resuxjs 0.3.11 → 0.4.0-beta.3

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 +5 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/build/index.d.ts +29 -0
  6. package/dist/build/index.js +51 -0
  7. package/dist/build/index.js.map +1 -0
  8. package/dist/cli.d.ts +19 -8
  9. package/dist/cli.js +2653 -3688
  10. package/dist/cli.js.map +1 -1
  11. package/dist/compiler/adapter.d.ts +19 -15
  12. package/dist/compiler/adapter.js +69 -93
  13. package/dist/compiler/adapter.js.map +1 -1
  14. package/dist/compiler/dev-warnings.d.ts +14 -10
  15. package/dist/compiler/dev-warnings.js +247 -319
  16. package/dist/compiler/dev-warnings.js.map +1 -1
  17. package/dist/compiler/directives.d.ts +7 -3
  18. package/dist/compiler/directives.js +125 -150
  19. package/dist/compiler/directives.js.map +1 -1
  20. package/dist/compiler/implementation.d.ts +117 -112
  21. package/dist/compiler/implementation.js +2954 -3426
  22. package/dist/compiler/index.d.ts +19 -15
  23. package/dist/compiler/index.js +69 -93
  24. package/dist/compiler/index.js.map +1 -1
  25. package/dist/core/config.d.ts +19 -10
  26. package/dist/core/config.js +42 -25
  27. package/dist/core/config.js.map +1 -1
  28. package/dist/core/hooks.d.ts +133 -131
  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 +6 -5
  33. package/dist/core/module-container.d.ts +97 -93
  34. package/dist/core/module-container.js +180 -185
  35. package/dist/core/module-container.js.map +1 -1
  36. package/dist/core/resux.d.ts +20 -15
  37. package/dist/core/resux.js +18 -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 +5 -0
  41. package/dist/create-bin.js.map +1 -1
  42. package/dist/create.d.ts +6 -2
  43. package/dist/create.js +496 -638
  44. package/dist/create.js.map +1 -1
  45. package/dist/deploy/cloudflare.d.ts +7 -2
  46. package/dist/deploy/cloudflare.js +31 -34
  47. package/dist/deploy/cloudflare.js.map +1 -1
  48. package/dist/deploy/common.d.ts +19 -15
  49. package/dist/deploy/common.js +119 -188
  50. package/dist/deploy/common.js.map +1 -1
  51. package/dist/deploy/framework-runtime.d.ts +5 -1
  52. package/dist/deploy/framework-runtime.js +44 -48
  53. package/dist/deploy/framework-runtime.js.map +1 -1
  54. package/dist/deploy/index.d.ts +8 -3
  55. package/dist/deploy/index.js +56 -80
  56. package/dist/deploy/index.js.map +1 -1
  57. package/dist/deploy/netlify.d.ts +7 -2
  58. package/dist/deploy/netlify.js +41 -41
  59. package/dist/deploy/netlify.js.map +1 -1
  60. package/dist/deploy/node.d.ts +7 -2
  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 +5 -1
  64. package/dist/deploy/production-report.js +15 -14
  65. package/dist/deploy/production-report.js.map +1 -1
  66. package/dist/deploy/runtime-dependencies.d.ts +8 -4
  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 +7 -2
  70. package/dist/deploy/static.js +17 -14
  71. package/dist/deploy/static.js.map +1 -1
  72. package/dist/deploy/types.d.ts +33 -29
  73. package/dist/deploy/types.js +1 -2
  74. package/dist/deploy/vercel.d.ts +8 -3
  75. package/dist/deploy/vercel.js +138 -188
  76. package/dist/deploy/vercel.js.map +1 -1
  77. package/dist/fonts/index.d.ts +19 -14
  78. package/dist/fonts/index.js +115 -134
  79. package/dist/fonts/index.js.map +1 -1
  80. package/dist/globals.d.ts +79 -78
  81. package/dist/globals.js +1 -2
  82. package/dist/halal-core/ai/classifyProject.d.ts +9 -4
  83. package/dist/halal-core/ai/classifyProject.js +82 -95
  84. package/dist/halal-core/ai/classifyProject.js.map +1 -1
  85. package/dist/halal-core/ai/classifyRuntimeContent.d.ts +8 -3
  86. package/dist/halal-core/ai/classifyRuntimeContent.js +78 -95
  87. package/dist/halal-core/ai/classifyRuntimeContent.js.map +1 -1
  88. package/dist/halal-core/ai/createProjectSummary.d.ts +40 -36
  89. package/dist/halal-core/ai/createProjectSummary.js +39 -39
  90. package/dist/halal-core/ai/createProjectSummary.js.map +1 -1
  91. package/dist/halal-core/ai/halalClassifierPrompt.d.ts +5 -1
  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 +5 -1
  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 +7 -2
  98. package/dist/halal-core/ai/validateAiResponse.js +56 -83
  99. package/dist/halal-core/ai/validateAiResponse.js.map +1 -1
  100. package/dist/halal-core/cli/check.d.ts +5 -1
  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 +5 -1
  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 +5 -1
  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 +5 -1
  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 +5 -1
  113. package/dist/halal-core/cli/verifyReview.js +17 -15
  114. package/dist/halal-core/cli/verifyReview.js.map +1 -1
  115. package/dist/halal-core/config.d.ts +39 -35
  116. package/dist/halal-core/config.js +77 -118
  117. package/dist/halal-core/config.js.map +1 -1
  118. package/dist/halal-core/crypto/integrity.d.ts +12 -8
  119. package/dist/halal-core/crypto/integrity.js +65 -87
  120. package/dist/halal-core/crypto/integrity.js.map +1 -1
  121. package/dist/halal-core/enforce.d.ts +9 -5
  122. package/dist/halal-core/enforce.js +90 -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 +19 -19
  126. package/dist/halal-core/lifecycle.d.ts +5 -1
  127. package/dist/halal-core/lifecycle.js +16 -13
  128. package/dist/halal-core/lifecycle.js.map +1 -1
  129. package/dist/halal-core/policy.d.ts +7 -2
  130. package/dist/halal-core/policy.js +7 -2
  131. package/dist/halal-core/policy.js.map +1 -1
  132. package/dist/halal-core/report/formatBrowserOverlay.d.ts +7 -2
  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 +7 -2
  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 +11 -6
  139. package/dist/halal-core/report/generateHalalReport.js +25 -27
  140. package/dist/halal-core/report/generateHalalReport.js.map +1 -1
  141. package/dist/halal-core/report/signReport.d.ts +8 -3
  142. package/dist/halal-core/report/signReport.js +17 -12
  143. package/dist/halal-core/report/signReport.js.map +1 -1
  144. package/dist/halal-core/report/verifyReport.d.ts +14 -9
  145. package/dist/halal-core/report/verifyReport.js +52 -41
  146. package/dist/halal-core/report/verifyReport.js.map +1 -1
  147. package/dist/halal-core/review/createReviewRequest.d.ts +7 -2
  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 +7 -3
  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 +17 -12
  154. package/dist/halal-core/review/signedReviewFile.js +25 -22
  155. package/dist/halal-core/review/signedReviewFile.js.map +1 -1
  156. package/dist/halal-core/review/verifyReviewApproval.d.ts +12 -8
  157. package/dist/halal-core/review/verifyReviewApproval.js +69 -62
  158. package/dist/halal-core/review/verifyReviewApproval.js.map +1 -1
  159. package/dist/halal-core/rules/adultContentRules.d.ts +6 -2
  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 +6 -2
  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 +6 -2
  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 +10 -6
  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 +6 -2
  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 +24 -19
  175. package/dist/halal-core/rules/defaultBlockedRules.js +156 -199
  176. package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -1
  177. package/dist/halal-core/rules/dependencyRules.d.ts +11 -7
  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 +9 -5
  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 +6 -2
  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 +6 -2
  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 +6 -2
  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 +6 -2
  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 +6 -2
  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 +13 -9
  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 +6 -2
  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 +6 -2
  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 +6 -2
  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 +6 -2
  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 +22 -17
  214. package/dist/halal-core/runtime/guard.js +163 -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 +5 -5
  218. package/dist/halal-core/runtime/reviewedMemory.d.ts +10 -5
  219. package/dist/halal-core/runtime/reviewedMemory.js +75 -110
  220. package/dist/halal-core/runtime/reviewedMemory.js.map +1 -1
  221. package/dist/halal-core/runtime/serializeRuntimeContent.d.ts +17 -12
  222. package/dist/halal-core/runtime/serializeRuntimeContent.js +133 -156
  223. package/dist/halal-core/runtime/serializeRuntimeContent.js.map +1 -1
  224. package/dist/halal-core/runtime/types.d.ts +55 -50
  225. package/dist/halal-core/runtime/types.js +1 -2
  226. package/dist/halal-core/scanner/scanApiRoutes.d.ts +5 -1
  227. package/dist/halal-core/scanner/scanApiRoutes.js +33 -36
  228. package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -1
  229. package/dist/halal-core/scanner/scanComponents.d.ts +5 -1
  230. package/dist/halal-core/scanner/scanComponents.js +13 -13
  231. package/dist/halal-core/scanner/scanComponents.js.map +1 -1
  232. package/dist/halal-core/scanner/scanContent.d.ts +8 -4
  233. package/dist/halal-core/scanner/scanContent.js +192 -261
  234. package/dist/halal-core/scanner/scanContent.js.map +1 -1
  235. package/dist/halal-core/scanner/scanDependencies.d.ts +5 -1
  236. package/dist/halal-core/scanner/scanDependencies.js +17 -15
  237. package/dist/halal-core/scanner/scanDependencies.js.map +1 -1
  238. package/dist/halal-core/scanner/scanDomains.d.ts +7 -3
  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 +5 -1
  242. package/dist/halal-core/scanner/scanEnvNames.js +24 -26
  243. package/dist/halal-core/scanner/scanEnvNames.js.map +1 -1
  244. package/dist/halal-core/scanner/scanMetadata.d.ts +9 -5
  245. package/dist/halal-core/scanner/scanMetadata.js +21 -29
  246. package/dist/halal-core/scanner/scanMetadata.js.map +1 -1
  247. package/dist/halal-core/scanner/scanPages.d.ts +5 -1
  248. package/dist/halal-core/scanner/scanPages.js +13 -15
  249. package/dist/halal-core/scanner/scanPages.js.map +1 -1
  250. package/dist/halal-core/scanner/scanProject.d.ts +19 -12
  251. package/dist/halal-core/scanner/scanProject.js +44 -49
  252. package/dist/halal-core/scanner/scanProject.js.map +1 -1
  253. package/dist/halal-core/scanner/scanRoutes.d.ts +5 -1
  254. package/dist/halal-core/scanner/scanRoutes.js +33 -39
  255. package/dist/halal-core/scanner/scanRoutes.js.map +1 -1
  256. package/dist/halal-core/scanner/scanTranslations.d.ts +5 -1
  257. package/dist/halal-core/scanner/scanTranslations.js +22 -29
  258. package/dist/halal-core/scanner/scanTranslations.js.map +1 -1
  259. package/dist/halal-core/status.d.ts +17 -13
  260. package/dist/halal-core/status.js +1 -2
  261. package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +5 -1
  262. package/dist/halal-core/tamper/verifyCoreIntegrity.js +27 -24
  263. package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -1
  264. package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +5 -1
  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 +9 -4
  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 +19 -2
  272. package/dist/i18n/index.d.ts +44 -40
  273. package/dist/i18n/index.js +218 -288
  274. package/dist/i18n/index.js.map +1 -1
  275. package/dist/i18n/shared.d.ts +33 -29
  276. package/dist/i18n/shared.js +204 -266
  277. package/dist/i18n/shared.js.map +1 -1
  278. package/dist/icons/index.d.ts +160 -154
  279. package/dist/icons/index.js +323 -273
  280. package/dist/icons/index.js.map +1 -1
  281. package/dist/index.d.ts +8 -1
  282. package/dist/index.js +8 -2
  283. package/dist/kit/index.d.ts +32 -27
  284. package/dist/kit/index.js +46 -43
  285. package/dist/kit/index.js.map +1 -1
  286. package/dist/nitro-server/index.d.ts +10 -6
  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 +9 -4
  290. package/dist/node.js +89 -116
  291. package/dist/node.js.map +1 -1
  292. package/dist/reactivity/computed.d.ts +11 -6
  293. package/dist/reactivity/computed.js +46 -53
  294. package/dist/reactivity/computed.js.map +1 -1
  295. package/dist/reactivity/effect.d.ts +23 -18
  296. package/dist/reactivity/effect.js +105 -147
  297. package/dist/reactivity/effect.js.map +1 -1
  298. package/dist/reactivity/index.d.ts +8 -8
  299. package/dist/reactivity/index.js +8 -8
  300. package/dist/reactivity/reactive.d.ts +9 -5
  301. package/dist/reactivity/reactive.js +95 -134
  302. package/dist/reactivity/reactive.js.map +1 -1
  303. package/dist/reactivity/readonly.d.ts +2 -1
  304. package/dist/reactivity/readonly.js +3 -2
  305. package/dist/reactivity/ref.d.ts +23 -21
  306. package/dist/reactivity/ref.js +71 -81
  307. package/dist/reactivity/ref.js.map +1 -1
  308. package/dist/reactivity/scheduler.d.ts +8 -5
  309. package/dist/reactivity/scheduler.js +67 -69
  310. package/dist/reactivity/scheduler.js.map +1 -1
  311. package/dist/reactivity/types.d.ts +29 -25
  312. package/dist/reactivity/types.js +1 -2
  313. package/dist/reactivity/utils.d.ts +17 -13
  314. package/dist/reactivity/utils.js +25 -24
  315. package/dist/reactivity/utils.js.map +1 -1
  316. package/dist/reactivity/watch.d.ts +8 -4
  317. package/dist/reactivity/watch.js +74 -103
  318. package/dist/reactivity/watch.js.map +1 -1
  319. package/dist/runtime/core.d.ts +32 -0
  320. package/dist/runtime/core.js +155 -0
  321. package/dist/runtime/core.js.map +1 -0
  322. package/dist/runtime/index.d.ts +649 -622
  323. package/dist/runtime/index.js +4105 -5243
  324. package/dist/runtime/index.js.map +1 -1
  325. package/dist/runtime/reactivity.d.ts +7 -0
  326. package/dist/runtime/reactivity.js +7 -0
  327. package/dist/runtime/resume.d.ts +80 -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 +21 -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 +25 -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 +33 -0
  337. package/dist/security/media-fetch.js +302 -0
  338. package/dist/security/media-fetch.js.map +1 -0
  339. package/dist/security/path-boundary.d.ts +8 -0
  340. package/dist/security/path-boundary.js +71 -0
  341. package/dist/security/path-boundary.js.map +1 -0
  342. package/dist/ui/index.d.ts +1774 -1768
  343. package/dist/ui/index.js +974 -674
  344. package/dist/ui/index.js.map +1 -1
  345. package/dist/vite-builder/index.d.ts +9 -5
  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,104 +1,108 @@
1
- import type { ResuxHooks, ResuxHookName, ResuxHookPayloads } from "./hooks.js";
2
- export type ResuxSupportMode = "all" | "server" | "client";
3
- export declare const RESUX_RUNTIME_CLIENT_PATH = "/__resux/runtime-client.mjs";
4
- export declare const RESUX_HANDLER_MODULES_PATH = "/__resux/handlers/**";
5
- export declare const RESUX_VUE_ISLAND_MODULES_PATH = "/__resux/vue-islands/**";
6
- export declare const RESUX_RUNTIME_CLIENT_CACHE_CONTROL = "no-cache, no-store, must-revalidate";
7
- export interface ResuxTemplateInput {
8
- filename: string;
9
- getContents: () => string | Promise<string>;
10
- write?: boolean;
1
+ import { ResuxHookName, ResuxHookPayloads, ResuxHooks } from "./hooks.js";
2
+
3
+ //#region src/core/module-container.d.ts
4
+ type ResuxSupportMode = "all" | "server" | "client";
5
+ declare const RESUX_RUNTIME_CLIENT_PATH = "/__resux/runtime-client.mjs";
6
+ declare const RESUX_HANDLER_MODULES_PATH = "/__resux/handlers/**";
7
+ declare const RESUX_VUE_ISLAND_MODULES_PATH = "/__resux/vue-islands/**";
8
+ declare const RESUX_RUNTIME_CLIENT_CACHE_CONTROL = "no-cache, no-store, must-revalidate";
9
+ interface ResuxTemplateInput {
10
+ filename: string;
11
+ getContents: () => string | Promise<string>;
12
+ write?: boolean;
11
13
  }
12
- export interface ResuxTypeTemplateInput extends ResuxTemplateInput {
14
+ interface ResuxTypeTemplateInput extends ResuxTemplateInput {}
15
+ interface ResuxComponentInput {
16
+ file: string;
17
+ name?: string;
18
+ global?: boolean;
19
+ mode?: ResuxSupportMode;
20
+ lazy?: boolean;
13
21
  }
14
- export interface ResuxComponentInput {
15
- file: string;
16
- name?: string;
17
- global?: boolean;
18
- mode?: ResuxSupportMode;
19
- lazy?: boolean;
22
+ interface ResuxComponentsDirInput {
23
+ path: string;
24
+ global?: boolean;
25
+ mode?: ResuxSupportMode;
26
+ pathPrefix?: boolean;
20
27
  }
21
- export interface ResuxComponentsDirInput {
22
- path: string;
23
- global?: boolean;
24
- mode?: ResuxSupportMode;
25
- pathPrefix?: boolean;
26
- }
27
- export interface ResuxImportInput {
28
- from: string;
29
- name: string;
30
- as?: string;
28
+ interface ResuxImportInput {
29
+ from: string;
30
+ name: string;
31
+ as?: string;
31
32
  }
32
- export interface ResuxPluginInput {
33
- src: string;
34
- mode?: ResuxSupportMode;
33
+ interface ResuxPluginInput {
34
+ src: string;
35
+ mode?: ResuxSupportMode;
35
36
  }
36
- export interface ResuxRouteMiddlewareInput {
37
- name: string;
38
- src: string;
39
- global?: boolean;
40
- mode?: ResuxSupportMode;
37
+ interface ResuxRouteMiddlewareInput {
38
+ name: string;
39
+ src: string;
40
+ global?: boolean;
41
+ mode?: ResuxSupportMode;
41
42
  }
42
- export interface ResuxServerHandlerInput {
43
- route: string;
44
- handler: string;
45
- middleware?: boolean;
46
- method?: string;
43
+ interface ResuxServerHandlerInput {
44
+ route: string;
45
+ handler: string;
46
+ middleware?: boolean;
47
+ method?: string;
47
48
  }
48
- export interface ResuxPrerenderRouteInput {
49
- route: string;
49
+ interface ResuxPrerenderRouteInput {
50
+ route: string;
50
51
  }
51
- export type PagesExtender = (pages: Array<Record<string, unknown>>) => void | Promise<void>;
52
- export type ViteConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;
53
- export type NitroConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;
54
- export interface ResuxModuleContributions {
55
- components: ResuxComponentInput[];
56
- componentDirs: ResuxComponentsDirInput[];
57
- imports: ResuxImportInput[];
58
- importDirs: string[];
59
- plugins: ResuxPluginInput[];
60
- middleware: ResuxRouteMiddlewareInput[];
61
- serverHandlers: ResuxServerHandlerInput[];
62
- serverPlugins: string[];
63
- templates: ResuxTemplateInput[];
64
- typeTemplates: ResuxTypeTemplateInput[];
65
- pagesExtenders: PagesExtender[];
66
- runtimeConfigExtends: Record<string, unknown>[];
67
- viteConfigExtenders: ViteConfigExtender[];
68
- nitroConfigExtenders: NitroConfigExtender[];
69
- vitePlugins: unknown[];
70
- routeRules: Array<{
71
- path: string;
72
- rule: Record<string, unknown>;
73
- }>;
74
- prerenderRoutes: ResuxPrerenderRouteInput[];
52
+ type PagesExtender = (pages: Array<Record<string, unknown>>) => void | Promise<void>;
53
+ type ViteConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;
54
+ type NitroConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;
55
+ interface ResuxModuleContributions {
56
+ components: ResuxComponentInput[];
57
+ componentDirs: ResuxComponentsDirInput[];
58
+ imports: ResuxImportInput[];
59
+ importDirs: string[];
60
+ plugins: ResuxPluginInput[];
61
+ middleware: ResuxRouteMiddlewareInput[];
62
+ serverHandlers: ResuxServerHandlerInput[];
63
+ serverPlugins: string[];
64
+ templates: ResuxTemplateInput[];
65
+ typeTemplates: ResuxTypeTemplateInput[];
66
+ pagesExtenders: PagesExtender[];
67
+ runtimeConfigExtends: Record<string, unknown>[];
68
+ viteConfigExtenders: ViteConfigExtender[];
69
+ nitroConfigExtenders: NitroConfigExtender[];
70
+ vitePlugins: unknown[];
71
+ routeRules: Array<{
72
+ path: string;
73
+ rule: Record<string, unknown>;
74
+ }>;
75
+ prerenderRoutes: ResuxPrerenderRouteInput[];
75
76
  }
76
- export interface ResuxModuleContext {
77
- rootDir: string;
78
- buildDir: string;
79
- options: Record<string, unknown>;
80
- addCss(href: string): void;
81
- addHead(head: Record<string, unknown>): void;
82
- addRouteRule(path: string, rule: Record<string, unknown>): void;
83
- extendRuntimeConfig(config: Record<string, unknown>): void;
84
- hook<K extends ResuxHookName>(name: K, handler: (payload: ResuxHookPayloads[K]) => void | Promise<void>): () => void;
85
- addComponent(component: ResuxComponentInput | string): void;
86
- addComponentsDir(dir: ResuxComponentsDirInput | string): void;
87
- addImports(imports: ResuxImportInput | ResuxImportInput[]): void;
88
- addImportsDir(dir: string): void;
89
- addPlugin(plugin: ResuxPluginInput | string): void;
90
- addRouteMiddleware(middleware: ResuxRouteMiddlewareInput): void;
91
- addServerHandler(handler: ResuxServerHandlerInput): void;
92
- addServerPlugin(plugin: string): void;
93
- addTemplate(template: ResuxTemplateInput): void;
94
- addTypeTemplate(template: ResuxTypeTemplateInput): void;
95
- extendPages(extender: PagesExtender): void;
96
- extendViteConfig(extender: ViteConfigExtender): void;
97
- extendNitroConfig(extender: NitroConfigExtender): void;
98
- addVitePlugin(plugin: unknown): void;
99
- addPrerenderRoutes(route: string | string[]): void;
77
+ interface ResuxModuleContext {
78
+ rootDir: string;
79
+ buildDir: string;
80
+ options: Record<string, unknown>;
81
+ addCss(href: string): void;
82
+ addHead(head: Record<string, unknown>): void;
83
+ addRouteRule(path: string, rule: Record<string, unknown>): void;
84
+ extendRuntimeConfig(config: Record<string, unknown>): void;
85
+ hook<K extends ResuxHookName>(name: K, handler: (payload: ResuxHookPayloads[K]) => void | Promise<void>): () => void;
86
+ addComponent(component: ResuxComponentInput | string): void;
87
+ addComponentsDir(dir: ResuxComponentsDirInput | string): void;
88
+ addImports(imports: ResuxImportInput | ResuxImportInput[]): void;
89
+ addImportsDir(dir: string): void;
90
+ addPlugin(plugin: ResuxPluginInput | string): void;
91
+ addRouteMiddleware(middleware: ResuxRouteMiddlewareInput): void;
92
+ addServerHandler(handler: ResuxServerHandlerInput): void;
93
+ addServerPlugin(plugin: string): void;
94
+ addTemplate(template: ResuxTemplateInput): void;
95
+ addTypeTemplate(template: ResuxTypeTemplateInput): void;
96
+ extendPages(extender: PagesExtender): void;
97
+ extendViteConfig(extender: ViteConfigExtender): void;
98
+ extendNitroConfig(extender: NitroConfigExtender): void;
99
+ addVitePlugin(plugin: unknown): void;
100
+ addPrerenderRoutes(route: string | string[]): void;
100
101
  }
101
- export declare class ResuxModuleContainer {
102
- readonly contributions: ResuxModuleContributions;
103
- createContext(config: Record<string, unknown>, rootDir: string, buildDir: string, hooks: ResuxHooks): ResuxModuleContext;
102
+ declare class ResuxModuleContainer {
103
+ readonly contributions: ResuxModuleContributions;
104
+ createContext(config: Record<string, unknown>, rootDir: string, buildDir: string, hooks: ResuxHooks): ResuxModuleContext;
104
105
  }
106
+ //#endregion
107
+ export { NitroConfigExtender, PagesExtender, RESUX_HANDLER_MODULES_PATH, RESUX_RUNTIME_CLIENT_CACHE_CONTROL, RESUX_RUNTIME_CLIENT_PATH, RESUX_VUE_ISLAND_MODULES_PATH, ResuxComponentInput, ResuxComponentsDirInput, ResuxImportInput, ResuxModuleContainer, ResuxModuleContext, ResuxModuleContributions, ResuxPluginInput, ResuxPrerenderRouteInput, ResuxRouteMiddlewareInput, ResuxServerHandlerInput, ResuxSupportMode, ResuxTemplateInput, ResuxTypeTemplateInput, ViteConfigExtender };
108
+ //# sourceMappingURL=module-container.d.ts.map
@@ -1,198 +1,193 @@
1
- export const RESUX_RUNTIME_CLIENT_PATH = "/__resux/runtime-client.mjs";
2
- export const RESUX_HANDLER_MODULES_PATH = "/__resux/handlers/**";
3
- export const RESUX_VUE_ISLAND_MODULES_PATH = "/__resux/vue-islands/**";
4
- export const RESUX_RUNTIME_CLIENT_CACHE_CONTROL = "no-cache, no-store, must-revalidate";
1
+ //#region src/core/module-container.ts
2
+ const RESUX_RUNTIME_CLIENT_PATH = "/__resux/runtime-client.mjs";
3
+ const RESUX_HANDLER_MODULES_PATH = "/__resux/handlers/**";
4
+ const RESUX_VUE_ISLAND_MODULES_PATH = "/__resux/vue-islands/**";
5
+ const RESUX_RUNTIME_CLIENT_CACHE_CONTROL = "no-cache, no-store, must-revalidate";
5
6
  const RESUX_STABLE_RESUMABILITY_ASSET_PATHS = new Set([
6
- RESUX_RUNTIME_CLIENT_PATH,
7
- RESUX_HANDLER_MODULES_PATH,
8
- RESUX_VUE_ISLAND_MODULES_PATH,
7
+ RESUX_RUNTIME_CLIENT_PATH,
8
+ RESUX_HANDLER_MODULES_PATH,
9
+ RESUX_VUE_ISLAND_MODULES_PATH
9
10
  ]);
10
- export class ResuxModuleContainer {
11
- contributions = {
12
- components: [],
13
- componentDirs: [],
14
- imports: [],
15
- importDirs: [],
16
- plugins: [],
17
- middleware: [],
18
- serverHandlers: [],
19
- serverPlugins: [],
20
- templates: [],
21
- typeTemplates: [],
22
- pagesExtenders: [],
23
- runtimeConfigExtends: [],
24
- viteConfigExtenders: [],
25
- nitroConfigExtenders: [],
26
- vitePlugins: [],
27
- routeRules: [],
28
- prerenderRoutes: []
29
- };
30
- createContext(config, rootDir, buildDir, hooks) {
31
- return {
32
- rootDir,
33
- buildDir,
34
- options: config,
35
- addCss: (href) => {
36
- const css = Array.isArray(config.css) ? config.css : [];
37
- if (!css.includes(href)) {
38
- css.push(href);
39
- }
40
- config.css = css;
41
- },
42
- addHead: (head) => {
43
- const app = isObject(config.app) ? config.app : {};
44
- const current = isObject(app.head) ? app.head : {};
45
- app.head = mergeHead(current, head);
46
- config.app = app;
47
- },
48
- addRouteRule: (path, rule) => {
49
- if (!path.startsWith("/")) {
50
- throw new Error(`Route rules need an absolute path. Received "${path}".`);
51
- }
52
- const routeRules = isObject(config.routeRules) ? config.routeRules : {};
53
- const current = isObject(routeRules[path]) ? routeRules[path] : {};
54
- const merged = mergeRouteRule(path, current, rule);
55
- routeRules[path] = merged;
56
- config.routeRules = routeRules;
57
- this.contributions.routeRules.push({ path, rule: merged });
58
- },
59
- extendRuntimeConfig: (runtimeConfig) => {
60
- this.contributions.runtimeConfigExtends.push(runtimeConfig);
61
- const current = isObject(config.runtimeConfig) ? config.runtimeConfig : {};
62
- config.runtimeConfig = deepMergeObjects(current, runtimeConfig);
63
- },
64
- hook: (name, handler) => hooks.hook(name, handler),
65
- addComponent: (component) => {
66
- if (typeof component === "string") {
67
- this.contributions.components.push({ file: component });
68
- return;
69
- }
70
- this.contributions.components.push(component);
71
- },
72
- addComponentsDir: (dir) => {
73
- if (typeof dir === "string") {
74
- this.contributions.componentDirs.push({ path: dir });
75
- return;
76
- }
77
- this.contributions.componentDirs.push(dir);
78
- },
79
- addImports: (imports) => {
80
- const list = Array.isArray(imports) ? imports : [imports];
81
- this.contributions.imports.push(...list);
82
- },
83
- addImportsDir: (dir) => {
84
- this.contributions.importDirs.push(dir);
85
- },
86
- addPlugin: (plugin) => {
87
- if (typeof plugin === "string") {
88
- this.contributions.plugins.push({ src: plugin, mode: "all" });
89
- return;
90
- }
91
- this.contributions.plugins.push({ mode: "all", ...plugin });
92
- },
93
- addRouteMiddleware: (middleware) => {
94
- this.contributions.middleware.push(middleware);
95
- },
96
- addServerHandler: (handler) => {
97
- this.contributions.serverHandlers.push(handler);
98
- },
99
- addServerPlugin: (plugin) => {
100
- this.contributions.serverPlugins.push(plugin);
101
- },
102
- addTemplate: (template) => {
103
- this.contributions.templates.push(template);
104
- },
105
- addTypeTemplate: (template) => {
106
- this.contributions.typeTemplates.push(template);
107
- },
108
- extendPages: (extender) => {
109
- this.contributions.pagesExtenders.push(extender);
110
- },
111
- extendViteConfig: (extender) => {
112
- this.contributions.viteConfigExtenders.push(extender);
113
- },
114
- extendNitroConfig: (extender) => {
115
- this.contributions.nitroConfigExtenders.push(extender);
116
- },
117
- addVitePlugin: (plugin) => {
118
- this.contributions.vitePlugins.push(plugin);
119
- },
120
- addPrerenderRoutes: (route) => {
121
- const list = Array.isArray(route) ? route : [route];
122
- for (const item of list) {
123
- this.contributions.prerenderRoutes.push({ route: item });
124
- }
125
- }
126
- };
127
- }
128
- }
11
+ var ResuxModuleContainer = class {
12
+ contributions = {
13
+ components: [],
14
+ componentDirs: [],
15
+ imports: [],
16
+ importDirs: [],
17
+ plugins: [],
18
+ middleware: [],
19
+ serverHandlers: [],
20
+ serverPlugins: [],
21
+ templates: [],
22
+ typeTemplates: [],
23
+ pagesExtenders: [],
24
+ runtimeConfigExtends: [],
25
+ viteConfigExtenders: [],
26
+ nitroConfigExtenders: [],
27
+ vitePlugins: [],
28
+ routeRules: [],
29
+ prerenderRoutes: []
30
+ };
31
+ createContext(config, rootDir, buildDir, hooks) {
32
+ return {
33
+ rootDir,
34
+ buildDir,
35
+ options: config,
36
+ addCss: (href) => {
37
+ const css = Array.isArray(config.css) ? config.css : [];
38
+ if (!css.includes(href)) css.push(href);
39
+ config.css = css;
40
+ },
41
+ addHead: (head) => {
42
+ const app = isObject(config.app) ? config.app : {};
43
+ app.head = mergeHead(isObject(app.head) ? app.head : {}, head);
44
+ config.app = app;
45
+ },
46
+ addRouteRule: (path, rule) => {
47
+ if (!path.startsWith("/")) throw new Error(`Route rules need an absolute path. Received "${path}".`);
48
+ const routeRules = isObject(config.routeRules) ? config.routeRules : {};
49
+ const merged = mergeRouteRule(path, isObject(routeRules[path]) ? routeRules[path] : {}, rule);
50
+ routeRules[path] = merged;
51
+ config.routeRules = routeRules;
52
+ this.contributions.routeRules.push({
53
+ path,
54
+ rule: merged
55
+ });
56
+ },
57
+ extendRuntimeConfig: (runtimeConfig) => {
58
+ this.contributions.runtimeConfigExtends.push(runtimeConfig);
59
+ config.runtimeConfig = deepMergeObjects(isObject(config.runtimeConfig) ? config.runtimeConfig : {}, runtimeConfig);
60
+ },
61
+ hook: (name, handler) => hooks.hook(name, handler),
62
+ addComponent: (component) => {
63
+ if (typeof component === "string") {
64
+ this.contributions.components.push({ file: component });
65
+ return;
66
+ }
67
+ this.contributions.components.push(component);
68
+ },
69
+ addComponentsDir: (dir) => {
70
+ if (typeof dir === "string") {
71
+ this.contributions.componentDirs.push({ path: dir });
72
+ return;
73
+ }
74
+ this.contributions.componentDirs.push(dir);
75
+ },
76
+ addImports: (imports) => {
77
+ const list = Array.isArray(imports) ? imports : [imports];
78
+ this.contributions.imports.push(...list);
79
+ },
80
+ addImportsDir: (dir) => {
81
+ this.contributions.importDirs.push(dir);
82
+ },
83
+ addPlugin: (plugin) => {
84
+ if (typeof plugin === "string") {
85
+ this.contributions.plugins.push({
86
+ src: plugin,
87
+ mode: "all"
88
+ });
89
+ return;
90
+ }
91
+ this.contributions.plugins.push({
92
+ mode: "all",
93
+ ...plugin
94
+ });
95
+ },
96
+ addRouteMiddleware: (middleware) => {
97
+ this.contributions.middleware.push(middleware);
98
+ },
99
+ addServerHandler: (handler) => {
100
+ this.contributions.serverHandlers.push(handler);
101
+ },
102
+ addServerPlugin: (plugin) => {
103
+ this.contributions.serverPlugins.push(plugin);
104
+ },
105
+ addTemplate: (template) => {
106
+ this.contributions.templates.push(template);
107
+ },
108
+ addTypeTemplate: (template) => {
109
+ this.contributions.typeTemplates.push(template);
110
+ },
111
+ extendPages: (extender) => {
112
+ this.contributions.pagesExtenders.push(extender);
113
+ },
114
+ extendViteConfig: (extender) => {
115
+ this.contributions.viteConfigExtenders.push(extender);
116
+ },
117
+ extendNitroConfig: (extender) => {
118
+ this.contributions.nitroConfigExtenders.push(extender);
119
+ },
120
+ addVitePlugin: (plugin) => {
121
+ this.contributions.vitePlugins.push(plugin);
122
+ },
123
+ addPrerenderRoutes: (route) => {
124
+ const list = Array.isArray(route) ? route : [route];
125
+ for (const item of list) this.contributions.prerenderRoutes.push({ route: item });
126
+ }
127
+ };
128
+ }
129
+ };
129
130
  function mergeRouteRule(routePath, current, next) {
130
- const headers = {
131
- ...(isObject(current.headers) ? current.headers : {}),
132
- ...(isObject(next.headers) ? next.headers : {}),
133
- };
134
- if (RESUX_STABLE_RESUMABILITY_ASSET_PATHS.has(routePath)) {
135
- for (const key of Object.keys(headers)) {
136
- if (key.toLowerCase() === "cache-control") {
137
- delete headers[key];
138
- }
139
- }
140
- headers["cache-control"] = RESUX_RUNTIME_CLIENT_CACHE_CONTROL;
141
- return {
142
- ...current,
143
- ...next,
144
- cache: false,
145
- headers,
146
- };
147
- }
148
- return {
149
- ...current,
150
- ...next,
151
- headers,
152
- };
131
+ const headers = {
132
+ ...isObject(current.headers) ? current.headers : {},
133
+ ...isObject(next.headers) ? next.headers : {}
134
+ };
135
+ if (RESUX_STABLE_RESUMABILITY_ASSET_PATHS.has(routePath)) {
136
+ for (const key of Object.keys(headers)) if (key.toLowerCase() === "cache-control") delete headers[key];
137
+ headers["cache-control"] = RESUX_RUNTIME_CLIENT_CACHE_CONTROL;
138
+ return {
139
+ ...current,
140
+ ...next,
141
+ cache: false,
142
+ headers
143
+ };
144
+ }
145
+ return {
146
+ ...current,
147
+ ...next,
148
+ headers
149
+ };
153
150
  }
154
151
  function mergeHead(current, next) {
155
- return {
156
- ...current,
157
- ...next,
158
- meta: mergeHeadArray(current.meta, next.meta),
159
- link: mergeHeadArray(current.link, next.link),
160
- style: mergeHeadArray(current.style, next.style),
161
- script: mergeHeadArray(current.script, next.script),
162
- noscript: mergeHeadArray(current.noscript, next.noscript),
163
- htmlAttrs: {
164
- ...(isObject(current.htmlAttrs) ? current.htmlAttrs : {}),
165
- ...(isObject(next.htmlAttrs) ? next.htmlAttrs : {}),
166
- },
167
- bodyAttrs: {
168
- ...(isObject(current.bodyAttrs) ? current.bodyAttrs : {}),
169
- ...(isObject(next.bodyAttrs) ? next.bodyAttrs : {}),
170
- },
171
- };
152
+ return {
153
+ ...current,
154
+ ...next,
155
+ meta: mergeHeadArray(current.meta, next.meta),
156
+ link: mergeHeadArray(current.link, next.link),
157
+ style: mergeHeadArray(current.style, next.style),
158
+ script: mergeHeadArray(current.script, next.script),
159
+ noscript: mergeHeadArray(current.noscript, next.noscript),
160
+ htmlAttrs: {
161
+ ...isObject(current.htmlAttrs) ? current.htmlAttrs : {},
162
+ ...isObject(next.htmlAttrs) ? next.htmlAttrs : {}
163
+ },
164
+ bodyAttrs: {
165
+ ...isObject(current.bodyAttrs) ? current.bodyAttrs : {},
166
+ ...isObject(next.bodyAttrs) ? next.bodyAttrs : {}
167
+ }
168
+ };
172
169
  }
173
170
  function mergeHeadArray(current, next) {
174
- return [
175
- ...(Array.isArray(current) ? current : []),
176
- ...(Array.isArray(next) ? next : []),
177
- ];
171
+ return [...Array.isArray(current) ? current : [], ...Array.isArray(next) ? next : []];
178
172
  }
179
173
  function isObject(value) {
180
- return Boolean(value && typeof value === "object" && !Array.isArray(value));
174
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
181
175
  }
182
- const FORBIDDEN_OBJECT_KEYS = new Set(["__proto__", "prototype", "constructor"]);
176
+ const FORBIDDEN_OBJECT_KEYS = new Set([
177
+ "__proto__",
178
+ "prototype",
179
+ "constructor"
180
+ ]);
183
181
  function deepMergeObjects(base, next) {
184
- const output = { ...base };
185
- for (const [key, value] of Object.entries(next)) {
186
- if (FORBIDDEN_OBJECT_KEYS.has(key)) {
187
- throw new Error(`Runtime config contains unsafe key "${key}".`);
188
- }
189
- const current = Object.hasOwn(output, key)
190
- ? output[key]
191
- : undefined;
192
- output[key] = isObject(current) && isObject(value)
193
- ? deepMergeObjects(current, value)
194
- : value;
195
- }
196
- return output;
182
+ const output = { ...base };
183
+ for (const [key, value] of Object.entries(next)) {
184
+ if (FORBIDDEN_OBJECT_KEYS.has(key)) throw new Error(`Runtime config contains unsafe key "${key}".`);
185
+ const current = Object.hasOwn(output, key) ? output[key] : void 0;
186
+ output[key] = isObject(current) && isObject(value) ? deepMergeObjects(current, value) : value;
187
+ }
188
+ return output;
197
189
  }
190
+
191
+ //#endregion
192
+ export { RESUX_HANDLER_MODULES_PATH, RESUX_RUNTIME_CLIENT_CACHE_CONTROL, RESUX_RUNTIME_CLIENT_PATH, RESUX_VUE_ISLAND_MODULES_PATH, ResuxModuleContainer };
198
193
  //# sourceMappingURL=module-container.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-container.js","sourceRoot":"","sources":["../../src/core/module-container.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,yBAAyB,GAAG,6BAA6B,CAAC;AACvE,MAAM,CAAC,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AACjE,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAC;AACvE,MAAM,CAAC,MAAM,kCAAkC,GAAG,qCAAqC,CAAC;AAExF,MAAM,qCAAqC,GAAG,IAAI,GAAG,CAAC;IACpD,yBAAyB;IACzB,0BAA0B;IAC1B,6BAA6B;CAC9B,CAAC,CAAC;AAwGH,MAAM,OAAO,oBAAoB;IACtB,aAAa,GAA6B;QACjD,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAAE;QACjB,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,cAAc,EAAE,EAAE;QAClB,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,EAAE;QACb,aAAa,EAAE,EAAE;QACjB,cAAc,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,CAAC,KAAc;IAC9B,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AAEjF,SAAS,gBAAgB,CAAC,IAA6B,EAAE,IAA6B;IACpF,MAAM,MAAM,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAC;IACpD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG,IAAI,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;YACxC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;YACb,CAAC,CAAC,SAAS,CAAC;QACd,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC;YAChD,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC;YAClC,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"module-container.js","names":[],"sources":["../../src/core/module-container.ts"],"sourcesContent":["import type { ResuxHooks, ResuxHookName, ResuxHookPayloads } from \"./hooks.js\";\n\nexport type ResuxSupportMode = \"all\" | \"server\" | \"client\";\n\nexport const RESUX_RUNTIME_CLIENT_PATH = \"/__resux/runtime-client.mjs\";\nexport const RESUX_HANDLER_MODULES_PATH = \"/__resux/handlers/**\";\nexport const RESUX_VUE_ISLAND_MODULES_PATH = \"/__resux/vue-islands/**\";\nexport const RESUX_RUNTIME_CLIENT_CACHE_CONTROL = \"no-cache, no-store, must-revalidate\";\n\nconst RESUX_STABLE_RESUMABILITY_ASSET_PATHS = new Set([\n RESUX_RUNTIME_CLIENT_PATH,\n RESUX_HANDLER_MODULES_PATH,\n RESUX_VUE_ISLAND_MODULES_PATH,\n]);\n\nexport interface ResuxTemplateInput {\n filename: string;\n getContents: () => string | Promise<string>;\n write?: boolean;\n}\n\nexport interface ResuxTypeTemplateInput extends ResuxTemplateInput {}\n\nexport interface ResuxComponentInput {\n file: string;\n name?: string;\n global?: boolean;\n mode?: ResuxSupportMode;\n lazy?: boolean;\n}\n\nexport interface ResuxComponentsDirInput {\n path: string;\n global?: boolean;\n mode?: ResuxSupportMode;\n pathPrefix?: boolean;\n}\n\nexport interface ResuxImportInput {\n from: string;\n name: string;\n as?: string;\n}\n\nexport interface ResuxPluginInput {\n src: string;\n mode?: ResuxSupportMode;\n}\n\nexport interface ResuxRouteMiddlewareInput {\n name: string;\n src: string;\n global?: boolean;\n mode?: ResuxSupportMode;\n}\n\nexport interface ResuxServerHandlerInput {\n route: string;\n handler: string;\n middleware?: boolean;\n method?: string;\n}\n\nexport interface ResuxPrerenderRouteInput {\n route: string;\n}\n\nexport type PagesExtender = (pages: Array<Record<string, unknown>>) => void | Promise<void>;\nexport type ViteConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;\nexport type NitroConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;\n\nexport interface ResuxModuleContributions {\n components: ResuxComponentInput[];\n componentDirs: ResuxComponentsDirInput[];\n imports: ResuxImportInput[];\n importDirs: string[];\n plugins: ResuxPluginInput[];\n middleware: ResuxRouteMiddlewareInput[];\n serverHandlers: ResuxServerHandlerInput[];\n serverPlugins: string[];\n templates: ResuxTemplateInput[];\n typeTemplates: ResuxTypeTemplateInput[];\n pagesExtenders: PagesExtender[];\n runtimeConfigExtends: Record<string, unknown>[];\n viteConfigExtenders: ViteConfigExtender[];\n nitroConfigExtenders: NitroConfigExtender[];\n vitePlugins: unknown[];\n routeRules: Array<{ path: string; rule: Record<string, unknown> }>;\n prerenderRoutes: ResuxPrerenderRouteInput[];\n}\n\nexport interface ResuxModuleContext {\n rootDir: string;\n buildDir: string;\n options: Record<string, unknown>;\n addCss(href: string): void;\n addHead(head: Record<string, unknown>): void;\n addRouteRule(path: string, rule: Record<string, unknown>): void;\n extendRuntimeConfig(config: Record<string, unknown>): void;\n hook<K extends ResuxHookName>(name: K, handler: (payload: ResuxHookPayloads[K]) => void | Promise<void>): () => void;\n addComponent(component: ResuxComponentInput | string): void;\n addComponentsDir(dir: ResuxComponentsDirInput | string): void;\n addImports(imports: ResuxImportInput | ResuxImportInput[]): void;\n addImportsDir(dir: string): void;\n addPlugin(plugin: ResuxPluginInput | string): void;\n addRouteMiddleware(middleware: ResuxRouteMiddlewareInput): void;\n addServerHandler(handler: ResuxServerHandlerInput): void;\n addServerPlugin(plugin: string): void;\n addTemplate(template: ResuxTemplateInput): void;\n addTypeTemplate(template: ResuxTypeTemplateInput): void;\n extendPages(extender: PagesExtender): void;\n extendViteConfig(extender: ViteConfigExtender): void;\n extendNitroConfig(extender: NitroConfigExtender): void;\n addVitePlugin(plugin: unknown): void;\n addPrerenderRoutes(route: string | string[]): void;\n}\n\nexport class ResuxModuleContainer {\n readonly contributions: ResuxModuleContributions = {\n components: [],\n componentDirs: [],\n imports: [],\n importDirs: [],\n plugins: [],\n middleware: [],\n serverHandlers: [],\n serverPlugins: [],\n templates: [],\n typeTemplates: [],\n pagesExtenders: [],\n runtimeConfigExtends: [],\n viteConfigExtenders: [],\n nitroConfigExtenders: [],\n vitePlugins: [],\n routeRules: [],\n prerenderRoutes: []\n };\n\n createContext(\n config: Record<string, unknown>,\n rootDir: string,\n buildDir: string,\n hooks: ResuxHooks\n ): ResuxModuleContext {\n return {\n rootDir,\n buildDir,\n options: config,\n addCss: (href) => {\n const css = Array.isArray(config.css) ? config.css : [];\n if (!css.includes(href)) {\n css.push(href);\n }\n config.css = css;\n },\n addHead: (head) => {\n const app = isObject(config.app) ? config.app : {};\n const current = isObject(app.head) ? app.head : {};\n app.head = mergeHead(current, head);\n config.app = app;\n },\n addRouteRule: (path, rule) => {\n if (!path.startsWith(\"/\")) {\n throw new Error(`Route rules need an absolute path. Received \"${path}\".`);\n }\n const routeRules = isObject(config.routeRules) ? config.routeRules : {};\n const current = isObject(routeRules[path]) ? routeRules[path] : {};\n const merged = mergeRouteRule(path, current, rule);\n routeRules[path] = merged;\n config.routeRules = routeRules;\n this.contributions.routeRules.push({ path, rule: merged });\n },\n extendRuntimeConfig: (runtimeConfig) => {\n this.contributions.runtimeConfigExtends.push(runtimeConfig);\n const current = isObject(config.runtimeConfig) ? config.runtimeConfig : {};\n config.runtimeConfig = deepMergeObjects(current, runtimeConfig);\n },\n hook: (name, handler) => hooks.hook(name, handler),\n addComponent: (component) => {\n if (typeof component === \"string\") {\n this.contributions.components.push({ file: component });\n return;\n }\n this.contributions.components.push(component);\n },\n addComponentsDir: (dir) => {\n if (typeof dir === \"string\") {\n this.contributions.componentDirs.push({ path: dir });\n return;\n }\n this.contributions.componentDirs.push(dir);\n },\n addImports: (imports) => {\n const list = Array.isArray(imports) ? imports : [imports];\n this.contributions.imports.push(...list);\n },\n addImportsDir: (dir) => {\n this.contributions.importDirs.push(dir);\n },\n addPlugin: (plugin) => {\n if (typeof plugin === \"string\") {\n this.contributions.plugins.push({ src: plugin, mode: \"all\" });\n return;\n }\n this.contributions.plugins.push({ mode: \"all\", ...plugin });\n },\n addRouteMiddleware: (middleware) => {\n this.contributions.middleware.push(middleware);\n },\n addServerHandler: (handler) => {\n this.contributions.serverHandlers.push(handler);\n },\n addServerPlugin: (plugin) => {\n this.contributions.serverPlugins.push(plugin);\n },\n addTemplate: (template) => {\n this.contributions.templates.push(template);\n },\n addTypeTemplate: (template) => {\n this.contributions.typeTemplates.push(template);\n },\n extendPages: (extender) => {\n this.contributions.pagesExtenders.push(extender);\n },\n extendViteConfig: (extender) => {\n this.contributions.viteConfigExtenders.push(extender);\n },\n extendNitroConfig: (extender) => {\n this.contributions.nitroConfigExtenders.push(extender);\n },\n addVitePlugin: (plugin) => {\n this.contributions.vitePlugins.push(plugin);\n },\n addPrerenderRoutes: (route) => {\n const list = Array.isArray(route) ? route : [route];\n for (const item of list) {\n this.contributions.prerenderRoutes.push({ route: item });\n }\n }\n };\n }\n}\n\nfunction mergeRouteRule(\n routePath: string,\n current: Record<string, unknown>,\n next: Record<string, unknown>,\n): Record<string, unknown> {\n const headers: Record<string, unknown> = {\n ...(isObject(current.headers) ? current.headers : {}),\n ...(isObject(next.headers) ? next.headers : {}),\n };\n\n if (RESUX_STABLE_RESUMABILITY_ASSET_PATHS.has(routePath)) {\n for (const key of Object.keys(headers)) {\n if (key.toLowerCase() === \"cache-control\") {\n delete headers[key];\n }\n }\n headers[\"cache-control\"] = RESUX_RUNTIME_CLIENT_CACHE_CONTROL;\n return {\n ...current,\n ...next,\n cache: false,\n headers,\n };\n }\n\n return {\n ...current,\n ...next,\n headers,\n };\n}\n\nfunction mergeHead(current: Record<string, unknown>, next: Record<string, unknown>): Record<string, unknown> {\n return {\n ...current,\n ...next,\n meta: mergeHeadArray(current.meta, next.meta),\n link: mergeHeadArray(current.link, next.link),\n style: mergeHeadArray(current.style, next.style),\n script: mergeHeadArray(current.script, next.script),\n noscript: mergeHeadArray(current.noscript, next.noscript),\n htmlAttrs: {\n ...(isObject(current.htmlAttrs) ? current.htmlAttrs : {}),\n ...(isObject(next.htmlAttrs) ? next.htmlAttrs : {}),\n },\n bodyAttrs: {\n ...(isObject(current.bodyAttrs) ? current.bodyAttrs : {}),\n ...(isObject(next.bodyAttrs) ? next.bodyAttrs : {}),\n },\n };\n}\n\nfunction mergeHeadArray(current: unknown, next: unknown): unknown[] {\n return [\n ...(Array.isArray(current) ? current : []),\n ...(Array.isArray(next) ? next : []),\n ];\n}\n\nfunction isObject(value: unknown): value is Record<string, any> {\n return Boolean(value && typeof value === \"object\" && !Array.isArray(value));\n}\n\nconst FORBIDDEN_OBJECT_KEYS = new Set([\"__proto__\", \"prototype\", \"constructor\"]);\n\nfunction deepMergeObjects(base: Record<string, unknown>, next: Record<string, unknown>): Record<string, unknown> {\n const output: Record<string, unknown> = { ...base };\n for (const [key, value] of Object.entries(next)) {\n if (FORBIDDEN_OBJECT_KEYS.has(key)) {\n throw new Error(`Runtime config contains unsafe key \"${key}\".`);\n }\n const current = Object.hasOwn(output, key)\n ? output[key]\n : undefined;\n output[key] = isObject(current) && isObject(value)\n ? deepMergeObjects(current, value)\n : value;\n }\n return output;\n}\n"],"mappings":";AAIA,MAAa,4BAA4B;AACzC,MAAa,6BAA6B;AAC1C,MAAa,gCAAgC;AAC7C,MAAa,qCAAqC;AAElD,MAAM,wCAAwC,IAAI,IAAI;CACpD;CACA;CACA;CACD,CAAC;AAwGF,IAAa,uBAAb,MAAkC;CAChC,AAAS,gBAA0C;EACjD,YAAY,EAAE;EACd,eAAe,EAAE;EACjB,SAAS,EAAE;EACX,YAAY,EAAE;EACd,SAAS,EAAE;EACX,YAAY,EAAE;EACd,gBAAgB,EAAE;EAClB,eAAe,EAAE;EACjB,WAAW,EAAE;EACb,eAAe,EAAE;EACjB,gBAAgB,EAAE;EAClB,sBAAsB,EAAE;EACxB,qBAAqB,EAAE;EACvB,sBAAsB,EAAE;EACxB,aAAa,EAAE;EACf,YAAY,EAAE;EACd,iBAAiB,EAAE;EACpB;CAED,cACE,QACA,SACA,UACA,OACoB;AACpB,SAAO;GACL;GACA;GACA,SAAS;GACT,SAAS,SAAS;IAChB,MAAM,MAAM,MAAM,QAAQ,OAAO,IAAI,GAAG,OAAO,MAAM,EAAE;AACvD,QAAI,CAAC,IAAI,SAAS,KAAK,CACrB,KAAI,KAAK,KAAK;AAEhB,WAAO,MAAM;;GAEf,UAAU,SAAS;IACjB,MAAM,MAAM,SAAS,OAAO,IAAI,GAAG,OAAO,MAAM,EAAE;AAElD,QAAI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