@rolldown/browser 1.0.0-rc.1 → 1.0.0-rc.10
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 +708 -1101
- package/dist/config.d.mts +9 -4
- package/dist/config.mjs +9 -13
- package/dist/{shared/constructors-BTW-c3jX.mjs → constructors-DsfxKD6A.js} +14 -7
- package/dist/error-BeZaDkS8.js +157 -0
- package/dist/experimental-index.browser.mjs +74 -15
- package/dist/experimental-index.d.mts +128 -56
- package/dist/experimental-index.mjs +76 -17
- package/dist/filter-index.d.mts +1 -1
- package/dist/filter-index.mjs +25 -6
- package/dist/get-log-filter.d.mts +3 -7
- package/dist/get-log-filter.mjs +23 -3
- package/dist/index.browser.mjs +70 -75
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +10 -12
- package/dist/{normalize-string-or-regex-CL-PJZI7.js → normalize-string-or-regex-TtAGUp42.js} +6 -12
- package/dist/parallel-plugin-worker.mjs +6 -7
- package/dist/parallel-plugin.d.mts +4 -4
- package/dist/parallel-plugin.mjs +1 -2
- package/dist/parse-ast-index.d.mts +27 -3
- package/dist/parse-ast-index.mjs +60 -3
- package/dist/plugins-index.browser.mjs +8 -7
- package/dist/plugins-index.d.mts +7 -4
- package/dist/plugins-index.mjs +8 -7
- package/dist/resolve-tsconfig-DThkUPSZ.js +112 -0
- package/dist/rolldown-binding.wasi-browser.js +6 -1
- package/dist/rolldown-binding.wasi.cjs +6 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/{rolldown-build-C4tDS_XC.js → rolldown-build-Chx5S-TB.js} +1038 -744
- package/dist/shared/{bindingify-input-options-Bp2kpiI8.mjs → bindingify-input-options-Czbczr8Z.mjs} +102 -165
- package/dist/shared/{composable-filters-CIxSuZSM.mjs → composable-filters-B2ByPP8y.mjs} +1 -4
- package/dist/shared/{constructors-5bt5oBhE.d.mts → constructors-BVnf_fH1.d.mts} +13 -4
- package/dist/{constructors-B8gqcrFr.js → shared/constructors-CemeNi29.mjs} +14 -7
- package/dist/shared/{define-config-Dlptvz3X.mjs → define-config-DJOr6Iwt.mjs} +1 -2
- package/dist/shared/define-config-i6TWE2hm.d.mts +3855 -0
- package/dist/shared/error-CQ6njWsV.mjs +86 -0
- package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
- package/dist/shared/{load-config-BBZgIUGN.mjs → load-config-CxvL5JxT.mjs} +11 -5
- package/dist/shared/{logging-Nvu645a7.d.mts → logging-C6h4g8dA.d.mts} +6 -6
- package/dist/shared/{logs-B2CASPcx.mjs → logs-D80CXhvg.mjs} +6 -9
- package/dist/shared/{normalize-string-or-regex-DIwprzLy.mjs → normalize-string-or-regex-CF3Uz6aU.mjs} +2 -5
- package/dist/shared/parse-CRhjbrcT.mjs +73 -0
- package/dist/shared/{prompt-B6NrDD1-.mjs → prompt-BYQIwEjg.mjs} +4 -6
- package/dist/shared/resolve-tsconfig-Cwoo4h_o.mjs +112 -0
- package/dist/shared/{rolldown-C0_W0QdY.mjs → rolldown-C3wFxOwq.mjs} +2 -4
- package/dist/shared/rolldown-build-ChZOz6BP.mjs +3318 -0
- package/dist/shared/transform-DEgNAQOQ.d.mts +149 -0
- package/dist/shared/{types-CIYK49jr.d.mts → types-Cx3HYorz.d.mts} +5 -3
- package/dist/shared/{watch-eIop0yN6.mjs → watch-C1jC1oFT.mjs} +71 -76
- package/dist/utils-index.browser.mjs +2414 -0
- package/dist/utils-index.d.mts +374 -0
- package/dist/utils-index.mjs +2415 -0
- package/package.json +1 -1
- package/dist/cli-setup.d.mts +0 -1
- package/dist/cli-setup.mjs +0 -16
- package/dist/shared/define-config-CDlEOpr1.d.mts +0 -3531
- package/dist/shared/parse-ast-index-2ahkCVK6.mjs +0 -98
- package/dist/shared/rolldown-build-DLuUhuNw.mjs +0 -2368
- /package/dist/shared/{utils-CqMTwlsR.d.mts → utils-6wxe_LMG.d.mts} +0 -0
package/dist/config.d.mts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { r as defineConfig, t as ConfigExport } from "./shared/define-config-
|
|
1
|
+
import { $ as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-i6TWE2hm.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/load-config.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Load config from a file in a way that Rolldown does.
|
|
6
|
+
*
|
|
7
|
+
* @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
|
|
8
|
+
* @returns The loaded config export
|
|
9
|
+
*
|
|
10
|
+
* @category Config
|
|
11
|
+
*/
|
|
4
12
|
declare function loadConfig(configPath: string): Promise<ConfigExport>;
|
|
5
13
|
//#endregion
|
|
6
|
-
//#region src/config.d.ts
|
|
7
|
-
declare const VERSION: string;
|
|
8
|
-
//#endregion
|
|
9
14
|
export { VERSION, defineConfig, loadConfig };
|
package/dist/config.mjs
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import "./shared/normalize-string-or-regex-
|
|
2
|
-
import {
|
|
3
|
-
import "./shared/rolldown-build-
|
|
4
|
-
import "./shared/
|
|
5
|
-
import "./shared/
|
|
6
|
-
import
|
|
7
|
-
import { t as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const VERSION = version;
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
export { VERSION, defineConfig, loadConfig };
|
|
1
|
+
import "./shared/normalize-string-or-regex-CF3Uz6aU.mjs";
|
|
2
|
+
import { x as VERSION } from "./shared/bindingify-input-options-Czbczr8Z.mjs";
|
|
3
|
+
import "./shared/rolldown-build-ChZOz6BP.mjs";
|
|
4
|
+
import "./shared/error-CQ6njWsV.mjs";
|
|
5
|
+
import "./shared/parse-CRhjbrcT.mjs";
|
|
6
|
+
import "./shared/rolldown-C3wFxOwq.mjs";
|
|
7
|
+
import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs";
|
|
8
|
+
import { t as loadConfig } from "./shared/load-config-CxvL5JxT.mjs";
|
|
9
|
+
export { VERSION, defineConfig, loadConfig };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-
|
|
2
|
-
|
|
1
|
+
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-TtAGUp42.js";
|
|
3
2
|
//#region src/builtin-plugin/constructors.ts
|
|
4
3
|
function viteModulePreloadPolyfillPlugin(config) {
|
|
5
4
|
return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
|
|
@@ -17,9 +16,6 @@ function viteImportGlobPlugin(config) {
|
|
|
17
16
|
function viteReporterPlugin(config) {
|
|
18
17
|
return new BuiltinPlugin("builtin:vite-reporter", config);
|
|
19
18
|
}
|
|
20
|
-
function viteWasmHelperPlugin(config) {
|
|
21
|
-
return new BuiltinPlugin("builtin:vite-wasm-helper", config);
|
|
22
|
-
}
|
|
23
19
|
function viteWasmFallbackPlugin() {
|
|
24
20
|
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-wasm-fallback"));
|
|
25
21
|
}
|
|
@@ -44,11 +40,23 @@ function isolatedDeclarationPlugin(config) {
|
|
|
44
40
|
function viteWebWorkerPostPlugin() {
|
|
45
41
|
return new BuiltinPlugin("builtin:vite-web-worker-post");
|
|
46
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
|
|
45
|
+
*
|
|
46
|
+
* @see https://rolldown.rs/builtin-plugins/esm-external-require
|
|
47
|
+
* @category Builtin Plugins
|
|
48
|
+
*/
|
|
47
49
|
function esmExternalRequirePlugin(config) {
|
|
48
50
|
const plugin = new BuiltinPlugin("builtin:esm-external-require", config);
|
|
49
51
|
plugin.enforce = "pre";
|
|
50
52
|
return plugin;
|
|
51
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* This plugin should not be used for Rolldown.
|
|
56
|
+
*/
|
|
57
|
+
function oxcRuntimePlugin() {
|
|
58
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:oxc-runtime"));
|
|
59
|
+
}
|
|
52
60
|
function viteReactRefreshWrapperPlugin(config) {
|
|
53
61
|
if (config) {
|
|
54
62
|
config.include = normalizedStringOrRegex(config.include);
|
|
@@ -56,6 +64,5 @@ function viteReactRefreshWrapperPlugin(config) {
|
|
|
56
64
|
}
|
|
57
65
|
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config));
|
|
58
66
|
}
|
|
59
|
-
|
|
60
67
|
//#endregion
|
|
61
|
-
export {
|
|
68
|
+
export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWasmFallbackPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { parse, parseSync } from "./rolldown-binding.wasi-browser.js";
|
|
2
|
+
//#region src/types/sourcemap.ts
|
|
3
|
+
function bindingifySourcemap(map) {
|
|
4
|
+
if (map == null) return;
|
|
5
|
+
return { inner: typeof map === "string" ? map : {
|
|
6
|
+
file: map.file ?? void 0,
|
|
7
|
+
mappings: map.mappings,
|
|
8
|
+
sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
|
|
9
|
+
sources: map.sources?.map((s) => s ?? void 0),
|
|
10
|
+
sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
|
|
11
|
+
names: map.names,
|
|
12
|
+
x_google_ignoreList: map.x_google_ignoreList,
|
|
13
|
+
debugId: "debugId" in map ? map.debugId : void 0
|
|
14
|
+
} };
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.120.0/node_modules/oxc-parser/src-js/wrap.js
|
|
18
|
+
function wrap(result) {
|
|
19
|
+
let program, module, comments, errors;
|
|
20
|
+
return {
|
|
21
|
+
get program() {
|
|
22
|
+
if (!program) program = jsonParseAst(result.program);
|
|
23
|
+
return program;
|
|
24
|
+
},
|
|
25
|
+
get module() {
|
|
26
|
+
if (!module) module = result.module;
|
|
27
|
+
return module;
|
|
28
|
+
},
|
|
29
|
+
get comments() {
|
|
30
|
+
if (!comments) comments = result.comments;
|
|
31
|
+
return comments;
|
|
32
|
+
},
|
|
33
|
+
get errors() {
|
|
34
|
+
if (!errors) errors = result.errors;
|
|
35
|
+
return errors;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function jsonParseAst(programJson) {
|
|
40
|
+
const { node: program, fixes } = JSON.parse(programJson);
|
|
41
|
+
for (const fixPath of fixes) applyFix(program, fixPath);
|
|
42
|
+
return program;
|
|
43
|
+
}
|
|
44
|
+
function applyFix(program, fixPath) {
|
|
45
|
+
let node = program;
|
|
46
|
+
for (const key of fixPath) node = node[key];
|
|
47
|
+
if (node.bigint) node.value = BigInt(node.bigint);
|
|
48
|
+
else try {
|
|
49
|
+
node.value = RegExp(node.regex.pattern, node.regex.flags);
|
|
50
|
+
} catch {}
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/utils/parse.ts
|
|
54
|
+
/**
|
|
55
|
+
* Parse JS/TS source asynchronously on a separate thread.
|
|
56
|
+
*
|
|
57
|
+
* Note that not all of the workload can happen on a separate thread.
|
|
58
|
+
* Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
|
|
59
|
+
* has to happen on current thread. This synchronous deserialization work typically outweighs
|
|
60
|
+
* the asynchronous parsing by a factor of between 3 and 20.
|
|
61
|
+
*
|
|
62
|
+
* i.e. the majority of the workload cannot be parallelized by using this method.
|
|
63
|
+
*
|
|
64
|
+
* Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
|
|
65
|
+
* If you need to parallelize parsing multiple files, it is recommended to use worker threads.
|
|
66
|
+
*
|
|
67
|
+
* @category Utilities
|
|
68
|
+
*/
|
|
69
|
+
async function parse$1(filename, sourceText, options) {
|
|
70
|
+
return wrap(await parse(filename, sourceText, options));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Parse JS/TS source synchronously on current thread.
|
|
74
|
+
*
|
|
75
|
+
* This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
|
|
76
|
+
* of spawning a thread, and the majority of the workload cannot be parallelized anyway
|
|
77
|
+
* (see {@linkcode parse} documentation for details).
|
|
78
|
+
*
|
|
79
|
+
* If you need to parallelize parsing multiple files, it is recommended to use worker threads
|
|
80
|
+
* with {@linkcode parseSync} rather than using {@linkcode parse}.
|
|
81
|
+
*
|
|
82
|
+
* @category Utilities
|
|
83
|
+
*/
|
|
84
|
+
function parseSync$1(filename, sourceText, options) {
|
|
85
|
+
return wrap(parseSync(filename, sourceText, options));
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/utils/error.ts
|
|
89
|
+
function unwrapBindingResult(container) {
|
|
90
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
91
|
+
return container;
|
|
92
|
+
}
|
|
93
|
+
function normalizeBindingResult(container) {
|
|
94
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
|
95
|
+
return container;
|
|
96
|
+
}
|
|
97
|
+
function normalizeBindingError(e) {
|
|
98
|
+
return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
99
|
+
code: e.field0.kind,
|
|
100
|
+
kind: e.field0.kind,
|
|
101
|
+
message: e.field0.message,
|
|
102
|
+
id: e.field0.id,
|
|
103
|
+
exporter: e.field0.exporter,
|
|
104
|
+
loc: e.field0.loc,
|
|
105
|
+
pos: e.field0.pos,
|
|
106
|
+
stack: void 0
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
110
|
+
const errors = rawErrors.map(normalizeBindingError);
|
|
111
|
+
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
112
|
+
for (let i = 0; i < errors.length; i++) {
|
|
113
|
+
summary += "\n";
|
|
114
|
+
if (i >= 5) {
|
|
115
|
+
summary += "...";
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
summary += getErrorMessage(errors[i]);
|
|
119
|
+
}
|
|
120
|
+
const wrapper = new Error(summary);
|
|
121
|
+
Object.defineProperty(wrapper, "errors", {
|
|
122
|
+
configurable: true,
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: () => errors,
|
|
125
|
+
set: (value) => Object.defineProperty(wrapper, "errors", {
|
|
126
|
+
configurable: true,
|
|
127
|
+
enumerable: true,
|
|
128
|
+
value
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
return wrapper;
|
|
132
|
+
}
|
|
133
|
+
function getErrorMessage(e) {
|
|
134
|
+
if (Object.hasOwn(e, "kind")) return e.message;
|
|
135
|
+
let s = "";
|
|
136
|
+
if (e.plugin) s += `[plugin ${e.plugin}]`;
|
|
137
|
+
const id = e.id ?? e.loc?.file;
|
|
138
|
+
if (id) {
|
|
139
|
+
s += " " + id;
|
|
140
|
+
if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
|
|
141
|
+
}
|
|
142
|
+
if (s) s += "\n";
|
|
143
|
+
const message = `${e.name ?? "Error"}: ${e.message}`;
|
|
144
|
+
s += message;
|
|
145
|
+
if (e.frame) s = joinNewLine(s, e.frame);
|
|
146
|
+
if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
|
|
147
|
+
if (e.cause) {
|
|
148
|
+
s = joinNewLine(s, "Caused by:");
|
|
149
|
+
s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
150
|
+
}
|
|
151
|
+
return s;
|
|
152
|
+
}
|
|
153
|
+
function joinNewLine(s1, s2) {
|
|
154
|
+
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
export { parse$1 as a, unwrapBindingResult as i, normalizeBindingError as n, parseSync$1 as o, normalizeBindingResult as r, bindingifySourcemap as s, aggregateBindingErrorsIntoJsError as t };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-
|
|
2
|
-
import { a as
|
|
3
|
-
import { a as
|
|
1
|
+
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-TtAGUp42.js";
|
|
2
|
+
import { a as validateOption, i as transformToRollupOutput, n as createBundlerOptions, o as PluginDriver, t as RolldownBuild } from "./rolldown-build-Chx5S-TB.js";
|
|
3
|
+
import { a as parse$2, i as unwrapBindingResult, o as parseSync$2, r as normalizeBindingResult } from "./error-BeZaDkS8.js";
|
|
4
|
+
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./constructors-DsfxKD6A.js";
|
|
5
|
+
import { a as minify$2, i as transformSync$1, n as resolveTsconfig, o as minifySync$2, r as transform$1, t as TsconfigCache$2 } from "./resolve-tsconfig-DThkUPSZ.js";
|
|
4
6
|
import * as binding from "./rolldown-binding.wasi-browser.js";
|
|
5
|
-
import { BindingBundler, BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory,
|
|
6
|
-
|
|
7
|
+
import { BindingBundler, BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, isolatedDeclarationSync, moduleRunnerTransform, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
|
|
7
8
|
//#region src/api/dev/dev-engine.ts
|
|
8
9
|
var DevEngine = class DevEngine {
|
|
9
10
|
#inner;
|
|
@@ -95,11 +96,9 @@ var DevEngine = class DevEngine {
|
|
|
95
96
|
return this.#inner.compileEntry(moduleId, clientId);
|
|
96
97
|
}
|
|
97
98
|
};
|
|
98
|
-
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region src/api/dev/index.ts
|
|
101
101
|
const dev = (...args) => DevEngine.create(...args);
|
|
102
|
-
|
|
103
102
|
//#endregion
|
|
104
103
|
//#region src/types/external-memory-handle.ts
|
|
105
104
|
const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__";
|
|
@@ -140,7 +139,6 @@ const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__";
|
|
|
140
139
|
function freeExternalMemory(handle, keepDataAlive = false) {
|
|
141
140
|
return handle[symbolForExternalMemoryHandle](keepDataAlive);
|
|
142
141
|
}
|
|
143
|
-
|
|
144
142
|
//#endregion
|
|
145
143
|
//#region src/api/experimental.ts
|
|
146
144
|
/**
|
|
@@ -181,19 +179,69 @@ const scan = async (rawInputOptions, rawOutputOptions = {}) => {
|
|
|
181
179
|
}
|
|
182
180
|
return cleanupPromise;
|
|
183
181
|
};
|
|
184
|
-
|
|
185
182
|
//#endregion
|
|
186
183
|
//#region src/plugin/parallel-plugin.ts
|
|
187
184
|
function defineParallelPlugin(pluginPath) {
|
|
188
185
|
throw new Error("`defineParallelPlugin` is not supported in browser build");
|
|
189
186
|
}
|
|
190
|
-
|
|
191
187
|
//#endregion
|
|
192
188
|
//#region src/builtin-plugin/alias-plugin.ts
|
|
193
189
|
function viteAliasPlugin(config) {
|
|
194
190
|
return new BuiltinPlugin("builtin:vite-alias", config);
|
|
195
191
|
}
|
|
196
|
-
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/builtin-plugin/bundle-analyzer-plugin.ts
|
|
194
|
+
/**
|
|
195
|
+
* A plugin that analyzes bundle composition and generates detailed reports.
|
|
196
|
+
*
|
|
197
|
+
* The plugin outputs a file containing detailed information about:
|
|
198
|
+
* - All chunks and their relationships
|
|
199
|
+
* - Modules bundled in each chunk
|
|
200
|
+
* - Import dependencies between chunks
|
|
201
|
+
* - Reachable modules from each entry point
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```js
|
|
205
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
206
|
+
*
|
|
207
|
+
* export default {
|
|
208
|
+
* plugins: [
|
|
209
|
+
* bundleAnalyzerPlugin()
|
|
210
|
+
* ]
|
|
211
|
+
* }
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* **Custom filename**
|
|
216
|
+
* ```js
|
|
217
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
218
|
+
*
|
|
219
|
+
* export default {
|
|
220
|
+
* plugins: [
|
|
221
|
+
* bundleAnalyzerPlugin({
|
|
222
|
+
* fileName: 'bundle-analysis.json'
|
|
223
|
+
* })
|
|
224
|
+
* ]
|
|
225
|
+
* }
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* **LLM-friendly markdown output**
|
|
230
|
+
* ```js
|
|
231
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
232
|
+
*
|
|
233
|
+
* export default {
|
|
234
|
+
* plugins: [
|
|
235
|
+
* bundleAnalyzerPlugin({
|
|
236
|
+
* format: 'md'
|
|
237
|
+
* })
|
|
238
|
+
* ]
|
|
239
|
+
* }
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
function bundleAnalyzerPlugin(config) {
|
|
243
|
+
return new BuiltinPlugin("builtin:bundle-analyzer", config);
|
|
244
|
+
}
|
|
197
245
|
//#endregion
|
|
198
246
|
//#region src/builtin-plugin/transform-plugin.ts
|
|
199
247
|
function viteTransformPlugin(config) {
|
|
@@ -206,13 +254,11 @@ function viteTransformPlugin(config) {
|
|
|
206
254
|
yarnPnp: typeof process === "object" && !!process.versions?.pnp
|
|
207
255
|
});
|
|
208
256
|
}
|
|
209
|
-
|
|
210
257
|
//#endregion
|
|
211
258
|
//#region src/builtin-plugin/vite-manifest-plugin.ts
|
|
212
259
|
function viteManifestPlugin(config) {
|
|
213
260
|
return new BuiltinPlugin("builtin:vite-manifest", config);
|
|
214
261
|
}
|
|
215
|
-
|
|
216
262
|
//#endregion
|
|
217
263
|
//#region src/experimental-index.ts
|
|
218
264
|
/**
|
|
@@ -246,6 +292,19 @@ const memfs = {
|
|
|
246
292
|
fs: binding.__fs,
|
|
247
293
|
volume: binding.__volume
|
|
248
294
|
};
|
|
249
|
-
|
|
295
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
296
|
+
const parse = parse$2;
|
|
297
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
298
|
+
const parseSync = parseSync$2;
|
|
299
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
300
|
+
const minify = minify$2;
|
|
301
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
302
|
+
const minifySync = minifySync$2;
|
|
303
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
304
|
+
const transform = transform$1;
|
|
305
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
306
|
+
const transformSync = transformSync$1;
|
|
307
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
308
|
+
const TsconfigCache = TsconfigCache$2;
|
|
250
309
|
//#endregion
|
|
251
|
-
export { BindingRebuildStrategy, DevEngine, ResolverFactory,
|
|
310
|
+
export { BindingRebuildStrategy, DevEngine, ResolverFactory, TsconfigCache, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BuiltinPlugin } from "./shared/utils-
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
1
|
+
import { Tt as NormalizedOutputOptions, c as InputOptions, ln as freeExternalMemory, mt as defineParallelPlugin, sn as RolldownOutput, tn as OutputOptions } from "./shared/define-config-i6TWE2hm.mjs";
|
|
2
|
+
import { t as BuiltinPlugin } from "./shared/utils-6wxe_LMG.mjs";
|
|
3
|
+
import { a as transform$1, c as MinifyResult$2, d as ParseResult$3, f as ParserOptions$3, g as resolveTsconfig, h as TsconfigCache$2, i as TsconfigRawOptions$1, l as minify$1, m as parseSync$1, n as TransformResult$1, o as transformSync$1, p as parse$1, r as TsconfigCompilerOptions$1, s as MinifyOptions$2, t as TransformOptions$2, u as minifySync$1 } from "./shared/transform-DEgNAQOQ.mjs";
|
|
4
|
+
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-BVnf_fH1.mjs";
|
|
5
|
+
import { BindingBundleAnalyzerPluginConfig, BindingViteManifestPluginConfig, BindingViteTransformPluginConfig } from "../binding.cjs";
|
|
5
6
|
import { BindingBundleState, BindingClientHmrUpdate as BindingClientHmrUpdate$1 } from "../../binding.cjs";
|
|
6
|
-
import { BindingClientHmrUpdate, BindingRebuildStrategy, IsolatedDeclarationsOptions, IsolatedDeclarationsResult,
|
|
7
|
+
import { BindingClientHmrUpdate, BindingRebuildStrategy, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions as ResolveOptions, ResolveResult, ResolverFactory, isolatedDeclaration, isolatedDeclarationSync, moduleRunnerTransform } from "./binding.cjs";
|
|
7
8
|
|
|
8
9
|
//#region src/api/dev/dev-options.d.ts
|
|
9
10
|
type DevOnHmrUpdates = (result: Error | {
|
|
@@ -13,54 +14,54 @@ type DevOnHmrUpdates = (result: Error | {
|
|
|
13
14
|
type DevOnOutput = (result: Error | RolldownOutput) => void | Promise<void>;
|
|
14
15
|
interface DevWatchOptions {
|
|
15
16
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
* If `true`, files are not written to disk.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
19
20
|
skipWrite?: boolean;
|
|
20
21
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
* If `true`, use polling instead of native file system events for watching.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
24
25
|
usePolling?: boolean;
|
|
25
26
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
* Poll interval in milliseconds (only used when usePolling is true).
|
|
28
|
+
* @default 100
|
|
29
|
+
*/
|
|
29
30
|
pollInterval?: number;
|
|
30
31
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* If `true`, use debounced watcher. If `false`, use non-debounced watcher for immediate responses.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
34
35
|
useDebounce?: boolean;
|
|
35
36
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
* Debounce duration in milliseconds (only used when useDebounce is true).
|
|
38
|
+
* @default 10
|
|
39
|
+
*/
|
|
39
40
|
debounceDuration?: number;
|
|
40
41
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
* Whether to compare file contents for poll-based watchers (only used when usePolling is true).
|
|
43
|
+
* When enabled, poll watchers will check file contents to determine if they actually changed.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
45
46
|
compareContentsForPolling?: boolean;
|
|
46
47
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
* Tick rate in milliseconds for debounced watchers (only used when useDebounce is true).
|
|
49
|
+
* Controls how frequently the debouncer checks for events to process.
|
|
50
|
+
* When not specified, the debouncer will auto-select an appropriate tick rate (1/4 of the debounce duration).
|
|
51
|
+
* @default undefined (auto-select)
|
|
52
|
+
*/
|
|
52
53
|
debounceTickRate?: number;
|
|
53
54
|
}
|
|
54
55
|
interface DevOptions {
|
|
55
56
|
onHmrUpdates?: DevOnHmrUpdates;
|
|
56
57
|
onOutput?: DevOnOutput;
|
|
57
58
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
* Strategy for triggering rebuilds after HMR updates.
|
|
60
|
+
* - `'always'`: Always trigger a rebuild after HMR updates
|
|
61
|
+
* - `'auto'`: Trigger rebuild only if HMR updates contain full reload updates
|
|
62
|
+
* - `'never'`: Never trigger rebuild after HMR updates (default)
|
|
63
|
+
* @default 'auto'
|
|
64
|
+
*/
|
|
64
65
|
rebuildStrategy?: "always" | "auto" | "never";
|
|
65
66
|
watch?: DevWatchOptions;
|
|
66
67
|
}
|
|
@@ -79,16 +80,16 @@ declare class DevEngine {
|
|
|
79
80
|
removeClient(clientId: string): Promise<void>;
|
|
80
81
|
close(): Promise<void>;
|
|
81
82
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
* Compile a lazy entry module and return HMR-style patch code.
|
|
84
|
+
*
|
|
85
|
+
* This is called when a dynamically imported module is first requested at runtime.
|
|
86
|
+
* The module was previously stubbed with a proxy, and now we need to compile the
|
|
87
|
+
* actual module and its dependencies.
|
|
88
|
+
*
|
|
89
|
+
* @param moduleId - The absolute file path of the module to compile
|
|
90
|
+
* @param clientId - The client ID requesting this compilation
|
|
91
|
+
* @returns The compiled JavaScript code as a string (HMR patch format)
|
|
92
|
+
*/
|
|
92
93
|
compileEntry(moduleId: string, clientId: string): Promise<string>;
|
|
93
94
|
}
|
|
94
95
|
//#endregion
|
|
@@ -113,16 +114,6 @@ declare const dev: typeof DevEngine.create;
|
|
|
113
114
|
*/
|
|
114
115
|
declare const scan: (rawInputOptions: InputOptions, rawOutputOptions?: {}) => Promise<Promise<void>>;
|
|
115
116
|
//#endregion
|
|
116
|
-
//#region src/utils/parse.d.ts
|
|
117
|
-
/**
|
|
118
|
-
* Parse asynchronously.
|
|
119
|
-
*
|
|
120
|
-
* Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
|
|
121
|
-
*/
|
|
122
|
-
declare function parse(filename: string, sourceText: string, options?: ParserOptions$1 | null): Promise<ParseResult$1>;
|
|
123
|
-
/** Parse synchronously. */
|
|
124
|
-
declare function parseSync(filename: string, sourceText: string, options?: ParserOptions$1 | null): ParseResult$1;
|
|
125
|
-
//#endregion
|
|
126
117
|
//#region src/builtin-plugin/alias-plugin.d.ts
|
|
127
118
|
type ViteAliasPluginConfig = {
|
|
128
119
|
entries: {
|
|
@@ -132,6 +123,57 @@ type ViteAliasPluginConfig = {
|
|
|
132
123
|
};
|
|
133
124
|
declare function viteAliasPlugin(config: ViteAliasPluginConfig): BuiltinPlugin;
|
|
134
125
|
//#endregion
|
|
126
|
+
//#region src/builtin-plugin/bundle-analyzer-plugin.d.ts
|
|
127
|
+
/**
|
|
128
|
+
* A plugin that analyzes bundle composition and generates detailed reports.
|
|
129
|
+
*
|
|
130
|
+
* The plugin outputs a file containing detailed information about:
|
|
131
|
+
* - All chunks and their relationships
|
|
132
|
+
* - Modules bundled in each chunk
|
|
133
|
+
* - Import dependencies between chunks
|
|
134
|
+
* - Reachable modules from each entry point
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```js
|
|
138
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
139
|
+
*
|
|
140
|
+
* export default {
|
|
141
|
+
* plugins: [
|
|
142
|
+
* bundleAnalyzerPlugin()
|
|
143
|
+
* ]
|
|
144
|
+
* }
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* **Custom filename**
|
|
149
|
+
* ```js
|
|
150
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
151
|
+
*
|
|
152
|
+
* export default {
|
|
153
|
+
* plugins: [
|
|
154
|
+
* bundleAnalyzerPlugin({
|
|
155
|
+
* fileName: 'bundle-analysis.json'
|
|
156
|
+
* })
|
|
157
|
+
* ]
|
|
158
|
+
* }
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* **LLM-friendly markdown output**
|
|
163
|
+
* ```js
|
|
164
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
165
|
+
*
|
|
166
|
+
* export default {
|
|
167
|
+
* plugins: [
|
|
168
|
+
* bundleAnalyzerPlugin({
|
|
169
|
+
* format: 'md'
|
|
170
|
+
* })
|
|
171
|
+
* ]
|
|
172
|
+
* }
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
declare function bundleAnalyzerPlugin(config?: BindingBundleAnalyzerPluginConfig): BuiltinPlugin;
|
|
176
|
+
//#endregion
|
|
135
177
|
//#region src/builtin-plugin/transform-plugin.d.ts
|
|
136
178
|
type TransformPattern = string | RegExp | readonly (RegExp | string)[];
|
|
137
179
|
type TransformPluginConfig = Omit<BindingViteTransformPluginConfig, "include" | "exclude" | "jsxRefreshInclude" | "jsxRefreshExclude" | "yarnPnp"> & {
|
|
@@ -180,5 +222,35 @@ declare const memfs: {
|
|
|
180
222
|
fs: any;
|
|
181
223
|
volume: any;
|
|
182
224
|
} | undefined;
|
|
225
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
226
|
+
declare const parse: typeof parse$1;
|
|
227
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
228
|
+
declare const parseSync: typeof parseSync$1;
|
|
229
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
230
|
+
type ParseResult = ParseResult$3;
|
|
231
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
232
|
+
type ParserOptions = ParserOptions$3;
|
|
233
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
234
|
+
declare const minify: typeof minify$1;
|
|
235
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
236
|
+
declare const minifySync: typeof minifySync$1;
|
|
237
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
238
|
+
type MinifyOptions = MinifyOptions$2;
|
|
239
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
240
|
+
type MinifyResult = MinifyResult$2;
|
|
241
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
242
|
+
declare const transform: typeof transform$1;
|
|
243
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
244
|
+
declare const transformSync: typeof transformSync$1;
|
|
245
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
246
|
+
type TransformOptions = TransformOptions$2;
|
|
247
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
248
|
+
type TransformResult = TransformResult$1;
|
|
249
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
250
|
+
declare const TsconfigCache: typeof TsconfigCache$2;
|
|
251
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
252
|
+
type TsconfigRawOptions = TsconfigRawOptions$1;
|
|
253
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
254
|
+
type TsconfigCompilerOptions = TsconfigCompilerOptions$1;
|
|
183
255
|
//#endregion
|
|
184
|
-
export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult,
|
|
256
|
+
export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, MinifyOptions, MinifyResult, ParseResult, ParserOptions, type ResolveOptions, type ResolveResult, ResolverFactory, TransformOptions, TransformResult, TsconfigCache, TsconfigCompilerOptions, TsconfigRawOptions, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };
|