renovate 44.99.0 → 44.101.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/modules/manager/bun/artifacts.js +25 -22
  2. package/dist/modules/manager/bun/artifacts.js.map +1 -1
  3. package/dist/modules/manager/deno/artifacts.js +38 -35
  4. package/dist/modules/manager/deno/artifacts.js.map +1 -1
  5. package/dist/modules/manager/devbox/artifacts.js +6 -6
  6. package/dist/modules/manager/devbox/artifacts.js.map +1 -1
  7. package/dist/modules/manager/dockerfile/apk.js +3 -65
  8. package/dist/modules/manager/dockerfile/apk.js.map +1 -1
  9. package/dist/modules/manager/dockerfile/deb.js +108 -0
  10. package/dist/modules/manager/dockerfile/deb.js.map +1 -0
  11. package/dist/modules/manager/dockerfile/extract.js +2 -1
  12. package/dist/modules/manager/dockerfile/extract.js.map +1 -1
  13. package/dist/modules/manager/dockerfile/index.js +6 -1
  14. package/dist/modules/manager/dockerfile/index.js.map +1 -1
  15. package/dist/modules/manager/dockerfile/run-command.js +92 -0
  16. package/dist/modules/manager/dockerfile/run-command.js.map +1 -0
  17. package/dist/modules/manager/fingerprint.generated.js +3 -3
  18. package/dist/modules/manager/fingerprint.generated.js.map +1 -1
  19. package/dist/modules/manager/npm/artifacts.js +20 -22
  20. package/dist/modules/manager/npm/artifacts.js.map +1 -1
  21. package/dist/modules/manager/npm/post-update/index.js +113 -116
  22. package/dist/modules/manager/npm/post-update/index.js.map +1 -1
  23. package/dist/modules/manager/npm/utils.js +15 -1
  24. package/dist/modules/manager/npm/utils.js.map +1 -1
  25. package/dist/modules/manager/types.d.ts +6 -2
  26. package/dist/modules/manager/util.js +9 -2
  27. package/dist/modules/manager/util.js.map +1 -1
  28. package/package.json +1 -1
  29. package/renovate-schema.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"extract.js","names":["ubuntuVersioning.id","debianVersioning.id"],"sources":["../../../../lib/modules/manager/dockerfile/extract.ts"],"sourcesContent":["import {\n isNonEmptyStringAndNotWhitespace,\n isNumericString,\n isString,\n} from '@sindresorhus/is';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\nimport { ensureTrailingSlash } from '../../../util/url.ts';\nimport { DockerDatasource } from '../../datasource/docker/index.ts';\nimport * as debianVersioning from '../../versioning/debian/index.ts';\nimport * as ubuntuVersioning from '../../versioning/ubuntu/index.ts';\nimport type {\n ExtractConfig,\n PackageDependency,\n PackageFileContent,\n} from '../types.ts';\nimport { extractApkDeps } from './apk.ts';\n\nconst variableMarker = '$';\n\nexport function extractVariables(image: string): Record<string, string> {\n const variables: Record<string, string> = {};\n const variableRegex = regEx(\n /(?<fullvariable>\\\\?\\$(?<simplearg>\\w+)|\\\\?\\${(?<complexarg>\\w+)(?::.+?)?}+)/gi,\n );\n\n let match: RegExpExecArray | null;\n do {\n match = variableRegex.exec(image);\n if (match?.groups?.fullvariable) {\n variables[match.groups.fullvariable] =\n match.groups?.simplearg || match.groups?.complexarg;\n }\n } while (match);\n\n return variables;\n}\n\nfunction getAutoReplaceTemplate(dep: PackageDependency): string | undefined {\n let template = dep.replaceString;\n\n if (dep.currentValue) {\n let placeholder = '{{#if newValue}}{{newValue}}{{/if}}';\n if (!dep.currentDigest) {\n placeholder += '{{#if newDigest}}@{{newDigest}}{{/if}}';\n }\n template = template?.replace(dep.currentValue, placeholder);\n }\n\n if (dep.currentDigest) {\n template = template?.replace(\n dep.currentDigest,\n '{{#if newDigest}}{{newDigest}}{{/if}}',\n );\n }\n\n return template;\n}\n\nfunction processDepForAutoReplace(\n dep: PackageDependency,\n lineNumberRanges: number[][],\n lines: string[],\n linefeed: string,\n): void {\n const lineNumberRangesToReplace: number[][] = [];\n for (const lineNumberRange of lineNumberRanges) {\n for (const lineNumber of lineNumberRange) {\n if (\n (isString(dep.currentValue) &&\n lines[lineNumber].includes(dep.currentValue)) ||\n (isString(dep.currentDigest) &&\n lines[lineNumber].includes(dep.currentDigest))\n ) {\n lineNumberRangesToReplace.push(lineNumberRange);\n }\n }\n }\n\n lineNumberRangesToReplace.sort((a, b) => {\n return a[0] - b[0];\n });\n\n const minLine = lineNumberRangesToReplace[0]?.[0];\n const maxLine = lineNumberRangesToReplace.at(-1)?.[1];\n if (\n lineNumberRanges.length === 1 ||\n minLine === undefined ||\n maxLine === undefined\n ) {\n return;\n }\n\n const unfoldedLineNumbers = Array.from(\n { length: maxLine - minLine + 1 },\n (_v, k) => k + minLine,\n );\n\n dep.replaceString = unfoldedLineNumbers\n .map((lineNumber) => lines[lineNumber])\n .join(linefeed);\n\n if (!dep.currentDigest) {\n dep.replaceString += linefeed;\n }\n\n dep.autoReplaceStringTemplate = getAutoReplaceTemplate(dep);\n}\n\nexport function splitImageParts(currentFrom: string): PackageDependency {\n let isVariable = false;\n let cleanedCurrentFrom = currentFrom;\n\n // Check if we have a variable in format of \"${VARIABLE:-<image>:<defaultVal>@<digest>}\"\n // If so, remove everything except the image, defaultVal and digest.\n if (cleanedCurrentFrom?.includes(variableMarker)) {\n const defaultValueRegex = regEx(/^\\${.+?:-\"?(?<value>.*?)\"?}$/);\n const defaultValueMatch =\n defaultValueRegex.exec(cleanedCurrentFrom)?.groups;\n if (defaultValueMatch?.value) {\n isVariable = true;\n cleanedCurrentFrom = defaultValueMatch.value;\n }\n\n if (cleanedCurrentFrom?.includes(variableMarker)) {\n // If cleanedCurrentFrom contains a variable, after cleaning, e.g. \"$REGISTRY/alpine\", we do not support this.\n return {\n skipReason: 'contains-variable',\n };\n }\n }\n\n const [currentDepTag, currentDigest] = cleanedCurrentFrom.split('@');\n const depTagSplit = currentDepTag.split(':');\n let depName: string;\n let currentValue: string | undefined;\n if (depTagSplit.length === 1 || depTagSplit.at(-1)!.includes('/')) {\n depName = currentDepTag;\n } else {\n currentValue = depTagSplit.pop();\n depName = depTagSplit.join(':');\n }\n\n const dep: PackageDependency = {\n depName,\n packageName: depName,\n currentValue,\n currentDigest,\n };\n\n if (isVariable) {\n dep.replaceString = cleanedCurrentFrom;\n\n if (!dep.currentValue) {\n delete dep.currentValue;\n }\n\n if (!dep.currentDigest) {\n delete dep.currentDigest;\n }\n }\n\n return dep;\n}\n\nconst quayRegex = regEx(/^quay\\.io(?::[1-9][0-9]{0,4})?/i);\n\nexport function getDep(\n currentFrom: string | null | undefined,\n specifyReplaceString = true,\n registryAliases?: Record<string, string>,\n): PackageDependency {\n if (\n !isString(currentFrom) ||\n !isNonEmptyStringAndNotWhitespace(currentFrom)\n ) {\n return {\n skipReason: 'invalid-value',\n };\n }\n\n // Resolve registry aliases first so that we don't need special casing later on:\n for (const [name, value] of Object.entries(coerceObject(registryAliases))) {\n // Allow `${VAR}`/`${VAR:-...}` keys to match without a trailing slash\n // (`}` is an unambiguous boundary). Bare identifier keys like\n // `$CI_REGISTRY` still require `/` so they can't eat `$CI_REGISTRY_IMAGE/`.\n const matchedWithSlash = currentFrom.startsWith(`${name}/`);\n const matchedAtBoundary =\n name.endsWith('}') && currentFrom.startsWith(name);\n if (!matchedWithSlash && !matchedAtBoundary) {\n continue;\n }\n const depName = currentFrom.slice(\n matchedWithSlash ? name.length + 1 : name.length,\n );\n // An empty alias value means \"no registry prefix\", i.e. Docker Hub.\n const valueWithSlash = value ? ensureTrailingSlash(value) : '';\n const dep = getDep(`${valueWithSlash}${depName}`, false);\n // TODO: when the inner getDep strips a `library/` prefix (or similar)\n // the depName no longer starts with `valueWithSlash` and the alias-rooted\n // depName is not restored.\n if (dep.depName?.startsWith(valueWithSlash)) {\n dep.packageName = dep.depName;\n const [imageAndTag] = currentFrom.split('@');\n dep.depName = dep.currentValue\n ? imageAndTag.substring(0, imageAndTag.lastIndexOf(':'))\n : imageAndTag;\n }\n if (specifyReplaceString) {\n dep.replaceString = currentFrom;\n dep.autoReplaceStringTemplate = getAutoReplaceTemplate(dep);\n }\n return dep;\n }\n\n const dep = splitImageParts(currentFrom);\n if (specifyReplaceString) {\n dep.replaceString ??= currentFrom;\n dep.autoReplaceStringTemplate =\n '{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}';\n }\n dep.datasource = DockerDatasource.id;\n\n // Pretty up special prefixes\n if (dep.depName) {\n const specialPrefixes = ['amd64', 'arm64', 'library'];\n for (const prefix of specialPrefixes) {\n if (dep.depName.startsWith(`${prefix}/`)) {\n dep.depName = dep.depName.replace(`${prefix}/`, '');\n if (specifyReplaceString) {\n dep.autoReplaceStringTemplate =\n '{{packageName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}';\n }\n }\n }\n }\n\n if (dep.depName === 'ubuntu' || dep.depName?.endsWith('/ubuntu')) {\n dep.versioning = ubuntuVersioning.id;\n }\n\n if (\n (dep.depName === 'debian' || dep.depName?.endsWith('/debian')) &&\n debianVersioning.api.isVersion(dep.currentValue)\n ) {\n dep.versioning = debianVersioning.id;\n }\n\n // Don't display quay.io ports\n if (dep.depName && quayRegex.test(dep.depName)) {\n const depName = dep.depName.replace(quayRegex, 'quay.io');\n if (depName !== dep.depName) {\n dep.depName = depName;\n dep.autoReplaceStringTemplate =\n '{{packageName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}';\n }\n }\n\n return dep;\n}\n\nexport function extractPackageFile(\n content: string,\n _packageFile: string,\n config: ExtractConfig,\n): PackageFileContent | null {\n const sanitizedContent = content.replace(regEx(/^\\uFEFF/), ''); // remove bom marker\n const deps: PackageDependency[] = [];\n const stageNames: string[] = [];\n const args: Record<string, string> = {};\n const argsLines: Record<string, number[]> = {};\n\n let escapeChar = '\\\\\\\\';\n let lookForEscapeChar = true;\n let lookForSyntaxDirective = true;\n\n const lineFeed = sanitizedContent.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const lines = sanitizedContent.split(newlineRegex);\n for (let lineNumber = 0; lineNumber < lines.length;) {\n const lineNumberInstrStart = lineNumber;\n let instruction = lines[lineNumber];\n\n if (lookForEscapeChar) {\n const directivesMatch = regEx(\n /^[ \\t]*#[ \\t]*(?<directive>syntax|escape)[ \\t]*=[ \\t]*(?<escapeChar>\\S)/i,\n ).exec(instruction);\n if (!directivesMatch) {\n lookForEscapeChar = false;\n } else if (directivesMatch.groups?.directive.toLowerCase() === 'escape') {\n if (directivesMatch.groups?.escapeChar === '`') {\n escapeChar = '`';\n }\n lookForEscapeChar = false;\n }\n }\n\n if (lookForSyntaxDirective) {\n const syntaxRegex = regEx(\n '^#[ \\\\t]*syntax[ \\\\t]*=[ \\\\t]*(?<image>\\\\S+)',\n 'im',\n );\n const syntaxMatch = instruction.match(syntaxRegex);\n if (syntaxMatch?.groups?.image) {\n const syntaxImage = syntaxMatch.groups.image;\n const lineNumberRanges: number[][] = [\n [lineNumberInstrStart, lineNumber],\n ];\n const dep = getDep(syntaxImage, true, config.registryAliases);\n dep.depType = 'syntax';\n processDepForAutoReplace(dep, lineNumberRanges, lines, lineFeed);\n logger.trace(\n {\n depName: dep.depName,\n currentValue: dep.currentValue,\n currentDigest: dep.currentDigest,\n },\n 'Dockerfile # syntax',\n );\n deps.push(dep);\n }\n lookForSyntaxDirective = false;\n }\n\n const lineContinuationRegex = regEx(`${escapeChar}[ \\\\t]*$|^[ \\\\t]*#`, 'm');\n let lineLookahead = instruction;\n while (\n !lookForEscapeChar &&\n !instruction.trimStart().startsWith('#') &&\n lineContinuationRegex.test(lineLookahead)\n ) {\n lineLookahead = lines[++lineNumber] || '';\n instruction += `\\n${lineLookahead}`;\n }\n\n const argRegex = regEx(\n `^[ \\\\t]*ARG(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n)+(?<name>\\\\w+)[ =](?<value>\\\\S*)`,\n 'im',\n );\n const argMatch = argRegex.exec(instruction);\n if (argMatch?.groups?.name) {\n argsLines[argMatch.groups.name] = [lineNumberInstrStart, lineNumber];\n let argMatchValue = argMatch.groups?.value;\n\n if (\n (argMatchValue.startsWith('\"') && argMatchValue.endsWith('\"')) ||\n (argMatchValue.startsWith(\"'\") && argMatchValue.endsWith(\"'\"))\n ) {\n argMatchValue = argMatchValue.slice(1, -1);\n }\n\n args[argMatch.groups.name] = argMatchValue || '';\n }\n\n const fromRegex = regEx(\n `^[ \\\\t]*FROM(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n|--platform=\\\\S+)+(?<image>\\\\S+)(?:(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n)+as[ \\\\t]+(?<name>\\\\S+))?`,\n 'im',\n );\n const fromMatch = instruction.match(fromRegex);\n if (fromMatch?.groups?.image) {\n let fromImage = fromMatch.groups.image;\n const lineNumberRanges: number[][] = [[lineNumberInstrStart, lineNumber]];\n\n if (fromImage.includes(variableMarker)) {\n const variables = extractVariables(fromImage);\n for (const [fullVariable, argName] of Object.entries(variables)) {\n const resolvedArgValue = args[argName];\n if (resolvedArgValue || resolvedArgValue === '') {\n fromImage = fromImage.replaceAll(fullVariable, resolvedArgValue);\n lineNumberRanges.push(argsLines[argName]);\n }\n }\n }\n\n if (fromMatch.groups?.name) {\n logger.debug(\n `Found a multistage build stage name: ${fromMatch.groups.name}`,\n );\n stageNames.push(fromMatch.groups.name);\n }\n if (fromImage === 'scratch') {\n logger.debug('Skipping scratch');\n } else if (fromImage && stageNames.includes(fromImage)) {\n logger.debug(`Skipping alias FROM image:${fromImage}`);\n } else {\n const dep = getDep(fromImage, true, config.registryAliases);\n processDepForAutoReplace(dep, lineNumberRanges, lines, lineFeed);\n logger.trace(\n {\n depName: dep.depName,\n currentValue: dep.currentValue,\n currentDigest: dep.currentDigest,\n },\n 'Dockerfile FROM',\n );\n deps.push(dep);\n }\n }\n\n const copyFromRegex = regEx(\n `^[ \\\\t]*COPY(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n|--[a-z]+(?:=[a-zA-Z0-9_.:-]+?)?)+--from=(?<image>\\\\S+)`,\n 'im',\n );\n const copyFromMatch = instruction.match(copyFromRegex);\n if (copyFromMatch?.groups?.image) {\n if (stageNames.includes(copyFromMatch.groups.image)) {\n logger.debug(\n { image: copyFromMatch.groups.image },\n 'Skipping alias COPY --from',\n );\n } else if (isNumericString(copyFromMatch.groups.image)) {\n logger.debug(\n { image: copyFromMatch.groups.image },\n 'Skipping index reference COPY --from',\n );\n } else {\n const dep = getDep(\n copyFromMatch.groups.image,\n true,\n config.registryAliases,\n );\n const lineNumberRanges: number[][] = [\n [lineNumberInstrStart, lineNumber],\n ];\n processDepForAutoReplace(dep, lineNumberRanges, lines, lineFeed);\n logger.debug(\n {\n depName: dep.depName,\n currentValue: dep.currentValue,\n currentDigest: dep.currentDigest,\n },\n 'Dockerfile COPY --from',\n );\n deps.push(dep);\n }\n }\n\n const runMountFromRegex = regEx(\n `^[ \\\\t]*RUN(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n|--[a-z]+(?:=[a-zA-Z0-9_.:-]+?)?)+--mount=(?:\\\\S*=\\\\S*,)*from=(?<image>[^, ]+)`,\n 'im',\n );\n const runMountFromMatch = instruction.match(runMountFromRegex);\n if (runMountFromMatch?.groups?.image) {\n if (stageNames.includes(runMountFromMatch.groups.image)) {\n logger.debug(\n { image: runMountFromMatch.groups.image },\n 'Skipping alias RUN --mount=from',\n );\n } else {\n const dep = getDep(\n runMountFromMatch.groups.image,\n true,\n config.registryAliases,\n );\n const lineNumberRanges: number[][] = [\n [lineNumberInstrStart, lineNumber],\n ];\n processDepForAutoReplace(dep, lineNumberRanges, lines, lineFeed);\n logger.debug(\n {\n depName: dep.depName,\n currentValue: dep.currentValue,\n currentDigest: dep.currentDigest,\n },\n 'Dockerfile RUN --mount=from',\n );\n deps.push(dep);\n }\n }\n\n for (const dep of extractApkDeps(instruction, escapeChar)) {\n dep.depType = 'install';\n deps.push(dep);\n }\n\n lineNumber += 1;\n }\n\n if (!deps.length) {\n return null;\n }\n for (const d of deps) {\n d.depType ??= 'stage';\n }\n // find the last `stage`, and treat it as the `final` stage\n const lastStage = deps.filter((d) => d.depType === 'stage').at(-1);\n if (lastStage) {\n lastStage.depType = 'final';\n }\n return { deps };\n}\n"],"mappings":";;;;;;;;;;AAmBA,MAAM,iBAAiB;AAEvB,SAAgB,iBAAiB,OAAuC;CACtE,MAAM,YAAoC,CAAC;CAC3C,MAAM,gBAAgB,MACpB,+EACF;CAEA,IAAI;CACJ,GAAG;EACD,QAAQ,cAAc,KAAK,KAAK;EAChC,IAAI,OAAO,QAAQ,cACjB,UAAU,MAAM,OAAO,gBACrB,MAAM,QAAQ,aAAa,MAAM,QAAQ;CAE/C,SAAS;CAET,OAAO;AACT;AAEA,SAAS,uBAAuB,KAA4C;CAC1E,IAAI,WAAW,IAAI;CAEnB,IAAI,IAAI,cAAc;EACpB,IAAI,cAAc;EAClB,IAAI,CAAC,IAAI,eACP,eAAe;EAEjB,WAAW,UAAU,QAAQ,IAAI,cAAc,WAAW;CAC5D;CAEA,IAAI,IAAI,eACN,WAAW,UAAU,QACnB,IAAI,eACJ,uCACF;CAGF,OAAO;AACT;AAEA,SAAS,yBACP,KACA,kBACA,OACA,UACM;CACN,MAAM,4BAAwC,CAAC;CAC/C,KAAK,MAAM,mBAAmB,kBAC5B,KAAK,MAAM,cAAc,iBACvB,IACG,SAAS,IAAI,YAAY,KACxB,MAAM,WAAW,CAAC,SAAS,IAAI,YAAY,KAC5C,SAAS,IAAI,aAAa,KACzB,MAAM,WAAW,CAAC,SAAS,IAAI,aAAa,GAE9C,0BAA0B,KAAK,eAAe;CAKpD,0BAA0B,MAAM,GAAG,MAAM;EACvC,OAAO,EAAE,KAAK,EAAE;CAClB,CAAC;CAED,MAAM,UAAU,0BAA0B,EAAE,GAAG;CAC/C,MAAM,UAAU,0BAA0B,GAAG,EAAE,CAAC,GAAG;CACnD,IACE,iBAAiB,WAAW,KAC5B,YAAY,KAAA,K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B,MACA,OAAO,eACT;IAIA,yBAAyB,KAAK,CAF5B,CAAC,sBAAsB,UAAU,CAEU,GAAG,OAAO,QAAQ;IAC/D,OAAO,MACL;KACE,SAAS,IAAI;KACb,cAAc,IAAI;KAClB,eAAe,IAAI;IACrB,GACA,6BACF;IACA,KAAK,KAAK,GAAG;GACf;EACF;EAEA,KAAK,MAAM,OAAO,eAAe,aAAa,UAAU,GAAG;GACzD,IAAI,UAAU;GACd,KAAK,KAAK,GAAG;EACf;EAEA,cAAc;CAChB;CAEA,IAAI,CAAC,KAAK,QACR,OAAO;CAET,KAAK,MAAM,KAAK,MACd,EAAE,YAAY;CAGhB,MAAM,YAAY,KAAK,QAAQ,MAAM,EAAE,YAAY,OAAO,CAAC,CAAC,GAAG,EAAE;CACjE,IAAI,WACF,UAAU,UAAU;CAEtB,OAAO,EAAE,KAAK;AAChB"}
1
+ {"version":3,"file":"extract.js","names":["ubuntuVersioning.id","debianVersioning.id"],"sources":["../../../../lib/modules/manager/dockerfile/extract.ts"],"sourcesContent":["import {\n isNonEmptyStringAndNotWhitespace,\n isNumericString,\n isString,\n} from '@sindresorhus/is';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\nimport { ensureTrailingSlash } from '../../../util/url.ts';\nimport { DockerDatasource } from '../../datasource/docker/index.ts';\nimport * as debianVersioning from '../../versioning/debian/index.ts';\nimport * as ubuntuVersioning from '../../versioning/ubuntu/index.ts';\nimport type {\n ExtractConfig,\n PackageDependency,\n PackageFileContent,\n} from '../types.ts';\nimport { extractApkDeps } from './apk.ts';\nimport { extractDebDeps } from './deb.ts';\n\nconst variableMarker = '$';\n\nexport function extractVariables(image: string): Record<string, string> {\n const variables: Record<string, string> = {};\n const variableRegex = regEx(\n /(?<fullvariable>\\\\?\\$(?<simplearg>\\w+)|\\\\?\\${(?<complexarg>\\w+)(?::.+?)?}+)/gi,\n );\n\n let match: RegExpExecArray | null;\n do {\n match = variableRegex.exec(image);\n if (match?.groups?.fullvariable) {\n variables[match.groups.fullvariable] =\n match.groups?.simplearg || match.groups?.complexarg;\n }\n } while (match);\n\n return variables;\n}\n\nfunction getAutoReplaceTemplate(dep: PackageDependency): string | undefined {\n let template = dep.replaceString;\n\n if (dep.currentValue) {\n let placeholder = '{{#if newValue}}{{newValue}}{{/if}}';\n if (!dep.currentDigest) {\n placeholder += '{{#if newDigest}}@{{newDigest}}{{/if}}';\n }\n template = template?.replace(dep.currentValue, placeholder);\n }\n\n if (dep.currentDigest) {\n template = template?.replace(\n dep.currentDigest,\n '{{#if newDigest}}{{newDigest}}{{/if}}',\n );\n }\n\n return template;\n}\n\nfunction processDepForAutoReplace(\n dep: PackageDependency,\n lineNumberRanges: number[][],\n lines: string[],\n linefeed: string,\n): void {\n const lineNumberRangesToReplace: number[][] = [];\n for (const lineNumberRange of lineNumberRanges) {\n for (const lineNumber of lineNumberRange) {\n if (\n (isString(dep.currentValue) &&\n lines[lineNumber].includes(dep.currentValue)) ||\n (isString(dep.currentDigest) &&\n lines[lineNumber].includes(dep.currentDigest))\n ) {\n lineNumberRangesToReplace.push(lineNumberRange);\n }\n }\n }\n\n lineNumberRangesToReplace.sort((a, b) => {\n return a[0] - b[0];\n });\n\n const minLine = lineNumberRangesToReplace[0]?.[0];\n const maxLine = lineNumberRangesToReplace.at(-1)?.[1];\n if (\n lineNumberRanges.length === 1 ||\n minLine === undefined ||\n maxLine === undefined\n ) {\n return;\n }\n\n const unfoldedLineNumbers = Array.from(\n { length: maxLine - minLine + 1 },\n (_v, k) => k + minLine,\n );\n\n dep.replaceString = unfoldedLineNumbers\n .map((lineNumber) => lines[lineNumber])\n .join(linefeed);\n\n if (!dep.currentDigest) {\n dep.replaceString += linefeed;\n }\n\n dep.autoReplaceStringTemplate = getAutoReplaceTemplate(dep);\n}\n\nexport function splitImageParts(currentFrom: string): PackageDependency {\n let isVariable = false;\n let cleanedCurrentFrom = currentFrom;\n\n // Check if we have a variable in format of \"${VARIABLE:-<image>:<defaultVal>@<digest>}\"\n // If so, remove everything except the image, defaultVal and digest.\n if (cleanedCurrentFrom?.includes(variableMarker)) {\n const defaultValueRegex = regEx(/^\\${.+?:-\"?(?<value>.*?)\"?}$/);\n const defaultValueMatch =\n defaultValueRegex.exec(cleanedCurrentFrom)?.groups;\n if (defaultValueMatch?.value) {\n isVariable = true;\n cleanedCurrentFrom = defaultValueMatch.value;\n }\n\n if (cleanedCurrentFrom?.includes(variableMarker)) {\n // If cleanedCurrentFrom contains a variable, after cleaning, e.g. \"$REGISTRY/alpine\", we do not support this.\n return {\n skipReason: 'contains-variable',\n };\n }\n }\n\n const [currentDepTag, currentDigest] = cleanedCurrentFrom.split('@');\n const depTagSplit = currentDepTag.split(':');\n let depName: string;\n let currentValue: string | undefined;\n if (depTagSplit.length === 1 || depTagSplit.at(-1)!.includes('/')) {\n depName = currentDepTag;\n } else {\n currentValue = depTagSplit.pop();\n depName = depTagSplit.join(':');\n }\n\n const dep: PackageDependency = {\n depName,\n packageName: depName,\n currentValue,\n currentDigest,\n };\n\n if (isVariable) {\n dep.replaceString = cleanedCurrentFrom;\n\n if (!dep.currentValue) {\n delete dep.currentValue;\n }\n\n if (!dep.currentDigest) {\n delete dep.currentDigest;\n }\n }\n\n return dep;\n}\n\nconst quayRegex = regEx(/^quay\\.io(?::[1-9][0-9]{0,4})?/i);\n\nexport function getDep(\n currentFrom: string | null | undefined,\n specifyReplaceString = true,\n registryAliases?: Record<string, string>,\n): PackageDependency {\n if (\n !isString(currentFrom) ||\n !isNonEmptyStringAndNotWhitespace(currentFrom)\n ) {\n return {\n skipReason: 'invalid-value',\n };\n }\n\n // Resolve registry aliases first so that we don't need special casing later on:\n for (const [name, value] of Object.entries(coerceObject(registryAliases))) {\n // Allow `${VAR}`/`${VAR:-...}` keys to match without a trailing slash\n // (`}` is an unambiguous boundary). Bare identifier keys like\n // `$CI_REGISTRY` still require `/` so they can't eat `$CI_REGISTRY_IMAGE/`.\n const matchedWithSlash = currentFrom.startsWith(`${name}/`);\n const matchedAtBoundary =\n name.endsWith('}') && currentFrom.startsWith(name);\n if (!matchedWithSlash && !matchedAtBoundary) {\n continue;\n }\n const depName = currentFrom.slice(\n matchedWithSlash ? name.length + 1 : name.length,\n );\n // An empty alias value means \"no registry prefix\", i.e. Docker Hub.\n const valueWithSlash = value ? ensureTrailingSlash(value) : '';\n const dep = getDep(`${valueWithSlash}${depName}`, false);\n // TODO: when the inner getDep strips a `library/` prefix (or similar)\n // the depName no longer starts with `valueWithSlash` and the alias-rooted\n // depName is not restored.\n if (dep.depName?.startsWith(valueWithSlash)) {\n dep.packageName = dep.depName;\n const [imageAndTag] = currentFrom.split('@');\n dep.depName = dep.currentValue\n ? imageAndTag.substring(0, imageAndTag.lastIndexOf(':'))\n : imageAndTag;\n }\n if (specifyReplaceString) {\n dep.replaceString = currentFrom;\n dep.autoReplaceStringTemplate = getAutoReplaceTemplate(dep);\n }\n return dep;\n }\n\n const dep = splitImageParts(currentFrom);\n if (specifyReplaceString) {\n dep.replaceString ??= currentFrom;\n dep.autoReplaceStringTemplate =\n '{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}';\n }\n dep.datasource = DockerDatasource.id;\n\n // Pretty up special prefixes\n if (dep.depName) {\n const specialPrefixes = ['amd64', 'arm64', 'library'];\n for (const prefix of specialPrefixes) {\n if (dep.depName.startsWith(`${prefix}/`)) {\n dep.depName = dep.depName.replace(`${prefix}/`, '');\n if (specifyReplaceString) {\n dep.autoReplaceStringTemplate =\n '{{packageName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}';\n }\n }\n }\n }\n\n if (dep.depName === 'ubuntu' || dep.depName?.endsWith('/ubuntu')) {\n dep.versioning = ubuntuVersioning.id;\n }\n\n if (\n (dep.depName === 'debian' || dep.depName?.endsWith('/debian')) &&\n debianVersioning.api.isVersion(dep.currentValue)\n ) {\n dep.versioning = debianVersioning.id;\n }\n\n // Don't display quay.io ports\n if (dep.depName && quayRegex.test(dep.depName)) {\n const depName = dep.depName.replace(quayRegex, 'quay.io');\n if (depName !== dep.depName) {\n dep.depName = depName;\n dep.autoReplaceStringTemplate =\n '{{packageName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}';\n }\n }\n\n return dep;\n}\n\nexport function extractPackageFile(\n content: string,\n _packageFile: string,\n config: ExtractConfig,\n): PackageFileContent | null {\n const sanitizedContent = content.replace(regEx(/^\\uFEFF/), ''); // remove bom marker\n const deps: PackageDependency[] = [];\n const stageNames: string[] = [];\n const args: Record<string, string> = {};\n const argsLines: Record<string, number[]> = {};\n\n let escapeChar = '\\\\\\\\';\n let lookForEscapeChar = true;\n let lookForSyntaxDirective = true;\n\n const lineFeed = sanitizedContent.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const lines = sanitizedContent.split(newlineRegex);\n for (let lineNumber = 0; lineNumber < lines.length;) {\n const lineNumberInstrStart = lineNumber;\n let instruction = lines[lineNumber];\n\n if (lookForEscapeChar) {\n const directivesMatch = regEx(\n /^[ \\t]*#[ \\t]*(?<directive>syntax|escape)[ \\t]*=[ \\t]*(?<escapeChar>\\S)/i,\n ).exec(instruction);\n if (!directivesMatch) {\n lookForEscapeChar = false;\n } else if (directivesMatch.groups?.directive.toLowerCase() === 'escape') {\n if (directivesMatch.groups?.escapeChar === '`') {\n escapeChar = '`';\n }\n lookForEscapeChar = false;\n }\n }\n\n if (lookForSyntaxDirective) {\n const syntaxRegex = regEx(\n '^#[ \\\\t]*syntax[ \\\\t]*=[ \\\\t]*(?<image>\\\\S+)',\n 'im',\n );\n const syntaxMatch = instruction.match(syntaxRegex);\n if (syntaxMatch?.groups?.image) {\n const syntaxImage = syntaxMatch.groups.image;\n const lineNumberRanges: number[][] = [\n [lineNumberInstrStart, lineNumber],\n ];\n const dep = getDep(syntaxImage, true, config.registryAliases);\n dep.depType = 'syntax';\n processDepForAutoReplace(dep, lineNumberRanges, lines, lineFeed);\n logger.trace(\n {\n depName: dep.depName,\n currentValue: dep.currentValue,\n currentDigest: dep.currentDigest,\n },\n 'Dockerfile # syntax',\n );\n deps.push(dep);\n }\n lookForSyntaxDirective = false;\n }\n\n const lineContinuationRegex = regEx(`${escapeChar}[ \\\\t]*$|^[ \\\\t]*#`, 'm');\n let lineLookahead = instruction;\n while (\n !lookForEscapeChar &&\n !instruction.trimStart().startsWith('#') &&\n lineContinuationRegex.test(lineLookahead)\n ) {\n lineLookahead = lines[++lineNumber] || '';\n instruction += `\\n${lineLookahead}`;\n }\n\n const argRegex = regEx(\n `^[ \\\\t]*ARG(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n)+(?<name>\\\\w+)[ =](?<value>\\\\S*)`,\n 'im',\n );\n const argMatch = argRegex.exec(instruction);\n if (argMatch?.groups?.name) {\n argsLines[argMatch.groups.name] = [lineNumberInstrStart, lineNumber];\n let argMatchValue = argMatch.groups?.value;\n\n if (\n (argMatchValue.startsWith('\"') && argMatchValue.endsWith('\"')) ||\n (argMatchValue.startsWith(\"'\") && argMatchValue.endsWith(\"'\"))\n ) {\n argMatchValue = argMatchValue.slice(1, -1);\n }\n\n args[argMatch.groups.name] = argMatchValue || '';\n }\n\n const fromRegex = regEx(\n `^[ \\\\t]*FROM(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n|--platform=\\\\S+)+(?<image>\\\\S+)(?:(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n)+as[ \\\\t]+(?<name>\\\\S+))?`,\n 'im',\n );\n const fromMatch = instruction.match(fromRegex);\n if (fromMatch?.groups?.image) {\n let fromImage = fromMatch.groups.image;\n const lineNumberRanges: number[][] = [[lineNumberInstrStart, lineNumber]];\n\n if (fromImage.includes(variableMarker)) {\n const variables = extractVariables(fromImage);\n for (const [fullVariable, argName] of Object.entries(variables)) {\n const resolvedArgValue = args[argName];\n if (resolvedArgValue || resolvedArgValue === '') {\n fromImage = fromImage.replaceAll(fullVariable, resolvedArgValue);\n lineNumberRanges.push(argsLines[argName]);\n }\n }\n }\n\n if (fromMatch.groups?.name) {\n logger.debug(\n `Found a multistage build stage name: ${fromMatch.groups.name}`,\n );\n stageNames.push(fromMatch.groups.name);\n }\n if (fromImage === 'scratch') {\n logger.debug('Skipping scratch');\n } else if (fromImage && stageNames.includes(fromImage)) {\n logger.debug(`Skipping alias FROM image:${fromImage}`);\n } else {\n const dep = getDep(fromImage, true, config.registryAliases);\n processDepForAutoReplace(dep, lineNumberRanges, lines, lineFeed);\n logger.trace(\n {\n depName: dep.depName,\n currentValue: dep.currentValue,\n currentDigest: dep.currentDigest,\n },\n 'Dockerfile FROM',\n );\n deps.push(dep);\n }\n }\n\n const copyFromRegex = regEx(\n `^[ \\\\t]*COPY(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n|--[a-z]+(?:=[a-zA-Z0-9_.:-]+?)?)+--from=(?<image>\\\\S+)`,\n 'im',\n );\n const copyFromMatch = instruction.match(copyFromRegex);\n if (copyFromMatch?.groups?.image) {\n if (stageNames.includes(copyFromMatch.groups.image)) {\n logger.debug(\n { image: copyFromMatch.groups.image },\n 'Skipping alias COPY --from',\n );\n } else if (isNumericString(copyFromMatch.groups.image)) {\n logger.debug(\n { image: copyFromMatch.groups.image },\n 'Skipping index reference COPY --from',\n );\n } else {\n const dep = getDep(\n copyFromMatch.groups.image,\n true,\n config.registryAliases,\n );\n const lineNumberRanges: number[][] = [\n [lineNumberInstrStart, lineNumber],\n ];\n processDepForAutoReplace(dep, lineNumberRanges, lines, lineFeed);\n logger.debug(\n {\n depName: dep.depName,\n currentValue: dep.currentValue,\n currentDigest: dep.currentDigest,\n },\n 'Dockerfile COPY --from',\n );\n deps.push(dep);\n }\n }\n\n const runMountFromRegex = regEx(\n `^[ \\\\t]*RUN(?:${escapeChar}[ \\\\t]*\\\\r?\\\\n| |\\\\t|#.*?\\\\r?\\\\n|--[a-z]+(?:=[a-zA-Z0-9_.:-]+?)?)+--mount=(?:\\\\S*=\\\\S*,)*from=(?<image>[^, ]+)`,\n 'im',\n );\n const runMountFromMatch = instruction.match(runMountFromRegex);\n if (runMountFromMatch?.groups?.image) {\n if (stageNames.includes(runMountFromMatch.groups.image)) {\n logger.debug(\n { image: runMountFromMatch.groups.image },\n 'Skipping alias RUN --mount=from',\n );\n } else {\n const dep = getDep(\n runMountFromMatch.groups.image,\n true,\n config.registryAliases,\n );\n const lineNumberRanges: number[][] = [\n [lineNumberInstrStart, lineNumber],\n ];\n processDepForAutoReplace(dep, lineNumberRanges, lines, lineFeed);\n logger.debug(\n {\n depName: dep.depName,\n currentValue: dep.currentValue,\n currentDigest: dep.currentDigest,\n },\n 'Dockerfile RUN --mount=from',\n );\n deps.push(dep);\n }\n }\n\n for (const dep of [\n ...extractApkDeps(instruction, escapeChar),\n ...extractDebDeps(instruction, escapeChar),\n ]) {\n dep.depType = 'install';\n deps.push(dep);\n }\n\n lineNumber += 1;\n }\n\n if (!deps.length) {\n return null;\n }\n for (const d of deps) {\n d.depType ??= 'stage';\n }\n // find the last `stage`, and treat it as the `final` stage\n const lastStage = deps.filter((d) => d.depType === 'stage').at(-1);\n if (lastStage) {\n lastStage.depType = 'final';\n }\n return { deps };\n}\n"],"mappings":";;;;;;;;;;;AAoBA,MAAM,iBAAiB;AAEvB,SAAgB,iBAAiB,OAAuC;CACtE,MAAM,YAAoC,CAAC;CAC3C,MAAM,gBAAgB,MACpB,+EACF;CAEA,IAAI;CACJ,GAAG;EACD,QAAQ,cAAc,KAAK,KAAK;EAChC,IAAI,OAAO,QAAQ,cACjB,UAAU,MAAM,OAAO,gBACrB,MAAM,QAAQ,aAAa,MAAM,QAAQ;CAE/C,SAAS;CAET,OAAO;AACT;AAEA,SAAS,uBAAuB,KAA4C;CAC1E,IAAI,WAAW,IAAI;CAEnB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,WACF,UAAU,UAAU;CAEtB,OAAO,EAAE,KAAK;AAChB"}
@@ -1,5 +1,6 @@
1
1
  import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
2
2
  import { ApkDatasource } from "../../datasource/apk/index.js";
3
+ import { DebDatasource } from "../../datasource/deb/index.js";
3
4
  import { DockerDatasource } from "../../datasource/docker/index.js";
4
5
  import { extractPackageFile } from "./extract.js";
5
6
  import { knownDepTypes } from "./dep-types.js";
@@ -15,7 +16,11 @@ var dockerfile_exports = /* @__PURE__ */ __exportAll({
15
16
  const url = "https://docs.docker.com/build/concepts/dockerfile";
16
17
  const categories = ["docker"];
17
18
  const defaultConfig = { managerFilePatterns: ["/(^|/|\\.)([Dd]ocker|[Cc]ontainer)file$/", "/(^|/)([Dd]ocker|[Cc]ontainer)file[^/]*$/"] };
18
- const supportedDatasources = [ApkDatasource.id, DockerDatasource.id];
19
+ const supportedDatasources = [
20
+ ApkDatasource.id,
21
+ DebDatasource.id,
22
+ DockerDatasource.id
23
+ ];
19
24
  //#endregion
20
25
  export { categories, defaultConfig, dockerfile_exports, extractPackageFile, knownDepTypes, supportedDatasources, url };
21
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/manager/dockerfile/index.ts"],"sourcesContent":["import type { Category } from '../../../constants/index.ts';\nimport { ApkDatasource } from '../../datasource/apk/index.ts';\nimport { DockerDatasource } from '../../datasource/docker/index.ts';\nimport { extractPackageFile } from './extract.ts';\n\nexport { knownDepTypes } from './dep-types.ts';\nexport { extractPackageFile };\n\nexport const url = 'https://docs.docker.com/build/concepts/dockerfile';\nexport const categories: Category[] = ['docker'];\n\nexport const defaultConfig = {\n managerFilePatterns: [\n '/(^|/|\\\\.)([Dd]ocker|[Cc]ontainer)file$/',\n '/(^|/)([Dd]ocker|[Cc]ontainer)file[^/]*$/',\n ],\n};\n\nexport const supportedDatasources = [ApkDatasource.id, DockerDatasource.id];\n"],"mappings":";;;;;;;;;;;;;;AAQA,MAAa,MAAM;AACnB,MAAa,aAAyB,CAAC,QAAQ;AAE/C,MAAa,gBAAgB,EAC3B,qBAAqB,CACnB,4CACA,2CACF,EACF;AAEA,MAAa,uBAAuB,CAAC,cAAc,IAAI,iBAAiB,EAAE"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/manager/dockerfile/index.ts"],"sourcesContent":["import type { Category } from '../../../constants/index.ts';\nimport { ApkDatasource } from '../../datasource/apk/index.ts';\nimport { DebDatasource } from '../../datasource/deb/index.ts';\nimport { DockerDatasource } from '../../datasource/docker/index.ts';\nimport { extractPackageFile } from './extract.ts';\n\nexport { knownDepTypes } from './dep-types.ts';\nexport { extractPackageFile };\n\nexport const url = 'https://docs.docker.com/build/concepts/dockerfile';\nexport const categories: Category[] = ['docker'];\n\nexport const defaultConfig = {\n managerFilePatterns: [\n '/(^|/|\\\\.)([Dd]ocker|[Cc]ontainer)file$/',\n '/(^|/)([Dd]ocker|[Cc]ontainer)file[^/]*$/',\n ],\n};\n\nexport const supportedDatasources = [\n ApkDatasource.id,\n DebDatasource.id,\n DockerDatasource.id,\n];\n"],"mappings":";;;;;;;;;;;;;;;AASA,MAAa,MAAM;AACnB,MAAa,aAAyB,CAAC,QAAQ;AAE/C,MAAa,gBAAgB,EAC3B,qBAAqB,CACnB,4CACA,2CACF,EACF;AAEA,MAAa,uBAAuB;CAClC,cAAc;CACd,cAAc;CACd,iBAAiB;AACnB"}
@@ -0,0 +1,92 @@
1
+ import { newlineRegex, regEx } from "../../../util/regex.js";
2
+ import { logger } from "../../../logger/index.js";
3
+ import { split } from "shlex";
4
+ //#region lib/modules/manager/dockerfile/run-command.ts
5
+ /** Shell operators which start a new command */
6
+ const commandSeparators = [
7
+ "&&",
8
+ "||",
9
+ ";",
10
+ "|",
11
+ "&",
12
+ "(",
13
+ ")",
14
+ "{",
15
+ "}"
16
+ ];
17
+ /**
18
+ * The `RUN` keyword and its flags, e.g. `RUN --mount=type=cache,target=/x `.
19
+ *
20
+ * Stripping these leaves the shell command that the instruction runs.
21
+ */
22
+ const runPrefixRegex = regEx(/^[ \t]*(?:ONBUILD[ \t]+)?RUN[ \t]+(?:--[a-z]\S*[ \t]+)*/i);
23
+ function matchesCommand(token, name) {
24
+ return token === name || !!token?.endsWith(`/${name}`);
25
+ }
26
+ /**
27
+ * Returns the arguments of the command, or `null` if none of the given
28
+ * commands were run.
29
+ *
30
+ * The command is found by its name alone, wherever it sits in the tokens -
31
+ * so it's found whether it's prefixed by a shell keyword (`do`/`then`/...),
32
+ * a variable assignment (`DEBUG=1 apk add ...`), or a wrapper program
33
+ * (`sudo`/`chroot /mnt`/`timeout 30`/...).
34
+ */
35
+ function matchCommand(tokens, names) {
36
+ const index = tokens.findIndex((token) => names.some((name) => matchesCommand(token, name)));
37
+ if (index === -1) return null;
38
+ return tokens.slice(index + 1);
39
+ }
40
+ /**
41
+ * Finds the invocations of the given commands in a `RUN` instruction, e.g. the
42
+ * `add --no-cache bash=5.2.37-r2` of
43
+ *
44
+ * ```dockerfile
45
+ * RUN apk update && apk add --no-cache bash=5.2.37-r2
46
+ * ```
47
+ *
48
+ * @param instruction the full `RUN` instruction, including any line continuations
49
+ * @param escapeChar the Dockerfile escape character, already regex-escaped
50
+ * @param names the commands to look for, e.g. `['apt', 'apt-get']`
51
+ * @returns the arguments of each invocation, in the order they were run
52
+ */
53
+ function parseRunCommands(instruction, escapeChar, names) {
54
+ const joined = instruction.split(newlineRegex).filter((line) => !regEx(/^[ \t]*#/).test(line)).join("\n").replace(regEx(`${escapeChar}[ \\t]*\\r?\\n`, "g"), " ");
55
+ const runPrefix = runPrefixRegex.exec(joined)?.[0];
56
+ if (!runPrefix) return [];
57
+ const command = joined.slice(runPrefix.length);
58
+ if (!names.some((name) => command.includes(name))) return [];
59
+ let tokens;
60
+ try {
61
+ tokens = split(command);
62
+ } catch (err) {
63
+ logger.debug({
64
+ err,
65
+ command
66
+ }, "Failed to tokenize Dockerfile RUN command");
67
+ return [];
68
+ }
69
+ const commands = [];
70
+ let current = [];
71
+ for (const token of tokens) {
72
+ if (token.startsWith("#")) break;
73
+ if (commandSeparators.includes(token)) {
74
+ commands.push(current);
75
+ current = [];
76
+ continue;
77
+ }
78
+ if (token.endsWith(";")) {
79
+ current.push(token.slice(0, -1));
80
+ commands.push(current);
81
+ current = [];
82
+ continue;
83
+ }
84
+ current.push(token);
85
+ }
86
+ commands.push(current);
87
+ return commands.map((command) => matchCommand(command, names)).filter((args) => args !== null);
88
+ }
89
+ //#endregion
90
+ export { parseRunCommands };
91
+
92
+ //# sourceMappingURL=run-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-command.js","names":[],"sources":["../../../../lib/modules/manager/dockerfile/run-command.ts"],"sourcesContent":["import { split } from 'shlex';\nimport { logger } from '../../../logger/index.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\n\n/** Shell operators which start a new command */\nconst commandSeparators = ['&&', '||', ';', '|', '&', '(', ')', '{', '}'];\n\n/**\n * The `RUN` keyword and its flags, e.g. `RUN --mount=type=cache,target=/x `.\n *\n * Stripping these leaves the shell command that the instruction runs.\n */\nconst runPrefixRegex = regEx(\n /^[ \\t]*(?:ONBUILD[ \\t]+)?RUN[ \\t]+(?:--[a-z]\\S*[ \\t]+)*/i,\n);\n\nfunction matchesCommand(token: string | undefined, name: string): boolean {\n return token === name || !!token?.endsWith(`/${name}`);\n}\n\n/**\n * Returns the arguments of the command, or `null` if none of the given\n * commands were run.\n *\n * The command is found by its name alone, wherever it sits in the tokens -\n * so it's found whether it's prefixed by a shell keyword (`do`/`then`/...),\n * a variable assignment (`DEBUG=1 apk add ...`), or a wrapper program\n * (`sudo`/`chroot /mnt`/`timeout 30`/...).\n */\nfunction matchCommand(tokens: string[], names: string[]): string[] | null {\n const index = tokens.findIndex((token) =>\n names.some((name) => matchesCommand(token, name)),\n );\n if (index === -1) {\n return null;\n }\n return tokens.slice(index + 1);\n}\n\n/**\n * Finds the invocations of the given commands in a `RUN` instruction, e.g. the\n * `add --no-cache bash=5.2.37-r2` of\n *\n * ```dockerfile\n * RUN apk update && apk add --no-cache bash=5.2.37-r2\n * ```\n *\n * @param instruction the full `RUN` instruction, including any line continuations\n * @param escapeChar the Dockerfile escape character, already regex-escaped\n * @param names the commands to look for, e.g. `['apt', 'apt-get']`\n * @returns the arguments of each invocation, in the order they were run\n */\nexport function parseRunCommands(\n instruction: string,\n escapeChar: string,\n names: string[],\n): string[][] {\n // A `#` line inside a line continuation is a Dockerfile comment, and is\n // dropped before the shell ever sees it\n const joined = instruction\n .split(newlineRegex)\n .filter((line) => !regEx(/^[ \\t]*#/).test(line))\n .join('\\n')\n .replace(regEx(`${escapeChar}[ \\\\t]*\\\\r?\\\\n`, 'g'), ' ');\n\n const runPrefix = runPrefixRegex.exec(joined)?.[0];\n if (!runPrefix) {\n return [];\n }\n\n const command = joined.slice(runPrefix.length);\n if (!names.some((name) => command.includes(name))) {\n return [];\n }\n\n let tokens: string[];\n try {\n tokens = split(command);\n } catch (err) {\n logger.debug({ err, command }, 'Failed to tokenize Dockerfile RUN command');\n return [];\n }\n\n // Split the shell command into the individual commands it runs, so that only\n // the arguments of a matching invocation are considered\n const commands: string[][] = [];\n let current: string[] = [];\n for (const token of tokens) {\n if (token.startsWith('#')) {\n // the rest of the command is a shell comment\n break;\n }\n if (commandSeparators.includes(token)) {\n commands.push(current);\n current = [];\n continue;\n }\n // e.g. the `{1..10};` of `for iter in {1..10}; do apk add ...`, which shlex\n // keeps as one token because no whitespace precedes the `;`\n if (token.endsWith(';')) {\n current.push(token.slice(0, -1));\n commands.push(current);\n current = [];\n continue;\n }\n current.push(token);\n }\n commands.push(current);\n\n return commands\n .map((command) => matchCommand(command, names))\n .filter((args) => args !== null);\n}\n"],"mappings":";;;;;AAKA,MAAM,oBAAoB;CAAC;CAAM;CAAM;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG;;;;;;AAOxE,MAAM,iBAAiB,MACrB,0DACF;AAEA,SAAS,eAAe,O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A,QAAQ,KAAK,KAAK;CACpB;CACA,SAAS,KAAK,OAAO;CAErB,OAAO,SACJ,KAAK,YAAY,aAAa,SAAS,KAAK,CAAC,CAAC,CAC9C,QAAQ,SAAS,SAAS,IAAI;AACnC"}
@@ -17,7 +17,7 @@ hashMap.set("bitbucket-pipelines", "59c0503494ab1442b127914503c01b97ac17b6742b19
17
17
  hashMap.set("bitrise", "478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42");
18
18
  hashMap.set("buildkite", "b8b404f53cd5d61c39153fddf93945e621471c4ac6aa9960c881cd868922bb4c");
19
19
  hashMap.set("buildpacks", "6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f");
20
- hashMap.set("bun", "8ec4c3c8080a55e93b741cfa97779b47291734dc24d80529c887d3b2b823fc44");
20
+ hashMap.set("bun", "5820cfb6ebe018b8c336d481ea9ae319daaee6a2e368c45196fc8bc67cb3e755");
21
21
  hashMap.set("bun-version", "df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4");
22
22
  hashMap.set("bundler", "6e4784dd98c1f86ef64cc8cbf3128df48aebf920032d7792b54fdedd3dd9d4d5");
23
23
  hashMap.set("cake", "9ebd8b481220b30a8860121d26184540a1a2fcc05ef780df9295dea39b386fad");
@@ -32,12 +32,12 @@ hashMap.set("copier", "10ae4d7f8ff35faf3a3f9f25bf4c969ea960e19aaf8c012aee11f93f4
32
32
  hashMap.set("cpanfile", "07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3");
33
33
  hashMap.set("crossplane", "5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40");
34
34
  hashMap.set("crow", "eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0");
35
- hashMap.set("deno", "917fdbfbad58fd7f57933646a760d91768368df563ce5eaf34a2bba165164a12");
35
+ hashMap.set("deno", "05e7ab60494a20a5e7477f06a9e723e443d37643b6e1d9ba8d3d87126a051175");
36
36
  hashMap.set("deps-edn", "06783dbc8b9c7bb84e162d1f75b7db56dfa021cc6f809dfd2314cee8b64af08d");
37
37
  hashMap.set("devbox", "a40050cc61bd9b5d500ec111abb17bb15d5f82ab5b7699f66f628307ba8382c9");
38
38
  hashMap.set("devcontainer", "24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec");
39
39
  hashMap.set("docker-compose", "fba87b82cb0f2bfd66526631fbe928b8153e7ca701a5790d02b944df17417bb9");
40
- hashMap.set("dockerfile", "e0bbb007c6fe2a7a135de4514be7af6b32ade599ddd8eec5e4aecd92d5237b4b");
40
+ hashMap.set("dockerfile", "78cb1e8b58653289dd4b73425c45495a4c4b41badd3614b8345aaf8ab73de09c");
41
41
  hashMap.set("droneci", "661d2a2d7295af8dd7a1234c7090c42a89306bd574c3adf1fc67782efaad3998");
42
42
  hashMap.set("fleet", "4942d52e82f35c41e2d46cf76f426e2d91b350338cfc0bbcb97e8aaae2a1ac0b");
43
43
  hashMap.set("flux", "aad8c786c4a2b5820663027452eeb8fe84c3af8c8399261e85f0eade2e484fe8");
@@ -1 +1 @@
1
- {"version":3,"file":"fingerprint.generated.js","names":[],"sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"sourcesContent":["export const hashMap = new Map<string, string>();\n\nhashMap.set('ansible','a52394a36ac5517f7330473c31d93aa05b2ce607c5e951b48f25a4693cd20a81');\nhashMap.set('ansible-galaxy','0a264d6be73953d801510fdeff271e4071c274339569c6dab4e2a128eaf4869f');\nhashMap.set('ant','2df5943cf0ed19a21b94df13729dbb925655548130caf37e3e22bebaed518e17');\nhashMap.set('apm','bdb6931cc03f4ac02ebfdb56c4b3483bb6c5250fa952545f1a25584d502bbffd');\nhashMap.set('argocd','cff9cd22257bc460ae4b9936570bf0ed5585f280a55d26629deaeeb0bfee8eb5');\nhashMap.set('asdf','430eb99b58171700c8a59c78b9e648575e9b176b781d90dd10a710f7b69015bb');\nhashMap.set('azure-pipelines','a051fe5e7e4fef8208b5864131a2b52b4ae319936f1dd8ee5a4e1ef11359ec09');\nhashMap.set('batect','375d39b432013bedb1330cf40a2199dd822751b28578214f219e7bab98594b8d');\nhashMap.set('batect-wrapper','d999355511ea7f4053325a18b8cfc8d2b586c61e6760c35e557d383a673e3939');\nhashMap.set('bazel','c31bc0a0e23d32726bcc09aa67533ebc5058124bf89c88e09c837419f550801a');\nhashMap.set('bazel-module','9fbba0339f9f7785d52ab85c5f0f6385003093c063483c13feccba13ae438bef');\nhashMap.set('bazelisk','770f75a746dc6ba90c518788d5987d7df4243ef9eee122d1bb0556a93d6e1b11');\nhashMap.set('bicep','7246e0bfc06e0e28cbb03ac088c5591f648956b086e106aeb251fe5d628329db');\nhashMap.set('bitbucket-pipelines','59c0503494ab1442b127914503c01b97ac17b6742b19c632292d5aa24de115cd');\nhashMap.set('bitrise','478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42');\nhashMap.set('buildkite','b8b404f53cd5d61c39153fddf93945e621471c4ac6aa9960c881cd868922bb4c');\nhashMap.set('buildpacks','6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f');\nhashMap.set('bun','8ec4c3c8080a55e93b741cfa97779b47291734dc24d80529c887d3b2b823fc44');\nhashMap.set('bun-version','df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4');\nhashMap.set('bundler','6e4784dd98c1f86ef64cc8cbf3128df48aebf920032d7792b54fdedd3dd9d4d5');\nhashMap.set('cake','9ebd8b481220b30a8860121d26184540a1a2fcc05ef780df9295dea39b386fad');\nhashMap.set('cargo','fe8136135c895dd08819f91a60cf105f8b951251b057092700101ace991ae1d7');\nhashMap.set('cdnurl','9a81c8e3c6ad6c788498c99fc1067ffdfcd92a427c3afaf8c0130975d83131f2');\nhashMap.set('circleci','91cbeb33ea20f9838e2c81a1195eb806f0b38fa282bc3679f62552f20575ca85');\nhashMap.set('cloudbuild','f4e40388944652c8a19f8518771ac8d3f3c4ccf81ddef0e68b463aca833cb73c');\nhashMap.set('cocoapods','f832e2beef885bb3fd697ed9bb3e8cd742926bfec37ff41212edd2dbb4edb3ba');\nhashMap.set('composer','f1294fb3866ff65a75d98fdef80b1df3d3a8856535b8c690d1799e1205e4b639');\nhashMap.set('conan','8d46e9a30ae628e26118aea10a98d1b846f7c5d96d51ce24693437d555f6d125');\nhashMap.set('copier','10ae4d7f8ff35faf3a3f9f25bf4c969ea960e19aaf8c012aee11f93f4d10533e');\nhashMap.set('cpanfile','07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3');\nhashMap.set('crossplane','5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40');\nhashMap.set('crow','eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0');\nhashMap.set('deno','917fdbfbad58fd7f57933646a760d91768368df563ce5eaf34a2bba165164a12');\nhashMap.set('deps-edn','06783dbc8b9c7bb84e162d1f75b7db56dfa021cc6f809dfd2314cee8b64af08d');\nhashMap.set('devbox','a40050cc61bd9b5d500ec111abb17bb15d5f82ab5b7699f66f628307ba8382c9');\nhashMap.set('devcontainer','24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec');\nhashMap.set('docker-compose','fba87b82cb0f2bfd66526631fbe928b8153e7ca701a5790d02b944df17417bb9');\nhashMap.set('dockerfile','e0bbb007c6fe2a7a135de4514be7af6b32ade599ddd8eec5e4aecd92d5237b4b');\nhashMap.set('droneci','661d2a2d7295af8dd7a1234c7090c42a89306bd574c3adf1fc67782efaad3998');\nhashMap.set('fleet','4942d52e82f35c41e2d46cf76f426e2d91b350338cfc0bbcb97e8aaae2a1ac0b');\nhashMap.set('flux','aad8c786c4a2b5820663027452eeb8fe84c3af8c8399261e85f0eade2e484fe8');\nhashMap.set('fvm','9b161df0f14bc6e536368952adf373e343630097121a913cea60ee284027fb90');\nhashMap.set('git-submodules','df8bb92b2906d8cddda2d4b302ee503f8002e3554d32d74cef2f584fe891f38f');\nhashMap.set('github-actions','7adddc8e590786084855ffe53292bff3098ac672f91c21cc39d45bcf0af2271f');\nhashMap.set('gitlabci','a5e1e66ef461e1c1e71062f85f35a212417e23627f4b002810f9a98295d6e672');\nhashMap.set('gitlabci-include','8860a15ab516fde00694f9bd9bf56fce4addafe5a55b5ddb9a4ec477d301d351');\nhashMap.set('glasskube','93e7b9000a17efa15a1abaaf320b5af9169b1ecd828fc0c881d98570ef9d9e30');\nhashMap.set('gleam','5e9b9f5f914afe5ed7b526c06c65111e3716d2dea9b0cbe7907bbc96db1064a3');\nhashMap.set('gomod','de042f3b5a900346c5f2df41f793f1716dc12145c38705c3064c6a7150b49495');\nhashMap.set('gradle','9e3ff52ce4ad2555929acdd4d32c417c4ef8714c23a92f2893ecc580fa4d6064');\nhashMap.set('gradle-wrapper','73ba30c34955fab7737454b5cff9aca6d1b5607d53c17c9e13d8ad96f6eaae87');\nhashMap.set('haskell-cabal','f158b7725e3143dfd2950e3de0bbccc2a61cd7eba87f7a54c5057e01252348e2');\nhashMap.set('helm-requirements','7ee9dace4c036dfe113c0c0e46369d8b83a739caa831660142ca98d3236a180a');\nhashMap.set('helm-values','0aa79bb0257d0d72e54dfd2653e59bfef63b97e46c035b7443593bdf6e6382aa');\nhashMap.set('helmfile','28572dd24b6746ca7065ee467aa13bbc8c3e8c0f88ae48e33bce88468c600100');\nhashMap.set('helmsman','951deeb3355da751ef39c9e932b26ea749450e32e75759e4b5fc29359e100b37');\nhashMap.set('helmv3','4a3cf47072978eb131d70cd13f3d0bbd4408b0290be2a798a4cbf6103189269b');\nhashMap.set('hermit','0fb25b7766c3a264fbb765ff75b1542b24136c4c9f933696d4a5aecfed637071');\nhashMap.set('homeassistant-manifest','05043c6db870cffbb6f8f3e351c025e3de227eaae0b24134b796aec46f84b65f');\nhashMap.set('homebrew','dffe954a4e18c2dc4bfdaa12222fe8ddc3395869afd5afa603fc2b6264747984');\nhashMap.set('html','81fa6c2bf2b868596584a48b949645207a2aa3081951ed99183ee50b70b77d5f');\nhashMap.set('jenkins','7fda0e7e0f3d5e18088ccb3594f727f4cfc48b064706bdaaf1a0a075b6a2cff5');\nhashMap.set('jsonnet-bundler','4cedeb0394e5c38361d1868ff45b4f34747ab8c492378b6e63dcaf1f4f3c024d');\nhashMap.set('kotlin-script','95ebc844c040ca047321b207d525220e29774a2a1fe06f9639e8353c66908564');\nhashMap.set('kubernetes','321e7d77fb3600dd4c00a86eaa1294927e7f92300b74fa2977d813dcaa3bb4de');\nhashMap.set('kustomize','aa830c27302555e12d7f04e342c96125d68c231028a2d3c459c4431516382584');\nhashMap.set('leiningen','c8397e376f1717c2f771ae9ea3ba6b720d2422b133cf937e762c44e42be146a2');\nhashMap.set('maven','c110b99291c2a5bc82cf7a69330275e9bbd7dc8ba3e9e987611dfcffbe002d8d');\nhashMap.set('maven-wrapper','6e53b6e4abf1d20b75094c7a70d66b4a5ac39954f009aa401f5e55dada8be4d0');\nhashMap.set('meteor','4636a47ba4dcfff19fe662572ef7a40d17146be3c966e00ef437e1fc8de92776');\nhashMap.set('mint','248fe4f1ea5c985921c286785792c97e06fc41f402b2d45df82f6aecd17f710e');\nhashMap.set('mise','279da4690751c3abee10badd12eb4ac6ef31d824c6bd3ada824859eca3109ebe');\nhashMap.set('mix','0f79163dc2a1c896599d152be635c23beaf16812ae3d8fbfffec98c7bd0de872');\nhashMap.set('nix','0f80f0b81f2197a7e588be5c115a32a826fc184593f4e879f7b60fafd97a977e');\nhashMap.set('nodenv','ac652c28481b001f7471f4183eac07b45d98ecbe83efc275830b0a1b2e0459b8');\nhashMap.set('npm','30c78bc1c29eeecbdedb4eacc52bd93eedfb07279fd385f893193dcac6196466');\nhashMap.set('nuget','b81fb0ca6cfeb86b004592b38ce176673e056d6a2ed41a9807afb0eb7ad405d2');\nhashMap.set('nvm','3eb77c7b0acf6d64753de78fad2499b352719853aa6872878c40675d14152322');\nhashMap.set('ocb','032b216684c14b0954e0bb019513a2aca3faaee5748587acb668d377d7c891ca');\nhashMap.set('osgi','d6567a733ef3983112b46fdccd7ceebfcd48411104e0c6b6e714d4310db48024');\nhashMap.set('pep621','52450676f8b0e05134b3e8947b832195ef40bcaec1ce43d71351a2f797b80d75');\nhashMap.set('pep723','77022a0eae6a3cbb74a1e6d596db1276e379768e40448192b3fa81edd14ca73f');\nhashMap.set('pip-compile','7e418b8bdaeed38c1372eb19e0ae1c64999000e128d8754e37368638037b4c5c');\nhashMap.set('pip_requirements','bf3a407f72abf711230247bef94ba5dc84c08a35107b0f017912fad66afa716a');\nhashMap.set('pip_setup','df18fba2bdcf48f3ca12a8f7e5cd28df31e2368d5528127277038ef4206eca79');\nhashMap.set('pipenv','cd974eadd649ba8c9c2e3c7b564a49c8bb2ce95d6df043a7e942364f574c7613');\nhashMap.set('pixi','e31c397982ffa34222b061f23f3b3683f42523dd5dca45ecce2448b0ebc55ea2');\nhashMap.set('poetry','b2b917c200d25e01a3a198deb3bf33353535f27430142111cfab816c03bb966d');\nhashMap.set('pre-commit','760f2c291ae084db889f722390798a0e2d431ccdc3bc676e73b14901ebea19ac');\nhashMap.set('proto','412053d4550026b4ace490b46e970915b87ec1abf0b0a0c6c8c58ccf1fc16843');\nhashMap.set('pub','8e7c65dfd1999de4f7c44392e949a4d8f4701eb86df59d550e4657feb06b1872');\nhashMap.set('puppet','ba58ab689e44acc8f61c3569ab8b40fde01b8a9d3aad712708e2a419e57d8b45');\nhashMap.set('pyenv','9ede8becc97774f9040b40f4472d3e933534b596e04c360bfe0f3c6f95f25182');\nhashMap.set('quadlet','e1fc88a4e14cd595e89bb3d79b4adf2add3ce5eb80f75276e712c32598cca53d');\nhashMap.set('renovate-config','dfaf3f03ddaf70c332f7916106648f36dbfa6a36dd76d15dd27fa116ab3c174c');\nhashMap.set('ruby-version','2db2140d9eee8c555e729a4de0396fa2d78846d3149890ee12fa515bd654be97');\nhashMap.set('runtime-version','b582b168c0cc595e39010feb10f4b97a82683eb269e9598216fbb11cc186e160');\nhashMap.set('rust-toolchain','6ace53db02874d73620d2d872291839820a512a9529c42d174358c692e5db720');\nhashMap.set('sbt','e1eb5c7f0171a9bb1b6bd4a36a91039a31b6c84e0983d91d930be31a69506d9e');\nhashMap.set('scalafmt','9d36159b56835e96498af026a1fb0543200db0581681ef95ec54988f411e180f');\nhashMap.set('setup-cfg','4a3a7c812d34739c07685691e7e64c7d3127f9d7d4aff99dc45a25df97ed9745');\nhashMap.set('smithy','9641b91d065ffb63be0dd888139a0402dba41e550f8b44c592db9daf52109100');\nhashMap.set('sveltos','60dd75bb53ace31217211100d622fdb65068c6162758b6ae7103a6ce8bdc9f90');\nhashMap.set('swift','6932c904b0d18ad4845c46ce3f7d4c54dd8e411e16c31a782b399fe0b7dc550b');\nhashMap.set('tekton','33948f5bdf7553909fa63744adb26da97ddf366e9499bccab1250879570267c9');\nhashMap.set('terraform','5b0037e4a88e06efe6f006eff15c24d9e1fefdda40d282aa99f54c2637d21c4d');\nhashMap.set('terraform-version','ec8f786b9731d47f2c2fe0307caf64d7ddd83046fe7ff1f7d8423239f8b0f2aa');\nhashMap.set('terragrunt','300f8fb3c09667654412d2f5dd8ab4882e0f5d1d7a8bc39794993d2e7e58d1b7');\nhashMap.set('terragrunt-version','eea6087b33717d22ede2fc68c2f64df8390b75abe82110ed831a180648feb51d');\nhashMap.set('tflint-plugin','f423bfa2b42a2bfc0e38a33ebd4f9d452473e7ed4e7ad6384a99eb9a35d97479');\nhashMap.set('travis','f3e2f38e699c390b00ff481be5e91dceaa81609e93caf9a4214933de759c84fc');\nhashMap.set('typst','d080a79fbd961c6e21fcc505d544b7e0ff2126142acb1dcabdf6abbcd9339248');\nhashMap.set('unity3d','f13e25e115e3443f4e16cf31578acffa78fb1a5e23339680a92d8d6de6052920');\nhashMap.set('velaci','fda00ddb7cc23e9a37e0a8a253151df0a6930b4276d3e4f78cc54b9ac09af7de');\nhashMap.set('vendir','7db907b3b77ef5f3465f3c4339fbab56bbcdfd1bf34b3d33e4c178d2e07e23e7');\nhashMap.set('woodpecker','6110d3bec33aaeb3511d4bbfa896cec3c8e02fb04a6cff50c9ba81061c851045');\nhashMap.set('xcodegen','dad511d88a9ce1dbdde8b9731f3da7f2bdaa4ca8a083294ee58d56da62ab1683');\nhashMap.set('jsonata','416bcf61144b276b3112814c6e6d261aa29608f46fbb0516c471d35c16f8f0d7');\nhashMap.set('regex','20be5247fdc164173871a051acb0527da017d0c155c653d7563601f55e7b3ff5');"],"mappings":";AAAA,MAAa,0BAAU,IAAI,IAAoB;AAE/C,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,kBAAiB,kEAAkE;AAC/F,QAAQ,IAAI,OAAM,kEAAkE;AACpF,QAAQ,IAAI,OAAM,kEAAkE;AACpF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,QAAO,kEAAkE;AACrF,QAAQ,IAAI,mBAAkB,kEAAkE;AAChG,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,kBAAiB,kEAAkE;AAC/F,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,gBAAe,kEAAkE;AAC7F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,uBAAsB,kEAAkE;AACpG,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,OAAM,kEAAkE;AACpF,QAAQ,IAAI,eAAc,kEAAkE;AAC5F,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,QAAO,kEAAkE;AACrF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,aAAY,kEAAkE;AAC1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AAQ,IAAI,kBAAiB,kEAAkE;AAC/F,QAAQ,IAAI,OAAM,kEAAkE;AACpF,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,qBAAoB,kEAAkE;AAClG,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,sBAAqB,kEAAkE;AACnG,QAAQ,IAAI,iBAAgB,kEAAkE;AAC9F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE"}
1
+ {"version":3,"file":"fingerprint.generated.js","names":[],"sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"sourcesContent":["export const hashMap = new Map<string, string>();\n\nhashMap.set('ansible','a52394a36ac5517f7330473c31d93aa05b2ce607c5e951b48f25a4693cd20a81');\nhashMap.set('ansible-galaxy','0a264d6be73953d801510fdeff271e4071c274339569c6dab4e2a128eaf4869f');\nhashMap.set('ant','2df5943cf0ed19a21b94df13729dbb925655548130caf37e3e22bebaed518e17');\nhashMap.set('apm','bdb6931cc03f4ac02ebfdb56c4b3483bb6c5250fa952545f1a25584d502bbffd');\nhashMap.set('argocd','cff9cd22257bc460ae4b9936570bf0ed5585f280a55d26629deaeeb0bfee8eb5');\nhashMap.set('asdf','430eb99b58171700c8a59c78b9e648575e9b176b781d90dd10a710f7b69015bb');\nhashMap.set('azure-pipelines','a051fe5e7e4fef8208b5864131a2b52b4ae319936f1dd8ee5a4e1ef11359ec09');\nhashMap.set('batect','375d39b432013bedb1330cf40a2199dd822751b28578214f219e7bab98594b8d');\nhashMap.set('batect-wrapper','d999355511ea7f4053325a18b8cfc8d2b586c61e6760c35e557d383a673e3939');\nhashMap.set('bazel','c31bc0a0e23d32726bcc09aa67533ebc5058124bf89c88e09c837419f550801a');\nhashMap.set('bazel-module','9fbba0339f9f7785d52ab85c5f0f6385003093c063483c13feccba13ae438bef');\nhashMap.set('bazelisk','770f75a746dc6ba90c518788d5987d7df4243ef9eee122d1bb0556a93d6e1b11');\nhashMap.set('bicep','7246e0bfc06e0e28cbb03ac088c5591f648956b086e106aeb251fe5d628329db');\nhashMap.set('bitbucket-pipelines','59c0503494ab1442b127914503c01b97ac17b6742b19c632292d5aa24de115cd');\nhashMap.set('bitrise','478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42');\nhashMap.set('buildkite','b8b404f53cd5d61c39153fddf93945e621471c4ac6aa9960c881cd868922bb4c');\nhashMap.set('buildpacks','6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f');\nhashMap.set('bun','5820cfb6ebe018b8c336d481ea9ae319daaee6a2e368c45196fc8bc67cb3e755');\nhashMap.set('bun-version','df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4');\nhashMap.set('bundler','6e4784dd98c1f86ef64cc8cbf3128df48aebf920032d7792b54fdedd3dd9d4d5');\nhashMap.set('cake','9ebd8b481220b30a8860121d26184540a1a2fcc05ef780df9295dea39b386fad');\nhashMap.set('cargo','fe8136135c895dd08819f91a60cf105f8b951251b057092700101ace991ae1d7');\nhashMap.set('cdnurl','9a81c8e3c6ad6c788498c99fc1067ffdfcd92a427c3afaf8c0130975d83131f2');\nhashMap.set('circleci','91cbeb33ea20f9838e2c81a1195eb806f0b38fa282bc3679f62552f20575ca85');\nhashMap.set('cloudbuild','f4e40388944652c8a19f8518771ac8d3f3c4ccf81ddef0e68b463aca833cb73c');\nhashMap.set('cocoapods','f832e2beef885bb3fd697ed9bb3e8cd742926bfec37ff41212edd2dbb4edb3ba');\nhashMap.set('composer','f1294fb3866ff65a75d98fdef80b1df3d3a8856535b8c690d1799e1205e4b639');\nhashMap.set('conan','8d46e9a30ae628e26118aea10a98d1b846f7c5d96d51ce24693437d555f6d125');\nhashMap.set('copier','10ae4d7f8ff35faf3a3f9f25bf4c969ea960e19aaf8c012aee11f93f4d10533e');\nhashMap.set('cpanfile','07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3');\nhashMap.set('crossplane','5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40');\nhashMap.set('crow','eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0');\nhashMap.set('deno','05e7ab60494a20a5e7477f06a9e723e443d37643b6e1d9ba8d3d87126a051175');\nhashMap.set('deps-edn','06783dbc8b9c7bb84e162d1f75b7db56dfa021cc6f809dfd2314cee8b64af08d');\nhashMap.set('devbox','a40050cc61bd9b5d500ec111abb17bb15d5f82ab5b7699f66f628307ba8382c9');\nhashMap.set('devcontainer','24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec');\nhashMap.set('docker-compose','fba87b82cb0f2bfd66526631fbe928b8153e7ca701a5790d02b944df17417bb9');\nhashMap.set('dockerfile','78cb1e8b58653289dd4b73425c45495a4c4b41badd3614b8345aaf8ab73de09c');\nhashMap.set('droneci','661d2a2d7295af8dd7a1234c7090c42a89306bd574c3adf1fc67782efaad3998');\nhashMap.set('fleet','4942d52e82f35c41e2d46cf76f426e2d91b350338cfc0bbcb97e8aaae2a1ac0b');\nhashMap.set('flux','aad8c786c4a2b5820663027452eeb8fe84c3af8c8399261e85f0eade2e484fe8');\nhashMap.set('fvm','9b161df0f14bc6e536368952adf373e343630097121a913cea60ee284027fb90');\nhashMap.set('git-submodules','df8bb92b2906d8cddda2d4b302ee503f8002e3554d32d74cef2f584fe891f38f');\nhashMap.set('github-actions','7adddc8e590786084855ffe53292bff3098ac672f91c21cc39d45bcf0af2271f');\nhashMap.set('gitlabci','a5e1e66ef461e1c1e71062f85f35a212417e23627f4b002810f9a98295d6e672');\nhashMap.set('gitlabci-include','8860a15ab516fde00694f9bd9bf56fce4addafe5a55b5ddb9a4ec477d301d351');\nhashMap.set('glasskube','93e7b9000a17efa15a1abaaf320b5af9169b1ecd828fc0c881d98570ef9d9e30');\nhashMap.set('gleam','5e9b9f5f914afe5ed7b526c06c65111e3716d2dea9b0cbe7907bbc96db1064a3');\nhashMap.set('gomod','de042f3b5a900346c5f2df41f793f1716dc12145c38705c3064c6a7150b49495');\nhashMap.set('gradle','9e3ff52ce4ad2555929acdd4d32c417c4ef8714c23a92f2893ecc580fa4d6064');\nhashMap.set('gradle-wrapper','73ba30c34955fab7737454b5cff9aca6d1b5607d53c17c9e13d8ad96f6eaae87');\nhashMap.set('haskell-cabal','f158b7725e3143dfd2950e3de0bbccc2a61cd7eba87f7a54c5057e01252348e2');\nhashMap.set('helm-requirements','7ee9dace4c036dfe113c0c0e46369d8b83a739caa831660142ca98d3236a180a');\nhashMap.set('helm-values','0aa79bb0257d0d72e54dfd2653e59bfef63b97e46c035b7443593bdf6e6382aa');\nhashMap.set('helmfile','28572dd24b6746ca7065ee467aa13bbc8c3e8c0f88ae48e33bce88468c600100');\nhashMap.set('helmsman','951deeb3355da751ef39c9e932b26ea749450e32e75759e4b5fc29359e100b37');\nhashMap.set('helmv3','4a3cf47072978eb131d70cd13f3d0bbd4408b0290be2a798a4cbf6103189269b');\nhashMap.set('hermit','0fb25b7766c3a264fbb765ff75b1542b24136c4c9f933696d4a5aecfed637071');\nhashMap.set('homeassistant-manifest','05043c6db870cffbb6f8f3e351c025e3de227eaae0b24134b796aec46f84b65f');\nhashMap.set('homebrew','dffe954a4e18c2dc4bfdaa12222fe8ddc3395869afd5afa603fc2b6264747984');\nhashMap.set('html','81fa6c2bf2b868596584a48b949645207a2aa3081951ed99183ee50b70b77d5f');\nhashMap.set('jenkins','7fda0e7e0f3d5e18088ccb3594f727f4cfc48b064706bdaaf1a0a075b6a2cff5');\nhashMap.set('jsonnet-bundler','4cedeb0394e5c38361d1868ff45b4f34747ab8c492378b6e63dcaf1f4f3c024d');\nhashMap.set('kotlin-script','95ebc844c040ca047321b207d525220e29774a2a1fe06f9639e8353c66908564');\nhashMap.set('kubernetes','321e7d77fb3600dd4c00a86eaa1294927e7f92300b74fa2977d813dcaa3bb4de');\nhashMap.set('kustomize','aa830c27302555e12d7f04e342c96125d68c231028a2d3c459c4431516382584');\nhashMap.set('leiningen','c8397e376f1717c2f771ae9ea3ba6b720d2422b133cf937e762c44e42be146a2');\nhashMap.set('maven','c110b99291c2a5bc82cf7a69330275e9bbd7dc8ba3e9e987611dfcffbe002d8d');\nhashMap.set('maven-wrapper','6e53b6e4abf1d20b75094c7a70d66b4a5ac39954f009aa401f5e55dada8be4d0');\nhashMap.set('meteor','4636a47ba4dcfff19fe662572ef7a40d17146be3c966e00ef437e1fc8de92776');\nhashMap.set('mint','248fe4f1ea5c985921c286785792c97e06fc41f402b2d45df82f6aecd17f710e');\nhashMap.set('mise','279da4690751c3abee10badd12eb4ac6ef31d824c6bd3ada824859eca3109ebe');\nhashMap.set('mix','0f79163dc2a1c896599d152be635c23beaf16812ae3d8fbfffec98c7bd0de872');\nhashMap.set('nix','0f80f0b81f2197a7e588be5c115a32a826fc184593f4e879f7b60fafd97a977e');\nhashMap.set('nodenv','ac652c28481b001f7471f4183eac07b45d98ecbe83efc275830b0a1b2e0459b8');\nhashMap.set('npm','30c78bc1c29eeecbdedb4eacc52bd93eedfb07279fd385f893193dcac6196466');\nhashMap.set('nuget','b81fb0ca6cfeb86b004592b38ce176673e056d6a2ed41a9807afb0eb7ad405d2');\nhashMap.set('nvm','3eb77c7b0acf6d64753de78fad2499b352719853aa6872878c40675d14152322');\nhashMap.set('ocb','032b216684c14b0954e0bb019513a2aca3faaee5748587acb668d377d7c891ca');\nhashMap.set('osgi','d6567a733ef3983112b46fdccd7ceebfcd48411104e0c6b6e714d4310db48024');\nhashMap.set('pep621','52450676f8b0e05134b3e8947b832195ef40bcaec1ce43d71351a2f797b80d75');\nhashMap.set('pep723','77022a0eae6a3cbb74a1e6d596db1276e379768e40448192b3fa81edd14ca73f');\nhashMap.set('pip-compile','7e418b8bdaeed38c1372eb19e0ae1c64999000e128d8754e37368638037b4c5c');\nhashMap.set('pip_requirements','bf3a407f72abf711230247bef94ba5dc84c08a35107b0f017912fad66afa716a');\nhashMap.set('pip_setup','df18fba2bdcf48f3ca12a8f7e5cd28df31e2368d5528127277038ef4206eca79');\nhashMap.set('pipenv','cd974eadd649ba8c9c2e3c7b564a49c8bb2ce95d6df043a7e942364f574c7613');\nhashMap.set('pixi','e31c397982ffa34222b061f23f3b3683f42523dd5dca45ecce2448b0ebc55ea2');\nhashMap.set('poetry','b2b917c200d25e01a3a198deb3bf33353535f27430142111cfab816c03bb966d');\nhashMap.set('pre-commit','760f2c291ae084db889f722390798a0e2d431ccdc3bc676e73b14901ebea19ac');\nhashMap.set('proto','412053d4550026b4ace490b46e970915b87ec1abf0b0a0c6c8c58ccf1fc16843');\nhashMap.set('pub','8e7c65dfd1999de4f7c44392e949a4d8f4701eb86df59d550e4657feb06b1872');\nhashMap.set('puppet','ba58ab689e44acc8f61c3569ab8b40fde01b8a9d3aad712708e2a419e57d8b45');\nhashMap.set('pyenv','9ede8becc97774f9040b40f4472d3e933534b596e04c360bfe0f3c6f95f25182');\nhashMap.set('quadlet','e1fc88a4e14cd595e89bb3d79b4adf2add3ce5eb80f75276e712c32598cca53d');\nhashMap.set('renovate-config','dfaf3f03ddaf70c332f7916106648f36dbfa6a36dd76d15dd27fa116ab3c174c');\nhashMap.set('ruby-version','2db2140d9eee8c555e729a4de0396fa2d78846d3149890ee12fa515bd654be97');\nhashMap.set('runtime-version','b582b168c0cc595e39010feb10f4b97a82683eb269e9598216fbb11cc186e160');\nhashMap.set('rust-toolchain','6ace53db02874d73620d2d872291839820a512a9529c42d174358c692e5db720');\nhashMap.set('sbt','e1eb5c7f0171a9bb1b6bd4a36a91039a31b6c84e0983d91d930be31a69506d9e');\nhashMap.set('scalafmt','9d36159b56835e96498af026a1fb0543200db0581681ef95ec54988f411e180f');\nhashMap.set('setup-cfg','4a3a7c812d34739c07685691e7e64c7d3127f9d7d4aff99dc45a25df97ed9745');\nhashMap.set('smithy','9641b91d065ffb63be0dd888139a0402dba41e550f8b44c592db9daf52109100');\nhashMap.set('sveltos','60dd75bb53ace31217211100d622fdb65068c6162758b6ae7103a6ce8bdc9f90');\nhashMap.set('swift','6932c904b0d18ad4845c46ce3f7d4c54dd8e411e16c31a782b399fe0b7dc550b');\nhashMap.set('tekton','33948f5bdf7553909fa63744adb26da97ddf366e9499bccab1250879570267c9');\nhashMap.set('terraform','5b0037e4a88e06efe6f006eff15c24d9e1fefdda40d282aa99f54c2637d21c4d');\nhashMap.set('terraform-version','ec8f786b9731d47f2c2fe0307caf64d7ddd83046fe7ff1f7d8423239f8b0f2aa');\nhashMap.set('terragrunt','300f8fb3c09667654412d2f5dd8ab4882e0f5d1d7a8bc39794993d2e7e58d1b7');\nhashMap.set('terragrunt-version','eea6087b33717d22ede2fc68c2f64df8390b75abe82110ed831a180648feb51d');\nhashMap.set('tflint-plugin','f423bfa2b42a2bfc0e38a33ebd4f9d452473e7ed4e7ad6384a99eb9a35d97479');\nhashMap.set('travis','f3e2f38e699c390b00ff481be5e91dceaa81609e93caf9a4214933de759c84fc');\nhashMap.set('typst','d080a79fbd961c6e21fcc505d544b7e0ff2126142acb1dcabdf6abbcd9339248');\nhashMap.set('unity3d','f13e25e115e3443f4e16cf31578acffa78fb1a5e23339680a92d8d6de6052920');\nhashMap.set('velaci','fda00ddb7cc23e9a37e0a8a253151df0a6930b4276d3e4f78cc54b9ac09af7de');\nhashMap.set('vendir','7db907b3b77ef5f3465f3c4339fbab56bbcdfd1bf34b3d33e4c178d2e07e23e7');\nhashMap.set('woodpecker','6110d3bec33aaeb3511d4bbfa896cec3c8e02fb04a6cff50c9ba81061c851045');\nhashMap.set('xcodegen','dad511d88a9ce1dbdde8b9731f3da7f2bdaa4ca8a083294ee58d56da62ab1683');\nhashMap.set('jsonata','416bcf61144b276b3112814c6e6d261aa29608f46fbb0516c471d35c16f8f0d7');\nhashMap.set('regex','20be5247fdc164173871a051acb0527da017d0c155c653d7563601f55e7b3ff5');"],"mappings":";AAAA,MAAa,0BAAU,IAAI,IAAoB;AAE/C,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,kBAAiB,kEAAkE;AAC/F,QAAQ,IAAI,OAAM,kEAAkE;AACpF,QAAQ,IAAI,OAAM,kEAAkE;AACpF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,QAAO,kEAAkE;AACrF,QAAQ,IAAI,mBAAkB,kEAAkE;AAChG,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,kBAAiB,kEAAkE;AAC/F,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,gBAAe,kEAAkE;AAC7F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,uBAAsB,kEAAkE;AACpG,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,OAAM,kEAAkE;AACpF,QAAQ,IAAI,eAAc,kEAAkE;AAC5F,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,QAAO,kEAAkE;AACrF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,cAAa,k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E;AAC7F,QAAQ,IAAI,mBAAkB,kEAAkE;AAChG,QAAQ,IAAI,kBAAiB,kEAAkE;AAC/F,QAAQ,IAAI,OAAM,kEAAkE;AACpF,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,qBAAoB,kEAAkE;AAClG,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,sBAAqB,kEAAkE;AACnG,QAAQ,IAAI,iBAAgB,kEAAkE;AAC9F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE"}
@@ -8,7 +8,7 @@ import { resolveToolConstraint } from "../util.js";
8
8
  import { PNPM_CACHE_DIR, PNPM_STORE_DIR } from "./constants.js";
9
9
  import { getNodeToolConstraint } from "./post-update/node-version.js";
10
10
  import { processHostRules } from "./post-update/rules.js";
11
- import { getNpmrcContent, resetNpmrcContent, updateNpmrcContent } from "./utils.js";
11
+ import { withNpmrcHostRules } from "./utils.js";
12
12
  import { lazyLoadPackageJson } from "./post-update/utils.js";
13
13
  import { isEmptyArray, isNonEmptyObject, isString } from "@sindresorhus/is";
14
14
  import { isScalar, isSeq, parseDocument } from "yaml";
@@ -37,7 +37,6 @@ async function handlePackageManagerUpdates(updateArtifactsConfig) {
37
37
  await writeLocalFile(packageFileName, existingPackageFileContent);
38
38
  const pkgFileDir = upath.dirname(packageFileName);
39
39
  const { additionalNpmrcContent } = processHostRules();
40
- const npmrcContent = await getNpmrcContent(pkgFileDir);
41
40
  const lazyPkgJson = lazyLoadPackageJson(pkgFileDir);
42
41
  const cmd = `corepack use ${quote(`${depName}@${newVersion}`)}`;
43
42
  const nodeConstraints = await getNodeToolConstraint(config, updatedDeps, pkgFileDir, lazyPkgJson);
@@ -57,26 +56,25 @@ async function handlePackageManagerUpdates(updateArtifactsConfig) {
57
56
  }],
58
57
  docker: {}
59
58
  };
60
- await updateNpmrcContent(pkgFileDir, npmrcContent, additionalNpmrcContent);
61
- try {
62
- await exec(cmd, execOptions);
63
- await resetNpmrcContent(pkgFileDir, npmrcContent);
64
- const newPackageFileContent = await readLocalFile(packageFileName, "utf8");
65
- if (!newPackageFileContent || existingPackageFileContent === newPackageFileContent) return null;
66
- logger.debug("Returning updated package.json");
67
- return { file: {
68
- type: "addition",
69
- path: packageFileName,
70
- contents: newPackageFileContent
71
- } };
72
- } catch (err) {
73
- logger.warn({ err }, "Error updating package.json");
74
- await resetNpmrcContent(pkgFileDir, npmrcContent);
75
- return { artifactError: {
76
- fileName: packageFileName,
77
- stderr: err.message
78
- } };
79
- }
59
+ return await withNpmrcHostRules(pkgFileDir, additionalNpmrcContent, async () => {
60
+ try {
61
+ await exec(cmd, execOptions);
62
+ const newPackageFileContent = await readLocalFile(packageFileName, "utf8");
63
+ if (!newPackageFileContent || existingPackageFileContent === newPackageFileContent) return null;
64
+ logger.debug("Returning updated package.json");
65
+ return { file: {
66
+ type: "addition",
67
+ path: packageFileName,
68
+ contents: newPackageFileContent
69
+ } };
70
+ } catch (err) {
71
+ logger.warn({ err }, "Error updating package.json");
72
+ return { artifactError: {
73
+ fileName: packageFileName,
74
+ stderr: err.message
75
+ } };
76
+ }
77
+ });
80
78
  }
81
79
  /**
82
80
  * Update the minimumReleaseAgeExclude setting in pnpm-workspace.yaml if needed
@@ -1 +1 @@
1
- {"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/npm/artifacts.ts"],"sourcesContent":["import { isEmptyArray, isNonEmptyObject, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport upath from 'upath';\nimport type { Scalar, YAMLSeq } from 'yaml';\nimport { isScalar, isSeq, parseDocument } from 'yaml';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n ensureCacheDir,\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { matchRegexOrGlob } from '../../../util/string-match.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { PNPM_CACHE_DIR, PNPM_STORE_DIR } from './constants.ts';\nimport { getNodeToolConstraint } from './post-update/node-version.ts';\nimport { processHostRules } from './post-update/rules.ts';\nimport { lazyLoadPackageJson } from './post-update/utils.ts';\nimport {\n getNpmrcContent,\n resetNpmrcContent,\n updateNpmrcContent,\n} from './utils.ts';\n\n// eg. 8.15.5+sha256.4b4efa12490e5055d59b9b9fc9438b7d581a6b7af3b5675eb5c5f447cee1a589\nconst versionWithHashRegString = '^(?<version>.*)\\\\+(?<hash>.*)';\n\n// Execute 'corepack use' command for npm manager updates\n// This step is necessary because Corepack recommends attaching a hash after the version\n// The hash is generated only after running 'corepack use' and cannot be fetched from the npm registry\nexport async function updateArtifacts(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`npm.updateArtifacts(${updateArtifactsConfig.packageFileName})`);\n let res: UpdateArtifactsResult[] = [];\n res.push(\n coerceObject(await handlePackageManagerUpdates(updateArtifactsConfig)),\n );\n res.push(coerceObject(await updatePnpmWorkspace(updateArtifactsConfig)));\n\n res = res.filter(isNonEmptyObject);\n if (res.length === 0) {\n return null;\n }\n\n return res;\n}\n\nasync function handlePackageManagerUpdates(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const {\n packageFileName,\n config,\n updatedDeps,\n newPackageFileContent: existingPackageFileContent,\n } = updateArtifactsConfig;\n const packageManagerUpdate = updatedDeps.find(\n (dep) => dep.depType === 'packageManager',\n );\n\n if (!packageManagerUpdate) {\n logger.debug('No packageManager updates - returning null');\n return null;\n }\n\n const { currentValue, depName, newVersion } = packageManagerUpdate;\n\n // Execute 'corepack use' command only if the currentValue already has hash in it\n if (!currentValue || !regEx(versionWithHashRegString).test(currentValue)) {\n return null;\n }\n\n // write old updates before executing corepack update so that they are not removed from package file\n await writeLocalFile(packageFileName, existingPackageFileContent);\n\n // Asumming that corepack only needs to modify the package.json file in the root folder\n // As it should not be regular practice to have different package managers in different workspaces\n const pkgFileDir = upath.dirname(packageFileName);\n const { additionalNpmrcContent } = processHostRules();\n const npmrcContent = await getNpmrcContent(pkgFileDir);\n const lazyPkgJson = lazyLoadPackageJson(pkgFileDir);\n const cmd = `corepack use ${quote(`${depName}@${newVersion}`)}`;\n\n const nodeConstraints = await getNodeToolConstraint(\n config,\n updatedDeps,\n pkgFileDir,\n lazyPkgJson,\n );\n\n const pnpmConfigCacheDir = await ensureCacheDir(PNPM_CACHE_DIR);\n const pnpmConfigStoreDir = await ensureCacheDir(PNPM_STORE_DIR);\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv: {\n // To make sure pnpm store location is consistent between \"corepack use\"\n // here and the pnpm commands in ./post-update/pnpm.ts. Check\n // ./post-update/pnpm.ts for more details.\n npm_config_cache_dir: pnpmConfigCacheDir,\n npm_config_store_dir: pnpmConfigStoreDir,\n pnpm_config_cache_dir: pnpmConfigCacheDir,\n pnpm_config_store_dir: pnpmConfigStoreDir,\n },\n toolConstraints: [\n nodeConstraints,\n {\n toolName: 'corepack',\n constraint: await resolveToolConstraint(config, 'corepack'),\n },\n ],\n docker: {},\n };\n\n await updateNpmrcContent(pkgFileDir, npmrcContent, additionalNpmrcContent);\n try {\n await exec(cmd, execOptions);\n await resetNpmrcContent(pkgFileDir, npmrcContent);\n const newPackageFileContent = await readLocalFile(packageFileName, 'utf8');\n if (\n !newPackageFileContent ||\n existingPackageFileContent === newPackageFileContent\n ) {\n return null;\n }\n logger.debug('Returning updated package.json');\n return {\n file: {\n type: 'addition',\n path: packageFileName,\n contents: newPackageFileContent,\n },\n };\n } catch (err) {\n logger.warn({ err }, 'Error updating package.json');\n await resetNpmrcContent(pkgFileDir, npmrcContent);\n return {\n artifactError: {\n fileName: packageFileName,\n stderr: err.message,\n },\n };\n }\n}\n\n/**\n * Update the minimumReleaseAgeExclude setting in pnpm-workspace.yaml if needed\n */\nasync function updatePnpmWorkspace(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const upgrades = updateArtifactsConfig.updatedDeps.filter(\n (u) => u.isVulnerabilityAlert,\n );\n // return early if no security updates are present\n if (isEmptyArray(upgrades)) {\n return null;\n }\n\n const pnpmLockFile = upgrades[0].managerData?.pnpmLockFile;\n if (!isString(pnpmLockFile)) {\n logger.debug(\n 'No pnpm shrinkwrap found, not attempting to update pnpm-workspace.yaml',\n );\n return null;\n }\n const lockFileDir = upath.dirname(pnpmLockFile);\n const pnpmWorkspaceFilePath = upath.join(lockFileDir, 'pnpm-workspace.yaml');\n\n if (!(await localPathExists(pnpmWorkspaceFilePath))) {\n return null;\n }\n\n // use already-updated content when updating the workspace file itself\n const packageFileContent =\n updateArtifactsConfig.packageFileName === pnpmWorkspaceFilePath\n ? updateArtifactsConfig.newPackageFileContent\n : (await readLocalFile(pnpmWorkspaceFilePath, 'utf8'))!;\n const doc = parseDocument(packageFileContent);\n\n if (!doc.get('minimumReleaseAge')) {\n return null;\n }\n\n let updated = false;\n\n for (const upgrade of upgrades) {\n let excludeNode = doc.getIn(['minimumReleaseAgeExclude']) as YAMLSeq | null;\n // v8 ignore next -- TODO: add test #40625\n const newVersion = upgrade.newVersion ?? upgrade.newValue;\n // For pnpm overrides with range selectors (e.g. \"pkg@<=1.0.0\"), depName contains\n // the full key including the selector. Use packageName (bare package name) for\n // minimumReleaseAgeExclude entries which require exact versions only.\n const excludeDepName = upgrade.packageName ?? upgrade.depName;\n\n /* v8 ignore if -- should not happen, adding for type narrowing*/\n if (excludeNode && !isSeq(excludeNode)) {\n return null;\n }\n\n if (!excludeNode) {\n logger.debug('Adding new exclude block');\n excludeNode = doc.createNode([]);\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n excludeNode.items.push(newItem);\n doc.set('minimumReleaseAgeExclude', excludeNode);\n updated = true;\n continue;\n }\n\n const {\n item: matchedItem,\n allExcluded,\n malformed,\n } = getMatchedItem(excludeDepName!, excludeNode.items);\n\n if (allExcluded) {\n // still clean up any malformed entries even when a wildcard covers the package\n } else if (malformed && isScalar<string>(matchedItem)) {\n logger.debug(\n { entry: matchedItem.value, excludeDepName, newVersion },\n 'Replacing malformed minimumReleaseAgeExclude entry',\n );\n matchedItem.value = `${excludeDepName}@${newVersion}`;\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n } else if (isScalar<string>(matchedItem)) {\n // if we have a comment before the list, which includes the dependency\n if (excludeNode?.commentBefore?.includes(`${excludeDepName}@`)) {\n // and it doesn't already have the version included in it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n excludeNode.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // then append it\n\n // normalize value (no quote handling needed)\n excludeNode.commentBefore = `${excludeNode.commentBefore} || ${newVersion}`;\n updated = true;\n }\n }\n // otherwise, if it's in our matched item's comment\n else if (matchedItem.commentBefore) {\n // add it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // normalize value (no quote handling needed)\n matchedItem.commentBefore = `${matchedItem.commentBefore} || ${newVersion}`;\n updated = true;\n }\n } else {\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n }\n\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.value,\n excludeDepName,\n newVersion,\n )\n ) {\n matchedItem.value = `${matchedItem.value} || ${newVersion}`;\n updated = true;\n }\n } else {\n // add new entry\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n\n excludeNode.items.push(newItem);\n updated = true;\n }\n\n // Remove any malformed entries for the same package left over from the prior bug\n for (let i = excludeNode.items.length - 1; i >= 0; i--) {\n const item = excludeNode.items[i];\n if (\n item !== matchedItem &&\n isScalar(item) &&\n isString(item.value) &&\n item.value.startsWith(`${excludeDepName}@`) &&\n !isValidMinimumReleaseAgeExcludeEntry(item.value, excludeDepName!)\n ) {\n excludeNode.items.splice(i, 1);\n updated = true;\n }\n }\n }\n\n if (!updated) {\n return null;\n }\n\n const newContent = doc.toString();\n await writeLocalFile(pnpmWorkspaceFilePath, newContent);\n\n return {\n file: {\n type: 'addition',\n path: pnpmWorkspaceFilePath,\n contents: newContent,\n },\n };\n}\n\nfunction getMatchedItem(\n depName: string,\n items: unknown[],\n): {\n item: Scalar | null;\n allExcluded: boolean;\n malformed?: boolean;\n} {\n let malformedItem: Scalar | null = null;\n\n for (const item of items) {\n /* v8 ignore if -- should not happen */\n if (!isScalar(item) || !isString(item.value)) {\n continue;\n }\n\n if (item.value.startsWith(`${depName}@`)) {\n if (isValidMinimumReleaseAgeExcludeEntry(item.value, depName)) {\n return {\n allExcluded: false,\n item,\n };\n }\n malformedItem ??= item;\n continue;\n }\n\n if (item.value === depName || matchRegexOrGlob(depName, item.value)) {\n return {\n allExcluded: true,\n item,\n };\n }\n }\n\n if (malformedItem) {\n return {\n allExcluded: false,\n item: malformedItem,\n malformed: true,\n };\n }\n\n return {\n item: null,\n allExcluded: false,\n };\n}\n\n/** pnpm requires package@version entries without range selectors or extra @ in the version part */\nfunction isValidMinimumReleaseAgeExcludeEntry(\n value: string,\n packageName: string,\n): boolean {\n return !value.slice(`${packageName}@`.length).includes('@');\n}\n\n/** determine whether a comment or a list item contains the depName at a given newVersion */\nfunction minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n line: string,\n depName: string | undefined,\n newVersion: string | undefined,\n): boolean {\n if (line.includes(`${depName}@${newVersion}`)) {\n return true;\n }\n\n if (line.includes(`|| ${newVersion}`)) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,MAAM,2BAA2B;AAKjC,eAAsB,gBACpB,uBACyC;CACzC,OAAO,MAAM,uBAAuB,sBAAsB,gBAAgB,EAAE;CAC5E,IAAI,MAA+B,CAAC;CACpC,IAAI,KACF,aAAa,MAAM,4BAA4B,qBAAqB,CAAC,CACvE;CACA,IAAI,KAAK,aAAa,MAAM,oBAAoB,qBAAqB,CAAC,CAAC;CAEvE,MAAM,IAAI,OAAO,gBAAgB;CACjC,IAAI,IAAI,WAAW,GACjB,OAAO;CAGT,OAAO;AACT;AAEA,eAAe,4BACb,uBACuC;CACvC,MAAM,EACJ,iBACA,QACA,aACA,uBAAuB,+BACrB;CACJ,MAAM,uBAAuB,YAAY,MACtC,QAAQ,IAAI,YAAY,gBAC3B;CAEA,IAAI,CAAC,sBAAsB;EACzB,OAAO,MAAM,4CAA4C;EACzD,OAAO;CACT;CAEA,MAAM,EAAE,cAAc,SAAS,eAAe;CAG9C,IAAI,CAAC,gBAAgB,CAAC,MAAM,wBAAwB,CAAC,CAAC,KAAK,YAAY,GACrE,OAAO;CAIT,MAAM,eAAe,iBAAiB,0BAA0B;CAIhE,MAAM,aAAa,MAAM,QAAQ,eAAe;CAChD,MAAM,EAAE,2BAA2B,iBAAiB;CACpD,MAAM,eAAe,MAAM,gBAAgB,UAAU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I,KAAK,UAAU,WAAW,iBAAiB,SAAS,KAAK,KAAK,GAChE,OAAO;GACL,aAAa;GACb;EACF;CAEJ;CAEA,IAAI,eACF,OAAO;EACL,aAAa;EACb,MAAM;EACN,WAAW;CACb;CAGF,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;;AAGA,SAAS,qCACP,OACA,aACS;CACT,OAAO,CAAC,MAAM,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC,SAAS,GAAG;AAC5D;;AAGA,SAAS,kDACP,MACA,SACA,YACS;CACT,IAAI,KAAK,SAAS,GAAG,QAAQ,GAAG,YAAY,GAC1C,OAAO;CAGT,IAAI,KAAK,SAAS,MAAM,YAAY,GAClC,OAAO;CAGT,OAAO;AACT"}
1
+ {"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/npm/artifacts.ts"],"sourcesContent":["import { isEmptyArray, isNonEmptyObject, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport upath from 'upath';\nimport type { Scalar, YAMLSeq } from 'yaml';\nimport { isScalar, isSeq, parseDocument } from 'yaml';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n ensureCacheDir,\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { matchRegexOrGlob } from '../../../util/string-match.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { PNPM_CACHE_DIR, PNPM_STORE_DIR } from './constants.ts';\nimport { getNodeToolConstraint } from './post-update/node-version.ts';\nimport { processHostRules } from './post-update/rules.ts';\nimport { lazyLoadPackageJson } from './post-update/utils.ts';\nimport { withNpmrcHostRules } from './utils.ts';\n\n// eg. 8.15.5+sha256.4b4efa12490e5055d59b9b9fc9438b7d581a6b7af3b5675eb5c5f447cee1a589\nconst versionWithHashRegString = '^(?<version>.*)\\\\+(?<hash>.*)';\n\n// Execute 'corepack use' command for npm manager updates\n// This step is necessary because Corepack recommends attaching a hash after the version\n// The hash is generated only after running 'corepack use' and cannot be fetched from the npm registry\nexport async function updateArtifacts(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`npm.updateArtifacts(${updateArtifactsConfig.packageFileName})`);\n let res: UpdateArtifactsResult[] = [];\n res.push(\n coerceObject(await handlePackageManagerUpdates(updateArtifactsConfig)),\n );\n res.push(coerceObject(await updatePnpmWorkspace(updateArtifactsConfig)));\n\n res = res.filter(isNonEmptyObject);\n if (res.length === 0) {\n return null;\n }\n\n return res;\n}\n\nasync function handlePackageManagerUpdates(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const {\n packageFileName,\n config,\n updatedDeps,\n newPackageFileContent: existingPackageFileContent,\n } = updateArtifactsConfig;\n const packageManagerUpdate = updatedDeps.find(\n (dep) => dep.depType === 'packageManager',\n );\n\n if (!packageManagerUpdate) {\n logger.debug('No packageManager updates - returning null');\n return null;\n }\n\n const { currentValue, depName, newVersion } = packageManagerUpdate;\n\n // Execute 'corepack use' command only if the currentValue already has hash in it\n if (!currentValue || !regEx(versionWithHashRegString).test(currentValue)) {\n return null;\n }\n\n // write old updates before executing corepack update so that they are not removed from package file\n await writeLocalFile(packageFileName, existingPackageFileContent);\n\n // Asumming that corepack only needs to modify the package.json file in the root folder\n // As it should not be regular practice to have different package managers in different workspaces\n const pkgFileDir = upath.dirname(packageFileName);\n const { additionalNpmrcContent } = processHostRules();\n const lazyPkgJson = lazyLoadPackageJson(pkgFileDir);\n const cmd = `corepack use ${quote(`${depName}@${newVersion}`)}`;\n\n const nodeConstraints = await getNodeToolConstraint(\n config,\n updatedDeps,\n pkgFileDir,\n lazyPkgJson,\n );\n\n const pnpmConfigCacheDir = await ensureCacheDir(PNPM_CACHE_DIR);\n const pnpmConfigStoreDir = await ensureCacheDir(PNPM_STORE_DIR);\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv: {\n // To make sure pnpm store location is consistent between \"corepack use\"\n // here and the pnpm commands in ./post-update/pnpm.ts. Check\n // ./post-update/pnpm.ts for more details.\n npm_config_cache_dir: pnpmConfigCacheDir,\n npm_config_store_dir: pnpmConfigStoreDir,\n pnpm_config_cache_dir: pnpmConfigCacheDir,\n pnpm_config_store_dir: pnpmConfigStoreDir,\n },\n toolConstraints: [\n nodeConstraints,\n {\n toolName: 'corepack',\n constraint: await resolveToolConstraint(config, 'corepack'),\n },\n ],\n docker: {},\n };\n\n return await withNpmrcHostRules(\n pkgFileDir,\n additionalNpmrcContent,\n async () => {\n try {\n await exec(cmd, execOptions);\n const newPackageFileContent = await readLocalFile(\n packageFileName,\n 'utf8',\n );\n if (\n !newPackageFileContent ||\n existingPackageFileContent === newPackageFileContent\n ) {\n return null;\n }\n logger.debug('Returning updated package.json');\n return {\n file: {\n type: 'addition',\n path: packageFileName,\n contents: newPackageFileContent,\n },\n };\n } catch (err) {\n logger.warn({ err }, 'Error updating package.json');\n return {\n artifactError: {\n fileName: packageFileName,\n stderr: err.message,\n },\n };\n }\n },\n );\n}\n\n/**\n * Update the minimumReleaseAgeExclude setting in pnpm-workspace.yaml if needed\n */\nasync function updatePnpmWorkspace(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const upgrades = updateArtifactsConfig.updatedDeps.filter(\n (u) => u.isVulnerabilityAlert,\n );\n // return early if no security updates are present\n if (isEmptyArray(upgrades)) {\n return null;\n }\n\n const pnpmLockFile = upgrades[0].managerData?.pnpmLockFile;\n if (!isString(pnpmLockFile)) {\n logger.debug(\n 'No pnpm shrinkwrap found, not attempting to update pnpm-workspace.yaml',\n );\n return null;\n }\n const lockFileDir = upath.dirname(pnpmLockFile);\n const pnpmWorkspaceFilePath = upath.join(lockFileDir, 'pnpm-workspace.yaml');\n\n if (!(await localPathExists(pnpmWorkspaceFilePath))) {\n return null;\n }\n\n // use already-updated content when updating the workspace file itself\n const packageFileContent =\n updateArtifactsConfig.packageFileName === pnpmWorkspaceFilePath\n ? updateArtifactsConfig.newPackageFileContent\n : (await readLocalFile(pnpmWorkspaceFilePath, 'utf8'))!;\n const doc = parseDocument(packageFileContent);\n\n if (!doc.get('minimumReleaseAge')) {\n return null;\n }\n\n let updated = false;\n\n for (const upgrade of upgrades) {\n let excludeNode = doc.getIn(['minimumReleaseAgeExclude']) as YAMLSeq | null;\n // v8 ignore next -- TODO: add test #40625\n const newVersion = upgrade.newVersion ?? upgrade.newValue;\n // For pnpm overrides with range selectors (e.g. \"pkg@<=1.0.0\"), depName contains\n // the full key including the selector. Use packageName (bare package name) for\n // minimumReleaseAgeExclude entries which require exact versions only.\n const excludeDepName = upgrade.packageName ?? upgrade.depName;\n\n /* v8 ignore if -- should not happen, adding for type narrowing*/\n if (excludeNode && !isSeq(excludeNode)) {\n return null;\n }\n\n if (!excludeNode) {\n logger.debug('Adding new exclude block');\n excludeNode = doc.createNode([]);\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n excludeNode.items.push(newItem);\n doc.set('minimumReleaseAgeExclude', excludeNode);\n updated = true;\n continue;\n }\n\n const {\n item: matchedItem,\n allExcluded,\n malformed,\n } = getMatchedItem(excludeDepName!, excludeNode.items);\n\n if (allExcluded) {\n // still clean up any malformed entries even when a wildcard covers the package\n } else if (malformed && isScalar<string>(matchedItem)) {\n logger.debug(\n { entry: matchedItem.value, excludeDepName, newVersion },\n 'Replacing malformed minimumReleaseAgeExclude entry',\n );\n matchedItem.value = `${excludeDepName}@${newVersion}`;\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n } else if (isScalar<string>(matchedItem)) {\n // if we have a comment before the list, which includes the dependency\n if (excludeNode?.commentBefore?.includes(`${excludeDepName}@`)) {\n // and it doesn't already have the version included in it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n excludeNode.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // then append it\n\n // normalize value (no quote handling needed)\n excludeNode.commentBefore = `${excludeNode.commentBefore} || ${newVersion}`;\n updated = true;\n }\n }\n // otherwise, if it's in our matched item's comment\n else if (matchedItem.commentBefore) {\n // add it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // normalize value (no quote handling needed)\n matchedItem.commentBefore = `${matchedItem.commentBefore} || ${newVersion}`;\n updated = true;\n }\n } else {\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n }\n\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.value,\n excludeDepName,\n newVersion,\n )\n ) {\n matchedItem.value = `${matchedItem.value} || ${newVersion}`;\n updated = true;\n }\n } else {\n // add new entry\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n\n excludeNode.items.push(newItem);\n updated = true;\n }\n\n // Remove any malformed entries for the same package left over from the prior bug\n for (let i = excludeNode.items.length - 1; i >= 0; i--) {\n const item = excludeNode.items[i];\n if (\n item !== matchedItem &&\n isScalar(item) &&\n isString(item.value) &&\n item.value.startsWith(`${excludeDepName}@`) &&\n !isValidMinimumReleaseAgeExcludeEntry(item.value, excludeDepName!)\n ) {\n excludeNode.items.splice(i, 1);\n updated = true;\n }\n }\n }\n\n if (!updated) {\n return null;\n }\n\n const newContent = doc.toString();\n await writeLocalFile(pnpmWorkspaceFilePath, newContent);\n\n return {\n file: {\n type: 'addition',\n path: pnpmWorkspaceFilePath,\n contents: newContent,\n },\n };\n}\n\nfunction getMatchedItem(\n depName: string,\n items: unknown[],\n): {\n item: Scalar | null;\n allExcluded: boolean;\n malformed?: boolean;\n} {\n let malformedItem: Scalar | null = null;\n\n for (const item of items) {\n /* v8 ignore if -- should not happen */\n if (!isScalar(item) || !isString(item.value)) {\n continue;\n }\n\n if (item.value.startsWith(`${depName}@`)) {\n if (isValidMinimumReleaseAgeExcludeEntry(item.value, depName)) {\n return {\n allExcluded: false,\n item,\n };\n }\n malformedItem ??= item;\n continue;\n }\n\n if (item.value === depName || matchRegexOrGlob(depName, item.value)) {\n return {\n allExcluded: true,\n item,\n };\n }\n }\n\n if (malformedItem) {\n return {\n allExcluded: false,\n item: malformedItem,\n malformed: true,\n };\n }\n\n return {\n item: null,\n allExcluded: false,\n };\n}\n\n/** pnpm requires package@version entries without range selectors or extra @ in the version part */\nfunction isValidMinimumReleaseAgeExcludeEntry(\n value: string,\n packageName: string,\n): boolean {\n return !value.slice(`${packageName}@`.length).includes('@');\n}\n\n/** determine whether a comment or a list item contains the depName at a given newVersion */\nfunction minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n line: string,\n depName: string | undefined,\n newVersion: string | undefined,\n): boolean {\n if (line.includes(`${depName}@${newVersion}`)) {\n return true;\n }\n\n if (line.includes(`|| ${newVersion}`)) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,MAAM,2BAA2B;AAKjC,eAAsB,gBACpB,uBACyC;CACzC,OAAO,MAAM,uBAAuB,sBAAsB,gBAAgB,EAAE;CAC5E,IAAI,MAA+B,CAAC;CACpC,IAAI,KACF,aAAa,MAAM,4BAA4B,qBAAqB,CAAC,CACvE;CACA,IAAI,KAAK,aAAa,MAAM,oBAAoB,qBAAqB,CAAC,CAAC;CAEvE,MAAM,IAAI,OAAO,gBAAgB;CACjC,IAAI,IAAI,WAAW,GACjB,OAAO;CAGT,OAAO;AACT;AAEA,eAAe,4BACb,uBACuC;CACvC,MAAM,EACJ,iBACA,QACA,aACA,uBAAuB,+BACrB;CACJ,MAAM,uBAAuB,YAAY,MACtC,QAAQ,IAAI,YAAY,gBA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