Skip to content

Commit

Permalink
feat!: update dependency @rollup/plugin-commonjs to v21
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Oct 7, 2021
1 parent 8c83286 commit f4b235a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 25 deletions.
7 changes: 7 additions & 0 deletions .changeset/eight-windows-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@web/dev-server-rollup': minor
'@web/dev-server': minor
'@web/test-runner': minor
---

Update dependency @rollup/plugin-commonjs to v21
2 changes: 1 addition & 1 deletion packages/dev-server-rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@babel/plugin-transform-template-literals": "^7.12.1",
"@rollup/plugin-alias": "^3.1.1",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-commonjs": "^21.0.0",
"@rollup/plugin-node-resolve": "^11.0.1",
"@rollup/plugin-replace": "^3.0.0",
"@types/parse5": "^6.0.1",
Expand Down
38 changes: 18 additions & 20 deletions packages/dev-server-rollup/test/node/plugins/commonjs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ describe('@rollup/plugin-commonjs', () => {

try {
const text = await fetchText(`${host}/foo.js`);
expectIncludes(text, 'var foo_1 = "bar"; var lorem = "ipsum";');
expectIncludes(text, 'var foo_1 = foo.foo = "bar"; var lorem = foo.lorem = "ipsum"');
expectIncludes(text, 'export default foo;');
expectIncludes(text, 'export { foo_1 as foo };');
expectIncludes(text, 'export { lorem };');
expectIncludes(text, 'export { foo as __moduleExports, foo_1 as foo, lorem };');
} finally {
server.stop();
}
Expand Down Expand Up @@ -84,10 +83,12 @@ module.exports.lorem = lorem;`;
try {
const text = await fetchText(`${host}/foo.js`);

expectIncludes(text, 'export default foo_1;');
expectIncludes(text, 'export { foo_1 as __moduleExports };');
expectIncludes(text, 'export { foo_2 as foo }');
expectIncludes(text, 'export { lorem_1 as lorem }');
expectIncludes(text, 'var foo_2 = foo_1.foo = foo;');
expectIncludes(text, 'var lorem_1 = foo_1.lorem = lorem;');
expectIncludes(
text,
'export { foo_1 as __moduleExports, foo_2 as foo, lorem_1 as lorem, foo_1 as default };',
);
} finally {
server.stop();
}
Expand Down Expand Up @@ -116,20 +117,17 @@ exports.default = _default;`;
const text = await fetchText(`${host}/foo.js`);
expectIncludes(
text,
"import * as commonjsHelpers from '/__web-dev-server__/rollup/commonjsHelpers.js?web-dev-server-rollup-null-byte=%00commonjsHelpers.js';",
'import * as commonjsHelpers from "/__web-dev-server__/rollup/commonjsHelpers.js?web-dev-server-rollup-null-byte=%00commonjsHelpers.js"',
);
expectIncludes(
text,
'var foo = commonjsHelpers.createCommonjsModule(function (module, exports) {',
'import { __exports as foo } from "/__web-dev-server__/rollup/foo.js?web-dev-server-rollup-null-byte=%00',
);
expectIncludes(text, 'exports.__esModule = true;');
expectIncludes(text, 'exports.default = void 0;');
expectIncludes(text, 'foo.__esModule = true;');
expectIncludes(text, 'var default_1 = foo.default = void 0;');
expectIncludes(text, "var _default = 'foo';");
expectIncludes(text, 'exports.default = _default;');
expectIncludes(
text,
'export default /*@__PURE__*/commonjsHelpers.getDefaultExportFromCjs(foo);',
);
expectIncludes(text, 'default_1 = foo.default = _default;');
expectIncludes(text, 'export { foo as __moduleExports, default_1 as default };');
} finally {
server.stop();
}
Expand Down Expand Up @@ -158,13 +156,13 @@ exports.default = _default;`;

try {
const text = await fetchText(`${host}/foo.js`);
expectIncludes(text, "import './bar.js';");
expectIncludes(text, 'import "./bar.js"');
expectIncludes(
text,
"import bar from '/__web-dev-server__/rollup/bar.js?web-dev-server-rollup-null-byte=%00",
'import require$$0 from "/__web-dev-server__/rollup/bar.js?web-dev-server-rollup-null-byte=%00',
);
expectIncludes(text, 'export default foo;');
expectIncludes(text, 'export { bar_1 as bar };');
expectIncludes(text, 'const bar = require$$0; var bar_1 = foo.bar = bar;');
expectIncludes(text, 'export { foo as __moduleExports, bar_1 as bar };');
} finally {
server.stop();
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1634,10 +1634,10 @@
"@babel/helper-module-imports" "^7.10.4"
"@rollup/pluginutils" "^3.1.0"

"@rollup/plugin-commonjs@^18.0.0":
version "18.1.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-18.1.0.tgz#5a760d757af168a50727c0ae080251fbfcc5eb02"
integrity sha512-h3e6T9rUxVMAQswpDIobfUHn/doMzM9sgkMrsMWCFLmB84PSoC8mV8tOloAJjSRwdqhXBqstlX2BwBpHJvbhxg==
"@rollup/plugin-commonjs@^21.0.0":
version "21.0.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-21.0.0.tgz#b9e4342855ea20b5528f4587b9a90f642196a502"
integrity sha512-XDQimjHl0kNotAV5lLo34XoygaI0teqiKGJ100B3iCU8+15YscJPeqk2KqkqD3NIe1H8ZTUo5lYjUFZyEgASTw==
dependencies:
"@rollup/pluginutils" "^3.1.0"
commondir "^1.0.1"
Expand Down

0 comments on commit f4b235a

Please sign in to comment.