renovate 44.88.0 → 44.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"update-locked.js","names":["lockfile.getLockedVersion"],"sources":["../../../../lib/modules/manager/mise/update-locked.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport type { UpdateLockedConfig, UpdateLockedResult } from '../types.ts';\nimport * as lockfile from './lockfile.ts';\nimport { MiseLockFile } from './schema.ts';\n\nexport function updateLockedDependency(\n config: UpdateLockedConfig,\n): UpdateLockedResult {\n const { depName, newVersion, lockFile, lockFileContent } = config;\n logger.debug(\n `mise.updateLockedDependency: ${depName} -> ${newVersion} [${lockFile}]`,\n );\n\n if (!depName || !lockFileContent) {\n return { status: 'unsupported' };\n }\n\n try {\n const parsed = MiseLockFile.safeParse(lockFileContent);\n if (!parsed.success) {\n return { status: 'unsupported' };\n }\n\n if (lockfile.getLockedVersion(parsed.data, depName) === newVersion) {\n return { status: 'already-updated' };\n }\n\n return { status: 'unsupported' };\n } catch (err) {\n logger.debug({ err }, 'mise.updateLockedDependency() error');\n return { status: 'update-failed' };\n }\n}\n"],"mappings":";;;;AAKA,SAAgB,uBACd,QACoB;CACpB,MAAM,EAAE,SAAS,YAAY,UAAU,oBAAoB;CAC3D,OAAO,MACL,gCAAgC,QAAQ,MAAM,WAAW,IAAI,SAAS,EACxE;CAEA,IAAI,CAAC,WAAW,CAAC,iBACf,OAAO,EAAE,QAAQ,cAAc;CAGjC,IAAI;EACF,MAAM,SAAS,aAAa,UAAU,eAAe;EACrD,IAAI,CAAC,OAAO,SACV,OAAO,EAAE,QAAQ,cAAc;EAGjC,IAAIA,iBAA0B,OAAO,MAAM,OAAO,MAAM,YACtD,OAAO,EAAE,QAAQ,kBAAkB;EAGrC,OAAO,EAAE,QAAQ,cAAc;CACjC,SAAS,KAAK;EACZ,OAAO,MAAM,EAAE,IAAI,GAAG,qCAAqC;EAC3D,OAAO,EAAE,QAAQ,gBAAgB;CACnC;AACF"}
1
+ {"version":3,"file":"update-locked.js","names":["lockfile.getLockedTool"],"sources":["../../../../lib/modules/manager/mise/update-locked.ts"],"sourcesContent":["import { isNullOrUndefined } from '@sindresorhus/is';\nimport type { AST } from 'toml-eslint-parser';\nimport { logger } from '../../../logger/index.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { safeStringify } from '../../../util/stringify.ts';\nimport { parseTOMLDocument } from '../../../util/toml.ts';\nimport type { UpdateLockedConfig, UpdateLockedResult } from '../types.ts';\nimport * as lockfile from './lockfile.ts';\nimport { MiseLockFile } from './schema.ts';\n\nconst versionPrefixRegex = regEx(/^(?<prefix>[^\\d]*)\\d/);\n\nfunction getToolName(depName: string, lockFileData: MiseLockFile): string {\n if (lockFileData.tools[depName]) {\n return depName;\n }\n\n const delimiterIndex = depName.indexOf(':');\n if (delimiterIndex !== -1) {\n const shortName = depName.substring(delimiterIndex + 1);\n if (lockFileData.tools[shortName]) {\n return shortName;\n }\n }\n\n return '';\n}\n\nfunction formatLockedVersion(\n currentVersion: string,\n newVersion: string,\n): string {\n const currentPrefix =\n versionPrefixRegex.exec(currentVersion)?.groups?.prefix ?? '';\n const newPrefix = versionPrefixRegex.exec(newVersion)?.groups?.prefix;\n if (newPrefix !== undefined) {\n return `${currentPrefix}${newVersion.slice(newPrefix.length)}`;\n }\n return newVersion;\n}\n\nfunction getVersionKeyValue(key: AST.TOMLKey): string | undefined {\n if (key.keys.length !== 1) {\n return undefined;\n }\n\n const [part] = key.keys;\n return part.type === 'TOMLBare' ? part.name : part.value;\n}\n\nfunction getVersionValueNode(\n content: string,\n depName: string,\n lockFileData: MiseLockFile,\n currentVersion: string,\n newVersion: string,\n): { currentLockedVersion: string; versionNode: AST.TOMLValue } | undefined {\n const toolName = getToolName(depName, lockFileData);\n const lockedTools = lockfile.getLockedTool(lockFileData, depName);\n if (!toolName || !lockedTools?.length) {\n return undefined;\n }\n\n const toolIndex =\n lockedTools.length === 1\n ? 0\n : lockedTools.findIndex(\n ({ version }) =>\n version === currentVersion ||\n formatLockedVersion(version, currentVersion) === version ||\n version === newVersion ||\n formatLockedVersion(version, newVersion) === version,\n );\n if (toolIndex === -1) {\n return undefined;\n }\n\n const table = astTableForTool(content, toolName, toolIndex);\n const versionKeyValue = table?.body.find(\n (keyValue) => getVersionKeyValue(keyValue.key) === 'version',\n );\n if (versionKeyValue?.value.type !== 'TOMLValue') {\n return undefined;\n }\n return {\n currentLockedVersion: lockedTools[toolIndex].version,\n versionNode: versionKeyValue.value,\n };\n}\n\nfunction astTableForTool(\n content: string,\n toolName: string,\n toolIndex: number,\n): AST.TOMLTable | undefined {\n const ast = parseTOMLDocument(content);\n return ast.body[0]?.body.find(\n (node): node is AST.TOMLTable =>\n node.type === 'TOMLTable' &&\n node.kind === 'array' &&\n node.resolvedKey.length === 3 &&\n node.resolvedKey[0] === 'tools' &&\n node.resolvedKey[1] === toolName &&\n node.resolvedKey[2] === toolIndex,\n );\n}\n\nexport function updateLockedDependency(\n config: UpdateLockedConfig,\n): UpdateLockedResult {\n const { depName, newVersion, lockFile, lockFileContent } = config;\n logger.debug(\n `mise.updateLockedDependency: ${depName} -> ${newVersion} [${lockFile}]`,\n );\n\n if (!depName || !lockFileContent) {\n return { status: 'unsupported' };\n }\n\n try {\n const parsed = MiseLockFile.safeParse(lockFileContent);\n if (!parsed.success) {\n return { status: 'unsupported' };\n }\n\n const lockedVersion = getVersionValueNode(\n lockFileContent,\n depName,\n parsed.data,\n config.currentVersion,\n newVersion,\n );\n if (!lockedVersion) {\n return { status: 'unsupported' };\n }\n const { currentLockedVersion: currentVersionValue, versionNode } =\n lockedVersion;\n\n const currentLockedVersion = lockFileContent.slice(\n versionNode.range[0],\n versionNode.range[1],\n );\n const updatedVersion = formatLockedVersion(currentVersionValue, newVersion);\n if (currentVersionValue === updatedVersion) {\n return { status: 'already-updated' };\n }\n\n const quote = currentLockedVersion.startsWith(\"'\") ? \"'\" : '\"';\n const replacement =\n quote === \"'\" ? `'${updatedVersion}'` : safeStringify(updatedVersion);\n const files = {\n [lockFile]:\n lockFileContent.slice(0, versionNode.range[0]) +\n replacement +\n lockFileContent.slice(versionNode.range[1]),\n };\n if (!isNullOrUndefined(config.packageFileContent)) {\n // Keep the package file in the update set so mise's artifact refresh runs\n // for selector lockfile updates and regenerates platform metadata.\n files[config.packageFile] = config.packageFileContent;\n }\n return { status: 'updated', files };\n } catch (err) {\n logger.debug({ err }, 'mise.updateLockedDependency() error');\n return { status: 'update-failed' };\n }\n}\n"],"mappings":";;;;;;;;AAUA,MAAM,qBAAqB,MAAM,sBAAsB;AAEvD,SAAS,YAAY,SAAiB,cAAoC;CACxE,IAAI,aAAa,MAAM,UACrB,OAAO;CAGT,MAAM,iBAAiB,QAAQ,QAAQ,GAAG;CAC1C,IAAI,mBAAmB,IAAI;EACzB,MAAM,YAAY,QAAQ,UAAU,iBAAiB,CAAC;EACtD,IAAI,aAAa,MAAM,YACrB,OAAO;CAEX;CAEA,OAAO;AACT;AAEA,SAAS,oBACP,gBACA,YACQ;CACR,MAAM,gBACJ,mBAAmB,KAAK,cAAc,CAAC,EAAE,QAAQ,UAAU;CAC7D,MAAM,YAAY,mBAAmB,KAAK,UAAU,CAAC,EAAE,QAAQ;CAC/D,IAAI,cAAc,KAAA,GAChB,OAAO,GAAG,gBAAgB,WAAW,MAAM,UAAU,MAAM;CAE7D,OAAO;AACT;AAEA,SAAS,mBAAmB,KAAsC;CAChE,IAAI,IAAI,KAAK,WAAW,GACtB;CAGF,MAAM,CAAC,QAAQ,IAAI;CACnB,OAAO,KAAK,SAAS,aAAa,KAAK,OAAO,KAAK;AACrD;AAEA,SAAS,oBACP,SACA,SACA,cACA,gBACA,YAC0E;CAC1E,MAAM,WAAW,YAAY,SAAS,YAAY;CAClD,MAAM,cAAcA,cAAuB,cAAc,OAAO;CAChE,IAAI,CAAC,YAAY,CAAC,aAAa,QAC7B;CAGF,MAAM,YACJ,YAAY,WAAW,IACnB,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B;EAIrC,MAAM,eADQ,qBAAqB,WAAW,GAAG,IAAI,MAAM,UAE/C,MAAM,IAAI,eAAe,KAAK,cAAc,cAAc;EACtE,MAAM,QAAQ,GACX,WACC,gBAAgB,MAAM,GAAG,YAAY,MAAM,EAAE,IAC7C,cACA,gBAAgB,MAAM,YAAY,MAAM,EAAE,EAC9C;EACA,IAAI,CAAC,kBAAkB,OAAO,kBAAkB,GAG9C,MAAM,OAAO,eAAe,OAAO;EAErC,OAAO;GAAE,QAAQ;GAAW;EAAM;CACpC,SAAS,KAAK;EACZ,OAAO,MAAM,EAAE,IAAI,GAAG,qCAAqC;EAC3D,OAAO,EAAE,QAAQ,gBAAgB;CACnC;AACF"}
@@ -165,6 +165,17 @@ interface PackageDependency<T = Record<string, any>, DepType extends string = st
165
165
  sourceUrl?: string | null;
166
166
  pinDigests?: boolean;
167
167
  currentRawValue?: string;
168
+ /**
169
+ * Restrict extracted dependencies to a version range.
170
+ *
171
+ * Managers can use this for native selectors which are not Renovate
172
+ * version ranges but still describe a set of compatible versions.
173
+ */
174
+ allowedVersions?: string;
175
+ /** Whether unstable releases should be excluded from update candidates. */
176
+ ignoreUnstable?: boolean;
177
+ /** True when the dependency should only be updated in the lockfile, and the source file should remain untouched. */
178
+ isLockfileOnly?: boolean;
168
179
  major?: {
169
180
  enabled?: boolean;
170
181
  };
@@ -265,6 +276,8 @@ interface UpdateArtifact<T = Record<string, unknown>> {
265
276
  packageFileName: string;
266
277
  updatedDeps: Upgrade<T>[];
267
278
  newPackageFileContent: string;
279
+ /** Updated lockfile content that is not yet present on disk. */
280
+ newLockFileContent?: string;
268
281
  config: UpdateArtifactsConfig;
269
282
  }
270
283
  interface UpdateDependencyConfig<T = Record<string, any>> {
package/dist/util/toml.js CHANGED
@@ -2,14 +2,16 @@ import { regEx } from "./regex.js";
2
2
  import { stripTemplates } from "./string.js";
3
3
  import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
4
4
  //#region lib/util/toml.ts
5
+ function parseTOMLDocument(input) {
6
+ return parseTOML(input, { tomlVersion: "1.1" });
7
+ }
5
8
  function parse(input) {
6
- const ast = parseTOML(input, { tomlVersion: "1.1" });
7
- return getStaticTOMLValue(ast);
9
+ return getStaticTOMLValue(parseTOMLDocument(input));
8
10
  }
9
11
  function massage(input) {
10
12
  return stripTemplates(input.replace(regEx(/^\s*{{.+?}}\s*=.*$/gm), ""));
11
13
  }
12
14
  //#endregion
13
- export { massage, parse };
15
+ export { massage, parse, parseTOMLDocument };
14
16
 
15
17
  //# sourceMappingURL=toml.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toml.js","names":[],"sources":["../../lib/util/toml.ts"],"sourcesContent":["import { getStaticTOMLValue, parseTOML } from 'toml-eslint-parser';\nimport { regEx } from './regex.ts';\nimport { stripTemplates } from './string.ts';\n\nexport function parse(input: string): unknown {\n const ast = parseTOML(input, { tomlVersion: '1.1' });\n return getStaticTOMLValue(ast);\n}\n\nexport function massage(input: string): string {\n return stripTemplates(input.replace(regEx(/^\\s*{{.+?}}\\s*=.*$/gm), ''));\n}\n"],"mappings":";;;;AAIA,SAAgB,MAAM,OAAwB;CAC5C,MAAM,MAAM,UAAU,OAAO,EAAE,aAAa,MAAM,CAAC;CACnD,OAAO,mBAAmB,GAAG;AAC/B;AAEA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,eAAe,MAAM,QAAQ,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACxE"}
1
+ {"version":3,"file":"toml.js","names":[],"sources":["../../lib/util/toml.ts"],"sourcesContent":["import { type AST, getStaticTOMLValue, parseTOML } from 'toml-eslint-parser';\nimport { regEx } from './regex.ts';\nimport { stripTemplates } from './string.ts';\n\nexport function parseTOMLDocument(input: string): AST.TOMLProgram {\n return parseTOML(input, { tomlVersion: '1.1' });\n}\n\nexport function parse(input: string): unknown {\n return getStaticTOMLValue(parseTOMLDocument(input));\n}\n\nexport function massage(input: string): string {\n return stripTemplates(input.replace(regEx(/^\\s*{{.+?}}\\s*=.*$/gm), ''));\n}\n"],"mappings":";;;;AAIA,SAAgB,kBAAkB,OAAgC;CAChE,OAAO,UAAU,OAAO,EAAE,aAAa,MAAM,CAAC;AAChD;AAEA,SAAgB,MAAM,OAAwB;CAC5C,OAAO,mBAAmB,kBAAkB,KAAK,CAAC;AACpD;AAEA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,eAAe,MAAM,QAAQ,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACxE"}
@@ -27,7 +27,8 @@ async function generateUpdate(config, currentValue, versioningApi, rangeStrategy
27
27
  */
28
28
  update.registryUrl = release.registryUrl;
29
29
  if (currentValue) try {
30
- update.newValue = versioningApi.getNewValue({
30
+ if (config.isLockfileOnly) update.newValue = currentValue;
31
+ else update.newValue = versioningApi.getNewValue({
31
32
  currentValue,
32
33
  rangeStrategy,
33
34
  currentVersion,
@@ -59,7 +60,7 @@ async function generateUpdate(config, currentValue, versioningApi, rangeStrategy
59
60
  const { datasource, packageName, packageRules } = config;
60
61
  if (packageRules?.some((pr) => isNonEmptyArray(pr.matchConfidence))) update.mergeConfidenceLevel = await getMergeConfidenceLevel(datasource, packageName, currentVersion, newVersion, update.updateType);
61
62
  if (!versioningApi.isVersion(update.newValue)) update.isRange = true;
62
- if (rangeStrategy === "update-lockfile" && currentValue === update.newValue) update.isLockfileUpdate = true;
63
+ if ((config.isLockfileOnly || rangeStrategy === "update-lockfile") && currentValue === update.newValue) update.isLockfileUpdate = true;
63
64
  if (rangeStrategy === "bump" && versioningApi.matches(newVersion, currentValue)) update.isBump = true;
64
65
  return update;
65
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","names":[],"sources":["../../../../../lib/workers/repository/process/lookup/generate.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport { logger } from '../../../../logger/index.ts';\nimport type { Release } from '../../../../modules/datasource/index.ts';\nimport type { LookupUpdate } from '../../../../modules/manager/types.ts';\nimport type { VersioningApi } from '../../../../modules/versioning/index.ts';\nimport type { RangeStrategy } from '../../../../types/index.ts';\nimport { getElapsedDays } from '../../../../util/date.ts';\nimport { getMergeConfidenceLevel } from '../../../../util/merge-confidence/index.ts';\nimport type { LookupUpdateConfig } from './types.ts';\nimport { getUpdateType } from './update-type.ts';\n\nexport async function generateUpdate(\n config: LookupUpdateConfig,\n currentValue: string | undefined,\n versioningApi: VersioningApi,\n rangeStrategy: RangeStrategy,\n currentVersion: string,\n bucket: string,\n release: Release,\n allVersions: Set<string>,\n): Promise<LookupUpdate> {\n const newVersion = release.version;\n const update: LookupUpdate = {\n bucket,\n newVersion,\n newValue: null!,\n hasAttestation: release.attestation,\n };\n\n if (release.checksumUrl !== undefined) {\n update.checksumUrl = release.checksumUrl;\n }\n if (release.downloadUrl !== undefined) {\n update.downloadUrl = release.downloadUrl;\n }\n if (release.newDigest !== undefined) {\n update.newDigest = release.newDigest;\n }\n if (release.releaseTimestamp) {\n update.releaseTimestamp = release.releaseTimestamp;\n update.newVersionAgeInDays = getElapsedDays(release.releaseTimestamp);\n }\n if (release.registryUrl !== undefined) {\n /**\n * This means:\n * - registry strategy is set to merge\n * - releases were fetched from multiple registry urls\n */\n update.registryUrl = release.registryUrl;\n }\n\n if (currentValue) {\n try {\n update.newValue = versioningApi.getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n allVersions,\n })!;\n } catch (err) {\n logger.warn(\n { err, currentValue, rangeStrategy, currentVersion, newVersion },\n 'getNewValue error',\n );\n update.newValue = currentValue;\n }\n } else {\n update.newValue = currentValue;\n }\n update.newMajor = versioningApi.getMajor(newVersion)!;\n update.newMinor = versioningApi.getMinor(newVersion)!;\n update.newPatch = versioningApi.getPatch(newVersion)!;\n if (!update.updateType && !currentVersion) {\n logger.debug({ update }, 'Update has no currentVersion');\n update.newValue = currentValue!;\n return update;\n }\n update.updateType =\n update.updateType ??\n getUpdateType(config, versioningApi, currentVersion, newVersion);\n if (versioningApi.isBreaking) {\n // This versioning scheme has breaking awareness\n update.isBreaking = versioningApi.isBreaking(currentVersion, newVersion);\n } else {\n // This versioning scheme does not have breaking awareness - assume only major updates are breaking\n // Updates from, or to, unstable releases should be treated as breaking too.\n // But we should not add that as default behavior until we stop treating non-LTS versions as unstable first\n update.isBreaking = update.updateType === 'major';\n }\n const { datasource, packageName, packageRules } = config;\n if (packageRules?.some((pr) => isNonEmptyArray(pr.matchConfidence))) {\n update.mergeConfidenceLevel = await getMergeConfidenceLevel(\n datasource,\n packageName,\n currentVersion,\n newVersion,\n update.updateType,\n );\n }\n if (!versioningApi.isVersion(update.newValue)) {\n update.isRange = true;\n }\n if (rangeStrategy === 'update-lockfile' && currentValue === update.newValue) {\n update.isLockfileUpdate = true;\n }\n if (\n rangeStrategy === 'bump' &&\n // TODO #22198\n versioningApi.matches(newVersion, currentValue!)\n ) {\n update.isBump = true;\n }\n return update;\n}\n"],"mappings":";;;;;;AAWA,eAAsB,eACpB,QACA,cACA,eACA,eACA,gBACA,QACA,SACA,aACuB;CACvB,MAAM,aAAa,QAAQ;CAC3B,MAAM,SAAuB;EAC3B;EACA;EACA,UAAU;EACV,gBAAgB,QAAQ;CAC1B;CAEA,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,OAAO,cAAc,QAAQ;CAE/B,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,OAAO,cAAc,QAAQ;CAE/B,IAAI,QAAQ,cAAc,KAAA,GACxB,OAAO,YAAY,QAAQ;CAE7B,IAAI,QAAQ,kBAAkB;EAC5B,OAAO,mBAAmB,QAAQ;EAClC,OAAO,sBAAsB,eAAe,QAAQ,gBAAgB;CACtE;CACA,IAAI,QAAQ,gBAAgB,KAAA;;;;;;CAM1B,OAAO,cAAc,QAAQ;CAG/B,IAAI,cACF,IAAI;EACF,OAAO,WAAW,cAAc,YAAY;GAC1C;GACA;GACA;GACA;GACA;EACF,CAAC;CACH,SAAS,KAAK;EACZ,OAAO,KACL;GAAE;GAAK;GAAc;GAAe;GAAgB;EAAW,GAC/D,mBACF;EACA,OAAO,WAAW;CACpB;MAEA,OAAO,WAAW;CAEpB,OAAO,WAAW,cAAc,SAAS,UAAU;CACnD,OAAO,WAAW,cAAc,SAAS,UAAU;CACnD,OAAO,WAAW,cAAc,SAAS,UAAU;CACnD,IAAI,CAAC,OAAO,cAAc,CAAC,gBAAgB;EACzC,OAAO,MAAM,EAAE,OAAO,GAAG,8BAA8B;EACvD,OAAO,WAAW;EAClB,OAAO;CACT;CACA,OAAO,aACL,OAAO,cACP,cAAc,QAAQ,eAAe,gBAAgB,UAAU;CACjE,IAAI,cAAc,YAEhB,OAAO,aAAa,cAAc,WAAW,gBAAgB,UAAU;MAKvE,OAAO,aAAa,OAAO,eAAe;CAE5C,MAAM,EAAE,YAAY,aAAa,iBAAiB;CAClD,IAAI,cAAc,MAAM,OAAO,gBAAgB,GAAG,eAAe,CAAC,GAChE,OAAO,uBAAuB,MAAM,wBAClC,YACA,aACA,gBACA,YACA,OAAO,UACT;CAEF,IAAI,CAAC,cAAc,UAAU,OAAO,QAAQ,GAC1C,OAAO,UAAU;CAEnB,IAAI,kBAAkB,qBAAqB,iBAAiB,OAAO,UACjE,OAAO,mBAAmB;CAE5B,IACE,kBAAkB,UAElB,cAAc,QAAQ,YAAY,YAAa,GAE/C,OAAO,SAAS;CAElB,OAAO;AACT"}
1
+ {"version":3,"file":"generate.js","names":[],"sources":["../../../../../lib/workers/repository/process/lookup/generate.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport { logger } from '../../../../logger/index.ts';\nimport type { Release } from '../../../../modules/datasource/index.ts';\nimport type { LookupUpdate } from '../../../../modules/manager/types.ts';\nimport type { VersioningApi } from '../../../../modules/versioning/index.ts';\nimport type { RangeStrategy } from '../../../../types/index.ts';\nimport { getElapsedDays } from '../../../../util/date.ts';\nimport { getMergeConfidenceLevel } from '../../../../util/merge-confidence/index.ts';\nimport type { LookupUpdateConfig } from './types.ts';\nimport { getUpdateType } from './update-type.ts';\n\nexport async function generateUpdate(\n config: LookupUpdateConfig,\n currentValue: string | undefined,\n versioningApi: VersioningApi,\n rangeStrategy: RangeStrategy,\n currentVersion: string,\n bucket: string,\n release: Release,\n allVersions: Set<string>,\n): Promise<LookupUpdate> {\n const newVersion = release.version;\n const update: LookupUpdate = {\n bucket,\n newVersion,\n newValue: null!,\n hasAttestation: release.attestation,\n };\n\n if (release.checksumUrl !== undefined) {\n update.checksumUrl = release.checksumUrl;\n }\n if (release.downloadUrl !== undefined) {\n update.downloadUrl = release.downloadUrl;\n }\n if (release.newDigest !== undefined) {\n update.newDigest = release.newDigest;\n }\n if (release.releaseTimestamp) {\n update.releaseTimestamp = release.releaseTimestamp;\n update.newVersionAgeInDays = getElapsedDays(release.releaseTimestamp);\n }\n if (release.registryUrl !== undefined) {\n /**\n * This means:\n * - registry strategy is set to merge\n * - releases were fetched from multiple registry urls\n */\n update.registryUrl = release.registryUrl;\n }\n\n if (currentValue) {\n try {\n if (config.isLockfileOnly) {\n update.newValue = currentValue;\n } else {\n update.newValue = versioningApi.getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n allVersions,\n })!;\n }\n } catch (err) {\n logger.warn(\n { err, currentValue, rangeStrategy, currentVersion, newVersion },\n 'getNewValue error',\n );\n update.newValue = currentValue;\n }\n } else {\n update.newValue = currentValue;\n }\n update.newMajor = versioningApi.getMajor(newVersion)!;\n update.newMinor = versioningApi.getMinor(newVersion)!;\n update.newPatch = versioningApi.getPatch(newVersion)!;\n if (!update.updateType && !currentVersion) {\n logger.debug({ update }, 'Update has no currentVersion');\n update.newValue = currentValue!;\n return update;\n }\n update.updateType =\n update.updateType ??\n getUpdateType(config, versioningApi, currentVersion, newVersion);\n if (versioningApi.isBreaking) {\n // This versioning scheme has breaking awareness\n update.isBreaking = versioningApi.isBreaking(currentVersion, newVersion);\n } else {\n // This versioning scheme does not have breaking awareness - assume only major updates are breaking\n // Updates from, or to, unstable releases should be treated as breaking too.\n // But we should not add that as default behavior until we stop treating non-LTS versions as unstable first\n update.isBreaking = update.updateType === 'major';\n }\n const { datasource, packageName, packageRules } = config;\n if (packageRules?.some((pr) => isNonEmptyArray(pr.matchConfidence))) {\n update.mergeConfidenceLevel = await getMergeConfidenceLevel(\n datasource,\n packageName,\n currentVersion,\n newVersion,\n update.updateType,\n );\n }\n if (!versioningApi.isVersion(update.newValue)) {\n update.isRange = true;\n }\n if (\n (config.isLockfileOnly || rangeStrategy === 'update-lockfile') &&\n currentValue === update.newValue\n ) {\n update.isLockfileUpdate = true;\n }\n if (\n rangeStrategy === 'bump' &&\n // TODO #22198\n versioningApi.matches(newVersion, currentValue!)\n ) {\n update.isBump = true;\n }\n return update;\n}\n"],"mappings":";;;;;;AAWA,eAAsB,eACpB,QACA,cACA,eACA,eACA,gBACA,QACA,SACA,aACuB;CACvB,MAAM,aAAa,QAAQ;CAC3B,MAAM,SAAuB;EAC3B;EACA;EACA,UAAU;EACV,gBAAgB,QAAQ;CAC1B;CAEA,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,OAAO,cAAc,QAAQ;CAE/B,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,OAAO,cAAc,QAAQ;CAE/B,IAAI,QAAQ,cAAc,KAAA,GACxB,OAAO,YAAY,QAAQ;CAE7B,IAAI,QAAQ,kBAAkB;EAC5B,OAAO,mBAAmB,QAAQ;EAClC,OAAO,sBAAsB,eAAe,QAAQ,gBAAgB;CACtE;CACA,IAAI,QAAQ,gBAAgB,KAAA;;;;;;CAM1B,OAAO,cAAc,QAAQ;CAG/B,IAAI,cACF,IAAI;EACF,IAAI,OAAO,gBACT,OAAO,WAAW;OAElB,OAAO,WAAW,cAAc,YAAY;GAC1C;GACA;GACA;GACA;GACA;EACF,CAAC;CAEL,SAAS,KAAK;EACZ,OAAO,KACL;GAAE;GAAK;GAAc;GAAe;GAAgB;EAAW,GAC/D,mBACF;EACA,OAAO,WAAW;CACpB;MAEA,OAAO,WAAW;CAEpB,OAAO,WAAW,cAAc,SAAS,UAAU;CACnD,OAAO,WAAW,cAAc,SAAS,UAAU;CACnD,OAAO,WAAW,cAAc,SAAS,UAAU;CACnD,IAAI,CAAC,OAAO,cAAc,CAAC,gBAAgB;EACzC,OAAO,MAAM,EAAE,OAAO,GAAG,8BAA8B;EACvD,OAAO,WAAW;EAClB,OAAO;CACT;CACA,OAAO,aACL,OAAO,cACP,cAAc,QAAQ,eAAe,gBAAgB,UAAU;CACjE,IAAI,cAAc,YAEhB,OAAO,aAAa,cAAc,WAAW,gBAAgB,UAAU;MAKvE,OAAO,aAAa,OAAO,eAAe;CAE5C,MAAM,EAAE,YAAY,aAAa,iBAAiB;CAClD,IAAI,cAAc,MAAM,OAAO,gBAAgB,GAAG,eAAe,CAAC,GAChE,OAAO,uBAAuB,MAAM,wBAClC,YACA,aACA,gBACA,YACA,OAAO,UACT;CAEF,IAAI,CAAC,cAAc,UAAU,OAAO,QAAQ,GAC1C,OAAO,UAAU;CAEnB,KACG,OAAO,kBAAkB,kBAAkB,sBAC5C,iBAAiB,OAAO,UAExB,OAAO,mBAAmB;CAE5B,IACE,kBAAkB,UAElB,cAAc,QAAQ,YAAY,YAAa,GAE/C,OAAO,SAAS;CAElB,OAAO;AACT"}
@@ -108,7 +108,7 @@ async function lookupUpdates(inconfig) {
108
108
  res.skipReason = "invalid-config";
109
109
  return Result.ok(res);
110
110
  }
111
- let compareValue = config.currentValue;
111
+ let compareValue = config.isLockfileOnly && config.lockedVersion ? config.lockedVersion : config.currentValue;
112
112
  if (isString(config.currentValue) && isString(config.versionCompatibility)) {
113
113
  const regexMatch = regEx(config.versionCompatibility).exec(config.currentValue);
114
114
  if (regexMatch?.groups) {
@@ -130,7 +130,7 @@ async function lookupUpdates(inconfig) {
130
130
  const isValid = isString(compareValue) && versioningApi.isValid(compareValue);
131
131
  const unconstrainedValue = !!config.lockedVersion && isUndefined(config.currentValue);
132
132
  if (isValid || unconstrainedValue) {
133
- if (!config.updatePinnedDependencies && versioningApi.isSingleVersion(compareValue)) {
133
+ if (!config.updatePinnedDependencies && !config.isLockfileOnly && versioningApi.isSingleVersion(compareValue)) {
134
134
  res.skipReason = "is-pinned";
135
135
  return Result.ok(res);
136
136
  }
@@ -253,7 +253,10 @@ async function lookupUpdates(inconfig) {
253
253
  res.skipReason = "invalid-version";
254
254
  return Result.ok(res);
255
255
  }
256
- let filteredReleases = filterVersions(config, currentVersion, latestVersion, inRangeOnlyStrategy ? allSatisfyingVersions : allVersions, versioningApi).filter((v) => unconstrainedValue || versioningApi.isCompatible(v.version, compareValue));
256
+ let filteredReleases = filterVersions(config, currentVersion, latestVersion, inRangeOnlyStrategy ? allSatisfyingVersions : allVersions, versioningApi).filter((v) => {
257
+ if (config.isLockfileOnly) return true;
258
+ return unconstrainedValue || versioningApi.isCompatible(v.version, compareValue);
259
+ });
257
260
  let shrinkedViaVulnerability = false;
258
261
  if (config.isVulnerabilityAlert) {
259
262
  if (config.vulnerabilityFixVersion) {
@@ -297,7 +300,7 @@ async function lookupUpdates(inconfig) {
297
300
  // istanbul ignore next
298
301
  if (!release) return Result.ok(res);
299
302
  const newVersion = release.version;
300
- const update = await generateUpdate(config, compareValue, versioningApi, rangeStrategy, config.lockedVersion ?? currentVersion, bucket, release, allReleaseVersions);
303
+ const update = await generateUpdate(config, config.isLockfileOnly ? config.currentValue : compareValue, versioningApi, rangeStrategy, config.lockedVersion ?? currentVersion, bucket, release, allReleaseVersions);
301
304
  if (config.manager === "gomod" && compareValue?.startsWith("v0.0.0-") && update.newValue?.startsWith("v0.0.0-") && config.currentDigest !== update.newDigest) {
302
305
  update.updateType = "digest";
303
306
  await applyMinimumReleaseAgeToDigestUpdate(update, config, res, true, release.releaseTimestamp);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["allVersioning.get"],"sources":["../../../../../lib/workers/repository/process/lookup/index.ts"],"sourcesContent":["import { isNonEmptyString, isString, isUndefined } from '@sindresorhus/is';\nimport { mergeChildConfig } from '../../../../config/index.ts';\nimport type { ValidationMessage } from '../../../../config/types.ts';\nimport { CONFIG_VALIDATION } from '../../../../constants/error-messages.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport {\n getDatasourceFor,\n getDefaultVersioning,\n} from '../../../../modules/datasource/common.ts';\nimport type {\n GetDigestInputConfig,\n Release,\n ReleaseResult,\n} from '../../../../modules/datasource/index.ts';\nimport {\n applyDatasourceFilters,\n getDigest,\n getRawPkgReleases,\n isGetPkgReleasesConfig,\n supportsDigests,\n} from '../../../../modules/datasource/index.ts';\nimport { postprocessRelease } from '../../../../modules/datasource/postprocess-release.ts';\nimport { getRangeStrategy } from '../../../../modules/manager/index.ts';\nimport type { LookupUpdate } from '../../../../modules/manager/types.ts';\nimport { id as dockerVersioningId } from '../../../../modules/versioning/docker/index.ts';\nimport * as allVersioning from '../../../../modules/versioning/index.ts';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error.ts';\nimport { assignKeys } from '../../../../util/assign-keys.ts';\nimport { getElapsedDays } from '../../../../util/date.ts';\nimport { checkMinimumReleaseAge } from '../../../../util/minimum-release-age.ts';\nimport { applyPackageRules } from '../../../../util/package-rules/index.ts';\nimport { regEx } from '../../../../util/regex.ts';\nimport { Result } from '../../../../util/result.ts';\nimport { safeStringify } from '../../../../util/stringify.ts';\nimport type { Timestamp } from '../../../../util/timestamp.ts';\nimport { calculateAbandonment } from './abandonment.ts';\nimport { getBucket } from './bucket.ts';\nimport { getCurrentVersion } from './current.ts';\nimport { filterVersions } from './filter.ts';\nimport { filterInternalChecks } from './filter-checks.ts';\nimport { generateUpdate } from './generate.ts';\nimport { getRollbackUpdate } from './rollback.ts';\nimport { calculateMostRecentTimestamp } from './timestamps.ts';\nimport type { LookupUpdateConfig, UpdateResult } from './types.ts';\nimport {\n addReplacementUpdateIfValid,\n isReplacementRulesConfigured,\n} from './utils.ts';\n\nasync function getTimestamp(\n config: LookupUpdateConfig,\n versions: Release[],\n version: string,\n versioningApi: allVersioning.VersioningApi,\n): Promise<Timestamp | null | undefined> {\n const currentRelease = versions.find(\n (v) =>\n versioningApi.isValid(v.version) &&\n versioningApi.equals(v.version, version),\n );\n\n if (!currentRelease) {\n return null;\n }\n\n if (currentRelease.releaseTimestamp) {\n return currentRelease.releaseTimestamp;\n }\n\n const remoteRelease = await postprocessRelease(config, currentRelease);\n return remoteRelease?.releaseTimestamp;\n}\n\n/** The only two `updateType`s that `applyMinimumReleaseAgeToDigestUpdate()` can be called with */\ntype DigestLikeUpdate = LookupUpdate & { updateType: 'digest' | 'pinDigest' };\n\n/**\n * A helper function to allow a short-circuit for `minimumReleaseAge` functionality if a package may have config that applies it.\n *\n * Allows avoiding unnecessary calls to more expensive checks like merge + `applyPackageRules()` and `getTimestamp()`.\n */\nfunction couldApplyMinimumReleaseAgeToDigest(\n config: LookupUpdateConfig,\n updateType: DigestLikeUpdate['updateType'],\n): boolean {\n // Match filterInternalChecks(): under `none` the user opted out of internal\n // checks entirely, so do no merging, no package rules, no age check and no\n // logging claiming an age check ran.\n if (config.internalChecksFilter === 'none') {\n return false;\n }\n\n return (\n isNonEmptyString(config.minimumReleaseAge) ||\n isNonEmptyString(config[updateType]?.minimumReleaseAge) ||\n !!config.packageRules?.some((rule) =>\n isNonEmptyString(rule.minimumReleaseAge),\n )\n );\n}\n\n/**\n * Ensure `minimumReleaseAge`/`internalChecksFilter` applies to digest/pinDigest updates, as they don't currently get run through `filterInternalChecks()`.\n *\n * NOTE that this should be kept in sync with `filterInternalChecks`()\n */\nasync function applyMinimumReleaseAgeToDigestUpdate(\n update: DigestLikeUpdate,\n config: LookupUpdateConfig,\n res: UpdateResult,\n currentVersionWasResolved: boolean,\n newestMatchingVersionTimestamp: Timestamp | null | undefined,\n): Promise<void> {\n if (!couldApplyMinimumReleaseAgeToDigest(config, update.updateType)) {\n return;\n }\n\n if (update.updateType === 'pinDigest' && !currentVersionWasResolved) {\n // Not `!res.currentVersion` - that's force-set to lockedVersion further down regardless of timestamp resolution.\n // `pinDigest` doesn't repoint anywhere, unlike `digest` - it just freezes whatever the ref already resolves to.\n // An unversioned tag (e.g. `latest`) has no versioned release to age against, and holding the pin would only\n // prolong the less-pinned (less safe) state, so skip the check entirely rather than treating the missing\n // timestamp as pending.\n logger.once.debug(\n { depName: config.depName, updateType: update.updateType },\n `Skipping minimumReleaseAge check for ${update.updateType} update of ${config.depName}, as its current value does not resolve to a versioned release`,\n );\n return;\n }\n\n let releaseConfig: LookupUpdateConfig = {\n ...mergeChildConfig(config, res),\n updateType: update.updateType,\n };\n releaseConfig = mergeChildConfig(\n releaseConfig,\n releaseConfig[update.updateType]!,\n );\n releaseConfig = await applyPackageRules(releaseConfig, 'update-type');\n\n // Not update.releaseTimestamp - that field means \"age of the new release\" elsewhere (generate.ts, libyear.ts).\n // Not res.currentVersionTimestamp either - that tracks whatever rangeStrategy resolves currentVersion to (e.g.\n // the oldest matching release under `bump`), whereas both `digest` and `pinDigest` reflect whatever the current\n // value's ref actually resolves to *right now*, which is always the newest matching version.\n const ageCheck = checkMinimumReleaseAge(\n releaseConfig,\n newestMatchingVersionTimestamp,\n );\n\n // Mirror filterInternalChecks()'s logging so a held/passed digest update is diagnosable.\n if (ageCheck.minimumReleaseAgeMs && !ageCheck.hasTimestamp) {\n if (releaseConfig.minimumReleaseAgeBehaviour === 'timestamp-optional') {\n logger.once.warn(\n \"Some release(s) did not have a releaseTimestamp, but as we're running with minimumReleaseAgeBehaviour=timestamp-optional, proceeding. See debug logs for more information\",\n );\n }\n\n logger.once.debug(\n {\n depName: config.depName,\n updateType: update.updateType,\n minimumReleaseAgeBehaviour: releaseConfig.minimumReleaseAgeBehaviour,\n check: 'minimumReleaseAge',\n },\n `${update.updateType} update of ${config.depName} has no releaseTimestamp to age against`,\n );\n }\n if (ageCheck.isPending) {\n logger.trace(\n {\n depName: config.depName,\n updateType: update.updateType,\n releaseTimestamp: newestMatchingVersionTimestamp,\n check: 'minimumReleaseAge',\n },\n `${update.updateType} update is pending minimumReleaseAge status checks`,\n );\n\n // internalChecksFilter is read from the unmerged top-level config, like filterInternalChecks().\n if (config.internalChecksFilter === 'strict') {\n update.pendingChecks = true;\n }\n }\n}\n\nexport async function lookupUpdates(\n inconfig: LookupUpdateConfig,\n): Promise<Result<UpdateResult>> {\n let config: LookupUpdateConfig = { ...inconfig };\n config.versioning ??= getDefaultVersioning(config.datasource);\n\n const versioningApi = allVersioning.get(config.versioning);\n\n let dependency: ReleaseResult | null = null;\n const res: UpdateResult = {\n versioning: config.versioning,\n updates: [],\n warnings: [],\n };\n // Timestamp of the release a `digest`/`pinDigest` update's current value currently resolves to (the newest version matching it, regardless of `rangeStrategy`), as opposed to `res.currentVersionTimestamp` which tracks whatever the configured rangeStrategy resolves `currentVersion` to (e.g. the oldest for `bump`)\n let newestMatchingVersionTimestamp: Timestamp | null | undefined;\n // The `digest` update for `config.currentDigest` (if one is added), so its age check can run after `newDigest` is fetched and no-op updates are stripped.\n let digestUpdate: DigestLikeUpdate | undefined;\n\n try {\n logger.trace(\n {\n dependency: config.packageName,\n currentValue: config.currentValue,\n },\n 'lookupUpdates',\n );\n if (config.currentValue && !isString(config.currentValue)) {\n // If currentValue is not a string, then it's invalid\n logger.debug(\n `Invalid currentValue for ${config.packageName}: ${safeStringify(config.currentValue)} (${typeof config.currentValue})`,\n );\n res.skipReason = 'invalid-value';\n return Result.ok(res);\n }\n if (\n !isGetPkgReleasesConfig(config) ||\n !getDatasourceFor(config.datasource)\n ) {\n res.skipReason = 'invalid-config';\n return Result.ok(res);\n }\n let compareValue = config.currentValue;\n if (\n isString(config.currentValue) &&\n isString(config.versionCompatibility)\n ) {\n const versionCompatbilityRegEx = regEx(config.versionCompatibility);\n const regexMatch = versionCompatbilityRegEx.exec(config.currentValue);\n if (regexMatch?.groups) {\n logger.debug(\n {\n versionCompatibility: config.versionCompatibility,\n currentValue: config.currentValue,\n packageName: config.packageName,\n groups: regexMatch.groups,\n },\n 'version compatibility regex match',\n );\n config.currentCompatibility = regexMatch.groups.compatibility;\n res.currentCompatibility = regexMatch.groups.compatibility;\n compareValue = regexMatch.groups.version;\n } else {\n logger.debug(\n {\n versionCompatibility: config.versionCompatibility,\n currentValue: config.currentValue,\n packageName: config.packageName,\n },\n 'version compatibility regex mismatch',\n );\n }\n }\n\n const isValid =\n isString(compareValue) && versioningApi.isValid(compareValue);\n\n const unconstrainedValue =\n !!config.lockedVersion && isUndefined(config.currentValue);\n\n if (isValid || unconstrainedValue) {\n if (\n !config.updatePinnedDependencies &&\n // TODO #22198\n versioningApi.isSingleVersion(compareValue!)\n ) {\n res.skipReason = 'is-pinned';\n return Result.ok(res);\n }\n\n const { val: releaseResult, err: lookupError } = await getRawPkgReleases(\n config,\n )\n .transform((res) => calculateMostRecentTimestamp(versioningApi, res))\n .transform((res) => calculateAbandonment(res, config))\n .transform((res) => applyDatasourceFilters(res, config))\n .unwrap();\n\n if (lookupError instanceof Error) {\n throw lookupError;\n }\n\n if (lookupError) {\n // If dependency lookup fails then warn and return\n const warning: ValidationMessage = {\n topic: config.packageName,\n message: `Failed to look up ${config.datasource} package ${config.packageName}: ${lookupError}`,\n };\n logger.debug(\n {\n dependency: config.packageName,\n packageFile: config.packageFile,\n },\n warning.message,\n );\n // TODO: return warnings in own field\n res.warnings.push(warning);\n return Result.ok(res);\n }\n\n dependency = releaseResult;\n\n if (dependency.deprecationMessage) {\n logger.debug(\n `Found deprecationMessage for ${config.datasource} package ${config.packageName}`,\n );\n }\n\n assignKeys(res, dependency, [\n 'deprecationMessage',\n 'sourceUrl',\n 'registryUrl',\n 'sourceDirectory',\n 'homepage',\n 'changelogUrl',\n 'dependencyUrl',\n 'lookupName',\n 'packageScope',\n 'mostRecentTimestamp',\n 'isAbandoned',\n 'respectLatest',\n ]);\n\n const latestVersion = dependency.tags?.latest;\n // Filter out any results from datasource that don't comply with our versioning\n let allVersions = dependency.releases.filter((release) =>\n versioningApi.isVersion(release.version),\n );\n const allReleaseVersions = new Set(allVersions.map((r) => r.version));\n // The datasources used in these tests always return at least one\n // version-like release, so neither this block nor the currentDigest\n // check inside it is reached. A lookup whose releases are all\n // unversioned tags does not get here either - with a digest configured\n // it takes the digest-only path above instead - see #40625\n // istanbul ignore if\n if (allVersions.length === 0) {\n const message = `Found no results from datasource that look like a version`;\n logger.info(\n {\n dependency: config.packageName,\n result: dependency,\n },\n message,\n );\n if (!config.currentDigest) {\n return Result.ok(res);\n }\n }\n // Reapply package rules in case we missed something from sourceUrl\n config = await applyPackageRules(\n { ...config, sourceUrl: res.sourceUrl },\n 'source-url',\n );\n if (config.followTag) {\n const taggedVersion = dependency.tags?.[config.followTag];\n if (!taggedVersion) {\n res.warnings.push({\n topic: config.packageName,\n message: `Can't find version with tag ${config.followTag} for ${config.datasource} package ${config.packageName}`,\n });\n return Result.ok(res);\n }\n allVersions = allVersions.filter(\n (v) =>\n v.version === taggedVersion ||\n (v.version === compareValue &&\n versioningApi.isGreaterThan(taggedVersion, compareValue)),\n );\n }\n\n const inRangeOnlyStrategy = config.rangeStrategy === 'in-range-only';\n // Check that existing constraint can be satisfied\n const allSatisfyingVersions =\n (inRangeOnlyStrategy || config.rollbackPrs) && !unconstrainedValue\n ? allVersions.filter((v) =>\n // TODO #22198\n versioningApi.matches(v.version, compareValue!),\n )\n : allVersions;\n if (!allSatisfyingVersions.length) {\n logger.debug(\n `Found no satisfying versions with '${config.versioning}' versioning`,\n );\n }\n\n if (config.rollbackPrs && !allSatisfyingVersions.length) {\n const rollback = getRollbackUpdate(config, allVersions, versioningApi);\n // istanbul ignore if\n if (!rollback) {\n res.warnings.push({\n topic: config.packageName,\n // TODO: types (#22198)\n message: `Can't find version matching ${compareValue!} for ${\n config.datasource\n } package ${config.packageName}`,\n });\n return Result.ok(res);\n }\n res.updates.push(rollback);\n }\n let rangeStrategy = getRangeStrategy(config);\n\n // istanbul ignore next\n if (\n config.isVulnerabilityAlert &&\n rangeStrategy === 'update-lockfile' &&\n !config.lockedVersion\n ) {\n rangeStrategy = 'bump';\n }\n // unconstrained deps with lockedVersion\n if (\n config.isVulnerabilityAlert &&\n !config.currentValue &&\n config.lockedVersion\n ) {\n rangeStrategy = 'update-lockfile';\n }\n const nonDeprecatedVersions = dependency.releases\n .filter((release) => !release.isDeprecated)\n .map((release) => release.version);\n let currentVersion: string;\n if (rangeStrategy === 'update-lockfile') {\n currentVersion = config.lockedVersion!;\n } else if (\n compareValue &&\n versioningApi.isSingleVersion(compareValue) &&\n allVersions.find((v) => v.version === compareValue)\n ) {\n currentVersion = compareValue;\n }\n // TODO #22198\n currentVersion ??=\n getCurrentVersion(\n compareValue!,\n config.lockedVersion!,\n versioningApi,\n rangeStrategy!,\n latestVersion!,\n nonDeprecatedVersions,\n ) ??\n getCurrentVersion(\n compareValue!,\n config.lockedVersion!,\n versioningApi,\n rangeStrategy!,\n latestVersion!,\n allVersions.map((v) => v.version),\n )!;\n\n if (!currentVersion) {\n // v8 ignore else -- TODO: add test #40625\n if (!config.lockedVersion) {\n logger.debug(\n `No currentVersion or lockedVersion found for ${config.packageName}`,\n );\n res.skipReason = 'invalid-value';\n }\n return Result.ok(res);\n }\n\n res.currentVersion = currentVersion;\n\n // Use lockedVersion for the timestamp lookup when available, because\n // res.currentVersion is later overwritten to lockedVersion (see below).\n // Without this, strategies like \"replace\" would compute the timestamp\n // for the highest satisfying version (e.g. 1.4.1) while the reported\n // currentVersion ends up being the locked one (e.g. 1.0.0).\n const versionForTimestamp = config.lockedVersion ?? currentVersion;\n const currentVersionTimestamp = await getTimestamp(\n config,\n allVersions,\n versionForTimestamp,\n versioningApi,\n );\n\n if (isNonEmptyString(currentVersionTimestamp)) {\n res.currentVersionTimestamp = currentVersionTimestamp;\n res.currentVersionAgeInDays = getElapsedDays(currentVersionTimestamp);\n\n if (\n config.packageRules?.some((rule) =>\n isNonEmptyString(rule.matchCurrentAge),\n )\n ) {\n // Reapply package rules to check matches for matchCurrentAge\n config = await applyPackageRules(\n { ...config, currentVersionTimestamp },\n 'current-timestamp',\n );\n }\n }\n\n if (\n config.currentDigest\n ? couldApplyMinimumReleaseAgeToDigest(config, 'digest')\n : config.pinDigests &&\n couldApplyMinimumReleaseAgeToDigest(config, 'pinDigest')\n ) {\n // Resolve from `allVersions` (not `dependency.releases`) so that filters like followTag apply, preferring non-deprecated versions with a fallback - both like the `currentVersion` resolution above.\n const newestMatchingVersion =\n getCurrentVersion(\n compareValue!,\n '',\n versioningApi,\n 'replace',\n latestVersion!,\n allVersions.filter((v) => !v.isDeprecated).map((v) => v.version),\n ) ??\n getCurrentVersion(\n compareValue!,\n '',\n versioningApi,\n 'replace',\n latestVersion!,\n allVersions.map((v) => v.version),\n );\n if (newestMatchingVersion) {\n newestMatchingVersionTimestamp = await getTimestamp(\n config,\n allVersions,\n newestMatchingVersion,\n versioningApi,\n );\n }\n }\n\n if (\n compareValue &&\n currentVersion &&\n rangeStrategy === 'pin' &&\n !versioningApi.isSingleVersion(compareValue)\n ) {\n const newValue =\n versioningApi.getPinnedValue?.(currentVersion) ?? currentVersion;\n res.updates.push({\n updateType: 'pin',\n isPin: true,\n newValue,\n newVersion: currentVersion,\n newMajor: versioningApi.getMajor(currentVersion)!,\n });\n }\n if (rangeStrategy === 'pin') {\n // Fall back to replace once pinning logic is done\n rangeStrategy = 'replace';\n }\n // A non-version can only get this far via a locked version under\n // rangeStrategy=pin, but the timestamp lookup above calls `equals()` on\n // it first and throws - see #40625\n // istanbul ignore if\n if (!versioningApi.isVersion(currentVersion!)) {\n res.skipReason = 'invalid-version';\n return Result.ok(res);\n }\n // Filter latest, unstable, etc\n // TODO #22198\n let filteredReleases = filterVersions(\n config,\n currentVersion!,\n latestVersion!,\n inRangeOnlyStrategy ? allSatisfyingVersions : allVersions,\n versioningApi,\n ).filter(\n (v) =>\n // Leave only compatible versions\n unconstrainedValue ||\n versioningApi.isCompatible(v.version, compareValue),\n );\n let shrinkedViaVulnerability = false;\n if (config.isVulnerabilityAlert) {\n if (config.vulnerabilityFixVersion) {\n res.vulnerabilityFixVersion = config.vulnerabilityFixVersion;\n res.vulnerabilityFixStrategy = config.vulnerabilityFixStrategy;\n if (versioningApi.isValid(config.vulnerabilityFixVersion)) {\n let fixedFilteredReleases;\n if (versioningApi.isVersion(config.vulnerabilityFixVersion)) {\n // Retain only releases greater than or equal to the fix version\n fixedFilteredReleases = filteredReleases.filter(\n (release) =>\n !versioningApi.isGreaterThan(\n config.vulnerabilityFixVersion!,\n release.version,\n ),\n );\n } else {\n // Retain only releases which max the fix constraint\n fixedFilteredReleases = filteredReleases.filter((release) =>\n versioningApi.matches(\n release.version,\n config.vulnerabilityFixVersion!,\n ),\n );\n }\n // Warn if this filtering results caused zero releases\n if (fixedFilteredReleases.length === 0 && filteredReleases.length) {\n logger.warn(\n {\n releases: filteredReleases,\n vulnerabilityFixVersion: config.vulnerabilityFixVersion,\n packageName: config.packageName,\n },\n 'No releases satisfy vulnerabilityFixVersion',\n );\n }\n // Use the additionally filtered releases\n filteredReleases = fixedFilteredReleases;\n } else {\n logger.warn(\n {\n vulnerabilityFixVersion: config.vulnerabilityFixVersion,\n packageName: config.packageName,\n },\n 'vulnerabilityFixVersion is not valid',\n );\n }\n }\n if (config.vulnerabilityFixStrategy === 'highest') {\n // Don't shrink the list of releases - let Renovate use its normal logic\n logger.once.debug(\n `Using vulnerabilityFixStrategy=highest for ${config.packageName}`,\n );\n } else {\n // Shrink the list of releases to the lowest fixed version\n logger.once.debug(\n `Using vulnerabilityFixStrategy=lowest for ${config.packageName}`,\n );\n filteredReleases = filteredReleases.slice(0, 1);\n shrinkedViaVulnerability = true;\n }\n }\n const buckets: Record<string, [Release]> = {};\n for (const release of filteredReleases) {\n const bucket = getBucket(\n config,\n // TODO #22198\n currentVersion!,\n release.version,\n versioningApi,\n );\n // `getBucket()` only returns null when the versioning api cannot\n // determine a major, but every release reaching it has already passed\n // `isVersion()`, so a null major contradicts that and the else looks\n // unreachable rather than merely untested\n // v8 ignore else -- see #40625\n if (isString(bucket)) {\n if (buckets[bucket]) {\n buckets[bucket].push(release);\n } else {\n buckets[bucket] = [release];\n }\n }\n }\n const depResultConfig = mergeChildConfig(config, res);\n for (const [bucket, releases] of Object.entries(buckets)) {\n const sortedReleases = releases.sort((r1, r2) =>\n versioningApi.sortVersions(r1.version, r2.version),\n );\n const { release, pendingChecks, pendingReleases } =\n await filterInternalChecks(\n depResultConfig,\n versioningApi,\n bucket,\n sortedReleases,\n );\n // `filterInternalChecks()` normally yields a release, falling back to\n // the newest pending one; only a datasource rejecting every candidate\n // during postprocessing leaves none - see #40625\n // istanbul ignore next\n if (!release) {\n return Result.ok(res);\n }\n const newVersion = release.version;\n const update = await generateUpdate(\n config,\n compareValue,\n versioningApi,\n // TODO #22198\n\n rangeStrategy!,\n config.lockedVersion ?? currentVersion!,\n bucket,\n release,\n allReleaseVersions,\n );\n\n // #29034\n if (\n config.manager === 'gomod' &&\n compareValue?.startsWith('v0.0.0-') &&\n update.newValue?.startsWith('v0.0.0-') &&\n config.currentDigest !== update.newDigest\n ) {\n update.updateType = 'digest';\n\n // As this has already been processed by `filterInternalChecks()`, but we're changing the `updateType`, we need to apply the digest-scoped minimumReleaseAge rules.\n // `currentVersionWasResolved` only matters for `pinDigest`, which `update.updateType` never is here - true is a safe constant.\n await applyMinimumReleaseAgeToDigestUpdate(\n update as DigestLikeUpdate,\n config,\n res,\n true,\n release.releaseTimestamp,\n );\n }\n\n if (pendingChecks) {\n update.pendingChecks = pendingChecks;\n }\n\n if (pendingReleases.length) {\n update.pendingVersions = pendingReleases.map((r) => r.version);\n }\n if (!update.newValue || update.newValue === compareValue) {\n if (!config.lockedVersion) {\n continue;\n }\n // istanbul ignore if\n if (rangeStrategy === 'bump') {\n logger.trace(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n lockedVersion: config.lockedVersion,\n newVersion,\n },\n 'Skipping bump because newValue is the same',\n );\n continue;\n }\n res.isSingleVersion = true;\n }\n res.isSingleVersion ??=\n isString(update.newValue) &&\n versioningApi.isSingleVersion(update.newValue);\n // Guards against a docker downgrade, which the datasources used in\n // these tests never produce - see #40625\n // istanbul ignore if\n if (\n config.versioning === dockerVersioningId &&\n update.updateType !== 'rollback' &&\n update.newValue &&\n versioningApi.isVersion(update.newValue) &&\n compareValue &&\n versioningApi.isVersion(compareValue) &&\n versioningApi.isGreaterThan(compareValue, update.newValue)\n ) {\n logger.warn(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n compareValue,\n currentVersion: config.currentVersion,\n update,\n allVersionsLength: allVersions.length,\n filteredReleaseVersions: filteredReleases.map((r) => r.version),\n shrinkedViaVulnerability,\n },\n 'Unexpected downgrade detected: skipping',\n );\n } else {\n res.updates.push(update);\n }\n }\n } else if (compareValue) {\n logger.debug(\n `Dependency ${config.packageName} has unsupported/unversioned value ${compareValue} (versioning=${config.versioning})`,\n );\n\n if (!config.pinDigests && !config.currentDigest) {\n logger.debug(\n `Skipping ${config.packageName} because no currentDigest or pinDigests`,\n );\n res.skipReason = 'invalid-value';\n } else {\n delete res.skipReason;\n }\n } else {\n res.skipReason = 'invalid-value';\n }\n\n if (isReplacementRulesConfigured(config)) {\n addReplacementUpdateIfValid(res.updates, config);\n } else if (dependency?.replacementName && dependency.replacementVersion) {\n res.updates.push({\n updateType: 'replacement',\n newName: dependency.replacementName,\n newValue: dependency.replacementVersion,\n });\n }\n\n // Record if the dep is fixed to a version\n if (config.lockedVersion) {\n res.currentVersion = config.lockedVersion;\n res.fixedVersion = config.lockedVersion;\n } else if (compareValue && versioningApi.isSingleVersion(compareValue)) {\n res.fixedVersion = compareValue.replace(regEx(/^=+/), '');\n }\n\n // massage versionCompatibility\n if (\n isString(config.currentValue) &&\n isString(compareValue) &&\n isString(config.versionCompatibility)\n ) {\n for (const update of res.updates) {\n logger.debug({ update });\n // The enclosing condition already requires a string `currentValue`,\n // so only a null `newValue` takes the else\n // v8 ignore else -- see #40625\n if (isString(config.currentValue) && isString(update.newValue)) {\n update.newValue = config.currentValue.replace(\n compareValue,\n update.newValue,\n );\n }\n }\n }\n\n // Add digests if necessary\n if (supportsDigests(config.datasource)) {\n if (config.currentDigest) {\n if (!config.digestOneAndOnly || !res.updates.length) {\n // digest update - age-checked after the strip below, once newDigest is known\n digestUpdate = {\n updateType: 'digest',\n newValue: config.currentValue,\n };\n res.updates.push(digestUpdate);\n }\n } else if (\n config.pinDigests &&\n // only update the digest in the package file if it's managed by us\n !config.digestManagedExternally &&\n // Create a pin only if one doesn't already exists\n // v8 ignore else -- TODO: add test #40625\n !res.updates.some((update) => update.updateType === 'pin')\n ) {\n // pin digest\n const pinDigestUpdate: DigestLikeUpdate = {\n isPinDigest: true,\n updateType: 'pinDigest',\n newValue: config.currentValue,\n };\n await applyMinimumReleaseAgeToDigestUpdate(\n pinDigestUpdate,\n config,\n res,\n isValid || unconstrainedValue,\n newestMatchingVersionTimestamp,\n );\n res.updates.push(pinDigestUpdate);\n }\n if (versioningApi.valueToVersion) {\n // TODO #22198\n res.currentVersion = versioningApi.valueToVersion(res.currentVersion!);\n for (const update of res.updates) {\n // TODO #22198\n update.newVersion = versioningApi.valueToVersion(update.newVersion!);\n }\n }\n if (res.registryUrl) {\n config.registryUrls = [res.registryUrl];\n }\n\n // update digest for all\n for (const update of res.updates) {\n // only update the digest in the package file if it's managed by us\n if (\n (config.pinDigests === true && !config.digestManagedExternally) ||\n config.currentDigest\n ) {\n const getDigestConfig: GetDigestInputConfig = {\n ...config,\n registryUrl: update.registryUrl ?? res.registryUrl,\n lookupName: res.lookupName,\n };\n\n // #20304 only pass it for replacement updates, otherwise we get wrong or invalid digest\n if (update.updateType !== 'replacement') {\n delete getDigestConfig.replacementName;\n }\n\n // #20304 don't use lookupName and currentDigest when we replace image name\n if (\n update.updateType === 'replacement' &&\n update.newName !== config.packageName\n ) {\n delete getDigestConfig.lookupName;\n delete getDigestConfig.currentDigest;\n getDigestConfig.replacementName = update.newName;\n }\n\n // Don't use current releases if replacement changes name, otherwise we use the wrong new digest.\n // This happens on datasources which return the digest in release info like `github-tags`.\n // We can still use it when only version is changing.\n if (\n update.updateType !== 'replacement' ||\n update.newName === config.packageName\n ) {\n update.newDigest ??= dependency?.releases.find(\n (r) => r.version === update.newValue,\n )?.newDigest;\n }\n\n update.newDigest ??= await getDigest(\n getDigestConfig,\n update.newValue,\n );\n\n // If the digest could not be determined, report this as otherwise the\n // update will be omitted later on without notice.\n if (update.newDigest === null) {\n logger.debug(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n datasource: config.datasource,\n newValue: update.newValue,\n bucket: update.bucket,\n },\n 'Could not determine new digest for update.',\n );\n\n // Only report a warning if there is a current digest.\n // Context: https://github.com/renovatebot/renovate/pull/20175#discussion_r1102615059.\n if (config.currentDigest) {\n res.warnings.push({\n message: `Could not determine new digest for update (${config.datasource} package ${config.packageName})`,\n topic: config.packageName,\n });\n }\n }\n } else {\n delete update.newDigest;\n }\n if (update.newVersion) {\n const registryUrl = dependency?.releases?.find(\n (release) => release.version === update.newVersion,\n )?.registryUrl;\n if (registryUrl && registryUrl !== res.registryUrl) {\n update.registryUrl = registryUrl;\n }\n }\n }\n }\n\n if (res.updates.length) {\n delete res.skipReason;\n }\n // Strip out any non-changed ones\n res.updates = res.updates\n .filter(\n (update) => update.newValue !== null || config.currentValue === null,\n )\n .filter((update) => update.newDigest !== null)\n .filter(\n (update) =>\n (isString(update.newName) && update.newName !== config.packageName) ||\n update.isReplacement === true ||\n update.newValue !== config.currentValue ||\n update.isLockfileUpdate === true ||\n // TODO #22198\n (update.newDigest &&\n !update.newDigest.startsWith(config.currentDigest!)),\n );\n // If range strategy specified in config is 'in-range-only', also strip out updates where currentValue !== newValue\n if (config.rangeStrategy === 'in-range-only') {\n res.updates = res.updates.filter(\n (update) => update.newValue === config.currentValue,\n );\n }\n // Handle a weird edge case involving followTag and fallbacks\n if (config.rollbackPrs && config.followTag) {\n res.updates = res.updates.filter(\n (update) =>\n update.updateType !== 'rollback' || res.updates.length === 1,\n );\n }\n\n // If there is a digest update proposed which is in the pending updates for this dependency, ensure that `minimumReleaseAge` is applied.\n // `currentVersionWasResolved` only matters for `pinDigest`, which `digestUpdate` never is - true is a safe constant.\n if (digestUpdate && res.updates.includes(digestUpdate)) {\n await applyMinimumReleaseAgeToDigestUpdate(\n digestUpdate,\n config,\n res,\n true,\n newestMatchingVersionTimestamp,\n );\n }\n\n const release =\n res.updates.length > 0\n ? (dependency?.releases.find(\n (r) => r.version === res.updates[0].newValue,\n ) ??\n dependency?.releases.find(\n (r) => r.version === res.updates[0].newVersion,\n ))\n : null;\n\n if (release?.changelogContent) {\n res.changelogContent = release.changelogContent;\n res.changelogUrl = release.changelogUrl;\n }\n } catch (err) /* istanbul ignore next */ {\n if (err instanceof ExternalHostError) {\n return Result.err(err);\n }\n\n if (err instanceof Error && err.message === CONFIG_VALIDATION) {\n return Result.err(err);\n }\n\n logger.error(\n {\n currentDigest: config.currentDigest,\n currentValue: config.currentValue,\n datasource: config.datasource,\n packageName: config.packageName,\n digestOneAndOnly: config.digestOneAndOnly,\n followTag: config.followTag,\n lockedVersion: config.lockedVersion,\n packageFile: config.packageFile,\n pinDigests: config.pinDigests,\n rollbackPrs: config.rollbackPrs,\n isVulnerabilityAlert: config.isVulnerabilityAlert,\n updatePinnedDependencies: config.updatePinnedDependencies,\n err,\n },\n 'lookupUpdates error',\n );\n res.skipReason = 'internal-error';\n }\n return Result.ok(res);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,eAAe,aACb,QACA,UACA,SACA,eACuC;CACvC,MAAM,iBAAiB,SAAS,MAC7B,MACC,cAAc,QAAQ,EAAE,OAAO,KAC/B,cAAc,OAAO,EAAE,SAAS,OAAO,CAC3C;CAEA,IAAI,CAAC,gBACH,OAAO;CAGT,IAAI,eAAe,kBACjB,OAAO,eAAe;CAIxB,QAAO,MADqB,mBAAmB,QAAQ,cAAc,EAAA,EAC/C;AACxB;;;;;;AAUA,SAAS,oCACP,QACA,YACS;CAIT,IAAI,OAAO,yBAAyB,QAClC,OAAO;CAGT,OACE,iBAAiB,OAAO,iBAAiB,KACzC,iBAAiB,OAAO,WAAW,EAAE,iBAAiB,KACtD,CAAC,CAAC,OAAO,cAAc,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;GACrB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,kBAAkB,OAAO;GACzB,WAAW,OAAO;GAClB,eAAe,OAAO;GACtB,aAAa,OAAO;GACpB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,sBAAsB,OAAO;GAC7B,0BAA0B,OAAO;GACjC;EACF,GACA,qBACF;EACA,IAAI,aAAa;CACnB;CACA,OAAO,OAAO,GAAG,GAAG;AACtB"}
1
+ {"version":3,"file":"index.js","names":["allVersioning.get"],"sources":["../../../../../lib/workers/repository/process/lookup/index.ts"],"sourcesContent":["import { isNonEmptyString, isString, isUndefined } from '@sindresorhus/is';\nimport { mergeChildConfig } from '../../../../config/index.ts';\nimport type { ValidationMessage } from '../../../../config/types.ts';\nimport { CONFIG_VALIDATION } from '../../../../constants/error-messages.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport {\n getDatasourceFor,\n getDefaultVersioning,\n} from '../../../../modules/datasource/common.ts';\nimport type {\n GetDigestInputConfig,\n Release,\n ReleaseResult,\n} from '../../../../modules/datasource/index.ts';\nimport {\n applyDatasourceFilters,\n getDigest,\n getRawPkgReleases,\n isGetPkgReleasesConfig,\n supportsDigests,\n} from '../../../../modules/datasource/index.ts';\nimport { postprocessRelease } from '../../../../modules/datasource/postprocess-release.ts';\nimport { getRangeStrategy } from '../../../../modules/manager/index.ts';\nimport type { LookupUpdate } from '../../../../modules/manager/types.ts';\nimport { id as dockerVersioningId } from '../../../../modules/versioning/docker/index.ts';\nimport * as allVersioning from '../../../../modules/versioning/index.ts';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error.ts';\nimport { assignKeys } from '../../../../util/assign-keys.ts';\nimport { getElapsedDays } from '../../../../util/date.ts';\nimport { checkMinimumReleaseAge } from '../../../../util/minimum-release-age.ts';\nimport { applyPackageRules } from '../../../../util/package-rules/index.ts';\nimport { regEx } from '../../../../util/regex.ts';\nimport { Result } from '../../../../util/result.ts';\nimport { safeStringify } from '../../../../util/stringify.ts';\nimport type { Timestamp } from '../../../../util/timestamp.ts';\nimport { calculateAbandonment } from './abandonment.ts';\nimport { getBucket } from './bucket.ts';\nimport { getCurrentVersion } from './current.ts';\nimport { filterVersions } from './filter.ts';\nimport { filterInternalChecks } from './filter-checks.ts';\nimport { generateUpdate } from './generate.ts';\nimport { getRollbackUpdate } from './rollback.ts';\nimport { calculateMostRecentTimestamp } from './timestamps.ts';\nimport type { LookupUpdateConfig, UpdateResult } from './types.ts';\nimport {\n addReplacementUpdateIfValid,\n isReplacementRulesConfigured,\n} from './utils.ts';\n\nasync function getTimestamp(\n config: LookupUpdateConfig,\n versions: Release[],\n version: string,\n versioningApi: allVersioning.VersioningApi,\n): Promise<Timestamp | null | undefined> {\n const currentRelease = versions.find(\n (v) =>\n versioningApi.isValid(v.version) &&\n versioningApi.equals(v.version, version),\n );\n\n if (!currentRelease) {\n return null;\n }\n\n if (currentRelease.releaseTimestamp) {\n return currentRelease.releaseTimestamp;\n }\n\n const remoteRelease = await postprocessRelease(config, currentRelease);\n return remoteRelease?.releaseTimestamp;\n}\n\n/** The only two `updateType`s that `applyMinimumReleaseAgeToDigestUpdate()` can be called with */\ntype DigestLikeUpdate = LookupUpdate & { updateType: 'digest' | 'pinDigest' };\n\n/**\n * A helper function to allow a short-circuit for `minimumReleaseAge` functionality if a package may have config that applies it.\n *\n * Allows avoiding unnecessary calls to more expensive checks like merge + `applyPackageRules()` and `getTimestamp()`.\n */\nfunction couldApplyMinimumReleaseAgeToDigest(\n config: LookupUpdateConfig,\n updateType: DigestLikeUpdate['updateType'],\n): boolean {\n // Match filterInternalChecks(): under `none` the user opted out of internal\n // checks entirely, so do no merging, no package rules, no age check and no\n // logging claiming an age check ran.\n if (config.internalChecksFilter === 'none') {\n return false;\n }\n\n return (\n isNonEmptyString(config.minimumReleaseAge) ||\n isNonEmptyString(config[updateType]?.minimumReleaseAge) ||\n !!config.packageRules?.some((rule) =>\n isNonEmptyString(rule.minimumReleaseAge),\n )\n );\n}\n\n/**\n * Ensure `minimumReleaseAge`/`internalChecksFilter` applies to digest/pinDigest updates, as they don't currently get run through `filterInternalChecks()`.\n *\n * NOTE that this should be kept in sync with `filterInternalChecks`()\n */\nasync function applyMinimumReleaseAgeToDigestUpdate(\n update: DigestLikeUpdate,\n config: LookupUpdateConfig,\n res: UpdateResult,\n currentVersionWasResolved: boolean,\n newestMatchingVersionTimestamp: Timestamp | null | undefined,\n): Promise<void> {\n if (!couldApplyMinimumReleaseAgeToDigest(config, update.updateType)) {\n return;\n }\n\n if (update.updateType === 'pinDigest' && !currentVersionWasResolved) {\n // Not `!res.currentVersion` - that's force-set to lockedVersion further down regardless of timestamp resolution.\n // `pinDigest` doesn't repoint anywhere, unlike `digest` - it just freezes whatever the ref already resolves to.\n // An unversioned tag (e.g. `latest`) has no versioned release to age against, and holding the pin would only\n // prolong the less-pinned (less safe) state, so skip the check entirely rather than treating the missing\n // timestamp as pending.\n logger.once.debug(\n { depName: config.depName, updateType: update.updateType },\n `Skipping minimumReleaseAge check for ${update.updateType} update of ${config.depName}, as its current value does not resolve to a versioned release`,\n );\n return;\n }\n\n let releaseConfig: LookupUpdateConfig = {\n ...mergeChildConfig(config, res),\n updateType: update.updateType,\n };\n releaseConfig = mergeChildConfig(\n releaseConfig,\n releaseConfig[update.updateType]!,\n );\n releaseConfig = await applyPackageRules(releaseConfig, 'update-type');\n\n // Not update.releaseTimestamp - that field means \"age of the new release\" elsewhere (generate.ts, libyear.ts).\n // Not res.currentVersionTimestamp either - that tracks whatever rangeStrategy resolves currentVersion to (e.g.\n // the oldest matching release under `bump`), whereas both `digest` and `pinDigest` reflect whatever the current\n // value's ref actually resolves to *right now*, which is always the newest matching version.\n const ageCheck = checkMinimumReleaseAge(\n releaseConfig,\n newestMatchingVersionTimestamp,\n );\n\n // Mirror filterInternalChecks()'s logging so a held/passed digest update is diagnosable.\n if (ageCheck.minimumReleaseAgeMs && !ageCheck.hasTimestamp) {\n if (releaseConfig.minimumReleaseAgeBehaviour === 'timestamp-optional') {\n logger.once.warn(\n \"Some release(s) did not have a releaseTimestamp, but as we're running with minimumReleaseAgeBehaviour=timestamp-optional, proceeding. See debug logs for more information\",\n );\n }\n\n logger.once.debug(\n {\n depName: config.depName,\n updateType: update.updateType,\n minimumReleaseAgeBehaviour: releaseConfig.minimumReleaseAgeBehaviour,\n check: 'minimumReleaseAge',\n },\n `${update.updateType} update of ${config.depName} has no releaseTimestamp to age against`,\n );\n }\n if (ageCheck.isPending) {\n logger.trace(\n {\n depName: config.depName,\n updateType: update.updateType,\n releaseTimestamp: newestMatchingVersionTimestamp,\n check: 'minimumReleaseAge',\n },\n `${update.updateType} update is pending minimumReleaseAge status checks`,\n );\n\n // internalChecksFilter is read from the unmerged top-level config, like filterInternalChecks().\n if (config.internalChecksFilter === 'strict') {\n update.pendingChecks = true;\n }\n }\n}\n\nexport async function lookupUpdates(\n inconfig: LookupUpdateConfig,\n): Promise<Result<UpdateResult>> {\n let config: LookupUpdateConfig = { ...inconfig };\n config.versioning ??= getDefaultVersioning(config.datasource);\n\n const versioningApi = allVersioning.get(config.versioning);\n\n let dependency: ReleaseResult | null = null;\n const res: UpdateResult = {\n versioning: config.versioning,\n updates: [],\n warnings: [],\n };\n // Timestamp of the release a `digest`/`pinDigest` update's current value currently resolves to (the newest version matching it, regardless of `rangeStrategy`), as opposed to `res.currentVersionTimestamp` which tracks whatever the configured rangeStrategy resolves `currentVersion` to (e.g. the oldest for `bump`)\n let newestMatchingVersionTimestamp: Timestamp | null | undefined;\n // The `digest` update for `config.currentDigest` (if one is added), so its age check can run after `newDigest` is fetched and no-op updates are stripped.\n let digestUpdate: DigestLikeUpdate | undefined;\n\n try {\n logger.trace(\n {\n dependency: config.packageName,\n currentValue: config.currentValue,\n },\n 'lookupUpdates',\n );\n if (config.currentValue && !isString(config.currentValue)) {\n // If currentValue is not a string, then it's invalid\n logger.debug(\n `Invalid currentValue for ${config.packageName}: ${safeStringify(config.currentValue)} (${typeof config.currentValue})`,\n );\n res.skipReason = 'invalid-value';\n return Result.ok(res);\n }\n if (\n !isGetPkgReleasesConfig(config) ||\n !getDatasourceFor(config.datasource)\n ) {\n res.skipReason = 'invalid-config';\n return Result.ok(res);\n }\n let compareValue =\n config.isLockfileOnly && config.lockedVersion\n ? config.lockedVersion\n : config.currentValue;\n if (\n isString(config.currentValue) &&\n isString(config.versionCompatibility)\n ) {\n const versionCompatbilityRegEx = regEx(config.versionCompatibility);\n const regexMatch = versionCompatbilityRegEx.exec(config.currentValue);\n if (regexMatch?.groups) {\n logger.debug(\n {\n versionCompatibility: config.versionCompatibility,\n currentValue: config.currentValue,\n packageName: config.packageName,\n groups: regexMatch.groups,\n },\n 'version compatibility regex match',\n );\n config.currentCompatibility = regexMatch.groups.compatibility;\n res.currentCompatibility = regexMatch.groups.compatibility;\n compareValue = regexMatch.groups.version;\n } else {\n logger.debug(\n {\n versionCompatibility: config.versionCompatibility,\n currentValue: config.currentValue,\n packageName: config.packageName,\n },\n 'version compatibility regex mismatch',\n );\n }\n }\n\n const isValid =\n isString(compareValue) && versioningApi.isValid(compareValue);\n\n const unconstrainedValue =\n !!config.lockedVersion && isUndefined(config.currentValue);\n\n if (isValid || unconstrainedValue) {\n if (\n !config.updatePinnedDependencies &&\n !config.isLockfileOnly &&\n // TODO #22198\n versioningApi.isSingleVersion(compareValue!)\n ) {\n res.skipReason = 'is-pinned';\n return Result.ok(res);\n }\n\n const { val: releaseResult, err: lookupError } = await getRawPkgReleases(\n config,\n )\n .transform((res) => calculateMostRecentTimestamp(versioningApi, res))\n .transform((res) => calculateAbandonment(res, config))\n .transform((res) => applyDatasourceFilters(res, config))\n .unwrap();\n\n if (lookupError instanceof Error) {\n throw lookupError;\n }\n\n if (lookupError) {\n // If dependency lookup fails then warn and return\n const warning: ValidationMessage = {\n topic: config.packageName,\n message: `Failed to look up ${config.datasource} package ${config.packageName}: ${lookupError}`,\n };\n logger.debug(\n {\n dependency: config.packageName,\n packageFile: config.packageFile,\n },\n warning.message,\n );\n // TODO: return warnings in own field\n res.warnings.push(warning);\n return Result.ok(res);\n }\n\n dependency = releaseResult;\n\n if (dependency.deprecationMessage) {\n logger.debug(\n `Found deprecationMessage for ${config.datasource} package ${config.packageName}`,\n );\n }\n\n assignKeys(res, dependency, [\n 'deprecationMessage',\n 'sourceUrl',\n 'registryUrl',\n 'sourceDirectory',\n 'homepage',\n 'changelogUrl',\n 'dependencyUrl',\n 'lookupName',\n 'packageScope',\n 'mostRecentTimestamp',\n 'isAbandoned',\n 'respectLatest',\n ]);\n\n const latestVersion = dependency.tags?.latest;\n // Filter out any results from datasource that don't comply with our versioning\n let allVersions = dependency.releases.filter((release) =>\n versioningApi.isVersion(release.version),\n );\n const allReleaseVersions = new Set(allVersions.map((r) => r.version));\n // The datasources used in these tests always return at least one\n // version-like release, so neither this block nor the currentDigest\n // check inside it is reached. A lookup whose releases are all\n // unversioned tags does not get here either - with a digest configured\n // it takes the digest-only path above instead - see #40625\n // istanbul ignore if\n if (allVersions.length === 0) {\n const message = `Found no results from datasource that look like a version`;\n logger.info(\n {\n dependency: config.packageName,\n result: dependency,\n },\n message,\n );\n if (!config.currentDigest) {\n return Result.ok(res);\n }\n }\n // Reapply package rules in case we missed something from sourceUrl\n config = await applyPackageRules(\n { ...config, sourceUrl: res.sourceUrl },\n 'source-url',\n );\n if (config.followTag) {\n const taggedVersion = dependency.tags?.[config.followTag];\n if (!taggedVersion) {\n res.warnings.push({\n topic: config.packageName,\n message: `Can't find version with tag ${config.followTag} for ${config.datasource} package ${config.packageName}`,\n });\n return Result.ok(res);\n }\n allVersions = allVersions.filter(\n (v) =>\n v.version === taggedVersion ||\n (v.version === compareValue &&\n versioningApi.isGreaterThan(taggedVersion, compareValue)),\n );\n }\n\n const inRangeOnlyStrategy = config.rangeStrategy === 'in-range-only';\n // Check that existing constraint can be satisfied\n const allSatisfyingVersions =\n (inRangeOnlyStrategy || config.rollbackPrs) && !unconstrainedValue\n ? allVersions.filter((v) =>\n // TODO #22198\n versioningApi.matches(v.version, compareValue!),\n )\n : allVersions;\n if (!allSatisfyingVersions.length) {\n logger.debug(\n `Found no satisfying versions with '${config.versioning}' versioning`,\n );\n }\n\n if (config.rollbackPrs && !allSatisfyingVersions.length) {\n const rollback = getRollbackUpdate(config, allVersions, versioningApi);\n // istanbul ignore if\n if (!rollback) {\n res.warnings.push({\n topic: config.packageName,\n // TODO: types (#22198)\n message: `Can't find version matching ${compareValue!} for ${\n config.datasource\n } package ${config.packageName}`,\n });\n return Result.ok(res);\n }\n res.updates.push(rollback);\n }\n let rangeStrategy = getRangeStrategy(config);\n\n // istanbul ignore next\n if (\n config.isVulnerabilityAlert &&\n rangeStrategy === 'update-lockfile' &&\n !config.lockedVersion\n ) {\n rangeStrategy = 'bump';\n }\n // unconstrained deps with lockedVersion\n if (\n config.isVulnerabilityAlert &&\n !config.currentValue &&\n config.lockedVersion\n ) {\n rangeStrategy = 'update-lockfile';\n }\n const nonDeprecatedVersions = dependency.releases\n .filter((release) => !release.isDeprecated)\n .map((release) => release.version);\n let currentVersion: string;\n if (rangeStrategy === 'update-lockfile') {\n currentVersion = config.lockedVersion!;\n } else if (\n compareValue &&\n versioningApi.isSingleVersion(compareValue) &&\n allVersions.find((v) => v.version === compareValue)\n ) {\n currentVersion = compareValue;\n }\n // TODO #22198\n currentVersion ??=\n getCurrentVersion(\n compareValue!,\n config.lockedVersion!,\n versioningApi,\n rangeStrategy!,\n latestVersion!,\n nonDeprecatedVersions,\n ) ??\n getCurrentVersion(\n compareValue!,\n config.lockedVersion!,\n versioningApi,\n rangeStrategy!,\n latestVersion!,\n allVersions.map((v) => v.version),\n )!;\n\n if (!currentVersion) {\n // v8 ignore else -- TODO: add test #40625\n if (!config.lockedVersion) {\n logger.debug(\n `No currentVersion or lockedVersion found for ${config.packageName}`,\n );\n res.skipReason = 'invalid-value';\n }\n return Result.ok(res);\n }\n\n res.currentVersion = currentVersion;\n\n // Use lockedVersion for the timestamp lookup when available, because\n // res.currentVersion is later overwritten to lockedVersion (see below).\n // Without this, strategies like \"replace\" would compute the timestamp\n // for the highest satisfying version (e.g. 1.4.1) while the reported\n // currentVersion ends up being the locked one (e.g. 1.0.0).\n const versionForTimestamp = config.lockedVersion ?? currentVersion;\n const currentVersionTimestamp = await getTimestamp(\n config,\n allVersions,\n versionForTimestamp,\n versioningApi,\n );\n\n if (isNonEmptyString(currentVersionTimestamp)) {\n res.currentVersionTimestamp = currentVersionTimestamp;\n res.currentVersionAgeInDays = getElapsedDays(currentVersionTimestamp);\n\n if (\n config.packageRules?.some((rule) =>\n isNonEmptyString(rule.matchCurrentAge),\n )\n ) {\n // Reapply package rules to check matches for matchCurrentAge\n config = await applyPackageRules(\n { ...config, currentVersionTimestamp },\n 'current-timestamp',\n );\n }\n }\n\n if (\n config.currentDigest\n ? couldApplyMinimumReleaseAgeToDigest(config, 'digest')\n : config.pinDigests &&\n couldApplyMinimumReleaseAgeToDigest(config, 'pinDigest')\n ) {\n // Resolve from `allVersions` (not `dependency.releases`) so that filters like followTag apply, preferring non-deprecated versions with a fallback - both like the `currentVersion` resolution above.\n const newestMatchingVersion =\n getCurrentVersion(\n compareValue!,\n '',\n versioningApi,\n 'replace',\n latestVersion!,\n allVersions.filter((v) => !v.isDeprecated).map((v) => v.version),\n ) ??\n getCurrentVersion(\n compareValue!,\n '',\n versioningApi,\n 'replace',\n latestVersion!,\n allVersions.map((v) => v.version),\n );\n if (newestMatchingVersion) {\n newestMatchingVersionTimestamp = await getTimestamp(\n config,\n allVersions,\n newestMatchingVersion,\n versioningApi,\n );\n }\n }\n\n if (\n compareValue &&\n currentVersion &&\n rangeStrategy === 'pin' &&\n !versioningApi.isSingleVersion(compareValue)\n ) {\n const newValue =\n versioningApi.getPinnedValue?.(currentVersion) ?? currentVersion;\n res.updates.push({\n updateType: 'pin',\n isPin: true,\n newValue,\n newVersion: currentVersion,\n newMajor: versioningApi.getMajor(currentVersion)!,\n });\n }\n if (rangeStrategy === 'pin') {\n // Fall back to replace once pinning logic is done\n rangeStrategy = 'replace';\n }\n // A non-version can only get this far via a locked version under\n // rangeStrategy=pin, but the timestamp lookup above calls `equals()` on\n // it first and throws - see #40625\n // istanbul ignore if\n if (!versioningApi.isVersion(currentVersion!)) {\n res.skipReason = 'invalid-version';\n return Result.ok(res);\n }\n // Filter latest, unstable, etc\n // TODO #22198\n let filteredReleases = filterVersions(\n config,\n currentVersion!,\n latestVersion!,\n inRangeOnlyStrategy ? allSatisfyingVersions : allVersions,\n versioningApi,\n ).filter((v) => {\n if (config.isLockfileOnly) {\n return true;\n }\n\n // Leave only compatible versions\n return (\n unconstrainedValue ||\n versioningApi.isCompatible(v.version, compareValue)\n );\n });\n let shrinkedViaVulnerability = false;\n if (config.isVulnerabilityAlert) {\n if (config.vulnerabilityFixVersion) {\n res.vulnerabilityFixVersion = config.vulnerabilityFixVersion;\n res.vulnerabilityFixStrategy = config.vulnerabilityFixStrategy;\n if (versioningApi.isValid(config.vulnerabilityFixVersion)) {\n let fixedFilteredReleases;\n if (versioningApi.isVersion(config.vulnerabilityFixVersion)) {\n // Retain only releases greater than or equal to the fix version\n fixedFilteredReleases = filteredReleases.filter(\n (release) =>\n !versioningApi.isGreaterThan(\n config.vulnerabilityFixVersion!,\n release.version,\n ),\n );\n } else {\n // Retain only releases which max the fix constraint\n fixedFilteredReleases = filteredReleases.filter((release) =>\n versioningApi.matches(\n release.version,\n config.vulnerabilityFixVersion!,\n ),\n );\n }\n // Warn if this filtering results caused zero releases\n if (fixedFilteredReleases.length === 0 && filteredReleases.length) {\n logger.warn(\n {\n releases: filteredReleases,\n vulnerabilityFixVersion: config.vulnerabilityFixVersion,\n packageName: config.packageName,\n },\n 'No releases satisfy vulnerabilityFixVersion',\n );\n }\n // Use the additionally filtered releases\n filteredReleases = fixedFilteredReleases;\n } else {\n logger.warn(\n {\n vulnerabilityFixVersion: config.vulnerabilityFixVersion,\n packageName: config.packageName,\n },\n 'vulnerabilityFixVersion is not valid',\n );\n }\n }\n if (config.vulnerabilityFixStrategy === 'highest') {\n // Don't shrink the list of releases - let Renovate use its normal logic\n logger.once.debug(\n `Using vulnerabilityFixStrategy=highest for ${config.packageName}`,\n );\n } else {\n // Shrink the list of releases to the lowest fixed version\n logger.once.debug(\n `Using vulnerabilityFixStrategy=lowest for ${config.packageName}`,\n );\n filteredReleases = filteredReleases.slice(0, 1);\n shrinkedViaVulnerability = true;\n }\n }\n const buckets: Record<string, [Release]> = {};\n for (const release of filteredReleases) {\n const bucket = getBucket(\n config,\n // TODO #22198\n currentVersion!,\n release.version,\n versioningApi,\n );\n // `getBucket()` only returns null when the versioning api cannot\n // determine a major, but every release reaching it has already passed\n // `isVersion()`, so a null major contradicts that and the else looks\n // unreachable rather than merely untested\n // v8 ignore else -- see #40625\n if (isString(bucket)) {\n if (buckets[bucket]) {\n buckets[bucket].push(release);\n } else {\n buckets[bucket] = [release];\n }\n }\n }\n const depResultConfig = mergeChildConfig(config, res);\n for (const [bucket, releases] of Object.entries(buckets)) {\n const sortedReleases = releases.sort((r1, r2) =>\n versioningApi.sortVersions(r1.version, r2.version),\n );\n const { release, pendingChecks, pendingReleases } =\n await filterInternalChecks(\n depResultConfig,\n versioningApi,\n bucket,\n sortedReleases,\n );\n // `filterInternalChecks()` normally yields a release, falling back to\n // the newest pending one; only a datasource rejecting every candidate\n // during postprocessing leaves none - see #40625\n // istanbul ignore next\n if (!release) {\n return Result.ok(res);\n }\n const newVersion = release.version;\n const update = await generateUpdate(\n config,\n config.isLockfileOnly ? config.currentValue : compareValue,\n versioningApi,\n // TODO #22198\n\n rangeStrategy!,\n config.lockedVersion ?? currentVersion!,\n bucket,\n release,\n allReleaseVersions,\n );\n\n // #29034\n if (\n config.manager === 'gomod' &&\n compareValue?.startsWith('v0.0.0-') &&\n update.newValue?.startsWith('v0.0.0-') &&\n config.currentDigest !== update.newDigest\n ) {\n update.updateType = 'digest';\n\n // As this has already been processed by `filterInternalChecks()`, but we're changing the `updateType`, we need to apply the digest-scoped minimumReleaseAge rules.\n // `currentVersionWasResolved` only matters for `pinDigest`, which `update.updateType` never is here - true is a safe constant.\n await applyMinimumReleaseAgeToDigestUpdate(\n update as DigestLikeUpdate,\n config,\n res,\n true,\n release.releaseTimestamp,\n );\n }\n\n if (pendingChecks) {\n update.pendingChecks = pendingChecks;\n }\n\n if (pendingReleases.length) {\n update.pendingVersions = pendingReleases.map((r) => r.version);\n }\n if (!update.newValue || update.newValue === compareValue) {\n if (!config.lockedVersion) {\n continue;\n }\n // istanbul ignore if\n if (rangeStrategy === 'bump') {\n logger.trace(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n lockedVersion: config.lockedVersion,\n newVersion,\n },\n 'Skipping bump because newValue is the same',\n );\n continue;\n }\n res.isSingleVersion = true;\n }\n res.isSingleVersion ??=\n isString(update.newValue) &&\n versioningApi.isSingleVersion(update.newValue);\n // Guards against a docker downgrade, which the datasources used in\n // these tests never produce - see #40625\n // istanbul ignore if\n if (\n config.versioning === dockerVersioningId &&\n update.updateType !== 'rollback' &&\n update.newValue &&\n versioningApi.isVersion(update.newValue) &&\n compareValue &&\n versioningApi.isVersion(compareValue) &&\n versioningApi.isGreaterThan(compareValue, update.newValue)\n ) {\n logger.warn(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n compareValue,\n currentVersion: config.currentVersion,\n update,\n allVersionsLength: allVersions.length,\n filteredReleaseVersions: filteredReleases.map((r) => r.version),\n shrinkedViaVulnerability,\n },\n 'Unexpected downgrade detected: skipping',\n );\n } else {\n res.updates.push(update);\n }\n }\n } else if (compareValue) {\n logger.debug(\n `Dependency ${config.packageName} has unsupported/unversioned value ${compareValue} (versioning=${config.versioning})`,\n );\n\n if (!config.pinDigests && !config.currentDigest) {\n logger.debug(\n `Skipping ${config.packageName} because no currentDigest or pinDigests`,\n );\n res.skipReason = 'invalid-value';\n } else {\n delete res.skipReason;\n }\n } else {\n res.skipReason = 'invalid-value';\n }\n\n if (isReplacementRulesConfigured(config)) {\n addReplacementUpdateIfValid(res.updates, config);\n } else if (dependency?.replacementName && dependency.replacementVersion) {\n res.updates.push({\n updateType: 'replacement',\n newName: dependency.replacementName,\n newValue: dependency.replacementVersion,\n });\n }\n\n // Record if the dep is fixed to a version\n if (config.lockedVersion) {\n res.currentVersion = config.lockedVersion;\n res.fixedVersion = config.lockedVersion;\n } else if (compareValue && versioningApi.isSingleVersion(compareValue)) {\n res.fixedVersion = compareValue.replace(regEx(/^=+/), '');\n }\n\n // massage versionCompatibility\n if (\n isString(config.currentValue) &&\n isString(compareValue) &&\n isString(config.versionCompatibility)\n ) {\n for (const update of res.updates) {\n logger.debug({ update });\n // The enclosing condition already requires a string `currentValue`,\n // so only a null `newValue` takes the else\n // v8 ignore else -- see #40625\n if (isString(config.currentValue) && isString(update.newValue)) {\n update.newValue = config.currentValue.replace(\n compareValue,\n update.newValue,\n );\n }\n }\n }\n\n // Add digests if necessary\n if (supportsDigests(config.datasource)) {\n if (config.currentDigest) {\n if (!config.digestOneAndOnly || !res.updates.length) {\n // digest update - age-checked after the strip below, once newDigest is known\n digestUpdate = {\n updateType: 'digest',\n newValue: config.currentValue,\n };\n res.updates.push(digestUpdate);\n }\n } else if (\n config.pinDigests &&\n // only update the digest in the package file if it's managed by us\n !config.digestManagedExternally &&\n // Create a pin only if one doesn't already exists\n // v8 ignore else -- TODO: add test #40625\n !res.updates.some((update) => update.updateType === 'pin')\n ) {\n // pin digest\n const pinDigestUpdate: DigestLikeUpdate = {\n isPinDigest: true,\n updateType: 'pinDigest',\n newValue: config.currentValue,\n };\n await applyMinimumReleaseAgeToDigestUpdate(\n pinDigestUpdate,\n config,\n res,\n isValid || unconstrainedValue,\n newestMatchingVersionTimestamp,\n );\n res.updates.push(pinDigestUpdate);\n }\n if (versioningApi.valueToVersion) {\n // TODO #22198\n res.currentVersion = versioningApi.valueToVersion(res.currentVersion!);\n for (const update of res.updates) {\n // TODO #22198\n update.newVersion = versioningApi.valueToVersion(update.newVersion!);\n }\n }\n if (res.registryUrl) {\n config.registryUrls = [res.registryUrl];\n }\n\n // update digest for all\n for (const update of res.updates) {\n // only update the digest in the package file if it's managed by us\n if (\n (config.pinDigests === true && !config.digestManagedExternally) ||\n config.currentDigest\n ) {\n const getDigestConfig: GetDigestInputConfig = {\n ...config,\n registryUrl: update.registryUrl ?? res.registryUrl,\n lookupName: res.lookupName,\n };\n\n // #20304 only pass it for replacement updates, otherwise we get wrong or invalid digest\n if (update.updateType !== 'replacement') {\n delete getDigestConfig.replacementName;\n }\n\n // #20304 don't use lookupName and currentDigest when we replace image name\n if (\n update.updateType === 'replacement' &&\n update.newName !== config.packageName\n ) {\n delete getDigestConfig.lookupName;\n delete getDigestConfig.currentDigest;\n getDigestConfig.replacementName = update.newName;\n }\n\n // Don't use current releases if replacement changes name, otherwise we use the wrong new digest.\n // This happens on datasources which return the digest in release info like `github-tags`.\n // We can still use it when only version is changing.\n if (\n update.updateType !== 'replacement' ||\n update.newName === config.packageName\n ) {\n update.newDigest ??= dependency?.releases.find(\n (r) => r.version === update.newValue,\n )?.newDigest;\n }\n\n update.newDigest ??= await getDigest(\n getDigestConfig,\n update.newValue,\n );\n\n // If the digest could not be determined, report this as otherwise the\n // update will be omitted later on without notice.\n if (update.newDigest === null) {\n logger.debug(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n datasource: config.datasource,\n newValue: update.newValue,\n bucket: update.bucket,\n },\n 'Could not determine new digest for update.',\n );\n\n // Only report a warning if there is a current digest.\n // Context: https://github.com/renovatebot/renovate/pull/20175#discussion_r1102615059.\n if (config.currentDigest) {\n res.warnings.push({\n message: `Could not determine new digest for update (${config.datasource} package ${config.packageName})`,\n topic: config.packageName,\n });\n }\n }\n } else {\n delete update.newDigest;\n }\n if (update.newVersion) {\n const registryUrl = dependency?.releases?.find(\n (release) => release.version === update.newVersion,\n )?.registryUrl;\n if (registryUrl && registryUrl !== res.registryUrl) {\n update.registryUrl = registryUrl;\n }\n }\n }\n }\n\n if (res.updates.length) {\n delete res.skipReason;\n }\n // Strip out any non-changed ones\n res.updates = res.updates\n .filter(\n (update) => update.newValue !== null || config.currentValue === null,\n )\n .filter((update) => update.newDigest !== null)\n .filter(\n (update) =>\n (isString(update.newName) && update.newName !== config.packageName) ||\n update.isReplacement === true ||\n update.newValue !== config.currentValue ||\n update.isLockfileUpdate === true ||\n // TODO #22198\n (update.newDigest &&\n !update.newDigest.startsWith(config.currentDigest!)),\n );\n // If range strategy specified in config is 'in-range-only', also strip out updates where currentValue !== newValue\n if (config.rangeStrategy === 'in-range-only') {\n res.updates = res.updates.filter(\n (update) => update.newValue === config.currentValue,\n );\n }\n // Handle a weird edge case involving followTag and fallbacks\n if (config.rollbackPrs && config.followTag) {\n res.updates = res.updates.filter(\n (update) =>\n update.updateType !== 'rollback' || res.updates.length === 1,\n );\n }\n\n // If there is a digest update proposed which is in the pending updates for this dependency, ensure that `minimumReleaseAge` is applied.\n // `currentVersionWasResolved` only matters for `pinDigest`, which `digestUpdate` never is - true is a safe constant.\n if (digestUpdate && res.updates.includes(digestUpdate)) {\n await applyMinimumReleaseAgeToDigestUpdate(\n digestUpdate,\n config,\n res,\n true,\n newestMatchingVersionTimestamp,\n );\n }\n\n const release =\n res.updates.length > 0\n ? (dependency?.releases.find(\n (r) => r.version === res.updates[0].newValue,\n ) ??\n dependency?.releases.find(\n (r) => r.version === res.updates[0].newVersion,\n ))\n : null;\n\n if (release?.changelogContent) {\n res.changelogContent = release.changelogContent;\n res.changelogUrl = release.changelogUrl;\n }\n } catch (err) /* istanbul ignore next */ {\n if (err instanceof ExternalHostError) {\n return Result.err(err);\n }\n\n if (err instanceof Error && err.message === CONFIG_VALIDATION) {\n return Result.err(err);\n }\n\n logger.error(\n {\n currentDigest: config.currentDigest,\n currentValue: config.currentValue,\n datasource: config.datasource,\n packageName: config.packageName,\n digestOneAndOnly: config.digestOneAndOnly,\n followTag: config.followTag,\n lockedVersion: config.lockedVersion,\n packageFile: config.packageFile,\n pinDigests: config.pinDigests,\n rollbackPrs: config.rollbackPrs,\n isVulnerabilityAlert: config.isVulnerabilityAlert,\n updatePinnedDependencies: config.updatePinnedDependencies,\n err,\n },\n 'lookupUpdates error',\n );\n res.skipReason = 'internal-error';\n }\n return Result.ok(res);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,eAAe,aACb,QACA,UACA,SACA,eACuC;CACvC,MAAM,iBAAiB,SAAS,MAC7B,MACC,cAAc,QAAQ,EAAE,OAAO,KAC/B,cAAc,OAAO,EAAE,SAAS,OAAO,CAC3C;CAEA,IAAI,CAAC,gBACH,OAAO;CAGT,IAAI,eAAe,kBACjB,OAAO,eAAe;CAIxB,QAAO,MADqB,mBAAmB,QAAQ,cAAc,EAAA,EAC/C;AACxB;;;;;;AAUA,SAAS,oCACP,QACA,YACS;CAIT,IAAI,OAAO,yBAAyB,QAClC,OAAO;CAGT,OACE,iBAAiB,OAAO,iBAAiB,KACzC,iBAAiB,OAAO,WAAW,EAAE,iBAAiB,KACtD,CAAC,CAAC,OAAO,cAAc,MAAM,SAC3B,iBAAiB,KAAK,iBAAiB,CACzC;AAEJ;;;;;;AAOA,eAAe,qCACb,QACA,QACA,KACA,2BACA,gCACe;CACf,IAAI,CAAC,oCAAoC,QAAQ,OAAO,UAAU,GAChE;CAGF,IAAI,OAAO,eAAe,eAAe,CAAC,2BAA2B;EAMnE,OAAO,KAAK,MACV;GAAE,SAAS,OAAO;GAAS,YAAY,OAAO;EAAW,GACzD,wCAAwC,OAAO,WAAW,aAAa,OAAO,QAAQ,+DACxF;EACA;CACF;CAEA,IAAI,gBAAoC;EACtC,GAAG,iBAAiB,QAAQ,GAAG;EAC/B,YAAY,OAAO;CACrB;CACA,gBAAgB,iBACd,eACA,cAAc,OAAO,WACvB;CACA,gBAAgB,MAAM,kBAAkB,eAAe,aAAa;CAMpE,MAAM,WAAW,uBACf,eACA,8BACF;CAGA,IAAI,SAAS,uBAAuB,CAAC,SAAS,cAAc;EAC1D,IAAI,cAAc,+BAA+B,sBAC/C,OAAO,KAAK,KACV,2KACF;EAGF,OAAO,KAAK,MACV;G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AAQ,QACvB,WAAW,OAAO,aAAa,OAAO,YACzC;EAGF,IAAI,OAAO,eAAe,OAAO,WAC/B,IAAI,UAAU,IAAI,QAAQ,QACvB,WACC,OAAO,eAAe,cAAc,IAAI,QAAQ,WAAW,CAC/D;EAKF,IAAI,gBAAgB,IAAI,QAAQ,SAAS,YAAY,GACnD,MAAM,qCACJ,cACA,QACA,KACA,MACA,8BACF;EAGF,MAAM,UACJ,IAAI,QAAQ,SAAS,IAChB,YAAY,SAAS,MACnB,MAAM,EAAE,YAAY,IAAI,QAAQ,EAAE,CAAC,QACtC,KACA,YAAY,SAAS,MAClB,MAAM,EAAE,YAAY,IAAI,QAAQ,EAAE,CAAC,UACtC,IACA;EAEN,IAAI,SAAS,kBAAkB;GAC7B,IAAI,mBAAmB,QAAQ;GAC/B,IAAI,eAAe,QAAQ;EAC7B;CACF,SAAS,gCAAgC;EACvC,IAAI,eAAe,mBACjB,OAAO,OAAO,IAAI,GAAG;EAGvB,IAAI,eAAe,SAAS,IAAI,YAAA,qBAC9B,OAAO,OAAO,IAAI,GAAG;EAGvB,OAAO,MACL;GACE,eAAe,OAAO;GACtB,cAAc,OAAO;GACrB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,kBAAkB,OAAO;GACzB,WAAW,OAAO;GAClB,eAAe,OAAO;GACtB,aAAa,OAAO;GACpB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,sBAAsB,OAAO;GAC7B,0BAA0B,OAAO;GACjC;EACF,GACA,qBACF;EACA,IAAI,aAAa;CACnB;CACA,OAAO,OAAO,GAAG,GAAG;AACtB"}
@@ -1,5 +1,6 @@
1
1
  import { WORKER_FILE_UPDATE_FAILED } from "../../../../constants/error-messages.js";
2
2
  import { GlobalConfig } from "../../../../config/global.js";
3
+ import { coerceArray } from "../../../../util/array.js";
3
4
  import { coerceString } from "../../../../util/string.js";
4
5
  import { logger } from "../../../../logger/index.js";
5
6
  import { getFile } from "../../../../util/git/index.js";
@@ -23,6 +24,40 @@ function hasAny(set, targets) {
23
24
  for (const target of targets) if (set.has(target)) return true;
24
25
  return false;
25
26
  }
27
+ function getUpdatedLockFileContent(updatedDeps, updatedFileContents) {
28
+ for (const upgrade of updatedDeps) {
29
+ const lockFiles = [upgrade.lockFile, ...coerceArray(upgrade.lockFiles)];
30
+ for (const lockFile of lockFiles) if (lockFile && updatedFileContents[lockFile] !== void 0) return updatedFileContents[lockFile];
31
+ }
32
+ }
33
+ function removeUnrefreshedLockfileOnlyChanges(packageFiles, updatedDeps, results) {
34
+ const removedLockFiles = [];
35
+ const refreshedFiles = new Set(coerceArray(results).flatMap((result) => result.file ? [result.file.path] : []));
36
+ const lockFiles = new Set(updatedDeps.filter((upgrade) => upgrade.isLockfileOnly).flatMap((upgrade) => [upgrade.lockFile, ...coerceArray(upgrade.lockFiles)]));
37
+ for (let index = packageFiles.length - 1; index >= 0; index -= 1) {
38
+ const path = packageFiles[index].path;
39
+ if (lockFiles.has(path) && !refreshedFiles.has(path)) {
40
+ packageFiles.splice(index, 1);
41
+ removedLockFiles.push(path);
42
+ }
43
+ }
44
+ return removedLockFiles;
45
+ }
46
+ function reportUnrefreshedLockfileOnlyChanges(removedLockFiles, results, artifactErrors) {
47
+ const artifactErrorFiles = new Set(coerceArray(results).flatMap((result) => result.artifactError ? [result.artifactError.fileName] : []));
48
+ for (const lockFile of removedLockFiles) if (!artifactErrorFiles.has(lockFile)) artifactErrors.push({
49
+ fileName: lockFile,
50
+ stderr: "Lockfile-only update could not be refreshed"
51
+ });
52
+ }
53
+ function removeSupersededLockFileChanges(packageFiles, updatedDeps, results) {
54
+ const artifactFiles = new Set(coerceArray(results).flatMap((result) => result.file ? [result.file.path] : []));
55
+ const lockFiles = new Set(updatedDeps.filter((upgrade) => upgrade.isLockfileOnly).flatMap((upgrade) => [upgrade.lockFile, ...coerceArray(upgrade.lockFiles)]));
56
+ for (let index = packageFiles.length - 1; index >= 0; index -= 1) {
57
+ const path = packageFiles[index].path;
58
+ if (lockFiles.has(path) && artifactFiles.has(path)) packageFiles.splice(index, 1);
59
+ }
60
+ }
26
61
  function getManagersForPackageFiles(packageFiles, managerPackageFiles) {
27
62
  const packageFileNames = packageFiles.map((packageFile) => packageFile.path);
28
63
  return new Set(Object.keys(managerPackageFiles).filter((manager) => hasAny(managerPackageFiles[manager], packageFileNames)));
@@ -233,8 +268,13 @@ async function getUpdatedPackageFiles(config) {
233
268
  packageFileName: packageFile.path,
234
269
  updatedDeps,
235
270
  newPackageFileContent: packageFile.contents.toString(),
271
+ newLockFileContent: getUpdatedLockFileContent(updatedDeps, updatedFileContents),
236
272
  config: patchConfigForArtifactsUpdate(config, manager, packageFile.path)
237
273
  });
274
+ if (manager === "mise") {
275
+ reportUnrefreshedLockfileOnlyChanges(removeUnrefreshedLockfileOnlyChanges(updatedPackageFiles, updatedDeps, results), results, artifactErrors);
276
+ removeSupersededLockFileChanges(updatedPackageFiles, updatedDeps, results);
277
+ }
238
278
  processUpdateArtifactResults(results, updatedArtifacts, artifactErrors, artifactNotices);
239
279
  if (isNonEmptyArray(results)) await checkForPendingVersions(manager, packageFile.path, packageFile.contents.toString(), updatedDeps, artifactErrors, config);
240
280
  }
@@ -257,6 +297,7 @@ async function getUpdatedPackageFiles(config) {
257
297
  packageFileName: packageFile.path,
258
298
  updatedDeps,
259
299
  newPackageFileContent: packageFile.contents.toString(),
300
+ newLockFileContent: getUpdatedLockFileContent(updatedDeps, updatedFileContents),
260
301
  config: patchConfigForArtifactsUpdate(config, manager, packageFile.path)
261
302
  });
262
303
  processUpdateArtifactResults(results, updatedArtifacts, artifactErrors, artifactNotices);