Skip to content

Commit

Permalink
fix(alias,auto-install,babel,beep,buble,commonjs,data-uri,dsv,dynamic…
Browse files Browse the repository at this point in the history
…-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 (#1595)
  • Loading branch information
lukastaegert authored Oct 5, 2023
1 parent 4fcc32a commit 841a039
Show file tree
Hide file tree
Showing 63 changed files with 462 additions and 415 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
run: pnpm install --ignore-scripts

- name: run tests
run: pnpm --filter "...[origin/master]" ci:test
run: pnpm --workspace-concurrency 1 --filter "...[origin/master]" ci:test
4 changes: 2 additions & 2 deletions packages/alias/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"alias"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -65,7 +65,7 @@
"@rollup/plugin-node-resolve": "^15.0.0",
"@rollup/plugin-typescript": "^9.0.1",
"del-cli": "^5.0.0",
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"typescript": "^4.8.3"
},
"types": "./types/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions packages/alias/test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ test('Forwards isEntry and custom options to a custom resolver', (t) => {
{
source: 'nonEntry',
importer: '/src/importer.js',
options: { assertions: {}, isEntry: false, custom: { test: 42 } }
options: { attributes: {}, isEntry: false, custom: { test: 42 } }
}
]
).then((result) => {
Expand All @@ -464,7 +464,7 @@ test('Forwards isEntry and custom options to a custom resolver', (t) => {
'entry-point',
'/src/importer.js',
{
assertions: {},
attributes: {},
custom: void 0,
isEntry: true
}
Expand All @@ -473,7 +473,7 @@ test('Forwards isEntry and custom options to a custom resolver', (t) => {
'non-entry-point',
'/src/importer.js',
{
assertions: {},
attributes: {},
custom: { test: 42 },
isEntry: false
}
Expand Down Expand Up @@ -514,7 +514,7 @@ test('Forwards isEntry and custom options to other plugins', (t) => {
'entry-point',
'/src/importer.js',
{
assertions: {},
attributes: {},
custom: void 0,
isEntry: true
}
Expand All @@ -523,7 +523,7 @@ test('Forwards isEntry and custom options to other plugins', (t) => {
'non-entry-point',
'/src/importer.js',
{
assertions: {},
attributes: {},
custom: { test: 42 },
isEntry: false
}
Expand Down
4 changes: 2 additions & 2 deletions packages/auto-install/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"modules"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -65,7 +65,7 @@
"@rollup/plugin-typescript": "^9.0.1",
"del": "^6.1.1",
"node-noop": "^1.0.0",
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"typescript": "^4.8.3"
},
"types": "./types/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"peerDependencies": {
"@babel/core": "^7.0.0",
"@types/babel__core": "^7.1.9",
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -79,7 +79,7 @@
"@rollup/plugin-json": "^5.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@types/babel__core": "^7.1.9",
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"source-map": "^0.7.4"
},
"types": "./types/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel/test/as-output-plugin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ test('transforms all chunks in a code-splitting setup', async (t) => {
t.deepEqual(
output.map(({ code }) => code),
[
`import('./dep-20aaf50b.js').then(function (result) {
`import('./dep--s88I99N.js').then(function (result) {
return console.log(result);
});
`,
Expand Down
4 changes: 2 additions & 2 deletions packages/beep/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
"rollup"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
},
"devDependencies": {
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"strip-ansi": "^7.0.1"
},
"types": "types/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/buble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"modules"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -68,7 +68,7 @@
"devDependencies": {
"@rollup/plugin-typescript": "^9.0.1",
"del-cli": "^5.0.0",
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"source-map": "^0.7.4",
"typescript": "^4.8.3"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"require"
],
"peerDependencies": {
"rollup": "^2.68.0||^3.0.0"
"rollup": "^2.68.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -74,7 +74,7 @@
"@rollup/plugin-node-resolve": "^15.0.0",
"locate-character": "^2.0.5",
"require-relative": "^0.8.7",
"rollup": "^3.19.0",
"rollup": "^4.0.0-24",
"shx": "^0.3.4",
"source-map": "^0.7.4",
"source-map-support": "^0.5.21",
Expand Down
2 changes: 1 addition & 1 deletion packages/commonjs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export default function commonjs(options = {}) {
try {
return transformAndCheckExports.call(this, code, id);
} catch (err) {
return this.error(err, err.loc);
return this.error(err, err.pos);
}
}
};
Expand Down
1 change: 1 addition & 0 deletions packages/commonjs/src/resolve-require-sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export function getRequireResolver(extensions, detectCyclesAndConditional, curre
currentlyResolvingForParent.add(source);
const resolved =
(await rollupContext.resolve(source, parentId, {
skipSelf: false,
custom: { 'node-resolve': { isRequire: true } }
})) || resolveExtensions(source, parentId, extensions);
currentlyResolvingForParent.delete(source);
Expand Down
3 changes: 3 additions & 0 deletions packages/commonjs/src/transform-commonjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ export default async function transformCommonjs(
}
if (!ignoreDynamicRequires) {
if (isShorthandProperty(parent)) {
// as key and value are the same object, isReference regards
// both as references, so we need to skip now
skippedNodes.add(parent.value);
magicString.prependRight(node.start, 'require: ');
}
replacedDynamicRequires.push(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ module.exports = {
plugins: [
{
async buildStart() {
await this.resolve('./other.js', ID_MAIN, { isEntry: true, custom: { test: 42 } });
await this.resolve('./other.js', ID_MAIN, {
skipSelf: false,
isEntry: true,
custom: { test: 42 }
});
},
buildEnd() {
assert.deepStrictEqual(resolveIdArgs, [
['other.js', 'main.js', { assertions: {}, custom: { test: 42 }, isEntry: true }],
['main.js', void 0, { assertions: {}, custom: {}, isEntry: true }]
['other.js', 'main.js', { attributes: {}, custom: { test: 42 }, isEntry: true }],
['main.js', void 0, { attributes: {}, custom: {}, isEntry: true }]
]);
},
resolveId(source, importer, options) {
Expand Down
Loading

0 comments on commit 841a039

Please sign in to comment.