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.
Files changed (44) hide show
  1. package/dist/cli.mjs +218 -229
  2. package/dist/config.d.mts +2 -2
  3. package/dist/config.mjs +3 -3
  4. package/dist/experimental-index.d.mts +16 -4
  5. package/dist/experimental-index.mjs +23 -7
  6. package/dist/filter-index.d.mts +2 -2
  7. package/dist/index.d.mts +2 -2
  8. package/dist/index.mjs +2 -2
  9. package/dist/parallel-plugin-worker.mjs +3 -4
  10. package/dist/parallel-plugin.d.mts +2 -2
  11. package/dist/parse-ast-index.d.mts +1 -1
  12. package/dist/parse-ast-index.mjs +1 -1
  13. package/dist/shared/{binding-9k0egz6L.d.mts → binding-wK0CRIMb.d.mts} +1 -0
  14. package/dist/shared/{define-config-DVSr6Unb.d.mts → define-config-wxvILtDx.d.mts} +30 -3
  15. package/dist/shared/{load-config-CXpGBNqp.mjs → load-config-Jqw6FAJp.mjs} +4 -6
  16. package/dist/shared/parse-ast-index-CkDFQ-07.mjs +10847 -0
  17. package/dist/shared/{prompt-C5jz26Zn.mjs → prompt-DuG2i9ud.mjs} +4 -7
  18. package/dist/shared/{src-Chn1S4O2.mjs → src-WjgJWoNk.mjs} +141 -70
  19. package/package.json +33 -48
  20. package/dist/cli.cjs +0 -1767
  21. package/dist/cli.d.cts +0 -1
  22. package/dist/config.cjs +0 -12
  23. package/dist/config.d.cts +0 -10
  24. package/dist/experimental-index.cjs +0 -139
  25. package/dist/experimental-index.d.cts +0 -90
  26. package/dist/filter-index.cjs +0 -105
  27. package/dist/filter-index.d.cts +0 -4
  28. package/dist/index.cjs +0 -9
  29. package/dist/index.d.cts +0 -3
  30. package/dist/parallel-plugin-worker.cjs +0 -32
  31. package/dist/parallel-plugin-worker.d.cts +0 -1
  32. package/dist/parallel-plugin.cjs +0 -8
  33. package/dist/parallel-plugin.d.cts +0 -14
  34. package/dist/parse-ast-index.cjs +0 -4
  35. package/dist/parse-ast-index.d.cts +0 -8
  36. package/dist/shared/binding-D13M6Llu.d.cts +0 -1425
  37. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  38. package/dist/shared/define-config-D5AluabE.d.cts +0 -1394
  39. package/dist/shared/load-config-CefxSUnT.cjs +0 -125
  40. package/dist/shared/misc-DksvspN4.cjs +0 -58
  41. package/dist/shared/parse-ast-index-BCv3Y1TT.cjs +0 -859
  42. package/dist/shared/parse-ast-index-DjojK-Vf.mjs +0 -725
  43. package/dist/shared/prompt-QNI93ne7.cjs +0 -854
  44. package/dist/shared/src-djpzntWm.cjs +0 -4622
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { PreRenderedChunk } from "./shared/binding-9k0egz6L.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-DVSr6Unb.mjs";
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-DjojK-Vf.mjs";
2
- import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-Chn1S4O2.mjs";
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-DjojK-Vf.mjs";
2
- import { PluginContextData, bindingifyPlugin } from "./shared/src-Chn1S4O2.mjs";
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 pluginModule = await import(pluginInfo.fileUrl);
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-9k0egz6L.mjs";
2
- import { MaybePromise, Plugin } from "./shared/define-config-DVSr6Unb.mjs";
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;
@@ -1,4 +1,4 @@
1
- import { ParseResult, ParserOptions } from "./shared/binding-9k0egz6L.mjs";
1
+ import { ParseResult, ParserOptions } from "./shared/binding-wK0CRIMb.mjs";
2
2
  import { Program } from "@oxc-project/types";
3
3
 
4
4
  //#region src/parse-ast-index.d.ts
@@ -1,3 +1,3 @@
1
- import { parseAst, parseAstAsync } from "./shared/parse-ast-index-DjojK-Vf.mjs";
1
+ import { parseAst, parseAstAsync } from "./shared/parse-ast-index-CkDFQ-07.mjs";
2
2
 
3
3
  export { parseAst, parseAstAsync };
@@ -1364,6 +1364,7 @@ interface BindingReporterPluginConfig {
1364
1364
  assetsDir: string;
1365
1365
  chunkLimit: number;
1366
1366
  shouldLogInfo: boolean;
1367
+ warnLargeChunks: boolean;
1367
1368
  reportCompressedSize: boolean;
1368
1369
  }
1369
1370
  interface BindingTransformHookExtraArgs {
@@ -1,4 +1,4 @@
1
- import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHmrUpdate, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-9k0egz6L.mjs";
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" | "codegen" | "sorucemap">;
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-Chn1S4O2.mjs";
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: injectValues + 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 result = await bundle.write({
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 = [