diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +dist diff --git a/package.json b/package.json index ae6ff1e..6b92c58 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,9 @@ "module": "dist/rollup-plugin-postprocess.m.js", "source": "postprocess.js", "scripts": { + "lint": "eslint .", "prepare": "microbundle --external all --target node --format cjs,es --no-compress", - "test": "eslint postprocess.js && npm run -s prepare && node test", + "test": "npm run lint && npm run -s prepare && nyc node test", "release": "npm run -s prepare && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish" }, "eslintConfig": { @@ -27,15 +28,21 @@ "index.js", "dist" ], - "repository": "developit/rollup-plugin-postprocess", + "repository": "https://github.com/developit/rollup-plugin-postprocess", + "homepage": "https://github.com/developit/rollup-plugin-postprocess", + "bugs": "https://github.com/developit/rollup-plugin-postprocess/issues", "author": "Jason Miller (http://jasonformat.com)", + "contributors": [ + "Brett Zamir" + ], "license": "MIT", "devDependencies": { - "eslint": "^4.13.1", - "eslint-config-developit": "^1.1.1", - "microbundle": "^0.4.1" + "eslint": "^7.7.0", + "eslint-config-developit": "^1.2.0", + "microbundle": "^0.12.3", + "nyc": "^15.1.0" }, "dependencies": { - "magic-string": "^0.22.4" + "magic-string": "^0.25.7" } } diff --git a/postprocess.js b/postprocess.js index c2b902b..811e25d 100644 --- a/postprocess.js +++ b/postprocess.js @@ -6,7 +6,7 @@ const replacer = (str, index) => currentToken[index]; export default function postprocess(allReplacements) { return { name: 'postprocess', - transformBundle(code, { sourceMap, format }) { + renderChunk(code, { sourceMap, format }) { let str = new MagicString(code); let replacements = typeof allReplacements==='function' ? allReplacements({ code, sourceMap, format }) : allReplacements; @@ -38,4 +38,4 @@ export default function postprocess(allReplacements) { }; } }; -} \ No newline at end of file +} diff --git a/test.js b/test.js index ed481ed..cb3a127 100644 --- a/test.js +++ b/test.js @@ -1,12 +1,12 @@ /* eslint-disable */ -var assert = require('assert'); -var postprocess = require('.'); +const assert = require('assert'); +const postprocess = require('.'); -var code = 'function t(t,o,e,i){for(i=0,o=o.split?o.split("."):o;t&&i