@gadicc/loom 1.37.0 → 2.0.0

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 (834) hide show
  1. package/.loom-source-manifest.json +97 -0
  2. package/README.md +113 -31
  3. package/db/databaseTls.js +6 -3
  4. package/db/databaseUrl.js +3 -2
  5. package/db/drizzle-config.js +14 -16
  6. package/db/fixtures.d.ts +1 -3
  7. package/db/fixtures.js +4 -7
  8. package/esm/bin/loom.d.ts +2 -1
  9. package/esm/bin/loom.d.ts.map +1 -1
  10. package/esm/bin/loom.js +37 -10
  11. package/esm/bin/loom.js.map +1 -0
  12. package/esm/mod.d.ts +0 -1
  13. package/esm/mod.d.ts.map +1 -1
  14. package/esm/mod.js +1 -1
  15. package/esm/mod.js.map +1 -0
  16. package/esm/src/apiKeys/authorize.d.ts.map +1 -1
  17. package/esm/src/apiKeys/authorize.js +15 -14
  18. package/esm/src/apiKeys/authorize.js.map +1 -0
  19. package/esm/src/apiKeys/betterAuth.d.ts.map +1 -1
  20. package/esm/src/apiKeys/betterAuth.js +1 -0
  21. package/esm/src/apiKeys/betterAuth.js.map +1 -0
  22. package/esm/src/apiKeys/country.d.ts.map +1 -1
  23. package/esm/src/apiKeys/country.js +1 -0
  24. package/esm/src/apiKeys/country.js.map +1 -0
  25. package/esm/src/apiKeys/credentials.d.ts.map +1 -1
  26. package/esm/src/apiKeys/credentials.js +3 -1
  27. package/esm/src/apiKeys/credentials.js.map +1 -0
  28. package/esm/src/apiKeys/fingerprint.d.ts.map +1 -1
  29. package/esm/src/apiKeys/fingerprint.js +1 -0
  30. package/esm/src/apiKeys/fingerprint.js.map +1 -0
  31. package/esm/src/apiKeys/lifecycle.d.ts.map +1 -1
  32. package/esm/src/apiKeys/lifecycle.js +1 -0
  33. package/esm/src/apiKeys/lifecycle.js.map +1 -0
  34. package/esm/src/apiKeys/limits.d.ts.map +1 -1
  35. package/esm/src/apiKeys/limits.js +10 -10
  36. package/esm/src/apiKeys/limits.js.map +1 -0
  37. package/esm/src/apiKeys/mod.d.ts +0 -1
  38. package/esm/src/apiKeys/mod.d.ts.map +1 -1
  39. package/esm/src/apiKeys/mod.js +1 -1
  40. package/esm/src/apiKeys/mod.js.map +1 -0
  41. package/esm/src/apiKeys/permissions.d.ts.map +1 -1
  42. package/esm/src/apiKeys/permissions.js +1 -0
  43. package/esm/src/apiKeys/permissions.js.map +1 -0
  44. package/esm/src/apiKeys/policy.d.ts.map +1 -1
  45. package/esm/src/apiKeys/policy.js +1 -0
  46. package/esm/src/apiKeys/policy.js.map +1 -0
  47. package/esm/src/apiKeys/retention.d.ts.map +1 -1
  48. package/esm/src/apiKeys/retention.js +1 -0
  49. package/esm/src/apiKeys/retention.js.map +1 -0
  50. package/esm/src/apiKeys/types.d.ts.map +1 -1
  51. package/esm/src/apiKeys/types.js +1 -0
  52. package/esm/src/apiKeys/types.js.map +1 -0
  53. package/esm/src/cli/atomicText.d.ts +3 -0
  54. package/esm/src/cli/atomicText.d.ts.map +1 -0
  55. package/esm/src/cli/atomicText.js +33 -0
  56. package/esm/src/cli/atomicText.js.map +1 -0
  57. package/esm/src/cli/bunLocalDev.d.ts +65 -0
  58. package/esm/src/cli/bunLocalDev.d.ts.map +1 -0
  59. package/esm/src/cli/bunLocalDev.js +459 -0
  60. package/esm/src/cli/bunLocalDev.js.map +1 -0
  61. package/esm/src/cli/bunProject.d.ts +30 -0
  62. package/esm/src/cli/bunProject.d.ts.map +1 -0
  63. package/esm/src/cli/bunProject.js +309 -0
  64. package/esm/src/cli/bunProject.js.map +1 -0
  65. package/esm/src/cli/cliBootstrap.d.ts +83 -0
  66. package/esm/src/cli/cliBootstrap.d.ts.map +1 -0
  67. package/esm/src/cli/cliBootstrap.js +186 -0
  68. package/esm/src/cli/cliBootstrap.js.map +1 -0
  69. package/esm/src/cli/externalSkills.d.ts.map +1 -1
  70. package/esm/src/cli/externalSkills.js +9 -5
  71. package/esm/src/cli/externalSkills.js.map +1 -0
  72. package/esm/src/cli/filesR2Policy.d.ts.map +1 -1
  73. package/esm/src/cli/filesR2Policy.js +18 -11
  74. package/esm/src/cli/filesR2Policy.js.map +1 -0
  75. package/esm/src/cli/generatedBuild.d.ts +42 -0
  76. package/esm/src/cli/generatedBuild.d.ts.map +1 -0
  77. package/esm/src/cli/generatedBuild.js +259 -0
  78. package/esm/src/cli/generatedBuild.js.map +1 -0
  79. package/esm/src/cli/generatedCleanup.d.ts +7 -0
  80. package/esm/src/cli/generatedCleanup.d.ts.map +1 -0
  81. package/esm/src/cli/generatedCleanup.js +67 -0
  82. package/esm/src/cli/generatedCleanup.js.map +1 -0
  83. package/esm/src/cli/generatedDevLease.d.ts +8 -0
  84. package/esm/src/cli/generatedDevLease.d.ts.map +1 -0
  85. package/esm/src/cli/generatedDevLease.js +39 -0
  86. package/esm/src/cli/generatedDevLease.js.map +1 -0
  87. package/esm/src/cli/generatedInstall.d.ts +64 -0
  88. package/esm/src/cli/generatedInstall.d.ts.map +1 -0
  89. package/esm/src/cli/generatedInstall.js +466 -0
  90. package/esm/src/cli/generatedInstall.js.map +1 -0
  91. package/esm/src/cli/generatedWorkflow.d.ts +34 -0
  92. package/esm/src/cli/generatedWorkflow.d.ts.map +1 -0
  93. package/esm/src/cli/generatedWorkflow.js +85 -0
  94. package/esm/src/cli/generatedWorkflow.js.map +1 -0
  95. package/esm/src/cli/legacyManagedOutputs.d.ts.map +1 -1
  96. package/esm/src/cli/legacyManagedOutputs.js +1 -0
  97. package/esm/src/cli/legacyManagedOutputs.js.map +1 -0
  98. package/esm/src/cli/localDb.d.ts.map +1 -1
  99. package/esm/src/cli/localDb.js +35 -30
  100. package/esm/src/cli/localDb.js.map +1 -0
  101. package/esm/src/cli/localDevLock.d.ts +9 -0
  102. package/esm/src/cli/localDevLock.d.ts.map +1 -1
  103. package/esm/src/cli/localDevLock.js +54 -13
  104. package/esm/src/cli/localDevLock.js.map +1 -0
  105. package/esm/src/cli/localDevPackage.d.ts +6 -11
  106. package/esm/src/cli/localDevPackage.d.ts.map +1 -1
  107. package/esm/src/cli/localDevPackage.js +51 -48
  108. package/esm/src/cli/localDevPackage.js.map +1 -0
  109. package/esm/src/cli/managedFiles.d.ts.map +1 -1
  110. package/esm/src/cli/managedFiles.js +34 -18
  111. package/esm/src/cli/managedFiles.js.map +1 -0
  112. package/esm/src/cli/migrationEnv.d.ts +16 -3
  113. package/esm/src/cli/migrationEnv.d.ts.map +1 -1
  114. package/esm/src/cli/migrationEnv.js +9 -6
  115. package/esm/src/cli/migrationEnv.js.map +1 -0
  116. package/esm/src/cli/mod.d.ts +20 -7
  117. package/esm/src/cli/mod.d.ts.map +1 -1
  118. package/esm/src/cli/mod.js +2148 -730
  119. package/esm/src/cli/mod.js.map +1 -0
  120. package/esm/src/cli/packageTreeSignature.d.ts +8 -0
  121. package/esm/src/cli/packageTreeSignature.d.ts.map +1 -0
  122. package/esm/src/cli/packageTreeSignature.js +60 -0
  123. package/esm/src/cli/packageTreeSignature.js.map +1 -0
  124. package/esm/src/cli/processIdentity.d.ts +7 -0
  125. package/esm/src/cli/processIdentity.d.ts.map +1 -0
  126. package/esm/src/cli/processIdentity.js +39 -0
  127. package/esm/src/cli/processIdentity.js.map +1 -0
  128. package/esm/src/cli/projectSkills.d.ts +1 -1
  129. package/esm/src/cli/projectSkills.d.ts.map +1 -1
  130. package/esm/src/cli/projectSkills.js +31 -23
  131. package/esm/src/cli/projectSkills.js.map +1 -0
  132. package/esm/src/cli/projectTooling.d.ts +6 -3
  133. package/esm/src/cli/projectTooling.d.ts.map +1 -1
  134. package/esm/src/cli/projectTooling.js +86 -41
  135. package/esm/src/cli/projectTooling.js.map +1 -0
  136. package/esm/src/cli/releaseConfig.d.ts.map +1 -1
  137. package/esm/src/cli/releaseConfig.js +5 -3
  138. package/esm/src/cli/releaseConfig.js.map +1 -0
  139. package/esm/src/cli/releaseCredentials.d.ts.map +1 -1
  140. package/esm/src/cli/releaseCredentials.js +19 -31
  141. package/esm/src/cli/releaseCredentials.js.map +1 -0
  142. package/esm/src/cli/releaseTrust.d.ts.map +1 -1
  143. package/esm/src/cli/releaseTrust.js +11 -4
  144. package/esm/src/cli/releaseTrust.js.map +1 -0
  145. package/esm/src/cli/releaseTrustCommand.d.ts.map +1 -1
  146. package/esm/src/cli/releaseTrustCommand.js +6 -4
  147. package/esm/src/cli/releaseTrustCommand.js.map +1 -0
  148. package/esm/src/cli/sourceConfig.d.ts +3 -0
  149. package/esm/src/cli/sourceConfig.d.ts.map +1 -0
  150. package/esm/src/cli/sourceConfig.js +91 -0
  151. package/esm/src/cli/sourceConfig.js.map +1 -0
  152. package/esm/src/cli/sourceDev.d.ts +77 -0
  153. package/esm/src/cli/sourceDev.d.ts.map +1 -0
  154. package/esm/src/cli/sourceDev.js +974 -0
  155. package/esm/src/cli/sourceDev.js.map +1 -0
  156. package/esm/src/cli/vercelBuildEnv.d.ts.map +1 -1
  157. package/esm/src/cli/vercelBuildEnv.js +44 -21
  158. package/esm/src/cli/vercelBuildEnv.js.map +1 -0
  159. package/esm/src/cli/vercelEnvMask.d.ts +38 -0
  160. package/esm/src/cli/vercelEnvMask.d.ts.map +1 -0
  161. package/esm/src/cli/vercelEnvMask.js +140 -0
  162. package/esm/src/cli/vercelEnvMask.js.map +1 -0
  163. package/esm/src/cli/vercelProjectRelease.d.ts.map +1 -1
  164. package/esm/src/cli/vercelProjectRelease.js +47 -24
  165. package/esm/src/cli/vercelProjectRelease.js.map +1 -0
  166. package/esm/src/cli/vercelPulledEnv.d.ts +65 -0
  167. package/esm/src/cli/vercelPulledEnv.d.ts.map +1 -0
  168. package/esm/src/cli/vercelPulledEnv.js +133 -0
  169. package/esm/src/cli/vercelPulledEnv.js.map +1 -0
  170. package/esm/src/clientData/identity.d.ts.map +1 -1
  171. package/esm/src/clientData/identity.js +1 -0
  172. package/esm/src/clientData/identity.js.map +1 -0
  173. package/esm/src/clientData/mod.d.ts +0 -1
  174. package/esm/src/clientData/mod.d.ts.map +1 -1
  175. package/esm/src/clientData/mod.js +1 -0
  176. package/esm/src/clientData/mod.js.map +1 -0
  177. package/esm/src/files/client.d.ts +1 -1
  178. package/esm/src/files/client.d.ts.map +1 -1
  179. package/esm/src/files/client.js +3 -4
  180. package/esm/src/files/client.js.map +1 -0
  181. package/esm/src/files/errors.d.ts.map +1 -1
  182. package/esm/src/files/errors.js +3 -12
  183. package/esm/src/files/errors.js.map +1 -0
  184. package/esm/src/files/hash.d.ts +1 -1
  185. package/esm/src/files/hash.d.ts.map +1 -1
  186. package/esm/src/files/hash.js +1 -0
  187. package/esm/src/files/hash.js.map +1 -0
  188. package/esm/src/files/memory.d.ts.map +1 -1
  189. package/esm/src/files/memory.js +2 -1
  190. package/esm/src/files/memory.js.map +1 -0
  191. package/esm/src/files/metadata.d.ts.map +1 -1
  192. package/esm/src/files/metadata.js +11 -18
  193. package/esm/src/files/metadata.js.map +1 -0
  194. package/esm/src/files/mod.d.ts +0 -1
  195. package/esm/src/files/mod.d.ts.map +1 -1
  196. package/esm/src/files/mod.js +1 -1
  197. package/esm/src/files/mod.js.map +1 -0
  198. package/esm/src/files/s3.d.ts.map +1 -1
  199. package/esm/src/files/s3.js +6 -4
  200. package/esm/src/files/s3.js.map +1 -0
  201. package/esm/src/files/service.d.ts.map +1 -1
  202. package/esm/src/files/service.js +3 -4
  203. package/esm/src/files/service.js.map +1 -0
  204. package/esm/src/files/types.d.ts.map +1 -1
  205. package/esm/src/files/types.js +1 -0
  206. package/esm/src/files/types.js.map +1 -0
  207. package/esm/src/jobs/catalog.d.ts.map +1 -1
  208. package/esm/src/jobs/catalog.js +5 -1
  209. package/esm/src/jobs/catalog.js.map +1 -0
  210. package/esm/src/jobs/controller.d.ts +1 -1
  211. package/esm/src/jobs/controller.d.ts.map +1 -1
  212. package/esm/src/jobs/controller.js +11 -55
  213. package/esm/src/jobs/controller.js.map +1 -0
  214. package/esm/src/jobs/direct.d.ts.map +1 -1
  215. package/esm/src/jobs/direct.js +3 -3
  216. package/esm/src/jobs/direct.js.map +1 -0
  217. package/esm/src/jobs/events.d.ts.map +1 -1
  218. package/esm/src/jobs/events.js +1 -0
  219. package/esm/src/jobs/events.js.map +1 -0
  220. package/esm/src/jobs/format.d.ts +5 -5
  221. package/esm/src/jobs/format.d.ts.map +1 -1
  222. package/esm/src/jobs/format.js +2 -1
  223. package/esm/src/jobs/format.js.map +1 -0
  224. package/esm/src/jobs/http.d.ts +3 -3
  225. package/esm/src/jobs/http.d.ts.map +1 -1
  226. package/esm/src/jobs/http.js +1 -0
  227. package/esm/src/jobs/http.js.map +1 -0
  228. package/esm/src/jobs/log.d.ts.map +1 -1
  229. package/esm/src/jobs/log.js +1 -0
  230. package/esm/src/jobs/log.js.map +1 -0
  231. package/esm/src/jobs/mod.d.ts.map +1 -1
  232. package/esm/src/jobs/mod.js +1 -0
  233. package/esm/src/jobs/mod.js.map +1 -0
  234. package/esm/src/jobs/run.d.ts.map +1 -1
  235. package/esm/src/jobs/run.js +1 -0
  236. package/esm/src/jobs/run.js.map +1 -0
  237. package/esm/src/jobs/sanitize.d.ts.map +1 -1
  238. package/esm/src/jobs/sanitize.js +1 -0
  239. package/esm/src/jobs/sanitize.js.map +1 -0
  240. package/esm/src/jobs/types.d.ts +1 -0
  241. package/esm/src/jobs/types.d.ts.map +1 -1
  242. package/esm/src/jobs/types.js +1 -0
  243. package/esm/src/jobs/types.js.map +1 -0
  244. package/esm/src/mail/errors.d.ts.map +1 -1
  245. package/esm/src/mail/errors.js +8 -42
  246. package/esm/src/mail/errors.js.map +1 -0
  247. package/esm/src/mail/memory.d.ts +1 -1
  248. package/esm/src/mail/memory.d.ts.map +1 -1
  249. package/esm/src/mail/memory.js +10 -14
  250. package/esm/src/mail/memory.js.map +1 -0
  251. package/esm/src/mail/mod.d.ts +0 -1
  252. package/esm/src/mail/mod.d.ts.map +1 -1
  253. package/esm/src/mail/mod.js +1 -1
  254. package/esm/src/mail/mod.js.map +1 -0
  255. package/esm/src/mail/postal.d.ts +1 -2
  256. package/esm/src/mail/postal.d.ts.map +1 -1
  257. package/esm/src/mail/postal.js +22 -18
  258. package/esm/src/mail/postal.js.map +1 -0
  259. package/esm/src/mail/retry.d.ts.map +1 -1
  260. package/esm/src/mail/retry.js +1 -0
  261. package/esm/src/mail/retry.js.map +1 -0
  262. package/esm/src/mail/sender.d.ts.map +1 -1
  263. package/esm/src/mail/sender.js +1 -0
  264. package/esm/src/mail/sender.js.map +1 -0
  265. package/esm/src/mail/service.d.ts.map +1 -1
  266. package/esm/src/mail/service.js +6 -7
  267. package/esm/src/mail/service.js.map +1 -0
  268. package/esm/src/mail/types.d.ts.map +1 -1
  269. package/esm/src/mail/types.js +1 -0
  270. package/esm/src/mail/types.js.map +1 -0
  271. package/esm/src/mui/apiKeys.d.ts +10 -11
  272. package/esm/src/mui/apiKeys.d.ts.map +1 -1
  273. package/esm/src/mui/apiKeys.js +83 -214
  274. package/esm/src/mui/apiKeys.js.map +1 -0
  275. package/esm/src/mui/apiKeysView.d.ts +1 -1
  276. package/esm/src/mui/apiKeysView.d.ts.map +1 -1
  277. package/esm/src/mui/apiKeysView.js +11 -9
  278. package/esm/src/mui/apiKeysView.js.map +1 -0
  279. package/esm/src/mui/confirm.d.ts +2 -2
  280. package/esm/src/mui/confirm.d.ts.map +1 -1
  281. package/esm/src/mui/confirm.js +3 -7
  282. package/esm/src/mui/confirm.js.map +1 -0
  283. package/esm/src/mui/mail.d.ts +4 -4
  284. package/esm/src/mui/mail.d.ts.map +1 -1
  285. package/esm/src/mui/mail.js +11 -71
  286. package/esm/src/mui/mail.js.map +1 -0
  287. package/esm/src/mui/mailView.d.ts +1 -1
  288. package/esm/src/mui/mailView.d.ts.map +1 -1
  289. package/esm/src/mui/mailView.js +1 -0
  290. package/esm/src/mui/mailView.js.map +1 -0
  291. package/esm/src/mui/mod.d.ts +0 -1
  292. package/esm/src/mui/mod.d.ts.map +1 -1
  293. package/esm/src/mui/mod.js +1 -0
  294. package/esm/src/mui/mod.js.map +1 -0
  295. package/esm/src/next/apiKeys/mod.d.ts +2 -3
  296. package/esm/src/next/apiKeys/mod.d.ts.map +1 -1
  297. package/esm/src/next/apiKeys/mod.js +6 -5
  298. package/esm/src/next/apiKeys/mod.js.map +1 -0
  299. package/esm/src/next/auth/client.d.ts +0 -1
  300. package/esm/src/next/auth/client.d.ts.map +1 -1
  301. package/esm/src/next/auth/client.js +1 -0
  302. package/esm/src/next/auth/client.js.map +1 -0
  303. package/esm/src/next/auth/config.d.ts.map +1 -1
  304. package/esm/src/next/auth/config.js +11 -17
  305. package/esm/src/next/auth/config.js.map +1 -0
  306. package/esm/src/next/auth/localTestLogin.d.ts.map +1 -1
  307. package/esm/src/next/auth/localTestLogin.js +13 -9
  308. package/esm/src/next/auth/localTestLogin.js.map +1 -0
  309. package/esm/src/next/auth/mod.d.ts.map +1 -1
  310. package/esm/src/next/auth/mod.js +1 -0
  311. package/esm/src/next/auth/mod.js.map +1 -0
  312. package/esm/src/next/auth/server.d.ts +2 -2
  313. package/esm/src/next/auth/server.d.ts.map +1 -1
  314. package/esm/src/next/auth/server.js +1 -0
  315. package/esm/src/next/auth/server.js.map +1 -0
  316. package/esm/src/next/files/mod.d.ts +0 -1
  317. package/esm/src/next/files/mod.d.ts.map +1 -1
  318. package/esm/src/next/files/mod.js +1 -1
  319. package/esm/src/next/files/mod.js.map +1 -0
  320. package/esm/src/next/files/route.d.ts +1 -1
  321. package/esm/src/next/files/route.d.ts.map +1 -1
  322. package/esm/src/next/files/route.js +11 -11
  323. package/esm/src/next/files/route.js.map +1 -0
  324. package/esm/src/next/jobs/list.d.ts +5 -5
  325. package/esm/src/next/jobs/list.d.ts.map +1 -1
  326. package/esm/src/next/jobs/list.js +15 -19
  327. package/esm/src/next/jobs/list.js.map +1 -0
  328. package/esm/src/next/jobs/mod.d.ts.map +1 -1
  329. package/esm/src/next/jobs/mod.js +1 -0
  330. package/esm/src/next/jobs/mod.js.map +1 -0
  331. package/esm/src/next/jobs/paths.d.ts +2 -2
  332. package/esm/src/next/jobs/paths.d.ts.map +1 -1
  333. package/esm/src/next/jobs/paths.js +1 -0
  334. package/esm/src/next/jobs/paths.js.map +1 -0
  335. package/esm/src/next/jobs/route.d.ts +2 -2
  336. package/esm/src/next/jobs/route.d.ts.map +1 -1
  337. package/esm/src/next/jobs/route.js +4 -4
  338. package/esm/src/next/jobs/route.js.map +1 -0
  339. package/esm/src/next/jobs/run.d.ts +2 -2
  340. package/esm/src/next/jobs/run.d.ts.map +1 -1
  341. package/esm/src/next/jobs/run.js +68 -132
  342. package/esm/src/next/jobs/run.js.map +1 -0
  343. package/esm/src/next/jobs/runRequest.d.ts +1 -1
  344. package/esm/src/next/jobs/runRequest.d.ts.map +1 -1
  345. package/esm/src/next/jobs/runRequest.js +3 -4
  346. package/esm/src/next/jobs/runRequest.js.map +1 -0
  347. package/esm/src/next/jobs/stream.d.ts.map +1 -1
  348. package/esm/src/next/jobs/stream.js +1 -0
  349. package/esm/src/next/jobs/stream.js.map +1 -0
  350. package/esm/src/next/mail/mod.d.ts +0 -1
  351. package/esm/src/next/mail/mod.d.ts.map +1 -1
  352. package/esm/src/next/mail/mod.js +1 -1
  353. package/esm/src/next/mail/mod.js.map +1 -0
  354. package/esm/src/next/mail/route.d.ts +2 -2
  355. package/esm/src/next/mail/route.d.ts.map +1 -1
  356. package/esm/src/next/mail/route.js +1 -0
  357. package/esm/src/next/mail/route.js.map +1 -0
  358. package/esm/src/next/pwa/mod.d.ts +0 -4
  359. package/esm/src/next/pwa/mod.d.ts.map +1 -1
  360. package/esm/src/next/pwa/mod.js +32 -16
  361. package/esm/src/next/pwa/mod.js.map +1 -0
  362. package/esm/src/next/pwa/worker.d.ts +0 -1
  363. package/esm/src/next/pwa/worker.d.ts.map +1 -1
  364. package/esm/src/next/pwa/worker.js +1 -0
  365. package/esm/src/next/pwa/worker.js.map +1 -0
  366. package/esm/src/next/secrets/constants.d.ts +3 -0
  367. package/esm/src/next/secrets/constants.d.ts.map +1 -0
  368. package/esm/src/next/secrets/constants.js +3 -0
  369. package/esm/src/next/secrets/constants.js.map +1 -0
  370. package/esm/src/next/secrets/mod.d.ts +1 -3
  371. package/esm/src/next/secrets/mod.d.ts.map +1 -1
  372. package/esm/src/next/secrets/mod.js +6 -7
  373. package/esm/src/next/secrets/mod.js.map +1 -0
  374. package/esm/src/next/sourceDev.d.ts +6 -0
  375. package/esm/src/next/sourceDev.d.ts.map +1 -0
  376. package/esm/src/next/sourceDev.js +41 -0
  377. package/esm/src/next/sourceDev.js.map +1 -0
  378. package/esm/src/secrets/encoding.d.ts.map +1 -1
  379. package/esm/src/secrets/encoding.js +1 -0
  380. package/esm/src/secrets/encoding.js.map +1 -0
  381. package/esm/src/secrets/errors.d.ts.map +1 -1
  382. package/esm/src/secrets/errors.js +3 -7
  383. package/esm/src/secrets/errors.js.map +1 -0
  384. package/esm/src/secrets/fingerprint.d.ts.map +1 -1
  385. package/esm/src/secrets/fingerprint.js +1 -0
  386. package/esm/src/secrets/fingerprint.js.map +1 -0
  387. package/esm/src/secrets/frame.d.ts.map +1 -1
  388. package/esm/src/secrets/frame.js +4 -3
  389. package/esm/src/secrets/frame.js.map +1 -0
  390. package/esm/src/secrets/keyring.d.ts.map +1 -1
  391. package/esm/src/secrets/keyring.js +6 -6
  392. package/esm/src/secrets/keyring.js.map +1 -0
  393. package/esm/src/secrets/legacy.d.ts +0 -1
  394. package/esm/src/secrets/legacy.d.ts.map +1 -1
  395. package/esm/src/secrets/legacy.js +13 -10
  396. package/esm/src/secrets/legacy.js.map +1 -0
  397. package/esm/src/secrets/maintenance.d.ts +0 -1
  398. package/esm/src/secrets/maintenance.d.ts.map +1 -1
  399. package/esm/src/secrets/maintenance.js +9 -24
  400. package/esm/src/secrets/maintenance.js.map +1 -0
  401. package/esm/src/secrets/mod.d.ts +0 -1
  402. package/esm/src/secrets/mod.d.ts.map +1 -1
  403. package/esm/src/secrets/mod.js +1 -1
  404. package/esm/src/secrets/mod.js.map +1 -0
  405. package/esm/src/secrets/secrets.d.ts.map +1 -1
  406. package/esm/src/secrets/secrets.js +38 -30
  407. package/esm/src/secrets/secrets.js.map +1 -0
  408. package/package.json +111 -135
  409. package/skills/loom/SKILL.md +40 -5
  410. package/skills/loom/references/dependency-upgrades.md +4 -0
  411. package/skills/loom/references/esm-package.md +35 -0
  412. package/skills/loom/references/local-development.md +261 -29
  413. package/skills/loom/references/release-safety.md +10 -3
  414. package/skills/loom-auth/references/secrets-and-rotation.md +2 -1
  415. package/skills/loom-mail/SKILL.md +1 -0
  416. package/skills/loom-scaffold/references/greenfield-workflow.md +2 -1
  417. package/skills/upgrade-deps/SKILL.md +4 -2
  418. package/source/bin/loom.ts +50 -0
  419. package/source/mod.ts +10 -0
  420. package/source/src/apiKeys/authorize.ts +294 -0
  421. package/source/src/apiKeys/betterAuth.ts +253 -0
  422. package/source/src/apiKeys/country.ts +7 -0
  423. package/source/src/apiKeys/credentials.ts +171 -0
  424. package/source/src/apiKeys/fingerprint.ts +10 -0
  425. package/{script/src/apiKeys/lifecycle.d.ts → source/src/apiKeys/lifecycle.ts} +21 -23
  426. package/source/src/apiKeys/limits.ts +372 -0
  427. package/source/src/apiKeys/mod.ts +11 -0
  428. package/source/src/apiKeys/permissions.ts +153 -0
  429. package/source/src/apiKeys/policy.ts +189 -0
  430. package/source/src/apiKeys/retention.ts +136 -0
  431. package/source/src/apiKeys/types.ts +288 -0
  432. package/source/src/cli/atomicText.ts +38 -0
  433. package/source/src/cli/bunLocalDev.ts +646 -0
  434. package/source/src/cli/bunProject.ts +433 -0
  435. package/source/src/cli/cliBootstrap.ts +313 -0
  436. package/source/src/cli/externalSkills.ts +315 -0
  437. package/source/src/cli/filesR2Policy.ts +212 -0
  438. package/source/src/cli/generatedBuild.ts +380 -0
  439. package/source/src/cli/generatedCleanup.ts +87 -0
  440. package/source/src/cli/generatedDevLease.ts +52 -0
  441. package/source/src/cli/generatedInstall.ts +630 -0
  442. package/source/src/cli/generatedWorkflow.ts +135 -0
  443. package/{script/src/cli/legacyManagedOutputs.js → source/src/cli/legacyManagedOutputs.ts} +36 -30
  444. package/source/src/cli/localDb.ts +548 -0
  445. package/source/src/cli/localDevLock.ts +462 -0
  446. package/source/src/cli/localDevPackage.ts +754 -0
  447. package/source/src/cli/managedFiles.ts +688 -0
  448. package/source/src/cli/migrationEnv.ts +267 -0
  449. package/source/src/cli/mod.ts +26788 -0
  450. package/source/src/cli/packageTreeSignature.ts +65 -0
  451. package/source/src/cli/processIdentity.ts +38 -0
  452. package/source/src/cli/projectSkills.ts +1102 -0
  453. package/source/src/cli/projectTooling.ts +1140 -0
  454. package/source/src/cli/releaseConfig.ts +36 -0
  455. package/source/src/cli/releaseCredentials.ts +642 -0
  456. package/source/src/cli/releaseTrust.ts +194 -0
  457. package/source/src/cli/releaseTrustCommand.ts +210 -0
  458. package/source/src/cli/sourceConfig.ts +106 -0
  459. package/source/src/cli/sourceDev.ts +1279 -0
  460. package/source/src/cli/vercelBuildEnv.ts +714 -0
  461. package/source/src/cli/vercelEnvMask.ts +182 -0
  462. package/source/src/cli/vercelProjectRelease.ts +807 -0
  463. package/source/src/cli/vercelPulledEnv.ts +174 -0
  464. package/source/src/clientData/identity.ts +229 -0
  465. package/source/src/clientData/mod.ts +1 -0
  466. package/source/src/files/client.ts +75 -0
  467. package/source/src/files/errors.ts +69 -0
  468. package/source/src/files/hash.ts +109 -0
  469. package/source/src/files/memory.ts +158 -0
  470. package/source/src/files/metadata.ts +251 -0
  471. package/source/src/files/mod.ts +8 -0
  472. package/source/src/files/s3.ts +182 -0
  473. package/source/src/files/service.ts +210 -0
  474. package/source/src/files/types.ts +171 -0
  475. package/source/src/jobs/catalog.ts +303 -0
  476. package/source/src/jobs/controller.ts +156 -0
  477. package/source/src/jobs/direct.ts +177 -0
  478. package/source/src/jobs/events.ts +74 -0
  479. package/source/src/jobs/format.ts +233 -0
  480. package/source/src/jobs/http.ts +83 -0
  481. package/source/src/jobs/log.ts +10 -0
  482. package/source/src/jobs/mod.ts +10 -0
  483. package/source/src/jobs/run.ts +141 -0
  484. package/source/src/jobs/sanitize.ts +142 -0
  485. package/source/src/jobs/types.ts +43 -0
  486. package/source/src/mail/errors.ts +77 -0
  487. package/source/src/mail/memory.ts +451 -0
  488. package/source/src/mail/mod.ts +5 -0
  489. package/source/src/mail/postal.ts +363 -0
  490. package/source/src/mail/retry.ts +30 -0
  491. package/source/src/mail/sender.ts +57 -0
  492. package/source/src/mail/service.ts +252 -0
  493. package/source/src/mail/types.ts +229 -0
  494. package/source/src/mui/apiKeys.tsx +1044 -0
  495. package/source/src/mui/apiKeysView.ts +535 -0
  496. package/source/src/mui/confirm.tsx +138 -0
  497. package/source/src/mui/mail.tsx +279 -0
  498. package/source/src/mui/mailView.ts +50 -0
  499. package/source/src/mui/mod.ts +3 -0
  500. package/source/src/next/apiKeys/mod.ts +393 -0
  501. package/{script/src/next/auth/client.d.ts → source/src/next/auth/client.ts} +19 -5
  502. package/source/src/next/auth/config.ts +207 -0
  503. package/source/src/next/auth/localTestLogin.ts +412 -0
  504. package/source/src/next/auth/mod.ts +3 -0
  505. package/source/src/next/auth/server.ts +94 -0
  506. package/source/src/next/files/mod.ts +1 -0
  507. package/source/src/next/files/route.ts +621 -0
  508. package/source/src/next/jobs/list.tsx +90 -0
  509. package/source/src/next/jobs/mod.ts +5 -0
  510. package/source/src/next/jobs/paths.ts +70 -0
  511. package/source/src/next/jobs/route.ts +207 -0
  512. package/source/src/next/jobs/run.tsx +888 -0
  513. package/source/src/next/jobs/runRequest.ts +92 -0
  514. package/source/src/next/jobs/stream.ts +33 -0
  515. package/source/src/next/mail/mod.ts +1 -0
  516. package/source/src/next/mail/route.ts +75 -0
  517. package/source/src/next/pwa/mod.tsx +453 -0
  518. package/source/src/next/pwa/worker.ts +59 -0
  519. package/source/src/next/secrets/constants.ts +2 -0
  520. package/source/src/next/secrets/mod.ts +319 -0
  521. package/source/src/next/sourceDev.ts +50 -0
  522. package/source/src/secrets/encoding.ts +102 -0
  523. package/source/src/secrets/errors.ts +58 -0
  524. package/source/src/secrets/fingerprint.ts +132 -0
  525. package/source/src/secrets/frame.ts +119 -0
  526. package/source/src/secrets/keyring.ts +225 -0
  527. package/source/src/secrets/legacy.ts +244 -0
  528. package/source/src/secrets/maintenance.ts +517 -0
  529. package/source/src/secrets/mod.ts +38 -0
  530. package/source/src/secrets/secrets.ts +926 -0
  531. package/db/databaseTls.test.ts +0 -171
  532. package/db/databaseUrl.test.ts +0 -72
  533. package/db/neonEndpoint.test.ts +0 -51
  534. package/db/testing.test.ts +0 -28
  535. package/deno.json +0 -3
  536. package/esm/_dnt.polyfills.d.ts +0 -166
  537. package/esm/_dnt.polyfills.d.ts.map +0 -1
  538. package/esm/_dnt.polyfills.js +0 -177
  539. package/esm/_dnt.shims.d.ts +0 -2
  540. package/esm/_dnt.shims.d.ts.map +0 -1
  541. package/esm/_dnt.shims.js +0 -57
  542. package/esm/package.json +0 -3
  543. package/script/_dnt.polyfills.d.ts +0 -166
  544. package/script/_dnt.polyfills.d.ts.map +0 -1
  545. package/script/_dnt.polyfills.js +0 -180
  546. package/script/_dnt.shims.d.ts +0 -2
  547. package/script/_dnt.shims.d.ts.map +0 -1
  548. package/script/_dnt.shims.js +0 -60
  549. package/script/bin/loom.d.ts +0 -2
  550. package/script/bin/loom.d.ts.map +0 -1
  551. package/script/bin/loom.js +0 -17
  552. package/script/mod.d.ts +0 -12
  553. package/script/mod.d.ts.map +0 -1
  554. package/script/mod.js +0 -27
  555. package/script/package.json +0 -3
  556. package/script/src/apiKeys/authorize.d.ts +0 -4
  557. package/script/src/apiKeys/authorize.d.ts.map +0 -1
  558. package/script/src/apiKeys/authorize.js +0 -258
  559. package/script/src/apiKeys/betterAuth.d.ts +0 -123
  560. package/script/src/apiKeys/betterAuth.d.ts.map +0 -1
  561. package/script/src/apiKeys/betterAuth.js +0 -169
  562. package/script/src/apiKeys/country.d.ts +0 -3
  563. package/script/src/apiKeys/country.d.ts.map +0 -1
  564. package/script/src/apiKeys/country.js +0 -10
  565. package/script/src/apiKeys/credentials.d.ts +0 -39
  566. package/script/src/apiKeys/credentials.d.ts.map +0 -1
  567. package/script/src/apiKeys/credentials.js +0 -121
  568. package/script/src/apiKeys/fingerprint.d.ts +0 -3
  569. package/script/src/apiKeys/fingerprint.d.ts.map +0 -1
  570. package/script/src/apiKeys/fingerprint.js +0 -8
  571. package/script/src/apiKeys/lifecycle.d.ts.map +0 -1
  572. package/script/src/apiKeys/lifecycle.js +0 -7
  573. package/script/src/apiKeys/limits.d.ts +0 -132
  574. package/script/src/apiKeys/limits.d.ts.map +0 -1
  575. package/script/src/apiKeys/limits.js +0 -254
  576. package/script/src/apiKeys/mod.d.ts +0 -13
  577. package/script/src/apiKeys/mod.d.ts.map +0 -1
  578. package/script/src/apiKeys/mod.js +0 -28
  579. package/script/src/apiKeys/permissions.d.ts +0 -56
  580. package/script/src/apiKeys/permissions.d.ts.map +0 -1
  581. package/script/src/apiKeys/permissions.js +0 -136
  582. package/script/src/apiKeys/policy.d.ts +0 -61
  583. package/script/src/apiKeys/policy.d.ts.map +0 -1
  584. package/script/src/apiKeys/policy.js +0 -94
  585. package/script/src/apiKeys/retention.d.ts +0 -55
  586. package/script/src/apiKeys/retention.d.ts.map +0 -1
  587. package/script/src/apiKeys/retention.js +0 -70
  588. package/script/src/apiKeys/types.d.ts +0 -242
  589. package/script/src/apiKeys/types.d.ts.map +0 -1
  590. package/script/src/apiKeys/types.js +0 -2
  591. package/script/src/cli/externalSkills.d.ts +0 -39
  592. package/script/src/cli/externalSkills.d.ts.map +0 -1
  593. package/script/src/cli/externalSkills.js +0 -204
  594. package/script/src/cli/filesR2Policy.d.ts +0 -33
  595. package/script/src/cli/filesR2Policy.d.ts.map +0 -1
  596. package/script/src/cli/filesR2Policy.js +0 -135
  597. package/script/src/cli/legacyManagedOutputs.d.ts +0 -33
  598. package/script/src/cli/legacyManagedOutputs.d.ts.map +0 -1
  599. package/script/src/cli/localDb.d.ts +0 -28
  600. package/script/src/cli/localDb.d.ts.map +0 -1
  601. package/script/src/cli/localDb.js +0 -370
  602. package/script/src/cli/localDevLock.d.ts +0 -97
  603. package/script/src/cli/localDevLock.d.ts.map +0 -1
  604. package/script/src/cli/localDevLock.js +0 -320
  605. package/script/src/cli/localDevPackage.d.ts +0 -172
  606. package/script/src/cli/localDevPackage.d.ts.map +0 -1
  607. package/script/src/cli/localDevPackage.js +0 -635
  608. package/script/src/cli/managedFiles.d.ts +0 -131
  609. package/script/src/cli/managedFiles.d.ts.map +0 -1
  610. package/script/src/cli/managedFiles.js +0 -536
  611. package/script/src/cli/migrationEnv.d.ts +0 -63
  612. package/script/src/cli/migrationEnv.d.ts.map +0 -1
  613. package/script/src/cli/migrationEnv.js +0 -217
  614. package/script/src/cli/mod.d.ts +0 -581
  615. package/script/src/cli/mod.d.ts.map +0 -1
  616. package/script/src/cli/mod.js +0 -16850
  617. package/script/src/cli/projectSkills.d.ts +0 -109
  618. package/script/src/cli/projectSkills.d.ts.map +0 -1
  619. package/script/src/cli/projectSkills.js +0 -749
  620. package/script/src/cli/projectTooling.d.ts +0 -164
  621. package/script/src/cli/projectTooling.d.ts.map +0 -1
  622. package/script/src/cli/projectTooling.js +0 -847
  623. package/script/src/cli/releaseConfig.d.ts +0 -10
  624. package/script/src/cli/releaseConfig.d.ts.map +0 -1
  625. package/script/src/cli/releaseConfig.js +0 -26
  626. package/script/src/cli/releaseCredentials.d.ts +0 -32
  627. package/script/src/cli/releaseCredentials.d.ts.map +0 -1
  628. package/script/src/cli/releaseCredentials.js +0 -392
  629. package/script/src/cli/releaseTrust.d.ts +0 -39
  630. package/script/src/cli/releaseTrust.d.ts.map +0 -1
  631. package/script/src/cli/releaseTrust.js +0 -130
  632. package/script/src/cli/releaseTrustCommand.d.ts +0 -18
  633. package/script/src/cli/releaseTrustCommand.d.ts.map +0 -1
  634. package/script/src/cli/releaseTrustCommand.js +0 -145
  635. package/script/src/cli/vercelBuildEnv.d.ts +0 -62
  636. package/script/src/cli/vercelBuildEnv.d.ts.map +0 -1
  637. package/script/src/cli/vercelBuildEnv.js +0 -401
  638. package/script/src/cli/vercelProjectRelease.d.ts +0 -38
  639. package/script/src/cli/vercelProjectRelease.d.ts.map +0 -1
  640. package/script/src/cli/vercelProjectRelease.js +0 -607
  641. package/script/src/clientData/identity.d.ts +0 -89
  642. package/script/src/clientData/identity.d.ts.map +0 -1
  643. package/script/src/clientData/identity.js +0 -134
  644. package/script/src/clientData/mod.d.ts +0 -3
  645. package/script/src/clientData/mod.d.ts.map +0 -1
  646. package/script/src/clientData/mod.js +0 -18
  647. package/script/src/files/client.d.ts +0 -29
  648. package/script/src/files/client.d.ts.map +0 -1
  649. package/script/src/files/client.js +0 -45
  650. package/script/src/files/errors.d.ts +0 -37
  651. package/script/src/files/errors.d.ts.map +0 -1
  652. package/script/src/files/errors.js +0 -76
  653. package/script/src/files/hash.d.ts +0 -15
  654. package/script/src/files/hash.d.ts.map +0 -1
  655. package/script/src/files/hash.js +0 -89
  656. package/script/src/files/memory.d.ts +0 -29
  657. package/script/src/files/memory.d.ts.map +0 -1
  658. package/script/src/files/memory.js +0 -113
  659. package/script/src/files/metadata.d.ts +0 -10
  660. package/script/src/files/metadata.d.ts.map +0 -1
  661. package/script/src/files/metadata.js +0 -189
  662. package/script/src/files/mod.d.ts +0 -10
  663. package/script/src/files/mod.d.ts.map +0 -1
  664. package/script/src/files/mod.js +0 -25
  665. package/script/src/files/s3.d.ts +0 -29
  666. package/script/src/files/s3.d.ts.map +0 -1
  667. package/script/src/files/s3.js +0 -110
  668. package/script/src/files/service.d.ts +0 -27
  669. package/script/src/files/service.d.ts.map +0 -1
  670. package/script/src/files/service.js +0 -139
  671. package/script/src/files/types.d.ts +0 -134
  672. package/script/src/files/types.d.ts.map +0 -1
  673. package/script/src/files/types.js +0 -2
  674. package/script/src/jobs/catalog.d.ts +0 -32
  675. package/script/src/jobs/catalog.d.ts.map +0 -1
  676. package/script/src/jobs/catalog.js +0 -223
  677. package/script/src/jobs/controller.d.ts +0 -41
  678. package/script/src/jobs/controller.d.ts.map +0 -1
  679. package/script/src/jobs/controller.js +0 -151
  680. package/script/src/jobs/direct.d.ts +0 -36
  681. package/script/src/jobs/direct.d.ts.map +0 -1
  682. package/script/src/jobs/direct.js +0 -128
  683. package/script/src/jobs/events.d.ts +0 -23
  684. package/script/src/jobs/events.d.ts.map +0 -1
  685. package/script/src/jobs/events.js +0 -50
  686. package/script/src/jobs/format.d.ts +0 -16
  687. package/script/src/jobs/format.d.ts.map +0 -1
  688. package/script/src/jobs/format.js +0 -193
  689. package/script/src/jobs/http.d.ts +0 -22
  690. package/script/src/jobs/http.d.ts.map +0 -1
  691. package/script/src/jobs/http.js +0 -50
  692. package/script/src/jobs/log.d.ts +0 -2
  693. package/script/src/jobs/log.d.ts.map +0 -1
  694. package/script/src/jobs/log.js +0 -13
  695. package/script/src/jobs/mod.d.ts +0 -11
  696. package/script/src/jobs/mod.d.ts.map +0 -1
  697. package/script/src/jobs/mod.js +0 -26
  698. package/script/src/jobs/run.d.ts +0 -39
  699. package/script/src/jobs/run.d.ts.map +0 -1
  700. package/script/src/jobs/run.js +0 -86
  701. package/script/src/jobs/sanitize.d.ts +0 -30
  702. package/script/src/jobs/sanitize.d.ts.map +0 -1
  703. package/script/src/jobs/sanitize.js +0 -97
  704. package/script/src/jobs/types.d.ts +0 -31
  705. package/script/src/jobs/types.d.ts.map +0 -1
  706. package/script/src/jobs/types.js +0 -2
  707. package/script/src/mail/errors.d.ts +0 -33
  708. package/script/src/mail/errors.d.ts.map +0 -1
  709. package/script/src/mail/errors.js +0 -97
  710. package/script/src/mail/memory.d.ts +0 -30
  711. package/script/src/mail/memory.d.ts.map +0 -1
  712. package/script/src/mail/memory.js +0 -345
  713. package/script/src/mail/mod.d.ts +0 -7
  714. package/script/src/mail/mod.d.ts.map +0 -1
  715. package/script/src/mail/mod.js +0 -22
  716. package/script/src/mail/postal.d.ts +0 -57
  717. package/script/src/mail/postal.d.ts.map +0 -1
  718. package/script/src/mail/postal.js +0 -251
  719. package/script/src/mail/retry.d.ts +0 -9
  720. package/script/src/mail/retry.d.ts.map +0 -1
  721. package/script/src/mail/retry.js +0 -22
  722. package/script/src/mail/sender.d.ts +0 -5
  723. package/script/src/mail/sender.d.ts.map +0 -1
  724. package/script/src/mail/sender.js +0 -52
  725. package/script/src/mail/service.d.ts +0 -23
  726. package/script/src/mail/service.d.ts.map +0 -1
  727. package/script/src/mail/service.js +0 -191
  728. package/script/src/mail/types.d.ts +0 -176
  729. package/script/src/mail/types.d.ts.map +0 -1
  730. package/script/src/mail/types.js +0 -2
  731. package/script/src/mui/apiKeys.d.ts +0 -171
  732. package/script/src/mui/apiKeys.d.ts.map +0 -1
  733. package/script/src/mui/apiKeys.js +0 -470
  734. package/script/src/mui/apiKeysView.d.ts +0 -193
  735. package/script/src/mui/apiKeysView.d.ts.map +0 -1
  736. package/script/src/mui/apiKeysView.js +0 -331
  737. package/script/src/mui/confirm.d.ts +0 -12
  738. package/script/src/mui/confirm.d.ts.map +0 -1
  739. package/script/src/mui/confirm.js +0 -85
  740. package/script/src/mui/mail.d.ts +0 -29
  741. package/script/src/mui/mail.d.ts.map +0 -1
  742. package/script/src/mui/mail.js +0 -159
  743. package/script/src/mui/mailView.d.ts +0 -20
  744. package/script/src/mui/mailView.d.ts.map +0 -1
  745. package/script/src/mui/mailView.js +0 -32
  746. package/script/src/mui/mod.d.ts +0 -5
  747. package/script/src/mui/mod.d.ts.map +0 -1
  748. package/script/src/mui/mod.js +0 -20
  749. package/script/src/next/apiKeys/mod.d.ts +0 -71
  750. package/script/src/next/apiKeys/mod.d.ts.map +0 -1
  751. package/script/src/next/apiKeys/mod.js +0 -227
  752. package/script/src/next/auth/client.d.ts.map +0 -1
  753. package/script/src/next/auth/client.js +0 -39
  754. package/script/src/next/auth/config.d.ts +0 -62
  755. package/script/src/next/auth/config.d.ts.map +0 -1
  756. package/script/src/next/auth/config.js +0 -178
  757. package/script/src/next/auth/localTestLogin.d.ts +0 -75
  758. package/script/src/next/auth/localTestLogin.d.ts.map +0 -1
  759. package/script/src/next/auth/localTestLogin.js +0 -291
  760. package/script/src/next/auth/mod.d.ts +0 -4
  761. package/script/src/next/auth/mod.d.ts.map +0 -1
  762. package/script/src/next/auth/mod.js +0 -19
  763. package/script/src/next/auth/server.d.ts +0 -44
  764. package/script/src/next/auth/server.d.ts.map +0 -1
  765. package/script/src/next/auth/server.js +0 -39
  766. package/script/src/next/files/mod.d.ts +0 -3
  767. package/script/src/next/files/mod.d.ts.map +0 -1
  768. package/script/src/next/files/mod.js +0 -18
  769. package/script/src/next/files/route.d.ts +0 -99
  770. package/script/src/next/files/route.d.ts.map +0 -1
  771. package/script/src/next/files/route.js +0 -353
  772. package/script/src/next/jobs/list.d.ts +0 -25
  773. package/script/src/next/jobs/list.d.ts.map +0 -1
  774. package/script/src/next/jobs/list.js +0 -48
  775. package/script/src/next/jobs/mod.d.ts +0 -6
  776. package/script/src/next/jobs/mod.d.ts.map +0 -1
  777. package/script/src/next/jobs/mod.js +0 -21
  778. package/script/src/next/jobs/paths.d.ts +0 -14
  779. package/script/src/next/jobs/paths.d.ts.map +0 -1
  780. package/script/src/next/jobs/paths.js +0 -47
  781. package/script/src/next/jobs/route.d.ts +0 -48
  782. package/script/src/next/jobs/route.d.ts.map +0 -1
  783. package/script/src/next/jobs/route.js +0 -105
  784. package/script/src/next/jobs/run.d.ts +0 -58
  785. package/script/src/next/jobs/run.d.ts.map +0 -1
  786. package/script/src/next/jobs/run.js +0 -592
  787. package/script/src/next/jobs/runRequest.d.ts +0 -19
  788. package/script/src/next/jobs/runRequest.d.ts.map +0 -1
  789. package/script/src/next/jobs/runRequest.js +0 -81
  790. package/script/src/next/jobs/stream.d.ts +0 -3
  791. package/script/src/next/jobs/stream.d.ts.map +0 -1
  792. package/script/src/next/jobs/stream.js +0 -28
  793. package/script/src/next/mail/mod.d.ts +0 -3
  794. package/script/src/next/mail/mod.d.ts.map +0 -1
  795. package/script/src/next/mail/mod.js +0 -18
  796. package/script/src/next/mail/route.d.ts +0 -12
  797. package/script/src/next/mail/route.d.ts.map +0 -1
  798. package/script/src/next/mail/route.js +0 -46
  799. package/script/src/next/pwa/mod.d.ts +0 -112
  800. package/script/src/next/pwa/mod.d.ts.map +0 -1
  801. package/script/src/next/pwa/mod.js +0 -303
  802. package/script/src/next/pwa/worker.d.ts +0 -27
  803. package/script/src/next/pwa/worker.d.ts.map +0 -1
  804. package/script/src/next/pwa/worker.js +0 -33
  805. package/script/src/next/secrets/mod.d.ts +0 -108
  806. package/script/src/next/secrets/mod.d.ts.map +0 -1
  807. package/script/src/next/secrets/mod.js +0 -218
  808. package/script/src/secrets/encoding.d.ts +0 -32
  809. package/script/src/secrets/encoding.d.ts.map +0 -1
  810. package/script/src/secrets/encoding.js +0 -95
  811. package/script/src/secrets/errors.d.ts +0 -45
  812. package/script/src/secrets/errors.d.ts.map +0 -1
  813. package/script/src/secrets/errors.js +0 -45
  814. package/script/src/secrets/fingerprint.d.ts +0 -43
  815. package/script/src/secrets/fingerprint.d.ts.map +0 -1
  816. package/script/src/secrets/fingerprint.js +0 -92
  817. package/script/src/secrets/frame.d.ts +0 -34
  818. package/script/src/secrets/frame.d.ts.map +0 -1
  819. package/script/src/secrets/frame.js +0 -91
  820. package/script/src/secrets/keyring.d.ts +0 -62
  821. package/script/src/secrets/keyring.d.ts.map +0 -1
  822. package/script/src/secrets/keyring.js +0 -202
  823. package/script/src/secrets/legacy.d.ts +0 -60
  824. package/script/src/secrets/legacy.d.ts.map +0 -1
  825. package/script/src/secrets/legacy.js +0 -186
  826. package/script/src/secrets/maintenance.d.ts +0 -173
  827. package/script/src/secrets/maintenance.d.ts.map +0 -1
  828. package/script/src/secrets/maintenance.js +0 -323
  829. package/script/src/secrets/mod.d.ts +0 -6
  830. package/script/src/secrets/mod.d.ts.map +0 -1
  831. package/script/src/secrets/mod.js +0 -24
  832. package/script/src/secrets/secrets.d.ts +0 -192
  833. package/script/src/secrets/secrets.d.ts.map +0 -1
  834. package/script/src/secrets/secrets.js +0 -532
@@ -1,847 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.parseJsonc = parseJsonc;
37
- exports.jsonValuesEqual = jsonValuesEqual;
38
- exports.patchJsonText = patchJsonText;
39
- exports.detectProjectTooling = detectProjectTooling;
40
- exports.readTaskStore = readTaskStore;
41
- exports.denoConfigAsPackageJson = denoConfigAsPackageJson;
42
- exports.readProjectPackageMetadata = readProjectPackageMetadata;
43
- exports.mutateProjectDependencies = mutateProjectDependencies;
44
- exports.mutatePackageJsonOverride = mutatePackageJsonOverride;
45
- exports.mutateDenoLinks = mutateDenoLinks;
46
- exports.readDenoLinks = readDenoLinks;
47
- exports.getTaskCommand = getTaskCommand;
48
- exports.getTaskDependencies = getTaskDependencies;
49
- exports.formatTaskInvocation = formatTaskInvocation;
50
- exports.taskInvokes = taskInvokes;
51
- exports.taskInvokesCommand = taskInvokesCommand;
52
- exports.taskRunsBeforeCommand = taskRunsBeforeCommand;
53
- exports.ensureTask = ensureTask;
54
- exports.ensureTaskPrerequisite = ensureTaskPrerequisite;
55
- exports.ensureTaskFollowup = ensureTaskFollowup;
56
- exports.findTaskConflicts = findTaskConflicts;
57
- const promises_1 = require("node:fs/promises");
58
- const node_path_1 = require("node:path");
59
- const jsoncParserNamespace = __importStar(require("jsonc-parser"));
60
- // A static import, not a lazy createRequire(), so jsonc-parser is part of
61
- // every module graph that reaches these exported helpers. It is UMD without
62
- // an `exports` map: Node's ESM loader exposes its named exports only when
63
- // cjs-module-lexer recognises them, so fall back to the CommonJS object that
64
- // it always provides as `default`.
65
- const jsoncParser = typeof jsoncParserNamespace.modify === "function"
66
- ? jsoncParserNamespace
67
- : jsoncParserNamespace.default;
68
- async function readTextIfExists(path) {
69
- try {
70
- return await (0, promises_1.readFile)(path, "utf8");
71
- }
72
- catch (error) {
73
- if (error.code === "ENOENT")
74
- return null;
75
- throw error;
76
- }
77
- }
78
- /** Parses Deno JSON/JSONC while reporting every syntax error. */
79
- function parseJsonc(text, filename) {
80
- const { parse, printParseErrorCode } = jsoncParser;
81
- const errors = [];
82
- const value = parse(text, errors, {
83
- allowEmptyContent: false,
84
- allowTrailingComma: true,
85
- disallowComments: false,
86
- });
87
- if (errors.length) {
88
- const detail = errors.map((error) => `${printParseErrorCode(error.error)} at offset ${error.offset}`).join(", ");
89
- throw new Error(`Failed to parse ${filename}: ${detail}`);
90
- }
91
- return value;
92
- }
93
- function parseStrictJson(text, filename) {
94
- try {
95
- return JSON.parse(text);
96
- }
97
- catch (error) {
98
- throw new Error(`Failed to parse ${filename}: ${error.message}`);
99
- }
100
- }
101
- function formattingOptions(text) {
102
- const eol = text.includes("\r\n") ? "\r\n" : "\n";
103
- const indentation = text.match(/(?:^|\r?\n)([\t ]+)\S/m)?.[1] ?? " ";
104
- const insertSpaces = !indentation.includes("\t");
105
- return {
106
- eol,
107
- insertFinalNewline: text.endsWith("\n"),
108
- insertSpaces,
109
- keepLines: true,
110
- tabSize: insertSpaces ? Math.max(1, indentation.length) : 1,
111
- };
112
- }
113
- function updateJsonPath(text, path, value) {
114
- const { applyEdits, modify } = jsoncParser;
115
- return applyEdits(text, modify(text, path, value, { formattingOptions: formattingOptions(text) }));
116
- }
117
- function isPlainJsonObject(value) {
118
- return typeof value === "object" && value !== null && !Array.isArray(value);
119
- }
120
- function sortedJson(value) {
121
- if (Array.isArray(value))
122
- return value.map(sortedJson);
123
- if (!isPlainJsonObject(value))
124
- return value;
125
- return Object.fromEntries(Object.keys(value).filter((key) => value[key] !== undefined).sort()
126
- .map((key) => [key, sortedJson(value[key])]));
127
- }
128
- /** Compares JSON data, ignoring object key order and `undefined` members. */
129
- function jsonValuesEqual(left, right) {
130
- return JSON.stringify(sortedJson(left)) === JSON.stringify(sortedJson(right));
131
- }
132
- function collectJsonEdits(current, next, path, edits) {
133
- if (jsonValuesEqual(current, next))
134
- return;
135
- if (isPlainJsonObject(current) && isPlainJsonObject(next)) {
136
- for (const key of Object.keys(current)) {
137
- if (next[key] === undefined)
138
- edits.push([[...path, key], undefined]);
139
- }
140
- for (const [key, value] of Object.entries(next)) {
141
- if (value === undefined)
142
- continue;
143
- if (hasOwn(current, key)) {
144
- collectJsonEdits(current[key], value, [...path, key], edits);
145
- }
146
- else {
147
- edits.push([[...path, key], value]);
148
- }
149
- }
150
- return;
151
- }
152
- edits.push([path, next]);
153
- }
154
- /**
155
- * Rewrites JSON or JSONC text to hold `next` by editing only the members
156
- * whose values changed, so the file keeps its own key order, indentation,
157
- * line layout and comments. New members are appended to their object.
158
- */
159
- function patchJsonText(text, next) {
160
- const edits = [];
161
- collectJsonEdits(parseJsonc(text, "JSON"), next, [], edits);
162
- return edits.reduce((result, [path, value]) => updateJsonPath(result, path, value), text);
163
- }
164
- function hasOwn(value, key) {
165
- return Object.prototype.hasOwnProperty.call(value, key);
166
- }
167
- function definitionsEqual(left, right) {
168
- return JSON.stringify(left) === JSON.stringify(right);
169
- }
170
- function definitionsConflict(left, right) {
171
- if (definitionsEqual(left, right))
172
- return false;
173
- const leftCommand = getTaskCommand(left);
174
- const rightCommand = getTaskCommand(right);
175
- if (leftCommand !== rightCommand)
176
- return true;
177
- const leftDependencies = getTaskDependencies(left);
178
- const rightDependencies = getTaskDependencies(right);
179
- if (JSON.stringify(leftDependencies) !== JSON.stringify(rightDependencies)) {
180
- return true;
181
- }
182
- const executionKeys = ["env", "files", "output"];
183
- return executionKeys.some((key) => JSON.stringify(typeof left === "object" ? left[key] : undefined) !==
184
- JSON.stringify(typeof right === "object" ? right[key] : undefined));
185
- }
186
- function packageManagerFromField(value) {
187
- for (const manager of ["pnpm", "yarn", "npm", "deno"]) {
188
- if (value?.startsWith(`${manager}@`))
189
- return manager;
190
- }
191
- return null;
192
- }
193
- async function detectDependencyManager(cwd, packageJson, denoConfig) {
194
- const declared = packageManagerFromField(packageJson?.packageManager);
195
- if (declared)
196
- return declared;
197
- if (await readTextIfExists((0, node_path_1.join)(cwd, "pnpm-lock.yaml")))
198
- return "pnpm";
199
- if (await readTextIfExists((0, node_path_1.join)(cwd, "yarn.lock")))
200
- return "yarn";
201
- if (await readTextIfExists((0, node_path_1.join)(cwd, "package-lock.json")))
202
- return "npm";
203
- if (denoConfig || await readTextIfExists((0, node_path_1.join)(cwd, "deno.lock"))) {
204
- return "deno";
205
- }
206
- return "npm";
207
- }
208
- function validateRecordedTooling(tooling, available) {
209
- const configs = new Set([
210
- "deno.json",
211
- "deno.jsonc",
212
- "package.json",
213
- ]);
214
- const managers = new Set(["deno", "npm", "pnpm", "yarn"]);
215
- if (!tooling || typeof tooling !== "object" ||
216
- !tooling.tasks || typeof tooling.tasks !== "object" ||
217
- !tooling.dependencies || typeof tooling.dependencies !== "object" ||
218
- !configs.has(tooling.tasks.config) ||
219
- !configs.has(tooling.dependencies.config) ||
220
- !managers.has(tooling.tasks.runner) ||
221
- !managers.has(tooling.dependencies.manager)) {
222
- throw new Error("loom.json records invalid project tooling.");
223
- }
224
- if (!available.has(tooling.tasks.config)) {
225
- throw new Error(`loom.json records missing task config: ${tooling.tasks.config}`);
226
- }
227
- if (!available.has(tooling.dependencies.config)) {
228
- throw new Error(`loom.json records missing dependency config: ${tooling.dependencies.config}`);
229
- }
230
- if (tooling.tasks.config !== "package.json" && tooling.tasks.runner !== "deno") {
231
- throw new Error(`${tooling.tasks.config} tasks must use the deno task runner.`);
232
- }
233
- if (tooling.dependencies.config !== "package.json" &&
234
- tooling.dependencies.manager !== "deno") {
235
- throw new Error(`${tooling.dependencies.config} dependencies must use the deno manager.`);
236
- }
237
- }
238
- /**
239
- * Detects project tooling once during adoption. A recorded Loom choice is
240
- * authoritative on later runs and is validated instead of inferred again.
241
- */
242
- async function detectProjectTooling(cwd, recorded) {
243
- const packageText = await readTextIfExists((0, node_path_1.join)(cwd, "package.json"));
244
- const denoText = await readTextIfExists((0, node_path_1.join)(cwd, "deno.json"));
245
- const denoJsoncText = await readTextIfExists((0, node_path_1.join)(cwd, "deno.jsonc"));
246
- if (denoText !== null && denoJsoncText !== null) {
247
- throw new Error("Both deno.json and deno.jsonc exist. Keep one Deno config or record a single unambiguous project config before running Loom.");
248
- }
249
- if (packageText === null && denoText === null && denoJsoncText === null) {
250
- throw new Error(`No package.json, deno.json, or deno.jsonc found in ${cwd}`);
251
- }
252
- const denoConfigPath = denoText !== null
253
- ? "deno.json"
254
- : denoJsoncText !== null
255
- ? "deno.jsonc"
256
- : null;
257
- const denoConfigText = denoText ?? denoJsoncText;
258
- const packageJson = packageText === null
259
- ? null
260
- : parseStrictJson(packageText, "package.json");
261
- const denoConfig = denoConfigText === null || !denoConfigPath
262
- ? null
263
- : parseJsonc(denoConfigText, denoConfigPath);
264
- const available = new Set();
265
- if (packageText !== null)
266
- available.add("package.json");
267
- if (denoConfigPath)
268
- available.add(denoConfigPath);
269
- if (recorded) {
270
- validateRecordedTooling(recorded, available);
271
- return recorded;
272
- }
273
- const dependencyManager = await detectDependencyManager(cwd, packageJson, denoConfig);
274
- const dependencyConfig = packageJson
275
- ? "package.json"
276
- : denoConfigPath;
277
- const denoOwnsTasks = Boolean(denoConfig && hasOwn(denoConfig, "tasks"));
278
- const taskConfig = denoOwnsTasks || !packageJson
279
- ? denoConfigPath
280
- : "package.json";
281
- const taskRunner = taskConfig === "package.json"
282
- ? dependencyManager
283
- : "deno";
284
- return {
285
- dependencies: {
286
- config: dependencyConfig,
287
- manager: dependencyManager,
288
- },
289
- tasks: {
290
- config: taskConfig,
291
- runner: taskRunner,
292
- },
293
- };
294
- }
295
- /** Reads the task definitions from the recorded authoritative config. */
296
- async function readTaskStore(cwd, tooling) {
297
- const text = await readTextIfExists((0, node_path_1.join)(cwd, tooling.config));
298
- if (text === null) {
299
- throw new Error(`Missing authoritative task config: ${tooling.config}`);
300
- }
301
- if (tooling.config === "package.json") {
302
- const packageJson = parseStrictJson(text, tooling.config);
303
- const definitions = packageJson.scripts ?? {};
304
- validateTaskDefinitions(definitions, tooling.config, false);
305
- return {
306
- config: tooling.config,
307
- definitions,
308
- rootKey: "scripts",
309
- runner: tooling.runner,
310
- text,
311
- };
312
- }
313
- const denoConfig = parseJsonc(text, tooling.config);
314
- const definitions = denoConfig.tasks ?? {};
315
- validateTaskDefinitions(definitions, tooling.config, true);
316
- return {
317
- config: tooling.config,
318
- definitions,
319
- rootKey: "tasks",
320
- runner: tooling.runner,
321
- text,
322
- };
323
- }
324
- function validateTaskDefinitions(definitions, config, allowStructured) {
325
- if (!definitions || typeof definitions !== "object" ||
326
- Array.isArray(definitions)) {
327
- throw new Error(`${config} tasks/scripts must be an object.`);
328
- }
329
- for (const [name, definition] of Object.entries(definitions)) {
330
- if (typeof definition === "string")
331
- continue;
332
- if (!allowStructured || !definition || typeof definition !== "object" ||
333
- Array.isArray(definition)) {
334
- throw new Error(`${config} task '${name}' has an invalid definition.`);
335
- }
336
- const task = definition;
337
- if (task.command !== undefined && typeof task.command !== "string") {
338
- throw new Error(`${config} task '${name}' has a non-string command.`);
339
- }
340
- if (task.dependencies !== undefined &&
341
- (!Array.isArray(task.dependencies) ||
342
- task.dependencies.some((dependency) => typeof dependency !== "string"))) {
343
- throw new Error(`${config} task '${name}' has invalid dependencies.`);
344
- }
345
- }
346
- }
347
- function parseNpmImport(value) {
348
- if (typeof value !== "string")
349
- return undefined;
350
- const match = value.match(/^npm:((?:@[^/]+\/)?[^@/]+)(?:@([^/]+))?(?:\/.*)?$/);
351
- return match ? { name: match[1], version: match[2] ?? "*" } : undefined;
352
- }
353
- /** Projects a Deno import map and task table into Loom's dependency signals. */
354
- function denoConfigAsPackageJson(config) {
355
- const dependencies = {};
356
- for (const value of Object.values(config.imports ?? {})) {
357
- const dependency = parseNpmImport(value);
358
- if (dependency)
359
- dependencies[dependency.name] = dependency.version;
360
- }
361
- const scripts = Object.fromEntries(Object.entries(config.tasks ?? {}).flatMap(([name, definition]) => {
362
- const command = getTaskCommand(definition);
363
- return command ? [[name, command]] : [];
364
- }));
365
- return {
366
- dependencies,
367
- name: config.name,
368
- packageManager: "deno",
369
- scripts,
370
- version: config.version,
371
- };
372
- }
373
- /** Reads package metadata, falling back to Deno imports/tasks for Deno-only projects. */
374
- async function readProjectPackageMetadata(cwd) {
375
- const packageText = await readTextIfExists((0, node_path_1.join)(cwd, "package.json"));
376
- if (packageText !== null) {
377
- return {
378
- config: "package.json",
379
- packageJson: parseStrictJson(packageText, "package.json"),
380
- path: (0, node_path_1.join)(cwd, "package.json"),
381
- };
382
- }
383
- const denoJsonText = await readTextIfExists((0, node_path_1.join)(cwd, "deno.json"));
384
- const denoJsoncText = await readTextIfExists((0, node_path_1.join)(cwd, "deno.jsonc"));
385
- if (denoJsonText !== null && denoJsoncText !== null) {
386
- throw new Error("Both deno.json and deno.jsonc exist.");
387
- }
388
- const config = denoJsonText !== null ? "deno.json" : "deno.jsonc";
389
- const text = denoJsonText ?? denoJsoncText;
390
- if (text === null) {
391
- throw new Error(`No package.json, deno.json, or deno.jsonc found in ${cwd}`);
392
- }
393
- return {
394
- config: config,
395
- packageJson: denoConfigAsPackageJson(parseJsonc(text, config)),
396
- path: (0, node_path_1.join)(cwd, config),
397
- };
398
- }
399
- function npmImport(name, version) {
400
- return `npm:${name}@${version}`;
401
- }
402
- /**
403
- * Applies dependency changes to the recorded dependency owner. Deno projects
404
- * use imports and share one dependency class; package projects retain the
405
- * dependencies/devDependencies distinction.
406
- */
407
- async function mutateProjectDependencies(cwd, tooling, mutation) {
408
- const path = (0, node_path_1.join)(cwd, tooling.config);
409
- const original = await readTextIfExists(path);
410
- if (original === null) {
411
- throw new Error(`Missing authoritative dependency config: ${tooling.config}`);
412
- }
413
- let text = original;
414
- const changedKeys = [];
415
- const removedKeys = [];
416
- if (tooling.config === "package.json") {
417
- let config = parseStrictJson(text, tooling.config);
418
- for (const [field, additions] of [
419
- ["dependencies", mutation.dependencies],
420
- ["devDependencies", mutation.devDependencies],
421
- ]) {
422
- for (const [name, version] of Object.entries(additions ?? {})) {
423
- if (!mutation.replace && config[field]?.[name])
424
- continue;
425
- if (config[field]?.[name] === version)
426
- continue;
427
- text = updateJsonPath(text, [field, name], version);
428
- config = parseStrictJson(text, tooling.config);
429
- changedKeys.push(name);
430
- }
431
- }
432
- for (const name of mutation.remove ?? []) {
433
- for (const field of ["dependencies", "devDependencies"]) {
434
- if (!config[field]?.[name])
435
- continue;
436
- text = updateJsonPath(text, [field, name], undefined);
437
- config = parseStrictJson(text, tooling.config);
438
- removedKeys.push(name);
439
- }
440
- }
441
- }
442
- else {
443
- let config = parseJsonc(text, tooling.config);
444
- const additions = {
445
- ...mutation.devDependencies,
446
- ...mutation.dependencies,
447
- };
448
- for (const [name, version] of Object.entries(additions)) {
449
- const desired = npmImport(name, version);
450
- if (!mutation.replace && config.imports?.[name])
451
- continue;
452
- if (config.imports?.[name] === desired)
453
- continue;
454
- text = updateJsonPath(text, ["imports", name], desired);
455
- config = parseJsonc(text, tooling.config);
456
- changedKeys.push(name);
457
- }
458
- for (const name of mutation.remove ?? []) {
459
- if (!config.imports?.[name])
460
- continue;
461
- text = updateJsonPath(text, ["imports", name], undefined);
462
- config = parseJsonc(text, tooling.config);
463
- removedKeys.push(name);
464
- }
465
- if (config.nodeModulesDir === undefined) {
466
- text = updateJsonPath(text, ["nodeModulesDir"], "auto");
467
- }
468
- }
469
- if (text !== original)
470
- await (0, promises_1.writeFile)(path, text, "utf8");
471
- return {
472
- changed: text !== original,
473
- changedKeys: [...new Set(changedKeys)],
474
- config: tooling.config,
475
- removedKeys: [...new Set(removedKeys)],
476
- };
477
- }
478
- function isPlainObject(value) {
479
- return value !== null && typeof value === "object" && !Array.isArray(value);
480
- }
481
- function getJsonPath(value, path) {
482
- let current = value;
483
- for (const key of path) {
484
- current = isPlainObject(current) ? current[key] : undefined;
485
- }
486
- return current;
487
- }
488
- /**
489
- * Sets, replaces, or (with an undefined value) removes one entry of a
490
- * package.json override map with a minimal text edit that keeps the file's
491
- * formatting. A missing map is created. Removing a map's last entry leaves
492
- * the map in place unless `removeEmptyMap` says the caller created it.
493
- */
494
- async function mutatePackageJsonOverride(cwd, field, name, value, options = {}) {
495
- const path = (0, node_path_1.join)(cwd, "package.json");
496
- const original = await readTextIfExists(path);
497
- if (original === null)
498
- throw new Error("Missing package.json");
499
- const config = parseStrictJson(original, "package.json");
500
- const mapPath = field === "resolutions" ? ["resolutions"] : [
501
- "pnpm",
502
- "overrides",
503
- ];
504
- if (getJsonPath(config, [...mapPath, name]) === value) {
505
- return { changed: false };
506
- }
507
- let editPath = [...mapPath, name];
508
- let editValue = value;
509
- const map = getJsonPath(config, mapPath);
510
- if (value === undefined) {
511
- if (options.removeEmptyMap && isPlainObject(map) &&
512
- Object.keys(map).length === 1) {
513
- editPath = mapPath;
514
- if (options.removeEmptyPnpm && field === "pnpm.overrides" &&
515
- isPlainObject(config.pnpm) && Object.keys(config.pnpm).length === 1) {
516
- editPath = ["pnpm"];
517
- }
518
- }
519
- }
520
- else if (map === undefined) {
521
- if (field === "pnpm.overrides" && config.pnpm === undefined) {
522
- editPath = ["pnpm"];
523
- editValue = { overrides: { [name]: value } };
524
- }
525
- else {
526
- editPath = mapPath;
527
- editValue = { [name]: value };
528
- }
529
- }
530
- const text = editSingleLineObjectEntry(original, editPath.slice(0, -1), editPath[editPath.length - 1], editValue) ?? updateJsonPath(original, editPath, editValue);
531
- if (text !== original)
532
- await (0, promises_1.writeFile)(path, text, "utf8");
533
- return { changed: text !== original };
534
- }
535
- /**
536
- * Appends or removes one entry of an object written on a single line without
537
- * reformatting it, so a compact map such as `{ "a": "1" }` round-trips byte
538
- * for byte (jsonc `modify` would expand it). Returns null when the object is
539
- * missing, spans lines, or the edit is not a plain append or removal.
540
- */
541
- function editSingleLineObjectEntry(text, objectPath, name, value) {
542
- const { findNodeAtLocation, parseTree } = jsoncParser;
543
- const tree = parseTree(text);
544
- const object = tree
545
- ? objectPath.length ? findNodeAtLocation(tree, objectPath) : tree
546
- : undefined;
547
- const properties = object?.type === "object" ? object.children ?? [] : [];
548
- const objectText = object
549
- ? text.slice(object.offset, object.offset + object.length)
550
- : "";
551
- if (!object || object.type !== "object" || objectText.includes("\n")) {
552
- return null;
553
- }
554
- const end = (node) => node.offset + node.length;
555
- const index = properties.findIndex((property) => property.children?.[0]?.value === name);
556
- let edited;
557
- if (value === undefined) {
558
- if (index === -1)
559
- return null;
560
- const property = properties[index];
561
- // Removing the only entry of `{"a":1}` gives back `{}`.
562
- const start = properties.length === 1
563
- ? property.offset
564
- : index > 0
565
- ? end(properties[index - 1])
566
- : property.offset;
567
- const stop = properties.length === 1 || index > 0
568
- ? end(property)
569
- : properties[index + 1].offset;
570
- edited = text.slice(0, start) + text.slice(stop);
571
- }
572
- else if (properties.length === 0) {
573
- if (objectText !== "{}")
574
- return null;
575
- edited = `${text.slice(0, object.offset + 1)}${JSON.stringify(name)}:${JSON.stringify(value)}${text.slice(object.offset + 1)}`;
576
- }
577
- else {
578
- if (index !== -1)
579
- return null;
580
- const last = properties[properties.length - 1];
581
- const [lastKey, lastValue] = last.children ?? [];
582
- if (!lastKey || !lastValue)
583
- return null;
584
- const colon = text.slice(end(lastKey), lastValue.offset);
585
- const separator = properties.length > 1
586
- ? text.slice(end(properties[properties.length - 2]), last.offset)
587
- : /^\{\s/.test(text.slice(object.offset))
588
- ? ", "
589
- : ",";
590
- edited = `${text.slice(0, end(last))}${separator}${JSON.stringify(name)}${colon}${JSON.stringify(value)}${text.slice(end(last))}`;
591
- }
592
- // Keep the textual edit only when it parses to exactly the intended value.
593
- let parsed;
594
- try {
595
- parsed = JSON.parse(edited);
596
- }
597
- catch {
598
- return null;
599
- }
600
- return JSON.stringify(getJsonPath(parsed, [...objectPath, name])) ===
601
- JSON.stringify(value)
602
- ? edited
603
- : null;
604
- }
605
- /** Adds or removes local dependency links in a Deno config. */
606
- async function mutateDenoLinks(cwd, config, mutation) {
607
- const path = (0, node_path_1.join)(cwd, config);
608
- const original = await readTextIfExists(path);
609
- if (original === null)
610
- throw new Error(`Missing Deno config: ${config}`);
611
- const denoConfig = parseJsonc(original, config);
612
- let links = [...(denoConfig.links ?? [])];
613
- const remove = typeof mutation.remove === "string"
614
- ? [mutation.remove]
615
- : mutation.remove ?? [];
616
- links = links.filter((link) => !remove.includes(link));
617
- if (mutation.add && !links.includes(mutation.add))
618
- links.push(mutation.add);
619
- const text = JSON.stringify(links) === JSON.stringify(denoConfig.links ?? [])
620
- ? original
621
- : updateJsonPath(original, ["links"], links.length ? links : undefined);
622
- if (text !== original)
623
- await (0, promises_1.writeFile)(path, text, "utf8");
624
- return { changed: text !== original, links };
625
- }
626
- /** Returns the configured local links without resolving their paths. */
627
- async function readDenoLinks(cwd, config) {
628
- const text = await readTextIfExists((0, node_path_1.join)(cwd, config));
629
- if (text === null)
630
- throw new Error(`Missing Deno config: ${config}`);
631
- return parseJsonc(text, config).links ?? [];
632
- }
633
- /** Returns the executable command portion of either task representation. */
634
- function getTaskCommand(definition) {
635
- if (typeof definition === "string")
636
- return definition;
637
- return typeof definition?.command === "string"
638
- ? definition.command
639
- : undefined;
640
- }
641
- function getTaskDependencies(definition) {
642
- return typeof definition === "object" &&
643
- Array.isArray(definition.dependencies)
644
- ? definition.dependencies.filter((value) => typeof value === "string")
645
- : [];
646
- }
647
- /** Formats a task invocation for the selected project runner. */
648
- function formatTaskInvocation(tasks, name) {
649
- switch (tasks.runner) {
650
- case "deno":
651
- return `deno task ${name}`;
652
- case "npm":
653
- return `npm run ${name}`;
654
- case "pnpm":
655
- return `pnpm ${name}`;
656
- case "yarn":
657
- return `yarn ${name}`;
658
- }
659
- }
660
- function taskInvocationPatterns(name) {
661
- const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
662
- const tail = `(?:[\\s;&|)]|$)`;
663
- return [
664
- new RegExp(`(?:^|[\\s;&|($])deno\\s+task\\s+${escaped}${tail}`),
665
- new RegExp(`(?:^|[\\s;&|($])npm\\s+run\\s+${escaped}${tail}`),
666
- new RegExp(`(?:^|[\\s;&|($])pnpm\\s+(?:run\\s+)?${escaped}${tail}`),
667
- new RegExp(`(?:^|[\\s;&|($])yarn\\s+(?:run\\s+)?${escaped}${tail}`),
668
- ];
669
- }
670
- function commandInvokesTask(command, name) {
671
- return Boolean(command &&
672
- taskInvocationPatterns(name).some((pattern) => pattern.test(command)));
673
- }
674
- /** Checks direct and transitive task references without executing shell code. */
675
- function taskInvokes(store, source, target) {
676
- const visiting = new Set();
677
- const visit = (name) => {
678
- if (name === target)
679
- return true;
680
- if (visiting.has(name))
681
- return false;
682
- visiting.add(name);
683
- const definition = store.definitions[name];
684
- const command = getTaskCommand(definition);
685
- if (commandInvokesTask(command, target))
686
- return true;
687
- if (getTaskDependencies(definition).some(visit))
688
- return true;
689
- return Object.keys(store.definitions).some((candidate) => candidate !== name && commandInvokesTask(command, candidate) &&
690
- visit(candidate));
691
- };
692
- return source !== target && visit(source);
693
- }
694
- /** Checks whether a task, or a task it invokes, contains a command fragment. */
695
- function taskInvokesCommand(store, source, expectedCommand) {
696
- const normalizedExpected = expectedCommand.trim().replace(/\s+/g, " ");
697
- const visiting = new Set();
698
- const visit = (name) => {
699
- if (visiting.has(name))
700
- return false;
701
- visiting.add(name);
702
- const definition = store.definitions[name];
703
- const command = getTaskCommand(definition)?.replace(/\s+/g, " ");
704
- if (command?.includes(normalizedExpected))
705
- return true;
706
- if (getTaskDependencies(definition).some(visit))
707
- return true;
708
- return Object.keys(store.definitions).some((candidate) => candidate !== name && commandInvokesTask(command, candidate) &&
709
- visit(candidate));
710
- };
711
- return normalizedExpected.length > 0 && visit(source);
712
- }
713
- /** Verifies that a task invocation is ordered before a command fragment. */
714
- function taskRunsBeforeCommand(store, source, prerequisite, beforeCommand) {
715
- const definition = store.definitions[source];
716
- const command = getTaskCommand(definition);
717
- if (!command || !command.includes(beforeCommand))
718
- return false;
719
- if (getTaskDependencies(definition).some((dependency) => dependency === prerequisite ||
720
- taskInvokes(store, dependency, prerequisite))) {
721
- return true;
722
- }
723
- const commandIndex = command.indexOf(beforeCommand);
724
- return taskInvocationPatterns(prerequisite).some((pattern) => {
725
- const match = pattern.exec(command);
726
- return match !== null && match.index < commandIndex;
727
- });
728
- }
729
- /** Ensures one task through a localized JSON/JSONC edit. */
730
- async function ensureTask(cwd, tooling, options) {
731
- const store = await readTaskStore(cwd, tooling);
732
- validateTaskDefinitions({ [options.name]: options.definition }, store.config, store.config !== "package.json");
733
- const previous = store.definitions[options.name];
734
- if (previous !== undefined && definitionsEqual(previous, options.definition)) {
735
- return { changed: false, config: store.config, previous, preserved: false };
736
- }
737
- if (previous !== undefined && options.onConflict === "preserve") {
738
- return { changed: false, config: store.config, previous, preserved: true };
739
- }
740
- const text = updateJsonPath(store.text, [store.rootKey, options.name], options.definition);
741
- if (text !== store.text) {
742
- await (0, promises_1.writeFile)((0, node_path_1.join)(cwd, store.config), text, "utf8");
743
- }
744
- return {
745
- changed: text !== store.text,
746
- config: store.config,
747
- previous,
748
- preserved: false,
749
- };
750
- }
751
- /**
752
- * Ensures a prerequisite runs before a named task. Deno tasks use their native
753
- * dependency graph; package scripts receive the runner-specific invocation.
754
- */
755
- async function ensureTaskPrerequisite(cwd, tooling, taskName, prerequisite) {
756
- const store = await readTaskStore(cwd, tooling);
757
- const current = store.definitions[taskName];
758
- if (current === undefined) {
759
- throw new Error(`Cannot compose missing task: ${taskName}`);
760
- }
761
- if (taskInvokes(store, taskName, prerequisite)) {
762
- return { changed: false, config: store.config };
763
- }
764
- let definition;
765
- if (store.config !== "package.json") {
766
- if (typeof current === "string") {
767
- definition = { command: current, dependencies: [prerequisite] };
768
- }
769
- else {
770
- definition = {
771
- ...current,
772
- dependencies: [...getTaskDependencies(current), prerequisite],
773
- };
774
- }
775
- }
776
- else {
777
- const command = getTaskCommand(current);
778
- if (!command)
779
- throw new Error(`Task has no command: ${taskName}`);
780
- definition = `${formatTaskInvocation(tooling, prerequisite)} && (${command})`;
781
- }
782
- const result = await ensureTask(cwd, tooling, {
783
- definition,
784
- name: taskName,
785
- });
786
- return { changed: result.changed, config: result.config };
787
- }
788
- /** Ensures a named task runs after another task's existing command succeeds. */
789
- async function ensureTaskFollowup(cwd, tooling, taskName, followup) {
790
- const store = await readTaskStore(cwd, tooling);
791
- const current = store.definitions[taskName];
792
- if (current === undefined) {
793
- throw new Error(`Cannot compose missing task: ${taskName}`);
794
- }
795
- if (taskInvokes(store, taskName, followup)) {
796
- return { changed: false, config: store.config };
797
- }
798
- const command = getTaskCommand(current);
799
- if (!command)
800
- throw new Error(`Task has no command: ${taskName}`);
801
- const composed = `(${command}) && ${formatTaskInvocation(tooling, followup)}`;
802
- const definition = typeof current === "string"
803
- ? composed
804
- : { ...current, command: composed };
805
- const result = await ensureTask(cwd, tooling, {
806
- definition,
807
- name: taskName,
808
- });
809
- return { changed: result.changed, config: result.config };
810
- }
811
- function delegatesToAuthoritativeDenoTask(primaryConfig, secondaryConfig, name, definition) {
812
- return primaryConfig !== "package.json" &&
813
- secondaryConfig === "package.json" &&
814
- getTaskCommand(definition)?.trim() === `deno task ${name}`;
815
- }
816
- /** Finds duplicate task names that differ and do not delegate to Deno. */
817
- async function findTaskConflicts(cwd, authoritative) {
818
- const primary = await readTaskStore(cwd, authoritative);
819
- const secondaryConfigs = primary.config === "package.json"
820
- ? ["deno.json", "deno.jsonc"]
821
- : ["package.json"];
822
- const conflicts = [];
823
- for (const secondaryConfig of secondaryConfigs) {
824
- const text = await readTextIfExists((0, node_path_1.join)(cwd, secondaryConfig));
825
- if (text === null)
826
- continue;
827
- const secondary = await readTaskStore(cwd, {
828
- config: secondaryConfig,
829
- runner: secondaryConfig === "package.json" ? "npm" : "deno",
830
- });
831
- for (const [name, definition] of Object.entries(primary.definitions)) {
832
- const other = secondary.definitions[name];
833
- if (other === undefined || !definitionsConflict(definition, other) ||
834
- delegatesToAuthoritativeDenoTask(primary.config, secondaryConfig, name, other)) {
835
- continue;
836
- }
837
- conflicts.push({
838
- authoritative: definition,
839
- authoritativeConfig: primary.config,
840
- name,
841
- secondary: other,
842
- secondaryConfig,
843
- });
844
- }
845
- }
846
- return conflicts;
847
- }