@module-federation/bridge-react 0.0.0-next-20240902075042 → 0.0.0-next-20240903075658

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