@rspack-canary/browser 1.7.3-canary-8f09f616-20260116215247 → 1.7.3-canary-467a44da-20260119082229
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.
- package/dist/browser/middleware.d.ts +1 -0
- package/dist/container/ModuleFederationManifestPlugin.d.ts +10 -3
- package/dist/container/ModuleFederationPlugin.d.ts +17 -3
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +0 -5
- package/dist/exports.d.ts +3 -0
- package/dist/index.mjs +1667 -1269
- package/dist/napi-binding.d.ts +33 -5
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +13 -0
- package/dist/sharing/IndependentSharedPlugin.d.ts +35 -0
- package/dist/sharing/ProvideSharedPlugin.d.ts +19 -0
- package/dist/sharing/SharePlugin.d.ts +36 -0
- package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
- package/dist/sharing/TreeShakingSharedPlugin.d.ts +16 -0
- package/dist/sharing/utils.d.ts +1 -0
- package/dist/wasi-worker-browser.mjs +22749 -22744
- package/package.json +2 -2
- package/dist/rslib-runtime.js +0 -29
package/dist/napi-binding.d.ts
CHANGED
|
@@ -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
|
+
SharedContainerPlugin = 'SharedContainerPlugin',
|
|
547
550
|
ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
|
|
548
551
|
ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
|
|
549
552
|
NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
|
|
@@ -1839,6 +1842,11 @@ export interface RawCircularDependencyRspackPluginOptions {
|
|
|
1839
1842
|
onEnd?: () => void
|
|
1840
1843
|
}
|
|
1841
1844
|
|
|
1845
|
+
export interface RawCollectShareEntryPluginOptions {
|
|
1846
|
+
consumes: Array<RawConsumeOptions>
|
|
1847
|
+
filename?: string
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1842
1850
|
export interface RawCompilerPlatform {
|
|
1843
1851
|
web?: boolean | null
|
|
1844
1852
|
browser?: boolean | null
|
|
@@ -1859,6 +1867,7 @@ export interface RawConsumeOptions {
|
|
|
1859
1867
|
strictVersion: boolean
|
|
1860
1868
|
singleton: boolean
|
|
1861
1869
|
eager: boolean
|
|
1870
|
+
treeShakingMode?: string
|
|
1862
1871
|
}
|
|
1863
1872
|
|
|
1864
1873
|
export interface RawConsumeSharedPluginOptions {
|
|
@@ -2477,13 +2486,8 @@ export interface RawModuleFederationManifestPluginOptions {
|
|
|
2477
2486
|
buildInfo?: RawStatsBuildInfo
|
|
2478
2487
|
}
|
|
2479
2488
|
|
|
2480
|
-
export interface RawModuleFederationRuntimeExperimentsOptions {
|
|
2481
|
-
asyncStartup?: boolean
|
|
2482
|
-
}
|
|
2483
|
-
|
|
2484
2489
|
export interface RawModuleFederationRuntimePluginOptions {
|
|
2485
2490
|
entryRuntime?: string | undefined
|
|
2486
|
-
experiments?: RawModuleFederationRuntimeExperimentsOptions
|
|
2487
2491
|
}
|
|
2488
2492
|
|
|
2489
2493
|
export interface RawModuleFilenameTemplateFnCtx {
|
|
@@ -2599,6 +2603,12 @@ export interface RawOptimizationOptions {
|
|
|
2599
2603
|
avoidEntryIife: boolean
|
|
2600
2604
|
}
|
|
2601
2605
|
|
|
2606
|
+
export interface RawOptimizeSharedConfig {
|
|
2607
|
+
shareKey: string
|
|
2608
|
+
treeShaking: boolean
|
|
2609
|
+
usedExports?: Array<string>
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2602
2612
|
export interface RawOptions {
|
|
2603
2613
|
name?: string
|
|
2604
2614
|
mode?: undefined | 'production' | 'development' | 'none'
|
|
@@ -2699,6 +2709,7 @@ export interface RawProvideOptions {
|
|
|
2699
2709
|
singleton?: boolean
|
|
2700
2710
|
requiredVersion?: string | false | undefined
|
|
2701
2711
|
strictVersion?: boolean
|
|
2712
|
+
treeShakingMode?: string
|
|
2702
2713
|
}
|
|
2703
2714
|
|
|
2704
2715
|
export interface RawRelated {
|
|
@@ -2836,6 +2847,21 @@ export interface RawRuntimeChunkOptions {
|
|
|
2836
2847
|
name: string | ((entrypoint: { name: string }) => string)
|
|
2837
2848
|
}
|
|
2838
2849
|
|
|
2850
|
+
export interface RawSharedContainerPluginOptions {
|
|
2851
|
+
name: string
|
|
2852
|
+
request: string
|
|
2853
|
+
version: string
|
|
2854
|
+
fileName?: string
|
|
2855
|
+
library: JsLibraryOptions
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
export interface RawSharedUsedExportsOptimizerPluginOptions {
|
|
2859
|
+
shared: Array<RawOptimizeSharedConfig>
|
|
2860
|
+
injectTreeShakingUsedExports?: boolean
|
|
2861
|
+
manifestFileName?: string
|
|
2862
|
+
statsFileName?: string
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2839
2865
|
export interface RawSizeLimitsPluginOptions {
|
|
2840
2866
|
assetFilter?: (assetFilename: string) => boolean
|
|
2841
2867
|
hints?: "error" | "warning"
|
|
@@ -2873,6 +2899,8 @@ export interface RawSplitChunksOptions {
|
|
|
2873
2899
|
export interface RawStatsBuildInfo {
|
|
2874
2900
|
buildVersion: string
|
|
2875
2901
|
buildName?: string
|
|
2902
|
+
target?: Array<string>
|
|
2903
|
+
plugins?: Array<string>
|
|
2876
2904
|
}
|
|
2877
2905
|
|
|
2878
2906
|
export interface RawStatsOptions {
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/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,19 @@ export type ConsumesConfig = {
|
|
|
20
20
|
shareScope?: string;
|
|
21
21
|
singleton?: boolean;
|
|
22
22
|
strictVersion?: boolean;
|
|
23
|
+
treeShakingMode?: 'server-calc' | 'runtime-infer';
|
|
23
24
|
};
|
|
25
|
+
export declare function normalizeConsumeShareOptions(consumes: Consumes, shareScope?: string): [string, {
|
|
26
|
+
import: string | undefined;
|
|
27
|
+
shareScope: string;
|
|
28
|
+
shareKey: string;
|
|
29
|
+
requiredVersion: string | false | undefined;
|
|
30
|
+
strictVersion: boolean;
|
|
31
|
+
packageName: string | undefined;
|
|
32
|
+
singleton: boolean;
|
|
33
|
+
eager: boolean;
|
|
34
|
+
treeShakingMode: "server-calc" | "runtime-infer" | undefined;
|
|
35
|
+
}][];
|
|
24
36
|
export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
25
37
|
name: BuiltinPluginName;
|
|
26
38
|
_options: {
|
|
@@ -33,6 +45,7 @@ export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
|
33
45
|
packageName: string | undefined;
|
|
34
46
|
singleton: boolean;
|
|
35
47
|
eager: boolean;
|
|
48
|
+
treeShakingMode: "server-calc" | "runtime-infer" | undefined;
|
|
36
49
|
}][];
|
|
37
50
|
enhanced: boolean;
|
|
38
51
|
};
|
|
@@ -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
|
+
treeShaking?: boolean;
|
|
13
|
+
manifest?: ModuleFederationManifestPluginOptions;
|
|
14
|
+
injectTreeShakingUsedExports?: boolean;
|
|
15
|
+
treeShakingSharedExcludePlugins?: 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
|
+
treeShaking?: boolean;
|
|
26
|
+
manifest?: ModuleFederationManifestPluginOptions;
|
|
27
|
+
buildAssets: ShareFallback;
|
|
28
|
+
injectTreeShakingUsedExports?: boolean;
|
|
29
|
+
treeShakingSharedExcludePlugins?: 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
|
+
treeShakingMode?: 'server-calc' | 'runtime-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
|
+
treeShakingMode: "server-calc" | "runtime-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 TreeShakingConfig = {
|
|
13
|
+
usedExports?: string[];
|
|
14
|
+
mode?: 'server-calc' | 'runtime-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
|
+
treeShaking?: TreeShakingConfig;
|
|
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
|
+
treeShakingMode: "server-calc" | "runtime-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
|
+
treeShakingMode: "server-calc" | "runtime-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
|
+
treeShakingMode: "server-calc" | "runtime-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
|
+
treeShakingMode: "server-calc" | "runtime-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 '@rspack/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 '@rspack/binding';
|
|
2
|
+
import { BuiltinPluginName } from '@rspack/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 injectTreeShakingUsedExports;
|
|
10
|
+
private manifestOptions;
|
|
11
|
+
constructor(sharedOptions: NormalizedSharedOptions, injectTreeShakingUsedExports?: boolean, manifestOptions?: ModuleFederationManifestPluginOptions);
|
|
12
|
+
private buildOptions;
|
|
13
|
+
raw(): BuiltinPlugin | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Compiler } from '../Compiler';
|
|
2
|
+
import type { ModuleFederationPluginOptions } from '../container/ModuleFederationPlugin';
|
|
3
|
+
export interface TreeshakingSharedPluginOptions {
|
|
4
|
+
mfConfig: ModuleFederationPluginOptions;
|
|
5
|
+
secondary?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class TreeShakingSharedPlugin {
|
|
8
|
+
mfConfig: ModuleFederationPluginOptions;
|
|
9
|
+
outputDir: string;
|
|
10
|
+
secondary?: boolean;
|
|
11
|
+
private _independentSharePlugin?;
|
|
12
|
+
name: string;
|
|
13
|
+
constructor(options: TreeshakingSharedPluginOptions);
|
|
14
|
+
apply(compiler: Compiler): void;
|
|
15
|
+
get buildAssets(): import("./IndependentSharedPlugin").ShareFallback;
|
|
16
|
+
}
|
package/dist/sharing/utils.d.ts
CHANGED