rolldown 1.0.0-beta.43 → 1.0.0-beta.44
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/bin/cli.mjs +1 -0
- package/dist/cli-setup.d.mts +1 -0
- package/dist/cli-setup.mjs +16 -0
- package/dist/cli.mjs +1049 -75
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +5 -4
- package/dist/experimental-index.d.mts +20 -5
- package/dist/experimental-index.mjs +39 -15
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -3
- package/dist/parallel-plugin-worker.mjs +4 -3
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +2 -1
- package/dist/shared/{parse-ast-index-DkUtf7vl.mjs → binding-DkR1uPxc.mjs} +97 -360
- package/dist/shared/{binding-BkaKdpud.d.mts → binding-QBosa6N8.d.mts} +89 -14
- package/dist/shared/{define-config-BGtNx9V_.d.mts → define-config-D9LwN_tW.d.mts} +193 -87
- package/dist/shared/{load-config-CLB1MN5j.mjs → load-config-BwIN-FIB.mjs} +2 -2
- package/dist/shared/{misc-CQeo-AFx.mjs → misc-usdOVIou.mjs} +1 -1
- package/dist/shared/parse-ast-index-Dee9Dv5S.mjs +297 -0
- package/dist/shared/{prompt-B4e-jZUR.mjs → prompt-YGfbLmz5.mjs} +1 -1
- package/dist/shared/{src-DucjDcdj.mjs → src-DY4_vVWu.mjs} +85 -88
- package/package.json +19 -20
- package/dist/shared/logger-B83ocDok.mjs +0 -985
|
@@ -45,13 +45,30 @@ interface CompressOptions {
|
|
|
45
45
|
*/
|
|
46
46
|
dropDebugger?: boolean;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Pass `true` to drop unreferenced functions and variables.
|
|
49
49
|
*
|
|
50
|
-
* Simple direct variable assignments do not count as references unless set to
|
|
50
|
+
* Simple direct variable assignments do not count as references unless set to `keep_assign`.
|
|
51
|
+
* @default true
|
|
51
52
|
*/
|
|
52
|
-
unused?:
|
|
53
|
+
unused?: boolean | 'keep_assign';
|
|
53
54
|
/** Keep function / class names. */
|
|
54
55
|
keepNames?: CompressOptionsKeepNames;
|
|
56
|
+
/**
|
|
57
|
+
* Join consecutive var, let and const statements.
|
|
58
|
+
*
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
joinVars?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Join consecutive simple statements using the comma operator.
|
|
64
|
+
*
|
|
65
|
+
* `a; b` -> `a, b`
|
|
66
|
+
*
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
sequences?: boolean;
|
|
70
|
+
/** Limit the maximum number of iterations for debugging purpose. */
|
|
71
|
+
maxIterations?: number;
|
|
55
72
|
}
|
|
56
73
|
interface CompressOptionsKeepNames {
|
|
57
74
|
/**
|
|
@@ -1224,6 +1241,9 @@ declare class BindingRenderedModule {
|
|
|
1224
1241
|
get code(): string | null;
|
|
1225
1242
|
get renderedExports(): Array<string>;
|
|
1226
1243
|
}
|
|
1244
|
+
declare class BindingUrlResolver {
|
|
1245
|
+
call(url: string, importer?: string): Promise<[string, string | undefined]>;
|
|
1246
|
+
}
|
|
1227
1247
|
declare class BindingWatcherChangeData {
|
|
1228
1248
|
path: string;
|
|
1229
1249
|
kind: string;
|
|
@@ -1236,15 +1256,15 @@ declare class BindingWatcherEvent {
|
|
|
1236
1256
|
bundleErrorData(): BindingBundleErrorEventData;
|
|
1237
1257
|
}
|
|
1238
1258
|
interface BindingAssetPluginConfig {
|
|
1239
|
-
isLib
|
|
1240
|
-
isSsr
|
|
1241
|
-
isWorker
|
|
1242
|
-
urlBase
|
|
1243
|
-
publicDir
|
|
1244
|
-
decodedBase
|
|
1245
|
-
isSkipAssets
|
|
1246
|
-
assetsInclude
|
|
1247
|
-
assetInlineLimit
|
|
1259
|
+
isLib: boolean;
|
|
1260
|
+
isSsr: boolean;
|
|
1261
|
+
isWorker: boolean;
|
|
1262
|
+
urlBase: string;
|
|
1263
|
+
publicDir: string;
|
|
1264
|
+
decodedBase: string;
|
|
1265
|
+
isSkipAssets: boolean;
|
|
1266
|
+
assetsInclude: Array<BindingStringOrRegex>;
|
|
1267
|
+
assetInlineLimit: number | ((file: string, content: Buffer) => boolean | undefined);
|
|
1248
1268
|
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => MaybePromise<VoidNullable<string | BindingRenderBuiltUrlRet>>;
|
|
1249
1269
|
}
|
|
1250
1270
|
interface BindingAssetSource {
|
|
@@ -1257,7 +1277,7 @@ interface BindingBuildImportAnalysisPluginConfig {
|
|
|
1257
1277
|
renderBuiltUrl: boolean;
|
|
1258
1278
|
isRelativeBase: boolean;
|
|
1259
1279
|
}
|
|
1260
|
-
type BindingBuiltinPluginName = 'builtin:alias' | 'builtin:asset' | 'builtin:asset-import-meta-url' | 'builtin:build-import-analysis' | 'builtin:dynamic-import-vars' | 'builtin:import-glob' | 'builtin:isolated-declaration' | 'builtin:json' | 'builtin:load-fallback' | 'builtin:manifest' | 'builtin:module-preload-polyfill' | 'builtin:react-refresh-wrapper' | 'builtin:reporter' | 'builtin:replace' | 'builtin:
|
|
1280
|
+
type BindingBuiltinPluginName = 'builtin:alias' | 'builtin:asset' | 'builtin:asset-import-meta-url' | 'builtin:build-import-analysis' | 'builtin:dynamic-import-vars' | 'builtin:esm-external-require' | 'builtin:import-glob' | 'builtin:isolated-declaration' | 'builtin:json' | 'builtin:load-fallback' | 'builtin:manifest' | 'builtin:module-preload-polyfill' | 'builtin:react-refresh-wrapper' | 'builtin:reporter' | 'builtin:replace' | 'builtin:transform' | 'builtin:vite-css' | 'builtin:vite-css-post' | 'builtin:vite-html' | 'builtin:vite-resolve' | 'builtin:wasm-fallback' | 'builtin:wasm-helper' | 'builtin:web-worker-post';
|
|
1261
1281
|
interface BindingClientHmrUpdate {
|
|
1262
1282
|
clientId: string;
|
|
1263
1283
|
update: BindingHmrUpdate;
|
|
@@ -1322,6 +1342,16 @@ interface BindingJsonPluginConfig {
|
|
|
1322
1342
|
stringify?: BindingJsonPluginStringify;
|
|
1323
1343
|
}
|
|
1324
1344
|
type BindingJsonPluginStringify = boolean | string;
|
|
1345
|
+
interface BindingJsonSourcemap {
|
|
1346
|
+
file?: string;
|
|
1347
|
+
mappings?: string;
|
|
1348
|
+
sourceRoot?: string;
|
|
1349
|
+
sources?: Array<string | undefined | null>;
|
|
1350
|
+
sourcesContent?: Array<string | undefined | null>;
|
|
1351
|
+
names?: Array<string>;
|
|
1352
|
+
debugId?: string;
|
|
1353
|
+
x_google_ignoreList?: Array<number>;
|
|
1354
|
+
}
|
|
1325
1355
|
interface BindingManifestPluginConfig {
|
|
1326
1356
|
root: string;
|
|
1327
1357
|
outPath: string;
|
|
@@ -1373,6 +1403,9 @@ interface BindingReporterPluginConfig {
|
|
|
1373
1403
|
warnLargeChunks: boolean;
|
|
1374
1404
|
reportCompressedSize: boolean;
|
|
1375
1405
|
}
|
|
1406
|
+
interface BindingSourcemap {
|
|
1407
|
+
inner: string | BindingJsonSourcemap;
|
|
1408
|
+
}
|
|
1376
1409
|
interface BindingTransformHookExtraArgs {
|
|
1377
1410
|
moduleType: string;
|
|
1378
1411
|
}
|
|
@@ -1385,6 +1418,48 @@ interface BindingTransformPluginConfig {
|
|
|
1385
1418
|
jsxInject?: string;
|
|
1386
1419
|
transformOptions?: TransformOptions;
|
|
1387
1420
|
}
|
|
1421
|
+
interface BindingViteCssPluginConfig {
|
|
1422
|
+
isLib: boolean;
|
|
1423
|
+
publicDir: string;
|
|
1424
|
+
compileCSS: (url: string, importer: string, resolver: BindingUrlResolver) => Promise<{
|
|
1425
|
+
code: string;
|
|
1426
|
+
map?: BindingSourcemap;
|
|
1427
|
+
modules?: Record<string, string>;
|
|
1428
|
+
deps?: Set<string>;
|
|
1429
|
+
}>;
|
|
1430
|
+
resolveUrl: (url: string, importer?: string) => MaybePromise<string | undefined>;
|
|
1431
|
+
assetInlineLimit: number | ((file: string, content: Buffer) => boolean | undefined);
|
|
1432
|
+
}
|
|
1433
|
+
interface BindingViteCssPostPluginConfig {
|
|
1434
|
+
isLib: boolean;
|
|
1435
|
+
isSsr: boolean;
|
|
1436
|
+
isWorker: boolean;
|
|
1437
|
+
isClient: boolean;
|
|
1438
|
+
cssCodeSplit: boolean;
|
|
1439
|
+
sourcemap: boolean;
|
|
1440
|
+
assetsDir: string;
|
|
1441
|
+
urlBase: string;
|
|
1442
|
+
decodedBase: string;
|
|
1443
|
+
libCssFilename?: string;
|
|
1444
|
+
isLegacy?: () => boolean;
|
|
1445
|
+
cssMinify?: (css: string) => Promise<string>;
|
|
1446
|
+
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => MaybePromise<VoidNullable<string | BindingRenderBuiltUrlRet>>;
|
|
1447
|
+
}
|
|
1448
|
+
interface BindingViteHtmlPluginConfig {
|
|
1449
|
+
isLib: boolean;
|
|
1450
|
+
isSsr: boolean;
|
|
1451
|
+
urlBase: string;
|
|
1452
|
+
publicDir: string;
|
|
1453
|
+
decodedBase: string;
|
|
1454
|
+
cssCodeSplit: boolean;
|
|
1455
|
+
modulePreloadPolyfill: boolean;
|
|
1456
|
+
assetInlineLimit: number | ((file: string, content: Buffer) => boolean | undefined);
|
|
1457
|
+
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => MaybePromise<VoidNullable<string | BindingRenderBuiltUrlRet>>;
|
|
1458
|
+
resolveDependencies?: boolean | ((filename: string, dependencies: string[], context: {
|
|
1459
|
+
hostId: string;
|
|
1460
|
+
hostType: 'html' | 'js';
|
|
1461
|
+
}) => Promise<string[]>);
|
|
1462
|
+
}
|
|
1388
1463
|
interface BindingViteResolvePluginConfig {
|
|
1389
1464
|
resolveOptions: BindingViteResolvePluginResolveOptions;
|
|
1390
1465
|
environmentConsumer: string;
|
|
@@ -1433,4 +1508,4 @@ interface PreRenderedChunk {
|
|
|
1433
1508
|
exports: Array<string>;
|
|
1434
1509
|
}
|
|
1435
1510
|
//#endregion
|
|
1436
|
-
export {
|
|
1511
|
+
export { IsolatedDeclarationsResult as A, TransformResult as B, BindingViteCssPluginConfig as C, BindingWasmHelperPluginConfig as D, BindingViteResolvePluginConfig as E, ParserOptions as F, moduleRunnerTransform as H, PreRenderedChunk as I, ResolveResult as L, MinifyOptions as M, NapiResolveOptions as N, BindingWatcherEvent as O, ParseResult as P, ResolverFactory as R, BindingUrlResolver as S, BindingViteHtmlPluginConfig as T, transform as U, isolatedDeclaration as V, BindingRenderedChunk as _, BindingClientHmrUpdate as a, BindingTransformHookExtraArgs as b, BindingHookResolveIdExtraArgs as c, BindingJsonPluginConfig as d, BindingMagicString as f, BindingRebuildStrategy as g, BindingReactRefreshWrapperPluginConfig as h, BindingBundlerImpl as i, JsxOptions as j, IsolatedDeclarationsOptions as k, BindingImportGlobPluginConfig as l, BindingModulePreloadPolyfillPluginConfig as m, BindingBuildImportAnalysisPluginConfig as n, BindingDynamicImportVarsPluginConfig as o, BindingManifestPluginConfig as p, BindingBuiltinPluginName as r, BindingEsmExternalRequirePluginConfig as s, BindingAssetPluginConfig as t, BindingIsolatedDeclarationPluginConfig as u, BindingReplacePluginConfig as v, BindingViteCssPostPluginConfig as w, BindingTransformPluginConfig as x, BindingReporterPluginConfig as y, TransformOptions as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as ParserOptions, I as PreRenderedChunk, M as MinifyOptions$1, O as BindingWatcherEvent, _ as BindingRenderedChunk, b as BindingTransformHookExtraArgs, c as BindingHookResolveIdExtraArgs, f as BindingMagicString, i as BindingBundlerImpl, j as JsxOptions, r as BindingBuiltinPluginName, z as TransformOptions$1 } from "./binding-QBosa6N8.mjs";
|
|
2
2
|
import { TopLevelFilterExpression } from "@rolldown/pluginutils";
|
|
3
3
|
import { Program } from "@oxc-project/types";
|
|
4
4
|
|
|
@@ -159,6 +159,15 @@ interface GeneratedCodeOptions {
|
|
|
159
159
|
* ```
|
|
160
160
|
*/
|
|
161
161
|
preset?: GeneratedCodePreset;
|
|
162
|
+
/**
|
|
163
|
+
* Whether to add readable names to internal variables for profiling purposes.
|
|
164
|
+
*
|
|
165
|
+
* When enabled, generated code will use descriptive variable names that correspond
|
|
166
|
+
* to the original module names, making it easier to profile and debug the bundled code.
|
|
167
|
+
*
|
|
168
|
+
* @default true when minification is disabled, false when minification is enabled
|
|
169
|
+
*/
|
|
170
|
+
profilerNames?: boolean;
|
|
162
171
|
}
|
|
163
172
|
type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd";
|
|
164
173
|
type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
@@ -541,11 +550,26 @@ interface OutputOptions {
|
|
|
541
550
|
topLevelVar?: boolean;
|
|
542
551
|
/**
|
|
543
552
|
* - Type: `boolean`
|
|
544
|
-
* - Default: `false`
|
|
553
|
+
* - Default: `true` for format `es` or if `output.minify` is `true` or object, `false` otherwise
|
|
545
554
|
*
|
|
546
555
|
* Whether to minify internal exports.
|
|
547
556
|
*/
|
|
548
557
|
minifyInternalExports?: boolean;
|
|
558
|
+
/**
|
|
559
|
+
* - Type: `boolean`
|
|
560
|
+
* - Default: `false`
|
|
561
|
+
*
|
|
562
|
+
* Clean output directory before emitting output.
|
|
563
|
+
*/
|
|
564
|
+
cleanDir?: boolean;
|
|
565
|
+
/** Keep function and class names after bundling.
|
|
566
|
+
*
|
|
567
|
+
* When enabled, the bundler will preserve the original names of functions and classes
|
|
568
|
+
* in the output, which is useful for debugging and error stack traces.
|
|
569
|
+
*
|
|
570
|
+
* @default false
|
|
571
|
+
*/
|
|
572
|
+
keepNames?: boolean;
|
|
549
573
|
}
|
|
550
574
|
//#endregion
|
|
551
575
|
//#region src/api/build.d.ts
|
|
@@ -1039,15 +1063,15 @@ type SequentialPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBund
|
|
|
1039
1063
|
type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
|
|
1040
1064
|
type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
|
|
1041
1065
|
type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
1042
|
-
type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
|
|
1066
|
+
type HookFilterExtension<K$1 extends keyof FunctionPluginHooks> = K$1 extends "transform" ? {
|
|
1043
1067
|
filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>;
|
|
1044
|
-
} : K extends "load" ? {
|
|
1068
|
+
} : K$1 extends "load" ? {
|
|
1045
1069
|
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>;
|
|
1046
|
-
} : K extends "resolveId" ? {
|
|
1070
|
+
} : K$1 extends "resolveId" ? {
|
|
1047
1071
|
filter?: TUnionWithTopLevelFilterExpressionArray<{
|
|
1048
1072
|
id?: GeneralHookFilter<RegExp>;
|
|
1049
1073
|
}>;
|
|
1050
|
-
} : K extends "renderChunk" ? {
|
|
1074
|
+
} : K$1 extends "renderChunk" ? {
|
|
1051
1075
|
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>;
|
|
1052
1076
|
} : {};
|
|
1053
1077
|
type PluginHooks = { [K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
|
|
@@ -1144,9 +1168,114 @@ interface ChecksOptions {
|
|
|
1144
1168
|
preferBuiltinFeature?: boolean;
|
|
1145
1169
|
}
|
|
1146
1170
|
//#endregion
|
|
1171
|
+
//#region src/options/transform-options.d.ts
|
|
1172
|
+
interface TransformOptions extends Omit<TransformOptions$1, "sourceType" | "lang" | "cwd" | "sourcemap" | "define" | "inject" | "jsx"> {
|
|
1173
|
+
/**
|
|
1174
|
+
* Replace global variables or [property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) with the provided values.
|
|
1175
|
+
*
|
|
1176
|
+
* # Examples
|
|
1177
|
+
*
|
|
1178
|
+
* - Replace the global variable `IS_PROD` with `true`
|
|
1179
|
+
*
|
|
1180
|
+
* ```js rolldown.config.js
|
|
1181
|
+
* export default defineConfig({ transform: { define: { IS_PROD: 'true' } } })
|
|
1182
|
+
* ```
|
|
1183
|
+
*
|
|
1184
|
+
* Result:
|
|
1185
|
+
*
|
|
1186
|
+
* ```js
|
|
1187
|
+
* // Input
|
|
1188
|
+
* if (IS_PROD) {
|
|
1189
|
+
* console.log('Production mode')
|
|
1190
|
+
* }
|
|
1191
|
+
*
|
|
1192
|
+
* // After bundling
|
|
1193
|
+
* if (true) {
|
|
1194
|
+
* console.log('Production mode')
|
|
1195
|
+
* }
|
|
1196
|
+
* ```
|
|
1197
|
+
*
|
|
1198
|
+
* - Replace the property accessor `process.env.NODE_ENV` with `'production'`
|
|
1199
|
+
*
|
|
1200
|
+
* ```js rolldown.config.js
|
|
1201
|
+
* export default defineConfig({ transform: { define: { 'process.env.NODE_ENV': "'production'" } } })
|
|
1202
|
+
* ```
|
|
1203
|
+
*
|
|
1204
|
+
* Result:
|
|
1205
|
+
*
|
|
1206
|
+
* ```js
|
|
1207
|
+
* // Input
|
|
1208
|
+
* if (process.env.NODE_ENV === 'production') {
|
|
1209
|
+
* console.log('Production mode')
|
|
1210
|
+
* }
|
|
1211
|
+
*
|
|
1212
|
+
* // After bundling
|
|
1213
|
+
* if ('production' === 'production') {
|
|
1214
|
+
* console.log('Production mode')
|
|
1215
|
+
* }
|
|
1216
|
+
*
|
|
1217
|
+
* ```
|
|
1218
|
+
*/
|
|
1219
|
+
define?: Record<string, string>;
|
|
1220
|
+
/**
|
|
1221
|
+
* Inject import statements on demand.
|
|
1222
|
+
*
|
|
1223
|
+
* The API is aligned with `@rollup/plugin-inject`.
|
|
1224
|
+
*
|
|
1225
|
+
* ## Supported patterns
|
|
1226
|
+
* ```js
|
|
1227
|
+
* {
|
|
1228
|
+
* // import { Promise } from 'es6-promise'
|
|
1229
|
+
* Promise: ['es6-promise', 'Promise'],
|
|
1230
|
+
*
|
|
1231
|
+
* // import { Promise as P } from 'es6-promise'
|
|
1232
|
+
* P: ['es6-promise', 'Promise'],
|
|
1233
|
+
*
|
|
1234
|
+
* // import $ from 'jquery'
|
|
1235
|
+
* $: 'jquery',
|
|
1236
|
+
*
|
|
1237
|
+
* // import * as fs from 'node:fs'
|
|
1238
|
+
* fs: ['node:fs', '*'],
|
|
1239
|
+
*
|
|
1240
|
+
* // Inject shims for property access pattern
|
|
1241
|
+
* 'Object.assign': path.resolve( 'src/helpers/object-assign.js' ),
|
|
1242
|
+
* }
|
|
1243
|
+
* ```
|
|
1244
|
+
*/
|
|
1245
|
+
inject?: Record<string, string | [string, string]>;
|
|
1246
|
+
/**
|
|
1247
|
+
* Remove labeled statements with these label names.
|
|
1248
|
+
*
|
|
1249
|
+
* Labeled statements are JavaScript statements prefixed with a label identifier.
|
|
1250
|
+
* This option allows you to strip specific labeled statements from the output,
|
|
1251
|
+
* which is useful for removing debug-only code in production builds.
|
|
1252
|
+
*
|
|
1253
|
+
* ## Example
|
|
1254
|
+
*
|
|
1255
|
+
* ```js rolldown.config.js
|
|
1256
|
+
* export default defineConfig({ transform: { dropLabels: ['DEBUG', 'DEV'] } })
|
|
1257
|
+
* ```
|
|
1258
|
+
*
|
|
1259
|
+
* Result:
|
|
1260
|
+
*
|
|
1261
|
+
* ```js
|
|
1262
|
+
* // Input
|
|
1263
|
+
* DEBUG: console.log('Debug info');
|
|
1264
|
+
* DEV: {
|
|
1265
|
+
* console.log('Development mode');
|
|
1266
|
+
* }
|
|
1267
|
+
* console.log('Production code');
|
|
1268
|
+
*
|
|
1269
|
+
* // After bundling
|
|
1270
|
+
* console.log('Production code');
|
|
1271
|
+
* ```
|
|
1272
|
+
*/
|
|
1273
|
+
dropLabels?: string[];
|
|
1274
|
+
jsx?: false | "react" | "react-jsx" | "preserve" | JsxOptions;
|
|
1275
|
+
}
|
|
1276
|
+
//#endregion
|
|
1147
1277
|
//#region src/options/input-options.d.ts
|
|
1148
1278
|
type InputOption = string | string[] | Record<string, string>;
|
|
1149
|
-
type OxcTransformOption = Omit<TransformOptions, "sourceType" | "lang" | "cwd" | "sourcemap" | "define" | "inject">;
|
|
1150
1279
|
type ExternalOption = StringOrRegExp | StringOrRegExp[] | ((id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>);
|
|
1151
1280
|
type ModuleTypes = Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css" | "asset">;
|
|
1152
1281
|
interface WatcherOptions {
|
|
@@ -1214,13 +1343,6 @@ type OptimizationOptions = {
|
|
|
1214
1343
|
};
|
|
1215
1344
|
type AttachDebugOptions = "none" | "simple" | "full";
|
|
1216
1345
|
type ChunkModulesOrder = "exec-order" | "module-id";
|
|
1217
|
-
interface RollupJsxOptions {
|
|
1218
|
-
mode?: "classic" | "automatic" | "preserve";
|
|
1219
|
-
factory?: string;
|
|
1220
|
-
fragment?: string;
|
|
1221
|
-
importSource?: string;
|
|
1222
|
-
jsxImportSource?: string;
|
|
1223
|
-
}
|
|
1224
1346
|
interface InputOptions {
|
|
1225
1347
|
input?: InputOption;
|
|
1226
1348
|
plugins?: RolldownPluginOption;
|
|
@@ -1379,97 +1501,67 @@ interface InputOptions {
|
|
|
1379
1501
|
* - Type: `boolean`
|
|
1380
1502
|
* - Default: `false`
|
|
1381
1503
|
*
|
|
1382
|
-
*
|
|
1383
|
-
* for
|
|
1504
|
+
* [MagicString](https://github.com/rich-harris/magic-string) is a JavaScript library commonly used by bundlers
|
|
1505
|
+
* for string manipulation and source map generation. When enabled, rolldown will use a native Rust
|
|
1506
|
+
* implementation of MagicString instead of the JavaScript version, providing significantly better performance
|
|
1507
|
+
* during source map generation and code transformation.
|
|
1508
|
+
*
|
|
1509
|
+
* ## Benefits
|
|
1510
|
+
*
|
|
1511
|
+
* - **Improved Performance**: The native Rust implementation is typically faster than the JavaScript version,
|
|
1512
|
+
* especially for large codebases with extensive source maps.
|
|
1513
|
+
* - **Background Processing**: Source map generation is performed asynchronously in a background thread,
|
|
1514
|
+
* allowing the main bundling process to continue without blocking. This parallel processing can significantly
|
|
1515
|
+
* reduce overall build times when working with JavaScript transform hooks.
|
|
1516
|
+
* - **Better Integration**: Seamless integration with rolldown's native Rust architecture.
|
|
1517
|
+
*
|
|
1518
|
+
* ## Example
|
|
1519
|
+
*
|
|
1520
|
+
* ```js
|
|
1521
|
+
* export default {
|
|
1522
|
+
* experimental: {
|
|
1523
|
+
* nativeMagicString: true
|
|
1524
|
+
* },
|
|
1525
|
+
* output: {
|
|
1526
|
+
* sourcemap: true
|
|
1527
|
+
* }
|
|
1528
|
+
* }
|
|
1529
|
+
* ```
|
|
1530
|
+
*
|
|
1531
|
+
* > [!NOTE]
|
|
1532
|
+
* > This is an experimental feature. While it aims to provide identical behavior to the JavaScript
|
|
1533
|
+
* > implementation, there may be edge cases. Please report any discrepancies you encounter.
|
|
1534
|
+
* > For a complete working example, see [examples/native-magic-string](https://github.com/rolldown/rolldown/tree/main/examples/native-magic-string)
|
|
1384
1535
|
*/
|
|
1385
1536
|
nativeMagicString?: boolean;
|
|
1386
1537
|
};
|
|
1387
1538
|
/**
|
|
1388
1539
|
* Replace global variables or [property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) with the provided values.
|
|
1389
1540
|
*
|
|
1390
|
-
*
|
|
1391
|
-
*
|
|
1392
|
-
* - Replace the global variable `IS_PROD` with `true`
|
|
1393
|
-
*
|
|
1394
|
-
* ```js rolldown.config.js
|
|
1395
|
-
* export default defineConfig({ define: { IS_PROD: 'true' // or JSON.stringify(true) } })
|
|
1396
|
-
* ```
|
|
1397
|
-
*
|
|
1398
|
-
* Result:
|
|
1399
|
-
*
|
|
1400
|
-
* ```js
|
|
1401
|
-
* // Input
|
|
1402
|
-
* if (IS_PROD) {
|
|
1403
|
-
* console.log('Production mode')
|
|
1404
|
-
* }
|
|
1405
|
-
*
|
|
1406
|
-
* // After bundling
|
|
1407
|
-
* if (true) {
|
|
1408
|
-
* console.log('Production mode')
|
|
1409
|
-
* }
|
|
1410
|
-
* ```
|
|
1411
|
-
*
|
|
1412
|
-
* - Replace the property accessor `process.env.NODE_ENV` with `'production'`
|
|
1413
|
-
*
|
|
1414
|
-
* ```js rolldown.config.js
|
|
1415
|
-
* export default defineConfig({ define: { 'process.env.NODE_ENV': "'production'" } })
|
|
1416
|
-
* ```
|
|
1417
|
-
*
|
|
1418
|
-
* Result:
|
|
1419
|
-
*
|
|
1420
|
-
* ```js
|
|
1421
|
-
* // Input
|
|
1422
|
-
* if (process.env.NODE_ENV === 'production') {
|
|
1423
|
-
* console.log('Production mode')
|
|
1424
|
-
* }
|
|
1541
|
+
* @deprecated Use `transform.define` instead. This top-level option will be removed in a future release.
|
|
1425
1542
|
*
|
|
1426
|
-
*
|
|
1427
|
-
* if ('production' === 'production') {
|
|
1428
|
-
* console.log('Production mode')
|
|
1429
|
-
* }
|
|
1430
|
-
*
|
|
1431
|
-
* ```
|
|
1543
|
+
* See `transform.define` for detailed documentation and examples.
|
|
1432
1544
|
*/
|
|
1433
1545
|
define?: Record<string, string>;
|
|
1434
1546
|
/**
|
|
1435
1547
|
* Inject import statements on demand.
|
|
1436
1548
|
*
|
|
1437
|
-
*
|
|
1438
|
-
* ```js
|
|
1439
|
-
* {
|
|
1440
|
-
* // import { Promise } from 'es6-promise'
|
|
1441
|
-
* Promise: ['es6-promise', 'Promise'],
|
|
1442
|
-
*
|
|
1443
|
-
* // import { Promise as P } from 'es6-promise'
|
|
1444
|
-
* P: ['es6-promise', 'Promise'],
|
|
1445
|
-
*
|
|
1446
|
-
* // import $ from 'jquery'
|
|
1447
|
-
* $: 'jquery',
|
|
1448
|
-
*
|
|
1449
|
-
* // import * as fs from 'node:fs'
|
|
1450
|
-
* fs: ['node:fs', '*'],
|
|
1549
|
+
* @deprecated Use `transform.inject` instead. This top-level option will be removed in a future release.
|
|
1451
1550
|
*
|
|
1452
|
-
*
|
|
1453
|
-
* 'Object.assign': path.resolve( 'src/helpers/object-assign.js' ),
|
|
1454
|
-
* }
|
|
1455
|
-
* ```
|
|
1551
|
+
* See `transform.inject` for detailed documentation and examples.
|
|
1456
1552
|
*/
|
|
1457
1553
|
inject?: Record<string, string | [string, string]>;
|
|
1458
|
-
profilerNames?: boolean;
|
|
1459
1554
|
/**
|
|
1460
|
-
*
|
|
1555
|
+
* Whether to add readable names to internal variables for profiling purposes.
|
|
1461
1556
|
*
|
|
1462
|
-
*
|
|
1463
|
-
*
|
|
1557
|
+
* When enabled, generated code will use descriptive variable names that correspond
|
|
1558
|
+
* to the original module names, making it easier to profile and debug the bundled code.
|
|
1464
1559
|
*
|
|
1465
|
-
*
|
|
1466
|
-
* - `"preserve"` disables the JSX transformer, preserving the original JSX syntax in the output.
|
|
1467
|
-
* - `"react"` enables the `classic` JSX transformer.
|
|
1468
|
-
* - `"react-jsx"` enables the `automatic` JSX transformer.
|
|
1560
|
+
* @default true when minification is disabled, false when minification is enabled
|
|
1469
1561
|
*
|
|
1470
|
-
* @
|
|
1562
|
+
* @deprecated Use `output.generatedCode.profilerNames` instead. This top-level option will be removed in a future release.
|
|
1471
1563
|
*/
|
|
1472
|
-
|
|
1564
|
+
profilerNames?: boolean;
|
|
1473
1565
|
/**
|
|
1474
1566
|
* Configure how the code is transformed. This process happens after the `transform` hook.
|
|
1475
1567
|
*
|
|
@@ -1487,9 +1579,23 @@ interface InputOptions {
|
|
|
1487
1579
|
*
|
|
1488
1580
|
* For latest decorators proposal, rolldown is able to bundle them but doesn't support transpiling them yet.
|
|
1489
1581
|
*/
|
|
1490
|
-
transform?:
|
|
1582
|
+
transform?: TransformOptions;
|
|
1491
1583
|
watch?: WatcherOptions | false;
|
|
1584
|
+
/**
|
|
1585
|
+
* Remove labeled statements with these label names.
|
|
1586
|
+
*
|
|
1587
|
+
* @deprecated Use `transform.dropLabels` instead. This top-level option will be removed in a future release.
|
|
1588
|
+
*
|
|
1589
|
+
* See `transform.dropLabels` for detailed documentation and examples.
|
|
1590
|
+
*/
|
|
1492
1591
|
dropLabels?: string[];
|
|
1592
|
+
/**
|
|
1593
|
+
* Keep function and class names after bundling.
|
|
1594
|
+
*
|
|
1595
|
+
* @deprecated Use `output.keepNames` instead. This top-level option will be removed in a future release.
|
|
1596
|
+
*
|
|
1597
|
+
* See `output.keepNames` for detailed documentation.
|
|
1598
|
+
*/
|
|
1493
1599
|
keepNames?: boolean;
|
|
1494
1600
|
checks?: ChecksOptions;
|
|
1495
1601
|
makeAbsoluteExternalsRelative?: MakeAbsoluteExternalsRelative;
|
|
@@ -1529,4 +1635,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
|
|
|
1529
1635
|
declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
|
|
1530
1636
|
declare function defineConfig(config: ConfigExport): ConfigExport;
|
|
1531
1637
|
//#endregion
|
|
1532
|
-
export {
|
|
1638
|
+
export { InternalModuleFormat as $, BuiltinPlugin as A, SourceMap as At, GetModuleInfo as B, ResolveIdResult as C, PartialNull as Ct, SourceDescription as D, RenderedChunk as Dt, RolldownPluginOption as E, OutputChunk as Et, OutputBundle as F, LogOrStringHandler as Ft, PluginContextMeta as G, DefineParallelPluginResult as H, TreeshakingOptions as I, RollupError as It, ModuleTypeFilter as J, GeneralHookFilter as K, TransformPluginContext as L, RollupLog as Lt, ExistingRawSourceMap as M, SourcemapIgnoreListOption as Mt, SourceMapInput as N, LogLevel as Nt, TransformResult as O, RenderedModule as Ot, RolldownOptionsFunction as P, LogLevelOption as Pt, RolldownFsModule as Q, EmittedAsset as R, RollupLogWithString as Rt, ResolveIdExtraOptions as S, MaybePromise as St, RolldownPlugin as T, OutputAsset as Tt, defineParallelPlugin as U, PluginContext as V, MinimalPluginContext as W, RolldownDirectoryEntry as X, BufferEncoding as Y, RolldownFileStats as Z, ModuleType as _, GlobalsFunction as _t, InputOption as a, RolldownWatcher as at, PartialResolvedId as b, OutputOptions as bt, OptimizationOptions as c, rolldown as ct, CustomPluginOptions as d, build as dt, NormalizedOutputOptions as et, FunctionPluginHooks as f, AddonFunction as ft, ModuleOptions as g, GeneratedCodePreset as gt, LoadResult as h, GeneratedCodeOptions as ht, ExternalOption as i, watch as it, VERSION as j, ModuleInfo as jt, withFilter as k, RolldownOutput as kt, WatcherOptions as l, RolldownBuild as lt, ImportKind as m, ChunkingContext as mt, ConfigExport as n, LoggingFunction as nt, InputOptions as o, RolldownWatcherEvent as ot, HookFilterExtension as p, ChunkFileNamesFunction as pt, HookFilter as q, RolldownOptions as r, WarningHandlerWithDefault as rt, ModuleTypes as s, WatchOptions as st, defineConfig as t, NormalizedInputOptions as tt, AsyncPluginHooks as u, BuildOptions as ut, ObjectHook as v, MinifyOptions as vt, ResolvedId as w, StringOrRegExp as wt, Plugin as x, PreRenderedAsset as xt, ParallelPluginHooks as y, ModuleFormat as yt, EmittedFile as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rolldown } from "./src-
|
|
1
|
+
import { a as rolldown } from "./src-DY4_vVWu.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { readdir } from "node:fs/promises";
|
|
@@ -111,4 +111,4 @@ async function loadConfig(configPath) {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
//#endregion
|
|
114
|
-
export { loadConfig };
|
|
114
|
+
export { loadConfig as t };
|
|
@@ -19,4 +19,4 @@ function unsupported(info) {
|
|
|
19
19
|
function noop(..._args) {}
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
|
-
export {
|
|
22
|
+
export { unreachable as a, unimplemented as i, isPromiseLike as n, unsupported as o, noop as r, arraify as t };
|