@rolldown/browser 1.0.0-beta.46 → 1.0.0-beta.47

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,7 +1,7 @@
1
- import { n as __toESM, t as require_binding } from "./binding-BeWSOIj5.mjs";
2
- import { a as logCycleLoading, c as logDeprecatedInject, d as logInputHookInOutputPlugin, f as logInvalidLogPosition, h as styleText, i as error, l as logDeprecatedKeepNames, m as logPluginError, o as logDeprecatedDefine, p as logMultiplyNotifyOption, r as augmentCodeLocation, s as logDeprecatedDropLabels, t as parseAst, u as logDeprecatedProfilerNames } from "./parse-ast-index-DMI5m8Lk.mjs";
3
- import { a as include, c as or, d as arraify, g as unsupported, h as unreachable, i as id, m as unimplemented, n as code, o as moduleType, p as noop, r as exclude, t as and } from "./composable-filters-CgRsnfr3.mjs";
1
+ import { a as logCycleLoading, c as logDeprecatedInject, d as logInputHookInOutputPlugin, f as logInvalidLogPosition, h as styleText, i as error, l as logDeprecatedKeepNames, m as logPluginError, o as logDeprecatedDefine, p as logMultiplyNotifyOption, r as augmentCodeLocation, s as logDeprecatedDropLabels, t as parseAst, u as logDeprecatedProfilerNames } from "./parse-ast-index-BiBzSGZe.mjs";
2
+ import { a as include, c as or, d as arraify, g as unsupported, h as unreachable, i as id, m as unimplemented, n as code, o as moduleType, p as noop, r as exclude, t as and } from "./composable-filters-D_PY7Qa7.mjs";
4
3
  import { Worker, isMainThread } from "node:worker_threads";
4
+ import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingMagicString as BindingMagicString$1, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
5
5
  import path from "node:path";
6
6
  import fsp from "node:fs/promises";
7
7
  import os from "node:os";
@@ -208,9 +208,8 @@ const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new Signa
208
208
 
209
209
  //#endregion
210
210
  //#region src/setup.ts
211
- var import_binding$8 = /* @__PURE__ */ __toESM(require_binding(), 1);
212
211
  if (isMainThread) {
213
- const subscriberGuard = (0, import_binding$8.initTraceSubscriber)();
212
+ const subscriberGuard = initTraceSubscriber();
214
213
  onExit(() => {
215
214
  subscriberGuard?.close();
216
215
  });
@@ -218,12 +217,11 @@ if (isMainThread) {
218
217
 
219
218
  //#endregion
220
219
  //#region package.json
221
- var version = "1.0.0-beta.46";
220
+ var version = "1.0.0-beta.47";
222
221
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
223
222
 
224
223
  //#endregion
225
224
  //#region src/builtin-plugin/utils.ts
226
- var import_binding$7 = /* @__PURE__ */ __toESM(require_binding(), 1);
227
225
  var BuiltinPlugin = class {
228
226
  constructor(name, _options) {
229
227
  this.name = name;
@@ -231,7 +229,7 @@ var BuiltinPlugin = class {
231
229
  }
232
230
  };
233
231
  function makeBuiltinPluginCallable(plugin) {
234
- let callablePlugin = new import_binding$7.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
232
+ let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
235
233
  const wrappedPlugin = plugin;
236
234
  for (const key in callablePlugin) wrappedPlugin[key] = async function(...args$1) {
237
235
  try {
@@ -2862,14 +2860,13 @@ function bindingifyRenderChunkFilter(filterOption) {
2862
2860
 
2863
2861
  //#endregion
2864
2862
  //#region src/plugin/bindingify-plugin-hook-meta.ts
2865
- var import_binding$6 = /* @__PURE__ */ __toESM(require_binding(), 1);
2866
2863
  function bindingifyPluginHookMeta(options) {
2867
2864
  return { order: bindingPluginOrder(options.order) };
2868
2865
  }
2869
2866
  function bindingPluginOrder(order) {
2870
2867
  switch (order) {
2871
- case "post": return import_binding$6.BindingPluginOrder.Post;
2872
- case "pre": return import_binding$6.BindingPluginOrder.Pre;
2868
+ case "post": return BindingPluginOrder.Post;
2869
+ case "pre": return BindingPluginOrder.Pre;
2873
2870
  case null:
2874
2871
  case void 0: return;
2875
2872
  default: throw new Error(`Unknown plugin order: ${order}`);
@@ -3030,7 +3027,6 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
3030
3027
 
3031
3028
  //#endregion
3032
3029
  //#region src/plugin/bindingify-build-hooks.ts
3033
- var import_binding$5 = /* @__PURE__ */ __toESM(require_binding(), 1);
3034
3030
  function bindingifyBuildStart(args$1) {
3035
3031
  const hook = args$1.plugin.buildStart;
3036
3032
  if (!hook) return {};
@@ -3126,11 +3122,15 @@ function bindingifyTransform(args$1) {
3126
3122
  const { handler, meta, options } = normalizeHook(hook);
3127
3123
  return {
3128
3124
  plugin: async (ctx, code$1, id$1, meta$1) => {
3125
+ let magicStringInstance, astInstance;
3129
3126
  Object.defineProperties(meta$1, {
3130
3127
  magicString: { get() {
3131
- return new import_binding$5.BindingMagicString(code$1);
3128
+ if (magicStringInstance) return magicStringInstance;
3129
+ magicStringInstance = new BindingMagicString(code$1);
3130
+ return magicStringInstance;
3132
3131
  } },
3133
3132
  ast: { get() {
3133
+ if (astInstance) return astInstance;
3134
3134
  let lang = "js";
3135
3135
  switch (meta$1.moduleType) {
3136
3136
  case "js":
@@ -3141,10 +3141,11 @@ function bindingifyTransform(args$1) {
3141
3141
  break;
3142
3142
  default: break;
3143
3143
  }
3144
- return parseAst(code$1, {
3144
+ astInstance = parseAst(code$1, {
3145
3145
  astType: meta$1.moduleType.includes("ts") ? "ts" : "js",
3146
3146
  lang
3147
3147
  });
3148
+ return astInstance;
3148
3149
  } }
3149
3150
  });
3150
3151
  const transformCtx = 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);
@@ -3159,7 +3160,7 @@ function bindingifyTransform(args$1) {
3159
3160
  let normalizedCode = void 0;
3160
3161
  let map = ret.map;
3161
3162
  if (typeof ret.code === "string") normalizedCode = ret.code;
3162
- else if (ret.code instanceof import_binding$5.BindingMagicString) {
3163
+ else if (ret.code instanceof BindingMagicString) {
3163
3164
  let magicString = ret.code;
3164
3165
  normalizedCode = magicString.toString();
3165
3166
  let fallbackSourcemap = ctx.sendMagicString(magicString);
@@ -3888,7 +3889,6 @@ function normalizeTransformOptions(inputOptions, onLog) {
3888
3889
 
3889
3890
  //#endregion
3890
3891
  //#region src/utils/bindingify-input-options.ts
3891
- var import_binding$4 = /* @__PURE__ */ __toESM(require_binding(), 1);
3892
3892
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3893
3893
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
3894
3894
  const plugins = rawPlugins.map((plugin) => {
@@ -3958,9 +3958,9 @@ function bindingifyHmr(hmr) {
3958
3958
  function bindingifyAttachDebugInfo(attachDebugInfo) {
3959
3959
  switch (attachDebugInfo) {
3960
3960
  case void 0: return;
3961
- case "full": return import_binding$4.BindingAttachDebugInfo.Full;
3962
- case "simple": return import_binding$4.BindingAttachDebugInfo.Simple;
3963
- case "none": return import_binding$4.BindingAttachDebugInfo.None;
3961
+ case "full": return BindingAttachDebugInfo.Full;
3962
+ case "simple": return BindingAttachDebugInfo.Simple;
3963
+ case "none": return BindingAttachDebugInfo.None;
3964
3964
  }
3965
3965
  }
3966
3966
  function bindingifyExternal(external) {
@@ -3973,13 +3973,13 @@ function bindingifyExternal(external) {
3973
3973
  }
3974
3974
  }
3975
3975
  function bindingifyExperimental(experimental) {
3976
- let chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3976
+ let chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3977
3977
  if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
3978
3978
  case "exec-order":
3979
- chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3979
+ chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3980
3980
  break;
3981
3981
  case "module-id":
3982
- chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ModuleId;
3982
+ chunkModulesOrder = BindingChunkModuleOrderBy.ModuleId;
3983
3983
  break;
3984
3984
  default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
3985
3985
  }
@@ -4039,10 +4039,10 @@ function bindingifyInject(inject) {
4039
4039
  }
4040
4040
  function bindingifyLogLevel(logLevel) {
4041
4041
  switch (logLevel) {
4042
- case "silent": return import_binding$4.BindingLogLevel.Silent;
4043
- case "debug": return import_binding$4.BindingLogLevel.Debug;
4044
- case "warn": return import_binding$4.BindingLogLevel.Warn;
4045
- case "info": return import_binding$4.BindingLogLevel.Info;
4042
+ case "silent": return BindingLogLevel.Silent;
4043
+ case "debug": return BindingLogLevel.Debug;
4044
+ case "warn": return BindingLogLevel.Warn;
4045
+ case "info": return BindingLogLevel.Info;
4046
4046
  default: throw new Error(`Unexpected log level: ${logLevel}`);
4047
4047
  }
4048
4048
  }
@@ -4078,19 +4078,19 @@ function bindingifyTreeshakeOptions(config) {
4078
4078
  };
4079
4079
  switch (config.propertyReadSideEffects) {
4080
4080
  case "always":
4081
- normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.Always;
4081
+ normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
4082
4082
  break;
4083
4083
  case false:
4084
- normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.False;
4084
+ normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
4085
4085
  break;
4086
4086
  default:
4087
4087
  }
4088
4088
  switch (config.propertyWriteSideEffects) {
4089
4089
  case "always":
4090
- normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.Always;
4090
+ normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
4091
4091
  break;
4092
4092
  case false:
4093
- normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.False;
4093
+ normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
4094
4094
  break;
4095
4095
  default:
4096
4096
  }
@@ -4250,7 +4250,6 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
4250
4250
 
4251
4251
  //#endregion
4252
4252
  //#region src/utils/initialize-parallel-plugins.ts
4253
- var import_binding$3 = /* @__PURE__ */ __toESM(require_binding(), 1);
4254
4253
  async function initializeParallelPlugins(plugins) {
4255
4254
  const pluginInfos = [];
4256
4255
  for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
@@ -4263,7 +4262,7 @@ async function initializeParallelPlugins(plugins) {
4263
4262
  }
4264
4263
  if (pluginInfos.length <= 0) return;
4265
4264
  const count = availableParallelism();
4266
- const parallelJsPluginRegistry = new import_binding$3.ParallelJsPluginRegistry(count);
4265
+ const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
4267
4266
  const registryId = parallelJsPluginRegistry.id;
4268
4267
  const workers = await initializeWorkers(registryId, count, pluginInfos);
4269
4268
  const stopWorkers = async () => {
@@ -4341,7 +4340,6 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
4341
4340
 
4342
4341
  //#endregion
4343
4342
  //#region src/api/rolldown/rolldown-build.ts
4344
- var import_binding$2 = /* @__PURE__ */ __toESM(require_binding());
4345
4343
  Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4346
4344
  var RolldownBuild = class RolldownBuild {
4347
4345
  #inputOptions;
@@ -4350,7 +4348,7 @@ var RolldownBuild = class RolldownBuild {
4350
4348
  static asyncRuntimeShutdown = false;
4351
4349
  constructor(inputOptions) {
4352
4350
  this.#inputOptions = inputOptions;
4353
- this.#bundler = new import_binding$2.BindingBundler();
4351
+ this.#bundler = new BindingBundler();
4354
4352
  }
4355
4353
  get closed() {
4356
4354
  return this.#bundlerImpl?.impl.closed ?? true;
@@ -4358,13 +4356,13 @@ var RolldownBuild = class RolldownBuild {
4358
4356
  async #getBundlerWithStopWorker(outputOptions) {
4359
4357
  if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
4360
4358
  const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
4361
- if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding$2.startAsyncRuntime)();
4359
+ if (RolldownBuild.asyncRuntimeShutdown) startAsyncRuntime();
4362
4360
  try {
4363
4361
  return this.#bundlerImpl = {
4364
4362
  impl: this.#bundler.createImpl(option.bundlerOptions),
4365
4363
  stopWorkers: option.stopWorkers,
4366
4364
  shutdown: () => {
4367
- (0, import_binding$2.shutdownAsyncRuntime)();
4365
+ shutdownAsyncRuntime();
4368
4366
  RolldownBuild.asyncRuntimeShutdown = true;
4369
4367
  }
4370
4368
  };
@@ -4504,7 +4502,6 @@ var WatcherEmitter = class {
4504
4502
 
4505
4503
  //#endregion
4506
4504
  //#region src/api/watch/watcher.ts
4507
- var import_binding$1 = /* @__PURE__ */ __toESM(require_binding(), 1);
4508
4505
  var Watcher = class {
4509
4506
  closed;
4510
4507
  inner;
@@ -4526,7 +4523,7 @@ var Watcher = class {
4526
4523
  this.closed = true;
4527
4524
  for (const stop of this.stopWorkers) await stop?.();
4528
4525
  await this.inner.close();
4529
- (0, import_binding$1.shutdownAsyncRuntime)();
4526
+ shutdownAsyncRuntime();
4530
4527
  }
4531
4528
  start() {
4532
4529
  process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
@@ -4538,7 +4535,7 @@ async function createWatcher(emitter, input) {
4538
4535
  return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
4539
4536
  })).flat());
4540
4537
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4541
- new Watcher(emitter, new import_binding$1.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
4538
+ new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
4542
4539
  }
4543
4540
  function getValidNotifyOption(bundlerOptions) {
4544
4541
  let result;
@@ -4567,8 +4564,7 @@ function defineConfig(config) {
4567
4564
 
4568
4565
  //#endregion
4569
4566
  //#region src/index.ts
4570
- var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
4571
4567
  const VERSION = version;
4572
4568
 
4573
4569
  //#endregion
4574
- export { version as C, description$1 as S, getOutputCliKeys as _, build as a, BuiltinPlugin as b, createBundlerOptions as c, bindingifyPlugin as d, normalizeBindingResult as f, getInputCliKeys as g, getCliSchemaInfo as h, watch as i, normalizedStringOrRegex as l, bindingifySourcemap$1 as m, import_binding as n, rolldown as o, transformToRollupOutput as p, defineConfig as r, RolldownBuild as s, VERSION as t, PluginContextData as u, validateCliOptions as v, onExit as w, makeBuiltinPluginCallable as x, PluginDriver as y };
4570
+ export { version as C, description$1 as S, getOutputCliKeys as _, build as a, BuiltinPlugin as b, createBundlerOptions as c, bindingifyPlugin as d, normalizeBindingResult as f, getInputCliKeys as g, getCliSchemaInfo as h, watch as i, normalizedStringOrRegex as l, bindingifySourcemap$1 as m, VERSION as n, rolldown as o, transformToRollupOutput as p, defineConfig as r, RolldownBuild as s, BindingMagicString$1 as t, PluginContextData as u, validateCliOptions as v, onExit as w, makeBuiltinPluginCallable as x, PluginDriver as y };