rolldown 1.0.0-beta.44 → 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,5 +1,5 @@
1
- import { C as startAsyncRuntime, S as shutdownAsyncRuntime, c as BindingPluginOrder, f as BindingWatcher, g as initTraceSubscriber, i as BindingChunkModuleOrderBy, l as BindingPropertyReadSideEffects, n as BindingBundler, o as BindingLogLevel, p as ParallelJsPluginRegistry, r as BindingCallableBuiltinPlugin, s as BindingMagicString, t as BindingAttachDebugInfo, u as BindingPropertyWriteSideEffects } from "./binding-DkR1uPxc.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-Dee9Dv5S.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-DOZoR4bu.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-oPgrkdqc.mjs";
3
3
  import { a as unreachable, i as unimplemented, o as unsupported, r as noop, t as arraify } from "./misc-usdOVIou.mjs";
4
4
  import { Worker, isMainThread } from "node:worker_threads";
5
5
  import path from "node:path";
@@ -209,8 +209,9 @@ const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new Signa
209
209
 
210
210
  //#endregion
211
211
  //#region src/setup.ts
212
+ var import_binding$8 = /* @__PURE__ */ __toESM(require_binding(), 1);
212
213
  if (isMainThread) {
213
- const subscriberGuard = initTraceSubscriber();
214
+ const subscriberGuard = (0, import_binding$8.initTraceSubscriber)();
214
215
  onExit(() => {
215
216
  subscriberGuard?.close();
216
217
  });
@@ -218,11 +219,12 @@ if (isMainThread) {
218
219
 
219
220
  //#endregion
220
221
  //#region package.json
221
- var version = "1.0.0-beta.44";
222
+ var version = "1.0.0-beta.46";
222
223
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
223
224
 
224
225
  //#endregion
225
226
  //#region src/builtin-plugin/utils.ts
227
+ var import_binding$7 = /* @__PURE__ */ __toESM(require_binding(), 1);
226
228
  var BuiltinPlugin = class {
227
229
  constructor(name, _options) {
228
230
  this.name = name;
@@ -230,7 +232,7 @@ var BuiltinPlugin = class {
230
232
  }
231
233
  };
232
234
  function makeBuiltinPluginCallable(plugin) {
233
- let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
235
+ let callablePlugin = new import_binding$7.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
234
236
  const wrappedPlugin = plugin;
235
237
  for (const key in callablePlugin) wrappedPlugin[key] = async function(...args$1) {
236
238
  try {
@@ -1382,6 +1384,25 @@ function tuple(items, message2) {
1382
1384
  };
1383
1385
  }
1384
1386
  /* @__NO_SIDE_EFFECTS__ */
1387
+ function undefined_(message2) {
1388
+ return {
1389
+ kind: "schema",
1390
+ type: "undefined",
1391
+ reference: undefined_,
1392
+ expects: "undefined",
1393
+ async: false,
1394
+ message: message2,
1395
+ get "~standard"() {
1396
+ return /* @__PURE__ */ _getStandardProps(this);
1397
+ },
1398
+ "~run"(dataset, config2) {
1399
+ if (dataset.value === void 0) dataset.typed = true;
1400
+ else _addIssue(this, "type", dataset, config2);
1401
+ return dataset;
1402
+ }
1403
+ };
1404
+ }
1405
+ /* @__NO_SIDE_EFFECTS__ */
1385
1406
  function _subIssues(datasets) {
1386
1407
  let issues;
1387
1408
  if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
@@ -1633,6 +1654,9 @@ function flattenValibotSchema(schema, result = {}, prefix = "") {
1633
1654
  //#endregion
1634
1655
  //#region src/utils/validator.ts
1635
1656
  const StringOrRegExpSchema = union([string(), instance(RegExp)]);
1657
+ function vFunction() {
1658
+ return function_();
1659
+ }
1636
1660
  const LogLevelSchema = union([
1637
1661
  literal("debug"),
1638
1662
  literal("info"),
@@ -1647,14 +1671,15 @@ const InputOptionSchema = union([
1647
1671
  array(string()),
1648
1672
  record(string(), string())
1649
1673
  ]);
1650
- const ExternalSchema = union([
1674
+ const ExternalOptionFunctionSchema = pipe(vFunction(), args(tuple([
1675
+ string(),
1676
+ optional(string()),
1677
+ boolean()
1678
+ ])), returns(nullish(boolean())));
1679
+ const ExternalOptionSchema = union([
1651
1680
  StringOrRegExpSchema,
1652
1681
  array(StringOrRegExpSchema),
1653
- pipe(function_(), args(tuple([
1654
- string(),
1655
- optional(string()),
1656
- boolean()
1657
- ])), returns(nullish(boolean())))
1682
+ ExternalOptionFunctionSchema
1658
1683
  ]);
1659
1684
  const ModuleTypesSchema = record(string(), union([
1660
1685
  literal("asset"),
@@ -1673,7 +1698,7 @@ const ModuleTypesSchema = record(string(), union([
1673
1698
  const JsxOptionsSchema = strictObject({
1674
1699
  runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
1675
1700
  development: pipe(optional(boolean()), description("Development specific information")),
1676
- throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
1701
+ throwIfNamespace: pipe(optional(boolean()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
1677
1702
  importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
1678
1703
  pragma: pipe(optional(string()), description("Jsx element transformation")),
1679
1704
  pragmaFrag: pipe(optional(string()), description("Jsx fragment transformation")),
@@ -1714,7 +1739,13 @@ const TransformOptionsSchema = object({
1714
1739
  typescript: optional(TypescriptSchema),
1715
1740
  helpers: optional(HelpersSchema),
1716
1741
  decorators: optional(DecoratorOptionSchema),
1717
- jsx: optional(union([literal("preserve"), JsxOptionsSchema])),
1742
+ jsx: optional(union([
1743
+ literal(false),
1744
+ literal("preserve"),
1745
+ literal("react"),
1746
+ literal("react-jsx"),
1747
+ JsxOptionsSchema
1748
+ ])),
1718
1749
  target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment")),
1719
1750
  define: optional(record(string(), string())),
1720
1751
  inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
@@ -1749,8 +1780,8 @@ const ChecksOptionsSchema = strictObject({
1749
1780
  preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
1750
1781
  });
1751
1782
  const CompressOptionsKeepNamesSchema = strictObject({
1752
- function: optional(boolean()),
1753
- class: optional(boolean())
1783
+ function: boolean(),
1784
+ class: boolean()
1754
1785
  });
1755
1786
  const CompressOptionsSchema = strictObject({
1756
1787
  target: optional(union([
@@ -1772,8 +1803,8 @@ const CompressOptionsSchema = strictObject({
1772
1803
  unused: optional(union([boolean(), literal("keep_assign")]))
1773
1804
  });
1774
1805
  const MangleOptionsKeepNamesSchema = strictObject({
1775
- function: optional(boolean()),
1776
- class: optional(boolean())
1806
+ function: boolean(),
1807
+ class: boolean()
1777
1808
  });
1778
1809
  const MangleOptionsSchema = strictObject({
1779
1810
  toplevel: optional(boolean()),
@@ -1812,22 +1843,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
1812
1843
  propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
1813
1844
  })]);
1814
1845
  const OptimizationOptionsSchema = strictObject({
1815
- inlineConst: pipe(optional(union([
1816
- boolean(),
1817
- literal("smart"),
1818
- strictObject({
1819
- mode: optional(union([literal("all"), literal("smart")])),
1820
- pass: optional(number())
1821
- })
1822
- ])), description("Enable crossmodule constant inlining")),
1846
+ inlineConst: pipe(optional(union([boolean(), strictObject({
1847
+ mode: optional(union([literal("all"), literal("smart")])),
1848
+ pass: optional(number())
1849
+ })])), description("Enable crossmodule constant inlining")),
1823
1850
  pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
1824
1851
  });
1825
- const OnLogSchema = pipe(function_(), args(tuple([
1852
+ const LogOrStringHandlerSchema = pipe(vFunction(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])));
1853
+ const OnLogSchema = pipe(vFunction(), args(tuple([
1826
1854
  LogLevelSchema,
1827
1855
  RollupLogSchema,
1828
- pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
1856
+ LogOrStringHandlerSchema
1829
1857
  ])));
1830
- const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
1858
+ const OnwarnSchema = pipe(vFunction(), args(tuple([RollupLogSchema, pipe(vFunction(), args(tuple([union([RollupLogWithStringSchema, pipe(vFunction(), returns(RollupLogWithStringSchema))])])))])));
1831
1859
  const HmrSchema = union([boolean(), strictObject({
1832
1860
  new: optional(boolean()),
1833
1861
  port: optional(number()),
@@ -1837,7 +1865,7 @@ const HmrSchema = union([boolean(), strictObject({
1837
1865
  const InputOptionsSchema = strictObject({
1838
1866
  input: optional(InputOptionSchema),
1839
1867
  plugins: optional(custom(() => true)),
1840
- external: optional(ExternalSchema),
1868
+ external: optional(ExternalOptionSchema),
1841
1869
  makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
1842
1870
  resolve: optional(ResolveOptionsSchema),
1843
1871
  cwd: pipe(optional(string()), description("Current working directory")),
@@ -1921,12 +1949,22 @@ const ModuleFormatSchema = union([
1921
1949
  literal("iife"),
1922
1950
  literal("umd")
1923
1951
  ]);
1924
- const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
1925
- const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1926
- const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1927
- const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
1928
- const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
1929
- const PathsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
1952
+ const AddonFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
1953
+ const ChunkFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
1954
+ const ChunkFileNamesSchema = union([string(), ChunkFileNamesFunctionSchema]);
1955
+ const AssetFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
1956
+ const AssetFileNamesSchema = union([string(), AssetFileNamesFunctionSchema]);
1957
+ const SanitizeFileNameFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
1958
+ const SanitizeFileNameSchema = union([boolean(), SanitizeFileNameFunctionSchema]);
1959
+ const GlobalsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
1960
+ const PathsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
1961
+ const ManualChunksFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
1962
+ const AdvancedChunksNameFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
1963
+ const AdvancedChunksTestFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(union([
1964
+ boolean(),
1965
+ void_(),
1966
+ undefined_()
1967
+ ])));
1930
1968
  const AdvancedChunksSchema = strictObject({
1931
1969
  includeDependenciesRecursively: optional(boolean()),
1932
1970
  minSize: optional(number()),
@@ -1935,12 +1973,8 @@ const AdvancedChunksSchema = strictObject({
1935
1973
  maxModuleSize: optional(number()),
1936
1974
  minShareCount: optional(number()),
1937
1975
  groups: optional(array(strictObject({
1938
- name: union([string(), pipe(function_(), args(tuple([string()])), returns(nullish(string())))]),
1939
- test: optional(union([
1940
- string(),
1941
- instance(RegExp),
1942
- pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
1943
- ])),
1976
+ name: union([string(), AdvancedChunksNameFunctionSchema]),
1977
+ test: optional(union([StringOrRegExpSchema, AdvancedChunksTestFunctionSchema])),
1944
1978
  priority: optional(number()),
1945
1979
  minSize: optional(number()),
1946
1980
  minShareCount: optional(number()),
@@ -1997,7 +2031,7 @@ const OutputOptionsSchema = strictObject({
1997
2031
  sanitizeFileName: optional(SanitizeFileNameSchema),
1998
2032
  minify: pipe(optional(union([
1999
2033
  boolean(),
2000
- string("dce-only"),
2034
+ literal("dce-only"),
2001
2035
  MinifyOptionsSchema
2002
2036
  ])), description("Minify the bundled file")),
2003
2037
  name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
@@ -2006,15 +2040,12 @@ const OutputOptionsSchema = strictObject({
2006
2040
  generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
2007
2041
  externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2008
2042
  inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2009
- manualChunks: optional(pipe(function_(), args(tuple([string(), object({})])), returns(union([string(), nullish(string())])))),
2043
+ manualChunks: optional(ManualChunksFunctionSchema),
2010
2044
  advancedChunks: optional(AdvancedChunksSchema),
2011
2045
  legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
2012
2046
  plugins: optional(custom(() => true)),
2013
2047
  polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
2014
- hoistTransitiveImports: optional(custom((input) => {
2015
- if (input) return false;
2016
- return true;
2017
- }, () => `The 'true' value is not supported`)),
2048
+ hoistTransitiveImports: optional(literal(false)),
2018
2049
  preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
2019
2050
  preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
2020
2051
  virtualDirname: optional(string()),
@@ -2107,6 +2138,264 @@ function getCliSchemaInfo() {
2107
2138
  return flattenValibotSchema(CliOptionsSchema);
2108
2139
  }
2109
2140
 
2141
+ //#endregion
2142
+ //#region src/decorators/lazy.ts
2143
+ const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
2144
+ const LAZY_CACHE_PREFIX = "__cached_";
2145
+ /**
2146
+ * Legacy decorator that makes a getter lazy-evaluated and cached.
2147
+ * Also auto-registers the field for batch prefetching.
2148
+ *
2149
+ * @example
2150
+ * ```typescript
2151
+ * class MyClass {
2152
+ * @lazy
2153
+ * get expensiveValue() {
2154
+ * return someExpensiveComputation();
2155
+ * }
2156
+ * }
2157
+ * ```
2158
+ */
2159
+ function lazy(target, propertyKey, descriptor) {
2160
+ if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Set();
2161
+ target.constructor[LAZY_FIELDS_KEY].add(propertyKey);
2162
+ const originalGetter = descriptor.get;
2163
+ const cacheKey = LAZY_CACHE_PREFIX + propertyKey;
2164
+ descriptor.get = function() {
2165
+ if (!(cacheKey in this)) this[cacheKey] = originalGetter.call(this);
2166
+ return this[cacheKey];
2167
+ };
2168
+ return descriptor;
2169
+ }
2170
+ /**
2171
+ * Get all lazy field names from a class instance.
2172
+ *
2173
+ * @param instance - Instance to inspect
2174
+ * @returns Set of lazy property names
2175
+ */
2176
+ function getLazyFields(instance$1) {
2177
+ return instance$1.constructor[LAZY_FIELDS_KEY] || /* @__PURE__ */ new Set();
2178
+ }
2179
+
2180
+ //#endregion
2181
+ //#region src/decorators/non-enumerable.ts
2182
+ /**
2183
+ * Decorator that makes a property or method non-enumerable.
2184
+ * This hides the property from enumeration (e.g., Object.keys(), for...in loops).
2185
+ *
2186
+ * @example
2187
+ * ```typescript
2188
+ * class MyClass {
2189
+ * @nonEnumerable
2190
+ * hiddenMethod() {
2191
+ * return 'This method will not show up in Object.keys()';
2192
+ * }
2193
+ * }
2194
+ * ```
2195
+ */
2196
+ function nonEnumerable(target, propertyKey, descriptor) {
2197
+ descriptor.enumerable = false;
2198
+ return descriptor;
2199
+ }
2200
+
2201
+ //#endregion
2202
+ //#region src/utils/asset-source.ts
2203
+ function transformAssetSource(bindingAssetSource$1) {
2204
+ return bindingAssetSource$1.inner;
2205
+ }
2206
+ function bindingAssetSource(source) {
2207
+ return { inner: source };
2208
+ }
2209
+
2210
+ //#endregion
2211
+ //#region \0@oxc-project+runtime@0.96.0/helpers/decorate.js
2212
+ function __decorate(decorators, target, key, desc) {
2213
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2214
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2215
+ 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;
2216
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2217
+ }
2218
+
2219
+ //#endregion
2220
+ //#region src/types/output-asset-impl.ts
2221
+ var OutputAssetImpl = class {
2222
+ type = "asset";
2223
+ constructor(bindingAsset) {
2224
+ this.bindingAsset = bindingAsset;
2225
+ }
2226
+ get fileName() {
2227
+ return this.bindingAsset.getFileName();
2228
+ }
2229
+ get originalFileName() {
2230
+ return this.bindingAsset.getOriginalFileName() || null;
2231
+ }
2232
+ get originalFileNames() {
2233
+ return this.bindingAsset.getOriginalFileNames();
2234
+ }
2235
+ get name() {
2236
+ return this.bindingAsset.getName() ?? void 0;
2237
+ }
2238
+ get names() {
2239
+ return this.bindingAsset.getNames();
2240
+ }
2241
+ get source() {
2242
+ return transformAssetSource(this.bindingAsset.getSource());
2243
+ }
2244
+ __rolldown_external_memory_handle__(keepDataAlive) {
2245
+ if (keepDataAlive) this.#evaluateAllLazyFields();
2246
+ return this.bindingAsset.dropInner();
2247
+ }
2248
+ #evaluateAllLazyFields() {
2249
+ for (const field of getLazyFields(this)) this[field];
2250
+ }
2251
+ };
2252
+ __decorate([lazy], OutputAssetImpl.prototype, "fileName", null);
2253
+ __decorate([lazy], OutputAssetImpl.prototype, "originalFileName", null);
2254
+ __decorate([lazy], OutputAssetImpl.prototype, "originalFileNames", null);
2255
+ __decorate([lazy], OutputAssetImpl.prototype, "name", null);
2256
+ __decorate([lazy], OutputAssetImpl.prototype, "names", null);
2257
+ __decorate([lazy], OutputAssetImpl.prototype, "source", null);
2258
+ __decorate([nonEnumerable], OutputAssetImpl.prototype, "__rolldown_external_memory_handle__", null);
2259
+
2260
+ //#endregion
2261
+ //#region src/utils/transform-rendered-module.ts
2262
+ function transformToRenderedModule(bindingRenderedModule) {
2263
+ return {
2264
+ get code() {
2265
+ return bindingRenderedModule.code;
2266
+ },
2267
+ get renderedLength() {
2268
+ return bindingRenderedModule.code?.length || 0;
2269
+ },
2270
+ get renderedExports() {
2271
+ return bindingRenderedModule.renderedExports;
2272
+ }
2273
+ };
2274
+ }
2275
+
2276
+ //#endregion
2277
+ //#region src/utils/transform-rendered-chunk.ts
2278
+ function transformRenderedChunk(chunk) {
2279
+ let modules = null;
2280
+ return {
2281
+ type: "chunk",
2282
+ get name() {
2283
+ return chunk.name;
2284
+ },
2285
+ get isEntry() {
2286
+ return chunk.isEntry;
2287
+ },
2288
+ get isDynamicEntry() {
2289
+ return chunk.isDynamicEntry;
2290
+ },
2291
+ get facadeModuleId() {
2292
+ return chunk.facadeModuleId;
2293
+ },
2294
+ get moduleIds() {
2295
+ return chunk.moduleIds;
2296
+ },
2297
+ get exports() {
2298
+ return chunk.exports;
2299
+ },
2300
+ get fileName() {
2301
+ return chunk.fileName;
2302
+ },
2303
+ get imports() {
2304
+ return chunk.imports;
2305
+ },
2306
+ get dynamicImports() {
2307
+ return chunk.dynamicImports;
2308
+ },
2309
+ get modules() {
2310
+ if (!modules) modules = transformChunkModules(chunk.modules);
2311
+ return modules;
2312
+ }
2313
+ };
2314
+ }
2315
+ function transformChunkModules(modules) {
2316
+ const result = {};
2317
+ for (let i = 0; i < modules.values.length; i++) {
2318
+ let key = modules.keys[i];
2319
+ const mod = modules.values[i];
2320
+ result[key] = transformToRenderedModule(mod);
2321
+ }
2322
+ return result;
2323
+ }
2324
+
2325
+ //#endregion
2326
+ //#region src/types/output-chunk-impl.ts
2327
+ var OutputChunkImpl = class {
2328
+ type = "chunk";
2329
+ constructor(bindingChunk) {
2330
+ this.bindingChunk = bindingChunk;
2331
+ }
2332
+ get fileName() {
2333
+ return this.bindingChunk.getFileName();
2334
+ }
2335
+ get name() {
2336
+ return this.bindingChunk.getName();
2337
+ }
2338
+ get exports() {
2339
+ return this.bindingChunk.getExports();
2340
+ }
2341
+ get isEntry() {
2342
+ return this.bindingChunk.getIsEntry();
2343
+ }
2344
+ get facadeModuleId() {
2345
+ return this.bindingChunk.getFacadeModuleId() || null;
2346
+ }
2347
+ get isDynamicEntry() {
2348
+ return this.bindingChunk.getIsDynamicEntry();
2349
+ }
2350
+ get sourcemapFileName() {
2351
+ return this.bindingChunk.getSourcemapFileName() || null;
2352
+ }
2353
+ get preliminaryFileName() {
2354
+ return this.bindingChunk.getPreliminaryFileName();
2355
+ }
2356
+ get code() {
2357
+ return this.bindingChunk.getCode();
2358
+ }
2359
+ get modules() {
2360
+ return transformChunkModules(this.bindingChunk.getModules());
2361
+ }
2362
+ get imports() {
2363
+ return this.bindingChunk.getImports();
2364
+ }
2365
+ get dynamicImports() {
2366
+ return this.bindingChunk.getDynamicImports();
2367
+ }
2368
+ get moduleIds() {
2369
+ return this.bindingChunk.getModuleIds();
2370
+ }
2371
+ get map() {
2372
+ const mapString = this.bindingChunk.getMap();
2373
+ return mapString ? transformToRollupSourceMap(mapString) : null;
2374
+ }
2375
+ __rolldown_external_memory_handle__(keepDataAlive) {
2376
+ if (keepDataAlive) this.#evaluateAllLazyFields();
2377
+ return this.bindingChunk.dropInner();
2378
+ }
2379
+ #evaluateAllLazyFields() {
2380
+ for (const field of getLazyFields(this)) this[field];
2381
+ }
2382
+ };
2383
+ __decorate([lazy], OutputChunkImpl.prototype, "fileName", null);
2384
+ __decorate([lazy], OutputChunkImpl.prototype, "name", null);
2385
+ __decorate([lazy], OutputChunkImpl.prototype, "exports", null);
2386
+ __decorate([lazy], OutputChunkImpl.prototype, "isEntry", null);
2387
+ __decorate([lazy], OutputChunkImpl.prototype, "facadeModuleId", null);
2388
+ __decorate([lazy], OutputChunkImpl.prototype, "isDynamicEntry", null);
2389
+ __decorate([lazy], OutputChunkImpl.prototype, "sourcemapFileName", null);
2390
+ __decorate([lazy], OutputChunkImpl.prototype, "preliminaryFileName", null);
2391
+ __decorate([lazy], OutputChunkImpl.prototype, "code", null);
2392
+ __decorate([lazy], OutputChunkImpl.prototype, "modules", null);
2393
+ __decorate([lazy], OutputChunkImpl.prototype, "imports", null);
2394
+ __decorate([lazy], OutputChunkImpl.prototype, "dynamicImports", null);
2395
+ __decorate([lazy], OutputChunkImpl.prototype, "moduleIds", null);
2396
+ __decorate([lazy], OutputChunkImpl.prototype, "map", null);
2397
+ __decorate([nonEnumerable], OutputChunkImpl.prototype, "__rolldown_external_memory_handle__", null);
2398
+
2110
2399
  //#endregion
2111
2400
  //#region src/types/sourcemap.ts
2112
2401
  function bindingifySourcemap$1(map) {
@@ -2123,6 +2412,190 @@ function bindingifySourcemap$1(map) {
2123
2412
  } };
2124
2413
  }
2125
2414
 
2415
+ //#endregion
2416
+ //#region src/utils/transform-to-rollup-output.ts
2417
+ function transformToRollupSourceMap(map) {
2418
+ const obj = {
2419
+ ...JSON.parse(map),
2420
+ toString() {
2421
+ return JSON.stringify(obj);
2422
+ },
2423
+ toUrl() {
2424
+ return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
2425
+ }
2426
+ };
2427
+ return obj;
2428
+ }
2429
+ function transformToRollupOutputChunk(bindingChunk) {
2430
+ return new OutputChunkImpl(bindingChunk);
2431
+ }
2432
+ function transformToMutableRollupOutputChunk(bindingChunk, changed) {
2433
+ const chunk = {
2434
+ type: "chunk",
2435
+ get code() {
2436
+ return bindingChunk.getCode();
2437
+ },
2438
+ fileName: bindingChunk.getFileName(),
2439
+ name: bindingChunk.getName(),
2440
+ get modules() {
2441
+ return transformChunkModules(bindingChunk.getModules());
2442
+ },
2443
+ get imports() {
2444
+ return bindingChunk.getImports();
2445
+ },
2446
+ get dynamicImports() {
2447
+ return bindingChunk.getDynamicImports();
2448
+ },
2449
+ exports: bindingChunk.getExports(),
2450
+ isEntry: bindingChunk.getIsEntry(),
2451
+ facadeModuleId: bindingChunk.getFacadeModuleId() || null,
2452
+ isDynamicEntry: bindingChunk.getIsDynamicEntry(),
2453
+ get moduleIds() {
2454
+ return bindingChunk.getModuleIds();
2455
+ },
2456
+ get map() {
2457
+ const map = bindingChunk.getMap();
2458
+ return map ? transformToRollupSourceMap(map) : null;
2459
+ },
2460
+ sourcemapFileName: bindingChunk.getSourcemapFileName() || null,
2461
+ preliminaryFileName: bindingChunk.getPreliminaryFileName()
2462
+ };
2463
+ const cache = {};
2464
+ return new Proxy(chunk, {
2465
+ get(target, p) {
2466
+ if (p in cache) return cache[p];
2467
+ const value = target[p];
2468
+ cache[p] = value;
2469
+ return value;
2470
+ },
2471
+ set(_target, p, newValue) {
2472
+ cache[p] = newValue;
2473
+ changed.updated.add(bindingChunk.getFileName());
2474
+ return true;
2475
+ },
2476
+ has(target, p) {
2477
+ if (p in cache) return true;
2478
+ return p in target;
2479
+ }
2480
+ });
2481
+ }
2482
+ function transformToRollupOutputAsset(bindingAsset) {
2483
+ return new OutputAssetImpl(bindingAsset);
2484
+ }
2485
+ function transformToMutableRollupOutputAsset(bindingAsset, changed) {
2486
+ const asset = {
2487
+ type: "asset",
2488
+ fileName: bindingAsset.getFileName(),
2489
+ originalFileName: bindingAsset.getOriginalFileName() || null,
2490
+ originalFileNames: bindingAsset.getOriginalFileNames(),
2491
+ get source() {
2492
+ return transformAssetSource(bindingAsset.getSource());
2493
+ },
2494
+ name: bindingAsset.getName() ?? void 0,
2495
+ names: bindingAsset.getNames()
2496
+ };
2497
+ const cache = {};
2498
+ return new Proxy(asset, {
2499
+ get(target, p) {
2500
+ if (p in cache) return cache[p];
2501
+ const value = target[p];
2502
+ cache[p] = value;
2503
+ return value;
2504
+ },
2505
+ set(_target, p, newValue) {
2506
+ cache[p] = newValue;
2507
+ changed.updated.add(bindingAsset.getFileName());
2508
+ return true;
2509
+ }
2510
+ });
2511
+ }
2512
+ function transformToRollupOutput(output) {
2513
+ const { chunks, assets } = output;
2514
+ return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
2515
+ }
2516
+ function transformToMutableRollupOutput(output, changed) {
2517
+ const { chunks, assets } = output;
2518
+ return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
2519
+ }
2520
+ function transformToOutputBundle(context, output, changed) {
2521
+ const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
2522
+ return new Proxy(bundle, {
2523
+ set(_target, _p, _newValue, _receiver) {
2524
+ const originalStackTraceLimit = Error.stackTraceLimit;
2525
+ Error.stackTraceLimit = 2;
2526
+ const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
2527
+ const stack = new Error(message).stack ?? message;
2528
+ Error.stackTraceLimit = originalStackTraceLimit;
2529
+ context.warn({
2530
+ message: stack,
2531
+ code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
2532
+ });
2533
+ return true;
2534
+ },
2535
+ deleteProperty(target, property) {
2536
+ if (typeof property === "string") changed.deleted.add(property);
2537
+ return true;
2538
+ }
2539
+ });
2540
+ }
2541
+ function collectChangedBundle(changed, bundle) {
2542
+ const changes = {};
2543
+ for (const key in bundle) {
2544
+ if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
2545
+ const item = bundle[key];
2546
+ if (item.type === "asset") changes[key] = {
2547
+ filename: item.fileName,
2548
+ originalFileNames: item.originalFileNames,
2549
+ source: bindingAssetSource(item.source),
2550
+ names: item.names
2551
+ };
2552
+ else changes[key] = {
2553
+ code: item.code,
2554
+ filename: item.fileName,
2555
+ name: item.name,
2556
+ isEntry: item.isEntry,
2557
+ exports: item.exports,
2558
+ modules: {},
2559
+ imports: item.imports,
2560
+ dynamicImports: item.dynamicImports,
2561
+ facadeModuleId: item.facadeModuleId || void 0,
2562
+ isDynamicEntry: item.isDynamicEntry,
2563
+ moduleIds: item.moduleIds,
2564
+ map: bindingifySourcemap$1(item.map),
2565
+ sourcemapFilename: item.sourcemapFileName || void 0,
2566
+ preliminaryFilename: item.preliminaryFileName
2567
+ };
2568
+ }
2569
+ return {
2570
+ changes,
2571
+ deleted: changed.deleted
2572
+ };
2573
+ }
2574
+
2575
+ //#endregion
2576
+ //#region src/types/rolldown-output-impl.ts
2577
+ var RolldownOutputImpl = class {
2578
+ constructor(bindingOutputs) {
2579
+ this.bindingOutputs = bindingOutputs;
2580
+ }
2581
+ get output() {
2582
+ return transformToRollupOutput(this.bindingOutputs).output;
2583
+ }
2584
+ __rolldown_external_memory_handle__(keepDataAlive) {
2585
+ const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
2586
+ if (!results.every((r) => r.freed)) {
2587
+ const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
2588
+ return {
2589
+ freed: false,
2590
+ reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
2591
+ };
2592
+ }
2593
+ return { freed: true };
2594
+ }
2595
+ };
2596
+ __decorate([lazy], RolldownOutputImpl.prototype, "output", null);
2597
+ __decorate([nonEnumerable], RolldownOutputImpl.prototype, "__rolldown_external_memory_handle__", null);
2598
+
2126
2599
  //#endregion
2127
2600
  //#region src/utils/error.ts
2128
2601
  function unwrapBindingResult(container) {
@@ -2390,28 +2863,20 @@ function bindingifyRenderChunkFilter(filterOption) {
2390
2863
 
2391
2864
  //#endregion
2392
2865
  //#region src/plugin/bindingify-plugin-hook-meta.ts
2866
+ var import_binding$6 = /* @__PURE__ */ __toESM(require_binding(), 1);
2393
2867
  function bindingifyPluginHookMeta(options) {
2394
2868
  return { order: bindingPluginOrder(options.order) };
2395
2869
  }
2396
2870
  function bindingPluginOrder(order) {
2397
2871
  switch (order) {
2398
- case "post": return BindingPluginOrder.Post;
2399
- case "pre": return BindingPluginOrder.Pre;
2872
+ case "post": return import_binding$6.BindingPluginOrder.Post;
2873
+ case "pre": return import_binding$6.BindingPluginOrder.Pre;
2400
2874
  case null:
2401
2875
  case void 0: return;
2402
2876
  default: throw new Error(`Unknown plugin order: ${order}`);
2403
2877
  }
2404
2878
  }
2405
2879
 
2406
- //#endregion
2407
- //#region src/utils/asset-source.ts
2408
- function transformAssetSource(bindingAssetSource$1) {
2409
- return bindingAssetSource$1.inner;
2410
- }
2411
- function bindingAssetSource(source) {
2412
- return { inner: source };
2413
- }
2414
-
2415
2880
  //#endregion
2416
2881
  //#region src/plugin/fs.ts
2417
2882
  const fsModule = {
@@ -2566,6 +3031,7 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2566
3031
 
2567
3032
  //#endregion
2568
3033
  //#region src/plugin/bindingify-build-hooks.ts
3034
+ var import_binding$5 = /* @__PURE__ */ __toESM(require_binding(), 1);
2569
3035
  function bindingifyBuildStart(args$1) {
2570
3036
  const hook = args$1.plugin.buildStart;
2571
3037
  if (!hook) return {};
@@ -2663,7 +3129,7 @@ function bindingifyTransform(args$1) {
2663
3129
  plugin: async (ctx, code, id, meta$1) => {
2664
3130
  Object.defineProperties(meta$1, {
2665
3131
  magicString: { get() {
2666
- return new BindingMagicString(code);
3132
+ return new import_binding$5.BindingMagicString(code);
2667
3133
  } },
2668
3134
  ast: { get() {
2669
3135
  let lang = "js";
@@ -2694,7 +3160,7 @@ function bindingifyTransform(args$1) {
2694
3160
  let normalizedCode = void 0;
2695
3161
  let map = ret.map;
2696
3162
  if (typeof ret.code === "string") normalizedCode = ret.code;
2697
- else if (ret.code instanceof BindingMagicString) {
3163
+ else if (ret.code instanceof import_binding$5.BindingMagicString) {
2698
3164
  let magicString = ret.code;
2699
3165
  normalizedCode = magicString.toString();
2700
3166
  let fallbackSourcemap = ctx.sendMagicString(magicString);
@@ -2759,220 +3225,6 @@ function bindingifyModuleParsed(args$1) {
2759
3225
  };
2760
3226
  }
2761
3227
 
2762
- //#endregion
2763
- //#region src/utils/transform-rendered-module.ts
2764
- function transformToRenderedModule(bindingRenderedModule) {
2765
- return {
2766
- get code() {
2767
- return bindingRenderedModule.code;
2768
- },
2769
- get renderedLength() {
2770
- return bindingRenderedModule.code?.length || 0;
2771
- },
2772
- get renderedExports() {
2773
- return bindingRenderedModule.renderedExports;
2774
- }
2775
- };
2776
- }
2777
-
2778
- //#endregion
2779
- //#region src/utils/transform-rendered-chunk.ts
2780
- function transformRenderedChunk(chunk) {
2781
- let modules = null;
2782
- return {
2783
- type: "chunk",
2784
- get name() {
2785
- return chunk.name;
2786
- },
2787
- get isEntry() {
2788
- return chunk.isEntry;
2789
- },
2790
- get isDynamicEntry() {
2791
- return chunk.isDynamicEntry;
2792
- },
2793
- get facadeModuleId() {
2794
- return chunk.facadeModuleId;
2795
- },
2796
- get moduleIds() {
2797
- return chunk.moduleIds;
2798
- },
2799
- get exports() {
2800
- return chunk.exports;
2801
- },
2802
- get fileName() {
2803
- return chunk.fileName;
2804
- },
2805
- get imports() {
2806
- return chunk.imports;
2807
- },
2808
- get dynamicImports() {
2809
- return chunk.dynamicImports;
2810
- },
2811
- get modules() {
2812
- if (!modules) modules = transformChunkModules(chunk.modules);
2813
- return modules;
2814
- }
2815
- };
2816
- }
2817
- function transformChunkModules(modules) {
2818
- const result = {};
2819
- for (let i = 0; i < modules.values.length; i++) {
2820
- let key = modules.keys[i];
2821
- const mod = modules.values[i];
2822
- result[key] = transformToRenderedModule(mod);
2823
- }
2824
- return result;
2825
- }
2826
-
2827
- //#endregion
2828
- //#region src/utils/transform-to-rollup-output.ts
2829
- function transformToRollupSourceMap(map) {
2830
- const obj = {
2831
- ...JSON.parse(map),
2832
- toString() {
2833
- return JSON.stringify(obj);
2834
- },
2835
- toUrl() {
2836
- return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
2837
- }
2838
- };
2839
- return obj;
2840
- }
2841
- function transformToRollupOutputChunk(bindingChunk, changed) {
2842
- const chunk = {
2843
- type: "chunk",
2844
- get code() {
2845
- return bindingChunk.code;
2846
- },
2847
- fileName: bindingChunk.fileName,
2848
- name: bindingChunk.name,
2849
- get modules() {
2850
- return transformChunkModules(bindingChunk.modules);
2851
- },
2852
- get imports() {
2853
- return bindingChunk.imports;
2854
- },
2855
- get dynamicImports() {
2856
- return bindingChunk.dynamicImports;
2857
- },
2858
- exports: bindingChunk.exports,
2859
- isEntry: bindingChunk.isEntry,
2860
- facadeModuleId: bindingChunk.facadeModuleId || null,
2861
- isDynamicEntry: bindingChunk.isDynamicEntry,
2862
- get moduleIds() {
2863
- return bindingChunk.moduleIds;
2864
- },
2865
- get map() {
2866
- return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
2867
- },
2868
- sourcemapFileName: bindingChunk.sourcemapFileName || null,
2869
- preliminaryFileName: bindingChunk.preliminaryFileName
2870
- };
2871
- const cache = {};
2872
- return new Proxy(chunk, {
2873
- get(target, p) {
2874
- if (p in cache) return cache[p];
2875
- const value = target[p];
2876
- cache[p] = value;
2877
- return value;
2878
- },
2879
- set(_target, p, newValue) {
2880
- cache[p] = newValue;
2881
- changed?.updated.add(bindingChunk.fileName);
2882
- return true;
2883
- },
2884
- has(target, p) {
2885
- if (p in cache) return true;
2886
- return p in target;
2887
- }
2888
- });
2889
- }
2890
- function transformToRollupOutputAsset(bindingAsset, changed) {
2891
- const asset = {
2892
- type: "asset",
2893
- fileName: bindingAsset.fileName,
2894
- originalFileName: bindingAsset.originalFileName || null,
2895
- originalFileNames: bindingAsset.originalFileNames,
2896
- get source() {
2897
- return transformAssetSource(bindingAsset.source);
2898
- },
2899
- name: bindingAsset.name ?? void 0,
2900
- names: bindingAsset.names
2901
- };
2902
- const cache = {};
2903
- return new Proxy(asset, {
2904
- get(target, p) {
2905
- if (p in cache) return cache[p];
2906
- const value = target[p];
2907
- cache[p] = value;
2908
- return value;
2909
- },
2910
- set(_target, p, newValue) {
2911
- cache[p] = newValue;
2912
- changed?.updated.add(bindingAsset.fileName);
2913
- return true;
2914
- }
2915
- });
2916
- }
2917
- function transformToRollupOutput(output, changed) {
2918
- const { chunks, assets } = output;
2919
- return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
2920
- }
2921
- function transformToOutputBundle(context, output, changed) {
2922
- const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
2923
- return new Proxy(bundle, {
2924
- set(_target, _p, _newValue, _receiver) {
2925
- const originalStackTraceLimit = Error.stackTraceLimit;
2926
- Error.stackTraceLimit = 2;
2927
- const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
2928
- const stack = new Error(message).stack ?? message;
2929
- Error.stackTraceLimit = originalStackTraceLimit;
2930
- context.warn({
2931
- message: stack,
2932
- code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
2933
- });
2934
- return true;
2935
- },
2936
- deleteProperty(target, property) {
2937
- if (typeof property === "string") changed.deleted.add(property);
2938
- return true;
2939
- }
2940
- });
2941
- }
2942
- function collectChangedBundle(changed, bundle) {
2943
- const changes = {};
2944
- for (const key in bundle) {
2945
- if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
2946
- const item = bundle[key];
2947
- if (item.type === "asset") changes[key] = {
2948
- filename: item.fileName,
2949
- originalFileNames: item.originalFileNames,
2950
- source: bindingAssetSource(item.source),
2951
- names: item.names
2952
- };
2953
- else changes[key] = {
2954
- code: item.code,
2955
- filename: item.fileName,
2956
- name: item.name,
2957
- isEntry: item.isEntry,
2958
- exports: item.exports,
2959
- modules: {},
2960
- imports: item.imports,
2961
- dynamicImports: item.dynamicImports,
2962
- facadeModuleId: item.facadeModuleId || void 0,
2963
- isDynamicEntry: item.isDynamicEntry,
2964
- moduleIds: item.moduleIds,
2965
- map: bindingifySourcemap$1(item.map),
2966
- sourcemapFilename: item.sourcemapFileName || void 0,
2967
- preliminaryFilename: item.preliminaryFileName
2968
- };
2969
- }
2970
- return {
2971
- changes,
2972
- deleted: changed.deleted
2973
- };
2974
- }
2975
-
2976
3228
  //#endregion
2977
3229
  //#region src/plugin/bindingify-output-hooks.ts
2978
3230
  function bindingifyRenderStart(args$1) {
@@ -3012,7 +3264,7 @@ function bindingifyAugmentChunkHash(args$1) {
3012
3264
  const { handler, meta } = normalizeHook(hook);
3013
3265
  return {
3014
3266
  plugin: async (ctx, chunk) => {
3015
- return await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
3267
+ return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
3016
3268
  },
3017
3269
  meta: bindingifyPluginHookMeta(meta)
3018
3270
  };
@@ -3637,6 +3889,7 @@ function normalizeTransformOptions(inputOptions, onLog) {
3637
3889
 
3638
3890
  //#endregion
3639
3891
  //#region src/utils/bindingify-input-options.ts
3892
+ var import_binding$4 = /* @__PURE__ */ __toESM(require_binding(), 1);
3640
3893
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3641
3894
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
3642
3895
  const plugins = rawPlugins.map((plugin) => {
@@ -3706,9 +3959,9 @@ function bindingifyHmr(hmr) {
3706
3959
  function bindingifyAttachDebugInfo(attachDebugInfo) {
3707
3960
  switch (attachDebugInfo) {
3708
3961
  case void 0: return;
3709
- case "full": return BindingAttachDebugInfo.Full;
3710
- case "simple": return BindingAttachDebugInfo.Simple;
3711
- case "none": return BindingAttachDebugInfo.None;
3962
+ case "full": return import_binding$4.BindingAttachDebugInfo.Full;
3963
+ case "simple": return import_binding$4.BindingAttachDebugInfo.Simple;
3964
+ case "none": return import_binding$4.BindingAttachDebugInfo.None;
3712
3965
  }
3713
3966
  }
3714
3967
  function bindingifyExternal(external) {
@@ -3721,13 +3974,13 @@ function bindingifyExternal(external) {
3721
3974
  }
3722
3975
  }
3723
3976
  function bindingifyExperimental(experimental) {
3724
- let chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3977
+ let chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3725
3978
  if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
3726
3979
  case "exec-order":
3727
- chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3980
+ chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3728
3981
  break;
3729
3982
  case "module-id":
3730
- chunkModulesOrder = BindingChunkModuleOrderBy.ModuleId;
3983
+ chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ModuleId;
3731
3984
  break;
3732
3985
  default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
3733
3986
  }
@@ -3787,10 +4040,10 @@ function bindingifyInject(inject) {
3787
4040
  }
3788
4041
  function bindingifyLogLevel(logLevel) {
3789
4042
  switch (logLevel) {
3790
- case "silent": return BindingLogLevel.Silent;
3791
- case "debug": return BindingLogLevel.Debug;
3792
- case "warn": return BindingLogLevel.Warn;
3793
- case "info": return BindingLogLevel.Info;
4043
+ case "silent": return import_binding$4.BindingLogLevel.Silent;
4044
+ case "debug": return import_binding$4.BindingLogLevel.Debug;
4045
+ case "warn": return import_binding$4.BindingLogLevel.Warn;
4046
+ case "info": return import_binding$4.BindingLogLevel.Info;
3794
4047
  default: throw new Error(`Unexpected log level: ${logLevel}`);
3795
4048
  }
3796
4049
  }
@@ -3826,19 +4079,19 @@ function bindingifyTreeshakeOptions(config) {
3826
4079
  };
3827
4080
  switch (config.propertyReadSideEffects) {
3828
4081
  case "always":
3829
- normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
4082
+ normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.Always;
3830
4083
  break;
3831
4084
  case false:
3832
- normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
4085
+ normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.False;
3833
4086
  break;
3834
4087
  default:
3835
4088
  }
3836
4089
  switch (config.propertyWriteSideEffects) {
3837
4090
  case "always":
3838
- normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
4091
+ normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.Always;
3839
4092
  break;
3840
4093
  case false:
3841
- normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
4094
+ normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.False;
3842
4095
  break;
3843
4096
  default:
3844
4097
  }
@@ -3998,6 +4251,7 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
3998
4251
 
3999
4252
  //#endregion
4000
4253
  //#region src/utils/initialize-parallel-plugins.ts
4254
+ var import_binding$3 = /* @__PURE__ */ __toESM(require_binding(), 1);
4001
4255
  async function initializeParallelPlugins(plugins) {
4002
4256
  const pluginInfos = [];
4003
4257
  for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
@@ -4010,7 +4264,7 @@ async function initializeParallelPlugins(plugins) {
4010
4264
  }
4011
4265
  if (pluginInfos.length <= 0) return;
4012
4266
  const count = availableParallelism();
4013
- const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
4267
+ const parallelJsPluginRegistry = new import_binding$3.ParallelJsPluginRegistry(count);
4014
4268
  const registryId = parallelJsPluginRegistry.id;
4015
4269
  const workers = await initializeWorkers(registryId, count, pluginInfos);
4016
4270
  const stopWorkers = async () => {
@@ -4088,6 +4342,7 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
4088
4342
 
4089
4343
  //#endregion
4090
4344
  //#region src/api/rolldown/rolldown-build.ts
4345
+ var import_binding$2 = /* @__PURE__ */ __toESM(require_binding());
4091
4346
  Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4092
4347
  var RolldownBuild = class RolldownBuild {
4093
4348
  #inputOptions;
@@ -4096,7 +4351,7 @@ var RolldownBuild = class RolldownBuild {
4096
4351
  static asyncRuntimeShutdown = false;
4097
4352
  constructor(inputOptions) {
4098
4353
  this.#inputOptions = inputOptions;
4099
- this.#bundler = new BindingBundler();
4354
+ this.#bundler = new import_binding$2.BindingBundler();
4100
4355
  }
4101
4356
  get closed() {
4102
4357
  return this.#bundlerImpl?.impl.closed ?? true;
@@ -4104,13 +4359,13 @@ var RolldownBuild = class RolldownBuild {
4104
4359
  async #getBundlerWithStopWorker(outputOptions) {
4105
4360
  if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
4106
4361
  const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
4107
- if (RolldownBuild.asyncRuntimeShutdown) startAsyncRuntime();
4362
+ if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding$2.startAsyncRuntime)();
4108
4363
  try {
4109
4364
  return this.#bundlerImpl = {
4110
4365
  impl: this.#bundler.createImpl(option.bundlerOptions),
4111
4366
  stopWorkers: option.stopWorkers,
4112
4367
  shutdown: () => {
4113
- shutdownAsyncRuntime();
4368
+ (0, import_binding$2.shutdownAsyncRuntime)();
4114
4369
  RolldownBuild.asyncRuntimeShutdown = true;
4115
4370
  }
4116
4371
  };
@@ -4126,13 +4381,16 @@ var RolldownBuild = class RolldownBuild {
4126
4381
  async generate(outputOptions = {}) {
4127
4382
  validateOption("output", outputOptions);
4128
4383
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4129
- return transformToRollupOutput(unwrapBindingResult(await impl.generate()));
4384
+ return new RolldownOutputImpl(unwrapBindingResult(await impl.generate()));
4130
4385
  }
4131
4386
  async write(outputOptions = {}) {
4132
4387
  validateOption("output", outputOptions);
4133
4388
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4134
- return transformToRollupOutput(unwrapBindingResult(await impl.write()));
4389
+ return new RolldownOutputImpl(unwrapBindingResult(await impl.write()));
4135
4390
  }
4391
+ /**
4392
+ * Close the build and free resources.
4393
+ */
4136
4394
  async close() {
4137
4395
  if (this.#bundlerImpl) {
4138
4396
  await this.#bundlerImpl.stopWorkers?.();
@@ -4247,6 +4505,7 @@ var WatcherEmitter = class {
4247
4505
 
4248
4506
  //#endregion
4249
4507
  //#region src/api/watch/watcher.ts
4508
+ var import_binding$1 = /* @__PURE__ */ __toESM(require_binding(), 1);
4250
4509
  var Watcher = class {
4251
4510
  closed;
4252
4511
  inner;
@@ -4268,7 +4527,7 @@ var Watcher = class {
4268
4527
  this.closed = true;
4269
4528
  for (const stop of this.stopWorkers) await stop?.();
4270
4529
  await this.inner.close();
4271
- shutdownAsyncRuntime();
4530
+ (0, import_binding$1.shutdownAsyncRuntime)();
4272
4531
  }
4273
4532
  start() {
4274
4533
  process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
@@ -4280,7 +4539,7 @@ async function createWatcher(emitter, input) {
4280
4539
  return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
4281
4540
  })).flat());
4282
4541
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4283
- new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
4542
+ new Watcher(emitter, new import_binding$1.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
4284
4543
  }
4285
4544
  function getValidNotifyOption(bundlerOptions) {
4286
4545
  let result;
@@ -4309,7 +4568,8 @@ function defineConfig(config) {
4309
4568
 
4310
4569
  //#endregion
4311
4570
  //#region src/index.ts
4571
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
4312
4572
  const VERSION = version;
4313
4573
 
4314
4574
  //#endregion
4315
- export { onExit as C, version as S, validateCliOptions as _, rolldown as a, makeBuiltinPluginCallable as b, normalizedStringOrRegex as c, transformToRollupOutput as d, normalizeBindingResult as f, getOutputCliKeys as g, getInputCliKeys as h, build as i, PluginContextData as l, getCliSchemaInfo as m, defineConfig as n, RolldownBuild as o, bindingifySourcemap$1 as p, watch as r, createBundlerOptions as s, VERSION as t, bindingifyPlugin as u, PluginDriver as v, description$1 as x, BuiltinPlugin as y };
4575
+ 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 };