remote-components 0.0.41 → 0.0.43
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 +459 -312
- package/dist/html/host.cjs.map +1 -1
- package/dist/html/host.js +459 -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/next/host/app-router-client.d.ts +30 -3
- package/dist/internal/shared/client/remote-component.cjs +433 -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 +433 -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 +532 -371
- package/dist/next/host/client/index.cjs.map +1 -1
- package/dist/next/host/client/index.d.ts +2 -49
- package/dist/next/host/client/index.js +527 -365
- package/dist/next/host/client/index.js.map +1 -1
- package/dist/react/index.cjs +1562 -84
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +1 -10
- package/dist/react/index.js +1540 -84
- package/dist/react/index.js.map +1 -1
- package/package.json +4 -6
- package/dist/types-235b68a5.d.ts +0 -32
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,54 +284,10 @@ 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) {
|
|
290
|
+
logDebug("ChunkLoader", `Loading chunk: "${chunkId}"`);
|
|
282
291
|
const self = globalThis;
|
|
283
292
|
const {
|
|
284
293
|
bundle,
|
|
@@ -288,8 +297,14 @@ function createChunkLoader(runtime) {
|
|
|
288
297
|
bundle: scriptBundle ?? "",
|
|
289
298
|
id: chunkId
|
|
290
299
|
};
|
|
300
|
+
logDebug(
|
|
301
|
+
"ChunkLoader",
|
|
302
|
+
`Parsed chunk - bundle: "${bundle}", path: "${path}", prefix: "${prefix}"`
|
|
303
|
+
);
|
|
291
304
|
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
305
|
+
logDebug("ChunkLoader", `Remote runtime: "${remoteRuntime}"`);
|
|
292
306
|
if (remoteRuntime === RUNTIME_WEBPACK) {
|
|
307
|
+
logDebug("ChunkLoader", "Skipping chunk load - webpack runtime detected");
|
|
293
308
|
return Promise.resolve(void 0);
|
|
294
309
|
}
|
|
295
310
|
const url = new URL(
|
|
@@ -300,14 +315,17 @@ function createChunkLoader(runtime) {
|
|
|
300
315
|
self.__remote_bundle_url__?.[bundle ?? "default"] ?? new URL(location.origin)
|
|
301
316
|
).href;
|
|
302
317
|
if (url.endsWith(".css")) {
|
|
318
|
+
logDebug("ChunkLoader", `Skipping CSS file: "${url}"`);
|
|
303
319
|
return;
|
|
304
320
|
}
|
|
305
321
|
if (!self.__remote_components_turbopack_chunk_loader_promise__) {
|
|
306
322
|
self.__remote_components_turbopack_chunk_loader_promise__ = {};
|
|
307
323
|
}
|
|
308
324
|
if (self.__remote_components_turbopack_chunk_loader_promise__[url]) {
|
|
325
|
+
logDebug("ChunkLoader", `Returning cached promise for: "${url}"`);
|
|
309
326
|
return self.__remote_components_turbopack_chunk_loader_promise__[url];
|
|
310
327
|
}
|
|
328
|
+
logDebug("ChunkLoader", `Fetching chunk from: "${url}"`);
|
|
311
329
|
self.__remote_components_turbopack_chunk_loader_promise__[url] = new Promise((resolve, reject) => {
|
|
312
330
|
fetch(url).then((res) => res.text()).then((code) => {
|
|
313
331
|
if (code.includes("globalThis.TURBOPACK")) {
|
|
@@ -319,7 +337,12 @@ function createChunkLoader(runtime) {
|
|
|
319
337
|
};
|
|
320
338
|
}
|
|
321
339
|
async function handleTurbopackChunk(code, bundle, url) {
|
|
340
|
+
logDebug(
|
|
341
|
+
"ChunkLoader",
|
|
342
|
+
`Handling Turbopack chunk - bundle: "${bundle}", url: "${url}"`
|
|
343
|
+
);
|
|
322
344
|
if (/importScripts\(\.\.\.self.TURBOPACK_NEXT_CHUNK_URLS/.test(code)) {
|
|
345
|
+
logDebug("ChunkLoader", `Skipping worker chunk: "${url}"`);
|
|
323
346
|
const preloadLinks = document.querySelectorAll(
|
|
324
347
|
`link[rel="preload"][href="${new URL(url).pathname}"]`
|
|
325
348
|
);
|
|
@@ -328,6 +351,7 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
328
351
|
}
|
|
329
352
|
const self = globalThis;
|
|
330
353
|
const bundleKey = getBundleKey(bundle);
|
|
354
|
+
logDebug("ChunkLoader", `Bundle key: "${bundleKey}"`);
|
|
331
355
|
const transformedCode = code.replace(/globalThis\.TURBOPACK/g, `globalThis.TURBOPACK_${bundleKey}`).replace(
|
|
332
356
|
/TURBOPACK_WORKER_LOCATION/g,
|
|
333
357
|
`TURBOPACK_WORKER_LOCATION_${bundleKey}`
|
|
@@ -347,6 +371,7 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
347
371
|
)
|
|
348
372
|
).href}$1$2.js.map`
|
|
349
373
|
);
|
|
374
|
+
logDebug("ChunkLoader", `Creating blob script for: "${url}"`);
|
|
350
375
|
await new Promise((scriptResolve, scriptReject) => {
|
|
351
376
|
const blob = new Blob([transformedCode], {
|
|
352
377
|
type: "application/javascript; charset=UTF-8"
|
|
@@ -373,10 +398,18 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
373
398
|
document.head.appendChild(script);
|
|
374
399
|
});
|
|
375
400
|
const chunkLists = self[`TURBOPACK_${bundleKey}_CHUNK_LISTS`];
|
|
401
|
+
logDebug(
|
|
402
|
+
"ChunkLoader",
|
|
403
|
+
`Processing chunk lists for bundle "${bundle}": ${chunkLists?.length ?? 0} lists`
|
|
404
|
+
);
|
|
376
405
|
const loadChunkLists = [];
|
|
377
406
|
while (chunkLists?.length) {
|
|
378
407
|
const { chunks } = chunkLists.shift() ?? { chunks: [] };
|
|
379
408
|
if (chunks.length > 0) {
|
|
409
|
+
logDebug(
|
|
410
|
+
"ChunkLoader",
|
|
411
|
+
`Loading ${chunks.length} additional chunks for bundle "${bundle}": [${chunks.join(", ")}]`
|
|
412
|
+
);
|
|
380
413
|
chunks.forEach((id) => {
|
|
381
414
|
const chunkLoadResult = self.__webpack_chunk_load__?.(
|
|
382
415
|
`[${bundle}] ${url.slice(0, url.indexOf("/_next"))}/_next/${id}`
|
|
@@ -388,49 +421,259 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
388
421
|
}
|
|
389
422
|
}
|
|
390
423
|
if (loadChunkLists.length > 0) {
|
|
424
|
+
logDebug(
|
|
425
|
+
"ChunkLoader",
|
|
426
|
+
`Waiting for ${loadChunkLists.length} additional chunks to load`
|
|
427
|
+
);
|
|
391
428
|
await Promise.all(loadChunkLists);
|
|
392
429
|
}
|
|
393
430
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
431
|
+
var init_chunk_loader = __esm({
|
|
432
|
+
"src/shared/client/chunk-loader.ts"() {
|
|
433
|
+
"use strict";
|
|
434
|
+
init_error();
|
|
435
|
+
init_logger();
|
|
436
|
+
init_const();
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// src/shared/client/turbopack-module.ts
|
|
441
|
+
function handleTurbopackModule(bundle, moduleId, id) {
|
|
442
|
+
const self = globalThis;
|
|
443
|
+
const bundleKey = getBundleKey(bundle);
|
|
444
|
+
const modules = self[`TURBOPACK_${bundleKey}`];
|
|
445
|
+
const moduleInit = findModuleInit(modules, moduleId);
|
|
446
|
+
const exports = {};
|
|
447
|
+
const moduleExports = { exports };
|
|
448
|
+
if (!self.__remote_components_turbopack_modules__) {
|
|
449
|
+
self.__remote_components_turbopack_modules__ = {};
|
|
450
|
+
}
|
|
451
|
+
if (!self.__remote_components_turbopack_modules__[bundle]) {
|
|
452
|
+
self.__remote_components_turbopack_modules__[bundle] = {};
|
|
453
|
+
}
|
|
454
|
+
if (self.__remote_components_turbopack_modules__[bundle][moduleId]) {
|
|
455
|
+
return self.__remote_components_turbopack_modules__[bundle][moduleId];
|
|
456
|
+
}
|
|
457
|
+
if (typeof moduleInit !== "function") {
|
|
458
|
+
throw new Error(
|
|
459
|
+
`Module ${id} not found in bundle ${bundle} with id ${moduleId}`
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
|
|
463
|
+
if (!self.__remote_components_turbopack_global__) {
|
|
464
|
+
self.__remote_components_turbopack_global__ = {};
|
|
465
|
+
}
|
|
466
|
+
if (!self.__remote_components_turbopack_global__[bundle]) {
|
|
467
|
+
self.__remote_components_turbopack_global__[bundle] = {};
|
|
468
|
+
}
|
|
469
|
+
const allModules = modules?.flat() ?? [];
|
|
470
|
+
moduleInit(
|
|
471
|
+
createTurbopackContext(
|
|
472
|
+
bundle,
|
|
473
|
+
exports,
|
|
474
|
+
moduleExports,
|
|
475
|
+
allModules,
|
|
476
|
+
moduleInit,
|
|
477
|
+
id,
|
|
478
|
+
self
|
|
479
|
+
),
|
|
480
|
+
moduleExports,
|
|
481
|
+
exports
|
|
482
|
+
);
|
|
483
|
+
if (self.__remote_components_turbopack_modules__[bundle][moduleId] !== moduleExports.exports) {
|
|
484
|
+
self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
|
|
485
|
+
}
|
|
486
|
+
return moduleExports.exports;
|
|
487
|
+
}
|
|
488
|
+
function findModuleInit(modules, moduleId) {
|
|
489
|
+
const allModules = modules?.flat() ?? [];
|
|
490
|
+
if (typeof allModules[1] === "string" || typeof allModules[1] === "number") {
|
|
491
|
+
const normalizedId = /^[0-9]+$/.test(moduleId) ? Number(moduleId) : moduleId;
|
|
492
|
+
let moduleIdIndex = allModules.indexOf(normalizedId);
|
|
493
|
+
if (moduleIdIndex === -1) {
|
|
494
|
+
moduleIdIndex = allModules.findIndex(
|
|
495
|
+
(bundleEntry) => typeof bundleEntry === "string" && bundleEntry.startsWith(moduleId) || bundleEntry === normalizedId
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
if (moduleIdIndex !== -1) {
|
|
499
|
+
while (typeof allModules[moduleIdIndex] !== "function" && moduleIdIndex < allModules.length) {
|
|
500
|
+
moduleIdIndex++;
|
|
405
501
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
502
|
+
return allModules[moduleIdIndex];
|
|
503
|
+
}
|
|
504
|
+
} else {
|
|
505
|
+
return allModules.find(
|
|
506
|
+
(bundleEntry) => typeof bundleEntry === "object" && bundleEntry !== null && moduleId in bundleEntry
|
|
507
|
+
)?.[moduleId];
|
|
508
|
+
}
|
|
509
|
+
return void 0;
|
|
510
|
+
}
|
|
511
|
+
function createTurbopackContext(bundle, exports, moduleExports, allModules, moduleInit, id, self) {
|
|
512
|
+
return {
|
|
513
|
+
// HMR not implemented for Remote Components
|
|
514
|
+
k: {
|
|
515
|
+
register() {
|
|
516
|
+
},
|
|
517
|
+
registerExports() {
|
|
518
|
+
},
|
|
519
|
+
signature() {
|
|
520
|
+
return (fn) => fn;
|
|
409
521
|
}
|
|
410
|
-
|
|
411
|
-
|
|
522
|
+
},
|
|
523
|
+
// ESM exports setup
|
|
524
|
+
s(bindings, esmId) {
|
|
525
|
+
let mod = exports;
|
|
526
|
+
if (typeof esmId === "string" || typeof esmId === "number") {
|
|
527
|
+
if (!self.__remote_components_turbopack_modules__) {
|
|
528
|
+
self.__remote_components_turbopack_modules__ = {};
|
|
529
|
+
}
|
|
530
|
+
if (!self.__remote_components_turbopack_modules__[bundle]) {
|
|
531
|
+
self.__remote_components_turbopack_modules__[bundle] = {};
|
|
532
|
+
}
|
|
533
|
+
if (!self.__remote_components_turbopack_modules__[bundle][esmId]) {
|
|
534
|
+
self.__remote_components_turbopack_modules__[bundle][esmId] = {};
|
|
535
|
+
}
|
|
536
|
+
mod = self.__remote_components_turbopack_modules__[bundle][esmId];
|
|
412
537
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
538
|
+
Object.defineProperty(mod, "__esModule", { value: true });
|
|
539
|
+
if (Array.isArray(bindings)) {
|
|
540
|
+
let i = 0;
|
|
541
|
+
while (i < bindings.length) {
|
|
542
|
+
const propName = bindings[i++];
|
|
543
|
+
const tagOrFunc = bindings[i++];
|
|
544
|
+
if (typeof tagOrFunc === "number") {
|
|
545
|
+
Object.defineProperty(mod, propName, {
|
|
546
|
+
value: bindings[i++],
|
|
547
|
+
enumerable: true,
|
|
548
|
+
writable: false
|
|
549
|
+
});
|
|
550
|
+
} else {
|
|
551
|
+
const getterFn = tagOrFunc;
|
|
552
|
+
if (typeof bindings[i] === "function") {
|
|
553
|
+
const setterFn = bindings[i++];
|
|
554
|
+
Object.defineProperty(mod, propName, {
|
|
555
|
+
get: getterFn,
|
|
556
|
+
set: setterFn,
|
|
557
|
+
enumerable: true
|
|
558
|
+
});
|
|
559
|
+
} else {
|
|
560
|
+
Object.defineProperty(mod, propName, {
|
|
561
|
+
get: getterFn,
|
|
562
|
+
enumerable: true
|
|
563
|
+
});
|
|
564
|
+
}
|
|
420
565
|
}
|
|
421
|
-
|
|
566
|
+
}
|
|
422
567
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
568
|
+
},
|
|
569
|
+
// import
|
|
570
|
+
i(importId) {
|
|
571
|
+
let mod;
|
|
572
|
+
if (typeof importId === "string") {
|
|
573
|
+
const { exportSource, exportName } = /\s+<export (?<exportSource>.*?) as (?<exportName>.*?)>$/.exec(
|
|
574
|
+
importId
|
|
575
|
+
)?.groups ?? {};
|
|
576
|
+
const normalizedId = importId.replace(
|
|
577
|
+
/\s+<export(?<specifier>.*)>$/,
|
|
578
|
+
""
|
|
429
579
|
);
|
|
580
|
+
mod = self.__webpack_require__?.(`[${bundle}] ${normalizedId}`);
|
|
581
|
+
if (mod && exportSource && exportName && (exportSource === "*" || typeof mod[exportSource] !== "undefined") && typeof mod[exportName] === "undefined") {
|
|
582
|
+
if (exportSource === "*") {
|
|
583
|
+
mod[exportName] = mod;
|
|
584
|
+
} else {
|
|
585
|
+
mod[exportName] = mod[exportSource];
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
} else {
|
|
589
|
+
mod = self.__webpack_require__?.(`[${bundle}] ${importId}`);
|
|
430
590
|
}
|
|
431
|
-
|
|
591
|
+
if (typeof mod !== "object" || mod === null) {
|
|
592
|
+
mod = { default: mod };
|
|
593
|
+
} else if (!("default" in mod) && mod.toString() !== "[object Module]") {
|
|
594
|
+
try {
|
|
595
|
+
mod.default = mod;
|
|
596
|
+
} catch {
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
return mod;
|
|
600
|
+
},
|
|
601
|
+
// require
|
|
602
|
+
r(requireId) {
|
|
603
|
+
return self.__webpack_require__?.(`[${bundle}] ${requireId}`);
|
|
604
|
+
},
|
|
605
|
+
// value exports
|
|
606
|
+
v(value) {
|
|
607
|
+
if (typeof value === "function") {
|
|
608
|
+
exports.default = value((vid) => {
|
|
609
|
+
return self.__webpack_require__?.(`[${bundle}] ${vid}`);
|
|
610
|
+
});
|
|
611
|
+
} else {
|
|
612
|
+
moduleExports.exports = value;
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
// async module initializer
|
|
616
|
+
async a(mod) {
|
|
617
|
+
let result;
|
|
618
|
+
await mod(
|
|
619
|
+
() => {
|
|
620
|
+
},
|
|
621
|
+
(value) => result = value
|
|
622
|
+
);
|
|
623
|
+
exports.default = result;
|
|
624
|
+
},
|
|
625
|
+
// async module loader
|
|
626
|
+
async A(Aid) {
|
|
627
|
+
const mod = self.__webpack_require__?.(`[${bundle}] ${Aid}`);
|
|
628
|
+
return mod.default(
|
|
629
|
+
(parentId) => self.__webpack_require__?.(`[${bundle}] ${parentId}`)
|
|
630
|
+
);
|
|
631
|
+
},
|
|
632
|
+
// chunk loader
|
|
633
|
+
l(url) {
|
|
634
|
+
const moduleInitIndex = allModules.indexOf(moduleInit);
|
|
635
|
+
if (moduleInitIndex !== -1) {
|
|
636
|
+
const scriptIndex = allModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
|
|
637
|
+
if (scriptIndex !== -1) {
|
|
638
|
+
const script = allModules[scriptIndex];
|
|
639
|
+
const scriptSrc = script.getAttribute("data-turbopack-src") || "";
|
|
640
|
+
const nextIndex = scriptSrc.indexOf("/_next");
|
|
641
|
+
const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
|
|
642
|
+
const bundleUrl = `[${bundle}] ${baseUrl}/_next/${url}`;
|
|
643
|
+
return self.__webpack_chunk_load__?.(bundleUrl, bundle);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
throw new Error(
|
|
647
|
+
`Failed to load Turbopack chunk "${url}" for module "${id}". Check the URL is correct.`
|
|
648
|
+
);
|
|
649
|
+
},
|
|
650
|
+
// global object for this bundle
|
|
651
|
+
g: self.__remote_components_turbopack_global__?.[bundle],
|
|
652
|
+
m: moduleExports,
|
|
653
|
+
e: exports
|
|
432
654
|
};
|
|
433
655
|
}
|
|
656
|
+
var init_turbopack_module = __esm({
|
|
657
|
+
"src/shared/client/turbopack-module.ts"() {
|
|
658
|
+
"use strict";
|
|
659
|
+
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]+)\)\)\)\}/;
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
// src/shared/client/shared-modules.ts
|
|
434
677
|
async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {}) {
|
|
435
678
|
const self = globalThis;
|
|
436
679
|
self.__remote_shared_modules__ = self.__remote_shared_modules__ ?? {};
|
|
@@ -447,14 +690,12 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
447
690
|
return false;
|
|
448
691
|
}
|
|
449
692
|
const funcCode = idOrFunc.toString();
|
|
450
|
-
return
|
|
693
|
+
return REMOTE_SHARED_MARKER_RE.test(funcCode);
|
|
451
694
|
});
|
|
452
695
|
if (sharedModuleInitializerIndex > 0) {
|
|
453
696
|
const sharedModuleInitializerCode = allModules[sharedModuleInitializerIndex].toString();
|
|
454
697
|
const sharedModuleInitializerId = allModules[sharedModuleInitializerIndex - 1];
|
|
455
|
-
const { sharedModuleId } =
|
|
456
|
-
sharedModuleInitializerCode
|
|
457
|
-
)?.groups ?? {};
|
|
698
|
+
const { sharedModuleId } = REMOTE_SHARED_ASSIGNMENT_RE.exec(sharedModuleInitializerCode)?.groups ?? {};
|
|
458
699
|
if (sharedModuleId) {
|
|
459
700
|
const { default: sharedModuleInitializerInstance } = handleTurbopackModule(
|
|
460
701
|
bundle,
|
|
@@ -466,33 +707,11 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
466
707
|
}
|
|
467
708
|
if (sharedModuleInitializer) {
|
|
468
709
|
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
|
-
}, {});
|
|
710
|
+
const sharedModuleIds = extractSharedModuleIds(
|
|
711
|
+
shared,
|
|
712
|
+
bundleKey,
|
|
713
|
+
self
|
|
714
|
+
);
|
|
496
715
|
return Promise.all(
|
|
497
716
|
Object.entries(sharedModuleIds).map(async ([id, module2]) => {
|
|
498
717
|
if (self.__remote_shared_modules__?.[bundle]) {
|
|
@@ -516,6 +735,31 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
516
735
|
})
|
|
517
736
|
);
|
|
518
737
|
}
|
|
738
|
+
function extractSharedModuleIds(shared, bundleKey, self) {
|
|
739
|
+
return Object.entries(shared).filter(([, value]) => typeof value === "function").reduce((acc, [key, value]) => {
|
|
740
|
+
const { asyncSharedModuleId } = ASYNC_MODULE_LOADER_RE.exec(value.toString())?.groups ?? {};
|
|
741
|
+
if (asyncSharedModuleId) {
|
|
742
|
+
const asyncSharedModuleIdNumber = Number(asyncSharedModuleId);
|
|
743
|
+
let asyncSharedModule;
|
|
744
|
+
const newAllModules = self[`TURBOPACK_${bundleKey}`]?.flat() ?? [];
|
|
745
|
+
const asyncSharedModuleIdIndex = newAllModules.indexOf(
|
|
746
|
+
asyncSharedModuleIdNumber
|
|
747
|
+
);
|
|
748
|
+
if (asyncSharedModuleIdIndex !== -1 && typeof newAllModules[asyncSharedModuleIdIndex + 1] === "function") {
|
|
749
|
+
asyncSharedModule = newAllModules[asyncSharedModuleIdIndex + 1];
|
|
750
|
+
}
|
|
751
|
+
if (asyncSharedModule) {
|
|
752
|
+
const asyncSharedModuleCode = asyncSharedModule.toString();
|
|
753
|
+
const { sharedModuleId } = ASYNC_MODULE_RESOLVE_RE.exec(asyncSharedModuleCode)?.groups ?? ASYNC_MODULE_ALL_RE.exec(asyncSharedModuleCode)?.groups ?? {};
|
|
754
|
+
acc[sharedModuleId ?? asyncSharedModuleId] = key.replace(
|
|
755
|
+
"__remote_shared_module_",
|
|
756
|
+
""
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return acc;
|
|
761
|
+
}, {});
|
|
762
|
+
}
|
|
519
763
|
function getSharedModule(bundle, id) {
|
|
520
764
|
const self = globalThis;
|
|
521
765
|
for (const [key, value] of Object.entries(
|
|
@@ -527,216 +771,118 @@ function getSharedModule(bundle, id) {
|
|
|
527
771
|
}
|
|
528
772
|
return null;
|
|
529
773
|
}
|
|
530
|
-
|
|
774
|
+
var init_shared_modules2 = __esm({
|
|
775
|
+
"src/shared/client/shared-modules.ts"() {
|
|
776
|
+
"use strict";
|
|
777
|
+
init_const();
|
|
778
|
+
init_turbopack_module();
|
|
779
|
+
init_turbopack_patterns();
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
// src/shared/client/webpack-adapter.ts
|
|
784
|
+
async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}) {
|
|
531
785
|
const self = globalThis;
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
(bundleEntry) => typeof bundleEntry === "string" && bundleEntry.startsWith(moduleId) || bundleEntry === normalizedId
|
|
542
|
-
);
|
|
786
|
+
if (!self.__remote_bundle_url__) {
|
|
787
|
+
self.__remote_bundle_url__ = {};
|
|
788
|
+
}
|
|
789
|
+
self.__remote_bundle_url__[bundle ?? "default"] = url;
|
|
790
|
+
self.__webpack_get_script_filename__ = () => null;
|
|
791
|
+
if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
|
|
792
|
+
if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
|
|
793
|
+
self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
|
|
794
|
+
self.__original_webpack_require__ = self.__webpack_require__;
|
|
543
795
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
796
|
+
self.__webpack_chunk_load__ = createChunkLoader(runtime);
|
|
797
|
+
self.__webpack_require__ = createModuleRequire(runtime);
|
|
798
|
+
self.__webpack_require_type__ = runtime;
|
|
799
|
+
if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {
|
|
800
|
+
const remoteBundle = bundle ?? "default";
|
|
801
|
+
self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
|
|
802
|
+
self.__remote_webpack_require__[remoteBundle].type = "turbopack";
|
|
549
803
|
}
|
|
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
804
|
}
|
|
566
|
-
if (
|
|
567
|
-
|
|
568
|
-
|
|
805
|
+
if (runtime === RUNTIME_TURBOPACK) {
|
|
806
|
+
await Promise.all(
|
|
807
|
+
scripts.map((script) => {
|
|
808
|
+
if (script.src) {
|
|
809
|
+
return self.__webpack_chunk_load__?.(script.src, bundle);
|
|
810
|
+
}
|
|
811
|
+
return Promise.resolve(void 0);
|
|
812
|
+
})
|
|
569
813
|
);
|
|
570
814
|
}
|
|
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 {
|
|
815
|
+
const coreShared = {
|
|
816
|
+
react: async () => (await import("react")).default,
|
|
817
|
+
"react-dom": async () => (await import("react-dom")).default,
|
|
818
|
+
"react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
|
|
819
|
+
"react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
|
|
820
|
+
"react-dom/client": async () => (await import("react-dom/client")).default,
|
|
821
|
+
...shared
|
|
822
|
+
};
|
|
823
|
+
await initializeSharedModules(
|
|
824
|
+
bundle ?? "default",
|
|
825
|
+
// include all core modules as shared
|
|
826
|
+
coreShared,
|
|
827
|
+
remoteShared
|
|
828
|
+
);
|
|
829
|
+
}
|
|
830
|
+
function createModuleRequire(runtime) {
|
|
831
|
+
return (id) => {
|
|
832
|
+
const self = globalThis;
|
|
833
|
+
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
834
|
+
bundle: "default",
|
|
835
|
+
id
|
|
836
|
+
};
|
|
837
|
+
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
838
|
+
logDebug("WebpackAdapter", `remoteRuntime: "${remoteRuntime}"`);
|
|
839
|
+
try {
|
|
840
|
+
if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
|
|
841
|
+
return self.__remote_webpack_require__?.[bundle]?.(moduleId);
|
|
842
|
+
}
|
|
843
|
+
const sharedModuleId = moduleId ?? id;
|
|
844
|
+
const sharedModule = getSharedModule(bundle ?? "default", sharedModuleId);
|
|
845
|
+
if (sharedModule) {
|
|
846
|
+
return sharedModule;
|
|
847
|
+
}
|
|
848
|
+
if (bundle && moduleId) {
|
|
849
|
+
return handleTurbopackModule(bundle, moduleId, id);
|
|
850
|
+
}
|
|
851
|
+
throw new Error(`Module "${id}" not found.`);
|
|
852
|
+
} catch (requireError) {
|
|
853
|
+
logWarn(
|
|
854
|
+
"WebpackAdapter",
|
|
855
|
+
`Module require failed: ${String(requireError)}`
|
|
856
|
+
);
|
|
857
|
+
if (typeof self.__original_webpack_require__ !== "function") {
|
|
858
|
+
throw new RemoteComponentsError(
|
|
859
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
860
|
+
{
|
|
861
|
+
cause: requireError instanceof Error ? requireError : void 0
|
|
669
862
|
}
|
|
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
|
-
);
|
|
695
|
-
exports.default = result;
|
|
696
|
-
},
|
|
697
|
-
// async module loader
|
|
698
|
-
async A(Aid) {
|
|
699
|
-
const mod = self.__webpack_require__?.(`[${bundle}] ${Aid}`);
|
|
700
|
-
return mod.default(
|
|
701
|
-
(parentId) => self.__webpack_require__?.(`[${bundle}] ${parentId}`)
|
|
702
863
|
);
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
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.`
|
|
864
|
+
}
|
|
865
|
+
try {
|
|
866
|
+
logDebug("WebpackAdapter", "Falling back to original webpack require");
|
|
867
|
+
return self.__original_webpack_require__(id);
|
|
868
|
+
} catch (originalError) {
|
|
869
|
+
throw new RemoteComponentsError(
|
|
870
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
871
|
+
{ cause: originalError instanceof Error ? originalError : void 0 }
|
|
720
872
|
);
|
|
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;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
};
|
|
734
876
|
}
|
|
735
877
|
var init_webpack_adapter = __esm({
|
|
736
878
|
"src/shared/client/webpack-adapter.ts"() {
|
|
737
879
|
"use strict";
|
|
738
880
|
init_error();
|
|
881
|
+
init_logger();
|
|
882
|
+
init_chunk_loader();
|
|
739
883
|
init_const();
|
|
884
|
+
init_shared_modules2();
|
|
885
|
+
init_turbopack_module();
|
|
740
886
|
}
|
|
741
887
|
});
|
|
742
888
|
|
|
@@ -1309,6 +1455,7 @@ var JSXRuntime = __toESM(require("react/jsx-runtime"), 1);
|
|
|
1309
1455
|
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
1310
1456
|
var ReactDOMClient = __toESM(require("react-dom/client"), 1);
|
|
1311
1457
|
init_error();
|
|
1458
|
+
init_logger();
|
|
1312
1459
|
init_next_client_pages_loader();
|
|
1313
1460
|
init_shared_modules();
|
|
1314
1461
|
|
|
@@ -1568,9 +1715,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1568
1715
|
};
|
|
1569
1716
|
const res = await fetch(url, fetchInit);
|
|
1570
1717
|
if (!res.ok) {
|
|
1571
|
-
let error = failedToFetchRemoteComponentError(url.href,
|
|
1572
|
-
cause: new Error(`${res.status} ${res.statusText}`)
|
|
1573
|
-
});
|
|
1718
|
+
let error = failedToFetchRemoteComponentError(url.href, res);
|
|
1574
1719
|
try {
|
|
1575
1720
|
const body = await res.text();
|
|
1576
1721
|
const parser2 = new DOMParser();
|
|
@@ -1881,7 +2026,9 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1881
2026
|
};
|
|
1882
2027
|
if (rsc) {
|
|
1883
2028
|
rsc.parentElement?.removeChild(rsc);
|
|
1884
|
-
const rscName = `__remote_component_rsc_${escapeString(
|
|
2029
|
+
const rscName = `__remote_component_rsc_${escapeString(
|
|
2030
|
+
url.href
|
|
2031
|
+
)}_${escapeString(this.name)}`;
|
|
1885
2032
|
const rscClone = document.createElement("script");
|
|
1886
2033
|
rscClone.id = `${rscName}_rsc`;
|
|
1887
2034
|
rscClone.textContent = rsc.textContent?.replace(
|