remote-components 0.0.18 → 0.0.20
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 +194 -180
- package/dist/html/host.cjs.map +1 -1
- package/dist/html/host.js +193 -179
- package/dist/html/host.js.map +1 -1
- package/dist/{next → internal/next}/host/app-router-client.cjs +1 -1
- package/dist/internal/next/host/app-router-client.cjs.map +1 -0
- package/dist/{next → internal/next}/host/app-router-client.d.ts +2 -2
- package/dist/{next → internal/next}/host/app-router-client.js +1 -1
- package/dist/internal/next/host/app-router-client.js.map +1 -0
- package/dist/internal/next/remote/render-client.cjs +56 -0
- package/dist/internal/next/remote/render-client.cjs.map +1 -0
- package/dist/internal/next/remote/render-client.d.ts +7 -0
- package/dist/internal/next/remote/render-client.js +22 -0
- package/dist/internal/next/remote/render-client.js.map +1 -0
- package/dist/{next → internal/next}/remote/render-server.cjs +12 -26
- package/dist/internal/next/remote/render-server.cjs.map +1 -0
- package/dist/{next → internal/next}/remote/render-server.d.ts +1 -1
- package/dist/{next → internal/next}/remote/render-server.js +12 -26
- package/dist/internal/next/remote/render-server.js.map +1 -0
- package/dist/internal/shared/client/remote-component.cjs.map +1 -0
- package/dist/internal/shared/client/remote-component.js.map +1 -0
- package/dist/{shared → internal/shared}/ssr/dom-flight.cjs +4 -0
- package/dist/internal/shared/ssr/dom-flight.cjs.map +1 -0
- package/dist/{shared → internal/shared}/ssr/dom-flight.d.ts +2 -2
- package/dist/{shared → internal/shared}/ssr/dom-flight.js +4 -0
- package/dist/internal/shared/ssr/dom-flight.js.map +1 -0
- package/dist/{shared → internal/shared}/ssr/fetch-remote-component.cjs +22 -6
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -0
- package/dist/{shared → internal/shared}/ssr/fetch-remote-component.d.ts +2 -2
- package/dist/{shared → internal/shared}/ssr/fetch-remote-component.js +11 -5
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -0
- package/dist/next/host/app-router-server.cjs +2 -2
- package/dist/next/host/app-router-server.cjs.map +1 -1
- package/dist/next/host/app-router-server.d.ts +1 -1
- package/dist/next/host/app-router-server.js +2 -2
- package/dist/next/host/app-router-server.js.map +1 -1
- package/dist/next/host/client/index.cjs +1 -1
- package/dist/next/host/client/index.cjs.map +1 -1
- package/dist/next/host/client/index.js +1 -1
- package/dist/next/host/client/index.js.map +1 -1
- package/dist/next/host/pages-router-server.cjs +2 -2
- package/dist/next/host/pages-router-server.cjs.map +1 -1
- package/dist/next/host/pages-router-server.js +2 -2
- package/dist/next/host/pages-router-server.js.map +1 -1
- package/dist/next/index.cjs +2 -2
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.ts +2 -2
- package/dist/next/index.js +2 -2
- package/dist/next/index.js.map +1 -1
- package/dist/next/remote/pages-router.cjs +2 -2
- package/dist/next/remote/pages-router.cjs.map +1 -1
- package/dist/next/remote/pages-router.js +2 -2
- package/dist/next/remote/pages-router.js.map +1 -1
- package/dist/next/remote/server.cjs +1 -1
- package/dist/next/remote/server.cjs.map +1 -1
- package/dist/next/remote/server.d.ts +1 -1
- package/dist/next/remote/server.js +1 -1
- package/dist/next/remote/server.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +18 -1
- package/dist/next/host/app-router-client.cjs.map +0 -1
- package/dist/next/host/app-router-client.js.map +0 -1
- package/dist/next/remote/render-client-turbopack.cjs +0 -51
- package/dist/next/remote/render-client-turbopack.cjs.map +0 -1
- package/dist/next/remote/render-client-turbopack.d.ts +0 -11
- package/dist/next/remote/render-client-turbopack.js +0 -27
- package/dist/next/remote/render-client-turbopack.js.map +0 -1
- package/dist/next/remote/render-client-webpack.cjs +0 -51
- package/dist/next/remote/render-client-webpack.cjs.map +0 -1
- package/dist/next/remote/render-client-webpack.d.ts +0 -11
- package/dist/next/remote/render-client-webpack.js +0 -27
- package/dist/next/remote/render-client-webpack.js.map +0 -1
- package/dist/next/remote/render-client.cjs +0 -123
- package/dist/next/remote/render-client.cjs.map +0 -1
- package/dist/next/remote/render-client.d.ts +0 -15
- package/dist/next/remote/render-client.js +0 -89
- package/dist/next/remote/render-client.js.map +0 -1
- package/dist/next/remote/render-server.cjs.map +0 -1
- package/dist/next/remote/render-server.js.map +0 -1
- package/dist/shared/client/remote-component.cjs.map +0 -1
- package/dist/shared/client/remote-component.js.map +0 -1
- package/dist/shared/ssr/dom-flight.cjs.map +0 -1
- package/dist/shared/ssr/dom-flight.js.map +0 -1
- package/dist/shared/ssr/fetch-remote-component.cjs.map +0 -1
- package/dist/shared/ssr/fetch-remote-component.js.map +0 -1
- package/dist/types-a1bd5b56.d.ts +0 -6
- /package/dist/{shared → internal/shared}/client/remote-component.cjs +0 -0
- /package/dist/{shared → internal/shared}/client/remote-component.d.ts +0 -0
- /package/dist/{shared → internal/shared}/client/remote-component.js +0 -0
- /package/dist/{shared → internal}/webpack/next-client-pages-loader.cjs +0 -0
- /package/dist/{shared → internal}/webpack/next-client-pages-loader.cjs.map +0 -0
- /package/dist/{shared → internal}/webpack/next-client-pages-loader.d.ts +0 -0
- /package/dist/{shared → internal}/webpack/next-client-pages-loader.js +0 -0
- /package/dist/{shared → internal}/webpack/next-client-pages-loader.js.map +0 -0
- /package/dist/{shared → internal}/webpack/shared-modules.cjs +0 -0
- /package/dist/{shared → internal}/webpack/shared-modules.cjs.map +0 -0
- /package/dist/{shared → internal}/webpack/shared-modules.d.ts +0 -0
- /package/dist/{shared → internal}/webpack/shared-modules.js +0 -0
- /package/dist/{shared → internal}/webpack/shared-modules.js.map +0 -0
package/dist/html/host.cjs
CHANGED
|
@@ -152,186 +152,6 @@ var init_next_client_pages_loader = __esm({
|
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
-
// src/shared/client/polyfill.tsx
|
|
156
|
-
function sharedPolyfills(shared) {
|
|
157
|
-
const self = globalThis;
|
|
158
|
-
const polyfill = {
|
|
159
|
-
"next/dist/client/components/navigation": self.__remote_component_host_shared_modules__?.["next/navigation"] ?? shared?.["next/navigation"] ?? (() => Promise.resolve({
|
|
160
|
-
useRouter() {
|
|
161
|
-
return {
|
|
162
|
-
push: (routerUrl) => {
|
|
163
|
-
history.pushState({}, "", routerUrl);
|
|
164
|
-
},
|
|
165
|
-
replace: (routerUrl) => {
|
|
166
|
-
history.replaceState({}, "", routerUrl);
|
|
167
|
-
},
|
|
168
|
-
back: () => {
|
|
169
|
-
history.back();
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
},
|
|
173
|
-
useSearchParams() {
|
|
174
|
-
return new URLSearchParams(location.search);
|
|
175
|
-
},
|
|
176
|
-
__esModule: true
|
|
177
|
-
})),
|
|
178
|
-
"next/dist/client/app-dir/link": self.__remote_component_host_shared_modules__?.["next/link"] ?? shared?.["next/link"] ?? (() => Promise.resolve({
|
|
179
|
-
default: ({
|
|
180
|
-
children,
|
|
181
|
-
...props
|
|
182
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { ...props, href: props.href, suppressHydrationWarning: true, children: children ?? null }),
|
|
183
|
-
__esModule: true
|
|
184
|
-
})),
|
|
185
|
-
"next/dist/client/app-dir/form": self.__remote_component_host_shared_modules__?.["next/form"] ?? shared?.["next/form"] ?? (() => Promise.resolve({
|
|
186
|
-
default: () => {
|
|
187
|
-
throw new Error("Next.js <Form> component not implemented");
|
|
188
|
-
},
|
|
189
|
-
__esModule: true
|
|
190
|
-
})),
|
|
191
|
-
"next/dist/client/image-component": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? (() => Promise.resolve({
|
|
192
|
-
Image: (props) => (
|
|
193
|
-
// eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
|
|
194
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
|
-
"img",
|
|
196
|
-
{
|
|
197
|
-
...props,
|
|
198
|
-
src: props.src,
|
|
199
|
-
suppressHydrationWarning: true
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
),
|
|
203
|
-
__esModule: true
|
|
204
|
-
})),
|
|
205
|
-
"next/dist/client/script": self.__remote_component_host_shared_modules__?.["next/script"] ?? shared?.["next/script"] ?? (() => Promise.resolve({
|
|
206
|
-
// TODO: implement <Script> component for non-Next.js host applications
|
|
207
|
-
// do not throw an error for now
|
|
208
|
-
default: () => null,
|
|
209
|
-
__esModule: true
|
|
210
|
-
}))
|
|
211
|
-
};
|
|
212
|
-
polyfill["next/link"] = polyfill["next/dist/client/app-dir/link"];
|
|
213
|
-
polyfill["next/form"] = polyfill["next/dist/client/app-dir/form"];
|
|
214
|
-
polyfill["next/image"] = polyfill["next/dist/client/image-component"];
|
|
215
|
-
polyfill["next/dist/api/image"] = polyfill["next/dist/client/image-component"];
|
|
216
|
-
polyfill["next/script"] = polyfill["next/dist/client/script"];
|
|
217
|
-
return polyfill;
|
|
218
|
-
}
|
|
219
|
-
var import_jsx_runtime;
|
|
220
|
-
var init_polyfill = __esm({
|
|
221
|
-
"src/shared/client/polyfill.tsx"() {
|
|
222
|
-
"use strict";
|
|
223
|
-
import_jsx_runtime = require("react/jsx-runtime");
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
// src/html/host/runtime/webpack.ts
|
|
228
|
-
var webpack_exports = {};
|
|
229
|
-
__export(webpack_exports, {
|
|
230
|
-
webpackRuntime: () => webpackRuntime
|
|
231
|
-
});
|
|
232
|
-
async function webpackRuntime(bundle, shared, remoteShared) {
|
|
233
|
-
const self = globalThis;
|
|
234
|
-
if (!self.__DISABLE_WEBPACK_EXEC__) {
|
|
235
|
-
self.__DISABLE_WEBPACK_EXEC__ = {};
|
|
236
|
-
}
|
|
237
|
-
self.__DISABLE_WEBPACK_EXEC__[bundle] = true;
|
|
238
|
-
if (typeof self.__webpack_require__ !== "function" && self.__webpack_require_type__ !== "turbopack") {
|
|
239
|
-
self.__webpack_require__ = (remoteId) => {
|
|
240
|
-
const re = /\[(?<bundle>[^\]]+)\] (?<id>.*)/;
|
|
241
|
-
const match = re.exec(remoteId);
|
|
242
|
-
const remoteBundle = match?.groups?.bundle;
|
|
243
|
-
const id = match?.groups?.id;
|
|
244
|
-
if (!(id && remoteBundle)) {
|
|
245
|
-
throw new Error(`Module not found: "${remoteId}"`);
|
|
246
|
-
}
|
|
247
|
-
if (typeof self.__remote_webpack_require__?.[remoteBundle] !== "function") {
|
|
248
|
-
throw new Error(`Remote component loading error "${remoteBundle}"`);
|
|
249
|
-
}
|
|
250
|
-
return self.__remote_webpack_require__[remoteBundle](id);
|
|
251
|
-
};
|
|
252
|
-
self.__webpack_chunk_load__ = () => {
|
|
253
|
-
return Promise.resolve([]);
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
const {
|
|
257
|
-
default: { createFromReadableStream }
|
|
258
|
-
} = await import("react-server-dom-webpack/client.browser");
|
|
259
|
-
async function preloadScripts(scripts, url, remoteBundle, _) {
|
|
260
|
-
await Promise.all(
|
|
261
|
-
scripts.map((script) => {
|
|
262
|
-
return new Promise((resolve2, reject) => {
|
|
263
|
-
const newScript = document.createElement("script");
|
|
264
|
-
newScript.onload = () => {
|
|
265
|
-
resolve2();
|
|
266
|
-
};
|
|
267
|
-
newScript.onerror = () => {
|
|
268
|
-
reject(
|
|
269
|
-
new Error(
|
|
270
|
-
`Failed to load script ${script.src} for remote component`
|
|
271
|
-
)
|
|
272
|
-
);
|
|
273
|
-
};
|
|
274
|
-
const scriptSrc = script.getAttribute("src") || script.getAttribute("data-src");
|
|
275
|
-
if (scriptSrc) {
|
|
276
|
-
newScript.src = new URL(
|
|
277
|
-
scriptSrc.replace(/\/_next\/\[(?:.+)\](?:%20| )/, "/_next/"),
|
|
278
|
-
url
|
|
279
|
-
).href;
|
|
280
|
-
}
|
|
281
|
-
newScript.async = true;
|
|
282
|
-
document.body.appendChild(newScript);
|
|
283
|
-
script.parentElement?.removeChild(script);
|
|
284
|
-
});
|
|
285
|
-
})
|
|
286
|
-
);
|
|
287
|
-
const hostShared = {
|
|
288
|
-
...sharedPolyfills(shared),
|
|
289
|
-
...self.__remote_component_host_shared_modules__,
|
|
290
|
-
...shared
|
|
291
|
-
};
|
|
292
|
-
const resolve = {
|
|
293
|
-
"/react/index.js": (await import("react")).default,
|
|
294
|
-
"/react/jsx-dev-runtime.js": (await import("react/jsx-dev-runtime")).default,
|
|
295
|
-
"/react/jsx-runtime.js": (await import("react/jsx-runtime")).default,
|
|
296
|
-
"/react-dom/index.js": (await import("react-dom")).default,
|
|
297
|
-
"/react-dom/client.js": (await import("react-dom/client")).default,
|
|
298
|
-
...Object.entries(remoteShared ?? {}).reduce(
|
|
299
|
-
(acc, [key, value]) => {
|
|
300
|
-
if (typeof hostShared[value] !== "undefined") {
|
|
301
|
-
acc[key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "")] = hostShared[value];
|
|
302
|
-
}
|
|
303
|
-
return acc;
|
|
304
|
-
},
|
|
305
|
-
{}
|
|
306
|
-
)
|
|
307
|
-
};
|
|
308
|
-
await Promise.all(
|
|
309
|
-
Object.entries(resolve).map(async ([key, value]) => {
|
|
310
|
-
if (typeof value === "function") {
|
|
311
|
-
resolve[key] = await value();
|
|
312
|
-
}
|
|
313
|
-
return Promise.resolve(value);
|
|
314
|
-
})
|
|
315
|
-
);
|
|
316
|
-
applySharedModules(remoteBundle, resolve);
|
|
317
|
-
}
|
|
318
|
-
return {
|
|
319
|
-
self,
|
|
320
|
-
createFromReadableStream,
|
|
321
|
-
applySharedModules,
|
|
322
|
-
nextClientPagesLoader,
|
|
323
|
-
preloadScripts
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
var init_webpack = __esm({
|
|
327
|
-
"src/html/host/runtime/webpack.ts"() {
|
|
328
|
-
"use strict";
|
|
329
|
-
init_shared_modules();
|
|
330
|
-
init_next_client_pages_loader();
|
|
331
|
-
init_polyfill();
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
|
|
335
155
|
// src/shared/client/const.ts
|
|
336
156
|
function getBundleKey(bundle) {
|
|
337
157
|
return bundle.replace(/-/g, "_");
|
|
@@ -693,6 +513,186 @@ var init_webpack_adapter = __esm({
|
|
|
693
513
|
}
|
|
694
514
|
});
|
|
695
515
|
|
|
516
|
+
// src/shared/client/polyfill.tsx
|
|
517
|
+
function sharedPolyfills(shared) {
|
|
518
|
+
const self = globalThis;
|
|
519
|
+
const polyfill = {
|
|
520
|
+
"next/dist/client/components/navigation": self.__remote_component_host_shared_modules__?.["next/navigation"] ?? shared?.["next/navigation"] ?? (() => Promise.resolve({
|
|
521
|
+
useRouter() {
|
|
522
|
+
return {
|
|
523
|
+
push: (routerUrl) => {
|
|
524
|
+
history.pushState({}, "", routerUrl);
|
|
525
|
+
},
|
|
526
|
+
replace: (routerUrl) => {
|
|
527
|
+
history.replaceState({}, "", routerUrl);
|
|
528
|
+
},
|
|
529
|
+
back: () => {
|
|
530
|
+
history.back();
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
},
|
|
534
|
+
useSearchParams() {
|
|
535
|
+
return new URLSearchParams(location.search);
|
|
536
|
+
},
|
|
537
|
+
__esModule: true
|
|
538
|
+
})),
|
|
539
|
+
"next/dist/client/app-dir/link": self.__remote_component_host_shared_modules__?.["next/link"] ?? shared?.["next/link"] ?? (() => Promise.resolve({
|
|
540
|
+
default: ({
|
|
541
|
+
children,
|
|
542
|
+
...props
|
|
543
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { ...props, href: props.href, suppressHydrationWarning: true, children: children ?? null }),
|
|
544
|
+
__esModule: true
|
|
545
|
+
})),
|
|
546
|
+
"next/dist/client/app-dir/form": self.__remote_component_host_shared_modules__?.["next/form"] ?? shared?.["next/form"] ?? (() => Promise.resolve({
|
|
547
|
+
default: () => {
|
|
548
|
+
throw new Error("Next.js <Form> component not implemented");
|
|
549
|
+
},
|
|
550
|
+
__esModule: true
|
|
551
|
+
})),
|
|
552
|
+
"next/dist/client/image-component": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? (() => Promise.resolve({
|
|
553
|
+
Image: (props) => (
|
|
554
|
+
// eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
|
|
555
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
556
|
+
"img",
|
|
557
|
+
{
|
|
558
|
+
...props,
|
|
559
|
+
src: props.src,
|
|
560
|
+
suppressHydrationWarning: true
|
|
561
|
+
}
|
|
562
|
+
)
|
|
563
|
+
),
|
|
564
|
+
__esModule: true
|
|
565
|
+
})),
|
|
566
|
+
"next/dist/client/script": self.__remote_component_host_shared_modules__?.["next/script"] ?? shared?.["next/script"] ?? (() => Promise.resolve({
|
|
567
|
+
// TODO: implement <Script> component for non-Next.js host applications
|
|
568
|
+
// do not throw an error for now
|
|
569
|
+
default: () => null,
|
|
570
|
+
__esModule: true
|
|
571
|
+
}))
|
|
572
|
+
};
|
|
573
|
+
polyfill["next/link"] = polyfill["next/dist/client/app-dir/link"];
|
|
574
|
+
polyfill["next/form"] = polyfill["next/dist/client/app-dir/form"];
|
|
575
|
+
polyfill["next/image"] = polyfill["next/dist/client/image-component"];
|
|
576
|
+
polyfill["next/dist/api/image"] = polyfill["next/dist/client/image-component"];
|
|
577
|
+
polyfill["next/script"] = polyfill["next/dist/client/script"];
|
|
578
|
+
return polyfill;
|
|
579
|
+
}
|
|
580
|
+
var import_jsx_runtime;
|
|
581
|
+
var init_polyfill = __esm({
|
|
582
|
+
"src/shared/client/polyfill.tsx"() {
|
|
583
|
+
"use strict";
|
|
584
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
// src/html/host/runtime/webpack.ts
|
|
589
|
+
var webpack_exports = {};
|
|
590
|
+
__export(webpack_exports, {
|
|
591
|
+
webpackRuntime: () => webpackRuntime
|
|
592
|
+
});
|
|
593
|
+
async function webpackRuntime(bundle, shared, remoteShared) {
|
|
594
|
+
const self = globalThis;
|
|
595
|
+
if (!self.__DISABLE_WEBPACK_EXEC__) {
|
|
596
|
+
self.__DISABLE_WEBPACK_EXEC__ = {};
|
|
597
|
+
}
|
|
598
|
+
self.__DISABLE_WEBPACK_EXEC__[bundle] = true;
|
|
599
|
+
if (typeof self.__webpack_require__ !== "function" && self.__webpack_require_type__ !== "turbopack") {
|
|
600
|
+
self.__webpack_require__ = (remoteId) => {
|
|
601
|
+
const re = /\[(?<bundle>[^\]]+)\] (?<id>.*)/;
|
|
602
|
+
const match = re.exec(remoteId);
|
|
603
|
+
const remoteBundle = match?.groups?.bundle;
|
|
604
|
+
const id = match?.groups?.id;
|
|
605
|
+
if (!(id && remoteBundle)) {
|
|
606
|
+
throw new Error(`Module not found: "${remoteId}"`);
|
|
607
|
+
}
|
|
608
|
+
if (typeof self.__remote_webpack_require__?.[remoteBundle] !== "function") {
|
|
609
|
+
throw new Error(`Remote component loading error "${remoteBundle}"`);
|
|
610
|
+
}
|
|
611
|
+
return self.__remote_webpack_require__[remoteBundle](id);
|
|
612
|
+
};
|
|
613
|
+
self.__webpack_chunk_load__ = () => {
|
|
614
|
+
return Promise.resolve([]);
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
const {
|
|
618
|
+
default: { createFromReadableStream }
|
|
619
|
+
} = await import("react-server-dom-webpack/client.browser");
|
|
620
|
+
async function preloadScripts(scripts, url, remoteBundle, _) {
|
|
621
|
+
await Promise.all(
|
|
622
|
+
scripts.map((script) => {
|
|
623
|
+
return new Promise((resolve2, reject) => {
|
|
624
|
+
const newScript = document.createElement("script");
|
|
625
|
+
newScript.onload = () => {
|
|
626
|
+
resolve2();
|
|
627
|
+
};
|
|
628
|
+
newScript.onerror = () => {
|
|
629
|
+
reject(
|
|
630
|
+
new Error(
|
|
631
|
+
`Failed to load script ${script.src} for remote component`
|
|
632
|
+
)
|
|
633
|
+
);
|
|
634
|
+
};
|
|
635
|
+
const scriptSrc = script.getAttribute("src") || script.getAttribute("data-src");
|
|
636
|
+
if (scriptSrc) {
|
|
637
|
+
newScript.src = new URL(
|
|
638
|
+
scriptSrc.replace(/\/_next\/\[(?:.+)\](?:%20| )/, "/_next/"),
|
|
639
|
+
url
|
|
640
|
+
).href;
|
|
641
|
+
}
|
|
642
|
+
newScript.async = true;
|
|
643
|
+
document.body.appendChild(newScript);
|
|
644
|
+
script.parentElement?.removeChild(script);
|
|
645
|
+
});
|
|
646
|
+
})
|
|
647
|
+
);
|
|
648
|
+
const hostShared = {
|
|
649
|
+
...sharedPolyfills(shared),
|
|
650
|
+
...self.__remote_component_host_shared_modules__,
|
|
651
|
+
...shared
|
|
652
|
+
};
|
|
653
|
+
const resolve = {
|
|
654
|
+
"/react/index.js": (await import("react")).default,
|
|
655
|
+
"/react/jsx-dev-runtime.js": (await import("react/jsx-dev-runtime")).default,
|
|
656
|
+
"/react/jsx-runtime.js": (await import("react/jsx-runtime")).default,
|
|
657
|
+
"/react-dom/index.js": (await import("react-dom")).default,
|
|
658
|
+
"/react-dom/client.js": (await import("react-dom/client")).default,
|
|
659
|
+
...Object.entries(remoteShared ?? {}).reduce(
|
|
660
|
+
(acc, [key, value]) => {
|
|
661
|
+
if (typeof hostShared[value] !== "undefined") {
|
|
662
|
+
acc[key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "")] = hostShared[value];
|
|
663
|
+
}
|
|
664
|
+
return acc;
|
|
665
|
+
},
|
|
666
|
+
{}
|
|
667
|
+
)
|
|
668
|
+
};
|
|
669
|
+
await Promise.all(
|
|
670
|
+
Object.entries(resolve).map(async ([key, value]) => {
|
|
671
|
+
if (typeof value === "function") {
|
|
672
|
+
resolve[key] = await value();
|
|
673
|
+
}
|
|
674
|
+
return Promise.resolve(value);
|
|
675
|
+
})
|
|
676
|
+
);
|
|
677
|
+
applySharedModules(remoteBundle, resolve);
|
|
678
|
+
}
|
|
679
|
+
return {
|
|
680
|
+
self,
|
|
681
|
+
createFromReadableStream,
|
|
682
|
+
applySharedModules,
|
|
683
|
+
nextClientPagesLoader,
|
|
684
|
+
preloadScripts
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
var init_webpack = __esm({
|
|
688
|
+
"src/html/host/runtime/webpack.ts"() {
|
|
689
|
+
"use strict";
|
|
690
|
+
init_shared_modules();
|
|
691
|
+
init_next_client_pages_loader();
|
|
692
|
+
init_polyfill();
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
|
|
696
696
|
// src/html/host/runtime/turbopack.ts
|
|
697
697
|
var turbopack_exports = {};
|
|
698
698
|
__export(turbopack_exports, {
|
|
@@ -755,6 +755,16 @@ __export(host_exports, {
|
|
|
755
755
|
module.exports = __toCommonJS(host_exports);
|
|
756
756
|
var import_client = require("react-dom/client");
|
|
757
757
|
|
|
758
|
+
// src/shared/client/component-loader.ts
|
|
759
|
+
var React = __toESM(require("react"), 1);
|
|
760
|
+
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
761
|
+
var ReactDOMClient = __toESM(require("react-dom/client"), 1);
|
|
762
|
+
var JSXDevRuntime = __toESM(require("react/jsx-dev-runtime"), 1);
|
|
763
|
+
var JSXRuntime = __toESM(require("react/jsx-runtime"), 1);
|
|
764
|
+
init_shared_modules();
|
|
765
|
+
init_next_client_pages_loader();
|
|
766
|
+
init_webpack_adapter();
|
|
767
|
+
|
|
758
768
|
// src/shared/client/rsc.ts
|
|
759
769
|
var import_web_streams_polyfill = require("web-streams-polyfill");
|
|
760
770
|
function fixPayload(payload) {
|
|
@@ -820,6 +830,10 @@ function createRSCStream(name, data) {
|
|
|
820
830
|
});
|
|
821
831
|
}
|
|
822
832
|
|
|
833
|
+
// src/shared/client/remote-component.ts
|
|
834
|
+
init_webpack_adapter();
|
|
835
|
+
init_const();
|
|
836
|
+
|
|
823
837
|
// src/html/host/runtime/index.ts
|
|
824
838
|
async function getRuntime(type, url, bundle, shared, remoteShared) {
|
|
825
839
|
if (typeof globalThis.process === "undefined") {
|