rolldown 1.0.0-beta.40 → 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 "./shared/parse-ast-index-C7EYXjEA.mjs";
2
- import { description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-BH2eQDD9.mjs";
1
+ import "./shared/parse-ast-index-DHblAIjN.mjs";
2
+ import { description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-CUdyD4rb.mjs";
3
3
  import { arraify } from "./shared/misc-CQeo-AFx.mjs";
4
- import { logger } from "./shared/logger-CiCY7ucm.mjs";
5
- import { loadConfig } from "./shared/load-config-BJ274Wsp.mjs";
4
+ import { logger } from "./shared/logger-B83ocDok.mjs";
5
+ import { loadConfig } from "./shared/load-config-a7bPxI7K.mjs";
6
6
  import path from "node:path";
7
7
  import colors from "ansis";
8
8
  import { parseArgs } from "node:util";
@@ -91,13 +91,15 @@ function normalizeCliOptions(cliOptions, positionals) {
91
91
  watch: options$1.watch ?? false
92
92
  };
93
93
  if (typeof options$1.config === "string") result.config = options$1.config;
94
+ if (options$1.environment !== void 0) result.environment = options$1.environment;
94
95
  const keysOfInput = getInputCliKeys();
95
96
  const keysOfOutput = getOutputCliKeys();
96
97
  const reservedKeys = [
97
98
  "help",
98
99
  "version",
99
100
  "config",
100
- "watch"
101
+ "watch",
102
+ "environment"
101
103
  ];
102
104
  for (let [key, value] of Object.entries(options$1)) {
103
105
  const [primary] = key.split(".");
@@ -242,7 +244,7 @@ function getClearScreenFunction(options$1) {
242
244
  }
243
245
 
244
246
  //#endregion
245
- //#region \0@oxc-project+runtime@0.92.0/helpers/usingCtx.js
247
+ //#region \0@oxc-project+runtime@0.94.0/helpers/usingCtx.js
246
248
  function _usingCtx() {
247
249
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r$1, e$1) {
248
250
  var n$1 = Error();
@@ -413,8 +415,7 @@ async function bundleInner(config, cliOptions) {
413
415
  }
414
416
  function printBundleOutputPretty(output) {
415
417
  const outputEntries = collectOutputEntries(output.output);
416
- const outputLayoutSizes = collectOutputLayoutAdjustmentSizes(outputEntries);
417
- printOutputEntries(outputEntries, outputLayoutSizes, "<DIR>");
418
+ printOutputEntries(outputEntries, collectOutputLayoutAdjustmentSizes(outputEntries), "<DIR>");
418
419
  }
419
420
  function collectOutputEntries(output) {
420
421
  return output.map((chunk) => ({
@@ -556,6 +557,13 @@ function checkNodeVersion(nodeVersion) {
556
557
  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.`);
557
558
  async function main() {
558
559
  const { rawArgs,...cliOptions } = parseCliArguments();
560
+ if (cliOptions.environment) {
561
+ const environment = Array.isArray(cliOptions.environment) ? cliOptions.environment : [cliOptions.environment];
562
+ for (const argument of environment) for (const pair of argument.split(",")) {
563
+ const [key, ...value] = pair.split(":");
564
+ process$1.env[key] = value.length === 0 ? String(true) : value.join(":");
565
+ }
566
+ }
559
567
  if (cliOptions.config || cliOptions.config === "") {
560
568
  await bundleWithConfig(cliOptions.config, cliOptions, rawArgs);
561
569
  return;
package/dist/config.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import "./shared/binding-BVXbXhPv.mjs";
2
- import { ConfigExport, defineConfig } from "./shared/define-config-0kfJrpvQ.mjs";
1
+ import "./shared/binding-CtbNz6TD.mjs";
2
+ import { ConfigExport, defineConfig } from "./shared/define-config-C9Rp3knL.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 "./shared/parse-ast-index-C7EYXjEA.mjs";
2
- import { defineConfig, version } from "./shared/src-BH2eQDD9.mjs";
1
+ import "./shared/parse-ast-index-DHblAIjN.mjs";
2
+ import { defineConfig, version } from "./shared/src-CUdyD4rb.mjs";
3
3
  import "./shared/misc-CQeo-AFx.mjs";
4
- import { loadConfig } from "./shared/load-config-BJ274Wsp.mjs";
4
+ import { loadConfig } from "./shared/load-config-a7bPxI7K.mjs";
5
5
 
6
6
  //#region src/config.ts
7
7
  const VERSION = version;
@@ -1,5 +1,5 @@
1
- import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHmrUpdate, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-BVXbXhPv.mjs";
2
- import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-0kfJrpvQ.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-C9Rp3knL.mjs";
3
3
 
4
4
  //#region src/api/dev/dev-options.d.ts
5
5
  interface DevWatchOptions {
@@ -43,7 +43,15 @@ interface DevWatchOptions {
43
43
  debounceTickRate?: number;
44
44
  }
45
45
  interface DevOptions {
46
- onHmrUpdates?: (updates: BindingHmrUpdate[], changedFiles: string[]) => void | Promise<void>;
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
@@ -54,12 +62,12 @@ declare class DevEngine {
54
62
  private constructor();
55
63
  run(): Promise<void>;
56
64
  ensureCurrentBuildFinish(): Promise<void>;
65
+ hasLatestBuildOutput(): Promise<boolean>;
57
66
  ensureLatestBuildOutput(): Promise<void>;
58
- /**
59
- * Returns true if a new build is scheduled.
60
- */
61
- scheduleBuildIfStale(): Promise<"scheduled" | "alreadyScheduled" | undefined>;
62
- invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingHmrUpdate>;
67
+ invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingClientHmrUpdate[]>;
68
+ registerModules(clientId: string, modules: string[]): void;
69
+ removeClient(clientId: string): void;
70
+ close(): Promise<void>;
63
71
  }
64
72
  //#endregion
65
73
  //#region src/api/dev/index.d.ts
@@ -144,4 +152,4 @@ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exc
144
152
  };
145
153
  declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
146
154
  //#endregion
147
- export { 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,7 +1,7 @@
1
- import { BindingDevEngine, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/parse-ast-index-C7EYXjEA.mjs";
2
- import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./shared/src-BH2eQDD9.mjs";
1
+ import { BindingClientHmrUpdate, BindingDevEngine, BindingRebuildStrategy, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/parse-ast-index-DHblAIjN.mjs";
2
+ import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./shared/src-CUdyD4rb.mjs";
3
3
  import "./shared/misc-CQeo-AFx.mjs";
4
- import { logger } from "./shared/logger-CiCY7ucm.mjs";
4
+ import { logger } from "./shared/logger-B83ocDok.mjs";
5
5
  import { pathToFileURL } from "node:url";
6
6
 
7
7
  //#region src/api/dev/dev-engine.ts
@@ -13,6 +13,7 @@ var DevEngine = class DevEngine {
13
13
  const options = await createBundlerOptions(inputOptions, outputOptions, false);
14
14
  const bindingDevOptions = {
15
15
  onHmrUpdates: devOptions.onHmrUpdates,
16
+ rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy.Auto : BindingRebuildStrategy.Never : void 0,
16
17
  watch: devOptions.watch && {
17
18
  skipWrite: devOptions.watch.skipWrite,
18
19
  usePolling: devOptions.watch.usePolling,
@@ -23,8 +24,7 @@ var DevEngine = class DevEngine {
23
24
  debounceTickRate: devOptions.watch.debounceTickRate
24
25
  }
25
26
  };
26
- const inner = new BindingDevEngine(options.bundlerOptions, bindingDevOptions);
27
- return new DevEngine(inner);
27
+ return new DevEngine(new BindingDevEngine(options.bundlerOptions, bindingDevOptions));
28
28
  }
29
29
  constructor(inner) {
30
30
  this.#inner = inner;
@@ -40,22 +40,24 @@ var DevEngine = class DevEngine {
40
40
  this.#cachedBuildFinishPromise = promise;
41
41
  return promise;
42
42
  }
43
+ async hasLatestBuildOutput() {
44
+ return this.#inner.hasLatestBuildOutput();
45
+ }
43
46
  async ensureLatestBuildOutput() {
44
47
  await this.#inner.ensureLatestBuildOutput();
45
48
  }
46
- /**
47
- * Returns true if a new build is scheduled.
48
- */
49
- async scheduleBuildIfStale() {
50
- const scheduled = await this.#inner.scheduleBuildIfStale();
51
- if (scheduled) {
52
- scheduled.wait().catch(() => {});
53
- return scheduled.alreadyScheduled() ? "alreadyScheduled" : "scheduled";
54
- }
55
- }
56
49
  async invalidate(file, firstInvalidatedBy) {
57
50
  return this.#inner.invalidate(file, firstInvalidatedBy);
58
51
  }
52
+ registerModules(clientId, modules) {
53
+ this.#inner.registerModules(clientId, modules);
54
+ }
55
+ removeClient(clientId) {
56
+ this.#inner.removeClient(clientId);
57
+ }
58
+ async close() {
59
+ await this.#inner.close();
60
+ }
59
61
  };
60
62
 
61
63
  //#endregion
@@ -70,8 +72,7 @@ var dev = DevEngine.create;
70
72
  * Calling this API will only execute the scan stage of rolldown.
71
73
  */
72
74
  const scan = async (input) => {
73
- const inputOptions = await PluginDriver.callOptionsHook(input);
74
- const build = new RolldownBuild(inputOptions);
75
+ const build = new RolldownBuild(await PluginDriver.callOptionsHook(input));
75
76
  try {
76
77
  await build.scan();
77
78
  } finally {
@@ -115,22 +116,19 @@ function wasmHelperPlugin(config) {
115
116
  return new BuiltinPlugin("builtin:wasm-helper", config);
116
117
  }
117
118
  function wasmFallbackPlugin() {
118
- const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
119
- return makeBuiltinPluginCallable(builtinPlugin);
119
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:wasm-fallback"));
120
120
  }
121
121
  function loadFallbackPlugin() {
122
122
  return new BuiltinPlugin("builtin:load-fallback");
123
123
  }
124
124
  function jsonPlugin(config) {
125
- const builtinPlugin = new BuiltinPlugin("builtin:json", config);
126
- return makeBuiltinPluginCallable(builtinPlugin);
125
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:json", config));
127
126
  }
128
127
  function buildImportAnalysisPlugin(config) {
129
128
  return new BuiltinPlugin("builtin:build-import-analysis", config);
130
129
  }
131
130
  function viteResolvePlugin(config) {
132
- const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
133
- return makeBuiltinPluginCallable(builtinPlugin);
131
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", config));
134
132
  }
135
133
  function isolatedDeclarationPlugin(config) {
136
134
  return new BuiltinPlugin("builtin:isolated-declaration", config);
@@ -149,8 +147,7 @@ function reactRefreshWrapperPlugin(config) {
149
147
  config.include = normalizedStringOrRegex(config.include);
150
148
  config.exclude = normalizedStringOrRegex(config.exclude);
151
149
  }
152
- const builtinPlugin = new BuiltinPlugin("builtin:react-refresh-wrapper", config);
153
- return makeBuiltinPluginCallable(builtinPlugin);
150
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:react-refresh-wrapper", config));
154
151
  }
155
152
 
156
153
  //#endregion
@@ -213,4 +210,4 @@ function transformPlugin(config) {
213
210
  }
214
211
 
215
212
  //#endregion
216
- export { 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 };
213
+ 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,9 @@
1
1
  export class DevRuntime {
2
+ /**
3
+ * @param {WebSocket} socket
4
+ */
5
+ constructor(socket: WebSocket);
6
+ socket: WebSocket;
2
7
  /**
3
8
  * @type {Record<string, Module>}
4
9
  */
@@ -50,6 +55,7 @@ export class DevRuntime {
50
55
  __toDynamicImportESM: any;
51
56
  /** @internal */
52
57
  __reExport: any;
58
+ sendModuleRegisteredMessage: (module: string) => void;
53
59
  }
54
60
  declare class Module {
55
61
  /**
@@ -1,4 +1,4 @@
1
- import "./shared/binding-BVXbXhPv.mjs";
2
- import { withFilter } from "./shared/define-config-0kfJrpvQ.mjs";
1
+ import "./shared/binding-CtbNz6TD.mjs";
2
+ import { withFilter } from "./shared/define-config-C9Rp3knL.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 };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { PreRenderedChunk } from "./shared/binding-BVXbXhPv.mjs";
2
- import { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, 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-0kfJrpvQ.mjs";
3
- export { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, 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 };
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-C9Rp3knL.mjs";
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 "./shared/parse-ast-index-C7EYXjEA.mjs";
2
- import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-BH2eQDD9.mjs";
1
+ import "./shared/parse-ast-index-DHblAIjN.mjs";
2
+ import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-CUdyD4rb.mjs";
3
3
  import "./shared/misc-CQeo-AFx.mjs";
4
4
 
5
5
  export { VERSION, build, defineConfig, rolldown, watch };
@@ -1,5 +1,5 @@
1
- import { registerPlugins } from "./shared/parse-ast-index-C7EYXjEA.mjs";
2
- import { PluginContextData, bindingifyPlugin } from "./shared/src-BH2eQDD9.mjs";
1
+ import { registerPlugins } from "./shared/parse-ast-index-DHblAIjN.mjs";
2
+ import { PluginContextData, bindingifyPlugin } from "./shared/src-CUdyD4rb.mjs";
3
3
  import "./shared/misc-CQeo-AFx.mjs";
4
4
  import { parentPort, workerData } from "node:worker_threads";
5
5
 
@@ -7,15 +7,14 @@ import { parentPort, workerData } from "node:worker_threads";
7
7
  const { registryId, pluginInfos, threadNumber } = workerData;
8
8
  (async () => {
9
9
  try {
10
- const plugins = await Promise.all(pluginInfos.map(async (pluginInfo) => {
10
+ registerPlugins(registryId, await Promise.all(pluginInfos.map(async (pluginInfo) => {
11
11
  const definePluginImpl = (await import(pluginInfo.fileUrl)).default;
12
12
  const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
13
13
  return {
14
14
  index: pluginInfo.index,
15
15
  plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData(() => {}, {}, []), [], () => {}, "info", false)
16
16
  };
17
- }));
18
- registerPlugins(registryId, plugins);
17
+ })));
19
18
  parentPort.postMessage({ type: "success" });
20
19
  } catch (error) {
21
20
  parentPort.postMessage({
@@ -1,5 +1,5 @@
1
- import "./shared/binding-BVXbXhPv.mjs";
2
- import { MaybePromise, Plugin } from "./shared/define-config-0kfJrpvQ.mjs";
1
+ import "./shared/binding-CtbNz6TD.mjs";
2
+ import { MaybePromise, Plugin } from "./shared/define-config-C9Rp3knL.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-BVXbXhPv.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-C7EYXjEA.mjs";
1
+ import { parseAst, parseAstAsync } from "./shared/parse-ast-index-DHblAIjN.mjs";
2
2
 
3
3
  export { parseAst, parseAstAsync };
@@ -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,21 +1154,19 @@ 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>>;
1162
- generateHmrPatch(changedFiles: Array<string>): Promise<BindingGenerateHmrPatchReturn>;
1163
- hmrInvalidate(caller: string, firstInvalidatedBy?: string | undefined | null): Promise<BindingHmrOutput>;
1164
1166
  }
1165
- declare class BindingHmrOutput {
1166
- get patch(): BindingHmrUpdate | null;
1167
- get errors(): Array<Error | BindingError>;
1167
+ declare class BindingClientHmrUpdate {
1168
+ get clientId(): string;
1169
+ get update(): BindingHmrUpdate;
1168
1170
  }
1169
1171
  declare class BindingOutputAsset {
1170
1172
  get fileName(): string;
@@ -1193,7 +1195,6 @@ declare class BindingOutputChunk {
1193
1195
  declare class BindingOutputs {
1194
1196
  get chunks(): Array<BindingOutputChunk>;
1195
1197
  get assets(): Array<BindingOutputAsset>;
1196
- get errors(): Array<Error | BindingError>;
1197
1198
  }
1198
1199
  declare class BindingRenderedChunk {
1199
1200
  get name(): string;
@@ -1250,21 +1251,17 @@ interface BindingDynamicImportVarsPluginConfig {
1250
1251
  exclude?: Array<BindingStringOrRegex>;
1251
1252
  resolver?: (id: string, importer: string) => MaybePromise<string | undefined>;
1252
1253
  }
1253
- interface BindingError {
1254
- kind: string;
1255
- message: string;
1256
- }
1254
+ type BindingError = {
1255
+ type: 'JsError';
1256
+ field0: Error;
1257
+ } | {
1258
+ type: 'NativeError';
1259
+ field0: NativeError;
1260
+ };
1257
1261
  interface BindingEsmExternalRequirePluginConfig {
1258
1262
  external: Array<BindingStringOrRegex>;
1259
1263
  skipDuplicateCheck?: boolean;
1260
1264
  }
1261
- type BindingGenerateHmrPatchReturn = {
1262
- type: 'Ok';
1263
- field0: Array<BindingHmrUpdate>;
1264
- } | {
1265
- type: 'Error';
1266
- field0: Array<Error | BindingError>;
1267
- };
1268
1265
  interface BindingHmrBoundaryOutput {
1269
1266
  boundary: string;
1270
1267
  acceptedVia: string;
@@ -1329,6 +1326,11 @@ interface BindingReactRefreshWrapperPluginConfig {
1329
1326
  jsxImportSource: string;
1330
1327
  reactRefreshHost: string;
1331
1328
  }
1329
+ declare enum BindingRebuildStrategy {
1330
+ Always = 0,
1331
+ Auto = 1,
1332
+ Never = 2,
1333
+ }
1332
1334
  interface BindingRenderBuiltUrlConfig {
1333
1335
  ssr: boolean;
1334
1336
  type: 'asset' | 'public';
@@ -1401,6 +1403,11 @@ interface BindingViteResolvePluginResolveOptions {
1401
1403
  interface BindingWasmHelperPluginConfig {
1402
1404
  decodedBase: string;
1403
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
+ }
1404
1411
  interface PreRenderedChunk {
1405
1412
  name: string;
1406
1413
  isEntry: boolean;
@@ -1410,4 +1417,4 @@ interface PreRenderedChunk {
1410
1417
  exports: Array<string>;
1411
1418
  }
1412
1419
  //#endregion
1413
- export { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHmrUpdate, 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, BindingHmrUpdate, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-BVXbXhPv.mjs";
1
+ import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-CtbNz6TD.mjs";
2
2
  import { TopLevelFilterExpression } from "@rolldown/pluginutils";
3
3
  import { Program } from "@oxc-project/types";
4
4
 
@@ -137,6 +137,29 @@ type MaybeArray<T> = T | T[];
137
137
  type StringOrRegExp = string | RegExp;
138
138
  //#endregion
139
139
  //#region src/options/output-options.d.ts
140
+ type GeneratedCodePreset = "es5" | "es2015";
141
+ interface GeneratedCodeOptions {
142
+ /**
143
+ * Whether to use Symbol.toStringTag for namespace objects.
144
+ * @default false
145
+ */
146
+ symbols?: boolean;
147
+ /**
148
+ * Allows choosing one of the presets listed above while overriding some options.
149
+ *
150
+ * ```js
151
+ * export default {
152
+ * output: {
153
+ * generatedCode: {
154
+ * preset: 'es2015',
155
+ * symbols: false
156
+ * }
157
+ * }
158
+ * };
159
+ * ```
160
+ */
161
+ preset?: GeneratedCodePreset;
162
+ }
140
163
  type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd";
141
164
  type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
142
165
  type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
@@ -195,7 +218,7 @@ interface OutputOptions {
195
218
  * // ✅ Preferred: Use string pattern for better performance
196
219
  * sourcemapIgnoreList: "vendor"
197
220
  *
198
- * // ⚠️ Use sparingly: Function calls have high overhead
221
+ * // ! Use sparingly: Function calls have high overhead
199
222
  * sourcemapIgnoreList: (source, sourcemapPath) => {
200
223
  * return source.includes('node_modules') || source.includes('.min.');
201
224
  * }
@@ -230,6 +253,7 @@ interface OutputOptions {
230
253
  minify?: boolean | "dce-only" | MinifyOptions;
231
254
  name?: string;
232
255
  globals?: Record<string, string> | GlobalsFunction;
256
+ generatedCode?: Partial<GeneratedCodeOptions>;
233
257
  externalLiveBindings?: boolean;
234
258
  inlineDynamicImports?: boolean;
235
259
  /**
@@ -520,8 +544,6 @@ declare class RolldownBuild {
520
544
  write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
521
545
  close(): Promise<void>;
522
546
  [Symbol.asyncDispose](): Promise<void>;
523
- generateHmrPatch(changedFiles: string[]): Promise<BindingHmrUpdate[]>;
524
- hmrInvalidate(file: string, firstInvalidatedBy?: string): Promise<BindingHmrUpdate>;
525
547
  get watchFiles(): Promise<string[]>;
526
548
  }
527
549
  //#endregion
@@ -1108,7 +1130,6 @@ type HmrOptions = boolean | {
1108
1130
  host?: string;
1109
1131
  port?: number;
1110
1132
  implement?: string;
1111
- new?: boolean;
1112
1133
  };
1113
1134
  type OptimizationOptions = {
1114
1135
  /**
@@ -1451,4 +1472,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
1451
1472
  declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
1452
1473
  declare function defineConfig(config: ConfigExport): ConfigExport;
1453
1474
  //#endregion
1454
- export { type AddonFunction, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, BuiltinPlugin, type ChunkFileNamesFunction, type ChunkingContext, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedFile, type ExistingRawSourceMap, type ExternalOption, type FunctionPluginHooks, type GeneralHookFilter, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, MaybePromise, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PreRenderedAsset, type RenderedChunk, type RenderedModule, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownFileStats, type RolldownFsModule, type RolldownOptions, type RolldownOptionsFunction, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RollupError, type RollupLog, type RollupLogWithString, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, StringOrRegExp, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherOptions, build, defineConfig, defineParallelPlugin, rolldown, watch, withFilter };
1475
+ export { type AddonFunction, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, BuiltinPlugin, type ChunkFileNamesFunction, type ChunkingContext, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedFile, type ExistingRawSourceMap, type ExternalOption, type FunctionPluginHooks, type GeneralHookFilter, type GeneratedCodeOptions, type GeneratedCodePreset, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, MaybePromise, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PreRenderedAsset, type RenderedChunk, type RenderedModule, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownFileStats, type RolldownFsModule, type RolldownOptions, type RolldownOptionsFunction, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RollupError, type RollupLog, type RollupLogWithString, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, StringOrRegExp, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherOptions, build, defineConfig, defineParallelPlugin, rolldown, watch, withFilter };
@@ -1,4 +1,4 @@
1
- import { rolldown } from "./src-BH2eQDD9.mjs";
1
+ import { rolldown } from "./src-CUdyD4rb.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { readdir } from "node:fs/promises";
@@ -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-D2FxOcB5.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
  });