remote-components 0.2.1 → 0.3.0

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 (65) hide show
  1. package/dist/config/nextjs.cjs +2 -4
  2. package/dist/config/nextjs.cjs.map +1 -1
  3. package/dist/config/nextjs.d.ts +1 -1
  4. package/dist/config/nextjs.js +2 -4
  5. package/dist/config/nextjs.js.map +1 -1
  6. package/dist/host/html.cjs +40 -59
  7. package/dist/host/html.cjs.map +1 -1
  8. package/dist/host/html.js +40 -62
  9. package/dist/host/html.js.map +1 -1
  10. package/dist/host/nextjs/app/client-only.cjs +199 -231
  11. package/dist/host/nextjs/app/client-only.cjs.map +1 -1
  12. package/dist/host/nextjs/app/client-only.d.ts +28 -9
  13. package/dist/host/nextjs/app/client-only.js +198 -231
  14. package/dist/host/nextjs/app/client-only.js.map +1 -1
  15. package/dist/host/nextjs/pages.cjs +5 -12
  16. package/dist/host/nextjs/pages.cjs.map +1 -1
  17. package/dist/host/nextjs/pages.js +6 -13
  18. package/dist/host/nextjs/pages.js.map +1 -1
  19. package/dist/host/react.cjs +45 -71
  20. package/dist/host/react.cjs.map +1 -1
  21. package/dist/host/react.d.ts +2 -366
  22. package/dist/host/react.js +45 -71
  23. package/dist/host/react.js.map +1 -1
  24. package/dist/index-4c65355c.d.ts +298 -0
  25. package/dist/internal/config/webpack/next-client-pages-loader.d.ts +3 -3
  26. package/dist/internal/host/nextjs/app-client.cjs +1 -5
  27. package/dist/internal/host/nextjs/app-client.cjs.map +1 -1
  28. package/dist/internal/host/nextjs/app-client.d.ts +1 -1
  29. package/dist/internal/host/nextjs/app-client.js +2 -6
  30. package/dist/internal/host/nextjs/app-client.js.map +1 -1
  31. package/dist/internal/host/nextjs/image-shared.cjs +25 -15
  32. package/dist/internal/host/nextjs/image-shared.cjs.map +1 -1
  33. package/dist/internal/host/nextjs/image-shared.d.ts +19 -6
  34. package/dist/internal/host/nextjs/image-shared.js +24 -14
  35. package/dist/internal/host/nextjs/image-shared.js.map +1 -1
  36. package/dist/internal/host/react/context.cjs +5 -10
  37. package/dist/internal/host/react/context.cjs.map +1 -1
  38. package/dist/internal/host/react/context.d.ts +7 -18
  39. package/dist/internal/host/react/context.js +4 -9
  40. package/dist/internal/host/react/context.js.map +1 -1
  41. package/dist/internal/host/react/hooks/use-resolve-client-url.cjs +2 -5
  42. package/dist/internal/host/react/hooks/use-resolve-client-url.cjs.map +1 -1
  43. package/dist/internal/host/react/hooks/use-resolve-client-url.js +2 -5
  44. package/dist/internal/host/react/hooks/use-resolve-client-url.js.map +1 -1
  45. package/dist/internal/host/shared/config.cjs.map +1 -1
  46. package/dist/internal/host/shared/config.d.ts +7 -0
  47. package/dist/internal/host/shared/polyfill.cjs +10 -65
  48. package/dist/internal/host/shared/polyfill.cjs.map +1 -1
  49. package/dist/internal/host/shared/polyfill.d.ts +1 -3
  50. package/dist/internal/host/shared/polyfill.js +9 -63
  51. package/dist/internal/host/shared/polyfill.js.map +1 -1
  52. package/dist/internal/host/shared/remote-image-loader.cjs +53 -0
  53. package/dist/internal/host/shared/remote-image-loader.cjs.map +1 -0
  54. package/dist/internal/host/shared/remote-image-loader.d.ts +30 -0
  55. package/dist/internal/host/shared/remote-image-loader.js +29 -0
  56. package/dist/internal/host/shared/remote-image-loader.js.map +1 -0
  57. package/dist/internal/host/shared/resolved-data.d.ts +2 -2
  58. package/dist/internal/runtime/loaders/component-loader.d.ts +1 -1
  59. package/dist/{server-handoff-8c89b856.d.ts → server-handoff-ce13bebc.d.ts} +2 -2
  60. package/package.json +1 -9
  61. package/dist/internal/host/nextjs/image-impl.cjs +0 -60
  62. package/dist/internal/host/nextjs/image-impl.cjs.map +0 -1
  63. package/dist/internal/host/nextjs/image-impl.d.ts +0 -10
  64. package/dist/internal/host/nextjs/image-impl.js +0 -36
  65. package/dist/internal/host/nextjs/image-impl.js.map +0 -1
@@ -18,26 +18,36 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var image_shared_exports = {};
20
20
  __export(image_shared_exports, {
21
- createNextImageSharedEntries: () => createNextImageSharedEntries
21
+ createImageLoaderSharedEntries: () => createImageLoaderSharedEntries
22
22
  });
23
23
  module.exports = __toCommonJS(image_shared_exports);
24
- function createNextImageSharedEntries(getWrappedImage, options) {
25
- const entries = {
26
- "next/image": (bundle) => Promise.resolve(getWrappedImage(bundle)),
27
- "next/dist/client/image-component": (bundle) => Promise.resolve({
28
- Image: getWrappedImage(bundle)
29
- })
30
- };
31
- if (options?.getImageProps) {
32
- entries["next/dist/api/image"] = (bundle) => Promise.resolve({
33
- default: getWrappedImage(bundle),
34
- getImageProps: options.getImageProps
24
+ var import_remote_image_loader = require("#internal/host/shared/remote-image-loader");
25
+ var import_default_resolve_client_url = require("#internal/runtime/url/default-resolve-client-url");
26
+ function resolveForBundle(unbound, bundle) {
27
+ if (!unbound)
28
+ return void 0;
29
+ const self = globalThis;
30
+ const remoteSrc = self.__remote_bundle_url__?.[bundle]?.href ?? "";
31
+ return (0, import_default_resolve_client_url.bindResolveClientUrl)(unbound, remoteSrc);
32
+ }
33
+ function createImageLoaderSharedEntries({
34
+ bound,
35
+ unbound
36
+ } = {}) {
37
+ const entry = (bundle) => {
38
+ const resolveClientUrl = bound ?? resolveForBundle(unbound, bundle);
39
+ return Promise.resolve({
40
+ default: (0, import_remote_image_loader.createRemoteImageLoader)(bundle, resolveClientUrl),
41
+ __esModule: true
35
42
  });
36
- }
37
- return entries;
43
+ };
44
+ return {
45
+ "next/dist/shared/lib/image-loader": entry,
46
+ "next/dist/esm/shared/lib/image-loader": entry
47
+ };
38
48
  }
39
49
  // Annotate the CommonJS export names for ESM import in node:
40
50
  0 && (module.exports = {
41
- createNextImageSharedEntries
51
+ createImageLoaderSharedEntries
42
52
  });
43
53
  //# sourceMappingURL=image-shared.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/host/nextjs/image-shared.ts"],"sourcesContent":["import type { getImageProps } from 'next/image';\n\ntype WrappedImageFactory = (bundle?: string) => unknown;\ntype SharedImageModule = (bundle?: string) => Promise<unknown>;\n\nexport function createNextImageSharedEntries(\n getWrappedImage: WrappedImageFactory,\n options?: { getImageProps?: typeof getImageProps },\n): Record<string, SharedImageModule> {\n const entries: Record<string, SharedImageModule> = {\n 'next/image': (bundle?: string) =>\n Promise.resolve(getWrappedImage(bundle)) as Promise<unknown>,\n 'next/dist/client/image-component': (bundle?: string) =>\n Promise.resolve({\n Image: getWrappedImage(bundle),\n }) as Promise<unknown>,\n };\n\n if (options?.getImageProps) {\n entries['next/dist/api/image'] = (bundle?: string) =>\n Promise.resolve({\n default: getWrappedImage(bundle),\n getImageProps: options.getImageProps,\n }) as Promise<unknown>;\n }\n\n return entries;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,SAAS,6BACd,iBACA,SACmC;AACnC,QAAM,UAA6C;AAAA,IACjD,cAAc,CAAC,WACb,QAAQ,QAAQ,gBAAgB,MAAM,CAAC;AAAA,IACzC,oCAAoC,CAAC,WACnC,QAAQ,QAAQ;AAAA,MACd,OAAO,gBAAgB,MAAM;AAAA,IAC/B,CAAC;AAAA,EACL;AAEA,MAAI,SAAS,eAAe;AAC1B,YAAQ,qBAAqB,IAAI,CAAC,WAChC,QAAQ,QAAQ;AAAA,MACd,SAAS,gBAAgB,MAAM;AAAA,MAC/B,eAAe,QAAQ;AAAA,IACzB,CAAC;AAAA,EACL;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/host/nextjs/image-shared.ts"],"sourcesContent":["import { createRemoteImageLoader } from '#internal/host/shared/remote-image-loader';\nimport { bindResolveClientUrl } from '#internal/runtime/url/default-resolve-client-url';\nimport type {\n InternalResolveClientUrl,\n ResolveClientUrl,\n} from '#internal/runtime/url/resolve-client-url';\n\ntype SharedImageModule = (bundle: string) => Promise<unknown>;\n\nfunction resolveForBundle(\n unbound: ResolveClientUrl | undefined,\n bundle: string,\n): InternalResolveClientUrl | undefined {\n if (!unbound) return undefined;\n const self = globalThis as typeof globalThis & {\n __remote_bundle_url__?: Record<string, URL>;\n };\n const remoteSrc = self.__remote_bundle_url__?.[bundle]?.href ?? '';\n return bindResolveClientUrl(unbound, remoteSrc);\n}\n\n/**\n * Creates shared module entries for `next/dist/shared/lib/image-loader` (and\n * its ESM alias). These ensure that any code path in the remote's bundle that\n * directly imports the image loader — rather than going through the shared\n * `next/image` entry — still routes image optimization requests to the remote\n * and through the host's proxy when deployment protection is active.\n *\n * Pass `bound` when the resolver already has `remoteSrc` applied (App Router —\n * `useResolveClientUrl` returns the bound form). Pass `unbound` when only the\n * raw 2-arg `ResolveClientUrl` is available (Pages Router, client-only\n * provider) — binding is deferred until the bundle URL is known at resolution\n * time.\n */\nexport function createImageLoaderSharedEntries({\n bound,\n unbound,\n}: {\n bound?: InternalResolveClientUrl;\n unbound?: ResolveClientUrl;\n} = {}): Record<string, SharedImageModule> {\n const entry: SharedImageModule = (bundle: string) => {\n const resolveClientUrl = bound ?? resolveForBundle(unbound, bundle);\n return Promise.resolve({\n default: createRemoteImageLoader(bundle, resolveClientUrl),\n __esModule: true,\n });\n };\n return {\n 'next/dist/shared/lib/image-loader': entry,\n 'next/dist/esm/shared/lib/image-loader': entry,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAwC;AACxC,wCAAqC;AAQrC,SAAS,iBACP,SACA,QACsC;AACtC,MAAI,CAAC;AAAS,WAAO;AACrB,QAAM,OAAO;AAGb,QAAM,YAAY,KAAK,wBAAwB,MAAM,GAAG,QAAQ;AAChE,aAAO,wDAAqB,SAAS,SAAS;AAChD;AAeO,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,IAGI,CAAC,GAAsC;AACzC,QAAM,QAA2B,CAAC,WAAmB;AACnD,UAAM,mBAAmB,SAAS,iBAAiB,SAAS,MAAM;AAClE,WAAO,QAAQ,QAAQ;AAAA,MACrB,aAAS,oDAAwB,QAAQ,gBAAgB;AAAA,MACzD,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACA,SAAO;AAAA,IACL,qCAAqC;AAAA,IACrC,yCAAyC;AAAA,EAC3C;AACF;","names":[]}
@@ -1,9 +1,22 @@
1
- import { getImageProps } from 'next/image';
1
+ import { InternalResolveClientUrl, ResolveClientUrl } from '../../runtime/url/resolve-client-url.js';
2
2
 
3
- type WrappedImageFactory = (bundle?: string) => unknown;
4
- type SharedImageModule = (bundle?: string) => Promise<unknown>;
5
- declare function createNextImageSharedEntries(getWrappedImage: WrappedImageFactory, options?: {
6
- getImageProps?: typeof getImageProps;
3
+ type SharedImageModule = (bundle: string) => Promise<unknown>;
4
+ /**
5
+ * Creates shared module entries for `next/dist/shared/lib/image-loader` (and
6
+ * its ESM alias). These ensure that any code path in the remote's bundle that
7
+ * directly imports the image loader — rather than going through the shared
8
+ * `next/image` entry — still routes image optimization requests to the remote
9
+ * and through the host's proxy when deployment protection is active.
10
+ *
11
+ * Pass `bound` when the resolver already has `remoteSrc` applied (App Router —
12
+ * `useResolveClientUrl` returns the bound form). Pass `unbound` when only the
13
+ * raw 2-arg `ResolveClientUrl` is available (Pages Router, client-only
14
+ * provider) — binding is deferred until the bundle URL is known at resolution
15
+ * time.
16
+ */
17
+ declare function createImageLoaderSharedEntries({ bound, unbound, }?: {
18
+ bound?: InternalResolveClientUrl;
19
+ unbound?: ResolveClientUrl;
7
20
  }): Record<string, SharedImageModule>;
8
21
 
9
- export { createNextImageSharedEntries };
22
+ export { createImageLoaderSharedEntries };
@@ -1,19 +1,29 @@
1
- function createNextImageSharedEntries(getWrappedImage, options) {
2
- const entries = {
3
- "next/image": (bundle) => Promise.resolve(getWrappedImage(bundle)),
4
- "next/dist/client/image-component": (bundle) => Promise.resolve({
5
- Image: getWrappedImage(bundle)
6
- })
7
- };
8
- if (options?.getImageProps) {
9
- entries["next/dist/api/image"] = (bundle) => Promise.resolve({
10
- default: getWrappedImage(bundle),
11
- getImageProps: options.getImageProps
1
+ import { createRemoteImageLoader } from "#internal/host/shared/remote-image-loader";
2
+ import { bindResolveClientUrl } from "#internal/runtime/url/default-resolve-client-url";
3
+ function resolveForBundle(unbound, bundle) {
4
+ if (!unbound)
5
+ return void 0;
6
+ const self = globalThis;
7
+ const remoteSrc = self.__remote_bundle_url__?.[bundle]?.href ?? "";
8
+ return bindResolveClientUrl(unbound, remoteSrc);
9
+ }
10
+ function createImageLoaderSharedEntries({
11
+ bound,
12
+ unbound
13
+ } = {}) {
14
+ const entry = (bundle) => {
15
+ const resolveClientUrl = bound ?? resolveForBundle(unbound, bundle);
16
+ return Promise.resolve({
17
+ default: createRemoteImageLoader(bundle, resolveClientUrl),
18
+ __esModule: true
12
19
  });
13
- }
14
- return entries;
20
+ };
21
+ return {
22
+ "next/dist/shared/lib/image-loader": entry,
23
+ "next/dist/esm/shared/lib/image-loader": entry
24
+ };
15
25
  }
16
26
  export {
17
- createNextImageSharedEntries
27
+ createImageLoaderSharedEntries
18
28
  };
19
29
  //# sourceMappingURL=image-shared.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/host/nextjs/image-shared.ts"],"sourcesContent":["import type { getImageProps } from 'next/image';\n\ntype WrappedImageFactory = (bundle?: string) => unknown;\ntype SharedImageModule = (bundle?: string) => Promise<unknown>;\n\nexport function createNextImageSharedEntries(\n getWrappedImage: WrappedImageFactory,\n options?: { getImageProps?: typeof getImageProps },\n): Record<string, SharedImageModule> {\n const entries: Record<string, SharedImageModule> = {\n 'next/image': (bundle?: string) =>\n Promise.resolve(getWrappedImage(bundle)) as Promise<unknown>,\n 'next/dist/client/image-component': (bundle?: string) =>\n Promise.resolve({\n Image: getWrappedImage(bundle),\n }) as Promise<unknown>,\n };\n\n if (options?.getImageProps) {\n entries['next/dist/api/image'] = (bundle?: string) =>\n Promise.resolve({\n default: getWrappedImage(bundle),\n getImageProps: options.getImageProps,\n }) as Promise<unknown>;\n }\n\n return entries;\n}\n"],"mappings":"AAKO,SAAS,6BACd,iBACA,SACmC;AACnC,QAAM,UAA6C;AAAA,IACjD,cAAc,CAAC,WACb,QAAQ,QAAQ,gBAAgB,MAAM,CAAC;AAAA,IACzC,oCAAoC,CAAC,WACnC,QAAQ,QAAQ;AAAA,MACd,OAAO,gBAAgB,MAAM;AAAA,IAC/B,CAAC;AAAA,EACL;AAEA,MAAI,SAAS,eAAe;AAC1B,YAAQ,qBAAqB,IAAI,CAAC,WAChC,QAAQ,QAAQ;AAAA,MACd,SAAS,gBAAgB,MAAM;AAAA,MAC/B,eAAe,QAAQ;AAAA,IACzB,CAAC;AAAA,EACL;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/host/nextjs/image-shared.ts"],"sourcesContent":["import { createRemoteImageLoader } from '#internal/host/shared/remote-image-loader';\nimport { bindResolveClientUrl } from '#internal/runtime/url/default-resolve-client-url';\nimport type {\n InternalResolveClientUrl,\n ResolveClientUrl,\n} from '#internal/runtime/url/resolve-client-url';\n\ntype SharedImageModule = (bundle: string) => Promise<unknown>;\n\nfunction resolveForBundle(\n unbound: ResolveClientUrl | undefined,\n bundle: string,\n): InternalResolveClientUrl | undefined {\n if (!unbound) return undefined;\n const self = globalThis as typeof globalThis & {\n __remote_bundle_url__?: Record<string, URL>;\n };\n const remoteSrc = self.__remote_bundle_url__?.[bundle]?.href ?? '';\n return bindResolveClientUrl(unbound, remoteSrc);\n}\n\n/**\n * Creates shared module entries for `next/dist/shared/lib/image-loader` (and\n * its ESM alias). These ensure that any code path in the remote's bundle that\n * directly imports the image loader — rather than going through the shared\n * `next/image` entry — still routes image optimization requests to the remote\n * and through the host's proxy when deployment protection is active.\n *\n * Pass `bound` when the resolver already has `remoteSrc` applied (App Router —\n * `useResolveClientUrl` returns the bound form). Pass `unbound` when only the\n * raw 2-arg `ResolveClientUrl` is available (Pages Router, client-only\n * provider) — binding is deferred until the bundle URL is known at resolution\n * time.\n */\nexport function createImageLoaderSharedEntries({\n bound,\n unbound,\n}: {\n bound?: InternalResolveClientUrl;\n unbound?: ResolveClientUrl;\n} = {}): Record<string, SharedImageModule> {\n const entry: SharedImageModule = (bundle: string) => {\n const resolveClientUrl = bound ?? resolveForBundle(unbound, bundle);\n return Promise.resolve({\n default: createRemoteImageLoader(bundle, resolveClientUrl),\n __esModule: true,\n });\n };\n return {\n 'next/dist/shared/lib/image-loader': entry,\n 'next/dist/esm/shared/lib/image-loader': entry,\n };\n}\n"],"mappings":"AAAA,SAAS,+BAA+B;AACxC,SAAS,4BAA4B;AAQrC,SAAS,iBACP,SACA,QACsC;AACtC,MAAI,CAAC;AAAS,WAAO;AACrB,QAAM,OAAO;AAGb,QAAM,YAAY,KAAK,wBAAwB,MAAM,GAAG,QAAQ;AAChE,SAAO,qBAAqB,SAAS,SAAS;AAChD;AAeO,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,IAGI,CAAC,GAAsC;AACzC,QAAM,QAA2B,CAAC,WAAmB;AACnD,UAAM,mBAAmB,SAAS,iBAAiB,SAAS,MAAM;AAClE,WAAO,QAAQ,QAAQ;AAAA,MACrB,SAAS,wBAAwB,QAAQ,gBAAgB;AAAA,MACzD,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACA,SAAO;AAAA,IACL,qCAAqC;AAAA,IACrC,yCAAyC;AAAA,EAC3C;AACF;","names":[]}
@@ -19,25 +19,20 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var context_exports = {};
21
21
  __export(context_exports, {
22
- RemoteComponentsClientProvider: () => RemoteComponentsClientProvider,
22
+ RemoteComponentsContext: () => RemoteComponentsContext,
23
23
  useRemoteComponentsContext: () => useRemoteComponentsContext
24
24
  });
25
25
  module.exports = __toCommonJS(context_exports);
26
- var import_jsx_runtime = require("react/jsx-runtime");
27
26
  var import_react = require("react");
28
- const RemoteComponentsContext = (0, import_react.createContext)({});
29
- function RemoteComponentsClientProvider({
30
- resolveClientUrl,
31
- children
32
- }) {
33
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RemoteComponentsContext, { value: { resolveClientUrl }, children });
34
- }
27
+ const RemoteComponentsContext = (0, import_react.createContext)(
28
+ {}
29
+ );
35
30
  function useRemoteComponentsContext() {
36
31
  return (0, import_react.useContext)(RemoteComponentsContext);
37
32
  }
38
33
  // Annotate the CommonJS export names for ESM import in node:
39
34
  0 && (module.exports = {
40
- RemoteComponentsClientProvider,
35
+ RemoteComponentsContext,
41
36
  useRemoteComponentsContext
42
37
  });
43
38
  //# sourceMappingURL=context.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/host/react/context.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\ninterface RemoteComponentsContextValue {\n resolveClientUrl?: ResolveClientUrl;\n}\n\nconst RemoteComponentsContext = createContext<RemoteComponentsContextValue>({});\n\n/**\n * Client-side context provider for passing `resolveClientUrl` to all nested\n * `<ConsumeRemoteComponent>` instances. Since `resolveClientUrl` is a function, it\n * can't be passed as a prop through Server Components — this provider should\n * wrap the tree in a Client Component boundary so the callback is available\n * on the client where asset fetches happen.\n */\nexport function RemoteComponentsClientProvider({\n resolveClientUrl,\n children,\n}: {\n resolveClientUrl?: ResolveClientUrl;\n children: React.ReactNode;\n}) {\n return (\n <RemoteComponentsContext value={{ resolveClientUrl }}>\n {children}\n </RemoteComponentsContext>\n );\n}\n\nexport function useRemoteComponentsContext(): RemoteComponentsContextValue {\n return useContext(RemoteComponentsContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BI;AAxBJ,mBAA0C;AAO1C,MAAM,8BAA0B,4BAA4C,CAAC,CAAC;AASvE,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,GAGG;AACD,SACE,4CAAC,2BAAwB,OAAO,EAAE,iBAAiB,GAChD,UACH;AAEJ;AAEO,SAAS,6BAA2D;AACzE,aAAO,yBAAW,uBAAuB;AAC3C;","names":[]}
1
+ {"version":3,"sources":["../../../../src/host/react/context.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\nimport type { ConsumeClientOnlyConfig } from '#internal/host/shared/config';\n\nexport const RemoteComponentsContext = createContext<ConsumeClientOnlyConfig>(\n {},\n);\n\nexport function useRemoteComponentsContext(): ConsumeClientOnlyConfig {\n return useContext(RemoteComponentsContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0C;AAGnC,MAAM,8BAA0B;AAAA,EACrC,CAAC;AACH;AAEO,SAAS,6BAAsD;AACpE,aAAO,yBAAW,uBAAuB;AAC3C;","names":[]}
@@ -1,20 +1,9 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ResolveClientUrl } from '../../runtime/url/resolve-client-url.js';
1
+ import * as react from 'react';
2
+ import { ConsumeClientOnlyConfig } from '../shared/config.js';
3
+ import '../../runtime/url/resolve-client-url.js';
4
+ import '../shared/fetch-interceptors.js';
3
5
 
4
- interface RemoteComponentsContextValue {
5
- resolveClientUrl?: ResolveClientUrl;
6
- }
7
- /**
8
- * Client-side context provider for passing `resolveClientUrl` to all nested
9
- * `<ConsumeRemoteComponent>` instances. Since `resolveClientUrl` is a function, it
10
- * can't be passed as a prop through Server Components — this provider should
11
- * wrap the tree in a Client Component boundary so the callback is available
12
- * on the client where asset fetches happen.
13
- */
14
- declare function RemoteComponentsClientProvider({ resolveClientUrl, children, }: {
15
- resolveClientUrl?: ResolveClientUrl;
16
- children: React.ReactNode;
17
- }): react_jsx_runtime.JSX.Element;
18
- declare function useRemoteComponentsContext(): RemoteComponentsContextValue;
6
+ declare const RemoteComponentsContext: react.Context<ConsumeClientOnlyConfig>;
7
+ declare function useRemoteComponentsContext(): ConsumeClientOnlyConfig;
19
8
 
20
- export { RemoteComponentsClientProvider, useRemoteComponentsContext };
9
+ export { RemoteComponentsContext, useRemoteComponentsContext };
@@ -1,18 +1,13 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
2
  import { createContext, useContext } from "react";
4
- const RemoteComponentsContext = createContext({});
5
- function RemoteComponentsClientProvider({
6
- resolveClientUrl,
7
- children
8
- }) {
9
- return /* @__PURE__ */ jsx(RemoteComponentsContext, { value: { resolveClientUrl }, children });
10
- }
3
+ const RemoteComponentsContext = createContext(
4
+ {}
5
+ );
11
6
  function useRemoteComponentsContext() {
12
7
  return useContext(RemoteComponentsContext);
13
8
  }
14
9
  export {
15
- RemoteComponentsClientProvider,
10
+ RemoteComponentsContext,
16
11
  useRemoteComponentsContext
17
12
  };
18
13
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/host/react/context.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\ninterface RemoteComponentsContextValue {\n resolveClientUrl?: ResolveClientUrl;\n}\n\nconst RemoteComponentsContext = createContext<RemoteComponentsContextValue>({});\n\n/**\n * Client-side context provider for passing `resolveClientUrl` to all nested\n * `<ConsumeRemoteComponent>` instances. Since `resolveClientUrl` is a function, it\n * can't be passed as a prop through Server Components — this provider should\n * wrap the tree in a Client Component boundary so the callback is available\n * on the client where asset fetches happen.\n */\nexport function RemoteComponentsClientProvider({\n resolveClientUrl,\n children,\n}: {\n resolveClientUrl?: ResolveClientUrl;\n children: React.ReactNode;\n}) {\n return (\n <RemoteComponentsContext value={{ resolveClientUrl }}>\n {children}\n </RemoteComponentsContext>\n );\n}\n\nexport function useRemoteComponentsContext(): RemoteComponentsContextValue {\n return useContext(RemoteComponentsContext);\n}\n"],"mappings":";AA0BI;AAxBJ,SAAS,eAAe,kBAAkB;AAO1C,MAAM,0BAA0B,cAA4C,CAAC,CAAC;AASvE,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,GAGG;AACD,SACE,oBAAC,2BAAwB,OAAO,EAAE,iBAAiB,GAChD,UACH;AAEJ;AAEO,SAAS,6BAA2D;AACzE,SAAO,WAAW,uBAAuB;AAC3C;","names":[]}
1
+ {"version":3,"sources":["../../../../src/host/react/context.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\nimport type { ConsumeClientOnlyConfig } from '#internal/host/shared/config';\n\nexport const RemoteComponentsContext = createContext<ConsumeClientOnlyConfig>(\n {},\n);\n\nexport function useRemoteComponentsContext(): ConsumeClientOnlyConfig {\n return useContext(RemoteComponentsContext);\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AAGnC,MAAM,0BAA0B;AAAA,EACrC,CAAC;AACH;AAEO,SAAS,6BAAsD;AACpE,SAAO,WAAW,uBAAuB;AAC3C;","names":[]}
@@ -26,11 +26,8 @@ var import_context = require("#internal/host/react/context");
26
26
  var import_default_resolve_client_url = require("#internal/runtime/url/default-resolve-client-url");
27
27
  function useResolveClientUrl(prop, urlHref) {
28
28
  const { resolveClientUrl: contextValue } = (0, import_context.useRemoteComponentsContext)();
29
- const resolveClientUrl = prop ?? contextValue;
30
- return (0, import_react.useMemo)(
31
- () => (0, import_default_resolve_client_url.bindResolveClientUrl)(resolveClientUrl, urlHref),
32
- [resolveClientUrl, urlHref]
33
- );
29
+ const raw = prop ?? contextValue;
30
+ return (0, import_react.useMemo)(() => (0, import_default_resolve_client_url.bindResolveClientUrl)(raw, urlHref), [raw, urlHref]);
34
31
  }
35
32
  // Annotate the CommonJS export names for ESM import in node:
36
33
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/host/react/hooks/use-resolve-client-url.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useRemoteComponentsContext } from '#internal/host/react/context';\nimport { bindResolveClientUrl } from '#internal/runtime/url/default-resolve-client-url';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\nexport function useResolveClientUrl(\n prop: ResolveClientUrl | undefined,\n urlHref: string,\n) {\n const { resolveClientUrl: contextValue } = useRemoteComponentsContext();\n const resolveClientUrl = prop ?? contextValue;\n return useMemo(\n () => bindResolveClientUrl(resolveClientUrl, urlHref),\n [resolveClientUrl, urlHref],\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwB;AACxB,qBAA2C;AAC3C,wCAAqC;AAG9B,SAAS,oBACd,MACA,SACA;AACA,QAAM,EAAE,kBAAkB,aAAa,QAAI,2CAA2B;AACtE,QAAM,mBAAmB,QAAQ;AACjC,aAAO;AAAA,IACL,UAAM,wDAAqB,kBAAkB,OAAO;AAAA,IACpD,CAAC,kBAAkB,OAAO;AAAA,EAC5B;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/host/react/hooks/use-resolve-client-url.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useRemoteComponentsContext } from '#internal/host/react/context';\nimport { bindResolveClientUrl } from '#internal/runtime/url/default-resolve-client-url';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\nexport function useResolveClientUrl(\n prop: ResolveClientUrl | undefined,\n urlHref: string,\n) {\n const { resolveClientUrl: contextValue } = useRemoteComponentsContext();\n const raw = prop ?? contextValue;\n return useMemo(() => bindResolveClientUrl(raw, urlHref), [raw, urlHref]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwB;AACxB,qBAA2C;AAC3C,wCAAqC;AAG9B,SAAS,oBACd,MACA,SACA;AACA,QAAM,EAAE,kBAAkB,aAAa,QAAI,2CAA2B;AACtE,QAAM,MAAM,QAAQ;AACpB,aAAO,sBAAQ,UAAM,wDAAqB,KAAK,OAAO,GAAG,CAAC,KAAK,OAAO,CAAC;AACzE;","names":[]}
@@ -3,11 +3,8 @@ import { useRemoteComponentsContext } from "#internal/host/react/context";
3
3
  import { bindResolveClientUrl } from "#internal/runtime/url/default-resolve-client-url";
4
4
  function useResolveClientUrl(prop, urlHref) {
5
5
  const { resolveClientUrl: contextValue } = useRemoteComponentsContext();
6
- const resolveClientUrl = prop ?? contextValue;
7
- return useMemo(
8
- () => bindResolveClientUrl(resolveClientUrl, urlHref),
9
- [resolveClientUrl, urlHref]
10
- );
6
+ const raw = prop ?? contextValue;
7
+ return useMemo(() => bindResolveClientUrl(raw, urlHref), [raw, urlHref]);
11
8
  }
12
9
  export {
13
10
  useResolveClientUrl
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/host/react/hooks/use-resolve-client-url.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useRemoteComponentsContext } from '#internal/host/react/context';\nimport { bindResolveClientUrl } from '#internal/runtime/url/default-resolve-client-url';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\nexport function useResolveClientUrl(\n prop: ResolveClientUrl | undefined,\n urlHref: string,\n) {\n const { resolveClientUrl: contextValue } = useRemoteComponentsContext();\n const resolveClientUrl = prop ?? contextValue;\n return useMemo(\n () => bindResolveClientUrl(resolveClientUrl, urlHref),\n [resolveClientUrl, urlHref],\n );\n}\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AAG9B,SAAS,oBACd,MACA,SACA;AACA,QAAM,EAAE,kBAAkB,aAAa,IAAI,2BAA2B;AACtE,QAAM,mBAAmB,QAAQ;AACjC,SAAO;AAAA,IACL,MAAM,qBAAqB,kBAAkB,OAAO;AAAA,IACpD,CAAC,kBAAkB,OAAO;AAAA,EAC5B;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/host/react/hooks/use-resolve-client-url.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useRemoteComponentsContext } from '#internal/host/react/context';\nimport { bindResolveClientUrl } from '#internal/runtime/url/default-resolve-client-url';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\nexport function useResolveClientUrl(\n prop: ResolveClientUrl | undefined,\n urlHref: string,\n) {\n const { resolveClientUrl: contextValue } = useRemoteComponentsContext();\n const raw = prop ?? contextValue;\n return useMemo(() => bindResolveClientUrl(raw, urlHref), [raw, urlHref]);\n}\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AAG9B,SAAS,oBACd,MACA,SACA;AACA,QAAM,EAAE,kBAAkB,aAAa,IAAI,2BAA2B;AACtE,QAAM,MAAM,QAAQ;AACpB,SAAO,QAAQ,MAAM,qBAAqB,KAAK,OAAO,GAAG,CAAC,KAAK,OAAO,CAAC;AACzE;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/host/shared/config.ts"],"sourcesContent":["import type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\nimport type { OnRequestHook, OnResponseHook } from './fetch-interceptors';\n\n/**\n * Configuration for Shadow DOM isolation of a remote component.\n *\n * Used by both the public {@link ConsumeRemoteComponentConfig} (user-facing props) and\n * {@link ConsumeServerData} (internal runtime data) to control\n * whether and how the remote component is wrapped in a shadow root.\n */\nexport interface ShadowDomConfig {\n /** Whether to isolate the remote component using a Shadow DOM wrapper. */\n isolate?: boolean;\n /** The Shadow DOM mode. Defaults to `'open'`. */\n mode?: 'open' | 'closed';\n /** Whether to include a CSS reset style in the Shadow DOM. Defaults to `false`. */\n reset?: boolean;\n}\n\n/**\n * Configuration accepted by server-rendered embed hosts (e.g. the Next.js App Router\n * `<ConsumeRemoteComponent>`). This is the minimal, serializable subset — no client-side\n * asset fetching fields, no lifecycle callbacks.\n *\n * `src` is optional here because not every host has a source at construction\n * time (e.g. the React host during SSR hydration, or a `<remote-component>`\n * element before its `src` attribute is set). Frameworks that require `src`\n * narrow it to required in their own props type.\n */\nexport interface ConsumeServerConfig extends ShadowDomConfig {\n /** The source URL of the remote component. Relative or absolute. */\n src?: string | URL;\n /** Selects a named remote component when multiple are exposed on a single page. */\n name?: string;\n /** Intercepts fetch requests before they are sent. */\n onRequest?: OnRequestHook;\n /** Inspects or transforms fetch responses after they arrive. */\n onResponse?: OnResponseHook;\n}\n\n/**\n * Client-only configuration fields — the subset of {@link ConsumeClientConfig}\n * that applies only to client-side asset fetching. Used directly in contexts where\n * the full server config is already present (e.g. {@link ConsumeRemoteComponentClient}).\n */\nexport interface ConsumeClientOnlyConfig {\n /** The credentials mode for the fetch request. Defaults to `'same-origin'`. */\n credentials?: RequestCredentials;\n /**\n * Rewrites client-side asset URLs (scripts, stylesheets, chunks, modules, images).\n * Return a new URL string to redirect the request (e.g. through a proxy),\n * or `undefined` to use the original URL.\n */\n resolveClientUrl?: ResolveClientUrl;\n}\n\n/**\n * Configuration accepted by client-side embed hosts (React host, Pages Router host,\n * HTML host). Extends {@link ConsumeServerConfig} with fields for\n * client-side asset fetching (`credentials`, `resolveClientUrl`).\n */\nexport interface ConsumeClientConfig\n extends ConsumeServerConfig,\n ConsumeClientOnlyConfig {}\n\n/**\n * Complete configuration for client-side embed hosts (React host, Pages Router host).\n * Combines {@link ConsumeClientConfig} with {@link ConsumeLifecycleCallbacks}.\n *\n * This is the base type for public-facing props on hosts that fetch and mount\n * remote components on the client. The App Router server host uses only\n * {@link ConsumeServerConfig} since RSC cannot accept function callbacks.\n */\nexport interface ConsumeRemoteComponentConfig\n extends ConsumeClientConfig,\n ConsumeLifecycleCallbacks {}\n\n/** Information provided to the `onChange` lifecycle callback. */\nexport interface ChangeInfo {\n previousSrc: string | URL | null;\n nextSrc: string | URL | null;\n previousName: string | undefined;\n nextName: string | undefined;\n}\n\n/**\n * Lifecycle callbacks shared by host and remote component implementations.\n *\n * On the host side, these fire during client-side loading (the React host\n * exposes them as callback props; the HTML host dispatches DOM events).\n * On the remote side (Next.js `<ExposeRemoteComponent>` wrapper), the callbacks\n * are forwarded as `data-on-*` attributes so the host can wire them up.\n *\n * Server-only components (e.g. Next.js App Router server host) do not\n * support these callbacks since they render once on the server.\n */\nexport interface ConsumeLifecycleCallbacks {\n /** Called right before a new remote component load starts. */\n onBeforeLoad?: (src: string | URL) => void;\n /** Called when the remote component has been successfully loaded and mounted. */\n onLoad?: (src: string | URL) => void;\n /** Called when an error occurs while loading or mounting the remote component. */\n onError?: (error: unknown) => void;\n /** Called when a different remote component is loaded into the same wrapper. */\n onChange?: (info: ChangeInfo) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../../src/host/shared/config.ts"],"sourcesContent":["import type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\nimport type { OnRequestHook, OnResponseHook } from './fetch-interceptors';\n\n/**\n * Configuration for Shadow DOM isolation of a remote component.\n *\n * Used by both the public {@link ConsumeRemoteComponentConfig} (user-facing props) and\n * {@link ConsumeServerData} (internal runtime data) to control\n * whether and how the remote component is wrapped in a shadow root.\n */\nexport interface ShadowDomConfig {\n /** Whether to isolate the remote component using a Shadow DOM wrapper. */\n isolate?: boolean;\n /** The Shadow DOM mode. Defaults to `'open'`. */\n mode?: 'open' | 'closed';\n /** Whether to include a CSS reset style in the Shadow DOM. Defaults to `false`. */\n reset?: boolean;\n}\n\n/**\n * Configuration accepted by server-rendered embed hosts (e.g. the Next.js App Router\n * `<ConsumeRemoteComponent>`). This is the minimal, serializable subset — no client-side\n * asset fetching fields, no lifecycle callbacks.\n *\n * `src` is optional here because not every host has a source at construction\n * time (e.g. the React host during SSR hydration, or a `<remote-component>`\n * element before its `src` attribute is set). Frameworks that require `src`\n * narrow it to required in their own props type.\n */\nexport interface ConsumeServerConfig extends ShadowDomConfig {\n /** The source URL of the remote component. Relative or absolute. */\n src?: string | URL;\n /** Selects a named remote component when multiple are exposed on a single page. */\n name?: string;\n /** Intercepts fetch requests before they are sent. */\n onRequest?: OnRequestHook;\n /** Inspects or transforms fetch responses after they arrive. */\n onResponse?: OnResponseHook;\n}\n\n/**\n * Client-only configuration fields — the subset of {@link ConsumeClientConfig}\n * that applies only to client-side asset fetching. Used directly in contexts where\n * the full server config is already present (e.g. {@link ConsumeRemoteComponentClient}).\n */\nexport interface ConsumeClientOnlyConfig {\n /** The credentials mode for the fetch request. Defaults to `'same-origin'`. */\n credentials?: RequestCredentials;\n /**\n * Rewrites client-side asset URLs (scripts, stylesheets, chunks, modules, images).\n * Return a new URL string to redirect the request (e.g. through a proxy),\n * or `undefined` to use the original URL.\n */\n resolveClientUrl?: ResolveClientUrl;\n /**\n * Shared module factories provided to the remote component's module system.\n * Each key is a module specifier; the value is a factory function that returns\n * the module. Since factories are functions, this can only be supplied from\n * client-side code and cannot be passed through Server Component boundaries.\n */\n shared?:\n | Promise<Record<string, (bundle?: string) => Promise<unknown>>>\n | Record<string, (bundle?: string) => Promise<unknown>>;\n}\n\n/**\n * Configuration accepted by client-side embed hosts (React host, Pages Router host,\n * HTML host). Extends {@link ConsumeServerConfig} with fields for\n * client-side asset fetching (`credentials`, `resolveClientUrl`).\n */\nexport interface ConsumeClientConfig\n extends ConsumeServerConfig,\n ConsumeClientOnlyConfig {}\n\n/**\n * Complete configuration for client-side embed hosts (React host, Pages Router host).\n * Combines {@link ConsumeClientConfig} with {@link ConsumeLifecycleCallbacks}.\n *\n * This is the base type for public-facing props on hosts that fetch and mount\n * remote components on the client. The App Router server host uses only\n * {@link ConsumeServerConfig} since RSC cannot accept function callbacks.\n */\nexport interface ConsumeRemoteComponentConfig\n extends ConsumeClientConfig,\n ConsumeLifecycleCallbacks {}\n\n/** Information provided to the `onChange` lifecycle callback. */\nexport interface ChangeInfo {\n previousSrc: string | URL | null;\n nextSrc: string | URL | null;\n previousName: string | undefined;\n nextName: string | undefined;\n}\n\n/**\n * Lifecycle callbacks shared by host and remote component implementations.\n *\n * On the host side, these fire during client-side loading (the React host\n * exposes them as callback props; the HTML host dispatches DOM events).\n * On the remote side (Next.js `<ExposeRemoteComponent>` wrapper), the callbacks\n * are forwarded as `data-on-*` attributes so the host can wire them up.\n *\n * Server-only components (e.g. Next.js App Router server host) do not\n * support these callbacks since they render once on the server.\n */\nexport interface ConsumeLifecycleCallbacks {\n /** Called right before a new remote component load starts. */\n onBeforeLoad?: (src: string | URL) => void;\n /** Called when the remote component has been successfully loaded and mounted. */\n onLoad?: (src: string | URL) => void;\n /** Called when an error occurs while loading or mounting the remote component. */\n onError?: (error: unknown) => void;\n /** Called when a different remote component is loaded into the same wrapper. */\n onChange?: (info: ChangeInfo) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -50,6 +50,13 @@ interface ConsumeClientOnlyConfig {
50
50
  * or `undefined` to use the original URL.
51
51
  */
52
52
  resolveClientUrl?: ResolveClientUrl;
53
+ /**
54
+ * Shared module factories provided to the remote component's module system.
55
+ * Each key is a module specifier; the value is a factory function that returns
56
+ * the module. Since factories are functions, this can only be supplied from
57
+ * client-side code and cannot be passed through Server Component boundaries.
58
+ */
59
+ shared?: Promise<Record<string, (bundle?: string) => Promise<unknown>>> | Record<string, (bundle?: string) => Promise<unknown>>;
53
60
  }
54
61
  /**
55
62
  * Configuration accepted by client-side embed hosts (React host, Pages Router host,
@@ -18,62 +18,12 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var polyfill_exports = {};
20
20
  __export(polyfill_exports, {
21
- applyBundleUrlToImagePropsSrc: () => applyBundleUrlToImagePropsSrc,
22
21
  sharedPolyfills: () => sharedPolyfills
23
22
  });
24
23
  module.exports = __toCommonJS(polyfill_exports);
25
- var import_jsx_runtime = (
26
- // eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
27
- require("react/jsx-runtime")
28
- );
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_remote_image_loader = require("#internal/host/shared/remote-image-loader");
29
26
  var import_logger = require("#internal/utils/logger");
30
- function applyBundleUrlToSrc(bundle, src) {
31
- const self = globalThis;
32
- if (self.__remote_bundle_url__?.[bundle]?.origin === location.origin) {
33
- return src;
34
- }
35
- const { assetPrefix, path } = /^(?<assetPrefix>.*?)\/_next\/(?<path>.*)/.exec(src)?.groups ?? {};
36
- if (!path) {
37
- return new URL(src, self.__remote_bundle_url__?.[bundle]?.origin).href;
38
- }
39
- return `${self.__remote_bundle_url__?.[bundle]?.origin ?? ""}${assetPrefix}/_next/${path}`;
40
- }
41
- function applyBundleUrlToImagePropsSrc(bundle, src) {
42
- if (typeof src === "string") {
43
- return applyBundleUrlToSrc(bundle, src);
44
- }
45
- const propSrc = src;
46
- return applyBundleUrlToSrc(bundle, propSrc.src);
47
- }
48
- const imageImpl = (bundle, resolveClientUrl) => function RemoteImage({
49
- fill: _fill,
50
- loader: _loader,
51
- quality: _quality,
52
- priority: _priority,
53
- loading: _loading,
54
- placeholder: _placeholder,
55
- blurDataURL: _blurDataURL,
56
- unoptimized: _unoptimized,
57
- overrideSrc: _overrideSrc,
58
- src,
59
- ...props
60
- }) {
61
- const newSrc = applyBundleUrlToImagePropsSrc(
62
- bundle,
63
- typeof src === "string" ? src : src.src
64
- );
65
- const proxiedSrc = resolveClientUrl?.(newSrc) ?? newSrc;
66
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
- "img",
68
- {
69
- decoding: "async",
70
- style: { color: "transparent" },
71
- ...props,
72
- src: proxiedSrc,
73
- suppressHydrationWarning: true
74
- }
75
- );
76
- };
77
27
  function sharedPolyfills(shared, resolveClientUrl) {
78
28
  const self = globalThis;
79
29
  const polyfill = {
@@ -164,17 +114,13 @@ function sharedPolyfills(shared, resolveClientUrl) {
164
114
  },
165
115
  __esModule: true
166
116
  })),
167
- "next/dist/client/image-component": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
168
- Image: imageImpl(bundle, resolveClientUrl),
169
- __esModule: true
170
- })),
171
- "next/image": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
172
- default: imageImpl(bundle, resolveClientUrl),
173
- getImageProps: (_imgProps) => {
174
- throw new Error(
175
- "Next.js getImageProps() is not implemented in remote components"
176
- );
177
- },
117
+ // Instead of replacing next/image entirely, we let the real Next.js Image
118
+ // component load from the remote bundle and only replace its default loader.
119
+ // This gives us full next/image fidelity (fill, priority, srcSet, blur
120
+ // placeholders, error handling) while routing image optimization through the
121
+ // remote app's /_next/image endpoint.
122
+ "next/dist/shared/lib/image-loader": self.__remote_component_host_shared_modules__?.["next/dist/shared/lib/image-loader"] ?? shared?.["next/dist/shared/lib/image-loader"] ?? ((bundle) => Promise.resolve({
123
+ default: (0, import_remote_image_loader.createRemoteImageLoader)(bundle, resolveClientUrl),
178
124
  __esModule: true
179
125
  })),
180
126
  "next/dist/client/script": self.__remote_component_host_shared_modules__?.["next/script"] ?? shared?.["next/script"] ?? (() => Promise.resolve({
@@ -214,13 +160,12 @@ function sharedPolyfills(shared, resolveClientUrl) {
214
160
  polyfill["next/navigation"] = polyfill["next/dist/client/components/navigation"];
215
161
  polyfill["next/link"] = polyfill["next/dist/client/app-dir/link"];
216
162
  polyfill["next/form"] = polyfill["next/dist/client/app-dir/form"];
217
- polyfill["next/dist/api/image"] = polyfill["next/dist/client/image-component"];
163
+ polyfill["next/dist/esm/shared/lib/image-loader"] = polyfill["next/dist/shared/lib/image-loader"];
218
164
  polyfill["next/script"] = polyfill["next/dist/client/script"];
219
165
  return polyfill;
220
166
  }
221
167
  // Annotate the CommonJS export names for ESM import in node:
222
168
  0 && (module.exports = {
223
- applyBundleUrlToImagePropsSrc,
224
169
  sharedPolyfills
225
170
  });
226
171
  //# sourceMappingURL=polyfill.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/host/shared/polyfill.tsx"],"sourcesContent":["import type { ImageProps, StaticImageData } from 'next/image';\nimport type { LinkProps } from 'next/link';\nimport type { InternalResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\nimport { logWarn } from '#internal/utils/logger';\n\nfunction applyBundleUrlToSrc(bundle: string, src: string) {\n const self = globalThis as typeof globalThis & {\n __remote_bundle_url__?: Record<string, URL>;\n };\n\n if (self.__remote_bundle_url__?.[bundle]?.origin === location.origin) {\n return src;\n }\n\n const { assetPrefix, path } =\n /^(?<assetPrefix>.*?)\\/_next\\/(?<path>.*)/.exec(src)?.groups ?? {};\n if (!path) {\n return new URL(src, self.__remote_bundle_url__?.[bundle]?.origin).href;\n }\n return `${\n self.__remote_bundle_url__?.[bundle]?.origin ?? ''\n }${assetPrefix}/_next/${path}`;\n}\n\nexport function applyBundleUrlToImagePropsSrc(\n bundle: string,\n src: ImageProps['src'],\n) {\n if (typeof src === 'string') {\n return applyBundleUrlToSrc(bundle, src);\n }\n const propSrc = src as StaticImageData;\n return applyBundleUrlToSrc(bundle, propSrc.src);\n}\n\nconst imageImpl = (\n bundle: string,\n resolveClientUrl?: InternalResolveClientUrl,\n) =>\n function RemoteImage({\n fill: _fill,\n loader: _loader,\n quality: _quality,\n priority: _priority,\n loading: _loading,\n placeholder: _placeholder,\n blurDataURL: _blurDataURL,\n unoptimized: _unoptimized,\n overrideSrc: _overrideSrc,\n src,\n ...props\n }: ImageProps) {\n const newSrc = applyBundleUrlToImagePropsSrc(\n bundle,\n typeof src === 'string' ? src : (src as StaticImageData).src,\n );\n const proxiedSrc = resolveClientUrl?.(newSrc) ?? newSrc;\n\n return (\n // eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text\n <img\n decoding=\"async\"\n style={{ color: 'transparent' }}\n {...props}\n src={proxiedSrc}\n suppressHydrationWarning\n />\n );\n };\n\n// polyfill Next.js App Router client API (minimal)\n// implementations are minimal and do not cover all use cases\n// developer can override these shared modules from configuration\nexport function sharedPolyfills(\n shared?: Record<string, () => Promise<unknown>>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n const self = globalThis as typeof globalThis & {\n __remote_component_host_shared_modules__?: Record<\n string,\n () => Promise<unknown>\n >;\n };\n const polyfill = {\n 'next/dist/client/components/navigation':\n self.__remote_component_host_shared_modules__?.['next/navigation'] ??\n shared?.['next/navigation'] ??\n (() =>\n Promise.resolve({\n useRouter() {\n return {\n push: (routerUrl: string) => {\n history.pushState({}, '', routerUrl);\n },\n replace: (routerUrl: string) => {\n history.replaceState({}, '', routerUrl);\n },\n back: () => {\n history.back();\n },\n };\n },\n usePathname() {\n return location.pathname;\n },\n useParams() {\n return {};\n },\n useSearchParams() {\n return new URLSearchParams(location.search);\n },\n useSelectedLayoutSegment() {\n return null;\n },\n useSelectedLayoutSegments() {\n return [];\n },\n __esModule: true,\n })),\n 'next/dist/client/app-dir/link':\n self.__remote_component_host_shared_modules__?.['next/link'] ??\n shared?.['next/link'] ??\n (() =>\n Promise.resolve({\n default: ({\n scroll: _,\n replace,\n prefetch,\n onNavigate,\n children,\n ...props\n }: React.PropsWithChildren<LinkProps>) => {\n if (prefetch) {\n logWarn(\n 'Polyfill',\n 'Next.js Link prefetch is not supported in remote components',\n );\n }\n return (\n <a\n {...props}\n href={props.href as string}\n onClick={(e) => {\n e.preventDefault();\n let preventDefaulted = false;\n e.preventDefault = () => {\n preventDefaulted = true;\n e.defaultPrevented = true;\n };\n if (typeof props.onClick === 'function') {\n props.onClick(e);\n }\n onNavigate?.(e);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (preventDefaulted) {\n return;\n }\n if (replace) {\n history.replaceState({}, '', props.href as string);\n } else {\n history.pushState({}, '', props.href as string);\n }\n }}\n suppressHydrationWarning\n >\n {children ?? null}\n </a>\n );\n },\n useLinkStatus() {\n return { pending: false };\n },\n __esModule: true,\n })),\n 'next/dist/client/app-dir/form':\n self.__remote_component_host_shared_modules__?.['next/form'] ??\n shared?.['next/form'] ??\n (() =>\n Promise.resolve({\n default: () => {\n // TODO: implement <Form> component for non-Next.js host applications\n throw new Error('Next.js <Form> component not implemented');\n },\n __esModule: true,\n })),\n 'next/dist/client/image-component':\n self.__remote_component_host_shared_modules__?.['next/image'] ??\n shared?.['next/image'] ??\n ((bundle: string) =>\n Promise.resolve({\n Image: imageImpl(bundle, resolveClientUrl),\n __esModule: true,\n })),\n 'next/image':\n self.__remote_component_host_shared_modules__?.['next/image'] ??\n shared?.['next/image'] ??\n ((bundle: string) =>\n Promise.resolve({\n default: imageImpl(bundle, resolveClientUrl),\n getImageProps: (_imgProps: ImageProps) => {\n throw new Error(\n 'Next.js getImageProps() is not implemented in remote components',\n );\n },\n __esModule: true,\n })),\n 'next/dist/client/script':\n self.__remote_component_host_shared_modules__?.['next/script'] ??\n shared?.['next/script'] ??\n (() =>\n Promise.resolve({\n // TODO: implement <Script> component for non-Next.js host applications\n // do not throw an error for now\n default: () => null,\n __esModule: true,\n })),\n 'next/router':\n self.__remote_component_host_shared_modules__?.['next/router'] ??\n shared?.['next/router'] ??\n (() =>\n // TODO: incomplete implementation\n Promise.resolve({\n useRouter() {\n return {\n push: (routerUrl: string) => {\n history.pushState({}, '', routerUrl);\n },\n replace: (routerUrl: string) => {\n history.replaceState({}, '', routerUrl);\n },\n back: () => {\n history.back();\n },\n };\n },\n __esModule: true,\n })),\n 'next/dist/build/polyfills/process': () =>\n Promise.resolve({\n default: {\n env: {\n NODE_ENV: 'production',\n },\n },\n __esModule: true,\n }),\n } as Record<string, () => Promise<unknown>>;\n\n polyfill['next/navigation'] = polyfill[\n 'next/dist/client/components/navigation'\n ] as () => Promise<unknown>;\n polyfill['next/link'] = polyfill[\n 'next/dist/client/app-dir/link'\n ] as () => Promise<unknown>;\n polyfill['next/form'] = polyfill[\n 'next/dist/client/app-dir/form'\n ] as () => Promise<unknown>;\n polyfill['next/dist/api/image'] = polyfill[\n 'next/dist/client/image-component'\n ] as () => Promise<unknown>;\n polyfill['next/script'] = polyfill[\n 'next/dist/client/script'\n ] as () => Promise<unknown>;\n\n return polyfill;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4DM;AAAA;AA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,YACrC;AAAA,YACA,SAAS,CAAC,cAAsB;AAC9B,sBAAQ,aAAa,CAAC,GAAG,IAAI,SAAS;AAAA,YACxC;AAAA,YACA,MAAM,MAAM;AACV,sBAAQ,KAAK;AAAA,YACf;AAAA,UACF;AAAA,QACF;AAAA,QACA,YAAY;AAAA,MACd,CAAC;AAAA;AAAA,IACL,qCAAqC,MACnC,QAAQ,QAAQ;AAAA,MACd,SAAS;AAAA,QACP,KAAK;AAAA,UACH,UAAU;AAAA,QACZ;AAAA,MACF;AAAA,MACA,YAAY;AAAA,IACd,CAAC;AAAA,EACL;AAEA,WAAS,iBAAiB,IAAI,SAC5B,wCACF;AACA,WAAS,WAAW,IAAI,SACtB,+BACF;AACA,WAAS,WAAW,IAAI,SACtB,+BACF;AACA,WAAS,qBAAqB,IAAI,SAChC,kCACF;AACA,WAAS,aAAa,IAAI,SACxB,yBACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/host/shared/polyfill.tsx"],"sourcesContent":["import type { LinkProps } from 'next/link';\nimport { createRemoteImageLoader } from '#internal/host/shared/remote-image-loader';\nimport type { InternalResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\nimport { logWarn } from '#internal/utils/logger';\n\n// polyfill Next.js App Router client API (minimal)\n// implementations are minimal and do not cover all use cases\n// developer can override these shared modules from configuration\nexport function sharedPolyfills(\n shared?: Record<string, () => Promise<unknown>>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n const self = globalThis as typeof globalThis & {\n __remote_component_host_shared_modules__?: Record<\n string,\n () => Promise<unknown>\n >;\n };\n const polyfill = {\n 'next/dist/client/components/navigation':\n self.__remote_component_host_shared_modules__?.['next/navigation'] ??\n shared?.['next/navigation'] ??\n (() =>\n Promise.resolve({\n useRouter() {\n return {\n push: (routerUrl: string) => {\n history.pushState({}, '', routerUrl);\n },\n replace: (routerUrl: string) => {\n history.replaceState({}, '', routerUrl);\n },\n back: () => {\n history.back();\n },\n };\n },\n usePathname() {\n return location.pathname;\n },\n useParams() {\n return {};\n },\n useSearchParams() {\n return new URLSearchParams(location.search);\n },\n useSelectedLayoutSegment() {\n return null;\n },\n useSelectedLayoutSegments() {\n return [];\n },\n __esModule: true,\n })),\n 'next/dist/client/app-dir/link':\n self.__remote_component_host_shared_modules__?.['next/link'] ??\n shared?.['next/link'] ??\n (() =>\n Promise.resolve({\n default: ({\n scroll: _,\n replace,\n prefetch,\n onNavigate,\n children,\n ...props\n }: React.PropsWithChildren<LinkProps>) => {\n if (prefetch) {\n logWarn(\n 'Polyfill',\n 'Next.js Link prefetch is not supported in remote components',\n );\n }\n return (\n <a\n {...props}\n href={props.href as string}\n onClick={(e) => {\n e.preventDefault();\n let preventDefaulted = false;\n e.preventDefault = () => {\n preventDefaulted = true;\n e.defaultPrevented = true;\n };\n if (typeof props.onClick === 'function') {\n props.onClick(e);\n }\n onNavigate?.(e);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (preventDefaulted) {\n return;\n }\n if (replace) {\n history.replaceState({}, '', props.href as string);\n } else {\n history.pushState({}, '', props.href as string);\n }\n }}\n suppressHydrationWarning\n >\n {children ?? null}\n </a>\n );\n },\n useLinkStatus() {\n return { pending: false };\n },\n __esModule: true,\n })),\n 'next/dist/client/app-dir/form':\n self.__remote_component_host_shared_modules__?.['next/form'] ??\n shared?.['next/form'] ??\n (() =>\n Promise.resolve({\n default: () => {\n // TODO: implement <Form> component for non-Next.js host applications\n throw new Error('Next.js <Form> component not implemented');\n },\n __esModule: true,\n })),\n // Instead of replacing next/image entirely, we let the real Next.js Image\n // component load from the remote bundle and only replace its default loader.\n // This gives us full next/image fidelity (fill, priority, srcSet, blur\n // placeholders, error handling) while routing image optimization through the\n // remote app's /_next/image endpoint.\n 'next/dist/shared/lib/image-loader':\n self.__remote_component_host_shared_modules__?.[\n 'next/dist/shared/lib/image-loader'\n ] ??\n shared?.['next/dist/shared/lib/image-loader'] ??\n ((bundle: string) =>\n Promise.resolve({\n default: createRemoteImageLoader(bundle, resolveClientUrl),\n __esModule: true,\n })),\n 'next/dist/client/script':\n self.__remote_component_host_shared_modules__?.['next/script'] ??\n shared?.['next/script'] ??\n (() =>\n Promise.resolve({\n // TODO: implement <Script> component for non-Next.js host applications\n // do not throw an error for now\n default: () => null,\n __esModule: true,\n })),\n 'next/router':\n self.__remote_component_host_shared_modules__?.['next/router'] ??\n shared?.['next/router'] ??\n (() =>\n // TODO: incomplete implementation\n Promise.resolve({\n useRouter() {\n return {\n push: (routerUrl: string) => {\n history.pushState({}, '', routerUrl);\n },\n replace: (routerUrl: string) => {\n history.replaceState({}, '', routerUrl);\n },\n back: () => {\n history.back();\n },\n };\n },\n __esModule: true,\n })),\n 'next/dist/build/polyfills/process': () =>\n Promise.resolve({\n default: {\n env: {\n NODE_ENV: 'production',\n },\n },\n __esModule: true,\n }),\n } as Record<string, () => Promise<unknown>>;\n\n polyfill['next/navigation'] = polyfill[\n 'next/dist/client/components/navigation'\n ] as () => Promise<unknown>;\n polyfill['next/link'] = polyfill[\n 'next/dist/client/app-dir/link'\n ] as () => Promise<unknown>;\n polyfill['next/form'] = polyfill[\n 'next/dist/client/app-dir/form'\n ] as () => Promise<unknown>;\n polyfill['next/dist/esm/shared/lib/image-loader'] = polyfill[\n 'next/dist/shared/lib/image-loader'\n ] as () => Promise<unknown>;\n polyfill['next/script'] = polyfill[\n 'next/dist/client/script'\n ] as () => Promise<unknown>;\n\n return polyfill;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0Ec;AAzEd,iCAAwC;AAExC,oBAAwB;AAKjB,SAAS,gBACd,QACA,kBACA;AACA,QAAM,OAAO;AAMb,QAAM,WAAW;AAAA,IACf,0CACE,KAAK,2CAA2C,iBAAiB,KACjE,SAAS,iBAAiB,MACzB,MACC,QAAQ,QAAQ;AAAA,MACd,YAAY;AACV,eAAO;AAAA,UACL,MAAM,CAAC,cAAsB;AAC3B,oBAAQ,UAAU,CAAC,GAA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F;AAAA,MACA,YAAY;AAAA,IACd,CAAC;AAAA,EACL;AAEA,WAAS,iBAAiB,IAAI,SAC5B,wCACF;AACA,WAAS,WAAW,IAAI,SACtB,+BACF;AACA,WAAS,WAAW,IAAI,SACtB,+BACF;AACA,WAAS,uCAAuC,IAAI,SAClD,mCACF;AACA,WAAS,aAAa,IAAI,SACxB,yBACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,7 +1,5 @@
1
- import { ImageProps } from 'next/image';
2
1
  import { InternalResolveClientUrl } from '../../runtime/url/resolve-client-url.js';
3
2
 
4
- declare function applyBundleUrlToImagePropsSrc(bundle: string, src: ImageProps['src']): string;
5
3
  declare function sharedPolyfills(shared?: Record<string, () => Promise<unknown>>, resolveClientUrl?: InternalResolveClientUrl): Record<string, () => Promise<unknown>>;
6
4
 
7
- export { applyBundleUrlToImagePropsSrc, sharedPolyfills };
5
+ export { sharedPolyfills };