remote-components 0.0.45 → 0.0.46
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/html/host.cjs +154 -49
- package/dist/html/host.cjs.map +1 -1
- package/dist/html/host.js +154 -49
- package/dist/html/host.js.map +1 -1
- package/dist/html/remote.cjs +28 -28
- package/dist/html/remote.cjs.map +1 -1
- package/dist/html/remote.js +28 -28
- package/dist/html/remote.js.map +1 -1
- package/dist/internal/next/host/app-router-client.cjs +10 -5
- package/dist/internal/next/host/app-router-client.cjs.map +1 -1
- package/dist/internal/next/host/app-router-client.js +10 -5
- package/dist/internal/next/host/app-router-client.js.map +1 -1
- package/dist/internal/next/host/app-router-compat.cjs +9 -4
- package/dist/internal/next/host/app-router-compat.cjs.map +1 -1
- package/dist/internal/next/host/app-router-compat.js +9 -4
- package/dist/internal/next/host/app-router-compat.js.map +1 -1
- package/dist/internal/shared/client/polyfill.cjs +3 -1
- package/dist/internal/shared/client/polyfill.cjs.map +1 -1
- package/dist/internal/shared/client/polyfill.js +3 -1
- package/dist/internal/shared/client/polyfill.js.map +1 -1
- package/dist/internal/shared/client/remote-component.cjs +126 -26
- package/dist/internal/shared/client/remote-component.cjs.map +1 -1
- package/dist/internal/shared/client/remote-component.js +126 -26
- package/dist/internal/shared/client/remote-component.js.map +1 -1
- package/dist/internal/shared/logger.cjs +50 -0
- package/dist/internal/shared/logger.cjs.map +1 -0
- package/dist/internal/shared/logger.d.ts +6 -0
- package/dist/internal/shared/logger.js +24 -0
- package/dist/internal/shared/logger.js.map +1 -0
- package/dist/internal/shared/ssr/fetch-remote-component.cjs +3 -0
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.js +3 -0
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -1
- package/dist/internal/shared/utils.cjs +9 -2
- package/dist/internal/shared/utils.cjs.map +1 -1
- package/dist/internal/shared/utils.d.ts +2 -0
- package/dist/internal/shared/utils.js +5 -1
- package/dist/internal/shared/utils.js.map +1 -1
- package/dist/next/config.cjs +22 -1
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.js +22 -1
- package/dist/next/config.js.map +1 -1
- package/dist/next/host/client/index.cjs +180 -75
- package/dist/next/host/client/index.cjs.map +1 -1
- package/dist/next/host/client/index.js +180 -75
- package/dist/next/host/client/index.js.map +1 -1
- package/dist/react/index.cjs +172 -71
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +172 -71
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/html/host.cjs
CHANGED
|
@@ -65,10 +65,18 @@ function logDebug(location2, message) {
|
|
|
65
65
|
function logWarn(location2, message) {
|
|
66
66
|
console.warn(`[${PREFIX}:${location2}]: ${message}`);
|
|
67
67
|
}
|
|
68
|
+
function logError(location2, message, cause) {
|
|
69
|
+
console.error(
|
|
70
|
+
new RemoteComponentsError(`[${PREFIX}:${location2}]: ${message}`, {
|
|
71
|
+
cause
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
}
|
|
68
75
|
var PREFIX, DEBUG;
|
|
69
76
|
var init_logger = __esm({
|
|
70
77
|
"src/shared/utils/logger.ts"() {
|
|
71
78
|
"use strict";
|
|
79
|
+
init_error();
|
|
72
80
|
PREFIX = "remote-components";
|
|
73
81
|
DEBUG = typeof window !== "undefined" && localStorage.getItem("RC_DEBUG") === "true";
|
|
74
82
|
}
|
|
@@ -266,6 +274,7 @@ function escapeString(str) {
|
|
|
266
274
|
var init_utils = __esm({
|
|
267
275
|
"src/shared/utils/index.ts"() {
|
|
268
276
|
"use strict";
|
|
277
|
+
init_logger();
|
|
269
278
|
}
|
|
270
279
|
});
|
|
271
280
|
|
|
@@ -328,9 +337,18 @@ function createChunkLoader(runtime) {
|
|
|
328
337
|
logDebug("ChunkLoader", `Fetching chunk from: "${url}"`);
|
|
329
338
|
self.__remote_components_turbopack_chunk_loader_promise__[url] = new Promise((resolve, reject) => {
|
|
330
339
|
fetch(url).then((res) => res.text()).then((code) => {
|
|
331
|
-
|
|
340
|
+
const hasTurbopack = code.includes("globalThis.TURBOPACK") || code.includes("self.TURBOPACK");
|
|
341
|
+
if (hasTurbopack) {
|
|
332
342
|
return handleTurbopackChunk(code, bundle ?? "", url);
|
|
333
343
|
}
|
|
344
|
+
logDebug(
|
|
345
|
+
"ChunkLoader",
|
|
346
|
+
`Chunk does not contain globalThis.TURBOPACK or self.TURBOPACK: "${url}"`
|
|
347
|
+
);
|
|
348
|
+
logDebug(
|
|
349
|
+
"ChunkLoader",
|
|
350
|
+
`First 500 chars of chunk: ${code.slice(0, 500)}`
|
|
351
|
+
);
|
|
334
352
|
}).then(resolve).catch(reject);
|
|
335
353
|
});
|
|
336
354
|
return self.__remote_components_turbopack_chunk_loader_promise__[url];
|
|
@@ -352,7 +370,7 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
352
370
|
const self = globalThis;
|
|
353
371
|
const bundleKey = getBundleKey(bundle);
|
|
354
372
|
logDebug("ChunkLoader", `Bundle key: "${bundleKey}"`);
|
|
355
|
-
const transformedCode = code.replace(/globalThis\.TURBOPACK/g, `globalThis.TURBOPACK_${bundleKey}`).replace(
|
|
373
|
+
const transformedCode = code.replace(/globalThis\.TURBOPACK/g, `globalThis.TURBOPACK_${bundleKey}`).replace(/self\.TURBOPACK(?!_)/g, `self.TURBOPACK_${bundleKey}`).replace(
|
|
356
374
|
/TURBOPACK_WORKER_LOCATION/g,
|
|
357
375
|
`TURBOPACK_WORKER_LOCATION_${bundleKey}`
|
|
358
376
|
).replace(
|
|
@@ -371,6 +389,30 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
371
389
|
)
|
|
372
390
|
).href}$1$2.js.map`
|
|
373
391
|
);
|
|
392
|
+
if (!self[`TURBOPACK_${bundleKey}`]) {
|
|
393
|
+
const chunkData = [];
|
|
394
|
+
const turbopackObject = {
|
|
395
|
+
push: (item) => {
|
|
396
|
+
logDebug(
|
|
397
|
+
"ChunkLoader",
|
|
398
|
+
`TURBOPACK_${bundleKey}.push() called with item type: ${Array.isArray(item) ? "array" : typeof item}`
|
|
399
|
+
);
|
|
400
|
+
if (Array.isArray(item)) {
|
|
401
|
+
chunkData.push(item);
|
|
402
|
+
logDebug(
|
|
403
|
+
"ChunkLoader",
|
|
404
|
+
`TURBOPACK_${bundleKey} now has ${chunkData.length} chunks`
|
|
405
|
+
);
|
|
406
|
+
} else {
|
|
407
|
+
chunkData.push([item]);
|
|
408
|
+
}
|
|
409
|
+
return chunkData.length;
|
|
410
|
+
},
|
|
411
|
+
// Store chunks for later access
|
|
412
|
+
__chunks__: chunkData
|
|
413
|
+
};
|
|
414
|
+
self[`TURBOPACK_${bundleKey}`] = turbopackObject;
|
|
415
|
+
}
|
|
374
416
|
logDebug("ChunkLoader", `Creating blob script for: "${url}"`);
|
|
375
417
|
await new Promise((scriptResolve, scriptReject) => {
|
|
376
418
|
const blob = new Blob([transformedCode], {
|
|
@@ -383,6 +425,21 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
383
425
|
script.async = true;
|
|
384
426
|
script.onload = () => {
|
|
385
427
|
URL.revokeObjectURL(scriptUrl);
|
|
428
|
+
logDebug(
|
|
429
|
+
"ChunkLoader",
|
|
430
|
+
`Script loaded successfully for bundle "${bundle}"`
|
|
431
|
+
);
|
|
432
|
+
const turbopackBundle = self[`TURBOPACK_${bundleKey}`];
|
|
433
|
+
logDebug(
|
|
434
|
+
"ChunkLoader",
|
|
435
|
+
`TURBOPACK_${bundleKey} type: ${typeof turbopackBundle}, isArray: ${Array.isArray(turbopackBundle)}, keys: ${turbopackBundle ? Object.keys(turbopackBundle).slice(0, 10).join(", ") : "none"}`
|
|
436
|
+
);
|
|
437
|
+
if (turbopackBundle && typeof turbopackBundle === "object") {
|
|
438
|
+
logDebug(
|
|
439
|
+
"ChunkLoader",
|
|
440
|
+
`TURBOPACK_${bundleKey} length/size: ${Array.isArray(turbopackBundle) ? turbopackBundle.length : Object.keys(turbopackBundle).length}`
|
|
441
|
+
);
|
|
442
|
+
}
|
|
386
443
|
scriptResolve(void 0);
|
|
387
444
|
script.remove();
|
|
388
445
|
};
|
|
@@ -437,14 +494,29 @@ var init_chunk_loader = __esm({
|
|
|
437
494
|
}
|
|
438
495
|
});
|
|
439
496
|
|
|
497
|
+
// src/shared/client/turbopack-patterns.ts
|
|
498
|
+
var REMOTE_SHARED_MARKER_RE, REMOTE_SHARED_ASSIGNMENT_RE, ASYNC_MODULE_LOADER_RE, ASYNC_MODULE_RESOLVE_RE, ASYNC_MODULE_ALL_RE, NUMERIC_MODULE_ID_RE;
|
|
499
|
+
var init_turbopack_patterns = __esm({
|
|
500
|
+
"src/shared/client/turbopack-patterns.ts"() {
|
|
501
|
+
"use strict";
|
|
502
|
+
REMOTE_SHARED_MARKER_RE = /(?:self|[a-z])\.TURBOPACK_REMOTE_SHARED/;
|
|
503
|
+
REMOTE_SHARED_ASSIGNMENT_RE = /\.TURBOPACK_REMOTE_SHARED=await (?:__turbopack_context__|e)\.A\((?<sharedModuleId>[0-9]+)\)/;
|
|
504
|
+
ASYNC_MODULE_LOADER_RE = /(?:__turbopack_context__|e)\.A\((?<asyncSharedModuleId>[0-9]+)\)/;
|
|
505
|
+
ASYNC_MODULE_RESOLVE_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<inner>parentImport|e)=>Promise\.resolve\(\)\.then\(\(\)=>\k<inner>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
|
|
506
|
+
ASYNC_MODULE_ALL_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<vCb>parentImport|t)=>Promise\.all\(\["[^"]+"\]\.map\((?<mapCb>chunk|t)=>\k<ctx>\.l\(\k<mapCb>\)\)\)\.then\(\(\)=>\k<vCb>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
|
|
507
|
+
NUMERIC_MODULE_ID_RE = /^[0-9]+$/;
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
|
|
440
511
|
// src/shared/client/turbopack-module.ts
|
|
441
512
|
function handleTurbopackModule(bundle, moduleId, id) {
|
|
442
513
|
const self = globalThis;
|
|
443
514
|
const bundleKey = getBundleKey(bundle);
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
515
|
+
let modules = self[`TURBOPACK_${bundleKey}`];
|
|
516
|
+
if (modules && typeof modules === "object" && "__chunks__" in modules) {
|
|
517
|
+
const chunks = modules.__chunks__;
|
|
518
|
+
modules = chunks.flat();
|
|
519
|
+
}
|
|
448
520
|
if (!self.__remote_components_turbopack_modules__) {
|
|
449
521
|
self.__remote_components_turbopack_modules__ = {};
|
|
450
522
|
}
|
|
@@ -454,6 +526,12 @@ function handleTurbopackModule(bundle, moduleId, id) {
|
|
|
454
526
|
if (self.__remote_components_turbopack_modules__[bundle][moduleId]) {
|
|
455
527
|
return self.__remote_components_turbopack_modules__[bundle][moduleId];
|
|
456
528
|
}
|
|
529
|
+
if (!modules) {
|
|
530
|
+
logError("TurbopackModule", `TURBOPACK_${bundleKey} is undefined`);
|
|
531
|
+
}
|
|
532
|
+
const moduleInit = findModuleInit(modules, moduleId);
|
|
533
|
+
const exports = {};
|
|
534
|
+
const moduleExports = { exports };
|
|
457
535
|
if (typeof moduleInit !== "function") {
|
|
458
536
|
throw new Error(
|
|
459
537
|
`Module ${id} not found in bundle ${bundle} with id ${moduleId}`
|
|
@@ -466,7 +544,7 @@ function handleTurbopackModule(bundle, moduleId, id) {
|
|
|
466
544
|
if (!self.__remote_components_turbopack_global__[bundle]) {
|
|
467
545
|
self.__remote_components_turbopack_global__[bundle] = {};
|
|
468
546
|
}
|
|
469
|
-
const allModules = modules
|
|
547
|
+
const allModules = Array.isArray(modules) ? modules.flat() : modules ? Object.values(modules) : [];
|
|
470
548
|
moduleInit(
|
|
471
549
|
createTurbopackContext(
|
|
472
550
|
bundle,
|
|
@@ -486,9 +564,26 @@ function handleTurbopackModule(bundle, moduleId, id) {
|
|
|
486
564
|
return moduleExports.exports;
|
|
487
565
|
}
|
|
488
566
|
function findModuleInit(modules, moduleId) {
|
|
567
|
+
if (modules && !Array.isArray(modules) && typeof modules === "object") {
|
|
568
|
+
const normalizedId = NUMERIC_MODULE_ID_RE.test(moduleId) ? Number(moduleId) : moduleId;
|
|
569
|
+
if (normalizedId in modules) {
|
|
570
|
+
return modules[normalizedId];
|
|
571
|
+
}
|
|
572
|
+
if (typeof normalizedId === "number" && String(normalizedId) in modules) {
|
|
573
|
+
return modules[String(normalizedId)];
|
|
574
|
+
}
|
|
575
|
+
const matchingKey = Object.keys(modules).find(
|
|
576
|
+
(key) => typeof key === "string" && key.includes(String(moduleId))
|
|
577
|
+
);
|
|
578
|
+
if (matchingKey) {
|
|
579
|
+
return modules[matchingKey];
|
|
580
|
+
}
|
|
581
|
+
logError("TurbopackModule", `No match found for module ID: ${moduleId}`);
|
|
582
|
+
return void 0;
|
|
583
|
+
}
|
|
489
584
|
const allModules = modules?.flat() ?? [];
|
|
490
585
|
if (typeof allModules[1] === "string" || typeof allModules[1] === "number") {
|
|
491
|
-
const normalizedId =
|
|
586
|
+
const normalizedId = NUMERIC_MODULE_ID_RE.test(moduleId) ? Number(moduleId) : moduleId;
|
|
492
587
|
let moduleIdIndex = allModules.indexOf(normalizedId);
|
|
493
588
|
if (moduleIdIndex === -1) {
|
|
494
589
|
moduleIdIndex = allModules.findIndex(
|
|
@@ -656,20 +751,9 @@ function createTurbopackContext(bundle, exports, moduleExports, allModules, modu
|
|
|
656
751
|
var init_turbopack_module = __esm({
|
|
657
752
|
"src/shared/client/turbopack-module.ts"() {
|
|
658
753
|
"use strict";
|
|
754
|
+
init_logger();
|
|
659
755
|
init_const();
|
|
660
|
-
|
|
661
|
-
});
|
|
662
|
-
|
|
663
|
-
// src/shared/client/turbopack-patterns.ts
|
|
664
|
-
var REMOTE_SHARED_MARKER_RE, REMOTE_SHARED_ASSIGNMENT_RE, ASYNC_MODULE_LOADER_RE, ASYNC_MODULE_RESOLVE_RE, ASYNC_MODULE_ALL_RE;
|
|
665
|
-
var init_turbopack_patterns = __esm({
|
|
666
|
-
"src/shared/client/turbopack-patterns.ts"() {
|
|
667
|
-
"use strict";
|
|
668
|
-
REMOTE_SHARED_MARKER_RE = /(?:self|[a-z])\.TURBOPACK_REMOTE_SHARED/;
|
|
669
|
-
REMOTE_SHARED_ASSIGNMENT_RE = /\.TURBOPACK_REMOTE_SHARED=await (?:__turbopack_context__|e)\.A\((?<sharedModuleId>[0-9]+)\)/;
|
|
670
|
-
ASYNC_MODULE_LOADER_RE = /(?:__turbopack_context__|e)\.A\((?<asyncSharedModuleId>[0-9]+)\)/;
|
|
671
|
-
ASYNC_MODULE_RESOLVE_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<inner>parentImport|e)=>Promise\.resolve\(\)\.then\(\(\)=>\k<inner>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
|
|
672
|
-
ASYNC_MODULE_ALL_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<vCb>parentImport|t)=>Promise\.all\(\["[^"]+"\]\.map\((?<mapCb>chunk|t)=>\k<ctx>\.l\(\k<mapCb>\)\)\)\.then\(\(\)=>\k<vCb>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
|
|
756
|
+
init_turbopack_patterns();
|
|
673
757
|
}
|
|
674
758
|
});
|
|
675
759
|
|
|
@@ -681,10 +765,14 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
681
765
|
self.__remote_shared_modules__[bundle] = {};
|
|
682
766
|
}
|
|
683
767
|
const bundleKey = getBundleKey(bundle);
|
|
684
|
-
|
|
768
|
+
let modules = self[`TURBOPACK_${bundleKey}`];
|
|
769
|
+
if (modules && typeof modules === "object" && "__chunks__" in modules) {
|
|
770
|
+
const chunks = modules.__chunks__;
|
|
771
|
+
modules = chunks.flat();
|
|
772
|
+
}
|
|
685
773
|
let sharedModuleInitializer = null;
|
|
686
|
-
if (modules
|
|
687
|
-
const allModules = modules.flat();
|
|
774
|
+
if (modules) {
|
|
775
|
+
const allModules = Array.isArray(modules) ? modules.flat() : Object.entries(modules).flat();
|
|
688
776
|
const sharedModuleInitializerIndex = allModules.findIndex((idOrFunc) => {
|
|
689
777
|
if (typeof idOrFunc !== "function") {
|
|
690
778
|
return false;
|
|
@@ -717,6 +805,11 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
717
805
|
if (self.__remote_shared_modules__?.[bundle]) {
|
|
718
806
|
if (hostShared[module2]) {
|
|
719
807
|
self.__remote_shared_modules__[bundle][id] = await hostShared[module2](bundle);
|
|
808
|
+
} else {
|
|
809
|
+
logError(
|
|
810
|
+
"SharedModules",
|
|
811
|
+
`Host shared module "${module2}" not found for ID ${id}`
|
|
812
|
+
);
|
|
720
813
|
}
|
|
721
814
|
}
|
|
722
815
|
})
|
|
@@ -727,9 +820,13 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
727
820
|
Object.entries(remoteShared).map(async ([id, module2]) => {
|
|
728
821
|
if (self.__remote_shared_modules__?.[bundle]) {
|
|
729
822
|
if (hostShared[module2]) {
|
|
730
|
-
|
|
823
|
+
const normalizedId = id.replace("[app-ssr]", "[app-client]");
|
|
824
|
+
self.__remote_shared_modules__[bundle][normalizedId] = await hostShared[module2](bundle);
|
|
731
825
|
} else {
|
|
732
|
-
|
|
826
|
+
logError(
|
|
827
|
+
"SharedModules",
|
|
828
|
+
`Shared module "${module2}" not found for "${bundle}"`
|
|
829
|
+
);
|
|
733
830
|
}
|
|
734
831
|
}
|
|
735
832
|
})
|
|
@@ -741,7 +838,15 @@ function extractSharedModuleIds(shared, bundleKey, self) {
|
|
|
741
838
|
if (asyncSharedModuleId) {
|
|
742
839
|
const asyncSharedModuleIdNumber = Number(asyncSharedModuleId);
|
|
743
840
|
let asyncSharedModule;
|
|
744
|
-
|
|
841
|
+
let turbopackModules = self[`TURBOPACK_${bundleKey}`];
|
|
842
|
+
if (turbopackModules && typeof turbopackModules === "object" && "__chunks__" in turbopackModules) {
|
|
843
|
+
const chunks = turbopackModules.__chunks__;
|
|
844
|
+
turbopackModules = chunks.flat();
|
|
845
|
+
}
|
|
846
|
+
const newAllModules = Array.isArray(turbopackModules) ? turbopackModules.flat() : turbopackModules ? Object.entries(turbopackModules).flatMap(([key2, value2]) => [
|
|
847
|
+
key2,
|
|
848
|
+
value2
|
|
849
|
+
]) : [];
|
|
745
850
|
const asyncSharedModuleIdIndex = newAllModules.indexOf(
|
|
746
851
|
asyncSharedModuleIdNumber
|
|
747
852
|
);
|
|
@@ -774,6 +879,7 @@ function getSharedModule(bundle, id) {
|
|
|
774
879
|
var init_shared_modules2 = __esm({
|
|
775
880
|
"src/shared/client/shared-modules.ts"() {
|
|
776
881
|
"use strict";
|
|
882
|
+
init_logger();
|
|
777
883
|
init_const();
|
|
778
884
|
init_turbopack_module();
|
|
779
885
|
init_turbopack_patterns();
|
|
@@ -950,11 +1056,10 @@ async function loadStaticRemoteComponent(scripts, url) {
|
|
|
950
1056
|
unmount: mod.unmount || mod.default?.unmount
|
|
951
1057
|
};
|
|
952
1058
|
} catch (e) {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
)
|
|
1059
|
+
logError(
|
|
1060
|
+
"StaticLoader",
|
|
1061
|
+
`Error loading remote component script from "${script.src || url.href}".`,
|
|
1062
|
+
e
|
|
958
1063
|
);
|
|
959
1064
|
return {
|
|
960
1065
|
mount: void 0,
|
|
@@ -982,7 +1087,7 @@ async function loadStaticRemoteComponent(scripts, url) {
|
|
|
982
1087
|
var init_static_loader = __esm({
|
|
983
1088
|
"src/shared/client/static-loader.ts"() {
|
|
984
1089
|
"use strict";
|
|
985
|
-
|
|
1090
|
+
init_logger();
|
|
986
1091
|
}
|
|
987
1092
|
});
|
|
988
1093
|
|
|
@@ -1049,7 +1154,8 @@ function sharedPolyfills(shared) {
|
|
|
1049
1154
|
...props
|
|
1050
1155
|
}) => {
|
|
1051
1156
|
if (prefetch) {
|
|
1052
|
-
|
|
1157
|
+
logWarn(
|
|
1158
|
+
"Polyfill",
|
|
1053
1159
|
"Next.js Link prefetch is not supported in remote components"
|
|
1054
1160
|
);
|
|
1055
1161
|
}
|
|
@@ -1152,6 +1258,7 @@ var import_jsx_runtime, imageImpl;
|
|
|
1152
1258
|
var init_polyfill = __esm({
|
|
1153
1259
|
"src/shared/client/polyfill.tsx"() {
|
|
1154
1260
|
"use strict";
|
|
1261
|
+
init_utils();
|
|
1155
1262
|
// eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
|
|
1156
1263
|
import_jsx_runtime = require("react/jsx-runtime");
|
|
1157
1264
|
imageImpl = (bundle) => function RemoteImage({
|
|
@@ -1623,7 +1730,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1623
1730
|
if ((name === "src" || name === "name") && oldValue !== newValue) {
|
|
1624
1731
|
if (this.getAttribute("src")) {
|
|
1625
1732
|
this.load().catch((e) => {
|
|
1626
|
-
|
|
1733
|
+
logError("HtmlHost", "Error loading remote component.", e);
|
|
1627
1734
|
const errorEvent = new Event("error", {
|
|
1628
1735
|
bubbles: true,
|
|
1629
1736
|
composed: true
|
|
@@ -1645,7 +1752,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1645
1752
|
});
|
|
1646
1753
|
this.root = newRoot;
|
|
1647
1754
|
this.load().catch((e) => {
|
|
1648
|
-
|
|
1755
|
+
logError("HtmlHost", "Error reloading remote component.", e);
|
|
1649
1756
|
const errorEvent = new Event("error", {
|
|
1650
1757
|
bubbles: true,
|
|
1651
1758
|
composed: true
|
|
@@ -1678,7 +1785,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1678
1785
|
this.bundle = "default";
|
|
1679
1786
|
if (this.hasAttribute("src") || this.querySelector("div#__REMOTE_COMPONENT__") || this.hasAttribute("data-ssr")) {
|
|
1680
1787
|
this.load().catch((e) => {
|
|
1681
|
-
|
|
1788
|
+
logError("HtmlHost", "Error loading remote component.", e);
|
|
1682
1789
|
const errorEvent = new Event("error", {
|
|
1683
1790
|
bubbles: true,
|
|
1684
1791
|
composed: true
|
|
@@ -1820,11 +1927,10 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1820
1927
|
try {
|
|
1821
1928
|
await unmount(this.root);
|
|
1822
1929
|
} catch (e) {
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
)
|
|
1930
|
+
logError(
|
|
1931
|
+
"HtmlHost",
|
|
1932
|
+
`Error while calling unmount() for Remote Component from ${prevUrl.href}.`,
|
|
1933
|
+
e
|
|
1828
1934
|
);
|
|
1829
1935
|
}
|
|
1830
1936
|
})
|
|
@@ -2066,7 +2172,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2066
2172
|
applyReset();
|
|
2067
2173
|
if (!initial) {
|
|
2068
2174
|
attachLinks().catch((e) => {
|
|
2069
|
-
|
|
2175
|
+
logError("HtmlHost", "Error attaching links.", e);
|
|
2070
2176
|
});
|
|
2071
2177
|
}
|
|
2072
2178
|
this.isLoading = false;
|
|
@@ -2119,7 +2225,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2119
2225
|
if (!initial) {
|
|
2120
2226
|
applyReset();
|
|
2121
2227
|
attachLinks().catch((e) => {
|
|
2122
|
-
|
|
2228
|
+
logError("HtmlHost", "Error attaching links.", e);
|
|
2123
2229
|
});
|
|
2124
2230
|
}
|
|
2125
2231
|
remoteComponent.isLoading = false;
|
|
@@ -2161,11 +2267,10 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2161
2267
|
try {
|
|
2162
2268
|
await mount(this.root);
|
|
2163
2269
|
} catch (e) {
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
)
|
|
2270
|
+
logError(
|
|
2271
|
+
"HtmlHost",
|
|
2272
|
+
`Error while calling mount() for Remote Component from ${url.href}.`,
|
|
2273
|
+
e
|
|
2169
2274
|
);
|
|
2170
2275
|
}
|
|
2171
2276
|
})
|