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