Skip to content

Commit

Permalink
use resolveChain instead of hardcoding n_m
Browse files Browse the repository at this point in the history
Co-Authored-By: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
  • Loading branch information
JLHwung and nicolo-ribaudo committed Feb 19, 2021
1 parent 6f2dd16 commit 5f8a3a0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Gulpfile.mjs
Expand Up @@ -237,6 +237,18 @@ function buildBabel(exclude) {
.pipe(gulp.dest(base));
}

/**
* Resolve a nested dependency starting from the given file
*/
export default function resolveChain(baseUrl, ...packages) {
const require = createRequire(baseUrl);

return packages.reduce(
(base, pkg) => require.resolve(pkg, { 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 @@ -294,7 +306,12 @@ function buildRollup(packages, targetBrowsers) {
],
dynamicRequireTargets: [
// https://github.com/mathiasbynens/regexpu-core/blob/ffd8fff2e31f4597f6fdfee75d5ac1c5c8111ec3/rewrite-pattern.js#L48
"node_modules/regenerate-unicode-properties/**",
resolveChain(
import.meta.url,
"./packages/babel-helper-create-regexp-features-plugin",
"regexpu-core",
"regenerate-unicode-properties/package.json"
) + "/../**",
],
}),
rollupBabel({
Expand Down

0 comments on commit 5f8a3a0

Please sign in to comment.