@rspack-canary/browser 1.6.5-canary-5c09e49d-20251121173820 → 1.6.5-canary-a407d226-20251124112255

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.
@@ -540,10 +540,13 @@ export declare enum BuiltinPluginName {
540
540
  SplitChunksPlugin = 'SplitChunksPlugin',
541
541
  RemoveDuplicateModulesPlugin = 'RemoveDuplicateModulesPlugin',
542
542
  ShareRuntimePlugin = 'ShareRuntimePlugin',
543
+ SharedUsedExportsOptimizerPlugin = 'SharedUsedExportsOptimizerPlugin',
543
544
  ContainerPlugin = 'ContainerPlugin',
544
545
  ContainerReferencePlugin = 'ContainerReferencePlugin',
545
546
  ProvideSharedPlugin = 'ProvideSharedPlugin',
546
547
  ConsumeSharedPlugin = 'ConsumeSharedPlugin',
548
+ CollectSharedEntryPlugin = 'CollectSharedEntryPlugin',
549
+ ShareContainerPlugin = 'ShareContainerPlugin',
547
550
  ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
548
551
  ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
549
552
  NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
@@ -1837,6 +1840,11 @@ export interface RawCircularDependencyRspackPluginOptions {
1837
1840
  onEnd?: () => void
1838
1841
  }
1839
1842
 
1843
+ export interface RawCollectShareEntryPluginOptions {
1844
+ consumes: Array<RawConsumeOptions>
1845
+ filename?: string
1846
+ }
1847
+
1840
1848
  export interface RawConsumeOptions {
1841
1849
  key: string
1842
1850
  import?: string
@@ -2584,6 +2592,12 @@ export interface RawOptimizationOptions {
2584
2592
  avoidEntryIife: boolean
2585
2593
  }
2586
2594
 
2595
+ export interface RawOptimizeSharedConfig {
2596
+ shareKey: string
2597
+ treeshake: boolean
2598
+ usedExports?: Array<string>
2599
+ }
2600
+
2587
2601
  export interface RawOptions {
2588
2602
  name?: string
2589
2603
  mode?: undefined | 'production' | 'development' | 'none'
@@ -2820,6 +2834,21 @@ export interface RawRuntimeChunkOptions {
2820
2834
  name: string | ((entrypoint: { name: string }) => string)
2821
2835
  }
2822
2836
 
2837
+ export interface RawShareContainerPluginOptions {
2838
+ name: string
2839
+ request: string
2840
+ version: string
2841
+ fileName?: string
2842
+ library: JsLibraryOptions
2843
+ }
2844
+
2845
+ export interface RawSharedUsedExportsOptimizerPluginOptions {
2846
+ shared: Array<RawOptimizeSharedConfig>
2847
+ injectUsedExports?: boolean
2848
+ manifestFileName?: string
2849
+ statsFileName?: string
2850
+ }
2851
+
2823
2852
  export interface RawSizeLimitsPluginOptions {
2824
2853
  assetFilter?: (assetFilename: string) => boolean
2825
2854
  hints?: "error" | "warning"
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
+ }
@@ -21,6 +21,16 @@ export type ConsumesConfig = {
21
21
  singleton?: boolean;
22
22
  strictVersion?: boolean;
23
23
  };
24
+ export declare function normalizeConsumeShareOptions(consumes: Consumes, shareScope?: string): [string, {
25
+ import: string | undefined;
26
+ shareScope: string;
27
+ shareKey: string;
28
+ requiredVersion: string | false | undefined;
29
+ strictVersion: boolean;
30
+ packageName: string | undefined;
31
+ singleton: boolean;
32
+ eager: boolean;
33
+ }][];
24
34
  export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
25
35
  name: BuiltinPluginName;
26
36
  _options: {
@@ -0,0 +1,37 @@
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
+ outputFilePath?: string;
12
+ plugins?: Plugins;
13
+ treeshake?: boolean;
14
+ manifest?: ModuleFederationManifestPluginOptions;
15
+ injectUsedExports?: boolean;
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
+ outputFilePath?: string;
25
+ plugins: Plugins;
26
+ compilers: Map<string, Compiler>;
27
+ treeshake?: boolean;
28
+ manifest?: ModuleFederationManifestPluginOptions;
29
+ buildAssets: ShareFallback;
30
+ injectUsedExports?: boolean;
31
+ name: string;
32
+ constructor(options: IndependentSharePluginOptions);
33
+ apply(compiler: Compiler): void;
34
+ private createIndependentCompilers;
35
+ private createIndependentCompiler;
36
+ private cleanup;
37
+ }
@@ -24,6 +24,20 @@ type ProvidesEnhancedExtraConfig = {
24
24
  strictVersion?: boolean;
25
25
  requiredVersion?: false | string;
26
26
  };
27
+ export declare function normalizeProvideShareOptions<Enhanced extends boolean = false>(options: Provides<Enhanced>, shareScope?: string, enhanced?: boolean): [string, {
28
+ shareKey: string;
29
+ version: string | false | undefined;
30
+ shareScope: string;
31
+ eager: boolean;
32
+ } | {
33
+ singleton: boolean | undefined;
34
+ requiredVersion: string | false | undefined;
35
+ strictVersion: boolean | undefined;
36
+ shareKey: string;
37
+ version: string | false | undefined;
38
+ shareScope: string;
39
+ eager: boolean;
40
+ }][];
27
41
  export declare class ProvideSharedPlugin<Enhanced extends boolean = false> extends RspackBuiltinPlugin {
28
42
  name: BuiltinPluginName;
29
43
  _provides: [string, Omit<RawProvideOptions, "key">][];
@@ -0,0 +1,23 @@
1
+ import { type BuiltinPlugin, BuiltinPluginName, type RawShareContainerPluginOptions } from "../binding";
2
+ import { RspackBuiltinPlugin } from "../builtin-plugin/base";
3
+ import type { Compiler } from "../Compiler";
4
+ import type { LibraryOptions } from "../config";
5
+ export type ShareContainerPluginOptions = {
6
+ mfName: string;
7
+ shareName: string;
8
+ version: string;
9
+ request: string;
10
+ library?: LibraryOptions;
11
+ independentShareFileName?: string;
12
+ };
13
+ export declare class ShareContainerPlugin extends RspackBuiltinPlugin {
14
+ name: BuiltinPluginName;
15
+ filename: string;
16
+ _options: RawShareContainerPluginOptions;
17
+ _shareName: string;
18
+ _globalName: string;
19
+ constructor(options: ShareContainerPluginOptions);
20
+ getData(): string[];
21
+ raw(compiler: Compiler): BuiltinPlugin;
22
+ apply(compiler: Compiler): void;
23
+ }
@@ -19,7 +19,35 @@ export type SharedConfig = {
19
19
  singleton?: boolean;
20
20
  strictVersion?: boolean;
21
21
  version?: false | string;
22
+ treeshake?: boolean;
23
+ usedExports?: string[];
24
+ independentShareFileName?: string;
22
25
  };
26
+ export type NormalizedSharedOptions = [string, SharedConfig][];
27
+ export declare function normalizeSharedOptions(shared: Shared): NormalizedSharedOptions;
28
+ export declare function createProvideShareOptions(normalizedSharedOptions: NormalizedSharedOptions): {
29
+ [x: string]: {
30
+ shareKey: string;
31
+ shareScope: string | undefined;
32
+ version: string | false | undefined;
33
+ eager: boolean | undefined;
34
+ singleton: boolean | undefined;
35
+ requiredVersion: string | false | undefined;
36
+ strictVersion: boolean | undefined;
37
+ };
38
+ }[];
39
+ export declare function createConsumeShareOptions(normalizedSharedOptions: NormalizedSharedOptions): {
40
+ [x: string]: {
41
+ import: string | false | undefined;
42
+ shareKey: string;
43
+ shareScope: string | undefined;
44
+ requiredVersion: string | false | undefined;
45
+ strictVersion: boolean | undefined;
46
+ singleton: boolean | undefined;
47
+ packageName: string | undefined;
48
+ eager: boolean | undefined;
49
+ };
50
+ }[];
23
51
  export declare class SharePlugin {
24
52
  _shareScope: string | undefined;
25
53
  _consumes: {
@@ -46,6 +74,7 @@ export declare class SharePlugin {
46
74
  };
47
75
  }[];
48
76
  _enhanced: boolean;
77
+ _sharedOptions: NormalizedSharedOptions;
49
78
  constructor(options: SharePluginOptions);
50
79
  apply(compiler: Compiler): void;
51
80
  }
@@ -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 { SharedConfig } from "./SharePlugin";
6
+ export declare class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
7
+ name: BuiltinPluginName;
8
+ private sharedOptions;
9
+ private injectUsedExports;
10
+ private manifestOptions;
11
+ constructor(sharedOptions: [string, SharedConfig][], 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.6.5-canary-5c09e49d-20251121173820",
3
+ "version": "1.6.5-canary-a407d226-20251124112255",
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.",