rolldown 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-LICENSE +33 -0
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +9 -10
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +2 -2
- package/dist/experimental-default-runtime.mjs +116 -0
- package/dist/experimental-index.d.mts +10 -4
- package/dist/experimental-index.mjs +32 -16
- package/dist/experimental-runtime-base.mjs +95 -0
- package/dist/experimental-runtime.d.ts +177 -0
- package/dist/experimental-runtime.mjs +257 -0
- package/dist/filter-index.d.mts +1 -1
- package/dist/filter-index.mjs +1 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/parallel-plugin-worker.d.mts +1 -1
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.mts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +2 -2
- package/dist/plugins-index.d.mts +3 -3
- package/dist/plugins-index.mjs +2 -2
- package/dist/shared/{binding-Dbbi0RbO.d.mts → binding-CVtkJvyl.d.mts} +11 -0
- package/dist/shared/{binding-Dby9rwGk.mjs → binding-DwUQWZOo.mjs} +124 -50
- package/dist/shared/{bindingify-input-options-_ppP73I9.mjs → bindingify-input-options-BHixd47T.mjs} +448 -268
- package/dist/shared/{constructors-CSWbNgBZ.d.mts → constructors-ALilxAii.d.mts} +2 -2
- package/dist/shared/{constructors-CuGa75s-.mjs → constructors-COwFYQna.mjs} +10 -6
- package/dist/shared/{rolldown-build-CdF8HAHX.mjs → create-bundler-option-LuUKlAT7.mjs} +72 -179
- package/dist/shared/{define-config-B-IDOhDz.d.mts → define-config-DSMNXceb.d.mts} +85 -22
- package/dist/shared/{error-DFGNOCle.mjs → error-nLggAzpQ.mjs} +1 -1
- package/dist/shared/{load-config-C6UyiS41.mjs → load-config-cRWJAHTc.mjs} +2 -2
- package/dist/shared/{logs-ZGEh6uhb.mjs → logs-DmYCAKcW.mjs} +8 -1
- package/dist/shared/{misc-CoQm4NHO.mjs → misc-DOSKtd97.mjs} +9 -1
- package/dist/shared/{normalize-string-or-regex-SiXbePVH.mjs → normalize-string-or-regex-Cj-DgIV1.mjs} +2 -2
- package/dist/shared/{parse-BFj5G_7i.mjs → parse-C17W7W5g.mjs} +2 -2
- package/dist/shared/{prompt--dNycKSZ.mjs → prompt-CH6TK0bC.mjs} +2 -6
- package/dist/shared/{resolve-tsconfig-2TXRF_zr.mjs → resolve-tsconfig-CE3HNSOK.mjs} +2 -2
- package/dist/shared/rolldown-D23fYgSS.mjs +178 -0
- package/dist/shared/{transform-Cs2bUDRH.d.mts → transform-WmU_cI8e.d.mts} +1 -1
- package/dist/shared/{watch-WnrlHRS0.mjs → watch-DcgK_L55.mjs} +16 -13
- package/dist/utils-index.d.mts +3 -3
- package/dist/utils-index.mjs +6 -8
- package/package.json +32 -25
- package/dist/shared/rolldown-951h_1lf.mjs +0 -40
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as BindingViteJsonPluginConfig, D as BindingViteReporterPluginConfig, E as BindingViteReactRefreshWrapperPluginConfig, O as BindingViteResolvePluginConfig, S as BindingViteImportGlobPluginConfig, T as BindingViteModulePreloadPolyfillPluginConfig, b as BindingViteBuildImportAnalysisPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, x as BindingViteDynamicImportVarsPluginConfig } from "./binding-
|
|
2
|
-
import {
|
|
1
|
+
import { C as BindingViteJsonPluginConfig, D as BindingViteReporterPluginConfig, E as BindingViteReactRefreshWrapperPluginConfig, O as BindingViteResolvePluginConfig, S as BindingViteImportGlobPluginConfig, T as BindingViteModulePreloadPolyfillPluginConfig, b as BindingViteBuildImportAnalysisPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, x as BindingViteDynamicImportVarsPluginConfig } from "./binding-CVtkJvyl.mjs";
|
|
2
|
+
import { Gt as StringOrRegExp, I as BuiltinPlugin } from "./define-config-DSMNXceb.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,4 +1,4 @@
|
|
|
1
|
-
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-
|
|
1
|
+
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-Cj-DgIV1.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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,9 +1,8 @@
|
|
|
1
|
-
import { n as __toESM, t as require_binding } from "./binding-
|
|
2
|
-
import {
|
|
3
|
-
import { n as BuiltinPlugin } from "./normalize-string-or-regex-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { i as unwrapBindingResult } from "./error-DFGNOCle.mjs";
|
|
1
|
+
import { n as __toESM, t as require_binding } from "./binding-DwUQWZOo.mjs";
|
|
2
|
+
import { a as logInputHookInOutputPlugin, n as error } from "./logs-DmYCAKcW.mjs";
|
|
3
|
+
import { n as BuiltinPlugin } from "./normalize-string-or-regex-Cj-DgIV1.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-BHixd47T.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()) => {
|
|
@@ -106,7 +104,8 @@ const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
|
|
|
106
104
|
"renderStart",
|
|
107
105
|
"renderError",
|
|
108
106
|
"writeBundle",
|
|
109
|
-
"generateBundle"
|
|
107
|
+
"generateBundle",
|
|
108
|
+
"resolveFileUrl"
|
|
110
109
|
];
|
|
111
110
|
const ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
112
111
|
...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
|
|
@@ -116,7 +115,15 @@ const ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
|
116
115
|
"intro",
|
|
117
116
|
"outro"
|
|
118
117
|
];
|
|
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];
|
|
118
|
+
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
|
+
//#endregion
|
|
120
|
+
//#region src/plugin/internal-hooks.ts
|
|
121
|
+
/**
|
|
122
|
+
* Names of the hidden hooks, alongside {@linkcode InternalFunctionPluginHooks}.
|
|
123
|
+
* Kept separate from `ENUMERATED_INPUT_PLUGIN_HOOK_NAMES` so the names stay out
|
|
124
|
+
* of the published `.d.ts` (that list's type is reachable from public types).
|
|
125
|
+
*/
|
|
126
|
+
const INTERNAL_PLUGIN_HOOK_NAMES = ["hotUpdate"];
|
|
120
127
|
//#endregion
|
|
121
128
|
//#region src/utils/async-flatten.ts
|
|
122
129
|
async function asyncFlatten(array) {
|
|
@@ -129,7 +136,7 @@ async function asyncFlatten(array) {
|
|
|
129
136
|
//#region src/utils/normalize-plugin-option.ts
|
|
130
137
|
const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
131
138
|
function checkOutputPluginOption(plugins, onLog) {
|
|
132
|
-
for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
|
|
139
|
+
for (const plugin of plugins) for (const hook of [...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ...INTERNAL_PLUGIN_HOOK_NAMES]) if (hook in plugin) {
|
|
133
140
|
delete plugin[hook];
|
|
134
141
|
onLog(LOG_LEVEL_WARN, logInputHookInOutputPlugin(plugin.name, hook));
|
|
135
142
|
}
|
|
@@ -137,9 +144,10 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
137
144
|
}
|
|
138
145
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
139
146
|
for (const [index, plugin] of plugins.entries()) {
|
|
140
|
-
if (
|
|
147
|
+
if (getParallelPluginInfo(plugin)) continue;
|
|
141
148
|
if (plugin instanceof BuiltinPlugin) continue;
|
|
142
|
-
|
|
149
|
+
const objectPlugin = plugin;
|
|
150
|
+
if (!objectPlugin.name) objectPlugin.name = `${anonymousPrefix}${index + 1}`;
|
|
143
151
|
}
|
|
144
152
|
return plugins;
|
|
145
153
|
}
|
|
@@ -180,7 +188,7 @@ var PluginDriver = class {
|
|
|
180
188
|
function getObjectPlugins(plugins) {
|
|
181
189
|
return plugins.filter((plugin) => {
|
|
182
190
|
if (!plugin) return;
|
|
183
|
-
if (
|
|
191
|
+
if (getParallelPluginInfo(plugin)) return;
|
|
184
192
|
if (plugin instanceof BuiltinPlugin) return;
|
|
185
193
|
return plugin;
|
|
186
194
|
});
|
|
@@ -1604,6 +1612,7 @@ const DevModeSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PU
|
|
|
1604
1612
|
port: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
1605
1613
|
host: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1606
1614
|
implement: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1615
|
+
skipCommonRuntimeInjection: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1607
1616
|
lazy: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
1608
1617
|
})]);
|
|
1609
1618
|
const InputOptionsSchema = /* @__PURE__ */ strictObject({
|
|
@@ -1805,7 +1814,7 @@ const OutputOptionsSchema = /* @__PURE__ */ strictObject({
|
|
|
1805
1814
|
topLevelVar: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Rewrite top-level declarations to use `var`.")),
|
|
1806
1815
|
cleanDir: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Clean output directory before emitting output")),
|
|
1807
1816
|
keepNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Keep function and class names after bundling")),
|
|
1808
|
-
strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("
|
|
1817
|
+
strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Preserve source module execution order across generated chunks.")),
|
|
1809
1818
|
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."))
|
|
1810
1819
|
});
|
|
1811
1820
|
const getAddonDescription = (placement, wrapper) => {
|
|
@@ -1897,30 +1906,6 @@ function getCliSchemaInfo() {
|
|
|
1897
1906
|
return flattenValibotSchema(CliOptionsSchema);
|
|
1898
1907
|
}
|
|
1899
1908
|
//#endregion
|
|
1900
|
-
//#region src/types/rolldown-output-impl.ts
|
|
1901
|
-
var RolldownOutputImpl = class extends PlainObjectLike {
|
|
1902
|
-
bindingOutputs;
|
|
1903
|
-
constructor(bindingOutputs) {
|
|
1904
|
-
super();
|
|
1905
|
-
this.bindingOutputs = bindingOutputs;
|
|
1906
|
-
}
|
|
1907
|
-
get output() {
|
|
1908
|
-
return transformToRollupOutput(this.bindingOutputs).output;
|
|
1909
|
-
}
|
|
1910
|
-
__rolldown_external_memory_handle__(keepDataAlive) {
|
|
1911
|
-
const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
|
|
1912
|
-
if (!results.every((r) => r.freed)) {
|
|
1913
|
-
const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
|
|
1914
|
-
return {
|
|
1915
|
-
freed: false,
|
|
1916
|
-
reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
|
|
1917
|
-
};
|
|
1918
|
-
}
|
|
1919
|
-
return { freed: true };
|
|
1920
|
-
}
|
|
1921
|
-
};
|
|
1922
|
-
__decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
|
|
1923
|
-
//#endregion
|
|
1924
1909
|
//#region src/types/chunking-context.ts
|
|
1925
1910
|
var ChunkingContextImpl = class {
|
|
1926
1911
|
context;
|
|
@@ -2348,10 +2333,11 @@ ${indent}`);
|
|
|
2348
2333
|
return causedPrefix + message + "\n" + stack + causedError;
|
|
2349
2334
|
}
|
|
2350
2335
|
formatArgs(args, opts) {
|
|
2351
|
-
|
|
2336
|
+
const _args = args.map((arg) => {
|
|
2352
2337
|
if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
|
|
2353
2338
|
return arg;
|
|
2354
|
-
})
|
|
2339
|
+
});
|
|
2340
|
+
return formatWithOptions(opts, ..._args);
|
|
2355
2341
|
}
|
|
2356
2342
|
formatDate(date, opts) {
|
|
2357
2343
|
return opts.date ? date.toLocaleTimeString() : "";
|
|
@@ -2887,7 +2873,7 @@ function createConsola(options = {}) {
|
|
|
2887
2873
|
defaults: { level },
|
|
2888
2874
|
stdout: process.stdout,
|
|
2889
2875
|
stderr: process.stderr,
|
|
2890
|
-
prompt: (...args) => import("./prompt
|
|
2876
|
+
prompt: (...args) => import("./prompt-CH6TK0bC.mjs").then((m) => m.prompt(...args)),
|
|
2891
2877
|
reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
2892
2878
|
...options
|
|
2893
2879
|
});
|
|
@@ -2927,10 +2913,10 @@ function createTestingLogger() {
|
|
|
2927
2913
|
}
|
|
2928
2914
|
//#endregion
|
|
2929
2915
|
//#region src/utils/bindingify-output-options.ts
|
|
2930
|
-
function bindingifyOutputOptions(outputOptions, pluginContextData) {
|
|
2916
|
+
function bindingifyOutputOptions(outputOptions, pluginContextData, timings) {
|
|
2931
2917
|
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;
|
|
2932
2918
|
if (legalComments != null) logger.warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
|
|
2933
|
-
const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData);
|
|
2919
|
+
const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData, timings);
|
|
2934
2920
|
return {
|
|
2935
2921
|
dir,
|
|
2936
2922
|
file: file == null ? void 0 : file,
|
|
@@ -2940,25 +2926,25 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
|
|
|
2940
2926
|
sourcemap: bindingifySourcemap(sourcemap),
|
|
2941
2927
|
sourcemapBaseUrl,
|
|
2942
2928
|
sourcemapDebugIds,
|
|
2943
|
-
sourcemapFileNames,
|
|
2929
|
+
sourcemapFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapFileNames", sourcemapFileNames),
|
|
2944
2930
|
sourcemapExcludeSources,
|
|
2945
|
-
sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules
|
|
2946
|
-
sourcemapPathTransform,
|
|
2947
|
-
banner: bindingifyAddon(banner),
|
|
2948
|
-
footer: bindingifyAddon(footer),
|
|
2949
|
-
postBanner: bindingifyAddon(postBanner),
|
|
2950
|
-
postFooter: bindingifyAddon(postFooter),
|
|
2951
|
-
intro: bindingifyAddon(intro),
|
|
2952
|
-
outro: bindingifyAddon(outro),
|
|
2931
|
+
sourcemapIgnoreList: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapIgnoreList", sourcemapIgnoreList ?? /node_modules/),
|
|
2932
|
+
sourcemapPathTransform: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapPathTransform", sourcemapPathTransform),
|
|
2933
|
+
banner: bindingifyAddon(banner, "banner", timings),
|
|
2934
|
+
footer: bindingifyAddon(footer, "footer", timings),
|
|
2935
|
+
postBanner: bindingifyAddon(postBanner, "postBanner", timings),
|
|
2936
|
+
postFooter: bindingifyAddon(postFooter, "postFooter", timings),
|
|
2937
|
+
intro: bindingifyAddon(intro, "intro", timings),
|
|
2938
|
+
outro: bindingifyAddon(outro, "outro", timings),
|
|
2953
2939
|
extend: outputOptions.extend,
|
|
2954
|
-
globals,
|
|
2955
|
-
paths,
|
|
2940
|
+
globals: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "globals", globals),
|
|
2941
|
+
paths: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "paths", paths),
|
|
2956
2942
|
generatedCode,
|
|
2957
2943
|
esModule,
|
|
2958
2944
|
name,
|
|
2959
2945
|
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
2960
|
-
entryFileNames,
|
|
2961
|
-
chunkFileNames,
|
|
2946
|
+
entryFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "entryFileNames", entryFileNames),
|
|
2947
|
+
chunkFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "chunkFileNames", chunkFileNames),
|
|
2962
2948
|
plugins: [],
|
|
2963
2949
|
minify: outputOptions.minify,
|
|
2964
2950
|
externalLiveBindings: outputOptions.externalLiveBindings,
|
|
@@ -2979,9 +2965,12 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
|
|
|
2979
2965
|
strict: outputOptions.strict
|
|
2980
2966
|
};
|
|
2981
2967
|
}
|
|
2982
|
-
function bindingifyAddon(configAddon) {
|
|
2968
|
+
function bindingifyAddon(configAddon, name, timings) {
|
|
2983
2969
|
if (configAddon == null || configAddon === "") return;
|
|
2984
|
-
if (typeof configAddon === "function")
|
|
2970
|
+
if (typeof configAddon === "function") {
|
|
2971
|
+
const measured = measureHookCost(timings, OUTPUT_OPTIONS_OWNER, name, configAddon);
|
|
2972
|
+
return async (chunk) => measured(transformRenderedChunk(chunk));
|
|
2973
|
+
}
|
|
2985
2974
|
return configAddon;
|
|
2986
2975
|
}
|
|
2987
2976
|
function bindingifyFormat(format) {
|
|
@@ -3025,7 +3014,7 @@ function bindingifyComments(comments) {
|
|
|
3025
3014
|
if (typeof comments === "boolean") return comments;
|
|
3026
3015
|
return comments;
|
|
3027
3016
|
}
|
|
3028
|
-
function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData) {
|
|
3017
|
+
function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData, timings) {
|
|
3029
3018
|
let inlineDynamicImports;
|
|
3030
3019
|
let effectiveChunksOption;
|
|
3031
3020
|
if (codeSplitting === false) {
|
|
@@ -3068,10 +3057,11 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
|
|
|
3068
3057
|
advancedChunksResult = {
|
|
3069
3058
|
...restOptions,
|
|
3070
3059
|
groups: groups?.map((group) => {
|
|
3071
|
-
const { name, ...restGroup } = group;
|
|
3060
|
+
const { name, test, ...restGroup } = group;
|
|
3072
3061
|
return {
|
|
3073
3062
|
...restGroup,
|
|
3074
|
-
|
|
3063
|
+
test: typeof test === "function" ? measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].test", test) : test,
|
|
3064
|
+
name: typeof name === "function" ? measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].name", (id, ctx) => name(id, new ChunkingContextImpl(ctx, pluginContextData))) : name
|
|
3075
3065
|
};
|
|
3076
3066
|
})
|
|
3077
3067
|
};
|
|
@@ -3083,15 +3073,19 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
|
|
|
3083
3073
|
}
|
|
3084
3074
|
//#endregion
|
|
3085
3075
|
//#region src/utils/initialize-parallel-plugins.ts
|
|
3076
|
+
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
3086
3077
|
async function initializeParallelPlugins(plugins) {
|
|
3087
3078
|
const pluginInfos = [];
|
|
3088
|
-
for (const [index, plugin] of plugins.entries())
|
|
3089
|
-
const
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3079
|
+
for (const [index, plugin] of plugins.entries()) {
|
|
3080
|
+
const parallel = getParallelPluginInfo(plugin);
|
|
3081
|
+
if (parallel) {
|
|
3082
|
+
const { fileUrl, options } = parallel;
|
|
3083
|
+
pluginInfos.push({
|
|
3084
|
+
index,
|
|
3085
|
+
fileUrl,
|
|
3086
|
+
options
|
|
3087
|
+
});
|
|
3088
|
+
}
|
|
3095
3089
|
}
|
|
3096
3090
|
if (pluginInfos.length <= 0) return;
|
|
3097
3091
|
const count = availableParallelism();
|
|
@@ -3144,7 +3138,7 @@ const availableParallelism = () => {
|
|
|
3144
3138
|
};
|
|
3145
3139
|
//#endregion
|
|
3146
3140
|
//#region src/utils/create-bundler-option.ts
|
|
3147
|
-
async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
3141
|
+
async function createBundlerOptions(inputOptions, outputOptions, watchMode, measureTimings = false) {
|
|
3148
3142
|
const inputPlugins = await normalizePluginOption(inputOptions.plugins);
|
|
3149
3143
|
const outputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
3150
3144
|
const logLevel = inputOptions.logLevel || "info";
|
|
@@ -3154,14 +3148,20 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
3154
3148
|
const normalizedInputPlugins = normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX);
|
|
3155
3149
|
const normalizedOutputPlugins = normalizePlugins(hookOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
|
|
3156
3150
|
let plugins = [...normalizedInputPlugins, ...checkOutputPluginOption(normalizedOutputPlugins, onLog)];
|
|
3151
|
+
const timings = measureTimings && inputOptions.checks?.pluginTimings !== false ? pluginTimingsRecorderFor(inputOptions) : void 0;
|
|
3152
|
+
if (timings) outputOptions = {
|
|
3153
|
+
...outputOptions,
|
|
3154
|
+
assetFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "assetFileNames", outputOptions.assetFileNames),
|
|
3155
|
+
sanitizeFileName: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sanitizeFileName", outputOptions.sanitizeFileName)
|
|
3156
|
+
};
|
|
3157
3157
|
const parallelPluginInitResult = await initializeParallelPlugins(plugins);
|
|
3158
3158
|
if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
|
|
3159
3159
|
try {
|
|
3160
3160
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
|
|
3161
3161
|
return {
|
|
3162
3162
|
bundlerOptions: {
|
|
3163
|
-
inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode),
|
|
3164
|
-
outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData),
|
|
3163
|
+
inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings),
|
|
3164
|
+
outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData, timings),
|
|
3165
3165
|
parallelPluginsRegistry: parallelPluginInitResult?.registry
|
|
3166
3166
|
},
|
|
3167
3167
|
inputOptions,
|
|
@@ -3174,111 +3174,4 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
3174
3174
|
}
|
|
3175
3175
|
}
|
|
3176
3176
|
//#endregion
|
|
3177
|
-
|
|
3178
|
-
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
3179
|
-
/**
|
|
3180
|
-
* The bundle object returned by {@linkcode rolldown} function.
|
|
3181
|
-
*
|
|
3182
|
-
* @category Programmatic APIs
|
|
3183
|
-
*/
|
|
3184
|
-
var RolldownBuild = class RolldownBuild {
|
|
3185
|
-
#inputOptions;
|
|
3186
|
-
#bundler;
|
|
3187
|
-
#stopWorkers;
|
|
3188
|
-
/** @internal */
|
|
3189
|
-
static asyncRuntimeShutdown = false;
|
|
3190
|
-
/** @hidden should not be used directly */
|
|
3191
|
-
constructor(inputOptions) {
|
|
3192
|
-
this.#inputOptions = inputOptions;
|
|
3193
|
-
this.#bundler = new import_binding.BindingBundler();
|
|
3194
|
-
}
|
|
3195
|
-
/**
|
|
3196
|
-
* Whether the bundle has been closed.
|
|
3197
|
-
*
|
|
3198
|
-
* If the bundle is closed, calling other methods will throw an error.
|
|
3199
|
-
*/
|
|
3200
|
-
get closed() {
|
|
3201
|
-
return this.#bundler.closed;
|
|
3202
|
-
}
|
|
3203
|
-
/**
|
|
3204
|
-
* Generate bundles in-memory.
|
|
3205
|
-
*
|
|
3206
|
-
* If you directly want to write bundles to disk, use the {@linkcode write} method instead.
|
|
3207
|
-
*
|
|
3208
|
-
* @param outputOptions The output options.
|
|
3209
|
-
* @returns The generated bundle.
|
|
3210
|
-
* @throws {@linkcode BundleError} When an error occurs during the build.
|
|
3211
|
-
*/
|
|
3212
|
-
async generate(outputOptions = {}) {
|
|
3213
|
-
return this.#build(false, outputOptions);
|
|
3214
|
-
}
|
|
3215
|
-
/**
|
|
3216
|
-
* Generate and write bundles to disk.
|
|
3217
|
-
*
|
|
3218
|
-
* If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
|
|
3219
|
-
*
|
|
3220
|
-
* @param outputOptions The output options.
|
|
3221
|
-
* @returns The generated bundle.
|
|
3222
|
-
* @throws {@linkcode BundleError} When an error occurs during the build.
|
|
3223
|
-
*/
|
|
3224
|
-
async write(outputOptions = {}) {
|
|
3225
|
-
return this.#build(true, outputOptions);
|
|
3226
|
-
}
|
|
3227
|
-
/**
|
|
3228
|
-
* Close the bundle and free resources.
|
|
3229
|
-
*
|
|
3230
|
-
* This method should be called even if the {@linkcode generate} method
|
|
3231
|
-
* or the {@linkcode write} method threw an error. It should be called
|
|
3232
|
-
* even if neither of the methods are called.
|
|
3233
|
-
*
|
|
3234
|
-
* This method is called automatically when using `using` syntax.
|
|
3235
|
-
*
|
|
3236
|
-
* @example
|
|
3237
|
-
* ```js
|
|
3238
|
-
* import { rolldown } from 'rolldown';
|
|
3239
|
-
*
|
|
3240
|
-
* {
|
|
3241
|
-
* using bundle = await rolldown({ input: 'src/main.js' });
|
|
3242
|
-
* const output = await bundle.generate({ format: 'esm' });
|
|
3243
|
-
* console.log(output);
|
|
3244
|
-
* // bundle.close() is called automatically here
|
|
3245
|
-
* }
|
|
3246
|
-
* ```
|
|
3247
|
-
*/
|
|
3248
|
-
async close() {
|
|
3249
|
-
await this.#stopWorkers?.();
|
|
3250
|
-
await this.#bundler.close();
|
|
3251
|
-
(0, import_binding.shutdownAsyncRuntime)();
|
|
3252
|
-
RolldownBuild.asyncRuntimeShutdown = true;
|
|
3253
|
-
this.#stopWorkers = void 0;
|
|
3254
|
-
}
|
|
3255
|
-
/** @hidden documented in close method */
|
|
3256
|
-
async [Symbol.asyncDispose]() {
|
|
3257
|
-
await this.close();
|
|
3258
|
-
}
|
|
3259
|
-
/**
|
|
3260
|
-
* @experimental
|
|
3261
|
-
* @hidden not ready for public usage yet
|
|
3262
|
-
*/
|
|
3263
|
-
get watchFiles() {
|
|
3264
|
-
return Promise.resolve(this.#bundler.getWatchFiles());
|
|
3265
|
-
}
|
|
3266
|
-
async #build(isWrite, outputOptions) {
|
|
3267
|
-
validateOption("output", outputOptions);
|
|
3268
|
-
await this.#stopWorkers?.();
|
|
3269
|
-
const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
|
|
3270
|
-
if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)();
|
|
3271
|
-
try {
|
|
3272
|
-
this.#stopWorkers = option.stopWorkers;
|
|
3273
|
-
let output;
|
|
3274
|
-
if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
|
|
3275
|
-
else output = await this.#bundler.generate(option.bundlerOptions);
|
|
3276
|
-
return new RolldownOutputImpl(unwrapBindingResult(output));
|
|
3277
|
-
} catch (e) {
|
|
3278
|
-
await option.stopWorkers?.();
|
|
3279
|
-
throw e;
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
};
|
|
3283
|
-
//#endregion
|
|
3284
|
-
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 };
|
|
3177
|
+
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 };
|