rolldown 1.0.0-beta.3-commit.980c6f6 → 1.0.0-beta.3-commit.de6e9d2

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('./chunk-qZFfknuJ.cjs');
3
- const require_binding = require('./binding-DTKqYZn-.cjs');
3
+ const require_parse_ast_index = require('./parse-ast-index-p24sJjY3.cjs');
4
4
  const node_path = require_chunk.__toESM(require("node:path"));
5
5
  const node_buffer = require_chunk.__toESM(require("node:buffer"));
6
6
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
@@ -54,7 +54,7 @@ const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeo
54
54
  function getLogHandler(level, code, logger, pluginName, logLevel) {
55
55
  if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
56
56
  return (log, pos) => {
57
- if (pos != null) logger(LOG_LEVEL_WARN, require_binding.logInvalidLogPosition(pluginName));
57
+ if (pos != null) logger(LOG_LEVEL_WARN, require_parse_ast_index.logInvalidLogPosition(pluginName));
58
58
  log = normalizeLog(log);
59
59
  if (log.code && !log.pluginCode) log.pluginCode = log.code;
60
60
  log.code = code;
@@ -100,7 +100,7 @@ function getLogger(plugins, onLog, logLevel) {
100
100
  const handler = "handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog;
101
101
  if (handler.call({
102
102
  debug: getLogHandler$1(LOG_LEVEL_DEBUG),
103
- error: (log$1) => require_binding.error(normalizeLog(log$1)),
103
+ error: (log$1) => require_parse_ast_index.error(normalizeLog(log$1)),
104
104
  info: getLogHandler$1(LOG_LEVEL_INFO),
105
105
  meta: {
106
106
  rollupVersion: "4.23.0",
@@ -122,7 +122,7 @@ const getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
122
122
  if (onLog) {
123
123
  const minimalPriority = logLevelPriority[logLevel];
124
124
  return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
125
- if (level$1 === LOG_LEVEL_ERROR) return require_binding.error(normalizeLog(handledLog));
125
+ if (level$1 === LOG_LEVEL_ERROR) return require_parse_ast_index.error(normalizeLog(handledLog));
126
126
  if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
127
127
  });
128
128
  }
@@ -161,7 +161,7 @@ function relativeId(id) {
161
161
  //#endregion
162
162
  //#region src/builtin-plugin/utils.ts
163
163
  function makeBuiltinPluginCallable(plugin) {
164
- let callablePlugin = new require_binding.import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
164
+ let callablePlugin = new require_parse_ast_index.import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
165
165
  const wrappedPlugin = plugin;
166
166
  for (const key in callablePlugin) wrappedPlugin[key] = function(...args) {
167
167
  return callablePlugin[key](...args);
@@ -228,7 +228,8 @@ function moduleFederationPlugin(config) {
228
228
  const entry = remote.replace(entryGlobalName + "@", "");
229
229
  return {
230
230
  entry,
231
- name
231
+ name,
232
+ entryGlobalName
232
233
  };
233
234
  }
234
235
  return {
@@ -314,7 +315,7 @@ const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins]))
314
315
  function checkOutputPluginOption(plugins, onLog) {
315
316
  for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
316
317
  delete plugin[hook];
317
- onLog(LOG_LEVEL_WARN, require_binding.logInputHookInOutputPlugin(plugin.name, hook));
318
+ onLog(LOG_LEVEL_WARN, require_parse_ast_index.logInputHookInOutputPlugin(plugin.name, hook));
318
319
  }
319
320
  return plugins;
320
321
  }
@@ -343,7 +344,7 @@ var PluginDriver = class {
343
344
  const { handler } = normalizeHook(options);
344
345
  const result = await handler.call({
345
346
  debug: getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", logger, name, logLevel),
346
- error: (e) => require_binding.error(require_binding.logPluginError(normalizeLog(e), name, { hook: "onLog" })),
347
+ error: (e) => require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e), name, { hook: "onLog" })),
347
348
  info: getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", logger, name, logLevel),
348
349
  meta: {
349
350
  rollupVersion: "4.23.0",
@@ -726,7 +727,7 @@ var MinimalPluginContext = class {
726
727
  };
727
728
  }
728
729
  error(e) {
729
- return require_binding.error(require_binding.logPluginError(normalizeLog(e), this.pluginName));
730
+ return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e), this.pluginName));
730
731
  }
731
732
  };
732
733
 
@@ -734,9 +735,9 @@ var MinimalPluginContext = class {
734
735
  //#region src/utils/transform-side-effects.ts
735
736
  function bindingifySideEffects(sideEffects) {
736
737
  switch (sideEffects) {
737
- case true: return require_binding.import_binding.BindingHookSideEffects.True;
738
- case false: return require_binding.import_binding.BindingHookSideEffects.False;
739
- case "no-treeshake": return require_binding.import_binding.BindingHookSideEffects.NoTreeshake;
738
+ case true: return require_parse_ast_index.import_binding.BindingHookSideEffects.True;
739
+ case false: return require_parse_ast_index.import_binding.BindingHookSideEffects.False;
740
+ case "no-treeshake": return require_parse_ast_index.import_binding.BindingHookSideEffects.NoTreeshake;
740
741
  case null:
741
742
  case void 0: return void 0;
742
743
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
@@ -756,7 +757,7 @@ var PluginContext = class extends MinimalPluginContext {
756
757
  }
757
758
  async load(options) {
758
759
  const id = options.id;
759
- if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, require_binding.logCycleLoading(this.pluginName, this.currentLoadingModule));
760
+ if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, require_parse_ast_index.logCycleLoading(this.pluginName, this.currentLoadingModule));
760
761
  const moduleInfo = this.data.getModuleInfo(id, this.context);
761
762
  if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
762
763
  const rawOptions = {
@@ -829,11 +830,8 @@ var PluginContext = class extends MinimalPluginContext {
829
830
  addWatchFile(id) {
830
831
  this.context.addWatchFile(id);
831
832
  }
832
- /**
833
- * @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
834
- */
835
- parse(_input, _options) {
836
- unsupported("`PluginContext#parse` is not supported by rolldown.");
833
+ parse(input, options) {
834
+ return require_parse_ast_index.parseAst("test.js", input, options);
837
835
  }
838
836
  };
839
837
 
@@ -847,7 +845,7 @@ var TransformPluginContext = class extends PluginContext {
847
845
  this.moduleSource = moduleSource;
848
846
  const getLogHandler$1 = (handler) => (log, pos) => {
849
847
  log = normalizeLog(log);
850
- if (pos) require_binding.augmentCodeLocation(log, pos, moduleSource, moduleId);
848
+ if (pos) require_parse_ast_index.augmentCodeLocation(log, pos, moduleSource, moduleId);
851
849
  log.id = moduleId;
852
850
  log.hook = "transform";
853
851
  handler(log);
@@ -858,10 +856,10 @@ var TransformPluginContext = class extends PluginContext {
858
856
  }
859
857
  error(e, pos) {
860
858
  if (typeof e === "string") e = { message: e };
861
- if (pos) require_binding.augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
859
+ if (pos) require_parse_ast_index.augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
862
860
  e.id = this.moduleId;
863
861
  e.hook = "transform";
864
- return require_binding.error(require_binding.logPluginError(normalizeLog(e), this.pluginName));
862
+ return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e), this.pluginName));
865
863
  }
866
864
  getCombinedSourcemap() {
867
865
  return JSON.parse(this.inner.getCombinedSourcemap());
@@ -875,8 +873,8 @@ function bindingifyPluginHookMeta(options) {
875
873
  }
876
874
  function bindingPluginOrder(order) {
877
875
  switch (order) {
878
- case "post": return require_binding.import_binding.BindingPluginOrder.Post;
879
- case "pre": return require_binding.import_binding.BindingPluginOrder.Pre;
876
+ case "post": return require_parse_ast_index.import_binding.BindingPluginOrder.Post;
877
+ case "pre": return require_parse_ast_index.import_binding.BindingPluginOrder.Pre;
880
878
  case null:
881
879
  case void 0: return void 0;
882
880
  default: throw new Error(`Unknown plugin order: ${order}`);
@@ -1105,21 +1103,22 @@ function mapFunctionOption(option, name) {
1105
1103
  } : option;
1106
1104
  }
1107
1105
  var NormalizedOutputOptionsImpl = class {
1108
- inner;
1109
- constructor(inner) {
1106
+ constructor(inner, outputOptions, normalizedOutputPlugins) {
1110
1107
  this.inner = inner;
1108
+ this.outputOptions = outputOptions;
1109
+ this.normalizedOutputPlugins = normalizedOutputPlugins;
1111
1110
  }
1112
1111
  get dir() {
1113
1112
  return this.inner.dir ?? void 0;
1114
1113
  }
1115
1114
  get entryFileNames() {
1116
- return mapFunctionOption(this.inner.entryFilenames, "entryFileNames");
1115
+ return this.inner.entryFilenames || this.outputOptions.entryFileNames;
1117
1116
  }
1118
1117
  get chunkFileNames() {
1119
- return mapFunctionOption(this.inner.chunkFilenames, "chunkFileNames");
1118
+ return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
1120
1119
  }
1121
1120
  get assetFileNames() {
1122
- return mapFunctionOption(this.inner.assetFilenames, "assetFilenames");
1121
+ return this.inner.assetFilenames || this.outputOptions.assetFileNames;
1123
1122
  }
1124
1123
  get format() {
1125
1124
  return this.inner.format;
@@ -1131,10 +1130,10 @@ var NormalizedOutputOptionsImpl = class {
1131
1130
  return this.inner.sourcemap;
1132
1131
  }
1133
1132
  get cssEntryFileNames() {
1134
- return mapFunctionOption(this.inner.cssEntryFilenames, "cssEntryFileNames");
1133
+ return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
1135
1134
  }
1136
1135
  get cssChunkFileNames() {
1137
- return mapFunctionOption(this.inner.cssChunkFilenames, "cssChunkFileNames");
1136
+ return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
1138
1137
  }
1139
1138
  get shimMissingExports() {
1140
1139
  return this.inner.shimMissingExports;
@@ -1152,16 +1151,16 @@ var NormalizedOutputOptionsImpl = class {
1152
1151
  return this.inner.externalLiveBindings;
1153
1152
  }
1154
1153
  get banner() {
1155
- return mapFunctionOption(this.inner.banner, "banner") ?? void 0;
1154
+ return normalizeAddon(this.outputOptions.banner);
1156
1155
  }
1157
1156
  get footer() {
1158
- return mapFunctionOption(this.inner.footer, "footer") ?? void 0;
1157
+ return normalizeAddon(this.outputOptions.footer);
1159
1158
  }
1160
1159
  get intro() {
1161
- return mapFunctionOption(this.inner.intro, "intro") ?? void 0;
1160
+ return normalizeAddon(this.outputOptions.intro);
1162
1161
  }
1163
1162
  get outro() {
1164
- return mapFunctionOption(this.inner.outro, "outro") ?? void 0;
1163
+ return normalizeAddon(this.outputOptions.outro);
1165
1164
  }
1166
1165
  get esModule() {
1167
1166
  return this.inner.esModule;
@@ -1170,7 +1169,7 @@ var NormalizedOutputOptionsImpl = class {
1170
1169
  return this.inner.extend;
1171
1170
  }
1172
1171
  get globals() {
1173
- return mapFunctionOption(this.inner.globals, "globals");
1172
+ return this.inner.globals || this.outputOptions.globals;
1174
1173
  }
1175
1174
  get hashCharacters() {
1176
1175
  return this.inner.hashCharacters;
@@ -1182,7 +1181,7 @@ var NormalizedOutputOptionsImpl = class {
1182
1181
  return mapFunctionOption(void 0, "sourcemapIgnoreList");
1183
1182
  }
1184
1183
  get sourcemapPathTransform() {
1185
- return mapFunctionOption(void 0, "sourcemapPathTransform");
1184
+ return this.outputOptions.sourcemapPathTransform;
1186
1185
  }
1187
1186
  get minify() {
1188
1187
  return this.inner.minify;
@@ -1193,7 +1192,14 @@ var NormalizedOutputOptionsImpl = class {
1193
1192
  get polyfillRequire() {
1194
1193
  return this.inner.polyfillRequire;
1195
1194
  }
1195
+ get plugins() {
1196
+ return this.normalizedOutputPlugins;
1197
+ }
1196
1198
  };
1199
+ function normalizeAddon(value) {
1200
+ if (typeof value === "function") return value;
1201
+ return () => value || "";
1202
+ }
1197
1203
 
1198
1204
  //#endregion
1199
1205
  //#region src/plugin/bindingify-output-hooks.ts
@@ -1203,7 +1209,7 @@ function bindingifyRenderStart(args) {
1203
1209
  const { handler, meta } = normalizeHook(hook);
1204
1210
  return {
1205
1211
  plugin: async (ctx, opts) => {
1206
- handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptionsImpl(opts, args.onLog));
1212
+ handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
1207
1213
  },
1208
1214
  meta: bindingifyPluginHookMeta(meta)
1209
1215
  };
@@ -1214,7 +1220,7 @@ function bindingifyRenderChunk(args) {
1214
1220
  const { handler, meta } = normalizeHook(hook);
1215
1221
  return {
1216
1222
  plugin: async (ctx, code, chunk, opts) => {
1217
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts));
1223
+ const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins));
1218
1224
  if (ret == null) return;
1219
1225
  if (typeof ret === "string") return { code: ret };
1220
1226
  if (!ret.map) return { code: ret.code };
@@ -1259,7 +1265,7 @@ function bindingifyGenerateBundle(args) {
1259
1265
  deleted: new Set()
1260
1266
  };
1261
1267
  const output = transformToOutputBundle(bundle, changed);
1262
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
1268
+ await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
1263
1269
  return collectChangedBundle(changed, output);
1264
1270
  },
1265
1271
  meta: bindingifyPluginHookMeta(meta)
@@ -1276,7 +1282,7 @@ function bindingifyWriteBundle(args) {
1276
1282
  deleted: new Set()
1277
1283
  };
1278
1284
  const output = transformToOutputBundle(bundle, changed);
1279
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output);
1285
+ await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
1280
1286
  return collectChangedBundle(changed, output);
1281
1287
  },
1282
1288
  meta: bindingifyPluginHookMeta(meta)
@@ -1369,14 +1375,15 @@ function bindingifyCloseWatcher(args) {
1369
1375
 
1370
1376
  //#endregion
1371
1377
  //#region src/plugin/bindingify-plugin.ts
1372
- function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, onLog, logLevel) {
1378
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel) {
1373
1379
  const args = {
1374
1380
  plugin,
1375
1381
  options,
1376
1382
  outputOptions,
1377
1383
  pluginContextData,
1378
1384
  onLog,
1379
- logLevel
1385
+ logLevel,
1386
+ normalizedOutputPlugins
1380
1387
  };
1381
1388
  const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
1382
1389
  const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
@@ -1474,7 +1481,7 @@ function wrapHandlers(plugin) {
1474
1481
  try {
1475
1482
  return await handler(...args);
1476
1483
  } catch (e) {
1477
- return require_binding.error(require_binding.logPluginError(e, plugin.name, {
1484
+ return require_parse_ast_index.error(require_parse_ast_index.logPluginError(e, plugin.name, {
1478
1485
  hook: hookName,
1479
1486
  id: hookName === "transform" ? args[2] : void 0
1480
1487
  }));
@@ -1566,12 +1573,12 @@ function normalizedStringOrRegex(pattern) {
1566
1573
 
1567
1574
  //#endregion
1568
1575
  //#region src/utils/bindingify-input-options.ts
1569
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, onLog, logLevel) {
1576
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel) {
1570
1577
  const pluginContextData = new PluginContextData();
1571
1578
  const plugins = rawPlugins.map((plugin) => {
1572
1579
  if ("_parallel" in plugin) return void 0;
1573
1580
  if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
1574
- return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, onLog, logLevel);
1581
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel);
1575
1582
  });
1576
1583
  return {
1577
1584
  input: bindingifyInput(inputOptions.input),
@@ -1667,10 +1674,10 @@ function bindingifyInject(inject) {
1667
1674
  }
1668
1675
  function bindingifyLogLevel(logLevel) {
1669
1676
  switch (logLevel) {
1670
- case "silent": return require_binding.import_binding.BindingLogLevel.Silent;
1671
- case "debug": return require_binding.import_binding.BindingLogLevel.Debug;
1672
- case "warn": return require_binding.import_binding.BindingLogLevel.Warn;
1673
- case "info": return require_binding.import_binding.BindingLogLevel.Info;
1677
+ case "silent": return require_parse_ast_index.import_binding.BindingLogLevel.Silent;
1678
+ case "debug": return require_parse_ast_index.import_binding.BindingLogLevel.Debug;
1679
+ case "warn": return require_parse_ast_index.import_binding.BindingLogLevel.Warn;
1680
+ case "info": return require_parse_ast_index.import_binding.BindingLogLevel.Info;
1674
1681
  default: throw new Error(`Unexpected log level: ${logLevel}`);
1675
1682
  }
1676
1683
  }
@@ -2171,7 +2178,7 @@ async function initializeParallelPlugins(plugins) {
2171
2178
  }
2172
2179
  if (pluginInfos.length <= 0) return void 0;
2173
2180
  const count = Math.min((0, node_os.availableParallelism)(), 8);
2174
- const parallelJsPluginRegistry = new require_binding.import_binding.ParallelJsPluginRegistry(count);
2181
+ const parallelJsPluginRegistry = new require_parse_ast_index.import_binding.ParallelJsPluginRegistry(count);
2175
2182
  const registryId = parallelJsPluginRegistry.id;
2176
2183
  const workers = await initializeWorkers(registryId, count, pluginInfos);
2177
2184
  const stopWorkers = async () => {
@@ -2304,10 +2311,10 @@ const InputOptionsSchema = valibot.strictObject({
2304
2311
  valibot.literal("browser"),
2305
2312
  valibot.literal("neutral"),
2306
2313
  valibot.literal("node")
2307
- ])), valibot.description(`Platform for which the code should be generated (node, ${require_binding.colors.underline("browser")}, neutral)`)),
2314
+ ])), valibot.description(`Platform for which the code should be generated (node, ${require_parse_ast_index.colors.underline("browser")}, neutral)`)),
2308
2315
  shimMissingExports: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Create shim variables for missing exports")),
2309
2316
  treeshake: valibot.optional(TreeshakingOptionsSchema),
2310
- logLevel: valibot.pipe(valibot.optional(LogLevelOptionSchema), valibot.description(`Log level (${require_binding.colors.dim("silent")}, ${require_binding.colors.underline(require_binding.colors.gray("info"))}, debug, ${require_binding.colors.yellow("warn")})`)),
2317
+ logLevel: valibot.pipe(valibot.optional(LogLevelOptionSchema), valibot.description(`Log level (${require_parse_ast_index.colors.dim("silent")}, ${require_parse_ast_index.colors.underline(require_parse_ast_index.colors.gray("info"))}, debug, ${require_parse_ast_index.colors.yellow("warn")})`)),
2311
2318
  onLog: valibot.optional(OnLogSchema),
2312
2319
  onwarn: valibot.optional(OnwarnSchema),
2313
2320
  moduleTypes: valibot.pipe(valibot.optional(ModuleTypesSchema), valibot.description("Module types for customized extensions")),
@@ -2396,18 +2403,18 @@ const OutputOptionsSchema = valibot.strictObject({
2396
2403
  valibot.literal("named"),
2397
2404
  valibot.literal("default"),
2398
2405
  valibot.literal("none")
2399
- ])), valibot.description(`Specify a export mode (${require_binding.colors.underline("auto")}, named, default, none)`)),
2406
+ ])), valibot.description(`Specify a export mode (${require_parse_ast_index.colors.underline("auto")}, named, default, none)`)),
2400
2407
  hashCharacters: valibot.pipe(valibot.optional(valibot.union([
2401
2408
  valibot.literal("base64"),
2402
2409
  valibot.literal("base36"),
2403
2410
  valibot.literal("hex")
2404
2411
  ])), valibot.description("Use the specified character set for file hashes")),
2405
- format: valibot.pipe(valibot.optional(ModuleFormatSchema), valibot.description(`Output format of the generated bundle (supports ${require_binding.colors.underline("esm")}, cjs, and iife)`)),
2412
+ format: valibot.pipe(valibot.optional(ModuleFormatSchema), valibot.description(`Output format of the generated bundle (supports ${require_parse_ast_index.colors.underline("esm")}, cjs, and iife)`)),
2406
2413
  sourcemap: valibot.pipe(valibot.optional(valibot.union([
2407
2414
  valibot.boolean(),
2408
2415
  valibot.literal("inline"),
2409
2416
  valibot.literal("hidden")
2410
- ])), valibot.description(`Generate sourcemap (\`-s inline\` for inline, or ${require_binding.colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
2417
+ ])), valibot.description(`Generate sourcemap (\`-s inline\` for inline, or ${require_parse_ast_index.colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
2411
2418
  sourcemapIgnoreList: valibot.optional(valibot.union([valibot.boolean(), valibot.custom(() => true)])),
2412
2419
  sourcemapPathTransform: valibot.optional(valibot.custom(() => true)),
2413
2420
  banner: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
@@ -2431,7 +2438,7 @@ const OutputOptionsSchema = valibot.strictObject({
2431
2438
  target: valibot.pipe(valibot.optional(valibot.enum(ESTarget)), valibot.description("The JavaScript target environment"))
2432
2439
  });
2433
2440
  const getAddonDescription = (placement, wrapper) => {
2434
- return `Code to insert the ${require_binding.colors.bold(placement)} of the bundled file (${require_binding.colors.bold(wrapper)} the wrapper function)`;
2441
+ return `Code to insert the ${require_parse_ast_index.colors.bold(placement)} of the bundled file (${require_parse_ast_index.colors.bold(wrapper)} the wrapper function)`;
2435
2442
  };
2436
2443
  const OutputCliOverrideSchema = valibot.strictObject({
2437
2444
  entryFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted entry chunks")),
@@ -2488,12 +2495,13 @@ async function createBundlerOptions(inputOptions, outputOptions) {
2488
2495
  const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
2489
2496
  const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel);
2490
2497
  outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
2491
- if (outputOptions.minify === true) onLog(LOG_LEVEL_WARN, require_binding.logMinifyWarning());
2492
- let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(await normalizePluginOption(outputOptions.plugins), ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
2498
+ if (outputOptions.minify === true) onLog(LOG_LEVEL_WARN, require_parse_ast_index.logMinifyWarning());
2499
+ const normalizedOutputPlugins = await normalizePluginOption(outputOptions.plugins);
2500
+ let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
2493
2501
  if (inputOptions.experimental?.enableComposingJsPlugins ?? false) plugins = composeJsPlugins(plugins);
2494
2502
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
2495
2503
  try {
2496
- const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, onLog, logLevel);
2504
+ const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel);
2497
2505
  const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
2498
2506
  return {
2499
2507
  bundlerOptions: {
@@ -2517,7 +2525,7 @@ async function createBundler(inputOptions, outputOptions) {
2517
2525
  const option = await createBundlerOptions(inputOptions, outputOptions);
2518
2526
  try {
2519
2527
  return {
2520
- bundler: new require_binding.import_binding.Bundler(option.bundlerOptions),
2528
+ bundler: new require_parse_ast_index.import_binding.Bundler(option.bundlerOptions),
2521
2529
  stopWorkers: option.stopWorkers
2522
2530
  };
2523
2531
  } catch (e) {
@@ -2668,7 +2676,7 @@ async function createWatcher(emitter, input) {
2668
2676
  return createBundlerOptions(inputOptions, output);
2669
2677
  })).flat());
2670
2678
  const notifyOptions = getValidNotifyOption(bundlerOptions);
2671
- const bindingWatcher = new require_binding.import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
2679
+ const bindingWatcher = new require_parse_ast_index.import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
2672
2680
  const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
2673
2681
  watcher.start();
2674
2682
  }
@@ -2677,7 +2685,7 @@ function getValidNotifyOption(bundlerOptions) {
2677
2685
  for (const option of bundlerOptions) if (option.inputOptions.watch) {
2678
2686
  const notifyOption = option.inputOptions.watch.notify;
2679
2687
  if (notifyOption) if (result) {
2680
- option.onLog(LOG_LEVEL_WARN, require_binding.logMultiplyNotifyOption());
2688
+ option.onLog(LOG_LEVEL_WARN, require_parse_ast_index.logMultiplyNotifyOption());
2681
2689
  return result;
2682
2690
  } else result = notifyOption;
2683
2691
  }
@@ -2693,7 +2701,7 @@ const watch = (input) => {
2693
2701
 
2694
2702
  //#endregion
2695
2703
  //#region package.json
2696
- var version = "1.0.0-beta.3-commit.980c6f6";
2704
+ var version = "1.0.0-beta.3-commit.de6e9d2";
2697
2705
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2698
2706
 
2699
2707
  //#endregion
@@ -1,4 +1,4 @@
1
- import { augmentCodeLocation, colors, error, import_binding, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMinifyWarning, logMultiplyNotifyOption, logPluginError } from "./binding-CFTx0Fs7.mjs";
1
+ import { augmentCodeLocation, colors, error, import_binding, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMinifyWarning, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-BDY-7XFT.mjs";
2
2
  import path from "node:path";
3
3
  import { Buffer } from "node:buffer";
4
4
  import { Worker } from "node:worker_threads";
@@ -226,7 +226,8 @@ function moduleFederationPlugin(config) {
226
226
  const entry = remote.replace(entryGlobalName + "@", "");
227
227
  return {
228
228
  entry,
229
- name
229
+ name,
230
+ entryGlobalName
230
231
  };
231
232
  }
232
233
  return {
@@ -827,11 +828,8 @@ var PluginContext = class extends MinimalPluginContext {
827
828
  addWatchFile(id) {
828
829
  this.context.addWatchFile(id);
829
830
  }
830
- /**
831
- * @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
832
- */
833
- parse(_input, _options) {
834
- unsupported("`PluginContext#parse` is not supported by rolldown.");
831
+ parse(input, options) {
832
+ return parseAst("test.js", input, options);
835
833
  }
836
834
  };
837
835
 
@@ -1103,21 +1101,22 @@ function mapFunctionOption(option, name) {
1103
1101
  } : option;
1104
1102
  }
1105
1103
  var NormalizedOutputOptionsImpl = class {
1106
- inner;
1107
- constructor(inner) {
1104
+ constructor(inner, outputOptions, normalizedOutputPlugins) {
1108
1105
  this.inner = inner;
1106
+ this.outputOptions = outputOptions;
1107
+ this.normalizedOutputPlugins = normalizedOutputPlugins;
1109
1108
  }
1110
1109
  get dir() {
1111
1110
  return this.inner.dir ?? void 0;
1112
1111
  }
1113
1112
  get entryFileNames() {
1114
- return mapFunctionOption(this.inner.entryFilenames, "entryFileNames");
1113
+ return this.inner.entryFilenames || this.outputOptions.entryFileNames;
1115
1114
  }
1116
1115
  get chunkFileNames() {
1117
- return mapFunctionOption(this.inner.chunkFilenames, "chunkFileNames");
1116
+ return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
1118
1117
  }
1119
1118
  get assetFileNames() {
1120
- return mapFunctionOption(this.inner.assetFilenames, "assetFilenames");
1119
+ return this.inner.assetFilenames || this.outputOptions.assetFileNames;
1121
1120
  }
1122
1121
  get format() {
1123
1122
  return this.inner.format;
@@ -1129,10 +1128,10 @@ var NormalizedOutputOptionsImpl = class {
1129
1128
  return this.inner.sourcemap;
1130
1129
  }
1131
1130
  get cssEntryFileNames() {
1132
- return mapFunctionOption(this.inner.cssEntryFilenames, "cssEntryFileNames");
1131
+ return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
1133
1132
  }
1134
1133
  get cssChunkFileNames() {
1135
- return mapFunctionOption(this.inner.cssChunkFilenames, "cssChunkFileNames");
1134
+ return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
1136
1135
  }
1137
1136
  get shimMissingExports() {
1138
1137
  return this.inner.shimMissingExports;
@@ -1150,16 +1149,16 @@ var NormalizedOutputOptionsImpl = class {
1150
1149
  return this.inner.externalLiveBindings;
1151
1150
  }
1152
1151
  get banner() {
1153
- return mapFunctionOption(this.inner.banner, "banner") ?? void 0;
1152
+ return normalizeAddon(this.outputOptions.banner);
1154
1153
  }
1155
1154
  get footer() {
1156
- return mapFunctionOption(this.inner.footer, "footer") ?? void 0;
1155
+ return normalizeAddon(this.outputOptions.footer);
1157
1156
  }
1158
1157
  get intro() {
1159
- return mapFunctionOption(this.inner.intro, "intro") ?? void 0;
1158
+ return normalizeAddon(this.outputOptions.intro);
1160
1159
  }
1161
1160
  get outro() {
1162
- return mapFunctionOption(this.inner.outro, "outro") ?? void 0;
1161
+ return normalizeAddon(this.outputOptions.outro);
1163
1162
  }
1164
1163
  get esModule() {
1165
1164
  return this.inner.esModule;
@@ -1168,7 +1167,7 @@ var NormalizedOutputOptionsImpl = class {
1168
1167
  return this.inner.extend;
1169
1168
  }
1170
1169
  get globals() {
1171
- return mapFunctionOption(this.inner.globals, "globals");
1170
+ return this.inner.globals || this.outputOptions.globals;
1172
1171
  }
1173
1172
  get hashCharacters() {
1174
1173
  return this.inner.hashCharacters;
@@ -1180,7 +1179,7 @@ var NormalizedOutputOptionsImpl = class {
1180
1179
  return mapFunctionOption(void 0, "sourcemapIgnoreList");
1181
1180
  }
1182
1181
  get sourcemapPathTransform() {
1183
- return mapFunctionOption(void 0, "sourcemapPathTransform");
1182
+ return this.outputOptions.sourcemapPathTransform;
1184
1183
  }
1185
1184
  get minify() {
1186
1185
  return this.inner.minify;
@@ -1191,7 +1190,14 @@ var NormalizedOutputOptionsImpl = class {
1191
1190
  get polyfillRequire() {
1192
1191
  return this.inner.polyfillRequire;
1193
1192
  }
1193
+ get plugins() {
1194
+ return this.normalizedOutputPlugins;
1195
+ }
1194
1196
  };
1197
+ function normalizeAddon(value) {
1198
+ if (typeof value === "function") return value;
1199
+ return () => value || "";
1200
+ }
1195
1201
 
1196
1202
  //#endregion
1197
1203
  //#region src/plugin/bindingify-output-hooks.ts
@@ -1201,7 +1207,7 @@ function bindingifyRenderStart(args) {
1201
1207
  const { handler, meta } = normalizeHook(hook);
1202
1208
  return {
1203
1209
  plugin: async (ctx, opts) => {
1204
- handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptionsImpl(opts, args.onLog));
1210
+ handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
1205
1211
  },
1206
1212
  meta: bindingifyPluginHookMeta(meta)
1207
1213
  };
@@ -1212,7 +1218,7 @@ function bindingifyRenderChunk(args) {
1212
1218
  const { handler, meta } = normalizeHook(hook);
1213
1219
  return {
1214
1220
  plugin: async (ctx, code, chunk, opts) => {
1215
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts));
1221
+ const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins));
1216
1222
  if (ret == null) return;
1217
1223
  if (typeof ret === "string") return { code: ret };
1218
1224
  if (!ret.map) return { code: ret.code };
@@ -1257,7 +1263,7 @@ function bindingifyGenerateBundle(args) {
1257
1263
  deleted: new Set()
1258
1264
  };
1259
1265
  const output = transformToOutputBundle(bundle, changed);
1260
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
1266
+ await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
1261
1267
  return collectChangedBundle(changed, output);
1262
1268
  },
1263
1269
  meta: bindingifyPluginHookMeta(meta)
@@ -1274,7 +1280,7 @@ function bindingifyWriteBundle(args) {
1274
1280
  deleted: new Set()
1275
1281
  };
1276
1282
  const output = transformToOutputBundle(bundle, changed);
1277
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output);
1283
+ await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
1278
1284
  return collectChangedBundle(changed, output);
1279
1285
  },
1280
1286
  meta: bindingifyPluginHookMeta(meta)
@@ -1367,14 +1373,15 @@ function bindingifyCloseWatcher(args) {
1367
1373
 
1368
1374
  //#endregion
1369
1375
  //#region src/plugin/bindingify-plugin.ts
1370
- function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, onLog, logLevel) {
1376
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel) {
1371
1377
  const args = {
1372
1378
  plugin,
1373
1379
  options,
1374
1380
  outputOptions,
1375
1381
  pluginContextData,
1376
1382
  onLog,
1377
- logLevel
1383
+ logLevel,
1384
+ normalizedOutputPlugins
1378
1385
  };
1379
1386
  const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
1380
1387
  const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
@@ -1564,12 +1571,12 @@ function normalizedStringOrRegex(pattern) {
1564
1571
 
1565
1572
  //#endregion
1566
1573
  //#region src/utils/bindingify-input-options.ts
1567
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, onLog, logLevel) {
1574
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel) {
1568
1575
  const pluginContextData = new PluginContextData();
1569
1576
  const plugins = rawPlugins.map((plugin) => {
1570
1577
  if ("_parallel" in plugin) return void 0;
1571
1578
  if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
1572
- return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, onLog, logLevel);
1579
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel);
1573
1580
  });
1574
1581
  return {
1575
1582
  input: bindingifyInput(inputOptions.input),
@@ -2487,11 +2494,12 @@ async function createBundlerOptions(inputOptions, outputOptions) {
2487
2494
  const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel);
2488
2495
  outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
2489
2496
  if (outputOptions.minify === true) onLog(LOG_LEVEL_WARN, logMinifyWarning());
2490
- let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(await normalizePluginOption(outputOptions.plugins), ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
2497
+ const normalizedOutputPlugins = await normalizePluginOption(outputOptions.plugins);
2498
+ let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
2491
2499
  if (inputOptions.experimental?.enableComposingJsPlugins ?? false) plugins = composeJsPlugins(plugins);
2492
2500
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
2493
2501
  try {
2494
- const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, onLog, logLevel);
2502
+ const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel);
2495
2503
  const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
2496
2504
  return {
2497
2505
  bundlerOptions: {
@@ -2691,7 +2699,7 @@ const watch = (input) => {
2691
2699
 
2692
2700
  //#endregion
2693
2701
  //#region package.json
2694
- var version = "1.0.0-beta.3-commit.980c6f6";
2702
+ var version = "1.0.0-beta.3-commit.de6e9d2";
2695
2703
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2696
2704
 
2697
2705
  //#endregion