@rspack-canary/browser 1.7.0-canary-4941195f-20251224083309 → 1.7.0-canary-c8f933e3-20251224124051

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.
@@ -95,8 +95,6 @@ export interface JsSource {
95
95
  source: string | Buffer
96
96
  map?: string
97
97
  }
98
-
99
- export type CompilerId = void;
100
98
  /* -- banner.d.ts end -- */
101
99
 
102
100
  /* -- napi-rs generated below -- */
@@ -336,7 +334,6 @@ export declare class JsCompiler {
336
334
  rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void
337
335
  close(): Promise<void>
338
336
  getVirtualFileStore(): VirtualFileStore | null
339
- getCompilerId(): ExternalObject<CompilerId>
340
337
  }
341
338
 
342
339
  export declare class JsContextModuleFactoryAfterResolveData {
@@ -364,10 +361,6 @@ export declare class JsContextModuleFactoryBeforeResolveData {
364
361
  set recursive(recursive: boolean)
365
362
  }
366
363
 
367
- export declare class JsCoordinator {
368
- constructor(getServerCompilerIdJsFn: () => ExternalObject<CompilerId>)
369
- }
370
-
371
364
  export declare class JsDependencies {
372
365
  get fileDependencies(): Array<string>
373
366
  get addedFileDependencies(): Array<string>
@@ -547,10 +540,13 @@ export declare enum BuiltinPluginName {
547
540
  SplitChunksPlugin = 'SplitChunksPlugin',
548
541
  RemoveDuplicateModulesPlugin = 'RemoveDuplicateModulesPlugin',
549
542
  ShareRuntimePlugin = 'ShareRuntimePlugin',
543
+ SharedUsedExportsOptimizerPlugin = 'SharedUsedExportsOptimizerPlugin',
550
544
  ContainerPlugin = 'ContainerPlugin',
551
545
  ContainerReferencePlugin = 'ContainerReferencePlugin',
552
546
  ProvideSharedPlugin = 'ProvideSharedPlugin',
553
547
  ConsumeSharedPlugin = 'ConsumeSharedPlugin',
548
+ CollectSharedEntryPlugin = 'CollectSharedEntryPlugin',
549
+ SharedContainerPlugin = 'SharedContainerPlugin',
554
550
  ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
555
551
  ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
556
552
  NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
@@ -609,9 +605,7 @@ export declare enum BuiltinPluginName {
609
605
  LazyCompilationPlugin = 'LazyCompilationPlugin',
610
606
  ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin',
611
607
  HttpUriPlugin = 'HttpUriPlugin',
612
- CssChunkingPlugin = 'CssChunkingPlugin',
613
- RscServerPlugin = 'RscServerPlugin',
614
- RscClientPlugin = 'RscClientPlugin'
608
+ CssChunkingPlugin = 'CssChunkingPlugin'
615
609
  }
616
610
 
617
611
  export declare function cleanupGlobalTrace(): void
@@ -1847,6 +1841,11 @@ export interface RawCircularDependencyRspackPluginOptions {
1847
1841
  onEnd?: () => void
1848
1842
  }
1849
1843
 
1844
+ export interface RawCollectShareEntryPluginOptions {
1845
+ consumes: Array<RawConsumeOptions>
1846
+ filename?: string
1847
+ }
1848
+
1850
1849
  export interface RawConsumeOptions {
1851
1850
  key: string
1852
1851
  import?: string
@@ -1858,6 +1857,7 @@ export interface RawConsumeOptions {
1858
1857
  strictVersion: boolean
1859
1858
  singleton: boolean
1860
1859
  eager: boolean
1860
+ treeshakeStrategy?: string
1861
1861
  }
1862
1862
 
1863
1863
  export interface RawConsumeSharedPluginOptions {
@@ -2133,6 +2133,7 @@ export interface RawExperimentCacheOptionsPersistent {
2133
2133
  export interface RawExperiments {
2134
2134
  topLevelAwait: boolean
2135
2135
  incremental?: false | { [key: string]: boolean }
2136
+ parallelCodeSplitting: boolean
2136
2137
  rspackFuture?: RawRspackFuture
2137
2138
  cache: boolean | { type: "persistent" } & RawExperimentCacheOptionsPersistent | { type: "memory" }
2138
2139
  useInputFileSystem?: false | Array<RegExp>
@@ -2588,6 +2589,12 @@ export interface RawOptimizationOptions {
2588
2589
  avoidEntryIife: boolean
2589
2590
  }
2590
2591
 
2592
+ export interface RawOptimizeSharedConfig {
2593
+ shareKey: string
2594
+ treeshake: boolean
2595
+ usedExports?: Array<string>
2596
+ }
2597
+
2591
2598
  export interface RawOptions {
2592
2599
  name?: string
2593
2600
  mode?: undefined | 'production' | 'development' | 'none'
@@ -2688,6 +2695,7 @@ export interface RawProvideOptions {
2688
2695
  singleton?: boolean
2689
2696
  requiredVersion?: string | false | undefined
2690
2697
  strictVersion?: boolean
2698
+ treeshakeStrategy?: string
2691
2699
  }
2692
2700
 
2693
2701
  export interface RawRelated {
@@ -2824,6 +2832,21 @@ export interface RawRuntimeChunkOptions {
2824
2832
  name: string | ((entrypoint: { name: string }) => string)
2825
2833
  }
2826
2834
 
2835
+ export interface RawSharedContainerPluginOptions {
2836
+ name: string
2837
+ request: string
2838
+ version: string
2839
+ fileName?: string
2840
+ library: JsLibraryOptions
2841
+ }
2842
+
2843
+ export interface RawSharedUsedExportsOptimizerPluginOptions {
2844
+ shared: Array<RawOptimizeSharedConfig>
2845
+ injectUsedExports?: boolean
2846
+ manifestFileName?: string
2847
+ statsFileName?: string
2848
+ }
2849
+
2827
2850
  export interface RawSizeLimitsPluginOptions {
2828
2851
  assetFilter?: (assetFilename: string) => boolean
2829
2852
  hints?: "error" | "warning"
@@ -2861,6 +2884,8 @@ export interface RawSplitChunksOptions {
2861
2884
  export interface RawStatsBuildInfo {
2862
2885
  buildVersion: string
2863
2886
  buildName?: string
2887
+ target?: Array<string>
2888
+ plugins?: Array<string>
2864
2889
  }
2865
2890
 
2866
2891
  export interface RawStatsOptions {
@@ -85,7 +85,6 @@ export const JsCompilation = __napiModule.exports.JsCompilation
85
85
  export const JsCompiler = __napiModule.exports.JsCompiler
86
86
  export const JsContextModuleFactoryAfterResolveData = __napiModule.exports.JsContextModuleFactoryAfterResolveData
87
87
  export const JsContextModuleFactoryBeforeResolveData = __napiModule.exports.JsContextModuleFactoryBeforeResolveData
88
- export const JsCoordinator = __napiModule.exports.JsCoordinator
89
88
  export const JsDependencies = __napiModule.exports.JsDependencies
90
89
  export const JsEntries = __napiModule.exports.JsEntries
91
90
  export const JsExportsInfo = __napiModule.exports.JsExportsInfo
Binary file
@@ -0,0 +1,22 @@
1
+ import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
2
+ import { RspackBuiltinPlugin } from "../builtin-plugin/base";
3
+ import type { Compiler } from "../Compiler";
4
+ import { type NormalizedSharedOptions } from "./SharePlugin";
5
+ export type CollectSharedEntryPluginOptions = {
6
+ sharedOptions: NormalizedSharedOptions;
7
+ shareScope?: string;
8
+ };
9
+ export type ShareRequestsMap = Record<string, {
10
+ shareScope: string;
11
+ requests: [string, string][];
12
+ }>;
13
+ export declare class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
14
+ name: BuiltinPluginName;
15
+ sharedOptions: NormalizedSharedOptions;
16
+ private _collectedEntries;
17
+ constructor(options: CollectSharedEntryPluginOptions);
18
+ getData(): ShareRequestsMap;
19
+ getFilename(): string;
20
+ apply(compiler: Compiler): void;
21
+ raw(): BuiltinPlugin;
22
+ }
@@ -20,7 +20,22 @@ export type ConsumesConfig = {
20
20
  shareScope?: string;
21
21
  singleton?: boolean;
22
22
  strictVersion?: boolean;
23
+ /**
24
+ * Tree shaking strategy for the shared module.
25
+ */
26
+ treeshakeStrategy?: "server" | "infer";
23
27
  };
28
+ export declare function normalizeConsumeShareOptions(consumes: Consumes, shareScope?: string): [string, {
29
+ import: string | undefined;
30
+ shareScope: string;
31
+ shareKey: string;
32
+ requiredVersion: string | false | undefined;
33
+ strictVersion: boolean;
34
+ packageName: string | undefined;
35
+ singleton: boolean;
36
+ eager: boolean;
37
+ treeshakeStrategy: "server" | "infer" | undefined;
38
+ }][];
24
39
  export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
25
40
  name: BuiltinPluginName;
26
41
  _options: {
@@ -33,6 +48,7 @@ export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
33
48
  packageName: string | undefined;
34
49
  singleton: boolean;
35
50
  eager: boolean;
51
+ treeshakeStrategy: "server" | "infer" | undefined;
36
52
  }][];
37
53
  enhanced: boolean;
38
54
  };
@@ -0,0 +1,35 @@
1
+ import type { Compiler } from "../Compiler";
2
+ import type { LibraryOptions, Plugins } from "../config";
3
+ import { type ModuleFederationManifestPluginOptions } from "../container/ModuleFederationManifestPlugin";
4
+ import type { Shared, SharedConfig } from "./SharePlugin";
5
+ export type MakeRequired<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
6
+ export interface IndependentSharePluginOptions {
7
+ name: string;
8
+ shared: Shared;
9
+ library?: LibraryOptions;
10
+ outputDir?: string;
11
+ plugins?: Plugins;
12
+ treeshake?: boolean;
13
+ manifest?: ModuleFederationManifestPluginOptions;
14
+ injectUsedExports?: boolean;
15
+ treeshakeSharedExcludedPlugins?: string[];
16
+ }
17
+ export type ShareFallback = Record<string, [string, string, string][]>;
18
+ export declare class IndependentSharedPlugin {
19
+ mfName: string;
20
+ shared: Shared;
21
+ library?: LibraryOptions;
22
+ sharedOptions: [string, SharedConfig][];
23
+ outputDir: string;
24
+ plugins: Plugins;
25
+ treeshake?: boolean;
26
+ manifest?: ModuleFederationManifestPluginOptions;
27
+ buildAssets: ShareFallback;
28
+ injectUsedExports?: boolean;
29
+ treeshakeSharedExcludedPlugins?: string[];
30
+ name: string;
31
+ constructor(options: IndependentSharePluginOptions);
32
+ apply(compiler: Compiler): void;
33
+ private createIndependentCompilers;
34
+ private createIndependentCompiler;
35
+ }
@@ -23,7 +23,26 @@ type ProvidesEnhancedExtraConfig = {
23
23
  singleton?: boolean;
24
24
  strictVersion?: boolean;
25
25
  requiredVersion?: false | string;
26
+ /**
27
+ * Tree shaking strategy for the shared module.
28
+ */
29
+ treeshakeStrategy?: "server" | "infer";
26
30
  };
31
+ export declare function normalizeProvideShareOptions<Enhanced extends boolean = false>(options: Provides<Enhanced>, shareScope?: string, enhanced?: boolean): [string, {
32
+ shareKey: string;
33
+ version: string | false | undefined;
34
+ shareScope: string;
35
+ eager: boolean;
36
+ } | {
37
+ singleton: boolean | undefined;
38
+ requiredVersion: string | false | undefined;
39
+ strictVersion: boolean | undefined;
40
+ treeshakeStrategy: "server" | "infer" | undefined;
41
+ shareKey: string;
42
+ version: string | false | undefined;
43
+ shareScope: string;
44
+ eager: boolean;
45
+ }][];
27
46
  export declare class ProvideSharedPlugin<Enhanced extends boolean = false> extends RspackBuiltinPlugin {
28
47
  name: BuiltinPluginName;
29
48
  _provides: [string, Omit<RawProvideOptions, "key">][];
@@ -9,6 +9,11 @@ export type SharedItem = string;
9
9
  export type SharedObject = {
10
10
  [k: string]: SharedConfig | SharedItem;
11
11
  };
12
+ export type TreeshakeConfig = {
13
+ usedExports?: string[];
14
+ strategy?: "server" | "infer";
15
+ filename?: string;
16
+ };
12
17
  export type SharedConfig = {
13
18
  eager?: boolean;
14
19
  import?: false | SharedItem;
@@ -19,7 +24,35 @@ export type SharedConfig = {
19
24
  singleton?: boolean;
20
25
  strictVersion?: boolean;
21
26
  version?: false | string;
27
+ treeshake?: TreeshakeConfig;
22
28
  };
29
+ export type NormalizedSharedOptions = [string, SharedConfig][];
30
+ export declare function normalizeSharedOptions(shared: Shared): NormalizedSharedOptions;
31
+ export declare function createProvideShareOptions(normalizedSharedOptions: NormalizedSharedOptions): {
32
+ [x: string]: {
33
+ shareKey: string;
34
+ shareScope: string | undefined;
35
+ version: string | false | undefined;
36
+ eager: boolean | undefined;
37
+ singleton: boolean | undefined;
38
+ requiredVersion: string | false | undefined;
39
+ strictVersion: boolean | undefined;
40
+ treeshakeStrategy: "server" | "infer" | undefined;
41
+ };
42
+ }[];
43
+ export declare function createConsumeShareOptions(normalizedSharedOptions: NormalizedSharedOptions): {
44
+ [x: string]: {
45
+ import: string | false | undefined;
46
+ shareKey: string;
47
+ shareScope: string | undefined;
48
+ requiredVersion: string | false | undefined;
49
+ strictVersion: boolean | undefined;
50
+ singleton: boolean | undefined;
51
+ packageName: string | undefined;
52
+ eager: boolean | undefined;
53
+ treeshakeStrategy: "server" | "infer" | undefined;
54
+ };
55
+ }[];
23
56
  export declare class SharePlugin {
24
57
  _shareScope: string | undefined;
25
58
  _consumes: {
@@ -32,6 +65,7 @@ export declare class SharePlugin {
32
65
  singleton: boolean | undefined;
33
66
  packageName: string | undefined;
34
67
  eager: boolean | undefined;
68
+ treeshakeStrategy: "server" | "infer" | undefined;
35
69
  };
36
70
  }[];
37
71
  _provides: {
@@ -43,9 +77,11 @@ export declare class SharePlugin {
43
77
  singleton: boolean | undefined;
44
78
  requiredVersion: string | false | undefined;
45
79
  strictVersion: boolean | undefined;
80
+ treeshakeStrategy: "server" | "infer" | undefined;
46
81
  };
47
82
  }[];
48
83
  _enhanced: boolean;
84
+ _sharedOptions: NormalizedSharedOptions;
49
85
  constructor(options: SharePluginOptions);
50
86
  apply(compiler: Compiler): void;
51
87
  }
@@ -0,0 +1,23 @@
1
+ import { type BuiltinPlugin, BuiltinPluginName, type RawSharedContainerPluginOptions } from "../binding";
2
+ import { RspackBuiltinPlugin } from "../builtin-plugin/base";
3
+ import type { Compiler } from "../Compiler";
4
+ import type { LibraryOptions } from "../config";
5
+ export type SharedContainerPluginOptions = {
6
+ mfName: string;
7
+ shareName: string;
8
+ version: string;
9
+ request: string;
10
+ library?: LibraryOptions;
11
+ independentShareFileName?: string;
12
+ };
13
+ export declare class SharedContainerPlugin extends RspackBuiltinPlugin {
14
+ name: BuiltinPluginName;
15
+ filename: string;
16
+ _options: RawSharedContainerPluginOptions;
17
+ _shareName: string;
18
+ _globalName: string;
19
+ constructor(options: SharedContainerPluginOptions);
20
+ getData(): (string | undefined)[];
21
+ raw(compiler: Compiler): BuiltinPlugin;
22
+ apply(compiler: Compiler): void;
23
+ }
@@ -0,0 +1,14 @@
1
+ import type { BuiltinPlugin } from "../binding";
2
+ import { BuiltinPluginName } from "../binding";
3
+ import { RspackBuiltinPlugin } from "../builtin-plugin/base";
4
+ import { type ModuleFederationManifestPluginOptions } from "../container/ModuleFederationManifestPlugin";
5
+ import type { NormalizedSharedOptions } from "./SharePlugin";
6
+ export declare class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
7
+ name: BuiltinPluginName;
8
+ private sharedOptions;
9
+ private injectUsedExports;
10
+ private manifestOptions;
11
+ constructor(sharedOptions: NormalizedSharedOptions, injectUsedExports?: boolean, manifestOptions?: ModuleFederationManifestPluginOptions);
12
+ private buildOptions;
13
+ raw(): BuiltinPlugin | undefined;
14
+ }
@@ -0,0 +1,19 @@
1
+ import type { Compiler } from "../Compiler";
2
+ import type { Plugins } from "../config";
3
+ import type { ModuleFederationPluginOptions } from "../container/ModuleFederationPlugin";
4
+ export interface TreeshakeSharedPluginOptions {
5
+ mfConfig: ModuleFederationPluginOptions;
6
+ plugins?: Plugins;
7
+ reShake?: boolean;
8
+ }
9
+ export declare class TreeShakeSharedPlugin {
10
+ mfConfig: ModuleFederationPluginOptions;
11
+ outputDir: string;
12
+ plugins?: Plugins;
13
+ reShake?: boolean;
14
+ private _independentSharePlugin?;
15
+ name: string;
16
+ constructor(options: TreeshakeSharedPluginOptions);
17
+ apply(compiler: Compiler): void;
18
+ get buildAssets(): import("./IndependentSharedPlugin").ShareFallback;
19
+ }
@@ -1 +1,2 @@
1
1
  export declare function isRequiredVersion(str: string): boolean;
2
+ export declare const encodeName: (name: string, prefix?: string, withExt?: boolean) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/browser",
3
- "version": "1.7.0-canary-4941195f-20251224083309",
3
+ "version": "1.7.0-canary-c8f933e3-20251224124051",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",
@@ -1,8 +0,0 @@
1
- import { type Compiler } from "../../Compiler";
2
- export declare const GET_OR_INIT_BINDING: unique symbol;
3
- export declare class Coordinator {
4
- #private;
5
- constructor();
6
- applyServerCompiler(serverCompiler: Compiler): void;
7
- applyClientCompiler(clientCompiler: Compiler): void;
8
- }
@@ -1,10 +0,0 @@
1
- import type binding from "../../binding";
2
- import type { Compiler } from "../..";
3
- import { RspackBuiltinPlugin } from "../base";
4
- import { type Coordinator } from "./Coordinator";
5
- export declare class RscClientPlugin extends RspackBuiltinPlugin {
6
- #private;
7
- name: string;
8
- constructor(coordinator: Coordinator);
9
- raw(compiler: Compiler): binding.BuiltinPlugin;
10
- }
@@ -1,10 +0,0 @@
1
- import type binding from "../../binding";
2
- import type { Compiler } from "../..";
3
- import { RspackBuiltinPlugin } from "../base";
4
- import { type Coordinator } from "./Coordinator";
5
- export declare class RscServerPlugin extends RspackBuiltinPlugin {
6
- #private;
7
- name: string;
8
- constructor(coordinator: Coordinator);
9
- raw(compiler: Compiler): binding.BuiltinPlugin;
10
- }
@@ -1,19 +0,0 @@
1
- import type { RspackPluginInstance } from "../..";
2
- export declare function createRscPlugins(): {
3
- ServerPlugin: RspackPluginInstance;
4
- ClientPlugin: RspackPluginInstance;
5
- };
6
- export declare const RSC_LAYERS_NAMES: {
7
- /**
8
- * The layer for server-only runtime and picking up `react-server` export conditions.
9
- */
10
- REACT_SERVER_COMPONENTS: string;
11
- /**
12
- * Server Side Rendering layer for app.
13
- */
14
- SERVER_SIDE_RENDERING: string;
15
- /**
16
- * The browser client bundle layer for actions.
17
- */
18
- ACTION_BROWSER: string;
19
- };