@rolldown/browser 1.0.0-beta.41 → 1.0.0-beta.43
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 +25 -11
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -4
- package/dist/experimental-index.browser.mjs +31 -16
- package/dist/experimental-index.d.mts +19 -4
- package/dist/experimental-index.mjs +34 -19
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/parallel-plugin-worker.mjs +5 -6
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +2 -3
- package/dist/rolldown-binding.wasi.cjs +2 -3
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-DOpOtI1J.d.mts → binding-BkaKdpud.d.mts} +45 -13
- package/dist/shared/{define-config-DzdeQbht.d.mts → define-config-D5LB7YAC.d.mts} +60 -3
- package/dist/shared/{dist-CHTC3-kR.mjs → dist-CU0dSkK2.mjs} +2 -3
- package/dist/shared/{load-config-Dk8qZvLs.mjs → load-config-DBsf9ada.mjs} +4 -7
- package/dist/shared/{logger-ClMekpHZ.mjs → logger-B83ocDok.mjs} +6 -9
- package/dist/shared/{parse-ast-index-CTl_R-Xm.mjs → parse-ast-index-Gktxd-oi.mjs} +1 -1
- package/dist/shared/{prompt-R6XhwkxA.mjs → prompt-B4e-jZUR.mjs} +18 -20
- package/dist/shared/{src-DnNenssl.mjs → src-Dqrw8WuH.mjs} +89 -48
- package/dist/{src-D3uOoJau.js → src-DXN0YLUN.js} +192 -154
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ansis_default, description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-
|
|
2
|
-
import "./shared/parse-ast-index-
|
|
3
|
-
import { arraify } from "./shared/dist-
|
|
4
|
-
import { logger } from "./shared/logger-
|
|
5
|
-
import { loadConfig } from "./shared/load-config-
|
|
1
|
+
import { ansis_default, description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
|
+
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
|
+
import { arraify } from "./shared/dist-CU0dSkK2.mjs";
|
|
4
|
+
import { logger } from "./shared/logger-B83ocDok.mjs";
|
|
5
|
+
import { loadConfig } from "./shared/load-config-DBsf9ada.mjs";
|
|
6
|
+
import { createTokioRuntime } from "./rolldown-binding.wasi.cjs";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { parseArgs } from "node:util";
|
|
8
9
|
import process$1 from "node:process";
|
|
@@ -90,13 +91,15 @@ function normalizeCliOptions(cliOptions, positionals) {
|
|
|
90
91
|
watch: options$1.watch ?? false
|
|
91
92
|
};
|
|
92
93
|
if (typeof options$1.config === "string") result.config = options$1.config;
|
|
94
|
+
if (options$1.environment !== void 0) result.environment = options$1.environment;
|
|
93
95
|
const keysOfInput = getInputCliKeys();
|
|
94
96
|
const keysOfOutput = getOutputCliKeys();
|
|
95
97
|
const reservedKeys = [
|
|
96
98
|
"help",
|
|
97
99
|
"version",
|
|
98
100
|
"config",
|
|
99
|
-
"watch"
|
|
101
|
+
"watch",
|
|
102
|
+
"environment"
|
|
100
103
|
];
|
|
101
104
|
for (let [key, value] of Object.entries(options$1)) {
|
|
102
105
|
const [primary] = key.split(".");
|
|
@@ -241,7 +244,7 @@ function getClearScreenFunction(options$1) {
|
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
//#endregion
|
|
244
|
-
//#region \0@oxc-project+runtime@0.
|
|
247
|
+
//#region \0@oxc-project+runtime@0.94.0/helpers/usingCtx.js
|
|
245
248
|
function _usingCtx() {
|
|
246
249
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r$1, e$1) {
|
|
247
250
|
var n$1 = Error();
|
|
@@ -310,8 +313,13 @@ async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
|
|
|
310
313
|
process.exit(1);
|
|
311
314
|
}
|
|
312
315
|
const resolvedConfig = typeof config === "function" ? await config(rawArgs) : config;
|
|
313
|
-
if (cliOptions.watch)
|
|
314
|
-
|
|
316
|
+
if (cliOptions.watch) {
|
|
317
|
+
createTokioRuntime(32);
|
|
318
|
+
await watchInner(resolvedConfig, cliOptions);
|
|
319
|
+
} else {
|
|
320
|
+
createTokioRuntime(4);
|
|
321
|
+
await bundleInner(resolvedConfig, cliOptions);
|
|
322
|
+
}
|
|
315
323
|
}
|
|
316
324
|
async function bundleWithCliOptions(cliOptions) {
|
|
317
325
|
try {
|
|
@@ -412,8 +420,7 @@ async function bundleInner(config, cliOptions) {
|
|
|
412
420
|
}
|
|
413
421
|
function printBundleOutputPretty(output) {
|
|
414
422
|
const outputEntries = collectOutputEntries(output.output);
|
|
415
|
-
|
|
416
|
-
printOutputEntries(outputEntries, outputLayoutSizes, "<DIR>");
|
|
423
|
+
printOutputEntries(outputEntries, collectOutputLayoutAdjustmentSizes(outputEntries), "<DIR>");
|
|
417
424
|
}
|
|
418
425
|
function collectOutputEntries(output) {
|
|
419
426
|
return output.map((chunk) => ({
|
|
@@ -555,6 +562,13 @@ function checkNodeVersion(nodeVersion) {
|
|
|
555
562
|
if (!checkNodeVersion(process$1.versions.node)) logger.warn(`You are using Node.js ${process$1.versions.node}. Rolldown requires Node.js version 20.19+ or 22.12+. Please upgrade your Node.js version.`);
|
|
556
563
|
async function main() {
|
|
557
564
|
const { rawArgs,...cliOptions } = parseCliArguments();
|
|
565
|
+
if (cliOptions.environment) {
|
|
566
|
+
const environment = Array.isArray(cliOptions.environment) ? cliOptions.environment : [cliOptions.environment];
|
|
567
|
+
for (const argument of environment) for (const pair of argument.split(",")) {
|
|
568
|
+
const [key, ...value] = pair.split(":");
|
|
569
|
+
process$1.env[key] = value.length === 0 ? String(true) : value.join(":");
|
|
570
|
+
}
|
|
571
|
+
}
|
|
558
572
|
if (cliOptions.config || cliOptions.config === "") {
|
|
559
573
|
await bundleWithConfig(cliOptions.config, cliOptions, rawArgs);
|
|
560
574
|
return;
|
package/dist/config.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { ConfigExport, defineConfig } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { ConfigExport, defineConfig } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/load-config.d.ts
|
|
5
5
|
declare function loadConfig(configPath: string): Promise<ConfigExport>;
|
package/dist/config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineConfig, version } from "./shared/src-
|
|
2
|
-
import "./shared/parse-ast-index-
|
|
3
|
-
import "./shared/dist-
|
|
4
|
-
import { loadConfig } from "./shared/load-config-
|
|
1
|
+
import { defineConfig, version } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
|
+
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
|
+
import "./shared/dist-CU0dSkK2.mjs";
|
|
4
|
+
import { loadConfig } from "./shared/load-config-DBsf9ada.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/config.ts
|
|
7
7
|
const VERSION = version;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./src-
|
|
2
|
-
import {
|
|
1
|
+
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizeBindingResult, normalizedStringOrRegex } from "./src-DXN0YLUN.js";
|
|
2
|
+
import { BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi-browser.js";
|
|
3
3
|
|
|
4
4
|
//#region src/api/dev/dev-engine.ts
|
|
5
5
|
var DevEngine = class DevEngine {
|
|
@@ -8,8 +8,26 @@ var DevEngine = class DevEngine {
|
|
|
8
8
|
static async create(inputOptions, outputOptions = {}, devOptions = {}) {
|
|
9
9
|
inputOptions = await PluginDriver.callOptionsHook(inputOptions);
|
|
10
10
|
const options = await createBundlerOptions(inputOptions, outputOptions, false);
|
|
11
|
+
const userOnHmrUpdates = devOptions.onHmrUpdates;
|
|
12
|
+
const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) {
|
|
13
|
+
const result = normalizeBindingResult(rawResult);
|
|
14
|
+
if (result instanceof Error) {
|
|
15
|
+
userOnHmrUpdates(result);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const [updates, changedFiles] = result;
|
|
19
|
+
userOnHmrUpdates({
|
|
20
|
+
updates,
|
|
21
|
+
changedFiles
|
|
22
|
+
});
|
|
23
|
+
} : void 0;
|
|
24
|
+
const userOnOutput = devOptions.onOutput;
|
|
11
25
|
const bindingDevOptions = {
|
|
12
|
-
onHmrUpdates:
|
|
26
|
+
onHmrUpdates: bindingOnHmrUpdates,
|
|
27
|
+
onOutput: userOnOutput ? function(rawResult) {
|
|
28
|
+
userOnOutput(normalizeBindingResult(rawResult));
|
|
29
|
+
} : void 0,
|
|
30
|
+
rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
|
|
13
31
|
watch: devOptions.watch && {
|
|
14
32
|
skipWrite: devOptions.watch.skipWrite,
|
|
15
33
|
usePolling: devOptions.watch.usePolling,
|
|
@@ -20,8 +38,7 @@ var DevEngine = class DevEngine {
|
|
|
20
38
|
debounceTickRate: devOptions.watch.debounceTickRate
|
|
21
39
|
}
|
|
22
40
|
};
|
|
23
|
-
|
|
24
|
-
return new DevEngine(inner);
|
|
41
|
+
return new DevEngine(new BindingDevEngine(options.bundlerOptions, bindingDevOptions));
|
|
25
42
|
}
|
|
26
43
|
constructor(inner) {
|
|
27
44
|
this.#inner = inner;
|
|
@@ -52,6 +69,9 @@ var DevEngine = class DevEngine {
|
|
|
52
69
|
removeClient(clientId) {
|
|
53
70
|
this.#inner.removeClient(clientId);
|
|
54
71
|
}
|
|
72
|
+
async close() {
|
|
73
|
+
await this.#inner.close();
|
|
74
|
+
}
|
|
55
75
|
};
|
|
56
76
|
|
|
57
77
|
//#endregion
|
|
@@ -66,8 +86,7 @@ var dev = DevEngine.create;
|
|
|
66
86
|
* Calling this API will only execute the scan stage of rolldown.
|
|
67
87
|
*/
|
|
68
88
|
const scan = async (input) => {
|
|
69
|
-
const
|
|
70
|
-
const build = new RolldownBuild(inputOptions);
|
|
89
|
+
const build = new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
71
90
|
try {
|
|
72
91
|
await build.scan();
|
|
73
92
|
} finally {
|
|
@@ -106,22 +125,19 @@ function wasmHelperPlugin(config) {
|
|
|
106
125
|
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
107
126
|
}
|
|
108
127
|
function wasmFallbackPlugin() {
|
|
109
|
-
|
|
110
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
128
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:wasm-fallback"));
|
|
111
129
|
}
|
|
112
130
|
function loadFallbackPlugin() {
|
|
113
131
|
return new BuiltinPlugin("builtin:load-fallback");
|
|
114
132
|
}
|
|
115
133
|
function jsonPlugin(config) {
|
|
116
|
-
|
|
117
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
134
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:json", config));
|
|
118
135
|
}
|
|
119
136
|
function buildImportAnalysisPlugin(config) {
|
|
120
137
|
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
121
138
|
}
|
|
122
139
|
function viteResolvePlugin(config) {
|
|
123
|
-
|
|
124
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
140
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", config));
|
|
125
141
|
}
|
|
126
142
|
function isolatedDeclarationPlugin(config) {
|
|
127
143
|
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
@@ -140,8 +156,7 @@ function reactRefreshWrapperPlugin(config) {
|
|
|
140
156
|
config.include = normalizedStringOrRegex(config.include);
|
|
141
157
|
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
142
158
|
}
|
|
143
|
-
|
|
144
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
159
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:react-refresh-wrapper", config));
|
|
145
160
|
}
|
|
146
161
|
|
|
147
162
|
//#endregion
|
|
@@ -647,4 +662,4 @@ function transformPlugin(config) {
|
|
|
647
662
|
}
|
|
648
663
|
|
|
649
664
|
//#endregion
|
|
650
|
-
export {
|
|
665
|
+
export { BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-
|
|
2
|
-
import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-
|
|
1
|
+
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingOutputs, BindingReactRefreshWrapperPluginConfig, BindingRebuildStrategy, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/api/dev/dev-options.d.ts
|
|
5
|
+
type DevOnHmrUpdates = (result: Error | {
|
|
6
|
+
updates: BindingClientHmrUpdate[];
|
|
7
|
+
changedFiles: string[];
|
|
8
|
+
}) => void | Promise<void>;
|
|
9
|
+
type DevOnOutput = (result: Error | BindingOutputs) => void | Promise<void>;
|
|
5
10
|
interface DevWatchOptions {
|
|
6
11
|
/**
|
|
7
12
|
* If `true`, files are not written to disk.
|
|
@@ -43,7 +48,16 @@ interface DevWatchOptions {
|
|
|
43
48
|
debounceTickRate?: number;
|
|
44
49
|
}
|
|
45
50
|
interface DevOptions {
|
|
46
|
-
onHmrUpdates?:
|
|
51
|
+
onHmrUpdates?: DevOnHmrUpdates;
|
|
52
|
+
onOutput?: DevOnOutput;
|
|
53
|
+
/**
|
|
54
|
+
* Strategy for triggering rebuilds after HMR updates.
|
|
55
|
+
* - `'always'`: Always trigger a rebuild after HMR updates
|
|
56
|
+
* - `'auto'`: Trigger rebuild only if HMR updates contain full reload updates
|
|
57
|
+
* - `'never'`: Never trigger rebuild after HMR updates (default)
|
|
58
|
+
* @default 'auto'
|
|
59
|
+
*/
|
|
60
|
+
rebuildStrategy?: "always" | "auto" | "never";
|
|
47
61
|
watch?: DevWatchOptions;
|
|
48
62
|
}
|
|
49
63
|
//#endregion
|
|
@@ -59,6 +73,7 @@ declare class DevEngine {
|
|
|
59
73
|
invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingClientHmrUpdate[]>;
|
|
60
74
|
registerModules(clientId: string, modules: string[]): void;
|
|
61
75
|
removeClient(clientId: string): void;
|
|
76
|
+
close(): Promise<void>;
|
|
62
77
|
}
|
|
63
78
|
//#endregion
|
|
64
79
|
//#region src/api/dev/index.d.ts
|
|
@@ -143,4 +158,4 @@ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exc
|
|
|
143
158
|
};
|
|
144
159
|
declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
|
|
145
160
|
//#endregion
|
|
146
|
-
export { BindingClientHmrUpdate, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
|
161
|
+
export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./shared/src-
|
|
2
|
-
import "./shared/parse-ast-index-
|
|
3
|
-
import "./shared/dist-
|
|
4
|
-
import { logger } from "./shared/logger-
|
|
5
|
-
import {
|
|
1
|
+
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizeBindingResult, normalizedStringOrRegex } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
|
+
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
|
+
import "./shared/dist-CU0dSkK2.mjs";
|
|
4
|
+
import { logger } from "./shared/logger-B83ocDok.mjs";
|
|
5
|
+
import { BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
|
|
8
8
|
//#region src/api/dev/dev-engine.ts
|
|
@@ -12,8 +12,26 @@ var DevEngine = class DevEngine {
|
|
|
12
12
|
static async create(inputOptions, outputOptions = {}, devOptions = {}) {
|
|
13
13
|
inputOptions = await PluginDriver.callOptionsHook(inputOptions);
|
|
14
14
|
const options = await createBundlerOptions(inputOptions, outputOptions, false);
|
|
15
|
+
const userOnHmrUpdates = devOptions.onHmrUpdates;
|
|
16
|
+
const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) {
|
|
17
|
+
const result = normalizeBindingResult(rawResult);
|
|
18
|
+
if (result instanceof Error) {
|
|
19
|
+
userOnHmrUpdates(result);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const [updates, changedFiles] = result;
|
|
23
|
+
userOnHmrUpdates({
|
|
24
|
+
updates,
|
|
25
|
+
changedFiles
|
|
26
|
+
});
|
|
27
|
+
} : void 0;
|
|
28
|
+
const userOnOutput = devOptions.onOutput;
|
|
15
29
|
const bindingDevOptions = {
|
|
16
|
-
onHmrUpdates:
|
|
30
|
+
onHmrUpdates: bindingOnHmrUpdates,
|
|
31
|
+
onOutput: userOnOutput ? function(rawResult) {
|
|
32
|
+
userOnOutput(normalizeBindingResult(rawResult));
|
|
33
|
+
} : void 0,
|
|
34
|
+
rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
|
|
17
35
|
watch: devOptions.watch && {
|
|
18
36
|
skipWrite: devOptions.watch.skipWrite,
|
|
19
37
|
usePolling: devOptions.watch.usePolling,
|
|
@@ -24,8 +42,7 @@ var DevEngine = class DevEngine {
|
|
|
24
42
|
debounceTickRate: devOptions.watch.debounceTickRate
|
|
25
43
|
}
|
|
26
44
|
};
|
|
27
|
-
|
|
28
|
-
return new DevEngine(inner);
|
|
45
|
+
return new DevEngine(new BindingDevEngine(options.bundlerOptions, bindingDevOptions));
|
|
29
46
|
}
|
|
30
47
|
constructor(inner) {
|
|
31
48
|
this.#inner = inner;
|
|
@@ -56,6 +73,9 @@ var DevEngine = class DevEngine {
|
|
|
56
73
|
removeClient(clientId) {
|
|
57
74
|
this.#inner.removeClient(clientId);
|
|
58
75
|
}
|
|
76
|
+
async close() {
|
|
77
|
+
await this.#inner.close();
|
|
78
|
+
}
|
|
59
79
|
};
|
|
60
80
|
|
|
61
81
|
//#endregion
|
|
@@ -70,8 +90,7 @@ var dev = DevEngine.create;
|
|
|
70
90
|
* Calling this API will only execute the scan stage of rolldown.
|
|
71
91
|
*/
|
|
72
92
|
const scan = async (input) => {
|
|
73
|
-
const
|
|
74
|
-
const build = new RolldownBuild(inputOptions);
|
|
93
|
+
const build = new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
75
94
|
try {
|
|
76
95
|
await build.scan();
|
|
77
96
|
} finally {
|
|
@@ -115,22 +134,19 @@ function wasmHelperPlugin(config) {
|
|
|
115
134
|
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
116
135
|
}
|
|
117
136
|
function wasmFallbackPlugin() {
|
|
118
|
-
|
|
119
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
137
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:wasm-fallback"));
|
|
120
138
|
}
|
|
121
139
|
function loadFallbackPlugin() {
|
|
122
140
|
return new BuiltinPlugin("builtin:load-fallback");
|
|
123
141
|
}
|
|
124
142
|
function jsonPlugin(config) {
|
|
125
|
-
|
|
126
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
143
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:json", config));
|
|
127
144
|
}
|
|
128
145
|
function buildImportAnalysisPlugin(config) {
|
|
129
146
|
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
130
147
|
}
|
|
131
148
|
function viteResolvePlugin(config) {
|
|
132
|
-
|
|
133
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
149
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", config));
|
|
134
150
|
}
|
|
135
151
|
function isolatedDeclarationPlugin(config) {
|
|
136
152
|
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
@@ -149,8 +165,7 @@ function reactRefreshWrapperPlugin(config) {
|
|
|
149
165
|
config.include = normalizedStringOrRegex(config.include);
|
|
150
166
|
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
151
167
|
}
|
|
152
|
-
|
|
153
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
168
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:react-refresh-wrapper", config));
|
|
154
169
|
}
|
|
155
170
|
|
|
156
171
|
//#endregion
|
|
@@ -213,4 +228,4 @@ function transformPlugin(config) {
|
|
|
213
228
|
}
|
|
214
229
|
|
|
215
230
|
//#endregion
|
|
216
|
-
export {
|
|
231
|
+
export { BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
package/dist/filter-index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { withFilter } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { withFilter } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
3
|
import { and, code, exclude, id, include, moduleType, not, or, queries, query } from "@rolldown/pluginutils";
|
|
4
4
|
export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
|
package/dist/filter-index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { and, arraify, code, exclude, id, include, isPromiseLike, moduleType, not, or, queries, query } from "./shared/dist-
|
|
1
|
+
import { and, arraify, code, exclude, id, include, isPromiseLike, moduleType, not, or, queries, query } from "./shared/dist-CU0dSkK2.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin/with-filter.ts
|
|
4
4
|
function withFilterImpl(pluginOption, filterObjectList) {
|
package/dist/index.browser.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "./src-
|
|
1
|
+
import { BindingMagicString, VERSION, build, defineConfig, rolldown, watch } from "./src-DXN0YLUN.js";
|
|
2
2
|
|
|
3
|
-
export { VERSION, build, defineConfig, rolldown, watch };
|
|
3
|
+
export { BindingMagicString, VERSION, build, defineConfig, rolldown, watch };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PreRenderedChunk } from "./shared/binding-
|
|
2
|
-
import { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch } from "./shared/define-config-
|
|
3
|
-
export { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };
|
|
1
|
+
import { BindingMagicString, PreRenderedChunk } from "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
|
+
export { AddonFunction, AsyncPluginHooks, BindingMagicString, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-
|
|
2
|
-
import "./shared/parse-ast-index-
|
|
3
|
-
import "./shared/dist-
|
|
1
|
+
import { BindingMagicString, VERSION, build, defineConfig, rolldown, watch } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
|
+
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
|
+
import "./shared/dist-CU0dSkK2.mjs";
|
|
4
4
|
|
|
5
|
-
export { VERSION, build, defineConfig, rolldown, watch };
|
|
5
|
+
export { BindingMagicString, VERSION, build, defineConfig, rolldown, watch };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PluginContextData, bindingifyPlugin } from "./shared/src-
|
|
2
|
-
import "./shared/parse-ast-index-
|
|
3
|
-
import "./shared/dist-
|
|
1
|
+
import { PluginContextData, bindingifyPlugin } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
|
+
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
|
+
import "./shared/dist-CU0dSkK2.mjs";
|
|
4
4
|
import { parentPort, workerData } from "node:worker_threads";
|
|
5
5
|
import { registerPlugins } from "./rolldown-binding.wasi.cjs";
|
|
6
6
|
|
|
@@ -8,15 +8,14 @@ import { registerPlugins } from "./rolldown-binding.wasi.cjs";
|
|
|
8
8
|
const { registryId, pluginInfos, threadNumber } = workerData;
|
|
9
9
|
(async () => {
|
|
10
10
|
try {
|
|
11
|
-
|
|
11
|
+
registerPlugins(registryId, await Promise.all(pluginInfos.map(async (pluginInfo) => {
|
|
12
12
|
const definePluginImpl = (await import(pluginInfo.fileUrl)).default;
|
|
13
13
|
const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
|
|
14
14
|
return {
|
|
15
15
|
index: pluginInfo.index,
|
|
16
16
|
plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData(() => {}, {}, []), [], () => {}, "info", false)
|
|
17
17
|
};
|
|
18
|
-
}));
|
|
19
|
-
registerPlugins(registryId, plugins);
|
|
18
|
+
})));
|
|
20
19
|
parentPort.postMessage({ type: "success" });
|
|
21
20
|
} catch (error) {
|
|
22
21
|
parentPort.postMessage({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { MaybePromise, Plugin } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { MaybePromise, Plugin } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/parallel-plugin-implementation.d.ts
|
|
5
5
|
type ParallelPluginImplementation = Plugin;
|
package/dist/parse-ast-index.mjs
CHANGED
|
@@ -88,9 +88,7 @@ export const BindingBundler = __napiModule.exports.BindingBundler
|
|
|
88
88
|
export const BindingBundlerImpl = __napiModule.exports.BindingBundlerImpl
|
|
89
89
|
export const BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
90
90
|
export const BindingChunkingContext = __napiModule.exports.BindingChunkingContext
|
|
91
|
-
export const BindingClientHmrUpdate = __napiModule.exports.BindingClientHmrUpdate
|
|
92
91
|
export const BindingDevEngine = __napiModule.exports.BindingDevEngine
|
|
93
|
-
export const BindingHmrOutput = __napiModule.exports.BindingHmrOutput
|
|
94
92
|
export const BindingMagicString = __napiModule.exports.BindingMagicString
|
|
95
93
|
export const BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
96
94
|
export const BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
|
|
@@ -116,9 +114,10 @@ export const BindingLogLevel = __napiModule.exports.BindingLogLevel
|
|
|
116
114
|
export const BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
117
115
|
export const BindingPropertyReadSideEffects = __napiModule.exports.BindingPropertyReadSideEffects
|
|
118
116
|
export const BindingPropertyWriteSideEffects = __napiModule.exports.BindingPropertyWriteSideEffects
|
|
117
|
+
export const BindingRebuildStrategy = __napiModule.exports.BindingRebuildStrategy
|
|
118
|
+
export const createTokioRuntime = __napiModule.exports.createTokioRuntime
|
|
119
119
|
export const FilterTokenKind = __napiModule.exports.FilterTokenKind
|
|
120
120
|
export const initTraceSubscriber = __napiModule.exports.initTraceSubscriber
|
|
121
121
|
export const registerPlugins = __napiModule.exports.registerPlugins
|
|
122
122
|
export const shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
|
|
123
123
|
export const startAsyncRuntime = __napiModule.exports.startAsyncRuntime
|
|
124
|
-
export const JsWatcher = __napiModule.exports.JsWatcher
|
|
@@ -133,9 +133,7 @@ module.exports.BindingBundler = __napiModule.exports.BindingBundler
|
|
|
133
133
|
module.exports.BindingBundlerImpl = __napiModule.exports.BindingBundlerImpl
|
|
134
134
|
module.exports.BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
135
135
|
module.exports.BindingChunkingContext = __napiModule.exports.BindingChunkingContext
|
|
136
|
-
module.exports.BindingClientHmrUpdate = __napiModule.exports.BindingClientHmrUpdate
|
|
137
136
|
module.exports.BindingDevEngine = __napiModule.exports.BindingDevEngine
|
|
138
|
-
module.exports.BindingHmrOutput = __napiModule.exports.BindingHmrOutput
|
|
139
137
|
module.exports.BindingMagicString = __napiModule.exports.BindingMagicString
|
|
140
138
|
module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
141
139
|
module.exports.BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
|
|
@@ -161,9 +159,10 @@ module.exports.BindingLogLevel = __napiModule.exports.BindingLogLevel
|
|
|
161
159
|
module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
162
160
|
module.exports.BindingPropertyReadSideEffects = __napiModule.exports.BindingPropertyReadSideEffects
|
|
163
161
|
module.exports.BindingPropertyWriteSideEffects = __napiModule.exports.BindingPropertyWriteSideEffects
|
|
162
|
+
module.exports.BindingRebuildStrategy = __napiModule.exports.BindingRebuildStrategy
|
|
163
|
+
module.exports.createTokioRuntime = __napiModule.exports.createTokioRuntime
|
|
164
164
|
module.exports.FilterTokenKind = __napiModule.exports.FilterTokenKind
|
|
165
165
|
module.exports.initTraceSubscriber = __napiModule.exports.initTraceSubscriber
|
|
166
166
|
module.exports.registerPlugins = __napiModule.exports.registerPlugins
|
|
167
167
|
module.exports.shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
|
|
168
168
|
module.exports.startAsyncRuntime = __napiModule.exports.startAsyncRuntime
|
|
169
|
-
module.exports.JsWatcher = __napiModule.exports.JsWatcher
|
|
Binary file
|
|
@@ -4,6 +4,10 @@ import * as _oxc_project_types0 from "@oxc-project/types";
|
|
|
4
4
|
type MaybePromise<T> = T | Promise<T>;
|
|
5
5
|
type VoidNullable<T = void> = T | null | undefined | void;
|
|
6
6
|
type BindingStringOrRegex = string | RegExp;
|
|
7
|
+
type BindingResult<T> = {
|
|
8
|
+
errors: BindingError[];
|
|
9
|
+
isBindingErrors: boolean;
|
|
10
|
+
} | T;
|
|
7
11
|
interface CodegenOptions {
|
|
8
12
|
/**
|
|
9
13
|
* Remove whitespace.
|
|
@@ -1150,19 +1154,31 @@ declare class BindingBundleEndEventData {
|
|
|
1150
1154
|
}
|
|
1151
1155
|
declare class BindingBundleErrorEventData {
|
|
1152
1156
|
get result(): BindingBundlerImpl;
|
|
1153
|
-
get error(): Array<
|
|
1157
|
+
get error(): Array<BindingError>;
|
|
1154
1158
|
}
|
|
1155
1159
|
declare class BindingBundlerImpl {
|
|
1156
|
-
write(): Promise<BindingOutputs
|
|
1157
|
-
generate(): Promise<BindingOutputs
|
|
1158
|
-
scan(): Promise<BindingOutputs
|
|
1160
|
+
write(): Promise<BindingResult<BindingOutputs>>;
|
|
1161
|
+
generate(): Promise<BindingResult<BindingOutputs>>;
|
|
1162
|
+
scan(): Promise<BindingResult<BindingOutputs>>;
|
|
1159
1163
|
close(): Promise<void>;
|
|
1160
1164
|
get closed(): boolean;
|
|
1161
1165
|
getWatchFiles(): Promise<Array<string>>;
|
|
1162
1166
|
}
|
|
1163
|
-
declare class
|
|
1164
|
-
|
|
1165
|
-
|
|
1167
|
+
declare class BindingMagicString {
|
|
1168
|
+
constructor(source: string);
|
|
1169
|
+
replace(from: string, to: string): void;
|
|
1170
|
+
replaceAll(from: string, to: string): void;
|
|
1171
|
+
prepend(content: string): void;
|
|
1172
|
+
append(content: string): void;
|
|
1173
|
+
prependLeft(index: number, content: string): void;
|
|
1174
|
+
prependRight(index: number, content: string): void;
|
|
1175
|
+
appendLeft(index: number, content: string): void;
|
|
1176
|
+
appendRight(index: number, content: string): void;
|
|
1177
|
+
overwrite(start: number, end: number, content: string): void;
|
|
1178
|
+
toString(): string;
|
|
1179
|
+
hasChanged(): boolean;
|
|
1180
|
+
length(): number;
|
|
1181
|
+
isEmpty(): boolean;
|
|
1166
1182
|
}
|
|
1167
1183
|
declare class BindingOutputAsset {
|
|
1168
1184
|
get fileName(): string;
|
|
@@ -1191,7 +1207,6 @@ declare class BindingOutputChunk {
|
|
|
1191
1207
|
declare class BindingOutputs {
|
|
1192
1208
|
get chunks(): Array<BindingOutputChunk>;
|
|
1193
1209
|
get assets(): Array<BindingOutputAsset>;
|
|
1194
|
-
get errors(): Array<Error | BindingError>;
|
|
1195
1210
|
}
|
|
1196
1211
|
declare class BindingRenderedChunk {
|
|
1197
1212
|
get name(): string;
|
|
@@ -1243,15 +1258,22 @@ interface BindingBuildImportAnalysisPluginConfig {
|
|
|
1243
1258
|
isRelativeBase: boolean;
|
|
1244
1259
|
}
|
|
1245
1260
|
type BindingBuiltinPluginName = 'builtin:alias' | 'builtin:asset' | 'builtin:asset-import-meta-url' | 'builtin:build-import-analysis' | 'builtin:dynamic-import-vars' | 'builtin:import-glob' | 'builtin:isolated-declaration' | 'builtin:json' | 'builtin:load-fallback' | 'builtin:manifest' | 'builtin:module-preload-polyfill' | 'builtin:react-refresh-wrapper' | 'builtin:reporter' | 'builtin:replace' | 'builtin:esm-external-require' | 'builtin:transform' | 'builtin:vite-resolve' | 'builtin:wasm-fallback' | 'builtin:wasm-helper' | 'builtin:web-worker-post';
|
|
1261
|
+
interface BindingClientHmrUpdate {
|
|
1262
|
+
clientId: string;
|
|
1263
|
+
update: BindingHmrUpdate;
|
|
1264
|
+
}
|
|
1246
1265
|
interface BindingDynamicImportVarsPluginConfig {
|
|
1247
1266
|
include?: Array<BindingStringOrRegex>;
|
|
1248
1267
|
exclude?: Array<BindingStringOrRegex>;
|
|
1249
1268
|
resolver?: (id: string, importer: string) => MaybePromise<string | undefined>;
|
|
1250
1269
|
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
}
|
|
1270
|
+
type BindingError = {
|
|
1271
|
+
type: 'JsError';
|
|
1272
|
+
field0: Error;
|
|
1273
|
+
} | {
|
|
1274
|
+
type: 'NativeError';
|
|
1275
|
+
field0: NativeError;
|
|
1276
|
+
};
|
|
1255
1277
|
interface BindingEsmExternalRequirePluginConfig {
|
|
1256
1278
|
external: Array<BindingStringOrRegex>;
|
|
1257
1279
|
skipDuplicateCheck?: boolean;
|
|
@@ -1320,6 +1342,11 @@ interface BindingReactRefreshWrapperPluginConfig {
|
|
|
1320
1342
|
jsxImportSource: string;
|
|
1321
1343
|
reactRefreshHost: string;
|
|
1322
1344
|
}
|
|
1345
|
+
declare enum BindingRebuildStrategy {
|
|
1346
|
+
Always = 0,
|
|
1347
|
+
Auto = 1,
|
|
1348
|
+
Never = 2,
|
|
1349
|
+
}
|
|
1323
1350
|
interface BindingRenderBuiltUrlConfig {
|
|
1324
1351
|
ssr: boolean;
|
|
1325
1352
|
type: 'asset' | 'public';
|
|
@@ -1392,6 +1419,11 @@ interface BindingViteResolvePluginResolveOptions {
|
|
|
1392
1419
|
interface BindingWasmHelperPluginConfig {
|
|
1393
1420
|
decodedBase: string;
|
|
1394
1421
|
}
|
|
1422
|
+
/** Error emitted from native side, it only contains kind and message, no stack trace. */
|
|
1423
|
+
interface NativeError {
|
|
1424
|
+
kind: string;
|
|
1425
|
+
message: string;
|
|
1426
|
+
}
|
|
1395
1427
|
interface PreRenderedChunk {
|
|
1396
1428
|
name: string;
|
|
1397
1429
|
isEntry: boolean;
|
|
@@ -1401,4 +1433,4 @@ interface PreRenderedChunk {
|
|
|
1401
1433
|
exports: Array<string>;
|
|
1402
1434
|
}
|
|
1403
1435
|
//#endregion
|
|
1404
|
-
export { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingRenderedChunk, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, BindingWatcherEvent, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, MinifyOptions, NapiResolveOptions, ParseResult, ParserOptions, PreRenderedChunk, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform };
|
|
1436
|
+
export { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingMagicString, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingOutputs, BindingReactRefreshWrapperPluginConfig, BindingRebuildStrategy, BindingRenderedChunk, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, BindingWatcherEvent, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, MinifyOptions, NapiResolveOptions, ParseResult, ParserOptions, PreRenderedChunk, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform };
|