@module-federation/bridge-react 0.0.0-next-20250926024003 → 0.0.0-perf-devtools-20260107043700
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 +81 -3
- package/__tests__/bridge.spec.tsx +37 -14
- 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-BwHtOqw_.mjs → bridge-base-CPSTBjEp.mjs} +30 -18
- package/dist/{bridge-base-Ds850AOx.js → bridge-base-RStDxH71.js} +30 -18
- package/dist/createHelpers-B_L612IN.js +190 -0
- package/dist/createHelpers-Ui5pt7je.mjs +191 -0
- package/dist/data-fetch-server-middleware.cjs.js +2 -2
- package/dist/data-fetch-server-middleware.es.js +2 -2
- package/dist/data-fetch-utils.cjs.js +2 -2
- package/dist/data-fetch-utils.es.js +8 -8
- package/dist/{index-eN2xRRXs.js → index-DRSBaSu3.js} +1 -1
- package/dist/{index-rAO0Wr0M.mjs → index-DyQNwY2M.mjs} +1 -1
- package/dist/index.cjs.js +11 -179
- package/dist/index.d.ts +31 -6
- package/dist/index.es.js +19 -186
- package/dist/{index.esm-Ju4RY-yW.js → index.esm-BWaKho-8.js} +108 -46
- package/dist/{index.esm-CtI0uQUR.mjs → index.esm-CPwSeCvw.mjs} +113 -51
- package/dist/{lazy-load-component-plugin-D6tEPyvX.mjs → lazy-load-component-plugin-CNyT62wB.mjs} +2 -2
- package/dist/{lazy-load-component-plugin-CWNzJM0v.js → lazy-load-component-plugin-Dr5VV1mu.js} +2 -2
- package/dist/lazy-load-component-plugin.cjs.js +2 -2
- package/dist/lazy-load-component-plugin.es.js +2 -2
- package/dist/lazy-utils.cjs.js +2 -2
- package/dist/lazy-utils.es.js +4 -4
- package/dist/{prefetch-hTVJ80G6.js → prefetch-J3x-_5zT.js} +43 -141
- package/dist/{prefetch-DCF_oa3O.mjs → prefetch-lrSPKiuu.mjs} +43 -141
- package/dist/router-v5.cjs.js +1 -1
- package/dist/router-v5.es.js +1 -1
- package/dist/router-v6.cjs.js +1 -1
- package/dist/router-v6.es.js +1 -1
- package/dist/router-v7.cjs.js +83 -0
- package/dist/router-v7.d.ts +20 -0
- package/dist/router-v7.es.js +61 -0
- package/dist/router.cjs.js +1 -1
- package/dist/router.es.js +1 -1
- package/dist/{utils-VSOJTX_o.mjs → utils-dUgb9Jkm.mjs} +7 -7
- package/dist/{utils-vIpCrZmn.js → utils-tM9yE73c.js} +1 -1
- package/dist/v18.cjs.js +1 -1
- package/dist/v18.es.js +1 -1
- package/dist/v19.cjs.js +1 -1
- package/dist/v19.es.js +1 -1
- package/package.json +54 -10
- package/src/base.ts +50 -0
- package/src/index.ts +6 -1
- package/src/provider/versions/bridge-base.tsx +45 -17
- package/src/provider/versions/legacy.ts +2 -1
- package/src/remote/RemoteAppWrapper.tsx +108 -0
- package/src/remote/base-component/component.tsx +2 -0
- package/src/remote/base-component/create.tsx +23 -0
- package/src/remote/base-component/index.tsx +10 -0
- package/src/remote/createHelpers.tsx +130 -0
- package/src/remote/{component.tsx → router-component/component.tsx} +3 -110
- package/src/remote/router-component/create.tsx +23 -0
- package/src/remote/router-component/index.tsx +10 -0
- package/src/router/v7.tsx +75 -0
- package/vite.config.ts +25 -0
- package/src/remote/create.tsx +0 -103
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function _extends() {
|
|
3
|
-
_extends = Object.assign || function assign(target) {
|
|
4
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
5
|
-
var source = arguments[i];
|
|
6
|
-
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
7
|
-
}
|
|
8
|
-
return target;
|
|
9
|
-
};
|
|
10
|
-
return _extends.apply(this, arguments);
|
|
11
|
-
}
|
|
12
2
|
const MANIFEST_EXT = ".json";
|
|
13
3
|
const BROWSER_LOG_KEY = "FEDERATION_DEBUG";
|
|
14
4
|
const SEPARATOR = ":";
|
|
@@ -52,40 +42,120 @@ const composeKeyWithSeparator = function(...args) {
|
|
|
52
42
|
const warn = (msg) => {
|
|
53
43
|
console.warn(`${LOG_CATEGORY}: ${msg}`);
|
|
54
44
|
};
|
|
55
|
-
|
|
45
|
+
const PREFIX = "[ Module Federation ]";
|
|
46
|
+
const DEFAULT_DELEGATE = console;
|
|
47
|
+
const LOGGER_STACK_SKIP_TOKENS = [
|
|
48
|
+
"logger.ts",
|
|
49
|
+
"logger.js",
|
|
50
|
+
"captureStackTrace",
|
|
51
|
+
"Logger.emit",
|
|
52
|
+
"Logger.log",
|
|
53
|
+
"Logger.info",
|
|
54
|
+
"Logger.warn",
|
|
55
|
+
"Logger.error",
|
|
56
|
+
"Logger.debug"
|
|
57
|
+
];
|
|
58
|
+
function captureStackTrace() {
|
|
59
|
+
try {
|
|
60
|
+
const stack = new Error().stack;
|
|
61
|
+
if (!stack) {
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
const [, ...rawLines] = stack.split("\n");
|
|
65
|
+
const filtered = rawLines.filter((line) => !LOGGER_STACK_SKIP_TOKENS.some((token) => line.includes(token)));
|
|
66
|
+
if (!filtered.length) {
|
|
67
|
+
return void 0;
|
|
68
|
+
}
|
|
69
|
+
const stackPreview = filtered.slice(0, 5).join("\n");
|
|
70
|
+
return `Stack trace:
|
|
71
|
+
${stackPreview}`;
|
|
72
|
+
} catch {
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
class Logger {
|
|
77
|
+
constructor(prefix, delegate = DEFAULT_DELEGATE) {
|
|
78
|
+
this.prefix = prefix;
|
|
79
|
+
this.delegate = delegate ?? DEFAULT_DELEGATE;
|
|
80
|
+
}
|
|
56
81
|
setPrefix(prefix) {
|
|
57
82
|
this.prefix = prefix;
|
|
58
83
|
}
|
|
84
|
+
setDelegate(delegate) {
|
|
85
|
+
this.delegate = delegate ?? DEFAULT_DELEGATE;
|
|
86
|
+
}
|
|
87
|
+
emit(method, args) {
|
|
88
|
+
const delegate = this.delegate;
|
|
89
|
+
const debugMode = isDebugMode();
|
|
90
|
+
const stackTrace = debugMode ? captureStackTrace() : void 0;
|
|
91
|
+
const enrichedArgs = stackTrace ? [...args, stackTrace] : args;
|
|
92
|
+
const order = (() => {
|
|
93
|
+
switch (method) {
|
|
94
|
+
case "log":
|
|
95
|
+
return ["log", "info"];
|
|
96
|
+
case "info":
|
|
97
|
+
return ["info", "log"];
|
|
98
|
+
case "warn":
|
|
99
|
+
return ["warn", "info", "log"];
|
|
100
|
+
case "error":
|
|
101
|
+
return ["error", "warn", "log"];
|
|
102
|
+
case "debug":
|
|
103
|
+
default:
|
|
104
|
+
return ["debug", "log"];
|
|
105
|
+
}
|
|
106
|
+
})();
|
|
107
|
+
for (const candidate of order) {
|
|
108
|
+
const handler = delegate[candidate];
|
|
109
|
+
if (typeof handler === "function") {
|
|
110
|
+
handler.call(delegate, this.prefix, ...enrichedArgs);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
for (const candidate of order) {
|
|
115
|
+
const handler = DEFAULT_DELEGATE[candidate];
|
|
116
|
+
if (typeof handler === "function") {
|
|
117
|
+
handler.call(DEFAULT_DELEGATE, this.prefix, ...enrichedArgs);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
59
122
|
log(...args) {
|
|
60
|
-
|
|
123
|
+
this.emit("log", args);
|
|
61
124
|
}
|
|
62
125
|
warn(...args) {
|
|
63
|
-
|
|
126
|
+
this.emit("warn", args);
|
|
64
127
|
}
|
|
65
128
|
error(...args) {
|
|
66
|
-
|
|
129
|
+
this.emit("error", args);
|
|
67
130
|
}
|
|
68
131
|
success(...args) {
|
|
69
|
-
|
|
132
|
+
this.emit("info", args);
|
|
70
133
|
}
|
|
71
134
|
info(...args) {
|
|
72
|
-
|
|
135
|
+
this.emit("info", args);
|
|
73
136
|
}
|
|
74
137
|
ready(...args) {
|
|
75
|
-
|
|
138
|
+
this.emit("info", args);
|
|
76
139
|
}
|
|
77
140
|
debug(...args) {
|
|
78
141
|
if (isDebugMode()) {
|
|
79
|
-
|
|
142
|
+
this.emit("debug", args);
|
|
80
143
|
}
|
|
81
144
|
}
|
|
82
|
-
|
|
83
|
-
this.prefix = prefix;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
145
|
+
}
|
|
86
146
|
function createLogger(prefix) {
|
|
87
147
|
return new Logger(prefix);
|
|
88
148
|
}
|
|
149
|
+
function createInfrastructureLogger(prefix) {
|
|
150
|
+
const infrastructureLogger = new Logger(prefix);
|
|
151
|
+
Object.defineProperty(infrastructureLogger, "__mf_infrastructure_logger__", {
|
|
152
|
+
value: true,
|
|
153
|
+
enumerable: false,
|
|
154
|
+
configurable: false
|
|
155
|
+
});
|
|
156
|
+
return infrastructureLogger;
|
|
157
|
+
}
|
|
158
|
+
createInfrastructureLogger(PREFIX);
|
|
89
159
|
async function safeWrapper(callback, disableWarn) {
|
|
90
160
|
try {
|
|
91
161
|
const res2 = await callback();
|
|
@@ -185,10 +255,7 @@ function createScript(info) {
|
|
|
185
255
|
timeoutId = setTimeout(() => {
|
|
186
256
|
onScriptComplete(null, new Error(`Remote script "${info.url}" time-outed.`));
|
|
187
257
|
}, timeout);
|
|
188
|
-
return {
|
|
189
|
-
script: script2,
|
|
190
|
-
needAttach
|
|
191
|
-
};
|
|
258
|
+
return { script: script2, needAttach };
|
|
192
259
|
}
|
|
193
260
|
function createLink(info) {
|
|
194
261
|
let link = null;
|
|
@@ -250,10 +317,7 @@ function createLink(info) {
|
|
|
250
317
|
};
|
|
251
318
|
link.onerror = onLinkComplete.bind(null, link.onerror);
|
|
252
319
|
link.onload = onLinkComplete.bind(null, link.onload);
|
|
253
|
-
return {
|
|
254
|
-
link,
|
|
255
|
-
needAttach
|
|
256
|
-
};
|
|
320
|
+
return { link, needAttach };
|
|
257
321
|
}
|
|
258
322
|
function loadScript(url2, info) {
|
|
259
323
|
const { attrs: attrs2 = {}, createScriptHook } = info;
|
|
@@ -262,9 +326,10 @@ function loadScript(url2, info) {
|
|
|
262
326
|
url: url2,
|
|
263
327
|
cb: resolve,
|
|
264
328
|
onErrorCallback: reject,
|
|
265
|
-
attrs:
|
|
266
|
-
fetchpriority: "high"
|
|
267
|
-
|
|
329
|
+
attrs: {
|
|
330
|
+
fetchpriority: "high",
|
|
331
|
+
...attrs2
|
|
332
|
+
},
|
|
268
333
|
createScriptHook,
|
|
269
334
|
needDeleteScript: true
|
|
270
335
|
});
|
|
@@ -325,27 +390,24 @@ const createScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "we
|
|
|
325
390
|
return typeof fetch === "undefined" ? loadNodeFetch() : fetch;
|
|
326
391
|
};
|
|
327
392
|
const handleScriptFetch = async (f, urlObj) => {
|
|
393
|
+
var _a;
|
|
328
394
|
try {
|
|
329
|
-
var _vm_constants;
|
|
330
395
|
const res = await f(urlObj.href);
|
|
331
396
|
const data = await res.text();
|
|
332
397
|
const [path, vm] = await Promise.all([
|
|
333
398
|
importNodeModule("path"),
|
|
334
399
|
importNodeModule("vm")
|
|
335
400
|
]);
|
|
336
|
-
const scriptContext = {
|
|
337
|
-
exports: {},
|
|
338
|
-
module: {
|
|
339
|
-
exports: {}
|
|
340
|
-
}
|
|
341
|
-
};
|
|
401
|
+
const scriptContext = { exports: {}, module: { exports: {} } };
|
|
342
402
|
const urlDirname = urlObj.pathname.split("/").slice(0, -1).join("/");
|
|
343
403
|
const filename = path.basename(urlObj.pathname);
|
|
344
|
-
var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;
|
|
345
404
|
const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
|
|
346
405
|
})`, {
|
|
347
406
|
filename,
|
|
348
|
-
importModuleDynamically: (
|
|
407
|
+
importModuleDynamically: (
|
|
408
|
+
//@ts-ignore
|
|
409
|
+
((_a = vm.constants) == null ? void 0 : _a.USE_MAIN_CONTEXT_DEFAULT_LOADER) ?? importNodeModule
|
|
410
|
+
)
|
|
349
411
|
});
|
|
350
412
|
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
|
|
351
413
|
const exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
@@ -381,11 +443,11 @@ const createScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "we
|
|
|
381
443
|
const loadScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "web" ? (url2, info) => {
|
|
382
444
|
return new Promise((resolve, reject) => {
|
|
383
445
|
createScriptNode(url2, (error, scriptContext2) => {
|
|
446
|
+
var _a, _b;
|
|
384
447
|
if (error) {
|
|
385
448
|
reject(error);
|
|
386
449
|
} else {
|
|
387
|
-
|
|
388
|
-
const remoteEntryKey = (info == null ? void 0 : (_info_attrs = info.attrs) == null ? void 0 : _info_attrs["globalName"]) || `__FEDERATION_${info == null ? void 0 : (_info_attrs1 = info.attrs) == null ? void 0 : _info_attrs1["name"]}:custom__`;
|
|
450
|
+
const remoteEntryKey = ((_a = info == null ? void 0 : info.attrs) == null ? void 0 : _a["globalName"]) || `__FEDERATION_${(_b = info == null ? void 0 : info.attrs) == null ? void 0 : _b["name"]}:custom__`;
|
|
389
451
|
const entryExports = globalThis[remoteEntryKey] = scriptContext2;
|
|
390
452
|
resolve(entryExports);
|
|
391
453
|
}
|
|
@@ -399,8 +461,8 @@ async function loadModule(url2, options) {
|
|
|
399
461
|
if (esmModuleCache.has(url2)) {
|
|
400
462
|
return esmModuleCache.get(url2);
|
|
401
463
|
}
|
|
402
|
-
const { fetch:
|
|
403
|
-
const response = await
|
|
464
|
+
const { fetch: fetch2, vm: vm2 } = options;
|
|
465
|
+
const response = await fetch2(url2);
|
|
404
466
|
const code = await response.text();
|
|
405
467
|
const module2 = new vm2.SourceTextModule(code, {
|
|
406
468
|
// @ts-ignore
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
function _extends() {
|
|
2
|
-
_extends = Object.assign || function assign(target) {
|
|
3
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
4
|
-
var source = arguments[i];
|
|
5
|
-
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
6
|
-
}
|
|
7
|
-
return target;
|
|
8
|
-
};
|
|
9
|
-
return _extends.apply(this, arguments);
|
|
10
|
-
}
|
|
11
1
|
const MANIFEST_EXT = ".json";
|
|
12
2
|
const BROWSER_LOG_KEY = "FEDERATION_DEBUG";
|
|
13
3
|
const SEPARATOR = ":";
|
|
@@ -51,40 +41,120 @@ const composeKeyWithSeparator = function(...args) {
|
|
|
51
41
|
const warn = (msg) => {
|
|
52
42
|
console.warn(`${LOG_CATEGORY}: ${msg}`);
|
|
53
43
|
};
|
|
54
|
-
|
|
44
|
+
const PREFIX = "[ Module Federation ]";
|
|
45
|
+
const DEFAULT_DELEGATE = console;
|
|
46
|
+
const LOGGER_STACK_SKIP_TOKENS = [
|
|
47
|
+
"logger.ts",
|
|
48
|
+
"logger.js",
|
|
49
|
+
"captureStackTrace",
|
|
50
|
+
"Logger.emit",
|
|
51
|
+
"Logger.log",
|
|
52
|
+
"Logger.info",
|
|
53
|
+
"Logger.warn",
|
|
54
|
+
"Logger.error",
|
|
55
|
+
"Logger.debug"
|
|
56
|
+
];
|
|
57
|
+
function captureStackTrace() {
|
|
58
|
+
try {
|
|
59
|
+
const stack = new Error().stack;
|
|
60
|
+
if (!stack) {
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
const [, ...rawLines] = stack.split("\n");
|
|
64
|
+
const filtered = rawLines.filter((line) => !LOGGER_STACK_SKIP_TOKENS.some((token) => line.includes(token)));
|
|
65
|
+
if (!filtered.length) {
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
const stackPreview = filtered.slice(0, 5).join("\n");
|
|
69
|
+
return `Stack trace:
|
|
70
|
+
${stackPreview}`;
|
|
71
|
+
} catch {
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class Logger {
|
|
76
|
+
constructor(prefix, delegate = DEFAULT_DELEGATE) {
|
|
77
|
+
this.prefix = prefix;
|
|
78
|
+
this.delegate = delegate ?? DEFAULT_DELEGATE;
|
|
79
|
+
}
|
|
55
80
|
setPrefix(prefix) {
|
|
56
81
|
this.prefix = prefix;
|
|
57
82
|
}
|
|
83
|
+
setDelegate(delegate) {
|
|
84
|
+
this.delegate = delegate ?? DEFAULT_DELEGATE;
|
|
85
|
+
}
|
|
86
|
+
emit(method, args) {
|
|
87
|
+
const delegate = this.delegate;
|
|
88
|
+
const debugMode = isDebugMode();
|
|
89
|
+
const stackTrace = debugMode ? captureStackTrace() : void 0;
|
|
90
|
+
const enrichedArgs = stackTrace ? [...args, stackTrace] : args;
|
|
91
|
+
const order = (() => {
|
|
92
|
+
switch (method) {
|
|
93
|
+
case "log":
|
|
94
|
+
return ["log", "info"];
|
|
95
|
+
case "info":
|
|
96
|
+
return ["info", "log"];
|
|
97
|
+
case "warn":
|
|
98
|
+
return ["warn", "info", "log"];
|
|
99
|
+
case "error":
|
|
100
|
+
return ["error", "warn", "log"];
|
|
101
|
+
case "debug":
|
|
102
|
+
default:
|
|
103
|
+
return ["debug", "log"];
|
|
104
|
+
}
|
|
105
|
+
})();
|
|
106
|
+
for (const candidate of order) {
|
|
107
|
+
const handler = delegate[candidate];
|
|
108
|
+
if (typeof handler === "function") {
|
|
109
|
+
handler.call(delegate, this.prefix, ...enrichedArgs);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (const candidate of order) {
|
|
114
|
+
const handler = DEFAULT_DELEGATE[candidate];
|
|
115
|
+
if (typeof handler === "function") {
|
|
116
|
+
handler.call(DEFAULT_DELEGATE, this.prefix, ...enrichedArgs);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
58
121
|
log(...args) {
|
|
59
|
-
|
|
122
|
+
this.emit("log", args);
|
|
60
123
|
}
|
|
61
124
|
warn(...args) {
|
|
62
|
-
|
|
125
|
+
this.emit("warn", args);
|
|
63
126
|
}
|
|
64
127
|
error(...args) {
|
|
65
|
-
|
|
128
|
+
this.emit("error", args);
|
|
66
129
|
}
|
|
67
130
|
success(...args) {
|
|
68
|
-
|
|
131
|
+
this.emit("info", args);
|
|
69
132
|
}
|
|
70
133
|
info(...args) {
|
|
71
|
-
|
|
134
|
+
this.emit("info", args);
|
|
72
135
|
}
|
|
73
136
|
ready(...args) {
|
|
74
|
-
|
|
137
|
+
this.emit("info", args);
|
|
75
138
|
}
|
|
76
139
|
debug(...args) {
|
|
77
140
|
if (isDebugMode()) {
|
|
78
|
-
|
|
141
|
+
this.emit("debug", args);
|
|
79
142
|
}
|
|
80
143
|
}
|
|
81
|
-
|
|
82
|
-
this.prefix = prefix;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
144
|
+
}
|
|
85
145
|
function createLogger(prefix) {
|
|
86
146
|
return new Logger(prefix);
|
|
87
147
|
}
|
|
148
|
+
function createInfrastructureLogger(prefix) {
|
|
149
|
+
const infrastructureLogger = new Logger(prefix);
|
|
150
|
+
Object.defineProperty(infrastructureLogger, "__mf_infrastructure_logger__", {
|
|
151
|
+
value: true,
|
|
152
|
+
enumerable: false,
|
|
153
|
+
configurable: false
|
|
154
|
+
});
|
|
155
|
+
return infrastructureLogger;
|
|
156
|
+
}
|
|
157
|
+
createInfrastructureLogger(PREFIX);
|
|
88
158
|
async function safeWrapper(callback, disableWarn) {
|
|
89
159
|
try {
|
|
90
160
|
const res2 = await callback();
|
|
@@ -184,10 +254,7 @@ function createScript(info) {
|
|
|
184
254
|
timeoutId = setTimeout(() => {
|
|
185
255
|
onScriptComplete(null, new Error(`Remote script "${info.url}" time-outed.`));
|
|
186
256
|
}, timeout);
|
|
187
|
-
return {
|
|
188
|
-
script: script2,
|
|
189
|
-
needAttach
|
|
190
|
-
};
|
|
257
|
+
return { script: script2, needAttach };
|
|
191
258
|
}
|
|
192
259
|
function createLink(info) {
|
|
193
260
|
let link = null;
|
|
@@ -249,10 +316,7 @@ function createLink(info) {
|
|
|
249
316
|
};
|
|
250
317
|
link.onerror = onLinkComplete.bind(null, link.onerror);
|
|
251
318
|
link.onload = onLinkComplete.bind(null, link.onload);
|
|
252
|
-
return {
|
|
253
|
-
link,
|
|
254
|
-
needAttach
|
|
255
|
-
};
|
|
319
|
+
return { link, needAttach };
|
|
256
320
|
}
|
|
257
321
|
function loadScript(url2, info) {
|
|
258
322
|
const { attrs: attrs2 = {}, createScriptHook } = info;
|
|
@@ -261,9 +325,10 @@ function loadScript(url2, info) {
|
|
|
261
325
|
url: url2,
|
|
262
326
|
cb: resolve,
|
|
263
327
|
onErrorCallback: reject,
|
|
264
|
-
attrs:
|
|
265
|
-
fetchpriority: "high"
|
|
266
|
-
|
|
328
|
+
attrs: {
|
|
329
|
+
fetchpriority: "high",
|
|
330
|
+
...attrs2
|
|
331
|
+
},
|
|
267
332
|
createScriptHook,
|
|
268
333
|
needDeleteScript: true
|
|
269
334
|
});
|
|
@@ -324,27 +389,24 @@ const createScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "we
|
|
|
324
389
|
return typeof fetch === "undefined" ? loadNodeFetch() : fetch;
|
|
325
390
|
};
|
|
326
391
|
const handleScriptFetch = async (f, urlObj) => {
|
|
392
|
+
var _a;
|
|
327
393
|
try {
|
|
328
|
-
var _vm_constants;
|
|
329
394
|
const res = await f(urlObj.href);
|
|
330
395
|
const data = await res.text();
|
|
331
396
|
const [path, vm] = await Promise.all([
|
|
332
397
|
importNodeModule("path"),
|
|
333
398
|
importNodeModule("vm")
|
|
334
399
|
]);
|
|
335
|
-
const scriptContext = {
|
|
336
|
-
exports: {},
|
|
337
|
-
module: {
|
|
338
|
-
exports: {}
|
|
339
|
-
}
|
|
340
|
-
};
|
|
400
|
+
const scriptContext = { exports: {}, module: { exports: {} } };
|
|
341
401
|
const urlDirname = urlObj.pathname.split("/").slice(0, -1).join("/");
|
|
342
402
|
const filename = path.basename(urlObj.pathname);
|
|
343
|
-
var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;
|
|
344
403
|
const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
|
|
345
404
|
})`, {
|
|
346
405
|
filename,
|
|
347
|
-
importModuleDynamically: (
|
|
406
|
+
importModuleDynamically: (
|
|
407
|
+
//@ts-ignore
|
|
408
|
+
((_a = vm.constants) == null ? void 0 : _a.USE_MAIN_CONTEXT_DEFAULT_LOADER) ?? importNodeModule
|
|
409
|
+
)
|
|
348
410
|
});
|
|
349
411
|
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
|
|
350
412
|
const exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
@@ -380,11 +442,11 @@ const createScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "we
|
|
|
380
442
|
const loadScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "web" ? (url2, info) => {
|
|
381
443
|
return new Promise((resolve, reject) => {
|
|
382
444
|
createScriptNode(url2, (error, scriptContext2) => {
|
|
445
|
+
var _a, _b;
|
|
383
446
|
if (error) {
|
|
384
447
|
reject(error);
|
|
385
448
|
} else {
|
|
386
|
-
|
|
387
|
-
const remoteEntryKey = (info == null ? void 0 : (_info_attrs = info.attrs) == null ? void 0 : _info_attrs["globalName"]) || `__FEDERATION_${info == null ? void 0 : (_info_attrs1 = info.attrs) == null ? void 0 : _info_attrs1["name"]}:custom__`;
|
|
449
|
+
const remoteEntryKey = ((_a = info == null ? void 0 : info.attrs) == null ? void 0 : _a["globalName"]) || `__FEDERATION_${(_b = info == null ? void 0 : info.attrs) == null ? void 0 : _b["name"]}:custom__`;
|
|
388
450
|
const entryExports = globalThis[remoteEntryKey] = scriptContext2;
|
|
389
451
|
resolve(entryExports);
|
|
390
452
|
}
|
|
@@ -398,8 +460,8 @@ async function loadModule(url2, options) {
|
|
|
398
460
|
if (esmModuleCache.has(url2)) {
|
|
399
461
|
return esmModuleCache.get(url2);
|
|
400
462
|
}
|
|
401
|
-
const { fetch:
|
|
402
|
-
const response = await
|
|
463
|
+
const { fetch: fetch2, vm: vm2 } = options;
|
|
464
|
+
const response = await fetch2(url2);
|
|
403
465
|
const code = await response.text();
|
|
404
466
|
const module = new vm2.SourceTextModule(code, {
|
|
405
467
|
// @ts-ignore
|
|
@@ -419,12 +481,12 @@ async function loadModule(url2, options) {
|
|
|
419
481
|
export {
|
|
420
482
|
MANIFEST_EXT as M,
|
|
421
483
|
SEPARATOR as S,
|
|
422
|
-
|
|
423
|
-
|
|
484
|
+
createLink as a,
|
|
485
|
+
createScript as b,
|
|
424
486
|
createLogger as c,
|
|
425
|
-
|
|
426
|
-
|
|
487
|
+
isBrowserEnv as d,
|
|
488
|
+
composeKeyWithSeparator as e,
|
|
427
489
|
loadScript as f,
|
|
428
|
-
|
|
490
|
+
isDebugMode as i,
|
|
429
491
|
loadScriptNode as l
|
|
430
492
|
};
|
package/dist/{lazy-load-component-plugin-D6tEPyvX.mjs → lazy-load-component-plugin-CNyT62wB.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as injectDataFetch, p as prefetch } from "./prefetch-
|
|
2
|
-
import { i as initDataFetchMap, j as isDataLoaderExpose, k as getDataFetchInfo, m as getDataFetchMapKey, l as logger, n as getDataFetchItem, o as DATA_FETCH_CLIENT_SUFFIX, p as MF_DATA_FETCH_TYPE, q as isCSROnly,
|
|
1
|
+
import { i as injectDataFetch, p as prefetch } from "./prefetch-lrSPKiuu.mjs";
|
|
2
|
+
import { i as initDataFetchMap, j as isDataLoaderExpose, k as getDataFetchInfo, m as getDataFetchMapKey, l as logger, n as getDataFetchItem, o as DATA_FETCH_CLIENT_SUFFIX, p as MF_DATA_FETCH_TYPE, q as isCSROnly, h as loadDataFetchModule, M as MF_DATA_FETCH_STATUS, e as getDataFetchMap, t as isServerEnv, u as getDataFetchIdWithErrorMsgs, v as DATA_FETCH_ERROR_PREFIX, E as ERROR_TYPE, w as wrapDataFetchId, L as LOAD_REMOTE_ERROR_PREFIX, x as DATA_FETCH_FUNCTION, y as getLoadedRemoteInfos, f as fetchData$1, z as setDataFetchItemLoadedStatus, F as FS_HREF } from "./utils-dUgb9Jkm.mjs";
|
|
3
3
|
import React__default, { useRef, useState, Suspense, useEffect } from "react";
|
|
4
4
|
const autoFetchData = () => {
|
|
5
5
|
initDataFetchMap();
|
package/dist/{lazy-load-component-plugin-CWNzJM0v.js → lazy-load-component-plugin-Dr5VV1mu.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const prefetch = require("./prefetch-
|
|
3
|
-
const lazyUtils = require("./utils-
|
|
2
|
+
const prefetch = require("./prefetch-J3x-_5zT.js");
|
|
3
|
+
const lazyUtils = require("./utils-tM9yE73c.js");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const autoFetchData = () => {
|
|
6
6
|
lazyUtils.initDataFetchMap();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-
|
|
4
|
-
require("./prefetch-
|
|
3
|
+
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-Dr5VV1mu.js");
|
|
4
|
+
require("./prefetch-J3x-_5zT.js");
|
|
5
5
|
exports.default = lazyLoadComponentPlugin.lazyLoadComponentPlugin;
|
|
6
6
|
exports.lazyLoadComponentPlugin = lazyLoadComponentPlugin.lazyLoadComponentPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l, l as l2 } from "./lazy-load-component-plugin-
|
|
2
|
-
import "./prefetch-
|
|
1
|
+
import { l, l as l2 } from "./lazy-load-component-plugin-CNyT62wB.mjs";
|
|
2
|
+
import "./prefetch-lrSPKiuu.mjs";
|
|
3
3
|
export {
|
|
4
4
|
l as default,
|
|
5
5
|
l2 as lazyLoadComponentPlugin
|
package/dist/lazy-utils.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("./index.esm-
|
|
4
|
-
const lazyUtils = require("./utils-
|
|
3
|
+
require("./index.esm-BWaKho-8.js");
|
|
4
|
+
const lazyUtils = require("./utils-tM9yE73c.js");
|
|
5
5
|
exports.callAllDowngrade = lazyUtils.callAllDowngrade;
|
|
6
6
|
exports.callDowngrade = lazyUtils.callDowngrade;
|
|
7
7
|
exports.fetchData = lazyUtils.fetchData;
|
package/dist/lazy-utils.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./index.esm-
|
|
2
|
-
import { G, H, f, J, I, u, k, n,
|
|
1
|
+
import "./index.esm-CPwSeCvw.mjs";
|
|
2
|
+
import { G, H, f, J, I, u, k, n, e, m, B, y, i, q, j, t, h, z, s, w } from "./utils-dUgb9Jkm.mjs";
|
|
3
3
|
export {
|
|
4
4
|
G as callAllDowngrade,
|
|
5
5
|
H as callDowngrade,
|
|
@@ -9,7 +9,7 @@ export {
|
|
|
9
9
|
u as getDataFetchIdWithErrorMsgs,
|
|
10
10
|
k as getDataFetchInfo,
|
|
11
11
|
n as getDataFetchItem,
|
|
12
|
-
|
|
12
|
+
e as getDataFetchMap,
|
|
13
13
|
m as getDataFetchMapKey,
|
|
14
14
|
B as getDowngradeTag,
|
|
15
15
|
y as getLoadedRemoteInfos,
|
|
@@ -17,7 +17,7 @@ export {
|
|
|
17
17
|
q as isCSROnly,
|
|
18
18
|
j as isDataLoaderExpose,
|
|
19
19
|
t as isServerEnv,
|
|
20
|
-
|
|
20
|
+
h as loadDataFetchModule,
|
|
21
21
|
z as setDataFetchItemLoadedStatus,
|
|
22
22
|
s as setSSREnv,
|
|
23
23
|
w as wrapDataFetchId
|