fix: add regenerate-unicode-properties to dynamicRequireTargets (#12819)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
parent
3af936fc2b
commit
72961e4564
22
Gulpfile.mjs
22
Gulpfile.mjs
@ -237,6 +237,19 @@ function buildBabel(exclude) {
|
|||||||
.pipe(gulp.dest(base));
|
.pipe(gulp.dest(base));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve a nested dependency starting from the given file
|
||||||
|
*/
|
||||||
|
function resolveChain(baseUrl, ...packages) {
|
||||||
|
const require = createRequire(baseUrl);
|
||||||
|
|
||||||
|
return packages.reduce(
|
||||||
|
(base, pkg) =>
|
||||||
|
require.resolve(pkg + "/package.json", { paths: [path.dirname(base)] }),
|
||||||
|
fileURLToPath(baseUrl)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// If this build is part of a pull request, include the pull request number in
|
// If this build is part of a pull request, include the pull request number in
|
||||||
// the version number.
|
// the version number.
|
||||||
let versionSuffix = "";
|
let versionSuffix = "";
|
||||||
@ -292,6 +305,15 @@ function buildRollup(packages, targetBrowsers) {
|
|||||||
"packages/babel-compat-data/*.js",
|
"packages/babel-compat-data/*.js",
|
||||||
"packages/*/src/**/*.cjs",
|
"packages/*/src/**/*.cjs",
|
||||||
],
|
],
|
||||||
|
dynamicRequireTargets: [
|
||||||
|
// https://github.com/mathiasbynens/regexpu-core/blob/ffd8fff2e31f4597f6fdfee75d5ac1c5c8111ec3/rewrite-pattern.js#L48
|
||||||
|
resolveChain(
|
||||||
|
import.meta.url,
|
||||||
|
"./packages/babel-helper-create-regexp-features-plugin",
|
||||||
|
"regexpu-core",
|
||||||
|
"regenerate-unicode-properties"
|
||||||
|
) + "/../**",
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
rollupBabel({
|
rollupBabel({
|
||||||
envName: babelEnvName,
|
envName: babelEnvName,
|
||||||
|
|||||||
@ -217,6 +217,13 @@
|
|||||||
}),
|
}),
|
||||||
).not.toThrow();
|
).not.toThrow();
|
||||||
});
|
});
|
||||||
|
it("#12815 - unicode property letter short alias should be transformed", () => {
|
||||||
|
expect(() =>
|
||||||
|
Babel.transform("/\\p{L}/u", {
|
||||||
|
plugins: ["proposal-unicode-property-regex"],
|
||||||
|
}),
|
||||||
|
).not.toThrow();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user