@module-federation/modern-js 0.14.2 → 0.15.0
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/LICENSE +21 -0
- package/dist/cjs/cli/configPlugin.js +381 -0
- package/dist/cjs/cli/configPlugin.spec.js +114 -0
- package/dist/cjs/cli/index.js +95 -0
- package/dist/cjs/cli/mfRuntimePlugins/auto-fetch-data.js +98 -0
- package/dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js +44 -0
- package/dist/cjs/cli/mfRuntimePlugins/resolve-entry-ipv4.js +82 -0
- package/dist/cjs/cli/mfRuntimePlugins/shared-strategy.js +43 -0
- package/dist/cjs/cli/server/data-fetch-server-plugin.js +189 -0
- package/dist/cjs/cli/ssrPlugin.js +236 -0
- package/dist/cjs/cli/utils.js +90 -0
- package/dist/cjs/constant.js +78 -0
- package/dist/cjs/interfaces/bundler.js +16 -0
- package/dist/cjs/interfaces/global.js +16 -0
- package/dist/cjs/logger.js +27 -0
- package/dist/cjs/runtime/AwaitDataFetch.js +144 -0
- package/dist/cjs/runtime/createRemoteComponent.js +327 -0
- package/dist/cjs/runtime/index.js +50 -0
- package/dist/cjs/runtime/wrapNoSSR.js +35 -0
- package/dist/cjs/server/fileCache.js +84 -0
- package/dist/cjs/server/fileCache.spec.js +28 -0
- package/dist/cjs/server/index.js +58 -0
- package/dist/cjs/server/staticMiddleware.js +77 -0
- package/dist/cjs/server/staticMiddleware.spec.js +185 -0
- package/dist/cjs/ssr-runtime/SSRLiveReload.js +43 -0
- package/dist/cjs/ssr-runtime/devPlugin.js +71 -0
- package/dist/cjs/ssr-runtime/downgrade.js +114 -0
- package/dist/cjs/ssr-runtime/injectDataFetchFunctionPlugin.js +136 -0
- package/dist/cjs/types/index.js +16 -0
- package/dist/cjs/utils/dataFetch.js +211 -0
- package/dist/cjs/utils/index.js +54 -0
- package/dist/esm/cli/configPlugin.js +388 -0
- package/dist/esm/cli/configPlugin.spec.js +110 -0
- package/dist/esm/cli/index.js +90 -0
- package/dist/esm/cli/mfRuntimePlugins/auto-fetch-data.js +74 -0
- package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js +16 -0
- package/dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js +74 -0
- package/dist/esm/cli/mfRuntimePlugins/shared-strategy.js +25 -0
- package/dist/esm/cli/server/data-fetch-server-plugin.js +237 -0
- package/dist/esm/cli/ssrPlugin.js +219 -0
- package/dist/esm/cli/utils.js +53 -0
- package/dist/esm/constant.js +42 -0
- package/dist/esm/interfaces/bundler.js +0 -0
- package/dist/esm/interfaces/global.js +0 -0
- package/dist/esm/logger.js +7 -0
- package/dist/esm/runtime/AwaitDataFetch.js +131 -0
- package/dist/esm/runtime/createRemoteComponent.js +417 -0
- package/dist/esm/runtime/index.js +22 -0
- package/dist/esm/runtime/wrapNoSSR.js +12 -0
- package/dist/esm/server/fileCache.js +98 -0
- package/dist/esm/server/fileCache.spec.js +50 -0
- package/dist/esm/server/index.js +36 -0
- package/dist/esm/server/staticMiddleware.js +81 -0
- package/dist/esm/server/staticMiddleware.spec.js +328 -0
- package/dist/esm/ssr-runtime/SSRLiveReload.js +26 -0
- package/dist/esm/ssr-runtime/devPlugin.js +73 -0
- package/dist/esm/ssr-runtime/downgrade.js +150 -0
- package/dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.js +177 -0
- package/dist/esm/types/index.js +0 -0
- package/dist/esm/utils/dataFetch.js +237 -0
- package/dist/esm/utils/index.js +28 -0
- package/dist/esm-node/cli/configPlugin.js +340 -0
- package/dist/esm-node/cli/configPlugin.spec.js +91 -0
- package/dist/esm-node/cli/index.js +70 -0
- package/dist/esm-node/cli/mfRuntimePlugins/auto-fetch-data.js +68 -0
- package/dist/esm-node/cli/mfRuntimePlugins/inject-node-fetch.js +14 -0
- package/dist/esm-node/cli/mfRuntimePlugins/resolve-entry-ipv4.js +62 -0
- package/dist/esm-node/cli/mfRuntimePlugins/shared-strategy.js +23 -0
- package/dist/esm-node/cli/server/data-fetch-server-plugin.js +159 -0
- package/dist/esm-node/cli/ssrPlugin.js +200 -0
- package/dist/esm-node/cli/utils.js +53 -0
- package/dist/esm-node/constant.js +42 -0
- package/dist/esm-node/interfaces/bundler.js +0 -0
- package/dist/esm-node/interfaces/global.js +0 -0
- package/dist/esm-node/logger.js +7 -0
- package/dist/esm-node/runtime/AwaitDataFetch.js +109 -0
- package/dist/esm-node/runtime/createRemoteComponent.js +291 -0
- package/dist/esm-node/runtime/index.js +22 -0
- package/dist/esm-node/runtime/wrapNoSSR.js +11 -0
- package/dist/esm-node/server/fileCache.js +49 -0
- package/dist/esm-node/server/fileCache.spec.js +27 -0
- package/dist/esm-node/server/index.js +34 -0
- package/dist/esm-node/server/staticMiddleware.js +43 -0
- package/dist/esm-node/server/staticMiddleware.spec.js +162 -0
- package/dist/esm-node/ssr-runtime/SSRLiveReload.js +19 -0
- package/dist/esm-node/ssr-runtime/devPlugin.js +37 -0
- package/dist/esm-node/ssr-runtime/downgrade.js +88 -0
- package/dist/esm-node/ssr-runtime/injectDataFetchFunctionPlugin.js +101 -0
- package/dist/esm-node/types/index.js +0 -0
- package/dist/esm-node/utils/dataFetch.js +166 -0
- package/dist/esm-node/utils/index.js +27 -0
- package/dist/types/cli/configPlugin.d.ts +21 -0
- package/dist/types/cli/configPlugin.spec.d.ts +1 -0
- package/dist/types/cli/index.d.ts +6 -0
- package/dist/types/cli/mfRuntimePlugins/auto-fetch-data.d.ts +3 -0
- package/dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts +3 -0
- package/dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts +3 -0
- package/dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts +3 -0
- package/dist/types/cli/server/data-fetch-server-plugin.d.ts +3 -0
- package/dist/types/cli/ssrPlugin.d.ts +6 -0
- package/dist/types/cli/utils.d.ts +6 -0
- package/dist/types/constant.d.ts +25 -0
- package/dist/types/interfaces/bundler.d.ts +18 -0
- package/dist/types/interfaces/global.d.ts +27 -0
- package/dist/types/logger.d.ts +2 -0
- package/dist/types/runtime/AwaitDataFetch.d.ts +19 -0
- package/dist/types/runtime/createRemoteComponent.d.ts +26 -0
- package/dist/types/runtime/index.d.ts +10 -0
- package/dist/types/runtime/wrapNoSSR.d.ts +9 -0
- package/dist/types/server/fileCache.d.ts +14 -0
- package/dist/types/server/fileCache.spec.d.ts +1 -0
- package/dist/types/server/index.d.ts +4 -0
- package/dist/types/server/staticMiddleware.d.ts +6 -0
- package/dist/types/server/staticMiddleware.spec.d.ts +1 -0
- package/dist/types/ssr-runtime/SSRLiveReload.d.ts +1 -0
- package/dist/types/ssr-runtime/devPlugin.d.ts +2 -0
- package/dist/types/ssr-runtime/downgrade.d.ts +4 -0
- package/dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts +7 -0
- package/dist/types/types/index.d.ts +24 -0
- package/dist/types/utils/dataFetch.d.ts +26 -0
- package/dist/types/utils/index.d.ts +15 -0
- package/package.json +37 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SSRLiveReload(): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DataFetchParams, MF_SSR_DOWNGRADE, NoSSRRemoteInfo } from '../interfaces/global';
|
|
2
|
+
export declare function getDowngradeTag(): MF_SSR_DOWNGRADE;
|
|
3
|
+
export declare function callAllDowngrade(): void;
|
|
4
|
+
export declare function callDowngrade(id: string, params?: DataFetchParams, remoteInfo?: NoSSRRemoteInfo): Promise<any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RuntimePluginFuture } from '@modern-js/runtime';
|
|
2
|
+
export declare function setSSREnv({ fetchServerQuery, }: {
|
|
3
|
+
fetchServerQuery?: Record<string, unknown>;
|
|
4
|
+
}): void;
|
|
5
|
+
export declare const injectDataFetchFunctionPlugin: ({ fetchServerQuery, }: {
|
|
6
|
+
fetchServerQuery?: Record<string, unknown>;
|
|
7
|
+
}) => RuntimePluginFuture;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
2
|
+
import type { ModuleFederationPlugin as WebpackModuleFederationPlugin } from '@module-federation/enhanced';
|
|
3
|
+
import type { ModuleFederationPlugin as RspackModuleFederationPlugin } from '@module-federation/enhanced/rspack';
|
|
4
|
+
export interface PluginOptions {
|
|
5
|
+
config?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
6
|
+
configPath?: string;
|
|
7
|
+
ssr?: {
|
|
8
|
+
distOutputDir?: string;
|
|
9
|
+
} | boolean;
|
|
10
|
+
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
11
|
+
fetchServerQuery?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface InternalModernPluginOptions {
|
|
14
|
+
csrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
15
|
+
ssrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
16
|
+
distOutputDir: string;
|
|
17
|
+
originPluginOptions: PluginOptions;
|
|
18
|
+
browserPlugin?: BundlerPlugin;
|
|
19
|
+
nodePlugin?: BundlerPlugin;
|
|
20
|
+
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
21
|
+
userConfig?: PluginOptions;
|
|
22
|
+
fetchServerQuery?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export type BundlerPlugin = WebpackModuleFederationPlugin | RspackModuleFederationPlugin;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GlobalModuleInfo } from '@module-federation/sdk';
|
|
2
|
+
import type { DataFetchParams, MF_DATA_FETCH_MAP, NoSSRRemoteInfo } from '../interfaces/global';
|
|
3
|
+
import type { FederationHost } from '@module-federation/enhanced/runtime';
|
|
4
|
+
export declare const getDataFetchInfo: ({ name, alias, id, remoteSnapshot, }: {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
remoteSnapshot: GlobalModuleInfo[string];
|
|
8
|
+
alias?: string;
|
|
9
|
+
}) => {
|
|
10
|
+
dataFetchName: string;
|
|
11
|
+
dataFetchId: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
export declare function initDataFetchMap(): void;
|
|
14
|
+
export declare function getDataFetchItem(id: string): import("../interfaces/global").MF_DATA_FETCH_MAP_VALUE;
|
|
15
|
+
export declare function getDataFetchMap(): MF_DATA_FETCH_MAP;
|
|
16
|
+
export declare const flushDataFetch: () => void;
|
|
17
|
+
export declare function setDataFetchItemLoadedStatus(id: string): void;
|
|
18
|
+
export declare const wrapDataFetchId: (id?: string) => string;
|
|
19
|
+
export declare const getDataFetchIdWithErrorMsgs: (errMsgs: string) => string | undefined;
|
|
20
|
+
export declare function fetchData(id: string, params: DataFetchParams, remoteInfo?: NoSSRRemoteInfo): Promise<unknown | undefined>;
|
|
21
|
+
export declare function getDataFetchMapKey(dataFetchInfo?: ReturnType<typeof getDataFetchInfo>, hostInfo?: {
|
|
22
|
+
name: string;
|
|
23
|
+
version?: string;
|
|
24
|
+
}): string | undefined;
|
|
25
|
+
export declare function loadDataFetchModule(instance: FederationHost, id: string): Promise<(params: DataFetchParams) => Promise<unknown>>;
|
|
26
|
+
export declare function isDataLoaderExpose(exposeKey: string): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FederationHost } from '@module-federation/enhanced/runtime';
|
|
2
|
+
export declare function getLoadedRemoteInfos(id: string, instance: FederationHost | null): {
|
|
3
|
+
snapshot: import("@module-federation/sdk/.").ModuleInfo | import("@module-federation/sdk/.").ManifestProvider | import("@module-federation/sdk/.").PureEntryProvider | undefined;
|
|
4
|
+
expose: string;
|
|
5
|
+
alias?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
version?: string;
|
|
8
|
+
buildVersion?: string;
|
|
9
|
+
entry: string;
|
|
10
|
+
type: import("@module-federation/sdk/.").RemoteEntryType;
|
|
11
|
+
entryGlobalName: string;
|
|
12
|
+
shareScope: string | string[];
|
|
13
|
+
} | undefined;
|
|
14
|
+
export declare function isCSROnly(): boolean;
|
|
15
|
+
export * from './dataFetch';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -24,9 +24,13 @@
|
|
|
24
24
|
"types": "./dist/types/runtime/index.d.ts",
|
|
25
25
|
"default": "./dist/esm/runtime/index.js"
|
|
26
26
|
},
|
|
27
|
-
"./ssr-
|
|
28
|
-
"types": "./dist/types/ssr-runtime/
|
|
29
|
-
"default": "./dist/esm/ssr-runtime/
|
|
27
|
+
"./ssr-dev-plugin": {
|
|
28
|
+
"types": "./dist/types/ssr-runtime/devPlugin.d.ts",
|
|
29
|
+
"default": "./dist/esm/ssr-runtime/devPlugin.js"
|
|
30
|
+
},
|
|
31
|
+
"./ssr-inject-data-fetch-function-plugin": {
|
|
32
|
+
"types": "./dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts",
|
|
33
|
+
"default": "./dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.js"
|
|
30
34
|
},
|
|
31
35
|
"./config-plugin": {
|
|
32
36
|
"types": "./dist/types/cli/configPlugin.d.ts",
|
|
@@ -48,11 +52,20 @@
|
|
|
48
52
|
"import": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js",
|
|
49
53
|
"require": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js"
|
|
50
54
|
},
|
|
55
|
+
"./auto-fetch-data": {
|
|
56
|
+
"types": "./dist/types/cli/mfRuntimePlugins/auto-fetch-data.d.ts",
|
|
57
|
+
"import": "./dist/esm/cli/mfRuntimePlugins/auto-fetch-data.js",
|
|
58
|
+
"require": "./dist/esm/cli/mfRuntimePlugins/auto-fetch-data.js"
|
|
59
|
+
},
|
|
51
60
|
"./inject-node-fetch": {
|
|
52
61
|
"types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts",
|
|
53
62
|
"import": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js",
|
|
54
63
|
"require": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js"
|
|
55
64
|
},
|
|
65
|
+
"./data-fetch-server-plugin": {
|
|
66
|
+
"types": "./dist/types/cli/server/data-fetch-server-plugin.d.ts",
|
|
67
|
+
"default": "./dist/cjs/cli/server/data-fetch-server-plugin.js"
|
|
68
|
+
},
|
|
56
69
|
"./server": {
|
|
57
70
|
"types": "./dist/types/server/index.d.ts",
|
|
58
71
|
"default": "./dist/cjs/server/index.js"
|
|
@@ -78,9 +91,18 @@
|
|
|
78
91
|
"resolve-entry-ipv4": [
|
|
79
92
|
"./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts"
|
|
80
93
|
],
|
|
94
|
+
"auto-fetch-data": [
|
|
95
|
+
"./dist/types/cli/mfRuntimePlugins/auto-fetch-data.d.ts"
|
|
96
|
+
],
|
|
81
97
|
"inject-node-fetch": [
|
|
82
98
|
"./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts"
|
|
83
99
|
],
|
|
100
|
+
"data-fetch-server-plugin": [
|
|
101
|
+
"./dist/types/cli/server/data-fetch-server-plugin.d.ts"
|
|
102
|
+
],
|
|
103
|
+
"ssr-inject-data-fetch-function-plugin": [
|
|
104
|
+
"./dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts"
|
|
105
|
+
],
|
|
84
106
|
"server": [
|
|
85
107
|
"./dist/types/server/index.d.ts"
|
|
86
108
|
]
|
|
@@ -91,26 +113,29 @@
|
|
|
91
113
|
"author": "hanric <hanric.zhang@gmail.com>",
|
|
92
114
|
"license": "MIT",
|
|
93
115
|
"dependencies": {
|
|
116
|
+
"@modern-js/utils": "2.67.5",
|
|
94
117
|
"@modern-js/node-bundle-require": "2.67.6",
|
|
95
118
|
"fs-extra": "11.3.0",
|
|
96
119
|
"lru-cache": "10.4.3",
|
|
97
|
-
"@swc/helpers": "0.5.
|
|
120
|
+
"@swc/helpers": "^0.5.17",
|
|
98
121
|
"node-fetch": "~3.3.0",
|
|
99
122
|
"react-error-boundary": "4.1.2",
|
|
100
|
-
"@module-federation/rsbuild-plugin": "0.
|
|
101
|
-
"@module-federation/enhanced": "0.
|
|
102
|
-
"@module-federation/
|
|
103
|
-
"@module-federation/
|
|
104
|
-
"@module-federation/
|
|
123
|
+
"@module-federation/rsbuild-plugin": "0.15.0",
|
|
124
|
+
"@module-federation/enhanced": "0.15.0",
|
|
125
|
+
"@module-federation/runtime": "0.15.0",
|
|
126
|
+
"@module-federation/node": "2.7.7",
|
|
127
|
+
"@module-federation/sdk": "0.15.0",
|
|
128
|
+
"@module-federation/cli": "0.15.0"
|
|
105
129
|
},
|
|
106
130
|
"devDependencies": {
|
|
107
|
-
"@
|
|
131
|
+
"@modern-js/core": "2.67.5",
|
|
132
|
+
"@rsbuild/core": "1.3.21",
|
|
108
133
|
"@modern-js/app-tools": "2.67.6",
|
|
109
134
|
"@modern-js/server-runtime": "2.67.6",
|
|
110
135
|
"@modern-js/module-tools": "2.67.6",
|
|
111
136
|
"@modern-js/runtime": "2.67.6",
|
|
112
137
|
"@modern-js/tsconfig": "2.67.6",
|
|
113
|
-
"@module-federation/manifest": "0.
|
|
138
|
+
"@module-federation/manifest": "0.15.0"
|
|
114
139
|
},
|
|
115
140
|
"peerDependencies": {
|
|
116
141
|
"react": ">=17",
|