rolldown 0.15.0-snapshot-c66278b-20241208003838 → 0.15.0-snapshot-86db816-20241210003559

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-BK2Ye-xa.cjs');
3
- const require_src = require('../shared/src-BYmJViz6.cjs');
3
+ const require_src = require('../shared/src-BAggR2QM.cjs');
4
4
  const require_consola_36c0034f = require('../shared/consola_36c0034f-_8_dG1Nr.cjs');
5
5
  const zod = require_chunk.__toESM(require("zod"));
6
6
  const node_path = require_chunk.__toESM(require("node:path"));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-BK2Ye-xa.cjs');
3
- const require_src = require('../shared/src-BYmJViz6.cjs');
3
+ const require_src = require('../shared/src-BAggR2QM.cjs');
4
4
  const node_url = require_chunk.__toESM(require("node:url"));
5
5
 
6
6
  //#region src/plugin/parallel-plugin.ts
@@ -1,4 +1,4 @@
1
- const require_src = require('../shared/src-BYmJViz6.cjs');
1
+ const require_src = require('../shared/src-BAggR2QM.cjs');
2
2
 
3
3
  exports.VERSION = require_src.VERSION
4
4
  exports.build = require_src.build
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-BK2Ye-xa.cjs');
3
- const require_src = require('../shared/src-BYmJViz6.cjs');
3
+ const require_src = require('../shared/src-BAggR2QM.cjs');
4
4
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
5
5
 
6
6
  //#region src/parallel-plugin-worker.ts
package/dist/esm/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, __export, arraify, description, rolldown, version, watch } from "../shared/src-CKZ4-qVz.mjs";
2
- import { createConsola } from "../shared/consola_36c0034f-B6fL2Jf_.mjs";
3
- import { ZodFirstPartyTypeKind, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$1, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$2, z, z as z$1, z as z$2, z as z$3 } from "zod";
1
+ import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, __export, arraify, description, rolldown, version, watch } from "../shared/src-BAGIbE8g.mjs";
2
+ import { createConsola } from "../shared/consola_36c0034f-D9ce-831.mjs";
3
+ import { ZodFirstPartyTypeKind, z } from "zod";
4
4
  import nodePath, { default as path } from "node:path";
5
5
  import process$1, { env } from "node:process";
6
6
  import { performance } from "node:perf_hooks";
@@ -439,7 +439,7 @@ function printOutputEntries(entries, sizeAdjustment, distPath) {
439
439
  for (const group of CHUNK_GROUPS) {
440
440
  const filtered = entries.filter((e) => e.type === group.type);
441
441
  if (!filtered.length) continue;
442
- for (const entry of filtered.sort((a, z$4) => a.size - z$4.size)) {
442
+ for (const entry of filtered.sort((a, z$1) => a.size - z$1.size)) {
443
443
  let log = dim(withTrailingSlash(distPath));
444
444
  log += colors_exports[group.color](entry.fileName.padEnd(sizeAdjustment.longest + 2));
445
445
  log += dim(entry.type);
@@ -541,7 +541,7 @@ function parseAnyDef() {
541
541
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
542
542
  function parseArrayDef(def, refs) {
543
543
  const res = { type: "array" };
544
- if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind$2.ZodAny) res.items = parseDef(def.type._def, {
544
+ if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) res.items = parseDef(def.type._def, {
545
545
  ...refs,
546
546
  currentPath: [...refs.currentPath, "items"]
547
547
  });
@@ -950,7 +950,7 @@ else if (!inCharGroup && source[i] === "[") inCharGroup = true;
950
950
  //#endregion
951
951
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
952
952
  function parseRecordDef(def, refs) {
953
- if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodEnum) return {
953
+ if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {
954
954
  type: "object",
955
955
  required: def.keyType._def.values,
956
956
  properties: def.keyType._def.values.reduce((acc, key) => ({
@@ -974,17 +974,17 @@ function parseRecordDef(def, refs) {
974
974
  }) ?? {}
975
975
  };
976
976
  if (refs.target === "openApi3") return schema$1;
977
- if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodString && def.keyType._def.checks?.length) {
977
+ if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
978
978
  const { type,...keyType } = parseStringDef(def.keyType._def, refs);
979
979
  return {
980
980
  ...schema$1,
981
981
  propertyNames: keyType
982
982
  };
983
- } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodEnum) return {
983
+ } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {
984
984
  ...schema$1,
985
985
  propertyNames: { enum: def.keyType._def.values }
986
986
  };
987
- else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind$1.ZodString && def.keyType._def.type._def.checks?.length) {
987
+ else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
988
988
  const { type,...keyType } = parseBrandedDef(def.keyType._def, refs);
989
989
  return {
990
990
  ...schema$1,
@@ -1492,86 +1492,86 @@ else if (refs.target === "jsonSchema2019-09") combined.$schema = "https://json-s
1492
1492
 
1493
1493
  //#endregion
1494
1494
  //#region src/utils/zod-ext.ts
1495
- const stringOrRegExp = () => z$3.string().or(z$3.instanceof(RegExp));
1496
- const optionalStringArray = () => z$3.string().array().optional();
1495
+ const stringOrRegExp = () => z.string().or(z.instanceof(RegExp));
1496
+ const optionalStringArray = () => z.string().array().optional();
1497
1497
  const returnTrue = () => true;
1498
- const phantom = () => z$3.custom(returnTrue);
1498
+ const phantom = () => z.custom(returnTrue);
1499
1499
  const voidNullableWith = (t) => {
1500
1500
  return voidNullable().or(t);
1501
1501
  };
1502
1502
  const voidNullable = () => {
1503
- return z$3.void().or(z$3.null()).or(z$3.undefined());
1503
+ return z.void().or(z.null()).or(z.undefined());
1504
1504
  };
1505
1505
 
1506
1506
  //#endregion
1507
1507
  //#region src/options/input-options-schema.ts
1508
- const inputOptionSchema = z$2.string().or(z$2.string().array()).or(z$2.record(z$2.string()));
1509
- const externalSchema = stringOrRegExp().or(stringOrRegExp().array()).or(z$2.function().args(z$2.string(), z$2.string().optional(), z$2.boolean()).returns(voidNullableWith(z$2.boolean())));
1510
- const moduleTypesSchema = z$2.record(z$2.literal("js").or(z$2.literal("jsx")).or(z$2.literal("ts")).or(z$2.literal("tsx")).or(z$2.literal("json")).or(z$2.literal("text")).or(z$2.literal("base64")).or(z$2.literal("dataurl")).or(z$2.literal("binary")).or(z$2.literal("empty")).or(z$2.literal("css")));
1511
- const jsxOptionsSchema = z$2.strictObject({
1512
- mode: z$2.literal("classic").or(z$2.literal("automatic")).describe("Jsx transformation mode").optional(),
1513
- factory: z$2.string().describe("Jsx element transformation").optional(),
1514
- fragment: z$2.string().describe("Jsx fragment transformation").optional(),
1515
- importSource: z$2.string().describe("Import the factory of element and fragment if mode is classic").optional(),
1516
- jsxImportSource: z$2.string().describe("Import the factory of element and fragment if mode is automatic").optional(),
1517
- refresh: z$2.boolean().describe("React refresh transformation").optional(),
1518
- development: z$2.boolean().describe("Development specific information").optional()
1508
+ const inputOptionSchema = z.string().or(z.string().array()).or(z.record(z.string()));
1509
+ const externalSchema = stringOrRegExp().or(stringOrRegExp().array()).or(z.function().args(z.string(), z.string().optional(), z.boolean()).returns(voidNullableWith(z.boolean())));
1510
+ const moduleTypesSchema = z.record(z.literal("js").or(z.literal("jsx")).or(z.literal("ts")).or(z.literal("tsx")).or(z.literal("json")).or(z.literal("text")).or(z.literal("base64")).or(z.literal("dataurl")).or(z.literal("binary")).or(z.literal("empty")).or(z.literal("css")));
1511
+ const jsxOptionsSchema = z.strictObject({
1512
+ mode: z.literal("classic").or(z.literal("automatic")).describe("Jsx transformation mode").optional(),
1513
+ factory: z.string().describe("Jsx element transformation").optional(),
1514
+ fragment: z.string().describe("Jsx fragment transformation").optional(),
1515
+ importSource: z.string().describe("Import the factory of element and fragment if mode is classic").optional(),
1516
+ jsxImportSource: z.string().describe("Import the factory of element and fragment if mode is automatic").optional(),
1517
+ refresh: z.boolean().describe("React refresh transformation").optional(),
1518
+ development: z.boolean().describe("Development specific information").optional()
1519
1519
  });
1520
1520
  const stringOrRegExpSchema = stringOrRegExp().or(stringOrRegExp().array());
1521
- const watchOptionsSchema = z$2.strictObject({
1522
- skipWrite: z$2.boolean().describe("Skip the bundle.write() step").optional(),
1523
- notify: z$2.strictObject({
1524
- pollInterval: z$2.number().optional(),
1525
- compareContents: z$2.boolean().optional()
1521
+ const watchOptionsSchema = z.strictObject({
1522
+ skipWrite: z.boolean().describe("Skip the bundle.write() step").optional(),
1523
+ notify: z.strictObject({
1524
+ pollInterval: z.number().optional(),
1525
+ compareContents: z.boolean().optional()
1526
1526
  }).describe("Notify options").optional(),
1527
1527
  include: stringOrRegExpSchema.optional(),
1528
1528
  exclude: stringOrRegExpSchema.optional(),
1529
- chokidar: z$2.any().optional()
1529
+ chokidar: z.any().optional()
1530
1530
  });
1531
- const checksOptionsSchema = z$2.strictObject({ circularDependency: z$2.boolean().describe("Wether to emit warnings when detecting circular dependencies").optional() });
1532
- const inputOptionsSchema = z$2.strictObject({
1531
+ const checksOptionsSchema = z.strictObject({ circularDependency: z.boolean().describe("Wether to emit warnings when detecting circular dependencies").optional() });
1532
+ const inputOptionsSchema = z.strictObject({
1533
1533
  input: inputOptionSchema.optional(),
1534
1534
  plugins: phantom().optional(),
1535
1535
  external: externalSchema.optional(),
1536
- resolve: z$2.strictObject({
1537
- alias: z$2.record(z$2.array(z$2.string()).or(z$2.string())).optional(),
1538
- aliasFields: z$2.array(z$2.array(z$2.string())).optional(),
1536
+ resolve: z.strictObject({
1537
+ alias: z.record(z.array(z.string()).or(z.string())).optional(),
1538
+ aliasFields: z.array(z.array(z.string())).optional(),
1539
1539
  conditionNames: optionalStringArray(),
1540
- extensionAlias: z$2.record(z$2.string(), z$2.array(z$2.string())).optional(),
1541
- exportsFields: z$2.array(z$2.array(z$2.string())).optional(),
1540
+ extensionAlias: z.record(z.string(), z.array(z.string())).optional(),
1541
+ exportsFields: z.array(z.array(z.string())).optional(),
1542
1542
  extensions: optionalStringArray(),
1543
1543
  mainFields: optionalStringArray(),
1544
1544
  mainFiles: optionalStringArray(),
1545
1545
  modules: optionalStringArray(),
1546
- symlinks: z$2.boolean().optional(),
1547
- tsconfigFilename: z$2.string().optional()
1546
+ symlinks: z.boolean().optional(),
1547
+ tsconfigFilename: z.string().optional()
1548
1548
  }).optional(),
1549
- cwd: z$2.string().describe("Current working directory").optional(),
1550
- platform: z$2.literal("node").or(z$2.literal("browser")).or(z$2.literal("neutral")).describe(`Platform for which the code should be generated (node, ${underline("browser")}, neutral)`).optional(),
1551
- shimMissingExports: z$2.boolean().describe(`Create shim variables for missing exports`).optional(),
1549
+ cwd: z.string().describe("Current working directory").optional(),
1550
+ platform: z.literal("node").or(z.literal("browser")).or(z.literal("neutral")).describe(`Platform for which the code should be generated (node, ${underline("browser")}, neutral)`).optional(),
1551
+ shimMissingExports: z.boolean().describe(`Create shim variables for missing exports`).optional(),
1552
1552
  treeshake: TreeshakingOptionsSchema.optional(),
1553
1553
  logLevel: LogLevelOptionSchema.describe(`Log level (${dim("silent")}, ${underline(gray("info"))}, debug, ${yellow("warn")})`).optional(),
1554
- onLog: z$2.function().args(LogLevelSchema, RollupLogSchema, z$2.function().args(LogLevelWithErrorSchema, RollupLogWithStringSchema)).optional(),
1555
- onwarn: z$2.function().args(RollupLogSchema, z$2.function().args(RollupLogWithStringSchema.or(z$2.function().returns(RollupLogWithStringSchema)))).optional(),
1554
+ onLog: z.function().args(LogLevelSchema, RollupLogSchema, z.function().args(LogLevelWithErrorSchema, RollupLogWithStringSchema)).optional(),
1555
+ onwarn: z.function().args(RollupLogSchema, z.function().args(RollupLogWithStringSchema.or(z.function().returns(RollupLogWithStringSchema)))).optional(),
1556
1556
  moduleTypes: moduleTypesSchema.describe("Module types for customized extensions").optional(),
1557
- experimental: z$2.strictObject({
1558
- enableComposingJsPlugins: z$2.boolean().optional(),
1559
- strictExecutionOrder: z$2.boolean().optional(),
1560
- disableLiveBindings: z$2.boolean().optional(),
1561
- resolveNewUrlToAsset: z$2.boolean().optional()
1557
+ experimental: z.strictObject({
1558
+ enableComposingJsPlugins: z.boolean().optional(),
1559
+ strictExecutionOrder: z.boolean().optional(),
1560
+ disableLiveBindings: z.boolean().optional(),
1561
+ resolveNewUrlToAsset: z.boolean().optional()
1562
1562
  }).optional(),
1563
- define: z$2.record(z$2.string()).describe("Define global variables").optional(),
1564
- inject: z$2.record(z$2.string().or(z$2.tuple([z$2.string(), z$2.string()]))).optional(),
1565
- profilerNames: z$2.boolean().optional(),
1563
+ define: z.record(z.string()).describe("Define global variables").optional(),
1564
+ inject: z.record(z.string().or(z.tuple([z.string(), z.string()]))).optional(),
1565
+ profilerNames: z.boolean().optional(),
1566
1566
  jsx: jsxOptionsSchema.optional(),
1567
- watch: watchOptionsSchema.or(z$2.literal(false)).optional(),
1568
- dropLabels: z$2.array(z$2.string()).describe("Remove labeled statements with these label names").optional(),
1567
+ watch: watchOptionsSchema.or(z.literal(false)).optional(),
1568
+ dropLabels: z.array(z.string()).describe("Remove labeled statements with these label names").optional(),
1569
1569
  checks: checksOptionsSchema.optional()
1570
1570
  });
1571
1571
  const inputCliOptionsSchema = inputOptionsSchema.extend({
1572
- external: z$2.array(z$2.string()).describe("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`").optional(),
1573
- inject: z$2.record(z$2.string()).describe("Inject import statements on demand").optional(),
1574
- treeshake: z$2.boolean().describe("enable treeshaking").default(true).optional()
1572
+ external: z.array(z.string()).describe("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`").optional(),
1573
+ inject: z.record(z.string()).describe("Inject import statements on demand").optional(),
1574
+ treeshake: z.boolean().describe("enable treeshaking").default(true).optional()
1575
1575
  }).omit({
1576
1576
  input: true,
1577
1577
  plugins: true,
@@ -1585,61 +1585,61 @@ const inputCliOptionsSchema = inputOptionsSchema.extend({
1585
1585
 
1586
1586
  //#endregion
1587
1587
  //#region src/options/output-options-schema.ts
1588
- const ModuleFormatSchema = z$1.literal("es").or(z$1.literal("cjs")).or(z$1.literal("esm")).or(z$1.literal("module")).or(z$1.literal("commonjs")).or(z$1.literal("iife")).or(z$1.literal("umd")).describe(`Output format of the generated bundle (supports ${underline("esm")}, cjs, and iife)`);
1589
- const addonFunctionSchema = z$1.function().args(phantom()).returns(z$1.string().or(z$1.promise(z$1.string())));
1590
- const chunkFileNamesFunctionSchema = z$1.function().args(phantom()).returns(z$1.string());
1591
- const GlobalsFunctionSchema = z$1.function().args(z$1.string()).returns(z$1.string());
1592
- const outputOptionsSchema = z$1.strictObject({
1593
- dir: z$1.string().describe("Output directory, defaults to `dist` if `file` is not set").optional(),
1594
- file: z$1.string().describe("Single output file").optional(),
1595
- exports: z$1.literal("auto").or(z$1.literal("named")).or(z$1.literal("default")).or(z$1.literal("none")).describe(`Specify a export mode (${underline("auto")}, named, default, none)`).optional(),
1596
- hashCharacters: z$1.literal("base64").or(z$1.literal("base36")).or(z$1.literal("hex")).describe("Use the specified character set for file hashes").optional(),
1588
+ const ModuleFormatSchema = z.literal("es").or(z.literal("cjs")).or(z.literal("esm")).or(z.literal("module")).or(z.literal("commonjs")).or(z.literal("iife")).or(z.literal("umd")).describe(`Output format of the generated bundle (supports ${underline("esm")}, cjs, and iife)`);
1589
+ const addonFunctionSchema = z.function().args(phantom()).returns(z.string().or(z.promise(z.string())));
1590
+ const chunkFileNamesFunctionSchema = z.function().args(phantom()).returns(z.string());
1591
+ const GlobalsFunctionSchema = z.function().args(z.string()).returns(z.string());
1592
+ const outputOptionsSchema = z.strictObject({
1593
+ dir: z.string().describe("Output directory, defaults to `dist` if `file` is not set").optional(),
1594
+ file: z.string().describe("Single output file").optional(),
1595
+ exports: z.literal("auto").or(z.literal("named")).or(z.literal("default")).or(z.literal("none")).describe(`Specify a export mode (${underline("auto")}, named, default, none)`).optional(),
1596
+ hashCharacters: z.literal("base64").or(z.literal("base36")).or(z.literal("hex")).describe("Use the specified character set for file hashes").optional(),
1597
1597
  format: ModuleFormatSchema.optional(),
1598
- sourcemap: z$1.boolean().or(z$1.literal("inline")).or(z$1.literal("hidden")).describe(`Generate sourcemap (\`-s inline\` for inline, or ${bold("pass the `-s` on the last argument if you want to generate `.map` file")})`).optional(),
1599
- sourcemapIgnoreList: z$1.boolean().or(phantom()).optional(),
1598
+ sourcemap: z.boolean().or(z.literal("inline")).or(z.literal("hidden")).describe(`Generate sourcemap (\`-s inline\` for inline, or ${bold("pass the `-s` on the last argument if you want to generate `.map` file")})`).optional(),
1599
+ sourcemapIgnoreList: z.boolean().or(phantom()).optional(),
1600
1600
  sourcemapPathTransform: phantom().optional(),
1601
- banner: z$1.string().or(addonFunctionSchema).optional(),
1602
- footer: z$1.string().or(addonFunctionSchema).optional(),
1603
- intro: z$1.string().or(addonFunctionSchema).optional(),
1604
- outro: z$1.string().or(addonFunctionSchema).optional(),
1605
- extend: z$1.boolean().describe("Extend global variable defined by name in IIFE / UMD formats").optional(),
1606
- esModule: z$1.literal("if-default-prop").or(z$1.boolean()).optional(),
1607
- assetFileNames: z$1.string().describe("Name pattern for asset files").optional(),
1608
- entryFileNames: z$1.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted entry chunks").optional(),
1609
- chunkFileNames: z$1.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted secondary chunks").optional(),
1610
- cssEntryFileNames: z$1.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted css entry chunks").optional(),
1611
- cssChunkFileNames: z$1.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted css secondary chunks").optional(),
1612
- minify: z$1.boolean().describe("Minify the bundled file.").optional(),
1613
- name: z$1.string().describe("Name for UMD / IIFE format outputs").optional(),
1614
- globals: z$1.record(z$1.string()).or(GlobalsFunctionSchema).describe("Global variable of UMD / IIFE dependencies (syntax: `key=value`)").optional(),
1615
- externalLiveBindings: z$1.boolean().describe("external live bindings").default(true).optional(),
1616
- inlineDynamicImports: z$1.boolean().describe("Inline dynamic imports").default(false).optional(),
1617
- advancedChunks: z$1.strictObject({
1618
- minSize: z$1.number().optional(),
1619
- minShareCount: z$1.number().optional(),
1620
- groups: z$1.array(z$1.strictObject({
1621
- name: z$1.string(),
1622
- test: z$1.string().or(z$1.instanceof(RegExp)).optional(),
1623
- priority: z$1.number().optional(),
1624
- minSize: z$1.number().optional(),
1625
- minShareCount: z$1.number().optional()
1601
+ banner: z.string().or(addonFunctionSchema).optional(),
1602
+ footer: z.string().or(addonFunctionSchema).optional(),
1603
+ intro: z.string().or(addonFunctionSchema).optional(),
1604
+ outro: z.string().or(addonFunctionSchema).optional(),
1605
+ extend: z.boolean().describe("Extend global variable defined by name in IIFE / UMD formats").optional(),
1606
+ esModule: z.literal("if-default-prop").or(z.boolean()).optional(),
1607
+ assetFileNames: z.string().describe("Name pattern for asset files").optional(),
1608
+ entryFileNames: z.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted entry chunks").optional(),
1609
+ chunkFileNames: z.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted secondary chunks").optional(),
1610
+ cssEntryFileNames: z.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted css entry chunks").optional(),
1611
+ cssChunkFileNames: z.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted css secondary chunks").optional(),
1612
+ minify: z.boolean().describe("Minify the bundled file.").optional(),
1613
+ name: z.string().describe("Name for UMD / IIFE format outputs").optional(),
1614
+ globals: z.record(z.string()).or(GlobalsFunctionSchema).describe("Global variable of UMD / IIFE dependencies (syntax: `key=value`)").optional(),
1615
+ externalLiveBindings: z.boolean().describe("external live bindings").default(true).optional(),
1616
+ inlineDynamicImports: z.boolean().describe("Inline dynamic imports").default(false).optional(),
1617
+ advancedChunks: z.strictObject({
1618
+ minSize: z.number().optional(),
1619
+ minShareCount: z.number().optional(),
1620
+ groups: z.array(z.strictObject({
1621
+ name: z.string(),
1622
+ test: z.string().or(z.instanceof(RegExp)).optional(),
1623
+ priority: z.number().optional(),
1624
+ minSize: z.number().optional(),
1625
+ minShareCount: z.number().optional()
1626
1626
  })).optional()
1627
1627
  }).optional(),
1628
- comments: z$1.enum(["none", "preserve-legal"]).describe("Control comments in the output").optional()
1628
+ comments: z.enum(["none", "preserve-legal"]).describe("Control comments in the output").optional()
1629
1629
  });
1630
1630
  const getAddonDescription = (placement, wrapper) => {
1631
1631
  return `Code to insert the ${bold(placement)} of the bundled file (${bold(wrapper)} the wrapper function)`;
1632
1632
  };
1633
1633
  const outputCliOptionsSchema = outputOptionsSchema.extend({
1634
- banner: z$1.string().describe(getAddonDescription("top", "outside")).optional(),
1635
- footer: z$1.string().describe(getAddonDescription("bottom", "outside")).optional(),
1636
- intro: z$1.string().describe(getAddonDescription("top", "inside")).optional(),
1637
- outro: z$1.string().describe(getAddonDescription("bottom", "inside")).optional(),
1638
- esModule: z$1.boolean().describe("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)").optional(),
1639
- globals: z$1.record(z$1.string()).describe("Global variable of UMD / IIFE dependencies (syntax: `key=value`)").optional(),
1640
- advancedChunks: z$1.strictObject({
1641
- minSize: z$1.number().describe("Minimum size of the chunk").optional(),
1642
- minShareCount: z$1.number().describe("Minimum share count of the chunk").optional()
1634
+ banner: z.string().describe(getAddonDescription("top", "outside")).optional(),
1635
+ footer: z.string().describe(getAddonDescription("bottom", "outside")).optional(),
1636
+ intro: z.string().describe(getAddonDescription("top", "inside")).optional(),
1637
+ outro: z.string().describe(getAddonDescription("bottom", "inside")).optional(),
1638
+ esModule: z.boolean().describe("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)").optional(),
1639
+ globals: z.record(z.string()).describe("Global variable of UMD / IIFE dependencies (syntax: `key=value`)").optional(),
1640
+ advancedChunks: z.strictObject({
1641
+ minSize: z.number().describe("Minimum size of the chunk").optional(),
1642
+ minShareCount: z.number().describe("Minimum share count of the chunk").optional()
1643
1643
  }).optional()
1644
1644
  }).omit({
1645
1645
  sourcemapPathTransform: true,
@@ -1,4 +1,4 @@
1
- import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-CKZ4-qVz.mjs";
1
+ import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-BAGIbE8g.mjs";
2
2
  import { pathToFileURL } from "node:url";
3
3
 
4
4
  //#region src/plugin/parallel-plugin.ts
@@ -1,3 +1,3 @@
1
- import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-CKZ4-qVz.mjs";
1
+ import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-BAGIbE8g.mjs";
2
2
 
3
3
  export { VERSION, build, defineConfig, rolldown, watch };
@@ -1,4 +1,4 @@
1
- import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-CKZ4-qVz.mjs";
1
+ import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-BAGIbE8g.mjs";
2
2
  import { parentPort, workerData } from "node:worker_threads";
3
3
 
4
4
  //#region src/parallel-plugin-worker.ts
@@ -348,13 +348,13 @@ var BasicReporter = class {
348
348
 
349
349
  //#endregion
350
350
  //#region ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/utils.mjs
351
- const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
352
- const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
353
- const isForced = "FORCE_COLOR" in env || argv.includes("--color");
351
+ const { env: env$1 = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
352
+ const isDisabled = "NO_COLOR" in env$1 || argv.includes("--no-color");
353
+ const isForced = "FORCE_COLOR" in env$1 || argv.includes("--color");
354
354
  const isWindows = platform === "win32";
355
- const isDumbTerminal = env.TERM === "dumb";
356
- const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
357
- const isCI$1 = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
355
+ const isDumbTerminal = env$1.TERM === "dumb";
356
+ const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
357
+ const isCI$1 = "CI" in env$1 && ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
358
358
  const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI$1);
359
359
  function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
360
360
  return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
@@ -593,15 +593,15 @@ const providers = [
593
593
  ["STORMKIT"],
594
594
  ["CLEAVR"]
595
595
  ];
596
- function detectProvider(env$1) {
596
+ function detectProvider(env$2) {
597
597
  for (const provider of providers) {
598
598
  const envName = provider[1] || provider[0];
599
- if (env$1[envName]) return {
599
+ if (env$2[envName]) return {
600
600
  name: provider[0].toLowerCase(),
601
601
  ...provider[2]
602
602
  };
603
603
  }
604
- if (env$1.SHELL && env$1.SHELL === "/bin/jsh") return {
604
+ if (env$2.SHELL && env$2.SHELL === "/bin/jsh") return {
605
605
  name: "stackblitz",
606
606
  ci: false
607
607
  };
@@ -815,7 +815,7 @@ function createConsola(options = {}) {
815
815
  defaults: { level },
816
816
  stdout: process.stdout,
817
817
  stderr: process.stderr,
818
- prompt: (...args) => import("./prompt-Bxbtwdyb.mjs").then((m) => m.prompt(...args)),
818
+ prompt: (...args) => import("./prompt-DlQ-08lk.mjs").then((m) => m.prompt(...args)),
819
819
  reporters: options.reporters || [options.fancy ?? !(isCI || isTest) ? new FancyReporter() : new BasicReporter()],
820
820
  ...options
821
821
  });
@@ -1,4 +1,4 @@
1
- import { colors, getDefaultExportFromCjs, isUnicodeSupported } from "./consola_36c0034f-B6fL2Jf_.mjs";
1
+ import { colors, getDefaultExportFromCjs, isUnicodeSupported } from "./consola_36c0034f-D9ce-831.mjs";
2
2
  import { stdin, stdout } from "node:process";
3
3
  import require$$0 from "tty";
4
4
  import { WriteStream } from "node:tty";
@@ -1,6 +1,6 @@
1
- import { createRequire as createRequire$1 } from "module";
1
+ import { createRequire } from "module";
2
2
  import { Buffer as Buffer$1 } from "node:buffer";
3
- import { z, z as z$1 } from "zod";
3
+ import { z } from "zod";
4
4
  import path, { default as path$1 } from "node:path";
5
5
  import { Worker } from "node:worker_threads";
6
6
  import { availableParallelism } from "node:os";
@@ -35,7 +35,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
35
35
  value: mod,
36
36
  enumerable: true
37
37
  }) : target, mod));
38
- var __require = /* @__PURE__ */ createRequire$1(import.meta.url);
38
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
39
39
 
40
40
  //#endregion
41
41
  //#region src/utils/define-config.ts
@@ -277,7 +277,7 @@ else chunks.push({
277
277
  //#endregion
278
278
  //#region src/binding.js
279
279
  var require_binding = __commonJS({ "src/binding.js"(exports, module) {
280
- const { createRequire } = __require("node:module");
280
+ const { createRequire: createRequire$1 } = __require("node:module");
281
281
  const { readFileSync } = __require("node:fs");
282
282
  let nativeBinding = null;
283
283
  const loadErrors = [];
@@ -614,9 +614,9 @@ function noop(..._args) {}
614
614
 
615
615
  //#endregion
616
616
  //#region src/log/logging.ts
617
- const LogLevelSchema = z$1.literal("info").or(z$1.literal("debug")).or(z$1.literal("warn"));
618
- const LogLevelOptionSchema = LogLevelSchema.or(z$1.literal("silent"));
619
- const LogLevelWithErrorSchema = LogLevelSchema.or(z$1.literal("error"));
617
+ const LogLevelSchema = z.literal("info").or(z.literal("debug")).or(z.literal("warn"));
618
+ const LogLevelOptionSchema = LogLevelSchema.or(z.literal("silent"));
619
+ const LogLevelWithErrorSchema = LogLevelSchema.or(z.literal("error"));
620
620
  const LOG_LEVEL_SILENT = "silent";
621
621
  const LOG_LEVEL_ERROR = "error";
622
622
  const LOG_LEVEL_WARN = "warn";
@@ -628,8 +628,8 @@ const logLevelPriority = {
628
628
  [LOG_LEVEL_WARN]: 2,
629
629
  [LOG_LEVEL_SILENT]: 3
630
630
  };
631
- const RollupLogSchema = z$1.any();
632
- const RollupLogWithStringSchema = RollupLogSchema.or(z$1.string());
631
+ const RollupLogSchema = z.any();
632
+ const RollupLogWithStringSchema = RollupLogSchema.or(z.string());
633
633
 
634
634
  //#endregion
635
635
  //#region src/utils/code-frame.ts
@@ -897,9 +897,9 @@ function relativeId(id) {
897
897
 
898
898
  //#endregion
899
899
  //#region src/builtin-plugin/utils.ts
900
- var import_binding$5 = __toESM(require_binding());
900
+ var import_binding$6 = __toESM(require_binding());
901
901
  function makeBuiltinPluginCallable(plugin) {
902
- let callablePlugin = new import_binding$5.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
902
+ let callablePlugin = new import_binding$6.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
903
903
  const wrappedPlugin = plugin;
904
904
  for (const key in callablePlugin) wrappedPlugin[key] = function(...args) {
905
905
  return callablePlugin[key](...args);
@@ -1199,12 +1199,12 @@ var MinimalPluginContext = class {
1199
1199
 
1200
1200
  //#endregion
1201
1201
  //#region src/utils/transform-side-effects.ts
1202
- var import_binding$4 = __toESM(require_binding());
1202
+ var import_binding$5 = __toESM(require_binding());
1203
1203
  function bindingifySideEffects(sideEffects) {
1204
1204
  switch (sideEffects) {
1205
- case true: return import_binding$4.BindingHookSideEffects.True;
1206
- case false: return import_binding$4.BindingHookSideEffects.False;
1207
- case "no-treeshake": return import_binding$4.BindingHookSideEffects.NoTreeshake;
1205
+ case true: return import_binding$5.BindingHookSideEffects.True;
1206
+ case false: return import_binding$5.BindingHookSideEffects.False;
1207
+ case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
1208
1208
  case null:
1209
1209
  case undefined: return undefined;
1210
1210
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
@@ -1315,14 +1315,14 @@ var TransformPluginContext = class extends PluginContext {
1315
1315
 
1316
1316
  //#endregion
1317
1317
  //#region src/plugin/bindingify-plugin-hook-meta.ts
1318
- var import_binding$3 = __toESM(require_binding());
1318
+ var import_binding$4 = __toESM(require_binding());
1319
1319
  function bindingifyPluginHookMeta(options) {
1320
1320
  return { order: bindingPluginOrder(options.order) };
1321
1321
  }
1322
1322
  function bindingPluginOrder(order) {
1323
1323
  switch (order) {
1324
- case "post": return import_binding$3.BindingPluginOrder.Post;
1325
- case "pre": return import_binding$3.BindingPluginOrder.Pre;
1324
+ case "post": return import_binding$4.BindingPluginOrder.Post;
1325
+ case "pre": return import_binding$4.BindingPluginOrder.Pre;
1326
1326
  case null:
1327
1327
  case undefined: return undefined;
1328
1328
  default: throw new Error(`Unknown plugin order: ${order}`);
@@ -1630,6 +1630,9 @@ var NormalizedOutputOptionsImpl = class {
1630
1630
  get comments() {
1631
1631
  return this.inner.comments;
1632
1632
  }
1633
+ get polyfillRequire() {
1634
+ return this.inner.polyfillRequire;
1635
+ }
1633
1636
  };
1634
1637
 
1635
1638
  //#endregion
@@ -1981,7 +1984,7 @@ function normalizedStringOrRegex(pattern) {
1981
1984
 
1982
1985
  //#endregion
1983
1986
  //#region src/utils/bindingify-input-options.ts
1984
- var import_binding$2 = __toESM(require_binding());
1987
+ var import_binding$3 = __toESM(require_binding());
1985
1988
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, onLog, logLevel) {
1986
1989
  const pluginContextData = new PluginContextData();
1987
1990
  const plugins = rawPlugins.map((plugin) => {
@@ -2072,10 +2075,10 @@ function bindingifyInject(inject) {
2072
2075
  }
2073
2076
  function bindingifyLogLevel(logLevel) {
2074
2077
  switch (logLevel) {
2075
- case "silent": return import_binding$2.BindingLogLevel.Silent;
2076
- case "debug": return import_binding$2.BindingLogLevel.Debug;
2077
- case "warn": return import_binding$2.BindingLogLevel.Warn;
2078
- case "info": return import_binding$2.BindingLogLevel.Info;
2078
+ case "silent": return import_binding$3.BindingLogLevel.Silent;
2079
+ case "debug": return import_binding$3.BindingLogLevel.Debug;
2080
+ case "warn": return import_binding$3.BindingLogLevel.Warn;
2081
+ case "info": return import_binding$3.BindingLogLevel.Info;
2079
2082
  default: throw new Error(`Unexpected log level: ${logLevel}`);
2080
2083
  }
2081
2084
  }
@@ -2168,7 +2171,8 @@ function bindingifyOutputOptions(outputOptions) {
2168
2171
  minify: outputOptions.minify,
2169
2172
  externalLiveBindings: outputOptions.externalLiveBindings,
2170
2173
  inlineDynamicImports: outputOptions.inlineDynamicImports,
2171
- advancedChunks: outputOptions.advancedChunks
2174
+ advancedChunks: outputOptions.advancedChunks,
2175
+ polyfillRequire: outputOptions.polyfillRequire
2172
2176
  };
2173
2177
  }
2174
2178
  function bindingifyAddon(configAddon) {
@@ -2554,7 +2558,7 @@ else newPlugins.push(toBeComposed[0]);
2554
2558
 
2555
2559
  //#endregion
2556
2560
  //#region src/utils/initialize-parallel-plugins.ts
2557
- var import_binding$1 = __toESM(require_binding());
2561
+ var import_binding$2 = __toESM(require_binding());
2558
2562
  async function initializeParallelPlugins(plugins) {
2559
2563
  const pluginInfos = [];
2560
2564
  for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
@@ -2567,7 +2571,7 @@ async function initializeParallelPlugins(plugins) {
2567
2571
  }
2568
2572
  if (pluginInfos.length <= 0) return undefined;
2569
2573
  const count = Math.min(availableParallelism(), 8);
2570
- const parallelJsPluginRegistry = new import_binding$1.ParallelJsPluginRegistry(count);
2574
+ const parallelJsPluginRegistry = new import_binding$2.ParallelJsPluginRegistry(count);
2571
2575
  const registryId = parallelJsPluginRegistry.id;
2572
2576
  const workers = await initializeWorkers(registryId, count, pluginInfos);
2573
2577
  const stopWorkers = async () => {
@@ -2583,14 +2587,14 @@ function initializeWorkers(registryId, count, pluginInfos) {
2583
2587
  }
2584
2588
  async function initializeWorker(registryId, pluginInfos, threadNumber) {
2585
2589
  const urlString = import.meta.resolve("#parallel-plugin-worker");
2586
- const workerData = {
2590
+ const workerData$1 = {
2587
2591
  registryId,
2588
2592
  pluginInfos,
2589
2593
  threadNumber
2590
2594
  };
2591
2595
  let worker;
2592
2596
  try {
2593
- worker = new Worker(new URL(urlString), { workerData });
2597
+ worker = new Worker(new URL(urlString), { workerData: workerData$1 });
2594
2598
  worker.unref();
2595
2599
  await new Promise((resolve, reject) => {
2596
2600
  worker.once("message", async (message) => {
@@ -2606,9 +2610,8 @@ else resolve();
2606
2610
  }
2607
2611
 
2608
2612
  //#endregion
2609
- //#region src/utils/create-bundler.ts
2610
- var import_binding = __toESM(require_binding());
2611
- async function createBundler(inputOptions, outputOptions) {
2613
+ //#region src/utils/create-bundler-option.ts
2614
+ async function createBundlerOptions(inputOptions, outputOptions) {
2612
2615
  const pluginDriver = new PluginDriver();
2613
2616
  inputOptions = await pluginDriver.callOptionsHook(inputOptions);
2614
2617
  if (inputOptions.treeshake !== undefined) TreeshakingOptionsSchema.parse(inputOptions.treeshake);
@@ -2624,7 +2627,11 @@ async function createBundler(inputOptions, outputOptions) {
2624
2627
  const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, onLog, logLevel);
2625
2628
  const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
2626
2629
  return {
2627
- bundler: new import_binding.Bundler(bindingInputOptions, bindingOutputOptions, parallelPluginInitResult?.registry),
2630
+ bundlerOptions: {
2631
+ inputOptions: bindingInputOptions,
2632
+ outputOptions: bindingOutputOptions,
2633
+ parallelPluginsRegistry: parallelPluginInitResult?.registry
2634
+ },
2628
2635
  stopWorkers: parallelPluginInitResult?.stopWorkers
2629
2636
  };
2630
2637
  } catch (e) {
@@ -2633,6 +2640,22 @@ async function createBundler(inputOptions, outputOptions) {
2633
2640
  }
2634
2641
  }
2635
2642
 
2643
+ //#endregion
2644
+ //#region src/utils/create-bundler.ts
2645
+ var import_binding$1 = __toESM(require_binding());
2646
+ async function createBundler(inputOptions, outputOptions) {
2647
+ const option = await createBundlerOptions(inputOptions, outputOptions);
2648
+ try {
2649
+ return {
2650
+ bundler: new import_binding$1.Bundler(option.bundlerOptions),
2651
+ stopWorkers: option.stopWorkers
2652
+ };
2653
+ } catch (e) {
2654
+ await option.stopWorkers?.();
2655
+ throw e;
2656
+ }
2657
+ }
2658
+
2636
2659
  //#endregion
2637
2660
  //#region src/api/rolldown/rolldown-build.ts
2638
2661
  Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
@@ -2741,6 +2764,7 @@ else this.listeners.set(event, [listener]);
2741
2764
 
2742
2765
  //#endregion
2743
2766
  //#region src/api/watch/watcher.ts
2767
+ var import_binding = __toESM(require_binding());
2744
2768
  var Watcher = class {
2745
2769
  closed;
2746
2770
  inner;
@@ -2760,7 +2784,7 @@ var Watcher = class {
2760
2784
  async close() {
2761
2785
  if (this.closed) return;
2762
2786
  this.closed = true;
2763
- await this.stopWorkers?.();
2787
+ for (const stop of this.stopWorkers) await stop?.();
2764
2788
  await this.inner.close();
2765
2789
  }
2766
2790
  start() {
@@ -2768,9 +2792,10 @@ var Watcher = class {
2768
2792
  }
2769
2793
  };
2770
2794
  async function createWatcher(emitter, input) {
2771
- const { bundler, stopWorkers } = await createBundler(input, input.output || {});
2772
- const bindingWatcher = await bundler.watch();
2773
- const watcher = new Watcher(emitter, bindingWatcher, stopWorkers);
2795
+ const options = Array.isArray(input) ? input : [input];
2796
+ const bundlerOptions = await Promise.all(options.map((option) => createBundlerOptions(option, option.output || {})));
2797
+ const bindingWatcher = new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions));
2798
+ const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
2774
2799
  watcher.start();
2775
2800
  }
2776
2801
 
@@ -865,9 +865,9 @@ function relativeId(id) {
865
865
 
866
866
  //#endregion
867
867
  //#region src/builtin-plugin/utils.ts
868
- var import_binding$5 = require_chunk.__toESM(require_binding());
868
+ var import_binding$6 = require_chunk.__toESM(require_binding());
869
869
  function makeBuiltinPluginCallable(plugin) {
870
- let callablePlugin = new import_binding$5.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
870
+ let callablePlugin = new import_binding$6.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
871
871
  const wrappedPlugin = plugin;
872
872
  for (const key in callablePlugin) wrappedPlugin[key] = function(...args) {
873
873
  return callablePlugin[key](...args);
@@ -1167,12 +1167,12 @@ var MinimalPluginContext = class {
1167
1167
 
1168
1168
  //#endregion
1169
1169
  //#region src/utils/transform-side-effects.ts
1170
- var import_binding$4 = require_chunk.__toESM(require_binding());
1170
+ var import_binding$5 = require_chunk.__toESM(require_binding());
1171
1171
  function bindingifySideEffects(sideEffects) {
1172
1172
  switch (sideEffects) {
1173
- case true: return import_binding$4.BindingHookSideEffects.True;
1174
- case false: return import_binding$4.BindingHookSideEffects.False;
1175
- case "no-treeshake": return import_binding$4.BindingHookSideEffects.NoTreeshake;
1173
+ case true: return import_binding$5.BindingHookSideEffects.True;
1174
+ case false: return import_binding$5.BindingHookSideEffects.False;
1175
+ case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
1176
1176
  case null:
1177
1177
  case undefined: return undefined;
1178
1178
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
@@ -1283,14 +1283,14 @@ var TransformPluginContext = class extends PluginContext {
1283
1283
 
1284
1284
  //#endregion
1285
1285
  //#region src/plugin/bindingify-plugin-hook-meta.ts
1286
- var import_binding$3 = require_chunk.__toESM(require_binding());
1286
+ var import_binding$4 = require_chunk.__toESM(require_binding());
1287
1287
  function bindingifyPluginHookMeta(options) {
1288
1288
  return { order: bindingPluginOrder(options.order) };
1289
1289
  }
1290
1290
  function bindingPluginOrder(order) {
1291
1291
  switch (order) {
1292
- case "post": return import_binding$3.BindingPluginOrder.Post;
1293
- case "pre": return import_binding$3.BindingPluginOrder.Pre;
1292
+ case "post": return import_binding$4.BindingPluginOrder.Post;
1293
+ case "pre": return import_binding$4.BindingPluginOrder.Pre;
1294
1294
  case null:
1295
1295
  case undefined: return undefined;
1296
1296
  default: throw new Error(`Unknown plugin order: ${order}`);
@@ -1598,6 +1598,9 @@ var NormalizedOutputOptionsImpl = class {
1598
1598
  get comments() {
1599
1599
  return this.inner.comments;
1600
1600
  }
1601
+ get polyfillRequire() {
1602
+ return this.inner.polyfillRequire;
1603
+ }
1601
1604
  };
1602
1605
 
1603
1606
  //#endregion
@@ -1949,7 +1952,7 @@ function normalizedStringOrRegex(pattern) {
1949
1952
 
1950
1953
  //#endregion
1951
1954
  //#region src/utils/bindingify-input-options.ts
1952
- var import_binding$2 = require_chunk.__toESM(require_binding());
1955
+ var import_binding$3 = require_chunk.__toESM(require_binding());
1953
1956
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, onLog, logLevel) {
1954
1957
  const pluginContextData = new PluginContextData();
1955
1958
  const plugins = rawPlugins.map((plugin) => {
@@ -2040,10 +2043,10 @@ function bindingifyInject(inject) {
2040
2043
  }
2041
2044
  function bindingifyLogLevel(logLevel) {
2042
2045
  switch (logLevel) {
2043
- case "silent": return import_binding$2.BindingLogLevel.Silent;
2044
- case "debug": return import_binding$2.BindingLogLevel.Debug;
2045
- case "warn": return import_binding$2.BindingLogLevel.Warn;
2046
- case "info": return import_binding$2.BindingLogLevel.Info;
2046
+ case "silent": return import_binding$3.BindingLogLevel.Silent;
2047
+ case "debug": return import_binding$3.BindingLogLevel.Debug;
2048
+ case "warn": return import_binding$3.BindingLogLevel.Warn;
2049
+ case "info": return import_binding$3.BindingLogLevel.Info;
2047
2050
  default: throw new Error(`Unexpected log level: ${logLevel}`);
2048
2051
  }
2049
2052
  }
@@ -2136,7 +2139,8 @@ function bindingifyOutputOptions(outputOptions) {
2136
2139
  minify: outputOptions.minify,
2137
2140
  externalLiveBindings: outputOptions.externalLiveBindings,
2138
2141
  inlineDynamicImports: outputOptions.inlineDynamicImports,
2139
- advancedChunks: outputOptions.advancedChunks
2142
+ advancedChunks: outputOptions.advancedChunks,
2143
+ polyfillRequire: outputOptions.polyfillRequire
2140
2144
  };
2141
2145
  }
2142
2146
  function bindingifyAddon(configAddon) {
@@ -2522,7 +2526,7 @@ else newPlugins.push(toBeComposed[0]);
2522
2526
 
2523
2527
  //#endregion
2524
2528
  //#region src/utils/initialize-parallel-plugins.ts
2525
- var import_binding$1 = require_chunk.__toESM(require_binding());
2529
+ var import_binding$2 = require_chunk.__toESM(require_binding());
2526
2530
  async function initializeParallelPlugins(plugins) {
2527
2531
  const pluginInfos = [];
2528
2532
  for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
@@ -2535,7 +2539,7 @@ async function initializeParallelPlugins(plugins) {
2535
2539
  }
2536
2540
  if (pluginInfos.length <= 0) return undefined;
2537
2541
  const count = Math.min((0, node_os.availableParallelism)(), 8);
2538
- const parallelJsPluginRegistry = new import_binding$1.ParallelJsPluginRegistry(count);
2542
+ const parallelJsPluginRegistry = new import_binding$2.ParallelJsPluginRegistry(count);
2539
2543
  const registryId = parallelJsPluginRegistry.id;
2540
2544
  const workers = await initializeWorkers(registryId, count, pluginInfos);
2541
2545
  const stopWorkers = async () => {
@@ -2574,9 +2578,8 @@ else resolve();
2574
2578
  }
2575
2579
 
2576
2580
  //#endregion
2577
- //#region src/utils/create-bundler.ts
2578
- var import_binding = require_chunk.__toESM(require_binding());
2579
- async function createBundler(inputOptions, outputOptions) {
2581
+ //#region src/utils/create-bundler-option.ts
2582
+ async function createBundlerOptions(inputOptions, outputOptions) {
2580
2583
  const pluginDriver = new PluginDriver();
2581
2584
  inputOptions = await pluginDriver.callOptionsHook(inputOptions);
2582
2585
  if (inputOptions.treeshake !== undefined) TreeshakingOptionsSchema.parse(inputOptions.treeshake);
@@ -2592,7 +2595,11 @@ async function createBundler(inputOptions, outputOptions) {
2592
2595
  const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, onLog, logLevel);
2593
2596
  const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
2594
2597
  return {
2595
- bundler: new import_binding.Bundler(bindingInputOptions, bindingOutputOptions, parallelPluginInitResult?.registry),
2598
+ bundlerOptions: {
2599
+ inputOptions: bindingInputOptions,
2600
+ outputOptions: bindingOutputOptions,
2601
+ parallelPluginsRegistry: parallelPluginInitResult?.registry
2602
+ },
2596
2603
  stopWorkers: parallelPluginInitResult?.stopWorkers
2597
2604
  };
2598
2605
  } catch (e) {
@@ -2601,6 +2608,22 @@ async function createBundler(inputOptions, outputOptions) {
2601
2608
  }
2602
2609
  }
2603
2610
 
2611
+ //#endregion
2612
+ //#region src/utils/create-bundler.ts
2613
+ var import_binding$1 = require_chunk.__toESM(require_binding());
2614
+ async function createBundler(inputOptions, outputOptions) {
2615
+ const option = await createBundlerOptions(inputOptions, outputOptions);
2616
+ try {
2617
+ return {
2618
+ bundler: new import_binding$1.Bundler(option.bundlerOptions),
2619
+ stopWorkers: option.stopWorkers
2620
+ };
2621
+ } catch (e) {
2622
+ await option.stopWorkers?.();
2623
+ throw e;
2624
+ }
2625
+ }
2626
+
2604
2627
  //#endregion
2605
2628
  //#region src/api/rolldown/rolldown-build.ts
2606
2629
  Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
@@ -2709,6 +2732,7 @@ else this.listeners.set(event, [listener]);
2709
2732
 
2710
2733
  //#endregion
2711
2734
  //#region src/api/watch/watcher.ts
2735
+ var import_binding = require_chunk.__toESM(require_binding());
2712
2736
  var Watcher = class {
2713
2737
  closed;
2714
2738
  inner;
@@ -2728,7 +2752,7 @@ var Watcher = class {
2728
2752
  async close() {
2729
2753
  if (this.closed) return;
2730
2754
  this.closed = true;
2731
- await this.stopWorkers?.();
2755
+ for (const stop of this.stopWorkers) await stop?.();
2732
2756
  await this.inner.close();
2733
2757
  }
2734
2758
  start() {
@@ -2736,9 +2760,10 @@ var Watcher = class {
2736
2760
  }
2737
2761
  };
2738
2762
  async function createWatcher(emitter, input) {
2739
- const { bundler, stopWorkers } = await createBundler(input, input.output || {});
2740
- const bindingWatcher = await bundler.watch();
2741
- const watcher = new Watcher(emitter, bindingWatcher, stopWorkers);
2763
+ const options = Array.isArray(input) ? input : [input];
2764
+ const bundlerOptions = await Promise.all(options.map((option) => createBundlerOptions(option, option.output || {})));
2765
+ const bindingWatcher = new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions));
2766
+ const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
2742
2767
  watcher.start();
2743
2768
  }
2744
2769
 
@@ -1,3 +1,3 @@
1
1
  import type { WatchOptions } from '../../options/watch-options';
2
2
  import { RolldownWatcher } from './watch-emitter';
3
- export declare const watch: (input: WatchOptions) => RolldownWatcher;
3
+ export declare const watch: (input: WatchOptions | WatchOptions[]) => RolldownWatcher;
@@ -5,9 +5,9 @@ export declare class Watcher {
5
5
  closed: boolean;
6
6
  inner: BindingWatcher;
7
7
  emitter: WatcherEmitter;
8
- stopWorkers?: () => Promise<void>;
9
- constructor(emitter: WatcherEmitter, inner: BindingWatcher, stopWorkers?: () => Promise<void>);
8
+ stopWorkers: ((() => Promise<void>) | undefined)[];
9
+ constructor(emitter: WatcherEmitter, inner: BindingWatcher, stopWorkers: ((() => Promise<void>) | undefined)[]);
10
10
  close(): Promise<void>;
11
11
  start(): void;
12
12
  }
13
- export declare function createWatcher(emitter: WatcherEmitter, input: WatchOptions): Promise<void>;
13
+ export declare function createWatcher(emitter: WatcherEmitter, input: WatchOptions | WatchOptions[]): Promise<void>;
@@ -62,6 +62,7 @@ export declare class BindingNormalizedOptions {
62
62
  get hashCharacters(): 'base64' | 'base36' | 'hex'
63
63
  get sourcemapDebugIds(): boolean
64
64
  get minify(): boolean
65
+ get polyfillRequire(): boolean
65
66
  get comments(): 'none' | 'preserve-legal'
66
67
  }
67
68
 
@@ -117,6 +118,7 @@ export declare class BindingTransformPluginContext {
117
118
  }
118
119
 
119
120
  export declare class BindingWatcher {
121
+ constructor(options: Array<BindingBundlerOptions>)
120
122
  close(): Promise<void>
121
123
  start(listener: (data: BindingWatcherEvent) => void): Promise<void>
122
124
  }
@@ -135,12 +137,11 @@ export declare class BindingWatcherEvent {
135
137
  }
136
138
 
137
139
  export declare class Bundler {
138
- constructor(inputOptions: BindingInputOptions, outputOptions: BindingOutputOptions, parallelPluginsRegistry?: ParallelJsPluginRegistry | undefined | null)
140
+ constructor(option: BindingBundlerOptions)
139
141
  write(): Promise<BindingOutputs>
140
142
  generate(): Promise<BindingOutputs>
141
143
  scan(): Promise<BindingOutputs>
142
144
  close(): Promise<void>
143
- watch(): Promise<BindingWatcher>
144
145
  get closed(): boolean
145
146
  }
146
147
 
@@ -213,6 +214,12 @@ export type BindingBuiltinPluginName = 'builtin:wasm-helper'|
213
214
  'builtin:replace'|
214
215
  'builtin:vite-resolve';
215
216
 
217
+ export interface BindingBundlerOptions {
218
+ inputOptions: BindingInputOptions
219
+ outputOptions: BindingOutputOptions
220
+ parallelPluginsRegistry?: ParallelJsPluginRegistry
221
+ }
222
+
216
223
  export interface BindingChecksOptions {
217
224
  circularDependency?: boolean
218
225
  }
@@ -338,6 +345,7 @@ export interface BindingInputOptions {
338
345
  export interface BindingJsonPluginConfig {
339
346
  stringify?: boolean
340
347
  isBuild?: boolean
348
+ namedExports?: boolean
341
349
  }
342
350
 
343
351
  export interface BindingJsonSourcemap {
@@ -417,6 +425,7 @@ export interface BindingOutputOptions {
417
425
  minify?: boolean
418
426
  advancedChunks?: BindingAdvancedChunksOptions
419
427
  comments?: 'none' | 'preserve-legal'
428
+ polyfillRequire?: boolean
420
429
  }
421
430
 
422
431
  export interface BindingPluginContextResolvedId {
@@ -39,6 +39,12 @@ export interface InputOptions {
39
39
  alias?: Record<string, string[] | string>;
40
40
  aliasFields?: string[][];
41
41
  conditionNames?: string[];
42
+ /**
43
+ * Map of extensions to alternative extensions.
44
+ *
45
+ * With writing `import './foo.js'` in a file, you want to resolve it to `foo.ts` instead of `foo.js`.
46
+ * You can achieve this by setting: `extensionAlias: { '.js': ['.ts', '.js'] }`.
47
+ */
42
48
  extensionAlias?: Record<string, string[]>;
43
49
  exportsFields?: string[][];
44
50
  extensions?: string[];
@@ -29,6 +29,7 @@ export interface NormalizedOutputOptions {
29
29
  sourcemapPathTransform: SourcemapPathTransformOption | undefined;
30
30
  minify: boolean;
31
31
  comments: 'none' | 'preserve-legal';
32
+ polyfillRequire: boolean;
32
33
  }
33
34
  export declare class NormalizedOutputOptionsImpl implements NormalizedOutputOptions {
34
35
  inner: BindingNormalizedOptions;
@@ -60,4 +61,5 @@ export declare class NormalizedOutputOptionsImpl implements NormalizedOutputOpti
60
61
  get sourcemapPathTransform(): (() => never) | undefined;
61
62
  get minify(): boolean;
62
63
  get comments(): "none" | "preserve-legal";
64
+ get polyfillRequire(): boolean;
63
65
  }
@@ -60,6 +60,7 @@ export interface OutputOptions {
60
60
  */
61
61
  comments?: 'none' | 'preserve-legal';
62
62
  plugins?: RolldownOutputPluginOption;
63
+ polyfillRequire?: boolean;
63
64
  }
64
65
  interface OverwriteOutputOptionsForCli {
65
66
  banner?: string;
@@ -0,0 +1,8 @@
1
+ import { BindingBundlerOptions } from '../binding';
2
+ import type { InputOptions } from '../options/input-options';
3
+ import type { OutputOptions } from '../options/output-options';
4
+ export declare function createBundlerOptions(inputOptions: InputOptions, outputOptions: OutputOptions): Promise<BundlerOptionWithStopWorker>;
5
+ export interface BundlerOptionWithStopWorker {
6
+ bundlerOptions: BindingBundlerOptions;
7
+ stopWorkers?: () => Promise<void>;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown",
3
- "version": "0.15.0-snapshot-c66278b-20241208003838",
3
+ "version": "0.15.0-snapshot-86db816-20241210003559",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "repository": {
@@ -113,21 +113,21 @@
113
113
  "why-is-node-running": "^3.0.0",
114
114
  "zod-to-json-schema": "^3.23.2",
115
115
  "@rolldown/testing": "0.0.1",
116
- "rolldown": "0.15.0-snapshot-c66278b-20241208003838"
116
+ "rolldown": "0.15.0-snapshot-86db816-20241210003559"
117
117
  },
118
118
  "optionalDependencies": {
119
- "@rolldown/binding-darwin-arm64": "0.15.0-snapshot-c66278b-20241208003838",
120
- "@rolldown/binding-darwin-x64": "0.15.0-snapshot-c66278b-20241208003838",
121
- "@rolldown/binding-linux-arm-gnueabihf": "0.15.0-snapshot-c66278b-20241208003838",
122
- "@rolldown/binding-freebsd-x64": "0.15.0-snapshot-c66278b-20241208003838",
123
- "@rolldown/binding-linux-arm64-gnu": "0.15.0-snapshot-c66278b-20241208003838",
124
- "@rolldown/binding-linux-x64-gnu": "0.15.0-snapshot-c66278b-20241208003838",
125
- "@rolldown/binding-linux-arm64-musl": "0.15.0-snapshot-c66278b-20241208003838",
126
- "@rolldown/binding-linux-x64-musl": "0.15.0-snapshot-c66278b-20241208003838",
127
- "@rolldown/binding-wasm32-wasi": "0.15.0-snapshot-c66278b-20241208003838",
128
- "@rolldown/binding-win32-arm64-msvc": "0.15.0-snapshot-c66278b-20241208003838",
129
- "@rolldown/binding-win32-ia32-msvc": "0.15.0-snapshot-c66278b-20241208003838",
130
- "@rolldown/binding-win32-x64-msvc": "0.15.0-snapshot-c66278b-20241208003838"
119
+ "@rolldown/binding-darwin-arm64": "0.15.0-snapshot-86db816-20241210003559",
120
+ "@rolldown/binding-darwin-x64": "0.15.0-snapshot-86db816-20241210003559",
121
+ "@rolldown/binding-freebsd-x64": "0.15.0-snapshot-86db816-20241210003559",
122
+ "@rolldown/binding-linux-arm-gnueabihf": "0.15.0-snapshot-86db816-20241210003559",
123
+ "@rolldown/binding-linux-arm64-musl": "0.15.0-snapshot-86db816-20241210003559",
124
+ "@rolldown/binding-linux-arm64-gnu": "0.15.0-snapshot-86db816-20241210003559",
125
+ "@rolldown/binding-linux-x64-gnu": "0.15.0-snapshot-86db816-20241210003559",
126
+ "@rolldown/binding-linux-x64-musl": "0.15.0-snapshot-86db816-20241210003559",
127
+ "@rolldown/binding-win32-arm64-msvc": "0.15.0-snapshot-86db816-20241210003559",
128
+ "@rolldown/binding-win32-ia32-msvc": "0.15.0-snapshot-86db816-20241210003559",
129
+ "@rolldown/binding-wasm32-wasi": "0.15.0-snapshot-86db816-20241210003559",
130
+ "@rolldown/binding-win32-x64-msvc": "0.15.0-snapshot-86db816-20241210003559"
131
131
  },
132
132
  "scripts": {
133
133
  "# Scrips for binding #": "_",