@angular/cli 22.2.0 → 22.3.0-next.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 (377) hide show
  1. package/bin/ng.js +7 -10
  2. package/bin/version.js +98 -0
  3. package/index.d.ts +19 -0
  4. package/lib/chunk-5AASRQKS.js +85 -0
  5. package/lib/chunk-A2VIYA2E.js +165 -0
  6. package/lib/chunk-CAZUOCTC.js +225 -0
  7. package/lib/chunk-DHWVZMLH.js +206 -0
  8. package/lib/chunk-FZ5GFCWU.js +483 -0
  9. package/lib/chunk-G7TRU43D.js +42 -0
  10. package/lib/chunk-GHUUJYOY.js +40 -0
  11. package/lib/chunk-JBLF2TH3.js +267 -0
  12. package/lib/chunk-Q67GOPL7.js +380 -0
  13. package/lib/chunk-SN4KY4Z3.js +24 -0
  14. package/lib/chunk-XFL2J3CJ.js +24 -0
  15. package/lib/chunk-XG3HVNIL.js +59 -0
  16. package/lib/chunk-YM7ILCS5.js +2573 -0
  17. package/lib/cli/index.js +353 -105
  18. package/lib/cli-4CMZ6KMR.js +48 -0
  19. package/lib/cli-4Q7DGTBA.js +33 -0
  20. package/lib/cli-6AHY7ADW.js +96 -0
  21. package/lib/cli-A5UAJDO6.js +135 -0
  22. package/lib/cli-ACLGUIBI.js +2531 -0
  23. package/lib/cli-BQRFWIMG.js +35 -0
  24. package/lib/cli-CWICUPZW.js +42 -0
  25. package/lib/cli-DWQUM3M2.js +29 -0
  26. package/lib/cli-L4TM4JH3.js +88 -0
  27. package/lib/cli-LYBZEMDR.js +96 -0
  28. package/lib/cli-PDCEX7HQ.js +605 -0
  29. package/lib/cli-PJVTDBQM.js +51 -0
  30. package/lib/cli-PRIRL3WP.js +185 -0
  31. package/lib/cli-PU5VH7JB.js +189 -0
  32. package/lib/cli-QUH44NUB.js +68 -0
  33. package/lib/cli-VVITNTBC.js +50 -0
  34. package/lib/cli-XM4L4PP4.js +1651 -0
  35. package/lib/cli-Y2ECUR33.js +33 -0
  36. package/lib/cli-YDSMJOSO.js +182 -0
  37. package/lib/color-SJPGXZVA.js +8 -0
  38. package/lib/config/schema.json +210 -6
  39. package/lib/config-QXK7SSVG.js +22 -0
  40. package/lib/init.js +91 -180
  41. package/package.json +20 -15
  42. package/lib/cli/index.d.ts +0 -11
  43. package/lib/cli/index.js.map +0 -1
  44. package/lib/config/workspace-schema.d.ts +0 -1025
  45. package/lib/config/workspace-schema.js +0 -131
  46. package/lib/config/workspace-schema.js.map +0 -1
  47. package/lib/init.d.ts +0 -8
  48. package/lib/init.js.map +0 -1
  49. package/src/analytics/analytics-collector.d.ts +0 -35
  50. package/src/analytics/analytics-collector.js +0 -195
  51. package/src/analytics/analytics-collector.js.map +0 -1
  52. package/src/analytics/analytics-parameters.d.ts +0 -101
  53. package/src/analytics/analytics-parameters.js +0 -107
  54. package/src/analytics/analytics-parameters.js.map +0 -1
  55. package/src/analytics/analytics.d.ts +0 -27
  56. package/src/analytics/analytics.js +0 -183
  57. package/src/analytics/analytics.js.map +0 -1
  58. package/src/command-builder/architect-base-command-module.d.ts +0 -30
  59. package/src/command-builder/architect-base-command-module.js +0 -244
  60. package/src/command-builder/architect-base-command-module.js.map +0 -1
  61. package/src/command-builder/architect-command-module.d.ts +0 -28
  62. package/src/command-builder/architect-command-module.js +0 -218
  63. package/src/command-builder/architect-command-module.js.map +0 -1
  64. package/src/command-builder/command-module.d.ts +0 -73
  65. package/src/command-builder/command-module.js +0 -260
  66. package/src/command-builder/command-module.js.map +0 -1
  67. package/src/command-builder/command-runner.d.ts +0 -9
  68. package/src/command-builder/command-runner.js +0 -202
  69. package/src/command-builder/command-runner.js.map +0 -1
  70. package/src/command-builder/definitions.d.ts +0 -41
  71. package/src/command-builder/definitions.js +0 -20
  72. package/src/command-builder/definitions.js.map +0 -1
  73. package/src/command-builder/schematics-command-module.d.ts +0 -41
  74. package/src/command-builder/schematics-command-module.js +0 -408
  75. package/src/command-builder/schematics-command-module.js.map +0 -1
  76. package/src/command-builder/utilities/command.d.ts +0 -13
  77. package/src/command-builder/utilities/command.js +0 -39
  78. package/src/command-builder/utilities/command.js.map +0 -1
  79. package/src/command-builder/utilities/json-help.d.ts +0 -37
  80. package/src/command-builder/utilities/json-help.js +0 -92
  81. package/src/command-builder/utilities/json-help.js.map +0 -1
  82. package/src/command-builder/utilities/json-schema.d.ts +0 -64
  83. package/src/command-builder/utilities/json-schema.js +0 -349
  84. package/src/command-builder/utilities/json-schema.js.map +0 -1
  85. package/src/command-builder/utilities/normalize-options-middleware.d.ts +0 -18
  86. package/src/command-builder/utilities/normalize-options-middleware.js +0 -37
  87. package/src/command-builder/utilities/normalize-options-middleware.js.map +0 -1
  88. package/src/command-builder/utilities/schematic-engine-host.d.ts +0 -15
  89. package/src/command-builder/utilities/schematic-engine-host.js +0 -179
  90. package/src/command-builder/utilities/schematic-engine-host.js.map +0 -1
  91. package/src/command-builder/utilities/schematic-workflow.d.ts +0 -14
  92. package/src/command-builder/utilities/schematic-workflow.js +0 -70
  93. package/src/command-builder/utilities/schematic-workflow.js.map +0 -1
  94. package/src/commands/add/cli.d.ts +0 -41
  95. package/src/commands/add/cli.js +0 -705
  96. package/src/commands/add/cli.js.map +0 -1
  97. package/src/commands/add/long-description.md +0 -7
  98. package/src/commands/analytics/cli.d.ts +0 -16
  99. package/src/commands/analytics/cli.js +0 -34
  100. package/src/commands/analytics/cli.js.map +0 -1
  101. package/src/commands/analytics/info/cli.d.ts +0 -16
  102. package/src/commands/analytics/info/cli.js +0 -25
  103. package/src/commands/analytics/info/cli.js.map +0 -1
  104. package/src/commands/analytics/long-description.md +0 -20
  105. package/src/commands/analytics/settings/cli.d.ts +0 -35
  106. package/src/commands/analytics/settings/cli.js +0 -54
  107. package/src/commands/analytics/settings/cli.js.map +0 -1
  108. package/src/commands/build/cli.d.ts +0 -16
  109. package/src/commands/build/cli.js +0 -21
  110. package/src/commands/build/cli.js.map +0 -1
  111. package/src/commands/build/long-description.md +0 -18
  112. package/src/commands/cache/clean/cli.d.ts +0 -17
  113. package/src/commands/cache/clean/cli.js +0 -32
  114. package/src/commands/cache/clean/cli.js.map +0 -1
  115. package/src/commands/cache/cli.d.ts +0 -17
  116. package/src/commands/cache/cli.js +0 -36
  117. package/src/commands/cache/cli.js.map +0 -1
  118. package/src/commands/cache/info/cli.d.ts +0 -20
  119. package/src/commands/cache/info/cli.js +0 -139
  120. package/src/commands/cache/info/cli.js.map +0 -1
  121. package/src/commands/cache/long-description.md +0 -53
  122. package/src/commands/cache/settings/cli.d.ts +0 -27
  123. package/src/commands/cache/settings/cli.js +0 -41
  124. package/src/commands/cache/settings/cli.js.map +0 -1
  125. package/src/commands/cache/utilities.d.ts +0 -11
  126. package/src/commands/cache/utilities.js +0 -85
  127. package/src/commands/cache/utilities.js.map +0 -1
  128. package/src/commands/command-config.d.ts +0 -17
  129. package/src/commands/command-config.js +0 -116
  130. package/src/commands/command-config.js.map +0 -1
  131. package/src/commands/completion/cli.d.ts +0 -16
  132. package/src/commands/completion/cli.js +0 -61
  133. package/src/commands/completion/cli.js.map +0 -1
  134. package/src/commands/completion/long-description.md +0 -67
  135. package/src/commands/config/cli.d.ts +0 -24
  136. package/src/commands/config/cli.js +0 -150
  137. package/src/commands/config/cli.js.map +0 -1
  138. package/src/commands/config/long-description.md +0 -13
  139. package/src/commands/deploy/cli.d.ts +0 -17
  140. package/src/commands/deploy/cli.js +0 -38
  141. package/src/commands/deploy/cli.js.map +0 -1
  142. package/src/commands/deploy/long-description.md +0 -22
  143. package/src/commands/e2e/cli.d.ts +0 -18
  144. package/src/commands/e2e/cli.js +0 -42
  145. package/src/commands/e2e/cli.js.map +0 -1
  146. package/src/commands/extract-i18n/cli.d.ts +0 -17
  147. package/src/commands/extract-i18n/cli.js +0 -48
  148. package/src/commands/extract-i18n/cli.js.map +0 -1
  149. package/src/commands/generate/cli.d.ts +0 -47
  150. package/src/commands/generate/cli.js +0 -189
  151. package/src/commands/generate/cli.js.map +0 -1
  152. package/src/commands/lint/cli.d.ts +0 -17
  153. package/src/commands/lint/cli.js +0 -25
  154. package/src/commands/lint/cli.js.map +0 -1
  155. package/src/commands/lint/long-description.md +0 -20
  156. package/src/commands/make-this-awesome/cli.d.ts +0 -17
  157. package/src/commands/make-this-awesome/cli.js +0 -36
  158. package/src/commands/make-this-awesome/cli.js.map +0 -1
  159. package/src/commands/mcp/cli.d.ts +0 -21
  160. package/src/commands/mcp/cli.js +0 -74
  161. package/src/commands/mcp/cli.js.map +0 -1
  162. package/src/commands/mcp/constants.d.ts +0 -10
  163. package/src/commands/mcp/constants.js +0 -16
  164. package/src/commands/mcp/constants.js.map +0 -1
  165. package/src/commands/mcp/devserver.d.ts +0 -85
  166. package/src/commands/mcp/devserver.js +0 -109
  167. package/src/commands/mcp/devserver.js.map +0 -1
  168. package/src/commands/mcp/host.d.ts +0 -103
  169. package/src/commands/mcp/host.js +0 -270
  170. package/src/commands/mcp/host.js.map +0 -1
  171. package/src/commands/mcp/mcp-server.d.ts +0 -38
  172. package/src/commands/mcp/mcp-server.js +0 -176
  173. package/src/commands/mcp/mcp-server.js.map +0 -1
  174. package/src/commands/mcp/resources/ai-tutor.md +0 -822
  175. package/src/commands/mcp/resources/best-practices.md +0 -59
  176. package/src/commands/mcp/resources/instructions.d.ts +0 -9
  177. package/src/commands/mcp/resources/instructions.js +0 -26
  178. package/src/commands/mcp/resources/instructions.js.map +0 -1
  179. package/src/commands/mcp/shared-options.d.ts +0 -12
  180. package/src/commands/mcp/shared-options.js +0 -22
  181. package/src/commands/mcp/shared-options.js.map +0 -1
  182. package/src/commands/mcp/tools/ai-tutor.d.ts +0 -12
  183. package/src/commands/mcp/tools/ai-tutor.js +0 -59
  184. package/src/commands/mcp/tools/ai-tutor.js.map +0 -1
  185. package/src/commands/mcp/tools/best-practices.d.ts +0 -13
  186. package/src/commands/mcp/tools/best-practices.js +0 -196
  187. package/src/commands/mcp/tools/best-practices.js.map +0 -1
  188. package/src/commands/mcp/tools/devserver/devserver-start.d.ts +0 -32
  189. package/src/commands/mcp/tools/devserver/devserver-start.js +0 -110
  190. package/src/commands/mcp/tools/devserver/devserver-start.js.map +0 -1
  191. package/src/commands/mcp/tools/devserver/devserver-stop.d.ts +0 -31
  192. package/src/commands/mcp/tools/devserver/devserver-stop.js +0 -69
  193. package/src/commands/mcp/tools/devserver/devserver-stop.js.map +0 -1
  194. package/src/commands/mcp/tools/devserver/devserver-wait-for-build.d.ts +0 -41
  195. package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js +0 -105
  196. package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js.map +0 -1
  197. package/src/commands/mcp/tools/doc-search.d.ts +0 -21
  198. package/src/commands/mcp/tools/doc-search.js +0 -307
  199. package/src/commands/mcp/tools/doc-search.js.map +0 -1
  200. package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.d.ts +0 -17
  201. package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js +0 -62
  202. package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js.map +0 -1
  203. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.d.ts +0 -12
  204. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js +0 -70
  205. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js.map +0 -1
  206. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.d.ts +0 -12
  207. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js +0 -60
  208. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +0 -1
  209. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.d.ts +0 -15
  210. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js +0 -238
  211. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js.map +0 -1
  212. package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.d.ts +0 -9
  213. package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js +0 -14
  214. package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js.map +0 -1
  215. package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.d.ts +0 -36
  216. package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js +0 -135
  217. package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js.map +0 -1
  218. package/src/commands/mcp/tools/onpush-zoneless-migration/types.d.ts +0 -13
  219. package/src/commands/mcp/tools/onpush-zoneless-migration/types.js +0 -10
  220. package/src/commands/mcp/tools/onpush-zoneless-migration/types.js.map +0 -1
  221. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +0 -16
  222. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +0 -211
  223. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +0 -1
  224. package/src/commands/mcp/tools/projects.d.ts +0 -48
  225. package/src/commands/mcp/tools/projects.js +0 -541
  226. package/src/commands/mcp/tools/projects.js.map +0 -1
  227. package/src/commands/mcp/tools/run-target/build-target-strategy.d.ts +0 -14
  228. package/src/commands/mcp/tools/run-target/build-target-strategy.js +0 -53
  229. package/src/commands/mcp/tools/run-target/build-target-strategy.js.map +0 -1
  230. package/src/commands/mcp/tools/run-target/generic-target-strategy.d.ts +0 -14
  231. package/src/commands/mcp/tools/run-target/generic-target-strategy.js +0 -63
  232. package/src/commands/mcp/tools/run-target/generic-target-strategy.js.map +0 -1
  233. package/src/commands/mcp/tools/run-target/options-serializer.d.ts +0 -13
  234. package/src/commands/mcp/tools/run-target/options-serializer.js +0 -41
  235. package/src/commands/mcp/tools/run-target/options-serializer.js.map +0 -1
  236. package/src/commands/mcp/tools/run-target/run-target.d.ts +0 -34
  237. package/src/commands/mcp/tools/run-target/run-target.js +0 -69
  238. package/src/commands/mcp/tools/run-target/run-target.js.map +0 -1
  239. package/src/commands/mcp/tools/run-target/strategy.d.ts +0 -15
  240. package/src/commands/mcp/tools/run-target/strategy.js +0 -10
  241. package/src/commands/mcp/tools/run-target/strategy.js.map +0 -1
  242. package/src/commands/mcp/tools/run-target/types.d.ts +0 -39
  243. package/src/commands/mcp/tools/run-target/types.js +0 -41
  244. package/src/commands/mcp/tools/run-target/types.js.map +0 -1
  245. package/src/commands/mcp/tools/run-target/unit-test-strategy.d.ts +0 -14
  246. package/src/commands/mcp/tools/run-target/unit-test-strategy.js +0 -56
  247. package/src/commands/mcp/tools/run-target/unit-test-strategy.js.map +0 -1
  248. package/src/commands/mcp/tools/tool-registry.d.ts +0 -40
  249. package/src/commands/mcp/tools/tool-registry.js +0 -40
  250. package/src/commands/mcp/tools/tool-registry.js.map +0 -1
  251. package/src/commands/mcp/utils.d.ts +0 -25
  252. package/src/commands/mcp/utils.js +0 -44
  253. package/src/commands/mcp/utils.js.map +0 -1
  254. package/src/commands/mcp/workspace-utils.d.ts +0 -55
  255. package/src/commands/mcp/workspace-utils.js +0 -181
  256. package/src/commands/mcp/workspace-utils.js.map +0 -1
  257. package/src/commands/new/cli.d.ts +0 -27
  258. package/src/commands/new/cli.js +0 -76
  259. package/src/commands/new/cli.js.map +0 -1
  260. package/src/commands/new/long-description.md +0 -15
  261. package/src/commands/run/cli.d.ts +0 -25
  262. package/src/commands/run/cli.js +0 -89
  263. package/src/commands/run/cli.js.map +0 -1
  264. package/src/commands/run/long-description.md +0 -10
  265. package/src/commands/serve/cli.d.ts +0 -16
  266. package/src/commands/serve/cli.js +0 -20
  267. package/src/commands/serve/cli.js.map +0 -1
  268. package/src/commands/test/cli.d.ts +0 -16
  269. package/src/commands/test/cli.js +0 -21
  270. package/src/commands/test/cli.js.map +0 -1
  271. package/src/commands/test/long-description.md +0 -2
  272. package/src/commands/update/cli.d.ts +0 -50
  273. package/src/commands/update/cli.js +0 -586
  274. package/src/commands/update/cli.js.map +0 -1
  275. package/src/commands/update/long-description.md +0 -22
  276. package/src/commands/update/update-resolver.d.ts +0 -75
  277. package/src/commands/update/update-resolver.js +0 -918
  278. package/src/commands/update/update-resolver.js.map +0 -1
  279. package/src/commands/update/utilities/cli-version.d.ts +0 -48
  280. package/src/commands/update/utilities/cli-version.js +0 -196
  281. package/src/commands/update/utilities/cli-version.js.map +0 -1
  282. package/src/commands/update/utilities/constants.d.ts +0 -12
  283. package/src/commands/update/utilities/constants.js +0 -16
  284. package/src/commands/update/utilities/constants.js.map +0 -1
  285. package/src/commands/update/utilities/git.d.ts +0 -36
  286. package/src/commands/update/utilities/git.js +0 -148
  287. package/src/commands/update/utilities/git.js.map +0 -1
  288. package/src/commands/update/utilities/migration.d.ts +0 -32
  289. package/src/commands/update/utilities/migration.js +0 -271
  290. package/src/commands/update/utilities/migration.js.map +0 -1
  291. package/src/commands/version/cli.d.ts +0 -36
  292. package/src/commands/version/cli.js +0 -117
  293. package/src/commands/version/cli.js.map +0 -1
  294. package/src/commands/version/version-info.d.ts +0 -46
  295. package/src/commands/version/version-info.js +0 -101
  296. package/src/commands/version/version-info.js.map +0 -1
  297. package/src/package-managers/discovery.d.ts +0 -23
  298. package/src/package-managers/discovery.js +0 -104
  299. package/src/package-managers/discovery.js.map +0 -1
  300. package/src/package-managers/error.d.ts +0 -43
  301. package/src/package-managers/error.js +0 -41
  302. package/src/package-managers/error.js.map +0 -1
  303. package/src/package-managers/factory.d.ts +0 -30
  304. package/src/package-managers/factory.js +0 -137
  305. package/src/package-managers/factory.js.map +0 -1
  306. package/src/package-managers/host.d.ts +0 -86
  307. package/src/package-managers/host.js +0 -91
  308. package/src/package-managers/host.js.map +0 -1
  309. package/src/package-managers/index.d.ts +0 -13
  310. package/src/package-managers/index.js +0 -17
  311. package/src/package-managers/index.js.map +0 -1
  312. package/src/package-managers/logger.d.ts +0 -27
  313. package/src/package-managers/logger.js +0 -10
  314. package/src/package-managers/logger.js.map +0 -1
  315. package/src/package-managers/package-manager-descriptor.d.ts +0 -269
  316. package/src/package-managers/package-manager-descriptor.js +0 -210
  317. package/src/package-managers/package-manager-descriptor.js.map +0 -1
  318. package/src/package-managers/package-manager.d.ts +0 -200
  319. package/src/package-managers/package-manager.js +0 -720
  320. package/src/package-managers/package-manager.js.map +0 -1
  321. package/src/package-managers/package-metadata.d.ts +0 -91
  322. package/src/package-managers/package-metadata.js +0 -10
  323. package/src/package-managers/package-metadata.js.map +0 -1
  324. package/src/package-managers/package-tree.d.ts +0 -23
  325. package/src/package-managers/package-tree.js +0 -10
  326. package/src/package-managers/package-tree.js.map +0 -1
  327. package/src/package-managers/parsers.d.ts +0 -167
  328. package/src/package-managers/parsers.js +0 -674
  329. package/src/package-managers/parsers.js.map +0 -1
  330. package/src/utilities/color.d.ts +0 -23
  331. package/src/utilities/color.js +0 -41
  332. package/src/utilities/color.js.map +0 -1
  333. package/src/utilities/completion.d.ts +0 -30
  334. package/src/utilities/completion.js +0 -270
  335. package/src/utilities/completion.js.map +0 -1
  336. package/src/utilities/config.d.ts +0 -38
  337. package/src/utilities/config.js +0 -368
  338. package/src/utilities/config.js.map +0 -1
  339. package/src/utilities/environment-options.d.ts +0 -25
  340. package/src/utilities/environment-options.js +0 -60
  341. package/src/utilities/environment-options.js.map +0 -1
  342. package/src/utilities/eol.d.ts +0 -20
  343. package/src/utilities/eol.js +0 -35
  344. package/src/utilities/eol.js.map +0 -1
  345. package/src/utilities/error.d.ts +0 -18
  346. package/src/utilities/error.js +0 -41
  347. package/src/utilities/error.js.map +0 -1
  348. package/src/utilities/find-up.d.ts +0 -21
  349. package/src/utilities/find-up.js +0 -67
  350. package/src/utilities/find-up.js.map +0 -1
  351. package/src/utilities/json-file.d.ts +0 -24
  352. package/src/utilities/json-file.js +0 -179
  353. package/src/utilities/json-file.js.map +0 -1
  354. package/src/utilities/log-file.d.ts +0 -13
  355. package/src/utilities/log-file.js +0 -28
  356. package/src/utilities/log-file.js.map +0 -1
  357. package/src/utilities/memoize.d.ts +0 -15
  358. package/src/utilities/memoize.js +0 -64
  359. package/src/utilities/memoize.js.map +0 -1
  360. package/src/utilities/node-version.d.ts +0 -21
  361. package/src/utilities/node-version.js +0 -65
  362. package/src/utilities/node-version.js.map +0 -1
  363. package/src/utilities/prettier.d.ts +0 -19
  364. package/src/utilities/prettier.js +0 -105
  365. package/src/utilities/prettier.js.map +0 -1
  366. package/src/utilities/project.d.ts +0 -8
  367. package/src/utilities/project.js +0 -81
  368. package/src/utilities/project.js.map +0 -1
  369. package/src/utilities/prompt.d.ts +0 -17
  370. package/src/utilities/prompt.js +0 -90
  371. package/src/utilities/prompt.js.map +0 -1
  372. package/src/utilities/tty.d.ts +0 -16
  373. package/src/utilities/tty.js +0 -23
  374. package/src/utilities/tty.js.map +0 -1
  375. package/src/utilities/version.d.ts +0 -16
  376. package/src/utilities/version.js +0 -26
  377. package/src/utilities/version.js.map +0 -1
@@ -1,674 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.parseNpmLikeDependencies = parseNpmLikeDependencies;
11
- exports.parseYarnClassicDependencies = parseYarnClassicDependencies;
12
- exports.parseNpmLikeManifest = parseNpmLikeManifest;
13
- exports.parseNpmLikeMetadata = parseNpmLikeMetadata;
14
- exports.parseYarnClassicManifest = parseYarnClassicManifest;
15
- exports.parseYarnClassicMetadata = parseYarnClassicMetadata;
16
- exports.parseNpmLikeError = parseNpmLikeError;
17
- exports.parseYarnClassicError = parseYarnClassicError;
18
- exports.parseBunDependencies = parseBunDependencies;
19
- exports.parseYarnModernDependencies = parseYarnModernDependencies;
20
- exports.parsePnpmReleaseAge = parsePnpmReleaseAge;
21
- exports.parseYarnReleaseAge = parseYarnReleaseAge;
22
- exports.parseNpmBeforeDate = parseNpmBeforeDate;
23
- /**
24
- * @fileoverview This file contains the parser functions that are used to
25
- * interpret the output of various package manager commands. Separating these
26
- * into their own file improves modularity and allows for focused testing.
27
- */
28
- const semver_1 = require("semver");
29
- const MAX_LOG_LENGTH = 1024;
30
- function logStdout(stdout, logger) {
31
- if (!logger) {
32
- return;
33
- }
34
- let output = stdout;
35
- if (output.length > MAX_LOG_LENGTH) {
36
- output = `${output.slice(0, MAX_LOG_LENGTH)}... (truncated)`;
37
- }
38
- logger.debug(` stdout:\n${output}`);
39
- }
40
- /**
41
- * A generator function that parses a string containing JSONL (newline-delimited JSON)
42
- * and yields each successfully parsed JSON object.
43
- * @param output The string output to parse.
44
- * @param logger An optional logger instance.
45
- */
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
- function* parseJsonLines(output, logger) {
48
- for (const line of output.split('\n')) {
49
- if (!line.trim()) {
50
- continue;
51
- }
52
- try {
53
- yield JSON.parse(line);
54
- }
55
- catch (e) {
56
- logger?.debug(` Ignoring non-JSON line: ${e}`);
57
- }
58
- }
59
- }
60
- function parseNpmLikeDependencies(stdout, logger, options) {
61
- logger?.debug(`Parsing npm-like dependency list...`);
62
- logStdout(stdout, logger);
63
- const dependencies = new Map();
64
- if (!stdout) {
65
- logger?.debug(' stdout is empty. No dependencies found.');
66
- return dependencies;
67
- }
68
- const data = JSON.parse(stdout);
69
- const workspacePackageName = options?.workspacePackageName;
70
- let rootProject;
71
- let subProject;
72
- if (Array.isArray(data)) {
73
- rootProject = data[0];
74
- if (workspacePackageName) {
75
- subProject = data.find((project) => project?.name === workspacePackageName);
76
- }
77
- }
78
- else {
79
- rootProject = data;
80
- }
81
- if (!rootProject || typeof rootProject !== 'object') {
82
- return dependencies;
83
- }
84
- // 1. Extract subproject dependencies first to prioritize them
85
- if (subProject) {
86
- const subprojectMaps = [
87
- subProject.dependencies,
88
- subProject.devDependencies,
89
- subProject.unsavedDependencies,
90
- ].filter((d) => !!d);
91
- for (const subprojectMap of subprojectMaps) {
92
- for (const [name, info] of Object.entries(subprojectMap)) {
93
- if (info && typeof info === 'object' && info.version) {
94
- dependencies.set(name, {
95
- name,
96
- version: info.version,
97
- path: info.path,
98
- });
99
- }
100
- }
101
- }
102
- }
103
- else if (workspacePackageName) {
104
- // Fallback to npm-like nested lookup inside the root project
105
- const rootDependencyMaps = [
106
- rootProject.dependencies,
107
- rootProject.devDependencies,
108
- rootProject.unsavedDependencies,
109
- ].filter((d) => !!d);
110
- for (const dependencyMap of rootDependencyMaps) {
111
- const info = dependencyMap[workspacePackageName];
112
- if (info && typeof info === 'object') {
113
- const nestedMaps = [
114
- info.dependencies,
115
- info.devDependencies,
116
- info.unsavedDependencies,
117
- ].filter((d) => !!d);
118
- for (const nestedMap of nestedMaps) {
119
- for (const [name, nestedInfo] of Object.entries(nestedMap)) {
120
- if (nestedInfo && typeof nestedInfo === 'object' && nestedInfo.version) {
121
- dependencies.set(name, {
122
- name,
123
- version: nestedInfo.version,
124
- path: nestedInfo.path,
125
- });
126
- }
127
- }
128
- }
129
- }
130
- }
131
- }
132
- // 2. Supplement with hoisted/root dependencies (without overwriting subproject dependencies)
133
- const rootDependencyMaps = [
134
- rootProject.dependencies,
135
- rootProject.devDependencies,
136
- rootProject.unsavedDependencies,
137
- ].filter((d) => !!d);
138
- for (const dependencyMap of rootDependencyMaps) {
139
- for (const [name, info] of Object.entries(dependencyMap)) {
140
- if (!info || typeof info !== 'object') {
141
- continue;
142
- }
143
- // Exclude local monorepo workspace packages (which originate from a local file/dir
144
- // and contain nested dependency maps in the output of `npm list --depth=0`),
145
- // while preserving third-party packages installed from local paths.
146
- const isWorkspacePackage = info.resolved?.startsWith('file:') &&
147
- (!!info.dependencies || !!info.devDependencies || !!info.unsavedDependencies);
148
- if (info.version && !dependencies.has(name) && !isWorkspacePackage) {
149
- dependencies.set(name, {
150
- name,
151
- version: info.version,
152
- path: info.path,
153
- });
154
- }
155
- }
156
- }
157
- logger?.debug(` Found ${dependencies.size} dependencies.`);
158
- return dependencies;
159
- }
160
- /**
161
- * Parses the output of `yarn list` (classic).
162
- *
163
- * The expected output is a JSON stream (JSONL), where each line is a JSON object.
164
- * The relevant object has a `type` of `'tree'` with a `data` property.
165
- * Yarn classic does not provide a path, so the `path` property will be `undefined`.
166
- *
167
- * ```json
168
- * {"type":"tree","data":{"trees":[{"name":"@angular/cli@18.0.0","children":[]}]}}
169
- * ```
170
- *
171
- * @param stdout The standard output of the command.
172
- * @param logger An optional logger instance.
173
- * @returns A map of package names to their installed package details.
174
- */
175
- function parseYarnClassicDependencies(stdout, logger) {
176
- logger?.debug(`Parsing yarn classic dependency list...`);
177
- logStdout(stdout, logger);
178
- const dependencies = new Map();
179
- if (!stdout) {
180
- logger?.debug(' stdout is empty. No dependencies found.');
181
- return dependencies;
182
- }
183
- for (const json of parseJsonLines(stdout, logger)) {
184
- if (json.type === 'tree' && json.data?.trees) {
185
- for (const info of json.data.trees) {
186
- const lastAtIndex = info.name.lastIndexOf('@');
187
- const name = info.name.slice(0, lastAtIndex);
188
- const version = info.name.slice(lastAtIndex + 1);
189
- dependencies.set(name, {
190
- name,
191
- version,
192
- });
193
- }
194
- }
195
- }
196
- logger?.debug(` Found ${dependencies.size} dependencies.`);
197
- return dependencies;
198
- }
199
- function isValidManifest(obj) {
200
- if (typeof obj !== 'object' || obj === null) {
201
- return false;
202
- }
203
- const { name, version } = obj;
204
- return typeof name === 'string' && typeof version === 'string' && (0, semver_1.valid)(version) !== null;
205
- }
206
- function isValidMetadata(obj) {
207
- if (typeof obj !== 'object' || obj === null) {
208
- return false;
209
- }
210
- const { name, versions, 'dist-tags': distTags } = obj;
211
- return (typeof name === 'string' &&
212
- Array.isArray(versions) &&
213
- typeof distTags === 'object' &&
214
- distTags !== null);
215
- }
216
- /**
217
- * Parses the output of `npm view` or a compatible command to get a package manifest.
218
- * @param stdout The standard output of the command.
219
- * @param logger An optional logger instance.
220
- * @returns The package manifest object.
221
- */
222
- function parseNpmLikeManifest(stdout, logger) {
223
- logger?.debug(`Parsing npm-like manifest...`);
224
- logStdout(stdout, logger);
225
- if (!stdout) {
226
- logger?.debug(' stdout is empty. No manifest found.');
227
- return null;
228
- }
229
- const result = JSON.parse(stdout);
230
- // npm view returns an array of manifests if the query matches multiple versions
231
- // (e.g. when using a version range). We find the highest version to ensure
232
- // we get the latest relevant manifest, even if the output is not sorted.
233
- if (Array.isArray(result)) {
234
- let maxManifest = null;
235
- for (const manifest of result) {
236
- if (!isValidManifest(manifest)) {
237
- logger?.debug(' Skipping invalid manifest in array (missing name, version, or invalid SemVer).');
238
- continue;
239
- }
240
- if (!maxManifest || (0, semver_1.compare)(manifest.version, maxManifest.version) > 0) {
241
- maxManifest = manifest;
242
- }
243
- }
244
- if (!maxManifest) {
245
- logger?.debug(' No valid manifests found in the array.');
246
- }
247
- return maxManifest;
248
- }
249
- if (!isValidManifest(result)) {
250
- logger?.debug(' Parsed JSON is not a valid manifest (missing name, version, or invalid SemVer).');
251
- return null;
252
- }
253
- return result;
254
- }
255
- /**
256
- * Parses the output of `npm view` or a compatible command to get package metadata.
257
- * @param stdout The standard output of the command.
258
- * @param logger An optional logger instance.
259
- * @returns The package metadata object.
260
- */
261
- function parseNpmLikeMetadata(stdout, logger) {
262
- logger?.debug(`Parsing npm-like metadata...`);
263
- logStdout(stdout, logger);
264
- if (!stdout) {
265
- logger?.debug(' stdout is empty. No metadata found.');
266
- return null;
267
- }
268
- const result = JSON.parse(stdout);
269
- // npm 12+ `npm view --json` always returns an array of objects.
270
- if (Array.isArray(result)) {
271
- for (const item of result) {
272
- if (isValidMetadata(item)) {
273
- return item;
274
- }
275
- }
276
- logger?.debug(' No valid metadata found in the array.');
277
- return null;
278
- }
279
- if (!isValidMetadata(result)) {
280
- logger?.debug(' Parsed JSON is not valid metadata (missing name, versions, or dist-tags).');
281
- return null;
282
- }
283
- return result;
284
- }
285
- /**
286
- * Parses the output of `yarn info` (classic) to get a package manifest.
287
- *
288
- * When `yarn info --verbose` is used, the output is a JSONL stream. This function
289
- * iterates through the lines to find the object with `type: 'inspect'` which contains
290
- * the package manifest.
291
- *
292
- * For non-verbose output, it falls back to parsing a single JSON object.
293
- *
294
- * @param stdout The standard output of the command.
295
- * @param logger An optional logger instance.
296
- * @returns The package manifest object, or `null` if not found.
297
- */
298
- function parseYarnClassicManifest(stdout, logger) {
299
- logger?.debug(`Parsing yarn classic manifest...`);
300
- logStdout(stdout, logger);
301
- if (!stdout) {
302
- logger?.debug(' stdout is empty. No manifest found.');
303
- return null;
304
- }
305
- // Yarn classic outputs JSONL. We need to find the relevant object.
306
- let manifest;
307
- for (const json of parseJsonLines(stdout, logger)) {
308
- // The manifest data is in a JSON object with type 'inspect'.
309
- if (json.type === 'inspect' && json.data) {
310
- manifest = json.data;
311
- break;
312
- }
313
- }
314
- if (!manifest) {
315
- logger?.debug(' Failed to find manifest in yarn classic output.');
316
- return null;
317
- }
318
- // Yarn classic removes any field with a falsy value
319
- // https://github.com/yarnpkg/yarn/blob/7cafa512a777048ce0b666080a24e80aae3d66a9/src/cli/commands/info.js#L26-L29
320
- // Add a default of 'false' for the `save` field when the `ng-add` object is present but does not have any fields.
321
- // There is a small chance this causes an incorrect value. However, the use of `ng-add` is rare and, in the cases
322
- // it is used, save is set to either a `false` literal or a truthy value. Special cases can be added for specific
323
- // packages if discovered.
324
- if (manifest['ng-add'] &&
325
- typeof manifest['ng-add'] === 'object' &&
326
- Object.keys(manifest['ng-add']).length === 0) {
327
- manifest['ng-add'].save ??= false;
328
- }
329
- if (!isValidManifest(manifest)) {
330
- logger?.debug(' Parsed JSON is not a valid manifest (missing name, version, or invalid SemVer).');
331
- return null;
332
- }
333
- return manifest;
334
- }
335
- /**
336
- * Parses the output of `yarn info` (classic) to get package metadata.
337
- * @param stdout The standard output of the command.
338
- * @param logger An optional logger instance.
339
- * @returns The package metadata object.
340
- */
341
- function parseYarnClassicMetadata(stdout, logger) {
342
- logger?.debug(`Parsing yarn classic metadata...`);
343
- logStdout(stdout, logger);
344
- if (!stdout) {
345
- logger?.debug(' stdout is empty. No metadata found.');
346
- return null;
347
- }
348
- // Yarn classic outputs JSONL. We need to find the relevant object.
349
- let metadata;
350
- for (const json of parseJsonLines(stdout, logger)) {
351
- // The metadata data is in a JSON object with type 'inspect'.
352
- if (json.type === 'inspect' && json.data) {
353
- metadata = json.data;
354
- break;
355
- }
356
- }
357
- if (!metadata) {
358
- logger?.debug(' Failed to find metadata in yarn classic output.');
359
- return null;
360
- }
361
- return metadata;
362
- }
363
- /**
364
- * Parses the `stdout` or `stderr` output of npm, pnpm, modern yarn, or bun to extract structured error information.
365
- *
366
- * This parser uses a multi-stage approach. It first attempts to parse the entire `output` as a
367
- * single JSON object, which is the standard for modern tools like pnpm, yarn, and bun. If JSON
368
- * parsing fails, it falls back to a line-by-line regex-based approach to handle the plain
369
- * text output from older versions of npm.
370
- *
371
- * Example JSON output (pnpm):
372
- * ```json
373
- * {
374
- * "code": "E404",
375
- * "summary": "Not Found - GET https://registry.npmjs.org/@angular%2fnon-existent - Not found",
376
- * "detail": "The requested resource '@angular/non-existent@*' could not be found or you do not have permission to access it."
377
- * }
378
- * ```
379
- *
380
- * Example text output (npm):
381
- * ```
382
- * npm error code E404
383
- * npm error 404 Not Found - GET https://registry.npmjs.org/@angular%2fnon-existent - Not found
384
- * ```
385
- *
386
- * @param output The standard output or standard error of the command.
387
- * @param logger An optional logger instance.
388
- * @returns An `ErrorInfo` object if parsing is successful, otherwise `null`.
389
- */
390
- function parseNpmLikeError(output, logger) {
391
- logger?.debug(`Parsing npm-like error output...`);
392
- logStdout(output, logger); // Log output for debugging purposes
393
- if (!output) {
394
- logger?.debug(' output is empty. No error found.');
395
- return null;
396
- }
397
- // Attempt to parse as JSON first (common for pnpm, modern yarn, bun, npm 12)
398
- try {
399
- let jsonError = JSON.parse(output);
400
- if (Array.isArray(jsonError)) {
401
- jsonError = jsonError[0];
402
- }
403
- if (jsonError && typeof jsonError === 'object' && 'error' in jsonError) {
404
- jsonError = jsonError.error;
405
- }
406
- if (jsonError &&
407
- typeof jsonError.code === 'string' &&
408
- (typeof jsonError.summary === 'string' || typeof jsonError.message === 'string')) {
409
- const summary = jsonError.summary || jsonError.message;
410
- logger?.debug(` Successfully parsed JSON error with code '${jsonError.code}'.`);
411
- return {
412
- code: jsonError.code,
413
- summary,
414
- detail: jsonError.detail,
415
- };
416
- }
417
- }
418
- catch (e) {
419
- logger?.debug(` Failed to parse output as JSON: ${e}. Attempting regex fallback.`);
420
- // Fallback to regex for plain text errors (common for npm)
421
- }
422
- // Regex for npm-like error codes (e.g., `npm ERR! code E404` or `npm error code E404`)
423
- const errorCodeMatch = output.match(/npm (ERR!|error) code (E\d{3}|[A-Z_]+)/);
424
- if (errorCodeMatch) {
425
- const code = errorCodeMatch[2]; // Capture group 2 is the actual error code
426
- let summary;
427
- // Find the most descriptive summary line (the line after `npm ERR! code ...` or `npm error code ...`).
428
- for (const line of output.split('\n')) {
429
- if (line.startsWith('npm ERR!') && !line.includes(' code ')) {
430
- summary = line.replace('npm ERR! ', '').trim();
431
- break;
432
- }
433
- else if (line.startsWith('npm error') && !line.includes(' code ')) {
434
- summary = line.replace('npm error ', '').trim();
435
- break;
436
- }
437
- }
438
- logger?.debug(` Successfully parsed text error with code '${code}'.`);
439
- return {
440
- code,
441
- summary: summary || `Package manager error: ${code}`,
442
- };
443
- }
444
- logger?.debug(' Failed to parse npm-like error. No structured error found.');
445
- return null;
446
- }
447
- /**
448
- * Parses the `stdout` or `stderr` output of yarn classic to extract structured error information.
449
- *
450
- * This parser first attempts to find an HTTP status code (e.g., 404, 401) in the verbose output.
451
- * If found, it returns a standardized error code (`E${statusCode}`).
452
- * If no HTTP status code is found, it falls back to parsing generic JSON error lines.
453
- *
454
- * Example verbose output (with HTTP status code):
455
- * ```json
456
- * {"type":"verbose","data":"Request \"https://registry.npmjs.org/@angular%2fnon-existent\" finished with status code 404."}
457
- * ```
458
- *
459
- * Example generic JSON error output:
460
- * ```json
461
- * {"type":"error","data":"Received invalid response from npm."}
462
- * ```
463
- *
464
- * @param output The standard output or standard error of the command.
465
- * @param logger An optional logger instance.
466
- * @returns An `ErrorInfo` object if parsing is successful, otherwise `null`.
467
- */
468
- function parseYarnClassicError(output, logger) {
469
- logger?.debug(`Parsing yarn classic error output...`);
470
- logStdout(output, logger); // Log output for debugging purposes
471
- if (!output) {
472
- logger?.debug(' output is empty. No error found.');
473
- return null;
474
- }
475
- // First, check for any HTTP status code in the verbose output.
476
- const statusCodeMatch = output.match(/finished with status code (\d{3})/);
477
- if (statusCodeMatch) {
478
- const statusCode = Number(statusCodeMatch[1]);
479
- // Status codes in the 200-299 range are successful.
480
- if (statusCode < 200 || statusCode >= 300) {
481
- logger?.debug(` Detected HTTP error status code '${statusCode}' in verbose output.`);
482
- return {
483
- code: `E${statusCode}`,
484
- summary: `Request failed with status code ${statusCode}.`,
485
- };
486
- }
487
- }
488
- // Fallback to the JSON error type if no HTTP status code is present.
489
- for (const json of parseJsonLines(output, logger)) {
490
- if (json.type === 'error' && typeof json.data === 'string') {
491
- const summary = json.data;
492
- logger?.debug(` Successfully parsed generic yarn classic error.`);
493
- return {
494
- code: 'UNKNOWN_ERROR',
495
- summary,
496
- };
497
- }
498
- }
499
- logger?.debug(' Failed to parse yarn classic error. No structured error found.');
500
- return null;
501
- }
502
- /**
503
- * Parses the output of `bun pm ls`.
504
- *
505
- * Bun does not support JSON output for `pm ls`. The output is a tree structure:
506
- * ```
507
- * /path/to/project node_modules (1084)
508
- * ├── @angular/core@20.3.15
509
- * ├── rxjs @7.8.2
510
- * └── zone.js @0.15.1
511
- * ```
512
- *
513
- * @param stdout The standard output of the command.
514
- * @param logger An optional logger instance.
515
- * @returns A map of package names to their installed package details.
516
- */
517
- function parseBunDependencies(stdout, logger) {
518
- logger?.debug('Parsing Bun dependency list...');
519
- logStdout(stdout, logger);
520
- const dependencies = new Map();
521
- if (!stdout) {
522
- return dependencies;
523
- }
524
- const lines = stdout.split('\n');
525
- // Skip the first line (project info)
526
- for (let i = 1; i < lines.length; i++) {
527
- const line = lines[i].trim();
528
- if (!line) {
529
- continue;
530
- }
531
- // Remove tree structure characters
532
- const cleanLine = line.replace(/^[└├]──\s*/, '');
533
- // Parse name and version
534
- // Scoped: @angular/core@20.3.15
535
- // Unscoped: rxjs @7.8.2
536
- const match = cleanLine.match(/^(.+?)\s?@([^@\s]+)$/);
537
- if (match) {
538
- const name = match[1];
539
- const version = match[2];
540
- dependencies.set(name, { name, version });
541
- }
542
- }
543
- logger?.debug(` Found ${dependencies.size} dependencies.`);
544
- return dependencies;
545
- }
546
- /**
547
- * Parses the output of `yarn info --name-only --json`.
548
- *
549
- * The expected output is a JSON stream (JSONL) of strings.
550
- * Each string represents a package locator.
551
- *
552
- * ```
553
- * "karma@npm:6.4.4"
554
- * "@angular/core@npm:20.3.15"
555
- * ```
556
- *
557
- * @param stdout The standard output of the command.
558
- * @param logger An optional logger instance.
559
- * @returns A map of package names to their installed package details.
560
- */
561
- function parseYarnModernDependencies(stdout, logger) {
562
- logger?.debug('Parsing Yarn Berry dependency list...');
563
- logStdout(stdout, logger);
564
- const dependencies = new Map();
565
- if (!stdout) {
566
- return dependencies;
567
- }
568
- for (const json of parseJsonLines(stdout, logger)) {
569
- if (typeof json === 'string') {
570
- const match = json.match(/^(@?[^@]+)@(.+)$/);
571
- if (match) {
572
- const name = match[1];
573
- let version = match[2];
574
- // Handle "npm:" prefix
575
- if (version.startsWith('npm:')) {
576
- version = version.slice(4);
577
- }
578
- // Handle complex locators with embedded version metadata (e.g., "patch:...", "virtual:...")
579
- // Yarn Berry often appends metadata like "::version=x.y.z"
580
- const versionParamMatch = version.match(/::version=([^&]+)/);
581
- if (versionParamMatch) {
582
- version = versionParamMatch[1];
583
- }
584
- dependencies.set(name, { name, version });
585
- }
586
- }
587
- }
588
- logger?.debug(` Found ${dependencies.size} dependencies.`);
589
- return dependencies;
590
- }
591
- /**
592
- * Parses the output of the pnpm minimum-release-age config command.
593
- * @param output The string output to parse (in minutes).
594
- * @param version The active package manager version string.
595
- * @returns The duration in milliseconds.
596
- */
597
- function parsePnpmReleaseAge(output, version) {
598
- const value = output.trim();
599
- // If the setting is empty, or undefined/null string placeholder, no age limit is active.
600
- if (!value || value === 'undefined' || value === 'null') {
601
- // Starting with pnpm version 11, the default value for minimum-release-age is 24 hours (1440 minutes).
602
- // In prior versions, it defaulted to 0.
603
- const major = parseInt(version.split('.')[0], 10);
604
- if (major >= 11) {
605
- return 1440 * 60000;
606
- }
607
- return 0;
608
- }
609
- // PNPM config outputs duration values without a unit as minutes (e.g. 1440).
610
- const minutes = parseInt(value, 10);
611
- return isNaN(minutes) ? 0 : minutes * 60000;
612
- }
613
- /**
614
- * Parses the output of the yarn npmMinimalAgeGate config command.
615
- * @param output The string output to parse (duration string or minutes).
616
- * @returns The duration in milliseconds.
617
- */
618
- function parseYarnReleaseAge(output, version) {
619
- const value = output.trim();
620
- // If the setting is empty, or undefined/null string placeholder, no age limit is active.
621
- if (!value || value === 'undefined' || value === 'null') {
622
- // Starting with yarn version 4, the default value for minimum-release-age is 24 hours (1440 minutes).
623
- // In prior versions, it defaulted to 0.
624
- const major = parseInt(version.split('.')[0], 10);
625
- if (major >= 4) {
626
- return 1440 * 60000;
627
- }
628
- return 0;
629
- }
630
- // Parse Yarn duration format (e.g. "3d", "24h") or a raw minute value.
631
- const match = value.match(/^(\d+)(ms|s|m|h|d|w)?$/);
632
- if (!match) {
633
- return 0;
634
- }
635
- const amount = parseInt(match[1], 10);
636
- const unit = match[2];
637
- if (unit) {
638
- switch (unit) {
639
- case 'ms':
640
- return amount;
641
- case 's':
642
- return amount * 1000;
643
- case 'm':
644
- return amount * 60000;
645
- case 'h':
646
- return amount * 3600000;
647
- case 'd':
648
- return amount * 86400000;
649
- case 'w':
650
- return amount * 604800000;
651
- }
652
- }
653
- // Yarn unit-less config value is always minutes.
654
- return amount * 60000;
655
- }
656
- /**
657
- * Parses the output of the npm before config option.
658
- * Converts the absolute cutoff date into a relative age in milliseconds.
659
- * @param output The date string to parse.
660
- * @returns The age in milliseconds.
661
- */
662
- function parseNpmBeforeDate(output) {
663
- const trimmed = output.trim();
664
- if (!trimmed || trimmed === 'null' || trimmed === 'undefined') {
665
- return 0;
666
- }
667
- const parsedDate = Date.parse(trimmed);
668
- if (isNaN(parsedDate)) {
669
- return 0;
670
- }
671
- const age = Date.now() - parsedDate;
672
- return age > 0 ? age : 0;
673
- }
674
- //# sourceMappingURL=parsers.js.map