resuxjs 0.4.0-beta.6 → 0.4.0-beta.7

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 (399) hide show
  1. package/README.md +55 -13
  2. package/dist/bin.d.ts +1 -1
  3. package/dist/bin.js +2 -4
  4. package/dist/bin.js.map +1 -1
  5. package/dist/build/index.d.ts +8 -11
  6. package/dist/build/index.js +3 -4
  7. package/dist/build/index.js.map +1 -1
  8. package/dist/cli.d.ts +7 -8
  9. package/dist/cli.js +170 -135
  10. package/dist/cli.js.map +1 -1
  11. package/dist/compiler/adapter.d.ts +5 -8
  12. package/dist/compiler/adapter.js +2 -4
  13. package/dist/compiler/adapter.js.map +1 -1
  14. package/dist/compiler/dev-warnings.d.ts +5 -8
  15. package/dist/compiler/dev-warnings.js +7 -9
  16. package/dist/compiler/dev-warnings.js.map +1 -1
  17. package/dist/compiler/directives.d.ts +3 -6
  18. package/dist/compiler/directives.js +2 -4
  19. package/dist/compiler/directives.js.map +1 -1
  20. package/dist/compiler/implementation.d.ts +22 -24
  21. package/dist/compiler/implementation.js +140 -129
  22. package/dist/compiler/index.d.ts +5 -8
  23. package/dist/compiler/index.js +2 -4
  24. package/dist/compiler/index.js.map +1 -1
  25. package/dist/core/config.d.ts +5 -9
  26. package/dist/core/config.js +2 -3
  27. package/dist/core/config.js.map +1 -1
  28. package/dist/core/hooks.d.ts +6 -9
  29. package/dist/core/hooks.js +2 -3
  30. package/dist/core/hooks.js.map +1 -1
  31. package/dist/core/index.d.ts +1 -1
  32. package/dist/core/index.js +1 -2
  33. package/dist/core/module-container.d.ts +20 -24
  34. package/dist/core/module-container.js +4 -5
  35. package/dist/core/module-container.js.map +1 -1
  36. package/dist/core/resux.d.ts +4 -8
  37. package/dist/core/resux.js +2 -4
  38. package/dist/core/resux.js.map +1 -1
  39. package/dist/create-bin.d.ts +1 -1
  40. package/dist/create-bin.js +2 -4
  41. package/dist/create-bin.js.map +1 -1
  42. package/dist/create.d.ts +2 -5
  43. package/dist/create.js +15 -10
  44. package/dist/create.js.map +1 -1
  45. package/dist/deploy/cloudflare.d.ts +1 -5
  46. package/dist/deploy/cloudflare.js +2 -4
  47. package/dist/deploy/cloudflare.js.map +1 -1
  48. package/dist/deploy/common.d.ts +12 -15
  49. package/dist/deploy/common.js +2 -4
  50. package/dist/deploy/common.js.map +1 -1
  51. package/dist/deploy/framework-runtime.d.ts +1 -4
  52. package/dist/deploy/framework-runtime.js +2 -4
  53. package/dist/deploy/framework-runtime.js.map +1 -1
  54. package/dist/deploy/index.d.ts +2 -6
  55. package/dist/deploy/index.js +7 -6
  56. package/dist/deploy/index.js.map +1 -1
  57. package/dist/deploy/netlify.d.ts +1 -5
  58. package/dist/deploy/netlify.js +3 -5
  59. package/dist/deploy/netlify.js.map +1 -1
  60. package/dist/deploy/node.d.ts +1 -5
  61. package/dist/deploy/node.js +4 -5
  62. package/dist/deploy/node.js.map +1 -1
  63. package/dist/deploy/production-report.d.ts +1 -4
  64. package/dist/deploy/production-report.js +2 -4
  65. package/dist/deploy/production-report.js.map +1 -1
  66. package/dist/deploy/runtime-dependencies.d.ts +4 -7
  67. package/dist/deploy/runtime-dependencies.js +4 -5
  68. package/dist/deploy/runtime-dependencies.js.map +1 -1
  69. package/dist/deploy/static.d.ts +1 -5
  70. package/dist/deploy/static.js +2 -4
  71. package/dist/deploy/static.js.map +1 -1
  72. package/dist/deploy/types.d.ts +7 -10
  73. package/dist/deploy/types.js +1 -1
  74. package/dist/deploy/vercel.d.ts +2 -6
  75. package/dist/deploy/vercel.js +3 -5
  76. package/dist/deploy/vercel.js.map +1 -1
  77. package/dist/fonts/index.d.ts +60 -11
  78. package/dist/fonts/index.js +422 -46
  79. package/dist/fonts/index.js.map +1 -1
  80. package/dist/globals.d.ts +1 -3
  81. package/dist/globals.js +1 -1
  82. package/dist/halal-core/ai/classifyProject.d.ts +3 -7
  83. package/dist/halal-core/ai/classifyProject.js +2 -4
  84. package/dist/halal-core/ai/classifyProject.js.map +1 -1
  85. package/dist/halal-core/ai/classifyRuntimeContent.d.ts +1 -5
  86. package/dist/halal-core/ai/classifyRuntimeContent.js +3 -5
  87. package/dist/halal-core/ai/classifyRuntimeContent.js.map +1 -1
  88. package/dist/halal-core/ai/createProjectSummary.d.ts +1 -4
  89. package/dist/halal-core/ai/createProjectSummary.js +2 -4
  90. package/dist/halal-core/ai/createProjectSummary.js.map +1 -1
  91. package/dist/halal-core/ai/halalClassifierPrompt.d.ts +1 -4
  92. package/dist/halal-core/ai/halalClassifierPrompt.js +2 -3
  93. package/dist/halal-core/ai/redactSensitiveData.d.ts +1 -4
  94. package/dist/halal-core/ai/redactSensitiveData.js +2 -3
  95. package/dist/halal-core/ai/redactSensitiveData.js.map +1 -1
  96. package/dist/halal-core/ai/validateAiResponse.d.ts +1 -5
  97. package/dist/halal-core/ai/validateAiResponse.js +4 -5
  98. package/dist/halal-core/ai/validateAiResponse.js.map +1 -1
  99. package/dist/halal-core/cli/check.d.ts +1 -4
  100. package/dist/halal-core/cli/check.js +5 -6
  101. package/dist/halal-core/cli/check.js.map +1 -1
  102. package/dist/halal-core/cli/explain.d.ts +1 -4
  103. package/dist/halal-core/cli/explain.js +5 -6
  104. package/dist/halal-core/cli/explain.js.map +1 -1
  105. package/dist/halal-core/cli/report.d.ts +1 -4
  106. package/dist/halal-core/cli/report.js +5 -6
  107. package/dist/halal-core/cli/report.js.map +1 -1
  108. package/dist/halal-core/cli/submitReview.d.ts +1 -4
  109. package/dist/halal-core/cli/submitReview.js +5 -6
  110. package/dist/halal-core/cli/submitReview.js.map +1 -1
  111. package/dist/halal-core/cli/verifyReview.d.ts +1 -4
  112. package/dist/halal-core/cli/verifyReview.js +7 -7
  113. package/dist/halal-core/cli/verifyReview.js.map +1 -1
  114. package/dist/halal-core/config.d.ts +9 -11
  115. package/dist/halal-core/config.js +46 -11
  116. package/dist/halal-core/config.js.map +1 -1
  117. package/dist/halal-core/crypto/integrity.d.ts +5 -8
  118. package/dist/halal-core/crypto/integrity.js +2 -4
  119. package/dist/halal-core/crypto/integrity.js.map +1 -1
  120. package/dist/halal-core/enforce.d.ts +5 -8
  121. package/dist/halal-core/enforce.js +17 -16
  122. package/dist/halal-core/enforce.js.map +1 -1
  123. package/dist/halal-core/index.d.ts +6 -6
  124. package/dist/halal-core/index.js +8 -9
  125. package/dist/halal-core/lifecycle.d.ts +1 -4
  126. package/dist/halal-core/lifecycle.js +2 -4
  127. package/dist/halal-core/lifecycle.js.map +1 -1
  128. package/dist/halal-core/policy.d.ts +1 -5
  129. package/dist/halal-core/policy.js +2 -4
  130. package/dist/halal-core/policy.js.map +1 -1
  131. package/dist/halal-core/report/formatBrowserOverlay.d.ts +1 -5
  132. package/dist/halal-core/report/formatBrowserOverlay.js +2 -3
  133. package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -1
  134. package/dist/halal-core/report/formatTerminalReport.d.ts +1 -5
  135. package/dist/halal-core/report/formatTerminalReport.js +2 -3
  136. package/dist/halal-core/report/formatTerminalReport.js.map +1 -1
  137. package/dist/halal-core/report/generateHalalReport.d.ts +2 -6
  138. package/dist/halal-core/report/generateHalalReport.js +8 -7
  139. package/dist/halal-core/report/generateHalalReport.js.map +1 -1
  140. package/dist/halal-core/report/signReport.d.ts +2 -6
  141. package/dist/halal-core/report/signReport.js +2 -4
  142. package/dist/halal-core/report/signReport.js.map +1 -1
  143. package/dist/halal-core/report/verifyReport.d.ts +3 -7
  144. package/dist/halal-core/report/verifyReport.js +4 -6
  145. package/dist/halal-core/report/verifyReport.js.map +1 -1
  146. package/dist/halal-core/review/createReviewRequest.d.ts +1 -5
  147. package/dist/halal-core/review/createReviewRequest.js +4 -5
  148. package/dist/halal-core/review/createReviewRequest.js.map +1 -1
  149. package/dist/halal-core/review/reviewPolicy.d.ts +3 -6
  150. package/dist/halal-core/review/reviewPolicy.js +2 -3
  151. package/dist/halal-core/review/reviewPolicy.js.map +1 -1
  152. package/dist/halal-core/review/signedReviewFile.d.ts +4 -8
  153. package/dist/halal-core/review/signedReviewFile.js +2 -4
  154. package/dist/halal-core/review/signedReviewFile.js.map +1 -1
  155. package/dist/halal-core/review/verifyReviewApproval.d.ts +2 -5
  156. package/dist/halal-core/review/verifyReviewApproval.js +2 -4
  157. package/dist/halal-core/review/verifyReviewApproval.js.map +1 -1
  158. package/dist/halal-core/rules/adultContentRules.d.ts +2 -5
  159. package/dist/halal-core/rules/adultContentRules.js +2 -3
  160. package/dist/halal-core/rules/adultContentRules.js.map +1 -1
  161. package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +2 -5
  162. package/dist/halal-core/rules/alcoholDrugVapeRules.js +2 -3
  163. package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -1
  164. package/dist/halal-core/rules/childSafetyRules.d.ts +2 -5
  165. package/dist/halal-core/rules/childSafetyRules.js +2 -3
  166. package/dist/halal-core/rules/childSafetyRules.js.map +1 -1
  167. package/dist/halal-core/rules/coreCategories.d.ts +2 -5
  168. package/dist/halal-core/rules/coreCategories.js +2 -3
  169. package/dist/halal-core/rules/coreCategories.js.map +1 -1
  170. package/dist/halal-core/rules/cyberAbuseRules.d.ts +2 -5
  171. package/dist/halal-core/rules/cyberAbuseRules.js +2 -3
  172. package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -1
  173. package/dist/halal-core/rules/defaultBlockedRules.d.ts +1 -5
  174. package/dist/halal-core/rules/defaultBlockedRules.js +12 -11
  175. package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -1
  176. package/dist/halal-core/rules/dependencyRules.d.ts +2 -5
  177. package/dist/halal-core/rules/dependencyRules.js +2 -3
  178. package/dist/halal-core/rules/dependencyRules.js.map +1 -1
  179. package/dist/halal-core/rules/endpointRules.d.ts +2 -5
  180. package/dist/halal-core/rules/endpointRules.js +2 -3
  181. package/dist/halal-core/rules/endpointRules.js.map +1 -1
  182. package/dist/halal-core/rules/environmentalHarmRules.d.ts +2 -5
  183. package/dist/halal-core/rules/environmentalHarmRules.js +2 -3
  184. package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -1
  185. package/dist/halal-core/rules/financeRibaRules.d.ts +2 -5
  186. package/dist/halal-core/rules/financeRibaRules.js +2 -3
  187. package/dist/halal-core/rules/financeRibaRules.js.map +1 -1
  188. package/dist/halal-core/rules/gamblingRules.d.ts +2 -5
  189. package/dist/halal-core/rules/gamblingRules.js +2 -3
  190. package/dist/halal-core/rules/gamblingRules.js.map +1 -1
  191. package/dist/halal-core/rules/generalHarmRules.d.ts +2 -5
  192. package/dist/halal-core/rules/generalHarmRules.js +2 -3
  193. package/dist/halal-core/rules/generalHarmRules.js.map +1 -1
  194. package/dist/halal-core/rules/healthHarmRules.d.ts +2 -5
  195. package/dist/halal-core/rules/healthHarmRules.js +2 -3
  196. package/dist/halal-core/rules/healthHarmRules.js.map +1 -1
  197. package/dist/halal-core/rules/keywordRules.d.ts +1 -4
  198. package/dist/halal-core/rules/keywordRules.js +2 -3
  199. package/dist/halal-core/rules/keywordRules.js.map +1 -1
  200. package/dist/halal-core/rules/privacyAbuseRules.d.ts +2 -5
  201. package/dist/halal-core/rules/privacyAbuseRules.js +2 -3
  202. package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -1
  203. package/dist/halal-core/rules/scamFraudRules.d.ts +2 -5
  204. package/dist/halal-core/rules/scamFraudRules.js +2 -3
  205. package/dist/halal-core/rules/scamFraudRules.js.map +1 -1
  206. package/dist/halal-core/rules/selfHarmRules.d.ts +2 -5
  207. package/dist/halal-core/rules/selfHarmRules.js +2 -3
  208. package/dist/halal-core/rules/selfHarmRules.js.map +1 -1
  209. package/dist/halal-core/rules/violenceExtremismRules.d.ts +2 -5
  210. package/dist/halal-core/rules/violenceExtremismRules.js +2 -3
  211. package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -1
  212. package/dist/halal-core/runtime/guard.d.ts +3 -7
  213. package/dist/halal-core/runtime/guard.js +5 -7
  214. package/dist/halal-core/runtime/guard.js.map +1 -1
  215. package/dist/halal-core/runtime/index.js +1 -2
  216. package/dist/halal-core/runtime/reviewedMemory.d.ts +4 -8
  217. package/dist/halal-core/runtime/reviewedMemory.js +3 -5
  218. package/dist/halal-core/runtime/reviewedMemory.js.map +1 -1
  219. package/dist/halal-core/runtime/serializeRuntimeContent.d.ts +5 -9
  220. package/dist/halal-core/runtime/serializeRuntimeContent.js +4 -6
  221. package/dist/halal-core/runtime/serializeRuntimeContent.js.map +1 -1
  222. package/dist/halal-core/runtime/types.d.ts +9 -13
  223. package/dist/halal-core/runtime/types.js +1 -1
  224. package/dist/halal-core/scanner/scanApiRoutes.d.ts +1 -4
  225. package/dist/halal-core/scanner/scanApiRoutes.js +2 -4
  226. package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -1
  227. package/dist/halal-core/scanner/scanComponents.d.ts +1 -4
  228. package/dist/halal-core/scanner/scanComponents.js +2 -4
  229. package/dist/halal-core/scanner/scanComponents.js.map +1 -1
  230. package/dist/halal-core/scanner/scanContent.d.ts +2 -5
  231. package/dist/halal-core/scanner/scanContent.js +4 -6
  232. package/dist/halal-core/scanner/scanContent.js.map +1 -1
  233. package/dist/halal-core/scanner/scanDependencies.d.ts +1 -4
  234. package/dist/halal-core/scanner/scanDependencies.js +2 -4
  235. package/dist/halal-core/scanner/scanDependencies.js.map +1 -1
  236. package/dist/halal-core/scanner/scanDomains.d.ts +1 -4
  237. package/dist/halal-core/scanner/scanDomains.js +2 -3
  238. package/dist/halal-core/scanner/scanDomains.js.map +1 -1
  239. package/dist/halal-core/scanner/scanEnvNames.d.ts +1 -4
  240. package/dist/halal-core/scanner/scanEnvNames.js +2 -4
  241. package/dist/halal-core/scanner/scanEnvNames.js.map +1 -1
  242. package/dist/halal-core/scanner/scanMetadata.d.ts +2 -5
  243. package/dist/halal-core/scanner/scanMetadata.js +2 -4
  244. package/dist/halal-core/scanner/scanMetadata.js.map +1 -1
  245. package/dist/halal-core/scanner/scanPages.d.ts +1 -4
  246. package/dist/halal-core/scanner/scanPages.js +2 -4
  247. package/dist/halal-core/scanner/scanPages.js.map +1 -1
  248. package/dist/halal-core/scanner/scanProject.d.ts +2 -6
  249. package/dist/halal-core/scanner/scanProject.js +2 -4
  250. package/dist/halal-core/scanner/scanProject.js.map +1 -1
  251. package/dist/halal-core/scanner/scanRoutes.d.ts +1 -4
  252. package/dist/halal-core/scanner/scanRoutes.js +2 -4
  253. package/dist/halal-core/scanner/scanRoutes.js.map +1 -1
  254. package/dist/halal-core/scanner/scanTranslations.d.ts +1 -4
  255. package/dist/halal-core/scanner/scanTranslations.js +2 -4
  256. package/dist/halal-core/scanner/scanTranslations.js.map +1 -1
  257. package/dist/halal-core/status.d.ts +2 -5
  258. package/dist/halal-core/status.js +1 -1
  259. package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +1 -4
  260. package/dist/halal-core/tamper/verifyCoreIntegrity.js +2 -4
  261. package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -1
  262. package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +1 -4
  263. package/dist/halal-core/tamper/verifyLifecycleHooks.js +2 -3
  264. package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -1
  265. package/dist/halal-core/tamper/verifyReportSignature.d.ts +1 -5
  266. package/dist/halal-core/tamper/verifyReportSignature.js +4 -5
  267. package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -1
  268. package/dist/halal.d.ts +2 -2
  269. package/dist/halal.js +2 -3
  270. package/dist/i18n/index.d.ts +11 -14
  271. package/dist/i18n/index.js +9 -9
  272. package/dist/i18n/index.js.map +1 -1
  273. package/dist/i18n/shared.d.ts +14 -17
  274. package/dist/i18n/shared.js +5 -6
  275. package/dist/i18n/shared.js.map +1 -1
  276. package/dist/icons/api-fetcher.d.ts +4 -0
  277. package/dist/icons/api-fetcher.js +77 -0
  278. package/dist/icons/api-fetcher.js.map +1 -0
  279. package/dist/icons/cache.d.ts +22 -0
  280. package/dist/icons/cache.js +74 -0
  281. package/dist/icons/cache.js.map +1 -0
  282. package/dist/icons/component.d.ts +157 -0
  283. package/dist/icons/component.js +139 -0
  284. package/dist/icons/component.js.map +1 -0
  285. package/dist/icons/constants.d.ts +14 -0
  286. package/dist/icons/constants.js +16 -0
  287. package/dist/icons/constants.js.map +1 -0
  288. package/dist/icons/css-mode.d.ts +7 -0
  289. package/dist/icons/css-mode.js +51 -0
  290. package/dist/icons/css-mode.js.map +1 -0
  291. package/dist/icons/index.d.ts +14 -152
  292. package/dist/icons/index.js +30 -286
  293. package/dist/icons/index.js.map +1 -1
  294. package/dist/icons/local-svg.d.ts +5 -0
  295. package/dist/icons/local-svg.js +53 -0
  296. package/dist/icons/local-svg.js.map +1 -0
  297. package/dist/icons/normalize.d.ts +5 -0
  298. package/dist/icons/normalize.js +63 -0
  299. package/dist/icons/normalize.js.map +1 -0
  300. package/dist/icons/offline-loader.d.ts +21 -0
  301. package/dist/icons/offline-loader.js +94 -0
  302. package/dist/icons/offline-loader.js.map +1 -0
  303. package/dist/icons/parser.d.ts +5 -0
  304. package/dist/icons/parser.js +89 -0
  305. package/dist/icons/parser.js.map +1 -0
  306. package/dist/icons/registry.d.ts +6 -21
  307. package/dist/icons/registry.js +82 -75
  308. package/dist/icons/registry.js.map +1 -1
  309. package/dist/icons/resolver.d.ts +4 -0
  310. package/dist/icons/resolver.js +45 -0
  311. package/dist/icons/resolver.js.map +1 -0
  312. package/dist/icons/svg-mode.d.ts +4 -0
  313. package/dist/icons/svg-mode.js +54 -0
  314. package/dist/icons/svg-mode.js.map +1 -0
  315. package/dist/icons/transform.d.ts +11 -0
  316. package/dist/icons/transform.js +68 -0
  317. package/dist/icons/transform.js.map +1 -0
  318. package/dist/icons/types.d.ts +49 -0
  319. package/dist/icons/types.js +1 -0
  320. package/dist/index.d.ts +4 -2
  321. package/dist/index.js +2 -2
  322. package/dist/kit/index.d.ts +21 -25
  323. package/dist/kit/index.js +2 -4
  324. package/dist/kit/index.js.map +1 -1
  325. package/dist/nitro-server/index.d.ts +2 -5
  326. package/dist/nitro-server/index.js +2 -3
  327. package/dist/nitro-server/index.js.map +1 -1
  328. package/dist/node.d.ts +2 -6
  329. package/dist/node.js +7 -9
  330. package/dist/node.js.map +1 -1
  331. package/dist/reactivity/computed.d.ts +3 -7
  332. package/dist/reactivity/computed.js +4 -5
  333. package/dist/reactivity/computed.js.map +1 -1
  334. package/dist/reactivity/effect.d.ts +13 -17
  335. package/dist/reactivity/effect.js +11 -11
  336. package/dist/reactivity/effect.js.map +1 -1
  337. package/dist/reactivity/index.d.ts +1 -1
  338. package/dist/reactivity/index.js +3 -4
  339. package/dist/reactivity/reactive.d.ts +5 -8
  340. package/dist/reactivity/reactive.js +5 -7
  341. package/dist/reactivity/reactive.js.map +1 -1
  342. package/dist/reactivity/readonly.js +1 -3
  343. package/dist/reactivity/ref.d.ts +9 -12
  344. package/dist/reactivity/ref.js +6 -5
  345. package/dist/reactivity/ref.js.map +1 -1
  346. package/dist/reactivity/scheduler.d.ts +5 -7
  347. package/dist/reactivity/scheduler.js +2 -3
  348. package/dist/reactivity/scheduler.js.map +1 -1
  349. package/dist/reactivity/types.d.ts +11 -14
  350. package/dist/reactivity/types.js +1 -1
  351. package/dist/reactivity/utils.d.ts +9 -12
  352. package/dist/reactivity/utils.js +2 -3
  353. package/dist/reactivity/utils.js.map +1 -1
  354. package/dist/reactivity/watch.d.ts +3 -6
  355. package/dist/reactivity/watch.js +7 -7
  356. package/dist/reactivity/watch.js.map +1 -1
  357. package/dist/runtime/core.d.ts +4 -20
  358. package/dist/runtime/core.js +11 -24
  359. package/dist/runtime/core.js.map +1 -1
  360. package/dist/runtime/index.d.ts +162 -158
  361. package/dist/runtime/index.js +2749 -1025
  362. package/dist/runtime/index.js.map +1 -1
  363. package/dist/runtime/reactivity.d.ts +4 -4
  364. package/dist/runtime/reactivity.js +2 -3
  365. package/dist/runtime/resume.d.ts +14 -51
  366. package/dist/runtime/resume.js +4 -34
  367. package/dist/runtime/resume.js.map +1 -1
  368. package/dist/runtime/router.d.ts +5 -17
  369. package/dist/runtime/router.js +7 -17
  370. package/dist/runtime/router.js.map +1 -1
  371. package/dist/runtime/streaming.d.ts +6 -13
  372. package/dist/runtime/streaming.js +4 -9
  373. package/dist/runtime/streaming.js.map +1 -1
  374. package/dist/runtime/view-transitions/detect.d.ts +11 -0
  375. package/dist/runtime/view-transitions/detect.js +16 -0
  376. package/dist/runtime/view-transitions/detect.js.map +1 -0
  377. package/dist/runtime/view-transitions/index.d.ts +4 -0
  378. package/dist/runtime/view-transitions/index.js +3 -0
  379. package/dist/runtime/view-transitions/transition.d.ts +4 -0
  380. package/dist/runtime/view-transitions/transition.js +41 -0
  381. package/dist/runtime/view-transitions/transition.js.map +1 -0
  382. package/dist/runtime/view-transitions/types.d.ts +8 -0
  383. package/dist/runtime/view-transitions/types.js +1 -0
  384. package/dist/security/media-fetch.d.ts +10 -13
  385. package/dist/security/media-fetch.js +5 -7
  386. package/dist/security/media-fetch.js.map +1 -1
  387. package/dist/security/path-boundary.d.ts +4 -7
  388. package/dist/security/path-boundary.js +2 -4
  389. package/dist/security/path-boundary.js.map +1 -1
  390. package/dist/ui/index.d.ts +367 -217
  391. package/dist/ui/index.js +199 -152
  392. package/dist/ui/index.js.map +1 -1
  393. package/dist/ui/verification-code.d.ts +134 -0
  394. package/dist/ui/verification-code.js +472 -0
  395. package/dist/ui/verification-code.js.map +1 -0
  396. package/dist/vite-builder/index.d.ts +2 -5
  397. package/dist/vite-builder/index.js +2 -3
  398. package/dist/vite-builder/index.js.map +1 -1
  399. package/package.json +5 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/deploy/index.ts"],"sourcesContent":["import {\n detectDeployProviderFromEnv,\n loadResuxDeployConfig,\n normalizeProviderPreset,\n} from \"./common.js\";\nimport { cloudflareDeployModule } from \"./cloudflare.js\";\nimport { netlifyDeployModule } from \"./netlify.js\";\nimport { nodeDeployModule } from \"./node.js\";\nimport { staticDeployModule } from \"./static.js\";\nimport type {\n DeployBuildContext,\n DeployDetectionContext,\n DeploymentResolution,\n DeployTargetModule,\n ResuxResolvedDeployTarget,\n} from \"./types.js\";\nimport { vercelDeployModule } from \"./vercel.js\";\n\nconst deployModules: DeployTargetModule[] = [\n vercelDeployModule,\n netlifyDeployModule,\n cloudflareDeployModule,\n staticDeployModule,\n nodeDeployModule,\n];\n\nconst moduleByTarget = new Map<ResuxResolvedDeployTarget, DeployTargetModule>(\n deployModules.map((module) => [module.target, module]),\n);\n\nfunction moduleFromPreset(preset: string): DeployTargetModule | null {\n const normalized = preset.trim().toLowerCase();\n if (!normalized) {\n return null;\n }\n\n return deployModules.find((module) =>\n module.presetAliases.some((alias) => alias === normalized)\n ) ?? null;\n}\n\nfunction buildDetectionContext(\n appRoot: string,\n outDir: string,\n env: NodeJS.ProcessEnv,\n explicitNitroPreset: string | null,\n deployConfig: DeployDetectionContext[\"deployConfig\"],\n): DeployDetectionContext {\n return {\n appRoot,\n outDir,\n env,\n explicitNitroPreset,\n deployConfig,\n };\n}\n\nfunction resolveModuleFromTarget(target: string | undefined): DeployTargetModule | null {\n if (!target || target === \"auto\") {\n return null;\n }\n return moduleByTarget.get(target as ResuxResolvedDeployTarget) ?? null;\n}\n\nfunction readExplicitNitroPreset(\n env: NodeJS.ProcessEnv,\n configPreset: string | undefined,\n): string | null {\n const envPreset = (env.NITRO_PRESET ?? env.RESUX_NITRO_PRESET)?.trim();\n if (envPreset) {\n return envPreset;\n }\n const normalizedConfigPreset = configPreset?.trim();\n return normalizedConfigPreset || null;\n}\n\nfunction createResolution(\n module: DeployTargetModule,\n nitroPreset: string | null,\n reason: string,\n): DeploymentResolution {\n return {\n target: module.target,\n nitroPreset,\n outputLabel: module.outputLabel,\n reason,\n };\n}\n\nexport async function resolveDeployment(\n appRoot: string,\n outDir: string,\n env: NodeJS.ProcessEnv,\n): Promise<DeploymentResolution> {\n const deployConfig = await loadResuxDeployConfig(appRoot, outDir);\n const explicitNitroPreset = readExplicitNitroPreset(env, deployConfig.nitroPreset);\n const detectionContext = buildDetectionContext(\n appRoot,\n outDir,\n env,\n explicitNitroPreset,\n deployConfig,\n );\n\n if (explicitNitroPreset) {\n const presetModule = moduleFromPreset(explicitNitroPreset);\n if (presetModule) {\n return createResolution(\n presetModule,\n explicitNitroPreset,\n \"explicit Nitro preset\",\n );\n }\n }\n\n const configuredTargetModule = resolveModuleFromTarget(deployConfig.target);\n if (configuredTargetModule) {\n const configuredPreset =\n deployConfig.nitroPreset\n ?? configuredTargetModule.inferPreset?.(detectionContext)\n ?? null;\n return createResolution(\n configuredTargetModule,\n configuredPreset,\n \"resux.config deploy.target\",\n );\n }\n\n const provider = detectDeployProviderFromEnv(env);\n if (provider) {\n const providerPreset = normalizeProviderPreset(provider);\n const providerModule = moduleFromPreset(providerPreset);\n if (providerModule) {\n if (providerModule.target === \"cloudflare\" && deployConfig.target !== \"cloudflare\") {\n // Cloudflare worker presets need an edge-compatible app handler.\n // Keep auto mode on node fallback unless the app explicitly opts in.\n } else {\n return createResolution(\n providerModule,\n providerPreset,\n `environment provider (${provider})`,\n );\n }\n }\n }\n\n for (const module of deployModules) {\n if (module.target === \"cloudflare\" && deployConfig.target !== \"cloudflare\") {\n continue;\n }\n if (!(await module.detect?.(detectionContext))) {\n continue;\n }\n const inferredPreset = module.inferPreset?.(detectionContext) ?? null;\n return createResolution(module, inferredPreset, `${module.target} project detection`);\n }\n\n const fallbackPreset = nodeDeployModule.inferPreset?.(detectionContext) ?? null;\n return createResolution(nodeDeployModule, fallbackPreset, \"default node target\");\n}\n\nexport async function applyDeploymentPostBuild(context: DeployBuildContext): Promise<void> {\n const module = moduleByTarget.get(context.target);\n await module?.postBuild?.(context);\n}\n"],"mappings":";;;;;;;;AAkBA,MAAM,gBAAsC;CAC1C;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,iBAAiB,IAAI,IACzB,cAAc,KAAK,WAAW,CAAC,OAAO,QAAQ,OAAO,CAAC,CACvD;AAED,SAAS,iBAAiB,QAA2C;CACnE,MAAM,aAAa,OAAO,MAA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Ae;AAClC,MAAI,OAAO,WAAW,gBAAgB,aAAa,WAAW,aAC5D;AAEF,MAAI,CAAE,MAAM,OAAO,SAAS,iBAAiB,CAC3C;AAGF,SAAO,iBAAiB,QADD,OAAO,cAAc,iBAAiB,IAAI,MACjB,GAAG,OAAO,OAAO,oBAAoB;;AAIvF,QAAO,iBAAiB,kBADD,iBAAiB,cAAc,iBAAiB,IAAI,MACjB,sBAAsB;;AAGlF,eAAsB,yBAAyB,SAA4C;AAEzF,OADe,eAAe,IAAI,QAAQ,OAAO,EACnC,YAAY,QAAQ"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/deploy/index.ts"],"sourcesContent":["import {\n detectDeployProviderFromEnv,\n loadResuxDeployConfig,\n normalizeProviderPreset,\n} from \"./common.js\";\nimport { cloudflareDeployModule } from \"./cloudflare.js\";\nimport { netlifyDeployModule } from \"./netlify.js\";\nimport { nodeDeployModule } from \"./node.js\";\nimport { staticDeployModule } from \"./static.js\";\nimport type {\n DeployBuildContext,\n DeployDetectionContext,\n DeploymentResolution,\n DeployTargetModule,\n ResuxResolvedDeployTarget,\n} from \"./types.js\";\nimport { vercelDeployModule } from \"./vercel.js\";\n\nconst deployModules: DeployTargetModule[] = [\n vercelDeployModule,\n netlifyDeployModule,\n cloudflareDeployModule,\n staticDeployModule,\n nodeDeployModule,\n];\n\nconst moduleByTarget = new Map<ResuxResolvedDeployTarget, DeployTargetModule>(\n deployModules.map((module) => [module.target, module]),\n);\n\nfunction moduleFromPreset(preset: string): DeployTargetModule | null {\n const normalized = preset.trim().toLowerCase();\n if (!normalized) {\n return null;\n }\n\n return deployModules.find((module) =>\n module.presetAliases.some((alias) => alias === normalized)\n ) ?? null;\n}\n\nfunction buildDetectionContext(\n appRoot: string,\n outDir: string,\n env: NodeJS.ProcessEnv,\n explicitNitroPreset: string | null,\n deployConfig: DeployDetectionContext[\"deployConfig\"],\n): DeployDetectionContext {\n return {\n appRoot,\n outDir,\n env,\n explicitNitroPreset,\n deployConfig,\n };\n}\n\nfunction resolveModuleFromTarget(target: string | undefined): DeployTargetModule | null {\n if (!target || target === \"auto\") {\n return null;\n }\n return moduleByTarget.get(target as ResuxResolvedDeployTarget) ?? null;\n}\n\nfunction readExplicitNitroPreset(\n env: NodeJS.ProcessEnv,\n configPreset: string | undefined,\n): string | null {\n const envPreset = (env.NITRO_PRESET ?? env.RESUX_NITRO_PRESET)?.trim();\n if (envPreset) {\n return envPreset;\n }\n const normalizedConfigPreset = configPreset?.trim();\n return normalizedConfigPreset || null;\n}\n\nfunction createResolution(\n module: DeployTargetModule,\n nitroPreset: string | null,\n reason: string,\n): DeploymentResolution {\n return {\n target: module.target,\n nitroPreset,\n outputLabel: module.outputLabel,\n reason,\n };\n}\n\nexport async function resolveDeployment(\n appRoot: string,\n outDir: string,\n env: NodeJS.ProcessEnv,\n): Promise<DeploymentResolution> {\n const deployConfig = await loadResuxDeployConfig(appRoot, outDir);\n const explicitNitroPreset = readExplicitNitroPreset(env, deployConfig.nitroPreset);\n const detectionContext = buildDetectionContext(\n appRoot,\n outDir,\n env,\n explicitNitroPreset,\n deployConfig,\n );\n\n if (explicitNitroPreset) {\n const presetModule = moduleFromPreset(explicitNitroPreset);\n if (presetModule) {\n return createResolution(\n presetModule,\n explicitNitroPreset,\n \"explicit Nitro preset\",\n );\n }\n }\n\n const configuredTargetModule = resolveModuleFromTarget(deployConfig.target);\n if (configuredTargetModule) {\n const configuredPreset =\n deployConfig.nitroPreset\n ?? configuredTargetModule.inferPreset?.(detectionContext)\n ?? null;\n return createResolution(\n configuredTargetModule,\n configuredPreset,\n \"resux.config deploy.target\",\n );\n }\n\n const provider = detectDeployProviderFromEnv(env);\n if (provider) {\n const providerPreset = normalizeProviderPreset(provider);\n const providerModule = moduleFromPreset(providerPreset);\n if (providerModule) {\n if (providerModule.target === \"cloudflare\" && deployConfig.target !== \"cloudflare\") {\n // Cloudflare worker presets need an edge-compatible app handler.\n // Keep auto mode on node fallback unless the app explicitly opts in.\n } else {\n return createResolution(\n providerModule,\n providerPreset,\n `environment provider (${provider})`,\n );\n }\n }\n }\n\n for (const module of deployModules) {\n if (module.target === \"cloudflare\" && deployConfig.target !== \"cloudflare\") {\n continue;\n }\n if (!(await module.detect?.(detectionContext))) {\n continue;\n }\n const inferredPreset = module.inferPreset?.(detectionContext) ?? null;\n return createResolution(module, inferredPreset, `${module.target} project detection`);\n }\n\n const fallbackPreset = nodeDeployModule.inferPreset?.(detectionContext) ?? null;\n return createResolution(nodeDeployModule, fallbackPreset, \"default node target\");\n}\n\nexport async function applyDeploymentPostBuild(context: DeployBuildContext): Promise<void> {\n const module = moduleByTarget.get(context.target);\n await module?.postBuild?.(context);\n}\n"],"mappings":";;;;;;;AAkBA,MAAM,gBAAsC;CAC1C;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,iBAAiB,IAAI,IACzB,cAAc,KAAK,WAAW,CAAC,OAAO,QAAQ,MAAM,CAAC,CACvD;AAEA,SAAS,iBAAiB,QAA2C;CACnE,MAAM,aAAa,OAAO,KAAK,CAAC,CAAC,YAAY;CAC7C,IAAI,CAAC,YACH,OAAO;CAGT,OAAO,cAAc,MAAM,WACzB,OAAO,cAAc,MAAM,UAAU,UAAU,UAAU,CAC3D,KAAK;AACP;AAEA,SAAS,sBACP,SACA,QACA,KACA,qBACA,cACwB;CACxB,OAAO;EACL;EACA;EACA;EACA;EACA;CACF;AACF;AAEA,SAAS,wBAAwB,QAAuD;CACtF,IAAI,CAAC,UAAU,WAAW,QACxB,OAAO;CAET,OAAO,eAAe,IAAI,MAAmC,KAAK;AACpE;AAEA,SAAS,wBACP,KACA,cACe;CACf,MAAM,aAAa,IAAI,gBAAgB,IAAI,mBAAA,EAAqB,KAAK;CACrE,IAAI,WACF,OAAO;CAGT,OAD+B,cAAc,KAAK,KACjB;AACnC;AAEA,SAAS,iBACP,QACA,aACA,QACsB;CACtB,OAAO;EACL,QAAQ,OAAO;EACf;EACA,aAAa,OAAO;EACpB;CACF;AACF;AAEA,eAAsB,kBACpB,SACA,QACA,KAC+B;CAC/B,MAAM,eAAe,MAAM,sBAAsB,SAAS,MAAM;CAChE,MAAM,sBAAsB,wBAAwB,KAAK,aAAa,WAAW;CACjF,MAAM,mBAAmB,sBACvB,SACA,QACA,KACA,qBACA,YACF;CAEA,IAAI,qBAAqB;EACvB,MAAM,eAAe,iBAAiB,mBAAmB;EACzD,IAAI,cACF,OAAO,iBACL,cACA,qBACA,uBACF;CAEJ;CAEA,MAAM,yBAAyB,wBAAwB,aAAa,MAAM;CAC1E,IAAI,wBAKF,OAAO,iBACL,wBAJA,aAAa,eACV,uBAAuB,cAAc,gBAAgB,KACrD,MAIH,4BACF;CAGF,MAAM,WAAW,4BAA4B,GAAG;CAChD,IAAI,UAAU;EACZ,MAAM,iBAAiB,wBAAwB,QAAQ;EACvD,MAAM,iBAAiB,iBAAiB,cAAc;EACtD,IAAI,gBAAgB;GAClB,IAAI,eAAe,WAAW,gBAAgB,aAAa,WAAW,cAAc,CAGpF,OACA,OAAO,iBACL,gBACA,gBACA,yBAAyB,SAAS,EACpC;EAEF;CACF;CAEA,KAAK,MAAM,UAAU,eAAe;EAClC,IAAI,OAAO,WAAW,gBAAgB,aAAa,WAAW,cAC5D;EAEF,IAAI,CAAE,MAAM,OAAO,SAAS,gBAAgB,GAC1C;EAGF,OAAO,iBAAiB,QADD,OAAO,cAAc,gBAAgB,KAAK,MACjB,GAAG,OAAO,OAAO,mBAAmB;CACtF;CAEA,MAAM,iBAAiB,iBAAiB,cAAc,gBAAgB,KAAK;CAC3E,OAAO,iBAAiB,kBAAkB,gBAAgB,qBAAqB;AACjF;AAEA,eAAsB,yBAAyB,SAA4C;CAEzF,MADe,eAAe,IAAI,QAAQ,MAC/B,CAAC,EAAE,YAAY,OAAO;AACnC"}
@@ -1,7 +1,3 @@
1
1
  import { DeployTargetModule } from "./types.js";
2
-
3
- //#region src/deploy/netlify.d.ts
4
- declare const netlifyDeployModule: DeployTargetModule;
5
- //#endregion
6
- export { netlifyDeployModule };
2
+ export declare const netlifyDeployModule: DeployTargetModule;
7
3
  //# sourceMappingURL=netlify.d.ts.map
@@ -1,11 +1,10 @@
1
1
  import { assertRuntimeClientAsset, ensureResuxClientAssets, ensureResuxServerPayload, pathExists } from "./common.js";
2
- import { ensureRuntimeDependencyTrees, ensureServerRuntimeDependencyTrees } from "./runtime-dependencies.js";
3
2
  import { ensureResuxFrameworkRuntime } from "./framework-runtime.js";
4
3
  import { ensureResuxProductionReport } from "./production-report.js";
4
+ import { ensureRuntimeDependencyTrees, ensureServerRuntimeDependencyTrees } from "./runtime-dependencies.js";
5
5
  import { readdir } from "node:fs/promises";
6
6
  import path from "node:path";
7
-
8
- //#region src/deploy/netlify.ts
7
+ // src/deploy/netlify.ts
9
8
  async function detect(context) {
10
9
  if (context.env.NETLIFY && !context.env.NETLIFY_LOCAL) return true;
11
10
  return pathExists(path.join(context.appRoot, "netlify.toml"));
@@ -45,7 +44,6 @@ const netlifyDeployModule = {
45
44
  inferPreset: () => "netlify",
46
45
  postBuild
47
46
  };
48
-
49
- //#endregion
50
47
  export { netlifyDeployModule };
48
+
51
49
  //# sourceMappingURL=netlify.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"netlify.js","names":[],"sources":["../../src/deploy/netlify.ts"],"sourcesContent":["import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n assertRuntimeClientAsset,\n ensureResuxClientAssets,\n ensureResuxServerPayload,\n pathExists,\n} from \"./common.js\";\nimport { ensureResuxFrameworkRuntime } from \"./framework-runtime.js\";\nimport { ensureResuxProductionReport } from \"./production-report.js\";\nimport {\n ensureRuntimeDependencyTrees,\n ensureServerRuntimeDependencyTrees,\n} from \"./runtime-dependencies.js\";\nimport type {\n DeployBuildContext,\n DeployDetectionContext,\n DeployTargetModule,\n} from \"./types.js\";\n\nasync function detect(context: DeployDetectionContext): Promise<boolean> {\n if (context.env.NETLIFY && !context.env.NETLIFY_LOCAL) {\n return true;\n }\n\n return pathExists(path.join(context.appRoot, \"netlify.toml\"));\n}\n\nasync function listInternalFunctionRoots(appRoot: string): Promise<string[]> {\n const functionsInternalDir = path.join(appRoot, \".netlify\", \"functions-internal\");\n const entries = await readdir(functionsInternalDir, { withFileTypes: true }).catch(() => []);\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => path.join(functionsInternalDir, entry.name));\n}\n\nasync function postBuild(context: DeployBuildContext): Promise<void> {\n await ensureResuxClientAssets(context.appRoot, [\n {\n root: path.join(context.appRoot, \"dist\"),\n target: path.join(context.appRoot, \"dist\", \"__resux\"),\n },\n {\n root: path.join(context.appRoot, \".output\"),\n target: path.join(context.appRoot, \".output\", \"public\", \"__resux\"),\n },\n ]);\n\n const functionRoots = await listInternalFunctionRoots(context.appRoot);\n if (!functionRoots.length) {\n throw new Error(\n \"Resux netlify deployment output is missing .netlify/functions-internal server functions.\",\n );\n }\n const payloadTargets = functionRoots.map((functionRoot) =>\n path.join(functionRoot, \".resux\", \"server\")\n );\n await ensureResuxServerPayload(context.appRoot, payloadTargets);\n await ensureResuxProductionReport(context.appRoot, functionRoots);\n await ensureResuxFrameworkRuntime(context.appRoot, functionRoots);\n await ensureServerRuntimeDependencyTrees(\n context.appRoot,\n path.join(context.appRoot, \".resux\", \"server\"),\n functionRoots,\n \"Resux Netlify\",\n );\n await ensureRuntimeDependencyTrees(\n context.appRoot,\n functionRoots,\n \"sharp\",\n \"Resux Netlify image optimizer\",\n );\n await assertRuntimeClientAsset(path.join(context.appRoot, \"dist\"));\n}\n\nexport const netlifyDeployModule: DeployTargetModule = {\n target: \"netlify\",\n presetAliases: [\"netlify\", \"netlify_builder\", \"netlify-builder\", \"netlify-edge\"],\n outputLabel: \"dist + .netlify/functions-internal\",\n detect,\n inferPreset: () => \"netlify\",\n postBuild,\n};\n"],"mappings":";;;;;;;;AAoBA,eAAe,OAAO,SAAmD;AACvE,KAAI,QAAQ,IAAI,WAAW,CAAC,QAAQ,IAAI,cACtC,QAAO;AAGT,QAAO,WAAW,KAAK,K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deploy/netlify.ts"],"sourcesContent":["import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n assertRuntimeClientAsset,\n ensureResuxClientAssets,\n ensureResuxServerPayload,\n pathExists,\n} from \"./common.js\";\nimport { ensureResuxFrameworkRuntime } from \"./framework-runtime.js\";\nimport { ensureResuxProductionReport } from \"./production-report.js\";\nimport {\n ensureRuntimeDependencyTrees,\n ensureServerRuntimeDependencyTrees,\n} from \"./runtime-dependencies.js\";\nimport type {\n DeployBuildContext,\n DeployDetectionContext,\n DeployTargetModule,\n} from \"./types.js\";\n\nasync function detect(context: DeployDetectionContext): Promise<boolean> {\n if (context.env.NETLIFY && !context.env.NETLIFY_LOCAL) {\n return true;\n }\n\n return pathExists(path.join(context.appRoot, \"netlify.toml\"));\n}\n\nasync function listInternalFunctionRoots(appRoot: string): Promise<string[]> {\n const functionsInternalDir = path.join(appRoot, \".netlify\", \"functions-internal\");\n const entries = await readdir(functionsInternalDir, { withFileTypes: true }).catch(() => []);\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => path.join(functionsInternalDir, entry.name));\n}\n\nasync function postBuild(context: DeployBuildContext): Promise<void> {\n await ensureResuxClientAssets(context.appRoot, [\n {\n root: path.join(context.appRoot, \"dist\"),\n target: path.join(context.appRoot, \"dist\", \"__resux\"),\n },\n {\n root: path.join(context.appRoot, \".output\"),\n target: path.join(context.appRoot, \".output\", \"public\", \"__resux\"),\n },\n ]);\n\n const functionRoots = await listInternalFunctionRoots(context.appRoot);\n if (!functionRoots.length) {\n throw new Error(\n \"Resux netlify deployment output is missing .netlify/functions-internal server functions.\",\n );\n }\n const payloadTargets = functionRoots.map((functionRoot) =>\n path.join(functionRoot, \".resux\", \"server\")\n );\n await ensureResuxServerPayload(context.appRoot, payloadTargets);\n await ensureResuxProductionReport(context.appRoot, functionRoots);\n await ensureResuxFrameworkRuntime(context.appRoot, functionRoots);\n await ensureServerRuntimeDependencyTrees(\n context.appRoot,\n path.join(context.appRoot, \".resux\", \"server\"),\n functionRoots,\n \"Resux Netlify\",\n );\n await ensureRuntimeDependencyTrees(\n context.appRoot,\n functionRoots,\n \"sharp\",\n \"Resux Netlify image optimizer\",\n );\n await assertRuntimeClientAsset(path.join(context.appRoot, \"dist\"));\n}\n\nexport const netlifyDeployModule: DeployTargetModule = {\n target: \"netlify\",\n presetAliases: [\"netlify\", \"netlify_builder\", \"netlify-builder\", \"netlify-edge\"],\n outputLabel: \"dist + .netlify/functions-internal\",\n detect,\n inferPreset: () => \"netlify\",\n postBuild,\n};\n"],"mappings":";;;;;;;AAoBA,eAAe,OAAO,SAAmD;CACvE,IAAI,QAAQ,IAAI,WAAW,CAAC,QAAQ,IAAI,eACtC,OAAO;CAGT,OAAO,WAAW,KAAK,KAAK,QAAQ,SAAS,cAAc,CAAC;AAC9D;AAEA,eAAe,0BAA0B,SAAoC;CAC3E,MAAM,uBAAuB,KAAK,KAAK,SAAS,YAAY,oBAAoB;CAEhF,QAAO,MADe,QAAQ,sBAAsB,EAAE,eAAe,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,EAAA,CAExF,QAAQ,UAAU,MAAM,YAAY,CAAC,CAAC,CACtC,KAAK,UAAU,KAAK,KAAK,sBAAsB,MAAM,IAAI,CAAC;AAC/D;AAEA,eAAe,UAAU,SAA4C;CACnE,MAAM,wBAAwB,QAAQ,SAAS,CAC7C;EACE,MAAM,KAAK,KAAK,QAAQ,SAAS,MAAM;EACvC,QAAQ,KAAK,KAAK,QAAQ,SAAS,QAAQ,SAAS;CACtD,GACA;EACE,MAAM,KAAK,KAAK,QAAQ,SAAS,SAAS;EAC1C,QAAQ,KAAK,KAAK,QAAQ,SAAS,WAAW,UAAU,SAAS;CACnE,CACF,CAAC;CAED,MAAM,gBAAgB,MAAM,0BAA0B,QAAQ,OAAO;CACrE,IAAI,CAAC,cAAc,QACjB,MAAM,IAAI,MACR,0FACF;CAEF,MAAM,iBAAiB,cAAc,KAAK,iBACxC,KAAK,KAAK,cAAc,UAAU,QAAQ,CAC5C;CACA,MAAM,yBAAyB,QAAQ,SAAS,cAAc;CAC9D,MAAM,4BAA4B,QAAQ,SAAS,aAAa;CAChE,MAAM,4BAA4B,QAAQ,SAAS,aAAa;CAChE,MAAM,mCACJ,QAAQ,SACR,KAAK,KAAK,QAAQ,SAAS,UAAU,QAAQ,GAC7C,eACA,eACF;CACA,MAAM,6BACJ,QAAQ,SACR,eACA,SACA,+BACF;CACA,MAAM,yBAAyB,KAAK,KAAK,QAAQ,SAAS,MAAM,CAAC;AACnE;AAEA,MAAa,sBAA0C;CACrD,QAAQ;CACR,eAAe;EAAC;EAAW;EAAmB;EAAmB;CAAc;CAC/E,aAAa;CACb;CACA,mBAAmB;CACnB;AACF"}
@@ -1,7 +1,3 @@
1
1
  import { DeployTargetModule } from "./types.js";
2
-
3
- //#region src/deploy/node.d.ts
4
- declare const nodeDeployModule: DeployTargetModule;
5
- //#endregion
6
- export { nodeDeployModule };
2
+ export declare const nodeDeployModule: DeployTargetModule;
7
3
  //# sourceMappingURL=node.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { assertResuxServerManifest, assertRuntimeClientAsset, ensureResuxClientAssets, pathExists } from "./common.js";
2
2
  import path from "node:path";
3
-
4
- //#region src/deploy/node.ts
3
+ // src/deploy/node.ts
5
4
  async function postBuild(context) {
6
5
  await ensureResuxClientAssets(context.appRoot, [{
7
6
  root: path.join(context.appRoot, ".output"),
@@ -9,7 +8,8 @@ async function postBuild(context) {
9
8
  }]);
10
9
  await assertResuxServerManifest(context.appRoot);
11
10
  await assertRuntimeClientAsset(path.join(context.appRoot, ".output", "public"));
12
- if (!await pathExists(path.join(context.appRoot, ".output", "server", "index.mjs"))) throw new Error("Resux node deployment output is missing .output/server/index.mjs.");
11
+ const serverEntry = path.join(context.appRoot, ".output", "server", "index.mjs");
12
+ if (!await pathExists(serverEntry)) throw new Error("Resux node deployment output is missing .output/server/index.mjs.");
13
13
  }
14
14
  const nodeDeployModule = {
15
15
  target: "node",
@@ -23,7 +23,6 @@ const nodeDeployModule = {
23
23
  inferPreset: () => "node-server",
24
24
  postBuild
25
25
  };
26
-
27
- //#endregion
28
26
  export { nodeDeployModule };
27
+
29
28
  //# sourceMappingURL=node.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","names":[],"sources":["../../src/deploy/node.ts"],"sourcesContent":["import path from \"node:path\";\nimport {\n assertResuxServerManifest,\n assertRuntimeClientAsset,\n ensureResuxClientAssets,\n pathExists,\n} from \"./common.js\";\nimport type { DeployBuildContext, DeployTargetModule } from \"./types.js\";\n\nasync function postBuild(context: DeployBuildContext): Promise<void> {\n await ensureResuxClientAssets(context.appRoot, [\n {\n root: path.join(context.appRoot, \".output\"),\n target: path.join(context.appRoot, \".output\", \"public\", \"__resux\"),\n },\n ]);\n\n await assertResuxServerManifest(context.appRoot);\n await assertRuntimeClientAsset(path.join(context.appRoot, \".output\", \"public\"));\n const serverEntry = path.join(context.appRoot, \".output\", \"server\", \"index.mjs\");\n if (!(await pathExists(serverEntry))) {\n throw new Error(\"Resux node deployment output is missing .output/server/index.mjs.\");\n }\n}\n\nexport const nodeDeployModule: DeployTargetModule = {\n target: \"node\",\n presetAliases: [\"node-server\", \"node\", \"node_cluster\", \"node-cluster\"],\n outputLabel: \".output\",\n inferPreset: () => \"node-server\",\n postBuild,\n};\n"],"mappings":";;;;AASA,eAAe,UAAU,SAA4C;AACnE,OAAM,wBAAwB,QAAQ,SAAS,CAC7C;EACE,MAAM,KAAK,KAAK,QAAQ,SAAS,UAAU;EAC3C,QAAQ,KAAK,KAAK,QAAQ,SAAS,WAAW,UAAU,UAAU;EACnE,CACF,CAAC;AAEF,OAAM,0BAA0B,QAAQ,QAAQ;AAChD,OAAM,yBAAyB,KAAK,KAAK,QAAQ,SAAS,WAAW,SAAS,CAAC;AAE/E,KAAI,CAAE,MAAM,WADQ,KAAK,KAAK,QAAQ,SAAS,WAAW,UAAU,YAAY,CAC7C,CACjC,OAAM,IAAI,MAAM,oEAAoE;;AAIxF,MAAa,mBAAuC;CAClD,QAAQ;CACR,eAAe;EAAC;EAAe;EAAQ;EAAgB;EAAe;CACtE,aAAa;CACb,mBAAmB;CACnB;CACD"}
1
+ {"version":3,"file":"node.js","names":[],"sources":["../../src/deploy/node.ts"],"sourcesContent":["import path from \"node:path\";\nimport {\n assertResuxServerManifest,\n assertRuntimeClientAsset,\n ensureResuxClientAssets,\n pathExists,\n} from \"./common.js\";\nimport type { DeployBuildContext, DeployTargetModule } from \"./types.js\";\n\nasync function postBuild(context: DeployBuildContext): Promise<void> {\n await ensureResuxClientAssets(context.appRoot, [\n {\n root: path.join(context.appRoot, \".output\"),\n target: path.join(context.appRoot, \".output\", \"public\", \"__resux\"),\n },\n ]);\n\n await assertResuxServerManifest(context.appRoot);\n await assertRuntimeClientAsset(path.join(context.appRoot, \".output\", \"public\"));\n const serverEntry = path.join(context.appRoot, \".output\", \"server\", \"index.mjs\");\n if (!(await pathExists(serverEntry))) {\n throw new Error(\"Resux node deployment output is missing .output/server/index.mjs.\");\n }\n}\n\nexport const nodeDeployModule: DeployTargetModule = {\n target: \"node\",\n presetAliases: [\"node-server\", \"node\", \"node_cluster\", \"node-cluster\"],\n outputLabel: \".output\",\n inferPreset: () => \"node-server\",\n postBuild,\n};\n"],"mappings":";;;AASA,eAAe,UAAU,SAA4C;CACnE,MAAM,wBAAwB,QAAQ,SAAS,CAC7C;EACE,MAAM,KAAK,KAAK,QAAQ,SAAS,SAAS;EAC1C,QAAQ,KAAK,KAAK,QAAQ,SAAS,WAAW,UAAU,SAAS;CACnE,CACF,CAAC;CAED,MAAM,0BAA0B,QAAQ,OAAO;CAC/C,MAAM,yBAAyB,KAAK,KAAK,QAAQ,SAAS,WAAW,QAAQ,CAAC;CAC9E,MAAM,cAAc,KAAK,KAAK,QAAQ,SAAS,WAAW,UAAU,WAAW;CAC/E,IAAI,CAAE,MAAM,WAAW,WAAW,GAChC,MAAM,IAAI,MAAM,mEAAmE;AAEvF;AAEA,MAAa,mBAAuC;CAClD,QAAQ;CACR,eAAe;EAAC;EAAe;EAAQ;EAAgB;CAAc;CACrE,aAAa;CACb,mBAAmB;CACnB;AACF"}
@@ -1,5 +1,2 @@
1
- //#region src/deploy/production-report.d.ts
2
- declare function ensureResuxProductionReport(appRoot: string, runtimeRoots: string[]): Promise<void>;
3
- //#endregion
4
- export { ensureResuxProductionReport };
1
+ export declare function ensureResuxProductionReport(appRoot: string, runtimeRoots: string[]): Promise<void>;
5
2
  //# sourceMappingURL=production-report.d.ts.map
@@ -1,8 +1,7 @@
1
1
  import { pathExists } from "./common.js";
2
2
  import { cp, mkdir } from "node:fs/promises";
3
3
  import path from "node:path";
4
-
5
- //#region src/deploy/production-report.ts
4
+ // src/deploy/production-report.ts
6
5
  const REPORT_FILENAME = "halal-report.json";
7
6
  async function ensureResuxProductionReport(appRoot, runtimeRoots) {
8
7
  if (!runtimeRoots.length) return;
@@ -14,7 +13,6 @@ async function ensureResuxProductionReport(appRoot, runtimeRoots) {
14
13
  await cp(source, target, { force: true });
15
14
  }
16
15
  }
17
-
18
- //#endregion
19
16
  export { ensureResuxProductionReport };
17
+
20
18
  //# sourceMappingURL=production-report.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"production-report.js","names":[],"sources":["../../src/deploy/production-report.ts"],"sourcesContent":["import { cp, mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists } from \"./common.js\";\n\nconst REPORT_FILENAME = \"halal-report.json\";\n\nexport async function ensureResuxProductionReport(\n appRoot: string,\n runtimeRoots: string[],\n): Promise<void> {\n if (!runtimeRoots.length) {\n return;\n }\n\n const source = path.join(appRoot, \".resux\", REPORT_FILENAME);\n if (!(await pathExists(source))) {\n throw new Error(\n \"Resux deployment is missing .resux/halal-report.json. Run `resux build` with RESUX_HALAL_REPORT_SIGNING_SECRET configured and retry.\",\n );\n }\n\n for (const runtimeRoot of runtimeRoots) {\n const target = path.join(runtimeRoot, \".resux\", REPORT_FILENAME);\n await mkdir(path.dirname(target), { recursive: true });\n await cp(source, target, { force: true });\n }\n}\n"],"mappings":";;;;;AAIA,MAAM,kBAAkB;AAExB,eAAsB,4BACpB,SACA,cACe;AACf,KAAI,CAAC,aAAa,OAChB;CAGF,MAAM,SAAS,KAAK,KAAK,SAAS,UAAU,gBAAgB;AAC5D,KAAI,CAAE,MAAM,WAAW,OAAO,CAC5B,OAAM,IAAI,MACR,uIACD;AAGH,MAAK,MAAM,eAAe,cAAc;EACtC,MAAM,SAAS,KAAK,KAAK,aAAa,UAAU,gBAAgB;AAChE,QAAM,MAAM,KAAK,QAAQ,OAAO,EAAE,EAAE,WAAW,MAAM,CAAC;AACtD,QAAM,GAAG,QAAQ,QAAQ,EAAE,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"production-report.js","names":[],"sources":["../../src/deploy/production-report.ts"],"sourcesContent":["import { cp, mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists } from \"./common.js\";\n\nconst REPORT_FILENAME = \"halal-report.json\";\n\nexport async function ensureResuxProductionReport(\n appRoot: string,\n runtimeRoots: string[],\n): Promise<void> {\n if (!runtimeRoots.length) {\n return;\n }\n\n const source = path.join(appRoot, \".resux\", REPORT_FILENAME);\n if (!(await pathExists(source))) {\n throw new Error(\n \"Resux deployment is missing .resux/halal-report.json. Run `resux build` with RESUX_HALAL_REPORT_SIGNING_SECRET configured and retry.\",\n );\n }\n\n for (const runtimeRoot of runtimeRoots) {\n const target = path.join(runtimeRoot, \".resux\", REPORT_FILENAME);\n await mkdir(path.dirname(target), { recursive: true });\n await cp(source, target, { force: true });\n }\n}\n"],"mappings":";;;;AAIA,MAAM,kBAAkB;AAExB,eAAsB,4BACpB,SACA,cACe;CACf,IAAI,CAAC,aAAa,QAChB;CAGF,MAAM,SAAS,KAAK,KAAK,SAAS,UAAU,eAAe;CAC3D,IAAI,CAAE,MAAM,WAAW,MAAM,GAC3B,MAAM,IAAI,MACR,sIACF;CAGF,KAAK,MAAM,eAAe,cAAc;EACtC,MAAM,SAAS,KAAK,KAAK,aAAa,UAAU,eAAe;EAC/D,MAAM,MAAM,KAAK,QAAQ,MAAM,GAAG,EAAE,WAAW,KAAK,CAAC;EACrD,MAAM,GAAG,QAAQ,QAAQ,EAAE,OAAO,KAAK,CAAC;CAC1C;AACF"}
@@ -1,8 +1,5 @@
1
- //#region src/deploy/runtime-dependencies.d.ts
2
- declare function collectServerRuntimeDependencyNames(serverRoot: string): Promise<string[]>;
3
- declare function copyRuntimeDependencyTree(appRoot: string, runtimeRoot: string, rootDependency: string, consumerLabel: string): Promise<void>;
4
- declare function ensureRuntimeDependencyTrees(appRoot: string, runtimeRoots: string[], rootDependency: string, consumerLabel: string): Promise<void>;
5
- declare function ensureServerRuntimeDependencyTrees(appRoot: string, serverRoot: string, runtimeRoots: string[], consumerLabel: string): Promise<string[]>;
6
- //#endregion
7
- export { collectServerRuntimeDependencyNames, copyRuntimeDependencyTree, ensureRuntimeDependencyTrees, ensureServerRuntimeDependencyTrees };
1
+ export declare function collectServerRuntimeDependencyNames(serverRoot: string): Promise<string[]>;
2
+ export declare function copyRuntimeDependencyTree(appRoot: string, runtimeRoot: string, rootDependency: string, consumerLabel: string): Promise<void>;
3
+ export declare function ensureRuntimeDependencyTrees(appRoot: string, runtimeRoots: string[], rootDependency: string, consumerLabel: string): Promise<void>;
4
+ export declare function ensureServerRuntimeDependencyTrees(appRoot: string, serverRoot: string, runtimeRoots: string[], consumerLabel: string): Promise<string[]>;
8
5
  //# sourceMappingURL=runtime-dependencies.d.ts.map
@@ -3,8 +3,7 @@ import { builtinModules, createRequire } from "node:module";
3
3
  import { cp, mkdir, readFile, readdir, rm } from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import ts from "typescript";
6
-
7
- //#region src/deploy/runtime-dependencies.ts
6
+ // src/deploy/runtime-dependencies.ts
8
7
  const nodeBuiltins = new Set(builtinModules.flatMap((name) => [name, name.startsWith("node:") ? name.slice(5) : `node:${name}`]));
9
8
  function isRecord(value) {
10
9
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -172,7 +171,8 @@ async function copyRuntimeDependencyTree(appRoot, runtimeRoot, rootDependency, c
172
171
  });
173
172
  }
174
173
  }
175
- if (!await pathExists(path.join(dependencyTargetPath(runtimeRoot, rootDependency), "package.json"))) throw new Error(`${consumerLabel} could not prepare "${rootDependency}" for ${runtimeRoot}.`);
174
+ const requiredDependencyPath = path.join(dependencyTargetPath(runtimeRoot, rootDependency), "package.json");
175
+ if (!await pathExists(requiredDependencyPath)) throw new Error(`${consumerLabel} could not prepare "${rootDependency}" for ${runtimeRoot}.`);
176
176
  }
177
177
  async function ensureRuntimeDependencyTrees(appRoot, runtimeRoots, rootDependency, consumerLabel) {
178
178
  for (const runtimeRoot of runtimeRoots) await copyRuntimeDependencyTree(appRoot, runtimeRoot, rootDependency, consumerLabel);
@@ -182,7 +182,6 @@ async function ensureServerRuntimeDependencyTrees(appRoot, serverRoot, runtimeRo
182
182
  for (const dependency of dependencies) await ensureRuntimeDependencyTrees(appRoot, runtimeRoots, dependency, `${consumerLabel} server runtime`);
183
183
  return dependencies;
184
184
  }
185
-
186
- //#endregion
187
185
  export { collectServerRuntimeDependencyNames, copyRuntimeDependencyTree, ensureRuntimeDependencyTrees, ensureServerRuntimeDependencyTrees };
186
+
188
187
  //# sourceMappingURL=runtime-dependencies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-dependencies.js","names":[],"sources":["../../src/deploy/runtime-dependencies.ts"],"sourcesContent":["import { cp, mkdir, readFile, readdir, rm } from \"node:fs/promises\";\nimport { builtinModules, createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport ts from \"typescript\";\nimport { pathExists, readJsonRecord } from \"./common.js\";\n\ninterface PackageRecord extends Record<string, unknown> {\n name?: unknown;\n dependencies?: unknown;\n optionalDependencies?: unknown;\n peerDependencies?: unknown;\n peerDependenciesMeta?: unknown;\n}\n\nconst nodeBuiltins = new Set(\n builtinModules.flatMap((name) => [\n name,\n name.startsWith(\"node:\") ? name.slice(5) : `node:${name}`,\n ]),\n);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction runtimeDependencyNames(value: unknown): string[] {\n if (!isRecord(value)) {\n return [];\n }\n return Object.keys(value).filter((name) => name.trim().length > 0);\n}\n\nfunction dependencyTargetPath(runtimeRoot: string, packageName: string): string {\n return path.join(runtimeRoot, \"node_modules\", ...packageName.split(\"/\"));\n}\n\nfunction packageNameFromSpecifier(specifier: string): string | null {\n if (\n !specifier\n || specifier.startsWith(\".\")\n || specifier.startsWith(\"/\")\n || specifier.startsWith(\"#\")\n || specifier.startsWith(\"data:\")\n || specifier.startsWith(\"file:\")\n || nodeBuiltins.has(specifier)\n ) {\n return null;\n }\n\n if (specifier.startsWith(\"@\")) {\n const [scope, name] = specifier.split(\"/\");\n return scope && name ? `${scope}/${name}` : null;\n }\n\n const packageName = specifier.split(\"/\")[0] ?? \"\";\n return packageName && !nodeBuiltins.has(packageName) ? packageName : null;\n}\n\nasync function walkRuntimeModuleFiles(directory: string): Promise<string[]> {\n const entries = await readdir(directory, { withFileTypes: true }).catch(() => []);\n const files: string[] = [];\n\n for (const entry of entries) {\n const fullPath = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n files.push(...(await walkRuntimeModuleFiles(fullPath)));\n continue;\n }\n if (entry.isFile() && /\\.(?:mjs|cjs|js)$/.test(entry.name)) {\n files.push(fullPath);\n }\n }\n\n return files;\n}\n\nfunction collectModuleSpecifiers(sourceFile: ts.SourceFile): string[] {\n const specifiers: string[] = [];\n\n function visit(node: ts.Node): void {\n if (\n (ts.isImportDeclaration(node) || ts.isExportDeclaration(node))\n && node.moduleSpecifier\n && ts.isStringLiteralLike(node.moduleSpecifier)\n ) {\n specifiers.push(node.moduleSpecifier.text);\n } else if (\n ts.isCallExpression(node)\n && node.expression.kind === ts.SyntaxKind.ImportKeyword\n && node.arguments.length === 1\n && ts.isStringLiteralLike(node.arguments[0])\n ) {\n specifiers.push(node.arguments[0].text);\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return specifiers;\n}\n\nexport async function collectServerRuntimeDependencyNames(\n serverRoot: string,\n): Promise<string[]> {\n if (!(await pathExists(serverRoot))) {\n return [];\n }\n\n const dependencyNames = new Set<string>();\n\n for (const file of await walkRuntimeModuleFiles(serverRoot)) {\n const source = await readFile(file, \"utf8\");\n const sourceFile = ts.createSourceFile(\n file,\n source,\n ts.ScriptTarget.Latest,\n false,\n ts.ScriptKind.JS,\n );\n\n for (const specifier of collectModuleSpecifiers(sourceFile)) {\n const packageName = packageNameFromSpecifier(specifier);\n if (packageName && packageName !== \"resuxjs\" && packageName !== \"resux\") {\n dependencyNames.add(packageName);\n }\n }\n }\n\n return [...dependencyNames].sort();\n}\n\nfunction resolveResuxPackageRequire(\n appRequire: ReturnType<typeof createRequire>,\n): ReturnType<typeof createRequire> | null {\n for (const packageName of [\"resuxjs\", \"resux\"]) {\n try {\n return createRequire(appRequire.resolve(packageName));\n } catch {\n try {\n return createRequire(appRequire.resolve(`${packageName}/package.json`));\n } catch {\n // Keep trying known package names.\n }\n }\n }\n return null;\n}\n\nfunction formatResolutionError(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nasync function findPackageJsonFromEntry(\n dependency: string,\n entryPath: string,\n): Promise<string | null> {\n let currentDirectory = path.dirname(entryPath);\n\n while (true) {\n const candidate = path.join(currentDirectory, \"package.json\");\n const packageJson = (await readJsonRecord(candidate)) as PackageRecord | null;\n if (packageJson?.name === dependency) {\n return candidate;\n }\n\n const parentDirectory = path.dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n return null;\n }\n currentDirectory = parentDirectory;\n }\n}\n\nasync function findPackageJsonFromSearchPaths(\n dependency: string,\n resolver: ReturnType<typeof createRequire>,\n): Promise<string | null> {\n const searchPaths = resolver.resolve.paths(dependency) ?? [];\n for (const nodeModulesRoot of searchPaths) {\n const candidate = path.join(\n nodeModulesRoot,\n ...dependency.split(\"/\"),\n \"package.json\",\n );\n const packageJson = (await readJsonRecord(candidate)) as PackageRecord | null;\n if (packageJson?.name === dependency) {\n return candidate;\n }\n }\n return null;\n}\n\nasync function resolveDependencyPackageJsonPath(\n dependency: string,\n resolver: ReturnType<typeof createRequire>,\n resolutionErrors?: string[],\n): Promise<string | null> {\n let entryResolutionError: unknown = null;\n try {\n const entryPath = resolver.resolve(dependency);\n const packageJsonPath = await findPackageJsonFromEntry(dependency, entryPath);\n if (packageJsonPath) {\n return packageJsonPath;\n }\n entryResolutionError = new Error(\n `Resolved \"${dependency}\" to ${entryPath}, but its package root could not be located.`,\n );\n } catch (error) {\n entryResolutionError = error;\n }\n\n // Native packages such as @img/sharp-linux-x64 intentionally expose only\n // specific subpaths, so neither the package root nor ./package.json is\n // necessarily resolvable through exports. Node still exposes the node_modules\n // lookup roots; inspect those roots directly without bypassing package identity.\n const searchPathPackageJson = await findPackageJsonFromSearchPaths(dependency, resolver);\n if (searchPathPackageJson) {\n return searchPathPackageJson;\n }\n\n // Preserve compatibility with packages that explicitly export package.json.\n try {\n return resolver.resolve(`${dependency}/package.json`);\n } catch (packageJsonError) {\n resolutionErrors?.push(\n `${formatResolutionError(entryResolutionError)} | ${formatResolutionError(packageJsonError)}`,\n );\n return null;\n }\n}\n\nexport async function copyRuntimeDependencyTree(\n appRoot: string,\n runtimeRoot: string,\n rootDependency: string,\n consumerLabel: string,\n): Promise<void> {\n const appRequire = createRequire(path.join(appRoot, \"package.json\"));\n const resuxPackageRequire = resolveResuxPackageRequire(appRequire);\n const rootResolvers = [appRequire, ...(resuxPackageRequire ? [resuxPackageRequire] : [])];\n const resolutionErrors: string[] = [];\n let rootDependencyPackageJsonPath: string | null = null;\n\n for (const resolver of rootResolvers) {\n rootDependencyPackageJsonPath = await resolveDependencyPackageJsonPath(\n rootDependency,\n resolver,\n resolutionErrors,\n );\n if (rootDependencyPackageJsonPath) {\n break;\n }\n }\n\n if (!rootDependencyPackageJsonPath) {\n throw new Error(\n `${consumerLabel} requires \"${rootDependency}\" but it could not be resolved from app or framework dependencies. (${resolutionErrors.join(\" | \")})`,\n );\n }\n\n const pending = [{\n dependency: rootDependency,\n packageJsonPath: rootDependencyPackageJsonPath,\n }];\n const copied = new Set<string>();\n\n while (pending.length > 0) {\n const next = pending.shift();\n if (!next || copied.has(next.dependency)) {\n continue;\n }\n copied.add(next.dependency);\n\n const sourcePackageJsonPath = next.packageJsonPath;\n const sourcePackageRoot = path.dirname(sourcePackageJsonPath);\n const targetPackageRoot = dependencyTargetPath(runtimeRoot, next.dependency);\n\n await rm(targetPackageRoot, { recursive: true, force: true });\n await mkdir(path.dirname(targetPackageRoot), { recursive: true });\n await cp(sourcePackageRoot, targetPackageRoot, {\n recursive: true,\n force: true,\n dereference: true,\n });\n\n const packageJson = (await readJsonRecord(sourcePackageJsonPath)) as PackageRecord | null;\n if (!packageJson) {\n continue;\n }\n\n const dependencyResolver = createRequire(sourcePackageJsonPath);\n for (const dependency of runtimeDependencyNames(packageJson.dependencies)) {\n const dependencyPackageJsonPath = await resolveDependencyPackageJsonPath(\n dependency,\n dependencyResolver,\n );\n if (!dependencyPackageJsonPath) {\n throw new Error(\n `${consumerLabel} dependency \"${next.dependency}\" is missing required package \"${dependency}\".`,\n );\n }\n pending.push({ dependency, packageJsonPath: dependencyPackageJsonPath });\n }\n\n for (const dependency of runtimeDependencyNames(packageJson.optionalDependencies)) {\n const dependencyPackageJsonPath = await resolveDependencyPackageJsonPath(\n dependency,\n dependencyResolver,\n );\n if (!dependencyPackageJsonPath) {\n continue;\n }\n pending.push({ dependency, packageJsonPath: dependencyPackageJsonPath });\n }\n\n // Peer dependencies are runtime requirements supplied by the consuming app\n // rather than nested package dependencies. Include installed peers in the\n // serverless closure, but do not fail packaging when an optional/uninstalled\n // peer is intentionally absent. This mirrors Node's runtime resolution model\n // without treating peer declarations as unconditional npm package imports.\n for (const dependency of runtimeDependencyNames(packageJson.peerDependencies)) {\n const dependencyPackageJsonPath = await resolveDependencyPackageJsonPath(\n dependency,\n dependencyResolver,\n );\n if (!dependencyPackageJsonPath) {\n continue;\n }\n pending.push({ dependency, packageJsonPath: dependencyPackageJsonPath });\n }\n }\n\n const requiredDependencyPath = path.join(\n dependencyTargetPath(runtimeRoot, rootDependency),\n \"package.json\",\n );\n if (!(await pathExists(requiredDependencyPath))) {\n throw new Error(\n `${consumerLabel} could not prepare \"${rootDependency}\" for ${runtimeRoot}.`,\n );\n }\n}\n\nexport async function ensureRuntimeDependencyTrees(\n appRoot: string,\n runtimeRoots: string[],\n rootDependency: string,\n consumerLabel: string,\n): Promise<void> {\n for (const runtimeRoot of runtimeRoots) {\n await copyRuntimeDependencyTree(\n appRoot,\n runtimeRoot,\n rootDependency,\n consumerLabel,\n );\n }\n}\n\nexport async function ensureServerRuntimeDependencyTrees(\n appRoot: string,\n serverRoot: string,\n runtimeRoots: string[],\n consumerLabel: string,\n): Promise<string[]> {\n const dependencies = await collectServerRuntimeDependencyNames(serverRoot);\n for (const dependency of dependencies) {\n await ensureRuntimeDependencyTrees(\n appRoot,\n runtimeRoots,\n dependency,\n `${consumerLabel} server runtime`,\n );\n }\n return dependencies;\n}"],"mappings":";;;;;;;AAcA,MAAM,eAAe,IAAI,IACvB,eAAe,SAAS,SAAS,CAC/B,MACA,KAAK,WAAW,QAAQ,GAAG,KAAK,MAAM,EAAE,GAAG,QAAQ,OACpD,CAAC,CACH;AAED,SAAS,SAAS,OAAkD;AAClE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG7E,SAAS,uBAAuB,OAA0B;AACxD,KAAI,CAAC,SAAS,MAAM,CAClB,QAAO,EAAE;AAEX,QAAO,OAAO,KAAK,MAAM,CAAC,QAAQ,SAAS,KAAK,MAAM,CAAC,SAAS,EAAE;;AAGpE,SAAS,qBAAqB,aAAqB,aAA6B;AAC9E,QAAO,KAAK,KAAK,aAAa,gBAAgB,GAAG,YAAY,MAAM,IAAI,CA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e,EACjD,eACD,CAC6C,CAC5C,OAAM,IAAI,MACR,GAAG,cAAc,sBAAsB,eAAe,QAAQ,YAAY,GAC3E;;AAIL,eAAsB,6BACpB,SACA,cACA,gBACA,eACe;AACf,MAAK,MAAM,eAAe,aACxB,OAAM,0BACJ,SACA,aACA,gBACA,cACD;;AAIL,eAAsB,mCACpB,SACA,YACA,cACA,eACmB;CACnB,MAAM,eAAe,MAAM,oCAAoC,WAAW;AAC1E,MAAK,MAAM,cAAc,aACvB,OAAM,6BACJ,SACA,cACA,YACA,GAAG,cAAc,iBAClB;AAEH,QAAO"}
1
+ {"version":3,"file":"runtime-dependencies.js","names":[],"sources":["../../src/deploy/runtime-dependencies.ts"],"sourcesContent":["import { cp, mkdir, readFile, readdir, rm } from \"node:fs/promises\";\nimport { builtinModules, createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport ts from \"typescript\";\nimport { pathExists, readJsonRecord } from \"./common.js\";\n\ninterface PackageRecord extends Record<string, unknown> {\n name?: unknown;\n dependencies?: unknown;\n optionalDependencies?: unknown;\n peerDependencies?: unknown;\n peerDependenciesMeta?: unknown;\n}\n\nconst nodeBuiltins = new Set(\n builtinModules.flatMap((name) => [\n name,\n name.startsWith(\"node:\") ? name.slice(5) : `node:${name}`,\n ]),\n);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction runtimeDependencyNames(value: unknown): string[] {\n if (!isRecord(value)) {\n return [];\n }\n return Object.keys(value).filter((name) => name.trim().length > 0);\n}\n\nfunction dependencyTargetPath(runtimeRoot: string, packageName: string): string {\n return path.join(runtimeRoot, \"node_modules\", ...packageName.split(\"/\"));\n}\n\nfunction packageNameFromSpecifier(specifier: string): string | null {\n if (\n !specifier\n || specifier.startsWith(\".\")\n || specifier.startsWith(\"/\")\n || specifier.startsWith(\"#\")\n || specifier.startsWith(\"data:\")\n || specifier.startsWith(\"file:\")\n || nodeBuiltins.has(specifier)\n ) {\n return null;\n }\n\n if (specifier.startsWith(\"@\")) {\n const [scope, name] = specifier.split(\"/\");\n return scope && name ? `${scope}/${name}` : null;\n }\n\n const packageName = specifier.split(\"/\")[0] ?? \"\";\n return packageName && !nodeBuiltins.has(packageName) ? packageName : null;\n}\n\nasync function walkRuntimeModuleFiles(directory: string): Promise<string[]> {\n const entries = await readdir(directory, { withFileTypes: true }).catch(() => []);\n const files: string[] = [];\n\n for (const entry of entries) {\n const fullPath = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n files.push(...(await walkRuntimeModuleFiles(fullPath)));\n continue;\n }\n if (entry.isFile() && /\\.(?:mjs|cjs|js)$/.test(entry.name)) {\n files.push(fullPath);\n }\n }\n\n return files;\n}\n\nfunction collectModuleSpecifiers(sourceFile: ts.SourceFile): string[] {\n const specifiers: string[] = [];\n\n function visit(node: ts.Node): void {\n if (\n (ts.isImportDeclaration(node) || ts.isExportDeclaration(node))\n && node.moduleSpecifier\n && ts.isStringLiteralLike(node.moduleSpecifier)\n ) {\n specifiers.push(node.moduleSpecifier.text);\n } else if (\n ts.isCallExpression(node)\n && node.expression.kind === ts.SyntaxKind.ImportKeyword\n && node.arguments.length === 1\n && ts.isStringLiteralLike(node.arguments[0])\n ) {\n specifiers.push(node.arguments[0].text);\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return specifiers;\n}\n\nexport async function collectServerRuntimeDependencyNames(\n serverRoot: string,\n): Promise<string[]> {\n if (!(await pathExists(serverRoot))) {\n return [];\n }\n\n const dependencyNames = new Set<string>();\n\n for (const file of await walkRuntimeModuleFiles(serverRoot)) {\n const source = await readFile(file, \"utf8\");\n const sourceFile = ts.createSourceFile(\n file,\n source,\n ts.ScriptTarget.Latest,\n false,\n ts.ScriptKind.JS,\n );\n\n for (const specifier of collectModuleSpecifiers(sourceFile)) {\n const packageName = packageNameFromSpecifier(specifier);\n if (packageName && packageName !== \"resuxjs\" && packageName !== \"resux\") {\n dependencyNames.add(packageName);\n }\n }\n }\n\n return [...dependencyNames].sort();\n}\n\nfunction resolveResuxPackageRequire(\n appRequire: ReturnType<typeof createRequire>,\n): ReturnType<typeof createRequire> | null {\n for (const packageName of [\"resuxjs\", \"resux\"]) {\n try {\n return createRequire(appRequire.resolve(packageName));\n } catch {\n try {\n return createRequire(appRequire.resolve(`${packageName}/package.json`));\n } catch {\n // Keep trying known package names.\n }\n }\n }\n return null;\n}\n\nfunction formatResolutionError(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nasync function findPackageJsonFromEntry(\n dependency: string,\n entryPath: string,\n): Promise<string | null> {\n let currentDirectory = path.dirname(entryPath);\n\n while (true) {\n const candidate = path.join(currentDirectory, \"package.json\");\n const packageJson = (await readJsonRecord(candidate)) as PackageRecord | null;\n if (packageJson?.name === dependency) {\n return candidate;\n }\n\n const parentDirectory = path.dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n return null;\n }\n currentDirectory = parentDirectory;\n }\n}\n\nasync function findPackageJsonFromSearchPaths(\n dependency: string,\n resolver: ReturnType<typeof createRequire>,\n): Promise<string | null> {\n const searchPaths = resolver.resolve.paths(dependency) ?? [];\n for (const nodeModulesRoot of searchPaths) {\n const candidate = path.join(\n nodeModulesRoot,\n ...dependency.split(\"/\"),\n \"package.json\",\n );\n const packageJson = (await readJsonRecord(candidate)) as PackageRecord | null;\n if (packageJson?.name === dependency) {\n return candidate;\n }\n }\n return null;\n}\n\nasync function resolveDependencyPackageJsonPath(\n dependency: string,\n resolver: ReturnType<typeof createRequire>,\n resolutionErrors?: string[],\n): Promise<string | null> {\n let entryResolutionError: unknown = null;\n try {\n const entryPath = resolver.resolve(dependency);\n const packageJsonPath = await findPackageJsonFromEntry(dependency, entryPath);\n if (packageJsonPath) {\n return packageJsonPath;\n }\n entryResolutionError = new Error(\n `Resolved \"${dependency}\" to ${entryPath}, but its package root could not be located.`,\n );\n } catch (error) {\n entryResolutionError = error;\n }\n\n // Native packages such as @img/sharp-linux-x64 intentionally expose only\n // specific subpaths, so neither the package root nor ./package.json is\n // necessarily resolvable through exports. Node still exposes the node_modules\n // lookup roots; inspect those roots directly without bypassing package identity.\n const searchPathPackageJson = await findPackageJsonFromSearchPaths(dependency, resolver);\n if (searchPathPackageJson) {\n return searchPathPackageJson;\n }\n\n // Preserve compatibility with packages that explicitly export package.json.\n try {\n return resolver.resolve(`${dependency}/package.json`);\n } catch (packageJsonError) {\n resolutionErrors?.push(\n `${formatResolutionError(entryResolutionError)} | ${formatResolutionError(packageJsonError)}`,\n );\n return null;\n }\n}\n\nexport async function copyRuntimeDependencyTree(\n appRoot: string,\n runtimeRoot: string,\n rootDependency: string,\n consumerLabel: string,\n): Promise<void> {\n const appRequire = createRequire(path.join(appRoot, \"package.json\"));\n const resuxPackageRequire = resolveResuxPackageRequire(appRequire);\n const rootResolvers = [appRequire, ...(resuxPackageRequire ? [resuxPackageRequire] : [])];\n const resolutionErrors: string[] = [];\n let rootDependencyPackageJsonPath: string | null = null;\n\n for (const resolver of rootResolvers) {\n rootDependencyPackageJsonPath = await resolveDependencyPackageJsonPath(\n rootDependency,\n resolver,\n resolutionErrors,\n );\n if (rootDependencyPackageJsonPath) {\n break;\n }\n }\n\n if (!rootDependencyPackageJsonPath) {\n throw new Error(\n `${consumerLabel} requires \"${rootDependency}\" but it could not be resolved from app or framework dependencies. (${resolutionErrors.join(\" | \")})`,\n );\n }\n\n const pending = [{\n dependency: rootDependency,\n packageJsonPath: rootDependencyPackageJsonPath,\n }];\n const copied = new Set<string>();\n\n while (pending.length > 0) {\n const next = pending.shift();\n if (!next || copied.has(next.dependency)) {\n continue;\n }\n copied.add(next.dependency);\n\n const sourcePackageJsonPath = next.packageJsonPath;\n const sourcePackageRoot = path.dirname(sourcePackageJsonPath);\n const targetPackageRoot = dependencyTargetPath(runtimeRoot, next.dependency);\n\n await rm(targetPackageRoot, { recursive: true, force: true });\n await mkdir(path.dirname(targetPackageRoot), { recursive: true });\n await cp(sourcePackageRoot, targetPackageRoot, {\n recursive: true,\n force: true,\n dereference: true,\n });\n\n const packageJson = (await readJsonRecord(sourcePackageJsonPath)) as PackageRecord | null;\n if (!packageJson) {\n continue;\n }\n\n const dependencyResolver = createRequire(sourcePackageJsonPath);\n for (const dependency of runtimeDependencyNames(packageJson.dependencies)) {\n const dependencyPackageJsonPath = await resolveDependencyPackageJsonPath(\n dependency,\n dependencyResolver,\n );\n if (!dependencyPackageJsonPath) {\n throw new Error(\n `${consumerLabel} dependency \"${next.dependency}\" is missing required package \"${dependency}\".`,\n );\n }\n pending.push({ dependency, packageJsonPath: dependencyPackageJsonPath });\n }\n\n for (const dependency of runtimeDependencyNames(packageJson.optionalDependencies)) {\n const dependencyPackageJsonPath = await resolveDependencyPackageJsonPath(\n dependency,\n dependencyResolver,\n );\n if (!dependencyPackageJsonPath) {\n continue;\n }\n pending.push({ dependency, packageJsonPath: dependencyPackageJsonPath });\n }\n\n // Peer dependencies are runtime requirements supplied by the consuming app\n // rather than nested package dependencies. Include installed peers in the\n // serverless closure, but do not fail packaging when an optional/uninstalled\n // peer is intentionally absent. This mirrors Node's runtime resolution model\n // without treating peer declarations as unconditional npm package imports.\n for (const dependency of runtimeDependencyNames(packageJson.peerDependencies)) {\n const dependencyPackageJsonPath = await resolveDependencyPackageJsonPath(\n dependency,\n dependencyResolver,\n );\n if (!dependencyPackageJsonPath) {\n continue;\n }\n pending.push({ dependency, packageJsonPath: dependencyPackageJsonPath });\n }\n }\n\n const requiredDependencyPath = path.join(\n dependencyTargetPath(runtimeRoot, rootDependency),\n \"package.json\",\n );\n if (!(await pathExists(requiredDependencyPath))) {\n throw new Error(\n `${consumerLabel} could not prepare \"${rootDependency}\" for ${runtimeRoot}.`,\n );\n }\n}\n\nexport async function ensureRuntimeDependencyTrees(\n appRoot: string,\n runtimeRoots: string[],\n rootDependency: string,\n consumerLabel: string,\n): Promise<void> {\n for (const runtimeRoot of runtimeRoots) {\n await copyRuntimeDependencyTree(\n appRoot,\n runtimeRoot,\n rootDependency,\n consumerLabel,\n );\n }\n}\n\nexport async function ensureServerRuntimeDependencyTrees(\n appRoot: string,\n serverRoot: string,\n runtimeRoots: string[],\n consumerLabel: string,\n): Promise<string[]> {\n const dependencies = await collectServerRuntimeDependencyNames(serverRoot);\n for (const dependency of dependencies) {\n await ensureRuntimeDependencyTrees(\n appRoot,\n runtimeRoots,\n dependency,\n `${consumerLabel} server runtime`,\n );\n }\n return dependencies;\n}"],"mappings":";;;;;;AAcA,MAAM,eAAe,IAAI,IACvB,eAAe,SAAS,SAAS,CAC/B,MACA,KAAK,WAAW,OAAO,IAAI,KAAK,MAAM,CAAC,IAAI,QAAQ,MACrD,CAAC,CACH;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,uBAAuB,OAA0B;CACxD,IAAI,CAAC,SAAS,KAAK,GACjB,OAAO,CAAC;CAEV,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ,SAAS,KAAK,KAAK,CAAC,CAAC,SAAS,CAAC;AACnE;AAEA,SAAS,qBAAqB,aAAqB,aAA6B;CAC9E,OAAO,KAAK,KAAK,aAAa,gBAAgB,GAAG,YAAY,MAAM,GAAG,CAAC;AACzE;AAEA,SAAS,yBAAyB,WAAkC;CAClE,IACE,CAAC,aACE,UAAU,WAAW,GAAG,KACxB,UAAU,WAAW,GAAG,KACxB,UAAU,WAAW,GAAG,KACxB,UAAU,WAAW,OAAO,KAC5B,UAAU,WAAW,OAAO,KAC5B,aAAa,IAAI,SAAS,GAE7B,OAAO;CAGT,IAAI,UAAU,WAAW,GAAG,GAAG;EAC7B,MAAM,CAAC,OAAO,QAAQ,UAAU,MAAM,GAAG;EACzC,OAAO,SAAS,OAAO,GAAG,MAAM,GAAG,SAAS;CAC9C;CAEA,MAAM,cAAc,UAAU,MAAM,GAAG,CAAC,CAAC,MAAM;CAC/C,OAAO,eAAe,CAAC,aAAa,IAAI,WAAW,IA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CAAoC,UAAU;CACzE,KAAK,MAAM,cAAc,cACvB,MAAM,6BACJ,SACA,cACA,YACA,GAAG,cAAc,gBACnB;CAEF,OAAO;AACT"}
@@ -1,7 +1,3 @@
1
1
  import { DeployTargetModule } from "./types.js";
2
-
3
- //#region src/deploy/static.d.ts
4
- declare const staticDeployModule: DeployTargetModule;
5
- //#endregion
6
- export { staticDeployModule };
2
+ export declare const staticDeployModule: DeployTargetModule;
7
3
  //# sourceMappingURL=static.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { assertRuntimeClientAsset, ensureResuxClientAssets } from "./common.js";
2
2
  import path from "node:path";
3
-
4
- //#region src/deploy/static.ts
3
+ // src/deploy/static.ts
5
4
  async function postBuild(context) {
6
5
  await ensureResuxClientAssets(context.appRoot, [{
7
6
  root: path.join(context.appRoot, ".output"),
@@ -16,7 +15,6 @@ const staticDeployModule = {
16
15
  inferPreset: () => "static",
17
16
  postBuild
18
17
  };
19
-
20
- //#endregion
21
18
  export { staticDeployModule };
19
+
22
20
  //# sourceMappingURL=static.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"static.js","names":[],"sources":["../../src/deploy/static.ts"],"sourcesContent":["import path from \"node:path\";\nimport { assertRuntimeClientAsset, ensureResuxClientAssets } from \"./common.js\";\nimport type { DeployBuildContext, DeployTargetModule } from \"./types.js\";\n\nasync function postBuild(context: DeployBuildContext): Promise<void> {\n await ensureResuxClientAssets(context.appRoot, [\n {\n root: path.join(context.appRoot, \".output\"),\n target: path.join(context.appRoot, \".output\", \"public\", \"__resux\"),\n },\n ]);\n\n await assertRuntimeClientAsset(path.join(context.appRoot, \".output\", \"public\"));\n}\n\nexport const staticDeployModule: DeployTargetModule = {\n target: \"static\",\n presetAliases: [\"static\", \"_static\"],\n outputLabel: \".output/public\",\n inferPreset: () => \"static\",\n postBuild,\n};\n"],"mappings":";;;;AAIA,eAAe,UAAU,SAA4C;AACnE,OAAM,wBAAwB,QAAQ,SAAS,CAC7C;EACE,MAAM,KAAK,KAAK,QAAQ,SAAS,UAAU;EAC3C,QAAQ,KAAK,KAAK,QAAQ,SAAS,WAAW,UAAU,UAAU;EACnE,CACF,CAAC;AAEF,OAAM,yBAAyB,KAAK,KAAK,QAAQ,SAAS,WAAW,SAAS,CAAC;;AAGjF,MAAa,qBAAyC;CACpD,QAAQ;CACR,eAAe,CAAC,UAAU,UAAU;CACpC,aAAa;CACb,mBAAmB;CACnB;CACD"}
1
+ {"version":3,"file":"static.js","names":[],"sources":["../../src/deploy/static.ts"],"sourcesContent":["import path from \"node:path\";\nimport { assertRuntimeClientAsset, ensureResuxClientAssets } from \"./common.js\";\nimport type { DeployBuildContext, DeployTargetModule } from \"./types.js\";\n\nasync function postBuild(context: DeployBuildContext): Promise<void> {\n await ensureResuxClientAssets(context.appRoot, [\n {\n root: path.join(context.appRoot, \".output\"),\n target: path.join(context.appRoot, \".output\", \"public\", \"__resux\"),\n },\n ]);\n\n await assertRuntimeClientAsset(path.join(context.appRoot, \".output\", \"public\"));\n}\n\nexport const staticDeployModule: DeployTargetModule = {\n target: \"static\",\n presetAliases: [\"static\", \"_static\"],\n outputLabel: \".output/public\",\n inferPreset: () => \"static\",\n postBuild,\n};\n"],"mappings":";;;AAIA,eAAe,UAAU,SAA4C;CACnE,MAAM,wBAAwB,QAAQ,SAAS,CAC7C;EACE,MAAM,KAAK,KAAK,QAAQ,SAAS,SAAS;EAC1C,QAAQ,KAAK,KAAK,QAAQ,SAAS,WAAW,UAAU,SAAS;CACnE,CACF,CAAC;CAED,MAAM,yBAAyB,KAAK,KAAK,QAAQ,SAAS,WAAW,QAAQ,CAAC;AAChF;AAEA,MAAa,qBAAyC;CACpD,QAAQ;CACR,eAAe,CAAC,UAAU,SAAS;CACnC,aAAa;CACb,mBAAmB;CACnB;AACF"}
@@ -1,25 +1,24 @@
1
- //#region src/deploy/types.d.ts
2
- type ResuxDeployTarget = "auto" | "node" | "vercel" | "netlify" | "cloudflare" | "static";
3
- type ResuxResolvedDeployTarget = Exclude<ResuxDeployTarget, "auto">;
4
- interface ResuxDeployConfig {
1
+ export type ResuxDeployTarget = "auto" | "node" | "vercel" | "netlify" | "cloudflare" | "static";
2
+ export type ResuxResolvedDeployTarget = Exclude<ResuxDeployTarget, "auto">;
3
+ export interface ResuxDeployConfig {
5
4
  target?: ResuxDeployTarget;
6
5
  nitroPreset?: string;
7
6
  }
8
- interface DeployBuildContext {
7
+ export interface DeployBuildContext {
9
8
  appRoot: string;
10
9
  outDir: string;
11
10
  env: NodeJS.ProcessEnv;
12
11
  nitroPreset: string | null;
13
12
  target: ResuxResolvedDeployTarget;
14
13
  }
15
- interface DeployDetectionContext {
14
+ export interface DeployDetectionContext {
16
15
  appRoot: string;
17
16
  outDir: string;
18
17
  env: NodeJS.ProcessEnv;
19
18
  explicitNitroPreset: string | null;
20
19
  deployConfig: ResuxDeployConfig;
21
20
  }
22
- interface DeployTargetModule {
21
+ export interface DeployTargetModule {
23
22
  target: ResuxResolvedDeployTarget;
24
23
  presetAliases: string[];
25
24
  outputLabel: string;
@@ -27,12 +26,10 @@ interface DeployTargetModule {
27
26
  inferPreset?(context: DeployDetectionContext): string | null;
28
27
  postBuild?(context: DeployBuildContext): Promise<void>;
29
28
  }
30
- interface DeploymentResolution {
29
+ export interface DeploymentResolution {
31
30
  target: ResuxResolvedDeployTarget;
32
31
  nitroPreset: string | null;
33
32
  outputLabel: string;
34
33
  reason: string;
35
34
  }
36
- //#endregion
37
- export { DeployBuildContext, DeployDetectionContext, DeployTargetModule, DeploymentResolution, ResuxDeployConfig, ResuxDeployTarget, ResuxResolvedDeployTarget };
38
35
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1,8 +1,4 @@
1
1
  import { DeployTargetModule } from "./types.js";
2
-
3
- //#region src/deploy/vercel.d.ts
4
- declare function resolveVercelNodeRuntime(nodeVersion?: string): string;
5
- declare const vercelDeployModule: DeployTargetModule;
6
- //#endregion
7
- export { resolveVercelNodeRuntime, vercelDeployModule };
2
+ export declare function resolveVercelNodeRuntime(nodeVersion?: string): string;
3
+ export declare const vercelDeployModule: DeployTargetModule;
8
4
  //# sourceMappingURL=vercel.d.ts.map
@@ -1,12 +1,11 @@
1
1
  import { assertRuntimeClientAsset, ensureResuxClientAssets, ensureResuxServerPayload, pathExists, readJsonRecord, writeJson } from "./common.js";
2
- import { ensureRuntimeDependencyTrees, ensureServerRuntimeDependencyTrees } from "./runtime-dependencies.js";
3
2
  import { ensureResuxFrameworkRuntime } from "./framework-runtime.js";
4
3
  import { ensureResuxProductionReport } from "./production-report.js";
4
+ import { ensureRuntimeDependencyTrees, ensureServerRuntimeDependencyTrees } from "./runtime-dependencies.js";
5
5
  import { existsSync } from "node:fs";
6
6
  import { cp, lstat, mkdir, readdir, realpath, rm, stat, writeFile } from "node:fs/promises";
7
7
  import path from "node:path";
8
-
9
- //#region src/deploy/vercel.ts
8
+ // src/deploy/vercel.ts
10
9
  const SUPPORTED_NODE_VERSIONS = [
11
10
  18,
12
11
  20,
@@ -173,7 +172,6 @@ const vercelDeployModule = {
173
172
  inferPreset: () => "vercel",
174
173
  postBuild
175
174
  };
176
-
177
- //#endregion
178
175
  export { resolveVercelNodeRuntime, vercelDeployModule };
176
+
179
177
  //# sourceMappingURL=vercel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vercel.js","names":[],"sources":["../../src/deploy/vercel.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { cp, lstat, mkdir, readdir, realpath, rm, stat, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n assertRuntimeClientAsset,\n ensureResuxClientAssets,\n ensureResuxServerPayload,\n pathExists,\n readJsonRecord,\n writeJson,\n} from \"./common.js\";\nimport { ensureResuxFrameworkRuntime } from \"./framework-runtime.js\";\nimport { ensureResuxProductionReport } from \"./production-report.js\";\nimport {\n ensureRuntimeDependencyTrees,\n ensureServerRuntimeDependencyTrees,\n} from \"./runtime-dependencies.js\";\nimport type {\n DeployBuildContext,\n DeployDetectionContext,\n DeployTargetModule,\n} from \"./types.js\";\n\nconst SUPPORTED_NODE_VERSIONS = [18, 20, 22] as const;\n\ntype BuildOutputRoute = Record<string, unknown>;\n\ninterface BuildOutputConfig extends Record<string, unknown> {\n version?: unknown;\n routes?: unknown;\n}\n\nfunction parseMajorNodeVersion(version: string): number {\n const major = Number.parseInt(version.split(\".\")[0] ?? \"\", 10);\n return Number.isNaN(major) ? 22 : major;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nexport function resolveVercelNodeRuntime(nodeVersion = process.versions.node): string {\n const systemNodeVersion = parseMajorNodeVersion(nodeVersion);\n const runtimeVersion =\n SUPPORTED_NODE_VERSIONS.find((version) => version >= systemNodeVersion)\n ?? SUPPORTED_NODE_VERSIONS[SUPPORTED_NODE_VERSIONS.length - 1];\n return `nodejs${runtimeVersion}.x`;\n}\n\nfunction resolveFallbackFunctionName(functionNames: string[]): string | null {\n if (functionNames.includes(\"__fallback.func\")) {\n return \"__fallback\";\n }\n if (functionNames.includes(\"[...].func\")) {\n return \"[...]\";\n }\n const fallback = functionNames.find((name) => name.endsWith(\".func\"));\n return fallback ? fallback.slice(0, -5) : null;\n}\n\nfunction isCatchAllRouteSrc(src: unknown): boolean {\n if (typeof src !== \"string\") {\n return false;\n }\n\n return src === \"/(.*)\" || src === \"/(?:.*)\" || /^\\/\\((?:\\?:)?\\.\\*\\)$/.test(src);\n}\n\nfunction routeDestIncludesFunctionName(route: Record<string, unknown>, functionName: string): boolean {\n if (typeof route.dest !== \"string\" || !functionName) {\n return false;\n }\n\n const normalizedDest = route.dest.startsWith(\"/\") ? route.dest.slice(1) : route.dest;\n return normalizedDest === functionName;\n}\n\nfunction normalizeBuildOutputConfig(value: unknown): BuildOutputConfig {\n if (!isRecord(value)) {\n return {};\n }\n return value;\n}\n\nfunction isHeaderOnlyRoute(route: BuildOutputRoute): boolean {\n if (!isRecord(route)) {\n return false;\n }\n\n return (\n typeof route.src === \"string\"\n && isRecord(route.headers)\n && route.continue !== true\n && route.dest === undefined\n && route.handle === undefined\n && route.status === undefined\n && route.check === undefined\n && route.middlewarePath === undefined\n );\n}\n\nfunction normalizeRoute(route: BuildOutputRoute): BuildOutputRoute {\n if (isHeaderOnlyRoute(route)) {\n return { ...route, continue: true };\n }\n return route;\n}\n\nfunction isRunningInsideVercelContainer(appRoot: string): boolean {\n const normalizedRoot = appRoot.replace(/\\\\/g, \"/\");\n if (normalizedRoot.startsWith(\"/vercel/path\")) {\n return true;\n }\n\n return (\n existsSync(\"/vercel\")\n || existsSync(\"/vercel/path\")\n || existsSync(\"/vercel/path0\")\n || existsSync(\"/vercel/output\")\n );\n}\n\nasync function detect(context: DeployDetectionContext): Promise<boolean> {\n if (isRunningInsideVercelContainer(context.appRoot)) {\n return true;\n }\n\n if (context.env.NOW_BUILDER || context.env.VERCEL || context.env.VERCEL_ENV) {\n return true;\n }\n return false;\n}\n\nasync function materializeLinkedFunctions(functionsDir: string): Promise<void> {\n const entries = await readdir(functionsDir, { withFileTypes: true }).catch(() => []);\n\n for (const entry of entries) {\n if (!entry.name.endsWith(\".func\")) {\n continue;\n }\n\n const functionPath = path.join(functionsDir, entry.name);\n const stats = await lstat(functionPath).catch(() => null);\n if (!stats?.isSymbolicLink()) {\n continue;\n }\n\n const resolvedTarget = await realpath(functionPath).catch(() => null);\n if (!resolvedTarget) {\n continue;\n }\n\n await rm(functionPath, { recursive: true, force: true });\n await cp(resolvedTarget, functionPath, {\n recursive: true,\n force: true,\n });\n }\n}\n\nasync function listFunctionDirectories(functionsDir: string): Promise<string[]> {\n const entries = await readdir(functionsDir, { withFileTypes: true }).catch(() => []);\n const functionNames: string[] = [];\n\n for (const entry of entries) {\n if (!entry.name.endsWith(\".func\")) {\n continue;\n }\n\n const functionPath = path.join(functionsDir, entry.name);\n if (entry.isDirectory()) {\n functionNames.push(entry.name);\n continue;\n }\n\n if (!entry.isSymbolicLink()) {\n continue;\n }\n\n const linkedStats = await stat(functionPath).catch(() => null);\n if (linkedStats?.isDirectory()) {\n functionNames.push(entry.name);\n }\n }\n\n return functionNames;\n}\n\nasync function postBuild(context: DeployBuildContext): Promise<void> {\n await ensureResuxClientAssets(context.appRoot, [\n {\n root: path.join(context.appRoot, \".output\"),\n target: path.join(context.appRoot, \".output\", \"public\", \"__resux\"),\n },\n {\n root: path.join(context.appRoot, \".vercel\", \"output\"),\n target: path.join(context.appRoot, \".vercel\", \"output\", \"static\", \"__resux\"),\n },\n ]);\n await assertRuntimeClientAsset(path.join(context.appRoot, \".vercel\", \"output\", \"static\"));\n\n const appAssetsDir = path.join(context.appRoot, \"assets\");\n const vercelStaticAssetsDir = path.join(context.appRoot, \".vercel\", \"output\", \"static\", \"assets\");\n if (await pathExists(appAssetsDir)) {\n await mkdir(path.dirname(vercelStaticAssetsDir), { recursive: true });\n await cp(appAssetsDir, vercelStaticAssetsDir, {\n recursive: true,\n force: true,\n });\n }\n\n const outputDir = path.join(context.appRoot, \".vercel\", \"output\");\n const functionsDir = path.join(outputDir, \"functions\");\n await materializeLinkedFunctions(functionsDir);\n\n const functionNames = await listFunctionDirectories(functionsDir);\n if (!functionNames.length) {\n throw new Error(\n \"Resux vercel deployment output is missing function directories under .vercel/output/functions.\",\n );\n }\n\n const functionRoots = functionNames.map((functionName) =>\n path.join(functionsDir, functionName)\n );\n await ensureResuxServerPayload(\n context.appRoot,\n functionRoots.map((root) => path.join(root, \".resux\", \"server\")),\n );\n await ensureResuxClientAssets(\n context.appRoot,\n functionRoots.map((root) => ({\n root,\n target: path.join(root, \".resux\", \"client\"),\n })),\n );\n await ensureResuxProductionReport(context.appRoot, functionRoots);\n await ensureResuxFrameworkRuntime(context.appRoot, functionRoots);\n await ensureServerRuntimeDependencyTrees(\n context.appRoot,\n path.join(context.appRoot, \".resux\", \"server\"),\n functionRoots,\n \"Resux Vercel\",\n );\n await ensureRuntimeDependencyTrees(\n context.appRoot,\n functionRoots,\n \"sharp\",\n \"Resux Vercel image optimizer\",\n );\n for (const functionRoot of functionRoots) {\n const manifestPath = path.join(functionRoot, \".resux\", \"server\", \"manifest.mjs\");\n if (!(await pathExists(manifestPath))) {\n const chunkManifestPath = path.join(functionRoot, \"chunks\", \"raw\", \"manifest.mjs\");\n const hasChunkManifest = await pathExists(chunkManifestPath);\n throw new Error(\n hasChunkManifest\n ? `Resux vercel deployment output is missing ${manifestPath}. Found ${chunkManifestPath} but not the copied Resux server payload. Stop concurrent dev/watch processes, clean .vercel/output, and rerun build.`\n : `Resux vercel deployment output is missing ${manifestPath}.`,\n );\n }\n }\n\n const defaultFunctionConfig = {\n runtime: resolveVercelNodeRuntime(),\n handler: \"index.mjs\",\n launcherType: \"Nodejs\",\n shouldAddHelpers: false,\n supportsResponseStreaming: true,\n };\n\n for (const functionRoot of functionRoots) {\n const functionConfigPath = path.join(functionRoot, \".vc-config.json\");\n if (!(await pathExists(functionConfigPath))) {\n await writeFile(\n functionConfigPath,\n JSON.stringify(defaultFunctionConfig, null, 2),\n \"utf8\",\n );\n }\n }\n\n const outputConfigPath = path.join(outputDir, \"config.json\");\n const parsedOutputConfig = await readJsonRecord(outputConfigPath);\n const safeOutputConfig = normalizeBuildOutputConfig(parsedOutputConfig ?? {});\n const routes = Array.isArray(safeOutputConfig.routes)\n ? (safeOutputConfig.routes as BuildOutputRoute[]).map(normalizeRoute)\n : [];\n const hasFilesystemRoute = routes.some((route) => route?.handle === \"filesystem\");\n if (!hasFilesystemRoute) {\n routes.push({ handle: \"filesystem\" });\n }\n\n const fallbackFunctionName = resolveFallbackFunctionName(functionNames);\n const hasNativeCatchAllFunction = functionNames.includes(\"[...].func\");\n const hasCatchAllRoute =\n hasNativeCatchAllFunction || routes.some((route) => isCatchAllRouteSrc(route?.src));\n const hasFallbackDest = fallbackFunctionName\n ? routes.some((route) => routeDestIncludesFunctionName(route ?? {}, fallbackFunctionName))\n : false;\n if (fallbackFunctionName && !hasCatchAllRoute && !hasFallbackDest) {\n routes.push({ src: \"/(.*)\", dest: `/${fallbackFunctionName}` });\n }\n\n const outputConfig: BuildOutputConfig = {\n ...safeOutputConfig,\n version: 3,\n routes,\n };\n await mkdir(path.dirname(outputConfigPath), { recursive: true });\n await writeJson(outputConfigPath, outputConfig);\n}\n\nexport const vercelDeployModule: DeployTargetModule = {\n target: \"vercel\",\n presetAliases: [\"vercel\", \"vercel-edge\"],\n outputLabel: \".vercel/output\",\n detect,\n inferPreset: () => \"vercel\",\n postBuild,\n};\n"],"mappings":";;;;;;;;;AAuBA,MAAM,0BAA0B;CAAC;CAAI;CAAI;CAAG;AAS5C,SAAS,sBAAsB,SAAyB;CACtD,MAAM,QAAQ,OAAO,SAAS,QAAQ,MAAM,IAAI,CAAC,MAAM,IAAI,GAAG;AAC9D,QAAO,OAAO,MAAM,MAAM,GAAG,KAAK;;AAGpC,SAAS,SAAS,OAAkD;AAClE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG7E,SAAgB,yBAAyB,cAAc,QAAQ,SAAS,MAAc;CACpF,MAAM,oBAAoB,sBAAsB,YAAY;AAI5D,QAAO,SAFL,wBAAwB,MAAM,YAAY,WAAW,kBAAkB,IACpE,wBAAwB,wBAAwB,SAAS,GAC/B;;AAGjC,SAAS,4BAA4B,eAAwC;AAC3E,KAAI,cAAc,SAAS,kBAAkB,CAC3C,QAAO;AAET,KAAI,cAAc,SAAS,aAAa,CACtC,QAAO;CAET,MAAM,WAAW,cAAc,MAAM,SAAS,KAAK,SAAS,QAAQ,CAAC;AACrE,QAAO,WAAW,SAAS,MAAM,GAAG,GAAG,GAAG;;AAG5C,SAAS,mBAAmB,KAAuB;AACjD,KAAI,OAAO,QAAQ,SACjB,QAAO;AAGT,QAAO,QAAQ,WAAW,QAAQ,aAAa,uBAAuB,KAAK,IAAI;;AAGjF,SAAS,8BAA8B,OAAgC,cAA+B;AACpG,KAAI,OAAO,MAAM,SAAS,YAAY,CAAC,aACrC,QAAO;A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gB,eAAe;EACxC,MAAM,qBAAqB,KAAK,KAAK,cAAc,kBAAkB;AACrE,MAAI,CAAE,MAAM,WAAW,mBAAmB,CACxC,OAAM,UACJ,oBACA,KAAK,UAAU,uBAAuB,MAAM,EAAE,EAC9C,OACD;;CAIL,MAAM,mBAAmB,KAAK,KAAK,WAAW,cAAc;CAE5D,MAAM,mBAAmB,2BADE,MAAM,eAAe,iBAAiB,IACS,EAAE,CAAC;CAC7E,MAAM,SAAS,MAAM,QAAQ,iBAAiB,OAAO,GAChD,iBAAiB,OAA8B,IAAI,eAAe,GACnE,EAAE;AAEN,KAAI,CADuB,OAAO,MAAM,UAAU,OAAO,WAAW,aAAa,CAE/E,QAAO,KAAK,EAAE,QAAQ,cAAc,CAAC;CAGvC,MAAM,uBAAuB,4BAA4B,cAAc;CAEvE,MAAM,mBAD4B,cAAc,SAAS,aAAa,IAEvC,OAAO,MAAM,UAAU,mBAAmB,OAAO,IAAI,CAAC;CACrF,MAAM,kBAAkB,uBACpB,OAAO,MAAM,UAAU,8BAA8B,SAAS,EAAE,EAAE,qBAAqB,CAAC,GACxF;AACJ,KAAI,wBAAwB,CAAC,oBAAoB,CAAC,gBAChD,QAAO,KAAK;EAAE,KAAK;EAAS,MAAM,IAAI;EAAwB,CAAC;CAGjE,MAAM,eAAkC;EACtC,GAAG;EACH,SAAS;EACT;EACD;AACD,OAAM,MAAM,KAAK,QAAQ,iBAAiB,EAAE,EAAE,WAAW,MAAM,CAAC;AAChE,OAAM,UAAU,kBAAkB,aAAa;;AAGjD,MAAa,qBAAyC;CACpD,QAAQ;CACR,eAAe,CAAC,UAAU,cAAc;CACxC,aAAa;CACb;CACA,mBAAmB;CACnB;CACD"}
1
+ {"version":3,"file":"vercel.js","names":[],"sources":["../../src/deploy/vercel.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { cp, lstat, mkdir, readdir, realpath, rm, stat, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n assertRuntimeClientAsset,\n ensureResuxClientAssets,\n ensureResuxServerPayload,\n pathExists,\n readJsonRecord,\n writeJson,\n} from \"./common.js\";\nimport { ensureResuxFrameworkRuntime } from \"./framework-runtime.js\";\nimport { ensureResuxProductionReport } from \"./production-report.js\";\nimport {\n ensureRuntimeDependencyTrees,\n ensureServerRuntimeDependencyTrees,\n} from \"./runtime-dependencies.js\";\nimport type {\n DeployBuildContext,\n DeployDetectionContext,\n DeployTargetModule,\n} from \"./types.js\";\n\nconst SUPPORTED_NODE_VERSIONS = [18, 20, 22] as const;\n\ntype BuildOutputRoute = Record<string, unknown>;\n\ninterface BuildOutputConfig extends Record<string, unknown> {\n version?: unknown;\n routes?: unknown;\n}\n\nfunction parseMajorNodeVersion(version: string): number {\n const major = Number.parseInt(version.split(\".\")[0] ?? \"\", 10);\n return Number.isNaN(major) ? 22 : major;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nexport function resolveVercelNodeRuntime(nodeVersion = process.versions.node): string {\n const systemNodeVersion = parseMajorNodeVersion(nodeVersion);\n const runtimeVersion =\n SUPPORTED_NODE_VERSIONS.find((version) => version >= systemNodeVersion)\n ?? SUPPORTED_NODE_VERSIONS[SUPPORTED_NODE_VERSIONS.length - 1];\n return `nodejs${runtimeVersion}.x`;\n}\n\nfunction resolveFallbackFunctionName(functionNames: string[]): string | null {\n if (functionNames.includes(\"__fallback.func\")) {\n return \"__fallback\";\n }\n if (functionNames.includes(\"[...].func\")) {\n return \"[...]\";\n }\n const fallback = functionNames.find((name) => name.endsWith(\".func\"));\n return fallback ? fallback.slice(0, -5) : null;\n}\n\nfunction isCatchAllRouteSrc(src: unknown): boolean {\n if (typeof src !== \"string\") {\n return false;\n }\n\n return src === \"/(.*)\" || src === \"/(?:.*)\" || /^\\/\\((?:\\?:)?\\.\\*\\)$/.test(src);\n}\n\nfunction routeDestIncludesFunctionName(route: Record<string, unknown>, functionName: string): boolean {\n if (typeof route.dest !== \"string\" || !functionName) {\n return false;\n }\n\n const normalizedDest = route.dest.startsWith(\"/\") ? route.dest.slice(1) : route.dest;\n return normalizedDest === functionName;\n}\n\nfunction normalizeBuildOutputConfig(value: unknown): BuildOutputConfig {\n if (!isRecord(value)) {\n return {};\n }\n return value;\n}\n\nfunction isHeaderOnlyRoute(route: BuildOutputRoute): boolean {\n if (!isRecord(route)) {\n return false;\n }\n\n return (\n typeof route.src === \"string\"\n && isRecord(route.headers)\n && route.continue !== true\n && route.dest === undefined\n && route.handle === undefined\n && route.status === undefined\n && route.check === undefined\n && route.middlewarePath === undefined\n );\n}\n\nfunction normalizeRoute(route: BuildOutputRoute): BuildOutputRoute {\n if (isHeaderOnlyRoute(route)) {\n return { ...route, continue: true };\n }\n return route;\n}\n\nfunction isRunningInsideVercelContainer(appRoot: string): boolean {\n const normalizedRoot = appRoot.replace(/\\\\/g, \"/\");\n if (normalizedRoot.startsWith(\"/vercel/path\")) {\n return true;\n }\n\n return (\n existsSync(\"/vercel\")\n || existsSync(\"/vercel/path\")\n || existsSync(\"/vercel/path0\")\n || existsSync(\"/vercel/output\")\n );\n}\n\nasync function detect(context: DeployDetectionContext): Promise<boolean> {\n if (isRunningInsideVercelContainer(context.appRoot)) {\n return true;\n }\n\n if (context.env.NOW_BUILDER || context.env.VERCEL || context.env.VERCEL_ENV) {\n return true;\n }\n return false;\n}\n\nasync function materializeLinkedFunctions(functionsDir: string): Promise<void> {\n const entries = await readdir(functionsDir, { withFileTypes: true }).catch(() => []);\n\n for (const entry of entries) {\n if (!entry.name.endsWith(\".func\")) {\n continue;\n }\n\n const functionPath = path.join(functionsDir, entry.name);\n const stats = await lstat(functionPath).catch(() => null);\n if (!stats?.isSymbolicLink()) {\n continue;\n }\n\n const resolvedTarget = await realpath(functionPath).catch(() => null);\n if (!resolvedTarget) {\n continue;\n }\n\n await rm(functionPath, { recursive: true, force: true });\n await cp(resolvedTarget, functionPath, {\n recursive: true,\n force: true,\n });\n }\n}\n\nasync function listFunctionDirectories(functionsDir: string): Promise<string[]> {\n const entries = await readdir(functionsDir, { withFileTypes: true }).catch(() => []);\n const functionNames: string[] = [];\n\n for (const entry of entries) {\n if (!entry.name.endsWith(\".func\")) {\n continue;\n }\n\n const functionPath = path.join(functionsDir, entry.name);\n if (entry.isDirectory()) {\n functionNames.push(entry.name);\n continue;\n }\n\n if (!entry.isSymbolicLink()) {\n continue;\n }\n\n const linkedStats = await stat(functionPath).catch(() => null);\n if (linkedStats?.isDirectory()) {\n functionNames.push(entry.name);\n }\n }\n\n return functionNames;\n}\n\nasync function postBuild(context: DeployBuildContext): Promise<void> {\n await ensureResuxClientAssets(context.appRoot, [\n {\n root: path.join(context.appRoot, \".output\"),\n target: path.join(context.appRoot, \".output\", \"public\", \"__resux\"),\n },\n {\n root: path.join(context.appRoot, \".vercel\", \"output\"),\n target: path.join(context.appRoot, \".vercel\", \"output\", \"static\", \"__resux\"),\n },\n ]);\n await assertRuntimeClientAsset(path.join(context.appRoot, \".vercel\", \"output\", \"static\"));\n\n const appAssetsDir = path.join(context.appRoot, \"assets\");\n const vercelStaticAssetsDir = path.join(context.appRoot, \".vercel\", \"output\", \"static\", \"assets\");\n if (await pathExists(appAssetsDir)) {\n await mkdir(path.dirname(vercelStaticAssetsDir), { recursive: true });\n await cp(appAssetsDir, vercelStaticAssetsDir, {\n recursive: true,\n force: true,\n });\n }\n\n const outputDir = path.join(context.appRoot, \".vercel\", \"output\");\n const functionsDir = path.join(outputDir, \"functions\");\n await materializeLinkedFunctions(functionsDir);\n\n const functionNames = await listFunctionDirectories(functionsDir);\n if (!functionNames.length) {\n throw new Error(\n \"Resux vercel deployment output is missing function directories under .vercel/output/functions.\",\n );\n }\n\n const functionRoots = functionNames.map((functionName) =>\n path.join(functionsDir, functionName)\n );\n await ensureResuxServerPayload(\n context.appRoot,\n functionRoots.map((root) => path.join(root, \".resux\", \"server\")),\n );\n await ensureResuxClientAssets(\n context.appRoot,\n functionRoots.map((root) => ({\n root,\n target: path.join(root, \".resux\", \"client\"),\n })),\n );\n await ensureResuxProductionReport(context.appRoot, functionRoots);\n await ensureResuxFrameworkRuntime(context.appRoot, functionRoots);\n await ensureServerRuntimeDependencyTrees(\n context.appRoot,\n path.join(context.appRoot, \".resux\", \"server\"),\n functionRoots,\n \"Resux Vercel\",\n );\n await ensureRuntimeDependencyTrees(\n context.appRoot,\n functionRoots,\n \"sharp\",\n \"Resux Vercel image optimizer\",\n );\n for (const functionRoot of functionRoots) {\n const manifestPath = path.join(functionRoot, \".resux\", \"server\", \"manifest.mjs\");\n if (!(await pathExists(manifestPath))) {\n const chunkManifestPath = path.join(functionRoot, \"chunks\", \"raw\", \"manifest.mjs\");\n const hasChunkManifest = await pathExists(chunkManifestPath);\n throw new Error(\n hasChunkManifest\n ? `Resux vercel deployment output is missing ${manifestPath}. Found ${chunkManifestPath} but not the copied Resux server payload. Stop concurrent dev/watch processes, clean .vercel/output, and rerun build.`\n : `Resux vercel deployment output is missing ${manifestPath}.`,\n );\n }\n }\n\n const defaultFunctionConfig = {\n runtime: resolveVercelNodeRuntime(),\n handler: \"index.mjs\",\n launcherType: \"Nodejs\",\n shouldAddHelpers: false,\n supportsResponseStreaming: true,\n };\n\n for (const functionRoot of functionRoots) {\n const functionConfigPath = path.join(functionRoot, \".vc-config.json\");\n if (!(await pathExists(functionConfigPath))) {\n await writeFile(\n functionConfigPath,\n JSON.stringify(defaultFunctionConfig, null, 2),\n \"utf8\",\n );\n }\n }\n\n const outputConfigPath = path.join(outputDir, \"config.json\");\n const parsedOutputConfig = await readJsonRecord(outputConfigPath);\n const safeOutputConfig = normalizeBuildOutputConfig(parsedOutputConfig ?? {});\n const routes = Array.isArray(safeOutputConfig.routes)\n ? (safeOutputConfig.routes as BuildOutputRoute[]).map(normalizeRoute)\n : [];\n const hasFilesystemRoute = routes.some((route) => route?.handle === \"filesystem\");\n if (!hasFilesystemRoute) {\n routes.push({ handle: \"filesystem\" });\n }\n\n const fallbackFunctionName = resolveFallbackFunctionName(functionNames);\n const hasNativeCatchAllFunction = functionNames.includes(\"[...].func\");\n const hasCatchAllRoute =\n hasNativeCatchAllFunction || routes.some((route) => isCatchAllRouteSrc(route?.src));\n const hasFallbackDest = fallbackFunctionName\n ? routes.some((route) => routeDestIncludesFunctionName(route ?? {}, fallbackFunctionName))\n : false;\n if (fallbackFunctionName && !hasCatchAllRoute && !hasFallbackDest) {\n routes.push({ src: \"/(.*)\", dest: `/${fallbackFunctionName}` });\n }\n\n const outputConfig: BuildOutputConfig = {\n ...safeOutputConfig,\n version: 3,\n routes,\n };\n await mkdir(path.dirname(outputConfigPath), { recursive: true });\n await writeJson(outputConfigPath, outputConfig);\n}\n\nexport const vercelDeployModule: DeployTargetModule = {\n target: \"vercel\",\n presetAliases: [\"vercel\", \"vercel-edge\"],\n outputLabel: \".vercel/output\",\n detect,\n inferPreset: () => \"vercel\",\n postBuild,\n};\n"],"mappings":";;;;;;;;AAuBA,MAAM,0BAA0B;CAAC;CAAI;CAAI;AAAE;AAS3C,SAAS,sBAAsB,SAAyB;CACtD,MAAM,QAAQ,OAAO,SAAS,QAAQ,MAAM,GAAG,CAAC,CAAC,MAAM,IAAI,EAAE;CAC7D,OAAO,OAAO,MAAM,KAAK,IAAI,KAAK;AACpC;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAgB,yBAAyB,cAAc,QAAQ,SAAS,MAAc;CACpF,MAAM,oBAAoB,sBAAsB,WAAW;CAI3D,OAAO,SAFL,wBAAwB,MAAM,YAAY,WAAW,iBAAiB,KACnE,wBAAwB,wBAAwB,SAAS,GAC/B;AACjC;AAEA,SAAS,4BAA4B,eAAwC;CAC3E,IAAI,cAAc,SAAS,iBAAiB,GAC1C,OAAO;CAET,IAAI,cAAc,SAAS,YAAY,GACrC,OAAO;CAET,MAAM,WAAW,cAAc,MAAM,SAAS,KAAK,SAAS,OAAO,CAAC;CACp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;EACH,SAAS;EACT;CACF;CACA,MAAM,MAAM,KAAK,QAAQ,gBAAgB,GAAG,EAAE,WAAW,KAAK,CAAC;CAC/D,MAAM,UAAU,kBAAkB,YAAY;AAChD;AAEA,MAAa,qBAAyC;CACpD,QAAQ;CACR,eAAe,CAAC,UAAU,aAAa;CACvC,aAAa;CACb;CACA,mBAAmB;CACnB;AACF"}
@@ -1,21 +1,70 @@
1
1
  import { ResuxModuleDefinition } from "../kit/index.js";
2
-
3
- //#region src/fonts/index.d.ts
4
- interface ResuxFontFamilyInput {
2
+ export type ResuxFontStrategy = "eager" | "preload" | "lazy";
3
+ export type ResuxFontDisplay = "auto" | "block" | "swap" | "fallback" | "optional";
4
+ export type ResuxFontProvider = "google" | "local" | "remote";
5
+ export type ResuxFontWeightName = "thin" | "hairline" | "extralight" | "extra-light" | "ultralight" | "light" | "normal" | "regular" | "medium" | "semibold" | "semi-bold" | "demibold" | "bold" | "extrabold" | "extra-bold" | "ultrabold" | "black" | "heavy";
6
+ export type ResuxFontWeight = number | ResuxFontWeightName | (string & {});
7
+ export interface ResuxFontSourceInput {
8
+ url: string;
9
+ format?: "woff2" | "woff" | "truetype" | "opentype" | "embedded-opentype";
10
+ }
11
+ export interface ResuxFontFaceInput {
12
+ src: string | ResuxFontSourceInput | Array<string | ResuxFontSourceInput>;
13
+ weight?: ResuxFontWeight;
14
+ style?: "normal" | "italic" | "oblique";
15
+ display?: ResuxFontDisplay;
16
+ unicodeRange?: string;
17
+ preload?: boolean;
18
+ axes?: Record<string, number | [number, number]>;
19
+ }
20
+ export interface ResuxFontFamilyInput {
5
21
  name: string;
6
- weights?: Array<number | string>;
7
- display?: "auto" | "block" | "swap" | "fallback" | "optional";
8
- strategy?: "eager" | "preload" | "lazy";
22
+ provider?: ResuxFontProvider;
23
+ weights?: ResuxFontWeight[];
24
+ display?: ResuxFontDisplay;
25
+ strategy?: ResuxFontStrategy;
9
26
  deferUntilPageLoad?: boolean;
27
+ src?: string | ResuxFontSourceInput | Array<string | ResuxFontSourceInput>;
28
+ faces?: ResuxFontFaceInput[];
29
+ weight?: ResuxFontWeight;
30
+ style?: "normal" | "italic" | "oblique";
31
+ unicodeRange?: string;
32
+ preload?: boolean;
33
+ variable?: string;
34
+ axes?: Record<string, number | [number, number]>;
35
+ fallbacks?: string[];
10
36
  }
11
- interface ResuxFontsModuleOptions {
37
+ export interface ResuxFontsModuleOptions {
38
+ /** Enable automatic CSS/template font scanning via fontless. Defaults to true. */
39
+ autoScan?: boolean;
40
+ /** Global font defaults across all resolved families */
41
+ defaults?: {
42
+ preload?: boolean;
43
+ subsets?: string[];
44
+ weights?: ResuxFontWeight[];
45
+ styles?: Array<"normal" | "italic" | "oblique">;
46
+ fallbacks?: string[];
47
+ };
48
+ /** Provider configurations (google, bunny, fontshare, fontsource, local) */
49
+ providers?: {
50
+ google?: boolean | Record<string, unknown>;
51
+ bunny?: boolean | Record<string, unknown>;
52
+ fontshare?: boolean | Record<string, unknown>;
53
+ fontsource?: boolean | Record<string, unknown>;
54
+ local?: boolean | Record<string, unknown>;
55
+ };
56
+ /** Devtools panel toggle during development (defaults to true) */
57
+ devtools?: boolean;
58
+ /** Backward-compatible Google Fonts declaration. */
12
59
  google?: ResuxFontFamilyInput[];
60
+ /** Provider-aware families. Local/remote families can provide src/faces; Google families use weights. */
61
+ families?: ResuxFontFamilyInput[];
13
62
  preconnect?: boolean;
14
- strategy?: "eager" | "preload" | "lazy";
63
+ strategy?: ResuxFontStrategy;
15
64
  deferUntilPageLoad?: boolean;
16
65
  }
17
- declare function googleFont(input: ResuxFontFamilyInput): ResuxFontFamilyInput;
66
+ export declare function googleFont(input: ResuxFontFamilyInput): ResuxFontFamilyInput;
67
+ export declare function localFont(input: ResuxFontFamilyInput): ResuxFontFamilyInput;
18
68
  declare const _default: ResuxModuleDefinition<ResuxFontsModuleOptions>;
19
- //#endregion
20
- export { ResuxFontFamilyInput, ResuxFontsModuleOptions, _default as default, googleFont };
69
+ export { _default as default };
21
70
  //# sourceMappingURL=index.d.ts.map