@rspack-debug/browser 2.0.0-beta.0 → 2.0.0-beta.1

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.
@@ -162,6 +162,7 @@ export declare class Compilation {
162
162
  Iterable<Chunk>,
163
163
  Iterable<Module>
164
164
  ], void>;
165
+ beforeModuleIds: liteTapable.SyncHook<[Iterable<Module>]>;
165
166
  finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
166
167
  chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
167
168
  chunkAsset: liteTapable.SyncHook<[Chunk, string]>;
@@ -1,6 +1,6 @@
1
1
  import { type Compiler, MultiCompiler } from '../..';
2
2
  import type { MiddlewareHandler } from '../../config/devServer';
3
- export declare const LAZY_COMPILATION_PREFIX = "/lazy-compilation-using-";
3
+ export declare const LAZY_COMPILATION_PREFIX = "/_rspack/lazy/trigger";
4
4
  /**
5
5
  * Create a middleware that handles lazy compilation requests from the client.
6
6
  * This function returns an Express-style middleware that listens for
@@ -367,7 +367,6 @@ export type Output = {
367
367
  library?: Library;
368
368
  /**
369
369
  * Output JavaScript files as module type.
370
- * Disabled by default as it's an experimental feature. To use it, you must set experiments.outputModule to true.
371
370
  * @default false
372
371
  */
373
372
  module?: OutputModule;
@@ -718,6 +717,14 @@ export type AssetParserOptions = {
718
717
  };
719
718
  export type CssParserNamedExports = boolean;
720
719
  export type CssParserUrl = boolean;
720
+ export type CssParserResolveImportContext = {
721
+ url: string;
722
+ media: string | undefined;
723
+ resourcePath: string;
724
+ supports: string | undefined;
725
+ layer: string | undefined;
726
+ };
727
+ export type CssParserResolveImport = boolean | ((context: CssParserResolveImportContext) => boolean);
721
728
  /** Options object for `css` modules. */
722
729
  export type CssParserOptions = {
723
730
  /**
@@ -730,6 +737,11 @@ export type CssParserOptions = {
730
737
  * @default true
731
738
  * */
732
739
  url?: CssParserUrl;
740
+ /**
741
+ * Allow to enable/disables `@import` at-rules handling.
742
+ * @default true
743
+ * */
744
+ resolveImport?: CssParserResolveImport;
733
745
  };
734
746
  /** Options object for `css/auto` modules. */
735
747
  export type CssAutoParserOptions = {
@@ -743,6 +755,11 @@ export type CssAutoParserOptions = {
743
755
  * @default true
744
756
  * */
745
757
  url?: CssParserUrl;
758
+ /**
759
+ * Allow to enable/disables `@import` at-rules handling.
760
+ * @default true
761
+ * */
762
+ resolveImport?: CssParserResolveImport;
746
763
  };
747
764
  /** Options object for `css/module` modules. */
748
765
  export type CssModuleParserOptions = {
@@ -756,6 +773,11 @@ export type CssModuleParserOptions = {
756
773
  * @default true
757
774
  * */
758
775
  url?: CssParserUrl;
776
+ /**
777
+ * Allow to enable/disables `@import` at-rules handling.
778
+ * @default true
779
+ * */
780
+ resolveImport?: CssParserResolveImport;
759
781
  };
760
782
  type ExportsPresence = 'error' | 'warn' | 'auto' | false;
761
783
  export type JavascriptParserCommonjsExports = boolean | 'skipInEsm';
@@ -815,15 +837,13 @@ export type JavascriptParserOptions = {
815
837
  wrappedContextRegExp?: RegExp;
816
838
  /**
817
839
  * Warn or error for using non-existent exports and conflicting re-exports.
818
- * @default 'auto'
840
+ * @default 'error'
819
841
  */
820
842
  exportsPresence?: ExportsPresence;
821
843
  /** Warn or error for using non-existent exports */
822
844
  importExportsPresence?: ExportsPresence;
823
845
  /** Warn or error for conflicting re-exports */
824
846
  reexportExportsPresence?: ExportsPresence;
825
- /** Emit errors instead of warnings when imported names don't exist in imported module. */
826
- strictExportPresence?: boolean;
827
847
  /** Provide custom syntax for Worker parsing, commonly used to support Worklet */
828
848
  worker?: string[] | boolean;
829
849
  /** Override the module to strict or non-strict. */
@@ -1299,6 +1319,12 @@ export type PersistentCacheOptions = {
1299
1319
  * @default false
1300
1320
  */
1301
1321
  portable?: boolean;
1322
+ /**
1323
+ * Enable read-only mode. When enabled, the cache will only be read from disk and never written to.
1324
+ * @description This is useful for CI environments where you want to use a pre-warmed cache without modifying it.
1325
+ * @default false
1326
+ */
1327
+ readonly?: boolean;
1302
1328
  };
1303
1329
  /**
1304
1330
  * Memory cache options.
@@ -2031,7 +2057,7 @@ export type LazyCompilationOptions = {
2031
2057
  serverUrl?: string;
2032
2058
  /**
2033
2059
  * Customize the prefix used for lazy compilation endpoint.
2034
- * @default "/lazy-compilation-using-"
2060
+ * @default "/_rspack/lazy/trigger"
2035
2061
  */
2036
2062
  prefix?: string;
2037
2063
  };
@@ -1,6 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from '../binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
3
  import type { Compiler } from '../Compiler';
4
+ import { type ModuleFederationPluginOptions } from './ModuleFederationPlugin';
4
5
  export type RemoteAliasMap = Record<string, {
5
6
  name: string;
6
7
  entry?: string;
@@ -15,7 +16,7 @@ export type ManifestSharedOption = {
15
16
  requiredVersion?: string;
16
17
  singleton?: boolean;
17
18
  };
18
- export type ModuleFederationManifestPluginOptions = {
19
+ type InternalManifestPluginOptions = {
19
20
  name?: string;
20
21
  globalName?: string;
21
22
  filePath?: string;
@@ -25,13 +26,19 @@ export type ModuleFederationManifestPluginOptions = {
25
26
  exposes?: ManifestExposeOption[];
26
27
  shared?: ManifestSharedOption[];
27
28
  };
29
+ export type ModuleFederationManifestPluginOptions = boolean | Pick<InternalManifestPluginOptions, 'disableAssetsAnalyze' | 'filePath' | 'fileName'>;
30
+ export declare function getFileName(manifestOptions: ModuleFederationManifestPluginOptions): {
31
+ statsFileName: string;
32
+ manifestFileName: string;
33
+ };
28
34
  /**
29
35
  * JS-side post-processing plugin: reads mf-manifest.json and mf-stats.json, executes additionalData callback and merges/overwrites manifest.
30
36
  * To avoid cross-NAPI callback complexity, this plugin runs at the afterProcessAssets stage to ensure Rust-side MfManifestPlugin has already output its artifacts.
31
37
  */
32
38
  export declare class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
33
39
  name: BuiltinPluginName;
34
- private opts;
35
- constructor(opts: ModuleFederationManifestPluginOptions);
40
+ private rawOpts;
41
+ constructor(opts: ModuleFederationPluginOptions);
36
42
  raw(compiler: Compiler): BuiltinPlugin;
37
43
  }
44
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { Compiler } from '../Compiler';
2
+ import type { ExternalsType } from '../config';
2
3
  import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin';
3
4
  import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1';
4
5
  import { type ModuleFederationRuntimeExperimentsOptions } from './ModuleFederationRuntimePlugin';
@@ -6,12 +7,27 @@ export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPlug
6
7
  runtimePlugins?: RuntimePlugins;
7
8
  implementation?: string;
8
9
  shareStrategy?: 'version-first' | 'loaded-first';
9
- manifest?: boolean | Omit<ModuleFederationManifestPluginOptions, 'remoteAliasMap' | 'globalName' | 'name' | 'exposes' | 'shared'>;
10
+ manifest?: ModuleFederationManifestPluginOptions;
11
+ injectTreeShakingUsedExports?: boolean;
12
+ treeShakingSharedDir?: string;
13
+ treeShakingSharedExcludePlugins?: string[];
14
+ treeShakingSharedPlugins?: string[];
10
15
  experiments?: ModuleFederationRuntimeExperimentsOptions;
11
16
  }
12
17
  export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
13
18
  export declare class ModuleFederationPlugin {
14
19
  private _options;
20
+ private _treeShakingSharedPlugin?;
15
21
  constructor(_options: ModuleFederationPluginOptions);
16
22
  apply(compiler: Compiler): void;
17
23
  }
24
+ interface RemoteInfo {
25
+ alias: string;
26
+ name?: string;
27
+ entry?: string;
28
+ externalType: ExternalsType;
29
+ shareScope: string;
30
+ }
31
+ type RemoteInfos = Record<string, RemoteInfo[]>;
32
+ export declare function getRemoteInfos(options: ModuleFederationPluginOptions): RemoteInfos;
33
+ export {};
package/dist/exports.d.ts CHANGED
@@ -43,7 +43,7 @@ type Config = {
43
43
  export declare const config: Config;
44
44
  export type * from './config';
45
45
  export declare const util: {
46
- createHash: (algorithm: "debug" | "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./util/hash").default)) => import("./util/hash").default;
46
+ createHash: (algorithm: "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./util/hash").default)) => import("./util/hash").default;
47
47
  cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
48
48
  };
49
49
  export type { BannerPluginArgument, DefinePluginOptions, EntryOptions, ProgressPluginArgument, ProvidePluginOptions, } from './builtin-plugin';
@@ -121,11 +121,14 @@ export declare const container: {
121
121
  import { ConsumeSharedPlugin } from './sharing/ConsumeSharedPlugin';
122
122
  import { ProvideSharedPlugin } from './sharing/ProvideSharedPlugin';
123
123
  import { SharePlugin } from './sharing/SharePlugin';
124
+ import { TreeShakingSharedPlugin } from './sharing/TreeShakingSharedPlugin';
124
125
  export type { ConsumeSharedPluginOptions, Consumes, ConsumesConfig, ConsumesItem, ConsumesObject, } from './sharing/ConsumeSharedPlugin';
125
126
  export type { ProvideSharedPluginOptions, Provides, ProvidesConfig, ProvidesItem, ProvidesObject, } from './sharing/ProvideSharedPlugin';
126
127
  export type { Shared, SharedConfig, SharedItem, SharedObject, SharePluginOptions, } from './sharing/SharePlugin';
128
+ export type { TreeshakingSharedPluginOptions } from './sharing/TreeShakingSharedPlugin';
127
129
  export declare const sharing: {
128
130
  ProvideSharedPlugin: typeof ProvideSharedPlugin;
131
+ TreeShakingSharedPlugin: typeof TreeShakingSharedPlugin;
129
132
  ConsumeSharedPlugin: typeof ConsumeSharedPlugin;
130
133
  SharePlugin: typeof SharePlugin;
131
134
  };