@rolldown/browser 1.0.0-beta.41 → 1.0.0-beta.42

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.
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { ansis_default, description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-DnNenssl.mjs";
2
- import "./shared/parse-ast-index-CTl_R-Xm.mjs";
3
- import { arraify } from "./shared/dist-CHTC3-kR.mjs";
4
- import { logger } from "./shared/logger-ClMekpHZ.mjs";
5
- import { loadConfig } from "./shared/load-config-Dk8qZvLs.mjs";
1
+ import { ansis_default, description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-DbG0hppv.mjs";
2
+ import "./shared/parse-ast-index-Gktxd-oi.mjs";
3
+ import { arraify } from "./shared/dist-CU0dSkK2.mjs";
4
+ import { logger } from "./shared/logger-B83ocDok.mjs";
5
+ import { loadConfig } from "./shared/load-config-B4-CoeU7.mjs";
6
6
  import path from "node:path";
7
7
  import { parseArgs } from "node:util";
8
8
  import process$1 from "node:process";
@@ -90,13 +90,15 @@ function normalizeCliOptions(cliOptions, positionals) {
90
90
  watch: options$1.watch ?? false
91
91
  };
92
92
  if (typeof options$1.config === "string") result.config = options$1.config;
93
+ if (options$1.environment !== void 0) result.environment = options$1.environment;
93
94
  const keysOfInput = getInputCliKeys();
94
95
  const keysOfOutput = getOutputCliKeys();
95
96
  const reservedKeys = [
96
97
  "help",
97
98
  "version",
98
99
  "config",
99
- "watch"
100
+ "watch",
101
+ "environment"
100
102
  ];
101
103
  for (let [key, value] of Object.entries(options$1)) {
102
104
  const [primary] = key.split(".");
@@ -241,7 +243,7 @@ function getClearScreenFunction(options$1) {
241
243
  }
242
244
 
243
245
  //#endregion
244
- //#region \0@oxc-project+runtime@0.93.0/helpers/usingCtx.js
246
+ //#region \0@oxc-project+runtime@0.94.0/helpers/usingCtx.js
245
247
  function _usingCtx() {
246
248
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r$1, e$1) {
247
249
  var n$1 = Error();
@@ -412,8 +414,7 @@ async function bundleInner(config, cliOptions) {
412
414
  }
413
415
  function printBundleOutputPretty(output) {
414
416
  const outputEntries = collectOutputEntries(output.output);
415
- const outputLayoutSizes = collectOutputLayoutAdjustmentSizes(outputEntries);
416
- printOutputEntries(outputEntries, outputLayoutSizes, "<DIR>");
417
+ printOutputEntries(outputEntries, collectOutputLayoutAdjustmentSizes(outputEntries), "<DIR>");
417
418
  }
418
419
  function collectOutputEntries(output) {
419
420
  return output.map((chunk) => ({
@@ -555,6 +556,13 @@ function checkNodeVersion(nodeVersion) {
555
556
  if (!checkNodeVersion(process$1.versions.node)) logger.warn(`You are using Node.js ${process$1.versions.node}. Rolldown requires Node.js version 20.19+ or 22.12+. Please upgrade your Node.js version.`);
556
557
  async function main() {
557
558
  const { rawArgs,...cliOptions } = parseCliArguments();
559
+ if (cliOptions.environment) {
560
+ const environment = Array.isArray(cliOptions.environment) ? cliOptions.environment : [cliOptions.environment];
561
+ for (const argument of environment) for (const pair of argument.split(",")) {
562
+ const [key, ...value] = pair.split(":");
563
+ process$1.env[key] = value.length === 0 ? String(true) : value.join(":");
564
+ }
565
+ }
558
566
  if (cliOptions.config || cliOptions.config === "") {
559
567
  await bundleWithConfig(cliOptions.config, cliOptions, rawArgs);
560
568
  return;
package/dist/config.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import "./shared/binding-DOpOtI1J.mjs";
2
- import { ConfigExport, defineConfig } from "./shared/define-config-DzdeQbht.mjs";
1
+ import "./shared/binding-CtbNz6TD.mjs";
2
+ import { ConfigExport, defineConfig } from "./shared/define-config-xBdWOg15.mjs";
3
3
 
4
4
  //#region src/utils/load-config.d.ts
5
5
  declare function loadConfig(configPath: string): Promise<ConfigExport>;
package/dist/config.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { defineConfig, version } from "./shared/src-DnNenssl.mjs";
2
- import "./shared/parse-ast-index-CTl_R-Xm.mjs";
3
- import "./shared/dist-CHTC3-kR.mjs";
4
- import { loadConfig } from "./shared/load-config-Dk8qZvLs.mjs";
1
+ import { defineConfig, version } from "./shared/src-DbG0hppv.mjs";
2
+ import "./shared/parse-ast-index-Gktxd-oi.mjs";
3
+ import "./shared/dist-CU0dSkK2.mjs";
4
+ import { loadConfig } from "./shared/load-config-B4-CoeU7.mjs";
5
5
 
6
6
  //#region src/config.ts
7
7
  const VERSION = version;
@@ -1,5 +1,5 @@
1
- import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./src-D3uOoJau.js";
2
- import { BindingClientHmrUpdate, BindingDevEngine, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi-browser.js";
1
+ import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./src-D_rsgcbb.js";
2
+ import { BindingClientHmrUpdate, BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi-browser.js";
3
3
 
4
4
  //#region src/api/dev/dev-engine.ts
5
5
  var DevEngine = class DevEngine {
@@ -10,6 +10,7 @@ var DevEngine = class DevEngine {
10
10
  const options = await createBundlerOptions(inputOptions, outputOptions, false);
11
11
  const bindingDevOptions = {
12
12
  onHmrUpdates: devOptions.onHmrUpdates,
13
+ rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
13
14
  watch: devOptions.watch && {
14
15
  skipWrite: devOptions.watch.skipWrite,
15
16
  usePolling: devOptions.watch.usePolling,
@@ -20,8 +21,7 @@ var DevEngine = class DevEngine {
20
21
  debounceTickRate: devOptions.watch.debounceTickRate
21
22
  }
22
23
  };
23
- const inner = new BindingDevEngine(options.bundlerOptions, bindingDevOptions);
24
- return new DevEngine(inner);
24
+ return new DevEngine(new BindingDevEngine(options.bundlerOptions, bindingDevOptions));
25
25
  }
26
26
  constructor(inner) {
27
27
  this.#inner = inner;
@@ -52,6 +52,9 @@ var DevEngine = class DevEngine {
52
52
  removeClient(clientId) {
53
53
  this.#inner.removeClient(clientId);
54
54
  }
55
+ async close() {
56
+ await this.#inner.close();
57
+ }
55
58
  };
56
59
 
57
60
  //#endregion
@@ -66,8 +69,7 @@ var dev = DevEngine.create;
66
69
  * Calling this API will only execute the scan stage of rolldown.
67
70
  */
68
71
  const scan = async (input) => {
69
- const inputOptions = await PluginDriver.callOptionsHook(input);
70
- const build = new RolldownBuild(inputOptions);
72
+ const build = new RolldownBuild(await PluginDriver.callOptionsHook(input));
71
73
  try {
72
74
  await build.scan();
73
75
  } finally {
@@ -106,22 +108,19 @@ function wasmHelperPlugin(config) {
106
108
  return new BuiltinPlugin("builtin:wasm-helper", config);
107
109
  }
108
110
  function wasmFallbackPlugin() {
109
- const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
110
- return makeBuiltinPluginCallable(builtinPlugin);
111
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:wasm-fallback"));
111
112
  }
112
113
  function loadFallbackPlugin() {
113
114
  return new BuiltinPlugin("builtin:load-fallback");
114
115
  }
115
116
  function jsonPlugin(config) {
116
- const builtinPlugin = new BuiltinPlugin("builtin:json", config);
117
- return makeBuiltinPluginCallable(builtinPlugin);
117
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:json", config));
118
118
  }
119
119
  function buildImportAnalysisPlugin(config) {
120
120
  return new BuiltinPlugin("builtin:build-import-analysis", config);
121
121
  }
122
122
  function viteResolvePlugin(config) {
123
- const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
124
- return makeBuiltinPluginCallable(builtinPlugin);
123
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", config));
125
124
  }
126
125
  function isolatedDeclarationPlugin(config) {
127
126
  return new BuiltinPlugin("builtin:isolated-declaration", config);
@@ -140,8 +139,7 @@ function reactRefreshWrapperPlugin(config) {
140
139
  config.include = normalizedStringOrRegex(config.include);
141
140
  config.exclude = normalizedStringOrRegex(config.exclude);
142
141
  }
143
- const builtinPlugin = new BuiltinPlugin("builtin:react-refresh-wrapper", config);
144
- return makeBuiltinPluginCallable(builtinPlugin);
142
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:react-refresh-wrapper", config));
145
143
  }
146
144
 
147
145
  //#endregion
@@ -647,4 +645,4 @@ function transformPlugin(config) {
647
645
  }
648
646
 
649
647
  //#endregion
650
- export { BindingClientHmrUpdate, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
648
+ export { BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -1,5 +1,5 @@
1
- import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-DOpOtI1J.mjs";
2
- import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-DzdeQbht.mjs";
1
+ import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingRebuildStrategy, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-CtbNz6TD.mjs";
2
+ import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-xBdWOg15.mjs";
3
3
 
4
4
  //#region src/api/dev/dev-options.d.ts
5
5
  interface DevWatchOptions {
@@ -44,6 +44,14 @@ interface DevWatchOptions {
44
44
  }
45
45
  interface DevOptions {
46
46
  onHmrUpdates?: (updates: BindingClientHmrUpdate[], changedFiles: string[]) => void | Promise<void>;
47
+ /**
48
+ * Strategy for triggering rebuilds after HMR updates.
49
+ * - `'always'`: Always trigger a rebuild after HMR updates
50
+ * - `'auto'`: Trigger rebuild only if HMR updates contain full reload updates
51
+ * - `'never'`: Never trigger rebuild after HMR updates (default)
52
+ * @default 'auto'
53
+ */
54
+ rebuildStrategy?: "always" | "auto" | "never";
47
55
  watch?: DevWatchOptions;
48
56
  }
49
57
  //#endregion
@@ -59,6 +67,7 @@ declare class DevEngine {
59
67
  invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingClientHmrUpdate[]>;
60
68
  registerModules(clientId: string, modules: string[]): void;
61
69
  removeClient(clientId: string): void;
70
+ close(): Promise<void>;
62
71
  }
63
72
  //#endregion
64
73
  //#region src/api/dev/index.d.ts
@@ -143,4 +152,4 @@ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exc
143
152
  };
144
153
  declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
145
154
  //#endregion
146
- export { BindingClientHmrUpdate, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
155
+ export { BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -1,8 +1,8 @@
1
- import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./shared/src-DnNenssl.mjs";
2
- import "./shared/parse-ast-index-CTl_R-Xm.mjs";
3
- import "./shared/dist-CHTC3-kR.mjs";
4
- import { logger } from "./shared/logger-ClMekpHZ.mjs";
5
- import { BindingClientHmrUpdate, BindingDevEngine, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
1
+ import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./shared/src-DbG0hppv.mjs";
2
+ import "./shared/parse-ast-index-Gktxd-oi.mjs";
3
+ import "./shared/dist-CU0dSkK2.mjs";
4
+ import { logger } from "./shared/logger-B83ocDok.mjs";
5
+ import { BindingClientHmrUpdate, BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
6
6
  import { pathToFileURL } from "node:url";
7
7
 
8
8
  //#region src/api/dev/dev-engine.ts
@@ -14,6 +14,7 @@ var DevEngine = class DevEngine {
14
14
  const options = await createBundlerOptions(inputOptions, outputOptions, false);
15
15
  const bindingDevOptions = {
16
16
  onHmrUpdates: devOptions.onHmrUpdates,
17
+ rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
17
18
  watch: devOptions.watch && {
18
19
  skipWrite: devOptions.watch.skipWrite,
19
20
  usePolling: devOptions.watch.usePolling,
@@ -24,8 +25,7 @@ var DevEngine = class DevEngine {
24
25
  debounceTickRate: devOptions.watch.debounceTickRate
25
26
  }
26
27
  };
27
- const inner = new BindingDevEngine(options.bundlerOptions, bindingDevOptions);
28
- return new DevEngine(inner);
28
+ return new DevEngine(new BindingDevEngine(options.bundlerOptions, bindingDevOptions));
29
29
  }
30
30
  constructor(inner) {
31
31
  this.#inner = inner;
@@ -56,6 +56,9 @@ var DevEngine = class DevEngine {
56
56
  removeClient(clientId) {
57
57
  this.#inner.removeClient(clientId);
58
58
  }
59
+ async close() {
60
+ await this.#inner.close();
61
+ }
59
62
  };
60
63
 
61
64
  //#endregion
@@ -70,8 +73,7 @@ var dev = DevEngine.create;
70
73
  * Calling this API will only execute the scan stage of rolldown.
71
74
  */
72
75
  const scan = async (input) => {
73
- const inputOptions = await PluginDriver.callOptionsHook(input);
74
- const build = new RolldownBuild(inputOptions);
76
+ const build = new RolldownBuild(await PluginDriver.callOptionsHook(input));
75
77
  try {
76
78
  await build.scan();
77
79
  } finally {
@@ -115,22 +117,19 @@ function wasmHelperPlugin(config) {
115
117
  return new BuiltinPlugin("builtin:wasm-helper", config);
116
118
  }
117
119
  function wasmFallbackPlugin() {
118
- const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
119
- return makeBuiltinPluginCallable(builtinPlugin);
120
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:wasm-fallback"));
120
121
  }
121
122
  function loadFallbackPlugin() {
122
123
  return new BuiltinPlugin("builtin:load-fallback");
123
124
  }
124
125
  function jsonPlugin(config) {
125
- const builtinPlugin = new BuiltinPlugin("builtin:json", config);
126
- return makeBuiltinPluginCallable(builtinPlugin);
126
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:json", config));
127
127
  }
128
128
  function buildImportAnalysisPlugin(config) {
129
129
  return new BuiltinPlugin("builtin:build-import-analysis", config);
130
130
  }
131
131
  function viteResolvePlugin(config) {
132
- const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
133
- return makeBuiltinPluginCallable(builtinPlugin);
132
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", config));
134
133
  }
135
134
  function isolatedDeclarationPlugin(config) {
136
135
  return new BuiltinPlugin("builtin:isolated-declaration", config);
@@ -149,8 +148,7 @@ function reactRefreshWrapperPlugin(config) {
149
148
  config.include = normalizedStringOrRegex(config.include);
150
149
  config.exclude = normalizedStringOrRegex(config.exclude);
151
150
  }
152
- const builtinPlugin = new BuiltinPlugin("builtin:react-refresh-wrapper", config);
153
- return makeBuiltinPluginCallable(builtinPlugin);
151
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:react-refresh-wrapper", config));
154
152
  }
155
153
 
156
154
  //#endregion
@@ -213,4 +211,4 @@ function transformPlugin(config) {
213
211
  }
214
212
 
215
213
  //#endregion
216
- export { BindingClientHmrUpdate, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
214
+ export { BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -1,4 +1,4 @@
1
- import "./shared/binding-DOpOtI1J.mjs";
2
- import { withFilter } from "./shared/define-config-DzdeQbht.mjs";
1
+ import "./shared/binding-CtbNz6TD.mjs";
2
+ import { withFilter } from "./shared/define-config-xBdWOg15.mjs";
3
3
  import { and, code, exclude, id, include, moduleType, not, or, queries, query } from "@rolldown/pluginutils";
4
4
  export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
@@ -1,4 +1,4 @@
1
- import { and, arraify, code, exclude, id, include, isPromiseLike, moduleType, not, or, queries, query } from "./shared/dist-CHTC3-kR.mjs";
1
+ import { and, arraify, code, exclude, id, include, isPromiseLike, moduleType, not, or, queries, query } from "./shared/dist-CU0dSkK2.mjs";
2
2
 
3
3
  //#region src/plugin/with-filter.ts
4
4
  function withFilterImpl(pluginOption, filterObjectList) {
@@ -1,3 +1,3 @@
1
- import { VERSION, build, defineConfig, rolldown, watch } from "./src-D3uOoJau.js";
1
+ import { VERSION, build, defineConfig, rolldown, watch } from "./src-D_rsgcbb.js";
2
2
 
3
3
  export { VERSION, build, defineConfig, rolldown, watch };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { PreRenderedChunk } from "./shared/binding-DOpOtI1J.mjs";
2
- import { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch } from "./shared/define-config-DzdeQbht.mjs";
1
+ import { PreRenderedChunk } from "./shared/binding-CtbNz6TD.mjs";
2
+ import { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch } from "./shared/define-config-xBdWOg15.mjs";
3
3
  export { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-DnNenssl.mjs";
2
- import "./shared/parse-ast-index-CTl_R-Xm.mjs";
3
- import "./shared/dist-CHTC3-kR.mjs";
1
+ import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-DbG0hppv.mjs";
2
+ import "./shared/parse-ast-index-Gktxd-oi.mjs";
3
+ import "./shared/dist-CU0dSkK2.mjs";
4
4
 
5
5
  export { VERSION, build, defineConfig, rolldown, watch };
@@ -1,6 +1,6 @@
1
- import { PluginContextData, bindingifyPlugin } from "./shared/src-DnNenssl.mjs";
2
- import "./shared/parse-ast-index-CTl_R-Xm.mjs";
3
- import "./shared/dist-CHTC3-kR.mjs";
1
+ import { PluginContextData, bindingifyPlugin } from "./shared/src-DbG0hppv.mjs";
2
+ import "./shared/parse-ast-index-Gktxd-oi.mjs";
3
+ import "./shared/dist-CU0dSkK2.mjs";
4
4
  import { parentPort, workerData } from "node:worker_threads";
5
5
  import { registerPlugins } from "./rolldown-binding.wasi.cjs";
6
6
 
@@ -8,15 +8,14 @@ import { registerPlugins } from "./rolldown-binding.wasi.cjs";
8
8
  const { registryId, pluginInfos, threadNumber } = workerData;
9
9
  (async () => {
10
10
  try {
11
- const plugins = await Promise.all(pluginInfos.map(async (pluginInfo) => {
11
+ registerPlugins(registryId, await Promise.all(pluginInfos.map(async (pluginInfo) => {
12
12
  const definePluginImpl = (await import(pluginInfo.fileUrl)).default;
13
13
  const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
14
14
  return {
15
15
  index: pluginInfo.index,
16
16
  plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData(() => {}, {}, []), [], () => {}, "info", false)
17
17
  };
18
- }));
19
- registerPlugins(registryId, plugins);
18
+ })));
20
19
  parentPort.postMessage({ type: "success" });
21
20
  } catch (error) {
22
21
  parentPort.postMessage({
@@ -1,5 +1,5 @@
1
- import "./shared/binding-DOpOtI1J.mjs";
2
- import { MaybePromise, Plugin } from "./shared/define-config-DzdeQbht.mjs";
1
+ import "./shared/binding-CtbNz6TD.mjs";
2
+ import { MaybePromise, Plugin } from "./shared/define-config-xBdWOg15.mjs";
3
3
 
4
4
  //#region src/plugin/parallel-plugin-implementation.d.ts
5
5
  type ParallelPluginImplementation = Plugin;
@@ -1,4 +1,4 @@
1
- import { ParseResult, ParserOptions } from "./shared/binding-DOpOtI1J.mjs";
1
+ import { ParseResult, ParserOptions } from "./shared/binding-CtbNz6TD.mjs";
2
2
  import { Program } from "@oxc-project/types";
3
3
 
4
4
  //#region src/parse-ast-index.d.ts
@@ -1,3 +1,3 @@
1
- import { parseAst, parseAstAsync } from "./shared/parse-ast-index-CTl_R-Xm.mjs";
1
+ import { parseAst, parseAstAsync } from "./shared/parse-ast-index-Gktxd-oi.mjs";
2
2
 
3
3
  export { parseAst, parseAstAsync };
@@ -116,9 +116,9 @@ export const BindingLogLevel = __napiModule.exports.BindingLogLevel
116
116
  export const BindingPluginOrder = __napiModule.exports.BindingPluginOrder
117
117
  export const BindingPropertyReadSideEffects = __napiModule.exports.BindingPropertyReadSideEffects
118
118
  export const BindingPropertyWriteSideEffects = __napiModule.exports.BindingPropertyWriteSideEffects
119
+ export const BindingRebuildStrategy = __napiModule.exports.BindingRebuildStrategy
119
120
  export const FilterTokenKind = __napiModule.exports.FilterTokenKind
120
121
  export const initTraceSubscriber = __napiModule.exports.initTraceSubscriber
121
122
  export const registerPlugins = __napiModule.exports.registerPlugins
122
123
  export const shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
123
124
  export const startAsyncRuntime = __napiModule.exports.startAsyncRuntime
124
- export const JsWatcher = __napiModule.exports.JsWatcher
@@ -161,9 +161,9 @@ module.exports.BindingLogLevel = __napiModule.exports.BindingLogLevel
161
161
  module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
162
162
  module.exports.BindingPropertyReadSideEffects = __napiModule.exports.BindingPropertyReadSideEffects
163
163
  module.exports.BindingPropertyWriteSideEffects = __napiModule.exports.BindingPropertyWriteSideEffects
164
+ module.exports.BindingRebuildStrategy = __napiModule.exports.BindingRebuildStrategy
164
165
  module.exports.FilterTokenKind = __napiModule.exports.FilterTokenKind
165
166
  module.exports.initTraceSubscriber = __napiModule.exports.initTraceSubscriber
166
167
  module.exports.registerPlugins = __napiModule.exports.registerPlugins
167
168
  module.exports.shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
168
169
  module.exports.startAsyncRuntime = __napiModule.exports.startAsyncRuntime
169
- module.exports.JsWatcher = __napiModule.exports.JsWatcher
@@ -4,6 +4,10 @@ import * as _oxc_project_types0 from "@oxc-project/types";
4
4
  type MaybePromise<T> = T | Promise<T>;
5
5
  type VoidNullable<T = void> = T | null | undefined | void;
6
6
  type BindingStringOrRegex = string | RegExp;
7
+ type BindingResult<T> = {
8
+ errors: BindingError[];
9
+ isBindingErrors: boolean;
10
+ } | T;
7
11
  interface CodegenOptions {
8
12
  /**
9
13
  * Remove whitespace.
@@ -1150,12 +1154,12 @@ declare class BindingBundleEndEventData {
1150
1154
  }
1151
1155
  declare class BindingBundleErrorEventData {
1152
1156
  get result(): BindingBundlerImpl;
1153
- get error(): Array<Error | BindingError>;
1157
+ get error(): Array<BindingError>;
1154
1158
  }
1155
1159
  declare class BindingBundlerImpl {
1156
- write(): Promise<BindingOutputs>;
1157
- generate(): Promise<BindingOutputs>;
1158
- scan(): Promise<BindingOutputs>;
1160
+ write(): Promise<BindingResult<BindingOutputs>>;
1161
+ generate(): Promise<BindingResult<BindingOutputs>>;
1162
+ scan(): Promise<BindingResult<BindingOutputs>>;
1159
1163
  close(): Promise<void>;
1160
1164
  get closed(): boolean;
1161
1165
  getWatchFiles(): Promise<Array<string>>;
@@ -1191,7 +1195,6 @@ declare class BindingOutputChunk {
1191
1195
  declare class BindingOutputs {
1192
1196
  get chunks(): Array<BindingOutputChunk>;
1193
1197
  get assets(): Array<BindingOutputAsset>;
1194
- get errors(): Array<Error | BindingError>;
1195
1198
  }
1196
1199
  declare class BindingRenderedChunk {
1197
1200
  get name(): string;
@@ -1248,10 +1251,13 @@ interface BindingDynamicImportVarsPluginConfig {
1248
1251
  exclude?: Array<BindingStringOrRegex>;
1249
1252
  resolver?: (id: string, importer: string) => MaybePromise<string | undefined>;
1250
1253
  }
1251
- interface BindingError {
1252
- kind: string;
1253
- message: string;
1254
- }
1254
+ type BindingError = {
1255
+ type: 'JsError';
1256
+ field0: Error;
1257
+ } | {
1258
+ type: 'NativeError';
1259
+ field0: NativeError;
1260
+ };
1255
1261
  interface BindingEsmExternalRequirePluginConfig {
1256
1262
  external: Array<BindingStringOrRegex>;
1257
1263
  skipDuplicateCheck?: boolean;
@@ -1320,6 +1326,11 @@ interface BindingReactRefreshWrapperPluginConfig {
1320
1326
  jsxImportSource: string;
1321
1327
  reactRefreshHost: string;
1322
1328
  }
1329
+ declare enum BindingRebuildStrategy {
1330
+ Always = 0,
1331
+ Auto = 1,
1332
+ Never = 2,
1333
+ }
1323
1334
  interface BindingRenderBuiltUrlConfig {
1324
1335
  ssr: boolean;
1325
1336
  type: 'asset' | 'public';
@@ -1392,6 +1403,11 @@ interface BindingViteResolvePluginResolveOptions {
1392
1403
  interface BindingWasmHelperPluginConfig {
1393
1404
  decodedBase: string;
1394
1405
  }
1406
+ /** Error emitted from native side, it only contains kind and message, no stack trace. */
1407
+ interface NativeError {
1408
+ kind: string;
1409
+ message: string;
1410
+ }
1395
1411
  interface PreRenderedChunk {
1396
1412
  name: string;
1397
1413
  isEntry: boolean;
@@ -1401,4 +1417,4 @@ interface PreRenderedChunk {
1401
1417
  exports: Array<string>;
1402
1418
  }
1403
1419
  //#endregion
1404
- export { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingRenderedChunk, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, BindingWatcherEvent, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, MinifyOptions, NapiResolveOptions, ParseResult, ParserOptions, PreRenderedChunk, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform };
1420
+ export { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingRebuildStrategy, BindingRenderedChunk, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, BindingWatcherEvent, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, MinifyOptions, NapiResolveOptions, ParseResult, ParserOptions, PreRenderedChunk, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform };
@@ -1,4 +1,4 @@
1
- import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-DOpOtI1J.mjs";
1
+ import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-CtbNz6TD.mjs";
2
2
  import { Program } from "@oxc-project/types";
3
3
  import { TopLevelFilterExpression } from "@rolldown/pluginutils";
4
4
 
@@ -134,10 +134,9 @@ function exclude(expr) {
134
134
  * @returns a `And` FilterExpression
135
135
  */
136
136
  function queries(queryFilter) {
137
- let arr = Object.entries(queryFilter).map(([key, value]) => {
137
+ return and(...Object.entries(queryFilter).map(([key, value]) => {
138
138
  return new Query(key, value);
139
- });
140
- return and(...arr);
139
+ }));
141
140
  }
142
141
 
143
142
  //#endregion
@@ -1,4 +1,4 @@
1
- import { rolldown } from "./src-DnNenssl.mjs";
1
+ import { rolldown } from "./src-DbG0hppv.mjs";
2
2
  import path from "node:path";
3
3
  import { readdir } from "node:fs/promises";
4
4
  import { pathToFileURL } from "node:url";
@@ -66,8 +66,7 @@ async function findConfigFileNameInCwd() {
66
66
  throw new Error("No `rolldown.config` configuration file found.");
67
67
  }
68
68
  async function loadTsConfig(configFile) {
69
- const isEsm = isFilePathESM(configFile);
70
- const file = await bundleTsConfig(configFile, isEsm);
69
+ const file = await bundleTsConfig(configFile, isFilePathESM(configFile));
71
70
  try {
72
71
  return (await import(pathToFileURL(file).href)).default;
73
72
  } finally {
@@ -104,10 +103,8 @@ async function loadConfig(configPath) {
104
103
  const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
105
104
  try {
106
105
  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;
107
- else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) {
108
- const rawConfigPath = path.resolve(configPath);
109
- return await loadTsConfig(rawConfigPath);
110
- } else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
106
+ else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return await loadTsConfig(path.resolve(configPath));
107
+ else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
111
108
  } catch (err) {
112
109
  throw new Error("Error happened while loading config.", { cause: err });
113
110
  }
@@ -416,11 +416,10 @@ ${indent}`);
416
416
  return causedPrefix + message + "\n" + stack + causedError;
417
417
  }
418
418
  formatArgs(args, opts) {
419
- const _args = args.map((arg) => {
419
+ return formatWithOptions(opts, ...args.map((arg) => {
420
420
  if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
421
421
  return arg;
422
- });
423
- return formatWithOptions(opts, ..._args);
422
+ }));
424
423
  }
425
424
  formatDate(date, opts) {
426
425
  return opts.date ? date.toLocaleTimeString() : "";
@@ -442,11 +441,10 @@ ${indent}`);
442
441
  ]);
443
442
  }
444
443
  log(logObj, ctx) {
445
- const line = this.formatLogObj(logObj, {
444
+ return writeStream(this.formatLogObj(logObj, {
446
445
  columns: ctx.options.stdout.columns || 0,
447
446
  ...ctx.options.formatOptions
448
- });
449
- return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
447
+ }) + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
450
448
  }
451
449
  };
452
450
 
@@ -646,8 +644,7 @@ const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta
646
644
  return i()[s$1] ?? r[s$1];
647
645
  },
648
646
  has(e, s$1) {
649
- const E = i();
650
- return s$1 in E || s$1 in r;
647
+ return s$1 in i() || s$1 in r;
651
648
  },
652
649
  set(e, s$1, E) {
653
650
  const B = i(true);
@@ -944,7 +941,7 @@ function createConsola(options = {}) {
944
941
  defaults: { level },
945
942
  stdout: process.stdout,
946
943
  stderr: process.stderr,
947
- prompt: (...args) => import("./prompt-R6XhwkxA.mjs").then((m) => m.prompt(...args)),
944
+ prompt: (...args) => import("./prompt-B4e-jZUR.mjs").then((m) => m.prompt(...args)),
948
945
  reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
949
946
  ...options
950
947
  });
@@ -186,7 +186,7 @@ function augmentCodeLocation(properties, pos, source, id) {
186
186
  }
187
187
 
188
188
  //#endregion
189
- //#region ../../node_modules/.pnpm/oxc-parser@0.93.0/node_modules/oxc-parser/src-js/wrap.js
189
+ //#region ../../node_modules/.pnpm/oxc-parser@0.94.0/node_modules/oxc-parser/src-js/wrap.js
190
190
  function wrap$1(result) {
191
191
  let program, module, comments, errors;
192
192
  return {
@@ -39,28 +39,26 @@ function requireSrc() {
39
39
  save: `${ESC}7`,
40
40
  restore: `${ESC}8`
41
41
  };
42
- const scroll = {
43
- up: (count = 1) => `${CSI}S`.repeat(count),
44
- down: (count = 1) => `${CSI}T`.repeat(count)
45
- };
46
- const erase = {
47
- screen: `${CSI}2J`,
48
- up: (count = 1) => `${CSI}1J`.repeat(count),
49
- down: (count = 1) => `${CSI}J`.repeat(count),
50
- line: `${CSI}2K`,
51
- lineEnd: `${CSI}K`,
52
- lineStart: `${CSI}1K`,
53
- lines(count) {
54
- let clear = "";
55
- for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
56
- if (count) clear += cursor.left;
57
- return clear;
58
- }
59
- };
60
42
  src = {
61
43
  cursor,
62
- scroll,
63
- erase,
44
+ scroll: {
45
+ up: (count = 1) => `${CSI}S`.repeat(count),
46
+ down: (count = 1) => `${CSI}T`.repeat(count)
47
+ },
48
+ erase: {
49
+ screen: `${CSI}2J`,
50
+ up: (count = 1) => `${CSI}1J`.repeat(count),
51
+ down: (count = 1) => `${CSI}J`.repeat(count),
52
+ line: `${CSI}2K`,
53
+ lineEnd: `${CSI}K`,
54
+ lineStart: `${CSI}1K`,
55
+ lines(count) {
56
+ let clear = "";
57
+ for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
58
+ if (count) clear += cursor.left;
59
+ return clear;
60
+ }
61
+ },
64
62
  beep
65
63
  };
66
64
  return src;
@@ -1,5 +1,5 @@
1
- import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-CTl_R-Xm.mjs";
2
- import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-CHTC3-kR.mjs";
1
+ import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-Gktxd-oi.mjs";
2
+ import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-CU0dSkK2.mjs";
3
3
  import { Worker, isMainThread } from "node:worker_threads";
4
4
  import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
5
5
  import path from "node:path";
@@ -243,7 +243,7 @@ if (isMainThread) {
243
243
 
244
244
  //#endregion
245
245
  //#region package.json
246
- var version = "1.0.0-beta.41";
246
+ var version = "1.0.0-beta.42";
247
247
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
248
248
 
249
249
  //#endregion
@@ -701,7 +701,7 @@ var ansis_default = import_ansis.default;
701
701
  const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
702
702
 
703
703
  //#endregion
704
- //#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.2/node_modules/valibot/dist/index.js
704
+ //#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.3/node_modules/valibot/dist/index.js
705
705
  var store;
706
706
  /* @__NO_SIDE_EFFECTS__ */
707
707
  function getGlobalConfig(config2) {
@@ -2208,6 +2208,7 @@ const OutputCliOptionsSchema = omit(strictObject({
2208
2208
  const CliOptionsSchema = strictObject({
2209
2209
  config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
2210
2210
  help: pipe(optional(boolean()), description("Show help")),
2211
+ environment: pipe(optional(union([string(), array(string())])), description("Pass additional settings to the config file via process.ENV.")),
2211
2212
  version: pipe(optional(boolean()), description("Show version number")),
2212
2213
  watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
2213
2214
  ...InputCliOptionsSchema.entries,
@@ -2275,12 +2276,19 @@ function bindingifySourcemap$1(map) {
2275
2276
 
2276
2277
  //#endregion
2277
2278
  //#region src/utils/error.ts
2278
- function normalizeErrors(rawErrors) {
2279
- const errors = rawErrors.map((e$2) => e$2 instanceof Error ? e$2 : Object.assign(/* @__PURE__ */ new Error(), {
2280
- kind: e$2.kind,
2281
- message: e$2.message,
2279
+ function unwrapBindingResult(container) {
2280
+ if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
2281
+ return container;
2282
+ }
2283
+ function normalizeBindingError(e$2) {
2284
+ return e$2.type === "JsError" ? e$2.field0 : Object.assign(/* @__PURE__ */ new Error(), {
2285
+ kind: e$2.field0.kind,
2286
+ message: e$2.field0.message,
2282
2287
  stack: void 0
2283
- }));
2288
+ });
2289
+ }
2290
+ function aggregateBindingErrorsIntoJsError(rawErrors) {
2291
+ const errors = rawErrors.map(normalizeBindingError);
2284
2292
  let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
2285
2293
  for (let i$1 = 0; i$1 < errors.length; i$1++) {
2286
2294
  summary += "\n";
@@ -2719,7 +2727,7 @@ function bindingifyBuildEnd(args$1) {
2719
2727
  const { handler, meta } = normalizeHook(hook);
2720
2728
  return {
2721
2729
  plugin: async (ctx, err) => {
2722
- await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ? normalizeErrors(err) : void 0);
2730
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
2723
2731
  },
2724
2732
  meta: bindingifyPluginHookMeta(meta)
2725
2733
  };
@@ -2777,7 +2785,8 @@ function bindingifyResolveDynamicImport(args$1) {
2777
2785
  if (typeof ret === "string") return { id: ret };
2778
2786
  const result = {
2779
2787
  id: ret.id,
2780
- external: ret.external
2788
+ external: ret.external,
2789
+ packageJsonPath: ret.packageJsonPath
2781
2790
  };
2782
2791
  if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
2783
2792
  args$1.pluginContextData.updateModuleOption(ret.id, {
@@ -3019,14 +3028,9 @@ function transformToRollupOutputAsset(bindingAsset, changed) {
3019
3028
  });
3020
3029
  }
3021
3030
  function transformToRollupOutput(output, changed) {
3022
- handleOutputErrors(output);
3023
3031
  const { chunks, assets } = output;
3024
3032
  return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
3025
3033
  }
3026
- function handleOutputErrors(output) {
3027
- const rawErrors = output.errors;
3028
- if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
3029
- }
3030
3034
  function transformToOutputBundle(context, output, changed) {
3031
3035
  const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
3032
3036
  return new Proxy(bundle, {
@@ -3132,7 +3136,7 @@ function bindingifyRenderError(args$1) {
3132
3136
  const { handler, meta } = normalizeHook(hook);
3133
3137
  return {
3134
3138
  plugin: async (ctx, err) => {
3135
- handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), normalizeErrors(err));
3139
+ handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), aggregateBindingErrorsIntoJsError(err));
3136
3140
  },
3137
3141
  meta: bindingifyPluginHookMeta(meta)
3138
3142
  };
@@ -3148,7 +3152,7 @@ function bindingifyGenerateBundle(args$1) {
3148
3152
  deleted: /* @__PURE__ */ new Set()
3149
3153
  };
3150
3154
  const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
3151
- const output = transformToOutputBundle(context, bundle, changed);
3155
+ const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
3152
3156
  await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output, isWrite);
3153
3157
  return collectChangedBundle(changed, output);
3154
3158
  },
@@ -3166,7 +3170,7 @@ function bindingifyWriteBundle(args$1) {
3166
3170
  deleted: /* @__PURE__ */ new Set()
3167
3171
  };
3168
3172
  const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
3169
- const output = transformToOutputBundle(context, bundle, changed);
3173
+ const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
3170
3174
  await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output);
3171
3175
  return collectChangedBundle(changed, output);
3172
3176
  },
@@ -3353,7 +3357,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
3353
3357
  const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
3354
3358
  const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
3355
3359
  let hookUsage = extractHookUsage(plugin).inner();
3356
- const result = {
3360
+ return wrapHandlers({
3357
3361
  name: plugin.name,
3358
3362
  buildStart,
3359
3363
  buildStartMeta,
@@ -3400,8 +3404,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
3400
3404
  closeWatcher,
3401
3405
  closeWatcherMeta,
3402
3406
  hookUsage
3403
- };
3404
- return wrapHandlers(result);
3407
+ });
3405
3408
  }
3406
3409
  function wrapHandlers(plugin) {
3407
3410
  for (const hookName of [
@@ -4160,12 +4163,10 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
4160
4163
  let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
4161
4164
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
4162
4165
  try {
4163
- const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
4164
- const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
4165
4166
  return {
4166
4167
  bundlerOptions: {
4167
- inputOptions: bindingInputOptions,
4168
- outputOptions: bindingOutputOptions,
4168
+ inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode),
4169
+ outputOptions: bindingifyOutputOptions(outputOptions),
4169
4170
  parallelPluginsRegistry: parallelPluginInitResult?.registry
4170
4171
  },
4171
4172
  inputOptions,
@@ -4213,20 +4214,17 @@ var RolldownBuild = class RolldownBuild {
4213
4214
  }
4214
4215
  async scan() {
4215
4216
  const { impl } = await this.#getBundlerWithStopWorker({});
4216
- const output = await impl.scan();
4217
- return handleOutputErrors(output);
4217
+ unwrapBindingResult(await impl.scan());
4218
4218
  }
4219
4219
  async generate(outputOptions = {}) {
4220
4220
  validateOption("output", outputOptions);
4221
4221
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4222
- const output = await impl.generate();
4223
- return transformToRollupOutput(output);
4222
+ return transformToRollupOutput(unwrapBindingResult(await impl.generate()));
4224
4223
  }
4225
4224
  async write(outputOptions = {}) {
4226
4225
  validateOption("output", outputOptions);
4227
4226
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4228
- const output = await impl.write();
4229
- return transformToRollupOutput(output);
4227
+ return transformToRollupOutput(unwrapBindingResult(await impl.write()));
4230
4228
  }
4231
4229
  async close() {
4232
4230
  if (this.#bundlerImpl) {
@@ -4248,8 +4246,7 @@ var RolldownBuild = class RolldownBuild {
4248
4246
  //#region src/api/rolldown/index.ts
4249
4247
  const rolldown = async (input) => {
4250
4248
  validateOption("input", input);
4251
- const inputOptions = await PluginDriver.callOptionsHook(input);
4252
- return new RolldownBuild(inputOptions);
4249
+ return new RolldownBuild(await PluginDriver.callOptionsHook(input));
4253
4250
  };
4254
4251
 
4255
4252
  //#endregion
@@ -4317,7 +4314,7 @@ var WatcherEmitter = class {
4317
4314
  const data = event.bundleErrorData();
4318
4315
  await listener({
4319
4316
  code: "ERROR",
4320
- error: normalizeErrors(data.error),
4317
+ error: aggregateBindingErrorsIntoJsError(data.error),
4321
4318
  result: data.result
4322
4319
  });
4323
4320
  break;
@@ -4373,12 +4370,10 @@ var Watcher = class {
4373
4370
  async function createWatcher(emitter, input) {
4374
4371
  const options = arraify(input);
4375
4372
  const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
4376
- const inputOptions = await PluginDriver.callOptionsHook(option, true);
4377
- return createBundlerOptions(inputOptions, output, true);
4373
+ return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
4378
4374
  })).flat());
4379
4375
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4380
- const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
4381
- new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
4376
+ new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
4382
4377
  }
4383
4378
  function getValidNotifyOption(bundlerOptions) {
4384
4379
  let result;
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
 
28
28
  //#endregion
29
29
  //#region package.json
30
- var version = "1.0.0-beta.41";
30
+ var version = "1.0.0-beta.42";
31
31
 
32
32
  //#endregion
33
33
  //#region src/utils/code-frame.ts
@@ -397,10 +397,7 @@ let _lazyMatch = () => {
397
397
  throw new Error("Invalid rule");
398
398
  }), P = "abcdefghijklmnopqrstuvwxyz", ir = (r$1) => {
399
399
  let e$2 = "";
400
- for (; r$1 > 0;) {
401
- const n$2 = (r$1 - 1) % 26;
402
- e$2 = P[n$2] + e$2, r$1 = Math.floor((r$1 - 1) / 26);
403
- }
400
+ for (; r$1 > 0;) e$2 = P[(r$1 - 1) % 26] + e$2, r$1 = Math.floor((r$1 - 1) / 26);
404
401
  return e$2;
405
402
  }, O$1 = (r$1) => {
406
403
  let e$2 = 0;
@@ -414,45 +411,45 @@ let _lazyMatch = () => {
414
411
  }, or$1 = (r$1, e$2, n$2) => S(r$1, e$2).map((a$2) => String(a$2).padStart(n$2, "0")), R = (r$1, e$2) => S(O$1(r$1), O$1(e$2)).map(ir), p$1 = (r$1) => r$1, z = (r$1) => ur((e$2) => rr(e$2, r$1, { memoization: false }).join("")), ur = (r$1) => {
415
412
  const e$2 = {};
416
413
  return (n$2) => e$2[n$2] ?? (e$2[n$2] = r$1(n$2));
417
- }, sr = i$1(/^\*\*\/\*$/, ".*"), cr = i$1(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r$1, e$2, n$2) => `.*${e$2 ? "" : "(?:^|/)"}${n$2.replaceAll(".", "\\.")}`), lr = i$1(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r$1, e$2, n$2, a$2) => `.*${e$2 ? "" : "(?:^|/)"}${n$2.replaceAll(".", "\\.")}(?:${a$2.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i$1(/\\./, p$1), pr = i$1(/[$.*+?^(){}[\]\|]/, (r$1) => `\\${r$1}`), vr = i$1(/./, p$1), hr = i$1(/^(?:!!)*!(.*)$/, (r$1, e$2) => `(?!^${L(e$2)}$).*?`), dr = i$1(/^(!!)+/, ""), fr = l$1([hr, dr]), xr = i$1(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i$1(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i$1(/\/(\*\*)$/, "(?:/.*|$)"), _r = i$1(/\*\*/, ".*"), j = l$1([
418
- xr,
419
- gr,
420
- mr,
421
- _r
422
- ]), Sr = i$1(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i$1(/\*/, "[^/]*"), N = l$1([Sr, yr]), k = i$1("?", "[^/]"), $r = i$1("[", p$1), wr = i$1("]", p$1), Ar = i$1(/[!^]/, "^/"), br = i$1(/[a-z]-[a-z]|[0-9]-[0-9]/i, p$1), Cr = i$1(/[$.*+?^(){}[\|]/, (r$1) => `\\${r$1}`), Mr = i$1(/[^\]]/, p$1), Er = l$1([
414
+ }, sr = i$1(/^\*\*\/\*$/, ".*"), cr = i$1(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r$1, e$2, n$2) => `.*${e$2 ? "" : "(?:^|/)"}${n$2.replaceAll(".", "\\.")}`), lr = i$1(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r$1, e$2, n$2, a$2) => `.*${e$2 ? "" : "(?:^|/)"}${n$2.replaceAll(".", "\\.")}(?:${a$2.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i$1(/\\./, p$1), pr = i$1(/[$.*+?^(){}[\]\|]/, (r$1) => `\\${r$1}`), vr = i$1(/./, p$1), fr = l$1([i$1(/^(?:!!)*!(.*)$/, (r$1, e$2) => `(?!^${L(e$2)}$).*?`), i$1(/^(!!)+/, "")]), j = l$1([
415
+ i$1(/\/(\*\*\/)+/, "(?:/.+/|/)"),
416
+ i$1(/^(\*\*\/)+/, "(?:^|.*/)"),
417
+ i$1(/\/(\*\*)$/, "(?:/.*|$)"),
418
+ i$1(/\*\*/, ".*")
419
+ ]), N = l$1([i$1(/\*\/(?!\*\*\/)/, "[^/]*/"), i$1(/\*/, "[^/]*")]), k = i$1("?", "[^/]"), $r = i$1("[", p$1), wr = i$1("]", p$1), Ar = i$1(/[!^]/, "^/"), br = i$1(/[a-z]-[a-z]|[0-9]-[0-9]/i, p$1), Er = l$1([
423
420
  y,
424
- Cr,
421
+ i$1(/[$.*+?^(){}[\|]/, (r$1) => `\\${r$1}`),
425
422
  br,
426
- Mr
423
+ i$1(/[^\]]/, p$1)
427
424
  ]), B = x([
428
425
  $r,
429
426
  tr(Ar),
430
427
  f$1(Er),
431
428
  wr
432
- ]), Pr = i$1("{", "(?:"), Or$1 = i$1("}", ")"), Rr = i$1(/(\d+)\.\.(\d+)/, (r$1, e$2, n$2) => or$1(+e$2, +n$2, Math.min(e$2.length, n$2.length)).join("|")), zr = i$1(/([a-z]+)\.\.([a-z]+)/, (r$1, e$2, n$2) => R(e$2, n$2).join("|")), jr = i$1(/([A-Z]+)\.\.([A-Z]+)/, (r$1, e$2, n$2) => R(e$2.toLowerCase(), n$2.toLowerCase()).join("|").toUpperCase()), Nr = l$1([
433
- Rr,
434
- zr,
435
- jr
436
- ]), I = x([
429
+ ]), Pr = i$1("{", "(?:"), Or$1 = i$1("}", ")"), I = x([
437
430
  Pr,
438
- Nr,
431
+ l$1([
432
+ i$1(/(\d+)\.\.(\d+)/, (r$1, e$2, n$2) => or$1(+e$2, +n$2, Math.min(e$2.length, n$2.length)).join("|")),
433
+ i$1(/([a-z]+)\.\.([a-z]+)/, (r$1, e$2, n$2) => R(e$2, n$2).join("|")),
434
+ i$1(/([A-Z]+)\.\.([A-Z]+)/, (r$1, e$2, n$2) => R(e$2.toLowerCase(), n$2.toLowerCase()).join("|").toUpperCase())
435
+ ]),
439
436
  Or$1
440
- ]), kr = i$1("{", "(?:"), Br = i$1("}", ")"), Ir = i$1(",", "|"), Fr = i$1(/[$.*+?^(){[\]\|]/, (r$1) => `\\${r$1}`), Lr = i$1(/[^}]/, p$1), Zr = E(() => F), Dr = l$1([
441
- j,
442
- N,
443
- k,
444
- B,
445
- I,
446
- Zr,
447
- y,
448
- Fr,
449
- Ir,
450
- Lr
451
- ]), F = x([
437
+ ]), kr = i$1("{", "(?:"), Br = i$1("}", ")"), Ir = i$1(",", "|"), Fr = i$1(/[$.*+?^(){[\]\|]/, (r$1) => `\\${r$1}`), Lr = i$1(/[^}]/, p$1), F = x([
452
438
  kr,
453
- f$1(Dr),
439
+ f$1(l$1([
440
+ j,
441
+ N,
442
+ k,
443
+ B,
444
+ I,
445
+ E(() => F),
446
+ y,
447
+ Fr,
448
+ Ir,
449
+ Lr
450
+ ])),
454
451
  Br
455
- ]), Vr = f$1(l$1([
452
+ ]), L = z(f$1(l$1([
456
453
  sr,
457
454
  cr,
458
455
  lr,
@@ -466,13 +463,13 @@ let _lazyMatch = () => {
466
463
  y,
467
464
  pr,
468
465
  vr
469
- ])), L = z(Vr), Tr = i$1(/\\./, p$1), qr = i$1(/./, p$1), Hr = i$1(/\*\*\*+/, "*"), Jr = i$1(/([^/{[(!])\*\*/, (r$1, e$2) => `${e$2}*`), Qr = i$1(/(^|.)\*\*(?=[^*/)\]}])/, (r$1, e$2) => `${e$2}*`), Kr = f$1(l$1([
466
+ ]))), Tr = i$1(/\\./, p$1), qr = i$1(/./, p$1), Yr = z(f$1(l$1([
470
467
  Tr,
471
- Hr,
472
- Jr,
473
- Qr,
468
+ i$1(/\*\*\*+/, "*"),
469
+ i$1(/([^/{[(!])\*\*/, (r$1, e$2) => `${e$2}*`),
470
+ i$1(/(^|.)\*\*(?=[^*/)\]}])/, (r$1, e$2) => `${e$2}*`),
474
471
  qr
475
- ])), Yr = z(Kr), $ = (r$1, e$2) => {
472
+ ]))), $ = (r$1, e$2) => {
476
473
  const n$2 = Array.isArray(r$1) ? r$1 : [r$1];
477
474
  if (!n$2.length) return false;
478
475
  const a$2 = n$2.map($.compile), t$3 = n$2.every((s$1) => /(\/(?:\*\*)?|\[\/\])$/.test(s$1)), o$1 = e$2.replace(/[\\\/]+/g, "/").replace(/\/$/, t$3 ? "/" : "");
@@ -1146,7 +1143,7 @@ var ansis_default = import_ansis.default;
1146
1143
  const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
1147
1144
 
1148
1145
  //#endregion
1149
- //#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.2/node_modules/valibot/dist/index.js
1146
+ //#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.3/node_modules/valibot/dist/index.js
1150
1147
  var store;
1151
1148
  /* @__NO_SIDE_EFFECTS__ */
1152
1149
  function getGlobalConfig(config2) {
@@ -2564,6 +2561,7 @@ const OutputCliOptionsSchema = omit(strictObject({
2564
2561
  const CliOptionsSchema = strictObject({
2565
2562
  config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
2566
2563
  help: pipe(optional(boolean()), description("Show help")),
2564
+ environment: pipe(optional(union([string(), array(string())])), description("Pass additional settings to the config file via process.ENV.")),
2567
2565
  version: pipe(optional(boolean()), description("Show version number")),
2568
2566
  watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
2569
2567
  ...InputCliOptionsSchema.entries,
@@ -2616,12 +2614,19 @@ function bindingifySourcemap$1(map) {
2616
2614
 
2617
2615
  //#endregion
2618
2616
  //#region src/utils/error.ts
2619
- function normalizeErrors(rawErrors) {
2620
- const errors = rawErrors.map((e$2) => e$2 instanceof Error ? e$2 : Object.assign(/* @__PURE__ */ new Error(), {
2621
- kind: e$2.kind,
2622
- message: e$2.message,
2617
+ function unwrapBindingResult(container) {
2618
+ if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
2619
+ return container;
2620
+ }
2621
+ function normalizeBindingError(e$2) {
2622
+ return e$2.type === "JsError" ? e$2.field0 : Object.assign(/* @__PURE__ */ new Error(), {
2623
+ kind: e$2.field0.kind,
2624
+ message: e$2.field0.message,
2623
2625
  stack: void 0
2624
- }));
2626
+ });
2627
+ }
2628
+ function aggregateBindingErrorsIntoJsError(rawErrors) {
2629
+ const errors = rawErrors.map(normalizeBindingError);
2625
2630
  let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
2626
2631
  for (let i$1 = 0; i$1 < errors.length; i$1++) {
2627
2632
  summary += "\n";
@@ -2968,7 +2973,7 @@ function bindingPluginOrder(order) {
2968
2973
  }
2969
2974
 
2970
2975
  //#endregion
2971
- //#region ../../node_modules/.pnpm/oxc-parser@0.93.0/node_modules/oxc-parser/src-js/wrap.js
2976
+ //#region ../../node_modules/.pnpm/oxc-parser@0.94.0/node_modules/oxc-parser/src-js/wrap.js
2972
2977
  function wrap$1(result) {
2973
2978
  let program, module$1, comments, errors;
2974
2979
  return {
@@ -3220,7 +3225,7 @@ function bindingifyBuildEnd(args$1) {
3220
3225
  const { handler, meta } = normalizeHook(hook);
3221
3226
  return {
3222
3227
  plugin: async (ctx, err) => {
3223
- await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ? normalizeErrors(err) : void 0);
3228
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
3224
3229
  },
3225
3230
  meta: bindingifyPluginHookMeta(meta)
3226
3231
  };
@@ -3278,7 +3283,8 @@ function bindingifyResolveDynamicImport(args$1) {
3278
3283
  if (typeof ret === "string") return { id: ret };
3279
3284
  const result = {
3280
3285
  id: ret.id,
3281
- external: ret.external
3286
+ external: ret.external,
3287
+ packageJsonPath: ret.packageJsonPath
3282
3288
  };
3283
3289
  if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
3284
3290
  args$1.pluginContextData.updateModuleOption(ret.id, {
@@ -3520,14 +3526,9 @@ function transformToRollupOutputAsset(bindingAsset, changed) {
3520
3526
  });
3521
3527
  }
3522
3528
  function transformToRollupOutput(output, changed) {
3523
- handleOutputErrors(output);
3524
3529
  const { chunks, assets } = output;
3525
3530
  return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
3526
3531
  }
3527
- function handleOutputErrors(output) {
3528
- const rawErrors = output.errors;
3529
- if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
3530
- }
3531
3532
  function transformToOutputBundle(context, output, changed) {
3532
3533
  const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
3533
3534
  return new Proxy(bundle, {
@@ -3633,7 +3634,7 @@ function bindingifyRenderError(args$1) {
3633
3634
  const { handler, meta } = normalizeHook(hook);
3634
3635
  return {
3635
3636
  plugin: async (ctx, err) => {
3636
- handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), normalizeErrors(err));
3637
+ handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), aggregateBindingErrorsIntoJsError(err));
3637
3638
  },
3638
3639
  meta: bindingifyPluginHookMeta(meta)
3639
3640
  };
@@ -3649,7 +3650,7 @@ function bindingifyGenerateBundle(args$1) {
3649
3650
  deleted: /* @__PURE__ */ new Set()
3650
3651
  };
3651
3652
  const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
3652
- const output = transformToOutputBundle(context, bundle, changed);
3653
+ const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
3653
3654
  await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output, isWrite);
3654
3655
  return collectChangedBundle(changed, output);
3655
3656
  },
@@ -3667,7 +3668,7 @@ function bindingifyWriteBundle(args$1) {
3667
3668
  deleted: /* @__PURE__ */ new Set()
3668
3669
  };
3669
3670
  const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
3670
- const output = transformToOutputBundle(context, bundle, changed);
3671
+ const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
3671
3672
  await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output);
3672
3673
  return collectChangedBundle(changed, output);
3673
3674
  },
@@ -3854,7 +3855,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
3854
3855
  const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
3855
3856
  const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
3856
3857
  let hookUsage = extractHookUsage(plugin).inner();
3857
- const result = {
3858
+ return wrapHandlers({
3858
3859
  name: plugin.name,
3859
3860
  buildStart,
3860
3861
  buildStartMeta,
@@ -3901,8 +3902,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
3901
3902
  closeWatcher,
3902
3903
  closeWatcherMeta,
3903
3904
  hookUsage
3904
- };
3905
- return wrapHandlers(result);
3905
+ });
3906
3906
  }
3907
3907
  function wrapHandlers(plugin) {
3908
3908
  for (const hookName of [
@@ -4599,12 +4599,10 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
4599
4599
  let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
4600
4600
  const parallelPluginInitResult = void 0;
4601
4601
  try {
4602
- const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
4603
- const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
4604
4602
  return {
4605
4603
  bundlerOptions: {
4606
- inputOptions: bindingInputOptions,
4607
- outputOptions: bindingOutputOptions,
4604
+ inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode),
4605
+ outputOptions: bindingifyOutputOptions(outputOptions),
4608
4606
  parallelPluginsRegistry: parallelPluginInitResult?.registry
4609
4607
  },
4610
4608
  inputOptions,
@@ -4652,20 +4650,17 @@ var RolldownBuild = class RolldownBuild {
4652
4650
  }
4653
4651
  async scan() {
4654
4652
  const { impl } = await this.#getBundlerWithStopWorker({});
4655
- const output = await impl.scan();
4656
- return handleOutputErrors(output);
4653
+ unwrapBindingResult(await impl.scan());
4657
4654
  }
4658
4655
  async generate(outputOptions = {}) {
4659
4656
  validateOption("output", outputOptions);
4660
4657
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4661
- const output = await impl.generate();
4662
- return transformToRollupOutput(output);
4658
+ return transformToRollupOutput(unwrapBindingResult(await impl.generate()));
4663
4659
  }
4664
4660
  async write(outputOptions = {}) {
4665
4661
  validateOption("output", outputOptions);
4666
4662
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4667
- const output = await impl.write();
4668
- return transformToRollupOutput(output);
4663
+ return transformToRollupOutput(unwrapBindingResult(await impl.write()));
4669
4664
  }
4670
4665
  async close() {
4671
4666
  if (this.#bundlerImpl) {
@@ -4687,8 +4682,7 @@ var RolldownBuild = class RolldownBuild {
4687
4682
  //#region src/api/rolldown/index.ts
4688
4683
  const rolldown = async (input) => {
4689
4684
  validateOption("input", input);
4690
- const inputOptions = await PluginDriver.callOptionsHook(input);
4691
- return new RolldownBuild(inputOptions);
4685
+ return new RolldownBuild(await PluginDriver.callOptionsHook(input));
4692
4686
  };
4693
4687
 
4694
4688
  //#endregion
@@ -4756,7 +4750,7 @@ var WatcherEmitter = class {
4756
4750
  const data = event.bundleErrorData();
4757
4751
  await listener({
4758
4752
  code: "ERROR",
4759
- error: normalizeErrors(data.error),
4753
+ error: aggregateBindingErrorsIntoJsError(data.error),
4760
4754
  result: data.result
4761
4755
  });
4762
4756
  break;
@@ -4812,12 +4806,10 @@ var Watcher = class {
4812
4806
  async function createWatcher(emitter, input) {
4813
4807
  const options = arraify(input);
4814
4808
  const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
4815
- const inputOptions = await PluginDriver.callOptionsHook(option, true);
4816
- return createBundlerOptions(inputOptions, output, true);
4809
+ return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
4817
4810
  })).flat());
4818
4811
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4819
- const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
4820
- new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
4812
+ new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
4821
4813
  }
4822
4814
  function getValidNotifyOption(bundlerOptions) {
4823
4815
  let result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolldown/browser",
3
- "version": "1.0.0-beta.41",
3
+ "version": "1.0.0-beta.42",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "type": "module",