@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,6 +1,6 @@
1
1
  import * as _oxc_project_types0 from "@oxc-project/types";
2
2
 
3
- //#region src/binding.d.ts
3
+ //#region src/binding.d.cts
4
4
  type MaybePromise<T> = T | Promise<T>;
5
5
  type VoidNullable<T = void> = T | null | undefined | void;
6
6
  type BindingStringOrRegex = string | RegExp;
@@ -67,6 +67,14 @@ interface CompressOptions {
67
67
  * @default true
68
68
  */
69
69
  sequences?: boolean;
70
+ /**
71
+ * Set of label names to drop from the code.
72
+ *
73
+ * Labeled statements matching these names will be removed during minification.
74
+ *
75
+ * @default []
76
+ */
77
+ dropLabels?: Array<string>;
70
78
  /** Limit the maximum number of iterations for debugging purpose. */
71
79
  maxIterations?: number;
72
80
  }
@@ -394,11 +402,11 @@ type ModuleType = 'module' | 'commonjs' | 'json' | 'wasm' | 'addon';
394
402
  */
395
403
  interface NapiResolveOptions {
396
404
  /**
397
- * Path to TypeScript configuration file.
405
+ * Discover tsconfig automatically or use the specified tsconfig.json path.
398
406
  *
399
407
  * Default `None`
400
408
  */
401
- tsconfig?: TsconfigOptions;
409
+ tsconfig?: 'auto' | TsconfigOptions;
402
410
  /**
403
411
  * Alias for [ResolveOptions::alias] and [ResolveOptions::fallback].
404
412
  *
@@ -1198,32 +1206,30 @@ declare class BindingMagicString {
1198
1206
  isEmpty(): boolean;
1199
1207
  }
1200
1208
  declare class BindingOutputAsset {
1201
- get fileName(): string;
1202
- get originalFileName(): string | null;
1203
- get originalFileNames(): Array<string>;
1204
- get source(): BindingAssetSource;
1205
- get name(): string | null;
1206
- get names(): Array<string>;
1209
+ dropInner(): ExternalMemoryStatus;
1210
+ getFileName(): string;
1211
+ getOriginalFileName(): string | null;
1212
+ getOriginalFileNames(): Array<string>;
1213
+ getSource(): BindingAssetSource;
1214
+ getName(): string | null;
1215
+ getNames(): Array<string>;
1207
1216
  }
1208
1217
  declare class BindingOutputChunk {
1209
- get isEntry(): boolean;
1210
- get isDynamicEntry(): boolean;
1211
- get facadeModuleId(): string | null;
1212
- get moduleIds(): Array<string>;
1213
- get exports(): Array<string>;
1214
- get fileName(): string;
1215
- get modules(): BindingModules;
1216
- get imports(): Array<string>;
1217
- get dynamicImports(): Array<string>;
1218
- get code(): string;
1219
- get map(): string | null;
1220
- get sourcemapFileName(): string | null;
1221
- get preliminaryFileName(): string;
1222
- get name(): string;
1223
- }
1224
- declare class BindingOutputs {
1225
- get chunks(): Array<BindingOutputChunk>;
1226
- get assets(): Array<BindingOutputAsset>;
1218
+ dropInner(): ExternalMemoryStatus;
1219
+ getIsEntry(): boolean;
1220
+ getIsDynamicEntry(): boolean;
1221
+ getFacadeModuleId(): string | null;
1222
+ getModuleIds(): Array<string>;
1223
+ getExports(): Array<string>;
1224
+ getFileName(): string;
1225
+ getModules(): BindingModules;
1226
+ getImports(): Array<string>;
1227
+ getDynamicImports(): Array<string>;
1228
+ getCode(): string;
1229
+ getMap(): string | null;
1230
+ getSourcemapFileName(): string | null;
1231
+ getPreliminaryFileName(): string;
1232
+ getName(): string;
1227
1233
  }
1228
1234
  declare class BindingRenderedChunk {
1229
1235
  get name(): string;
@@ -1265,7 +1271,7 @@ interface BindingAssetPluginConfig {
1265
1271
  isSkipAssets: boolean;
1266
1272
  assetsInclude: Array<BindingStringOrRegex>;
1267
1273
  assetInlineLimit: number | ((file: string, content: Buffer) => boolean | undefined);
1268
- renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => MaybePromise<VoidNullable<string | BindingRenderBuiltUrlRet>>;
1274
+ renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => Promise<undefined | string | BindingRenderBuiltUrlRet>;
1269
1275
  }
1270
1276
  interface BindingAssetSource {
1271
1277
  inner: string | Uint8Array;
@@ -1276,6 +1282,7 @@ interface BindingBuildImportAnalysisPluginConfig {
1276
1282
  optimizeModulePreloadRelativePaths: boolean;
1277
1283
  renderBuiltUrl: boolean;
1278
1284
  isRelativeBase: boolean;
1285
+ isTestV2?: boolean;
1279
1286
  }
1280
1287
  type BindingBuiltinPluginName = 'builtin:alias' | 'builtin:asset' | 'builtin:asset-import-meta-url' | 'builtin:build-import-analysis' | 'builtin:dynamic-import-vars' | 'builtin:esm-external-require' | 'builtin:import-glob' | 'builtin:isolated-declaration' | 'builtin:json' | 'builtin:load-fallback' | 'builtin:manifest' | 'builtin:module-preload-polyfill' | 'builtin:react-refresh-wrapper' | 'builtin:reporter' | 'builtin:replace' | 'builtin:transform' | 'builtin:vite-css' | 'builtin:vite-css-post' | 'builtin:vite-html' | 'builtin:vite-resolve' | 'builtin:wasm-fallback' | 'builtin:wasm-helper' | 'builtin:web-worker-post';
1281
1288
  interface BindingClientHmrUpdate {
@@ -1356,7 +1363,7 @@ interface BindingManifestPluginConfig {
1356
1363
  root: string;
1357
1364
  outPath: string;
1358
1365
  isLegacy?: () => boolean;
1359
- cssEntries: () => Set<string>;
1366
+ cssEntries: () => Record<string, string>;
1360
1367
  }
1361
1368
  interface BindingModulePreloadPolyfillPluginConfig {
1362
1369
  isServer?: boolean;
@@ -1365,6 +1372,10 @@ interface BindingModules {
1365
1372
  values: Array<BindingRenderedModule>;
1366
1373
  keys: Array<string>;
1367
1374
  }
1375
+ interface BindingOutputs {
1376
+ chunks: Array<BindingOutputChunk>;
1377
+ assets: Array<BindingOutputAsset>;
1378
+ }
1368
1379
  interface BindingReactRefreshWrapperPluginConfig {
1369
1380
  cwd: string;
1370
1381
  include?: Array<BindingStringOrRegex>;
@@ -1443,7 +1454,7 @@ interface BindingViteCssPostPluginConfig {
1443
1454
  libCssFilename?: string;
1444
1455
  isLegacy?: () => boolean;
1445
1456
  cssMinify?: (css: string) => Promise<string>;
1446
- renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => MaybePromise<VoidNullable<string | BindingRenderBuiltUrlRet>>;
1457
+ renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => Promise<undefined | string | BindingRenderBuiltUrlRet>;
1447
1458
  }
1448
1459
  interface BindingViteHtmlPluginConfig {
1449
1460
  isLib: boolean;
@@ -1454,7 +1465,7 @@ interface BindingViteHtmlPluginConfig {
1454
1465
  cssCodeSplit: boolean;
1455
1466
  modulePreloadPolyfill: boolean;
1456
1467
  assetInlineLimit: number | ((file: string, content: Buffer) => boolean | undefined);
1457
- renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => MaybePromise<VoidNullable<string | BindingRenderBuiltUrlRet>>;
1468
+ renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => Promise<undefined | string | BindingRenderBuiltUrlRet>;
1458
1469
  resolveDependencies?: boolean | ((filename: string, dependencies: string[], context: {
1459
1470
  hostId: string;
1460
1471
  hostType: 'html' | 'js';
@@ -1468,6 +1479,7 @@ interface BindingViteResolvePluginConfig {
1468
1479
  external: true | string[];
1469
1480
  noExternal: true | Array<string | RegExp>;
1470
1481
  dedupe: Array<string>;
1482
+ legacyInconsistentCjsInterop?: boolean;
1471
1483
  finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>;
1472
1484
  finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>;
1473
1485
  resolveSubpathImports: (id: string, importer: string, isRequire: boolean, scan: boolean) => VoidNullable<string>;
@@ -1494,6 +1506,10 @@ interface BindingViteResolvePluginResolveOptions {
1494
1506
  interface BindingWasmHelperPluginConfig {
1495
1507
  decodedBase: string;
1496
1508
  }
1509
+ interface ExternalMemoryStatus {
1510
+ freed: boolean;
1511
+ reason?: string;
1512
+ }
1497
1513
  /** Error emitted from native side, it only contains kind and message, no stack trace. */
1498
1514
  interface NativeError {
1499
1515
  kind: string;
@@ -1508,4 +1524,4 @@ interface PreRenderedChunk {
1508
1524
  exports: Array<string>;
1509
1525
  }
1510
1526
  //#endregion
1511
- export { IsolatedDeclarationsResult as A, TransformResult as B, BindingViteCssPluginConfig as C, BindingWasmHelperPluginConfig as D, BindingViteResolvePluginConfig as E, ParserOptions as F, moduleRunnerTransform as H, PreRenderedChunk as I, ResolveResult as L, MinifyOptions as M, NapiResolveOptions as N, BindingWatcherEvent as O, ParseResult as P, ResolverFactory as R, BindingUrlResolver as S, BindingViteHtmlPluginConfig as T, transform as U, isolatedDeclaration as V, BindingRenderedChunk as _, BindingClientHmrUpdate as a, BindingTransformHookExtraArgs as b, BindingHookResolveIdExtraArgs as c, BindingJsonPluginConfig as d, BindingMagicString as f, BindingRebuildStrategy as g, BindingReactRefreshWrapperPluginConfig as h, BindingBundlerImpl as i, JsxOptions as j, IsolatedDeclarationsOptions as k, BindingImportGlobPluginConfig as l, BindingModulePreloadPolyfillPluginConfig as m, BindingBuildImportAnalysisPluginConfig as n, BindingDynamicImportVarsPluginConfig as o, BindingManifestPluginConfig as p, BindingBuiltinPluginName as r, BindingEsmExternalRequirePluginConfig as s, BindingAssetPluginConfig as t, BindingIsolatedDeclarationPluginConfig as u, BindingReplacePluginConfig as v, BindingViteCssPostPluginConfig as w, BindingTransformPluginConfig as x, BindingReporterPluginConfig as y, TransformOptions as z };
1527
+ export { IsolatedDeclarationsOptions as A, TransformOptions as B, BindingViteCssPluginConfig as C, BindingWasmHelperPluginConfig as D, BindingViteResolvePluginConfig as E, ParseResult as F, isolatedDeclaration as H, ParserOptions as I, PreRenderedChunk as L, JsxOptions as M, MinifyOptions as N, BindingWatcherEvent as O, NapiResolveOptions as P, ResolveResult as R, BindingUrlResolver as S, BindingViteHtmlPluginConfig as T, moduleRunnerTransform as U, TransformResult as V, transform as W, BindingRenderedChunk as _, BindingClientHmrUpdate as a, BindingTransformHookExtraArgs as b, BindingHookResolveIdExtraArgs as c, BindingJsonPluginConfig as d, BindingMagicString as f, BindingRebuildStrategy as g, BindingReactRefreshWrapperPluginConfig as h, BindingBundlerImpl as i, IsolatedDeclarationsResult as j, ExternalMemoryStatus as k, BindingImportGlobPluginConfig as l, BindingModulePreloadPolyfillPluginConfig as m, BindingBuildImportAnalysisPluginConfig as n, BindingDynamicImportVarsPluginConfig as o, BindingManifestPluginConfig as p, BindingBuiltinPluginName as r, BindingEsmExternalRequirePluginConfig as s, BindingAssetPluginConfig as t, BindingIsolatedDeclarationPluginConfig as u, BindingReplacePluginConfig as v, BindingViteCssPostPluginConfig as w, BindingTransformPluginConfig as x, BindingReporterPluginConfig as y, ResolverFactory as z };
@@ -19,7 +19,7 @@ function unsupported(info) {
19
19
  function noop(..._args) {}
20
20
 
21
21
  //#endregion
22
- //#region ../pluginutils/dist/index.mjs
22
+ //#region ../pluginutils/dist/composable-filters.js
23
23
  var And = class {
24
24
  kind;
25
25
  args;
@@ -1,4 +1,4 @@
1
- import { F as ParserOptions, I as PreRenderedChunk, M as MinifyOptions$1, O as BindingWatcherEvent, _ as BindingRenderedChunk, b as BindingTransformHookExtraArgs, c as BindingHookResolveIdExtraArgs, f as BindingMagicString, i as BindingBundlerImpl, j as JsxOptions, r as BindingBuiltinPluginName, z as TransformOptions$1 } from "./binding-0m41EAn-.mjs";
1
+ import { B as TransformOptions$1, I as ParserOptions, L as PreRenderedChunk, M as JsxOptions, N as MinifyOptions$1, O as BindingWatcherEvent, _ as BindingRenderedChunk, b as BindingTransformHookExtraArgs, c as BindingHookResolveIdExtraArgs, f as BindingMagicString, i as BindingBundlerImpl, k as ExternalMemoryStatus, r as BindingBuiltinPluginName } from "./binding-CCMrV5an.mjs";
2
2
  import { Program } from "@oxc-project/types";
3
3
  import { TopLevelFilterExpression } from "@rolldown/pluginutils";
4
4
 
@@ -61,8 +61,59 @@ interface ModuleInfo extends ModuleOptions {
61
61
  //#region src/utils/asset-source.d.ts
62
62
  type AssetSource = string | Uint8Array;
63
63
  //#endregion
64
+ //#region src/types/external-memory-handle.d.ts
65
+ declare const symbolForExternalMemoryHandle: "__rolldown_external_memory_handle__";
66
+ /**
67
+ * Interface for objects that hold external memory that can be explicitly freed.
68
+ */
69
+ interface ExternalMemoryHandle {
70
+ /**
71
+ * Frees the external memory held by this object.
72
+ * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory.
73
+ * This will take time but prevents errors when accessing properties after freeing.
74
+ * @returns Status object with `freed` boolean and optional `reason` string.
75
+ * @internal
76
+ */
77
+ [symbolForExternalMemoryHandle]: (keepDataAlive?: boolean) => ExternalMemoryStatus;
78
+ }
79
+ /**
80
+ * Frees the external memory held by the given handle.
81
+ *
82
+ * This is useful when you want to manually release memory held by Rust objects
83
+ * (like `OutputChunk` or `OutputAsset`) before they are garbage collected.
84
+ *
85
+ * @param handle - The object with external memory to free
86
+ * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false).
87
+ * This will take time to copy data from Rust to JavaScript, but prevents errors
88
+ * when accessing properties after the memory is freed.
89
+ * @returns Status object with `freed` boolean and optional `reason` string.
90
+ * - `{ freed: true }` if memory was successfully freed
91
+ * - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist)
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * import { freeExternalMemory } from 'rolldown/experimental';
96
+ *
97
+ * const output = await bundle.generate();
98
+ * const chunk = output.output[0];
99
+ *
100
+ * // Use the chunk...
101
+ *
102
+ * // Manually free the memory (fast, but accessing properties after will throw)
103
+ * const status = freeExternalMemory(chunk); // { freed: true }
104
+ * const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" }
105
+ *
106
+ * // Keep data alive before freeing (slower, but data remains accessible)
107
+ * freeExternalMemory(chunk, true); // Evaluates all lazy fields first
108
+ * console.log(chunk.code); // OK - data was copied to JavaScript before freeing
109
+ *
110
+ * // Without keepDataAlive, accessing chunk properties after freeing will throw an error
111
+ * ```
112
+ */
113
+ declare function freeExternalMemory(handle: ExternalMemoryHandle, keepDataAlive?: boolean): ExternalMemoryStatus;
114
+ //#endregion
64
115
  //#region src/types/rolldown-output.d.ts
65
- interface OutputAsset {
116
+ interface OutputAsset extends ExternalMemoryHandle {
66
117
  type: "asset";
67
118
  fileName: string;
68
119
  /** @deprecated Use "originalFileNames" instead. */
@@ -105,7 +156,7 @@ interface RenderedChunk extends Omit<BindingRenderedChunk, "modules"> {
105
156
  imports: Array<string>;
106
157
  dynamicImports: Array<string>;
107
158
  }
108
- interface OutputChunk {
159
+ interface OutputChunk extends ExternalMemoryHandle {
109
160
  type: "chunk";
110
161
  code: string;
111
162
  name: string;
@@ -124,7 +175,7 @@ interface OutputChunk {
124
175
  sourcemapFileName: string | null;
125
176
  preliminaryFileName: string;
126
177
  }
127
- interface RolldownOutput {
178
+ interface RolldownOutput extends ExternalMemoryHandle {
128
179
  output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
129
180
  }
130
181
  //#endregion
@@ -172,6 +223,7 @@ interface GeneratedCodeOptions {
172
223
  type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd";
173
224
  type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
174
225
  type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
226
+ type SanitizeFileNameFunction = (name: string) => string;
175
227
  interface PreRenderedAsset {
176
228
  type: "asset";
177
229
  name?: string;
@@ -181,7 +233,13 @@ interface PreRenderedAsset {
181
233
  source: string | Uint8Array;
182
234
  }
183
235
  type AssetFileNamesFunction = (chunkInfo: PreRenderedAsset) => string;
236
+ type PathsFunction$1 = (id: string) => string;
237
+ type ManualChunksFunction = (moduleId: string, meta: {
238
+ getModuleInfo: (moduleId: string) => ModuleInfo | null;
239
+ }) => string | NullValue;
184
240
  type GlobalsFunction = (name: string) => string;
241
+ type AdvancedChunksNameFunction = (moduleId: string, ctx: ChunkingContext) => string | NullValue;
242
+ type AdvancedChunksTestFunction = (id: string) => boolean | undefined | void;
185
243
  type MinifyOptions = Omit<MinifyOptions$1, "module" | "sourcemap">;
186
244
  interface ChunkingContext {
187
245
  getModuleInfo(moduleId: string): ModuleInfo | null;
@@ -248,7 +306,7 @@ interface OutputOptions {
248
306
  chunkFileNames?: string | ChunkFileNamesFunction;
249
307
  cssEntryFileNames?: string | ChunkFileNamesFunction;
250
308
  cssChunkFileNames?: string | ChunkFileNamesFunction;
251
- sanitizeFileName?: boolean | ((name: string) => string);
309
+ sanitizeFileName?: boolean | SanitizeFileNameFunction;
252
310
  /**
253
311
  * Control code minification.
254
312
  *
@@ -292,7 +350,7 @@ interface OutputOptions {
292
350
  * }
293
351
  * ```
294
352
  */
295
- paths?: Record<string, string> | ((id: string) => string);
353
+ paths?: Record<string, string> | PathsFunction$1;
296
354
  generatedCode?: Partial<GeneratedCodeOptions>;
297
355
  externalLiveBindings?: boolean;
298
356
  inlineDynamicImports?: boolean;
@@ -340,11 +398,9 @@ interface OutputOptions {
340
398
  *
341
399
  * @deprecated Please use `advancedChunks` instead.
342
400
  */
343
- manualChunks?: (moduleId: string, meta: {
344
- getModuleInfo: (moduleId: string) => ModuleInfo | null;
345
- }) => string | NullValue;
401
+ manualChunks?: ManualChunksFunction;
346
402
  /**
347
- * Allows you to do manual chunking. For deeper understanding, please refer to the in-depth [documentation](https://rolldown.rs/guide/in-depth/advanced-chunks).
403
+ * Allows you to do manual chunking. For deeper understanding, please refer to the in-depth [documentation](https://rolldown.rs/in-depth/advanced-chunks).
348
404
  */
349
405
  advancedChunks?: {
350
406
  /**
@@ -446,7 +502,7 @@ interface OutputOptions {
446
502
  * Constraints like `minSize`, `maxSize`, etc. are applied separately for different names returned by the function.
447
503
  * :::
448
504
  */
449
- name: string | ((moduleId: string, ctx: ChunkingContext) => string | NullValue);
505
+ name: string | AdvancedChunksNameFunction;
450
506
  /**
451
507
  * - Type: `string | RegExp | ((id: string) => boolean | undefined | void);`
452
508
  *
@@ -463,7 +519,7 @@ interface OutputOptions {
463
519
  * - ❌ Not recommended: `/node_modules/react/`
464
520
  * :::
465
521
  */
466
- test?: StringOrRegExp | ((id: string) => boolean | undefined | void);
522
+ test?: StringOrRegExp | AdvancedChunksTestFunction;
467
523
  /**
468
524
  * - Type: `number`
469
525
  * - Default: `0`
@@ -597,6 +653,9 @@ declare class RolldownBuild {
597
653
  scan(): Promise<void>;
598
654
  generate(outputOptions?: OutputOptions): Promise<RolldownOutput>;
599
655
  write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
656
+ /**
657
+ * Close the build and free resources.
658
+ */
600
659
  close(): Promise<void>;
601
660
  [Symbol.asyncDispose](): Promise<void>;
602
661
  get watchFiles(): Promise<string[]>;
@@ -876,7 +935,7 @@ interface PluginContext extends MinimalPluginContext {
876
935
  id: string;
877
936
  resolveDependencies?: boolean;
878
937
  } & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
879
- parse(input: string, options?: ParserOptions | undefined | null): Program;
938
+ parse(input: string, options?: ParserOptions | null): Program;
880
939
  resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
881
940
  }
882
941
  //#endregion
@@ -1276,7 +1335,8 @@ interface TransformOptions extends Omit<TransformOptions$1, "sourceType" | "lang
1276
1335
  //#endregion
1277
1336
  //#region src/options/input-options.d.ts
1278
1337
  type InputOption = string | string[] | Record<string, string>;
1279
- type ExternalOption = StringOrRegExp | StringOrRegExp[] | ((id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>);
1338
+ type ExternalOptionFunction = (id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>;
1339
+ type ExternalOption = StringOrRegExp | StringOrRegExp[] | ExternalOptionFunction;
1280
1340
  type ModuleTypes = Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css" | "asset">;
1281
1341
  interface WatcherOptions {
1282
1342
  skipWrite?: boolean;
@@ -1340,9 +1400,15 @@ type OptimizationOptions = {
1340
1400
  mode?: "all" | "smart";
1341
1401
  pass?: number;
1342
1402
  };
1403
+ /**
1404
+ * Use PIFE pattern for module wrappers
1405
+ */
1406
+ pifeForModuleWrappers?: boolean;
1343
1407
  };
1344
1408
  type AttachDebugOptions = "none" | "simple" | "full";
1345
1409
  type ChunkModulesOrder = "exec-order" | "module-id";
1410
+ type OnLogFunction = (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
1411
+ type OnwarnFunction = (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
1346
1412
  interface InputOptions {
1347
1413
  input?: InputOption;
1348
1414
  plugins?: RolldownPluginOption;
@@ -1392,8 +1458,8 @@ interface InputOptions {
1392
1458
  shimMissingExports?: boolean;
1393
1459
  treeshake?: boolean | TreeshakingOptions;
1394
1460
  logLevel?: LogLevelOption;
1395
- onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
1396
- onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
1461
+ onLog?: OnLogFunction;
1462
+ onwarn?: OnwarnFunction;
1397
1463
  moduleTypes?: ModuleTypes;
1398
1464
  experimental?: {
1399
1465
  /**
@@ -1635,4 +1701,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
1635
1701
  declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
1636
1702
  declare function defineConfig(config: ConfigExport): ConfigExport;
1637
1703
  //#endregion
1638
- export { InternalModuleFormat as $, BuiltinPlugin as A, SourceMap as At, GetModuleInfo as B, ResolveIdResult as C, PartialNull as Ct, SourceDescription as D, RenderedChunk as Dt, RolldownPluginOption as E, OutputChunk as Et, OutputBundle as F, LogOrStringHandler as Ft, PluginContextMeta as G, DefineParallelPluginResult as H, TreeshakingOptions as I, RollupError as It, ModuleTypeFilter as J, GeneralHookFilter as K, TransformPluginContext as L, RollupLog as Lt, ExistingRawSourceMap as M, SourcemapIgnoreListOption as Mt, SourceMapInput as N, LogLevel as Nt, TransformResult as O, RenderedModule as Ot, RolldownOptionsFunction as P, LogLevelOption as Pt, RolldownFsModule as Q, EmittedAsset as R, RollupLogWithString as Rt, ResolveIdExtraOptions as S, MaybePromise as St, RolldownPlugin as T, OutputAsset as Tt, defineParallelPlugin as U, PluginContext as V, MinimalPluginContext as W, RolldownDirectoryEntry as X, BufferEncoding as Y, RolldownFileStats as Z, ModuleType as _, GlobalsFunction as _t, InputOption as a, RolldownWatcher as at, PartialResolvedId as b, OutputOptions as bt, OptimizationOptions as c, rolldown as ct, CustomPluginOptions as d, build as dt, NormalizedOutputOptions as et, FunctionPluginHooks as f, AddonFunction as ft, ModuleOptions as g, GeneratedCodePreset as gt, LoadResult as h, GeneratedCodeOptions as ht, ExternalOption as i, watch as it, VERSION as j, ModuleInfo as jt, withFilter as k, RolldownOutput as kt, WatcherOptions as l, RolldownBuild as lt, ImportKind as m, ChunkingContext as mt, ConfigExport as n, LoggingFunction as nt, InputOptions as o, RolldownWatcherEvent as ot, HookFilterExtension as p, ChunkFileNamesFunction as pt, HookFilter as q, RolldownOptions as r, WarningHandlerWithDefault as rt, ModuleTypes as s, WatchOptions as st, defineConfig as t, NormalizedInputOptions as tt, AsyncPluginHooks as u, BuildOptions as ut, ObjectHook as v, MinifyOptions as vt, ResolvedId as w, StringOrRegExp as wt, Plugin as x, PreRenderedAsset as xt, ParallelPluginHooks as y, ModuleFormat as yt, EmittedFile as z };
1704
+ export { InternalModuleFormat as $, BuiltinPlugin as A, SourceMap as At, GetModuleInfo as B, ResolveIdResult as C, PartialNull as Ct, SourceDescription as D, RenderedChunk as Dt, RolldownPluginOption as E, OutputChunk as Et, OutputBundle as F, LogLevelOption as Ft, PluginContextMeta as G, DefineParallelPluginResult as H, TreeshakingOptions as I, LogOrStringHandler as It, ModuleTypeFilter as J, GeneralHookFilter as K, TransformPluginContext as L, RollupError as Lt, ExistingRawSourceMap as M, ModuleInfo as Mt, SourceMapInput as N, SourcemapIgnoreListOption as Nt, TransformResult as O, RenderedModule as Ot, RolldownOptionsFunction as P, LogLevel as Pt, RolldownFsModule as Q, EmittedAsset as R, RollupLog as Rt, ResolveIdExtraOptions as S, MaybePromise as St, RolldownPlugin as T, OutputAsset as Tt, defineParallelPlugin as U, PluginContext as V, MinimalPluginContext as W, RolldownDirectoryEntry as X, BufferEncoding as Y, RolldownFileStats as Z, ModuleType as _, GlobalsFunction as _t, InputOption as a, RolldownWatcher as at, PartialResolvedId as b, OutputOptions as bt, OptimizationOptions as c, rolldown as ct, CustomPluginOptions as d, build as dt, NormalizedOutputOptions as et, FunctionPluginHooks as f, AddonFunction as ft, ModuleOptions as g, GeneratedCodePreset as gt, LoadResult as h, GeneratedCodeOptions as ht, ExternalOption as i, watch as it, VERSION as j, freeExternalMemory as jt, withFilter as k, RolldownOutput as kt, WatcherOptions as l, RolldownBuild as lt, ImportKind as m, ChunkingContext as mt, ConfigExport as n, LoggingFunction as nt, InputOptions as o, RolldownWatcherEvent as ot, HookFilterExtension as p, ChunkFileNamesFunction as pt, HookFilter as q, RolldownOptions as r, WarningHandlerWithDefault as rt, ModuleTypes as s, WatchOptions as st, defineConfig as t, NormalizedInputOptions as tt, AsyncPluginHooks as u, BuildOptions as ut, ObjectHook as v, MinifyOptions as vt, ResolvedId as w, StringOrRegExp as wt, Plugin as x, PreRenderedAsset as xt, ParallelPluginHooks as y, ModuleFormat as yt, EmittedFile as z, RollupLogWithString as zt };
@@ -1,9 +1,9 @@
1
- import { o as rolldown } from "./src-BnIhK3nA.mjs";
1
+ import { o as rolldown } from "./src-B8saaB3b.mjs";
2
+ import fs from "node:fs";
2
3
  import path from "node:path";
3
4
  import { readdir } from "node:fs/promises";
4
5
  import { pathToFileURL } from "node:url";
5
6
  import { cwd } from "node:process";
6
- import fs from "node:fs";
7
7
 
8
8
  //#region src/utils/load-config.ts
9
9
  async function bundleTsConfig(configFile, isEsm) {
@@ -14,13 +14,13 @@ async function bundleTsConfig(configFile, isEsm) {
14
14
  input: configFile,
15
15
  platform: "node",
16
16
  resolve: { mainFields: ["main"] },
17
- define: {
17
+ transform: { define: {
18
18
  __dirname: dirnameVarName,
19
19
  __filename: filenameVarName,
20
20
  "import.meta.url": importMetaUrlVarName,
21
21
  "import.meta.dirname": dirnameVarName,
22
22
  "import.meta.filename": filenameVarName
23
- },
23
+ } },
24
24
  treeshake: false,
25
25
  external: [/^[\w@][^:]/],
26
26
  plugins: [{
@@ -1,4 +1,4 @@
1
- import { parseAsync, parseSync } from "../rolldown-binding.wasi.cjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-BeWSOIj5.mjs";
2
2
  import { styleText } from "node:util";
3
3
 
4
4
  //#region src/utils/code-frame.ts
@@ -41,6 +41,11 @@ function getCodeFrame(source, line, column) {
41
41
 
42
42
  //#endregion
43
43
  //#region src/utils/style-text.ts
44
+ /**
45
+ * Cross-platform styleText utility that works in both Node.js and browser environments
46
+ * In Node.js, it uses the native `styleText` from `node:util`
47
+ * In browser, it provides empty styling functions for compatibility
48
+ */
44
49
  function styleText$1(...args) {
45
50
  return styleText(...args);
46
51
  }
@@ -217,7 +222,7 @@ function augmentCodeLocation(properties, pos, source, id) {
217
222
  }
218
223
 
219
224
  //#endregion
220
- //#region ../../node_modules/.pnpm/oxc-parser@0.95.0/node_modules/oxc-parser/src-js/wrap.js
225
+ //#region ../../node_modules/.pnpm/oxc-parser@0.96.0/node_modules/oxc-parser/src-js/wrap.js
221
226
  function wrap$1(result) {
222
227
  let program, module, comments, errors;
223
228
  return {
@@ -250,11 +255,12 @@ function applyFix(program, fixPath) {
250
255
  if (node.bigint) node.value = BigInt(node.bigint);
251
256
  else try {
252
257
  node.value = RegExp(node.regex.pattern, node.regex.flags);
253
- } catch (_err) {}
258
+ } catch {}
254
259
  }
255
260
 
256
261
  //#endregion
257
262
  //#region src/parse-ast-index.ts
263
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
258
264
  function wrap(result, sourceText) {
259
265
  result = wrap$1(result);
260
266
  if (result.errors.length > 0) return normalizeParseError(sourceText, result.errors);
@@ -281,13 +287,13 @@ const defaultParserOptions = {
281
287
  preserveParens: false
282
288
  };
283
289
  function parseAst(sourceText, options, filename) {
284
- return wrap(parseSync(filename ?? "file.js", sourceText, {
290
+ return wrap((0, import_binding.parseSync)(filename ?? "file.js", sourceText, {
285
291
  ...defaultParserOptions,
286
292
  ...options
287
293
  }), sourceText);
288
294
  }
289
295
  async function parseAstAsync(sourceText, options, filename) {
290
- return wrap(await parseAsync(filename ?? "file.js", sourceText, {
296
+ return wrap(await (0, import_binding.parseAsync)(filename ?? "file.js", sourceText, {
291
297
  ...defaultParserOptions,
292
298
  ...options
293
299
  }), sourceText);