remote-components 0.0.34 → 0.0.35
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 +127 -117
- package/dist/html/host.cjs.map +1 -1
- package/dist/html/host.js +127 -117
- package/dist/html/host.js.map +1 -1
- package/dist/html/remote.cjs +4 -3
- package/dist/html/remote.cjs.map +1 -1
- package/dist/html/remote.js +4 -3
- package/dist/html/remote.js.map +1 -1
- package/dist/internal/next/host/app-router-client.cjs +4 -15
- package/dist/internal/next/host/app-router-client.cjs.map +1 -1
- package/dist/internal/next/host/app-router-client.js +10 -21
- package/dist/internal/next/host/app-router-client.js.map +1 -1
- package/dist/internal/next/host/app-router-compat.cjs.map +1 -1
- package/dist/internal/next/host/app-router-compat.d.ts +1 -1
- package/dist/internal/next/host/app-router-compat.js.map +1 -1
- package/dist/internal/next/remote/render-server.cjs +1 -1
- package/dist/internal/next/remote/render-server.cjs.map +1 -1
- package/dist/internal/next/remote/render-server.js +1 -1
- package/dist/internal/next/remote/render-server.js.map +1 -1
- package/dist/internal/shared/client/polyfill.cjs.map +1 -1
- package/dist/internal/shared/client/polyfill.js.map +1 -1
- package/dist/internal/shared/client/remote-component.cjs +179 -174
- package/dist/internal/shared/client/remote-component.cjs.map +1 -1
- package/dist/internal/shared/client/remote-component.d.ts +23 -23
- package/dist/internal/shared/client/remote-component.js +179 -174
- package/dist/internal/shared/client/remote-component.js.map +1 -1
- package/dist/internal/shared/error.cjs +1 -1
- package/dist/internal/shared/error.cjs.map +1 -1
- package/dist/internal/shared/error.js +1 -1
- package/dist/internal/shared/error.js.map +1 -1
- package/dist/internal/shared/ssr/dom-flight.cjs +7 -3
- package/dist/internal/shared/ssr/dom-flight.cjs.map +1 -1
- package/dist/internal/shared/ssr/dom-flight.js +7 -3
- package/dist/internal/shared/ssr/dom-flight.js.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.cjs +2 -2
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.js +3 -3
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -1
- package/dist/next/config.cjs +100 -86
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.js +100 -86
- package/dist/next/config.js.map +1 -1
- package/dist/next/host/app-router-server.cjs.map +1 -1
- package/dist/next/host/app-router-server.js +1 -1
- package/dist/next/host/app-router-server.js.map +1 -1
- package/dist/next/host/client/index.cjs +723 -718
- package/dist/next/host/client/index.cjs.map +1 -1
- package/dist/next/host/client/index.js +727 -722
- package/dist/next/host/client/index.js.map +1 -1
- package/dist/next/host/pages-router-server.cjs +4 -4
- package/dist/next/host/pages-router-server.cjs.map +1 -1
- package/dist/next/host/pages-router-server.js +4 -4
- package/dist/next/host/pages-router-server.js.map +1 -1
- package/dist/next/{middleware.cjs → proxy.cjs} +24 -14
- package/dist/next/proxy.cjs.map +1 -0
- package/dist/next/proxy.d.ts +29 -0
- package/dist/next/{middleware.js → proxy.js} +21 -11
- package/dist/next/proxy.js.map +1 -0
- package/dist/react/index.cjs +4 -4
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +11 -11
- package/dist/react/index.js.map +1 -1
- package/package.json +15 -9
- package/dist/next/middleware.cjs.map +0 -1
- package/dist/next/middleware.d.ts +0 -29
- package/dist/next/middleware.js.map +0 -1
package/dist/html/host.js
CHANGED
|
@@ -8,38 +8,6 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
// src/shared/webpack/shared-modules.ts
|
|
12
|
-
function applySharedModules(bundle, resolve) {
|
|
13
|
-
const self = globalThis;
|
|
14
|
-
if (self.__remote_webpack_require__?.[bundle]) {
|
|
15
|
-
const modulePaths = Object.keys(
|
|
16
|
-
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
17
|
-
);
|
|
18
|
-
for (const [key, value] of Object.entries(resolve)) {
|
|
19
|
-
let ids = modulePaths.filter((p) => p === key);
|
|
20
|
-
if (ids.length === 0) {
|
|
21
|
-
ids = modulePaths.filter((p) => p.includes(key));
|
|
22
|
-
}
|
|
23
|
-
for (let id of ids) {
|
|
24
|
-
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
25
|
-
if (webpackBundle.m) {
|
|
26
|
-
if (self.__remote_webpack_module_map__?.[bundle]?.[id]) {
|
|
27
|
-
id = `${self.__remote_webpack_module_map__[bundle][id]}`;
|
|
28
|
-
}
|
|
29
|
-
webpackBundle.m[id] = (module) => {
|
|
30
|
-
module.exports = value;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
var init_shared_modules = __esm({
|
|
38
|
-
"src/shared/webpack/shared-modules.ts"() {
|
|
39
|
-
"use strict";
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
11
|
// src/shared/error.ts
|
|
44
12
|
function multipleRemoteComponentsError(url) {
|
|
45
13
|
return new Error(
|
|
@@ -57,9 +25,9 @@ var init_error = __esm({
|
|
|
57
25
|
"src/shared/error.ts"() {
|
|
58
26
|
"use strict";
|
|
59
27
|
RemoteComponentsError = class extends Error {
|
|
28
|
+
code = "REMOTE_COMPONENTS_ERROR";
|
|
60
29
|
constructor(message, options) {
|
|
61
30
|
super(message, options);
|
|
62
|
-
this.code = "REMOTE_COMPONENTS_ERROR";
|
|
63
31
|
this.name = "RemoteComponentsError";
|
|
64
32
|
}
|
|
65
33
|
};
|
|
@@ -184,6 +152,38 @@ var init_next_client_pages_loader = __esm({
|
|
|
184
152
|
}
|
|
185
153
|
});
|
|
186
154
|
|
|
155
|
+
// src/shared/webpack/shared-modules.ts
|
|
156
|
+
function applySharedModules(bundle, resolve) {
|
|
157
|
+
const self = globalThis;
|
|
158
|
+
if (self.__remote_webpack_require__?.[bundle]) {
|
|
159
|
+
const modulePaths = Object.keys(
|
|
160
|
+
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
161
|
+
);
|
|
162
|
+
for (const [key, value] of Object.entries(resolve)) {
|
|
163
|
+
let ids = modulePaths.filter((p) => p === key);
|
|
164
|
+
if (ids.length === 0) {
|
|
165
|
+
ids = modulePaths.filter((p) => p.includes(key));
|
|
166
|
+
}
|
|
167
|
+
for (let id of ids) {
|
|
168
|
+
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
169
|
+
if (webpackBundle.m) {
|
|
170
|
+
if (self.__remote_webpack_module_map__?.[bundle]?.[id]) {
|
|
171
|
+
id = `${self.__remote_webpack_module_map__[bundle][id]}`;
|
|
172
|
+
}
|
|
173
|
+
webpackBundle.m[id] = (module) => {
|
|
174
|
+
module.exports = value;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
var init_shared_modules = __esm({
|
|
182
|
+
"src/shared/webpack/shared-modules.ts"() {
|
|
183
|
+
"use strict";
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
187
|
// src/shared/utils/index.ts
|
|
188
188
|
function escapeString(str) {
|
|
189
189
|
return str.replace(/[^a-z0-9]/g, "_");
|
|
@@ -372,7 +372,10 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
372
372
|
function createModuleRequire(runtime) {
|
|
373
373
|
return (id) => {
|
|
374
374
|
const self = globalThis;
|
|
375
|
-
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
375
|
+
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
376
|
+
bundle: "default",
|
|
377
|
+
id
|
|
378
|
+
};
|
|
376
379
|
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
377
380
|
try {
|
|
378
381
|
if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
|
|
@@ -1124,10 +1127,10 @@ async function webpackRuntime(bundle, shared, remoteShared) {
|
|
|
1124
1127
|
var init_webpack = __esm({
|
|
1125
1128
|
"src/html/host/runtime/webpack.ts"() {
|
|
1126
1129
|
"use strict";
|
|
1130
|
+
init_polyfill();
|
|
1127
1131
|
init_error();
|
|
1128
|
-
init_shared_modules();
|
|
1129
1132
|
init_next_client_pages_loader();
|
|
1130
|
-
|
|
1133
|
+
init_shared_modules();
|
|
1131
1134
|
}
|
|
1132
1135
|
});
|
|
1133
1136
|
|
|
@@ -1178,10 +1181,10 @@ async function turbopackRuntime(url, bundle, shared, remoteShared) {
|
|
|
1178
1181
|
var init_turbopack = __esm({
|
|
1179
1182
|
"src/html/host/runtime/turbopack.ts"() {
|
|
1180
1183
|
"use strict";
|
|
1181
|
-
init_shared_modules();
|
|
1182
|
-
init_next_client_pages_loader();
|
|
1183
|
-
init_webpack_adapter();
|
|
1184
1184
|
init_polyfill();
|
|
1185
|
+
init_webpack_adapter();
|
|
1186
|
+
init_next_client_pages_loader();
|
|
1187
|
+
init_shared_modules();
|
|
1185
1188
|
}
|
|
1186
1189
|
});
|
|
1187
1190
|
|
|
@@ -1214,19 +1217,75 @@ var init_script = __esm({
|
|
|
1214
1217
|
import { startTransition, useLayoutEffect } from "react";
|
|
1215
1218
|
import { hydrateRoot } from "react-dom/client";
|
|
1216
1219
|
|
|
1220
|
+
// src/shared/client/apply-origin.ts
|
|
1221
|
+
var tagNames = [
|
|
1222
|
+
"img",
|
|
1223
|
+
"source",
|
|
1224
|
+
"video",
|
|
1225
|
+
"audio",
|
|
1226
|
+
"track",
|
|
1227
|
+
"iframe",
|
|
1228
|
+
"embed",
|
|
1229
|
+
"script",
|
|
1230
|
+
"link"
|
|
1231
|
+
];
|
|
1232
|
+
function applyOriginToNodes(doc, url) {
|
|
1233
|
+
if (url.origin !== location.origin) {
|
|
1234
|
+
const nodes = doc.querySelectorAll(
|
|
1235
|
+
tagNames.map(
|
|
1236
|
+
(type) => `${type}[src],${type}[srcset],${type}[href],${type}[imagesrcset]`
|
|
1237
|
+
).join(",")
|
|
1238
|
+
);
|
|
1239
|
+
nodes.forEach((node) => {
|
|
1240
|
+
if (node.hasAttribute("src") && /^[./]+\/?/.test(node.getAttribute("src") ?? "")) {
|
|
1241
|
+
node.src = new URL(node.getAttribute("src") ?? "/", url).href;
|
|
1242
|
+
}
|
|
1243
|
+
if (node.hasAttribute("href") && /^[./]+\/?/.test(node.getAttribute("href") ?? "")) {
|
|
1244
|
+
node.setAttribute(
|
|
1245
|
+
"href",
|
|
1246
|
+
new URL(node.getAttribute("href") ?? "/", url).href
|
|
1247
|
+
);
|
|
1248
|
+
}
|
|
1249
|
+
if (node.hasAttribute("srcset")) {
|
|
1250
|
+
const srcSet = node.getAttribute("srcset")?.split(",").map((entry) => {
|
|
1251
|
+
const [urlPart, descriptor] = entry.trim().split(/\s+/);
|
|
1252
|
+
if (!urlPart)
|
|
1253
|
+
return entry;
|
|
1254
|
+
const absoluteUrl = new URL(urlPart, url).href;
|
|
1255
|
+
return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
|
|
1256
|
+
}).join(", ");
|
|
1257
|
+
if (srcSet) {
|
|
1258
|
+
node.setAttribute("srcset", srcSet);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
if (node.hasAttribute("imagesrcset")) {
|
|
1262
|
+
const srcSet = node.getAttribute("imagesrcset")?.split(",").map((entry) => {
|
|
1263
|
+
const [urlPart, descriptor] = entry.trim().split(/\s+/);
|
|
1264
|
+
if (!urlPart)
|
|
1265
|
+
return entry;
|
|
1266
|
+
const absoluteUrl = new URL(urlPart, url).href;
|
|
1267
|
+
return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
|
|
1268
|
+
}).join(", ");
|
|
1269
|
+
if (srcSet) {
|
|
1270
|
+
node.setAttribute("imagesrcset", srcSet);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
// src/shared/client/remote-component.ts
|
|
1278
|
+
init_error();
|
|
1279
|
+
|
|
1217
1280
|
// src/shared/client/component-loader.ts
|
|
1218
|
-
init_shared_modules();
|
|
1219
|
-
init_next_client_pages_loader();
|
|
1220
1281
|
init_error();
|
|
1221
|
-
|
|
1282
|
+
init_next_client_pages_loader();
|
|
1283
|
+
init_shared_modules();
|
|
1222
1284
|
import * as React from "react";
|
|
1223
|
-
import * as ReactDOM from "react-dom";
|
|
1224
|
-
import * as ReactDOMClient from "react-dom/client";
|
|
1225
1285
|
import * as JSXDevRuntime from "react/jsx-dev-runtime";
|
|
1226
1286
|
import * as JSXRuntime from "react/jsx-runtime";
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
init_error();
|
|
1287
|
+
import * as ReactDOM from "react-dom";
|
|
1288
|
+
import * as ReactDOMClient from "react-dom/client";
|
|
1230
1289
|
|
|
1231
1290
|
// src/shared/client/rsc.ts
|
|
1232
1291
|
import { ReadableStream } from "web-streams-polyfill";
|
|
@@ -1294,14 +1353,19 @@ function createRSCStream(rscName, data) {
|
|
|
1294
1353
|
});
|
|
1295
1354
|
}
|
|
1296
1355
|
|
|
1356
|
+
// src/shared/client/script-loader.ts
|
|
1357
|
+
init_error();
|
|
1358
|
+
|
|
1359
|
+
// src/shared/client/component-loader.ts
|
|
1360
|
+
init_webpack_adapter();
|
|
1361
|
+
|
|
1297
1362
|
// src/shared/client/remote-component.ts
|
|
1363
|
+
init_const();
|
|
1298
1364
|
init_static_loader();
|
|
1299
1365
|
init_webpack_adapter();
|
|
1300
|
-
init_const();
|
|
1301
|
-
init_error();
|
|
1302
1366
|
|
|
1303
1367
|
// src/html/host/index.tsx
|
|
1304
|
-
|
|
1368
|
+
init_error();
|
|
1305
1369
|
|
|
1306
1370
|
// src/shared/ssr/fetch-headers.ts
|
|
1307
1371
|
function remoteFetchHeaders(additionalHeaders) {
|
|
@@ -1321,65 +1385,8 @@ function remoteFetchHeaders(additionalHeaders) {
|
|
|
1321
1385
|
};
|
|
1322
1386
|
}
|
|
1323
1387
|
|
|
1324
|
-
// src/shared/client/apply-origin.ts
|
|
1325
|
-
var tagNames = [
|
|
1326
|
-
"img",
|
|
1327
|
-
"source",
|
|
1328
|
-
"video",
|
|
1329
|
-
"audio",
|
|
1330
|
-
"track",
|
|
1331
|
-
"iframe",
|
|
1332
|
-
"embed",
|
|
1333
|
-
"script",
|
|
1334
|
-
"link"
|
|
1335
|
-
];
|
|
1336
|
-
function applyOriginToNodes(doc, url) {
|
|
1337
|
-
if (url.origin !== location.origin) {
|
|
1338
|
-
const nodes = doc.querySelectorAll(
|
|
1339
|
-
tagNames.map(
|
|
1340
|
-
(type) => `${type}[src],${type}[srcset],${type}[href],${type}[imagesrcset]`
|
|
1341
|
-
).join(",")
|
|
1342
|
-
);
|
|
1343
|
-
nodes.forEach((node) => {
|
|
1344
|
-
if (node.hasAttribute("src") && /^[./]+\/?/.test(node.getAttribute("src") ?? "")) {
|
|
1345
|
-
node.src = new URL(node.getAttribute("src") ?? "/", url).href;
|
|
1346
|
-
}
|
|
1347
|
-
if (node.hasAttribute("href") && /^[./]+\/?/.test(node.getAttribute("href") ?? "")) {
|
|
1348
|
-
node.setAttribute(
|
|
1349
|
-
"href",
|
|
1350
|
-
new URL(node.getAttribute("href") ?? "/", url).href
|
|
1351
|
-
);
|
|
1352
|
-
}
|
|
1353
|
-
if (node.hasAttribute("srcset")) {
|
|
1354
|
-
const srcSet = node.getAttribute("srcset")?.split(",").map((entry) => {
|
|
1355
|
-
const [urlPart, descriptor] = entry.trim().split(/\s+/);
|
|
1356
|
-
if (!urlPart)
|
|
1357
|
-
return entry;
|
|
1358
|
-
const absoluteUrl = new URL(urlPart, url).href;
|
|
1359
|
-
return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
|
|
1360
|
-
}).join(", ");
|
|
1361
|
-
if (srcSet) {
|
|
1362
|
-
node.setAttribute("srcset", srcSet);
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
if (node.hasAttribute("imagesrcset")) {
|
|
1366
|
-
const srcSet = node.getAttribute("imagesrcset")?.split(",").map((entry) => {
|
|
1367
|
-
const [urlPart, descriptor] = entry.trim().split(/\s+/);
|
|
1368
|
-
if (!urlPart)
|
|
1369
|
-
return entry;
|
|
1370
|
-
const absoluteUrl = new URL(urlPart, url).href;
|
|
1371
|
-
return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
|
|
1372
|
-
}).join(", ");
|
|
1373
|
-
if (srcSet) {
|
|
1374
|
-
node.setAttribute("imagesrcset", srcSet);
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
});
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
1388
|
// src/html/host/index.tsx
|
|
1382
|
-
|
|
1389
|
+
init_utils();
|
|
1383
1390
|
|
|
1384
1391
|
// src/html/host/runtime/index.ts
|
|
1385
1392
|
init_error();
|
|
@@ -1408,14 +1415,17 @@ async function getRuntime(type, url, bundle, shared, remoteShared) {
|
|
|
1408
1415
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
1409
1416
|
if (typeof HTMLElement !== "undefined") {
|
|
1410
1417
|
class RemoteComponent extends HTMLElement {
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1418
|
+
name;
|
|
1419
|
+
bundle;
|
|
1420
|
+
fallbackSlot;
|
|
1421
|
+
__next = null;
|
|
1422
|
+
fouc = null;
|
|
1423
|
+
isLoading = false;
|
|
1424
|
+
prevIsRemoteComponent = false;
|
|
1425
|
+
prevUrl;
|
|
1426
|
+
root = null;
|
|
1427
|
+
reactRoot;
|
|
1428
|
+
additionalHeaders;
|
|
1419
1429
|
static get observedAttributes() {
|
|
1420
1430
|
return ["src", "name", "mode"];
|
|
1421
1431
|
}
|
|
@@ -1878,7 +1888,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1878
1888
|
});
|
|
1879
1889
|
}
|
|
1880
1890
|
remoteComponent.isLoading = false;
|
|
1881
|
-
}, [initial]);
|
|
1891
|
+
}, [initial, remoteComponent]);
|
|
1882
1892
|
return NextApp ? /* @__PURE__ */ jsx2(NextApp, { Component: NextComponent, ...nextData.props }) : /* @__PURE__ */ jsx2(NextComponent, { ...nextData.props });
|
|
1883
1893
|
})(App, Component, this);
|
|
1884
1894
|
if (this.reactRoot) {
|