renovate 44.85.1 → 44.87.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.
- package/dist/data/replacements.js +11 -0
- package/dist/modules/datasource/conan/index.js +2 -0
- package/dist/modules/datasource/conan/index.js.map +1 -1
- package/dist/modules/datasource/cpan/index.js +1 -0
- package/dist/modules/datasource/cpan/index.js.map +1 -1
- package/dist/modules/datasource/dart/index.js +1 -0
- package/dist/modules/datasource/dart/index.js.map +1 -1
- package/dist/modules/datasource/deb/index.js +3 -0
- package/dist/modules/datasource/deb/index.js.map +1 -1
- package/dist/modules/datasource/deno/index.js +1 -0
- package/dist/modules/datasource/deno/index.js.map +1 -1
- package/dist/modules/datasource/docker/dockerhub-cache.js +1 -0
- package/dist/modules/datasource/docker/dockerhub-cache.js.map +1 -1
- package/dist/modules/datasource/docker/index.js +5 -0
- package/dist/modules/datasource/docker/index.js.map +1 -1
- package/dist/modules/datasource/go/releases-goproxy.js +4 -2
- package/dist/modules/datasource/go/releases-goproxy.js.map +1 -1
- package/dist/modules/datasource/index.js +3 -0
- package/dist/modules/datasource/index.js.map +1 -1
- package/dist/modules/datasource/npm/npmrc.js.map +1 -1
- package/dist/modules/datasource/nuget/v3.js +1 -0
- package/dist/modules/datasource/nuget/v3.js.map +1 -1
- package/dist/modules/datasource/pod/index.js +1 -0
- package/dist/modules/datasource/pod/index.js.map +1 -1
- package/dist/modules/datasource/repology/index.js +1 -0
- package/dist/modules/datasource/repology/index.js.map +1 -1
- package/dist/modules/datasource/rubygems/metadata-cache.js +2 -0
- package/dist/modules/datasource/rubygems/metadata-cache.js.map +1 -1
- package/dist/modules/datasource/rubygems/versions-endpoint-cache.js +6 -1
- package/dist/modules/datasource/rubygems/versions-endpoint-cache.js.map +1 -1
- package/dist/modules/datasource/sbt-package/index.js +3 -0
- package/dist/modules/datasource/sbt-package/index.js.map +1 -1
- package/dist/modules/datasource/sbt-plugin/index.js +3 -0
- package/dist/modules/datasource/sbt-plugin/index.js.map +1 -1
- package/dist/modules/manager/apm/artifacts.js +2 -1
- package/dist/modules/manager/apm/artifacts.js.map +1 -1
- package/dist/modules/manager/bazel-module/artifacts.js +2 -1
- package/dist/modules/manager/bazel-module/artifacts.js.map +1 -1
- package/dist/modules/manager/bazelisk/artifacts.js +2 -1
- package/dist/modules/manager/bazelisk/artifacts.js.map +1 -1
- package/dist/modules/manager/bun/artifacts.js +2 -1
- package/dist/modules/manager/bun/artifacts.js.map +1 -1
- package/dist/modules/manager/bundler/artifacts.js +1 -1
- package/dist/modules/manager/bundler/artifacts.js.map +1 -1
- package/dist/modules/manager/bundler/common.js +11 -16
- package/dist/modules/manager/bundler/common.js.map +1 -1
- package/dist/modules/manager/cargo/artifacts.js +5 -3
- package/dist/modules/manager/cargo/artifacts.js.map +1 -1
- package/dist/modules/manager/composer/artifacts.js +6 -7
- package/dist/modules/manager/composer/artifacts.js.map +1 -1
- package/dist/modules/manager/composer/utils.js +1 -10
- package/dist/modules/manager/composer/utils.js.map +1 -1
- package/dist/modules/manager/conan/artifacts.js +2 -1
- package/dist/modules/manager/conan/artifacts.js.map +1 -1
- package/dist/modules/manager/copier/artifacts.js +3 -3
- package/dist/modules/manager/copier/artifacts.js.map +1 -1
- package/dist/modules/manager/deno/artifacts.js +2 -1
- package/dist/modules/manager/deno/artifacts.js.map +1 -1
- package/dist/modules/manager/devbox/artifacts.js +8 -5
- package/dist/modules/manager/devbox/artifacts.js.map +1 -1
- package/dist/modules/manager/fingerprint.generated.js +34 -34
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/manager/github-actions/artifacts.js +6 -4
- package/dist/modules/manager/github-actions/artifacts.js.map +1 -1
- package/dist/modules/manager/gleam/artifacts.js +2 -1
- package/dist/modules/manager/gleam/artifacts.js.map +1 -1
- package/dist/modules/manager/gomod/artifacts.js +8 -6
- package/dist/modules/manager/gomod/artifacts.js.map +1 -1
- package/dist/modules/manager/gradle/artifacts.js +2 -1
- package/dist/modules/manager/gradle/artifacts.js.map +1 -1
- package/dist/modules/manager/gradle-wrapper/artifacts.js +2 -1
- package/dist/modules/manager/gradle-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/helmfile/artifacts.js +4 -3
- package/dist/modules/manager/helmfile/artifacts.js.map +1 -1
- package/dist/modules/manager/helmv3/artifacts.js +2 -1
- package/dist/modules/manager/helmv3/artifacts.js.map +1 -1
- package/dist/modules/manager/jsonnet-bundler/artifacts.js +2 -1
- package/dist/modules/manager/jsonnet-bundler/artifacts.js.map +1 -1
- package/dist/modules/manager/kustomize/artifacts.js +4 -2
- package/dist/modules/manager/kustomize/artifacts.js.map +1 -1
- package/dist/modules/manager/kustomize/common.js +2 -2
- package/dist/modules/manager/kustomize/common.js.map +1 -1
- package/dist/modules/manager/maven-wrapper/artifacts.js +2 -1
- package/dist/modules/manager/maven-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/mise/artifacts.js +13 -11
- package/dist/modules/manager/mise/artifacts.js.map +1 -1
- package/dist/modules/manager/mix/artifacts.js +3 -2
- package/dist/modules/manager/mix/artifacts.js.map +1 -1
- package/dist/modules/manager/nix/artifacts.js +2 -1
- package/dist/modules/manager/nix/artifacts.js.map +1 -1
- package/dist/modules/manager/npm/artifacts.js +2 -1
- package/dist/modules/manager/npm/artifacts.js.map +1 -1
- package/dist/modules/manager/npm/post-update/node-version.js +2 -1
- package/dist/modules/manager/npm/post-update/node-version.js.map +1 -1
- package/dist/modules/manager/npm/post-update/npm.js +2 -1
- package/dist/modules/manager/npm/post-update/npm.js.map +1 -1
- package/dist/modules/manager/npm/post-update/pnpm.js +2 -1
- package/dist/modules/manager/npm/post-update/pnpm.js.map +1 -1
- package/dist/modules/manager/npm/post-update/yarn.js +5 -3
- package/dist/modules/manager/npm/post-update/yarn.js.map +1 -1
- package/dist/modules/manager/nuget/artifacts.js +2 -1
- package/dist/modules/manager/nuget/artifacts.js.map +1 -1
- package/dist/modules/manager/pep621/processors/pdm.js +3 -2
- package/dist/modules/manager/pep621/processors/pdm.js.map +1 -1
- package/dist/modules/manager/pep621/processors/pixi.js +4 -3
- package/dist/modules/manager/pep621/processors/pixi.js.map +1 -1
- package/dist/modules/manager/pep621/processors/uv.js +3 -3
- package/dist/modules/manager/pep621/processors/uv.js.map +1 -1
- package/dist/modules/manager/pip-compile/common.js +14 -36
- package/dist/modules/manager/pip-compile/common.js.map +1 -1
- package/dist/modules/manager/pip_requirements/artifacts.js +3 -2
- package/dist/modules/manager/pip_requirements/artifacts.js.map +1 -1
- package/dist/modules/manager/pipenv/artifacts.js +3 -2
- package/dist/modules/manager/pipenv/artifacts.js.map +1 -1
- package/dist/modules/manager/pixi/artifacts.js +2 -1
- package/dist/modules/manager/pixi/artifacts.js.map +1 -1
- package/dist/modules/manager/poetry/artifacts.js +3 -2
- package/dist/modules/manager/poetry/artifacts.js.map +1 -1
- package/dist/modules/manager/pub/artifacts.js +11 -10
- package/dist/modules/manager/pub/artifacts.js.map +1 -1
- package/dist/modules/manager/types.d.ts +23 -3
- package/dist/modules/manager/util.js +28 -1
- package/dist/modules/manager/util.js.map +1 -1
- package/dist/modules/manager/vendir/artifacts.js +3 -2
- package/dist/modules/manager/vendir/artifacts.js.map +1 -1
- package/dist/workers/repository/process/lookup/filter.js +1 -1
- package/dist/workers/repository/process/lookup/filter.js.map +1 -1
- package/dist/workers/repository/process/lookup/generate.js +1 -7
- package/dist/workers/repository/process/lookup/generate.js.map +1 -1
- package/dist/workers/repository/process/lookup/index.js +2 -2
- package/dist/workers/repository/process/lookup/index.js.map +1 -1
- package/dist/workers/repository/process/lookup/rollback.js.map +1 -1
- package/dist/workers/repository/updates/generate.js +11 -4
- package/dist/workers/repository/updates/generate.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
- package/dist/modules/manager/copier/utils.js +0 -24
- package/dist/modules/manager/copier/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":["massageToml","parseToml"],"sources":["../../../../lib/modules/manager/poetry/artifacts.ts"],"sourcesContent":["import {\n isNonEmptyArray,\n isNonEmptyObject,\n isNumber,\n isString,\n} from '@sindresorhus/is';\nimport { Duration } from 'luxon';\nimport { quote } from 'shlex';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport type { HostRule } from '../../../types/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n ensureCacheDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { withGitEnvironment } from '../../../util/git/exec.ts';\nimport { find } from '../../../util/host-rules.ts';\nimport { toMs } from '../../../util/pretty-time.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { Result } from '../../../util/result.ts';\nimport {\n massage as massageToml,\n parse as parseToml,\n} from '../../../util/toml.ts';\nimport { parseUrl } from '../../../util/url.ts';\nimport { PypiDatasource } from '../../datasource/pypi/index.ts';\nimport { getGoogleAuthHostRule } from '../../datasource/util.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { Lockfile, PoetryPyProject } from './schema.ts';\nimport type { PoetryFile, PoetrySource } from './types.ts';\n\nconst gitExec = withGitEnvironment(['poetry']);\n\nexport function getPythonConstraint(\n pyProjectContent: string,\n existingLockFileContent: string,\n): string | null {\n // Read Python version from `pyproject.toml` first as it could have been updated\n const pyprojectPythonConstraint = Result.parse(\n massageToml(pyProjectContent),\n PoetryPyProject.transform(\n ({ packageFileContent }) =>\n packageFileContent.deps.find((dep) => dep.depName === 'python')\n ?.currentValue,\n ),\n ).unwrapOrNull();\n if (pyprojectPythonConstraint) {\n logger.debug('Using python version from pyproject.toml');\n return pyprojectPythonConstraint;\n }\n\n const lockfilePythonConstraint = Result.parse(\n existingLockFileContent,\n Lockfile.transform(({ pythonVersions }) => pythonVersions),\n ).unwrapOrNull();\n if (lockfilePythonConstraint) {\n logger.debug('Using python version from poetry.lock');\n return lockfilePythonConstraint;\n }\n\n return null;\n}\n\nexport function getPoetryRequirement(\n pyProjectContent: string,\n existingLockFileContent: string,\n): undefined | string | null {\n // Read Poetry version from first line of poetry.lock\n const firstLine = existingLockFileContent.split('\\n')[0];\n const poetryVersionMatch = regEx(/by Poetry (?<version>[\\d\\\\.]+)/).exec(\n firstLine,\n );\n if (poetryVersionMatch?.groups?.version) {\n const poetryVersion = poetryVersionMatch.groups.version;\n logger.debug(\n `Using poetry version ${poetryVersion} from poetry.lock header`,\n );\n return poetryVersion;\n }\n\n const { val: lockfilePoetryConstraint } = Result.parse(\n existingLockFileContent,\n Lockfile.transform(({ poetryConstraint }) => poetryConstraint),\n ).unwrap();\n if (lockfilePoetryConstraint) {\n logger.debug(\n `Using poetry version ${lockfilePoetryConstraint} from poetry.lock metadata`,\n );\n return lockfilePoetryConstraint;\n }\n\n const { val: pyprojectPoetryConstraint } = Result.parse(\n massageToml(pyProjectContent),\n PoetryPyProject.transform(({ poetryRequirement }) => poetryRequirement),\n ).unwrap();\n if (pyprojectPoetryConstraint) {\n logger.debug(\n `Using poetry version ${pyprojectPoetryConstraint} from pyproject.toml`,\n );\n return pyprojectPoetryConstraint;\n }\n\n return null;\n}\n\nfunction getPoetrySources(content: string, fileName: string): PoetrySource[] {\n let pyprojectFile: PoetryFile;\n try {\n pyprojectFile = parseToml(massageToml(content)) as PoetryFile;\n } catch (err) {\n logger.debug({ err }, 'Error parsing pyproject.toml file');\n return [];\n }\n if (!pyprojectFile.tool?.poetry) {\n logger.debug(`${fileName} contains no poetry section`);\n return [];\n }\n\n const sources = coerceArray(pyprojectFile.tool?.poetry?.source);\n const sourceArray: PoetrySource[] = [];\n for (const source of sources) {\n if (source.name && source.url) {\n sourceArray.push({ name: source.name, url: source.url });\n }\n }\n return sourceArray;\n}\n\nasync function getMatchingHostRule(url: string | undefined): Promise<HostRule> {\n const scopedMatch = find({ hostType: PypiDatasource.id, url });\n const hostRule = isNonEmptyObject(scopedMatch) ? scopedMatch : find({ url });\n if (hostRule && Object.keys(hostRule).length !== 0) {\n return hostRule;\n }\n\n const parsedUrl = parseUrl(url);\n if (!parsedUrl) {\n logger.once.debug(`Failed to parse URL ${url}`);\n return {};\n }\n\n if (parsedUrl.hostname.endsWith('.pkg.dev')) {\n const hostRule = await getGoogleAuthHostRule();\n if (hostRule && Object.keys(hostRule).length !== 0) {\n return hostRule;\n }\n logger.once.debug(`Could not get Google access token (url=${url})`);\n }\n\n return {};\n}\n\nasync function getSourceCredentialVars(\n pyprojectContent: string,\n packageFileName: string,\n): Promise<NodeJS.ProcessEnv> {\n const poetrySources = getPoetrySources(pyprojectContent, packageFileName);\n const envVars: NodeJS.ProcessEnv = {};\n\n for (const source of poetrySources) {\n const matchingHostRule = await getMatchingHostRule(source.url);\n const formattedSourceName = source.name\n .replace(regEx(/(?:\\.|-)+/g), '_')\n .toUpperCase();\n if (matchingHostRule.username) {\n envVars[`POETRY_HTTP_BASIC_${formattedSourceName}_USERNAME`] =\n matchingHostRule.username;\n }\n if (matchingHostRule.password) {\n envVars[`POETRY_HTTP_BASIC_${formattedSourceName}_PASSWORD`] =\n matchingHostRule.password;\n }\n }\n return envVars;\n}\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`poetry.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (!isNonEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated poetry deps - returning null');\n return null;\n }\n // Try poetry.lock first\n let lockFileName = getSiblingFileName(packageFileName, 'poetry.lock');\n let existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n // Try pyproject.lock next\n lockFileName = getSiblingFileName(packageFileName, 'pyproject.lock');\n existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug(`No lock file found`);\n return null;\n }\n }\n logger.debug(`Updating ${lockFileName}`);\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n const cmd: string[] = [];\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n cmd.push('poetry update --lock --no-interaction');\n } else {\n cmd.push(\n `poetry update --lock --no-interaction ${updatedDeps\n .map((dep) => dep.depName)\n .filter(isString)\n .map((dep) => quote(dep))\n .join(' ')}`,\n );\n }\n const pythonConstraint =\n config?.constraints?.python ??\n getPythonConstraint(newPackageFileContent, existingLockFileContent);\n const poetryConstraint =\n config.constraints?.poetry ??\n getPoetryRequirement(newPackageFileContent, existingLockFileContent);\n const extraEnv: NodeJS.ProcessEnv = {\n ...(await getSourceCredentialVars(\n newPackageFileContent,\n packageFileName,\n )),\n PIP_CACHE_DIR: await ensureCacheDir('pip'),\n };\n\n if (config.minimumReleaseAge) {\n const ageMs = toMs(config.minimumReleaseAge);\n if (isNumber(ageMs)) {\n const days = Math.ceil(Duration.fromMillis(ageMs).as('days'));\n extraEnv.POETRY_SOLVER_MIN_RELEASE_AGE = days.toString();\n } else {\n logger.debug(\n { minimumReleaseAge: config.minimumReleaseAge },\n 'Invalid minimumReleaseAge, skipping POETRY_SOLVER_MIN_RELEASE_AGE',\n );\n }\n }\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv,\n docker: {},\n toolConstraints: [\n { toolName: 'python', constraint: pythonConstraint },\n { toolName: 'poetry', constraint: poetryConstraint },\n ],\n };\n await gitExec(cmd, execOptions);\n const newPoetryLockContent = await readLocalFile(lockFileName, 'utf8');\n if (existingLockFileContent === newPoetryLockContent) {\n logger.debug(`${lockFileName} is unchanged`);\n return null;\n }\n logger.debug(`Returning updated ${lockFileName}`);\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: newPoetryLockContent,\n },\n },\n ];\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.debug({ err }, `Failed to update ${lockFileName} file`);\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: `${String(err.stdout)}\\n${String(err.stderr)}`,\n },\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,MAAM,UAAU,mBAAmB,CAAC,QAAQ,CAAC;AAE7C,SAAgB,oBACd,kBACA,yBACe;CAEf,MAAM,4BAA4B,OAAO,MACvCA,QAAY,gBAAgB,GAC5B,gBAAgB,WACb,EAAE,yBACD,mBAAmB,KAAK,MAAM,QAAQ,IAAI,YAAY,QAAQ,CAAC,EAC3D,YACR,CACF,CAAC,CAAC,aAAa;CACf,IAAI,2BAA2B;EAC7B,OAAO,MAAM,0CAA0C;EACvD,OAAO;CACT;CAEA,MAAM,2BAA2B,OAAO,MACtC,yBACA,SAAS,WAAW,EAAE,qBAAqB,cAAc,CAC3D,CAAC,CAAC,aAAa;CACf,IAAI,0BAA0B;EAC5B,OAAO,MAAM,uCAAuC;EACpD,OAAO;CACT;CAEA,OAAO;AACT;AAEA,SAAgB,qBACd,kBACA,yBAC2B;CAE3B,MAAM,YAAY,wBAAwB,MAAM,IAAI,CAAC,CAAC;CACtD,MAAM,qBAAqB,MAAM,gCAAgC,CAAC,CAAC,KACjE,SACF;CACA,IAAI,oBAAoB,QAAQ,SAAS;EACvC,MAAM,gBAAgB,mBAAmB,OAAO;EAChD,OAAO,MACL,wBAAwB,cAAc,yBACxC;EACA,OAAO;CACT;CAEA,MAAM,EAAE,KAAK,6BAA6B,OAAO,MAC/C,yBACA,SAAS,WAAW,EAAE,uBAAuB,gBAAgB,CAC/D,CAAC,CAAC,OAAO;CACT,IAAI,0BAA0B;EAC5B,OAAO,MACL,wBAAwB,yBAAyB,2BACnD;EACA,OAAO;CACT;CAEA,MAAM,EAAE,KAAK,8BAA8B,OAAO,MAChDA,QAAY,gBAAgB,GAC5B,gBAAgB,WAAW,EAAE,wBAAwB,iBAAiB,CACxE,CAAC,CAAC,OAAO;CACT,IAAI,2BAA2B;EA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ACpB,qBAAqB,uBAAuB,uBAAuB;EACrE,MAAM,WAA8B;GAClC,GAAI,MAAM,wBACR,uBACA,eACF;GACA,eAAe,MAAM,eAAe,KAAK;EAC3C;EAEA,IAAI,OAAO,mBAAmB;GAC5B,MAAM,QAAQ,KAAK,OAAO,iBAAiB;GAC3C,IAAI,SAAS,KAAK,GAEhB,SAAS,gCADI,KAAK,KAAK,SAAS,WAAW,KAAK,CAAC,CAAC,GAAG,MAAM,CACf,CAAC,CAAC,SAAS;QAEvD,OAAO,MACL,EAAE,mBAAmB,OAAO,kBAAkB,GAC9C,mEACF;EAEJ;EAWA,MAAM,QAAQ,KAAK;GARjB,SAAS;GACT;GACA,QAAQ,CAAC;GACT,iBAAiB,CACf;IAAE,UAAU;IAAU,YAAY;GAAiB,GACnD;IAAE,UAAU;IAAU,YAAY;GAAiB,CACrD;EAE2B,CAAC;EAC9B,MAAM,uBAAuB,MAAM,cAAc,cAAc,MAAM;EACrE,IAAI,4BAA4B,sBAAsB;GACpD,OAAO,MAAM,GAAG,aAAa,cAAc;GAC3C,OAAO;EACT;EACA,OAAO,MAAM,qBAAqB,cAAc;EAChD,OAAO,CACL,EACE,MAAM;GACJ,MAAM;GACN,MAAM;GACN,UAAU;EACZ,EACF,CACF;CACF,SAAS,KAAK;;EAEZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,OAAO,MAAM,EAAE,IAAI,GAAG,oBAAoB,aAAa,MAAM;EAC7D,OAAO,CACL,EACE,eAAe;GACb,UAAU;GACV,QAAQ,GAAG,OAAO,IAAI,MAAM,EAAE,IAAI,OAAO,IAAI,MAAM;EACrD,EACF,CACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":["massageToml","parseToml"],"sources":["../../../../lib/modules/manager/poetry/artifacts.ts"],"sourcesContent":["import {\n isNonEmptyArray,\n isNonEmptyObject,\n isNumber,\n isString,\n} from '@sindresorhus/is';\nimport { Duration } from 'luxon';\nimport { quote } from 'shlex';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport type { HostRule } from '../../../types/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n ensureCacheDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { withGitEnvironment } from '../../../util/git/exec.ts';\nimport { find } from '../../../util/host-rules.ts';\nimport { toMs } from '../../../util/pretty-time.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { Result } from '../../../util/result.ts';\nimport {\n massage as massageToml,\n parse as parseToml,\n} from '../../../util/toml.ts';\nimport { parseUrl } from '../../../util/url.ts';\nimport { PypiDatasource } from '../../datasource/pypi/index.ts';\nimport { getGoogleAuthHostRule } from '../../datasource/util.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { Lockfile, PoetryPyProject } from './schema.ts';\nimport type { PoetryFile, PoetrySource } from './types.ts';\n\nconst gitExec = withGitEnvironment(['poetry']);\n\nexport function getPythonConstraint(\n pyProjectContent: string,\n existingLockFileContent: string,\n): string | null {\n // Read Python version from `pyproject.toml` first as it could have been updated\n const pyprojectPythonConstraint = Result.parse(\n massageToml(pyProjectContent),\n PoetryPyProject.transform(\n ({ packageFileContent }) =>\n packageFileContent.deps.find((dep) => dep.depName === 'python')\n ?.currentValue,\n ),\n ).unwrapOrNull();\n if (pyprojectPythonConstraint) {\n logger.debug('Using python version from pyproject.toml');\n return pyprojectPythonConstraint;\n }\n\n const lockfilePythonConstraint = Result.parse(\n existingLockFileContent,\n Lockfile.transform(({ pythonVersions }) => pythonVersions),\n ).unwrapOrNull();\n if (lockfilePythonConstraint) {\n logger.debug('Using python version from poetry.lock');\n return lockfilePythonConstraint;\n }\n\n return null;\n}\n\nexport function getPoetryRequirement(\n pyProjectContent: string,\n existingLockFileContent: string,\n): undefined | string | null {\n // Read Poetry version from first line of poetry.lock\n const firstLine = existingLockFileContent.split('\\n')[0];\n const poetryVersionMatch = regEx(/by Poetry (?<version>[\\d\\\\.]+)/).exec(\n firstLine,\n );\n if (poetryVersionMatch?.groups?.version) {\n const poetryVersion = poetryVersionMatch.groups.version;\n logger.debug(\n `Using poetry version ${poetryVersion} from poetry.lock header`,\n );\n return poetryVersion;\n }\n\n const { val: lockfilePoetryConstraint } = Result.parse(\n existingLockFileContent,\n Lockfile.transform(({ poetryConstraint }) => poetryConstraint),\n ).unwrap();\n if (lockfilePoetryConstraint) {\n logger.debug(\n `Using poetry version ${lockfilePoetryConstraint} from poetry.lock metadata`,\n );\n return lockfilePoetryConstraint;\n }\n\n const { val: pyprojectPoetryConstraint } = Result.parse(\n massageToml(pyProjectContent),\n PoetryPyProject.transform(({ poetryRequirement }) => poetryRequirement),\n ).unwrap();\n if (pyprojectPoetryConstraint) {\n logger.debug(\n `Using poetry version ${pyprojectPoetryConstraint} from pyproject.toml`,\n );\n return pyprojectPoetryConstraint;\n }\n\n return null;\n}\n\nfunction getPoetrySources(content: string, fileName: string): PoetrySource[] {\n let pyprojectFile: PoetryFile;\n try {\n pyprojectFile = parseToml(massageToml(content)) as PoetryFile;\n } catch (err) {\n logger.debug({ err }, 'Error parsing pyproject.toml file');\n return [];\n }\n if (!pyprojectFile.tool?.poetry) {\n logger.debug(`${fileName} contains no poetry section`);\n return [];\n }\n\n const sources = coerceArray(pyprojectFile.tool?.poetry?.source);\n const sourceArray: PoetrySource[] = [];\n for (const source of sources) {\n if (source.name && source.url) {\n sourceArray.push({ name: source.name, url: source.url });\n }\n }\n return sourceArray;\n}\n\nasync function getMatchingHostRule(url: string | undefined): Promise<HostRule> {\n const scopedMatch = find({ hostType: PypiDatasource.id, url });\n const hostRule = isNonEmptyObject(scopedMatch) ? scopedMatch : find({ url });\n if (hostRule && Object.keys(hostRule).length !== 0) {\n return hostRule;\n }\n\n const parsedUrl = parseUrl(url);\n if (!parsedUrl) {\n logger.once.debug(`Failed to parse URL ${url}`);\n return {};\n }\n\n if (parsedUrl.hostname.endsWith('.pkg.dev')) {\n const hostRule = await getGoogleAuthHostRule();\n if (hostRule && Object.keys(hostRule).length !== 0) {\n return hostRule;\n }\n logger.once.debug(`Could not get Google access token (url=${url})`);\n }\n\n return {};\n}\n\nasync function getSourceCredentialVars(\n pyprojectContent: string,\n packageFileName: string,\n): Promise<NodeJS.ProcessEnv> {\n const poetrySources = getPoetrySources(pyprojectContent, packageFileName);\n const envVars: NodeJS.ProcessEnv = {};\n\n for (const source of poetrySources) {\n const matchingHostRule = await getMatchingHostRule(source.url);\n const formattedSourceName = source.name\n .replace(regEx(/(?:\\.|-)+/g), '_')\n .toUpperCase();\n if (matchingHostRule.username) {\n envVars[`POETRY_HTTP_BASIC_${formattedSourceName}_USERNAME`] =\n matchingHostRule.username;\n }\n if (matchingHostRule.password) {\n envVars[`POETRY_HTTP_BASIC_${formattedSourceName}_PASSWORD`] =\n matchingHostRule.password;\n }\n }\n return envVars;\n}\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`poetry.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (!isNonEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated poetry deps - returning null');\n return null;\n }\n // Try poetry.lock first\n let lockFileName = getSiblingFileName(packageFileName, 'poetry.lock');\n let existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n // Try pyproject.lock next\n lockFileName = getSiblingFileName(packageFileName, 'pyproject.lock');\n existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug(`No lock file found`);\n return null;\n }\n }\n logger.debug(`Updating ${lockFileName}`);\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n const cmd: string[] = [];\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n cmd.push('poetry update --lock --no-interaction');\n } else {\n cmd.push(\n `poetry update --lock --no-interaction ${updatedDeps\n .map((dep) => dep.depName)\n .filter(isString)\n .map((dep) => quote(dep))\n .join(' ')}`,\n );\n }\n const pythonConstraint = await resolveToolConstraint(config, 'python', () =>\n getPythonConstraint(newPackageFileContent, existingLockFileContent),\n );\n const poetryConstraint = await resolveToolConstraint(config, 'poetry', () =>\n getPoetryRequirement(newPackageFileContent, existingLockFileContent),\n );\n const extraEnv: NodeJS.ProcessEnv = {\n ...(await getSourceCredentialVars(\n newPackageFileContent,\n packageFileName,\n )),\n PIP_CACHE_DIR: await ensureCacheDir('pip'),\n };\n\n if (config.minimumReleaseAge) {\n const ageMs = toMs(config.minimumReleaseAge);\n if (isNumber(ageMs)) {\n const days = Math.ceil(Duration.fromMillis(ageMs).as('days'));\n extraEnv.POETRY_SOLVER_MIN_RELEASE_AGE = days.toString();\n } else {\n logger.debug(\n { minimumReleaseAge: config.minimumReleaseAge },\n 'Invalid minimumReleaseAge, skipping POETRY_SOLVER_MIN_RELEASE_AGE',\n );\n }\n }\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv,\n docker: {},\n toolConstraints: [\n { toolName: 'python', constraint: pythonConstraint },\n { toolName: 'poetry', constraint: poetryConstraint },\n ],\n };\n await gitExec(cmd, execOptions);\n const newPoetryLockContent = await readLocalFile(lockFileName, 'utf8');\n if (existingLockFileContent === newPoetryLockContent) {\n logger.debug(`${lockFileName} is unchanged`);\n return null;\n }\n logger.debug(`Returning updated ${lockFileName}`);\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: newPoetryLockContent,\n },\n },\n ];\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.debug({ err }, `Failed to update ${lockFileName} file`);\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: `${String(err.stdout)}\\n${String(err.stderr)}`,\n },\n },\n ];\n }\n}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R,uBACA,eACF;GACA,eAAe,MAAM,eAAe,KAAK;EAC3C;EAEA,IAAI,OAAO,mBAAmB;GAC5B,MAAM,QAAQ,KAAK,OAAO,iBAAiB;GAC3C,IAAI,SAAS,KAAK,GAEhB,SAAS,gCADI,KAAK,KAAK,SAAS,WAAW,KAAK,CAAC,CAAC,GAAG,MAAM,CACf,CAAC,CAAC,SAAS;QAEvD,OAAO,MACL,EAAE,mBAAmB,OAAO,kBAAkB,GAC9C,mEACF;EAEJ;EAWA,MAAM,QAAQ,KAAK;GARjB,SAAS;GACT;GACA,QAAQ,CAAC;GACT,iBAAiB,CACf;IAAE,UAAU;IAAU,YAAY;GAAiB,GACnD;IAAE,UAAU;IAAU,YAAY;GAAiB,CACrD;EAE2B,CAAC;EAC9B,MAAM,uBAAuB,MAAM,cAAc,cAAc,MAAM;EACrE,IAAI,4BAA4B,sBAAsB;GACpD,OAAO,MAAM,GAAG,aAAa,cAAc;GAC3C,OAAO;EACT;EACA,OAAO,MAAM,qBAAqB,cAAc;EAChD,OAAO,CACL,EACE,MAAM;GACJ,MAAM;GACN,MAAM;GACN,UAAU;EACZ,EACF,CACF;CACF,SAAS,KAAK;;EAEZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,OAAO,MAAM,EAAE,IAAI,GAAG,oBAAoB,aAAa,MAAM;EAC7D,OAAO,CACL,EACE,eAAe;GACb,UAAU;GACV,QAAQ,GAAG,OAAO,IAAI,MAAM,EAAE,IAAI,OAAO,IAAI,MAAM;EACrD,EACF,CACF;CACF;AACF"}
|
|
@@ -2,6 +2,7 @@ import "../../../constants/error-messages.js";
|
|
|
2
2
|
import { logger } from "../../../logger/index.js";
|
|
3
3
|
import { getSiblingFileName, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
4
4
|
import { exec } from "../../../util/exec/index.js";
|
|
5
|
+
import { resolveToolConstraint } from "../util.js";
|
|
5
6
|
import { parsePubspec, parsePubspecLock } from "./utils.js";
|
|
6
7
|
import { isEmptyArray, isString } from "@sindresorhus/is";
|
|
7
8
|
import { quote } from "shlex";
|
|
@@ -26,21 +27,21 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
26
27
|
const isFlutter = newPackageFileContent.includes("sdk: flutter");
|
|
27
28
|
const toolName = isFlutter ? "flutter" : "dart";
|
|
28
29
|
const cmd = getExecCommand(toolName, updatedDeps, isLockFileMaintenance);
|
|
29
|
-
|
|
30
|
-
if (!constraint) {
|
|
31
|
-
const pubspec = parsePubspec(packageFileName, newPackageFileContent);
|
|
32
|
-
const pubspecToolName = isFlutter ? "flutter" : "sdk";
|
|
33
|
-
constraint = pubspec?.environment[pubspecToolName];
|
|
34
|
-
if (!constraint) constraint = parsePubspecLock(lockFileName, oldLockFileContent)?.sdks[toolName];
|
|
35
|
-
}
|
|
36
|
-
await exec(cmd, {
|
|
30
|
+
const execOptions = {
|
|
37
31
|
cwdFile: packageFileName,
|
|
38
32
|
docker: {},
|
|
39
33
|
toolConstraints: [{
|
|
40
34
|
toolName,
|
|
41
|
-
constraint
|
|
35
|
+
constraint: await resolveToolConstraint(config, toolName, () => {
|
|
36
|
+
const pubspec = parsePubspec(packageFileName, newPackageFileContent);
|
|
37
|
+
const pubspecToolName = isFlutter ? "flutter" : "sdk";
|
|
38
|
+
const pubspecConstraint = pubspec?.environment[pubspecToolName];
|
|
39
|
+
if (pubspecConstraint) return pubspecConstraint;
|
|
40
|
+
return parsePubspecLock(lockFileName, oldLockFileContent)?.sdks[toolName];
|
|
41
|
+
})
|
|
42
42
|
}]
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
|
+
await exec(cmd, execOptions);
|
|
44
45
|
const newLockFileContent = await readLocalFile(lockFileName, "utf8");
|
|
45
46
|
if (oldLockFileContent === newLockFileContent) return null;
|
|
46
47
|
return [{ file: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/pub/artifacts.ts"],"sourcesContent":["import { isEmptyArray, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport type {\n UpdateArtifact,\n UpdateArtifactsResult,\n Upgrade,\n} from '../types.ts';\nimport { parsePubspec, parsePubspecLock } from './utils.ts';\n\nconst SDK_NAMES = ['dart', 'flutter'];\nconst PUB_GET_COMMAND = 'pub get --no-precompile';\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`pub.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (isEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated pub deps - returning null');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'pubspec.lock');\n const oldLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!oldLockFileContent) {\n logger.debug('No pubspec.lock found');\n return null;\n }\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n const isFlutter = newPackageFileContent.includes('sdk: flutter');\n const toolName = isFlutter ? 'flutter' : 'dart';\n const cmd = getExecCommand(toolName, updatedDeps, isLockFileMaintenance);\n\n
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/pub/artifacts.ts"],"sourcesContent":["import { isEmptyArray, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport type {\n UpdateArtifact,\n UpdateArtifactsResult,\n Upgrade,\n} from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { parsePubspec, parsePubspecLock } from './utils.ts';\n\nconst SDK_NAMES = ['dart', 'flutter'];\nconst PUB_GET_COMMAND = 'pub get --no-precompile';\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`pub.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (isEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated pub deps - returning null');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'pubspec.lock');\n const oldLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!oldLockFileContent) {\n logger.debug('No pubspec.lock found');\n return null;\n }\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n const isFlutter = newPackageFileContent.includes('sdk: flutter');\n const toolName = isFlutter ? 'flutter' : 'dart';\n const cmd = getExecCommand(toolName, updatedDeps, isLockFileMaintenance);\n\n const constraint = await resolveToolConstraint(config, toolName, () => {\n const pubspec = parsePubspec(packageFileName, newPackageFileContent);\n const pubspecToolName = isFlutter ? 'flutter' : 'sdk';\n const pubspecConstraint = pubspec?.environment[pubspecToolName];\n if (pubspecConstraint) {\n return pubspecConstraint;\n }\n\n const pubspecLock = parsePubspecLock(lockFileName, oldLockFileContent);\n return pubspecLock?.sdks[toolName];\n });\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n docker: {},\n toolConstraints: [\n {\n toolName,\n constraint,\n },\n ],\n };\n\n await exec(cmd, execOptions);\n const newLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (oldLockFileContent === newLockFileContent) {\n return null;\n }\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: newLockFileContent,\n },\n },\n ];\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.warn({ lockfile: lockFileName, err }, `Failed to update lock file`);\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: err.message,\n },\n },\n ];\n }\n}\n\nfunction getExecCommand(\n toolName: string,\n updatedDeps: Upgrade<Record<string, unknown>>[],\n isLockFileMaintenance: boolean | undefined,\n): string {\n if (isLockFileMaintenance) {\n return `${toolName} pub upgrade`;\n }\n const depNames = updatedDeps.map((dep) => dep.depName).filter(isString);\n if (depNames.length === 1 && SDK_NAMES.includes(depNames[0])) {\n return `${toolName} ${PUB_GET_COMMAND}`;\n }\n // If there are two updated dependencies and both of them are SDK updates (Dart and Flutter),\n // we use Flutter over Dart to run `pub get` as it is a Flutter project.\n if (\n depNames.length === 2 &&\n depNames.filter((depName) => SDK_NAMES.includes(depName)).length === 2\n ) {\n return `flutter ${PUB_GET_COMMAND}`;\n }\n const depNamesCmd = depNames\n .filter((depName) => !SDK_NAMES.includes(depName))\n .map(quote)\n .join(' ');\n return `${toolName} pub upgrade ${depNamesCmd}`;\n}\n"],"mappings":";;;;;;;;;AAmBA,MAAM,YAAY,CAAC,QAAQ,SAAS;AACpC,MAAM,kBAAkB;AAExB,eAAsB,gBAAgB,EACpC,iBACA,aACA,uBACA,UAC0D;CAC1D,OAAO,MAAM,uBAAuB,gBAAgB,EAAE;CACtD,MAAM,EAAE,0BAA0B;CAElC,IAAI,aAAa,WAAW,KAAK,CAAC,uBAAuB;EACvD,OAAO,MAAM,sCAAsC;EACnD,OAAO;CACT;CAEA,MAAM,eAAe,mBAAmB,iBAAiB,cAAc;CACvE,MAAM,qBAAqB,MAAM,cAAc,cAAc,MAAM;CACnE,IAAI,CAAC,oBAAoB;EACvB,OAAO,MAAM,uBAAuB;EACpC,OAAO;CACT;CAEA,IAAI;EACF,MAAM,eAAe,iBAAiB,qBAAqB;EAE3D,MAAM,YAAY,sBAAsB,SAAS,cAAc;EAC/D,MAAM,WAAW,YAAY,YAAY;EACz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9 +25,29 @@ interface ExtractConfig extends CustomExtractConfig {
|
|
|
25
25
|
currentDigest?: string;
|
|
26
26
|
newDigest?: string | null;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The part of a manager config that `resolveToolConstraint()` reads. Managers
|
|
30
|
+
* must not read these properties directly (enforced by the
|
|
31
|
+
* `renovate/prefer-resolve-tool-constraint` lint rule), so that user config, a
|
|
32
|
+
* value derived from the updated files and the extracted constraints are always
|
|
33
|
+
* applied in the same order.
|
|
34
|
+
*/
|
|
35
|
+
interface ToolConstraintsConfig {
|
|
36
|
+
/**
|
|
37
|
+
* Constraints as configured by the user, so they always win over anything a
|
|
38
|
+
* manager derives itself.
|
|
39
|
+
*/
|
|
40
|
+
constraints?: Partial<Record<ConstraintName, string>> | null;
|
|
41
|
+
/**
|
|
42
|
+
* Constraints collected during extraction, merged over all upgrades of the
|
|
43
|
+
* branch. They describe the package files as they were on the base branch, so
|
|
44
|
+
* they are a fallback for a manager that cannot derive the constraint from
|
|
45
|
+
* the files it is called with.
|
|
46
|
+
*/
|
|
47
|
+
extractedConstraints?: Partial<Record<ConstraintName, string>> | null;
|
|
48
|
+
}
|
|
49
|
+
interface UpdateArtifactsConfig extends ToolConstraintsConfig {
|
|
29
50
|
isLockFileMaintenance?: boolean;
|
|
30
|
-
constraints?: Partial<Record<ConstraintName, string>>;
|
|
31
51
|
composerIgnorePlatformReqs?: string[];
|
|
32
52
|
goGetDirs?: string[];
|
|
33
53
|
currentValue?: string;
|
|
@@ -348,5 +368,5 @@ interface PostUpdateConfig<T = Record<string, any>> extends Record<string, any>,
|
|
|
348
368
|
isLockFileMaintenance?: boolean;
|
|
349
369
|
}
|
|
350
370
|
//#endregion
|
|
351
|
-
export { ArtifactError, ArtifactNotice, BumpPackageVersionResult, DepTypeMetadata, ExtractConfig, GlobalManagerConfig, LookupUpdate, ManagerApi, ManagerData, PackageDependency, PackageFile, PackageFileContent, PostUpdateConfig, RangeConfig, UpdateArtifact, UpdateArtifactsConfig, UpdateArtifactsResult, UpdateDependencyConfig, UpdateLockedConfig, UpdateLockedResult, Upgrade };
|
|
371
|
+
export { ArtifactError, ArtifactNotice, BumpPackageVersionResult, DepTypeMetadata, ExtractConfig, GlobalManagerConfig, LookupUpdate, ManagerApi, ManagerData, PackageDependency, PackageFile, PackageFileContent, PostUpdateConfig, RangeConfig, ToolConstraintsConfig, UpdateArtifact, UpdateArtifactsConfig, UpdateArtifactsResult, UpdateDependencyConfig, UpdateLockedConfig, UpdateLockedResult, Upgrade };
|
|
352
372
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -4,6 +4,7 @@ import { GitRefsDatasource } from "../datasource/git-refs/index.js";
|
|
|
4
4
|
import { GitTagsDatasource } from "../datasource/git-tags/index.js";
|
|
5
5
|
import { GithubTagsDatasource } from "../datasource/github-tags/index.js";
|
|
6
6
|
import { GitlabTagsDatasource } from "../datasource/gitlab-tags/index.js";
|
|
7
|
+
import { isNonEmptyString } from "@sindresorhus/is";
|
|
7
8
|
//#region lib/modules/manager/util.ts
|
|
8
9
|
function applyGitSource(dep, git, rev, tag, branch) {
|
|
9
10
|
if (tag) {
|
|
@@ -43,7 +44,33 @@ function artifactErrorMessageFromExecError(err, message) {
|
|
|
43
44
|
if (err.stdout?.trim()) return err.stdout;
|
|
44
45
|
return message;
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolve the constraint for a tool that `updateArtifacts()` has to run.
|
|
49
|
+
*
|
|
50
|
+
* The precedence is:
|
|
51
|
+
*
|
|
52
|
+
* 1. `constraints`, because the user asked for it explicitly
|
|
53
|
+
* 2. `derive`, because it reads the package files as the branch changed them,
|
|
54
|
+
* so it can be newer than what extraction saw
|
|
55
|
+
* 3. `extractedConstraints`, as collected while extracting the base branch
|
|
56
|
+
*
|
|
57
|
+
* Managers that have no way to derive the constraint at artifact time can omit
|
|
58
|
+
* `derive`. An empty string counts as "not set" at every step, so it never
|
|
59
|
+
* shadows a value further down the list.
|
|
60
|
+
*
|
|
61
|
+
* This is the only place that reads `constraints` and `extractedConstraints`
|
|
62
|
+
* from the config; the `renovate/prefer-resolve-tool-constraint` lint rule
|
|
63
|
+
* keeps managers from reading them directly.
|
|
64
|
+
*/
|
|
65
|
+
async function resolveToolConstraint(config, toolName, derive) {
|
|
66
|
+
const configured = config.constraints?.[toolName];
|
|
67
|
+
if (isNonEmptyString(configured)) return configured;
|
|
68
|
+
const derived = await derive?.();
|
|
69
|
+
if (isNonEmptyString(derived)) return derived;
|
|
70
|
+
const extracted = config.extractedConstraints?.[toolName];
|
|
71
|
+
return isNonEmptyString(extracted) ? extracted : void 0;
|
|
72
|
+
}
|
|
46
73
|
//#endregion
|
|
47
|
-
export { applyGitSource, artifactErrorMessageFromExecError };
|
|
74
|
+
export { applyGitSource, artifactErrorMessageFromExecError, resolveToolConstraint };
|
|
48
75
|
|
|
49
76
|
//# sourceMappingURL=util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":[],"sources":["../../../lib/modules/manager/util.ts"],"sourcesContent":["import { detectPlatform } from '../../util/common.ts';\nimport type { ExecError } from '../../util/exec/exec-error.ts';\nimport { parseGitUrl } from '../../util/git/url.ts';\nimport { GitRefsDatasource } from '../datasource/git-refs/index.ts';\nimport { GitTagsDatasource } from '../datasource/git-tags/index.ts';\nimport { GithubTagsDatasource } from '../datasource/github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../datasource/gitlab-tags/index.ts';\nimport type { PackageDependency } from './types.ts';\n\nexport function applyGitSource(\n dep: PackageDependency,\n git: string,\n rev: string | undefined,\n tag: string | undefined,\n branch: string | undefined,\n): void {\n if (tag) {\n const platform = detectPlatform(git);\n if (platform === 'github' || platform === 'gitlab') {\n dep.datasource =\n platform === 'github'\n ? GithubTagsDatasource.id\n : GitlabTagsDatasource.id;\n const { host, full_name } = parseGitUrl(git);\n\n // Always use HTTPS for GitHub/GitLab API endpoints, even if the git URL protocol is SSH.\n dep.registryUrls = [`https://${host}`];\n dep.packageName = full_name;\n } else {\n dep.datasource = GitTagsDatasource.id;\n dep.packageName = git;\n }\n dep.currentValue = tag;\n dep.skipReason = undefined;\n } else if (rev) {\n dep.datasource = GitRefsDatasource.id;\n dep.packageName = git;\n dep.currentDigest = rev;\n dep.replaceString = rev;\n dep.skipReason = undefined;\n } else {\n dep.datasource = GitRefsDatasource.id;\n dep.packageName = git;\n dep.currentValue = branch;\n dep.skipReason = branch ? 'git-dependency' : 'unspecified-version';\n }\n}\n\n/**\n * Given an {@link ExecError}, retrieve the message which will be used for an {@link ArtifactError}.\n *\n * An `ExecError` always carries a `stderr` property, so nullish coalescing would keep an empty string and render an artifact error with no message at all.\n *\n */\nexport function artifactErrorMessageFromExecError(\n err: Partial<ExecError>,\n message: string,\n): string {\n if (err.stderr?.trim()) {\n return err.stderr;\n }\n\n if (err.stdout?.trim()) {\n return err.stdout;\n }\n\n return message;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","names":[],"sources":["../../../lib/modules/manager/util.ts"],"sourcesContent":["import { isNonEmptyString } from '@sindresorhus/is';\nimport type { MaybePromise } from '../../types/index.ts';\nimport { detectPlatform } from '../../util/common.ts';\nimport type { ExecError } from '../../util/exec/exec-error.ts';\nimport type { ConstraintName } from '../../util/exec/types.ts';\nimport { parseGitUrl } from '../../util/git/url.ts';\nimport { GitRefsDatasource } from '../datasource/git-refs/index.ts';\nimport { GitTagsDatasource } from '../datasource/git-tags/index.ts';\nimport { GithubTagsDatasource } from '../datasource/github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../datasource/gitlab-tags/index.ts';\nimport type { PackageDependency, ToolConstraintsConfig } from './types.ts';\n\nexport function applyGitSource(\n dep: PackageDependency,\n git: string,\n rev: string | undefined,\n tag: string | undefined,\n branch: string | undefined,\n): void {\n if (tag) {\n const platform = detectPlatform(git);\n if (platform === 'github' || platform === 'gitlab') {\n dep.datasource =\n platform === 'github'\n ? GithubTagsDatasource.id\n : GitlabTagsDatasource.id;\n const { host, full_name } = parseGitUrl(git);\n\n // Always use HTTPS for GitHub/GitLab API endpoints, even if the git URL protocol is SSH.\n dep.registryUrls = [`https://${host}`];\n dep.packageName = full_name;\n } else {\n dep.datasource = GitTagsDatasource.id;\n dep.packageName = git;\n }\n dep.currentValue = tag;\n dep.skipReason = undefined;\n } else if (rev) {\n dep.datasource = GitRefsDatasource.id;\n dep.packageName = git;\n dep.currentDigest = rev;\n dep.replaceString = rev;\n dep.skipReason = undefined;\n } else {\n dep.datasource = GitRefsDatasource.id;\n dep.packageName = git;\n dep.currentValue = branch;\n dep.skipReason = branch ? 'git-dependency' : 'unspecified-version';\n }\n}\n\n/**\n * Given an {@link ExecError}, retrieve the message which will be used for an {@link ArtifactError}.\n *\n * An `ExecError` always carries a `stderr` property, so nullish coalescing would keep an empty string and render an artifact error with no message at all.\n *\n */\nexport function artifactErrorMessageFromExecError(\n err: Partial<ExecError>,\n message: string,\n): string {\n if (err.stderr?.trim()) {\n return err.stderr;\n }\n\n if (err.stdout?.trim()) {\n return err.stdout;\n }\n\n return message;\n}\n\n/**\n * Resolve the constraint for a tool that `updateArtifacts()` has to run.\n *\n * The precedence is:\n *\n * 1. `constraints`, because the user asked for it explicitly\n * 2. `derive`, because it reads the package files as the branch changed them,\n * so it can be newer than what extraction saw\n * 3. `extractedConstraints`, as collected while extracting the base branch\n *\n * Managers that have no way to derive the constraint at artifact time can omit\n * `derive`. An empty string counts as \"not set\" at every step, so it never\n * shadows a value further down the list.\n *\n * This is the only place that reads `constraints` and `extractedConstraints`\n * from the config; the `renovate/prefer-resolve-tool-constraint` lint rule\n * keeps managers from reading them directly.\n */\nexport async function resolveToolConstraint(\n config: ToolConstraintsConfig,\n toolName: ConstraintName,\n derive?: () => MaybePromise<string | null | undefined>,\n): Promise<string | undefined> {\n const configured = config.constraints?.[toolName];\n if (isNonEmptyString(configured)) {\n return configured;\n }\n const derived = await derive?.();\n if (isNonEmptyString(derived)) {\n return derived;\n }\n const extracted = config.extractedConstraints?.[toolName];\n return isNonEmptyString(extracted) ? extracted : undefined;\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,eACd,KACA,KACA,KACA,KACA,QACM;CACN,IAAI,KAAK;EACP,MAAM,WAAW,eAAe,GAAG;EACnC,IAAI,aAAa,YAAY,aAAa,UAAU;GAClD,IAAI,aACF,aAAa,WACT,qBAAqB,KACrB,qBAAqB;GAC3B,MAAM,EAAE,MAAM,cAAc,YAAY,GAAG;GAG3C,IAAI,eAAe,CAAC,WAAW,MAAM;GACrC,IAAI,cAAc;EACpB,OAAO;GACL,IAAI,aAAa,kBAAkB;GACnC,IAAI,cAAc;EACpB;EACA,IAAI,eAAe;EACnB,IAAI,aAAa,KAAA;CACnB,OAAO,IAAI,KAAK;EACd,IAAI,aAAa,kBAAkB;EACnC,IAAI,cAAc;EAClB,IAAI,gBAAgB;EACpB,IAAI,gBAAgB;EACpB,IAAI,aAAa,KAAA;CACnB,OAAO;EACL,IAAI,aAAa,kBAAkB;EACnC,IAAI,cAAc;EAClB,IAAI,eAAe;EACnB,IAAI,aAAa,SAAS,mBAAmB;CAC/C;AACF;;;;;;;AAQA,SAAgB,kCACd,KACA,SACQ;CACR,IAAI,IAAI,QAAQ,KAAK,GACnB,OAAO,IAAI;CAGb,IAAI,IAAI,QAAQ,KAAK,GACnB,OAAO,IAAI;CAGb,OAAO;AACT;;;;;;;;;;;;;;;;;;;AAoBA,eAAsB,sBACpB,QACA,UACA,QAC6B;CAC7B,MAAM,aAAa,OAAO,cAAc;CACxC,IAAI,iBAAiB,UAAU,GAC7B,OAAO;CAET,MAAM,UAAU,MAAM,SAAS;CAC/B,IAAI,iBAAiB,OAAO,GAC1B,OAAO;CAET,MAAM,YAAY,OAAO,uBAAuB;CAChD,OAAO,iBAAiB,SAAS,IAAI,YAAY,KAAA;AACnD"}
|
|
@@ -3,6 +3,7 @@ import { coerceArray } from "../../../util/array.js";
|
|
|
3
3
|
import { logger } from "../../../logger/index.js";
|
|
4
4
|
import { getParentDir, getSiblingFileName, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
5
5
|
import { getRepoStatus } from "../../../util/git/index.js";
|
|
6
|
+
import { resolveToolConstraint } from "../util.js";
|
|
6
7
|
import { withGitEnvironment } from "../../../util/git/exec.js";
|
|
7
8
|
//#region lib/modules/manager/vendir/artifacts.ts
|
|
8
9
|
const gitExec = withGitEnvironment();
|
|
@@ -26,10 +27,10 @@ async function updateArtifacts({ packageFileName, newPackageFileContent, config
|
|
|
26
27
|
docker: {},
|
|
27
28
|
toolConstraints: [{
|
|
28
29
|
toolName: "vendir",
|
|
29
|
-
constraint: config
|
|
30
|
+
constraint: await resolveToolConstraint(config, "vendir")
|
|
30
31
|
}, {
|
|
31
32
|
toolName: "helm",
|
|
32
|
-
constraint: config
|
|
33
|
+
constraint: await resolveToolConstraint(config, "helm")
|
|
33
34
|
}]
|
|
34
35
|
};
|
|
35
36
|
await gitExec(`vendir sync`, execOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/vendir/artifacts.ts"],"sourcesContent":["import { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n getParentDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { withGitEnvironment } from '../../../util/git/exec.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\n\nconst gitExec = withGitEnvironment();\n\nexport async function updateArtifacts({\n packageFileName,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`vendir.updateArtifacts(${packageFileName})`);\n\n const lockFileName = getSiblingFileName(packageFileName, 'vendir.lock.yml');\n if (!lockFileName) {\n logger.warn('No vendir.lock.yml found');\n return null;\n }\n const existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.warn('Empty vendir.lock.yml found');\n return null;\n }\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n logger.debug('Updating Vendir artifacts');\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n docker: {},\n toolConstraints: [\n {
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/vendir/artifacts.ts"],"sourcesContent":["import { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n getParentDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { withGitEnvironment } from '../../../util/git/exec.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\n\nconst gitExec = withGitEnvironment();\n\nexport async function updateArtifacts({\n packageFileName,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`vendir.updateArtifacts(${packageFileName})`);\n\n const lockFileName = getSiblingFileName(packageFileName, 'vendir.lock.yml');\n if (!lockFileName) {\n logger.warn('No vendir.lock.yml found');\n return null;\n }\n const existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.warn('Empty vendir.lock.yml found');\n return null;\n }\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n logger.debug('Updating Vendir artifacts');\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n docker: {},\n toolConstraints: [\n {\n toolName: 'vendir',\n constraint: await resolveToolConstraint(config, 'vendir'),\n },\n {\n toolName: 'helm',\n constraint: await resolveToolConstraint(config, 'helm'),\n },\n ],\n };\n\n await gitExec(`vendir sync`, execOptions);\n\n logger.debug('Returning updated Vendir artifacts');\n\n const fileChanges: UpdateArtifactsResult[] = [];\n\n const newVendirLockContent = await readLocalFile(lockFileName, 'utf8');\n const isLockFileChanged = existingLockFileContent !== newVendirLockContent;\n if (isLockFileChanged) {\n fileChanges.push({\n file: {\n type: 'addition',\n path: lockFileName,\n contents: newVendirLockContent,\n },\n });\n }\n\n // add modified vendir archives to artifacts\n logger.debug(\"Adding Sync'd files to git\");\n // Files must be in the vendor path to get added\n const vendorDir = getParentDir(packageFileName);\n const status = await getRepoStatus();\n if (status) {\n const modifiedFiles = coerceArray(status.modified);\n const notAddedFiles = status.not_added;\n const deletedFiles = coerceArray(status.deleted);\n\n for (const f of modifiedFiles.concat(notAddedFiles)) {\n const isFileInVendorDir = f.startsWith(vendorDir);\n if (vendorDir || isFileInVendorDir) {\n fileChanges.push({\n file: {\n type: 'addition',\n path: f,\n contents: await readLocalFile(f),\n },\n });\n }\n }\n\n for (const f of deletedFiles) {\n fileChanges.push({\n file: {\n type: 'deletion',\n path: f,\n },\n });\n }\n } else {\n logger.error('Failed to get git status');\n }\n\n return fileChanges.length ? fileChanges : null;\n } catch (err) {\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.debug({ err }, 'Failed to update Vendir lock file');\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: err.message,\n },\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;AAeA,MAAM,UAAU,mBAAmB;AAEnC,eAAsB,gBAAgB,EACpC,iBACA,uBACA,UAC0D;CAC1D,OAAO,MAAM,0BAA0B,gBAAgB,EAAE;CAEzD,MAAM,eAAe,mBAAmB,iBAAiB,iBAAiB;CAC1E,IAAI,CAAC,cAAc;EACjB,OAAO,KAAK,0BAA0B;EACtC,OAAO;CACT;CACA,MAAM,0BAA0B,MAAM,cAAc,cAAc,MAAM;CACxE,IAAI,CAAC,yBAAyB;EAC5B,OAAO,KAAK,6BAA6B;EACzC,OAAO;CACT;C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d,EACF,CACF;CACF;AACF"}
|
|
@@ -60,7 +60,7 @@ function filterVersions(config, currentVersion, latestVersion, releases, version
|
|
|
60
60
|
else if (config.versioning !== "npm" && semver.validRange(allowedVersions)) {
|
|
61
61
|
logger.debug({ depName: config.depName }, "Falling back to npm semver syntax for allowedVersions");
|
|
62
62
|
filteredReleases = filteredReleases.filter((r) => semver.satisfies(
|
|
63
|
-
semver.valid(r.version) ? r.version : /* v8 ignore start:
|
|
63
|
+
semver.valid(r.version) ? r.version : /* v8 ignore start: only for a version the configured versioning accepts but semver cannot parse, e.g. a four-part docker tag, see #40625 */ semver.coerce(r.version),
|
|
64
64
|
/* v8 ignore stop */
|
|
65
65
|
allowedVersions
|
|
66
66
|
));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","names":["template.compile","pep440.isValid","pep440.matches"],"sources":["../../../../../lib/workers/repository/process/lookup/filter.ts"],"sourcesContent":["import semver from 'semver';\nimport { CONFIG_VALIDATION } from '../../../../constants/error-messages.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport type { Release } from '../../../../modules/datasource/types.ts';\nimport type { VersioningApi } from '../../../../modules/versioning/index.ts';\nimport * as npmVersioning from '../../../../modules/versioning/npm/index.ts';\nimport * as pep440 from '../../../../modules/versioning/pep440/index.ts';\nimport * as poetryVersioning from '../../../../modules/versioning/poetry/index.ts';\nimport { getRegexPredicate } from '../../../../util/string-match.ts';\nimport * as template from '../../../../util/template/index.ts';\nimport type { FilterConfig } from './types.ts';\n\nfunction isReleaseStable(\n release: Release,\n versioningApi: VersioningApi,\n): boolean {\n if (!versioningApi.isStable(release.version)) {\n return false;\n }\n\n if (release.isStable === false) {\n return false;\n }\n\n return true;\n}\n\nfunction filterByMaxMajorIncrement(\n releases: Release[],\n currentVersion: string,\n maxMajorIncrement: number,\n versioningApi: VersioningApi,\n depName: string,\n): Release[] {\n const currentMajor = versioningApi.getMajor(currentVersion);\n /* v8 ignore next -- shouldn't happen */\n if (currentMajor === null) {\n return releases;\n }\n return releases.filter((r) => {\n const releaseMajor = versioningApi.getMajor(r.version);\n /* v8 ignore next -- shouldn't happen */\n if (releaseMajor === null) {\n return true;\n }\n const majorIncrement = releaseMajor - currentMajor;\n if (majorIncrement > maxMajorIncrement) {\n logger.once.debug(\n `Skipping ${depName}@${r.version} because major increment ${majorIncrement} exceeds maxMajorIncrement ${maxMajorIncrement}`,\n );\n return false;\n }\n return true;\n });\n}\n\nexport function filterVersions(\n config: FilterConfig,\n currentVersion: string,\n latestVersion: string,\n releases: Release[],\n versioningApi: VersioningApi,\n): Release[] {\n const { ignoreUnstable, ignoreDeprecated, respectLatest, maxMajorIncrement } =\n config;\n\n /* v8 ignore next -- shouldn't happen */\n if (!currentVersion) {\n return [];\n }\n\n // Leave only versions greater than current\n const versionedReleases = releases.filter((r) =>\n versioningApi.isVersion(r.version),\n );\n let filteredReleases = versionedReleases.filter((r) =>\n versioningApi.isGreaterThan(r.version, currentVersion),\n );\n\n const currentRelease = versioningApi.isVersion(currentVersion)\n ? versionedReleases.find((r) =>\n versioningApi.equals(r.version, currentVersion),\n )\n : undefined;\n\n // Don't upgrade from non-deprecated to deprecated\n if (ignoreDeprecated && currentRelease && !currentRelease.isDeprecated) {\n filteredReleases = filteredReleases.filter((r) => {\n if (r.isDeprecated) {\n logger.trace(\n `Skipping ${config.depName!}@${r.version} because it is deprecated`,\n );\n return false;\n }\n return true;\n });\n }\n\n if (maxMajorIncrement && maxMajorIncrement > 0) {\n filteredReleases = filterByMaxMajorIncrement(\n filteredReleases,\n currentVersion,\n maxMajorIncrement,\n versioningApi,\n config.depName!,\n );\n }\n\n const currentMajor = versioningApi.getMajor(currentVersion);\n const currentMinor = versioningApi.getMinor(currentVersion);\n const currentPatch = versioningApi.getPatch(currentVersion);\n\n if (config.allowedVersions) {\n const input = {\n currentVersion,\n major: currentMajor,\n minor: currentMinor,\n patch: currentPatch,\n };\n const allowedVersions = template.compile(config.allowedVersions, input);\n const isAllowedPred = getRegexPredicate(allowedVersions);\n if (isAllowedPred) {\n filteredReleases = filteredReleases.filter(({ version }) =>\n isAllowedPred(version),\n );\n } else if (versioningApi.isValid(allowedVersions)) {\n filteredReleases = filteredReleases.filter((r) =>\n versioningApi.matches(r.version, allowedVersions),\n );\n } else if (\n config.versioning !== npmVersioning.id &&\n semver.validRange(allowedVersions)\n ) {\n logger.debug(\n { depName: config.depName },\n 'Falling back to npm semver syntax for allowedVersions',\n );\n filteredReleases = filteredReleases.filter((r) =>\n semver.satisfies(\n semver.valid(r.version)\n ? r.version\n : /* v8 ignore start:
|
|
1
|
+
{"version":3,"file":"filter.js","names":["template.compile","pep440.isValid","pep440.matches"],"sources":["../../../../../lib/workers/repository/process/lookup/filter.ts"],"sourcesContent":["import semver from 'semver';\nimport { CONFIG_VALIDATION } from '../../../../constants/error-messages.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport type { Release } from '../../../../modules/datasource/types.ts';\nimport type { VersioningApi } from '../../../../modules/versioning/index.ts';\nimport * as npmVersioning from '../../../../modules/versioning/npm/index.ts';\nimport * as pep440 from '../../../../modules/versioning/pep440/index.ts';\nimport * as poetryVersioning from '../../../../modules/versioning/poetry/index.ts';\nimport { getRegexPredicate } from '../../../../util/string-match.ts';\nimport * as template from '../../../../util/template/index.ts';\nimport type { FilterConfig } from './types.ts';\n\nfunction isReleaseStable(\n release: Release,\n versioningApi: VersioningApi,\n): boolean {\n if (!versioningApi.isStable(release.version)) {\n return false;\n }\n\n if (release.isStable === false) {\n return false;\n }\n\n return true;\n}\n\nfunction filterByMaxMajorIncrement(\n releases: Release[],\n currentVersion: string,\n maxMajorIncrement: number,\n versioningApi: VersioningApi,\n depName: string,\n): Release[] {\n const currentMajor = versioningApi.getMajor(currentVersion);\n /* v8 ignore next -- shouldn't happen */\n if (currentMajor === null) {\n return releases;\n }\n return releases.filter((r) => {\n const releaseMajor = versioningApi.getMajor(r.version);\n /* v8 ignore next -- shouldn't happen */\n if (releaseMajor === null) {\n return true;\n }\n const majorIncrement = releaseMajor - currentMajor;\n if (majorIncrement > maxMajorIncrement) {\n logger.once.debug(\n `Skipping ${depName}@${r.version} because major increment ${majorIncrement} exceeds maxMajorIncrement ${maxMajorIncrement}`,\n );\n return false;\n }\n return true;\n });\n}\n\nexport function filterVersions(\n config: FilterConfig,\n currentVersion: string,\n latestVersion: string,\n releases: Release[],\n versioningApi: VersioningApi,\n): Release[] {\n const { ignoreUnstable, ignoreDeprecated, respectLatest, maxMajorIncrement } =\n config;\n\n /* v8 ignore next -- shouldn't happen */\n if (!currentVersion) {\n return [];\n }\n\n // Leave only versions greater than current\n const versionedReleases = releases.filter((r) =>\n versioningApi.isVersion(r.version),\n );\n let filteredReleases = versionedReleases.filter((r) =>\n versioningApi.isGreaterThan(r.version, currentVersion),\n );\n\n const currentRelease = versioningApi.isVersion(currentVersion)\n ? versionedReleases.find((r) =>\n versioningApi.equals(r.version, currentVersion),\n )\n : undefined;\n\n // Don't upgrade from non-deprecated to deprecated\n if (ignoreDeprecated && currentRelease && !currentRelease.isDeprecated) {\n filteredReleases = filteredReleases.filter((r) => {\n if (r.isDeprecated) {\n logger.trace(\n `Skipping ${config.depName!}@${r.version} because it is deprecated`,\n );\n return false;\n }\n return true;\n });\n }\n\n if (maxMajorIncrement && maxMajorIncrement > 0) {\n filteredReleases = filterByMaxMajorIncrement(\n filteredReleases,\n currentVersion,\n maxMajorIncrement,\n versioningApi,\n config.depName!,\n );\n }\n\n const currentMajor = versioningApi.getMajor(currentVersion);\n const currentMinor = versioningApi.getMinor(currentVersion);\n const currentPatch = versioningApi.getPatch(currentVersion);\n\n if (config.allowedVersions) {\n const input = {\n currentVersion,\n major: currentMajor,\n minor: currentMinor,\n patch: currentPatch,\n };\n const allowedVersions = template.compile(config.allowedVersions, input);\n const isAllowedPred = getRegexPredicate(allowedVersions);\n if (isAllowedPred) {\n filteredReleases = filteredReleases.filter(({ version }) =>\n isAllowedPred(version),\n );\n } else if (versioningApi.isValid(allowedVersions)) {\n filteredReleases = filteredReleases.filter((r) =>\n versioningApi.matches(r.version, allowedVersions),\n );\n } else if (\n config.versioning !== npmVersioning.id &&\n semver.validRange(allowedVersions)\n ) {\n logger.debug(\n { depName: config.depName },\n 'Falling back to npm semver syntax for allowedVersions',\n );\n filteredReleases = filteredReleases.filter((r) =>\n semver.satisfies(\n semver.valid(r.version)\n ? r.version\n : /* v8 ignore start: only for a version the configured versioning accepts but semver cannot parse, e.g. a four-part docker tag, see #40625 */ semver.coerce(\n r.version,\n )!,\n /* v8 ignore stop */\n allowedVersions,\n ),\n );\n } else if (\n config.versioning === poetryVersioning.id &&\n pep440.isValid(allowedVersions)\n ) {\n logger.debug(\n { depName: config.depName },\n 'Falling back to pypi syntax for allowedVersions',\n );\n filteredReleases = filteredReleases.filter((r) =>\n pep440.matches(r.version, allowedVersions),\n );\n } else {\n const error = new Error(CONFIG_VALIDATION);\n error.validationSource = 'config';\n error.validationError = 'Invalid `allowedVersions`';\n error.validationMessage = `The following allowedVersions does not parse as a valid version or range with versioning=${JSON.stringify(config.versioning)}: ${JSON.stringify(allowedVersions)}`;\n throw error;\n }\n }\n\n if (config.followTag) {\n return filteredReleases;\n }\n\n if (\n respectLatest &&\n latestVersion &&\n !versioningApi.isGreaterThan(currentVersion, latestVersion)\n ) {\n filteredReleases = filteredReleases.filter(\n (r) => !versioningApi.isGreaterThan(r.version, latestVersion),\n );\n }\n\n if (!ignoreUnstable) {\n return filteredReleases;\n }\n\n if (currentRelease && isReleaseStable(currentRelease, versioningApi)) {\n return filteredReleases.filter((r) => isReleaseStable(r, versioningApi));\n }\n\n return filteredReleases.filter((r) => {\n if (isReleaseStable(r, versioningApi)) {\n return true;\n }\n\n const major = versioningApi.getMajor(r.version);\n\n if (major !== currentMajor) {\n return false;\n }\n\n if (versioningApi.allowUnstableMajorUpgrades) {\n return true;\n }\n\n const minor = versioningApi.getMinor(r.version);\n const patch = versioningApi.getPatch(r.version);\n\n return minor === currentMinor && patch === currentPatch;\n });\n}\n"],"mappings":";;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CAGF,IAAI,CAAC,gBACH,OAAO;CAGT,IAAI,kBAAkB,gBAAgB,gBAAgB,aAAa,GACjE,OAAO,iBAAiB,QAAQ,MAAM,gBAAgB,GAAG,aAAa,CAAC;CAGzE,OAAO,iBAAiB,QAAQ,MAAM;EACpC,IAAI,gBAAgB,GAAG,aAAa,GAClC,OAAO;EAKT,IAFc,cAAc,SAAS,EAAE,OAE/B,MAAM,cACZ,OAAO;EAGT,IAAI,cAAc,4BAChB,OAAO;EAGT,MAAM,QAAQ,cAAc,SAAS,EAAE,OAAO;EAC9C,MAAM,QAAQ,cAAc,SAAS,EAAE,OAAO;EAE9C,OAAO,UAAU,gBAAgB,UAAU;CAC7C,CAAC;AACH"}
|
|
@@ -12,18 +12,13 @@ async function generateUpdate(config, currentValue, versioningApi, rangeStrategy
|
|
|
12
12
|
newValue: null,
|
|
13
13
|
hasAttestation: release.attestation
|
|
14
14
|
};
|
|
15
|
-
// istanbul ignore if
|
|
16
15
|
if (release.checksumUrl !== void 0) update.checksumUrl = release.checksumUrl;
|
|
17
|
-
// istanbul ignore if
|
|
18
16
|
if (release.downloadUrl !== void 0) update.downloadUrl = release.downloadUrl;
|
|
19
|
-
// istanbul ignore if
|
|
20
17
|
if (release.newDigest !== void 0) update.newDigest = release.newDigest;
|
|
21
|
-
// istanbul ignore if
|
|
22
18
|
if (release.releaseTimestamp) {
|
|
23
19
|
update.releaseTimestamp = release.releaseTimestamp;
|
|
24
20
|
update.newVersionAgeInDays = getElapsedDays(release.releaseTimestamp);
|
|
25
21
|
}
|
|
26
|
-
// istanbul ignore if
|
|
27
22
|
if (release.registryUrl !== void 0)
|
|
28
23
|
/**
|
|
29
24
|
* This means:
|
|
@@ -39,7 +34,7 @@ async function generateUpdate(config, currentValue, versioningApi, rangeStrategy
|
|
|
39
34
|
newVersion,
|
|
40
35
|
allVersions
|
|
41
36
|
});
|
|
42
|
-
} catch (err)
|
|
37
|
+
} catch (err) {
|
|
43
38
|
logger.warn({
|
|
44
39
|
err,
|
|
45
40
|
currentValue,
|
|
@@ -53,7 +48,6 @@ async function generateUpdate(config, currentValue, versioningApi, rangeStrategy
|
|
|
53
48
|
update.newMajor = versioningApi.getMajor(newVersion);
|
|
54
49
|
update.newMinor = versioningApi.getMinor(newVersion);
|
|
55
50
|
update.newPatch = versioningApi.getPatch(newVersion);
|
|
56
|
-
// istanbul ignore if
|
|
57
51
|
if (!update.updateType && !currentVersion) {
|
|
58
52
|
logger.debug({ update }, "Update has no currentVersion");
|
|
59
53
|
update.newValue = currentValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","names":[],"sources":["../../../../../lib/workers/repository/process/lookup/generate.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport { logger } from '../../../../logger/index.ts';\nimport type { Release } from '../../../../modules/datasource/index.ts';\nimport type { LookupUpdate } from '../../../../modules/manager/types.ts';\nimport type { VersioningApi } from '../../../../modules/versioning/index.ts';\nimport type { RangeStrategy } from '../../../../types/index.ts';\nimport { getElapsedDays } from '../../../../util/date.ts';\nimport { getMergeConfidenceLevel } from '../../../../util/merge-confidence/index.ts';\nimport type { LookupUpdateConfig } from './types.ts';\nimport { getUpdateType } from './update-type.ts';\n\nexport async function generateUpdate(\n config: LookupUpdateConfig,\n currentValue: string | undefined,\n versioningApi: VersioningApi,\n rangeStrategy: RangeStrategy,\n currentVersion: string,\n bucket: string,\n release: Release,\n allVersions: Set<string>,\n): Promise<LookupUpdate> {\n const newVersion = release.version;\n const update: LookupUpdate = {\n bucket,\n newVersion,\n newValue: null!,\n hasAttestation: release.attestation,\n };\n\n
|
|
1
|
+
{"version":3,"file":"generate.js","names":[],"sources":["../../../../../lib/workers/repository/process/lookup/generate.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport { logger } from '../../../../logger/index.ts';\nimport type { Release } from '../../../../modules/datasource/index.ts';\nimport type { LookupUpdate } from '../../../../modules/manager/types.ts';\nimport type { VersioningApi } from '../../../../modules/versioning/index.ts';\nimport type { RangeStrategy } from '../../../../types/index.ts';\nimport { getElapsedDays } from '../../../../util/date.ts';\nimport { getMergeConfidenceLevel } from '../../../../util/merge-confidence/index.ts';\nimport type { LookupUpdateConfig } from './types.ts';\nimport { getUpdateType } from './update-type.ts';\n\nexport async function generateUpdate(\n config: LookupUpdateConfig,\n currentValue: string | undefined,\n versioningApi: VersioningApi,\n rangeStrategy: RangeStrategy,\n currentVersion: string,\n bucket: string,\n release: Release,\n allVersions: Set<string>,\n): Promise<LookupUpdate> {\n const newVersion = release.version;\n const update: LookupUpdate = {\n bucket,\n newVersion,\n newValue: null!,\n hasAttestation: release.attestation,\n };\n\n if (release.checksumUrl !== undefined) {\n update.checksumUrl = release.checksumUrl;\n }\n if (release.downloadUrl !== undefined) {\n update.downloadUrl = release.downloadUrl;\n }\n if (release.newDigest !== undefined) {\n update.newDigest = release.newDigest;\n }\n if (release.releaseTimestamp) {\n update.releaseTimestamp = release.releaseTimestamp;\n update.newVersionAgeInDays = getElapsedDays(release.releaseTimestamp);\n }\n if (release.registryUrl !== undefined) {\n /**\n * This means:\n * - registry strategy is set to merge\n * - releases were fetched from multiple registry urls\n */\n update.registryUrl = release.registryUrl;\n }\n\n if (currentValue) {\n try {\n update.newValue = versioningApi.getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n allVersions,\n })!;\n } catch (err) {\n logger.warn(\n { err, currentValue, rangeStrategy, currentVersion, newVersion },\n 'getNewValue error',\n );\n update.newValue = currentValue;\n }\n } else {\n update.newValue = currentValue;\n }\n update.newMajor = versioningApi.getMajor(newVersion)!;\n update.newMinor = versioningApi.getMinor(newVersion)!;\n update.newPatch = versioningApi.getPatch(newVersion)!;\n if (!update.updateType && !currentVersion) {\n logger.debug({ update }, 'Update has no currentVersion');\n update.newValue = currentValue!;\n return update;\n }\n update.updateType =\n update.updateType ??\n getUpdateType(config, versioningApi, currentVersion, newVersion);\n if (versioningApi.isBreaking) {\n // This versioning scheme has breaking awareness\n update.isBreaking = versioningApi.isBreaking(currentVersion, newVersion);\n } else {\n // This versioning scheme does not have breaking awareness - assume only major updates are breaking\n // Updates from, or to, unstable releases should be treated as breaking too.\n // But we should not add that as default behavior until we stop treating non-LTS versions as unstable first\n update.isBreaking = update.updateType === 'major';\n }\n const { datasource, packageName, packageRules } = config;\n if (packageRules?.some((pr) => isNonEmptyArray(pr.matchConfidence))) {\n update.mergeConfidenceLevel = await getMergeConfidenceLevel(\n datasource,\n packageName,\n currentVersion,\n newVersion,\n update.updateType,\n );\n }\n if (!versioningApi.isVersion(update.newValue)) {\n update.isRange = true;\n }\n if (rangeStrategy === 'update-lockfile' && currentValue === update.newValue) {\n update.isLockfileUpdate = true;\n }\n if (\n rangeStrategy === 'bump' &&\n // TODO #22198\n versioningApi.matches(newVersion, currentValue!)\n ) {\n update.isBump = true;\n }\n return update;\n}\n"],"mappings":";;;;;;AAWA,eAAsB,eACpB,QACA,cACA,eACA,eACA,gBACA,QACA,SACA,aACuB;CACvB,MAAM,aAAa,QAAQ;CAC3B,MAAM,SAAuB;EAC3B;EACA;EACA,UAAU;EACV,gBAAgB,QAAQ;CAC1B;CAEA,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,OAAO,cAAc,QAAQ;CAE/B,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,OAAO,cAAc,QAAQ;CAE/B,IAAI,QAAQ,cAAc,KAAA,GACxB,OAAO,YAAY,QAAQ;CAE7B,IAAI,QAAQ,kBAAkB;EAC5B,OAAO,mBAAmB,QAAQ;EAClC,OAAO,sBAAsB,eAAe,QAAQ,gBAAgB;CACtE;CACA,IAAI,QAAQ,gBAAgB,KAAA;;;;;;CAM1B,OAAO,cAAc,QAAQ;CAG/B,IAAI,cACF,IAAI;EACF,OAAO,WAAW,cAAc,YAAY;GAC1C;GACA;GACA;GACA;GACA;EACF,CAAC;CACH,SAAS,KAAK;EACZ,OAAO,KACL;GAAE;GAAK;GAAc;GAAe;GAAgB;EAAW,GAC/D,mBACF;EACA,OAAO,WAAW;CACpB;MAEA,OAAO,WAAW;CAEpB,OAAO,WAAW,cAAc,SAAS,UAAU;CACnD,OAAO,WAAW,cAAc,SAAS,UAAU;CACnD,OAAO,WAAW,cAAc,SAAS,UAAU;CACnD,IAAI,CAAC,OAAO,cAAc,CAAC,gBAAgB;EACzC,OAAO,MAAM,EAAE,OAAO,GAAG,8BAA8B;EACvD,OAAO,WAAW;EAClB,OAAO;CACT;CACA,OAAO,aACL,OAAO,cACP,cAAc,QAAQ,eAAe,gBAAgB,UAAU;CACjE,IAAI,cAAc,YAEhB,OAAO,aAAa,cAAc,WAAW,gBAAgB,UAAU;MAKvE,OAAO,aAAa,OAAO,eAAe;CAE5C,MAAM,EAAE,YAAY,aAAa,iBAAiB;CAClD,IAAI,cAAc,MAAM,OAAO,gBAAgB,GAAG,eAAe,CAAC,GAChE,OAAO,uBAAuB,MAAM,wBAClC,YACA,aACA,gBACA,YACA,OAAO,UACT;CAEF,IAAI,CAAC,cAAc,UAAU,OAAO,QAAQ,GAC1C,OAAO,UAAU;CAEnB,IAAI,kBAAkB,qBAAqB,iBAAiB,OAAO,UACjE,OAAO,mBAAmB;CAE5B,IACE,kBAAkB,UAElB,cAAc,QAAQ,YAAY,YAAa,GAE/C,OAAO,SAAS;CAElB,OAAO;AACT"}
|
|
@@ -284,7 +284,7 @@ async function lookupUpdates(inconfig) {
|
|
|
284
284
|
const buckets = {};
|
|
285
285
|
for (const release of filteredReleases) {
|
|
286
286
|
const bucket = getBucket(config, currentVersion, release.version, versioningApi);
|
|
287
|
-
// v8 ignore else --
|
|
287
|
+
// v8 ignore else -- see #40625
|
|
288
288
|
if (isString(bucket)) {
|
|
289
289
|
if (buckets[bucket]) buckets[bucket].push(release);
|
|
290
290
|
else buckets[bucket] = [release];
|
|
@@ -351,7 +351,7 @@ async function lookupUpdates(inconfig) {
|
|
|
351
351
|
} else if (compareValue && versioningApi.isSingleVersion(compareValue)) res.fixedVersion = compareValue.replace(regEx(/^=+/), "");
|
|
352
352
|
if (isString(config.currentValue) && isString(compareValue) && isString(config.versionCompatibility)) for (const update of res.updates) {
|
|
353
353
|
logger.debug({ update });
|
|
354
|
-
// v8 ignore else --
|
|
354
|
+
// v8 ignore else -- see #40625
|
|
355
355
|
if (isString(config.currentValue) && isString(update.newValue)) update.newValue = config.currentValue.replace(compareValue, update.newValue);
|
|
356
356
|
}
|
|
357
357
|
if (supportsDigests(config.datasource)) {
|