rolldown 1.0.0-beta.40 → 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 +17 -9
- package/dist/experimental-index.mjs +23 -26
- package/dist/experimental-runtime-types.d.ts +6 -0
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.d.mts +3 -3
- 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-BVXbXhPv.d.mts → binding-CtbNz6TD.d.mts} +29 -22
- package/dist/shared/{define-config-0kfJrpvQ.d.mts → define-config-C9Rp3knL.d.mts} +27 -6
- package/dist/shared/{load-config-BJ274Wsp.mjs → load-config-a7bPxI7K.mjs} +4 -7
- package/dist/shared/{logger-CiCY7ucm.mjs → logger-B83ocDok.mjs} +6 -9
- package/dist/shared/{parse-ast-index-C7EYXjEA.mjs → parse-ast-index-DHblAIjN.mjs} +98 -127
- package/dist/shared/{prompt-D2FxOcB5.mjs → prompt-B4e-jZUR.mjs} +28 -30
- package/dist/shared/{src-BH2eQDD9.mjs → src-CUdyD4rb.mjs} +53 -63
- package/package.json +22 -23
|
@@ -39,28 +39,26 @@ function requireSrc() {
|
|
|
39
39
|
save: `${ESC}7`,
|
|
40
40
|
restore: `${ESC}8`
|
|
41
41
|
};
|
|
42
|
-
const scroll = {
|
|
43
|
-
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
44
|
-
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
45
|
-
};
|
|
46
|
-
const erase = {
|
|
47
|
-
screen: `${CSI}2J`,
|
|
48
|
-
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
49
|
-
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
50
|
-
line: `${CSI}2K`,
|
|
51
|
-
lineEnd: `${CSI}K`,
|
|
52
|
-
lineStart: `${CSI}1K`,
|
|
53
|
-
lines(count) {
|
|
54
|
-
let clear = "";
|
|
55
|
-
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
56
|
-
if (count) clear += cursor.left;
|
|
57
|
-
return clear;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
42
|
src = {
|
|
61
43
|
cursor,
|
|
62
|
-
scroll
|
|
63
|
-
|
|
44
|
+
scroll: {
|
|
45
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
46
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
47
|
+
},
|
|
48
|
+
erase: {
|
|
49
|
+
screen: `${CSI}2J`,
|
|
50
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
51
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
52
|
+
line: `${CSI}2K`,
|
|
53
|
+
lineEnd: `${CSI}K`,
|
|
54
|
+
lineStart: `${CSI}1K`,
|
|
55
|
+
lines(count) {
|
|
56
|
+
let clear = "";
|
|
57
|
+
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
58
|
+
if (count) clear += cursor.left;
|
|
59
|
+
return clear;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
64
62
|
beep
|
|
65
63
|
};
|
|
66
64
|
return src;
|
|
@@ -401,16 +399,16 @@ function G(t, u$1, F$1) {
|
|
|
401
399
|
`).map((e$1) => oD(e$1, u$1, F$1)).join(`
|
|
402
400
|
`);
|
|
403
401
|
}
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
402
|
+
const c = {
|
|
403
|
+
actions: new Set([
|
|
404
|
+
"up",
|
|
405
|
+
"down",
|
|
406
|
+
"left",
|
|
407
|
+
"right",
|
|
408
|
+
"space",
|
|
409
|
+
"enter",
|
|
410
|
+
"cancel"
|
|
411
|
+
]),
|
|
414
412
|
aliases: new Map([
|
|
415
413
|
["k", "up"],
|
|
416
414
|
["j", "down"],
|
|
@@ -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) {
|
|
@@ -1502,6 +1502,18 @@ function omit(schema, keys) {
|
|
|
1502
1502
|
};
|
|
1503
1503
|
}
|
|
1504
1504
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1505
|
+
function partial(schema, keys) {
|
|
1506
|
+
const entries2 = {};
|
|
1507
|
+
for (const key in schema.entries) entries2[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];
|
|
1508
|
+
return {
|
|
1509
|
+
...schema,
|
|
1510
|
+
entries: entries2,
|
|
1511
|
+
get "~standard"() {
|
|
1512
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1505
1517
|
function pipe(...pipe2) {
|
|
1506
1518
|
return {
|
|
1507
1519
|
...pipe2[0],
|
|
@@ -1956,6 +1968,11 @@ const AdvancedChunksSchema = strictObject({
|
|
|
1956
1968
|
maxModuleSize: optional(number())
|
|
1957
1969
|
})))
|
|
1958
1970
|
});
|
|
1971
|
+
const GeneratedCodePresetSchema = union([literal("es5"), literal("es2015")]);
|
|
1972
|
+
const GeneratedCodeOptionsSchema = strictObject({
|
|
1973
|
+
symbols: pipe(optional(boolean()), description("Whether to use Symbol.toStringTag for namespace objects")),
|
|
1974
|
+
preset: GeneratedCodePresetSchema
|
|
1975
|
+
});
|
|
1959
1976
|
const OutputOptionsSchema = strictObject({
|
|
1960
1977
|
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
1961
1978
|
file: pipe(optional(string()), description("Single output file")),
|
|
@@ -2003,6 +2020,7 @@ const OutputOptionsSchema = strictObject({
|
|
|
2003
2020
|
])), description("Minify the bundled file")),
|
|
2004
2021
|
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2005
2022
|
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2023
|
+
generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
|
|
2006
2024
|
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2007
2025
|
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2008
2026
|
manualChunks: optional(pipe(function_(), args(tuple([string(), object({})])), returns(union([string(), nullish(string())])))),
|
|
@@ -2054,6 +2072,7 @@ const OutputCliOptionsSchema = omit(strictObject({
|
|
|
2054
2072
|
const CliOptionsSchema = strictObject({
|
|
2055
2073
|
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2056
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.")),
|
|
2057
2076
|
version: pipe(optional(boolean()), description("Show version number")),
|
|
2058
2077
|
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2059
2078
|
...InputCliOptionsSchema.entries,
|
|
@@ -2121,12 +2140,19 @@ function bindingifySourcemap$1(map) {
|
|
|
2121
2140
|
|
|
2122
2141
|
//#endregion
|
|
2123
2142
|
//#region src/utils/error.ts
|
|
2124
|
-
function
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
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,
|
|
2128
2151
|
stack: void 0
|
|
2129
|
-
})
|
|
2152
|
+
});
|
|
2153
|
+
}
|
|
2154
|
+
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2155
|
+
const errors = rawErrors.map(normalizeBindingError);
|
|
2130
2156
|
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2131
2157
|
for (let i = 0; i < errors.length; i++) {
|
|
2132
2158
|
summary += "\n";
|
|
@@ -2565,7 +2591,7 @@ function bindingifyBuildEnd(args$1) {
|
|
|
2565
2591
|
const { handler, meta } = normalizeHook(hook);
|
|
2566
2592
|
return {
|
|
2567
2593
|
plugin: async (ctx, err) => {
|
|
2568
|
-
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);
|
|
2569
2595
|
},
|
|
2570
2596
|
meta: bindingifyPluginHookMeta(meta)
|
|
2571
2597
|
};
|
|
@@ -2623,7 +2649,8 @@ function bindingifyResolveDynamicImport(args$1) {
|
|
|
2623
2649
|
if (typeof ret === "string") return { id: ret };
|
|
2624
2650
|
const result = {
|
|
2625
2651
|
id: ret.id,
|
|
2626
|
-
external: ret.external
|
|
2652
|
+
external: ret.external,
|
|
2653
|
+
packageJsonPath: ret.packageJsonPath
|
|
2627
2654
|
};
|
|
2628
2655
|
if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
|
|
2629
2656
|
args$1.pluginContextData.updateModuleOption(ret.id, {
|
|
@@ -2865,14 +2892,9 @@ function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
|
2865
2892
|
});
|
|
2866
2893
|
}
|
|
2867
2894
|
function transformToRollupOutput(output, changed) {
|
|
2868
|
-
handleOutputErrors(output);
|
|
2869
2895
|
const { chunks, assets } = output;
|
|
2870
2896
|
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
|
|
2871
2897
|
}
|
|
2872
|
-
function handleOutputErrors(output) {
|
|
2873
|
-
const rawErrors = output.errors;
|
|
2874
|
-
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
2875
|
-
}
|
|
2876
2898
|
function transformToOutputBundle(context, output, changed) {
|
|
2877
2899
|
const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
2878
2900
|
return new Proxy(bundle, {
|
|
@@ -2978,7 +3000,7 @@ function bindingifyRenderError(args$1) {
|
|
|
2978
3000
|
const { handler, meta } = normalizeHook(hook);
|
|
2979
3001
|
return {
|
|
2980
3002
|
plugin: async (ctx, err) => {
|
|
2981
|
-
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));
|
|
2982
3004
|
},
|
|
2983
3005
|
meta: bindingifyPluginHookMeta(meta)
|
|
2984
3006
|
};
|
|
@@ -2994,7 +3016,7 @@ function bindingifyGenerateBundle(args$1) {
|
|
|
2994
3016
|
deleted: /* @__PURE__ */ new Set()
|
|
2995
3017
|
};
|
|
2996
3018
|
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
2997
|
-
const output = transformToOutputBundle(context, bundle, changed);
|
|
3019
|
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
2998
3020
|
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output, isWrite);
|
|
2999
3021
|
return collectChangedBundle(changed, output);
|
|
3000
3022
|
},
|
|
@@ -3012,7 +3034,7 @@ function bindingifyWriteBundle(args$1) {
|
|
|
3012
3034
|
deleted: /* @__PURE__ */ new Set()
|
|
3013
3035
|
};
|
|
3014
3036
|
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);
|
|
3037
|
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
3016
3038
|
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output);
|
|
3017
3039
|
return collectChangedBundle(changed, output);
|
|
3018
3040
|
},
|
|
@@ -3199,7 +3221,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3199
3221
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
|
|
3200
3222
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
|
|
3201
3223
|
let hookUsage = extractHookUsage(plugin).inner();
|
|
3202
|
-
|
|
3224
|
+
return wrapHandlers({
|
|
3203
3225
|
name: plugin.name,
|
|
3204
3226
|
buildStart,
|
|
3205
3227
|
buildStartMeta,
|
|
@@ -3246,8 +3268,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3246
3268
|
closeWatcher,
|
|
3247
3269
|
closeWatcherMeta,
|
|
3248
3270
|
hookUsage
|
|
3249
|
-
};
|
|
3250
|
-
return wrapHandlers(result);
|
|
3271
|
+
});
|
|
3251
3272
|
}
|
|
3252
3273
|
function wrapHandlers(plugin) {
|
|
3253
3274
|
for (const hookName of [
|
|
@@ -3829,7 +3850,7 @@ var ChunkingContextImpl = class {
|
|
|
3829
3850
|
//#endregion
|
|
3830
3851
|
//#region src/utils/bindingify-output-options.ts
|
|
3831
3852
|
function bindingifyOutputOptions(outputOptions) {
|
|
3832
|
-
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
3853
|
+
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
3833
3854
|
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
3834
3855
|
return {
|
|
3835
3856
|
dir,
|
|
@@ -3848,6 +3869,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
3848
3869
|
outro: bindingifyAddon(outro),
|
|
3849
3870
|
extend: outputOptions.extend,
|
|
3850
3871
|
globals,
|
|
3872
|
+
generatedCode,
|
|
3851
3873
|
esModule,
|
|
3852
3874
|
name,
|
|
3853
3875
|
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
@@ -4005,12 +4027,10 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4005
4027
|
let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
|
|
4006
4028
|
const parallelPluginInitResult = await initializeParallelPlugins(plugins);
|
|
4007
4029
|
try {
|
|
4008
|
-
const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4009
|
-
const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
|
|
4010
4030
|
return {
|
|
4011
4031
|
bundlerOptions: {
|
|
4012
|
-
inputOptions:
|
|
4013
|
-
outputOptions:
|
|
4032
|
+
inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode),
|
|
4033
|
+
outputOptions: bindingifyOutputOptions(outputOptions),
|
|
4014
4034
|
parallelPluginsRegistry: parallelPluginInitResult?.registry
|
|
4015
4035
|
},
|
|
4016
4036
|
inputOptions,
|
|
@@ -4023,18 +4043,6 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4023
4043
|
}
|
|
4024
4044
|
}
|
|
4025
4045
|
|
|
4026
|
-
//#endregion
|
|
4027
|
-
//#region src/utils/transform-hmr-patch-output.ts
|
|
4028
|
-
function transformHmrPatchOutput(output) {
|
|
4029
|
-
handleHmrPatchOutputErrors(output);
|
|
4030
|
-
const { patch } = output;
|
|
4031
|
-
return patch ?? void 0;
|
|
4032
|
-
}
|
|
4033
|
-
function handleHmrPatchOutputErrors(output) {
|
|
4034
|
-
const rawErrors = output.errors;
|
|
4035
|
-
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
4036
|
-
}
|
|
4037
|
-
|
|
4038
4046
|
//#endregion
|
|
4039
4047
|
//#region src/api/rolldown/rolldown-build.ts
|
|
4040
4048
|
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
@@ -4070,20 +4078,17 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4070
4078
|
}
|
|
4071
4079
|
async scan() {
|
|
4072
4080
|
const { impl } = await this.#getBundlerWithStopWorker({});
|
|
4073
|
-
|
|
4074
|
-
return handleOutputErrors(output);
|
|
4081
|
+
unwrapBindingResult(await impl.scan());
|
|
4075
4082
|
}
|
|
4076
4083
|
async generate(outputOptions = {}) {
|
|
4077
4084
|
validateOption("output", outputOptions);
|
|
4078
4085
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4079
|
-
|
|
4080
|
-
return transformToRollupOutput(output);
|
|
4086
|
+
return transformToRollupOutput(unwrapBindingResult(await impl.generate()));
|
|
4081
4087
|
}
|
|
4082
4088
|
async write(outputOptions = {}) {
|
|
4083
4089
|
validateOption("output", outputOptions);
|
|
4084
4090
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4085
|
-
|
|
4086
|
-
return transformToRollupOutput(output);
|
|
4091
|
+
return transformToRollupOutput(unwrapBindingResult(await impl.write()));
|
|
4087
4092
|
}
|
|
4088
4093
|
async close() {
|
|
4089
4094
|
if (this.#bundlerImpl) {
|
|
@@ -4096,18 +4101,6 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4096
4101
|
async [Symbol.asyncDispose]() {
|
|
4097
4102
|
await this.close();
|
|
4098
4103
|
}
|
|
4099
|
-
async generateHmrPatch(changedFiles) {
|
|
4100
|
-
const ret = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
|
|
4101
|
-
switch (ret.type) {
|
|
4102
|
-
case "Ok": return ret.field0;
|
|
4103
|
-
case "Error": throw normalizeErrors(ret.field0);
|
|
4104
|
-
default: throw new Error("Unknown error");
|
|
4105
|
-
}
|
|
4106
|
-
}
|
|
4107
|
-
async hmrInvalidate(file, firstInvalidatedBy) {
|
|
4108
|
-
const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
|
|
4109
|
-
return transformHmrPatchOutput(output);
|
|
4110
|
-
}
|
|
4111
4104
|
get watchFiles() {
|
|
4112
4105
|
return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
|
|
4113
4106
|
}
|
|
@@ -4117,8 +4110,7 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4117
4110
|
//#region src/api/rolldown/index.ts
|
|
4118
4111
|
const rolldown = async (input) => {
|
|
4119
4112
|
validateOption("input", input);
|
|
4120
|
-
|
|
4121
|
-
return new RolldownBuild(inputOptions);
|
|
4113
|
+
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
4122
4114
|
};
|
|
4123
4115
|
|
|
4124
4116
|
//#endregion
|
|
@@ -4186,7 +4178,7 @@ var WatcherEmitter = class {
|
|
|
4186
4178
|
const data = event.bundleErrorData();
|
|
4187
4179
|
await listener({
|
|
4188
4180
|
code: "ERROR",
|
|
4189
|
-
error:
|
|
4181
|
+
error: aggregateBindingErrorsIntoJsError(data.error),
|
|
4190
4182
|
result: data.result
|
|
4191
4183
|
});
|
|
4192
4184
|
break;
|
|
@@ -4242,12 +4234,10 @@ var Watcher = class {
|
|
|
4242
4234
|
async function createWatcher(emitter, input) {
|
|
4243
4235
|
const options = arraify(input);
|
|
4244
4236
|
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
4245
|
-
|
|
4246
|
-
return createBundlerOptions(inputOptions, output, true);
|
|
4237
|
+
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
|
|
4247
4238
|
})).flat());
|
|
4248
4239
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4249
|
-
|
|
4250
|
-
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();
|
|
4251
4241
|
}
|
|
4252
4242
|
function getValidNotifyOption(bundlerOptions) {
|
|
4253
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.
|
|
79
|
-
"ansis": "
|
|
80
|
-
"@rolldown/pluginutils": "1.0.0-beta.
|
|
78
|
+
"@oxc-project/types": "=0.94.0",
|
|
79
|
+
"ansis": "=4.2.0",
|
|
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",
|
|
@@ -98,28 +97,28 @@
|
|
|
98
97
|
"source-map": "^0.7.4",
|
|
99
98
|
"tsx": "^4.19.4",
|
|
100
99
|
"typedoc": "^0.28.0",
|
|
101
|
-
"typescript": "^5.
|
|
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 #": "_",
|