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

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 (37) hide show
  1. package/dist/cli.mjs +22 -9
  2. package/dist/config.d.mts +3 -2
  3. package/dist/config.mjs +6 -4
  4. package/dist/constructors-EhfoQfqh.js +68 -0
  5. package/dist/experimental-index.browser.mjs +36 -106
  6. package/dist/experimental-index.d.mts +18 -58
  7. package/dist/experimental-index.mjs +39 -108
  8. package/dist/filter-index.d.mts +3 -2
  9. package/dist/filter-index.mjs +1 -1
  10. package/dist/index.browser.mjs +2 -1
  11. package/dist/index.d.mts +3 -2
  12. package/dist/index.mjs +5 -3
  13. package/dist/{shared/parse-ast-index-BiBzSGZe.mjs → normalize-string-or-regex-d47jXr3r.js} +38 -109
  14. package/dist/parallel-plugin-worker.mjs +5 -3
  15. package/dist/parallel-plugin.d.mts +3 -2
  16. package/dist/parse-ast-index.d.mts +1 -1
  17. package/dist/parse-ast-index.mjs +2 -1
  18. package/dist/plugins-index.browser.mjs +39 -0
  19. package/dist/plugins-index.d.mts +31 -0
  20. package/dist/plugins-index.mjs +40 -0
  21. package/dist/rolldown-binding.wasi-browser.js +1 -1
  22. package/dist/rolldown-binding.wasi.cjs +1 -1
  23. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  24. package/dist/shared/{binding-CRSqCQIK.d.mts → binding-B4uTNiw2.d.mts} +19 -49
  25. package/dist/shared/constructors-CaN9lKj2.d.mts +32 -0
  26. package/dist/shared/constructors-DcEzB0nc.mjs +68 -0
  27. package/dist/shared/{define-config-pfDd6Le4.d.mts → define-config-BAQ9c-hh.d.mts} +7 -64
  28. package/dist/shared/{load-config-D508WsWM.mjs → load-config-DQI-2sfE.mjs} +1 -1
  29. package/dist/shared/logs-CPsamAuj.mjs +181 -0
  30. package/dist/shared/normalize-string-or-regex-CbDij6KB.mjs +46 -0
  31. package/dist/shared/parse-ast-index-D9jH_38U.mjs +81 -0
  32. package/dist/shared/{prompt-BDwA3jSr.mjs → prompt-Ckjl2FdJ.mjs} +1 -1
  33. package/dist/shared/{src-DE7RBSfl.mjs → src-CZ_U2fML.mjs} +218 -191
  34. package/dist/shared/utils-CduIqa7h.d.mts +18 -0
  35. package/dist/{src-Deywlnh0.js → src-CnMyHYgB.js} +203 -405
  36. package/package.json +1 -1
  37. /package/dist/shared/{composable-filters-D_PY7Qa7.mjs → composable-filters-CBpK2Fbc.mjs} +0 -0
@@ -1,8 +1,11 @@
1
- import { a as logCycleLoading, c as logDeprecatedInject, d as logInputHookInOutputPlugin, f as logInvalidLogPosition, h as styleText, i as error, l as logDeprecatedKeepNames, m as logPluginError, o as logDeprecatedDefine, p as logMultiplyNotifyOption, r as augmentCodeLocation, s as logDeprecatedDropLabels, t as parseAst, u as logDeprecatedProfilerNames } from "./parse-ast-index-BiBzSGZe.mjs";
2
- import { a as include, c as or, d as arraify, g as unsupported, h as unreachable, i as id, m as unimplemented, n as code, o as moduleType, p as noop, r as exclude, t as and } from "./composable-filters-D_PY7Qa7.mjs";
1
+ import { a as logInvalidLogPosition, c as logPluginError, i as logInputHookInOutputPlugin, n as error, o as logMultiplyNotifyOption, r as logCycleLoading, t as augmentCodeLocation } from "./logs-CPsamAuj.mjs";
2
+ import { n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CbDij6KB.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-CBpK2Fbc.mjs";
4
+ import { t as parseAst } from "./parse-ast-index-D9jH_38U.mjs";
3
5
  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";
6
+ import { BindingAttachDebugInfo, BindingBundler, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingMagicString as BindingMagicString$1, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
5
7
  import path from "node:path";
8
+ import { styleText } from "node:util";
6
9
  import fsp from "node:fs/promises";
7
10
  import os from "node:os";
8
11
 
@@ -217,40 +220,9 @@ if (isMainThread) {
217
220
 
218
221
  //#endregion
219
222
  //#region package.json
220
- var version = "1.0.0-beta.47";
223
+ var version = "1.0.0-beta.49";
221
224
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
222
225
 
223
- //#endregion
224
- //#region src/builtin-plugin/utils.ts
225
- var BuiltinPlugin = class {
226
- constructor(name, _options) {
227
- this.name = name;
228
- this._options = _options;
229
- }
230
- };
231
- function makeBuiltinPluginCallable(plugin) {
232
- let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
233
- const wrappedPlugin = plugin;
234
- for (const key in callablePlugin) wrappedPlugin[key] = async function(...args$1) {
235
- try {
236
- return await callablePlugin[key](...args$1);
237
- } catch (e$1) {
238
- if (e$1 instanceof Error && !e$1.stack?.includes("at ")) Error.captureStackTrace(e$1, wrappedPlugin[key]);
239
- return error(logPluginError(e$1, plugin.name, {
240
- hook: key,
241
- id: key === "transform" ? args$1[2] : void 0
242
- }));
243
- }
244
- };
245
- return wrappedPlugin;
246
- }
247
- function bindingifyBuiltInPlugin(plugin) {
248
- return {
249
- __name: plugin.name,
250
- options: plugin._options
251
- };
252
- }
253
-
254
226
  //#endregion
255
227
  //#region src/log/logging.ts
256
228
  const LOG_LEVEL_SILENT = "silent";
@@ -1648,6 +1620,17 @@ function flattenValibotSchema(schema, result = {}, prefix = "") {
1648
1620
  return result;
1649
1621
  }
1650
1622
 
1623
+ //#endregion
1624
+ //#region src/utils/style-text.ts
1625
+ /**
1626
+ * Cross-platform styleText utility that works in both Node.js and browser environments
1627
+ * In Node.js, it uses the native `styleText` from `node:util`
1628
+ * In browser, it provides empty styling functions for compatibility
1629
+ */
1630
+ function styleText$1(...args$1) {
1631
+ return styleText(...args$1);
1632
+ }
1633
+
1651
1634
  //#endregion
1652
1635
  //#region src/utils/validator.ts
1653
1636
  const StringOrRegExpSchema = union([string(), instance(RegExp)]);
@@ -1744,8 +1727,8 @@ const TransformOptionsSchema = object({
1744
1727
  JsxOptionsSchema
1745
1728
  ])),
1746
1729
  target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment")),
1747
- define: optional(record(string(), string())),
1748
- inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
1730
+ define: pipe(optional(record(string(), string())), description("Define global variables")),
1731
+ inject: pipe(optional(record(string(), union([string(), tuple([string(), string()])]))), description("Inject import statements on demand")),
1749
1732
  dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names"))
1750
1733
  });
1751
1734
  const WatchOptionsSchema = strictObject({
@@ -1870,11 +1853,11 @@ const InputOptionsSchema = strictObject({
1870
1853
  literal("browser"),
1871
1854
  literal("neutral"),
1872
1855
  literal("node")
1873
- ])), description(`Platform for which the code should be generated (node, ${styleText("underline", "browser")}, neutral)`)),
1856
+ ])), description(`Platform for which the code should be generated (node, ${styleText$1("underline", "browser")}, neutral)`)),
1874
1857
  shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
1875
1858
  treeshake: optional(TreeshakingOptionsSchema),
1876
1859
  optimization: optional(OptimizationOptionsSchema),
1877
- logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${styleText("dim", "silent")}, ${styleText(["underline", "gray"], "info")}, debug, ${styleText("yellow", "warn")})`)),
1860
+ logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${styleText$1("dim", "silent")}, ${styleText$1(["underline", "gray"], "info")}, debug, ${styleText$1("yellow", "warn")})`)),
1878
1861
  onLog: optional(OnLogSchema),
1879
1862
  onwarn: optional(OnwarnSchema),
1880
1863
  moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
@@ -1899,14 +1882,9 @@ const InputOptionsSchema = strictObject({
1899
1882
  })])),
1900
1883
  nativeMagicString: optional(boolean())
1901
1884
  })),
1902
- define: pipe(optional(record(string(), string())), description("Define global variables")),
1903
- inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
1904
- profilerNames: optional(boolean()),
1905
1885
  transform: optional(TransformOptionsSchema),
1906
1886
  watch: optional(union([WatchOptionsSchema, literal(false)])),
1907
- dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
1908
1887
  checks: optional(ChecksOptionsSchema),
1909
- keepNames: pipe(optional(boolean()), description("Keep function/class name")),
1910
1888
  debug: pipe(optional(object({ sessionId: pipe(optional(string()), description("Used to name the build.")) })), description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.")),
1911
1889
  preserveEntrySignatures: pipe(optional(union([
1912
1890
  literal("strict"),
@@ -1919,7 +1897,6 @@ const InputOptionsSchema = strictObject({
1919
1897
  const InputCliOverrideSchema = strictObject({
1920
1898
  input: pipe(optional(array(string())), description("Entry file")),
1921
1899
  external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
1922
- inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
1923
1900
  treeshake: pipe(optional(boolean()), description("enable treeshaking")),
1924
1901
  makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
1925
1902
  preserveEntrySignatures: pipe(optional(literal(false)), description("Avoid facade chunks for entry points")),
@@ -1934,7 +1911,6 @@ const InputCliOptionsSchema = omit(strictObject({
1934
1911
  "onLog",
1935
1912
  "resolve",
1936
1913
  "experimental",
1937
- "profilerNames",
1938
1914
  "watch"
1939
1915
  ]);
1940
1916
  const ModuleFormatSchema = union([
@@ -1994,18 +1970,18 @@ const OutputOptionsSchema = strictObject({
1994
1970
  literal("named"),
1995
1971
  literal("default"),
1996
1972
  literal("none")
1997
- ])), description(`Specify a export mode (${styleText("underline", "auto")}, named, default, none)`)),
1973
+ ])), description(`Specify a export mode (${styleText$1("underline", "auto")}, named, default, none)`)),
1998
1974
  hashCharacters: pipe(optional(union([
1999
1975
  literal("base64"),
2000
1976
  literal("base36"),
2001
1977
  literal("hex")
2002
1978
  ])), description("Use the specified character set for file hashes")),
2003
- format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${styleText("underline", "esm")}, cjs, and iife)`)),
1979
+ format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${styleText$1("underline", "esm")}, cjs, and iife)`)),
2004
1980
  sourcemap: pipe(optional(union([
2005
1981
  boolean(),
2006
1982
  literal("inline"),
2007
1983
  literal("hidden")
2008
- ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${styleText("bold", "pass the `-s` on the last argument if you want to generate `.map` file")})`)),
1984
+ ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${styleText$1("bold", "pass the `-s` on the last argument if you want to generate `.map` file")})`)),
2009
1985
  sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
2010
1986
  sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2011
1987
  sourcemapIgnoreList: optional(union([
@@ -2052,7 +2028,7 @@ const OutputOptionsSchema = strictObject({
2052
2028
  keepNames: pipe(optional(boolean()), description("Keep function and class names after bundling"))
2053
2029
  });
2054
2030
  const getAddonDescription = (placement, wrapper) => {
2055
- return `Code to insert the ${styleText("bold", placement)} of the bundled file (${styleText("bold", wrapper)} the wrapper function)`;
2031
+ return `Code to insert the ${styleText$1("bold", placement)} of the bundled file (${styleText$1("bold", wrapper)} the wrapper function)`;
2056
2032
  };
2057
2033
  const OutputCliOverrideSchema = strictObject({
2058
2034
  assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
@@ -2136,33 +2112,72 @@ function getCliSchemaInfo() {
2136
2112
  }
2137
2113
 
2138
2114
  //#endregion
2139
- //#region src/decorators/lazy.ts
2115
+ //#region src/types/plain-object-like.ts
2140
2116
  const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
2141
- const LAZY_CACHE_PREFIX = "__cached_";
2142
2117
  /**
2143
- * Legacy decorator that makes a getter lazy-evaluated and cached.
2144
- * Also auto-registers the field for batch prefetching.
2118
+ * Base class for classes that use `@lazyProp` decorated properties.
2119
+ *
2120
+ * **Design Pattern in Rolldown:**
2121
+ * This is a common pattern in Rolldown due to its three-layer architecture:
2122
+ * TypeScript API → NAPI Bindings → Rust Core
2123
+ *
2124
+ * **Why we use getters:**
2125
+ * For performance - to lazily fetch data from Rust bindings only when needed,
2126
+ * rather than eagerly fetching all data during object construction.
2127
+ *
2128
+ * **The problem:**
2129
+ * Getters defined on class prototypes are non-enumerable by default, which breaks:
2130
+ * - Object spread operators ({...obj})
2131
+ * - Object.keys() and similar methods
2132
+ * - Standard JavaScript object semantics
2133
+ *
2134
+ * **The solution:**
2135
+ * This base class automatically converts `@lazyProp` decorated getters into
2136
+ * own enumerable getters on each instance during construction.
2137
+ *
2138
+ * **Result:**
2139
+ * Objects get both lazy-loading performance benefits AND plain JavaScript object behavior.
2145
2140
  *
2146
2141
  * @example
2147
2142
  * ```typescript
2148
- * class MyClass {
2149
- * @lazy
2150
- * get expensiveValue() {
2151
- * return someExpensiveComputation();
2143
+ * class MyClass extends PlainObjectLike {
2144
+ * @lazyProp
2145
+ * get myProp() {
2146
+ * return fetchFromRustBinding();
2152
2147
  * }
2153
2148
  * }
2154
2149
  * ```
2155
2150
  */
2156
- function lazy(target, propertyKey, descriptor) {
2157
- if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Set();
2158
- target.constructor[LAZY_FIELDS_KEY].add(propertyKey);
2159
- const originalGetter = descriptor.get;
2160
- const cacheKey = LAZY_CACHE_PREFIX + propertyKey;
2161
- descriptor.get = function() {
2162
- if (!(cacheKey in this)) this[cacheKey] = originalGetter.call(this);
2163
- return this[cacheKey];
2164
- };
2165
- return descriptor;
2151
+ var PlainObjectLike = class {
2152
+ constructor() {
2153
+ setupLazyProperties(this);
2154
+ }
2155
+ };
2156
+ /**
2157
+ * Set up lazy properties as own getters on an instance.
2158
+ * This is called automatically by the `PlainObjectLike` base class constructor.
2159
+ *
2160
+ * @param instance - The instance to set up lazy properties on
2161
+ * @internal
2162
+ */
2163
+ function setupLazyProperties(instance$1) {
2164
+ const lazyFields = instance$1.constructor[LAZY_FIELDS_KEY];
2165
+ if (!lazyFields) return;
2166
+ for (const [propertyKey, originalGetter] of lazyFields.entries()) {
2167
+ let cachedValue;
2168
+ let hasValue = false;
2169
+ Object.defineProperty(instance$1, propertyKey, {
2170
+ get() {
2171
+ if (!hasValue) {
2172
+ cachedValue = originalGetter.call(this);
2173
+ hasValue = true;
2174
+ }
2175
+ return cachedValue;
2176
+ },
2177
+ enumerable: true,
2178
+ configurable: true
2179
+ });
2180
+ }
2166
2181
  }
2167
2182
  /**
2168
2183
  * Get all lazy field names from a class instance.
@@ -2171,28 +2186,46 @@ function lazy(target, propertyKey, descriptor) {
2171
2186
  * @returns Set of lazy property names
2172
2187
  */
2173
2188
  function getLazyFields(instance$1) {
2174
- return instance$1.constructor[LAZY_FIELDS_KEY] || /* @__PURE__ */ new Set();
2189
+ const lazyFields = instance$1.constructor[LAZY_FIELDS_KEY];
2190
+ return lazyFields ? new Set(lazyFields.keys()) : /* @__PURE__ */ new Set();
2175
2191
  }
2176
2192
 
2177
2193
  //#endregion
2178
- //#region src/decorators/non-enumerable.ts
2194
+ //#region src/decorators/lazy.ts
2179
2195
  /**
2180
- * Decorator that makes a property or method non-enumerable.
2181
- * This hides the property from enumeration (e.g., Object.keys(), for...in loops).
2196
+ * Decorator that marks a getter as lazy-evaluated and cached.
2197
+ *
2198
+ * **What "lazy" means here:**
2199
+ * 1. Data is lazily fetched from Rust bindings only when the property is accessed (not eagerly on construction)
2200
+ * 2. Once fetched, the data is cached for subsequent accesses (performance optimization)
2201
+ * 3. Despite being a getter, it behaves like a plain object property (enumerable, appears in Object.keys())
2202
+ *
2203
+ * **Important**: Properties decorated with `@lazyProp` are defined as own enumerable
2204
+ * properties on each instance (not on the prototype). This ensures they:
2205
+ * - Appear in Object.keys() and Object.getOwnPropertyNames()
2206
+ * - Are included in object spreads ({...obj})
2207
+ * - Are enumerable in for...in loops
2208
+ *
2209
+ * Classes using this decorator must extend `PlainObjectLike` base class.
2182
2210
  *
2183
2211
  * @example
2184
2212
  * ```typescript
2185
- * class MyClass {
2186
- * @nonEnumerable
2187
- * hiddenMethod() {
2188
- * return 'This method will not show up in Object.keys()';
2213
+ * class MyClass extends PlainObjectLike {
2214
+ * @lazyProp
2215
+ * get expensiveValue() {
2216
+ * return someExpensiveComputation();
2189
2217
  * }
2190
2218
  * }
2191
2219
  * ```
2192
2220
  */
2193
- function nonEnumerable(target, propertyKey, descriptor) {
2194
- descriptor.enumerable = false;
2195
- return descriptor;
2221
+ function lazyProp(target, propertyKey, descriptor) {
2222
+ if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Map();
2223
+ const originalGetter = descriptor.get;
2224
+ target.constructor[LAZY_FIELDS_KEY].set(propertyKey, originalGetter);
2225
+ return {
2226
+ enumerable: false,
2227
+ configurable: true
2228
+ };
2196
2229
  }
2197
2230
 
2198
2231
  //#endregion
@@ -2215,9 +2248,10 @@ function __decorate(decorators, target, key, desc) {
2215
2248
 
2216
2249
  //#endregion
2217
2250
  //#region src/types/output-asset-impl.ts
2218
- var OutputAssetImpl = class {
2251
+ var OutputAssetImpl = class extends PlainObjectLike {
2219
2252
  type = "asset";
2220
2253
  constructor(bindingAsset) {
2254
+ super();
2221
2255
  this.bindingAsset = bindingAsset;
2222
2256
  }
2223
2257
  get fileName() {
@@ -2246,13 +2280,12 @@ var OutputAssetImpl = class {
2246
2280
  for (const field of getLazyFields(this)) this[field];
2247
2281
  }
2248
2282
  };
2249
- __decorate([lazy], OutputAssetImpl.prototype, "fileName", null);
2250
- __decorate([lazy], OutputAssetImpl.prototype, "originalFileName", null);
2251
- __decorate([lazy], OutputAssetImpl.prototype, "originalFileNames", null);
2252
- __decorate([lazy], OutputAssetImpl.prototype, "name", null);
2253
- __decorate([lazy], OutputAssetImpl.prototype, "names", null);
2254
- __decorate([lazy], OutputAssetImpl.prototype, "source", null);
2255
- __decorate([nonEnumerable], OutputAssetImpl.prototype, "__rolldown_external_memory_handle__", null);
2283
+ __decorate([lazyProp], OutputAssetImpl.prototype, "fileName", null);
2284
+ __decorate([lazyProp], OutputAssetImpl.prototype, "originalFileName", null);
2285
+ __decorate([lazyProp], OutputAssetImpl.prototype, "originalFileNames", null);
2286
+ __decorate([lazyProp], OutputAssetImpl.prototype, "name", null);
2287
+ __decorate([lazyProp], OutputAssetImpl.prototype, "names", null);
2288
+ __decorate([lazyProp], OutputAssetImpl.prototype, "source", null);
2256
2289
 
2257
2290
  //#endregion
2258
2291
  //#region src/utils/transform-rendered-module.ts
@@ -2321,9 +2354,10 @@ function transformChunkModules(modules) {
2321
2354
 
2322
2355
  //#endregion
2323
2356
  //#region src/types/output-chunk-impl.ts
2324
- var OutputChunkImpl = class {
2357
+ var OutputChunkImpl = class extends PlainObjectLike {
2325
2358
  type = "chunk";
2326
2359
  constructor(bindingChunk) {
2360
+ super();
2327
2361
  this.bindingChunk = bindingChunk;
2328
2362
  }
2329
2363
  get fileName() {
@@ -2377,21 +2411,20 @@ var OutputChunkImpl = class {
2377
2411
  for (const field of getLazyFields(this)) this[field];
2378
2412
  }
2379
2413
  };
2380
- __decorate([lazy], OutputChunkImpl.prototype, "fileName", null);
2381
- __decorate([lazy], OutputChunkImpl.prototype, "name", null);
2382
- __decorate([lazy], OutputChunkImpl.prototype, "exports", null);
2383
- __decorate([lazy], OutputChunkImpl.prototype, "isEntry", null);
2384
- __decorate([lazy], OutputChunkImpl.prototype, "facadeModuleId", null);
2385
- __decorate([lazy], OutputChunkImpl.prototype, "isDynamicEntry", null);
2386
- __decorate([lazy], OutputChunkImpl.prototype, "sourcemapFileName", null);
2387
- __decorate([lazy], OutputChunkImpl.prototype, "preliminaryFileName", null);
2388
- __decorate([lazy], OutputChunkImpl.prototype, "code", null);
2389
- __decorate([lazy], OutputChunkImpl.prototype, "modules", null);
2390
- __decorate([lazy], OutputChunkImpl.prototype, "imports", null);
2391
- __decorate([lazy], OutputChunkImpl.prototype, "dynamicImports", null);
2392
- __decorate([lazy], OutputChunkImpl.prototype, "moduleIds", null);
2393
- __decorate([lazy], OutputChunkImpl.prototype, "map", null);
2394
- __decorate([nonEnumerable], OutputChunkImpl.prototype, "__rolldown_external_memory_handle__", null);
2414
+ __decorate([lazyProp], OutputChunkImpl.prototype, "fileName", null);
2415
+ __decorate([lazyProp], OutputChunkImpl.prototype, "name", null);
2416
+ __decorate([lazyProp], OutputChunkImpl.prototype, "exports", null);
2417
+ __decorate([lazyProp], OutputChunkImpl.prototype, "isEntry", null);
2418
+ __decorate([lazyProp], OutputChunkImpl.prototype, "facadeModuleId", null);
2419
+ __decorate([lazyProp], OutputChunkImpl.prototype, "isDynamicEntry", null);
2420
+ __decorate([lazyProp], OutputChunkImpl.prototype, "sourcemapFileName", null);
2421
+ __decorate([lazyProp], OutputChunkImpl.prototype, "preliminaryFileName", null);
2422
+ __decorate([lazyProp], OutputChunkImpl.prototype, "code", null);
2423
+ __decorate([lazyProp], OutputChunkImpl.prototype, "modules", null);
2424
+ __decorate([lazyProp], OutputChunkImpl.prototype, "imports", null);
2425
+ __decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
2426
+ __decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
2427
+ __decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
2395
2428
 
2396
2429
  //#endregion
2397
2430
  //#region src/types/sourcemap.ts
@@ -2571,8 +2604,9 @@ function collectChangedBundle(changed, bundle) {
2571
2604
 
2572
2605
  //#endregion
2573
2606
  //#region src/types/rolldown-output-impl.ts
2574
- var RolldownOutputImpl = class {
2607
+ var RolldownOutputImpl = class extends PlainObjectLike {
2575
2608
  constructor(bindingOutputs) {
2609
+ super();
2576
2610
  this.bindingOutputs = bindingOutputs;
2577
2611
  }
2578
2612
  get output() {
@@ -2590,8 +2624,7 @@ var RolldownOutputImpl = class {
2590
2624
  return { freed: true };
2591
2625
  }
2592
2626
  };
2593
- __decorate([lazy], RolldownOutputImpl.prototype, "output", null);
2594
- __decorate([nonEnumerable], RolldownOutputImpl.prototype, "__rolldown_external_memory_handle__", null);
2627
+ __decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
2595
2628
 
2596
2629
  //#endregion
2597
2630
  //#region src/utils/error.ts
@@ -3585,9 +3618,10 @@ function wrapHandlers(plugin) {
3585
3618
 
3586
3619
  //#endregion
3587
3620
  //#region src/options/normalized-input-options.ts
3588
- var NormalizedInputOptionsImpl = class {
3621
+ var NormalizedInputOptionsImpl = class extends PlainObjectLike {
3589
3622
  inner;
3590
3623
  constructor(inner, onLog) {
3624
+ super();
3591
3625
  this.onLog = onLog;
3592
3626
  this.inner = inner;
3593
3627
  }
@@ -3607,11 +3641,17 @@ var NormalizedInputOptionsImpl = class {
3607
3641
  return this.inner.context;
3608
3642
  }
3609
3643
  };
3644
+ __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "shimMissingExports", null);
3645
+ __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "input", null);
3646
+ __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "cwd", null);
3647
+ __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "platform", null);
3648
+ __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "context", null);
3610
3649
 
3611
3650
  //#endregion
3612
3651
  //#region src/options/normalized-output-options.ts
3613
- var NormalizedOutputOptionsImpl = class {
3652
+ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
3614
3653
  constructor(inner, outputOptions, normalizedOutputPlugins) {
3654
+ super();
3615
3655
  this.inner = inner;
3616
3656
  this.outputOptions = outputOptions;
3617
3657
  this.normalizedOutputPlugins = normalizedOutputPlugins;
@@ -3731,6 +3771,42 @@ var NormalizedOutputOptionsImpl = class {
3731
3771
  return this.inner.minifyInternalExports ?? false;
3732
3772
  }
3733
3773
  };
3774
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "dir", null);
3775
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "entryFileNames", null);
3776
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "chunkFileNames", null);
3777
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "assetFileNames", null);
3778
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
3779
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
3780
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
3781
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
3782
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssEntryFileNames", null);
3783
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssChunkFileNames", null);
3784
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
3785
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
3786
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "file", null);
3787
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "inlineDynamicImports", null);
3788
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "externalLiveBindings", null);
3789
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "banner", null);
3790
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "footer", null);
3791
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "intro", null);
3792
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "outro", null);
3793
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "esModule", null);
3794
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "extend", null);
3795
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "globals", null);
3796
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "paths", null);
3797
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "hashCharacters", null);
3798
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapDebugIds", null);
3799
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapIgnoreList", null);
3800
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapPathTransform", null);
3801
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minify", null);
3802
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "legalComments", null);
3803
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "polyfillRequire", null);
3804
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "plugins", null);
3805
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModules", null);
3806
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModulesRoot", null);
3807
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "virtualDirname", null);
3808
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "topLevelVar", null);
3809
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minifyInternalExports", null);
3734
3810
  function normalizeAddon(value) {
3735
3811
  if (typeof value === "function") return value;
3736
3812
  return () => value || "";
@@ -3833,17 +3909,6 @@ var PluginContextData = class {
3833
3909
  }
3834
3910
  };
3835
3911
 
3836
- //#endregion
3837
- //#region src/utils/normalize-string-or-regex.ts
3838
- function normalizedStringOrRegex(pattern) {
3839
- if (!pattern) return;
3840
- if (!isReadonlyArray(pattern)) return [pattern];
3841
- return pattern;
3842
- }
3843
- function isReadonlyArray(input) {
3844
- return Array.isArray(input);
3845
- }
3846
-
3847
3912
  //#endregion
3848
3913
  //#region src/utils/normalize-transform-options.ts
3849
3914
  /**
@@ -3851,26 +3916,11 @@ function isReadonlyArray(input) {
3851
3916
  *
3852
3917
  * Prioritizes values from `transform.define`, `transform.inject`, and `transform.dropLabels` over deprecated top-level options.
3853
3918
  */
3854
- function normalizeTransformOptions(inputOptions, onLog) {
3919
+ function normalizeTransformOptions(inputOptions) {
3855
3920
  const transform = inputOptions.transform;
3856
- let define;
3857
- if (transform?.define) define = Object.entries(transform.define);
3858
- else if (inputOptions.define) {
3859
- onLog(LOG_LEVEL_WARN, logDeprecatedDefine());
3860
- define = Object.entries(inputOptions.define);
3861
- }
3862
- let inject;
3863
- if (transform?.inject) inject = transform.inject;
3864
- else if (inputOptions.inject) {
3865
- onLog(LOG_LEVEL_WARN, logDeprecatedInject());
3866
- inject = inputOptions.inject;
3867
- }
3868
- let dropLabels;
3869
- if (transform?.dropLabels) dropLabels = transform.dropLabels;
3870
- else if (inputOptions.dropLabels) {
3871
- onLog(LOG_LEVEL_WARN, logDeprecatedDropLabels());
3872
- dropLabels = inputOptions.dropLabels;
3873
- }
3921
+ const define = transform?.define ? Object.entries(transform.define) : void 0;
3922
+ const inject = transform?.inject;
3923
+ const dropLabels = transform?.dropLabels;
3874
3924
  let oxcTransformOptions;
3875
3925
  if (transform) {
3876
3926
  const { define: _define, inject: _inject, dropLabels: _dropLabels,...rest } = transform;
@@ -3896,19 +3946,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3896
3946
  if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
3897
3947
  return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
3898
3948
  });
3899
- const normalizedTransform = normalizeTransformOptions(inputOptions, onLog);
3900
- let profilerNames;
3901
- if (outputOptions.generatedCode?.profilerNames !== void 0) profilerNames = outputOptions.generatedCode.profilerNames;
3902
- else if (inputOptions.profilerNames !== void 0) {
3903
- onLog(LOG_LEVEL_WARN, logDeprecatedProfilerNames());
3904
- profilerNames = inputOptions.profilerNames;
3905
- }
3906
- let keepNames;
3907
- if (outputOptions.keepNames !== void 0) keepNames = outputOptions.keepNames;
3908
- else if (inputOptions.keepNames !== void 0) {
3909
- onLog(LOG_LEVEL_WARN, logDeprecatedKeepNames());
3910
- keepNames = inputOptions.keepNames;
3911
- }
3949
+ const normalizedTransform = normalizeTransformOptions(inputOptions);
3912
3950
  return {
3913
3951
  input: bindingifyInput(inputOptions.input),
3914
3952
  plugins,
@@ -3924,11 +3962,11 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3924
3962
  define: normalizedTransform.define,
3925
3963
  inject: bindingifyInject(normalizedTransform.inject),
3926
3964
  experimental: bindingifyExperimental(inputOptions.experimental),
3927
- profilerNames,
3965
+ profilerNames: outputOptions.generatedCode?.profilerNames,
3928
3966
  transform: normalizedTransform.oxcTransformOptions,
3929
3967
  watch: bindingifyWatch(inputOptions.watch),
3930
3968
  dropLabels: normalizedTransform.dropLabels,
3931
- keepNames,
3969
+ keepNames: outputOptions.keepNames,
3932
3970
  checks: inputOptions.checks,
3933
3971
  deferSyncScanData: () => {
3934
3972
  let ret = [];
@@ -4344,63 +4382,52 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4344
4382
  var RolldownBuild = class RolldownBuild {
4345
4383
  #inputOptions;
4346
4384
  #bundler;
4347
- #bundlerImpl;
4385
+ #stopWorkers;
4348
4386
  static asyncRuntimeShutdown = false;
4349
4387
  constructor(inputOptions) {
4350
4388
  this.#inputOptions = inputOptions;
4351
4389
  this.#bundler = new BindingBundler();
4352
4390
  }
4353
4391
  get closed() {
4354
- return this.#bundlerImpl?.impl.closed ?? true;
4355
- }
4356
- async #getBundlerWithStopWorker(outputOptions) {
4357
- if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
4358
- const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
4359
- if (RolldownBuild.asyncRuntimeShutdown) startAsyncRuntime();
4360
- try {
4361
- return this.#bundlerImpl = {
4362
- impl: this.#bundler.createImpl(option.bundlerOptions),
4363
- stopWorkers: option.stopWorkers,
4364
- shutdown: () => {
4365
- shutdownAsyncRuntime();
4366
- RolldownBuild.asyncRuntimeShutdown = true;
4367
- }
4368
- };
4369
- } catch (e$1) {
4370
- await option.stopWorkers?.();
4371
- throw e$1;
4372
- }
4373
- }
4374
- async scan() {
4375
- const { impl } = await this.#getBundlerWithStopWorker({});
4376
- unwrapBindingResult(await impl.scan());
4392
+ return this.#bundler.closed;
4377
4393
  }
4378
4394
  async generate(outputOptions = {}) {
4379
- validateOption("output", outputOptions);
4380
- const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4381
- return new RolldownOutputImpl(unwrapBindingResult(await impl.generate()));
4395
+ return this.#build(false, outputOptions);
4382
4396
  }
4383
4397
  async write(outputOptions = {}) {
4384
- validateOption("output", outputOptions);
4385
- const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4386
- return new RolldownOutputImpl(unwrapBindingResult(await impl.write()));
4398
+ return this.#build(true, outputOptions);
4387
4399
  }
4388
4400
  /**
4389
4401
  * Close the build and free resources.
4390
4402
  */
4391
4403
  async close() {
4392
- if (this.#bundlerImpl) {
4393
- await this.#bundlerImpl.stopWorkers?.();
4394
- await this.#bundlerImpl.impl.close();
4395
- this.#bundlerImpl.shutdown();
4396
- this.#bundlerImpl = void 0;
4397
- }
4404
+ await this.#stopWorkers?.();
4405
+ await this.#bundler.close();
4406
+ shutdownAsyncRuntime();
4407
+ RolldownBuild.asyncRuntimeShutdown = true;
4408
+ this.#stopWorkers = void 0;
4398
4409
  }
4399
4410
  async [Symbol.asyncDispose]() {
4400
4411
  await this.close();
4401
4412
  }
4402
4413
  get watchFiles() {
4403
- return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
4414
+ return Promise.resolve(this.#bundler.getWatchFiles());
4415
+ }
4416
+ async #build(isWrite, outputOptions) {
4417
+ validateOption("output", outputOptions);
4418
+ await this.#stopWorkers?.();
4419
+ const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
4420
+ if (RolldownBuild.asyncRuntimeShutdown) startAsyncRuntime();
4421
+ try {
4422
+ this.#stopWorkers = option.stopWorkers;
4423
+ let output;
4424
+ if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
4425
+ else output = await this.#bundler.generate(option.bundlerOptions);
4426
+ return new RolldownOutputImpl(unwrapBindingResult(output));
4427
+ } catch (e$1) {
4428
+ await option.stopWorkers?.();
4429
+ throw e$1;
4430
+ }
4404
4431
  }
4405
4432
  };
4406
4433
 
@@ -4567,4 +4594,4 @@ function defineConfig(config) {
4567
4594
  const VERSION = version;
4568
4595
 
4569
4596
  //#endregion
4570
- export { version as C, description$1 as S, getOutputCliKeys as _, build as a, BuiltinPlugin as b, createBundlerOptions as c, bindingifyPlugin as d, normalizeBindingResult as f, getInputCliKeys as g, getCliSchemaInfo as h, watch as i, normalizedStringOrRegex as l, bindingifySourcemap$1 as m, VERSION as n, rolldown as o, transformToRollupOutput as p, defineConfig as r, RolldownBuild as s, BindingMagicString$1 as t, PluginContextData as u, validateCliOptions as v, onExit as w, makeBuiltinPluginCallable as x, PluginDriver as y };
4597
+ export { version as C, description$1 as S, getOutputCliKeys as _, build as a, styleText$1 as b, createBundlerOptions as c, normalizeBindingResult as d, unwrapBindingResult as f, getInputCliKeys as g, getCliSchemaInfo as h, watch as i, PluginContextData as l, bindingifySourcemap$1 as m, VERSION as n, rolldown as o, transformToRollupOutput as p, defineConfig as r, RolldownBuild as s, BindingMagicString$1 as t, bindingifyPlugin as u, validateCliOptions as v, onExit as w, PluginDriver as x, validateOption as y };