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
|
@@ -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;
|
|
@@ -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, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, initTraceSubscriber, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-DkUtf7vl.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.43";
|
|
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) {
|
|
@@ -1879,7 +1879,8 @@ const InputOptionsSchema = strictObject({
|
|
|
1879
1879
|
chunkImportMap: optional(union([boolean(), object({
|
|
1880
1880
|
baseUrl: optional(string()),
|
|
1881
1881
|
fileName: optional(string())
|
|
1882
|
-
})]))
|
|
1882
|
+
})])),
|
|
1883
|
+
nativeMagicString: optional(boolean())
|
|
1883
1884
|
})),
|
|
1884
1885
|
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
1885
1886
|
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
@@ -1946,6 +1947,7 @@ const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([cust
|
|
|
1946
1947
|
const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
1947
1948
|
const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
1948
1949
|
const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
1950
|
+
const PathsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
1949
1951
|
const AdvancedChunksSchema = strictObject({
|
|
1950
1952
|
includeDependenciesRecursively: optional(boolean()),
|
|
1951
1953
|
minSize: optional(number()),
|
|
@@ -2020,6 +2022,7 @@ const OutputOptionsSchema = strictObject({
|
|
|
2020
2022
|
])), description("Minify the bundled file")),
|
|
2021
2023
|
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2022
2024
|
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2025
|
+
paths: pipe(optional(union([record(string(), string()), PathsFunctionSchema])), description("Maps external module IDs to paths")),
|
|
2023
2026
|
generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
|
|
2024
2027
|
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2025
2028
|
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
@@ -2072,6 +2075,7 @@ const OutputCliOptionsSchema = omit(strictObject({
|
|
|
2072
2075
|
const CliOptionsSchema = strictObject({
|
|
2073
2076
|
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2074
2077
|
help: pipe(optional(boolean()), description("Show help")),
|
|
2078
|
+
environment: pipe(optional(union([string(), array(string())])), description("Pass additional settings to the config file via process.ENV.")),
|
|
2075
2079
|
version: pipe(optional(boolean()), description("Show version number")),
|
|
2076
2080
|
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2077
2081
|
...InputCliOptionsSchema.entries,
|
|
@@ -2139,12 +2143,23 @@ function bindingifySourcemap$1(map) {
|
|
|
2139
2143
|
|
|
2140
2144
|
//#endregion
|
|
2141
2145
|
//#region src/utils/error.ts
|
|
2142
|
-
function
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
+
function unwrapBindingResult(container) {
|
|
2147
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
2148
|
+
return container;
|
|
2149
|
+
}
|
|
2150
|
+
function normalizeBindingResult(container) {
|
|
2151
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
|
2152
|
+
return container;
|
|
2153
|
+
}
|
|
2154
|
+
function normalizeBindingError(e$1) {
|
|
2155
|
+
return e$1.type === "JsError" ? e$1.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2156
|
+
kind: e$1.field0.kind,
|
|
2157
|
+
message: e$1.field0.message,
|
|
2146
2158
|
stack: void 0
|
|
2147
|
-
})
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2161
|
+
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2162
|
+
const errors = rawErrors.map(normalizeBindingError);
|
|
2148
2163
|
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2149
2164
|
for (let i = 0; i < errors.length; i++) {
|
|
2150
2165
|
summary += "\n";
|
|
@@ -2460,7 +2475,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2460
2475
|
this.data.updateModuleOption(id, rawOptions);
|
|
2461
2476
|
let loadPromise = this.data.loadModulePromiseMap.get(id);
|
|
2462
2477
|
if (!loadPromise) {
|
|
2463
|
-
loadPromise = this.context.load(id, options.moduleSideEffects ?? void 0).catch(() => {
|
|
2478
|
+
loadPromise = this.context.load(id, options.moduleSideEffects ?? void 0, options.packageJsonPath ?? void 0).catch(() => {
|
|
2464
2479
|
this.data.loadModulePromiseMap.delete(id);
|
|
2465
2480
|
});
|
|
2466
2481
|
this.data.loadModulePromiseMap.set(id, loadPromise);
|
|
@@ -2562,6 +2577,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2562
2577
|
addWatchFile(id) {
|
|
2563
2578
|
this.inner.addWatchFile(id);
|
|
2564
2579
|
}
|
|
2580
|
+
sendMagicString(s) {
|
|
2581
|
+
this.inner.sendMagicString(s);
|
|
2582
|
+
}
|
|
2565
2583
|
};
|
|
2566
2584
|
|
|
2567
2585
|
//#endregion
|
|
@@ -2583,7 +2601,7 @@ function bindingifyBuildEnd(args$1) {
|
|
|
2583
2601
|
const { handler, meta } = normalizeHook(hook);
|
|
2584
2602
|
return {
|
|
2585
2603
|
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 ?
|
|
2604
|
+
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
2605
|
},
|
|
2588
2606
|
meta: bindingifyPluginHookMeta(meta)
|
|
2589
2607
|
};
|
|
@@ -2641,7 +2659,8 @@ function bindingifyResolveDynamicImport(args$1) {
|
|
|
2641
2659
|
if (typeof ret === "string") return { id: ret };
|
|
2642
2660
|
const result = {
|
|
2643
2661
|
id: ret.id,
|
|
2644
|
-
external: ret.external
|
|
2662
|
+
external: ret.external,
|
|
2663
|
+
packageJsonPath: ret.packageJsonPath
|
|
2645
2664
|
};
|
|
2646
2665
|
if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
|
|
2647
2666
|
args$1.pluginContextData.updateModuleOption(ret.id, {
|
|
@@ -2660,7 +2679,29 @@ function bindingifyTransform(args$1) {
|
|
|
2660
2679
|
const { handler, meta, options } = normalizeHook(hook);
|
|
2661
2680
|
return {
|
|
2662
2681
|
plugin: async (ctx, code, id, meta$1) => {
|
|
2663
|
-
|
|
2682
|
+
Object.defineProperties(meta$1, {
|
|
2683
|
+
magicString: { get() {
|
|
2684
|
+
return new BindingMagicString(code);
|
|
2685
|
+
} },
|
|
2686
|
+
ast: { get() {
|
|
2687
|
+
let lang = "js";
|
|
2688
|
+
switch (meta$1.moduleType) {
|
|
2689
|
+
case "js":
|
|
2690
|
+
case "jsx":
|
|
2691
|
+
case "ts":
|
|
2692
|
+
case "tsx":
|
|
2693
|
+
lang = meta$1.moduleType;
|
|
2694
|
+
break;
|
|
2695
|
+
default: break;
|
|
2696
|
+
}
|
|
2697
|
+
return parseAst(code, {
|
|
2698
|
+
astType: meta$1.moduleType.includes("ts") ? "ts" : "js",
|
|
2699
|
+
lang
|
|
2700
|
+
});
|
|
2701
|
+
} }
|
|
2702
|
+
});
|
|
2703
|
+
const transformCtx = new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id, code, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
2704
|
+
const ret = await handler.call(transformCtx, code, id, meta$1);
|
|
2664
2705
|
if (ret == null) return;
|
|
2665
2706
|
if (typeof ret === "string") return { code: ret };
|
|
2666
2707
|
let moduleOption = args$1.pluginContextData.updateModuleOption(id, {
|
|
@@ -2668,9 +2709,18 @@ function bindingifyTransform(args$1) {
|
|
|
2668
2709
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
2669
2710
|
invalidate: false
|
|
2670
2711
|
});
|
|
2712
|
+
let normalizedCode = void 0;
|
|
2713
|
+
let map = ret.map;
|
|
2714
|
+
if (typeof ret.code === "string") normalizedCode = ret.code;
|
|
2715
|
+
else if (ret.code instanceof BindingMagicString) {
|
|
2716
|
+
let magicString = ret.code;
|
|
2717
|
+
normalizedCode = magicString.toString();
|
|
2718
|
+
let fallbackSourcemap = ctx.sendMagicString(magicString);
|
|
2719
|
+
if (fallbackSourcemap != void 0) map = fallbackSourcemap;
|
|
2720
|
+
}
|
|
2671
2721
|
return {
|
|
2672
|
-
code:
|
|
2673
|
-
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code,
|
|
2722
|
+
code: normalizedCode,
|
|
2723
|
+
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, map)),
|
|
2674
2724
|
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
|
|
2675
2725
|
moduleType: ret.moduleType
|
|
2676
2726
|
};
|
|
@@ -2883,14 +2933,9 @@ function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
|
2883
2933
|
});
|
|
2884
2934
|
}
|
|
2885
2935
|
function transformToRollupOutput(output, changed) {
|
|
2886
|
-
handleOutputErrors(output);
|
|
2887
2936
|
const { chunks, assets } = output;
|
|
2888
2937
|
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
|
|
2889
2938
|
}
|
|
2890
|
-
function handleOutputErrors(output) {
|
|
2891
|
-
const rawErrors = output.errors;
|
|
2892
|
-
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
2893
|
-
}
|
|
2894
2939
|
function transformToOutputBundle(context, output, changed) {
|
|
2895
2940
|
const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
2896
2941
|
return new Proxy(bundle, {
|
|
@@ -2996,7 +3041,7 @@ function bindingifyRenderError(args$1) {
|
|
|
2996
3041
|
const { handler, meta } = normalizeHook(hook);
|
|
2997
3042
|
return {
|
|
2998
3043
|
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),
|
|
3044
|
+
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
3045
|
},
|
|
3001
3046
|
meta: bindingifyPluginHookMeta(meta)
|
|
3002
3047
|
};
|
|
@@ -3012,7 +3057,7 @@ function bindingifyGenerateBundle(args$1) {
|
|
|
3012
3057
|
deleted: /* @__PURE__ */ new Set()
|
|
3013
3058
|
};
|
|
3014
3059
|
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);
|
|
3060
|
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
3016
3061
|
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output, isWrite);
|
|
3017
3062
|
return collectChangedBundle(changed, output);
|
|
3018
3063
|
},
|
|
@@ -3030,7 +3075,7 @@ function bindingifyWriteBundle(args$1) {
|
|
|
3030
3075
|
deleted: /* @__PURE__ */ new Set()
|
|
3031
3076
|
};
|
|
3032
3077
|
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);
|
|
3078
|
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
3034
3079
|
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output);
|
|
3035
3080
|
return collectChangedBundle(changed, output);
|
|
3036
3081
|
},
|
|
@@ -3217,7 +3262,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3217
3262
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
|
|
3218
3263
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
|
|
3219
3264
|
let hookUsage = extractHookUsage(plugin).inner();
|
|
3220
|
-
|
|
3265
|
+
return wrapHandlers({
|
|
3221
3266
|
name: plugin.name,
|
|
3222
3267
|
buildStart,
|
|
3223
3268
|
buildStartMeta,
|
|
@@ -3264,8 +3309,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3264
3309
|
closeWatcher,
|
|
3265
3310
|
closeWatcherMeta,
|
|
3266
3311
|
hookUsage
|
|
3267
|
-
};
|
|
3268
|
-
return wrapHandlers(result);
|
|
3312
|
+
});
|
|
3269
3313
|
}
|
|
3270
3314
|
function wrapHandlers(plugin) {
|
|
3271
3315
|
for (const hookName of [
|
|
@@ -3404,6 +3448,9 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
3404
3448
|
get globals() {
|
|
3405
3449
|
return this.inner.globals || this.outputOptions.globals;
|
|
3406
3450
|
}
|
|
3451
|
+
get paths() {
|
|
3452
|
+
return this.outputOptions.paths;
|
|
3453
|
+
}
|
|
3407
3454
|
get hashCharacters() {
|
|
3408
3455
|
return this.inner.hashCharacters;
|
|
3409
3456
|
}
|
|
@@ -3658,7 +3705,8 @@ function bindingifyExperimental(experimental) {
|
|
|
3658
3705
|
chunkModulesOrder,
|
|
3659
3706
|
chunkImportMap: experimental?.chunkImportMap,
|
|
3660
3707
|
onDemandWrapping: experimental?.onDemandWrapping,
|
|
3661
|
-
incrementalBuild: experimental?.incrementalBuild
|
|
3708
|
+
incrementalBuild: experimental?.incrementalBuild,
|
|
3709
|
+
nativeMagicString: experimental?.nativeMagicString
|
|
3662
3710
|
};
|
|
3663
3711
|
}
|
|
3664
3712
|
function bindingifyResolve(resolve) {
|
|
@@ -3847,7 +3895,7 @@ var ChunkingContextImpl = class {
|
|
|
3847
3895
|
//#endregion
|
|
3848
3896
|
//#region src/utils/bindingify-output-options.ts
|
|
3849
3897
|
function bindingifyOutputOptions(outputOptions) {
|
|
3850
|
-
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;
|
|
3898
|
+
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
3851
3899
|
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
3852
3900
|
return {
|
|
3853
3901
|
dir,
|
|
@@ -3866,6 +3914,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
3866
3914
|
outro: bindingifyAddon(outro),
|
|
3867
3915
|
extend: outputOptions.extend,
|
|
3868
3916
|
globals,
|
|
3917
|
+
paths,
|
|
3869
3918
|
generatedCode,
|
|
3870
3919
|
esModule,
|
|
3871
3920
|
name,
|
|
@@ -4024,12 +4073,10 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4024
4073
|
let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
|
|
4025
4074
|
const parallelPluginInitResult = await initializeParallelPlugins(plugins);
|
|
4026
4075
|
try {
|
|
4027
|
-
const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4028
|
-
const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
|
|
4029
4076
|
return {
|
|
4030
4077
|
bundlerOptions: {
|
|
4031
|
-
inputOptions:
|
|
4032
|
-
outputOptions:
|
|
4078
|
+
inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode),
|
|
4079
|
+
outputOptions: bindingifyOutputOptions(outputOptions),
|
|
4033
4080
|
parallelPluginsRegistry: parallelPluginInitResult?.registry
|
|
4034
4081
|
},
|
|
4035
4082
|
inputOptions,
|
|
@@ -4077,20 +4124,17 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4077
4124
|
}
|
|
4078
4125
|
async scan() {
|
|
4079
4126
|
const { impl } = await this.#getBundlerWithStopWorker({});
|
|
4080
|
-
|
|
4081
|
-
return handleOutputErrors(output);
|
|
4127
|
+
unwrapBindingResult(await impl.scan());
|
|
4082
4128
|
}
|
|
4083
4129
|
async generate(outputOptions = {}) {
|
|
4084
4130
|
validateOption("output", outputOptions);
|
|
4085
4131
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4086
|
-
|
|
4087
|
-
return transformToRollupOutput(output);
|
|
4132
|
+
return transformToRollupOutput(unwrapBindingResult(await impl.generate()));
|
|
4088
4133
|
}
|
|
4089
4134
|
async write(outputOptions = {}) {
|
|
4090
4135
|
validateOption("output", outputOptions);
|
|
4091
4136
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4092
|
-
|
|
4093
|
-
return transformToRollupOutput(output);
|
|
4137
|
+
return transformToRollupOutput(unwrapBindingResult(await impl.write()));
|
|
4094
4138
|
}
|
|
4095
4139
|
async close() {
|
|
4096
4140
|
if (this.#bundlerImpl) {
|
|
@@ -4112,8 +4156,7 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4112
4156
|
//#region src/api/rolldown/index.ts
|
|
4113
4157
|
const rolldown = async (input) => {
|
|
4114
4158
|
validateOption("input", input);
|
|
4115
|
-
|
|
4116
|
-
return new RolldownBuild(inputOptions);
|
|
4159
|
+
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
4117
4160
|
};
|
|
4118
4161
|
|
|
4119
4162
|
//#endregion
|
|
@@ -4181,7 +4224,7 @@ var WatcherEmitter = class {
|
|
|
4181
4224
|
const data = event.bundleErrorData();
|
|
4182
4225
|
await listener({
|
|
4183
4226
|
code: "ERROR",
|
|
4184
|
-
error:
|
|
4227
|
+
error: aggregateBindingErrorsIntoJsError(data.error),
|
|
4185
4228
|
result: data.result
|
|
4186
4229
|
});
|
|
4187
4230
|
break;
|
|
@@ -4237,12 +4280,10 @@ var Watcher = class {
|
|
|
4237
4280
|
async function createWatcher(emitter, input) {
|
|
4238
4281
|
const options = arraify(input);
|
|
4239
4282
|
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
4240
|
-
|
|
4241
|
-
return createBundlerOptions(inputOptions, output, true);
|
|
4283
|
+
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
|
|
4242
4284
|
})).flat());
|
|
4243
4285
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4244
|
-
|
|
4245
|
-
new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4286
|
+
new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4246
4287
|
}
|
|
4247
4288
|
function getValidNotifyOption(bundlerOptions) {
|
|
4248
4289
|
let result;
|
|
@@ -4274,4 +4315,4 @@ function defineConfig(config) {
|
|
|
4274
4315
|
const VERSION = version;
|
|
4275
4316
|
|
|
4276
4317
|
//#endregion
|
|
4277
|
-
export { BuiltinPlugin, PluginContextData, PluginDriver, RolldownBuild, VERSION, bindingifyPlugin, build, createBundlerOptions, defineConfig, description$1 as description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, makeBuiltinPluginCallable, normalizedStringOrRegex, onExit, rolldown, validateCliOptions, version, watch };
|
|
4318
|
+
export { BuiltinPlugin, PluginContextData, PluginDriver, RolldownBuild, VERSION, bindingifyPlugin, build, createBundlerOptions, defineConfig, description$1 as description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, makeBuiltinPluginCallable, normalizeBindingResult, normalizedStringOrRegex, onExit, rolldown, validateCliOptions, version, watch };
|
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.43",
|
|
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.43"
|
|
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.43"
|
|
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.43",
|
|
109
|
+
"@rolldown/binding-win32-x64-msvc": "1.0.0-beta.43",
|
|
110
|
+
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.43",
|
|
111
|
+
"@rolldown/binding-linux-x64-musl": "1.0.0-beta.43",
|
|
112
|
+
"@rolldown/binding-freebsd-x64": "1.0.0-beta.43",
|
|
113
|
+
"@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.43",
|
|
114
|
+
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.43",
|
|
115
|
+
"@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.43",
|
|
116
|
+
"@rolldown/binding-darwin-arm64": "1.0.0-beta.43",
|
|
117
|
+
"@rolldown/binding-linux-arm64-musl": "1.0.0-beta.43",
|
|
118
|
+
"@rolldown/binding-openharmony-arm64": "1.0.0-beta.43",
|
|
119
|
+
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.43",
|
|
120
|
+
"@rolldown/binding-android-arm64": "1.0.0-beta.43",
|
|
121
|
+
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.43"
|
|
123
122
|
},
|
|
124
123
|
"scripts": {
|
|
125
124
|
"# Scrips for binding #": "_",
|