Skip to content

Commit

Permalink
feat:✨remove unused specifier
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyuehui.yyh committed Mar 19, 2024
1 parent a44b42f commit a6f4f12
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
const assert = require("assert");
const { parseBuildResult } = require("../../../scripts/test-utils");
const { parseBuildResult, moduleReg } = require("../../../scripts/test-utils");
const { files } = parseBuildResult(__dirname);

const content = files["index.js"];

assert(
content.includes("/a.js") &&
!content.includes("_a"),
`should remove default specifier`
assert.match(
content,
moduleReg(
"src/index.js",
`__mako_require__\\("src/a.js"\\);[\\s\\S]*__mako_require__\\("src/b.js"\\);[\\s\\S]*__mako_require__\\("src/c.js"\\);`
),
`should remove namespace specifier`
);

assert(
content.includes("/b.js") &&
!content.includes("_b"),
`should remove namespace specifier`
);

assert(
content.includes("/c.js") &&
!content.includes("_c"),
`should remove namespace specifier`
);
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ const a = 'a';

console.log('aaa');

export default a;
export default a;
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ const b = 'b';

console.log('bbb');

export default b;
export default b;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
console.log('ccc');

export const c = 'c';
export const cc = 'cc';
export const cc = 'cc';

0 comments on commit a6f4f12

Please sign in to comment.