rolldown 1.0.0-beta.8-commit.c76291c → 1.0.0-beta.8-commit.e270f24

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 (31) hide show
  1. package/dist/cli.cjs +6 -6
  2. package/dist/cli.mjs +2 -2
  3. package/dist/experimental-index.cjs +2 -2
  4. package/dist/experimental-index.d.cts +2 -2
  5. package/dist/experimental-index.d.mts +2 -2
  6. package/dist/experimental-index.mjs +2 -2
  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 +2 -2
  12. package/dist/index.d.cts +2 -2
  13. package/dist/index.d.mts +2 -2
  14. package/dist/index.mjs +2 -2
  15. package/dist/parallel-plugin-worker.cjs +2 -2
  16. package/dist/parallel-plugin-worker.mjs +2 -2
  17. package/dist/parallel-plugin.d.cts +2 -2
  18. package/dist/parallel-plugin.d.mts +2 -2
  19. package/dist/parse-ast-index.d.cts +1 -1
  20. package/dist/parse-ast-index.d.mts +1 -1
  21. package/dist/shared/{binding.d-BRwjFIld.d.cts → binding.d-DiufgqJs.d.mts} +1 -0
  22. package/dist/shared/{binding.d-DVNuaImz.d.mts → binding.d-TdksiV0L.d.cts} +1 -0
  23. package/dist/shared/{input-options.d-CcrldgHK.d.cts → input-options.d--njwKbQU.d.mts} +3 -56
  24. package/dist/shared/{input-options.d-DVGWBVp4.d.mts → input-options.d-xkHPeCns.d.cts} +3 -56
  25. package/dist/shared/misc-BWx4LNta.cjs +68 -0
  26. package/dist/shared/misc-CcQKSZ8O.mjs +28 -0
  27. package/dist/shared/{src-DdLhlxoJ.mjs → src-DbQfn8bU.mjs} +89 -89
  28. package/dist/shared/{src-_pefwDkF.cjs → src-WSLYLQjV.cjs} +103 -102
  29. package/package.json +16 -15
  30. package/dist/shared/filter-index-DblXSw9s.cjs +0 -255
  31. package/dist/shared/filter-index-hnEzlqRW.mjs +0 -174
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  const require_chunk = require('./chunk-qZFfknuJ.cjs');
3
3
  const require_parse_ast_index = require('./parse-ast-index-n6Ys2h9o.cjs');
4
- const require_filter_index = require('./filter-index-DblXSw9s.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.e270f24";
12
13
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
13
14
 
14
15
  //#endregion
@@ -112,13 +113,13 @@ const logLevelPriority = {
112
113
  //#endregion
113
114
  //#region src/log/log-handler.ts
114
115
  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;
116
+ function getLogHandler(level, code, logger, pluginName, logLevel) {
117
+ if (logLevelPriority[level] < logLevelPriority[logLevel]) return require_misc.noop;
117
118
  return (log, pos) => {
118
119
  if (pos != null) logger(LOG_LEVEL_WARN, require_parse_ast_index.logInvalidLogPosition(pluginName));
119
120
  log = normalizeLog(log);
120
121
  if (log.code && !log.pluginCode) log.pluginCode = log.code;
121
- log.code = code$1;
122
+ log.code = code;
122
123
  log.plugin = pluginName;
123
124
  logger(level, log);
124
125
  };
@@ -195,9 +196,9 @@ const getExtendedLogMessage = (log) => {
195
196
  if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
196
197
  return prefix + log.message;
197
198
  };
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);
199
+ function relativeId(id) {
200
+ if (!node_path.default.isAbsolute(id)) return id;
201
+ return node_path.default.relative(node_path.default.resolve(), id);
201
202
  }
202
203
 
203
204
  //#endregion
@@ -216,7 +217,7 @@ function normalizeHook(hook) {
216
217
  meta: { order }
217
218
  };
218
219
  }
219
- require_filter_index.unreachable("Invalid hook type");
220
+ require_misc.unreachable("Invalid hook type");
220
221
  }
221
222
 
222
223
  //#endregion
@@ -2161,9 +2162,9 @@ function getErrorMessage(e) {
2161
2162
  if (Object.hasOwn(e, "kind")) return e.message;
2162
2163
  let s = "";
2163
2164
  if (e.plugin) s += `[plugin ${e.plugin}]`;
2164
- const id$1 = e.id ?? e.loc?.file;
2165
- if (id$1) {
2166
- s += " " + id$1;
2165
+ const id = e.id ?? e.loc?.file;
2166
+ if (id) {
2167
+ s += " " + id;
2167
2168
  if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
2168
2169
  }
2169
2170
  if (s) s += "\n";
@@ -2182,7 +2183,7 @@ function joinNewLine(s1, s2) {
2182
2183
  function transformModuleInfo(info, option) {
2183
2184
  return {
2184
2185
  get ast() {
2185
- return require_filter_index.unsupported("ModuleInfo#ast");
2186
+ return require_misc.unsupported("ModuleInfo#ast");
2186
2187
  },
2187
2188
  get code() {
2188
2189
  return info.code;
@@ -2218,11 +2219,11 @@ function isEmptySourcemapFiled(array$1) {
2218
2219
  if (array$1.length === 0 || !array$1[0]) return true;
2219
2220
  return false;
2220
2221
  }
2221
- function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2222
+ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
2222
2223
  if (!rawMap) return;
2223
2224
  let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
2224
2225
  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];
2226
+ if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
2226
2227
  return map;
2227
2228
  }
2228
2229
 
@@ -2265,37 +2266,37 @@ function t(...n) {
2265
2266
  //#endregion
2266
2267
  //#region src/plugin/bindingify-hook-filter.ts
2267
2268
  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)));
2269
+ if (typeof matcher === "string" || matcher instanceof RegExp) return [__rolldown_pluginutils.include(generateAtomMatcher(stringKind, matcher))];
2270
+ if (Array.isArray(matcher)) return matcher.map((m) => __rolldown_pluginutils.include(generateAtomMatcher(stringKind, m)));
2270
2271
  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))));
2272
+ if (matcher.exclude) ret.push(...require_misc.arraify(matcher.exclude).map((m) => __rolldown_pluginutils.exclude(generateAtomMatcher(stringKind, m))));
2273
+ if (matcher.include) ret.push(...require_misc.arraify(matcher.include).map((m) => __rolldown_pluginutils.include(generateAtomMatcher(stringKind, m))));
2273
2274
  return ret;
2274
2275
  }
2275
2276
  function generateAtomMatcher(kind, matcher) {
2276
- return kind === "code" ? require_filter_index.code(matcher) : require_filter_index.id(matcher);
2277
+ return kind === "code" ? __rolldown_pluginutils.code(matcher) : __rolldown_pluginutils.id(matcher);
2277
2278
  }
2278
2279
  function transformFilterMatcherToFilterExprs(filterOption) {
2279
2280
  if (!filterOption) return void 0;
2280
2281
  if (Array.isArray(filterOption)) return filterOption;
2281
- const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
2282
+ const { id, code, moduleType } = filterOption;
2282
2283
  let ret = [];
2283
2284
  let idIncludes = [];
2284
2285
  let idExcludes = [];
2285
2286
  let codeIncludes = [];
2286
2287
  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");
2288
+ if (id) [idIncludes, idExcludes] = d(generalHookFilterMatcherToFilterExprs(id, "id") ?? [], (m) => m.kind === "include");
2289
+ if (code) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code, "code") ?? [], (m) => m.kind === "include");
2289
2290
  ret.push(...idExcludes);
2290
2291
  ret.push(...codeExcludes);
2291
2292
  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))));
2293
+ if (moduleType) {
2294
+ let moduleTypes = Array.isArray(moduleType) ? moduleType : moduleType.include ?? [];
2295
+ andExprList.push(__rolldown_pluginutils.or(...moduleTypes.map((m) => __rolldown_pluginutils.moduleType(m))));
2295
2296
  }
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)));
2297
+ if (idIncludes.length) andExprList.push(__rolldown_pluginutils.or(...idIncludes.map((item) => item.expr)));
2298
+ if (codeIncludes.length) andExprList.push(__rolldown_pluginutils.or(...codeIncludes.map((item) => item.expr)));
2299
+ if (andExprList.length) ret.push(__rolldown_pluginutils.include(__rolldown_pluginutils.and(...andExprList)));
2299
2300
  return ret;
2300
2301
  }
2301
2302
  function bindingifyGeneralHookFilter(stringKind, pattern) {
@@ -2426,37 +2427,37 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2426
2427
  this.data = data;
2427
2428
  this.onLog = onLog;
2428
2429
  this.currentLoadingModule = currentLoadingModule;
2429
- this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
2430
+ this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
2430
2431
  }
2431
2432
  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);
2433
+ const id = options.id;
2434
+ if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, require_parse_ast_index.logCycleLoading(this.pluginName, this.currentLoadingModule));
2435
+ const moduleInfo = this.data.getModuleInfo(id, this.context);
2435
2436
  if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
2436
2437
  const rawOptions = {
2437
2438
  meta: options.meta || {},
2438
2439
  moduleSideEffects: options.moduleSideEffects || null,
2439
2440
  invalidate: false
2440
2441
  };
2441
- this.data.updateModuleOption(id$1, rawOptions);
2442
+ this.data.updateModuleOption(id, rawOptions);
2442
2443
  async function createLoadModulePromise(context, data) {
2443
- const loadPromise = data.loadModulePromiseMap.get(id$1);
2444
+ const loadPromise = data.loadModulePromiseMap.get(id);
2444
2445
  if (loadPromise) return loadPromise;
2445
2446
  const promise$1 = new Promise((resolve, _) => {
2446
- data.loadModulePromiseResolveFnMap.set(id$1, resolve);
2447
+ data.loadModulePromiseResolveFnMap.set(id, resolve);
2447
2448
  });
2448
- data.loadModulePromiseMap.set(id$1, promise$1);
2449
+ data.loadModulePromiseMap.set(id, promise$1);
2449
2450
  try {
2450
- await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2451
+ await context.load(id, bindingifySideEffects(options.moduleSideEffects));
2451
2452
  } catch (e) {
2452
- data.loadModulePromiseMap.delete(id$1);
2453
- data.loadModulePromiseResolveFnMap.delete(id$1);
2453
+ data.loadModulePromiseMap.delete(id);
2454
+ data.loadModulePromiseResolveFnMap.delete(id);
2454
2455
  throw e;
2455
2456
  }
2456
2457
  return promise$1;
2457
2458
  }
2458
2459
  await createLoadModulePromise(this.context, this.data);
2459
- return this.data.getModuleInfo(id$1, this.context);
2460
+ return this.data.getModuleInfo(id, this.context);
2460
2461
  }
2461
2462
  async resolve(source, importer, options) {
2462
2463
  let receipt = void 0;
@@ -2470,12 +2471,12 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2470
2471
  const info = this.data.getModuleOption(res.id) || {};
2471
2472
  return {
2472
2473
  ...res,
2473
- external: res.external === "relative" ? require_filter_index.unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2474
+ external: res.external === "relative" ? require_misc.unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2474
2475
  ...info
2475
2476
  };
2476
2477
  }
2477
2478
  emitFile = (file) => {
2478
- if (file.type === "prebuilt-chunk") return require_filter_index.unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2479
+ if (file.type === "prebuilt-chunk") return require_misc.unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2479
2480
  if (file.type === "chunk") return this.context.emitChunk(file);
2480
2481
  const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
2481
2482
  const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
@@ -2499,8 +2500,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2499
2500
  getModuleIds() {
2500
2501
  return this.data.getModuleIds(this.context);
2501
2502
  }
2502
- addWatchFile(id$1) {
2503
- this.context.addWatchFile(id$1);
2503
+ addWatchFile(id) {
2504
+ this.context.addWatchFile(id);
2504
2505
  }
2505
2506
  parse(input, options) {
2506
2507
  return require_parse_ast_index.parseAst(input, options);
@@ -2634,18 +2635,18 @@ function bindingifyTransform(args$1) {
2634
2635
  if (!hook) return {};
2635
2636
  const { handler, meta, options } = normalizeHook(hook);
2636
2637
  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);
2638
+ plugin: async (ctx, code, id, meta$1) => {
2639
+ 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
2640
  if (ret == null) return void 0;
2640
2641
  if (typeof ret === "string") return { code: ret };
2641
- let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
2642
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id, {
2642
2643
  meta: ret.meta ?? {},
2643
2644
  moduleSideEffects: ret.moduleSideEffects ?? null,
2644
2645
  invalidate: false
2645
2646
  });
2646
2647
  return {
2647
2648
  code: ret.code,
2648
- map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
2649
+ map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, ret.map)),
2649
2650
  sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
2650
2651
  moduleType: ret.moduleType
2651
2652
  };
@@ -2659,16 +2660,16 @@ function bindingifyLoad(args$1) {
2659
2660
  if (!hook) return {};
2660
2661
  const { handler, meta, options } = normalizeHook(hook);
2661
2662
  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);
2663
+ plugin: async (ctx, id) => {
2664
+ 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
2665
  if (ret == null) return;
2665
2666
  if (typeof ret === "string") return { code: ret };
2666
- let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
2667
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id, {
2667
2668
  meta: ret.meta || {},
2668
2669
  moduleSideEffects: ret.moduleSideEffects ?? null,
2669
2670
  invalidate: false
2670
2671
  });
2671
- let map = preProcessSourceMap(ret, id$1);
2672
+ let map = preProcessSourceMap(ret, id);
2672
2673
  return {
2673
2674
  code: ret.code,
2674
2675
  map: bindingifySourcemap$1(map),
@@ -2680,11 +2681,11 @@ function bindingifyLoad(args$1) {
2680
2681
  filter: bindingifyLoadFilter(options.filter)
2681
2682
  };
2682
2683
  }
2683
- function preProcessSourceMap(ret, id$1) {
2684
+ function preProcessSourceMap(ret, id) {
2684
2685
  if (!ret.map) return;
2685
2686
  let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
2686
2687
  if (!isEmptySourcemapFiled(map.sources)) {
2687
- const directory = node_path.default.dirname(id$1) || ".";
2688
+ const directory = node_path.default.dirname(id) || ".";
2688
2689
  const sourceRoot = map.sourceRoot || ".";
2689
2690
  map.sources = map.sources.map((source) => node_path.default.resolve(directory, sourceRoot, source));
2690
2691
  }
@@ -2820,7 +2821,7 @@ function bindingifyFormat(format) {
2820
2821
  case "iife": return "iife";
2821
2822
  case "umd": return "umd";
2822
2823
  case "experimental-app": return "app";
2823
- default: require_filter_index.unimplemented(`output.format: ${format}`);
2824
+ default: require_misc.unimplemented(`output.format: ${format}`);
2824
2825
  }
2825
2826
  }
2826
2827
  function bindingifySourcemap(sourcemap) {
@@ -3110,9 +3111,9 @@ function bindingifyRenderChunk(args$1) {
3110
3111
  if (!hook) return {};
3111
3112
  const { handler, meta, options } = normalizeHook(hook);
3112
3113
  return {
3113
- plugin: async (ctx, code$1, chunk, opts, meta$1) => {
3114
+ plugin: async (ctx, code, chunk, opts, meta$1) => {
3114
3115
  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());
3116
+ 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
3117
  if (ret == null) return;
3117
3118
  if (typeof ret === "string") return { code: ret };
3118
3119
  if (!ret.map) return { code: ret.code };
@@ -3248,8 +3249,8 @@ function bindingifyWatchChange(args$1) {
3248
3249
  if (!hook) return {};
3249
3250
  const { handler, meta } = normalizeHook(hook);
3250
3251
  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 });
3252
+ plugin: async (ctx, id, event) => {
3253
+ 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
3254
  },
3254
3255
  meta: bindingifyPluginHookMeta(meta)
3255
3256
  };
@@ -3457,46 +3458,46 @@ var PluginContextData = class {
3457
3458
  loadModulePromiseMap = new Map();
3458
3459
  loadModulePromiseResolveFnMap = new Map();
3459
3460
  renderedChunkMeta = null;
3460
- updateModuleOption(id$1, option) {
3461
- const existing = this.moduleOptionMap.get(id$1);
3461
+ updateModuleOption(id, option) {
3462
+ const existing = this.moduleOptionMap.get(id);
3462
3463
  if (existing) {
3463
3464
  if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
3464
3465
  if (option.meta != null) Object.assign(existing.meta, option.meta);
3465
3466
  if (option.invalidate != null) existing.invalidate = option.invalidate;
3466
3467
  } else {
3467
- this.moduleOptionMap.set(id$1, option);
3468
+ this.moduleOptionMap.set(id, option);
3468
3469
  return option;
3469
3470
  }
3470
3471
  return existing;
3471
3472
  }
3472
- getModuleOption(id$1) {
3473
- const option = this.moduleOptionMap.get(id$1);
3473
+ getModuleOption(id) {
3474
+ const option = this.moduleOptionMap.get(id);
3474
3475
  if (!option) {
3475
3476
  const raw = {
3476
3477
  moduleSideEffects: null,
3477
3478
  meta: {}
3478
3479
  };
3479
- this.moduleOptionMap.set(id$1, raw);
3480
+ this.moduleOptionMap.set(id, raw);
3480
3481
  return raw;
3481
3482
  }
3482
3483
  return option;
3483
3484
  }
3484
- getModuleInfo(id$1, context) {
3485
- const bindingInfo = context.getModuleInfo(id$1);
3485
+ getModuleInfo(id, context) {
3486
+ const bindingInfo = context.getModuleInfo(id);
3486
3487
  if (bindingInfo) {
3487
- const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
3488
- return this.proxyModuleInfo(id$1, info);
3488
+ const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
3489
+ return this.proxyModuleInfo(id, info);
3489
3490
  }
3490
3491
  return null;
3491
3492
  }
3492
- proxyModuleInfo(id$1, info) {
3493
+ proxyModuleInfo(id, info) {
3493
3494
  let moduleSideEffects = info.moduleSideEffects;
3494
3495
  Object.defineProperty(info, "moduleSideEffects", {
3495
3496
  get() {
3496
3497
  return moduleSideEffects;
3497
3498
  },
3498
3499
  set: (v) => {
3499
- this.updateModuleOption(id$1, {
3500
+ this.updateModuleOption(id, {
3500
3501
  moduleSideEffects: v,
3501
3502
  meta: info.meta,
3502
3503
  invalidate: true
@@ -3527,8 +3528,8 @@ var PluginContextData = class {
3527
3528
  getRenderChunkMeta() {
3528
3529
  return this.renderedChunkMeta;
3529
3530
  }
3530
- markModuleLoaded(id$1, _success) {
3531
- const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
3531
+ markModuleLoaded(id, _success) {
3532
+ const resolve = this.loadModulePromiseResolveFnMap.get(id);
3532
3533
  if (resolve) resolve();
3533
3534
  }
3534
3535
  clear() {
@@ -3610,15 +3611,15 @@ function bindingifyHmr(hmr) {
3610
3611
  }
3611
3612
  function bindingifyExternal(external) {
3612
3613
  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;
3614
+ if (typeof external === "function") return (id, importer, isResolved) => {
3615
+ if (id.startsWith("\0")) return false;
3616
+ return external(id, importer, isResolved) ?? false;
3616
3617
  };
3617
- const externalArr = require_filter_index.arraify(external);
3618
- return (id$1, _importer, _isResolved) => {
3618
+ const externalArr = require_misc.arraify(external);
3619
+ return (id, _importer, _isResolved) => {
3619
3620
  return externalArr.some((pat) => {
3620
- if (pat instanceof RegExp) return pat.test(id$1);
3621
- return id$1 === pat;
3621
+ if (pat instanceof RegExp) return pat.test(id);
3622
+ return id === pat;
3622
3623
  });
3623
3624
  };
3624
3625
  }
@@ -3629,7 +3630,7 @@ function bindingifyResolve(resolve) {
3629
3630
  return {
3630
3631
  alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
3631
3632
  find: name,
3632
- replacements: require_filter_index.arraify(replacement)
3633
+ replacements: require_misc.arraify(replacement)
3633
3634
  })) : void 0,
3634
3635
  extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
3635
3636
  target: name,
@@ -3876,7 +3877,7 @@ function createComposedPlugin(plugins) {
3876
3877
  if (symbolForCallerThatSkipSelf === handlerSymbol) continue;
3877
3878
  const { handler: handlerFn } = normalizeHook(handler);
3878
3879
  const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), source, importer, rawHookResolveIdOptions);
3879
- if (!require_filter_index.isNullish(result)) return result;
3880
+ if (!require_misc.isNullish(result)) return result;
3880
3881
  }
3881
3882
  };
3882
3883
  }
@@ -3898,11 +3899,11 @@ function createComposedPlugin(plugins) {
3898
3899
  case "load": {
3899
3900
  if (batchedHooks.load) {
3900
3901
  const batchedHandlers = batchedHooks.load;
3901
- composed.load = async function(id$1) {
3902
+ composed.load = async function(id) {
3902
3903
  for (const [handler, plugin] of batchedHandlers) {
3903
3904
  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;
3905
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id);
3906
+ if (!require_misc.isNullish(result)) return result;
3906
3907
  }
3907
3908
  };
3908
3909
  }
@@ -3911,11 +3912,11 @@ function createComposedPlugin(plugins) {
3911
3912
  case "transform": {
3912
3913
  if (batchedHooks.transform) {
3913
3914
  const batchedHandlers = batchedHooks.transform;
3914
- composed.transform = async function(initialCode, id$1, moduleType$1) {
3915
- let code$1 = initialCode;
3915
+ composed.transform = async function(initialCode, id, moduleType) {
3916
+ let code = initialCode;
3916
3917
  let moduleSideEffects = void 0;
3917
3918
  function updateOutput(newCode, newModuleSideEffects) {
3918
- code$1 = newCode;
3919
+ code = newCode;
3919
3920
  moduleSideEffects = newModuleSideEffects ?? void 0;
3920
3921
  }
3921
3922
  for (const [handler, plugin] of batchedHandlers) {
@@ -3923,14 +3924,14 @@ function createComposedPlugin(plugins) {
3923
3924
  this.getCombinedSourcemap = () => {
3924
3925
  throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
3925
3926
  };
3926
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
3927
- if (!require_filter_index.isNullish(result)) {
3927
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
3928
+ if (!require_misc.isNullish(result)) {
3928
3929
  if (typeof result === "string") updateOutput(result);
3929
3930
  else if (result.code) updateOutput(result.code, result.moduleSideEffects);
3930
3931
  }
3931
3932
  }
3932
3933
  return {
3933
- code: code$1,
3934
+ code,
3934
3935
  moduleSideEffects
3935
3936
  };
3936
3937
  };
@@ -3952,11 +3953,11 @@ function createComposedPlugin(plugins) {
3952
3953
  case "renderChunk": {
3953
3954
  if (batchedHooks.renderChunk) {
3954
3955
  const batchedHandlers = batchedHooks.renderChunk;
3955
- composed.renderChunk = async function(code$1, chunk, options, meta) {
3956
+ composed.renderChunk = async function(code, chunk, options, meta) {
3956
3957
  for (const [handler, plugin] of batchedHandlers) {
3957
3958
  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;
3959
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, chunk, options, meta);
3960
+ if (!require_misc.isNullish(result)) return result;
3960
3961
  }
3961
3962
  };
3962
3963
  }
@@ -3992,10 +3993,10 @@ function createComposedPlugin(plugins) {
3992
3993
  case "watchChange": {
3993
3994
  if (batchedHooks.watchChange) {
3994
3995
  const batchedHandlers = batchedHooks.watchChange;
3995
- composed.watchChange = async function(id$1, event) {
3996
+ composed.watchChange = async function(id, event) {
3996
3997
  await Promise.all(batchedHandlers.map(([handler, plugin]) => {
3997
3998
  const { handler: handlerFn } = normalizeHook(handler);
3998
- return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
3999
+ return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id, event);
3999
4000
  }));
4000
4001
  };
4001
4002
  }
@@ -4267,8 +4268,8 @@ var WatcherEmitter = class {
4267
4268
  break;
4268
4269
  case "event":
4269
4270
  for (const listener of listeners) {
4270
- const code$1 = event.bundleEventKind();
4271
- switch (code$1) {
4271
+ const code = event.bundleEventKind();
4272
+ switch (code) {
4272
4273
  case "BUNDLE_END":
4273
4274
  const { duration, output, result } = event.bundleEndData();
4274
4275
  await listener({
@@ -4287,7 +4288,7 @@ var WatcherEmitter = class {
4287
4288
  });
4288
4289
  break;
4289
4290
  default:
4290
- await listener({ code: code$1 });
4291
+ await listener({ code });
4291
4292
  break;
4292
4293
  }
4293
4294
  }
@@ -4336,8 +4337,8 @@ var Watcher = class {
4336
4337
  }
4337
4338
  };
4338
4339
  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) => {
4340
+ const options = require_misc.arraify(input);
4341
+ const bundlerOptions = await Promise.all(options.map((option) => require_misc.arraify(option.output || {}).map(async (output) => {
4341
4342
  const inputOptions = await PluginDriver.callOptionsHook(option, true);
4342
4343
  return createBundlerOptions(inputOptions, output, true);
4343
4344
  })).flat());
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.e270f24",
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": "^3.17.0",
91
+ "@rolldown/pluginutils": "1.0.0-beta.8"
91
92
  },
92
93
  "peerDependencies": {
93
94
  "@oxc-project/runtime": "0.68.1"
@@ -124,21 +125,21 @@
124
125
  "unbuild": "^3.0.0",
125
126
  "valibot": "1.0.0",
126
127
  "@rolldown/testing": "0.0.1",
127
- "rolldown": "1.0.0-beta.8-commit.c76291c"
128
+ "rolldown": "1.0.0-beta.8-commit.e270f24"
128
129
  },
129
130
  "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"
131
+ "@rolldown/binding-darwin-arm64": "1.0.0-beta.8-commit.e270f24",
132
+ "@rolldown/binding-darwin-x64": "1.0.0-beta.8-commit.e270f24",
133
+ "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.8-commit.e270f24",
134
+ "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.8-commit.e270f24",
135
+ "@rolldown/binding-freebsd-x64": "1.0.0-beta.8-commit.e270f24",
136
+ "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.8-commit.e270f24",
137
+ "@rolldown/binding-linux-x64-musl": "1.0.0-beta.8-commit.e270f24",
138
+ "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.8-commit.e270f24",
139
+ "@rolldown/binding-wasm32-wasi": "1.0.0-beta.8-commit.e270f24",
140
+ "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.8-commit.e270f24",
141
+ "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.8-commit.e270f24",
142
+ "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.8-commit.e270f24"
142
143
  },
143
144
  "scripts": {
144
145
  "# Scrips for binding #": "_",