Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add regenerate-unicode-properties to dynamicRequireTargets #12819

Merged
merged 4 commits into from Feb 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions Gulpfile.mjs
Expand Up @@ -237,6 +237,19 @@ function buildBabel(exclude) {
.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
// the version number.
let versionSuffix = "";
Expand Down Expand Up @@ -292,6 +305,15 @@ function buildRollup(packages, targetBrowsers) {
"packages/babel-compat-data/*.js",
"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({
envName: babelEnvName,
Expand Down
7 changes: 7 additions & 0 deletions packages/babel-standalone/test/babel.js
Expand Up @@ -217,6 +217,13 @@
}),
).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();
});
});
},
);