@module-federation/bridge-react 2.6.0 → 2.8.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/base.cjs.js +4 -4
- package/dist/base.d.ts +8 -311
- package/dist/base.es.js +5 -5
- package/dist/{bridge-base-CIOXqUYV.mjs → bridge-base-BaKy6CY_.mjs} +25 -92
- package/dist/{bridge-base-HLp3d7aF.js → bridge-base-Ch33UJuN.js} +25 -91
- package/dist/{createHelpers-DNBacpxb.js → createHelpers-19BP0xtB.js} +2 -3
- package/dist/{createHelpers-BY5Uj9_Z.mjs → createHelpers-BSHeKyd-.mjs} +2 -3
- package/dist/data-fetch-server-middleware.cjs.js +1 -1
- package/dist/data-fetch-server-middleware.d.ts +1 -15
- package/dist/data-fetch-server-middleware.es.js +1 -1
- package/dist/data-fetch-utils.cjs.js +2 -2
- package/dist/data-fetch-utils.d.ts +1 -81
- package/dist/data-fetch-utils.es.js +4 -4
- package/dist/data-fetch.cjs.js +3 -3
- package/dist/data-fetch.d.ts +4 -140
- package/dist/data-fetch.es.js +3 -3
- package/dist/error-boundary.d.ts +17 -0
- package/dist/error-boundary.spec.d.ts +1 -0
- package/dist/index.cjs.js +4 -4
- package/dist/index.d.ts +12 -299
- package/dist/index.es.js +5 -5
- package/dist/lazy/AwaitDataFetch.d.ts +24 -0
- package/dist/lazy/constant.d.ts +26 -0
- package/dist/lazy/createLazyComponent.d.ts +28 -0
- package/dist/lazy/data-fetch/cache.d.ts +34 -0
- package/dist/lazy/data-fetch/cache.spec.d.ts +1 -0
- package/dist/lazy/data-fetch/call-data-fetch.d.ts +1 -0
- package/dist/lazy/data-fetch/data-fetch-server-middleware.d.ts +3 -0
- package/dist/lazy/data-fetch/index.d.ts +6 -0
- package/dist/lazy/data-fetch/inject-data-fetch.d.ts +4 -0
- package/dist/lazy/data-fetch/prefetch.d.ts +9 -0
- package/dist/lazy/data-fetch/runtime-plugin.d.ts +3 -0
- package/dist/lazy/index.d.ts +9 -0
- package/dist/lazy/logger.d.ts +2 -0
- package/dist/lazy/types.d.ts +60 -0
- package/dist/lazy/utils.d.ts +48 -0
- package/dist/lazy/wrapNoSSR.d.ts +9 -0
- package/dist/{lazy-load-component-plugin-BYI941I2.mjs → lazy-load-component-plugin-DEu-DfZt.mjs} +2 -2
- package/dist/{lazy-load-component-plugin-DG4e3Tib.js → lazy-load-component-plugin-FKp6nQa-.js} +2 -2
- package/dist/lazy-load-component-plugin.cjs.js +2 -2
- package/dist/lazy-load-component-plugin.d.ts +2 -16
- package/dist/lazy-load-component-plugin.es.js +2 -2
- package/dist/lazy-utils.cjs.js +1 -1
- package/dist/lazy-utils.d.ts +1 -149
- package/dist/lazy-utils.es.js +2 -2
- package/dist/plugin.d.ts +2 -22
- package/dist/plugins/lazy-load-component-plugin.d.ts +12 -0
- package/dist/plugins/lazy-load-component-plugin.spec.d.ts +1 -0
- package/dist/{prefetch-DzO9_QQ-.mjs → prefetch-CTZuFBqh.mjs} +387 -16
- package/dist/{prefetch-CG2l-06N.js → prefetch-D66kL1aM.js} +387 -16
- package/dist/provider/context.d.ts +3 -0
- package/dist/provider/plugin.d.ts +7 -0
- package/dist/provider/versions/bridge-base.d.ts +5 -0
- package/dist/provider/versions/legacy.d.ts +26 -0
- package/dist/provider/versions/v18.d.ts +19 -0
- package/dist/provider/versions/v19.d.ts +21 -0
- package/dist/remote/RemoteAppWrapper.d.ts +7 -0
- package/dist/remote/base-component/component.d.ts +2 -0
- package/dist/remote/base-component/create.d.ts +9 -0
- package/dist/remote/base-component/index.d.ts +5 -0
- package/dist/remote/createHelpers.d.ts +17 -0
- package/dist/remote/router-component/component.d.ts +8 -0
- package/dist/remote/router-component/create.d.ts +9 -0
- package/dist/remote/router-component/index.d.ts +5 -0
- package/dist/router/default.d.ts +7 -0
- package/dist/router/v5.d.ts +4 -0
- package/dist/router/v6.d.ts +7 -0
- package/dist/router/v7.d.ts +6 -0
- package/dist/router-v5.d.ts +1 -17
- package/dist/router-v6.d.ts +1 -20
- package/dist/router-v7.d.ts +1 -19
- package/dist/router.d.ts +1 -20
- package/dist/shared/size-limited-cache.d.ts +29 -0
- package/dist/shared/size-limited-cache.spec.d.ts +1 -0
- package/dist/size-limited-cache.cjs.js +82 -0
- package/dist/size-limited-cache.d.ts +1 -0
- package/dist/size-limited-cache.es.js +82 -0
- package/dist/types.d.ts +137 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils-5dGErM3C.js +588 -0
- package/dist/utils-BBP3hEeV.mjs +589 -0
- package/dist/v18.cjs.js +1 -1
- package/dist/v18.d.ts +3 -114
- package/dist/v18.es.js +1 -1
- package/dist/v19.cjs.js +1 -1
- package/dist/v19.d.ts +3 -115
- package/dist/v19.es.js +1 -1
- package/package.json +20 -13
- package/dist/utils-CFTy4LVE.js +0 -2029
- package/dist/utils-DGS4pYp8.mjs +0 -2030
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const lazyUtils = require("./utils-
|
|
2
|
+
const lazyUtils = require("./utils-5dGErM3C.js");
|
|
3
3
|
const logger = require("./logger-Dxblx6P-.js");
|
|
4
4
|
async function safeWrapper(callback, disableWarn) {
|
|
5
5
|
try {
|
|
@@ -216,16 +216,12 @@ function importNodeModule(name) {
|
|
|
216
216
|
sdkImportCache.set(name, promise);
|
|
217
217
|
return promise;
|
|
218
218
|
}
|
|
219
|
-
const loadNodeFetch = async () => {
|
|
220
|
-
const fetchModule = await importNodeModule("node-fetch");
|
|
221
|
-
return fetchModule.default || fetchModule;
|
|
222
|
-
};
|
|
223
219
|
const lazyLoaderHookFetch = async (input, init, loaderHook) => {
|
|
224
220
|
const hook = (url, init2) => {
|
|
225
221
|
return loaderHook.lifecycle.fetch.emit(url, init2);
|
|
226
222
|
};
|
|
227
223
|
const res = await hook(input, init || {});
|
|
228
|
-
if (!res || !(res instanceof Response)) return
|
|
224
|
+
if (!res || !(res instanceof Response)) return fetch(input, init || {});
|
|
229
225
|
return res;
|
|
230
226
|
};
|
|
231
227
|
const createScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "web" ? (url, cb, attrs, loaderHook) => {
|
|
@@ -243,7 +239,7 @@ const createScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "we
|
|
|
243
239
|
}
|
|
244
240
|
const getFetch = async () => {
|
|
245
241
|
if (loaderHook == null ? void 0 : loaderHook.fetch) return (input, init) => lazyLoaderHookFetch(input, init, loaderHook);
|
|
246
|
-
return
|
|
242
|
+
return fetch;
|
|
247
243
|
};
|
|
248
244
|
const handleScriptFetch = async (f, urlObj2) => {
|
|
249
245
|
var _a;
|
|
@@ -307,20 +303,82 @@ const loadScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "web"
|
|
|
307
303
|
throw new Error("loadScriptNode is disabled in non-Node.js environment");
|
|
308
304
|
};
|
|
309
305
|
const esmModuleCache = /* @__PURE__ */ new Map();
|
|
306
|
+
const isFetchableRemoteModuleUrl = (url) => url.startsWith("http:") || url.startsWith("https:");
|
|
307
|
+
const isBareModuleSpecifier = (specifier) => !specifier.startsWith("./") && !specifier.startsWith("../") && !specifier.startsWith("/") && !specifier.includes(":");
|
|
308
|
+
function encodeRemoteModulePath(url) {
|
|
309
|
+
const remoteUrl = new URL(url);
|
|
310
|
+
const encodedProtocol = encodeURIComponent(remoteUrl.protocol.slice(0, -1));
|
|
311
|
+
const encodedHost = encodeURIComponent(remoteUrl.host);
|
|
312
|
+
const encodedPathname = remoteUrl.pathname.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
313
|
+
const encodedSearchHash = encodeURIComponent(`${remoteUrl.search}${remoteUrl.hash}`);
|
|
314
|
+
return `/${encodedProtocol}/${encodedHost}${encodedPathname}${encodedSearchHash ? `/${encodedSearchHash}` : ""}`;
|
|
315
|
+
}
|
|
316
|
+
function createImportMetaUrl(url, baseFileUrl) {
|
|
317
|
+
const baseUrl = baseFileUrl.endsWith("/") ? baseFileUrl : `${baseFileUrl}/`;
|
|
318
|
+
return new URL(`__module_federation_remote__${encodeRemoteModulePath(url)}`, baseUrl).href;
|
|
319
|
+
}
|
|
320
|
+
async function isNodeBuiltinSpecifier(specifier) {
|
|
321
|
+
if (specifier.startsWith("node:")) return true;
|
|
322
|
+
if (!isBareModuleSpecifier(specifier)) return false;
|
|
323
|
+
return (await importNodeModule("node:module")).builtinModules.includes(specifier);
|
|
324
|
+
}
|
|
325
|
+
function getSyntheticModuleExports(moduleExports) {
|
|
326
|
+
const namespaceObject = moduleExports && (typeof moduleExports === "object" || typeof moduleExports === "function") ? moduleExports : { default: moduleExports };
|
|
327
|
+
const effectiveExports = { ...namespaceObject };
|
|
328
|
+
if (!Object.prototype.hasOwnProperty.call(effectiveExports, "default")) effectiveExports.default = namespaceObject;
|
|
329
|
+
return effectiveExports;
|
|
330
|
+
}
|
|
331
|
+
async function createSyntheticModuleFromExports(identifier, moduleExports, vm) {
|
|
332
|
+
if (typeof vm.SyntheticModule !== "function") throw new Error("vm.SyntheticModule is required to load Node.js built-in modules in ESM remote entries.");
|
|
333
|
+
const effectiveExports = getSyntheticModuleExports(moduleExports);
|
|
334
|
+
const exportNames = Object.keys(effectiveExports);
|
|
335
|
+
const syntheticModule = new vm.SyntheticModule(exportNames, function setSyntheticModuleExports() {
|
|
336
|
+
for (const name of exportNames) this.setExport(name, effectiveExports[name]);
|
|
337
|
+
}, { identifier });
|
|
338
|
+
esmModuleCache.set(identifier, syntheticModule);
|
|
339
|
+
await syntheticModule.link(async () => {
|
|
340
|
+
throw new Error(`Node.js built-in module "${identifier}" should not request child modules.`);
|
|
341
|
+
});
|
|
342
|
+
await syntheticModule.evaluate();
|
|
343
|
+
return syntheticModule;
|
|
344
|
+
}
|
|
345
|
+
async function loadNodeBuiltinModule(specifier, vm) {
|
|
346
|
+
const cacheKey = `node-builtin:${specifier}`;
|
|
347
|
+
if (esmModuleCache.has(cacheKey)) return esmModuleCache.get(cacheKey);
|
|
348
|
+
return createSyntheticModuleFromExports(cacheKey, await importNodeModule(specifier), vm);
|
|
349
|
+
}
|
|
350
|
+
async function loadResolvedModule(specifier, parentUrl, options) {
|
|
351
|
+
if (await isNodeBuiltinSpecifier(specifier)) return loadNodeBuiltinModule(specifier, options.vm);
|
|
352
|
+
if (isBareModuleSpecifier(specifier)) throw new Error(`Unsupported ESM module specifier "${specifier}". Only relative or absolute http(s) remote modules and Node.js built-in modules are supported.`);
|
|
353
|
+
const resolvedUrl = new URL(specifier, parentUrl).href;
|
|
354
|
+
if (!isFetchableRemoteModuleUrl(resolvedUrl)) throw new Error(`Unsupported ESM module specifier "${specifier}" resolved to "${resolvedUrl}". Only http(s) remote modules and Node.js built-in modules are supported.`);
|
|
355
|
+
return loadModule(resolvedUrl, options);
|
|
356
|
+
}
|
|
357
|
+
async function evaluateDynamicModule(module2) {
|
|
358
|
+
if (module2.status === "linked") await module2.evaluate();
|
|
359
|
+
if (module2.status === "errored") throw module2.error;
|
|
360
|
+
return module2;
|
|
361
|
+
}
|
|
310
362
|
async function loadModule(url, options) {
|
|
311
363
|
if (esmModuleCache.has(url)) return esmModuleCache.get(url);
|
|
312
364
|
const { fetch: fetch2, vm } = options;
|
|
365
|
+
if (!isFetchableRemoteModuleUrl(url)) throw new Error(`Unsupported ESM module URL "${url}". Only http(s) remote modules and Node.js built-in modules are supported.`);
|
|
313
366
|
const code = await (await fetch2(url)).text();
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
367
|
+
const cwdFileUrl = (await importNodeModule("node:url")).pathToFileURL(process.cwd()).href;
|
|
368
|
+
const sourceTextModule = new vm.SourceTextModule(code, {
|
|
369
|
+
identifier: url,
|
|
370
|
+
initializeImportMeta: (meta) => {
|
|
371
|
+
meta.url = createImportMetaUrl(url, cwdFileUrl);
|
|
372
|
+
},
|
|
373
|
+
importModuleDynamically: async (specifier) => {
|
|
374
|
+
return evaluateDynamicModule(await loadResolvedModule(specifier, url, options));
|
|
375
|
+
}
|
|
322
376
|
});
|
|
323
|
-
|
|
377
|
+
esmModuleCache.set(url, sourceTextModule);
|
|
378
|
+
await sourceTextModule.link(async (specifier) => {
|
|
379
|
+
return loadResolvedModule(specifier, url, options);
|
|
380
|
+
});
|
|
381
|
+
return sourceTextModule;
|
|
324
382
|
}
|
|
325
383
|
const dataFetchFunction = async function(options) {
|
|
326
384
|
var _a, _b;
|
|
@@ -412,6 +470,9 @@ function logAndReport(code, descMap, args, logger2, originalErrorMsg, context) {
|
|
|
412
470
|
return logger2(getShortErrorMsg(code, descMap, args, originalErrorMsg));
|
|
413
471
|
}
|
|
414
472
|
const LOG_CATEGORY = "[ Federation Runtime ]";
|
|
473
|
+
function assert(condition, msgOrCode, descMap, args, context) {
|
|
474
|
+
if (!condition) error(msgOrCode);
|
|
475
|
+
}
|
|
415
476
|
function error(msgOrCode, descMap, args, originalErrorMsg, context) {
|
|
416
477
|
if (descMap !== void 0) return logAndReport(msgOrCode, descMap, args ?? {}, (msg2) => {
|
|
417
478
|
throw new Error(`${LOG_CATEGORY}: ${msg2}`);
|
|
@@ -423,6 +484,14 @@ function error(msgOrCode, descMap, args, originalErrorMsg, context) {
|
|
|
423
484
|
}
|
|
424
485
|
throw new Error(`${LOG_CATEGORY}: ${msg}`);
|
|
425
486
|
}
|
|
487
|
+
const processModuleAlias = (name, subPath) => {
|
|
488
|
+
let moduleName;
|
|
489
|
+
if (name.endsWith("/")) moduleName = name.slice(0, -1);
|
|
490
|
+
else moduleName = name;
|
|
491
|
+
if (subPath.startsWith(".")) subPath = subPath.slice(1);
|
|
492
|
+
moduleName = moduleName + subPath;
|
|
493
|
+
return moduleName;
|
|
494
|
+
};
|
|
426
495
|
const CurrentGlobal = typeof globalThis === "object" ? globalThis : window;
|
|
427
496
|
const nativeGlobal = (() => {
|
|
428
497
|
try {
|
|
@@ -475,6 +544,10 @@ const getRemoteEntryExports = (name, globalName) => {
|
|
|
475
544
|
};
|
|
476
545
|
const DEFAULT_SCOPE = "default";
|
|
477
546
|
const DEFAULT_REMOTE_TYPE = "global";
|
|
547
|
+
function composeRemoteRequestId(remoteName, expose) {
|
|
548
|
+
if (!expose || expose === ".") return remoteName;
|
|
549
|
+
return `${remoteName}/${expose.replace(/^\.\//, "")}`;
|
|
550
|
+
}
|
|
478
551
|
function matchRemoteWithNameAndExpose(remotes, id) {
|
|
479
552
|
for (const remote of remotes) {
|
|
480
553
|
const isNameMatched = id.startsWith(remote.name);
|
|
@@ -752,6 +825,42 @@ function getRemoteInfo(remote) {
|
|
|
752
825
|
shareScope: remote.shareScope || DEFAULT_SCOPE
|
|
753
826
|
};
|
|
754
827
|
}
|
|
828
|
+
function remoteToEntry(r) {
|
|
829
|
+
return {
|
|
830
|
+
name: r.name,
|
|
831
|
+
alias: r.alias,
|
|
832
|
+
entry: "entry" in r ? r.entry : void 0,
|
|
833
|
+
version: "version" in r ? r.version : void 0,
|
|
834
|
+
type: r.type,
|
|
835
|
+
entryGlobalName: r.entryGlobalName,
|
|
836
|
+
shareScope: r.shareScope
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
function optionsToMFContext(options) {
|
|
840
|
+
var _a, _b, _c, _d, _e, _f;
|
|
841
|
+
const shared = {};
|
|
842
|
+
for (const [pkgName, versions] of Object.entries(options.shared)) {
|
|
843
|
+
const first = versions[0];
|
|
844
|
+
if (first) shared[pkgName] = {
|
|
845
|
+
version: first.version,
|
|
846
|
+
singleton: (_a = first.shareConfig) == null ? void 0 : _a.singleton,
|
|
847
|
+
requiredVersion: ((_b = first.shareConfig) == null ? void 0 : _b.requiredVersion) === false ? false : (_c = first.shareConfig) == null ? void 0 : _c.requiredVersion,
|
|
848
|
+
eager: first.eager,
|
|
849
|
+
strictVersion: (_d = first.shareConfig) == null ? void 0 : _d.strictVersion
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
return {
|
|
853
|
+
project: {
|
|
854
|
+
name: options.name,
|
|
855
|
+
mfRole: ((_e = options.remotes) == null ? void 0 : _e.length) > 0 ? "host" : "unknown"
|
|
856
|
+
},
|
|
857
|
+
mfConfig: {
|
|
858
|
+
name: options.name,
|
|
859
|
+
remotes: ((_f = options.remotes) == null ? void 0 : _f.map(remoteToEntry)) ?? [],
|
|
860
|
+
shared
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
}
|
|
755
864
|
function isTimeoutError(error2) {
|
|
756
865
|
if (!(error2 instanceof Error)) return false;
|
|
757
866
|
return error2.message.includes("timed out") || error2.name.includes("Timeout");
|
|
@@ -929,8 +1038,270 @@ var helpers_default = {
|
|
|
929
1038
|
getRemoteInfo
|
|
930
1039
|
}
|
|
931
1040
|
};
|
|
1041
|
+
function getAvailableExposeNames(remoteSnapshot) {
|
|
1042
|
+
if (!remoteSnapshot || !("modules" in remoteSnapshot) || !Array.isArray(remoteSnapshot.modules)) return;
|
|
1043
|
+
const exposes = remoteSnapshot.modules.map((module2) => module2.moduleName).filter(Boolean);
|
|
1044
|
+
return exposes.length ? exposes.join(",") : void 0;
|
|
1045
|
+
}
|
|
1046
|
+
function createRemoteEntryInitOptions(remoteInfo, hostShareScopeMap, rawInitScope) {
|
|
1047
|
+
const localShareScopeMap = hostShareScopeMap;
|
|
1048
|
+
const shareScopeKeys = Array.isArray(remoteInfo.shareScope) ? remoteInfo.shareScope : [remoteInfo.shareScope];
|
|
1049
|
+
if (!shareScopeKeys.length) shareScopeKeys.push("default");
|
|
1050
|
+
shareScopeKeys.forEach((shareScopeKey) => {
|
|
1051
|
+
if (!localShareScopeMap[shareScopeKey]) localShareScopeMap[shareScopeKey] = {};
|
|
1052
|
+
});
|
|
1053
|
+
const remoteEntryInitOptions = {
|
|
1054
|
+
version: remoteInfo.version || "",
|
|
1055
|
+
shareScopeKeys: Array.isArray(remoteInfo.shareScope) ? shareScopeKeys : remoteInfo.shareScope || "default"
|
|
1056
|
+
};
|
|
1057
|
+
Object.defineProperty(remoteEntryInitOptions, "shareScopeMap", {
|
|
1058
|
+
value: localShareScopeMap,
|
|
1059
|
+
enumerable: false
|
|
1060
|
+
});
|
|
1061
|
+
return {
|
|
1062
|
+
remoteEntryInitOptions,
|
|
1063
|
+
shareScope: localShareScopeMap[shareScopeKeys[0]],
|
|
1064
|
+
initScope: rawInitScope ?? []
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
var Module$1 = class {
|
|
1068
|
+
constructor({ remoteInfo, host }) {
|
|
1069
|
+
this.inited = false;
|
|
1070
|
+
this.initing = false;
|
|
1071
|
+
this.lib = void 0;
|
|
1072
|
+
this.remoteInfo = remoteInfo;
|
|
1073
|
+
this.host = host;
|
|
1074
|
+
}
|
|
1075
|
+
async getEntry(expose) {
|
|
1076
|
+
if (this.remoteEntryExports) return this.remoteEntryExports;
|
|
1077
|
+
const remoteEntryExports = await getRemoteEntry({
|
|
1078
|
+
origin: this.host,
|
|
1079
|
+
remoteInfo: this.remoteInfo,
|
|
1080
|
+
remoteEntryExports: this.remoteEntryExports,
|
|
1081
|
+
resourceContext: {
|
|
1082
|
+
initiator: "loadRemote",
|
|
1083
|
+
id: composeRemoteRequestId(this.remoteInfo.name, expose),
|
|
1084
|
+
resourceType: "remoteEntry"
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
assert(remoteEntryExports, `remoteEntryExports is undefined
|
|
1088
|
+
${lazyUtils.safeToString(this.remoteInfo)}`);
|
|
1089
|
+
this.remoteEntryExports = remoteEntryExports;
|
|
1090
|
+
return this.remoteEntryExports;
|
|
1091
|
+
}
|
|
1092
|
+
async init(id, remoteSnapshot, rawInitScope, expose) {
|
|
1093
|
+
const remoteEntryExports = await this.getEntry(expose);
|
|
1094
|
+
if (this.inited) {
|
|
1095
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1096
|
+
id,
|
|
1097
|
+
remoteInfo: this.remoteInfo,
|
|
1098
|
+
remoteSnapshot,
|
|
1099
|
+
remoteEntryExports,
|
|
1100
|
+
cached: true,
|
|
1101
|
+
origin: this.host
|
|
1102
|
+
});
|
|
1103
|
+
return remoteEntryExports;
|
|
1104
|
+
}
|
|
1105
|
+
if (this.initPromise) {
|
|
1106
|
+
try {
|
|
1107
|
+
await this.initPromise;
|
|
1108
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1109
|
+
id,
|
|
1110
|
+
remoteInfo: this.remoteInfo,
|
|
1111
|
+
remoteSnapshot,
|
|
1112
|
+
remoteEntryExports,
|
|
1113
|
+
cached: true,
|
|
1114
|
+
origin: this.host
|
|
1115
|
+
});
|
|
1116
|
+
} catch (initError) {
|
|
1117
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1118
|
+
id,
|
|
1119
|
+
remoteInfo: this.remoteInfo,
|
|
1120
|
+
remoteSnapshot,
|
|
1121
|
+
remoteEntryExports,
|
|
1122
|
+
error: initError,
|
|
1123
|
+
cached: true,
|
|
1124
|
+
origin: this.host
|
|
1125
|
+
});
|
|
1126
|
+
throw initError;
|
|
1127
|
+
}
|
|
1128
|
+
return remoteEntryExports;
|
|
1129
|
+
}
|
|
1130
|
+
this.initing = true;
|
|
1131
|
+
this.initPromise = (async () => {
|
|
1132
|
+
await this.host.loaderHook.lifecycle.beforeInitRemote.emit({
|
|
1133
|
+
id,
|
|
1134
|
+
remoteInfo: this.remoteInfo,
|
|
1135
|
+
remoteSnapshot,
|
|
1136
|
+
origin: this.host
|
|
1137
|
+
});
|
|
1138
|
+
const { remoteEntryInitOptions, shareScope, initScope } = createRemoteEntryInitOptions(this.remoteInfo, this.host.shareScopeMap, rawInitScope);
|
|
1139
|
+
const initContainerOptions = await this.host.hooks.lifecycle.beforeInitContainer.emit({
|
|
1140
|
+
shareScope,
|
|
1141
|
+
remoteEntryInitOptions,
|
|
1142
|
+
initScope,
|
|
1143
|
+
remoteInfo: this.remoteInfo,
|
|
1144
|
+
origin: this.host
|
|
1145
|
+
});
|
|
1146
|
+
if (typeof (remoteEntryExports == null ? void 0 : remoteEntryExports.init) === "undefined") error(RUNTIME_002, runtimeDescMap, {
|
|
1147
|
+
hostName: this.host.name,
|
|
1148
|
+
remoteName: this.remoteInfo.name,
|
|
1149
|
+
remoteEntryUrl: this.remoteInfo.entry,
|
|
1150
|
+
remoteEntryKey: this.remoteInfo.entryGlobalName
|
|
1151
|
+
}, void 0, optionsToMFContext(this.host.options));
|
|
1152
|
+
try {
|
|
1153
|
+
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
1154
|
+
} catch (initError) {
|
|
1155
|
+
error(RUNTIME_015, runtimeDescMap, {
|
|
1156
|
+
hostName: this.host.name,
|
|
1157
|
+
remoteName: this.remoteInfo.name,
|
|
1158
|
+
remoteEntryUrl: this.remoteInfo.entry,
|
|
1159
|
+
remoteEntryKey: this.remoteInfo.entryGlobalName,
|
|
1160
|
+
shareScope: this.remoteInfo.shareScope
|
|
1161
|
+
}, `${initError}`, optionsToMFContext(this.host.options));
|
|
1162
|
+
}
|
|
1163
|
+
await this.host.hooks.lifecycle.initContainer.emit({
|
|
1164
|
+
...initContainerOptions,
|
|
1165
|
+
id,
|
|
1166
|
+
remoteSnapshot,
|
|
1167
|
+
remoteEntryExports
|
|
1168
|
+
});
|
|
1169
|
+
this.inited = true;
|
|
1170
|
+
})();
|
|
1171
|
+
try {
|
|
1172
|
+
await this.initPromise;
|
|
1173
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1174
|
+
id,
|
|
1175
|
+
remoteInfo: this.remoteInfo,
|
|
1176
|
+
remoteSnapshot,
|
|
1177
|
+
remoteEntryExports,
|
|
1178
|
+
origin: this.host
|
|
1179
|
+
});
|
|
1180
|
+
} catch (initError) {
|
|
1181
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1182
|
+
id,
|
|
1183
|
+
remoteInfo: this.remoteInfo,
|
|
1184
|
+
remoteSnapshot,
|
|
1185
|
+
remoteEntryExports,
|
|
1186
|
+
error: initError,
|
|
1187
|
+
origin: this.host
|
|
1188
|
+
});
|
|
1189
|
+
throw initError;
|
|
1190
|
+
} finally {
|
|
1191
|
+
this.initing = false;
|
|
1192
|
+
this.initPromise = void 0;
|
|
1193
|
+
}
|
|
1194
|
+
return remoteEntryExports;
|
|
1195
|
+
}
|
|
1196
|
+
async get(id, expose, options, remoteSnapshot) {
|
|
1197
|
+
const { loadFactory = true } = options || { loadFactory: true };
|
|
1198
|
+
const remoteEntryExports = await this.init(id, remoteSnapshot, void 0, expose);
|
|
1199
|
+
this.lib = remoteEntryExports;
|
|
1200
|
+
await this.host.loaderHook.lifecycle.beforeGetExpose.emit({
|
|
1201
|
+
id,
|
|
1202
|
+
expose,
|
|
1203
|
+
moduleInfo: this.remoteInfo,
|
|
1204
|
+
remoteEntryExports,
|
|
1205
|
+
origin: this.host
|
|
1206
|
+
});
|
|
1207
|
+
let moduleFactory;
|
|
1208
|
+
try {
|
|
1209
|
+
const hookModuleFactory = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
1210
|
+
remoteEntryExports,
|
|
1211
|
+
expose,
|
|
1212
|
+
moduleInfo: this.remoteInfo
|
|
1213
|
+
});
|
|
1214
|
+
moduleFactory = typeof hookModuleFactory === "function" ? hookModuleFactory : void 0;
|
|
1215
|
+
if (!moduleFactory) moduleFactory = await remoteEntryExports.get(expose);
|
|
1216
|
+
if (!moduleFactory) error(RUNTIME_014, runtimeDescMap, {
|
|
1217
|
+
hostName: this.host.name,
|
|
1218
|
+
remoteName: this.remoteInfo.name,
|
|
1219
|
+
remoteEntryUrl: this.remoteInfo.entry,
|
|
1220
|
+
expose,
|
|
1221
|
+
requestId: id,
|
|
1222
|
+
availableExposes: getAvailableExposeNames(remoteSnapshot)
|
|
1223
|
+
}, void 0, optionsToMFContext(this.host.options));
|
|
1224
|
+
await this.host.loaderHook.lifecycle.afterGetExpose.emit({
|
|
1225
|
+
id,
|
|
1226
|
+
expose,
|
|
1227
|
+
moduleInfo: this.remoteInfo,
|
|
1228
|
+
remoteEntryExports,
|
|
1229
|
+
moduleFactory,
|
|
1230
|
+
origin: this.host
|
|
1231
|
+
});
|
|
1232
|
+
} catch (getExposeError) {
|
|
1233
|
+
await this.host.loaderHook.lifecycle.afterGetExpose.emit({
|
|
1234
|
+
id,
|
|
1235
|
+
expose,
|
|
1236
|
+
moduleInfo: this.remoteInfo,
|
|
1237
|
+
remoteEntryExports,
|
|
1238
|
+
error: getExposeError,
|
|
1239
|
+
origin: this.host
|
|
1240
|
+
});
|
|
1241
|
+
throw getExposeError;
|
|
1242
|
+
}
|
|
1243
|
+
const symbolName = processModuleAlias(this.remoteInfo.name, expose);
|
|
1244
|
+
const wrapModuleFactory = this.wraperFactory(moduleFactory, symbolName);
|
|
1245
|
+
if (!loadFactory) return wrapModuleFactory;
|
|
1246
|
+
await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({
|
|
1247
|
+
id,
|
|
1248
|
+
expose,
|
|
1249
|
+
moduleInfo: this.remoteInfo,
|
|
1250
|
+
loadFactory,
|
|
1251
|
+
origin: this.host
|
|
1252
|
+
});
|
|
1253
|
+
try {
|
|
1254
|
+
const exposeContent = await wrapModuleFactory();
|
|
1255
|
+
await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({
|
|
1256
|
+
id,
|
|
1257
|
+
expose,
|
|
1258
|
+
moduleInfo: this.remoteInfo,
|
|
1259
|
+
loadFactory,
|
|
1260
|
+
exposeModule: exposeContent,
|
|
1261
|
+
origin: this.host
|
|
1262
|
+
});
|
|
1263
|
+
return exposeContent;
|
|
1264
|
+
} catch (executeFactoryError) {
|
|
1265
|
+
await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({
|
|
1266
|
+
id,
|
|
1267
|
+
expose,
|
|
1268
|
+
moduleInfo: this.remoteInfo,
|
|
1269
|
+
loadFactory,
|
|
1270
|
+
error: executeFactoryError,
|
|
1271
|
+
origin: this.host
|
|
1272
|
+
});
|
|
1273
|
+
throw executeFactoryError;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
wraperFactory(moduleFactory, id) {
|
|
1277
|
+
function defineModuleId(res, id2) {
|
|
1278
|
+
if (res && typeof res === "object" && Object.isExtensible(res) && !Object.getOwnPropertyDescriptor(res, Symbol.for("mf_module_id"))) Object.defineProperty(res, Symbol.for("mf_module_id"), {
|
|
1279
|
+
value: id2,
|
|
1280
|
+
enumerable: false
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
return () => {
|
|
1284
|
+
const res = moduleFactory();
|
|
1285
|
+
if (res instanceof Promise) return res.then((asyncRes) => {
|
|
1286
|
+
defineModuleId(asyncRes, id);
|
|
1287
|
+
return asyncRes;
|
|
1288
|
+
});
|
|
1289
|
+
defineModuleId(res, id);
|
|
1290
|
+
return res;
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1294
|
+
const REMOTE_DISABLED_MESSAGE = "Remote loading is disabled by experiments.optimization.disableRemote.";
|
|
1295
|
+
var UnavailableRemoteModule = class {
|
|
1296
|
+
constructor() {
|
|
1297
|
+
throw new Error(REMOTE_DISABLED_MESSAGE);
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
932
1300
|
typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN === "boolean" ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : true;
|
|
1301
|
+
typeof FEDERATION_OPTIMIZE_NO_REMOTE === "boolean" ? !FEDERATION_OPTIMIZE_NO_REMOTE : true;
|
|
1302
|
+
typeof FEDERATION_OPTIMIZE_NO_SHARED === "boolean" ? !FEDERATION_OPTIMIZE_NO_SHARED : true;
|
|
933
1303
|
const helpers = helpers_default;
|
|
1304
|
+
typeof FEDERATION_OPTIMIZE_NO_REMOTE === "boolean" && FEDERATION_OPTIMIZE_NO_REMOTE ? UnavailableRemoteModule : Module$1;
|
|
934
1305
|
const utils = helpers.utils;
|
|
935
1306
|
const runtimeHelpers = {
|
|
936
1307
|
utils
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ModuleFederationRuntimePlugin, ModuleFederation } from '@module-federation/runtime';
|
|
2
|
+
export type FederationRuntimeType = {
|
|
3
|
+
instance: ModuleFederation | null;
|
|
4
|
+
};
|
|
5
|
+
export declare const federationRuntime: FederationRuntimeType;
|
|
6
|
+
declare function BridgeReactPlugin(): ModuleFederationRuntimePlugin;
|
|
7
|
+
export default BridgeReactPlugin;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProviderFnParams, DestroyParams, RenderParams } from '../../types';
|
|
2
|
+
export declare function createBaseBridgeComponent<T>({ createRoot, defaultRootOptions, ...bridgeInfo }: ProviderFnParams<T>): () => {
|
|
3
|
+
render(info: RenderParams): Promise<void>;
|
|
4
|
+
destroy(info: DestroyParams): void;
|
|
5
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for React 16/17 (legacy) specific bridge components
|
|
3
|
+
* This file provides support for React 16 and 17 versions, using the traditional ReactDOM.render API
|
|
4
|
+
*/
|
|
5
|
+
import type { ProviderFnParams } from '../../types';
|
|
6
|
+
export interface CreateRootOptions {
|
|
7
|
+
identifierPrefix?: string;
|
|
8
|
+
onRecoverableError?: (error: unknown, errorInfo: unknown) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface Root {
|
|
11
|
+
render(children: React.ReactNode): void;
|
|
12
|
+
unmount(): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Default createRoot function that automatically detects React version and uses the appropriate API(only support React 16/17, 18)
|
|
16
|
+
*
|
|
17
|
+
* Note: Users can also directly import version-specific bridge components:
|
|
18
|
+
* - import { createBridgeComponent } from '@module-federation/bridge-react'
|
|
19
|
+
* - import { createBridgeComponent } from '@module-federation/bridge-react/v18'
|
|
20
|
+
* - import { createBridgeComponent } from '@module-federation/bridge-react/v19'
|
|
21
|
+
*/
|
|
22
|
+
export declare function createReact16Or17Root(container: Element | DocumentFragment): Root;
|
|
23
|
+
export declare function createBridgeComponent<T = any>(bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>): () => {
|
|
24
|
+
render(info: import("../..").RenderParams): Promise<void>;
|
|
25
|
+
destroy(info: import("../..").DestroyParams): void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for React 18 specific bridge components
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { ProviderFnParams } from '../../types';
|
|
6
|
+
export interface CreateRootOptions {
|
|
7
|
+
identifierPrefix?: string;
|
|
8
|
+
onRecoverableError?: (error: unknown, errorInfo: unknown) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface Root {
|
|
11
|
+
render(children: React.ReactNode): void;
|
|
12
|
+
unmount(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare function createReact18Root(container: Element | DocumentFragment, options?: CreateRootOptions): Root;
|
|
15
|
+
export declare function hydrateReact18Root(container: Element | DocumentFragment, initialChildren: React.ReactNode, options?: CreateRootOptions): import("node_modules/@types/react-dom/client").Root;
|
|
16
|
+
export declare function createBridgeComponent<T = any>(bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>): () => {
|
|
17
|
+
render(info: import("../..").RenderParams): Promise<void>;
|
|
18
|
+
destroy(info: import("../..").DestroyParams): void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for React 19 specific bridge components
|
|
3
|
+
* This file provides support for React 19 version, using the new ReactDOM.createRoot API
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { ProviderFnParams } from '../../types';
|
|
7
|
+
export interface CreateRootOptions {
|
|
8
|
+
identifierPrefix?: string;
|
|
9
|
+
onRecoverableError?: (error: unknown, errorInfo: unknown) => void;
|
|
10
|
+
transitionCallbacks?: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface Root {
|
|
13
|
+
render(children: React.ReactNode): void;
|
|
14
|
+
unmount(): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function createReact19Root(container: Element | DocumentFragment, options?: CreateRootOptions): Root;
|
|
17
|
+
export declare function hydrateReact19Root(container: Element | DocumentFragment, initialChildren: React.ReactNode, options?: CreateRootOptions): Root;
|
|
18
|
+
export declare function createBridgeComponent<T = any>(bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>): () => {
|
|
19
|
+
render(info: import("../..").RenderParams): Promise<void>;
|
|
20
|
+
destroy(info: import("../..").DestroyParams): void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared RemoteAppWrapper component used by both base and router versions
|
|
3
|
+
* This component handles the lifecycle of remote Module Federation apps
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { RemoteComponentProps, RemoteAppParams } from '../types';
|
|
7
|
+
export declare const RemoteAppWrapper: React.ForwardRefExoticComponent<Omit<RemoteAppParams & RemoteComponentProps<Record<string, unknown>>, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type LazyRemoteComponentInfo } from '../createHelpers';
|
|
2
|
+
export type { LazyRemoteComponentInfo };
|
|
3
|
+
declare const createLazyRemoteComponent: <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => import("node_modules/@types/react").LazyExoticComponent<import("node_modules/@types/react").ForwardRefExoticComponent<Omit<import("../..").RemoteComponentProps<Record<string, unknown>>, "ref"> & import("node_modules/@types/react").RefAttributes<HTMLDivElement>>>;
|
|
4
|
+
export declare const createRemoteAppComponent: <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => import("node_modules/@types/react").ForwardRefExoticComponent<Omit<import("../..").RemoteComponentProps<Record<string, unknown>>, "ref"> & import("node_modules/@types/react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated createRemoteComponent is deprecated, please use createRemoteAppComponent instead!
|
|
7
|
+
*/
|
|
8
|
+
export declare const createRemoteComponent: <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => any;
|
|
9
|
+
export { createLazyRemoteComponent };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RemoteComponentParams, RemoteComponentProps } from '../types';
|
|
3
|
+
export type LazyRemoteComponentInfo<T, _E extends keyof T> = RemoteComponentParams<T>;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a factory function for creating lazy remote components
|
|
6
|
+
* @param RemoteApp The RemoteAppWrapper component to use (with or without router)
|
|
7
|
+
*/
|
|
8
|
+
export declare function createLazyRemoteComponentFactory(RemoteApp: React.ComponentType<any>): <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => React.LazyExoticComponent<React.ForwardRefExoticComponent<Omit<RemoteComponentProps<Record<string, unknown>>, "ref"> & React.RefAttributes<HTMLDivElement>>>;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a factory function for creating remote app components
|
|
11
|
+
* @param RemoteApp The RemoteAppWrapper component to use (with or without router)
|
|
12
|
+
*/
|
|
13
|
+
export declare function createRemoteAppComponentFactory(RemoteApp: React.ComponentType<any>): <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => React.ForwardRefExoticComponent<Omit<RemoteComponentProps<Record<string, unknown>>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates the deprecated createRemoteComponent function
|
|
16
|
+
*/
|
|
17
|
+
export declare function createDeprecatedRemoteComponentFactory<T = Record<string, unknown>, E extends keyof T = keyof T>(createFn: (info: LazyRemoteComponentInfo<T, E>) => any): (info: LazyRemoteComponentInfo<T, E>) => any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RemoteAppWrapper } from '../RemoteAppWrapper';
|
|
3
|
+
interface ExtraDataProps {
|
|
4
|
+
basename?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function withRouterData<P extends Parameters<typeof RemoteAppWrapper>[0]>(WrappedComponent: React.ComponentType<P & ExtraDataProps>): React.FC<Omit<P, keyof ExtraDataProps>>;
|
|
7
|
+
declare const _default: React.FC<Omit<Omit<import("../../types").RemoteAppParams & import("../..").RemoteComponentProps<Record<string, unknown>>, "ref"> & React.RefAttributes<unknown>, "basename">>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type LazyRemoteComponentInfo } from '../createHelpers';
|
|
2
|
+
export type { LazyRemoteComponentInfo };
|
|
3
|
+
declare const createLazyRemoteComponent: <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => import("node_modules/@types/react").LazyExoticComponent<import("node_modules/@types/react").ForwardRefExoticComponent<Omit<import("../..").RemoteComponentProps<Record<string, unknown>>, "ref"> & import("node_modules/@types/react").RefAttributes<HTMLDivElement>>>;
|
|
4
|
+
export declare const createRemoteAppComponent: <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => import("node_modules/@types/react").ForwardRefExoticComponent<Omit<import("../..").RemoteComponentProps<Record<string, unknown>>, "ref"> & import("node_modules/@types/react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated createRemoteComponent is deprecated, please use createRemoteAppComponent instead!
|
|
7
|
+
*/
|
|
8
|
+
export declare const createRemoteComponent: <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => any;
|
|
9
|
+
export { createLazyRemoteComponent };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as ReactRouterDom from 'react-router-dom/';
|
|
3
|
+
declare function WrapperRouter(props: Parameters<typeof ReactRouterDom.BrowserRouter>[0] | Parameters<typeof ReactRouterDom.MemoryRouter>[0]): React.JSX.Element;
|
|
4
|
+
declare function WrapperRouterProvider(props: Parameters<typeof ReactRouterDom.RouterProvider>[0]): React.JSX.Element;
|
|
5
|
+
export * from 'react-router-dom/';
|
|
6
|
+
export { WrapperRouter as BrowserRouter };
|
|
7
|
+
export { WrapperRouterProvider as RouterProvider };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as ReactRouterDom from 'react-router-dom/dist/index.js';
|
|
3
|
+
declare function WraperRouter(props: Parameters<typeof ReactRouterDom.BrowserRouter>[0] | Parameters<typeof ReactRouterDom.MemoryRouter>[0]): React.JSX.Element;
|
|
4
|
+
declare function WraperRouterProvider(props: Parameters<typeof ReactRouterDom.RouterProvider>[0]): React.JSX.Element;
|
|
5
|
+
export * from 'react-router-dom/';
|
|
6
|
+
export { WraperRouter as BrowserRouter };
|
|
7
|
+
export { WraperRouterProvider as RouterProvider };
|