renovate 44.127.2 → 44.128.1
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.
- package/dist/modules/manager/bun/index.js +1 -1
- package/dist/modules/manager/fingerprint.generated.js +2 -2
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/manager/npm/artifacts.js +37 -23
- package/dist/modules/manager/npm/artifacts.js.map +1 -1
- package/dist/modules/manager/npm/dep-types.js +10 -0
- package/dist/modules/manager/npm/dep-types.js.map +1 -1
- package/dist/modules/manager/npm/extract/common/dependency.js +5 -2
- package/dist/modules/manager/npm/extract/common/dependency.js.map +1 -1
- package/dist/modules/manager/npm/extract/common/package-file.js +30 -3
- package/dist/modules/manager/npm/extract/common/package-file.js.map +1 -1
- package/dist/modules/manager/npm/extract/index.js +4 -4
- package/dist/modules/manager/npm/extract/index.js.map +1 -1
- package/dist/modules/manager/npm/extract/pnpm.js +1 -1
- package/dist/modules/manager/npm/extract/post/locked-versions.js +3 -3
- package/dist/modules/manager/npm/extract/post/locked-versions.js.map +1 -1
- package/dist/modules/manager/npm/index.js +2 -2
- package/dist/modules/manager/npm/post-update/utils.js +5 -5
- package/dist/modules/manager/npm/post-update/utils.js.map +1 -1
- package/dist/modules/manager/npm/post-update/yarn.js +1 -1
- package/dist/modules/manager/npm/post-update/yarn.js.map +1 -1
- package/dist/modules/manager/npm/update/dependency/index.js +73 -0
- package/dist/modules/manager/npm/update/dependency/index.js.map +1 -1
- package/dist/modules/manager/npm/update/dependency/pnpm.js +1 -1
- package/dist/modules/manager/npm/update/dependency/yarn.js +1 -1
- package/package.json +2 -2
- package/renovate-schema.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { GithubTagsDatasource } from "../../datasource/github-tags/index.js";
|
|
3
3
|
import { NpmDatasource } from "../../datasource/npm/index.js";
|
|
4
|
-
import { getRangeStrategy } from "../npm/range.js";
|
|
5
4
|
import { updateDependency } from "../npm/update/dependency/index.js";
|
|
5
|
+
import { getRangeStrategy } from "../npm/range.js";
|
|
6
6
|
import "../npm/index.js";
|
|
7
7
|
import { updateArtifacts } from "./artifacts.js";
|
|
8
8
|
import { extractAllPackageFiles } from "./extract.js";
|
|
@@ -17,7 +17,7 @@ hashMap.set("bitbucket-pipelines", "59c0503494ab1442b127914503c01b97ac17b6742b19
|
|
|
17
17
|
hashMap.set("bitrise", "478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42");
|
|
18
18
|
hashMap.set("buildkite", "b8b404f53cd5d61c39153fddf93945e621471c4ac6aa9960c881cd868922bb4c");
|
|
19
19
|
hashMap.set("buildpacks", "6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f");
|
|
20
|
-
hashMap.set("bun", "
|
|
20
|
+
hashMap.set("bun", "6789cc6499c77cdf44d4fb306198274bb72241e6d0ef7ceda7e916d7022d864c");
|
|
21
21
|
hashMap.set("bun-version", "df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4");
|
|
22
22
|
hashMap.set("bundler", "6e4784dd98c1f86ef64cc8cbf3128df48aebf920032d7792b54fdedd3dd9d4d5");
|
|
23
23
|
hashMap.set("cake", "9ebd8b481220b30a8860121d26184540a1a2fcc05ef780df9295dea39b386fad");
|
|
@@ -75,7 +75,7 @@ hashMap.set("mise", "59c691024c34cb4be4d9b4f811019ae9b22410df0da54977cdcecea261f
|
|
|
75
75
|
hashMap.set("mix", "0f79163dc2a1c896599d152be635c23beaf16812ae3d8fbfffec98c7bd0de872");
|
|
76
76
|
hashMap.set("nix", "9cbd96a29fe96e3df7418e422256380202f07970cf7f00b08388c181224a2b85");
|
|
77
77
|
hashMap.set("nodenv", "ac652c28481b001f7471f4183eac07b45d98ecbe83efc275830b0a1b2e0459b8");
|
|
78
|
-
hashMap.set("npm", "
|
|
78
|
+
hashMap.set("npm", "d8989e2dd8d18506b626d71934816dac9cc03311787d12d466cda46d33ca1324");
|
|
79
79
|
hashMap.set("nuget", "fb02247c67a198ffe414a44d23c7894bd114dcc53803334f82e39479e7b27f6f");
|
|
80
80
|
hashMap.set("nvm", "3eb77c7b0acf6d64753de78fad2499b352719853aa6872878c40675d14152322");
|
|
81
81
|
hashMap.set("ocb", "032b216684c14b0954e0bb019513a2aca3faaee5748587acb668d377d7c891ca");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.generated.js","names":[],"sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"sourcesContent":["export const hashMap = new Map<string, string>();\n\nhashMap.set('ansible','a52394a36ac5517f7330473c31d93aa05b2ce607c5e951b48f25a4693cd20a81');\nhashMap.set('ansible-galaxy','0a264d6be73953d801510fdeff271e4071c274339569c6dab4e2a128eaf4869f');\nhashMap.set('ant','2df5943cf0ed19a21b94df13729dbb925655548130caf37e3e22bebaed518e17');\nhashMap.set('apm','bdb6931cc03f4ac02ebfdb56c4b3483bb6c5250fa952545f1a25584d502bbffd');\nhashMap.set('argocd','cff9cd22257bc460ae4b9936570bf0ed5585f280a55d26629deaeeb0bfee8eb5');\nhashMap.set('asdf','430eb99b58171700c8a59c78b9e648575e9b176b781d90dd10a710f7b69015bb');\nhashMap.set('azure-pipelines','04a13dec4e08ba21004961c718072fde976226d65809fa3c838bf66ba93e5d5a');\nhashMap.set('batect','375d39b432013bedb1330cf40a2199dd822751b28578214f219e7bab98594b8d');\nhashMap.set('batect-wrapper','d999355511ea7f4053325a18b8cfc8d2b586c61e6760c35e557d383a673e3939');\nhashMap.set('bazel','c31bc0a0e23d32726bcc09aa67533ebc5058124bf89c88e09c837419f550801a');\nhashMap.set('bazel-module','9fbba0339f9f7785d52ab85c5f0f6385003093c063483c13feccba13ae438bef');\nhashMap.set('bazelisk','770f75a746dc6ba90c518788d5987d7df4243ef9eee122d1bb0556a93d6e1b11');\nhashMap.set('bicep','7246e0bfc06e0e28cbb03ac088c5591f648956b086e106aeb251fe5d628329db');\nhashMap.set('bitbucket-pipelines','59c0503494ab1442b127914503c01b97ac17b6742b19c632292d5aa24de115cd');\nhashMap.set('bitrise','478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42');\nhashMap.set('buildkite','b8b404f53cd5d61c39153fddf93945e621471c4ac6aa9960c881cd868922bb4c');\nhashMap.set('buildpacks','6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f');\nhashMap.set('bun','5820cfb6ebe018b8c336d481ea9ae319daaee6a2e368c45196fc8bc67cb3e755');\nhashMap.set('bun-version','df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4');\nhashMap.set('bundler','6e4784dd98c1f86ef64cc8cbf3128df48aebf920032d7792b54fdedd3dd9d4d5');\nhashMap.set('cake','9ebd8b481220b30a8860121d26184540a1a2fcc05ef780df9295dea39b386fad');\nhashMap.set('cargo','027f60d13311b340391633eceb3685b5105eb6de88d876270d40f4666e5ef7a5');\nhashMap.set('cdnurl','9a81c8e3c6ad6c788498c99fc1067ffdfcd92a427c3afaf8c0130975d83131f2');\nhashMap.set('circleci','91cbeb33ea20f9838e2c81a1195eb806f0b38fa282bc3679f62552f20575ca85');\nhashMap.set('cloudbuild','f4e40388944652c8a19f8518771ac8d3f3c4ccf81ddef0e68b463aca833cb73c');\nhashMap.set('cocoapods','f832e2beef885bb3fd697ed9bb3e8cd742926bfec37ff41212edd2dbb4edb3ba');\nhashMap.set('composer','3976117beb9adeade088187965929d42f21f5da12c4614fd22aa92cad1083b19');\nhashMap.set('conan','8d46e9a30ae628e26118aea10a98d1b846f7c5d96d51ce24693437d555f6d125');\nhashMap.set('copier','197219e93857ad7e6701755ede245824329da08913ebdb23d1e5e854a169aafe');\nhashMap.set('cpanfile','07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3');\nhashMap.set('crossplane','5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40');\nhashMap.set('crow','eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0');\nhashMap.set('deno','9585e4e0626cc3613c3903249972acf97942ad7e16d85fa0da6677373e445db1');\nhashMap.set('deps-edn','06783dbc8b9c7bb84e162d1f75b7db56dfa021cc6f809dfd2314cee8b64af08d');\nhashMap.set('devbox','a40050cc61bd9b5d500ec111abb17bb15d5f82ab5b7699f66f628307ba8382c9');\nhashMap.set('devcontainer','24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec');\nhashMap.set('docker-compose','fba87b82cb0f2bfd66526631fbe928b8153e7ca701a5790d02b944df17417bb9');\nhashMap.set('dockerfile','b5faeb8f31d238e0d05a4aeebf9a837273687908ab8078b34e738bb0e369c80c');\nhashMap.set('droneci','661d2a2d7295af8dd7a1234c7090c42a89306bd574c3adf1fc67782efaad3998');\nhashMap.set('fleet','ffa222820f72c4eb4cdc4c229ae8c50433bee96f3b974f0633d5a7d1f6427c97');\nhashMap.set('flux','842597c9083d82af99ef3d526101a3a53c4448414d2f53f7e969074757124811');\nhashMap.set('fvm','9b161df0f14bc6e536368952adf373e343630097121a913cea60ee284027fb90');\nhashMap.set('git-submodules','f4e2c6ddf2fa93241665c5176faafb358eecfcb701e7478790c4d58853ed827a');\nhashMap.set('github-actions','7bd984806fa6e33e0650d2f65d88758a9f4b972f366c6cd7c7698e22e6fb3ca3');\nhashMap.set('gitlabci','a5e1e66ef461e1c1e71062f85f35a212417e23627f4b002810f9a98295d6e672');\nhashMap.set('gitlabci-include','8860a15ab516fde00694f9bd9bf56fce4addafe5a55b5ddb9a4ec477d301d351');\nhashMap.set('glasskube','93e7b9000a17efa15a1abaaf320b5af9169b1ecd828fc0c881d98570ef9d9e30');\nhashMap.set('gleam','5e9b9f5f914afe5ed7b526c06c65111e3716d2dea9b0cbe7907bbc96db1064a3');\nhashMap.set('gomod','89899292f917777b79f8ce1714e54c4e61cf151fb75f87f1ddb1d1ccd6a4e6f7');\nhashMap.set('gradle','9e3ff52ce4ad2555929acdd4d32c417c4ef8714c23a92f2893ecc580fa4d6064');\nhashMap.set('gradle-wrapper','73ba30c34955fab7737454b5cff9aca6d1b5607d53c17c9e13d8ad96f6eaae87');\nhashMap.set('haskell-cabal','f158b7725e3143dfd2950e3de0bbccc2a61cd7eba87f7a54c5057e01252348e2');\nhashMap.set('helm-requirements','22f61344565f87ca3512c0ba8fac32627fde8ee919b7badae07b2116e285f049');\nhashMap.set('helm-values','0aa79bb0257d0d72e54dfd2653e59bfef63b97e46c035b7443593bdf6e6382aa');\nhashMap.set('helmfile','4e12edd848dcf258c94e9b7d4bd9fdd5674ffe12c5786bbcb51089b72bfe0ca3');\nhashMap.set('helmsman','951deeb3355da751ef39c9e932b26ea749450e32e75759e4b5fc29359e100b37');\nhashMap.set('helmv3','71e9e621ba0974271f1a7effcbd364efd66767d4336e844539788f5d6bb22720');\nhashMap.set('hermit','0fb25b7766c3a264fbb765ff75b1542b24136c4c9f933696d4a5aecfed637071');\nhashMap.set('homeassistant-manifest','05043c6db870cffbb6f8f3e351c025e3de227eaae0b24134b796aec46f84b65f');\nhashMap.set('homebrew','dffe954a4e18c2dc4bfdaa12222fe8ddc3395869afd5afa603fc2b6264747984');\nhashMap.set('html','81fa6c2bf2b868596584a48b949645207a2aa3081951ed99183ee50b70b77d5f');\nhashMap.set('jenkins','7fda0e7e0f3d5e18088ccb3594f727f4cfc48b064706bdaaf1a0a075b6a2cff5');\nhashMap.set('jsonnet-bundler','4cedeb0394e5c38361d1868ff45b4f34747ab8c492378b6e63dcaf1f4f3c024d');\nhashMap.set('kotlin-script','95ebc844c040ca047321b207d525220e29774a2a1fe06f9639e8353c66908564');\nhashMap.set('kubernetes','321e7d77fb3600dd4c00a86eaa1294927e7f92300b74fa2977d813dcaa3bb4de');\nhashMap.set('kustomize','706cc4776ad6ec4df5bed0ac84e8324ad7328457b6743b082e444d4770756604');\nhashMap.set('leiningen','c8397e376f1717c2f771ae9ea3ba6b720d2422b133cf937e762c44e42be146a2');\nhashMap.set('maven','c110b99291c2a5bc82cf7a69330275e9bbd7dc8ba3e9e987611dfcffbe002d8d');\nhashMap.set('maven-wrapper','6e53b6e4abf1d20b75094c7a70d66b4a5ac39954f009aa401f5e55dada8be4d0');\nhashMap.set('meteor','4636a47ba4dcfff19fe662572ef7a40d17146be3c966e00ef437e1fc8de92776');\nhashMap.set('mint','248fe4f1ea5c985921c286785792c97e06fc41f402b2d45df82f6aecd17f710e');\nhashMap.set('mise','59c691024c34cb4be4d9b4f811019ae9b22410df0da54977cdcecea261fbbbf5');\nhashMap.set('mix','0f79163dc2a1c896599d152be635c23beaf16812ae3d8fbfffec98c7bd0de872');\nhashMap.set('nix','9cbd96a29fe96e3df7418e422256380202f07970cf7f00b08388c181224a2b85');\nhashMap.set('nodenv','ac652c28481b001f7471f4183eac07b45d98ecbe83efc275830b0a1b2e0459b8');\nhashMap.set('npm','95017de512f3679634bfe839812b84712f59738062040039bc528e40743a4101');\nhashMap.set('nuget','fb02247c67a198ffe414a44d23c7894bd114dcc53803334f82e39479e7b27f6f');\nhashMap.set('nvm','3eb77c7b0acf6d64753de78fad2499b352719853aa6872878c40675d14152322');\nhashMap.set('ocb','032b216684c14b0954e0bb019513a2aca3faaee5748587acb668d377d7c891ca');\nhashMap.set('osgi','d6567a733ef3983112b46fdccd7ceebfcd48411104e0c6b6e714d4310db48024');\nhashMap.set('pep621','52450676f8b0e05134b3e8947b832195ef40bcaec1ce43d71351a2f797b80d75');\nhashMap.set('pep723','77022a0eae6a3cbb74a1e6d596db1276e379768e40448192b3fa81edd14ca73f');\nhashMap.set('pip-compile','a98dc76a002e1dc21662237f009ff8fea36236bb4e24cb82ee30c6a78f57271f');\nhashMap.set('pip_requirements','bf3a407f72abf711230247bef94ba5dc84c08a35107b0f017912fad66afa716a');\nhashMap.set('pip_setup','df18fba2bdcf48f3ca12a8f7e5cd28df31e2368d5528127277038ef4206eca79');\nhashMap.set('pipenv','baf237cd77173c1a7a9c7fa2a8bfb214f3c488ba0cc27f0e8f334df192e3a398');\nhashMap.set('pixi','e31c397982ffa34222b061f23f3b3683f42523dd5dca45ecce2448b0ebc55ea2');\nhashMap.set('poetry','e9dea5d591c87956b9f018414cb3dab8f2e13580a13be00550fdce198fdf08e6');\nhashMap.set('pre-commit','760f2c291ae084db889f722390798a0e2d431ccdc3bc676e73b14901ebea19ac');\nhashMap.set('proto','412053d4550026b4ace490b46e970915b87ec1abf0b0a0c6c8c58ccf1fc16843');\nhashMap.set('pub','8e7c65dfd1999de4f7c44392e949a4d8f4701eb86df59d550e4657feb06b1872');\nhashMap.set('puppet','ba58ab689e44acc8f61c3569ab8b40fde01b8a9d3aad712708e2a419e57d8b45');\nhashMap.set('pyenv','9ede8becc97774f9040b40f4472d3e933534b596e04c360bfe0f3c6f95f25182');\nhashMap.set('quadlet','40927b98dd2bac45dba60e66b5fd0e6b84b61d02db8be536fda7b14546a4feb7');\nhashMap.set('renovate-config','dfaf3f03ddaf70c332f7916106648f36dbfa6a36dd76d15dd27fa116ab3c174c');\nhashMap.set('ruby-version','2db2140d9eee8c555e729a4de0396fa2d78846d3149890ee12fa515bd654be97');\nhashMap.set('runtime-version','b582b168c0cc595e39010feb10f4b97a82683eb269e9598216fbb11cc186e160');\nhashMap.set('rust-toolchain','6ace53db02874d73620d2d872291839820a512a9529c42d174358c692e5db720');\nhashMap.set('sbt','e1eb5c7f0171a9bb1b6bd4a36a91039a31b6c84e0983d91d930be31a69506d9e');\nhashMap.set('scalafmt','9d36159b56835e96498af026a1fb0543200db0581681ef95ec54988f411e180f');\nhashMap.set('setup-cfg','4a3a7c812d34739c07685691e7e64c7d3127f9d7d4aff99dc45a25df97ed9745');\nhashMap.set('smithy','9641b91d065ffb63be0dd888139a0402dba41e550f8b44c592db9daf52109100');\nhashMap.set('sveltos','60dd75bb53ace31217211100d622fdb65068c6162758b6ae7103a6ce8bdc9f90');\nhashMap.set('swift','cdf063debdbf36888523ff8cec6d2d1b0ec6f49b37b2fbcd80b0d4f6a31114e1');\nhashMap.set('tekton','33948f5bdf7553909fa63744adb26da97ddf366e9499bccab1250879570267c9');\nhashMap.set('terraform','6788a8569ba9c50c763ffa2bed952a4314ae8e696c29f93d3eb7c4a12d99ce20');\nhashMap.set('terraform-version','ec8f786b9731d47f2c2fe0307caf64d7ddd83046fe7ff1f7d8423239f8b0f2aa');\nhashMap.set('terragrunt','300f8fb3c09667654412d2f5dd8ab4882e0f5d1d7a8bc39794993d2e7e58d1b7');\nhashMap.set('terragrunt-version','eea6087b33717d22ede2fc68c2f64df8390b75abe82110ed831a180648feb51d');\nhashMap.set('tflint-plugin','f423bfa2b42a2bfc0e38a33ebd4f9d452473e7ed4e7ad6384a99eb9a35d97479');\nhashMap.set('travis','f3e2f38e699c390b00ff481be5e91dceaa81609e93caf9a4214933de759c84fc');\nhashMap.set('typst','d080a79fbd961c6e21fcc505d544b7e0ff2126142acb1dcabdf6abbcd9339248');\nhashMap.set('unity3d','f13e25e115e3443f4e16cf31578acffa78fb1a5e23339680a92d8d6de6052920');\nhashMap.set('velaci','fda00ddb7cc23e9a37e0a8a253151df0a6930b4276d3e4f78cc54b9ac09af7de');\nhashMap.set('vendir','48e2bff8d3a96e8011ee12776fe9c6e8aac4718ff47e891c294a8f12660cb1bb');\nhashMap.set('woodpecker','6110d3bec33aaeb3511d4bbfa896cec3c8e02fb04a6cff50c9ba81061c851045');\nhashMap.set('xcodegen','dad511d88a9ce1dbdde8b9731f3da7f2bdaa4ca8a083294ee58d56da62ab1683');\nhashMap.set('jsonata','416bcf61144b276b3112814c6e6d261aa29608f46fbb0516c471d35c16f8f0d7');\nhashMap.set('regex','20be5247fdc164173871a051acb0527da017d0c155c653d7563601f55e7b3ff5');"],"mappings":";AAAA,MAAa,0BAAU,IAAI,IAAoB;AAE/C,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,kBAAiB,kEAAkE;AAC/F,QAAQ,IAAI,OAAM,kEAAkE;AACpF,QAAQ,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AAC9F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE"}
|
|
1
|
+
{"version":3,"file":"fingerprint.generated.js","names":[],"sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"sourcesContent":["export const hashMap = new Map<string, string>();\n\nhashMap.set('ansible','a52394a36ac5517f7330473c31d93aa05b2ce607c5e951b48f25a4693cd20a81');\nhashMap.set('ansible-galaxy','0a264d6be73953d801510fdeff271e4071c274339569c6dab4e2a128eaf4869f');\nhashMap.set('ant','2df5943cf0ed19a21b94df13729dbb925655548130caf37e3e22bebaed518e17');\nhashMap.set('apm','bdb6931cc03f4ac02ebfdb56c4b3483bb6c5250fa952545f1a25584d502bbffd');\nhashMap.set('argocd','cff9cd22257bc460ae4b9936570bf0ed5585f280a55d26629deaeeb0bfee8eb5');\nhashMap.set('asdf','430eb99b58171700c8a59c78b9e648575e9b176b781d90dd10a710f7b69015bb');\nhashMap.set('azure-pipelines','04a13dec4e08ba21004961c718072fde976226d65809fa3c838bf66ba93e5d5a');\nhashMap.set('batect','375d39b432013bedb1330cf40a2199dd822751b28578214f219e7bab98594b8d');\nhashMap.set('batect-wrapper','d999355511ea7f4053325a18b8cfc8d2b586c61e6760c35e557d383a673e3939');\nhashMap.set('bazel','c31bc0a0e23d32726bcc09aa67533ebc5058124bf89c88e09c837419f550801a');\nhashMap.set('bazel-module','9fbba0339f9f7785d52ab85c5f0f6385003093c063483c13feccba13ae438bef');\nhashMap.set('bazelisk','770f75a746dc6ba90c518788d5987d7df4243ef9eee122d1bb0556a93d6e1b11');\nhashMap.set('bicep','7246e0bfc06e0e28cbb03ac088c5591f648956b086e106aeb251fe5d628329db');\nhashMap.set('bitbucket-pipelines','59c0503494ab1442b127914503c01b97ac17b6742b19c632292d5aa24de115cd');\nhashMap.set('bitrise','478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42');\nhashMap.set('buildkite','b8b404f53cd5d61c39153fddf93945e621471c4ac6aa9960c881cd868922bb4c');\nhashMap.set('buildpacks','6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f');\nhashMap.set('bun','6789cc6499c77cdf44d4fb306198274bb72241e6d0ef7ceda7e916d7022d864c');\nhashMap.set('bun-version','df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4');\nhashMap.set('bundler','6e4784dd98c1f86ef64cc8cbf3128df48aebf920032d7792b54fdedd3dd9d4d5');\nhashMap.set('cake','9ebd8b481220b30a8860121d26184540a1a2fcc05ef780df9295dea39b386fad');\nhashMap.set('cargo','027f60d13311b340391633eceb3685b5105eb6de88d876270d40f4666e5ef7a5');\nhashMap.set('cdnurl','9a81c8e3c6ad6c788498c99fc1067ffdfcd92a427c3afaf8c0130975d83131f2');\nhashMap.set('circleci','91cbeb33ea20f9838e2c81a1195eb806f0b38fa282bc3679f62552f20575ca85');\nhashMap.set('cloudbuild','f4e40388944652c8a19f8518771ac8d3f3c4ccf81ddef0e68b463aca833cb73c');\nhashMap.set('cocoapods','f832e2beef885bb3fd697ed9bb3e8cd742926bfec37ff41212edd2dbb4edb3ba');\nhashMap.set('composer','3976117beb9adeade088187965929d42f21f5da12c4614fd22aa92cad1083b19');\nhashMap.set('conan','8d46e9a30ae628e26118aea10a98d1b846f7c5d96d51ce24693437d555f6d125');\nhashMap.set('copier','197219e93857ad7e6701755ede245824329da08913ebdb23d1e5e854a169aafe');\nhashMap.set('cpanfile','07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3');\nhashMap.set('crossplane','5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40');\nhashMap.set('crow','eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0');\nhashMap.set('deno','9585e4e0626cc3613c3903249972acf97942ad7e16d85fa0da6677373e445db1');\nhashMap.set('deps-edn','06783dbc8b9c7bb84e162d1f75b7db56dfa021cc6f809dfd2314cee8b64af08d');\nhashMap.set('devbox','a40050cc61bd9b5d500ec111abb17bb15d5f82ab5b7699f66f628307ba8382c9');\nhashMap.set('devcontainer','24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec');\nhashMap.set('docker-compose','fba87b82cb0f2bfd66526631fbe928b8153e7ca701a5790d02b944df17417bb9');\nhashMap.set('dockerfile','b5faeb8f31d238e0d05a4aeebf9a837273687908ab8078b34e738bb0e369c80c');\nhashMap.set('droneci','661d2a2d7295af8dd7a1234c7090c42a89306bd574c3adf1fc67782efaad3998');\nhashMap.set('fleet','ffa222820f72c4eb4cdc4c229ae8c50433bee96f3b974f0633d5a7d1f6427c97');\nhashMap.set('flux','842597c9083d82af99ef3d526101a3a53c4448414d2f53f7e969074757124811');\nhashMap.set('fvm','9b161df0f14bc6e536368952adf373e343630097121a913cea60ee284027fb90');\nhashMap.set('git-submodules','f4e2c6ddf2fa93241665c5176faafb358eecfcb701e7478790c4d58853ed827a');\nhashMap.set('github-actions','7bd984806fa6e33e0650d2f65d88758a9f4b972f366c6cd7c7698e22e6fb3ca3');\nhashMap.set('gitlabci','a5e1e66ef461e1c1e71062f85f35a212417e23627f4b002810f9a98295d6e672');\nhashMap.set('gitlabci-include','8860a15ab516fde00694f9bd9bf56fce4addafe5a55b5ddb9a4ec477d301d351');\nhashMap.set('glasskube','93e7b9000a17efa15a1abaaf320b5af9169b1ecd828fc0c881d98570ef9d9e30');\nhashMap.set('gleam','5e9b9f5f914afe5ed7b526c06c65111e3716d2dea9b0cbe7907bbc96db1064a3');\nhashMap.set('gomod','89899292f917777b79f8ce1714e54c4e61cf151fb75f87f1ddb1d1ccd6a4e6f7');\nhashMap.set('gradle','9e3ff52ce4ad2555929acdd4d32c417c4ef8714c23a92f2893ecc580fa4d6064');\nhashMap.set('gradle-wrapper','73ba30c34955fab7737454b5cff9aca6d1b5607d53c17c9e13d8ad96f6eaae87');\nhashMap.set('haskell-cabal','f158b7725e3143dfd2950e3de0bbccc2a61cd7eba87f7a54c5057e01252348e2');\nhashMap.set('helm-requirements','22f61344565f87ca3512c0ba8fac32627fde8ee919b7badae07b2116e285f049');\nhashMap.set('helm-values','0aa79bb0257d0d72e54dfd2653e59bfef63b97e46c035b7443593bdf6e6382aa');\nhashMap.set('helmfile','4e12edd848dcf258c94e9b7d4bd9fdd5674ffe12c5786bbcb51089b72bfe0ca3');\nhashMap.set('helmsman','951deeb3355da751ef39c9e932b26ea749450e32e75759e4b5fc29359e100b37');\nhashMap.set('helmv3','71e9e621ba0974271f1a7effcbd364efd66767d4336e844539788f5d6bb22720');\nhashMap.set('hermit','0fb25b7766c3a264fbb765ff75b1542b24136c4c9f933696d4a5aecfed637071');\nhashMap.set('homeassistant-manifest','05043c6db870cffbb6f8f3e351c025e3de227eaae0b24134b796aec46f84b65f');\nhashMap.set('homebrew','dffe954a4e18c2dc4bfdaa12222fe8ddc3395869afd5afa603fc2b6264747984');\nhashMap.set('html','81fa6c2bf2b868596584a48b949645207a2aa3081951ed99183ee50b70b77d5f');\nhashMap.set('jenkins','7fda0e7e0f3d5e18088ccb3594f727f4cfc48b064706bdaaf1a0a075b6a2cff5');\nhashMap.set('jsonnet-bundler','4cedeb0394e5c38361d1868ff45b4f34747ab8c492378b6e63dcaf1f4f3c024d');\nhashMap.set('kotlin-script','95ebc844c040ca047321b207d525220e29774a2a1fe06f9639e8353c66908564');\nhashMap.set('kubernetes','321e7d77fb3600dd4c00a86eaa1294927e7f92300b74fa2977d813dcaa3bb4de');\nhashMap.set('kustomize','706cc4776ad6ec4df5bed0ac84e8324ad7328457b6743b082e444d4770756604');\nhashMap.set('leiningen','c8397e376f1717c2f771ae9ea3ba6b720d2422b133cf937e762c44e42be146a2');\nhashMap.set('maven','c110b99291c2a5bc82cf7a69330275e9bbd7dc8ba3e9e987611dfcffbe002d8d');\nhashMap.set('maven-wrapper','6e53b6e4abf1d20b75094c7a70d66b4a5ac39954f009aa401f5e55dada8be4d0');\nhashMap.set('meteor','4636a47ba4dcfff19fe662572ef7a40d17146be3c966e00ef437e1fc8de92776');\nhashMap.set('mint','248fe4f1ea5c985921c286785792c97e06fc41f402b2d45df82f6aecd17f710e');\nhashMap.set('mise','59c691024c34cb4be4d9b4f811019ae9b22410df0da54977cdcecea261fbbbf5');\nhashMap.set('mix','0f79163dc2a1c896599d152be635c23beaf16812ae3d8fbfffec98c7bd0de872');\nhashMap.set('nix','9cbd96a29fe96e3df7418e422256380202f07970cf7f00b08388c181224a2b85');\nhashMap.set('nodenv','ac652c28481b001f7471f4183eac07b45d98ecbe83efc275830b0a1b2e0459b8');\nhashMap.set('npm','d8989e2dd8d18506b626d71934816dac9cc03311787d12d466cda46d33ca1324');\nhashMap.set('nuget','fb02247c67a198ffe414a44d23c7894bd114dcc53803334f82e39479e7b27f6f');\nhashMap.set('nvm','3eb77c7b0acf6d64753de78fad2499b352719853aa6872878c40675d14152322');\nhashMap.set('ocb','032b216684c14b0954e0bb019513a2aca3faaee5748587acb668d377d7c891ca');\nhashMap.set('osgi','d6567a733ef3983112b46fdccd7ceebfcd48411104e0c6b6e714d4310db48024');\nhashMap.set('pep621','52450676f8b0e05134b3e8947b832195ef40bcaec1ce43d71351a2f797b80d75');\nhashMap.set('pep723','77022a0eae6a3cbb74a1e6d596db1276e379768e40448192b3fa81edd14ca73f');\nhashMap.set('pip-compile','a98dc76a002e1dc21662237f009ff8fea36236bb4e24cb82ee30c6a78f57271f');\nhashMap.set('pip_requirements','bf3a407f72abf711230247bef94ba5dc84c08a35107b0f017912fad66afa716a');\nhashMap.set('pip_setup','df18fba2bdcf48f3ca12a8f7e5cd28df31e2368d5528127277038ef4206eca79');\nhashMap.set('pipenv','baf237cd77173c1a7a9c7fa2a8bfb214f3c488ba0cc27f0e8f334df192e3a398');\nhashMap.set('pixi','e31c397982ffa34222b061f23f3b3683f42523dd5dca45ecce2448b0ebc55ea2');\nhashMap.set('poetry','e9dea5d591c87956b9f018414cb3dab8f2e13580a13be00550fdce198fdf08e6');\nhashMap.set('pre-commit','760f2c291ae084db889f722390798a0e2d431ccdc3bc676e73b14901ebea19ac');\nhashMap.set('proto','412053d4550026b4ace490b46e970915b87ec1abf0b0a0c6c8c58ccf1fc16843');\nhashMap.set('pub','8e7c65dfd1999de4f7c44392e949a4d8f4701eb86df59d550e4657feb06b1872');\nhashMap.set('puppet','ba58ab689e44acc8f61c3569ab8b40fde01b8a9d3aad712708e2a419e57d8b45');\nhashMap.set('pyenv','9ede8becc97774f9040b40f4472d3e933534b596e04c360bfe0f3c6f95f25182');\nhashMap.set('quadlet','40927b98dd2bac45dba60e66b5fd0e6b84b61d02db8be536fda7b14546a4feb7');\nhashMap.set('renovate-config','dfaf3f03ddaf70c332f7916106648f36dbfa6a36dd76d15dd27fa116ab3c174c');\nhashMap.set('ruby-version','2db2140d9eee8c555e729a4de0396fa2d78846d3149890ee12fa515bd654be97');\nhashMap.set('runtime-version','b582b168c0cc595e39010feb10f4b97a82683eb269e9598216fbb11cc186e160');\nhashMap.set('rust-toolchain','6ace53db02874d73620d2d872291839820a512a9529c42d174358c692e5db720');\nhashMap.set('sbt','e1eb5c7f0171a9bb1b6bd4a36a91039a31b6c84e0983d91d930be31a69506d9e');\nhashMap.set('scalafmt','9d36159b56835e96498af026a1fb0543200db0581681ef95ec54988f411e180f');\nhashMap.set('setup-cfg','4a3a7c812d34739c07685691e7e64c7d3127f9d7d4aff99dc45a25df97ed9745');\nhashMap.set('smithy','9641b91d065ffb63be0dd888139a0402dba41e550f8b44c592db9daf52109100');\nhashMap.set('sveltos','60dd75bb53ace31217211100d622fdb65068c6162758b6ae7103a6ce8bdc9f90');\nhashMap.set('swift','cdf063debdbf36888523ff8cec6d2d1b0ec6f49b37b2fbcd80b0d4f6a31114e1');\nhashMap.set('tekton','33948f5bdf7553909fa63744adb26da97ddf366e9499bccab1250879570267c9');\nhashMap.set('terraform','6788a8569ba9c50c763ffa2bed952a4314ae8e696c29f93d3eb7c4a12d99ce20');\nhashMap.set('terraform-version','ec8f786b9731d47f2c2fe0307caf64d7ddd83046fe7ff1f7d8423239f8b0f2aa');\nhashMap.set('terragrunt','300f8fb3c09667654412d2f5dd8ab4882e0f5d1d7a8bc39794993d2e7e58d1b7');\nhashMap.set('terragrunt-version','eea6087b33717d22ede2fc68c2f64df8390b75abe82110ed831a180648feb51d');\nhashMap.set('tflint-plugin','f423bfa2b42a2bfc0e38a33ebd4f9d452473e7ed4e7ad6384a99eb9a35d97479');\nhashMap.set('travis','f3e2f38e699c390b00ff481be5e91dceaa81609e93caf9a4214933de759c84fc');\nhashMap.set('typst','d080a79fbd961c6e21fcc505d544b7e0ff2126142acb1dcabdf6abbcd9339248');\nhashMap.set('unity3d','f13e25e115e3443f4e16cf31578acffa78fb1a5e23339680a92d8d6de6052920');\nhashMap.set('velaci','fda00ddb7cc23e9a37e0a8a253151df0a6930b4276d3e4f78cc54b9ac09af7de');\nhashMap.set('vendir','48e2bff8d3a96e8011ee12776fe9c6e8aac4718ff47e891c294a8f12660cb1bb');\nhashMap.set('woodpecker','6110d3bec33aaeb3511d4bbfa896cec3c8e02fb04a6cff50c9ba81061c851045');\nhashMap.set('xcodegen','dad511d88a9ce1dbdde8b9731f3da7f2bdaa4ca8a083294ee58d56da62ab1683');\nhashMap.set('jsonata','416bcf61144b276b3112814c6e6d261aa29608f46fbb0516c471d35c16f8f0d7');\nhashMap.set('regex','20be5247fdc164173871a051acb0527da017d0c155c653d7563601f55e7b3ff5');"],"mappings":";AAAA,MAAa,0BAAU,IAAI,IAAoB;AAE/C,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,kBAAiB,kEAAkE;AAC/F,QAAQ,IAAI,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AQ,IAAI,iBAAgB,kEAAkE;AAC9F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE"}
|
|
@@ -3,6 +3,7 @@ import { regEx } from "../../../util/regex.js";
|
|
|
3
3
|
import { matchRegexOrGlob } from "../../../util/string-match.js";
|
|
4
4
|
import { logger } from "../../../logger/index.js";
|
|
5
5
|
import { localPathExists, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
6
|
+
import { updateDependency } from "./update/dependency/index.js";
|
|
6
7
|
import { isEmptyArray, isNonEmptyObject, isString } from "@sindresorhus/is";
|
|
7
8
|
import { isScalar, isSeq, parseDocument } from "yaml";
|
|
8
9
|
import upath from "upath";
|
|
@@ -20,34 +21,47 @@ async function updateArtifacts(updateArtifactsConfig) {
|
|
|
20
21
|
return res;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
* Updates
|
|
24
|
+
* Updates corepack hashes in `packageManager` and `devEngines.packageManager` from the new version's integrity digest.
|
|
24
25
|
* @see https://github.com/nodejs/corepack/blob/57bfb67b062ea1b8746b302bcdbf9f8e8438c526/sources/corepackUtils.ts#L300
|
|
25
26
|
*/
|
|
26
27
|
function handlePackageManagerUpdates(updateArtifactsConfig) {
|
|
27
28
|
const { packageFileName, updatedDeps, newPackageFileContent } = updateArtifactsConfig;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} }
|
|
29
|
+
const packageManagerUpdates = updatedDeps.filter((dep) => (dep.depType === "packageManager" || dep.depType === "devEngines.packageManager") && dep.currentValue && regEx(versionWithHashRegString).test(dep.currentValue));
|
|
30
|
+
let newContent = newPackageFileContent;
|
|
31
|
+
for (const packageManagerUpdate of packageManagerUpdates) {
|
|
32
|
+
const { depName, newVersion, newDigest } = packageManagerUpdate;
|
|
33
|
+
const sriMatch = regEx(sriRegString).exec(newDigest ?? "");
|
|
34
|
+
if (!sriMatch?.groups) {
|
|
35
|
+
logger.warn({
|
|
36
|
+
packageFileName,
|
|
37
|
+
depName,
|
|
38
|
+
newVersion,
|
|
39
|
+
newDigest
|
|
40
|
+
}, "Cannot update packageManager hash: no valid digest available");
|
|
41
|
+
return { artifactError: {
|
|
42
|
+
fileName: packageFileName,
|
|
43
|
+
stderr: `Cannot update packageManager hash for ${depName}@${newVersion}: no valid digest available`
|
|
44
|
+
} };
|
|
45
|
+
}
|
|
46
|
+
const { algo, hash } = sriMatch.groups;
|
|
47
|
+
const versionWithHash = `${newVersion}+${algo}.${Buffer.from(hash, "base64").toString("hex")}`;
|
|
48
|
+
if (packageManagerUpdate.depType === "packageManager") newContent = newContent.replace(regEx(packageManagerFieldRegString), `$1${depName}@${versionWithHash}"`);
|
|
49
|
+
else {
|
|
50
|
+
const updatedContent = updateDependency({
|
|
51
|
+
fileContent: newContent,
|
|
52
|
+
packageFile: packageFileName,
|
|
53
|
+
upgrade: {
|
|
54
|
+
...packageManagerUpdate,
|
|
55
|
+
newValue: versionWithHash
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
if (!updatedContent) return { artifactError: {
|
|
59
|
+
fileName: packageFileName,
|
|
60
|
+
stderr: `Failed to apply Corepack hash for ${depName}@${newVersion}`
|
|
61
|
+
} };
|
|
62
|
+
newContent = updatedContent;
|
|
63
|
+
}
|
|
47
64
|
}
|
|
48
|
-
const { algo, hash } = sriMatch.groups;
|
|
49
|
-
const newPackageManagerValue = `${depName}@${newVersion}+${algo}.${Buffer.from(hash, "base64").toString("hex")}`;
|
|
50
|
-
const newContent = newPackageFileContent.replace(regEx(packageManagerFieldRegString), `$1${newPackageManagerValue}"`);
|
|
51
65
|
if (newContent === newPackageFileContent) return null;
|
|
52
66
|
logger.debug("Returning updated package.json");
|
|
53
67
|
return { file: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/npm/artifacts.ts"],"sourcesContent":["import { isEmptyArray, isNonEmptyObject, isString } from '@sindresorhus/is';\nimport upath from 'upath';\nimport type { Scalar, YAMLSeq } from 'yaml';\nimport { isScalar, isSeq, parseDocument } from 'yaml';\nimport { logger } from '../../../logger/index.ts';\nimport {\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { matchRegexOrGlob } from '../../../util/string-match.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\n\n// eg. 8.15.5+sha256.4b4efa12490e5055d59b9b9fc9438b7d581a6b7af3b5675eb5c5f447cee1a589\nconst versionWithHashRegString = '^(?<version>.*)\\\\+(?<hash>.*)';\n\n// Matches a Subresource Integrity string, eg. sha512-<base64 digest>\nconst sriRegString = '^(?<algo>sha\\\\d+)-(?<hash>[A-Za-z0-9+/]+={0,2})$';\n\nconst packageManagerFieldRegString = '(\"packageManager\"\\\\s*:\\\\s*\")[^\"]*\"';\n\nexport async function updateArtifacts(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`npm.updateArtifacts(${updateArtifactsConfig.packageFileName})`);\n let res: UpdateArtifactsResult[] = [];\n res.push(coerceObject(handlePackageManagerUpdates(updateArtifactsConfig)));\n res.push(coerceObject(await updatePnpmWorkspace(updateArtifactsConfig)));\n\n res = res.filter(isNonEmptyObject);\n if (res.length === 0) {\n return null;\n }\n\n return res;\n}\n\n/**\n * Updates the corepack hash of the `packageManager` field from the new version's integrity digest.\n * @see https://github.com/nodejs/corepack/blob/57bfb67b062ea1b8746b302bcdbf9f8e8438c526/sources/corepackUtils.ts#L300\n */\nfunction handlePackageManagerUpdates(\n updateArtifactsConfig: UpdateArtifact,\n): UpdateArtifactsResult | null {\n const { packageFileName, updatedDeps, newPackageFileContent } =\n updateArtifactsConfig;\n const packageManagerUpdate = updatedDeps.find(\n (dep) => dep.depType === 'packageManager',\n );\n\n if (!packageManagerUpdate) {\n logger.debug('No packageManager updates - returning null');\n return null;\n }\n\n const { currentValue, depName, newVersion, newDigest } = packageManagerUpdate;\n\n // Only rewrite the hash if the current value already has one\n if (!currentValue || !regEx(versionWithHashRegString).test(currentValue)) {\n return null;\n }\n\n const sriMatch = regEx(sriRegString).exec(newDigest ?? '');\n if (!sriMatch?.groups) {\n logger.warn(\n { packageFileName, depName, newVersion, newDigest },\n 'Cannot update packageManager hash: no valid digest available',\n );\n return {\n artifactError: {\n fileName: packageFileName,\n stderr: `Cannot update packageManager hash for ${depName}@${newVersion}: no valid digest available`,\n },\n };\n }\n\n const { algo, hash } = sriMatch.groups;\n const hexHash = Buffer.from(hash, 'base64').toString('hex');\n const newPackageManagerValue = `${depName}@${newVersion}+${algo}.${hexHash}`;\n\n const newContent = newPackageFileContent.replace(\n regEx(packageManagerFieldRegString),\n `$1${newPackageManagerValue}\"`,\n );\n\n if (newContent === newPackageFileContent) {\n return null;\n }\n\n logger.debug('Returning updated package.json');\n return {\n file: {\n type: 'addition',\n path: packageFileName,\n contents: newContent,\n },\n };\n}\n\n/**\n * Update the minimumReleaseAgeExclude setting in pnpm-workspace.yaml if needed\n */\nasync function updatePnpmWorkspace(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const upgrades = updateArtifactsConfig.updatedDeps.filter(\n (u) => u.isVulnerabilityAlert,\n );\n // return early if no security updates are present\n if (isEmptyArray(upgrades)) {\n return null;\n }\n\n const pnpmLockFile = upgrades[0].managerData?.pnpmLockFile;\n if (!isString(pnpmLockFile)) {\n logger.debug(\n 'No pnpm shrinkwrap found, not attempting to update pnpm-workspace.yaml',\n );\n return null;\n }\n const lockFileDir = upath.dirname(pnpmLockFile);\n const pnpmWorkspaceFilePath = upath.join(lockFileDir, 'pnpm-workspace.yaml');\n\n if (!(await localPathExists(pnpmWorkspaceFilePath))) {\n return null;\n }\n\n // use already-updated content when updating the workspace file itself\n const packageFileContent =\n updateArtifactsConfig.packageFileName === pnpmWorkspaceFilePath\n ? updateArtifactsConfig.newPackageFileContent\n : (await readLocalFile(pnpmWorkspaceFilePath, 'utf8'))!;\n const doc = parseDocument(packageFileContent);\n\n if (!doc.get('minimumReleaseAge')) {\n return null;\n }\n\n let updated = false;\n\n for (const upgrade of upgrades) {\n let excludeNode = doc.getIn(['minimumReleaseAgeExclude']) as YAMLSeq | null;\n // v8 ignore next -- TODO: add test #40625\n const newVersion = upgrade.newVersion ?? upgrade.newValue;\n // For pnpm overrides with range selectors (e.g. \"pkg@<=1.0.0\"), depName contains\n // the full key including the selector. Use packageName (bare package name) for\n // minimumReleaseAgeExclude entries which require exact versions only.\n const excludeDepName = upgrade.packageName ?? upgrade.depName;\n\n /* v8 ignore if -- should not happen, adding for type narrowing*/\n if (excludeNode && !isSeq(excludeNode)) {\n return null;\n }\n\n if (!excludeNode) {\n logger.debug('Adding new exclude block');\n excludeNode = doc.createNode([]);\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n excludeNode.items.push(newItem);\n doc.set('minimumReleaseAgeExclude', excludeNode);\n updated = true;\n continue;\n }\n\n const {\n item: matchedItem,\n allExcluded,\n malformed,\n } = getMatchedItem(excludeDepName!, excludeNode.items);\n\n if (allExcluded) {\n // still clean up any malformed entries even when a wildcard covers the package\n } else if (malformed && isScalar<string>(matchedItem)) {\n logger.debug(\n { entry: matchedItem.value, excludeDepName, newVersion },\n 'Replacing malformed minimumReleaseAgeExclude entry',\n );\n matchedItem.value = `${excludeDepName}@${newVersion}`;\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n } else if (isScalar<string>(matchedItem)) {\n // if we have a comment before the list, which includes the dependency\n if (excludeNode?.commentBefore?.includes(`${excludeDepName}@`)) {\n // and it doesn't already have the version included in it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n excludeNode.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // then append it\n\n // normalize value (no quote handling needed)\n excludeNode.commentBefore = `${excludeNode.commentBefore} || ${newVersion}`;\n updated = true;\n }\n }\n // otherwise, if it's in our matched item's comment\n else if (matchedItem.commentBefore) {\n // add it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // normalize value (no quote handling needed)\n matchedItem.commentBefore = `${matchedItem.commentBefore} || ${newVersion}`;\n updated = true;\n }\n } else {\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n }\n\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.value,\n excludeDepName,\n newVersion,\n )\n ) {\n matchedItem.value = `${matchedItem.value} || ${newVersion}`;\n updated = true;\n }\n } else {\n // add new entry\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n\n excludeNode.items.push(newItem);\n updated = true;\n }\n\n // Remove any malformed entries for the same package left over from the prior bug\n for (let i = excludeNode.items.length - 1; i >= 0; i--) {\n const item = excludeNode.items[i];\n if (\n item !== matchedItem &&\n isScalar(item) &&\n isString(item.value) &&\n item.value.startsWith(`${excludeDepName}@`) &&\n !isValidMinimumReleaseAgeExcludeEntry(item.value, excludeDepName!)\n ) {\n excludeNode.items.splice(i, 1);\n updated = true;\n }\n }\n }\n\n if (!updated) {\n return null;\n }\n\n const newContent = doc.toString();\n await writeLocalFile(pnpmWorkspaceFilePath, newContent);\n\n return {\n file: {\n type: 'addition',\n path: pnpmWorkspaceFilePath,\n contents: newContent,\n },\n };\n}\n\nfunction getMatchedItem(\n depName: string,\n items: unknown[],\n): {\n item: Scalar | null;\n allExcluded: boolean;\n malformed?: boolean;\n} {\n let malformedItem: Scalar | null = null;\n\n for (const item of items) {\n /* v8 ignore if -- should not happen */\n if (!isScalar(item) || !isString(item.value)) {\n continue;\n }\n\n if (item.value.startsWith(`${depName}@`)) {\n if (isValidMinimumReleaseAgeExcludeEntry(item.value, depName)) {\n return {\n allExcluded: false,\n item,\n };\n }\n malformedItem ??= item;\n continue;\n }\n\n if (item.value === depName || matchRegexOrGlob(depName, item.value)) {\n return {\n allExcluded: true,\n item,\n };\n }\n }\n\n if (malformedItem) {\n return {\n allExcluded: false,\n item: malformedItem,\n malformed: true,\n };\n }\n\n return {\n item: null,\n allExcluded: false,\n };\n}\n\n/** pnpm requires package@version entries without range selectors or extra @ in the version part */\nfunction isValidMinimumReleaseAgeExcludeEntry(\n value: string,\n packageName: string,\n): boolean {\n return !value.slice(`${packageName}@`.length).includes('@');\n}\n\n/** determine whether a comment or a list item contains the depName at a given newVersion */\nfunction minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n line: string,\n depName: string | undefined,\n newVersion: string | undefined,\n): boolean {\n if (line.includes(`${depName}@${newVersion}`)) {\n return true;\n }\n\n if (line.includes(`|| ${newVersion}`)) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;AAgBA,MAAM,2BAA2B;AAGjC,MAAM,eAAe;AAErB,MAAM,+BAA+B;AAErC,eAAsB,gBACpB,uBACyC;CACzC,OAAO,MAAM,uBAAuB,sBAAsB,gBAAgB,EAAE;CAC5E,IAAI,MAA+B,CAAC;CACpC,IAAI,KAAK,aAAa,4B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,SAAS,KAAK,KAAK,GACzC;EAGF,IAAI,KAAK,MAAM,WAAW,GAAG,QAAQ,EAAE,GAAG;GACxC,IAAI,qCAAqC,KAAK,OAAO,OAAO,GAC1D,OAAO;IACL,aAAa;IACb;GACF;GAEF,kBAAkB;GAClB;EACF;EAEA,IAAI,KAAK,UAAU,WAAW,iBAAiB,SAAS,KAAK,KAAK,GAChE,OAAO;GACL,aAAa;GACb;EACF;CAEJ;CAEA,IAAI,eACF,OAAO;EACL,aAAa;EACb,MAAM;EACN,WAAW;CACb;CAGF,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;;AAGA,SAAS,qCACP,OACA,aACS;CACT,OAAO,CAAC,MAAM,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC,SAAS,GAAG;AAC5D;;AAGA,SAAS,kDACP,MACA,SACA,YACS;CACT,IAAI,KAAK,SAAS,GAAG,QAAQ,GAAG,YAAY,GAC1C,OAAO;CAGT,IAAI,KAAK,SAAS,MAAM,YAAY,GAClC,OAAO;CAGT,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/npm/artifacts.ts"],"sourcesContent":["import { isEmptyArray, isNonEmptyObject, isString } from '@sindresorhus/is';\nimport upath from 'upath';\nimport type { Scalar, YAMLSeq } from 'yaml';\nimport { isScalar, isSeq, parseDocument } from 'yaml';\nimport { logger } from '../../../logger/index.ts';\nimport {\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { matchRegexOrGlob } from '../../../util/string-match.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { updateDependency } from './update/dependency/index.ts';\n\n// eg. 8.15.5+sha256.4b4efa12490e5055d59b9b9fc9438b7d581a6b7af3b5675eb5c5f447cee1a589\nconst versionWithHashRegString = '^(?<version>.*)\\\\+(?<hash>.*)';\n\n// Matches a Subresource Integrity string, eg. sha512-<base64 digest>\nconst sriRegString = '^(?<algo>sha\\\\d+)-(?<hash>[A-Za-z0-9+/]+={0,2})$';\n\nconst packageManagerFieldRegString = '(\"packageManager\"\\\\s*:\\\\s*\")[^\"]*\"';\n\nexport async function updateArtifacts(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`npm.updateArtifacts(${updateArtifactsConfig.packageFileName})`);\n let res: UpdateArtifactsResult[] = [];\n res.push(coerceObject(handlePackageManagerUpdates(updateArtifactsConfig)));\n res.push(coerceObject(await updatePnpmWorkspace(updateArtifactsConfig)));\n\n res = res.filter(isNonEmptyObject);\n if (res.length === 0) {\n return null;\n }\n\n return res;\n}\n\n/**\n * Updates corepack hashes in `packageManager` and `devEngines.packageManager` from the new version's integrity digest.\n * @see https://github.com/nodejs/corepack/blob/57bfb67b062ea1b8746b302bcdbf9f8e8438c526/sources/corepackUtils.ts#L300\n */\nfunction handlePackageManagerUpdates(\n updateArtifactsConfig: UpdateArtifact,\n): UpdateArtifactsResult | null {\n const { packageFileName, updatedDeps, newPackageFileContent } =\n updateArtifactsConfig;\n const packageManagerUpdates = updatedDeps.filter(\n (dep) =>\n (dep.depType === 'packageManager' ||\n dep.depType === 'devEngines.packageManager') &&\n dep.currentValue &&\n regEx(versionWithHashRegString).test(dep.currentValue),\n );\n\n let newContent = newPackageFileContent;\n for (const packageManagerUpdate of packageManagerUpdates) {\n const { depName, newVersion, newDigest } = packageManagerUpdate;\n const sriMatch = regEx(sriRegString).exec(newDigest ?? '');\n if (!sriMatch?.groups) {\n logger.warn(\n { packageFileName, depName, newVersion, newDigest },\n 'Cannot update packageManager hash: no valid digest available',\n );\n return {\n artifactError: {\n fileName: packageFileName,\n stderr: `Cannot update packageManager hash for ${depName}@${newVersion}: no valid digest available`,\n },\n };\n }\n\n const { algo, hash } = sriMatch.groups;\n const hexHash = Buffer.from(hash, 'base64').toString('hex');\n const versionWithHash = `${newVersion}+${algo}.${hexHash}`;\n\n if (packageManagerUpdate.depType === 'packageManager') {\n newContent = newContent.replace(\n regEx(packageManagerFieldRegString),\n `$1${depName}@${versionWithHash}\"`,\n );\n } else {\n const updatedContent = updateDependency({\n fileContent: newContent,\n packageFile: packageFileName,\n upgrade: { ...packageManagerUpdate, newValue: versionWithHash },\n });\n if (!updatedContent) {\n return {\n artifactError: {\n fileName: packageFileName,\n stderr: `Failed to apply Corepack hash for ${depName}@${newVersion}`,\n },\n };\n }\n newContent = updatedContent;\n }\n }\n\n if (newContent === newPackageFileContent) {\n return null;\n }\n\n logger.debug('Returning updated package.json');\n return {\n file: {\n type: 'addition',\n path: packageFileName,\n contents: newContent,\n },\n };\n}\n\n/**\n * Update the minimumReleaseAgeExclude setting in pnpm-workspace.yaml if needed\n */\nasync function updatePnpmWorkspace(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const upgrades = updateArtifactsConfig.updatedDeps.filter(\n (u) => u.isVulnerabilityAlert,\n );\n // return early if no security updates are present\n if (isEmptyArray(upgrades)) {\n return null;\n }\n\n const pnpmLockFile = upgrades[0].managerData?.pnpmLockFile;\n if (!isString(pnpmLockFile)) {\n logger.debug(\n 'No pnpm shrinkwrap found, not attempting to update pnpm-workspace.yaml',\n );\n return null;\n }\n const lockFileDir = upath.dirname(pnpmLockFile);\n const pnpmWorkspaceFilePath = upath.join(lockFileDir, 'pnpm-workspace.yaml');\n\n if (!(await localPathExists(pnpmWorkspaceFilePath))) {\n return null;\n }\n\n // use already-updated content when updating the workspace file itself\n const packageFileContent =\n updateArtifactsConfig.packageFileName === pnpmWorkspaceFilePath\n ? updateArtifactsConfig.newPackageFileContent\n : (await readLocalFile(pnpmWorkspaceFilePath, 'utf8'))!;\n const doc = parseDocument(packageFileContent);\n\n if (!doc.get('minimumReleaseAge')) {\n return null;\n }\n\n let updated = false;\n\n for (const upgrade of upgrades) {\n let excludeNode = doc.getIn(['minimumReleaseAgeExclude']) as YAMLSeq | null;\n // v8 ignore next -- TODO: add test #40625\n const newVersion = upgrade.newVersion ?? upgrade.newValue;\n // For pnpm overrides with range selectors (e.g. \"pkg@<=1.0.0\"), depName contains\n // the full key including the selector. Use packageName (bare package name) for\n // minimumReleaseAgeExclude entries which require exact versions only.\n const excludeDepName = upgrade.packageName ?? upgrade.depName;\n\n /* v8 ignore if -- should not happen, adding for type narrowing*/\n if (excludeNode && !isSeq(excludeNode)) {\n return null;\n }\n\n if (!excludeNode) {\n logger.debug('Adding new exclude block');\n excludeNode = doc.createNode([]);\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n excludeNode.items.push(newItem);\n doc.set('minimumReleaseAgeExclude', excludeNode);\n updated = true;\n continue;\n }\n\n const {\n item: matchedItem,\n allExcluded,\n malformed,\n } = getMatchedItem(excludeDepName!, excludeNode.items);\n\n if (allExcluded) {\n // still clean up any malformed entries even when a wildcard covers the package\n } else if (malformed && isScalar<string>(matchedItem)) {\n logger.debug(\n { entry: matchedItem.value, excludeDepName, newVersion },\n 'Replacing malformed minimumReleaseAgeExclude entry',\n );\n matchedItem.value = `${excludeDepName}@${newVersion}`;\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n } else if (isScalar<string>(matchedItem)) {\n // if we have a comment before the list, which includes the dependency\n if (excludeNode?.commentBefore?.includes(`${excludeDepName}@`)) {\n // and it doesn't already have the version included in it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n excludeNode.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // then append it\n\n // normalize value (no quote handling needed)\n excludeNode.commentBefore = `${excludeNode.commentBefore} || ${newVersion}`;\n updated = true;\n }\n }\n // otherwise, if it's in our matched item's comment\n else if (matchedItem.commentBefore) {\n // add it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // normalize value (no quote handling needed)\n matchedItem.commentBefore = `${matchedItem.commentBefore} || ${newVersion}`;\n updated = true;\n }\n } else {\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n }\n\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.value,\n excludeDepName,\n newVersion,\n )\n ) {\n matchedItem.value = `${matchedItem.value} || ${newVersion}`;\n updated = true;\n }\n } else {\n // add new entry\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n\n excludeNode.items.push(newItem);\n updated = true;\n }\n\n // Remove any malformed entries for the same package left over from the prior bug\n for (let i = excludeNode.items.length - 1; i >= 0; i--) {\n const item = excludeNode.items[i];\n if (\n item !== matchedItem &&\n isScalar(item) &&\n isString(item.value) &&\n item.value.startsWith(`${excludeDepName}@`) &&\n !isValidMinimumReleaseAgeExcludeEntry(item.value, excludeDepName!)\n ) {\n excludeNode.items.splice(i, 1);\n updated = true;\n }\n }\n }\n\n if (!updated) {\n return null;\n }\n\n const newContent = doc.toString();\n await writeLocalFile(pnpmWorkspaceFilePath, newContent);\n\n return {\n file: {\n type: 'addition',\n path: pnpmWorkspaceFilePath,\n contents: newContent,\n },\n };\n}\n\nfunction getMatchedItem(\n depName: string,\n items: unknown[],\n): {\n item: Scalar | null;\n allExcluded: boolean;\n malformed?: boolean;\n} {\n let malformedItem: Scalar | null = null;\n\n for (const item of items) {\n /* v8 ignore if -- should not happen */\n if (!isScalar(item) || !isString(item.value)) {\n continue;\n }\n\n if (item.value.startsWith(`${depName}@`)) {\n if (isValidMinimumReleaseAgeExcludeEntry(item.value, depName)) {\n return {\n allExcluded: false,\n item,\n };\n }\n malformedItem ??= item;\n continue;\n }\n\n if (item.value === depName || matchRegexOrGlob(depName, item.value)) {\n return {\n allExcluded: true,\n item,\n };\n }\n }\n\n if (malformedItem) {\n return {\n allExcluded: false,\n item: malformedItem,\n malformed: true,\n };\n }\n\n return {\n item: null,\n allExcluded: false,\n };\n}\n\n/** pnpm requires package@version entries without range selectors or extra @ in the version part */\nfunction isValidMinimumReleaseAgeExcludeEntry(\n value: string,\n packageName: string,\n): boolean {\n return !value.slice(`${packageName}@`.length).includes('@');\n}\n\n/** determine whether a comment or a list item contains the depName at a given newVersion */\nfunction minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n line: string,\n depName: string | undefined,\n newVersion: string | undefined,\n): boolean {\n if (line.includes(`${depName}@${newVersion}`)) {\n return true;\n }\n\n if (line.includes(`|| ${newVersion}`)) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;AAiBA,MAAM,2BAA2B;AAGjC,MAAM,eAAe;AAErB,MAAM,+BAA+B;AAErC,eAAsB,gBACpB,uBACyC;CACzC,OAAO,MAAM,uBAAuB,sBAAsB,gBAAgB,EAAE;CAC5E,IAAI,MAA+B,CAAC;CACpC,IAAI,KAAK,aAAa,4BAA4B,qBAAqB,CAAC,CAAC;CACzE,IAAI,KAAK,aAAa,MAAM,oBAAoB,qBAAqB,CAAC,CAAC;CAEvE,MAAM,IAAI,OAAO,gBAAgB;CACjC,IAAI,IAAI,WAAW,GACjB,OAAO;CAGT,OAAO;AACT;;;;;AAMA,SAAS,4BACP,uBAC8B;CAC9B,MAAM,EAAE,iBAAiB,aAAa,0BACpC;CACF,MAAM,wBAAwB,YAAY,QACvC,SACE,IAAI,YAAY,oBACf,IAAI,YAAY,gCAClB,IAAI,gBACJ,MAAM,wBAAwB,CAAC,CAAC,KAAK,IAAI,YAAY,CACzD;CAEA,IAAI,aAAa;CACjB,KAAK,MAAM,wBAAwB,uBAAuB;EACxD,MAAM,EAAE,SAAS,YAAY,cAAc;EAC3C,MAAM,WAAW,MAAM,YAAY,CAAC,CAAC,KAAK,aAAa,EAAE;EACzD,IAAI,CAAC,UAAU,QAAQ;GACrB,OAAO,KACL;IAAE;IAAiB;IAAS;IAAY;GAAU,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CACP,OACA,aACS;CACT,OAAO,CAAC,MAAM,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC,SAAS,GAAG;AAC5D;;AAGA,SAAS,kDACP,MACA,SACA,YACS;CACT,IAAI,KAAK,SAAS,GAAG,QAAQ,GAAG,YAAY,GAC1C,OAAO;CAGT,IAAI,KAAK,SAAS,MAAM,YAAY,GAClC,OAAO;CAGT,OAAO;AACT"}
|
|
@@ -56,6 +56,16 @@ const knownDepTypes = [
|
|
|
56
56
|
prettyDepType: "overrides",
|
|
57
57
|
description: "Listed under `pnpm.overrides`"
|
|
58
58
|
},
|
|
59
|
+
{
|
|
60
|
+
depType: "devEngines.runtime",
|
|
61
|
+
prettyDepType: "devEngines.runtime",
|
|
62
|
+
description: "Listed under `devEngines.runtime`"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
depType: "devEngines.packageManager",
|
|
66
|
+
prettyDepType: "devEngines.packageManager",
|
|
67
|
+
description: "Listed under `devEngines.packageManager`"
|
|
68
|
+
},
|
|
59
69
|
{
|
|
60
70
|
depType: pnpmWorkspaceOverrides,
|
|
61
71
|
prettyDepType: "overrides",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dep-types.js","names":[],"sources":["../../../../lib/modules/manager/npm/dep-types.ts"],"sourcesContent":["import type { DepTypeMetadata } from '../types.ts';\n\nexport const pnpmWorkspaceOverrides = 'pnpm-workspace.overrides' as const;\n\nexport const knownDepTypes = [\n {\n depType: 'dependencies',\n prettyDepType: 'dependency',\n description: 'Listed under `dependencies`',\n },\n {\n depType: 'devDependencies',\n prettyDepType: 'devDependency',\n description: 'Listed under `devDependencies`',\n },\n {\n depType: 'optionalDependencies',\n prettyDepType: 'optionalDependency',\n description: 'Listed under `optionalDependencies`',\n },\n {\n depType: 'peerDependencies',\n prettyDepType: 'peerDependency',\n description: 'Listed under `peerDependencies`',\n },\n {\n depType: 'engines',\n prettyDepType: 'engine',\n description: 'Listed under `engines`',\n },\n {\n depType: 'volta',\n prettyDepType: 'volta',\n description: 'Listed under `volta`',\n },\n {\n depType: 'resolutions',\n prettyDepType: 'resolutions',\n description: 'Listed under `resolutions` (Yarn)',\n },\n {\n depType: 'packageManager',\n prettyDepType: 'packageManager',\n description: 'Listed under `packageManager`',\n },\n {\n depType: 'overrides',\n prettyDepType: 'overrides',\n description: 'Listed under `overrides`',\n },\n {\n depType: 'pnpm',\n prettyDepType: 'pnpm',\n description: 'Listed under the top-level `pnpm` field',\n },\n {\n depType: 'pnpm.overrides',\n prettyDepType: 'overrides',\n description: 'Listed under `pnpm.overrides`',\n },\n {\n depType: pnpmWorkspaceOverrides,\n prettyDepType: 'overrides',\n description: 'Listed under `overrides` in a pnpm workspace YAML file',\n },\n] as const satisfies readonly DepTypeMetadata[];\n\nexport const supportsDynamicDepTypesNote =\n 'Additionally, catalog dependencies produce dynamic `depType` values: `pnpm.catalog.<name>` for [pnpm catalogs](https://pnpm.io/catalogs#defining-catalogs) and `yarn.catalog.<name>` for [yarn catalogs](https://yarnpkg.com/features/catalogs).';\n"],"mappings":";AAEA,MAAa,yBAAyB;AAEtC,MAAa,gBAAgB;CAC3B;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;AACF;AAEA,MAAa,8BACX"}
|
|
1
|
+
{"version":3,"file":"dep-types.js","names":[],"sources":["../../../../lib/modules/manager/npm/dep-types.ts"],"sourcesContent":["import type { DepTypeMetadata } from '../types.ts';\n\nexport const pnpmWorkspaceOverrides = 'pnpm-workspace.overrides' as const;\n\nexport const knownDepTypes = [\n {\n depType: 'dependencies',\n prettyDepType: 'dependency',\n description: 'Listed under `dependencies`',\n },\n {\n depType: 'devDependencies',\n prettyDepType: 'devDependency',\n description: 'Listed under `devDependencies`',\n },\n {\n depType: 'optionalDependencies',\n prettyDepType: 'optionalDependency',\n description: 'Listed under `optionalDependencies`',\n },\n {\n depType: 'peerDependencies',\n prettyDepType: 'peerDependency',\n description: 'Listed under `peerDependencies`',\n },\n {\n depType: 'engines',\n prettyDepType: 'engine',\n description: 'Listed under `engines`',\n },\n {\n depType: 'volta',\n prettyDepType: 'volta',\n description: 'Listed under `volta`',\n },\n {\n depType: 'resolutions',\n prettyDepType: 'resolutions',\n description: 'Listed under `resolutions` (Yarn)',\n },\n {\n depType: 'packageManager',\n prettyDepType: 'packageManager',\n description: 'Listed under `packageManager`',\n },\n {\n depType: 'overrides',\n prettyDepType: 'overrides',\n description: 'Listed under `overrides`',\n },\n {\n depType: 'pnpm',\n prettyDepType: 'pnpm',\n description: 'Listed under the top-level `pnpm` field',\n },\n {\n depType: 'pnpm.overrides',\n prettyDepType: 'overrides',\n description: 'Listed under `pnpm.overrides`',\n },\n {\n depType: 'devEngines.runtime',\n prettyDepType: 'devEngines.runtime',\n description: 'Listed under `devEngines.runtime`',\n },\n {\n depType: 'devEngines.packageManager',\n prettyDepType: 'devEngines.packageManager',\n description: 'Listed under `devEngines.packageManager`',\n },\n {\n depType: pnpmWorkspaceOverrides,\n prettyDepType: 'overrides',\n description: 'Listed under `overrides` in a pnpm workspace YAML file',\n },\n] as const satisfies readonly DepTypeMetadata[];\n\nexport const supportsDynamicDepTypesNote =\n 'Additionally, catalog dependencies produce dynamic `depType` values: `pnpm.catalog.<name>` for [pnpm catalogs](https://pnpm.io/catalogs#defining-catalogs) and `yarn.catalog.<name>` for [yarn catalogs](https://yarnpkg.com/features/catalogs).';\n"],"mappings":";AAEA,MAAa,yBAAyB;AAEtC,MAAa,gBAAgB;CAC3B;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;CACA;EACE,SAAS;EACT,eAAe;EACf,aAAa;CACf;AACF;AAEA,MAAa,8BACX"}
|
|
@@ -37,7 +37,7 @@ function extractDependency(depType, depName, input) {
|
|
|
37
37
|
return dep;
|
|
38
38
|
}
|
|
39
39
|
dep.currentValue = input.trim();
|
|
40
|
-
if (depType === "engines" || depType === "packageManager") {
|
|
40
|
+
if (depType === "engines" || depType === "packageManager" || depType === "devEngines.runtime" || depType === "devEngines.packageManager") {
|
|
41
41
|
if (depName === "node") dep.datasource = NodeVersionDatasource.id;
|
|
42
42
|
else if (depName === "yarn") {
|
|
43
43
|
dep.datasource = NpmDatasource.id;
|
|
@@ -50,6 +50,9 @@ function extractDependency(depType, depName, input) {
|
|
|
50
50
|
} else if (depName === "pnpm") {
|
|
51
51
|
dep.datasource = NpmDatasource.id;
|
|
52
52
|
dep.commitMessageTopic = "pnpm";
|
|
53
|
+
} else if (depType === "devEngines.runtime" && depName === "deno") {
|
|
54
|
+
dep.datasource = NpmDatasource.id;
|
|
55
|
+
dep.commitMessageTopic = "Deno";
|
|
53
56
|
} else if (depName === "vscode") {
|
|
54
57
|
dep.datasource = GithubTagsDatasource.id;
|
|
55
58
|
dep.packageName = "microsoft/vscode";
|
|
@@ -170,7 +173,7 @@ function getExtractedConstraints(deps) {
|
|
|
170
173
|
"pnpm",
|
|
171
174
|
"vscode"
|
|
172
175
|
];
|
|
173
|
-
for (const dep of deps) if (!dep.skipReason && (dep.depType === "engines" || dep.depType === "packageManager") && dep.depName && isConstraintName(dep.depName) && constraints.includes(dep.depName) && isString(dep.currentValue)) extractedConstraints[dep.depName] = dep.currentValue;
|
|
176
|
+
for (const dep of deps) if (!dep.skipReason && (dep.depType === "engines" || dep.depType === "packageManager" || dep.depType === "devEngines.runtime" || dep.depType === "devEngines.packageManager") && dep.depName && isConstraintName(dep.depName) && constraints.includes(dep.depName) && isString(dep.currentValue)) extractedConstraints[dep.depName] = dep.currentValue;
|
|
174
177
|
return extractedConstraints;
|
|
175
178
|
}
|
|
176
179
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency.js","names":[],"sources":["../../../../../../lib/modules/manager/npm/extract/common/dependency.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport validateNpmPackageName from 'validate-npm-package-name';\nimport { logger } from '../../../../../logger/index.ts';\nimport { coerceArray } from '../../../../../util/array.ts';\nimport type { ConstraintName } from '../../../../../util/exec/types.ts';\nimport { isConstraintName } from '../../../../../util/exec/types.ts';\nimport { regEx } from '../../../../../util/regex.ts';\nimport { coerceString } from '../../../../../util/string.ts';\nimport { GithubTagsDatasource } from '../../../../datasource/github-tags/index.ts';\nimport { NodeVersionDatasource } from '../../../../datasource/node-version/index.ts';\nimport { NpmDatasource } from '../../../../datasource/npm/index.ts';\nimport {\n api,\n isValid,\n isVersion,\n id as npmVersioningId,\n} from '../../../../versioning/npm/index.ts';\nimport type { PackageDependency } from '../../../types.ts';\n\nconst RE_REPOSITORY_GITHUB_SSH_FORMAT = regEx(\n /(?:git@)github.com:(?<owner>[^/]+)\\/(?<repo>[^/]+?)(?:\\.git)?$/,\n);\n\nexport function parseDepName(depType: string, key: string): string {\n if (depType !== 'resolutions') {\n return key;\n }\n\n // Yarn selective dependency resolutions may nest a path of parent\n // packages before the target package, e.g. `parent/child` or\n // `@scope/parent/child`, and any segment (including the last) may carry\n // a `@range` suffix used to disambiguate which version of that package\n // to match, e.g. `@cypress/request/qs@~6.14.1`.\n const parts = key.split('/');\n const segments: string[] = [];\n for (let i = 0; i < parts.length; i += 1) {\n const part = parts[i];\n if (part.startsWith('@') && i + 1 < parts.length) {\n i += 1;\n segments.push(`${part}/${parts[i]}`);\n } else {\n segments.push(part);\n }\n }\n\n const lastSegment = segments.at(-1);\n const [, depName] = coerceArray(\n regEx(/^(?<depName>(?:@[^/]+\\/)?[^@]+)/).exec(coerceString(lastSegment)),\n );\n return depName;\n}\n\nexport function extractDependency(\n depType: string,\n depName: string,\n input: string,\n): PackageDependency {\n const dep: PackageDependency = {};\n if (!validateNpmPackageName(depName).validForOldPackages) {\n dep.skipReason = 'invalid-name';\n return dep;\n }\n if (!isString(input)) {\n dep.skipReason = 'invalid-value';\n return dep;\n }\n dep.currentValue = input.trim();\n if (depType === 'engines' || depType === 'packageManager') {\n if (depName === 'node') {\n dep.datasource = NodeVersionDatasource.id;\n } else if (depName === 'yarn') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'Yarn';\n const major =\n isVersion(dep.currentValue) && api.getMajor(dep.currentValue);\n if (major && major > 1) {\n dep.packageName = '@yarnpkg/cli-dist';\n }\n } else if (depName === 'npm') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'npm';\n } else if (depName === 'pnpm') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'pnpm';\n } else if (depName === 'vscode') {\n dep.datasource = GithubTagsDatasource.id;\n dep.packageName = 'microsoft/vscode';\n dep.versioning = npmVersioningId;\n } else if (depName === 'bun') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'Bun';\n } else {\n dep.skipReason = 'unknown-engines';\n }\n if (!isValid(dep.currentValue)) {\n dep.skipReason = 'unspecified-version';\n }\n return dep;\n }\n\n // support for volta\n if (depType === 'volta') {\n if (depName === 'node') {\n dep.datasource = NodeVersionDatasource.id;\n } else if (depName === 'yarn') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'Yarn';\n const major =\n isVersion(dep.currentValue) && api.getMajor(dep.currentValue);\n if (major && major > 1) {\n dep.packageName = '@yarnpkg/cli-dist';\n }\n } else if (depName === 'npm') {\n dep.datasource = NpmDatasource.id;\n } else if (depName === 'pnpm') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'pnpm';\n } else {\n dep.skipReason = 'unknown-volta';\n }\n if (!isValid(dep.currentValue)) {\n dep.skipReason = 'unspecified-version';\n }\n return dep;\n }\n\n if (dep.currentValue.startsWith('npm:')) {\n dep.npmPackageAlias = true;\n const valSplit = dep.currentValue.replace('npm:', '').split('@');\n if (valSplit.length === 1) {\n dep.packageName = depName;\n dep.currentValue = valSplit[0];\n } else if (valSplit.length === 2) {\n dep.packageName = valSplit[0];\n dep.currentValue = valSplit[1];\n } else if (valSplit.length === 3) {\n dep.packageName = `${valSplit[0]}@${valSplit[1]}`;\n dep.currentValue = valSplit[2];\n } else {\n logger.debug(\n `Invalid npm package alias for dependency: \"${depName}\":\"${dep.currentValue}\"`,\n );\n }\n }\n if (dep.currentValue.startsWith('file:')) {\n dep.skipReason = 'file';\n return dep;\n }\n\n if (isValid(dep.currentValue)) {\n dep.datasource = NpmDatasource.id;\n if (dep.currentValue === '') {\n dep.skipReason = 'empty';\n }\n return dep;\n }\n const hashSplit = dep.currentValue.split('#');\n if (hashSplit.length !== 2) {\n dep.skipReason = 'unspecified-version';\n return dep;\n }\n const [depNamePart, depRefPart] = hashSplit;\n\n let githubOwnerRepo: string;\n let githubOwner: string;\n let githubRepo: string;\n const matchUrlSshFormat = RE_REPOSITORY_GITHUB_SSH_FORMAT.exec(depNamePart);\n if (matchUrlSshFormat === null) {\n githubOwnerRepo = depNamePart\n .replace(regEx(/^github:/), '')\n .replace(regEx(/^git\\+/), '')\n .replace(regEx(/^https:\\/\\/github\\.com\\//), '')\n .replace(regEx(/\\.git$/), '');\n const githubRepoSplit = githubOwnerRepo.split('/');\n if (githubRepoSplit.length !== 2) {\n dep.skipReason = 'unspecified-version';\n return dep;\n }\n [githubOwner, githubRepo] = githubRepoSplit;\n } else {\n githubOwner = matchUrlSshFormat.groups!.owner;\n githubRepo = matchUrlSshFormat.groups!.repo;\n githubOwnerRepo = `${githubOwner}/${githubRepo}`;\n }\n // combined with the length check below, this is equivalent to\n // /^[a-z\\d](?:[a-z\\d]|-(?=[a-z\\d])){0,38}$/i without the lookahead\n const githubOwnerRegex = regEx(/^[a-z\\d](?:-?[a-z\\d]){0,38}$/i);\n const githubRepoRegex = regEx(/^[a-zA-Z0-9._-]{1,100}$/);\n if (\n githubOwner.length > 39 ||\n !githubOwnerRegex.test(githubOwner) ||\n !githubRepoRegex.test(githubRepo)\n ) {\n dep.skipReason = 'unspecified-version';\n return dep;\n }\n if (isVersion(depRefPart)) {\n dep.currentRawValue = dep.currentValue;\n dep.currentValue = depRefPart;\n dep.datasource = GithubTagsDatasource.id;\n dep.versioning = npmVersioningId;\n dep.packageName = githubOwnerRepo;\n dep.pinDigests = false;\n } else if (\n regEx(/^[0-9a-f]{7}$/).test(depRefPart) ||\n regEx(/^[0-9a-f]{40}$/).test(depRefPart)\n ) {\n dep.currentRawValue = dep.currentValue;\n dep.currentValue = null;\n dep.currentDigest = depRefPart;\n dep.datasource = GithubTagsDatasource.id;\n dep.versioning = npmVersioningId;\n dep.packageName = githubOwnerRepo;\n } else {\n // <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]\n // https://docs.npmjs.com/cli/v10/configuring-npm/package-json#git-urls-as-dependencies\n const len = 7; // length of 'semver:'\n const maybeVersion = depRefPart.substring(len);\n\n if (depRefPart.startsWith('semver:') && isValid(maybeVersion)) {\n dep.currentRawValue = dep.currentValue;\n dep.currentValue = maybeVersion;\n dep.datasource = GithubTagsDatasource.id;\n dep.versioning = npmVersioningId;\n dep.packageName = githubOwnerRepo;\n dep.pinDigests = false;\n } else {\n dep.skipReason = 'unversioned-reference';\n return dep;\n }\n }\n dep.sourceUrl = `https://github.com/${githubOwnerRepo}`;\n dep.gitRef = true;\n return dep;\n}\n\nexport function getExtractedConstraints(\n deps: PackageDependency[],\n): Partial<Record<ConstraintName, string>> {\n const extractedConstraints: Partial<Record<ConstraintName, string>> = {};\n const constraints: ConstraintName[] = [\n 'bun',\n 'node',\n 'yarn',\n 'npm',\n 'pnpm',\n 'vscode',\n ];\n for (const dep of deps) {\n if (\n !dep.skipReason &&\n (dep.depType === 'engines' || dep.depType === 'packageManager') &&\n dep.depName &&\n isConstraintName(dep.depName) &&\n constraints.includes(dep.depName) &&\n isString(dep.currentValue)\n ) {\n extractedConstraints[dep.depName] = dep.currentValue;\n }\n }\n return extractedConstraints;\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,kCAAkC,MACtC,gEACF;AAEA,SAAgB,aAAa,SAAiB,KAAqB;CACjE,IAAI,YAAY,eACd,OAAO;CAQT,MAAM,QAAQ,IAAI,MAAM,GAAG;CAC3B,MAAM,WAAqB,CAAC;CAC5B,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxC,MAAM,OAAO,MAAM;EACnB,IAAI,KAAK,WAAW,GAAG,KAAK,IAAI,IAAI,MAAM,QAAQ;GAChD,KAAK;GACL,SAAS,KAAK,GAAG,KAAK,GAAG,MAAM,IAAI;EACrC,OACE,SAAS,KAAK,IAAI;CAEtB;CAEA,MAAM,cAAc,SAAS,GAAG,EAAE;CACl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,IAAI,aAAa;GACjB,OAAO;EACT;CACF;CACA,IAAI,YAAY,sBAAsB;CACtC,IAAI,SAAS;CACb,OAAO;AACT;AAEA,SAAgB,wBACd,MACyC;CACzC,MAAM,uBAAgE,CAAC;CACvE,MAAM,cAAgC;EACpC;EACA;EACA;EACA;EACA;EACA;CACF;CACA,KAAK,MAAM,OAAO,MAChB,IACE,CAAC,IAAI,eACJ,IAAI,YAAY,aAAa,IAAI,YAAY,qBAC9C,IAAI,WACJ,iBAAiB,IAAI,OAAO,KAC5B,YAAY,SAAS,IAAI,OAAO,KAChC,SAAS,IAAI,YAAY,GAEzB,qBAAqB,IAAI,WAAW,IAAI;CAG5C,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"dependency.js","names":[],"sources":["../../../../../../lib/modules/manager/npm/extract/common/dependency.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport validateNpmPackageName from 'validate-npm-package-name';\nimport { logger } from '../../../../../logger/index.ts';\nimport { coerceArray } from '../../../../../util/array.ts';\nimport type { ConstraintName } from '../../../../../util/exec/types.ts';\nimport { isConstraintName } from '../../../../../util/exec/types.ts';\nimport { regEx } from '../../../../../util/regex.ts';\nimport { coerceString } from '../../../../../util/string.ts';\nimport { GithubTagsDatasource } from '../../../../datasource/github-tags/index.ts';\nimport { NodeVersionDatasource } from '../../../../datasource/node-version/index.ts';\nimport { NpmDatasource } from '../../../../datasource/npm/index.ts';\nimport {\n api,\n isValid,\n isVersion,\n id as npmVersioningId,\n} from '../../../../versioning/npm/index.ts';\nimport type { PackageDependency } from '../../../types.ts';\n\nconst RE_REPOSITORY_GITHUB_SSH_FORMAT = regEx(\n /(?:git@)github.com:(?<owner>[^/]+)\\/(?<repo>[^/]+?)(?:\\.git)?$/,\n);\n\nexport function parseDepName(depType: string, key: string): string {\n if (depType !== 'resolutions') {\n return key;\n }\n\n // Yarn selective dependency resolutions may nest a path of parent\n // packages before the target package, e.g. `parent/child` or\n // `@scope/parent/child`, and any segment (including the last) may carry\n // a `@range` suffix used to disambiguate which version of that package\n // to match, e.g. `@cypress/request/qs@~6.14.1`.\n const parts = key.split('/');\n const segments: string[] = [];\n for (let i = 0; i < parts.length; i += 1) {\n const part = parts[i];\n if (part.startsWith('@') && i + 1 < parts.length) {\n i += 1;\n segments.push(`${part}/${parts[i]}`);\n } else {\n segments.push(part);\n }\n }\n\n const lastSegment = segments.at(-1);\n const [, depName] = coerceArray(\n regEx(/^(?<depName>(?:@[^/]+\\/)?[^@]+)/).exec(coerceString(lastSegment)),\n );\n return depName;\n}\n\nexport function extractDependency(\n depType: string,\n depName: string,\n input: string,\n): PackageDependency {\n const dep: PackageDependency = {};\n if (!validateNpmPackageName(depName).validForOldPackages) {\n dep.skipReason = 'invalid-name';\n return dep;\n }\n if (!isString(input)) {\n dep.skipReason = 'invalid-value';\n return dep;\n }\n dep.currentValue = input.trim();\n if (\n depType === 'engines' ||\n depType === 'packageManager' ||\n depType === 'devEngines.runtime' ||\n depType === 'devEngines.packageManager'\n ) {\n if (depName === 'node') {\n dep.datasource = NodeVersionDatasource.id;\n } else if (depName === 'yarn') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'Yarn';\n const major =\n isVersion(dep.currentValue) && api.getMajor(dep.currentValue);\n if (major && major > 1) {\n dep.packageName = '@yarnpkg/cli-dist';\n }\n } else if (depName === 'npm') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'npm';\n } else if (depName === 'pnpm') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'pnpm';\n } else if (depType === 'devEngines.runtime' && depName === 'deno') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'Deno';\n } else if (depName === 'vscode') {\n dep.datasource = GithubTagsDatasource.id;\n dep.packageName = 'microsoft/vscode';\n dep.versioning = npmVersioningId;\n } else if (depName === 'bun') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'Bun';\n } else {\n dep.skipReason = 'unknown-engines';\n }\n if (!isValid(dep.currentValue)) {\n dep.skipReason = 'unspecified-version';\n }\n return dep;\n }\n\n // support for volta\n if (depType === 'volta') {\n if (depName === 'node') {\n dep.datasource = NodeVersionDatasource.id;\n } else if (depName === 'yarn') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'Yarn';\n const major =\n isVersion(dep.currentValue) && api.getMajor(dep.currentValue);\n if (major && major > 1) {\n dep.packageName = '@yarnpkg/cli-dist';\n }\n } else if (depName === 'npm') {\n dep.datasource = NpmDatasource.id;\n } else if (depName === 'pnpm') {\n dep.datasource = NpmDatasource.id;\n dep.commitMessageTopic = 'pnpm';\n } else {\n dep.skipReason = 'unknown-volta';\n }\n if (!isValid(dep.currentValue)) {\n dep.skipReason = 'unspecified-version';\n }\n return dep;\n }\n\n if (dep.currentValue.startsWith('npm:')) {\n dep.npmPackageAlias = true;\n const valSplit = dep.currentValue.replace('npm:', '').split('@');\n if (valSplit.length === 1) {\n dep.packageName = depName;\n dep.currentValue = valSplit[0];\n } else if (valSplit.length === 2) {\n dep.packageName = valSplit[0];\n dep.currentValue = valSplit[1];\n } else if (valSplit.length === 3) {\n dep.packageName = `${valSplit[0]}@${valSplit[1]}`;\n dep.currentValue = valSplit[2];\n } else {\n logger.debug(\n `Invalid npm package alias for dependency: \"${depName}\":\"${dep.currentValue}\"`,\n );\n }\n }\n if (dep.currentValue.startsWith('file:')) {\n dep.skipReason = 'file';\n return dep;\n }\n\n if (isValid(dep.currentValue)) {\n dep.datasource = NpmDatasource.id;\n if (dep.currentValue === '') {\n dep.skipReason = 'empty';\n }\n return dep;\n }\n const hashSplit = dep.currentValue.split('#');\n if (hashSplit.length !== 2) {\n dep.skipReason = 'unspecified-version';\n return dep;\n }\n const [depNamePart, depRefPart] = hashSplit;\n\n let githubOwnerRepo: string;\n let githubOwner: string;\n let githubRepo: string;\n const matchUrlSshFormat = RE_REPOSITORY_GITHUB_SSH_FORMAT.exec(depNamePart);\n if (matchUrlSshFormat === null) {\n githubOwnerRepo = depNamePart\n .replace(regEx(/^github:/), '')\n .replace(regEx(/^git\\+/), '')\n .replace(regEx(/^https:\\/\\/github\\.com\\//), '')\n .replace(regEx(/\\.git$/), '');\n const githubRepoSplit = githubOwnerRepo.split('/');\n if (githubRepoSplit.length !== 2) {\n dep.skipReason = 'unspecified-version';\n return dep;\n }\n [githubOwner, githubRepo] = githubRepoSplit;\n } else {\n githubOwner = matchUrlSshFormat.groups!.owner;\n githubRepo = matchUrlSshFormat.groups!.repo;\n githubOwnerRepo = `${githubOwner}/${githubRepo}`;\n }\n // combined with the length check below, this is equivalent to\n // /^[a-z\\d](?:[a-z\\d]|-(?=[a-z\\d])){0,38}$/i without the lookahead\n const githubOwnerRegex = regEx(/^[a-z\\d](?:-?[a-z\\d]){0,38}$/i);\n const githubRepoRegex = regEx(/^[a-zA-Z0-9._-]{1,100}$/);\n if (\n githubOwner.length > 39 ||\n !githubOwnerRegex.test(githubOwner) ||\n !githubRepoRegex.test(githubRepo)\n ) {\n dep.skipReason = 'unspecified-version';\n return dep;\n }\n if (isVersion(depRefPart)) {\n dep.currentRawValue = dep.currentValue;\n dep.currentValue = depRefPart;\n dep.datasource = GithubTagsDatasource.id;\n dep.versioning = npmVersioningId;\n dep.packageName = githubOwnerRepo;\n dep.pinDigests = false;\n } else if (\n regEx(/^[0-9a-f]{7}$/).test(depRefPart) ||\n regEx(/^[0-9a-f]{40}$/).test(depRefPart)\n ) {\n dep.currentRawValue = dep.currentValue;\n dep.currentValue = null;\n dep.currentDigest = depRefPart;\n dep.datasource = GithubTagsDatasource.id;\n dep.versioning = npmVersioningId;\n dep.packageName = githubOwnerRepo;\n } else {\n // <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]\n // https://docs.npmjs.com/cli/v10/configuring-npm/package-json#git-urls-as-dependencies\n const len = 7; // length of 'semver:'\n const maybeVersion = depRefPart.substring(len);\n\n if (depRefPart.startsWith('semver:') && isValid(maybeVersion)) {\n dep.currentRawValue = dep.currentValue;\n dep.currentValue = maybeVersion;\n dep.datasource = GithubTagsDatasource.id;\n dep.versioning = npmVersioningId;\n dep.packageName = githubOwnerRepo;\n dep.pinDigests = false;\n } else {\n dep.skipReason = 'unversioned-reference';\n return dep;\n }\n }\n dep.sourceUrl = `https://github.com/${githubOwnerRepo}`;\n dep.gitRef = true;\n return dep;\n}\n\nexport function getExtractedConstraints(\n deps: PackageDependency[],\n): Partial<Record<ConstraintName, string>> {\n const extractedConstraints: Partial<Record<ConstraintName, string>> = {};\n const constraints: ConstraintName[] = [\n 'bun',\n 'node',\n 'yarn',\n 'npm',\n 'pnpm',\n 'vscode',\n ];\n for (const dep of deps) {\n if (\n !dep.skipReason &&\n (dep.depType === 'engines' ||\n dep.depType === 'packageManager' ||\n dep.depType === 'devEngines.runtime' ||\n dep.depType === 'devEngines.packageManager') &&\n dep.depName &&\n isConstraintName(dep.depName) &&\n constraints.includes(dep.depName) &&\n isString(dep.currentValue)\n ) {\n extractedConstraints[dep.depName] = dep.currentValue;\n }\n }\n return extractedConstraints;\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,kCAAkC,MACtC,gEACF;AAEA,SAAgB,aAAa,SAAiB,KAAqB;CACjE,IAAI,YAAY,eACd,OAAO;CAQT,MAAM,QAAQ,IAAI,MAAM,GAAG;CAC3B,MAAM,WAAqB,CAAC;CAC5B,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxC,MAAM,OAAO,MAAM;EACnB,IAAI,KAAK,WAAW,GAAG,KAAK,IAAI,IAAI,MAAM,QAAQ;GAChD,KAAK;GACL,SAAS,KAAK,GAAG,KAAK,GAAG,MAAM,IAAI;EACrC,OACE,SAAS,KAAK,IAAI;CAEtB;CAEA,MAAM,cAAc,SAAS,GAAG,EAAE;CAClC,MAAM,GAAG,WAAW,YAClB,MAAM,iCAAiC,CAAC,CAAC,KAAK,aAAa,WAAW,CAAC,CACzE;CACA,OAAO;AACT;AAEA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B,OAAO;GACL,IAAI,aAAa;GACjB,OAAO;EACT;CACF;CACA,IAAI,YAAY,sBAAsB;CACtC,IAAI,SAAS;CACb,OAAO;AACT;AAEA,SAAgB,wBACd,MACyC;CACzC,MAAM,uBAAgE,CAAC;CACvE,MAAM,cAAgC;EACpC;EACA;EACA;EACA;EACA;EACA;CACF;CACA,KAAK,MAAM,OAAO,MAChB,IACE,CAAC,IAAI,eACJ,IAAI,YAAY,aACf,IAAI,YAAY,oBAChB,IAAI,YAAY,wBAChB,IAAI,YAAY,gCAClB,IAAI,WACJ,iBAAiB,IAAI,OAAO,KAC5B,YAAY,SAAS,IAAI,OAAO,KAChC,SAAS,IAAI,YAAY,GAEzB,qBAAqB,IAAI,WAAW,IAAI;CAG5C,OAAO;AACT"}
|
|
@@ -8,6 +8,11 @@ import { extractOverrideDepsRec } from "./overrides.js";
|
|
|
8
8
|
import { isNonEmptyObject, isNonEmptyString, isNonEmptyStringAndNotWhitespace, isObject, isString } from "@sindresorhus/is";
|
|
9
9
|
import { parsePkgAndParentSelector } from "@pnpm/parse-overrides";
|
|
10
10
|
//#region lib/modules/manager/npm/extract/common/package-file.ts
|
|
11
|
+
function hasDevEnginesPackageManager(packageJson) {
|
|
12
|
+
const pm = packageJson.devEngines?.packageManager;
|
|
13
|
+
if (Array.isArray(pm)) return pm.some((item) => isNonEmptyObject(item));
|
|
14
|
+
return isNonEmptyObject(pm);
|
|
15
|
+
}
|
|
11
16
|
function extractPackageJson(packageJson, packageFile) {
|
|
12
17
|
logger.trace(`npm.extractPackageJson(${packageFile})`);
|
|
13
18
|
const deps = [];
|
|
@@ -86,13 +91,35 @@ function extractPackageJson(packageJson, packageFile) {
|
|
|
86
91
|
return null;
|
|
87
92
|
}
|
|
88
93
|
}
|
|
94
|
+
if (packageJson.devEngines) for (const subKey of ["runtime", "packageManager"]) {
|
|
95
|
+
const value = packageJson.devEngines[subKey];
|
|
96
|
+
if (!value) continue;
|
|
97
|
+
const items = Array.isArray(value) ? value : [value];
|
|
98
|
+
const depType = `devEngines.${subKey}`;
|
|
99
|
+
for (let i = 0; i < items.length; i += 1) {
|
|
100
|
+
const item = items[i];
|
|
101
|
+
if (!item?.name || !item.version) continue;
|
|
102
|
+
const dep = {
|
|
103
|
+
depType,
|
|
104
|
+
depName: item.name,
|
|
105
|
+
...extractDependency(depType, item.name, item.version)
|
|
106
|
+
};
|
|
107
|
+
setNodeCommitTopic(dep);
|
|
108
|
+
dep.prettyDepType = depType;
|
|
109
|
+
if (Array.isArray(value)) dep.managerData = {
|
|
110
|
+
...dep.managerData,
|
|
111
|
+
devEnginesIndex: i
|
|
112
|
+
};
|
|
113
|
+
deps.push(dep);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
89
116
|
return {
|
|
90
117
|
deps,
|
|
91
118
|
extractedConstraints: getExtractedConstraints(deps),
|
|
92
119
|
packageFileVersion,
|
|
93
120
|
managerData: {
|
|
94
121
|
packageJsonName,
|
|
95
|
-
hasPackageManager: isNonEmptyStringAndNotWhitespace(packageJson.packageManager) ||
|
|
122
|
+
hasPackageManager: isNonEmptyStringAndNotWhitespace(packageJson.packageManager) || hasDevEnginesPackageManager(packageJson),
|
|
96
123
|
workspaces: packageJson.workspaces
|
|
97
124
|
}
|
|
98
125
|
};
|
|
@@ -100,9 +127,9 @@ function extractPackageJson(packageJson, packageFile) {
|
|
|
100
127
|
async function hasPackageManager(packageJsonDir) {
|
|
101
128
|
logger.trace(`npm.hasPackageManager from package.json`);
|
|
102
129
|
const packageJsonResult = await loadPackageJson(packageJsonDir);
|
|
103
|
-
return isNonEmptyString(packageJsonResult?.packageManager?.name) && isNonEmptyString(packageJsonResult?.packageManager?.version);
|
|
130
|
+
return isNonEmptyString(packageJsonResult?.packageManager?.name) && isNonEmptyString(packageJsonResult?.packageManager?.version) || hasDevEnginesPackageManager(packageJsonResult);
|
|
104
131
|
}
|
|
105
132
|
//#endregion
|
|
106
|
-
export { extractPackageJson, hasPackageManager };
|
|
133
|
+
export { extractPackageJson, hasDevEnginesPackageManager, hasPackageManager };
|
|
107
134
|
|
|
108
135
|
//# sourceMappingURL=package-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-file.js","names":[],"sources":["../../../../../../lib/modules/manager/npm/extract/common/package-file.ts"],"sourcesContent":["import { parsePkgAndParentSelector } from '@pnpm/parse-overrides';\nimport {\n isNonEmptyObject,\n isNonEmptyString,\n isNonEmptyStringAndNotWhitespace,\n isObject,\n isString,\n} from '@sindresorhus/is';\nimport { CONFIG_VALIDATION } from '../../../../../constants/error-messages.ts';\nimport { logger } from '../../../../../logger/index.ts';\nimport { regEx } from '../../../../../util/regex.ts';\nimport type { PackageDependency, PackageFileContent } from '../../../types.ts';\nimport type { NpmManagerData } from '../../types.ts';\nimport { loadPackageJson } from '../../utils.ts';\nimport type { NpmPackage, NpmPackageDependency } from '../types.ts';\nimport {\n extractDependency,\n getExtractedConstraints,\n parseDepName,\n} from './dependency.ts';\nimport { setNodeCommitTopic } from './node.ts';\nimport { extractOverrideDepsRec } from './overrides.ts';\n\nexport function extractPackageJson(\n packageJson: NpmPackage,\n packageFile: string,\n): PackageFileContent<NpmManagerData> | null {\n logger.trace(`npm.extractPackageJson(${packageFile})`);\n const deps: PackageDependency[] = [];\n\n if (packageJson._id && packageJson._args && packageJson._from) {\n logger.debug({ packageFile }, 'Ignoring vendorised package.json');\n return null;\n }\n if (packageFile !== 'package.json' && packageJson.renovate) {\n const error = new Error(CONFIG_VALIDATION);\n error.validationSource = packageFile;\n error.validationError =\n 'Nested package.json must not contain Renovate configuration. Please use `packageRules` with `matchFileNames` in your main config instead.';\n throw error;\n }\n const packageJsonName = packageJson.name;\n logger.debug(\n `npm file ${packageFile} has name ${JSON.stringify(packageJsonName)}`,\n );\n const packageFileVersion = packageJson.version;\n\n const depTypes = {\n dependencies: 'dependency',\n devDependencies: 'devDependency',\n optionalDependencies: 'optionalDependency',\n peerDependencies: 'peerDependency',\n engines: 'engine',\n volta: 'volta',\n resolutions: 'resolutions',\n packageManager: 'packageManager',\n overrides: 'overrides',\n pnpm: 'pnpm',\n };\n\n for (const depType of Object.keys(depTypes) as (keyof typeof depTypes)[]) {\n let dependencies = packageJson[depType];\n if (dependencies) {\n try {\n if (depType === 'packageManager') {\n const match = regEx('^(?<name>.+)@(?<range>.+)$').exec(\n dependencies as string,\n );\n /* v8 ignore next -- needs test */\n if (!match?.groups) {\n break;\n }\n dependencies = { [match.groups.name]: match.groups.range };\n }\n for (const [key, val] of Object.entries(\n dependencies as NpmPackageDependency,\n )) {\n const depName = parseDepName(depType, key);\n let dep: PackageDependency = {\n depType,\n depName,\n };\n if (depName !== key) {\n dep.managerData = { key };\n }\n // v8 ignore else -- TODO: add test #40625\n if (depType === 'overrides' && !isString(val)) {\n // TODO: fix type #22198\n deps.push(\n ...extractOverrideDepsRec(\n [depName],\n val as unknown as NpmManagerData,\n ),\n );\n } else if (depType === 'pnpm' && depName === 'overrides') {\n // pnpm overrides\n // https://pnpm.io/package_json#pnpmoverrides\n for (const [overridesKey, overridesVal] of Object.entries(\n val as unknown as NpmPackageDependency,\n )) {\n if (isString(overridesVal)) {\n // Newer flat syntax: `parent>parent>child`\n const packageName =\n parsePkgAndParentSelector(overridesKey).targetPkg.name;\n dep = {\n depName: overridesKey,\n packageName,\n depType: 'pnpm.overrides',\n ...extractDependency(depName, packageName, overridesVal),\n };\n setNodeCommitTopic(dep);\n // TODO: Is this expected? It's always 'overrides'.\n dep.prettyDepType = depTypes[depName];\n deps.push(dep);\n } else if (isObject(overridesVal)) {\n // Older nested object syntax: `parent: { parent: { child: version } }`\n deps.push(\n ...extractOverrideDepsRec([overridesKey], overridesVal),\n );\n }\n }\n } else {\n // TODO: fix type #22198\n dep = { ...dep, ...extractDependency(depType, depName, val!) };\n setNodeCommitTopic(dep);\n dep.prettyDepType = depTypes[depType];\n deps.push(dep);\n }\n }\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.debug(\n { fileName: packageFile, depType, err },\n 'Error parsing package.json',\n );\n return null;\n }\n }\n }\n\n const extractedConstraints = getExtractedConstraints(deps);\n\n return {\n deps,\n extractedConstraints,\n packageFileVersion,\n managerData: {\n packageJsonName,\n hasPackageManager:\n isNonEmptyStringAndNotWhitespace(packageJson.packageManager) ||\n
|
|
1
|
+
{"version":3,"file":"package-file.js","names":[],"sources":["../../../../../../lib/modules/manager/npm/extract/common/package-file.ts"],"sourcesContent":["import { parsePkgAndParentSelector } from '@pnpm/parse-overrides';\nimport {\n isNonEmptyObject,\n isNonEmptyString,\n isNonEmptyStringAndNotWhitespace,\n isObject,\n isString,\n} from '@sindresorhus/is';\nimport { CONFIG_VALIDATION } from '../../../../../constants/error-messages.ts';\nimport { logger } from '../../../../../logger/index.ts';\nimport { regEx } from '../../../../../util/regex.ts';\nimport type { PackageDependency, PackageFileContent } from '../../../types.ts';\nimport type { NpmManagerData } from '../../types.ts';\nimport { loadPackageJson } from '../../utils.ts';\nimport type { NpmPackage, NpmPackageDependency } from '../types.ts';\nimport {\n extractDependency,\n getExtractedConstraints,\n parseDepName,\n} from './dependency.ts';\nimport { setNodeCommitTopic } from './node.ts';\nimport { extractOverrideDepsRec } from './overrides.ts';\n\nexport function hasDevEnginesPackageManager(\n packageJson: Pick<NpmPackage, 'devEngines'>,\n): boolean {\n const pm = packageJson.devEngines?.packageManager;\n if (Array.isArray(pm)) {\n return pm.some((item) => isNonEmptyObject(item));\n }\n return isNonEmptyObject(pm);\n}\n\nexport function extractPackageJson(\n packageJson: NpmPackage,\n packageFile: string,\n): PackageFileContent<NpmManagerData> | null {\n logger.trace(`npm.extractPackageJson(${packageFile})`);\n const deps: PackageDependency[] = [];\n\n if (packageJson._id && packageJson._args && packageJson._from) {\n logger.debug({ packageFile }, 'Ignoring vendorised package.json');\n return null;\n }\n if (packageFile !== 'package.json' && packageJson.renovate) {\n const error = new Error(CONFIG_VALIDATION);\n error.validationSource = packageFile;\n error.validationError =\n 'Nested package.json must not contain Renovate configuration. Please use `packageRules` with `matchFileNames` in your main config instead.';\n throw error;\n }\n const packageJsonName = packageJson.name;\n logger.debug(\n `npm file ${packageFile} has name ${JSON.stringify(packageJsonName)}`,\n );\n const packageFileVersion = packageJson.version;\n\n const depTypes = {\n dependencies: 'dependency',\n devDependencies: 'devDependency',\n optionalDependencies: 'optionalDependency',\n peerDependencies: 'peerDependency',\n engines: 'engine',\n volta: 'volta',\n resolutions: 'resolutions',\n packageManager: 'packageManager',\n overrides: 'overrides',\n pnpm: 'pnpm',\n };\n\n for (const depType of Object.keys(depTypes) as (keyof typeof depTypes)[]) {\n let dependencies = packageJson[depType];\n if (dependencies) {\n try {\n if (depType === 'packageManager') {\n const match = regEx('^(?<name>.+)@(?<range>.+)$').exec(\n dependencies as string,\n );\n /* v8 ignore next -- needs test */\n if (!match?.groups) {\n break;\n }\n dependencies = { [match.groups.name]: match.groups.range };\n }\n for (const [key, val] of Object.entries(\n dependencies as NpmPackageDependency,\n )) {\n const depName = parseDepName(depType, key);\n let dep: PackageDependency = {\n depType,\n depName,\n };\n if (depName !== key) {\n dep.managerData = { key };\n }\n // v8 ignore else -- TODO: add test #40625\n if (depType === 'overrides' && !isString(val)) {\n // TODO: fix type #22198\n deps.push(\n ...extractOverrideDepsRec(\n [depName],\n val as unknown as NpmManagerData,\n ),\n );\n } else if (depType === 'pnpm' && depName === 'overrides') {\n // pnpm overrides\n // https://pnpm.io/package_json#pnpmoverrides\n for (const [overridesKey, overridesVal] of Object.entries(\n val as unknown as NpmPackageDependency,\n )) {\n if (isString(overridesVal)) {\n // Newer flat syntax: `parent>parent>child`\n const packageName =\n parsePkgAndParentSelector(overridesKey).targetPkg.name;\n dep = {\n depName: overridesKey,\n packageName,\n depType: 'pnpm.overrides',\n ...extractDependency(depName, packageName, overridesVal),\n };\n setNodeCommitTopic(dep);\n // TODO: Is this expected? It's always 'overrides'.\n dep.prettyDepType = depTypes[depName];\n deps.push(dep);\n } else if (isObject(overridesVal)) {\n // Older nested object syntax: `parent: { parent: { child: version } }`\n deps.push(\n ...extractOverrideDepsRec([overridesKey], overridesVal),\n );\n }\n }\n } else {\n // TODO: fix type #22198\n dep = { ...dep, ...extractDependency(depType, depName, val!) };\n setNodeCommitTopic(dep);\n dep.prettyDepType = depTypes[depType];\n deps.push(dep);\n }\n }\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.debug(\n { fileName: packageFile, depType, err },\n 'Error parsing package.json',\n );\n return null;\n }\n }\n }\n\n if (packageJson.devEngines) {\n for (const subKey of ['runtime', 'packageManager'] as const) {\n const value = packageJson.devEngines[subKey];\n if (!value) {\n continue;\n }\n const items = Array.isArray(value) ? value : [value];\n const depType = `devEngines.${subKey}`;\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (!item?.name || !item.version) {\n continue;\n }\n const dep: PackageDependency = {\n depType,\n depName: item.name,\n ...extractDependency(depType, item.name, item.version),\n };\n setNodeCommitTopic(dep);\n dep.prettyDepType = depType;\n if (Array.isArray(value)) {\n dep.managerData = {\n ...dep.managerData,\n devEnginesIndex: i,\n };\n }\n deps.push(dep);\n }\n }\n }\n\n const extractedConstraints = getExtractedConstraints(deps);\n\n return {\n deps,\n extractedConstraints,\n packageFileVersion,\n managerData: {\n packageJsonName,\n hasPackageManager:\n isNonEmptyStringAndNotWhitespace(packageJson.packageManager) ||\n hasDevEnginesPackageManager(packageJson),\n workspaces: packageJson.workspaces,\n },\n };\n}\n\nexport async function hasPackageManager(\n packageJsonDir: string,\n): Promise<boolean> {\n logger.trace(`npm.hasPackageManager from package.json`);\n\n const packageJsonResult = await loadPackageJson(packageJsonDir);\n\n return (\n (isNonEmptyString(packageJsonResult?.packageManager?.name) &&\n isNonEmptyString(packageJsonResult?.packageManager?.version)) ||\n hasDevEnginesPackageManager(packageJsonResult)\n );\n}\n"],"mappings":";;;;;;;;;;AAuBA,SAAgB,4BACd,aACS;CACT,MAAM,KAAK,YAAY,YAAY;CACnC,IAAI,MAAM,QAAQ,EAAE,GAClB,OAAO,GAAG,MAAM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AEF,KAAK,KAAK,GAAG;EACf;CACF;CAKF,OAAO;EACL;EACA,sBAJ2B,wBAAwB,IAIhC;EACnB;EACA,aAAa;GACX;GACA,mBACE,iCAAiC,YAAY,cAAc,KAC3D,4BAA4B,WAAW;GACzC,YAAY,YAAY;EAC1B;CACF;AACF;AAEA,eAAsB,kBACpB,gBACkB;CAClB,OAAO,MAAM,yCAAyC;CAEtD,MAAM,oBAAoB,MAAM,gBAAgB,cAAc;CAE9D,OACG,iBAAiB,mBAAmB,gBAAgB,IAAI,KACvD,iBAAiB,mBAAmB,gBAAgB,OAAO,KAC7D,4BAA4B,iBAAiB;AAEjD"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { logger } from "../../../../logger/index.js";
|
|
2
2
|
import { findLocalSiblingOrParent, getSiblingFileName, readLocalFile } from "../../../../util/fs/index.js";
|
|
3
3
|
import { NpmDatasource } from "../../../datasource/npm/index.js";
|
|
4
|
-
import { resolveNpmrc } from "../npmrc.js";
|
|
5
4
|
import { PnpmWorkspaceFile } from "../schema.js";
|
|
5
|
+
import { resolveNpmrc } from "../npmrc.js";
|
|
6
6
|
import { getExtractedConstraints } from "./common/dependency.js";
|
|
7
|
-
import { extractPackageJson, hasPackageManager } from "./common/package-file.js";
|
|
7
|
+
import { extractPackageJson, hasDevEnginesPackageManager, hasPackageManager } from "./common/package-file.js";
|
|
8
8
|
import { applyPnpmWorkspaceRegistries, extractPnpmWorkspaceFile } from "./pnpm.js";
|
|
9
9
|
import { extractYarnCatalogs, isZeroInstall } from "./yarn.js";
|
|
10
10
|
import { postExtract } from "./post/index.js";
|
|
11
11
|
import { loadConfigFromLegacyYarnrc, loadConfigFromYarnrcYml, resolveRegistryUrl } from "./yarnrc.js";
|
|
12
|
-
import { isArray,
|
|
12
|
+
import { isArray, isNonEmptyStringAndNotWhitespace, isString } from "@sindresorhus/is";
|
|
13
13
|
import upath from "upath";
|
|
14
14
|
//#region lib/modules/manager/npm/extract/index.ts
|
|
15
15
|
function hasMultipleLockFiles(lockFiles) {
|
|
@@ -99,7 +99,7 @@ async function extractPackageFile(content, packageFile, config) {
|
|
|
99
99
|
...res.managerData,
|
|
100
100
|
...lockFiles,
|
|
101
101
|
yarnZeroInstall,
|
|
102
|
-
hasPackageManager: isNonEmptyStringAndNotWhitespace(packageJson.packageManager) ||
|
|
102
|
+
hasPackageManager: isNonEmptyStringAndNotWhitespace(packageJson.packageManager) || hasDevEnginesPackageManager(packageJson),
|
|
103
103
|
workspacesPackages,
|
|
104
104
|
npmrcFileName
|
|
105
105
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../lib/modules/manager/npm/extract/index.ts"],"sourcesContent":["import {\n isArray,\n isNonEmptyObject,\n isNonEmptyStringAndNotWhitespace,\n isString,\n} from '@sindresorhus/is';\nimport upath from 'upath';\nimport { logger } from '../../../../logger/index.ts';\nimport {\n findLocalSiblingOrParent,\n getSiblingFileName,\n readLocalFile,\n} from '../../../../util/fs/index.ts';\nimport { NpmDatasource } from '../../../datasource/npm/index.ts';\n\nimport type {\n ExtractConfig,\n NpmrcPackageFile,\n NpmrcPackageFileContent,\n} from '../../types.ts';\nimport { resolveNpmrc } from '../npmrc.ts';\nimport { PnpmWorkspaceFile, type YarnConfig } from '../schema.ts';\nimport type { NpmLockFiles, NpmManagerData } from '../types.ts';\nimport { getExtractedConstraints } from './common/dependency.ts';\nimport {\n extractPackageJson,\n hasPackageManager,\n} from './common/package-file.ts';\nimport {\n applyPnpmWorkspaceRegistries,\n extractPnpmWorkspaceFile,\n} from './pnpm.ts';\nimport { postExtract } from './post/index.ts';\nimport type { NpmPackage } from './types.ts';\nimport { extractYarnCatalogs, isZeroInstall } from './yarn.ts';\nimport {\n loadConfigFromLegacyYarnrc,\n loadConfigFromYarnrcYml,\n resolveRegistryUrl,\n} from './yarnrc.ts';\n\nfunction hasMultipleLockFiles(lockFiles: NpmLockFiles): boolean {\n return Object.values(lockFiles).filter(isString).length > 1;\n}\n\nexport async function extractPackageFile(\n content: string,\n packageFile: string,\n config: ExtractConfig,\n): Promise<NpmrcPackageFileContent<NpmManagerData> | null> {\n logger.trace(`npm.extractPackageFile(${packageFile})`);\n logger.trace({ content });\n let packageJson: NpmPackage;\n try {\n packageJson = JSON.parse(content);\n } catch {\n logger.debug({ packageFile }, `Invalid JSON`);\n return null;\n }\n\n const res = extractPackageJson(packageJson, packageFile);\n if (!res) {\n return null;\n }\n\n let workspacesPackages: string[] | undefined;\n if (isArray(packageJson.workspaces)) {\n workspacesPackages = packageJson.workspaces;\n } else {\n workspacesPackages = packageJson.workspaces?.packages;\n }\n\n const lockFiles: NpmLockFiles = {\n yarnLock: 'yarn.lock',\n packageLock: 'package-lock.json',\n shrinkwrapJson: 'npm-shrinkwrap.json',\n pnpmLockFile: 'pnpm-lock.yaml',\n };\n\n for (const [key, val] of Object.entries(lockFiles) as [\n 'yarnLock' | 'packageLock' | 'shrinkwrapJson' | 'pnpmLockFile',\n string,\n ][]) {\n const filePath = getSiblingFileName(packageFile, val);\n if (await readLocalFile(filePath, 'utf8')) {\n lockFiles[key] = filePath;\n } else {\n lockFiles[key] = undefined;\n }\n }\n lockFiles.npmLock = lockFiles.packageLock ?? lockFiles.shrinkwrapJson;\n delete lockFiles.packageLock;\n delete lockFiles.shrinkwrapJson;\n\n if (hasMultipleLockFiles(lockFiles)) {\n logger.warn(\n 'Updating multiple npm lock files is deprecated and support will be removed in future versions.',\n );\n }\n\n const { npmrc, npmrcFileName } = await resolveNpmrc(packageFile, config);\n\n const yarnrcYmlFileName = await findLocalSiblingOrParent(\n packageFile,\n '.yarnrc.yml',\n );\n const yarnZeroInstall = yarnrcYmlFileName\n ? await isZeroInstall(yarnrcYmlFileName)\n : false;\n\n let yarnrcConfig: YarnConfig | null = null;\n const repoYarnrcYml = yarnrcYmlFileName\n ? await readLocalFile(yarnrcYmlFileName, 'utf8')\n : null;\n if (isString(repoYarnrcYml) && repoYarnrcYml.trim().length > 0) {\n yarnrcConfig = loadConfigFromYarnrcYml(repoYarnrcYml);\n }\n\n const legacyYarnrcFileName = await findLocalSiblingOrParent(\n packageFile,\n '.yarnrc',\n );\n const repoLegacyYarnrc = legacyYarnrcFileName\n ? await readLocalFile(legacyYarnrcFileName, 'utf8')\n : null;\n if (isString(repoLegacyYarnrc) && repoLegacyYarnrc.trim().length > 0) {\n yarnrcConfig = loadConfigFromLegacyYarnrc(repoLegacyYarnrc);\n }\n\n let pnpmWorkspaceRegistry: string | undefined;\n let pnpmWorkspaceRegistries: Record<string, string> | undefined;\n const pnpmWorkspaceYamlFileName = await findLocalSiblingOrParent(\n packageFile,\n 'pnpm-workspace.yaml',\n );\n const repoPnpmWorkspaceYaml = pnpmWorkspaceYamlFileName\n ? await readLocalFile(pnpmWorkspaceYamlFileName, 'utf8')\n : null;\n if (isNonEmptyStringAndNotWhitespace(repoPnpmWorkspaceYaml)) {\n const parsed = await PnpmWorkspaceFile.safeParseAsync(\n repoPnpmWorkspaceYaml,\n );\n if (parsed.success) {\n pnpmWorkspaceRegistry = parsed.data.registry;\n pnpmWorkspaceRegistries = parsed.data.registries;\n } else {\n logger.debug(\n { packageFile: pnpmWorkspaceYamlFileName, err: parsed.error },\n 'Failed to parse pnpm-workspace.yaml',\n );\n }\n }\n\n if (res.deps.length === 0) {\n logger.debug('Package file has no deps');\n if (!(\n !!res.managerData?.packageJsonName ||\n !!res.packageFileVersion ||\n !!npmrc ||\n workspacesPackages\n )) {\n logger.debug('Skipping file');\n return null;\n }\n }\n let skipInstalls = config.skipInstalls;\n if (skipInstalls === null) {\n const hasFancyRefs = !!res.deps.some(\n (dep) =>\n !!dep.currentValue?.startsWith('file:') ||\n !!dep.currentValue?.startsWith('npm:'),\n );\n if ((hasFancyRefs && !!lockFiles.npmLock) || yarnZeroInstall) {\n // https://github.com/npm/cli/issues/1432\n // Explanation:\n // - npm install --package-lock-only is buggy for transitive deps in file: and npm: references\n // - So we set skipInstalls to false if file: or npm: refs are found *and* the user hasn't explicitly set the value already\n // - Also, do not skip install if Yarn zero-install is used\n logger.debug('Automatically setting skipInstalls to false');\n skipInstalls = false;\n } else {\n skipInstalls = true;\n }\n }\n\n const extractedConstraints = getExtractedConstraints(res.deps);\n\n if (yarnrcConfig) {\n for (const dep of res.deps) {\n // v8 ignore else -- TODO: add tests #40625\n if (dep.depName) {\n const registryUrlFromYarnrcConfig = resolveRegistryUrl(\n dep.packageName ?? dep.depName,\n yarnrcConfig,\n );\n if (\n registryUrlFromYarnrcConfig &&\n dep.datasource === NpmDatasource.id\n ) {\n dep.registryUrls = [registryUrlFromYarnrcConfig];\n }\n }\n }\n }\n\n // Applied after the yarnrc resolution so pnpm-workspace.yaml wins in pnpm repos\n applyPnpmWorkspaceRegistries(\n res.deps,\n pnpmWorkspaceRegistries,\n pnpmWorkspaceRegistry,\n );\n\n return {\n ...res,\n npmrc,\n managerData: {\n ...res.managerData,\n ...lockFiles,\n yarnZeroInstall,\n hasPackageManager:\n isNonEmptyStringAndNotWhitespace(packageJson.packageManager) ||\n isNonEmptyObject(packageJson.devEngines?.packageManager),\n workspacesPackages,\n npmrcFileName, // store npmrc file name so we can later tell if it came from the workspace or not\n },\n skipInstalls,\n extractedConstraints,\n };\n}\n\nexport async function extractAllPackageFiles(\n config: ExtractConfig,\n packageFiles: string[],\n): Promise<NpmrcPackageFile<NpmManagerData>[]> {\n const npmFiles: NpmrcPackageFile<NpmManagerData>[] = [];\n for (const packageFile of packageFiles) {\n const content = await readLocalFile(packageFile, 'utf8');\n if (content) {\n // pnpm workspace files are their own package file, defined via managerFilePatterns.\n if (packageFile.endsWith('pnpm-workspace.yaml')) {\n logger.trace(\n { packageFile },\n `Extracting as a pnpm-workspace.yaml file`,\n );\n const parsedPnpmWorkspaceYaml =\n await PnpmWorkspaceFile.safeParseAsync(content);\n if (parsedPnpmWorkspaceYaml.success) {\n logger.trace(\n { packageFile },\n `Extracting file as a pnpm workspace YAML file`,\n );\n const deps = await extractPnpmWorkspaceFile(\n parsedPnpmWorkspaceYaml.data,\n packageFile,\n );\n // v8 ignore else -- TODO: add test #40625\n if (deps) {\n npmFiles.push({\n ...deps,\n packageFile,\n });\n }\n } else {\n logger.warn(\n { packageFile, err: parsedPnpmWorkspaceYaml.error },\n `Failed to parse pnpm-workspace.yaml file`,\n );\n }\n } else {\n if (packageFile.endsWith('json')) {\n logger.trace({ packageFile }, `Extracting as a package.json file`);\n\n const deps = await extractPackageFile(content, packageFile, config);\n // v8 ignore else -- TODO: add tests #40625\n if (deps) {\n npmFiles.push({\n ...deps,\n packageFile,\n });\n }\n } else {\n logger.trace({ packageFile }, `Extracting as a .yarnrc.yml file`);\n\n const yarnConfig = loadConfigFromYarnrcYml(content);\n\n // v8 ignore else -- TODO: add tests #40625\n if (yarnConfig?.catalogs || yarnConfig?.catalog) {\n const hasPackageManagerResult = await hasPackageManager(\n upath.dirname(packageFile),\n );\n const catalogsDeps = await extractYarnCatalogs(\n { catalog: yarnConfig.catalog, catalogs: yarnConfig.catalogs },\n packageFile,\n hasPackageManagerResult,\n );\n // v8 ignore else -- TODO: add tests #40625\n if (catalogsDeps) {\n npmFiles.push({\n ...catalogsDeps,\n packageFile,\n });\n }\n }\n }\n }\n } else {\n logger.debug({ packageFile }, `No content found`);\n }\n }\n\n await postExtract(npmFiles);\n return npmFiles;\n}\n"],"mappings":";;;;;;;;;;;;;;AAyCA,SAAS,qBAAqB,WAAkC;CAC9D,OAAO,OAAO,OAAO,SAAS,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,SAAS;AAC5D;AAEA,eAAsB,mBACpB,SACA,aACA,QACyD;CACzD,OAAO,MAAM,0BAA0B,YAAY,EAAE;CACrD,OAAO,MAAM,EAAE,QAAQ,CAAC;CACxB,IAAI;CACJ,IAAI;EACF,cAAc,KAAK,MAAM,OAAO;CAClC,QAAQ;EACN,OAAO,MAAM,EAAE,YAAY,GAAG,cAAc;EAC5C,OAAO;CACT;CAEA,MAAM,MAAM,mBAAmB,aAAa,WAAW;CACvD,I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AI,SAAS;GAEX,IAAI,YAAY,SAAS,qBAAqB,GAAG;IAC/C,OAAO,MACL,EAAE,YAAY,GACd,0CACF;IACA,MAAM,0BACJ,MAAM,kBAAkB,eAAe,OAAO;IAChD,IAAI,wBAAwB,SAAS;KACnC,OAAO,MACL,EAAE,YAAY,GACd,+CACF;KACA,MAAM,OAAO,MAAM,yBACjB,wBAAwB,MACxB,WACF;;KAEA,IAAI,MACF,SAAS,KAAK;MACZ,GAAG;MACH;KACF,CAAC;IAEL,OACE,OAAO,KACL;KAAE;KAAa,KAAK,wBAAwB;IAAM,GAClD,0CACF;GAEJ,OACE,IAAI,YAAY,SAAS,MAAM,GAAG;IAChC,OAAO,MAAM,EAAE,YAAY,GAAG,mCAAmC;IAEjE,MAAM,OAAO,MAAM,mBAAmB,SAAS,aAAa,MAAM;;IAElE,IAAI,MACF,SAAS,KAAK;KACZ,GAAG;KACH;IACF,CAAC;GAEL,OAAO;IACL,OAAO,MAAM,EAAE,YAAY,GAAG,kCAAkC;IAEhE,MAAM,aAAa,wBAAwB,OAAO;;IAGlD,IAAI,YAAY,YAAY,YAAY,SAAS;KAC/C,MAAM,0BAA0B,MAAM,kBACpC,MAAM,QAAQ,WAAW,CAC3B;KACA,MAAM,eAAe,MAAM,oBACzB;MAAE,SAAS,WAAW;MAAS,UAAU,WAAW;KAAS,GAC7D,aACA,uBACF;;KAEA,IAAI,cACF,SAAS,KAAK;MACZ,GAAG;MACH;KACF,CAAC;IAEL;GACF;EAEJ,OACE,OAAO,MAAM,EAAE,YAAY,GAAG,kBAAkB;CAEpD;CAEA,MAAM,YAAY,QAAQ;CAC1B,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../lib/modules/manager/npm/extract/index.ts"],"sourcesContent":["import {\n isArray,\n isNonEmptyStringAndNotWhitespace,\n isString,\n} from '@sindresorhus/is';\nimport upath from 'upath';\nimport { logger } from '../../../../logger/index.ts';\nimport {\n findLocalSiblingOrParent,\n getSiblingFileName,\n readLocalFile,\n} from '../../../../util/fs/index.ts';\nimport { NpmDatasource } from '../../../datasource/npm/index.ts';\n\nimport type {\n ExtractConfig,\n NpmrcPackageFile,\n NpmrcPackageFileContent,\n} from '../../types.ts';\nimport { resolveNpmrc } from '../npmrc.ts';\nimport { PnpmWorkspaceFile, type YarnConfig } from '../schema.ts';\nimport type { NpmLockFiles, NpmManagerData } from '../types.ts';\nimport { getExtractedConstraints } from './common/dependency.ts';\nimport {\n extractPackageJson,\n hasDevEnginesPackageManager,\n hasPackageManager,\n} from './common/package-file.ts';\nimport {\n applyPnpmWorkspaceRegistries,\n extractPnpmWorkspaceFile,\n} from './pnpm.ts';\nimport { postExtract } from './post/index.ts';\nimport type { NpmPackage } from './types.ts';\nimport { extractYarnCatalogs, isZeroInstall } from './yarn.ts';\nimport {\n loadConfigFromLegacyYarnrc,\n loadConfigFromYarnrcYml,\n resolveRegistryUrl,\n} from './yarnrc.ts';\n\nfunction hasMultipleLockFiles(lockFiles: NpmLockFiles): boolean {\n return Object.values(lockFiles).filter(isString).length > 1;\n}\n\nexport async function extractPackageFile(\n content: string,\n packageFile: string,\n config: ExtractConfig,\n): Promise<NpmrcPackageFileContent<NpmManagerData> | null> {\n logger.trace(`npm.extractPackageFile(${packageFile})`);\n logger.trace({ content });\n let packageJson: NpmPackage;\n try {\n packageJson = JSON.parse(content);\n } catch {\n logger.debug({ packageFile }, `Invalid JSON`);\n return null;\n }\n\n const res = extractPackageJson(packageJson, packageFile);\n if (!res) {\n return null;\n }\n\n let workspacesPackages: string[] | undefined;\n if (isArray(packageJson.workspaces)) {\n workspacesPackages = packageJson.workspaces;\n } else {\n workspacesPackages = packageJson.workspaces?.packages;\n }\n\n const lockFiles: NpmLockFiles = {\n yarnLock: 'yarn.lock',\n packageLock: 'package-lock.json',\n shrinkwrapJson: 'npm-shrinkwrap.json',\n pnpmLockFile: 'pnpm-lock.yaml',\n };\n\n for (const [key, val] of Object.entries(lockFiles) as [\n 'yarnLock' | 'packageLock' | 'shrinkwrapJson' | 'pnpmLockFile',\n string,\n ][]) {\n const filePath = getSiblingFileName(packageFile, val);\n if (await readLocalFile(filePath, 'utf8')) {\n lockFiles[key] = filePath;\n } else {\n lockFiles[key] = undefined;\n }\n }\n lockFiles.npmLock = lockFiles.packageLock ?? lockFiles.shrinkwrapJson;\n delete lockFiles.packageLock;\n delete lockFiles.shrinkwrapJson;\n\n if (hasMultipleLockFiles(lockFiles)) {\n logger.warn(\n 'Updating multiple npm lock files is deprecated and support will be removed in future versions.',\n );\n }\n\n const { npmrc, npmrcFileName } = await resolveNpmrc(packageFile, config);\n\n const yarnrcYmlFileName = await findLocalSiblingOrParent(\n packageFile,\n '.yarnrc.yml',\n );\n const yarnZeroInstall = yarnrcYmlFileName\n ? await isZeroInstall(yarnrcYmlFileName)\n : false;\n\n let yarnrcConfig: YarnConfig | null = null;\n const repoYarnrcYml = yarnrcYmlFileName\n ? await readLocalFile(yarnrcYmlFileName, 'utf8')\n : null;\n if (isString(repoYarnrcYml) && repoYarnrcYml.trim().length > 0) {\n yarnrcConfig = loadConfigFromYarnrcYml(repoYarnrcYml);\n }\n\n const legacyYarnrcFileName = await findLocalSiblingOrParent(\n packageFile,\n '.yarnrc',\n );\n const repoLegacyYarnrc = legacyYarnrcFileName\n ? await readLocalFile(legacyYarnrcFileName, 'utf8')\n : null;\n if (isString(repoLegacyYarnrc) && repoLegacyYarnrc.trim().length > 0) {\n yarnrcConfig = loadConfigFromLegacyYarnrc(repoLegacyYarnrc);\n }\n\n let pnpmWorkspaceRegistry: string | undefined;\n let pnpmWorkspaceRegistries: Record<string, string> | undefined;\n const pnpmWorkspaceYamlFileName = await findLocalSiblingOrParent(\n packageFile,\n 'pnpm-workspace.yaml',\n );\n const repoPnpmWorkspaceYaml = pnpmWorkspaceYamlFileName\n ? await readLocalFile(pnpmWorkspaceYamlFileName, 'utf8')\n : null;\n if (isNonEmptyStringAndNotWhitespace(repoPnpmWorkspaceYaml)) {\n const parsed = await PnpmWorkspaceFile.safeParseAsync(\n repoPnpmWorkspaceYaml,\n );\n if (parsed.success) {\n pnpmWorkspaceRegistry = parsed.data.registry;\n pnpmWorkspaceRegistries = parsed.data.registries;\n } else {\n logger.debug(\n { packageFile: pnpmWorkspaceYamlFileName, err: parsed.error },\n 'Failed to parse pnpm-workspace.yaml',\n );\n }\n }\n\n if (res.deps.length === 0) {\n logger.debug('Package file has no deps');\n if (!(\n !!res.managerData?.packageJsonName ||\n !!res.packageFileVersion ||\n !!npmrc ||\n workspacesPackages\n )) {\n logger.debug('Skipping file');\n return null;\n }\n }\n let skipInstalls = config.skipInstalls;\n if (skipInstalls === null) {\n const hasFancyRefs = !!res.deps.some(\n (dep) =>\n !!dep.currentValue?.startsWith('file:') ||\n !!dep.currentValue?.startsWith('npm:'),\n );\n if ((hasFancyRefs && !!lockFiles.npmLock) || yarnZeroInstall) {\n // https://github.com/npm/cli/issues/1432\n // Explanation:\n // - npm install --package-lock-only is buggy for transitive deps in file: and npm: references\n // - So we set skipInstalls to false if file: or npm: refs are found *and* the user hasn't explicitly set the value already\n // - Also, do not skip install if Yarn zero-install is used\n logger.debug('Automatically setting skipInstalls to false');\n skipInstalls = false;\n } else {\n skipInstalls = true;\n }\n }\n\n const extractedConstraints = getExtractedConstraints(res.deps);\n\n if (yarnrcConfig) {\n for (const dep of res.deps) {\n // v8 ignore else -- TODO: add tests #40625\n if (dep.depName) {\n const registryUrlFromYarnrcConfig = resolveRegistryUrl(\n dep.packageName ?? dep.depName,\n yarnrcConfig,\n );\n if (\n registryUrlFromYarnrcConfig &&\n dep.datasource === NpmDatasource.id\n ) {\n dep.registryUrls = [registryUrlFromYarnrcConfig];\n }\n }\n }\n }\n\n // Applied after the yarnrc resolution so pnpm-workspace.yaml wins in pnpm repos\n applyPnpmWorkspaceRegistries(\n res.deps,\n pnpmWorkspaceRegistries,\n pnpmWorkspaceRegistry,\n );\n\n return {\n ...res,\n npmrc,\n managerData: {\n ...res.managerData,\n ...lockFiles,\n yarnZeroInstall,\n hasPackageManager:\n isNonEmptyStringAndNotWhitespace(packageJson.packageManager) ||\n hasDevEnginesPackageManager(packageJson),\n workspacesPackages,\n npmrcFileName, // store npmrc file name so we can later tell if it came from the workspace or not\n },\n skipInstalls,\n extractedConstraints,\n };\n}\n\nexport async function extractAllPackageFiles(\n config: ExtractConfig,\n packageFiles: string[],\n): Promise<NpmrcPackageFile<NpmManagerData>[]> {\n const npmFiles: NpmrcPackageFile<NpmManagerData>[] = [];\n for (const packageFile of packageFiles) {\n const content = await readLocalFile(packageFile, 'utf8');\n if (content) {\n // pnpm workspace files are their own package file, defined via managerFilePatterns.\n if (packageFile.endsWith('pnpm-workspace.yaml')) {\n logger.trace(\n { packageFile },\n `Extracting as a pnpm-workspace.yaml file`,\n );\n const parsedPnpmWorkspaceYaml =\n await PnpmWorkspaceFile.safeParseAsync(content);\n if (parsedPnpmWorkspaceYaml.success) {\n logger.trace(\n { packageFile },\n `Extracting file as a pnpm workspace YAML file`,\n );\n const deps = await extractPnpmWorkspaceFile(\n parsedPnpmWorkspaceYaml.data,\n packageFile,\n );\n // v8 ignore else -- TODO: add test #40625\n if (deps) {\n npmFiles.push({\n ...deps,\n packageFile,\n });\n }\n } else {\n logger.warn(\n { packageFile, err: parsedPnpmWorkspaceYaml.error },\n `Failed to parse pnpm-workspace.yaml file`,\n );\n }\n } else {\n if (packageFile.endsWith('json')) {\n logger.trace({ packageFile }, `Extracting as a package.json file`);\n\n const deps = await extractPackageFile(content, packageFile, config);\n // v8 ignore else -- TODO: add tests #40625\n if (deps) {\n npmFiles.push({\n ...deps,\n packageFile,\n });\n }\n } else {\n logger.trace({ packageFile }, `Extracting as a .yarnrc.yml file`);\n\n const yarnConfig = loadConfigFromYarnrcYml(content);\n\n // v8 ignore else -- TODO: add tests #40625\n if (yarnConfig?.catalogs || yarnConfig?.catalog) {\n const hasPackageManagerResult = await hasPackageManager(\n upath.dirname(packageFile),\n );\n const catalogsDeps = await extractYarnCatalogs(\n { catalog: yarnConfig.catalog, catalogs: yarnConfig.catalogs },\n packageFile,\n hasPackageManagerResult,\n );\n // v8 ignore else -- TODO: add tests #40625\n if (catalogsDeps) {\n npmFiles.push({\n ...catalogsDeps,\n packageFile,\n });\n }\n }\n }\n }\n } else {\n logger.debug({ packageFile }, `No content found`);\n }\n }\n\n await postExtract(npmFiles);\n return npmFiles;\n}\n"],"mappings":";;;;;;;;;;;;;;AAyCA,SAAS,qBAAqB,WAAkC;CAC9D,OAAO,OAAO,OAAO,SAAS,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,SAAS;AAC5D;AAEA,eAAsB,mBACpB,SACA,aACA,QACyD;CACzD,OAAO,MAAM,0BAA0B,YAAY,EAAE;CACrD,OAAO,MAAM,EAAE,QAAQ,CAAC;CACxB,IAAI;CACJ,IAAI;EACF,cAAc,KAAK,MAAM,OAAO;CAClC,QAAQ;EACN,OAAO,MAAM,EAAE,YAAY,GAAG,cAAc;EAC5C,OAAO;CACT;CAEA,MAAM,MAAM,mBAAmB,aAAa,WAAW;CACvD,IAAI,CAAC,KACH,OAAO;CAGT,IAAI;CACJ,IAAI,QAAQ,YAAY,UAAU,GAChC,qBAAqB,YAAY;MAEjC,qBAAqB,YAAY,YAAY;CAG/C,MAAM,YAA0B;EAC9B,UAAU;EACV,aAAa;EACb,gBAAgB;EAChB,cAAc;CAChB;CAEA,KAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,SAAS,GAG5C;EACH,MAAM,WAAW,mBAAmB,aAAa,GAAG;EACpD,IAAI,MAAM,cAAc,UAAU,MAAM,GACtC,UAAU,OAAO;OAEjB,UAAU,OAAO,KAAA;CAErB;CACA,UAAU,UAAU,UAAU,eAAe,UAAU;CACvD,OAAO,UAAU;CACjB,OAAO,UAAU;CAEjB,IAAI,qBAAqB,SAAS,GAChC,OAAO,KACL,gGACF;CAGF,MAAM,EAAE,OAAO,kBAAkB,MAAM,aAAa,aAAa,MAAM;CAEvE,MAAM,oBAAoB,MAAM,y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AM,EAAE,YAAY,GAAG,kCAAkC;IAEhE,MAAM,aAAa,wBAAwB,OAAO;;IAGlD,IAAI,YAAY,YAAY,YAAY,SAAS;KAC/C,MAAM,0BAA0B,MAAM,kBACpC,MAAM,QAAQ,WAAW,CAC3B;KACA,MAAM,eAAe,MAAM,oBACzB;MAAE,SAAS,WAAW;MAAS,UAAU,WAAW;KAAS,GAC7D,aACA,uBACF;;KAEA,IAAI,cACF,SAAS,KAAK;MACZ,GAAG;MACH;KACF,CAAC;IAEL;GACF;EAEJ,OACE,OAAO,MAAM,EAAE,YAAY,GAAG,kBAAkB;CAEpD;CAEA,MAAM,YAAY,QAAQ;CAC1B,OAAO;AACT"}
|
|
@@ -4,8 +4,8 @@ import { logger } from "../../../../logger/index.js";
|
|
|
4
4
|
import { parseSingleYaml, parseYaml } from "../../../../util/yaml.js";
|
|
5
5
|
import { findLocalSiblingOrParent, getSiblingFileName, localPathExists, readLocalFile } from "../../../../util/fs/index.js";
|
|
6
6
|
import { NpmDatasource } from "../../../datasource/npm/index.js";
|
|
7
|
-
import { extractDependency } from "./common/dependency.js";
|
|
8
7
|
import { pnpmWorkspaceOverrides } from "../dep-types.js";
|
|
8
|
+
import { extractDependency } from "./common/dependency.js";
|
|
9
9
|
import { extractCatalogDeps } from "./common/catalogs.js";
|
|
10
10
|
import { isNonEmptyObject, isNumber, isObject, isPlainObject, isString } from "@sindresorhus/is";
|
|
11
11
|
import upath from "upath";
|
|
@@ -31,8 +31,8 @@ async function getLockedVersions(packageFiles) {
|
|
|
31
31
|
packageFile.extractedConstraints.yarn = yarn;
|
|
32
32
|
}
|
|
33
33
|
for (const dep of packageFile.deps) {
|
|
34
|
-
dep.lockedVersion = lockFileCache[yarnLock].lockedVersions?.[`${dep.depName}@${dep.currentValue}`];
|
|
35
|
-
if ((dep.depType === "engines" || dep.depType === "packageManager") && dep.depName === "yarn" && !isYarn1) dep.packageName = "@yarnpkg/cli-dist";
|
|
34
|
+
if (dep.depType !== "devEngines.runtime" && dep.depType !== "devEngines.packageManager") dep.lockedVersion = lockFileCache[yarnLock].lockedVersions?.[`${dep.depName}@${dep.currentValue}`];
|
|
35
|
+
if ((dep.depType === "engines" || dep.depType === "packageManager" || dep.depType === "devEngines.packageManager") && dep.depName === "yarn" && !isYarn1) dep.packageName = "@yarnpkg/cli-dist";
|
|
36
36
|
}
|
|
37
37
|
} else if (npmLock) {
|
|
38
38
|
logger.debug(`Found ${npmLock} for ${packageFile.packageFile}`);
|
|
@@ -74,7 +74,7 @@ async function getLockedVersions(packageFiles) {
|
|
|
74
74
|
const npmRootDir = upath.dirname(npmLock);
|
|
75
75
|
const relativeDir = upath.relative(npmRootDir, packageDir);
|
|
76
76
|
for (const dep of packageFile.deps) {
|
|
77
|
-
if (dep.depType === "engines" || dep.depType === "packageManager" || dep.depType === "volta") continue;
|
|
77
|
+
if (dep.depType === "engines" || dep.depType === "packageManager" || dep.depType === "volta" || dep.depType === "devEngines.runtime" || dep.depType === "devEngines.packageManager") continue;
|
|
78
78
|
let lockedDepName = dep.depName;
|
|
79
79
|
if (relativeDir && relativeDir !== ".") lockedDepName = `${relativeDir}/node_modules/${dep.depName}`;
|
|
80
80
|
dep.lockedVersion = semver.valid(lockFileCache[npmLock].lockedVersions?.[lockedDepName]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locked-versions.js","names":[],"sources":["../../../../../../lib/modules/manager/npm/extract/post/locked-versions.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport semver from 'semver';\nimport upath from 'upath';\nimport { logger } from '../../../../../logger/index.ts';\nimport { regEx } from '../../../../../util/regex.ts';\nimport type { PackageFile } from '../../../types.ts';\nimport type { NpmManagerData } from '../../types.ts';\nimport { getNpmLock } from '../npm.ts';\nimport { getPnpmLock } from '../pnpm.ts';\nimport type { LockFile } from '../types.ts';\nimport { getYarnLock, getYarnVersionFromLock } from '../yarn.ts';\n\nconst pnpmCatalogDepTypeRe = regEx(/pnpm\\.catalog\\.(?<version>.*)/);\n\nexport async function getLockedVersions(\n packageFiles: PackageFile<NpmManagerData>[],\n): Promise<void> {\n const lockFileCache: Record<string, LockFile> = {};\n logger.debug('Finding locked versions');\n for (const packageFile of packageFiles) {\n const { managerData = {} } = packageFile;\n const { yarnLock, npmLock, pnpmLockFile } = managerData;\n const lockFiles: string[] = [];\n if (yarnLock) {\n logger.trace('Found yarnLock');\n lockFiles.push(yarnLock);\n // v8 ignore else -- TODO: add test #40625\n if (!lockFileCache[yarnLock]) {\n logger.trace(`Retrieving/parsing ${yarnLock}`);\n lockFileCache[yarnLock] = await getYarnLock(yarnLock);\n }\n const { isYarn1 } = lockFileCache[yarnLock];\n let yarn: string | undefined;\n if (!isYarn1 && !packageFile.extractedConstraints?.yarn) {\n yarn = getYarnVersionFromLock(lockFileCache[yarnLock]);\n }\n if (yarn) {\n packageFile.extractedConstraints ??= {};\n packageFile.extractedConstraints.yarn = yarn;\n }\n for (const dep of packageFile.deps) {\n dep.lockedVersion =\n
|
|
1
|
+
{"version":3,"file":"locked-versions.js","names":[],"sources":["../../../../../../lib/modules/manager/npm/extract/post/locked-versions.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport semver from 'semver';\nimport upath from 'upath';\nimport { logger } from '../../../../../logger/index.ts';\nimport { regEx } from '../../../../../util/regex.ts';\nimport type { PackageFile } from '../../../types.ts';\nimport type { NpmManagerData } from '../../types.ts';\nimport { getNpmLock } from '../npm.ts';\nimport { getPnpmLock } from '../pnpm.ts';\nimport type { LockFile } from '../types.ts';\nimport { getYarnLock, getYarnVersionFromLock } from '../yarn.ts';\n\nconst pnpmCatalogDepTypeRe = regEx(/pnpm\\.catalog\\.(?<version>.*)/);\n\nexport async function getLockedVersions(\n packageFiles: PackageFile<NpmManagerData>[],\n): Promise<void> {\n const lockFileCache: Record<string, LockFile> = {};\n logger.debug('Finding locked versions');\n for (const packageFile of packageFiles) {\n const { managerData = {} } = packageFile;\n const { yarnLock, npmLock, pnpmLockFile } = managerData;\n const lockFiles: string[] = [];\n if (yarnLock) {\n logger.trace('Found yarnLock');\n lockFiles.push(yarnLock);\n // v8 ignore else -- TODO: add test #40625\n if (!lockFileCache[yarnLock]) {\n logger.trace(`Retrieving/parsing ${yarnLock}`);\n lockFileCache[yarnLock] = await getYarnLock(yarnLock);\n }\n const { isYarn1 } = lockFileCache[yarnLock];\n let yarn: string | undefined;\n if (!isYarn1 && !packageFile.extractedConstraints?.yarn) {\n yarn = getYarnVersionFromLock(lockFileCache[yarnLock]);\n }\n if (yarn) {\n packageFile.extractedConstraints ??= {};\n packageFile.extractedConstraints.yarn = yarn;\n }\n for (const dep of packageFile.deps) {\n if (\n dep.depType !== 'devEngines.runtime' &&\n dep.depType !== 'devEngines.packageManager'\n ) {\n dep.lockedVersion =\n lockFileCache[yarnLock].lockedVersions?.[\n // TODO: types (#22198)\n `${dep.depName}@${dep.currentValue}`\n ];\n }\n if (\n (dep.depType === 'engines' ||\n dep.depType === 'packageManager' ||\n dep.depType === 'devEngines.packageManager') &&\n dep.depName === 'yarn' &&\n !isYarn1\n ) {\n dep.packageName = '@yarnpkg/cli-dist';\n }\n }\n } else if (npmLock) {\n logger.debug(`Found ${npmLock} for ${packageFile.packageFile}`);\n lockFiles.push(npmLock);\n if (!lockFileCache[npmLock]) {\n logger.trace(`Retrieving/parsing ${npmLock}`);\n const cache = await getNpmLock(npmLock);\n /* v8 ignore next -- needs test */\n if (!cache) {\n logger.warn({ npmLock }, 'Npm: unable to get lockfile');\n return;\n }\n lockFileCache[npmLock] = cache;\n }\n\n const { lockfileVersion } = lockFileCache[npmLock];\n let npm: string | undefined;\n if (lockfileVersion === 1) {\n if (packageFile.extractedConstraints?.npm) {\n // Add a <7 constraint if it's not already a fixed version\n if (\n semver.satisfies('6.14.18', packageFile.extractedConstraints.npm)\n ) {\n npm = `${packageFile.extractedConstraints.npm} <7`;\n }\n } else {\n npm = '<7';\n }\n } else if (lockfileVersion === 2) {\n if (packageFile.extractedConstraints?.npm) {\n // Add a <9 constraint if the latest 8.x is compatible\n if (\n semver.satisfies('8.19.3', packageFile.extractedConstraints.npm)\n ) {\n npm = `${packageFile.extractedConstraints.npm} <9`;\n }\n } else {\n npm = '<9';\n }\n } else if (lockfileVersion === 3) {\n if (!packageFile.extractedConstraints?.npm) {\n npm = '>=7';\n }\n } else {\n logger.warn(\n { lockfileVersion, npmLock },\n 'Found unsupported npm lockfile version',\n );\n return;\n }\n if (npm) {\n packageFile.extractedConstraints ??= {};\n packageFile.extractedConstraints.npm = npm;\n }\n\n const packageDir = upath.dirname(packageFile.packageFile);\n const npmRootDir = upath.dirname(npmLock);\n const relativeDir = upath.relative(npmRootDir, packageDir);\n\n for (const dep of packageFile.deps) {\n // Skip dependency types which are not locked in the lock file\n if (\n dep.depType === 'engines' ||\n dep.depType === 'packageManager' ||\n dep.depType === 'volta' ||\n dep.depType === 'devEngines.runtime' ||\n dep.depType === 'devEngines.packageManager'\n ) {\n continue;\n }\n\n // TODO: types (#22198)\n let lockedDepName = dep.depName!;\n if (relativeDir && relativeDir !== '.') {\n lockedDepName = `${relativeDir}/node_modules/${dep.depName}`;\n }\n\n dep.lockedVersion = semver.valid(\n lockFileCache[npmLock].lockedVersions?.[lockedDepName],\n )!;\n }\n } else if (pnpmLockFile) {\n logger.debug('Found pnpm lock-file');\n lockFiles.push(pnpmLockFile);\n if (!lockFileCache[pnpmLockFile]) {\n logger.trace(`Retrieving/parsing ${pnpmLockFile}`);\n lockFileCache[pnpmLockFile] = await getPnpmLock(pnpmLockFile);\n }\n\n const packageDir = upath.dirname(packageFile.packageFile);\n const pnpmRootDir = upath.dirname(pnpmLockFile);\n const relativeDir = upath.relative(pnpmRootDir, packageDir) || '.';\n\n for (const dep of packageFile.deps) {\n const { depName, depType } = dep;\n\n const catalogName = pnpmCatalogDepTypeRe.exec(depType!)?.groups\n ?.version;\n\n if (catalogName) {\n const lockedVersion = semver.valid(\n lockFileCache[pnpmLockFile].lockedVersionsWithCatalog?.[\n catalogName\n ]?.[depName!],\n );\n\n // v8 ignore else -- TODO: add test #40625\n if (isString(lockedVersion)) {\n dep.lockedVersion = lockedVersion;\n }\n } else {\n // TODO: types (#22198)\n const lockedVersion = semver.valid(\n lockFileCache[pnpmLockFile].lockedVersionsWithPath?.[relativeDir]?.[\n depType!\n ]?.[depName!],\n );\n\n // v8 ignore else -- TODO: add test #40625\n if (isString(lockedVersion)) {\n dep.lockedVersion = lockedVersion;\n }\n }\n }\n }\n if (lockFiles.length) {\n packageFile.lockFiles = lockFiles;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAYA,MAAM,uBAAuB,MAAM,+BAA+B;AAElE,eAAsB,kBACpB,cACe;CACf,MAAM,gBAA0C,CAAC;CACjD,OAAO,MAAM,yBAAyB;CACtC,KAAK,MAAM,eAAe,cAAc;EACtC,MAAM,EAAE,cAAc,CAAC,MAAM;EAC7B,MAAM,EAAE,UAAU,SAAS,iBAAiB;EAC5C,MAAM,YAAsB,CAAC;EAC7B,IAAI,UAAU;GACZ,OAAO,MAAM,gBAAgB;GAC7B,UAAU,KAAK,QAAQ;;GAEvB,IAAI,CAAC,cAAc,WAAW;IAC5B,OAAO,MAAM,sBAAsB,UAAU;IAC7C,cAAc,YAAY,MAAM,YAAY,QAAQ;GACtD;GACA,MAAM,EAAE,YAAY,cAAc;GAClC,IAAI;GACJ,IAAI,CAAC,WAAW,CAAC,YAAY,sBAAsB,MACjD,OAAO,uBAAuB,cAAc,SAAS;GAEvD,IAAI,MAAM;IACR,YAAY,yBAAyB,CAAC;IACtC,YAAY,qBAAqB,OAAO;GAC1C;GACA,KAAK,MAAM,OAAO,YAAY,MAAM;IAClC,IACE,IAAI,YAAY,wBAChB,IAAI,YAAY,6BAEhB,IAAI,gBACF,cAAc,SAAS,CAAC,iBAEtB,GAAG,IAAI,QAAQ,GAAG,IAAI;IAG5B,KACG,IAAI,YAAY,aACf,IAAI,YAAY,oBAChB,IAAI,YAAY,gCAClB,IAAI,YAAY,UAChB,CAAC,SAED,IAAI,cAAc;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,gBAAgB,GAAG,YAAY,gBAAgB,IAAI;IAGrD,IAAI,gBAAgB,OAAO,MACzB,cAAc,QAAQ,CAAC,iBAAiB,cAC1C;GACF;EACF,OAAO,IAAI,cAAc;GACvB,OAAO,MAAM,sBAAsB;GACnC,UAAU,KAAK,YAAY;GAC3B,IAAI,CAAC,cAAc,eAAe;IAChC,OAAO,MAAM,sBAAsB,cAAc;IACjD,cAAc,gBAAgB,MAAM,YAAY,YAAY;GAC9D;GAEA,MAAM,aAAa,MAAM,QAAQ,YAAY,WAAW;GACxD,MAAM,cAAc,MAAM,QAAQ,YAAY;GAC9C,MAAM,cAAc,MAAM,SAAS,aAAa,UAAU,KAAK;GAE/D,KAAK,MAAM,OAAO,YAAY,MAAM;IAClC,MAAM,EAAE,SAAS,YAAY;IAE7B,MAAM,cAAc,qBAAqB,KAAK,OAAQ,CAAC,EAAE,QACrD;IAEJ,IAAI,aAAa;KACf,MAAM,gBAAgB,OAAO,MAC3B,cAAc,aAAa,CAAC,4BAC1B,YACD,GAAG,QACN;;KAGA,IAAI,SAAS,aAAa,GACxB,IAAI,gBAAgB;IAExB,OAAO;KAEL,MAAM,gBAAgB,OAAO,MAC3B,cAAc,aAAa,CAAC,yBAAyB,YAAY,GAC/D,QACD,GAAG,QACN;;KAGA,IAAI,SAAS,aAAa,GACxB,IAAI,gBAAgB;IAExB;GACF;EACF;EACA,IAAI,UAAU,QACZ,YAAY,YAAY;CAE5B;AACF"}
|
|
@@ -2,12 +2,12 @@ import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { GithubTagsDatasource } from "../../datasource/github-tags/index.js";
|
|
3
3
|
import { NodeVersionDatasource } from "../../datasource/node-version/index.js";
|
|
4
4
|
import { NpmDatasource } from "../../datasource/npm/index.js";
|
|
5
|
+
import { knownDepTypes, supportsDynamicDepTypesNote } from "./dep-types.js";
|
|
6
|
+
import { updateDependency } from "./update/dependency/index.js";
|
|
5
7
|
import { updateArtifacts } from "./artifacts.js";
|
|
6
8
|
import { detectGlobalConfig } from "./detect.js";
|
|
7
|
-
import { knownDepTypes, supportsDynamicDepTypesNote } from "./dep-types.js";
|
|
8
9
|
import { extractAllPackageFiles } from "./extract/index.js";
|
|
9
10
|
import { getRangeStrategy } from "./range.js";
|
|
10
|
-
import { updateDependency } from "./update/dependency/index.js";
|
|
11
11
|
import { updateLockedDependency } from "./update/locked-dependency/index.js";
|
|
12
12
|
import { bumpPackageVersion } from "./update/package-version/index.js";
|
|
13
13
|
import "./update/index.js";
|
|
@@ -8,11 +8,6 @@ function lazyLoadPackageJson(lockFileDir) {
|
|
|
8
8
|
return new Lazy(() => loadPackageJson(lockFileDir));
|
|
9
9
|
}
|
|
10
10
|
function getPackageManagerVersion(name, pkg) {
|
|
11
|
-
if (pkg.volta?.[name]) {
|
|
12
|
-
const version = pkg.volta[name];
|
|
13
|
-
logger.debug(`Found ${name} constraint in package.json volta: ${version}`);
|
|
14
|
-
return version;
|
|
15
|
-
}
|
|
16
11
|
if (pkg.devEngines?.packageManager) {
|
|
17
12
|
const version = (isArray(pkg.devEngines.packageManager) ? pkg.devEngines.packageManager : [pkg.devEngines.packageManager]).find((pm) => pm.name === name)?.version;
|
|
18
13
|
// v8 ignore else -- TODO: add test #40625
|
|
@@ -21,6 +16,11 @@ function getPackageManagerVersion(name, pkg) {
|
|
|
21
16
|
return version;
|
|
22
17
|
}
|
|
23
18
|
}
|
|
19
|
+
if (pkg.volta?.[name]) {
|
|
20
|
+
const version = pkg.volta[name];
|
|
21
|
+
logger.debug(`Found ${name} constraint in package.json volta: ${version}`);
|
|
22
|
+
return version;
|
|
23
|
+
}
|
|
24
24
|
if (pkg.packageManager?.name === name) {
|
|
25
25
|
const version = pkg.packageManager.version;
|
|
26
26
|
logger.debug(`Found ${name} constraint in package.json packageManager: ${version}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../../../lib/modules/manager/npm/post-update/utils.ts"],"sourcesContent":["import { isArray } from '@sindresorhus/is';\nimport semver from 'semver';\nimport { logger } from '../../../../logger/index.ts';\nimport { Lazy } from '../../../../util/lazy.ts';\nimport type { PackageJson } from '../schema.ts';\nimport { loadPackageJson } from '../utils.ts';\n\nexport function lazyLoadPackageJson(\n lockFileDir: string,\n): Lazy<Promise<PackageJson>> {\n return new Lazy(() => loadPackageJson(lockFileDir));\n}\n\nexport function getPackageManagerVersion(\n name: string,\n pkg: PackageJson,\n): string | null {\n if (pkg.
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../../../lib/modules/manager/npm/post-update/utils.ts"],"sourcesContent":["import { isArray } from '@sindresorhus/is';\nimport semver from 'semver';\nimport { logger } from '../../../../logger/index.ts';\nimport { Lazy } from '../../../../util/lazy.ts';\nimport type { PackageJson } from '../schema.ts';\nimport { loadPackageJson } from '../utils.ts';\n\nexport function lazyLoadPackageJson(\n lockFileDir: string,\n): Lazy<Promise<PackageJson>> {\n return new Lazy(() => loadPackageJson(lockFileDir));\n}\n\nexport function getPackageManagerVersion(\n name: string,\n pkg: PackageJson,\n): string | null {\n if (pkg.devEngines?.packageManager) {\n const packageManagers = isArray(pkg.devEngines.packageManager)\n ? pkg.devEngines.packageManager\n : [pkg.devEngines.packageManager];\n const packageMgr = packageManagers.find((pm) => pm.name === name);\n const version = packageMgr?.version;\n // v8 ignore else -- TODO: add test #40625\n if (version) {\n logger.debug(\n `Found ${name} constraint in package.json devEngines: ${version}`,\n );\n return version;\n }\n }\n if (pkg.volta?.[name]) {\n const version = pkg.volta[name];\n logger.debug(`Found ${name} constraint in package.json volta: ${version}`);\n\n return version;\n }\n if (pkg.packageManager?.name === name) {\n const version = pkg.packageManager.version;\n logger.debug(\n `Found ${name} constraint in package.json packageManager: ${version}`,\n );\n if (semver.valid(version)) {\n return version;\n }\n return null;\n }\n if (pkg.engines?.[name]) {\n const version = pkg.engines[name];\n logger.debug(\n `Found ${name} constraint in package.json engines: ${version}`,\n );\n return version;\n }\n return null;\n}\n\nexport function getNodeOptions(nodeMaxMemory: number): string {\n return `--max-old-space-size=${nodeMaxMemory}`;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,oBACd,aAC4B;CAC5B,OAAO,IAAI,WAAW,gBAAgB,WAAW,CAAC;AACpD;AAEA,SAAgB,yBACd,MACA,KACe;CACf,IAAI,IAAI,YAAY,gBAAgB;EAKlC,MAAM,WAJkB,QAAQ,IAAI,WAAW,cAAc,IACzD,IAAI,WAAW,iBACf,CAAC,IAAI,WAAW,cAAc,EAAA,CACC,MAAM,OAAO,GAAG,SAAS,IACnC,CAAC,EAAE;;EAE5B,IAAI,SAAS;GACX,OAAO,MACL,SAAS,KAAK,0CAA0C,SAC1D;GACA,OAAO;EACT;CACF;CACA,IAAI,IAAI,QAAQ,OAAO;EACrB,MAAM,UAAU,IAAI,MAAM;EAC1B,OAAO,MAAM,SAAS,KAAK,qCAAqC,SAAS;EAEzE,OAAO;CACT;CACA,IAAI,IAAI,gBAAgB,SAAS,MAAM;EACrC,MAAM,UAAU,IAAI,eAAe;EACnC,OAAO,MACL,SAAS,KAAK,8CAA8C,SAC9D;EACA,IAAI,OAAO,MAAM,OAAO,GACtB,OAAO;EAET,OAAO;CACT;CACA,IAAI,IAAI,UAAU,OAAO;EACvB,MAAM,UAAU,IAAI,QAAQ;EAC5B,OAAO,MACL,SAAS,KAAK,uCAAuC,SACvD;EACA,OAAO;CACT;CACA,OAAO;AACT;AAEA,SAAgB,eAAe,eAA+B;CAC5D,OAAO,wBAAwB;AACjC"}
|
|
@@ -54,7 +54,7 @@ function getOptimizeCommand(fileName) {
|
|
|
54
54
|
];
|
|
55
55
|
}
|
|
56
56
|
function isYarnUpdate(upgrade) {
|
|
57
|
-
return upgrade.depType === "packageManager" && upgrade.depName === "yarn";
|
|
57
|
+
return (upgrade.depType === "packageManager" || upgrade.depType === "devEngines.packageManager") && upgrade.depName === "yarn";
|
|
58
58
|
}
|
|
59
59
|
async function generateLockFile(lockFileDir, env, config = {}, upgrades = []) {
|
|
60
60
|
const lockFileName = upath.join(lockFileDir, "yarn.lock");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yarn.js","names":[],"sources":["../../../../../lib/modules/manager/npm/post-update/yarn.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport semver from 'semver';\nimport { quote } from 'shlex';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../../../config/global.ts';\nimport {\n SYSTEM_INSUFFICIENT_DISK_SPACE,\n TEMPORARY_ERROR,\n} from '../../../../constants/error-messages.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error.ts';\nimport { getEnv } from '../../../../util/env.ts';\nimport { exec, getToolSettingsOptions } from '../../../../util/exec/index.ts';\nimport type {\n CommandWithOptions,\n ExecOptions,\n ExtraEnv,\n ToolConstraint,\n} from '../../../../util/exec/types.ts';\nimport {\n localPathIsFile,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs/index.ts';\nimport { coerceObject } from '../../../../util/object.ts';\nimport { newlineRegex, regEx } from '../../../../util/regex.ts';\nimport { uniqueStrings } from '../../../../util/string.ts';\nimport { NpmDatasource } from '../../../datasource/npm/index.ts';\nimport type { PostUpdateConfig, Upgrade } from '../../types.ts';\nimport { resolveToolConstraint } from '../../util.ts';\nimport { getYarnLock, getYarnVersionFromLock } from '../extract/yarn.ts';\nimport type { NpmManagerData } from '../types.ts';\nimport { getNodeToolConstraint } from './node-version.ts';\nimport type { GenerateLockFileResult } from './types.ts';\nimport {\n getNodeOptions,\n getPackageManagerVersion,\n lazyLoadPackageJson,\n} from './utils.ts';\n\nexport async function checkYarnrc(\n lockFileDir: string,\n): Promise<{ offlineMirror: boolean; yarnPath: string | null }> {\n let offlineMirror = false;\n let yarnPath: string | null = null;\n try {\n const yarnrc = await readLocalFile(\n upath.join(lockFileDir, '.yarnrc'),\n 'utf8',\n );\n if (isString(yarnrc)) {\n const mirrorLine = yarnrc\n .split(newlineRegex)\n .find((line) => line.startsWith('yarn-offline-mirror '));\n offlineMirror = !!mirrorLine;\n const pathLine = yarnrc\n .split(newlineRegex)\n .find((line) => line.startsWith('yarn-path '));\n if (pathLine) {\n yarnPath = pathLine.replace(\n regEx(/^yarn-path\\s+\"?(?<path>.+?)\"?$/),\n '$<path>',\n );\n }\n if (yarnPath) {\n // resolve binary relative to `yarnrc`\n yarnPath = upath.join(lockFileDir, yarnPath);\n }\n const yarnBinaryExists = yarnPath\n ? await localPathIsFile(yarnPath)\n : false;\n let scrubbedYarnrc = yarnrc\n .replace('--install.pure-lockfile true', '')\n .replace('--install.frozen-lockfile true', '');\n if (!yarnBinaryExists) {\n scrubbedYarnrc = scrubbedYarnrc.replace(\n regEx(/^yarn-path\\s+\"?.+?\"?$/gm),\n '',\n );\n yarnPath = null;\n }\n if (yarnrc !== scrubbedYarnrc) {\n logger.debug(`Writing scrubbed .yarnrc to ${lockFileDir}`);\n await writeLocalFile(\n upath.join(lockFileDir, '.yarnrc'),\n scrubbedYarnrc,\n );\n }\n }\n /* v8 ignore next -- needs test */\n } catch {\n // not found\n }\n return { offlineMirror, yarnPath };\n}\n\nexport function getOptimizeCommand(fileName: string): string[] {\n return ['sed', '-i', 's/ steps,/ steps.slice(0,1),/', fileName];\n}\n\nexport function isYarnUpdate(upgrade: Upgrade): boolean {\n return upgrade.depType === 'packageManager' && upgrade.depName === 'yarn';\n}\n\nexport async function generateLockFile(\n lockFileDir: string,\n env: NodeJS.ProcessEnv,\n config: Partial<PostUpdateConfig<NpmManagerData>> = {},\n upgrades: Upgrade[] = [],\n): Promise<GenerateLockFileResult> {\n const lockFileName = upath.join(lockFileDir, 'yarn.lock');\n logger.debug(`Spawning yarn install to create ${lockFileName}`);\n let lockFile: string | null = null;\n try {\n const lazyPgkJson = lazyLoadPackageJson(lockFileDir);\n const toolConstraints: ToolConstraint[] = [\n await getNodeToolConstraint(config, upgrades, lockFileDir, lazyPgkJson),\n ];\n const yarnUpdate = upgrades.find(isYarnUpdate);\n const yarnCompatibility =\n yarnUpdate?.newValue ??\n (await resolveToolConstraint(\n config,\n 'yarn',\n async () =>\n getPackageManagerVersion('yarn', await lazyPgkJson.getValue()) ??\n getYarnVersionFromLock(await getYarnLock(lockFileName)),\n ));\n const yarnRange = semver.validRange(yarnCompatibility);\n const minYarnVersion = yarnRange && semver.minVersion(yarnRange);\n const isYarn1 = !minYarnVersion || minYarnVersion.major === 1;\n const isYarnDedupeAvailable =\n minYarnVersion && semver.gte(minYarnVersion, '2.2.0');\n const isYarnModeAvailable =\n minYarnVersion && semver.gte(minYarnVersion, '3.0.0');\n\n const yarnTool: ToolConstraint = {\n toolName: 'yarn',\n constraint: '^1.22.18', // needs to be a v1 yarn, otherwise v2 will be installed\n };\n\n // check first upgrade, see #17786\n const hasPackageManager =\n !!config.managerData?.hasPackageManager ||\n !!upgrades[0]?.managerData?.hasPackageManager;\n\n if (!isYarn1 && hasPackageManager) {\n toolConstraints.push({\n toolName: 'corepack',\n constraint: await resolveToolConstraint(config, 'corepack'),\n });\n } else {\n toolConstraints.push(yarnTool);\n if (isYarn1 && minYarnVersion) {\n yarnTool.constraint = yarnCompatibility;\n }\n }\n\n const extraEnv: ExtraEnv = {\n NPM_CONFIG_CACHE: env.NPM_CONFIG_CACHE,\n npm_config_store: env.npm_config_store,\n };\n\n const commands: (string | CommandWithOptions)[] = [];\n let cmdOptions = ''; // should have a leading space\n if (config.skipInstalls !== false) {\n if (isYarn1) {\n const { offlineMirror, yarnPath } = await checkYarnrc(lockFileDir);\n // v8 ignore else -- TODO: add test #40625\n if (!offlineMirror) {\n logger.debug('Updating yarn.lock only - skipping node_modules');\n // The following change causes Yarn 1.x to exit gracefully after updating the lock file but without installing node_modules\n yarnTool.toolName = 'yarn-slim';\n if (yarnPath) {\n commands.push({\n command: getOptimizeCommand(yarnPath),\n ignoreFailure: true,\n });\n }\n }\n } else if (isYarnModeAvailable) {\n // Don't run the link step and only fetch what's necessary to compute an updated lockfile\n cmdOptions += ' --mode=update-lockfile';\n }\n }\n\n if (isYarn1) {\n cmdOptions +=\n ' --ignore-engines --ignore-platform --network-timeout 100000';\n extraEnv.YARN_CACHE_FOLDER = env.YARN_CACHE_FOLDER;\n } else {\n extraEnv.YARN_ENABLE_IMMUTABLE_INSTALLS = 'false';\n extraEnv.YARN_HTTP_TIMEOUT = '100000';\n extraEnv.YARN_GLOBAL_FOLDER = env.YARN_GLOBAL_FOLDER;\n if (!config.managerData?.yarnZeroInstall) {\n logger.debug('Enabling global cache as zero-install is not detected');\n extraEnv.YARN_ENABLE_GLOBAL_CACHE = '1';\n }\n }\n if (!GlobalConfig.get('allowScripts') || config.ignoreScripts) {\n if (isYarn1) {\n cmdOptions += ' --ignore-scripts';\n } else if (isYarnModeAvailable) {\n if (config.skipInstalls === false) {\n // Don't run the build scripts\n cmdOptions += ' --mode=skip-build';\n }\n } else {\n extraEnv.YARN_ENABLE_SCRIPTS = '0';\n }\n }\n\n const { nodeMaxMemory } = getToolSettingsOptions(config.toolSettings);\n if (nodeMaxMemory) {\n extraEnv.NODE_OPTIONS = getNodeOptions(nodeMaxMemory);\n }\n\n const execOptions: ExecOptions = {\n cwdFile: lockFileName,\n extraEnv,\n docker: {},\n toolConstraints,\n };\n /* v8 ignore next -- needs test */\n if (GlobalConfig.get('exposeAllEnv')) {\n extraEnv.NPM_AUTH = env.NPM_AUTH;\n extraEnv.NPM_EMAIL = env.NPM_EMAIL;\n }\n\n if (yarnUpdate && !isYarn1) {\n logger.debug('Updating Yarn binary');\n // TODO: types (#22198)\n commands.push(`yarn set version ${quote(yarnUpdate.newValue!)}`);\n }\n\n const allEnv = getEnv();\n if (allEnv.RENOVATE_X_YARN_PROXY) {\n // v8 ignore else -- TODO: add test #40625\n if (allEnv.HTTP_PROXY && !isYarn1) {\n commands.push('yarn config unset --home httpProxy');\n commands.push(\n `yarn config set --home httpProxy ${quote(allEnv.HTTP_PROXY)}`,\n );\n }\n // v8 ignore else -- TODO: add test #40625\n if (allEnv.HTTPS_PROXY && !isYarn1) {\n commands.push('yarn config unset --home httpsProxy');\n commands.push(\n `yarn config set --home httpsProxy ${quote(allEnv.HTTPS_PROXY)}`,\n );\n }\n }\n\n // This command updates the lock file based on package.json\n commands.push(`yarn install${cmdOptions}`);\n\n // rangeStrategy = update-lockfile\n const lockUpdates = upgrades.filter((upgrade) => upgrade.isLockfileUpdate);\n if (lockUpdates.length) {\n logger.debug('Performing lockfileUpdate (yarn)');\n if (isYarn1) {\n // `yarn upgrade` updates based on the version range specified in the package file\n // note - this can hit a yarn bug, see https://github.com/yarnpkg/yarn/issues/8236\n commands.push(\n `yarn upgrade ${lockUpdates\n .map((update) => update.depName)\n .filter(isString)\n .filter(uniqueStrings)\n .map(quote)\n .join(' ')}${cmdOptions}`,\n );\n } else {\n // `yarn up -R` updates to the latest release in each range\n commands.push(\n `yarn up -R ${lockUpdates\n // TODO: types (#22198)\n .map((update) => `${update.depName!}`)\n .filter(uniqueStrings)\n .map(quote)\n .join(' ')}${cmdOptions}`,\n );\n }\n }\n\n // postUpdateOptions\n ['fewer', 'highest'].forEach((s) => {\n if (\n config.postUpdateOptions?.includes(\n `yarnDedupe${s.charAt(0).toUpperCase()}${s.slice(1)}`,\n )\n ) {\n logger.debug(`Performing yarn dedupe ${s}`);\n if (isYarn1) {\n commands.push(`npx yarn-deduplicate --strategy ${s}`);\n // Run yarn again in case any changes are necessary\n commands.push(`yarn install${cmdOptions}`);\n } else if (isYarnDedupeAvailable && s === 'highest') {\n commands.push(`yarn dedupe --strategy ${s}${cmdOptions}`);\n } else {\n logger.debug(`yarn dedupe ${s} not available`);\n }\n }\n });\n\n if (upgrades.find((upgrade) => upgrade.isLockFileMaintenance)) {\n logger.debug(\n `Removing ${lockFileName} first due to lock file maintenance upgrade`,\n );\n\n // Note: Instead of just deleting the `yarn.lock` file, we just wipe it\n // and keep an empty lock file. Deleting the lock file could result in different\n // Yarn semantics. e.g. Yarn 2+ will error when `yarn install` is executed in\n // a subdirectory which is not part of a Yarn workspace. Yarn suggests to create\n // an empty lock file if a subdirectory should be treated as its own workspace.\n // https://github.com/yarnpkg/berry/blob/20612e82d26ead5928cc27bf482bb8d62dde87d3/packages/yarnpkg-core/sources/Project.ts#L284.\n try {\n await writeLocalFile(lockFileName, '');\n } catch (err) {\n // v8 ignore next -- TODO: add test #40625\n logger.debug(\n { err, lockFileName },\n 'Error clearing `yarn.lock` for lock file maintenance',\n );\n }\n }\n\n // Run the commands\n await exec(commands, execOptions);\n\n // Read the result\n lockFile = await readLocalFile(lockFileName, 'utf8');\n } catch (err) {\n // v8 ignore if -- TODO: add test #40625\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.debug(\n {\n err,\n type: 'yarn',\n },\n 'lock file error',\n );\n const stdouterr = String(err.stdout) + String(err.stderr);\n // v8 ignore if -- TODO: add test #40625\n if (\n stdouterr.includes('ENOSPC: no space left on device') ||\n stdouterr.includes('Out of diskspace')\n ) {\n throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);\n }\n // v8 ignore if -- TODO: add test #40625\n if (\n stdouterr.includes('The registry may be down.') ||\n stdouterr.includes('getaddrinfo ENOTFOUND registry.yarnpkg.com') ||\n stdouterr.includes('getaddrinfo ENOTFOUND registry.npmjs.org')\n ) {\n throw new ExternalHostError(err, NpmDatasource.id);\n }\n return { error: true, stderr: err.stderr, stdout: err.stdout };\n }\n return { lockFile };\n}\n\nexport function fuzzyMatchAdditionalYarnrcYml<\n T extends { npmRegistries?: Record<string, unknown> },\n>(additionalYarnRcYml: T, existingYarnrRcYml: T): T {\n const keys = new Map(\n Object.keys(coerceObject(existingYarnrRcYml.npmRegistries)).map((x) => [\n x.replace(regEx(/\\/$/), '').replace(regEx(/^https?:/), ''),\n x,\n ]),\n );\n\n return {\n ...additionalYarnRcYml,\n npmRegistries: Object.entries(\n coerceObject(additionalYarnRcYml.npmRegistries),\n )\n .map(([k, v]) => {\n const key = keys.get(k.replace(regEx(/\\/$/), '')) ?? k;\n return { [key]: v };\n })\n .reduce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B,GAErC,MAAM,IAAI,MAAM,8BAA8B;;EAGhD,IACE,UAAU,SAAS,2BAA2B,KAC9C,UAAU,SAAS,4CAA4C,KAC/D,UAAU,SAAS,0CAA0C,GAE7D,MAAM,IAAI,kBAAkB,KAAK,cAAc,EAAE;EAEnD,OAAO;GAAE,OAAO;GAAM,QAAQ,IAAI;GAAQ,QAAQ,IAAI;EAAO;CAC/D;CACA,OAAO,EAAE,SAAS;AACpB;AAEA,SAAgB,8BAEd,qBAAwB,oBAA0B;CAClD,MAAM,OAAO,IAAI,IACf,OAAO,KAAK,aAAa,mBAAmB,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CACrE,EAAE,QAAQ,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC,QAAQ,MAAM,UAAU,GAAG,EAAE,GACzD,CACF,CAAC,CACH;CAEA,OAAO;EACL,GAAG;EACH,eAAe,OAAO,QACpB,aAAa,oBAAoB,aAAa,CAChD,CAAC,CACE,KAAK,CAAC,GAAG,OAAO;GAEf,OAAO,GADK,KAAK,IAAI,EAAE,QAAQ,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,IACrC,EAAE;EACpB,CAAC,CAAC,CACD,QAAQ,KAAK,SAAS;GAAE,GAAG;GAAK,GAAG;EAAI,IAAI,CAAC,CAAC;CAClD;AACF"}
|
|
1
|
+
{"version":3,"file":"yarn.js","names":[],"sources":["../../../../../lib/modules/manager/npm/post-update/yarn.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport semver from 'semver';\nimport { quote } from 'shlex';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../../../config/global.ts';\nimport {\n SYSTEM_INSUFFICIENT_DISK_SPACE,\n TEMPORARY_ERROR,\n} from '../../../../constants/error-messages.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error.ts';\nimport { getEnv } from '../../../../util/env.ts';\nimport { exec, getToolSettingsOptions } from '../../../../util/exec/index.ts';\nimport type {\n CommandWithOptions,\n ExecOptions,\n ExtraEnv,\n ToolConstraint,\n} from '../../../../util/exec/types.ts';\nimport {\n localPathIsFile,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs/index.ts';\nimport { coerceObject } from '../../../../util/object.ts';\nimport { newlineRegex, regEx } from '../../../../util/regex.ts';\nimport { uniqueStrings } from '../../../../util/string.ts';\nimport { NpmDatasource } from '../../../datasource/npm/index.ts';\nimport type { PostUpdateConfig, Upgrade } from '../../types.ts';\nimport { resolveToolConstraint } from '../../util.ts';\nimport { getYarnLock, getYarnVersionFromLock } from '../extract/yarn.ts';\nimport type { NpmManagerData } from '../types.ts';\nimport { getNodeToolConstraint } from './node-version.ts';\nimport type { GenerateLockFileResult } from './types.ts';\nimport {\n getNodeOptions,\n getPackageManagerVersion,\n lazyLoadPackageJson,\n} from './utils.ts';\n\nexport async function checkYarnrc(\n lockFileDir: string,\n): Promise<{ offlineMirror: boolean; yarnPath: string | null }> {\n let offlineMirror = false;\n let yarnPath: string | null = null;\n try {\n const yarnrc = await readLocalFile(\n upath.join(lockFileDir, '.yarnrc'),\n 'utf8',\n );\n if (isString(yarnrc)) {\n const mirrorLine = yarnrc\n .split(newlineRegex)\n .find((line) => line.startsWith('yarn-offline-mirror '));\n offlineMirror = !!mirrorLine;\n const pathLine = yarnrc\n .split(newlineRegex)\n .find((line) => line.startsWith('yarn-path '));\n if (pathLine) {\n yarnPath = pathLine.replace(\n regEx(/^yarn-path\\s+\"?(?<path>.+?)\"?$/),\n '$<path>',\n );\n }\n if (yarnPath) {\n // resolve binary relative to `yarnrc`\n yarnPath = upath.join(lockFileDir, yarnPath);\n }\n const yarnBinaryExists = yarnPath\n ? await localPathIsFile(yarnPath)\n : false;\n let scrubbedYarnrc = yarnrc\n .replace('--install.pure-lockfile true', '')\n .replace('--install.frozen-lockfile true', '');\n if (!yarnBinaryExists) {\n scrubbedYarnrc = scrubbedYarnrc.replace(\n regEx(/^yarn-path\\s+\"?.+?\"?$/gm),\n '',\n );\n yarnPath = null;\n }\n if (yarnrc !== scrubbedYarnrc) {\n logger.debug(`Writing scrubbed .yarnrc to ${lockFileDir}`);\n await writeLocalFile(\n upath.join(lockFileDir, '.yarnrc'),\n scrubbedYarnrc,\n );\n }\n }\n /* v8 ignore next -- needs test */\n } catch {\n // not found\n }\n return { offlineMirror, yarnPath };\n}\n\nexport function getOptimizeCommand(fileName: string): string[] {\n return ['sed', '-i', 's/ steps,/ steps.slice(0,1),/', fileName];\n}\n\nexport function isYarnUpdate(upgrade: Upgrade): boolean {\n return (\n (upgrade.depType === 'packageManager' ||\n upgrade.depType === 'devEngines.packageManager') &&\n upgrade.depName === 'yarn'\n );\n}\n\nexport async function generateLockFile(\n lockFileDir: string,\n env: NodeJS.ProcessEnv,\n config: Partial<PostUpdateConfig<NpmManagerData>> = {},\n upgrades: Upgrade[] = [],\n): Promise<GenerateLockFileResult> {\n const lockFileName = upath.join(lockFileDir, 'yarn.lock');\n logger.debug(`Spawning yarn install to create ${lockFileName}`);\n let lockFile: string | null = null;\n try {\n const lazyPgkJson = lazyLoadPackageJson(lockFileDir);\n const toolConstraints: ToolConstraint[] = [\n await getNodeToolConstraint(config, upgrades, lockFileDir, lazyPgkJson),\n ];\n const yarnUpdate = upgrades.find(isYarnUpdate);\n const yarnCompatibility =\n yarnUpdate?.newValue ??\n (await resolveToolConstraint(\n config,\n 'yarn',\n async () =>\n getPackageManagerVersion('yarn', await lazyPgkJson.getValue()) ??\n getYarnVersionFromLock(await getYarnLock(lockFileName)),\n ));\n const yarnRange = semver.validRange(yarnCompatibility);\n const minYarnVersion = yarnRange && semver.minVersion(yarnRange);\n const isYarn1 = !minYarnVersion || minYarnVersion.major === 1;\n const isYarnDedupeAvailable =\n minYarnVersion && semver.gte(minYarnVersion, '2.2.0');\n const isYarnModeAvailable =\n minYarnVersion && semver.gte(minYarnVersion, '3.0.0');\n\n const yarnTool: ToolConstraint = {\n toolName: 'yarn',\n constraint: '^1.22.18', // needs to be a v1 yarn, otherwise v2 will be installed\n };\n\n // check first upgrade, see #17786\n const hasPackageManager =\n !!config.managerData?.hasPackageManager ||\n !!upgrades[0]?.managerData?.hasPackageManager;\n\n if (!isYarn1 && hasPackageManager) {\n toolConstraints.push({\n toolName: 'corepack',\n constraint: await resolveToolConstraint(config, 'corepack'),\n });\n } else {\n toolConstraints.push(yarnTool);\n if (isYarn1 && minYarnVersion) {\n yarnTool.constraint = yarnCompatibility;\n }\n }\n\n const extraEnv: ExtraEnv = {\n NPM_CONFIG_CACHE: env.NPM_CONFIG_CACHE,\n npm_config_store: env.npm_config_store,\n };\n\n const commands: (string | CommandWithOptions)[] = [];\n let cmdOptions = ''; // should have a leading space\n if (config.skipInstalls !== false) {\n if (isYarn1) {\n const { offlineMirror, yarnPath } = await checkYarnrc(lockFileDir);\n // v8 ignore else -- TODO: add test #40625\n if (!offlineMirror) {\n logger.debug('Updating yarn.lock only - skipping node_modules');\n // The following change causes Yarn 1.x to exit gracefully after updating the lock file but without installing node_modules\n yarnTool.toolName = 'yarn-slim';\n if (yarnPath) {\n commands.push({\n command: getOptimizeCommand(yarnPath),\n ignoreFailure: true,\n });\n }\n }\n } else if (isYarnModeAvailable) {\n // Don't run the link step and only fetch what's necessary to compute an updated lockfile\n cmdOptions += ' --mode=update-lockfile';\n }\n }\n\n if (isYarn1) {\n cmdOptions +=\n ' --ignore-engines --ignore-platform --network-timeout 100000';\n extraEnv.YARN_CACHE_FOLDER = env.YARN_CACHE_FOLDER;\n } else {\n extraEnv.YARN_ENABLE_IMMUTABLE_INSTALLS = 'false';\n extraEnv.YARN_HTTP_TIMEOUT = '100000';\n extraEnv.YARN_GLOBAL_FOLDER = env.YARN_GLOBAL_FOLDER;\n if (!config.managerData?.yarnZeroInstall) {\n logger.debug('Enabling global cache as zero-install is not detected');\n extraEnv.YARN_ENABLE_GLOBAL_CACHE = '1';\n }\n }\n if (!GlobalConfig.get('allowScripts') || config.ignoreScripts) {\n if (isYarn1) {\n cmdOptions += ' --ignore-scripts';\n } else if (isYarnModeAvailable) {\n if (config.skipInstalls === false) {\n // Don't run the build scripts\n cmdOptions += ' --mode=skip-build';\n }\n } else {\n extraEnv.YARN_ENABLE_SCRIPTS = '0';\n }\n }\n\n const { nodeMaxMemory } = getToolSettingsOptions(config.toolSettings);\n if (nodeMaxMemory) {\n extraEnv.NODE_OPTIONS = getNodeOptions(nodeMaxMemory);\n }\n\n const execOptions: ExecOptions = {\n cwdFile: lockFileName,\n extraEnv,\n docker: {},\n toolConstraints,\n };\n /* v8 ignore next -- needs test */\n if (GlobalConfig.get('exposeAllEnv')) {\n extraEnv.NPM_AUTH = env.NPM_AUTH;\n extraEnv.NPM_EMAIL = env.NPM_EMAIL;\n }\n\n if (yarnUpdate && !isYarn1) {\n logger.debug('Updating Yarn binary');\n // TODO: types (#22198)\n commands.push(`yarn set version ${quote(yarnUpdate.newValue!)}`);\n }\n\n const allEnv = getEnv();\n if (allEnv.RENOVATE_X_YARN_PROXY) {\n // v8 ignore else -- TODO: add test #40625\n if (allEnv.HTTP_PROXY && !isYarn1) {\n commands.push('yarn config unset --home httpProxy');\n commands.push(\n `yarn config set --home httpProxy ${quote(allEnv.HTTP_PROXY)}`,\n );\n }\n // v8 ignore else -- TODO: add test #40625\n if (allEnv.HTTPS_PROXY && !isYarn1) {\n commands.push('yarn config unset --home httpsProxy');\n commands.push(\n `yarn config set --home httpsProxy ${quote(allEnv.HTTPS_PROXY)}`,\n );\n }\n }\n\n // This command updates the lock file based on package.json\n commands.push(`yarn install${cmdOptions}`);\n\n // rangeStrategy = update-lockfile\n const lockUpdates = upgrades.filter((upgrade) => upgrade.isLockfileUpdate);\n if (lockUpdates.length) {\n logger.debug('Performing lockfileUpdate (yarn)');\n if (isYarn1) {\n // `yarn upgrade` updates based on the version range specified in the package file\n // note - this can hit a yarn bug, see https://github.com/yarnpkg/yarn/issues/8236\n commands.push(\n `yarn upgrade ${lockUpdates\n .map((update) => update.depName)\n .filter(isString)\n .filter(uniqueStrings)\n .map(quote)\n .join(' ')}${cmdOptions}`,\n );\n } else {\n // `yarn up -R` updates to the latest release in each range\n commands.push(\n `yarn up -R ${lockUpdates\n // TODO: types (#22198)\n .map((update) => `${update.depName!}`)\n .filter(uniqueStrings)\n .map(quote)\n .join(' ')}${cmdOptions}`,\n );\n }\n }\n\n // postUpdateOptions\n ['fewer', 'highest'].forEach((s) => {\n if (\n config.postUpdateOptions?.includes(\n `yarnDedupe${s.charAt(0).toUpperCase()}${s.slice(1)}`,\n )\n ) {\n logger.debug(`Performing yarn dedupe ${s}`);\n if (isYarn1) {\n commands.push(`npx yarn-deduplicate --strategy ${s}`);\n // Run yarn again in case any changes are necessary\n commands.push(`yarn install${cmdOptions}`);\n } else if (isYarnDedupeAvailable && s === 'highest') {\n commands.push(`yarn dedupe --strategy ${s}${cmdOptions}`);\n } else {\n logger.debug(`yarn dedupe ${s} not available`);\n }\n }\n });\n\n if (upgrades.find((upgrade) => upgrade.isLockFileMaintenance)) {\n logger.debug(\n `Removing ${lockFileName} first due to lock file maintenance upgrade`,\n );\n\n // Note: Instead of just deleting the `yarn.lock` file, we just wipe it\n // and keep an empty lock file. Deleting the lock file could result in different\n // Yarn semantics. e.g. Yarn 2+ will error when `yarn install` is executed in\n // a subdirectory which is not part of a Yarn workspace. Yarn suggests to create\n // an empty lock file if a subdirectory should be treated as its own workspace.\n // https://github.com/yarnpkg/berry/blob/20612e82d26ead5928cc27bf482bb8d62dde87d3/packages/yarnpkg-core/sources/Project.ts#L284.\n try {\n await writeLocalFile(lockFileName, '');\n } catch (err) {\n // v8 ignore next -- TODO: add test #40625\n logger.debug(\n { err, lockFileName },\n 'Error clearing `yarn.lock` for lock file maintenance',\n );\n }\n }\n\n // Run the commands\n await exec(commands, execOptions);\n\n // Read the result\n lockFile = await readLocalFile(lockFileName, 'utf8');\n } catch (err) {\n // v8 ignore if -- TODO: add test #40625\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.debug(\n {\n err,\n type: 'yarn',\n },\n 'lock file error',\n );\n const stdouterr = String(err.stdout) + String(err.stderr);\n // v8 ignore if -- TODO: add test #40625\n if (\n stdouterr.includes('ENOSPC: no space left on device') ||\n stdouterr.includes('Out of diskspace')\n ) {\n throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);\n }\n // v8 ignore if -- TODO: add test #40625\n if (\n stdouterr.includes('The registry may be down.') ||\n stdouterr.includes('getaddrinfo ENOTFOUND registry.yarnpkg.com') ||\n stdouterr.includes('getaddrinfo ENOTFOUND registry.npmjs.org')\n ) {\n throw new ExternalHostError(err, NpmDatasource.id);\n }\n return { error: true, stderr: err.stderr, stdout: err.stdout };\n }\n return { lockFile };\n}\n\nexport function fuzzyMatchAdditionalYarnrcYml<\n T extends { npmRegistries?: Record<string, unknown> },\n>(additionalYarnRcYml: T, existingYarnrRcYml: T): T {\n const keys = new Map(\n Object.keys(coerceObject(existingYarnrRcYml.npmRegistries)).map((x) => [\n x.replace(regEx(/\\/$/), '').replace(regEx(/^https?:/), ''),\n x,\n ]),\n );\n\n return {\n ...additionalYarnRcYml,\n npmRegistries: Object.entries(\n coerceObject(additionalYarnRcYml.npmRegistries),\n )\n .map(([k, v]) => {\n const key = keys.get(k.replace(regEx(/\\/$/), '')) ?? k;\n return { [key]: v };\n })\n .reduce((acc, cur) => ({ ...acc, ...cur }), {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,eAAsB,YACpB,aAC8D;CAC9D,IAAI,gBAAgB;CACpB,IAAI,WAA0B;CAC9B,IAAI;EACF,MAAM,SAAS,MAAM,cACnB,MAAM,KAAK,aAAa,SAAS,GACjC,MACF;EACA,IAAI,SAAS,MAAM,GAAG;GAIpB,gBAAgB,CAAC,CAHE,OAChB,MAAM,YAAY,CAAC,CACnB,MAAM,SAAS,KAAK,WAAW,sBAAsB,CAC7B;GAC3B,MAAM,WAAW,OACd,MAAM,YAAY,CAAC,CACnB,MAAM,SAAS,KAAK,WAAW,YAAY,CAAC;GAC/C,IAAI,UACF,WA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KAAK,GAAG,EAAE,CAAC,CAAC,QAAQ,MAAM,UAAU,GAAG,EAAE,GACzD,CACF,CAAC,CACH;CAEA,OAAO;EACL,GAAG;EACH,eAAe,OAAO,QACpB,aAAa,oBAAoB,aAAa,CAChD,CAAC,CACE,KAAK,CAAC,GAAG,OAAO;GAEf,OAAO,GADK,KAAK,IAAI,EAAE,QAAQ,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,IACrC,EAAE;EACpB,CAAC,CAAC,CACD,QAAQ,KAAK,SAAS;GAAE,GAAG;GAAK,GAAG;EAAI,IAAI,CAAC,CAAC;CAClD;AACF"}
|
|
@@ -46,6 +46,75 @@ function replaceAsString(parsedContents, fileContent, depType, depName, oldValue
|
|
|
46
46
|
// v8 ignore next -- TODO: add test #40625
|
|
47
47
|
throw new Error();
|
|
48
48
|
}
|
|
49
|
+
function updateDevEnginesDependency({ fileContent, upgrade }) {
|
|
50
|
+
const { depType, depName, newValue, managerData } = upgrade;
|
|
51
|
+
/* v8 ignore if -- defensive: dispatcher already filtered */
|
|
52
|
+
if (!depName || !newValue || depType !== "devEngines.runtime" && depType !== "devEngines.packageManager") return null;
|
|
53
|
+
const subKey = depType === "devEngines.runtime" ? "runtime" : "packageManager";
|
|
54
|
+
try {
|
|
55
|
+
const parsedContents = JSON.parse(fileContent);
|
|
56
|
+
const block = parsedContents.devEngines?.[subKey];
|
|
57
|
+
if (!block) {
|
|
58
|
+
logger.warn({
|
|
59
|
+
depName,
|
|
60
|
+
depType
|
|
61
|
+
}, "No devEngines block found; this is likely an extraction error.");
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
let oldVersion;
|
|
65
|
+
if (isArray(block)) {
|
|
66
|
+
const idx = managerData?.devEnginesIndex;
|
|
67
|
+
if (typeof idx !== "number") {
|
|
68
|
+
logger.warn({
|
|
69
|
+
depName,
|
|
70
|
+
depType
|
|
71
|
+
}, "No devEngines index found; this is likely an extraction error.");
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const item = block[idx];
|
|
75
|
+
if (!item || item.name !== depName) {
|
|
76
|
+
logger.warn({
|
|
77
|
+
actualName: item?.name,
|
|
78
|
+
depName,
|
|
79
|
+
depType,
|
|
80
|
+
devEnginesIndex: idx
|
|
81
|
+
}, "No matching devEngines dependency found; this is likely an extraction error.");
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
oldVersion = item.version;
|
|
85
|
+
item.version = newValue;
|
|
86
|
+
} else {
|
|
87
|
+
if (block.name !== depName) {
|
|
88
|
+
logger.warn({
|
|
89
|
+
actualName: block.name,
|
|
90
|
+
depName,
|
|
91
|
+
depType
|
|
92
|
+
}, "No matching devEngines dependency found; this is likely an extraction error.");
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
oldVersion = block.version;
|
|
96
|
+
block.version = newValue;
|
|
97
|
+
}
|
|
98
|
+
/* v8 ignore if -- defensive: extract filters out version-less items */
|
|
99
|
+
if (oldVersion === void 0) return null;
|
|
100
|
+
if (oldVersion === newValue) return fileContent;
|
|
101
|
+
const searchString = JSON.stringify(oldVersion);
|
|
102
|
+
const newString = JSON.stringify(newValue);
|
|
103
|
+
let searchIndex = fileContent.indexOf("\"devEngines\"");
|
|
104
|
+
/* v8 ignore if -- defensive: extract verified devEngines presence */
|
|
105
|
+
if (searchIndex === -1) return null;
|
|
106
|
+
searchIndex += 12;
|
|
107
|
+
for (; searchIndex < fileContent.length; searchIndex += 1) if (matchAt(fileContent, searchIndex, searchString)) {
|
|
108
|
+
const testContent = replaceAt(fileContent, searchIndex, searchString, newString);
|
|
109
|
+
if (dequal(parsedContents, JSON.parse(testContent))) return testContent;
|
|
110
|
+
}
|
|
111
|
+
/* v8 ignore next -- defensive: oldVersion guaranteed to appear in JSON */
|
|
112
|
+
return null;
|
|
113
|
+
} catch (err) {
|
|
114
|
+
logger.warn({ err }, "updateDevEnginesDependency error");
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
49
118
|
function updateDependency({ fileContent, packageFile: packageFileName, upgrade }) {
|
|
50
119
|
if (upgrade.depType?.startsWith("pnpm.catalog") || upgrade.depType === "pnpm-workspace.overrides") return updatePnpmWorkspaceDependency({
|
|
51
120
|
fileContent,
|
|
@@ -57,6 +126,10 @@ function updateDependency({ fileContent, packageFile: packageFileName, upgrade }
|
|
|
57
126
|
packageFile: packageFileName,
|
|
58
127
|
upgrade
|
|
59
128
|
});
|
|
129
|
+
if (upgrade.depType === "devEngines.runtime" || upgrade.depType === "devEngines.packageManager") return updateDevEnginesDependency({
|
|
130
|
+
fileContent,
|
|
131
|
+
upgrade
|
|
132
|
+
});
|
|
60
133
|
const { depType, managerData } = upgrade;
|
|
61
134
|
const depName = managerData?.key ?? upgrade.depName;
|
|
62
135
|
let { newValue } = upgrade;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../lib/modules/manager/npm/update/dependency/index.ts"],"sourcesContent":["import { isArray, isNonEmptyStringAndNotWhitespace } from '@sindresorhus/is';\nimport { dequal } from 'dequal';\nimport { logger } from '../../../../../logger/index.ts';\nimport { regEx } from '../../../../../util/regex.ts';\nimport { matchAt, replaceAt } from '../../../../../util/string.ts';\nimport type { UpdateDependencyConfig, Upgrade } from '../../../types.ts';\nimport { pnpmWorkspaceOverrides } from '../../dep-types.ts';\nimport type {\n DependenciesMeta,\n NpmPackage,\n OverrideDependency,\n RecursiveOverride,\n} from '../../extract/types.ts';\nimport type { NpmDepType, NpmManagerData } from '../../types.ts';\nimport { getNewGitValue, getNewNpmAliasValue } from './common.ts';\nimport { updatePnpmWorkspaceDependency } from './pnpm.ts';\nimport { updateYarnrcCatalogDependency } from './yarn.ts';\n\nfunction renameObjKey(\n oldObj: DependenciesMeta,\n oldKey: string,\n newKey: string,\n): DependenciesMeta {\n const keys = Object.keys(oldObj);\n return keys.reduce((acc, key) => {\n if (key === oldKey) {\n acc[newKey] = oldObj[oldKey];\n } else {\n acc[key] = oldObj[key];\n }\n return acc;\n }, {} as DependenciesMeta);\n}\n\nfunction replaceAsString(\n parsedContents: NpmPackage,\n fileContent: string,\n depType:\n NpmDepType | 'dependenciesMeta' | 'packageManager' | 'pnpm.overrides',\n depName: string,\n oldValue: string,\n newValue: string,\n parents?: string[],\n): string {\n if (depType === 'packageManager') {\n parsedContents[depType] = newValue;\n } else if (depType === 'pnpm.overrides') {\n parsedContents.pnpm!.overrides![depName] = newValue;\n } else if (depName === oldValue) {\n // The old value is the name of the dependency itself\n delete Object.assign(parsedContents[depType]!, {\n [newValue]: parsedContents[depType]![oldValue],\n })[oldValue];\n } else if (depType === 'dependenciesMeta') {\n // v8 ignore else -- TODO: add test #40625\n if (oldValue !== newValue) {\n parsedContents.dependenciesMeta = renameObjKey(\n // TODO #22198\n parsedContents.dependenciesMeta!,\n oldValue,\n newValue,\n );\n }\n } else if (parents && depType === 'overrides') {\n // there is an object as a value in overrides block\n const { depObjectReference, overrideDepName } = overrideDepPosition(\n parsedContents[depType]!,\n parents,\n depName,\n );\n // v8 ignore else -- TODO: add test #40625\n if (depObjectReference) {\n depObjectReference[overrideDepName] = newValue;\n }\n } else {\n // The old value is the version of the dependency\n parsedContents[depType]![depName] = newValue;\n }\n // Look for the old version number\n const searchString = `\"${oldValue}\"`;\n let newString = `\"${newValue}\"`;\n\n const escapedDepName = RegExp.escape(depName);\n const patchRe = regEx(`^(patch:${escapedDepName}@(npm:)?).*#`);\n const match = patchRe.exec(oldValue);\n if (match && depType === 'resolutions') {\n const patch = oldValue.replace(match[0], `${match[1]}${newValue}#`);\n parsedContents[depType]![depName] = patch;\n newString = `\"${patch}\"`;\n }\n\n // Skip ahead to depType section\n let searchIndex = fileContent.indexOf(`\"${depType}\"`) + depType.length;\n logger.trace(`Starting search at index ${searchIndex}`);\n // Iterate through the rest of the file\n for (; searchIndex < fileContent.length; searchIndex += 1) {\n // First check if we have a hit for the old version\n if (matchAt(fileContent, searchIndex, searchString)) {\n logger.trace(`Found match at index ${searchIndex}`);\n // Now test if the result matches\n const testContent = replaceAt(\n fileContent,\n searchIndex,\n searchString,\n newString,\n );\n // Compare the parsed JSON structure of old and new\n if (dequal(parsedContents, JSON.parse(testContent))) {\n return testContent;\n }\n }\n }\n // v8 ignore next -- TODO: add test #40625\n throw new Error();\n}\n\nexport function updateDependency({\n fileContent,\n packageFile: packageFileName,\n upgrade,\n}: UpdateDependencyConfig): string | null {\n if (\n upgrade.depType?.startsWith('pnpm.catalog') ||\n upgrade.depType === pnpmWorkspaceOverrides\n ) {\n return updatePnpmWorkspaceDependency({\n fileContent,\n packageFile: packageFileName,\n upgrade,\n });\n }\n if (upgrade.depType?.startsWith('yarn.catalog')) {\n return updateYarnrcCatalogDependency({\n fileContent,\n packageFile: packageFileName,\n upgrade,\n });\n }\n\n const { depType, managerData } = upgrade;\n const depName: string = managerData?.key ?? upgrade.depName;\n let { newValue } = upgrade;\n\n newValue = getNewGitValue(upgrade) ?? newValue;\n newValue = getNewNpmAliasValue(newValue, upgrade) ?? newValue;\n\n logger.debug(`npm.updateDependency(): ${depType}.${depName} = ${newValue}`);\n try {\n const parsedContents: NpmPackage = JSON.parse(fileContent);\n let overrideDepParents: string[] | undefined = undefined;\n // Save the old version\n let oldVersion: string | undefined;\n if (depType === 'packageManager') {\n oldVersion = parsedContents[depType];\n newValue = `${depName}@${newValue}`;\n } else if (isOverrideObject(upgrade)) {\n overrideDepParents = managerData?.parents;\n // v8 ignore else -- TODO: add test #40625\n if (overrideDepParents) {\n // old version when there is an object as a value in overrides block\n const { depObjectReference, overrideDepName } = overrideDepPosition(\n parsedContents.overrides!,\n overrideDepParents,\n depName,\n );\n // v8 ignore else -- TODO: add test #40625\n if (depObjectReference) {\n oldVersion = depObjectReference[overrideDepName]!;\n }\n }\n } else if (depType === 'pnpm.overrides') {\n oldVersion = parsedContents.pnpm?.overrides?.[depName];\n } else {\n oldVersion = parsedContents[depType as NpmDepType]![depName] as string;\n }\n if (\n oldVersion === newValue &&\n (!upgrade.newName || upgrade.newName === depName)\n ) {\n logger.trace('Version is already updated');\n return fileContent;\n }\n\n // TODO #22198\n let newFileContent: string;\n if (upgrade.newName && upgrade.replacementApproach === 'alias') {\n newFileContent = replaceAsString(\n parsedContents,\n fileContent,\n depType as NpmDepType,\n depName,\n oldVersion!,\n `npm:${upgrade.newName}@${newValue}`,\n overrideDepParents,\n );\n } else {\n newFileContent = replaceAsString(\n parsedContents,\n fileContent,\n depType as NpmDepType,\n depName,\n oldVersion!,\n newValue!,\n overrideDepParents,\n );\n if (upgrade.newName && upgrade.newName !== depName) {\n newFileContent = replaceAsString(\n parsedContents,\n newFileContent,\n depType as NpmDepType,\n depName,\n depName,\n upgrade.newName,\n overrideDepParents,\n );\n }\n }\n /* v8 ignore next -- needs test */\n if (!newFileContent) {\n logger.debug(\n { fileContent, parsedContents, depType, depName, newValue },\n 'Warning: updateDependency error',\n );\n return fileContent;\n }\n\n if (parsedContents?.resolutions) {\n let depKey: string | undefined;\n if (parsedContents.resolutions[depName]) {\n depKey = depName;\n } else if (parsedContents.resolutions[`**/${depName}`]) {\n depKey = `**/${depName}`;\n }\n if (depKey) {\n /* v8 ignore next -- needs test */\n if (parsedContents.resolutions[depKey] !== oldVersion) {\n logger.debug(\n {\n depName,\n depKey,\n oldVersion,\n resolutionsVersion: parsedContents.resolutions[depKey],\n },\n 'Upgraded dependency exists in yarn resolutions but is different version',\n );\n }\n newFileContent = replaceAsString(\n parsedContents,\n newFileContent,\n 'resolutions',\n depKey,\n // TODO #22198\n parsedContents.resolutions[depKey]!,\n // TODO #22198\n newValue!,\n );\n if (upgrade.newName && upgrade.newName !== depName) {\n if (depKey === `**/${depName}`) {\n // handles the case where a replacement is in a resolution\n upgrade.newName = `**/${upgrade.newName}`;\n }\n newFileContent = replaceAsString(\n parsedContents,\n newFileContent,\n 'resolutions',\n depKey,\n depKey,\n upgrade.newName,\n );\n }\n }\n }\n if (parsedContents?.dependenciesMeta) {\n for (const [depKey] of Object.entries(parsedContents.dependenciesMeta)) {\n if (depKey.startsWith(`${depName}@`)) {\n newFileContent = replaceAsString(\n parsedContents,\n newFileContent,\n 'dependenciesMeta',\n depName,\n depKey,\n // TODO: types (#22198)\n `${depName}@${newValue}`,\n );\n }\n }\n }\n return newFileContent;\n } catch (err) {\n logger.debug({ err }, 'updateDependency error');\n return null;\n }\n}\n\nfunction overrideDepPosition(\n overrideBlock: OverrideDependency,\n parents: string[],\n depName: string,\n): {\n depObjectReference: Record<string, string>;\n overrideDepName: string;\n} {\n // get override dep position when its nested in an object\n const lastParent = parents.at(-1);\n let overrideDep: OverrideDependency = overrideBlock;\n for (const parent of parents) {\n // v8 ignore else -- TODO: add test #40625\n if (overrideDep) {\n overrideDep = overrideDep[parent] as Record<string, RecursiveOverride>;\n }\n }\n const overrideDepName = depName === lastParent ? '.' : depName;\n const depObjectReference = overrideDep as Record<string, string>;\n return { depObjectReference, overrideDepName };\n}\n\nfunction isOverrideObject(upgrade: Upgrade<NpmManagerData>): boolean {\n return (\n isArray(upgrade.managerData?.parents, isNonEmptyStringAndNotWhitespace) &&\n upgrade.depType === 'overrides'\n );\n}\n"],"mappings":";;;;;;;;;;AAkBA,SAAS,aACP,QACA,QACA,QACkB;CAElB,OADa,OAAO,KAAK,MACf,CAAC,CAAC,QAAQ,KAAK,QAAQ;EAC/B,IAAI,QAAQ,QACV,IAAI,UAAU,OAAO;OAErB,IAAI,OAAO,OAAO;EAEpB,OAAO;CACT,GAAG,CAAC,CAAqB;AAC3B;AAEA,SAAS,gBACP,gBACA,aACA,SAEA,SACA,UACA,UACA,SACQ;CACR,IAAI,YAAY,kBACd,eAAe,WAAW;MACrB,IAAI,YAAY,kBACrB,eAAe,KAAM,UAAW,WAAW;MACtC,IAAI,YAAY,UAErB,OAAO,OAAO,OAAO,eAAe,UAAW,GAC5C,WAAW,eAAe,QAAQ,CAAE,UACvC,CAAC,CAAC,CAAC;MACE,IAAI,YAAY,oBAEjB;;MAAA,aAAa,UACf,eAAe,mBAAmB,aAEhC,eAAe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QAAQ;;IAEV,IAAI,eAAe,YAAY,YAAY,YACzC,OAAO,MACL;KACE;KACA;KACA;KACA,oBAAoB,eAAe,YAAY;IACjD,GACA,yEACF;IAEF,iBAAiB,gBACf,gBACA,gBACA,eACA,QAEA,eAAe,YAAY,SAE3B,QACF;IACA,IAAI,QAAQ,WAAW,QAAQ,YAAY,SAAS;KAClD,IAAI,WAAW,MAAM,WAEnB,QAAQ,UAAU,MAAM,QAAQ;KAElC,iBAAiB,gBACf,gBACA,gBACA,eACA,QACA,QACA,QAAQ,OACV;IACF;GACF;EACF;EACA,IAAI,gBAAgB,kBACb;QAAA,MAAM,CAAC,WAAW,OAAO,QAAQ,eAAe,gBAAgB,GACnE,IAAI,OAAO,WAAW,GAAG,QAAQ,EAAE,GACjC,iBAAiB,gBACf,gBACA,gBACA,oBACA,SACA,QAEA,GAAG,QAAQ,GAAG,UAChB;EAAA;EAIN,OAAO;CACT,SAAS,KAAK;EACZ,OAAO,MAAM,EAAE,IAAI,GAAG,wBAAwB;EAC9C,OAAO;CACT;AACF;AAEA,SAAS,oBACP,eACA,SACA,SAIA;CAEA,MAAM,aAAa,QAAQ,GAAG,EAAE;CAChC,IAAI,cAAkC;CACtC,KAAK,MAAM,UAAU;;CAEnB,IAAI,aACF,cAAc,YAAY;CAK9B,OAAO;EAAE,oBAAA;EAAoB,iBAFL,YAAY,aAAa,MAAM;CAEV;AAC/C;AAEA,SAAS,iBAAiB,SAA2C;CACnE,OACE,QAAQ,QAAQ,aAAa,SAAS,gCAAgC,KACtE,QAAQ,YAAY;AAExB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../lib/modules/manager/npm/update/dependency/index.ts"],"sourcesContent":["import { isArray, isNonEmptyStringAndNotWhitespace } from '@sindresorhus/is';\nimport { dequal } from 'dequal';\nimport { logger } from '../../../../../logger/index.ts';\nimport { regEx } from '../../../../../util/regex.ts';\nimport { matchAt, replaceAt } from '../../../../../util/string.ts';\nimport type { UpdateDependencyConfig, Upgrade } from '../../../types.ts';\nimport { pnpmWorkspaceOverrides } from '../../dep-types.ts';\nimport type {\n DependenciesMeta,\n NpmPackage,\n OverrideDependency,\n RecursiveOverride,\n} from '../../extract/types.ts';\nimport type { NpmDepType, NpmManagerData } from '../../types.ts';\nimport { getNewGitValue, getNewNpmAliasValue } from './common.ts';\nimport { updatePnpmWorkspaceDependency } from './pnpm.ts';\nimport { updateYarnrcCatalogDependency } from './yarn.ts';\n\nfunction renameObjKey(\n oldObj: DependenciesMeta,\n oldKey: string,\n newKey: string,\n): DependenciesMeta {\n const keys = Object.keys(oldObj);\n return keys.reduce((acc, key) => {\n if (key === oldKey) {\n acc[newKey] = oldObj[oldKey];\n } else {\n acc[key] = oldObj[key];\n }\n return acc;\n }, {} as DependenciesMeta);\n}\n\nfunction replaceAsString(\n parsedContents: NpmPackage,\n fileContent: string,\n depType:\n NpmDepType | 'dependenciesMeta' | 'packageManager' | 'pnpm.overrides',\n depName: string,\n oldValue: string,\n newValue: string,\n parents?: string[],\n): string {\n if (depType === 'packageManager') {\n parsedContents[depType] = newValue;\n } else if (depType === 'pnpm.overrides') {\n parsedContents.pnpm!.overrides![depName] = newValue;\n } else if (depName === oldValue) {\n // The old value is the name of the dependency itself\n delete Object.assign(parsedContents[depType]!, {\n [newValue]: parsedContents[depType]![oldValue],\n })[oldValue];\n } else if (depType === 'dependenciesMeta') {\n // v8 ignore else -- TODO: add test #40625\n if (oldValue !== newValue) {\n parsedContents.dependenciesMeta = renameObjKey(\n // TODO #22198\n parsedContents.dependenciesMeta!,\n oldValue,\n newValue,\n );\n }\n } else if (parents && depType === 'overrides') {\n // there is an object as a value in overrides block\n const { depObjectReference, overrideDepName } = overrideDepPosition(\n parsedContents[depType]!,\n parents,\n depName,\n );\n // v8 ignore else -- TODO: add test #40625\n if (depObjectReference) {\n depObjectReference[overrideDepName] = newValue;\n }\n } else {\n // The old value is the version of the dependency\n parsedContents[depType]![depName] = newValue;\n }\n // Look for the old version number\n const searchString = `\"${oldValue}\"`;\n let newString = `\"${newValue}\"`;\n\n const escapedDepName = RegExp.escape(depName);\n const patchRe = regEx(`^(patch:${escapedDepName}@(npm:)?).*#`);\n const match = patchRe.exec(oldValue);\n if (match && depType === 'resolutions') {\n const patch = oldValue.replace(match[0], `${match[1]}${newValue}#`);\n parsedContents[depType]![depName] = patch;\n newString = `\"${patch}\"`;\n }\n\n // Skip ahead to depType section\n let searchIndex = fileContent.indexOf(`\"${depType}\"`) + depType.length;\n logger.trace(`Starting search at index ${searchIndex}`);\n // Iterate through the rest of the file\n for (; searchIndex < fileContent.length; searchIndex += 1) {\n // First check if we have a hit for the old version\n if (matchAt(fileContent, searchIndex, searchString)) {\n logger.trace(`Found match at index ${searchIndex}`);\n // Now test if the result matches\n const testContent = replaceAt(\n fileContent,\n searchIndex,\n searchString,\n newString,\n );\n // Compare the parsed JSON structure of old and new\n if (dequal(parsedContents, JSON.parse(testContent))) {\n return testContent;\n }\n }\n }\n // v8 ignore next -- TODO: add test #40625\n throw new Error();\n}\n\nfunction updateDevEnginesDependency({\n fileContent,\n upgrade,\n}: Pick<UpdateDependencyConfig, 'fileContent' | 'upgrade'>): string | null {\n const { depType, depName, newValue, managerData } = upgrade;\n /* v8 ignore if -- defensive: dispatcher already filtered */\n if (\n !depName ||\n !newValue ||\n (depType !== 'devEngines.runtime' &&\n depType !== 'devEngines.packageManager')\n ) {\n return null;\n }\n const subKey: 'runtime' | 'packageManager' =\n depType === 'devEngines.runtime' ? 'runtime' : 'packageManager';\n try {\n const parsedContents: NpmPackage = JSON.parse(fileContent);\n const block = parsedContents.devEngines?.[subKey];\n if (!block) {\n logger.warn(\n { depName, depType },\n 'No devEngines block found; this is likely an extraction error.',\n );\n return null;\n }\n let oldVersion: string | undefined;\n if (isArray(block)) {\n const idx = managerData?.devEnginesIndex;\n if (typeof idx !== 'number') {\n logger.warn(\n { depName, depType },\n 'No devEngines index found; this is likely an extraction error.',\n );\n return null;\n }\n const item = block[idx];\n if (!item || item.name !== depName) {\n logger.warn(\n {\n actualName: item?.name,\n depName,\n depType,\n devEnginesIndex: idx,\n },\n 'No matching devEngines dependency found; this is likely an extraction error.',\n );\n return null;\n }\n oldVersion = item.version;\n item.version = newValue;\n } else {\n if (block.name !== depName) {\n logger.warn(\n { actualName: block.name, depName, depType },\n 'No matching devEngines dependency found; this is likely an extraction error.',\n );\n return null;\n }\n oldVersion = block.version;\n block.version = newValue;\n }\n /* v8 ignore if -- defensive: extract filters out version-less items */\n if (oldVersion === undefined) {\n return null;\n }\n if (oldVersion === newValue) {\n return fileContent;\n }\n const searchString = JSON.stringify(oldVersion);\n const newString = JSON.stringify(newValue);\n const anchor = '\"devEngines\"';\n let searchIndex = fileContent.indexOf(anchor);\n /* v8 ignore if -- defensive: extract verified devEngines presence */\n if (searchIndex === -1) {\n return null;\n }\n searchIndex += anchor.length;\n for (; searchIndex < fileContent.length; searchIndex += 1) {\n if (matchAt(fileContent, searchIndex, searchString)) {\n const testContent = replaceAt(\n fileContent,\n searchIndex,\n searchString,\n newString,\n );\n if (dequal(parsedContents, JSON.parse(testContent))) {\n return testContent;\n }\n }\n }\n /* v8 ignore next -- defensive: oldVersion guaranteed to appear in JSON */\n return null;\n } catch (err) {\n logger.warn({ err }, 'updateDevEnginesDependency error');\n return null;\n }\n}\n\nexport function updateDependency({\n fileContent,\n packageFile: packageFileName,\n upgrade,\n}: UpdateDependencyConfig): string | null {\n if (\n upgrade.depType?.startsWith('pnpm.catalog') ||\n upgrade.depType === pnpmWorkspaceOverrides\n ) {\n return updatePnpmWorkspaceDependency({\n fileContent,\n packageFile: packageFileName,\n upgrade,\n });\n }\n if (upgrade.depType?.startsWith('yarn.catalog')) {\n return updateYarnrcCatalogDependency({\n fileContent,\n packageFile: packageFileName,\n upgrade,\n });\n }\n if (\n upgrade.depType === 'devEngines.runtime' ||\n upgrade.depType === 'devEngines.packageManager'\n ) {\n return updateDevEnginesDependency({ fileContent, upgrade });\n }\n\n const { depType, managerData } = upgrade;\n const depName: string = managerData?.key ?? upgrade.depName;\n let { newValue } = upgrade;\n\n newValue = getNewGitValue(upgrade) ?? newValue;\n newValue = getNewNpmAliasValue(newValue, upgrade) ?? newValue;\n\n logger.debug(`npm.updateDependency(): ${depType}.${depName} = ${newValue}`);\n try {\n const parsedContents: NpmPackage = JSON.parse(fileContent);\n let overrideDepParents: string[] | undefined = undefined;\n // Save the old version\n let oldVersion: string | undefined;\n if (depType === 'packageManager') {\n oldVersion = parsedContents[depType];\n newValue = `${depName}@${newValue}`;\n } else if (isOverrideObject(upgrade)) {\n overrideDepParents = managerData?.parents;\n // v8 ignore else -- TODO: add test #40625\n if (overrideDepParents) {\n // old version when there is an object as a value in overrides block\n const { depObjectReference, overrideDepName } = overrideDepPosition(\n parsedContents.overrides!,\n overrideDepParents,\n depName,\n );\n // v8 ignore else -- TODO: add test #40625\n if (depObjectReference) {\n oldVersion = depObjectReference[overrideDepName]!;\n }\n }\n } else if (depType === 'pnpm.overrides') {\n oldVersion = parsedContents.pnpm?.overrides?.[depName];\n } else {\n oldVersion = parsedContents[depType as NpmDepType]![depName] as string;\n }\n if (\n oldVersion === newValue &&\n (!upgrade.newName || upgrade.newName === depName)\n ) {\n logger.trace('Version is already updated');\n return fileContent;\n }\n\n // TODO #22198\n let newFileContent: string;\n if (upgrade.newName && upgrade.replacementApproach === 'alias') {\n newFileContent = replaceAsString(\n parsedContents,\n fileContent,\n depType as NpmDepType,\n depName,\n oldVersion!,\n `npm:${upgrade.newName}@${newValue}`,\n overrideDepParents,\n );\n } else {\n newFileContent = replaceAsString(\n parsedContents,\n fileContent,\n depType as NpmDepType,\n depName,\n oldVersion!,\n newValue!,\n overrideDepParents,\n );\n if (upgrade.newName && upgrade.newName !== depName) {\n newFileContent = replaceAsString(\n parsedContents,\n newFileContent,\n depType as NpmDepType,\n depName,\n depName,\n upgrade.newName,\n overrideDepParents,\n );\n }\n }\n /* v8 ignore next -- needs test */\n if (!newFileContent) {\n logger.debug(\n { fileContent, parsedContents, depType, depName, newValue },\n 'Warning: updateDependency error',\n );\n return fileContent;\n }\n\n if (parsedContents?.resolutions) {\n let depKey: string | undefined;\n if (parsedContents.resolutions[depName]) {\n depKey = depName;\n } else if (parsedContents.resolutions[`**/${depName}`]) {\n depKey = `**/${depName}`;\n }\n if (depKey) {\n /* v8 ignore next -- needs test */\n if (parsedContents.resolutions[depKey] !== oldVersion) {\n logger.debug(\n {\n depName,\n depKey,\n oldVersion,\n resolutionsVersion: parsedContents.resolutions[depKey],\n },\n 'Upgraded dependency exists in yarn resolutions but is different version',\n );\n }\n newFileContent = replaceAsString(\n parsedContents,\n newFileContent,\n 'resolutions',\n depKey,\n // TODO #22198\n parsedContents.resolutions[depKey]!,\n // TODO #22198\n newValue!,\n );\n if (upgrade.newName && upgrade.newName !== depName) {\n if (depKey === `**/${depName}`) {\n // handles the case where a replacement is in a resolution\n upgrade.newName = `**/${upgrade.newName}`;\n }\n newFileContent = replaceAsString(\n parsedContents,\n newFileContent,\n 'resolutions',\n depKey,\n depKey,\n upgrade.newName,\n );\n }\n }\n }\n if (parsedContents?.dependenciesMeta) {\n for (const [depKey] of Object.entries(parsedContents.dependenciesMeta)) {\n if (depKey.startsWith(`${depName}@`)) {\n newFileContent = replaceAsString(\n parsedContents,\n newFileContent,\n 'dependenciesMeta',\n depName,\n depKey,\n // TODO: types (#22198)\n `${depName}@${newValue}`,\n );\n }\n }\n }\n return newFileContent;\n } catch (err) {\n logger.debug({ err }, 'updateDependency error');\n return null;\n }\n}\n\nfunction overrideDepPosition(\n overrideBlock: OverrideDependency,\n parents: string[],\n depName: string,\n): {\n depObjectReference: Record<string, string>;\n overrideDepName: string;\n} {\n // get override dep position when its nested in an object\n const lastParent = parents.at(-1);\n let overrideDep: OverrideDependency = overrideBlock;\n for (const parent of parents) {\n // v8 ignore else -- TODO: add test #40625\n if (overrideDep) {\n overrideDep = overrideDep[parent] as Record<string, RecursiveOverride>;\n }\n }\n const overrideDepName = depName === lastParent ? '.' : depName;\n const depObjectReference = overrideDep as Record<string, string>;\n return { depObjectReference, overrideDepName };\n}\n\nfunction isOverrideObject(upgrade: Upgrade<NpmManagerData>): boolean {\n return (\n isArray(upgrade.managerData?.parents, isNonEmptyStringAndNotWhitespace) &&\n upgrade.depType === 'overrides'\n );\n}\n"],"mappings":";;;;;;;;;;AAkBA,SAAS,aACP,QACA,QACA,QACkB;CAElB,OADa,OAAO,KAAK,MACf,CAAC,CAAC,QAAQ,KAAK,QAAQ;EAC/B,IAAI,QAAQ,QACV,IAAI,UAAU,OAAO;OAErB,IAAI,OAAO,OAAO;EAEpB,OAAO;CACT,GAAG,CAAC,CAAqB;AAC3B;AAEA,SAAS,gBACP,gBACA,aACA,SAEA,SACA,UACA,UACA,SACQ;CACR,IAAI,YAAY,kBACd,eAAe,WAAW;MACrB,IAAI,YAAY,kBACrB,eAAe,KAAM,UAAW,WAAW;MACtC,IAAI,YAAY,UAErB,OAAO,OAAO,OAAO,eAAe,UAAW,GAC5C,WAAW,eAAe,QAAQ,CAAE,UACvC,CAAC,CAAC,CAAC;MACE,IAAI,YAAY,oBAEjB;;MAAA,aAAa,UACf,eAAe,mBAAmB,aAEhC,eAAe,kBACf,UACA,QACF;CAAA,OAEG,IAAI,WAAW,YAAY,aAAa;EAE7C,MAAM,EAAE,oBAAoB,oBAAoB,oBAC9C,eAAe,UACf,SACA,OACF;;EAEA,IAAI,oBACF,mBAAmB,mBAAmB;CAE1C,OAEE,eAAe,QAAQ,CAAE,WAAW;CAGtC,MAAM,eAAe,IAAI,SAAS;CAClC,IAAI,YAAY,IAAI,SAAS;CAE7B,MAAM,iBAAiB,OAAO,OAAO,OAAO;CAE5C,MAAM,QADU,MAAM,WAAW,eAAe,aAC5B,CAAC,CAAC,KAAK,QAAQ;CACnC,IAAI,SAAS,YAAY,eAAe;EACtC,MAAM,QAAQ,SAAS,QAAQ,MAAM,IAAI,GAAG,MAAM,KAAK,SAAS,EAAE;EAClE,eAAe,QAAQ,CAAE,WAAW;EACpC,YAAY,IAAI,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AM,QAAQ;KAElC,iBAAiB,gBACf,gBACA,gBACA,eACA,QACA,QACA,QAAQ,OACV;IACF;GACF;EACF;EACA,IAAI,gBAAgB,kBACb;QAAA,MAAM,CAAC,WAAW,OAAO,QAAQ,eAAe,gBAAgB,GACnE,IAAI,OAAO,WAAW,GAAG,QAAQ,EAAE,GACjC,iBAAiB,gBACf,gBACA,gBACA,oBACA,SACA,QAEA,GAAG,QAAQ,GAAG,UAChB;EAAA;EAIN,OAAO;CACT,SAAS,KAAK;EACZ,OAAO,MAAM,EAAE,IAAI,GAAG,wBAAwB;EAC9C,OAAO;CACT;AACF;AAEA,SAAS,oBACP,eACA,SACA,SAIA;CAEA,MAAM,aAAa,QAAQ,GAAG,EAAE;CAChC,IAAI,cAAkC;CACtC,KAAK,MAAM,UAAU;;CAEnB,IAAI,aACF,cAAc,YAAY;CAK9B,OAAO;EAAE,oBAAA;EAAoB,iBAFL,YAAY,aAAa,MAAM;CAEV;AAC/C;AAEA,SAAS,iBAAiB,SAA2C;CACnE,OACE,QAAQ,QAAQ,aAAa,SAAS,gCAAgC,KACtE,QAAQ,YAAY;AAExB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logger } from "../../../../../logger/index.js";
|
|
2
|
-
import { PnpmWorkspaceFile } from "../../schema.js";
|
|
3
2
|
import "../../dep-types.js";
|
|
4
3
|
import { getNewGitValue, getNewNpmAliasValue } from "./common.js";
|
|
4
|
+
import { PnpmWorkspaceFile } from "../../schema.js";
|
|
5
5
|
import { isString } from "@sindresorhus/is";
|
|
6
6
|
import { CST, isCollection, isPair, isScalar, parseDocument } from "yaml";
|
|
7
7
|
//#region lib/modules/manager/npm/update/dependency/pnpm.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { logger } from "../../../../../logger/index.js";
|
|
2
|
-
import { YarnConfig } from "../../schema.js";
|
|
3
2
|
import { getNewGitValue, getNewNpmAliasValue } from "./common.js";
|
|
3
|
+
import { YarnConfig } from "../../schema.js";
|
|
4
4
|
import { isObject, isString } from "@sindresorhus/is";
|
|
5
5
|
import { CST, isCollection, isPair, isScalar, parseDocument } from "yaml";
|
|
6
6
|
//#region lib/modules/manager/npm/update/dependency/yarn.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "renovate",
|
|
3
3
|
"description": "Automated dependency updates. Flexible so you don't need to be.",
|
|
4
|
-
"version": "44.
|
|
4
|
+
"version": "44.128.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"renovate": "dist/renovate.js",
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
"zod": "4.6.5"
|
|
213
213
|
},
|
|
214
214
|
"optionalDependencies": {
|
|
215
|
-
"openpgp": "6.3.
|
|
215
|
+
"openpgp": "6.3.2",
|
|
216
216
|
"re2": "1.26.1"
|
|
217
217
|
},
|
|
218
218
|
"devDependencies": {
|
package/renovate-schema.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$id": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
-
"title": "JSON schema for Renovate 44.
|
|
3
|
+
"title": "JSON schema for Renovate 44.128.1 config files (https://renovatebot.com/)",
|
|
4
4
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
-
"x-renovate-version": "44.
|
|
5
|
+
"x-renovate-version": "44.128.1",
|
|
6
6
|
"allowComments": true,
|
|
7
7
|
"type": "object",
|
|
8
8
|
"definitions": {
|