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.cjs
CHANGED
|
@@ -30,38 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// src/shared/webpack/shared-modules.ts
|
|
34
|
-
function applySharedModules(bundle, resolve) {
|
|
35
|
-
const self = globalThis;
|
|
36
|
-
if (self.__remote_webpack_require__?.[bundle]) {
|
|
37
|
-
const modulePaths = Object.keys(
|
|
38
|
-
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
39
|
-
);
|
|
40
|
-
for (const [key, value] of Object.entries(resolve)) {
|
|
41
|
-
let ids = modulePaths.filter((p) => p === key);
|
|
42
|
-
if (ids.length === 0) {
|
|
43
|
-
ids = modulePaths.filter((p) => p.includes(key));
|
|
44
|
-
}
|
|
45
|
-
for (let id of ids) {
|
|
46
|
-
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
47
|
-
if (webpackBundle.m) {
|
|
48
|
-
if (self.__remote_webpack_module_map__?.[bundle]?.[id]) {
|
|
49
|
-
id = `${self.__remote_webpack_module_map__[bundle][id]}`;
|
|
50
|
-
}
|
|
51
|
-
webpackBundle.m[id] = (module2) => {
|
|
52
|
-
module2.exports = value;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
var init_shared_modules = __esm({
|
|
60
|
-
"src/shared/webpack/shared-modules.ts"() {
|
|
61
|
-
"use strict";
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
33
|
// src/shared/error.ts
|
|
66
34
|
function multipleRemoteComponentsError(url) {
|
|
67
35
|
return new Error(
|
|
@@ -79,9 +47,9 @@ var init_error = __esm({
|
|
|
79
47
|
"src/shared/error.ts"() {
|
|
80
48
|
"use strict";
|
|
81
49
|
RemoteComponentsError = class extends Error {
|
|
50
|
+
code = "REMOTE_COMPONENTS_ERROR";
|
|
82
51
|
constructor(message, options) {
|
|
83
52
|
super(message, options);
|
|
84
|
-
this.code = "REMOTE_COMPONENTS_ERROR";
|
|
85
53
|
this.name = "RemoteComponentsError";
|
|
86
54
|
}
|
|
87
55
|
};
|
|
@@ -206,6 +174,38 @@ var init_next_client_pages_loader = __esm({
|
|
|
206
174
|
}
|
|
207
175
|
});
|
|
208
176
|
|
|
177
|
+
// src/shared/webpack/shared-modules.ts
|
|
178
|
+
function applySharedModules(bundle, resolve) {
|
|
179
|
+
const self = globalThis;
|
|
180
|
+
if (self.__remote_webpack_require__?.[bundle]) {
|
|
181
|
+
const modulePaths = Object.keys(
|
|
182
|
+
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
183
|
+
);
|
|
184
|
+
for (const [key, value] of Object.entries(resolve)) {
|
|
185
|
+
let ids = modulePaths.filter((p) => p === key);
|
|
186
|
+
if (ids.length === 0) {
|
|
187
|
+
ids = modulePaths.filter((p) => p.includes(key));
|
|
188
|
+
}
|
|
189
|
+
for (let id of ids) {
|
|
190
|
+
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
191
|
+
if (webpackBundle.m) {
|
|
192
|
+
if (self.__remote_webpack_module_map__?.[bundle]?.[id]) {
|
|
193
|
+
id = `${self.__remote_webpack_module_map__[bundle][id]}`;
|
|
194
|
+
}
|
|
195
|
+
webpackBundle.m[id] = (module2) => {
|
|
196
|
+
module2.exports = value;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
var init_shared_modules = __esm({
|
|
204
|
+
"src/shared/webpack/shared-modules.ts"() {
|
|
205
|
+
"use strict";
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
209
|
// src/shared/utils/index.ts
|
|
210
210
|
function escapeString(str) {
|
|
211
211
|
return str.replace(/[^a-z0-9]/g, "_");
|
|
@@ -394,7 +394,10 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
394
394
|
function createModuleRequire(runtime) {
|
|
395
395
|
return (id) => {
|
|
396
396
|
const self = globalThis;
|
|
397
|
-
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
397
|
+
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
398
|
+
bundle: "default",
|
|
399
|
+
id
|
|
400
|
+
};
|
|
398
401
|
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
399
402
|
try {
|
|
400
403
|
if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
|
|
@@ -1144,10 +1147,10 @@ async function webpackRuntime(bundle, shared, remoteShared) {
|
|
|
1144
1147
|
var init_webpack = __esm({
|
|
1145
1148
|
"src/html/host/runtime/webpack.ts"() {
|
|
1146
1149
|
"use strict";
|
|
1150
|
+
init_polyfill();
|
|
1147
1151
|
init_error();
|
|
1148
|
-
init_shared_modules();
|
|
1149
1152
|
init_next_client_pages_loader();
|
|
1150
|
-
|
|
1153
|
+
init_shared_modules();
|
|
1151
1154
|
}
|
|
1152
1155
|
});
|
|
1153
1156
|
|
|
@@ -1198,10 +1201,10 @@ async function turbopackRuntime(url, bundle, shared, remoteShared) {
|
|
|
1198
1201
|
var init_turbopack = __esm({
|
|
1199
1202
|
"src/html/host/runtime/turbopack.ts"() {
|
|
1200
1203
|
"use strict";
|
|
1201
|
-
init_shared_modules();
|
|
1202
|
-
init_next_client_pages_loader();
|
|
1203
|
-
init_webpack_adapter();
|
|
1204
1204
|
init_polyfill();
|
|
1205
|
+
init_webpack_adapter();
|
|
1206
|
+
init_next_client_pages_loader();
|
|
1207
|
+
init_shared_modules();
|
|
1205
1208
|
}
|
|
1206
1209
|
});
|
|
1207
1210
|
|
|
@@ -1239,19 +1242,75 @@ module.exports = __toCommonJS(host_exports);
|
|
|
1239
1242
|
var import_react = require("react");
|
|
1240
1243
|
var import_client = require("react-dom/client");
|
|
1241
1244
|
|
|
1245
|
+
// src/shared/client/apply-origin.ts
|
|
1246
|
+
var tagNames = [
|
|
1247
|
+
"img",
|
|
1248
|
+
"source",
|
|
1249
|
+
"video",
|
|
1250
|
+
"audio",
|
|
1251
|
+
"track",
|
|
1252
|
+
"iframe",
|
|
1253
|
+
"embed",
|
|
1254
|
+
"script",
|
|
1255
|
+
"link"
|
|
1256
|
+
];
|
|
1257
|
+
function applyOriginToNodes(doc, url) {
|
|
1258
|
+
if (url.origin !== location.origin) {
|
|
1259
|
+
const nodes = doc.querySelectorAll(
|
|
1260
|
+
tagNames.map(
|
|
1261
|
+
(type) => `${type}[src],${type}[srcset],${type}[href],${type}[imagesrcset]`
|
|
1262
|
+
).join(",")
|
|
1263
|
+
);
|
|
1264
|
+
nodes.forEach((node) => {
|
|
1265
|
+
if (node.hasAttribute("src") && /^[./]+\/?/.test(node.getAttribute("src") ?? "")) {
|
|
1266
|
+
node.src = new URL(node.getAttribute("src") ?? "/", url).href;
|
|
1267
|
+
}
|
|
1268
|
+
if (node.hasAttribute("href") && /^[./]+\/?/.test(node.getAttribute("href") ?? "")) {
|
|
1269
|
+
node.setAttribute(
|
|
1270
|
+
"href",
|
|
1271
|
+
new URL(node.getAttribute("href") ?? "/", url).href
|
|
1272
|
+
);
|
|
1273
|
+
}
|
|
1274
|
+
if (node.hasAttribute("srcset")) {
|
|
1275
|
+
const srcSet = node.getAttribute("srcset")?.split(",").map((entry) => {
|
|
1276
|
+
const [urlPart, descriptor] = entry.trim().split(/\s+/);
|
|
1277
|
+
if (!urlPart)
|
|
1278
|
+
return entry;
|
|
1279
|
+
const absoluteUrl = new URL(urlPart, url).href;
|
|
1280
|
+
return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
|
|
1281
|
+
}).join(", ");
|
|
1282
|
+
if (srcSet) {
|
|
1283
|
+
node.setAttribute("srcset", srcSet);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
if (node.hasAttribute("imagesrcset")) {
|
|
1287
|
+
const srcSet = node.getAttribute("imagesrcset")?.split(",").map((entry) => {
|
|
1288
|
+
const [urlPart, descriptor] = entry.trim().split(/\s+/);
|
|
1289
|
+
if (!urlPart)
|
|
1290
|
+
return entry;
|
|
1291
|
+
const absoluteUrl = new URL(urlPart, url).href;
|
|
1292
|
+
return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
|
|
1293
|
+
}).join(", ");
|
|
1294
|
+
if (srcSet) {
|
|
1295
|
+
node.setAttribute("imagesrcset", srcSet);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
// src/shared/client/remote-component.ts
|
|
1303
|
+
init_error();
|
|
1304
|
+
|
|
1242
1305
|
// src/shared/client/component-loader.ts
|
|
1243
1306
|
var React = __toESM(require("react"), 1);
|
|
1244
|
-
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
1245
|
-
var ReactDOMClient = __toESM(require("react-dom/client"), 1);
|
|
1246
1307
|
var JSXDevRuntime = __toESM(require("react/jsx-dev-runtime"), 1);
|
|
1247
1308
|
var JSXRuntime = __toESM(require("react/jsx-runtime"), 1);
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
init_error();
|
|
1251
|
-
init_webpack_adapter();
|
|
1252
|
-
|
|
1253
|
-
// src/shared/client/script-loader.ts
|
|
1309
|
+
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
1310
|
+
var ReactDOMClient = __toESM(require("react-dom/client"), 1);
|
|
1254
1311
|
init_error();
|
|
1312
|
+
init_next_client_pages_loader();
|
|
1313
|
+
init_shared_modules();
|
|
1255
1314
|
|
|
1256
1315
|
// src/shared/client/rsc.ts
|
|
1257
1316
|
var import_web_streams_polyfill = require("web-streams-polyfill");
|
|
@@ -1319,14 +1378,19 @@ function createRSCStream(rscName, data) {
|
|
|
1319
1378
|
});
|
|
1320
1379
|
}
|
|
1321
1380
|
|
|
1381
|
+
// src/shared/client/script-loader.ts
|
|
1382
|
+
init_error();
|
|
1383
|
+
|
|
1384
|
+
// src/shared/client/component-loader.ts
|
|
1385
|
+
init_webpack_adapter();
|
|
1386
|
+
|
|
1322
1387
|
// src/shared/client/remote-component.ts
|
|
1388
|
+
init_const();
|
|
1323
1389
|
init_static_loader();
|
|
1324
1390
|
init_webpack_adapter();
|
|
1325
|
-
init_const();
|
|
1326
|
-
init_error();
|
|
1327
1391
|
|
|
1328
1392
|
// src/html/host/index.tsx
|
|
1329
|
-
|
|
1393
|
+
init_error();
|
|
1330
1394
|
|
|
1331
1395
|
// src/shared/ssr/fetch-headers.ts
|
|
1332
1396
|
function remoteFetchHeaders(additionalHeaders) {
|
|
@@ -1346,65 +1410,8 @@ function remoteFetchHeaders(additionalHeaders) {
|
|
|
1346
1410
|
};
|
|
1347
1411
|
}
|
|
1348
1412
|
|
|
1349
|
-
// src/shared/client/apply-origin.ts
|
|
1350
|
-
var tagNames = [
|
|
1351
|
-
"img",
|
|
1352
|
-
"source",
|
|
1353
|
-
"video",
|
|
1354
|
-
"audio",
|
|
1355
|
-
"track",
|
|
1356
|
-
"iframe",
|
|
1357
|
-
"embed",
|
|
1358
|
-
"script",
|
|
1359
|
-
"link"
|
|
1360
|
-
];
|
|
1361
|
-
function applyOriginToNodes(doc, url) {
|
|
1362
|
-
if (url.origin !== location.origin) {
|
|
1363
|
-
const nodes = doc.querySelectorAll(
|
|
1364
|
-
tagNames.map(
|
|
1365
|
-
(type) => `${type}[src],${type}[srcset],${type}[href],${type}[imagesrcset]`
|
|
1366
|
-
).join(",")
|
|
1367
|
-
);
|
|
1368
|
-
nodes.forEach((node) => {
|
|
1369
|
-
if (node.hasAttribute("src") && /^[./]+\/?/.test(node.getAttribute("src") ?? "")) {
|
|
1370
|
-
node.src = new URL(node.getAttribute("src") ?? "/", url).href;
|
|
1371
|
-
}
|
|
1372
|
-
if (node.hasAttribute("href") && /^[./]+\/?/.test(node.getAttribute("href") ?? "")) {
|
|
1373
|
-
node.setAttribute(
|
|
1374
|
-
"href",
|
|
1375
|
-
new URL(node.getAttribute("href") ?? "/", url).href
|
|
1376
|
-
);
|
|
1377
|
-
}
|
|
1378
|
-
if (node.hasAttribute("srcset")) {
|
|
1379
|
-
const srcSet = node.getAttribute("srcset")?.split(",").map((entry) => {
|
|
1380
|
-
const [urlPart, descriptor] = entry.trim().split(/\s+/);
|
|
1381
|
-
if (!urlPart)
|
|
1382
|
-
return entry;
|
|
1383
|
-
const absoluteUrl = new URL(urlPart, url).href;
|
|
1384
|
-
return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
|
|
1385
|
-
}).join(", ");
|
|
1386
|
-
if (srcSet) {
|
|
1387
|
-
node.setAttribute("srcset", srcSet);
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
if (node.hasAttribute("imagesrcset")) {
|
|
1391
|
-
const srcSet = node.getAttribute("imagesrcset")?.split(",").map((entry) => {
|
|
1392
|
-
const [urlPart, descriptor] = entry.trim().split(/\s+/);
|
|
1393
|
-
if (!urlPart)
|
|
1394
|
-
return entry;
|
|
1395
|
-
const absoluteUrl = new URL(urlPart, url).href;
|
|
1396
|
-
return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
|
|
1397
|
-
}).join(", ");
|
|
1398
|
-
if (srcSet) {
|
|
1399
|
-
node.setAttribute("imagesrcset", srcSet);
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
});
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
1413
|
// src/html/host/index.tsx
|
|
1407
|
-
|
|
1414
|
+
init_utils();
|
|
1408
1415
|
|
|
1409
1416
|
// src/html/host/runtime/index.ts
|
|
1410
1417
|
init_error();
|
|
@@ -1433,14 +1440,17 @@ async function getRuntime(type, url, bundle, shared, remoteShared) {
|
|
|
1433
1440
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1434
1441
|
if (typeof HTMLElement !== "undefined") {
|
|
1435
1442
|
class RemoteComponent extends HTMLElement {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1443
|
+
name;
|
|
1444
|
+
bundle;
|
|
1445
|
+
fallbackSlot;
|
|
1446
|
+
__next = null;
|
|
1447
|
+
fouc = null;
|
|
1448
|
+
isLoading = false;
|
|
1449
|
+
prevIsRemoteComponent = false;
|
|
1450
|
+
prevUrl;
|
|
1451
|
+
root = null;
|
|
1452
|
+
reactRoot;
|
|
1453
|
+
additionalHeaders;
|
|
1444
1454
|
static get observedAttributes() {
|
|
1445
1455
|
return ["src", "name", "mode"];
|
|
1446
1456
|
}
|
|
@@ -1903,7 +1913,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1903
1913
|
});
|
|
1904
1914
|
}
|
|
1905
1915
|
remoteComponent.isLoading = false;
|
|
1906
|
-
}, [initial]);
|
|
1916
|
+
}, [initial, remoteComponent]);
|
|
1907
1917
|
return NextApp ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NextApp, { Component: NextComponent, ...nextData.props }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NextComponent, { ...nextData.props });
|
|
1908
1918
|
})(App, Component, this);
|
|
1909
1919
|
if (this.reactRoot) {
|