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

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 { 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-Ck5SwMSC.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";
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";
3
4
  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,8 +208,9 @@ 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);
211
212
  if (isMainThread) {
212
- const subscriberGuard = initTraceSubscriber();
213
+ const subscriberGuard = (0, import_binding$8.initTraceSubscriber)();
213
214
  onExit(() => {
214
215
  subscriberGuard?.close();
215
216
  });
@@ -217,11 +218,12 @@ if (isMainThread) {
217
218
 
218
219
  //#endregion
219
220
  //#region package.json
220
- var version = "1.0.0-beta.45";
221
+ var version = "1.0.0-beta.46";
221
222
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
222
223
 
223
224
  //#endregion
224
225
  //#region src/builtin-plugin/utils.ts
226
+ var import_binding$7 = /* @__PURE__ */ __toESM(require_binding(), 1);
225
227
  var BuiltinPlugin = class {
226
228
  constructor(name, _options) {
227
229
  this.name = name;
@@ -229,7 +231,7 @@ var BuiltinPlugin = class {
229
231
  }
230
232
  };
231
233
  function makeBuiltinPluginCallable(plugin) {
232
- let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
234
+ let callablePlugin = new import_binding$7.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
233
235
  const wrappedPlugin = plugin;
234
236
  for (const key in callablePlugin) wrappedPlugin[key] = async function(...args$1) {
235
237
  try {
@@ -2136,19 +2138,63 @@ function getCliSchemaInfo() {
2136
2138
  }
2137
2139
 
2138
2140
  //#endregion
2139
- //#region src/types/sourcemap.ts
2140
- function bindingifySourcemap$1(map) {
2141
- if (map == null) return;
2142
- return { inner: typeof map === "string" ? map : {
2143
- file: map.file ?? void 0,
2144
- mappings: map.mappings,
2145
- sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
2146
- sources: map.sources?.map((s) => s ?? void 0),
2147
- sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
2148
- names: map.names,
2149
- x_google_ignoreList: map.x_google_ignoreList,
2150
- debugId: "debugId" in map ? map.debugId : void 0
2151
- } };
2141
+ //#region src/decorators/lazy.ts
2142
+ const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
2143
+ const LAZY_CACHE_PREFIX = "__cached_";
2144
+ /**
2145
+ * Legacy decorator that makes a getter lazy-evaluated and cached.
2146
+ * Also auto-registers the field for batch prefetching.
2147
+ *
2148
+ * @example
2149
+ * ```typescript
2150
+ * class MyClass {
2151
+ * @lazy
2152
+ * get expensiveValue() {
2153
+ * return someExpensiveComputation();
2154
+ * }
2155
+ * }
2156
+ * ```
2157
+ */
2158
+ function lazy(target, propertyKey, descriptor) {
2159
+ if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Set();
2160
+ target.constructor[LAZY_FIELDS_KEY].add(propertyKey);
2161
+ const originalGetter = descriptor.get;
2162
+ const cacheKey = LAZY_CACHE_PREFIX + propertyKey;
2163
+ descriptor.get = function() {
2164
+ if (!(cacheKey in this)) this[cacheKey] = originalGetter.call(this);
2165
+ return this[cacheKey];
2166
+ };
2167
+ return descriptor;
2168
+ }
2169
+ /**
2170
+ * Get all lazy field names from a class instance.
2171
+ *
2172
+ * @param instance - Instance to inspect
2173
+ * @returns Set of lazy property names
2174
+ */
2175
+ function getLazyFields(instance$1) {
2176
+ return instance$1.constructor[LAZY_FIELDS_KEY] || /* @__PURE__ */ new Set();
2177
+ }
2178
+
2179
+ //#endregion
2180
+ //#region src/decorators/non-enumerable.ts
2181
+ /**
2182
+ * Decorator that makes a property or method non-enumerable.
2183
+ * This hides the property from enumeration (e.g., Object.keys(), for...in loops).
2184
+ *
2185
+ * @example
2186
+ * ```typescript
2187
+ * class MyClass {
2188
+ * @nonEnumerable
2189
+ * hiddenMethod() {
2190
+ * return 'This method will not show up in Object.keys()';
2191
+ * }
2192
+ * }
2193
+ * ```
2194
+ */
2195
+ function nonEnumerable(target, propertyKey, descriptor) {
2196
+ descriptor.enumerable = false;
2197
+ return descriptor;
2152
2198
  }
2153
2199
 
2154
2200
  //#endregion
@@ -2160,6 +2206,56 @@ function bindingAssetSource(source) {
2160
2206
  return { inner: source };
2161
2207
  }
2162
2208
 
2209
+ //#endregion
2210
+ //#region \0@oxc-project+runtime@0.96.0/helpers/decorate.js
2211
+ function __decorate(decorators, target, key, desc) {
2212
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2213
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2214
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2215
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2216
+ }
2217
+
2218
+ //#endregion
2219
+ //#region src/types/output-asset-impl.ts
2220
+ var OutputAssetImpl = class {
2221
+ type = "asset";
2222
+ constructor(bindingAsset) {
2223
+ this.bindingAsset = bindingAsset;
2224
+ }
2225
+ get fileName() {
2226
+ return this.bindingAsset.getFileName();
2227
+ }
2228
+ get originalFileName() {
2229
+ return this.bindingAsset.getOriginalFileName() || null;
2230
+ }
2231
+ get originalFileNames() {
2232
+ return this.bindingAsset.getOriginalFileNames();
2233
+ }
2234
+ get name() {
2235
+ return this.bindingAsset.getName() ?? void 0;
2236
+ }
2237
+ get names() {
2238
+ return this.bindingAsset.getNames();
2239
+ }
2240
+ get source() {
2241
+ return transformAssetSource(this.bindingAsset.getSource());
2242
+ }
2243
+ __rolldown_external_memory_handle__(keepDataAlive) {
2244
+ if (keepDataAlive) this.#evaluateAllLazyFields();
2245
+ return this.bindingAsset.dropInner();
2246
+ }
2247
+ #evaluateAllLazyFields() {
2248
+ for (const field of getLazyFields(this)) this[field];
2249
+ }
2250
+ };
2251
+ __decorate([lazy], OutputAssetImpl.prototype, "fileName", null);
2252
+ __decorate([lazy], OutputAssetImpl.prototype, "originalFileName", null);
2253
+ __decorate([lazy], OutputAssetImpl.prototype, "originalFileNames", null);
2254
+ __decorate([lazy], OutputAssetImpl.prototype, "name", null);
2255
+ __decorate([lazy], OutputAssetImpl.prototype, "names", null);
2256
+ __decorate([lazy], OutputAssetImpl.prototype, "source", null);
2257
+ __decorate([nonEnumerable], OutputAssetImpl.prototype, "__rolldown_external_memory_handle__", null);
2258
+
2163
2259
  //#endregion
2164
2260
  //#region src/utils/transform-rendered-module.ts
2165
2261
  function transformToRenderedModule(bindingRenderedModule) {
@@ -2225,6 +2321,96 @@ function transformChunkModules(modules) {
2225
2321
  return result;
2226
2322
  }
2227
2323
 
2324
+ //#endregion
2325
+ //#region src/types/output-chunk-impl.ts
2326
+ var OutputChunkImpl = class {
2327
+ type = "chunk";
2328
+ constructor(bindingChunk) {
2329
+ this.bindingChunk = bindingChunk;
2330
+ }
2331
+ get fileName() {
2332
+ return this.bindingChunk.getFileName();
2333
+ }
2334
+ get name() {
2335
+ return this.bindingChunk.getName();
2336
+ }
2337
+ get exports() {
2338
+ return this.bindingChunk.getExports();
2339
+ }
2340
+ get isEntry() {
2341
+ return this.bindingChunk.getIsEntry();
2342
+ }
2343
+ get facadeModuleId() {
2344
+ return this.bindingChunk.getFacadeModuleId() || null;
2345
+ }
2346
+ get isDynamicEntry() {
2347
+ return this.bindingChunk.getIsDynamicEntry();
2348
+ }
2349
+ get sourcemapFileName() {
2350
+ return this.bindingChunk.getSourcemapFileName() || null;
2351
+ }
2352
+ get preliminaryFileName() {
2353
+ return this.bindingChunk.getPreliminaryFileName();
2354
+ }
2355
+ get code() {
2356
+ return this.bindingChunk.getCode();
2357
+ }
2358
+ get modules() {
2359
+ return transformChunkModules(this.bindingChunk.getModules());
2360
+ }
2361
+ get imports() {
2362
+ return this.bindingChunk.getImports();
2363
+ }
2364
+ get dynamicImports() {
2365
+ return this.bindingChunk.getDynamicImports();
2366
+ }
2367
+ get moduleIds() {
2368
+ return this.bindingChunk.getModuleIds();
2369
+ }
2370
+ get map() {
2371
+ const mapString = this.bindingChunk.getMap();
2372
+ return mapString ? transformToRollupSourceMap(mapString) : null;
2373
+ }
2374
+ __rolldown_external_memory_handle__(keepDataAlive) {
2375
+ if (keepDataAlive) this.#evaluateAllLazyFields();
2376
+ return this.bindingChunk.dropInner();
2377
+ }
2378
+ #evaluateAllLazyFields() {
2379
+ for (const field of getLazyFields(this)) this[field];
2380
+ }
2381
+ };
2382
+ __decorate([lazy], OutputChunkImpl.prototype, "fileName", null);
2383
+ __decorate([lazy], OutputChunkImpl.prototype, "name", null);
2384
+ __decorate([lazy], OutputChunkImpl.prototype, "exports", null);
2385
+ __decorate([lazy], OutputChunkImpl.prototype, "isEntry", null);
2386
+ __decorate([lazy], OutputChunkImpl.prototype, "facadeModuleId", null);
2387
+ __decorate([lazy], OutputChunkImpl.prototype, "isDynamicEntry", null);
2388
+ __decorate([lazy], OutputChunkImpl.prototype, "sourcemapFileName", null);
2389
+ __decorate([lazy], OutputChunkImpl.prototype, "preliminaryFileName", null);
2390
+ __decorate([lazy], OutputChunkImpl.prototype, "code", null);
2391
+ __decorate([lazy], OutputChunkImpl.prototype, "modules", null);
2392
+ __decorate([lazy], OutputChunkImpl.prototype, "imports", null);
2393
+ __decorate([lazy], OutputChunkImpl.prototype, "dynamicImports", null);
2394
+ __decorate([lazy], OutputChunkImpl.prototype, "moduleIds", null);
2395
+ __decorate([lazy], OutputChunkImpl.prototype, "map", null);
2396
+ __decorate([nonEnumerable], OutputChunkImpl.prototype, "__rolldown_external_memory_handle__", null);
2397
+
2398
+ //#endregion
2399
+ //#region src/types/sourcemap.ts
2400
+ function bindingifySourcemap$1(map) {
2401
+ if (map == null) return;
2402
+ return { inner: typeof map === "string" ? map : {
2403
+ file: map.file ?? void 0,
2404
+ mappings: map.mappings,
2405
+ sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
2406
+ sources: map.sources?.map((s) => s ?? void 0),
2407
+ sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
2408
+ names: map.names,
2409
+ x_google_ignoreList: map.x_google_ignoreList,
2410
+ debugId: "debugId" in map ? map.debugId : void 0
2411
+ } };
2412
+ }
2413
+
2228
2414
  //#endregion
2229
2415
  //#region src/utils/transform-to-rollup-output.ts
2230
2416
  function transformToRollupSourceMap(map) {
@@ -2240,78 +2426,38 @@ function transformToRollupSourceMap(map) {
2240
2426
  return obj;
2241
2427
  }
2242
2428
  function transformToRollupOutputChunk(bindingChunk) {
2243
- const chunk = {
2244
- type: "chunk",
2245
- get code() {
2246
- return bindingChunk.code;
2247
- },
2248
- fileName: bindingChunk.fileName,
2249
- name: bindingChunk.name,
2250
- get modules() {
2251
- return transformChunkModules(bindingChunk.modules);
2252
- },
2253
- get imports() {
2254
- return bindingChunk.imports;
2255
- },
2256
- get dynamicImports() {
2257
- return bindingChunk.dynamicImports;
2258
- },
2259
- exports: bindingChunk.exports,
2260
- isEntry: bindingChunk.isEntry,
2261
- facadeModuleId: bindingChunk.facadeModuleId || null,
2262
- isDynamicEntry: bindingChunk.isDynamicEntry,
2263
- get moduleIds() {
2264
- return bindingChunk.moduleIds;
2265
- },
2266
- get map() {
2267
- return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
2268
- },
2269
- sourcemapFileName: bindingChunk.sourcemapFileName || null,
2270
- preliminaryFileName: bindingChunk.preliminaryFileName
2271
- };
2272
- const cache = {};
2273
- return new Proxy(chunk, {
2274
- get(target, p) {
2275
- if (p in cache) return cache[p];
2276
- const value = target[p];
2277
- cache[p] = value;
2278
- return value;
2279
- },
2280
- has(target, p) {
2281
- if (p in cache) return true;
2282
- return p in target;
2283
- }
2284
- });
2429
+ return new OutputChunkImpl(bindingChunk);
2285
2430
  }
2286
2431
  function transformToMutableRollupOutputChunk(bindingChunk, changed) {
2287
2432
  const chunk = {
2288
2433
  type: "chunk",
2289
2434
  get code() {
2290
- return bindingChunk.code;
2435
+ return bindingChunk.getCode();
2291
2436
  },
2292
- fileName: bindingChunk.fileName,
2293
- name: bindingChunk.name,
2437
+ fileName: bindingChunk.getFileName(),
2438
+ name: bindingChunk.getName(),
2294
2439
  get modules() {
2295
- return transformChunkModules(bindingChunk.modules);
2440
+ return transformChunkModules(bindingChunk.getModules());
2296
2441
  },
2297
2442
  get imports() {
2298
- return bindingChunk.imports;
2443
+ return bindingChunk.getImports();
2299
2444
  },
2300
2445
  get dynamicImports() {
2301
- return bindingChunk.dynamicImports;
2446
+ return bindingChunk.getDynamicImports();
2302
2447
  },
2303
- exports: bindingChunk.exports,
2304
- isEntry: bindingChunk.isEntry,
2305
- facadeModuleId: bindingChunk.facadeModuleId || null,
2306
- isDynamicEntry: bindingChunk.isDynamicEntry,
2448
+ exports: bindingChunk.getExports(),
2449
+ isEntry: bindingChunk.getIsEntry(),
2450
+ facadeModuleId: bindingChunk.getFacadeModuleId() || null,
2451
+ isDynamicEntry: bindingChunk.getIsDynamicEntry(),
2307
2452
  get moduleIds() {
2308
- return bindingChunk.moduleIds;
2453
+ return bindingChunk.getModuleIds();
2309
2454
  },
2310
2455
  get map() {
2311
- return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
2456
+ const map = bindingChunk.getMap();
2457
+ return map ? transformToRollupSourceMap(map) : null;
2312
2458
  },
2313
- sourcemapFileName: bindingChunk.sourcemapFileName || null,
2314
- preliminaryFileName: bindingChunk.preliminaryFileName
2459
+ sourcemapFileName: bindingChunk.getSourcemapFileName() || null,
2460
+ preliminaryFileName: bindingChunk.getPreliminaryFileName()
2315
2461
  };
2316
2462
  const cache = {};
2317
2463
  return new Proxy(chunk, {
@@ -2323,7 +2469,7 @@ function transformToMutableRollupOutputChunk(bindingChunk, changed) {
2323
2469
  },
2324
2470
  set(_target, p, newValue) {
2325
2471
  cache[p] = newValue;
2326
- changed.updated.add(bindingChunk.fileName);
2472
+ changed.updated.add(bindingChunk.getFileName());
2327
2473
  return true;
2328
2474
  },
2329
2475
  has(target, p) {
@@ -2333,36 +2479,19 @@ function transformToMutableRollupOutputChunk(bindingChunk, changed) {
2333
2479
  });
2334
2480
  }
2335
2481
  function transformToRollupOutputAsset(bindingAsset) {
2336
- const asset = {
2337
- type: "asset",
2338
- fileName: bindingAsset.fileName,
2339
- originalFileName: bindingAsset.originalFileName || null,
2340
- originalFileNames: bindingAsset.originalFileNames,
2341
- get source() {
2342
- return transformAssetSource(bindingAsset.source);
2343
- },
2344
- name: bindingAsset.name ?? void 0,
2345
- names: bindingAsset.names
2346
- };
2347
- const cache = {};
2348
- return new Proxy(asset, { get(target, p) {
2349
- if (p in cache) return cache[p];
2350
- const value = target[p];
2351
- cache[p] = value;
2352
- return value;
2353
- } });
2482
+ return new OutputAssetImpl(bindingAsset);
2354
2483
  }
2355
2484
  function transformToMutableRollupOutputAsset(bindingAsset, changed) {
2356
2485
  const asset = {
2357
2486
  type: "asset",
2358
- fileName: bindingAsset.fileName,
2359
- originalFileName: bindingAsset.originalFileName || null,
2360
- originalFileNames: bindingAsset.originalFileNames,
2487
+ fileName: bindingAsset.getFileName(),
2488
+ originalFileName: bindingAsset.getOriginalFileName() || null,
2489
+ originalFileNames: bindingAsset.getOriginalFileNames(),
2361
2490
  get source() {
2362
- return transformAssetSource(bindingAsset.source);
2491
+ return transformAssetSource(bindingAsset.getSource());
2363
2492
  },
2364
- name: bindingAsset.name ?? void 0,
2365
- names: bindingAsset.names
2493
+ name: bindingAsset.getName() ?? void 0,
2494
+ names: bindingAsset.getNames()
2366
2495
  };
2367
2496
  const cache = {};
2368
2497
  return new Proxy(asset, {
@@ -2374,7 +2503,7 @@ function transformToMutableRollupOutputAsset(bindingAsset, changed) {
2374
2503
  },
2375
2504
  set(_target, p, newValue) {
2376
2505
  cache[p] = newValue;
2377
- changed.updated.add(bindingAsset.fileName);
2506
+ changed.updated.add(bindingAsset.getFileName());
2378
2507
  return true;
2379
2508
  }
2380
2509
  });
@@ -2451,7 +2580,20 @@ var RolldownOutputImpl = class {
2451
2580
  get output() {
2452
2581
  return transformToRollupOutput(this.bindingOutputs).output;
2453
2582
  }
2583
+ __rolldown_external_memory_handle__(keepDataAlive) {
2584
+ const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
2585
+ if (!results.every((r) => r.freed)) {
2586
+ const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
2587
+ return {
2588
+ freed: false,
2589
+ reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
2590
+ };
2591
+ }
2592
+ return { freed: true };
2593
+ }
2454
2594
  };
2595
+ __decorate([lazy], RolldownOutputImpl.prototype, "output", null);
2596
+ __decorate([nonEnumerable], RolldownOutputImpl.prototype, "__rolldown_external_memory_handle__", null);
2455
2597
 
2456
2598
  //#endregion
2457
2599
  //#region src/utils/error.ts
@@ -2720,13 +2862,14 @@ function bindingifyRenderChunkFilter(filterOption) {
2720
2862
 
2721
2863
  //#endregion
2722
2864
  //#region src/plugin/bindingify-plugin-hook-meta.ts
2865
+ var import_binding$6 = /* @__PURE__ */ __toESM(require_binding(), 1);
2723
2866
  function bindingifyPluginHookMeta(options) {
2724
2867
  return { order: bindingPluginOrder(options.order) };
2725
2868
  }
2726
2869
  function bindingPluginOrder(order) {
2727
2870
  switch (order) {
2728
- case "post": return BindingPluginOrder.Post;
2729
- case "pre": return BindingPluginOrder.Pre;
2871
+ case "post": return import_binding$6.BindingPluginOrder.Post;
2872
+ case "pre": return import_binding$6.BindingPluginOrder.Pre;
2730
2873
  case null:
2731
2874
  case void 0: return;
2732
2875
  default: throw new Error(`Unknown plugin order: ${order}`);
@@ -2887,6 +3030,7 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2887
3030
 
2888
3031
  //#endregion
2889
3032
  //#region src/plugin/bindingify-build-hooks.ts
3033
+ var import_binding$5 = /* @__PURE__ */ __toESM(require_binding(), 1);
2890
3034
  function bindingifyBuildStart(args$1) {
2891
3035
  const hook = args$1.plugin.buildStart;
2892
3036
  if (!hook) return {};
@@ -2984,7 +3128,7 @@ function bindingifyTransform(args$1) {
2984
3128
  plugin: async (ctx, code$1, id$1, meta$1) => {
2985
3129
  Object.defineProperties(meta$1, {
2986
3130
  magicString: { get() {
2987
- return new BindingMagicString(code$1);
3131
+ return new import_binding$5.BindingMagicString(code$1);
2988
3132
  } },
2989
3133
  ast: { get() {
2990
3134
  let lang = "js";
@@ -3015,7 +3159,7 @@ function bindingifyTransform(args$1) {
3015
3159
  let normalizedCode = void 0;
3016
3160
  let map = ret.map;
3017
3161
  if (typeof ret.code === "string") normalizedCode = ret.code;
3018
- else if (ret.code instanceof BindingMagicString) {
3162
+ else if (ret.code instanceof import_binding$5.BindingMagicString) {
3019
3163
  let magicString = ret.code;
3020
3164
  normalizedCode = magicString.toString();
3021
3165
  let fallbackSourcemap = ctx.sendMagicString(magicString);
@@ -3744,6 +3888,7 @@ function normalizeTransformOptions(inputOptions, onLog) {
3744
3888
 
3745
3889
  //#endregion
3746
3890
  //#region src/utils/bindingify-input-options.ts
3891
+ var import_binding$4 = /* @__PURE__ */ __toESM(require_binding(), 1);
3747
3892
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3748
3893
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
3749
3894
  const plugins = rawPlugins.map((plugin) => {
@@ -3813,9 +3958,9 @@ function bindingifyHmr(hmr) {
3813
3958
  function bindingifyAttachDebugInfo(attachDebugInfo) {
3814
3959
  switch (attachDebugInfo) {
3815
3960
  case void 0: return;
3816
- case "full": return BindingAttachDebugInfo.Full;
3817
- case "simple": return BindingAttachDebugInfo.Simple;
3818
- case "none": return BindingAttachDebugInfo.None;
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;
3819
3964
  }
3820
3965
  }
3821
3966
  function bindingifyExternal(external) {
@@ -3828,13 +3973,13 @@ function bindingifyExternal(external) {
3828
3973
  }
3829
3974
  }
3830
3975
  function bindingifyExperimental(experimental) {
3831
- let chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3976
+ let chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3832
3977
  if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
3833
3978
  case "exec-order":
3834
- chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3979
+ chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3835
3980
  break;
3836
3981
  case "module-id":
3837
- chunkModulesOrder = BindingChunkModuleOrderBy.ModuleId;
3982
+ chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ModuleId;
3838
3983
  break;
3839
3984
  default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
3840
3985
  }
@@ -3894,10 +4039,10 @@ function bindingifyInject(inject) {
3894
4039
  }
3895
4040
  function bindingifyLogLevel(logLevel) {
3896
4041
  switch (logLevel) {
3897
- case "silent": return BindingLogLevel.Silent;
3898
- case "debug": return BindingLogLevel.Debug;
3899
- case "warn": return BindingLogLevel.Warn;
3900
- case "info": return BindingLogLevel.Info;
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;
3901
4046
  default: throw new Error(`Unexpected log level: ${logLevel}`);
3902
4047
  }
3903
4048
  }
@@ -3933,19 +4078,19 @@ function bindingifyTreeshakeOptions(config) {
3933
4078
  };
3934
4079
  switch (config.propertyReadSideEffects) {
3935
4080
  case "always":
3936
- normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
4081
+ normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.Always;
3937
4082
  break;
3938
4083
  case false:
3939
- normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
4084
+ normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.False;
3940
4085
  break;
3941
4086
  default:
3942
4087
  }
3943
4088
  switch (config.propertyWriteSideEffects) {
3944
4089
  case "always":
3945
- normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
4090
+ normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.Always;
3946
4091
  break;
3947
4092
  case false:
3948
- normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
4093
+ normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.False;
3949
4094
  break;
3950
4095
  default:
3951
4096
  }
@@ -4105,6 +4250,7 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
4105
4250
 
4106
4251
  //#endregion
4107
4252
  //#region src/utils/initialize-parallel-plugins.ts
4253
+ var import_binding$3 = /* @__PURE__ */ __toESM(require_binding(), 1);
4108
4254
  async function initializeParallelPlugins(plugins) {
4109
4255
  const pluginInfos = [];
4110
4256
  for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
@@ -4117,7 +4263,7 @@ async function initializeParallelPlugins(plugins) {
4117
4263
  }
4118
4264
  if (pluginInfos.length <= 0) return;
4119
4265
  const count = availableParallelism();
4120
- const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
4266
+ const parallelJsPluginRegistry = new import_binding$3.ParallelJsPluginRegistry(count);
4121
4267
  const registryId = parallelJsPluginRegistry.id;
4122
4268
  const workers = await initializeWorkers(registryId, count, pluginInfos);
4123
4269
  const stopWorkers = async () => {
@@ -4195,6 +4341,7 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
4195
4341
 
4196
4342
  //#endregion
4197
4343
  //#region src/api/rolldown/rolldown-build.ts
4344
+ var import_binding$2 = /* @__PURE__ */ __toESM(require_binding());
4198
4345
  Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4199
4346
  var RolldownBuild = class RolldownBuild {
4200
4347
  #inputOptions;
@@ -4203,7 +4350,7 @@ var RolldownBuild = class RolldownBuild {
4203
4350
  static asyncRuntimeShutdown = false;
4204
4351
  constructor(inputOptions) {
4205
4352
  this.#inputOptions = inputOptions;
4206
- this.#bundler = new BindingBundler();
4353
+ this.#bundler = new import_binding$2.BindingBundler();
4207
4354
  }
4208
4355
  get closed() {
4209
4356
  return this.#bundlerImpl?.impl.closed ?? true;
@@ -4211,13 +4358,13 @@ var RolldownBuild = class RolldownBuild {
4211
4358
  async #getBundlerWithStopWorker(outputOptions) {
4212
4359
  if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
4213
4360
  const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
4214
- if (RolldownBuild.asyncRuntimeShutdown) startAsyncRuntime();
4361
+ if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding$2.startAsyncRuntime)();
4215
4362
  try {
4216
4363
  return this.#bundlerImpl = {
4217
4364
  impl: this.#bundler.createImpl(option.bundlerOptions),
4218
4365
  stopWorkers: option.stopWorkers,
4219
4366
  shutdown: () => {
4220
- shutdownAsyncRuntime();
4367
+ (0, import_binding$2.shutdownAsyncRuntime)();
4221
4368
  RolldownBuild.asyncRuntimeShutdown = true;
4222
4369
  }
4223
4370
  };
@@ -4240,6 +4387,9 @@ var RolldownBuild = class RolldownBuild {
4240
4387
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4241
4388
  return new RolldownOutputImpl(unwrapBindingResult(await impl.write()));
4242
4389
  }
4390
+ /**
4391
+ * Close the build and free resources.
4392
+ */
4243
4393
  async close() {
4244
4394
  if (this.#bundlerImpl) {
4245
4395
  await this.#bundlerImpl.stopWorkers?.();
@@ -4354,6 +4504,7 @@ var WatcherEmitter = class {
4354
4504
 
4355
4505
  //#endregion
4356
4506
  //#region src/api/watch/watcher.ts
4507
+ var import_binding$1 = /* @__PURE__ */ __toESM(require_binding(), 1);
4357
4508
  var Watcher = class {
4358
4509
  closed;
4359
4510
  inner;
@@ -4375,7 +4526,7 @@ var Watcher = class {
4375
4526
  this.closed = true;
4376
4527
  for (const stop of this.stopWorkers) await stop?.();
4377
4528
  await this.inner.close();
4378
- shutdownAsyncRuntime();
4529
+ (0, import_binding$1.shutdownAsyncRuntime)();
4379
4530
  }
4380
4531
  start() {
4381
4532
  process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
@@ -4387,7 +4538,7 @@ async function createWatcher(emitter, input) {
4387
4538
  return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
4388
4539
  })).flat());
4389
4540
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4390
- new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
4541
+ new Watcher(emitter, new import_binding$1.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
4391
4542
  }
4392
4543
  function getValidNotifyOption(bundlerOptions) {
4393
4544
  let result;
@@ -4416,7 +4567,8 @@ function defineConfig(config) {
4416
4567
 
4417
4568
  //#endregion
4418
4569
  //#region src/index.ts
4570
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
4419
4571
  const VERSION = version;
4420
4572
 
4421
4573
  //#endregion
4422
- 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 };
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 };