@agegr/pi-web 0.3.2 → 0.3.4

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 (259) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +4 -4
  3. package/.next/build-manifest.json +13 -14
  4. package/.next/next-minimal-server.js.nft.json +1 -1
  5. package/.next/next-server.js.nft.json +1 -1
  6. package/.next/react-loadable-manifest.json +8 -0
  7. package/.next/required-server-files.js +2 -0
  8. package/.next/required-server-files.json +2 -0
  9. package/.next/server/app/_global-error/page.js +32 -10
  10. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  11. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -3
  12. package/.next/server/app/_global-error.html +1 -1
  13. package/.next/server/app/_global-error.meta +2 -1
  14. package/.next/server/app/_global-error.rsc +8 -9
  15. package/.next/server/app/_global-error.segments/_full.segment.rsc +8 -9
  16. package/.next/server/app/_global-error.segments/{__PAGE__.segment.rsc → _global-error/__PAGE__.segment.rsc} +2 -2
  17. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +5 -0
  18. package/.next/server/app/_global-error.segments/_head.segment.rsc +3 -4
  19. package/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  20. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  21. package/.next/server/app/_not-found/page.js +2 -13
  22. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  23. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -3
  24. package/.next/server/app/_not-found.html +1 -1
  25. package/.next/server/app/_not-found.rsc +10 -10
  26. package/.next/server/app/_not-found.segments/_full.segment.rsc +10 -10
  27. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  28. package/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  29. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  30. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  31. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  32. package/.next/server/app/api/agent/[id]/events/route.js +6 -6
  33. package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
  34. package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +1 -3
  35. package/.next/server/app/api/agent/[id]/route.js +4 -7
  36. package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
  37. package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +1 -3
  38. package/.next/server/app/api/agent/new/route.js +2 -7
  39. package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
  40. package/.next/server/app/api/agent/new/route_client-reference-manifest.js +1 -3
  41. package/.next/server/app/api/files/[...path]/route.js +3 -7
  42. package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -1
  43. package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +1 -3
  44. package/.next/server/app/api/models/route.js +3 -6
  45. package/.next/server/app/api/models/route.js.nft.json +1 -1
  46. package/.next/server/app/api/models/route_client-reference-manifest.js +1 -3
  47. package/.next/server/app/api/models-config/route.js +1 -7
  48. package/.next/server/app/api/models-config/route.js.nft.json +1 -1
  49. package/.next/server/app/api/models-config/route_client-reference-manifest.js +1 -3
  50. package/.next/server/app/api/sessions/[id]/context/route.js +3 -7
  51. package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
  52. package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +1 -3
  53. package/.next/server/app/api/sessions/[id]/route.js +3 -7
  54. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  55. package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -3
  56. package/.next/server/app/api/sessions/new/route.js +1 -6
  57. package/.next/server/app/api/sessions/new/route.js.nft.json +1 -1
  58. package/.next/server/app/api/sessions/new/route_client-reference-manifest.js +1 -3
  59. package/.next/server/app/api/sessions/route.js +3 -7
  60. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  61. package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -3
  62. package/.next/server/app/favicon.ico/route.js +1 -8
  63. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  64. package/.next/server/app/index.html +1 -1
  65. package/.next/server/app/index.rsc +11 -11
  66. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  67. package/.next/server/app/index.segments/_full.segment.rsc +11 -11
  68. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  69. package/.next/server/app/index.segments/_index.segment.rsc +4 -4
  70. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  71. package/.next/server/app/page.js +2 -14
  72. package/.next/server/app/page.js.nft.json +1 -1
  73. package/.next/server/app/page_client-reference-manifest.js +1 -3
  74. package/.next/server/app-paths-manifest.json +4 -4
  75. package/.next/server/chunks/573.js +3 -0
  76. package/.next/server/chunks/63.js +45 -0
  77. package/.next/server/chunks/65.js +1 -0
  78. package/.next/server/chunks/741.js +18 -0
  79. package/.next/server/chunks/813.js +1 -0
  80. package/.next/server/chunks/918.js +1 -0
  81. package/.next/server/middleware-build-manifest.js +1 -21
  82. package/.next/server/middleware-manifest.json +2 -2
  83. package/.next/server/middleware-react-loadable-manifest.js +1 -0
  84. package/.next/server/next-font-manifest.js +1 -1
  85. package/.next/server/next-font-manifest.json +1 -6
  86. package/.next/server/pages/404.html +1 -1
  87. package/.next/server/pages/500.html +1 -1
  88. package/.next/server/server-reference-manifest.js +1 -1
  89. package/.next/server/server-reference-manifest.json +1 -5
  90. package/.next/server/webpack-runtime.js +1 -0
  91. package/.next/static/4kp7if2lGqkmV9DEGzfXZ/_buildManifest.js +1 -0
  92. package/.next/static/chunks/110-fff6e5d8c205420b.js +1 -0
  93. package/.next/static/chunks/451.1247b87def61e309.js +1 -0
  94. package/.next/static/chunks/4bd1b696-215e5051988c3dde.js +1 -0
  95. package/.next/static/chunks/794-4d0b7b700451cc43.js +32 -0
  96. package/.next/static/chunks/app/_global-error/page-957de1f71e826217.js +1 -0
  97. package/.next/static/chunks/app/_not-found/page-e294ec8de846ea31.js +1 -0
  98. package/.next/static/chunks/app/api/agent/[id]/events/route-957de1f71e826217.js +1 -0
  99. package/.next/static/chunks/app/api/agent/[id]/route-957de1f71e826217.js +1 -0
  100. package/.next/static/chunks/app/api/agent/new/route-957de1f71e826217.js +1 -0
  101. package/.next/static/chunks/app/api/files/[...path]/route-957de1f71e826217.js +1 -0
  102. package/.next/static/chunks/app/api/models/route-957de1f71e826217.js +1 -0
  103. package/.next/static/chunks/app/api/models-config/route-957de1f71e826217.js +1 -0
  104. package/.next/static/chunks/app/api/sessions/[id]/context/route-957de1f71e826217.js +1 -0
  105. package/.next/static/chunks/app/api/sessions/[id]/route-957de1f71e826217.js +1 -0
  106. package/.next/static/chunks/app/api/sessions/new/route-957de1f71e826217.js +1 -0
  107. package/.next/static/chunks/app/api/sessions/route-957de1f71e826217.js +1 -0
  108. package/.next/static/chunks/app/layout-7c348314be580c6a.js +1 -0
  109. package/.next/static/chunks/app/page-bb92671a9b83a367.js +1 -0
  110. package/.next/static/chunks/framework-93cda6578f6c76ec.js +1 -0
  111. package/.next/static/chunks/main-0525ed1bd1807a80.js +5 -0
  112. package/.next/static/chunks/main-app-bd11c9df37a8ab8e.js +1 -0
  113. package/.next/static/chunks/next/dist/client/components/builtin/app-error-957de1f71e826217.js +1 -0
  114. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-957de1f71e826217.js +1 -0
  115. package/.next/static/chunks/next/dist/client/components/builtin/global-error-0dd2035d6f688008.js +1 -0
  116. package/.next/static/chunks/next/dist/client/components/builtin/not-found-957de1f71e826217.js +1 -0
  117. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-957de1f71e826217.js +1 -0
  118. package/.next/static/chunks/webpack-f15a3bb2c3a9cba9.js +1 -0
  119. package/.next/static/css/db181498dfd5fef0.css +1 -0
  120. package/.next/trace +3 -1
  121. package/.next/trace-build +1 -1
  122. package/.next/types/app/api/agent/[id]/events/route.ts +351 -0
  123. package/.next/types/app/api/agent/[id]/route.ts +351 -0
  124. package/.next/types/app/api/agent/new/route.ts +351 -0
  125. package/.next/types/app/api/files/[...path]/route.ts +351 -0
  126. package/.next/types/app/api/models/route.ts +351 -0
  127. package/.next/types/app/api/models-config/route.ts +351 -0
  128. package/.next/types/app/api/sessions/[id]/context/route.ts +351 -0
  129. package/.next/types/app/api/sessions/[id]/route.ts +351 -0
  130. package/.next/types/app/api/sessions/new/route.ts +351 -0
  131. package/.next/types/app/api/sessions/route.ts +351 -0
  132. package/.next/types/app/layout.ts +87 -0
  133. package/.next/types/app/page.ts +87 -0
  134. package/.next/types/package.json +1 -0
  135. package/package.json +2 -2
  136. package/.next/build/chunks/[root-of-the-server]__0d-m0h0._.js +0 -206
  137. package/.next/build/chunks/[root-of-the-server]__0ubbtyl._.js +0 -500
  138. package/.next/build/chunks/[turbopack-node]_transforms_postcss_ts_06e.r3r._.js +0 -13
  139. package/.next/build/chunks/[turbopack]_runtime.js +0 -890
  140. package/.next/build/chunks/node_modules_13sb.px._.js +0 -6765
  141. package/.next/build/package.json +0 -1
  142. package/.next/build/postcss.js +0 -6
  143. package/.next/diagnostics/route-bundle-stats.json +0 -28
  144. package/.next/fallback-build-manifest.json +0 -13
  145. package/.next/server/app/_global-error/page/app-paths-manifest.json +0 -3
  146. package/.next/server/app/_global-error/page/build-manifest.json +0 -17
  147. package/.next/server/app/_global-error/page/next-font-manifest.json +0 -6
  148. package/.next/server/app/_global-error/page/react-loadable-manifest.json +0 -1
  149. package/.next/server/app/_global-error/page/server-reference-manifest.json +0 -4
  150. package/.next/server/app/_not-found/page/app-paths-manifest.json +0 -3
  151. package/.next/server/app/_not-found/page/build-manifest.json +0 -17
  152. package/.next/server/app/_not-found/page/next-font-manifest.json +0 -6
  153. package/.next/server/app/_not-found/page/react-loadable-manifest.json +0 -1
  154. package/.next/server/app/_not-found/page/server-reference-manifest.json +0 -4
  155. package/.next/server/app/api/agent/[id]/events/route/app-paths-manifest.json +0 -3
  156. package/.next/server/app/api/agent/[id]/events/route/build-manifest.json +0 -9
  157. package/.next/server/app/api/agent/[id]/events/route/server-reference-manifest.json +0 -4
  158. package/.next/server/app/api/agent/[id]/route/app-paths-manifest.json +0 -3
  159. package/.next/server/app/api/agent/[id]/route/build-manifest.json +0 -9
  160. package/.next/server/app/api/agent/[id]/route/server-reference-manifest.json +0 -4
  161. package/.next/server/app/api/agent/new/route/app-paths-manifest.json +0 -3
  162. package/.next/server/app/api/agent/new/route/build-manifest.json +0 -9
  163. package/.next/server/app/api/agent/new/route/server-reference-manifest.json +0 -4
  164. package/.next/server/app/api/files/[...path]/route/app-paths-manifest.json +0 -3
  165. package/.next/server/app/api/files/[...path]/route/build-manifest.json +0 -9
  166. package/.next/server/app/api/files/[...path]/route/server-reference-manifest.json +0 -4
  167. package/.next/server/app/api/models/route/app-paths-manifest.json +0 -3
  168. package/.next/server/app/api/models/route/build-manifest.json +0 -9
  169. package/.next/server/app/api/models/route/server-reference-manifest.json +0 -4
  170. package/.next/server/app/api/models-config/route/app-paths-manifest.json +0 -3
  171. package/.next/server/app/api/models-config/route/build-manifest.json +0 -9
  172. package/.next/server/app/api/models-config/route/server-reference-manifest.json +0 -4
  173. package/.next/server/app/api/sessions/[id]/context/route/app-paths-manifest.json +0 -3
  174. package/.next/server/app/api/sessions/[id]/context/route/build-manifest.json +0 -9
  175. package/.next/server/app/api/sessions/[id]/context/route/server-reference-manifest.json +0 -4
  176. package/.next/server/app/api/sessions/[id]/route/app-paths-manifest.json +0 -3
  177. package/.next/server/app/api/sessions/[id]/route/build-manifest.json +0 -9
  178. package/.next/server/app/api/sessions/[id]/route/server-reference-manifest.json +0 -4
  179. package/.next/server/app/api/sessions/new/route/app-paths-manifest.json +0 -3
  180. package/.next/server/app/api/sessions/new/route/build-manifest.json +0 -9
  181. package/.next/server/app/api/sessions/new/route/server-reference-manifest.json +0 -4
  182. package/.next/server/app/api/sessions/route/app-paths-manifest.json +0 -3
  183. package/.next/server/app/api/sessions/route/build-manifest.json +0 -9
  184. package/.next/server/app/api/sessions/route/server-reference-manifest.json +0 -4
  185. package/.next/server/app/favicon.ico/route/app-paths-manifest.json +0 -3
  186. package/.next/server/app/favicon.ico/route/build-manifest.json +0 -9
  187. package/.next/server/app/page/app-paths-manifest.json +0 -3
  188. package/.next/server/app/page/build-manifest.json +0 -17
  189. package/.next/server/app/page/next-font-manifest.json +0 -6
  190. package/.next/server/app/page/react-loadable-manifest.json +0 -1
  191. package/.next/server/app/page/server-reference-manifest.json +0 -4
  192. package/.next/server/chunks/[externals]_next_dist_0h.fyd6._.js +0 -3
  193. package/.next/server/chunks/[root-of-the-server]__002d92q._.js +0 -6
  194. package/.next/server/chunks/[root-of-the-server]__00a-~o4._.js +0 -3
  195. package/.next/server/chunks/[root-of-the-server]__06qx74m._.js +0 -5
  196. package/.next/server/chunks/[root-of-the-server]__0_ehal9._.js +0 -5
  197. package/.next/server/chunks/[root-of-the-server]__0a-p9wd._.js +0 -3
  198. package/.next/server/chunks/[root-of-the-server]__0b0kii6._.js +0 -8
  199. package/.next/server/chunks/[root-of-the-server]__0cw6f~v._.js +0 -5
  200. package/.next/server/chunks/[root-of-the-server]__0llo_uy._.js +0 -5
  201. package/.next/server/chunks/[root-of-the-server]__0rr3q~-._.js +0 -5
  202. package/.next/server/chunks/[root-of-the-server]__0y7g-4j._.js +0 -4
  203. package/.next/server/chunks/[root-of-the-server]__11j~5mn._.js +0 -3
  204. package/.next/server/chunks/[turbopack]_runtime.js +0 -903
  205. package/.next/server/chunks/_next-internal_server_app_api_agent_[id]_events_route_actions_05o7blz.js +0 -3
  206. package/.next/server/chunks/_next-internal_server_app_api_agent_[id]_route_actions_0kr98j0.js +0 -3
  207. package/.next/server/chunks/_next-internal_server_app_api_agent_new_route_actions_0w3r5tj.js +0 -3
  208. package/.next/server/chunks/_next-internal_server_app_api_files_[___path]_route_actions_0_g4akf.js +0 -3
  209. package/.next/server/chunks/_next-internal_server_app_api_models-config_route_actions_0ipr5cq.js +0 -3
  210. package/.next/server/chunks/_next-internal_server_app_api_models_route_actions_0vfccm4.js +0 -3
  211. package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_context_route_actions_0d0pnzf.js +0 -3
  212. package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_route_actions_0eo4u5w.js +0 -3
  213. package/.next/server/chunks/_next-internal_server_app_api_sessions_new_route_actions_093p~n-.js +0 -3
  214. package/.next/server/chunks/_next-internal_server_app_api_sessions_route_actions_0y1t9w0.js +0 -3
  215. package/.next/server/chunks/_next-internal_server_app_favicon_ico_route_actions_095lj93.js +0 -3
  216. package/.next/server/chunks/lib_session-reader_ts_07kvkqq._.js +0 -5
  217. package/.next/server/chunks/node_modules_next_04~_e52._.js +0 -13
  218. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0yubv2d.js +0 -3
  219. package/.next/server/chunks/ssr/[root-of-the-server]__00d4x5d._.js +0 -3
  220. package/.next/server/chunks/ssr/[root-of-the-server]__02hi65f._.js +0 -3
  221. package/.next/server/chunks/ssr/[root-of-the-server]__06-2p1a._.js +0 -33
  222. package/.next/server/chunks/ssr/[root-of-the-server]__09z7o2x._.js +0 -19
  223. package/.next/server/chunks/ssr/[root-of-the-server]__0jag6jd._.js +0 -3
  224. package/.next/server/chunks/ssr/[root-of-the-server]__0pr3cat._.js +0 -33
  225. package/.next/server/chunks/ssr/[root-of-the-server]__0pspq~2._.js +0 -6
  226. package/.next/server/chunks/ssr/[root-of-the-server]__0w~zl.s._.js +0 -3
  227. package/.next/server/chunks/ssr/[turbopack]_runtime.js +0 -903
  228. package/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0k77kol.js +0 -3
  229. package/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0eq97pa.js +0 -3
  230. package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_09-gtaw.js +0 -3
  231. package/.next/server/chunks/ssr/app_layout_tsx_13yf0ls._.js +0 -3
  232. package/.next/server/chunks/ssr/components_ToolPanel_tsx_0r3vloj._.js +0 -3
  233. package/.next/server/chunks/ssr/components_ToolPanel_tsx_0ybdq6k._.js +0 -3
  234. package/.next/server/chunks/ssr/node_modules_09w7yel._.js +0 -33
  235. package/.next/server/chunks/ssr/node_modules_0vtdjw7._.js +0 -3
  236. package/.next/server/chunks/ssr/node_modules_next_dist_09y1ibj._.js +0 -6
  237. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0inhx6q._.js +0 -3
  238. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js +0 -3
  239. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js +0 -3
  240. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js +0 -3
  241. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_002l7yi.js +0 -4
  242. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_02suzhc.js +0 -4
  243. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0nsg22r.js +0 -4
  244. package/.next/static/1WVvKDGcM-B8j5drdJZ7m/_buildManifest.js +0 -11
  245. package/.next/static/1WVvKDGcM-B8j5drdJZ7m/_clientMiddlewareManifest.js +0 -1
  246. package/.next/static/chunks/0-j.wjqnc6zff.js +0 -1
  247. package/.next/static/chunks/02i7dfk78~t~2.js +0 -4
  248. package/.next/static/chunks/02p06lvcsni3l.js +0 -1
  249. package/.next/static/chunks/09dho1gmydle0.js +0 -1
  250. package/.next/static/chunks/0cj37tl-sc0gx.js +0 -2
  251. package/.next/static/chunks/0h4bblvd1oiwg.js +0 -1
  252. package/.next/static/chunks/0j-yjan8jn-8-.js +0 -31
  253. package/.next/static/chunks/168.i5wkbx2o-.js +0 -1
  254. package/.next/static/chunks/18b1hylg5nikt.css +0 -1
  255. package/.next/static/chunks/turbopack-04u~j1o-remaj.js +0 -1
  256. package/.next/static/media/favicon.0~uco8ba8mwit.ico +0 -0
  257. package/.next/turbopack +0 -0
  258. /package/.next/static/{1WVvKDGcM-B8j5drdJZ7m → 4kp7if2lGqkmV9DEGzfXZ}/_ssgManifest.js +0 -0
  259. /package/.next/static/chunks/{03~yq9q893hmn.js → polyfills-42372ed130431b0a.js} +0 -0
@@ -1,890 +0,0 @@
1
- const RUNTIME_PUBLIC_PATH = "chunks/[turbopack]_runtime.js";
2
- const RELATIVE_ROOT_PATH = "..";
3
- const ASSET_PREFIX = "/";
4
- const WORKER_FORWARDED_GLOBALS = [];
5
- /**
6
- * This file contains runtime types and functions that are shared between all
7
- * TurboPack ECMAScript runtimes.
8
- *
9
- * It will be prepended to the runtime code of each runtime.
10
- */ /* eslint-disable @typescript-eslint/no-unused-vars */ /// <reference path="./runtime-types.d.ts" />
11
- /**
12
- * Describes why a module was instantiated.
13
- * Shared between browser and Node.js runtimes.
14
- */ var SourceType = /*#__PURE__*/ function(SourceType) {
15
- /**
16
- * The module was instantiated because it was included in an evaluated chunk's
17
- * runtime.
18
- * SourceData is a ChunkPath.
19
- */ SourceType[SourceType["Runtime"] = 0] = "Runtime";
20
- /**
21
- * The module was instantiated because a parent module imported it.
22
- * SourceData is a ModuleId.
23
- */ SourceType[SourceType["Parent"] = 1] = "Parent";
24
- /**
25
- * The module was instantiated because it was included in a chunk's hot module
26
- * update.
27
- * SourceData is an array of ModuleIds or undefined.
28
- */ SourceType[SourceType["Update"] = 2] = "Update";
29
- return SourceType;
30
- }(SourceType || {});
31
- /**
32
- * Flag indicating which module object type to create when a module is merged. Set to `true`
33
- * by each runtime that uses ModuleWithDirection (browser dev-base.ts, nodejs dev-base.ts,
34
- * nodejs build-base.ts). Browser production (build-base.ts) leaves it as `false` since it
35
- * uses plain Module objects.
36
- */ let createModuleWithDirectionFlag = false;
37
- const REEXPORTED_OBJECTS = new WeakMap();
38
- /**
39
- * Constructs the `__turbopack_context__` object for a module.
40
- */ function Context(module, exports) {
41
- this.m = module;
42
- // We need to store this here instead of accessing it from the module object to:
43
- // 1. Make it available to factories directly, since we rewrite `this` to
44
- // `__turbopack_context__.e` in CJS modules.
45
- // 2. Support async modules which rewrite `module.exports` to a promise, so we
46
- // can still access the original exports object from functions like
47
- // `esmExport`
48
- // Ideally we could find a new approach for async modules and drop this property altogether.
49
- this.e = exports;
50
- }
51
- const contextPrototype = Context.prototype;
52
- const hasOwnProperty = Object.prototype.hasOwnProperty;
53
- const toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag;
54
- function defineProp(obj, name, options) {
55
- if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options);
56
- }
57
- function getOverwrittenModule(moduleCache, id) {
58
- let module = moduleCache[id];
59
- if (!module) {
60
- if (createModuleWithDirectionFlag) {
61
- // set in development modes for hmr support
62
- module = createModuleWithDirection(id);
63
- } else {
64
- module = createModuleObject(id);
65
- }
66
- moduleCache[id] = module;
67
- }
68
- return module;
69
- }
70
- /**
71
- * Creates the module object. Only done here to ensure all module objects have the same shape.
72
- */ function createModuleObject(id) {
73
- return {
74
- exports: {},
75
- error: undefined,
76
- id,
77
- namespaceObject: undefined
78
- };
79
- }
80
- function createModuleWithDirection(id) {
81
- return {
82
- exports: {},
83
- error: undefined,
84
- id,
85
- namespaceObject: undefined,
86
- parents: [],
87
- children: []
88
- };
89
- }
90
- const BindingTag_Value = 0;
91
- /**
92
- * Adds the getters to the exports object.
93
- */ function esm(exports, bindings) {
94
- defineProp(exports, '__esModule', {
95
- value: true
96
- });
97
- if (toStringTag) defineProp(exports, toStringTag, {
98
- value: 'Module'
99
- });
100
- let i = 0;
101
- while(i < bindings.length){
102
- const propName = bindings[i++];
103
- const tagOrFunction = bindings[i++];
104
- if (typeof tagOrFunction === 'number') {
105
- if (tagOrFunction === BindingTag_Value) {
106
- defineProp(exports, propName, {
107
- value: bindings[i++],
108
- enumerable: true,
109
- writable: false
110
- });
111
- } else {
112
- throw new Error(`unexpected tag: ${tagOrFunction}`);
113
- }
114
- } else {
115
- const getterFn = tagOrFunction;
116
- if (typeof bindings[i] === 'function') {
117
- const setterFn = bindings[i++];
118
- defineProp(exports, propName, {
119
- get: getterFn,
120
- set: setterFn,
121
- enumerable: true
122
- });
123
- } else {
124
- defineProp(exports, propName, {
125
- get: getterFn,
126
- enumerable: true
127
- });
128
- }
129
- }
130
- }
131
- Object.seal(exports);
132
- }
133
- /**
134
- * Makes the module an ESM with exports
135
- */ function esmExport(bindings, id) {
136
- let module;
137
- let exports;
138
- if (id != null) {
139
- module = getOverwrittenModule(this.c, id);
140
- exports = module.exports;
141
- } else {
142
- module = this.m;
143
- exports = this.e;
144
- }
145
- module.namespaceObject = exports;
146
- esm(exports, bindings);
147
- }
148
- contextPrototype.s = esmExport;
149
- function ensureDynamicExports(module, exports) {
150
- let reexportedObjects = REEXPORTED_OBJECTS.get(module);
151
- if (!reexportedObjects) {
152
- REEXPORTED_OBJECTS.set(module, reexportedObjects = []);
153
- module.exports = module.namespaceObject = new Proxy(exports, {
154
- get (target, prop) {
155
- if (hasOwnProperty.call(target, prop) || prop === 'default' || prop === '__esModule') {
156
- return Reflect.get(target, prop);
157
- }
158
- for (const obj of reexportedObjects){
159
- const value = Reflect.get(obj, prop);
160
- if (value !== undefined) return value;
161
- }
162
- return undefined;
163
- },
164
- ownKeys (target) {
165
- const keys = Reflect.ownKeys(target);
166
- for (const obj of reexportedObjects){
167
- for (const key of Reflect.ownKeys(obj)){
168
- if (key !== 'default' && !keys.includes(key)) keys.push(key);
169
- }
170
- }
171
- return keys;
172
- }
173
- });
174
- }
175
- return reexportedObjects;
176
- }
177
- /**
178
- * Dynamically exports properties from an object
179
- */ function dynamicExport(object, id) {
180
- let module;
181
- let exports;
182
- if (id != null) {
183
- module = getOverwrittenModule(this.c, id);
184
- exports = module.exports;
185
- } else {
186
- module = this.m;
187
- exports = this.e;
188
- }
189
- const reexportedObjects = ensureDynamicExports(module, exports);
190
- if (typeof object === 'object' && object !== null) {
191
- reexportedObjects.push(object);
192
- }
193
- }
194
- contextPrototype.j = dynamicExport;
195
- function exportValue(value, id) {
196
- let module;
197
- if (id != null) {
198
- module = getOverwrittenModule(this.c, id);
199
- } else {
200
- module = this.m;
201
- }
202
- module.exports = value;
203
- }
204
- contextPrototype.v = exportValue;
205
- function exportNamespace(namespace, id) {
206
- let module;
207
- if (id != null) {
208
- module = getOverwrittenModule(this.c, id);
209
- } else {
210
- module = this.m;
211
- }
212
- module.exports = module.namespaceObject = namespace;
213
- }
214
- contextPrototype.n = exportNamespace;
215
- function createGetter(obj, key) {
216
- return ()=>obj[key];
217
- }
218
- /**
219
- * @returns prototype of the object
220
- */ const getProto = Object.getPrototypeOf ? (obj)=>Object.getPrototypeOf(obj) : (obj)=>obj.__proto__;
221
- /** Prototypes that are not expanded for exports */ const LEAF_PROTOTYPES = [
222
- null,
223
- getProto({}),
224
- getProto([]),
225
- getProto(getProto)
226
- ];
227
- /**
228
- * @param raw
229
- * @param ns
230
- * @param allowExportDefault
231
- * * `false`: will have the raw module as default export
232
- * * `true`: will have the default property as default export
233
- */ function interopEsm(raw, ns, allowExportDefault) {
234
- const bindings = [];
235
- let defaultLocation = -1;
236
- for(let current = raw; (typeof current === 'object' || typeof current === 'function') && !LEAF_PROTOTYPES.includes(current); current = getProto(current)){
237
- for (const key of Object.getOwnPropertyNames(current)){
238
- bindings.push(key, createGetter(raw, key));
239
- if (defaultLocation === -1 && key === 'default') {
240
- defaultLocation = bindings.length - 1;
241
- }
242
- }
243
- }
244
- // this is not really correct
245
- // we should set the `default` getter if the imported module is a `.cjs file`
246
- if (!(allowExportDefault && defaultLocation >= 0)) {
247
- // Replace the binding with one for the namespace itself in order to preserve iteration order.
248
- if (defaultLocation >= 0) {
249
- // Replace the getter with the value
250
- bindings.splice(defaultLocation, 1, BindingTag_Value, raw);
251
- } else {
252
- bindings.push('default', BindingTag_Value, raw);
253
- }
254
- }
255
- esm(ns, bindings);
256
- return ns;
257
- }
258
- function createNS(raw) {
259
- if (typeof raw === 'function') {
260
- return function(...args) {
261
- return raw.apply(this, args);
262
- };
263
- } else {
264
- return Object.create(null);
265
- }
266
- }
267
- function esmImport(id) {
268
- const module = getOrInstantiateModuleFromParent(id, this.m);
269
- // any ES module has to have `module.namespaceObject` defined.
270
- if (module.namespaceObject) return module.namespaceObject;
271
- // only ESM can be an async module, so we don't need to worry about exports being a promise here.
272
- const raw = module.exports;
273
- return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
274
- }
275
- contextPrototype.i = esmImport;
276
- function asyncLoader(moduleId) {
277
- const loader = this.r(moduleId);
278
- return loader(esmImport.bind(this));
279
- }
280
- contextPrototype.A = asyncLoader;
281
- // Add a simple runtime require so that environments without one can still pass
282
- // `typeof require` CommonJS checks so that exports are correctly registered.
283
- const runtimeRequire = // @ts-ignore
284
- typeof require === 'function' ? require : function require1() {
285
- throw new Error('Unexpected use of runtime require');
286
- };
287
- contextPrototype.t = runtimeRequire;
288
- function commonJsRequire(id) {
289
- return getOrInstantiateModuleFromParent(id, this.m).exports;
290
- }
291
- contextPrototype.r = commonJsRequire;
292
- /**
293
- * Remove fragments and query parameters since they are never part of the context map keys
294
- *
295
- * This matches how we parse patterns at resolving time. Arguably we should only do this for
296
- * strings passed to `import` but the resolve does it for `import` and `require` and so we do
297
- * here as well.
298
- */ function parseRequest(request) {
299
- // Per the URI spec fragments can contain `?` characters, so we should trim it off first
300
- // https://datatracker.ietf.org/doc/html/rfc3986#section-3.5
301
- const hashIndex = request.indexOf('#');
302
- if (hashIndex !== -1) {
303
- request = request.substring(0, hashIndex);
304
- }
305
- const queryIndex = request.indexOf('?');
306
- if (queryIndex !== -1) {
307
- request = request.substring(0, queryIndex);
308
- }
309
- return request;
310
- }
311
- /**
312
- * `require.context` and require/import expression runtime.
313
- */ function moduleContext(map) {
314
- function moduleContext(id) {
315
- id = parseRequest(id);
316
- if (hasOwnProperty.call(map, id)) {
317
- return map[id].module();
318
- }
319
- const e = new Error(`Cannot find module '${id}'`);
320
- e.code = 'MODULE_NOT_FOUND';
321
- throw e;
322
- }
323
- moduleContext.keys = ()=>{
324
- return Object.keys(map);
325
- };
326
- moduleContext.resolve = (id)=>{
327
- id = parseRequest(id);
328
- if (hasOwnProperty.call(map, id)) {
329
- return map[id].id();
330
- }
331
- const e = new Error(`Cannot find module '${id}'`);
332
- e.code = 'MODULE_NOT_FOUND';
333
- throw e;
334
- };
335
- moduleContext.import = async (id)=>{
336
- return await moduleContext(id);
337
- };
338
- return moduleContext;
339
- }
340
- contextPrototype.f = moduleContext;
341
- /**
342
- * Returns the path of a chunk defined by its data.
343
- */ function getChunkPath(chunkData) {
344
- return typeof chunkData === 'string' ? chunkData : chunkData.path;
345
- }
346
- function isPromise(maybePromise) {
347
- return maybePromise != null && typeof maybePromise === 'object' && 'then' in maybePromise && typeof maybePromise.then === 'function';
348
- }
349
- function isAsyncModuleExt(obj) {
350
- return turbopackQueues in obj;
351
- }
352
- function createPromise() {
353
- let resolve;
354
- let reject;
355
- const promise = new Promise((res, rej)=>{
356
- reject = rej;
357
- resolve = res;
358
- });
359
- return {
360
- promise,
361
- resolve: resolve,
362
- reject: reject
363
- };
364
- }
365
- // Load the CompressedmoduleFactories of a chunk into the `moduleFactories` Map.
366
- // The CompressedModuleFactories format is
367
- // - 1 or more module ids
368
- // - a module factory function
369
- // So walking this is a little complex but the flat structure is also fast to
370
- // traverse, we can use `typeof` operators to distinguish the two cases.
371
- function installCompressedModuleFactories(chunkModules, offset, moduleFactories, newModuleId) {
372
- let i = offset;
373
- while(i < chunkModules.length){
374
- let end = i + 1;
375
- // Find our factory function
376
- while(end < chunkModules.length && typeof chunkModules[end] !== 'function'){
377
- end++;
378
- }
379
- if (end === chunkModules.length) {
380
- throw new Error('malformed chunk format, expected a factory function');
381
- }
382
- // Install the factory for each module ID that doesn't already have one.
383
- // When some IDs in this group already have a factory, reuse that existing
384
- // group factory for the missing IDs to keep all IDs in the group consistent.
385
- // Otherwise, install the factory from this chunk.
386
- const moduleFactoryFn = chunkModules[end];
387
- let existingGroupFactory = undefined;
388
- for(let j = i; j < end; j++){
389
- const id = chunkModules[j];
390
- const existingFactory = moduleFactories.get(id);
391
- if (existingFactory) {
392
- existingGroupFactory = existingFactory;
393
- break;
394
- }
395
- }
396
- const factoryToInstall = existingGroupFactory ?? moduleFactoryFn;
397
- let didInstallFactory = false;
398
- for(let j = i; j < end; j++){
399
- const id = chunkModules[j];
400
- if (!moduleFactories.has(id)) {
401
- if (!didInstallFactory) {
402
- if (factoryToInstall === moduleFactoryFn) {
403
- applyModuleFactoryName(moduleFactoryFn);
404
- }
405
- didInstallFactory = true;
406
- }
407
- moduleFactories.set(id, factoryToInstall);
408
- newModuleId?.(id);
409
- }
410
- }
411
- i = end + 1; // end is pointing at the last factory advance to the next id or the end of the array.
412
- }
413
- }
414
- // everything below is adapted from webpack
415
- // https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13
416
- const turbopackQueues = Symbol('turbopack queues');
417
- const turbopackExports = Symbol('turbopack exports');
418
- const turbopackError = Symbol('turbopack error');
419
- function resolveQueue(queue) {
420
- if (queue && queue.status !== 1) {
421
- queue.status = 1;
422
- queue.forEach((fn)=>fn.queueCount--);
423
- queue.forEach((fn)=>fn.queueCount-- ? fn.queueCount++ : fn());
424
- }
425
- }
426
- function wrapDeps(deps) {
427
- return deps.map((dep)=>{
428
- if (dep !== null && typeof dep === 'object') {
429
- if (isAsyncModuleExt(dep)) return dep;
430
- if (isPromise(dep)) {
431
- const queue = Object.assign([], {
432
- status: 0
433
- });
434
- const obj = {
435
- [turbopackExports]: {},
436
- [turbopackQueues]: (fn)=>fn(queue)
437
- };
438
- dep.then((res)=>{
439
- obj[turbopackExports] = res;
440
- resolveQueue(queue);
441
- }, (err)=>{
442
- obj[turbopackError] = err;
443
- resolveQueue(queue);
444
- });
445
- return obj;
446
- }
447
- }
448
- return {
449
- [turbopackExports]: dep,
450
- [turbopackQueues]: ()=>{}
451
- };
452
- });
453
- }
454
- function asyncModule(body, hasAwait) {
455
- const module = this.m;
456
- const queue = hasAwait ? Object.assign([], {
457
- status: -1
458
- }) : undefined;
459
- const depQueues = new Set();
460
- const { resolve, reject, promise: rawPromise } = createPromise();
461
- const promise = Object.assign(rawPromise, {
462
- [turbopackExports]: module.exports,
463
- [turbopackQueues]: (fn)=>{
464
- queue && fn(queue);
465
- depQueues.forEach(fn);
466
- promise['catch'](()=>{});
467
- }
468
- });
469
- const attributes = {
470
- get () {
471
- return promise;
472
- },
473
- set (v) {
474
- // Calling `esmExport` leads to this.
475
- if (v !== promise) {
476
- promise[turbopackExports] = v;
477
- }
478
- }
479
- };
480
- Object.defineProperty(module, 'exports', attributes);
481
- Object.defineProperty(module, 'namespaceObject', attributes);
482
- function handleAsyncDependencies(deps) {
483
- const currentDeps = wrapDeps(deps);
484
- const getResult = ()=>currentDeps.map((d)=>{
485
- if (d[turbopackError]) throw d[turbopackError];
486
- return d[turbopackExports];
487
- });
488
- const { promise, resolve } = createPromise();
489
- const fn = Object.assign(()=>resolve(getResult), {
490
- queueCount: 0
491
- });
492
- function fnQueue(q) {
493
- if (q !== queue && !depQueues.has(q)) {
494
- depQueues.add(q);
495
- if (q && q.status === 0) {
496
- fn.queueCount++;
497
- q.push(fn);
498
- }
499
- }
500
- }
501
- currentDeps.map((dep)=>dep[turbopackQueues](fnQueue));
502
- return fn.queueCount ? promise : getResult();
503
- }
504
- function asyncResult(err) {
505
- if (err) {
506
- reject(promise[turbopackError] = err);
507
- } else {
508
- resolve(promise[turbopackExports]);
509
- }
510
- resolveQueue(queue);
511
- }
512
- body(handleAsyncDependencies, asyncResult);
513
- if (queue && queue.status === -1) {
514
- queue.status = 0;
515
- }
516
- }
517
- contextPrototype.a = asyncModule;
518
- /**
519
- * A pseudo "fake" URL object to resolve to its relative path.
520
- *
521
- * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this
522
- * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid
523
- * hydration mismatch.
524
- *
525
- * This is based on webpack's existing implementation:
526
- * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js
527
- */ const relativeURL = function relativeURL(inputUrl) {
528
- const realUrl = new URL(inputUrl, 'x:/');
529
- const values = {};
530
- for(const key in realUrl)values[key] = realUrl[key];
531
- values.href = inputUrl;
532
- values.pathname = inputUrl.replace(/[?#].*/, '');
533
- values.origin = values.protocol = '';
534
- values.toString = values.toJSON = (..._args)=>inputUrl;
535
- for(const key in values)Object.defineProperty(this, key, {
536
- enumerable: true,
537
- configurable: true,
538
- value: values[key]
539
- });
540
- };
541
- relativeURL.prototype = URL.prototype;
542
- contextPrototype.U = relativeURL;
543
- /**
544
- * Utility function to ensure all variants of an enum are handled.
545
- */ function invariant(never, computeMessage) {
546
- throw new Error(`Invariant: ${computeMessage(never)}`);
547
- }
548
- /**
549
- * Constructs an error message for when a module factory is not available.
550
- */ function factoryNotAvailableMessage(moduleId, sourceType, sourceData) {
551
- let instantiationReason;
552
- switch(sourceType){
553
- case 0:
554
- instantiationReason = `as a runtime entry of chunk ${sourceData}`;
555
- break;
556
- case 1:
557
- instantiationReason = `because it was required from module ${sourceData}`;
558
- break;
559
- case 2:
560
- instantiationReason = 'because of an HMR update';
561
- break;
562
- default:
563
- invariant(sourceType, (sourceType)=>`Unknown source type: ${sourceType}`);
564
- }
565
- return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`;
566
- }
567
- /**
568
- * A stub function to make `require` available but non-functional in ESM.
569
- */ function requireStub(_moduleId) {
570
- throw new Error('dynamic usage of require is not supported');
571
- }
572
- contextPrototype.z = requireStub;
573
- // Make `globalThis` available to the module in a way that cannot be shadowed by a local variable.
574
- contextPrototype.g = globalThis;
575
- function applyModuleFactoryName(factory) {
576
- // Give the module factory a nice name to improve stack traces.
577
- Object.defineProperty(factory, 'name', {
578
- value: 'module evaluation'
579
- });
580
- }
581
- /// <reference path="../shared/runtime/runtime-utils.ts" />
582
- /// A 'base' utilities to support runtime can have externals.
583
- /// Currently this is for node.js / edge runtime both.
584
- /// If a fn requires node.js specific behavior, it should be placed in `node-external-utils` instead.
585
- async function externalImport(id) {
586
- let raw;
587
- try {
588
- raw = await import(id);
589
- } catch (err) {
590
- // TODO(alexkirsz) This can happen when a client-side module tries to load
591
- // an external module we don't provide a shim for (e.g. querystring, url).
592
- // For now, we fail semi-silently, but in the future this should be a
593
- // compilation error.
594
- throw new Error(`Failed to load external module ${id}: ${err}`);
595
- }
596
- if (raw && raw.__esModule && raw.default && 'default' in raw.default) {
597
- return interopEsm(raw.default, createNS(raw), true);
598
- }
599
- return raw;
600
- }
601
- contextPrototype.y = externalImport;
602
- function externalRequire(id, thunk, esm = false) {
603
- let raw;
604
- try {
605
- raw = thunk();
606
- } catch (err) {
607
- // TODO(alexkirsz) This can happen when a client-side module tries to load
608
- // an external module we don't provide a shim for (e.g. querystring, url).
609
- // For now, we fail semi-silently, but in the future this should be a
610
- // compilation error.
611
- throw new Error(`Failed to load external module ${id}: ${err}`);
612
- }
613
- if (!esm || raw.__esModule) {
614
- return raw;
615
- }
616
- return interopEsm(raw, createNS(raw), true);
617
- }
618
- externalRequire.resolve = (id, options)=>{
619
- return require.resolve(id, options);
620
- };
621
- contextPrototype.x = externalRequire;
622
- /* eslint-disable @typescript-eslint/no-unused-vars */ const path = require('path');
623
- const relativePathToRuntimeRoot = path.relative(RUNTIME_PUBLIC_PATH, '.');
624
- // Compute the relative path to the `distDir`.
625
- const relativePathToDistRoot = path.join(relativePathToRuntimeRoot, RELATIVE_ROOT_PATH);
626
- const RUNTIME_ROOT = path.resolve(__filename, relativePathToRuntimeRoot);
627
- // Compute the absolute path to the root, by stripping distDir from the absolute path to this file.
628
- const ABSOLUTE_ROOT = path.resolve(__filename, relativePathToDistRoot);
629
- /**
630
- * Returns an absolute path to the given module path.
631
- * Module path should be relative, either path to a file or a directory.
632
- *
633
- * This fn allows to calculate an absolute path for some global static values, such as
634
- * `__dirname` or `import.meta.url` that Turbopack will not embeds in compile time.
635
- * See ImportMetaBinding::code_generation for the usage.
636
- */ function resolveAbsolutePath(modulePath) {
637
- if (modulePath) {
638
- return path.join(ABSOLUTE_ROOT, modulePath);
639
- }
640
- return ABSOLUTE_ROOT;
641
- }
642
- Context.prototype.P = resolveAbsolutePath;
643
- /* eslint-disable @typescript-eslint/no-unused-vars */ /// <reference path="../shared/runtime/runtime-utils.ts" />
644
- function readWebAssemblyAsResponse(path) {
645
- const { createReadStream } = require('fs');
646
- const { Readable } = require('stream');
647
- const stream = createReadStream(path);
648
- // @ts-ignore unfortunately there's a slight type mismatch with the stream.
649
- return new Response(Readable.toWeb(stream), {
650
- headers: {
651
- 'content-type': 'application/wasm'
652
- }
653
- });
654
- }
655
- async function compileWebAssemblyFromPath(path) {
656
- const response = readWebAssemblyAsResponse(path);
657
- return await WebAssembly.compileStreaming(response);
658
- }
659
- async function instantiateWebAssemblyFromPath(path, importsObj) {
660
- const response = readWebAssemblyAsResponse(path);
661
- const { instance } = await WebAssembly.instantiateStreaming(response, importsObj);
662
- return instance.exports;
663
- }
664
- /* eslint-disable @typescript-eslint/no-unused-vars */ /// <reference path="../../shared/runtime/runtime-utils.ts" />
665
- /// <reference path="../../shared-node/base-externals-utils.ts" />
666
- /// <reference path="../../shared-node/node-externals-utils.ts" />
667
- /// <reference path="../../shared-node/node-wasm-utils.ts" />
668
- /// <reference path="./nodejs-globals.d.ts" />
669
- /**
670
- * Base Node.js runtime shared between production and development.
671
- * Contains chunk loading, module caching, and other non-HMR functionality.
672
- */ process.env.TURBOPACK = '1';
673
- const url = require('url');
674
- const moduleFactories = new Map();
675
- const moduleCache = Object.create(null);
676
- /**
677
- * Returns an absolute path to the given module's id.
678
- */ function resolvePathFromModule(moduleId) {
679
- const exported = this.r(moduleId);
680
- const exportedPath = exported?.default ?? exported;
681
- if (typeof exportedPath !== 'string') {
682
- return exported;
683
- }
684
- const strippedAssetPrefix = exportedPath.slice(ASSET_PREFIX.length);
685
- const resolved = path.resolve(RUNTIME_ROOT, strippedAssetPrefix);
686
- return url.pathToFileURL(resolved).href;
687
- }
688
- /**
689
- * Exports a URL value. No suffix is added in Node.js runtime.
690
- */ function exportUrl(urlValue, id) {
691
- exportValue.call(this, urlValue, id);
692
- }
693
- function loadRuntimeChunk(sourcePath, chunkData) {
694
- if (typeof chunkData === 'string') {
695
- loadRuntimeChunkPath(sourcePath, chunkData);
696
- } else {
697
- loadRuntimeChunkPath(sourcePath, chunkData.path);
698
- }
699
- }
700
- const loadedChunks = new Set();
701
- const unsupportedLoadChunk = Promise.resolve(undefined);
702
- const loadedChunk = Promise.resolve(undefined);
703
- const chunkCache = new Map();
704
- function clearChunkCache() {
705
- chunkCache.clear();
706
- loadedChunks.clear();
707
- }
708
- function loadRuntimeChunkPath(sourcePath, chunkPath) {
709
- if (!isJs(chunkPath)) {
710
- // We only support loading JS chunks in Node.js.
711
- // This branch can be hit when trying to load a CSS chunk.
712
- return;
713
- }
714
- if (loadedChunks.has(chunkPath)) {
715
- return;
716
- }
717
- try {
718
- const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
719
- const chunkModules = require(resolved);
720
- installCompressedModuleFactories(chunkModules, 0, moduleFactories);
721
- loadedChunks.add(chunkPath);
722
- } catch (cause) {
723
- let errorMessage = `Failed to load chunk ${chunkPath}`;
724
- if (sourcePath) {
725
- errorMessage += ` from runtime for chunk ${sourcePath}`;
726
- }
727
- const error = new Error(errorMessage, {
728
- cause
729
- });
730
- error.name = 'ChunkLoadError';
731
- throw error;
732
- }
733
- }
734
- function loadChunkAsync(chunkData) {
735
- const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path;
736
- if (!isJs(chunkPath)) {
737
- // We only support loading JS chunks in Node.js.
738
- // This branch can be hit when trying to load a CSS chunk.
739
- return unsupportedLoadChunk;
740
- }
741
- let entry = chunkCache.get(chunkPath);
742
- if (entry === undefined) {
743
- try {
744
- // resolve to an absolute path to simplify `require` handling
745
- const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
746
- // TODO: consider switching to `import()` to enable concurrent chunk loading and async file io
747
- // However this is incompatible with hot reloading (since `import` doesn't use the require cache)
748
- const chunkModules = require(resolved);
749
- installCompressedModuleFactories(chunkModules, 0, moduleFactories);
750
- entry = loadedChunk;
751
- } catch (cause) {
752
- const errorMessage = `Failed to load chunk ${chunkPath} from module ${this.m.id}`;
753
- const error = new Error(errorMessage, {
754
- cause
755
- });
756
- error.name = 'ChunkLoadError';
757
- // Cache the failure promise, future requests will also get this same rejection
758
- entry = Promise.reject(error);
759
- }
760
- chunkCache.set(chunkPath, entry);
761
- }
762
- // TODO: Return an instrumented Promise that React can use instead of relying on referential equality.
763
- return entry;
764
- }
765
- contextPrototype.l = loadChunkAsync;
766
- function loadChunkAsyncByUrl(chunkUrl) {
767
- const path1 = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT));
768
- return loadChunkAsync.call(this, path1);
769
- }
770
- contextPrototype.L = loadChunkAsyncByUrl;
771
- function loadWebAssembly(chunkPath, _edgeModule, imports) {
772
- const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
773
- return instantiateWebAssemblyFromPath(resolved, imports);
774
- }
775
- contextPrototype.w = loadWebAssembly;
776
- function loadWebAssemblyModule(chunkPath, _edgeModule) {
777
- const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
778
- return compileWebAssemblyFromPath(resolved);
779
- }
780
- contextPrototype.u = loadWebAssemblyModule;
781
- /**
782
- * Creates a Node.js worker thread by instantiating the given WorkerConstructor
783
- * with the appropriate path and options, including forwarded globals.
784
- *
785
- * @param WorkerConstructor The Worker constructor from worker_threads
786
- * @param workerPath Path to the worker entry chunk
787
- * @param workerOptions options to pass to the Worker constructor (optional)
788
- */ function createWorker(WorkerConstructor, workerPath, workerOptions) {
789
- // Build the forwarded globals object
790
- const forwardedGlobals = {};
791
- for (const name of WORKER_FORWARDED_GLOBALS){
792
- forwardedGlobals[name] = globalThis[name];
793
- }
794
- // Merge workerData with forwarded globals
795
- const existingWorkerData = workerOptions?.workerData || {};
796
- const options = {
797
- ...workerOptions,
798
- workerData: {
799
- ...typeof existingWorkerData === 'object' ? existingWorkerData : {},
800
- __turbopack_globals__: forwardedGlobals
801
- }
802
- };
803
- return new WorkerConstructor(workerPath, options);
804
- }
805
- const regexJsUrl = /\.js(?:\?[^#]*)?(?:#.*)?$/;
806
- /**
807
- * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.
808
- */ function isJs(chunkUrlOrPath) {
809
- return regexJsUrl.test(chunkUrlOrPath);
810
- }
811
- /* eslint-disable @typescript-eslint/no-unused-vars */ /// <reference path="./runtime-base.ts" />
812
- /**
813
- * Production Node.js runtime.
814
- * Uses ModuleWithDirection and simple module instantiation without HMR support.
815
- */ // moduleCache and moduleFactories are declared in runtime-base.ts
816
- // this is read in runtime-utils.ts so it creates a module with direction for hmr
817
- createModuleWithDirectionFlag = true;
818
- const nodeContextPrototype = Context.prototype;
819
- nodeContextPrototype.q = exportUrl;
820
- nodeContextPrototype.M = moduleFactories;
821
- // Cast moduleCache to ModuleWithDirection for production mode
822
- nodeContextPrototype.c = moduleCache;
823
- nodeContextPrototype.R = resolvePathFromModule;
824
- nodeContextPrototype.b = createWorker;
825
- nodeContextPrototype.C = clearChunkCache;
826
- function instantiateModule(id, sourceType, sourceData) {
827
- const moduleFactory = moduleFactories.get(id);
828
- if (typeof moduleFactory !== 'function') {
829
- // This can happen if modules incorrectly handle HMR disposes/updates,
830
- // e.g. when they keep a `setTimeout` around which still executes old code
831
- // and contains e.g. a `require("something")` call.
832
- throw new Error(factoryNotAvailableMessage(id, sourceType, sourceData));
833
- }
834
- const module1 = createModuleWithDirection(id);
835
- const exports = module1.exports;
836
- moduleCache[id] = module1;
837
- const context = new Context(module1, exports);
838
- // NOTE(alexkirsz) This can fail when the module encounters a runtime error.
839
- try {
840
- moduleFactory(context, module1, exports);
841
- } catch (error) {
842
- module1.error = error;
843
- throw error;
844
- }
845
- ;
846
- module1.loaded = true;
847
- if (module1.namespaceObject && module1.exports !== module1.namespaceObject) {
848
- // in case of a circular dependency: cjs1 -> esm2 -> cjs1
849
- interopEsm(module1.exports, module1.namespaceObject);
850
- }
851
- return module1;
852
- }
853
- /**
854
- * Retrieves a module from the cache, or instantiate it if it is not cached.
855
- */ // @ts-ignore
856
- function getOrInstantiateModuleFromParent(id, sourceModule) {
857
- const module1 = moduleCache[id];
858
- if (module1) {
859
- if (module1.error) {
860
- throw module1.error;
861
- }
862
- return module1;
863
- }
864
- return instantiateModule(id, SourceType.Parent, sourceModule.id);
865
- }
866
- /**
867
- * Instantiates a runtime module.
868
- */ function instantiateRuntimeModule(chunkPath, moduleId) {
869
- return instantiateModule(moduleId, SourceType.Runtime, chunkPath);
870
- }
871
- /**
872
- * Retrieves a module from the cache, or instantiate it as a runtime module if it is not cached.
873
- */ // @ts-ignore TypeScript doesn't separate this module space from the browser runtime
874
- function getOrInstantiateRuntimeModule(chunkPath, moduleId) {
875
- const module1 = moduleCache[moduleId];
876
- if (module1) {
877
- if (module1.error) {
878
- throw module1.error;
879
- }
880
- return module1;
881
- }
882
- return instantiateRuntimeModule(chunkPath, moduleId);
883
- }
884
- module.exports = (sourcePath)=>({
885
- m: (id)=>getOrInstantiateRuntimeModule(sourcePath, id),
886
- c: (chunkData)=>loadRuntimeChunk(sourcePath, chunkData)
887
- });
888
-
889
-
890
- //# sourceMappingURL=%5Bturbopack%5D_runtime.js.map