resuxjs 0.3.10 → 0.4.0-beta.2

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 (361) hide show
  1. package/README.md +23 -1
  2. package/dist/bin.d.ts +1 -2
  3. package/dist/bin.js +4 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/build/index.d.ts +28 -0
  6. package/dist/build/index.js +51 -0
  7. package/dist/build/index.js.map +1 -0
  8. package/dist/cli.d.ts +15 -5
  9. package/dist/cli.js +2648 -3668
  10. package/dist/cli.js.map +1 -1
  11. package/dist/compiler/adapter.d.ts +14 -11
  12. package/dist/compiler/adapter.js +68 -93
  13. package/dist/compiler/adapter.js.map +1 -1
  14. package/dist/compiler/dev-warnings.d.ts +8 -5
  15. package/dist/compiler/dev-warnings.js +248 -321
  16. package/dist/compiler/dev-warnings.js.map +1 -1
  17. package/dist/compiler/directives.d.ts +3 -0
  18. package/dist/compiler/directives.js +124 -150
  19. package/dist/compiler/directives.js.map +1 -1
  20. package/dist/compiler/implementation.d.ts +96 -93
  21. package/dist/compiler/implementation.js +2967 -3430
  22. package/dist/compiler/index.d.ts +14 -11
  23. package/dist/compiler/index.js +68 -93
  24. package/dist/compiler/index.js.map +1 -1
  25. package/dist/core/config.d.ts +12 -5
  26. package/dist/core/config.js +42 -25
  27. package/dist/core/config.js.map +1 -1
  28. package/dist/core/hooks.d.ts +127 -126
  29. package/dist/core/hooks.js +45 -55
  30. package/dist/core/hooks.js.map +1 -1
  31. package/dist/core/index.d.ts +5 -4
  32. package/dist/core/index.js +5 -5
  33. package/dist/core/module-container.d.ts +76 -74
  34. package/dist/core/module-container.js +181 -186
  35. package/dist/core/module-container.js.map +1 -1
  36. package/dist/core/resux.d.ts +15 -12
  37. package/dist/core/resux.js +17 -13
  38. package/dist/core/resux.js.map +1 -1
  39. package/dist/create-bin.d.ts +1 -2
  40. package/dist/create-bin.js +4 -0
  41. package/dist/create-bin.js.map +1 -1
  42. package/dist/create.d.ts +3 -0
  43. package/dist/create.js +499 -638
  44. package/dist/create.js.map +1 -1
  45. package/dist/deploy/cloudflare.d.ts +4 -1
  46. package/dist/deploy/cloudflare.js +30 -34
  47. package/dist/deploy/cloudflare.js.map +1 -1
  48. package/dist/deploy/common.d.ts +6 -4
  49. package/dist/deploy/common.js +118 -188
  50. package/dist/deploy/common.js.map +1 -1
  51. package/dist/deploy/framework-runtime.d.ts +3 -0
  52. package/dist/deploy/framework-runtime.js +43 -48
  53. package/dist/deploy/framework-runtime.js.map +1 -1
  54. package/dist/deploy/index.d.ts +4 -1
  55. package/dist/deploy/index.js +58 -80
  56. package/dist/deploy/index.js.map +1 -1
  57. package/dist/deploy/netlify.d.ts +4 -1
  58. package/dist/deploy/netlify.js +40 -41
  59. package/dist/deploy/netlify.js.map +1 -1
  60. package/dist/deploy/node.d.ts +4 -1
  61. package/dist/deploy/node.js +24 -19
  62. package/dist/deploy/node.js.map +1 -1
  63. package/dist/deploy/production-report.d.ts +3 -0
  64. package/dist/deploy/production-report.js +14 -14
  65. package/dist/deploy/production-report.js.map +1 -1
  66. package/dist/deploy/runtime-dependencies.d.ts +3 -0
  67. package/dist/deploy/runtime-dependencies.js +158 -220
  68. package/dist/deploy/runtime-dependencies.js.map +1 -1
  69. package/dist/deploy/static.d.ts +4 -1
  70. package/dist/deploy/static.js +16 -14
  71. package/dist/deploy/static.js.map +1 -1
  72. package/dist/deploy/types.d.ts +25 -22
  73. package/dist/deploy/types.js +0 -1
  74. package/dist/deploy/vercel.d.ts +4 -1
  75. package/dist/deploy/vercel.js +137 -188
  76. package/dist/deploy/vercel.js.map +1 -1
  77. package/dist/fonts/index.d.ts +15 -11
  78. package/dist/fonts/index.js +114 -134
  79. package/dist/fonts/index.js.map +1 -1
  80. package/dist/globals.d.ts +79 -78
  81. package/dist/globals.js +0 -1
  82. package/dist/halal-core/ai/classifyProject.d.ts +4 -1
  83. package/dist/halal-core/ai/classifyProject.js +81 -95
  84. package/dist/halal-core/ai/classifyProject.js.map +1 -1
  85. package/dist/halal-core/ai/classifyRuntimeContent.d.ts +5 -2
  86. package/dist/halal-core/ai/classifyRuntimeContent.js +77 -95
  87. package/dist/halal-core/ai/classifyRuntimeContent.js.map +1 -1
  88. package/dist/halal-core/ai/createProjectSummary.d.ts +38 -35
  89. package/dist/halal-core/ai/createProjectSummary.js +38 -39
  90. package/dist/halal-core/ai/createProjectSummary.js.map +1 -1
  91. package/dist/halal-core/ai/halalClassifierPrompt.d.ts +3 -0
  92. package/dist/halal-core/ai/halalClassifierPrompt.js +5 -1
  93. package/dist/halal-core/ai/halalClassifierPrompt.js.map +1 -1
  94. package/dist/halal-core/ai/redactSensitiveData.d.ts +3 -0
  95. package/dist/halal-core/ai/redactSensitiveData.js +82 -110
  96. package/dist/halal-core/ai/redactSensitiveData.js.map +1 -1
  97. package/dist/halal-core/ai/validateAiResponse.d.ts +4 -1
  98. package/dist/halal-core/ai/validateAiResponse.js +58 -85
  99. package/dist/halal-core/ai/validateAiResponse.js.map +1 -1
  100. package/dist/halal-core/cli/check.d.ts +3 -0
  101. package/dist/halal-core/cli/check.js +28 -30
  102. package/dist/halal-core/cli/check.js.map +1 -1
  103. package/dist/halal-core/cli/explain.d.ts +3 -0
  104. package/dist/halal-core/cli/explain.js +27 -31
  105. package/dist/halal-core/cli/explain.js.map +1 -1
  106. package/dist/halal-core/cli/report.d.ts +3 -0
  107. package/dist/halal-core/cli/report.js +14 -10
  108. package/dist/halal-core/cli/report.js.map +1 -1
  109. package/dist/halal-core/cli/submitReview.d.ts +3 -0
  110. package/dist/halal-core/cli/submitReview.js +13 -9
  111. package/dist/halal-core/cli/submitReview.js.map +1 -1
  112. package/dist/halal-core/cli/verifyReview.d.ts +3 -0
  113. package/dist/halal-core/cli/verifyReview.js +18 -15
  114. package/dist/halal-core/cli/verifyReview.js.map +1 -1
  115. package/dist/halal-core/config.d.ts +30 -27
  116. package/dist/halal-core/config.js +76 -118
  117. package/dist/halal-core/config.js.map +1 -1
  118. package/dist/halal-core/crypto/integrity.d.ts +6 -3
  119. package/dist/halal-core/crypto/integrity.js +64 -87
  120. package/dist/halal-core/crypto/integrity.js.map +1 -1
  121. package/dist/halal-core/enforce.d.ts +3 -0
  122. package/dist/halal-core/enforce.js +92 -105
  123. package/dist/halal-core/enforce.js.map +1 -1
  124. package/dist/halal-core/index.d.ts +20 -16
  125. package/dist/halal-core/index.js +18 -19
  126. package/dist/halal-core/lifecycle.d.ts +3 -0
  127. package/dist/halal-core/lifecycle.js +15 -13
  128. package/dist/halal-core/lifecycle.js.map +1 -1
  129. package/dist/halal-core/policy.d.ts +4 -1
  130. package/dist/halal-core/policy.js +6 -2
  131. package/dist/halal-core/policy.js.map +1 -1
  132. package/dist/halal-core/report/formatBrowserOverlay.d.ts +4 -1
  133. package/dist/halal-core/report/formatBrowserOverlay.js +10 -8
  134. package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -1
  135. package/dist/halal-core/report/formatTerminalReport.d.ts +4 -1
  136. package/dist/halal-core/report/formatTerminalReport.js +27 -37
  137. package/dist/halal-core/report/formatTerminalReport.js.map +1 -1
  138. package/dist/halal-core/report/generateHalalReport.d.ts +7 -4
  139. package/dist/halal-core/report/generateHalalReport.js +26 -26
  140. package/dist/halal-core/report/generateHalalReport.js.map +1 -1
  141. package/dist/halal-core/report/signReport.d.ts +4 -1
  142. package/dist/halal-core/report/signReport.js +16 -12
  143. package/dist/halal-core/report/signReport.js.map +1 -1
  144. package/dist/halal-core/report/verifyReport.d.ts +9 -6
  145. package/dist/halal-core/report/verifyReport.js +51 -41
  146. package/dist/halal-core/report/verifyReport.js.map +1 -1
  147. package/dist/halal-core/review/createReviewRequest.d.ts +4 -1
  148. package/dist/halal-core/review/createReviewRequest.js +21 -17
  149. package/dist/halal-core/review/createReviewRequest.js.map +1 -1
  150. package/dist/halal-core/review/reviewPolicy.d.ts +3 -0
  151. package/dist/halal-core/review/reviewPolicy.js +19 -17
  152. package/dist/halal-core/review/reviewPolicy.js.map +1 -1
  153. package/dist/halal-core/review/signedReviewFile.d.ts +11 -8
  154. package/dist/halal-core/review/signedReviewFile.js +24 -22
  155. package/dist/halal-core/review/signedReviewFile.js.map +1 -1
  156. package/dist/halal-core/review/verifyReviewApproval.d.ts +9 -6
  157. package/dist/halal-core/review/verifyReviewApproval.js +68 -62
  158. package/dist/halal-core/review/verifyReviewApproval.js.map +1 -1
  159. package/dist/halal-core/rules/adultContentRules.d.ts +3 -0
  160. package/dist/halal-core/rules/adultContentRules.js +23 -23
  161. package/dist/halal-core/rules/adultContentRules.js.map +1 -1
  162. package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +3 -0
  163. package/dist/halal-core/rules/alcoholDrugVapeRules.js +22 -22
  164. package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -1
  165. package/dist/halal-core/rules/childSafetyRules.d.ts +3 -0
  166. package/dist/halal-core/rules/childSafetyRules.js +19 -19
  167. package/dist/halal-core/rules/childSafetyRules.js.map +1 -1
  168. package/dist/halal-core/rules/coreCategories.d.ts +7 -4
  169. package/dist/halal-core/rules/coreCategories.js +237 -110
  170. package/dist/halal-core/rules/coreCategories.js.map +1 -1
  171. package/dist/halal-core/rules/cyberAbuseRules.d.ts +3 -0
  172. package/dist/halal-core/rules/cyberAbuseRules.js +27 -27
  173. package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -1
  174. package/dist/halal-core/rules/defaultBlockedRules.d.ts +21 -18
  175. package/dist/halal-core/rules/defaultBlockedRules.js +158 -199
  176. package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -1
  177. package/dist/halal-core/rules/dependencyRules.d.ts +8 -5
  178. package/dist/halal-core/rules/dependencyRules.js +50 -56
  179. package/dist/halal-core/rules/dependencyRules.js.map +1 -1
  180. package/dist/halal-core/rules/endpointRules.d.ts +6 -3
  181. package/dist/halal-core/rules/endpointRules.js +21 -23
  182. package/dist/halal-core/rules/endpointRules.js.map +1 -1
  183. package/dist/halal-core/rules/environmentalHarmRules.d.ts +3 -0
  184. package/dist/halal-core/rules/environmentalHarmRules.js +17 -17
  185. package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -1
  186. package/dist/halal-core/rules/financeRibaRules.d.ts +3 -0
  187. package/dist/halal-core/rules/financeRibaRules.js +20 -20
  188. package/dist/halal-core/rules/financeRibaRules.js.map +1 -1
  189. package/dist/halal-core/rules/gamblingRules.d.ts +3 -0
  190. package/dist/halal-core/rules/gamblingRules.js +22 -22
  191. package/dist/halal-core/rules/gamblingRules.js.map +1 -1
  192. package/dist/halal-core/rules/generalHarmRules.d.ts +3 -0
  193. package/dist/halal-core/rules/generalHarmRules.js +15 -15
  194. package/dist/halal-core/rules/generalHarmRules.js.map +1 -1
  195. package/dist/halal-core/rules/healthHarmRules.d.ts +3 -0
  196. package/dist/halal-core/rules/healthHarmRules.js +19 -19
  197. package/dist/halal-core/rules/healthHarmRules.js.map +1 -1
  198. package/dist/halal-core/rules/keywordRules.d.ts +11 -8
  199. package/dist/halal-core/rules/keywordRules.js +90 -39
  200. package/dist/halal-core/rules/keywordRules.js.map +1 -1
  201. package/dist/halal-core/rules/privacyAbuseRules.d.ts +3 -0
  202. package/dist/halal-core/rules/privacyAbuseRules.js +21 -21
  203. package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -1
  204. package/dist/halal-core/rules/scamFraudRules.d.ts +3 -0
  205. package/dist/halal-core/rules/scamFraudRules.js +29 -29
  206. package/dist/halal-core/rules/scamFraudRules.js.map +1 -1
  207. package/dist/halal-core/rules/selfHarmRules.d.ts +3 -0
  208. package/dist/halal-core/rules/selfHarmRules.js +17 -17
  209. package/dist/halal-core/rules/selfHarmRules.js.map +1 -1
  210. package/dist/halal-core/rules/violenceExtremismRules.d.ts +3 -0
  211. package/dist/halal-core/rules/violenceExtremismRules.js +30 -30
  212. package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -1
  213. package/dist/halal-core/runtime/guard.d.ts +17 -14
  214. package/dist/halal-core/runtime/guard.js +162 -183
  215. package/dist/halal-core/runtime/guard.js.map +1 -1
  216. package/dist/halal-core/runtime/index.d.ts +5 -4
  217. package/dist/halal-core/runtime/index.js +4 -5
  218. package/dist/halal-core/runtime/reviewedMemory.d.ts +4 -1
  219. package/dist/halal-core/runtime/reviewedMemory.js +74 -110
  220. package/dist/halal-core/runtime/reviewedMemory.js.map +1 -1
  221. package/dist/halal-core/runtime/serializeRuntimeContent.d.ts +10 -7
  222. package/dist/halal-core/runtime/serializeRuntimeContent.js +132 -156
  223. package/dist/halal-core/runtime/serializeRuntimeContent.js.map +1 -1
  224. package/dist/halal-core/runtime/types.d.ts +44 -41
  225. package/dist/halal-core/runtime/types.js +0 -1
  226. package/dist/halal-core/scanner/scanApiRoutes.d.ts +3 -0
  227. package/dist/halal-core/scanner/scanApiRoutes.js +32 -36
  228. package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -1
  229. package/dist/halal-core/scanner/scanComponents.d.ts +3 -0
  230. package/dist/halal-core/scanner/scanComponents.js +12 -13
  231. package/dist/halal-core/scanner/scanComponents.js.map +1 -1
  232. package/dist/halal-core/scanner/scanContent.d.ts +5 -2
  233. package/dist/halal-core/scanner/scanContent.js +193 -263
  234. package/dist/halal-core/scanner/scanContent.js.map +1 -1
  235. package/dist/halal-core/scanner/scanDependencies.d.ts +3 -0
  236. package/dist/halal-core/scanner/scanDependencies.js +16 -15
  237. package/dist/halal-core/scanner/scanDependencies.js.map +1 -1
  238. package/dist/halal-core/scanner/scanDomains.d.ts +5 -2
  239. package/dist/halal-core/scanner/scanDomains.js +12 -12
  240. package/dist/halal-core/scanner/scanDomains.js.map +1 -1
  241. package/dist/halal-core/scanner/scanEnvNames.d.ts +3 -0
  242. package/dist/halal-core/scanner/scanEnvNames.js +23 -26
  243. package/dist/halal-core/scanner/scanEnvNames.js.map +1 -1
  244. package/dist/halal-core/scanner/scanMetadata.d.ts +6 -3
  245. package/dist/halal-core/scanner/scanMetadata.js +20 -29
  246. package/dist/halal-core/scanner/scanMetadata.js.map +1 -1
  247. package/dist/halal-core/scanner/scanPages.d.ts +3 -0
  248. package/dist/halal-core/scanner/scanPages.js +12 -15
  249. package/dist/halal-core/scanner/scanPages.js.map +1 -1
  250. package/dist/halal-core/scanner/scanProject.d.ts +15 -10
  251. package/dist/halal-core/scanner/scanProject.js +43 -49
  252. package/dist/halal-core/scanner/scanProject.js.map +1 -1
  253. package/dist/halal-core/scanner/scanRoutes.d.ts +3 -0
  254. package/dist/halal-core/scanner/scanRoutes.js +32 -39
  255. package/dist/halal-core/scanner/scanRoutes.js.map +1 -1
  256. package/dist/halal-core/scanner/scanTranslations.d.ts +3 -0
  257. package/dist/halal-core/scanner/scanTranslations.js +21 -29
  258. package/dist/halal-core/scanner/scanTranslations.js.map +1 -1
  259. package/dist/halal-core/status.d.ts +14 -11
  260. package/dist/halal-core/status.js +0 -1
  261. package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +3 -0
  262. package/dist/halal-core/tamper/verifyCoreIntegrity.js +26 -24
  263. package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -1
  264. package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +3 -0
  265. package/dist/halal-core/tamper/verifyLifecycleHooks.js +13 -12
  266. package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -1
  267. package/dist/halal-core/tamper/verifyReportSignature.d.ts +6 -3
  268. package/dist/halal-core/tamper/verifyReportSignature.js +20 -14
  269. package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -1
  270. package/dist/halal.d.ts +20 -1
  271. package/dist/halal.js +18 -2
  272. package/dist/i18n/index.d.ts +34 -31
  273. package/dist/i18n/index.js +219 -288
  274. package/dist/i18n/index.js.map +1 -1
  275. package/dist/i18n/shared.d.ts +18 -15
  276. package/dist/i18n/shared.js +204 -266
  277. package/dist/i18n/shared.js.map +1 -1
  278. package/dist/icons/index.d.ts +143 -139
  279. package/dist/icons/index.js +322 -273
  280. package/dist/icons/index.js.map +1 -1
  281. package/dist/index.d.ts +8 -1
  282. package/dist/index.js +7 -2
  283. package/dist/kit/index.d.ts +9 -6
  284. package/dist/kit/index.js +45 -43
  285. package/dist/kit/index.js.map +1 -1
  286. package/dist/nitro-server/index.d.ts +7 -4
  287. package/dist/nitro-server/index.js +6 -2
  288. package/dist/nitro-server/index.js.map +1 -1
  289. package/dist/node.d.ts +6 -3
  290. package/dist/node.js +88 -116
  291. package/dist/node.js.map +1 -1
  292. package/dist/reactivity/computed.d.ts +6 -3
  293. package/dist/reactivity/computed.js +46 -53
  294. package/dist/reactivity/computed.js.map +1 -1
  295. package/dist/reactivity/effect.d.ts +8 -5
  296. package/dist/reactivity/effect.js +105 -146
  297. package/dist/reactivity/effect.js.map +1 -1
  298. package/dist/reactivity/index.d.ts +8 -8
  299. package/dist/reactivity/index.js +7 -8
  300. package/dist/reactivity/reactive.d.ts +3 -0
  301. package/dist/reactivity/reactive.js +93 -133
  302. package/dist/reactivity/reactive.js.map +1 -1
  303. package/dist/reactivity/readonly.d.ts +2 -1
  304. package/dist/reactivity/readonly.js +2 -2
  305. package/dist/reactivity/ref.d.ts +15 -15
  306. package/dist/reactivity/ref.js +73 -81
  307. package/dist/reactivity/ref.js.map +1 -1
  308. package/dist/reactivity/scheduler.d.ts +3 -1
  309. package/dist/reactivity/scheduler.js +67 -69
  310. package/dist/reactivity/scheduler.js.map +1 -1
  311. package/dist/reactivity/types.d.ts +17 -14
  312. package/dist/reactivity/types.js +0 -1
  313. package/dist/reactivity/utils.d.ts +7 -4
  314. package/dist/reactivity/utils.js +25 -24
  315. package/dist/reactivity/utils.js.map +1 -1
  316. package/dist/reactivity/watch.d.ts +4 -2
  317. package/dist/reactivity/watch.js +75 -103
  318. package/dist/reactivity/watch.js.map +1 -1
  319. package/dist/runtime/core.d.ts +31 -0
  320. package/dist/runtime/core.js +156 -0
  321. package/dist/runtime/core.js.map +1 -0
  322. package/dist/runtime/index.d.ts +487 -461
  323. package/dist/runtime/index.js +4129 -5254
  324. package/dist/runtime/index.js.map +1 -1
  325. package/dist/runtime/reactivity.d.ts +7 -0
  326. package/dist/runtime/reactivity.js +6 -0
  327. package/dist/runtime/resume.d.ts +79 -0
  328. package/dist/runtime/resume.js +482 -0
  329. package/dist/runtime/resume.js.map +1 -0
  330. package/dist/runtime/router.d.ts +20 -0
  331. package/dist/runtime/router.js +60 -0
  332. package/dist/runtime/router.js.map +1 -0
  333. package/dist/runtime/streaming.d.ts +24 -0
  334. package/dist/runtime/streaming.js +200 -0
  335. package/dist/runtime/streaming.js.map +1 -0
  336. package/dist/security/media-fetch.d.ts +32 -0
  337. package/dist/security/media-fetch.js +301 -0
  338. package/dist/security/media-fetch.js.map +1 -0
  339. package/dist/security/path-boundary.d.ts +7 -0
  340. package/dist/security/path-boundary.js +70 -0
  341. package/dist/security/path-boundary.js.map +1 -0
  342. package/dist/ui/index.d.ts +1580 -1576
  343. package/dist/ui/index.js +975 -674
  344. package/dist/ui/index.js.map +1 -1
  345. package/dist/vite-builder/index.d.ts +6 -3
  346. package/dist/vite-builder/index.js +6 -2
  347. package/dist/vite-builder/index.js.map +1 -1
  348. package/package.json +46 -86
  349. package/dist/compiler/implementation.js.map +0 -1
  350. package/dist/core/index.js.map +0 -1
  351. package/dist/deploy/types.js.map +0 -1
  352. package/dist/globals.js.map +0 -1
  353. package/dist/halal-core/index.js.map +0 -1
  354. package/dist/halal-core/runtime/index.js.map +0 -1
  355. package/dist/halal-core/runtime/types.js.map +0 -1
  356. package/dist/halal-core/status.js.map +0 -1
  357. package/dist/halal.js.map +0 -1
  358. package/dist/index.js.map +0 -1
  359. package/dist/reactivity/index.js.map +0 -1
  360. package/dist/reactivity/readonly.js.map +0 -1
  361. package/dist/reactivity/types.js.map +0 -1
@@ -1,207 +1,137 @@
1
1
  import { cp, mkdir, readFile, stat, writeFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { pathToFileURL } from "node:url";
4
+ //#region src/deploy/common.ts
4
5
  function isRecord(value) {
5
- return typeof value === "object" && value !== null && !Array.isArray(value);
6
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6
7
  }
7
- export async function pathExists(file) {
8
- try {
9
- await stat(file);
10
- return true;
11
- }
12
- catch {
13
- return false;
14
- }
8
+ async function pathExists(file) {
9
+ try {
10
+ await stat(file);
11
+ return true;
12
+ } catch {
13
+ return false;
14
+ }
15
15
  }
16
- export async function readJsonRecord(file) {
17
- const raw = await readFile(file, "utf8").catch(() => null);
18
- if (raw === null) {
19
- return null;
20
- }
21
- try {
22
- const parsed = JSON.parse(raw);
23
- return isRecord(parsed) ? parsed : null;
24
- }
25
- catch {
26
- return null;
27
- }
16
+ async function readJsonRecord(file) {
17
+ const raw = await readFile(file, "utf8").catch(() => null);
18
+ if (raw === null) return null;
19
+ try {
20
+ const parsed = JSON.parse(raw);
21
+ return isRecord(parsed) ? parsed : null;
22
+ } catch {
23
+ return null;
24
+ }
28
25
  }
29
- export async function writeJson(file, value) {
30
- await mkdir(path.dirname(file), { recursive: true });
31
- await writeFile(file, JSON.stringify(value, null, 2), "utf8");
26
+ async function writeJson(file, value) {
27
+ await mkdir(path.dirname(file), { recursive: true });
28
+ await writeFile(file, JSON.stringify(value, null, 2), "utf8");
32
29
  }
33
- export function normalizeDeployTarget(value) {
34
- if (typeof value !== "string") {
35
- return null;
36
- }
37
- const normalized = value.trim().toLowerCase();
38
- if (normalized === "auto"
39
- || normalized === "node"
40
- || normalized === "vercel"
41
- || normalized === "netlify"
42
- || normalized === "cloudflare"
43
- || normalized === "static") {
44
- return normalized;
45
- }
46
- return null;
30
+ function normalizeDeployTarget(value) {
31
+ if (typeof value !== "string") return null;
32
+ const normalized = value.trim().toLowerCase();
33
+ if (normalized === "auto" || normalized === "node" || normalized === "vercel" || normalized === "netlify" || normalized === "cloudflare" || normalized === "static") return normalized;
34
+ return null;
47
35
  }
48
36
  function parseDeployConfig(value) {
49
- if (!isRecord(value)) {
50
- return {};
51
- }
52
- // Compiled Resux config modules export the full framework config, where the
53
- // deployment options live under `deploy`. Keep accepting the direct shape as
54
- // well for compatibility with callers that already pass the deploy section.
55
- const deploy = isRecord(value.deploy) ? value.deploy : value;
56
- const target = normalizeDeployTarget(deploy.target);
57
- const nitroPresetCandidate = typeof deploy.nitroPreset === "string"
58
- ? deploy.nitroPreset.trim()
59
- : typeof deploy.preset === "string"
60
- ? deploy.preset.trim()
61
- : "";
62
- return {
63
- ...(target ? { target } : {}),
64
- ...(nitroPresetCandidate ? { nitroPreset: nitroPresetCandidate } : {}),
65
- };
37
+ if (!isRecord(value)) return {};
38
+ const deploy = isRecord(value.deploy) ? value.deploy : value;
39
+ const target = normalizeDeployTarget(deploy.target);
40
+ const nitroPresetCandidate = typeof deploy.nitroPreset === "string" ? deploy.nitroPreset.trim() : typeof deploy.preset === "string" ? deploy.preset.trim() : "";
41
+ return {
42
+ ...target ? { target } : {},
43
+ ...nitroPresetCandidate ? { nitroPreset: nitroPresetCandidate } : {}
44
+ };
66
45
  }
67
- export async function loadResuxDeployConfig(appRoot, outDir) {
68
- const compiledConfigFile = path.join(outDir, "server", "config.mjs");
69
- if (await pathExists(compiledConfigFile)) {
70
- const configModule = await import(`${pathToFileURL(compiledConfigFile).href}?t=${Date.now()}`).catch(() => null);
71
- const resolved = parseDeployConfig(configModule?.default);
72
- if (resolved.target || resolved.nitroPreset) {
73
- return resolved;
74
- }
75
- }
76
- const sourceConfigFiles = [
77
- path.join(appRoot, "resux.config.ts"),
78
- path.join(appRoot, "resux.config.mjs"),
79
- path.join(appRoot, "resux.config.js"),
80
- ];
81
- for (const configFile of sourceConfigFiles) {
82
- if (!(await pathExists(configFile))) {
83
- continue;
84
- }
85
- const source = await readFile(configFile, "utf8").catch(() => "");
86
- const targetMatch = source.match(/\bdeploy\s*:\s*\{[\s\S]*?\btarget\s*:\s*["'](auto|node|vercel|netlify|cloudflare|static)["']/i);
87
- const presetMatch = source.match(/\bdeploy\s*:\s*\{[\s\S]*?\b(?:nitroPreset|preset)\s*:\s*["']([^"']+)["']/i);
88
- if (!targetMatch && !presetMatch) {
89
- continue;
90
- }
91
- const target = normalizeDeployTarget(targetMatch?.[1]);
92
- const nitroPreset = presetMatch?.[1]?.trim();
93
- return {
94
- ...(target ? { target } : {}),
95
- ...(nitroPreset ? { nitroPreset } : {}),
96
- };
97
- }
98
- return {};
46
+ async function loadResuxDeployConfig(appRoot, outDir) {
47
+ const compiledConfigFile = path.join(outDir, "server", "config.mjs");
48
+ if (await pathExists(compiledConfigFile)) {
49
+ const resolved = parseDeployConfig((await import(`${pathToFileURL(compiledConfigFile).href}?t=${Date.now()}`).catch(() => null))?.default);
50
+ if (resolved.target || resolved.nitroPreset) return resolved;
51
+ }
52
+ const sourceConfigFiles = [
53
+ path.join(appRoot, "resux.config.ts"),
54
+ path.join(appRoot, "resux.config.mjs"),
55
+ path.join(appRoot, "resux.config.js")
56
+ ];
57
+ for (const configFile of sourceConfigFiles) {
58
+ if (!await pathExists(configFile)) continue;
59
+ const source = await readFile(configFile, "utf8").catch(() => "");
60
+ const targetMatch = source.match(/\bdeploy\s*:\s*\{[\s\S]*?\btarget\s*:\s*["'](auto|node|vercel|netlify|cloudflare|static)["']/i);
61
+ const presetMatch = source.match(/\bdeploy\s*:\s*\{[\s\S]*?\b(?:nitroPreset|preset)\s*:\s*["']([^"']+)["']/i);
62
+ if (!targetMatch && !presetMatch) continue;
63
+ const target = normalizeDeployTarget(targetMatch?.[1]);
64
+ const nitroPreset = presetMatch?.[1]?.trim();
65
+ return {
66
+ ...target ? { target } : {},
67
+ ...nitroPreset ? { nitroPreset } : {}
68
+ };
69
+ }
70
+ return {};
99
71
  }
100
- export function normalizeProviderPreset(provider) {
101
- switch (provider) {
102
- case "aws_amplify":
103
- return "aws-amplify";
104
- case "azure_static":
105
- return "azure";
106
- case "cloudflare_pages":
107
- return "cloudflare-pages";
108
- case "netlify":
109
- return "netlify";
110
- case "render":
111
- return "render-com";
112
- case "stormkit":
113
- return "stormkit";
114
- case "vercel":
115
- return "vercel";
116
- case "cleavr":
117
- return "cleavr";
118
- case "zeabur":
119
- return "zeabur";
120
- default:
121
- return provider;
122
- }
72
+ function normalizeProviderPreset(provider) {
73
+ switch (provider) {
74
+ case "aws_amplify": return "aws-amplify";
75
+ case "azure_static": return "azure";
76
+ case "cloudflare_pages": return "cloudflare-pages";
77
+ case "netlify": return "netlify";
78
+ case "render": return "render-com";
79
+ case "stormkit": return "stormkit";
80
+ case "vercel": return "vercel";
81
+ case "cleavr": return "cleavr";
82
+ case "zeabur": return "zeabur";
83
+ default: return provider;
84
+ }
123
85
  }
124
- export function detectDeployProviderFromEnv(env) {
125
- if (env.NOW_BUILDER || env.VERCEL || env.VERCEL_ENV) {
126
- return "vercel";
127
- }
128
- if (env.NETLIFY && !env.NETLIFY_LOCAL) {
129
- return "netlify";
130
- }
131
- if (env.CF_PAGES || env.CLOUDFLARE_PAGES) {
132
- return "cloudflare_pages";
133
- }
134
- if (env.INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN || env.AZURE_STATIC) {
135
- return "azure_static";
136
- }
137
- if (env.AWS_AMPLIFY || env.AWS_APP_ID) {
138
- return "aws_amplify";
139
- }
140
- if (env.STORMKIT) {
141
- return "stormkit";
142
- }
143
- if (env.RENDER) {
144
- return "render";
145
- }
146
- if (env.CLEAVR) {
147
- return "cleavr";
148
- }
149
- if (env.ZEABUR) {
150
- return "zeabur";
151
- }
152
- return null;
86
+ function detectDeployProviderFromEnv(env) {
87
+ if (env.NOW_BUILDER || env.VERCEL || env.VERCEL_ENV) return "vercel";
88
+ if (env.NETLIFY && !env.NETLIFY_LOCAL) return "netlify";
89
+ if (env.CF_PAGES || env.CLOUDFLARE_PAGES) return "cloudflare_pages";
90
+ if (env.INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN || env.AZURE_STATIC) return "azure_static";
91
+ if (env.AWS_AMPLIFY || env.AWS_APP_ID) return "aws_amplify";
92
+ if (env.STORMKIT) return "stormkit";
93
+ if (env.RENDER) return "render";
94
+ if (env.CLEAVR) return "cleavr";
95
+ if (env.ZEABUR) return "zeabur";
96
+ return null;
153
97
  }
154
- export async function ensureResuxClientAssets(appRoot, targets) {
155
- if (!targets.length) {
156
- return;
157
- }
158
- const source = path.join(appRoot, ".resux", "client");
159
- if (!(await pathExists(source))) {
160
- throw new Error("Resux deployment is missing .resux/client output. Run `resux build` and retry.");
161
- }
162
- for (const { root, target } of targets) {
163
- if (!(await pathExists(root))) {
164
- continue;
165
- }
166
- await mkdir(path.dirname(target), { recursive: true });
167
- await cp(source, target, {
168
- recursive: true,
169
- force: true,
170
- });
171
- }
98
+ async function ensureResuxClientAssets(appRoot, targets) {
99
+ if (!targets.length) return;
100
+ const source = path.join(appRoot, ".resux", "client");
101
+ if (!await pathExists(source)) throw new Error("Resux deployment is missing .resux/client output. Run `resux build` and retry.");
102
+ for (const { root, target } of targets) {
103
+ if (!await pathExists(root)) continue;
104
+ await mkdir(path.dirname(target), { recursive: true });
105
+ await cp(source, target, {
106
+ recursive: true,
107
+ force: true
108
+ });
109
+ }
172
110
  }
173
- export async function ensureResuxServerPayload(appRoot, targets) {
174
- if (!targets.length) {
175
- return;
176
- }
177
- const source = path.join(appRoot, ".resux", "server");
178
- if (!(await pathExists(source))) {
179
- throw new Error("Resux deployment is missing .resux/server output. Run `resux build` and retry.");
180
- }
181
- for (const target of targets) {
182
- await mkdir(path.dirname(target), { recursive: true });
183
- await cp(source, target, {
184
- recursive: true,
185
- force: true,
186
- });
187
- }
111
+ async function ensureResuxServerPayload(appRoot, targets) {
112
+ if (!targets.length) return;
113
+ const source = path.join(appRoot, ".resux", "server");
114
+ if (!await pathExists(source)) throw new Error("Resux deployment is missing .resux/server output. Run `resux build` and retry.");
115
+ for (const target of targets) {
116
+ await mkdir(path.dirname(target), { recursive: true });
117
+ await cp(source, target, {
118
+ recursive: true,
119
+ force: true
120
+ });
121
+ }
188
122
  }
189
- export async function assertResuxServerManifest(appRoot) {
190
- const serverRoot = path.join(appRoot, ".resux", "server");
191
- if (!(await pathExists(serverRoot))) {
192
- throw new Error("Resux deployment is missing .resux/server output. Run `resux build` and retry.");
193
- }
194
- const manifestJsonPath = path.join(appRoot, ".resux", "manifest.json");
195
- const configPath = path.join(serverRoot, "config.mjs");
196
- if (!(await pathExists(manifestJsonPath)) && !(await pathExists(configPath))) {
197
- throw new Error("Resux deployment is missing .resux/manifest.json or .resux/server/config.mjs. Run `resux build` and retry.");
198
- }
123
+ async function assertResuxServerManifest(appRoot) {
124
+ const serverRoot = path.join(appRoot, ".resux", "server");
125
+ if (!await pathExists(serverRoot)) throw new Error("Resux deployment is missing .resux/server output. Run `resux build` and retry.");
126
+ const manifestJsonPath = path.join(appRoot, ".resux", "manifest.json");
127
+ const configPath = path.join(serverRoot, "config.mjs");
128
+ if (!await pathExists(manifestJsonPath) && !await pathExists(configPath)) throw new Error("Resux deployment is missing .resux/manifest.json or .resux/server/config.mjs. Run `resux build` and retry.");
199
129
  }
200
- export async function assertRuntimeClientAsset(root, relativePath = path.join("__resux", "runtime-client.mjs")) {
201
- const asset = path.join(root, relativePath);
202
- if (await pathExists(asset)) {
203
- return;
204
- }
205
- throw new Error(`Resux deployment output is missing ${relativePath.replaceAll("\\", "/")} in ${root}.`);
130
+ async function assertRuntimeClientAsset(root, relativePath = path.join("__resux", "runtime-client.mjs")) {
131
+ if (await pathExists(path.join(root, relativePath))) return;
132
+ throw new Error(`Resux deployment output is missing ${relativePath.replaceAll("\\", "/")} in ${root}.`);
206
133
  }
134
+ //#endregion
135
+ export { assertResuxServerManifest, assertRuntimeClientAsset, detectDeployProviderFromEnv, ensureResuxClientAssets, ensureResuxServerPayload, loadResuxDeployConfig, normalizeDeployTarget, normalizeProviderPreset, pathExists, readJsonRecord, writeJson };
136
+
207
137
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/deploy/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACx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IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACvD,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,4GAA4G,CAC7G,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,IAAY,EACZ,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC;IAEzD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC5C,IAAI,MAAM,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,KAAK,CACb,sCAAsC,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,IAAI,GAAG,CACvF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"common.js","names":[],"sources":["../../src/deploy/common.ts"],"sourcesContent":["import { cp, mkdir, readFile, stat, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { ResuxDeployConfig, ResuxDeployTarget } from \"./types.js\";\n\ninterface AssetCopyTarget {\n root: string;\n target: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nexport async function pathExists(file: string): Promise<boolean> {\n try {\n await stat(file);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function readJsonRecord(file: string): Promise<Record<string, unknown> | null> {\n const raw = await readFile(file, \"utf8\").catch(() => null);\n if (raw === null) {\n return null;\n }\n\n try {\n const parsed: unknown = JSON.parse(raw);\n return isRecord(parsed) ? parsed : null;\n } catch {\n return null;\n }\n}\n\nexport async function writeJson(file: string, value: unknown): Promise<void> {\n await mkdir(path.dirname(file), { recursive: true });\n await writeFile(file, JSON.stringify(value, null, 2), \"utf8\");\n}\n\nexport function normalizeDeployTarget(value: unknown): ResuxDeployTarget | null {\n if (typeof value !== \"string\") {\n return null;\n }\n\n const normalized = value.trim().toLowerCase();\n if (\n normalized === \"auto\"\n || normalized === \"node\"\n || normalized === \"vercel\"\n || normalized === \"netlify\"\n || normalized === \"cloudflare\"\n || normalized === \"static\"\n ) {\n return normalized;\n }\n\n return null;\n}\n\nfunction parseDeployConfig(value: unknown): ResuxDeployConfig {\n if (!isRecord(value)) {\n return {};\n }\n\n // Compiled Resux config modules export the full framework config, where the\n // deployment options live under `deploy`. Keep accepting the direct shape as\n // well for compatibility with callers that already pass the deploy section.\n const deploy = isRecord(value.deploy) ? value.deploy : value;\n const target = normalizeDeployTarget(deploy.target);\n const nitroPresetCandidate = typeof deploy.nitroPreset === \"string\"\n ? deploy.nitroPreset.trim()\n : typeof deploy.preset === \"string\"\n ? deploy.preset.trim()\n : \"\";\n\n return {\n ...(target ? { target } : {}),\n ...(nitroPresetCandidate ? { nitroPreset: nitroPresetCandidate } : {}),\n };\n}\n\nexport async function loadResuxDeployConfig(\n appRoot: string,\n outDir: string,\n): Promise<ResuxDeployConfig> {\n const compiledConfigFile = path.join(outDir, \"server\", \"config.mjs\");\n if (await pathExists(compiledConfigFile)) {\n const configModule = await import(\n `${pathToFileURL(compiledConfigFile).href}?t=${Date.now()}`\n ).catch(() => null);\n const resolved = parseDeployConfig((configModule as { default?: unknown } | null)?.default);\n if (resolved.target || resolved.nitroPreset) {\n return resolved;\n }\n }\n\n const sourceConfigFiles = [\n path.join(appRoot, \"resux.config.ts\"),\n path.join(appRoot, \"resux.config.mjs\"),\n path.join(appRoot, \"resux.config.js\"),\n ];\n for (const configFile of sourceConfigFiles) {\n if (!(await pathExists(configFile))) {\n continue;\n }\n\n const source = await readFile(configFile, \"utf8\").catch(() => \"\");\n const targetMatch = source.match(\n /\\bdeploy\\s*:\\s*\\{[\\s\\S]*?\\btarget\\s*:\\s*[\"'](auto|node|vercel|netlify|cloudflare|static)[\"']/i,\n );\n const presetMatch = source.match(\n /\\bdeploy\\s*:\\s*\\{[\\s\\S]*?\\b(?:nitroPreset|preset)\\s*:\\s*[\"']([^\"']+)[\"']/i,\n );\n if (!targetMatch && !presetMatch) {\n continue;\n }\n\n const target = normalizeDeployTarget(targetMatch?.[1]);\n const nitroPreset = presetMatch?.[1]?.trim();\n return {\n ...(target ? { target } : {}),\n ...(nitroPreset ? { nitroPreset } : {}),\n };\n }\n\n return {};\n}\n\nexport function normalizeProviderPreset(provider: string): string {\n switch (provider) {\n case \"aws_amplify\":\n return \"aws-amplify\";\n case \"azure_static\":\n return \"azure\";\n case \"cloudflare_pages\":\n return \"cloudflare-pages\";\n case \"netlify\":\n return \"netlify\";\n case \"render\":\n return \"render-com\";\n case \"stormkit\":\n return \"stormkit\";\n case \"vercel\":\n return \"vercel\";\n case \"cleavr\":\n return \"cleavr\";\n case \"zeabur\":\n return \"zeabur\";\n default:\n return provider;\n }\n}\n\nexport function detectDeployProviderFromEnv(env: NodeJS.ProcessEnv): string | null {\n if (env.NOW_BUILDER || env.VERCEL || env.VERCEL_ENV) {\n return \"vercel\";\n }\n if (env.NETLIFY && !env.NETLIFY_LOCAL) {\n return \"netlify\";\n }\n if (env.CF_PAGES || env.CLOUDFLARE_PAGES) {\n return \"cloudflare_pages\";\n }\n if (env.INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN || env.AZURE_STATIC) {\n return \"azure_static\";\n }\n if (env.AWS_AMPLIFY || env.AWS_APP_ID) {\n return \"aws_amplify\";\n }\n if (env.STORMKIT) {\n return \"stormkit\";\n }\n if (env.RENDER) {\n return \"render\";\n }\n if (env.CLEAVR) {\n return \"cleavr\";\n }\n if (env.ZEABUR) {\n return \"zeabur\";\n }\n return null;\n}\n\nexport async function ensureResuxClientAssets(\n appRoot: string,\n targets: AssetCopyTarget[],\n): Promise<void> {\n if (!targets.length) {\n return;\n }\n\n const source = path.join(appRoot, \".resux\", \"client\");\n if (!(await pathExists(source))) {\n throw new Error(\n \"Resux deployment is missing .resux/client output. Run `resux build` and retry.\",\n );\n }\n\n for (const { root, target } of targets) {\n if (!(await pathExists(root))) {\n continue;\n }\n await mkdir(path.dirname(target), { recursive: true });\n await cp(source, target, {\n recursive: true,\n force: true,\n });\n }\n}\n\nexport async function ensureResuxServerPayload(\n appRoot: string,\n targets: string[],\n): Promise<void> {\n if (!targets.length) {\n return;\n }\n\n const source = path.join(appRoot, \".resux\", \"server\");\n if (!(await pathExists(source))) {\n throw new Error(\n \"Resux deployment is missing .resux/server output. Run `resux build` and retry.\",\n );\n }\n\n for (const target of targets) {\n await mkdir(path.dirname(target), { recursive: true });\n await cp(source, target, {\n recursive: true,\n force: true,\n });\n }\n}\n\nexport async function assertResuxServerManifest(\n appRoot: string,\n): Promise<void> {\n const serverRoot = path.join(appRoot, \".resux\", \"server\");\n if (!(await pathExists(serverRoot))) {\n throw new Error(\n \"Resux deployment is missing .resux/server output. Run `resux build` and retry.\",\n );\n }\n\n const manifestJsonPath = path.join(appRoot, \".resux\", \"manifest.json\");\n const configPath = path.join(serverRoot, \"config.mjs\");\n if (!(await pathExists(manifestJsonPath)) && !(await pathExists(configPath))) {\n throw new Error(\n \"Resux deployment is missing .resux/manifest.json or .resux/server/config.mjs. Run `resux build` and retry.\",\n );\n }\n}\n\nexport async function assertRuntimeClientAsset(\n root: string,\n relativePath = path.join(\"__resux\", \"runtime-client.mjs\"),\n): Promise<void> {\n const asset = path.join(root, relativePath);\n if (await pathExists(asset)) {\n return;\n }\n\n throw new Error(\n `Resux deployment output is missing ${relativePath.replaceAll(\"\\\\\", \"/\")} in ${root}.`,\n );\n}\n"],"mappings":";;;;AAUA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UA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a,KAAK,KAAK,YAAY,YAAY;CACrD,IAAI,CAAE,MAAM,WAAW,gBAAgB,KAAM,CAAE,MAAM,WAAW,UAAU,GACxE,MAAM,IAAI,MACR,4GACF;AAEJ;AAEA,eAAsB,yBACpB,MACA,eAAe,KAAK,KAAK,WAAW,oBAAoB,GACzC;CAEf,IAAI,MAAM,WADI,KAAK,KAAK,MAAM,YACL,CAAC,GACxB;CAGF,MAAM,IAAI,MACR,sCAAsC,aAAa,WAAW,MAAM,GAAG,EAAE,MAAM,KAAK,EACtF;AACF"}
@@ -1 +1,4 @@
1
+ //#region src/deploy/framework-runtime.d.ts
1
2
  export declare function ensureResuxFrameworkRuntime(appRoot: string, runtimeRoots: string[]): Promise<void>;
3
+ //#endregion
4
+ //# sourceMappingURL=framework-runtime.d.ts.map
@@ -1,56 +1,51 @@
1
- import { cp, mkdir, rm } from "node:fs/promises";
1
+ import { pathExists, readJsonRecord } from "./common.js";
2
2
  import { createRequire } from "node:module";
3
+ import { cp, mkdir, rm } from "node:fs/promises";
3
4
  import path from "node:path";
4
- import { pathExists, readJsonRecord } from "./common.js";
5
+ //#region src/deploy/framework-runtime.ts
5
6
  async function findPackageJsonFromEntry(packageName, entryPath) {
6
- let currentDirectory = path.dirname(entryPath);
7
- while (true) {
8
- const candidate = path.join(currentDirectory, "package.json");
9
- const packageJson = (await readJsonRecord(candidate));
10
- if (packageJson?.name === packageName) {
11
- return candidate;
12
- }
13
- const parentDirectory = path.dirname(currentDirectory);
14
- if (parentDirectory === currentDirectory) {
15
- return null;
16
- }
17
- currentDirectory = parentDirectory;
18
- }
7
+ let currentDirectory = path.dirname(entryPath);
8
+ while (true) {
9
+ const candidate = path.join(currentDirectory, "package.json");
10
+ if ((await readJsonRecord(candidate))?.name === packageName) return candidate;
11
+ const parentDirectory = path.dirname(currentDirectory);
12
+ if (parentDirectory === currentDirectory) return null;
13
+ currentDirectory = parentDirectory;
14
+ }
19
15
  }
20
16
  async function resolvePackageJsonPath(appRoot, packageName) {
21
- const resolver = createRequire(path.join(appRoot, "package.json"));
22
- try {
23
- return resolver.resolve(`${packageName}/package.json`);
24
- }
25
- catch {
26
- const entryPath = resolver.resolve(packageName);
27
- const packageJsonPath = await findPackageJsonFromEntry(packageName, entryPath);
28
- if (packageJsonPath) {
29
- return packageJsonPath;
30
- }
31
- throw new Error(`Resux deployment could resolve "${packageName}" to ${entryPath}, but could not locate its package root.`);
32
- }
17
+ const resolver = createRequire(path.join(appRoot, "package.json"));
18
+ try {
19
+ return resolver.resolve(`${packageName}/package.json`);
20
+ } catch {
21
+ const entryPath = resolver.resolve(packageName);
22
+ const packageJsonPath = await findPackageJsonFromEntry(packageName, entryPath);
23
+ if (packageJsonPath) return packageJsonPath;
24
+ throw new Error(`Resux deployment could resolve "${packageName}" to ${entryPath}, but could not locate its package root.`);
25
+ }
33
26
  }
34
- export async function ensureResuxFrameworkRuntime(appRoot, runtimeRoots) {
35
- if (!runtimeRoots.length) {
36
- return;
37
- }
38
- const packageJsonPath = await resolvePackageJsonPath(appRoot, "resuxjs");
39
- const packageRoot = path.dirname(packageJsonPath);
40
- const distRoot = path.join(packageRoot, "dist");
41
- if (!(await pathExists(distRoot))) {
42
- throw new Error(`Resux deployment resolved resuxjs at ${packageRoot}, but its dist runtime is missing.`);
43
- }
44
- for (const runtimeRoot of runtimeRoots) {
45
- const targetRoot = path.join(runtimeRoot, "node_modules", "resuxjs");
46
- await rm(targetRoot, { recursive: true, force: true });
47
- await mkdir(targetRoot, { recursive: true });
48
- await cp(packageJsonPath, path.join(targetRoot, "package.json"), { force: true });
49
- await cp(distRoot, path.join(targetRoot, "dist"), {
50
- recursive: true,
51
- force: true,
52
- dereference: true,
53
- });
54
- }
27
+ async function ensureResuxFrameworkRuntime(appRoot, runtimeRoots) {
28
+ if (!runtimeRoots.length) return;
29
+ const packageJsonPath = await resolvePackageJsonPath(appRoot, "resuxjs");
30
+ const packageRoot = path.dirname(packageJsonPath);
31
+ const distRoot = path.join(packageRoot, "dist");
32
+ if (!await pathExists(distRoot)) throw new Error(`Resux deployment resolved resuxjs at ${packageRoot}, but its dist runtime is missing.`);
33
+ for (const runtimeRoot of runtimeRoots) {
34
+ const targetRoot = path.join(runtimeRoot, "node_modules", "resuxjs");
35
+ await rm(targetRoot, {
36
+ recursive: true,
37
+ force: true
38
+ });
39
+ await mkdir(targetRoot, { recursive: true });
40
+ await cp(packageJsonPath, path.join(targetRoot, "package.json"), { force: true });
41
+ await cp(distRoot, path.join(targetRoot, "dist"), {
42
+ recursive: true,
43
+ force: true,
44
+ dereference: true
45
+ });
46
+ }
55
47
  }
48
+ //#endregion
49
+ export { ensureResuxFrameworkRuntime };
50
+
56
51
  //# sourceMappingURL=framework-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework-runtime.js","sourceRoot":"","sources":["../../src/deploy/framework-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMzD,KAAK,UAAU,wBAAwB,CACrC,WAAmB,EACnB,SAAiB;IAEjB,IAAI,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE/C,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAC9D,MAAM,WAAW,GAAG,CAAC,MAAM,cAAc,CAAC,SAAS,CAAC,CAAyB,CAAC;QAC9E,IAAI,WAAW,EAAE,IAAI,KAAK,WAAW,EAAE,CAAC;YACtC,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACvD,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AAY,EAAE,CAAC;QACvC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;QACrE,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,MAAM,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7C,MAAM,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAClF,MAAM,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE;YAChD,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,IAAI;YACX,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"framework-runtime.js","names":[],"sources":["../../src/deploy/framework-runtime.ts"],"sourcesContent":["import { cp, mkdir, rm } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathExists, readJsonRecord } from \"./common.js\";\n\ninterface PackageRecord extends Record<string, unknown> {\n name?: unknown;\n}\n\nasync function findPackageJsonFromEntry(\n packageName: 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 === packageName) {\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 resolvePackageJsonPath(\n appRoot: string,\n packageName: string,\n): Promise<string> {\n const resolver = createRequire(path.join(appRoot, \"package.json\"));\n\n try {\n return resolver.resolve(`${packageName}/package.json`);\n } catch {\n const entryPath = resolver.resolve(packageName);\n const packageJsonPath = await findPackageJsonFromEntry(packageName, entryPath);\n if (packageJsonPath) {\n return packageJsonPath;\n }\n throw new Error(\n `Resux deployment could resolve \"${packageName}\" to ${entryPath}, but could not locate its package root.`,\n );\n }\n}\n\nexport async function ensureResuxFrameworkRuntime(\n appRoot: string,\n runtimeRoots: string[],\n): Promise<void> {\n if (!runtimeRoots.length) {\n return;\n }\n\n const packageJsonPath = await resolvePackageJsonPath(appRoot, \"resuxjs\");\n const packageRoot = path.dirname(packageJsonPath);\n const distRoot = path.join(packageRoot, \"dist\");\n if (!(await pathExists(distRoot))) {\n throw new Error(\n `Resux deployment resolved resuxjs at ${packageRoot}, but its dist runtime is missing.`,\n );\n }\n\n for (const runtimeRoot of runtimeRoots) {\n const targetRoot = path.join(runtimeRoot, \"node_modules\", \"resuxjs\");\n await rm(targetRoot, { recursive: true, force: true });\n await mkdir(targetRoot, { recursive: true });\n await cp(packageJsonPath, path.join(targetRoot, \"package.json\"), { force: true });\n await cp(distRoot, path.join(targetRoot, \"dist\"), {\n recursive: true,\n force: true,\n dereference: true,\n });\n }\n}\n"],"mappings":";;;;;AASA,eAAe,yBACb,aACA,WACwB;CACxB,IAAI,mBAAmB,KAAK,QAAQ,SAAS;CAE7C,OAAO,MAAM;EACX,MAAM,YAAY,KAAK,KAAK,kBAAkB,cAAc;EAE5D,KAAI,MADuB,eAAe,SAAS,EAAA,EAClC,SAAS,aACxB,OAAO;EAGT,MAAM,kBAAkB,KAAK,QAAQ,gBAAgB;EACrD,IAAI,oBAAoB,kBACtB,OAAO;EAET,mBAAmB;CACrB;AACF;AAEA,eAAe,uBACb,SACA,aACiB;CACjB,MAAM,WAAW,cAAc,KAAK,KAAK,SAAS,cAAc,CAAC;CAEjE,IAAI;EACF,OAAO,SAAS,QAAQ,GAAG,YAAY,cAAc;CACvD,QAAQ;EACN,MAAM,YAAY,SAAS,QAAQ,WAAW;EAC9C,MAAM,kBAAkB,MAAM,yBAAyB,aAAa,SAAS;EAC7E,IAAI,iBACF,OAAO;EAET,MAAM,IAAI,MACR,mCAAmC,YAAY,OAAO,UAAU,yCAClE;CACF;AACF;AAEA,eAAsB,4BACpB,SACA,cACe;CACf,IAAI,CAAC,aAAa,QAChB;CAGF,MAAM,kBAAkB,MAAM,uBAAuB,SAAS,SAAS;CACvE,MAAM,cAAc,KAAK,QAAQ,eAAe;CAChD,MAAM,WAAW,KAAK,KAAK,aAAa,MAAM;CAC9C,IAAI,CAAE,MAAM,WAAW,QAAQ,GAC7B,MAAM,IAAI,MACR,wCAAwC,YAAY,mCACtD;CAGF,KAAK,MAAM,eAAe,cAAc;EACtC,MAAM,aAAa,KAAK,KAAK,aAAa,gBAAgB,SAAS;EACnE,MAAM,GAAG,YAAY;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACrD,MAAM,MAAM,YAAY,EAAE,WAAW,KAAK,CAAC;EAC3C,MAAM,GAAG,iBAAiB,KAAK,KAAK,YAAY,cAAc,GAAG,EAAE,OAAO,KAAK,CAAC;EAChF,MAAM,GAAG,UAAU,KAAK,KAAK,YAAY,MAAM,GAAG;GAChD,WAAW;GACX,OAAO;GACP,aAAa;EACf,CAAC;CACH;AACF"}
@@ -1,3 +1,6 @@
1
- import type { DeployBuildContext, DeploymentResolution } from "./types.js";
1
+ import { DeployBuildContext, DeploymentResolution } from "./types.js";
2
+ //#region src/deploy/index.d.ts
2
3
  export declare function resolveDeployment(appRoot: string, outDir: string, env: NodeJS.ProcessEnv): Promise<DeploymentResolution>;
3
4
  export declare function applyDeploymentPostBuild(context: DeployBuildContext): Promise<void>;
5
+ //#endregion
6
+ //# sourceMappingURL=index.d.ts.map