@rolldown/browser 1.0.0-beta.24 → 1.0.0-beta.25
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 +1 -1
- package/dist/experimental-index.cjs +2 -2
- package/dist/experimental-index.d.cts +2 -4
- package/dist/experimental-index.d.mts +2 -4
- package/dist/experimental-index.mjs +2 -2
- package/dist/experimental-runtime-types.d.ts +2 -0
- 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 -2
- package/dist/parse-ast-index.d.mts +1 -2
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +1 -1
- package/dist/rolldown-binding.wasi.cjs +24 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-DG3bbtXG.d.cts → binding-B9-3a5q4.d.cts} +0 -2
- package/dist/shared/{binding-cECB-Ts3.d.mts → binding-DQYRWAqj.d.mts} +0 -2
- package/dist/shared/{define-config-BnlWQIlM.d.cts → define-config-BtEiHmBk.d.mts} +26 -29
- package/dist/shared/{define-config-Dipre2WB.d.mts → define-config-ZN70csxk.d.cts} +26 -29
- package/dist/shared/{load-config-FXcGLoFh.mjs → load-config-B_r5s5Sw.mjs} +1 -1
- package/dist/shared/{load-config-B-Wrkmqo.cjs → load-config-CbbGAxoK.cjs} +1 -1
- package/dist/shared/{parse-ast-index-B0vXlNs8.cjs → parse-ast-index-80TSV2Ni.cjs} +1 -1
- package/dist/shared/{parse-ast-index-DQEVpsUG.mjs → parse-ast-index-Bo5jcF9A.mjs} +1 -1
- package/dist/shared/{src-DmJCtJ15.mjs → src-DgEwyn6q.mjs} +57 -41
- package/dist/shared/{src-dEUToPiW.cjs → src-Dtgcnc61.cjs} +56 -40
- package/dist/{src-BHNQaKQh.js → src-nDvl0w95.js} +57 -41
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingDynamicImportVarsPluginConfig, BindingHmrOutputPatch, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, BindingWatcherEvent, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-
|
|
1
|
+
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingDynamicImportVarsPluginConfig, BindingHmrOutputPatch, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, BindingWatcherEvent, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-B9-3a5q4.cjs";
|
|
2
2
|
import { Program } from "@oxc-project/types";
|
|
3
3
|
import { TopLevelFilterExpression } from "@rolldown/pluginutils";
|
|
4
4
|
|
|
@@ -426,6 +426,14 @@ interface OutputOptions {
|
|
|
426
426
|
preserveModules?: boolean;
|
|
427
427
|
virtualDirname?: string;
|
|
428
428
|
preserveModulesRoot?: string;
|
|
429
|
+
topLevelVar?: boolean;
|
|
430
|
+
/**
|
|
431
|
+
* - Type: `boolean`
|
|
432
|
+
* - Default: `false`
|
|
433
|
+
*
|
|
434
|
+
* Whether to minify internal exports.
|
|
435
|
+
*/
|
|
436
|
+
minifyInternalExports?: boolean;
|
|
429
437
|
}
|
|
430
438
|
//#endregion
|
|
431
439
|
//#region src/api/build.d.ts
|
|
@@ -453,16 +461,12 @@ declare class RolldownBuild {
|
|
|
453
461
|
write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
|
|
454
462
|
close(): Promise<void>;
|
|
455
463
|
[Symbol.asyncDispose](): Promise<void>;
|
|
456
|
-
generateHmrPatch(changedFiles: string[]): Promise<BindingHmrOutputPatch>;
|
|
464
|
+
generateHmrPatch(changedFiles: string[]): Promise<BindingHmrOutputPatch | undefined>;
|
|
457
465
|
hmrInvalidate(file: string, firstInvalidatedBy?: string): Promise<BindingHmrOutputPatch>;
|
|
458
|
-
// TODO(underfin)
|
|
459
|
-
// The `watchFiles` method returns a promise, but Rollup does not.
|
|
460
|
-
// Converting it to a synchronous API might cause a deadlock if the user calls `write` and `watchFiles` simultaneously.
|
|
461
466
|
get watchFiles(): Promise<string[]>;
|
|
462
467
|
}
|
|
463
468
|
//#endregion
|
|
464
469
|
//#region src/api/rolldown/index.d.ts
|
|
465
|
-
// `async` here is intentional to be compatible with `rollup.rollup`.
|
|
466
470
|
declare const rolldown: (input: InputOptions) => Promise<RolldownBuild>;
|
|
467
471
|
//#endregion
|
|
468
472
|
//#region src/options/watch-options.d.ts
|
|
@@ -473,7 +477,6 @@ interface WatchOptions extends InputOptions {
|
|
|
473
477
|
//#region src/api/watch/watch-emitter.d.ts
|
|
474
478
|
type WatcherEvent = "close" | "event" | "restart" | "change";
|
|
475
479
|
type ChangeEvent$1 = "create" | "update" | "delete";
|
|
476
|
-
// TODO: find a way use `RolldownBuild` instead of `Bundler`.
|
|
477
480
|
type RolldownWatchBuild = BindingBundlerImpl;
|
|
478
481
|
type RolldownWatcherEvent = {
|
|
479
482
|
code: "START";
|
|
@@ -482,7 +485,6 @@ type RolldownWatcherEvent = {
|
|
|
482
485
|
} | {
|
|
483
486
|
code: "BUNDLE_END";
|
|
484
487
|
duration: number;
|
|
485
|
-
// input?: InputOption
|
|
486
488
|
output: readonly string[];
|
|
487
489
|
result: RolldownWatchBuild;
|
|
488
490
|
} | {
|
|
@@ -508,7 +510,6 @@ declare class WatcherEmitter {
|
|
|
508
510
|
type RolldownWatcher = WatcherEmitter;
|
|
509
511
|
//#endregion
|
|
510
512
|
//#region src/api/watch/index.d.ts
|
|
511
|
-
// Compat to `rollup.watch`
|
|
512
513
|
declare const watch: (input: WatchOptions | WatchOptions[]) => RolldownWatcher;
|
|
513
514
|
//#endregion
|
|
514
515
|
//#region src/log/log-handler.d.ts
|
|
@@ -526,7 +527,6 @@ interface NormalizedInputOptions {
|
|
|
526
527
|
platform: InputOptions["platform"];
|
|
527
528
|
shimMissingExports: boolean;
|
|
528
529
|
}
|
|
529
|
-
// TODO: I guess we make these getters enumerable so it act more like a plain object
|
|
530
530
|
//#endregion
|
|
531
531
|
//#region src/options/normalized-output-options.d.ts
|
|
532
532
|
type InternalModuleFormat = "es" | "cjs" | "iife" | "umd";
|
|
@@ -562,8 +562,9 @@ interface NormalizedOutputOptions {
|
|
|
562
562
|
preserveModules: boolean;
|
|
563
563
|
virtualDirname: string;
|
|
564
564
|
preserveModulesRoot?: string;
|
|
565
|
+
topLevelVar?: boolean;
|
|
566
|
+
minifyInternalExports?: boolean;
|
|
565
567
|
}
|
|
566
|
-
// TODO: I guess we make these getters enumerable so it act more like a plain object
|
|
567
568
|
//#endregion
|
|
568
569
|
//#region src/plugin/hook-filter.d.ts
|
|
569
570
|
type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
|
|
@@ -657,6 +658,7 @@ interface EmittedChunk {
|
|
|
657
658
|
}
|
|
658
659
|
type EmittedFile = EmittedAsset | EmittedChunk;
|
|
659
660
|
interface PluginContextResolveOptions {
|
|
661
|
+
isEntry?: boolean;
|
|
660
662
|
skipSelf?: boolean;
|
|
661
663
|
custom?: CustomPluginOptions;
|
|
662
664
|
}
|
|
@@ -726,7 +728,6 @@ declare const VERSION: string;
|
|
|
726
728
|
//#region src/builtin-plugin/constructors.d.ts
|
|
727
729
|
declare class BuiltinPlugin {
|
|
728
730
|
name: BindingBuiltinPluginName;
|
|
729
|
-
// NOTE: has `_` to avoid conflict with `options` hook
|
|
730
731
|
_options?: unknown;
|
|
731
732
|
constructor(name: BindingBuiltinPluginName, _options?: unknown);
|
|
732
733
|
}
|
|
@@ -792,7 +793,6 @@ declare function withFilter<A, T extends RolldownPluginOption<A>>(pluginOption:
|
|
|
792
793
|
//#endregion
|
|
793
794
|
//#region src/plugin/index.d.ts
|
|
794
795
|
type ModuleSideEffects = boolean | "no-treeshake" | null;
|
|
795
|
-
// ref: https://github.com/microsoft/TypeScript/issues/33471#issuecomment-1376364329
|
|
796
796
|
type ModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {});
|
|
797
797
|
type ImportKind = BindingHookResolveIdExtraArgs["kind"];
|
|
798
798
|
interface CustomPluginOptions {
|
|
@@ -801,8 +801,6 @@ interface CustomPluginOptions {
|
|
|
801
801
|
interface ModuleOptions {
|
|
802
802
|
moduleSideEffects: ModuleSideEffects;
|
|
803
803
|
meta: CustomPluginOptions;
|
|
804
|
-
// flag used to check if user directly modified the `ModuleInfo`
|
|
805
|
-
// this is used to sync state between rust and js
|
|
806
804
|
invalidate?: boolean;
|
|
807
805
|
}
|
|
808
806
|
interface ResolvedId extends ModuleOptions {
|
|
@@ -832,9 +830,7 @@ type RenderedChunkMeta = {
|
|
|
832
830
|
interface FunctionPluginHooks {
|
|
833
831
|
[DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
|
|
834
832
|
[DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
|
|
835
|
-
// TODO find a way to make `this: PluginContext` work.
|
|
836
833
|
[DEFINED_HOOK_NAMES.outputOptions]: (this: MinimalPluginContext, options: OutputOptions) => NullValue | OutputOptions;
|
|
837
|
-
// --- Build hooks ---
|
|
838
834
|
[DEFINED_HOOK_NAMES.buildStart]: (this: PluginContext, options: NormalizedInputOptions) => void;
|
|
839
835
|
[DEFINED_HOOK_NAMES.resolveId]: (this: PluginContext, source: string, importer: string | undefined, extraOptions: ResolveIdExtraOptions) => ResolveIdResult;
|
|
840
836
|
/**
|
|
@@ -848,7 +844,6 @@ interface FunctionPluginHooks {
|
|
|
848
844
|
}) => TransformResult;
|
|
849
845
|
[DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
|
|
850
846
|
[DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
|
|
851
|
-
// --- Generate hooks ---
|
|
852
847
|
[DEFINED_HOOK_NAMES.renderStart]: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
|
|
853
848
|
[DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions, meta: RenderedChunkMeta) => NullValue | string | {
|
|
854
849
|
code: string;
|
|
@@ -859,7 +854,6 @@ interface FunctionPluginHooks {
|
|
|
859
854
|
[DEFINED_HOOK_NAMES.generateBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
|
|
860
855
|
[DEFINED_HOOK_NAMES.writeBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
|
|
861
856
|
[DEFINED_HOOK_NAMES.closeBundle]: (this: PluginContext) => void;
|
|
862
|
-
// --- watch hooks ---
|
|
863
857
|
[DEFINED_HOOK_NAMES.watchChange]: (this: PluginContext, id: string, event: {
|
|
864
858
|
event: ChangeEvent;
|
|
865
859
|
}) => void;
|
|
@@ -874,13 +868,8 @@ type ObjectHook<T, O = {}> = T | ({
|
|
|
874
868
|
handler: T;
|
|
875
869
|
} & ObjectHookMeta & O);
|
|
876
870
|
type SyncPluginHooks = DefinedHookNames["augmentChunkHash" | "onLog" | "outputOptions"];
|
|
877
|
-
// | 'renderDynamicImport'
|
|
878
|
-
// | 'resolveFileUrl'
|
|
879
|
-
// | 'resolveImportMeta'
|
|
880
871
|
type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
|
|
881
872
|
type FirstPluginHooks = DefinedHookNames["load" | "resolveDynamicImport" | "resolveId"];
|
|
882
|
-
// | 'resolveImportMeta'
|
|
883
|
-
// | 'shouldTransformCachedModule'
|
|
884
873
|
type SequentialPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "onLog" | "options" | "outputOptions" | "renderChunk" | "transform"];
|
|
885
874
|
type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
|
|
886
875
|
type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
|
|
@@ -907,11 +896,9 @@ type PluginHooks = { [K in keyof FunctionPluginHooks]: ObjectHook<K extends Asyn
|
|
|
907
896
|
type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
|
|
908
897
|
type AddonHook = string | AddonHookFunction;
|
|
909
898
|
interface OutputPlugin extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
|
|
910
|
-
// cacheKey?: string
|
|
911
899
|
name: string;
|
|
912
900
|
}
|
|
913
901
|
interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
|
|
914
|
-
// for inter-plugin communication
|
|
915
902
|
api?: A;
|
|
916
903
|
}
|
|
917
904
|
type RolldownPlugin<A = any> = Plugin<A> | BuiltinPlugin | ParallelPlugin;
|
|
@@ -924,8 +911,6 @@ type RolldownOutputPluginOption = MaybePromise<NullValue<RolldownOutputPlugin> |
|
|
|
924
911
|
} | false | RolldownOutputPluginOption[]>;
|
|
925
912
|
//#endregion
|
|
926
913
|
//#region src/options/generated/checks-options.d.ts
|
|
927
|
-
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
|
928
|
-
// To edit this generated file you have to edit `tasks/generator/src/generators/checks.rs`
|
|
929
914
|
interface ChecksOptions {
|
|
930
915
|
/**
|
|
931
916
|
* Whether to emit warning when detecting circular dependency
|
|
@@ -986,7 +971,6 @@ interface ChecksOptions {
|
|
|
986
971
|
//#endregion
|
|
987
972
|
//#region src/options/input-options.d.ts
|
|
988
973
|
type InputOption = string | string[] | Record<string, string>;
|
|
989
|
-
// Omit those key that are part of rolldown option
|
|
990
974
|
type OxcTransformOption = Omit<TransformOptions, "sourceType" | "lang" | "cwd" | "sourcemap" | "define" | "inject">;
|
|
991
975
|
type ExternalOption = StringOrRegExp | StringOrRegExp[] | ((id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>);
|
|
992
976
|
type ModuleTypes = Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css" | "asset">;
|
|
@@ -1010,6 +994,7 @@ type OptimizationOptions = {
|
|
|
1010
994
|
inlineConst?: boolean;
|
|
1011
995
|
};
|
|
1012
996
|
type AttachDebugOptions = "none" | "simple" | "full";
|
|
997
|
+
type ChunkModulesOrder = "exec-order" | "module-id";
|
|
1013
998
|
interface RollupJsxOptions {
|
|
1014
999
|
mode?: "classic" | "automatic" | "preserve";
|
|
1015
1000
|
factory?: string;
|
|
@@ -1068,6 +1053,18 @@ interface InputOptions {
|
|
|
1068
1053
|
resolveNewUrlToAsset?: boolean;
|
|
1069
1054
|
hmr?: HmrOptions;
|
|
1070
1055
|
/**
|
|
1056
|
+
* Control which order should use when rendering modules in chunk
|
|
1057
|
+
*
|
|
1058
|
+
* - Type: `'exec-order' | 'module-id'
|
|
1059
|
+
* - Default: `'exec-order'`
|
|
1060
|
+
*
|
|
1061
|
+
* - `exec-order`: Almost equivalent to the topological order of the module graph, but specially handling when module graph has cycle.
|
|
1062
|
+
* - `module-id`: This is more friendly for gzip compression, especially for some javascript static asset lib (e.g. icon library)
|
|
1063
|
+
* > [!NOTE]
|
|
1064
|
+
* > Try to sort the modules by their module id if possible(Since rolldown scope hoist all modules in the chunk, we only try to sort those modules by module id if we could ensure runtime behavior is correct after sorting).
|
|
1065
|
+
*/
|
|
1066
|
+
chunkModulesOrder?: ChunkModulesOrder;
|
|
1067
|
+
/**
|
|
1071
1068
|
* Attach debug information to the output bundle.
|
|
1072
1069
|
*
|
|
1073
1070
|
* - Type: `'none' | 'simple' | 'full'`
|
|
@@ -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-Dtgcnc61.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_process = require_chunk.__toESM(require("node:process"));
|
|
@@ -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.76.0/node_modules/oxc-parser/wrap.mjs
|
|
191
191
|
function wrap$1(result) {
|
|
192
192
|
let program, module$1, comments, errors;
|
|
193
193
|
return {
|
|
@@ -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.76.0/node_modules/oxc-parser/wrap.mjs
|
|
190
190
|
function wrap$1(result) {
|
|
191
191
|
let program, module, comments, errors;
|
|
192
192
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-DvBwroyk.mjs";
|
|
2
|
-
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-
|
|
3
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin,
|
|
2
|
+
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-Bo5jcF9A.mjs";
|
|
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";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import os from "node:os";
|
|
@@ -33,7 +33,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region package.json
|
|
36
|
-
var version = "1.0.0-beta.
|
|
36
|
+
var version = "1.0.0-beta.25";
|
|
37
37
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
@@ -2134,7 +2134,8 @@ const ResolveOptionsSchema = strictObject({
|
|
|
2134
2134
|
mainFiles: optional(array(string())),
|
|
2135
2135
|
modules: optional(array(string())),
|
|
2136
2136
|
symlinks: optional(boolean()),
|
|
2137
|
-
tsconfigFilename: optional(string())
|
|
2137
|
+
tsconfigFilename: optional(string()),
|
|
2138
|
+
yarnPnp: optional(boolean())
|
|
2138
2139
|
});
|
|
2139
2140
|
const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
2140
2141
|
annotations: optional(boolean()),
|
|
@@ -2184,7 +2185,8 @@ const InputOptionsSchema = strictObject({
|
|
|
2184
2185
|
literal("none"),
|
|
2185
2186
|
literal("simple"),
|
|
2186
2187
|
literal("full")
|
|
2187
|
-
]))
|
|
2188
|
+
])),
|
|
2189
|
+
chunkModulesOrder: optional(union([literal("module-id"), literal("exec-order")]))
|
|
2188
2190
|
})),
|
|
2189
2191
|
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2190
2192
|
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
@@ -2325,7 +2327,8 @@ const OutputOptionsSchema = strictObject({
|
|
|
2325
2327
|
}, () => `The 'true' value is not supported`)),
|
|
2326
2328
|
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2327
2329
|
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2328
|
-
virtualDirname: optional(string())
|
|
2330
|
+
virtualDirname: optional(string()),
|
|
2331
|
+
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports"))
|
|
2329
2332
|
});
|
|
2330
2333
|
const getAddonDescription = (placement, wrapper) => {
|
|
2331
2334
|
return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
|
|
@@ -2494,19 +2497,6 @@ function transformModuleInfo(info, option) {
|
|
|
2494
2497
|
};
|
|
2495
2498
|
}
|
|
2496
2499
|
|
|
2497
|
-
//#endregion
|
|
2498
|
-
//#region src/utils/transform-side-effects.ts
|
|
2499
|
-
function bindingifySideEffects(sideEffects) {
|
|
2500
|
-
switch (sideEffects) {
|
|
2501
|
-
case true: return BindingHookSideEffects.True;
|
|
2502
|
-
case false: return BindingHookSideEffects.False;
|
|
2503
|
-
case "no-treeshake": return BindingHookSideEffects.NoTreeshake;
|
|
2504
|
-
case null:
|
|
2505
|
-
case void 0: return void 0;
|
|
2506
|
-
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
2507
|
-
}
|
|
2508
|
-
}
|
|
2509
|
-
|
|
2510
2500
|
//#endregion
|
|
2511
2501
|
//#region src/utils/transform-sourcemap.ts
|
|
2512
2502
|
function isEmptySourcemapFiled(array$1) {
|
|
@@ -2523,7 +2513,7 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
|
2523
2513
|
}
|
|
2524
2514
|
|
|
2525
2515
|
//#endregion
|
|
2526
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2516
|
+
//#region ../../node_modules/.pnpm/remeda@2.24.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2527
2517
|
function u$1(o$1, n$1, a$2) {
|
|
2528
2518
|
let t$1 = (r$1) => o$1(r$1, ...n$1);
|
|
2529
2519
|
return a$2 === void 0 ? t$1 : Object.assign(t$1, {
|
|
@@ -2533,7 +2523,7 @@ function u$1(o$1, n$1, a$2) {
|
|
|
2533
2523
|
}
|
|
2534
2524
|
|
|
2535
2525
|
//#endregion
|
|
2536
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2526
|
+
//#region ../../node_modules/.pnpm/remeda@2.24.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
2537
2527
|
function u(r$1, n$1, o$1) {
|
|
2538
2528
|
let a$2 = r$1.length - n$1.length;
|
|
2539
2529
|
if (a$2 === 0) return r$1(...n$1);
|
|
@@ -2542,7 +2532,7 @@ function u(r$1, n$1, o$1) {
|
|
|
2542
2532
|
}
|
|
2543
2533
|
|
|
2544
2534
|
//#endregion
|
|
2545
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2535
|
+
//#region ../../node_modules/.pnpm/remeda@2.24.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
|
|
2546
2536
|
function d(...r$1) {
|
|
2547
2537
|
return u(i, r$1);
|
|
2548
2538
|
}
|
|
@@ -2749,7 +2739,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2749
2739
|
});
|
|
2750
2740
|
data.loadModulePromiseMap.set(id$1, promise$1);
|
|
2751
2741
|
try {
|
|
2752
|
-
await context.load(id$1,
|
|
2742
|
+
await context.load(id$1, options.moduleSideEffects ?? void 0);
|
|
2753
2743
|
} catch (e$1) {
|
|
2754
2744
|
data.loadModulePromiseMap.delete(id$1);
|
|
2755
2745
|
data.loadModulePromiseResolveFnMap.delete(id$1);
|
|
@@ -2769,6 +2759,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2769
2759
|
}, void 0);
|
|
2770
2760
|
const res = await this.context.resolve(source, importer, {
|
|
2771
2761
|
custom: receipt,
|
|
2762
|
+
isEntry: options?.isEntry,
|
|
2772
2763
|
skipSelf: options?.skipSelf,
|
|
2773
2764
|
vitePluginCustom
|
|
2774
2765
|
});
|
|
@@ -2778,7 +2769,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2778
2769
|
return {
|
|
2779
2770
|
...res,
|
|
2780
2771
|
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2781
|
-
...info
|
|
2772
|
+
...info,
|
|
2773
|
+
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null
|
|
2782
2774
|
};
|
|
2783
2775
|
}
|
|
2784
2776
|
emitFile = (file) => {
|
|
@@ -2902,7 +2894,7 @@ function bindingifyResolveId(args$1) {
|
|
|
2902
2894
|
id: ret.id,
|
|
2903
2895
|
external: ret.external,
|
|
2904
2896
|
normalizeExternalId: false,
|
|
2905
|
-
|
|
2897
|
+
moduleSideEffects: exist.moduleSideEffects ?? void 0
|
|
2906
2898
|
};
|
|
2907
2899
|
},
|
|
2908
2900
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -2926,7 +2918,7 @@ function bindingifyResolveDynamicImport(args$1) {
|
|
|
2926
2918
|
id: ret.id,
|
|
2927
2919
|
external: ret.external
|
|
2928
2920
|
};
|
|
2929
|
-
if (ret.moduleSideEffects !== null) result.
|
|
2921
|
+
if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
|
|
2930
2922
|
args$1.pluginContextData.updateModuleOption(ret.id, {
|
|
2931
2923
|
meta: ret.meta || {},
|
|
2932
2924
|
moduleSideEffects: ret.moduleSideEffects || null,
|
|
@@ -2954,7 +2946,7 @@ function bindingifyTransform(args$1) {
|
|
|
2954
2946
|
return {
|
|
2955
2947
|
code: ret.code,
|
|
2956
2948
|
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
|
|
2957
|
-
|
|
2949
|
+
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
|
|
2958
2950
|
moduleType: ret.moduleType
|
|
2959
2951
|
};
|
|
2960
2952
|
},
|
|
@@ -2981,7 +2973,7 @@ function bindingifyLoad(args$1) {
|
|
|
2981
2973
|
code: ret.code,
|
|
2982
2974
|
map: bindingifySourcemap$1(map),
|
|
2983
2975
|
moduleType: ret.moduleType,
|
|
2984
|
-
|
|
2976
|
+
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0
|
|
2985
2977
|
};
|
|
2986
2978
|
},
|
|
2987
2979
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -3635,7 +3627,7 @@ var ChunkingContextImpl = class {
|
|
|
3635
3627
|
//#endregion
|
|
3636
3628
|
//#region src/utils/bindingify-output-options.ts
|
|
3637
3629
|
function bindingifyOutputOptions(outputOptions) {
|
|
3638
|
-
const { dir, format, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks } = outputOptions;
|
|
3630
|
+
const { dir, format, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
3639
3631
|
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
3640
3632
|
return {
|
|
3641
3633
|
dir,
|
|
@@ -3670,7 +3662,9 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
3670
3662
|
preserveModules,
|
|
3671
3663
|
virtualDirname,
|
|
3672
3664
|
legalComments,
|
|
3673
|
-
preserveModulesRoot
|
|
3665
|
+
preserveModulesRoot,
|
|
3666
|
+
topLevelVar,
|
|
3667
|
+
minifyInternalExports: outputOptions.minifyInternalExports
|
|
3674
3668
|
};
|
|
3675
3669
|
}
|
|
3676
3670
|
function bindingifyAddon(configAddon) {
|
|
@@ -3839,6 +3833,12 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
3839
3833
|
get virtualDirname() {
|
|
3840
3834
|
return this.inner.virtualDirname;
|
|
3841
3835
|
}
|
|
3836
|
+
get topLevelVar() {
|
|
3837
|
+
return this.inner.topLevelVar ?? false;
|
|
3838
|
+
}
|
|
3839
|
+
get minifyInternalExports() {
|
|
3840
|
+
return this.inner.minifyInternalExports ?? false;
|
|
3841
|
+
}
|
|
3842
3842
|
};
|
|
3843
3843
|
function normalizeAddon(value) {
|
|
3844
3844
|
if (typeof value === "function") return value;
|
|
@@ -3973,14 +3973,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3973
3973
|
moduleTypes: inputOptions.moduleTypes,
|
|
3974
3974
|
define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
|
|
3975
3975
|
inject: bindingifyInject(inputOptions.inject),
|
|
3976
|
-
experimental:
|
|
3977
|
-
strictExecutionOrder: inputOptions.experimental?.strictExecutionOrder,
|
|
3978
|
-
disableLiveBindings: inputOptions.experimental?.disableLiveBindings,
|
|
3979
|
-
viteMode: inputOptions.experimental?.viteMode,
|
|
3980
|
-
resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
|
|
3981
|
-
hmr: bindingifyHmr(inputOptions.experimental?.hmr),
|
|
3982
|
-
attachDebugInfo: bindingifyAttachDebugInfo(inputOptions.experimental?.attachDebugInfo)
|
|
3983
|
-
},
|
|
3976
|
+
experimental: bindingifyExperimental(inputOptions.experimental),
|
|
3984
3977
|
profilerNames: inputOptions?.profilerNames,
|
|
3985
3978
|
jsx,
|
|
3986
3979
|
transform,
|
|
@@ -3993,7 +3986,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3993
3986
|
pluginContextData.moduleOptionMap.forEach((value, key) => {
|
|
3994
3987
|
if (value.invalidate) ret.push({
|
|
3995
3988
|
id: key,
|
|
3996
|
-
sideEffects:
|
|
3989
|
+
sideEffects: value.moduleSideEffects ?? void 0
|
|
3997
3990
|
});
|
|
3998
3991
|
});
|
|
3999
3992
|
return ret;
|
|
@@ -4035,7 +4028,29 @@ function bindingifyExternal(external) {
|
|
|
4035
4028
|
};
|
|
4036
4029
|
}
|
|
4037
4030
|
}
|
|
4031
|
+
function bindingifyExperimental(experimental) {
|
|
4032
|
+
let chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
|
|
4033
|
+
if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
|
|
4034
|
+
case "exec-order":
|
|
4035
|
+
chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
|
|
4036
|
+
break;
|
|
4037
|
+
case "module-id":
|
|
4038
|
+
chunkModulesOrder = BindingChunkModuleOrderBy.ModuleId;
|
|
4039
|
+
break;
|
|
4040
|
+
default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
|
|
4041
|
+
}
|
|
4042
|
+
return {
|
|
4043
|
+
strictExecutionOrder: experimental?.strictExecutionOrder,
|
|
4044
|
+
disableLiveBindings: experimental?.disableLiveBindings,
|
|
4045
|
+
viteMode: experimental?.viteMode,
|
|
4046
|
+
resolveNewUrlToAsset: experimental?.resolveNewUrlToAsset,
|
|
4047
|
+
hmr: bindingifyHmr(experimental?.hmr),
|
|
4048
|
+
attachDebugInfo: bindingifyAttachDebugInfo(experimental?.attachDebugInfo),
|
|
4049
|
+
chunkModulesOrder
|
|
4050
|
+
};
|
|
4051
|
+
}
|
|
4038
4052
|
function bindingifyResolve(resolve) {
|
|
4053
|
+
const yarnPnp = !!process.versions.pnp;
|
|
4039
4054
|
if (resolve) {
|
|
4040
4055
|
const { alias, extensionAlias,...rest } = resolve;
|
|
4041
4056
|
return {
|
|
@@ -4047,9 +4062,10 @@ function bindingifyResolve(resolve) {
|
|
|
4047
4062
|
target: name,
|
|
4048
4063
|
replacements: value
|
|
4049
4064
|
})) : void 0,
|
|
4065
|
+
yarnPnp,
|
|
4050
4066
|
...rest
|
|
4051
4067
|
};
|
|
4052
|
-
}
|
|
4068
|
+
} else return { yarnPnp };
|
|
4053
4069
|
}
|
|
4054
4070
|
function bindingifyInject(inject) {
|
|
4055
4071
|
if (inject) return Object.entries(inject).map(([alias, item]) => {
|
|
@@ -4303,7 +4319,7 @@ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose)
|
|
|
4303
4319
|
function transformHmrPatchOutput(output) {
|
|
4304
4320
|
handleHmrPatchOutputErrors(output);
|
|
4305
4321
|
const { patch } = output;
|
|
4306
|
-
return patch;
|
|
4322
|
+
return patch ?? void 0;
|
|
4307
4323
|
}
|
|
4308
4324
|
function handleHmrPatchOutputErrors(output) {
|
|
4309
4325
|
const rawErrors = output.errors;
|