remote-components 0.0.40 → 0.0.42
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 +429 -312
- package/dist/html/host.cjs.map +1 -1
- package/dist/html/host.js +429 -312
- package/dist/html/host.js.map +1 -1
- package/dist/html/remote.cjs.map +1 -1
- package/dist/html/remote.js.map +1 -1
- package/dist/internal/shared/client/remote-component.cjs +404 -304
- package/dist/internal/shared/client/remote-component.cjs.map +1 -1
- package/dist/internal/shared/client/remote-component.d.ts +10 -1
- package/dist/internal/shared/client/remote-component.js +404 -304
- package/dist/internal/shared/client/remote-component.js.map +1 -1
- package/dist/internal/shared/error.cjs +4 -4
- package/dist/internal/shared/error.cjs.map +1 -1
- package/dist/internal/shared/error.d.ts +5 -2
- package/dist/internal/shared/error.js +4 -4
- package/dist/internal/shared/error.js.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.cjs +22 -7
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.js +22 -7
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -1
- package/dist/internal/webpack/shared-modules.cjs +36 -1
- package/dist/internal/webpack/shared-modules.cjs.map +1 -1
- package/dist/internal/webpack/shared-modules.js +36 -1
- package/dist/internal/webpack/shared-modules.js.map +1 -1
- package/dist/next/host/client/index.cjs +415 -314
- package/dist/next/host/client/index.cjs.map +1 -1
- package/dist/next/host/client/index.js +415 -314
- package/dist/next/host/client/index.js.map +1 -1
- package/dist/react/index.cjs +7 -6
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +7 -6
- package/dist/react/index.js.map +1 -1
- package/package.json +6 -8
package/dist/html/host.cjs
CHANGED
|
@@ -32,14 +32,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
|
|
33
33
|
// src/shared/error.ts
|
|
34
34
|
function multipleRemoteComponentsError(url) {
|
|
35
|
-
return new
|
|
35
|
+
return new RemoteComponentsError(
|
|
36
36
|
`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.`
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
function failedToFetchRemoteComponentError(url,
|
|
39
|
+
function failedToFetchRemoteComponentError(url, { status, statusText }, help = "Is the URL correct and accessible?") {
|
|
40
40
|
return new RemoteComponentsError(
|
|
41
|
-
`Failed to fetch Remote Component from "${url}".
|
|
42
|
-
{ cause:
|
|
41
|
+
`Failed to fetch Remote Component from "${url}". ${help}`,
|
|
42
|
+
{ cause: new Error(`${status} ${statusText}`) }
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
var RemoteComponentsError;
|
|
@@ -56,6 +56,24 @@ var init_error = __esm({
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
// src/shared/utils/logger.ts
|
|
60
|
+
function logDebug(location2, message) {
|
|
61
|
+
if (DEBUG) {
|
|
62
|
+
console.debug(`[${PREFIX}:${location2}]: ${message}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function logWarn(location2, message) {
|
|
66
|
+
console.warn(`[${PREFIX}:${location2}]: ${message}`);
|
|
67
|
+
}
|
|
68
|
+
var PREFIX, DEBUG;
|
|
69
|
+
var init_logger = __esm({
|
|
70
|
+
"src/shared/utils/logger.ts"() {
|
|
71
|
+
"use strict";
|
|
72
|
+
PREFIX = "remote-components";
|
|
73
|
+
DEBUG = typeof window !== "undefined" && localStorage.getItem("RC_DEBUG") === "true";
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
59
77
|
// src/shared/webpack/next-client-pages-loader.ts
|
|
60
78
|
function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
61
79
|
const self = globalThis;
|
|
@@ -176,33 +194,68 @@ var init_next_client_pages_loader = __esm({
|
|
|
176
194
|
|
|
177
195
|
// src/shared/webpack/shared-modules.ts
|
|
178
196
|
function applySharedModules(bundle, resolve) {
|
|
197
|
+
logDebug(
|
|
198
|
+
"SharedModules",
|
|
199
|
+
`applySharedModules called for bundle: "${bundle}"`
|
|
200
|
+
);
|
|
201
|
+
logDebug(
|
|
202
|
+
"SharedModules",
|
|
203
|
+
`Shared modules to resolve: ${Object.keys(resolve)}`
|
|
204
|
+
);
|
|
179
205
|
const self = globalThis;
|
|
180
206
|
if (self.__remote_webpack_require__?.[bundle]) {
|
|
181
207
|
const modulePaths = Object.keys(
|
|
182
208
|
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
183
209
|
);
|
|
210
|
+
logDebug(
|
|
211
|
+
"SharedModules",
|
|
212
|
+
`Available module paths in __remote_webpack_require__[${bundle}]: ${modulePaths}`
|
|
213
|
+
);
|
|
184
214
|
for (const [key, value] of Object.entries(resolve)) {
|
|
185
215
|
let ids = modulePaths.filter((p) => p === key);
|
|
186
216
|
if (ids.length === 0) {
|
|
187
217
|
ids = modulePaths.filter((p) => p.includes(key));
|
|
188
218
|
}
|
|
219
|
+
if (ids.length === 0) {
|
|
220
|
+
logDebug(
|
|
221
|
+
"SharedModules",
|
|
222
|
+
`No matching module path found for shared module "${key}"`
|
|
223
|
+
);
|
|
224
|
+
}
|
|
189
225
|
for (let id of ids) {
|
|
190
226
|
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
191
227
|
if (webpackBundle.m) {
|
|
192
228
|
if (self.__remote_webpack_module_map__?.[bundle]?.[id]) {
|
|
193
|
-
|
|
229
|
+
const mappedId = `${self.__remote_webpack_module_map__[bundle][id]}`;
|
|
230
|
+
logDebug(
|
|
231
|
+
"SharedModules",
|
|
232
|
+
`Mapped module id: "${id}" -> "${mappedId}"`
|
|
233
|
+
);
|
|
234
|
+
id = mappedId;
|
|
194
235
|
}
|
|
195
236
|
webpackBundle.m[id] = (module2) => {
|
|
196
237
|
module2.exports = value;
|
|
197
238
|
};
|
|
239
|
+
} else {
|
|
240
|
+
logWarn(
|
|
241
|
+
"SharedModules",
|
|
242
|
+
`webpackBundle.m is not available for bundle "${bundle}"`
|
|
243
|
+
);
|
|
198
244
|
}
|
|
199
245
|
}
|
|
200
246
|
}
|
|
247
|
+
} else {
|
|
248
|
+
logWarn("SharedModules", `No webpack require found for bundle "${bundle}"`);
|
|
249
|
+
logDebug(
|
|
250
|
+
"SharedModules",
|
|
251
|
+
`Available bundles: ${Object.keys(self.__remote_webpack_require__ ?? {})}`
|
|
252
|
+
);
|
|
201
253
|
}
|
|
202
254
|
}
|
|
203
255
|
var init_shared_modules = __esm({
|
|
204
256
|
"src/shared/webpack/shared-modules.ts"() {
|
|
205
257
|
"use strict";
|
|
258
|
+
init_logger();
|
|
206
259
|
}
|
|
207
260
|
});
|
|
208
261
|
|
|
@@ -231,52 +284,7 @@ var init_const = __esm({
|
|
|
231
284
|
}
|
|
232
285
|
});
|
|
233
286
|
|
|
234
|
-
// src/shared/client/
|
|
235
|
-
async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}) {
|
|
236
|
-
const self = globalThis;
|
|
237
|
-
if (!self.__remote_bundle_url__) {
|
|
238
|
-
self.__remote_bundle_url__ = {};
|
|
239
|
-
}
|
|
240
|
-
self.__remote_bundle_url__[bundle ?? "default"] = url;
|
|
241
|
-
self.__webpack_get_script_filename__ = () => null;
|
|
242
|
-
if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
|
|
243
|
-
if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
|
|
244
|
-
self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
|
|
245
|
-
self.__original_webpack_require__ = self.__webpack_require__;
|
|
246
|
-
}
|
|
247
|
-
self.__webpack_chunk_load__ = createChunkLoader(runtime);
|
|
248
|
-
self.__webpack_require__ = createModuleRequire(runtime);
|
|
249
|
-
self.__webpack_require_type__ = runtime;
|
|
250
|
-
if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {
|
|
251
|
-
const remoteBundle = bundle ?? "default";
|
|
252
|
-
self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
|
|
253
|
-
self.__remote_webpack_require__[remoteBundle].type = "turbopack";
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
if (runtime === RUNTIME_TURBOPACK) {
|
|
257
|
-
await Promise.all(
|
|
258
|
-
scripts.map((script) => {
|
|
259
|
-
if (script.src) {
|
|
260
|
-
return self.__webpack_chunk_load__?.(script.src, bundle);
|
|
261
|
-
}
|
|
262
|
-
return Promise.resolve(void 0);
|
|
263
|
-
})
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
await initializeSharedModules(
|
|
267
|
-
bundle ?? "default",
|
|
268
|
-
// include all core modules as shared
|
|
269
|
-
{
|
|
270
|
-
react: async () => (await import("react")).default,
|
|
271
|
-
"react-dom": async () => (await import("react-dom")).default,
|
|
272
|
-
"react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
|
|
273
|
-
"react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
|
|
274
|
-
"react-dom/client": async () => (await import("react-dom/client")).default,
|
|
275
|
-
...shared
|
|
276
|
-
},
|
|
277
|
-
remoteShared
|
|
278
|
-
);
|
|
279
|
-
}
|
|
287
|
+
// src/shared/client/chunk-loader.ts
|
|
280
288
|
function createChunkLoader(runtime) {
|
|
281
289
|
return function __turbopack_chunk_load__(chunkId, scriptBundle) {
|
|
282
290
|
const self = globalThis;
|
|
@@ -391,46 +399,251 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
391
399
|
await Promise.all(loadChunkLists);
|
|
392
400
|
}
|
|
393
401
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
var init_chunk_loader = __esm({
|
|
403
|
+
"src/shared/client/chunk-loader.ts"() {
|
|
404
|
+
"use strict";
|
|
405
|
+
init_error();
|
|
406
|
+
init_const();
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// src/shared/client/turbopack-module.ts
|
|
411
|
+
function handleTurbopackModule(bundle, moduleId, id) {
|
|
412
|
+
const self = globalThis;
|
|
413
|
+
const bundleKey = getBundleKey(bundle);
|
|
414
|
+
const modules = self[`TURBOPACK_${bundleKey}`];
|
|
415
|
+
const moduleInit = findModuleInit(modules, moduleId);
|
|
416
|
+
const exports = {};
|
|
417
|
+
const moduleExports = { exports };
|
|
418
|
+
if (!self.__remote_components_turbopack_modules__) {
|
|
419
|
+
self.__remote_components_turbopack_modules__ = {};
|
|
420
|
+
}
|
|
421
|
+
if (!self.__remote_components_turbopack_modules__[bundle]) {
|
|
422
|
+
self.__remote_components_turbopack_modules__[bundle] = {};
|
|
423
|
+
}
|
|
424
|
+
if (self.__remote_components_turbopack_modules__[bundle][moduleId]) {
|
|
425
|
+
return self.__remote_components_turbopack_modules__[bundle][moduleId];
|
|
426
|
+
}
|
|
427
|
+
if (typeof moduleInit !== "function") {
|
|
428
|
+
throw new Error(
|
|
429
|
+
`Module ${id} not found in bundle ${bundle} with id ${moduleId}`
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
|
|
433
|
+
if (!self.__remote_components_turbopack_global__) {
|
|
434
|
+
self.__remote_components_turbopack_global__ = {};
|
|
435
|
+
}
|
|
436
|
+
if (!self.__remote_components_turbopack_global__[bundle]) {
|
|
437
|
+
self.__remote_components_turbopack_global__[bundle] = {};
|
|
438
|
+
}
|
|
439
|
+
const allModules = modules?.flat() ?? [];
|
|
440
|
+
moduleInit(
|
|
441
|
+
createTurbopackContext(
|
|
442
|
+
bundle,
|
|
443
|
+
exports,
|
|
444
|
+
moduleExports,
|
|
445
|
+
allModules,
|
|
446
|
+
moduleInit,
|
|
447
|
+
id,
|
|
448
|
+
self
|
|
449
|
+
),
|
|
450
|
+
moduleExports,
|
|
451
|
+
exports
|
|
452
|
+
);
|
|
453
|
+
if (self.__remote_components_turbopack_modules__[bundle][moduleId] !== moduleExports.exports) {
|
|
454
|
+
self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
|
|
455
|
+
}
|
|
456
|
+
return moduleExports.exports;
|
|
457
|
+
}
|
|
458
|
+
function findModuleInit(modules, moduleId) {
|
|
459
|
+
const allModules = modules?.flat() ?? [];
|
|
460
|
+
if (typeof allModules[1] === "string" || typeof allModules[1] === "number") {
|
|
461
|
+
const normalizedId = /^[0-9]+$/.test(moduleId) ? Number(moduleId) : moduleId;
|
|
462
|
+
let moduleIdIndex = allModules.indexOf(normalizedId);
|
|
463
|
+
if (moduleIdIndex === -1) {
|
|
464
|
+
moduleIdIndex = allModules.findIndex(
|
|
465
|
+
(bundleEntry) => typeof bundleEntry === "string" && bundleEntry.startsWith(moduleId) || bundleEntry === normalizedId
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
if (moduleIdIndex !== -1) {
|
|
469
|
+
while (typeof allModules[moduleIdIndex] !== "function" && moduleIdIndex < allModules.length) {
|
|
470
|
+
moduleIdIndex++;
|
|
405
471
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
472
|
+
return allModules[moduleIdIndex];
|
|
473
|
+
}
|
|
474
|
+
} else {
|
|
475
|
+
return allModules.find(
|
|
476
|
+
(bundleEntry) => typeof bundleEntry === "object" && bundleEntry !== null && moduleId in bundleEntry
|
|
477
|
+
)?.[moduleId];
|
|
478
|
+
}
|
|
479
|
+
return void 0;
|
|
480
|
+
}
|
|
481
|
+
function createTurbopackContext(bundle, exports, moduleExports, allModules, moduleInit, id, self) {
|
|
482
|
+
return {
|
|
483
|
+
// HMR not implemented for Remote Components
|
|
484
|
+
k: {
|
|
485
|
+
register() {
|
|
486
|
+
},
|
|
487
|
+
registerExports() {
|
|
488
|
+
},
|
|
489
|
+
signature() {
|
|
490
|
+
return (fn) => fn;
|
|
409
491
|
}
|
|
410
|
-
|
|
411
|
-
|
|
492
|
+
},
|
|
493
|
+
// ESM exports setup
|
|
494
|
+
s(bindings, esmId) {
|
|
495
|
+
let mod = exports;
|
|
496
|
+
if (typeof esmId === "string" || typeof esmId === "number") {
|
|
497
|
+
if (!self.__remote_components_turbopack_modules__) {
|
|
498
|
+
self.__remote_components_turbopack_modules__ = {};
|
|
499
|
+
}
|
|
500
|
+
if (!self.__remote_components_turbopack_modules__[bundle]) {
|
|
501
|
+
self.__remote_components_turbopack_modules__[bundle] = {};
|
|
502
|
+
}
|
|
503
|
+
if (!self.__remote_components_turbopack_modules__[bundle][esmId]) {
|
|
504
|
+
self.__remote_components_turbopack_modules__[bundle][esmId] = {};
|
|
505
|
+
}
|
|
506
|
+
mod = self.__remote_components_turbopack_modules__[bundle][esmId];
|
|
412
507
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
508
|
+
Object.defineProperty(mod, "__esModule", { value: true });
|
|
509
|
+
if (Array.isArray(bindings)) {
|
|
510
|
+
let i = 0;
|
|
511
|
+
while (i < bindings.length) {
|
|
512
|
+
const propName = bindings[i++];
|
|
513
|
+
const tagOrFunc = bindings[i++];
|
|
514
|
+
if (typeof tagOrFunc === "number") {
|
|
515
|
+
Object.defineProperty(mod, propName, {
|
|
516
|
+
value: bindings[i++],
|
|
517
|
+
enumerable: true,
|
|
518
|
+
writable: false
|
|
519
|
+
});
|
|
520
|
+
} else {
|
|
521
|
+
const getterFn = tagOrFunc;
|
|
522
|
+
if (typeof bindings[i] === "function") {
|
|
523
|
+
const setterFn = bindings[i++];
|
|
524
|
+
Object.defineProperty(mod, propName, {
|
|
525
|
+
get: getterFn,
|
|
526
|
+
set: setterFn,
|
|
527
|
+
enumerable: true
|
|
528
|
+
});
|
|
529
|
+
} else {
|
|
530
|
+
Object.defineProperty(mod, propName, {
|
|
531
|
+
get: getterFn,
|
|
532
|
+
enumerable: true
|
|
533
|
+
});
|
|
534
|
+
}
|
|
420
535
|
}
|
|
421
|
-
|
|
536
|
+
}
|
|
422
537
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
538
|
+
},
|
|
539
|
+
// import
|
|
540
|
+
i(importId) {
|
|
541
|
+
let mod;
|
|
542
|
+
if (typeof importId === "string") {
|
|
543
|
+
const { exportSource, exportName } = /\s+<export (?<exportSource>.*?) as (?<exportName>.*?)>$/.exec(
|
|
544
|
+
importId
|
|
545
|
+
)?.groups ?? {};
|
|
546
|
+
const normalizedId = importId.replace(
|
|
547
|
+
/\s+<export(?<specifier>.*)>$/,
|
|
548
|
+
""
|
|
429
549
|
);
|
|
550
|
+
mod = self.__webpack_require__?.(`[${bundle}] ${normalizedId}`);
|
|
551
|
+
if (mod && exportSource && exportName && (exportSource === "*" || typeof mod[exportSource] !== "undefined") && typeof mod[exportName] === "undefined") {
|
|
552
|
+
if (exportSource === "*") {
|
|
553
|
+
mod[exportName] = mod;
|
|
554
|
+
} else {
|
|
555
|
+
mod[exportName] = mod[exportSource];
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
} else {
|
|
559
|
+
mod = self.__webpack_require__?.(`[${bundle}] ${importId}`);
|
|
430
560
|
}
|
|
431
|
-
|
|
561
|
+
if (typeof mod !== "object" || mod === null) {
|
|
562
|
+
mod = { default: mod };
|
|
563
|
+
} else if (!("default" in mod) && mod.toString() !== "[object Module]") {
|
|
564
|
+
try {
|
|
565
|
+
mod.default = mod;
|
|
566
|
+
} catch {
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
return mod;
|
|
570
|
+
},
|
|
571
|
+
// require
|
|
572
|
+
r(requireId) {
|
|
573
|
+
return self.__webpack_require__?.(`[${bundle}] ${requireId}`);
|
|
574
|
+
},
|
|
575
|
+
// value exports
|
|
576
|
+
v(value) {
|
|
577
|
+
if (typeof value === "function") {
|
|
578
|
+
exports.default = value((vid) => {
|
|
579
|
+
return self.__webpack_require__?.(`[${bundle}] ${vid}`);
|
|
580
|
+
});
|
|
581
|
+
} else {
|
|
582
|
+
moduleExports.exports = value;
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
// async module initializer
|
|
586
|
+
async a(mod) {
|
|
587
|
+
let result;
|
|
588
|
+
await mod(
|
|
589
|
+
() => {
|
|
590
|
+
},
|
|
591
|
+
(value) => result = value
|
|
592
|
+
);
|
|
593
|
+
exports.default = result;
|
|
594
|
+
},
|
|
595
|
+
// async module loader
|
|
596
|
+
async A(Aid) {
|
|
597
|
+
const mod = self.__webpack_require__?.(`[${bundle}] ${Aid}`);
|
|
598
|
+
return mod.default(
|
|
599
|
+
(parentId) => self.__webpack_require__?.(`[${bundle}] ${parentId}`)
|
|
600
|
+
);
|
|
601
|
+
},
|
|
602
|
+
// chunk loader
|
|
603
|
+
l(url) {
|
|
604
|
+
const moduleInitIndex = allModules.indexOf(moduleInit);
|
|
605
|
+
if (moduleInitIndex !== -1) {
|
|
606
|
+
const scriptIndex = allModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
|
|
607
|
+
if (scriptIndex !== -1) {
|
|
608
|
+
const script = allModules[scriptIndex];
|
|
609
|
+
const scriptSrc = script.getAttribute("data-turbopack-src") || "";
|
|
610
|
+
const nextIndex = scriptSrc.indexOf("/_next");
|
|
611
|
+
const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
|
|
612
|
+
const bundleUrl = `[${bundle}] ${baseUrl}/_next/${url}`;
|
|
613
|
+
return self.__webpack_chunk_load__?.(bundleUrl, bundle);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
throw new Error(
|
|
617
|
+
`Failed to load Turbopack chunk "${url}" for module "${id}". Check the URL is correct.`
|
|
618
|
+
);
|
|
619
|
+
},
|
|
620
|
+
// global object for this bundle
|
|
621
|
+
g: self.__remote_components_turbopack_global__?.[bundle],
|
|
622
|
+
m: moduleExports,
|
|
623
|
+
e: exports
|
|
432
624
|
};
|
|
433
625
|
}
|
|
626
|
+
var init_turbopack_module = __esm({
|
|
627
|
+
"src/shared/client/turbopack-module.ts"() {
|
|
628
|
+
"use strict";
|
|
629
|
+
init_const();
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
// src/shared/client/turbopack-patterns.ts
|
|
634
|
+
var REMOTE_SHARED_MARKER_RE, REMOTE_SHARED_ASSIGNMENT_RE, ASYNC_MODULE_LOADER_RE, ASYNC_MODULE_RESOLVE_RE, ASYNC_MODULE_ALL_RE;
|
|
635
|
+
var init_turbopack_patterns = __esm({
|
|
636
|
+
"src/shared/client/turbopack-patterns.ts"() {
|
|
637
|
+
"use strict";
|
|
638
|
+
REMOTE_SHARED_MARKER_RE = /(?:self|[a-z])\.TURBOPACK_REMOTE_SHARED/;
|
|
639
|
+
REMOTE_SHARED_ASSIGNMENT_RE = /\.TURBOPACK_REMOTE_SHARED=await (?:__turbopack_context__|e)\.A\((?<sharedModuleId>[0-9]+)\)/;
|
|
640
|
+
ASYNC_MODULE_LOADER_RE = /(?:__turbopack_context__|e)\.A\((?<asyncSharedModuleId>[0-9]+)\)/;
|
|
641
|
+
ASYNC_MODULE_RESOLVE_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<inner>parentImport|e)=>Promise\.resolve\(\)\.then\(\(\)=>\k<inner>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
|
|
642
|
+
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]+)\)\)\)\}/;
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
// src/shared/client/shared-modules.ts
|
|
434
647
|
async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {}) {
|
|
435
648
|
const self = globalThis;
|
|
436
649
|
self.__remote_shared_modules__ = self.__remote_shared_modules__ ?? {};
|
|
@@ -447,14 +660,12 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
447
660
|
return false;
|
|
448
661
|
}
|
|
449
662
|
const funcCode = idOrFunc.toString();
|
|
450
|
-
return
|
|
663
|
+
return REMOTE_SHARED_MARKER_RE.test(funcCode);
|
|
451
664
|
});
|
|
452
665
|
if (sharedModuleInitializerIndex > 0) {
|
|
453
666
|
const sharedModuleInitializerCode = allModules[sharedModuleInitializerIndex].toString();
|
|
454
667
|
const sharedModuleInitializerId = allModules[sharedModuleInitializerIndex - 1];
|
|
455
|
-
const { sharedModuleId } =
|
|
456
|
-
sharedModuleInitializerCode
|
|
457
|
-
)?.groups ?? {};
|
|
668
|
+
const { sharedModuleId } = REMOTE_SHARED_ASSIGNMENT_RE.exec(sharedModuleInitializerCode)?.groups ?? {};
|
|
458
669
|
if (sharedModuleId) {
|
|
459
670
|
const { default: sharedModuleInitializerInstance } = handleTurbopackModule(
|
|
460
671
|
bundle,
|
|
@@ -466,33 +677,11 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
466
677
|
}
|
|
467
678
|
if (sharedModuleInitializer) {
|
|
468
679
|
const { shared } = await sharedModuleInitializer;
|
|
469
|
-
const sharedModuleIds =
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
const newAllModules = self[`TURBOPACK_${bundleKey}`]?.flat() ?? [];
|
|
475
|
-
const asyncSharedModuleIdIndex = newAllModules.indexOf(
|
|
476
|
-
asyncSharedModuleIdNumber
|
|
477
|
-
);
|
|
478
|
-
if (asyncSharedModuleIdIndex !== -1 && typeof newAllModules[asyncSharedModuleIdIndex + 1] === "function") {
|
|
479
|
-
asyncSharedModule = newAllModules[asyncSharedModuleIdIndex + 1];
|
|
480
|
-
}
|
|
481
|
-
if (asyncSharedModule) {
|
|
482
|
-
const asyncSharedModuleCode = asyncSharedModule.toString();
|
|
483
|
-
const { sharedModuleId } = /e=>{e\.v\(e=>Promise\.resolve\(\)\.then\(\(\)=>e\((?<sharedModuleId>[0-9]+)\)\)\)}/.exec(
|
|
484
|
-
asyncSharedModuleCode
|
|
485
|
-
)?.groups ?? /e=>{e\.v\(t=>Promise\.all\(\["[^"]+"\].map\(t=>e\.l\(t\)\)\)\.then\(\(\)=>t\((?<sharedModuleId>[0-9]+)\)\)\)}/.exec(
|
|
486
|
-
asyncSharedModuleCode
|
|
487
|
-
)?.groups ?? {};
|
|
488
|
-
acc[sharedModuleId ?? asyncSharedModuleId] = key.replace(
|
|
489
|
-
"__remote_shared_module_",
|
|
490
|
-
""
|
|
491
|
-
);
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
return acc;
|
|
495
|
-
}, {});
|
|
680
|
+
const sharedModuleIds = extractSharedModuleIds(
|
|
681
|
+
shared,
|
|
682
|
+
bundleKey,
|
|
683
|
+
self
|
|
684
|
+
);
|
|
496
685
|
return Promise.all(
|
|
497
686
|
Object.entries(sharedModuleIds).map(async ([id, module2]) => {
|
|
498
687
|
if (self.__remote_shared_modules__?.[bundle]) {
|
|
@@ -516,6 +705,31 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
516
705
|
})
|
|
517
706
|
);
|
|
518
707
|
}
|
|
708
|
+
function extractSharedModuleIds(shared, bundleKey, self) {
|
|
709
|
+
return Object.entries(shared).filter(([, value]) => typeof value === "function").reduce((acc, [key, value]) => {
|
|
710
|
+
const { asyncSharedModuleId } = ASYNC_MODULE_LOADER_RE.exec(value.toString())?.groups ?? {};
|
|
711
|
+
if (asyncSharedModuleId) {
|
|
712
|
+
const asyncSharedModuleIdNumber = Number(asyncSharedModuleId);
|
|
713
|
+
let asyncSharedModule;
|
|
714
|
+
const newAllModules = self[`TURBOPACK_${bundleKey}`]?.flat() ?? [];
|
|
715
|
+
const asyncSharedModuleIdIndex = newAllModules.indexOf(
|
|
716
|
+
asyncSharedModuleIdNumber
|
|
717
|
+
);
|
|
718
|
+
if (asyncSharedModuleIdIndex !== -1 && typeof newAllModules[asyncSharedModuleIdIndex + 1] === "function") {
|
|
719
|
+
asyncSharedModule = newAllModules[asyncSharedModuleIdIndex + 1];
|
|
720
|
+
}
|
|
721
|
+
if (asyncSharedModule) {
|
|
722
|
+
const asyncSharedModuleCode = asyncSharedModule.toString();
|
|
723
|
+
const { sharedModuleId } = ASYNC_MODULE_RESOLVE_RE.exec(asyncSharedModuleCode)?.groups ?? ASYNC_MODULE_ALL_RE.exec(asyncSharedModuleCode)?.groups ?? {};
|
|
724
|
+
acc[sharedModuleId ?? asyncSharedModuleId] = key.replace(
|
|
725
|
+
"__remote_shared_module_",
|
|
726
|
+
""
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return acc;
|
|
731
|
+
}, {});
|
|
732
|
+
}
|
|
519
733
|
function getSharedModule(bundle, id) {
|
|
520
734
|
const self = globalThis;
|
|
521
735
|
for (const [key, value] of Object.entries(
|
|
@@ -527,216 +741,118 @@ function getSharedModule(bundle, id) {
|
|
|
527
741
|
}
|
|
528
742
|
return null;
|
|
529
743
|
}
|
|
530
|
-
|
|
744
|
+
var init_shared_modules2 = __esm({
|
|
745
|
+
"src/shared/client/shared-modules.ts"() {
|
|
746
|
+
"use strict";
|
|
747
|
+
init_const();
|
|
748
|
+
init_turbopack_module();
|
|
749
|
+
init_turbopack_patterns();
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
// src/shared/client/webpack-adapter.ts
|
|
754
|
+
async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}) {
|
|
531
755
|
const self = globalThis;
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
(bundleEntry) => typeof bundleEntry === "string" && bundleEntry.startsWith(moduleId) || bundleEntry === normalizedId
|
|
542
|
-
);
|
|
756
|
+
if (!self.__remote_bundle_url__) {
|
|
757
|
+
self.__remote_bundle_url__ = {};
|
|
758
|
+
}
|
|
759
|
+
self.__remote_bundle_url__[bundle ?? "default"] = url;
|
|
760
|
+
self.__webpack_get_script_filename__ = () => null;
|
|
761
|
+
if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
|
|
762
|
+
if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
|
|
763
|
+
self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
|
|
764
|
+
self.__original_webpack_require__ = self.__webpack_require__;
|
|
543
765
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
766
|
+
self.__webpack_chunk_load__ = createChunkLoader(runtime);
|
|
767
|
+
self.__webpack_require__ = createModuleRequire(runtime);
|
|
768
|
+
self.__webpack_require_type__ = runtime;
|
|
769
|
+
if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {
|
|
770
|
+
const remoteBundle = bundle ?? "default";
|
|
771
|
+
self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
|
|
772
|
+
self.__remote_webpack_require__[remoteBundle].type = "turbopack";
|
|
549
773
|
}
|
|
550
|
-
} else {
|
|
551
|
-
moduleInit = allModules.find(
|
|
552
|
-
(bundleEntry) => typeof bundleEntry === "object" && bundleEntry !== null && moduleId in bundleEntry
|
|
553
|
-
)?.[moduleId];
|
|
554
|
-
}
|
|
555
|
-
const exports = {};
|
|
556
|
-
const moduleExports = { exports };
|
|
557
|
-
if (!self.__remote_components_turbopack_modules__) {
|
|
558
|
-
self.__remote_components_turbopack_modules__ = {};
|
|
559
|
-
}
|
|
560
|
-
if (!self.__remote_components_turbopack_modules__[bundle]) {
|
|
561
|
-
self.__remote_components_turbopack_modules__[bundle] = {};
|
|
562
|
-
}
|
|
563
|
-
if (self.__remote_components_turbopack_modules__[bundle][moduleId]) {
|
|
564
|
-
return self.__remote_components_turbopack_modules__[bundle][moduleId];
|
|
565
774
|
}
|
|
566
|
-
if (
|
|
567
|
-
|
|
568
|
-
|
|
775
|
+
if (runtime === RUNTIME_TURBOPACK) {
|
|
776
|
+
await Promise.all(
|
|
777
|
+
scripts.map((script) => {
|
|
778
|
+
if (script.src) {
|
|
779
|
+
return self.__webpack_chunk_load__?.(script.src, bundle);
|
|
780
|
+
}
|
|
781
|
+
return Promise.resolve(void 0);
|
|
782
|
+
})
|
|
569
783
|
);
|
|
570
784
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
});
|
|
619
|
-
} else {
|
|
620
|
-
const getterFn = tagOrFunc;
|
|
621
|
-
if (typeof bindings[i] === "function") {
|
|
622
|
-
const setterFn = bindings[i++];
|
|
623
|
-
Object.defineProperty(mod, propName, {
|
|
624
|
-
get: getterFn,
|
|
625
|
-
set: setterFn,
|
|
626
|
-
enumerable: true
|
|
627
|
-
});
|
|
628
|
-
} else {
|
|
629
|
-
Object.defineProperty(mod, propName, {
|
|
630
|
-
get: getterFn,
|
|
631
|
-
enumerable: true
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
},
|
|
638
|
-
// import
|
|
639
|
-
i(importId) {
|
|
640
|
-
let mod;
|
|
641
|
-
if (typeof importId === "string") {
|
|
642
|
-
const { exportSource, exportName } = /\s+<export (?<exportSource>.*?) as (?<exportName>.*?)>$/.exec(
|
|
643
|
-
importId
|
|
644
|
-
)?.groups ?? {};
|
|
645
|
-
const normalizedId = importId.replace(
|
|
646
|
-
/\s+<export(?<specifier>.*)>$/,
|
|
647
|
-
""
|
|
648
|
-
);
|
|
649
|
-
mod = self.__webpack_require__?.(
|
|
650
|
-
`[${bundle}] ${normalizedId}`
|
|
651
|
-
);
|
|
652
|
-
if (exportSource && exportName && (exportSource === "*" || typeof mod[exportSource] !== "undefined") && typeof mod[exportName] === "undefined") {
|
|
653
|
-
if (exportSource === "*") {
|
|
654
|
-
mod[exportName] = mod;
|
|
655
|
-
} else {
|
|
656
|
-
mod[exportName] = mod[exportSource];
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
} else {
|
|
660
|
-
mod = self.__webpack_require__?.(`[${bundle}] ${importId}`);
|
|
661
|
-
}
|
|
662
|
-
if (typeof mod !== "object") {
|
|
663
|
-
mod = { default: mod };
|
|
664
|
-
} else if (!("default" in mod) && // eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
665
|
-
mod.toString() !== "[object Module]") {
|
|
666
|
-
try {
|
|
667
|
-
mod.default = mod;
|
|
668
|
-
} catch {
|
|
785
|
+
const coreShared = {
|
|
786
|
+
react: async () => (await import("react")).default,
|
|
787
|
+
"react-dom": async () => (await import("react-dom")).default,
|
|
788
|
+
"react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
|
|
789
|
+
"react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
|
|
790
|
+
"react-dom/client": async () => (await import("react-dom/client")).default,
|
|
791
|
+
...shared
|
|
792
|
+
};
|
|
793
|
+
await initializeSharedModules(
|
|
794
|
+
bundle ?? "default",
|
|
795
|
+
// include all core modules as shared
|
|
796
|
+
coreShared,
|
|
797
|
+
remoteShared
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
function createModuleRequire(runtime) {
|
|
801
|
+
return (id) => {
|
|
802
|
+
const self = globalThis;
|
|
803
|
+
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
804
|
+
bundle: "default",
|
|
805
|
+
id
|
|
806
|
+
};
|
|
807
|
+
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
808
|
+
logDebug("WebpackAdapter", `remoteRuntime: "${remoteRuntime}"`);
|
|
809
|
+
try {
|
|
810
|
+
if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
|
|
811
|
+
return self.__remote_webpack_require__?.[bundle]?.(moduleId);
|
|
812
|
+
}
|
|
813
|
+
const sharedModuleId = moduleId ?? id;
|
|
814
|
+
const sharedModule = getSharedModule(bundle ?? "default", sharedModuleId);
|
|
815
|
+
if (sharedModule) {
|
|
816
|
+
return sharedModule;
|
|
817
|
+
}
|
|
818
|
+
if (bundle && moduleId) {
|
|
819
|
+
return handleTurbopackModule(bundle, moduleId, id);
|
|
820
|
+
}
|
|
821
|
+
throw new Error(`Module "${id}" not found.`);
|
|
822
|
+
} catch (requireError) {
|
|
823
|
+
logWarn(
|
|
824
|
+
"WebpackAdapter",
|
|
825
|
+
`Module require failed: ${String(requireError)}`
|
|
826
|
+
);
|
|
827
|
+
if (typeof self.__original_webpack_require__ !== "function") {
|
|
828
|
+
throw new RemoteComponentsError(
|
|
829
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
830
|
+
{
|
|
831
|
+
cause: requireError instanceof Error ? requireError : void 0
|
|
669
832
|
}
|
|
670
|
-
}
|
|
671
|
-
return mod;
|
|
672
|
-
},
|
|
673
|
-
// require
|
|
674
|
-
r(requireId) {
|
|
675
|
-
return self.__webpack_require__?.(`[${bundle}] ${requireId}`);
|
|
676
|
-
},
|
|
677
|
-
// value exports
|
|
678
|
-
v(value) {
|
|
679
|
-
if (typeof value === "function") {
|
|
680
|
-
exports.default = value((vid) => {
|
|
681
|
-
return self.__webpack_require__?.(`[${bundle}] ${vid}`);
|
|
682
|
-
});
|
|
683
|
-
} else {
|
|
684
|
-
moduleExports.exports = value;
|
|
685
|
-
}
|
|
686
|
-
},
|
|
687
|
-
// async module initializer
|
|
688
|
-
async a(mod) {
|
|
689
|
-
let result;
|
|
690
|
-
await mod(
|
|
691
|
-
() => {
|
|
692
|
-
},
|
|
693
|
-
(value) => result = value
|
|
694
833
|
);
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
},
|
|
704
|
-
// chunk loader
|
|
705
|
-
l(url) {
|
|
706
|
-
const moduleInitIndex = allModules.indexOf(moduleInit);
|
|
707
|
-
if (moduleInitIndex !== -1) {
|
|
708
|
-
const scriptIndex = allModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
|
|
709
|
-
if (scriptIndex !== -1) {
|
|
710
|
-
const script = allModules[scriptIndex];
|
|
711
|
-
const scriptSrc = script.getAttribute("data-turbopack-src") || "";
|
|
712
|
-
const nextIndex = scriptSrc.indexOf("/_next");
|
|
713
|
-
const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
|
|
714
|
-
const bundleUrl = `[${bundle}] ${baseUrl}/_next/${url}`;
|
|
715
|
-
return self.__webpack_chunk_load__?.(bundleUrl, bundle);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
throw new Error(
|
|
719
|
-
`Failed to load Turbopack chunk "${url}" for module "${id}". Check the URL is correct.`
|
|
834
|
+
}
|
|
835
|
+
try {
|
|
836
|
+
logDebug("WebpackAdapter", "Falling back to original webpack require");
|
|
837
|
+
return self.__original_webpack_require__(id);
|
|
838
|
+
} catch (originalError) {
|
|
839
|
+
throw new RemoteComponentsError(
|
|
840
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
841
|
+
{ cause: originalError instanceof Error ? originalError : void 0 }
|
|
720
842
|
);
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
m: moduleExports,
|
|
725
|
-
e: exports
|
|
726
|
-
},
|
|
727
|
-
moduleExports,
|
|
728
|
-
exports
|
|
729
|
-
);
|
|
730
|
-
if (self.__remote_components_turbopack_modules__[bundle][moduleId] !== moduleExports.exports) {
|
|
731
|
-
self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
|
|
732
|
-
}
|
|
733
|
-
return moduleExports.exports;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
};
|
|
734
846
|
}
|
|
735
847
|
var init_webpack_adapter = __esm({
|
|
736
848
|
"src/shared/client/webpack-adapter.ts"() {
|
|
737
849
|
"use strict";
|
|
738
850
|
init_error();
|
|
851
|
+
init_logger();
|
|
852
|
+
init_chunk_loader();
|
|
739
853
|
init_const();
|
|
854
|
+
init_shared_modules2();
|
|
855
|
+
init_turbopack_module();
|
|
740
856
|
}
|
|
741
857
|
});
|
|
742
858
|
|
|
@@ -1309,6 +1425,7 @@ var JSXRuntime = __toESM(require("react/jsx-runtime"), 1);
|
|
|
1309
1425
|
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
1310
1426
|
var ReactDOMClient = __toESM(require("react-dom/client"), 1);
|
|
1311
1427
|
init_error();
|
|
1428
|
+
init_logger();
|
|
1312
1429
|
init_next_client_pages_loader();
|
|
1313
1430
|
init_shared_modules();
|
|
1314
1431
|
|
|
@@ -1568,9 +1685,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1568
1685
|
};
|
|
1569
1686
|
const res = await fetch(url, fetchInit);
|
|
1570
1687
|
if (!res.ok) {
|
|
1571
|
-
let error = failedToFetchRemoteComponentError(url.href,
|
|
1572
|
-
cause: new Error(`${res.status} ${res.statusText}`)
|
|
1573
|
-
});
|
|
1688
|
+
let error = failedToFetchRemoteComponentError(url.href, res);
|
|
1574
1689
|
try {
|
|
1575
1690
|
const body = await res.text();
|
|
1576
1691
|
const parser2 = new DOMParser();
|
|
@@ -1881,7 +1996,9 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1881
1996
|
};
|
|
1882
1997
|
if (rsc) {
|
|
1883
1998
|
rsc.parentElement?.removeChild(rsc);
|
|
1884
|
-
const rscName = `__remote_component_rsc_${escapeString(
|
|
1999
|
+
const rscName = `__remote_component_rsc_${escapeString(
|
|
2000
|
+
url.href
|
|
2001
|
+
)}_${escapeString(this.name)}`;
|
|
1885
2002
|
const rscClone = document.createElement("script");
|
|
1886
2003
|
rscClone.id = `${rscName}_rsc`;
|
|
1887
2004
|
rscClone.textContent = rsc.textContent?.replace(
|