@module-federation/bridge-react 0.0.0-next-20240918063302 → 0.0.0-next-20240918073359

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/index.cjs.js CHANGED
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
- var _a;
3
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
3
  const React = require("react");
5
4
  const context = require("./context--mtFt3tp.cjs");
6
5
  const ReactRouterDOM = require("react-router-dom");
7
- const runtime = require("@module-federation/runtime");
8
6
  const ReactDOM = require("react-dom");
9
7
  function _interopNamespaceDefault(e) {
10
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -35,17 +33,17 @@ class ErrorBoundary extends React.Component {
35
33
  this.resetErrorBoundary = this.resetErrorBoundary.bind(this);
36
34
  this.state = initialState;
37
35
  }
38
- static getDerivedStateFromError(error2) {
36
+ static getDerivedStateFromError(error) {
39
37
  return {
40
38
  didCatch: true,
41
- error: error2
39
+ error
42
40
  };
43
41
  }
44
42
  resetErrorBoundary() {
45
43
  const {
46
- error: error2
44
+ error
47
45
  } = this.state;
48
- if (error2 !== null) {
46
+ if (error !== null) {
49
47
  var _this$props$onReset, _this$props;
50
48
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
51
49
  args[_key] = arguments[_key];
@@ -57,9 +55,9 @@ class ErrorBoundary extends React.Component {
57
55
  this.setState(initialState);
58
56
  }
59
57
  }
60
- componentDidCatch(error2, info) {
58
+ componentDidCatch(error, info) {
61
59
  var _this$props$onError, _this$props2;
62
- (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error2, info);
60
+ (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);
63
61
  }
64
62
  componentDidUpdate(prevProps, prevState) {
65
63
  const {
@@ -87,12 +85,12 @@ class ErrorBoundary extends React.Component {
87
85
  } = this.props;
88
86
  const {
89
87
  didCatch,
90
- error: error2
88
+ error
91
89
  } = this.state;
92
90
  let childToRender = children;
93
91
  if (didCatch) {
94
92
  const props = {
95
- error: error2,
93
+ error,
96
94
  resetErrorBoundary: this.resetErrorBoundary
97
95
  };
98
96
  if (typeof fallbackRender === "function") {
@@ -102,13 +100,13 @@ class ErrorBoundary extends React.Component {
102
100
  } else if (fallback === null || React.isValidElement(fallback)) {
103
101
  childToRender = fallback;
104
102
  } else {
105
- throw error2;
103
+ throw error;
106
104
  }
107
105
  }
108
106
  return React.createElement(ErrorBoundaryContext.Provider, {
109
107
  value: {
110
108
  didCatch,
111
- error: error2,
109
+ error,
112
110
  resetErrorBoundary: this.resetErrorBoundary
113
111
  }
114
112
  }, childToRender);
@@ -119,1007 +117,6 @@ function hasArrayChanged() {
119
117
  let b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
120
118
  return a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));
121
119
  }
122
- const BROWSER_LOG_KEY = "FEDERATION_DEBUG";
123
- const BROWSER_LOG_VALUE = "1";
124
- function isBrowserEnv() {
125
- return typeof window !== "undefined";
126
- }
127
- function isDebugMode() {
128
- if (typeof process !== "undefined" && process.env && process.env["FEDERATION_DEBUG"]) {
129
- return Boolean(process.env["FEDERATION_DEBUG"]);
130
- }
131
- return typeof FEDERATION_DEBUG !== "undefined" && Boolean(FEDERATION_DEBUG);
132
- }
133
- const DEBUG_LOG = "[ FEDERATION DEBUG ]";
134
- function safeGetLocalStorageItem() {
135
- try {
136
- if (typeof window !== "undefined" && window.localStorage) {
137
- return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
138
- }
139
- } catch (error2) {
140
- return typeof document !== "undefined";
141
- }
142
- return false;
143
- }
144
- let Logger = class Logger2 {
145
- info(msg, info) {
146
- if (this.enable) {
147
- const argsToString = safeToString(info) || "";
148
- if (isBrowserEnv()) {
149
- console.info(`%c ${this.identifier}: ${msg} ${argsToString}`, "color:#3300CC");
150
- } else {
151
- console.info("\x1B[34m%s", `${this.identifier}: ${msg} ${argsToString ? `
152
- ${argsToString}` : ""}`);
153
- }
154
- }
155
- }
156
- logOriginalInfo(...args) {
157
- if (this.enable) {
158
- if (isBrowserEnv()) {
159
- console.info(`%c ${this.identifier}: OriginalInfo`, "color:#3300CC");
160
- console.log(...args);
161
- } else {
162
- console.info(`%c ${this.identifier}: OriginalInfo`, "color:#3300CC");
163
- console.log(...args);
164
- }
165
- }
166
- }
167
- constructor(identifier) {
168
- this.enable = false;
169
- this.identifier = identifier || DEBUG_LOG;
170
- if (isBrowserEnv() && safeGetLocalStorageItem()) {
171
- this.enable = true;
172
- } else if (isDebugMode()) {
173
- this.enable = true;
174
- }
175
- }
176
- };
177
- new Logger();
178
- function safeToString(info) {
179
- try {
180
- return JSON.stringify(info, null, 2);
181
- } catch (e) {
182
- return "";
183
- }
184
- }
185
- function _extends() {
186
- _extends = Object.assign || function assign(target) {
187
- for (var i = 1; i < arguments.length; i++) {
188
- var source = arguments[i];
189
- for (var key in source)
190
- if (Object.prototype.hasOwnProperty.call(source, key))
191
- target[key] = source[key];
192
- }
193
- return target;
194
- };
195
- return _extends.apply(this, arguments);
196
- }
197
- function _object_without_properties_loose(source, excluded) {
198
- if (source == null)
199
- return {};
200
- var target = {};
201
- var sourceKeys = Object.keys(source);
202
- var key, i;
203
- for (i = 0; i < sourceKeys.length; i++) {
204
- key = sourceKeys[i];
205
- if (excluded.indexOf(key) >= 0)
206
- continue;
207
- target[key] = source[key];
208
- }
209
- return target;
210
- }
211
- function getBuilderId() {
212
- return typeof FEDERATION_BUILD_IDENTIFIER !== "undefined" ? FEDERATION_BUILD_IDENTIFIER : "";
213
- }
214
- const LOG_CATEGORY = "[ Federation Runtime ]";
215
- function assert(condition, msg) {
216
- if (!condition) {
217
- error(msg);
218
- }
219
- }
220
- function error(msg) {
221
- if (msg instanceof Error) {
222
- msg.message = `${LOG_CATEGORY}: ${msg.message}`;
223
- throw msg;
224
- }
225
- throw new Error(`${LOG_CATEGORY}: ${msg}`);
226
- }
227
- function warn(msg) {
228
- if (msg instanceof Error) {
229
- msg.message = `${LOG_CATEGORY}: ${msg.message}`;
230
- console.warn(msg);
231
- } else {
232
- console.warn(`${LOG_CATEGORY}: ${msg}`);
233
- }
234
- }
235
- function getFMId(remoteInfo) {
236
- if ("version" in remoteInfo && remoteInfo.version) {
237
- return `${remoteInfo.name}:${remoteInfo.version}`;
238
- } else if ("entry" in remoteInfo && remoteInfo.entry) {
239
- return `${remoteInfo.name}:${remoteInfo.entry}`;
240
- } else {
241
- return `${remoteInfo.name}`;
242
- }
243
- }
244
- function isObject(val) {
245
- return val && typeof val === "object";
246
- }
247
- const objectToString = Object.prototype.toString;
248
- function isPlainObject(val) {
249
- return objectToString.call(val) === "[object Object]";
250
- }
251
- const nativeGlobal = (() => {
252
- try {
253
- return new Function("return this")();
254
- } catch (e) {
255
- return globalThis;
256
- }
257
- })();
258
- const Global = nativeGlobal;
259
- function definePropertyGlobalVal(target, key, val) {
260
- Object.defineProperty(target, key, {
261
- value: val,
262
- configurable: false,
263
- writable: true
264
- });
265
- }
266
- function includeOwnProperty(target, key) {
267
- return Object.hasOwnProperty.call(target, key);
268
- }
269
- if (!includeOwnProperty(globalThis, "__GLOBAL_LOADING_REMOTE_ENTRY__")) {
270
- definePropertyGlobalVal(globalThis, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
271
- }
272
- function setGlobalDefaultVal(target) {
273
- var _target___FEDERATION__, _target___FEDERATION__1, _target___FEDERATION__2, _target___FEDERATION__3, _target___FEDERATION__4, _target___FEDERATION__5;
274
- if (includeOwnProperty(target, "__VMOK__") && !includeOwnProperty(target, "__FEDERATION__")) {
275
- definePropertyGlobalVal(target, "__FEDERATION__", target.__VMOK__);
276
- }
277
- if (!includeOwnProperty(target, "__FEDERATION__")) {
278
- definePropertyGlobalVal(target, "__FEDERATION__", {
279
- __GLOBAL_PLUGIN__: [],
280
- __INSTANCES__: [],
281
- moduleInfo: {},
282
- __SHARE__: {},
283
- __MANIFEST_LOADING__: {},
284
- __PRELOADED_MAP__: /* @__PURE__ */ new Map()
285
- });
286
- definePropertyGlobalVal(target, "__VMOK__", target.__FEDERATION__);
287
- }
288
- var ___GLOBAL_PLUGIN__;
289
- (___GLOBAL_PLUGIN__ = (_target___FEDERATION__ = target.__FEDERATION__).__GLOBAL_PLUGIN__) != null ? ___GLOBAL_PLUGIN__ : _target___FEDERATION__.__GLOBAL_PLUGIN__ = [];
290
- var ___INSTANCES__;
291
- (___INSTANCES__ = (_target___FEDERATION__1 = target.__FEDERATION__).__INSTANCES__) != null ? ___INSTANCES__ : _target___FEDERATION__1.__INSTANCES__ = [];
292
- var _moduleInfo;
293
- (_moduleInfo = (_target___FEDERATION__2 = target.__FEDERATION__).moduleInfo) != null ? _moduleInfo : _target___FEDERATION__2.moduleInfo = {};
294
- var ___SHARE__;
295
- (___SHARE__ = (_target___FEDERATION__3 = target.__FEDERATION__).__SHARE__) != null ? ___SHARE__ : _target___FEDERATION__3.__SHARE__ = {};
296
- var ___MANIFEST_LOADING__;
297
- (___MANIFEST_LOADING__ = (_target___FEDERATION__4 = target.__FEDERATION__).__MANIFEST_LOADING__) != null ? ___MANIFEST_LOADING__ : _target___FEDERATION__4.__MANIFEST_LOADING__ = {};
298
- var ___PRELOADED_MAP__;
299
- (___PRELOADED_MAP__ = (_target___FEDERATION__5 = target.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _target___FEDERATION__5.__PRELOADED_MAP__ = /* @__PURE__ */ new Map();
300
- }
301
- setGlobalDefaultVal(globalThis);
302
- setGlobalDefaultVal(nativeGlobal);
303
- function resetFederationGlobalInfo() {
304
- globalThis.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
305
- globalThis.__FEDERATION__.__INSTANCES__ = [];
306
- globalThis.__FEDERATION__.moduleInfo = {};
307
- globalThis.__FEDERATION__.__SHARE__ = {};
308
- globalThis.__FEDERATION__.__MANIFEST_LOADING__ = {};
309
- }
310
- function getGlobalFederationInstance(name, version) {
311
- const buildId = getBuilderId();
312
- return globalThis.__FEDERATION__.__INSTANCES__.find((GMInstance) => {
313
- if (buildId && GMInstance.options.id === getBuilderId()) {
314
- return true;
315
- }
316
- if (GMInstance.options.name === name && !GMInstance.options.version && !version) {
317
- return true;
318
- }
319
- if (GMInstance.options.name === name && version && GMInstance.options.version === version) {
320
- return true;
321
- }
322
- return false;
323
- });
324
- }
325
- function setGlobalFederationInstance(FederationInstance) {
326
- globalThis.__FEDERATION__.__INSTANCES__.push(FederationInstance);
327
- }
328
- function getGlobalFederationConstructor() {
329
- return globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__;
330
- }
331
- function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
332
- if (isDebug) {
333
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
334
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.4";
335
- }
336
- }
337
- function getInfoWithoutType(target, key) {
338
- if (typeof key === "string") {
339
- const keyRes = target[key];
340
- if (keyRes) {
341
- return {
342
- value: target[key],
343
- key
344
- };
345
- } else {
346
- const targetKeys = Object.keys(target);
347
- for (const targetKey of targetKeys) {
348
- const [targetTypeOrName, _] = targetKey.split(":");
349
- const nKey = `${targetTypeOrName}:${key}`;
350
- const typeWithKeyRes = target[nKey];
351
- if (typeWithKeyRes) {
352
- return {
353
- value: typeWithKeyRes,
354
- key: nKey
355
- };
356
- }
357
- }
358
- return {
359
- value: void 0,
360
- key
361
- };
362
- }
363
- } else {
364
- throw new Error("key must be string");
365
- }
366
- }
367
- const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo;
368
- const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot) => {
369
- const moduleKey = getFMId(moduleInfo);
370
- const getModuleInfo = getInfoWithoutType(snapshot, moduleKey).value;
371
- if (getModuleInfo && !getModuleInfo.version && "version" in moduleInfo && moduleInfo["version"]) {
372
- getModuleInfo.version = moduleInfo["version"];
373
- }
374
- if (getModuleInfo) {
375
- return getModuleInfo;
376
- }
377
- if ("version" in moduleInfo && moduleInfo["version"]) {
378
- const { version } = moduleInfo, resModuleInfo = _object_without_properties_loose(moduleInfo, [
379
- "version"
380
- ]);
381
- const moduleKeyWithoutVersion = getFMId(resModuleInfo);
382
- const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion).value;
383
- if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) {
384
- return getModuleInfoWithoutVersion;
385
- }
386
- }
387
- return;
388
- };
389
- const getGlobalSnapshotInfoByModuleInfo = (moduleInfo) => getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo);
390
- const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo) => {
391
- const moduleKey = getFMId(remoteInfo);
392
- nativeGlobal.__FEDERATION__.moduleInfo[moduleKey] = moduleDetailInfo;
393
- return nativeGlobal.__FEDERATION__.moduleInfo;
394
- };
395
- const addGlobalSnapshot = (moduleInfos) => {
396
- nativeGlobal.__FEDERATION__.moduleInfo = _extends({}, nativeGlobal.__FEDERATION__.moduleInfo, moduleInfos);
397
- return () => {
398
- const keys = Object.keys(moduleInfos);
399
- for (const key of keys) {
400
- delete nativeGlobal.__FEDERATION__.moduleInfo[key];
401
- }
402
- };
403
- };
404
- const getRemoteEntryExports = (name, globalName) => {
405
- const remoteEntryKey = globalName || `__FEDERATION_${name}:custom__`;
406
- const entryExports = globalThis[remoteEntryKey];
407
- return {
408
- remoteEntryKey,
409
- entryExports
410
- };
411
- };
412
- const registerGlobalPlugins = (plugins) => {
413
- const { __GLOBAL_PLUGIN__ } = nativeGlobal.__FEDERATION__;
414
- plugins.forEach((plugin) => {
415
- if (__GLOBAL_PLUGIN__.findIndex((p) => p.name === plugin.name) === -1) {
416
- __GLOBAL_PLUGIN__.push(plugin);
417
- } else {
418
- warn(`The plugin ${plugin.name} has been registered.`);
419
- }
420
- });
421
- };
422
- const getGlobalHostPlugins = () => nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__;
423
- const getPreloaded = (id) => globalThis.__FEDERATION__.__PRELOADED_MAP__.get(id);
424
- const setPreloaded = (id) => globalThis.__FEDERATION__.__PRELOADED_MAP__.set(id, true);
425
- function registerPlugins(plugins, hookInstances) {
426
- const globalPlugins = getGlobalHostPlugins();
427
- if (globalPlugins.length > 0) {
428
- globalPlugins.forEach((plugin) => {
429
- if (plugins == null ? void 0 : plugins.find((item) => item.name !== plugin.name)) {
430
- plugins.push(plugin);
431
- }
432
- });
433
- }
434
- if (plugins && plugins.length > 0) {
435
- plugins.forEach((plugin) => {
436
- hookInstances.forEach((hookInstance) => {
437
- hookInstance.applyPlugin(plugin);
438
- });
439
- });
440
- }
441
- return plugins;
442
- }
443
- const DEFAULT_SCOPE = "default";
444
- class SyncHook {
445
- on(fn) {
446
- if (typeof fn === "function") {
447
- this.listeners.add(fn);
448
- }
449
- }
450
- once(fn) {
451
- const self = this;
452
- this.on(function wrapper(...args) {
453
- self.remove(wrapper);
454
- return fn.apply(null, args);
455
- });
456
- }
457
- emit(...data) {
458
- let result;
459
- if (this.listeners.size > 0) {
460
- this.listeners.forEach((fn) => {
461
- result = fn(...data);
462
- });
463
- }
464
- return result;
465
- }
466
- remove(fn) {
467
- this.listeners.delete(fn);
468
- }
469
- removeAll() {
470
- this.listeners.clear();
471
- }
472
- constructor(type) {
473
- this.type = "";
474
- this.listeners = /* @__PURE__ */ new Set();
475
- if (type) {
476
- this.type = type;
477
- }
478
- }
479
- }
480
- class AsyncHook extends SyncHook {
481
- emit(...data) {
482
- let result;
483
- const ls = Array.from(this.listeners);
484
- if (ls.length > 0) {
485
- let i = 0;
486
- const call = (prev) => {
487
- if (prev === false) {
488
- return false;
489
- } else if (i < ls.length) {
490
- return Promise.resolve(ls[i++].apply(null, data)).then(call);
491
- } else {
492
- return prev;
493
- }
494
- };
495
- result = call();
496
- }
497
- return Promise.resolve(result);
498
- }
499
- }
500
- function checkReturnData(originalData, returnedData) {
501
- if (!isObject(returnedData)) {
502
- return false;
503
- }
504
- if (originalData !== returnedData) {
505
- for (const key in originalData) {
506
- if (!(key in returnedData)) {
507
- return false;
508
- }
509
- }
510
- }
511
- return true;
512
- }
513
- class SyncWaterfallHook extends SyncHook {
514
- emit(data) {
515
- if (!isObject(data)) {
516
- error(`The data for the "${this.type}" hook should be an object.`);
517
- }
518
- for (const fn of this.listeners) {
519
- try {
520
- const tempData = fn(data);
521
- if (checkReturnData(data, tempData)) {
522
- data = tempData;
523
- } else {
524
- this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
525
- break;
526
- }
527
- } catch (e) {
528
- warn(e);
529
- this.onerror(e);
530
- }
531
- }
532
- return data;
533
- }
534
- constructor(type) {
535
- super();
536
- this.onerror = error;
537
- this.type = type;
538
- }
539
- }
540
- class AsyncWaterfallHook extends SyncHook {
541
- emit(data) {
542
- if (!isObject(data)) {
543
- error(`The response data for the "${this.type}" hook must be an object.`);
544
- }
545
- const ls = Array.from(this.listeners);
546
- if (ls.length > 0) {
547
- let i = 0;
548
- const processError = (e) => {
549
- warn(e);
550
- this.onerror(e);
551
- return data;
552
- };
553
- const call = (prevData) => {
554
- if (checkReturnData(data, prevData)) {
555
- data = prevData;
556
- if (i < ls.length) {
557
- try {
558
- return Promise.resolve(ls[i++](data)).then(call, processError);
559
- } catch (e) {
560
- return processError(e);
561
- }
562
- }
563
- } else {
564
- this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
565
- }
566
- return data;
567
- };
568
- return Promise.resolve(call(data));
569
- }
570
- return Promise.resolve(data);
571
- }
572
- constructor(type) {
573
- super();
574
- this.onerror = error;
575
- this.type = type;
576
- }
577
- }
578
- class PluginSystem {
579
- applyPlugin(plugin) {
580
- assert(isPlainObject(plugin), "Plugin configuration is invalid.");
581
- const pluginName = plugin.name;
582
- assert(pluginName, "A name must be provided by the plugin.");
583
- if (!this.registerPlugins[pluginName]) {
584
- this.registerPlugins[pluginName] = plugin;
585
- Object.keys(this.lifecycle).forEach((key) => {
586
- const pluginLife = plugin[key];
587
- if (pluginLife) {
588
- this.lifecycle[key].on(pluginLife);
589
- }
590
- });
591
- }
592
- }
593
- removePlugin(pluginName) {
594
- assert(pluginName, "A name is required.");
595
- const plugin = this.registerPlugins[pluginName];
596
- assert(plugin, `The plugin "${pluginName}" is not registered.`);
597
- Object.keys(plugin).forEach((key) => {
598
- if (key !== "name") {
599
- this.lifecycle[key].remove(plugin[key]);
600
- }
601
- });
602
- }
603
- // eslint-disable-next-line @typescript-eslint/no-shadow
604
- inherit({ lifecycle, registerPlugins: registerPlugins2 }) {
605
- Object.keys(lifecycle).forEach((hookName) => {
606
- assert(!this.lifecycle[hookName], `The hook "${hookName}" has a conflict and cannot be inherited.`);
607
- this.lifecycle[hookName] = lifecycle[hookName];
608
- });
609
- Object.keys(registerPlugins2).forEach((pluginName) => {
610
- assert(!this.registerPlugins[pluginName], `The plugin "${pluginName}" has a conflict and cannot be inherited.`);
611
- this.applyPlugin(registerPlugins2[pluginName]);
612
- });
613
- }
614
- constructor(lifecycle) {
615
- this.registerPlugins = {};
616
- this.lifecycle = lifecycle;
617
- this.lifecycleKeys = Object.keys(lifecycle);
618
- }
619
- }
620
- const buildIdentifier = "[0-9A-Za-z-]+";
621
- const build = `(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`;
622
- const numericIdentifier = "0|[1-9]\\d*";
623
- const numericIdentifierLoose = "[0-9]+";
624
- const nonNumericIdentifier = "\\d*[a-zA-Z-][a-zA-Z0-9-]*";
625
- const preReleaseIdentifierLoose = `(?:${numericIdentifierLoose}|${nonNumericIdentifier})`;
626
- const preReleaseLoose = `(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`;
627
- const preReleaseIdentifier = `(?:${numericIdentifier}|${nonNumericIdentifier})`;
628
- const preRelease = `(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`;
629
- const xRangeIdentifier = `${numericIdentifier}|x|X|\\*`;
630
- const xRangePlain = `[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`;
631
- const hyphenRange = `^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`;
632
- const mainVersionLoose = `(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`;
633
- const loosePlain = `[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`;
634
- const gtlt = "((?:<|>)?=?)";
635
- const comparatorTrim = `(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`;
636
- const loneTilde = "(?:~>?)";
637
- const tildeTrim = `(\\s*)${loneTilde}\\s+`;
638
- const loneCaret = "(?:\\^)";
639
- const caretTrim = `(\\s*)${loneCaret}\\s+`;
640
- const star = "(<|>)?=?\\s*\\*";
641
- const caret = `^${loneCaret}${xRangePlain}$`;
642
- const mainVersion = `(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`;
643
- const fullPlain = `v?${mainVersion}${preRelease}?${build}?`;
644
- const tilde = `^${loneTilde}${xRangePlain}$`;
645
- const xRange = `^${gtlt}\\s*${xRangePlain}$`;
646
- const comparator = `^${gtlt}\\s*(${fullPlain})$|^$`;
647
- const gte0 = "^\\s*>=\\s*0.0.0\\s*$";
648
- function parseRegex(source) {
649
- return new RegExp(source);
650
- }
651
- function isXVersion(version) {
652
- return !version || version.toLowerCase() === "x" || version === "*";
653
- }
654
- function pipe(...fns) {
655
- return (x) => fns.reduce((v, f) => f(v), x);
656
- }
657
- function extractComparator(comparatorString) {
658
- return comparatorString.match(parseRegex(comparator));
659
- }
660
- function combineVersion(major, minor, patch, preRelease2) {
661
- const mainVersion2 = `${major}.${minor}.${patch}`;
662
- if (preRelease2) {
663
- return `${mainVersion2}-${preRelease2}`;
664
- }
665
- return mainVersion2;
666
- }
667
- function parseHyphen(range) {
668
- return range.replace(parseRegex(hyphenRange), (_range, from, fromMajor, fromMinor, fromPatch, _fromPreRelease, _fromBuild, to, toMajor, toMinor, toPatch, toPreRelease) => {
669
- if (isXVersion(fromMajor)) {
670
- from = "";
671
- } else if (isXVersion(fromMinor)) {
672
- from = `>=${fromMajor}.0.0`;
673
- } else if (isXVersion(fromPatch)) {
674
- from = `>=${fromMajor}.${fromMinor}.0`;
675
- } else {
676
- from = `>=${from}`;
677
- }
678
- if (isXVersion(toMajor)) {
679
- to = "";
680
- } else if (isXVersion(toMinor)) {
681
- to = `<${Number(toMajor) + 1}.0.0-0`;
682
- } else if (isXVersion(toPatch)) {
683
- to = `<${toMajor}.${Number(toMinor) + 1}.0-0`;
684
- } else if (toPreRelease) {
685
- to = `<=${toMajor}.${toMinor}.${toPatch}-${toPreRelease}`;
686
- } else {
687
- to = `<=${to}`;
688
- }
689
- return `${from} ${to}`.trim();
690
- });
691
- }
692
- function parseComparatorTrim(range) {
693
- return range.replace(parseRegex(comparatorTrim), "$1$2$3");
694
- }
695
- function parseTildeTrim(range) {
696
- return range.replace(parseRegex(tildeTrim), "$1~");
697
- }
698
- function parseCaretTrim(range) {
699
- return range.replace(parseRegex(caretTrim), "$1^");
700
- }
701
- function parseCarets(range) {
702
- return range.trim().split(/\s+/).map((rangeVersion) => rangeVersion.replace(parseRegex(caret), (_, major, minor, patch, preRelease2) => {
703
- if (isXVersion(major)) {
704
- return "";
705
- } else if (isXVersion(minor)) {
706
- return `>=${major}.0.0 <${Number(major) + 1}.0.0-0`;
707
- } else if (isXVersion(patch)) {
708
- if (major === "0") {
709
- return `>=${major}.${minor}.0 <${major}.${Number(minor) + 1}.0-0`;
710
- } else {
711
- return `>=${major}.${minor}.0 <${Number(major) + 1}.0.0-0`;
712
- }
713
- } else if (preRelease2) {
714
- if (major === "0") {
715
- if (minor === "0") {
716
- return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${minor}.${Number(patch) + 1}-0`;
717
- } else {
718
- return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${Number(minor) + 1}.0-0`;
719
- }
720
- } else {
721
- return `>=${major}.${minor}.${patch}-${preRelease2} <${Number(major) + 1}.0.0-0`;
722
- }
723
- } else {
724
- if (major === "0") {
725
- if (minor === "0") {
726
- return `>=${major}.${minor}.${patch} <${major}.${minor}.${Number(patch) + 1}-0`;
727
- } else {
728
- return `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0`;
729
- }
730
- }
731
- return `>=${major}.${minor}.${patch} <${Number(major) + 1}.0.0-0`;
732
- }
733
- })).join(" ");
734
- }
735
- function parseTildes(range) {
736
- return range.trim().split(/\s+/).map((rangeVersion) => rangeVersion.replace(parseRegex(tilde), (_, major, minor, patch, preRelease2) => {
737
- if (isXVersion(major)) {
738
- return "";
739
- } else if (isXVersion(minor)) {
740
- return `>=${major}.0.0 <${Number(major) + 1}.0.0-0`;
741
- } else if (isXVersion(patch)) {
742
- return `>=${major}.${minor}.0 <${major}.${Number(minor) + 1}.0-0`;
743
- } else if (preRelease2) {
744
- return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${Number(minor) + 1}.0-0`;
745
- }
746
- return `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0`;
747
- })).join(" ");
748
- }
749
- function parseXRanges(range) {
750
- return range.split(/\s+/).map((rangeVersion) => rangeVersion.trim().replace(parseRegex(xRange), (ret, gtlt2, major, minor, patch, preRelease2) => {
751
- const isXMajor = isXVersion(major);
752
- const isXMinor = isXMajor || isXVersion(minor);
753
- const isXPatch = isXMinor || isXVersion(patch);
754
- if (gtlt2 === "=" && isXPatch) {
755
- gtlt2 = "";
756
- }
757
- preRelease2 = "";
758
- if (isXMajor) {
759
- if (gtlt2 === ">" || gtlt2 === "<") {
760
- return "<0.0.0-0";
761
- } else {
762
- return "*";
763
- }
764
- } else if (gtlt2 && isXPatch) {
765
- if (isXMinor) {
766
- minor = 0;
767
- }
768
- patch = 0;
769
- if (gtlt2 === ">") {
770
- gtlt2 = ">=";
771
- if (isXMinor) {
772
- major = Number(major) + 1;
773
- minor = 0;
774
- patch = 0;
775
- } else {
776
- minor = Number(minor) + 1;
777
- patch = 0;
778
- }
779
- } else if (gtlt2 === "<=") {
780
- gtlt2 = "<";
781
- if (isXMinor) {
782
- major = Number(major) + 1;
783
- } else {
784
- minor = Number(minor) + 1;
785
- }
786
- }
787
- if (gtlt2 === "<") {
788
- preRelease2 = "-0";
789
- }
790
- return `${gtlt2 + major}.${minor}.${patch}${preRelease2}`;
791
- } else if (isXMinor) {
792
- return `>=${major}.0.0${preRelease2} <${Number(major) + 1}.0.0-0`;
793
- } else if (isXPatch) {
794
- return `>=${major}.${minor}.0${preRelease2} <${major}.${Number(minor) + 1}.0-0`;
795
- }
796
- return ret;
797
- })).join(" ");
798
- }
799
- function parseStar(range) {
800
- return range.trim().replace(parseRegex(star), "");
801
- }
802
- function parseGTE0(comparatorString) {
803
- return comparatorString.trim().replace(parseRegex(gte0), "");
804
- }
805
- function compareAtom(rangeAtom, versionAtom) {
806
- rangeAtom = Number(rangeAtom) || rangeAtom;
807
- versionAtom = Number(versionAtom) || versionAtom;
808
- if (rangeAtom > versionAtom) {
809
- return 1;
810
- }
811
- if (rangeAtom === versionAtom) {
812
- return 0;
813
- }
814
- return -1;
815
- }
816
- function comparePreRelease(rangeAtom, versionAtom) {
817
- const { preRelease: rangePreRelease } = rangeAtom;
818
- const { preRelease: versionPreRelease } = versionAtom;
819
- if (rangePreRelease === void 0 && Boolean(versionPreRelease)) {
820
- return 1;
821
- }
822
- if (Boolean(rangePreRelease) && versionPreRelease === void 0) {
823
- return -1;
824
- }
825
- if (rangePreRelease === void 0 && versionPreRelease === void 0) {
826
- return 0;
827
- }
828
- for (let i = 0, n = rangePreRelease.length; i <= n; i++) {
829
- const rangeElement = rangePreRelease[i];
830
- const versionElement = versionPreRelease[i];
831
- if (rangeElement === versionElement) {
832
- continue;
833
- }
834
- if (rangeElement === void 0 && versionElement === void 0) {
835
- return 0;
836
- }
837
- if (!rangeElement) {
838
- return 1;
839
- }
840
- if (!versionElement) {
841
- return -1;
842
- }
843
- return compareAtom(rangeElement, versionElement);
844
- }
845
- return 0;
846
- }
847
- function compareVersion(rangeAtom, versionAtom) {
848
- return compareAtom(rangeAtom.major, versionAtom.major) || compareAtom(rangeAtom.minor, versionAtom.minor) || compareAtom(rangeAtom.patch, versionAtom.patch) || comparePreRelease(rangeAtom, versionAtom);
849
- }
850
- function eq(rangeAtom, versionAtom) {
851
- return rangeAtom.version === versionAtom.version;
852
- }
853
- function compare(rangeAtom, versionAtom) {
854
- switch (rangeAtom.operator) {
855
- case "":
856
- case "=":
857
- return eq(rangeAtom, versionAtom);
858
- case ">":
859
- return compareVersion(rangeAtom, versionAtom) < 0;
860
- case ">=":
861
- return eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) < 0;
862
- case "<":
863
- return compareVersion(rangeAtom, versionAtom) > 0;
864
- case "<=":
865
- return eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) > 0;
866
- case void 0: {
867
- return true;
868
- }
869
- default:
870
- return false;
871
- }
872
- }
873
- function parseComparatorString(range) {
874
- return pipe(
875
- // handle caret
876
- // ^ --> * (any, kinda silly)
877
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
878
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
879
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
880
- // ^1.2.3 --> >=1.2.3 <2.0.0-0
881
- // ^1.2.0 --> >=1.2.0 <2.0.0-0
882
- parseCarets,
883
- // handle tilde
884
- // ~, ~> --> * (any, kinda silly)
885
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
886
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
887
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
888
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
889
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
890
- parseTildes,
891
- parseXRanges,
892
- parseStar
893
- )(range);
894
- }
895
- function parseRange(range) {
896
- return pipe(
897
- // handle hyphenRange
898
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
899
- parseHyphen,
900
- // handle trim comparator
901
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
902
- parseComparatorTrim,
903
- // handle trim tilde
904
- // `~ 1.2.3` => `~1.2.3`
905
- parseTildeTrim,
906
- // handle trim caret
907
- // `^ 1.2.3` => `^1.2.3`
908
- parseCaretTrim
909
- )(range.trim()).split(/\s+/).join(" ");
910
- }
911
- function satisfy(version, range) {
912
- if (!version) {
913
- return false;
914
- }
915
- const parsedRange = parseRange(range);
916
- const parsedComparator = parsedRange.split(" ").map((rangeVersion) => parseComparatorString(rangeVersion)).join(" ");
917
- const comparators = parsedComparator.split(/\s+/).map((comparator2) => parseGTE0(comparator2));
918
- const extractedVersion = extractComparator(version);
919
- if (!extractedVersion) {
920
- return false;
921
- }
922
- const [, versionOperator, , versionMajor, versionMinor, versionPatch, versionPreRelease] = extractedVersion;
923
- const versionAtom = {
924
- operator: versionOperator,
925
- version: combineVersion(versionMajor, versionMinor, versionPatch, versionPreRelease),
926
- major: versionMajor,
927
- minor: versionMinor,
928
- patch: versionPatch,
929
- preRelease: versionPreRelease == null ? void 0 : versionPreRelease.split(".")
930
- };
931
- for (const comparator2 of comparators) {
932
- const extractedComparator = extractComparator(comparator2);
933
- if (!extractedComparator) {
934
- return false;
935
- }
936
- const [, rangeOperator, , rangeMajor, rangeMinor, rangePatch, rangePreRelease] = extractedComparator;
937
- const rangeAtom = {
938
- operator: rangeOperator,
939
- version: combineVersion(rangeMajor, rangeMinor, rangePatch, rangePreRelease),
940
- major: rangeMajor,
941
- minor: rangeMinor,
942
- patch: rangePatch,
943
- preRelease: rangePreRelease == null ? void 0 : rangePreRelease.split(".")
944
- };
945
- if (!compare(rangeAtom, versionAtom)) {
946
- return false;
947
- }
948
- }
949
- return true;
950
- }
951
- function versionLt(a, b) {
952
- const transformInvalidVersion = (version) => {
953
- const isNumberVersion = !Number.isNaN(Number(version));
954
- if (isNumberVersion) {
955
- const splitArr = version.split(".");
956
- let validVersion = version;
957
- for (let i = 0; i < 3 - splitArr.length; i++) {
958
- validVersion += ".0";
959
- }
960
- return validVersion;
961
- }
962
- return version;
963
- };
964
- if (satisfy(transformInvalidVersion(a), `<=${transformInvalidVersion(b)}`)) {
965
- return true;
966
- } else {
967
- return false;
968
- }
969
- }
970
- const findVersion = (shareVersionMap, cb) => {
971
- const callback = cb || function(prev, cur) {
972
- return versionLt(prev, cur);
973
- };
974
- return Object.keys(shareVersionMap).reduce((prev, cur) => {
975
- if (!prev) {
976
- return cur;
977
- }
978
- if (callback(prev, cur)) {
979
- return cur;
980
- }
981
- if (prev === "0") {
982
- return cur;
983
- }
984
- return prev;
985
- }, 0);
986
- };
987
- const isLoaded = (shared) => {
988
- return Boolean(shared.loaded) || typeof shared.lib === "function";
989
- };
990
- function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
991
- const versions = shareScopeMap[scope][pkgName];
992
- const callback = function(prev, cur) {
993
- return !isLoaded(versions[prev]) && versionLt(prev, cur);
994
- };
995
- return findVersion(shareScopeMap[scope][pkgName], callback);
996
- }
997
- function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
998
- const versions = shareScopeMap[scope][pkgName];
999
- const callback = function(prev, cur) {
1000
- if (isLoaded(versions[cur])) {
1001
- if (isLoaded(versions[prev])) {
1002
- return Boolean(versionLt(prev, cur));
1003
- } else {
1004
- return true;
1005
- }
1006
- }
1007
- if (isLoaded(versions[prev])) {
1008
- return false;
1009
- }
1010
- return versionLt(prev, cur);
1011
- };
1012
- return findVersion(shareScopeMap[scope][pkgName], callback);
1013
- }
1014
- function getFindShareFunction(strategy) {
1015
- if (strategy === "loaded-first") {
1016
- return findSingletonVersionOrderByLoaded;
1017
- }
1018
- return findSingletonVersionOrderByVersion;
1019
- }
1020
- function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare) {
1021
- if (!localShareScopeMap) {
1022
- return;
1023
- }
1024
- const { shareConfig, scope = DEFAULT_SCOPE, strategy } = shareInfo;
1025
- const scopes = Array.isArray(scope) ? scope : [
1026
- scope
1027
- ];
1028
- for (const sc of scopes) {
1029
- if (shareConfig && localShareScopeMap[sc] && localShareScopeMap[sc][pkgName]) {
1030
- const { requiredVersion } = shareConfig;
1031
- const findShareFunction = getFindShareFunction(strategy);
1032
- const maxOrSingletonVersion = findShareFunction(localShareScopeMap, sc, pkgName);
1033
- const defaultResolver = () => {
1034
- if (shareConfig.singleton) {
1035
- if (typeof requiredVersion === "string" && !satisfy(maxOrSingletonVersion, requiredVersion)) {
1036
- const msg = `Version ${maxOrSingletonVersion} from ${maxOrSingletonVersion && localShareScopeMap[sc][pkgName][maxOrSingletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`;
1037
- if (shareConfig.strictVersion) {
1038
- error(msg);
1039
- } else {
1040
- warn(msg);
1041
- }
1042
- }
1043
- return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
1044
- } else {
1045
- if (requiredVersion === false || requiredVersion === "*") {
1046
- return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
1047
- }
1048
- if (satisfy(maxOrSingletonVersion, requiredVersion)) {
1049
- return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
1050
- }
1051
- for (const [versionKey, versionValue] of Object.entries(localShareScopeMap[sc][pkgName])) {
1052
- if (satisfy(versionKey, requiredVersion)) {
1053
- return versionValue;
1054
- }
1055
- }
1056
- }
1057
- };
1058
- const params = {
1059
- shareScopeMap: localShareScopeMap,
1060
- scope: sc,
1061
- pkgName,
1062
- version: maxOrSingletonVersion,
1063
- GlobalFederation: Global.__FEDERATION__,
1064
- resolver: defaultResolver
1065
- };
1066
- const resolveShared = resolveShare.emit(params) || params;
1067
- return resolveShared.resolver();
1068
- }
1069
- }
1070
- }
1071
- function getGlobalShareScope() {
1072
- return Global.__FEDERATION__.__SHARE__;
1073
- }
1074
- var pluginHelper$1 = /* @__PURE__ */ Object.freeze({
1075
- __proto__: null,
1076
- SyncHook,
1077
- AsyncHook,
1078
- SyncWaterfallHook,
1079
- AsyncWaterfallHook,
1080
- PluginSystem
1081
- });
1082
- const ShareUtils = {
1083
- getRegisteredShare,
1084
- getGlobalShareScope
1085
- };
1086
- const GlobalUtils = {
1087
- Global,
1088
- nativeGlobal,
1089
- resetFederationGlobalInfo,
1090
- getGlobalFederationInstance,
1091
- setGlobalFederationInstance,
1092
- getGlobalFederationConstructor,
1093
- setGlobalFederationConstructor,
1094
- getInfoWithoutType,
1095
- getGlobalSnapshot,
1096
- getTargetSnapshotInfoByModuleInfo,
1097
- getGlobalSnapshotInfoByModuleInfo,
1098
- setGlobalSnapshotInfoByModuleInfo,
1099
- addGlobalSnapshot,
1100
- getRemoteEntryExports,
1101
- registerGlobalPlugins,
1102
- getGlobalHostPlugins,
1103
- getPreloaded,
1104
- setPreloaded,
1105
- registerPlugins,
1106
- pluginHelper: pluginHelper$1
1107
- };
1108
- var helpers = {
1109
- global: GlobalUtils,
1110
- share: ShareUtils
1111
- };
1112
- const registerPlugin = helpers.global.registerPlugins;
1113
- const pluginHelper = helpers.global.pluginHelper;
1114
- const host = runtime.getInstance();
1115
- const pluginSystem = new pluginHelper.PluginSystem({
1116
- beforeBridgeRender: new pluginHelper.SyncHook(),
1117
- beforeBridgeDestroy: new pluginHelper.SyncHook()
1118
- });
1119
- registerPlugin(
1120
- (_a = host == null ? void 0 : host.options) == null ? void 0 : _a.plugins,
1121
- [pluginSystem]
1122
- );
1123
120
  const RemoteAppWrapper = React.forwardRef(function(props, ref) {
1124
121
  const RemoteApp2 = () => {
1125
122
  context.LoggerInstance.log(`RemoteAppWrapper RemoteApp props >>>`, { props });
@@ -1153,28 +150,17 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
1153
150
  `createRemoteComponent LazyComponent render >>>`,
1154
151
  renderProps
1155
152
  );
1156
- pluginSystem.lifecycle.beforeBridgeRender.emit({
1157
- ...renderProps
1158
- });
1159
153
  providerReturn.render(renderProps);
1160
154
  });
1161
155
  return () => {
1162
156
  clearTimeout(renderTimeout);
1163
157
  setTimeout(() => {
1164
- var _a2, _b;
1165
- if ((_a2 = providerInfoRef.current) == null ? void 0 : _a2.destroy) {
158
+ var _a, _b;
159
+ if ((_a = providerInfoRef.current) == null ? void 0 : _a.destroy) {
1166
160
  context.LoggerInstance.log(
1167
161
  `createRemoteComponent LazyComponent destroy >>>`,
1168
162
  { moduleName, basename, dom: renderDom.current }
1169
163
  );
1170
- pluginSystem.lifecycle.beforeBridgeDestroy.emit({
1171
- moduleName,
1172
- dom: renderDom.current,
1173
- basename,
1174
- memoryRoute,
1175
- fallback,
1176
- ...resProps
1177
- });
1178
164
  (_b = providerInfoRef.current) == null ? void 0 : _b.destroy({
1179
165
  dom: renderDom.current
1180
166
  });
@@ -1196,7 +182,7 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
1196
182
  });
1197
183
  function withRouterData(WrappedComponent) {
1198
184
  const Component = React.forwardRef(function(props, ref) {
1199
- var _a2;
185
+ var _a;
1200
186
  let enableDispathPopstate = false;
1201
187
  let routerContextVal;
1202
188
  try {
@@ -1226,7 +212,7 @@ function withRouterData(WrappedComponent) {
1226
212
  const match = useRouteMatch == null ? void 0 : useRouteMatch();
1227
213
  if (useHistory) {
1228
214
  const history = useHistory == null ? void 0 : useHistory();
1229
- basename = (_a2 = history == null ? void 0 : history.createHref) == null ? void 0 : _a2.call(history, { pathname: "/" });
215
+ basename = (_a = history == null ? void 0 : history.createHref) == null ? void 0 : _a.call(history, { pathname: "/" });
1230
216
  }
1231
217
  if (match) {
1232
218
  basename = context.pathJoin(basename, (match == null ? void 0 : match.path) || "/");
@@ -1303,8 +289,8 @@ function createLazyRemoteComponent(info) {
1303
289
  )}`
1304
290
  );
1305
291
  }
1306
- } catch (error2) {
1307
- throw error2;
292
+ } catch (error) {
293
+ throw error;
1308
294
  }
1309
295
  });
1310
296
  }
@@ -1380,9 +366,6 @@ function createBridgeComponent(bridgeInfo) {
1380
366
  }
1381
367
  ))
1382
368
  );
1383
- if ((bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.beforeBridgeRender) && typeof (bridgeInfo == null ? void 0 : bridgeInfo.hooks.beforeBridgeRender) === "function") {
1384
- bridgeInfo.hooks.beforeBridgeRender(info);
1385
- }
1386
369
  if (context.atLeastReact18(React__namespace)) {
1387
370
  if (bridgeInfo == null ? void 0 : bridgeInfo.render) {
1388
371
  Promise.resolve(
@@ -1402,9 +385,6 @@ function createBridgeComponent(bridgeInfo) {
1402
385
  context.LoggerInstance.log(`createBridgeComponent destroy Info`, {
1403
386
  dom: info.dom
1404
387
  });
1405
- if ((bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.beforeBridgeDestroy) && typeof (bridgeInfo == null ? void 0 : bridgeInfo.hooks.beforeBridgeDestroy) === "function") {
1406
- bridgeInfo.hooks.beforeBridgeDestroy(info);
1407
- }
1408
388
  if (context.atLeastReact18(React__namespace)) {
1409
389
  const root = rootMap.get(info.dom);
1410
390
  root == null ? void 0 : root.unmount();