remote-components 0.2.0 → 0.2.1
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/config/nextjs.cjs +1 -1
- package/dist/config/nextjs.cjs.map +1 -1
- package/dist/config/nextjs.js +1 -1
- package/dist/config/nextjs.js.map +1 -1
- package/dist/host/html.cjs +19 -17
- package/dist/host/html.cjs.map +1 -1
- package/dist/host/html.js +19 -17
- package/dist/host/html.js.map +1 -1
- package/dist/host/nextjs/app/client-only.cjs +17 -19
- package/dist/host/nextjs/app/client-only.cjs.map +1 -1
- package/dist/host/nextjs/app/client-only.js +17 -19
- package/dist/host/nextjs/app/client-only.js.map +1 -1
- package/dist/host/react.cjs +17 -15
- package/dist/host/react.cjs.map +1 -1
- package/dist/host/react.js +17 -15
- package/dist/host/react.js.map +1 -1
- package/dist/internal/config/webpack/apply-shared-modules.cjs +6 -2
- package/dist/internal/config/webpack/apply-shared-modules.cjs.map +1 -1
- package/dist/internal/config/webpack/apply-shared-modules.js +6 -2
- package/dist/internal/config/webpack/apply-shared-modules.js.map +1 -1
- package/dist/internal/runtime/loaders/script-loader.cjs +1 -6
- package/dist/internal/runtime/loaders/script-loader.cjs.map +1 -1
- package/dist/internal/runtime/loaders/script-loader.js +4 -9
- package/dist/internal/runtime/loaders/script-loader.js.map +1 -1
- package/dist/internal/runtime/turbopack/chunk-loader.cjs +1 -6
- package/dist/internal/runtime/turbopack/chunk-loader.cjs.map +1 -1
- package/dist/internal/runtime/turbopack/chunk-loader.js +4 -9
- package/dist/internal/runtime/turbopack/chunk-loader.js.map +1 -1
- package/dist/internal/runtime/turbopack/shared-modules.cjs +3 -2
- package/dist/internal/runtime/turbopack/shared-modules.cjs.map +1 -1
- package/dist/internal/runtime/turbopack/shared-modules.js +3 -2
- package/dist/internal/runtime/turbopack/shared-modules.js.map +1 -1
- package/dist/internal/utils/error.cjs +7 -0
- package/dist/internal/utils/error.cjs.map +1 -1
- package/dist/internal/utils/error.d.ts +2 -1
- package/dist/internal/utils/error.js +6 -0
- package/dist/internal/utils/error.js.map +1 -1
- package/dist/internal/utils/logger.cjs +1 -1
- package/dist/internal/utils/logger.cjs.map +1 -1
- package/dist/internal/utils/logger.d.ts +1 -1
- package/dist/internal/utils/logger.js +1 -1
- package/dist/internal/utils/logger.js.map +1 -1
- package/dist/remote/html.cjs +1 -1
- package/dist/remote/html.cjs.map +1 -1
- package/dist/remote/html.js +1 -1
- package/dist/remote/html.js.map +1 -1
- package/package.json +1 -1
package/dist/host/html.js
CHANGED
|
@@ -101,6 +101,11 @@ async function errorFromFailedFetch(originalUrl, resolvedUrl, res) {
|
|
|
101
101
|
}
|
|
102
102
|
return fallback;
|
|
103
103
|
}
|
|
104
|
+
function failedProxiedAssetError(kind, url, resolvedUrl) {
|
|
105
|
+
return new RemoteComponentsError(
|
|
106
|
+
`Failed to load ${kind} "${url}" via proxy "${resolvedUrl}". Ensure withRemoteComponentsHostProxy middleware is configured, "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" is in the matcher, and the remote URL is included in allowedProxyUrls. See: ${CORS_DOCS_URL}`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
104
109
|
function failedProxyFetchError(originalUrl, proxyUrl, status, responseBody) {
|
|
105
110
|
if (status === 404) {
|
|
106
111
|
return new RemoteComponentsError(
|
|
@@ -166,7 +171,7 @@ function warnCrossOriginFetchError(logLocation, url) {
|
|
|
166
171
|
}
|
|
167
172
|
logWarn(
|
|
168
173
|
logLocation,
|
|
169
|
-
`Failed to fetch cross-origin resource "${parsed.href}".
|
|
174
|
+
`Failed to fetch cross-origin resource "${parsed.href}". To load assets from a protected deployment, two steps are required: (1) configure withRemoteComponentsHostProxy middleware in your host with the remote URL in allowedProxyUrls, and (2) provide a resolveClientUrl prop that rewrites cross-origin asset URLs to go through the proxy. See: ${CORS_DOCS_URL}`
|
|
170
175
|
);
|
|
171
176
|
} catch {
|
|
172
177
|
}
|
|
@@ -254,23 +259,28 @@ function applySharedModules(bundle, resolve) {
|
|
|
254
259
|
} else {
|
|
255
260
|
logWarn(
|
|
256
261
|
"SharedModules",
|
|
257
|
-
`webpackBundle.m is not available for bundle "${bundle}"`
|
|
262
|
+
`webpackBundle.m is not available for bundle "${bundle}" \u2014 ${DEDUPLICATION_SKIPPED}`
|
|
258
263
|
);
|
|
259
264
|
}
|
|
260
265
|
}
|
|
261
266
|
}
|
|
262
267
|
} else {
|
|
263
|
-
logWarn(
|
|
268
|
+
logWarn(
|
|
269
|
+
"SharedModules",
|
|
270
|
+
`No webpack require found for bundle "${bundle}" \u2014 ${DEDUPLICATION_SKIPPED}`
|
|
271
|
+
);
|
|
264
272
|
logDebug(
|
|
265
273
|
"SharedModules",
|
|
266
274
|
`Available bundles: ${Object.keys(self.__remote_webpack_require__ ?? {})}`
|
|
267
275
|
);
|
|
268
276
|
}
|
|
269
277
|
}
|
|
278
|
+
var DEDUPLICATION_SKIPPED;
|
|
270
279
|
var init_apply_shared_modules = __esm({
|
|
271
280
|
"src/config/webpack/apply-shared-modules.ts"() {
|
|
272
281
|
"use strict";
|
|
273
282
|
init_logger();
|
|
283
|
+
DEDUPLICATION_SKIPPED = "shared module deduplication skipped. The remote may load its own copy of shared dependencies.";
|
|
274
284
|
}
|
|
275
285
|
});
|
|
276
286
|
|
|
@@ -612,11 +622,7 @@ async function loadScripts(scripts, resolveClientUrl) {
|
|
|
612
622
|
newScript.onerror = () => {
|
|
613
623
|
const isProxied = isProxiedUrl(resolvedSrc);
|
|
614
624
|
if (isProxied) {
|
|
615
|
-
reject(
|
|
616
|
-
new RemoteComponentsError(
|
|
617
|
-
`Failed to load script "${newSrc}" via proxy "${resolvedSrc}". Ensure withRemoteComponentsHostProxy middleware is configured and "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" is in the matcher. See: ${CORS_DOCS_URL}`
|
|
618
|
-
)
|
|
619
|
-
);
|
|
625
|
+
reject(failedProxiedAssetError("script", newSrc, resolvedSrc));
|
|
620
626
|
} else {
|
|
621
627
|
warnCrossOriginFetchError("ScriptLoader", newSrc);
|
|
622
628
|
reject(
|
|
@@ -638,7 +644,6 @@ var init_script_loader = __esm({
|
|
|
638
644
|
"use strict";
|
|
639
645
|
init_constants2();
|
|
640
646
|
init_protected_rc_fallback();
|
|
641
|
-
init_constants();
|
|
642
647
|
init_error();
|
|
643
648
|
init_logger();
|
|
644
649
|
}
|
|
@@ -818,11 +823,7 @@ function createChunkLoader(runtime, resolveClientUrl) {
|
|
|
818
823
|
}).then(resolve).catch((error) => {
|
|
819
824
|
const isProxied = isProxiedUrl(resolvedUrl);
|
|
820
825
|
if (isProxied) {
|
|
821
|
-
reject(
|
|
822
|
-
new RemoteComponentsError(
|
|
823
|
-
`Failed to load chunk "${url}" via proxy "${resolvedUrl}". Ensure withRemoteComponentsHostProxy middleware is configured and "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" is in the matcher. See: ${CORS_DOCS_URL}`
|
|
824
|
-
)
|
|
825
|
-
);
|
|
826
|
+
reject(failedProxiedAssetError("chunk", url, resolvedUrl));
|
|
826
827
|
} else {
|
|
827
828
|
warnCrossOriginFetchError("ChunkLoader", url);
|
|
828
829
|
reject(error);
|
|
@@ -974,7 +975,6 @@ var init_chunk_loader = __esm({
|
|
|
974
975
|
"use strict";
|
|
975
976
|
init_constants2();
|
|
976
977
|
init_protected_rc_fallback();
|
|
977
|
-
init_constants();
|
|
978
978
|
init_error();
|
|
979
979
|
init_logger();
|
|
980
980
|
init_patterns();
|
|
@@ -1268,7 +1268,7 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
1268
1268
|
} else {
|
|
1269
1269
|
logError(
|
|
1270
1270
|
"SharedModules",
|
|
1271
|
-
`Host shared module "${module}" not found for ID ${id}`
|
|
1271
|
+
`Host shared module "${module}" not found for ID ${id}. ${DEDUPLICATION_WARNING}`
|
|
1272
1272
|
);
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
@@ -1285,7 +1285,7 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
|
|
|
1285
1285
|
} else {
|
|
1286
1286
|
logError(
|
|
1287
1287
|
"SharedModules",
|
|
1288
|
-
`Shared module "${module}" not found for "${bundle}"`
|
|
1288
|
+
`Shared module "${module}" not found for "${bundle}". ${DEDUPLICATION_WARNING}`
|
|
1289
1289
|
);
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
@@ -1336,6 +1336,7 @@ function getSharedModule(bundle, id) {
|
|
|
1336
1336
|
}
|
|
1337
1337
|
return null;
|
|
1338
1338
|
}
|
|
1339
|
+
var DEDUPLICATION_WARNING;
|
|
1339
1340
|
var init_shared_modules = __esm({
|
|
1340
1341
|
"src/runtime/turbopack/shared-modules.ts"() {
|
|
1341
1342
|
"use strict";
|
|
@@ -1343,6 +1344,7 @@ var init_shared_modules = __esm({
|
|
|
1343
1344
|
init_logger();
|
|
1344
1345
|
init_module();
|
|
1345
1346
|
init_patterns();
|
|
1347
|
+
DEDUPLICATION_WARNING = "This module will not be deduplicated \u2014 the remote may load its own copy, which can cause duplicate instance errors (e.g. invalid hook calls if React is loaded twice).";
|
|
1346
1348
|
}
|
|
1347
1349
|
});
|
|
1348
1350
|
|