Skip to content

Commit 9395599

Browse files
committed
fix(alias,auto-install,babel,beep,buble,commonjs,data-uri,dsv,dynamic-import-vars,eslint,esm-shim,graphql,html,image,inject,json,legacy,multi-entry,node-resolve,pluginutils,replace,run,strip,sucrase,swc,terser,typescript,url,virtual,wasm,yaml): ensure rollup 4 compatibility
1 parent 4fcc32a commit 9395599

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+460
-418
lines changed

.github/workflows/node-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
run: pnpm install --ignore-scripts
4848

4949
- name: run tests
50-
run: pnpm --filter "...[origin/master]" ci:test
50+
run: pnpm --workspace-concurrency 1 --filter "...[origin/master]" ci:test

packages/alias/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"alias"
5252
],
5353
"peerDependencies": {
54-
"rollup": "^1.20.0||^2.0.0||^3.0.0"
54+
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
5555
},
5656
"peerDependenciesMeta": {
5757
"rollup": {
@@ -65,7 +65,7 @@
6565
"@rollup/plugin-node-resolve": "^15.0.0",
6666
"@rollup/plugin-typescript": "^9.0.1",
6767
"del-cli": "^5.0.0",
68-
"rollup": "^3.2.3",
68+
"rollup": "^4.0.0-24",
6969
"typescript": "^4.8.3"
7070
},
7171
"types": "./types/index.d.ts",

packages/alias/test/test.mjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ test('Forwards isEntry and custom options to a custom resolver', (t) => {
455455
{
456456
source: 'nonEntry',
457457
importer: '/src/importer.js',
458-
options: { assertions: {}, isEntry: false, custom: { test: 42 } }
458+
options: { attributes: {}, isEntry: false, custom: { test: 42 } }
459459
}
460460
]
461461
).then((result) => {
@@ -464,7 +464,7 @@ test('Forwards isEntry and custom options to a custom resolver', (t) => {
464464
'entry-point',
465465
'/src/importer.js',
466466
{
467-
assertions: {},
467+
attributes: {},
468468
custom: void 0,
469469
isEntry: true
470470
}
@@ -473,7 +473,7 @@ test('Forwards isEntry and custom options to a custom resolver', (t) => {
473473
'non-entry-point',
474474
'/src/importer.js',
475475
{
476-
assertions: {},
476+
attributes: {},
477477
custom: { test: 42 },
478478
isEntry: false
479479
}
@@ -514,7 +514,7 @@ test('Forwards isEntry and custom options to other plugins', (t) => {
514514
'entry-point',
515515
'/src/importer.js',
516516
{
517-
assertions: {},
517+
attributes: {},
518518
custom: void 0,
519519
isEntry: true
520520
}
@@ -523,7 +523,7 @@ test('Forwards isEntry and custom options to other plugins', (t) => {
523523
'non-entry-point',
524524
'/src/importer.js',
525525
{
526-
assertions: {},
526+
attributes: {},
527527
custom: { test: 42 },
528528
isEntry: false
529529
}

packages/auto-install/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"modules"
5454
],
5555
"peerDependencies": {
56-
"rollup": "^1.20.0||^2.0.0||^3.0.0"
56+
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
5757
},
5858
"peerDependenciesMeta": {
5959
"rollup": {
@@ -65,7 +65,7 @@
6565
"@rollup/plugin-typescript": "^9.0.1",
6666
"del": "^6.1.1",
6767
"node-noop": "^1.0.0",
68-
"rollup": "^3.2.3",
68+
"rollup": "^4.0.0-24",
6969
"typescript": "^4.8.3"
7070
},
7171
"types": "./types/index.d.ts",

packages/babel/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"peerDependencies": {
5656
"@babel/core": "^7.0.0",
5757
"@types/babel__core": "^7.1.9",
58-
"rollup": "^1.20.0||^2.0.0||^3.0.0"
58+
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
5959
},
6060
"peerDependenciesMeta": {
6161
"rollup": {
@@ -79,7 +79,7 @@
7979
"@rollup/plugin-json": "^5.0.0",
8080
"@rollup/plugin-node-resolve": "^15.0.0",
8181
"@types/babel__core": "^7.1.9",
82-
"rollup": "^3.2.3",
82+
"rollup": "^4.0.0-24",
8383
"source-map": "^0.7.4"
8484
},
8585
"types": "./types/index.d.ts",

packages/babel/test/as-output-plugin.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ test('transforms all chunks in a code-splitting setup', async (t) => {
222222
t.deepEqual(
223223
output.map(({ code }) => code),
224224
[
225-
`import('./dep-20aaf50b.js').then(function (result) {
225+
`import('./dep--s88I99N.js').then(function (result) {
226226
return console.log(result);
227227
});
228228
`,

packages/beep/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@
3737
"rollup"
3838
],
3939
"peerDependencies": {
40-
"rollup": "^1.20.0||^2.0.0||^3.0.0"
40+
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
4141
},
4242
"peerDependenciesMeta": {
4343
"rollup": {
4444
"optional": true
4545
}
4646
},
4747
"devDependencies": {
48-
"rollup": "^3.2.3",
48+
"rollup": "^4.0.0-24",
4949
"strip-ansi": "^7.0.1"
5050
},
5151
"types": "types/index.d.ts",

packages/buble/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"modules"
5454
],
5555
"peerDependencies": {
56-
"rollup": "^1.20.0||^2.0.0||^3.0.0"
56+
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
5757
},
5858
"peerDependenciesMeta": {
5959
"rollup": {
@@ -68,7 +68,7 @@
6868
"devDependencies": {
6969
"@rollup/plugin-typescript": "^9.0.1",
7070
"del-cli": "^5.0.0",
71-
"rollup": "^3.2.3",
71+
"rollup": "^4.0.0-24",
7272
"source-map": "^0.7.4",
7373
"typescript": "^4.8.3"
7474
},

packages/commonjs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"require"
5555
],
5656
"peerDependencies": {
57-
"rollup": "^2.68.0||^3.0.0"
57+
"rollup": "^2.68.0||^3.0.0||^4.0.0"
5858
},
5959
"peerDependenciesMeta": {
6060
"rollup": {
@@ -74,7 +74,7 @@
7474
"@rollup/plugin-node-resolve": "^15.0.0",
7575
"locate-character": "^2.0.5",
7676
"require-relative": "^0.8.7",
77-
"rollup": "^3.19.0",
77+
"rollup": "^4.0.0-24",
7878
"shx": "^0.3.4",
7979
"source-map": "^0.7.4",
8080
"source-map-support": "^0.5.21",

packages/commonjs/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ export default function commonjs(options = {}) {
306306
try {
307307
return transformAndCheckExports.call(this, code, id);
308308
} catch (err) {
309-
return this.error(err, err.loc);
309+
return this.error(err, err.pos);
310310
}
311311
}
312312
};

packages/commonjs/src/resolve-require-sources.js

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export function getRequireResolver(extensions, detectCyclesAndConditional, curre
170170
currentlyResolvingForParent.add(source);
171171
const resolved =
172172
(await rollupContext.resolve(source, parentId, {
173+
skipSelf: false,
173174
custom: { 'node-resolve': { isRequire: true } }
174175
})) || resolveExtensions(source, parentId, extensions);
175176
currentlyResolvingForParent.delete(source);

packages/commonjs/src/transform-commonjs.js

+3
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ export default async function transformCommonjs(
300300
}
301301
if (!ignoreDynamicRequires) {
302302
if (isShorthandProperty(parent)) {
303+
// as key and value are the same object, isReference regards
304+
// both as references, so we need to skip now
305+
skippedNodes.add(parent.value);
303306
magicString.prependRight(node.start, 'require: ');
304307
}
305308
replacedDynamicRequires.push(node);

packages/commonjs/test/fixtures/function/custom-options/_config.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ module.exports = {
1313
plugins: [
1414
{
1515
async buildStart() {
16-
await this.resolve('./other.js', ID_MAIN, { isEntry: true, custom: { test: 42 } });
16+
await this.resolve('./other.js', ID_MAIN, {
17+
skipSelf: false,
18+
isEntry: true,
19+
custom: { test: 42 }
20+
});
1721
},
1822
buildEnd() {
1923
assert.deepStrictEqual(resolveIdArgs, [
20-
['other.js', 'main.js', { assertions: {}, custom: { test: 42 }, isEntry: true }],
21-
['main.js', void 0, { assertions: {}, custom: {}, isEntry: true }]
24+
['other.js', 'main.js', { attributes: {}, custom: { test: 42 }, isEntry: true }],
25+
['main.js', void 0, { attributes: {}, custom: {}, isEntry: true }]
2226
]);
2327
},
2428
resolveId(source, importer, options) {

0 commit comments

Comments
 (0)