rolldown 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 +23 -10
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.d.mts +19 -4
- package/dist/experimental-index.mjs +32 -17
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/parallel-plugin-worker.mjs +4 -5
- 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/shared/{binding-DOpOtI1J.d.mts → binding-BkaKdpud.d.mts} +45 -13
- package/dist/shared/{define-config-BZ_n3PjJ.d.mts → define-config-BGtNx9V_.d.mts} +60 -3
- package/dist/shared/{load-config-DkgIoWHl.mjs → load-config-CLB1MN5j.mjs} +4 -7
- package/dist/shared/{logger-ClMekpHZ.mjs → logger-B83ocDok.mjs} +6 -9
- package/dist/shared/{parse-ast-index-D2PcAmXE.mjs → parse-ast-index-DkUtf7vl.mjs} +98 -129
- package/dist/shared/{prompt-R6XhwkxA.mjs → prompt-B4e-jZUR.mjs} +18 -20
- package/dist/shared/{src-DkvlJJsC.mjs → src-DucjDcdj.mjs} +87 -46
- package/package.json +20 -21
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./shared/parse-ast-index-
|
|
2
|
-
import { description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-
|
|
1
|
+
import { createTokioRuntime } from "./shared/parse-ast-index-DkUtf7vl.mjs";
|
|
2
|
+
import { description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-DucjDcdj.mjs";
|
|
3
3
|
import { arraify } from "./shared/misc-CQeo-AFx.mjs";
|
|
4
|
-
import { logger } from "./shared/logger-
|
|
5
|
-
import { loadConfig } from "./shared/load-config-
|
|
4
|
+
import { logger } from "./shared/logger-B83ocDok.mjs";
|
|
5
|
+
import { loadConfig } from "./shared/load-config-CLB1MN5j.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import colors from "ansis";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
@@ -91,13 +91,15 @@ function normalizeCliOptions(cliOptions, positionals) {
|
|
|
91
91
|
watch: options$1.watch ?? false
|
|
92
92
|
};
|
|
93
93
|
if (typeof options$1.config === "string") result.config = options$1.config;
|
|
94
|
+
if (options$1.environment !== void 0) result.environment = options$1.environment;
|
|
94
95
|
const keysOfInput = getInputCliKeys();
|
|
95
96
|
const keysOfOutput = getOutputCliKeys();
|
|
96
97
|
const reservedKeys = [
|
|
97
98
|
"help",
|
|
98
99
|
"version",
|
|
99
100
|
"config",
|
|
100
|
-
"watch"
|
|
101
|
+
"watch",
|
|
102
|
+
"environment"
|
|
101
103
|
];
|
|
102
104
|
for (let [key, value] of Object.entries(options$1)) {
|
|
103
105
|
const [primary] = key.split(".");
|
|
@@ -242,7 +244,7 @@ function getClearScreenFunction(options$1) {
|
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
//#endregion
|
|
245
|
-
//#region \0@oxc-project+runtime@0.
|
|
247
|
+
//#region \0@oxc-project+runtime@0.94.0/helpers/usingCtx.js
|
|
246
248
|
function _usingCtx() {
|
|
247
249
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r$1, e$1) {
|
|
248
250
|
var n$1 = Error();
|
|
@@ -311,8 +313,13 @@ async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
|
|
|
311
313
|
process.exit(1);
|
|
312
314
|
}
|
|
313
315
|
const resolvedConfig = typeof config === "function" ? await config(rawArgs) : config;
|
|
314
|
-
if (cliOptions.watch)
|
|
315
|
-
|
|
316
|
+
if (cliOptions.watch) {
|
|
317
|
+
createTokioRuntime(32);
|
|
318
|
+
await watchInner(resolvedConfig, cliOptions);
|
|
319
|
+
} else {
|
|
320
|
+
createTokioRuntime(4);
|
|
321
|
+
await bundleInner(resolvedConfig, cliOptions);
|
|
322
|
+
}
|
|
316
323
|
}
|
|
317
324
|
async function bundleWithCliOptions(cliOptions) {
|
|
318
325
|
try {
|
|
@@ -413,8 +420,7 @@ async function bundleInner(config, cliOptions) {
|
|
|
413
420
|
}
|
|
414
421
|
function printBundleOutputPretty(output) {
|
|
415
422
|
const outputEntries = collectOutputEntries(output.output);
|
|
416
|
-
|
|
417
|
-
printOutputEntries(outputEntries, outputLayoutSizes, "<DIR>");
|
|
423
|
+
printOutputEntries(outputEntries, collectOutputLayoutAdjustmentSizes(outputEntries), "<DIR>");
|
|
418
424
|
}
|
|
419
425
|
function collectOutputEntries(output) {
|
|
420
426
|
return output.map((chunk) => ({
|
|
@@ -556,6 +562,13 @@ function checkNodeVersion(nodeVersion) {
|
|
|
556
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.`);
|
|
557
563
|
async function main() {
|
|
558
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
|
+
}
|
|
559
572
|
if (cliOptions.config || cliOptions.config === "") {
|
|
560
573
|
await bundleWithConfig(cliOptions.config, cliOptions, rawArgs);
|
|
561
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-BGtNx9V_.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/load-config.d.ts
|
|
5
5
|
declare function loadConfig(configPath: string): Promise<ConfigExport>;
|
package/dist/config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./shared/parse-ast-index-
|
|
2
|
-
import { defineConfig, version } from "./shared/src-
|
|
1
|
+
import "./shared/parse-ast-index-DkUtf7vl.mjs";
|
|
2
|
+
import { defineConfig, version } from "./shared/src-DucjDcdj.mjs";
|
|
3
3
|
import "./shared/misc-CQeo-AFx.mjs";
|
|
4
|
-
import { loadConfig } from "./shared/load-config-
|
|
4
|
+
import { loadConfig } from "./shared/load-config-CLB1MN5j.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/config.ts
|
|
7
7
|
const VERSION = version;
|
|
@@ -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-BGtNx9V_.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,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./shared/src-
|
|
1
|
+
import { BindingDevEngine, BindingRebuildStrategy, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/parse-ast-index-DkUtf7vl.mjs";
|
|
2
|
+
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizeBindingResult, normalizedStringOrRegex } from "./shared/src-DucjDcdj.mjs";
|
|
3
3
|
import "./shared/misc-CQeo-AFx.mjs";
|
|
4
|
-
import { logger } from "./shared/logger-
|
|
4
|
+
import { logger } from "./shared/logger-B83ocDok.mjs";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
|
|
7
7
|
//#region src/api/dev/dev-engine.ts
|
|
@@ -11,8 +11,26 @@ var DevEngine = class DevEngine {
|
|
|
11
11
|
static async create(inputOptions, outputOptions = {}, devOptions = {}) {
|
|
12
12
|
inputOptions = await PluginDriver.callOptionsHook(inputOptions);
|
|
13
13
|
const options = await createBundlerOptions(inputOptions, outputOptions, false);
|
|
14
|
+
const userOnHmrUpdates = devOptions.onHmrUpdates;
|
|
15
|
+
const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) {
|
|
16
|
+
const result = normalizeBindingResult(rawResult);
|
|
17
|
+
if (result instanceof Error) {
|
|
18
|
+
userOnHmrUpdates(result);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const [updates, changedFiles] = result;
|
|
22
|
+
userOnHmrUpdates({
|
|
23
|
+
updates,
|
|
24
|
+
changedFiles
|
|
25
|
+
});
|
|
26
|
+
} : void 0;
|
|
27
|
+
const userOnOutput = devOptions.onOutput;
|
|
14
28
|
const bindingDevOptions = {
|
|
15
|
-
onHmrUpdates:
|
|
29
|
+
onHmrUpdates: bindingOnHmrUpdates,
|
|
30
|
+
onOutput: userOnOutput ? function(rawResult) {
|
|
31
|
+
userOnOutput(normalizeBindingResult(rawResult));
|
|
32
|
+
} : void 0,
|
|
33
|
+
rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy.Auto : BindingRebuildStrategy.Never : void 0,
|
|
16
34
|
watch: devOptions.watch && {
|
|
17
35
|
skipWrite: devOptions.watch.skipWrite,
|
|
18
36
|
usePolling: devOptions.watch.usePolling,
|
|
@@ -23,8 +41,7 @@ var DevEngine = class DevEngine {
|
|
|
23
41
|
debounceTickRate: devOptions.watch.debounceTickRate
|
|
24
42
|
}
|
|
25
43
|
};
|
|
26
|
-
|
|
27
|
-
return new DevEngine(inner);
|
|
44
|
+
return new DevEngine(new BindingDevEngine(options.bundlerOptions, bindingDevOptions));
|
|
28
45
|
}
|
|
29
46
|
constructor(inner) {
|
|
30
47
|
this.#inner = inner;
|
|
@@ -55,6 +72,9 @@ var DevEngine = class DevEngine {
|
|
|
55
72
|
removeClient(clientId) {
|
|
56
73
|
this.#inner.removeClient(clientId);
|
|
57
74
|
}
|
|
75
|
+
async close() {
|
|
76
|
+
await this.#inner.close();
|
|
77
|
+
}
|
|
58
78
|
};
|
|
59
79
|
|
|
60
80
|
//#endregion
|
|
@@ -69,8 +89,7 @@ var dev = DevEngine.create;
|
|
|
69
89
|
* Calling this API will only execute the scan stage of rolldown.
|
|
70
90
|
*/
|
|
71
91
|
const scan = async (input) => {
|
|
72
|
-
const
|
|
73
|
-
const build = new RolldownBuild(inputOptions);
|
|
92
|
+
const build = new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
74
93
|
try {
|
|
75
94
|
await build.scan();
|
|
76
95
|
} finally {
|
|
@@ -114,22 +133,19 @@ function wasmHelperPlugin(config) {
|
|
|
114
133
|
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
115
134
|
}
|
|
116
135
|
function wasmFallbackPlugin() {
|
|
117
|
-
|
|
118
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
136
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:wasm-fallback"));
|
|
119
137
|
}
|
|
120
138
|
function loadFallbackPlugin() {
|
|
121
139
|
return new BuiltinPlugin("builtin:load-fallback");
|
|
122
140
|
}
|
|
123
141
|
function jsonPlugin(config) {
|
|
124
|
-
|
|
125
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
142
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:json", config));
|
|
126
143
|
}
|
|
127
144
|
function buildImportAnalysisPlugin(config) {
|
|
128
145
|
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
129
146
|
}
|
|
130
147
|
function viteResolvePlugin(config) {
|
|
131
|
-
|
|
132
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
148
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", config));
|
|
133
149
|
}
|
|
134
150
|
function isolatedDeclarationPlugin(config) {
|
|
135
151
|
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
@@ -148,8 +164,7 @@ function reactRefreshWrapperPlugin(config) {
|
|
|
148
164
|
config.include = normalizedStringOrRegex(config.include);
|
|
149
165
|
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
150
166
|
}
|
|
151
|
-
|
|
152
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
167
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:react-refresh-wrapper", config));
|
|
153
168
|
}
|
|
154
169
|
|
|
155
170
|
//#endregion
|
|
@@ -212,4 +227,4 @@ function transformPlugin(config) {
|
|
|
212
227
|
}
|
|
213
228
|
|
|
214
229
|
//#endregion
|
|
215
|
-
export {
|
|
230
|
+
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-BGtNx9V_.mjs";
|
|
3
3
|
import { and, code, exclude, id, include, moduleType, not, or, queries, query } from "@rolldown/pluginutils";
|
|
4
4
|
export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PreRenderedChunk } from "./shared/binding-
|
|
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-BGtNx9V_.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 "./shared/parse-ast-index-
|
|
2
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-
|
|
1
|
+
import { BindingMagicString } from "./shared/parse-ast-index-DkUtf7vl.mjs";
|
|
2
|
+
import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-DucjDcdj.mjs";
|
|
3
3
|
import "./shared/misc-CQeo-AFx.mjs";
|
|
4
4
|
|
|
5
|
-
export { VERSION, build, defineConfig, rolldown, watch };
|
|
5
|
+
export { BindingMagicString, VERSION, build, defineConfig, rolldown, watch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { registerPlugins } from "./shared/parse-ast-index-
|
|
2
|
-
import { PluginContextData, bindingifyPlugin } from "./shared/src-
|
|
1
|
+
import { registerPlugins } from "./shared/parse-ast-index-DkUtf7vl.mjs";
|
|
2
|
+
import { PluginContextData, bindingifyPlugin } from "./shared/src-DucjDcdj.mjs";
|
|
3
3
|
import "./shared/misc-CQeo-AFx.mjs";
|
|
4
4
|
import { parentPort, workerData } from "node:worker_threads";
|
|
5
5
|
|
|
@@ -7,15 +7,14 @@ import { parentPort, workerData } from "node:worker_threads";
|
|
|
7
7
|
const { registryId, pluginInfos, threadNumber } = workerData;
|
|
8
8
|
(async () => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
registerPlugins(registryId, await Promise.all(pluginInfos.map(async (pluginInfo) => {
|
|
11
11
|
const definePluginImpl = (await import(pluginInfo.fileUrl)).default;
|
|
12
12
|
const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
|
|
13
13
|
return {
|
|
14
14
|
index: pluginInfo.index,
|
|
15
15
|
plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData(() => {}, {}, []), [], () => {}, "info", false)
|
|
16
16
|
};
|
|
17
|
-
}));
|
|
18
|
-
registerPlugins(registryId, plugins);
|
|
17
|
+
})));
|
|
19
18
|
parentPort.postMessage({ type: "success" });
|
|
20
19
|
} catch (error) {
|
|
21
20
|
parentPort.postMessage({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { MaybePromise, Plugin } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { MaybePromise, Plugin } from "./shared/define-config-BGtNx9V_.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
|
@@ -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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-
|
|
1
|
+
import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHookResolveIdExtraArgs, BindingMagicString, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-BkaKdpud.mjs";
|
|
2
2
|
import { TopLevelFilterExpression } from "@rolldown/pluginutils";
|
|
3
3
|
import { Program } from "@oxc-project/types";
|
|
4
4
|
|
|
@@ -253,6 +253,37 @@ interface OutputOptions {
|
|
|
253
253
|
minify?: boolean | "dce-only" | MinifyOptions;
|
|
254
254
|
name?: string;
|
|
255
255
|
globals?: Record<string, string> | GlobalsFunction;
|
|
256
|
+
/**
|
|
257
|
+
* Maps external module IDs to paths.
|
|
258
|
+
*
|
|
259
|
+
* Allows customizing the path used when importing external dependencies.
|
|
260
|
+
* This is particularly useful for loading dependencies from CDNs or custom locations.
|
|
261
|
+
*
|
|
262
|
+
* - Object form: Maps module IDs to their replacement paths
|
|
263
|
+
* - Function form: Takes a module ID and returns its replacement path
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```js
|
|
267
|
+
* {
|
|
268
|
+
* paths: {
|
|
269
|
+
* 'd3': 'https://cdn.jsdelivr.net/npm/d3@7'
|
|
270
|
+
* }
|
|
271
|
+
* }
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```js
|
|
276
|
+
* {
|
|
277
|
+
* paths: (id) => {
|
|
278
|
+
* if (id.startsWith('lodash')) {
|
|
279
|
+
* return `https://cdn.jsdelivr.net/npm/${id}`
|
|
280
|
+
* }
|
|
281
|
+
* return id
|
|
282
|
+
* }
|
|
283
|
+
* }
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
paths?: Record<string, string> | ((id: string) => string);
|
|
256
287
|
generatedCode?: Partial<GeneratedCodeOptions>;
|
|
257
288
|
externalLiveBindings?: boolean;
|
|
258
289
|
inlineDynamicImports?: boolean;
|
|
@@ -314,7 +345,7 @@ interface OutputOptions {
|
|
|
314
345
|
* By default, each group will also include captured modules' dependencies. This reduces the chance of generating circular chunks.
|
|
315
346
|
*
|
|
316
347
|
* If you want to disable this behavior, it's recommended to both set
|
|
317
|
-
* - `preserveEntrySignatures: false`
|
|
348
|
+
* - `preserveEntrySignatures: false | 'allow-extension'`
|
|
318
349
|
* - `strictExecutionOrder: true`
|
|
319
350
|
*
|
|
320
351
|
* to avoid generating invalid chunks.
|
|
@@ -612,6 +643,7 @@ interface NormalizedInputOptions {
|
|
|
612
643
|
}
|
|
613
644
|
//#endregion
|
|
614
645
|
//#region src/options/normalized-output-options.d.ts
|
|
646
|
+
type PathsFunction = (id: string) => string;
|
|
615
647
|
type InternalModuleFormat = "es" | "cjs" | "iife" | "umd";
|
|
616
648
|
interface NormalizedOutputOptions {
|
|
617
649
|
name: string | undefined;
|
|
@@ -635,6 +667,7 @@ interface NormalizedOutputOptions {
|
|
|
635
667
|
esModule: boolean | "if-default-prop";
|
|
636
668
|
extend: boolean;
|
|
637
669
|
globals: Record<string, string> | GlobalsFunction;
|
|
670
|
+
paths: Record<string, string> | PathsFunction | undefined;
|
|
638
671
|
hashCharacters: "base64" | "base36" | "hex";
|
|
639
672
|
sourcemapDebugIds: boolean;
|
|
640
673
|
sourcemapIgnoreList: boolean | SourcemapIgnoreListOption | StringOrRegExp | undefined;
|
|
@@ -952,7 +985,9 @@ interface ResolveIdExtraOptions {
|
|
|
952
985
|
}
|
|
953
986
|
type ResolveIdResult = string | NullValue | false | PartialResolvedId;
|
|
954
987
|
type LoadResult = NullValue | string | SourceDescription;
|
|
955
|
-
type TransformResult = NullValue | string |
|
|
988
|
+
type TransformResult = NullValue | string | Omit<SourceDescription, "code"> & {
|
|
989
|
+
code?: string | BindingMagicString;
|
|
990
|
+
};
|
|
956
991
|
type RenderedChunkMeta = {
|
|
957
992
|
chunks: Record<string, RenderedChunk>;
|
|
958
993
|
};
|
|
@@ -970,6 +1005,7 @@ interface FunctionPluginHooks {
|
|
|
970
1005
|
[DEFINED_HOOK_NAMES.load]: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
|
|
971
1006
|
[DEFINED_HOOK_NAMES.transform]: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & {
|
|
972
1007
|
moduleType: ModuleType;
|
|
1008
|
+
magicString?: BindingMagicString;
|
|
973
1009
|
}) => TransformResult;
|
|
974
1010
|
[DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
|
|
975
1011
|
[DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
|
|
@@ -1238,6 +1274,17 @@ interface InputOptions {
|
|
|
1238
1274
|
onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
|
|
1239
1275
|
moduleTypes?: ModuleTypes;
|
|
1240
1276
|
experimental?: {
|
|
1277
|
+
/**
|
|
1278
|
+
* Lets modules be executed in the order they are declared.
|
|
1279
|
+
*
|
|
1280
|
+
* - Type: `boolean`
|
|
1281
|
+
* - Default: `false`
|
|
1282
|
+
*
|
|
1283
|
+
* This is done by injecting runtime helpers to ensure that modules are executed in the order they are imported. External modules won't be affected.
|
|
1284
|
+
*
|
|
1285
|
+
* > [!WARNING]
|
|
1286
|
+
* > Enabling this option may negatively increase bundle size. It is recommended to use this option only when absolutely necessary.
|
|
1287
|
+
*/
|
|
1241
1288
|
strictExecutionOrder?: boolean;
|
|
1242
1289
|
disableLiveBindings?: boolean;
|
|
1243
1290
|
viteMode?: boolean;
|
|
@@ -1326,6 +1373,16 @@ interface InputOptions {
|
|
|
1326
1373
|
*/
|
|
1327
1374
|
incrementalBuild?: boolean;
|
|
1328
1375
|
transformHiresSourcemap?: boolean | "boundary";
|
|
1376
|
+
/**
|
|
1377
|
+
* Use native Rust implementation of MagicString for source map generation.
|
|
1378
|
+
*
|
|
1379
|
+
* - Type: `boolean`
|
|
1380
|
+
* - Default: `false`
|
|
1381
|
+
*
|
|
1382
|
+
* When enabled, rolldown will use a native Rust implementation of MagicString
|
|
1383
|
+
* for better performance during source map generation.
|
|
1384
|
+
*/
|
|
1385
|
+
nativeMagicString?: boolean;
|
|
1329
1386
|
};
|
|
1330
1387
|
/**
|
|
1331
1388
|
* Replace global variables or [property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) with the provided values.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rolldown } from "./src-
|
|
1
|
+
import { rolldown } from "./src-DucjDcdj.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { readdir } from "node:fs/promises";
|
|
@@ -66,8 +66,7 @@ async function findConfigFileNameInCwd() {
|
|
|
66
66
|
throw new Error("No `rolldown.config` configuration file found.");
|
|
67
67
|
}
|
|
68
68
|
async function loadTsConfig(configFile) {
|
|
69
|
-
const
|
|
70
|
-
const file = await bundleTsConfig(configFile, isEsm);
|
|
69
|
+
const file = await bundleTsConfig(configFile, isFilePathESM(configFile));
|
|
71
70
|
try {
|
|
72
71
|
return (await import(pathToFileURL(file).href)).default;
|
|
73
72
|
} finally {
|
|
@@ -104,10 +103,8 @@ async function loadConfig(configPath) {
|
|
|
104
103
|
const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
|
|
105
104
|
try {
|
|
106
105
|
if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import(pathToFileURL(configPath).href)).default;
|
|
107
|
-
else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext))
|
|
108
|
-
|
|
109
|
-
return await loadTsConfig(rawConfigPath);
|
|
110
|
-
} else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
|
|
106
|
+
else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return await loadTsConfig(path.resolve(configPath));
|
|
107
|
+
else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
|
|
111
108
|
} catch (err) {
|
|
112
109
|
throw new Error("Error happened while loading config.", { cause: err });
|
|
113
110
|
}
|