@rolldown/browser 1.1.3 → 1.1.5

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 (45) hide show
  1. package/dist/cli.mjs +11 -8
  2. package/dist/config.d.mts +15 -2
  3. package/dist/config.mjs +2 -2
  4. package/dist/{constructors-CnlRXsZI.js → constructors-Byrk1_73.js} +1 -1
  5. package/dist/{error-DOcnYe1L.js → error-DXre1AuB.js} +1 -1
  6. package/dist/experimental-index.browser.mjs +7 -6
  7. package/dist/experimental-index.d.mts +5 -5
  8. package/dist/experimental-index.mjs +7 -6
  9. package/dist/filter-index.d.mts +35 -1
  10. package/dist/index.browser.mjs +9 -3
  11. package/dist/index.d.mts +4 -4
  12. package/dist/index.mjs +9 -3
  13. package/dist/{normalize-string-or-regex-A9UIvc9j.js → normalize-string-or-regex-Ccke9UdD.js} +7 -1
  14. package/dist/parallel-plugin-worker.mjs +4 -3
  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 +2 -2
  18. package/dist/plugins-index.browser.mjs +2 -2
  19. package/dist/plugins-index.d.mts +3 -3
  20. package/dist/plugins-index.mjs +2 -2
  21. package/dist/{resolve-tsconfig-B_KTldgL.js → resolve-tsconfig-LwTDNg0M.js} +1 -1
  22. package/dist/rolldown-binding.wasi-browser.js +0 -1
  23. package/dist/rolldown-binding.wasi.cjs +0 -1
  24. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  25. package/dist/{rolldown-build-AEs_8s-I.js → rolldown-build-C-ytNE9x.js} +14 -13
  26. package/dist/shared/{binding-DyMVbTi5.d.mts → binding-BlEEMlGM.d.mts} +16 -4
  27. package/dist/shared/{bindingify-input-options-C6gxQEeC.mjs → bindingify-input-options-CwvtdwoA.mjs} +9 -11
  28. package/dist/shared/{constructors-CAjrhG6p.mjs → constructors-BahhbY0t.mjs} +1 -1
  29. package/dist/shared/{constructors-CDyv7p8V.d.mts → constructors-CxRN1nW0.d.mts} +2 -2
  30. package/dist/shared/{define-config-Tz8fY30o.d.mts → define-config-CJTbYTo8.d.mts} +81 -36
  31. package/dist/shared/dist-DKbukT1H.mjs +154 -0
  32. package/dist/shared/{load-config-C6ynET_w.mjs → load-config-DyE9Nsvv.mjs} +19 -2
  33. package/dist/shared/{logs-aMKUxRpj.mjs → logs-ZGEh6uhb.mjs} +6 -1
  34. package/dist/shared/{normalize-string-or-regex-CHVaSqeF.mjs → normalize-string-or-regex-D93Gs8X1.mjs} +1 -1
  35. package/dist/shared/{parse-DzXgx0D0.mjs → parse-zUvsghAI.mjs} +1 -1
  36. package/dist/shared/{prompt-B1Yc1NPt.mjs → prompt--dNycKSZ.mjs} +59 -17
  37. package/dist/shared/{rolldown-build-CVwFjky2.mjs → rolldown-build-_M7Yfopw.mjs} +31 -11
  38. package/dist/shared/{rolldown-ro17jDL2.mjs → rolldown-q16hbH0c.mjs} +1 -1
  39. package/dist/shared/{transform-DudVZDD5.d.mts → transform-BJ9ymllw.d.mts} +1 -1
  40. package/dist/shared/{utils-DLIXIK5m.d.mts → utils-CEyV6qve.d.mts} +1 -1
  41. package/dist/shared/{watch-DyYqAbie.mjs → watch-WLd1o3am.mjs} +3 -3
  42. package/dist/utils-index.browser.mjs +8 -6
  43. package/dist/utils-index.d.mts +3 -3
  44. package/dist/utils-index.mjs +7 -5
  45. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-aMKUxRpj.mjs";
2
- import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CHVaSqeF.mjs";
1
+ import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-ZGEh6uhb.mjs";
2
+ import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-D93Gs8X1.mjs";
3
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";
@@ -7,7 +7,7 @@ import { BindingAttachDebugInfo, BindingChunkModuleOrderBy, BindingLogLevel, Bin
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.3";
10
+ var version = "1.1.5";
11
11
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
12
12
  //#endregion
13
13
  //#region src/constants/version.ts
@@ -19,12 +19,6 @@ var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compat
19
19
  */
20
20
  const VERSION = version;
21
21
  //#endregion
22
- //#region src/constants/index.ts
23
- /**
24
- * Runtime helper module ID
25
- */
26
- const RUNTIME_MODULE_ID = "\0rolldown/runtime.js";
27
- //#endregion
28
22
  //#region src/log/logging.ts
29
23
  const LOG_LEVEL_SILENT = "silent";
30
24
  const LOG_LEVEL_ERROR = "error";
@@ -218,7 +212,7 @@ function bindingAssetSource(source) {
218
212
  return { inner: source };
219
213
  }
220
214
  //#endregion
221
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
215
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/decorate.js
222
216
  function __decorate(decorators, target, key, desc) {
223
217
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
224
218
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -631,6 +625,9 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
631
625
  get sourcemap() {
632
626
  return this.inner.sourcemap;
633
627
  }
628
+ get sourcemapFileNames() {
629
+ return this.inner.sourcemapFilenames || this.outputOptions.sourcemapFileNames;
630
+ }
634
631
  get sourcemapBaseUrl() {
635
632
  return this.inner.sourcemapBaseUrl ?? void 0;
636
633
  }
@@ -752,6 +749,7 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "assetFileNames",
752
749
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
753
750
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
754
751
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
752
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapFileNames", null);
755
753
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
756
754
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
757
755
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
@@ -2235,4 +2233,4 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
2235
2233
  };
2236
2234
  }
2237
2235
  //#endregion
2238
- export { version as C, description as S, LOG_LEVEL_INFO as _, transformModuleInfo as a, RUNTIME_MODULE_ID as b, __decorate as c, PlainObjectLike as d, MinimalPluginContextImpl as f, LOG_LEVEL_ERROR as g, LOG_LEVEL_DEBUG as h, PluginContextData as i, transformAssetSource as l, normalizeLog as m, bindingifyPlugin as n, transformToRollupOutput as o, normalizeHook as p, RolldownMagicString as r, transformRenderedChunk as s, bindingifyInputOptions as t, lazyProp as u, LOG_LEVEL_WARN as v, VERSION as x, logLevelPriority as y };
2236
+ export { version as S, LOG_LEVEL_INFO as _, transformModuleInfo as a, VERSION as b, __decorate as c, PlainObjectLike as d, MinimalPluginContextImpl as f, LOG_LEVEL_ERROR as g, LOG_LEVEL_DEBUG as h, PluginContextData as i, transformAssetSource as l, normalizeLog as m, bindingifyPlugin as n, transformToRollupOutput as o, normalizeHook as p, RolldownMagicString as r, transformRenderedChunk as s, bindingifyInputOptions as t, lazyProp as u, LOG_LEVEL_WARN as v, description as x, logLevelPriority as y };
@@ -1,4 +1,4 @@
1
- import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CHVaSqeF.mjs";
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-D93Gs8X1.mjs";
2
2
  //#region src/builtin-plugin/constructors.ts
3
3
  function viteModulePreloadPolyfillPlugin(config) {
4
4
  return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
@@ -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-DyMVbTi5.mjs";
2
- import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-DLIXIK5m.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-BlEEMlGM.mjs";
2
+ import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-CEyV6qve.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-DyMVbTi5.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-BlEEMlGM.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-DLIXIK5m.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-CEyV6qve.mjs";
4
4
 
5
5
  //#region src/types/misc.d.ts
6
6
  /** @inline */
@@ -409,6 +409,22 @@ interface OutputOptions {
409
409
  */
410
410
  sourcemapBaseUrl?: string;
411
411
  /**
412
+ * The pattern to use for sourcemaps created from entry points, or a function that is called per entry chunk with {@linkcode PreRenderedChunk} to return such a pattern.
413
+ *
414
+ * Patterns support the following placeholders:
415
+ * - `[format]`: The rendering format defined in the output options. The value is any of {@linkcode InternalModuleFormat}.
416
+ * - `[hash]`: A hash based only on the content of the final generated sourcemap. You can also set a specific hash length via e.g. `[hash:10]`. By default, it will create a base-64 hash. If you need a reduced character set, see {@linkcode hashCharacters | output.hashCharacters}.
417
+ * - `[chunkhash]`: The same hash as the one used for the corresponding generated chunk (if any).
418
+ * - `[name]`: The name of the corresponding chunk.
419
+ *
420
+ * Forward slashes (`/`) can be used to place files in sub-directories. This pattern will also be used for every file when setting the {@linkcode preserveModules | output.preserveModules} option.
421
+ *
422
+ * See also {@linkcode assetFileNames | output.assetFileNames}, {@linkcode chunkFileNames | output.chunkFileNames}.
423
+ *
424
+ * @default the corresponding chunk filename with `.map` appended
425
+ */
426
+ sourcemapFileNames?: string | ChunkFileNamesFunction;
427
+ /**
412
428
  * Whether to include [debug IDs](https://github.com/tc39/ecma426/blob/main/proposals/debug-id.md) in the sourcemap.
413
429
  *
414
430
  * When `true`, a unique debug ID will be emitted in source and sourcemaps which streamlines identifying sourcemaps across different builds.
@@ -1513,6 +1529,9 @@ interface ChecksOptions {
1513
1529
  * Annotations placed where they cannot annotate a call expression (e.g. before a non-call expression,
1514
1530
  * before a statement declaration, or between an identifier and `=` in a variable declarator) are
1515
1531
  * ignored by the parser. Matches Rollup's `INVALID_ANNOTATION` log code.
1532
+ *
1533
+ * By default, warnings are emitted only for local project files inside `cwd` and outside
1534
+ * `node_modules`. Set this option to `false` to disable the warning entirely.
1516
1535
  * @default true
1517
1536
  * */
1518
1537
  invalidAnnotation?: boolean;
@@ -1789,6 +1808,8 @@ interface NormalizedOutputOptions {
1789
1808
  dir: string | undefined;
1790
1809
  /** @see {@linkcode OutputOptions.entryFileNames | entryFileNames} */
1791
1810
  entryFileNames: string | ChunkFileNamesFunction;
1811
+ /** @see {@linkcode OutputOptions.sourcemapFileNames | sourcemapFileNames} */
1812
+ sourcemapFileNames: string | ChunkFileNamesFunction | undefined;
1792
1813
  /** @see {@linkcode OutputOptions.chunkFileNames | chunkFileNames} */
1793
1814
  chunkFileNames: string | ChunkFileNamesFunction;
1794
1815
  /** @see {@linkcode OutputOptions.assetFileNames | assetFileNames} */
@@ -2780,44 +2801,34 @@ declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input:
2780
2801
  declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
2781
2802
  declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[]; //#endregion
2782
2803
  //#endregion
2783
- //#region src/plugin/with-filter.d.ts
2784
- type OverrideFilterObject = {
2785
- transform?: HookFilterExtension<"transform">["filter"];
2786
- resolveId?: HookFilterExtension<"resolveId">["filter"];
2787
- load?: HookFilterExtension<"load">["filter"];
2788
- pluginNamePattern?: StringOrRegExp$1[];
2789
- };
2790
- /**
2791
- * A helper function to add plugin hook filters to a plugin or an array of plugins.
2792
- *
2793
- * @example
2794
- * ```ts
2795
- * import yaml from '@rollup/plugin-yaml';
2796
- * import { defineConfig } from 'rolldown';
2797
- * import { withFilter } from 'rolldown/filter';
2798
- *
2799
- * export default defineConfig({
2800
- * plugins: [
2801
- * // Run the transform hook of the `yaml` plugin
2802
- * // only for modules which end in `.yaml`
2803
- * withFilter(
2804
- * yaml({}),
2805
- * { transform: { id: /\.yaml$/ } },
2806
- * ),
2807
- * ],
2808
- * });
2809
- * ```
2810
- *
2811
- * @category Config
2812
- */
2813
- declare function withFilter<A, T extends RolldownPluginOption<A>>(pluginOption: T, filterObject: OverrideFilterObject | OverrideFilterObject[]): T;
2814
- //#endregion
2815
2804
  //#region src/plugin/index.d.ts
2816
2805
  type ModuleSideEffects = boolean | "no-treeshake" | null;
2817
2806
  /** @category Plugin APIs */
2818
2807
  type ModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {});
2819
2808
  /** @category Plugin APIs */
2820
2809
  type ImportKind = BindingHookResolveIdExtraArgs["kind"];
2810
+ /**
2811
+ * Descriptive metadata a plugin can expose about itself.
2812
+ *
2813
+ * Set it via the {@linkcode Plugin.meta | meta} property of the plugin object.
2814
+ *
2815
+ * @category Plugin APIs
2816
+ */
2817
+ interface PluginMeta {
2818
+ /**
2819
+ * The name of the npm package the plugin ships in, e.g. `@vitejs/plugin-vue`.
2820
+ */
2821
+ packageName?: string;
2822
+ /**
2823
+ * The version of the npm package the plugin ships in, e.g. `5.0.0`. The
2824
+ * `version` field of that package's `package.json`.
2825
+ */
2826
+ version?: string;
2827
+ /**
2828
+ * A short, human-readable description of what the plugin does.
2829
+ */
2830
+ description?: string;
2831
+ }
2821
2832
  /** @category Plugin APIs */
2822
2833
  interface CustomPluginOptions {
2823
2834
  [plugin: string]: any;
@@ -2827,6 +2838,31 @@ interface ModuleOptions {
2827
2838
  moduleSideEffects: ModuleSideEffects;
2828
2839
  /** See [Custom module meta-data section](https://rolldown.rs/apis/plugin-api/inter-plugin-communication#custom-module-meta-data) for more details. */
2829
2840
  meta: CustomPluginOptions;
2841
+ /**
2842
+ * A short, human-readable description of the module.
2843
+ *
2844
+ * This is useful for virtual modules, whose ids (e.g.
2845
+ * `\0vite/modulepreload-polyfill.js`) do not convey their purpose on their own.
2846
+ *
2847
+ * @example
2848
+ * ```js
2849
+ * function polyfillPlugin() {
2850
+ * return {
2851
+ * name: 'vite:modulepreload-polyfill',
2852
+ * load: {
2853
+ * filter: { id: /^\0vite\/modulepreload-polyfill\.js$/ },
2854
+ * handler(id) {
2855
+ * return {
2856
+ * code: '',
2857
+ * description: 'A polyfill for `link` tag with `rel="modulepreload"`',
2858
+ * };
2859
+ * }
2860
+ * },
2861
+ * };
2862
+ * }
2863
+ * ```
2864
+ */
2865
+ description?: string;
2830
2866
  invalidate?: boolean;
2831
2867
  packageJsonPath?: string;
2832
2868
  }
@@ -3255,6 +3291,15 @@ interface OutputPlugin extends Partial<{ [K in keyof PluginHooks as K & OutputPl
3255
3291
  name: string;
3256
3292
  /** The version of the plugin, for use in inter-plugin communication scenarios. */
3257
3293
  version?: string;
3294
+ /**
3295
+ * Descriptive metadata about the plugin, such as the npm package it ships in.
3296
+ *
3297
+ * This does not affect bundling; it is informational and intended to be
3298
+ * surfaced by tooling that inspects a build. See {@linkcode PluginMeta}.
3299
+ *
3300
+ * @experimental
3301
+ */
3302
+ meta?: PluginMeta;
3258
3303
  }
3259
3304
  /**
3260
3305
  * The Plugin interface.
@@ -3941,7 +3986,7 @@ interface InputOptions {
3941
3986
  * describing your use case so we can address it before the option is gone.
3942
3987
  *
3943
3988
  * @see {@link https://rolldown.rs/in-depth/lazy-barrel-optimization | Lazy Barrel Documentation}
3944
- * @default true
3989
+ * @default false
3945
3990
  */
3946
3991
  lazyBarrel?: boolean;
3947
3992
  };
@@ -4070,4 +4115,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
4070
4115
  declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
4071
4116
  declare function defineConfig(config: ConfigExport): ConfigExport;
4072
4117
  //#endregion
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 };
4118
+ export { prefixRegex as $, CodeSplittingOptions as $t, RolldownPlugin as A, NormalizedInputOptions as At, exactRegex as B, WatchOptions as Bt, ParallelPluginHooks as C, ModuleTypeFilter as Ct, ResolveIdExtraOptions as D, RolldownFsModule as Dt, PluginMeta 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, SourceDescription as M, ChecksOptions as Mt, TransformResult as N, LoggingFunction as Nt, ResolveIdResult 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, RolldownPluginOption as j, TransformOptions as jt, ResolvedId 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 };
@@ -0,0 +1,154 @@
1
+ import { Module } from "node:module";
2
+ import { MessageChannel } from "node:worker_threads";
3
+ import { fileURLToPath } from "node:url";
4
+ //#region ../../node_modules/.pnpm/fresh-import@0.2.1/node_modules/fresh-import/dist/index.js
5
+ const instanceId = Math.random().toString(36).slice(2);
6
+ const relativeImportRE = /^\.{1,2}(?:\/|\\)/;
7
+ function escapeRegExp(value) {
8
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
9
+ }
10
+ /**
11
+ * The tracking query name `fresh-import-<instance>`, where `<instance>` is a
12
+ * random value unique to this loaded module instance. Any two instances (even
13
+ * two copies of the same build loaded into the same process) get distinct
14
+ * names, so each hook only recognizes the imports it tagged itself.
15
+ */
16
+ function buildQueryName() {
17
+ return `fresh-import-${instanceId}`;
18
+ }
19
+ /**
20
+ * Build the regex that matches the tracking query `?<name>=<id>,<context>`
21
+ * (or the `&<name>=...` form).
22
+ */
23
+ function buildQueryRE(queryName) {
24
+ return new RegExp(`(?:\\?|&)${escapeRegExp(queryName)}=(\\d+),([^&]+)(?:&|$)`);
25
+ }
26
+ /**
27
+ * Build the tracking query `?<name>=<id>,<context>` that `collect` appends to
28
+ * the entry specifier. `id` cache-busts the import (a distinct URL forces a
29
+ * fresh evaluation) and `context` tags the import graph so the resolve hook can
30
+ * attribute resolved dependencies back to the originating collect.
31
+ */
32
+ function formatTrackingQuery(queryName, id, context) {
33
+ return `?${queryName}=${id},${context}`;
34
+ }
35
+ /**
36
+ * Shared body of the resolve hook for both the on-thread and off-thread
37
+ * importers. Given an already-resolved `result`, decides whether it is a tracked
38
+ * relative file dependency; if so, reports it via `onDependency` and tags the
39
+ * URL so the query propagates to its own dependencies.
40
+ *
41
+ * The sync/async difference between the two hooks lives entirely in the caller
42
+ * (which awaits `nextResolve` or not); this function performs no I/O. `result`
43
+ * is mutated in place and returned.
44
+ */
45
+ function trackResolved(specifier, context, result, queryName, queryRE, onDependency) {
46
+ const isRelativeImport = relativeImportRE.test(specifier);
47
+ if (result.format === "builtin" || !isRelativeImport) return result;
48
+ if (!context.parentURL || queryRE.test(result.url) || !result.url.startsWith("file:")) return result;
49
+ const m = queryRE.exec(context.parentURL);
50
+ if (m) {
51
+ const [, id, contextFile] = m;
52
+ onDependency(contextFile, result.url);
53
+ result.url = result.url.replace(/(\?)|$/, (_n, n1) => `?${queryName}=${id},${contextFile}${n1 === "?" ? "&" : ""}`);
54
+ }
55
+ return result;
56
+ }
57
+ var loader_default = "data:text/javascript,Math.random().toString(36).slice(2);%0Aconst relativeImportRE = /^\\.{1,2}(%3F:\\/|\\\\)/;%0Afunction escapeRegExp(value) {%0A%09return value.replace(/[.*+%3F^${}()|[\\]\\\\]/g, \"\\\\$&\");%0A}%0A/**%0A* Build the regex that matches the tracking query `%3F<name>=<id>,<context>`%0A* (or the `&<name>=...` form).%0A*/%0Afunction buildQueryRE(queryName) {%0A%09return new RegExp(`(%3F:\\\\%3F|&)${escapeRegExp(queryName)}=(\\\\d+),([^&]+)(%3F:&|$)`);%0A}%0A/**%0A* Shared body of the resolve hook for both the on-thread and off-thread%0A* importers. Given an already-resolved `result`, decides whether it is a tracked%0A* relative file dependency; if so, reports it via `onDependency` and tags the%0A* URL so the query propagates to its own dependencies.%0A*%0A* The sync/async difference between the two hooks lives entirely in the caller%0A* (which awaits `nextResolve` or not); this function performs no I/O. `result`%0A* is mutated in place and returned.%0A*/%0Afunction trackResolved(specifier, context, result, queryName, queryRE, onDependency) {%0A%09const isRelativeImport = relativeImportRE.test(specifier);%0A%09if (result.format === \"builtin\" || !isRelativeImport) return result;%0A%09if (!context.parentURL || queryRE.test(result.url) || !result.url.startsWith(\"file:\")) return result;%0A%09const m = queryRE.exec(context.parentURL);%0A%09if (m) {%0A%09%09const [, id, contextFile] = m;%0A%09%09onDependency(contextFile, result.url);%0A%09%09result.url = result.url.replace(/(\\%3F)|$/, (_n, n1) => `%3F${queryName}=${id},${contextFile}${n1 === \"%3F\" %3F \"&\" : \"\"}`);%0A%09}%0A%09return result;%0A}%0A//%23endregion%0A//%23region src/off-thread/loader.ts%0Alet port;%0Alet queryName;%0Alet queryRE;%0Aconst initialize = async (data) => {%0A%09port = data.port;%0A%09queryName = data.queryName;%0A%09queryRE = buildQueryRE(queryName);%0A};%0Aconst resolve = async (specifier, context, nextResolve) => {%0A%09return trackResolved(specifier, context, await nextResolve(specifier, context), queryName, queryRE, (ctx, url) => {%0A%09%09port.postMessage({%0A%09%09%09context: ctx,%0A%09%09%09url%0A%09%09});%0A%09});%0A};%0A//%23endregion%0Aexport { initialize, resolve };%0A";
58
+ let nextId$1 = 0;
59
+ /**
60
+ * Off-thread importer: registers an ESM loader in a worker thread via
61
+ * `Module.register` and receives tracked dependencies over a `MessagePort`.
62
+ * Used on Node versions without `Module.registerHooks`.
63
+ */
64
+ function createOffThreadImporter() {
65
+ const queryName = buildQueryName();
66
+ const { port1, port2 } = new MessageChannel();
67
+ Module.register(loader_default, {
68
+ data: {
69
+ port: port2,
70
+ queryName
71
+ },
72
+ transferList: [port2]
73
+ });
74
+ port1.unref();
75
+ return { async collect(specifier) {
76
+ const id = nextId$1++;
77
+ const depsList = /* @__PURE__ */ new Set();
78
+ const onMessage = (e) => {
79
+ if (e.context === specifier) depsList.add(e.url);
80
+ };
81
+ port1.on("message", onMessage);
82
+ port1.unref();
83
+ try {
84
+ const result = await import(specifier + formatTrackingQuery(queryName, id, specifier));
85
+ await new Promise((resolve) => setImmediate(resolve));
86
+ return {
87
+ result,
88
+ dependencies: [...depsList].filter((url) => url.startsWith("file:")).map((url) => fileURLToPath(url))
89
+ };
90
+ } finally {
91
+ port1.off("message", onMessage);
92
+ }
93
+ } };
94
+ }
95
+ let nextId = 0;
96
+ /**
97
+ * On-thread importer: registers synchronous resolution hooks via
98
+ * `Module.registerHooks` (Node 22.15+/23.5+).
99
+ */
100
+ function createOnThreadImporter() {
101
+ const registry = /* @__PURE__ */ new Map();
102
+ const queryName = buildQueryName();
103
+ const queryRE = buildQueryRE(queryName);
104
+ const resolve = (specifier, context, nextResolve) => {
105
+ return trackResolved(specifier, context, nextResolve(specifier, context), queryName, queryRE, (ctx, url) => {
106
+ registry.get(ctx)?.add(url);
107
+ });
108
+ };
109
+ Module.registerHooks({ resolve });
110
+ return { async collect(specifier) {
111
+ const id = nextId++;
112
+ const depsList = /* @__PURE__ */ new Set();
113
+ registry.set(specifier, depsList);
114
+ try {
115
+ return {
116
+ result: await import(specifier + formatTrackingQuery(queryName, id, specifier)),
117
+ dependencies: [...depsList].filter((url) => url.startsWith("file:")).map((url) => fileURLToPath(url))
118
+ };
119
+ } finally {
120
+ registry.delete(specifier);
121
+ }
122
+ } };
123
+ }
124
+ /**
125
+ * Create the importer best suited to the current runtime, or `undefined` if it
126
+ * provides neither module-hook API.
127
+ */
128
+ function createImporter() {
129
+ if (Module.registerHooks) return createOnThreadImporter();
130
+ if (Module.register) return createOffThreadImporter();
131
+ }
132
+ let importer;
133
+ let initialized = false;
134
+ /**
135
+ * Import an ESM entry in its own fresh module graph (separate from Node's module
136
+ * cache and from other concurrent imports) and report the dependency files it
137
+ * pulled in.
138
+ *
139
+ * Each call re-evaluates the entry in a fresh graph; concurrent calls stay
140
+ * isolated from one another. Only statically-imported relative dependencies are
141
+ * tracked, not dynamic imports.
142
+ *
143
+ * Returns `undefined` on runtimes that provide neither `Module.registerHooks`
144
+ * nor `Module.register`.
145
+ */
146
+ function freshImport(specifier) {
147
+ if (!initialized) {
148
+ importer = createImporter();
149
+ initialized = true;
150
+ }
151
+ return importer?.collect(specifier);
152
+ }
153
+ //#endregion
154
+ export { freshImport };
@@ -1,4 +1,4 @@
1
- import { t as rolldown } from "./rolldown-ro17jDL2.mjs";
1
+ import { t as rolldown } from "./rolldown-q16hbH0c.mjs";
2
2
  import path from "node:path";
3
3
  import { readdir } from "node:fs/promises";
4
4
  import { cwd } from "node:process";
@@ -98,21 +98,38 @@ function tryStatSync(file) {
98
98
  return fs.statSync(file, { throwIfNoEntry: false });
99
99
  } catch {}
100
100
  }
101
+ async function loadNativeConfig(resolvedPath) {
102
+ const url = pathToFileURL(resolvedPath).href;
103
+ const { freshImport } = await import("./dist-DKbukT1H.mjs");
104
+ const freshImported = freshImport(url);
105
+ if (freshImported) {
106
+ const { result } = await freshImported;
107
+ return result.default;
108
+ }
109
+ return (await import(url + "?t=" + Date.now())).default;
110
+ }
101
111
  /**
102
112
  * Load config from a file in a way that Rolldown does.
103
113
  *
104
114
  * @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
115
+ * @param options Loading options. `configLoader` selects `'bundle'` (default) or `'native'`.
105
116
  * @returns The loaded config export
106
117
  *
107
118
  * @category Config
108
119
  */
109
- async function loadConfig(configPath) {
120
+ async function loadConfig(configPath, options = {}) {
121
+ const configLoader = options.configLoader ?? "bundle";
110
122
  const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
111
123
  try {
124
+ if (configLoader === "native") return await loadNativeConfig(path.resolve(configPath));
112
125
  if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import(pathToFileURL(configPath).href)).default;
113
126
  else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return await loadTsConfig(path.resolve(configPath));
114
127
  else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
115
128
  } catch (err) {
129
+ if (configLoader === "native") {
130
+ const tsHint = SUPPORTED_TS_CONFIG_FORMATS.includes(ext) && !process.features.typescript ? " This runtime does not natively support TypeScript config files." : "";
131
+ throw new Error(`Failed to load the config file "${configPath}" using the "native" config loader.${tsHint} Try "--configLoader bundle", or register a loader such as "--import tsx".`, { cause: err });
132
+ }
116
133
  throw new Error("Error happened while loading config.", { cause: err });
117
134
  }
118
135
  }
@@ -97,7 +97,12 @@ function locate(source, search, options) {
97
97
  }
98
98
  //#endregion
99
99
  //#region src/log/logs.ts
100
- const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION", PARSE_ERROR = "PARSE_ERROR";
100
+ const INVALID_LOG_POSITION = "INVALID_LOG_POSITION";
101
+ const PLUGIN_ERROR = "PLUGIN_ERROR";
102
+ const INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
103
+ const CYCLE_LOADING = "CYCLE_LOADING";
104
+ const MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION";
105
+ const PARSE_ERROR = "PARSE_ERROR";
101
106
  function logParseError(message, id, pos) {
102
107
  return {
103
108
  code: PARSE_ERROR,
@@ -1,4 +1,4 @@
1
- import { c as logPluginError, n as error } from "./logs-aMKUxRpj.mjs";
1
+ import { c as logPluginError, n as error } from "./logs-ZGEh6uhb.mjs";
2
2
  import { BindingCallableBuiltinPlugin } from "../rolldown-binding.wasi.cjs";
3
3
  //#region src/builtin-plugin/utils.ts
4
4
  var BuiltinPlugin = class {
@@ -1,5 +1,5 @@
1
1
  import { parse, parseSync } from "../rolldown-binding.wasi.cjs";
2
- //#region ../../node_modules/.pnpm/oxc-parser@0.137.0/node_modules/oxc-parser/src-js/wrap.js
2
+ //#region ../../node_modules/.pnpm/oxc-parser@0.139.0/node_modules/oxc-parser/src-js/wrap.js
3
3
  function wrap(result) {
4
4
  let program, module, comments, errors;
5
5
  return {