@rollipop/rolldown 1.0.25 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/THIRD-PARTY-LICENSE +33 -0
  2. package/dist/cli.d.mts +1 -1
  3. package/dist/cli.mjs +17 -14
  4. package/dist/config.d.mts +1 -1
  5. package/dist/config.mjs +2 -2
  6. package/dist/experimental-default-runtime.mjs +116 -0
  7. package/dist/experimental-index.d.mts +10 -4
  8. package/dist/experimental-index.mjs +32 -16
  9. package/dist/experimental-runtime-base.mjs +95 -0
  10. package/dist/experimental-runtime.d.ts +177 -0
  11. package/dist/experimental-runtime.mjs +257 -0
  12. package/dist/filter-index.d.mts +1 -1
  13. package/dist/filter-index.mjs +1 -3
  14. package/dist/index.d.mts +3 -3
  15. package/dist/index.mjs +4 -4
  16. package/dist/parallel-plugin-worker.d.mts +1 -1
  17. package/dist/parallel-plugin-worker.mjs +3 -3
  18. package/dist/parallel-plugin.d.mts +1 -1
  19. package/dist/parse-ast-index.d.mts +1 -1
  20. package/dist/parse-ast-index.mjs +2 -2
  21. package/dist/plugins-index.d.mts +3 -3
  22. package/dist/plugins-index.mjs +2 -2
  23. package/dist/shared/binding-CuB3cgML.mjs +679 -0
  24. package/dist/shared/{binding-CyCKfYSu.d.mts → binding-We_IfeZk.d.mts} +11 -0
  25. package/dist/shared/{bindingify-input-options-CkSiXecU.mjs → bindingify-input-options-Cp0kpzhL.mjs} +453 -283
  26. package/dist/shared/{constructors-CEYV9FDo.mjs → constructors-CUnQrTUN.mjs} +10 -6
  27. package/dist/shared/{constructors-B1v9buY3.d.mts → constructors-dwVL6FXl.d.mts} +2 -2
  28. package/dist/shared/{rolldown-build-Cy0C2jvD.mjs → create-bundler-option-CAx_5u9x.mjs} +72 -179
  29. package/dist/shared/{define-config-JSiTCvYA.d.mts → define-config-D7NdzfP7.d.mts} +86 -27
  30. package/dist/shared/{error-pMeQY3Ie.mjs → error-BdMRRSIe.mjs} +1 -1
  31. package/dist/shared/{load-config-BAsjK_il.mjs → load-config-Bh1CAJT7.mjs} +2 -2
  32. package/dist/shared/{logs-ZGEh6uhb.mjs → logs-DmYCAKcW.mjs} +8 -1
  33. package/dist/shared/{misc-CoQm4NHO.mjs → misc-DOSKtd97.mjs} +9 -1
  34. package/dist/shared/{normalize-string-or-regex-CSHtENP1.mjs → normalize-string-or-regex-Bp8lvaXp.mjs} +2 -2
  35. package/dist/shared/{parse-BEeauYyL.mjs → parse-Be-cJD0d.mjs} +2 -2
  36. package/dist/shared/{prompt--dNycKSZ.mjs → prompt-CH6TK0bC.mjs} +2 -6
  37. package/dist/shared/{resolve-tsconfig-upebNbwm.mjs → resolve-tsconfig-CzlObluk.mjs} +2 -2
  38. package/dist/shared/rolldown-BTyqb0Av.mjs +178 -0
  39. package/dist/shared/{transform-DJLP9UUk.d.mts → transform-CsZGbS4Q.d.mts} +1 -1
  40. package/dist/shared/{watch-BLrLOBAp.mjs → watch-BA13XFgy.mjs} +17 -14
  41. package/dist/utils-index.d.mts +3 -3
  42. package/dist/utils-index.mjs +16 -16
  43. package/package.json +26 -16
  44. package/dist/shared/binding-DnitnDvS.mjs +0 -594
  45. package/dist/shared/rolldown-DHWEkE2v.mjs +0 -40
@@ -1,4 +1,4 @@
1
- import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CSHtENP1.mjs";
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-Bp8lvaXp.mjs";
2
2
  //#region src/builtin-plugin/constructors.ts
3
3
  function viteModulePreloadPolyfillPlugin(config) {
4
4
  return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
@@ -20,16 +20,18 @@ function viteLoadFallbackPlugin() {
20
20
  return new BuiltinPlugin("builtin:vite-load-fallback");
21
21
  }
22
22
  function viteJsonPlugin(config) {
23
- return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-json", config));
23
+ const builtinPlugin = new BuiltinPlugin("builtin:vite-json", config);
24
+ return makeBuiltinPluginCallable(builtinPlugin);
24
25
  }
25
26
  function viteBuildImportAnalysisPlugin(config) {
26
27
  return new BuiltinPlugin("builtin:vite-build-import-analysis", config);
27
28
  }
28
29
  function viteResolvePlugin(config) {
29
- return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", {
30
+ const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", {
30
31
  ...config,
31
32
  yarnPnp: typeof process === "object" && !!process.versions?.pnp
32
- }));
33
+ });
34
+ return makeBuiltinPluginCallable(builtinPlugin);
33
35
  }
34
36
  function isolatedDeclarationPlugin(config) {
35
37
  return new BuiltinPlugin("builtin:isolated-declaration", config);
@@ -52,14 +54,16 @@ function esmExternalRequirePlugin(config) {
52
54
  * This plugin should not be used for Rolldown.
53
55
  */
54
56
  function oxcRuntimePlugin() {
55
- return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:oxc-runtime"));
57
+ const builtinPlugin = new BuiltinPlugin("builtin:oxc-runtime");
58
+ return makeBuiltinPluginCallable(builtinPlugin);
56
59
  }
57
60
  function viteReactRefreshWrapperPlugin(config) {
58
61
  if (config) {
59
62
  config.include = normalizedStringOrRegex(config.include);
60
63
  config.exclude = normalizedStringOrRegex(config.exclude);
61
64
  }
62
- return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config));
65
+ const builtinPlugin = new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config);
66
+ return makeBuiltinPluginCallable(builtinPlugin);
63
67
  }
64
68
  //#endregion
65
69
  export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWebWorkerPostPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
@@ -1,5 +1,5 @@
1
- import { A as BindingViteResolvePluginConfig, C as BindingViteDynamicImportVarsPluginConfig, D as BindingViteModulePreloadPolyfillPluginConfig, O as BindingViteReactRefreshWrapperPluginConfig, S as BindingViteBuildImportAnalysisPluginConfig, T as BindingViteJsonPluginConfig, k as BindingViteReporterPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, w as BindingViteImportGlobPluginConfig } from "./binding-CyCKfYSu.mjs";
2
- import { F as BuiltinPlugin, Wt as StringOrRegExp } from "./define-config-JSiTCvYA.mjs";
1
+ import { A as BindingViteResolvePluginConfig, C as BindingViteDynamicImportVarsPluginConfig, D as BindingViteModulePreloadPolyfillPluginConfig, O as BindingViteReactRefreshWrapperPluginConfig, S as BindingViteBuildImportAnalysisPluginConfig, T as BindingViteJsonPluginConfig, k as BindingViteReporterPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, w as BindingViteImportGlobPluginConfig } from "./binding-We_IfeZk.mjs";
2
+ import { Gt as StringOrRegExp, I as BuiltinPlugin } from "./define-config-D7NdzfP7.mjs";
3
3
  //#region src/builtin-plugin/constructors.d.ts
4
4
  declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
5
5
  type DynamicImportVarsPluginConfig = Omit<BindingViteDynamicImportVarsPluginConfig, "include" | "exclude"> & {
@@ -1,9 +1,8 @@
1
- import { n as __toESM, t as require_binding } from "./binding-DnitnDvS.mjs";
2
- import { i as logInputHookInOutputPlugin, n as error } from "./logs-ZGEh6uhb.mjs";
3
- import { n as BuiltinPlugin } from "./normalize-string-or-regex-CSHtENP1.mjs";
4
- import { a as transformModuleInfo, b as VERSION, c as __decorate, d as PlainObjectLike, f as MinimalPluginContextImpl, h as LOG_LEVEL_DEBUG, i as PluginContextData, l as transformAssetSource, m as normalizeLog, o as transformToRollupOutput, p as normalizeHook, s as transformRenderedChunk, t as bindingifyInputOptions, u as lazyProp, v as LOG_LEVEL_WARN, y as logLevelPriority } from "./bindingify-input-options-CkSiXecU.mjs";
5
- import { i as unimplemented } from "./misc-CoQm4NHO.mjs";
6
- import { i as unwrapBindingResult } from "./error-pMeQY3Ie.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-CuB3cgML.mjs";
2
+ import { a as logInputHookInOutputPlugin, n as error } from "./logs-DmYCAKcW.mjs";
3
+ import { n as BuiltinPlugin } from "./normalize-string-or-regex-Bp8lvaXp.mjs";
4
+ import { C as LOG_LEVEL_WARN, T as VERSION, _ as getParallelPluginInfo, a as measureIfFunction, b as LOG_LEVEL_DEBUG, c as PluginContextData, d as transformRenderedChunk, g as MinimalPluginContextImpl, i as measureHookCost, l as transformModuleInfo, o as pluginTimingsRecorderFor, p as transformAssetSource, r as OUTPUT_OPTIONS_OWNER, t as bindingifyInputOptions, v as normalizeHook, w as logLevelPriority, y as normalizeLog } from "./bindingify-input-options-Cp0kpzhL.mjs";
5
+ import { a as unimplemented } from "./misc-DOSKtd97.mjs";
7
6
  import { Worker } from "node:worker_threads";
8
7
  import path, { sep } from "node:path";
9
8
  import { formatWithOptions, styleText } from "node:util";
@@ -11,7 +10,6 @@ import g$1 from "node:process";
11
10
  import * as tty from "node:tty";
12
11
  import os from "node:os";
13
12
  //#region src/log/logger.ts
14
- var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
15
13
  function getLogger(plugins, onLog, logLevel, watchMode) {
16
14
  const minimalPriority = logLevelPriority[logLevel];
17
15
  const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
@@ -107,7 +105,8 @@ const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
107
105
  "renderStart",
108
106
  "renderError",
109
107
  "writeBundle",
110
- "generateBundle"
108
+ "generateBundle",
109
+ "resolveFileUrl"
111
110
  ];
112
111
  const ENUMERATED_PLUGIN_HOOK_NAMES = [
113
112
  ...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
@@ -117,7 +116,15 @@ const ENUMERATED_PLUGIN_HOOK_NAMES = [
117
116
  "intro",
118
117
  "outro"
119
118
  ];
120
- ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[23], ENUMERATED_PLUGIN_HOOK_NAMES[23];
119
+ ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[23], ENUMERATED_PLUGIN_HOOK_NAMES[23], ENUMERATED_PLUGIN_HOOK_NAMES[24], ENUMERATED_PLUGIN_HOOK_NAMES[24];
120
+ //#endregion
121
+ //#region src/plugin/internal-hooks.ts
122
+ /**
123
+ * Names of the hidden hooks, alongside {@linkcode InternalFunctionPluginHooks}.
124
+ * Kept separate from `ENUMERATED_INPUT_PLUGIN_HOOK_NAMES` so the names stay out
125
+ * of the published `.d.ts` (that list's type is reachable from public types).
126
+ */
127
+ const INTERNAL_PLUGIN_HOOK_NAMES = ["hotUpdate"];
121
128
  //#endregion
122
129
  //#region src/utils/async-flatten.ts
123
130
  async function asyncFlatten(array) {
@@ -130,7 +137,7 @@ async function asyncFlatten(array) {
130
137
  //#region src/utils/normalize-plugin-option.ts
131
138
  const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
132
139
  function checkOutputPluginOption(plugins, onLog) {
133
- for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
140
+ for (const plugin of plugins) for (const hook of [...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ...INTERNAL_PLUGIN_HOOK_NAMES]) if (hook in plugin) {
134
141
  delete plugin[hook];
135
142
  onLog(LOG_LEVEL_WARN, logInputHookInOutputPlugin(plugin.name, hook));
136
143
  }
@@ -138,9 +145,10 @@ function checkOutputPluginOption(plugins, onLog) {
138
145
  }
139
146
  function normalizePlugins(plugins, anonymousPrefix) {
140
147
  for (const [index, plugin] of plugins.entries()) {
141
- if ("_parallel" in plugin) continue;
148
+ if (getParallelPluginInfo(plugin)) continue;
142
149
  if (plugin instanceof BuiltinPlugin) continue;
143
- if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
150
+ const objectPlugin = plugin;
151
+ if (!objectPlugin.name) objectPlugin.name = `${anonymousPrefix}${index + 1}`;
144
152
  }
145
153
  return plugins;
146
154
  }
@@ -181,7 +189,7 @@ var PluginDriver = class {
181
189
  function getObjectPlugins(plugins) {
182
190
  return plugins.filter((plugin) => {
183
191
  if (!plugin) return;
184
- if ("_parallel" in plugin) return;
192
+ if (getParallelPluginInfo(plugin)) return;
185
193
  if (plugin instanceof BuiltinPlugin) return;
186
194
  return plugin;
187
195
  });
@@ -1612,6 +1620,7 @@ const DevModeSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PU
1612
1620
  port: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
1613
1621
  host: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
1614
1622
  implement: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
1623
+ skipCommonRuntimeInjection: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
1615
1624
  lazy: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
1616
1625
  })]);
1617
1626
  const InputOptionsSchema = /* @__PURE__ */ strictObject({
@@ -1815,7 +1824,7 @@ const OutputOptionsSchema = /* @__PURE__ */ strictObject({
1815
1824
  topLevelVar: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Rewrite top-level declarations to use `var`.")),
1816
1825
  cleanDir: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Clean output directory before emitting output")),
1817
1826
  keepNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Keep function and class names after bundling")),
1818
- strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Lets modules be executed in the order they are declared.")),
1827
+ strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Preserve source module execution order across generated chunks.")),
1819
1828
  strict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("auto")])), /* @__PURE__ */ description("Whether to always output `\"use strict\"` directive in non-ES module outputs.")),
1820
1829
  persistentCache: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Enable persistent transform cache to disk."))
1821
1830
  });
@@ -1908,30 +1917,6 @@ function getCliSchemaInfo() {
1908
1917
  return flattenValibotSchema(CliOptionsSchema);
1909
1918
  }
1910
1919
  //#endregion
1911
- //#region src/types/rolldown-output-impl.ts
1912
- var RolldownOutputImpl = class extends PlainObjectLike {
1913
- bindingOutputs;
1914
- constructor(bindingOutputs) {
1915
- super();
1916
- this.bindingOutputs = bindingOutputs;
1917
- }
1918
- get output() {
1919
- return transformToRollupOutput(this.bindingOutputs).output;
1920
- }
1921
- __rolldown_external_memory_handle__(keepDataAlive) {
1922
- const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
1923
- if (!results.every((r) => r.freed)) {
1924
- const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
1925
- return {
1926
- freed: false,
1927
- reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
1928
- };
1929
- }
1930
- return { freed: true };
1931
- }
1932
- };
1933
- __decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
1934
- //#endregion
1935
1920
  //#region src/types/chunking-context.ts
1936
1921
  var ChunkingContextImpl = class {
1937
1922
  context;
@@ -2359,10 +2344,11 @@ ${indent}`);
2359
2344
  return causedPrefix + message + "\n" + stack + causedError;
2360
2345
  }
2361
2346
  formatArgs(args, opts) {
2362
- return formatWithOptions(opts, ...args.map((arg) => {
2347
+ const _args = args.map((arg) => {
2363
2348
  if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
2364
2349
  return arg;
2365
- }));
2350
+ });
2351
+ return formatWithOptions(opts, ..._args);
2366
2352
  }
2367
2353
  formatDate(date, opts) {
2368
2354
  return opts.date ? date.toLocaleTimeString() : "";
@@ -2898,7 +2884,7 @@ function createConsola(options = {}) {
2898
2884
  defaults: { level },
2899
2885
  stdout: process.stdout,
2900
2886
  stderr: process.stderr,
2901
- prompt: (...args) => import("./prompt--dNycKSZ.mjs").then((m) => m.prompt(...args)),
2887
+ prompt: (...args) => import("./prompt-CH6TK0bC.mjs").then((m) => m.prompt(...args)),
2902
2888
  reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
2903
2889
  ...options
2904
2890
  });
@@ -2938,10 +2924,10 @@ function createTestingLogger() {
2938
2924
  }
2939
2925
  //#endregion
2940
2926
  //#region src/utils/bindingify-output-options.ts
2941
- function bindingifyOutputOptions(outputOptions, pluginContextData) {
2927
+ function bindingifyOutputOptions(outputOptions, pluginContextData, timings) {
2942
2928
  const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapFileNames, sourcemapExcludeSources, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, comments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder } = outputOptions;
2943
2929
  if (legalComments != null) logger.warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
2944
- const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData);
2930
+ const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData, timings);
2945
2931
  return {
2946
2932
  dir,
2947
2933
  file: file == null ? void 0 : file,
@@ -2951,25 +2937,25 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
2951
2937
  sourcemap: bindingifySourcemap(sourcemap),
2952
2938
  sourcemapBaseUrl,
2953
2939
  sourcemapDebugIds,
2954
- sourcemapFileNames,
2940
+ sourcemapFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapFileNames", sourcemapFileNames),
2955
2941
  sourcemapExcludeSources,
2956
- sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules/,
2957
- sourcemapPathTransform,
2958
- banner: bindingifyAddon(banner),
2959
- footer: bindingifyAddon(footer),
2960
- postBanner: bindingifyAddon(postBanner),
2961
- postFooter: bindingifyAddon(postFooter),
2962
- intro: bindingifyAddon(intro),
2963
- outro: bindingifyAddon(outro),
2942
+ sourcemapIgnoreList: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapIgnoreList", sourcemapIgnoreList ?? /node_modules/),
2943
+ sourcemapPathTransform: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapPathTransform", sourcemapPathTransform),
2944
+ banner: bindingifyAddon(banner, "banner", timings),
2945
+ footer: bindingifyAddon(footer, "footer", timings),
2946
+ postBanner: bindingifyAddon(postBanner, "postBanner", timings),
2947
+ postFooter: bindingifyAddon(postFooter, "postFooter", timings),
2948
+ intro: bindingifyAddon(intro, "intro", timings),
2949
+ outro: bindingifyAddon(outro, "outro", timings),
2964
2950
  extend: outputOptions.extend,
2965
- globals,
2966
- paths,
2951
+ globals: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "globals", globals),
2952
+ paths: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "paths", paths),
2967
2953
  generatedCode,
2968
2954
  esModule,
2969
2955
  name,
2970
2956
  assetFileNames: bindingifyAssetFilenames(assetFileNames),
2971
- entryFileNames,
2972
- chunkFileNames,
2957
+ entryFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "entryFileNames", entryFileNames),
2958
+ chunkFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "chunkFileNames", chunkFileNames),
2973
2959
  plugins: [],
2974
2960
  minify: outputOptions.minify,
2975
2961
  externalLiveBindings: outputOptions.externalLiveBindings,
@@ -2991,9 +2977,12 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
2991
2977
  persistentCache: outputOptions.persistentCache
2992
2978
  };
2993
2979
  }
2994
- function bindingifyAddon(configAddon) {
2980
+ function bindingifyAddon(configAddon, name, timings) {
2995
2981
  if (configAddon == null || configAddon === "") return;
2996
- if (typeof configAddon === "function") return async (chunk) => configAddon(transformRenderedChunk(chunk));
2982
+ if (typeof configAddon === "function") {
2983
+ const measured = measureHookCost(timings, OUTPUT_OPTIONS_OWNER, name, configAddon);
2984
+ return async (chunk) => measured(transformRenderedChunk(chunk));
2985
+ }
2997
2986
  return configAddon;
2998
2987
  }
2999
2988
  function bindingifyFormat(format) {
@@ -3038,7 +3027,7 @@ function bindingifyComments(comments) {
3038
3027
  if (typeof comments === "boolean") return comments;
3039
3028
  return comments;
3040
3029
  }
3041
- function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData) {
3030
+ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData, timings) {
3042
3031
  let inlineDynamicImports;
3043
3032
  let effectiveChunksOption;
3044
3033
  if (codeSplitting === false) {
@@ -3081,10 +3070,11 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
3081
3070
  advancedChunksResult = {
3082
3071
  ...restOptions,
3083
3072
  groups: groups?.map((group) => {
3084
- const { name, ...restGroup } = group;
3073
+ const { name, test, ...restGroup } = group;
3085
3074
  return {
3086
3075
  ...restGroup,
3087
- name: typeof name === "function" ? (id, ctx) => name(id, new ChunkingContextImpl(ctx, pluginContextData)) : name
3076
+ test: typeof test === "function" ? measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].test", test) : test,
3077
+ name: typeof name === "function" ? measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].name", (id, ctx) => name(id, new ChunkingContextImpl(ctx, pluginContextData))) : name
3088
3078
  };
3089
3079
  })
3090
3080
  };
@@ -3096,15 +3086,19 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
3096
3086
  }
3097
3087
  //#endregion
3098
3088
  //#region src/utils/initialize-parallel-plugins.ts
3089
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
3099
3090
  async function initializeParallelPlugins(plugins) {
3100
3091
  const pluginInfos = [];
3101
- for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
3102
- const { fileUrl, options } = plugin._parallel;
3103
- pluginInfos.push({
3104
- index,
3105
- fileUrl,
3106
- options
3107
- });
3092
+ for (const [index, plugin] of plugins.entries()) {
3093
+ const parallel = getParallelPluginInfo(plugin);
3094
+ if (parallel) {
3095
+ const { fileUrl, options } = parallel;
3096
+ pluginInfos.push({
3097
+ index,
3098
+ fileUrl,
3099
+ options
3100
+ });
3101
+ }
3108
3102
  }
3109
3103
  if (pluginInfos.length <= 0) return;
3110
3104
  const count = availableParallelism();
@@ -3157,7 +3151,7 @@ const availableParallelism = () => {
3157
3151
  };
3158
3152
  //#endregion
3159
3153
  //#region src/utils/create-bundler-option.ts
3160
- async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
3154
+ async function createBundlerOptions(inputOptions, outputOptions, watchMode, measureTimings = false) {
3161
3155
  const inputPlugins = await normalizePluginOption(inputOptions.plugins);
3162
3156
  const outputPlugins = await normalizePluginOption(outputOptions.plugins);
3163
3157
  const logLevel = inputOptions.logLevel || "info";
@@ -3167,14 +3161,20 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
3167
3161
  const normalizedInputPlugins = normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX);
3168
3162
  const normalizedOutputPlugins = normalizePlugins(hookOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
3169
3163
  let plugins = [...normalizedInputPlugins, ...checkOutputPluginOption(normalizedOutputPlugins, onLog)];
3164
+ const timings = measureTimings && inputOptions.checks?.pluginTimings !== false ? pluginTimingsRecorderFor(inputOptions) : void 0;
3165
+ if (timings) outputOptions = {
3166
+ ...outputOptions,
3167
+ assetFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "assetFileNames", outputOptions.assetFileNames),
3168
+ sanitizeFileName: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sanitizeFileName", outputOptions.sanitizeFileName)
3169
+ };
3170
3170
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
3171
3171
  if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
3172
3172
  try {
3173
3173
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
3174
3174
  return {
3175
3175
  bundlerOptions: {
3176
- inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode),
3177
- outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData),
3176
+ inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings),
3177
+ outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData, timings),
3178
3178
  parallelPluginsRegistry: parallelPluginInitResult?.registry
3179
3179
  },
3180
3180
  inputOptions,
@@ -3187,111 +3187,4 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
3187
3187
  }
3188
3188
  }
3189
3189
  //#endregion
3190
- //#region src/api/rolldown/rolldown-build.ts
3191
- Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
3192
- /**
3193
- * The bundle object returned by {@linkcode rolldown} function.
3194
- *
3195
- * @category Programmatic APIs
3196
- */
3197
- var RolldownBuild = class RolldownBuild {
3198
- #inputOptions;
3199
- #bundler;
3200
- #stopWorkers;
3201
- /** @internal */
3202
- static asyncRuntimeShutdown = false;
3203
- /** @hidden should not be used directly */
3204
- constructor(inputOptions) {
3205
- this.#inputOptions = inputOptions;
3206
- this.#bundler = new import_binding.BindingBundler();
3207
- }
3208
- /**
3209
- * Whether the bundle has been closed.
3210
- *
3211
- * If the bundle is closed, calling other methods will throw an error.
3212
- */
3213
- get closed() {
3214
- return this.#bundler.closed;
3215
- }
3216
- /**
3217
- * Generate bundles in-memory.
3218
- *
3219
- * If you directly want to write bundles to disk, use the {@linkcode write} method instead.
3220
- *
3221
- * @param outputOptions The output options.
3222
- * @returns The generated bundle.
3223
- * @throws {@linkcode BundleError} When an error occurs during the build.
3224
- */
3225
- async generate(outputOptions = {}) {
3226
- return this.#build(false, outputOptions);
3227
- }
3228
- /**
3229
- * Generate and write bundles to disk.
3230
- *
3231
- * If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
3232
- *
3233
- * @param outputOptions The output options.
3234
- * @returns The generated bundle.
3235
- * @throws {@linkcode BundleError} When an error occurs during the build.
3236
- */
3237
- async write(outputOptions = {}) {
3238
- return this.#build(true, outputOptions);
3239
- }
3240
- /**
3241
- * Close the bundle and free resources.
3242
- *
3243
- * This method should be called even if the {@linkcode generate} method
3244
- * or the {@linkcode write} method threw an error. It should be called
3245
- * even if neither of the methods are called.
3246
- *
3247
- * This method is called automatically when using `using` syntax.
3248
- *
3249
- * @example
3250
- * ```js
3251
- * import { rolldown } from '@rollipop/rolldown';
3252
- *
3253
- * {
3254
- * using bundle = await rolldown({ input: 'src/main.js' });
3255
- * const output = await bundle.generate({ format: 'esm' });
3256
- * console.log(output);
3257
- * // bundle.close() is called automatically here
3258
- * }
3259
- * ```
3260
- */
3261
- async close() {
3262
- await this.#stopWorkers?.();
3263
- await this.#bundler.close();
3264
- (0, import_binding.shutdownAsyncRuntime)();
3265
- RolldownBuild.asyncRuntimeShutdown = true;
3266
- this.#stopWorkers = void 0;
3267
- }
3268
- /** @hidden documented in close method */
3269
- async [Symbol.asyncDispose]() {
3270
- await this.close();
3271
- }
3272
- /**
3273
- * @experimental
3274
- * @hidden not ready for public usage yet
3275
- */
3276
- get watchFiles() {
3277
- return Promise.resolve(this.#bundler.getWatchFiles());
3278
- }
3279
- async #build(isWrite, outputOptions) {
3280
- validateOption("output", outputOptions);
3281
- await this.#stopWorkers?.();
3282
- const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
3283
- if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)();
3284
- try {
3285
- this.#stopWorkers = option.stopWorkers;
3286
- let output;
3287
- if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
3288
- else output = await this.#bundler.generate(option.bundlerOptions);
3289
- return new RolldownOutputImpl(unwrapBindingResult(output));
3290
- } catch (e) {
3291
- await option.stopWorkers?.();
3292
- throw e;
3293
- }
3294
- }
3295
- };
3296
- //#endregion
3297
- export { getInputCliKeys as a, validateOption as c, getCliSchemaInfo as i, styleText$1 as l, createBundlerOptions as n, getOutputCliKeys as o, logger as r, validateCliOptions as s, RolldownBuild as t, PluginDriver as u };
3190
+ export { getOutputCliKeys as a, styleText$1 as c, getInputCliKeys as i, PluginDriver as l, logger as n, validateCliOptions as o, getCliSchemaInfo as r, validateOption as s, createBundlerOptions as t };