@rspack-canary/browser 1.6.5-canary-a8913069-20251120042030 → 1.6.5-canary-83f58863-20251120092333

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
+ OptimizeDependencyReferencedExportsPlugin = 'OptimizeDependencyReferencedExportsPlugin',
543
544
  ContainerPlugin = 'ContainerPlugin',
544
545
  ContainerReferencePlugin = 'ContainerReferencePlugin',
545
546
  ProvideSharedPlugin = 'ProvideSharedPlugin',
546
547
  ConsumeSharedPlugin = 'ConsumeSharedPlugin',
548
+ CollectShareEntryPlugin = 'CollectShareEntryPlugin',
549
+ ShareContainerPlugin = 'ShareContainerPlugin',
547
550
  ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
548
551
  ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
549
552
  NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
@@ -1835,6 +1838,11 @@ export interface RawCircularDependencyRspackPluginOptions {
1835
1838
  onEnd?: () => void
1836
1839
  }
1837
1840
 
1841
+ export interface RawCollectShareEntryPluginOptions {
1842
+ consumes: Array<RawConsumeOptions>
1843
+ filename?: string
1844
+ }
1845
+
1838
1846
  export interface RawConsumeOptions {
1839
1847
  key: string
1840
1848
  import?: string
@@ -2582,6 +2590,19 @@ export interface RawOptimizationOptions {
2582
2590
  avoidEntryIife: boolean
2583
2591
  }
2584
2592
 
2593
+ export interface RawOptimizeDependencyReferencedExportsPluginOptions {
2594
+ shared: Array<RawOptimizeSharedConfig>
2595
+ injectUsedExports?: boolean
2596
+ manifestFileName?: string
2597
+ statsFileName?: string
2598
+ }
2599
+
2600
+ export interface RawOptimizeSharedConfig {
2601
+ shareKey: string
2602
+ treeshake: boolean
2603
+ usedExports?: Array<string>
2604
+ }
2605
+
2585
2606
  export interface RawOptions {
2586
2607
  name?: string
2587
2608
  mode?: undefined | 'production' | 'development' | 'none'
@@ -2818,6 +2839,14 @@ export interface RawRuntimeChunkOptions {
2818
2839
  name: string | ((entrypoint: { name: string }) => string)
2819
2840
  }
2820
2841
 
2842
+ export interface RawShareContainerPluginOptions {
2843
+ name: string
2844
+ request: string
2845
+ version: string
2846
+ fileName?: string
2847
+ library: JsLibraryOptions
2848
+ }
2849
+
2821
2850
  export interface RawSizeLimitsPluginOptions {
2822
2851
  assetFilter?: (assetFilename: string) => boolean
2823
2852
  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 CollectShareEntryPluginOptions = {
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 CollectShareEntryPlugin extends RspackBuiltinPlugin {
14
+ name: BuiltinPluginName;
15
+ sharedOptions: NormalizedSharedOptions;
16
+ private _collectedEntries;
17
+ constructor(options: CollectShareEntryPluginOptions);
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 IndependentSharePlugin {
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
+ }
@@ -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 OptimizeDependencyReferencedExportsPlugin 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
+ }
@@ -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,17 @@
1
+ import type { Compiler } from "../Compiler";
2
+ import type { Plugins } from "../config";
3
+ import type { ModuleFederationPluginOptions } from "../container/ModuleFederationPlugin";
4
+ export interface TreeshakeSharePluginOptions {
5
+ mfConfig: ModuleFederationPluginOptions;
6
+ plugins?: Plugins;
7
+ reshake?: boolean;
8
+ }
9
+ export declare class TreeshakeSharePlugin {
10
+ mfConfig: ModuleFederationPluginOptions;
11
+ outputDir: string;
12
+ plugins?: Plugins;
13
+ reshake?: boolean;
14
+ name: string;
15
+ constructor(options: TreeshakeSharePluginOptions);
16
+ apply(compiler: Compiler): void;
17
+ }
@@ -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-a8913069-20251120042030",
3
+ "version": "1.6.5-canary-83f58863-20251120092333",
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.",
@@ -33,7 +33,7 @@
33
33
  "@napi-rs/wasm-runtime": "1.0.7",
34
34
  "@rspack/lite-tapable": "1.1.0",
35
35
  "@swc/types": "0.1.25",
36
- "@types/watchpack": "^2.4.4",
36
+ "@types/watchpack": "^2.4.5",
37
37
  "memfs": "4.48.1",
38
38
  "webpack-sources": "3.3.3"
39
39
  },