renovate 41.155.0 → 41.155.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,6 +9,7 @@ export declare class PypiDatasource extends Datasource {
|
|
|
9
9
|
readonly defaultRegistryUrls: string[];
|
|
10
10
|
readonly defaultVersioning = "pep440";
|
|
11
11
|
readonly registryStrategy = "merge";
|
|
12
|
+
readonly releaseTimestampSupport = true;
|
|
12
13
|
readonly releaseTimestampNote = "The relase timestamp is determined from the `upload_time` field in the results.";
|
|
13
14
|
readonly sourceUrlSupport = "release";
|
|
14
15
|
readonly sourceUrlNote = "The source URL is determined from the `homepage` field if it is a github repository, else we use the `project_urls` field.";
|
|
@@ -27,6 +27,7 @@ class PypiDatasource extends datasource_1.Datasource {
|
|
|
27
27
|
defaultRegistryUrls = [PypiDatasource.defaultURL];
|
|
28
28
|
defaultVersioning = pep440.id;
|
|
29
29
|
registryStrategy = 'merge';
|
|
30
|
+
releaseTimestampSupport = true;
|
|
30
31
|
releaseTimestampNote = 'The relase timestamp is determined from the `upload_time` field in the results.';
|
|
31
32
|
sourceUrlSupport = 'release';
|
|
32
33
|
sourceUrlNote = 'The source URL is determined from the `homepage` field if it is a github repository, else we use the `project_urls` field.';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/datasource/pypi/index.ts"],"names":[],"mappings":";;;;AAAA,gEAA2B;AAC3B,kEAAkC;AAClC,gGAA8D;AAC9D,4CAAyC;AACzC,+CAAkD;AAClD,2CAA2C;AAC3C,6CAA2C;AAE3C,+CAA4C;AAC5C,uDAAsD;AACtD,2CAAkE;AAClE,wEAAkD;AAClD,8CAA2C;AAE3C,kCAA6C;AAC7C,qCAAgE;AAGhE,MAAa,cAAe,SAAQ,uBAAU;IAC5C,MAAM,CAAU,EAAE,GAAG,MAAM,CAAC;IAE5B;QACE,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,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,eAAe,GAAG,IAAA,mBAAW,EAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACvD,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;YAClE,MAAM,MAAM,GAAY,EAAE,OAAO,EAAE,CAAC;YACpC,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;YACrC,CAAC;YACD,8FAA8F;YAC9F,MAAM,CAAC,WAAW,GAAG;gBACnB,oCAAoC;gBACpC,MAAM,EAAE,eAAe,CAAC,GAAG,CACzB,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,eAAe,CAClC;aACT,CAAC;YACF,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACpB,CAAC;;AArSH,wCAsSC","sourcesContent":["import url from 'node:url';\nimport is from '@sindresorhus/is';\nimport changelogFilenameRegex from 'changelog-filename-regex';\nimport { logger } from '../../../logger';\nimport { coerceArray } from '../../../util/array';\nimport { getEnv } from '../../../util/env';\nimport { parse } from '../../../util/html';\nimport type { OutgoingHttpHeaders } from '../../../util/http/types';\nimport { regEx } from '../../../util/regex';\nimport { asTimestamp } from '../../../util/timestamp';\nimport { ensureTrailingSlash, parseUrl } from '../../../util/url';\nimport * as pep440 from '../../versioning/pep440';\nimport { Datasource } from '../datasource';\nimport type { GetReleasesConfig, Release, ReleaseResult } from '../types';\nimport { getGoogleAuthToken } from '../util';\nimport { isGitHubRepo, normalizePythonDepName } from './common';\nimport type { PypiJSON, PypiJSONRelease, Releases } from './types';\n\nexport class PypiDatasource extends Datasource {\n static readonly id = 'pypi';\n\n constructor() {\n super(PypiDatasource.id);\n }\n\n override readonly caching = true;\n\n override readonly customRegistrySupport = true;\n\n static readonly defaultURL =\n getEnv().PIP_INDEX_URL ?? 'https://pypi.org/pypi/';\n override readonly defaultRegistryUrls = [PypiDatasource.defaultURL];\n\n override readonly defaultVersioning = pep440.id;\n\n override readonly registryStrategy = 'merge';\n\n override readonly releaseTimestampNote =\n 'The relase timestamp is determined from the `upload_time` field in the results.';\n override readonly sourceUrlSupport = 'release';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `homepage` field if it is a github repository, else we use the `project_urls` field.';\n\n async getReleases({\n packageName,\n registryUrl,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n let dependency: ReleaseResult | null = null;\n // TODO: null check (#22198)\n const hostUrl = ensureTrailingSlash(\n registryUrl!.replace('https://pypi.org/simple', 'https://pypi.org/pypi'),\n );\n const normalizedLookupName = normalizePythonDepName(packageName);\n\n // not all simple indexes use this identifier, but most do\n if (hostUrl.endsWith('/simple/') || hostUrl.endsWith('/+simple/')) {\n logger.trace(\n { packageName, hostUrl },\n 'Looking up pypi simple dependency',\n );\n dependency = await this.getSimpleDependency(\n normalizedLookupName,\n hostUrl,\n );\n } else {\n logger.trace({ packageName, hostUrl }, 'Looking up pypi api dependency');\n try {\n // we need to resolve early here so we can catch any 404s and fallback to a simple lookup\n dependency = await this.getDependency(normalizedLookupName, hostUrl);\n } catch (err) {\n // error contacting json-style api -- attempt to fallback to a simple-style api\n logger.trace(\n { packageName, hostUrl, err },\n 'Looking up pypi simple dependency via fallback',\n );\n dependency = await this.getSimpleDependency(\n normalizedLookupName,\n hostUrl,\n );\n }\n }\n return dependency;\n }\n\n private async getAuthHeaders(\n lookupUrl: string,\n ): Promise<OutgoingHttpHeaders> {\n const parsedUrl = parseUrl(lookupUrl);\n if (!parsedUrl) {\n logger.once.debug({ lookupUrl }, 'Failed to parse URL');\n return {};\n }\n if (parsedUrl.hostname.endsWith('.pkg.dev')) {\n const auth = await getGoogleAuthToken();\n if (auth) {\n return { authorization: `Basic ${auth}` };\n }\n logger.once.debug({ lookupUrl }, 'Could not get Google access token');\n return {};\n }\n return {};\n }\n\n private async getDependency(\n packageName: string,\n hostUrl: string,\n ): Promise<ReleaseResult | null> {\n const lookupUrl = url.resolve(\n hostUrl,\n `${normalizePythonDepName(packageName)}/json`,\n );\n const dependency: ReleaseResult = { releases: [] };\n logger.trace({ lookupUrl }, 'Pypi api got lookup');\n const headers = await this.getAuthHeaders(lookupUrl);\n const rep = await this.http.getJsonUnchecked<PypiJSON>(lookupUrl, {\n headers,\n });\n const dep = rep?.body;\n if (!dep) {\n logger.trace({ dependency: packageName }, 'pip package not found');\n return null;\n }\n if (rep.authorization) {\n dependency.isPrivate = true;\n }\n logger.trace({ lookupUrl }, 'Got pypi api result');\n\n if (dep.info?.home_page) {\n dependency.homepage = dep.info.home_page;\n if (isGitHubRepo(dep.info.home_page)) {\n dependency.sourceUrl = dep.info.home_page.replace(\n 'http://',\n 'https://',\n );\n }\n }\n\n if (dep.info?.project_urls) {\n for (const [name, projectUrl] of Object.entries(dep.info.project_urls)) {\n const lower = name.toLowerCase();\n\n if (\n !dependency.sourceUrl &&\n (lower.startsWith('repo') ||\n lower === 'code' ||\n lower === 'source' ||\n isGitHubRepo(projectUrl))\n ) {\n dependency.sourceUrl = projectUrl;\n }\n\n if (\n !dependency.changelogUrl &&\n ([\n 'changelog',\n 'change log',\n 'changes',\n 'release notes',\n 'news',\n \"what's new\",\n ].includes(lower) ||\n changelogFilenameRegex.exec(lower))\n ) {\n // from https://github.com/pypa/warehouse/blob/418c7511dc367fb410c71be139545d0134ccb0df/warehouse/templates/packaging/detail.html#L24\n dependency.changelogUrl = projectUrl;\n }\n }\n }\n\n if (dep.releases) {\n const versions = Object.keys(dep.releases);\n dependency.releases = versions.map((version) => {\n const releases = coerceArray(dep.releases?.[version]);\n const { upload_time: releaseTimestamp } = releases[0] || {};\n const isDeprecated = releases.some(({ yanked }) => yanked);\n const result: Release = {\n version,\n releaseTimestamp: asTimestamp(releaseTimestamp),\n };\n if (isDeprecated) {\n result.isDeprecated = isDeprecated;\n }\n // There may be multiple releases with different requires_python, so we return all in an array\n const pythonConstraints = releases\n .map(({ requires_python }) => requires_python)\n .filter(is.string);\n result.constraints = {\n python: Array.from(new Set(pythonConstraints)),\n };\n return result;\n });\n }\n return dependency;\n }\n\n private static extractVersionFromLinkText(\n text: string,\n packageName: string,\n ): string | null {\n // source packages\n const lcText = text.toLowerCase();\n const normalizedSrcText = normalizePythonDepName(text);\n const srcPrefix = `${packageName}-`;\n\n // source distribution format: `{name}-{version}.tar.gz` (https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-file-name)\n // binary distribution: `{distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl` (https://packaging.python.org/en/latest/specifications/binary-distribution-format/#file-name-convention)\n // officially both `name` and `distribution` should be normalized and then the - replaced with _, but in reality this is not the case\n // We therefore normalize the name we have (replacing `_-.` with -) and then check if the text starts with the normalized name\n\n if (!normalizedSrcText.startsWith(srcPrefix)) {\n return null;\n }\n\n // strip off the prefix using the prefix length as we may have normalized the srcPrefix/packageName\n // We assume that neither the version nor the suffix contains multiple `-` like `0.1.2---rc1.tar.gz`\n // and use the difference in length to strip off the prefix in case the name contains double `--` characters\n const normalizedLengthDiff = lcText.length - normalizedSrcText.length;\n const res = lcText.slice(srcPrefix.length + normalizedLengthDiff);\n\n // source distribution\n const srcSuffixes = ['.tar.gz', '.tar.bz2', '.tar.xz', '.zip', '.tgz'];\n const srcSuffix = srcSuffixes.find((suffix) => lcText.endsWith(suffix));\n if (srcSuffix) {\n // strip off the suffix using character length\n return res.slice(0, -srcSuffix.length);\n }\n\n // binary distribution\n // for binary distributions the version is the first part after the removed distribution name\n const wheelSuffix = '.whl';\n if (lcText.endsWith(wheelSuffix) && lcText.split('-').length > 2) {\n return res.split('-')[0];\n }\n return null;\n }\n\n private static cleanSimpleHtml(html: string): string {\n return (\n html\n .replace(regEx(/<\\/?pre>/), '')\n // Certain simple repositories like artifactory don't escape > and <\n .replace(\n regEx(/data-requires-python=\"([^\"]*?)>([^\"]*?)\"/g),\n 'data-requires-python=\"$1>$2\"',\n )\n .replace(\n regEx(/data-requires-python=\"([^\"]*?)<([^\"]*?)\"/g),\n 'data-requires-python=\"$1<$2\"',\n )\n );\n }\n\n private async getSimpleDependency(\n packageName: string,\n hostUrl: string,\n ): Promise<ReleaseResult | null> {\n const lookupUrl = url.resolve(\n hostUrl,\n ensureTrailingSlash(normalizePythonDepName(packageName)),\n );\n const dependency: ReleaseResult = { releases: [] };\n const headers = await this.getAuthHeaders(lookupUrl);\n const response = await this.http.getText(lookupUrl, { headers });\n const dep = response?.body;\n if (!dep) {\n logger.trace({ dependency: packageName }, 'pip package not found');\n return null;\n }\n if (response.authorization) {\n dependency.isPrivate = true;\n }\n const root = parse(PypiDatasource.cleanSimpleHtml(dep));\n const links = root.querySelectorAll('a');\n const releases: Releases = {};\n for (const link of Array.from(links)) {\n const version = PypiDatasource.extractVersionFromLinkText(\n link.text?.trim(),\n packageName,\n );\n if (version) {\n const release: PypiJSONRelease = {\n yanked: link.hasAttribute('data-yanked'),\n };\n const requiresPython = link.getAttribute('data-requires-python');\n if (requiresPython) {\n release.requires_python = requiresPython;\n }\n if (!releases[version]) {\n releases[version] = [];\n }\n releases[version].push(release);\n }\n }\n const versions = Object.keys(releases);\n dependency.releases = versions.map((version) => {\n const versionReleases = coerceArray(releases[version]);\n const isDeprecated = versionReleases.some(({ yanked }) => yanked);\n const result: Release = { version };\n if (isDeprecated) {\n result.isDeprecated = isDeprecated;\n }\n // There may be multiple releases with different requires_python, so we return all in an array\n result.constraints = {\n // TODO: string[] isn't allowed here\n python: versionReleases.map(\n ({ requires_python }) => requires_python,\n ) as any,\n };\n return result;\n });\n return dependency;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/datasource/pypi/index.ts"],"names":[],"mappings":";;;;AAAA,gEAA2B;AAC3B,kEAAkC;AAClC,gGAA8D;AAC9D,4CAAyC;AACzC,+CAAkD;AAClD,2CAA2C;AAC3C,6CAA2C;AAE3C,+CAA4C;AAC5C,uDAAsD;AACtD,2CA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AAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7C,MAAM,eAAe,GAAG,IAAA,mBAAW,EAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACvD,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;YAClE,MAAM,MAAM,GAAY,EAAE,OAAO,EAAE,CAAC;YACpC,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;YACrC,CAAC;YACD,8FAA8F;YAC9F,MAAM,CAAC,WAAW,GAAG;gBACnB,oCAAoC;gBACpC,MAAM,EAAE,eAAe,CAAC,GAAG,CACzB,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,eAAe,CAClC;aACT,CAAC;YACF,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACpB,CAAC;;AAtSH,wCAuSC","sourcesContent":["import url from 'node:url';\nimport is from '@sindresorhus/is';\nimport changelogFilenameRegex from 'changelog-filename-regex';\nimport { logger } from '../../../logger';\nimport { coerceArray } from '../../../util/array';\nimport { getEnv } from '../../../util/env';\nimport { parse } from '../../../util/html';\nimport type { OutgoingHttpHeaders } from '../../../util/http/types';\nimport { regEx } from '../../../util/regex';\nimport { asTimestamp } from '../../../util/timestamp';\nimport { ensureTrailingSlash, parseUrl } from '../../../util/url';\nimport * as pep440 from '../../versioning/pep440';\nimport { Datasource } from '../datasource';\nimport type { GetReleasesConfig, Release, ReleaseResult } from '../types';\nimport { getGoogleAuthToken } from '../util';\nimport { isGitHubRepo, normalizePythonDepName } from './common';\nimport type { PypiJSON, PypiJSONRelease, Releases } from './types';\n\nexport class PypiDatasource extends Datasource {\n static readonly id = 'pypi';\n\n constructor() {\n super(PypiDatasource.id);\n }\n\n override readonly caching = true;\n\n override readonly customRegistrySupport = true;\n\n static readonly defaultURL =\n getEnv().PIP_INDEX_URL ?? 'https://pypi.org/pypi/';\n override readonly defaultRegistryUrls = [PypiDatasource.defaultURL];\n\n override readonly defaultVersioning = pep440.id;\n\n override readonly registryStrategy = 'merge';\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The relase timestamp is determined from the `upload_time` field in the results.';\n override readonly sourceUrlSupport = 'release';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `homepage` field if it is a github repository, else we use the `project_urls` field.';\n\n async getReleases({\n packageName,\n registryUrl,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n let dependency: ReleaseResult | null = null;\n // TODO: null check (#22198)\n const hostUrl = ensureTrailingSlash(\n registryUrl!.replace('https://pypi.org/simple', 'https://pypi.org/pypi'),\n );\n const normalizedLookupName = normalizePythonDepName(packageName);\n\n // not all simple indexes use this identifier, but most do\n if (hostUrl.endsWith('/simple/') || hostUrl.endsWith('/+simple/')) {\n logger.trace(\n { packageName, hostUrl },\n 'Looking up pypi simple dependency',\n );\n dependency = await this.getSimpleDependency(\n normalizedLookupName,\n hostUrl,\n );\n } else {\n logger.trace({ packageName, hostUrl }, 'Looking up pypi api dependency');\n try {\n // we need to resolve early here so we can catch any 404s and fallback to a simple lookup\n dependency = await this.getDependency(normalizedLookupName, hostUrl);\n } catch (err) {\n // error contacting json-style api -- attempt to fallback to a simple-style api\n logger.trace(\n { packageName, hostUrl, err },\n 'Looking up pypi simple dependency via fallback',\n );\n dependency = await this.getSimpleDependency(\n normalizedLookupName,\n hostUrl,\n );\n }\n }\n return dependency;\n }\n\n private async getAuthHeaders(\n lookupUrl: string,\n ): Promise<OutgoingHttpHeaders> {\n const parsedUrl = parseUrl(lookupUrl);\n if (!parsedUrl) {\n logger.once.debug({ lookupUrl }, 'Failed to parse URL');\n return {};\n }\n if (parsedUrl.hostname.endsWith('.pkg.dev')) {\n const auth = await getGoogleAuthToken();\n if (auth) {\n return { authorization: `Basic ${auth}` };\n }\n logger.once.debug({ lookupUrl }, 'Could not get Google access token');\n return {};\n }\n return {};\n }\n\n private async getDependency(\n packageName: string,\n hostUrl: string,\n ): Promise<ReleaseResult | null> {\n const lookupUrl = url.resolve(\n hostUrl,\n `${normalizePythonDepName(packageName)}/json`,\n );\n const dependency: ReleaseResult = { releases: [] };\n logger.trace({ lookupUrl }, 'Pypi api got lookup');\n const headers = await this.getAuthHeaders(lookupUrl);\n const rep = await this.http.getJsonUnchecked<PypiJSON>(lookupUrl, {\n headers,\n });\n const dep = rep?.body;\n if (!dep) {\n logger.trace({ dependency: packageName }, 'pip package not found');\n return null;\n }\n if (rep.authorization) {\n dependency.isPrivate = true;\n }\n logger.trace({ lookupUrl }, 'Got pypi api result');\n\n if (dep.info?.home_page) {\n dependency.homepage = dep.info.home_page;\n if (isGitHubRepo(dep.info.home_page)) {\n dependency.sourceUrl = dep.info.home_page.replace(\n 'http://',\n 'https://',\n );\n }\n }\n\n if (dep.info?.project_urls) {\n for (const [name, projectUrl] of Object.entries(dep.info.project_urls)) {\n const lower = name.toLowerCase();\n\n if (\n !dependency.sourceUrl &&\n (lower.startsWith('repo') ||\n lower === 'code' ||\n lower === 'source' ||\n isGitHubRepo(projectUrl))\n ) {\n dependency.sourceUrl = projectUrl;\n }\n\n if (\n !dependency.changelogUrl &&\n ([\n 'changelog',\n 'change log',\n 'changes',\n 'release notes',\n 'news',\n \"what's new\",\n ].includes(lower) ||\n changelogFilenameRegex.exec(lower))\n ) {\n // from https://github.com/pypa/warehouse/blob/418c7511dc367fb410c71be139545d0134ccb0df/warehouse/templates/packaging/detail.html#L24\n dependency.changelogUrl = projectUrl;\n }\n }\n }\n\n if (dep.releases) {\n const versions = Object.keys(dep.releases);\n dependency.releases = versions.map((version) => {\n const releases = coerceArray(dep.releases?.[version]);\n const { upload_time: releaseTimestamp } = releases[0] || {};\n const isDeprecated = releases.some(({ yanked }) => yanked);\n const result: Release = {\n version,\n releaseTimestamp: asTimestamp(releaseTimestamp),\n };\n if (isDeprecated) {\n result.isDeprecated = isDeprecated;\n }\n // There may be multiple releases with different requires_python, so we return all in an array\n const pythonConstraints = releases\n .map(({ requires_python }) => requires_python)\n .filter(is.string);\n result.constraints = {\n python: Array.from(new Set(pythonConstraints)),\n };\n return result;\n });\n }\n return dependency;\n }\n\n private static extractVersionFromLinkText(\n text: string,\n packageName: string,\n ): string | null {\n // source packages\n const lcText = text.toLowerCase();\n const normalizedSrcText = normalizePythonDepName(text);\n const srcPrefix = `${packageName}-`;\n\n // source distribution format: `{name}-{version}.tar.gz` (https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-file-name)\n // binary distribution: `{distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl` (https://packaging.python.org/en/latest/specifications/binary-distribution-format/#file-name-convention)\n // officially both `name` and `distribution` should be normalized and then the - replaced with _, but in reality this is not the case\n // We therefore normalize the name we have (replacing `_-.` with -) and then check if the text starts with the normalized name\n\n if (!normalizedSrcText.startsWith(srcPrefix)) {\n return null;\n }\n\n // strip off the prefix using the prefix length as we may have normalized the srcPrefix/packageName\n // We assume that neither the version nor the suffix contains multiple `-` like `0.1.2---rc1.tar.gz`\n // and use the difference in length to strip off the prefix in case the name contains double `--` characters\n const normalizedLengthDiff = lcText.length - normalizedSrcText.length;\n const res = lcText.slice(srcPrefix.length + normalizedLengthDiff);\n\n // source distribution\n const srcSuffixes = ['.tar.gz', '.tar.bz2', '.tar.xz', '.zip', '.tgz'];\n const srcSuffix = srcSuffixes.find((suffix) => lcText.endsWith(suffix));\n if (srcSuffix) {\n // strip off the suffix using character length\n return res.slice(0, -srcSuffix.length);\n }\n\n // binary distribution\n // for binary distributions the version is the first part after the removed distribution name\n const wheelSuffix = '.whl';\n if (lcText.endsWith(wheelSuffix) && lcText.split('-').length > 2) {\n return res.split('-')[0];\n }\n return null;\n }\n\n private static cleanSimpleHtml(html: string): string {\n return (\n html\n .replace(regEx(/<\\/?pre>/), '')\n // Certain simple repositories like artifactory don't escape > and <\n .replace(\n regEx(/data-requires-python=\"([^\"]*?)>([^\"]*?)\"/g),\n 'data-requires-python=\"$1>$2\"',\n )\n .replace(\n regEx(/data-requires-python=\"([^\"]*?)<([^\"]*?)\"/g),\n 'data-requires-python=\"$1<$2\"',\n )\n );\n }\n\n private async getSimpleDependency(\n packageName: string,\n hostUrl: string,\n ): Promise<ReleaseResult | null> {\n const lookupUrl = url.resolve(\n hostUrl,\n ensureTrailingSlash(normalizePythonDepName(packageName)),\n );\n const dependency: ReleaseResult = { releases: [] };\n const headers = await this.getAuthHeaders(lookupUrl);\n const response = await this.http.getText(lookupUrl, { headers });\n const dep = response?.body;\n if (!dep) {\n logger.trace({ dependency: packageName }, 'pip package not found');\n return null;\n }\n if (response.authorization) {\n dependency.isPrivate = true;\n }\n const root = parse(PypiDatasource.cleanSimpleHtml(dep));\n const links = root.querySelectorAll('a');\n const releases: Releases = {};\n for (const link of Array.from(links)) {\n const version = PypiDatasource.extractVersionFromLinkText(\n link.text?.trim(),\n packageName,\n );\n if (version) {\n const release: PypiJSONRelease = {\n yanked: link.hasAttribute('data-yanked'),\n };\n const requiresPython = link.getAttribute('data-requires-python');\n if (requiresPython) {\n release.requires_python = requiresPython;\n }\n if (!releases[version]) {\n releases[version] = [];\n }\n releases[version].push(release);\n }\n }\n const versions = Object.keys(releases);\n dependency.releases = versions.map((version) => {\n const versionReleases = coerceArray(releases[version]);\n const isDeprecated = versionReleases.some(({ yanked }) => yanked);\n const result: Release = { version };\n if (isDeprecated) {\n result.isDeprecated = isDeprecated;\n }\n // There may be multiple releases with different requires_python, so we return all in an array\n result.constraints = {\n // TODO: string[] isn't allowed here\n python: versionReleases.map(\n ({ requires_python }) => requires_python,\n ) as any,\n };\n return result;\n });\n return dependency;\n }\n}\n"]}
|
|
@@ -125,6 +125,7 @@ export declare const PackageJson: z.ZodPipeline<z.ZodEffects<z.ZodString, string
|
|
|
125
125
|
}, string>>;
|
|
126
126
|
volta: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodAny>, Record<string, string>, Record<string, any>>>;
|
|
127
127
|
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
engines?: Record<string, string> | undefined;
|
|
128
129
|
dependencies?: Record<string, string> | undefined;
|
|
129
130
|
devDependencies?: Record<string, string> | undefined;
|
|
130
131
|
peerDependencies?: Record<string, string> | undefined;
|
|
@@ -141,9 +142,9 @@ export declare const PackageJson: z.ZodPipeline<z.ZodEffects<z.ZodString, string
|
|
|
141
142
|
version?: string | undefined;
|
|
142
143
|
}[] | undefined;
|
|
143
144
|
} | undefined;
|
|
144
|
-
engines?: Record<string, string> | undefined;
|
|
145
145
|
volta?: Record<string, string> | undefined;
|
|
146
146
|
}, {
|
|
147
|
+
engines?: Record<string, any> | undefined;
|
|
147
148
|
dependencies?: Record<string, any> | undefined;
|
|
148
149
|
devDependencies?: Record<string, any> | undefined;
|
|
149
150
|
peerDependencies?: Record<string, any> | undefined;
|
|
@@ -157,7 +158,6 @@ export declare const PackageJson: z.ZodPipeline<z.ZodEffects<z.ZodString, string
|
|
|
157
158
|
version?: string | undefined;
|
|
158
159
|
}[] | undefined;
|
|
159
160
|
} | undefined;
|
|
160
|
-
engines?: Record<string, any> | undefined;
|
|
161
161
|
volta?: Record<string, any> | undefined;
|
|
162
162
|
}>>;
|
|
163
163
|
export type PackageJson = z.infer<typeof PackageJson>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "renovate",
|
|
3
3
|
"description": "Automated dependency updates. Flexible so you don't need to be.",
|
|
4
|
-
"version": "41.155.
|
|
4
|
+
"version": "41.155.2",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"renovate": "dist/renovate.js",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"diff": "8.0.2",
|
|
146
146
|
"editorconfig": "3.0.1",
|
|
147
147
|
"email-addresses": "5.0.0",
|
|
148
|
-
"emoji-regex": "10.
|
|
148
|
+
"emoji-regex": "10.6.0",
|
|
149
149
|
"emojibase": "16.0.0",
|
|
150
150
|
"emojibase-regex": "16.0.0",
|
|
151
151
|
"extract-zip": "2.0.1",
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"prettier": "3.6.2",
|
|
187
187
|
"protobufjs": "7.5.4",
|
|
188
188
|
"punycode": "2.3.1",
|
|
189
|
-
"redis": "
|
|
189
|
+
"redis": "5.8.3",
|
|
190
190
|
"remark": "15.0.1",
|
|
191
191
|
"remark-gfm": "4.0.1",
|
|
192
192
|
"remark-github": "12.0.0",
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
"test-e2e:pack": "pnpm pack",
|
|
349
349
|
"test-e2e:install": "cd test/e2e && pnpm --ignore-workspace install --no-lockfile --prod",
|
|
350
350
|
"test-e2e:run": "cd test/e2e && pnpm test",
|
|
351
|
-
"test-schema": "run-s create-json-schema",
|
|
351
|
+
"test-schema": "run-s create-json-schema && tsx tools/validate-schema.ts",
|
|
352
352
|
"test:docs": "node --test tools/docs/test/**/*.mjs",
|
|
353
353
|
"schedule-test-shards": "SCHEDULE_TEST_SHARDS=true tsx tools/test-shards.ts",
|
|
354
354
|
"tsc": "tsc",
|
package/renovate-schema.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"title": "JSON schema for Renovate 41.155.
|
|
2
|
+
"title": "JSON schema for Renovate 41.155.2 config files (https://renovatebot.com/)",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
4
|
-
"x-renovate-version": "41.155.
|
|
4
|
+
"x-renovate-version": "41.155.2",
|
|
5
5
|
"allowComments": true,
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|