renovate 44.17.0 → 44.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (456) hide show
  1. package/dist/config/migrations/custom/ignore-npmrc-file-migration.js +2 -1
  2. package/dist/config/migrations/custom/ignore-npmrc-file-migration.js.map +1 -1
  3. package/dist/config/migrations/custom/stability-days-migration.js +1 -3
  4. package/dist/config/migrations/custom/stability-days-migration.js.map +1 -1
  5. package/dist/config/options/index.js +1 -1
  6. package/dist/config/options/index.js.map +1 -1
  7. package/dist/config/secrets.js +2 -1
  8. package/dist/config/secrets.js.map +1 -1
  9. package/dist/config/validation.js +1 -3
  10. package/dist/config/validation.js.map +1 -1
  11. package/dist/config-validator.js +2 -1
  12. package/dist/config-validator.js.map +1 -1
  13. package/dist/expose.js.map +1 -1
  14. package/dist/global-config-option-defaults.generated.js +1 -1
  15. package/dist/global-config-option-defaults.generated.js.map +1 -1
  16. package/dist/modules/datasource/artifactory/index.js +2 -1
  17. package/dist/modules/datasource/artifactory/index.js.map +1 -1
  18. package/dist/modules/datasource/aws-eks-addon/index.js +2 -1
  19. package/dist/modules/datasource/aws-eks-addon/index.js.map +1 -1
  20. package/dist/modules/datasource/aws-machine-image/index.js +3 -2
  21. package/dist/modules/datasource/aws-machine-image/index.js.map +1 -1
  22. package/dist/modules/datasource/bazel/index.js +2 -1
  23. package/dist/modules/datasource/bazel/index.js.map +1 -1
  24. package/dist/modules/datasource/bitbucket-server-tags/index.js +4 -2
  25. package/dist/modules/datasource/bitbucket-server-tags/index.js.map +1 -1
  26. package/dist/modules/datasource/bitbucket-tags/index.js +2 -1
  27. package/dist/modules/datasource/bitbucket-tags/index.js.map +1 -1
  28. package/dist/modules/datasource/bitrise/index.js +2 -1
  29. package/dist/modules/datasource/bitrise/index.js.map +1 -1
  30. package/dist/modules/datasource/common.js +4 -2
  31. package/dist/modules/datasource/common.js.map +1 -1
  32. package/dist/modules/datasource/crate/index.js +12 -5
  33. package/dist/modules/datasource/crate/index.js.map +1 -1
  34. package/dist/modules/datasource/custom/formats/toml.js +2 -1
  35. package/dist/modules/datasource/custom/formats/toml.js.map +1 -1
  36. package/dist/modules/datasource/custom/formats/yaml.js +4 -2
  37. package/dist/modules/datasource/custom/formats/yaml.js.map +1 -1
  38. package/dist/modules/datasource/deb/checksum.js +2 -1
  39. package/dist/modules/datasource/deb/checksum.js.map +1 -1
  40. package/dist/modules/datasource/deb/packages.js +3 -1
  41. package/dist/modules/datasource/deb/packages.js.map +1 -1
  42. package/dist/modules/datasource/deno/index.js +2 -1
  43. package/dist/modules/datasource/deno/index.js.map +1 -1
  44. package/dist/modules/datasource/docker/common.js +3 -2
  45. package/dist/modules/datasource/docker/common.js.map +1 -1
  46. package/dist/modules/datasource/docker/dockerhub-cache.js +1 -1
  47. package/dist/modules/datasource/docker/dockerhub-cache.js.map +1 -1
  48. package/dist/modules/datasource/docker/index.js +11 -10
  49. package/dist/modules/datasource/docker/index.js.map +1 -1
  50. package/dist/modules/datasource/forgejo-tags/index.js +4 -2
  51. package/dist/modules/datasource/forgejo-tags/index.js.map +1 -1
  52. package/dist/modules/datasource/galaxy-collection/index.js +5 -3
  53. package/dist/modules/datasource/galaxy-collection/index.js.map +1 -1
  54. package/dist/modules/datasource/git-refs/base.js +2 -1
  55. package/dist/modules/datasource/git-refs/base.js.map +1 -1
  56. package/dist/modules/datasource/git-refs/index.js +1 -1
  57. package/dist/modules/datasource/git-refs/index.js.map +1 -1
  58. package/dist/modules/datasource/gitea-tags/index.js +4 -2
  59. package/dist/modules/datasource/gitea-tags/index.js.map +1 -1
  60. package/dist/modules/datasource/github-release-attachments/index.js +3 -2
  61. package/dist/modules/datasource/github-release-attachments/index.js.map +1 -1
  62. package/dist/modules/datasource/github-tags/index.js +1 -1
  63. package/dist/modules/datasource/github-tags/index.js.map +1 -1
  64. package/dist/modules/datasource/gitlab-tags/index.js +2 -1
  65. package/dist/modules/datasource/gitlab-tags/index.js.map +1 -1
  66. package/dist/modules/datasource/gitlab-tags/util.js +2 -1
  67. package/dist/modules/datasource/gitlab-tags/util.js.map +1 -1
  68. package/dist/modules/datasource/go/releases-goproxy.js +8 -5
  69. package/dist/modules/datasource/go/releases-goproxy.js.map +1 -1
  70. package/dist/modules/datasource/jenkins-plugins/index.js +1 -1
  71. package/dist/modules/datasource/jenkins-plugins/index.js.map +1 -1
  72. package/dist/modules/datasource/jsr/index.js +2 -1
  73. package/dist/modules/datasource/jsr/index.js.map +1 -1
  74. package/dist/modules/datasource/maven/index.js +3 -2
  75. package/dist/modules/datasource/maven/index.js.map +1 -1
  76. package/dist/modules/datasource/maven/util.js +1 -1
  77. package/dist/modules/datasource/maven/util.js.map +1 -1
  78. package/dist/modules/datasource/nuget/v2.js +3 -2
  79. package/dist/modules/datasource/nuget/v2.js.map +1 -1
  80. package/dist/modules/datasource/nuget/v3.js +9 -5
  81. package/dist/modules/datasource/nuget/v3.js.map +1 -1
  82. package/dist/modules/datasource/packagist/index.js +7 -4
  83. package/dist/modules/datasource/packagist/index.js.map +1 -1
  84. package/dist/modules/datasource/rpm/providers/common.js +3 -1
  85. package/dist/modules/datasource/rpm/providers/common.js.map +1 -1
  86. package/dist/modules/datasource/rpm/repomd.js +2 -1
  87. package/dist/modules/datasource/rpm/repomd.js.map +1 -1
  88. package/dist/modules/datasource/ruby-version/index.js +2 -1
  89. package/dist/modules/datasource/ruby-version/index.js.map +1 -1
  90. package/dist/modules/datasource/rubygems/metadata-cache.js +1 -1
  91. package/dist/modules/datasource/rubygems/metadata-cache.js.map +1 -1
  92. package/dist/modules/datasource/sbt-package/index.js +8 -5
  93. package/dist/modules/datasource/sbt-package/index.js.map +1 -1
  94. package/dist/modules/datasource/sbt-package/util.js +2 -1
  95. package/dist/modules/datasource/sbt-package/util.js.map +1 -1
  96. package/dist/modules/datasource/terraform-module/index.js +4 -2
  97. package/dist/modules/datasource/terraform-module/index.js.map +1 -1
  98. package/dist/modules/datasource/terraform-module/utils.js +2 -1
  99. package/dist/modules/datasource/terraform-module/utils.js.map +1 -1
  100. package/dist/modules/datasource/terraform-provider/index.js +2 -1
  101. package/dist/modules/datasource/terraform-provider/index.js.map +1 -1
  102. package/dist/modules/datasource/typst/schema.js +4 -2
  103. package/dist/modules/datasource/typst/schema.js.map +1 -1
  104. package/dist/modules/manager/ansible-galaxy/collections.js +2 -2
  105. package/dist/modules/manager/ansible-galaxy/collections.js.map +1 -1
  106. package/dist/modules/manager/ansible-galaxy/extract.js +5 -3
  107. package/dist/modules/manager/ansible-galaxy/extract.js.map +1 -1
  108. package/dist/modules/manager/bazel/artifacts.js +1 -1
  109. package/dist/modules/manager/bazel/artifacts.js.map +1 -1
  110. package/dist/modules/manager/bazel/parser.js +1 -1
  111. package/dist/modules/manager/bazel/parser.js.map +1 -1
  112. package/dist/modules/manager/bazel/rules/index.js +7 -2
  113. package/dist/modules/manager/bazel/rules/index.js.map +1 -1
  114. package/dist/modules/manager/bazel-module/extract.js +2 -1
  115. package/dist/modules/manager/bazel-module/extract.js.map +1 -1
  116. package/dist/modules/manager/bazel-module/parser/extension-tags.js +3 -2
  117. package/dist/modules/manager/bazel-module/parser/extension-tags.js.map +1 -1
  118. package/dist/modules/manager/bazel-module/rules.js +1 -3
  119. package/dist/modules/manager/bazel-module/rules.js.map +1 -1
  120. package/dist/modules/manager/bitbucket-pipelines/extract.js +5 -3
  121. package/dist/modules/manager/bitbucket-pipelines/extract.js.map +1 -1
  122. package/dist/modules/manager/buildkite/extract.js +1 -1
  123. package/dist/modules/manager/buildkite/extract.js.map +1 -1
  124. package/dist/modules/manager/bun/extract.js +2 -1
  125. package/dist/modules/manager/bun/extract.js.map +1 -1
  126. package/dist/modules/manager/bundler/artifacts.js +3 -2
  127. package/dist/modules/manager/bundler/artifacts.js.map +1 -1
  128. package/dist/modules/manager/cargo/artifacts.js +3 -2
  129. package/dist/modules/manager/cargo/artifacts.js.map +1 -1
  130. package/dist/modules/manager/cocoapods/artifacts.js +2 -1
  131. package/dist/modules/manager/cocoapods/artifacts.js.map +1 -1
  132. package/dist/modules/manager/composer/update-locked.js +1 -1
  133. package/dist/modules/manager/composer/update-locked.js.map +1 -1
  134. package/dist/modules/manager/conan/artifacts.js +4 -2
  135. package/dist/modules/manager/conan/artifacts.js.map +1 -1
  136. package/dist/modules/manager/custom/jsonata/index.js +1 -3
  137. package/dist/modules/manager/custom/jsonata/index.js.map +1 -1
  138. package/dist/modules/manager/custom/jsonata/utils.js +1 -3
  139. package/dist/modules/manager/custom/jsonata/utils.js.map +1 -1
  140. package/dist/modules/manager/custom/regex/index.js +1 -3
  141. package/dist/modules/manager/custom/regex/index.js.map +1 -1
  142. package/dist/modules/manager/custom/regex/strategies.js +7 -6
  143. package/dist/modules/manager/custom/regex/strategies.js.map +1 -1
  144. package/dist/modules/manager/custom/regex/utils.js +1 -3
  145. package/dist/modules/manager/custom/regex/utils.js.map +1 -1
  146. package/dist/modules/manager/docker-compose/extract.js +2 -2
  147. package/dist/modules/manager/docker-compose/extract.js.map +1 -1
  148. package/dist/modules/manager/droneci/extract.js +1 -1
  149. package/dist/modules/manager/droneci/extract.js.map +1 -1
  150. package/dist/modules/manager/flux/artifacts.js +5 -3
  151. package/dist/modules/manager/flux/artifacts.js.map +1 -1
  152. package/dist/modules/manager/flux/extract.js +2 -6
  153. package/dist/modules/manager/flux/extract.js.map +1 -1
  154. package/dist/modules/manager/git-submodules/extract.js +5 -4
  155. package/dist/modules/manager/git-submodules/extract.js.map +1 -1
  156. package/dist/modules/manager/github-actions/extract.js +2 -1
  157. package/dist/modules/manager/github-actions/extract.js.map +1 -1
  158. package/dist/modules/manager/gitlabci/extract.js +1 -1
  159. package/dist/modules/manager/gitlabci/extract.js.map +1 -1
  160. package/dist/modules/manager/gitlabci/schema.js +2 -1
  161. package/dist/modules/manager/gitlabci/schema.js.map +1 -1
  162. package/dist/modules/manager/gitlabci-include/extract.js +1 -1
  163. package/dist/modules/manager/gitlabci-include/extract.js.map +1 -1
  164. package/dist/modules/manager/gleam/artifacts.js +2 -1
  165. package/dist/modules/manager/gleam/artifacts.js.map +1 -1
  166. package/dist/modules/manager/gomod/artifacts.js +2 -1
  167. package/dist/modules/manager/gomod/artifacts.js.map +1 -1
  168. package/dist/modules/manager/gradle/artifacts.js +3 -1
  169. package/dist/modules/manager/gradle/artifacts.js.map +1 -1
  170. package/dist/modules/manager/gradle/extract/catalog.js +3 -1
  171. package/dist/modules/manager/gradle/extract/catalog.js.map +1 -1
  172. package/dist/modules/manager/gradle/extract/consistent-versions-plugin.js +2 -1
  173. package/dist/modules/manager/gradle/extract/consistent-versions-plugin.js.map +1 -1
  174. package/dist/modules/manager/gradle/extract.js +4 -2
  175. package/dist/modules/manager/gradle/extract.js.map +1 -1
  176. package/dist/modules/manager/gradle/parser/handlers.js +4 -2
  177. package/dist/modules/manager/gradle/parser/handlers.js.map +1 -1
  178. package/dist/modules/manager/gradle/parser/registry-urls.js +3 -2
  179. package/dist/modules/manager/gradle/parser/registry-urls.js.map +1 -1
  180. package/dist/modules/manager/gradle-wrapper/utils.js +2 -1
  181. package/dist/modules/manager/gradle-wrapper/utils.js.map +1 -1
  182. package/dist/modules/manager/helm-values/extract.js +1 -1
  183. package/dist/modules/manager/helm-values/extract.js.map +1 -1
  184. package/dist/modules/manager/helmfile/utils.js +3 -2
  185. package/dist/modules/manager/helmfile/utils.js.map +1 -1
  186. package/dist/modules/manager/helmsman/extract.js +1 -1
  187. package/dist/modules/manager/helmsman/extract.js.map +1 -1
  188. package/dist/modules/manager/helmv3/artifacts.js +3 -2
  189. package/dist/modules/manager/helmv3/artifacts.js.map +1 -1
  190. package/dist/modules/manager/jenkins/extract.js +1 -1
  191. package/dist/modules/manager/jenkins/extract.js.map +1 -1
  192. package/dist/modules/manager/jsonnet-bundler/artifacts.js +1 -1
  193. package/dist/modules/manager/jsonnet-bundler/artifacts.js.map +1 -1
  194. package/dist/modules/manager/kustomize/artifacts.js +3 -4
  195. package/dist/modules/manager/kustomize/artifacts.js.map +1 -1
  196. package/dist/modules/manager/kustomize/extract.js +1 -1
  197. package/dist/modules/manager/kustomize/extract.js.map +1 -1
  198. package/dist/modules/manager/leiningen/extract.js +2 -1
  199. package/dist/modules/manager/leiningen/extract.js.map +1 -1
  200. package/dist/modules/manager/maven/extract.js +6 -6
  201. package/dist/modules/manager/maven/extract.js.map +1 -1
  202. package/dist/modules/manager/maven-wrapper/artifacts.js +4 -1
  203. package/dist/modules/manager/maven-wrapper/artifacts.js.map +1 -1
  204. package/dist/modules/manager/meteor/extract.js +1 -1
  205. package/dist/modules/manager/meteor/extract.js.map +1 -1
  206. package/dist/modules/manager/mix/artifacts.js +2 -1
  207. package/dist/modules/manager/mix/artifacts.js.map +1 -1
  208. package/dist/modules/manager/nix/extract.js +0 -1
  209. package/dist/modules/manager/nix/extract.js.map +1 -1
  210. package/dist/modules/manager/npm/artifacts.js +2 -1
  211. package/dist/modules/manager/npm/artifacts.js.map +1 -1
  212. package/dist/modules/manager/npm/extract/common/package-file.js +1 -1
  213. package/dist/modules/manager/npm/extract/common/package-file.js.map +1 -1
  214. package/dist/modules/manager/npm/extract/pnpm.js +2 -1
  215. package/dist/modules/manager/npm/extract/pnpm.js.map +1 -1
  216. package/dist/modules/manager/npm/extract/yarn.js +3 -2
  217. package/dist/modules/manager/npm/extract/yarn.js.map +1 -1
  218. package/dist/modules/manager/npm/post-update/index.js +9 -7
  219. package/dist/modules/manager/npm/post-update/index.js.map +1 -1
  220. package/dist/modules/manager/npm/post-update/npm.js +7 -4
  221. package/dist/modules/manager/npm/post-update/npm.js.map +1 -1
  222. package/dist/modules/manager/npm/post-update/pnpm.js +1 -1
  223. package/dist/modules/manager/npm/post-update/pnpm.js.map +1 -1
  224. package/dist/modules/manager/npm/update/dependency/index.js +2 -1
  225. package/dist/modules/manager/npm/update/dependency/index.js.map +1 -1
  226. package/dist/modules/manager/npm/update/index.js +5 -0
  227. package/dist/modules/manager/npm/update/index.js.map +1 -0
  228. package/dist/modules/manager/npm/update/locked-dependency/common/parent-version.js +1 -1
  229. package/dist/modules/manager/npm/update/locked-dependency/common/parent-version.js.map +1 -1
  230. package/dist/modules/manager/npm/update/locked-dependency/package-lock/index.js +21 -16
  231. package/dist/modules/manager/npm/update/locked-dependency/package-lock/index.js.map +1 -1
  232. package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/get-locked.js +2 -2
  233. package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/get-locked.js.map +1 -1
  234. package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/index.js +1 -1
  235. package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/index.js.map +1 -1
  236. package/dist/modules/manager/npm/utils.js +3 -3
  237. package/dist/modules/manager/npm/utils.js.map +1 -1
  238. package/dist/modules/manager/nuget/artifacts.js +2 -1
  239. package/dist/modules/manager/nuget/artifacts.js.map +1 -1
  240. package/dist/modules/manager/nuget/update.js +2 -1
  241. package/dist/modules/manager/nuget/update.js.map +1 -1
  242. package/dist/modules/manager/pep621/processors/pdm.js +2 -1
  243. package/dist/modules/manager/pep621/processors/pdm.js.map +1 -1
  244. package/dist/modules/manager/pep621/schema.js +2 -1
  245. package/dist/modules/manager/pep621/schema.js.map +1 -1
  246. package/dist/modules/manager/pip-compile/artifacts.js +2 -1
  247. package/dist/modules/manager/pip-compile/artifacts.js.map +1 -1
  248. package/dist/modules/manager/pip_requirements/artifacts.js +5 -3
  249. package/dist/modules/manager/pip_requirements/artifacts.js.map +1 -1
  250. package/dist/modules/manager/pipenv/extract.js +2 -1
  251. package/dist/modules/manager/pipenv/extract.js.map +1 -1
  252. package/dist/modules/manager/poetry/artifacts.js +3 -2
  253. package/dist/modules/manager/poetry/artifacts.js.map +1 -1
  254. package/dist/modules/manager/poetry/extract.js +2 -1
  255. package/dist/modules/manager/poetry/extract.js.map +1 -1
  256. package/dist/modules/manager/pre-commit/extract.js +5 -3
  257. package/dist/modules/manager/pre-commit/extract.js.map +1 -1
  258. package/dist/modules/manager/puppet/puppetfile-parser.js +2 -1
  259. package/dist/modules/manager/puppet/puppetfile-parser.js.map +1 -1
  260. package/dist/modules/manager/quadlet/extract.js +2 -1
  261. package/dist/modules/manager/quadlet/extract.js.map +1 -1
  262. package/dist/modules/manager/sbt/extract.js +1 -1
  263. package/dist/modules/manager/sbt/extract.js.map +1 -1
  264. package/dist/modules/manager/swift/extract.js +4 -6
  265. package/dist/modules/manager/swift/extract.js.map +1 -1
  266. package/dist/modules/manager/terraform/lockfile/index.js +4 -3
  267. package/dist/modules/manager/terraform/lockfile/index.js.map +1 -1
  268. package/dist/modules/manager/terraform/util.js +2 -1
  269. package/dist/modules/manager/terraform/util.js.map +1 -1
  270. package/dist/modules/manager/terragrunt/extract.js +3 -9
  271. package/dist/modules/manager/terragrunt/extract.js.map +1 -1
  272. package/dist/modules/manager/tflint-plugin/extract.js +1 -1
  273. package/dist/modules/manager/tflint-plugin/extract.js.map +1 -1
  274. package/dist/modules/manager/vendir/artifacts.js +3 -2
  275. package/dist/modules/manager/vendir/artifacts.js.map +1 -1
  276. package/dist/modules/platform/azure/index.js +8 -7
  277. package/dist/modules/platform/azure/index.js.map +1 -1
  278. package/dist/modules/platform/bitbucket/comments.js +2 -2
  279. package/dist/modules/platform/bitbucket/comments.js.map +1 -1
  280. package/dist/modules/platform/bitbucket/index.js +9 -8
  281. package/dist/modules/platform/bitbucket/index.js.map +1 -1
  282. package/dist/modules/platform/bitbucket-server/index.js +8 -9
  283. package/dist/modules/platform/bitbucket-server/index.js.map +1 -1
  284. package/dist/modules/platform/codecommit/codecommit-client.js +8 -5
  285. package/dist/modules/platform/codecommit/codecommit-client.js.map +1 -1
  286. package/dist/modules/platform/codecommit/index.js +5 -5
  287. package/dist/modules/platform/codecommit/index.js.map +1 -1
  288. package/dist/modules/platform/forgejo/forgejo-helper.js +5 -3
  289. package/dist/modules/platform/forgejo/forgejo-helper.js.map +1 -1
  290. package/dist/modules/platform/forgejo/index.js +15 -8
  291. package/dist/modules/platform/forgejo/index.js.map +1 -1
  292. package/dist/modules/platform/gerrit/client.js +2 -1
  293. package/dist/modules/platform/gerrit/client.js.map +1 -1
  294. package/dist/modules/platform/gerrit/index.js +4 -2
  295. package/dist/modules/platform/gerrit/index.js.map +1 -1
  296. package/dist/modules/platform/gerrit/utils.js +1 -1
  297. package/dist/modules/platform/gerrit/utils.js.map +1 -1
  298. package/dist/modules/platform/gitea/gitea-helper.js +5 -3
  299. package/dist/modules/platform/gitea/gitea-helper.js.map +1 -1
  300. package/dist/modules/platform/gitea/index.js +16 -9
  301. package/dist/modules/platform/gitea/index.js.map +1 -1
  302. package/dist/modules/platform/github/index.js +27 -24
  303. package/dist/modules/platform/github/index.js.map +1 -1
  304. package/dist/modules/platform/github/massage-markdown-links.js +1 -1
  305. package/dist/modules/platform/github/massage-markdown-links.js.map +1 -1
  306. package/dist/modules/platform/github/pr.js +1 -1
  307. package/dist/modules/platform/github/pr.js.map +1 -1
  308. package/dist/modules/platform/github/schema.js +3 -2
  309. package/dist/modules/platform/github/schema.js.map +1 -1
  310. package/dist/modules/platform/gitlab/index.js +19 -14
  311. package/dist/modules/platform/gitlab/index.js.map +1 -1
  312. package/dist/modules/platform/local/scm.js +1 -1
  313. package/dist/modules/platform/local/scm.js.map +1 -1
  314. package/dist/modules/platform/util.js +2 -1
  315. package/dist/modules/platform/util.js.map +1 -1
  316. package/dist/modules/versioning/cargo/index.js +1 -1
  317. package/dist/modules/versioning/cargo/index.js.map +1 -1
  318. package/dist/modules/versioning/conan/index.js +4 -2
  319. package/dist/modules/versioning/conan/index.js.map +1 -1
  320. package/dist/modules/versioning/nixpkgs/index.js +2 -1
  321. package/dist/modules/versioning/nixpkgs/index.js.map +1 -1
  322. package/dist/modules/versioning/nuget/index.js +4 -2
  323. package/dist/modules/versioning/nuget/index.js.map +1 -1
  324. package/dist/modules/versioning/nuget/range.js +4 -2
  325. package/dist/modules/versioning/nuget/range.js.map +1 -1
  326. package/dist/modules/versioning/pep440/range.js +1 -1
  327. package/dist/modules/versioning/pep440/range.js.map +1 -1
  328. package/dist/modules/versioning/perl/index.js +1 -1
  329. package/dist/modules/versioning/perl/index.js.map +1 -1
  330. package/dist/modules/versioning/poetry/index.js +2 -2
  331. package/dist/modules/versioning/poetry/index.js.map +1 -1
  332. package/dist/modules/versioning/rez/index.js +5 -5
  333. package/dist/modules/versioning/rez/index.js.map +1 -1
  334. package/dist/modules/versioning/ruby/strategies/bump.js +3 -2
  335. package/dist/modules/versioning/ruby/strategies/bump.js.map +1 -1
  336. package/dist/modules/versioning/ruby/strategies/replace.js +3 -2
  337. package/dist/modules/versioning/ruby/strategies/replace.js.map +1 -1
  338. package/dist/modules/versioning/ruby/strategies/widen.js +3 -2
  339. package/dist/modules/versioning/ruby/strategies/widen.js.map +1 -1
  340. package/dist/util/cache/package/index.js +3 -1
  341. package/dist/util/cache/package/index.js.map +1 -1
  342. package/dist/util/cache/package/with-cache.js +7 -4
  343. package/dist/util/cache/package/with-cache.js.map +1 -1
  344. package/dist/util/cache/repository/impl/base.js +3 -2
  345. package/dist/util/cache/repository/impl/base.js.map +1 -1
  346. package/dist/util/cache/repository/impl/local.js +2 -1
  347. package/dist/util/cache/repository/impl/local.js.map +1 -1
  348. package/dist/util/cache/repository/impl/s3.js +4 -1
  349. package/dist/util/cache/repository/impl/s3.js.map +1 -1
  350. package/dist/util/date.js +1 -1
  351. package/dist/util/date.js.map +1 -1
  352. package/dist/util/emoji.js +6 -2
  353. package/dist/util/emoji.js.map +1 -1
  354. package/dist/util/exec/common.js +1 -1
  355. package/dist/util/exec/common.js.map +1 -1
  356. package/dist/util/exec/docker/index.js +2 -1
  357. package/dist/util/exec/docker/index.js.map +1 -1
  358. package/dist/util/exec/hermit.js +2 -1
  359. package/dist/util/exec/hermit.js.map +1 -1
  360. package/dist/util/exec/index.js +1 -1
  361. package/dist/util/exec/index.js.map +1 -1
  362. package/dist/util/fs/index.js +2 -1
  363. package/dist/util/fs/index.js.map +1 -1
  364. package/dist/util/git/index.js +32 -34
  365. package/dist/util/git/index.js.map +1 -1
  366. package/dist/util/git/url.js +2 -3
  367. package/dist/util/git/url.js.map +1 -1
  368. package/dist/util/github/graphql/cache-strategies/memory-cache-strategy.js +4 -2
  369. package/dist/util/github/graphql/cache-strategies/memory-cache-strategy.js.map +1 -1
  370. package/dist/util/github/graphql/datasource-fetcher.js +3 -1
  371. package/dist/util/github/graphql/datasource-fetcher.js.map +1 -1
  372. package/dist/util/http/cache/memory-http-cache-provider.js +2 -1
  373. package/dist/util/http/cache/memory-http-cache-provider.js.map +1 -1
  374. package/dist/util/http/github.js +3 -2
  375. package/dist/util/http/github.js.map +1 -1
  376. package/dist/util/http/http.js +2 -1
  377. package/dist/util/http/http.js.map +1 -1
  378. package/dist/util/http/index.js +1 -0
  379. package/dist/util/http/index.js.map +1 -1
  380. package/dist/util/http/www-authenticate.js +1 -3
  381. package/dist/util/http/www-authenticate.js.map +1 -1
  382. package/dist/util/mutex.js +1 -1
  383. package/dist/util/mutex.js.map +1 -1
  384. package/dist/util/schema-utils/index.js +1 -1
  385. package/dist/util/schema-utils/index.js.map +1 -1
  386. package/dist/util/toml.js +2 -1
  387. package/dist/util/toml.js.map +1 -1
  388. package/dist/util/yaml.js +4 -2
  389. package/dist/util/yaml.js.map +1 -1
  390. package/dist/workers/global/config/parse/util.js.map +1 -1
  391. package/dist/workers/global/index.js +2 -2
  392. package/dist/workers/global/index.js.map +1 -1
  393. package/dist/workers/repository/changelog/index.js +2 -1
  394. package/dist/workers/repository/changelog/index.js.map +1 -1
  395. package/dist/workers/repository/config-migration/branch/rebase.js +2 -1
  396. package/dist/workers/repository/config-migration/branch/rebase.js.map +1 -1
  397. package/dist/workers/repository/error-config.js +1 -1
  398. package/dist/workers/repository/error-config.js.map +1 -1
  399. package/dist/workers/repository/finalize/prune.js +1 -1
  400. package/dist/workers/repository/finalize/prune.js.map +1 -1
  401. package/dist/workers/repository/finalize/repository-statistics.js +1 -4
  402. package/dist/workers/repository/finalize/repository-statistics.js.map +1 -1
  403. package/dist/workers/repository/index.js +8 -5
  404. package/dist/workers/repository/index.js.map +1 -1
  405. package/dist/workers/repository/init/vulnerability.js +1 -1
  406. package/dist/workers/repository/init/vulnerability.js.map +1 -1
  407. package/dist/workers/repository/onboarding/branch/config.js +2 -1
  408. package/dist/workers/repository/onboarding/branch/config.js.map +1 -1
  409. package/dist/workers/repository/onboarding/branch/create.js +2 -1
  410. package/dist/workers/repository/onboarding/branch/create.js.map +1 -1
  411. package/dist/workers/repository/onboarding/branch/index.js +2 -1
  412. package/dist/workers/repository/onboarding/branch/index.js.map +1 -1
  413. package/dist/workers/repository/onboarding/pr/index.js +3 -1
  414. package/dist/workers/repository/onboarding/pr/index.js.map +1 -1
  415. package/dist/workers/repository/process/lookup/filter-checks.js +2 -1
  416. package/dist/workers/repository/process/lookup/filter-checks.js.map +1 -1
  417. package/dist/workers/repository/process/lookup/filter.js +1 -1
  418. package/dist/workers/repository/process/lookup/filter.js.map +1 -1
  419. package/dist/workers/repository/process/lookup/generate.js +1 -1
  420. package/dist/workers/repository/process/lookup/generate.js.map +1 -1
  421. package/dist/workers/repository/process/lookup/index.js +6 -3
  422. package/dist/workers/repository/process/lookup/index.js.map +1 -1
  423. package/dist/workers/repository/process/lookup/rollback.js +1 -1
  424. package/dist/workers/repository/process/lookup/rollback.js.map +1 -1
  425. package/dist/workers/repository/process/vulnerabilities.js +2 -1
  426. package/dist/workers/repository/process/vulnerabilities.js.map +1 -1
  427. package/dist/workers/repository/process/write.js +8 -4
  428. package/dist/workers/repository/process/write.js.map +1 -1
  429. package/dist/workers/repository/reconfigure/validate.js +2 -1
  430. package/dist/workers/repository/reconfigure/validate.js.map +1 -1
  431. package/dist/workers/repository/update/branch/auto-replace.js +1 -1
  432. package/dist/workers/repository/update/branch/auto-replace.js.map +1 -1
  433. package/dist/workers/repository/update/branch/bump-versions.js +2 -1
  434. package/dist/workers/repository/update/branch/bump-versions.js.map +1 -1
  435. package/dist/workers/repository/update/branch/index.js +3 -1
  436. package/dist/workers/repository/update/branch/index.js.map +1 -1
  437. package/dist/workers/repository/update/pr/automerge.js +1 -1
  438. package/dist/workers/repository/update/pr/automerge.js.map +1 -1
  439. package/dist/workers/repository/update/pr/body/updates-table.js +1 -1
  440. package/dist/workers/repository/update/pr/body/updates-table.js.map +1 -1
  441. package/dist/workers/repository/update/pr/changelog/github/index.js +2 -1
  442. package/dist/workers/repository/update/pr/changelog/github/index.js.map +1 -1
  443. package/dist/workers/repository/update/pr/changelog/github/source.js +2 -1
  444. package/dist/workers/repository/update/pr/changelog/github/source.js.map +1 -1
  445. package/dist/workers/repository/update/pr/changelog/index.js +1 -1
  446. package/dist/workers/repository/update/pr/changelog/index.js.map +1 -1
  447. package/dist/workers/repository/update/pr/changelog/release-notes.js +5 -5
  448. package/dist/workers/repository/update/pr/changelog/release-notes.js.map +1 -1
  449. package/dist/workers/repository/update/pr/changelog/releases.js +1 -1
  450. package/dist/workers/repository/update/pr/changelog/releases.js.map +1 -1
  451. package/dist/workers/repository/update/pr/index.js +6 -3
  452. package/dist/workers/repository/update/pr/index.js.map +1 -1
  453. package/dist/workers/repository/update/pr/pr-reuse.js +1 -1
  454. package/dist/workers/repository/update/pr/pr-reuse.js.map +1 -1
  455. package/package.json +1 -1
  456. package/renovate-schema.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["npm","pep440"],"sources":["../../../../lib/modules/versioning/rez/index.ts"],"sourcesContent":["import type { RangeStrategy } from '../../../types/versioning.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { coerceString } from '../../../util/string.ts';\nimport { api as npm } from '../npm/index.ts';\nimport { api as pep440 } from '../pep440/index.ts';\nimport type { NewValueConfig, VersioningApi } from '../types.ts';\n\nimport {\n ascendingRange,\n descendingRange,\n exactVersion,\n inclusiveBound,\n lowerBound,\n upperBound,\n versionGroup,\n} from './pattern.ts';\nimport {\n npm2rezplus,\n padZeroes,\n pep4402rezInclusiveBound,\n rez2npm,\n rez2pep440,\n} from './transform.ts';\n\nexport const id = 'rez';\nexport const displayName = 'rez';\nexport const urls = ['[Rez package manager](https://github.com/nerdvegas/rez)'];\nexport const supportsRanges = true;\nexport const supportedRangeStrategies: RangeStrategy[] = [\n 'bump',\n 'widen',\n 'replace',\n];\n\nfunction equals(a: string, b: string): boolean {\n try {\n return npm.equals(padZeroes(a), padZeroes(b));\n } catch /* istanbul ignore next */ {\n return pep440.equals(a, b);\n }\n}\n\nfunction getMajor(version: string): number | null {\n try {\n return npm.getMajor(padZeroes(version));\n } catch /* istanbul ignore next */ {\n return pep440.getMajor(version);\n }\n}\n\nfunction getMinor(version: string): number | null {\n try {\n return npm.getMinor(padZeroes(version));\n } catch /* istanbul ignore next */ {\n return pep440.getMinor(version);\n }\n}\n\nfunction getPatch(version: string): number | null {\n try {\n return npm.getPatch(padZeroes(version));\n } catch /* istanbul ignore next */ {\n return pep440.getPatch(version);\n }\n}\n\nfunction isGreaterThan(a: string, b: string): boolean {\n try {\n return npm.isGreaterThan(padZeroes(a), padZeroes(b));\n } catch /* istanbul ignore next */ {\n return pep440.isGreaterThan(a, b);\n }\n}\n\nfunction isLessThanRange(version: string, range: string): boolean {\n return (\n npm.isVersion(padZeroes(version)) &&\n !!npm.isLessThanRange?.(padZeroes(version), rez2npm(range))\n );\n}\n\nexport function isValid(input: string): boolean {\n return npm.isValid(rez2npm(input));\n}\n\nfunction isStable(version: string): boolean {\n return npm.isStable(padZeroes(version));\n}\n\nfunction isVersion(input: string): boolean {\n return npm.isVersion(padZeroes(rez2npm(input)));\n}\n\nfunction matches(version: string, range: string): boolean {\n return (\n npm.isVersion(padZeroes(version)) &&\n npm.matches(padZeroes(version), rez2npm(range))\n );\n}\n\nfunction getSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return npm.getSatisfyingVersion(versions, rez2npm(range));\n}\n\nfunction minSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return npm.minSatisfyingVersion(versions, rez2npm(range));\n}\n\nfunction isSingleVersion(constraint: string): boolean {\n return (\n (constraint.trim().startsWith('==') &&\n isVersion(constraint.trim().substring(2).trim())) ||\n isVersion(constraint.trim())\n );\n}\n\nfunction sortVersions(a: string, b: string): number {\n return npm.sortVersions(padZeroes(a), padZeroes(b));\n}\n\nfunction getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n}: NewValueConfig): string | null {\n const pep440Value = pep440.getNewValue({\n currentValue: rez2pep440(currentValue),\n rangeStrategy,\n currentVersion,\n newVersion,\n });\n if (exactVersion.test(currentValue)) {\n return pep440Value;\n }\n if (pep440Value && inclusiveBound.test(currentValue)) {\n return pep4402rezInclusiveBound(pep440Value);\n }\n if (pep440Value && lowerBound.test(currentValue)) {\n if (currentValue.includes('+')) {\n return npm2rezplus(pep440Value);\n }\n return pep440Value;\n }\n if (pep440Value && upperBound.test(currentValue)) {\n return pep440Value;\n }\n const matchAscRange = ascendingRange.exec(currentValue);\n if (pep440Value && matchAscRange?.groups) {\n // Replace version numbers but keep rez format, otherwise we just end up trying\n // to convert every single case separately.\n const lowerBoundAscCurrent = matchAscRange.groups.range_lower_asc;\n const upperBoundAscCurrent = matchAscRange.groups.range_upper_asc;\n const lowerAscVersionCurrent = matchAscRange.groups.range_lower_asc_version;\n const upperAscVersionCurrent = matchAscRange.groups.range_upper_asc_version;\n const [lowerBoundAscPep440, upperBoundAscPep440] = pep440Value.split(', ');\n const lowerAscVersionNew = coerceString(\n regEx(versionGroup).exec(lowerBoundAscPep440)?.[0],\n );\n const upperAscVersionNew = coerceString(\n regEx(versionGroup).exec(upperBoundAscPep440)?.[0],\n );\n const lowerBoundAscNew = lowerBoundAscCurrent.replace(\n lowerAscVersionCurrent,\n lowerAscVersionNew,\n );\n const upperBoundAscNew = upperBoundAscCurrent.replace(\n upperAscVersionCurrent,\n upperAscVersionNew,\n );\n const separator = currentValue.includes(',') ? ',' : '';\n\n return lowerBoundAscNew + separator + upperBoundAscNew;\n }\n const matchDscRange = descendingRange.exec(currentValue);\n if (pep440Value && matchDscRange?.groups) {\n // Replace version numbers but keep rez format, otherwise we just end up trying\n // to convert every single case separately.\n const upperBoundDescCurrent = matchDscRange.groups.range_upper_desc;\n const lowerBoundDescCurrent = matchDscRange.groups.range_lower_desc;\n const upperDescVersionCurrent =\n matchDscRange.groups.range_upper_desc_version;\n const lowerDescVersionCurrent =\n matchDscRange.groups.range_lower_desc_version;\n const [lowerBoundDescPep440, upperBoundDescPep440] =\n pep440Value.split(', ');\n\n const upperDescVersionNew = coerceString(\n regEx(versionGroup).exec(upperBoundDescPep440)?.[0],\n );\n const lowerDescVersionNew = coerceString(\n regEx(versionGroup).exec(lowerBoundDescPep440)?.[0],\n );\n const upperBoundDescNew = upperBoundDescCurrent.replace(\n upperDescVersionCurrent,\n upperDescVersionNew,\n );\n const lowerBoundDescNew = lowerBoundDescCurrent.replace(\n lowerDescVersionCurrent,\n lowerDescVersionNew,\n );\n // Descending ranges are only supported with a comma.\n const separator = ',';\n\n return upperBoundDescNew + separator + lowerBoundDescNew;\n }\n return null;\n}\n\nfunction isCompatible(version: string): boolean {\n return isVersion(version);\n}\n\nexport const api: VersioningApi = {\n equals,\n getMajor,\n getMinor,\n getPatch,\n getNewValue,\n getSatisfyingVersion,\n isCompatible,\n isGreaterThan,\n isLessThanRange,\n isSingleVersion,\n isStable,\n isValid,\n isVersion,\n matches,\n minSatisfyingVersion,\n sortVersions,\n};\nexport default api;\n"],"mappings":";;;;;;AAkCA,SAAS,OAAO,GAAW,GAAoB;CAC7C,IAAI;EACF,OAAOA,MAAI,OAAO,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC;CAC9C,oCAAmC;EACjC,OAAOC,MAAO,OAAO,GAAG,CAAC;CAC3B;AACF;AAEA,SAAS,SAAS,SAAgC;CAChD,IAAI;EACF,OAAOD,MAAI,SAAS,UAAU,OAAO,CAAC;CACxC,oCAAmC;EACjC,OAAOC,MAAO,SAAS,OAAO;CAChC;AACF;AAEA,SAAS,SAAS,SAAgC;CAChD,IAAI;EACF,OAAOD,MAAI,SAAS,UAAU,OAAO,CAAC;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AM,0BACJ,cAAc,OAAO;EACvB,MAAM,0BACJ,cAAc,OAAO;EACvB,MAAM,CAAC,sBAAsB,wBAC3B,YAAY,MAAM,IAAI;EAExB,MAAM,sBAAsB,aAC1B,MAAM,YAAY,CAAC,CAAC,KAAK,oBAAoB,CAAC,GAAG,EACnD;EACA,MAAM,sBAAsB,aAC1B,MAAM,YAAY,CAAC,CAAC,KAAK,oBAAoB,CAAC,GAAG,EACnD;EACA,MAAM,oBAAoB,sBAAsB,QAC9C,yBACA,mBACF;EACA,MAAM,oBAAoB,sBAAsB,QAC9C,yBACA,mBACF;EAIA,OAAO,oBAAoB,MAAY;CACzC;CACA,OAAO;AACT;AAEA,SAAS,aAAa,SAA0B;CAC9C,OAAO,UAAU,OAAO;AAC1B;AAEA,MAAa,MAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"index.js","names":["npm","pep440"],"sources":["../../../../lib/modules/versioning/rez/index.ts"],"sourcesContent":["import type { RangeStrategy } from '../../../types/versioning.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { coerceString } from '../../../util/string.ts';\nimport { api as npm } from '../npm/index.ts';\nimport { api as pep440 } from '../pep440/index.ts';\nimport type { NewValueConfig, VersioningApi } from '../types.ts';\n\nimport {\n ascendingRange,\n descendingRange,\n exactVersion,\n inclusiveBound,\n lowerBound,\n upperBound,\n versionGroup,\n} from './pattern.ts';\nimport {\n npm2rezplus,\n padZeroes,\n pep4402rezInclusiveBound,\n rez2npm,\n rez2pep440,\n} from './transform.ts';\n\nexport const id = 'rez';\nexport const displayName = 'rez';\nexport const urls = ['[Rez package manager](https://github.com/nerdvegas/rez)'];\nexport const supportsRanges = true;\nexport const supportedRangeStrategies: RangeStrategy[] = [\n 'bump',\n 'widen',\n 'replace',\n];\n\nfunction equals(a: string, b: string): boolean {\n try {\n return npm.equals(padZeroes(a), padZeroes(b));\n } catch /* istanbul ignore next */ {\n return pep440.equals(a, b);\n }\n}\n\nfunction getMajor(version: string): number | null {\n try {\n return npm.getMajor(padZeroes(version));\n } catch /* istanbul ignore next */ {\n return pep440.getMajor(version);\n }\n}\n\nfunction getMinor(version: string): number | null {\n try {\n return npm.getMinor(padZeroes(version));\n } catch /* istanbul ignore next */ {\n return pep440.getMinor(version);\n }\n}\n\nfunction getPatch(version: string): number | null {\n try {\n return npm.getPatch(padZeroes(version));\n } catch /* istanbul ignore next */ {\n return pep440.getPatch(version);\n }\n}\n\nfunction isGreaterThan(a: string, b: string): boolean {\n try {\n return npm.isGreaterThan(padZeroes(a), padZeroes(b));\n } catch /* istanbul ignore next */ {\n return pep440.isGreaterThan(a, b);\n }\n}\n\nfunction isLessThanRange(version: string, range: string): boolean {\n return (\n npm.isVersion(padZeroes(version)) &&\n !!npm.isLessThanRange?.(padZeroes(version), rez2npm(range))\n );\n}\n\nexport function isValid(input: string): boolean {\n return npm.isValid(rez2npm(input));\n}\n\nfunction isStable(version: string): boolean {\n return npm.isStable(padZeroes(version));\n}\n\nfunction isVersion(input: string): boolean {\n return npm.isVersion(padZeroes(rez2npm(input)));\n}\n\nfunction matches(version: string, range: string): boolean {\n return (\n npm.isVersion(padZeroes(version)) &&\n npm.matches(padZeroes(version), rez2npm(range))\n );\n}\n\nfunction getSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return npm.getSatisfyingVersion(versions, rez2npm(range));\n}\n\nfunction minSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return npm.minSatisfyingVersion(versions, rez2npm(range));\n}\n\nfunction isSingleVersion(constraint: string): boolean {\n return (\n (constraint.trim().startsWith('==') &&\n isVersion(constraint.trim().substring(2).trim())) ||\n isVersion(constraint.trim())\n );\n}\n\nfunction sortVersions(a: string, b: string): number {\n return npm.sortVersions(padZeroes(a), padZeroes(b));\n}\n\nfunction getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n}: NewValueConfig): string | null {\n const pep440Value = pep440.getNewValue({\n currentValue: rez2pep440(currentValue),\n rangeStrategy,\n currentVersion,\n newVersion,\n });\n if (exactVersion.test(currentValue)) {\n return pep440Value;\n }\n if (pep440Value && inclusiveBound.test(currentValue)) {\n return pep4402rezInclusiveBound(pep440Value);\n }\n if (pep440Value && lowerBound.test(currentValue)) {\n if (currentValue.includes('+')) {\n return npm2rezplus(pep440Value);\n }\n return pep440Value;\n }\n if (pep440Value && upperBound.test(currentValue)) {\n return pep440Value;\n }\n const matchAscRange = ascendingRange.exec(currentValue);\n if (pep440Value && matchAscRange?.groups) {\n // Replace version numbers but keep rez format, otherwise we just end up trying\n // to convert every single case separately.\n const lowerBoundAscCurrent = matchAscRange.groups.range_lower_asc;\n const upperBoundAscCurrent = matchAscRange.groups.range_upper_asc;\n const lowerAscVersionCurrent = matchAscRange.groups.range_lower_asc_version;\n const upperAscVersionCurrent = matchAscRange.groups.range_upper_asc_version;\n const [lowerBoundAscPep440, upperBoundAscPep440] = pep440Value.split(', ');\n const lowerAscVersionNew = coerceString(\n regEx(versionGroup).exec(lowerBoundAscPep440)?.[0],\n );\n const upperAscVersionNew = coerceString(\n regEx(versionGroup).exec(upperBoundAscPep440)?.[0],\n );\n const lowerBoundAscNew = lowerBoundAscCurrent.replace(\n lowerAscVersionCurrent,\n lowerAscVersionNew,\n );\n const upperBoundAscNew = upperBoundAscCurrent.replace(\n upperAscVersionCurrent,\n upperAscVersionNew,\n );\n const separator = currentValue.includes(',') ? ',' : '';\n\n return lowerBoundAscNew + separator + upperBoundAscNew;\n }\n const matchDscRange = descendingRange.exec(currentValue);\n if (pep440Value && matchDscRange?.groups) {\n // Replace version numbers but keep rez format, otherwise we just end up trying\n // to convert every single case separately.\n const upperBoundDescCurrent = matchDscRange.groups.range_upper_desc;\n const lowerBoundDescCurrent = matchDscRange.groups.range_lower_desc;\n const upperDescVersionCurrent =\n matchDscRange.groups.range_upper_desc_version;\n const lowerDescVersionCurrent =\n matchDscRange.groups.range_lower_desc_version;\n const [lowerBoundDescPep440, upperBoundDescPep440] =\n pep440Value.split(', ');\n\n const upperDescVersionNew = coerceString(\n regEx(versionGroup).exec(upperBoundDescPep440)?.[0],\n );\n const lowerDescVersionNew = coerceString(\n regEx(versionGroup).exec(lowerBoundDescPep440)?.[0],\n );\n const upperBoundDescNew = upperBoundDescCurrent.replace(\n upperDescVersionCurrent,\n upperDescVersionNew,\n );\n const lowerBoundDescNew = lowerBoundDescCurrent.replace(\n lowerDescVersionCurrent,\n lowerDescVersionNew,\n );\n // Descending ranges are only supported with a comma.\n const separator = ',';\n\n return upperBoundDescNew + separator + lowerBoundDescNew;\n }\n return null;\n}\n\nfunction isCompatible(version: string): boolean {\n return isVersion(version);\n}\n\nexport const api: VersioningApi = {\n equals,\n getMajor,\n getMinor,\n getPatch,\n getNewValue,\n getSatisfyingVersion,\n isCompatible,\n isGreaterThan,\n isLessThanRange,\n isSingleVersion,\n isStable,\n isValid,\n isVersion,\n matches,\n minSatisfyingVersion,\n sortVersions,\n};\nexport default api;\n"],"mappings":";;;;;;AAkCA,SAAS,OAAO,GAAW,GAAoB;CAC7C,IAAI;EACF,OAAOA,MAAI,OAAO,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC;CAC9C,mCAAmC;EACjC,OAAOC,MAAO,OAAO,GAAG,CAAC;CAC3B;AACF;AAEA,SAAS,SAAS,SAAgC;CAChD,IAAI;EACF,OAAOD,MAAI,SAAS,UAAU,OAAO,CAAC;CACxC,mCAAmC;EACjC,OAAOC,MAAO,SAAS,OAAO;CAChC;AACF;AAEA,SAAS,SAAS,SAAgC;CAChD,IAAI;EACF,OAAOD,MAAI,SAAS,UAAU,OAAO,CAAC;CACxC,mCAAmC;EACjC,OAAOC,MAAO,SAAS,OAAO;CAChC;AACF;AAEA,SAAS,SAAS,SAAgC;CAChD,IAAI;EACF,OAAOD,MAAI,SAAS,UAAU,OAAO,CAAC;CACxC,mCAAmC;EACjC,OAAOC,MAAO,SAAS,OAAO;CAChC;AACF;AA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,MAAM,sBAAsB,aAC1B,MAAM,YAAY,CAAC,CAAC,KAAK,oBAAoB,CAAC,GAAG,EACnD;EACA,MAAM,oBAAoB,sBAAsB,QAC9C,yBACA,mBACF;EACA,MAAM,oBAAoB,sBAAsB,QAC9C,yBACA,mBACF;EAIA,OAAO,oBAAoB,MAAY;CACzC;CACA,OAAO;AACT;AAEA,SAAS,aAAa,SAA0B;CAC9C,OAAO,UAAU,OAAO;AAC1B;AAEA,MAAa,MAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -4,7 +4,7 @@ import { replacePart } from "./replace.js";
4
4
  import { gt, gte, lt } from "@renovatebot/ruby-semver";
5
5
  //#region lib/modules/versioning/ruby/strategies/bump.ts
6
6
  var bump_default = ({ range, to }) => {
7
- return stringifyRanges(parseRanges(range).map((part) => {
7
+ const parts = parseRanges(range).map((part) => {
8
8
  const { operator, version: ver } = part;
9
9
  switch (operator) {
10
10
  case "<": return gte(to, ver) ? replacePart(part, to) : part;
@@ -35,7 +35,8 @@ var bump_default = ({ range, to }) => {
35
35
  return part;
36
36
  default: return replacePart(part, to);
37
37
  }
38
- }));
38
+ });
39
+ return stringifyRanges(parts);
39
40
  };
40
41
  //#endregion
41
42
  export { bump_default as default };
@@ -1 +1 @@
1
- {"version":3,"file":"bump.js","names":[],"sources":["../../../../../lib/modules/versioning/ruby/strategies/bump.ts"],"sourcesContent":["import { gt, gte, lt } from '@renovatebot/ruby-semver';\nimport { GTE, LT, LTE, NOT_EQUAL, PGTE } from '../operator.ts';\nimport type { Range } from '../range.ts';\nimport { parseRanges, stringifyRanges } from '../range.ts';\nimport { adapt, trimZeroes } from '../version.ts';\nimport { replacePart } from './replace.ts';\n\nexport default ({ range, to }: { range: string; to: string }): string => {\n const parts = parseRanges(range).map((part): Range => {\n const { operator, version: ver } = part;\n switch (operator) {\n // Update upper bound (`<` and `<=`) ranges only if the new version violates them\n case LT:\n return gte(to, ver) ? replacePart(part, to) : part;\n case LTE:\n return gt(to, ver) ? replacePart(part, to) : part;\n // `~>` ranges.\n case PGTE: {\n // Try to add / remove extra `>=` constraint.\n const trimmed = adapt(to, ver);\n if (trimZeroes(trimmed) === trimZeroes(to)) {\n // E.g. `'~> 5.2', '>= 5.2.0'`. In this case the latter is redundant.\n return { ...part, version: trimmed, companion: undefined };\n }\n // E.g. `'~> 5.2', '>= 5.2.1'`.\n return {\n ...part,\n version: trimmed,\n companion: { operator: GTE, delimiter: ' ', version: to },\n };\n }\n case NOT_EQUAL:\n if (lt(ver, to)) {\n // The version to exclude is now out of range.\n return { ...part, operator: GTE, version: to };\n }\n return part;\n default:\n // For `=` and lower bound ranges, always keep it stick to the new version.\n return replacePart(part, to);\n }\n });\n\n return stringifyRanges(parts);\n};\n"],"mappings":";;;;;AAOA,IAAA,gBAAgB,EAAE,OAAO,SAAgD;CAoCvE,OAAO,gBAnCO,YAAY,KAAK,CAAC,CAAC,KAAK,SAAgB;EACpD,MAAM,EAAE,UAAU,SAAS,QAAQ;EACnC,QAAQ,UAAR;GAEE,KAAA,KACE,OAAO,IAAI,IAAI,GAAG,IAAI,YAAY,MAAM,EAAE,IAAI;GAChD,KAAA,MACE,OAAO,GAAG,IAAI,GAAG,IAAI,YAAY,MAAM,EAAE,IAAI;GAE/C,KAAA,MAAW;IAET,MAAM,UAAU,MAAM,IAAI,GAAG;IAC7B,IAAI,WAAW,OAAO,MAAM,WAAW,EAAE,GAEvC,OAAO;KAAE,GAAG;KAAM,SAAS;KAAS,WAAW,KAAA;IAAU;IAG3D,OAAO;KACL,GAAG;KACH,SAAS;KACT,WAAW;MAAE,UAAA;MAAe,WAAW;MAAK,SAAS;KAAG;IAC1D;GACF;GACA,KAAA;IACE,IAAI,GAAG,KAAK,EAAE,GAEZ,OAAO;KAAE,GAAG;KAAM,UAAA;KAAe,SAAS;IAAG;IAE/C,OAAO;GACT,SAEE,OAAO,YAAY,MAAM,EAAE;EAC/B;CACF,CAE2B,CAAC;AAC9B"}
1
+ {"version":3,"file":"bump.js","names":[],"sources":["../../../../../lib/modules/versioning/ruby/strategies/bump.ts"],"sourcesContent":["import { gt, gte, lt } from '@renovatebot/ruby-semver';\nimport { GTE, LT, LTE, NOT_EQUAL, PGTE } from '../operator.ts';\nimport type { Range } from '../range.ts';\nimport { parseRanges, stringifyRanges } from '../range.ts';\nimport { adapt, trimZeroes } from '../version.ts';\nimport { replacePart } from './replace.ts';\n\nexport default ({ range, to }: { range: string; to: string }): string => {\n const parts = parseRanges(range).map((part): Range => {\n const { operator, version: ver } = part;\n switch (operator) {\n // Update upper bound (`<` and `<=`) ranges only if the new version violates them\n case LT:\n return gte(to, ver) ? replacePart(part, to) : part;\n case LTE:\n return gt(to, ver) ? replacePart(part, to) : part;\n // `~>` ranges.\n case PGTE: {\n // Try to add / remove extra `>=` constraint.\n const trimmed = adapt(to, ver);\n if (trimZeroes(trimmed) === trimZeroes(to)) {\n // E.g. `'~> 5.2', '>= 5.2.0'`. In this case the latter is redundant.\n return { ...part, version: trimmed, companion: undefined };\n }\n // E.g. `'~> 5.2', '>= 5.2.1'`.\n return {\n ...part,\n version: trimmed,\n companion: { operator: GTE, delimiter: ' ', version: to },\n };\n }\n case NOT_EQUAL:\n if (lt(ver, to)) {\n // The version to exclude is now out of range.\n return { ...part, operator: GTE, version: to };\n }\n return part;\n default:\n // For `=` and lower bound ranges, always keep it stick to the new version.\n return replacePart(part, to);\n }\n });\n\n return stringifyRanges(parts);\n};\n"],"mappings":";;;;;AAOA,IAAA,gBAAgB,EAAE,OAAO,SAAgD;CACvE,MAAM,QAAQ,YAAY,KAAK,CAAC,CAAC,KAAK,SAAgB;EACpD,MAAM,EAAE,UAAU,SAAS,QAAQ;EACnC,QAAQ,UAAR;GAEE,KAAA,KACE,OAAO,IAAI,IAAI,GAAG,IAAI,YAAY,MAAM,EAAE,IAAI;GAChD,KAAA,MACE,OAAO,GAAG,IAAI,GAAG,IAAI,YAAY,MAAM,EAAE,IAAI;GAE/C,KAAA,MAAW;IAET,MAAM,UAAU,MAAM,IAAI,GAAG;IAC7B,IAAI,WAAW,OAAO,MAAM,WAAW,EAAE,GAEvC,OAAO;KAAE,GAAG;KAAM,SAAS;KAAS,WAAW,KAAA;IAAU;IAG3D,OAAO;KACL,GAAG;KACH,SAAS;KACT,WAAW;MAAE,UAAA;MAAe,WAAW;MAAK,SAAS;KAAG;IAC1D;GACF;GACA,KAAA;IACE,IAAI,GAAG,KAAK,EAAE,GAEZ,OAAO;KAAE,GAAG;KAAM,UAAA;KAAe,SAAS;IAAG;IAE/C,OAAO;GACT,SAEE,OAAO,YAAY,MAAM,EAAE;EAC/B;CACF,CAAC;CAED,OAAO,gBAAgB,KAAK;AAC9B"}
@@ -47,7 +47,7 @@ function replacePart(part, to) {
47
47
  }
48
48
  }
49
49
  var replace_default = ({ range, to }) => {
50
- return stringifyRanges(parseRanges(range).map((part) => {
50
+ const parts = parseRanges(range).map((part) => {
51
51
  if (satisfiesRange(to, part)) return part;
52
52
  if (part.version.split(".").length > to.split(".").length) {
53
53
  const diff = part.version.split(".").length - to.split(".").length;
@@ -58,7 +58,8 @@ var replace_default = ({ range, to }) => {
58
58
  };
59
59
  }
60
60
  return replacePart(part, to);
61
- }));
61
+ });
62
+ return stringifyRanges(parts);
62
63
  };
63
64
  //#endregion
64
65
  export { replace_default as default, replacePart };
@@ -1 +1 @@
1
- {"version":3,"file":"replace.js","names":[],"sources":["../../../../../lib/modules/versioning/ruby/strategies/replace.ts"],"sourcesContent":["import { logger } from '../../../../logger/index.ts';\nimport { EQUAL, GT, GTE, LT, LTE, NOT_EQUAL, PGTE } from '../operator.ts';\nimport type { Range } from '../range.ts';\nimport { parseRanges, satisfiesRange, stringifyRanges } from '../range.ts';\nimport { adapt, decrement, floor, increment } from '../version.ts';\n\n// Common logic for replace, widen, and bump strategies\n// It basically makes the range stick to the new version.\nexport function replacePart(part: Range, to: string): Range {\n const { operator, version: ver, companion } = part;\n switch (operator) {\n case LT:\n return { ...part, version: increment(ver, to) };\n case LTE:\n return { ...part, version: to };\n case PGTE:\n if (companion) {\n return {\n ...part,\n version: floor(adapt(to, ver)),\n companion: { ...companion, version: to },\n };\n }\n return { ...part, version: floor(adapt(to, ver)) };\n\n case GT:\n return { ...part, version: decrement(to) };\n case GTE:\n case EQUAL:\n return { ...part, version: to };\n case NOT_EQUAL:\n return part;\n // istanbul ignore next\n default:\n logger.warn({ operator }, `Unsupported ruby versioning operator`);\n return { operator: '', delimiter: ' ', version: '' };\n }\n}\n\nexport default ({ range, to }: { range: string; to: string }): string => {\n const parts = parseRanges(range).map((part): Range => {\n if (satisfiesRange(to, part)) {\n // The new version satisfies the range. Keep it as-is.\n // Note that consecutive `~>` and `>=` parts are combined into one Range object,\n // therefore both parts are updated if the new version violates one of them.\n return part;\n }\n\n if (part.version.split('.').length > to.split('.').length) {\n const diff = part.version.split('.').length - to.split('.').length;\n const versionToReplace = [to, ...Array(diff).fill('0')].join('.');\n const replacement = replacePart(part, versionToReplace);\n return {\n ...replacement,\n version: replacement.version.split('.').slice(0, -diff).join('.'),\n };\n }\n\n return replacePart(part, to);\n });\n\n return stringifyRanges(parts);\n};\n"],"mappings":";;;;AAQA,SAAgB,YAAY,MAAa,IAAmB;CAC1D,MAAM,EAAE,UAAU,SAAS,KAAK,cAAc;CAC9C,QAAQ,UAAR;EACE,KAAA,KACE,OAAO;GAAE,GAAG;GAAM,SAAS,UAAU,KAAK,EAAE;EAAE;EAChD,KAAA,MACE,OAAO;GAAE,GAAG;GAAM,SAAS;EAAG;EAChC,KAAA;GACE,IAAI,WACF,OAAO;IACL,GAAG;IACH,SAAS,MAAM,MAAM,IAAI,GAAG,CAAC;IAC7B,WAAW;KAAE,GAAG;KAAW,SAAS;IAAG;GACzC;GAEF,OAAO;IAAE,GAAG;IAAM,SAAS,MAAM,MAAM,IAAI,GAAG,CAAC;GAAE;EAEnD,KAAA,KACE,OAAO;GAAE,GAAG;GAAM,SAAS,UAAU,EAAE;EAAE;EAC3C,KAAA;EACA,KAAA,KACE,OAAO;GAAE,GAAG;GAAM,SAAS;EAAG;EAChC,KAAA,MACE,OAAO;;EAET;GACE,OAAO,KAAK,EAAE,SAAS,GAAG,sCAAsC;GAChE,OAAO;IAAE,UAAU;IAAI,WAAW;IAAK,SAAS;GAAG;CACvD;AACF;AAEA,IAAA,mBAAgB,EAAE,OAAO,SAAgD;CAsBvE,OAAO,gBArBO,YAAY,KAAK,CAAC,CAAC,KAAK,SAAgB;EACpD,IAAI,eAAe,IAAI,IAAI,GAIzB,OAAO;EAGT,IAAI,KAAK,QAAQ,MAAM,GAAG,CAAC,CAAC,SAAS,GAAG,MAAM,GAAG,CAAC,CAAC,QAAQ;GACzD,MAAM,OAAO,KAAK,QAAQ,MAAM,GAAG,CAAC,CAAC,SAAS,GAAG,MAAM,GAAG,CAAC,CAAC;GAE5D,MAAM,cAAc,YAAY,MADP,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,GACR,CAAC;GACtD,OAAO;IACL,GAAG;IACH,SAAS,YAAY,QAAQ,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG;GAClE;EACF;EAEA,OAAO,YAAY,MAAM,EAAE;CAC7B,CAE2B,CAAC;AAC9B"}
1
+ {"version":3,"file":"replace.js","names":[],"sources":["../../../../../lib/modules/versioning/ruby/strategies/replace.ts"],"sourcesContent":["import { logger } from '../../../../logger/index.ts';\nimport { EQUAL, GT, GTE, LT, LTE, NOT_EQUAL, PGTE } from '../operator.ts';\nimport type { Range } from '../range.ts';\nimport { parseRanges, satisfiesRange, stringifyRanges } from '../range.ts';\nimport { adapt, decrement, floor, increment } from '../version.ts';\n\n// Common logic for replace, widen, and bump strategies\n// It basically makes the range stick to the new version.\nexport function replacePart(part: Range, to: string): Range {\n const { operator, version: ver, companion } = part;\n switch (operator) {\n case LT:\n return { ...part, version: increment(ver, to) };\n case LTE:\n return { ...part, version: to };\n case PGTE:\n if (companion) {\n return {\n ...part,\n version: floor(adapt(to, ver)),\n companion: { ...companion, version: to },\n };\n }\n return { ...part, version: floor(adapt(to, ver)) };\n\n case GT:\n return { ...part, version: decrement(to) };\n case GTE:\n case EQUAL:\n return { ...part, version: to };\n case NOT_EQUAL:\n return part;\n // istanbul ignore next\n default:\n logger.warn({ operator }, `Unsupported ruby versioning operator`);\n return { operator: '', delimiter: ' ', version: '' };\n }\n}\n\nexport default ({ range, to }: { range: string; to: string }): string => {\n const parts = parseRanges(range).map((part): Range => {\n if (satisfiesRange(to, part)) {\n // The new version satisfies the range. Keep it as-is.\n // Note that consecutive `~>` and `>=` parts are combined into one Range object,\n // therefore both parts are updated if the new version violates one of them.\n return part;\n }\n\n if (part.version.split('.').length > to.split('.').length) {\n const diff = part.version.split('.').length - to.split('.').length;\n const versionToReplace = [to, ...Array(diff).fill('0')].join('.');\n const replacement = replacePart(part, versionToReplace);\n return {\n ...replacement,\n version: replacement.version.split('.').slice(0, -diff).join('.'),\n };\n }\n\n return replacePart(part, to);\n });\n\n return stringifyRanges(parts);\n};\n"],"mappings":";;;;AAQA,SAAgB,YAAY,MAAa,IAAmB;CAC1D,MAAM,EAAE,UAAU,SAAS,KAAK,cAAc;CAC9C,QAAQ,UAAR;EACE,KAAA,KACE,OAAO;GAAE,GAAG;GAAM,SAAS,UAAU,KAAK,EAAE;EAAE;EAChD,KAAA,MACE,OAAO;GAAE,GAAG;GAAM,SAAS;EAAG;EAChC,KAAA;GACE,IAAI,WACF,OAAO;IACL,GAAG;IACH,SAAS,MAAM,MAAM,IAAI,GAAG,CAAC;IAC7B,WAAW;KAAE,GAAG;KAAW,SAAS;IAAG;GACzC;GAEF,OAAO;IAAE,GAAG;IAAM,SAAS,MAAM,MAAM,IAAI,GAAG,CAAC;GAAE;EAEnD,KAAA,KACE,OAAO;GAAE,GAAG;GAAM,SAAS,UAAU,EAAE;EAAE;EAC3C,KAAA;EACA,KAAA,KACE,OAAO;GAAE,GAAG;GAAM,SAAS;EAAG;EAChC,KAAA,MACE,OAAO;;EAET;GACE,OAAO,KAAK,EAAE,SAAS,GAAG,sCAAsC;GAChE,OAAO;IAAE,UAAU;IAAI,WAAW;IAAK,SAAS;GAAG;CACvD;AACF;AAEA,IAAA,mBAAgB,EAAE,OAAO,SAAgD;CACvE,MAAM,QAAQ,YAAY,KAAK,CAAC,CAAC,KAAK,SAAgB;EACpD,IAAI,eAAe,IAAI,IAAI,GAIzB,OAAO;EAGT,IAAI,KAAK,QAAQ,MAAM,GAAG,CAAC,CAAC,SAAS,GAAG,MAAM,GAAG,CAAC,CAAC,QAAQ;GACzD,MAAM,OAAO,KAAK,QAAQ,MAAM,GAAG,CAAC,CAAC,SAAS,GAAG,MAAM,GAAG,CAAC,CAAC;GAE5D,MAAM,cAAc,YAAY,MADP,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,GACR,CAAC;GACtD,OAAO;IACL,GAAG;IACH,SAAS,YAAY,QAAQ,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG;GAClE;EACF;EAEA,OAAO,YAAY,MAAM,EAAE;CAC7B,CAAC;CAED,OAAO,gBAAgB,KAAK;AAC9B"}
@@ -3,7 +3,7 @@ import { increment, pgteUpperBound } from "../version.js";
3
3
  import { replacePart } from "./replace.js";
4
4
  //#region lib/modules/versioning/ruby/strategies/widen.ts
5
5
  var widen_default = ({ range, to }) => {
6
- return stringifyRanges(parseRanges(range).flatMap((part) => {
6
+ const parts = parseRanges(range).flatMap((part) => {
7
7
  if (satisfiesRange(to, part)) return [part];
8
8
  const { operator, version: ver, companion } = part;
9
9
  switch (operator) {
@@ -22,7 +22,8 @@ var widen_default = ({ range, to }) => {
22
22
  }
23
23
  default: return [replacePart(part, to)];
24
24
  }
25
- }));
25
+ });
26
+ return stringifyRanges(parts);
26
27
  };
27
28
  //#endregion
28
29
  export { widen_default as default };
@@ -1 +1 @@
1
- {"version":3,"file":"widen.js","names":[],"sources":["../../../../../lib/modules/versioning/ruby/strategies/widen.ts"],"sourcesContent":["import { GTE, LT, PGTE } from '../operator.ts';\nimport type { Range } from '../range.ts';\nimport { parseRanges, satisfiesRange, stringifyRanges } from '../range.ts';\nimport { increment, pgteUpperBound } from '../version.ts';\nimport { replacePart } from './replace.ts';\n\nexport default ({ range, to }: { range: string; to: string }): string => {\n const parts = parseRanges(range).flatMap((part): Range[] => {\n if (satisfiesRange(to, part)) {\n return [part];\n }\n\n const { operator, version: ver, companion } = part;\n switch (operator) {\n // `~>` works as both lower bound and upper bound.\n // We need to decompose it to get wider range.\n case PGTE: {\n // Prefer constraints from `>=`\n const baseVersion = companion ? companion.version : ver;\n const limit = increment(pgteUpperBound(ver), to);\n return [\n { operator: GTE, delimiter: ' ', version: baseVersion },\n { operator: LT, delimiter: ' ', version: limit },\n ];\n }\n default:\n return [replacePart(part, to)];\n }\n });\n\n return stringifyRanges(parts);\n};\n"],"mappings":";;;;AAMA,IAAA,iBAAgB,EAAE,OAAO,SAAgD;CAwBvE,OAAO,gBAvBO,YAAY,KAAK,CAAC,CAAC,SAAS,SAAkB;EAC1D,IAAI,eAAe,IAAI,IAAI,GACzB,OAAO,CAAC,IAAI;EAGd,MAAM,EAAE,UAAU,SAAS,KAAK,cAAc;EAC9C,QAAQ,UAAR;GAGE,KAAA,MAAW;IAET,MAAM,cAAc,YAAY,UAAU,UAAU;IACpD,MAAM,QAAQ,UAAU,eAAe,GAAG,GAAG,EAAE;IAC/C,OAAO,CACL;KAAE,UAAA;KAAe,WAAW;KAAK,SAAS;IAAY,GACtD;KAAE,UAAA;KAAc,WAAW;KAAK,SAAS;IAAM,CACjD;GACF;GACA,SACE,OAAO,CAAC,YAAY,MAAM,EAAE,CAAC;EACjC;CACF,CAE2B,CAAC;AAC9B"}
1
+ {"version":3,"file":"widen.js","names":[],"sources":["../../../../../lib/modules/versioning/ruby/strategies/widen.ts"],"sourcesContent":["import { GTE, LT, PGTE } from '../operator.ts';\nimport type { Range } from '../range.ts';\nimport { parseRanges, satisfiesRange, stringifyRanges } from '../range.ts';\nimport { increment, pgteUpperBound } from '../version.ts';\nimport { replacePart } from './replace.ts';\n\nexport default ({ range, to }: { range: string; to: string }): string => {\n const parts = parseRanges(range).flatMap((part): Range[] => {\n if (satisfiesRange(to, part)) {\n return [part];\n }\n\n const { operator, version: ver, companion } = part;\n switch (operator) {\n // `~>` works as both lower bound and upper bound.\n // We need to decompose it to get wider range.\n case PGTE: {\n // Prefer constraints from `>=`\n const baseVersion = companion ? companion.version : ver;\n const limit = increment(pgteUpperBound(ver), to);\n return [\n { operator: GTE, delimiter: ' ', version: baseVersion },\n { operator: LT, delimiter: ' ', version: limit },\n ];\n }\n default:\n return [replacePart(part, to)];\n }\n });\n\n return stringifyRanges(parts);\n};\n"],"mappings":";;;;AAMA,IAAA,iBAAgB,EAAE,OAAO,SAAgD;CACvE,MAAM,QAAQ,YAAY,KAAK,CAAC,CAAC,SAAS,SAAkB;EAC1D,IAAI,eAAe,IAAI,IAAI,GACzB,OAAO,CAAC,IAAI;EAGd,MAAM,EAAE,UAAU,SAAS,KAAK,cAAc;EAC9C,QAAQ,UAAR;GAGE,KAAA,MAAW;IAET,MAAM,cAAc,YAAY,UAAU,UAAU;IACpD,MAAM,QAAQ,UAAU,eAAe,GAAG,GAAG,EAAE;IAC/C,OAAO,CACL;KAAE,UAAA;KAAe,WAAW;KAAK,SAAS;IAAY,GACtD;KAAE,UAAA;KAAc,WAAW;KAAK,SAAS;IAAM,CACjD;GACF;GACA,SACE,OAAO,CAAC,YAAY,MAAM,EAAE,CAAC;EACjC;CACF,CAAC;CAED,OAAO,gBAAgB,KAAK;AAC9B"}
@@ -30,7 +30,9 @@ async function set(namespace, key, value, hardTtlMinutes) {
30
30
  async function setWithRawTtl(namespace, key, value, hardTtlMinutes) {
31
31
  if (!getCacheType$1()) return;
32
32
  await PackageCacheStats.wrapSet(() => set$2(namespace, key, value, hardTtlMinutes));
33
- set$1(getCombinedKey(namespace, key), Promise.resolve(value));
33
+ const combinedKey = getCombinedKey(namespace, key);
34
+ const p = Promise.resolve(value);
35
+ set$1(combinedKey, p);
34
36
  }
35
37
  async function init(config) {
36
38
  await init$1(config);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["backend.getCacheType","memCache.get","backend.get","backend.set","backend.init","backend.destroy"],"sources":["../../../../lib/util/cache/package/index.ts"],"sourcesContent":["import type { AllConfig } from '../../../config/types.ts';\nimport { PackageCacheStats } from '../../stats.ts';\nimport * as memCache from '../memory/index.ts';\nimport * as backend from './backend.ts';\nimport { getCombinedKey } from './key.ts';\nimport { getTtlOverride } from './ttl.ts';\nimport type { PackageCacheNamespace } from './types.ts';\n\nexport function getCacheType(): ReturnType<typeof backend.getCacheType> {\n return backend.getCacheType();\n}\n\nexport async function get<T = any>(\n namespace: PackageCacheNamespace,\n key: string,\n): Promise<T | undefined> {\n if (!backend.getCacheType()) {\n return undefined;\n }\n\n const combinedKey = getCombinedKey(namespace, key);\n let cachedPromise = memCache.get(combinedKey);\n if (!cachedPromise) {\n cachedPromise = PackageCacheStats.wrapGet(() =>\n backend.get(namespace, key),\n );\n memCache.set(combinedKey, cachedPromise);\n }\n\n return await cachedPromise;\n}\n\n/**\n * Set cache value with user-defined TTL overrides.\n */\nexport async function set(\n namespace: PackageCacheNamespace,\n key: string,\n value: unknown,\n hardTtlMinutes: number,\n): Promise<void> {\n const rawTtl = getTtlOverride(namespace) ?? hardTtlMinutes;\n await setWithRawTtl(namespace, key, value, rawTtl);\n}\n\n/**\n * Set cache value ignoring user-defined TTL overrides.\n * This MUST NOT be used outside of cache implementation\n */\nexport async function setWithRawTtl(\n namespace: PackageCacheNamespace,\n key: string,\n value: unknown,\n hardTtlMinutes: number,\n): Promise<void> {\n if (!backend.getCacheType()) {\n return;\n }\n\n await PackageCacheStats.wrapSet(() =>\n backend.set(namespace, key, value, hardTtlMinutes),\n );\n\n const combinedKey = getCombinedKey(namespace, key);\n const p = Promise.resolve(value);\n memCache.set(combinedKey, p);\n}\n\nexport async function init(config: AllConfig): Promise<void> {\n await backend.init(config);\n}\n\nexport async function cleanup(_config: AllConfig): Promise<void> {\n await backend.destroy();\n}\n"],"mappings":";;;;;;AAQA,SAAgB,eAAwD;CACtE,OAAOA,eAAqB;AAC9B;AAEA,eAAsB,IACpB,WACA,KACwB;CACxB,IAAI,CAACA,eAAqB,GACxB;CAGF,MAAM,cAAc,eAAe,WAAW,GAAG;CACjD,IAAI,gBAAgBC,MAAa,WAAW;CAC5C,IAAI,CAAC,eAAe;EAClB,gBAAgB,kBAAkB,cAChCC,MAAY,WAAW,GAAG,CAC5B;EACA,MAAa,aAAa,aAAa;CACzC;CAEA,OAAO,MAAM;AACf;;;;AAKA,eAAsB,IACpB,WACA,KACA,OACA,gBACe;CAEf,MAAM,cAAc,WAAW,KAAK,OADrB,eAAe,SAAS,KAAK,cACK;AACnD;;;;;AAMA,eAAsB,cACpB,WACA,KACA,OACA,gBACe;CACf,IAAI,CAACF,eAAqB,GACxB;CAGF,MAAM,kBAAkB,cACtBG,MAAY,WAAW,KAAK,OAAO,cAAc,CACnD;CAIA,MAFoB,eAAe,WAAW,GAEjC,GADH,QAAQ,QAAQ,KACA,CAAC;AAC7B;AAEA,eAAsB,KAAK,QAAkC;CAC3D,MAAMC,OAAa,MAAM;AAC3B;AAEA,eAAsB,QAAQ,SAAmC;CAC/D,MAAMC,QAAgB;AACxB"}
1
+ {"version":3,"file":"index.js","names":["backend.getCacheType","memCache.get","backend.get","backend.set","backend.init","backend.destroy"],"sources":["../../../../lib/util/cache/package/index.ts"],"sourcesContent":["import type { AllConfig } from '../../../config/types.ts';\nimport { PackageCacheStats } from '../../stats.ts';\nimport * as memCache from '../memory/index.ts';\nimport * as backend from './backend.ts';\nimport { getCombinedKey } from './key.ts';\nimport { getTtlOverride } from './ttl.ts';\nimport type { PackageCacheNamespace } from './types.ts';\n\nexport function getCacheType(): ReturnType<typeof backend.getCacheType> {\n return backend.getCacheType();\n}\n\nexport async function get<T = any>(\n namespace: PackageCacheNamespace,\n key: string,\n): Promise<T | undefined> {\n if (!backend.getCacheType()) {\n return undefined;\n }\n\n const combinedKey = getCombinedKey(namespace, key);\n let cachedPromise = memCache.get(combinedKey);\n if (!cachedPromise) {\n cachedPromise = PackageCacheStats.wrapGet(() =>\n backend.get(namespace, key),\n );\n memCache.set(combinedKey, cachedPromise);\n }\n\n return await cachedPromise;\n}\n\n/**\n * Set cache value with user-defined TTL overrides.\n */\nexport async function set(\n namespace: PackageCacheNamespace,\n key: string,\n value: unknown,\n hardTtlMinutes: number,\n): Promise<void> {\n const rawTtl = getTtlOverride(namespace) ?? hardTtlMinutes;\n await setWithRawTtl(namespace, key, value, rawTtl);\n}\n\n/**\n * Set cache value ignoring user-defined TTL overrides.\n * This MUST NOT be used outside of cache implementation\n */\nexport async function setWithRawTtl(\n namespace: PackageCacheNamespace,\n key: string,\n value: unknown,\n hardTtlMinutes: number,\n): Promise<void> {\n if (!backend.getCacheType()) {\n return;\n }\n\n await PackageCacheStats.wrapSet(() =>\n backend.set(namespace, key, value, hardTtlMinutes),\n );\n\n const combinedKey = getCombinedKey(namespace, key);\n const p = Promise.resolve(value);\n memCache.set(combinedKey, p);\n}\n\nexport async function init(config: AllConfig): Promise<void> {\n await backend.init(config);\n}\n\nexport async function cleanup(_config: AllConfig): Promise<void> {\n await backend.destroy();\n}\n"],"mappings":";;;;;;AAQA,SAAgB,eAAwD;CACtE,OAAOA,eAAqB;AAC9B;AAEA,eAAsB,IACpB,WACA,KACwB;CACxB,IAAI,CAACA,eAAqB,GACxB;CAGF,MAAM,cAAc,eAAe,WAAW,GAAG;CACjD,IAAI,gBAAgBC,MAAa,WAAW;CAC5C,IAAI,CAAC,eAAe;EAClB,gBAAgB,kBAAkB,cAChCC,MAAY,WAAW,GAAG,CAC5B;EACA,MAAa,aAAa,aAAa;CACzC;CAEA,OAAO,MAAM;AACf;;;;AAKA,eAAsB,IACpB,WACA,KACA,OACA,gBACe;CAEf,MAAM,cAAc,WAAW,KAAK,OADrB,eAAe,SAAS,KAAK,cACK;AACnD;;;;;AAMA,eAAsB,cACpB,WACA,KACA,OACA,gBACe;CACf,IAAI,CAACF,eAAqB,GACxB;CAGF,MAAM,kBAAkB,cACtBG,MAAY,WAAW,KAAK,OAAO,cAAc,CACnD;CAEA,MAAM,cAAc,eAAe,WAAW,GAAG;CACjD,MAAM,IAAI,QAAQ,QAAQ,KAAK;CAC/B,MAAa,aAAa,CAAC;AAC7B;AAEA,eAAsB,KAAK,QAAkC;CAC3D,MAAMC,OAAa,MAAM;AAC3B;AAEA,eAAsB,QAAQ,SAAmC;CAC/D,MAAMC,QAAgB;AACxB"}
@@ -45,10 +45,13 @@ async function withCache(options, fn) {
45
45
  }
46
46
  throw err;
47
47
  }
48
- if (!isUndefined(newValue) && shouldCacheResult(newValue)) await setWithRawTtl(namespace, cacheKey, {
49
- cachedAt: DateTime.local().toISO(),
50
- value: newValue
51
- }, hardTtlMinutes);
48
+ if (!isUndefined(newValue) && shouldCacheResult(newValue)) {
49
+ const newRecord = {
50
+ cachedAt: DateTime.local().toISO(),
51
+ value: newValue
52
+ };
53
+ await setWithRawTtl(namespace, cacheKey, newRecord, hardTtlMinutes);
54
+ }
52
55
  return newValue;
53
56
  } finally {
54
57
  releaseLock();
@@ -1 +1 @@
1
- {"version":3,"file":"with-cache.js","names":["packageCache.get","packageCache.setWithRawTtl"],"sources":["../../../../lib/util/cache/package/with-cache.ts"],"sourcesContent":["import { isUndefined } from '@sindresorhus/is';\nimport { DateTime } from 'luxon';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { acquireLock } from '../../mutex.ts';\nimport * as packageCache from './index.ts';\nimport { resolveTtlValues } from './ttl.ts';\nimport type { CachedRecord, PackageCacheNamespace } from './types.ts';\n\ninterface CachedOptions {\n /**\n * The cache namespace.\n */\n namespace: PackageCacheNamespace;\n\n /**\n * The cache key.\n */\n key: string;\n\n /**\n * The TTL (or expiry) of the key in minutes.\n * @default 30\n */\n ttlMinutes?: number;\n\n /**\n * Whether caching is enabled for this call.\n * When false, the function is called directly without caching.\n * @default true\n */\n cacheable?: boolean;\n\n /**\n * Whether a cache result is safe to use and store for this call.\n * @default value !== undefined\n */\n shouldCacheResult?: (value: unknown) => boolean;\n\n /**\n * Enable extended hard TTL for graceful degradation.\n * When true and upstream errors occur, stale cached data is returned.\n * @default false\n */\n fallback?: boolean;\n}\n\n/**\n * Caches the result of an async function.\n *\n * @param options - Cache options\n * @param fn - The async function to cache\n * @returns The cached or fresh result\n */\nexport async function withCache<T>(\n options: CachedOptions,\n fn: () => T | Promise<T>,\n): Promise<T> {\n const {\n namespace,\n key,\n ttlMinutes = 30,\n cacheable = true,\n fallback = false,\n } = options;\n\n const cachePrivatePackages = GlobalConfig.get('cachePrivatePackages');\n const isCacheable = cachePrivatePackages || cacheable;\n if (!isCacheable) {\n return fn();\n }\n\n function defaultShouldCacheResult(_value: unknown): boolean {\n return true;\n }\n const shouldCacheResult =\n options.shouldCacheResult ?? defaultShouldCacheResult;\n\n // istanbul ignore if -- TODO: add test #40625\n if (!namespace || !key) {\n return fn();\n }\n\n const cacheKey = `cache-decorator:${key}`;\n\n // prevent concurrent processing and cache writes\n const releaseLock = await acquireLock(cacheKey, namespace);\n\n try {\n const cachedRecord = await packageCache.get<CachedRecord>(\n namespace,\n cacheKey,\n );\n\n const { softTtlMinutes, hardTtlMinutes: resolvedHardTtl } =\n resolveTtlValues(namespace, ttlMinutes);\n\n // The separation between \"soft\" and \"hard\" TTL allows us to treat\n // data as obsolete according to the \"soft\" TTL while physically storing it\n // according to the \"hard\" TTL.\n //\n // This helps us return obsolete data in case of upstream server errors,\n // which is more useful than throwing exceptions ourselves.\n //\n // The `fallback` option controls whether this extended TTL behavior is used.\n // When false, the \"soft\" just equals the \"hard\" ttl.\n const hardTtlMinutes = fallback ? resolvedHardTtl : softTtlMinutes;\n\n let fallbackValue: unknown;\n if (cachedRecord && shouldCacheResult(cachedRecord.value)) {\n const now = DateTime.local();\n const cachedAt = DateTime.fromISO(cachedRecord.cachedAt);\n\n const softDeadline = cachedAt.plus({ minutes: softTtlMinutes });\n if (now < softDeadline) {\n return cachedRecord.value as T;\n }\n\n const hardDeadline = cachedAt.plus({ minutes: hardTtlMinutes });\n if (now < hardDeadline) {\n fallbackValue = cachedRecord.value;\n }\n }\n\n let newValue: T;\n try {\n newValue = await fn();\n } catch (err) {\n if (!isUndefined(fallbackValue)) {\n logger.debug(\n { err },\n 'Package cache: callback error, returning stale data',\n );\n return fallbackValue as T;\n }\n throw err;\n }\n\n if (!isUndefined(newValue) && shouldCacheResult(newValue)) {\n const newRecord: CachedRecord = {\n cachedAt: DateTime.local().toISO(),\n value: newValue,\n };\n await packageCache.setWithRawTtl(\n namespace,\n cacheKey,\n newRecord,\n hardTtlMinutes,\n );\n }\n\n return newValue;\n } finally {\n releaseLock();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsDA,eAAsB,UACpB,SACA,IACY;CACZ,MAAM,EACJ,WACA,KACA,aAAa,IACb,YAAY,MACZ,WAAW,UACT;CAIJ,IAAI,EAFyB,aAAa,IAAI,sBACP,KAAK,YAE1C,OAAO,GAAG;CAGZ,SAAS,yBAAyB,QAA0B;EAC1D,OAAO;CACT;CACA,MAAM,oBACJ,QAAQ,qBAAqB;;CAG/B,IAAI,CAAC,aAAa,CAAC,KACjB,OAAO,GAAG;CAGZ,MAAM,WAAW,mBAAmB;CAGpC,MAAM,cAAc,MAAM,YAAY,UAAU,SAAS;CAEzD,IAAI;EACF,MAAM,eAAe,MAAMA,IACzB,WACA,QACF;EAEA,MAAM,EAAE,gBAAgB,gBAAgB,oBACtC,iBAAiB,WAAW,UAAU;EAWxC,MAAM,iBAAiB,WAAW,kBAAkB;EAEpD,IAAI;EACJ,IAAI,gBAAgB,kBAAkB,aAAa,KAAK,GAAG;GACzD,MAAM,MAAM,SAAS,MAAM;GAC3B,MAAM,WAAW,SAAS,QAAQ,aAAa,QAAQ;GAGvD,IAAI,MADiB,SAAS,KAAK,EAAE,SAAS,eAAe,CACxC,GACnB,OAAO,aAAa;GAItB,IAAI,MADiB,SAAS,KAAK,EAAE,SAAS,eAAe,CACxC,GACnB,gBAAgB,aAAa;EAEjC;EAEA,IAAI;EACJ,IAAI;GACF,WAAW,MAAM,GAAG;EACtB,SAAS,KAAK;GACZ,IAAI,CAAC,YAAY,aAAa,GAAG;IAC/B,OAAO,MACL,EAAE,IAAI,GACN,qDACF;IACA,OAAO;GACT;GACA,MAAM;EACR;EAEA,IAAI,CAAC,YAAY,QAAQ,KAAK,kBAAkB,QAAQ,GAKtD,MAAMC,cACJ,WACA,UACA;GANA,UAAU,SAAS,MAAM,CAAC,CAAC,MAAM;GACjC,OAAO;EAKP,GACA,cACF;EAGF,OAAO;CACT,UAAU;EACR,YAAY;CACd;AACF"}
1
+ {"version":3,"file":"with-cache.js","names":["packageCache.get","packageCache.setWithRawTtl"],"sources":["../../../../lib/util/cache/package/with-cache.ts"],"sourcesContent":["import { isUndefined } from '@sindresorhus/is';\nimport { DateTime } from 'luxon';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { acquireLock } from '../../mutex.ts';\nimport * as packageCache from './index.ts';\nimport { resolveTtlValues } from './ttl.ts';\nimport type { CachedRecord, PackageCacheNamespace } from './types.ts';\n\ninterface CachedOptions {\n /**\n * The cache namespace.\n */\n namespace: PackageCacheNamespace;\n\n /**\n * The cache key.\n */\n key: string;\n\n /**\n * The TTL (or expiry) of the key in minutes.\n * @default 30\n */\n ttlMinutes?: number;\n\n /**\n * Whether caching is enabled for this call.\n * When false, the function is called directly without caching.\n * @default true\n */\n cacheable?: boolean;\n\n /**\n * Whether a cache result is safe to use and store for this call.\n * @default value !== undefined\n */\n shouldCacheResult?: (value: unknown) => boolean;\n\n /**\n * Enable extended hard TTL for graceful degradation.\n * When true and upstream errors occur, stale cached data is returned.\n * @default false\n */\n fallback?: boolean;\n}\n\n/**\n * Caches the result of an async function.\n *\n * @param options - Cache options\n * @param fn - The async function to cache\n * @returns The cached or fresh result\n */\nexport async function withCache<T>(\n options: CachedOptions,\n fn: () => T | Promise<T>,\n): Promise<T> {\n const {\n namespace,\n key,\n ttlMinutes = 30,\n cacheable = true,\n fallback = false,\n } = options;\n\n const cachePrivatePackages = GlobalConfig.get('cachePrivatePackages');\n const isCacheable = cachePrivatePackages || cacheable;\n if (!isCacheable) {\n return fn();\n }\n\n function defaultShouldCacheResult(_value: unknown): boolean {\n return true;\n }\n const shouldCacheResult =\n options.shouldCacheResult ?? defaultShouldCacheResult;\n\n // istanbul ignore if -- TODO: add test #40625\n if (!namespace || !key) {\n return fn();\n }\n\n const cacheKey = `cache-decorator:${key}`;\n\n // prevent concurrent processing and cache writes\n const releaseLock = await acquireLock(cacheKey, namespace);\n\n try {\n const cachedRecord = await packageCache.get<CachedRecord>(\n namespace,\n cacheKey,\n );\n\n const { softTtlMinutes, hardTtlMinutes: resolvedHardTtl } =\n resolveTtlValues(namespace, ttlMinutes);\n\n // The separation between \"soft\" and \"hard\" TTL allows us to treat\n // data as obsolete according to the \"soft\" TTL while physically storing it\n // according to the \"hard\" TTL.\n //\n // This helps us return obsolete data in case of upstream server errors,\n // which is more useful than throwing exceptions ourselves.\n //\n // The `fallback` option controls whether this extended TTL behavior is used.\n // When false, the \"soft\" just equals the \"hard\" ttl.\n const hardTtlMinutes = fallback ? resolvedHardTtl : softTtlMinutes;\n\n let fallbackValue: unknown;\n if (cachedRecord && shouldCacheResult(cachedRecord.value)) {\n const now = DateTime.local();\n const cachedAt = DateTime.fromISO(cachedRecord.cachedAt);\n\n const softDeadline = cachedAt.plus({ minutes: softTtlMinutes });\n if (now < softDeadline) {\n return cachedRecord.value as T;\n }\n\n const hardDeadline = cachedAt.plus({ minutes: hardTtlMinutes });\n if (now < hardDeadline) {\n fallbackValue = cachedRecord.value;\n }\n }\n\n let newValue: T;\n try {\n newValue = await fn();\n } catch (err) {\n if (!isUndefined(fallbackValue)) {\n logger.debug(\n { err },\n 'Package cache: callback error, returning stale data',\n );\n return fallbackValue as T;\n }\n throw err;\n }\n\n if (!isUndefined(newValue) && shouldCacheResult(newValue)) {\n const newRecord: CachedRecord = {\n cachedAt: DateTime.local().toISO(),\n value: newValue,\n };\n await packageCache.setWithRawTtl(\n namespace,\n cacheKey,\n newRecord,\n hardTtlMinutes,\n );\n }\n\n return newValue;\n } finally {\n releaseLock();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsDA,eAAsB,UACpB,SACA,IACY;CACZ,MAAM,EACJ,WACA,KACA,aAAa,IACb,YAAY,MACZ,WAAW,UACT;CAIJ,IAAI,EAFyB,aAAa,IAAI,sBACP,KAAK,YAE1C,OAAO,GAAG;CAGZ,SAAS,yBAAyB,QAA0B;EAC1D,OAAO;CACT;CACA,MAAM,oBACJ,QAAQ,qBAAqB;;CAG/B,IAAI,CAAC,aAAa,CAAC,KACjB,OAAO,GAAG;CAGZ,MAAM,WAAW,mBAAmB;CAGpC,MAAM,cAAc,MAAM,YAAY,UAAU,SAAS;CAEzD,IAAI;EACF,MAAM,eAAe,MAAMA,IACzB,WACA,QACF;EAEA,MAAM,EAAE,gBAAgB,gBAAgB,oBACtC,iBAAiB,WAAW,UAAU;EAWxC,MAAM,iBAAiB,WAAW,kBAAkB;EAEpD,IAAI;EACJ,IAAI,gBAAgB,kBAAkB,aAAa,KAAK,GAAG;GACzD,MAAM,MAAM,SAAS,MAAM;GAC3B,MAAM,WAAW,SAAS,QAAQ,aAAa,QAAQ;GAGvD,IAAI,MADiB,SAAS,KAAK,EAAE,SAAS,eAAe,CACxC,GACnB,OAAO,aAAa;GAItB,IAAI,MADiB,SAAS,KAAK,EAAE,SAAS,eAAe,CACxC,GACnB,gBAAgB,aAAa;EAEjC;EAEA,IAAI;EACJ,IAAI;GACF,WAAW,MAAM,GAAG;EACtB,SAAS,KAAK;GACZ,IAAI,CAAC,YAAY,aAAa,GAAG;IAC/B,OAAO,MACL,EAAE,IAAI,GACN,qDACF;IACA,OAAO;GACT;GACA,MAAM;EACR;EAEA,IAAI,CAAC,YAAY,QAAQ,KAAK,kBAAkB,QAAQ,GAAG;GACzD,MAAM,YAA0B;IAC9B,UAAU,SAAS,MAAM,CAAC,CAAC,MAAM;IACjC,OAAO;GACT;GACA,MAAMC,cACJ,WACA,UACA,WACA,cACF;EACF;EAEA,OAAO;CACT,UAAU;EACR,YAAY;CACd;AACF"}
@@ -56,7 +56,7 @@ var RepoCacheBase = class RepoCacheBase {
56
56
  return;
57
57
  }
58
58
  logger.warn({ err: cacheV13.error }, "Repository cache is invalid");
59
- } catch (err) /* istanbul ignore next: not easily testable */ {
59
+ } catch (err) /* istanbul ignore next: not easily testable */ {
60
60
  logger.debug({ err }, "Error reading repository cache");
61
61
  }
62
62
  }
@@ -82,7 +82,8 @@ var RepoCacheBase = class RepoCacheBase {
82
82
  }
83
83
  isModified() {
84
84
  if (!this.oldHash) return;
85
- return hash(safeStringify(this.data)) !== this.oldHash;
85
+ const jsonStr = safeStringify(this.data);
86
+ return hash(jsonStr) !== this.oldHash;
86
87
  }
87
88
  };
88
89
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","names":[],"sources":["../../../../../lib/util/cache/repository/impl/base.ts"],"sourcesContent":["import { isNonEmptyString, isString } from '@sindresorhus/is';\nimport { GlobalConfig } from '../../../../config/global.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport { compressToBase64, decompressFromBase64 } from '../../../compress.ts';\nimport { hash } from '../../../hash.ts';\nimport { safeStringify } from '../../../stringify.ts';\nimport { CACHE_REVISION } from '../common.ts';\nimport { cleanupHttpCache } from '../http-cache.ts';\nimport { RepoCacheRecord } from '../schema.ts';\nimport type { RepoCache, RepoCacheData } from '../types.ts';\n\nexport abstract class RepoCacheBase implements RepoCache {\n protected platform = GlobalConfig.get('platform');\n private oldHash: string | null = null;\n private data: RepoCacheData = {};\n protected readonly repository: string;\n protected readonly fingerprint: string;\n\n protected constructor(repository: string, fingerprint: string) {\n this.repository = repository;\n this.fingerprint = fingerprint;\n }\n\n protected abstract read(): Promise<string | null>;\n\n protected abstract write(data: RepoCacheRecord): Promise<void>;\n\n private static parseData(input: string): RepoCacheData {\n const data: RepoCacheData = JSON.parse(input);\n // istanbul ignore next\n if (data.branches) {\n for (const branch of data.branches) {\n if (branch.branchFingerprint) {\n branch.commitFingerprint = branch.branchFingerprint;\n delete branch.branchFingerprint;\n }\n }\n }\n return data;\n }\n\n private async restore(oldCache: RepoCacheRecord): Promise<void> {\n if (oldCache.fingerprint !== this.fingerprint) {\n logger.debug('Repository cache fingerprint is invalid');\n return;\n }\n const jsonStr = await decompressFromBase64(oldCache.payload);\n this.data = RepoCacheBase.parseData(jsonStr);\n this.oldHash = oldCache.hash;\n }\n\n async load(): Promise<void> {\n try {\n const oldCache = await this.read();\n if (!isString(oldCache)) {\n logger.debug(\n `RepoCacheBase.load() - expecting data of type 'string' received '${typeof oldCache}' instead - skipping`,\n );\n return;\n }\n\n if (!isNonEmptyString(oldCache)) {\n logger.debug('RepoCacheBase.load() - cache file is empty - skipping');\n return;\n }\n\n const cacheV13 = RepoCacheRecord.safeParse(oldCache);\n if (cacheV13.success) {\n await this.restore(cacheV13.data);\n logger.debug('Repository cache is restored from revision 13');\n return;\n }\n\n logger.warn({ err: cacheV13.error }, 'Repository cache is invalid');\n } catch (err) /* istanbul ignore next: not easily testable */ {\n logger.debug({ err }, 'Error reading repository cache');\n }\n }\n\n async save(): Promise<void> {\n cleanupHttpCache(this.data);\n const jsonStr = safeStringify(this.data);\n const hashedJsonStr = hash(jsonStr);\n if (hashedJsonStr === this.oldHash) {\n return;\n }\n\n const revision = CACHE_REVISION;\n const repository = this.repository;\n const fingerprint = this.fingerprint;\n\n const payload = await compressToBase64(jsonStr);\n\n await this.write({\n revision,\n repository,\n fingerprint,\n payload,\n hash: hashedJsonStr,\n });\n }\n\n getData(): RepoCacheData {\n return this.data;\n }\n\n isModified(): boolean | undefined {\n if (!this.oldHash) {\n return undefined;\n }\n const jsonStr = safeStringify(this.data);\n return hash(jsonStr) !== this.oldHash;\n }\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAsB,gBAAtB,MAAsB,cAAmC;CACvD,WAAqB,aAAa,IAAI,UAAU;CAChD,UAAiC;CACjC,OAA8B,CAAC;CAC/B;CACA;CAEA,YAAsB,YAAoB,aAAqB;EAC7D,KAAK,aAAa;EAClB,KAAK,cAAc;CACrB;CAMA,OAAe,UAAU,OAA8B;EACrD,MAAM,OAAsB,KAAK,MAAM,KAAK;;EAE5C,IAAI,KAAK,UACF;QAAA,MAAM,UAAU,KAAK,UACxB,IAAI,OAAO,mBAAmB;IAC5B,OAAO,oBAAoB,OAAO;IAClC,OAAO,OAAO;GAChB;;EAGJ,OAAO;CACT;CAEA,MAAc,QAAQ,UAA0C;EAC9D,IAAI,SAAS,gBAAgB,KAAK,aAAa;GAC7C,OAAO,MAAM,yCAAyC;GACtD;EACF;EACA,MAAM,UAAU,MAAM,qBAAqB,SAAS,OAAO;EAC3D,KAAK,OAAO,cAAc,UAAU,OAAO;EAC3C,KAAK,UAAU,SAAS;CAC1B;CAEA,MAAM,OAAsB;EAC1B,IAAI;GACF,MAAM,WAAW,MAAM,KAAK,KAAK;GACjC,IAAI,CAAC,SAAS,QAAQ,GAAG;IACvB,OAAO,MACL,oEAAoE,OAAO,SAAS,qBACtF;IACA;GACF;GAEA,IAAI,CAAC,iBAAiB,QAAQ,GAAG;IAC/B,OAAO,MAAM,uDAAuD;IACpE;GACF;GAEA,MAAM,WAAW,gBAAgB,UAAU,QAAQ;GACnD,IAAI,SAAS,SAAS;IACpB,MAAM,KAAK,QAAQ,SAAS,IAAI;IAChC,OAAO,MAAM,+CAA+C;IAC5D;GACF;GAEA,OAAO,KAAK,EAAE,KAAK,SAAS,MAAM,GAAG,6BAA6B;EACpE,SAAS,uDAAqD;GAC5D,OAAO,MAAM,EAAE,IAAI,GAAG,gCAAgC;EACxD;CACF;CAEA,MAAM,OAAsB;EAC1B,iBAAiB,KAAK,IAAI;EAC1B,MAAM,UAAU,cAAc,KAAK,IAAI;EACvC,MAAM,gBAAgB,KAAK,OAAO;EAClC,IAAI,kBAAkB,KAAK,SACzB;EAGF,MAAM,WAAA;EACN,MAAM,aAAa,KAAK;EACxB,MAAM,cAAc,KAAK;EAEzB,MAAM,UAAU,MAAM,iBAAiB,OAAO;EAE9C,MAAM,KAAK,MAAM;GACf;GACA;GACA;GACA;GACA,MAAM;EACR,CAAC;CACH;CAEA,UAAyB;EACvB,OAAO,KAAK;CACd;CAEA,aAAkC;EAChC,IAAI,CAAC,KAAK,SACR;EAGF,OAAO,KADS,cAAc,KAAK,IACjB,CAAC,MAAM,KAAK;CAChC;AACF"}
1
+ {"version":3,"file":"base.js","names":[],"sources":["../../../../../lib/util/cache/repository/impl/base.ts"],"sourcesContent":["import { isNonEmptyString, isString } from '@sindresorhus/is';\nimport { GlobalConfig } from '../../../../config/global.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport { compressToBase64, decompressFromBase64 } from '../../../compress.ts';\nimport { hash } from '../../../hash.ts';\nimport { safeStringify } from '../../../stringify.ts';\nimport { CACHE_REVISION } from '../common.ts';\nimport { cleanupHttpCache } from '../http-cache.ts';\nimport { RepoCacheRecord } from '../schema.ts';\nimport type { RepoCache, RepoCacheData } from '../types.ts';\n\nexport abstract class RepoCacheBase implements RepoCache {\n protected platform = GlobalConfig.get('platform');\n private oldHash: string | null = null;\n private data: RepoCacheData = {};\n protected readonly repository: string;\n protected readonly fingerprint: string;\n\n protected constructor(repository: string, fingerprint: string) {\n this.repository = repository;\n this.fingerprint = fingerprint;\n }\n\n protected abstract read(): Promise<string | null>;\n\n protected abstract write(data: RepoCacheRecord): Promise<void>;\n\n private static parseData(input: string): RepoCacheData {\n const data: RepoCacheData = JSON.parse(input);\n // istanbul ignore next\n if (data.branches) {\n for (const branch of data.branches) {\n if (branch.branchFingerprint) {\n branch.commitFingerprint = branch.branchFingerprint;\n delete branch.branchFingerprint;\n }\n }\n }\n return data;\n }\n\n private async restore(oldCache: RepoCacheRecord): Promise<void> {\n if (oldCache.fingerprint !== this.fingerprint) {\n logger.debug('Repository cache fingerprint is invalid');\n return;\n }\n const jsonStr = await decompressFromBase64(oldCache.payload);\n this.data = RepoCacheBase.parseData(jsonStr);\n this.oldHash = oldCache.hash;\n }\n\n async load(): Promise<void> {\n try {\n const oldCache = await this.read();\n if (!isString(oldCache)) {\n logger.debug(\n `RepoCacheBase.load() - expecting data of type 'string' received '${typeof oldCache}' instead - skipping`,\n );\n return;\n }\n\n if (!isNonEmptyString(oldCache)) {\n logger.debug('RepoCacheBase.load() - cache file is empty - skipping');\n return;\n }\n\n const cacheV13 = RepoCacheRecord.safeParse(oldCache);\n if (cacheV13.success) {\n await this.restore(cacheV13.data);\n logger.debug('Repository cache is restored from revision 13');\n return;\n }\n\n logger.warn({ err: cacheV13.error }, 'Repository cache is invalid');\n } catch (err) /* istanbul ignore next: not easily testable */ {\n logger.debug({ err }, 'Error reading repository cache');\n }\n }\n\n async save(): Promise<void> {\n cleanupHttpCache(this.data);\n const jsonStr = safeStringify(this.data);\n const hashedJsonStr = hash(jsonStr);\n if (hashedJsonStr === this.oldHash) {\n return;\n }\n\n const revision = CACHE_REVISION;\n const repository = this.repository;\n const fingerprint = this.fingerprint;\n\n const payload = await compressToBase64(jsonStr);\n\n await this.write({\n revision,\n repository,\n fingerprint,\n payload,\n hash: hashedJsonStr,\n });\n }\n\n getData(): RepoCacheData {\n return this.data;\n }\n\n isModified(): boolean | undefined {\n if (!this.oldHash) {\n return undefined;\n }\n const jsonStr = safeStringify(this.data);\n return hash(jsonStr) !== this.oldHash;\n }\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAsB,gBAAtB,MAAsB,cAAmC;CACvD,WAAqB,aAAa,IAAI,UAAU;CAChD,UAAiC;CACjC,OAA8B,CAAC;CAC/B;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B,MAAM,UAAU,MAAM,iBAAiB,OAAO;EAE9C,MAAM,KAAK,MAAM;GACf;GACA;GACA;GACA;GACA,MAAM;EACR,CAAC;CACH;CAEA,UAAyB;EACvB,OAAO,KAAK;CACd;CAEA,aAAkC;EAChC,IAAI,CAAC,KAAK,SACR;EAEF,MAAM,UAAU,cAAc,KAAK,IAAI;EACvC,OAAO,KAAK,OAAO,MAAM,KAAK;CAChC;AACF"}
@@ -21,7 +21,8 @@ var RepoCacheLocal = class extends RepoCacheBase {
21
21
  return null;
22
22
  }
23
23
  async write(data) {
24
- await outputCacheFile(this.getCacheFileName(), JSON.stringify(data));
24
+ const cacheFileName = this.getCacheFileName();
25
+ await outputCacheFile(cacheFileName, JSON.stringify(data));
25
26
  }
26
27
  getCacheFileName() {
27
28
  return getLocalCacheFileName(this.platform, this.repository);
@@ -1 +1 @@
1
- {"version":3,"file":"local.js","names":[],"sources":["../../../../../lib/util/cache/repository/impl/local.ts"],"sourcesContent":["import { logger } from '../../../../logger/index.ts';\nimport {\n cachePathExists,\n outputCacheFile,\n readCacheFile,\n} from '../../../fs/index.ts';\nimport { getLocalCacheFileName } from '../common.ts';\nimport type { RepoCacheRecord } from '../schema.ts';\nimport { RepoCacheBase } from './base.ts';\n\nexport class RepoCacheLocal extends RepoCacheBase {\n constructor(repository: string, fingerprint: string) {\n super(repository, fingerprint);\n }\n\n protected async read(): Promise<string | null> {\n const cacheFileName = this.getCacheFileName();\n try {\n // suppress debug logs with errors\n if (!(await cachePathExists(cacheFileName))) {\n return null;\n }\n return await readCacheFile(cacheFileName, 'utf8');\n } catch (err) {\n logger.debug({ err, cacheFileName }, 'Repository local cache not found');\n }\n return null;\n }\n\n protected async write(data: RepoCacheRecord): Promise<void> {\n const cacheFileName = this.getCacheFileName();\n await outputCacheFile(cacheFileName, JSON.stringify(data));\n }\n\n private getCacheFileName(): string {\n return getLocalCacheFileName(this.platform, this.repository);\n }\n}\n"],"mappings":";;;;;AAUA,IAAa,iBAAb,cAAoC,cAAc;CAChD,YAAY,YAAoB,aAAqB;EACnD,MAAM,YAAY,WAAW;CAC/B;CAEA,MAAgB,OAA+B;EAC7C,MAAM,gBAAgB,KAAK,iBAAiB;EAC5C,IAAI;GAEF,IAAI,CAAE,MAAM,gBAAgB,aAAa,GACvC,OAAO;GAET,OAAO,MAAM,cAAc,eAAe,MAAM;EAClD,SAAS,KAAK;GACZ,OAAO,MAAM;IAAE;IAAK;GAAc,GAAG,kCAAkC;EACzE;EACA,OAAO;CACT;CAEA,MAAgB,MAAM,MAAsC;EAE1D,MAAM,gBADgB,KAAK,iBACO,GAAG,KAAK,UAAU,IAAI,CAAC;CAC3D;CAEA,mBAAmC;EACjC,OAAO,sBAAsB,KAAK,UAAU,KAAK,UAAU;CAC7D;AACF"}
1
+ {"version":3,"file":"local.js","names":[],"sources":["../../../../../lib/util/cache/repository/impl/local.ts"],"sourcesContent":["import { logger } from '../../../../logger/index.ts';\nimport {\n cachePathExists,\n outputCacheFile,\n readCacheFile,\n} from '../../../fs/index.ts';\nimport { getLocalCacheFileName } from '../common.ts';\nimport type { RepoCacheRecord } from '../schema.ts';\nimport { RepoCacheBase } from './base.ts';\n\nexport class RepoCacheLocal extends RepoCacheBase {\n constructor(repository: string, fingerprint: string) {\n super(repository, fingerprint);\n }\n\n protected async read(): Promise<string | null> {\n const cacheFileName = this.getCacheFileName();\n try {\n // suppress debug logs with errors\n if (!(await cachePathExists(cacheFileName))) {\n return null;\n }\n return await readCacheFile(cacheFileName, 'utf8');\n } catch (err) {\n logger.debug({ err, cacheFileName }, 'Repository local cache not found');\n }\n return null;\n }\n\n protected async write(data: RepoCacheRecord): Promise<void> {\n const cacheFileName = this.getCacheFileName();\n await outputCacheFile(cacheFileName, JSON.stringify(data));\n }\n\n private getCacheFileName(): string {\n return getLocalCacheFileName(this.platform, this.repository);\n }\n}\n"],"mappings":";;;;;AAUA,IAAa,iBAAb,cAAoC,cAAc;CAChD,YAAY,YAAoB,aAAqB;EACnD,MAAM,YAAY,WAAW;CAC/B;CAEA,MAAgB,OAA+B;EAC7C,MAAM,gBAAgB,KAAK,iBAAiB;EAC5C,IAAI;GAEF,IAAI,CAAE,MAAM,gBAAgB,aAAa,GACvC,OAAO;GAET,OAAO,MAAM,cAAc,eAAe,MAAM;EAClD,SAAS,KAAK;GACZ,OAAO,MAAM;IAAE;IAAK;GAAc,GAAG,kCAAkC;EACzE;EACA,OAAO;CACT;CAEA,MAAgB,MAAM,MAAsC;EAC1D,MAAM,gBAAgB,KAAK,iBAAiB;EAC5C,MAAM,gBAAgB,eAAe,KAAK,UAAU,IAAI,CAAC;CAC3D;CAEA,mBAAmC;EACjC,OAAO,sBAAsB,KAAK,UAAU,KAAK,UAAU;CAC7D;AACF"}
@@ -49,7 +49,10 @@ var RepoCacheS3 = class extends RepoCacheBase {
49
49
  };
50
50
  try {
51
51
  await this.s3Client.send(new PutObjectCommand(s3Params));
52
- if (GlobalConfig.get("repositoryCacheForceLocal")) await outputCacheFile(getLocalCacheFileName(this.platform, this.repository), stringifiedCache);
52
+ if (GlobalConfig.get("repositoryCacheForceLocal")) {
53
+ const cacheLocalFileName = getLocalCacheFileName(this.platform, this.repository);
54
+ await outputCacheFile(cacheLocalFileName, stringifiedCache);
55
+ }
53
56
  } catch (err) {
54
57
  logger.warn({ err }, "RepoCacheS3.write() - failure");
55
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"s3.js","names":[],"sources":["../../../../../lib/util/cache/repository/impl/s3.ts"],"sourcesContent":["import { Readable } from 'node:stream';\nimport type {\n GetObjectCommandInput,\n PutObjectCommandInput,\n} from '@aws-sdk/client-s3';\nimport { GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3';\nimport { GlobalConfig } from '../../../../config/global.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport { outputCacheFile } from '../../../fs/index.ts';\nimport { getS3Client, parseS3Url } from '../../../s3.ts';\nimport { streamToString } from '../../../streams.ts';\nimport { getLocalCacheFileName } from '../common.ts';\nimport type { RepoCacheRecord } from '../schema.ts';\nimport { RepoCacheBase } from './base.ts';\n\nexport class RepoCacheS3 extends RepoCacheBase {\n private readonly s3Client;\n private readonly bucket;\n private readonly dir;\n\n constructor(repository: string, fingerprint: string, url: string) {\n super(repository, fingerprint);\n const { Bucket, Key } = parseS3Url(url)!;\n this.dir = this.getCacheFolder(Key);\n this.bucket = Bucket;\n this.s3Client = getS3Client();\n }\n\n async read(): Promise<string | null> {\n const cacheFileName = this.getCacheFileName();\n const s3Params: GetObjectCommandInput = {\n Bucket: this.bucket,\n Key: cacheFileName,\n };\n try {\n const { Body: res } = await this.s3Client.send(\n new GetObjectCommand(s3Params),\n );\n if (res instanceof Readable) {\n logger.debug('RepoCacheS3.read() - success');\n return await streamToString(res);\n }\n logger.warn(\n { returnType: typeof res },\n 'RepoCacheS3.read() - failure - got unexpected return type',\n );\n } catch (err) {\n // https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html\n if (err.name === 'NoSuchKey') {\n logger.debug('RepoCacheS3.read() - No cached file found');\n } else {\n logger.warn({ err }, 'RepoCacheS3.read() - failure');\n }\n }\n return null;\n }\n\n async write(data: RepoCacheRecord): Promise<void> {\n const cacheFileName = this.getCacheFileName();\n const stringifiedCache = JSON.stringify(data);\n const s3Params: PutObjectCommandInput = {\n Bucket: this.bucket,\n Key: cacheFileName,\n Body: stringifiedCache,\n ContentType: 'application/json',\n };\n try {\n await this.s3Client.send(new PutObjectCommand(s3Params));\n if (GlobalConfig.get('repositoryCacheForceLocal')) {\n const cacheLocalFileName = getLocalCacheFileName(\n this.platform,\n this.repository,\n );\n await outputCacheFile(cacheLocalFileName, stringifiedCache);\n }\n } catch (err) {\n logger.warn({ err }, 'RepoCacheS3.write() - failure');\n }\n }\n\n private getCacheFolder(pathname: string | undefined): string {\n if (!pathname) {\n return '';\n }\n\n if (pathname.endsWith('/')) {\n return pathname;\n }\n\n logger.warn(\n { pathname },\n 'RepoCacheS3.getCacheFolder() - appending missing trailing slash to pathname',\n );\n return `${pathname}/`;\n }\n\n private getCacheFileName(): string {\n return `${this.dir}${this.platform}/${this.repository}/cache.json`;\n }\n}\n"],"mappings":";;;;;;;;;;AAeA,IAAa,cAAb,cAAiC,cAAc;CAC7C;CACA;CACA;CAEA,YAAY,YAAoB,aAAqB,KAAa;EAChE,MAAM,YAAY,WAAW;EAC7B,MAAM,EAAE,QAAQ,QAAQ,WAAW,GAAG;EACtC,KAAK,MAAM,KAAK,eAAe,GAAG;EAClC,KAAK,SAAS;EACd,KAAK,WAAW,YAAY;CAC9B;CAEA,MAAM,OAA+B;EACnC,MAAM,gBAAgB,KAAK,iBAAiB;EAC5C,MAAM,WAAkC;GACtC,QAAQ,KAAK;GACb,KAAK;EACP;EACA,IAAI;GACF,MAAM,EAAE,MAAM,QAAQ,MAAM,KAAK,SAAS,KACxC,IAAI,iBAAiB,QAAQ,CAC/B;GACA,IAAI,eAAe,UAAU;IAC3B,OAAO,MAAM,8BAA8B;IAC3C,OAAO,MAAM,eAAe,GAAG;GACjC;GACA,OAAO,KACL,EAAE,YAAY,OAAO,IAAI,GACzB,2DACF;EACF,SAAS,KAAK;GAEZ,IAAI,IAAI,SAAS,aACf,OAAO,MAAM,2CAA2C;QAExD,OAAO,KAAK,EAAE,IAAI,GAAG,8BAA8B;EAEvD;EACA,OAAO;CACT;CAEA,MAAM,MAAM,MAAsC;EAChD,MAAM,gBAAgB,KAAK,iBAAiB;EAC5C,MAAM,mBAAmB,KAAK,UAAU,IAAI;EAC5C,MAAM,WAAkC;GACtC,QAAQ,KAAK;GACb,KAAK;GACL,MAAM;GACN,aAAa;EACf;EACA,IAAI;GACF,MAAM,KAAK,SAAS,KAAK,IAAI,iBAAiB,QAAQ,CAAC;GACvD,IAAI,aAAa,IAAI,2BAA2B,GAK9C,MAAM,gBAJqB,sBACzB,KAAK,UACL,KAAK,UAEgC,GAAG,gBAAgB;EAE9D,SAAS,KAAK;GACZ,OAAO,KAAK,EAAE,IAAI,GAAG,+BAA+B;EACtD;CACF;CAEA,eAAuB,UAAsC;EAC3D,IAAI,CAAC,UACH,OAAO;EAGT,IAAI,SAAS,SAAS,GAAG,GACvB,OAAO;EAGT,OAAO,KACL,EAAE,SAAS,GACX,6EACF;EACA,OAAO,GAAG,SAAS;CACrB;CAEA,mBAAmC;EACjC,OAAO,GAAG,KAAK,MAAM,KAAK,SAAS,GAAG,KAAK,WAAW;CACxD;AACF"}
1
+ {"version":3,"file":"s3.js","names":[],"sources":["../../../../../lib/util/cache/repository/impl/s3.ts"],"sourcesContent":["import { Readable } from 'node:stream';\nimport type {\n GetObjectCommandInput,\n PutObjectCommandInput,\n} from '@aws-sdk/client-s3';\nimport { GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3';\nimport { GlobalConfig } from '../../../../config/global.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport { outputCacheFile } from '../../../fs/index.ts';\nimport { getS3Client, parseS3Url } from '../../../s3.ts';\nimport { streamToString } from '../../../streams.ts';\nimport { getLocalCacheFileName } from '../common.ts';\nimport type { RepoCacheRecord } from '../schema.ts';\nimport { RepoCacheBase } from './base.ts';\n\nexport class RepoCacheS3 extends RepoCacheBase {\n private readonly s3Client;\n private readonly bucket;\n private readonly dir;\n\n constructor(repository: string, fingerprint: string, url: string) {\n super(repository, fingerprint);\n const { Bucket, Key } = parseS3Url(url)!;\n this.dir = this.getCacheFolder(Key);\n this.bucket = Bucket;\n this.s3Client = getS3Client();\n }\n\n async read(): Promise<string | null> {\n const cacheFileName = this.getCacheFileName();\n const s3Params: GetObjectCommandInput = {\n Bucket: this.bucket,\n Key: cacheFileName,\n };\n try {\n const { Body: res } = await this.s3Client.send(\n new GetObjectCommand(s3Params),\n );\n if (res instanceof Readable) {\n logger.debug('RepoCacheS3.read() - success');\n return await streamToString(res);\n }\n logger.warn(\n { returnType: typeof res },\n 'RepoCacheS3.read() - failure - got unexpected return type',\n );\n } catch (err) {\n // https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html\n if (err.name === 'NoSuchKey') {\n logger.debug('RepoCacheS3.read() - No cached file found');\n } else {\n logger.warn({ err }, 'RepoCacheS3.read() - failure');\n }\n }\n return null;\n }\n\n async write(data: RepoCacheRecord): Promise<void> {\n const cacheFileName = this.getCacheFileName();\n const stringifiedCache = JSON.stringify(data);\n const s3Params: PutObjectCommandInput = {\n Bucket: this.bucket,\n Key: cacheFileName,\n Body: stringifiedCache,\n ContentType: 'application/json',\n };\n try {\n await this.s3Client.send(new PutObjectCommand(s3Params));\n if (GlobalConfig.get('repositoryCacheForceLocal')) {\n const cacheLocalFileName = getLocalCacheFileName(\n this.platform,\n this.repository,\n );\n await outputCacheFile(cacheLocalFileName, stringifiedCache);\n }\n } catch (err) {\n logger.warn({ err }, 'RepoCacheS3.write() - failure');\n }\n }\n\n private getCacheFolder(pathname: string | undefined): string {\n if (!pathname) {\n return '';\n }\n\n if (pathname.endsWith('/')) {\n return pathname;\n }\n\n logger.warn(\n { pathname },\n 'RepoCacheS3.getCacheFolder() - appending missing trailing slash to pathname',\n );\n return `${pathname}/`;\n }\n\n private getCacheFileName(): string {\n return `${this.dir}${this.platform}/${this.repository}/cache.json`;\n }\n}\n"],"mappings":";;;;;;;;;;AAeA,IAAa,cAAb,cAAiC,cAAc;CAC7C;CACA;CACA;CAEA,YAAY,YAAoB,aAAqB,KAAa;EAChE,MAAM,YAAY,WAAW;EAC7B,MAAM,EAAE,QAAQ,QAAQ,WAAW,GAAG;EACtC,KAAK,MAAM,KAAK,eAAe,GAAG;EAClC,KAAK,SAAS;EACd,KAAK,WAAW,YAAY;CAC9B;CAEA,MAAM,OAA+B;EACnC,MAAM,gBAAgB,KAAK,iBAAiB;EAC5C,MAAM,WAAkC;GACtC,QAAQ,KAAK;GACb,KAAK;EACP;EACA,IAAI;GACF,MAAM,EAAE,MAAM,QAAQ,MAAM,KAAK,SAAS,KACxC,IAAI,iBAAiB,QAAQ,CAC/B;GACA,IAAI,eAAe,UAAU;IAC3B,OAAO,MAAM,8BAA8B;IAC3C,OAAO,MAAM,eAAe,GAAG;GACjC;GACA,OAAO,KACL,EAAE,YAAY,OAAO,IAAI,GACzB,2DACF;EACF,SAAS,KAAK;GAEZ,IAAI,IAAI,SAAS,aACf,OAAO,MAAM,2CAA2C;QAExD,OAAO,KAAK,EAAE,IAAI,GAAG,8BAA8B;EAEvD;EACA,OAAO;CACT;CAEA,MAAM,MAAM,MAAsC;EAChD,MAAM,gBAAgB,KAAK,iBAAiB;EAC5C,MAAM,mBAAmB,KAAK,UAAU,IAAI;EAC5C,MAAM,WAAkC;GACtC,QAAQ,KAAK;GACb,KAAK;GACL,MAAM;GACN,aAAa;EACf;EACA,IAAI;GACF,MAAM,KAAK,SAAS,KAAK,IAAI,iBAAiB,QAAQ,CAAC;GACvD,IAAI,aAAa,IAAI,2BAA2B,GAAG;IACjD,MAAM,qBAAqB,sBACzB,KAAK,UACL,KAAK,UACP;IACA,MAAM,gBAAgB,oBAAoB,gBAAgB;GAC5D;EACF,SAAS,KAAK;GACZ,OAAO,KAAK,EAAE,IAAI,GAAG,+BAA+B;EACtD;CACF;CAEA,eAAuB,UAAsC;EAC3D,IAAI,CAAC,UACH,OAAO;EAGT,IAAI,SAAS,SAAS,GAAG,GACvB,OAAO;EAGT,OAAO,KACL,EAAE,SAAS,GACX,6EACF;EACA,OAAO,GAAG,SAAS;CACrB;CAEA,mBAAmC;EACjC,OAAO,GAAG,KAAK,MAAM,KAAK,SAAS,GAAG,KAAK,WAAW;CACxD;AACF"}
package/dist/util/date.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DateTime } from "luxon";
2
2
  //#region lib/util/date.ts
3
- const ONE_MINUTE_MS = 60 * 1e3;
3
+ const ONE_MINUTE_MS = 6e4;
4
4
  function getElapsedDays(timestamp, floor = true) {
5
5
  const currentVersionTimestampDate = DateTime.fromISO(timestamp);
6
6
  const diffInDays = DateTime.now().diff(currentVersionTimestampDate, "days").as("days");
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","names":[],"sources":["../../lib/util/date.ts"],"sourcesContent":["import { DateTime } from 'luxon';\n\nconst ONE_MINUTE_MS = 60 * 1000;\n\nexport function getElapsedDays(timestamp: string, floor = true): number {\n const currentVersionTimestampDate = DateTime.fromISO(timestamp);\n const now = DateTime.now();\n const diffInDays = now.diff(currentVersionTimestampDate, 'days').as('days');\n if (floor) {\n return Math.floor(diffInDays);\n }\n\n return diffInDays;\n}\n\nexport function getElapsedMinutes(date: Date): number {\n return Math.floor((new Date().getTime() - date.getTime()) / ONE_MINUTE_MS);\n}\n\nexport function getElapsedHours(date: Date | string): number {\n const pastDate =\n typeof date === 'string'\n ? DateTime.fromISO(date)\n : DateTime.fromJSDate(date);\n\n if (!pastDate.isValid) {\n return 0;\n }\n\n const diff = DateTime.now().diff(pastDate, 'hours');\n return Math.floor(diff.hours);\n}\n\nexport function getElapsedMs(timestamp: string): number {\n return new Date().getTime() - new Date(timestamp).getTime();\n}\n"],"mappings":";;AAEA,MAAM,gBAAgB,KAAK;AAE3B,SAAgB,eAAe,WAAmB,QAAQ,MAAc;CACtE,MAAM,8BAA8B,SAAS,QAAQ,SAAS;CAE9D,MAAM,aADM,SAAS,IACA,CAAC,CAAC,KAAK,6BAA6B,MAAM,CAAC,CAAC,GAAG,MAAM;CAC1E,IAAI,OACF,OAAO,KAAK,MAAM,UAAU;CAG9B,OAAO;AACT;AAEA,SAAgB,kBAAkB,MAAoB;CACpD,OAAO,KAAK,wBAAO,IAAI,KAAK,EAAA,CAAE,QAAQ,IAAI,KAAK,QAAQ,KAAK,aAAa;AAC3E;AAEA,SAAgB,gBAAgB,MAA6B;CAC3D,MAAM,WACJ,OAAO,SAAS,WACZ,SAAS,QAAQ,IAAI,IACrB,SAAS,WAAW,IAAI;CAE9B,IAAI,CAAC,SAAS,SACZ,OAAO;CAGT,MAAM,OAAO,SAAS,IAAI,CAAC,CAAC,KAAK,UAAU,OAAO;CAClD,OAAO,KAAK,MAAM,KAAK,KAAK;AAC9B;AAEA,SAAgB,aAAa,WAA2B;CACtD,wBAAO,IAAI,KAAK,EAAA,CAAE,QAAQ,IAAI,IAAI,KAAK,SAAS,CAAC,CAAC,QAAQ;AAC5D"}
1
+ {"version":3,"file":"date.js","names":[],"sources":["../../lib/util/date.ts"],"sourcesContent":["import { DateTime } from 'luxon';\n\nconst ONE_MINUTE_MS = 60 * 1000;\n\nexport function getElapsedDays(timestamp: string, floor = true): number {\n const currentVersionTimestampDate = DateTime.fromISO(timestamp);\n const now = DateTime.now();\n const diffInDays = now.diff(currentVersionTimestampDate, 'days').as('days');\n if (floor) {\n return Math.floor(diffInDays);\n }\n\n return diffInDays;\n}\n\nexport function getElapsedMinutes(date: Date): number {\n return Math.floor((new Date().getTime() - date.getTime()) / ONE_MINUTE_MS);\n}\n\nexport function getElapsedHours(date: Date | string): number {\n const pastDate =\n typeof date === 'string'\n ? DateTime.fromISO(date)\n : DateTime.fromJSDate(date);\n\n if (!pastDate.isValid) {\n return 0;\n }\n\n const diff = DateTime.now().diff(pastDate, 'hours');\n return Math.floor(diff.hours);\n}\n\nexport function getElapsedMs(timestamp: string): number {\n return new Date().getTime() - new Date(timestamp).getTime();\n}\n"],"mappings":";;AAEA,MAAM,gBAAgB;AAEtB,SAAgB,eAAe,WAAmB,QAAQ,MAAc;CACtE,MAAM,8BAA8B,SAAS,QAAQ,SAAS;CAE9D,MAAM,aADM,SAAS,IACA,CAAC,CAAC,KAAK,6BAA6B,MAAM,CAAC,CAAC,GAAG,MAAM;CAC1E,IAAI,OACF,OAAO,KAAK,MAAM,UAAU;CAG9B,OAAO;AACT;AAEA,SAAgB,kBAAkB,MAAoB;CACpD,OAAO,KAAK,wBAAO,IAAI,KAAK,EAAA,CAAE,QAAQ,IAAI,KAAK,QAAQ,KAAK,aAAa;AAC3E;AAEA,SAAgB,gBAAgB,MAA6B;CAC3D,MAAM,WACJ,OAAO,SAAS,WACZ,SAAS,QAAQ,IAAI,IACrB,SAAS,WAAW,IAAI;CAE9B,IAAI,CAAC,SAAS,SACZ,OAAO;CAGT,MAAM,OAAO,SAAS,IAAI,CAAC,CAAC,KAAK,UAAU,OAAO;CAClD,OAAO,KAAK,MAAM,KAAK,KAAK;AAC9B;AAEA,SAAgB,aAAa,WAA2B;CACtD,wBAAO,IAAI,KAAK,EAAA,CAAE,QAAQ,IAAI,IAAI,KAAK,SAAS,CAAC,CAAC,QAAQ;AAC5D"}
@@ -79,12 +79,16 @@ function unemojify(text) {
79
79
  lazyInitMappings();
80
80
  return text.replace(emojiRegex, (emoji) => {
81
81
  const hexCode = stripHexCode(fromUnicodeToHexcode(emoji));
82
- return coerceString(shortCodesByHex.get(hexCode), "�");
82
+ const shortCode = shortCodesByHex.get(hexCode);
83
+ return coerceString(shortCode, "�");
83
84
  });
84
85
  }
85
86
  function stripEmoji(emoji) {
86
87
  const hexCode = stripHexCode(fromUnicodeToHexcode(emoji));
87
- if (hexCode) return fromCodepointToUnicode(fromHexcodeToCodepoint(hexCode));
88
+ if (hexCode) {
89
+ const codePoint = fromHexcodeToCodepoint(hexCode);
90
+ return fromCodepointToUnicode(codePoint);
91
+ }
88
92
  return "";
89
93
  }
90
94
  function stripEmojis(input) {
@@ -1 +1 @@
1
- {"version":3,"file":"emoji.js","names":["dataFiles"],"sources":["../../lib/util/emoji.ts"],"sourcesContent":["import mathiasBynensEmojiRegex from 'emoji-regex';\nimport {\n fromCodepointToUnicode,\n fromHexcodeToCodepoint,\n fromUnicodeToHexcode,\n} from 'emojibase';\nimport emojibaseEmojiRegex from 'emojibase-regex/emoji.js';\nimport SHORTCODE_REGEX from 'emojibase-regex/shortcode.js';\nimport { z } from 'zod/v4';\nimport type { RenovateConfig } from '../config/types.ts';\nimport dataFiles from '../data-files.generated.ts';\nimport { logger } from '../logger/index.ts';\nimport { regEx } from './regex.ts';\nimport { Result } from './result.ts';\nimport { Json } from './schema-utils/index.ts';\nimport { coerceString } from './string.ts';\n\nlet unicodeEmoji = true;\n\nlet mappingsInitialized = false;\nconst shortCodesByHex = new Map<string, string>();\nconst hexCodesByShort = new Map<string, string>();\n\nconst EmojiShortcodes = Json.pipe(\n z.record(\n z.string(),\n z.union([z.string().transform((val) => [val]), z.array(z.string())]),\n ),\n);\ntype EmojiShortcodes = z.infer<typeof EmojiShortcodes>;\n\nconst patchedEmojis: EmojiShortcodes = {\n '26A0-FE0F': ['warning'], // Colorful warning (⚠️) instead of black and white (⚠)\n '2139-FE0F': ['information_source'], // Colorful info (ℹ️) instead of black and white (ℹ)\n};\n\nfunction initMapping(mapping: EmojiShortcodes): void {\n for (const [hex, shortcodes] of Object.entries(mapping)) {\n const mainShortcode = `:${shortcodes[0]}:`;\n\n shortCodesByHex.set(hex, mainShortcode);\n shortCodesByHex.set(stripHexCode(hex), mainShortcode);\n\n for (const shortcode of shortcodes) {\n hexCodesByShort.set(`:${shortcode}:`, hex);\n }\n }\n}\n\nfunction lazyInitMappings(): void {\n if (!mappingsInitialized) {\n const githubShortcodes = dataFiles.get(\n 'node_modules/emojibase-data/en/shortcodes/github.json',\n );\n\n Result.parse(githubShortcodes, EmojiShortcodes)\n .onValue((data) => {\n initMapping(data);\n initMapping(patchedEmojis);\n mappingsInitialized = true;\n })\n .onError(\n /* istanbul ignore next */\n (err) => {\n logger.warn({ err }, 'Unable to parse emoji shortcodes');\n },\n );\n }\n}\n\nexport function setEmojiConfig(config: RenovateConfig): void {\n unicodeEmoji = !!config.unicodeEmoji;\n}\n\nconst shortCodeRegex = regEx(\n (SHORTCODE_REGEX as unknown as RegExp).source,\n 'g',\n);\n\nexport function emojify(text: string): string {\n if (!unicodeEmoji) {\n return text;\n }\n lazyInitMappings();\n return text.replace(shortCodeRegex, (shortCode) => {\n const hexCode = hexCodesByShort.get(shortCode);\n return hexCode\n ? fromCodepointToUnicode(fromHexcodeToCodepoint(hexCode))\n : shortCode;\n });\n}\n\nconst emojiRegexSrc = [emojibaseEmojiRegex, mathiasBynensEmojiRegex()].map(\n (r) => (r as RegExp).source,\n);\nconst emojiRegex = new RegExp(`(?:${emojiRegexSrc.join('|')})`, 'g'); // TODO #12875 cannot figure it out\nconst excludedModifiers = new Set([\n '20E3',\n '200D',\n 'FE0E',\n 'FE0F',\n '1F3FB',\n '1F3FC',\n '1F3FD',\n '1F3FE',\n '1F3FF',\n '1F9B0',\n '1F9B1',\n '1F9B2',\n '1F9B3',\n]);\n\nexport function stripHexCode(input: string): string {\n return input\n .split('-')\n .filter((modifier) => !excludedModifiers.has(modifier))\n .join('-');\n}\n\nexport function unemojify(text: string): string {\n if (unicodeEmoji) {\n return text;\n }\n lazyInitMappings();\n return text.replace(emojiRegex, (emoji) => {\n const hexCode = stripHexCode(fromUnicodeToHexcode(emoji));\n const shortCode = shortCodesByHex.get(hexCode);\n return coerceString(shortCode, '�');\n });\n}\n\nfunction stripEmoji(emoji: string): string {\n const hexCode = stripHexCode(fromUnicodeToHexcode(emoji));\n // `hexCode` could be empty if `emoji` is a modifier character that isn't\n // modifying anything\n if (hexCode) {\n const codePoint = fromHexcodeToCodepoint(hexCode);\n return fromCodepointToUnicode(codePoint);\n }\n return '';\n}\n\nexport function stripEmojis(input: string): string {\n return input.replace(emojiRegex, stripEmoji);\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAI,eAAe;AAEnB,IAAI,sBAAsB;AAC1B,MAAM,kCAAkB,IAAI,IAAoB;AAChD,MAAM,kCAAkB,IAAI,IAAoB;AAEhD,MAAM,kBAAkB,KAAK,KAC3B,EAAE,OACA,EAAE,OAAO,GACT,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CACrE,CACF;AAGA,MAAM,gBAAiC;CACrC,aAAa,CAAC,SAAS;CACvB,aAAa,CAAC,oBAAoB;AACpC;AAEA,SAAS,YAAY,SAAgC;CACnD,KAAK,MAAM,CAAC,KAAK,eAAe,OAAO,QAAQ,OAAO,GAAG;EACvD,MAAM,gBAAgB,IAAI,WAAW,GAAG;EAExC,gB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CAET,iBAAiB;CACjB,OAAO,KAAK,QAAQ,aAAa,UAAU;EACzC,MAAM,UAAU,aAAa,qBAAqB,KAAK,CAAC;EAExD,OAAO,aADW,gBAAgB,IAAI,OACV,GAAG,GAAG;CACpC,CAAC;AACH;AAEA,SAAS,WAAW,OAAuB;CACzC,MAAM,UAAU,aAAa,qBAAqB,KAAK,CAAC;CAGxD,IAAI,SAEF,OAAO,uBADW,uBAAuB,OACH,CAAC;CAEzC,OAAO;AACT;AAEA,SAAgB,YAAY,OAAuB;CACjD,OAAO,MAAM,QAAQ,YAAY,UAAU;AAC7C"}
1
+ {"version":3,"file":"emoji.js","names":["dataFiles"],"sources":["../../lib/util/emoji.ts"],"sourcesContent":["import mathiasBynensEmojiRegex from 'emoji-regex';\nimport {\n fromCodepointToUnicode,\n fromHexcodeToCodepoint,\n fromUnicodeToHexcode,\n} from 'emojibase';\nimport emojibaseEmojiRegex from 'emojibase-regex/emoji.js';\nimport SHORTCODE_REGEX from 'emojibase-regex/shortcode.js';\nimport { z } from 'zod/v4';\nimport type { RenovateConfig } from '../config/types.ts';\nimport dataFiles from '../data-files.generated.ts';\nimport { logger } from '../logger/index.ts';\nimport { regEx } from './regex.ts';\nimport { Result } from './result.ts';\nimport { Json } from './schema-utils/index.ts';\nimport { coerceString } from './string.ts';\n\nlet unicodeEmoji = true;\n\nlet mappingsInitialized = false;\nconst shortCodesByHex = new Map<string, string>();\nconst hexCodesByShort = new Map<string, string>();\n\nconst EmojiShortcodes = Json.pipe(\n z.record(\n z.string(),\n z.union([z.string().transform((val) => [val]), z.array(z.string())]),\n ),\n);\ntype EmojiShortcodes = z.infer<typeof EmojiShortcodes>;\n\nconst patchedEmojis: EmojiShortcodes = {\n '26A0-FE0F': ['warning'], // Colorful warning (⚠️) instead of black and white (⚠)\n '2139-FE0F': ['information_source'], // Colorful info (ℹ️) instead of black and white (ℹ)\n};\n\nfunction initMapping(mapping: EmojiShortcodes): void {\n for (const [hex, shortcodes] of Object.entries(mapping)) {\n const mainShortcode = `:${shortcodes[0]}:`;\n\n shortCodesByHex.set(hex, mainShortcode);\n shortCodesByHex.set(stripHexCode(hex), mainShortcode);\n\n for (const shortcode of shortcodes) {\n hexCodesByShort.set(`:${shortcode}:`, hex);\n }\n }\n}\n\nfunction lazyInitMappings(): void {\n if (!mappingsInitialized) {\n const githubShortcodes = dataFiles.get(\n 'node_modules/emojibase-data/en/shortcodes/github.json',\n );\n\n Result.parse(githubShortcodes, EmojiShortcodes)\n .onValue((data) => {\n initMapping(data);\n initMapping(patchedEmojis);\n mappingsInitialized = true;\n })\n .onError(\n /* istanbul ignore next */\n (err) => {\n logger.warn({ err }, 'Unable to parse emoji shortcodes');\n },\n );\n }\n}\n\nexport function setEmojiConfig(config: RenovateConfig): void {\n unicodeEmoji = !!config.unicodeEmoji;\n}\n\nconst shortCodeRegex = regEx(\n (SHORTCODE_REGEX as unknown as RegExp).source,\n 'g',\n);\n\nexport function emojify(text: string): string {\n if (!unicodeEmoji) {\n return text;\n }\n lazyInitMappings();\n return text.replace(shortCodeRegex, (shortCode) => {\n const hexCode = hexCodesByShort.get(shortCode);\n return hexCode\n ? fromCodepointToUnicode(fromHexcodeToCodepoint(hexCode))\n : shortCode;\n });\n}\n\nconst emojiRegexSrc = [emojibaseEmojiRegex, mathiasBynensEmojiRegex()].map(\n (r) => (r as RegExp).source,\n);\nconst emojiRegex = new RegExp(`(?:${emojiRegexSrc.join('|')})`, 'g'); // TODO #12875 cannot figure it out\nconst excludedModifiers = new Set([\n '20E3',\n '200D',\n 'FE0E',\n 'FE0F',\n '1F3FB',\n '1F3FC',\n '1F3FD',\n '1F3FE',\n '1F3FF',\n '1F9B0',\n '1F9B1',\n '1F9B2',\n '1F9B3',\n]);\n\nexport function stripHexCode(input: string): string {\n return input\n .split('-')\n .filter((modifier) => !excludedModifiers.has(modifier))\n .join('-');\n}\n\nexport function unemojify(text: string): string {\n if (unicodeEmoji) {\n return text;\n }\n lazyInitMappings();\n return text.replace(emojiRegex, (emoji) => {\n const hexCode = stripHexCode(fromUnicodeToHexcode(emoji));\n const shortCode = shortCodesByHex.get(hexCode);\n return coerceString(shortCode, '�');\n });\n}\n\nfunction stripEmoji(emoji: string): string {\n const hexCode = stripHexCode(fromUnicodeToHexcode(emoji));\n // `hexCode` could be empty if `emoji` is a modifier character that isn't\n // modifying anything\n if (hexCode) {\n const codePoint = fromHexcodeToCodepoint(hexCode);\n return fromCodepointToUnicode(codePoint);\n }\n return '';\n}\n\nexport function stripEmojis(input: string): string {\n return input.replace(emojiRegex, stripEmoji);\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAI,eAAe;AAEnB,IAAI,sBAAsB;AAC1B,MAAM,kCAAkB,IAAI,IAAoB;AAChD,MAAM,kCAAkB,IAAI,IAAoB;AAEhD,MAAM,kBAAkB,KAAK,KAC3B,EAAE,OACA,EAAE,OAAO,GACT,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CACrE,CACF;AAGA,MAAM,gBAAiC;CACrC,aAAa,CAAC,SAAS;CACvB,aAAa,CAAC,oBAAoB;AACpC;AAEA,SAAS,YAAY,SAAgC;CACnD,KAAK,MAAM,CAAC,KAAK,eAAe,OAAO,QAAQ,OAAO,GAAG;EACvD,MAAM,gBAAgB,IAAI,WAAW,GAAG;EAExC,gBAAgB,IAAI,KAAK,aAAa;EACtC,gBAAgB,IAAI,aAAa,GAAG,GAAG,aAAa;EAEpD,KAAK,MAAM,aAAa,YACtB,gBAAgB,IAAI,IAAI,UAAU,IAAI,GAAG;CAE7C;AACF;AAEA,SAAS,mBAAyB;CAChC,IAAI,CAAC,qBAAqB;EACxB,MAAM,mBAAmBA,KAAU,IACjC,uDACF;EAEA,OAAO,MAAM,kBAAkB,eAAe,CAAC,CAC5C,SAAS,SAAS;GACjB,YAAY,IAAI;GAChB,YAAY,aAAa;GACzB,sBAAsB;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AACT;AAEA,SAAgB,YAAY,OAAuB;CACjD,OAAO,MAAM,QAAQ,YAAY,UAAU;AAC7C"}
@@ -66,7 +66,7 @@ function exec(commandArgument, opts) {
66
66
  return new Promise((resolve, reject) => {
67
67
  let cmd = asRawCommand(theCmd);
68
68
  let args = [];
69
- const maxBuffer = opts.maxBuffer ?? 10 * 1024 * 1024;
69
+ const maxBuffer = opts.maxBuffer ?? 10485760;
70
70
  let shell = opts.shell ?? false;
71
71
  if (isCommandWithOptions(commandArgument) && commandArgument.shell !== void 0) shell = commandArgument.shell;
72
72
  if (shell === false) {
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","names":[],"sources":["../../../lib/util/exec/common.ts"],"sourcesContent":["import type { ChildProcess } from 'node:child_process';\nimport type { Readable } from 'node:stream';\nimport { isNullOrUndefined } from '@sindresorhus/is';\nimport { execa } from 'execa';\nimport { join, split } from 'shlex';\nimport { instrument } from '../../instrumentation/index.ts';\nimport { logger } from '../../logger/index.ts';\nimport { getEnv } from '../env.ts';\nimport { sanitize } from '../sanitize.ts';\nimport type { ExecErrorData } from './exec-error.ts';\nimport { ExecError } from './exec-error.ts';\nimport type {\n CommandWithOptions,\n DataListener,\n ExecResult,\n OutputWriter,\n RawExecOptions,\n} from './types.ts';\nimport { asRawCommand, isCommandWithOptions } from './utils.ts';\n\n// https://man7.org/linux/man-pages/man7/signal.7.html#NAME\n// Non TERM/CORE signals\n// The following is step 3. in https://github.com/renovatebot/renovate/issues/16197#issuecomment-1171423890\nconst NONTERM = [\n 'SIGCHLD',\n 'SIGCLD',\n 'SIGCONT',\n 'SIGSTOP',\n 'SIGTSTP',\n 'SIGTTIN',\n 'SIGTTOU',\n 'SIGURG',\n 'SIGWINCH',\n];\n\nconst encoding = 'utf8';\n\nfunction stringify(list: Buffer[], writer: OutputWriter | undefined): string {\n return writer?.toString() ?? Buffer.concat(list).toString(encoding);\n}\n\nfunction initStreamListeners(\n cp: ChildProcess,\n opts: RawExecOptions & { maxBuffer: number },\n): [Buffer[], Buffer[]] {\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n let stdoutLen = 0;\n let stderrLen = 0;\n\n registerDataListeners(cp.stdout, opts.outputListeners?.stdout);\n registerDataListeners(cp.stderr, opts.outputListeners?.stderr);\n\n cp.stdout?.on('data', (chunk: Buffer) => {\n // process.stdout.write(data.toString());\n if (opts.outputWriters?.stdout) {\n opts.outputWriters.stdout.write(chunk);\n return;\n }\n\n const len = Buffer.byteLength(chunk, encoding);\n stdoutLen += len;\n if (stdoutLen > opts.maxBuffer) {\n cp.emit('error', new Error('stdout maxBuffer exceeded'));\n } else {\n stdout.push(chunk);\n }\n });\n\n cp.stderr?.on('data', (chunk: Buffer) => {\n // process.stderr.write(data.toString());\n if (opts.outputWriters?.stderr) {\n opts.outputWriters.stderr.write(chunk);\n return;\n }\n\n const len = Buffer.byteLength(chunk, encoding);\n stderrLen += len;\n if (stderrLen > opts.maxBuffer) {\n cp.emit('error', new Error('stderr maxBuffer exceeded'));\n } else {\n stderr.push(chunk);\n }\n });\n return [stdout, stderr];\n}\n\nfunction registerDataListeners(\n readable: Readable | null,\n dataListeners: DataListener[] | undefined,\n): void {\n if (isNullOrUndefined(readable) || isNullOrUndefined(dataListeners)) {\n return;\n }\n\n for (const listener of dataListeners) {\n readable.on('data', listener);\n }\n}\n\nexport function exec(\n commandArgument: string | CommandWithOptions,\n opts: RawExecOptions,\n): Promise<ExecResult> {\n let theCmd = commandArgument;\n let ignoreFailure = false;\n if (isCommandWithOptions(commandArgument)) {\n theCmd = join(commandArgument.command);\n if (commandArgument.ignoreFailure !== undefined) {\n ignoreFailure = commandArgument.ignoreFailure;\n }\n }\n\n return new Promise((resolve, reject) => {\n let cmd = asRawCommand(theCmd);\n let args: string[] = [];\n const maxBuffer = opts.maxBuffer ?? 10 * 1024 * 1024; // Set default max buffer size to 10MB\n\n // don't use shell by default, as it leads to potential security issues\n let shell = opts.shell ?? false;\n if (\n isCommandWithOptions(commandArgument) &&\n commandArgument.shell !== undefined\n ) {\n shell = commandArgument.shell;\n }\n\n // if we're not in shell mode, we need to provide the command and arguments\n if (shell === false) {\n const parts = split(cmd);\n // v8 ignore else -- TODO: add test #40625\n if (parts) {\n cmd = parts[0];\n args = parts.slice(1);\n }\n }\n\n const cp = execa(cmd, args, {\n ...opts,\n // force detached on non WIN platforms\n // https://github.com/nodejs/node/issues/21825#issuecomment-611328888\n detached: process.platform !== 'win32',\n shell,\n extendEnv: false,\n });\n\n // handle streams\n const [stdout, stderr] = initStreamListeners(cp, {\n ...opts,\n maxBuffer,\n });\n\n // handle process events\n void cp.on('error', (error) => {\n kill(cp, 'SIGTERM');\n // rethrowing, use originally emitted error message\n reject(new ExecError(error.message, rejectInfo(), error));\n });\n\n void cp.on('exit', (code: number, signal: NodeJS.Signals) => {\n if (NONTERM.includes(signal)) {\n return;\n }\n if (signal) {\n kill(cp, signal);\n reject(\n new ExecError(\n `Command failed: ${cp.spawnargs.join(' ')}\\nInterrupted by ${signal}`,\n {\n ...rejectInfo(),\n signal,\n },\n ),\n );\n return;\n }\n if (code !== 0) {\n if (ignoreFailure === undefined || ignoreFailure === false) {\n reject(\n new ExecError(\n `Command failed: ${cp.spawnargs.join(' ')}\\n${stringify(stderr, opts.outputWriters?.stderr)}`,\n {\n ...rejectInfo(),\n exitCode: code,\n },\n ),\n );\n return;\n }\n\n logger.once.debug(\n {\n command: cp.spawnargs.join(' '),\n stdout: stringify(stdout, opts.outputWriters?.stdout),\n stderr: stringify(stderr, opts.outputWriters?.stderr),\n exitCode: code,\n },\n `Ignoring failure to execute comamnd \\`${cp.spawnargs.join(' ')}\\`, as ignoreFailure=true is set`,\n );\n\n resolve({\n stderr: stringify(stderr, opts.outputWriters?.stderr),\n stdout: stringify(stdout, opts.outputWriters?.stdout),\n exitCode: code,\n });\n return;\n }\n resolve({\n stderr: stringify(stderr, opts.outputWriters?.stderr),\n stdout: stringify(stdout, opts.outputWriters?.stdout),\n });\n });\n\n function rejectInfo(): ExecErrorData {\n return {\n cmd: cp.spawnargs.join(' '),\n options: opts,\n stdout: stringify(stdout, opts.outputWriters?.stdout),\n stderr: stringify(stderr, opts.outputWriters?.stderr),\n };\n }\n });\n}\n\nfunction kill(cp: ChildProcess, signal: NodeJS.Signals): boolean {\n try {\n if (cp.pid && getEnv().RENOVATE_X_EXEC_GPID_HANDLE) {\n /**\n * If `pid` is negative, but not `-1`, signal shall be sent to all processes\n * (excluding an unspecified set of system processes),\n * whose process group ID (pgid) is equal to the absolute value of pid,\n * and for which the process has permission to send a signal.\n */\n return process.kill(-cp.pid, signal);\n }\n // destroying stdio is needed for unref to work\n // https://nodejs.org/api/child_process.html#subprocessunref\n // https://github.com/nodejs/node/blob/4d5ff25a813fd18939c9f76b17e36291e3ea15c3/lib/child_process.js#L412-L426\n cp.stderr?.destroy();\n cp.stdout?.destroy();\n cp.unref();\n return cp.kill(signal);\n } catch {\n // cp is a single node tree, therefore -pid is invalid as there is no such pgid,\n return false;\n }\n}\n\nexport function rawExec(\n cmd: string | CommandWithOptions,\n opts: RawExecOptions,\n): Promise<ExecResult> {\n return instrument(`rawExec: ${sanitize(asRawCommand(cmd))}`, () =>\n exec(cmd, opts),\n );\n}\n"],"mappings":";;;;;;;;;;AAuBA,MAAM,UAAU;CACd;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,WAAW;AAEjB,SAAS,UAAU,MAAgB,QAA0C;CAC3E,OAAO,QAAQ,SAAS,KAAK,OAAO,OAAO,IAAI,CAAC,CAAC,SAAS,QAAQ;AACpE;AAEA,SAAS,oBACP,IACA,MACsB;CACtB,MAAM,SAAmB,CAAC;CAC1B,MAAM,SAAmB,CAAC;CAC1B,IAAI,YAAY;CAChB,IAAI,YAAY;CAEhB,sBAAsB,GAAG,QAAQ,KAAK,iBAAiB,MAAM;CAC7D,sBAAsB,GAAG,QAAQ,KAAK,iBAAiB,MAAM;CAE7D,GAAG,QAAQ,GAAG,SAAS,UAAkB;EAEvC,IAAI,KAAK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,UAAU,QAAQ,KAAK,eAAe,MAAM;GACtD,CAAC;EACH,CAAC;EAED,SAAS,aAA4B;GACnC,OAAO;IACL,KAAK,GAAG,UAAU,KAAK,GAAG;IAC1B,SAAS;IACT,QAAQ,UAAU,QAAQ,KAAK,eAAe,MAAM;IACpD,QAAQ,UAAU,QAAQ,KAAK,eAAe,MAAM;GACtD;EACF;CACF,CAAC;AACH;AAEA,SAAS,KAAK,IAAkB,QAAiC;CAC/D,IAAI;EACF,IAAI,GAAG,OAAO,OAAO,CAAC,CAAC;;;;;;;EAOrB,OAAO,QAAQ,KAAK,CAAC,GAAG,KAAK,MAAM;EAKrC,GAAG,QAAQ,QAAQ;EACnB,GAAG,QAAQ,QAAQ;EACnB,GAAG,MAAM;EACT,OAAO,GAAG,KAAK,MAAM;CACvB,QAAQ;EAEN,OAAO;CACT;AACF;AAEA,SAAgB,QACd,KACA,MACqB;CACrB,OAAO,WAAW,YAAY,SAAS,aAAa,GAAG,CAAC,WACtD,KAAK,KAAK,IAAI,CAChB;AACF"}
1
+ {"version":3,"file":"common.js","names":[],"sources":["../../../lib/util/exec/common.ts"],"sourcesContent":["import type { ChildProcess } from 'node:child_process';\nimport type { Readable } from 'node:stream';\nimport { isNullOrUndefined } from '@sindresorhus/is';\nimport { execa } from 'execa';\nimport { join, split } from 'shlex';\nimport { instrument } from '../../instrumentation/index.ts';\nimport { logger } from '../../logger/index.ts';\nimport { getEnv } from '../env.ts';\nimport { sanitize } from '../sanitize.ts';\nimport type { ExecErrorData } from './exec-error.ts';\nimport { ExecError } from './exec-error.ts';\nimport type {\n CommandWithOptions,\n DataListener,\n ExecResult,\n OutputWriter,\n RawExecOptions,\n} from './types.ts';\nimport { asRawCommand, isCommandWithOptions } from './utils.ts';\n\n// https://man7.org/linux/man-pages/man7/signal.7.html#NAME\n// Non TERM/CORE signals\n// The following is step 3. in https://github.com/renovatebot/renovate/issues/16197#issuecomment-1171423890\nconst NONTERM = [\n 'SIGCHLD',\n 'SIGCLD',\n 'SIGCONT',\n 'SIGSTOP',\n 'SIGTSTP',\n 'SIGTTIN',\n 'SIGTTOU',\n 'SIGURG',\n 'SIGWINCH',\n];\n\nconst encoding = 'utf8';\n\nfunction stringify(list: Buffer[], writer: OutputWriter | undefined): string {\n return writer?.toString() ?? Buffer.concat(list).toString(encoding);\n}\n\nfunction initStreamListeners(\n cp: ChildProcess,\n opts: RawExecOptions & { maxBuffer: number },\n): [Buffer[], Buffer[]] {\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n let stdoutLen = 0;\n let stderrLen = 0;\n\n registerDataListeners(cp.stdout, opts.outputListeners?.stdout);\n registerDataListeners(cp.stderr, opts.outputListeners?.stderr);\n\n cp.stdout?.on('data', (chunk: Buffer) => {\n // process.stdout.write(data.toString());\n if (opts.outputWriters?.stdout) {\n opts.outputWriters.stdout.write(chunk);\n return;\n }\n\n const len = Buffer.byteLength(chunk, encoding);\n stdoutLen += len;\n if (stdoutLen > opts.maxBuffer) {\n cp.emit('error', new Error('stdout maxBuffer exceeded'));\n } else {\n stdout.push(chunk);\n }\n });\n\n cp.stderr?.on('data', (chunk: Buffer) => {\n // process.stderr.write(data.toString());\n if (opts.outputWriters?.stderr) {\n opts.outputWriters.stderr.write(chunk);\n return;\n }\n\n const len = Buffer.byteLength(chunk, encoding);\n stderrLen += len;\n if (stderrLen > opts.maxBuffer) {\n cp.emit('error', new Error('stderr maxBuffer exceeded'));\n } else {\n stderr.push(chunk);\n }\n });\n return [stdout, stderr];\n}\n\nfunction registerDataListeners(\n readable: Readable | null,\n dataListeners: DataListener[] | undefined,\n): void {\n if (isNullOrUndefined(readable) || isNullOrUndefined(dataListeners)) {\n return;\n }\n\n for (const listener of dataListeners) {\n readable.on('data', listener);\n }\n}\n\nexport function exec(\n commandArgument: string | CommandWithOptions,\n opts: RawExecOptions,\n): Promise<ExecResult> {\n let theCmd = commandArgument;\n let ignoreFailure = false;\n if (isCommandWithOptions(commandArgument)) {\n theCmd = join(commandArgument.command);\n if (commandArgument.ignoreFailure !== undefined) {\n ignoreFailure = commandArgument.ignoreFailure;\n }\n }\n\n return new Promise((resolve, reject) => {\n let cmd = asRawCommand(theCmd);\n let args: string[] = [];\n const maxBuffer = opts.maxBuffer ?? 10 * 1024 * 1024; // Set default max buffer size to 10MB\n\n // don't use shell by default, as it leads to potential security issues\n let shell = opts.shell ?? false;\n if (\n isCommandWithOptions(commandArgument) &&\n commandArgument.shell !== undefined\n ) {\n shell = commandArgument.shell;\n }\n\n // if we're not in shell mode, we need to provide the command and arguments\n if (shell === false) {\n const parts = split(cmd);\n // v8 ignore else -- TODO: add test #40625\n if (parts) {\n cmd = parts[0];\n args = parts.slice(1);\n }\n }\n\n const cp = execa(cmd, args, {\n ...opts,\n // force detached on non WIN platforms\n // https://github.com/nodejs/node/issues/21825#issuecomment-611328888\n detached: process.platform !== 'win32',\n shell,\n extendEnv: false,\n });\n\n // handle streams\n const [stdout, stderr] = initStreamListeners(cp, {\n ...opts,\n maxBuffer,\n });\n\n // handle process events\n void cp.on('error', (error) => {\n kill(cp, 'SIGTERM');\n // rethrowing, use originally emitted error message\n reject(new ExecError(error.message, rejectInfo(), error));\n });\n\n void cp.on('exit', (code: number, signal: NodeJS.Signals) => {\n if (NONTERM.includes(signal)) {\n return;\n }\n if (signal) {\n kill(cp, signal);\n reject(\n new ExecError(\n `Command failed: ${cp.spawnargs.join(' ')}\\nInterrupted by ${signal}`,\n {\n ...rejectInfo(),\n signal,\n },\n ),\n );\n return;\n }\n if (code !== 0) {\n if (ignoreFailure === undefined || ignoreFailure === false) {\n reject(\n new ExecError(\n `Command failed: ${cp.spawnargs.join(' ')}\\n${stringify(stderr, opts.outputWriters?.stderr)}`,\n {\n ...rejectInfo(),\n exitCode: code,\n },\n ),\n );\n return;\n }\n\n logger.once.debug(\n {\n command: cp.spawnargs.join(' '),\n stdout: stringify(stdout, opts.outputWriters?.stdout),\n stderr: stringify(stderr, opts.outputWriters?.stderr),\n exitCode: code,\n },\n `Ignoring failure to execute comamnd \\`${cp.spawnargs.join(' ')}\\`, as ignoreFailure=true is set`,\n );\n\n resolve({\n stderr: stringify(stderr, opts.outputWriters?.stderr),\n stdout: stringify(stdout, opts.outputWriters?.stdout),\n exitCode: code,\n });\n return;\n }\n resolve({\n stderr: stringify(stderr, opts.outputWriters?.stderr),\n stdout: stringify(stdout, opts.outputWriters?.stdout),\n });\n });\n\n function rejectInfo(): ExecErrorData {\n return {\n cmd: cp.spawnargs.join(' '),\n options: opts,\n stdout: stringify(stdout, opts.outputWriters?.stdout),\n stderr: stringify(stderr, opts.outputWriters?.stderr),\n };\n }\n });\n}\n\nfunction kill(cp: ChildProcess, signal: NodeJS.Signals): boolean {\n try {\n if (cp.pid && getEnv().RENOVATE_X_EXEC_GPID_HANDLE) {\n /**\n * If `pid` is negative, but not `-1`, signal shall be sent to all processes\n * (excluding an unspecified set of system processes),\n * whose process group ID (pgid) is equal to the absolute value of pid,\n * and for which the process has permission to send a signal.\n */\n return process.kill(-cp.pid, signal);\n }\n // destroying stdio is needed for unref to work\n // https://nodejs.org/api/child_process.html#subprocessunref\n // https://github.com/nodejs/node/blob/4d5ff25a813fd18939c9f76b17e36291e3ea15c3/lib/child_process.js#L412-L426\n cp.stderr?.destroy();\n cp.stdout?.destroy();\n cp.unref();\n return cp.kill(signal);\n } catch {\n // cp is a single node tree, therefore -pid is invalid as there is no such pgid,\n return false;\n }\n}\n\nexport function rawExec(\n cmd: string | CommandWithOptions,\n opts: RawExecOptions,\n): Promise<ExecResult> {\n return instrument(`rawExec: ${sanitize(asRawCommand(cmd))}`, () =>\n exec(cmd, opts),\n );\n}\n"],"mappings":";;;;;;;;;;AAuBA,MAAM,UAAU;CACd;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,WAAW;AAEjB,SAAS,UAAU,MAAgB,QAA0C;CAC3E,OAAO,QAAQ,SAAS,KAAK,OAAO,OAAO,IAAI,CAAC,CAAC,SAAS,QAAQ;AACpE;AAEA,SA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,GACA,yCAAyC,GAAG,UAAU,KAAK,GAAG,EAAE,iCAClE;IAEA,QAAQ;KACN,QAAQ,UAAU,QAAQ,KAAK,eAAe,MAAM;KACpD,QAAQ,UAAU,QAAQ,KAAK,eAAe,MAAM;KACpD,UAAU;IACZ,CAAC;IACD;GACF;GACA,QAAQ;IACN,QAAQ,UAAU,QAAQ,KAAK,eAAe,MAAM;IACpD,QAAQ,UAAU,QAAQ,KAAK,eAAe,MAAM;GACtD,CAAC;EACH,CAAC;EAED,SAAS,aAA4B;GACnC,OAAO;IACL,KAAK,GAAG,UAAU,KAAK,GAAG;IAC1B,SAAS;IACT,QAAQ,UAAU,QAAQ,KAAK,eAAe,MAAM;IACpD,QAAQ,UAAU,QAAQ,KAAK,eAAe,MAAM;GACtD;EACF;CACF,CAAC;AACH;AAEA,SAAS,KAAK,IAAkB,QAAiC;CAC/D,IAAI;EACF,IAAI,GAAG,OAAO,OAAO,CAAC,CAAC;;;;;;;EAOrB,OAAO,QAAQ,KAAK,CAAC,GAAG,KAAK,MAAM;EAKrC,GAAG,QAAQ,QAAQ;EACnB,GAAG,QAAQ,QAAQ;EACnB,GAAG,MAAM;EACT,OAAO,GAAG,KAAK,MAAM;CACvB,QAAQ;EAEN,OAAO;CACT;AACF;AAEA,SAAgB,QACd,KACA,MACqB;CACrB,OAAO,WAAW,YAAY,SAAS,aAAa,GAAG,CAAC,WACtD,KAAK,KAAK,IAAI,CAChB;AACF"}
@@ -36,7 +36,8 @@ function volumesEql(x, y) {
36
36
  return xFrom === yFrom && xTo === yTo;
37
37
  }
38
38
  function prepareVolumes(volumes) {
39
- return uniq(volumes.map(expandVolumeOption).filter((vol) => vol !== null), volumesEql).map(([from, to]) => `-v "${from}":"${to}"`);
39
+ const filtered = volumes.map(expandVolumeOption).filter((vol) => vol !== null);
40
+ return uniq(filtered, volumesEql).map(([from, to]) => `-v "${from}":"${to}"`);
40
41
  }
41
42
  function getContainerName(name, prefix) {
42
43
  return `${prefix ?? "renovate_"}${name}`.replace(regEx(/\//g), "_");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../lib/util/exec/docker/index.ts"],"sourcesContent":["import { isNonEmptyString, isString } from '@sindresorhus/is';\nimport { join, quote } from 'shlex';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { SYSTEM_INSUFFICIENT_MEMORY } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { newlineRegex, regEx } from '../../regex.ts';\nimport { uniq } from '../../uniq.ts';\nimport { rawExec } from '../common.ts';\nimport type {\n CommandWithOptions,\n DockerOptions,\n VolumeOption,\n VolumesPair,\n} from '../types.ts';\nimport { isCommandWithOptions } from '../utils.ts';\n\nconst prefetchedImages = new Map<string, string>();\n\nconst digestRegex = regEx('Digest: (.*?)\\n');\n\nexport const sideCarName = 'sidecar';\n\nexport async function prefetchDockerImage(taggedImage: string): Promise<void> {\n if (prefetchedImages.has(taggedImage)) {\n logger.debug(\n `Docker image is already prefetched: ${taggedImage}@${prefetchedImages.get(\n taggedImage,\n )!}`,\n );\n } else {\n logger.debug(`Fetching Docker image: ${taggedImage}`);\n const res = await rawExec(`docker pull ${taggedImage}`, {});\n const imageDigest = digestRegex.exec(res?.stdout)?.[1] ?? 'unknown';\n logger.debug(\n `Finished fetching Docker image ${taggedImage}@${imageDigest}`,\n );\n prefetchedImages.set(taggedImage, imageDigest);\n }\n}\n\nexport function resetPrefetchedImages(): void {\n prefetchedImages.clear();\n}\n\nfunction expandVolumeOption(x: VolumeOption): VolumesPair | null {\n if (isNonEmptyString(x)) {\n return [x, x];\n }\n if (Array.isArray(x) && x.length === 2) {\n const [from, to] = x;\n // v8 ignore else -- TODO: add test #40625\n if (isNonEmptyString(from) && isNonEmptyString(to)) {\n return [from, to];\n }\n }\n return null;\n}\n\nfunction volumesEql(x: VolumesPair, y: VolumesPair): boolean {\n const [xFrom, xTo] = x;\n const [yFrom, yTo] = y;\n return xFrom === yFrom && xTo === yTo;\n}\n\nfunction prepareVolumes(volumes: VolumeOption[]): string[] {\n const expanded: (VolumesPair | null)[] = volumes.map(expandVolumeOption);\n const filtered: VolumesPair[] = expanded.filter(\n (vol): vol is VolumesPair => vol !== null,\n );\n const unique: VolumesPair[] = uniq<VolumesPair>(filtered, volumesEql);\n return unique.map(([from, to]) => `-v \"${from}\":\"${to}\"`);\n}\n\nfunction getContainerName(name: string, prefix?: string): string {\n return `${prefix ?? 'renovate_'}${name}`.replace(regEx(/\\//g), '_');\n}\n\nfunction getContainerLabel(prefix: string | undefined): string {\n return `${prefix ?? 'renovate_'}child`;\n}\n\nexport async function removeDockerContainer(\n image: string,\n prefix: string,\n): Promise<void> {\n const containerName = getContainerName(sideCarName, prefix);\n let cmd = `docker ps --filter name=${containerName} -aq`;\n try {\n const res = await rawExec(cmd, {});\n const containerId = res?.stdout?.trim() || '';\n if (containerId.length) {\n logger.debug(`Removing container with ID: ${containerId}`);\n cmd = `docker rm -f ${containerId}`;\n await rawExec(cmd, {});\n } else {\n logger.trace({ image, containerName }, 'No running containers to remove');\n }\n } catch (err) {\n logger.warn(\n { image, containerName, cmd, err },\n 'Could not remove Docker container',\n );\n }\n}\n\nexport async function removeDanglingContainers(): Promise<void> {\n if (GlobalConfig.get('binarySource') !== 'docker') {\n return;\n }\n\n try {\n const containerLabel = getContainerLabel(\n GlobalConfig.get('dockerChildPrefix'),\n );\n logger.debug(\n `Removing dangling child containers with label ${containerLabel}`,\n );\n const res = await rawExec(\n `docker ps --filter label=${containerLabel} -aq`,\n {},\n );\n if (res?.stdout?.trim().length) {\n const containerIds = res.stdout\n .trim()\n .split(newlineRegex)\n .map((container) => container.trim())\n .filter(Boolean);\n logger.debug({ containerIds }, 'Removing dangling child containers');\n await rawExec(`docker rm -f ${containerIds.join(' ')}`, {});\n } else {\n logger.debug('No dangling containers to remove');\n }\n } catch (err) {\n if (err.errno === 'ENOMEM') {\n throw new Error(SYSTEM_INSUFFICIENT_MEMORY);\n }\n if (err.stderr?.includes('Cannot connect to the Docker daemon')) {\n logger.info('No docker daemon found');\n } else {\n logger.warn({ err }, 'Error removing dangling containers');\n }\n }\n}\n\nexport async function generateDockerCommand(\n commands: (string | CommandWithOptions)[],\n preCommands: (string | CommandWithOptions)[],\n options: DockerOptions,\n sideCarImage: string,\n): Promise<string> {\n const { envVars, cwd } = options;\n const volumes = options.volumes ?? [];\n const {\n localDir,\n cacheDir,\n containerbaseDir,\n dockerUser,\n dockerChildPrefix,\n dockerCliOptions,\n } = GlobalConfig.get();\n const result = ['docker run --rm'];\n const containerName = getContainerName(sideCarName, dockerChildPrefix);\n const containerLabel = getContainerLabel(dockerChildPrefix);\n result.push(`--name=${containerName}`);\n result.push(`--label=${containerLabel}`);\n if (dockerUser) {\n result.push(`--user=${dockerUser}`);\n }\n if (dockerCliOptions) {\n result.push(dockerCliOptions);\n }\n\n const volumeDirs: VolumeOption[] = [localDir, cacheDir];\n if (containerbaseDir) {\n if (cacheDir && containerbaseDir.startsWith(cacheDir)) {\n logger.debug('containerbaseDir is inside cacheDir');\n } else {\n logger.debug('containerbaseDir is separate from cacheDir');\n volumeDirs.push(containerbaseDir);\n }\n } else {\n logger.debug('containerbaseDir is missing');\n }\n volumeDirs.push(...volumes);\n result.push(...prepareVolumes(volumeDirs));\n\n // v8 ignore else -- TODO: add test #40625\n if (envVars) {\n result.push(\n ...uniq(envVars)\n .filter(isString)\n .map((e) => `-e ${e}`),\n );\n }\n\n if (cwd) {\n result.push(`-w \"${cwd}\"`);\n }\n\n logger.debug({ image: sideCarImage }, 'Resolved tag constraint');\n\n await prefetchDockerImage(sideCarImage);\n result.push(sideCarImage);\n\n const bashCommandParts = [];\n\n for (const preCommand of preCommands) {\n if (\n isCommandWithOptions(preCommand) &&\n isString(join(preCommand.command))\n ) {\n if (preCommand.ignoreFailure) {\n bashCommandParts.push(`${join(preCommand.command)} || true`);\n } else {\n bashCommandParts.push(join(preCommand.command));\n }\n } else if (isString(preCommand)) {\n bashCommandParts.push(preCommand);\n }\n }\n\n for (const command of commands) {\n if (isCommandWithOptions(command)) {\n if (command.ignoreFailure) {\n bashCommandParts.push(`${join(command.command)} || true`);\n } else {\n bashCommandParts.push(join(command.command));\n }\n } else {\n bashCommandParts.push(command);\n }\n }\n\n const bashCommand = bashCommandParts.join(' && ');\n // Single-quote the whole `-c` argument rather than hand-escaping `\"`. Escaping\n // only `\"` left `\\` unhandled, so a value containing `\\\"` produced a string that\n // `shlex.split` rejects outright (\"Got EOF while in a quoted string\"), failing\n // the update.\n //\n // It also left `$` and backticks live in the outer context, which silently\n // defeats the `quote()` calls the managers apply: their single quotes are not\n // special inside double quotes. That is inert while nothing pairs\n // `ExecOptions.shell` with `docker` — `rawExec` otherwise splits argv without a\n // shell — but it made the wrapper one `shell: true` away from turning a quoted\n // dep name into host-side command substitution, which is how the flux manager\n // was configured until it moved to `CommandWithOptions`. Being correct here\n // means that pairing is no longer load-bearing.\n result.push(`bash -l -c ${quote(bashCommand)}`);\n\n return result.join(' ');\n}\n"],"mappings":";;;;;;;;;;AAgBA,MAAM,mCAAmB,IAAI,IAAoB;AAEjD,MAAM,cAAc,MAAM,iBAAiB;AAE3C,MAAa,cAAc;AAE3B,eAAsB,oBAAoB,aAAoC;CAC5E,IAAI,iBAAiB,IAAI,WAAW,GAClC,OAAO,MACL,uCAAuC,YAAY,GAAG,iBAAiB,IACrE,WACF,GACF;MACK;EACL,OAAO,MAAM,0BAA0B,aAAa;EACpD,MAAM,MAAM,MAAM,QAAQ,eAAe,eAAe,CAAC,CAAC;EAC1D,MAAM,cAAc,YAAY,KAAK,KAAK,MAAM,CAAC,GAAG,MAAM;EAC1D,OAAO,MACL,kCAAkC,YAAY,GAAG,aACnD;EACA,iBAAiB,IAAI,aAAa,WAAW;CAC/C;AACF;AAMA,SAAS,mBAAmB,GAAqC;CAC/D,IAAI,iBAAiB,CAAC,GACpB,OAAO,CAAC,GAAG,CAAC;CAEd,IAAI,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG;EACtC,MAA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AW,KAAK,GAAG,OAAO;CAC1B,OAAO,KAAK,GAAG,eAAe,UAAU,CAAC;;CAGzC,IAAI,SACF,OAAO,KACL,GAAG,KAAK,OAAO,CAAC,CACb,OAAO,QAAQ,CAAC,CAChB,KAAK,MAAM,MAAM,GAAG,CACzB;CAGF,IAAI,KACF,OAAO,KAAK,OAAO,IAAI,EAAE;CAG3B,OAAO,MAAM,EAAE,OAAO,aAAa,GAAG,yBAAyB;CAE/D,MAAM,oBAAoB,YAAY;CACtC,OAAO,KAAK,YAAY;CAExB,MAAM,mBAAmB,CAAC;CAE1B,KAAK,MAAM,cAAc,aACvB,IACE,qBAAqB,UAAU,KAC/B,SAAS,KAAK,WAAW,OAAO,CAAC,GAEjC,IAAI,WAAW,eACb,iBAAiB,KAAK,GAAG,KAAK,WAAW,OAAO,EAAE,SAAS;MAE3D,iBAAiB,KAAK,KAAK,WAAW,OAAO,CAAC;MAE3C,IAAI,SAAS,UAAU,GAC5B,iBAAiB,KAAK,UAAU;CAIpC,KAAK,MAAM,WAAW,UACpB,IAAI,qBAAqB,OAAO,GAC9B,IAAI,QAAQ,eACV,iBAAiB,KAAK,GAAG,KAAK,QAAQ,OAAO,EAAE,SAAS;MAExD,iBAAiB,KAAK,KAAK,QAAQ,OAAO,CAAC;MAG7C,iBAAiB,KAAK,OAAO;CAIjC,MAAM,cAAc,iBAAiB,KAAK,MAAM;CAchD,OAAO,KAAK,cAAc,MAAM,WAAW,GAAG;CAE9C,OAAO,OAAO,KAAK,GAAG;AACxB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../lib/util/exec/docker/index.ts"],"sourcesContent":["import { isNonEmptyString, isString } from '@sindresorhus/is';\nimport { join, quote } from 'shlex';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { SYSTEM_INSUFFICIENT_MEMORY } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { newlineRegex, regEx } from '../../regex.ts';\nimport { uniq } from '../../uniq.ts';\nimport { rawExec } from '../common.ts';\nimport type {\n CommandWithOptions,\n DockerOptions,\n VolumeOption,\n VolumesPair,\n} from '../types.ts';\nimport { isCommandWithOptions } from '../utils.ts';\n\nconst prefetchedImages = new Map<string, string>();\n\nconst digestRegex = regEx('Digest: (.*?)\\n');\n\nexport const sideCarName = 'sidecar';\n\nexport async function prefetchDockerImage(taggedImage: string): Promise<void> {\n if (prefetchedImages.has(taggedImage)) {\n logger.debug(\n `Docker image is already prefetched: ${taggedImage}@${prefetchedImages.get(\n taggedImage,\n )!}`,\n );\n } else {\n logger.debug(`Fetching Docker image: ${taggedImage}`);\n const res = await rawExec(`docker pull ${taggedImage}`, {});\n const imageDigest = digestRegex.exec(res?.stdout)?.[1] ?? 'unknown';\n logger.debug(\n `Finished fetching Docker image ${taggedImage}@${imageDigest}`,\n );\n prefetchedImages.set(taggedImage, imageDigest);\n }\n}\n\nexport function resetPrefetchedImages(): void {\n prefetchedImages.clear();\n}\n\nfunction expandVolumeOption(x: VolumeOption): VolumesPair | null {\n if (isNonEmptyString(x)) {\n return [x, x];\n }\n if (Array.isArray(x) && x.length === 2) {\n const [from, to] = x;\n // v8 ignore else -- TODO: add test #40625\n if (isNonEmptyString(from) && isNonEmptyString(to)) {\n return [from, to];\n }\n }\n return null;\n}\n\nfunction volumesEql(x: VolumesPair, y: VolumesPair): boolean {\n const [xFrom, xTo] = x;\n const [yFrom, yTo] = y;\n return xFrom === yFrom && xTo === yTo;\n}\n\nfunction prepareVolumes(volumes: VolumeOption[]): string[] {\n const expanded: (VolumesPair | null)[] = volumes.map(expandVolumeOption);\n const filtered: VolumesPair[] = expanded.filter(\n (vol): vol is VolumesPair => vol !== null,\n );\n const unique: VolumesPair[] = uniq<VolumesPair>(filtered, volumesEql);\n return unique.map(([from, to]) => `-v \"${from}\":\"${to}\"`);\n}\n\nfunction getContainerName(name: string, prefix?: string): string {\n return `${prefix ?? 'renovate_'}${name}`.replace(regEx(/\\//g), '_');\n}\n\nfunction getContainerLabel(prefix: string | undefined): string {\n return `${prefix ?? 'renovate_'}child`;\n}\n\nexport async function removeDockerContainer(\n image: string,\n prefix: string,\n): Promise<void> {\n const containerName = getContainerName(sideCarName, prefix);\n let cmd = `docker ps --filter name=${containerName} -aq`;\n try {\n const res = await rawExec(cmd, {});\n const containerId = res?.stdout?.trim() || '';\n if (containerId.length) {\n logger.debug(`Removing container with ID: ${containerId}`);\n cmd = `docker rm -f ${containerId}`;\n await rawExec(cmd, {});\n } else {\n logger.trace({ image, containerName }, 'No running containers to remove');\n }\n } catch (err) {\n logger.warn(\n { image, containerName, cmd, err },\n 'Could not remove Docker container',\n );\n }\n}\n\nexport async function removeDanglingContainers(): Promise<void> {\n if (GlobalConfig.get('binarySource') !== 'docker') {\n return;\n }\n\n try {\n const containerLabel = getContainerLabel(\n GlobalConfig.get('dockerChildPrefix'),\n );\n logger.debug(\n `Removing dangling child containers with label ${containerLabel}`,\n );\n const res = await rawExec(\n `docker ps --filter label=${containerLabel} -aq`,\n {},\n );\n if (res?.stdout?.trim().length) {\n const containerIds = res.stdout\n .trim()\n .split(newlineRegex)\n .map((container) => container.trim())\n .filter(Boolean);\n logger.debug({ containerIds }, 'Removing dangling child containers');\n await rawExec(`docker rm -f ${containerIds.join(' ')}`, {});\n } else {\n logger.debug('No dangling containers to remove');\n }\n } catch (err) {\n if (err.errno === 'ENOMEM') {\n throw new Error(SYSTEM_INSUFFICIENT_MEMORY);\n }\n if (err.stderr?.includes('Cannot connect to the Docker daemon')) {\n logger.info('No docker daemon found');\n } else {\n logger.warn({ err }, 'Error removing dangling containers');\n }\n }\n}\n\nexport async function generateDockerCommand(\n commands: (string | CommandWithOptions)[],\n preCommands: (string | CommandWithOptions)[],\n options: DockerOptions,\n sideCarImage: string,\n): Promise<string> {\n const { envVars, cwd } = options;\n const volumes = options.volumes ?? [];\n const {\n localDir,\n cacheDir,\n containerbaseDir,\n dockerUser,\n dockerChildPrefix,\n dockerCliOptions,\n } = GlobalConfig.get();\n const result = ['docker run --rm'];\n const containerName = getContainerName(sideCarName, dockerChildPrefix);\n const containerLabel = getContainerLabel(dockerChildPrefix);\n result.push(`--name=${containerName}`);\n result.push(`--label=${containerLabel}`);\n if (dockerUser) {\n result.push(`--user=${dockerUser}`);\n }\n if (dockerCliOptions) {\n result.push(dockerCliOptions);\n }\n\n const volumeDirs: VolumeOption[] = [localDir, cacheDir];\n if (containerbaseDir) {\n if (cacheDir && containerbaseDir.startsWith(cacheDir)) {\n logger.debug('containerbaseDir is inside cacheDir');\n } else {\n logger.debug('containerbaseDir is separate from cacheDir');\n volumeDirs.push(containerbaseDir);\n }\n } else {\n logger.debug('containerbaseDir is missing');\n }\n volumeDirs.push(...volumes);\n result.push(...prepareVolumes(volumeDirs));\n\n // v8 ignore else -- TODO: add test #40625\n if (envVars) {\n result.push(\n ...uniq(envVars)\n .filter(isString)\n .map((e) => `-e ${e}`),\n );\n }\n\n if (cwd) {\n result.push(`-w \"${cwd}\"`);\n }\n\n logger.debug({ image: sideCarImage }, 'Resolved tag constraint');\n\n await prefetchDockerImage(sideCarImage);\n result.push(sideCarImage);\n\n const bashCommandParts = [];\n\n for (const preCommand of preCommands) {\n if (\n isCommandWithOptions(preCommand) &&\n isString(join(preCommand.command))\n ) {\n if (preCommand.ignoreFailure) {\n bashCommandParts.push(`${join(preCommand.command)} || true`);\n } else {\n bashCommandParts.push(join(preCommand.command));\n }\n } else if (isString(preCommand)) {\n bashCommandParts.push(preCommand);\n }\n }\n\n for (const command of commands) {\n if (isCommandWithOptions(command)) {\n if (command.ignoreFailure) {\n bashCommandParts.push(`${join(command.command)} || true`);\n } else {\n bashCommandParts.push(join(command.command));\n }\n } else {\n bashCommandParts.push(command);\n }\n }\n\n const bashCommand = bashCommandParts.join(' && ');\n // Single-quote the whole `-c` argument rather than hand-escaping `\"`. Escaping\n // only `\"` left `\\` unhandled, so a value containing `\\\"` produced a string that\n // `shlex.split` rejects outright (\"Got EOF while in a quoted string\"), failing\n // the update.\n //\n // It also left `$` and backticks live in the outer context, which silently\n // defeats the `quote()` calls the managers apply: their single quotes are not\n // special inside double quotes. That is inert while nothing pairs\n // `ExecOptions.shell` with `docker` — `rawExec` otherwise splits argv without a\n // shell — but it made the wrapper one `shell: true` away from turning a quoted\n // dep name into host-side command substitution, which is how the flux manager\n // was configured until it moved to `CommandWithOptions`. Being correct here\n // means that pairing is no longer load-bearing.\n result.push(`bash -l -c ${quote(bashCommand)}`);\n\n return result.join(' ');\n}\n"],"mappings":";;;;;;;;;;AAgBA,MAAM,mCAAmB,IAAI,IAAoB;AAEjD,MAAM,cAAc,MAAM,iBAAiB;AAE3C,MAAa,cAAc;AAE3B,eAAsB,oBAAoB,aAAoC;CAC5E,IAAI,iBAAiB,IAAI,WAAW,GAClC,OAAO,MACL,uCAAuC,YAAY,GAAG,iBAAiB,IACrE,WACF,GACF;MACK;EACL,OAAO,MAAM,0BAA0B,aAAa;EACpD,MAAM,MAAM,MAAM,QAAQ,eAAe,eAAe,CAAC,CAAC;EAC1D,MAAM,cAAc,YAAY,KAAK,KAAK,MAAM,CAAC,GAAG,MAAM;EAC1D,OAAO,MACL,kCAAkC,YAAY,GAAG,aACnD;EACA,iBAAiB,IAAI,aAAa,WAAW;CAC/C;AACF;AAMA,SAAS,mBAAmB,GAAqC;CAC/D,IAAI,iBAAiB,CAAC,GACpB,OAAO,CAAC,GAAG,CAAC;CAEd,IAAI,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG;EACtC,MAAM,CAAC,MAAM,MAAM;;EAEnB,IAAI,iBAAiB,IAAI,KAAK,iBAAiB,EAAE,GAC/C,OAAO,CAAC,MAAM,EAAE;CAEpB;CACA,OAAO;AACT;AAEA,SAAS,WAAW,GAAgB,GAAyB;CAC3D,MAAM,CAAC,OAAO,OAAO;CACrB,MAAM,CAAC,OAAO,OAAO;CACrB,OAAO,UAAU,SAAS,QAAQ;AACpC;AAEA,SAAS,eAAe,SAAmC;CAEzD,MAAM,WADmC,QAAQ,IAAI,kBACd,CAAC,CAAC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OAAO,KAAK,YAAY;CAExB,MAAM,mBAAmB,CAAC;CAE1B,KAAK,MAAM,cAAc,aACvB,IACE,qBAAqB,UAAU,KAC/B,SAAS,KAAK,WAAW,OAAO,CAAC,GAEjC,IAAI,WAAW,eACb,iBAAiB,KAAK,GAAG,KAAK,WAAW,OAAO,EAAE,SAAS;MAE3D,iBAAiB,KAAK,KAAK,WAAW,OAAO,CAAC;MAE3C,IAAI,SAAS,UAAU,GAC5B,iBAAiB,KAAK,UAAU;CAIpC,KAAK,MAAM,WAAW,UACpB,IAAI,qBAAqB,OAAO,GAC9B,IAAI,QAAQ,eACV,iBAAiB,KAAK,GAAG,KAAK,QAAQ,OAAO,EAAE,SAAS;MAExD,iBAAiB,KAAK,KAAK,QAAQ,OAAO,CAAC;MAG7C,iBAAiB,KAAK,OAAO;CAIjC,MAAM,cAAc,iBAAiB,KAAK,MAAM;CAchD,OAAO,KAAK,cAAc,MAAM,WAAW,GAAG;CAE9C,OAAO,OAAO,KAAK,GAAG;AACxB"}
@@ -10,7 +10,8 @@ function isHermit() {
10
10
  return GlobalConfig.get("binarySource") === "hermit";
11
11
  }
12
12
  async function findHermitCwd(cwd) {
13
- const hermitFile = await findUpLocal("bin/hermit", upath.relative(GlobalConfig.get("localDir"), cwd));
13
+ const relativeCwd = upath.relative(GlobalConfig.get("localDir"), cwd);
14
+ const hermitFile = await findUpLocal("bin/hermit", relativeCwd);
14
15
  if (hermitFile === null) throw new Error(`hermit not found for ${cwd}`);
15
16
  return upath.join(GlobalConfig.get("localDir"), upath.dirname(hermitFile));
16
17
  }