rolldown 1.0.0-beta.41 → 1.0.0-beta.42
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 +16 -8
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.d.mts +12 -3
- package/dist/experimental-index.mjs +14 -16
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- 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-CtbNz6TD.d.mts} +26 -10
- package/dist/shared/{define-config-BZ_n3PjJ.d.mts → define-config-C9Rp3knL.d.mts} +1 -1
- package/dist/shared/{load-config-DkgIoWHl.mjs → load-config-a7bPxI7K.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-DHblAIjN.mjs} +97 -127
- package/dist/shared/{prompt-R6XhwkxA.mjs → prompt-B4e-jZUR.mjs} +18 -20
- package/dist/shared/{src-DkvlJJsC.mjs → src-CUdyD4rb.mjs} +33 -38
- package/package.json +20 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, initTraceSubscriber, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-
|
|
1
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, initTraceSubscriber, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-DHblAIjN.mjs";
|
|
2
2
|
import { arraify, noop, unimplemented, unreachable, unsupported } from "./misc-CQeo-AFx.mjs";
|
|
3
3
|
import { Worker, isMainThread } from "node:worker_threads";
|
|
4
4
|
import path from "node:path";
|
|
@@ -218,7 +218,7 @@ if (isMainThread) {
|
|
|
218
218
|
|
|
219
219
|
//#endregion
|
|
220
220
|
//#region package.json
|
|
221
|
-
var version = "1.0.0-beta.
|
|
221
|
+
var version = "1.0.0-beta.42";
|
|
222
222
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
223
223
|
|
|
224
224
|
//#endregion
|
|
@@ -565,7 +565,7 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
//#endregion
|
|
568
|
-
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.
|
|
568
|
+
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.3/node_modules/valibot/dist/index.js
|
|
569
569
|
var store;
|
|
570
570
|
/* @__NO_SIDE_EFFECTS__ */
|
|
571
571
|
function getGlobalConfig(config2) {
|
|
@@ -2072,6 +2072,7 @@ const OutputCliOptionsSchema = omit(strictObject({
|
|
|
2072
2072
|
const CliOptionsSchema = strictObject({
|
|
2073
2073
|
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2074
2074
|
help: pipe(optional(boolean()), description("Show help")),
|
|
2075
|
+
environment: pipe(optional(union([string(), array(string())])), description("Pass additional settings to the config file via process.ENV.")),
|
|
2075
2076
|
version: pipe(optional(boolean()), description("Show version number")),
|
|
2076
2077
|
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2077
2078
|
...InputCliOptionsSchema.entries,
|
|
@@ -2139,12 +2140,19 @@ function bindingifySourcemap$1(map) {
|
|
|
2139
2140
|
|
|
2140
2141
|
//#endregion
|
|
2141
2142
|
//#region src/utils/error.ts
|
|
2142
|
-
function
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2143
|
+
function unwrapBindingResult(container) {
|
|
2144
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
2145
|
+
return container;
|
|
2146
|
+
}
|
|
2147
|
+
function normalizeBindingError(e$1) {
|
|
2148
|
+
return e$1.type === "JsError" ? e$1.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2149
|
+
kind: e$1.field0.kind,
|
|
2150
|
+
message: e$1.field0.message,
|
|
2146
2151
|
stack: void 0
|
|
2147
|
-
})
|
|
2152
|
+
});
|
|
2153
|
+
}
|
|
2154
|
+
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2155
|
+
const errors = rawErrors.map(normalizeBindingError);
|
|
2148
2156
|
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2149
2157
|
for (let i = 0; i < errors.length; i++) {
|
|
2150
2158
|
summary += "\n";
|
|
@@ -2583,7 +2591,7 @@ function bindingifyBuildEnd(args$1) {
|
|
|
2583
2591
|
const { handler, meta } = normalizeHook(hook);
|
|
2584
2592
|
return {
|
|
2585
2593
|
plugin: async (ctx, err) => {
|
|
2586
|
-
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ?
|
|
2594
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
|
|
2587
2595
|
},
|
|
2588
2596
|
meta: bindingifyPluginHookMeta(meta)
|
|
2589
2597
|
};
|
|
@@ -2641,7 +2649,8 @@ function bindingifyResolveDynamicImport(args$1) {
|
|
|
2641
2649
|
if (typeof ret === "string") return { id: ret };
|
|
2642
2650
|
const result = {
|
|
2643
2651
|
id: ret.id,
|
|
2644
|
-
external: ret.external
|
|
2652
|
+
external: ret.external,
|
|
2653
|
+
packageJsonPath: ret.packageJsonPath
|
|
2645
2654
|
};
|
|
2646
2655
|
if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
|
|
2647
2656
|
args$1.pluginContextData.updateModuleOption(ret.id, {
|
|
@@ -2883,14 +2892,9 @@ function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
|
2883
2892
|
});
|
|
2884
2893
|
}
|
|
2885
2894
|
function transformToRollupOutput(output, changed) {
|
|
2886
|
-
handleOutputErrors(output);
|
|
2887
2895
|
const { chunks, assets } = output;
|
|
2888
2896
|
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
|
|
2889
2897
|
}
|
|
2890
|
-
function handleOutputErrors(output) {
|
|
2891
|
-
const rawErrors = output.errors;
|
|
2892
|
-
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
2893
|
-
}
|
|
2894
2898
|
function transformToOutputBundle(context, output, changed) {
|
|
2895
2899
|
const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
2896
2900
|
return new Proxy(bundle, {
|
|
@@ -2996,7 +3000,7 @@ function bindingifyRenderError(args$1) {
|
|
|
2996
3000
|
const { handler, meta } = normalizeHook(hook);
|
|
2997
3001
|
return {
|
|
2998
3002
|
plugin: async (ctx, err) => {
|
|
2999
|
-
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode),
|
|
3003
|
+
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), aggregateBindingErrorsIntoJsError(err));
|
|
3000
3004
|
},
|
|
3001
3005
|
meta: bindingifyPluginHookMeta(meta)
|
|
3002
3006
|
};
|
|
@@ -3012,7 +3016,7 @@ function bindingifyGenerateBundle(args$1) {
|
|
|
3012
3016
|
deleted: /* @__PURE__ */ new Set()
|
|
3013
3017
|
};
|
|
3014
3018
|
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3015
|
-
const output = transformToOutputBundle(context, bundle, changed);
|
|
3019
|
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
3016
3020
|
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output, isWrite);
|
|
3017
3021
|
return collectChangedBundle(changed, output);
|
|
3018
3022
|
},
|
|
@@ -3030,7 +3034,7 @@ function bindingifyWriteBundle(args$1) {
|
|
|
3030
3034
|
deleted: /* @__PURE__ */ new Set()
|
|
3031
3035
|
};
|
|
3032
3036
|
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3033
|
-
const output = transformToOutputBundle(context, bundle, changed);
|
|
3037
|
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
3034
3038
|
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output);
|
|
3035
3039
|
return collectChangedBundle(changed, output);
|
|
3036
3040
|
},
|
|
@@ -3217,7 +3221,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3217
3221
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
|
|
3218
3222
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
|
|
3219
3223
|
let hookUsage = extractHookUsage(plugin).inner();
|
|
3220
|
-
|
|
3224
|
+
return wrapHandlers({
|
|
3221
3225
|
name: plugin.name,
|
|
3222
3226
|
buildStart,
|
|
3223
3227
|
buildStartMeta,
|
|
@@ -3264,8 +3268,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3264
3268
|
closeWatcher,
|
|
3265
3269
|
closeWatcherMeta,
|
|
3266
3270
|
hookUsage
|
|
3267
|
-
};
|
|
3268
|
-
return wrapHandlers(result);
|
|
3271
|
+
});
|
|
3269
3272
|
}
|
|
3270
3273
|
function wrapHandlers(plugin) {
|
|
3271
3274
|
for (const hookName of [
|
|
@@ -4024,12 +4027,10 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4024
4027
|
let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
|
|
4025
4028
|
const parallelPluginInitResult = await initializeParallelPlugins(plugins);
|
|
4026
4029
|
try {
|
|
4027
|
-
const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4028
|
-
const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
|
|
4029
4030
|
return {
|
|
4030
4031
|
bundlerOptions: {
|
|
4031
|
-
inputOptions:
|
|
4032
|
-
outputOptions:
|
|
4032
|
+
inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode),
|
|
4033
|
+
outputOptions: bindingifyOutputOptions(outputOptions),
|
|
4033
4034
|
parallelPluginsRegistry: parallelPluginInitResult?.registry
|
|
4034
4035
|
},
|
|
4035
4036
|
inputOptions,
|
|
@@ -4077,20 +4078,17 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4077
4078
|
}
|
|
4078
4079
|
async scan() {
|
|
4079
4080
|
const { impl } = await this.#getBundlerWithStopWorker({});
|
|
4080
|
-
|
|
4081
|
-
return handleOutputErrors(output);
|
|
4081
|
+
unwrapBindingResult(await impl.scan());
|
|
4082
4082
|
}
|
|
4083
4083
|
async generate(outputOptions = {}) {
|
|
4084
4084
|
validateOption("output", outputOptions);
|
|
4085
4085
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4086
|
-
|
|
4087
|
-
return transformToRollupOutput(output);
|
|
4086
|
+
return transformToRollupOutput(unwrapBindingResult(await impl.generate()));
|
|
4088
4087
|
}
|
|
4089
4088
|
async write(outputOptions = {}) {
|
|
4090
4089
|
validateOption("output", outputOptions);
|
|
4091
4090
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4092
|
-
|
|
4093
|
-
return transformToRollupOutput(output);
|
|
4091
|
+
return transformToRollupOutput(unwrapBindingResult(await impl.write()));
|
|
4094
4092
|
}
|
|
4095
4093
|
async close() {
|
|
4096
4094
|
if (this.#bundlerImpl) {
|
|
@@ -4112,8 +4110,7 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4112
4110
|
//#region src/api/rolldown/index.ts
|
|
4113
4111
|
const rolldown = async (input) => {
|
|
4114
4112
|
validateOption("input", input);
|
|
4115
|
-
|
|
4116
|
-
return new RolldownBuild(inputOptions);
|
|
4113
|
+
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
4117
4114
|
};
|
|
4118
4115
|
|
|
4119
4116
|
//#endregion
|
|
@@ -4181,7 +4178,7 @@ var WatcherEmitter = class {
|
|
|
4181
4178
|
const data = event.bundleErrorData();
|
|
4182
4179
|
await listener({
|
|
4183
4180
|
code: "ERROR",
|
|
4184
|
-
error:
|
|
4181
|
+
error: aggregateBindingErrorsIntoJsError(data.error),
|
|
4185
4182
|
result: data.result
|
|
4186
4183
|
});
|
|
4187
4184
|
break;
|
|
@@ -4237,12 +4234,10 @@ var Watcher = class {
|
|
|
4237
4234
|
async function createWatcher(emitter, input) {
|
|
4238
4235
|
const options = arraify(input);
|
|
4239
4236
|
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
4240
|
-
|
|
4241
|
-
return createBundlerOptions(inputOptions, output, true);
|
|
4237
|
+
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
|
|
4242
4238
|
})).flat());
|
|
4243
4239
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4244
|
-
|
|
4245
|
-
new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4240
|
+
new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4246
4241
|
}
|
|
4247
4242
|
function getValidNotifyOption(bundlerOptions) {
|
|
4248
4243
|
let result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.42",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://rolldown.rs/",
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"asyncInit": true
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
-
"dtsHeader": "type MaybePromise<T> = T | Promise<T>\ntype Nullable<T> = T | null | undefined\ntype VoidNullable<T = void> = T | null | undefined | void\nexport type BindingStringOrRegex = string | RegExp\n\n"
|
|
75
|
+
"dtsHeader": "type MaybePromise<T> = T | Promise<T>\ntype Nullable<T> = T | null | undefined\ntype VoidNullable<T = void> = T | null | undefined | void\nexport type BindingStringOrRegex = string | RegExp\ntype BindingResult<T> = { errors: BindingError[], isBindingErrors: boolean } | T\n\n"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@oxc-project/types": "=0.
|
|
78
|
+
"@oxc-project/types": "=0.94.0",
|
|
79
79
|
"ansis": "=4.2.0",
|
|
80
|
-
"@rolldown/pluginutils": "1.0.0-beta.
|
|
80
|
+
"@rolldown/pluginutils": "1.0.0-beta.42"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@napi-rs/cli": "^3.2.0",
|
|
@@ -86,10 +86,9 @@
|
|
|
86
86
|
"@rollup/plugin-json": "^6.1.0",
|
|
87
87
|
"buble": "^0.20.0",
|
|
88
88
|
"consola": "^3.4.2",
|
|
89
|
-
"emnapi": "^1.2.0",
|
|
90
89
|
"execa": "^9.2.0",
|
|
91
90
|
"glob": "^11.0.0",
|
|
92
|
-
"oxc-parser": "=0.
|
|
91
|
+
"oxc-parser": "=0.94.0",
|
|
93
92
|
"pathe": "^2.0.3",
|
|
94
93
|
"remeda": "^2.10.0",
|
|
95
94
|
"rolldown-plugin-dts": "^0.16.0",
|
|
@@ -100,26 +99,26 @@
|
|
|
100
99
|
"typedoc": "^0.28.0",
|
|
101
100
|
"typescript": "^5.8.3",
|
|
102
101
|
"valibot": "1.1.0",
|
|
103
|
-
"rolldown": "1.0.0-beta.
|
|
102
|
+
"rolldown": "1.0.0-beta.42"
|
|
104
103
|
},
|
|
105
104
|
"engines": {
|
|
106
105
|
"node": "^20.19.0 || >=22.12.0"
|
|
107
106
|
},
|
|
108
107
|
"optionalDependencies": {
|
|
109
|
-
"@rolldown/binding-darwin-x64": "1.0.0-beta.
|
|
110
|
-
"@rolldown/binding-win32-x64-msvc": "1.0.0-beta.
|
|
111
|
-
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.
|
|
112
|
-
"@rolldown/binding-linux-x64-musl": "1.0.0-beta.
|
|
113
|
-
"@rolldown/binding-freebsd-x64": "1.0.0-beta.
|
|
114
|
-
"@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.
|
|
115
|
-
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.
|
|
116
|
-
"@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.
|
|
117
|
-
"@rolldown/binding-darwin-arm64": "1.0.0-beta.
|
|
118
|
-
"@rolldown/binding-linux-arm64-musl": "1.0.0-beta.
|
|
119
|
-
"@rolldown/binding-openharmony-arm64": "1.0.0-beta.
|
|
120
|
-
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.
|
|
121
|
-
"@rolldown/binding-android-arm64": "1.0.0-beta.
|
|
122
|
-
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.
|
|
108
|
+
"@rolldown/binding-darwin-x64": "1.0.0-beta.42",
|
|
109
|
+
"@rolldown/binding-win32-x64-msvc": "1.0.0-beta.42",
|
|
110
|
+
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.42",
|
|
111
|
+
"@rolldown/binding-linux-x64-musl": "1.0.0-beta.42",
|
|
112
|
+
"@rolldown/binding-freebsd-x64": "1.0.0-beta.42",
|
|
113
|
+
"@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.42",
|
|
114
|
+
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.42",
|
|
115
|
+
"@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.42",
|
|
116
|
+
"@rolldown/binding-darwin-arm64": "1.0.0-beta.42",
|
|
117
|
+
"@rolldown/binding-linux-arm64-musl": "1.0.0-beta.42",
|
|
118
|
+
"@rolldown/binding-openharmony-arm64": "1.0.0-beta.42",
|
|
119
|
+
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.42",
|
|
120
|
+
"@rolldown/binding-android-arm64": "1.0.0-beta.42",
|
|
121
|
+
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.42"
|
|
123
122
|
},
|
|
124
123
|
"scripts": {
|
|
125
124
|
"# Scrips for binding #": "_",
|