@wular/pnext 0.1.6 → 0.1.8

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 (337) hide show
  1. package/bin/pnext +9 -2
  2. package/dist/server/_chunks/aliases-pycbtjt1.js +46 -0
  3. package/dist/server/_chunks/analyze-4d9e00g9.js +449 -0
  4. package/dist/server/_chunks/boot-bhemypxz.js +38 -0
  5. package/dist/server/_chunks/build-c991dv65.js +86 -0
  6. package/dist/server/_chunks/build-kh5e3x48.js +3341 -0
  7. package/dist/server/_chunks/build-tier-0a96kmx3.js +2456 -0
  8. package/dist/server/_chunks/compile-040r79gj.js +22 -0
  9. package/dist/server/_chunks/config-0tvz03a6.js +24 -0
  10. package/dist/server/_chunks/config-27rj7830.js +36 -0
  11. package/dist/server/_chunks/create-9rvwshsp.js +135 -0
  12. package/dist/server/_chunks/dev-ex9exynt.js +220 -0
  13. package/dist/server/_chunks/esbuild-yyktfrtt.js +15 -0
  14. package/dist/server/_chunks/generate-myw9hef7.js +22 -0
  15. package/dist/server/_chunks/index-0r5eqfc7.js +279 -0
  16. package/dist/server/_chunks/index-0yjv5v47.js +105 -0
  17. package/dist/server/_chunks/index-11xpbfej.js +17 -0
  18. package/dist/server/_chunks/index-141vcwk6.js +109 -0
  19. package/dist/server/_chunks/index-1pzm1hdy.js +4130 -0
  20. package/dist/server/_chunks/index-29pq0kax.js +590 -0
  21. package/dist/server/_chunks/index-2vz0wzdn.js +59 -0
  22. package/dist/server/_chunks/index-2wfv4kvx.js +182 -0
  23. package/dist/server/_chunks/index-38xpdxwd.js +194 -0
  24. package/dist/server/_chunks/index-3e075kny.js +128 -0
  25. package/dist/server/_chunks/index-3ycf5ckv.js +472 -0
  26. package/dist/server/_chunks/index-4399bvd2.js +18 -0
  27. package/dist/server/_chunks/index-4da76t62.js +297 -0
  28. package/dist/server/_chunks/index-4t92hdxd.js +172 -0
  29. package/dist/server/_chunks/index-4zzebszd.js +10 -0
  30. package/dist/server/_chunks/index-52k54ykj.js +95 -0
  31. package/dist/server/_chunks/index-5hr4062s.js +70 -0
  32. package/dist/server/_chunks/index-68m3mwbd.js +84 -0
  33. package/dist/server/_chunks/index-6b009mt0.js +56 -0
  34. package/dist/server/_chunks/index-6gex3pfa.js +15 -0
  35. package/dist/server/_chunks/index-6kp9r0d9.js +11 -0
  36. package/dist/server/_chunks/index-6q7zvrap.js +134 -0
  37. package/dist/server/_chunks/index-71885zaq.js +284 -0
  38. package/dist/server/_chunks/index-73z4esab.js +38 -0
  39. package/dist/server/_chunks/index-79ngvam8.js +60 -0
  40. package/dist/server/_chunks/index-7wc9n8be.js +25 -0
  41. package/dist/server/_chunks/index-8ct7rqy3.js +198 -0
  42. package/dist/server/_chunks/index-8kcxdfya.js +206 -0
  43. package/dist/server/_chunks/index-9ch50vtq.js +18 -0
  44. package/dist/server/_chunks/index-9f49w76j.js +213 -0
  45. package/dist/server/_chunks/index-9hz3s0m8.js +851 -0
  46. package/dist/server/_chunks/index-akkrvjn6.js +535 -0
  47. package/dist/server/_chunks/index-b6wtkdp4.js +24 -0
  48. package/dist/server/_chunks/index-b7j671dj.js +207 -0
  49. package/dist/server/_chunks/index-bcws5eh2.js +35 -0
  50. package/dist/server/_chunks/index-bzd2ef7t.js +10 -0
  51. package/dist/server/_chunks/index-cjgqs13g.js +65 -0
  52. package/dist/server/_chunks/index-ckkdpht5.js +41 -0
  53. package/dist/server/_chunks/index-cn86z041.js +296 -0
  54. package/dist/server/_chunks/index-cvr4z22m.js +92 -0
  55. package/dist/server/_chunks/index-cyfednwb.js +87 -0
  56. package/dist/server/_chunks/index-d158y67j.js +152 -0
  57. package/dist/server/_chunks/index-d1jsmhhk.js +955 -0
  58. package/dist/server/_chunks/index-dg0f05zs.js +199 -0
  59. package/dist/server/_chunks/index-dgr390q7.js +9438 -0
  60. package/dist/server/_chunks/index-drwv61cc.js +185 -0
  61. package/dist/server/_chunks/index-e3a6yx84.js +18 -0
  62. package/dist/server/_chunks/index-e88tyv35.js +45 -0
  63. package/dist/server/_chunks/index-en7n9f7m.js +22 -0
  64. package/dist/server/_chunks/index-entm8bmz.js +28 -0
  65. package/dist/server/_chunks/index-evhd413j.js +57 -0
  66. package/dist/server/_chunks/index-ezgj0tr1.js +88 -0
  67. package/dist/server/_chunks/index-fjv96re1.js +5295 -0
  68. package/dist/server/_chunks/index-fn1chkkd.js +214 -0
  69. package/dist/server/_chunks/index-fp8r0sqs.js +64 -0
  70. package/dist/server/_chunks/index-gcmj16xy.js +92 -0
  71. package/dist/server/_chunks/index-gkndxkxf.js +736 -0
  72. package/dist/server/_chunks/index-grta8ap3.js +238 -0
  73. package/dist/server/_chunks/index-h2a70tg4.js +7 -0
  74. package/dist/server/_chunks/index-h4xy648y.js +51 -0
  75. package/dist/server/_chunks/index-hdbwtdv2.js +352 -0
  76. package/dist/server/_chunks/index-he6n2bvp.js +1270 -0
  77. package/dist/server/_chunks/index-j0m1jxqa.js +1253 -0
  78. package/dist/server/_chunks/index-j2zrcp1k.js +66 -0
  79. package/dist/server/_chunks/index-j681c48a.js +2530 -0
  80. package/dist/server/_chunks/index-jbj7ehef.js +50 -0
  81. package/dist/server/_chunks/index-jcsjq3d1.js +20 -0
  82. package/dist/server/_chunks/index-jks0x0a1.js +14 -0
  83. package/dist/server/_chunks/index-jn9rbhrx.js +1599 -0
  84. package/dist/server/_chunks/index-jt8e1pje.js +12 -0
  85. package/dist/server/_chunks/index-kdhxpwyq.js +483 -0
  86. package/dist/server/_chunks/index-knp0s912.js +7 -0
  87. package/dist/server/_chunks/index-kqyy1d4f.js +50 -0
  88. package/dist/server/_chunks/index-kresp2n8.js +445 -0
  89. package/dist/server/_chunks/index-m63czgq5.js +590 -0
  90. package/dist/server/_chunks/index-ms9v9tnx.js +31 -0
  91. package/dist/server/_chunks/index-n4hxpng2.js +11 -0
  92. package/dist/server/_chunks/index-n629dy38.js +1071 -0
  93. package/dist/server/_chunks/index-nf3df4jy.js +266 -0
  94. package/dist/server/_chunks/index-nqh3xhdc.js +57 -0
  95. package/dist/server/_chunks/index-pym1cezq.js +39 -0
  96. package/dist/server/_chunks/index-q3r9z8mq.js +213 -0
  97. package/dist/server/_chunks/index-q738kkhj.js +100 -0
  98. package/dist/server/_chunks/index-qcrvt6er.js +112 -0
  99. package/dist/server/_chunks/index-qjj6gddn.js +54 -0
  100. package/dist/server/_chunks/index-qpwsgt3a.js +158 -0
  101. package/dist/server/_chunks/index-r97ptz1q.js +97 -0
  102. package/dist/server/_chunks/index-ras0sdab.js +26 -0
  103. package/dist/server/_chunks/index-rcs322t1.js +19 -0
  104. package/dist/server/_chunks/index-rgj5mx84.js +101 -0
  105. package/dist/server/_chunks/index-rjegyfx4.js +1435 -0
  106. package/dist/server/_chunks/index-rt9qq1va.js +4 -0
  107. package/dist/server/_chunks/index-rthrsed5.js +356 -0
  108. package/dist/server/_chunks/index-sq3kvz3g.js +200 -0
  109. package/dist/server/_chunks/index-stbk3jhn.js +31 -0
  110. package/dist/server/_chunks/index-tf4j19ge.js +130 -0
  111. package/dist/server/_chunks/index-tgcakdxc.js +125 -0
  112. package/dist/server/_chunks/index-tgsfjmep.js +74 -0
  113. package/dist/server/_chunks/index-tq1f96v7.js +51 -0
  114. package/dist/server/_chunks/index-tq3b39a5.js +107 -0
  115. package/dist/server/_chunks/index-typcbcsv.js +819 -0
  116. package/dist/server/_chunks/index-v1ags1na.js +132 -0
  117. package/dist/server/_chunks/index-vmr35jjw.js +170 -0
  118. package/dist/server/_chunks/index-vvq7rqtn.js +329 -0
  119. package/dist/server/_chunks/index-vz0km5qk.js +33 -0
  120. package/dist/server/_chunks/index-w6h8m6vp.js +138 -0
  121. package/dist/server/_chunks/index-web361b8.js +138 -0
  122. package/dist/server/_chunks/index-wm36rj4v.js +311 -0
  123. package/dist/server/_chunks/index-x0y005nh.js +283 -0
  124. package/dist/server/_chunks/index-x2m17v9c.js +6166 -0
  125. package/dist/server/_chunks/index-x3yn4ywm.js +22 -0
  126. package/dist/server/_chunks/index-x9c55pzy.js +871 -0
  127. package/dist/server/_chunks/index-xh1nbk46.js +1299 -0
  128. package/dist/server/_chunks/index-xvj80c3a.js +30 -0
  129. package/dist/server/_chunks/index-xywjg2vc.js +100 -0
  130. package/dist/server/_chunks/index-y4d02znn.js +66 -0
  131. package/dist/server/_chunks/index-y7mzvq2q.js +110 -0
  132. package/dist/server/_chunks/index-ye9hmsvf.js +47 -0
  133. package/dist/server/_chunks/index-yhxkxghe.js +56 -0
  134. package/dist/server/_chunks/index-yrjkqtfj.js +86 -0
  135. package/dist/server/_chunks/index-z88qv16t.js +11 -0
  136. package/dist/server/_chunks/index-zfrwq472.js +154 -0
  137. package/dist/server/_chunks/index-zqpqyg8p.js +666 -0
  138. package/dist/server/_chunks/loader-5en7wpt5.js +80 -0
  139. package/dist/server/_chunks/modules-t92favpj.js +76 -0
  140. package/dist/server/_chunks/pipeline-4t9q43ht.js +836 -0
  141. package/dist/server/_chunks/production-385bw8df.js +55 -0
  142. package/dist/server/_chunks/proxy-config-60gprphe.js +23 -0
  143. package/dist/server/_chunks/proxy-gfhmktbk.js +35 -0
  144. package/dist/server/_chunks/router-xnrva921.js +501 -0
  145. package/dist/server/_chunks/routes-ht868pdc.js +66 -0
  146. package/dist/server/_chunks/run-d40d63ag.js +697 -0
  147. package/dist/server/_chunks/server-2p8fgqq2.js +1839 -0
  148. package/dist/server/_chunks/tsconfig-defaults-bcn34eqb.js +21 -0
  149. package/dist/server/_chunks/typegen-dvtcjtaw.js +37 -0
  150. package/dist/server/api/client-cache.js +14 -0
  151. package/dist/server/cli/index.js +375 -0
  152. package/dist/server/cli/start.js +158 -0
  153. package/dist/server/client/reference.js +16 -0
  154. package/dist/server/compat/next/cache.js +56 -0
  155. package/dist/server/compat/next/canonical-url.js +13 -0
  156. package/dist/server/compat/next/client-cache.js +57 -0
  157. package/dist/server/compat/next/client-navigation.js +232 -0
  158. package/dist/server/compat/next/client-only.js +1 -0
  159. package/dist/server/compat/next/client-script.js +178 -0
  160. package/dist/server/compat/next/client-server.js +34 -0
  161. package/dist/server/compat/next/config-headers.js +34 -0
  162. package/dist/server/compat/next/config-loader.js +25 -0
  163. package/dist/server/compat/next/config.js +10 -0
  164. package/dist/server/compat/next/constants.js +18 -0
  165. package/dist/server/compat/next/custom-server.js +10 -0
  166. package/dist/server/compat/next/dist/client/components/app-router-headers.js +48 -0
  167. package/dist/server/compat/next/dist/server/web/spec-extension/revalidate.js +27 -0
  168. package/dist/server/compat/next/dist/server/web/spec-extension/unstable-cache.js +25 -0
  169. package/dist/server/compat/next/dist/server/web/spec-extension/unstable-no-store.js +25 -0
  170. package/dist/server/compat/next/dynamic.js +21 -0
  171. package/dist/server/compat/next/error.js +112 -0
  172. package/dist/server/compat/next/font/cache.js +16 -0
  173. package/dist/server/compat/next/font/google.js +3 -0
  174. package/dist/server/compat/next/font/index.js +1 -0
  175. package/dist/server/compat/next/font/local.js +24 -0
  176. package/dist/server/compat/next/font/runtime-client.js +33 -0
  177. package/dist/server/compat/next/font/runtime.js +43 -0
  178. package/dist/server/compat/next/font/shared.js +22 -0
  179. package/dist/server/compat/next/form.js +129 -0
  180. package/dist/server/compat/next/head.js +10 -0
  181. package/dist/server/compat/next/headers.js +30 -0
  182. package/dist/server/compat/next/image/client.js +11 -0
  183. package/dist/server/compat/next/image/config.js +18 -0
  184. package/dist/server/compat/next/image/optimizer.js +25 -0
  185. package/dist/server/compat/next/image/patterns.js +12 -0
  186. package/dist/server/compat/next/image/props.js +16 -0
  187. package/dist/server/compat/next/image/shared.js +86 -0
  188. package/dist/server/compat/next/image/static-metadata.js +32 -0
  189. package/dist/server/compat/next/image/validate.js +8 -0
  190. package/dist/server/compat/next/image.js +59 -0
  191. package/dist/server/compat/next/index.js +1 -0
  192. package/dist/server/compat/next/legacy-image.js +78 -0
  193. package/dist/server/compat/next/legacy-request-apis.js +24 -0
  194. package/dist/server/compat/next/link-transform.js +15 -0
  195. package/dist/server/compat/next/link.js +14 -0
  196. package/dist/server/compat/next/navigation.js +191 -0
  197. package/dist/server/compat/next/offline.js +45 -0
  198. package/dist/server/compat/next/og.js +8 -0
  199. package/dist/server/compat/next/preferred-region.js +8 -0
  200. package/dist/server/compat/next/redirects.js +32 -0
  201. package/dist/server/compat/next/resource-hints.js +30 -0
  202. package/dist/server/compat/next/rewrites.js +43 -0
  203. package/dist/server/compat/next/root-params.js +121 -0
  204. package/dist/server/compat/next/route-state.js +23 -0
  205. package/dist/server/compat/next/router.js +103 -0
  206. package/dist/server/compat/next/script.js +37 -0
  207. package/dist/server/compat/next/server-only.js +1 -0
  208. package/dist/server/compat/next/server.js +131 -0
  209. package/dist/server/compat/next/svgr.js +14 -0
  210. package/dist/server/compat/next/telemetry.js +10 -0
  211. package/dist/server/compat/next/usage.js +13 -0
  212. package/dist/server/compat/next/user-agent.js +12 -0
  213. package/dist/server/compat/next/web-vitals.js +35 -0
  214. package/dist/server/compat/react/action-state.js +11 -0
  215. package/dist/server/compat/react/client-lite.js +83 -0
  216. package/dist/server/compat/react/client.js +131 -0
  217. package/dist/server/compat/react/compiler-runtime.js +42 -0
  218. package/dist/server/compat/react/dom-client.js +106 -0
  219. package/dist/server/compat/react/dom-react-server.js +37 -0
  220. package/dist/server/compat/react/dom-server.js +40 -0
  221. package/dist/server/compat/react/dom.js +52 -0
  222. package/dist/server/compat/react/hooks-extra.js +12 -0
  223. package/dist/server/compat/react/internals.js +14 -0
  224. package/dist/server/compat/react/parity.js +11 -0
  225. package/dist/server/compat/react/preact.js +113 -0
  226. package/dist/server/compat/react/react-server.js +133 -0
  227. package/dist/server/compat/react/router-shim.js +8 -0
  228. package/dist/server/compat/react/server-component-use.js +14 -0
  229. package/dist/server/compat/react/server-inserted-html.js +14 -0
  230. package/dist/server/compat/react/server.js +194 -0
  231. package/dist/server/compat/react/style-values.js +10 -0
  232. package/dist/server/compat/react/use.js +10 -0
  233. package/dist/server/compat/react/view-transition.js +12 -0
  234. package/dist/server/generation.json +1 -0
  235. package/package.json +4 -1
  236. package/reference/compat.md +1 -1
  237. package/reference/config.md +2 -2
  238. package/reference/dev.md +1 -1
  239. package/reference/getting-started.md +1 -1
  240. package/reference/rendering.md +4 -4
  241. package/src/api/dynamic.tsx +86 -4
  242. package/src/api/server.ts +24 -6
  243. package/src/cli/adapters/vercel-warm.ts +327 -62
  244. package/src/cli/adapters/vercel.ts +164 -1054
  245. package/src/cli/analyze.ts +3 -2
  246. package/src/cli/build/cache.ts +6 -6
  247. package/src/cli/build.ts +78 -45
  248. package/src/cli/index.ts +21 -3
  249. package/src/cli/serve/immutable.ts +31 -0
  250. package/src/cli/serve/pipeline.ts +97 -93
  251. package/src/cli/serve/standalone-worker.ts +8 -0
  252. package/src/cli/serve/standalone.ts +703 -0
  253. package/src/cli/start.ts +31 -8
  254. package/src/client/build.ts +1 -1
  255. package/src/client/chunk-fold.ts +19 -6
  256. package/src/client/react-tier.ts +3 -2
  257. package/src/client/reference-stub.ts +23 -36
  258. package/src/compat/actions/client-plugin.ts +4 -2
  259. package/src/compat/actions/config.ts +6 -5
  260. package/src/compat/actions/extensions.ts +5 -5
  261. package/src/compat/aliases.ts +8 -1
  262. package/src/compat/bundler/config.ts +88 -0
  263. package/src/compat/bundler/optimize-package-imports.ts +86 -26
  264. package/src/compat/bundler/relay-transform.ts +15 -3
  265. package/src/compat/bundler/require-context.ts +2 -1
  266. package/src/compat/bundler/webpack-loaders.ts +3 -2
  267. package/src/compat/bundler/worker.ts +2 -2
  268. package/src/compat/cache-control.ts +16 -8
  269. package/src/compat/css/inline-css.ts +1 -1
  270. package/src/compat/css/modules.ts +18 -5
  271. package/src/compat/export/build-complete.ts +1 -1
  272. package/src/compat/export/emit.ts +4 -4
  273. package/src/compat/export/standalone.ts +30 -65
  274. package/src/compat/image-optimizer/optimize.ts +1 -1
  275. package/src/compat/lifecycle/error-funnel.ts +1 -1
  276. package/src/compat/lifecycle/instrumentation-client.ts +4 -3
  277. package/src/compat/lifecycle/instrumentation.ts +117 -24
  278. package/src/compat/lifecycle/testmode.ts +3 -2
  279. package/src/compat/metadata-artifacts.ts +1 -1
  280. package/src/compat/next/config-loader.ts +140 -13
  281. package/src/compat/next/dynamic.tsx +10 -23
  282. package/src/compat/next/font/cache.ts +2 -1
  283. package/src/compat/next/font/runtime.ts +23 -3
  284. package/src/compat/next/og.ts +3 -3
  285. package/src/compat/next/usage.ts +3 -2
  286. package/src/compat/pages/api.ts +83 -14
  287. package/src/compat/pages/router.ts +30 -14
  288. package/src/compat/register/bundler.ts +3 -1
  289. package/src/compat/register/image.ts +1 -1
  290. package/src/compat/register/middleware.ts +1 -1
  291. package/src/compat/register/otel.ts +5 -9
  292. package/src/compat/register/render.ts +3 -1
  293. package/src/compat/register/use-cache.ts +3 -1
  294. package/src/compat/release.ts +46 -0
  295. package/src/compat/segment/serve.ts +1 -1
  296. package/src/compat/typecheck/check.ts +6 -4
  297. package/src/compat/validation/validate.ts +10 -7
  298. package/src/config.ts +76 -9
  299. package/src/css/assets.ts +213 -0
  300. package/src/css/build.ts +190 -247
  301. package/src/dev/client-chunk-store.ts +2 -1
  302. package/src/dev/restart/client-key.ts +2 -1
  303. package/src/dev/restart/global-css.ts +2 -1
  304. package/src/dev/restart/route-bundle-key.ts +2 -1
  305. package/src/dev/restart/route-facts.ts +2 -1
  306. package/src/dev/server.ts +34 -14
  307. package/src/extensions.ts +4 -0
  308. package/src/out-paths.ts +10 -0
  309. package/src/render/hooks.ts +13 -0
  310. package/src/render/renderer.ts +53 -33
  311. package/src/request/context.ts +9 -0
  312. package/src/resolve/dynamic.ts +7 -1
  313. package/src/resolve/engine.ts +2 -12
  314. package/src/resolve/imports.ts +12 -52
  315. package/src/resolve/package-json.ts +56 -0
  316. package/src/resolve/scan-facts.ts +250 -1
  317. package/src/routing/href.ts +10 -3
  318. package/src/routing/match.ts +287 -0
  319. package/src/routing/metadata-files.ts +20 -6
  320. package/src/routing/proxy-config.ts +137 -0
  321. package/src/routing/proxy.ts +35 -134
  322. package/src/routing/routes.ts +22 -281
  323. package/src/runtime/fingerprint.ts +23 -8
  324. package/src/runtime/load.ts +170 -0
  325. package/src/runtime/loader.ts +218 -44
  326. package/src/runtime/module-cache.ts +15 -1
  327. package/src/runtime/modules.ts +405 -82
  328. package/src/runtime/prebundle.ts +101 -0
  329. package/src/runtime/production.ts +456 -0
  330. package/src/runtime/release-graph.ts +342 -0
  331. package/src/runtime/vendor-build.ts +750 -17
  332. package/src/runtime/vendor.ts +16 -3
  333. package/src/types.ts +4 -3
  334. package/src/utils/directive.ts +40 -0
  335. package/src/utils/fs.ts +95 -4
  336. package/src/utils/resource-query.ts +12 -0
  337. package/src/cli/serve/entry.ts +0 -45
@@ -0,0 +1,21 @@
1
+ // @bun
2
+ import {
3
+ writeTsconfigDefaults
4
+ } from "./index-b7j671dj.js";
5
+ import"./index-m63czgq5.js";
6
+ import"./index-cjgqs13g.js";
7
+ import"./index-jks0x0a1.js";
8
+ import"./index-6b009mt0.js";
9
+ import"./index-4zzebszd.js";
10
+ import"./index-sq3kvz3g.js";
11
+ import"./index-ckkdpht5.js";
12
+ import"./index-4da76t62.js";
13
+ import"./index-hdbwtdv2.js";
14
+ import"./index-kresp2n8.js";
15
+ import"./index-e3a6yx84.js";
16
+ import"./index-7wc9n8be.js";
17
+ import"./index-jt8e1pje.js";
18
+ import"./index-rt9qq1va.js";
19
+ export {
20
+ writeTsconfigDefaults
21
+ };
@@ -0,0 +1,37 @@
1
+ // @bun
2
+ import {
3
+ typegenProject,
4
+ writeTypegen
5
+ } from "./index-38xpdxwd.js";
6
+ import"./index-jn9rbhrx.js";
7
+ import"./index-0r5eqfc7.js";
8
+ import"./index-8ct7rqy3.js";
9
+ import"./index-n629dy38.js";
10
+ import"./index-73z4esab.js";
11
+ import"./index-d158y67j.js";
12
+ import"./index-web361b8.js";
13
+ import"./index-fp8r0sqs.js";
14
+ import"./index-cjgqs13g.js";
15
+ import"./index-cn86z041.js";
16
+ import"./index-4da76t62.js";
17
+ import"./index-tq3b39a5.js";
18
+ import"./index-71885zaq.js";
19
+ import"./index-bzd2ef7t.js";
20
+ import"./index-hdbwtdv2.js";
21
+ import"./index-6kp9r0d9.js";
22
+ import"./index-ras0sdab.js";
23
+ import"./index-grta8ap3.js";
24
+ import"./index-kresp2n8.js";
25
+ import"./index-e3a6yx84.js";
26
+ import"./index-x9c55pzy.js";
27
+ import"./index-d1jsmhhk.js";
28
+ import"./index-7wc9n8be.js";
29
+ import"./index-pym1cezq.js";
30
+ import"./index-jt8e1pje.js";
31
+ import"./index-zqpqyg8p.js";
32
+ import"./index-qjj6gddn.js";
33
+ import"./index-rt9qq1va.js";
34
+ export {
35
+ typegenProject,
36
+ writeTypegen
37
+ };
@@ -0,0 +1,14 @@
1
+ // @bun
2
+ import"../_chunks/index-rt9qq1va.js";
3
+
4
+ // src/api/client-cache.ts
5
+ function cache(fn) {
6
+ return (...args) => fn(...args);
7
+ }
8
+ function cacheSignal() {
9
+ return null;
10
+ }
11
+ export {
12
+ cache,
13
+ cacheSignal
14
+ };
@@ -0,0 +1,375 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ import { join as __pnextJoin } from "node:path";
4
+ const __PNEXT_PACKAGE_ROOT__ = __pnextJoin(import.meta.dirname, "../../..");
5
+ import {
6
+ markBoot
7
+ } from "../_chunks/index-tq1f96v7.js";
8
+ import {
9
+ commandBinaryName,
10
+ nameEsbuildProcess,
11
+ namedBunBinary
12
+ } from "../_chunks/index-cyfednwb.js";
13
+ import"../_chunks/index-vz0km5qk.js";
14
+ import {
15
+ bold,
16
+ cyan,
17
+ dim
18
+ } from "../_chunks/index-6kp9r0d9.js";
19
+ import {
20
+ __require
21
+ } from "../_chunks/index-rt9qq1va.js";
22
+
23
+ // src/cli/index.ts
24
+ import { existsSync, readFileSync, statSync } from "fs";
25
+ import path from "path";
26
+ var MIN_BUN = "1.3.10";
27
+ var BROKEN_BUN = new Set(["1.3.14"]);
28
+ var VERSION = packageVersion();
29
+ var COMMANDS = new Set([
30
+ "dev",
31
+ "build",
32
+ "start",
33
+ "analyze",
34
+ "typegen",
35
+ "create",
36
+ "migrate",
37
+ "info"
38
+ ]);
39
+ if (typeof Bun === "undefined") {
40
+ console.error(`pnext requires Bun >=${MIN_BUN}. Install it from https://bun.sh/get`);
41
+ process.exit(1);
42
+ }
43
+ var bunVersion = Bun.version.split("-")[0] ?? Bun.version;
44
+ if (BROKEN_BUN.has(bunVersion)) {
45
+ console.error(`pnext does not support Bun ${Bun.version}: it crashes the process at runtime. ` + "Upgrade to latest Bun with `bun upgrade`.");
46
+ process.exit(1);
47
+ } else if (!Bun.semver.satisfies(bunVersion, `>=${MIN_BUN}`)) {
48
+ console.error(`pnext requires Bun >=${MIN_BUN}, found ${Bun.version}. Upgrade with \`bun upgrade\`.`);
49
+ process.exit(1);
50
+ }
51
+ var [, , command, ...args] = process.argv;
52
+ markBoot("cli:entry");
53
+ namedBunBinary(commandBinaryName(command));
54
+ if (command !== "start")
55
+ nameEsbuildProcess();
56
+ markBoot("cli:naming");
57
+ try {
58
+ if (command === "--version" || command === "-v") {
59
+ console.log(VERSION);
60
+ } else if (command === "--help" || command === "-h" || !command) {
61
+ printHelp();
62
+ } else if (COMMANDS.has(command) && (args.includes("--help") || args.includes("-h"))) {
63
+ printCommandHelp(command);
64
+ } else if (command === "dev") {
65
+ warnUnknownFlags(command, args);
66
+ const { dev } = await import("../_chunks/dev-ex9exynt.js");
67
+ await dev({
68
+ root: positionalRoot(args),
69
+ port: optionNumber(args, "--port"),
70
+ hostname: optionString(args, "--hostname")
71
+ });
72
+ } else if (command === "build") {
73
+ warnUnknownFlags(command, args);
74
+ const { buildProject } = await import("../_chunks/build-kh5e3x48.js");
75
+ await buildProject(positionalRoot(args), {
76
+ adapter: adapterOption(args),
77
+ verbose: args.includes("--verbose"),
78
+ debugBuildPaths: optionString(args, "--debug-build-paths"),
79
+ buildMode: buildModeOption(args),
80
+ debugPrerender: args.includes("--debug-prerender")
81
+ });
82
+ await (await import("../_chunks/build-c991dv65.js")).stopCssWorker();
83
+ process.exit(0);
84
+ } else if (command === "start") {
85
+ warnUnknownFlags(command, args);
86
+ const root = positionalRoot(args);
87
+ const { start } = await prebundleServes(root) ? await import("./start.js") : await import(new URL("./start.ts", Bun.pathToFileURL(__PNEXT_PACKAGE_ROOT__ + "/src/cli/index.ts").href).href);
88
+ await start({
89
+ root,
90
+ port: optionNumber(args, "--port"),
91
+ hostname: optionString(args, "--hostname")
92
+ });
93
+ } else if (command === "analyze") {
94
+ warnUnknownFlags(command, args);
95
+ const { analyzeProject } = await import("../_chunks/analyze-4d9e00g9.js");
96
+ const { route, root } = analyzePositionals(args);
97
+ const result = await analyzeProject(root, {
98
+ compression: analyzeCompression(args),
99
+ route
100
+ });
101
+ if (args.includes("--json")) {
102
+ console.log(JSON.stringify(result, null, 2));
103
+ } else {
104
+ const { printAnalyzeResult } = await import("../_chunks/analyze-4d9e00g9.js");
105
+ printAnalyzeResult(result, { route, files: args.includes("--files") });
106
+ }
107
+ } else if (command === "typegen") {
108
+ warnUnknownFlags(command, args);
109
+ const { typegenProject } = await import("../_chunks/typegen-dvtcjtaw.js");
110
+ const result = await typegenProject(positionalRoot(args));
111
+ console.log(`Generated ${result.routes} route types, ${result.aliases} aliases, and ${result.checks} checks at ${result.file}`);
112
+ process.exit(0);
113
+ } else if (command === "create") {
114
+ warnUnknownFlags(command, args);
115
+ const { createApp } = await import("../_chunks/create-9rvwshsp.js");
116
+ await createApp(positionals(args)[0], { install: !args.includes("--no-install") });
117
+ process.exit(0);
118
+ } else if (command === "migrate") {
119
+ warnUnknownFlags(command, args);
120
+ const { migrateApp } = await import("../_chunks/run-d40d63ag.js");
121
+ const code = await migrateApp(positionalRoot(args), { dryRun: args.includes("--dry-run") });
122
+ process.exit(code);
123
+ } else if (command === "info") {
124
+ warnUnknownFlags(command, args);
125
+ printInfo();
126
+ } else {
127
+ printHelp();
128
+ process.exit(command ? 1 : 0);
129
+ }
130
+ } catch (error) {
131
+ const formatted = formatCliError(error);
132
+ if (formatted.message.trim())
133
+ console.error(formatted.message);
134
+ else
135
+ console.error(error instanceof Error ? error.stack ?? `${error.name}: ${error.message}` : String(error));
136
+ if (formatted.trace)
137
+ console.log(`
138
+ ${formatted.trace}`);
139
+ process.exit(1);
140
+ }
141
+ function formatCliError(error) {
142
+ const message = error instanceof Error ? error.message : String(error);
143
+ const traceStart = message.indexOf(`
144
+ pnext client import trace for route `);
145
+ if (traceStart === -1)
146
+ return { message };
147
+ return {
148
+ message: message.slice(0, traceStart),
149
+ trace: message.slice(traceStart + 1)
150
+ };
151
+ }
152
+ async function prebundleServes(root = process.cwd()) {
153
+ if (typeof { version: "0.1.8", fingerprint: "64aaa993cbaa58df", entries: ["cli/index", "cli/start", "client/reference", "api/client-cache", "compat/next/canonical-url", "compat/next/link-transform", "compat/next/client-navigation", "compat/next/og", "compat/next/link", "compat/next/usage", "compat/next/client-script", "compat/next/headers", "compat/next/custom-server", "compat/next/legacy-image", "compat/next/router", "compat/next/navigation", "compat/next/dist/server/web/spec-extension/unstable-no-store", "compat/next/dist/server/web/spec-extension/unstable-cache", "compat/next/dist/server/web/spec-extension/revalidate", "compat/next/dist/client/components/app-router-headers", "compat/next/web-vitals", "compat/next/root-params", "compat/next/route-state", "compat/next/server-only", "compat/next/client-server", "compat/next/legacy-request-apis", "compat/next/redirects", "compat/next/resource-hints", "compat/next/svgr", "compat/next/client-only", "compat/next/image/props", "compat/next/image/optimizer", "compat/next/image/validate", "compat/next/image/shared", "compat/next/image/patterns", "compat/next/image/config", "compat/next/image/client", "compat/next/image/static-metadata", "compat/next/user-agent", "compat/next/client-cache", "compat/next/head", "compat/next/dynamic", "compat/next/telemetry", "compat/next/offline", "compat/next/cache", "compat/next/constants", "compat/next/error", "compat/next/script", "compat/next/index", "compat/next/font/shared", "compat/next/font/runtime", "compat/next/font/google", "compat/next/font/cache", "compat/next/font/runtime-client", "compat/next/font/local", "compat/next/font/index", "compat/next/config-loader", "compat/next/config", "compat/next/image", "compat/next/server", "compat/next/rewrites", "compat/next/preferred-region", "compat/next/config-headers", "compat/next/form", "compat/react/dom", "compat/react/hooks-extra", "compat/react/react-server", "compat/react/dom-client", "compat/react/style-values", "compat/react/compiler-runtime", "compat/react/router-shim", "compat/react/dom-server", "compat/react/dom-react-server", "compat/react/server-component-use", "compat/react/action-state", "compat/react/client", "compat/react/client-lite", "compat/react/server-inserted-html", "compat/react/parity", "compat/react/preact", "compat/react/use", "compat/react/view-transition", "compat/react/internals", "compat/react/server"] } !== "object")
154
+ return true;
155
+ const [{ DEFAULT_OUT_DIR, standaloneOutSegment }, { buildIndexFile, readBuildIndex }] = await Promise.all([import("../_chunks/config-27rj7830.js"), import("../_chunks/production-385bw8df.js")]);
156
+ const outPath = path.resolve(root, DEFAULT_OUT_DIR, standaloneOutSegment);
157
+ return !existsSync(buildIndexFile(outPath)) || readBuildIndex(outPath).framework === { version: "0.1.8", fingerprint: "64aaa993cbaa58df", entries: ["cli/index", "cli/start", "client/reference", "api/client-cache", "compat/next/canonical-url", "compat/next/link-transform", "compat/next/client-navigation", "compat/next/og", "compat/next/link", "compat/next/usage", "compat/next/client-script", "compat/next/headers", "compat/next/custom-server", "compat/next/legacy-image", "compat/next/router", "compat/next/navigation", "compat/next/dist/server/web/spec-extension/unstable-no-store", "compat/next/dist/server/web/spec-extension/unstable-cache", "compat/next/dist/server/web/spec-extension/revalidate", "compat/next/dist/client/components/app-router-headers", "compat/next/web-vitals", "compat/next/root-params", "compat/next/route-state", "compat/next/server-only", "compat/next/client-server", "compat/next/legacy-request-apis", "compat/next/redirects", "compat/next/resource-hints", "compat/next/svgr", "compat/next/client-only", "compat/next/image/props", "compat/next/image/optimizer", "compat/next/image/validate", "compat/next/image/shared", "compat/next/image/patterns", "compat/next/image/config", "compat/next/image/client", "compat/next/image/static-metadata", "compat/next/user-agent", "compat/next/client-cache", "compat/next/head", "compat/next/dynamic", "compat/next/telemetry", "compat/next/offline", "compat/next/cache", "compat/next/constants", "compat/next/error", "compat/next/script", "compat/next/index", "compat/next/font/shared", "compat/next/font/runtime", "compat/next/font/google", "compat/next/font/cache", "compat/next/font/runtime-client", "compat/next/font/local", "compat/next/font/index", "compat/next/config-loader", "compat/next/config", "compat/next/image", "compat/next/server", "compat/next/rewrites", "compat/next/preferred-region", "compat/next/config-headers", "compat/next/form", "compat/react/dom", "compat/react/hooks-extra", "compat/react/react-server", "compat/react/dom-client", "compat/react/style-values", "compat/react/compiler-runtime", "compat/react/router-shim", "compat/react/dom-server", "compat/react/dom-react-server", "compat/react/server-component-use", "compat/react/action-state", "compat/react/client", "compat/react/client-lite", "compat/react/server-inserted-html", "compat/react/parity", "compat/react/preact", "compat/react/use", "compat/react/view-transition", "compat/react/internals", "compat/react/server"] }.fingerprint && VERSION === { version: "0.1.8", fingerprint: "64aaa993cbaa58df", entries: ["cli/index", "cli/start", "client/reference", "api/client-cache", "compat/next/canonical-url", "compat/next/link-transform", "compat/next/client-navigation", "compat/next/og", "compat/next/link", "compat/next/usage", "compat/next/client-script", "compat/next/headers", "compat/next/custom-server", "compat/next/legacy-image", "compat/next/router", "compat/next/navigation", "compat/next/dist/server/web/spec-extension/unstable-no-store", "compat/next/dist/server/web/spec-extension/unstable-cache", "compat/next/dist/server/web/spec-extension/revalidate", "compat/next/dist/client/components/app-router-headers", "compat/next/web-vitals", "compat/next/root-params", "compat/next/route-state", "compat/next/server-only", "compat/next/client-server", "compat/next/legacy-request-apis", "compat/next/redirects", "compat/next/resource-hints", "compat/next/svgr", "compat/next/client-only", "compat/next/image/props", "compat/next/image/optimizer", "compat/next/image/validate", "compat/next/image/shared", "compat/next/image/patterns", "compat/next/image/config", "compat/next/image/client", "compat/next/image/static-metadata", "compat/next/user-agent", "compat/next/client-cache", "compat/next/head", "compat/next/dynamic", "compat/next/telemetry", "compat/next/offline", "compat/next/cache", "compat/next/constants", "compat/next/error", "compat/next/script", "compat/next/index", "compat/next/font/shared", "compat/next/font/runtime", "compat/next/font/google", "compat/next/font/cache", "compat/next/font/runtime-client", "compat/next/font/local", "compat/next/font/index", "compat/next/config-loader", "compat/next/config", "compat/next/image", "compat/next/server", "compat/next/rewrites", "compat/next/preferred-region", "compat/next/config-headers", "compat/next/form", "compat/react/dom", "compat/react/hooks-extra", "compat/react/react-server", "compat/react/dom-client", "compat/react/style-values", "compat/react/compiler-runtime", "compat/react/router-shim", "compat/react/dom-server", "compat/react/dom-react-server", "compat/react/server-component-use", "compat/react/action-state", "compat/react/client", "compat/react/client-lite", "compat/react/server-inserted-html", "compat/react/parity", "compat/react/preact", "compat/react/use", "compat/react/view-transition", "compat/react/internals", "compat/react/server"] }.version;
158
+ }
159
+ function positionalRoot(args2) {
160
+ return positionals(args2)[0];
161
+ }
162
+ function analyzePositionals(args2) {
163
+ let route;
164
+ let root;
165
+ for (const arg of positionals(args2)) {
166
+ if (!route && arg.startsWith("/") && !isProjectDirectory(arg))
167
+ route = arg;
168
+ else
169
+ root ??= arg;
170
+ }
171
+ return { route, root };
172
+ }
173
+ function isProjectDirectory(candidate) {
174
+ if (!isDirectory(candidate))
175
+ return false;
176
+ return ["package.json", ".pnext", "app", path.join("src", "app")].some((entry) => existsSync(path.join(candidate, entry)));
177
+ }
178
+ function positionals(args2) {
179
+ const out = [];
180
+ for (let index = 0;index < args2.length; index += 1) {
181
+ const arg = args2[index];
182
+ if (!arg)
183
+ continue;
184
+ if (arg === "--port" || arg === "--adapter" || arg === "--hostname" || arg === "--debug-build-paths" || arg === "--experimental-build-mode") {
185
+ index += 1;
186
+ continue;
187
+ }
188
+ if (!arg.startsWith("--"))
189
+ out.push(arg);
190
+ }
191
+ return out;
192
+ }
193
+ function isDirectory(candidate) {
194
+ try {
195
+ return statSync(candidate).isDirectory();
196
+ } catch {
197
+ return false;
198
+ }
199
+ }
200
+ function optionNumber(args2, name) {
201
+ const index = args2.indexOf(name);
202
+ if (index === -1)
203
+ return;
204
+ const value = args2[index + 1];
205
+ return value ? Number(value) : undefined;
206
+ }
207
+ function optionString(args2, name) {
208
+ const inline = args2.find((arg) => arg.startsWith(`${name}=`));
209
+ if (inline !== undefined)
210
+ return inline.slice(name.length + 1);
211
+ const index = args2.indexOf(name);
212
+ if (index === -1)
213
+ return;
214
+ return args2[index + 1];
215
+ }
216
+ function buildModeOption(args2) {
217
+ const value = optionString(args2, "--experimental-build-mode");
218
+ if (value === "compile" || value === "generate")
219
+ return value;
220
+ if (value !== undefined) {
221
+ console.error(`error: option '--experimental-build-mode <mode>' argument '${value}' is invalid. Expected 'compile' or 'generate'.`);
222
+ process.exit(1);
223
+ }
224
+ return;
225
+ }
226
+ function adapterOption(args2) {
227
+ const index = args2.indexOf("--adapter");
228
+ if (index === -1)
229
+ return;
230
+ const adapter = args2[index + 1];
231
+ if (adapter === "vercel")
232
+ return adapter;
233
+ throw new Error(`Unsupported adapter: ${adapter ?? ""}`);
234
+ }
235
+ function analyzeCompression(args2) {
236
+ return args2.includes("--brotli") ? "brotli" : "gzip";
237
+ }
238
+ function packageVersion() {
239
+ const packageJson = JSON.parse(readFileSync(new URL("../../package.json", Bun.pathToFileURL(__PNEXT_PACKAGE_ROOT__ + "/src/cli/index.ts").href), "utf8"));
240
+ return typeof packageJson.version === "string" ? packageJson.version : "unknown";
241
+ }
242
+ function warnUnknownFlags(command2, args2) {
243
+ const flags = commandFlags(command2);
244
+ for (const arg of args2) {
245
+ if (!arg.startsWith("-") || arg === "--")
246
+ continue;
247
+ const name = arg.startsWith("--") ? arg.split("=", 1)[0] : arg;
248
+ if (!flags.has(name))
249
+ console.warn(`Warning: unknown option '${name}' was ignored.`);
250
+ }
251
+ }
252
+ function commandFlags(command2) {
253
+ const flags = new Set(["--help", "-h"]);
254
+ if (command2 === "dev" || command2 === "start") {
255
+ flags.add("--port");
256
+ flags.add("--hostname");
257
+ }
258
+ if (command2 === "build") {
259
+ for (const flag of [
260
+ "--adapter",
261
+ "--verbose",
262
+ "--experimental-build-mode",
263
+ "--debug-build-paths",
264
+ "--debug-prerender"
265
+ ])
266
+ flags.add(flag);
267
+ }
268
+ if (command2 === "analyze")
269
+ for (const flag of ["--json", "--files", "--brotli"])
270
+ flags.add(flag);
271
+ if (command2 === "create")
272
+ flags.add("--no-install");
273
+ if (command2 === "migrate")
274
+ flags.add("--dry-run");
275
+ return flags;
276
+ }
277
+ function printInfo() {
278
+ const config = configPresence(process.cwd());
279
+ console.log(`pnext info
280
+ pnext: ${VERSION}
281
+ bun: ${Bun.version}
282
+ os: ${process.platform} ${process.arch}
283
+ package manager: ${packageManager(process.cwd())}
284
+ pnext.config: ${config.pnext}
285
+ next.config: ${config.next}`);
286
+ }
287
+ function packageManager(root) {
288
+ if (existsSync(path.join(root, "bun.lock")) || existsSync(path.join(root, "bun.lockb")))
289
+ return "bun";
290
+ if (existsSync(path.join(root, "pnpm-lock.yaml")))
291
+ return "pnpm";
292
+ if (existsSync(path.join(root, "yarn.lock")))
293
+ return "yarn";
294
+ if (existsSync(path.join(root, "package-lock.json")))
295
+ return "npm";
296
+ return "unknown";
297
+ }
298
+ function configPresence(root) {
299
+ const find = (base) => {
300
+ const file = ["js", "mjs", "cjs", "ts"].map((extension) => `${base}.${extension}`).find((file2) => existsSync(path.join(root, file2)));
301
+ return file ?? "none";
302
+ };
303
+ return { pnext: find("pnext.config"), next: find("next.config") };
304
+ }
305
+ function printHelp() {
306
+ const commands = [
307
+ ["dev", "Start the development server."],
308
+ ["build", "Create a production build."],
309
+ ["start", "Start the production server."],
310
+ ["analyze", "Analyze production bundle output."],
311
+ ["typegen", "Generate route TypeScript definitions."],
312
+ ["create", "Create a new pnext application."],
313
+ ["migrate", "Migrate a Next.js application to pnext."],
314
+ ["info", "Print environment details for bug reports."]
315
+ ];
316
+ const flags = [
317
+ ["--port <port>", "Port to listen on (default: 3000)."],
318
+ ["--hostname <hostname>", "Hostname to listen on (default: 0.0.0.0)."],
319
+ ["--version, -v", "Print the pnext version."],
320
+ ["--help, -h", "Show this help message."]
321
+ ];
322
+ const row = ([name, text], width) => ` ${cyan(name.padEnd(width))} ${dim(text)}`;
323
+ console.log(`\u26A1 ${bold("pnext")} ${dim(VERSION)}
324
+
325
+ ${bold("Usage:")} pnext ${cyan("<command>")} [options]
326
+
327
+ ${bold("Commands:")}
328
+ ${commands.map((entry) => row(entry, 9)).join(`
329
+ `)}
330
+
331
+ ${bold("Common flags:")}
332
+ ${flags.map((entry) => row(entry, 21)).join(`
333
+ `)}
334
+
335
+ ${bold("Docs:")} ${cyan("https://pnext.dev")}`);
336
+ }
337
+ function printCommandHelp(command2) {
338
+ const help = {
339
+ dev: `Usage: pnext dev [directory] [options]
340
+
341
+ Flags:
342
+ --port <port> Port to listen on (default: 3000).
343
+ --hostname <hostname> Hostname to listen on (default: 0.0.0.0).`,
344
+ build: `Usage: pnext build [directory] [options]
345
+
346
+ Flags:
347
+ --adapter <adapter> Deployment adapter (vercel).
348
+ --verbose Print detailed build output.
349
+ --experimental-build-mode <mode> Build mode: compile or generate.
350
+ --debug-build-paths <patterns> Build matching routes only.
351
+ --debug-prerender Debug prerender failures.`,
352
+ start: `Usage: pnext start [directory] [options]
353
+
354
+ Flags:
355
+ --port <port> Port to listen on (default: 3000).
356
+ --hostname <hostname> Hostname to listen on (default: 0.0.0.0).`,
357
+ analyze: `Usage: pnext analyze [route] [directory] [options]
358
+
359
+ Flags:
360
+ --json Print JSON output.
361
+ --files Include individual files.
362
+ --brotli Report Brotli compression.`,
363
+ typegen: "Usage: pnext typegen [directory]",
364
+ create: `Usage: pnext create <directory> [options]
365
+
366
+ Flags:
367
+ --no-install Skip dependency installation.`,
368
+ migrate: `Usage: pnext migrate [directory] [options]
369
+
370
+ Flags:
371
+ --dry-run Preview changes without writing.`,
372
+ info: "Usage: pnext info"
373
+ };
374
+ console.log(help[command2]);
375
+ }
@@ -0,0 +1,158 @@
1
+ // @bun
2
+ import {
3
+ browserHost,
4
+ ensurePortFree,
5
+ openBrowser,
6
+ printServerReady
7
+ } from "../_chunks/index-q738kkhj.js";
8
+ import {
9
+ bootstrapCompat
10
+ } from "../_chunks/index-tq3b39a5.js";
11
+ import {
12
+ loadConfig
13
+ } from "../_chunks/index-71885zaq.js";
14
+ import"../_chunks/index-bzd2ef7t.js";
15
+ import {
16
+ markErrorLogged
17
+ } from "../_chunks/index-jcsjq3d1.js";
18
+ import {
19
+ buildIndexFile,
20
+ buildManifestFile,
21
+ linkStandaloneOrigins,
22
+ registerPrebundleResolve
23
+ } from "../_chunks/index-hdbwtdv2.js";
24
+ import"../_chunks/index-6kp9r0d9.js";
25
+ import {
26
+ drainWorkUnits
27
+ } from "../_chunks/index-grta8ap3.js";
28
+ import"../_chunks/index-kresp2n8.js";
29
+ import {
30
+ isPostpone
31
+ } from "../_chunks/index-e3a6yx84.js";
32
+ import"../_chunks/index-pym1cezq.js";
33
+ import"../_chunks/index-jt8e1pje.js";
34
+ import {
35
+ getBuildExtensions
36
+ } from "../_chunks/index-zqpqyg8p.js";
37
+ import"../_chunks/index-qjj6gddn.js";
38
+ import {
39
+ __require
40
+ } from "../_chunks/index-rt9qq1va.js";
41
+
42
+ // src/cli/start.ts
43
+ import { existsSync } from "fs";
44
+ import { readFile } from "fs/promises";
45
+ import path from "path";
46
+ import { pathToFileURL } from "url";
47
+ async function createRequestHandler(options = {}) {
48
+ registerPrebundleResolve();
49
+ const config = options.config ?? await loadConfig(options.root, { serve: true });
50
+ if (shipsElsewhere(config)) {
51
+ const shipped = await shippedStart(config);
52
+ return shipped.createRequestHandler({ root: options.root, manifest: options.manifest });
53
+ }
54
+ const { createRequestHandler: create } = await import("../_chunks/pipeline-4t9q43ht.js");
55
+ return create({ ...options, config });
56
+ }
57
+ function shipsElsewhere(config) {
58
+ return existsSync(buildIndexFile(config.outPath)) && !linkStandaloneOrigins(config.outPath);
59
+ }
60
+ function shippedStart(config) {
61
+ const entry = pathToFileURL(path.join(config.outPath, "server", "entry.js")).href;
62
+ return import(entry);
63
+ }
64
+ async function maybeBuiltFile(...args) {
65
+ const { maybeBuiltFile: impl } = await import("../_chunks/pipeline-4t9q43ht.js");
66
+ return impl(...args);
67
+ }
68
+ async function start(options = {}) {
69
+ const startedAt = Date.now();
70
+ const port = options.port ?? 3000;
71
+ const hostname = options.hostname ?? "0.0.0.0";
72
+ const config = await loadConfig(options.root, { serve: true });
73
+ if (shipsElsewhere(config)) {
74
+ await (await shippedStart(config)).start(options);
75
+ return;
76
+ }
77
+ await guardUnservableOutputMode(config);
78
+ const manifest = await readProductionManifest(config);
79
+ await ensurePortFree(port, hostname);
80
+ let handler;
81
+ let pending;
82
+ const ensureHandler = () => pending ??= createRequestHandler({ root: options.root, config, manifest }).then((ready) => {
83
+ handler = ready;
84
+ return ready;
85
+ });
86
+ const server = Bun.serve({
87
+ hostname,
88
+ port,
89
+ fetch: (request, server2) => handler ? handler(request, server2) : ensureHandler().then((ready) => ready(request, server2))
90
+ });
91
+ printServerReady({
92
+ mode: "production",
93
+ hostname,
94
+ port: server.port ?? port,
95
+ elapsedMs: Date.now() - startedAt
96
+ });
97
+ ensureHandler().catch(() => {
98
+ return;
99
+ });
100
+ openBrowser(`http://${browserHost(hostname)}:${server.port ?? port}`);
101
+ installShutdownHandlers(server);
102
+ installProcessErrorHandlers();
103
+ return server;
104
+ }
105
+ function installProcessErrorHandlers() {
106
+ const globalWithFlag = globalThis;
107
+ if (globalWithFlag.__pnextProcessErrorHandlers)
108
+ return;
109
+ globalWithFlag.__pnextProcessErrorHandlers = true;
110
+ const report = (reason) => {
111
+ if (isPostpone(reason))
112
+ return;
113
+ if (markErrorLogged(reason))
114
+ console.error(reason);
115
+ };
116
+ process.on("unhandledRejection", report);
117
+ process.on("uncaughtException", report);
118
+ }
119
+ async function readProductionManifest(config) {
120
+ try {
121
+ return JSON.parse(await readFile(buildManifestFile(config.outPath), "utf8"));
122
+ } catch (error) {
123
+ if (error.code === "ENOENT") {
124
+ throw new Error("No production build found. Run 'pnext build' first.");
125
+ }
126
+ throw error;
127
+ }
128
+ }
129
+ async function guardUnservableOutputMode(config) {
130
+ await bootstrapCompat(config);
131
+ const mode = getBuildExtensions().compat.nextOutputMode();
132
+ if (mode === "export") {
133
+ console.error('"next start" does not work with "output: export" configuration. Use "npx serve@latest out" instead.');
134
+ process.exit(1);
135
+ }
136
+ if (mode === "standalone" && !process.env.__NEXT_PRIVATE_STANDALONE_CONFIG) {
137
+ console.warn('"next start" does not work with "output: standalone" configuration. Use "node .next/standalone/server.js" instead.');
138
+ }
139
+ }
140
+ function installShutdownHandlers(server) {
141
+ let shuttingDown = false;
142
+ const shutdown = async () => {
143
+ if (shuttingDown)
144
+ return;
145
+ shuttingDown = true;
146
+ server.stop();
147
+ await drainWorkUnits();
148
+ process.exit(0);
149
+ };
150
+ process.on("SIGINT", shutdown);
151
+ process.on("SIGTERM", shutdown);
152
+ }
153
+ export {
154
+ createRequestHandler,
155
+ maybeBuiltFile,
156
+ readProductionManifest,
157
+ start
158
+ };
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ import {
3
+ clientReferenceId,
4
+ clientReferenceSymbol,
5
+ compiledClientReferenceFiles,
6
+ noteCompiledClientReference,
7
+ ssrClientReference
8
+ } from "../_chunks/index-ras0sdab.js";
9
+ import"../_chunks/index-rt9qq1va.js";
10
+ export {
11
+ clientReferenceId,
12
+ clientReferenceSymbol,
13
+ compiledClientReferenceFiles,
14
+ noteCompiledClientReference,
15
+ ssrClientReference
16
+ };