@rolldown/browser 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.
Files changed (30) hide show
  1. package/dist/cli-setup.mjs +4 -3
  2. package/dist/cli.mjs +8 -7
  3. package/dist/config.d.mts +2 -2
  4. package/dist/config.mjs +5 -4
  5. package/dist/experimental-index.browser.mjs +58 -8
  6. package/dist/experimental-index.d.mts +4 -4
  7. package/dist/experimental-index.mjs +61 -10
  8. package/dist/experimental-runtime-types.d.ts +16 -5
  9. package/dist/filter-index.d.mts +2 -2
  10. package/dist/filter-index.mjs +1 -1
  11. package/dist/index.browser.mjs +2 -1
  12. package/dist/index.d.mts +2 -2
  13. package/dist/index.mjs +5 -3
  14. package/dist/parallel-plugin-worker.mjs +6 -5
  15. package/dist/parallel-plugin.d.mts +2 -2
  16. package/dist/parse-ast-index.d.mts +3 -3
  17. package/dist/parse-ast-index.mjs +2 -1
  18. package/dist/rolldown-binding.wasi-browser.js +0 -1
  19. package/dist/rolldown-binding.wasi.cjs +0 -1
  20. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  21. package/dist/shared/binding-BeWSOIj5.mjs +578 -0
  22. package/dist/shared/{binding-0m41EAn-.d.mts → binding-CCMrV5an.d.mts} +48 -32
  23. package/dist/shared/{dist-DNFKY37q.mjs → composable-filters-CgRsnfr3.mjs} +1 -1
  24. package/dist/shared/{define-config-BbwLmCDX.d.mts → define-config-Bj-neIhz.d.mts} +83 -17
  25. package/dist/shared/{load-config-B3FsKQ_6.mjs → load-config-DnUAKl9P.mjs} +4 -4
  26. package/dist/shared/{parse-ast-index-Ck5SwMSC.mjs → parse-ast-index-DMI5m8Lk.mjs} +11 -5
  27. package/dist/shared/{src-BnIhK3nA.mjs → src-B8saaB3b.mjs} +559 -299
  28. package/dist/{src-CIeG_TGR.js → src-B-7Hrt6w.js} +1158 -344
  29. package/package.json +1 -1
  30. /package/dist/shared/{prompt-BDwA3jSr.mjs → prompt-YGfbLmz5.mjs} +0 -0
@@ -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 "./dist-DNFKY37q.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.44";
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 {
@@ -1381,6 +1383,25 @@ function tuple(items, message2) {
1381
1383
  };
1382
1384
  }
1383
1385
  /* @__NO_SIDE_EFFECTS__ */
1386
+ function undefined_(message2) {
1387
+ return {
1388
+ kind: "schema",
1389
+ type: "undefined",
1390
+ reference: undefined_,
1391
+ expects: "undefined",
1392
+ async: false,
1393
+ message: message2,
1394
+ get "~standard"() {
1395
+ return /* @__PURE__ */ _getStandardProps(this);
1396
+ },
1397
+ "~run"(dataset, config2) {
1398
+ if (dataset.value === void 0) dataset.typed = true;
1399
+ else _addIssue(this, "type", dataset, config2);
1400
+ return dataset;
1401
+ }
1402
+ };
1403
+ }
1404
+ /* @__NO_SIDE_EFFECTS__ */
1384
1405
  function _subIssues(datasets) {
1385
1406
  let issues;
1386
1407
  if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
@@ -1632,6 +1653,9 @@ function flattenValibotSchema(schema, result = {}, prefix = "") {
1632
1653
  //#endregion
1633
1654
  //#region src/utils/validator.ts
1634
1655
  const StringOrRegExpSchema = union([string(), instance(RegExp)]);
1656
+ function vFunction() {
1657
+ return function_();
1658
+ }
1635
1659
  const LogLevelSchema = union([
1636
1660
  literal("debug"),
1637
1661
  literal("info"),
@@ -1646,14 +1670,15 @@ const InputOptionSchema = union([
1646
1670
  array(string()),
1647
1671
  record(string(), string())
1648
1672
  ]);
1649
- const ExternalSchema = union([
1673
+ const ExternalOptionFunctionSchema = pipe(vFunction(), args(tuple([
1674
+ string(),
1675
+ optional(string()),
1676
+ boolean()
1677
+ ])), returns(nullish(boolean())));
1678
+ const ExternalOptionSchema = union([
1650
1679
  StringOrRegExpSchema,
1651
1680
  array(StringOrRegExpSchema),
1652
- pipe(function_(), args(tuple([
1653
- string(),
1654
- optional(string()),
1655
- boolean()
1656
- ])), returns(nullish(boolean())))
1681
+ ExternalOptionFunctionSchema
1657
1682
  ]);
1658
1683
  const ModuleTypesSchema = record(string(), union([
1659
1684
  literal("asset"),
@@ -1672,7 +1697,7 @@ const ModuleTypesSchema = record(string(), union([
1672
1697
  const JsxOptionsSchema = strictObject({
1673
1698
  runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
1674
1699
  development: pipe(optional(boolean()), description("Development specific information")),
1675
- throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
1700
+ throwIfNamespace: pipe(optional(boolean()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
1676
1701
  importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
1677
1702
  pragma: pipe(optional(string()), description("Jsx element transformation")),
1678
1703
  pragmaFrag: pipe(optional(string()), description("Jsx fragment transformation")),
@@ -1713,7 +1738,13 @@ const TransformOptionsSchema = object({
1713
1738
  typescript: optional(TypescriptSchema),
1714
1739
  helpers: optional(HelpersSchema),
1715
1740
  decorators: optional(DecoratorOptionSchema),
1716
- jsx: optional(union([literal("preserve"), JsxOptionsSchema])),
1741
+ jsx: optional(union([
1742
+ literal(false),
1743
+ literal("preserve"),
1744
+ literal("react"),
1745
+ literal("react-jsx"),
1746
+ JsxOptionsSchema
1747
+ ])),
1717
1748
  target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment")),
1718
1749
  define: optional(record(string(), string())),
1719
1750
  inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
@@ -1748,8 +1779,8 @@ const ChecksOptionsSchema = strictObject({
1748
1779
  preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
1749
1780
  });
1750
1781
  const CompressOptionsKeepNamesSchema = strictObject({
1751
- function: optional(boolean()),
1752
- class: optional(boolean())
1782
+ function: boolean(),
1783
+ class: boolean()
1753
1784
  });
1754
1785
  const CompressOptionsSchema = strictObject({
1755
1786
  target: optional(union([
@@ -1771,8 +1802,8 @@ const CompressOptionsSchema = strictObject({
1771
1802
  unused: optional(union([boolean(), literal("keep_assign")]))
1772
1803
  });
1773
1804
  const MangleOptionsKeepNamesSchema = strictObject({
1774
- function: optional(boolean()),
1775
- class: optional(boolean())
1805
+ function: boolean(),
1806
+ class: boolean()
1776
1807
  });
1777
1808
  const MangleOptionsSchema = strictObject({
1778
1809
  toplevel: optional(boolean()),
@@ -1811,22 +1842,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
1811
1842
  propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
1812
1843
  })]);
1813
1844
  const OptimizationOptionsSchema = strictObject({
1814
- inlineConst: pipe(optional(union([
1815
- boolean(),
1816
- literal("smart"),
1817
- strictObject({
1818
- mode: optional(union([literal("all"), literal("smart")])),
1819
- pass: optional(number())
1820
- })
1821
- ])), description("Enable crossmodule constant inlining")),
1845
+ inlineConst: pipe(optional(union([boolean(), strictObject({
1846
+ mode: optional(union([literal("all"), literal("smart")])),
1847
+ pass: optional(number())
1848
+ })])), description("Enable crossmodule constant inlining")),
1822
1849
  pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
1823
1850
  });
1824
- const OnLogSchema = pipe(function_(), args(tuple([
1851
+ const LogOrStringHandlerSchema = pipe(vFunction(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])));
1852
+ const OnLogSchema = pipe(vFunction(), args(tuple([
1825
1853
  LogLevelSchema,
1826
1854
  RollupLogSchema,
1827
- pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
1855
+ LogOrStringHandlerSchema
1828
1856
  ])));
1829
- const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
1857
+ const OnwarnSchema = pipe(vFunction(), args(tuple([RollupLogSchema, pipe(vFunction(), args(tuple([union([RollupLogWithStringSchema, pipe(vFunction(), returns(RollupLogWithStringSchema))])])))])));
1830
1858
  const HmrSchema = union([boolean(), strictObject({
1831
1859
  new: optional(boolean()),
1832
1860
  port: optional(number()),
@@ -1836,7 +1864,7 @@ const HmrSchema = union([boolean(), strictObject({
1836
1864
  const InputOptionsSchema = strictObject({
1837
1865
  input: optional(InputOptionSchema),
1838
1866
  plugins: optional(custom(() => true)),
1839
- external: optional(ExternalSchema),
1867
+ external: optional(ExternalOptionSchema),
1840
1868
  makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
1841
1869
  resolve: optional(ResolveOptionsSchema),
1842
1870
  cwd: pipe(optional(string()), description("Current working directory")),
@@ -1920,12 +1948,22 @@ const ModuleFormatSchema = union([
1920
1948
  literal("iife"),
1921
1949
  literal("umd")
1922
1950
  ]);
1923
- const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
1924
- const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1925
- const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1926
- const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
1927
- const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
1928
- const PathsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
1951
+ const AddonFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
1952
+ const ChunkFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
1953
+ const ChunkFileNamesSchema = union([string(), ChunkFileNamesFunctionSchema]);
1954
+ const AssetFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
1955
+ const AssetFileNamesSchema = union([string(), AssetFileNamesFunctionSchema]);
1956
+ const SanitizeFileNameFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
1957
+ const SanitizeFileNameSchema = union([boolean(), SanitizeFileNameFunctionSchema]);
1958
+ const GlobalsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
1959
+ const PathsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
1960
+ const ManualChunksFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
1961
+ const AdvancedChunksNameFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
1962
+ const AdvancedChunksTestFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(union([
1963
+ boolean(),
1964
+ void_(),
1965
+ undefined_()
1966
+ ])));
1929
1967
  const AdvancedChunksSchema = strictObject({
1930
1968
  includeDependenciesRecursively: optional(boolean()),
1931
1969
  minSize: optional(number()),
@@ -1934,12 +1972,8 @@ const AdvancedChunksSchema = strictObject({
1934
1972
  maxModuleSize: optional(number()),
1935
1973
  minShareCount: optional(number()),
1936
1974
  groups: optional(array(strictObject({
1937
- name: union([string(), pipe(function_(), args(tuple([string()])), returns(nullish(string())))]),
1938
- test: optional(union([
1939
- string(),
1940
- instance(RegExp),
1941
- pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
1942
- ])),
1975
+ name: union([string(), AdvancedChunksNameFunctionSchema]),
1976
+ test: optional(union([StringOrRegExpSchema, AdvancedChunksTestFunctionSchema])),
1943
1977
  priority: optional(number()),
1944
1978
  minSize: optional(number()),
1945
1979
  minShareCount: optional(number()),
@@ -1996,7 +2030,7 @@ const OutputOptionsSchema = strictObject({
1996
2030
  sanitizeFileName: optional(SanitizeFileNameSchema),
1997
2031
  minify: pipe(optional(union([
1998
2032
  boolean(),
1999
- string("dce-only"),
2033
+ literal("dce-only"),
2000
2034
  MinifyOptionsSchema
2001
2035
  ])), description("Minify the bundled file")),
2002
2036
  name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
@@ -2005,15 +2039,12 @@ const OutputOptionsSchema = strictObject({
2005
2039
  generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
2006
2040
  externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2007
2041
  inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2008
- manualChunks: optional(pipe(function_(), args(tuple([string(), object({})])), returns(union([string(), nullish(string())])))),
2042
+ manualChunks: optional(ManualChunksFunctionSchema),
2009
2043
  advancedChunks: optional(AdvancedChunksSchema),
2010
2044
  legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
2011
2045
  plugins: optional(custom(() => true)),
2012
2046
  polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
2013
- hoistTransitiveImports: optional(custom((input) => {
2014
- if (input) return false;
2015
- return true;
2016
- }, () => `The 'true' value is not supported`)),
2047
+ hoistTransitiveImports: optional(literal(false)),
2017
2048
  preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
2018
2049
  preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
2019
2050
  virtualDirname: optional(string()),
@@ -2106,6 +2137,264 @@ function getCliSchemaInfo() {
2106
2137
  return flattenValibotSchema(CliOptionsSchema);
2107
2138
  }
2108
2139
 
2140
+ //#endregion
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;
2198
+ }
2199
+
2200
+ //#endregion
2201
+ //#region src/utils/asset-source.ts
2202
+ function transformAssetSource(bindingAssetSource$1) {
2203
+ return bindingAssetSource$1.inner;
2204
+ }
2205
+ function bindingAssetSource(source) {
2206
+ return { inner: source };
2207
+ }
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
+
2259
+ //#endregion
2260
+ //#region src/utils/transform-rendered-module.ts
2261
+ function transformToRenderedModule(bindingRenderedModule) {
2262
+ return {
2263
+ get code() {
2264
+ return bindingRenderedModule.code;
2265
+ },
2266
+ get renderedLength() {
2267
+ return bindingRenderedModule.code?.length || 0;
2268
+ },
2269
+ get renderedExports() {
2270
+ return bindingRenderedModule.renderedExports;
2271
+ }
2272
+ };
2273
+ }
2274
+
2275
+ //#endregion
2276
+ //#region src/utils/transform-rendered-chunk.ts
2277
+ function transformRenderedChunk(chunk) {
2278
+ let modules = null;
2279
+ return {
2280
+ type: "chunk",
2281
+ get name() {
2282
+ return chunk.name;
2283
+ },
2284
+ get isEntry() {
2285
+ return chunk.isEntry;
2286
+ },
2287
+ get isDynamicEntry() {
2288
+ return chunk.isDynamicEntry;
2289
+ },
2290
+ get facadeModuleId() {
2291
+ return chunk.facadeModuleId;
2292
+ },
2293
+ get moduleIds() {
2294
+ return chunk.moduleIds;
2295
+ },
2296
+ get exports() {
2297
+ return chunk.exports;
2298
+ },
2299
+ get fileName() {
2300
+ return chunk.fileName;
2301
+ },
2302
+ get imports() {
2303
+ return chunk.imports;
2304
+ },
2305
+ get dynamicImports() {
2306
+ return chunk.dynamicImports;
2307
+ },
2308
+ get modules() {
2309
+ if (!modules) modules = transformChunkModules(chunk.modules);
2310
+ return modules;
2311
+ }
2312
+ };
2313
+ }
2314
+ function transformChunkModules(modules) {
2315
+ const result = {};
2316
+ for (let i = 0; i < modules.values.length; i++) {
2317
+ let key = modules.keys[i];
2318
+ const mod = modules.values[i];
2319
+ result[key] = transformToRenderedModule(mod);
2320
+ }
2321
+ return result;
2322
+ }
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
+
2109
2398
  //#endregion
2110
2399
  //#region src/types/sourcemap.ts
2111
2400
  function bindingifySourcemap$1(map) {
@@ -2122,6 +2411,190 @@ function bindingifySourcemap$1(map) {
2122
2411
  } };
2123
2412
  }
2124
2413
 
2414
+ //#endregion
2415
+ //#region src/utils/transform-to-rollup-output.ts
2416
+ function transformToRollupSourceMap(map) {
2417
+ const obj = {
2418
+ ...JSON.parse(map),
2419
+ toString() {
2420
+ return JSON.stringify(obj);
2421
+ },
2422
+ toUrl() {
2423
+ return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
2424
+ }
2425
+ };
2426
+ return obj;
2427
+ }
2428
+ function transformToRollupOutputChunk(bindingChunk) {
2429
+ return new OutputChunkImpl(bindingChunk);
2430
+ }
2431
+ function transformToMutableRollupOutputChunk(bindingChunk, changed) {
2432
+ const chunk = {
2433
+ type: "chunk",
2434
+ get code() {
2435
+ return bindingChunk.getCode();
2436
+ },
2437
+ fileName: bindingChunk.getFileName(),
2438
+ name: bindingChunk.getName(),
2439
+ get modules() {
2440
+ return transformChunkModules(bindingChunk.getModules());
2441
+ },
2442
+ get imports() {
2443
+ return bindingChunk.getImports();
2444
+ },
2445
+ get dynamicImports() {
2446
+ return bindingChunk.getDynamicImports();
2447
+ },
2448
+ exports: bindingChunk.getExports(),
2449
+ isEntry: bindingChunk.getIsEntry(),
2450
+ facadeModuleId: bindingChunk.getFacadeModuleId() || null,
2451
+ isDynamicEntry: bindingChunk.getIsDynamicEntry(),
2452
+ get moduleIds() {
2453
+ return bindingChunk.getModuleIds();
2454
+ },
2455
+ get map() {
2456
+ const map = bindingChunk.getMap();
2457
+ return map ? transformToRollupSourceMap(map) : null;
2458
+ },
2459
+ sourcemapFileName: bindingChunk.getSourcemapFileName() || null,
2460
+ preliminaryFileName: bindingChunk.getPreliminaryFileName()
2461
+ };
2462
+ const cache = {};
2463
+ return new Proxy(chunk, {
2464
+ get(target, p) {
2465
+ if (p in cache) return cache[p];
2466
+ const value = target[p];
2467
+ cache[p] = value;
2468
+ return value;
2469
+ },
2470
+ set(_target, p, newValue) {
2471
+ cache[p] = newValue;
2472
+ changed.updated.add(bindingChunk.getFileName());
2473
+ return true;
2474
+ },
2475
+ has(target, p) {
2476
+ if (p in cache) return true;
2477
+ return p in target;
2478
+ }
2479
+ });
2480
+ }
2481
+ function transformToRollupOutputAsset(bindingAsset) {
2482
+ return new OutputAssetImpl(bindingAsset);
2483
+ }
2484
+ function transformToMutableRollupOutputAsset(bindingAsset, changed) {
2485
+ const asset = {
2486
+ type: "asset",
2487
+ fileName: bindingAsset.getFileName(),
2488
+ originalFileName: bindingAsset.getOriginalFileName() || null,
2489
+ originalFileNames: bindingAsset.getOriginalFileNames(),
2490
+ get source() {
2491
+ return transformAssetSource(bindingAsset.getSource());
2492
+ },
2493
+ name: bindingAsset.getName() ?? void 0,
2494
+ names: bindingAsset.getNames()
2495
+ };
2496
+ const cache = {};
2497
+ return new Proxy(asset, {
2498
+ get(target, p) {
2499
+ if (p in cache) return cache[p];
2500
+ const value = target[p];
2501
+ cache[p] = value;
2502
+ return value;
2503
+ },
2504
+ set(_target, p, newValue) {
2505
+ cache[p] = newValue;
2506
+ changed.updated.add(bindingAsset.getFileName());
2507
+ return true;
2508
+ }
2509
+ });
2510
+ }
2511
+ function transformToRollupOutput(output) {
2512
+ const { chunks, assets } = output;
2513
+ return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
2514
+ }
2515
+ function transformToMutableRollupOutput(output, changed) {
2516
+ const { chunks, assets } = output;
2517
+ return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
2518
+ }
2519
+ function transformToOutputBundle(context, output, changed) {
2520
+ const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
2521
+ return new Proxy(bundle, {
2522
+ set(_target, _p, _newValue, _receiver) {
2523
+ const originalStackTraceLimit = Error.stackTraceLimit;
2524
+ Error.stackTraceLimit = 2;
2525
+ 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.";
2526
+ const stack = new Error(message).stack ?? message;
2527
+ Error.stackTraceLimit = originalStackTraceLimit;
2528
+ context.warn({
2529
+ message: stack,
2530
+ code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
2531
+ });
2532
+ return true;
2533
+ },
2534
+ deleteProperty(target, property) {
2535
+ if (typeof property === "string") changed.deleted.add(property);
2536
+ return true;
2537
+ }
2538
+ });
2539
+ }
2540
+ function collectChangedBundle(changed, bundle) {
2541
+ const changes = {};
2542
+ for (const key in bundle) {
2543
+ if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
2544
+ const item = bundle[key];
2545
+ if (item.type === "asset") changes[key] = {
2546
+ filename: item.fileName,
2547
+ originalFileNames: item.originalFileNames,
2548
+ source: bindingAssetSource(item.source),
2549
+ names: item.names
2550
+ };
2551
+ else changes[key] = {
2552
+ code: item.code,
2553
+ filename: item.fileName,
2554
+ name: item.name,
2555
+ isEntry: item.isEntry,
2556
+ exports: item.exports,
2557
+ modules: {},
2558
+ imports: item.imports,
2559
+ dynamicImports: item.dynamicImports,
2560
+ facadeModuleId: item.facadeModuleId || void 0,
2561
+ isDynamicEntry: item.isDynamicEntry,
2562
+ moduleIds: item.moduleIds,
2563
+ map: bindingifySourcemap$1(item.map),
2564
+ sourcemapFilename: item.sourcemapFileName || void 0,
2565
+ preliminaryFilename: item.preliminaryFileName
2566
+ };
2567
+ }
2568
+ return {
2569
+ changes,
2570
+ deleted: changed.deleted
2571
+ };
2572
+ }
2573
+
2574
+ //#endregion
2575
+ //#region src/types/rolldown-output-impl.ts
2576
+ var RolldownOutputImpl = class {
2577
+ constructor(bindingOutputs) {
2578
+ this.bindingOutputs = bindingOutputs;
2579
+ }
2580
+ get output() {
2581
+ return transformToRollupOutput(this.bindingOutputs).output;
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
+ }
2594
+ };
2595
+ __decorate([lazy], RolldownOutputImpl.prototype, "output", null);
2596
+ __decorate([nonEnumerable], RolldownOutputImpl.prototype, "__rolldown_external_memory_handle__", null);
2597
+
2125
2598
  //#endregion
2126
2599
  //#region src/utils/error.ts
2127
2600
  function unwrapBindingResult(container) {
@@ -2389,28 +2862,20 @@ function bindingifyRenderChunkFilter(filterOption) {
2389
2862
 
2390
2863
  //#endregion
2391
2864
  //#region src/plugin/bindingify-plugin-hook-meta.ts
2865
+ var import_binding$6 = /* @__PURE__ */ __toESM(require_binding(), 1);
2392
2866
  function bindingifyPluginHookMeta(options) {
2393
2867
  return { order: bindingPluginOrder(options.order) };
2394
2868
  }
2395
2869
  function bindingPluginOrder(order) {
2396
2870
  switch (order) {
2397
- case "post": return BindingPluginOrder.Post;
2398
- case "pre": return BindingPluginOrder.Pre;
2871
+ case "post": return import_binding$6.BindingPluginOrder.Post;
2872
+ case "pre": return import_binding$6.BindingPluginOrder.Pre;
2399
2873
  case null:
2400
2874
  case void 0: return;
2401
2875
  default: throw new Error(`Unknown plugin order: ${order}`);
2402
2876
  }
2403
2877
  }
2404
2878
 
2405
- //#endregion
2406
- //#region src/utils/asset-source.ts
2407
- function transformAssetSource(bindingAssetSource$1) {
2408
- return bindingAssetSource$1.inner;
2409
- }
2410
- function bindingAssetSource(source) {
2411
- return { inner: source };
2412
- }
2413
-
2414
2879
  //#endregion
2415
2880
  //#region src/plugin/fs.ts
2416
2881
  const fsModule = {
@@ -2565,6 +3030,7 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2565
3030
 
2566
3031
  //#endregion
2567
3032
  //#region src/plugin/bindingify-build-hooks.ts
3033
+ var import_binding$5 = /* @__PURE__ */ __toESM(require_binding(), 1);
2568
3034
  function bindingifyBuildStart(args$1) {
2569
3035
  const hook = args$1.plugin.buildStart;
2570
3036
  if (!hook) return {};
@@ -2662,7 +3128,7 @@ function bindingifyTransform(args$1) {
2662
3128
  plugin: async (ctx, code$1, id$1, meta$1) => {
2663
3129
  Object.defineProperties(meta$1, {
2664
3130
  magicString: { get() {
2665
- return new BindingMagicString(code$1);
3131
+ return new import_binding$5.BindingMagicString(code$1);
2666
3132
  } },
2667
3133
  ast: { get() {
2668
3134
  let lang = "js";
@@ -2693,7 +3159,7 @@ function bindingifyTransform(args$1) {
2693
3159
  let normalizedCode = void 0;
2694
3160
  let map = ret.map;
2695
3161
  if (typeof ret.code === "string") normalizedCode = ret.code;
2696
- else if (ret.code instanceof BindingMagicString) {
3162
+ else if (ret.code instanceof import_binding$5.BindingMagicString) {
2697
3163
  let magicString = ret.code;
2698
3164
  normalizedCode = magicString.toString();
2699
3165
  let fallbackSourcemap = ctx.sendMagicString(magicString);
@@ -2758,220 +3224,6 @@ function bindingifyModuleParsed(args$1) {
2758
3224
  };
2759
3225
  }
2760
3226
 
2761
- //#endregion
2762
- //#region src/utils/transform-rendered-module.ts
2763
- function transformToRenderedModule(bindingRenderedModule) {
2764
- return {
2765
- get code() {
2766
- return bindingRenderedModule.code;
2767
- },
2768
- get renderedLength() {
2769
- return bindingRenderedModule.code?.length || 0;
2770
- },
2771
- get renderedExports() {
2772
- return bindingRenderedModule.renderedExports;
2773
- }
2774
- };
2775
- }
2776
-
2777
- //#endregion
2778
- //#region src/utils/transform-rendered-chunk.ts
2779
- function transformRenderedChunk(chunk) {
2780
- let modules = null;
2781
- return {
2782
- type: "chunk",
2783
- get name() {
2784
- return chunk.name;
2785
- },
2786
- get isEntry() {
2787
- return chunk.isEntry;
2788
- },
2789
- get isDynamicEntry() {
2790
- return chunk.isDynamicEntry;
2791
- },
2792
- get facadeModuleId() {
2793
- return chunk.facadeModuleId;
2794
- },
2795
- get moduleIds() {
2796
- return chunk.moduleIds;
2797
- },
2798
- get exports() {
2799
- return chunk.exports;
2800
- },
2801
- get fileName() {
2802
- return chunk.fileName;
2803
- },
2804
- get imports() {
2805
- return chunk.imports;
2806
- },
2807
- get dynamicImports() {
2808
- return chunk.dynamicImports;
2809
- },
2810
- get modules() {
2811
- if (!modules) modules = transformChunkModules(chunk.modules);
2812
- return modules;
2813
- }
2814
- };
2815
- }
2816
- function transformChunkModules(modules) {
2817
- const result = {};
2818
- for (let i = 0; i < modules.values.length; i++) {
2819
- let key = modules.keys[i];
2820
- const mod = modules.values[i];
2821
- result[key] = transformToRenderedModule(mod);
2822
- }
2823
- return result;
2824
- }
2825
-
2826
- //#endregion
2827
- //#region src/utils/transform-to-rollup-output.ts
2828
- function transformToRollupSourceMap(map) {
2829
- const obj = {
2830
- ...JSON.parse(map),
2831
- toString() {
2832
- return JSON.stringify(obj);
2833
- },
2834
- toUrl() {
2835
- return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
2836
- }
2837
- };
2838
- return obj;
2839
- }
2840
- function transformToRollupOutputChunk(bindingChunk, changed) {
2841
- const chunk = {
2842
- type: "chunk",
2843
- get code() {
2844
- return bindingChunk.code;
2845
- },
2846
- fileName: bindingChunk.fileName,
2847
- name: bindingChunk.name,
2848
- get modules() {
2849
- return transformChunkModules(bindingChunk.modules);
2850
- },
2851
- get imports() {
2852
- return bindingChunk.imports;
2853
- },
2854
- get dynamicImports() {
2855
- return bindingChunk.dynamicImports;
2856
- },
2857
- exports: bindingChunk.exports,
2858
- isEntry: bindingChunk.isEntry,
2859
- facadeModuleId: bindingChunk.facadeModuleId || null,
2860
- isDynamicEntry: bindingChunk.isDynamicEntry,
2861
- get moduleIds() {
2862
- return bindingChunk.moduleIds;
2863
- },
2864
- get map() {
2865
- return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
2866
- },
2867
- sourcemapFileName: bindingChunk.sourcemapFileName || null,
2868
- preliminaryFileName: bindingChunk.preliminaryFileName
2869
- };
2870
- const cache = {};
2871
- return new Proxy(chunk, {
2872
- get(target, p) {
2873
- if (p in cache) return cache[p];
2874
- const value = target[p];
2875
- cache[p] = value;
2876
- return value;
2877
- },
2878
- set(_target, p, newValue) {
2879
- cache[p] = newValue;
2880
- changed?.updated.add(bindingChunk.fileName);
2881
- return true;
2882
- },
2883
- has(target, p) {
2884
- if (p in cache) return true;
2885
- return p in target;
2886
- }
2887
- });
2888
- }
2889
- function transformToRollupOutputAsset(bindingAsset, changed) {
2890
- const asset = {
2891
- type: "asset",
2892
- fileName: bindingAsset.fileName,
2893
- originalFileName: bindingAsset.originalFileName || null,
2894
- originalFileNames: bindingAsset.originalFileNames,
2895
- get source() {
2896
- return transformAssetSource(bindingAsset.source);
2897
- },
2898
- name: bindingAsset.name ?? void 0,
2899
- names: bindingAsset.names
2900
- };
2901
- const cache = {};
2902
- return new Proxy(asset, {
2903
- get(target, p) {
2904
- if (p in cache) return cache[p];
2905
- const value = target[p];
2906
- cache[p] = value;
2907
- return value;
2908
- },
2909
- set(_target, p, newValue) {
2910
- cache[p] = newValue;
2911
- changed?.updated.add(bindingAsset.fileName);
2912
- return true;
2913
- }
2914
- });
2915
- }
2916
- function transformToRollupOutput(output, changed) {
2917
- const { chunks, assets } = output;
2918
- return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
2919
- }
2920
- function transformToOutputBundle(context, output, changed) {
2921
- const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
2922
- return new Proxy(bundle, {
2923
- set(_target, _p, _newValue, _receiver) {
2924
- const originalStackTraceLimit = Error.stackTraceLimit;
2925
- Error.stackTraceLimit = 2;
2926
- 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.";
2927
- const stack = new Error(message).stack ?? message;
2928
- Error.stackTraceLimit = originalStackTraceLimit;
2929
- context.warn({
2930
- message: stack,
2931
- code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
2932
- });
2933
- return true;
2934
- },
2935
- deleteProperty(target, property) {
2936
- if (typeof property === "string") changed.deleted.add(property);
2937
- return true;
2938
- }
2939
- });
2940
- }
2941
- function collectChangedBundle(changed, bundle) {
2942
- const changes = {};
2943
- for (const key in bundle) {
2944
- if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
2945
- const item = bundle[key];
2946
- if (item.type === "asset") changes[key] = {
2947
- filename: item.fileName,
2948
- originalFileNames: item.originalFileNames,
2949
- source: bindingAssetSource(item.source),
2950
- names: item.names
2951
- };
2952
- else changes[key] = {
2953
- code: item.code,
2954
- filename: item.fileName,
2955
- name: item.name,
2956
- isEntry: item.isEntry,
2957
- exports: item.exports,
2958
- modules: {},
2959
- imports: item.imports,
2960
- dynamicImports: item.dynamicImports,
2961
- facadeModuleId: item.facadeModuleId || void 0,
2962
- isDynamicEntry: item.isDynamicEntry,
2963
- moduleIds: item.moduleIds,
2964
- map: bindingifySourcemap$1(item.map),
2965
- sourcemapFilename: item.sourcemapFileName || void 0,
2966
- preliminaryFilename: item.preliminaryFileName
2967
- };
2968
- }
2969
- return {
2970
- changes,
2971
- deleted: changed.deleted
2972
- };
2973
- }
2974
-
2975
3227
  //#endregion
2976
3228
  //#region src/plugin/bindingify-output-hooks.ts
2977
3229
  function bindingifyRenderStart(args$1) {
@@ -3011,7 +3263,7 @@ function bindingifyAugmentChunkHash(args$1) {
3011
3263
  const { handler, meta } = normalizeHook(hook);
3012
3264
  return {
3013
3265
  plugin: async (ctx, chunk) => {
3014
- 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));
3266
+ 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));
3015
3267
  },
3016
3268
  meta: bindingifyPluginHookMeta(meta)
3017
3269
  };
@@ -3636,6 +3888,7 @@ function normalizeTransformOptions(inputOptions, onLog) {
3636
3888
 
3637
3889
  //#endregion
3638
3890
  //#region src/utils/bindingify-input-options.ts
3891
+ var import_binding$4 = /* @__PURE__ */ __toESM(require_binding(), 1);
3639
3892
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3640
3893
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
3641
3894
  const plugins = rawPlugins.map((plugin) => {
@@ -3705,9 +3958,9 @@ function bindingifyHmr(hmr) {
3705
3958
  function bindingifyAttachDebugInfo(attachDebugInfo) {
3706
3959
  switch (attachDebugInfo) {
3707
3960
  case void 0: return;
3708
- case "full": return BindingAttachDebugInfo.Full;
3709
- case "simple": return BindingAttachDebugInfo.Simple;
3710
- 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;
3711
3964
  }
3712
3965
  }
3713
3966
  function bindingifyExternal(external) {
@@ -3720,13 +3973,13 @@ function bindingifyExternal(external) {
3720
3973
  }
3721
3974
  }
3722
3975
  function bindingifyExperimental(experimental) {
3723
- let chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3976
+ let chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3724
3977
  if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
3725
3978
  case "exec-order":
3726
- chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3979
+ chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3727
3980
  break;
3728
3981
  case "module-id":
3729
- chunkModulesOrder = BindingChunkModuleOrderBy.ModuleId;
3982
+ chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ModuleId;
3730
3983
  break;
3731
3984
  default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
3732
3985
  }
@@ -3786,10 +4039,10 @@ function bindingifyInject(inject) {
3786
4039
  }
3787
4040
  function bindingifyLogLevel(logLevel) {
3788
4041
  switch (logLevel) {
3789
- case "silent": return BindingLogLevel.Silent;
3790
- case "debug": return BindingLogLevel.Debug;
3791
- case "warn": return BindingLogLevel.Warn;
3792
- 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;
3793
4046
  default: throw new Error(`Unexpected log level: ${logLevel}`);
3794
4047
  }
3795
4048
  }
@@ -3825,19 +4078,19 @@ function bindingifyTreeshakeOptions(config) {
3825
4078
  };
3826
4079
  switch (config.propertyReadSideEffects) {
3827
4080
  case "always":
3828
- normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
4081
+ normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.Always;
3829
4082
  break;
3830
4083
  case false:
3831
- normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
4084
+ normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.False;
3832
4085
  break;
3833
4086
  default:
3834
4087
  }
3835
4088
  switch (config.propertyWriteSideEffects) {
3836
4089
  case "always":
3837
- normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
4090
+ normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.Always;
3838
4091
  break;
3839
4092
  case false:
3840
- normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
4093
+ normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.False;
3841
4094
  break;
3842
4095
  default:
3843
4096
  }
@@ -3997,6 +4250,7 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
3997
4250
 
3998
4251
  //#endregion
3999
4252
  //#region src/utils/initialize-parallel-plugins.ts
4253
+ var import_binding$3 = /* @__PURE__ */ __toESM(require_binding(), 1);
4000
4254
  async function initializeParallelPlugins(plugins) {
4001
4255
  const pluginInfos = [];
4002
4256
  for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
@@ -4009,7 +4263,7 @@ async function initializeParallelPlugins(plugins) {
4009
4263
  }
4010
4264
  if (pluginInfos.length <= 0) return;
4011
4265
  const count = availableParallelism();
4012
- const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
4266
+ const parallelJsPluginRegistry = new import_binding$3.ParallelJsPluginRegistry(count);
4013
4267
  const registryId = parallelJsPluginRegistry.id;
4014
4268
  const workers = await initializeWorkers(registryId, count, pluginInfos);
4015
4269
  const stopWorkers = async () => {
@@ -4087,6 +4341,7 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
4087
4341
 
4088
4342
  //#endregion
4089
4343
  //#region src/api/rolldown/rolldown-build.ts
4344
+ var import_binding$2 = /* @__PURE__ */ __toESM(require_binding());
4090
4345
  Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4091
4346
  var RolldownBuild = class RolldownBuild {
4092
4347
  #inputOptions;
@@ -4095,7 +4350,7 @@ var RolldownBuild = class RolldownBuild {
4095
4350
  static asyncRuntimeShutdown = false;
4096
4351
  constructor(inputOptions) {
4097
4352
  this.#inputOptions = inputOptions;
4098
- this.#bundler = new BindingBundler();
4353
+ this.#bundler = new import_binding$2.BindingBundler();
4099
4354
  }
4100
4355
  get closed() {
4101
4356
  return this.#bundlerImpl?.impl.closed ?? true;
@@ -4103,13 +4358,13 @@ var RolldownBuild = class RolldownBuild {
4103
4358
  async #getBundlerWithStopWorker(outputOptions) {
4104
4359
  if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
4105
4360
  const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
4106
- if (RolldownBuild.asyncRuntimeShutdown) startAsyncRuntime();
4361
+ if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding$2.startAsyncRuntime)();
4107
4362
  try {
4108
4363
  return this.#bundlerImpl = {
4109
4364
  impl: this.#bundler.createImpl(option.bundlerOptions),
4110
4365
  stopWorkers: option.stopWorkers,
4111
4366
  shutdown: () => {
4112
- shutdownAsyncRuntime();
4367
+ (0, import_binding$2.shutdownAsyncRuntime)();
4113
4368
  RolldownBuild.asyncRuntimeShutdown = true;
4114
4369
  }
4115
4370
  };
@@ -4125,13 +4380,16 @@ var RolldownBuild = class RolldownBuild {
4125
4380
  async generate(outputOptions = {}) {
4126
4381
  validateOption("output", outputOptions);
4127
4382
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4128
- return transformToRollupOutput(unwrapBindingResult(await impl.generate()));
4383
+ return new RolldownOutputImpl(unwrapBindingResult(await impl.generate()));
4129
4384
  }
4130
4385
  async write(outputOptions = {}) {
4131
4386
  validateOption("output", outputOptions);
4132
4387
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4133
- return transformToRollupOutput(unwrapBindingResult(await impl.write()));
4388
+ return new RolldownOutputImpl(unwrapBindingResult(await impl.write()));
4134
4389
  }
4390
+ /**
4391
+ * Close the build and free resources.
4392
+ */
4135
4393
  async close() {
4136
4394
  if (this.#bundlerImpl) {
4137
4395
  await this.#bundlerImpl.stopWorkers?.();
@@ -4246,6 +4504,7 @@ var WatcherEmitter = class {
4246
4504
 
4247
4505
  //#endregion
4248
4506
  //#region src/api/watch/watcher.ts
4507
+ var import_binding$1 = /* @__PURE__ */ __toESM(require_binding(), 1);
4249
4508
  var Watcher = class {
4250
4509
  closed;
4251
4510
  inner;
@@ -4267,7 +4526,7 @@ var Watcher = class {
4267
4526
  this.closed = true;
4268
4527
  for (const stop of this.stopWorkers) await stop?.();
4269
4528
  await this.inner.close();
4270
- shutdownAsyncRuntime();
4529
+ (0, import_binding$1.shutdownAsyncRuntime)();
4271
4530
  }
4272
4531
  start() {
4273
4532
  process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
@@ -4279,7 +4538,7 @@ async function createWatcher(emitter, input) {
4279
4538
  return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
4280
4539
  })).flat());
4281
4540
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4282
- 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();
4283
4542
  }
4284
4543
  function getValidNotifyOption(bundlerOptions) {
4285
4544
  let result;
@@ -4308,7 +4567,8 @@ function defineConfig(config) {
4308
4567
 
4309
4568
  //#endregion
4310
4569
  //#region src/index.ts
4570
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
4311
4571
  const VERSION = version;
4312
4572
 
4313
4573
  //#endregion
4314
- export { version as C, description$1 as S, getOutputCliKeys as _, build as a, BuiltinPlugin as b, createBundlerOptions as c, bindingifyPlugin as d, transformToRollupOutput as f, getInputCliKeys as g, getCliSchemaInfo as h, watch as i, normalizedStringOrRegex as l, bindingifySourcemap$1 as m, VERSION as n, rolldown as o, normalizeBindingResult 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 };