remote-components 0.1.0 → 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 (469) 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} +1270 -1201
  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} +1266 -1196
  22. package/dist/host/html.js.map +1 -0
  23. package/dist/{next/host/client/index.cjs → host/nextjs/app/client-only.cjs} +690 -518
  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} +693 -514
  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/host/nextjs/pages.d.ts +77 -0
  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/{internal/shared/client/proxy-through-host.cjs → host/proxy/client.cjs} +19 -13
  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} +552 -477
  58. package/dist/host/react.cjs.map +1 -0
  59. package/dist/host/react.d.ts +366 -0
  60. package/dist/{react/index.js → host/react.js} +551 -474
  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} +36 -29
  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} +27 -25
  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/internal/host/server/types.cjs +17 -0
  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/internal/host/shared/config.d.ts +100 -0
  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-cbe44b51.d.ts → internal/host/shared/fetch-interceptors.d.ts} +7 -73
  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/{next/remote/server.cjs → internal/host/shared/state.cjs} +16 -7
  161. package/dist/internal/host/shared/state.cjs.map +1 -0
  162. package/dist/internal/host/shared/state.d.ts +53 -0
  163. package/dist/internal/host/shared/state.js +14 -0
  164. package/dist/internal/host/shared/state.js.map +1 -0
  165. package/dist/internal/host/utils/resolve-name-from-src.cjs +40 -0
  166. package/dist/internal/host/utils/resolve-name-from-src.cjs.map +1 -0
  167. package/dist/internal/host/utils/resolve-name-from-src.d.ts +13 -0
  168. package/dist/internal/host/utils/resolve-name-from-src.js +16 -0
  169. package/dist/internal/host/utils/resolve-name-from-src.js.map +1 -0
  170. package/dist/internal/{next/remote/render-client.cjs → remote/nextjs/app-client.cjs} +8 -8
  171. package/dist/internal/remote/nextjs/app-client.cjs.map +1 -0
  172. package/dist/internal/{next/remote/render-client.js → remote/nextjs/app-client.js} +4 -4
  173. package/dist/internal/remote/nextjs/app-client.js.map +1 -0
  174. package/dist/internal/runtime/constants.cjs +50 -0
  175. package/dist/internal/runtime/constants.cjs.map +1 -0
  176. package/dist/internal/runtime/constants.d.ts +10 -0
  177. package/dist/internal/runtime/constants.js +20 -0
  178. package/dist/internal/runtime/constants.js.map +1 -0
  179. package/dist/internal/{shared/client → runtime/html}/apply-origin.cjs.map +1 -1
  180. package/dist/internal/{shared/client → runtime/html}/apply-origin.d.ts +1 -1
  181. package/dist/internal/{shared/client → runtime/html}/apply-origin.js.map +1 -1
  182. package/dist/internal/runtime/html/parse-remote-html.cjs +140 -0
  183. package/dist/internal/runtime/html/parse-remote-html.cjs.map +1 -0
  184. package/dist/internal/runtime/html/parse-remote-html.d.ts +88 -0
  185. package/dist/internal/runtime/html/parse-remote-html.js +110 -0
  186. package/dist/internal/runtime/html/parse-remote-html.js.map +1 -0
  187. package/dist/internal/runtime/html/set-attributes-from-props.cjs +68 -0
  188. package/dist/internal/runtime/html/set-attributes-from-props.cjs.map +1 -0
  189. package/dist/internal/runtime/html/set-attributes-from-props.d.ts +3 -0
  190. package/dist/internal/runtime/html/set-attributes-from-props.js +44 -0
  191. package/dist/internal/runtime/html/set-attributes-from-props.js.map +1 -0
  192. package/dist/internal/runtime/loaders/component-loader.cjs +184 -0
  193. package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -0
  194. package/dist/internal/runtime/loaders/component-loader.d.ts +31 -0
  195. package/dist/internal/runtime/loaders/component-loader.js +150 -0
  196. package/dist/internal/runtime/loaders/component-loader.js.map +1 -0
  197. package/dist/internal/runtime/loaders/script-loader.cjs +69 -0
  198. package/dist/internal/runtime/loaders/script-loader.cjs.map +1 -0
  199. package/dist/internal/runtime/loaders/script-loader.d.ts +10 -0
  200. package/dist/internal/runtime/loaders/script-loader.js +48 -0
  201. package/dist/internal/runtime/loaders/script-loader.js.map +1 -0
  202. package/dist/internal/runtime/loaders/static-loader.cjs +177 -0
  203. package/dist/internal/runtime/loaders/static-loader.cjs.map +1 -0
  204. package/dist/internal/runtime/loaders/static-loader.d.ts +10 -0
  205. package/dist/internal/runtime/loaders/static-loader.js +153 -0
  206. package/dist/internal/runtime/loaders/static-loader.js.map +1 -0
  207. package/dist/internal/runtime/metadata.cjs +17 -0
  208. package/dist/internal/runtime/metadata.cjs.map +1 -0
  209. package/dist/internal/runtime/metadata.d.ts +16 -0
  210. package/dist/internal/runtime/metadata.js +1 -0
  211. package/dist/internal/runtime/metadata.js.map +1 -0
  212. package/dist/internal/runtime/rsc.cjs +92 -0
  213. package/dist/internal/runtime/rsc.cjs.map +1 -0
  214. package/dist/internal/runtime/rsc.d.ts +8 -0
  215. package/dist/internal/runtime/rsc.js +68 -0
  216. package/dist/internal/runtime/rsc.js.map +1 -0
  217. package/dist/internal/runtime/turbopack/chunk-loader.cjs +244 -0
  218. package/dist/internal/runtime/turbopack/chunk-loader.cjs.map +1 -0
  219. package/dist/internal/runtime/turbopack/chunk-loader.d.ts +11 -0
  220. package/dist/internal/runtime/turbopack/chunk-loader.js +227 -0
  221. package/dist/internal/runtime/turbopack/chunk-loader.js.map +1 -0
  222. package/dist/internal/runtime/turbopack/module.cjs +257 -0
  223. package/dist/internal/runtime/turbopack/module.cjs.map +1 -0
  224. package/dist/internal/runtime/turbopack/module.d.ts +61 -0
  225. package/dist/internal/runtime/turbopack/module.js +233 -0
  226. package/dist/internal/runtime/turbopack/module.js.map +1 -0
  227. package/dist/internal/runtime/turbopack/patterns.cjs +44 -0
  228. package/dist/internal/runtime/turbopack/patterns.cjs.map +1 -0
  229. package/dist/internal/runtime/turbopack/patterns.d.ts +109 -0
  230. package/dist/internal/runtime/turbopack/patterns.js +15 -0
  231. package/dist/internal/runtime/turbopack/patterns.js.map +1 -0
  232. package/dist/internal/runtime/turbopack/shared-modules.cjs +152 -0
  233. package/dist/internal/runtime/turbopack/shared-modules.cjs.map +1 -0
  234. package/dist/internal/runtime/turbopack/shared-modules.d.ts +17 -0
  235. package/dist/internal/runtime/turbopack/shared-modules.js +133 -0
  236. package/dist/internal/runtime/turbopack/shared-modules.js.map +1 -0
  237. package/dist/internal/runtime/turbopack/webpack-runtime.cjs +137 -0
  238. package/dist/internal/runtime/turbopack/webpack-runtime.cjs.map +1 -0
  239. package/dist/internal/runtime/turbopack/webpack-runtime.d.ts +20 -0
  240. package/dist/internal/runtime/turbopack/webpack-runtime.js +107 -0
  241. package/dist/internal/runtime/turbopack/webpack-runtime.js.map +1 -0
  242. package/dist/internal/runtime/types.cjs +17 -0
  243. package/dist/internal/runtime/types.cjs.map +1 -0
  244. package/dist/internal/runtime/types.d.ts +40 -0
  245. package/dist/internal/runtime/types.js +1 -0
  246. package/dist/internal/runtime/types.js.map +1 -0
  247. package/dist/internal/{shared/client → runtime/url}/default-resolve-client-url.cjs +2 -2
  248. package/dist/internal/runtime/url/default-resolve-client-url.cjs.map +1 -0
  249. package/dist/internal/{shared/client → runtime/url}/default-resolve-client-url.d.ts +1 -1
  250. package/dist/internal/{shared/client → runtime/url}/default-resolve-client-url.js +1 -1
  251. package/dist/internal/runtime/url/default-resolve-client-url.js.map +1 -0
  252. package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.cjs +1 -1
  253. package/dist/internal/runtime/url/protected-rc-fallback.cjs.map +1 -0
  254. package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.js +1 -1
  255. package/dist/internal/runtime/url/protected-rc-fallback.js.map +1 -0
  256. package/dist/internal/runtime/url/resolve-client-url.cjs +45 -0
  257. package/dist/internal/runtime/url/resolve-client-url.cjs.map +1 -0
  258. package/dist/internal/{shared/client/proxy-through-host.d.ts → runtime/url/resolve-client-url.d.ts} +6 -25
  259. package/dist/internal/runtime/url/resolve-client-url.js +21 -0
  260. package/dist/internal/runtime/url/resolve-client-url.js.map +1 -0
  261. package/dist/internal/utils/abort.cjs.map +1 -0
  262. package/dist/internal/utils/abort.js.map +1 -0
  263. package/dist/internal/{shared → utils}/constants.cjs +3 -0
  264. package/dist/internal/utils/constants.cjs.map +1 -0
  265. package/dist/internal/utils/constants.d.ts +5 -0
  266. package/dist/internal/{shared → utils}/constants.js +2 -0
  267. package/dist/internal/utils/constants.js.map +1 -0
  268. package/dist/internal/{shared → utils}/error.cjs +4 -4
  269. package/dist/internal/utils/error.cjs.map +1 -0
  270. package/dist/internal/{shared → utils}/error.js +4 -4
  271. package/dist/internal/utils/error.js.map +1 -0
  272. package/dist/internal/{shared/utils → utils}/logger.cjs +3 -3
  273. package/dist/internal/utils/logger.cjs.map +1 -0
  274. package/dist/internal/{shared/utils → utils}/logger.d.ts +2 -2
  275. package/dist/internal/{shared/utils → utils}/logger.js +3 -3
  276. package/dist/internal/utils/logger.js.map +1 -0
  277. package/dist/internal/utils.cjs.map +1 -0
  278. package/dist/internal/utils.js.map +1 -0
  279. package/dist/{shared/host → remote/defaults}/app.cjs +2 -6
  280. package/dist/remote/defaults/app.cjs.map +1 -0
  281. package/dist/remote/defaults/app.js +8 -0
  282. package/dist/remote/defaults/app.js.map +1 -0
  283. package/dist/{shared/host → remote/defaults}/pages.cjs +2 -6
  284. package/dist/remote/defaults/pages.cjs.map +1 -0
  285. package/dist/remote/defaults/pages.js +8 -0
  286. package/dist/remote/defaults/pages.js.map +1 -0
  287. package/dist/{shared/remote → remote/defaults}/wrapper.cjs +12 -10
  288. package/dist/remote/defaults/wrapper.cjs.map +1 -0
  289. package/dist/remote/defaults/wrapper.js +27 -0
  290. package/dist/remote/defaults/wrapper.js.map +1 -0
  291. package/dist/{html/remote.cjs → remote/html.cjs} +16 -16
  292. package/dist/remote/html.cjs.map +1 -0
  293. package/dist/{html/remote.js → remote/html.js} +16 -16
  294. package/dist/remote/html.js.map +1 -0
  295. package/dist/{shared/remote/proxy.cjs → remote/middleware.cjs} +37 -12
  296. package/dist/remote/middleware.cjs.map +1 -0
  297. package/dist/remote/middleware.d.ts +27 -0
  298. package/dist/{shared/remote/proxy.js → remote/middleware.js} +32 -5
  299. package/dist/remote/middleware.js.map +1 -0
  300. package/dist/{internal/next/remote/render-server.cjs → remote/nextjs/app.cjs} +14 -16
  301. package/dist/remote/nextjs/app.cjs.map +1 -0
  302. package/dist/remote/nextjs/app.d.ts +45 -0
  303. package/dist/{internal/next/remote/render-server.js → remote/nextjs/app.js} +9 -11
  304. package/dist/remote/nextjs/app.js.map +1 -0
  305. package/dist/{next/remote/pages-router.cjs → remote/nextjs/pages.cjs} +8 -8
  306. package/dist/remote/nextjs/pages.cjs.map +1 -0
  307. package/dist/{next/remote/pages-router.d.ts → remote/nextjs/pages.d.ts} +8 -8
  308. package/dist/{next/remote/pages-router.js → remote/nextjs/pages.js} +4 -4
  309. package/dist/remote/nextjs/pages.js.map +1 -0
  310. package/dist/server-handoff-8c89b856.d.ts +46 -0
  311. package/package.json +126 -157
  312. package/dist/component-loader-76eb1b8b.d.ts +0 -200
  313. package/dist/html/host.cjs.map +0 -1
  314. package/dist/html/host.js.map +0 -1
  315. package/dist/html/remote.cjs.map +0 -1
  316. package/dist/html/remote.js.map +0 -1
  317. package/dist/internal/next/host/app-router-client.cjs.map +0 -1
  318. package/dist/internal/next/host/app-router-client.d.ts +0 -66
  319. package/dist/internal/next/host/app-router-client.js.map +0 -1
  320. package/dist/internal/next/host/app-router-compat.cjs.map +0 -1
  321. package/dist/internal/next/host/app-router-compat.js.map +0 -1
  322. package/dist/internal/next/host/remote-component-links.cjs.map +0 -1
  323. package/dist/internal/next/host/remote-component-links.js.map +0 -1
  324. package/dist/internal/next/remote/render-client.cjs.map +0 -1
  325. package/dist/internal/next/remote/render-client.js.map +0 -1
  326. package/dist/internal/next/remote/render-server.cjs.map +0 -1
  327. package/dist/internal/next/remote/render-server.d.ts +0 -47
  328. package/dist/internal/next/remote/render-server.js.map +0 -1
  329. package/dist/internal/react/context.cjs.map +0 -1
  330. package/dist/internal/react/context.js.map +0 -1
  331. package/dist/internal/react/hooks/use-resolve-client-url.cjs.map +0 -1
  332. package/dist/internal/react/hooks/use-resolve-client-url.js.map +0 -1
  333. package/dist/internal/shared/client/default-resolve-client-url.cjs.map +0 -1
  334. package/dist/internal/shared/client/default-resolve-client-url.js.map +0 -1
  335. package/dist/internal/shared/client/get-client-src.cjs.map +0 -1
  336. package/dist/internal/shared/client/get-client-src.js.map +0 -1
  337. package/dist/internal/shared/client/polyfill.cjs.map +0 -1
  338. package/dist/internal/shared/client/polyfill.js.map +0 -1
  339. package/dist/internal/shared/client/protected-rc-fallback.cjs.map +0 -1
  340. package/dist/internal/shared/client/protected-rc-fallback.js.map +0 -1
  341. package/dist/internal/shared/client/proxy-through-host.cjs.map +0 -1
  342. package/dist/internal/shared/client/proxy-through-host.js +0 -26
  343. package/dist/internal/shared/client/proxy-through-host.js.map +0 -1
  344. package/dist/internal/shared/client/remote-component.cjs +0 -1436
  345. package/dist/internal/shared/client/remote-component.cjs.map +0 -1
  346. package/dist/internal/shared/client/remote-component.d.ts +0 -62
  347. package/dist/internal/shared/client/remote-component.js +0 -1385
  348. package/dist/internal/shared/client/remote-component.js.map +0 -1
  349. package/dist/internal/shared/constants.cjs.map +0 -1
  350. package/dist/internal/shared/constants.d.ts +0 -4
  351. package/dist/internal/shared/constants.js.map +0 -1
  352. package/dist/internal/shared/error.cjs.map +0 -1
  353. package/dist/internal/shared/error.js.map +0 -1
  354. package/dist/internal/shared/ssr/dom-flight.cjs.map +0 -1
  355. package/dist/internal/shared/ssr/dom-flight.d.ts +0 -2
  356. package/dist/internal/shared/ssr/dom-flight.js.map +0 -1
  357. package/dist/internal/shared/ssr/fetch-headers.cjs.map +0 -1
  358. package/dist/internal/shared/ssr/fetch-headers.js.map +0 -1
  359. package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +0 -1
  360. package/dist/internal/shared/ssr/fetch-remote-component.js.map +0 -1
  361. package/dist/internal/shared/ssr/fetch-with-hooks.cjs.map +0 -1
  362. package/dist/internal/shared/ssr/fetch-with-hooks.d.ts +0 -56
  363. package/dist/internal/shared/ssr/fetch-with-hooks.js.map +0 -1
  364. package/dist/internal/shared/ssr/get-client-or-server-url.cjs.map +0 -1
  365. package/dist/internal/shared/ssr/get-client-or-server-url.js.map +0 -1
  366. package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.cjs.map +0 -1
  367. package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.js.map +0 -1
  368. package/dist/internal/shared/ssr/skeleton.cjs.map +0 -1
  369. package/dist/internal/shared/ssr/skeleton.js.map +0 -1
  370. package/dist/internal/shared/utils/abort.cjs.map +0 -1
  371. package/dist/internal/shared/utils/abort.js.map +0 -1
  372. package/dist/internal/shared/utils/logger.cjs.map +0 -1
  373. package/dist/internal/shared/utils/logger.js.map +0 -1
  374. package/dist/internal/shared/utils.cjs.map +0 -1
  375. package/dist/internal/shared/utils.js.map +0 -1
  376. package/dist/internal/webpack/next-client-pages-loader.cjs.map +0 -1
  377. package/dist/internal/webpack/next-client-pages-loader.js.map +0 -1
  378. package/dist/internal/webpack/shared-modules.cjs.map +0 -1
  379. package/dist/internal/webpack/shared-modules.js.map +0 -1
  380. package/dist/next/config.cjs.map +0 -1
  381. package/dist/next/config.js.map +0 -1
  382. package/dist/next/host/app-router-server.cjs.map +0 -1
  383. package/dist/next/host/app-router-server.d.ts +0 -60
  384. package/dist/next/host/app-router-server.js.map +0 -1
  385. package/dist/next/host/client/index.cjs.map +0 -1
  386. package/dist/next/host/client/index.d.ts +0 -19
  387. package/dist/next/host/client/index.js.map +0 -1
  388. package/dist/next/host/pages-router-client.cjs.map +0 -1
  389. package/dist/next/host/pages-router-client.d.ts +0 -56
  390. package/dist/next/host/pages-router-client.js.map +0 -1
  391. package/dist/next/host/pages-router-server.cjs.map +0 -1
  392. package/dist/next/host/pages-router-server.d.ts +0 -104
  393. package/dist/next/host/pages-router-server.js.map +0 -1
  394. package/dist/next/index.cjs +0 -53
  395. package/dist/next/index.cjs.map +0 -1
  396. package/dist/next/index.d.ts +0 -56
  397. package/dist/next/index.js +0 -19
  398. package/dist/next/index.js.map +0 -1
  399. package/dist/next/proxy.cjs.map +0 -1
  400. package/dist/next/proxy.d.ts +0 -56
  401. package/dist/next/proxy.js.map +0 -1
  402. package/dist/next/remote/pages-router.cjs.map +0 -1
  403. package/dist/next/remote/pages-router.js.map +0 -1
  404. package/dist/next/remote/server.cjs.map +0 -1
  405. package/dist/next/remote/server.d.ts +0 -1
  406. package/dist/next/remote/server.js +0 -5
  407. package/dist/next/remote/server.js.map +0 -1
  408. package/dist/proxy-through-host-a676a522.d.ts +0 -52
  409. package/dist/react/index.cjs.map +0 -1
  410. package/dist/react/index.d.ts +0 -123
  411. package/dist/react/index.js.map +0 -1
  412. package/dist/shared/host/app.cjs.map +0 -1
  413. package/dist/shared/host/app.js +0 -12
  414. package/dist/shared/host/app.js.map +0 -1
  415. package/dist/shared/host/pages.cjs.map +0 -1
  416. package/dist/shared/host/pages.js +0 -12
  417. package/dist/shared/host/pages.js.map +0 -1
  418. package/dist/shared/host/proxy.cjs.map +0 -1
  419. package/dist/shared/host/proxy.js.map +0 -1
  420. package/dist/shared/remote/app.cjs.map +0 -1
  421. package/dist/shared/remote/app.js +0 -8
  422. package/dist/shared/remote/app.js.map +0 -1
  423. package/dist/shared/remote/pages.cjs.map +0 -1
  424. package/dist/shared/remote/pages.js +0 -8
  425. package/dist/shared/remote/pages.js.map +0 -1
  426. package/dist/shared/remote/proxy.cjs.map +0 -1
  427. package/dist/shared/remote/proxy.d.ts +0 -44
  428. package/dist/shared/remote/proxy.js.map +0 -1
  429. package/dist/shared/remote/wrapper.cjs.map +0 -1
  430. package/dist/shared/remote/wrapper.js +0 -25
  431. package/dist/shared/remote/wrapper.js.map +0 -1
  432. package/dist/webpack.cjs.map +0 -1
  433. package/dist/webpack.js.map +0 -1
  434. /package/dist/{webpack.d.ts → config/webpack.d.ts} +0 -0
  435. /package/dist/{shared/host → host/defaults}/app.d.ts +0 -0
  436. /package/dist/{shared/host → host/defaults}/pages.d.ts +0 -0
  437. /package/dist/{shared/host/proxy.d.ts → host/proxy/protected-fetch.d.ts} +0 -0
  438. /package/dist/internal/{webpack/shared-modules.d.ts → config/webpack/apply-shared-modules.d.ts} +0 -0
  439. /package/dist/internal/{webpack → config/webpack}/next-client-pages-loader.d.ts +0 -0
  440. /package/dist/internal/{shared/ssr → host/nextjs}/dom-flight.cjs +0 -0
  441. /package/dist/internal/{shared/ssr → host/nextjs}/dom-flight.js +0 -0
  442. /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.cjs +0 -0
  443. /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.d.ts +0 -0
  444. /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.js +0 -0
  445. /package/dist/internal/{shared/ssr → host/server}/fetch-headers.cjs +0 -0
  446. /package/dist/internal/{shared/ssr → host/server}/fetch-headers.d.ts +0 -0
  447. /package/dist/internal/{shared/ssr → host/server}/fetch-headers.js +0 -0
  448. /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.cjs +0 -0
  449. /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.d.ts +0 -0
  450. /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.js +0 -0
  451. /package/dist/internal/{shared/client → host/server}/get-client-src.d.ts +0 -0
  452. /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.cjs +0 -0
  453. /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.d.ts +0 -0
  454. /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.js +0 -0
  455. /package/dist/internal/{next/remote/render-client.d.ts → remote/nextjs/app-client.d.ts} +0 -0
  456. /package/dist/internal/{shared/client → runtime/html}/apply-origin.cjs +0 -0
  457. /package/dist/internal/{shared/client → runtime/html}/apply-origin.js +0 -0
  458. /package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.d.ts +0 -0
  459. /package/dist/internal/{shared/utils → utils}/abort.cjs +0 -0
  460. /package/dist/internal/{shared/utils → utils}/abort.d.ts +0 -0
  461. /package/dist/internal/{shared/utils → utils}/abort.js +0 -0
  462. /package/dist/internal/{shared → utils}/error.d.ts +0 -0
  463. /package/dist/internal/{shared/utils.cjs → utils.cjs} +0 -0
  464. /package/dist/internal/{shared/utils.d.ts → utils.d.ts} +0 -0
  465. /package/dist/internal/{shared/utils.js → utils.js} +0 -0
  466. /package/dist/{shared/remote → remote/defaults}/app.d.ts +0 -0
  467. /package/dist/{shared/remote → remote/defaults}/pages.d.ts +0 -0
  468. /package/dist/{shared/remote → remote/defaults}/wrapper.d.ts +0 -0
  469. /package/dist/{html/remote.d.ts → remote/html.d.ts} +0 -0
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var webpack_runtime_exports = {};
30
+ __export(webpack_runtime_exports, {
31
+ setupWebpackRuntime: () => setupWebpackRuntime
32
+ });
33
+ module.exports = __toCommonJS(webpack_runtime_exports);
34
+ var import_constants = require("#internal/runtime/constants");
35
+ var import_error = require("#internal/utils/error");
36
+ var import_logger = require("#internal/utils/logger");
37
+ var import_chunk_loader = require("./chunk-loader");
38
+ var import_module = require("./module");
39
+ var import_shared_modules = require("./shared-modules");
40
+ async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}, resolveClientUrl) {
41
+ const self = globalThis;
42
+ if (!self.__remote_bundle_url__) {
43
+ self.__remote_bundle_url__ = {};
44
+ }
45
+ self.__remote_bundle_url__[bundle ?? "default"] = url;
46
+ self.__webpack_get_script_filename__ = () => null;
47
+ if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
48
+ if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
49
+ self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
50
+ self.__original_webpack_require__ = self.__webpack_require__;
51
+ }
52
+ self.__webpack_chunk_load__ = (0, import_chunk_loader.createChunkLoader)(runtime, resolveClientUrl);
53
+ self.__webpack_require__ = createModuleRequire(runtime);
54
+ self.__webpack_require_type__ = runtime;
55
+ if (self.__remote_webpack_require__ && runtime === import_constants.RUNTIME_TURBOPACK) {
56
+ const remoteBundle = bundle ?? "default";
57
+ self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
58
+ self.__remote_webpack_require__[remoteBundle].type = "turbopack";
59
+ }
60
+ }
61
+ if (runtime === import_constants.RUNTIME_TURBOPACK) {
62
+ await Promise.all(
63
+ scripts.map((script) => {
64
+ if (script.src) {
65
+ return self.__webpack_chunk_load__?.(script.src, bundle);
66
+ }
67
+ return Promise.resolve(void 0);
68
+ })
69
+ );
70
+ }
71
+ const coreShared = {
72
+ react: async () => (await import("react")).default,
73
+ "react-dom": async () => (await import("react-dom")).default,
74
+ "react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
75
+ "react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
76
+ "react-dom/client": async () => (await import("react-dom/client")).default,
77
+ ...shared
78
+ };
79
+ await (0, import_shared_modules.initializeSharedModules)(
80
+ bundle ?? "default",
81
+ // include all core modules as shared
82
+ coreShared,
83
+ remoteShared
84
+ );
85
+ }
86
+ function createModuleRequire(runtime) {
87
+ return (id) => {
88
+ const self = globalThis;
89
+ const { bundle, id: moduleId } = id.match(import_constants.REMOTE_COMPONENT_REGEX)?.groups ?? {
90
+ bundle: "default",
91
+ id
92
+ };
93
+ const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
94
+ (0, import_logger.logDebug)("WebpackRuntime", `remoteRuntime: "${remoteRuntime}"`);
95
+ try {
96
+ if (remoteRuntime === import_constants.RUNTIME_WEBPACK && bundle && moduleId) {
97
+ return self.__remote_webpack_require__?.[bundle]?.(moduleId);
98
+ }
99
+ const sharedModuleId = moduleId ?? id;
100
+ const sharedModule = (0, import_shared_modules.getSharedModule)(bundle ?? "default", sharedModuleId);
101
+ if (sharedModule) {
102
+ return sharedModule;
103
+ }
104
+ if (bundle && moduleId) {
105
+ return (0, import_module.handleTurbopackModule)(bundle, moduleId, id);
106
+ }
107
+ throw new Error(`Module "${id}" not found.`);
108
+ } catch (requireError) {
109
+ (0, import_logger.logWarn)(
110
+ "WebpackRuntime",
111
+ `Module require failed: ${String(requireError)}`
112
+ );
113
+ if (typeof self.__original_webpack_require__ !== "function") {
114
+ throw new import_error.RemoteComponentsError(
115
+ `Module "${id}" not found in remote component bundle "${bundle}".`,
116
+ {
117
+ cause: requireError instanceof Error ? requireError : void 0
118
+ }
119
+ );
120
+ }
121
+ try {
122
+ (0, import_logger.logDebug)("WebpackRuntime", "Falling back to original webpack require");
123
+ return self.__original_webpack_require__(id);
124
+ } catch (originalError) {
125
+ throw new import_error.RemoteComponentsError(
126
+ `Module "${id}" not found in remote component bundle "${bundle}".`,
127
+ { cause: originalError instanceof Error ? originalError : void 0 }
128
+ );
129
+ }
130
+ }
131
+ };
132
+ }
133
+ // Annotate the CommonJS export names for ESM import in node:
134
+ 0 && (module.exports = {
135
+ setupWebpackRuntime
136
+ });
137
+ //# sourceMappingURL=webpack-runtime.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/runtime/turbopack/webpack-runtime.ts"],"sourcesContent":["import type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport {\n REMOTE_COMPONENT_REGEX,\n RUNTIME_TURBOPACK,\n RUNTIME_WEBPACK,\n type Runtime,\n} from '#internal/runtime/constants';\nimport type { GlobalScope } from '#internal/runtime/types';\nimport { RemoteComponentsError } from '#internal/utils/error';\nimport { logDebug, logWarn } from '#internal/utils/logger';\nimport { createChunkLoader } from './chunk-loader';\nimport { handleTurbopackModule } from './module';\nimport { getSharedModule, initializeSharedModules } from './shared-modules';\n\n/**\n * Sets up webpack runtime environment for remote components.\n * This function initializes the global webpack require and chunk loading functions\n * to support loading and executing remote component bundles.\n *\n * @param runtime - The bundler runtime type ('webpack' or 'turbopack')\n * @param scripts - Initial script chunks to load for Turbopack runtime\n * @param url - Base URL for the remote component bundle\n * @param bundle - Bundle identifier (defaults to 'default')\n * @param shared - Host-provided shared modules (e.g., React)\n * @param remoteShared - Mapping of remote module IDs to shared module names\n */\nexport async function setupWebpackRuntime(\n runtime: Runtime,\n scripts: { src: string | null }[] = [],\n url: URL = new URL(location.href),\n bundle?: string,\n shared: Record<string, () => Promise<unknown>> = {},\n remoteShared: Record<string, string> = {},\n resolveClientUrl?: InternalResolveClientUrl,\n): Promise<void> {\n const self = globalThis as GlobalScope;\n\n if (!self.__remote_bundle_url__) {\n self.__remote_bundle_url__ = {};\n }\n self.__remote_bundle_url__[bundle ?? 'default'] = url;\n self.__webpack_get_script_filename__ = () => null;\n\n if (\n typeof self.__webpack_require__ !== 'function' ||\n self.__webpack_require_type__ !== 'turbopack'\n ) {\n // preserve original webpack functions for fallback\n if (\n !self.__original_webpack_require__ &&\n !self.__original_webpack_chunk_load__\n ) {\n self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;\n self.__original_webpack_require__ = self.__webpack_require__;\n }\n\n self.__webpack_chunk_load__ = createChunkLoader(runtime, resolveClientUrl);\n self.__webpack_require__ = createModuleRequire(runtime);\n self.__webpack_require_type__ = runtime;\n\n if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {\n const remoteBundle = bundle ?? 'default';\n self.__remote_webpack_require__[remoteBundle] =\n self.__webpack_require__ as (remoteId: string | number) => unknown;\n self.__remote_webpack_require__[remoteBundle].type = 'turbopack';\n }\n }\n\n // load all initial chunks when using Turbopack runtime\n if (runtime === RUNTIME_TURBOPACK) {\n await Promise.all(\n scripts.map((script) => {\n if (script.src) {\n return self.__webpack_chunk_load__?.(script.src, bundle);\n }\n return Promise.resolve(undefined);\n }),\n );\n }\n\n // initialize shared modules with core React dependencies\n const coreShared = {\n react: async () => (await import('react')).default,\n 'react-dom': async () => (await import('react-dom')).default,\n 'react/jsx-dev-runtime': async () =>\n (await import('react/jsx-dev-runtime')).default,\n 'react/jsx-runtime': async () =>\n (await import('react/jsx-runtime')).default,\n 'react-dom/client': async () => (await import('react-dom/client')).default,\n ...shared,\n };\n await initializeSharedModules(\n bundle ?? 'default',\n // include all core modules as shared\n coreShared,\n remoteShared,\n );\n}\n\n/**\n * Creates module require function for webpack runtime.\n * This function resolves module IDs to their exports, handling:\n * - Webpack remotes (pre-loaded bundles)\n * - Shared modules (React, etc.)\n * - Turbopack modules (dynamically loaded)\n */\nfunction createModuleRequire(runtime: Runtime): (id: string) => unknown {\n return (id: string) => {\n const self = globalThis as GlobalScope;\n const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)\n ?.groups ?? {\n bundle: 'default',\n id,\n };\n const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? 'default']\n ? self.__remote_webpack_require__[bundle ?? 'default']?.type || 'webpack'\n : runtime;\n\n logDebug('WebpackRuntime', `remoteRuntime: \"${remoteRuntime}\"`);\n\n try {\n // for webpack remotes, use the pre-loaded require function\n if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {\n return self.__remote_webpack_require__?.[bundle]?.(moduleId);\n }\n const sharedModuleId = moduleId ?? id;\n const sharedModule = getSharedModule(bundle ?? 'default', sharedModuleId);\n if (sharedModule) {\n return sharedModule;\n }\n if (bundle && moduleId) {\n return handleTurbopackModule(bundle, moduleId, id);\n }\n throw new Error(`Module \"${id}\" not found.`);\n } catch (requireError) {\n logWarn(\n 'WebpackRuntime',\n `Module require failed: ${String(requireError)}`,\n );\n if (typeof self.__original_webpack_require__ !== 'function') {\n throw new RemoteComponentsError(\n `Module \"${id}\" not found in remote component bundle \"${bundle}\".`,\n {\n cause: requireError instanceof Error ? requireError : undefined,\n },\n );\n }\n try {\n logDebug('WebpackRuntime', 'Falling back to original webpack require');\n return self.__original_webpack_require__(id);\n } catch (originalError) {\n throw new RemoteComponentsError(\n `Module \"${id}\" not found in remote component bundle \"${bundle}\".`,\n { cause: originalError instanceof Error ? originalError : undefined },\n );\n }\n }\n };\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,20 @@
1
+ import { InternalResolveClientUrl } from '../url/resolve-client-url.js';
2
+ import { Runtime } from '../constants.js';
3
+
4
+ /**
5
+ * Sets up webpack runtime environment for remote components.
6
+ * This function initializes the global webpack require and chunk loading functions
7
+ * to support loading and executing remote component bundles.
8
+ *
9
+ * @param runtime - The bundler runtime type ('webpack' or 'turbopack')
10
+ * @param scripts - Initial script chunks to load for Turbopack runtime
11
+ * @param url - Base URL for the remote component bundle
12
+ * @param bundle - Bundle identifier (defaults to 'default')
13
+ * @param shared - Host-provided shared modules (e.g., React)
14
+ * @param remoteShared - Mapping of remote module IDs to shared module names
15
+ */
16
+ declare function setupWebpackRuntime(runtime: Runtime, scripts?: {
17
+ src: string | null;
18
+ }[], url?: URL, bundle?: string, shared?: Record<string, () => Promise<unknown>>, remoteShared?: Record<string, string>, resolveClientUrl?: InternalResolveClientUrl): Promise<void>;
19
+
20
+ export { setupWebpackRuntime };
@@ -0,0 +1,107 @@
1
+ import {
2
+ REMOTE_COMPONENT_REGEX,
3
+ RUNTIME_TURBOPACK,
4
+ RUNTIME_WEBPACK
5
+ } from "#internal/runtime/constants";
6
+ import { RemoteComponentsError } from "#internal/utils/error";
7
+ import { logDebug, logWarn } from "#internal/utils/logger";
8
+ import { createChunkLoader } from "./chunk-loader";
9
+ import { handleTurbopackModule } from "./module";
10
+ import { getSharedModule, initializeSharedModules } from "./shared-modules";
11
+ async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}, resolveClientUrl) {
12
+ const self = globalThis;
13
+ if (!self.__remote_bundle_url__) {
14
+ self.__remote_bundle_url__ = {};
15
+ }
16
+ self.__remote_bundle_url__[bundle ?? "default"] = url;
17
+ self.__webpack_get_script_filename__ = () => null;
18
+ if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
19
+ if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
20
+ self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
21
+ self.__original_webpack_require__ = self.__webpack_require__;
22
+ }
23
+ self.__webpack_chunk_load__ = createChunkLoader(runtime, resolveClientUrl);
24
+ self.__webpack_require__ = createModuleRequire(runtime);
25
+ self.__webpack_require_type__ = runtime;
26
+ if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {
27
+ const remoteBundle = bundle ?? "default";
28
+ self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
29
+ self.__remote_webpack_require__[remoteBundle].type = "turbopack";
30
+ }
31
+ }
32
+ if (runtime === RUNTIME_TURBOPACK) {
33
+ await Promise.all(
34
+ scripts.map((script) => {
35
+ if (script.src) {
36
+ return self.__webpack_chunk_load__?.(script.src, bundle);
37
+ }
38
+ return Promise.resolve(void 0);
39
+ })
40
+ );
41
+ }
42
+ const coreShared = {
43
+ react: async () => (await import("react")).default,
44
+ "react-dom": async () => (await import("react-dom")).default,
45
+ "react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
46
+ "react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
47
+ "react-dom/client": async () => (await import("react-dom/client")).default,
48
+ ...shared
49
+ };
50
+ await initializeSharedModules(
51
+ bundle ?? "default",
52
+ // include all core modules as shared
53
+ coreShared,
54
+ remoteShared
55
+ );
56
+ }
57
+ function createModuleRequire(runtime) {
58
+ return (id) => {
59
+ const self = globalThis;
60
+ const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
61
+ bundle: "default",
62
+ id
63
+ };
64
+ const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
65
+ logDebug("WebpackRuntime", `remoteRuntime: "${remoteRuntime}"`);
66
+ try {
67
+ if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
68
+ return self.__remote_webpack_require__?.[bundle]?.(moduleId);
69
+ }
70
+ const sharedModuleId = moduleId ?? id;
71
+ const sharedModule = getSharedModule(bundle ?? "default", sharedModuleId);
72
+ if (sharedModule) {
73
+ return sharedModule;
74
+ }
75
+ if (bundle && moduleId) {
76
+ return handleTurbopackModule(bundle, moduleId, id);
77
+ }
78
+ throw new Error(`Module "${id}" not found.`);
79
+ } catch (requireError) {
80
+ logWarn(
81
+ "WebpackRuntime",
82
+ `Module require failed: ${String(requireError)}`
83
+ );
84
+ if (typeof self.__original_webpack_require__ !== "function") {
85
+ throw new RemoteComponentsError(
86
+ `Module "${id}" not found in remote component bundle "${bundle}".`,
87
+ {
88
+ cause: requireError instanceof Error ? requireError : void 0
89
+ }
90
+ );
91
+ }
92
+ try {
93
+ logDebug("WebpackRuntime", "Falling back to original webpack require");
94
+ return self.__original_webpack_require__(id);
95
+ } catch (originalError) {
96
+ throw new RemoteComponentsError(
97
+ `Module "${id}" not found in remote component bundle "${bundle}".`,
98
+ { cause: originalError instanceof Error ? originalError : void 0 }
99
+ );
100
+ }
101
+ }
102
+ };
103
+ }
104
+ export {
105
+ setupWebpackRuntime
106
+ };
107
+ //# sourceMappingURL=webpack-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/runtime/turbopack/webpack-runtime.ts"],"sourcesContent":["import type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport {\n REMOTE_COMPONENT_REGEX,\n RUNTIME_TURBOPACK,\n RUNTIME_WEBPACK,\n type Runtime,\n} from '#internal/runtime/constants';\nimport type { GlobalScope } from '#internal/runtime/types';\nimport { RemoteComponentsError } from '#internal/utils/error';\nimport { logDebug, logWarn } from '#internal/utils/logger';\nimport { createChunkLoader } from './chunk-loader';\nimport { handleTurbopackModule } from './module';\nimport { getSharedModule, initializeSharedModules } from './shared-modules';\n\n/**\n * Sets up webpack runtime environment for remote components.\n * This function initializes the global webpack require and chunk loading functions\n * to support loading and executing remote component bundles.\n *\n * @param runtime - The bundler runtime type ('webpack' or 'turbopack')\n * @param scripts - Initial script chunks to load for Turbopack runtime\n * @param url - Base URL for the remote component bundle\n * @param bundle - Bundle identifier (defaults to 'default')\n * @param shared - Host-provided shared modules (e.g., React)\n * @param remoteShared - Mapping of remote module IDs to shared module names\n */\nexport async function setupWebpackRuntime(\n runtime: Runtime,\n scripts: { src: string | null }[] = [],\n url: URL = new URL(location.href),\n bundle?: string,\n shared: Record<string, () => Promise<unknown>> = {},\n remoteShared: Record<string, string> = {},\n resolveClientUrl?: InternalResolveClientUrl,\n): Promise<void> {\n const self = globalThis as GlobalScope;\n\n if (!self.__remote_bundle_url__) {\n self.__remote_bundle_url__ = {};\n }\n self.__remote_bundle_url__[bundle ?? 'default'] = url;\n self.__webpack_get_script_filename__ = () => null;\n\n if (\n typeof self.__webpack_require__ !== 'function' ||\n self.__webpack_require_type__ !== 'turbopack'\n ) {\n // preserve original webpack functions for fallback\n if (\n !self.__original_webpack_require__ &&\n !self.__original_webpack_chunk_load__\n ) {\n self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;\n self.__original_webpack_require__ = self.__webpack_require__;\n }\n\n self.__webpack_chunk_load__ = createChunkLoader(runtime, resolveClientUrl);\n self.__webpack_require__ = createModuleRequire(runtime);\n self.__webpack_require_type__ = runtime;\n\n if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {\n const remoteBundle = bundle ?? 'default';\n self.__remote_webpack_require__[remoteBundle] =\n self.__webpack_require__ as (remoteId: string | number) => unknown;\n self.__remote_webpack_require__[remoteBundle].type = 'turbopack';\n }\n }\n\n // load all initial chunks when using Turbopack runtime\n if (runtime === RUNTIME_TURBOPACK) {\n await Promise.all(\n scripts.map((script) => {\n if (script.src) {\n return self.__webpack_chunk_load__?.(script.src, bundle);\n }\n return Promise.resolve(undefined);\n }),\n );\n }\n\n // initialize shared modules with core React dependencies\n const coreShared = {\n react: async () => (await import('react')).default,\n 'react-dom': async () => (await import('react-dom')).default,\n 'react/jsx-dev-runtime': async () =>\n (await import('react/jsx-dev-runtime')).default,\n 'react/jsx-runtime': async () =>\n (await import('react/jsx-runtime')).default,\n 'react-dom/client': async () => (await import('react-dom/client')).default,\n ...shared,\n };\n await initializeSharedModules(\n bundle ?? 'default',\n // include all core modules as shared\n coreShared,\n remoteShared,\n );\n}\n\n/**\n * Creates module require function for webpack runtime.\n * This function resolves module IDs to their exports, handling:\n * - Webpack remotes (pre-loaded bundles)\n * - Shared modules (React, etc.)\n * - Turbopack modules (dynamically loaded)\n */\nfunction createModuleRequire(runtime: Runtime): (id: string) => unknown {\n return (id: string) => {\n const self = globalThis as GlobalScope;\n const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)\n ?.groups ?? {\n bundle: 'default',\n id,\n };\n const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? 'default']\n ? self.__remote_webpack_require__[bundle ?? 'default']?.type || 'webpack'\n : runtime;\n\n logDebug('WebpackRuntime', `remoteRuntime: \"${remoteRuntime}\"`);\n\n try {\n // for webpack remotes, use the pre-loaded require function\n if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {\n return self.__remote_webpack_require__?.[bundle]?.(moduleId);\n }\n const sharedModuleId = moduleId ?? id;\n const sharedModule = getSharedModule(bundle ?? 'default', sharedModuleId);\n if (sharedModule) {\n return sharedModule;\n }\n if (bundle && moduleId) {\n return handleTurbopackModule(bundle, moduleId, id);\n }\n throw new Error(`Module \"${id}\" not found.`);\n } catch (requireError) {\n logWarn(\n 'WebpackRuntime',\n `Module require failed: ${String(requireError)}`,\n );\n if (typeof self.__original_webpack_require__ !== 'function') {\n throw new RemoteComponentsError(\n `Module \"${id}\" not found in remote component bundle \"${bundle}\".`,\n {\n cause: requireError instanceof Error ? requireError : undefined,\n },\n );\n }\n try {\n logDebug('WebpackRuntime', 'Falling back to original webpack require');\n return self.__original_webpack_require__(id);\n } catch (originalError) {\n throw new RemoteComponentsError(\n `Module \"${id}\" not found in remote component bundle \"${bundle}\".`,\n { cause: originalError instanceof Error ? originalError : undefined },\n );\n }\n }\n };\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,17 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
17
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/types.ts"],"sourcesContent":["import type { RemoteComponentMetadata } from '#internal/runtime/metadata';\n\nexport interface GlobalScope {\n __DISABLE_WEBPACK_EXEC__?: Record<string, boolean>;\n __webpack_chunk_load__?: (\n chunkId: string,\n scriptBundle?: string,\n ) => Promise<unknown> | undefined;\n __original_webpack_chunk_load__?: (\n chunkId: string,\n scriptBundle?: string,\n ) => Promise<unknown> | undefined;\n __webpack_require__?: (id: string) => unknown;\n __webpack_get_script_filename__?: (id: string) => string | null | undefined;\n __original_webpack_require__?: (id: string) => unknown;\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string | number) => unknown) & {\n c?: Record<\n string | number,\n { id: string; parents: string[]; children: string[] }\n >;\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n type?: 'turbopack' | 'webpack' | 'script';\n }\n >;\n __webpack_require_type__?: RemoteComponentMetadata['runtime'];\n __remote_shared_modules__?: Record<string, Record<string, unknown>>;\n __remote_bundle_url__?: Record<string, string | URL>;\n __remote_components_turbopack_chunk_loader_promise__?: Record<\n string,\n Promise<unknown>\n >;\n __remote_components_turbopack_modules__?: Record<\n string,\n Record<string, unknown>\n >;\n __remote_components_turbopack_global__?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\nexport interface LoaderResult {\n component: React.ReactNode;\n error?: Error;\n}\n\nexport type RSCKey = `__remote_component_rsc_${string}__`;\n\nexport type MountOrUnmountFunction = (\n el?: ShadowRoot | DocumentFragment | HTMLElement | HTMLCollection | null,\n) => Promise<void> | void;\n\nexport interface MountUnmountFunctions {\n __remote_script_entrypoint_mount__?: Record<\n string,\n Set<MountOrUnmountFunction>\n >;\n __remote_script_entrypoint_unmount__?: Record<\n string,\n Set<MountOrUnmountFunction>\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,40 @@
1
+ import { RemoteComponentMetadata } from './metadata.js';
2
+
3
+ interface GlobalScope {
4
+ __DISABLE_WEBPACK_EXEC__?: Record<string, boolean>;
5
+ __webpack_chunk_load__?: (chunkId: string, scriptBundle?: string) => Promise<unknown> | undefined;
6
+ __original_webpack_chunk_load__?: (chunkId: string, scriptBundle?: string) => Promise<unknown> | undefined;
7
+ __webpack_require__?: (id: string) => unknown;
8
+ __webpack_get_script_filename__?: (id: string) => string | null | undefined;
9
+ __original_webpack_require__?: (id: string) => unknown;
10
+ __remote_webpack_require__?: Record<string, ((remoteId: string | number) => unknown) & {
11
+ c?: Record<string | number, {
12
+ id: string;
13
+ parents: string[];
14
+ children: string[];
15
+ }>;
16
+ m?: Record<string | number, (module: {
17
+ exports: unknown;
18
+ }) => void>;
19
+ type?: 'turbopack' | 'webpack' | 'script';
20
+ }>;
21
+ __webpack_require_type__?: RemoteComponentMetadata['runtime'];
22
+ __remote_shared_modules__?: Record<string, Record<string, unknown>>;
23
+ __remote_bundle_url__?: Record<string, string | URL>;
24
+ __remote_components_turbopack_chunk_loader_promise__?: Record<string, Promise<unknown>>;
25
+ __remote_components_turbopack_modules__?: Record<string, Record<string, unknown>>;
26
+ __remote_components_turbopack_global__?: Record<string, unknown>;
27
+ [key: string]: unknown;
28
+ }
29
+ interface LoaderResult {
30
+ component: React.ReactNode;
31
+ error?: Error;
32
+ }
33
+ type RSCKey = `__remote_component_rsc_${string}__`;
34
+ type MountOrUnmountFunction = (el?: ShadowRoot | DocumentFragment | HTMLElement | HTMLCollection | null) => Promise<void> | void;
35
+ interface MountUnmountFunctions {
36
+ __remote_script_entrypoint_mount__?: Record<string, Set<MountOrUnmountFunction>>;
37
+ __remote_script_entrypoint_unmount__?: Record<string, Set<MountOrUnmountFunction>>;
38
+ }
39
+
40
+ export { GlobalScope, LoaderResult, MountOrUnmountFunction, MountUnmountFunctions, RSCKey };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -21,9 +21,9 @@ __export(default_resolve_client_url_exports, {
21
21
  bindResolveClientUrl: () => bindResolveClientUrl
22
22
  });
23
23
  module.exports = __toCommonJS(default_resolve_client_url_exports);
24
- var import_proxy_through_host = require("./proxy-through-host");
24
+ var import_resolve_client_url = require("./resolve-client-url");
25
25
  function bindResolveClientUrl(prop, remoteSrc) {
26
- return prop ? (0, import_proxy_through_host.withRemoteSrc)(prop, remoteSrc) : void 0;
26
+ return prop ? (0, import_resolve_client_url.withRemoteSrc)(prop, remoteSrc) : void 0;
27
27
  }
28
28
  // Annotate the CommonJS export names for ESM import in node:
29
29
  0 && (module.exports = {
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/runtime/url/default-resolve-client-url.ts"],"sourcesContent":["import {\n type InternalResolveClientUrl,\n type ResolveClientUrl,\n withRemoteSrc,\n} from './resolve-client-url';\n\nexport function bindResolveClientUrl(\n prop: ResolveClientUrl | undefined,\n remoteSrc: string,\n): InternalResolveClientUrl | undefined {\n return prop ? withRemoteSrc(prop, remoteSrc) : undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAIO;AAEA,SAAS,qBACd,MACA,WACsC;AACtC,SAAO,WAAO,yCAAc,MAAM,SAAS,IAAI;AACjD;","names":[]}
@@ -1,4 +1,4 @@
1
- import { ResolveClientUrl, InternalResolveClientUrl } from './proxy-through-host.js';
1
+ import { ResolveClientUrl, InternalResolveClientUrl } from './resolve-client-url.js';
2
2
 
3
3
  declare function bindResolveClientUrl(prop: ResolveClientUrl | undefined, remoteSrc: string): InternalResolveClientUrl | undefined;
4
4
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withRemoteSrc
3
- } from "./proxy-through-host";
3
+ } from "./resolve-client-url";
4
4
  function bindResolveClientUrl(prop, remoteSrc) {
5
5
  return prop ? withRemoteSrc(prop, remoteSrc) : void 0;
6
6
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/runtime/url/default-resolve-client-url.ts"],"sourcesContent":["import {\n type InternalResolveClientUrl,\n type ResolveClientUrl,\n withRemoteSrc,\n} from './resolve-client-url';\n\nexport function bindResolveClientUrl(\n prop: ResolveClientUrl | undefined,\n remoteSrc: string,\n): InternalResolveClientUrl | undefined {\n return prop ? withRemoteSrc(prop, remoteSrc) : undefined;\n}\n"],"mappings":"AAAA;AAAA,EAGE;AAAA,OACK;AAEA,SAAS,qBACd,MACA,WACsC;AACtC,SAAO,OAAO,cAAc,MAAM,SAAS,IAAI;AACjD;","names":[]}
@@ -22,7 +22,7 @@ __export(protected_rc_fallback_exports, {
22
22
  isProxiedUrl: () => isProxiedUrl
23
23
  });
24
24
  module.exports = __toCommonJS(protected_rc_fallback_exports);
25
- var import_constants = require("#internal/shared/constants");
25
+ var import_constants = require("#internal/utils/constants");
26
26
  function generateProtectedRcFallbackSrc(url) {
27
27
  return `${import_constants.RC_PROTECTED_REMOTE_FETCH_PATHNAME}?url=${encodeURIComponent(url)}`;
28
28
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/runtime/url/protected-rc-fallback.ts"],"sourcesContent":["import { RC_PROTECTED_REMOTE_FETCH_PATHNAME } from '#internal/utils/constants';\n\n/**\n * Generates a fallback URL that proxies the request through the host's protected remote fetch endpoint\n */\nexport function generateProtectedRcFallbackSrc(url: string): string {\n return `${RC_PROTECTED_REMOTE_FETCH_PATHNAME}?url=${encodeURIComponent(url)}`;\n}\n\nexport function isProxiedUrl(url: string): boolean {\n try {\n return (\n new URL(url, location.href).pathname ===\n RC_PROTECTED_REMOTE_FETCH_PATHNAME\n );\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAmD;AAK5C,SAAS,+BAA+B,KAAqB;AAClE,SAAO,GAAG,2DAA0C,mBAAmB,GAAG;AAC5E;AAEO,SAAS,aAAa,KAAsB;AACjD,MAAI;AACF,WACE,IAAI,IAAI,KAAK,SAAS,IAAI,EAAE,aAC5B;AAAA,EAEJ,QAAE;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,4 +1,4 @@
1
- import { RC_PROTECTED_REMOTE_FETCH_PATHNAME } from "#internal/shared/constants";
1
+ import { RC_PROTECTED_REMOTE_FETCH_PATHNAME } from "#internal/utils/constants";
2
2
  function generateProtectedRcFallbackSrc(url) {
3
3
  return `${RC_PROTECTED_REMOTE_FETCH_PATHNAME}?url=${encodeURIComponent(url)}`;
4
4
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/runtime/url/protected-rc-fallback.ts"],"sourcesContent":["import { RC_PROTECTED_REMOTE_FETCH_PATHNAME } from '#internal/utils/constants';\n\n/**\n * Generates a fallback URL that proxies the request through the host's protected remote fetch endpoint\n */\nexport function generateProtectedRcFallbackSrc(url: string): string {\n return `${RC_PROTECTED_REMOTE_FETCH_PATHNAME}?url=${encodeURIComponent(url)}`;\n}\n\nexport function isProxiedUrl(url: string): boolean {\n try {\n return (\n new URL(url, location.href).pathname ===\n RC_PROTECTED_REMOTE_FETCH_PATHNAME\n );\n } catch {\n return false;\n }\n}\n"],"mappings":"AAAA,SAAS,0CAA0C;AAK5C,SAAS,+BAA+B,KAAqB;AAClE,SAAO,GAAG,0CAA0C,mBAAmB,GAAG;AAC5E;AAEO,SAAS,aAAa,KAAsB;AACjD,MAAI;AACF,WACE,IAAI,IAAI,KAAK,SAAS,IAAI,EAAE,aAC5B;AAAA,EAEJ,QAAE;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,45 @@
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 resolve_client_url_exports = {};
20
+ __export(resolve_client_url_exports, {
21
+ withRemoteSrc: () => withRemoteSrc
22
+ });
23
+ module.exports = __toCommonJS(resolve_client_url_exports);
24
+ function withRemoteSrc(resolveClientUrl, remoteSrc) {
25
+ const remoteOrigin = parseOrigin(remoteSrc);
26
+ return (url) => {
27
+ const urlOrigin = parseOrigin(url);
28
+ if (remoteOrigin && urlOrigin && urlOrigin !== remoteOrigin) {
29
+ return void 0;
30
+ }
31
+ return resolveClientUrl(remoteSrc, url);
32
+ };
33
+ }
34
+ function parseOrigin(url) {
35
+ try {
36
+ return new URL(url).origin;
37
+ } catch {
38
+ return void 0;
39
+ }
40
+ }
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ withRemoteSrc
44
+ });
45
+ //# sourceMappingURL=resolve-client-url.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/runtime/url/resolve-client-url.ts"],"sourcesContent":["/**\n * Intercepts client-side URL resolution for remote component resources.\n * Called before each asset (script, stylesheet, chunk, module, image) is fetched.\n *\n * Return a new URL string to redirect the fetch (e.g., through a proxy),\n * or undefined to use the original URL.\n *\n * @param remoteSrc - The `src` of the remote component being loaded\n * @param url - The asset URL about to be fetched\n *\n * @example\n * // Proxy all assets from the remote's origin through the host\n * const resolveClientUrl = (remoteSrc, url) => {\n * const remoteOrigin = new URL(remoteSrc).origin;\n * const parsed = new URL(url);\n * if (parsed.origin !== location.origin && parsed.origin === remoteOrigin) {\n * return `/rc-fetch-protected-remote?url=${encodeURIComponent(url)}`;\n * }\n * };\n */\nexport type ResolveClientUrl = (\n remoteSrc: string,\n url: string,\n) => string | undefined;\n\n/**\n * Internal bound resolver — `ResolveClientUrl` with `remoteSrc` already applied.\n * Used by internal loaders that don't need to know the remote src.\n */\nexport type InternalResolveClientUrl = (url: string) => string | undefined;\n\n/**\n * Binds a `ResolveClientUrl` to a specific `remoteSrc`, producing an\n * `InternalResolveClientUrl` that only needs the asset URL.\n *\n * Only invokes the callback for URLs whose origin matches the remote\n * component's origin. Third-party scripts (e.g. `vercel.live` toolbar)\n * are left untouched. To proxy additional domains in the future, a\n * field or flag can be added to the host configuration.\n */\nexport function withRemoteSrc(\n resolveClientUrl: ResolveClientUrl,\n remoteSrc: string,\n): InternalResolveClientUrl {\n const remoteOrigin = parseOrigin(remoteSrc);\n return (url) => {\n const urlOrigin = parseOrigin(url);\n if (remoteOrigin && urlOrigin && urlOrigin !== remoteOrigin) {\n return undefined;\n }\n return resolveClientUrl(remoteSrc, url);\n };\n}\n\nfunction parseOrigin(url: string): string | undefined {\n try {\n return new URL(url).origin;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwCO,SAAS,cACd,kBACA,WAC0B;AAC1B,QAAM,eAAe,YAAY,SAAS;AAC1C,SAAO,CAAC,QAAQ;AACd,UAAM,YAAY,YAAY,GAAG;AACjC,QAAI,gBAAgB,aAAa,cAAc,cAAc;AAC3D,aAAO;AAAA,IACT;AACA,WAAO,iBAAiB,WAAW,GAAG;AAAA,EACxC;AACF;AAEA,SAAS,YAAY,KAAiC;AACpD,MAAI;AACF,WAAO,IAAI,IAAI,GAAG,EAAE;AAAA,EACtB,QAAE;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -27,31 +27,12 @@ type InternalResolveClientUrl = (url: string) => string | undefined;
27
27
  /**
28
28
  * Binds a `ResolveClientUrl` to a specific `remoteSrc`, producing an
29
29
  * `InternalResolveClientUrl` that only needs the asset URL.
30
- */
31
- declare function withRemoteSrc(resolveClientUrl: ResolveClientUrl, remoteSrc: string): InternalResolveClientUrl;
32
- /**
33
- * A `ResolveClientUrl` that proxies cross-origin asset URLs
34
- * through the host's protected remote fetch endpoint (`/rc-fetch-protected-remote`).
35
- * Same-origin URLs are left unchanged.
36
- *
37
- * On Vercel preview deployments, deployment protection blocks direct cross-origin
38
- * asset fetches. This function proxies those requests through the host so they
39
- * inherit the host's authentication cookies.
40
30
  *
41
- * Requires `withRemoteComponentsHost` middleware on the host to handle the
42
- * proxied requests. Configure `allowedProxyUrls` to restrict which URLs can
43
- * be proxied.
44
- *
45
- * @example
46
- * ```tsx
47
- * import { RemoteComponent, proxyClientRequestsThroughHost } from 'remote-components/react';
48
- *
49
- * <RemoteComponent
50
- * src="https://remote-app.com/components/header"
51
- * resolveClientUrl={proxyClientRequestsThroughHost}
52
- * />
53
- * ```
31
+ * Only invokes the callback for URLs whose origin matches the remote
32
+ * component's origin. Third-party scripts (e.g. `vercel.live` toolbar)
33
+ * are left untouched. To proxy additional domains in the future, a
34
+ * field or flag can be added to the host configuration.
54
35
  */
55
- declare const proxyClientRequestsThroughHost: ResolveClientUrl;
36
+ declare function withRemoteSrc(resolveClientUrl: ResolveClientUrl, remoteSrc: string): InternalResolveClientUrl;
56
37
 
57
- export { InternalResolveClientUrl, ResolveClientUrl, proxyClientRequestsThroughHost, withRemoteSrc };
38
+ export { InternalResolveClientUrl, ResolveClientUrl, withRemoteSrc };
@@ -0,0 +1,21 @@
1
+ function withRemoteSrc(resolveClientUrl, remoteSrc) {
2
+ const remoteOrigin = parseOrigin(remoteSrc);
3
+ return (url) => {
4
+ const urlOrigin = parseOrigin(url);
5
+ if (remoteOrigin && urlOrigin && urlOrigin !== remoteOrigin) {
6
+ return void 0;
7
+ }
8
+ return resolveClientUrl(remoteSrc, url);
9
+ };
10
+ }
11
+ function parseOrigin(url) {
12
+ try {
13
+ return new URL(url).origin;
14
+ } catch {
15
+ return void 0;
16
+ }
17
+ }
18
+ export {
19
+ withRemoteSrc
20
+ };
21
+ //# sourceMappingURL=resolve-client-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/runtime/url/resolve-client-url.ts"],"sourcesContent":["/**\n * Intercepts client-side URL resolution for remote component resources.\n * Called before each asset (script, stylesheet, chunk, module, image) is fetched.\n *\n * Return a new URL string to redirect the fetch (e.g., through a proxy),\n * or undefined to use the original URL.\n *\n * @param remoteSrc - The `src` of the remote component being loaded\n * @param url - The asset URL about to be fetched\n *\n * @example\n * // Proxy all assets from the remote's origin through the host\n * const resolveClientUrl = (remoteSrc, url) => {\n * const remoteOrigin = new URL(remoteSrc).origin;\n * const parsed = new URL(url);\n * if (parsed.origin !== location.origin && parsed.origin === remoteOrigin) {\n * return `/rc-fetch-protected-remote?url=${encodeURIComponent(url)}`;\n * }\n * };\n */\nexport type ResolveClientUrl = (\n remoteSrc: string,\n url: string,\n) => string | undefined;\n\n/**\n * Internal bound resolver — `ResolveClientUrl` with `remoteSrc` already applied.\n * Used by internal loaders that don't need to know the remote src.\n */\nexport type InternalResolveClientUrl = (url: string) => string | undefined;\n\n/**\n * Binds a `ResolveClientUrl` to a specific `remoteSrc`, producing an\n * `InternalResolveClientUrl` that only needs the asset URL.\n *\n * Only invokes the callback for URLs whose origin matches the remote\n * component's origin. Third-party scripts (e.g. `vercel.live` toolbar)\n * are left untouched. To proxy additional domains in the future, a\n * field or flag can be added to the host configuration.\n */\nexport function withRemoteSrc(\n resolveClientUrl: ResolveClientUrl,\n remoteSrc: string,\n): InternalResolveClientUrl {\n const remoteOrigin = parseOrigin(remoteSrc);\n return (url) => {\n const urlOrigin = parseOrigin(url);\n if (remoteOrigin && urlOrigin && urlOrigin !== remoteOrigin) {\n return undefined;\n }\n return resolveClientUrl(remoteSrc, url);\n };\n}\n\nfunction parseOrigin(url: string): string | undefined {\n try {\n return new URL(url).origin;\n } catch {\n return undefined;\n }\n}\n"],"mappings":"AAwCO,SAAS,cACd,kBACA,WAC0B;AAC1B,QAAM,eAAe,YAAY,SAAS;AAC1C,SAAO,CAAC,QAAQ;AACd,UAAM,YAAY,YAAY,GAAG;AACjC,QAAI,gBAAgB,aAAa,cAAc,cAAc;AAC3D,aAAO;AAAA,IACT;AACA,WAAO,iBAAiB,WAAW,GAAG;AAAA,EACxC;AACF;AAEA,SAAS,YAAY,KAAiC;AACpD,MAAI;AACF,WAAO,IAAI,IAAI,GAAG,EAAE;AAAA,EACtB,QAAE;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/abort.ts"],"sourcesContent":["/**\n * Type guard to check if an error is an AbortError.\n * Handles cross-environment differences (Node.js, browsers, JSDOM).\n */\nexport function isAbortError(error: unknown): error is DOMException {\n if (error instanceof DOMException && error.name === 'AbortError') {\n return true;\n }\n\n // Handle Node.js native AbortError which may not be instanceof global DOMException\n if (\n error !== null &&\n typeof error === 'object' &&\n 'name' in error &&\n error.name === 'AbortError' &&\n 'message' in error &&\n typeof (error as { message: unknown }).message === 'string'\n ) {\n // Additional check: verify it has DOMException-like structure\n const e = error as { code?: unknown; constructor?: { name?: string } };\n return typeof e.code === 'number' || e.constructor?.name === 'DOMException';\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,aAAa,OAAuC;AAClE,MAAI,iBAAiB,gBAAgB,MAAM,SAAS,cAAc;AAChE,WAAO;AAAA,EACT;AAGA,MACE,UAAU,QACV,OAAO,UAAU,YACjB,UAAU,SACV,MAAM,SAAS,gBACf,aAAa,SACb,OAAQ,MAA+B,YAAY,UACnD;AAEA,UAAM,IAAI;AACV,WAAO,OAAO,EAAE,SAAS,YAAY,EAAE,aAAa,SAAS;AAAA,EAC/D;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/abort.ts"],"sourcesContent":["/**\n * Type guard to check if an error is an AbortError.\n * Handles cross-environment differences (Node.js, browsers, JSDOM).\n */\nexport function isAbortError(error: unknown): error is DOMException {\n if (error instanceof DOMException && error.name === 'AbortError') {\n return true;\n }\n\n // Handle Node.js native AbortError which may not be instanceof global DOMException\n if (\n error !== null &&\n typeof error === 'object' &&\n 'name' in error &&\n error.name === 'AbortError' &&\n 'message' in error &&\n typeof (error as { message: unknown }).message === 'string'\n ) {\n // Additional check: verify it has DOMException-like structure\n const e = error as { code?: unknown; constructor?: { name?: string } };\n return typeof e.code === 'number' || e.constructor?.name === 'DOMException';\n }\n\n return false;\n}\n"],"mappings":"AAIO,SAAS,aAAa,OAAuC;AAClE,MAAI,iBAAiB,gBAAgB,MAAM,SAAS,cAAc;AAChE,WAAO;AAAA,EACT;AAGA,MACE,UAAU,QACV,OAAO,UAAU,YACjB,UAAU,SACV,MAAM,SAAS,gBACf,aAAa,SACb,OAAQ,MAA+B,YAAY,UACnD;AAEA,UAAM,IAAI;AACV,WAAO,OAAO,EAAE,SAAS,YAAY,EAAE,aAAa,SAAS;AAAA,EAC/D;AAEA,SAAO;AACT;","names":[]}
@@ -19,14 +19,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var constants_exports = {};
20
20
  __export(constants_exports, {
21
21
  CORS_DOCS_URL: () => CORS_DOCS_URL,
22
+ MISSING_SHARED_MODULES_MESSAGE: () => MISSING_SHARED_MODULES_MESSAGE,
22
23
  RC_PROTECTED_REMOTE_FETCH_PATHNAME: () => RC_PROTECTED_REMOTE_FETCH_PATHNAME
23
24
  });
24
25
  module.exports = __toCommonJS(constants_exports);
25
26
  const RC_PROTECTED_REMOTE_FETCH_PATHNAME = "/rc-fetch-protected-remote";
27
+ const MISSING_SHARED_MODULES_MESSAGE = "Remote Components shared modules not found. Did you forget to wrap your config with `withRemoteComponentsConfig` on both host and remote?";
26
28
  const CORS_DOCS_URL = "https://vercel.com/docs/remote-components/concepts/cors-external-urls#accessing-cross-site-protected-remote-components";
27
29
  // Annotate the CommonJS export names for ESM import in node:
28
30
  0 && (module.exports = {
29
31
  CORS_DOCS_URL,
32
+ MISSING_SHARED_MODULES_MESSAGE,
30
33
  RC_PROTECTED_REMOTE_FETCH_PATHNAME
31
34
  });
32
35
  //# sourceMappingURL=constants.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/constants.ts"],"sourcesContent":["export const RC_PROTECTED_REMOTE_FETCH_PATHNAME = '/rc-fetch-protected-remote';\n\nexport const MISSING_SHARED_MODULES_MESSAGE =\n 'Remote Components shared modules not found. Did you forget to wrap your config with `withRemoteComponentsConfig` on both host and remote?';\n\nexport const CORS_DOCS_URL =\n 'https://vercel.com/docs/remote-components/concepts/cors-external-urls#accessing-cross-site-protected-remote-components';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,qCAAqC;AAE3C,MAAM,iCACX;AAEK,MAAM,gBACX;","names":[]}
@@ -0,0 +1,5 @@
1
+ declare const RC_PROTECTED_REMOTE_FETCH_PATHNAME = "/rc-fetch-protected-remote";
2
+ declare const MISSING_SHARED_MODULES_MESSAGE = "Remote Components shared modules not found. Did you forget to wrap your config with `withRemoteComponentsConfig` on both host and remote?";
3
+ declare const CORS_DOCS_URL = "https://vercel.com/docs/remote-components/concepts/cors-external-urls#accessing-cross-site-protected-remote-components";
4
+
5
+ export { CORS_DOCS_URL, MISSING_SHARED_MODULES_MESSAGE, RC_PROTECTED_REMOTE_FETCH_PATHNAME };
@@ -1,7 +1,9 @@
1
1
  const RC_PROTECTED_REMOTE_FETCH_PATHNAME = "/rc-fetch-protected-remote";
2
+ const MISSING_SHARED_MODULES_MESSAGE = "Remote Components shared modules not found. Did you forget to wrap your config with `withRemoteComponentsConfig` on both host and remote?";
2
3
  const CORS_DOCS_URL = "https://vercel.com/docs/remote-components/concepts/cors-external-urls#accessing-cross-site-protected-remote-components";
3
4
  export {
4
5
  CORS_DOCS_URL,
6
+ MISSING_SHARED_MODULES_MESSAGE,
5
7
  RC_PROTECTED_REMOTE_FETCH_PATHNAME
6
8
  };
7
9
  //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/constants.ts"],"sourcesContent":["export const RC_PROTECTED_REMOTE_FETCH_PATHNAME = '/rc-fetch-protected-remote';\n\nexport const MISSING_SHARED_MODULES_MESSAGE =\n 'Remote Components shared modules not found. Did you forget to wrap your config with `withRemoteComponentsConfig` on both host and remote?';\n\nexport const CORS_DOCS_URL =\n 'https://vercel.com/docs/remote-components/concepts/cors-external-urls#accessing-cross-site-protected-remote-components';\n"],"mappings":"AAAO,MAAM,qCAAqC;AAE3C,MAAM,iCACX;AAEK,MAAM,gBACX;","names":[]}