@rolldown/browser 1.0.0-beta.32 → 1.0.0-beta.34
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 +5 -5
- package/dist/cli.mjs +5 -5
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.browser.mjs +34 -3
- package/dist/experimental-index.cjs +36 -2
- package/dist/experimental-index.d.cts +36 -4
- package/dist/experimental-index.d.mts +36 -4
- package/dist/experimental-index.mjs +35 -4
- package/dist/filter-index.d.cts +2 -2
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.browser.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.cjs +2 -2
- package/dist/parallel-plugin-worker.mjs +2 -2
- 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 -1
- package/dist/rolldown-binding.wasi-browser.js +3 -0
- package/dist/rolldown-binding.wasi.cjs +3 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-BEeJNtY4.d.mts → binding-9k0egz6L.d.mts} +110 -10
- package/dist/shared/{binding-CRMJJtol.d.cts → binding-D13M6Llu.d.cts} +110 -10
- package/dist/shared/{define-config-Dw9PP95x.d.cts → define-config-D5AluabE.d.cts} +69 -24
- package/dist/shared/{define-config-rQzrgjTj.d.mts → define-config-DzIQxNqU.d.mts} +69 -24
- package/dist/shared/{load-config-Dv1HB87g.mjs → load-config--VYNOtUY.mjs} +1 -1
- package/dist/shared/{load-config-Df5heSrD.cjs → load-config-DfHD1OI9.cjs} +1 -1
- package/dist/shared/{parse-ast-index-CqHkFxPM.mjs → parse-ast-index-C_CZT4St.mjs} +1 -1
- package/dist/shared/{parse-ast-index-DAsDnaa1.cjs → parse-ast-index-ChWj_C49.cjs} +1 -1
- package/dist/shared/{src-ZwxjvPpL.mjs → src-B4V64IkU.mjs} +114 -95
- package/dist/shared/{src-BDMOiU9t.cjs → src-McCMqGpa.cjs} +125 -94
- package/dist/{src-ZTshMqyf.js → src-Bl12Y5ab.js} +111 -92
- package/package.json +19 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHmrUpdate, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-9k0egz6L.mjs";
|
|
2
2
|
import { Program } from "@oxc-project/types";
|
|
3
3
|
import { TopLevelFilterExpression } from "@rolldown/pluginutils";
|
|
4
4
|
|
|
@@ -150,7 +150,7 @@ interface PreRenderedAsset {
|
|
|
150
150
|
}
|
|
151
151
|
type AssetFileNamesFunction = (chunkInfo: PreRenderedAsset) => string;
|
|
152
152
|
type GlobalsFunction = (name: string) => string;
|
|
153
|
-
type MinifyOptions =
|
|
153
|
+
type MinifyOptions = Omit<MinifyOptions$1, "module" | "codegen" | "sorucemap">;
|
|
154
154
|
interface ChunkingContext {
|
|
155
155
|
getModuleInfo(moduleId: string): ModuleInfo | null;
|
|
156
156
|
}
|
|
@@ -186,6 +186,16 @@ interface OutputOptions {
|
|
|
186
186
|
cssEntryFileNames?: string | ChunkFileNamesFunction;
|
|
187
187
|
cssChunkFileNames?: string | ChunkFileNamesFunction;
|
|
188
188
|
sanitizeFileName?: boolean | ((name: string) => string);
|
|
189
|
+
/**
|
|
190
|
+
* Control code minification.
|
|
191
|
+
*
|
|
192
|
+
* - `true`: Enable full minification including code compression and dead code elimination
|
|
193
|
+
* - `false`: Disable minification (default)
|
|
194
|
+
* - `'dce-only'`: Only perform dead code elimination without code compression
|
|
195
|
+
* - `MinifyOptions`: Fine-grained control over minification settings
|
|
196
|
+
*
|
|
197
|
+
* @default false
|
|
198
|
+
*/
|
|
189
199
|
minify?: boolean | "dce-only" | MinifyOptions;
|
|
190
200
|
name?: string;
|
|
191
201
|
globals?: Record<string, string> | GlobalsFunction;
|
|
@@ -543,6 +553,7 @@ interface NormalizedInputOptions {
|
|
|
543
553
|
cwd: string | undefined;
|
|
544
554
|
platform: InputOptions["platform"];
|
|
545
555
|
shimMissingExports: boolean;
|
|
556
|
+
context: string;
|
|
546
557
|
}
|
|
547
558
|
//#endregion
|
|
548
559
|
//#region src/options/normalized-output-options.d.ts
|
|
@@ -573,7 +584,7 @@ interface NormalizedOutputOptions {
|
|
|
573
584
|
sourcemapDebugIds: boolean;
|
|
574
585
|
sourcemapIgnoreList: SourcemapIgnoreListOption;
|
|
575
586
|
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
|
|
576
|
-
minify: false |
|
|
587
|
+
minify: false | MinifyOptions | "dce-only";
|
|
577
588
|
legalComments: "none" | "inline";
|
|
578
589
|
polyfillRequire: boolean;
|
|
579
590
|
plugins: RolldownPlugin[];
|
|
@@ -805,30 +816,12 @@ type SourceMapInput = ExistingRawSourceMap | string | null;
|
|
|
805
816
|
//#region src/index.d.ts
|
|
806
817
|
declare const VERSION: string;
|
|
807
818
|
//#endregion
|
|
808
|
-
//#region src/builtin-plugin/
|
|
819
|
+
//#region src/builtin-plugin/utils.d.ts
|
|
809
820
|
declare class BuiltinPlugin {
|
|
810
821
|
name: BindingBuiltinPluginName;
|
|
811
822
|
_options?: unknown;
|
|
812
823
|
constructor(name: BindingBuiltinPluginName, _options?: unknown);
|
|
813
824
|
}
|
|
814
|
-
declare function modulePreloadPolyfillPlugin(config?: BindingModulePreloadPolyfillPluginConfig): BuiltinPlugin;
|
|
815
|
-
type DynamicImportVarsPluginConfig = Omit<BindingDynamicImportVarsPluginConfig, "include" | "exclude"> & {
|
|
816
|
-
include?: StringOrRegExp | StringOrRegExp[];
|
|
817
|
-
exclude?: StringOrRegExp | StringOrRegExp[];
|
|
818
|
-
};
|
|
819
|
-
declare function dynamicImportVarsPlugin(config?: DynamicImportVarsPluginConfig): BuiltinPlugin;
|
|
820
|
-
declare function importGlobPlugin(config?: BindingImportGlobPluginConfig): BuiltinPlugin;
|
|
821
|
-
declare function reporterPlugin(config?: BindingReporterPluginConfig): BuiltinPlugin;
|
|
822
|
-
declare function manifestPlugin(config?: BindingManifestPluginConfig): BuiltinPlugin;
|
|
823
|
-
declare function wasmHelperPlugin(config?: BindingWasmHelperPluginConfig): BuiltinPlugin;
|
|
824
|
-
declare function wasmFallbackPlugin(): BuiltinPlugin;
|
|
825
|
-
declare function loadFallbackPlugin(): BuiltinPlugin;
|
|
826
|
-
declare function jsonPlugin(config?: BindingJsonPluginConfig): BuiltinPlugin;
|
|
827
|
-
declare function buildImportAnalysisPlugin(config: BindingBuildImportAnalysisPluginConfig): BuiltinPlugin;
|
|
828
|
-
declare function viteResolvePlugin(config: BindingViteResolvePluginConfig): BuiltinPlugin;
|
|
829
|
-
declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
|
|
830
|
-
declare function assetPlugin(config?: BindingAssetPluginConfig): BuiltinPlugin;
|
|
831
|
-
declare function webWorkerPostPlugin(): BuiltinPlugin;
|
|
832
825
|
//#endregion
|
|
833
826
|
//#region src/constants/plugin.d.ts
|
|
834
827
|
declare const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES: readonly ["options", "buildStart", "resolveId", "load", "transform", "moduleParsed", "buildEnd", "onLog", "resolveDynamicImport", "closeBundle", "closeWatcher", "watchChange"];
|
|
@@ -877,6 +870,7 @@ interface ModuleOptions {
|
|
|
877
870
|
moduleSideEffects: ModuleSideEffects;
|
|
878
871
|
meta: CustomPluginOptions;
|
|
879
872
|
invalidate?: boolean;
|
|
873
|
+
packageJsonPath?: string;
|
|
880
874
|
}
|
|
881
875
|
interface ResolvedId extends ModuleOptions {
|
|
882
876
|
external: boolean | "absolute";
|
|
@@ -1047,6 +1041,11 @@ interface ChecksOptions {
|
|
|
1047
1041
|
* @default true
|
|
1048
1042
|
*/
|
|
1049
1043
|
configurationFieldConflict?: boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* Whether to emit warning when detecting prefer builtin feature
|
|
1046
|
+
* @default true
|
|
1047
|
+
*/
|
|
1048
|
+
preferBuiltinFeature?: boolean;
|
|
1050
1049
|
}
|
|
1051
1050
|
//#endregion
|
|
1052
1051
|
//#region src/options/input-options.d.ts
|
|
@@ -1073,6 +1072,32 @@ type HmrOptions = boolean | {
|
|
|
1073
1072
|
implement?: string;
|
|
1074
1073
|
};
|
|
1075
1074
|
type OptimizationOptions = {
|
|
1075
|
+
/**
|
|
1076
|
+
* Inline imported constant values during bundling instead of preserving variable references.
|
|
1077
|
+
*
|
|
1078
|
+
* When enabled, constant values from imported modules will be inlined at their usage sites,
|
|
1079
|
+
* potentially reducing bundle size and improving runtime performance by eliminating variable lookups.
|
|
1080
|
+
*
|
|
1081
|
+
* **example**
|
|
1082
|
+
* ```js
|
|
1083
|
+
* // Input files:
|
|
1084
|
+
* // constants.js
|
|
1085
|
+
* export const API_URL = 'https://api.example.com';
|
|
1086
|
+
*
|
|
1087
|
+
* // main.js
|
|
1088
|
+
* import { API_URL } from './constants.js';
|
|
1089
|
+
* console.log(API_URL);
|
|
1090
|
+
*
|
|
1091
|
+
* // With inlineConst: true, the bundled output becomes:
|
|
1092
|
+
* console.log('https://api.example.com');
|
|
1093
|
+
*
|
|
1094
|
+
* // Instead of:
|
|
1095
|
+
* const API_URL = 'https://api.example.com';
|
|
1096
|
+
* console.log(API_URL);
|
|
1097
|
+
* ```
|
|
1098
|
+
*
|
|
1099
|
+
* @default false
|
|
1100
|
+
*/
|
|
1076
1101
|
inlineConst?: boolean;
|
|
1077
1102
|
};
|
|
1078
1103
|
type AttachDebugOptions = "none" | "simple" | "full";
|
|
@@ -1111,12 +1136,16 @@ interface InputOptions {
|
|
|
1111
1136
|
mainFiles?: string[];
|
|
1112
1137
|
modules?: string[];
|
|
1113
1138
|
symlinks?: boolean;
|
|
1114
|
-
tsconfigFilename?: string;
|
|
1115
1139
|
};
|
|
1116
1140
|
cwd?: string;
|
|
1117
1141
|
/**
|
|
1118
1142
|
* Expected platform where the code run.
|
|
1119
1143
|
*
|
|
1144
|
+
* When the platform is set to neutral:
|
|
1145
|
+
* - When bundling is enabled the default output format is set to esm, which uses the export syntax introduced with ECMAScript 2015 (i.e. ES6). You can change the output format if this default is not appropriate.
|
|
1146
|
+
* - The main fields setting is empty by default. If you want to use npm-style packages, you will likely have to configure this to be something else such as main for the standard main field used by node.
|
|
1147
|
+
* - The conditions setting does not automatically include any platform-specific values.
|
|
1148
|
+
*
|
|
1120
1149
|
* @default
|
|
1121
1150
|
* - 'node' if the format is 'cjs'
|
|
1122
1151
|
* - 'browser' for other formats
|
|
@@ -1291,6 +1320,11 @@ interface InputOptions {
|
|
|
1291
1320
|
inject?: Record<string, string | [string, string]>;
|
|
1292
1321
|
profilerNames?: boolean;
|
|
1293
1322
|
/**
|
|
1323
|
+
* @deprecated Use {@link OxcTransformOption.jsx} instead.
|
|
1324
|
+
*
|
|
1325
|
+
* This top-level `jsx` option will be removed in a future release.
|
|
1326
|
+
* It is only kept for backward compatibility and will be mapped internally to `transform.jsx`.
|
|
1327
|
+
*
|
|
1294
1328
|
* - `false` disables the JSX parser, resulting in a syntax error if JSX syntax is used.
|
|
1295
1329
|
* - `"preserve"` disables the JSX transformer, preserving the original JSX syntax in the output.
|
|
1296
1330
|
* - `"react"` enables the `classic` JSX transformer.
|
|
@@ -1328,6 +1362,17 @@ interface InputOptions {
|
|
|
1328
1362
|
preserveEntrySignatures?: false | "strict" | "allow-extension" | "exports-only";
|
|
1329
1363
|
optimization?: OptimizationOptions;
|
|
1330
1364
|
context?: string;
|
|
1365
|
+
/**
|
|
1366
|
+
* Allows you to specify where to find the TypeScript configuration file.
|
|
1367
|
+
*
|
|
1368
|
+
* You may provide:
|
|
1369
|
+
* - a relative path to the configuration file. It will be resolved relative to cwd.
|
|
1370
|
+
* - an absolute path to the configuration file.
|
|
1371
|
+
*
|
|
1372
|
+
* When a tsconfig path is specified, the module resolver will respect `compilerOptions.paths` from the specified `tsconfig.json`,
|
|
1373
|
+
* and the tsconfig options will be merged with the top-level `transform` options, with the `transform` options taking precedence.
|
|
1374
|
+
*/
|
|
1375
|
+
tsconfig?: string;
|
|
1331
1376
|
}
|
|
1332
1377
|
//#endregion
|
|
1333
1378
|
//#region src/types/rolldown-options.d.ts
|
|
@@ -1346,4 +1391,4 @@ declare function defineConfig(config: RolldownOptions): RolldownOptions;
|
|
|
1346
1391
|
declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
|
|
1347
1392
|
declare function defineConfig(config: ConfigExport): ConfigExport;
|
|
1348
1393
|
//#endregion
|
|
1349
|
-
export { type AddonFunction, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, BuiltinPlugin, type ChunkFileNamesFunction, type ChunkingContext, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedFile, type ExistingRawSourceMap, type ExternalOption, type FunctionPluginHooks, type GeneralHookFilter, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, MaybePromise, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PreRenderedAsset, type RenderedChunk, type RenderedModule, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownFileStats, type RolldownFsModule, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RollupError, type RollupLog, type RollupLogWithString, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherOptions,
|
|
1394
|
+
export { type AddonFunction, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, BuiltinPlugin, type ChunkFileNamesFunction, type ChunkingContext, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedFile, type ExistingRawSourceMap, type ExternalOption, type FunctionPluginHooks, type GeneralHookFilter, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, MaybePromise, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PreRenderedAsset, type RenderedChunk, type RenderedModule, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownFileStats, type RolldownFsModule, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RollupError, type RollupLog, type RollupLogWithString, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, StringOrRegExp, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherOptions, build, defineConfig, defineParallelPlugin, rolldown, watch, withFilter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-DDkG_k5U.cjs');
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-McCMqGpa.cjs');
|
|
3
3
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
4
4
|
const node_url = require_chunk.__toESM(require("node:url"));
|
|
5
5
|
const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
|
|
@@ -186,7 +186,7 @@ function augmentCodeLocation(properties, pos, source, id) {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
//#endregion
|
|
189
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.
|
|
189
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.82.3/node_modules/oxc-parser/wrap.mjs
|
|
190
190
|
function wrap$1(result) {
|
|
191
191
|
let program, module, comments, errors;
|
|
192
192
|
return {
|
|
@@ -187,7 +187,7 @@ function augmentCodeLocation(properties, pos, source, id) {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
//#endregion
|
|
190
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.
|
|
190
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.82.3/node_modules/oxc-parser/wrap.mjs
|
|
191
191
|
function wrap$1(result) {
|
|
192
192
|
let program, module$1, comments, errors;
|
|
193
193
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-
|
|
1
|
+
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-C_CZT4St.mjs";
|
|
2
2
|
import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-ByKQkexh.mjs";
|
|
3
3
|
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
4
4
|
import path from "node:path";
|
|
@@ -34,22 +34,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region package.json
|
|
37
|
-
var version = "1.0.0-beta.
|
|
37
|
+
var version = "1.0.0-beta.34";
|
|
38
38
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/utils/normalize-string-or-regex.ts
|
|
42
|
-
function normalizedStringOrRegex(pattern) {
|
|
43
|
-
if (!pattern) return void 0;
|
|
44
|
-
if (!isReadonlyArray(pattern)) return [pattern];
|
|
45
|
-
return pattern;
|
|
46
|
-
}
|
|
47
|
-
function isReadonlyArray(input) {
|
|
48
|
-
return Array.isArray(input);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
40
|
//#endregion
|
|
52
41
|
//#region src/builtin-plugin/utils.ts
|
|
42
|
+
var BuiltinPlugin = class {
|
|
43
|
+
constructor(name, _options) {
|
|
44
|
+
this.name = name;
|
|
45
|
+
this._options = _options;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
53
48
|
function makeBuiltinPluginCallable(plugin) {
|
|
54
49
|
let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
55
50
|
const wrappedPlugin = plugin;
|
|
@@ -73,67 +68,6 @@ function bindingifyBuiltInPlugin(plugin) {
|
|
|
73
68
|
};
|
|
74
69
|
}
|
|
75
70
|
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/builtin-plugin/constructors.ts
|
|
78
|
-
var BuiltinPlugin = class {
|
|
79
|
-
constructor(name, _options) {
|
|
80
|
-
this.name = name;
|
|
81
|
-
this._options = _options;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
function modulePreloadPolyfillPlugin(config) {
|
|
85
|
-
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
86
|
-
}
|
|
87
|
-
function dynamicImportVarsPlugin(config) {
|
|
88
|
-
if (config) {
|
|
89
|
-
config.include = normalizedStringOrRegex(config.include);
|
|
90
|
-
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
91
|
-
}
|
|
92
|
-
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
93
|
-
}
|
|
94
|
-
function importGlobPlugin(config) {
|
|
95
|
-
return new BuiltinPlugin("builtin:import-glob", config);
|
|
96
|
-
}
|
|
97
|
-
function reporterPlugin(config) {
|
|
98
|
-
return new BuiltinPlugin("builtin:reporter", config);
|
|
99
|
-
}
|
|
100
|
-
function manifestPlugin(config) {
|
|
101
|
-
return new BuiltinPlugin("builtin:manifest", config);
|
|
102
|
-
}
|
|
103
|
-
function wasmHelperPlugin(config) {
|
|
104
|
-
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
105
|
-
}
|
|
106
|
-
function wasmFallbackPlugin() {
|
|
107
|
-
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
108
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
109
|
-
}
|
|
110
|
-
function loadFallbackPlugin() {
|
|
111
|
-
return new BuiltinPlugin("builtin:load-fallback");
|
|
112
|
-
}
|
|
113
|
-
function jsonPlugin(config) {
|
|
114
|
-
const builtinPlugin = new BuiltinPlugin("builtin:json", config);
|
|
115
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
116
|
-
}
|
|
117
|
-
function buildImportAnalysisPlugin(config) {
|
|
118
|
-
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
119
|
-
}
|
|
120
|
-
function viteResolvePlugin(config) {
|
|
121
|
-
const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
|
|
122
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
123
|
-
}
|
|
124
|
-
function isolatedDeclarationPlugin(config) {
|
|
125
|
-
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
126
|
-
}
|
|
127
|
-
function assetPlugin(config) {
|
|
128
|
-
return new BuiltinPlugin("builtin:asset", config);
|
|
129
|
-
}
|
|
130
|
-
function webWorkerPostPlugin() {
|
|
131
|
-
return new BuiltinPlugin("builtin:web-worker-post");
|
|
132
|
-
}
|
|
133
|
-
function oxcRuntimePlugin(config) {
|
|
134
|
-
return new BuiltinPlugin("builtin:oxc-runtime", config);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
71
|
//#endregion
|
|
138
72
|
//#region src/log/logging.ts
|
|
139
73
|
const LOG_LEVEL_SILENT = "silent";
|
|
@@ -258,6 +192,75 @@ function normalizeHook(hook) {
|
|
|
258
192
|
unreachable("Invalid hook type");
|
|
259
193
|
}
|
|
260
194
|
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/utils/normalize-string-or-regex.ts
|
|
197
|
+
function normalizedStringOrRegex(pattern) {
|
|
198
|
+
if (!pattern) return void 0;
|
|
199
|
+
if (!isReadonlyArray(pattern)) return [pattern];
|
|
200
|
+
return pattern;
|
|
201
|
+
}
|
|
202
|
+
function isReadonlyArray(input) {
|
|
203
|
+
return Array.isArray(input);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/builtin-plugin/constructors.ts
|
|
208
|
+
function modulePreloadPolyfillPlugin(config) {
|
|
209
|
+
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
210
|
+
}
|
|
211
|
+
function dynamicImportVarsPlugin(config) {
|
|
212
|
+
if (config) {
|
|
213
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
214
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
215
|
+
}
|
|
216
|
+
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
217
|
+
}
|
|
218
|
+
function importGlobPlugin(config) {
|
|
219
|
+
return new BuiltinPlugin("builtin:import-glob", config);
|
|
220
|
+
}
|
|
221
|
+
function reporterPlugin(config) {
|
|
222
|
+
return new BuiltinPlugin("builtin:reporter", config);
|
|
223
|
+
}
|
|
224
|
+
function manifestPlugin(config) {
|
|
225
|
+
return new BuiltinPlugin("builtin:manifest", config);
|
|
226
|
+
}
|
|
227
|
+
function wasmHelperPlugin(config) {
|
|
228
|
+
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
229
|
+
}
|
|
230
|
+
function wasmFallbackPlugin() {
|
|
231
|
+
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
232
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
233
|
+
}
|
|
234
|
+
function loadFallbackPlugin() {
|
|
235
|
+
return new BuiltinPlugin("builtin:load-fallback");
|
|
236
|
+
}
|
|
237
|
+
function jsonPlugin(config) {
|
|
238
|
+
const builtinPlugin = new BuiltinPlugin("builtin:json", config);
|
|
239
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
240
|
+
}
|
|
241
|
+
function buildImportAnalysisPlugin(config) {
|
|
242
|
+
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
243
|
+
}
|
|
244
|
+
function viteResolvePlugin(config) {
|
|
245
|
+
const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
|
|
246
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
247
|
+
}
|
|
248
|
+
function isolatedDeclarationPlugin(config) {
|
|
249
|
+
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
250
|
+
}
|
|
251
|
+
function assetPlugin(config) {
|
|
252
|
+
return new BuiltinPlugin("builtin:asset", config);
|
|
253
|
+
}
|
|
254
|
+
function webWorkerPostPlugin() {
|
|
255
|
+
return new BuiltinPlugin("builtin:web-worker-post");
|
|
256
|
+
}
|
|
257
|
+
function oxcRuntimePlugin(config) {
|
|
258
|
+
return new BuiltinPlugin("builtin:oxc-runtime", config);
|
|
259
|
+
}
|
|
260
|
+
function esmExternalRequirePlugin(config) {
|
|
261
|
+
return new BuiltinPlugin("builtin:esm-external-require", config);
|
|
262
|
+
}
|
|
263
|
+
|
|
261
264
|
//#endregion
|
|
262
265
|
//#region src/constants/plugin.ts
|
|
263
266
|
const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
@@ -2036,7 +2039,7 @@ const TransformOptionsSchema = object({
|
|
|
2036
2039
|
typescript: optional(TypescriptSchema),
|
|
2037
2040
|
helpers: optional(HelpersSchema),
|
|
2038
2041
|
decorators: optional(DecoratorOptionSchema),
|
|
2039
|
-
jsx: optional(JsxOptionsSchema),
|
|
2042
|
+
jsx: optional(union([literal("preserve"), JsxOptionsSchema])),
|
|
2040
2043
|
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
2041
2044
|
});
|
|
2042
2045
|
const WatchOptionsSchema = strictObject({
|
|
@@ -2064,7 +2067,8 @@ const ChecksOptionsSchema = strictObject({
|
|
|
2064
2067
|
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
2065
2068
|
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
2066
2069
|
emptyImportMeta: pipe(optional(boolean()), description("Whether to emit warning when detecting empty import meta")),
|
|
2067
|
-
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
2070
|
+
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
|
|
2071
|
+
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
|
|
2068
2072
|
});
|
|
2069
2073
|
const MinifyOptionsSchema = strictObject({
|
|
2070
2074
|
mangle: optional(boolean()),
|
|
@@ -2082,7 +2086,6 @@ const ResolveOptionsSchema = strictObject({
|
|
|
2082
2086
|
mainFiles: optional(array(string())),
|
|
2083
2087
|
modules: optional(array(string())),
|
|
2084
2088
|
symlinks: optional(boolean()),
|
|
2085
|
-
tsconfigFilename: optional(string()),
|
|
2086
2089
|
yarnPnp: optional(boolean())
|
|
2087
2090
|
});
|
|
2088
2091
|
const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
@@ -2166,7 +2169,8 @@ const InputOptionsSchema = strictObject({
|
|
|
2166
2169
|
literal("allow-extension"),
|
|
2167
2170
|
literal("exports-only"),
|
|
2168
2171
|
literal(false)
|
|
2169
|
-
])))
|
|
2172
|
+
]))),
|
|
2173
|
+
tsconfig: pipe(optional(string()), description("Path to the tsconfig.json file."))
|
|
2170
2174
|
});
|
|
2171
2175
|
const InputCliOverrideSchema = strictObject({
|
|
2172
2176
|
input: pipe(optional(array(string())), description("Entry file")),
|
|
@@ -2288,7 +2292,8 @@ const OutputOptionsSchema = strictObject({
|
|
|
2288
2292
|
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2289
2293
|
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2290
2294
|
virtualDirname: optional(string()),
|
|
2291
|
-
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports"))
|
|
2295
|
+
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports")),
|
|
2296
|
+
topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`."))
|
|
2292
2297
|
});
|
|
2293
2298
|
const getAddonDescription = (placement, wrapper) => {
|
|
2294
2299
|
return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
|
|
@@ -2742,7 +2747,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2742
2747
|
...res,
|
|
2743
2748
|
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2744
2749
|
...info,
|
|
2745
|
-
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null
|
|
2750
|
+
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null,
|
|
2751
|
+
packageJsonPath: res.packageJsonPath
|
|
2746
2752
|
};
|
|
2747
2753
|
}
|
|
2748
2754
|
emitFile = (file) => {
|
|
@@ -2868,7 +2874,8 @@ function bindingifyResolveId(args$1) {
|
|
|
2868
2874
|
id: ret.id,
|
|
2869
2875
|
external: ret.external,
|
|
2870
2876
|
normalizeExternalId: false,
|
|
2871
|
-
moduleSideEffects: exist.moduleSideEffects ?? void 0
|
|
2877
|
+
moduleSideEffects: exist.moduleSideEffects ?? void 0,
|
|
2878
|
+
packageJsonPath: ret.packageJsonPath
|
|
2872
2879
|
};
|
|
2873
2880
|
},
|
|
2874
2881
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -3575,6 +3582,9 @@ var NormalizedInputOptionsImpl = class {
|
|
|
3575
3582
|
get platform() {
|
|
3576
3583
|
return this.inner.platform;
|
|
3577
3584
|
}
|
|
3585
|
+
get context() {
|
|
3586
|
+
return this.inner.context;
|
|
3587
|
+
}
|
|
3578
3588
|
};
|
|
3579
3589
|
|
|
3580
3590
|
//#endregion
|
|
@@ -3791,7 +3801,13 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
3791
3801
|
return this.outputOptions.sourcemapPathTransform;
|
|
3792
3802
|
}
|
|
3793
3803
|
get minify() {
|
|
3794
|
-
|
|
3804
|
+
let ret = this.inner.minify;
|
|
3805
|
+
if (typeof ret === "object" && ret !== null) {
|
|
3806
|
+
delete ret["codegen"];
|
|
3807
|
+
delete ret["module"];
|
|
3808
|
+
delete ret["sourcemap"];
|
|
3809
|
+
}
|
|
3810
|
+
return ret;
|
|
3795
3811
|
}
|
|
3796
3812
|
get legalComments() {
|
|
3797
3813
|
return this.inner.legalComments;
|
|
@@ -3975,7 +3991,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3975
3991
|
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
|
|
3976
3992
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
3977
3993
|
optimization: inputOptions.optimization,
|
|
3978
|
-
context: inputOptions.context
|
|
3994
|
+
context: inputOptions.context,
|
|
3995
|
+
tsconfig: inputOptions.tsconfig
|
|
3979
3996
|
};
|
|
3980
3997
|
}
|
|
3981
3998
|
function bindingifyHmr(hmr) {
|
|
@@ -4244,12 +4261,12 @@ const availableParallelism = () => {
|
|
|
4244
4261
|
|
|
4245
4262
|
//#endregion
|
|
4246
4263
|
//#region src/utils/create-bundler-option.ts
|
|
4247
|
-
async function createBundlerOptions(inputOptions, outputOptions, watchMode
|
|
4264
|
+
async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
4248
4265
|
const inputPlugins = await normalizePluginOption(inputOptions.plugins);
|
|
4249
4266
|
const outputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
4250
4267
|
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
4251
4268
|
const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
4252
|
-
|
|
4269
|
+
outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions, onLog, logLevel, watchMode);
|
|
4253
4270
|
const normalizedOutputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
4254
4271
|
let plugins = [
|
|
4255
4272
|
...BUILTIN_PLUGINS,
|
|
@@ -4279,8 +4296,8 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4279
4296
|
//#endregion
|
|
4280
4297
|
//#region src/utils/create-bundler.ts
|
|
4281
4298
|
let asyncRuntimeShutdown = false;
|
|
4282
|
-
async function createBundlerImpl(bundler, inputOptions, outputOptions
|
|
4283
|
-
const option = await createBundlerOptions(inputOptions, outputOptions, false
|
|
4299
|
+
async function createBundlerImpl(bundler, inputOptions, outputOptions) {
|
|
4300
|
+
const option = await createBundlerOptions(inputOptions, outputOptions, false);
|
|
4284
4301
|
if (asyncRuntimeShutdown) startAsyncRuntime();
|
|
4285
4302
|
try {
|
|
4286
4303
|
return {
|
|
@@ -4321,11 +4338,11 @@ var RolldownBuild = class {
|
|
|
4321
4338
|
this.#bundler = new BindingBundler();
|
|
4322
4339
|
}
|
|
4323
4340
|
get closed() {
|
|
4324
|
-
return this.#bundlerImpl?.impl.closed ??
|
|
4341
|
+
return this.#bundlerImpl?.impl.closed ?? true;
|
|
4325
4342
|
}
|
|
4326
|
-
async #getBundlerWithStopWorker(outputOptions
|
|
4343
|
+
async #getBundlerWithStopWorker(outputOptions) {
|
|
4327
4344
|
if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
|
|
4328
|
-
return this.#bundlerImpl = await createBundlerImpl(this.#bundler, this.#inputOptions, outputOptions
|
|
4345
|
+
return this.#bundlerImpl = await createBundlerImpl(this.#bundler, this.#inputOptions, outputOptions);
|
|
4329
4346
|
}
|
|
4330
4347
|
async generate(outputOptions = {}) {
|
|
4331
4348
|
validateOption("output", outputOptions);
|
|
@@ -4340,10 +4357,12 @@ var RolldownBuild = class {
|
|
|
4340
4357
|
return transformToRollupOutput(output);
|
|
4341
4358
|
}
|
|
4342
4359
|
async close() {
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4360
|
+
if (this.#bundlerImpl) {
|
|
4361
|
+
await this.#bundlerImpl.stopWorkers?.();
|
|
4362
|
+
await this.#bundlerImpl.impl.close();
|
|
4363
|
+
this.#bundlerImpl.shutdown();
|
|
4364
|
+
this.#bundlerImpl = void 0;
|
|
4365
|
+
}
|
|
4347
4366
|
}
|
|
4348
4367
|
async [Symbol.asyncDispose]() {
|
|
4349
4368
|
await this.close();
|
|
@@ -4532,4 +4551,4 @@ function defineConfig(config) {
|
|
|
4532
4551
|
const VERSION = version;
|
|
4533
4552
|
|
|
4534
4553
|
//#endregion
|
|
4535
|
-
export { BuiltinPlugin, PluginContextData, PluginDriver, VERSION, __commonJS, __toESM, ansis_default, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, createBundlerImpl, defineConfig, description$1 as description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
|
|
4554
|
+
export { BuiltinPlugin, PluginContextData, PluginDriver, VERSION, __commonJS, __toESM, ansis_default, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, createBundlerImpl, createBundlerOptions, defineConfig, description$1 as description, dynamicImportVarsPlugin, esmExternalRequirePlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
|