@module-federation/vite 1.0.0 → 1.1.1
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 +88 -54
- package/lib/index.cjs +144 -150
- package/lib/index.esm.js +144 -150
- package/lib/index.modern.js +158 -164
- package/lib/index.umd.js +144 -150
- package/lib/plugins/pluginDevProxyModuleTopLevelAwait.d.ts +1 -1
- package/lib/plugins/pluginModuleParseEnd.d.ts +1 -1
- package/lib/plugins/pluginProxyRemotes.d.ts +2 -2
- package/lib/utils/__tests__/normalizeModuleFederationOption.test.d.ts +1 -0
- package/lib/utils/logUtils.d.ts +1 -0
- package/lib/utils/normalizeModuleFederationOptions.d.ts +39 -7
- package/lib/virtualModules/index.d.ts +5 -4
- package/lib/virtualModules/virtualExposes.d.ts +2 -0
- package/lib/virtualModules/virtualRuntimeInitStatus.d.ts +1 -1
- package/lib/virtualModules/virtualShared_preBuild.d.ts +5 -5
- package/package.json +11 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Plugin } from
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
2
|
export declare function PluginDevProxyModuleTopLevelAwait(): Plugin;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Dynamic shared modules, such as "react/" and "react-dom/", can only be parsed during the build process;
|
|
3
3
|
* This plugin allows me to wait until all modules are built, and then expose them together.
|
|
4
4
|
*/
|
|
5
|
-
import { Plugin } from
|
|
5
|
+
import { Plugin } from 'vite';
|
|
6
6
|
declare let parsePromise: Promise<unknown>;
|
|
7
7
|
export default function (excludeFn: Function): Plugin[];
|
|
8
8
|
export { parsePromise };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Plugin } from
|
|
2
|
-
import { NormalizedModuleFederationOptions } from
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { NormalizedModuleFederationOptions } from '../utils/normalizeModuleFederationOptions';
|
|
3
3
|
export default function (options: NormalizedModuleFederationOptions): Plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const warn: (message: string) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SharedConfig } from '@module-federation/runtime/types';
|
|
1
|
+
import { SharedConfig, ShareStrategy } from '@module-federation/runtime/types';
|
|
2
2
|
export type RemoteEntryType = 'var' | 'module' | 'assign' | 'assign-properties' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system' | string;
|
|
3
3
|
interface ExposesItem {
|
|
4
4
|
import: string;
|
|
@@ -45,11 +45,12 @@ export type ModuleFederationOptions = {
|
|
|
45
45
|
strictVersion?: boolean;
|
|
46
46
|
}> | undefined;
|
|
47
47
|
runtimePlugins?: string[];
|
|
48
|
-
getPublicPath?:
|
|
48
|
+
getPublicPath?: string;
|
|
49
49
|
implementation?: any;
|
|
50
50
|
manifest?: ManifestOptions | boolean;
|
|
51
|
-
dev?:
|
|
52
|
-
dts?:
|
|
51
|
+
dev?: boolean | PluginDevOptions;
|
|
52
|
+
dts?: boolean | PluginDtsOptions;
|
|
53
|
+
shareStrategy?: ShareStrategy;
|
|
53
54
|
};
|
|
54
55
|
export interface NormalizedModuleFederationOptions {
|
|
55
56
|
exposes: Record<string, ExposesItem>;
|
|
@@ -61,11 +62,42 @@ export interface NormalizedModuleFederationOptions {
|
|
|
61
62
|
shareScope: string;
|
|
62
63
|
shared: NormalizedShared;
|
|
63
64
|
runtimePlugins: string[];
|
|
64
|
-
getPublicPath: any;
|
|
65
65
|
implementation: any;
|
|
66
66
|
manifest: ManifestOptions | boolean;
|
|
67
|
-
dev
|
|
68
|
-
dts
|
|
67
|
+
dev?: boolean | PluginDevOptions;
|
|
68
|
+
dts?: boolean | PluginDtsOptions;
|
|
69
|
+
shareStrategy?: ShareStrategy;
|
|
70
|
+
getPublicPath?: string;
|
|
71
|
+
}
|
|
72
|
+
interface PluginDevOptions {
|
|
73
|
+
disableLiveReload?: boolean;
|
|
74
|
+
disableHotTypesReload?: boolean;
|
|
75
|
+
disableDynamicRemoteTypeHints?: boolean;
|
|
76
|
+
}
|
|
77
|
+
interface PluginDtsOptions {
|
|
78
|
+
generateTypes?: boolean | DtsRemoteOptions;
|
|
79
|
+
consumeTypes?: boolean | DtsHostOptions;
|
|
80
|
+
tsConfigPath?: string;
|
|
81
|
+
}
|
|
82
|
+
interface DtsRemoteOptions {
|
|
83
|
+
tsConfigPath?: string;
|
|
84
|
+
typesFolder?: string;
|
|
85
|
+
deleteTypesFolder?: boolean;
|
|
86
|
+
additionalFilesToCompile?: string[];
|
|
87
|
+
compilerInstance?: 'tsc' | 'vue-tsc';
|
|
88
|
+
compileInChildProcess?: boolean;
|
|
89
|
+
generateAPITypes?: boolean;
|
|
90
|
+
extractThirdParty?: boolean;
|
|
91
|
+
extractRemoteTypes?: boolean;
|
|
92
|
+
abortOnError?: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface DtsHostOptions {
|
|
95
|
+
typesFolder?: string;
|
|
96
|
+
abortOnError?: boolean;
|
|
97
|
+
remoteTypesFolder?: string;
|
|
98
|
+
deleteTypesFolder?: boolean;
|
|
99
|
+
maxRetries?: number;
|
|
100
|
+
consumeAPITypes?: boolean;
|
|
69
101
|
}
|
|
70
102
|
export declare function getNormalizeModuleFederationOptions(): NormalizedModuleFederationOptions;
|
|
71
103
|
export declare function getNormalizeShareItem(key: string): ShareItem;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { addUsedShares, generateLocalSharedImportMap, generateRemoteEntry, getHostAutoInitImportId, getHostAutoInitPath, getLocalSharedImportMapPath, getUsedShares, REMOTE_ENTRY_ID, writeLocalSharedImportMap } from
|
|
2
|
-
export { addUsedRemote, generateRemotes, getRemoteVirtualModule, getUsedRemotesMap } from
|
|
3
|
-
export { getLoadShareModulePath, getPreBuildLibImportId, LOAD_SHARE_TAG, PREBUILD_TAG, writeLoadShareModule, writePreBuildLibPath } from
|
|
4
|
-
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 { generateExposes, VIRTUAL_EXPOSES } from './virtualExposes';
|
|
5
|
+
export { virtualRuntimeInitStatus } from './virtualRuntimeInitStatus';
|
|
5
6
|
export declare function initVirtualModules(): void;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* You can only proxy to the real file through alias
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* shared will be proxied:
|
|
8
|
-
* 1. __prebuild__: export shareModule (pre-built source code of modules such as vue, react, etc.)
|
|
9
|
-
* 2. __loadShare__: load shareModule (mfRuntime.loadShare('vue'))
|
|
10
|
-
*/
|
|
11
|
-
import { ShareItem } from
|
|
7
|
+
* shared will be proxied:
|
|
8
|
+
* 1. __prebuild__: export shareModule (pre-built source code of modules such as vue, react, etc.)
|
|
9
|
+
* 2. __loadShare__: load shareModule (mfRuntime.loadShare('vue'))
|
|
10
|
+
*/
|
|
11
|
+
import { ShareItem } from '../utils/normalizeModuleFederationOptions';
|
|
12
12
|
export declare const PREBUILD_TAG = "__prebuild__";
|
|
13
13
|
export declare function writePreBuildLibPath(pkg: string): void;
|
|
14
14
|
export declare function getPreBuildLibImportId(pkg: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/vite",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Vite plugin for Module Federation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -11,13 +11,18 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"prepare": "husky install",
|
|
14
|
+
"fmt": "prettier --write src",
|
|
15
|
+
"fmt.check": "prettier --check src",
|
|
14
16
|
"format": "pretty-quick",
|
|
15
17
|
"dev": "microbundle watch --no-sourcemap --compress=false",
|
|
16
18
|
"build": "rimraf lib && microbundle --no-sourcemap --compress=false",
|
|
17
19
|
"dev-rv": "pnpm -filter 'examples-rust-vite*' run dev",
|
|
20
|
+
"preview-rv": "pnpm -filter 'examples-rust-vite*' run preview",
|
|
18
21
|
"dev-vv": "pnpm -filter 'examples-vite-vite*' run dev",
|
|
19
22
|
"dev-nv": "pnpm -filter 'examples-nuxt-vite-host' -filter 'examples-vite-vite-remote' run dev",
|
|
20
|
-
"preview-vv": "pnpm -filter 'examples-vite-vite*' run preview"
|
|
23
|
+
"preview-vv": "pnpm -filter 'examples-vite-vite*' run preview",
|
|
24
|
+
"multi-example": "pnpm --filter \"multi-example-*\" run start",
|
|
25
|
+
"test": "vitest"
|
|
21
26
|
},
|
|
22
27
|
"repository": {
|
|
23
28
|
"type": "git",
|
|
@@ -40,17 +45,19 @@
|
|
|
40
45
|
"homepage": "https://github.com/module-federation/vite#readme",
|
|
41
46
|
"packageManager": "pnpm@9.1.3",
|
|
42
47
|
"dependencies": {
|
|
43
|
-
"@module-federation/runtime": "^0.6.
|
|
48
|
+
"@module-federation/runtime": "^0.6.8",
|
|
44
49
|
"@rollup/pluginutils": "^5.1.0",
|
|
50
|
+
"defu": "^6.1.4",
|
|
45
51
|
"estree-walker": "^2",
|
|
46
52
|
"magic-string": "^0.30.11",
|
|
47
53
|
"pathe": "^1.1.2",
|
|
48
|
-
"
|
|
54
|
+
"vitest": "^2.1.1"
|
|
49
55
|
},
|
|
50
56
|
"devDependencies": {
|
|
51
57
|
"husky": "^8.0.3",
|
|
52
58
|
"microbundle": "^0.15.1",
|
|
53
59
|
"mime-types": "^2.1.35",
|
|
60
|
+
"prettier": "3.3.3",
|
|
54
61
|
"pretty-quick": "^4.0.0",
|
|
55
62
|
"rimraf": "^6.0.1",
|
|
56
63
|
"vite": "^5.4.3"
|