remote-components 0.0.31 → 0.0.33
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/{component-loader-e5513139.d.ts → component-loader-28ad0083.d.ts} +1 -0
- package/dist/html/host.cjs +152 -56
- package/dist/html/host.cjs.map +1 -1
- package/dist/html/host.js +152 -56
- package/dist/html/host.js.map +1 -1
- package/dist/internal/next/host/app-router-client.cjs +6 -2
- package/dist/internal/next/host/app-router-client.cjs.map +1 -1
- package/dist/internal/next/host/app-router-client.d.ts +2 -2
- package/dist/internal/next/host/app-router-client.js +6 -2
- package/dist/internal/next/host/app-router-client.js.map +1 -1
- package/dist/internal/next/remote/render-client.cjs +13 -3
- package/dist/internal/next/remote/render-client.cjs.map +1 -1
- package/dist/internal/next/remote/render-client.js +13 -3
- package/dist/internal/next/remote/render-client.js.map +1 -1
- package/dist/internal/next/remote/render-server.cjs +22 -3
- package/dist/internal/next/remote/render-server.cjs.map +1 -1
- package/dist/internal/next/remote/render-server.js +23 -4
- package/dist/internal/next/remote/render-server.js.map +1 -1
- package/dist/internal/shared/client/remote-component.cjs +82 -45
- package/dist/internal/shared/client/remote-component.cjs.map +1 -1
- package/dist/internal/shared/client/remote-component.d.ts +9 -2
- package/dist/internal/shared/client/remote-component.js +81 -45
- package/dist/internal/shared/client/remote-component.js.map +1 -1
- package/dist/internal/shared/error.cjs +50 -0
- package/dist/internal/shared/error.cjs.map +1 -0
- package/dist/internal/shared/error.d.ts +10 -0
- package/dist/internal/shared/error.js +24 -0
- package/dist/internal/shared/error.js.map +1 -0
- package/dist/internal/shared/ssr/dom-flight.cjs +8 -1
- package/dist/internal/shared/ssr/dom-flight.cjs.map +1 -1
- package/dist/internal/shared/ssr/dom-flight.d.ts +2 -1
- package/dist/internal/shared/ssr/dom-flight.js +8 -1
- package/dist/internal/shared/ssr/dom-flight.js.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.cjs +48 -5
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.d.ts +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.js +52 -5
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -1
- package/dist/internal/webpack/next-client-pages-loader.cjs +3 -2
- package/dist/internal/webpack/next-client-pages-loader.cjs.map +1 -1
- package/dist/internal/webpack/next-client-pages-loader.js +3 -2
- package/dist/internal/webpack/next-client-pages-loader.js.map +1 -1
- package/dist/next/config.cjs +26 -9
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.js +26 -9
- package/dist/next/config.js.map +1 -1
- package/dist/next/host/client/index.cjs +133 -57
- package/dist/next/host/client/index.cjs.map +1 -1
- package/dist/next/host/client/index.d.ts +1 -1
- package/dist/next/host/client/index.js +133 -57
- package/dist/next/host/client/index.js.map +1 -1
- package/dist/next/host/pages-router-client.cjs +1 -1
- package/dist/next/host/pages-router-client.cjs.map +1 -1
- package/dist/next/host/pages-router-client.js +1 -1
- package/dist/next/host/pages-router-client.js.map +1 -1
- package/dist/next/host/pages-router-server.cjs +4 -3
- package/dist/next/host/pages-router-server.cjs.map +1 -1
- package/dist/next/host/pages-router-server.js +4 -3
- package/dist/next/host/pages-router-server.js.map +1 -1
- package/dist/next/index.cjs +4 -2
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +4 -2
- package/dist/next/index.js.map +1 -1
- package/dist/next/remote/pages-router.cjs +1 -1
- package/dist/next/remote/pages-router.cjs.map +1 -1
- package/dist/next/remote/pages-router.js +1 -1
- package/dist/next/remote/pages-router.js.map +1 -1
- package/dist/react/index.cjs +42 -11
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +46 -11
- package/dist/react/index.js.map +1 -1
- package/dist/shared/host/app.cjs +36 -0
- package/dist/shared/host/app.cjs.map +1 -0
- package/dist/shared/host/app.d.ts +3 -0
- package/dist/shared/host/app.js +12 -0
- package/dist/shared/host/app.js.map +1 -0
- package/dist/shared/host/pages.cjs +36 -0
- package/dist/shared/host/pages.cjs.map +1 -0
- package/dist/shared/host/pages.d.ts +3 -0
- package/dist/shared/host/pages.js +12 -0
- package/dist/shared/host/pages.js.map +1 -0
- package/dist/shared/remote/app.cjs +32 -0
- package/dist/shared/remote/app.cjs.map +1 -0
- package/dist/shared/remote/app.d.ts +3 -0
- package/dist/shared/remote/app.js +8 -0
- package/dist/shared/remote/app.js.map +1 -0
- package/dist/shared/remote/pages.cjs +32 -0
- package/dist/shared/remote/pages.cjs.map +1 -0
- package/dist/shared/remote/pages.d.ts +3 -0
- package/dist/shared/remote/pages.js +8 -0
- package/dist/shared/remote/pages.js.map +1 -0
- package/dist/shared/remote/wrapper.cjs +48 -0
- package/dist/shared/remote/wrapper.cjs.map +1 -0
- package/dist/shared/remote/wrapper.d.ts +2 -0
- package/dist/shared/remote/wrapper.js +25 -0
- package/dist/shared/remote/wrapper.js.map +1 -0
- package/dist/{types-b8210fd3.d.ts → types-7c207455.d.ts} +1 -1
- package/dist/{types-280a3640.d.ts → types-e4a3fa37.d.ts} +1 -0
- package/package.json +37 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { a as LoadRemoteComponentProps } from '../../../component-loader-
|
|
3
|
+
import { a as LoadRemoteComponentProps } from '../../../component-loader-28ad0083.js';
|
|
4
4
|
|
|
5
5
|
declare module 'react/jsx-runtime' {
|
|
6
6
|
namespace JSX {
|
|
@@ -48,6 +48,26 @@ function applySharedModules(bundle, resolve) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
// src/shared/error.ts
|
|
52
|
+
var RemoteComponentsError = class extends Error {
|
|
53
|
+
constructor(message, options) {
|
|
54
|
+
super(message, options);
|
|
55
|
+
this.code = "REMOTE_COMPONENTS_ERROR";
|
|
56
|
+
this.name = "RemoteComponentsError";
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function multipleRemoteComponentsError(url) {
|
|
60
|
+
return new Error(
|
|
61
|
+
`Multiple Remote Components found at "${url}". When a page exposes multiple Remote Components you must specify the "name" prop to select which one to load.`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
function failedToFetchRemoteComponentError(url, error) {
|
|
65
|
+
return new RemoteComponentsError(
|
|
66
|
+
`Failed to fetch Remote Component from "${url}". Is the URL correct and accessible?`,
|
|
67
|
+
{ cause: error instanceof Error ? error : new Error(String(error)) }
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
51
71
|
// src/shared/webpack/next-client-pages-loader.ts
|
|
52
72
|
function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
53
73
|
const self = globalThis;
|
|
@@ -86,8 +106,8 @@ function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
|
86
106
|
(key) => key.includes("/next/dist/client/page-loader.js")
|
|
87
107
|
) ?? ""] ?? -1;
|
|
88
108
|
if (!(componentLoaderChunk && appLoaderChunk)) {
|
|
89
|
-
throw new
|
|
90
|
-
`Next.js client pages loader not found in bundle "${bundle}"
|
|
109
|
+
throw new RemoteComponentsError(
|
|
110
|
+
`Next.js client pages loader not found in bundle "${bundle}".`
|
|
91
111
|
);
|
|
92
112
|
}
|
|
93
113
|
const __NEXT_P_ORIGINAL = self.__NEXT_P;
|
|
@@ -311,11 +331,11 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
311
331
|
scriptResolve(void 0);
|
|
312
332
|
script.remove();
|
|
313
333
|
};
|
|
314
|
-
script.onerror = (
|
|
334
|
+
script.onerror = () => {
|
|
315
335
|
URL.revokeObjectURL(scriptUrl);
|
|
316
336
|
scriptReject(
|
|
317
|
-
new
|
|
318
|
-
`Failed to load script
|
|
337
|
+
new RemoteComponentsError(
|
|
338
|
+
`Failed to load <script src="${script.src}"> for Remote Component. Check the URL is correct.`
|
|
319
339
|
)
|
|
320
340
|
);
|
|
321
341
|
script.remove();
|
|
@@ -357,11 +377,11 @@ function createModuleRequire(runtime) {
|
|
|
357
377
|
if (bundle && moduleId) {
|
|
358
378
|
return handleTurbopackModule(bundle, moduleId, id);
|
|
359
379
|
}
|
|
360
|
-
throw new Error(`Module ${id} not found
|
|
380
|
+
throw new Error(`Module "${id}" not found.`);
|
|
361
381
|
} catch (requireError) {
|
|
362
382
|
if (typeof self.__original_webpack_require__ !== "function") {
|
|
363
|
-
throw new
|
|
364
|
-
`Module ${id} not found in remote component bundle ${bundle}
|
|
383
|
+
throw new RemoteComponentsError(
|
|
384
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
365
385
|
{
|
|
366
386
|
cause: requireError instanceof Error ? requireError : void 0
|
|
367
387
|
}
|
|
@@ -370,8 +390,8 @@ function createModuleRequire(runtime) {
|
|
|
370
390
|
try {
|
|
371
391
|
return self.__original_webpack_require__(id);
|
|
372
392
|
} catch (originalError) {
|
|
373
|
-
throw new
|
|
374
|
-
`Module ${id} not found in remote component bundle ${bundle}
|
|
393
|
+
throw new RemoteComponentsError(
|
|
394
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
375
395
|
{ cause: originalError instanceof Error ? originalError : void 0 }
|
|
376
396
|
);
|
|
377
397
|
}
|
|
@@ -501,7 +521,6 @@ function handleTurbopackModule(bundle, moduleId, id) {
|
|
|
501
521
|
}
|
|
502
522
|
const exports = {};
|
|
503
523
|
const moduleExports = { exports };
|
|
504
|
-
const exportNames = /* @__PURE__ */ new Set();
|
|
505
524
|
if (!self.__remote_components_turbopack_modules__) {
|
|
506
525
|
self.__remote_components_turbopack_modules__ = {};
|
|
507
526
|
}
|
|
@@ -537,31 +556,53 @@ function handleTurbopackModule(bundle, moduleId, id) {
|
|
|
537
556
|
};
|
|
538
557
|
}
|
|
539
558
|
},
|
|
540
|
-
//
|
|
541
|
-
s(
|
|
542
|
-
let mod =
|
|
543
|
-
if (
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
559
|
+
// esm
|
|
560
|
+
s(bindings, esmId) {
|
|
561
|
+
let mod = exports;
|
|
562
|
+
if (typeof esmId === "string" || typeof esmId === "number") {
|
|
563
|
+
if (!self.__remote_components_turbopack_modules__) {
|
|
564
|
+
self.__remote_components_turbopack_modules__ = {};
|
|
565
|
+
}
|
|
566
|
+
if (!self.__remote_components_turbopack_modules__[bundle]) {
|
|
567
|
+
self.__remote_components_turbopack_modules__[bundle] = {};
|
|
568
|
+
}
|
|
569
|
+
if (!self.__remote_components_turbopack_modules__[bundle][esmId]) {
|
|
570
|
+
self.__remote_components_turbopack_modules__[bundle][esmId] = {};
|
|
571
|
+
}
|
|
572
|
+
mod = self.__remote_components_turbopack_modules__[bundle][esmId];
|
|
573
|
+
}
|
|
574
|
+
Object.defineProperty(mod, "__esModule", { value: true });
|
|
575
|
+
if (Array.isArray(bindings)) {
|
|
576
|
+
let i = 0;
|
|
577
|
+
while (i < bindings.length) {
|
|
578
|
+
const propName = bindings[i++];
|
|
579
|
+
const tagOrFunc = bindings[i++];
|
|
580
|
+
if (typeof tagOrFunc === "number") {
|
|
581
|
+
Object.defineProperty(mod, propName, {
|
|
582
|
+
value: bindings[i++],
|
|
583
|
+
enumerable: true,
|
|
584
|
+
writable: false
|
|
585
|
+
});
|
|
586
|
+
} else {
|
|
587
|
+
const getterFn = tagOrFunc;
|
|
588
|
+
if (typeof bindings[i] === "function") {
|
|
589
|
+
const setterFn = bindings[i++];
|
|
590
|
+
Object.defineProperty(mod, propName, {
|
|
591
|
+
get: getterFn,
|
|
592
|
+
set: setterFn,
|
|
593
|
+
enumerable: true
|
|
594
|
+
});
|
|
595
|
+
} else {
|
|
596
|
+
Object.defineProperty(mod, propName, {
|
|
597
|
+
get: getterFn,
|
|
598
|
+
enumerable: true
|
|
599
|
+
});
|
|
555
600
|
}
|
|
556
601
|
}
|
|
557
602
|
}
|
|
558
603
|
}
|
|
559
|
-
for (const [key, value] of Object.entries(mod)) {
|
|
560
|
-
exports[key] = value;
|
|
561
|
-
exportNames.add(key);
|
|
562
|
-
}
|
|
563
604
|
},
|
|
564
|
-
// import
|
|
605
|
+
// import
|
|
565
606
|
i(importId) {
|
|
566
607
|
let mod;
|
|
567
608
|
if (typeof importId === "string") {
|
|
@@ -585,7 +626,10 @@ function handleTurbopackModule(bundle, moduleId, id) {
|
|
|
585
626
|
} else {
|
|
586
627
|
mod = self.__webpack_require__?.(`[${bundle}] ${importId}`);
|
|
587
628
|
}
|
|
588
|
-
if (
|
|
629
|
+
if (typeof mod !== "object") {
|
|
630
|
+
mod = { default: mod };
|
|
631
|
+
} else if (!("default" in mod) && // eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
632
|
+
mod.toString() !== "[object Module]") {
|
|
589
633
|
try {
|
|
590
634
|
mod.default = mod;
|
|
591
635
|
} catch {
|
|
@@ -604,7 +648,7 @@ function handleTurbopackModule(bundle, moduleId, id) {
|
|
|
604
648
|
return self.__webpack_require__?.(`[${bundle}] ${vid}`);
|
|
605
649
|
});
|
|
606
650
|
} else {
|
|
607
|
-
exports
|
|
651
|
+
moduleExports.exports = value;
|
|
608
652
|
}
|
|
609
653
|
},
|
|
610
654
|
// async module initializer
|
|
@@ -638,7 +682,9 @@ function handleTurbopackModule(bundle, moduleId, id) {
|
|
|
638
682
|
return self.__webpack_chunk_load__?.(bundleUrl, bundle);
|
|
639
683
|
}
|
|
640
684
|
}
|
|
641
|
-
throw new Error(
|
|
685
|
+
throw new Error(
|
|
686
|
+
`Failed to load Turbopack chunk "${url}" for module "${id}". Check the URL is correct.`
|
|
687
|
+
);
|
|
642
688
|
},
|
|
643
689
|
// global
|
|
644
690
|
g: self.__remote_components_turbopack_global__[bundle],
|
|
@@ -648,11 +694,6 @@ function handleTurbopackModule(bundle, moduleId, id) {
|
|
|
648
694
|
moduleExports,
|
|
649
695
|
exports
|
|
650
696
|
);
|
|
651
|
-
for (const name of exportNames) {
|
|
652
|
-
if (typeof exports[name] === "function") {
|
|
653
|
-
exports[name] = exports[name]();
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
697
|
if (self.__remote_components_turbopack_modules__[bundle][moduleId] !== moduleExports.exports) {
|
|
657
698
|
self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
|
|
658
699
|
}
|
|
@@ -675,8 +716,8 @@ async function loadScripts(scripts) {
|
|
|
675
716
|
};
|
|
676
717
|
newScript.onerror = () => {
|
|
677
718
|
reject(
|
|
678
|
-
new
|
|
679
|
-
`Failed to load script ${script.src} for
|
|
719
|
+
new RemoteComponentsError(
|
|
720
|
+
`Failed to load <script src="${script.src}"> for Remote Component. Check the URL is correct.`
|
|
680
721
|
)
|
|
681
722
|
);
|
|
682
723
|
};
|
|
@@ -824,7 +865,10 @@ async function loadRemoteComponent({
|
|
|
824
865
|
} catch (error) {
|
|
825
866
|
return {
|
|
826
867
|
component: null,
|
|
827
|
-
error:
|
|
868
|
+
error: new RemoteComponentsError(
|
|
869
|
+
`Failed to load remote component "${name}".`,
|
|
870
|
+
{ cause: error instanceof Error ? error : new Error(String(error)) }
|
|
871
|
+
)
|
|
828
872
|
};
|
|
829
873
|
}
|
|
830
874
|
}
|
|
@@ -840,7 +884,9 @@ async function loadRSCComponent(rscName, data) {
|
|
|
840
884
|
createFromReadableStream = _createFromReadableStream;
|
|
841
885
|
}
|
|
842
886
|
if (typeof createFromReadableStream !== "function") {
|
|
843
|
-
throw new
|
|
887
|
+
throw new RemoteComponentsError(
|
|
888
|
+
'Failed to import "react-server-dom-webpack". Is Next.js installed correctly?'
|
|
889
|
+
);
|
|
844
890
|
}
|
|
845
891
|
const stream = createRSCStream(rscName, data);
|
|
846
892
|
const component = createFromReadableStream(stream);
|
|
@@ -849,8 +895,8 @@ async function loadRSCComponent(rscName, data) {
|
|
|
849
895
|
function loadNextPagesComponent(bundle, route, nextData, name, container) {
|
|
850
896
|
const { Component, App } = nextClientPagesLoader(bundle, route, container);
|
|
851
897
|
if (!Component) {
|
|
852
|
-
throw new
|
|
853
|
-
`Remote
|
|
898
|
+
throw new RemoteComponentsError(
|
|
899
|
+
`Remote Component "${name}" is trying to load the component for route "${route}" but it is not available.`
|
|
854
900
|
);
|
|
855
901
|
}
|
|
856
902
|
const component = App ? React.createElement(App, { Component, ...nextData.props }) : React.createElement(Component, nextData.props);
|
|
@@ -1314,7 +1360,6 @@ function RemoteComponent({
|
|
|
1314
1360
|
}
|
|
1315
1361
|
}, [src]);
|
|
1316
1362
|
useEffect(() => {
|
|
1317
|
-
let mounted = true;
|
|
1318
1363
|
if (src && src !== prevSrcRef.current) {
|
|
1319
1364
|
prevSrcRef.current = src;
|
|
1320
1365
|
startTransition(async () => {
|
|
@@ -1330,9 +1375,31 @@ function RemoteComponent({
|
|
|
1330
1375
|
};
|
|
1331
1376
|
const res = await fetch(url, fetchInit);
|
|
1332
1377
|
if (!res.ok) {
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
);
|
|
1378
|
+
let error = failedToFetchRemoteComponentError(url.href, {
|
|
1379
|
+
cause: new Error(`${res.status} ${res.statusText}`)
|
|
1380
|
+
});
|
|
1381
|
+
try {
|
|
1382
|
+
const body = await res.text();
|
|
1383
|
+
const parser2 = new DOMParser();
|
|
1384
|
+
const doc2 = parser2.parseFromString(body, "text/html");
|
|
1385
|
+
const errorTemplate = doc2.querySelector(
|
|
1386
|
+
"template[data-next-error-message]"
|
|
1387
|
+
);
|
|
1388
|
+
const errorMessage = errorTemplate?.getAttribute(
|
|
1389
|
+
"data-next-error-message"
|
|
1390
|
+
);
|
|
1391
|
+
const errorStack = errorTemplate?.getAttribute(
|
|
1392
|
+
"data-next-error-stack"
|
|
1393
|
+
);
|
|
1394
|
+
if (errorMessage) {
|
|
1395
|
+
error = new RemoteComponentsError(errorMessage);
|
|
1396
|
+
if (errorStack) {
|
|
1397
|
+
error.stack = errorStack;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
} catch {
|
|
1401
|
+
}
|
|
1402
|
+
throw error;
|
|
1336
1403
|
}
|
|
1337
1404
|
const remoteHtml = await res.text();
|
|
1338
1405
|
htmlRef.current = remoteHtml;
|
|
@@ -1340,6 +1407,9 @@ function RemoteComponent({
|
|
|
1340
1407
|
}
|
|
1341
1408
|
const parser = new DOMParser();
|
|
1342
1409
|
const doc = parser.parseFromString(html, "text/html");
|
|
1410
|
+
if (doc.querySelectorAll("div[data-bundle][data-route]").length > 1 && !doc.querySelector(`div[data-bundle][data-route][id^="${name}"]`)) {
|
|
1411
|
+
throw multipleRemoteComponentsError(url.href);
|
|
1412
|
+
}
|
|
1343
1413
|
const component = doc.querySelector(`div[data-bundle][data-route][id^="${name}"]`) ?? // fallback to the first element with the data-bundle and data-route attributes when not using a named remote component
|
|
1344
1414
|
doc.querySelector("div[data-bundle][data-route]") ?? // fallback to Next.js Pages Router
|
|
1345
1415
|
doc.querySelector("div#__next");
|
|
@@ -1361,7 +1431,9 @@ function RemoteComponent({
|
|
|
1361
1431
|
const remoteShared = nextData?.props.__REMOTE_COMPONENT__?.shared ?? (JSON.parse(remoteSharedEl?.textContent ?? "{}") ?? {});
|
|
1362
1432
|
remoteSharedEl?.remove();
|
|
1363
1433
|
if (!component || !(rsc || nextData)) {
|
|
1364
|
-
throw new
|
|
1434
|
+
throw new RemoteComponentsError(
|
|
1435
|
+
`Remote Component not found on ${url.href}.${remoteName !== "__vercel_remote_component" ? `The name for the <RemoteComponent> is "${remoteName}". Check <RemoteComponent> usage.` : ""} Did you forget to wrap the content in <RemoteComponent>?`
|
|
1436
|
+
);
|
|
1365
1437
|
}
|
|
1366
1438
|
applyOriginToNodes(doc, url);
|
|
1367
1439
|
const links = Array.from(
|
|
@@ -1453,6 +1525,15 @@ function RemoteComponent({
|
|
|
1453
1525
|
};
|
|
1454
1526
|
componentHydrationHtml.current = Array.from(doc.querySelectorAll("link,style")).map((link) => link.outerHTML).join("") + component.innerHTML;
|
|
1455
1527
|
const userShared = await shared;
|
|
1528
|
+
if ("__remote_components_missing_shared__" in userShared) {
|
|
1529
|
+
userShared.__remote_components_missing_shared__().catch((e) => {
|
|
1530
|
+
throw e;
|
|
1531
|
+
});
|
|
1532
|
+
} else if ("__remote_components_missing_shared__" in remoteShared) {
|
|
1533
|
+
throw new RemoteComponentsError(
|
|
1534
|
+
remoteShared.__remote_components_missing_shared__
|
|
1535
|
+
);
|
|
1536
|
+
}
|
|
1456
1537
|
const result = await loadRemoteComponent({
|
|
1457
1538
|
url: new URL(url, location.origin),
|
|
1458
1539
|
name: remoteName,
|
|
@@ -1497,15 +1578,10 @@ function RemoteComponent({
|
|
|
1497
1578
|
setRemoteComponent(result.component);
|
|
1498
1579
|
}
|
|
1499
1580
|
} catch (error) {
|
|
1500
|
-
|
|
1501
|
-
setRemoteComponent(error);
|
|
1502
|
-
}
|
|
1581
|
+
setRemoteComponent(error);
|
|
1503
1582
|
}
|
|
1504
1583
|
});
|
|
1505
1584
|
}
|
|
1506
|
-
return () => {
|
|
1507
|
-
mounted = false;
|
|
1508
|
-
};
|
|
1509
1585
|
}, [
|
|
1510
1586
|
url,
|
|
1511
1587
|
src,
|
|
@@ -1684,7 +1760,7 @@ var routerImpl = async () => {
|
|
|
1684
1760
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1685
1761
|
async function tryImportShared() {
|
|
1686
1762
|
try {
|
|
1687
|
-
const { shared } = await import("
|
|
1763
|
+
const { shared } = await import("remote-components/shared/host/app");
|
|
1688
1764
|
return shared;
|
|
1689
1765
|
} catch {
|
|
1690
1766
|
return {};
|