(packages: PackageInfo[], buildStandalone?: boolean)
| 330 | const babelVersion = |
| 331 | require("./packages/babel-core/package.json").version + versionSuffix; |
| 332 | function buildRollup(packages: PackageInfo[], buildStandalone?: boolean) { |
| 333 | const sourcemap = process.env.NODE_ENV === "production"; |
| 334 | return Promise.all( |
| 335 | packages.map( |
| 336 | async ({ |
| 337 | src, |
| 338 | format, |
| 339 | inputs, |
| 340 | dest, |
| 341 | name, |
| 342 | filename, |
| 343 | envName = "rollup", |
| 344 | pkgJSON, |
| 345 | }) => { |
| 346 | const version = pkgJSON.version + versionSuffix; |
| 347 | const { |
| 348 | dependencies = {}, |
| 349 | peerDependencies = {}, |
| 350 | imports = {}, |
| 351 | } = pkgJSON; |
| 352 | const external = [ |
| 353 | ...Object.keys(dependencies), |
| 354 | ...Object.keys(peerDependencies), |
| 355 | ...Object.keys(imports), |
| 356 | // @babel/compat-data sub exports |
| 357 | /@babel\/compat-data\/.*/, |
| 358 | // @babel/helper-globals sub exports |
| 359 | /@babel\/helper-globals\/.*/, |
| 360 | // Ideally they should be constructed from package.json exports |
| 361 | // required by modules-commonjs |
| 362 | /babel-plugin-dynamic-import-node\/utils/, |
| 363 | // required by preset-env |
| 364 | /@babel\/preset-modules\/.*/, |
| 365 | // required by babel-node |
| 366 | "core-js/stable/index.js", |
| 367 | "kexec", |
| 368 | // required by eslint-plugin |
| 369 | "eslint/use-at-your-own-risk", |
| 370 | ]; |
| 371 | |
| 372 | log( |
| 373 | `Compiling '${styleText("cyan", inputs.join(", "))}' with rollup ...` |
| 374 | ); |
| 375 | const bundle = await rollup({ |
| 376 | input: Object.fromEntries( |
| 377 | inputs.map(inputName => [ |
| 378 | filename || |
| 379 | // ./packages/babel-foo/src/bar/baz.ts -> bar/baz.js |
| 380 | inputName |
| 381 | .replaceAll("\\", "/") |
| 382 | .split("/") |
| 383 | .slice(4) |
| 384 | .join("/") |
| 385 | .replace(/(\.[cm]?)ts$/, "$1js"), |
| 386 | inputName, |
| 387 | ]) |
| 388 | ), |
| 389 | external: buildStandalone ? [] : external, |
no test coverage detected
searching dependent graphs…