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