@module-federation/bridge-react 0.0.0-next-20250708033956 → 0.0.0-next-20250708104625
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/CHANGELOG.md +3 -3
- package/dist/data-fetch-server-middleware.d.ts +9 -0
- package/dist/data-fetch-server-middleware.es.js +1 -1
- package/dist/data-fetch-utils.cjs.js +4 -1253
- package/dist/data-fetch-utils.d.ts +10 -1
- package/dist/data-fetch-utils.es.js +11 -1260
- package/dist/index.cjs.js +7 -433
- package/dist/index.d.ts +11 -11
- package/dist/index.es.js +20 -447
- package/dist/lazy-load-component-plugin-CttAWi8N.js +500 -0
- package/dist/lazy-load-component-plugin-hOC-Yus_.mjs +501 -0
- package/dist/lazy-load-component-plugin.cjs.js +6 -0
- package/dist/lazy-load-component-plugin.d.ts +16 -0
- package/dist/lazy-load-component-plugin.es.js +6 -0
- package/dist/lazy-utils.d.ts +9 -0
- package/dist/lazy-utils.es.js +19 -19
- package/dist/plugin.d.ts +9 -0
- package/dist/prefetch-Cx6MrkdU.mjs +1330 -0
- package/dist/prefetch-cGDaDkgV.js +1329 -0
- package/dist/router-v5.d.ts +9 -0
- package/dist/router-v6.d.ts +9 -0
- package/dist/router.d.ts +9 -0
- package/dist/{utils-Bk8hGjjF.mjs → utils-BTYYwZcb.mjs} +31 -31
- package/dist/v18.d.ts +9 -0
- package/dist/v19.d.ts +9 -0
- package/package.json +11 -11
- package/src/index.ts +3 -1
- package/src/lazy/createLazyComponent.tsx +88 -74
- package/src/lazy/data-fetch/index.ts +1 -0
- package/src/lazy/data-fetch/prefetch.ts +1 -1
- package/src/lazy/data-fetch/runtime-plugin.ts +80 -81
- package/src/lazy/index.ts +6 -2
- package/src/plugins/lazy-load-component-plugin.ts +72 -0
- package/vite.config.ts +2 -2
- package/dist/data-fetch-runtime-plugin.cjs.js +0 -73
- package/dist/data-fetch-runtime-plugin.d.ts +0 -6
- package/dist/data-fetch-runtime-plugin.es.js +0 -74
- package/dist/inject-data-fetch-CAvi-gSf.js +0 -79
- package/dist/inject-data-fetch-errCdqBS.mjs +0 -80
- package/src/.eslintrc.js +0 -9
package/src/lazy/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type {
|
|
|
9
9
|
|
|
10
10
|
export { createLazyComponent, collectSSRAssets } from './createLazyComponent';
|
|
11
11
|
|
|
12
|
-
export { wrapNoSSR } from './wrapNoSSR';
|
|
12
|
+
// export { wrapNoSSR } from './wrapNoSSR';
|
|
13
13
|
|
|
14
14
|
export {
|
|
15
15
|
injectDataFetch,
|
|
@@ -28,4 +28,8 @@ export { setSSREnv } from './utils';
|
|
|
28
28
|
|
|
29
29
|
export { autoFetchDataPlugin };
|
|
30
30
|
|
|
31
|
-
export type {
|
|
31
|
+
export type {
|
|
32
|
+
CacheStatus,
|
|
33
|
+
CacheStatsInfo,
|
|
34
|
+
PrefetchOptions,
|
|
35
|
+
} from './data-fetch';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FederationHost,
|
|
3
|
+
FederationRuntimePlugin,
|
|
4
|
+
} from '@module-federation/runtime';
|
|
5
|
+
import {
|
|
6
|
+
createLazyComponent,
|
|
7
|
+
prefetch,
|
|
8
|
+
collectSSRAssets,
|
|
9
|
+
autoFetchDataPlugin,
|
|
10
|
+
} from '../lazy';
|
|
11
|
+
import type { CreateLazyComponentOptions, PrefetchOptions } from '../lazy';
|
|
12
|
+
|
|
13
|
+
declare module '@module-federation/runtime' {
|
|
14
|
+
interface FederationHost {
|
|
15
|
+
createLazyComponent<T, E extends keyof T>(
|
|
16
|
+
options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>,
|
|
17
|
+
): ReturnType<typeof createLazyComponent<T, E>>;
|
|
18
|
+
prefetch(
|
|
19
|
+
options: Omit<PrefetchOptions, 'instance'>,
|
|
20
|
+
): ReturnType<typeof prefetch>;
|
|
21
|
+
// wrapNoSSR<T, E extends keyof T>(
|
|
22
|
+
// createLazyComponentFn: typeof createLazyComponent<T, E>,
|
|
23
|
+
// ): (
|
|
24
|
+
// options: Omit<CreateLazyComponentOptions<T, E>, 'instance' | 'noSSR'>,
|
|
25
|
+
// ) => ReturnType<typeof createLazyComponent<T, E>>;
|
|
26
|
+
collectSSRAssets(
|
|
27
|
+
options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>,
|
|
28
|
+
): ReturnType<typeof collectSSRAssets>;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function lazyLoadComponentPlugin(): FederationRuntimePlugin {
|
|
33
|
+
return {
|
|
34
|
+
name: 'lazy-load-component-plugin',
|
|
35
|
+
apply(instance: FederationHost) {
|
|
36
|
+
instance.registerPlugins([autoFetchDataPlugin()]);
|
|
37
|
+
|
|
38
|
+
instance.createLazyComponent = (options) => {
|
|
39
|
+
return createLazyComponent({
|
|
40
|
+
instance,
|
|
41
|
+
...options,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
instance.prefetch = (options) => {
|
|
46
|
+
return prefetch({
|
|
47
|
+
instance,
|
|
48
|
+
...options,
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
instance.wrapNoSSR = (fn) => {
|
|
53
|
+
return (options) => {
|
|
54
|
+
return fn({
|
|
55
|
+
instance,
|
|
56
|
+
noSSR: true,
|
|
57
|
+
...options,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
instance.collectSSRAssets = (options) => {
|
|
63
|
+
return collectSSRAssets({
|
|
64
|
+
instance,
|
|
65
|
+
...options,
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default lazyLoadComponentPlugin;
|
package/vite.config.ts
CHANGED
|
@@ -26,9 +26,9 @@ export default defineConfig({
|
|
|
26
26
|
'router-v6': path.resolve(__dirname, 'src/router/v6.tsx'),
|
|
27
27
|
v18: path.resolve(__dirname, 'src/v18.ts'),
|
|
28
28
|
v19: path.resolve(__dirname, 'src/v19.ts'),
|
|
29
|
-
'
|
|
29
|
+
'lazy-load-component-plugin': path.resolve(
|
|
30
30
|
__dirname,
|
|
31
|
-
'src/lazy
|
|
31
|
+
'src/plugins/lazy-load-component-plugin.ts',
|
|
32
32
|
),
|
|
33
33
|
'data-fetch-server-middleware': path.resolve(
|
|
34
34
|
__dirname,
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const injectDataFetch = require("./inject-data-fetch-CAvi-gSf.js");
|
|
3
|
-
const lazyUtils = require("./utils-iEVlDmyk.js");
|
|
4
|
-
const autoFetchData = () => ({
|
|
5
|
-
name: "auto-fetch-data-plugin",
|
|
6
|
-
beforeInit(args) {
|
|
7
|
-
lazyUtils.initDataFetchMap();
|
|
8
|
-
injectDataFetch.injectDataFetch();
|
|
9
|
-
return args;
|
|
10
|
-
},
|
|
11
|
-
afterLoadSnapshot(args) {
|
|
12
|
-
const { id, moduleInfo, remoteSnapshot, host } = args;
|
|
13
|
-
if (typeof id === "string" && lazyUtils.isDataLoaderExpose(id)) {
|
|
14
|
-
return args;
|
|
15
|
-
}
|
|
16
|
-
if (!remoteSnapshot || !id || !("modules" in remoteSnapshot)) {
|
|
17
|
-
return args;
|
|
18
|
-
}
|
|
19
|
-
const { name, alias } = moduleInfo;
|
|
20
|
-
const dataFetchInfo = lazyUtils.getDataFetchInfo({
|
|
21
|
-
name,
|
|
22
|
-
alias,
|
|
23
|
-
id,
|
|
24
|
-
remoteSnapshot
|
|
25
|
-
});
|
|
26
|
-
if (!dataFetchInfo) {
|
|
27
|
-
return args;
|
|
28
|
-
}
|
|
29
|
-
const { dataFetchId, dataFetchName } = dataFetchInfo;
|
|
30
|
-
const dataFetchMapKey = lazyUtils.getDataFetchMapKey(dataFetchInfo, {
|
|
31
|
-
name: host.name,
|
|
32
|
-
version: host.options.version
|
|
33
|
-
});
|
|
34
|
-
lazyUtils.logger.debug(
|
|
35
|
-
"======= auto fetch plugin dataFetchMapKey: ",
|
|
36
|
-
dataFetchMapKey
|
|
37
|
-
);
|
|
38
|
-
if (!dataFetchMapKey) {
|
|
39
|
-
return args;
|
|
40
|
-
}
|
|
41
|
-
const dataFetchItem = lazyUtils.getDataFetchItem(dataFetchMapKey);
|
|
42
|
-
if (dataFetchItem) {
|
|
43
|
-
return args;
|
|
44
|
-
}
|
|
45
|
-
const dataFetchMap = lazyUtils.getDataFetchMap();
|
|
46
|
-
const hasSSRAsset = Boolean(remoteSnapshot.ssrRemoteEntry);
|
|
47
|
-
const hasDataFetchClient = Boolean(
|
|
48
|
-
remoteSnapshot.modules.find(
|
|
49
|
-
(module2) => module2.moduleName === `${dataFetchName}${lazyUtils.DATA_FETCH_CLIENT_SUFFIX}`
|
|
50
|
-
)
|
|
51
|
-
);
|
|
52
|
-
const downgradeType = hasDataFetchClient ? lazyUtils.MF_DATA_FETCH_TYPE.FETCH_CLIENT : hasSSRAsset ? lazyUtils.MF_DATA_FETCH_TYPE.FETCH_SERVER : lazyUtils.MF_DATA_FETCH_TYPE.FETCH_CLIENT;
|
|
53
|
-
let finalDataFetchId = dataFetchId;
|
|
54
|
-
if (!lazyUtils.isServerEnv()) {
|
|
55
|
-
finalDataFetchId = downgradeType === lazyUtils.MF_DATA_FETCH_TYPE.FETCH_CLIENT ? hasDataFetchClient ? `${dataFetchId}${lazyUtils.DATA_FETCH_CLIENT_SUFFIX}` : dataFetchId : dataFetchId;
|
|
56
|
-
}
|
|
57
|
-
const getDataFetchGetter = () => lazyUtils.loadDataFetchModule(host, finalDataFetchId);
|
|
58
|
-
const dataFetchFnItem = [
|
|
59
|
-
getDataFetchGetter,
|
|
60
|
-
downgradeType
|
|
61
|
-
];
|
|
62
|
-
if (typeof window === "undefined" || lazyUtils.isCSROnly()) {
|
|
63
|
-
dataFetchFnItem.push(getDataFetchGetter());
|
|
64
|
-
}
|
|
65
|
-
dataFetchMap[dataFetchMapKey] = [
|
|
66
|
-
dataFetchFnItem,
|
|
67
|
-
void 0,
|
|
68
|
-
lazyUtils.MF_DATA_FETCH_STATUS.AWAIT
|
|
69
|
-
];
|
|
70
|
-
return args;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
module.exports = autoFetchData;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { i as injectDataFetch } from "./inject-data-fetch-errCdqBS.mjs";
|
|
2
|
-
import { i as isDataLoaderExpose, g as getDataFetchInfo, a as getDataFetchMapKey, l as logger, b as getDataFetchItem, D as DATA_FETCH_CLIENT_SUFFIX, M as MF_DATA_FETCH_TYPE, c as isServerEnv, d as isCSROnly, e as loadDataFetchModule, f as MF_DATA_FETCH_STATUS, h as getDataFetchMap, j as initDataFetchMap } from "./utils-Bk8hGjjF.mjs";
|
|
3
|
-
const autoFetchData = () => ({
|
|
4
|
-
name: "auto-fetch-data-plugin",
|
|
5
|
-
beforeInit(args) {
|
|
6
|
-
initDataFetchMap();
|
|
7
|
-
injectDataFetch();
|
|
8
|
-
return args;
|
|
9
|
-
},
|
|
10
|
-
afterLoadSnapshot(args) {
|
|
11
|
-
const { id, moduleInfo, remoteSnapshot, host } = args;
|
|
12
|
-
if (typeof id === "string" && isDataLoaderExpose(id)) {
|
|
13
|
-
return args;
|
|
14
|
-
}
|
|
15
|
-
if (!remoteSnapshot || !id || !("modules" in remoteSnapshot)) {
|
|
16
|
-
return args;
|
|
17
|
-
}
|
|
18
|
-
const { name, alias } = moduleInfo;
|
|
19
|
-
const dataFetchInfo = getDataFetchInfo({
|
|
20
|
-
name,
|
|
21
|
-
alias,
|
|
22
|
-
id,
|
|
23
|
-
remoteSnapshot
|
|
24
|
-
});
|
|
25
|
-
if (!dataFetchInfo) {
|
|
26
|
-
return args;
|
|
27
|
-
}
|
|
28
|
-
const { dataFetchId, dataFetchName } = dataFetchInfo;
|
|
29
|
-
const dataFetchMapKey = getDataFetchMapKey(dataFetchInfo, {
|
|
30
|
-
name: host.name,
|
|
31
|
-
version: host.options.version
|
|
32
|
-
});
|
|
33
|
-
logger.debug(
|
|
34
|
-
"======= auto fetch plugin dataFetchMapKey: ",
|
|
35
|
-
dataFetchMapKey
|
|
36
|
-
);
|
|
37
|
-
if (!dataFetchMapKey) {
|
|
38
|
-
return args;
|
|
39
|
-
}
|
|
40
|
-
const dataFetchItem = getDataFetchItem(dataFetchMapKey);
|
|
41
|
-
if (dataFetchItem) {
|
|
42
|
-
return args;
|
|
43
|
-
}
|
|
44
|
-
const dataFetchMap = getDataFetchMap();
|
|
45
|
-
const hasSSRAsset = Boolean(remoteSnapshot.ssrRemoteEntry);
|
|
46
|
-
const hasDataFetchClient = Boolean(
|
|
47
|
-
remoteSnapshot.modules.find(
|
|
48
|
-
(module) => module.moduleName === `${dataFetchName}${DATA_FETCH_CLIENT_SUFFIX}`
|
|
49
|
-
)
|
|
50
|
-
);
|
|
51
|
-
const downgradeType = hasDataFetchClient ? MF_DATA_FETCH_TYPE.FETCH_CLIENT : hasSSRAsset ? MF_DATA_FETCH_TYPE.FETCH_SERVER : MF_DATA_FETCH_TYPE.FETCH_CLIENT;
|
|
52
|
-
let finalDataFetchId = dataFetchId;
|
|
53
|
-
if (!isServerEnv()) {
|
|
54
|
-
finalDataFetchId = downgradeType === MF_DATA_FETCH_TYPE.FETCH_CLIENT ? hasDataFetchClient ? `${dataFetchId}${DATA_FETCH_CLIENT_SUFFIX}` : dataFetchId : dataFetchId;
|
|
55
|
-
}
|
|
56
|
-
const getDataFetchGetter = () => loadDataFetchModule(host, finalDataFetchId);
|
|
57
|
-
const dataFetchFnItem = [
|
|
58
|
-
getDataFetchGetter,
|
|
59
|
-
downgradeType
|
|
60
|
-
];
|
|
61
|
-
if (typeof window === "undefined" || isCSROnly()) {
|
|
62
|
-
dataFetchFnItem.push(getDataFetchGetter());
|
|
63
|
-
}
|
|
64
|
-
dataFetchMap[dataFetchMapKey] = [
|
|
65
|
-
dataFetchFnItem,
|
|
66
|
-
void 0,
|
|
67
|
-
MF_DATA_FETCH_STATUS.AWAIT
|
|
68
|
-
];
|
|
69
|
-
return args;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
export {
|
|
73
|
-
autoFetchData as default
|
|
74
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const lazyUtils = require("./utils-iEVlDmyk.js");
|
|
3
|
-
const dataFetchFunction = async function(options) {
|
|
4
|
-
var _a, _b;
|
|
5
|
-
const [id, data, downgrade] = options;
|
|
6
|
-
lazyUtils.logger.debug("==========call data fetch function!");
|
|
7
|
-
if (data) {
|
|
8
|
-
if (!id) {
|
|
9
|
-
throw new Error("id is required!");
|
|
10
|
-
}
|
|
11
|
-
if (!lazyUtils.getDataFetchMap()) {
|
|
12
|
-
lazyUtils.initDataFetchMap();
|
|
13
|
-
}
|
|
14
|
-
const dataFetchItem = lazyUtils.getDataFetchItem(id);
|
|
15
|
-
if (dataFetchItem) {
|
|
16
|
-
(_b = (_a = dataFetchItem[1]) == null ? void 0 : _a[1]) == null ? void 0 : _b.call(_a, data);
|
|
17
|
-
dataFetchItem[2] = lazyUtils.MF_DATA_FETCH_STATUS.LOADED;
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (!dataFetchItem) {
|
|
21
|
-
const dataFetchMap = lazyUtils.getDataFetchMap();
|
|
22
|
-
let res;
|
|
23
|
-
let rej;
|
|
24
|
-
const p = new Promise((resolve, reject) => {
|
|
25
|
-
res = resolve;
|
|
26
|
-
rej = reject;
|
|
27
|
-
});
|
|
28
|
-
dataFetchMap[id] = [
|
|
29
|
-
[
|
|
30
|
-
async () => async () => {
|
|
31
|
-
return "";
|
|
32
|
-
},
|
|
33
|
-
lazyUtils.MF_DATA_FETCH_TYPE.FETCH_SERVER
|
|
34
|
-
],
|
|
35
|
-
[p, res, rej],
|
|
36
|
-
lazyUtils.MF_DATA_FETCH_STATUS.LOADED
|
|
37
|
-
];
|
|
38
|
-
res && res(data);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (downgrade) {
|
|
43
|
-
const mfDowngrade2 = lazyUtils.getDowngradeTag();
|
|
44
|
-
if (!mfDowngrade2) {
|
|
45
|
-
globalThis[lazyUtils.DOWNGRADE_KEY] = id ? [id] : true;
|
|
46
|
-
} else if (Array.isArray(mfDowngrade2) && id && !mfDowngrade2.includes(id)) {
|
|
47
|
-
mfDowngrade2.push(id);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const mfDowngrade = lazyUtils.getDowngradeTag();
|
|
51
|
-
if (typeof mfDowngrade === "boolean") {
|
|
52
|
-
return lazyUtils.callAllDowngrade();
|
|
53
|
-
}
|
|
54
|
-
if (Array.isArray(mfDowngrade)) {
|
|
55
|
-
if (!id) {
|
|
56
|
-
globalThis[lazyUtils.DOWNGRADE_KEY] = true;
|
|
57
|
-
return lazyUtils.callAllDowngrade();
|
|
58
|
-
}
|
|
59
|
-
if (!mfDowngrade.includes(id)) {
|
|
60
|
-
mfDowngrade.push(id);
|
|
61
|
-
}
|
|
62
|
-
return lazyUtils.callDowngrade(id);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
function injectDataFetch() {
|
|
66
|
-
var _a;
|
|
67
|
-
globalThis[_a = lazyUtils.DATA_FETCH_FUNCTION] || (globalThis[_a] = []);
|
|
68
|
-
const dataFetch = globalThis[lazyUtils.DATA_FETCH_FUNCTION];
|
|
69
|
-
if (dataFetch.push === dataFetchFunction) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (typeof window === "undefined") {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
globalThis[lazyUtils.FS_HREF] = window.location.href;
|
|
76
|
-
dataFetch.push = dataFetchFunction;
|
|
77
|
-
}
|
|
78
|
-
exports.dataFetchFunction = dataFetchFunction;
|
|
79
|
-
exports.injectDataFetch = injectDataFetch;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { n as DATA_FETCH_FUNCTION, F as FS_HREF, l as logger, h as getDataFetchMap, j as initDataFetchMap, b as getDataFetchItem, f as MF_DATA_FETCH_STATUS, M as MF_DATA_FETCH_TYPE, o as DOWNGRADE_KEY, p as getDowngradeTag, q as callAllDowngrade, r as callDowngrade } from "./utils-Bk8hGjjF.mjs";
|
|
2
|
-
const dataFetchFunction = async function(options) {
|
|
3
|
-
var _a, _b;
|
|
4
|
-
const [id, data, downgrade] = options;
|
|
5
|
-
logger.debug("==========call data fetch function!");
|
|
6
|
-
if (data) {
|
|
7
|
-
if (!id) {
|
|
8
|
-
throw new Error("id is required!");
|
|
9
|
-
}
|
|
10
|
-
if (!getDataFetchMap()) {
|
|
11
|
-
initDataFetchMap();
|
|
12
|
-
}
|
|
13
|
-
const dataFetchItem = getDataFetchItem(id);
|
|
14
|
-
if (dataFetchItem) {
|
|
15
|
-
(_b = (_a = dataFetchItem[1]) == null ? void 0 : _a[1]) == null ? void 0 : _b.call(_a, data);
|
|
16
|
-
dataFetchItem[2] = MF_DATA_FETCH_STATUS.LOADED;
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (!dataFetchItem) {
|
|
20
|
-
const dataFetchMap = getDataFetchMap();
|
|
21
|
-
let res;
|
|
22
|
-
let rej;
|
|
23
|
-
const p = new Promise((resolve, reject) => {
|
|
24
|
-
res = resolve;
|
|
25
|
-
rej = reject;
|
|
26
|
-
});
|
|
27
|
-
dataFetchMap[id] = [
|
|
28
|
-
[
|
|
29
|
-
async () => async () => {
|
|
30
|
-
return "";
|
|
31
|
-
},
|
|
32
|
-
MF_DATA_FETCH_TYPE.FETCH_SERVER
|
|
33
|
-
],
|
|
34
|
-
[p, res, rej],
|
|
35
|
-
MF_DATA_FETCH_STATUS.LOADED
|
|
36
|
-
];
|
|
37
|
-
res && res(data);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (downgrade) {
|
|
42
|
-
const mfDowngrade2 = getDowngradeTag();
|
|
43
|
-
if (!mfDowngrade2) {
|
|
44
|
-
globalThis[DOWNGRADE_KEY] = id ? [id] : true;
|
|
45
|
-
} else if (Array.isArray(mfDowngrade2) && id && !mfDowngrade2.includes(id)) {
|
|
46
|
-
mfDowngrade2.push(id);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const mfDowngrade = getDowngradeTag();
|
|
50
|
-
if (typeof mfDowngrade === "boolean") {
|
|
51
|
-
return callAllDowngrade();
|
|
52
|
-
}
|
|
53
|
-
if (Array.isArray(mfDowngrade)) {
|
|
54
|
-
if (!id) {
|
|
55
|
-
globalThis[DOWNGRADE_KEY] = true;
|
|
56
|
-
return callAllDowngrade();
|
|
57
|
-
}
|
|
58
|
-
if (!mfDowngrade.includes(id)) {
|
|
59
|
-
mfDowngrade.push(id);
|
|
60
|
-
}
|
|
61
|
-
return callDowngrade(id);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
function injectDataFetch() {
|
|
65
|
-
var _a;
|
|
66
|
-
globalThis[_a = DATA_FETCH_FUNCTION] || (globalThis[_a] = []);
|
|
67
|
-
const dataFetch = globalThis[DATA_FETCH_FUNCTION];
|
|
68
|
-
if (dataFetch.push === dataFetchFunction) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (typeof window === "undefined") {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
globalThis[FS_HREF] = window.location.href;
|
|
75
|
-
dataFetch.push = dataFetchFunction;
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
dataFetchFunction as d,
|
|
79
|
-
injectDataFetch as i
|
|
80
|
-
};
|