@rolldown/browser 1.1.0 → 1.1.2

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 (43) hide show
  1. package/dist/cli.mjs +12 -12
  2. package/dist/config.d.mts +1 -1
  3. package/dist/config.mjs +2 -2
  4. package/dist/{constructors-B3MtwuwE.js → constructors-CnlRXsZI.js} +1 -4
  5. package/dist/{error-5Tc1aq0X.js → error-DOcnYe1L.js} +1 -1
  6. package/dist/experimental-index.browser.mjs +5 -5
  7. package/dist/experimental-index.d.mts +6 -6
  8. package/dist/experimental-index.mjs +5 -5
  9. package/dist/filter-index.d.mts +1 -104
  10. package/dist/filter-index.mjs +1 -120
  11. package/dist/index.browser.mjs +2 -2
  12. package/dist/index.d.mts +3 -3
  13. package/dist/index.mjs +3 -3
  14. package/dist/parallel-plugin-worker.mjs +1 -1
  15. package/dist/parallel-plugin.d.mts +2 -2
  16. package/dist/parse-ast-index.d.mts +1 -1
  17. package/dist/parse-ast-index.mjs +1 -1
  18. package/dist/plugins-index.browser.mjs +1 -1
  19. package/dist/plugins-index.d.mts +3 -3
  20. package/dist/plugins-index.mjs +1 -1
  21. package/dist/{resolve-tsconfig-zB6S1f4Q.js → resolve-tsconfig-B_KTldgL.js} +1 -1
  22. package/dist/rolldown-binding.wasi-browser.js +1 -0
  23. package/dist/rolldown-binding.wasi.cjs +1 -0
  24. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  25. package/dist/{rolldown-build-CDo_414H.js → rolldown-build-DkMkdHEX.js} +11 -7
  26. package/dist/shared/{binding-BhK3B-Zu.d.mts → binding-dOJO0Ipo.d.mts} +69 -24
  27. package/dist/shared/{bindingify-input-options-Yh0p_yKx.mjs → bindingify-input-options-CM59dkv7.mjs} +6 -6
  28. package/dist/shared/{constructors-YQsI-lJq.mjs → constructors-CAjrhG6p.mjs} +1 -4
  29. package/dist/shared/{constructors-CtnJN4Sg.d.mts → constructors-DXDHUcCD.d.mts} +3 -4
  30. package/dist/shared/{define-config-D0lnfATD.d.mts → define-config-VyEuugfx.d.mts} +106 -5
  31. package/dist/shared/{composable-filters-BcLvc0mh.mjs → filter-B_mD-HGz-Cbrk-2bt.mjs} +117 -4
  32. package/dist/shared/{load-config-D8sdE9HQ.mjs → load-config-ZI8T7gXR.mjs} +1 -1
  33. package/dist/shared/{parse-DYBaZ0kb.mjs → parse-DzXgx0D0.mjs} +1 -1
  34. package/dist/shared/{prompt-DYnaB1Nb.mjs → prompt-B1Yc1NPt.mjs} +5 -5
  35. package/dist/shared/{rolldown-CTBzrYF-.mjs → rolldown-DWdNBjur.mjs} +1 -1
  36. package/dist/shared/{rolldown-build-w_8ZCR-S.mjs → rolldown-build-CNErHQbt.mjs} +10 -6
  37. package/dist/shared/{transform-HS_zMlQ1.d.mts → transform-Wt-zRSFQ.d.mts} +1 -1
  38. package/dist/shared/{utils-m0ogxd-4.d.mts → utils-CuJMMtAZ.d.mts} +1 -1
  39. package/dist/shared/{watch-C5dPEOJJ.mjs → watch-DNIwEbWZ.mjs} +3 -3
  40. package/dist/utils-index.browser.mjs +6 -6
  41. package/dist/utils-index.d.mts +3 -3
  42. package/dist/utils-index.mjs +5 -5
  43. package/package.json +4 -4
@@ -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
  /**
@@ -2329,7 +2329,10 @@ interface StyledComponentsOptions {
2329
2329
  * Transpiles styled-components tagged template literals to a smaller representation
2330
2330
  * than what Babel normally creates, helping to reduce bundle size.
2331
2331
  *
2332
- * @default true
2332
+ * Disabled by default because Oxc does not down-level template literals, so this
2333
+ * transform only increases output size.
2334
+ *
2335
+ * @default false
2333
2336
  */
2334
2337
  transpileTemplateLiterals?: boolean;
2335
2338
  /**
@@ -2379,6 +2382,13 @@ interface StyledComponentsOptions {
2379
2382
  /**
2380
2383
  * Options for transforming a JavaScript or TypeScript file.
2381
2384
  *
2385
+ * Options are listed in evaluation order: the source is parsed (`lang`,
2386
+ * `sourceType`), declarations are emitted (`typescript.declaration`), then
2387
+ * transforms run (`typescript`, `decorator`, `plugins`,
2388
+ * `jsx`, `target`), followed by the `inject` and `define` plugins, and
2389
+ * finally codegen (`sourcemap`). `helpers` configures the runtime helpers
2390
+ * the transforms emit.
2391
+ *
2382
2392
  * @see {@link transform}
2383
2393
  */
2384
2394
  interface TransformOptions {
@@ -2391,23 +2401,23 @@ interface TransformOptions {
2391
2401
  * options.
2392
2402
  */
2393
2403
  cwd?: string;
2394
- /**
2395
- * Enable source map generation.
2396
- *
2397
- * When `true`, the `sourceMap` field of transform result objects will be populated.
2398
- *
2399
- * @default false
2400
- *
2401
- * @see {@link SourceMap}
2402
- */
2403
- sourcemap?: boolean;
2404
2404
  /** Set assumptions in order to produce smaller output. */
2405
2405
  assumptions?: CompilerAssumptions;
2406
2406
  /**
2407
2407
  * Configure how TypeScript is transformed.
2408
+ *
2409
+ * `typescript.declaration` is evaluated before all transforms.
2410
+ *
2408
2411
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
2409
2412
  */
2410
2413
  typescript?: TypeScriptOptions;
2414
+ /** Decorator plugin */
2415
+ decorator?: DecoratorOptions;
2416
+ /**
2417
+ * Third-party plugins to use.
2418
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
2419
+ */
2420
+ plugins?: PluginsOptions;
2411
2421
  /**
2412
2422
  * Configure how TSX and JSX are transformed.
2413
2423
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
@@ -2430,23 +2440,32 @@ interface TransformOptions {
2430
2440
  target?: string | Array<string>;
2431
2441
  /** Behaviour for runtime helpers. */
2432
2442
  helpers?: Helpers;
2433
- /**
2434
- * Define Plugin
2435
- * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
2436
- */
2437
- define?: Record<string, string>;
2438
2443
  /**
2439
2444
  * Inject Plugin
2445
+ *
2446
+ * Runs after all transforms.
2447
+ *
2440
2448
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
2441
2449
  */
2442
2450
  inject?: Record<string, string | [string, string]>;
2443
- /** Decorator plugin */
2444
- decorator?: DecoratorOptions;
2445
2451
  /**
2446
- * Third-party plugins to use.
2447
- * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
2452
+ * Define Plugin
2453
+ *
2454
+ * Runs after the inject plugin.
2455
+ *
2456
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
2448
2457
  */
2449
- plugins?: PluginsOptions;
2458
+ define?: Record<string, string>;
2459
+ /**
2460
+ * Enable source map generation.
2461
+ *
2462
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
2463
+ *
2464
+ * @default false
2465
+ *
2466
+ * @see {@link SourceMap}
2467
+ */
2468
+ sourcemap?: boolean;
2450
2469
  }
2451
2470
  interface TypeScriptOptions {
2452
2471
  jsxPragma?: string;
@@ -2740,7 +2759,7 @@ declare class TsconfigCache {
2740
2759
  /** Get the number of cached entries. */
2741
2760
  size(): number;
2742
2761
  }
2743
- type BindingBuiltinPluginName = 'builtin:bundle-analyzer' | 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-build-import-analysis' | 'builtin:vite-dynamic-import-vars' | 'builtin:vite-import-glob' | 'builtin:vite-json' | 'builtin:vite-load-fallback' | 'builtin:vite-manifest' | 'builtin:vite-module-preload-polyfill' | 'builtin:vite-react-refresh-wrapper' | 'builtin:vite-reporter' | 'builtin:vite-resolve' | 'builtin:vite-transform' | 'builtin:vite-wasm-fallback' | 'builtin:vite-web-worker-post' | 'builtin:oxc-runtime';
2762
+ type BindingBuiltinPluginName = 'builtin:bundle-analyzer' | 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-build-import-analysis' | 'builtin:vite-dynamic-import-vars' | 'builtin:vite-import-glob' | 'builtin:vite-json' | 'builtin:vite-load-fallback' | 'builtin:vite-manifest' | 'builtin:vite-module-preload-polyfill' | 'builtin:vite-react-refresh-wrapper' | 'builtin:vite-reporter' | 'builtin:vite-resolve' | 'builtin:vite-transform' | 'builtin:vite-web-worker-post' | 'builtin:oxc-runtime';
2744
2763
  interface BindingBundleAnalyzerPluginConfig {
2745
2764
  /** Output filename for the bundle analysis data (default: "analyze-data.json") */
2746
2765
  fileName?: string;
@@ -2748,7 +2767,16 @@ interface BindingBundleAnalyzerPluginConfig {
2748
2767
  format?: 'json' | 'md';
2749
2768
  }
2750
2769
  interface BindingBundleState {
2751
- lastFullBuildFailed: boolean;
2770
+ lastBuildErrored: boolean;
2771
+ /**
2772
+ * The stage of the last incremental failure, when `last_build_errored`
2773
+ * is true and the engine is in an incremental-failure state. Absent on
2774
+ * success and for an initial full-build failure (use
2775
+ * `last_build_errored` to detect that). The consumer can force a full
2776
+ * rebuild on the next page load when this is `Hmr`. See
2777
+ * `internal-docs/dev-engine/implementation.md` §12.
2778
+ */
2779
+ lastErrorStage?: BindingErrorStage;
2752
2780
  hasStaleOutput: boolean;
2753
2781
  }
2754
2782
  interface BindingClientHmrUpdate {
@@ -2910,6 +2938,16 @@ type BindingError = {
2910
2938
  type: 'NativeError';
2911
2939
  field0: NativeError;
2912
2940
  };
2941
+ /**
2942
+ * Which stage of an incremental dev build produced the last error.
2943
+ *
2944
+ * Mirrors `rolldown_dev::ErrorStage`. Surfaced on
2945
+ * [`crate::binding_dev_engine::BindingBundleState`] so the consumer can
2946
+ * treat an `Hmr`-stage failure as recoverable by forcing a full rebuild
2947
+ * on the next page load (HMR generation may itself be buggy). See
2948
+ * `internal-docs/dev-engine/implementation.md` §12.
2949
+ */
2950
+ type BindingErrorStage = 'Hmr' | 'Rebuild';
2913
2951
  interface BindingEsmExternalRequirePluginConfig {
2914
2952
  external: Array<BindingStringOrRegex>;
2915
2953
  skipDuplicateCheck?: boolean;
@@ -3057,6 +3095,13 @@ interface BindingTsconfigCompilerOptions {
3057
3095
  experimentalDecorators?: boolean;
3058
3096
  /** Enables decorator metadata emission. */
3059
3097
  emitDecoratorMetadata?: boolean;
3098
+ /** Enables all strict type-checking options. Used as the fallback for `strictNullChecks`. */
3099
+ strict?: boolean;
3100
+ /**
3101
+ * Enables strict null checks. Controls whether `null`/`undefined` are elided from
3102
+ * nullable-union `design:type` decorator metadata.
3103
+ */
3104
+ strictNullChecks?: boolean;
3060
3105
  /** Preserves module structure of imports/exports. */
3061
3106
  verbatimModuleSyntax?: boolean;
3062
3107
  /** Configures how class fields are emitted. */
@@ -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.1.0";
10
+ var version = "1.1.2";
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.134.0/helpers/esm/decorate.js
221
+ //#region \0@oxc-project+runtime@0.137.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);
@@ -672,7 +672,7 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
672
672
  return map;
673
673
  }
674
674
  //#endregion
675
- //#region ../../node_modules/.pnpm/remeda@2.34.1/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
675
+ //#region ../../node_modules/.pnpm/remeda@2.39.0/node_modules/remeda/dist/lazyDataLastImpl--3B10z3s.js
676
676
  function e(e, t, n) {
677
677
  let r = (n) => e(n, ...t);
678
678
  return n === void 0 ? r : Object.assign(r, {
@@ -681,7 +681,7 @@ function e(e, t, n) {
681
681
  });
682
682
  }
683
683
  //#endregion
684
- //#region ../../node_modules/.pnpm/remeda@2.34.1/node_modules/remeda/dist/purry.js
684
+ //#region ../../node_modules/.pnpm/remeda@2.39.0/node_modules/remeda/dist/purry.js
685
685
  function t$1(t, n, r) {
686
686
  let i = t.length - n.length;
687
687
  if (i === 0) return t(...n);
@@ -689,7 +689,7 @@ function t$1(t, n, r) {
689
689
  throw Error(`Wrong number of arguments`);
690
690
  }
691
691
  //#endregion
692
- //#region ../../node_modules/.pnpm/remeda@2.34.1/node_modules/remeda/dist/partition.js
692
+ //#region ../../node_modules/.pnpm/remeda@2.39.0/node_modules/remeda/dist/partition.js
693
693
  function t(...t) {
694
694
  return t$1(n, t);
695
695
  }
@@ -16,9 +16,6 @@ function viteImportGlobPlugin(config) {
16
16
  function viteReporterPlugin(config) {
17
17
  return new BuiltinPlugin("builtin:vite-reporter", config);
18
18
  }
19
- function viteWasmFallbackPlugin() {
20
- return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-wasm-fallback"));
21
- }
22
19
  function viteLoadFallbackPlugin() {
23
20
  return new BuiltinPlugin("builtin:vite-load-fallback");
24
21
  }
@@ -65,4 +62,4 @@ function viteReactRefreshWrapperPlugin(config) {
65
62
  return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config));
66
63
  }
67
64
  //#endregion
68
- export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWasmFallbackPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
65
+ export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWebWorkerPostPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
@@ -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-dOJO0Ipo.mjs";
2
+ import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-CuJMMtAZ.mjs";
3
3
 
4
4
  //#region src/builtin-plugin/constructors.d.ts
5
5
  declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
@@ -10,7 +10,6 @@ type DynamicImportVarsPluginConfig = Omit<BindingViteDynamicImportVarsPluginConf
10
10
  declare function viteDynamicImportVarsPlugin(config?: DynamicImportVarsPluginConfig): BuiltinPlugin;
11
11
  declare function viteImportGlobPlugin(config?: BindingViteImportGlobPluginConfig): BuiltinPlugin;
12
12
  declare function viteReporterPlugin(config: BindingViteReporterPluginConfig): BuiltinPlugin;
13
- declare function viteWasmFallbackPlugin(): BuiltinPlugin;
14
13
  declare function viteLoadFallbackPlugin(): BuiltinPlugin;
15
14
  declare function viteJsonPlugin(config: BindingViteJsonPluginConfig): BuiltinPlugin;
16
15
  declare function viteBuildImportAnalysisPlugin(config: BindingViteBuildImportAnalysisPluginConfig): BuiltinPlugin;
@@ -34,4 +33,4 @@ type ViteReactRefreshWrapperPluginConfig = Omit<BindingViteReactRefreshWrapperPl
34
33
  declare function oxcRuntimePlugin(): BuiltinPlugin;
35
34
  declare function viteReactRefreshWrapperPlugin(config: ViteReactRefreshWrapperPluginConfig): BuiltinPlugin;
36
35
  //#endregion
37
- export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWasmFallbackPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
36
+ export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWebWorkerPostPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
@@ -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-dOJO0Ipo.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-CuJMMtAZ.mjs";
4
4
 
5
5
  //#region src/types/misc.d.ts
6
6
  /** @inline */
@@ -2588,7 +2588,8 @@ type DefinedHookNames = { readonly [K in (typeof ENUMERATED_PLUGIN_HOOK_NAMES)[n
2588
2588
  */
2589
2589
  declare const DEFINED_HOOK_NAMES: DefinedHookNames;
2590
2590
  //#endregion
2591
- //#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
2592
2593
  type StringOrRegExp = string | RegExp;
2593
2594
  type PluginModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
2594
2595
  type FilterExpressionKind = FilterExpression['kind'];
@@ -2677,7 +2678,107 @@ interface InterpreterCtx {
2677
2678
  urlSearchParamsCache?: URLSearchParams;
2678
2679
  }
2679
2680
  declare function interpreterImpl(expr: TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
2680
- 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
2681
2782
  //#endregion
2682
2783
  //#region src/plugin/with-filter.d.ts
2683
2784
  type OverrideFilterObject = {
@@ -3969,4 +4070,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
3969
4070
  declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
3970
4071
  declare function defineConfig(config: ConfigExport): ConfigExport;
3971
4072
  //#endregion
3972
- 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-CTBzrYF-.mjs";
1
+ import { t as rolldown } from "./rolldown-DWdNBjur.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.134.0/node_modules/oxc-parser/src-js/wrap.js
2
+ //#region ../../node_modules/.pnpm/oxc-parser@0.137.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 process$1, { stdin, stdout } from "node:process";
1
+ import g$1, { stdin, stdout } from "node:process";
2
2
  import { WriteStream } from "node:tty";
3
3
  import f from "node:readline";
4
4
  //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
@@ -331,7 +331,7 @@ function sD() {
331
331
  }
332
332
  }), r;
333
333
  }
334
- const iD = sD(), v = new Set(["\x1B", "›"]), CD = 39, w$1 = "\x07", W$1 = "[", rD = "]", R = "m", y = `${rD}8;;`, V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`, z = (t) => `${v.values().next().value}${y}${t}${w$1}`, ED = (t) => t.split(" ").map((u) => A$1(u)), _ = (t, u, F) => {
334
+ const iD = sD(), v = /* @__PURE__ */ new Set(["\x1B", "›"]), CD = 39, w$1 = "\x07", W$1 = "[", rD = "]", R = "m", y = `${rD}8;;`, V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`, z = (t) => `${v.values().next().value}${y}${t}${w$1}`, ED = (t) => t.split(" ").map((u) => A$1(u)), _ = (t, u, F) => {
335
335
  const e = [...u];
336
336
  let s = false, i = false, D = A$1(T$1(t[t.length - 1]));
337
337
  for (const [C, o] of e.entries()) {
@@ -399,7 +399,7 @@ function G(t, u, F) {
399
399
  `);
400
400
  }
401
401
  const c = {
402
- actions: new Set([
402
+ actions: /* @__PURE__ */ new Set([
403
403
  "up",
404
404
  "down",
405
405
  "left",
@@ -408,7 +408,7 @@ const c = {
408
408
  "enter",
409
409
  "cancel"
410
410
  ]),
411
- aliases: new Map([
411
+ aliases: /* @__PURE__ */ new Map([
412
412
  ["k", "up"],
413
413
  ["j", "down"],
414
414
  ["h", "left"],
@@ -646,7 +646,7 @@ var PD = class extends x {
646
646
  }
647
647
  };
648
648
  function ce() {
649
- return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
649
+ return g$1.platform !== "win32" ? g$1.env.TERM !== "linux" : !!g$1.env.CI || !!g$1.env.WT_SESSION || !!g$1.env.TERMINUS_SUBLIME || g$1.env.ConEmuTask === "{cmd::Cmder}" || g$1.env.TERM_PROGRAM === "Terminus-Sublime" || g$1.env.TERM_PROGRAM === "vscode" || g$1.env.TERM === "xterm-256color" || g$1.env.TERM === "alacritty" || g$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
650
650
  }
651
651
  const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"), W = u("▲", "x"), C = u("✔", "√"), o = u(""), d = u(""), k = u("●", ">"), P = u("○", " "), A = u("◻", "[•]"), T = u("◼", "[+]"), F = u("◻", "[ ]"), w = (t) => {
652
652
  switch (t) {
@@ -1,4 +1,4 @@
1
- import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-w_8ZCR-S.mjs";
1
+ import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-CNErHQbt.mjs";
2
2
  //#region src/api/rolldown/index.ts
3
3
  /**
4
4
  * The API compatible with Rollup's `rollup` function.