rolldown 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.
Files changed (36) hide show
  1. package/dist/cli.cjs +5 -5
  2. package/dist/cli.mjs +5 -5
  3. package/dist/config.cjs +3 -3
  4. package/dist/config.d.cts +2 -2
  5. package/dist/config.d.mts +2 -2
  6. package/dist/config.mjs +3 -3
  7. package/dist/experimental-index.cjs +2 -2
  8. package/dist/experimental-index.d.cts +2 -4
  9. package/dist/experimental-index.d.mts +2 -4
  10. package/dist/experimental-index.mjs +2 -2
  11. package/dist/experimental-runtime-types.d.ts +2 -0
  12. package/dist/filter-index.d.cts +2 -2
  13. package/dist/filter-index.d.mts +2 -2
  14. package/dist/index.cjs +2 -2
  15. package/dist/index.d.cts +2 -2
  16. package/dist/index.d.mts +2 -2
  17. package/dist/index.mjs +2 -2
  18. package/dist/parallel-plugin-worker.cjs +2 -2
  19. package/dist/parallel-plugin-worker.mjs +2 -2
  20. package/dist/parallel-plugin.d.cts +2 -2
  21. package/dist/parallel-plugin.d.mts +2 -2
  22. package/dist/parse-ast-index.cjs +1 -1
  23. package/dist/parse-ast-index.d.cts +1 -2
  24. package/dist/parse-ast-index.d.mts +1 -2
  25. package/dist/parse-ast-index.mjs +1 -1
  26. package/dist/shared/{binding-DG3bbtXG.d.cts → binding-B9-3a5q4.d.cts} +0 -2
  27. package/dist/shared/{binding-cECB-Ts3.d.mts → binding-DQYRWAqj.d.mts} +0 -2
  28. package/dist/shared/{define-config-BnlWQIlM.d.cts → define-config-DM79zlkB.d.mts} +27 -30
  29. package/dist/shared/{define-config-DLGGYzTV.d.mts → define-config-ZN70csxk.d.cts} +27 -30
  30. package/dist/shared/{load-config-xHhudbSQ.cjs → load-config-CTkl_gvX.cjs} +1 -1
  31. package/dist/shared/{load-config-CciutN6Q.mjs → load-config-FeIDZeND.mjs} +1 -1
  32. package/dist/shared/{parse-ast-index-BzYd1T7N.cjs → parse-ast-index-BZPHquvf.cjs} +4 -4
  33. package/dist/shared/{parse-ast-index-D-D8UIRn.mjs → parse-ast-index-BztFsVUE.mjs} +3 -3
  34. package/dist/shared/{src-CVZ9JbCC.mjs → src-BS7SHs-K.mjs} +56 -40
  35. package/dist/shared/{src-DJtUlfyl.cjs → src-CKVDAG8j.cjs} +56 -40
  36. package/package.json +19 -19
@@ -1,6 +1,6 @@
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-cECB-Ts3.mjs";
2
- import { TopLevelFilterExpression } from "@rolldown/pluginutils";
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";
3
2
  import { Program } from "@oxc-project/types";
3
+ import { TopLevelFilterExpression } from "@rolldown/pluginutils";
4
4
 
5
5
  //#region src/log/logging.d.ts
6
6
  type LogLevel = "info" | "debug" | "warn";
@@ -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-DJtUlfyl.cjs');
2
+ const require_src = require('./src-CKVDAG8j.cjs');
3
3
  const node_fs = require_chunk.__toESM(require("node:fs"));
4
4
  const node_path = require_chunk.__toESM(require("node:path"));
5
5
  const node_url = require_chunk.__toESM(require("node:url"));
@@ -1,4 +1,4 @@
1
- import { rolldown } from "./src-CVZ9JbCC.mjs";
1
+ import { rolldown } from "./src-BS7SHs-K.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { pathToFileURL } from "node:url";
@@ -326,7 +326,7 @@ if (!nativeBinding) {
326
326
  if (loadErrors.length > 0) throw new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors });
327
327
  throw new Error(`Failed to load native binding`);
328
328
  }
329
- const { Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parseAsync, parseSync, rawTransferSupported, ResolverFactory, EnforceExtension, ModuleType, sync, HelperMode, isolatedDeclaration, moduleRunnerTransform, transform, BindingBundleEndEventData, BindingBundleErrorEventData, BindingBundler, BindingBundlerImpl, BindingCallableBuiltinPlugin, BindingChunkingContext, BindingError, BindingHmrOutput, BindingModuleInfo, BindingNormalizedOptions, BindingOutputAsset, BindingOutputChunk, BindingOutputs, BindingPluginContext, BindingRenderedChunk, BindingRenderedChunkMeta, BindingRenderedModule, BindingTransformPluginContext, BindingWatcher, BindingWatcherChangeData, BindingWatcherEvent, ParallelJsPluginRegistry, BindingAttachDebugInfo, BindingBuiltinPluginName, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, FilterTokenKind, registerPlugins, shutdownAsyncRuntime, startAsyncRuntime } = nativeBinding;
329
+ const { Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parseAsync, parseSync, rawTransferSupported, ResolverFactory, EnforceExtension, ModuleType, sync, HelperMode, isolatedDeclaration, moduleRunnerTransform, transform, BindingBundleEndEventData, BindingBundleErrorEventData, BindingBundler, BindingBundlerImpl, BindingCallableBuiltinPlugin, BindingChunkingContext, BindingError, BindingHmrOutput, BindingModuleInfo, BindingNormalizedOptions, BindingOutputAsset, BindingOutputChunk, BindingOutputs, BindingPluginContext, BindingRenderedChunk, BindingRenderedChunkMeta, BindingRenderedModule, BindingTransformPluginContext, BindingWatcher, BindingWatcherChangeData, BindingWatcherEvent, ParallelJsPluginRegistry, BindingAttachDebugInfo, BindingBuiltinPluginName, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, FilterTokenKind, registerPlugins, shutdownAsyncRuntime, startAsyncRuntime } = nativeBinding;
330
330
 
331
331
  //#endregion
332
332
  //#region src/utils/code-frame.ts
@@ -515,7 +515,7 @@ function augmentCodeLocation(properties, pos, source, id) {
515
515
  }
516
516
 
517
517
  //#endregion
518
- //#region ../../node_modules/.pnpm/oxc-parser@0.75.1/node_modules/oxc-parser/wrap.mjs
518
+ //#region ../../node_modules/.pnpm/oxc-parser@0.76.0/node_modules/oxc-parser/wrap.mjs
519
519
  function wrap$1(result) {
520
520
  let program, module$1, comments, errors;
521
521
  return {
@@ -610,10 +610,10 @@ Object.defineProperty(exports, 'BindingCallableBuiltinPlugin', {
610
610
  return BindingCallableBuiltinPlugin;
611
611
  }
612
612
  });
613
- Object.defineProperty(exports, 'BindingHookSideEffects', {
613
+ Object.defineProperty(exports, 'BindingChunkModuleOrderBy', {
614
614
  enumerable: true,
615
615
  get: function () {
616
- return BindingHookSideEffects;
616
+ return BindingChunkModuleOrderBy;
617
617
  }
618
618
  });
619
619
  Object.defineProperty(exports, 'BindingJsx', {
@@ -353,7 +353,7 @@ if (!nativeBinding) {
353
353
  if (loadErrors.length > 0) throw new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors });
354
354
  throw new Error(`Failed to load native binding`);
355
355
  }
356
- const { Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parseAsync, parseSync, rawTransferSupported, ResolverFactory, EnforceExtension, ModuleType, sync, HelperMode, isolatedDeclaration, moduleRunnerTransform, transform, BindingBundleEndEventData, BindingBundleErrorEventData, BindingBundler, BindingBundlerImpl, BindingCallableBuiltinPlugin, BindingChunkingContext, BindingError, BindingHmrOutput, BindingModuleInfo, BindingNormalizedOptions, BindingOutputAsset, BindingOutputChunk, BindingOutputs, BindingPluginContext, BindingRenderedChunk, BindingRenderedChunkMeta, BindingRenderedModule, BindingTransformPluginContext, BindingWatcher, BindingWatcherChangeData, BindingWatcherEvent, ParallelJsPluginRegistry, BindingAttachDebugInfo, BindingBuiltinPluginName, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, FilterTokenKind, registerPlugins, shutdownAsyncRuntime, startAsyncRuntime } = nativeBinding;
356
+ const { Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parseAsync, parseSync, rawTransferSupported, ResolverFactory, EnforceExtension, ModuleType, sync, HelperMode, isolatedDeclaration, moduleRunnerTransform, transform, BindingBundleEndEventData, BindingBundleErrorEventData, BindingBundler, BindingBundlerImpl, BindingCallableBuiltinPlugin, BindingChunkingContext, BindingError, BindingHmrOutput, BindingModuleInfo, BindingNormalizedOptions, BindingOutputAsset, BindingOutputChunk, BindingOutputs, BindingPluginContext, BindingRenderedChunk, BindingRenderedChunkMeta, BindingRenderedModule, BindingTransformPluginContext, BindingWatcher, BindingWatcherChangeData, BindingWatcherEvent, ParallelJsPluginRegistry, BindingAttachDebugInfo, BindingBuiltinPluginName, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, FilterTokenKind, registerPlugins, shutdownAsyncRuntime, startAsyncRuntime } = nativeBinding;
357
357
 
358
358
  //#endregion
359
359
  //#region src/utils/code-frame.ts
@@ -542,7 +542,7 @@ function augmentCodeLocation(properties, pos, source, id) {
542
542
  }
543
543
 
544
544
  //#endregion
545
- //#region ../../node_modules/.pnpm/oxc-parser@0.75.1/node_modules/oxc-parser/wrap.mjs
545
+ //#region ../../node_modules/.pnpm/oxc-parser@0.76.0/node_modules/oxc-parser/wrap.mjs
546
546
  function wrap$1(result) {
547
547
  let program, module$1, comments, errors;
548
548
  return {
@@ -619,4 +619,4 @@ async function parseAstAsync(sourceText, options, filename) {
619
619
  }
620
620
 
621
621
  //#endregion
622
- export { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, ResolverFactory, __commonJS, __toESM, augmentCodeLocation, error, isolatedDeclaration, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, moduleRunnerTransform, parseAst, parseAstAsync, registerPlugins, shutdownAsyncRuntime, startAsyncRuntime, transform };
622
+ export { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, ResolverFactory, __commonJS, __toESM, augmentCodeLocation, error, isolatedDeclaration, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, moduleRunnerTransform, parseAst, parseAstAsync, registerPlugins, shutdownAsyncRuntime, startAsyncRuntime, transform };
@@ -1,4 +1,4 @@
1
- import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-D-D8UIRn.mjs";
1
+ import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-BztFsVUE.mjs";
2
2
  import { arraify, noop, unimplemented, unreachable, unsupported } from "./misc-CQeo-AFx.mjs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
@@ -8,7 +8,7 @@ import os from "node:os";
8
8
  import { Worker } from "node:worker_threads";
9
9
 
10
10
  //#region package.json
11
- var version = "1.0.0-beta.24";
11
+ var version = "1.0.0-beta.25";
12
12
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
13
13
 
14
14
  //#endregion
@@ -1998,7 +1998,8 @@ const ResolveOptionsSchema = strictObject({
1998
1998
  mainFiles: optional(array(string())),
1999
1999
  modules: optional(array(string())),
2000
2000
  symlinks: optional(boolean()),
2001
- tsconfigFilename: optional(string())
2001
+ tsconfigFilename: optional(string()),
2002
+ yarnPnp: optional(boolean())
2002
2003
  });
2003
2004
  const TreeshakingOptionsSchema = union([boolean(), looseObject({
2004
2005
  annotations: optional(boolean()),
@@ -2048,7 +2049,8 @@ const InputOptionsSchema = strictObject({
2048
2049
  literal("none"),
2049
2050
  literal("simple"),
2050
2051
  literal("full")
2051
- ]))
2052
+ ])),
2053
+ chunkModulesOrder: optional(union([literal("module-id"), literal("exec-order")]))
2052
2054
  })),
2053
2055
  define: pipe(optional(record(string(), string())), description("Define global variables")),
2054
2056
  inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
@@ -2189,7 +2191,8 @@ const OutputOptionsSchema = strictObject({
2189
2191
  }, () => `The 'true' value is not supported`)),
2190
2192
  preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
2191
2193
  preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
2192
- virtualDirname: optional(string())
2194
+ virtualDirname: optional(string()),
2195
+ minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports"))
2193
2196
  });
2194
2197
  const getAddonDescription = (placement, wrapper) => {
2195
2198
  return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
@@ -2358,19 +2361,6 @@ function transformModuleInfo(info, option) {
2358
2361
  };
2359
2362
  }
2360
2363
 
2361
- //#endregion
2362
- //#region src/utils/transform-side-effects.ts
2363
- function bindingifySideEffects(sideEffects) {
2364
- switch (sideEffects) {
2365
- case true: return BindingHookSideEffects.True;
2366
- case false: return BindingHookSideEffects.False;
2367
- case "no-treeshake": return BindingHookSideEffects.NoTreeshake;
2368
- case null:
2369
- case void 0: return void 0;
2370
- default: throw new Error(`Unexpected side effects: ${sideEffects}`);
2371
- }
2372
- }
2373
-
2374
2364
  //#endregion
2375
2365
  //#region src/utils/transform-sourcemap.ts
2376
2366
  function isEmptySourcemapFiled(array$1) {
@@ -2387,7 +2377,7 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
2387
2377
  }
2388
2378
 
2389
2379
  //#endregion
2390
- //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
2380
+ //#region ../../node_modules/.pnpm/remeda@2.24.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
2391
2381
  function u$1(o, n, a) {
2392
2382
  let t = (r) => o(r, ...n);
2393
2383
  return a === void 0 ? t : Object.assign(t, {
@@ -2397,7 +2387,7 @@ function u$1(o, n, a) {
2397
2387
  }
2398
2388
 
2399
2389
  //#endregion
2400
- //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
2390
+ //#region ../../node_modules/.pnpm/remeda@2.24.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
2401
2391
  function u(r, n, o) {
2402
2392
  let a = r.length - n.length;
2403
2393
  if (a === 0) return r(...n);
@@ -2406,7 +2396,7 @@ function u(r, n, o) {
2406
2396
  }
2407
2397
 
2408
2398
  //#endregion
2409
- //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
2399
+ //#region ../../node_modules/.pnpm/remeda@2.24.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
2410
2400
  function d(...r) {
2411
2401
  return u(i, r);
2412
2402
  }
@@ -2613,7 +2603,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2613
2603
  });
2614
2604
  data.loadModulePromiseMap.set(id, promise$1);
2615
2605
  try {
2616
- await context.load(id, bindingifySideEffects(options.moduleSideEffects));
2606
+ await context.load(id, options.moduleSideEffects ?? void 0);
2617
2607
  } catch (e) {
2618
2608
  data.loadModulePromiseMap.delete(id);
2619
2609
  data.loadModulePromiseResolveFnMap.delete(id);
@@ -2633,6 +2623,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2633
2623
  }, void 0);
2634
2624
  const res = await this.context.resolve(source, importer, {
2635
2625
  custom: receipt,
2626
+ isEntry: options?.isEntry,
2636
2627
  skipSelf: options?.skipSelf,
2637
2628
  vitePluginCustom
2638
2629
  });
@@ -2642,7 +2633,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2642
2633
  return {
2643
2634
  ...res,
2644
2635
  external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2645
- ...info
2636
+ ...info,
2637
+ moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null
2646
2638
  };
2647
2639
  }
2648
2640
  emitFile = (file) => {
@@ -2766,7 +2758,7 @@ function bindingifyResolveId(args$1) {
2766
2758
  id: ret.id,
2767
2759
  external: ret.external,
2768
2760
  normalizeExternalId: false,
2769
- sideEffects: bindingifySideEffects(exist.moduleSideEffects)
2761
+ moduleSideEffects: exist.moduleSideEffects ?? void 0
2770
2762
  };
2771
2763
  },
2772
2764
  meta: bindingifyPluginHookMeta(meta),
@@ -2790,7 +2782,7 @@ function bindingifyResolveDynamicImport(args$1) {
2790
2782
  id: ret.id,
2791
2783
  external: ret.external
2792
2784
  };
2793
- if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
2785
+ if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
2794
2786
  args$1.pluginContextData.updateModuleOption(ret.id, {
2795
2787
  meta: ret.meta || {},
2796
2788
  moduleSideEffects: ret.moduleSideEffects || null,
@@ -2818,7 +2810,7 @@ function bindingifyTransform(args$1) {
2818
2810
  return {
2819
2811
  code: ret.code,
2820
2812
  map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, ret.map)),
2821
- sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
2813
+ moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
2822
2814
  moduleType: ret.moduleType
2823
2815
  };
2824
2816
  },
@@ -2845,7 +2837,7 @@ function bindingifyLoad(args$1) {
2845
2837
  code: ret.code,
2846
2838
  map: bindingifySourcemap$1(map),
2847
2839
  moduleType: ret.moduleType,
2848
- sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects)
2840
+ moduleSideEffects: moduleOption.moduleSideEffects ?? void 0
2849
2841
  };
2850
2842
  },
2851
2843
  meta: bindingifyPluginHookMeta(meta),
@@ -3499,7 +3491,7 @@ var ChunkingContextImpl = class {
3499
3491
  //#endregion
3500
3492
  //#region src/utils/bindingify-output-options.ts
3501
3493
  function bindingifyOutputOptions(outputOptions) {
3502
- 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;
3494
+ 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;
3503
3495
  const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
3504
3496
  return {
3505
3497
  dir,
@@ -3534,7 +3526,9 @@ function bindingifyOutputOptions(outputOptions) {
3534
3526
  preserveModules,
3535
3527
  virtualDirname,
3536
3528
  legalComments,
3537
- preserveModulesRoot
3529
+ preserveModulesRoot,
3530
+ topLevelVar,
3531
+ minifyInternalExports: outputOptions.minifyInternalExports
3538
3532
  };
3539
3533
  }
3540
3534
  function bindingifyAddon(configAddon) {
@@ -3703,6 +3697,12 @@ var NormalizedOutputOptionsImpl = class {
3703
3697
  get virtualDirname() {
3704
3698
  return this.inner.virtualDirname;
3705
3699
  }
3700
+ get topLevelVar() {
3701
+ return this.inner.topLevelVar ?? false;
3702
+ }
3703
+ get minifyInternalExports() {
3704
+ return this.inner.minifyInternalExports ?? false;
3705
+ }
3706
3706
  };
3707
3707
  function normalizeAddon(value) {
3708
3708
  if (typeof value === "function") return value;
@@ -3837,14 +3837,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3837
3837
  moduleTypes: inputOptions.moduleTypes,
3838
3838
  define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
3839
3839
  inject: bindingifyInject(inputOptions.inject),
3840
- experimental: {
3841
- strictExecutionOrder: inputOptions.experimental?.strictExecutionOrder,
3842
- disableLiveBindings: inputOptions.experimental?.disableLiveBindings,
3843
- viteMode: inputOptions.experimental?.viteMode,
3844
- resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
3845
- hmr: bindingifyHmr(inputOptions.experimental?.hmr),
3846
- attachDebugInfo: bindingifyAttachDebugInfo(inputOptions.experimental?.attachDebugInfo)
3847
- },
3840
+ experimental: bindingifyExperimental(inputOptions.experimental),
3848
3841
  profilerNames: inputOptions?.profilerNames,
3849
3842
  jsx,
3850
3843
  transform,
@@ -3857,7 +3850,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3857
3850
  pluginContextData.moduleOptionMap.forEach((value, key) => {
3858
3851
  if (value.invalidate) ret.push({
3859
3852
  id: key,
3860
- sideEffects: bindingifySideEffects(value.moduleSideEffects)
3853
+ sideEffects: value.moduleSideEffects ?? void 0
3861
3854
  });
3862
3855
  });
3863
3856
  return ret;
@@ -3899,7 +3892,29 @@ function bindingifyExternal(external) {
3899
3892
  };
3900
3893
  }
3901
3894
  }
3895
+ function bindingifyExperimental(experimental) {
3896
+ let chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3897
+ if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
3898
+ case "exec-order":
3899
+ chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
3900
+ break;
3901
+ case "module-id":
3902
+ chunkModulesOrder = BindingChunkModuleOrderBy.ModuleId;
3903
+ break;
3904
+ default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
3905
+ }
3906
+ return {
3907
+ strictExecutionOrder: experimental?.strictExecutionOrder,
3908
+ disableLiveBindings: experimental?.disableLiveBindings,
3909
+ viteMode: experimental?.viteMode,
3910
+ resolveNewUrlToAsset: experimental?.resolveNewUrlToAsset,
3911
+ hmr: bindingifyHmr(experimental?.hmr),
3912
+ attachDebugInfo: bindingifyAttachDebugInfo(experimental?.attachDebugInfo),
3913
+ chunkModulesOrder
3914
+ };
3915
+ }
3902
3916
  function bindingifyResolve(resolve) {
3917
+ const yarnPnp = !!process.versions.pnp;
3903
3918
  if (resolve) {
3904
3919
  const { alias, extensionAlias,...rest } = resolve;
3905
3920
  return {
@@ -3911,9 +3926,10 @@ function bindingifyResolve(resolve) {
3911
3926
  target: name,
3912
3927
  replacements: value
3913
3928
  })) : void 0,
3929
+ yarnPnp,
3914
3930
  ...rest
3915
3931
  };
3916
- }
3932
+ } else return { yarnPnp };
3917
3933
  }
3918
3934
  function bindingifyInject(inject) {
3919
3935
  if (inject) return Object.entries(inject).map(([alias, item]) => {
@@ -4167,7 +4183,7 @@ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose)
4167
4183
  function transformHmrPatchOutput(output) {
4168
4184
  handleHmrPatchOutputErrors(output);
4169
4185
  const { patch } = output;
4170
- return patch;
4186
+ return patch ?? void 0;
4171
4187
  }
4172
4188
  function handleHmrPatchOutputErrors(output) {
4173
4189
  const rawErrors = output.errors;