rolldown 0.11.1 → 0.12.0
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/cjs/cli.cjs +3 -3
- package/dist/cjs/index.cjs +3 -3
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +3 -3
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{rolldown-dJWM6yRj.mjs → rolldown-A4p6frgO.mjs} +1 -1
- package/dist/shared/{rolldown-Umx4sUze.cjs → rolldown-O94xkf2v.cjs} +1 -1
- package/dist/shared/rolldown-binding.wasi.cjs +12 -12
- package/dist/shared/{utils_index-CMJWXDsM.cjs → utils_index-Lj9DZ_Td.cjs} +10 -5
- package/dist/shared/{utils_index-Xz4uA-99.mjs → utils_index-XrQl8B0a.mjs} +10 -5
- package/dist/types/binding.d.ts +4 -1
- package/dist/types/index.d.ts +4 -5
- package/dist/types/options/bindingify-output-options.d.ts +0 -1
- package/dist/types/options/normalized-output-options.d.ts +3 -3
- package/dist/types/options/output-options.d.ts +4 -4
- package/dist/types/plugin/index.d.ts +43 -40
- package/dist/types/plugin/parallel-plugin.d.ts +9 -0
- package/dist/types/plugin/plugin-driver.d.ts +1 -1
- package/dist/types/types/rolldown-output.d.ts +1 -0
- package/dist/types/types/utils.d.ts +1 -0
- package/dist/types/utils/initialize-parallel-plugins.d.ts +2 -3
- package/package.json +13 -13
- /package/dist/types/plugin/{bindingify-builtin-plugin.d.ts → builtin-plugin.d.ts} +0 -0
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { __commonJSMin, __export, __toESM } = require("../shared/chunk-1xb6WR3y.cjs");
|
|
2
|
-
const { arraify } = require("../shared/utils_index-
|
|
3
|
-
const { rolldown } = require("../shared/rolldown-
|
|
2
|
+
const { arraify } = require("../shared/utils_index-Lj9DZ_Td.cjs");
|
|
3
|
+
const { rolldown } = require("../shared/rolldown-O94xkf2v.cjs");
|
|
4
4
|
const { colors, consola, createConsola } = require("../shared/consola.36c0034f-p4CNcyTx.cjs");
|
|
5
5
|
const { pathToFileURL } = __toESM(require("node:url"));
|
|
6
6
|
const { default: nodePath } = __toESM(require("node:path"));
|
|
@@ -702,7 +702,7 @@ function withTrailingSlash(path) {
|
|
|
702
702
|
|
|
703
703
|
//#endregion
|
|
704
704
|
//#region package.json
|
|
705
|
-
const version = '0.
|
|
705
|
+
const version = '0.12.0';
|
|
706
706
|
const description = 'Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.';
|
|
707
707
|
const keywords = ['webpack', 'parcel', 'esbuild', 'rollup', 'bundler', 'rolldown'];
|
|
708
708
|
const files = ['bin', 'cli', 'dist', '!dist/*.node'];
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __toESM } = require("../shared/chunk-1xb6WR3y.cjs");
|
|
4
|
-
const { BuiltinGlobImportPlugin, BuiltinWasmPlugin, require_binding } = require("../shared/utils_index-
|
|
5
|
-
const { experimental_scan, rolldown } = require("../shared/rolldown-
|
|
4
|
+
const { BuiltinGlobImportPlugin, BuiltinWasmPlugin, require_binding } = require("../shared/utils_index-Lj9DZ_Td.cjs");
|
|
5
|
+
const { experimental_scan, rolldown } = require("../shared/rolldown-O94xkf2v.cjs");
|
|
6
6
|
const { pathToFileURL } = __toESM(require("node:url"));
|
|
7
7
|
|
|
8
|
-
//#region src/plugin/
|
|
8
|
+
//#region src/plugin/parallel-plugin.ts
|
|
9
9
|
function defineParallelPlugin(pluginPath) {
|
|
10
10
|
return (options) => {
|
|
11
11
|
return {_parallel: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __toESM } = require("../shared/chunk-1xb6WR3y.cjs");
|
|
4
|
-
const { bindingifyPlugin, require_binding } = require("../shared/utils_index-
|
|
4
|
+
const { bindingifyPlugin, require_binding } = require("../shared/utils_index-Lj9DZ_Td.cjs");
|
|
5
5
|
const { parentPort, workerData } = __toESM(require("node:worker_threads"));
|
|
6
6
|
|
|
7
7
|
//#region src/parallel-plugin-worker.ts
|
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { __commonJSMin, __export, __toESM, arraify } from "../shared/utils_index-
|
|
4
|
-
import { rolldown } from "../shared/rolldown-
|
|
3
|
+
import { __commonJSMin, __export, __toESM, arraify } from "../shared/utils_index-XrQl8B0a.mjs";
|
|
4
|
+
import { rolldown } from "../shared/rolldown-A4p6frgO.mjs";
|
|
5
5
|
import { colors, consola, createConsola } from "../shared/consola.36c0034f-QyAKDJpW.mjs";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import { default as nodePath } from "node:path";
|
|
@@ -703,7 +703,7 @@ function withTrailingSlash(path) {
|
|
|
703
703
|
|
|
704
704
|
//#endregion
|
|
705
705
|
//#region package.json
|
|
706
|
-
const version = '0.
|
|
706
|
+
const version = '0.12.0';
|
|
707
707
|
const description = 'Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.';
|
|
708
708
|
const keywords = ['webpack', 'parcel', 'esbuild', 'rollup', 'bundler', 'rolldown'];
|
|
709
709
|
const files = ['bin', 'cli', 'dist', '!dist/*.node'];
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { BuiltinGlobImportPlugin, BuiltinWasmPlugin, __toESM, require_binding } from "../shared/utils_index-
|
|
4
|
-
import { experimental_scan, rolldown } from "../shared/rolldown-
|
|
3
|
+
import { BuiltinGlobImportPlugin, BuiltinWasmPlugin, __toESM, require_binding } from "../shared/utils_index-XrQl8B0a.mjs";
|
|
4
|
+
import { experimental_scan, rolldown } from "../shared/rolldown-A4p6frgO.mjs";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
|
|
7
|
-
//#region src/plugin/
|
|
7
|
+
//#region src/plugin/parallel-plugin.ts
|
|
8
8
|
function defineParallelPlugin(pluginPath) {
|
|
9
9
|
return (options) => {
|
|
10
10
|
return {_parallel: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { __toESM, bindingifyPlugin, require_binding } from "../shared/utils_index-
|
|
3
|
+
import { __toESM, bindingifyPlugin, require_binding } from "../shared/utils_index-XrQl8B0a.mjs";
|
|
4
4
|
import { parentPort, workerData } from "node:worker_threads";
|
|
5
5
|
|
|
6
6
|
//#region src/parallel-plugin-worker.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { createBundler, transformToRollupOutput } from "./utils_index-
|
|
3
|
+
import { createBundler, transformToRollupOutput } from "./utils_index-XrQl8B0a.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/rolldown-build.ts
|
|
6
6
|
class RolldownBuild {
|
|
@@ -125,18 +125,18 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
|
125
125
|
__napiInstance.exports['__napi_register__BindingModuleInfo_struct_41']?.()
|
|
126
126
|
__napiInstance.exports['__napi_register__BindingModuleInfo_impl_43']?.()
|
|
127
127
|
__napiInstance.exports['__napi_register__BindingOutputAsset_struct_44']?.()
|
|
128
|
-
__napiInstance.exports['
|
|
129
|
-
__napiInstance.exports['
|
|
130
|
-
__napiInstance.exports['
|
|
131
|
-
__napiInstance.exports['
|
|
132
|
-
__napiInstance.exports['
|
|
133
|
-
__napiInstance.exports['
|
|
134
|
-
__napiInstance.exports['
|
|
135
|
-
__napiInstance.exports['
|
|
136
|
-
__napiInstance.exports['
|
|
137
|
-
__napiInstance.exports['
|
|
138
|
-
__napiInstance.exports['
|
|
139
|
-
__napiInstance.exports['
|
|
128
|
+
__napiInstance.exports['__napi_register__BindingOutputAsset_impl_49']?.()
|
|
129
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_struct_50']?.()
|
|
130
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_impl_68']?.()
|
|
131
|
+
__napiInstance.exports['__napi_register__BindingOutputs_struct_69']?.()
|
|
132
|
+
__napiInstance.exports['__napi_register__BindingOutputs_impl_73']?.()
|
|
133
|
+
__napiInstance.exports['__napi_register__FinalBindingOutputs_struct_74']?.()
|
|
134
|
+
__napiInstance.exports['__napi_register__FinalBindingOutputs_impl_77']?.()
|
|
135
|
+
__napiInstance.exports['__napi_register__RenderedChunk_struct_78']?.()
|
|
136
|
+
__napiInstance.exports['__napi_register__BindingRenderedModule_struct_79']?.()
|
|
137
|
+
__napiInstance.exports['__napi_register__AliasItem_struct_80']?.()
|
|
138
|
+
__napiInstance.exports['__napi_register__BindingSourcemap_struct_81']?.()
|
|
139
|
+
__napiInstance.exports['__napi_register__BindingJSONSourcemap_struct_82']?.()
|
|
140
140
|
}
|
|
141
141
|
module.exports.BindingLog = __napiModule.exports.BindingLog
|
|
142
142
|
module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
@@ -73,7 +73,8 @@ function transformToRollupOutputAsset(asset) {
|
|
|
73
73
|
},
|
|
74
74
|
set source(source) {
|
|
75
75
|
asset.source = bindingAssetSource(source);
|
|
76
|
-
}
|
|
76
|
+
},
|
|
77
|
+
name: asset.name ?? undefined
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
function transformToRollupOutput(output) {
|
|
@@ -1071,7 +1072,7 @@ function bindingifyPlugin(plugin, options, outputOptions) {
|
|
|
1071
1072
|
}
|
|
1072
1073
|
|
|
1073
1074
|
//#endregion
|
|
1074
|
-
//#region src/plugin/
|
|
1075
|
+
//#region src/plugin/builtin-plugin.ts
|
|
1075
1076
|
var import_binding$3 = __toESM(require_binding());
|
|
1076
1077
|
class BuiltinPlugin {
|
|
1077
1078
|
constructor(name, options) {
|
|
@@ -1361,13 +1362,13 @@ class PluginDriver {
|
|
|
1361
1362
|
}
|
|
1362
1363
|
return inputOptions;
|
|
1363
1364
|
}
|
|
1364
|
-
|
|
1365
|
+
callOutputOptionsHook(inputOptions, outputOptions) {
|
|
1365
1366
|
const plugins = getObjectPlugins(inputOptions.plugins);
|
|
1366
1367
|
for (const plugin of plugins) {
|
|
1367
1368
|
const options = plugin.outputOptions;
|
|
1368
1369
|
if (options) {
|
|
1369
1370
|
const [handler, _optionsIgnoredSofar] = normalizeHook(options);
|
|
1370
|
-
const result =
|
|
1371
|
+
const result = handler.call(null, outputOptions);
|
|
1371
1372
|
if (result) {
|
|
1372
1373
|
outputOptions = result;
|
|
1373
1374
|
}
|
|
@@ -1457,6 +1458,9 @@ function getFormat(format) {
|
|
|
1457
1458
|
case 'commonjs': {
|
|
1458
1459
|
return 'cjs';
|
|
1459
1460
|
}
|
|
1461
|
+
case 'iife': {
|
|
1462
|
+
return 'iife';
|
|
1463
|
+
}
|
|
1460
1464
|
default: unimplemented(`output.format: ${format}`);
|
|
1461
1465
|
}
|
|
1462
1466
|
}
|
|
@@ -1478,6 +1482,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
1478
1482
|
switch (format) {
|
|
1479
1483
|
case 'es': return 'es';
|
|
1480
1484
|
case 'cjs': return 'cjs';
|
|
1485
|
+
case 'iife': return 'iife';
|
|
1481
1486
|
}
|
|
1482
1487
|
}(),
|
|
1483
1488
|
exports,
|
|
@@ -1512,7 +1517,7 @@ async function createBundler(inputOptions, outputOptions) {
|
|
|
1512
1517
|
const normalizedInputOptions = await normalizeInputOptions(inputOptions);
|
|
1513
1518
|
const parallelPluginInitResult = await initializeParallelPlugins(normalizedInputOptions.plugins);
|
|
1514
1519
|
try {
|
|
1515
|
-
outputOptions =
|
|
1520
|
+
outputOptions = pluginDriver.callOutputOptionsHook(normalizedInputOptions, outputOptions);
|
|
1516
1521
|
const normalizedOutputOptions = normalizeOutputOptions(outputOptions);
|
|
1517
1522
|
const bindingInputOptions = bindingifyInputOptions(normalizedInputOptions, normalizedOutputOptions);
|
|
1518
1523
|
return {
|
|
@@ -104,7 +104,8 @@ function transformToRollupOutputAsset(asset) {
|
|
|
104
104
|
},
|
|
105
105
|
set source(source) {
|
|
106
106
|
asset.source = bindingAssetSource(source);
|
|
107
|
-
}
|
|
107
|
+
},
|
|
108
|
+
name: asset.name ?? undefined
|
|
108
109
|
};
|
|
109
110
|
}
|
|
110
111
|
function transformToRollupOutput(output) {
|
|
@@ -1102,7 +1103,7 @@ function bindingifyPlugin(plugin, options, outputOptions) {
|
|
|
1102
1103
|
}
|
|
1103
1104
|
|
|
1104
1105
|
//#endregion
|
|
1105
|
-
//#region src/plugin/
|
|
1106
|
+
//#region src/plugin/builtin-plugin.ts
|
|
1106
1107
|
var import_binding$3 = __toESM(require_binding());
|
|
1107
1108
|
class BuiltinPlugin {
|
|
1108
1109
|
constructor(name, options) {
|
|
@@ -1392,13 +1393,13 @@ class PluginDriver {
|
|
|
1392
1393
|
}
|
|
1393
1394
|
return inputOptions;
|
|
1394
1395
|
}
|
|
1395
|
-
|
|
1396
|
+
callOutputOptionsHook(inputOptions, outputOptions) {
|
|
1396
1397
|
const plugins = getObjectPlugins(inputOptions.plugins);
|
|
1397
1398
|
for (const plugin of plugins) {
|
|
1398
1399
|
const options = plugin.outputOptions;
|
|
1399
1400
|
if (options) {
|
|
1400
1401
|
const [handler, _optionsIgnoredSofar] = normalizeHook(options);
|
|
1401
|
-
const result =
|
|
1402
|
+
const result = handler.call(null, outputOptions);
|
|
1402
1403
|
if (result) {
|
|
1403
1404
|
outputOptions = result;
|
|
1404
1405
|
}
|
|
@@ -1488,6 +1489,9 @@ function getFormat(format) {
|
|
|
1488
1489
|
case 'commonjs': {
|
|
1489
1490
|
return 'cjs';
|
|
1490
1491
|
}
|
|
1492
|
+
case 'iife': {
|
|
1493
|
+
return 'iife';
|
|
1494
|
+
}
|
|
1491
1495
|
default: unimplemented(`output.format: ${format}`);
|
|
1492
1496
|
}
|
|
1493
1497
|
}
|
|
@@ -1509,6 +1513,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
1509
1513
|
switch (format) {
|
|
1510
1514
|
case 'es': return 'es';
|
|
1511
1515
|
case 'cjs': return 'cjs';
|
|
1516
|
+
case 'iife': return 'iife';
|
|
1512
1517
|
}
|
|
1513
1518
|
}(),
|
|
1514
1519
|
exports,
|
|
@@ -1543,7 +1548,7 @@ async function createBundler(inputOptions, outputOptions) {
|
|
|
1543
1548
|
const normalizedInputOptions = await normalizeInputOptions(inputOptions);
|
|
1544
1549
|
const parallelPluginInitResult = await initializeParallelPlugins(normalizedInputOptions.plugins);
|
|
1545
1550
|
try {
|
|
1546
|
-
outputOptions =
|
|
1551
|
+
outputOptions = pluginDriver.callOutputOptionsHook(normalizedInputOptions, outputOptions);
|
|
1547
1552
|
const normalizedOutputOptions = normalizeOutputOptions(outputOptions);
|
|
1548
1553
|
const bindingInputOptions = bindingifyInputOptions(normalizedInputOptions, normalizedOutputOptions);
|
|
1549
1554
|
return {
|
package/dist/types/binding.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class BindingOutputAsset {
|
|
|
20
20
|
get fileName(): string
|
|
21
21
|
get source(): BindingAssetSource
|
|
22
22
|
set source(source: BindingAssetSource)
|
|
23
|
+
get name(): string | null
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export declare class BindingOutputChunk {
|
|
@@ -189,7 +190,7 @@ export interface BindingOutputOptions {
|
|
|
189
190
|
dir?: string
|
|
190
191
|
exports?: 'default' | 'named' | 'none' | 'auto'
|
|
191
192
|
footer?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
192
|
-
format?: 'es' | 'cjs'
|
|
193
|
+
format?: 'es' | 'cjs' | 'iife'
|
|
193
194
|
plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[]
|
|
194
195
|
sourcemap?: 'file' | 'inline' | 'hidden'
|
|
195
196
|
sourcemapIgnoreList?: (source: string, sourcemapPath: string) => boolean
|
|
@@ -304,6 +305,8 @@ export declare function transform(filename: string, sourceText: string, options?
|
|
|
304
305
|
|
|
305
306
|
export interface TransformOptions {
|
|
306
307
|
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
|
|
308
|
+
/** Force jsx parsing, */
|
|
309
|
+
jsx?: boolean
|
|
307
310
|
typescript?: TypeScriptBindingOptions
|
|
308
311
|
react?: ReactBindingOptions
|
|
309
312
|
es2015?: Es2015BindingOptions
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,16 +3,15 @@ import type { ExternalOption, InputOption, InputOptions } from './options/input-
|
|
|
3
3
|
import type { ModuleFormat, OutputOptions } from './options/output-options';
|
|
4
4
|
import type { RolldownOptions } from './types/rolldown-options';
|
|
5
5
|
import type { AsyncPluginHooks, CustomPluginOptions, FunctionPluginHooks, ImportKind, LoadResult, ModuleOptions, ObjectHook, ParallelPluginHooks, PartialResolvedId, Plugin, ResolveIdResult, ResolvedId, SourceDescription, TransformResult } from './plugin';
|
|
6
|
-
import { defineParallelPlugin, DefineParallelPluginResult } from './plugin';
|
|
6
|
+
import { defineParallelPlugin, DefineParallelPluginResult } from './plugin/parallel-plugin';
|
|
7
7
|
import { defineConfig } from './utils/define-config';
|
|
8
8
|
import { rolldown, experimental_scan } from './rolldown';
|
|
9
9
|
import { ConfigExport } from './types/config-export';
|
|
10
|
-
import { BuiltinGlobImportPlugin, BuiltinWasmPlugin } from './plugin/
|
|
10
|
+
import { BuiltinGlobImportPlugin, BuiltinWasmPlugin } from './plugin/builtin-plugin';
|
|
11
11
|
import { RolldownBuild } from './rolldown-build';
|
|
12
|
-
import { InternalModuleFormat } from './options/bindingify-output-options';
|
|
13
12
|
import { EmittedAsset, EmittedFile, PluginContext } from './plugin/plugin-context';
|
|
14
13
|
import { TransformPluginContext } from './plugin/transfrom-plugin-context';
|
|
15
|
-
import { NormalizedOutputOptions } from './options/normalized-output-options';
|
|
14
|
+
import { InternalModuleFormat, NormalizedOutputOptions } from './options/normalized-output-options';
|
|
16
15
|
import { RenderedChunk, transform } from './binding';
|
|
17
16
|
import { PartialNull } from './types/utils';
|
|
18
17
|
import { NormalizedInputOptions } from './options/normalized-input-options';
|
|
@@ -21,6 +20,6 @@ import { MinimalPluginContext } from './log/logger';
|
|
|
21
20
|
import { ExistingRawSourceMap, SourceMapInput } from './types/sourcemap';
|
|
22
21
|
import { OutputBundle } from './types/output-bundle';
|
|
23
22
|
export { defineConfig, defineParallelPlugin, rolldown, experimental_scan, transform, BuiltinWasmPlugin, BuiltinGlobImportPlugin, };
|
|
24
|
-
export type { RolldownOutputChunk, RolldownOptions, RolldownOutput, RolldownBuild, InputOptions, NormalizedInputOptions, OutputOptions, NormalizedOutputOptions, Plugin, DefineParallelPluginResult, ConfigExport, ImportKind, InputOption, ExternalOption, ModuleFormat, InternalModuleFormat, LoadResult, TransformResult, ResolveIdResult, PluginContext, TransformPluginContext, ObjectHook, RenderedChunk, SourceMap, SourceDescription, PartialNull, PartialResolvedId, ResolvedId, ModuleOptions, ModuleInfo, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, };
|
|
23
|
+
export type { RolldownOutputAsset, RolldownOutputChunk, RolldownOptions, RolldownOutput, RolldownBuild, InputOptions, NormalizedInputOptions, OutputOptions, NormalizedOutputOptions, Plugin, DefineParallelPluginResult, ConfigExport, ImportKind, InputOption, ExternalOption, ModuleFormat, InternalModuleFormat, LoadResult, TransformResult, ResolveIdResult, PluginContext, TransformPluginContext, ObjectHook, RenderedChunk, SourceMap, SourceDescription, PartialNull, PartialResolvedId, ResolvedId, ModuleOptions, ModuleInfo, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, };
|
|
25
24
|
export type { RolldownOutput as RollupOutput, RolldownOptions as RollupOptions, RolldownBuild as RollupBuild, RolldownOutputChunk as OutputChunk, RolldownOutputAsset as OutputAsset, };
|
|
26
25
|
export type { RollupError, RollupLog, LoggingFunction } from './rollup';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { BindingOutputOptions } from '../binding';
|
|
2
2
|
import type { NormalizedOutputOptions } from './normalized-output-options';
|
|
3
|
-
export type InternalModuleFormat = 'es' | 'cjs';
|
|
4
3
|
export declare function bindingifyOutputOptions(outputOptions: NormalizedOutputOptions): BindingOutputOptions;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../rollup';
|
|
2
2
|
import type { OutputOptions } from './output-options';
|
|
3
|
-
import type {
|
|
3
|
+
import type { RolldownPlugin } from '../plugin';
|
|
4
4
|
import type { RenderedChunk } from '../binding';
|
|
5
|
-
type InternalModuleFormat = 'es' | 'cjs';
|
|
5
|
+
export type InternalModuleFormat = 'es' | 'cjs' | 'iife';
|
|
6
6
|
type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
7
7
|
export interface NormalizedOutputOptions extends OutputOptions {
|
|
8
|
-
plugins:
|
|
8
|
+
plugins: RolldownPlugin[];
|
|
9
9
|
dir: string | undefined;
|
|
10
10
|
format: InternalModuleFormat;
|
|
11
11
|
exports: 'named';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RenderedChunk } from '../binding';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
declare const ModuleFormatSchema: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>>;
|
|
3
|
+
declare const ModuleFormatSchema: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>, z.ZodLiteral<"iife">]>>;
|
|
4
4
|
declare const outputOptionsSchema: z.ZodObject<{
|
|
5
5
|
dir: z.ZodOptional<z.ZodString>;
|
|
6
6
|
exports: z.ZodOptional<z.ZodLiteral<"named">>;
|
|
7
|
-
format: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>>;
|
|
7
|
+
format: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>, z.ZodLiteral<"iife">]>>;
|
|
8
8
|
sourcemap: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"inline">]>, z.ZodLiteral<"hidden">]>>;
|
|
9
9
|
sourcemapIgnoreList: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodType<SourcemapIgnoreListOption, z.ZodTypeDef, SourcemapIgnoreListOption>]>>;
|
|
10
10
|
sourcemapPathTransform: z.ZodOptional<z.ZodType<SourcemapPathTransformOption, z.ZodTypeDef, SourcemapPathTransformOption>>;
|
|
@@ -18,7 +18,7 @@ declare const outputOptionsSchema: z.ZodObject<{
|
|
|
18
18
|
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
19
19
|
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
20
20
|
dir?: string | undefined;
|
|
21
|
-
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | undefined;
|
|
21
|
+
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | undefined;
|
|
22
22
|
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
23
23
|
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
|
|
24
24
|
sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
|
|
@@ -30,7 +30,7 @@ declare const outputOptionsSchema: z.ZodObject<{
|
|
|
30
30
|
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
31
31
|
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
32
32
|
dir?: string | undefined;
|
|
33
|
-
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | undefined;
|
|
33
|
+
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | undefined;
|
|
34
34
|
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
35
35
|
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
|
|
36
36
|
sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BindingHookResolveIdExtraOptions, RenderedChunk } from '../binding';
|
|
2
2
|
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
3
|
-
import type {
|
|
3
|
+
import type { NullValue, MaybePromise, PartialNull, MakeAsync } from '../types/utils';
|
|
4
4
|
import type { SourceMapInput } from '../types/sourcemap';
|
|
5
5
|
import type { ModuleInfo } from '../types/module-info';
|
|
6
6
|
import type { OutputBundle } from '../types/output-bundle';
|
|
@@ -11,11 +11,8 @@ import type { LogLevel } from '../log/logging';
|
|
|
11
11
|
import type { RollupLog } from '../rollup';
|
|
12
12
|
import type { MinimalPluginContext } from '../log/logger';
|
|
13
13
|
import { InputOptions, OutputOptions } from '..';
|
|
14
|
-
import { BuiltinPlugin } from './
|
|
15
|
-
|
|
16
|
-
handler: Handler;
|
|
17
|
-
} & HookOptions;
|
|
18
|
-
export type ObjectHook<Handler extends AnyFn, HookOptions extends AnyObj = AnyObj> = FormalHook<Handler, HookOptions> | Handler;
|
|
14
|
+
import { BuiltinPlugin } from './builtin-plugin';
|
|
15
|
+
import { ParallelPlugin } from './parallel-plugin';
|
|
19
16
|
export type ModuleSideEffects = boolean | 'no-treeshake' | null;
|
|
20
17
|
export type ImportKind = BindingHookResolveIdExtraOptions['kind'];
|
|
21
18
|
export interface CustomPluginOptions {
|
|
@@ -40,47 +37,53 @@ export interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
|
|
|
40
37
|
export type ResolveIdResult = string | NullValue | false | PartialResolvedId;
|
|
41
38
|
export type LoadResult = NullValue | string | SourceDescription;
|
|
42
39
|
export type TransformResult = NullValue | string | Partial<SourceDescription>;
|
|
43
|
-
export interface
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, extraOptions: BindingHookResolveIdExtraOptions) => MaybePromise<ResolveIdResult>>;
|
|
40
|
+
export interface FunctionPluginHooks {
|
|
41
|
+
onLog: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
|
|
42
|
+
options: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
|
|
43
|
+
outputOptions: (this: null, options: OutputOptions) => NullValue | OutputOptions;
|
|
44
|
+
buildStart: (this: PluginContext, options: NormalizedInputOptions) => void;
|
|
45
|
+
resolveId: (this: PluginContext, source: string, importer: string | undefined, extraOptions: BindingHookResolveIdExtraOptions) => ResolveIdResult;
|
|
50
46
|
/**
|
|
51
47
|
* @deprecated
|
|
52
48
|
* This hook is only for rollup plugin compatibility. Please use `resolveId` instead.
|
|
53
49
|
*/
|
|
54
|
-
resolveDynamicImport
|
|
55
|
-
load
|
|
56
|
-
transform
|
|
57
|
-
moduleParsed
|
|
58
|
-
buildEnd
|
|
59
|
-
renderStart
|
|
60
|
-
renderChunk
|
|
50
|
+
resolveDynamicImport: (this: PluginContext, source: string, importer: string | undefined) => ResolveIdResult;
|
|
51
|
+
load: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
|
|
52
|
+
transform: (this: TransformPluginContext, code: string, id: string) => TransformResult;
|
|
53
|
+
moduleParsed: (this: PluginContext, moduleInfo: ModuleInfo) => void;
|
|
54
|
+
buildEnd: (this: PluginContext, err?: Error) => void;
|
|
55
|
+
renderStart: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
|
|
56
|
+
renderChunk: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) => NullValue | string | {
|
|
61
57
|
code: string;
|
|
62
58
|
map?: SourceMapInput;
|
|
63
|
-
}>>;
|
|
64
|
-
augmentChunkHash?: ObjectHook<(this: PluginContext, chunk: RenderedChunk) => MaybePromise<string | void>>;
|
|
65
|
-
renderError?: ObjectHook<(this: PluginContext, error: Error) => MaybePromise<NullValue>>;
|
|
66
|
-
generateBundle?: ObjectHook<(this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => MaybePromise<NullValue>>;
|
|
67
|
-
writeBundle?: ObjectHook<(this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => MaybePromise<NullValue>>;
|
|
68
|
-
}
|
|
69
|
-
export type ParallelPlugin = {
|
|
70
|
-
/** @internal */
|
|
71
|
-
_parallel: {
|
|
72
|
-
fileUrl: string;
|
|
73
|
-
options: unknown;
|
|
74
59
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
export type
|
|
60
|
+
augmentChunkHash: (this: PluginContext, chunk: RenderedChunk) => string | void;
|
|
61
|
+
renderError: (this: PluginContext, error: Error) => void;
|
|
62
|
+
generateBundle: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
|
|
63
|
+
writeBundle: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
|
|
64
|
+
}
|
|
65
|
+
export type ObjectHook<T, O = {}> = T | ({
|
|
66
|
+
handler: T;
|
|
67
|
+
} & O);
|
|
68
|
+
export type SyncPluginHooks = 'augmentChunkHash' | 'onLog' | 'outputOptions';
|
|
81
69
|
export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
|
|
82
|
-
export type FirstPluginHooks = 'load' | 'renderDynamicImport' | 'resolveDynamicImport' | '
|
|
70
|
+
export type FirstPluginHooks = 'load' | 'renderDynamicImport' | 'resolveDynamicImport' | 'resolveId';
|
|
83
71
|
export type SequentialPluginHooks = 'augmentChunkHash' | 'generateBundle' | 'onLog' | 'options' | 'outputOptions' | 'renderChunk' | 'transform';
|
|
84
|
-
export type AddonHooks = '
|
|
72
|
+
export type AddonHooks = '';
|
|
73
|
+
export type OutputPluginHooks = 'augmentChunkHash' | 'generateBundle' | 'outputOptions' | 'renderChunk' | 'renderError' | 'renderStart' | 'writeBundle';
|
|
85
74
|
export type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
86
|
-
export {
|
|
75
|
+
export type PluginHooks = {
|
|
76
|
+
[K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K]>;
|
|
77
|
+
};
|
|
78
|
+
export type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
|
|
79
|
+
export type AddonHook = string | AddonHookFunction;
|
|
80
|
+
export interface OutputPlugin extends Partial<{
|
|
81
|
+
[K in OutputPluginHooks]: PluginHooks[K];
|
|
82
|
+
}>, Partial<{
|
|
83
|
+
[K in AddonHooks]: ObjectHook<AddonHook>;
|
|
84
|
+
}> {
|
|
85
|
+
name?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
|
|
88
|
+
}
|
|
89
|
+
export type RolldownPlugin<A = any> = Plugin<A> | ParallelPlugin | BuiltinPlugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ParallelPlugin = {
|
|
2
|
+
/** @internal */
|
|
3
|
+
_parallel: {
|
|
4
|
+
fileUrl: string;
|
|
5
|
+
options: unknown;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export type DefineParallelPluginResult<Options> = (options: Options) => ParallelPlugin;
|
|
9
|
+
export declare function defineParallelPlugin<Options>(pluginPath: string): DefineParallelPluginResult<Options>;
|
|
@@ -3,6 +3,6 @@ import { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
|
3
3
|
import { InputOptions, OutputOptions } from '..';
|
|
4
4
|
export declare class PluginDriver {
|
|
5
5
|
callOptionsHook(inputOptions: InputOptions): Promise<InputOptions>;
|
|
6
|
-
callOutputOptionsHook(inputOptions: NormalizedInputOptions, outputOptions: OutputOptions):
|
|
6
|
+
callOutputOptionsHook(inputOptions: NormalizedInputOptions, outputOptions: OutputOptions): OutputOptions;
|
|
7
7
|
}
|
|
8
8
|
export declare function getObjectPlugins(plugins: RolldownPlugin[]): Plugin[];
|
|
@@ -8,3 +8,4 @@ export type NullValue<T = void> = T | undefined | null | void;
|
|
|
8
8
|
export type PartialNull<T> = {
|
|
9
9
|
[P in keyof T]: T[P] | null;
|
|
10
10
|
};
|
|
11
|
+
export type MakeAsync<Function_> = Function_ extends (this: infer This, ...parameters: infer Arguments) => infer Return ? (this: This, ...parameters: Arguments) => Return | Promise<Return> : never;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Worker } from 'node:worker_threads';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RolldownPlugin } from '../plugin';
|
|
3
3
|
import { ParallelJsPluginRegistry } from '../binding';
|
|
4
|
-
import { BuiltinPlugin } from '../plugin/bindingify-builtin-plugin';
|
|
5
4
|
export type WorkerData = {
|
|
6
5
|
registryId: number;
|
|
7
6
|
pluginInfos: ParallelPluginInfo[];
|
|
@@ -12,7 +11,7 @@ type ParallelPluginInfo = {
|
|
|
12
11
|
fileUrl: string;
|
|
13
12
|
options: unknown;
|
|
14
13
|
};
|
|
15
|
-
export declare function initializeParallelPlugins(plugins:
|
|
14
|
+
export declare function initializeParallelPlugins(plugins: RolldownPlugin[]): Promise<{
|
|
16
15
|
registry: ParallelJsPluginRegistry;
|
|
17
16
|
stopWorkers: () => Promise<void>;
|
|
18
17
|
} | undefined>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"repository": {
|
|
@@ -94,20 +94,20 @@
|
|
|
94
94
|
"vitest": "^1.6.0",
|
|
95
95
|
"why-is-node-running": "^2.2.2",
|
|
96
96
|
"@rolldown/testing": "0.0.1",
|
|
97
|
-
"rolldown": "0.
|
|
97
|
+
"rolldown": "0.12.0"
|
|
98
98
|
},
|
|
99
99
|
"optionalDependencies": {
|
|
100
|
-
"@rolldown/binding-darwin-
|
|
101
|
-
"@rolldown/binding-
|
|
102
|
-
"@rolldown/binding-
|
|
103
|
-
"@rolldown/binding-linux-arm64-gnu": "0.
|
|
104
|
-
"@rolldown/binding-linux-arm64-musl": "0.
|
|
105
|
-
"@rolldown/binding-linux-x64-
|
|
106
|
-
"@rolldown/binding-
|
|
107
|
-
"@rolldown/binding-
|
|
108
|
-
"@rolldown/binding-win32-arm64-msvc": "0.
|
|
109
|
-
"@rolldown/binding-win32-ia32-msvc": "0.
|
|
110
|
-
"@rolldown/binding-win32-x64-msvc": "0.
|
|
100
|
+
"@rolldown/binding-darwin-arm64": "0.12.0",
|
|
101
|
+
"@rolldown/binding-darwin-x64": "0.12.0",
|
|
102
|
+
"@rolldown/binding-linux-arm-gnueabihf": "0.12.0",
|
|
103
|
+
"@rolldown/binding-linux-arm64-gnu": "0.12.0",
|
|
104
|
+
"@rolldown/binding-linux-arm64-musl": "0.12.0",
|
|
105
|
+
"@rolldown/binding-linux-x64-musl": "0.12.0",
|
|
106
|
+
"@rolldown/binding-linux-x64-gnu": "0.12.0",
|
|
107
|
+
"@rolldown/binding-wasm32-wasi": "0.12.0",
|
|
108
|
+
"@rolldown/binding-win32-arm64-msvc": "0.12.0",
|
|
109
|
+
"@rolldown/binding-win32-ia32-msvc": "0.12.0",
|
|
110
|
+
"@rolldown/binding-win32-x64-msvc": "0.12.0"
|
|
111
111
|
},
|
|
112
112
|
"scripts": {
|
|
113
113
|
"# Scrips for binding #": "_",
|
|
File without changes
|