@module-federation/bridge-react 0.0.0-chore-bump-node-22-20260710161714
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/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/base.cjs.js +29 -0
- package/dist/base.d.ts +311 -0
- package/dist/base.es.js +30 -0
- package/dist/bridge-base-CIOXqUYV.mjs +214 -0
- package/dist/bridge-base-HLp3d7aF.js +229 -0
- package/dist/createHelpers-BY5Uj9_Z.mjs +192 -0
- package/dist/createHelpers-DNBacpxb.js +191 -0
- package/dist/data-fetch-server-middleware.cjs.js +163 -0
- package/dist/data-fetch-server-middleware.d.ts +15 -0
- package/dist/data-fetch-server-middleware.es.js +164 -0
- package/dist/data-fetch-utils.cjs.js +24 -0
- package/dist/data-fetch-utils.d.ts +81 -0
- package/dist/data-fetch-utils.es.js +26 -0
- package/dist/data-fetch.cjs.js +22 -0
- package/dist/data-fetch.d.ts +140 -0
- package/dist/data-fetch.es.js +22 -0
- package/dist/index-Bs2NxD2z.mjs +46 -0
- package/dist/index-DbjGCKOr.js +45 -0
- package/dist/index.cjs.js +125 -0
- package/dist/index.d.ts +299 -0
- package/dist/index.es.js +109 -0
- package/dist/lazy-load-component-plugin-BjMVNoep.js +521 -0
- package/dist/lazy-load-component-plugin-aj97Vt-4.mjs +522 -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.cjs.js +24 -0
- package/dist/lazy-utils.d.ts +149 -0
- package/dist/lazy-utils.es.js +24 -0
- package/dist/logger-DwWkXsWl.mjs +139 -0
- package/dist/logger-Dxblx6P-.js +138 -0
- package/dist/plugin.cjs.js +14 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/plugin.es.js +14 -0
- package/dist/prefetch-BwRDb4SJ.mjs +1082 -0
- package/dist/prefetch-DLhPTofn.js +1081 -0
- package/dist/router-v5.cjs.js +57 -0
- package/dist/router-v5.d.ts +17 -0
- package/dist/router-v5.es.js +34 -0
- package/dist/router-v6.cjs.js +84 -0
- package/dist/router-v6.d.ts +20 -0
- package/dist/router-v6.es.js +61 -0
- package/dist/router-v7.cjs.js +85 -0
- package/dist/router-v7.d.ts +19 -0
- package/dist/router-v7.es.js +63 -0
- package/dist/router.cjs.js +82 -0
- package/dist/router.d.ts +20 -0
- package/dist/router.es.js +60 -0
- package/dist/utils-CFTy4LVE.js +2029 -0
- package/dist/utils-DGS4pYp8.mjs +2030 -0
- package/dist/v18.cjs.js +15 -0
- package/dist/v18.d.ts +114 -0
- package/dist/v18.es.js +15 -0
- package/dist/v19.cjs.js +15 -0
- package/dist/v19.d.ts +115 -0
- package/dist/v19.es.js +15 -0
- package/package.json +189 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { GlobalModuleInfo } from '@module-federation/sdk';
|
|
2
|
+
import { LRUCache } from 'lru-cache';
|
|
3
|
+
import { ManifestProvider } from '@module-federation/sdk';
|
|
4
|
+
import { ModuleFederation } from '@module-federation/runtime';
|
|
5
|
+
import { ModuleInfo } from '@module-federation/sdk';
|
|
6
|
+
import { PureEntryProvider } from '@module-federation/sdk';
|
|
7
|
+
import { RemoteEntryType } from '@module-federation/sdk';
|
|
8
|
+
|
|
9
|
+
declare interface CacheConfig {
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
unstable_shouldDisable?: ({ request, }: {
|
|
12
|
+
request: Request;
|
|
13
|
+
}) => boolean | Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare interface CacheItem<T> {
|
|
17
|
+
data: T;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
isRevalidating?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare function callAllDowngrade(): void;
|
|
23
|
+
|
|
24
|
+
export declare function callDowngrade(id: string, params?: DataFetchParams, remoteInfo?: NoSSRRemoteInfo): Promise<unknown>;
|
|
25
|
+
|
|
26
|
+
declare type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
|
|
27
|
+
|
|
28
|
+
declare type DataFetchParams = {
|
|
29
|
+
isDowngrade: boolean;
|
|
30
|
+
_id?: string;
|
|
31
|
+
} & Record<string, unknown>;
|
|
32
|
+
|
|
33
|
+
export declare function fetchData(id: string, params: DataFetchParams, remoteInfo?: NoSSRRemoteInfo): Promise<unknown | undefined>;
|
|
34
|
+
|
|
35
|
+
export declare const flushDataFetch: () => void;
|
|
36
|
+
|
|
37
|
+
export declare function getDataFetchCache(): MF_DATA_FETCH_CACHE;
|
|
38
|
+
|
|
39
|
+
export declare const getDataFetchIdWithErrorMsgs: (errMsgs: string) => string | undefined;
|
|
40
|
+
|
|
41
|
+
export declare const getDataFetchInfo: ({ name, alias, id, remoteSnapshot, }: {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
remoteSnapshot: GlobalModuleInfo[string];
|
|
45
|
+
alias?: string;
|
|
46
|
+
}) => {
|
|
47
|
+
dataFetchName: string;
|
|
48
|
+
dataFetchId: string;
|
|
49
|
+
dataFetchKey: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
|
|
52
|
+
export declare function getDataFetchItem(id: string): MF_DATA_FETCH_MAP_VALUE;
|
|
53
|
+
|
|
54
|
+
export declare function getDataFetchMap(): MF_DATA_FETCH_MAP;
|
|
55
|
+
|
|
56
|
+
export declare function getDataFetchMapKey(dataFetchInfo?: ReturnType<typeof getDataFetchInfo>, hostInfo?: {
|
|
57
|
+
name: string;
|
|
58
|
+
version?: string;
|
|
59
|
+
}): string | undefined;
|
|
60
|
+
|
|
61
|
+
export declare function getDowngradeTag(): MF_SSR_DOWNGRADE;
|
|
62
|
+
|
|
63
|
+
export declare function getLoadedRemoteInfos(id: string, instance: ModuleFederation | null): {
|
|
64
|
+
snapshot: ModuleInfo | ManifestProvider | PureEntryProvider | undefined;
|
|
65
|
+
expose: string;
|
|
66
|
+
alias?: string;
|
|
67
|
+
name: string;
|
|
68
|
+
version?: string;
|
|
69
|
+
buildVersion?: string;
|
|
70
|
+
entry: string;
|
|
71
|
+
type: RemoteEntryType;
|
|
72
|
+
entryGlobalName: string;
|
|
73
|
+
shareScope: string | string[];
|
|
74
|
+
} | undefined;
|
|
75
|
+
|
|
76
|
+
export declare function initDataFetchMap(): void;
|
|
77
|
+
|
|
78
|
+
export declare function isCSROnly(): boolean;
|
|
79
|
+
|
|
80
|
+
export declare function isDataLoaderExpose(exposeKey: string): boolean;
|
|
81
|
+
|
|
82
|
+
export declare function isServerEnv(): boolean;
|
|
83
|
+
|
|
84
|
+
export declare function loadDataFetchModule(instance: ModuleFederation, id: string): Promise<(params: DataFetchParams) => Promise<unknown>>;
|
|
85
|
+
|
|
86
|
+
declare type MF_DATA_FETCH_CACHE = {
|
|
87
|
+
cacheStore?: LRUCache<string, Map<string, CacheItem<any>>>;
|
|
88
|
+
tagKeyMap?: Map<string, Set<string>>;
|
|
89
|
+
cacheConfig?: CacheConfig;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
declare type MF_DATA_FETCH_MAP = Record<string, MF_DATA_FETCH_MAP_VALUE>;
|
|
93
|
+
|
|
94
|
+
declare type MF_DATA_FETCH_MAP_VALUE = [
|
|
95
|
+
[
|
|
96
|
+
() => Promise<DataFetch<unknown>>,
|
|
97
|
+
MF_DATA_FETCH_TYPE,
|
|
98
|
+
Promise<DataFetch<unknown>>?
|
|
99
|
+
],
|
|
100
|
+
MF_DATA_FETCH_MAP_VALUE_PROMISE_SET?,
|
|
101
|
+
MF_DATA_FETCH_STATUS?
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
declare type MF_DATA_FETCH_MAP_VALUE_PROMISE_SET = [
|
|
105
|
+
Promise<unknown>,
|
|
106
|
+
((data: unknown) => void)?,
|
|
107
|
+
((err: unknown) => void)?
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
declare const enum MF_DATA_FETCH_STATUS {
|
|
111
|
+
LOADED = 1,
|
|
112
|
+
LOADING = 2,
|
|
113
|
+
AWAIT = 0,
|
|
114
|
+
ERROR = 3
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
declare const enum MF_DATA_FETCH_TYPE {
|
|
118
|
+
FETCH_SERVER = 1,
|
|
119
|
+
FETCH_CLIENT = 2
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare type MF_SSR_DOWNGRADE = string[] | true | undefined;
|
|
123
|
+
|
|
124
|
+
declare type NoSSRRemoteInfo = {
|
|
125
|
+
name: string;
|
|
126
|
+
version: string;
|
|
127
|
+
ssrPublicPath: string;
|
|
128
|
+
ssrRemoteEntry: string;
|
|
129
|
+
globalName: string;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export declare function setDataFetchItemLoadedStatus(id: string): void;
|
|
133
|
+
|
|
134
|
+
export declare function setSSREnv({ fetchServerQuery, }: {
|
|
135
|
+
fetchServerQuery?: Record<string, unknown>;
|
|
136
|
+
}): void;
|
|
137
|
+
|
|
138
|
+
export declare const wrapDataFetchId: (id?: string) => string;
|
|
139
|
+
|
|
140
|
+
export { }
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
declare module '@module-federation/runtime-core' {
|
|
144
|
+
interface ModuleFederation {
|
|
145
|
+
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
146
|
+
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
147
|
+
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "./logger-DwWkXsWl.mjs";
|
|
2
|
+
import { H, I, h, f, N, v, m, o, e, n, J, z, i, t, k, u, j, A, s, x } from "./utils-DGS4pYp8.mjs";
|
|
3
|
+
export {
|
|
4
|
+
H as callAllDowngrade,
|
|
5
|
+
I as callDowngrade,
|
|
6
|
+
h as fetchData,
|
|
7
|
+
f as flushDataFetch,
|
|
8
|
+
N as getDataFetchCache,
|
|
9
|
+
v as getDataFetchIdWithErrorMsgs,
|
|
10
|
+
m as getDataFetchInfo,
|
|
11
|
+
o as getDataFetchItem,
|
|
12
|
+
e as getDataFetchMap,
|
|
13
|
+
n as getDataFetchMapKey,
|
|
14
|
+
J as getDowngradeTag,
|
|
15
|
+
z as getLoadedRemoteInfos,
|
|
16
|
+
i as initDataFetchMap,
|
|
17
|
+
t as isCSROnly,
|
|
18
|
+
k as isDataLoaderExpose,
|
|
19
|
+
u as isServerEnv,
|
|
20
|
+
j as loadDataFetchModule,
|
|
21
|
+
A as setDataFetchItemLoadedStatus,
|
|
22
|
+
s as setSSREnv,
|
|
23
|
+
x as wrapDataFetchId
|
|
24
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const MANIFEST_EXT = ".json";
|
|
2
|
+
const BROWSER_LOG_KEY = "FEDERATION_DEBUG";
|
|
3
|
+
const SEPARATOR = ":";
|
|
4
|
+
const isBrowserEnvValue = typeof ENV_TARGET !== "undefined" ? ENV_TARGET === "web" : typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
5
|
+
function isBrowserEnv() {
|
|
6
|
+
return isBrowserEnvValue;
|
|
7
|
+
}
|
|
8
|
+
function isBrowserDebug() {
|
|
9
|
+
try {
|
|
10
|
+
if (isBrowserEnv() && window.localStorage) return Boolean(localStorage.getItem(BROWSER_LOG_KEY));
|
|
11
|
+
} catch (error) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
function isDebugMode() {
|
|
17
|
+
if (typeof process !== "undefined" && process.env && process.env["FEDERATION_DEBUG"]) return Boolean(process.env["FEDERATION_DEBUG"]);
|
|
18
|
+
if (typeof FEDERATION_DEBUG !== "undefined" && Boolean(FEDERATION_DEBUG)) return true;
|
|
19
|
+
return isBrowserDebug();
|
|
20
|
+
}
|
|
21
|
+
const PREFIX = "[ Module Federation ]";
|
|
22
|
+
const DEFAULT_DELEGATE = console;
|
|
23
|
+
const LOGGER_STACK_SKIP_TOKENS = [
|
|
24
|
+
"logger.ts",
|
|
25
|
+
"logger.js",
|
|
26
|
+
"captureStackTrace",
|
|
27
|
+
"Logger.emit",
|
|
28
|
+
"Logger.log",
|
|
29
|
+
"Logger.info",
|
|
30
|
+
"Logger.warn",
|
|
31
|
+
"Logger.error",
|
|
32
|
+
"Logger.debug"
|
|
33
|
+
];
|
|
34
|
+
function captureStackTrace() {
|
|
35
|
+
try {
|
|
36
|
+
const stack = (/* @__PURE__ */ new Error()).stack;
|
|
37
|
+
if (!stack) return;
|
|
38
|
+
const [, ...rawLines] = stack.split("\n");
|
|
39
|
+
const filtered = rawLines.filter((line) => !LOGGER_STACK_SKIP_TOKENS.some((token) => line.includes(token)));
|
|
40
|
+
if (!filtered.length) return;
|
|
41
|
+
return `Stack trace:
|
|
42
|
+
${filtered.slice(0, 5).join("\n")}`;
|
|
43
|
+
} catch {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
var Logger = class {
|
|
48
|
+
constructor(prefix, delegate = DEFAULT_DELEGATE) {
|
|
49
|
+
this.prefix = prefix;
|
|
50
|
+
this.delegate = delegate ?? DEFAULT_DELEGATE;
|
|
51
|
+
}
|
|
52
|
+
setPrefix(prefix) {
|
|
53
|
+
this.prefix = prefix;
|
|
54
|
+
}
|
|
55
|
+
setDelegate(delegate) {
|
|
56
|
+
this.delegate = delegate ?? DEFAULT_DELEGATE;
|
|
57
|
+
}
|
|
58
|
+
emit(method, args) {
|
|
59
|
+
const delegate = this.delegate;
|
|
60
|
+
const stackTrace = isDebugMode() ? captureStackTrace() : void 0;
|
|
61
|
+
const enrichedArgs = stackTrace ? [...args, stackTrace] : args;
|
|
62
|
+
const order = (() => {
|
|
63
|
+
switch (method) {
|
|
64
|
+
case "log":
|
|
65
|
+
return ["log", "info"];
|
|
66
|
+
case "info":
|
|
67
|
+
return ["info", "log"];
|
|
68
|
+
case "warn":
|
|
69
|
+
return [
|
|
70
|
+
"warn",
|
|
71
|
+
"info",
|
|
72
|
+
"log"
|
|
73
|
+
];
|
|
74
|
+
case "error":
|
|
75
|
+
return [
|
|
76
|
+
"error",
|
|
77
|
+
"warn",
|
|
78
|
+
"log"
|
|
79
|
+
];
|
|
80
|
+
default:
|
|
81
|
+
return ["debug", "log"];
|
|
82
|
+
}
|
|
83
|
+
})();
|
|
84
|
+
for (const candidate of order) {
|
|
85
|
+
const handler = delegate[candidate];
|
|
86
|
+
if (typeof handler === "function") {
|
|
87
|
+
handler.call(delegate, this.prefix, ...enrichedArgs);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const candidate of order) {
|
|
92
|
+
const handler = DEFAULT_DELEGATE[candidate];
|
|
93
|
+
if (typeof handler === "function") {
|
|
94
|
+
handler.call(DEFAULT_DELEGATE, this.prefix, ...enrichedArgs);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
log(...args) {
|
|
100
|
+
this.emit("log", args);
|
|
101
|
+
}
|
|
102
|
+
warn(...args) {
|
|
103
|
+
this.emit("warn", args);
|
|
104
|
+
}
|
|
105
|
+
error(...args) {
|
|
106
|
+
this.emit("error", args);
|
|
107
|
+
}
|
|
108
|
+
success(...args) {
|
|
109
|
+
this.emit("info", args);
|
|
110
|
+
}
|
|
111
|
+
info(...args) {
|
|
112
|
+
this.emit("info", args);
|
|
113
|
+
}
|
|
114
|
+
ready(...args) {
|
|
115
|
+
this.emit("info", args);
|
|
116
|
+
}
|
|
117
|
+
debug(...args) {
|
|
118
|
+
if (isDebugMode()) this.emit("debug", args);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
function createLogger(prefix) {
|
|
122
|
+
return new Logger(prefix);
|
|
123
|
+
}
|
|
124
|
+
function createInfrastructureLogger(prefix) {
|
|
125
|
+
const infrastructureLogger = new Logger(prefix);
|
|
126
|
+
Object.defineProperty(infrastructureLogger, "__mf_infrastructure_logger__", {
|
|
127
|
+
value: true,
|
|
128
|
+
enumerable: false,
|
|
129
|
+
configurable: false
|
|
130
|
+
});
|
|
131
|
+
return infrastructureLogger;
|
|
132
|
+
}
|
|
133
|
+
createInfrastructureLogger(PREFIX);
|
|
134
|
+
export {
|
|
135
|
+
MANIFEST_EXT as M,
|
|
136
|
+
SEPARATOR as S,
|
|
137
|
+
createLogger as c,
|
|
138
|
+
isBrowserEnvValue as i
|
|
139
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const MANIFEST_EXT = ".json";
|
|
3
|
+
const BROWSER_LOG_KEY = "FEDERATION_DEBUG";
|
|
4
|
+
const SEPARATOR = ":";
|
|
5
|
+
const isBrowserEnvValue = typeof ENV_TARGET !== "undefined" ? ENV_TARGET === "web" : typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
6
|
+
function isBrowserEnv() {
|
|
7
|
+
return isBrowserEnvValue;
|
|
8
|
+
}
|
|
9
|
+
function isBrowserDebug() {
|
|
10
|
+
try {
|
|
11
|
+
if (isBrowserEnv() && window.localStorage) return Boolean(localStorage.getItem(BROWSER_LOG_KEY));
|
|
12
|
+
} catch (error) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
function isDebugMode() {
|
|
18
|
+
if (typeof process !== "undefined" && process.env && process.env["FEDERATION_DEBUG"]) return Boolean(process.env["FEDERATION_DEBUG"]);
|
|
19
|
+
if (typeof FEDERATION_DEBUG !== "undefined" && Boolean(FEDERATION_DEBUG)) return true;
|
|
20
|
+
return isBrowserDebug();
|
|
21
|
+
}
|
|
22
|
+
const PREFIX = "[ Module Federation ]";
|
|
23
|
+
const DEFAULT_DELEGATE = console;
|
|
24
|
+
const LOGGER_STACK_SKIP_TOKENS = [
|
|
25
|
+
"logger.ts",
|
|
26
|
+
"logger.js",
|
|
27
|
+
"captureStackTrace",
|
|
28
|
+
"Logger.emit",
|
|
29
|
+
"Logger.log",
|
|
30
|
+
"Logger.info",
|
|
31
|
+
"Logger.warn",
|
|
32
|
+
"Logger.error",
|
|
33
|
+
"Logger.debug"
|
|
34
|
+
];
|
|
35
|
+
function captureStackTrace() {
|
|
36
|
+
try {
|
|
37
|
+
const stack = (/* @__PURE__ */ new Error()).stack;
|
|
38
|
+
if (!stack) return;
|
|
39
|
+
const [, ...rawLines] = stack.split("\n");
|
|
40
|
+
const filtered = rawLines.filter((line) => !LOGGER_STACK_SKIP_TOKENS.some((token) => line.includes(token)));
|
|
41
|
+
if (!filtered.length) return;
|
|
42
|
+
return `Stack trace:
|
|
43
|
+
${filtered.slice(0, 5).join("\n")}`;
|
|
44
|
+
} catch {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
var Logger = class {
|
|
49
|
+
constructor(prefix, delegate = DEFAULT_DELEGATE) {
|
|
50
|
+
this.prefix = prefix;
|
|
51
|
+
this.delegate = delegate ?? DEFAULT_DELEGATE;
|
|
52
|
+
}
|
|
53
|
+
setPrefix(prefix) {
|
|
54
|
+
this.prefix = prefix;
|
|
55
|
+
}
|
|
56
|
+
setDelegate(delegate) {
|
|
57
|
+
this.delegate = delegate ?? DEFAULT_DELEGATE;
|
|
58
|
+
}
|
|
59
|
+
emit(method, args) {
|
|
60
|
+
const delegate = this.delegate;
|
|
61
|
+
const stackTrace = isDebugMode() ? captureStackTrace() : void 0;
|
|
62
|
+
const enrichedArgs = stackTrace ? [...args, stackTrace] : args;
|
|
63
|
+
const order = (() => {
|
|
64
|
+
switch (method) {
|
|
65
|
+
case "log":
|
|
66
|
+
return ["log", "info"];
|
|
67
|
+
case "info":
|
|
68
|
+
return ["info", "log"];
|
|
69
|
+
case "warn":
|
|
70
|
+
return [
|
|
71
|
+
"warn",
|
|
72
|
+
"info",
|
|
73
|
+
"log"
|
|
74
|
+
];
|
|
75
|
+
case "error":
|
|
76
|
+
return [
|
|
77
|
+
"error",
|
|
78
|
+
"warn",
|
|
79
|
+
"log"
|
|
80
|
+
];
|
|
81
|
+
default:
|
|
82
|
+
return ["debug", "log"];
|
|
83
|
+
}
|
|
84
|
+
})();
|
|
85
|
+
for (const candidate of order) {
|
|
86
|
+
const handler = delegate[candidate];
|
|
87
|
+
if (typeof handler === "function") {
|
|
88
|
+
handler.call(delegate, this.prefix, ...enrichedArgs);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
for (const candidate of order) {
|
|
93
|
+
const handler = DEFAULT_DELEGATE[candidate];
|
|
94
|
+
if (typeof handler === "function") {
|
|
95
|
+
handler.call(DEFAULT_DELEGATE, this.prefix, ...enrichedArgs);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
log(...args) {
|
|
101
|
+
this.emit("log", args);
|
|
102
|
+
}
|
|
103
|
+
warn(...args) {
|
|
104
|
+
this.emit("warn", args);
|
|
105
|
+
}
|
|
106
|
+
error(...args) {
|
|
107
|
+
this.emit("error", args);
|
|
108
|
+
}
|
|
109
|
+
success(...args) {
|
|
110
|
+
this.emit("info", args);
|
|
111
|
+
}
|
|
112
|
+
info(...args) {
|
|
113
|
+
this.emit("info", args);
|
|
114
|
+
}
|
|
115
|
+
ready(...args) {
|
|
116
|
+
this.emit("info", args);
|
|
117
|
+
}
|
|
118
|
+
debug(...args) {
|
|
119
|
+
if (isDebugMode()) this.emit("debug", args);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
function createLogger(prefix) {
|
|
123
|
+
return new Logger(prefix);
|
|
124
|
+
}
|
|
125
|
+
function createInfrastructureLogger(prefix) {
|
|
126
|
+
const infrastructureLogger = new Logger(prefix);
|
|
127
|
+
Object.defineProperty(infrastructureLogger, "__mf_infrastructure_logger__", {
|
|
128
|
+
value: true,
|
|
129
|
+
enumerable: false,
|
|
130
|
+
configurable: false
|
|
131
|
+
});
|
|
132
|
+
return infrastructureLogger;
|
|
133
|
+
}
|
|
134
|
+
createInfrastructureLogger(PREFIX);
|
|
135
|
+
exports.MANIFEST_EXT = MANIFEST_EXT;
|
|
136
|
+
exports.SEPARATOR = SEPARATOR;
|
|
137
|
+
exports.createLogger = createLogger;
|
|
138
|
+
exports.isBrowserEnvValue = isBrowserEnvValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const federationRuntime = { instance: null };
|
|
4
|
+
function BridgeReactPlugin() {
|
|
5
|
+
return {
|
|
6
|
+
name: "bridge-react-plugin",
|
|
7
|
+
beforeInit(args) {
|
|
8
|
+
federationRuntime.instance = args.origin;
|
|
9
|
+
return args;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.default = BridgeReactPlugin;
|
|
14
|
+
exports.federationRuntime = federationRuntime;
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ModuleFederation } from '@module-federation/runtime';
|
|
2
|
+
import { ModuleFederationRuntimePlugin } from '@module-federation/runtime';
|
|
3
|
+
|
|
4
|
+
declare function BridgeReactPlugin(): ModuleFederationRuntimePlugin;
|
|
5
|
+
export default BridgeReactPlugin;
|
|
6
|
+
|
|
7
|
+
export declare const federationRuntime: FederationRuntimeType;
|
|
8
|
+
|
|
9
|
+
export declare type FederationRuntimeType = {
|
|
10
|
+
instance: ModuleFederation | null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
declare module '@module-federation/runtime-core' {
|
|
17
|
+
interface ModuleFederation {
|
|
18
|
+
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
19
|
+
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
20
|
+
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const federationRuntime = { instance: null };
|
|
2
|
+
function BridgeReactPlugin() {
|
|
3
|
+
return {
|
|
4
|
+
name: "bridge-react-plugin",
|
|
5
|
+
beforeInit(args) {
|
|
6
|
+
federationRuntime.instance = args.origin;
|
|
7
|
+
return args;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
BridgeReactPlugin as default,
|
|
13
|
+
federationRuntime
|
|
14
|
+
};
|