@module-federation/bridge-react 0.0.0-next-20240830065016 → 0.0.0-next-20240902023803

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