Skip to content

Commit

Permalink
Update to Rollup 3.2.3 (#15038)
Browse files Browse the repository at this point in the history
* Update to Rollup 3.0.0

* fix

* fix

* test

* update rollup

* remove workaround

---------

Co-authored-by: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com>
  • Loading branch information
nicolo-ribaudo and liuxingbaoyu committed Aug 14, 2023
1 parent 9c5109b commit 866ea43
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 35 deletions.
26 changes: 15 additions & 11 deletions Gulpfile.mjs
Expand Up @@ -364,14 +364,16 @@ function buildRollup(packages, buildStandalone) {
// https://github.com/babel/babel-polyfills/blob/4ac92be5b70b13e3d8a34614d8ecd900eb3f40e4/packages/babel-helper-define-polyfill-provider/src/types.js#L5
// We can safely ignore this warning, and let Rollup replace it with undefined.
if (
warning.exporter === "packages/babel-core/src/index.ts" &&
warning.missing === "default" &&
warning.exporter
.replace(/\\/g, "/")
.endsWith("packages/babel-core/src/index.ts") &&
warning.binding === "default" &&
[
"@babel/helper-define-polyfill-provider",
"babel-plugin-polyfill-corejs2",
"babel-plugin-polyfill-corejs3",
"babel-plugin-polyfill-regenerator",
].some(pkg => warning.importer.includes(pkg))
].some(pkg => warning.id.replace(/\\/g, "/").includes(pkg))
) {
return;
}
Expand Down Expand Up @@ -417,7 +419,7 @@ function buildRollup(packages, buildStandalone) {
"./packages/babel-helper-create-regexp-features-plugin",
"regexpu-core",
"regenerate-unicode-properties"
) + "/**/*.js",
).replace(/\\/g, "/") + "/**/*.js", // Must be posix path in rollup 3
],
// Never delegate to the native require()
ignoreDynamicRequires: false,
Expand Down Expand Up @@ -515,22 +517,22 @@ function buildRollup(packages, buildStandalone) {
// We have manually applied commonjs-esm interop to the source
// for library not in this monorepo
// https://github.com/babel/babel/pull/12795
if (!id.startsWith("@babel/")) return false;
if (!id.startsWith("@babel/")) return "compat";

// Some syntax plugins have been archived
if (id.includes("plugin-syntax")) {
const srcPath = new URL(
"./packages/" + id.replace("@babel/", "babel-"),
import.meta.url
const srcPath = path.join(
path.dirname(fileURLToPath(import.meta.url)),
"/packages/" + id.replace("@babel/", "babel-")
);
if (!fs.existsSync(srcPath)) return false;
if (!fs.existsSync(srcPath)) return "compat";
}

if (id.includes("@babel/preset-modules")) {
return false;
return "compat";
}

return true;
return "auto";
},
});

Expand All @@ -554,6 +556,7 @@ function buildRollup(packages, buildStandalone) {
await bundle.write({
file: outputFile.replace(/\.js$/, ".min.js"),
format,
interop: "compat",
name,
sourcemap: sourcemap,
exports: "named",
Expand Down Expand Up @@ -837,6 +840,7 @@ gulp.task("build-cjs-bundles", () => {
await bundle.write({
file: output,
format: "cjs",
interop: "compat",
sourcemap: false,
});
})
Expand Down
2 changes: 1 addition & 1 deletion Makefile.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -71,7 +71,7 @@
"lint-staged": "^13.2.3",
"mergeiterator": "^1.4.4",
"prettier": "^3.0.0",
"rollup": "^2.79.1",
"rollup": "^3.2.3",
"rollup-plugin-dts": "^5.3.1",
"rollup-plugin-polyfill-node": "^0.12.0",
"semver": "^6.3.1",
Expand Down
16 changes: 1 addition & 15 deletions packages/babel-traverse/src/scope/binding.ts
Expand Up @@ -44,21 +44,7 @@ export default class Binding {
this.path = path;
this.kind = kind;

if (
(kind === "var" || kind === "hoisted") &&
// https://github.com/rollup/rollup/issues/4654
// Rollup removes the path argument from this call. Add an
// unreachable IIFE (that rollup doesn't know is unreachable)
// with side effects, to prevent it from messing up with arguments.
// You can reproduce this with
// BABEL_8_BREAKING=true make prepublish-build
isDeclaredInLoop(
path ||
(() => {
throw new Error("Internal Babel error: unreachable ");
})(),
)
) {
if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(path)) {
this.reassign(path);
}

Expand Down
28 changes: 21 additions & 7 deletions yarn.lock
Expand Up @@ -6730,7 +6730,7 @@ __metadata:
lint-staged: ^13.2.3
mergeiterator: ^1.4.4
prettier: ^3.0.0
rollup: ^2.79.1
rollup: ^3.2.3
rollup-plugin-dts: ^5.3.1
rollup-plugin-polyfill-node: ^0.12.0
semver: ^6.3.1
Expand Down Expand Up @@ -9869,15 +9869,15 @@ __metadata:
linkType: hard

"glob@npm:^8.0.3":
version: 8.1.0
resolution: "glob@npm:8.1.0"
version: 8.0.3
resolution: "glob@npm:8.0.3"
dependencies:
fs.realpath: ^1.0.0
inflight: ^1.0.4
inherits: 2
minimatch: ^5.0.1
once: ^1.3.0
checksum: 92fbea3221a7d12075f26f0227abac435de868dd0736a17170663783296d0dd8d3d532a5672b4488a439bf5d7fb85cdd07c11185d6cd39184f0385cbdfb86a47
checksum: 50bcdea19d8e79d8de5f460b1939ffc2b3299eac28deb502093fdca22a78efebc03e66bf54f0abc3d3d07d8134d19a32850288b7440d77e072aa55f9d33b18c5
languageName: node
linkType: hard

Expand Down Expand Up @@ -12472,11 +12472,11 @@ __metadata:
linkType: hard

"minimatch@npm:^5.0.1":
version: 5.1.6
resolution: "minimatch@npm:5.1.6"
version: 5.1.0
resolution: "minimatch@npm:5.1.0"
dependencies:
brace-expansion: ^2.0.1
checksum: 7564208ef81d7065a370f788d337cd80a689e981042cb9a1d0e6580b6c6a8c9279eba80010516e258835a988363f99f54a6f711a315089b8b42694f5da9d0d77
checksum: 15ce53d31a06361e8b7a629501b5c75491bc2b59712d53e802b1987121d91b433d73fcc5be92974fde66b2b51d8fb28d75a9ae900d249feb792bb1ba2a4f0a90
languageName: node
linkType: hard

Expand Down Expand Up @@ -14371,6 +14371,20 @@ __metadata:
languageName: node
linkType: hard

"rollup@npm:^3.2.3":
version: 3.2.3
resolution: "rollup@npm:3.2.3"
dependencies:
fsevents: ~2.3.2
dependenciesMeta:
fsevents:
optional: true
bin:
rollup: dist/bin/rollup
checksum: e4b4f3b70fad4b8f7dabc579fb8bbe14399d5aed0cc1fcee39f15ae81804d6acd0e1063b653e6cf5ef50e8e954801689e2c822e99ed31ca18f1b1fbbea8075e5
languageName: node
linkType: hard

"run-applescript@npm:^5.0.0":
version: 5.0.0
resolution: "run-applescript@npm:5.0.0"
Expand Down

0 comments on commit 866ea43

Please sign in to comment.