remote-components 0.1.2 → 0.2.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 (470) hide show
  1. package/dist/{next/config.cjs → config/nextjs.cjs} +76 -101
  2. package/dist/config/nextjs.cjs.map +1 -0
  3. package/dist/{next/config.d.ts → config/nextjs.d.ts} +4 -4
  4. package/dist/{next/config.js → config/nextjs.js} +72 -97
  5. package/dist/config/nextjs.js.map +1 -0
  6. package/dist/{webpack.cjs → config/webpack.cjs} +13 -29
  7. package/dist/config/webpack.cjs.map +1 -0
  8. package/dist/{webpack.js → config/webpack.js} +12 -28
  9. package/dist/config/webpack.js.map +1 -0
  10. package/dist/{shared/remote → host/defaults}/app.cjs +2 -2
  11. package/dist/host/defaults/app.cjs.map +1 -0
  12. package/dist/host/defaults/app.js +8 -0
  13. package/dist/host/defaults/app.js.map +1 -0
  14. package/dist/{shared/remote → host/defaults}/pages.cjs +2 -2
  15. package/dist/host/defaults/pages.cjs.map +1 -0
  16. package/dist/host/defaults/pages.js +8 -0
  17. package/dist/host/defaults/pages.js.map +1 -0
  18. package/dist/{html/host.cjs → host/html.cjs} +1012 -1075
  19. package/dist/host/html.cjs.map +1 -0
  20. package/dist/{html/host.d.ts → host/html.d.ts} +0 -2
  21. package/dist/{html/host.js → host/html.js} +1009 -1071
  22. package/dist/host/html.js.map +1 -0
  23. package/dist/{next/host/client/index.cjs → host/nextjs/app/client-only.cjs} +681 -617
  24. package/dist/host/nextjs/app/client-only.cjs.map +1 -0
  25. package/dist/host/nextjs/app/client-only.d.ts +16 -0
  26. package/dist/{next/host/client/index.js → host/nextjs/app/client-only.js} +682 -611
  27. package/dist/host/nextjs/app/client-only.js.map +1 -0
  28. package/dist/{next/host/app-router-server.cjs → host/nextjs/app.cjs} +11 -10
  29. package/dist/host/nextjs/app.cjs.map +1 -0
  30. package/dist/host/nextjs/app.d.ts +29 -0
  31. package/dist/{next/host/app-router-server.js → host/nextjs/app.js} +7 -6
  32. package/dist/host/nextjs/app.js.map +1 -0
  33. package/dist/{next/host/pages-router-client.cjs → host/nextjs/pages/client-only.cjs} +8 -8
  34. package/dist/host/nextjs/pages/client-only.cjs.map +1 -0
  35. package/dist/host/nextjs/pages/client-only.d.ts +31 -0
  36. package/dist/{next/host/pages-router-client.js → host/nextjs/pages/client-only.js} +4 -4
  37. package/dist/host/nextjs/pages/client-only.js.map +1 -0
  38. package/dist/{next/host/pages-router-server.cjs → host/nextjs/pages.cjs} +44 -55
  39. package/dist/host/nextjs/pages.cjs.map +1 -0
  40. package/dist/{next/host/pages-router-server.d.ts → host/nextjs/pages.d.ts} +11 -13
  41. package/dist/{next/host/pages-router-server.js → host/nextjs/pages.js} +38 -49
  42. package/dist/host/nextjs/pages.js.map +1 -0
  43. package/dist/host/proxy/client.cjs +57 -0
  44. package/dist/host/proxy/client.cjs.map +1 -0
  45. package/dist/host/proxy/client.d.ts +31 -0
  46. package/dist/host/proxy/client.js +30 -0
  47. package/dist/host/proxy/client.js.map +1 -0
  48. package/dist/{shared/host/proxy.cjs → host/proxy/protected-fetch.cjs} +6 -6
  49. package/dist/host/proxy/protected-fetch.cjs.map +1 -0
  50. package/dist/{shared/host/proxy.js → host/proxy/protected-fetch.js} +3 -3
  51. package/dist/host/proxy/protected-fetch.js.map +1 -0
  52. package/dist/{next → host}/proxy.cjs +12 -92
  53. package/dist/host/proxy.cjs.map +1 -0
  54. package/dist/host/proxy.d.ts +30 -0
  55. package/dist/{next → host}/proxy.js +11 -88
  56. package/dist/host/proxy.js.map +1 -0
  57. package/dist/{react/index.cjs → host/react.cjs} +515 -548
  58. package/dist/host/react.cjs.map +1 -0
  59. package/dist/{component-loader-21865da3.d.ts → host/react.d.ts} +141 -99
  60. package/dist/{react/index.js → host/react.js} +514 -545
  61. package/dist/host/react.js.map +1 -0
  62. package/dist/internal/{webpack/shared-modules.cjs → config/webpack/apply-shared-modules.cjs} +12 -15
  63. package/dist/internal/config/webpack/apply-shared-modules.cjs.map +1 -0
  64. package/dist/internal/{webpack/shared-modules.js → config/webpack/apply-shared-modules.js} +9 -12
  65. package/dist/internal/config/webpack/apply-shared-modules.js.map +1 -0
  66. package/dist/internal/{webpack → config/webpack}/next-client-pages-loader.cjs +1 -1
  67. package/dist/internal/config/webpack/next-client-pages-loader.cjs.map +1 -0
  68. package/dist/internal/{webpack → config/webpack}/next-client-pages-loader.js +1 -1
  69. package/dist/internal/config/webpack/next-client-pages-loader.js.map +1 -0
  70. package/dist/internal/{next/host/app-router-client.cjs → host/nextjs/app-client.cjs} +29 -24
  71. package/dist/internal/host/nextjs/app-client.cjs.map +1 -0
  72. package/dist/internal/host/nextjs/app-client.d.ts +25 -0
  73. package/dist/internal/{next/host/app-router-client.js → host/nextjs/app-client.js} +19 -19
  74. package/dist/internal/host/nextjs/app-client.js.map +1 -0
  75. package/dist/internal/{next/host/app-router-compat.cjs → host/nextjs/app-compat.cjs} +5 -22
  76. package/dist/internal/host/nextjs/app-compat.cjs.map +1 -0
  77. package/dist/internal/{next/host/app-router-compat.d.ts → host/nextjs/app-compat.d.ts} +1 -7
  78. package/dist/internal/{next/host/app-router-compat.js → host/nextjs/app-compat.js} +2 -18
  79. package/dist/internal/host/nextjs/app-compat.js.map +1 -0
  80. package/dist/internal/host/nextjs/dom-flight.cjs.map +1 -0
  81. package/dist/internal/host/nextjs/dom-flight.d.ts +39 -0
  82. package/dist/internal/host/nextjs/dom-flight.js.map +1 -0
  83. package/dist/internal/host/nextjs/image-impl.cjs +60 -0
  84. package/dist/internal/host/nextjs/image-impl.cjs.map +1 -0
  85. package/dist/internal/host/nextjs/image-impl.d.ts +10 -0
  86. package/dist/internal/host/nextjs/image-impl.js +36 -0
  87. package/dist/internal/host/nextjs/image-impl.js.map +1 -0
  88. package/dist/internal/host/nextjs/image-shared.cjs +43 -0
  89. package/dist/internal/host/nextjs/image-shared.cjs.map +1 -0
  90. package/dist/internal/host/nextjs/image-shared.d.ts +9 -0
  91. package/dist/internal/host/nextjs/image-shared.js +19 -0
  92. package/dist/internal/host/nextjs/image-shared.js.map +1 -0
  93. package/dist/internal/{next/host → host/nextjs}/remote-component-links.cjs +2 -2
  94. package/dist/internal/host/nextjs/remote-component-links.cjs.map +1 -0
  95. package/dist/internal/{next/host → host/nextjs}/remote-component-links.d.ts +1 -1
  96. package/dist/internal/{next/host → host/nextjs}/remote-component-links.js +2 -2
  97. package/dist/internal/host/nextjs/remote-component-links.js.map +1 -0
  98. package/dist/internal/host/nextjs/skeleton.cjs.map +1 -0
  99. package/dist/internal/host/nextjs/skeleton.js.map +1 -0
  100. package/dist/internal/{react → host/react}/context.cjs +3 -3
  101. package/dist/internal/host/react/context.cjs.map +1 -0
  102. package/dist/internal/{react → host/react}/context.d.ts +4 -4
  103. package/dist/internal/{react → host/react}/context.js +2 -2
  104. package/dist/internal/host/react/context.js.map +1 -0
  105. package/dist/internal/{react → host/react}/hooks/use-resolve-client-url.cjs +2 -2
  106. package/dist/internal/host/react/hooks/use-resolve-client-url.cjs.map +1 -0
  107. package/dist/internal/{react → host/react}/hooks/use-resolve-client-url.d.ts +1 -1
  108. package/dist/internal/{react → host/react}/hooks/use-resolve-client-url.js +2 -2
  109. package/dist/internal/host/react/hooks/use-resolve-client-url.js.map +1 -0
  110. package/dist/internal/host/server/fetch-headers.cjs.map +1 -0
  111. package/dist/internal/host/server/fetch-headers.js.map +1 -0
  112. package/dist/internal/{shared/ssr → host/server}/fetch-remote-component.cjs +6 -6
  113. package/dist/internal/host/server/fetch-remote-component.cjs.map +1 -0
  114. package/dist/internal/{shared/ssr → host/server}/fetch-remote-component.d.ts +6 -1
  115. package/dist/internal/{shared/ssr → host/server}/fetch-remote-component.js +9 -9
  116. package/dist/internal/host/server/fetch-remote-component.js.map +1 -0
  117. package/dist/internal/{shared/ssr → host/server}/fetch-with-hooks.cjs +11 -15
  118. package/dist/internal/host/server/fetch-with-hooks.cjs.map +1 -0
  119. package/dist/internal/host/server/fetch-with-hooks.d.ts +21 -0
  120. package/dist/internal/{shared/ssr → host/server}/fetch-with-hooks.js +11 -15
  121. package/dist/internal/host/server/fetch-with-hooks.js.map +1 -0
  122. package/dist/internal/host/server/get-client-or-server-url.cjs.map +1 -0
  123. package/dist/internal/host/server/get-client-or-server-url.js.map +1 -0
  124. package/dist/internal/{shared/client → host/server}/get-client-src.cjs +1 -1
  125. package/dist/internal/host/server/get-client-src.cjs.map +1 -0
  126. package/dist/internal/{shared/client → host/server}/get-client-src.js +1 -1
  127. package/dist/internal/host/server/get-client-src.js.map +1 -0
  128. package/dist/internal/host/server/get-ssr-relative-path-base-url.cjs.map +1 -0
  129. package/dist/internal/host/server/get-ssr-relative-path-base-url.js.map +1 -0
  130. package/dist/{next/remote/server.cjs → internal/host/server/types.cjs} +3 -15
  131. package/dist/internal/host/server/types.cjs.map +1 -0
  132. package/dist/internal/host/server/types.d.ts +33 -0
  133. package/dist/internal/host/server/types.js +1 -0
  134. package/dist/internal/host/server/types.js.map +1 -0
  135. package/dist/internal/host/shared/asset-descriptors.cjs +17 -0
  136. package/dist/internal/host/shared/asset-descriptors.cjs.map +1 -0
  137. package/dist/internal/host/shared/asset-descriptors.d.ts +21 -0
  138. package/dist/internal/host/shared/asset-descriptors.js +1 -0
  139. package/dist/internal/host/shared/asset-descriptors.js.map +1 -0
  140. package/dist/internal/host/shared/config.cjs +17 -0
  141. package/dist/internal/host/shared/config.cjs.map +1 -0
  142. package/dist/{host-config-58cdccea.d.ts → internal/host/shared/config.d.ts} +32 -19
  143. package/dist/internal/host/shared/config.js +1 -0
  144. package/dist/internal/host/shared/config.js.map +1 -0
  145. package/dist/internal/host/shared/fetch-interceptors.cjs +17 -0
  146. package/dist/internal/host/shared/fetch-interceptors.cjs.map +1 -0
  147. package/dist/{types-2b26a246.d.ts → internal/host/shared/fetch-interceptors.d.ts} +4 -87
  148. package/dist/internal/host/shared/fetch-interceptors.js +1 -0
  149. package/dist/internal/host/shared/fetch-interceptors.js.map +1 -0
  150. package/dist/internal/{shared/client → host/shared}/polyfill.cjs +7 -6
  151. package/dist/internal/host/shared/polyfill.cjs.map +1 -0
  152. package/dist/internal/{shared/client → host/shared}/polyfill.d.ts +2 -1
  153. package/dist/internal/{shared/client → host/shared}/polyfill.js +7 -6
  154. package/dist/internal/host/shared/polyfill.js.map +1 -0
  155. package/dist/internal/host/shared/resolved-data.cjs +17 -0
  156. package/dist/internal/host/shared/resolved-data.cjs.map +1 -0
  157. package/dist/internal/host/shared/resolved-data.d.ts +48 -0
  158. package/dist/internal/host/shared/resolved-data.js +1 -0
  159. package/dist/internal/host/shared/resolved-data.js.map +1 -0
  160. package/dist/internal/{shared/contract/host-state.cjs → host/shared/state.cjs} +4 -4
  161. package/dist/internal/host/shared/state.cjs.map +1 -0
  162. package/dist/internal/{shared/contract/host-state.js → host/shared/state.js} +1 -1
  163. package/dist/internal/host/shared/state.js.map +1 -0
  164. package/dist/internal/host/utils/resolve-name-from-src.cjs.map +1 -0
  165. package/dist/internal/host/utils/resolve-name-from-src.js.map +1 -0
  166. package/dist/internal/{next/remote/render-client.cjs → remote/nextjs/app-client.cjs} +8 -8
  167. package/dist/internal/remote/nextjs/app-client.cjs.map +1 -0
  168. package/dist/internal/{next/remote/render-client.js → remote/nextjs/app-client.js} +4 -4
  169. package/dist/internal/remote/nextjs/app-client.js.map +1 -0
  170. package/dist/internal/runtime/constants.cjs +50 -0
  171. package/dist/internal/runtime/constants.cjs.map +1 -0
  172. package/dist/internal/runtime/constants.d.ts +10 -0
  173. package/dist/internal/runtime/constants.js +20 -0
  174. package/dist/internal/runtime/constants.js.map +1 -0
  175. package/dist/internal/{shared/client → runtime/html}/apply-origin.cjs.map +1 -1
  176. package/dist/internal/{shared/client → runtime/html}/apply-origin.d.ts +1 -1
  177. package/dist/internal/{shared/client → runtime/html}/apply-origin.js.map +1 -1
  178. package/dist/internal/runtime/html/parse-remote-html.cjs +140 -0
  179. package/dist/internal/runtime/html/parse-remote-html.cjs.map +1 -0
  180. package/dist/internal/runtime/html/parse-remote-html.d.ts +88 -0
  181. package/dist/internal/runtime/html/parse-remote-html.js +110 -0
  182. package/dist/internal/runtime/html/parse-remote-html.js.map +1 -0
  183. package/dist/internal/runtime/html/set-attributes-from-props.cjs +68 -0
  184. package/dist/internal/runtime/html/set-attributes-from-props.cjs.map +1 -0
  185. package/dist/internal/runtime/html/set-attributes-from-props.d.ts +3 -0
  186. package/dist/internal/runtime/html/set-attributes-from-props.js +44 -0
  187. package/dist/internal/runtime/html/set-attributes-from-props.js.map +1 -0
  188. package/dist/internal/runtime/loaders/component-loader.cjs +184 -0
  189. package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -0
  190. package/dist/internal/runtime/loaders/component-loader.d.ts +31 -0
  191. package/dist/internal/runtime/loaders/component-loader.js +150 -0
  192. package/dist/internal/runtime/loaders/component-loader.js.map +1 -0
  193. package/dist/internal/runtime/loaders/script-loader.cjs +69 -0
  194. package/dist/internal/runtime/loaders/script-loader.cjs.map +1 -0
  195. package/dist/internal/runtime/loaders/script-loader.d.ts +10 -0
  196. package/dist/internal/runtime/loaders/script-loader.js +48 -0
  197. package/dist/internal/runtime/loaders/script-loader.js.map +1 -0
  198. package/dist/internal/runtime/loaders/static-loader.cjs +177 -0
  199. package/dist/internal/runtime/loaders/static-loader.cjs.map +1 -0
  200. package/dist/internal/runtime/loaders/static-loader.d.ts +10 -0
  201. package/dist/internal/runtime/loaders/static-loader.js +153 -0
  202. package/dist/internal/runtime/loaders/static-loader.js.map +1 -0
  203. package/dist/internal/runtime/metadata.cjs +17 -0
  204. package/dist/internal/runtime/metadata.cjs.map +1 -0
  205. package/dist/internal/runtime/metadata.d.ts +16 -0
  206. package/dist/internal/runtime/metadata.js +1 -0
  207. package/dist/internal/runtime/metadata.js.map +1 -0
  208. package/dist/internal/runtime/rsc.cjs +92 -0
  209. package/dist/internal/runtime/rsc.cjs.map +1 -0
  210. package/dist/internal/runtime/rsc.d.ts +8 -0
  211. package/dist/internal/runtime/rsc.js +68 -0
  212. package/dist/internal/runtime/rsc.js.map +1 -0
  213. package/dist/internal/runtime/turbopack/chunk-loader.cjs +244 -0
  214. package/dist/internal/runtime/turbopack/chunk-loader.cjs.map +1 -0
  215. package/dist/internal/runtime/turbopack/chunk-loader.d.ts +11 -0
  216. package/dist/internal/runtime/turbopack/chunk-loader.js +227 -0
  217. package/dist/internal/runtime/turbopack/chunk-loader.js.map +1 -0
  218. package/dist/internal/runtime/turbopack/module.cjs +257 -0
  219. package/dist/internal/runtime/turbopack/module.cjs.map +1 -0
  220. package/dist/internal/runtime/turbopack/module.d.ts +61 -0
  221. package/dist/internal/runtime/turbopack/module.js +233 -0
  222. package/dist/internal/runtime/turbopack/module.js.map +1 -0
  223. package/dist/internal/runtime/turbopack/patterns.cjs +44 -0
  224. package/dist/internal/runtime/turbopack/patterns.cjs.map +1 -0
  225. package/dist/internal/runtime/turbopack/patterns.d.ts +109 -0
  226. package/dist/internal/runtime/turbopack/patterns.js +15 -0
  227. package/dist/internal/runtime/turbopack/patterns.js.map +1 -0
  228. package/dist/internal/runtime/turbopack/shared-modules.cjs +152 -0
  229. package/dist/internal/runtime/turbopack/shared-modules.cjs.map +1 -0
  230. package/dist/internal/runtime/turbopack/shared-modules.d.ts +17 -0
  231. package/dist/internal/runtime/turbopack/shared-modules.js +133 -0
  232. package/dist/internal/runtime/turbopack/shared-modules.js.map +1 -0
  233. package/dist/internal/runtime/turbopack/webpack-runtime.cjs +137 -0
  234. package/dist/internal/runtime/turbopack/webpack-runtime.cjs.map +1 -0
  235. package/dist/internal/runtime/turbopack/webpack-runtime.d.ts +20 -0
  236. package/dist/internal/runtime/turbopack/webpack-runtime.js +107 -0
  237. package/dist/internal/runtime/turbopack/webpack-runtime.js.map +1 -0
  238. package/dist/internal/runtime/types.cjs +17 -0
  239. package/dist/internal/runtime/types.cjs.map +1 -0
  240. package/dist/internal/runtime/types.d.ts +40 -0
  241. package/dist/internal/runtime/types.js +1 -0
  242. package/dist/internal/runtime/types.js.map +1 -0
  243. package/dist/internal/{shared/client → runtime/url}/default-resolve-client-url.cjs +2 -2
  244. package/dist/internal/runtime/url/default-resolve-client-url.cjs.map +1 -0
  245. package/dist/internal/{shared/client → runtime/url}/default-resolve-client-url.d.ts +1 -1
  246. package/dist/internal/{shared/client → runtime/url}/default-resolve-client-url.js +1 -1
  247. package/dist/internal/runtime/url/default-resolve-client-url.js.map +1 -0
  248. package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.cjs +1 -1
  249. package/dist/internal/runtime/url/protected-rc-fallback.cjs.map +1 -0
  250. package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.js +1 -1
  251. package/dist/internal/runtime/url/protected-rc-fallback.js.map +1 -0
  252. package/dist/internal/{shared/client/proxy-through-host.cjs → runtime/url/resolve-client-url.cjs} +4 -24
  253. package/dist/internal/runtime/url/resolve-client-url.cjs.map +1 -0
  254. package/dist/internal/{shared/client/proxy-through-host.d.ts → runtime/url/resolve-client-url.d.ts} +1 -25
  255. package/dist/internal/runtime/url/resolve-client-url.js +21 -0
  256. package/dist/internal/runtime/url/resolve-client-url.js.map +1 -0
  257. package/dist/internal/utils/abort.cjs.map +1 -0
  258. package/dist/internal/utils/abort.js.map +1 -0
  259. package/dist/internal/{shared → utils}/constants.cjs +3 -0
  260. package/dist/internal/utils/constants.cjs.map +1 -0
  261. package/dist/internal/utils/constants.d.ts +5 -0
  262. package/dist/internal/{shared → utils}/constants.js +2 -0
  263. package/dist/internal/utils/constants.js.map +1 -0
  264. package/dist/internal/{shared → utils}/error.cjs +4 -4
  265. package/dist/internal/utils/error.cjs.map +1 -0
  266. package/dist/internal/{shared → utils}/error.js +4 -4
  267. package/dist/internal/utils/error.js.map +1 -0
  268. package/dist/internal/{shared/utils → utils}/logger.cjs +3 -3
  269. package/dist/internal/utils/logger.cjs.map +1 -0
  270. package/dist/internal/{shared/utils → utils}/logger.d.ts +2 -2
  271. package/dist/internal/{shared/utils → utils}/logger.js +3 -3
  272. package/dist/internal/utils/logger.js.map +1 -0
  273. package/dist/internal/utils.cjs.map +1 -0
  274. package/dist/internal/utils.js.map +1 -0
  275. package/dist/{shared/host → remote/defaults}/app.cjs +2 -6
  276. package/dist/remote/defaults/app.cjs.map +1 -0
  277. package/dist/remote/defaults/app.js +8 -0
  278. package/dist/remote/defaults/app.js.map +1 -0
  279. package/dist/{shared/host → remote/defaults}/pages.cjs +2 -6
  280. package/dist/remote/defaults/pages.cjs.map +1 -0
  281. package/dist/remote/defaults/pages.js +8 -0
  282. package/dist/remote/defaults/pages.js.map +1 -0
  283. package/dist/{shared/remote → remote/defaults}/wrapper.cjs +12 -10
  284. package/dist/remote/defaults/wrapper.cjs.map +1 -0
  285. package/dist/remote/defaults/wrapper.js +27 -0
  286. package/dist/remote/defaults/wrapper.js.map +1 -0
  287. package/dist/{html/remote.cjs → remote/html.cjs} +16 -16
  288. package/dist/remote/html.cjs.map +1 -0
  289. package/dist/{html/remote.js → remote/html.js} +16 -16
  290. package/dist/remote/html.js.map +1 -0
  291. package/dist/{shared/remote/proxy.cjs → remote/middleware.cjs} +37 -12
  292. package/dist/remote/middleware.cjs.map +1 -0
  293. package/dist/remote/middleware.d.ts +27 -0
  294. package/dist/{shared/remote/proxy.js → remote/middleware.js} +32 -5
  295. package/dist/remote/middleware.js.map +1 -0
  296. package/dist/{internal/next/remote/render-server.cjs → remote/nextjs/app.cjs} +14 -16
  297. package/dist/remote/nextjs/app.cjs.map +1 -0
  298. package/dist/{internal/next/remote/render-server.d.ts → remote/nextjs/app.d.ts} +12 -13
  299. package/dist/{internal/next/remote/render-server.js → remote/nextjs/app.js} +9 -11
  300. package/dist/remote/nextjs/app.js.map +1 -0
  301. package/dist/{next/remote/pages-router.cjs → remote/nextjs/pages.cjs} +8 -8
  302. package/dist/remote/nextjs/pages.cjs.map +1 -0
  303. package/dist/{next/remote/pages-router.d.ts → remote/nextjs/pages.d.ts} +8 -8
  304. package/dist/{next/remote/pages-router.js → remote/nextjs/pages.js} +4 -4
  305. package/dist/remote/nextjs/pages.js.map +1 -0
  306. package/dist/server-handoff-8c89b856.d.ts +46 -0
  307. package/package.json +126 -157
  308. package/dist/html/host.cjs.map +0 -1
  309. package/dist/html/host.js.map +0 -1
  310. package/dist/html/remote.cjs.map +0 -1
  311. package/dist/html/remote.js.map +0 -1
  312. package/dist/internal/next/host/app-router-client.cjs.map +0 -1
  313. package/dist/internal/next/host/app-router-client.d.ts +0 -79
  314. package/dist/internal/next/host/app-router-client.js.map +0 -1
  315. package/dist/internal/next/host/app-router-compat.cjs.map +0 -1
  316. package/dist/internal/next/host/app-router-compat.js.map +0 -1
  317. package/dist/internal/next/host/remote-component-links.cjs.map +0 -1
  318. package/dist/internal/next/host/remote-component-links.js.map +0 -1
  319. package/dist/internal/next/remote/render-client.cjs.map +0 -1
  320. package/dist/internal/next/remote/render-client.js.map +0 -1
  321. package/dist/internal/next/remote/render-server.cjs.map +0 -1
  322. package/dist/internal/next/remote/render-server.js.map +0 -1
  323. package/dist/internal/react/context.cjs.map +0 -1
  324. package/dist/internal/react/context.js.map +0 -1
  325. package/dist/internal/react/hooks/use-resolve-client-url.cjs.map +0 -1
  326. package/dist/internal/react/hooks/use-resolve-client-url.js.map +0 -1
  327. package/dist/internal/shared/client/default-resolve-client-url.cjs.map +0 -1
  328. package/dist/internal/shared/client/default-resolve-client-url.js.map +0 -1
  329. package/dist/internal/shared/client/get-client-src.cjs.map +0 -1
  330. package/dist/internal/shared/client/get-client-src.js.map +0 -1
  331. package/dist/internal/shared/client/polyfill.cjs.map +0 -1
  332. package/dist/internal/shared/client/polyfill.js.map +0 -1
  333. package/dist/internal/shared/client/protected-rc-fallback.cjs.map +0 -1
  334. package/dist/internal/shared/client/protected-rc-fallback.js.map +0 -1
  335. package/dist/internal/shared/client/proxy-through-host.cjs.map +0 -1
  336. package/dist/internal/shared/client/proxy-through-host.js +0 -40
  337. package/dist/internal/shared/client/proxy-through-host.js.map +0 -1
  338. package/dist/internal/shared/client/remote-component.cjs +0 -1436
  339. package/dist/internal/shared/client/remote-component.cjs.map +0 -1
  340. package/dist/internal/shared/client/remote-component.d.ts +0 -62
  341. package/dist/internal/shared/client/remote-component.js +0 -1385
  342. package/dist/internal/shared/client/remote-component.js.map +0 -1
  343. package/dist/internal/shared/constants.cjs.map +0 -1
  344. package/dist/internal/shared/constants.d.ts +0 -4
  345. package/dist/internal/shared/constants.js.map +0 -1
  346. package/dist/internal/shared/contract/host-state.cjs.map +0 -1
  347. package/dist/internal/shared/contract/host-state.js.map +0 -1
  348. package/dist/internal/shared/contract/resolve-name-from-src.cjs.map +0 -1
  349. package/dist/internal/shared/contract/resolve-name-from-src.js.map +0 -1
  350. package/dist/internal/shared/error.cjs.map +0 -1
  351. package/dist/internal/shared/error.js.map +0 -1
  352. package/dist/internal/shared/ssr/dom-flight.cjs.map +0 -1
  353. package/dist/internal/shared/ssr/dom-flight.d.ts +0 -2
  354. package/dist/internal/shared/ssr/dom-flight.js.map +0 -1
  355. package/dist/internal/shared/ssr/fetch-headers.cjs.map +0 -1
  356. package/dist/internal/shared/ssr/fetch-headers.js.map +0 -1
  357. package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +0 -1
  358. package/dist/internal/shared/ssr/fetch-remote-component.js.map +0 -1
  359. package/dist/internal/shared/ssr/fetch-with-hooks.cjs.map +0 -1
  360. package/dist/internal/shared/ssr/fetch-with-hooks.d.ts +0 -56
  361. package/dist/internal/shared/ssr/fetch-with-hooks.js.map +0 -1
  362. package/dist/internal/shared/ssr/get-client-or-server-url.cjs.map +0 -1
  363. package/dist/internal/shared/ssr/get-client-or-server-url.js.map +0 -1
  364. package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.cjs.map +0 -1
  365. package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.js.map +0 -1
  366. package/dist/internal/shared/ssr/skeleton.cjs.map +0 -1
  367. package/dist/internal/shared/ssr/skeleton.js.map +0 -1
  368. package/dist/internal/shared/utils/abort.cjs.map +0 -1
  369. package/dist/internal/shared/utils/abort.js.map +0 -1
  370. package/dist/internal/shared/utils/logger.cjs.map +0 -1
  371. package/dist/internal/shared/utils/logger.js.map +0 -1
  372. package/dist/internal/shared/utils.cjs.map +0 -1
  373. package/dist/internal/shared/utils.js.map +0 -1
  374. package/dist/internal/webpack/next-client-pages-loader.cjs.map +0 -1
  375. package/dist/internal/webpack/next-client-pages-loader.js.map +0 -1
  376. package/dist/internal/webpack/shared-modules.cjs.map +0 -1
  377. package/dist/internal/webpack/shared-modules.js.map +0 -1
  378. package/dist/next/config.cjs.map +0 -1
  379. package/dist/next/config.js.map +0 -1
  380. package/dist/next/host/app-router-server.cjs.map +0 -1
  381. package/dist/next/host/app-router-server.d.ts +0 -30
  382. package/dist/next/host/app-router-server.js.map +0 -1
  383. package/dist/next/host/client/index.cjs.map +0 -1
  384. package/dist/next/host/client/index.d.ts +0 -19
  385. package/dist/next/host/client/index.js.map +0 -1
  386. package/dist/next/host/pages-router-client.cjs.map +0 -1
  387. package/dist/next/host/pages-router-client.d.ts +0 -33
  388. package/dist/next/host/pages-router-client.js.map +0 -1
  389. package/dist/next/host/pages-router-server.cjs.map +0 -1
  390. package/dist/next/host/pages-router-server.js.map +0 -1
  391. package/dist/next/index.cjs +0 -53
  392. package/dist/next/index.cjs.map +0 -1
  393. package/dist/next/index.d.ts +0 -30
  394. package/dist/next/index.js +0 -19
  395. package/dist/next/index.js.map +0 -1
  396. package/dist/next/proxy.cjs.map +0 -1
  397. package/dist/next/proxy.d.ts +0 -56
  398. package/dist/next/proxy.js.map +0 -1
  399. package/dist/next/remote/pages-router.cjs.map +0 -1
  400. package/dist/next/remote/pages-router.js.map +0 -1
  401. package/dist/next/remote/server.cjs.map +0 -1
  402. package/dist/next/remote/server.d.ts +0 -5
  403. package/dist/next/remote/server.js +0 -5
  404. package/dist/next/remote/server.js.map +0 -1
  405. package/dist/proxy-through-host-a676a522.d.ts +0 -52
  406. package/dist/react/index.cjs.map +0 -1
  407. package/dist/react/index.d.ts +0 -86
  408. package/dist/react/index.js.map +0 -1
  409. package/dist/shared/host/app.cjs.map +0 -1
  410. package/dist/shared/host/app.js +0 -12
  411. package/dist/shared/host/app.js.map +0 -1
  412. package/dist/shared/host/pages.cjs.map +0 -1
  413. package/dist/shared/host/pages.js +0 -12
  414. package/dist/shared/host/pages.js.map +0 -1
  415. package/dist/shared/host/proxy.cjs.map +0 -1
  416. package/dist/shared/host/proxy.js.map +0 -1
  417. package/dist/shared/remote/app.cjs.map +0 -1
  418. package/dist/shared/remote/app.js +0 -8
  419. package/dist/shared/remote/app.js.map +0 -1
  420. package/dist/shared/remote/pages.cjs.map +0 -1
  421. package/dist/shared/remote/pages.js +0 -8
  422. package/dist/shared/remote/pages.js.map +0 -1
  423. package/dist/shared/remote/proxy.cjs.map +0 -1
  424. package/dist/shared/remote/proxy.d.ts +0 -44
  425. package/dist/shared/remote/proxy.js.map +0 -1
  426. package/dist/shared/remote/wrapper.cjs.map +0 -1
  427. package/dist/shared/remote/wrapper.js +0 -25
  428. package/dist/shared/remote/wrapper.js.map +0 -1
  429. package/dist/webpack.cjs.map +0 -1
  430. package/dist/webpack.js.map +0 -1
  431. /package/dist/{webpack.d.ts → config/webpack.d.ts} +0 -0
  432. /package/dist/{shared/host → host/defaults}/app.d.ts +0 -0
  433. /package/dist/{shared/host → host/defaults}/pages.d.ts +0 -0
  434. /package/dist/{shared/host/proxy.d.ts → host/proxy/protected-fetch.d.ts} +0 -0
  435. /package/dist/internal/{webpack/shared-modules.d.ts → config/webpack/apply-shared-modules.d.ts} +0 -0
  436. /package/dist/internal/{webpack → config/webpack}/next-client-pages-loader.d.ts +0 -0
  437. /package/dist/internal/{shared/ssr → host/nextjs}/dom-flight.cjs +0 -0
  438. /package/dist/internal/{shared/ssr → host/nextjs}/dom-flight.js +0 -0
  439. /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.cjs +0 -0
  440. /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.d.ts +0 -0
  441. /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.js +0 -0
  442. /package/dist/internal/{shared/ssr → host/server}/fetch-headers.cjs +0 -0
  443. /package/dist/internal/{shared/ssr → host/server}/fetch-headers.d.ts +0 -0
  444. /package/dist/internal/{shared/ssr → host/server}/fetch-headers.js +0 -0
  445. /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.cjs +0 -0
  446. /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.d.ts +0 -0
  447. /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.js +0 -0
  448. /package/dist/internal/{shared/client → host/server}/get-client-src.d.ts +0 -0
  449. /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.cjs +0 -0
  450. /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.d.ts +0 -0
  451. /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.js +0 -0
  452. /package/dist/internal/{shared/contract/host-state.d.ts → host/shared/state.d.ts} +0 -0
  453. /package/dist/internal/{shared/contract → host/utils}/resolve-name-from-src.cjs +0 -0
  454. /package/dist/internal/{shared/contract → host/utils}/resolve-name-from-src.d.ts +0 -0
  455. /package/dist/internal/{shared/contract → host/utils}/resolve-name-from-src.js +0 -0
  456. /package/dist/internal/{next/remote/render-client.d.ts → remote/nextjs/app-client.d.ts} +0 -0
  457. /package/dist/internal/{shared/client → runtime/html}/apply-origin.cjs +0 -0
  458. /package/dist/internal/{shared/client → runtime/html}/apply-origin.js +0 -0
  459. /package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.d.ts +0 -0
  460. /package/dist/internal/{shared/utils → utils}/abort.cjs +0 -0
  461. /package/dist/internal/{shared/utils → utils}/abort.d.ts +0 -0
  462. /package/dist/internal/{shared/utils → utils}/abort.js +0 -0
  463. /package/dist/internal/{shared → utils}/error.d.ts +0 -0
  464. /package/dist/internal/{shared/utils.cjs → utils.cjs} +0 -0
  465. /package/dist/internal/{shared/utils.d.ts → utils.d.ts} +0 -0
  466. /package/dist/internal/{shared/utils.js → utils.js} +0 -0
  467. /package/dist/{shared/remote → remote/defaults}/app.d.ts +0 -0
  468. /package/dist/{shared/remote → remote/defaults}/pages.d.ts +0 -0
  469. /package/dist/{shared/remote → remote/defaults}/wrapper.d.ts +0 -0
  470. /package/dist/{html/remote.d.ts → remote/html.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/host/nextjs/app.tsx"],"sourcesContent":["import 'remote-components/remote/defaults/wrapper';\nimport { Children, Suspense } from 'react';\nimport { ConsumeRemoteComponentClient } from '#internal/host/nextjs/app-client';\nimport { fetchRemoteComponent } from '#internal/host/server/fetch-remote-component';\nimport type { ConsumeServerConfig } from '#internal/host/shared/config';\n\nconst CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;\n\n/**\n * Props for the Next.js App Router remote component host (server component).\n */\nexport interface ConsumeRemoteComponentProps extends ConsumeServerConfig {\n /** The source URL of the remote component. Required for server rendering. */\n src: string | URL;\n /** Loading fallback content to display while the remote component is being fetched. */\n children?: React.ReactNode;\n}\n\n/**\n * Next.js App Router server component that fetches and renders a remote component.\n * Props are documented on {@link ConsumeRemoteComponentProps} (extends {@link ConsumeServerConfig}).\n *\n * @example\n * ```tsx\n * import { ConsumeRemoteComponent } from 'remote-components/host/nextjs/app';\n *\n * export default function MyPage() {\n * return <ConsumeRemoteComponent src=\"/nextjs-app-remote/components/header\" />;\n * }\n * ```\n */\nexport async function ConsumeRemoteComponent({\n src,\n name: nameProp,\n isolate,\n mode,\n reset,\n children,\n onRequest,\n onResponse,\n}: ConsumeRemoteComponentProps): Promise<React.ReactElement> {\n const {\n metadata,\n scripts,\n links,\n hydrationData,\n nextData,\n component,\n remoteShared,\n serverUrl,\n } = await fetchRemoteComponent(src, {\n name: nameProp,\n rsc: true,\n appRouter: true,\n onRequest,\n onResponse,\n });\n\n // pass all remote component data to the SSR/client layer\n // render remote component static HTML as children\n // remote _ssr suffix from remote component id\n const name = metadata.id.replace(/_ssr$/, '');\n const remoteComponentClient = (\n <ConsumeRemoteComponentClient\n bundle={metadata.bundle || (CURRENT_ZONE ?? name)}\n data={hydrationData}\n isolate={isolate}\n links={links}\n mode={mode}\n name={name}\n nextData={nextData}\n remoteShared={remoteShared}\n reset={reset}\n route={metadata.route}\n runtime={metadata.runtime}\n scripts={scripts}\n type={metadata.type}\n src={typeof src === 'string' ? src : src.href}\n serverUrl={serverUrl.href}\n >\n {component}\n </ConsumeRemoteComponentClient>\n );\n\n if (Children.count(children) > 0) {\n // if there are children, render them inside the remote component\n return <Suspense fallback={children}>{remoteComponentClient}</Suspense>;\n }\n\n return remoteComponentClient;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+DI;AA/DJ,qBAAO;AACP,mBAAmC;AACnC,wBAA6C;AAC7C,oCAAqC;AAGrC,MAAM,eAAe,QAAQ,IAAI;AAyBjC,eAAsB,uBAAuB;AAAA,EAC3C;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6D;AAC3D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,UAAM,oDAAqB,KAAK;AAAA,IAClC,MAAM;AAAA,IACN,KAAK;AAAA,IACL,WAAW;AAAA,IACX;AAAA,IACA;AAAA,EACF,CAAC;AAKD,QAAM,OAAO,SAAS,GAAG,QAAQ,SAAS,EAAE;AAC5C,QAAM,wBACJ;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ,SAAS,WAAW,gBAAgB;AAAA,MAC5C,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,SAAS;AAAA,MAChB,SAAS,SAAS;AAAA,MAClB;AAAA,MACA,MAAM,SAAS;AAAA,MACf,KAAK,OAAO,QAAQ,WAAW,MAAM,IAAI;AAAA,MACzC,WAAW,UAAU;AAAA,MAEpB;AAAA;AAAA,EACH;AAGF,MAAI,sBAAS,MAAM,QAAQ,IAAI,GAAG;AAEhC,WAAO,4CAAC,yBAAS,UAAU,UAAW,iCAAsB;AAAA,EAC9D;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,29 @@
1
+ import { ConsumeServerConfig } from '../../internal/host/shared/config.js';
2
+ import '../../internal/runtime/url/resolve-client-url.js';
3
+ import '../../internal/host/shared/fetch-interceptors.js';
4
+
5
+ /**
6
+ * Props for the Next.js App Router remote component host (server component).
7
+ */
8
+ interface ConsumeRemoteComponentProps extends ConsumeServerConfig {
9
+ /** The source URL of the remote component. Required for server rendering. */
10
+ src: string | URL;
11
+ /** Loading fallback content to display while the remote component is being fetched. */
12
+ children?: React.ReactNode;
13
+ }
14
+ /**
15
+ * Next.js App Router server component that fetches and renders a remote component.
16
+ * Props are documented on {@link ConsumeRemoteComponentProps} (extends {@link ConsumeServerConfig}).
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * import { ConsumeRemoteComponent } from 'remote-components/host/nextjs/app';
21
+ *
22
+ * export default function MyPage() {
23
+ * return <ConsumeRemoteComponent src="/nextjs-app-remote/components/header" />;
24
+ * }
25
+ * ```
26
+ */
27
+ declare function ConsumeRemoteComponent({ src, name: nameProp, isolate, mode, reset, children, onRequest, onResponse, }: ConsumeRemoteComponentProps): Promise<React.ReactElement>;
28
+
29
+ export { ConsumeRemoteComponent, ConsumeRemoteComponentProps };
@@ -1,9 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import "remote-components/remote/defaults/wrapper";
2
3
  import { Children, Suspense } from "react";
3
- import { RemoteComponentClient } from "#internal/next/host/app-router-client";
4
- import { fetchRemoteComponent } from "#internal/shared/ssr/fetch-remote-component";
4
+ import { ConsumeRemoteComponentClient } from "#internal/host/nextjs/app-client";
5
+ import { fetchRemoteComponent } from "#internal/host/server/fetch-remote-component";
5
6
  const CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;
6
- async function RemoteComponent({
7
+ async function ConsumeRemoteComponent({
7
8
  src,
8
9
  name: nameProp,
9
10
  isolate,
@@ -31,7 +32,7 @@ async function RemoteComponent({
31
32
  });
32
33
  const name = metadata.id.replace(/_ssr$/, "");
33
34
  const remoteComponentClient = /* @__PURE__ */ jsx(
34
- RemoteComponentClient,
35
+ ConsumeRemoteComponentClient,
35
36
  {
36
37
  bundle: metadata.bundle || (CURRENT_ZONE ?? name),
37
38
  data: hydrationData,
@@ -57,6 +58,6 @@ async function RemoteComponent({
57
58
  return remoteComponentClient;
58
59
  }
59
60
  export {
60
- RemoteComponent
61
+ ConsumeRemoteComponent
61
62
  };
62
- //# sourceMappingURL=app-router-server.js.map
63
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/host/nextjs/app.tsx"],"sourcesContent":["import 'remote-components/remote/defaults/wrapper';\nimport { Children, Suspense } from 'react';\nimport { ConsumeRemoteComponentClient } from '#internal/host/nextjs/app-client';\nimport { fetchRemoteComponent } from '#internal/host/server/fetch-remote-component';\nimport type { ConsumeServerConfig } from '#internal/host/shared/config';\n\nconst CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;\n\n/**\n * Props for the Next.js App Router remote component host (server component).\n */\nexport interface ConsumeRemoteComponentProps extends ConsumeServerConfig {\n /** The source URL of the remote component. Required for server rendering. */\n src: string | URL;\n /** Loading fallback content to display while the remote component is being fetched. */\n children?: React.ReactNode;\n}\n\n/**\n * Next.js App Router server component that fetches and renders a remote component.\n * Props are documented on {@link ConsumeRemoteComponentProps} (extends {@link ConsumeServerConfig}).\n *\n * @example\n * ```tsx\n * import { ConsumeRemoteComponent } from 'remote-components/host/nextjs/app';\n *\n * export default function MyPage() {\n * return <ConsumeRemoteComponent src=\"/nextjs-app-remote/components/header\" />;\n * }\n * ```\n */\nexport async function ConsumeRemoteComponent({\n src,\n name: nameProp,\n isolate,\n mode,\n reset,\n children,\n onRequest,\n onResponse,\n}: ConsumeRemoteComponentProps): Promise<React.ReactElement> {\n const {\n metadata,\n scripts,\n links,\n hydrationData,\n nextData,\n component,\n remoteShared,\n serverUrl,\n } = await fetchRemoteComponent(src, {\n name: nameProp,\n rsc: true,\n appRouter: true,\n onRequest,\n onResponse,\n });\n\n // pass all remote component data to the SSR/client layer\n // render remote component static HTML as children\n // remote _ssr suffix from remote component id\n const name = metadata.id.replace(/_ssr$/, '');\n const remoteComponentClient = (\n <ConsumeRemoteComponentClient\n bundle={metadata.bundle || (CURRENT_ZONE ?? name)}\n data={hydrationData}\n isolate={isolate}\n links={links}\n mode={mode}\n name={name}\n nextData={nextData}\n remoteShared={remoteShared}\n reset={reset}\n route={metadata.route}\n runtime={metadata.runtime}\n scripts={scripts}\n type={metadata.type}\n src={typeof src === 'string' ? src : src.href}\n serverUrl={serverUrl.href}\n >\n {component}\n </ConsumeRemoteComponentClient>\n );\n\n if (Children.count(children) > 0) {\n // if there are children, render them inside the remote component\n return <Suspense fallback={children}>{remoteComponentClient}</Suspense>;\n }\n\n return remoteComponentClient;\n}\n"],"mappings":"AA+DI;AA/DJ,OAAO;AACP,SAAS,UAAU,gBAAgB;AACnC,SAAS,oCAAoC;AAC7C,SAAS,4BAA4B;AAGrC,MAAM,eAAe,QAAQ,IAAI;AAyBjC,eAAsB,uBAAuB;AAAA,EAC3C;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6D;AAC3D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,MAAM,qBAAqB,KAAK;AAAA,IAClC,MAAM;AAAA,IACN,KAAK;AAAA,IACL,WAAW;AAAA,IACX;AAAA,IACA;AAAA,EACF,CAAC;AAKD,QAAM,OAAO,SAAS,GAAG,QAAQ,SAAS,EAAE;AAC5C,QAAM,wBACJ;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ,SAAS,WAAW,gBAAgB;AAAA,MAC5C,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,SAAS;AAAA,MAChB,SAAS,SAAS;AAAA,MAClB;AAAA,MACA,MAAM,SAAS;AAAA,MACf,KAAK,OAAO,QAAQ,WAAW,MAAM,IAAI;AAAA,MACzC,WAAW,UAAU;AAAA,MAEpB;AAAA;AAAA,EACH;AAGF,MAAI,SAAS,MAAM,QAAQ,IAAI,GAAG;AAEhC,WAAO,oBAAC,YAAS,UAAU,UAAW,iCAAsB;AAAA,EAC9D;AAEA,SAAO;AACT;","names":[]}
@@ -26,15 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var pages_router_client_exports = {};
30
- __export(pages_router_client_exports, {
31
- RemoteComponent: () => RemoteComponent
29
+ var pages_client_exports = {};
30
+ __export(pages_client_exports, {
31
+ ConsumeRemoteComponent: () => ConsumeRemoteComponent
32
32
  });
33
- module.exports = __toCommonJS(pages_router_client_exports);
33
+ module.exports = __toCommonJS(pages_client_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_react = require("react");
36
- var import_pages = require("remote-components/shared/host/pages");
37
- function RemoteComponent({
36
+ var import_pages = require("#remote-components/host/defaults/pages");
37
+ function ConsumeRemoteComponent({
38
38
  src,
39
39
  children,
40
40
  onBeforeLoad,
@@ -117,6 +117,6 @@ function RemoteComponent({
117
117
  }
118
118
  // Annotate the CommonJS export names for ESM import in node:
119
119
  0 && (module.exports = {
120
- RemoteComponent
120
+ ConsumeRemoteComponent
121
121
  });
122
- //# sourceMappingURL=pages-router-client.cjs.map
122
+ //# sourceMappingURL=client-only.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/host/nextjs/pages-client.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { ConsumeRemoteComponentConfig } from '#internal/host/shared/config';\nimport type {\n OnRequestHook,\n OnResponseHook,\n} from '#internal/host/shared/fetch-interceptors';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\nimport { shared } from '#remote-components/host/defaults/pages';\n\n// patch react/jsx-runtime to support the remote-component custom element\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n 'remote-component': {\n src?: string;\n ref?: React.Ref<HTMLElement>;\n children: React.ReactNode;\n };\n }\n }\n}\n\n// Extend HTMLElement to include onRequest/onResponse/resolveClientUrl properties from the custom element\ninterface RemoteComponentElement extends HTMLElement {\n onRequest?: OnRequestHook;\n onResponse?: OnResponseHook;\n resolveClientUrl?: ResolveClientUrl;\n}\n\n/**\n * Props for the Pages Router client-side remote component wrapper.\n *\n * Extends {@link ConsumeRemoteComponentConfig}. The `src` prop is required since\n * the client always needs a source URL to load from.\n */\nexport interface ConsumeRemoteComponentProps\n extends ConsumeRemoteComponentConfig {\n /** The source URL of the remote component. Required for client-side loading. */\n src: string;\n /** Loading fallback content displayed while the remote component is being fetched. */\n children?: React.ReactNode;\n}\n\nexport function ConsumeRemoteComponent({\n src,\n children,\n onBeforeLoad,\n onChange,\n onError,\n onLoad,\n onRequest,\n onResponse,\n resolveClientUrl,\n}: ConsumeRemoteComponentProps) {\n const elementRef = useRef<RemoteComponentElement>(null);\n\n useEffect(() => {\n const self = globalThis as typeof globalThis & {\n __remote_component_shared__?: Record<string, () => Promise<unknown>>;\n };\n // eslint-disable-next-line camelcase\n self.__remote_component_shared__ = shared;\n import('remote-components/html/host');\n }, []);\n\n useEffect(() => {\n const element = elementRef.current;\n if (!element) return;\n\n // Set onRequest/onResponse/resolveClientUrl properties on the element before it loads\n if (onRequest) {\n element.onRequest = onRequest;\n }\n if (onResponse) {\n element.onResponse = onResponse;\n }\n if (resolveClientUrl !== undefined) {\n element.resolveClientUrl = resolveClientUrl;\n }\n\n // Set up event listeners for lifecycle hooks\n const handleBeforeLoad = (e: Event) => {\n const customEvent = e as CustomEvent & { src?: string };\n onBeforeLoad?.(customEvent.src ?? src);\n };\n const handleLoad = (e: Event) => {\n const customEvent = e as CustomEvent & { src?: string };\n onLoad?.(customEvent.src ?? src);\n };\n const handleError = (e: Event) => {\n const customEvent = e as CustomEvent & { error?: unknown };\n onError?.(customEvent.error);\n };\n const handleChange = (e: Event) => {\n const customEvent = e as CustomEvent & {\n previousSrc?: string | null;\n nextSrc?: string | null;\n previousName?: string;\n nextName?: string;\n };\n onChange?.({\n previousSrc: customEvent.previousSrc ?? null,\n nextSrc: customEvent.nextSrc ?? null,\n previousName: customEvent.previousName,\n nextName: customEvent.nextName,\n });\n };\n\n if (onBeforeLoad) element.addEventListener('beforeload', handleBeforeLoad);\n if (onLoad) element.addEventListener('load', handleLoad);\n if (onError) element.addEventListener('error', handleError);\n if (onChange) element.addEventListener('change', handleChange);\n\n return () => {\n if (onBeforeLoad)\n element.removeEventListener('beforeload', handleBeforeLoad);\n if (onLoad) element.removeEventListener('load', handleLoad);\n if (onError) element.removeEventListener('error', handleError);\n if (onChange) element.removeEventListener('change', handleChange);\n };\n }, [\n src,\n onBeforeLoad,\n onChange,\n onError,\n onLoad,\n onRequest,\n onResponse,\n resolveClientUrl,\n ]);\n\n return (\n <remote-component ref={elementRef} src={src}>\n {children}\n </remote-component>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqII;AArIJ,mBAAkC;AAOlC,mBAAuB;AAqChB,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAC9B,QAAM,iBAAa,qBAA+B,IAAI;AAEtD,8BAAU,MAAM;AACd,UAAM,OAAO;AAIb,SAAK,8BAA8B;AACnC,WAAO,6BAA6B;AAAA,EACtC,GAAG,CAAC,CAAC;AAEL,8BAAU,MAAM;AACd,UAAM,UAAU,WAAW;AAC3B,QAAI,CAAC;AAAS;AAGd,QAAI,WAAW;AACb,cAAQ,YAAY;AAAA,IACtB;AACA,QAAI,YAAY;AACd,cAAQ,aAAa;AAAA,IACvB;AACA,QAAI,qBAAqB,QAAW;AAClC,cAAQ,mBAAmB;AAAA,IAC7B;AAGA,UAAM,mBAAmB,CAAC,MAAa;AACrC,YAAM,cAAc;AACpB,qBAAe,YAAY,OAAO,GAAG;AAAA,IACvC;AACA,UAAM,aAAa,CAAC,MAAa;AAC/B,YAAM,cAAc;AACpB,eAAS,YAAY,OAAO,GAAG;AAAA,IACjC;AACA,UAAM,cAAc,CAAC,MAAa;AAChC,YAAM,cAAc;AACpB,gBAAU,YAAY,KAAK;AAAA,IAC7B;AACA,UAAM,eAAe,CAAC,MAAa;AACjC,YAAM,cAAc;AAMpB,iBAAW;AAAA,QACT,aAAa,YAAY,eAAe;AAAA,QACxC,SAAS,YAAY,WAAW;AAAA,QAChC,cAAc,YAAY;AAAA,QAC1B,UAAU,YAAY;AAAA,MACxB,CAAC;AAAA,IACH;AAEA,QAAI;AAAc,cAAQ,iBAAiB,cAAc,gBAAgB;AACzE,QAAI;AAAQ,cAAQ,iBAAiB,QAAQ,UAAU;AACvD,QAAI;AAAS,cAAQ,iBAAiB,SAAS,WAAW;AAC1D,QAAI;AAAU,cAAQ,iBAAiB,UAAU,YAAY;AAE7D,WAAO,MAAM;AACX,UAAI;AACF,gBAAQ,oBAAoB,cAAc,gBAAgB;AAC5D,UAAI;AAAQ,gBAAQ,oBAAoB,QAAQ,UAAU;AAC1D,UAAI;AAAS,gBAAQ,oBAAoB,SAAS,WAAW;AAC7D,UAAI;AAAU,gBAAQ,oBAAoB,UAAU,YAAY;AAAA,IAClE;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE,4CAAC,sBAAiB,KAAK,YAAY,KAChC,UACH;AAEJ;","names":[]}
@@ -0,0 +1,31 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ConsumeRemoteComponentConfig } from '../../../internal/host/shared/config.js';
3
+ import '../../../internal/runtime/url/resolve-client-url.js';
4
+ import '../../../internal/host/shared/fetch-interceptors.js';
5
+
6
+ declare module 'react/jsx-runtime' {
7
+ namespace JSX {
8
+ interface IntrinsicElements {
9
+ 'remote-component': {
10
+ src?: string;
11
+ ref?: React.Ref<HTMLElement>;
12
+ children: React.ReactNode;
13
+ };
14
+ }
15
+ }
16
+ }
17
+ /**
18
+ * Props for the Pages Router client-side remote component wrapper.
19
+ *
20
+ * Extends {@link ConsumeRemoteComponentConfig}. The `src` prop is required since
21
+ * the client always needs a source URL to load from.
22
+ */
23
+ interface ConsumeRemoteComponentProps extends ConsumeRemoteComponentConfig {
24
+ /** The source URL of the remote component. Required for client-side loading. */
25
+ src: string;
26
+ /** Loading fallback content displayed while the remote component is being fetched. */
27
+ children?: React.ReactNode;
28
+ }
29
+ declare function ConsumeRemoteComponent({ src, children, onBeforeLoad, onChange, onError, onLoad, onRequest, onResponse, resolveClientUrl, }: ConsumeRemoteComponentProps): react_jsx_runtime.JSX.Element;
30
+
31
+ export { ConsumeRemoteComponent, ConsumeRemoteComponentProps };
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useRef } from "react";
3
- import { shared } from "remote-components/shared/host/pages";
4
- function RemoteComponent({
3
+ import { shared } from "#remote-components/host/defaults/pages";
4
+ function ConsumeRemoteComponent({
5
5
  src,
6
6
  children,
7
7
  onBeforeLoad,
@@ -83,6 +83,6 @@ function RemoteComponent({
83
83
  return /* @__PURE__ */ jsx("remote-component", { ref: elementRef, src, children });
84
84
  }
85
85
  export {
86
- RemoteComponent
86
+ ConsumeRemoteComponent
87
87
  };
88
- //# sourceMappingURL=pages-router-client.js.map
88
+ //# sourceMappingURL=client-only.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/host/nextjs/pages-client.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { ConsumeRemoteComponentConfig } from '#internal/host/shared/config';\nimport type {\n OnRequestHook,\n OnResponseHook,\n} from '#internal/host/shared/fetch-interceptors';\nimport type { ResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\nimport { shared } from '#remote-components/host/defaults/pages';\n\n// patch react/jsx-runtime to support the remote-component custom element\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n 'remote-component': {\n src?: string;\n ref?: React.Ref<HTMLElement>;\n children: React.ReactNode;\n };\n }\n }\n}\n\n// Extend HTMLElement to include onRequest/onResponse/resolveClientUrl properties from the custom element\ninterface RemoteComponentElement extends HTMLElement {\n onRequest?: OnRequestHook;\n onResponse?: OnResponseHook;\n resolveClientUrl?: ResolveClientUrl;\n}\n\n/**\n * Props for the Pages Router client-side remote component wrapper.\n *\n * Extends {@link ConsumeRemoteComponentConfig}. The `src` prop is required since\n * the client always needs a source URL to load from.\n */\nexport interface ConsumeRemoteComponentProps\n extends ConsumeRemoteComponentConfig {\n /** The source URL of the remote component. Required for client-side loading. */\n src: string;\n /** Loading fallback content displayed while the remote component is being fetched. */\n children?: React.ReactNode;\n}\n\nexport function ConsumeRemoteComponent({\n src,\n children,\n onBeforeLoad,\n onChange,\n onError,\n onLoad,\n onRequest,\n onResponse,\n resolveClientUrl,\n}: ConsumeRemoteComponentProps) {\n const elementRef = useRef<RemoteComponentElement>(null);\n\n useEffect(() => {\n const self = globalThis as typeof globalThis & {\n __remote_component_shared__?: Record<string, () => Promise<unknown>>;\n };\n // eslint-disable-next-line camelcase\n self.__remote_component_shared__ = shared;\n import('remote-components/html/host');\n }, []);\n\n useEffect(() => {\n const element = elementRef.current;\n if (!element) return;\n\n // Set onRequest/onResponse/resolveClientUrl properties on the element before it loads\n if (onRequest) {\n element.onRequest = onRequest;\n }\n if (onResponse) {\n element.onResponse = onResponse;\n }\n if (resolveClientUrl !== undefined) {\n element.resolveClientUrl = resolveClientUrl;\n }\n\n // Set up event listeners for lifecycle hooks\n const handleBeforeLoad = (e: Event) => {\n const customEvent = e as CustomEvent & { src?: string };\n onBeforeLoad?.(customEvent.src ?? src);\n };\n const handleLoad = (e: Event) => {\n const customEvent = e as CustomEvent & { src?: string };\n onLoad?.(customEvent.src ?? src);\n };\n const handleError = (e: Event) => {\n const customEvent = e as CustomEvent & { error?: unknown };\n onError?.(customEvent.error);\n };\n const handleChange = (e: Event) => {\n const customEvent = e as CustomEvent & {\n previousSrc?: string | null;\n nextSrc?: string | null;\n previousName?: string;\n nextName?: string;\n };\n onChange?.({\n previousSrc: customEvent.previousSrc ?? null,\n nextSrc: customEvent.nextSrc ?? null,\n previousName: customEvent.previousName,\n nextName: customEvent.nextName,\n });\n };\n\n if (onBeforeLoad) element.addEventListener('beforeload', handleBeforeLoad);\n if (onLoad) element.addEventListener('load', handleLoad);\n if (onError) element.addEventListener('error', handleError);\n if (onChange) element.addEventListener('change', handleChange);\n\n return () => {\n if (onBeforeLoad)\n element.removeEventListener('beforeload', handleBeforeLoad);\n if (onLoad) element.removeEventListener('load', handleLoad);\n if (onError) element.removeEventListener('error', handleError);\n if (onChange) element.removeEventListener('change', handleChange);\n };\n }, [\n src,\n onBeforeLoad,\n onChange,\n onError,\n onLoad,\n onRequest,\n onResponse,\n resolveClientUrl,\n ]);\n\n return (\n <remote-component ref={elementRef} src={src}>\n {children}\n </remote-component>\n );\n}\n"],"mappings":"AAqII;AArIJ,SAAS,WAAW,cAAc;AAOlC,SAAS,cAAc;AAqChB,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAC9B,QAAM,aAAa,OAA+B,IAAI;AAEtD,YAAU,MAAM;AACd,UAAM,OAAO;AAIb,SAAK,8BAA8B;AACnC,WAAO,6BAA6B;AAAA,EACtC,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,UAAM,UAAU,WAAW;AAC3B,QAAI,CAAC;AAAS;AAGd,QAAI,WAAW;AACb,cAAQ,YAAY;AAAA,IACtB;AACA,QAAI,YAAY;AACd,cAAQ,aAAa;AAAA,IACvB;AACA,QAAI,qBAAqB,QAAW;AAClC,cAAQ,mBAAmB;AAAA,IAC7B;AAGA,UAAM,mBAAmB,CAAC,MAAa;AACrC,YAAM,cAAc;AACpB,qBAAe,YAAY,OAAO,GAAG;AAAA,IACvC;AACA,UAAM,aAAa,CAAC,MAAa;AAC/B,YAAM,cAAc;AACpB,eAAS,YAAY,OAAO,GAAG;AAAA,IACjC;AACA,UAAM,cAAc,CAAC,MAAa;AAChC,YAAM,cAAc;AACpB,gBAAU,YAAY,KAAK;AAAA,IAC7B;AACA,UAAM,eAAe,CAAC,MAAa;AACjC,YAAM,cAAc;AAMpB,iBAAW;AAAA,QACT,aAAa,YAAY,eAAe;AAAA,QACxC,SAAS,YAAY,WAAW;AAAA,QAChC,cAAc,YAAY;AAAA,QAC1B,UAAU,YAAY;AAAA,MACxB,CAAC;AAAA,IACH;AAEA,QAAI;AAAc,cAAQ,iBAAiB,cAAc,gBAAgB;AACzE,QAAI;AAAQ,cAAQ,iBAAiB,QAAQ,UAAU;AACvD,QAAI;AAAS,cAAQ,iBAAiB,SAAS,WAAW;AAC1D,QAAI;AAAU,cAAQ,iBAAiB,UAAU,YAAY;AAE7D,WAAO,MAAM;AACX,UAAI;AACF,gBAAQ,oBAAoB,cAAc,gBAAgB;AAC5D,UAAI;AAAQ,gBAAQ,oBAAoB,QAAQ,UAAU;AAC1D,UAAI;AAAS,gBAAQ,oBAAoB,SAAS,WAAW;AAC7D,UAAI;AAAU,gBAAQ,oBAAoB,UAAU,YAAY;AAAA,IAClE;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE,oBAAC,sBAAiB,KAAK,YAAY,KAChC,UACH;AAEJ;","names":[]}
@@ -26,23 +26,27 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var pages_router_server_exports = {};
30
- __export(pages_router_server_exports, {
31
- RemoteComponent: () => RemoteComponent,
32
- getRemoteComponentProps: () => getRemoteComponentProps
29
+ var pages_exports = {};
30
+ __export(pages_exports, {
31
+ ConsumeRemoteComponent: () => ConsumeRemoteComponent,
32
+ getConsumeRemoteComponentProps: () => getConsumeRemoteComponentProps
33
33
  });
34
- module.exports = __toCommonJS(pages_router_server_exports);
34
+ module.exports = __toCommonJS(pages_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_wrapper = require("remote-components/remote/defaults/wrapper");
36
37
  var Form = __toESM(require("next/form"), 1);
37
38
  var Image = __toESM(require("next/image"), 1);
38
39
  var Link = __toESM(require("next/link"), 1);
39
40
  var Router = __toESM(require("next/router"), 1);
40
41
  var Script = __toESM(require("next/script"), 1);
41
42
  var import_react = require("react");
42
- var import_pages = require("remote-components/shared/host/pages");
43
- var import_remote_component = require("#internal/shared/client/remote-component");
44
- var import_fetch_remote_component = require("#internal/shared/ssr/fetch-remote-component");
45
- var import_react2 = require("#remote-components/react/index");
43
+ var import_react2 = require("remote-components/host/react");
44
+ var import_image_impl = require("#internal/host/nextjs/image-impl");
45
+ var import_image_shared = require("#internal/host/nextjs/image-shared");
46
+ var import_fetch_remote_component = require("#internal/host/server/fetch-remote-component");
47
+ var import_default_resolve_client_url = require("#internal/runtime/url/default-resolve-client-url");
48
+ var import_error = require("#internal/utils/error");
49
+ var import_pages = require("#remote-components/host/defaults/pages");
46
50
  const navigationImpl = {
47
51
  useRouter: () => Router.useRouter(),
48
52
  useSearchParams: () => {
@@ -54,24 +58,14 @@ const navigationImpl = {
54
58
  }
55
59
  };
56
60
  const sharedCache = /* @__PURE__ */ new Map();
57
- const shared = (bundle) => {
58
- if (sharedCache.has(bundle)) {
59
- return sharedCache.get(bundle);
60
- }
61
- const remoteLoader = ({ src, width, quality }) => {
62
- const self2 = globalThis;
63
- const { assetPrefix } = /^(?<assetPrefix>.*?)\/_next\//.exec(src)?.groups ?? {};
64
- return `${self2.__remote_bundle_url__?.[bundle]?.origin ?? ""}${assetPrefix}/_next/image?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 75}`;
65
- };
66
- const imageImpl = (ImageComponent) => {
67
- function RemoteImage(props) {
68
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageComponent, { loader: remoteLoader, ...props });
61
+ const shared = (bundle, resolveClientUrl) => {
62
+ if (!resolveClientUrl) {
63
+ if (sharedCache.has(bundle)) {
64
+ return sharedCache.get(bundle);
69
65
  }
70
- RemoteImage.default = RemoteImage;
71
- RemoteImage.getImageProps = Image.getImageProps;
72
- return RemoteImage;
73
- };
74
- return {
66
+ }
67
+ const ImageComponent = Image.default.default ?? Image.default;
68
+ const result = {
75
69
  // polyfill Next.js App Router client API (minimal)
76
70
  // some API methods are not available when using a Next.js Pages Router application as host
77
71
  "next/navigation": () => Promise.resolve(navigationImpl),
@@ -82,26 +76,18 @@ const shared = (bundle) => {
82
76
  "next/form": () => Promise.resolve(Form.default),
83
77
  "next/dist/client/script": () => Promise.resolve(Script.default),
84
78
  "next/script": () => Promise.resolve(Script.default),
85
- "next/dist/client/image-component": () => Promise.resolve({
86
- // @ts-expect-error default.default
87
- // eslint-disable-next-line
88
- Image: imageImpl(Image.default.default ?? Image.default)
89
- }),
90
- "next/dist/api/image": () => Promise.resolve({
91
- // @ts-expect-error default.default
92
- // eslint-disable-next-line
93
- default: imageImpl(Image.default.default ?? Image.default),
94
- getImageProps: Image.getImageProps
95
- }),
96
79
  "next/router": () => Promise.resolve(Router),
97
80
  ...import_pages.shared,
98
- // always override next/image to use the remote loader
99
- "next/image": () => Promise.resolve(
100
- // @ts-expect-error default.default
101
- // eslint-disable-next-line
102
- imageImpl(Image.default.default ?? Image.default)
81
+ // Always override Next.js image modules to use the bundle URL rewriter.
82
+ ...(0, import_image_shared.createNextImageSharedEntries)(
83
+ () => (0, import_image_impl.imageImpl)(ImageComponent, bundle, resolveClientUrl, true),
84
+ { getImageProps: Image.getImageProps }
103
85
  )
104
86
  };
87
+ if (!resolveClientUrl) {
88
+ sharedCache.set(bundle, result);
89
+ }
90
+ return result;
105
91
  };
106
92
  const REMOTE_COMPONENT_STORE = Symbol("REMOTE_COMPONENT_STORE");
107
93
  const REMOTE_COMPONENT_KEY = "__REMOTE_COMPONENT_KEY__";
@@ -124,20 +110,23 @@ function getComponent(key) {
124
110
  self[REMOTE_COMPONENT_STORE]?.delete(key);
125
111
  return component;
126
112
  }
127
- function RemoteComponent(props) {
113
+ function ConsumeRemoteComponent(props) {
128
114
  const remoteComponent = typeof document !== "undefined" ? null : (
129
115
  // retrieve the HTML from the global store
130
116
  getComponent(
131
117
  props[REMOTE_COMPONENT_KEY] ?? "__vercel_remote_component"
132
118
  )
133
119
  );
120
+ const src = typeof props.src === "string" ? props.src : props.src.href;
121
+ const resolveClientUrl = props.resolveClientUrl ? (0, import_default_resolve_client_url.bindResolveClientUrl)(props.resolveClientUrl, src) : void 0;
122
+ const sharedResult = shared(props.bundle ?? "default", resolveClientUrl);
134
123
  (0, import_react.useEffect)(() => {
135
124
  const clientSelf = globalThis;
136
- clientSelf.__remote_component_shared__ = shared(props.bundle ?? "default");
137
- }, [props.bundle]);
125
+ clientSelf.__remote_component_shared__ = sharedResult;
126
+ }, [sharedResult]);
138
127
  if (!props[REMOTE_COMPONENT_KEY]) {
139
128
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
140
- import_react2.RemoteComponent,
129
+ import_react2.ConsumeRemoteComponent,
141
130
  {
142
131
  isolate: props.isolate,
143
132
  mode: props.mode,
@@ -150,14 +139,14 @@ function RemoteComponent(props) {
150
139
  onResponse: props.onResponse,
151
140
  resolveClientUrl: props.resolveClientUrl,
152
141
  reset: props.reset,
153
- shared: shared(props.bundle ?? "default"),
142
+ shared: sharedResult,
154
143
  src: props.src,
155
144
  children: props.children
156
145
  }
157
146
  );
158
147
  }
159
148
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
160
- import_react2.RemoteComponent,
149
+ import_react2.ConsumeRemoteComponent,
161
150
  {
162
151
  isolate: props.isolate,
163
152
  mode: props.mode,
@@ -170,16 +159,16 @@ function RemoteComponent(props) {
170
159
  onResponse: props.onResponse,
171
160
  resolveClientUrl: props.resolveClientUrl,
172
161
  reset: props.reset,
173
- shared: shared(props.bundle ?? "default"),
162
+ shared: sharedResult,
174
163
  src: props.src,
175
164
  children: remoteComponent
176
165
  }
177
166
  );
178
167
  }
179
- async function getRemoteComponentProps(src, options) {
168
+ async function getConsumeRemoteComponentProps(src, options) {
180
169
  if (typeof document !== "undefined") {
181
- throw new import_remote_component.RemoteComponentsError(
182
- "`getRemoteComponentProps()` can only be used on the server side."
170
+ throw new import_error.RemoteComponentsError(
171
+ "`getConsumeRemoteComponentProps()` can only be used on the server side."
183
172
  );
184
173
  }
185
174
  const {
@@ -233,7 +222,7 @@ async function getRemoteComponentProps(src, options) {
233
222
  }
234
223
  // Annotate the CommonJS export names for ESM import in node:
235
224
  0 && (module.exports = {
236
- RemoteComponent,
237
- getRemoteComponentProps
225
+ ConsumeRemoteComponent,
226
+ getConsumeRemoteComponentProps
238
227
  });
239
- //# sourceMappingURL=pages-router-server.cjs.map
228
+ //# sourceMappingURL=pages.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/host/nextjs/pages.tsx"],"sourcesContent":["import 'remote-components/remote/defaults/wrapper';\nimport * as Form from 'next/form';\nimport * as Image from 'next/image';\nimport * as Link from 'next/link';\nimport * as Router from 'next/router';\nimport * as Script from 'next/script';\nimport { useEffect } from 'react';\nimport { ConsumeRemoteComponent as ConsumeRemoteComponentReact } from 'remote-components/host/react';\nimport { imageImpl } from '#internal/host/nextjs/image-impl';\nimport { createNextImageSharedEntries } from '#internal/host/nextjs/image-shared';\nimport { fetchRemoteComponent } from '#internal/host/server/fetch-remote-component';\nimport type { ConsumeRemoteComponentConfig } from '#internal/host/shared/config';\nimport type {\n OnRequestHook,\n OnResponseHook,\n} from '#internal/host/shared/fetch-interceptors';\nimport { bindResolveClientUrl } from '#internal/runtime/url/default-resolve-client-url';\nimport type { InternalResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\nimport { RemoteComponentsError } from '#internal/utils/error';\nimport { shared as _shared } from '#remote-components/host/defaults/pages';\n\nconst navigationImpl = {\n useRouter: () => Router.useRouter(),\n useSearchParams: () => {\n const router = Router.useRouter();\n return {\n get: (key: string) => router.query[key],\n has: (key: string) => key in router.query,\n };\n },\n};\n\nconst sharedCache = new Map<string, Record<string, () => Promise<unknown>>>();\nconst shared = (\n bundle: string,\n resolveClientUrl?: InternalResolveClientUrl,\n) => {\n // Skip cache when resolveClientUrl is provided — different resolver instances\n // must not share a cache entry, since imageImpl closes over the resolver.\n if (!resolveClientUrl) {\n if (sharedCache.has(bundle)) {\n return sharedCache.get(bundle);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const ImageComponent: typeof Image.default =\n (Image.default as any).default ?? Image.default;\n const result = {\n // polyfill Next.js App Router client API (minimal)\n // some API methods are not available when using a Next.js Pages Router application as host\n 'next/navigation': () =>\n Promise.resolve(navigationImpl) as Promise<unknown>,\n 'next/dist/client/components/navigation': () =>\n Promise.resolve(navigationImpl) as Promise<unknown>,\n 'next/dist/client/app-dir/link': () =>\n Promise.resolve(Link.default) as Promise<unknown>,\n 'next/link': () => Promise.resolve(Link.default) as Promise<unknown>,\n 'next/dist/client/app-dir/form': () =>\n Promise.resolve(Form.default) as Promise<unknown>,\n 'next/form': () => Promise.resolve(Form.default) as Promise<unknown>,\n 'next/dist/client/script': () =>\n Promise.resolve(Script.default) as Promise<unknown>,\n 'next/script': () => Promise.resolve(Script.default) as Promise<unknown>,\n 'next/router': () => Promise.resolve(Router) as Promise<unknown>,\n ..._shared,\n // Always override Next.js image modules to use the bundle URL rewriter.\n ...createNextImageSharedEntries(\n () => imageImpl(ImageComponent, bundle, resolveClientUrl, true),\n { getImageProps: Image.getImageProps },\n ),\n };\n\n if (!resolveClientUrl) {\n sharedCache.set(bundle, result);\n }\n\n return result;\n};\n\n// internal symbols to access global store\nconst REMOTE_COMPONENT_STORE = Symbol('REMOTE_COMPONENT_STORE');\nconst REMOTE_COMPONENT_KEY = '__REMOTE_COMPONENT_KEY__';\n\n// temporary global store for remote component HTML\n// the store is used to save the HTML of remote components for SSR without sending the content to the client\nconst self = globalThis as typeof globalThis & {\n [REMOTE_COMPONENT_STORE]?: Map<string, React.ReactNode>;\n};\n\nfunction getKey({\n bundle,\n route,\n name,\n}: {\n bundle?: string;\n route?: string;\n name?: string;\n}): string {\n return `${bundle ?? '__next'}:${route ?? '/'}:${\n name ?? '__vercel_remote_component'\n }__${crypto.randomUUID()}`;\n}\n\nfunction setComponent(key: string, component: React.ReactNode): void {\n if (!self[REMOTE_COMPONENT_STORE]) {\n self[REMOTE_COMPONENT_STORE] = new Map();\n }\n self[REMOTE_COMPONENT_STORE].set(key, component);\n}\n\nfunction getComponent(key: string): React.ReactNode | undefined {\n const component = self[REMOTE_COMPONENT_STORE]?.get(key);\n // remove the component from the store after retrieving it to prevent memory leaks\n // storing the HTML in the global store is only needed for SSR and it's temporary only used for a single render\n self[REMOTE_COMPONENT_STORE]?.delete(key);\n return component;\n}\n\n/**\n * Props for the Next.js Pages Router remote component host.\n *\n * Extends {@link ConsumeRemoteComponentConfig} with Pages Router–specific `bundle` and\n * `route` props used for SSR hydration.\n */\nexport interface ConsumeRemoteComponentProps\n extends ConsumeRemoteComponentConfig {\n /** The source URL of the remote component. Required for server rendering. */\n src: string | URL;\n /** The Webpack bundle name for the remote component. */\n bundle?: string;\n /** The page route of the remote component. */\n route?: string;\n /** Loading fallback content displayed while the remote component is being fetched. */\n children?: React.ReactNode;\n [REMOTE_COMPONENT_KEY]?: string;\n}\n\n/**\n * This component handles the rendering of remote microfrontends.\n *\n * @param props - The properties for the remote component.\n * @returns A React component that renders the remote component.\n */\nexport function ConsumeRemoteComponent(props: ConsumeRemoteComponentProps) {\n const remoteComponent =\n typeof document !== 'undefined'\n ? null\n : // retrieve the HTML from the global store\n getComponent(\n props[REMOTE_COMPONENT_KEY] ?? '__vercel_remote_component',\n );\n\n const src =\n typeof props.src === 'string' ? props.src : (props.src as URL).href;\n const resolveClientUrl = props.resolveClientUrl\n ? bindResolveClientUrl(props.resolveClientUrl, src)\n : undefined;\n const sharedResult = shared(props.bundle ?? 'default', resolveClientUrl);\n\n useEffect(() => {\n const clientSelf = globalThis as typeof globalThis & {\n __remote_component_shared__?: Record<string, () => Promise<unknown>>;\n };\n // eslint-disable-next-line camelcase\n clientSelf.__remote_component_shared__ = sharedResult;\n }, [sharedResult]);\n\n if (!props[REMOTE_COMPONENT_KEY]) {\n return (\n <ConsumeRemoteComponentReact\n isolate={props.isolate}\n mode={props.mode}\n name={props.name}\n onBeforeLoad={props.onBeforeLoad}\n onChange={props.onChange}\n onError={props.onError}\n onLoad={props.onLoad}\n onRequest={props.onRequest}\n onResponse={props.onResponse}\n resolveClientUrl={props.resolveClientUrl}\n reset={props.reset}\n shared={sharedResult}\n src={props.src}\n >\n {props.children}\n </ConsumeRemoteComponentReact>\n );\n }\n\n return (\n <ConsumeRemoteComponentReact\n isolate={props.isolate}\n mode={props.mode}\n name={props.name}\n onBeforeLoad={props.onBeforeLoad}\n onChange={props.onChange}\n onError={props.onError}\n onLoad={props.onLoad}\n onRequest={props.onRequest}\n onResponse={props.onResponse}\n resolveClientUrl={props.resolveClientUrl}\n reset={props.reset}\n shared={sharedResult}\n src={props.src}\n >\n {remoteComponent}\n </ConsumeRemoteComponentReact>\n );\n}\n\n/**\n * Fetches the remote component properties from the server. You need to pass these properties to the `<ConsumeRemoteComponent>` component to render the fetched remote component.\n *\n * @param src - The source URL of the remote component. When using the Vercel Microfrontends solution, you can use relative paths, e.g. `/nextjs-app-remote/components/header`. Absolute URLs are also supported.\n * @param headers - The HTTP headers used for supporting the Vercel Microfrontends proxy.\n * @returns The properties of the remote component.\n *\n * @example\n *\n * ```tsx\n * import { getRemoteComponentProps } from 'remote-components/next/host/pages';\n * import type { GetServerSideProps } from 'next';\n *\n * export const getServerSideProps: GetServerSideProps<PageProps> = async function getServerSideProps({ req }) {\n * const myRemoteComponent = await getConsumeRemoteComponentProps(\n * '/nextjs-app-remote/components/header',\n * req.headers,\n * );\n * return {\n * props: {\n * remoteComponents: {\n * myRemoteComponent,\n * },\n * },\n * };\n * }\n * ```\n */\nexport async function getConsumeRemoteComponentProps(\n src: string,\n options?: {\n /**\n * Called when a fetch request is made to retrieve the remote component payload.\n * Can be used to intercept requests, modify headers, or provide a custom response.\n */\n onRequest?: OnRequestHook;\n /**\n * Called after a fetch completes to retrieve the remote component payload.\n * Can be used to inspect the response (e.g., check for redirects) or transform it.\n */\n onResponse?: OnResponseHook;\n /**\n * The name of the exposed remote component. Used to identify the remote component\n * when multiple remote components are exposed on a page.\n */\n name?: string;\n },\n): Promise<ConsumeRemoteComponentProps> {\n if (typeof document !== 'undefined') {\n throw new RemoteComponentsError(\n '`getConsumeRemoteComponentProps()` can only be used on the server side.',\n );\n }\n\n const {\n metadata: { bundle, route },\n name,\n links,\n component,\n nextData,\n remoteShared,\n } = await fetchRemoteComponent(src, {\n rsc: true,\n ...options,\n });\n\n const props: ConsumeRemoteComponentProps = {\n src,\n bundle,\n name,\n route,\n };\n\n const key = getKey(props);\n\n // do not render the HTML in development mode when remote is using Next.js Pages Router\n // this behavior is emulating the Next.js Pages Router FOUC as the styles are only applied on the client when running in development mode\n if (nextData?.buildId !== 'development') {\n // store the HTML in a global store\n setComponent(\n key,\n <>\n <script\n data-remote-components-shared=\"\"\n id={`${name}_shared`}\n type=\"application/json\"\n >\n {JSON.stringify(remoteShared)}\n </script>\n {links.map((link) => (\n <link\n key={`${link.as}_${link.href}`}\n {...link}\n precedence={undefined}\n />\n ))}\n {component}\n </>,\n );\n }\n\n return {\n ...props,\n // add remote component key to the props\n [REMOTE_COMPONENT_KEY]: key,\n };\n}\n"],"mappings":"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","names":["import_react","_shared","ConsumeRemoteComponentReact"]}
@@ -1,18 +1,16 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { H as HostConfig, C as ClientHostConfig, a as HostLifecycleCallbacks } from '../../host-config-58cdccea.js';
3
- import { O as OnRequestHook, a as OnResponseHook } from '../../types-2b26a246.js';
4
- import '../../internal/shared/client/proxy-through-host.js';
5
- import 'parse5/dist/tree-adapters/default';
2
+ import { ConsumeRemoteComponentConfig } from '../../internal/host/shared/config.js';
3
+ import { OnRequestHook, OnResponseHook } from '../../internal/host/shared/fetch-interceptors.js';
4
+ import '../../internal/runtime/url/resolve-client-url.js';
6
5
 
7
6
  declare const REMOTE_COMPONENT_KEY = "__REMOTE_COMPONENT_KEY__";
8
7
  /**
9
8
  * Props for the Next.js Pages Router remote component host.
10
9
  *
11
- * Extends {@link HostConfig}, {@link ClientHostConfig}, and
12
- * {@link HostLifecycleCallbacks}. Adds Pages Router–specific `bundle` and
10
+ * Extends {@link ConsumeRemoteComponentConfig} with Pages Router–specific `bundle` and
13
11
  * `route` props used for SSR hydration.
14
12
  */
15
- interface RemoteComponentProps extends HostConfig, ClientHostConfig, HostLifecycleCallbacks {
13
+ interface ConsumeRemoteComponentProps extends ConsumeRemoteComponentConfig {
16
14
  /** The source URL of the remote component. Required for server rendering. */
17
15
  src: string | URL;
18
16
  /** The Webpack bundle name for the remote component. */
@@ -29,9 +27,9 @@ interface RemoteComponentProps extends HostConfig, ClientHostConfig, HostLifecyc
29
27
  * @param props - The properties for the remote component.
30
28
  * @returns A React component that renders the remote component.
31
29
  */
32
- declare function RemoteComponent(props: RemoteComponentProps): react_jsx_runtime.JSX.Element;
30
+ declare function ConsumeRemoteComponent(props: ConsumeRemoteComponentProps): react_jsx_runtime.JSX.Element;
33
31
  /**
34
- * Fetches the remote component properties from the server. You need to pass these properties to the `<RemoteComponent>` component to render the fetched remote component.
32
+ * Fetches the remote component properties from the server. You need to pass these properties to the `<ConsumeRemoteComponent>` component to render the fetched remote component.
35
33
  *
36
34
  * @param src - The source URL of the remote component. When using the Vercel Microfrontends solution, you can use relative paths, e.g. `/nextjs-app-remote/components/header`. Absolute URLs are also supported.
37
35
  * @param headers - The HTTP headers used for supporting the Vercel Microfrontends proxy.
@@ -44,7 +42,7 @@ declare function RemoteComponent(props: RemoteComponentProps): react_jsx_runtime
44
42
  * import type { GetServerSideProps } from 'next';
45
43
  *
46
44
  * export const getServerSideProps: GetServerSideProps<PageProps> = async function getServerSideProps({ req }) {
47
- * const myRemoteComponent = await getRemoteComponentProps(
45
+ * const myRemoteComponent = await getConsumeRemoteComponentProps(
48
46
  * '/nextjs-app-remote/components/header',
49
47
  * req.headers,
50
48
  * );
@@ -58,7 +56,7 @@ declare function RemoteComponent(props: RemoteComponentProps): react_jsx_runtime
58
56
  * }
59
57
  * ```
60
58
  */
61
- declare function getRemoteComponentProps(src: string, options?: {
59
+ declare function getConsumeRemoteComponentProps(src: string, options?: {
62
60
  /**
63
61
  * Called when a fetch request is made to retrieve the remote component payload.
64
62
  * Can be used to intercept requests, modify headers, or provide a custom response.
@@ -74,6 +72,6 @@ declare function getRemoteComponentProps(src: string, options?: {
74
72
  * when multiple remote components are exposed on a page.
75
73
  */
76
74
  name?: string;
77
- }): Promise<RemoteComponentProps>;
75
+ }): Promise<ConsumeRemoteComponentProps>;
78
76
 
79
- export { RemoteComponent, RemoteComponentProps, getRemoteComponentProps };
77
+ export { ConsumeRemoteComponent, ConsumeRemoteComponentProps, getConsumeRemoteComponentProps };