remote-components 0.2.0 → 0.2.2

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.
Files changed (80) hide show
  1. package/dist/config/nextjs.cjs +1 -1
  2. package/dist/config/nextjs.cjs.map +1 -1
  3. package/dist/config/nextjs.js +1 -1
  4. package/dist/config/nextjs.js.map +1 -1
  5. package/dist/host/html.cjs +19 -17
  6. package/dist/host/html.cjs.map +1 -1
  7. package/dist/host/html.js +19 -17
  8. package/dist/host/html.js.map +1 -1
  9. package/dist/host/nextjs/app/client-only.cjs +93 -59
  10. package/dist/host/nextjs/app/client-only.cjs.map +1 -1
  11. package/dist/host/nextjs/app/client-only.d.ts +28 -9
  12. package/dist/host/nextjs/app/client-only.js +91 -58
  13. package/dist/host/nextjs/app/client-only.js.map +1 -1
  14. package/dist/host/nextjs/pages.cjs +4 -4
  15. package/dist/host/nextjs/pages.cjs.map +1 -1
  16. package/dist/host/nextjs/pages.js +4 -4
  17. package/dist/host/nextjs/pages.js.map +1 -1
  18. package/dist/host/react.cjs +33 -23
  19. package/dist/host/react.cjs.map +1 -1
  20. package/dist/host/react.d.ts +2 -366
  21. package/dist/host/react.js +33 -23
  22. package/dist/host/react.js.map +1 -1
  23. package/dist/index-4c65355c.d.ts +298 -0
  24. package/dist/internal/config/webpack/apply-shared-modules.cjs +6 -2
  25. package/dist/internal/config/webpack/apply-shared-modules.cjs.map +1 -1
  26. package/dist/internal/config/webpack/apply-shared-modules.js +6 -2
  27. package/dist/internal/config/webpack/apply-shared-modules.js.map +1 -1
  28. package/dist/internal/config/webpack/next-client-pages-loader.d.ts +3 -3
  29. package/dist/internal/host/nextjs/app-client.cjs +4 -3
  30. package/dist/internal/host/nextjs/app-client.cjs.map +1 -1
  31. package/dist/internal/host/nextjs/app-client.d.ts +1 -1
  32. package/dist/internal/host/nextjs/app-client.js +4 -3
  33. package/dist/internal/host/nextjs/app-client.js.map +1 -1
  34. package/dist/internal/host/nextjs/image-impl.cjs +8 -4
  35. package/dist/internal/host/nextjs/image-impl.cjs.map +1 -1
  36. package/dist/internal/host/nextjs/image-impl.d.ts +2 -2
  37. package/dist/internal/host/nextjs/image-impl.js +8 -4
  38. package/dist/internal/host/nextjs/image-impl.js.map +1 -1
  39. package/dist/internal/host/react/context.cjs +5 -10
  40. package/dist/internal/host/react/context.cjs.map +1 -1
  41. package/dist/internal/host/react/context.d.ts +7 -18
  42. package/dist/internal/host/react/context.js +4 -9
  43. package/dist/internal/host/react/context.js.map +1 -1
  44. package/dist/internal/host/react/hooks/use-resolve-client-url.cjs +5 -4
  45. package/dist/internal/host/react/hooks/use-resolve-client-url.cjs.map +1 -1
  46. package/dist/internal/host/react/hooks/use-resolve-client-url.d.ts +4 -1
  47. package/dist/internal/host/react/hooks/use-resolve-client-url.js +5 -4
  48. package/dist/internal/host/react/hooks/use-resolve-client-url.js.map +1 -1
  49. package/dist/internal/host/shared/config.cjs.map +1 -1
  50. package/dist/internal/host/shared/config.d.ts +7 -0
  51. package/dist/internal/host/shared/resolved-data.d.ts +2 -2
  52. package/dist/internal/runtime/loaders/component-loader.d.ts +1 -1
  53. package/dist/internal/runtime/loaders/script-loader.cjs +1 -6
  54. package/dist/internal/runtime/loaders/script-loader.cjs.map +1 -1
  55. package/dist/internal/runtime/loaders/script-loader.js +4 -9
  56. package/dist/internal/runtime/loaders/script-loader.js.map +1 -1
  57. package/dist/internal/runtime/turbopack/chunk-loader.cjs +1 -6
  58. package/dist/internal/runtime/turbopack/chunk-loader.cjs.map +1 -1
  59. package/dist/internal/runtime/turbopack/chunk-loader.js +4 -9
  60. package/dist/internal/runtime/turbopack/chunk-loader.js.map +1 -1
  61. package/dist/internal/runtime/turbopack/shared-modules.cjs +3 -2
  62. package/dist/internal/runtime/turbopack/shared-modules.cjs.map +1 -1
  63. package/dist/internal/runtime/turbopack/shared-modules.js +3 -2
  64. package/dist/internal/runtime/turbopack/shared-modules.js.map +1 -1
  65. package/dist/internal/utils/error.cjs +7 -0
  66. package/dist/internal/utils/error.cjs.map +1 -1
  67. package/dist/internal/utils/error.d.ts +2 -1
  68. package/dist/internal/utils/error.js +6 -0
  69. package/dist/internal/utils/error.js.map +1 -1
  70. package/dist/internal/utils/logger.cjs +1 -1
  71. package/dist/internal/utils/logger.cjs.map +1 -1
  72. package/dist/internal/utils/logger.d.ts +1 -1
  73. package/dist/internal/utils/logger.js +1 -1
  74. package/dist/internal/utils/logger.js.map +1 -1
  75. package/dist/remote/html.cjs +1 -1
  76. package/dist/remote/html.cjs.map +1 -1
  77. package/dist/remote/html.js +1 -1
  78. package/dist/remote/html.js.map +1 -1
  79. package/dist/{server-handoff-8c89b856.d.ts → server-handoff-ce13bebc.d.ts} +2 -2
  80. package/package.json +1 -9
@@ -1,16 +1,35 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as react from 'react';
3
- import { ConsumeRemoteComponentProps } from '../../react.js';
2
+ import React from 'react';
3
+ import { C as ConsumeClientOnlyConfig, a as ConsumeRemoteComponentProps } from '../../../index-4c65355c.js';
4
4
 
5
5
  /**
6
- * RemoteComponent - Client-side component for rendering remote components
6
+ * Provider for Next.js App Router hosts. Provides real Next.js implementations
7
+ * of `next/image`, `next/navigation`, `next/link`, etc. to all nested
8
+ * `<ConsumeRemoteComponent>` instances.
7
9
  *
8
- * This component is used in Next.js App Router to render remote components.
9
- * It supports both Next.js App Router and Pages Router based components.
10
+ * Works in both Server and Client Components set it up once in your layout
11
+ * and use `<ConsumeRemoteComponent>` from `remote-components/react` everywhere:
10
12
  *
11
- * @param props - The props for the remote component.
12
- * @returns The rendered remote component.
13
+ * ```tsx
14
+ * import { RemoteComponentsClientProvider } from 'remote-components/host/nextjs/app/client-only';
15
+ *
16
+ * <RemoteComponentsClientProvider resolveClientUrl={proxyClientRequestsThroughHost}>
17
+ * {children}
18
+ * </RemoteComponentsClientProvider>
19
+ * ```
20
+ */
21
+ declare function RemoteComponentsClientProvider({ shared, resolveClientUrl, children, ...props }: ConsumeClientOnlyConfig & {
22
+ children: React.ReactNode;
23
+ }): react_jsx_runtime.JSX.Element;
24
+ /**
25
+ * `ConsumeRemoteComponent` for Next.js App Router hosts. Provides real Next.js
26
+ * implementations of `next/image`, `next/navigation`, `next/link`, etc.
27
+ *
28
+ * The provider approach is recommended because it works in both Server and Client
29
+ * Components — set up `RemoteComponentsClientProvider` from this module once in
30
+ * your layout, and use `<ConsumeRemoteComponent>` from `remote-components/react`
31
+ * everywhere. Import this component only when adding a provider is not practical.
13
32
  */
14
- declare function ConsumeRemoteComponent(props: ConsumeRemoteComponentProps): string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
33
+ declare function ConsumeRemoteComponent(props: ConsumeRemoteComponentProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
15
34
 
16
- export { ConsumeRemoteComponent };
35
+ export { ConsumeRemoteComponent, RemoteComponentsClientProvider };
@@ -38,6 +38,7 @@ var init_app = __esm({
38
38
 
39
39
  // src/host/nextjs/app-client-only.tsx
40
40
  import * as Image from "next/image";
41
+ import { useMemo as useMemo3 } from "react";
41
42
 
42
43
  // src/utils/logger.ts
43
44
  init_constants();
@@ -123,6 +124,11 @@ async function errorFromFailedFetch(originalUrl, resolvedUrl, res) {
123
124
  }
124
125
  return fallback;
125
126
  }
127
+ function failedProxiedAssetError(kind, url, resolvedUrl) {
128
+ return new RemoteComponentsError(
129
+ `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}`
130
+ );
131
+ }
126
132
  function failedProxyFetchError(originalUrl, proxyUrl, status, responseBody) {
127
133
  if (status === 404) {
128
134
  return new RemoteComponentsError(
@@ -174,7 +180,7 @@ function warnCrossOriginFetchError(logLocation, url) {
174
180
  }
175
181
  logWarn(
176
182
  logLocation,
177
- `Failed to fetch cross-origin resource "${parsed.href}". If this is a protected deployment, ensure withRemoteComponentsHostProxy middleware is configured in your host and that the remote URL is included in allowedProxyUrls. See: ${CORS_DOCS_URL}`
183
+ `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}`
178
184
  );
179
185
  } catch {
180
186
  }
@@ -379,10 +385,11 @@ function sharedPolyfills(shared2, resolveClientUrl) {
379
385
 
380
386
  // src/host/nextjs/image-impl.tsx
381
387
  import { jsx as jsx2 } from "react/jsx-runtime";
388
+ var getBundleUrl = (bundle) => globalThis.__remote_bundle_url__?.[bundle];
382
389
  function createRemoteLoader(bundle, resolveClientUrl) {
383
390
  return ({ src, width, quality }) => {
384
- const self = globalThis;
385
- const origin = self.__remote_bundle_url__?.[bundle]?.origin ?? "";
391
+ const bundleUrl = getBundleUrl(bundle);
392
+ const origin = bundleUrl?.origin ?? "";
386
393
  let imageUrl = src;
387
394
  try {
388
395
  const parsed = new URL(src);
@@ -393,7 +400,8 @@ function createRemoteLoader(bundle, resolveClientUrl) {
393
400
  }
394
401
  const { assetPrefix } = /^(?<assetPrefix>.*?)\/_next\//.exec(imageUrl)?.groups ?? {};
395
402
  const url = `${origin}${assetPrefix ?? ""}/_next/image?url=${encodeURIComponent(imageUrl)}&w=${width}&q=${quality ?? 75}`;
396
- return resolveClientUrl?.(url) ?? url;
403
+ const remoteSrc = bundleUrl?.href ?? url;
404
+ return resolveClientUrl?.(remoteSrc, url) ?? url;
397
405
  };
398
406
  }
399
407
  function imageImpl2(ImageComponent, bundle, resolveClientUrl, useRemoteLoader) {
@@ -403,36 +411,17 @@ function imageImpl2(ImageComponent, bundle, resolveClientUrl, useRemoteLoader) {
403
411
  return /* @__PURE__ */ jsx2(ImageComponent, { loader: remoteLoader, ...props });
404
412
  }
405
413
  const rawSrc = applyBundleUrlToImagePropsSrc(bundle, props.src);
406
- const src = resolveClientUrl?.(rawSrc) ?? rawSrc;
414
+ const bundleUrl = getBundleUrl(bundle);
415
+ const remoteSrc = bundleUrl?.href ?? rawSrc;
416
+ const src = resolveClientUrl?.(remoteSrc, rawSrc) ?? rawSrc;
407
417
  return /* @__PURE__ */ jsx2(ImageComponent, { ...props, src });
408
418
  };
409
419
  component.default = component;
410
420
  return component;
411
421
  }
412
422
 
413
- // src/runtime/url/resolve-client-url.ts
414
- function withRemoteSrc(resolveClientUrl, remoteSrc) {
415
- const remoteOrigin = parseOrigin(remoteSrc);
416
- return (url) => {
417
- const urlOrigin = parseOrigin(url);
418
- if (remoteOrigin && urlOrigin && urlOrigin !== remoteOrigin) {
419
- return void 0;
420
- }
421
- return resolveClientUrl(remoteSrc, url);
422
- };
423
- }
424
- function parseOrigin(url) {
425
- try {
426
- return new URL(url).origin;
427
- } catch {
428
- return void 0;
429
- }
430
- }
431
-
432
- // src/runtime/url/default-resolve-client-url.ts
433
- function bindResolveClientUrl(prop, remoteSrc) {
434
- return prop ? withRemoteSrc(prop, remoteSrc) : void 0;
435
- }
423
+ // src/host/nextjs/app-client-only.tsx
424
+ import { RemoteComponentsContext } from "#internal/host/react/context";
436
425
 
437
426
  // src/host/react/index.tsx
438
427
  import {
@@ -445,6 +434,7 @@ import {
445
434
  useState as useState2
446
435
  } from "react";
447
436
  import { createPortal } from "react-dom";
437
+ import { useRemoteComponentsContext as useRemoteComponentsContext2 } from "#internal/host/react/context";
448
438
 
449
439
  // src/host/server/fetch-headers.ts
450
440
  function remoteFetchHeaders() {
@@ -756,6 +746,7 @@ import * as ReactDOM from "react-dom";
756
746
  import * as ReactDOMClient from "react-dom/client";
757
747
 
758
748
  // src/config/webpack/apply-shared-modules.ts
749
+ var DEDUPLICATION_SKIPPED = "shared module deduplication skipped. The remote may load its own copy of shared dependencies.";
759
750
  function applySharedModules(bundle, resolve) {
760
751
  logDebug(
761
752
  "SharedModules",
@@ -799,13 +790,16 @@ function applySharedModules(bundle, resolve) {
799
790
  } else {
800
791
  logWarn(
801
792
  "SharedModules",
802
- `webpackBundle.m is not available for bundle "${bundle}"`
793
+ `webpackBundle.m is not available for bundle "${bundle}" \u2014 ${DEDUPLICATION_SKIPPED}`
803
794
  );
804
795
  }
805
796
  }
806
797
  }
807
798
  } else {
808
- logWarn("SharedModules", `No webpack require found for bundle "${bundle}"`);
799
+ logWarn(
800
+ "SharedModules",
801
+ `No webpack require found for bundle "${bundle}" \u2014 ${DEDUPLICATION_SKIPPED}`
802
+ );
809
803
  logDebug(
810
804
  "SharedModules",
811
805
  `Available bundles: ${Object.keys(self.__remote_webpack_require__ ?? {})}`
@@ -991,9 +985,6 @@ function createRSCStream(rscName, data) {
991
985
  });
992
986
  }
993
987
 
994
- // src/runtime/turbopack/chunk-loader.ts
995
- init_constants();
996
-
997
988
  // src/runtime/turbopack/patterns.ts
998
989
  var REMOTE_SHARED_MARKER_RE = /(?:self|[a-z])\.TURBOPACK_REMOTE_SHARED/;
999
990
  var REMOTE_SHARED_ASSIGNMENT_RE = /\.TURBOPACK_REMOTE_SHARED=await (?:__turbopack_context__|[a-z])\.A\((?<sharedModuleId>[0-9]+)\)/;
@@ -1062,11 +1053,7 @@ function createChunkLoader(runtime, resolveClientUrl) {
1062
1053
  }).then(resolve).catch((error) => {
1063
1054
  const isProxied = isProxiedUrl(resolvedUrl);
1064
1055
  if (isProxied) {
1065
- reject(
1066
- new RemoteComponentsError(
1067
- `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}`
1068
- )
1069
- );
1056
+ reject(failedProxiedAssetError("chunk", url, resolvedUrl));
1070
1057
  } else {
1071
1058
  warnCrossOriginFetchError("ChunkLoader", url);
1072
1059
  reject(error);
@@ -1444,6 +1431,7 @@ function createTurbopackContext(bundle, exports, moduleExports, modules, moduleI
1444
1431
  }
1445
1432
 
1446
1433
  // src/runtime/turbopack/shared-modules.ts
1434
+ var 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).";
1447
1435
  async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {}) {
1448
1436
  const self = globalThis;
1449
1437
  self.__remote_shared_modules__ = self.__remote_shared_modules__ ?? {};
@@ -1494,7 +1482,7 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
1494
1482
  } else {
1495
1483
  logError(
1496
1484
  "SharedModules",
1497
- `Host shared module "${module}" not found for ID ${id}`
1485
+ `Host shared module "${module}" not found for ID ${id}. ${DEDUPLICATION_WARNING}`
1498
1486
  );
1499
1487
  }
1500
1488
  }
@@ -1511,7 +1499,7 @@ async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {
1511
1499
  } else {
1512
1500
  logError(
1513
1501
  "SharedModules",
1514
- `Shared module "${module}" not found for "${bundle}"`
1502
+ `Shared module "${module}" not found for "${bundle}". ${DEDUPLICATION_WARNING}`
1515
1503
  );
1516
1504
  }
1517
1505
  }
@@ -1659,7 +1647,6 @@ function createModuleRequire(runtime) {
1659
1647
  }
1660
1648
 
1661
1649
  // src/runtime/loaders/script-loader.ts
1662
- init_constants();
1663
1650
  async function loadScripts(scripts, resolveClientUrl) {
1664
1651
  await Promise.all(
1665
1652
  scripts.map((script) => {
@@ -1675,11 +1662,7 @@ async function loadScripts(scripts, resolveClientUrl) {
1675
1662
  newScript.onerror = () => {
1676
1663
  const isProxied = isProxiedUrl(resolvedSrc);
1677
1664
  if (isProxied) {
1678
- reject(
1679
- new RemoteComponentsError(
1680
- `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}`
1681
- )
1682
- );
1665
+ reject(failedProxiedAssetError("script", newSrc, resolvedSrc));
1683
1666
  } else {
1684
1667
  warnCrossOriginFetchError("ScriptLoader", newSrc);
1685
1668
  reject(
@@ -1986,13 +1969,40 @@ async function loadStaticRemoteComponent(scripts, url, resolveClientUrl) {
1986
1969
  // src/host/react/hooks/use-resolve-client-url.ts
1987
1970
  import { useMemo } from "react";
1988
1971
  import { useRemoteComponentsContext } from "#internal/host/react/context";
1972
+
1973
+ // src/runtime/url/resolve-client-url.ts
1974
+ function withRemoteSrc(resolveClientUrl, remoteSrc) {
1975
+ const remoteOrigin = parseOrigin(remoteSrc);
1976
+ return (url) => {
1977
+ const urlOrigin = parseOrigin(url);
1978
+ if (remoteOrigin && urlOrigin && urlOrigin !== remoteOrigin) {
1979
+ return void 0;
1980
+ }
1981
+ return resolveClientUrl(remoteSrc, url);
1982
+ };
1983
+ }
1984
+ function parseOrigin(url) {
1985
+ try {
1986
+ return new URL(url).origin;
1987
+ } catch {
1988
+ return void 0;
1989
+ }
1990
+ }
1991
+
1992
+ // src/runtime/url/default-resolve-client-url.ts
1993
+ function bindResolveClientUrl(prop, remoteSrc) {
1994
+ return prop ? withRemoteSrc(prop, remoteSrc) : void 0;
1995
+ }
1996
+
1997
+ // src/host/react/hooks/use-resolve-client-url.ts
1989
1998
  function useResolveClientUrl(prop, urlHref) {
1990
1999
  const { resolveClientUrl: contextValue } = useRemoteComponentsContext();
1991
- const resolveClientUrl = prop ?? contextValue;
1992
- return useMemo(
1993
- () => bindResolveClientUrl(resolveClientUrl, urlHref),
1994
- [resolveClientUrl, urlHref]
2000
+ const raw = prop ?? contextValue;
2001
+ const bound = useMemo(
2002
+ () => bindResolveClientUrl(raw, urlHref),
2003
+ [raw, urlHref]
1995
2004
  );
2005
+ return { bound, raw };
1996
2006
  }
1997
2007
 
1998
2008
  // src/host/react/hooks/use-shadow-root.ts
@@ -2074,9 +2084,9 @@ function ConsumeRemoteComponent({
2074
2084
  isolate,
2075
2085
  mode = "open",
2076
2086
  reset,
2077
- credentials = "same-origin",
2087
+ credentials: credentialsProp,
2078
2088
  name: nameProp = "__vercel_remote_component",
2079
- shared: shared2 = {},
2089
+ shared: sharedProp,
2080
2090
  children,
2081
2091
  onBeforeLoad,
2082
2092
  onLoad,
@@ -2084,9 +2094,12 @@ function ConsumeRemoteComponent({
2084
2094
  onChange,
2085
2095
  onRequest,
2086
2096
  onResponse,
2087
- resolveClientUrl: _resolveClientUrl
2097
+ resolveClientUrl: resolveClientUrlProp
2088
2098
  }) {
2089
2099
  const instanceId = useId();
2100
+ const { credentials: contextCredentials, shared: contextShared } = useRemoteComponentsContext2();
2101
+ const credentials = credentialsProp ?? contextCredentials ?? "same-origin";
2102
+ const shared2 = sharedProp ?? contextShared ?? {};
2090
2103
  const name = useMemo2(
2091
2104
  () => resolveNameFromSrc(src, nameProp),
2092
2105
  [src, nameProp]
@@ -2095,7 +2108,10 @@ function ConsumeRemoteComponent({
2095
2108
  null
2096
2109
  );
2097
2110
  const url = useMemo2(() => getClientOrServerUrl(src, DUMMY_FALLBACK), [src]);
2098
- const resolveClientUrl = useResolveClientUrl(_resolveClientUrl, url.href);
2111
+ const { bound: resolveClientUrl } = useResolveClientUrl(
2112
+ resolveClientUrlProp,
2113
+ url.href
2114
+ );
2099
2115
  const id = url.origin === (typeof location !== "undefined" ? location.origin : DUMMY_FALLBACK) ? url.pathname : url.href;
2100
2116
  const keySuffix = `${escapeString(id)}_${escapeString(
2101
2117
  data?.name ?? name
@@ -2698,21 +2714,38 @@ var sharedModules = async (userShared, resolveClientUrl) => {
2698
2714
  ...resolvedUserShared
2699
2715
  };
2700
2716
  };
2717
+ function RemoteComponentsClientProvider({
2718
+ shared: shared2,
2719
+ resolveClientUrl,
2720
+ children,
2721
+ ...props
2722
+ }) {
2723
+ const mergedShared = useMemo3(
2724
+ () => sharedModules(shared2, resolveClientUrl),
2725
+ [shared2, resolveClientUrl]
2726
+ );
2727
+ return /* @__PURE__ */ jsx4(
2728
+ RemoteComponentsContext,
2729
+ {
2730
+ value: { shared: mergedShared, resolveClientUrl, ...props },
2731
+ children
2732
+ }
2733
+ );
2734
+ }
2701
2735
  function ConsumeRemoteComponent2(props) {
2702
2736
  if (typeof props.src !== "string" && !(props.src instanceof URL)) {
2703
2737
  return props.children ?? null;
2704
2738
  }
2705
- const src = typeof props.src === "string" ? props.src : props.src.href;
2706
- const resolveClientUrl = props.resolveClientUrl ? bindResolveClientUrl(props.resolveClientUrl, src) : void 0;
2707
2739
  return /* @__PURE__ */ jsx4(
2708
2740
  ConsumeRemoteComponent,
2709
2741
  {
2710
2742
  ...props,
2711
- shared: sharedModules(props.shared, resolveClientUrl)
2743
+ shared: sharedModules(props.shared, props.resolveClientUrl)
2712
2744
  }
2713
2745
  );
2714
2746
  }
2715
2747
  export {
2716
- ConsumeRemoteComponent2 as ConsumeRemoteComponent
2748
+ ConsumeRemoteComponent2 as ConsumeRemoteComponent,
2749
+ RemoteComponentsClientProvider
2717
2750
  };
2718
2751
  //# sourceMappingURL=client-only.js.map