rolldown 1.0.0-beta.16 → 1.0.0-beta.17
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.cjs +4 -4
- package/dist/cli.mjs +1040 -1079
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -6
- package/dist/experimental-index.cjs +7 -31
- package/dist/experimental-index.d.cts +2 -2
- package/dist/experimental-index.d.mts +2 -2
- package/dist/experimental-index.mjs +4 -22
- package/dist/filter-index.d.cts +2 -2
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -4
- package/dist/parallel-plugin-worker.cjs +3 -4
- package/dist/parallel-plugin-worker.mjs +27 -34
- package/dist/parallel-plugin.d.cts +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.cts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -2
- package/dist/shared/{binding--Y47JZSL.d.cts → binding-CWvDTpOw.d.mts} +14 -14
- package/dist/shared/{binding-C_9au5Eg.d.mts → binding-um3VI33z.d.cts} +14 -14
- package/dist/shared/{define-config-DMWHsgSt.d.mts → define-config-Cm86JHb7.d.mts} +69 -9
- package/dist/shared/{define-config-CAyC9-af.d.cts → define-config-POPyhxOq.d.cts} +69 -9
- package/dist/shared/{load-config-BniS-jT_.cjs → load-config-B4zzmrcW.cjs} +1 -1
- package/dist/shared/{load-config-BT5Ts430.mjs → load-config-BlOqMlge.mjs} +14 -19
- package/dist/shared/{misc-DGAe2XOW.mjs → misc-BN0nse6C.mjs} +1 -4
- package/dist/shared/parse-ast-index-BpqxVgDm.mjs +616 -0
- package/dist/shared/parse-ast-index-XFcW-g8N.cjs +738 -0
- package/dist/shared/prompt-C5jz26Zn.mjs +852 -0
- package/dist/shared/{src-1lPDqeuR.cjs → src-C98Q0NLX.cjs} +43 -48
- package/dist/shared/{src-Cv4_zurW.mjs → src-CuIbdNSi.mjs} +1135 -1394
- package/package.json +18 -18
- package/dist/shared/chunk--iN_1bjD.mjs +0 -33
- package/dist/shared/parse-ast-index-BHkdbivO.mjs +0 -659
- package/dist/shared/parse-ast-index-hgMnddyI.cjs +0 -701
- package/dist/shared/prompt-CodO769G.mjs +0 -854
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-DDkG_k5U.cjs');
|
|
2
|
-
const require_parse_ast_index = require('./parse-ast-index-
|
|
2
|
+
const require_parse_ast_index = require('./parse-ast-index-XFcW-g8N.cjs');
|
|
3
3
|
const require_misc = require('./misc-BKp5iIef.cjs');
|
|
4
4
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
5
5
|
const node_url = require_chunk.__toESM(require("node:url"));
|
|
@@ -9,14 +9,13 @@ const node_os = require_chunk.__toESM(require("node:os"));
|
|
|
9
9
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
10
10
|
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "1.0.0-beta.
|
|
12
|
+
var version = "1.0.0-beta.17";
|
|
13
13
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/builtin-plugin/utils.ts
|
|
17
|
-
var import_binding$6 = require_chunk.__toESM(require_parse_ast_index.require_binding());
|
|
18
17
|
function makeBuiltinPluginCallable(plugin) {
|
|
19
|
-
let callablePlugin = new
|
|
18
|
+
let callablePlugin = new require_parse_ast_index.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
20
19
|
const wrappedPlugin = plugin;
|
|
21
20
|
for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
|
|
22
21
|
return callablePlugin[key](...args$1);
|
|
@@ -2375,12 +2374,11 @@ function transformModuleInfo(info, option) {
|
|
|
2375
2374
|
|
|
2376
2375
|
//#endregion
|
|
2377
2376
|
//#region src/utils/transform-side-effects.ts
|
|
2378
|
-
var import_binding$5 = require_chunk.__toESM(require_parse_ast_index.require_binding());
|
|
2379
2377
|
function bindingifySideEffects(sideEffects) {
|
|
2380
2378
|
switch (sideEffects) {
|
|
2381
|
-
case true: return
|
|
2382
|
-
case false: return
|
|
2383
|
-
case "no-treeshake": return
|
|
2379
|
+
case true: return require_parse_ast_index.BindingHookSideEffects.True;
|
|
2380
|
+
case false: return require_parse_ast_index.BindingHookSideEffects.False;
|
|
2381
|
+
case "no-treeshake": return require_parse_ast_index.BindingHookSideEffects.NoTreeshake;
|
|
2384
2382
|
case null:
|
|
2385
2383
|
case void 0: return void 0;
|
|
2386
2384
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
@@ -2581,14 +2579,13 @@ function bindingifyRenderChunkFilter(filterOption) {
|
|
|
2581
2579
|
|
|
2582
2580
|
//#endregion
|
|
2583
2581
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
2584
|
-
var import_binding$4 = require_chunk.__toESM(require_parse_ast_index.require_binding());
|
|
2585
2582
|
function bindingifyPluginHookMeta(options) {
|
|
2586
2583
|
return { order: bindingPluginOrder(options.order) };
|
|
2587
2584
|
}
|
|
2588
2585
|
function bindingPluginOrder(order) {
|
|
2589
2586
|
switch (order) {
|
|
2590
|
-
case "post": return
|
|
2591
|
-
case "pre": return
|
|
2587
|
+
case "post": return require_parse_ast_index.BindingPluginOrder.Post;
|
|
2588
|
+
case "pre": return require_parse_ast_index.BindingPluginOrder.Pre;
|
|
2592
2589
|
case null:
|
|
2593
2590
|
case void 0: return void 0;
|
|
2594
2591
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
@@ -3771,7 +3768,6 @@ function isReadonlyArray(input) {
|
|
|
3771
3768
|
|
|
3772
3769
|
//#endregion
|
|
3773
3770
|
//#region src/utils/bindingify-input-options.ts
|
|
3774
|
-
var import_binding$3 = require_chunk.__toESM(require_parse_ast_index.require_binding());
|
|
3775
3771
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
3776
3772
|
const pluginContextData = new PluginContextData();
|
|
3777
3773
|
const plugins = rawPlugins.map((plugin) => {
|
|
@@ -3836,9 +3832,9 @@ function bindingifyHmr(hmr) {
|
|
|
3836
3832
|
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
|
3837
3833
|
switch (attachDebugInfo) {
|
|
3838
3834
|
case void 0: return void 0;
|
|
3839
|
-
case "full": return
|
|
3840
|
-
case "simple": return
|
|
3841
|
-
case "none": return
|
|
3835
|
+
case "full": return require_parse_ast_index.BindingAttachDebugInfo.Full;
|
|
3836
|
+
case "simple": return require_parse_ast_index.BindingAttachDebugInfo.Simple;
|
|
3837
|
+
case "none": return require_parse_ast_index.BindingAttachDebugInfo.None;
|
|
3842
3838
|
}
|
|
3843
3839
|
}
|
|
3844
3840
|
function bindingifyExternal(external) {
|
|
@@ -3896,10 +3892,10 @@ function bindingifyInject(inject) {
|
|
|
3896
3892
|
}
|
|
3897
3893
|
function bindingifyLogLevel(logLevel) {
|
|
3898
3894
|
switch (logLevel) {
|
|
3899
|
-
case "silent": return
|
|
3900
|
-
case "debug": return
|
|
3901
|
-
case "warn": return
|
|
3902
|
-
case "info": return
|
|
3895
|
+
case "silent": return require_parse_ast_index.BindingLogLevel.Silent;
|
|
3896
|
+
case "debug": return require_parse_ast_index.BindingLogLevel.Debug;
|
|
3897
|
+
case "warn": return require_parse_ast_index.BindingLogLevel.Warn;
|
|
3898
|
+
case "info": return require_parse_ast_index.BindingLogLevel.Info;
|
|
3903
3899
|
default: throw new Error(`Unexpected log level: ${logLevel}`);
|
|
3904
3900
|
}
|
|
3905
3901
|
}
|
|
@@ -3916,7 +3912,7 @@ function bindingifyInput(input) {
|
|
|
3916
3912
|
}
|
|
3917
3913
|
function bindingifyJsx(input) {
|
|
3918
3914
|
if (typeof input === "object") {
|
|
3919
|
-
if (input.mode === "preserve") return { jsx:
|
|
3915
|
+
if (input.mode === "preserve") return { jsx: require_parse_ast_index.BindingJsx.Preserve };
|
|
3920
3916
|
const mode = input.mode ?? "automatic";
|
|
3921
3917
|
return { jsxTransform: { jsx: {
|
|
3922
3918
|
runtime: mode,
|
|
@@ -3926,10 +3922,10 @@ function bindingifyJsx(input) {
|
|
|
3926
3922
|
} } };
|
|
3927
3923
|
}
|
|
3928
3924
|
switch (input) {
|
|
3929
|
-
case false: return { jsx:
|
|
3930
|
-
case "react": return { jsx:
|
|
3931
|
-
case "react-jsx": return { jsx:
|
|
3932
|
-
case "preserve": return { jsx:
|
|
3925
|
+
case false: return { jsx: require_parse_ast_index.BindingJsx.Disable };
|
|
3926
|
+
case "react": return { jsx: require_parse_ast_index.BindingJsx.React };
|
|
3927
|
+
case "react-jsx": return { jsx: require_parse_ast_index.BindingJsx.ReactJsx };
|
|
3928
|
+
case "preserve": return { jsx: require_parse_ast_index.BindingJsx.Preserve };
|
|
3933
3929
|
default: return { jsx: void 0 };
|
|
3934
3930
|
}
|
|
3935
3931
|
}
|
|
@@ -4299,7 +4295,6 @@ function composeJsPlugins(plugins) {
|
|
|
4299
4295
|
|
|
4300
4296
|
//#endregion
|
|
4301
4297
|
//#region src/utils/initialize-parallel-plugins.ts
|
|
4302
|
-
var import_binding$2 = require_chunk.__toESM(require_parse_ast_index.require_binding());
|
|
4303
4298
|
async function initializeParallelPlugins(plugins) {
|
|
4304
4299
|
const pluginInfos = [];
|
|
4305
4300
|
for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
|
|
@@ -4312,7 +4307,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
4312
4307
|
}
|
|
4313
4308
|
if (pluginInfos.length <= 0) return void 0;
|
|
4314
4309
|
const count = availableParallelism();
|
|
4315
|
-
const parallelJsPluginRegistry = new
|
|
4310
|
+
const parallelJsPluginRegistry = new require_parse_ast_index.ParallelJsPluginRegistry(count);
|
|
4316
4311
|
const registryId = parallelJsPluginRegistry.id;
|
|
4317
4312
|
const workers = await initializeWorkers(registryId, count, pluginInfos);
|
|
4318
4313
|
const stopWorkers = async () => {
|
|
@@ -4397,17 +4392,16 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4397
4392
|
|
|
4398
4393
|
//#endregion
|
|
4399
4394
|
//#region src/utils/create-bundler.ts
|
|
4400
|
-
var import_binding$1 = require_chunk.__toESM(require_parse_ast_index.require_binding());
|
|
4401
4395
|
let asyncRuntimeShutdown = false;
|
|
4402
|
-
async function
|
|
4396
|
+
async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
|
|
4403
4397
|
const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
|
|
4404
|
-
if (asyncRuntimeShutdown)
|
|
4398
|
+
if (asyncRuntimeShutdown) require_parse_ast_index.startAsyncRuntime();
|
|
4405
4399
|
try {
|
|
4406
4400
|
return {
|
|
4407
|
-
|
|
4401
|
+
impl: bundler.createImpl(option.bundlerOptions),
|
|
4408
4402
|
stopWorkers: option.stopWorkers,
|
|
4409
4403
|
shutdown: () => {
|
|
4410
|
-
|
|
4404
|
+
require_parse_ast_index.shutdownAsyncRuntime();
|
|
4411
4405
|
asyncRuntimeShutdown = true;
|
|
4412
4406
|
}
|
|
4413
4407
|
};
|
|
@@ -4435,47 +4429,49 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
|
4435
4429
|
var RolldownBuild = class {
|
|
4436
4430
|
#inputOptions;
|
|
4437
4431
|
#bundler;
|
|
4432
|
+
#bundlerImpl;
|
|
4438
4433
|
constructor(inputOptions) {
|
|
4439
4434
|
this.#inputOptions = inputOptions;
|
|
4435
|
+
this.#bundler = new require_parse_ast_index.BindingBundler();
|
|
4440
4436
|
}
|
|
4441
4437
|
get closed() {
|
|
4442
|
-
return this.#
|
|
4438
|
+
return this.#bundlerImpl?.impl.closed ?? false;
|
|
4443
4439
|
}
|
|
4444
4440
|
async #getBundlerWithStopWorker(outputOptions, isClose) {
|
|
4445
|
-
if (this.#
|
|
4446
|
-
return this.#
|
|
4441
|
+
if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
|
|
4442
|
+
return this.#bundlerImpl = await createBundlerImpl(this.#bundler, this.#inputOptions, outputOptions, isClose);
|
|
4447
4443
|
}
|
|
4448
4444
|
async generate(outputOptions = {}) {
|
|
4449
4445
|
validateOption("output", outputOptions);
|
|
4450
|
-
const {
|
|
4451
|
-
const output = await
|
|
4446
|
+
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4447
|
+
const output = await impl.generate();
|
|
4452
4448
|
return transformToRollupOutput(output);
|
|
4453
4449
|
}
|
|
4454
4450
|
async write(outputOptions = {}) {
|
|
4455
4451
|
validateOption("output", outputOptions);
|
|
4456
|
-
const {
|
|
4457
|
-
const output = await
|
|
4452
|
+
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4453
|
+
const output = await impl.write();
|
|
4458
4454
|
return transformToRollupOutput(output);
|
|
4459
4455
|
}
|
|
4460
4456
|
async close() {
|
|
4461
|
-
const {
|
|
4457
|
+
const { impl, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
|
|
4462
4458
|
await stopWorkers?.();
|
|
4463
|
-
await
|
|
4459
|
+
await impl.close();
|
|
4464
4460
|
shutdown();
|
|
4465
4461
|
}
|
|
4466
4462
|
async [Symbol.asyncDispose]() {
|
|
4467
4463
|
await this.close();
|
|
4468
4464
|
}
|
|
4469
4465
|
async generateHmrPatch(changedFiles) {
|
|
4470
|
-
const output = await this.#
|
|
4466
|
+
const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
|
|
4471
4467
|
return transformHmrPatchOutput(output);
|
|
4472
4468
|
}
|
|
4473
4469
|
async hmrInvalidate(file, firstInvalidatedBy) {
|
|
4474
|
-
const output = await this.#
|
|
4470
|
+
const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
|
|
4475
4471
|
return transformHmrPatchOutput(output);
|
|
4476
4472
|
}
|
|
4477
4473
|
get watchFiles() {
|
|
4478
|
-
return this.#
|
|
4474
|
+
return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
|
|
4479
4475
|
}
|
|
4480
4476
|
};
|
|
4481
4477
|
|
|
@@ -4575,7 +4571,6 @@ var WatcherEmitter = class {
|
|
|
4575
4571
|
|
|
4576
4572
|
//#endregion
|
|
4577
4573
|
//#region src/api/watch/watcher.ts
|
|
4578
|
-
var import_binding = require_chunk.__toESM(require_parse_ast_index.require_binding());
|
|
4579
4574
|
var Watcher = class {
|
|
4580
4575
|
closed;
|
|
4581
4576
|
inner;
|
|
@@ -4597,7 +4592,7 @@ var Watcher = class {
|
|
|
4597
4592
|
this.closed = true;
|
|
4598
4593
|
for (const stop of this.stopWorkers) await stop?.();
|
|
4599
4594
|
await this.inner.close();
|
|
4600
|
-
|
|
4595
|
+
require_parse_ast_index.shutdownAsyncRuntime();
|
|
4601
4596
|
}
|
|
4602
4597
|
start() {
|
|
4603
4598
|
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
@@ -4610,7 +4605,7 @@ async function createWatcher(emitter, input) {
|
|
|
4610
4605
|
return createBundlerOptions(inputOptions, output, true);
|
|
4611
4606
|
})).flat());
|
|
4612
4607
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4613
|
-
const bindingWatcher = new
|
|
4608
|
+
const bindingWatcher = new require_parse_ast_index.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
|
|
4614
4609
|
const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
|
|
4615
4610
|
watcher.start();
|
|
4616
4611
|
}
|
|
@@ -4698,10 +4693,10 @@ Object.defineProperty(exports, 'composeJsPlugins', {
|
|
|
4698
4693
|
return composeJsPlugins;
|
|
4699
4694
|
}
|
|
4700
4695
|
});
|
|
4701
|
-
Object.defineProperty(exports, '
|
|
4696
|
+
Object.defineProperty(exports, 'createBundlerImpl', {
|
|
4702
4697
|
enumerable: true,
|
|
4703
4698
|
get: function () {
|
|
4704
|
-
return
|
|
4699
|
+
return createBundlerImpl;
|
|
4705
4700
|
}
|
|
4706
4701
|
});
|
|
4707
4702
|
Object.defineProperty(exports, 'defineConfig', {
|