@module-federation/bridge-react 0.0.0-next-20240930091801 → 0.0.0-next-20241002194835

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