rolldown 1.0.0-beta.8-commit.c76291c → 1.0.0-beta.8-commit.56abf23

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.
Files changed (37) hide show
  1. package/dist/cli.cjs +9 -9
  2. package/dist/cli.mjs +8 -8
  3. package/dist/experimental-index.cjs +7 -3
  4. package/dist/experimental-index.d.cts +2 -2
  5. package/dist/experimental-index.d.mts +2 -2
  6. package/dist/experimental-index.mjs +5 -3
  7. package/dist/filter-index.cjs +93 -11
  8. package/dist/filter-index.d.cts +4 -3
  9. package/dist/filter-index.d.mts +4 -3
  10. package/dist/filter-index.mjs +44 -3
  11. package/dist/index.cjs +3 -3
  12. package/dist/index.d.cts +2 -2
  13. package/dist/index.d.mts +2 -2
  14. package/dist/index.mjs +3 -3
  15. package/dist/parallel-plugin-worker.cjs +5 -4
  16. package/dist/parallel-plugin-worker.mjs +5 -4
  17. package/dist/parallel-plugin.d.cts +2 -2
  18. package/dist/parallel-plugin.d.mts +2 -2
  19. package/dist/parse-ast-index.cjs +1 -1
  20. package/dist/parse-ast-index.d.cts +1 -1
  21. package/dist/parse-ast-index.d.mts +1 -1
  22. package/dist/parse-ast-index.mjs +1 -1
  23. package/dist/shared/{binding.d-BRwjFIld.d.cts → binding.d-Ddl7hcN3.d.cts} +2 -0
  24. package/dist/shared/{binding.d-DVNuaImz.d.mts → binding.d-Y-OUMnnv.d.mts} +2 -0
  25. package/dist/shared/{chunk-DUYDk_2O.mjs → chunk--iN_1bjD.mjs} +1 -1
  26. package/dist/shared/{input-options.d-CcrldgHK.d.cts → input-options.d-DVmWlHE9.d.cts} +3 -56
  27. package/dist/shared/{input-options.d-DVGWBVp4.d.mts → input-options.d-Dnzz-V9o.d.mts} +3 -56
  28. package/dist/shared/misc-BWx4LNta.cjs +68 -0
  29. package/dist/shared/misc-DGAe2XOW.mjs +28 -0
  30. package/dist/shared/{parse-ast-index-CHCsJTcD.mjs → parse-ast-index-BXDjUzKF.mjs} +4 -4
  31. package/dist/shared/{parse-ast-index-n6Ys2h9o.cjs → parse-ast-index-C37DYnt2.cjs} +7 -7
  32. package/dist/shared/{prompt-UMUDMApt.mjs → prompt-AXtOIn-r.mjs} +1 -1
  33. package/dist/shared/{src-_pefwDkF.cjs → src-RTReWFUn.cjs} +127 -119
  34. package/dist/shared/{src-DdLhlxoJ.mjs → src-TcTOaWt7.mjs} +127 -111
  35. package/package.json +16 -16
  36. package/dist/shared/filter-index-DblXSw9s.cjs +0 -255
  37. package/dist/shared/filter-index-hnEzlqRW.mjs +0 -174
@@ -1,20 +1,22 @@
1
1
  "use strict";
2
2
  const require_chunk = require('./chunk-qZFfknuJ.cjs');
3
- const require_parse_ast_index = require('./parse-ast-index-n6Ys2h9o.cjs');
4
- const require_filter_index = require('./filter-index-DblXSw9s.cjs');
3
+ const require_parse_ast_index = require('./parse-ast-index-C37DYnt2.cjs');
4
+ const require_misc = require('./misc-BWx4LNta.cjs');
5
5
  const node_path = require_chunk.__toESM(require("node:path"));
6
6
  const ansis = require_chunk.__toESM(require("ansis"));
7
+ const __rolldown_pluginutils = require_chunk.__toESM(require("@rolldown/pluginutils"));
7
8
  const node_os = require_chunk.__toESM(require("node:os"));
8
9
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
9
10
 
10
11
  //#region package.json
11
- var version = "1.0.0-beta.8-commit.c76291c";
12
+ var version = "1.0.0-beta.8-commit.56abf23";
12
13
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
13
14
 
14
15
  //#endregion
15
16
  //#region src/builtin-plugin/utils.ts
17
+ var import_binding$6 = require_chunk.__toESM(require_parse_ast_index.require_binding());
16
18
  function makeBuiltinPluginCallable(plugin) {
17
- let callablePlugin = new require_parse_ast_index.import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
19
+ let callablePlugin = new import_binding$6.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
18
20
  const wrappedPlugin = plugin;
19
21
  for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
20
22
  return callablePlugin[key](...args$1);
@@ -112,13 +114,13 @@ const logLevelPriority = {
112
114
  //#endregion
113
115
  //#region src/log/log-handler.ts
114
116
  const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
115
- function getLogHandler(level, code$1, logger, pluginName, logLevel) {
116
- if (logLevelPriority[level] < logLevelPriority[logLevel]) return require_filter_index.noop;
117
+ function getLogHandler(level, code, logger, pluginName, logLevel) {
118
+ if (logLevelPriority[level] < logLevelPriority[logLevel]) return require_misc.noop;
117
119
  return (log, pos) => {
118
120
  if (pos != null) logger(LOG_LEVEL_WARN, require_parse_ast_index.logInvalidLogPosition(pluginName));
119
121
  log = normalizeLog(log);
120
122
  if (log.code && !log.pluginCode) log.pluginCode = log.code;
121
- log.code = code$1;
123
+ log.code = code;
122
124
  log.plugin = pluginName;
123
125
  logger(level, log);
124
126
  };
@@ -195,9 +197,9 @@ const getExtendedLogMessage = (log) => {
195
197
  if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
196
198
  return prefix + log.message;
197
199
  };
198
- function relativeId(id$1) {
199
- if (!node_path.default.isAbsolute(id$1)) return id$1;
200
- return node_path.default.relative(node_path.default.resolve(), id$1);
200
+ function relativeId(id) {
201
+ if (!node_path.default.isAbsolute(id)) return id;
202
+ return node_path.default.relative(node_path.default.resolve(), id);
201
203
  }
202
204
 
203
205
  //#endregion
@@ -216,7 +218,7 @@ function normalizeHook(hook) {
216
218
  meta: { order }
217
219
  };
218
220
  }
219
- require_filter_index.unreachable("Invalid hook type");
221
+ require_misc.unreachable("Invalid hook type");
220
222
  }
221
223
 
222
224
  //#endregion
@@ -2161,9 +2163,9 @@ function getErrorMessage(e) {
2161
2163
  if (Object.hasOwn(e, "kind")) return e.message;
2162
2164
  let s = "";
2163
2165
  if (e.plugin) s += `[plugin ${e.plugin}]`;
2164
- const id$1 = e.id ?? e.loc?.file;
2165
- if (id$1) {
2166
- s += " " + id$1;
2166
+ const id = e.id ?? e.loc?.file;
2167
+ if (id) {
2168
+ s += " " + id;
2167
2169
  if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
2168
2170
  }
2169
2171
  if (s) s += "\n";
@@ -2182,7 +2184,7 @@ function joinNewLine(s1, s2) {
2182
2184
  function transformModuleInfo(info, option) {
2183
2185
  return {
2184
2186
  get ast() {
2185
- return require_filter_index.unsupported("ModuleInfo#ast");
2187
+ return require_misc.unsupported("ModuleInfo#ast");
2186
2188
  },
2187
2189
  get code() {
2188
2190
  return info.code;
@@ -2200,11 +2202,12 @@ function transformModuleInfo(info, option) {
2200
2202
 
2201
2203
  //#endregion
2202
2204
  //#region src/utils/transform-side-effects.ts
2205
+ var import_binding$5 = require_chunk.__toESM(require_parse_ast_index.require_binding());
2203
2206
  function bindingifySideEffects(sideEffects) {
2204
2207
  switch (sideEffects) {
2205
- case true: return require_parse_ast_index.import_binding.BindingHookSideEffects.True;
2206
- case false: return require_parse_ast_index.import_binding.BindingHookSideEffects.False;
2207
- case "no-treeshake": return require_parse_ast_index.import_binding.BindingHookSideEffects.NoTreeshake;
2208
+ case true: return import_binding$5.BindingHookSideEffects.True;
2209
+ case false: return import_binding$5.BindingHookSideEffects.False;
2210
+ case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
2208
2211
  case null:
2209
2212
  case void 0: return void 0;
2210
2213
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
@@ -2218,11 +2221,11 @@ function isEmptySourcemapFiled(array$1) {
2218
2221
  if (array$1.length === 0 || !array$1[0]) return true;
2219
2222
  return false;
2220
2223
  }
2221
- function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2224
+ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
2222
2225
  if (!rawMap) return;
2223
2226
  let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
2224
2227
  if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
2225
- if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
2228
+ if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
2226
2229
  return map;
2227
2230
  }
2228
2231
 
@@ -2265,37 +2268,37 @@ function t(...n) {
2265
2268
  //#endregion
2266
2269
  //#region src/plugin/bindingify-hook-filter.ts
2267
2270
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
2268
- if (typeof matcher === "string" || matcher instanceof RegExp) return [require_filter_index.include(generateAtomMatcher(stringKind, matcher))];
2269
- if (Array.isArray(matcher)) return matcher.map((m) => require_filter_index.include(generateAtomMatcher(stringKind, m)));
2271
+ if (typeof matcher === "string" || matcher instanceof RegExp) return [__rolldown_pluginutils.include(generateAtomMatcher(stringKind, matcher))];
2272
+ if (Array.isArray(matcher)) return matcher.map((m) => __rolldown_pluginutils.include(generateAtomMatcher(stringKind, m)));
2270
2273
  let ret = [];
2271
- if (matcher.exclude) ret.push(...require_filter_index.arraify(matcher.exclude).map((m) => require_filter_index.exclude(generateAtomMatcher(stringKind, m))));
2272
- if (matcher.include) ret.push(...require_filter_index.arraify(matcher.include).map((m) => require_filter_index.include(generateAtomMatcher(stringKind, m))));
2274
+ if (matcher.exclude) ret.push(...require_misc.arraify(matcher.exclude).map((m) => __rolldown_pluginutils.exclude(generateAtomMatcher(stringKind, m))));
2275
+ if (matcher.include) ret.push(...require_misc.arraify(matcher.include).map((m) => __rolldown_pluginutils.include(generateAtomMatcher(stringKind, m))));
2273
2276
  return ret;
2274
2277
  }
2275
2278
  function generateAtomMatcher(kind, matcher) {
2276
- return kind === "code" ? require_filter_index.code(matcher) : require_filter_index.id(matcher);
2279
+ return kind === "code" ? __rolldown_pluginutils.code(matcher) : __rolldown_pluginutils.id(matcher);
2277
2280
  }
2278
2281
  function transformFilterMatcherToFilterExprs(filterOption) {
2279
2282
  if (!filterOption) return void 0;
2280
2283
  if (Array.isArray(filterOption)) return filterOption;
2281
- const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
2284
+ const { id, code, moduleType } = filterOption;
2282
2285
  let ret = [];
2283
2286
  let idIncludes = [];
2284
2287
  let idExcludes = [];
2285
2288
  let codeIncludes = [];
2286
2289
  let codeExcludes = [];
2287
- if (id$1) [idIncludes, idExcludes] = d(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
2288
- if (code$1) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
2290
+ if (id) [idIncludes, idExcludes] = d(generalHookFilterMatcherToFilterExprs(id, "id") ?? [], (m) => m.kind === "include");
2291
+ if (code) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code, "code") ?? [], (m) => m.kind === "include");
2289
2292
  ret.push(...idExcludes);
2290
2293
  ret.push(...codeExcludes);
2291
2294
  let andExprList = [];
2292
- if (moduleType$1) {
2293
- let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
2294
- andExprList.push(require_filter_index.or(...moduleTypes.map((m) => require_filter_index.moduleType(m))));
2295
+ if (moduleType) {
2296
+ let moduleTypes = Array.isArray(moduleType) ? moduleType : moduleType.include ?? [];
2297
+ andExprList.push(__rolldown_pluginutils.or(...moduleTypes.map((m) => __rolldown_pluginutils.moduleType(m))));
2295
2298
  }
2296
- if (idIncludes.length) andExprList.push(require_filter_index.or(...idIncludes.map((item) => item.expr)));
2297
- if (codeIncludes.length) andExprList.push(require_filter_index.or(...codeIncludes.map((item) => item.expr)));
2298
- if (andExprList.length) ret.push(require_filter_index.include(require_filter_index.and(...andExprList)));
2299
+ if (idIncludes.length) andExprList.push(__rolldown_pluginutils.or(...idIncludes.map((item) => item.expr)));
2300
+ if (codeIncludes.length) andExprList.push(__rolldown_pluginutils.or(...codeIncludes.map((item) => item.expr)));
2301
+ if (andExprList.length) ret.push(__rolldown_pluginutils.include(__rolldown_pluginutils.and(...andExprList)));
2299
2302
  return ret;
2300
2303
  }
2301
2304
  function bindingifyGeneralHookFilter(stringKind, pattern) {
@@ -2393,13 +2396,14 @@ function bindingifyRenderChunkFilter(filterOption) {
2393
2396
 
2394
2397
  //#endregion
2395
2398
  //#region src/plugin/bindingify-plugin-hook-meta.ts
2399
+ var import_binding$4 = require_chunk.__toESM(require_parse_ast_index.require_binding());
2396
2400
  function bindingifyPluginHookMeta(options) {
2397
2401
  return { order: bindingPluginOrder(options.order) };
2398
2402
  }
2399
2403
  function bindingPluginOrder(order) {
2400
2404
  switch (order) {
2401
- case "post": return require_parse_ast_index.import_binding.BindingPluginOrder.Post;
2402
- case "pre": return require_parse_ast_index.import_binding.BindingPluginOrder.Pre;
2405
+ case "post": return import_binding$4.BindingPluginOrder.Post;
2406
+ case "pre": return import_binding$4.BindingPluginOrder.Pre;
2403
2407
  case null:
2404
2408
  case void 0: return void 0;
2405
2409
  default: throw new Error(`Unknown plugin order: ${order}`);
@@ -2426,37 +2430,37 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2426
2430
  this.data = data;
2427
2431
  this.onLog = onLog;
2428
2432
  this.currentLoadingModule = currentLoadingModule;
2429
- this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
2433
+ this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
2430
2434
  }
2431
2435
  async load(options) {
2432
- const id$1 = options.id;
2433
- if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, require_parse_ast_index.logCycleLoading(this.pluginName, this.currentLoadingModule));
2434
- const moduleInfo = this.data.getModuleInfo(id$1, this.context);
2436
+ const id = options.id;
2437
+ if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, require_parse_ast_index.logCycleLoading(this.pluginName, this.currentLoadingModule));
2438
+ const moduleInfo = this.data.getModuleInfo(id, this.context);
2435
2439
  if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
2436
2440
  const rawOptions = {
2437
2441
  meta: options.meta || {},
2438
2442
  moduleSideEffects: options.moduleSideEffects || null,
2439
2443
  invalidate: false
2440
2444
  };
2441
- this.data.updateModuleOption(id$1, rawOptions);
2445
+ this.data.updateModuleOption(id, rawOptions);
2442
2446
  async function createLoadModulePromise(context, data) {
2443
- const loadPromise = data.loadModulePromiseMap.get(id$1);
2447
+ const loadPromise = data.loadModulePromiseMap.get(id);
2444
2448
  if (loadPromise) return loadPromise;
2445
2449
  const promise$1 = new Promise((resolve, _) => {
2446
- data.loadModulePromiseResolveFnMap.set(id$1, resolve);
2450
+ data.loadModulePromiseResolveFnMap.set(id, resolve);
2447
2451
  });
2448
- data.loadModulePromiseMap.set(id$1, promise$1);
2452
+ data.loadModulePromiseMap.set(id, promise$1);
2449
2453
  try {
2450
- await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2454
+ await context.load(id, bindingifySideEffects(options.moduleSideEffects));
2451
2455
  } catch (e) {
2452
- data.loadModulePromiseMap.delete(id$1);
2453
- data.loadModulePromiseResolveFnMap.delete(id$1);
2456
+ data.loadModulePromiseMap.delete(id);
2457
+ data.loadModulePromiseResolveFnMap.delete(id);
2454
2458
  throw e;
2455
2459
  }
2456
2460
  return promise$1;
2457
2461
  }
2458
2462
  await createLoadModulePromise(this.context, this.data);
2459
- return this.data.getModuleInfo(id$1, this.context);
2463
+ return this.data.getModuleInfo(id, this.context);
2460
2464
  }
2461
2465
  async resolve(source, importer, options) {
2462
2466
  let receipt = void 0;
@@ -2470,12 +2474,12 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2470
2474
  const info = this.data.getModuleOption(res.id) || {};
2471
2475
  return {
2472
2476
  ...res,
2473
- external: res.external === "relative" ? require_filter_index.unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2477
+ external: res.external === "relative" ? require_misc.unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2474
2478
  ...info
2475
2479
  };
2476
2480
  }
2477
2481
  emitFile = (file) => {
2478
- if (file.type === "prebuilt-chunk") return require_filter_index.unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2482
+ if (file.type === "prebuilt-chunk") return require_misc.unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2479
2483
  if (file.type === "chunk") return this.context.emitChunk(file);
2480
2484
  const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
2481
2485
  const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
@@ -2499,8 +2503,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2499
2503
  getModuleIds() {
2500
2504
  return this.data.getModuleIds(this.context);
2501
2505
  }
2502
- addWatchFile(id$1) {
2503
- this.context.addWatchFile(id$1);
2506
+ addWatchFile(id) {
2507
+ this.context.addWatchFile(id);
2504
2508
  }
2505
2509
  parse(input, options) {
2506
2510
  return require_parse_ast_index.parseAst(input, options);
@@ -2634,18 +2638,18 @@ function bindingifyTransform(args$1) {
2634
2638
  if (!hook) return {};
2635
2639
  const { handler, meta, options } = normalizeHook(hook);
2636
2640
  return {
2637
- plugin: async (ctx, code$1, id$1, meta$1) => {
2638
- const ret = await handler.call(new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, id$1, meta$1);
2641
+ plugin: async (ctx, code, id, meta$1) => {
2642
+ const ret = await handler.call(new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id, code, args$1.onLog, args$1.logLevel, args$1.watchMode), code, id, meta$1);
2639
2643
  if (ret == null) return void 0;
2640
2644
  if (typeof ret === "string") return { code: ret };
2641
- let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
2645
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id, {
2642
2646
  meta: ret.meta ?? {},
2643
2647
  moduleSideEffects: ret.moduleSideEffects ?? null,
2644
2648
  invalidate: false
2645
2649
  });
2646
2650
  return {
2647
2651
  code: ret.code,
2648
- map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
2652
+ map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, ret.map)),
2649
2653
  sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
2650
2654
  moduleType: ret.moduleType
2651
2655
  };
@@ -2659,16 +2663,16 @@ function bindingifyLoad(args$1) {
2659
2663
  if (!hook) return {};
2660
2664
  const { handler, meta, options } = normalizeHook(hook);
2661
2665
  return {
2662
- plugin: async (ctx, id$1) => {
2663
- const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode, id$1), id$1);
2666
+ plugin: async (ctx, id) => {
2667
+ const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode, id), id);
2664
2668
  if (ret == null) return;
2665
2669
  if (typeof ret === "string") return { code: ret };
2666
- let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
2670
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id, {
2667
2671
  meta: ret.meta || {},
2668
2672
  moduleSideEffects: ret.moduleSideEffects ?? null,
2669
2673
  invalidate: false
2670
2674
  });
2671
- let map = preProcessSourceMap(ret, id$1);
2675
+ let map = preProcessSourceMap(ret, id);
2672
2676
  return {
2673
2677
  code: ret.code,
2674
2678
  map: bindingifySourcemap$1(map),
@@ -2680,11 +2684,11 @@ function bindingifyLoad(args$1) {
2680
2684
  filter: bindingifyLoadFilter(options.filter)
2681
2685
  };
2682
2686
  }
2683
- function preProcessSourceMap(ret, id$1) {
2687
+ function preProcessSourceMap(ret, id) {
2684
2688
  if (!ret.map) return;
2685
2689
  let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
2686
2690
  if (!isEmptySourcemapFiled(map.sources)) {
2687
- const directory = node_path.default.dirname(id$1) || ".";
2691
+ const directory = node_path.default.dirname(id) || ".";
2688
2692
  const sourceRoot = map.sourceRoot || ".";
2689
2693
  map.sources = map.sources.map((source) => node_path.default.resolve(directory, sourceRoot, source));
2690
2694
  }
@@ -2820,7 +2824,7 @@ function bindingifyFormat(format) {
2820
2824
  case "iife": return "iife";
2821
2825
  case "umd": return "umd";
2822
2826
  case "experimental-app": return "app";
2823
- default: require_filter_index.unimplemented(`output.format: ${format}`);
2827
+ default: require_misc.unimplemented(`output.format: ${format}`);
2824
2828
  }
2825
2829
  }
2826
2830
  function bindingifySourcemap(sourcemap) {
@@ -3110,9 +3114,9 @@ function bindingifyRenderChunk(args$1) {
3110
3114
  if (!hook) return {};
3111
3115
  const { handler, meta, options } = normalizeHook(hook);
3112
3116
  return {
3113
- plugin: async (ctx, code$1, chunk, opts, meta$1) => {
3117
+ plugin: async (ctx, code, chunk, opts, meta$1) => {
3114
3118
  if (args$1.pluginContextData.getRenderChunkMeta() == null) args$1.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
3115
- const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), args$1.pluginContextData.getRenderChunkMeta());
3119
+ const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), args$1.pluginContextData.getRenderChunkMeta());
3116
3120
  if (ret == null) return;
3117
3121
  if (typeof ret === "string") return { code: ret };
3118
3122
  if (!ret.map) return { code: ret.code };
@@ -3248,8 +3252,8 @@ function bindingifyWatchChange(args$1) {
3248
3252
  if (!hook) return {};
3249
3253
  const { handler, meta } = normalizeHook(hook);
3250
3254
  return {
3251
- plugin: async (ctx, id$1, event) => {
3252
- await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), id$1, { event });
3255
+ plugin: async (ctx, id, event) => {
3256
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), id, { event });
3253
3257
  },
3254
3258
  meta: bindingifyPluginHookMeta(meta)
3255
3259
  };
@@ -3457,46 +3461,46 @@ var PluginContextData = class {
3457
3461
  loadModulePromiseMap = new Map();
3458
3462
  loadModulePromiseResolveFnMap = new Map();
3459
3463
  renderedChunkMeta = null;
3460
- updateModuleOption(id$1, option) {
3461
- const existing = this.moduleOptionMap.get(id$1);
3464
+ updateModuleOption(id, option) {
3465
+ const existing = this.moduleOptionMap.get(id);
3462
3466
  if (existing) {
3463
3467
  if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
3464
3468
  if (option.meta != null) Object.assign(existing.meta, option.meta);
3465
3469
  if (option.invalidate != null) existing.invalidate = option.invalidate;
3466
3470
  } else {
3467
- this.moduleOptionMap.set(id$1, option);
3471
+ this.moduleOptionMap.set(id, option);
3468
3472
  return option;
3469
3473
  }
3470
3474
  return existing;
3471
3475
  }
3472
- getModuleOption(id$1) {
3473
- const option = this.moduleOptionMap.get(id$1);
3476
+ getModuleOption(id) {
3477
+ const option = this.moduleOptionMap.get(id);
3474
3478
  if (!option) {
3475
3479
  const raw = {
3476
3480
  moduleSideEffects: null,
3477
3481
  meta: {}
3478
3482
  };
3479
- this.moduleOptionMap.set(id$1, raw);
3483
+ this.moduleOptionMap.set(id, raw);
3480
3484
  return raw;
3481
3485
  }
3482
3486
  return option;
3483
3487
  }
3484
- getModuleInfo(id$1, context) {
3485
- const bindingInfo = context.getModuleInfo(id$1);
3488
+ getModuleInfo(id, context) {
3489
+ const bindingInfo = context.getModuleInfo(id);
3486
3490
  if (bindingInfo) {
3487
- const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
3488
- return this.proxyModuleInfo(id$1, info);
3491
+ const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
3492
+ return this.proxyModuleInfo(id, info);
3489
3493
  }
3490
3494
  return null;
3491
3495
  }
3492
- proxyModuleInfo(id$1, info) {
3496
+ proxyModuleInfo(id, info) {
3493
3497
  let moduleSideEffects = info.moduleSideEffects;
3494
3498
  Object.defineProperty(info, "moduleSideEffects", {
3495
3499
  get() {
3496
3500
  return moduleSideEffects;
3497
3501
  },
3498
3502
  set: (v) => {
3499
- this.updateModuleOption(id$1, {
3503
+ this.updateModuleOption(id, {
3500
3504
  moduleSideEffects: v,
3501
3505
  meta: info.meta,
3502
3506
  invalidate: true
@@ -3527,8 +3531,8 @@ var PluginContextData = class {
3527
3531
  getRenderChunkMeta() {
3528
3532
  return this.renderedChunkMeta;
3529
3533
  }
3530
- markModuleLoaded(id$1, _success) {
3531
- const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
3534
+ markModuleLoaded(id, _success) {
3535
+ const resolve = this.loadModulePromiseResolveFnMap.get(id);
3532
3536
  if (resolve) resolve();
3533
3537
  }
3534
3538
  clear() {
@@ -3551,6 +3555,7 @@ function isReadonlyArray(input) {
3551
3555
 
3552
3556
  //#endregion
3553
3557
  //#region src/utils/bindingify-input-options.ts
3558
+ var import_binding$3 = require_chunk.__toESM(require_parse_ast_index.require_binding());
3554
3559
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3555
3560
  const pluginContextData = new PluginContextData();
3556
3561
  const plugins = rawPlugins.map((plugin) => {
@@ -3610,15 +3615,15 @@ function bindingifyHmr(hmr) {
3610
3615
  }
3611
3616
  function bindingifyExternal(external) {
3612
3617
  if (external) {
3613
- if (typeof external === "function") return (id$1, importer, isResolved) => {
3614
- if (id$1.startsWith("\0")) return false;
3615
- return external(id$1, importer, isResolved) ?? false;
3618
+ if (typeof external === "function") return (id, importer, isResolved) => {
3619
+ if (id.startsWith("\0")) return false;
3620
+ return external(id, importer, isResolved) ?? false;
3616
3621
  };
3617
- const externalArr = require_filter_index.arraify(external);
3618
- return (id$1, _importer, _isResolved) => {
3622
+ const externalArr = require_misc.arraify(external);
3623
+ return (id, _importer, _isResolved) => {
3619
3624
  return externalArr.some((pat) => {
3620
- if (pat instanceof RegExp) return pat.test(id$1);
3621
- return id$1 === pat;
3625
+ if (pat instanceof RegExp) return pat.test(id);
3626
+ return id === pat;
3622
3627
  });
3623
3628
  };
3624
3629
  }
@@ -3629,7 +3634,7 @@ function bindingifyResolve(resolve) {
3629
3634
  return {
3630
3635
  alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
3631
3636
  find: name,
3632
- replacements: require_filter_index.arraify(replacement)
3637
+ replacements: require_misc.arraify(replacement)
3633
3638
  })) : void 0,
3634
3639
  extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
3635
3640
  target: name,
@@ -3663,10 +3668,10 @@ function bindingifyInject(inject) {
3663
3668
  }
3664
3669
  function bindingifyLogLevel(logLevel) {
3665
3670
  switch (logLevel) {
3666
- case "silent": return require_parse_ast_index.import_binding.BindingLogLevel.Silent;
3667
- case "debug": return require_parse_ast_index.import_binding.BindingLogLevel.Debug;
3668
- case "warn": return require_parse_ast_index.import_binding.BindingLogLevel.Warn;
3669
- case "info": return require_parse_ast_index.import_binding.BindingLogLevel.Info;
3671
+ case "silent": return import_binding$3.BindingLogLevel.Silent;
3672
+ case "debug": return import_binding$3.BindingLogLevel.Debug;
3673
+ case "warn": return import_binding$3.BindingLogLevel.Warn;
3674
+ case "info": return import_binding$3.BindingLogLevel.Info;
3670
3675
  default: throw new Error(`Unexpected log level: ${logLevel}`);
3671
3676
  }
3672
3677
  }
@@ -3876,7 +3881,7 @@ function createComposedPlugin(plugins) {
3876
3881
  if (symbolForCallerThatSkipSelf === handlerSymbol) continue;
3877
3882
  const { handler: handlerFn } = normalizeHook(handler);
3878
3883
  const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), source, importer, rawHookResolveIdOptions);
3879
- if (!require_filter_index.isNullish(result)) return result;
3884
+ if (!require_misc.isNullish(result)) return result;
3880
3885
  }
3881
3886
  };
3882
3887
  }
@@ -3898,11 +3903,11 @@ function createComposedPlugin(plugins) {
3898
3903
  case "load": {
3899
3904
  if (batchedHooks.load) {
3900
3905
  const batchedHandlers = batchedHooks.load;
3901
- composed.load = async function(id$1) {
3906
+ composed.load = async function(id) {
3902
3907
  for (const [handler, plugin] of batchedHandlers) {
3903
3908
  const { handler: handlerFn } = normalizeHook(handler);
3904
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
3905
- if (!require_filter_index.isNullish(result)) return result;
3909
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id);
3910
+ if (!require_misc.isNullish(result)) return result;
3906
3911
  }
3907
3912
  };
3908
3913
  }
@@ -3911,11 +3916,11 @@ function createComposedPlugin(plugins) {
3911
3916
  case "transform": {
3912
3917
  if (batchedHooks.transform) {
3913
3918
  const batchedHandlers = batchedHooks.transform;
3914
- composed.transform = async function(initialCode, id$1, moduleType$1) {
3915
- let code$1 = initialCode;
3919
+ composed.transform = async function(initialCode, id, moduleType) {
3920
+ let code = initialCode;
3916
3921
  let moduleSideEffects = void 0;
3917
3922
  function updateOutput(newCode, newModuleSideEffects) {
3918
- code$1 = newCode;
3923
+ code = newCode;
3919
3924
  moduleSideEffects = newModuleSideEffects ?? void 0;
3920
3925
  }
3921
3926
  for (const [handler, plugin] of batchedHandlers) {
@@ -3923,14 +3928,14 @@ function createComposedPlugin(plugins) {
3923
3928
  this.getCombinedSourcemap = () => {
3924
3929
  throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
3925
3930
  };
3926
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
3927
- if (!require_filter_index.isNullish(result)) {
3931
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
3932
+ if (!require_misc.isNullish(result)) {
3928
3933
  if (typeof result === "string") updateOutput(result);
3929
3934
  else if (result.code) updateOutput(result.code, result.moduleSideEffects);
3930
3935
  }
3931
3936
  }
3932
3937
  return {
3933
- code: code$1,
3938
+ code,
3934
3939
  moduleSideEffects
3935
3940
  };
3936
3941
  };
@@ -3952,11 +3957,11 @@ function createComposedPlugin(plugins) {
3952
3957
  case "renderChunk": {
3953
3958
  if (batchedHooks.renderChunk) {
3954
3959
  const batchedHandlers = batchedHooks.renderChunk;
3955
- composed.renderChunk = async function(code$1, chunk, options, meta) {
3960
+ composed.renderChunk = async function(code, chunk, options, meta) {
3956
3961
  for (const [handler, plugin] of batchedHandlers) {
3957
3962
  const { handler: handlerFn } = normalizeHook(handler);
3958
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
3959
- if (!require_filter_index.isNullish(result)) return result;
3963
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, chunk, options, meta);
3964
+ if (!require_misc.isNullish(result)) return result;
3960
3965
  }
3961
3966
  };
3962
3967
  }
@@ -3992,10 +3997,10 @@ function createComposedPlugin(plugins) {
3992
3997
  case "watchChange": {
3993
3998
  if (batchedHooks.watchChange) {
3994
3999
  const batchedHandlers = batchedHooks.watchChange;
3995
- composed.watchChange = async function(id$1, event) {
4000
+ composed.watchChange = async function(id, event) {
3996
4001
  await Promise.all(batchedHandlers.map(([handler, plugin]) => {
3997
4002
  const { handler: handlerFn } = normalizeHook(handler);
3998
- return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
4003
+ return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id, event);
3999
4004
  }));
4000
4005
  };
4001
4006
  }
@@ -4058,6 +4063,7 @@ function composeJsPlugins(plugins) {
4058
4063
 
4059
4064
  //#endregion
4060
4065
  //#region src/utils/initialize-parallel-plugins.ts
4066
+ var import_binding$2 = require_chunk.__toESM(require_parse_ast_index.require_binding());
4061
4067
  async function initializeParallelPlugins(plugins) {
4062
4068
  const pluginInfos = [];
4063
4069
  for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
@@ -4070,7 +4076,7 @@ async function initializeParallelPlugins(plugins) {
4070
4076
  }
4071
4077
  if (pluginInfos.length <= 0) return void 0;
4072
4078
  const count = Math.min((0, node_os.availableParallelism)(), 8);
4073
- const parallelJsPluginRegistry = new require_parse_ast_index.import_binding.ParallelJsPluginRegistry(count);
4079
+ const parallelJsPluginRegistry = new import_binding$2.ParallelJsPluginRegistry(count);
4074
4080
  const registryId = parallelJsPluginRegistry.id;
4075
4081
  const workers = await initializeWorkers(registryId, count, pluginInfos);
4076
4082
  const stopWorkers = async () => {
@@ -4141,16 +4147,17 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
4141
4147
 
4142
4148
  //#endregion
4143
4149
  //#region src/utils/create-bundler.ts
4150
+ var import_binding$1 = require_chunk.__toESM(require_parse_ast_index.require_binding());
4144
4151
  let asyncRuntimeShutdown = false;
4145
4152
  async function createBundler(inputOptions, outputOptions, isClose) {
4146
4153
  const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
4147
- if (asyncRuntimeShutdown) (0, require_parse_ast_index.import_binding.startAsyncRuntime)();
4154
+ if (asyncRuntimeShutdown) (0, import_binding$1.startAsyncRuntime)();
4148
4155
  try {
4149
4156
  return {
4150
- bundler: new require_parse_ast_index.import_binding.Bundler(option.bundlerOptions),
4157
+ bundler: new import_binding$1.Bundler(option.bundlerOptions),
4151
4158
  stopWorkers: option.stopWorkers,
4152
4159
  shutdown: () => {
4153
- (0, require_parse_ast_index.import_binding.shutdownAsyncRuntime)();
4160
+ (0, import_binding$1.shutdownAsyncRuntime)();
4154
4161
  asyncRuntimeShutdown = true;
4155
4162
  }
4156
4163
  };
@@ -4267,8 +4274,8 @@ var WatcherEmitter = class {
4267
4274
  break;
4268
4275
  case "event":
4269
4276
  for (const listener of listeners) {
4270
- const code$1 = event.bundleEventKind();
4271
- switch (code$1) {
4277
+ const code = event.bundleEventKind();
4278
+ switch (code) {
4272
4279
  case "BUNDLE_END":
4273
4280
  const { duration, output, result } = event.bundleEndData();
4274
4281
  await listener({
@@ -4287,7 +4294,7 @@ var WatcherEmitter = class {
4287
4294
  });
4288
4295
  break;
4289
4296
  default:
4290
- await listener({ code: code$1 });
4297
+ await listener({ code });
4291
4298
  break;
4292
4299
  }
4293
4300
  }
@@ -4308,6 +4315,7 @@ var WatcherEmitter = class {
4308
4315
 
4309
4316
  //#endregion
4310
4317
  //#region src/api/watch/watcher.ts
4318
+ var import_binding = require_chunk.__toESM(require_parse_ast_index.require_binding());
4311
4319
  var Watcher = class {
4312
4320
  closed;
4313
4321
  inner;
@@ -4329,20 +4337,20 @@ var Watcher = class {
4329
4337
  this.closed = true;
4330
4338
  for (const stop of this.stopWorkers) await stop?.();
4331
4339
  await this.inner.close();
4332
- (0, require_parse_ast_index.import_binding.shutdownAsyncRuntime)();
4340
+ (0, import_binding.shutdownAsyncRuntime)();
4333
4341
  }
4334
4342
  start() {
4335
4343
  process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
4336
4344
  }
4337
4345
  };
4338
4346
  async function createWatcher(emitter, input) {
4339
- const options = require_filter_index.arraify(input);
4340
- const bundlerOptions = await Promise.all(options.map((option) => require_filter_index.arraify(option.output || {}).map(async (output) => {
4347
+ const options = require_misc.arraify(input);
4348
+ const bundlerOptions = await Promise.all(options.map((option) => require_misc.arraify(option.output || {}).map(async (output) => {
4341
4349
  const inputOptions = await PluginDriver.callOptionsHook(option, true);
4342
4350
  return createBundlerOptions(inputOptions, output, true);
4343
4351
  })).flat());
4344
4352
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4345
- const bindingWatcher = new require_parse_ast_index.import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
4353
+ const bindingWatcher = new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
4346
4354
  const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
4347
4355
  watcher.start();
4348
4356
  }