diff --git a/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js b/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js index 3991e16c4..4ebde6947 100644 --- a/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js +++ b/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js @@ -71,7 +71,7 @@ describe("constant-folding-plugin", () => { expect(transform(source)).toBe(source); }); - it("should handle script escape", () => { + xit("should handle script escape", () => { const source = unpad( ` " { "<\\\\/script"; ` ); - expect(transform(source, { isScriptContext: true })).toBe(expected); + expect(transform(source)).toBe(expected); }); - it("should handle style escape", () => { + xit("should handle style escape", () => { const source = unpad( ` " { "<\\\\/style"; ` ); - expect(transform(source, { isScriptContext: true })).toBe(expected); + expect(transform(source)).toBe(expected); }); - it("should handle html comment escape", () => { + xit("should handle html comment escape", () => { const source = unpad( ` " { "\\\\x3C!--"; ` ); - expect(transform(source, { isScriptContext: true })).toBe(expected); + expect(transform(source)).toBe(expected); }); it("should fix #440", () => { diff --git a/packages/babel-plugin-minify-constant-folding/package.json b/packages/babel-plugin-minify-constant-folding/package.json index 0a4581985..f7e1d0328 100644 --- a/packages/babel-plugin-minify-constant-folding/package.json +++ b/packages/babel-plugin-minify-constant-folding/package.json @@ -12,8 +12,6 @@ "babel-plugin" ], "dependencies": { - "babel-helper-evaluate-path": "^0.0.3", - "jsesc": "^2.4.0" - }, - "devDependencies": {} + "babel-helper-evaluate-path": "^0.0.3" + } } diff --git a/packages/babel-plugin-minify-constant-folding/src/index.js b/packages/babel-plugin-minify-constant-folding/src/index.js index 3594fae1c..f9826e5c7 100644 --- a/packages/babel-plugin-minify-constant-folding/src/index.js +++ b/packages/babel-plugin-minify-constant-folding/src/index.js @@ -1,7 +1,6 @@ "use strict"; const evaluate = require("babel-helper-evaluate-path"); -const jsesc = require("jsesc"); module.exports = ({ types: t, traverse }) => { const seen = Symbol("seen"); @@ -55,7 +54,7 @@ module.exports = ({ types: t, traverse }) => { }, // TODO: look into evaluating binding too (could result in more code, but gzip?) - Expression(path, { opts: { isScriptContext = false } }) { + Expression(path) { const { node } = path; if (node[seen]) { @@ -121,11 +120,6 @@ module.exports = ({ types: t, traverse }) => { } } - // https://github.com/babel/babili/issues/382 - if (typeof res.value === "string" && isScriptContext) { - res.value = jsesc(res.value, { isScriptContext }); - } - const node = t.valueToNode(res.value); node[seen] = true; path.replaceWith(node);