From 66d93bed8ee53a8327a52725d02c3ff5b0e8af78 Mon Sep 17 00:00:00 2001 From: aMarCruz Date: Fri, 18 Jan 2019 12:58:00 -0600 Subject: [PATCH] Closes #15 --- CHANGELOG.md | 10 ++++++++ README.md | 4 ++++ package.json | 8 +++---- test/index.js | 22 ++++++++++++++++++ yarn.lock | 63 ++++++++++++++++++++++++--------------------------- 5 files changed, 69 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b787b47..48d8ddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # rollup-plugin-cleanup changes +## \[3.1.1] - 2019-01-18 + +### Changed + +- Update dependencies. + +### Fixed + +- #15 : Version 3.1.0 fails for certain template literals. Thanks to @stotter for repoting this issue. + ## \[3.1.0] - 2018-12-27 Bye, acorn. diff --git a/README.md b/README.md index c58e5e3..8cc5cc3 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,10 @@ const cleanedCode = jsCleanup(code, null, { comments: ['eslint', /^\*-/] }) ## What's New +Changes in v3.1.1 + +- Fixed #15: Version 3.1.0 fails for certain template literals. Thanks to @stotter for repoting this issue. + Changes in v3.1.0 Bye, acorn. diff --git a/package.json b/package.json index 6ed642b..7f14a6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup-plugin-cleanup", - "version": "3.1.0", + "version": "3.1.1", "description": "Rollup plugin to trim trailing spaces, compact empty lines, and normalize line endings", "main": "dist/rollup-plugin-cleanup.js", "module": "dist/rollup-plugin-cleanup.es.js", @@ -47,11 +47,11 @@ }, "homepage": "https://github.com/aMarCruz/rollup-plugin-cleanup", "dependencies": { - "js-cleanup": "^1.0.0", - "rollup-pluginutils": "^2.3.0" + "js-cleanup": "^1.0.1", + "rollup-pluginutils": "^2.3.3" }, "devDependencies": { - "eslint": "^5.11.0", + "eslint": "^5.12.0", "expect": "1.20.2", "mocha": "^5.2.0", "nyc": "^13.1.0", diff --git a/test/index.js b/test/index.js index bef9342..7534b27 100644 --- a/test/index.js +++ b/test/index.js @@ -273,6 +273,28 @@ describe('Issues', function () { return testFile('issue_11') }) + it('#15 must handle "$" ending the string', function () { + const opts = { + sourceMap: false, + } + /* eslint-disable no-template-curly-in-string */ + const result = [ + 'const s = `${v}$`', + 'const s = `$${v}$`', + 'const s = `${v}$$`', + 'const s = `\\$`', + 'const s = `$0`', + 'const s = `$$`', + 'const s = `$`', + ].map(function (str) { + return cleanup(opts).transform(str, 'a.js').then((res) => { + expect(res.code).toBe(str) + }) + }) + /* eslint-enable no-template-curly-in-string */ + return Promise.all(result) + }) + }) diff --git a/yarn.lock b/yarn.lock index ac6cc0c..cf566a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -274,17 +274,10 @@ caching-transform@^2.0.0: package-hash "^2.0.0" write-file-atomic "^2.0.0" -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= - dependencies: - callsites "^0.2.0" - -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= +callsites@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3" + integrity sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw== camelcase@^4.1.0: version "4.1.0" @@ -558,10 +551,10 @@ eslint-visitor-keys@^1.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== -eslint@^5.11.0: - version "5.11.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.11.1.tgz#8deda83db9f354bf9d3f53f9677af7e0e13eadda" - integrity sha512-gOKhM8JwlFOc2acbOrkYR05NW8M6DCMSvfcJiBB5NDxRE1gv8kbvxKaC9u69e6ZGEMWXcswA/7eKR229cEIpvg== +eslint@^5.12.0: + version "5.12.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.12.0.tgz#fab3b908f60c52671fb14e996a450b96c743c859" + integrity sha512-LntwyPxtOHrsJdcSwyQKVtHofPHdv+4+mFwEe91r2V13vqpM8yLr7b1sW+Oo/yheOPkWYsYlYJCkzlFAt8KV7g== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.5.3" @@ -580,6 +573,7 @@ eslint@^5.11.0: glob "^7.1.2" globals "^11.7.0" ignore "^4.0.6" + import-fresh "^3.0.0" imurmurhash "^0.1.4" inquirer "^6.1.0" js-yaml "^3.12.0" @@ -594,7 +588,6 @@ eslint@^5.11.0: pluralize "^7.0.0" progress "^2.0.0" regexpp "^2.0.1" - require-uncached "^1.0.3" semver "^5.5.1" strip-ansi "^4.0.0" strip-json-comments "^2.0.1" @@ -959,6 +952,14 @@ ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== +import-fresh@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390" + integrity sha512-pOnA9tfM3Uwics+SaBLCNyZZZbK+4PTu0OPZtLlMIrv17EdBoC15S9Kn8ckJ9TZTyKb3ywNE5y1yeDxxGA7nTQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -1228,10 +1229,10 @@ istanbul-reports@^2.0.1: dependencies: handlebars "^4.0.11" -js-cleanup@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/js-cleanup/-/js-cleanup-1.0.0.tgz#a3aad18a23a1752e9fa005f9128e65d601d2d634" - integrity sha512-gT33849UQki2Ek5NJM9eCH1ZEMjzMfyE881kmfv51hxO4K+TgH+qBIt9RZjczrV02wFqNDSVCk8pE9p78I3cIw== +js-cleanup@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/js-cleanup/-/js-cleanup-1.0.1.tgz#1d38080c7ee92e1d2d2b94054d0a33c48951e0df" + integrity sha512-wyHeWKqbcQV78/tiMJ6pgJrkG7p2u3b2xX9IJFvvurpJL9/++89dHfkUebhWvSMS84LG0uQ7BnG5GGyAzY21Ag== dependencies: magic-string "^0.25.1" perf-regexes "^1.0.1" @@ -1938,6 +1939,13 @@ package-hash@^2.0.0: md5-hex "^2.0.0" release-zalgo "^1.0.0" +parent-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.0.tgz#df250bdc5391f4a085fb589dad761f5ad6b865b5" + integrity sha512-8Mf5juOMmiE4FcmzYc4IaiS9L3+9paz2KOiXzkRviCP6aDmN49Hz6EMWz0lGNp9pX80GvvAuLADtyGfW/Em3TA== + dependencies: + callsites "^3.0.0" + parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" @@ -2174,19 +2182,6 @@ require-main-filename@^1.0.1: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= - resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" @@ -2232,7 +2227,7 @@ rollup-pluginutils@^1.3.1: estree-walker "^0.2.1" minimatch "^3.0.2" -rollup-pluginutils@^2.3.0, rollup-pluginutils@^2.3.3: +rollup-pluginutils@^2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz#3aad9b1eb3e7fe8262820818840bf091e5ae6794" integrity sha512-2XZwja7b6P5q4RZ5FhyX1+f46xi1Z3qBKigLRZ6VTZjwbN0K1IFGMlwm06Uu0Emcre2Z63l77nq/pzn+KxIEoA==