remote-components 0.2.2 → 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 (51) 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 +169 -237
  11. package/dist/host/nextjs/app/client-only.cjs.map +1 -1
  12. package/dist/host/nextjs/app/client-only.js +170 -238
  13. package/dist/host/nextjs/app/client-only.js.map +1 -1
  14. package/dist/host/nextjs/pages.cjs +1 -8
  15. package/dist/host/nextjs/pages.cjs.map +1 -1
  16. package/dist/host/nextjs/pages.js +2 -9
  17. package/dist/host/nextjs/pages.js.map +1 -1
  18. package/dist/host/react.cjs +37 -71
  19. package/dist/host/react.cjs.map +1 -1
  20. package/dist/host/react.js +37 -71
  21. package/dist/host/react.js.map +1 -1
  22. package/dist/internal/host/nextjs/app-client.cjs +3 -8
  23. package/dist/internal/host/nextjs/app-client.cjs.map +1 -1
  24. package/dist/internal/host/nextjs/app-client.js +4 -9
  25. package/dist/internal/host/nextjs/app-client.js.map +1 -1
  26. package/dist/internal/host/nextjs/image-shared.cjs +25 -15
  27. package/dist/internal/host/nextjs/image-shared.cjs.map +1 -1
  28. package/dist/internal/host/nextjs/image-shared.d.ts +19 -6
  29. package/dist/internal/host/nextjs/image-shared.js +24 -14
  30. package/dist/internal/host/nextjs/image-shared.js.map +1 -1
  31. package/dist/internal/host/react/hooks/use-resolve-client-url.cjs +1 -5
  32. package/dist/internal/host/react/hooks/use-resolve-client-url.cjs.map +1 -1
  33. package/dist/internal/host/react/hooks/use-resolve-client-url.d.ts +1 -4
  34. package/dist/internal/host/react/hooks/use-resolve-client-url.js +1 -5
  35. package/dist/internal/host/react/hooks/use-resolve-client-url.js.map +1 -1
  36. package/dist/internal/host/shared/polyfill.cjs +10 -65
  37. package/dist/internal/host/shared/polyfill.cjs.map +1 -1
  38. package/dist/internal/host/shared/polyfill.d.ts +1 -3
  39. package/dist/internal/host/shared/polyfill.js +9 -63
  40. package/dist/internal/host/shared/polyfill.js.map +1 -1
  41. package/dist/internal/host/shared/remote-image-loader.cjs +53 -0
  42. package/dist/internal/host/shared/remote-image-loader.cjs.map +1 -0
  43. package/dist/internal/host/shared/remote-image-loader.d.ts +30 -0
  44. package/dist/internal/host/shared/remote-image-loader.js +29 -0
  45. package/dist/internal/host/shared/remote-image-loader.js.map +1 -0
  46. package/package.json +1 -1
  47. package/dist/internal/host/nextjs/image-impl.cjs +0 -64
  48. package/dist/internal/host/nextjs/image-impl.cjs.map +0 -1
  49. package/dist/internal/host/nextjs/image-impl.d.ts +0 -10
  50. package/dist/internal/host/nextjs/image-impl.js +0 -40
  51. package/dist/internal/host/nextjs/image-impl.js.map +0 -1
@@ -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;AAAA;AAAA;AAzDN,oBAAwB;AAExB,SAAS,oBAAoB,QAAgB,KAAa;AACxD,QAAM,OA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AI,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,GAAG,IAAI,SAAS;AAAA,UACrC;AAAA,UACA,SAAS,CAAC,cAAsB;AAC9B,oBAAQ,a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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 };
@@ -1,55 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { createRemoteImageLoader } from "#internal/host/shared/remote-image-loader";
2
3
  import { logWarn } from "#internal/utils/logger";
3
- function applyBundleUrlToSrc(bundle, src) {
4
- const self = globalThis;
5
- if (self.__remote_bundle_url__?.[bundle]?.origin === location.origin) {
6
- return src;
7
- }
8
- const { assetPrefix, path } = /^(?<assetPrefix>.*?)\/_next\/(?<path>.*)/.exec(src)?.groups ?? {};
9
- if (!path) {
10
- return new URL(src, self.__remote_bundle_url__?.[bundle]?.origin).href;
11
- }
12
- return `${self.__remote_bundle_url__?.[bundle]?.origin ?? ""}${assetPrefix}/_next/${path}`;
13
- }
14
- function applyBundleUrlToImagePropsSrc(bundle, src) {
15
- if (typeof src === "string") {
16
- return applyBundleUrlToSrc(bundle, src);
17
- }
18
- const propSrc = src;
19
- return applyBundleUrlToSrc(bundle, propSrc.src);
20
- }
21
- const imageImpl = (bundle, resolveClientUrl) => function RemoteImage({
22
- fill: _fill,
23
- loader: _loader,
24
- quality: _quality,
25
- priority: _priority,
26
- loading: _loading,
27
- placeholder: _placeholder,
28
- blurDataURL: _blurDataURL,
29
- unoptimized: _unoptimized,
30
- overrideSrc: _overrideSrc,
31
- src,
32
- ...props
33
- }) {
34
- const newSrc = applyBundleUrlToImagePropsSrc(
35
- bundle,
36
- typeof src === "string" ? src : src.src
37
- );
38
- const proxiedSrc = resolveClientUrl?.(newSrc) ?? newSrc;
39
- return (
40
- // eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
41
- /* @__PURE__ */ jsx(
42
- "img",
43
- {
44
- decoding: "async",
45
- style: { color: "transparent" },
46
- ...props,
47
- src: proxiedSrc,
48
- suppressHydrationWarning: true
49
- }
50
- )
51
- );
52
- };
53
4
  function sharedPolyfills(shared, resolveClientUrl) {
54
5
  const self = globalThis;
55
6
  const polyfill = {
@@ -140,17 +91,13 @@ function sharedPolyfills(shared, resolveClientUrl) {
140
91
  },
141
92
  __esModule: true
142
93
  })),
143
- "next/dist/client/image-component": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
144
- Image: imageImpl(bundle, resolveClientUrl),
145
- __esModule: true
146
- })),
147
- "next/image": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
148
- default: imageImpl(bundle, resolveClientUrl),
149
- getImageProps: (_imgProps) => {
150
- throw new Error(
151
- "Next.js getImageProps() is not implemented in remote components"
152
- );
153
- },
94
+ // Instead of replacing next/image entirely, we let the real Next.js Image
95
+ // component load from the remote bundle and only replace its default loader.
96
+ // This gives us full next/image fidelity (fill, priority, srcSet, blur
97
+ // placeholders, error handling) while routing image optimization through the
98
+ // remote app's /_next/image endpoint.
99
+ "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({
100
+ default: createRemoteImageLoader(bundle, resolveClientUrl),
154
101
  __esModule: true
155
102
  })),
156
103
  "next/dist/client/script": self.__remote_component_host_shared_modules__?.["next/script"] ?? shared?.["next/script"] ?? (() => Promise.resolve({
@@ -190,12 +137,11 @@ function sharedPolyfills(shared, resolveClientUrl) {
190
137
  polyfill["next/navigation"] = polyfill["next/dist/client/components/navigation"];
191
138
  polyfill["next/link"] = polyfill["next/dist/client/app-dir/link"];
192
139
  polyfill["next/form"] = polyfill["next/dist/client/app-dir/form"];
193
- polyfill["next/dist/api/image"] = polyfill["next/dist/client/image-component"];
140
+ polyfill["next/dist/esm/shared/lib/image-loader"] = polyfill["next/dist/shared/lib/image-loader"];
194
141
  polyfill["next/script"] = polyfill["next/dist/client/script"];
195
142
  return polyfill;
196
143
  }
197
144
  export {
198
- applyBundleUrlToImagePropsSrc,
199
145
  sharedPolyfills
200
146
  };
201
147
  //# sourceMappingURL=polyfill.js.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":"AA4DM;AAzDN,SAAS,eAAe;AAExB,SAAS,oBAAoB,QAAgB,KAAa;AACxD,QAAM,OAAO;AAIb,MAAI,KAAK,wBAAwB,MAAM,GAAG,WAAW,SAAS,QAAQ;AACpE,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,aAAa,KAAK,IACxB,2CAA2C,KAAK,GAAG,GAAG,UAAU,CAAC;AACnE,MAAI,CAAC,MAAM;AACT,WAAO,IAAI,IAAI,KAAK,KAAK,wBAAwB,MAAM,GAAG,MAAM,EAAE;AAAA,EACpE;AACA,SAAO,GACL,KAAK,wBAAwB,MAAM,GAAG,UAAU,KAC/C,qBAAqB;AAC1B;AAEO,SAAS,8BACd,QACA,KACA;AACA,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,oBAAoB,QAAQ,GAAG;AAAA,EACxC;AACA,QAAM,UAAU;AAChB,SAAO,oBAAoB,QAAQ,QAAQ,GAAG;AAChD;AAEA,MAAM,YAAY,CAChB,QACA,qBAEA,SAAS,YAAY;AAAA,EACnB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EAC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AAY,KAC5D,SAAS,YAAY,MACpB,CAAC,WACA,QAAQ,QAAQ;AAAA,MACd,SAAS,UAAU,QAAQ,gBAAgB;AAAA,MAC3C,eAAe,CAAC,cAA0B;AACxC,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAAA,MACA,YAAY;AAAA,IACd,CAAC;AAAA,IACL,2BACE,KAAK,2CAA2C,aAAa,KAC7D,SAAS,aAAa,MACrB,MACC,QAAQ,QAAQ;AAAA;AAAA;AAAA,MAGd,SAAS,MAAM;AAAA,MACf,YAAY;AAAA,IACd,CAAC;AAAA,IACL,eACE,KAAK,2CAA2C,aAAa,KAC7D,SAAS,aAAa,MACrB;AAAA;AAAA,MAEC,QAAQ,QAAQ;AAAA,QACd,YAAY;AACV,iBAAO;AAAA,YACL,MAAM,CAAC,cAAsB;AAC3B,sBAAQ,UAAU,CAAC,GAAG,IAAI,SAAS;AAAA,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":"AA0Ec;AAzEd,SAAS,+BAA+B;AAExC,SAAS,eAAe;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,GAAG,IAAI,SAAS;AAAA,UACrC;AAAA,UACA,SAAS,CAAC,cAAsB;AAC9B,oBAAQ,aAAa,CAAC,GAAG,IAAI,SAAS;AAAA,UACxC;AAAA,UACA,MAAM,MAAM;AACV,oBAAQ,KAAK;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,MACA,cAAc;AACZ,eAAO,SAAS;AAAA,MAClB;AAAA,MACA,YAAY;AACV,eAAO,CAAC;AAAA,MACV;AAAA,MACA,kBAAkB;AAChB,eAAO,IAAI,gBAAgB,SAAS,MAAM;AAAA,MAC5C;AAAA,MACA,2BAA2B;AACzB,eAAO;AAAA,MACT;AAAA,MACA,4BAA4B;AAC1B,eAAO,CAAC;AAAA,MACV;AAAA,MACA,YAAY;AAAA,IACd,CAAC;AAAA,IACL,iCACE,KAAK,2CAA2C,WAAW,KAC3D,SAAS,WAAW,MACnB,MACC,QAAQ,QAAQ;AAAA,MACd,SAAS,CAAC;AAAA,QACR,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MACL,MAA0C;AACxC,YAAI,UAAU;AACZ;AAAA,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;AAAA,IACL,eACE,KAAK,2CAA2C,aAAa,KAC7D,SAAS,aAAa,MACrB;AAAA;AAAA,MAEC,QAAQ,QAAQ;AAAA,QACd,YAAY;AACV,iBAAO;AAAA,YACL,MAAM,CAAC,cAAsB;AAC3B,sBAAQ,UAAU,CAAC,GAAG,IAAI,SAAS;AAAA,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,uCAAuC,IAAI,SAClD,mCACF;AACA,WAAS,aAAa,IAAI,SACxB,yBACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var remote_image_loader_exports = {};
20
+ __export(remote_image_loader_exports, {
21
+ createRemoteImageLoader: () => createRemoteImageLoader
22
+ });
23
+ module.exports = __toCommonJS(remote_image_loader_exports);
24
+ function getRemoteBundleOrigin(bundle) {
25
+ const self = globalThis;
26
+ return self.__remote_bundle_url__?.[bundle]?.origin ?? "";
27
+ }
28
+ function createRemoteImageLoader(bundle, resolveClientUrl) {
29
+ const loader = Object.assign(
30
+ ({
31
+ config,
32
+ src,
33
+ width,
34
+ quality
35
+ }) => {
36
+ const q = quality ?? 75;
37
+ const remoteOrigin = getRemoteBundleOrigin(bundle);
38
+ const isCrossOrigin = remoteOrigin && remoteOrigin !== location.origin;
39
+ const basePath = isCrossOrigin ? `${remoteOrigin}${config.path ?? "/_next/image"}` : config.path ?? `${remoteOrigin}/_next/image`;
40
+ const url = `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${q}`;
41
+ return resolveClientUrl?.(url) ?? url;
42
+ },
43
+ // Signals to getImgProps that this is a default loader (not a user-defined
44
+ // one), enabling srcSet generation with device/image sizes from the config.
45
+ { __next_img_default: true }
46
+ );
47
+ return loader;
48
+ }
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ createRemoteImageLoader
52
+ });
53
+ //# sourceMappingURL=remote-image-loader.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/host/shared/remote-image-loader.ts"],"sourcesContent":["import type { InternalResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\nfunction getRemoteBundleOrigin(bundle: string): string {\n const self = globalThis as typeof globalThis & {\n __remote_bundle_url__?: Record<string, URL>;\n };\n return self.__remote_bundle_url__?.[bundle]?.origin ?? '';\n}\n\n/**\n * Replacement for `next/dist/shared/lib/image-loader`.\n *\n * Uses `config.path` (which includes the remote's asset prefix, e.g.\n * `/vc-ap-xxx/_next/image`) to generate URLs that match the server-rendered\n * HTML and avoid hydration mismatches. Under the microfrontends proxy these\n * relative paths are routed to the correct app.\n *\n * For cross-origin deployments (standalone host on a different domain),\n * `config.path` is a relative path that would incorrectly resolve to the host\n * origin, so we prefix it with the remote origin to produce an absolute URL\n * pointing at the remote's optimizer.\n *\n * When `resolveClientUrl` is provided (deployment protection), the final URL\n * is routed through the host's proxy.\n */\nexport function createRemoteImageLoader(\n bundle: string,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n const loader = Object.assign(\n ({\n config,\n src,\n width,\n quality,\n }: {\n config: { path?: string };\n src: string;\n width: number;\n quality?: number;\n }) => {\n const q = quality ?? 75;\n const remoteOrigin = getRemoteBundleOrigin(bundle);\n const isCrossOrigin = remoteOrigin && remoteOrigin !== location.origin;\n const basePath = isCrossOrigin\n ? `${remoteOrigin}${config.path ?? '/_next/image'}`\n : (config.path ?? `${remoteOrigin}/_next/image`);\n const url = `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${q}`;\n return resolveClientUrl?.(url) ?? url;\n },\n // Signals to getImgProps that this is a default loader (not a user-defined\n // one), enabling srcSet generation with device/image sizes from the config.\n { __next_img_default: true as const },\n );\n return loader;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,SAAS,sBAAsB,QAAwB;AACrD,QAAM,OAAO;AAGb,SAAO,KAAK,wBAAwB,MAAM,GAAG,UAAU;AACzD;AAkBO,SAAS,wBACd,QACA,kBACA;AACA,QAAM,SAAS,OAAO;AAAA,IACpB,CAAC;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,MAKM;AACJ,YAAM,IAAI,WAAW;AACrB,YAAM,eAAe,sBAAsB,MAAM;AACjD,YAAM,gBAAgB,gBAAgB,iBAAiB,SAAS;AAChE,YAAM,WAAW,gBACb,GAAG,eAAe,OAAO,QAAQ,mBAChC,OAAO,QAAQ,GAAG;AACvB,YAAM,MAAM,GAAG,gBAAgB,mBAAmB,GAAG,OAAO,WAAW;AACvE,aAAO,mBAAmB,GAAG,KAAK;AAAA,IACpC;AAAA;AAAA;AAAA,IAGA,EAAE,oBAAoB,KAAc;AAAA,EACtC;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1,30 @@
1
+ import { InternalResolveClientUrl } from '../../runtime/url/resolve-client-url.js';
2
+
3
+ /**
4
+ * Replacement for `next/dist/shared/lib/image-loader`.
5
+ *
6
+ * Uses `config.path` (which includes the remote's asset prefix, e.g.
7
+ * `/vc-ap-xxx/_next/image`) to generate URLs that match the server-rendered
8
+ * HTML and avoid hydration mismatches. Under the microfrontends proxy these
9
+ * relative paths are routed to the correct app.
10
+ *
11
+ * For cross-origin deployments (standalone host on a different domain),
12
+ * `config.path` is a relative path that would incorrectly resolve to the host
13
+ * origin, so we prefix it with the remote origin to produce an absolute URL
14
+ * pointing at the remote's optimizer.
15
+ *
16
+ * When `resolveClientUrl` is provided (deployment protection), the final URL
17
+ * is routed through the host's proxy.
18
+ */
19
+ declare function createRemoteImageLoader(bundle: string, resolveClientUrl?: InternalResolveClientUrl): (({ config, src, width, quality, }: {
20
+ config: {
21
+ path?: string;
22
+ };
23
+ src: string;
24
+ width: number;
25
+ quality?: number;
26
+ }) => string) & {
27
+ __next_img_default: true;
28
+ };
29
+
30
+ export { createRemoteImageLoader };
@@ -0,0 +1,29 @@
1
+ function getRemoteBundleOrigin(bundle) {
2
+ const self = globalThis;
3
+ return self.__remote_bundle_url__?.[bundle]?.origin ?? "";
4
+ }
5
+ function createRemoteImageLoader(bundle, resolveClientUrl) {
6
+ const loader = Object.assign(
7
+ ({
8
+ config,
9
+ src,
10
+ width,
11
+ quality
12
+ }) => {
13
+ const q = quality ?? 75;
14
+ const remoteOrigin = getRemoteBundleOrigin(bundle);
15
+ const isCrossOrigin = remoteOrigin && remoteOrigin !== location.origin;
16
+ const basePath = isCrossOrigin ? `${remoteOrigin}${config.path ?? "/_next/image"}` : config.path ?? `${remoteOrigin}/_next/image`;
17
+ const url = `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${q}`;
18
+ return resolveClientUrl?.(url) ?? url;
19
+ },
20
+ // Signals to getImgProps that this is a default loader (not a user-defined
21
+ // one), enabling srcSet generation with device/image sizes from the config.
22
+ { __next_img_default: true }
23
+ );
24
+ return loader;
25
+ }
26
+ export {
27
+ createRemoteImageLoader
28
+ };
29
+ //# sourceMappingURL=remote-image-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/host/shared/remote-image-loader.ts"],"sourcesContent":["import type { InternalResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\nfunction getRemoteBundleOrigin(bundle: string): string {\n const self = globalThis as typeof globalThis & {\n __remote_bundle_url__?: Record<string, URL>;\n };\n return self.__remote_bundle_url__?.[bundle]?.origin ?? '';\n}\n\n/**\n * Replacement for `next/dist/shared/lib/image-loader`.\n *\n * Uses `config.path` (which includes the remote's asset prefix, e.g.\n * `/vc-ap-xxx/_next/image`) to generate URLs that match the server-rendered\n * HTML and avoid hydration mismatches. Under the microfrontends proxy these\n * relative paths are routed to the correct app.\n *\n * For cross-origin deployments (standalone host on a different domain),\n * `config.path` is a relative path that would incorrectly resolve to the host\n * origin, so we prefix it with the remote origin to produce an absolute URL\n * pointing at the remote's optimizer.\n *\n * When `resolveClientUrl` is provided (deployment protection), the final URL\n * is routed through the host's proxy.\n */\nexport function createRemoteImageLoader(\n bundle: string,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n const loader = Object.assign(\n ({\n config,\n src,\n width,\n quality,\n }: {\n config: { path?: string };\n src: string;\n width: number;\n quality?: number;\n }) => {\n const q = quality ?? 75;\n const remoteOrigin = getRemoteBundleOrigin(bundle);\n const isCrossOrigin = remoteOrigin && remoteOrigin !== location.origin;\n const basePath = isCrossOrigin\n ? `${remoteOrigin}${config.path ?? '/_next/image'}`\n : (config.path ?? `${remoteOrigin}/_next/image`);\n const url = `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${q}`;\n return resolveClientUrl?.(url) ?? url;\n },\n // Signals to getImgProps that this is a default loader (not a user-defined\n // one), enabling srcSet generation with device/image sizes from the config.\n { __next_img_default: true as const },\n );\n return loader;\n}\n"],"mappings":"AAEA,SAAS,sBAAsB,QAAwB;AACrD,QAAM,OAAO;AAGb,SAAO,KAAK,wBAAwB,MAAM,GAAG,UAAU;AACzD;AAkBO,SAAS,wBACd,QACA,kBACA;AACA,QAAM,SAAS,OAAO;AAAA,IACpB,CAAC;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,MAKM;AACJ,YAAM,IAAI,WAAW;AACrB,YAAM,eAAe,sBAAsB,MAAM;AACjD,YAAM,gBAAgB,gBAAgB,iBAAiB,SAAS;AAChE,YAAM,WAAW,gBACb,GAAG,eAAe,OAAO,QAAQ,mBAChC,OAAO,QAAQ,GAAG;AACvB,YAAM,MAAM,GAAG,gBAAgB,mBAAmB,GAAG,OAAO,WAAW;AACvE,aAAO,mBAAmB,GAAG,KAAK;AAAA,IACpC;AAAA;AAAA;AAAA,IAGA,EAAE,oBAAoB,KAAc;AAAA,EACtC;AACA,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remote-components",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "description": "Compose remote components at runtime between microfrontends applications.",
6
6
  "keywords": [
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var image_impl_exports = {};
20
- __export(image_impl_exports, {
21
- imageImpl: () => imageImpl
22
- });
23
- module.exports = __toCommonJS(image_impl_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_polyfill = require("#internal/host/shared/polyfill");
26
- const getBundleUrl = (bundle) => globalThis.__remote_bundle_url__?.[bundle];
27
- function createRemoteLoader(bundle, resolveClientUrl) {
28
- return ({ src, width, quality }) => {
29
- const bundleUrl = getBundleUrl(bundle);
30
- const origin = bundleUrl?.origin ?? "";
31
- let imageUrl = src;
32
- try {
33
- const parsed = new URL(src);
34
- if (origin && parsed.origin === origin) {
35
- imageUrl = parsed.pathname + parsed.search;
36
- }
37
- } catch {
38
- }
39
- const { assetPrefix } = /^(?<assetPrefix>.*?)\/_next\//.exec(imageUrl)?.groups ?? {};
40
- const url = `${origin}${assetPrefix ?? ""}/_next/image?url=${encodeURIComponent(imageUrl)}&w=${width}&q=${quality ?? 75}`;
41
- const remoteSrc = bundleUrl?.href ?? url;
42
- return resolveClientUrl?.(remoteSrc, url) ?? url;
43
- };
44
- }
45
- function imageImpl(ImageComponent, bundle, resolveClientUrl, useRemoteLoader) {
46
- const remoteLoader = useRemoteLoader ? createRemoteLoader(bundle, resolveClientUrl) : void 0;
47
- const component = function RemoteImage(props) {
48
- if (remoteLoader) {
49
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageComponent, { loader: remoteLoader, ...props });
50
- }
51
- const rawSrc = (0, import_polyfill.applyBundleUrlToImagePropsSrc)(bundle, props.src);
52
- const bundleUrl = getBundleUrl(bundle);
53
- const remoteSrc = bundleUrl?.href ?? rawSrc;
54
- const src = resolveClientUrl?.(remoteSrc, rawSrc) ?? rawSrc;
55
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageComponent, { ...props, src });
56
- };
57
- component.default = component;
58
- return component;
59
- }
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- imageImpl
63
- });
64
- //# sourceMappingURL=image-impl.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/host/nextjs/image-impl.tsx"],"sourcesContent":["import type {\n default as ImageComponentType,\n ImageLoaderProps,\n ImageProps,\n} from 'next/image';\nimport { applyBundleUrlToImagePropsSrc } from '#internal/host/shared/polyfill';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\nconst getBundleUrl = (bundle: string) =>\n (\n globalThis as typeof globalThis & {\n __remote_bundle_url__?: Record<string, URL>;\n }\n ).__remote_bundle_url__?.[bundle];\n\nfunction createRemoteLoader(\n bundle: string,\n resolveClientUrl?: ResolveClientUrl,\n) {\n return ({ src, width, quality }: ImageLoaderProps) => {\n const bundleUrl = getBundleUrl(bundle);\n const origin = bundleUrl?.origin ?? '';\n\n // Use a relative path when src is on the remote origin so the remote's\n // /_next/image endpoint serves it locally — avoids requiring the remote's\n // own origin in remotePatterns and works consistently across local/deployed.\n // Relative paths (common from Next.js static imports) pass through as-is.\n let imageUrl = src;\n try {\n const parsed = new URL(src);\n if (origin && parsed.origin === origin) {\n imageUrl = parsed.pathname + parsed.search;\n }\n } catch {\n // src is already a relative path, use as-is\n }\n\n const { assetPrefix } =\n /^(?<assetPrefix>.*?)\\/_next\\//.exec(imageUrl)?.groups ?? {};\n const url = `${origin}${assetPrefix ?? ''}/_next/image?url=${encodeURIComponent(imageUrl)}&w=${width}&q=${\n quality ?? 75\n }`;\n const remoteSrc = bundleUrl?.href ?? url;\n return resolveClientUrl?.(remoteSrc, url) ?? url;\n };\n}\n\nexport function imageImpl(\n ImageComponent: typeof ImageComponentType,\n bundle: string,\n resolveClientUrl?: ResolveClientUrl,\n useRemoteLoader?: boolean,\n) {\n const remoteLoader = useRemoteLoader\n ? createRemoteLoader(bundle, resolveClientUrl)\n : undefined;\n\n const component = function RemoteImage(props: ImageProps) {\n // When using remoteLoader, pass props.src unchanged — the loader receives\n // the original value (relative path or StaticImageData string) and handles\n // URL construction and proxying itself. This matches the original working\n // pattern and avoids unnecessary absolute→relative round-trips.\n // Without remoteLoader, rewrite src to point at the remote origin and proxy.\n if (remoteLoader) {\n return <ImageComponent loader={remoteLoader} {...props} />;\n }\n const rawSrc = applyBundleUrlToImagePropsSrc(bundle, props.src);\n const bundleUrl = getBundleUrl(bundle);\n const remoteSrc = bundleUrl?.href ?? rawSrc;\n const src = resolveClientUrl?.(remoteSrc, rawSrc) ?? rawSrc;\n return <ImageComponent {...props} src={src} />;\n };\n component.default = component;\n return component;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgEa;AA3Db,sBAA8C;AAG9C,MAAM,eAAe,CAAC,WAElB,WAGA,wBAAwB,MAAM;AAElC,SAAS,mBACP,QACA,kBACA;AACA,SAAO,CAAC,EAAE,KAAK,OAAO,QAAQ,MAAwB;AACpD,UAAM,YAAY,aAAa,MAAM;AACrC,UAAM,SAAS,WAAW,UAAU;AAMpC,QAAI,WAAW;AACf,QAAI;AACF,YAAM,SAAS,IAAI,IAAI,GAAG;AAC1B,UAAI,UAAU,OAAO,WAAW,QAAQ;AACtC,mBAAW,OAAO,WAAW,OAAO;AAAA,MACtC;AAAA,IACF,QAAE;AAAA,IAEF;AAEA,UAAM,EAAE,YAAY,IAClB,gCAAgC,KAAK,QAAQ,GAAG,UAAU,CAAC;AAC7D,UAAM,MAAM,GAAG,SAAS,eAAe,sBAAsB,mBAAmB,QAAQ,OAAO,WAC7F,WAAW;AAEb,UAAM,YAAY,WAAW,QAAQ;AACrC,WAAO,mBAAmB,WAAW,GAAG,KAAK;AAAA,EAC/C;AACF;AAEO,SAAS,UACd,gBACA,QACA,kBACA,iBACA;AACA,QAAM,eAAe,kBACjB,mBAAmB,QAAQ,gBAAgB,IAC3C;AAEJ,QAAM,YAAY,SAAS,YAAY,OAAmB;AAMxD,QAAI,cAAc;AAChB,aAAO,4CAAC,kBAAe,QAAQ,cAAe,GAAG,OAAO;AAAA,IAC1D;AACA,UAAM,aAAS,+CAA8B,QAAQ,MAAM,GAAG;AAC9D,UAAM,YAAY,aAAa,MAAM;AACrC,UAAM,YAAY,WAAW,QAAQ;AACrC,UAAM,MAAM,mBAAmB,WAAW,MAAM,KAAK;AACrD,WAAO,4CAAC,kBAAgB,GAAG,OAAO,KAAU;AAAA,EAC9C;AACA,YAAU,UAAU;AACpB,SAAO;AACT;","names":[]}
@@ -1,10 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import ImageComponentType, { ImageProps } from 'next/image';
3
- import { ResolveClientUrl } from '../../runtime/url/resolve-client-url.js';
4
-
5
- declare function imageImpl(ImageComponent: typeof ImageComponentType, bundle: string, resolveClientUrl?: ResolveClientUrl, useRemoteLoader?: boolean): {
6
- (props: ImageProps): react_jsx_runtime.JSX.Element;
7
- default: /*elided*/ any;
8
- };
9
-
10
- export { imageImpl };
@@ -1,40 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { applyBundleUrlToImagePropsSrc } from "#internal/host/shared/polyfill";
3
- const getBundleUrl = (bundle) => globalThis.__remote_bundle_url__?.[bundle];
4
- function createRemoteLoader(bundle, resolveClientUrl) {
5
- return ({ src, width, quality }) => {
6
- const bundleUrl = getBundleUrl(bundle);
7
- const origin = bundleUrl?.origin ?? "";
8
- let imageUrl = src;
9
- try {
10
- const parsed = new URL(src);
11
- if (origin && parsed.origin === origin) {
12
- imageUrl = parsed.pathname + parsed.search;
13
- }
14
- } catch {
15
- }
16
- const { assetPrefix } = /^(?<assetPrefix>.*?)\/_next\//.exec(imageUrl)?.groups ?? {};
17
- const url = `${origin}${assetPrefix ?? ""}/_next/image?url=${encodeURIComponent(imageUrl)}&w=${width}&q=${quality ?? 75}`;
18
- const remoteSrc = bundleUrl?.href ?? url;
19
- return resolveClientUrl?.(remoteSrc, url) ?? url;
20
- };
21
- }
22
- function imageImpl(ImageComponent, bundle, resolveClientUrl, useRemoteLoader) {
23
- const remoteLoader = useRemoteLoader ? createRemoteLoader(bundle, resolveClientUrl) : void 0;
24
- const component = function RemoteImage(props) {
25
- if (remoteLoader) {
26
- return /* @__PURE__ */ jsx(ImageComponent, { loader: remoteLoader, ...props });
27
- }
28
- const rawSrc = applyBundleUrlToImagePropsSrc(bundle, props.src);
29
- const bundleUrl = getBundleUrl(bundle);
30
- const remoteSrc = bundleUrl?.href ?? rawSrc;
31
- const src = resolveClientUrl?.(remoteSrc, rawSrc) ?? rawSrc;
32
- return /* @__PURE__ */ jsx(ImageComponent, { ...props, src });
33
- };
34
- component.default = component;
35
- return component;
36
- }
37
- export {
38
- imageImpl
39
- };
40
- //# sourceMappingURL=image-impl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/host/nextjs/image-impl.tsx"],"sourcesContent":["import type {\n default as ImageComponentType,\n ImageLoaderProps,\n ImageProps,\n} from 'next/image';\nimport { applyBundleUrlToImagePropsSrc } from '#internal/host/shared/polyfill';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\nconst getBundleUrl = (bundle: string) =>\n (\n globalThis as typeof globalThis & {\n __remote_bundle_url__?: Record<string, URL>;\n }\n ).__remote_bundle_url__?.[bundle];\n\nfunction createRemoteLoader(\n bundle: string,\n resolveClientUrl?: ResolveClientUrl,\n) {\n return ({ src, width, quality }: ImageLoaderProps) => {\n const bundleUrl = getBundleUrl(bundle);\n const origin = bundleUrl?.origin ?? '';\n\n // Use a relative path when src is on the remote origin so the remote's\n // /_next/image endpoint serves it locally — avoids requiring the remote's\n // own origin in remotePatterns and works consistently across local/deployed.\n // Relative paths (common from Next.js static imports) pass through as-is.\n let imageUrl = src;\n try {\n const parsed = new URL(src);\n if (origin && parsed.origin === origin) {\n imageUrl = parsed.pathname + parsed.search;\n }\n } catch {\n // src is already a relative path, use as-is\n }\n\n const { assetPrefix } =\n /^(?<assetPrefix>.*?)\\/_next\\//.exec(imageUrl)?.groups ?? {};\n const url = `${origin}${assetPrefix ?? ''}/_next/image?url=${encodeURIComponent(imageUrl)}&w=${width}&q=${\n quality ?? 75\n }`;\n const remoteSrc = bundleUrl?.href ?? url;\n return resolveClientUrl?.(remoteSrc, url) ?? url;\n };\n}\n\nexport function imageImpl(\n ImageComponent: typeof ImageComponentType,\n bundle: string,\n resolveClientUrl?: ResolveClientUrl,\n useRemoteLoader?: boolean,\n) {\n const remoteLoader = useRemoteLoader\n ? createRemoteLoader(bundle, resolveClientUrl)\n : undefined;\n\n const component = function RemoteImage(props: ImageProps) {\n // When using remoteLoader, pass props.src unchanged — the loader receives\n // the original value (relative path or StaticImageData string) and handles\n // URL construction and proxying itself. This matches the original working\n // pattern and avoids unnecessary absolute→relative round-trips.\n // Without remoteLoader, rewrite src to point at the remote origin and proxy.\n if (remoteLoader) {\n return <ImageComponent loader={remoteLoader} {...props} />;\n }\n const rawSrc = applyBundleUrlToImagePropsSrc(bundle, props.src);\n const bundleUrl = getBundleUrl(bundle);\n const remoteSrc = bundleUrl?.href ?? rawSrc;\n const src = resolveClientUrl?.(remoteSrc, rawSrc) ?? rawSrc;\n return <ImageComponent {...props} src={src} />;\n };\n component.default = component;\n return component;\n}\n"],"mappings":"AAgEa;AA3Db,SAAS,qCAAqC;AAG9C,MAAM,eAAe,CAAC,WAElB,WAGA,wBAAwB,MAAM;AAElC,SAAS,mBACP,QACA,kBACA;AACA,SAAO,CAAC,EAAE,KAAK,OAAO,QAAQ,MAAwB;AACpD,UAAM,YAAY,aAAa,MAAM;AACrC,UAAM,SAAS,WAAW,UAAU;AAMpC,QAAI,WAAW;AACf,QAAI;AACF,YAAM,SAAS,IAAI,IAAI,GAAG;AAC1B,UAAI,UAAU,OAAO,WAAW,QAAQ;AACtC,mBAAW,OAAO,WAAW,OAAO;AAAA,MACtC;AAAA,IACF,QAAE;AAAA,IAEF;AAEA,UAAM,EAAE,YAAY,IAClB,gCAAgC,KAAK,QAAQ,GAAG,UAAU,CAAC;AAC7D,UAAM,MAAM,GAAG,SAAS,eAAe,sBAAsB,mBAAmB,QAAQ,OAAO,WAC7F,WAAW;AAEb,UAAM,YAAY,WAAW,QAAQ;AACrC,WAAO,mBAAmB,WAAW,GAAG,KAAK;AAAA,EAC/C;AACF;AAEO,SAAS,UACd,gBACA,QACA,kBACA,iBACA;AACA,QAAM,eAAe,kBACjB,mBAAmB,QAAQ,gBAAgB,IAC3C;AAEJ,QAAM,YAAY,SAAS,YAAY,OAAmB;AAMxD,QAAI,cAAc;AAChB,aAAO,oBAAC,kBAAe,QAAQ,cAAe,GAAG,OAAO;AAAA,IAC1D;AACA,UAAM,SAAS,8BAA8B,QAAQ,MAAM,GAAG;AAC9D,UAAM,YAAY,aAAa,MAAM;AACrC,UAAM,YAAY,WAAW,QAAQ;AACrC,UAAM,MAAM,mBAAmB,WAAW,MAAM,KAAK;AACrD,WAAO,oBAAC,kBAAgB,GAAG,OAAO,KAAU;AAAA,EAC9C;AACA,YAAU,UAAU;AACpB,SAAO;AACT;","names":[]}