@module-federation/vite 1.0.0-alpha-2f53b4e → 1.0.0-alpha-b1bba84
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/README.md +16 -5
- package/lib/index.cjs +674 -333
- package/lib/index.esm.js +676 -335
- package/lib/index.modern.js +651 -336
- package/lib/index.umd.js +677 -336
- package/lib/plugins/pluginDevProxyModuleTopLevelAwait.d.ts +2 -0
- package/lib/plugins/pluginMFManifest.d.ts +3 -0
- package/lib/utils/VirtualModule.d.ts +5 -3
- package/lib/utils/normalizeModuleFederationOptions.d.ts +8 -2
- package/lib/utils/packageNameUtils.d.ts +7 -3
- package/lib/virtualModules/index.d.ts +4 -3
- package/lib/virtualModules/virtualRemoteEntry.d.ts +6 -4
- package/lib/virtualModules/virtualRemotes.d.ts +6 -8
- package/lib/virtualModules/virtualRuntimeInitStatus.d.ts +3 -0
- package/lib/virtualModules/virtualShared_preBuild.d.ts +0 -6
- package/package.json +2 -2
|
@@ -3,10 +3,12 @@ export declare const virtualPackageName = "__mf__virtual";
|
|
|
3
3
|
* Physically generate files as virtual modules under node_modules/__mf__virtual/*
|
|
4
4
|
*/
|
|
5
5
|
export default class VirtualModule {
|
|
6
|
-
|
|
6
|
+
name: string;
|
|
7
|
+
tag: string;
|
|
8
|
+
suffix: string;
|
|
7
9
|
inited: boolean;
|
|
8
|
-
|
|
9
|
-
constructor(name: string,
|
|
10
|
+
static findModule(tag: string, str?: string): VirtualModule | undefined;
|
|
11
|
+
constructor(name: string, tag?: string, suffix?: string);
|
|
10
12
|
getPath(): string;
|
|
11
13
|
getImportId(): string;
|
|
12
14
|
writeSync(code: string, force?: boolean): void;
|
|
@@ -26,6 +26,11 @@ export interface ShareItem {
|
|
|
26
26
|
from: string;
|
|
27
27
|
shareConfig: SharedConfig;
|
|
28
28
|
}
|
|
29
|
+
interface ManifestOptions {
|
|
30
|
+
filePath?: string;
|
|
31
|
+
disableAssetsAnalyze?: boolean;
|
|
32
|
+
fileName?: string;
|
|
33
|
+
}
|
|
29
34
|
export type ModuleFederationOptions = {
|
|
30
35
|
exposes?: Record<string, string | {
|
|
31
36
|
import: string;
|
|
@@ -53,7 +58,7 @@ export type ModuleFederationOptions = {
|
|
|
53
58
|
runtimePlugins?: string[];
|
|
54
59
|
getPublicPath?: any;
|
|
55
60
|
implementation?: any;
|
|
56
|
-
manifest?:
|
|
61
|
+
manifest?: ManifestOptions | boolean;
|
|
57
62
|
dev?: any;
|
|
58
63
|
dts?: any;
|
|
59
64
|
};
|
|
@@ -75,10 +80,11 @@ export interface NormalizedModuleFederationOptions {
|
|
|
75
80
|
runtimePlugins: string[];
|
|
76
81
|
getPublicPath: any;
|
|
77
82
|
implementation: any;
|
|
78
|
-
manifest:
|
|
83
|
+
manifest: ManifestOptions | boolean;
|
|
79
84
|
dev: any;
|
|
80
85
|
dts: any;
|
|
81
86
|
}
|
|
82
87
|
export declare function getNormalizeModuleFederationOptions(): NormalizedModuleFederationOptions;
|
|
88
|
+
export declare function getNormalizeShareItem(key: string): ShareItem;
|
|
83
89
|
export declare function normalizeModuleFederationOptions(options: ModuleFederationOptions): NormalizedModuleFederationOptions;
|
|
84
90
|
export {};
|
|
@@ -7,12 +7,16 @@
|
|
|
7
7
|
* . => 4
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Encodes a package name into a valid file name.
|
|
11
|
+
* @param {string} name - The package name, e.g., "@scope/xx-xx.xx".
|
|
12
|
+
* @returns {string} - The encoded file name.
|
|
11
13
|
*/
|
|
12
14
|
export declare function packageNameEncode(name: string): string;
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* Decodes an encoded file name back to the original package name.
|
|
17
|
+
* @param {string} encoded - The encoded file name, e.g., "_mf_0_scope_mf_1_xx_mf_2_xx_mf_3_xx".
|
|
18
|
+
* @returns {string} - The decoded package name.
|
|
15
19
|
*/
|
|
16
|
-
export declare function packageNameDecode(
|
|
20
|
+
export declare function packageNameDecode(encoded: string): string;
|
|
17
21
|
export declare function removePathFromNpmPackage(packageString: string): string;
|
|
18
22
|
export declare function getExtFromNpmPackage(packageString: string): string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { generateRemoteEntry, getHostAutoInitImportId, getHostAutoInitPath,
|
|
2
|
-
export { generateRemotes,
|
|
3
|
-
export {
|
|
1
|
+
export { addUsedShares, generateLocalSharedImportMap, generateRemoteEntry, getHostAutoInitImportId, getHostAutoInitPath, getLocalSharedImportMapPath, getUsedShares, REMOTE_ENTRY_ID, writeLocalSharedImportMap } from "./virtualRemoteEntry";
|
|
2
|
+
export { addUsedRemote, generateRemotes, getRemoteVirtualModule, getUsedRemotesMap } from "./virtualRemotes";
|
|
3
|
+
export { getLoadShareModulePath, getPreBuildLibImportId, LOAD_SHARE_TAG, PREBUILD_TAG, writeLoadShareModule, writePreBuildLibPath } from "./virtualShared_preBuild";
|
|
4
|
+
export { virtualRuntimeInitStatus } from "./virtualRuntimeInitStatus";
|
|
4
5
|
export declare function initVirtualModules(): void;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { NormalizedModuleFederationOptions } from '../utils/normalizeModuleFederationOptions';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function getUsedShares(): Set<string>;
|
|
3
|
+
export declare function addUsedShares(pkg: string): void;
|
|
4
|
+
export declare function getLocalSharedImportMapPath(): string;
|
|
5
|
+
export declare function writeLocalSharedImportMap(): void;
|
|
6
|
+
export declare function generateLocalSharedImportMap(): string;
|
|
7
|
+
export declare const REMOTE_ENTRY_ID = "virtual:mf-REMOTE_ENTRY_ID";
|
|
3
8
|
export declare function generateRemoteEntry(options: NormalizedModuleFederationOptions): string;
|
|
4
|
-
export declare function writeWrapRemoteEntry(): void;
|
|
5
|
-
export declare function getWrapRemoteEntryImportId(): string;
|
|
6
|
-
export declare function getWrapRemoteEntryPath(): string;
|
|
7
9
|
export declare function writeHostAutoInit(): void;
|
|
8
10
|
export declare function getHostAutoInitImportId(): string;
|
|
9
11
|
export declare function getHostAutoInitPath(): string;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import VirtualModule from
|
|
2
|
-
export declare const
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
syntheticNamedExports: string;
|
|
8
|
-
};
|
|
1
|
+
import VirtualModule from '../utils/VirtualModule';
|
|
2
|
+
export declare const LOAD_REMOTE_TAG = "__loadRemote__";
|
|
3
|
+
export declare function getRemoteVirtualModule(remote: string, command: string): VirtualModule;
|
|
4
|
+
export declare function addUsedRemote(remoteKey: string, remoteModule: string): void;
|
|
5
|
+
export declare function getUsedRemotesMap(): Record<string, Set<string>>;
|
|
6
|
+
export declare function generateRemotes(id: string, command: string): string;
|
|
@@ -9,15 +9,9 @@
|
|
|
9
9
|
* 2. __loadShare__: load shareModule (mfRuntime.loadShare('vue'))
|
|
10
10
|
*/
|
|
11
11
|
import { ShareItem } from "../utils/normalizeModuleFederationOptions";
|
|
12
|
-
import VirtualModule from "../utils/VirtualModule";
|
|
13
12
|
export declare const PREBUILD_TAG = "__prebuild__";
|
|
14
13
|
export declare function writePreBuildLibPath(pkg: string): void;
|
|
15
14
|
export declare function getPreBuildLibImportId(pkg: string): string;
|
|
16
|
-
export declare function addShare(pkg: string): void;
|
|
17
|
-
export declare const localSharedImportMapModule: VirtualModule;
|
|
18
|
-
export declare function getLocalSharedImportMapPath(): string;
|
|
19
|
-
export declare function writeLocalSharedImportMap(): Promise<void>;
|
|
20
|
-
export declare function generateLocalSharedImportMap(): Promise<string>;
|
|
21
15
|
export declare const LOAD_SHARE_TAG = "__loadShare__";
|
|
22
16
|
export declare function getLoadShareModulePath(pkg: string): string;
|
|
23
17
|
export declare function writeLoadShareModule(pkg: string, shareItem: ShareItem, command: string): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/vite",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-b1bba84",
|
|
4
4
|
"description": "Vite plugin for Module Federation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"prepare": "husky install",
|
|
14
14
|
"format": "pretty-quick",
|
|
15
|
-
"dev": "microbundle watch",
|
|
15
|
+
"dev": "microbundle watch --no-sourcemap --compress=false",
|
|
16
16
|
"build": "rimraf lib && microbundle --no-sourcemap --compress=false",
|
|
17
17
|
"dev-rv": "pnpm -filter 'examples-rust-vite*' run dev",
|
|
18
18
|
"dev-vv": "pnpm -filter 'examples-vite-vite*' run dev",
|