rolldown 1.0.0-beta.3-commit.fc7dd8c → 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);
@@ -315,7 +315,7 @@ const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins]))
315
315
  function checkOutputPluginOption(plugins, onLog) {
316
316
  for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
317
317
  delete plugin[hook];
318
- onLog(LOG_LEVEL_WARN, require_binding.logInputHookInOutputPlugin(plugin.name, hook));
318
+ onLog(LOG_LEVEL_WARN, require_parse_ast_index.logInputHookInOutputPlugin(plugin.name, hook));
319
319
  }
320
320
  return plugins;
321
321
  }
@@ -344,7 +344,7 @@ var PluginDriver = class {
344
344
  const { handler } = normalizeHook(options);
345
345
  const result = await handler.call({
346
346
  debug: getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", logger, name, logLevel),
347
- 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" })),
348
348
  info: getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", logger, name, logLevel),
349
349
  meta: {
350
350
  rollupVersion: "4.23.0",
@@ -727,7 +727,7 @@ var MinimalPluginContext = class {
727
727
  };
728
728
  }
729
729
  error(e) {
730
- 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));
731
731
  }
732
732
  };
733
733
 
@@ -735,9 +735,9 @@ var MinimalPluginContext = class {
735
735
  //#region src/utils/transform-side-effects.ts
736
736
  function bindingifySideEffects(sideEffects) {
737
737
  switch (sideEffects) {
738
- case true: return require_binding.import_binding.BindingHookSideEffects.True;
739
- case false: return require_binding.import_binding.BindingHookSideEffects.False;
740
- 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;
741
741
  case null:
742
742
  case void 0: return void 0;
743
743
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
@@ -757,7 +757,7 @@ var PluginContext = class extends MinimalPluginContext {
757
757
  }
758
758
  async load(options) {
759
759
  const id = options.id;
760
- 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));
761
761
  const moduleInfo = this.data.getModuleInfo(id, this.context);
762
762
  if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
763
763
  const rawOptions = {
@@ -830,11 +830,8 @@ var PluginContext = class extends MinimalPluginContext {
830
830
  addWatchFile(id) {
831
831
  this.context.addWatchFile(id);
832
832
  }
833
- /**
834
- * @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
835
- */
836
- parse(_input, _options) {
837
- unsupported("`PluginContext#parse` is not supported by rolldown.");
833
+ parse(input, options) {
834
+ return require_parse_ast_index.parseAst("test.js", input, options);
838
835
  }
839
836
  };
840
837
 
@@ -848,7 +845,7 @@ var TransformPluginContext = class extends PluginContext {
848
845
  this.moduleSource = moduleSource;
849
846
  const getLogHandler$1 = (handler) => (log, pos) => {
850
847
  log = normalizeLog(log);
851
- if (pos) require_binding.augmentCodeLocation(log, pos, moduleSource, moduleId);
848
+ if (pos) require_parse_ast_index.augmentCodeLocation(log, pos, moduleSource, moduleId);
852
849
  log.id = moduleId;
853
850
  log.hook = "transform";
854
851
  handler(log);
@@ -859,10 +856,10 @@ var TransformPluginContext = class extends PluginContext {
859
856
  }
860
857
  error(e, pos) {
861
858
  if (typeof e === "string") e = { message: e };
862
- 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);
863
860
  e.id = this.moduleId;
864
861
  e.hook = "transform";
865
- 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));
866
863
  }
867
864
  getCombinedSourcemap() {
868
865
  return JSON.parse(this.inner.getCombinedSourcemap());
@@ -876,8 +873,8 @@ function bindingifyPluginHookMeta(options) {
876
873
  }
877
874
  function bindingPluginOrder(order) {
878
875
  switch (order) {
879
- case "post": return require_binding.import_binding.BindingPluginOrder.Post;
880
- 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;
881
878
  case null:
882
879
  case void 0: return void 0;
883
880
  default: throw new Error(`Unknown plugin order: ${order}`);
@@ -1106,21 +1103,22 @@ function mapFunctionOption(option, name) {
1106
1103
  } : option;
1107
1104
  }
1108
1105
  var NormalizedOutputOptionsImpl = class {
1109
- inner;
1110
- constructor(inner) {
1106
+ constructor(inner, outputOptions, normalizedOutputPlugins) {
1111
1107
  this.inner = inner;
1108
+ this.outputOptions = outputOptions;
1109
+ this.normalizedOutputPlugins = normalizedOutputPlugins;
1112
1110
  }
1113
1111
  get dir() {
1114
1112
  return this.inner.dir ?? void 0;
1115
1113
  }
1116
1114
  get entryFileNames() {
1117
- return mapFunctionOption(this.inner.entryFilenames, "entryFileNames");
1115
+ return this.inner.entryFilenames || this.outputOptions.entryFileNames;
1118
1116
  }
1119
1117
  get chunkFileNames() {
1120
- return mapFunctionOption(this.inner.chunkFilenames, "chunkFileNames");
1118
+ return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
1121
1119
  }
1122
1120
  get assetFileNames() {
1123
- return mapFunctionOption(this.inner.assetFilenames, "assetFilenames");
1121
+ return this.inner.assetFilenames || this.outputOptions.assetFileNames;
1124
1122
  }
1125
1123
  get format() {
1126
1124
  return this.inner.format;
@@ -1132,10 +1130,10 @@ var NormalizedOutputOptionsImpl = class {
1132
1130
  return this.inner.sourcemap;
1133
1131
  }
1134
1132
  get cssEntryFileNames() {
1135
- return mapFunctionOption(this.inner.cssEntryFilenames, "cssEntryFileNames");
1133
+ return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
1136
1134
  }
1137
1135
  get cssChunkFileNames() {
1138
- return mapFunctionOption(this.inner.cssChunkFilenames, "cssChunkFileNames");
1136
+ return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
1139
1137
  }
1140
1138
  get shimMissingExports() {
1141
1139
  return this.inner.shimMissingExports;
@@ -1153,16 +1151,16 @@ var NormalizedOutputOptionsImpl = class {
1153
1151
  return this.inner.externalLiveBindings;
1154
1152
  }
1155
1153
  get banner() {
1156
- return mapFunctionOption(this.inner.banner, "banner") ?? void 0;
1154
+ return normalizeAddon(this.outputOptions.banner);
1157
1155
  }
1158
1156
  get footer() {
1159
- return mapFunctionOption(this.inner.footer, "footer") ?? void 0;
1157
+ return normalizeAddon(this.outputOptions.footer);
1160
1158
  }
1161
1159
  get intro() {
1162
- return mapFunctionOption(this.inner.intro, "intro") ?? void 0;
1160
+ return normalizeAddon(this.outputOptions.intro);
1163
1161
  }
1164
1162
  get outro() {
1165
- return mapFunctionOption(this.inner.outro, "outro") ?? void 0;
1163
+ return normalizeAddon(this.outputOptions.outro);
1166
1164
  }
1167
1165
  get esModule() {
1168
1166
  return this.inner.esModule;
@@ -1171,7 +1169,7 @@ var NormalizedOutputOptionsImpl = class {
1171
1169
  return this.inner.extend;
1172
1170
  }
1173
1171
  get globals() {
1174
- return mapFunctionOption(this.inner.globals, "globals");
1172
+ return this.inner.globals || this.outputOptions.globals;
1175
1173
  }
1176
1174
  get hashCharacters() {
1177
1175
  return this.inner.hashCharacters;
@@ -1183,7 +1181,7 @@ var NormalizedOutputOptionsImpl = class {
1183
1181
  return mapFunctionOption(void 0, "sourcemapIgnoreList");
1184
1182
  }
1185
1183
  get sourcemapPathTransform() {
1186
- return mapFunctionOption(void 0, "sourcemapPathTransform");
1184
+ return this.outputOptions.sourcemapPathTransform;
1187
1185
  }
1188
1186
  get minify() {
1189
1187
  return this.inner.minify;
@@ -1194,7 +1192,14 @@ var NormalizedOutputOptionsImpl = class {
1194
1192
  get polyfillRequire() {
1195
1193
  return this.inner.polyfillRequire;
1196
1194
  }
1195
+ get plugins() {
1196
+ return this.normalizedOutputPlugins;
1197
+ }
1197
1198
  };
1199
+ function normalizeAddon(value) {
1200
+ if (typeof value === "function") return value;
1201
+ return () => value || "";
1202
+ }
1198
1203
 
1199
1204
  //#endregion
1200
1205
  //#region src/plugin/bindingify-output-hooks.ts
@@ -1204,7 +1209,7 @@ function bindingifyRenderStart(args) {
1204
1209
  const { handler, meta } = normalizeHook(hook);
1205
1210
  return {
1206
1211
  plugin: async (ctx, opts) => {
1207
- 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));
1208
1213
  },
1209
1214
  meta: bindingifyPluginHookMeta(meta)
1210
1215
  };
@@ -1215,7 +1220,7 @@ function bindingifyRenderChunk(args) {
1215
1220
  const { handler, meta } = normalizeHook(hook);
1216
1221
  return {
1217
1222
  plugin: async (ctx, code, chunk, opts) => {
1218
- 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));
1219
1224
  if (ret == null) return;
1220
1225
  if (typeof ret === "string") return { code: ret };
1221
1226
  if (!ret.map) return { code: ret.code };
@@ -1260,7 +1265,7 @@ function bindingifyGenerateBundle(args) {
1260
1265
  deleted: new Set()
1261
1266
  };
1262
1267
  const output = transformToOutputBundle(bundle, changed);
1263
- 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);
1264
1269
  return collectChangedBundle(changed, output);
1265
1270
  },
1266
1271
  meta: bindingifyPluginHookMeta(meta)
@@ -1277,7 +1282,7 @@ function bindingifyWriteBundle(args) {
1277
1282
  deleted: new Set()
1278
1283
  };
1279
1284
  const output = transformToOutputBundle(bundle, changed);
1280
- 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);
1281
1286
  return collectChangedBundle(changed, output);
1282
1287
  },
1283
1288
  meta: bindingifyPluginHookMeta(meta)
@@ -1370,14 +1375,15 @@ function bindingifyCloseWatcher(args) {
1370
1375
 
1371
1376
  //#endregion
1372
1377
  //#region src/plugin/bindingify-plugin.ts
1373
- function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, onLog, logLevel) {
1378
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel) {
1374
1379
  const args = {
1375
1380
  plugin,
1376
1381
  options,
1377
1382
  outputOptions,
1378
1383
  pluginContextData,
1379
1384
  onLog,
1380
- logLevel
1385
+ logLevel,
1386
+ normalizedOutputPlugins
1381
1387
  };
1382
1388
  const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
1383
1389
  const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
@@ -1475,7 +1481,7 @@ function wrapHandlers(plugin) {
1475
1481
  try {
1476
1482
  return await handler(...args);
1477
1483
  } catch (e) {
1478
- 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, {
1479
1485
  hook: hookName,
1480
1486
  id: hookName === "transform" ? args[2] : void 0
1481
1487
  }));
@@ -1567,12 +1573,12 @@ function normalizedStringOrRegex(pattern) {
1567
1573
 
1568
1574
  //#endregion
1569
1575
  //#region src/utils/bindingify-input-options.ts
1570
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, onLog, logLevel) {
1576
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel) {
1571
1577
  const pluginContextData = new PluginContextData();
1572
1578
  const plugins = rawPlugins.map((plugin) => {
1573
1579
  if ("_parallel" in plugin) return void 0;
1574
1580
  if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
1575
- return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, onLog, logLevel);
1581
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel);
1576
1582
  });
1577
1583
  return {
1578
1584
  input: bindingifyInput(inputOptions.input),
@@ -1668,10 +1674,10 @@ function bindingifyInject(inject) {
1668
1674
  }
1669
1675
  function bindingifyLogLevel(logLevel) {
1670
1676
  switch (logLevel) {
1671
- case "silent": return require_binding.import_binding.BindingLogLevel.Silent;
1672
- case "debug": return require_binding.import_binding.BindingLogLevel.Debug;
1673
- case "warn": return require_binding.import_binding.BindingLogLevel.Warn;
1674
- 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;
1675
1681
  default: throw new Error(`Unexpected log level: ${logLevel}`);
1676
1682
  }
1677
1683
  }
@@ -2172,7 +2178,7 @@ async function initializeParallelPlugins(plugins) {
2172
2178
  }
2173
2179
  if (pluginInfos.length <= 0) return void 0;
2174
2180
  const count = Math.min((0, node_os.availableParallelism)(), 8);
2175
- const parallelJsPluginRegistry = new require_binding.import_binding.ParallelJsPluginRegistry(count);
2181
+ const parallelJsPluginRegistry = new require_parse_ast_index.import_binding.ParallelJsPluginRegistry(count);
2176
2182
  const registryId = parallelJsPluginRegistry.id;
2177
2183
  const workers = await initializeWorkers(registryId, count, pluginInfos);
2178
2184
  const stopWorkers = async () => {
@@ -2305,10 +2311,10 @@ const InputOptionsSchema = valibot.strictObject({
2305
2311
  valibot.literal("browser"),
2306
2312
  valibot.literal("neutral"),
2307
2313
  valibot.literal("node")
2308
- ])), 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)`)),
2309
2315
  shimMissingExports: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Create shim variables for missing exports")),
2310
2316
  treeshake: valibot.optional(TreeshakingOptionsSchema),
2311
- 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")})`)),
2312
2318
  onLog: valibot.optional(OnLogSchema),
2313
2319
  onwarn: valibot.optional(OnwarnSchema),
2314
2320
  moduleTypes: valibot.pipe(valibot.optional(ModuleTypesSchema), valibot.description("Module types for customized extensions")),
@@ -2397,18 +2403,18 @@ const OutputOptionsSchema = valibot.strictObject({
2397
2403
  valibot.literal("named"),
2398
2404
  valibot.literal("default"),
2399
2405
  valibot.literal("none")
2400
- ])), 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)`)),
2401
2407
  hashCharacters: valibot.pipe(valibot.optional(valibot.union([
2402
2408
  valibot.literal("base64"),
2403
2409
  valibot.literal("base36"),
2404
2410
  valibot.literal("hex")
2405
2411
  ])), valibot.description("Use the specified character set for file hashes")),
2406
- 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)`)),
2407
2413
  sourcemap: valibot.pipe(valibot.optional(valibot.union([
2408
2414
  valibot.boolean(),
2409
2415
  valibot.literal("inline"),
2410
2416
  valibot.literal("hidden")
2411
- ])), 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")})`)),
2412
2418
  sourcemapIgnoreList: valibot.optional(valibot.union([valibot.boolean(), valibot.custom(() => true)])),
2413
2419
  sourcemapPathTransform: valibot.optional(valibot.custom(() => true)),
2414
2420
  banner: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
@@ -2432,7 +2438,7 @@ const OutputOptionsSchema = valibot.strictObject({
2432
2438
  target: valibot.pipe(valibot.optional(valibot.enum(ESTarget)), valibot.description("The JavaScript target environment"))
2433
2439
  });
2434
2440
  const getAddonDescription = (placement, wrapper) => {
2435
- 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)`;
2436
2442
  };
2437
2443
  const OutputCliOverrideSchema = valibot.strictObject({
2438
2444
  entryFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted entry chunks")),
@@ -2489,12 +2495,13 @@ async function createBundlerOptions(inputOptions, outputOptions) {
2489
2495
  const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
2490
2496
  const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel);
2491
2497
  outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
2492
- if (outputOptions.minify === true) onLog(LOG_LEVEL_WARN, require_binding.logMinifyWarning());
2493
- 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)];
2494
2501
  if (inputOptions.experimental?.enableComposingJsPlugins ?? false) plugins = composeJsPlugins(plugins);
2495
2502
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
2496
2503
  try {
2497
- const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, onLog, logLevel);
2504
+ const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel);
2498
2505
  const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
2499
2506
  return {
2500
2507
  bundlerOptions: {
@@ -2518,7 +2525,7 @@ async function createBundler(inputOptions, outputOptions) {
2518
2525
  const option = await createBundlerOptions(inputOptions, outputOptions);
2519
2526
  try {
2520
2527
  return {
2521
- bundler: new require_binding.import_binding.Bundler(option.bundlerOptions),
2528
+ bundler: new require_parse_ast_index.import_binding.Bundler(option.bundlerOptions),
2522
2529
  stopWorkers: option.stopWorkers
2523
2530
  };
2524
2531
  } catch (e) {
@@ -2669,7 +2676,7 @@ async function createWatcher(emitter, input) {
2669
2676
  return createBundlerOptions(inputOptions, output);
2670
2677
  })).flat());
2671
2678
  const notifyOptions = getValidNotifyOption(bundlerOptions);
2672
- 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);
2673
2680
  const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
2674
2681
  watcher.start();
2675
2682
  }
@@ -2678,7 +2685,7 @@ function getValidNotifyOption(bundlerOptions) {
2678
2685
  for (const option of bundlerOptions) if (option.inputOptions.watch) {
2679
2686
  const notifyOption = option.inputOptions.watch.notify;
2680
2687
  if (notifyOption) if (result) {
2681
- option.onLog(LOG_LEVEL_WARN, require_binding.logMultiplyNotifyOption());
2688
+ option.onLog(LOG_LEVEL_WARN, require_parse_ast_index.logMultiplyNotifyOption());
2682
2689
  return result;
2683
2690
  } else result = notifyOption;
2684
2691
  }
@@ -2694,7 +2701,7 @@ const watch = (input) => {
2694
2701
 
2695
2702
  //#endregion
2696
2703
  //#region package.json
2697
- var version = "1.0.0-beta.3-commit.fc7dd8c";
2704
+ var version = "1.0.0-beta.3-commit.de6e9d2";
2698
2705
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2699
2706
 
2700
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";
@@ -828,11 +828,8 @@ var PluginContext = class extends MinimalPluginContext {
828
828
  addWatchFile(id) {
829
829
  this.context.addWatchFile(id);
830
830
  }
831
- /**
832
- * @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
833
- */
834
- parse(_input, _options) {
835
- unsupported("`PluginContext#parse` is not supported by rolldown.");
831
+ parse(input, options) {
832
+ return parseAst("test.js", input, options);
836
833
  }
837
834
  };
838
835
 
@@ -1104,21 +1101,22 @@ function mapFunctionOption(option, name) {
1104
1101
  } : option;
1105
1102
  }
1106
1103
  var NormalizedOutputOptionsImpl = class {
1107
- inner;
1108
- constructor(inner) {
1104
+ constructor(inner, outputOptions, normalizedOutputPlugins) {
1109
1105
  this.inner = inner;
1106
+ this.outputOptions = outputOptions;
1107
+ this.normalizedOutputPlugins = normalizedOutputPlugins;
1110
1108
  }
1111
1109
  get dir() {
1112
1110
  return this.inner.dir ?? void 0;
1113
1111
  }
1114
1112
  get entryFileNames() {
1115
- return mapFunctionOption(this.inner.entryFilenames, "entryFileNames");
1113
+ return this.inner.entryFilenames || this.outputOptions.entryFileNames;
1116
1114
  }
1117
1115
  get chunkFileNames() {
1118
- return mapFunctionOption(this.inner.chunkFilenames, "chunkFileNames");
1116
+ return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
1119
1117
  }
1120
1118
  get assetFileNames() {
1121
- return mapFunctionOption(this.inner.assetFilenames, "assetFilenames");
1119
+ return this.inner.assetFilenames || this.outputOptions.assetFileNames;
1122
1120
  }
1123
1121
  get format() {
1124
1122
  return this.inner.format;
@@ -1130,10 +1128,10 @@ var NormalizedOutputOptionsImpl = class {
1130
1128
  return this.inner.sourcemap;
1131
1129
  }
1132
1130
  get cssEntryFileNames() {
1133
- return mapFunctionOption(this.inner.cssEntryFilenames, "cssEntryFileNames");
1131
+ return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
1134
1132
  }
1135
1133
  get cssChunkFileNames() {
1136
- return mapFunctionOption(this.inner.cssChunkFilenames, "cssChunkFileNames");
1134
+ return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
1137
1135
  }
1138
1136
  get shimMissingExports() {
1139
1137
  return this.inner.shimMissingExports;
@@ -1151,16 +1149,16 @@ var NormalizedOutputOptionsImpl = class {
1151
1149
  return this.inner.externalLiveBindings;
1152
1150
  }
1153
1151
  get banner() {
1154
- return mapFunctionOption(this.inner.banner, "banner") ?? void 0;
1152
+ return normalizeAddon(this.outputOptions.banner);
1155
1153
  }
1156
1154
  get footer() {
1157
- return mapFunctionOption(this.inner.footer, "footer") ?? void 0;
1155
+ return normalizeAddon(this.outputOptions.footer);
1158
1156
  }
1159
1157
  get intro() {
1160
- return mapFunctionOption(this.inner.intro, "intro") ?? void 0;
1158
+ return normalizeAddon(this.outputOptions.intro);
1161
1159
  }
1162
1160
  get outro() {
1163
- return mapFunctionOption(this.inner.outro, "outro") ?? void 0;
1161
+ return normalizeAddon(this.outputOptions.outro);
1164
1162
  }
1165
1163
  get esModule() {
1166
1164
  return this.inner.esModule;
@@ -1169,7 +1167,7 @@ var NormalizedOutputOptionsImpl = class {
1169
1167
  return this.inner.extend;
1170
1168
  }
1171
1169
  get globals() {
1172
- return mapFunctionOption(this.inner.globals, "globals");
1170
+ return this.inner.globals || this.outputOptions.globals;
1173
1171
  }
1174
1172
  get hashCharacters() {
1175
1173
  return this.inner.hashCharacters;
@@ -1181,7 +1179,7 @@ var NormalizedOutputOptionsImpl = class {
1181
1179
  return mapFunctionOption(void 0, "sourcemapIgnoreList");
1182
1180
  }
1183
1181
  get sourcemapPathTransform() {
1184
- return mapFunctionOption(void 0, "sourcemapPathTransform");
1182
+ return this.outputOptions.sourcemapPathTransform;
1185
1183
  }
1186
1184
  get minify() {
1187
1185
  return this.inner.minify;
@@ -1192,7 +1190,14 @@ var NormalizedOutputOptionsImpl = class {
1192
1190
  get polyfillRequire() {
1193
1191
  return this.inner.polyfillRequire;
1194
1192
  }
1193
+ get plugins() {
1194
+ return this.normalizedOutputPlugins;
1195
+ }
1195
1196
  };
1197
+ function normalizeAddon(value) {
1198
+ if (typeof value === "function") return value;
1199
+ return () => value || "";
1200
+ }
1196
1201
 
1197
1202
  //#endregion
1198
1203
  //#region src/plugin/bindingify-output-hooks.ts
@@ -1202,7 +1207,7 @@ function bindingifyRenderStart(args) {
1202
1207
  const { handler, meta } = normalizeHook(hook);
1203
1208
  return {
1204
1209
  plugin: async (ctx, opts) => {
1205
- 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));
1206
1211
  },
1207
1212
  meta: bindingifyPluginHookMeta(meta)
1208
1213
  };
@@ -1213,7 +1218,7 @@ function bindingifyRenderChunk(args) {
1213
1218
  const { handler, meta } = normalizeHook(hook);
1214
1219
  return {
1215
1220
  plugin: async (ctx, code, chunk, opts) => {
1216
- 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));
1217
1222
  if (ret == null) return;
1218
1223
  if (typeof ret === "string") return { code: ret };
1219
1224
  if (!ret.map) return { code: ret.code };
@@ -1258,7 +1263,7 @@ function bindingifyGenerateBundle(args) {
1258
1263
  deleted: new Set()
1259
1264
  };
1260
1265
  const output = transformToOutputBundle(bundle, changed);
1261
- 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);
1262
1267
  return collectChangedBundle(changed, output);
1263
1268
  },
1264
1269
  meta: bindingifyPluginHookMeta(meta)
@@ -1275,7 +1280,7 @@ function bindingifyWriteBundle(args) {
1275
1280
  deleted: new Set()
1276
1281
  };
1277
1282
  const output = transformToOutputBundle(bundle, changed);
1278
- 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);
1279
1284
  return collectChangedBundle(changed, output);
1280
1285
  },
1281
1286
  meta: bindingifyPluginHookMeta(meta)
@@ -1368,14 +1373,15 @@ function bindingifyCloseWatcher(args) {
1368
1373
 
1369
1374
  //#endregion
1370
1375
  //#region src/plugin/bindingify-plugin.ts
1371
- function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, onLog, logLevel) {
1376
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel) {
1372
1377
  const args = {
1373
1378
  plugin,
1374
1379
  options,
1375
1380
  outputOptions,
1376
1381
  pluginContextData,
1377
1382
  onLog,
1378
- logLevel
1383
+ logLevel,
1384
+ normalizedOutputPlugins
1379
1385
  };
1380
1386
  const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
1381
1387
  const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
@@ -1565,12 +1571,12 @@ function normalizedStringOrRegex(pattern) {
1565
1571
 
1566
1572
  //#endregion
1567
1573
  //#region src/utils/bindingify-input-options.ts
1568
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, onLog, logLevel) {
1574
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel) {
1569
1575
  const pluginContextData = new PluginContextData();
1570
1576
  const plugins = rawPlugins.map((plugin) => {
1571
1577
  if ("_parallel" in plugin) return void 0;
1572
1578
  if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
1573
- return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, onLog, logLevel);
1579
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel);
1574
1580
  });
1575
1581
  return {
1576
1582
  input: bindingifyInput(inputOptions.input),
@@ -2488,11 +2494,12 @@ async function createBundlerOptions(inputOptions, outputOptions) {
2488
2494
  const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel);
2489
2495
  outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
2490
2496
  if (outputOptions.minify === true) onLog(LOG_LEVEL_WARN, logMinifyWarning());
2491
- 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)];
2492
2499
  if (inputOptions.experimental?.enableComposingJsPlugins ?? false) plugins = composeJsPlugins(plugins);
2493
2500
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
2494
2501
  try {
2495
- const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, onLog, logLevel);
2502
+ const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel);
2496
2503
  const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
2497
2504
  return {
2498
2505
  bundlerOptions: {
@@ -2692,7 +2699,7 @@ const watch = (input) => {
2692
2699
 
2693
2700
  //#endregion
2694
2701
  //#region package.json
2695
- var version = "1.0.0-beta.3-commit.fc7dd8c";
2702
+ var version = "1.0.0-beta.3-commit.de6e9d2";
2696
2703
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2697
2704
 
2698
2705
  //#endregion
@@ -857,7 +857,7 @@ export type HelperMode = /**
857
857
  * Example:
858
858
  *
859
859
  * ```js
860
- * import helperName from "@babel/runtime/helpers/helperName";
860
+ * import helperName from "@oxc-project/runtime/helpers/helperName";
861
861
  * helperName(...arguments);
862
862
  * ```
863
863
  */
@@ -1326,7 +1326,7 @@ export interface TransformResult {
1326
1326
  * Example:
1327
1327
  *
1328
1328
  * ```text
1329
- * { "_objectSpread": "@babel/runtime/helpers/objectSpread2" }
1329
+ * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
1330
1330
  * ```
1331
1331
  */
1332
1332
  helpersUsed: Record<string, string>