rolldown 1.0.0-beta.34 → 1.0.0-beta.36
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.mjs +218 -229
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.d.mts +16 -4
- package/dist/experimental-index.mjs +23 -7
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.mjs +3 -4
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/shared/{binding-9k0egz6L.d.mts → binding-wK0CRIMb.d.mts} +1 -0
- package/dist/shared/{define-config-DVSr6Unb.d.mts → define-config-wxvILtDx.d.mts} +30 -3
- package/dist/shared/{load-config-CXpGBNqp.mjs → load-config-Jqw6FAJp.mjs} +4 -6
- package/dist/shared/parse-ast-index-CkDFQ-07.mjs +10847 -0
- package/dist/shared/{prompt-C5jz26Zn.mjs → prompt-DuG2i9ud.mjs} +4 -7
- package/dist/shared/{src-Chn1S4O2.mjs → src-WjgJWoNk.mjs} +141 -70
- package/package.json +33 -48
- package/dist/cli.cjs +0 -1767
- package/dist/cli.d.cts +0 -1
- package/dist/config.cjs +0 -12
- package/dist/config.d.cts +0 -10
- package/dist/experimental-index.cjs +0 -139
- package/dist/experimental-index.d.cts +0 -90
- package/dist/filter-index.cjs +0 -105
- package/dist/filter-index.d.cts +0 -4
- package/dist/index.cjs +0 -9
- package/dist/index.d.cts +0 -3
- package/dist/parallel-plugin-worker.cjs +0 -32
- package/dist/parallel-plugin-worker.d.cts +0 -1
- package/dist/parallel-plugin.cjs +0 -8
- package/dist/parallel-plugin.d.cts +0 -14
- package/dist/parse-ast-index.cjs +0 -4
- package/dist/parse-ast-index.d.cts +0 -8
- package/dist/shared/binding-D13M6Llu.d.cts +0 -1425
- package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
- package/dist/shared/define-config-D5AluabE.d.cts +0 -1394
- package/dist/shared/load-config-CefxSUnT.cjs +0 -125
- package/dist/shared/misc-DksvspN4.cjs +0 -58
- package/dist/shared/parse-ast-index-BCv3Y1TT.cjs +0 -859
- package/dist/shared/parse-ast-index-DjojK-Vf.mjs +0 -725
- package/dist/shared/prompt-QNI93ne7.cjs +0 -854
- package/dist/shared/src-djpzntWm.cjs +0 -4622
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PreRenderedChunk } from "./shared/binding-
|
|
2
|
-
import { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch } from "./shared/define-config-
|
|
1
|
+
import { PreRenderedChunk } from "./shared/binding-wK0CRIMb.mjs";
|
|
2
|
+
import { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch } from "./shared/define-config-wxvILtDx.mjs";
|
|
3
3
|
export { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./shared/parse-ast-index-
|
|
2
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-
|
|
1
|
+
import "./shared/parse-ast-index-CkDFQ-07.mjs";
|
|
2
|
+
import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-WjgJWoNk.mjs";
|
|
3
3
|
import "./shared/misc-CQeo-AFx.mjs";
|
|
4
4
|
|
|
5
5
|
export { VERSION, build, defineConfig, rolldown, watch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { registerPlugins } from "./shared/parse-ast-index-
|
|
2
|
-
import { PluginContextData, bindingifyPlugin } from "./shared/src-
|
|
1
|
+
import { registerPlugins } from "./shared/parse-ast-index-CkDFQ-07.mjs";
|
|
2
|
+
import { PluginContextData, bindingifyPlugin } from "./shared/src-WjgJWoNk.mjs";
|
|
3
3
|
import "./shared/misc-CQeo-AFx.mjs";
|
|
4
4
|
import { parentPort, workerData } from "node:worker_threads";
|
|
5
5
|
|
|
@@ -8,8 +8,7 @@ const { registryId, pluginInfos, threadNumber } = workerData;
|
|
|
8
8
|
(async () => {
|
|
9
9
|
try {
|
|
10
10
|
const plugins = await Promise.all(pluginInfos.map(async (pluginInfo) => {
|
|
11
|
-
const
|
|
12
|
-
const definePluginImpl = pluginModule.default;
|
|
11
|
+
const definePluginImpl = (await import(pluginInfo.fileUrl)).default;
|
|
13
12
|
const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
|
|
14
13
|
return {
|
|
15
14
|
index: pluginInfo.index,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { MaybePromise, Plugin } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-wK0CRIMb.mjs";
|
|
2
|
+
import { MaybePromise, Plugin } from "./shared/define-config-wxvILtDx.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/parallel-plugin-implementation.d.ts
|
|
5
5
|
type ParallelPluginImplementation = Plugin;
|
package/dist/parse-ast-index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHmrUpdate, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-
|
|
1
|
+
import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHmrUpdate, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-wK0CRIMb.mjs";
|
|
2
2
|
import { TopLevelFilterExpression } from "@rolldown/pluginutils";
|
|
3
3
|
import { Program } from "@oxc-project/types";
|
|
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 = Omit<MinifyOptions$1, "module" | "
|
|
153
|
+
type MinifyOptions = Omit<MinifyOptions$1, "module" | "sourcemap">;
|
|
154
154
|
interface ChunkingContext {
|
|
155
155
|
getModuleInfo(moduleId: string): ModuleInfo | null;
|
|
156
156
|
}
|
|
@@ -793,6 +793,8 @@ type TreeshakingOptions = {
|
|
|
793
793
|
manualPureFunctions?: readonly string[];
|
|
794
794
|
unknownGlobalSideEffects?: boolean;
|
|
795
795
|
commonjs?: boolean;
|
|
796
|
+
propertyReadSideEffects?: false | "always";
|
|
797
|
+
propertyWriteSideEffects?: false | "always";
|
|
796
798
|
};
|
|
797
799
|
//#endregion
|
|
798
800
|
//#region src/types/output-bundle.d.ts
|
|
@@ -817,11 +819,15 @@ type SourceMapInput = ExistingRawSourceMap | string | null;
|
|
|
817
819
|
declare const VERSION: string;
|
|
818
820
|
//#endregion
|
|
819
821
|
//#region src/builtin-plugin/utils.d.ts
|
|
822
|
+
declare const BuiltinClassSymbol: symbol;
|
|
820
823
|
declare class BuiltinPlugin {
|
|
821
824
|
name: BindingBuiltinPluginName;
|
|
822
825
|
_options?: unknown;
|
|
823
826
|
constructor(name: BindingBuiltinPluginName, _options?: unknown);
|
|
824
827
|
}
|
|
828
|
+
interface BuiltinPlugin {
|
|
829
|
+
[BuiltinClassSymbol]: boolean;
|
|
830
|
+
}
|
|
825
831
|
//#endregion
|
|
826
832
|
//#region src/constants/plugin.d.ts
|
|
827
833
|
declare const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES: readonly ["options", "buildStart", "resolveId", "load", "transform", "moduleParsed", "buildEnd", "onLog", "resolveDynamicImport", "closeBundle", "closeWatcher", "watchChange"];
|
|
@@ -1070,6 +1076,7 @@ type HmrOptions = boolean | {
|
|
|
1070
1076
|
host?: string;
|
|
1071
1077
|
port?: number;
|
|
1072
1078
|
implement?: string;
|
|
1079
|
+
new?: boolean;
|
|
1073
1080
|
};
|
|
1074
1081
|
type OptimizationOptions = {
|
|
1075
1082
|
/**
|
|
@@ -1077,6 +1084,19 @@ type OptimizationOptions = {
|
|
|
1077
1084
|
*
|
|
1078
1085
|
* When enabled, constant values from imported modules will be inlined at their usage sites,
|
|
1079
1086
|
* potentially reducing bundle size and improving runtime performance by eliminating variable lookups.
|
|
1087
|
+
* **options**:
|
|
1088
|
+
* - `true`: equivalent to `{ mode: 'all', pass: 1 }`, enabling constant inlining for all eligible constants with a single pass.
|
|
1089
|
+
* - `false`: Disable constant inlining
|
|
1090
|
+
* - `{ mode: 'smart' | 'all', pass?: number }`:
|
|
1091
|
+
* - `mode: 'smart'`: Only inline constants in specific scenarios where it is likely to reduce bundle size and improve performance.
|
|
1092
|
+
* Smart mode inlines constants in these specific scenarios:
|
|
1093
|
+
* 1. `if (test) {} else {}` - condition expressions in if statements
|
|
1094
|
+
* 2. `test ? a : b` - condition expressions in ternary operators
|
|
1095
|
+
* 3. `test1 || test2` - logical OR expressions
|
|
1096
|
+
* 4. `test1 && test2` - logical AND expressions
|
|
1097
|
+
* 5. `test1 ?? test2` - nullish coalescing expressions
|
|
1098
|
+
* - `mode: 'all'`: Inline all imported constants wherever they are used.
|
|
1099
|
+
* - `pass`: Number of passes to perform for inlining constants.
|
|
1080
1100
|
*
|
|
1081
1101
|
* **example**
|
|
1082
1102
|
* ```js
|
|
@@ -1098,7 +1118,10 @@ type OptimizationOptions = {
|
|
|
1098
1118
|
*
|
|
1099
1119
|
* @default false
|
|
1100
1120
|
*/
|
|
1101
|
-
inlineConst?: boolean
|
|
1121
|
+
inlineConst?: boolean | {
|
|
1122
|
+
mode?: "all" | "smart";
|
|
1123
|
+
pass?: number;
|
|
1124
|
+
};
|
|
1102
1125
|
};
|
|
1103
1126
|
type AttachDebugOptions = "none" | "simple" | "full";
|
|
1104
1127
|
type ChunkModulesOrder = "exec-order" | "module-id";
|
|
@@ -1136,6 +1159,10 @@ interface InputOptions {
|
|
|
1136
1159
|
mainFiles?: string[];
|
|
1137
1160
|
modules?: string[];
|
|
1138
1161
|
symlinks?: boolean;
|
|
1162
|
+
/**
|
|
1163
|
+
* @deprecated Use the top-level `tsconfig` option instead.
|
|
1164
|
+
*/
|
|
1165
|
+
tsconfigFilename?: string;
|
|
1139
1166
|
};
|
|
1140
1167
|
cwd?: string;
|
|
1141
1168
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rolldown } from "./src-
|
|
1
|
+
import { rolldown } from "./src-WjgJWoNk.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
@@ -28,9 +28,8 @@ async function bundleTsConfig(configFile, isEsm) {
|
|
|
28
28
|
transform: {
|
|
29
29
|
filter: { id: /\.[cm]?[jt]s$/ },
|
|
30
30
|
async handler(code, id) {
|
|
31
|
-
const injectValues = `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};`;
|
|
32
31
|
return {
|
|
33
|
-
code:
|
|
32
|
+
code: `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};` + code,
|
|
34
33
|
map: null
|
|
35
34
|
};
|
|
36
35
|
}
|
|
@@ -38,13 +37,12 @@ async function bundleTsConfig(configFile, isEsm) {
|
|
|
38
37
|
}]
|
|
39
38
|
});
|
|
40
39
|
const outputDir = path.dirname(configFile);
|
|
41
|
-
const
|
|
40
|
+
const fileName = (await bundle.write({
|
|
42
41
|
dir: outputDir,
|
|
43
42
|
format: isEsm ? "esm" : "cjs",
|
|
44
43
|
sourcemap: "inline",
|
|
45
44
|
entryFileNames: `rolldown.config.[hash]${path.extname(configFile).replace("ts", "js")}`
|
|
46
|
-
});
|
|
47
|
-
const fileName = result.output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
|
|
45
|
+
})).output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
|
|
48
46
|
return path.join(outputDir, fileName);
|
|
49
47
|
}
|
|
50
48
|
const SUPPORTED_JS_CONFIG_FORMATS = [
|