@module-federation/modern-js 0.0.0-next-20250526074234 → 0.0.0-next-20250527094526

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.
Files changed (109) hide show
  1. package/dist/cjs/cli/configPlugin.js +6 -8
  2. package/dist/cjs/cli/configPlugin.spec.js +1 -3
  3. package/dist/cjs/{runtime/wrapNoSSR.js → cli/constant.js} +6 -13
  4. package/dist/cjs/cli/index.js +9 -3
  5. package/dist/cjs/{logger.js → cli/logger.js} +1 -1
  6. package/dist/cjs/cli/manifest.js +3 -3
  7. package/dist/cjs/cli/ssrPlugin.js +15 -34
  8. package/dist/cjs/cli/utils.js +0 -5
  9. package/dist/cjs/constant.js +2 -49
  10. package/dist/cjs/runtime/createRemoteSSRComponent.js +201 -0
  11. package/dist/cjs/runtime/index.js +3 -15
  12. package/dist/cjs/server/fileCache.js +84 -0
  13. package/dist/cjs/server/fileCache.spec.js +28 -0
  14. package/dist/cjs/server/index.js +58 -0
  15. package/dist/cjs/server/staticMiddleware.js +77 -0
  16. package/dist/cjs/server/staticMiddleware.spec.js +185 -0
  17. package/dist/cjs/{interfaces/global.js → ssr-runtime/index.js} +8 -2
  18. package/dist/cjs/ssr-runtime/{devPlugin.js → plugin.js} +6 -9
  19. package/dist/esm/cli/configPlugin.js +7 -9
  20. package/dist/esm/cli/configPlugin.spec.js +1 -3
  21. package/dist/esm/cli/constant.js +4 -0
  22. package/dist/esm/cli/index.js +10 -3
  23. package/dist/esm/{logger.js → cli/logger.js} +1 -1
  24. package/dist/esm/cli/manifest.js +1 -1
  25. package/dist/esm/cli/ssrPlugin.js +8 -28
  26. package/dist/esm/cli/utils.js +0 -4
  27. package/dist/esm/constant.js +1 -37
  28. package/dist/esm/runtime/createRemoteSSRComponent.js +191 -0
  29. package/dist/esm/runtime/index.js +3 -13
  30. package/dist/esm/server/fileCache.js +98 -0
  31. package/dist/esm/server/fileCache.spec.js +50 -0
  32. package/dist/esm/server/index.js +36 -0
  33. package/dist/esm/server/staticMiddleware.js +81 -0
  34. package/dist/esm/server/staticMiddleware.spec.js +328 -0
  35. package/dist/esm/ssr-runtime/index.js +1 -0
  36. package/dist/esm/ssr-runtime/{devPlugin.js → plugin.js} +2 -5
  37. package/dist/esm-node/cli/configPlugin.js +7 -9
  38. package/dist/esm-node/cli/configPlugin.spec.js +1 -3
  39. package/dist/esm-node/cli/constant.js +4 -0
  40. package/dist/esm-node/cli/index.js +9 -3
  41. package/dist/esm-node/{logger.js → cli/logger.js} +1 -1
  42. package/dist/esm-node/cli/manifest.js +1 -1
  43. package/dist/esm-node/cli/ssrPlugin.js +8 -27
  44. package/dist/esm-node/cli/utils.js +0 -4
  45. package/dist/esm-node/constant.js +1 -37
  46. package/dist/esm-node/runtime/createRemoteSSRComponent.js +166 -0
  47. package/dist/esm-node/runtime/index.js +3 -13
  48. package/dist/esm-node/server/fileCache.js +49 -0
  49. package/dist/esm-node/server/fileCache.spec.js +27 -0
  50. package/dist/esm-node/server/index.js +34 -0
  51. package/dist/esm-node/server/staticMiddleware.js +43 -0
  52. package/dist/esm-node/server/staticMiddleware.spec.js +162 -0
  53. package/dist/esm-node/ssr-runtime/index.js +1 -0
  54. package/dist/esm-node/ssr-runtime/{devPlugin.js → plugin.js} +2 -5
  55. package/dist/types/cli/constant.d.ts +1 -0
  56. package/dist/types/cli/index.d.ts +0 -1
  57. package/dist/types/cli/utils.d.ts +0 -1
  58. package/dist/types/constant.d.ts +0 -23
  59. package/dist/types/runtime/createRemoteSSRComponent.d.ts +18 -0
  60. package/dist/types/runtime/index.d.ts +2 -7
  61. package/dist/types/server/fileCache.d.ts +14 -0
  62. package/dist/types/server/fileCache.spec.d.ts +1 -0
  63. package/dist/types/server/index.d.ts +4 -0
  64. package/dist/types/server/staticMiddleware.d.ts +6 -0
  65. package/dist/types/server/staticMiddleware.spec.d.ts +1 -0
  66. package/dist/types/ssr-runtime/index.d.ts +1 -0
  67. package/dist/types/ssr-runtime/plugin.d.ts +2 -0
  68. package/dist/types/types/index.d.ts +0 -2
  69. package/package.json +23 -39
  70. package/dist/cjs/cli/mfRuntimePlugins/auto-fetch-data.js +0 -98
  71. package/dist/cjs/cli/server/data-fetch-server-plugin.js +0 -192
  72. package/dist/cjs/runtime/AwaitDataFetch.js +0 -144
  73. package/dist/cjs/runtime/createRemoteComponent.js +0 -327
  74. package/dist/cjs/ssr-runtime/downgrade.js +0 -114
  75. package/dist/cjs/ssr-runtime/injectDataFetchFunctionPlugin.js +0 -136
  76. package/dist/cjs/utils/dataFetch.js +0 -211
  77. package/dist/cjs/utils/index.js +0 -54
  78. package/dist/esm/cli/mfRuntimePlugins/auto-fetch-data.js +0 -74
  79. package/dist/esm/cli/server/data-fetch-server-plugin.js +0 -240
  80. package/dist/esm/interfaces/global.js +0 -0
  81. package/dist/esm/runtime/AwaitDataFetch.js +0 -131
  82. package/dist/esm/runtime/createRemoteComponent.js +0 -417
  83. package/dist/esm/runtime/wrapNoSSR.js +0 -12
  84. package/dist/esm/ssr-runtime/downgrade.js +0 -150
  85. package/dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.js +0 -177
  86. package/dist/esm/utils/dataFetch.js +0 -237
  87. package/dist/esm/utils/index.js +0 -28
  88. package/dist/esm-node/cli/mfRuntimePlugins/auto-fetch-data.js +0 -68
  89. package/dist/esm-node/cli/server/data-fetch-server-plugin.js +0 -162
  90. package/dist/esm-node/interfaces/global.js +0 -0
  91. package/dist/esm-node/runtime/AwaitDataFetch.js +0 -109
  92. package/dist/esm-node/runtime/createRemoteComponent.js +0 -291
  93. package/dist/esm-node/runtime/wrapNoSSR.js +0 -11
  94. package/dist/esm-node/ssr-runtime/downgrade.js +0 -88
  95. package/dist/esm-node/ssr-runtime/injectDataFetchFunctionPlugin.js +0 -101
  96. package/dist/esm-node/utils/dataFetch.js +0 -166
  97. package/dist/esm-node/utils/index.js +0 -27
  98. package/dist/types/cli/mfRuntimePlugins/auto-fetch-data.d.ts +0 -3
  99. package/dist/types/cli/server/data-fetch-server-plugin.d.ts +0 -3
  100. package/dist/types/interfaces/global.d.ts +0 -27
  101. package/dist/types/runtime/AwaitDataFetch.d.ts +0 -19
  102. package/dist/types/runtime/createRemoteComponent.d.ts +0 -26
  103. package/dist/types/runtime/wrapNoSSR.d.ts +0 -9
  104. package/dist/types/ssr-runtime/devPlugin.d.ts +0 -2
  105. package/dist/types/ssr-runtime/downgrade.d.ts +0 -4
  106. package/dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts +0 -7
  107. package/dist/types/utils/dataFetch.d.ts +0 -26
  108. package/dist/types/utils/index.d.ts +0 -15
  109. /package/dist/types/{logger.d.ts → cli/logger.d.ts} +0 -0
@@ -1,101 +0,0 @@
1
- import { DATA_FETCH_FUNCTION, DOWNGRADE_KEY, FS_HREF, MF_DATA_FETCH_STATUS, MF_DATA_FETCH_TYPE } from "../constant";
2
- import logger from "../logger";
3
- import { getDataFetchMap, getDataFetchItem, initDataFetchMap } from "../utils";
4
- import { callAllDowngrade, callDowngrade, getDowngradeTag } from "./downgrade";
5
- function setSSREnv({ fetchServerQuery }) {
6
- globalThis.FEDERATION_SSR = true;
7
- globalThis.FEDERATION_SERVER_QUERY = fetchServerQuery;
8
- }
9
- const injectDataFetchFunctionPlugin = ({ fetchServerQuery }) => ({
10
- name: "@module-federation/inject-data-fetch-function-plugin",
11
- setup: (api) => {
12
- api.onBeforeRender(async () => {
13
- var _globalThis, _DATA_FETCH_FUNCTION;
14
- setSSREnv({
15
- fetchServerQuery
16
- });
17
- if (typeof window === "undefined") {
18
- return;
19
- }
20
- const dataFetchFunction = async function(options) {
21
- const [id, data, downgrade] = options;
22
- logger.debug("==========call data fetch function!");
23
- if (data) {
24
- if (!id) {
25
- throw new Error("id is required!");
26
- }
27
- if (!getDataFetchMap()) {
28
- initDataFetchMap();
29
- }
30
- const dataFetchItem = getDataFetchItem(id);
31
- if (dataFetchItem) {
32
- var _dataFetchItem__, _dataFetchItem_;
33
- (_dataFetchItem_ = dataFetchItem[1]) === null || _dataFetchItem_ === void 0 ? void 0 : (_dataFetchItem__ = _dataFetchItem_[1]) === null || _dataFetchItem__ === void 0 ? void 0 : _dataFetchItem__.call(_dataFetchItem_, data);
34
- dataFetchItem[2] = MF_DATA_FETCH_STATUS.LOADED;
35
- return;
36
- }
37
- if (!dataFetchItem) {
38
- const dataFetchMap = getDataFetchMap();
39
- let res;
40
- let rej;
41
- const p = new Promise((resolve, reject) => {
42
- res = resolve;
43
- rej = reject;
44
- });
45
- dataFetchMap[id] = [
46
- [
47
- async () => async () => {
48
- return "";
49
- },
50
- MF_DATA_FETCH_TYPE.FETCH_SERVER
51
- ],
52
- [
53
- p,
54
- res,
55
- rej
56
- ],
57
- MF_DATA_FETCH_STATUS.LOADED
58
- ];
59
- res(data);
60
- return;
61
- }
62
- }
63
- if (downgrade) {
64
- const mfDowngrade2 = getDowngradeTag();
65
- if (!mfDowngrade2) {
66
- globalThis[DOWNGRADE_KEY] = id ? [
67
- id
68
- ] : true;
69
- } else if (Array.isArray(mfDowngrade2) && id && !mfDowngrade2.includes(id)) {
70
- mfDowngrade2.push(id);
71
- }
72
- }
73
- const mfDowngrade = getDowngradeTag();
74
- if (typeof mfDowngrade === "boolean") {
75
- return callAllDowngrade();
76
- }
77
- if (Array.isArray(mfDowngrade)) {
78
- if (!id) {
79
- globalThis[DOWNGRADE_KEY] = true;
80
- return callAllDowngrade();
81
- }
82
- if (!mfDowngrade.includes(id)) {
83
- mfDowngrade.push(id);
84
- }
85
- return callDowngrade(id);
86
- }
87
- };
88
- globalThis[FS_HREF] = window.location.href;
89
- (_globalThis = globalThis)[_DATA_FETCH_FUNCTION = DATA_FETCH_FUNCTION] || (_globalThis[_DATA_FETCH_FUNCTION] = []);
90
- const dataFetch = globalThis[DATA_FETCH_FUNCTION];
91
- await Promise.all(dataFetch.map(async (options) => {
92
- await dataFetchFunction(options);
93
- }));
94
- dataFetch.push = dataFetchFunction;
95
- });
96
- }
97
- });
98
- export {
99
- injectDataFetchFunctionPlugin,
100
- setSSREnv
101
- };
@@ -1,166 +0,0 @@
1
- import { isBrowserEnv, composeKeyWithSeparator } from "@module-federation/sdk";
2
- import { isCSROnly } from "../utils";
3
- import logger from "../logger";
4
- import { callDowngrade, getDowngradeTag } from "../ssr-runtime/downgrade";
5
- import { DOWNGRADE_KEY, MF_DATA_FETCH_STATUS, WRAP_DATA_FETCH_ID_IDENTIFIER } from "../constant";
6
- import { DATA_FETCH_CLIENT_SUFFIX, DATA_FETCH_IDENTIFIER } from "@module-federation/rsbuild-plugin/constant";
7
- const getDataFetchInfo = ({ name, alias, id, remoteSnapshot }) => {
8
- if (!remoteSnapshot) {
9
- return;
10
- }
11
- if (!("modules" in remoteSnapshot)) {
12
- return;
13
- }
14
- const regex = new RegExp(`^${name}(/[^/].*|)$`);
15
- const nameOrAlias = regex.test(id) ? name : alias || name;
16
- const expose = id.replace(nameOrAlias, "");
17
- let dataFetchName = "";
18
- let dataFetchId = "";
19
- if (expose.startsWith("/")) {
20
- dataFetchName = `${expose.slice(1)}.${DATA_FETCH_IDENTIFIER}`;
21
- dataFetchId = `${id}.${DATA_FETCH_IDENTIFIER}`;
22
- } else if (expose === "") {
23
- dataFetchName = DATA_FETCH_IDENTIFIER;
24
- dataFetchId = `${id}/${DATA_FETCH_IDENTIFIER}`;
25
- } else {
26
- return;
27
- }
28
- if (!dataFetchName || !dataFetchId) {
29
- return;
30
- }
31
- if (!remoteSnapshot.modules.find((module) => module.moduleName === dataFetchName)) {
32
- return;
33
- }
34
- return {
35
- dataFetchName,
36
- dataFetchId
37
- };
38
- };
39
- function initDataFetchMap() {
40
- var _globalThis;
41
- (_globalThis = globalThis).__MF_DATA_FETCH_MAP__ || (_globalThis.__MF_DATA_FETCH_MAP__ = {});
42
- }
43
- function getDataFetchItem(id) {
44
- var _globalThis___MF_DATA_FETCH_MAP__;
45
- return (_globalThis___MF_DATA_FETCH_MAP__ = globalThis.__MF_DATA_FETCH_MAP__) === null || _globalThis___MF_DATA_FETCH_MAP__ === void 0 ? void 0 : _globalThis___MF_DATA_FETCH_MAP__[id];
46
- }
47
- function getDataFetchMap() {
48
- return globalThis.__MF_DATA_FETCH_MAP__;
49
- }
50
- const flushDataFetch = () => {
51
- globalThis.__MF_DATA_FETCH_MAP__ = {};
52
- globalThis[DOWNGRADE_KEY] = void 0;
53
- };
54
- function setDataFetchItemLoadedStatus(id) {
55
- const dataFetchItem = getDataFetchItem(id);
56
- if (!dataFetchItem) {
57
- return;
58
- }
59
- dataFetchItem[2] = MF_DATA_FETCH_STATUS.LOADED;
60
- }
61
- const wrapDataFetchId = (id) => {
62
- return `${WRAP_DATA_FETCH_ID_IDENTIFIER}${id}${WRAP_DATA_FETCH_ID_IDENTIFIER}`;
63
- };
64
- const getDataFetchIdWithErrorMsgs = (errMsgs) => {
65
- const firstIdentifierIndex = errMsgs.indexOf(WRAP_DATA_FETCH_ID_IDENTIFIER);
66
- if (firstIdentifierIndex === -1) {
67
- return void 0;
68
- }
69
- const secondIdentifierIndex = errMsgs.indexOf(WRAP_DATA_FETCH_ID_IDENTIFIER, firstIdentifierIndex + WRAP_DATA_FETCH_ID_IDENTIFIER.length);
70
- if (secondIdentifierIndex === -1) {
71
- return void 0;
72
- }
73
- return errMsgs.substring(firstIdentifierIndex + WRAP_DATA_FETCH_ID_IDENTIFIER.length, secondIdentifierIndex);
74
- };
75
- async function fetchData(id, params, remoteInfo) {
76
- const callFetchData = async () => {
77
- const item = getDataFetchItem(id);
78
- if (!item) {
79
- return;
80
- }
81
- const [fetchDataFnArr, ..._rest] = item;
82
- const fetchDataFn = await fetchDataFnArr[2];
83
- if (!fetchDataFn) {
84
- return;
85
- }
86
- return fetchDataFn(params);
87
- };
88
- if (isBrowserEnv()) {
89
- var _dataFetchItem_;
90
- const dataFetchItem = getDataFetchItem(id);
91
- if (!dataFetchItem) {
92
- throw new Error(`dataFetchItem not found, id: ${id}`);
93
- }
94
- if ((_dataFetchItem_ = dataFetchItem[1]) === null || _dataFetchItem_ === void 0 ? void 0 : _dataFetchItem_[0]) {
95
- return dataFetchItem[1][0];
96
- }
97
- if (isCSROnly()) {
98
- logger.debug("==========csr only!");
99
- return callFetchData();
100
- }
101
- if (remoteInfo) {
102
- return callDowngrade(id, params, remoteInfo);
103
- }
104
- const mfDowngrade = getDowngradeTag();
105
- if (mfDowngrade) {
106
- if (typeof mfDowngrade === "boolean") {
107
- return callDowngrade(id, {
108
- ...params,
109
- isDowngrade: true
110
- });
111
- }
112
- if (mfDowngrade.includes(id)) {
113
- return callDowngrade(id, {
114
- ...params,
115
- isDowngrade: true
116
- });
117
- }
118
- }
119
- let res;
120
- let rej;
121
- const p = new Promise((resolve, reject) => {
122
- res = resolve;
123
- rej = reject;
124
- });
125
- dataFetchItem[1] = [
126
- p,
127
- res,
128
- rej
129
- ];
130
- dataFetchItem[2] = MF_DATA_FETCH_STATUS.AWAIT;
131
- return dataFetchItem[1][0];
132
- }
133
- return callFetchData();
134
- }
135
- function getDataFetchMapKey(dataFetchInfo, hostInfo) {
136
- if (!dataFetchInfo || !hostInfo) {
137
- return;
138
- }
139
- const { dataFetchId } = dataFetchInfo;
140
- return composeKeyWithSeparator(dataFetchId, hostInfo.name, hostInfo.version);
141
- }
142
- async function loadDataFetchModule(instance, id) {
143
- return instance.loadRemote(id).then((m) => {
144
- if (m && typeof m === "object" && "fetchData" in m && typeof m.fetchData === "function") {
145
- return m.fetchData;
146
- }
147
- throw new Error(`fetchData not found in remote ${id}, ${JSON.stringify(m)}`);
148
- });
149
- }
150
- function isDataLoaderExpose(exposeKey) {
151
- return exposeKey.endsWith(DATA_FETCH_IDENTIFIER) || exposeKey.endsWith(DATA_FETCH_CLIENT_SUFFIX);
152
- }
153
- export {
154
- fetchData,
155
- flushDataFetch,
156
- getDataFetchIdWithErrorMsgs,
157
- getDataFetchInfo,
158
- getDataFetchItem,
159
- getDataFetchMap,
160
- getDataFetchMapKey,
161
- initDataFetchMap,
162
- isDataLoaderExpose,
163
- loadDataFetchModule,
164
- setDataFetchItemLoadedStatus,
165
- wrapDataFetchId
166
- };
@@ -1,27 +0,0 @@
1
- function getLoadedRemoteInfos(id, instance) {
2
- if (!instance) {
3
- return;
4
- }
5
- const { name, expose } = instance.remoteHandler.idToRemoteMap[id] || {};
6
- if (!name) {
7
- return;
8
- }
9
- const module = instance.moduleCache.get(name);
10
- if (!module) {
11
- return;
12
- }
13
- const { remoteSnapshot } = instance.snapshotHandler.getGlobalRemoteInfo(module.remoteInfo);
14
- return {
15
- ...module.remoteInfo,
16
- snapshot: remoteSnapshot,
17
- expose
18
- };
19
- }
20
- function isCSROnly() {
21
- return window._SSR_DATA === void 0;
22
- }
23
- export * from "./dataFetch";
24
- export {
25
- getLoadedRemoteInfos,
26
- isCSROnly
27
- };
@@ -1,3 +0,0 @@
1
- import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
2
- declare const autoFetchData: () => FederationRuntimePlugin;
3
- export default autoFetchData;
@@ -1,3 +0,0 @@
1
- import type { ServerPlugin } from '@modern-js/server-runtime';
2
- declare const dataFetchServePlugin: () => ServerPlugin;
3
- export default dataFetchServePlugin;
@@ -1,27 +0,0 @@
1
- import { MF_DATA_FETCH_TYPE, MF_DATA_FETCH_STATUS } from '../constant';
2
- export type DataFetchParams = {
3
- isDowngrade: boolean;
4
- } & Record<string, unknown>;
5
- export type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
6
- export type MF_DATA_FETCH_MAP_VALUE = [
7
- [
8
- () => Promise<DataFetch<unknown>>,
9
- MF_DATA_FETCH_TYPE,
10
- Promise<DataFetch<unknown>>?
11
- ],
12
- [
13
- Promise<unknown>,
14
- ((data: unknown) => void)?,
15
- ((err: unknown) => void)?
16
- ]?,
17
- MF_DATA_FETCH_STATUS?
18
- ];
19
- export type MF_DATA_FETCH_MAP = Record<string, MF_DATA_FETCH_MAP_VALUE>;
20
- export type MF_SSR_DOWNGRADE = string[] | true | undefined;
21
- export type NoSSRRemoteInfo = {
22
- name: string;
23
- version: string;
24
- ssrPublicPath: string;
25
- ssrRemoteEntry: string;
26
- globalName: string;
27
- };
@@ -1,19 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import type { DataFetchParams } from '../interfaces/global';
3
- export type ErrorInfo = {
4
- error: Error;
5
- errorType: number;
6
- dataFetchMapKey?: string;
7
- };
8
- export declare const transformError: (err: string | Error) => ErrorInfo;
9
- export interface AwaitProps<T> {
10
- resolve: T | Promise<T>;
11
- loading?: ReactNode;
12
- errorElement?: ReactNode | ((errorInfo: ErrorInfo) => ReactNode);
13
- children: (data: T) => ReactNode;
14
- params?: DataFetchParams;
15
- }
16
- export interface AwaitErrorHandlerProps<T = any> extends Omit<AwaitProps<T>, 'resolve'> {
17
- resolve: () => T | string;
18
- }
19
- export declare function AwaitDataFetch<T>({ resolve, loading, errorElement, children, params, }: AwaitProps<T>): React.JSX.Element;
@@ -1,26 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import type { ErrorInfo } from './AwaitDataFetch';
3
- import type { DataFetchParams } from '../interfaces/global';
4
- type IProps = {
5
- id: string;
6
- injectScript?: boolean;
7
- injectLink?: boolean;
8
- };
9
- export type CreateRemoteComponentOptions<T, E extends keyof T> = {
10
- loader: () => Promise<T>;
11
- loading: React.ReactNode;
12
- fallback: ReactNode | ((errorInfo: ErrorInfo) => ReactNode);
13
- export?: E;
14
- dataFetchParams?: DataFetchParams;
15
- noSSR?: boolean;
16
- };
17
- type ReactKey = {
18
- key?: React.Key | null;
19
- };
20
- export declare function collectSSRAssets(options: IProps): React.ReactNode[];
21
- export declare function createRemoteComponent<T, E extends keyof T>(options: CreateRemoteComponentOptions<T, E>): (props: T[E] extends (...args: any) => any ? Parameters<T[E]>[0] extends undefined ? ReactKey : Parameters<T[E]>[0] & ReactKey : ReactKey) => React.JSX.Element;
22
- /**
23
- * @deprecated createRemoteSSRComponent is deprecated, please use createRemoteComponent instead!
24
- */
25
- export declare function createRemoteSSRComponent<T, E extends keyof T>(options: CreateRemoteComponentOptions<T, E>): (props: T[E] extends (...args: any) => any ? Parameters<T[E]>[0] extends undefined ? ReactKey : Parameters<T[E]>[0] & ReactKey : ReactKey) => React.JSX.Element;
26
- export {};
@@ -1,9 +0,0 @@
1
- import { createRemoteComponent } from './createRemoteComponent';
2
- import type { CreateRemoteComponentOptions } from './createRemoteComponent';
3
- export declare function wrapNoSSR<T, E extends keyof T>(createComponentFn: typeof createRemoteComponent<T, E>): (options: Omit<CreateRemoteComponentOptions<T, E>, "noSSR">) => (props: T[E] extends (...args: any) => any ? Parameters<T[E]>[0] extends undefined ? {
4
- key?: import("react").Key | null;
5
- } : Parameters<T[E]>[0] & {
6
- key?: import("react").Key | null;
7
- } : {
8
- key?: import("react").Key | null;
9
- }) => import("react").JSX.Element;
@@ -1,2 +0,0 @@
1
- import type { RuntimePluginFuture } from '@modern-js/runtime';
2
- export declare const mfSSRDevPlugin: () => RuntimePluginFuture;
@@ -1,4 +0,0 @@
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>;
@@ -1,7 +0,0 @@
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;
@@ -1,26 +0,0 @@
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;
@@ -1,15 +0,0 @@
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';
File without changes