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,19 +1,20 @@
1
- import { __esm } from "./chunk-DUYDk_2O.mjs";
2
- import { augmentCodeLocation, error, import_binding, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-CHCsJTcD.mjs";
3
- import { and, arraify, code, exclude, id, include, init_filter_index, init_misc, isNullish, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./filter-index-hnEzlqRW.mjs";
1
+ import { __esm, __toESM } from "./chunk--iN_1bjD.mjs";
2
+ import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, require_binding } from "./parse-ast-index-BXDjUzKF.mjs";
3
+ import { arraify, init_misc, isNullish, noop, unimplemented, unreachable, unsupported } from "./misc-DGAe2XOW.mjs";
4
4
  import path from "node:path";
5
5
  import colors from "ansis";
6
+ import * as filter from "@rolldown/pluginutils";
6
7
  import { availableParallelism } from "node:os";
7
8
  import { Worker } from "node:worker_threads";
8
9
 
9
10
  //#region package.json
10
- var version = "1.0.0-beta.8-commit.c76291c";
11
+ var version = "1.0.0-beta.8-commit.56abf23";
11
12
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
12
13
 
13
14
  //#endregion
14
15
  //#region src/builtin-plugin/utils.ts
15
16
  function makeBuiltinPluginCallable(plugin) {
16
- let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
17
+ let callablePlugin = new import_binding$6.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
17
18
  const wrappedPlugin = plugin;
18
19
  for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
19
20
  return callablePlugin[key](...args$1);
@@ -26,7 +27,10 @@ function bindingifyBuiltInPlugin(plugin) {
26
27
  options: plugin._options
27
28
  };
28
29
  }
29
- var init_utils = __esm({ "src/builtin-plugin/utils.ts"() {} });
30
+ var import_binding$6;
31
+ var init_utils = __esm({ "src/builtin-plugin/utils.ts"() {
32
+ import_binding$6 = __toESM(require_binding());
33
+ } });
30
34
 
31
35
  //#endregion
32
36
  //#region src/builtin-plugin/constructors.ts
@@ -118,13 +122,13 @@ var init_logging = __esm({ "src/log/logging.ts"() {
118
122
 
119
123
  //#endregion
120
124
  //#region src/log/log-handler.ts
121
- function getLogHandler(level, code$1, logger, pluginName, logLevel) {
125
+ function getLogHandler(level, code, logger, pluginName, logLevel) {
122
126
  if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
123
127
  return (log, pos) => {
124
128
  if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
125
129
  log = normalizeLog(log);
126
130
  if (log.code && !log.pluginCode) log.pluginCode = log.code;
127
- log.code = code$1;
131
+ log.code = code;
128
132
  log.plugin = pluginName;
129
133
  logger(level, log);
130
134
  };
@@ -171,9 +175,9 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
171
175
  };
172
176
  return logger;
173
177
  }
174
- function relativeId(id$1) {
175
- if (!path.isAbsolute(id$1)) return id$1;
176
- return path.relative(path.resolve(), id$1);
178
+ function relativeId(id) {
179
+ if (!path.isAbsolute(id)) return id;
180
+ return path.relative(path.resolve(), id);
177
181
  }
178
182
  var getOnLog, getDefaultOnLog, addLogToString, defaultPrintLog, getExtendedLogMessage;
179
183
  var init_logger = __esm({ "src/log/logger.ts"() {
@@ -2212,9 +2216,9 @@ function getErrorMessage(e$5) {
2212
2216
  if (Object.hasOwn(e$5, "kind")) return e$5.message;
2213
2217
  let s$10 = "";
2214
2218
  if (e$5.plugin) s$10 += `[plugin ${e$5.plugin}]`;
2215
- const id$1 = e$5.id ?? e$5.loc?.file;
2216
- if (id$1) {
2217
- s$10 += " " + id$1;
2219
+ const id = e$5.id ?? e$5.loc?.file;
2220
+ if (id) {
2221
+ s$10 += " " + id;
2218
2222
  if (e$5.loc) s$10 += `:${e$5.loc.line}:${e$5.loc.column}`;
2219
2223
  }
2220
2224
  if (s$10) s$10 += "\n";
@@ -2257,15 +2261,18 @@ var init_transform_module_info = __esm({ "src/utils/transform-module-info.ts"()
2257
2261
  //#region src/utils/transform-side-effects.ts
2258
2262
  function bindingifySideEffects(sideEffects) {
2259
2263
  switch (sideEffects) {
2260
- case true: return import_binding.BindingHookSideEffects.True;
2261
- case false: return import_binding.BindingHookSideEffects.False;
2262
- case "no-treeshake": return import_binding.BindingHookSideEffects.NoTreeshake;
2264
+ case true: return import_binding$5.BindingHookSideEffects.True;
2265
+ case false: return import_binding$5.BindingHookSideEffects.False;
2266
+ case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
2263
2267
  case null:
2264
2268
  case void 0: return void 0;
2265
2269
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
2266
2270
  }
2267
2271
  }
2268
- var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"() {} });
2272
+ var import_binding$5;
2273
+ var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"() {
2274
+ import_binding$5 = __toESM(require_binding());
2275
+ } });
2269
2276
 
2270
2277
  //#endregion
2271
2278
  //#region src/utils/transform-sourcemap.ts
@@ -2274,11 +2281,11 @@ function isEmptySourcemapFiled(array$1) {
2274
2281
  if (array$1.length === 0 || !array$1[0]) return true;
2275
2282
  return false;
2276
2283
  }
2277
- function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2284
+ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
2278
2285
  if (!rawMap) return;
2279
2286
  let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
2280
2287
  if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
2281
- if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
2288
+ if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
2282
2289
  return map;
2283
2290
  }
2284
2291
  var init_transform_sourcemap = __esm({ "src/utils/transform-sourcemap.ts"() {} });
@@ -3496,37 +3503,37 @@ var init_dist = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/rem
3496
3503
  //#endregion
3497
3504
  //#region src/plugin/bindingify-hook-filter.ts
3498
3505
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
3499
- if (typeof matcher === "string" || matcher instanceof RegExp) return [include(generateAtomMatcher(stringKind, matcher))];
3500
- if (Array.isArray(matcher)) return matcher.map((m$10) => include(generateAtomMatcher(stringKind, m$10)));
3506
+ if (typeof matcher === "string" || matcher instanceof RegExp) return [filter.include(generateAtomMatcher(stringKind, matcher))];
3507
+ if (Array.isArray(matcher)) return matcher.map((m$10) => filter.include(generateAtomMatcher(stringKind, m$10)));
3501
3508
  let ret = [];
3502
- if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m$10) => exclude(generateAtomMatcher(stringKind, m$10))));
3503
- if (matcher.include) ret.push(...arraify(matcher.include).map((m$10) => include(generateAtomMatcher(stringKind, m$10))));
3509
+ if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m$10) => filter.exclude(generateAtomMatcher(stringKind, m$10))));
3510
+ if (matcher.include) ret.push(...arraify(matcher.include).map((m$10) => filter.include(generateAtomMatcher(stringKind, m$10))));
3504
3511
  return ret;
3505
3512
  }
3506
3513
  function generateAtomMatcher(kind, matcher) {
3507
- return kind === "code" ? code(matcher) : id(matcher);
3514
+ return kind === "code" ? filter.code(matcher) : filter.id(matcher);
3508
3515
  }
3509
3516
  function transformFilterMatcherToFilterExprs(filterOption) {
3510
3517
  if (!filterOption) return void 0;
3511
3518
  if (Array.isArray(filterOption)) return filterOption;
3512
- const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
3519
+ const { id, code, moduleType } = filterOption;
3513
3520
  let ret = [];
3514
3521
  let idIncludes = [];
3515
3522
  let idExcludes = [];
3516
3523
  let codeIncludes = [];
3517
3524
  let codeExcludes = [];
3518
- if (id$1) [idIncludes, idExcludes] = d$3(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m$10) => m$10.kind === "include");
3519
- if (code$1) [codeIncludes, codeExcludes] = d$3(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m$10) => m$10.kind === "include");
3525
+ if (id) [idIncludes, idExcludes] = d$3(generalHookFilterMatcherToFilterExprs(id, "id") ?? [], (m$10) => m$10.kind === "include");
3526
+ if (code) [codeIncludes, codeExcludes] = d$3(generalHookFilterMatcherToFilterExprs(code, "code") ?? [], (m$10) => m$10.kind === "include");
3520
3527
  ret.push(...idExcludes);
3521
3528
  ret.push(...codeExcludes);
3522
3529
  let andExprList = [];
3523
- if (moduleType$1) {
3524
- let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
3525
- andExprList.push(or(...moduleTypes.map((m$10) => moduleType(m$10))));
3530
+ if (moduleType) {
3531
+ let moduleTypes = Array.isArray(moduleType) ? moduleType : moduleType.include ?? [];
3532
+ andExprList.push(filter.or(...moduleTypes.map((m$10) => filter.moduleType(m$10))));
3526
3533
  }
3527
- if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
3528
- if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
3529
- if (andExprList.length) ret.push(include(and(...andExprList)));
3534
+ if (idIncludes.length) andExprList.push(filter.or(...idIncludes.map((item) => item.expr)));
3535
+ if (codeIncludes.length) andExprList.push(filter.or(...codeIncludes.map((item) => item.expr)));
3536
+ if (andExprList.length) ret.push(filter.include(filter.and(...andExprList)));
3530
3537
  return ret;
3531
3538
  }
3532
3539
  function bindingifyGeneralHookFilter(stringKind, pattern) {
@@ -3623,7 +3630,6 @@ function bindingifyRenderChunkFilter(filterOption) {
3623
3630
  }
3624
3631
  var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
3625
3632
  init_dist();
3626
- init_filter_index();
3627
3633
  init_misc();
3628
3634
  } });
3629
3635
 
@@ -3634,14 +3640,17 @@ function bindingifyPluginHookMeta(options) {
3634
3640
  }
3635
3641
  function bindingPluginOrder(order) {
3636
3642
  switch (order) {
3637
- case "post": return import_binding.BindingPluginOrder.Post;
3638
- case "pre": return import_binding.BindingPluginOrder.Pre;
3643
+ case "post": return import_binding$4.BindingPluginOrder.Post;
3644
+ case "pre": return import_binding$4.BindingPluginOrder.Pre;
3639
3645
  case null:
3640
3646
  case void 0: return void 0;
3641
3647
  default: throw new Error(`Unknown plugin order: ${order}`);
3642
3648
  }
3643
3649
  }
3644
- var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {} });
3650
+ var import_binding$4;
3651
+ var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {
3652
+ import_binding$4 = __toESM(require_binding());
3653
+ } });
3645
3654
 
3646
3655
  //#endregion
3647
3656
  //#region src/utils/asset-source.ts
@@ -3673,37 +3682,37 @@ var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
3673
3682
  this.data = data;
3674
3683
  this.onLog = onLog;
3675
3684
  this.currentLoadingModule = currentLoadingModule;
3676
- this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
3685
+ this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
3677
3686
  }
3678
3687
  async load(options) {
3679
- const id$1 = options.id;
3680
- if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
3681
- const moduleInfo = this.data.getModuleInfo(id$1, this.context);
3688
+ const id = options.id;
3689
+ if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
3690
+ const moduleInfo = this.data.getModuleInfo(id, this.context);
3682
3691
  if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
3683
3692
  const rawOptions = {
3684
3693
  meta: options.meta || {},
3685
3694
  moduleSideEffects: options.moduleSideEffects || null,
3686
3695
  invalidate: false
3687
3696
  };
3688
- this.data.updateModuleOption(id$1, rawOptions);
3697
+ this.data.updateModuleOption(id, rawOptions);
3689
3698
  async function createLoadModulePromise(context, data) {
3690
- const loadPromise = data.loadModulePromiseMap.get(id$1);
3699
+ const loadPromise = data.loadModulePromiseMap.get(id);
3691
3700
  if (loadPromise) return loadPromise;
3692
3701
  const promise$1 = new Promise((resolve, _) => {
3693
- data.loadModulePromiseResolveFnMap.set(id$1, resolve);
3702
+ data.loadModulePromiseResolveFnMap.set(id, resolve);
3694
3703
  });
3695
- data.loadModulePromiseMap.set(id$1, promise$1);
3704
+ data.loadModulePromiseMap.set(id, promise$1);
3696
3705
  try {
3697
- await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
3706
+ await context.load(id, bindingifySideEffects(options.moduleSideEffects));
3698
3707
  } catch (e$5) {
3699
- data.loadModulePromiseMap.delete(id$1);
3700
- data.loadModulePromiseResolveFnMap.delete(id$1);
3708
+ data.loadModulePromiseMap.delete(id);
3709
+ data.loadModulePromiseResolveFnMap.delete(id);
3701
3710
  throw e$5;
3702
3711
  }
3703
3712
  return promise$1;
3704
3713
  }
3705
3714
  await createLoadModulePromise(this.context, this.data);
3706
- return this.data.getModuleInfo(id$1, this.context);
3715
+ return this.data.getModuleInfo(id, this.context);
3707
3716
  }
3708
3717
  async resolve(source, importer, options) {
3709
3718
  let receipt = void 0;
@@ -3746,8 +3755,8 @@ var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
3746
3755
  getModuleIds() {
3747
3756
  return this.data.getModuleIds(this.context);
3748
3757
  }
3749
- addWatchFile(id$1) {
3750
- this.context.addWatchFile(id$1);
3758
+ addWatchFile(id) {
3759
+ this.context.addWatchFile(id);
3751
3760
  }
3752
3761
  parse(input, options) {
3753
3762
  return parseAst(input, options);
@@ -3888,18 +3897,18 @@ function bindingifyTransform(args$1) {
3888
3897
  if (!hook) return {};
3889
3898
  const { handler, meta, options } = normalizeHook(hook);
3890
3899
  return {
3891
- plugin: async (ctx, code$1, id$1, meta$1) => {
3892
- 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);
3900
+ plugin: async (ctx, code, id, meta$1) => {
3901
+ 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);
3893
3902
  if (ret == null) return void 0;
3894
3903
  if (typeof ret === "string") return { code: ret };
3895
- let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
3904
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id, {
3896
3905
  meta: ret.meta ?? {},
3897
3906
  moduleSideEffects: ret.moduleSideEffects ?? null,
3898
3907
  invalidate: false
3899
3908
  });
3900
3909
  return {
3901
3910
  code: ret.code,
3902
- map: bindingifySourcemap(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
3911
+ map: bindingifySourcemap(normalizeTransformHookSourcemap(id, code, ret.map)),
3903
3912
  sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
3904
3913
  moduleType: ret.moduleType
3905
3914
  };
@@ -3913,16 +3922,16 @@ function bindingifyLoad(args$1) {
3913
3922
  if (!hook) return {};
3914
3923
  const { handler, meta, options } = normalizeHook(hook);
3915
3924
  return {
3916
- plugin: async (ctx, id$1) => {
3917
- 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);
3925
+ plugin: async (ctx, id) => {
3926
+ 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);
3918
3927
  if (ret == null) return;
3919
3928
  if (typeof ret === "string") return { code: ret };
3920
- let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
3929
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id, {
3921
3930
  meta: ret.meta || {},
3922
3931
  moduleSideEffects: ret.moduleSideEffects ?? null,
3923
3932
  invalidate: false
3924
3933
  });
3925
- let map = preProcessSourceMap(ret, id$1);
3934
+ let map = preProcessSourceMap(ret, id);
3926
3935
  return {
3927
3936
  code: ret.code,
3928
3937
  map: bindingifySourcemap(map),
@@ -3934,11 +3943,11 @@ function bindingifyLoad(args$1) {
3934
3943
  filter: bindingifyLoadFilter(options.filter)
3935
3944
  };
3936
3945
  }
3937
- function preProcessSourceMap(ret, id$1) {
3946
+ function preProcessSourceMap(ret, id) {
3938
3947
  if (!ret.map) return;
3939
3948
  let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
3940
3949
  if (!isEmptySourcemapFiled(map.sources)) {
3941
- const directory = path.dirname(id$1) || ".";
3950
+ const directory = path.dirname(id) || ".";
3942
3951
  const sourceRoot = map.sourceRoot || ".";
3943
3952
  map.sources = map.sources.map((source) => path.resolve(directory, sourceRoot, source));
3944
3953
  }
@@ -4397,9 +4406,9 @@ function bindingifyRenderChunk(args$1) {
4397
4406
  if (!hook) return {};
4398
4407
  const { handler, meta, options } = normalizeHook(hook);
4399
4408
  return {
4400
- plugin: async (ctx, code$1, chunk, opts, meta$1) => {
4409
+ plugin: async (ctx, code, chunk, opts, meta$1) => {
4401
4410
  if (args$1.pluginContextData.getRenderChunkMeta() == null) args$1.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
4402
- 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());
4411
+ 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());
4403
4412
  if (ret == null) return;
4404
4413
  if (typeof ret === "string") return { code: ret };
4405
4414
  if (!ret.map) return { code: ret.code };
@@ -4547,8 +4556,8 @@ function bindingifyWatchChange(args$1) {
4547
4556
  if (!hook) return {};
4548
4557
  const { handler, meta } = normalizeHook(hook);
4549
4558
  return {
4550
- plugin: async (ctx, id$1, event) => {
4551
- 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 });
4559
+ plugin: async (ctx, id, event) => {
4560
+ 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 });
4552
4561
  },
4553
4562
  meta: bindingifyPluginHookMeta(meta)
4554
4563
  };
@@ -4774,46 +4783,46 @@ var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
4774
4783
  loadModulePromiseMap = new Map();
4775
4784
  loadModulePromiseResolveFnMap = new Map();
4776
4785
  renderedChunkMeta = null;
4777
- updateModuleOption(id$1, option) {
4778
- const existing = this.moduleOptionMap.get(id$1);
4786
+ updateModuleOption(id, option) {
4787
+ const existing = this.moduleOptionMap.get(id);
4779
4788
  if (existing) {
4780
4789
  if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
4781
4790
  if (option.meta != null) Object.assign(existing.meta, option.meta);
4782
4791
  if (option.invalidate != null) existing.invalidate = option.invalidate;
4783
4792
  } else {
4784
- this.moduleOptionMap.set(id$1, option);
4793
+ this.moduleOptionMap.set(id, option);
4785
4794
  return option;
4786
4795
  }
4787
4796
  return existing;
4788
4797
  }
4789
- getModuleOption(id$1) {
4790
- const option = this.moduleOptionMap.get(id$1);
4798
+ getModuleOption(id) {
4799
+ const option = this.moduleOptionMap.get(id);
4791
4800
  if (!option) {
4792
4801
  const raw = {
4793
4802
  moduleSideEffects: null,
4794
4803
  meta: {}
4795
4804
  };
4796
- this.moduleOptionMap.set(id$1, raw);
4805
+ this.moduleOptionMap.set(id, raw);
4797
4806
  return raw;
4798
4807
  }
4799
4808
  return option;
4800
4809
  }
4801
- getModuleInfo(id$1, context) {
4802
- const bindingInfo = context.getModuleInfo(id$1);
4810
+ getModuleInfo(id, context) {
4811
+ const bindingInfo = context.getModuleInfo(id);
4803
4812
  if (bindingInfo) {
4804
- const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
4805
- return this.proxyModuleInfo(id$1, info);
4813
+ const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
4814
+ return this.proxyModuleInfo(id, info);
4806
4815
  }
4807
4816
  return null;
4808
4817
  }
4809
- proxyModuleInfo(id$1, info) {
4818
+ proxyModuleInfo(id, info) {
4810
4819
  let moduleSideEffects = info.moduleSideEffects;
4811
4820
  Object.defineProperty(info, "moduleSideEffects", {
4812
4821
  get() {
4813
4822
  return moduleSideEffects;
4814
4823
  },
4815
4824
  set: (v) => {
4816
- this.updateModuleOption(id$1, {
4825
+ this.updateModuleOption(id, {
4817
4826
  moduleSideEffects: v,
4818
4827
  meta: info.meta,
4819
4828
  invalidate: true
@@ -4844,8 +4853,8 @@ var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
4844
4853
  getRenderChunkMeta() {
4845
4854
  return this.renderedChunkMeta;
4846
4855
  }
4847
- markModuleLoaded(id$1, _success) {
4848
- const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
4856
+ markModuleLoaded(id, _success) {
4857
+ const resolve = this.loadModulePromiseResolveFnMap.get(id);
4849
4858
  if (resolve) resolve();
4850
4859
  }
4851
4860
  clear() {
@@ -4929,15 +4938,15 @@ function bindingifyHmr(hmr) {
4929
4938
  }
4930
4939
  function bindingifyExternal(external) {
4931
4940
  if (external) {
4932
- if (typeof external === "function") return (id$1, importer, isResolved) => {
4933
- if (id$1.startsWith("\0")) return false;
4934
- return external(id$1, importer, isResolved) ?? false;
4941
+ if (typeof external === "function") return (id, importer, isResolved) => {
4942
+ if (id.startsWith("\0")) return false;
4943
+ return external(id, importer, isResolved) ?? false;
4935
4944
  };
4936
4945
  const externalArr = arraify(external);
4937
- return (id$1, _importer, _isResolved) => {
4946
+ return (id, _importer, _isResolved) => {
4938
4947
  return externalArr.some((pat) => {
4939
- if (pat instanceof RegExp) return pat.test(id$1);
4940
- return id$1 === pat;
4948
+ if (pat instanceof RegExp) return pat.test(id);
4949
+ return id === pat;
4941
4950
  });
4942
4951
  };
4943
4952
  }
@@ -4982,10 +4991,10 @@ function bindingifyInject(inject) {
4982
4991
  }
4983
4992
  function bindingifyLogLevel(logLevel) {
4984
4993
  switch (logLevel) {
4985
- case "silent": return import_binding.BindingLogLevel.Silent;
4986
- case "debug": return import_binding.BindingLogLevel.Debug;
4987
- case "warn": return import_binding.BindingLogLevel.Warn;
4988
- case "info": return import_binding.BindingLogLevel.Info;
4994
+ case "silent": return import_binding$3.BindingLogLevel.Silent;
4995
+ case "debug": return import_binding$3.BindingLogLevel.Debug;
4996
+ case "warn": return import_binding$3.BindingLogLevel.Warn;
4997
+ case "info": return import_binding$3.BindingLogLevel.Info;
4989
4998
  default: throw new Error(`Unexpected log level: ${logLevel}`);
4990
4999
  }
4991
5000
  }
@@ -5057,7 +5066,9 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
5057
5066
  field0: makeAbsoluteExternalsRelative
5058
5067
  };
5059
5068
  }
5069
+ var import_binding$3;
5060
5070
  var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
5071
+ import_binding$3 = __toESM(require_binding());
5061
5072
  init_constructors();
5062
5073
  init_utils();
5063
5074
  init_bindingify_plugin();
@@ -5217,10 +5228,10 @@ function createComposedPlugin(plugins) {
5217
5228
  case "load": {
5218
5229
  if (batchedHooks.load) {
5219
5230
  const batchedHandlers = batchedHooks.load;
5220
- composed.load = async function(id$1) {
5231
+ composed.load = async function(id) {
5221
5232
  for (const [handler, plugin] of batchedHandlers) {
5222
5233
  const { handler: handlerFn } = normalizeHook(handler);
5223
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
5234
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id);
5224
5235
  if (!isNullish(result)) return result;
5225
5236
  }
5226
5237
  };
@@ -5230,11 +5241,11 @@ function createComposedPlugin(plugins) {
5230
5241
  case "transform": {
5231
5242
  if (batchedHooks.transform) {
5232
5243
  const batchedHandlers = batchedHooks.transform;
5233
- composed.transform = async function(initialCode, id$1, moduleType$1) {
5234
- let code$1 = initialCode;
5244
+ composed.transform = async function(initialCode, id, moduleType) {
5245
+ let code = initialCode;
5235
5246
  let moduleSideEffects = void 0;
5236
5247
  function updateOutput(newCode, newModuleSideEffects) {
5237
- code$1 = newCode;
5248
+ code = newCode;
5238
5249
  moduleSideEffects = newModuleSideEffects ?? void 0;
5239
5250
  }
5240
5251
  for (const [handler, plugin] of batchedHandlers) {
@@ -5242,14 +5253,14 @@ function createComposedPlugin(plugins) {
5242
5253
  this.getCombinedSourcemap = () => {
5243
5254
  throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
5244
5255
  };
5245
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
5256
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
5246
5257
  if (!isNullish(result)) {
5247
5258
  if (typeof result === "string") updateOutput(result);
5248
5259
  else if (result.code) updateOutput(result.code, result.moduleSideEffects);
5249
5260
  }
5250
5261
  }
5251
5262
  return {
5252
- code: code$1,
5263
+ code,
5253
5264
  moduleSideEffects
5254
5265
  };
5255
5266
  };
@@ -5271,10 +5282,10 @@ function createComposedPlugin(plugins) {
5271
5282
  case "renderChunk": {
5272
5283
  if (batchedHooks.renderChunk) {
5273
5284
  const batchedHandlers = batchedHooks.renderChunk;
5274
- composed.renderChunk = async function(code$1, chunk, options, meta) {
5285
+ composed.renderChunk = async function(code, chunk, options, meta) {
5275
5286
  for (const [handler, plugin] of batchedHandlers) {
5276
5287
  const { handler: handlerFn } = normalizeHook(handler);
5277
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
5288
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, chunk, options, meta);
5278
5289
  if (!isNullish(result)) return result;
5279
5290
  }
5280
5291
  };
@@ -5311,10 +5322,10 @@ function createComposedPlugin(plugins) {
5311
5322
  case "watchChange": {
5312
5323
  if (batchedHooks.watchChange) {
5313
5324
  const batchedHandlers = batchedHooks.watchChange;
5314
- composed.watchChange = async function(id$1, event) {
5325
+ composed.watchChange = async function(id, event) {
5315
5326
  await Promise.all(batchedHandlers.map(([handler, plugin]) => {
5316
5327
  const { handler: handlerFn } = normalizeHook(handler);
5317
- return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
5328
+ return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id, event);
5318
5329
  }));
5319
5330
  };
5320
5331
  }
@@ -5411,7 +5422,7 @@ async function initializeParallelPlugins(plugins) {
5411
5422
  }
5412
5423
  if (pluginInfos.length <= 0) return void 0;
5413
5424
  const count = Math.min(availableParallelism(), 8);
5414
- const parallelJsPluginRegistry = new import_binding.ParallelJsPluginRegistry(count);
5425
+ const parallelJsPluginRegistry = new import_binding$2.ParallelJsPluginRegistry(count);
5415
5426
  const registryId = parallelJsPluginRegistry.id;
5416
5427
  const workers = await initializeWorkers(registryId, count, pluginInfos);
5417
5428
  const stopWorkers = async () => {
@@ -5448,7 +5459,10 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
5448
5459
  throw e$5;
5449
5460
  }
5450
5461
  }
5451
- var init_initialize_parallel_plugins = __esm({ "src/utils/initialize-parallel-plugins.ts"() {} });
5462
+ var import_binding$2;
5463
+ var init_initialize_parallel_plugins = __esm({ "src/utils/initialize-parallel-plugins.ts"() {
5464
+ import_binding$2 = __toESM(require_binding());
5465
+ } });
5452
5466
 
5453
5467
  //#endregion
5454
5468
  //#region src/utils/create-bundler-option.ts
@@ -5495,13 +5509,13 @@ var init_create_bundler_option = __esm({ "src/utils/create-bundler-option.ts"()
5495
5509
  //#region src/utils/create-bundler.ts
5496
5510
  async function createBundler(inputOptions, outputOptions, isClose) {
5497
5511
  const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
5498
- if (asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)();
5512
+ if (asyncRuntimeShutdown) (0, import_binding$1.startAsyncRuntime)();
5499
5513
  try {
5500
5514
  return {
5501
- bundler: new import_binding.Bundler(option.bundlerOptions),
5515
+ bundler: new import_binding$1.Bundler(option.bundlerOptions),
5502
5516
  stopWorkers: option.stopWorkers,
5503
5517
  shutdown: () => {
5504
- (0, import_binding.shutdownAsyncRuntime)();
5518
+ (0, import_binding$1.shutdownAsyncRuntime)();
5505
5519
  asyncRuntimeShutdown = true;
5506
5520
  }
5507
5521
  };
@@ -5510,8 +5524,9 @@ async function createBundler(inputOptions, outputOptions, isClose) {
5510
5524
  throw e$5;
5511
5525
  }
5512
5526
  }
5513
- var asyncRuntimeShutdown;
5527
+ var import_binding$1, asyncRuntimeShutdown;
5514
5528
  var init_create_bundler = __esm({ "src/utils/create-bundler.ts"() {
5529
+ import_binding$1 = __toESM(require_binding());
5515
5530
  init_create_bundler_option();
5516
5531
  asyncRuntimeShutdown = false;
5517
5532
  } });
@@ -5641,8 +5656,8 @@ var init_watch_emitter = __esm({ "src/api/watch/watch-emitter.ts"() {
5641
5656
  break;
5642
5657
  case "event":
5643
5658
  for (const listener of listeners) {
5644
- const code$1 = event.bundleEventKind();
5645
- switch (code$1) {
5659
+ const code = event.bundleEventKind();
5660
+ switch (code) {
5646
5661
  case "BUNDLE_END":
5647
5662
  const { duration, output, result } = event.bundleEndData();
5648
5663
  await listener({
@@ -5661,7 +5676,7 @@ var init_watch_emitter = __esm({ "src/api/watch/watch-emitter.ts"() {
5661
5676
  });
5662
5677
  break;
5663
5678
  default:
5664
- await listener({ code: code$1 });
5679
+ await listener({ code });
5665
5680
  break;
5666
5681
  }
5667
5682
  }
@@ -5704,8 +5719,9 @@ function getValidNotifyOption(bundlerOptions) {
5704
5719
  } else result = notifyOption;
5705
5720
  }
5706
5721
  }
5707
- var Watcher;
5722
+ var import_binding, Watcher;
5708
5723
  var init_watcher = __esm({ "src/api/watch/watcher.ts"() {
5724
+ import_binding = __toESM(require_binding());
5709
5725
  init_logging();
5710
5726
  init_logs();
5711
5727
  init_plugin_driver();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown",
3
- "version": "1.0.0-beta.8-commit.c76291c",
3
+ "version": "1.0.0-beta.8-commit.56abf23",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "type": "commonjs",
6
6
  "homepage": "https://rolldown.rs/",
@@ -87,7 +87,8 @@
87
87
  },
88
88
  "dependencies": {
89
89
  "@oxc-project/types": "0.68.1",
90
- "ansis": "^3.17.0"
90
+ "ansis": "^4.0.0",
91
+ "@rolldown/pluginutils": "1.0.0-beta.8-commit.56abf23"
91
92
  },
92
93
  "peerDependencies": {
93
94
  "@oxc-project/runtime": "0.68.1"
@@ -101,7 +102,6 @@
101
102
  "@napi-rs/cli": "^3.0.0-alpha.77",
102
103
  "@napi-rs/wasm-runtime": "^0.2.4",
103
104
  "@oxc-node/cli": "^0.0.25",
104
- "@oxc-node/core": "^0.0.25",
105
105
  "@types/fs-extra": "^11.0.4",
106
106
  "@types/lodash-es": "^4.17.12",
107
107
  "@valibot/to-json-schema": "1.0.0",
@@ -124,21 +124,21 @@
124
124
  "unbuild": "^3.0.0",
125
125
  "valibot": "1.0.0",
126
126
  "@rolldown/testing": "0.0.1",
127
- "rolldown": "1.0.0-beta.8-commit.c76291c"
127
+ "rolldown": "1.0.0-beta.8-commit.56abf23"
128
128
  },
129
129
  "optionalDependencies": {
130
- "@rolldown/binding-darwin-arm64": "1.0.0-beta.8-commit.c76291c",
131
- "@rolldown/binding-darwin-x64": "1.0.0-beta.8-commit.c76291c",
132
- "@rolldown/binding-freebsd-x64": "1.0.0-beta.8-commit.c76291c",
133
- "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.8-commit.c76291c",
134
- "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.8-commit.c76291c",
135
- "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.8-commit.c76291c",
136
- "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.8-commit.c76291c",
137
- "@rolldown/binding-linux-x64-musl": "1.0.0-beta.8-commit.c76291c",
138
- "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.8-commit.c76291c",
139
- "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.8-commit.c76291c",
140
- "@rolldown/binding-wasm32-wasi": "1.0.0-beta.8-commit.c76291c",
141
- "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.8-commit.c76291c"
130
+ "@rolldown/binding-darwin-arm64": "1.0.0-beta.8-commit.56abf23",
131
+ "@rolldown/binding-freebsd-x64": "1.0.0-beta.8-commit.56abf23",
132
+ "@rolldown/binding-darwin-x64": "1.0.0-beta.8-commit.56abf23",
133
+ "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.8-commit.56abf23",
134
+ "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.8-commit.56abf23",
135
+ "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.8-commit.56abf23",
136
+ "@rolldown/binding-linux-x64-musl": "1.0.0-beta.8-commit.56abf23",
137
+ "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.8-commit.56abf23",
138
+ "@rolldown/binding-wasm32-wasi": "1.0.0-beta.8-commit.56abf23",
139
+ "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.8-commit.56abf23",
140
+ "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.8-commit.56abf23",
141
+ "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.8-commit.56abf23"
142
142
  },
143
143
  "scripts": {
144
144
  "# Scrips for binding #": "_",