@rolldown/browser 1.0.3 → 1.1.1

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 +7 -7
  2. package/dist/config.d.mts +1 -1
  3. package/dist/config.mjs +2 -2
  4. package/dist/{error-DAfzPCGW.js → error-Azs8e8cN.js} +1 -1
  5. package/dist/experimental-index.browser.mjs +5 -5
  6. package/dist/experimental-index.d.mts +5 -5
  7. package/dist/experimental-index.mjs +5 -5
  8. package/dist/filter-index.d.mts +1 -104
  9. package/dist/filter-index.mjs +1 -120
  10. package/dist/index.browser.mjs +2 -2
  11. package/dist/index.d.mts +3 -3
  12. package/dist/index.mjs +3 -3
  13. package/dist/parallel-plugin-worker.mjs +1 -1
  14. package/dist/parallel-plugin.d.mts +2 -2
  15. package/dist/parse-ast-index.d.mts +1 -1
  16. package/dist/parse-ast-index.mjs +1 -1
  17. package/dist/plugins-index.d.mts +3 -3
  18. package/dist/{resolve-tsconfig-B0FaCdVd.js → resolve-tsconfig-Cmw0SAxd.js} +1 -1
  19. package/dist/rolldown-binding.wasi-browser.js +1 -1
  20. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  21. package/dist/{rolldown-build-XdM92thc.js → rolldown-build-C9wAyTYG.js} +59 -9
  22. package/dist/shared/{binding-BhK3B-Zu.d.mts → binding-BPMI4t0-.d.mts} +97 -1
  23. package/dist/shared/{bindingify-input-options-BKrzu-Ci.mjs → bindingify-input-options-EBZ5IFF2.mjs} +14 -6
  24. package/dist/shared/{constructors-CtnJN4Sg.d.mts → constructors-DAokZVCk.d.mts} +2 -2
  25. package/dist/shared/{define-config-D4nAGxn1.d.mts → define-config-Nwe1joYW.d.mts} +134 -15
  26. package/dist/shared/{composable-filters-BcLvc0mh.mjs → filter-B_mD-HGz-Cbrk-2bt.mjs} +117 -4
  27. package/dist/shared/{load-config-BXndT4NL.mjs → load-config-2QjEcEu4.mjs} +1 -1
  28. package/dist/shared/{parse-DSgaJ6oU.mjs → parse-DNkPrz4w.mjs} +1 -1
  29. package/dist/shared/{rolldown-CMk-JrOo.mjs → rolldown-Bqp7kINm.mjs} +1 -1
  30. package/dist/shared/{rolldown-build-Dh-EVzMc.mjs → rolldown-build-BgBj9qUV.mjs} +46 -4
  31. package/dist/shared/{transform-HS_zMlQ1.d.mts → transform-DulXg6tQ.d.mts} +1 -1
  32. package/dist/shared/{utils-m0ogxd-4.d.mts → utils-Bp1VejKQ.d.mts} +1 -1
  33. package/dist/shared/{watch-_n5IfB8D.mjs → watch-C6WxUyjE.mjs} +3 -3
  34. package/dist/utils-index.browser.mjs +5 -5
  35. package/dist/utils-index.d.mts +3 -3
  36. package/dist/utils-index.mjs +4 -4
  37. package/package.json +10 -5
@@ -1338,7 +1338,7 @@ interface CompressOptions {
1338
1338
  *
1339
1339
  * @default 'esnext'
1340
1340
  *
1341
- * @see [esbuild#target](https://esbuild.github.io/api/#target)
1341
+ * @see [oxc#target](https://oxc.rs/docs/guide/usage/transformer/lowering#target)
1342
1342
  */
1343
1343
  target?: string | Array<string>;
1344
1344
  /**
@@ -2283,6 +2283,94 @@ interface PluginsOptions {
2283
2283
  styledComponents?: StyledComponentsOptions;
2284
2284
  taggedTemplateEscape?: boolean;
2285
2285
  }
2286
+ /** Dynamic gating for {@link ReactCompilerOptions#dynamicGating}. */
2287
+ interface ReactCompilerDynamicGating {
2288
+ /** Module the gating import comes from. */
2289
+ source: string;
2290
+ }
2291
+ /** Static gating for {@link ReactCompilerOptions#gating}. */
2292
+ interface ReactCompilerGating {
2293
+ /** Module the gating import comes from. */
2294
+ source: string;
2295
+ /** Imported specifier used as the gate. */
2296
+ importSpecifierName: string;
2297
+ }
2298
+ /**
2299
+ * Options for the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
2300
+ *
2301
+ * Mirrors the compiler's `PluginOptions`. The deep `environment` configuration
2302
+ * (inference / validation flags) is not surfaced here.
2303
+ *
2304
+ * @see {@link TransformOptions#reactCompiler}
2305
+ */
2306
+ interface ReactCompilerOptions {
2307
+ /**
2308
+ * Which functions to compile.
2309
+ *
2310
+ * @default 'infer'
2311
+ */
2312
+ compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all';
2313
+ /**
2314
+ * What to do when a function cannot be compiled.
2315
+ *
2316
+ * @default 'none'
2317
+ */
2318
+ panicThreshold?: 'none' | 'critical_errors' | 'all_errors';
2319
+ /**
2320
+ * React runtime version target. `17` and `18` require the
2321
+ * `react-compiler-runtime` package; `19` ships the runtime in `react`.
2322
+ *
2323
+ * @default '19'
2324
+ */
2325
+ target?: '17' | '18' | '19';
2326
+ /**
2327
+ * Analyze and report diagnostics only; emit no transformed code.
2328
+ *
2329
+ * @default false
2330
+ */
2331
+ noEmit?: boolean;
2332
+ /**
2333
+ * Compiler output mode.
2334
+ *
2335
+ * @default undefined
2336
+ */
2337
+ outputMode?: 'client' | 'ssr' | 'lint';
2338
+ /**
2339
+ * Compile even functions marked with the `"use no memo"` / `"use no forget"`
2340
+ * opt-out directives.
2341
+ *
2342
+ * @default false
2343
+ */
2344
+ ignoreUseNoForget?: boolean;
2345
+ /**
2346
+ * Treat Flow suppression comments as opt-outs.
2347
+ *
2348
+ * @default true
2349
+ */
2350
+ flowSuppressions?: boolean;
2351
+ /**
2352
+ * Enable `react-native-reanimated` support.
2353
+ *
2354
+ * @default false
2355
+ */
2356
+ enableReanimated?: boolean;
2357
+ /**
2358
+ * Development mode (extra validation / instrumentation).
2359
+ *
2360
+ * @default false
2361
+ */
2362
+ isDev?: boolean;
2363
+ /** Source file name, used for the fast-refresh hash and in diagnostics. */
2364
+ filename?: string;
2365
+ /** ESLint rules whose suppressions opt a function out of compilation. */
2366
+ eslintSuppressionRules?: Array<string>;
2367
+ /** Extra directives that opt a function out of compilation. */
2368
+ customOptOutDirectives?: Array<string>;
2369
+ /** Also emit a gated (feature-flagged) version of each compiled function. */
2370
+ gating?: ReactCompilerGating;
2371
+ /** Dynamically-gated compilation. */
2372
+ dynamicGating?: ReactCompilerDynamicGating;
2373
+ }
2286
2374
  interface ReactRefreshOptions {
2287
2375
  /**
2288
2376
  * Specify the identifier of the refresh registration variable.
@@ -2442,6 +2530,14 @@ interface TransformOptions {
2442
2530
  inject?: Record<string, string | [string, string]>;
2443
2531
  /** Decorator plugin */
2444
2532
  decorator?: DecoratorOptions;
2533
+ /**
2534
+ * Enable the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
2535
+ *
2536
+ * `true` enables it with default options; an object enables it with the
2537
+ * given options; `false` or omitted disables it. When enabled, the compiler
2538
+ * runs as the first transform and memoizes React components and hooks.
2539
+ */
2540
+ reactCompiler?: boolean | ReactCompilerOptions;
2445
2541
  /**
2446
2542
  * Third-party plugins to use.
2447
2543
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
@@ -1,13 +1,13 @@
1
1
  import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-aMKUxRpj.mjs";
2
2
  import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CHVaSqeF.mjs";
3
- import { _ as noop, a as id, b as unsupported, f as or, h as arraify, n as code, r as exclude, s as include, t as and, u as moduleType, y as unreachable } from "./composable-filters-BcLvc0mh.mjs";
3
+ import { C as unreachable, h as or, i as exclude, l as include, n as code, p as moduleType, s as id, t as and, w as unsupported, x as noop, y as arraify } from "./filter-B_mD-HGz-Cbrk-2bt.mjs";
4
4
  import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-B5cMIevi.mjs";
5
5
  import { parseAst } from "../parse-ast-index.mjs";
6
6
  import { BindingAttachDebugInfo, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects } from "../rolldown-binding.wasi.cjs";
7
7
  import path from "node:path";
8
8
  import fsp from "node:fs/promises";
9
9
  //#region package.json
10
- var version = "1.0.3";
10
+ var version = "1.1.1";
11
11
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
12
12
  //#endregion
13
13
  //#region src/constants/version.ts
@@ -218,7 +218,7 @@ function bindingAssetSource(source) {
218
218
  return { inner: source };
219
219
  }
220
220
  //#endregion
221
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
221
+ //#region \0@oxc-project+runtime@0.135.0/helpers/esm/decorate.js
222
222
  function __decorate(decorators, target, key, desc) {
223
223
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
224
224
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1190,16 +1190,18 @@ function bindingifyTransform(args) {
1190
1190
  });
1191
1191
  let normalizedCode = void 0;
1192
1192
  let map = ret.map;
1193
+ let mapHandledByNativeChannel = false;
1193
1194
  if (typeof ret.code === "string") normalizedCode = ret.code;
1194
1195
  else if (ret.code instanceof RolldownMagicString) {
1195
1196
  let magicString = ret.code;
1196
1197
  normalizedCode = magicString.toString();
1197
1198
  let fallbackSourcemap = ctx.sendMagicString(magicString);
1198
1199
  if (fallbackSourcemap != void 0) map = fallbackSourcemap;
1200
+ else mapHandledByNativeChannel = true;
1199
1201
  }
1200
1202
  return {
1201
1203
  code: normalizedCode,
1202
- map: bindingifySourcemap(normalizeTransformHookSourcemap(id, code, map)) ?? (ret.map === null ? null : void 0),
1204
+ map: bindingifySourcemap(normalizeTransformHookSourcemap(id, code, map)) ?? (mapHandledByNativeChannel || ret.map === null ? null : void 0),
1203
1205
  moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
1204
1206
  moduleType: ret.moduleType
1205
1207
  };
@@ -1305,7 +1307,10 @@ function bindingifyRenderChunk(args) {
1305
1307
  if (ret.code instanceof RolldownMagicString) {
1306
1308
  const magicString = ret.code;
1307
1309
  const normalizedCode = magicString.toString();
1308
- if (ret.map === null) return { code: normalizedCode };
1310
+ if (ret.map === null) return {
1311
+ code: normalizedCode,
1312
+ map: null
1313
+ };
1309
1314
  if (ret.map === void 0) {
1310
1315
  const generatedMap = magicString.generateMap();
1311
1316
  return {
@@ -1324,7 +1329,10 @@ function bindingifyRenderChunk(args) {
1324
1329
  map: bindingifySourcemap(ret.map)
1325
1330
  };
1326
1331
  }
1327
- if (!ret.map) return { code: ret.code };
1332
+ if (ret.map === null) return {
1333
+ code: ret.code,
1334
+ map: null
1335
+ };
1328
1336
  return {
1329
1337
  code: ret.code,
1330
1338
  map: bindingifySourcemap(ret.map)
@@ -1,5 +1,5 @@
1
- import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, b as BindingViteDynamicImportVarsPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteBuildImportAnalysisPluginConfig } from "./binding-BhK3B-Zu.mjs";
2
- import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-m0ogxd-4.mjs";
1
+ import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, b as BindingViteDynamicImportVarsPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteBuildImportAnalysisPluginConfig } from "./binding-BPMI4t0-.mjs";
2
+ import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-Bp1VejKQ.mjs";
3
3
 
4
4
  //#region src/builtin-plugin/constructors.d.ts
5
5
  declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
@@ -1,6 +1,6 @@
1
- import { A as ExternalMemoryStatus, N as JsxOptions, P as MinifyOptions$1, R as ParserOptions, U as TransformOptions$1, bn as Program, c as BindingHookResolveIdExtraArgs, d as BindingPluginContextResolveOptions, h as BindingTransformHookExtraArgs, k as BindingWatcherBundler, p as BindingRenderedChunk, u as BindingMagicString, z as PreRenderedChunk } from "./binding-BhK3B-Zu.mjs";
1
+ import { A as ExternalMemoryStatus, N as JsxOptions, P as MinifyOptions$1, R as ParserOptions, U as TransformOptions$1, bn as Program, c as BindingHookResolveIdExtraArgs, d as BindingPluginContextResolveOptions, h as BindingTransformHookExtraArgs, k as BindingWatcherBundler, p as BindingRenderedChunk, u as BindingMagicString, z as PreRenderedChunk } from "./binding-BPMI4t0-.mjs";
2
2
  import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./logging-BSNejiLS.mjs";
3
- import { a as NullValue, i as MaybePromise, n as MakeAsync, o as PartialNull, r as MaybeArray, s as StringOrRegExp$1, t as BuiltinPlugin } from "./utils-m0ogxd-4.mjs";
3
+ import { a as NullValue, i as MaybePromise, n as MakeAsync, o as PartialNull, r as MaybeArray, s as StringOrRegExp$1, t as BuiltinPlugin } from "./utils-Bp1VejKQ.mjs";
4
4
 
5
5
  //#region src/types/misc.d.ts
6
6
  /** @inline */
@@ -1133,6 +1133,20 @@ type CodeSplittingGroup = {
1133
1133
  */
1134
1134
  entriesAwareMergeThreshold?: number;
1135
1135
  /**
1136
+ * Whether to include captured modules' dependencies.
1137
+ *
1138
+ * Enabling this option reduces the chance of generating circular chunks.
1139
+ *
1140
+ * If you want to disable this behavior, it's recommended to both set
1141
+ * - {@linkcode InputOptions.preserveEntrySignatures | preserveEntrySignatures}: `false | 'allow-extension'`
1142
+ * - {@linkcode OutputOptions.strictExecutionOrder | strictExecutionOrder}: `true`
1143
+ *
1144
+ * to avoid generating invalid chunks.
1145
+ *
1146
+ * @default true
1147
+ */
1148
+ includeDependenciesRecursively?: boolean;
1149
+ /**
1136
1150
  * Filter modules by tags. Only modules that have **all** specified tags
1137
1151
  * are captured by this group. Combines with `test` and other filters —
1138
1152
  * a module must match all criteria.
@@ -1159,15 +1173,7 @@ type AdvancedChunksGroup = CodeSplittingGroup;
1159
1173
  */
1160
1174
  type CodeSplittingOptions = {
1161
1175
  /**
1162
- * By default, each group will also include captured modules' dependencies. This reduces the chance of generating circular chunks.
1163
- *
1164
- * If you want to disable this behavior, it's recommended to both set
1165
- * - {@linkcode InputOptions.preserveEntrySignatures | preserveEntrySignatures}: `false | 'allow-extension'`
1166
- * - {@linkcode OutputOptions.strictExecutionOrder | strictExecutionOrder}: `true`
1167
- *
1168
- * to avoid generating invalid chunks.
1169
- *
1170
- * @default true
1176
+ * Global fallback of {@linkcode CodeSplittingGroup.includeDependenciesRecursively | group.includeDependenciesRecursively}, if it's not specified in the group.
1171
1177
  */
1172
1178
  includeDependenciesRecursively?: boolean;
1173
1179
  /**
@@ -1274,6 +1280,10 @@ declare class RolldownBuild {
1274
1280
  /**
1275
1281
  * Close the bundle and free resources.
1276
1282
  *
1283
+ * This method should be called even if the {@linkcode generate} method
1284
+ * or the {@linkcode write} method threw an error. It should be called
1285
+ * even if neither of the methods are called.
1286
+ *
1277
1287
  * This method is called automatically when using `using` syntax.
1278
1288
  *
1279
1289
  * @example
@@ -1625,6 +1635,11 @@ interface ChecksOptions {
1625
1635
  * @default true
1626
1636
  * */
1627
1637
  largeBarrelModules?: boolean;
1638
+ /**
1639
+ * Whether to emit warnings when a plugin transforms code without generating a sourcemap.
1640
+ * @default true
1641
+ * */
1642
+ sourcemapBroken?: boolean;
1628
1643
  }
1629
1644
  //#endregion
1630
1645
  //#region src/options/transform-options.d.ts
@@ -2573,7 +2588,8 @@ type DefinedHookNames = { readonly [K in (typeof ENUMERATED_PLUGIN_HOOK_NAMES)[n
2573
2588
  */
2574
2589
  declare const DEFINED_HOOK_NAMES: DefinedHookNames;
2575
2590
  //#endregion
2576
- //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.d.ts
2591
+ //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter/index.d.mts
2592
+ //#region src/filter/composable-filters.d.ts
2577
2593
  type StringOrRegExp = string | RegExp;
2578
2594
  type PluginModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
2579
2595
  type FilterExpressionKind = FilterExpression['kind'];
@@ -2662,7 +2678,107 @@ interface InterpreterCtx {
2662
2678
  urlSearchParamsCache?: URLSearchParams;
2663
2679
  }
2664
2680
  declare function interpreterImpl(expr: TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
2665
- declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
2681
+ declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean; //#endregion
2682
+ //#region src/filter/filter-vite-plugins.d.ts
2683
+ /**
2684
+ * Filters out Vite plugins that have `apply: 'serve'` set.
2685
+ *
2686
+ * Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
2687
+ * are intended only for Vite's dev server and should be excluded from the build process.
2688
+ *
2689
+ * @param plugins - Array of plugins (can include nested arrays)
2690
+ * @returns Filtered array with serve-only plugins removed
2691
+ *
2692
+ * @example
2693
+ * ```ts
2694
+ * import { defineConfig } from 'rolldown';
2695
+ * import { filterVitePlugins } from '@rolldown/pluginutils';
2696
+ * import viteReact from '@vitejs/plugin-react';
2697
+ *
2698
+ * export default defineConfig({
2699
+ * plugins: filterVitePlugins([
2700
+ * viteReact(),
2701
+ * {
2702
+ * name: 'dev-only',
2703
+ * apply: 'serve', // This will be filtered out
2704
+ * // ...
2705
+ * }
2706
+ * ])
2707
+ * });
2708
+ * ```
2709
+ */
2710
+ declare function filterVitePlugins<T = any>(plugins: T | T[] | null | undefined | false): T[]; //#endregion
2711
+ //#region src/filter/simple-filters.d.ts
2712
+ /**
2713
+ * Constructs a RegExp that matches the exact string specified.
2714
+ *
2715
+ * This is useful for plugin hook filters.
2716
+ *
2717
+ * @param str the string to match.
2718
+ * @param flags flags for the RegExp.
2719
+ *
2720
+ * @example
2721
+ * ```ts
2722
+ * import { exactRegex } from '@rolldown/pluginutils';
2723
+ * const plugin = {
2724
+ * name: 'plugin',
2725
+ * resolveId: {
2726
+ * filter: { id: exactRegex('foo') },
2727
+ * handler(id) {} // will only be called for `foo`
2728
+ * }
2729
+ * }
2730
+ * ```
2731
+ */
2732
+ declare function exactRegex(str: string, flags?: string): RegExp;
2733
+ /**
2734
+ * Constructs a RegExp that matches a value that has the specified prefix.
2735
+ *
2736
+ * This is useful for plugin hook filters.
2737
+ *
2738
+ * @param str the string to match.
2739
+ * @param flags flags for the RegExp.
2740
+ *
2741
+ * @example
2742
+ * ```ts
2743
+ * import { prefixRegex } from '@rolldown/pluginutils';
2744
+ * const plugin = {
2745
+ * name: 'plugin',
2746
+ * resolveId: {
2747
+ * filter: { id: prefixRegex('foo') },
2748
+ * handler(id) {} // will only be called for IDs starting with `foo`
2749
+ * }
2750
+ * }
2751
+ * ```
2752
+ */
2753
+ declare function prefixRegex(str: string, flags?: string): RegExp;
2754
+ type WidenString<T> = T extends string ? string : T;
2755
+ /**
2756
+ * Converts a id filter to match with an id with a query.
2757
+ *
2758
+ * @param input the id filters to convert.
2759
+ *
2760
+ * @example
2761
+ * ```ts
2762
+ * import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
2763
+ * const plugin = {
2764
+ * name: 'plugin',
2765
+ * transform: {
2766
+ * filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
2767
+ * // The handler will be called for IDs like:
2768
+ * // - foo.js
2769
+ * // - foo.js?foo
2770
+ * // - foo.txt?foo.js
2771
+ * // - foo.ts
2772
+ * // - foo.ts?foo
2773
+ * // - foo.txt?foo.ts
2774
+ * handler(code, id) {}
2775
+ * }
2776
+ * }
2777
+ * ```
2778
+ */
2779
+ declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;
2780
+ declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
2781
+ declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[]; //#endregion
2666
2782
  //#endregion
2667
2783
  //#region src/plugin/with-filter.d.ts
2668
2784
  type OverrideFilterObject = {
@@ -3821,8 +3937,11 @@ interface InputOptions {
3821
3937
  * Lazy barrel optimization avoids compiling unused re-export modules in side-effect-free barrel modules,
3822
3938
  * significantly improving build performance for large codebases with many barrel modules.
3823
3939
  *
3940
+ * This option is planned to be removed in the future. If you need to opt out, please open an issue
3941
+ * describing your use case so we can address it before the option is gone.
3942
+ *
3824
3943
  * @see {@link https://rolldown.rs/in-depth/lazy-barrel-optimization | Lazy Barrel Documentation}
3825
- * @default false
3944
+ * @default true
3826
3945
  */
3827
3946
  lazyBarrel?: boolean;
3828
3947
  };
@@ -3951,4 +4070,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
3951
4070
  declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
3952
4071
  declare function defineConfig(config: ConfigExport): ConfigExport;
3953
4072
  //#endregion
3954
- export { VERSION as $, GlobalsFunction as $t, RolldownPluginOption as A, WarningHandlerWithDefault as At, exclude as B, build as Bt, ParallelPluginHooks as C, RolldownFsModule as Ct, ResolveIdResult as D, TransformOptions as Dt, ResolveIdExtraOptions as E, NormalizedInputOptions as Et, FilterExpressionKind as F, RolldownWatcherWatcherEventMap as Ft, interpreter as G, ChunkFileNamesFunction as Gt, id as H, AdvancedChunksGroup as Ht, QueryFilterObject as I, WatchOptions as It, not as J, CodeSplittingNameFunction as Jt, interpreterImpl as K, ChunkingContext as Kt, TopLevelFilterExpression as L, rolldown as Lt, TransformResult as M, watch as Mt, withFilter as N, RolldownWatcher as Nt, ResolvedId as O, ChecksOptions as Ot, FilterExpression as P, RolldownWatcherEvent as Pt, RUNTIME_MODULE_ID as Q, GeneratedCodePreset as Qt, and as R, RolldownBuild as Rt, ObjectHook as S, RolldownFileStats as St, Plugin as T, NormalizedOutputOptions as Tt, importerId as U, AdvancedChunksOptions as Ut, exprInterpreter as V, AddonFunction as Vt, include as W, BuiltinModuleTag as Wt, queries as X, CommentsOptions as Xt, or as Y, CodeSplittingOptions as Yt, query as Z, GeneratedCodeOptions as Zt, HookFilterExtension as _, GeneralHookFilter as _t, ChunkOptimizationOptions as a, OutputChunk as an, TransformPluginContext as at, ModuleOptions as b, BufferEncoding as bt, InputOption as c, RolldownOutput as cn, EmittedFile as ct, OptimizationOptions as d, ModuleInfo as dn, PluginContext as dt, MinifyOptions as en, BundleError as et, WatcherFileWatcherOptions as f, SourcemapIgnoreListOption as fn, PluginContextResolveOptions as ft, FunctionPluginHooks as g, PluginContextMeta as gt, CustomPluginOptions as h, MinimalPluginContext as ht, RolldownOptions as i, OutputAsset as in, TreeshakingOptions as it, SourceDescription as j, RolldownMagicString as jt, RolldownPlugin as k, LoggingFunction as kt, InputOptions as l, SourceMap as ln, EmittedPrebuiltChunk as lt, AsyncPluginHooks as m, defineParallelPlugin as mt, RolldownOptionsFunction as n, OutputOptions as nn, SourceMapInput as nt, ExternalOption as o, RenderedChunk as on, EmittedAsset as ot, WatcherOptions as p, DefineParallelPluginResult as pt, moduleType as q, CodeSplittingGroup as qt, defineConfig as r, PreRenderedAsset as rn, OutputBundle as rt, ExternalOptionFunction as s, RenderedModule as sn, EmittedChunk as st, ConfigExport as t, ModuleFormat as tn, ExistingRawSourceMap as tt, ModuleTypes as u, freeExternalMemory as un, GetModuleInfo as ut, ImportKind as v, HookFilter as vt, PartialResolvedId as w, InternalModuleFormat as wt, ModuleType as x, RolldownDirectoryEntry as xt, LoadResult as y, ModuleTypeFilter as yt, code as z, BuildOptions as zt };
4073
+ export { prefixRegex as $, CodeSplittingOptions as $t, RolldownPluginOption as A, NormalizedInputOptions as At, exactRegex as B, WatchOptions as Bt, ParallelPluginHooks as C, ModuleTypeFilter as Ct, ResolveIdResult as D, RolldownFsModule as Dt, ResolveIdExtraOptions as E, RolldownFileStats as Et, FilterExpressionKind as F, RolldownMagicString as Ft, importerId as G, AddonFunction as Gt, exprInterpreter as H, RolldownBuild as Ht, QueryFilterObject as I, watch as It, interpreterImpl as J, BuiltinModuleTag as Jt, include as K, AdvancedChunksGroup as Kt, TopLevelFilterExpression as L, RolldownWatcher as Lt, TransformResult as M, ChecksOptions as Mt, withFilter as N, LoggingFunction as Nt, ResolvedId as O, InternalModuleFormat as Ot, FilterExpression as P, WarningHandlerWithDefault as Pt, or as Q, CodeSplittingNameFunction as Qt, and as R, RolldownWatcherEvent as Rt, ObjectHook as S, HookFilter as St, Plugin as T, RolldownDirectoryEntry as Tt, filterVitePlugins as U, BuildOptions as Ut, exclude as V, rolldown as Vt, id as W, build as Wt, moduleType as X, ChunkingContext as Xt, makeIdFiltersToMatchWithQuery as Y, ChunkFileNamesFunction as Yt, not as Z, CodeSplittingGroup as Zt, HookFilterExtension as _, DefineParallelPluginResult as _t, ChunkOptimizationOptions as a, ModuleFormat as an, ExistingRawSourceMap as at, ModuleOptions as b, PluginContextMeta as bt, InputOption as c, OutputAsset as cn, TreeshakingOptions as ct, OptimizationOptions as d, RenderedModule as dn, EmittedChunk as dt, CommentsOptions as en, queries as et, WatcherFileWatcherOptions as f, RolldownOutput as fn, EmittedFile as ft, FunctionPluginHooks as g, SourcemapIgnoreListOption as gn, PluginContextResolveOptions as gt, CustomPluginOptions as h, ModuleInfo as hn, PluginContext as ht, RolldownOptions as i, MinifyOptions as in, BundleError as it, SourceDescription as j, TransformOptions as jt, RolldownPlugin as k, NormalizedOutputOptions as kt, InputOptions as l, OutputChunk as ln, TransformPluginContext as lt, AsyncPluginHooks as m, freeExternalMemory as mn, GetModuleInfo as mt, RolldownOptionsFunction as n, GeneratedCodePreset as nn, RUNTIME_MODULE_ID as nt, ExternalOption as o, OutputOptions as on, SourceMapInput as ot, WatcherOptions as p, SourceMap as pn, EmittedPrebuiltChunk as pt, interpreter as q, AdvancedChunksOptions as qt, defineConfig as r, GlobalsFunction as rn, VERSION as rt, ExternalOptionFunction as s, PreRenderedAsset as sn, OutputBundle as st, ConfigExport as t, GeneratedCodeOptions as tn, query as tt, ModuleTypes as u, RenderedChunk as un, EmittedAsset as ut, ImportKind as v, defineParallelPlugin as vt, PartialResolvedId as w, BufferEncoding as wt, ModuleType as x, GeneralHookFilter as xt, LoadResult as y, MinimalPluginContext as yt, code as z, RolldownWatcherWatcherEventMap as zt };
@@ -18,7 +18,7 @@ function unsupported(info) {
18
18
  }
19
19
  function noop(..._args) {}
20
20
  //#endregion
21
- //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0/node_modules/@rolldown/pluginutils/dist/utils.js
21
+ //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter-B_mD-HGz.mjs
22
22
  const postfixRE = /[?#].*$/;
23
23
  function cleanUrl(url) {
24
24
  return url.replace(postfixRE, "");
@@ -30,8 +30,6 @@ function extractQueryWithoutFragment(url) {
30
30
  if (fragmentIndex === -1) return url.substring(questionMarkIndex);
31
31
  else return url.substring(questionMarkIndex, fragmentIndex);
32
32
  }
33
- //#endregion
34
- //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.js
35
33
  var And = class {
36
34
  kind;
37
35
  args;
@@ -220,5 +218,120 @@ function exprInterpreter(expr, code, id, moduleType, importerId, ctx = {}) {
220
218
  default: throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
221
219
  }
222
220
  }
221
+ /**
222
+ * Filters out Vite plugins that have `apply: 'serve'` set.
223
+ *
224
+ * Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
225
+ * are intended only for Vite's dev server and should be excluded from the build process.
226
+ *
227
+ * @param plugins - Array of plugins (can include nested arrays)
228
+ * @returns Filtered array with serve-only plugins removed
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * import { defineConfig } from 'rolldown';
233
+ * import { filterVitePlugins } from '@rolldown/pluginutils';
234
+ * import viteReact from '@vitejs/plugin-react';
235
+ *
236
+ * export default defineConfig({
237
+ * plugins: filterVitePlugins([
238
+ * viteReact(),
239
+ * {
240
+ * name: 'dev-only',
241
+ * apply: 'serve', // This will be filtered out
242
+ * // ...
243
+ * }
244
+ * ])
245
+ * });
246
+ * ```
247
+ */
248
+ function filterVitePlugins(plugins) {
249
+ if (!plugins) return [];
250
+ const pluginArray = Array.isArray(plugins) ? plugins : [plugins];
251
+ const result = [];
252
+ for (const plugin of pluginArray) {
253
+ if (!plugin) continue;
254
+ if (Array.isArray(plugin)) {
255
+ result.push(...filterVitePlugins(plugin));
256
+ continue;
257
+ }
258
+ const pluginWithApply = plugin;
259
+ if ("apply" in pluginWithApply) {
260
+ const applyValue = pluginWithApply.apply;
261
+ if (typeof applyValue === "function") try {
262
+ if (applyValue({}, {
263
+ command: "build",
264
+ mode: "production"
265
+ })) result.push(plugin);
266
+ } catch {
267
+ result.push(plugin);
268
+ }
269
+ else if (applyValue === "serve") continue;
270
+ else result.push(plugin);
271
+ } else result.push(plugin);
272
+ }
273
+ return result;
274
+ }
275
+ /**
276
+ * Constructs a RegExp that matches the exact string specified.
277
+ *
278
+ * This is useful for plugin hook filters.
279
+ *
280
+ * @param str the string to match.
281
+ * @param flags flags for the RegExp.
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * import { exactRegex } from '@rolldown/pluginutils';
286
+ * const plugin = {
287
+ * name: 'plugin',
288
+ * resolveId: {
289
+ * filter: { id: exactRegex('foo') },
290
+ * handler(id) {} // will only be called for `foo`
291
+ * }
292
+ * }
293
+ * ```
294
+ */
295
+ function exactRegex(str, flags) {
296
+ return new RegExp(`^${escapeRegex(str)}$`, flags);
297
+ }
298
+ /**
299
+ * Constructs a RegExp that matches a value that has the specified prefix.
300
+ *
301
+ * This is useful for plugin hook filters.
302
+ *
303
+ * @param str the string to match.
304
+ * @param flags flags for the RegExp.
305
+ *
306
+ * @example
307
+ * ```ts
308
+ * import { prefixRegex } from '@rolldown/pluginutils';
309
+ * const plugin = {
310
+ * name: 'plugin',
311
+ * resolveId: {
312
+ * filter: { id: prefixRegex('foo') },
313
+ * handler(id) {} // will only be called for IDs starting with `foo`
314
+ * }
315
+ * }
316
+ * ```
317
+ */
318
+ function prefixRegex(str, flags) {
319
+ return new RegExp(`^${escapeRegex(str)}`, flags);
320
+ }
321
+ const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
322
+ function escapeRegex(str) {
323
+ return str.replace(escapeRegexRE, "\\$&");
324
+ }
325
+ function makeIdFiltersToMatchWithQuery(input) {
326
+ if (!Array.isArray(input)) return makeIdFilterToMatchWithQuery(input);
327
+ return input.map((i) => makeIdFilterToMatchWithQuery(i));
328
+ }
329
+ function makeIdFilterToMatchWithQuery(input) {
330
+ if (typeof input === "string") return `${input}{?*,}`;
331
+ return makeRegexIdFilterToMatchWithQuery(input);
332
+ }
333
+ function makeRegexIdFilterToMatchWithQuery(input) {
334
+ return new RegExp(input.source.replace(/(?<!\\)\$/g, "(?:\\?.*)?$"), input.flags);
335
+ }
223
336
  //#endregion
224
- export { noop as _, id as a, unsupported as b, interpreter as c, not as d, or as f, isPromiseLike as g, arraify as h, exprInterpreter as i, interpreterImpl as l, query as m, code as n, importerId as o, queries as p, exclude as r, include as s, and as t, moduleType as u, unimplemented as v, unreachable as y };
337
+ export { unreachable as C, unimplemented as S, queries as _, exprInterpreter as a, isPromiseLike as b, importerId as c, interpreterImpl as d, makeIdFiltersToMatchWithQuery as f, prefixRegex as g, or as h, exclude as i, include as l, not as m, code as n, filterVitePlugins as o, moduleType as p, exactRegex as r, id as s, and as t, interpreter as u, query as v, unsupported as w, noop as x, arraify as y };
@@ -1,4 +1,4 @@
1
- import { t as rolldown } from "./rolldown-CMk-JrOo.mjs";
1
+ import { t as rolldown } from "./rolldown-Bqp7kINm.mjs";
2
2
  import path from "node:path";
3
3
  import { readdir } from "node:fs/promises";
4
4
  import { cwd } from "node:process";
@@ -1,5 +1,5 @@
1
1
  import { parse, parseSync } from "../rolldown-binding.wasi.cjs";
2
- //#region ../../node_modules/.pnpm/oxc-parser@0.133.0/node_modules/oxc-parser/src-js/wrap.js
2
+ //#region ../../node_modules/.pnpm/oxc-parser@0.135.0/node_modules/oxc-parser/src-js/wrap.js
3
3
  function wrap(result) {
4
4
  let program, module, comments, errors;
5
5
  return {
@@ -1,4 +1,4 @@
1
- import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-Dh-EVzMc.mjs";
1
+ import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-BgBj9qUV.mjs";
2
2
  //#region src/api/rolldown/index.ts
3
3
  /**
4
4
  * The API compatible with Rollup's `rollup` function.
@@ -1,7 +1,7 @@
1
1
  import { i as logInputHookInOutputPlugin, n as error } from "./logs-aMKUxRpj.mjs";
2
2
  import { n as BuiltinPlugin } from "./normalize-string-or-regex-CHVaSqeF.mjs";
3
- import { c as __decorate, d as PlainObjectLike, f as MinimalPluginContextImpl, h as LOG_LEVEL_DEBUG, i as transformModuleInfo, l as transformAssetSource, m as normalizeLog, o as transformToRollupOutput, p as normalizeHook, s as transformRenderedChunk, t as bindingifyInputOptions, u as lazyProp, v as LOG_LEVEL_WARN, x as VERSION, y as logLevelPriority } from "./bindingify-input-options-BKrzu-Ci.mjs";
4
- import { v as unimplemented } from "./composable-filters-BcLvc0mh.mjs";
3
+ import { c as __decorate, d as PlainObjectLike, f as MinimalPluginContextImpl, h as LOG_LEVEL_DEBUG, i as transformModuleInfo, l as transformAssetSource, m as normalizeLog, o as transformToRollupOutput, p as normalizeHook, s as transformRenderedChunk, t as bindingifyInputOptions, u as lazyProp, v as LOG_LEVEL_WARN, x as VERSION, y as logLevelPriority } from "./bindingify-input-options-EBZ5IFF2.mjs";
4
+ import { S as unimplemented } from "./filter-B_mD-HGz-Cbrk-2bt.mjs";
5
5
  import { i as unwrapBindingResult } from "./error-B5cMIevi.mjs";
6
6
  import { Worker } from "node:worker_threads";
7
7
  import { BindingBundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
@@ -1469,7 +1469,43 @@ const TransformOptionsSchema = /* @__PURE__ */ object({
1469
1469
  plugins: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ object({
1470
1470
  styledComponents: /* @__PURE__ */ optional(/* @__PURE__ */ any()),
1471
1471
  taggedTemplateEscape: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
1472
- })), /* @__PURE__ */ description("Third-party plugins to use"))
1472
+ })), /* @__PURE__ */ description("Third-party plugins to use")),
1473
+ reactCompiler: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ object({
1474
+ compilationMode: /* @__PURE__ */ optional(/* @__PURE__ */ union([
1475
+ /* @__PURE__ */ literal("infer"),
1476
+ /* @__PURE__ */ literal("syntax"),
1477
+ /* @__PURE__ */ literal("annotation"),
1478
+ /* @__PURE__ */ literal("all")
1479
+ ])),
1480
+ panicThreshold: /* @__PURE__ */ optional(/* @__PURE__ */ union([
1481
+ /* @__PURE__ */ literal("none"),
1482
+ /* @__PURE__ */ literal("critical_errors"),
1483
+ /* @__PURE__ */ literal("all_errors")
1484
+ ])),
1485
+ target: /* @__PURE__ */ optional(/* @__PURE__ */ union([
1486
+ /* @__PURE__ */ literal("17"),
1487
+ /* @__PURE__ */ literal("18"),
1488
+ /* @__PURE__ */ literal("19")
1489
+ ])),
1490
+ noEmit: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
1491
+ outputMode: /* @__PURE__ */ optional(/* @__PURE__ */ union([
1492
+ /* @__PURE__ */ literal("client"),
1493
+ /* @__PURE__ */ literal("ssr"),
1494
+ /* @__PURE__ */ literal("lint")
1495
+ ])),
1496
+ ignoreUseNoForget: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
1497
+ flowSuppressions: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
1498
+ enableReanimated: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
1499
+ isDev: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
1500
+ filename: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
1501
+ eslintSuppressionRules: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
1502
+ customOptOutDirectives: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
1503
+ gating: /* @__PURE__ */ optional(/* @__PURE__ */ object({
1504
+ source: /* @__PURE__ */ string(),
1505
+ importSpecifierName: /* @__PURE__ */ string()
1506
+ })),
1507
+ dynamicGating: /* @__PURE__ */ optional(/* @__PURE__ */ object({ source: /* @__PURE__ */ string() }))
1508
+ })]))
1473
1509
  });
1474
1510
  const WatcherFileWatcherOptionsSchema = /* @__PURE__ */ strictObject({
1475
1511
  usePolling: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Use polling-based file watching instead of native OS events")),
@@ -1512,7 +1548,8 @@ const ChecksOptionsSchema = /* @__PURE__ */ strictObject({
1512
1548
  duplicateShebang: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when both the code and postBanner contain shebang")),
1513
1549
  unsupportedTsconfigOption: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a tsconfig option or combination of options is not supported")),
1514
1550
  ineffectiveDynamicImport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a module is dynamically imported but also statically imported, making the dynamic import ineffective for code splitting")),
1515
- largeBarrelModules: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit info logs when a barrel module has a very large number of re-exports (more than 5000)"))
1551
+ largeBarrelModules: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit info logs when a barrel module has a very large number of re-exports (more than 5000)")),
1552
+ sourcemapBroken: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a plugin transforms code without generating a sourcemap"))
1516
1553
  });
1517
1554
  const MinifyOptionsSchema = /* @__PURE__ */ strictObject({
1518
1555
  compress: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
@@ -1720,6 +1757,7 @@ const AdvancedChunksSchema = /* @__PURE__ */ strictObject({
1720
1757
  maxModuleSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
1721
1758
  entriesAware: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
1722
1759
  entriesAwareMergeThreshold: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
1760
+ includeDependenciesRecursively: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
1723
1761
  tags: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string()))
1724
1762
  })))
1725
1763
  });
@@ -3200,6 +3238,10 @@ var RolldownBuild = class RolldownBuild {
3200
3238
  /**
3201
3239
  * Close the bundle and free resources.
3202
3240
  *
3241
+ * This method should be called even if the {@linkcode generate} method
3242
+ * or the {@linkcode write} method threw an error. It should be called
3243
+ * even if neither of the methods are called.
3244
+ *
3203
3245
  * This method is called automatically when using `using` syntax.
3204
3246
  *
3205
3247
  * @example