renovate 44.93.8 → 44.94.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/config/decrypt.js +3 -1
- package/dist/config/decrypt.js.map +1 -1
- package/dist/config/presets/internal/workarounds.preset.js +2 -2
- package/dist/config/presets/internal/workarounds.preset.js.map +1 -1
- package/dist/modules/datasource/azure-bicep-resource/index.js +4 -2
- package/dist/modules/datasource/azure-bicep-resource/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/docker/common.js +3 -1
- package/dist/modules/datasource/docker/common.js.map +1 -1
- package/dist/modules/datasource/elm-package/index.js +2 -1
- package/dist/modules/datasource/elm-package/index.js.map +1 -1
- package/dist/modules/datasource/index.js +1 -1
- package/dist/modules/datasource/index.js.map +1 -1
- package/dist/modules/datasource/java-version/index.js +1 -0
- package/dist/modules/datasource/java-version/index.js.map +1 -1
- package/dist/modules/datasource/npm/npmrc.js +1 -1
- package/dist/modules/datasource/npm/npmrc.js.map +1 -1
- package/dist/modules/datasource/ruby-version/index.js +1 -0
- package/dist/modules/datasource/ruby-version/index.js.map +1 -1
- package/dist/modules/datasource/typst/index.js +10 -7
- package/dist/modules/datasource/typst/index.js.map +1 -1
- package/dist/modules/manager/apm/artifacts.js +7 -18
- package/dist/modules/manager/apm/artifacts.js.map +1 -1
- package/dist/modules/manager/bun/artifacts.js +3 -10
- package/dist/modules/manager/bun/artifacts.js.map +1 -1
- package/dist/modules/manager/cargo/artifacts.js +4 -15
- package/dist/modules/manager/cargo/artifacts.js.map +1 -1
- package/dist/modules/manager/cocoapods/artifacts.js +11 -26
- package/dist/modules/manager/cocoapods/artifacts.js.map +1 -1
- package/dist/modules/manager/composer/artifacts.js +8 -19
- package/dist/modules/manager/composer/artifacts.js.map +1 -1
- package/dist/modules/manager/conan/artifacts.js +3 -10
- package/dist/modules/manager/conan/artifacts.js.map +1 -1
- package/dist/modules/manager/copier/artifacts.js +21 -41
- package/dist/modules/manager/copier/artifacts.js.map +1 -1
- package/dist/modules/manager/deno/artifacts.js +5 -18
- package/dist/modules/manager/deno/artifacts.js.map +1 -1
- package/dist/modules/manager/devbox/artifacts.js +3 -10
- package/dist/modules/manager/devbox/artifacts.js.map +1 -1
- package/dist/modules/manager/fingerprint.generated.js +7 -7
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/manager/github-actions/known-actions/crate-dynamic.js +20 -0
- package/dist/modules/manager/github-actions/known-actions/crate-dynamic.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/dart-version.js +13 -0
- package/dist/modules/manager/github-actions/known-actions/dart-version.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/docker-dynamic.js +33 -0
- package/dist/modules/manager/github-actions/known-actions/docker-dynamic.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/docker.js +10 -0
- package/dist/modules/manager/github-actions/known-actions/docker.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/dotnet-version.js +14 -0
- package/dist/modules/manager/github-actions/known-actions/dotnet-version.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/github-release-attachments-dynamic.js +22 -0
- package/dist/modules/manager/github-actions/known-actions/github-release-attachments-dynamic.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/github-releases-dynamic.js +143 -0
- package/dist/modules/manager/github-actions/known-actions/github-releases-dynamic.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/github-releases.js +271 -0
- package/dist/modules/manager/github-actions/known-actions/github-releases.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/gradle-version.js +25 -0
- package/dist/modules/manager/github-actions/known-actions/gradle-version.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/java-version-dynamic.js +51 -0
- package/dist/modules/manager/github-actions/known-actions/java-version-dynamic.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/multiple.js +106 -0
- package/dist/modules/manager/github-actions/known-actions/multiple.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/npm.js +53 -0
- package/dist/modules/manager/github-actions/known-actions/npm.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/pypi.js +27 -0
- package/dist/modules/manager/github-actions/known-actions/pypi.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/ruby-version.js +12 -0
- package/dist/modules/manager/github-actions/known-actions/ruby-version.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/rust-version-dynamic.js +14 -0
- package/dist/modules/manager/github-actions/known-actions/rust-version-dynamic.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/rust-version.js +19 -0
- package/dist/modules/manager/github-actions/known-actions/rust-version.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions/utils.js +93 -0
- package/dist/modules/manager/github-actions/known-actions/utils.js.map +1 -0
- package/dist/modules/manager/github-actions/known-actions.js +33 -728
- package/dist/modules/manager/github-actions/known-actions.js.map +1 -1
- package/dist/modules/manager/github-actions/schema.js +2 -1
- package/dist/modules/manager/github-actions/schema.js.map +1 -1
- package/dist/modules/manager/github-actions/types.js +9 -0
- package/dist/modules/manager/github-actions/types.js.map +1 -0
- package/dist/modules/manager/gleam/artifacts.js +13 -23
- package/dist/modules/manager/gleam/artifacts.js.map +1 -1
- package/dist/modules/manager/gomod/artifacts.js +18 -50
- package/dist/modules/manager/gomod/artifacts.js.map +1 -1
- package/dist/modules/manager/helmfile/artifacts.js +16 -22
- package/dist/modules/manager/helmfile/artifacts.js.map +1 -1
- package/dist/modules/manager/helmv3/artifacts.js +8 -28
- package/dist/modules/manager/helmv3/artifacts.js.map +1 -1
- package/dist/modules/manager/jsonnet-bundler/artifacts.js +4 -22
- package/dist/modules/manager/jsonnet-bundler/artifacts.js.map +1 -1
- package/dist/modules/manager/kustomize/artifacts.js +9 -23
- package/dist/modules/manager/kustomize/artifacts.js.map +1 -1
- package/dist/modules/manager/mise/artifacts.js +13 -22
- package/dist/modules/manager/mise/artifacts.js.map +1 -1
- package/dist/modules/manager/mix/artifacts.js +5 -18
- package/dist/modules/manager/mix/artifacts.js.map +1 -1
- package/dist/modules/manager/nuget/artifacts.js +3 -10
- package/dist/modules/manager/nuget/artifacts.js.map +1 -1
- package/dist/modules/manager/pep621/processors/pdm.js +7 -15
- package/dist/modules/manager/pep621/processors/pdm.js.map +1 -1
- package/dist/modules/manager/pep621/processors/uv.js +7 -15
- package/dist/modules/manager/pep621/processors/uv.js.map +1 -1
- package/dist/modules/manager/pixi/lockfile.js +25 -28
- package/dist/modules/manager/pixi/lockfile.js.map +1 -1
- package/dist/modules/manager/poetry/artifacts.js +41 -46
- package/dist/modules/manager/poetry/artifacts.js.map +1 -1
- package/dist/modules/manager/pub/artifacts.js +13 -16
- package/dist/modules/manager/pub/artifacts.js.map +1 -1
- package/dist/modules/manager/renovate-config/extract.js +3 -1
- package/dist/modules/manager/renovate-config/extract.js.map +1 -1
- package/dist/modules/manager/terragrunt/modules.js +2 -0
- package/dist/modules/manager/terragrunt/modules.js.map +1 -1
- package/dist/modules/manager/types.d.ts +19 -1
- package/dist/modules/manager/util.js +60 -1
- package/dist/modules/manager/util.js.map +1 -1
- package/dist/modules/manager/vendir/artifacts.js +7 -31
- package/dist/modules/manager/vendir/artifacts.js.map +1 -1
- package/dist/modules/versioning/composer/index.js +1 -1
- package/dist/modules/versioning/composer/index.js.map +1 -1
- package/dist/modules/versioning/docker/index.js +1 -1
- package/dist/modules/versioning/docker/index.js.map +1 -1
- package/dist/modules/versioning/gradle/compare.js +4 -4
- package/dist/modules/versioning/gradle/compare.js.map +1 -1
- package/dist/modules/versioning/hermit/index.js +1 -2
- package/dist/modules/versioning/hermit/index.js.map +1 -1
- package/dist/modules/versioning/ivy/index.js +2 -5
- package/dist/modules/versioning/ivy/index.js.map +1 -1
- package/dist/modules/versioning/ivy/parse.js +4 -7
- package/dist/modules/versioning/ivy/parse.js.map +1 -1
- package/dist/modules/versioning/maven/compare.js +7 -10
- package/dist/modules/versioning/maven/compare.js.map +1 -1
- package/dist/modules/versioning/nuget/parser.js +2 -3
- package/dist/modules/versioning/nuget/parser.js.map +1 -1
- package/dist/modules/versioning/nuget/range.js +1 -1
- package/dist/modules/versioning/nuget/range.js.map +1 -1
- package/dist/modules/versioning/pep440/range.js +6 -21
- package/dist/modules/versioning/pep440/range.js.map +1 -1
- package/dist/modules/versioning/rpm/index.js +1 -2
- package/dist/modules/versioning/rpm/index.js.map +1 -1
- package/dist/util/git/file-changes.js +50 -0
- package/dist/util/git/file-changes.js.map +1 -0
- package/dist/util/template/index.js +1 -0
- package/dist/util/template/index.js.map +1 -1
- package/dist/workers/global/config/parse/additional-config-file.js +1 -1
- package/dist/workers/global/config/parse/additional-config-file.js.map +1 -1
- package/dist/workers/global/limits.js +0 -1
- package/dist/workers/global/limits.js.map +1 -1
- package/dist/workers/repository/onboarding/branch/index.js +4 -2
- package/dist/workers/repository/onboarding/branch/index.js.map +1 -1
- package/dist/workers/repository/onboarding/branch/rebase.js +2 -1
- package/dist/workers/repository/onboarding/branch/rebase.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/forgejo/index.js +1 -3
- package/dist/workers/repository/update/pr/changelog/forgejo/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/gitea/index.js +1 -3
- package/dist/workers/repository/update/pr/changelog/gitea/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/gitlab/index.js +1 -3
- package/dist/workers/repository/update/pr/changelog/gitlab/index.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
|
@@ -109,7 +109,7 @@ function setNpmrc(input) {
|
|
|
109
109
|
const npmrcRules = convertNpmrcToRules(npmrc);
|
|
110
110
|
if (npmrcRules.hostRules?.length) npmrcRules.hostRules.forEach((hostRule) => add(hostRule));
|
|
111
111
|
packageRules = npmrcRules.packageRules;
|
|
112
|
-
} else
|
|
112
|
+
} else {
|
|
113
113
|
logger.debug("Resetting npmrc");
|
|
114
114
|
npmrc = {};
|
|
115
115
|
npmrcRaw = "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npmrc.js","names":["hostRules.add"],"sources":["../../../../lib/modules/datasource/npm/npmrc.ts"],"sourcesContent":["import { isNonEmptyString, isString } from '@sindresorhus/is';\nimport ini from 'ini';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport type { PackageRule } from '../../../config/types.ts';\nimport { logger } from '../../../logger/index.ts';\nimport type { HostRule } from '../../../types/index.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { fromBase64 } from '../../../util/string.ts';\nimport { ensureTrailingSlash, isHttpUrl } from '../../../util/url.ts';\nimport { defaultRegistryUrl } from './common.ts';\nimport type { NpmrcRules } from './types.ts';\n\nlet npmrc: Record<string, any> = {};\nlet npmrcRaw = '';\nlet packageRules: PackageRule[] = [];\n\nfunction envReplace(value: any, env = getEnv()): any {\n /* v8 ignore next -- TODO: add test */\n if (!isString(value)) {\n return value;\n }\n\n const ENV_EXPR = regEx(/(?<esc>\\\\*)\\$\\{(?<envVarName>[^}]+)\\}/g);\n\n return value.replace(ENV_EXPR, (match, _esc, envVarName) => {\n if (env[envVarName] === undefined) {\n logger.warn({ match }, 'Failed to replace env in config');\n throw new Error('env-replace');\n }\n return env[envVarName];\n });\n}\n\nexport function getMatchHostFromNpmrcHost(input: string): string {\n if (input.startsWith('//')) {\n const matchHost = input.replace('//', '');\n if (matchHost.includes('/')) {\n return `https://${matchHost}`;\n }\n return matchHost;\n }\n return input;\n}\n\nexport function convertNpmrcToRules(npmrc: Record<string, any>): NpmrcRules {\n const rules: NpmrcRules = {\n hostRules: [],\n packageRules: [],\n };\n // Generate hostRules\n const hostType = 'npm';\n const hosts: Record<string, HostRule> = {};\n for (const [key, value] of Object.entries(npmrc)) {\n if (!isNonEmptyString(value)) {\n continue;\n }\n const keyParts = key.split(':');\n const keyType = keyParts.pop();\n let matchHost = '';\n if (keyParts.length) {\n matchHost = getMatchHostFromNpmrcHost(keyParts.join(':'));\n }\n const rule: HostRule = hosts[matchHost] || {};\n if (keyType === '_authToken' || keyType === '_auth') {\n rule.token = value;\n if (keyType === '_auth') {\n rule.authType = 'Basic';\n }\n } else if (keyType === 'username') {\n rule.username = value;\n } else if (keyType === '_password') {\n rule.password = fromBase64(value);\n } else {\n continue; // don't add the rule\n }\n hosts[matchHost] = rule;\n }\n for (const [matchHost, rule] of Object.entries(hosts)) {\n const hostRule = { ...rule, hostType };\n if (matchHost) {\n hostRule.matchHost = matchHost;\n }\n rules.hostRules?.push(hostRule);\n }\n // Generate packageRules\n const matchDatasources = ['npm'];\n const { registry } = npmrc;\n // packageRules order matters, so look for a default registry first\n if (isNonEmptyString(registry)) {\n if (isHttpUrl(registry)) {\n // Default registry\n rules.packageRules?.push({\n matchDatasources,\n registryUrls: [registry],\n });\n } else {\n logger.warn({ registry }, 'Invalid npmrc registry= URL');\n }\n }\n // Now look for scoped registries\n for (const [key, value] of Object.entries(npmrc)) {\n if (!isNonEmptyString(value)) {\n continue;\n }\n const keyParts = key.split(':');\n const keyType = keyParts.pop();\n if (keyType === 'registry' && keyParts.length && isNonEmptyString(value)) {\n const scope = keyParts.join(':');\n if (isHttpUrl(value)) {\n rules.packageRules?.push({\n matchDatasources,\n matchPackageNames: [`${scope}/**`],\n registryUrls: [value],\n });\n } else {\n logger.warn({ scope, registry: value }, 'Invalid npmrc registry= URL');\n }\n }\n }\n return rules;\n}\n\nexport function setNpmrc(input?: string): void {\n if (input) {\n if (input === npmrcRaw) {\n return;\n }\n const existingNpmrc = npmrc;\n npmrcRaw = input;\n logger.debug('Setting npmrc');\n npmrc = ini.parse(input.replace(regEx(/\\\\n/g), '\\n'));\n const exposeAllEnv = GlobalConfig.get('exposeAllEnv');\n for (const [key, val] of Object.entries(npmrc)) {\n if (\n !exposeAllEnv &&\n key.endsWith('registry') &&\n isString(val) &&\n val.includes('localhost')\n ) {\n logger.debug(\n { key, val },\n 'Detected localhost registry - rejecting npmrc file',\n );\n npmrc = existingNpmrc;\n return;\n }\n }\n if (exposeAllEnv) {\n for (const key of Object.keys(npmrc)) {\n npmrc[key] = envReplace(npmrc[key]);\n }\n }\n const npmrcRules = convertNpmrcToRules(npmrc);\n if (npmrcRules.hostRules?.length) {\n npmrcRules.hostRules.forEach((hostRule) => hostRules.add(hostRule));\n }\n packageRules = npmrcRules.packageRules;\n //
|
|
1
|
+
{"version":3,"file":"npmrc.js","names":["hostRules.add"],"sources":["../../../../lib/modules/datasource/npm/npmrc.ts"],"sourcesContent":["import { isNonEmptyString, isString } from '@sindresorhus/is';\nimport ini from 'ini';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport type { PackageRule } from '../../../config/types.ts';\nimport { logger } from '../../../logger/index.ts';\nimport type { HostRule } from '../../../types/index.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { fromBase64 } from '../../../util/string.ts';\nimport { ensureTrailingSlash, isHttpUrl } from '../../../util/url.ts';\nimport { defaultRegistryUrl } from './common.ts';\nimport type { NpmrcRules } from './types.ts';\n\nlet npmrc: Record<string, any> = {};\nlet npmrcRaw = '';\nlet packageRules: PackageRule[] = [];\n\nfunction envReplace(value: any, env = getEnv()): any {\n /* v8 ignore next -- TODO: add test */\n if (!isString(value)) {\n return value;\n }\n\n const ENV_EXPR = regEx(/(?<esc>\\\\*)\\$\\{(?<envVarName>[^}]+)\\}/g);\n\n return value.replace(ENV_EXPR, (match, _esc, envVarName) => {\n if (env[envVarName] === undefined) {\n logger.warn({ match }, 'Failed to replace env in config');\n throw new Error('env-replace');\n }\n return env[envVarName];\n });\n}\n\nexport function getMatchHostFromNpmrcHost(input: string): string {\n if (input.startsWith('//')) {\n const matchHost = input.replace('//', '');\n if (matchHost.includes('/')) {\n return `https://${matchHost}`;\n }\n return matchHost;\n }\n return input;\n}\n\nexport function convertNpmrcToRules(npmrc: Record<string, any>): NpmrcRules {\n const rules: NpmrcRules = {\n hostRules: [],\n packageRules: [],\n };\n // Generate hostRules\n const hostType = 'npm';\n const hosts: Record<string, HostRule> = {};\n for (const [key, value] of Object.entries(npmrc)) {\n if (!isNonEmptyString(value)) {\n continue;\n }\n const keyParts = key.split(':');\n const keyType = keyParts.pop();\n let matchHost = '';\n if (keyParts.length) {\n matchHost = getMatchHostFromNpmrcHost(keyParts.join(':'));\n }\n const rule: HostRule = hosts[matchHost] || {};\n if (keyType === '_authToken' || keyType === '_auth') {\n rule.token = value;\n if (keyType === '_auth') {\n rule.authType = 'Basic';\n }\n } else if (keyType === 'username') {\n rule.username = value;\n } else if (keyType === '_password') {\n rule.password = fromBase64(value);\n } else {\n continue; // don't add the rule\n }\n hosts[matchHost] = rule;\n }\n for (const [matchHost, rule] of Object.entries(hosts)) {\n const hostRule = { ...rule, hostType };\n if (matchHost) {\n hostRule.matchHost = matchHost;\n }\n rules.hostRules?.push(hostRule);\n }\n // Generate packageRules\n const matchDatasources = ['npm'];\n const { registry } = npmrc;\n // packageRules order matters, so look for a default registry first\n if (isNonEmptyString(registry)) {\n if (isHttpUrl(registry)) {\n // Default registry\n rules.packageRules?.push({\n matchDatasources,\n registryUrls: [registry],\n });\n } else {\n logger.warn({ registry }, 'Invalid npmrc registry= URL');\n }\n }\n // Now look for scoped registries\n for (const [key, value] of Object.entries(npmrc)) {\n if (!isNonEmptyString(value)) {\n continue;\n }\n const keyParts = key.split(':');\n const keyType = keyParts.pop();\n if (keyType === 'registry' && keyParts.length && isNonEmptyString(value)) {\n const scope = keyParts.join(':');\n if (isHttpUrl(value)) {\n rules.packageRules?.push({\n matchDatasources,\n matchPackageNames: [`${scope}/**`],\n registryUrls: [value],\n });\n } else {\n logger.warn({ scope, registry: value }, 'Invalid npmrc registry= URL');\n }\n }\n }\n return rules;\n}\n\nexport function setNpmrc(input?: string): void {\n if (input) {\n if (input === npmrcRaw) {\n return;\n }\n const existingNpmrc = npmrc;\n npmrcRaw = input;\n logger.debug('Setting npmrc');\n npmrc = ini.parse(input.replace(regEx(/\\\\n/g), '\\n'));\n const exposeAllEnv = GlobalConfig.get('exposeAllEnv');\n for (const [key, val] of Object.entries(npmrc)) {\n if (\n !exposeAllEnv &&\n key.endsWith('registry') &&\n isString(val) &&\n val.includes('localhost')\n ) {\n logger.debug(\n { key, val },\n 'Detected localhost registry - rejecting npmrc file',\n );\n npmrc = existingNpmrc;\n return;\n }\n }\n if (exposeAllEnv) {\n for (const key of Object.keys(npmrc)) {\n npmrc[key] = envReplace(npmrc[key]);\n }\n }\n const npmrcRules = convertNpmrcToRules(npmrc);\n if (npmrcRules.hostRules?.length) {\n npmrcRules.hostRules.forEach((hostRule) => hostRules.add(hostRule));\n }\n packageRules = npmrcRules.packageRules;\n } else {\n // `npmrc` starts as an object and is only ever reassigned to one, so it is\n // always truthy here\n logger.debug('Resetting npmrc');\n npmrc = {};\n npmrcRaw = '';\n packageRules = [];\n }\n}\n\nexport function resolveRegistryUrl(packageName: string): string {\n let registryUrl = defaultRegistryUrl;\n for (const rule of packageRules) {\n const { matchPackageNames, registryUrls } = rule;\n if (\n !matchPackageNames ||\n packageName.startsWith(matchPackageNames[0].replace(regEx(/\\*\\*$/), ''))\n ) {\n // TODO: fix types #22198\n registryUrl = registryUrls![0];\n }\n }\n return registryUrl;\n}\n\nexport function resolvePackageUrl(\n registryUrl: string,\n packageName: string,\n): string {\n return new URL(\n encodeURIComponent(packageName).replace(regEx(/^%40/), '@'),\n ensureTrailingSlash(registryUrl),\n ).href;\n}\n"],"mappings":";;;;;;;;;;;AAcA,IAAI,QAA6B,CAAC;AAClC,IAAI,WAAW;AACf,IAAI,eAA8B,CAAC;AAEnC,SAAS,WAAW,OAAY,MAAM,OAAO,GAAQ;;CAEnD,IAAI,CAAC,SAAS,KAAK,GACjB,OAAO;CAGT,MAAM,WAAW,MAAM,wCAAwC;CAE/D,OAAO,MAAM,QAAQ,WAAW,OAAO,MAAM,eAAe;EAC1D,IAAI,I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AC;EAEpE,eAAe,WAAW;CAC5B,OAAO;EAGL,OAAO,MAAM,iBAAiB;EAC9B,QAAQ,CAAC;EACT,WAAW;EACX,eAAe,CAAC;CAClB;AACF;AAEA,SAAgB,mBAAmB,aAA6B;CAC9D,IAAI,cAAc;CAClB,KAAK,MAAM,QAAQ,cAAc;EAC/B,MAAM,EAAE,mBAAmB,iBAAiB;EAC5C,IACE,CAAC,qBACD,YAAY,WAAW,kBAAkB,EAAE,CAAC,QAAQ,MAAM,OAAO,GAAG,EAAE,CAAC,GAGvE,cAAc,aAAc;CAEhC;CACA,OAAO;AACT;AAEA,SAAgB,kBACd,aACA,aACQ;CACR,OAAO,IAAI,IACT,mBAAmB,WAAW,CAAC,CAAC,QAAQ,MAAM,MAAM,GAAG,GAAG,GAC1D,oBAAoB,WAAW,CACjC,CAAC,CAAC;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["rubyVersioningId"],"sources":["../../../../lib/modules/datasource/ruby-version/index.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { parse } from '../../../util/html.ts';\nimport type { HttpError } from '../../../util/http/index.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport {\n isVersion,\n id as rubyVersioningId,\n} from '../../versioning/ruby/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, ReleaseResult } from '../types.ts';\n\nexport class RubyVersionDatasource extends Datasource {\n static readonly id = 'ruby-version';\n\n constructor() {\n super(RubyVersionDatasource.id);\n }\n\n override readonly defaultRegistryUrls = ['https://www.ruby-lang.org/'];\n\n override readonly customRegistrySupport = false;\n\n override readonly defaultVersioning = rubyVersioningId;\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The release timestamp is determined from the `release-list` table in the results.';\n override readonly sourceUrlSupport = 'package';\n override readonly sourceUrlNote =\n 'We use the URL: https://github.com/ruby/ruby.';\n\n private async _getReleases({\n registryUrl,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n const res: ReleaseResult = {\n homepage: 'https://www.ruby-lang.org',\n sourceUrl: 'https://github.com/ruby/ruby',\n releases: [],\n };\n // TODO: types (#22198)\n const rubyVersionsUrl = `${registryUrl}en/downloads/releases/`;\n try {\n const response = await this.http.getText(rubyVersionsUrl);\n\n const root = parse(response.body);\n const rows = coerceArray(\n root.querySelector('.release-list')?.querySelectorAll('tr'),\n );\n rows.forEach((row) => {\n const tds = row.querySelectorAll('td');\n const columns: string[] = [];\n tds.forEach((td) => columns.push(td.innerHTML));\n if (columns.length) {\n const version = columns[0].replace('Ruby ', '');\n if (isVersion(version)) {\n const releaseTimestamp = asTimestamp(columns[1]);\n const changelogUrl = columns[2]\n .replace('<a href=\"', 'https://www.ruby-lang.org')\n .replace('\">more...</a>', '');\n res.releases.push({ version, releaseTimestamp, changelogUrl });\n }\n }\n });\n if (!res.releases.length) {\n logger.warn({ registryUrl }, 'Missing ruby releases');\n return null;\n }\n } catch (err) {\n this.handleGenericErrors(err);\n }\n\n return res;\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n return withCache(\n {\n namespace: `datasource-${RubyVersionDatasource.id}`,\n key: 'all',\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n\n override handleHttpErrors(err: HttpError): never | void {\n throw new ExternalHostError(err);\n }\n}\n"],"mappings":";;;;;;;;;AAcA,IAAa,wBAAb,MAAa,8BAA8B,WAAW;CACpD,OAAgB,KAAK;CAErB,cAAc;EACZ,MAAM,sBAAsB,EAAE;CAChC;CAEA,sBAAwC,CAAC,4BAA4B;CAErE,wBAA0C;CAE1C,oBAAsCA;CAEtC,0BAA4C;CAC5C,uBACE;CACF,mBAAqC;CACrC,gBACE;CAEF,MAAc,aAAa,EACzB,eACmD;EACnD,MAAM,MAAqB;GACzB,UAAU;GACV,WAAW;GACX,UAAU,CAAC;EACb;EAEA,MAAM,kBAAkB,GAAG,YAAY;EACvC,IAAI;GACF,MAAM,WAAW,MAAM,KAAK,KAAK,QAAQ,eAAe;GAExD,MAAM,OAAO,MAAM,SAAS,IAAI;GAIhC,YAFE,KAAK,cAAc,eAAe,CAAC,EAAE,iBAAiB,IAAI,CAEzD,CAAC,CAAC,SAAS,QAAQ;IACpB,MAAM,MAAM,IAAI,iBAAiB,IAAI;IACrC,MAAM,UAAoB,CAAC;IAC3B,IAAI,SAAS,OAAO,QAAQ,KAAK,GAAG,SAAS,CAAC;IAC9C,IAAI,QAAQ,QAAQ;KAClB,MAAM,UAAU,QAAQ,EAAE,CAAC,QAAQ,SAAS,EAAE;KAC9C,IAAI,UAAU,OAAO,GAAG;MACtB,MAAM,mBAAmB,YAAY,QAAQ,EAAE;MAC/C,MAAM,eAAe,QAAQ,EAAE,CAC5B,QAAQ,cAAa,2BAA2B,CAAC,CACjD,QAAQ,kBAAiB,EAAE;MAC9B,IAAI,SAAS,KAAK;OAAE;OAAS;OAAkB;MAAa,CAAC;KAC/D;IACF;GACF,CAAC;GACD,IAAI,CAAC,IAAI,SAAS,QAAQ;IACxB,OAAO,KAAK,EAAE,YAAY,GAAG,uBAAuB;IACpD,OAAO;GACT;EACF,SAAS,KAAK;GACZ,KAAK,oBAAoB,GAAG;EAC9B;EAEA,OAAO;CACT;CAEA,YAAY,QAA0D;EACpE,OAAO,UACL;GACE,WAAW,cAAc,sBAAsB;GAC/C,KAAK;GACL,UAAU;EACZ,SACM,KAAK,aAAa,MAAM,CAChC;CACF;CAEA,iBAA0B,KAA8B;EACtD,MAAM,IAAI,kBAAkB,GAAG;CACjC;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["rubyVersioningId"],"sources":["../../../../lib/modules/datasource/ruby-version/index.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { parse } from '../../../util/html.ts';\nimport type { HttpError } from '../../../util/http/index.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport {\n isVersion,\n id as rubyVersioningId,\n} from '../../versioning/ruby/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, ReleaseResult } from '../types.ts';\n\nexport class RubyVersionDatasource extends Datasource {\n static readonly id = 'ruby-version';\n\n constructor() {\n super(RubyVersionDatasource.id);\n }\n\n override readonly defaultRegistryUrls = ['https://www.ruby-lang.org/'];\n\n override readonly customRegistrySupport = false;\n\n override readonly defaultVersioning = rubyVersioningId;\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The release timestamp is determined from the `release-list` table in the results.';\n override readonly sourceUrlSupport = 'package';\n override readonly sourceUrlNote =\n 'We use the URL: https://github.com/ruby/ruby.';\n\n private async _getReleases({\n registryUrl,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n const res: ReleaseResult = {\n homepage: 'https://www.ruby-lang.org',\n sourceUrl: 'https://github.com/ruby/ruby',\n releases: [],\n };\n // TODO: types (#22198)\n const rubyVersionsUrl = `${registryUrl}en/downloads/releases/`;\n try {\n const response = await this.http.getText(rubyVersionsUrl);\n\n const root = parse(response.body);\n const rows = coerceArray(\n root.querySelector('.release-list')?.querySelectorAll('tr'),\n );\n rows.forEach((row) => {\n const tds = row.querySelectorAll('td');\n const columns: string[] = [];\n tds.forEach((td) => columns.push(td.innerHTML));\n if (columns.length) {\n const version = columns[0].replace('Ruby ', '');\n if (isVersion(version)) {\n const releaseTimestamp = asTimestamp(columns[1]);\n const changelogUrl = columns[2]\n .replace('<a href=\"', 'https://www.ruby-lang.org')\n .replace('\">more...</a>', '');\n res.releases.push({ version, releaseTimestamp, changelogUrl });\n }\n }\n });\n if (!res.releases.length) {\n logger.warn({ registryUrl }, 'Missing ruby releases');\n return null;\n }\n } catch (err) {\n this.handleGenericErrors(err);\n }\n\n return res;\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n return withCache(\n {\n namespace: `datasource-${RubyVersionDatasource.id}`,\n key: 'all',\n cacheable: true,\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n\n override handleHttpErrors(err: HttpError): never | void {\n throw new ExternalHostError(err);\n }\n}\n"],"mappings":";;;;;;;;;AAcA,IAAa,wBAAb,MAAa,8BAA8B,WAAW;CACpD,OAAgB,KAAK;CAErB,cAAc;EACZ,MAAM,sBAAsB,EAAE;CAChC;CAEA,sBAAwC,CAAC,4BAA4B;CAErE,wBAA0C;CAE1C,oBAAsCA;CAEtC,0BAA4C;CAC5C,uBACE;CACF,mBAAqC;CACrC,gBACE;CAEF,MAAc,aAAa,EACzB,eACmD;EACnD,MAAM,MAAqB;GACzB,UAAU;GACV,WAAW;GACX,UAAU,CAAC;EACb;EAEA,MAAM,kBAAkB,GAAG,YAAY;EACvC,IAAI;GACF,MAAM,WAAW,MAAM,KAAK,KAAK,QAAQ,eAAe;GAExD,MAAM,OAAO,MAAM,SAAS,IAAI;GAIhC,YAFE,KAAK,cAAc,eAAe,CAAC,EAAE,iBAAiB,IAAI,CAEzD,CAAC,CAAC,SAAS,QAAQ;IACpB,MAAM,MAAM,IAAI,iBAAiB,IAAI;IACrC,MAAM,UAAoB,CAAC;IAC3B,IAAI,SAAS,OAAO,QAAQ,KAAK,GAAG,SAAS,CAAC;IAC9C,IAAI,QAAQ,QAAQ;KAClB,MAAM,UAAU,QAAQ,EAAE,CAAC,QAAQ,SAAS,EAAE;KAC9C,IAAI,UAAU,OAAO,GAAG;MACtB,MAAM,mBAAmB,YAAY,QAAQ,EAAE;MAC/C,MAAM,eAAe,QAAQ,EAAE,CAC5B,QAAQ,cAAa,2BAA2B,CAAC,CACjD,QAAQ,kBAAiB,EAAE;MAC9B,IAAI,SAAS,KAAK;OAAE;OAAS;OAAkB;MAAa,CAAC;KAC/D;IACF;GACF,CAAC;GACD,IAAI,CAAC,IAAI,SAAS,QAAQ;IACxB,OAAO,KAAK,EAAE,YAAY,GAAG,uBAAuB;IACpD,OAAO;GACT;EACF,SAAS,KAAK;GACZ,KAAK,oBAAoB,GAAG;EAC9B;EAEA,OAAO;CACT;CAEA,YAAY,QAA0D;EACpE,OAAO,UACL;GACE,WAAW,cAAc,sBAAsB;GAC/C,KAAK;GACL,WAAW;GACX,UAAU;EACZ,SACM,KAAK,aAAa,MAAM,CAChC;CACF;CAEA,iBAA0B,KAA8B;EACtD,MAAM,IAAI,kBAAkB,GAAG;CACjC;AACF"}
|
|
@@ -7,17 +7,14 @@ import { Registry } from "./schema.js";
|
|
|
7
7
|
//#region lib/modules/datasource/typst/index.ts
|
|
8
8
|
var TypstDatasource = class TypstDatasource extends Datasource {
|
|
9
9
|
static id = "typst";
|
|
10
|
+
customRegistrySupport = false;
|
|
10
11
|
defaultRegistryUrls = ["https://packages.typst.org/preview/index.json"];
|
|
11
12
|
defaultVersioning = id;
|
|
12
13
|
constructor() {
|
|
13
14
|
super(TypstDatasource.id);
|
|
14
15
|
}
|
|
15
16
|
async _getReleases({ packageName }) {
|
|
16
|
-
const [
|
|
17
|
-
if (namespace !== "preview") {
|
|
18
|
-
logger.debug(`Unsupported namespace for @${packageName}`);
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
17
|
+
const [, pkg] = packageName.split("/");
|
|
21
18
|
const [registryUrl] = this.defaultRegistryUrls;
|
|
22
19
|
const cacheProvider = new PackageHttpCacheProvider({
|
|
23
20
|
namespace: "datasource-typst:cache-provider",
|
|
@@ -30,11 +27,17 @@ var TypstDatasource = class TypstDatasource extends Datasource {
|
|
|
30
27
|
result.registryUrl = registryUrl;
|
|
31
28
|
return result;
|
|
32
29
|
}
|
|
33
|
-
getReleases(config) {
|
|
30
|
+
async getReleases(config) {
|
|
31
|
+
const [namespace] = config.packageName.split("/");
|
|
32
|
+
if (namespace !== "preview") {
|
|
33
|
+
logger.debug(`Unsupported namespace for @${config.packageName}`);
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
34
36
|
return withCache({
|
|
35
37
|
namespace: `datasource-${TypstDatasource.id}:registry-releases`,
|
|
36
38
|
key: config.packageName,
|
|
37
|
-
fallback: true
|
|
39
|
+
fallback: true,
|
|
40
|
+
cacheable: true
|
|
38
41
|
}, () => this._getReleases(config));
|
|
39
42
|
}
|
|
40
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["semver"],"sources":["../../../../lib/modules/datasource/typst/index.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { PackageHttpCacheProvider } from '../../../util/http/cache/package-http-cache-provider.ts';\nimport { id as semver } from '../../versioning/semver-coerced/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, ReleaseResult } from '../types.ts';\nimport { Registry } from './schema.ts';\n\nexport class TypstDatasource extends Datasource {\n static readonly id = 'typst';\n\n override readonly defaultRegistryUrls = [\n 'https://packages.typst.org/preview/index.json',\n ];\n\n override defaultVersioning = semver;\n\n constructor() {\n super(TypstDatasource.id);\n }\n\n private async _getReleases({\n packageName,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n const [
|
|
1
|
+
{"version":3,"file":"index.js","names":["semver"],"sources":["../../../../lib/modules/datasource/typst/index.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { PackageHttpCacheProvider } from '../../../util/http/cache/package-http-cache-provider.ts';\nimport { id as semver } from '../../versioning/semver-coerced/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, ReleaseResult } from '../types.ts';\nimport { Registry } from './schema.ts';\n\nexport class TypstDatasource extends Datasource {\n static readonly id = 'typst';\n\n override readonly customRegistrySupport = false;\n\n override readonly defaultRegistryUrls = [\n 'https://packages.typst.org/preview/index.json',\n ];\n\n override defaultVersioning = semver;\n\n constructor() {\n super(TypstDatasource.id);\n }\n\n private async _getReleases({\n packageName,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n const [, pkg] = packageName.split('/');\n\n const [registryUrl] = this.defaultRegistryUrls;\n\n const cacheProvider = new PackageHttpCacheProvider({\n namespace: 'datasource-typst:cache-provider',\n checkAuthorizationHeader: false,\n checkCacheControlHeader: false,\n });\n\n const { body: registry } = await this.http.getJson(\n registryUrl,\n { cacheProvider },\n Registry,\n );\n\n const result = registry[pkg];\n if (!result) {\n return null;\n }\n\n result.registryUrl = registryUrl;\n return result;\n }\n\n override async getReleases(\n config: GetReleasesConfig,\n ): Promise<ReleaseResult | null> {\n const [namespace] = config.packageName.split('/');\n if (namespace !== 'preview') {\n logger.debug(`Unsupported namespace for @${config.packageName}`);\n return null;\n }\n\n return withCache(\n {\n namespace: `datasource-${TypstDatasource.id}:registry-releases`,\n key: config.packageName,\n fallback: true,\n cacheable: true,\n },\n () => this._getReleases(config),\n );\n }\n}\n"],"mappings":";;;;;;;AAQA,IAAa,kBAAb,MAAa,wBAAwB,WAAW;CAC9C,OAAgB,KAAK;CAErB,wBAA0C;CAE1C,sBAAwC,CACtC,+CACF;CAEA,oBAA6BA;CAE7B,cAAc;EACZ,MAAM,gBAAgB,EAAE;CAC1B;CAEA,MAAc,aAAa,EACzB,eACmD;EACnD,MAAM,GAAG,OAAO,YAAY,MAAM,GAAG;EAErC,MAAM,CAAC,eAAe,KAAK;EAE3B,MAAM,gBAAgB,IAAI,yBAAyB;GACjD,WAAW;GACX,0BAA0B;GAC1B,yBAAyB;EAC3B,CAAC;EAED,MAAM,EAAE,MAAM,aAAa,MAAM,KAAK,KAAK,QACzC,aACA,EAAE,cAAc,GAChB,QACF;EAEA,MAAM,SAAS,SAAS;EACxB,IAAI,CAAC,QACH,OAAO;EAGT,OAAO,cAAc;EACrB,OAAO;CACT;CAEA,MAAe,YACb,QAC+B;EAC/B,MAAM,CAAC,aAAa,OAAO,YAAY,MAAM,GAAG;EAChD,IAAI,cAAc,WAAW;GAC3B,OAAO,MAAM,8BAA8B,OAAO,aAAa;GAC/D,OAAO;EACT;EAEA,OAAO,UACL;GACE,WAAW,cAAc,gBAAgB,GAAG;GAC5C,KAAK,OAAO;GACZ,UAAU;GACV,WAAW;EACb,SACM,KAAK,aAAa,MAAM,CAChC;CACF;AACF"}
|
|
@@ -3,7 +3,8 @@ import { logger } from "../../../logger/index.js";
|
|
|
3
3
|
import { deleteLocalFile, getSiblingFileName, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
4
4
|
import { exec } from "../../../util/exec/index.js";
|
|
5
5
|
import { getRepoStatus } from "../../../util/git/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { collectFileChanges } from "../../../util/git/file-changes.js";
|
|
7
|
+
import { artifactErrorResult, fileChangesToArtifactResults, resolveToolConstraint } from "../util.js";
|
|
7
8
|
import { isNonEmptyArray } from "@sindresorhus/is";
|
|
8
9
|
//#region lib/modules/manager/apm/artifacts.ts
|
|
9
10
|
async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileContent, config }) {
|
|
@@ -31,19 +32,10 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
31
32
|
};
|
|
32
33
|
await exec("apm install", execOptions);
|
|
33
34
|
const status = await getRepoStatus();
|
|
34
|
-
const res = [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
type: "addition",
|
|
39
|
-
path,
|
|
40
|
-
contents: await readLocalFile(path)
|
|
41
|
-
} });
|
|
42
|
-
}
|
|
43
|
-
for (const path of status.deleted) res.push({ file: {
|
|
44
|
-
type: "deletion",
|
|
45
|
-
path
|
|
46
|
-
} });
|
|
35
|
+
const res = fileChangesToArtifactResults([...await collectFileChanges(status, {
|
|
36
|
+
include: ["modified", "not_added"],
|
|
37
|
+
filter: (path) => path !== packageFileName
|
|
38
|
+
}), ...await collectFileChanges(status, { include: ["deleted"] })]);
|
|
47
39
|
if (!res.length) {
|
|
48
40
|
logger.debug("apm: no changed files after install");
|
|
49
41
|
return null;
|
|
@@ -52,10 +44,7 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
52
44
|
} catch (err) {
|
|
53
45
|
if (err.message === "temporary-error") throw err;
|
|
54
46
|
logger.debug({ err }, `Failed to update ${lockFileName}`);
|
|
55
|
-
return
|
|
56
|
-
fileName: lockFileName,
|
|
57
|
-
stderr: `${err}`
|
|
58
|
-
} }];
|
|
47
|
+
return artifactErrorResult(lockFileName, err);
|
|
59
48
|
}
|
|
60
49
|
}
|
|
61
50
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/apm/artifacts.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\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 deleteLocalFile,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/apm/artifacts.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\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 deleteLocalFile,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { collectFileChanges } from '../../../util/git/file-changes.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n artifactErrorResult,\n fileChangesToArtifactResults,\n resolveToolConstraint,\n} from '../util.ts';\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`apm.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (!isNonEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('apm: no updated deps - returning null');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'apm.lock.yaml');\n const existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug('apm: no lock file found');\n return null;\n }\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n }\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n docker: {},\n toolConstraints: [\n {\n toolName: 'apm',\n constraint: await resolveToolConstraint(config, 'apm'),\n },\n ],\n };\n await exec('apm install', execOptions);\n\n // `apm install` regenerates the lockfile and re-deploys the harness\n // directories (`.github/`, `.claude/`, ...) that APM consumers commit, so\n // return every file it changed - not just the lockfile - or the committed\n // instruction files go stale after a bump. `apm_modules/` is the gitignored\n // cache, so it is not reported here.\n const status = await getRepoStatus();\n const res = fileChangesToArtifactResults([\n ...(await collectFileChanges(status, {\n include: ['modified', 'not_added'],\n // the manifest itself is committed as an updated package file\n filter: (path) => path !== packageFileName,\n })),\n ...(await collectFileChanges(status, { include: ['deleted'] })),\n ]);\n if (!res.length) {\n logger.debug('apm: no changed files after install');\n return null;\n }\n return res;\n } catch (err) {\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.debug({ err }, `Failed to update ${lockFileName}`);\n return artifactErrorResult(lockFileName, err);\n }\n}\n"],"mappings":";;;;;;;;;AAoBA,eAAsB,gBAAgB,EACpC,iBACA,aACA,uBACA,UAC0D;CAC1D,OAAO,MAAM,uBAAuB,gBAAgB,EAAE;CACtD,MAAM,EAAE,0BAA0B;CAElC,IAAI,CAAC,gBAAgB,WAAW,KAAK,CAAC,uBAAuB;EAC3D,OAAO,MAAM,uCAAuC;EACpD,OAAO;CACT;CAEA,MAAM,eAAe,mBAAmB,iBAAiB,eAAe;CAExE,IAAI,CAAC,MADiC,cAAc,cAAc,MAAM,GAC1C;EAC5B,OAAO,MAAM,yBAAyB;EACtC,OAAO;CACT;CAEA,IAAI;EACF,MAAM,eAAe,iBAAiB,qBAAqB;EAC3D,IAAI,uBACF,MAAM,gBAAgB,YAAY;EAGpC,MAAM,cAA2B;GAC/B,SAAS;GACT,QAAQ,CAAC;GACT,iBAAiB,CACf;IACE,UAAU;IACV,YAAY,MAAM,sBAAsB,QAAQ,KAAK;GACvD,CACF;EACF;EACA,MAAM,KAAK,eAAe,WAAW;EAOrC,MAAM,SAAS,MAAM,cAAc;EACnC,MAAM,MAAM,6BAA6B,CACvC,GAAI,MAAM,mBAAmB,QAAQ;GACnC,SAAS,CAAC,YAAY,WAAW;GAEjC,SAAS,SAAS,SAAS;EAC7B,CAAC,GACD,GAAI,MAAM,mBAAmB,QAAQ,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC,CAC/D,CAAC;EACD,IAAI,CAAC,IAAI,QAAQ;GACf,OAAO,MAAM,qCAAqC;GAClD,OAAO;EACT;EACA,OAAO;CACT,SAAS,KAAK;EACZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,OAAO,MAAM,EAAE,IAAI,GAAG,oBAAoB,cAAc;EACxD,OAAO,oBAAoB,cAAc,GAAG;CAC9C;AACF"}
|
|
@@ -3,7 +3,7 @@ import { GlobalConfig } from "../../../config/global.js";
|
|
|
3
3
|
import { logger } from "../../../logger/index.js";
|
|
4
4
|
import { deleteLocalFile, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
5
5
|
import { exec } from "../../../util/exec/index.js";
|
|
6
|
-
import { resolveToolConstraint } from "../util.js";
|
|
6
|
+
import { artifactErrorResult, fileAddition, resolveToolConstraint } from "../util.js";
|
|
7
7
|
import { processHostRules } from "../npm/post-update/rules.js";
|
|
8
8
|
import { getNpmrcContent, resetNpmrcContent, updateNpmrcContent } from "../npm/utils.js";
|
|
9
9
|
import { isEmptyArray } from "@sindresorhus/is";
|
|
@@ -48,21 +48,14 @@ async function updateArtifacts(updateArtifact) {
|
|
|
48
48
|
await resetNpmrcContent(pkgFileDir, npmrcContent);
|
|
49
49
|
const newLockFileContent = await readLocalFile(lockFileName);
|
|
50
50
|
if (!newLockFileContent || Buffer.compare(oldLockFileContent, newLockFileContent) === 0) return null;
|
|
51
|
-
return [
|
|
52
|
-
type: "addition",
|
|
53
|
-
path: lockFileName,
|
|
54
|
-
contents: newLockFileContent
|
|
55
|
-
} }];
|
|
51
|
+
return [fileAddition(lockFileName, newLockFileContent)];
|
|
56
52
|
} catch (err) {
|
|
57
53
|
if (err.message === "temporary-error") throw err;
|
|
58
54
|
logger.warn({
|
|
59
55
|
lockfile: lockFileName,
|
|
60
56
|
err
|
|
61
57
|
}, `Failed to update lock file`);
|
|
62
|
-
return
|
|
63
|
-
fileName: lockFileName,
|
|
64
|
-
stderr: err.message
|
|
65
|
-
} }];
|
|
58
|
+
return artifactErrorResult(lockFileName, err);
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
61
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bun/artifacts.ts"],"sourcesContent":["import { isEmptyArray } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../../config/global.ts';\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 deleteLocalFile,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { processHostRules } from '../npm/post-update/rules.ts';\nimport {\n getNpmrcContent,\n resetNpmrcContent,\n updateNpmrcContent,\n} from '../npm/utils.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bun/artifacts.ts"],"sourcesContent":["import { isEmptyArray } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../../config/global.ts';\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 deleteLocalFile,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { processHostRules } from '../npm/post-update/rules.ts';\nimport {\n getNpmrcContent,\n resetNpmrcContent,\n updateNpmrcContent,\n} from '../npm/utils.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n artifactErrorResult,\n fileAddition,\n resolveToolConstraint,\n} from '../util.ts';\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n const { packageFileName, updatedDeps, newPackageFileContent, config } =\n updateArtifact;\n logger.debug(`bun.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (isEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated bun deps - returning null');\n return null;\n }\n\n // Find the first bun dependency in order to handle mixed manager updates,\n // eventually falling back to the first lock file from config.\n const lockFileName =\n updatedDeps.find((dep) => dep.manager === 'bun')?.lockFiles?.[0] ??\n config.lockFiles?.[0];\n\n if (!lockFileName) {\n logger.debug(`bun: No lock file found`);\n return null;\n }\n\n const oldLockFileContent = await readLocalFile(lockFileName);\n if (!oldLockFileContent) {\n logger.debug(`No ${lockFileName} found`);\n return null;\n }\n\n const pkgFileDir = upath.dirname(packageFileName);\n const npmrcContent = await getNpmrcContent(pkgFileDir);\n const { additionalNpmrcContent } = processHostRules();\n await updateNpmrcContent(pkgFileDir, npmrcContent, additionalNpmrcContent);\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n }\n\n let cmd = 'bun install';\n\n if (!GlobalConfig.get('allowScripts') || config.ignoreScripts) {\n cmd += ' --ignore-scripts';\n }\n\n const execOptions: ExecOptions = {\n cwdFile: lockFileName,\n docker: {},\n toolConstraints: [\n {\n toolName: 'bun',\n constraint: await resolveToolConstraint(config, 'bun'),\n },\n ],\n };\n\n await exec(cmd, execOptions);\n await resetNpmrcContent(pkgFileDir, npmrcContent);\n\n const newLockFileContent = await readLocalFile(lockFileName);\n if (\n !newLockFileContent ||\n Buffer.compare(oldLockFileContent, newLockFileContent) === 0\n ) {\n return null;\n }\n return [fileAddition(lockFileName, newLockFileContent)];\n } catch (err) {\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.warn({ lockfile: lockFileName, err }, `Failed to update lock file`);\n return artifactErrorResult(lockFileName, err);\n }\n}\n"],"mappings":";;;;;;;;;;;AAyBA,eAAsB,gBACpB,gBACyC;CACzC,MAAM,EAAE,iBAAiB,aAAa,uBAAuB,WAC3D;CACF,OAAO,MAAM,uBAAuB,gBAAgB,EAAE;CACtD,MAAM,EAAE,0BAA0B;CAElC,IAAI,aAAa,WAAW,KAAK,CAAC,uBAAuB;EACvD,OAAO,MAAM,sCAAsC;EACnD,OAAO;CACT;CAIA,MAAM,eACJ,YAAY,MAAM,QAAQ,IAAI,YAAY,KAAK,CAAC,EAAE,YAAY,MAC9D,OAAO,YAAY;CAErB,IAAI,CAAC,cAAc;EACjB,OAAO,MAAM,yBAAyB;EACtC,OAAO;CACT;CAEA,MAAM,qBAAqB,MAAM,cAAc,YAAY;CAC3D,IAAI,CAAC,oBAAoB;EACvB,OAAO,MAAM,MAAM,aAAa,OAAO;EACvC,OAAO;CACT;CAEA,MAAM,aAAa,MAAM,QAAQ,eAAe;CAChD,MAAM,eAAe,MAAM,gBAAgB,UAAU;CACrD,MAAM,EAAE,2BAA2B,iBAAiB;CACpD,MAAM,mBAAmB,YAAY,cAAc,sBAAsB;CAEzE,IAAI;EACF,MAAM,eAAe,iBAAiB,qBAAqB;EAC3D,IAAI,uBACF,MAAM,gBAAgB,YAAY;EAGpC,IAAI,MAAM;EAEV,IAAI,CAAC,aAAa,IAAI,cAAc,KAAK,OAAO,eAC9C,OAAO;EAGT,MAAM,cAA2B;GAC/B,SAAS;GACT,QAAQ,CAAC;GACT,iBAAiB,CACf;IACE,UAAU;IACV,YAAY,MAAM,sBAAsB,QAAQ,KAAK;GACvD,CACF;EACF;EAEA,MAAM,KAAK,KAAK,WAAW;EAC3B,MAAM,kBAAkB,YAAY,YAAY;EAEhD,MAAM,qBAAqB,MAAM,cAAc,YAAY;EAC3D,IACE,CAAC,sBACD,OAAO,QAAQ,oBAAoB,kBAAkB,MAAM,GAE3D,OAAO;EAET,OAAO,CAAC,aAAa,cAAc,kBAAkB,CAAC;CACxD,SAAS,KAAK;EACZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,OAAO,KAAK;GAAE,UAAU;GAAc;EAAI,GAAG,4BAA4B;EACzE,OAAO,oBAAoB,cAAc,GAAG;CAC9C;AACF"}
|
|
@@ -4,7 +4,7 @@ import { coerceArray } from "../../../util/array.js";
|
|
|
4
4
|
import { logger } from "../../../logger/index.js";
|
|
5
5
|
import { findLocalSiblingOrParent, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
6
6
|
import { CrateDatasource } from "../../datasource/crate/index.js";
|
|
7
|
-
import { resolveToolConstraint } from "../util.js";
|
|
7
|
+
import { artifactErrorResult, fileAddition, resolveToolConstraint } from "../util.js";
|
|
8
8
|
import { withGitEnvironment } from "../../../util/git/exec.js";
|
|
9
9
|
import { extractLockFileContentVersions } from "./locked-version.js";
|
|
10
10
|
import { quote } from "shlex";
|
|
@@ -50,11 +50,7 @@ async function updateArtifactsImpl({ packageFileName, updatedDeps, newPackageFil
|
|
|
50
50
|
const { isLockFileMaintenance } = config;
|
|
51
51
|
if (!isLockFileMaintenance && !updatedDeps?.length) {
|
|
52
52
|
logger.debug("No more dependencies to update");
|
|
53
|
-
return [
|
|
54
|
-
type: "addition",
|
|
55
|
-
path: lockFileName,
|
|
56
|
-
contents: existingLockFileContent
|
|
57
|
-
} }];
|
|
53
|
+
return [fileAddition(lockFileName, existingLockFileContent)];
|
|
58
54
|
}
|
|
59
55
|
const rustConstraint = await resolveToolConstraint(config, "rust");
|
|
60
56
|
try {
|
|
@@ -76,11 +72,7 @@ async function updateArtifactsImpl({ packageFileName, updatedDeps, newPackageFil
|
|
|
76
72
|
logger.debug("Cargo.lock is unchanged");
|
|
77
73
|
return null;
|
|
78
74
|
}
|
|
79
|
-
return [
|
|
80
|
-
type: "addition",
|
|
81
|
-
path: lockFileName,
|
|
82
|
-
contents: newCargoLockContent
|
|
83
|
-
} }];
|
|
75
|
+
return [fileAddition(lockFileName, newCargoLockContent)];
|
|
84
76
|
} catch (err) {
|
|
85
77
|
// istanbul ignore if
|
|
86
78
|
if (err.message === "temporary-error") throw err;
|
|
@@ -100,10 +92,7 @@ async function updateArtifactsImpl({ packageFileName, updatedDeps, newPackageFil
|
|
|
100
92
|
}
|
|
101
93
|
}
|
|
102
94
|
logger.debug({ err }, "Failed to update Cargo lock file");
|
|
103
|
-
return
|
|
104
|
-
fileName: lockFileName,
|
|
105
|
-
stderr: err.message
|
|
106
|
-
} }];
|
|
95
|
+
return artifactErrorResult(lockFileName, err);
|
|
107
96
|
}
|
|
108
97
|
}
|
|
109
98
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/cargo/artifacts.ts"],"sourcesContent":["import { quote } from 'shlex';\nimport { 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 findLocalSiblingOrParent,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { withGitEnvironment } from '../../../util/git/exec.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { CrateDatasource } from '../../datasource/crate/index.ts';\nimport type {\n UpdateArtifact,\n UpdateArtifactsResult,\n Upgrade,\n} from '../types.ts';\nimport {
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/cargo/artifacts.ts"],"sourcesContent":["import { quote } from 'shlex';\nimport { 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 findLocalSiblingOrParent,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { withGitEnvironment } from '../../../util/git/exec.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { CrateDatasource } from '../../datasource/crate/index.ts';\nimport type {\n UpdateArtifact,\n UpdateArtifactsResult,\n Upgrade,\n} from '../types.ts';\nimport {\n artifactErrorResult,\n fileAddition,\n resolveToolConstraint,\n} from '../util.ts';\nimport { extractLockFileContentVersions } from './locked-version.ts';\n\nconst gitExec = withGitEnvironment(['cargo']);\n\nasync function cargoUpdate(\n manifestPath: string,\n isLockFileMaintenance: boolean,\n constraint: string | undefined,\n): Promise<void> {\n let cmd = `cargo update --config net.git-fetch-with-cli=true --manifest-path ${quote(\n manifestPath,\n )}`;\n // If we're updating a specific crate, `cargo-update` requires `--workspace`\n // for more information, see: https://github.com/renovatebot/renovate/issues/12332\n if (!isLockFileMaintenance) {\n cmd += ` --workspace`;\n }\n\n const execOptions: ExecOptions = {\n docker: {},\n toolConstraints: [{ toolName: 'rust', constraint }],\n };\n await gitExec(cmd, execOptions);\n}\n\nasync function cargoUpdatePrecise(\n manifestPath: string,\n updatedDeps: Upgrade[],\n constraint: string | undefined,\n): Promise<void> {\n const cmds = [];\n\n // First update individual dependencies to their `newVersion`. Necessary when\n // using the `update-lockfile` rangeStrategy which doesn't touch Cargo.toml.\n for (const dep of updatedDeps) {\n // If the range is bumped in Cargo.toml, the old lockedVersion may no longer\n // exist in Cargo's dependency graph, so let the --workspace update at the\n // end re-resolve it instead.\n if (dep.currentValue && dep.newValue && dep.currentValue !== dep.newValue) {\n continue;\n }\n\n cmds.push(\n `cargo update --config net.git-fetch-with-cli=true` +\n ` --manifest-path ${quote(manifestPath)}` +\n ` --package ${quote(`${dep.packageName}@${dep.lockedVersion}`)}` +\n ` --precise ${quote(dep.newVersion!)}`,\n );\n }\n\n // Then update all dependencies that have been bumped in `Cargo.toml`.\n cmds.push(\n `cargo update --config net.git-fetch-with-cli=true --manifest-path ${quote(manifestPath)} --workspace`,\n );\n\n const execOptions: ExecOptions = {\n docker: {},\n toolConstraints: [{ toolName: 'rust', constraint }],\n };\n\n await gitExec(cmds, execOptions);\n}\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n return await updateArtifactsImpl(updateArtifact);\n}\n\nasync function updateArtifactsImpl(\n {\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n }: UpdateArtifact,\n recursionLimit = 10,\n): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`cargo.updateArtifacts(${packageFileName})`);\n\n // For standalone package crates, the `Cargo.lock` will be in the same\n // directory as `Cargo.toml` (ie. a sibling). For cargo workspaces, it\n // will be further up.\n const lockFileName = await findLocalSiblingOrParent(\n packageFileName,\n 'Cargo.lock',\n );\n const existingLockFileContent = lockFileName\n ? await readLocalFile(lockFileName)\n : null;\n if (!existingLockFileContent || !lockFileName) {\n logger.debug('No Cargo.lock found');\n return null;\n }\n\n const { isLockFileMaintenance } = config;\n if (!isLockFileMaintenance && !updatedDeps?.length) {\n logger.debug('No more dependencies to update');\n return [fileAddition(lockFileName, existingLockFileContent)];\n }\n\n const rustConstraint = await resolveToolConstraint(config, 'rust');\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n logger.debug(`Updating ${lockFileName}`);\n\n if (isLockFileMaintenance) {\n await cargoUpdate(packageFileName, true, rustConstraint);\n } else {\n const hasNonCrateDep = updatedDeps.some(\n (dep) => dep.datasource !== CrateDatasource.id,\n );\n const crateDepWithoutLockedVersion = updatedDeps.find(\n (dep) => !dep.lockedVersion && dep.datasource === CrateDatasource.id,\n );\n // Non-crate dependencies (like git ones) do not have locked versions.\n // For crate dependencies, a locked version is expected.\n // In both situations, perform a regular workspace lockfile update.\n if (hasNonCrateDep || crateDepWithoutLockedVersion) {\n // v8 ignore else -- needs a workspace update driven only by a non-crate dep\n if (crateDepWithoutLockedVersion) {\n // Only warn when a crate dependency has no locked version\n logger.warn(\n { dependency: crateDepWithoutLockedVersion.depName },\n 'Missing locked version for dependency',\n );\n }\n await cargoUpdate(packageFileName, false, rustConstraint);\n } else {\n // If all dependencies have locked versions then update them precisely.\n await cargoUpdatePrecise(packageFileName, updatedDeps, rustConstraint);\n }\n }\n\n logger.debug('Returning updated Cargo.lock');\n const newCargoLockContent = await readLocalFile(lockFileName);\n if (existingLockFileContent === newCargoLockContent) {\n logger.debug('Cargo.lock is unchanged');\n return null;\n }\n return [fileAddition(lockFileName, newCargoLockContent)];\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n\n // Sometimes `cargo update` will fail when a preceding dependency update\n // causes another dependency to update. In this case we can no longer\n // reference the dependency by its old version, so we filter it out\n // and retry recursively.\n const newCargoLockContent = await readLocalFile(lockFileName, 'utf8');\n if (\n recursionLimit > 0 &&\n newCargoLockContent &&\n regEx(/error: package ID specification/).test(err.stderr)\n ) {\n const versions = extractLockFileContentVersions(newCargoLockContent);\n const newUpdatedDeps = updatedDeps.filter(\n (dep) =>\n !coerceArray(versions?.get(dep.packageName!)).includes(\n dep.newVersion!,\n ),\n );\n\n // v8 ignore else -- this retry only runs when a dep was already current\n if (newUpdatedDeps.length < updatedDeps.length) {\n logger.debug(\n 'Dependency already up to date - reattempting recursively',\n );\n return updateArtifactsImpl(\n {\n packageFileName,\n updatedDeps: newUpdatedDeps,\n newPackageFileContent,\n config,\n },\n recursionLimit - 1,\n );\n }\n }\n\n logger.debug({ err }, 'Failed to update Cargo lock file');\n\n return artifactErrorResult(lockFileName, err);\n }\n}\n"],"mappings":";;;;;;;;;;;AAyBA,MAAM,UAAU,mBAAmB,CAAC,OAAO,CAAC;AAE5C,eAAe,YACb,cACA,uBACA,YACe;CACf,IAAI,MAAM,qEAAqE,MAC7E,YACF;CAGA,IAAI,CAAC,uBACH,OAAO;CAOT,MAAM,QAAQ,KAAK;EAHjB,QAAQ,CAAC;EACT,iBAAiB,CAAC;GAAE,UAAU;GAAQ;EAAW,CAAC;CAEvB,CAAC;AAChC;AAEA,eAAe,mBACb,cACA,aACA,YACe;CACf,MAAM,OAAO,CAAC;CAId,KAAK,MAAM,OAAO,aAAa;EAI7B,IAAI,IAAI,gBAAgB,IAAI,YAAY,IAAI,iBAAiB,IAAI,UAC/D;EAGF,KAAK,KACH,qEACsB,MAAM,YAAY,EAAA,aACxB,MAAM,GAAG,IAAI,YAAY,GAAG,IAAI,eAAe,EAAA,aAC/C,MAAM,IAAI,UAAW,GACvC;CACF;CAGA,KAAK,KACH,qEAAqE,MAAM,YAAY,EAAE,aAC3F;CAOA,MAAM,QAAQ,MAAM;EAJlB,QAAQ,CAAC;EACT,iBAAiB,CAAC;GAAE,UAAU;GAAQ;EAAW,CAAC;CAGtB,CAAC;AACjC;AAEA,eAAsB,gBACpB,gBACyC;CACzC,OAAO,MAAM,oBAAoB,cAAc;AACjD;AAEA,eAAe,oBACb,EACE,iBACA,aACA,uBACA,UAEF,iBAAiB,IACwB;CACzC,OAAO,MAAM,yBAAyB,gBAAgB,EAAE;CAKxD,MAAM,eAAe,MAAM,yBACzB,iBACA,YACF;CACA,MAAM,0BAA0B,eAC5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C,YAAY,UAAU,IAAI,IAAI,WAAY,CAAC,CAAC,CAAC,SAC5C,IAAI,UACN,CACJ;;GAGA,IAAI,eAAe,SAAS,YAAY,QAAQ;IAC9C,OAAO,MACL,0DACF;IACA,OAAO,oBACL;KACE;KACA,aAAa;KACb;KACA;IACF,GACA,iBAAiB,CACnB;GACF;EACF;EAEA,OAAO,MAAM,EAAE,IAAI,GAAG,kCAAkC;EAExD,OAAO,oBAAoB,cAAc,GAAG;CAC9C;AACF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import "../../../constants/error-messages.js";
|
|
2
2
|
import { newlineRegex, regEx } from "../../../util/regex.js";
|
|
3
|
-
import { coerceArray } from "../../../util/array.js";
|
|
4
3
|
import { logger } from "../../../logger/index.js";
|
|
5
4
|
import { ensureCacheDir, getSiblingFileName, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
6
5
|
import { exec } from "../../../util/exec/index.js";
|
|
7
6
|
import { getRepoStatus } from "../../../util/git/index.js";
|
|
7
|
+
import { collectFileChanges } from "../../../util/git/file-changes.js";
|
|
8
|
+
import { artifactErrorResult, fileAddition, fileChangesToArtifactResults } from "../util.js";
|
|
8
9
|
import { quote } from "shlex";
|
|
9
10
|
import upath from "upath";
|
|
10
11
|
//#region lib/modules/manager/cocoapods/artifacts.ts
|
|
@@ -31,10 +32,7 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
31
32
|
await writeLocalFile(packageFileName, newPackageFileContent);
|
|
32
33
|
} catch (err) {
|
|
33
34
|
logger.warn({ err }, "Podfile could not be written");
|
|
34
|
-
return
|
|
35
|
-
fileName: lockFileName,
|
|
36
|
-
stderr: err.message
|
|
37
|
-
} }];
|
|
35
|
+
return artifactErrorResult(lockFileName, err);
|
|
38
36
|
}
|
|
39
37
|
const existingLockFileContent = await readLocalFile(lockFileName, "utf8");
|
|
40
38
|
if (!existingLockFileContent) {
|
|
@@ -55,34 +53,21 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
55
53
|
try {
|
|
56
54
|
await exec(cmd, execOptions);
|
|
57
55
|
} catch (err) {
|
|
58
|
-
|
|
56
|
+
/* v8 ignore if -- defensive rethrow, not reproduced in the cocoapods specs */
|
|
59
57
|
if (err.message === "temporary-error") throw err;
|
|
60
|
-
return
|
|
61
|
-
fileName: lockFileName,
|
|
62
|
-
stderr: err.stderr ?? err.stdout ?? err.message
|
|
63
|
-
} }];
|
|
58
|
+
return artifactErrorResult(lockFileName, err);
|
|
64
59
|
}
|
|
65
60
|
const status = await getRepoStatus();
|
|
66
61
|
if (!status.modified.includes(lockFileName)) return null;
|
|
67
62
|
logger.debug(`Returning updated lockfile: ${lockFileName}`);
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
path: lockFileName,
|
|
71
|
-
contents: await readLocalFile(lockFileName)
|
|
72
|
-
} }];
|
|
63
|
+
const lockFileContent = await readLocalFile(lockFileName);
|
|
64
|
+
const res = [fileAddition(lockFileName, lockFileContent)];
|
|
73
65
|
const podsDir = upath.join(upath.dirname(packageFileName), "Pods");
|
|
74
66
|
const podsManifestFileName = upath.join(podsDir, "Manifest.lock");
|
|
75
|
-
if (await readLocalFile(podsManifestFileName, "utf8")) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
contents: await readLocalFile(f)
|
|
80
|
-
} });
|
|
81
|
-
for (const f of coerceArray(status.deleted)) res.push({ file: {
|
|
82
|
-
type: "deletion",
|
|
83
|
-
path: f
|
|
84
|
-
} });
|
|
85
|
-
}
|
|
67
|
+
if (await readLocalFile(podsManifestFileName, "utf8")) res.push(...fileChangesToArtifactResults([...await collectFileChanges(status, {
|
|
68
|
+
include: ["modified", "not_added"],
|
|
69
|
+
filter: (f) => f.startsWith(podsDir)
|
|
70
|
+
}), ...await collectFileChanges(status, { include: ["deleted"] })]));
|
|
86
71
|
return res;
|
|
87
72
|
}
|
|
88
73
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/cocoapods/artifacts.ts"],"sourcesContent":["import { quote } from 'shlex';\nimport upath from 'upath';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport {
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/cocoapods/artifacts.ts"],"sourcesContent":["import { quote } from 'shlex';\nimport upath from 'upath';\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 ensureCacheDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { collectFileChanges } from '../../../util/git/file-changes.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n artifactErrorResult,\n fileAddition,\n fileChangesToArtifactResults,\n} from '../util.ts';\n\nconst pluginRegex = regEx(`^\\\\s*plugin\\\\s*(['\"])(?<plugin>[^'\"]+)(['\"])`);\n\nfunction getPluginCommands(content: string): string[] {\n const result = new Set<string>();\n const lines: string[] = content.split(newlineRegex);\n lines.forEach((line) => {\n const match = pluginRegex.exec(line);\n if (match?.groups) {\n const { plugin } = match.groups;\n result.add(`gem install ${quote(plugin)}`);\n }\n });\n return [...result];\n}\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`cocoapods.getArtifacts(${packageFileName})`);\n\n if (updatedDeps.length < 1) {\n logger.debug('CocoaPods: empty update - returning null');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'Podfile.lock');\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n } catch (err) {\n logger.warn({ err }, 'Podfile could not be written');\n return artifactErrorResult(lockFileName, err);\n }\n\n const existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug(`Lockfile not found: ${lockFileName}`);\n return null;\n }\n\n const match = regEx(/^COCOAPODS: (?<cocoapodsVersion>.*)$/m).exec(\n existingLockFileContent,\n );\n const cocoapods = match?.groups?.cocoapodsVersion ?? null;\n\n const cmd = [...getPluginCommands(newPackageFileContent), 'pod install'];\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv: {\n CP_HOME_DIR: await ensureCacheDir('cocoapods'),\n },\n docker: {},\n toolConstraints: [\n {\n toolName: 'ruby',\n },\n {\n toolName: 'cocoapods',\n constraint: cocoapods,\n },\n ],\n };\n\n try {\n await exec(cmd, execOptions);\n } catch (err) {\n /* v8 ignore if -- defensive rethrow, not reproduced in the cocoapods specs */\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n return artifactErrorResult(lockFileName, err);\n }\n\n const status = await getRepoStatus();\n if (!status.modified.includes(lockFileName)) {\n return null;\n }\n logger.debug(`Returning updated lockfile: ${lockFileName}`);\n const lockFileContent = await readLocalFile(lockFileName);\n const res: UpdateArtifactsResult[] = [\n fileAddition(lockFileName, lockFileContent),\n ];\n\n const podsDir = upath.join(upath.dirname(packageFileName), 'Pods');\n const podsManifestFileName = upath.join(podsDir, 'Manifest.lock');\n if (await readLocalFile(podsManifestFileName, 'utf8')) {\n res.push(\n ...fileChangesToArtifactResults([\n ...(await collectFileChanges(status, {\n include: ['modified', 'not_added'],\n filter: (f) => f.startsWith(podsDir),\n })),\n ...(await collectFileChanges(status, { include: ['deleted'] })),\n ]),\n );\n }\n return res;\n}\n"],"mappings":";;;;;;;;;;;AAsBA,MAAM,cAAc,MAAM,8CAA8C;AAExE,SAAS,kBAAkB,SAA2B;CACpD,MAAM,yBAAS,IAAI,IAAY;CAE/B,QADgC,MAAM,YAClC,CAAC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OAAO,MAAM,+BAA+B,cAAc;CAC1D,MAAM,kBAAkB,MAAM,cAAc,YAAY;CACxD,MAAM,MAA+B,CACnC,aAAa,cAAc,eAAe,CAC5C;CAEA,MAAM,UAAU,MAAM,KAAK,MAAM,QAAQ,eAAe,GAAG,MAAM;CACjE,MAAM,uBAAuB,MAAM,KAAK,SAAS,eAAe;CAChE,IAAI,MAAM,cAAc,sBAAsB,MAAM,GAClD,IAAI,KACF,GAAG,6BAA6B,CAC9B,GAAI,MAAM,mBAAmB,QAAQ;EACnC,SAAS,CAAC,YAAY,WAAW;EACjC,SAAS,MAAM,EAAE,WAAW,OAAO;CACrC,CAAC,GACD,GAAI,MAAM,mBAAmB,QAAQ,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC,CAC/D,CAAC,CACH;CAEF,OAAO;AACT"}
|
|
@@ -12,7 +12,8 @@ import { exec } from "../../../util/exec/index.js";
|
|
|
12
12
|
import { getRepoStatus } from "../../../util/git/index.js";
|
|
13
13
|
import { GitTagsDatasource } from "../../datasource/git-tags/index.js";
|
|
14
14
|
import { PackagistDatasource } from "../../datasource/packagist/index.js";
|
|
15
|
-
import {
|
|
15
|
+
import { collectFileChanges } from "../../../util/git/file-changes.js";
|
|
16
|
+
import { artifactErrorResult, fileAddition, fileChangesToArtifactResults, resolveToolConstraint } from "../util.js";
|
|
16
17
|
import { findGithubToken, takePersonalAccessTokenIfPossible } from "../../../util/check-token.js";
|
|
17
18
|
import { Lockfile, PackageFile } from "./schema.js";
|
|
18
19
|
import { extractConstraints, getComposerArguments, getComposerUpdateArguments, isArtifactAuthEnabled, requireComposerDependencyInstallation } from "./utils.js";
|
|
@@ -127,22 +128,13 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
127
128
|
const status = await getRepoStatus();
|
|
128
129
|
if (!status.modified.includes(lockFileName)) return null;
|
|
129
130
|
logger.debug("Returning updated composer.lock");
|
|
130
|
-
const res = [
|
|
131
|
-
type: "addition",
|
|
132
|
-
path: lockFileName,
|
|
133
|
-
contents: await readLocalFile(lockFileName)
|
|
134
|
-
} }];
|
|
131
|
+
const res = [fileAddition(lockFileName, await readLocalFile(lockFileName))];
|
|
135
132
|
if (!commitVendorFiles) return res;
|
|
136
133
|
logger.debug(`Committing vendor files in ${vendorDir}`);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
} });
|
|
142
|
-
for (const f of status.deleted) res.push({ file: {
|
|
143
|
-
type: "deletion",
|
|
144
|
-
path: f
|
|
145
|
-
} });
|
|
134
|
+
res.push(...fileChangesToArtifactResults([...await collectFileChanges(status, {
|
|
135
|
+
include: ["modified", "not_added"],
|
|
136
|
+
filter: (f) => f.startsWith(vendorDir)
|
|
137
|
+
}), ...await collectFileChanges(status, { include: ["deleted"] })]));
|
|
146
138
|
return res;
|
|
147
139
|
} catch (err) {
|
|
148
140
|
// istanbul ignore if
|
|
@@ -150,10 +142,7 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
150
142
|
if (err.message?.includes("Your requirements could not be resolved to an installable set of packages.")) logger.info("Composer requirements cannot be resolved");
|
|
151
143
|
else if (err.message?.includes("write error (disk full?)")) throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);
|
|
152
144
|
else logger.debug({ err }, "Failed to generate composer.lock");
|
|
153
|
-
return
|
|
154
|
-
fileName: lockFileName,
|
|
155
|
-
stderr: err.message
|
|
156
|
-
} }];
|
|
145
|
+
return artifactErrorResult(lockFileName, err);
|
|
157
146
|
}
|
|
158
147
|
}
|
|
159
148
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":["hostRules.find","hostRules.findAll"],"sources":["../../../../lib/modules/manager/composer/artifacts.ts"],"sourcesContent":["import { isEmptyObject, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport { z } from 'zod/v4';\nimport {\n SYSTEM_INSUFFICIENT_DISK_SPACE,\n TEMPORARY_ERROR,\n} from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport {\n findGithubToken,\n takePersonalAccessTokenIfPossible,\n} from '../../../util/check-token.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type {\n CommandWithOptions,\n ExecOptions,\n ToolConstraint,\n} from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n ensureCacheDir,\n ensureLocalDir,\n getSiblingFileName,\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { Lazy } from '../../../util/lazy.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { Json } from '../../../util/schema-utils/index.ts';\nimport { coerceString } from '../../../util/string.ts';\nimport { GitTagsDatasource } from '../../datasource/git-tags/index.ts';\nimport { PackagistDatasource } from '../../datasource/packagist/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { Lockfile, PackageFile } from './schema.ts';\nimport type { AuthJson } from './types.ts';\nimport {\n extractConstraints,\n getComposerArguments,\n getComposerUpdateArguments,\n isArtifactAuthEnabled,\n requireComposerDependencyInstallation,\n} from './utils.ts';\n\nfunction getAuthJson(): string | null {\n const authJson: AuthJson = {};\n\n const githubHostRule = hostRules.find({\n hostType: 'github',\n url: 'https://api.github.com/',\n });\n\n const gitTagsHostRule = hostRules.find({\n hostType: GitTagsDatasource.id,\n url: 'https://github.com',\n });\n\n const selectedGithubToken = takePersonalAccessTokenIfPossible(\n isArtifactAuthEnabled(githubHostRule)\n ? findGithubToken(githubHostRule)\n : undefined,\n isArtifactAuthEnabled(gitTagsHostRule)\n ? findGithubToken(gitTagsHostRule)\n : undefined,\n );\n\n if (selectedGithubToken) {\n authJson['github-oauth'] = {\n 'github.com': selectedGithubToken,\n };\n }\n\n for (const gitlabHostRule of hostRules.findAll({ hostType: 'gitlab' })) {\n if (!isArtifactAuthEnabled(gitlabHostRule)) {\n continue;\n }\n\n // v8 ignore else -- a rule without a token does not pass the check above\n if (gitlabHostRule?.token) {\n const host = coerceString(gitlabHostRule.resolvedHost, 'gitlab.com');\n authJson['gitlab-token'] = coerceObject(authJson['gitlab-token']);\n authJson['gitlab-token'][host] = gitlabHostRule.token;\n // https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token\n authJson['gitlab-domains'] = [\n host,\n ...coerceArray(authJson['gitlab-domains']),\n ];\n }\n }\n\n for (const packagistHostRule of hostRules.findAll({\n hostType: PackagistDatasource.id,\n })) {\n if (!isArtifactAuthEnabled(packagistHostRule)) {\n continue;\n }\n\n const { resolvedHost, username, password, token } = packagistHostRule;\n if (resolvedHost && username && password) {\n authJson['http-basic'] = coerceObject(authJson['http-basic']);\n authJson['http-basic'][resolvedHost] = { username, password };\n } else if (resolvedHost && token) {\n authJson.bearer = coerceObject(authJson.bearer);\n authJson.bearer[resolvedHost] = token;\n }\n }\n\n return isEmptyObject(authJson) ? null : JSON.stringify(authJson);\n}\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`composer.updateArtifacts(${packageFileName})`);\n\n const file = Json.pipe(PackageFile).parse(newPackageFileContent);\n\n const lockFileName = packageFileName.replace(regEx(/\\.json$/), '.lock');\n const lockfile = await z\n .string()\n .transform((f) => readLocalFile(f, 'utf8'))\n .pipe(Json)\n .pipe(Lockfile)\n .nullable()\n .catch(null)\n .parseAsync(lockFileName);\n if (!lockfile) {\n logger.debug('Composer: unable to read lockfile');\n return null;\n }\n\n const vendorDir = getSiblingFileName(packageFileName, 'vendor');\n const commitVendorFiles = await localPathExists(vendorDir);\n await ensureLocalDir(vendorDir);\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n // `extractConstraints()` re-reads the updated package file, so its values win\n // over what extraction saw on the base branch. It only runs when a user\n // constraint is missing for at least one of the tools.\n const fileConstraints = new Lazy(() => extractConstraints(file, lockfile));\n\n const composerToolConstraint: ToolConstraint = {\n toolName: 'composer',\n constraint: await resolveToolConstraint(\n config,\n 'composer',\n () => fileConstraints.getValue().composer,\n ),\n };\n\n const phpToolConstraint: ToolConstraint = {\n toolName: 'php',\n constraint: await resolveToolConstraint(\n config,\n 'php',\n () => fileConstraints.getValue().php,\n ),\n };\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv: {\n COMPOSER_CACHE_DIR: await ensureCacheDir('composer'),\n COMPOSER_AUTH: getAuthJson(),\n },\n toolConstraints: [phpToolConstraint, composerToolConstraint],\n docker: {},\n };\n\n const commands: (string | CommandWithOptions)[] = [];\n\n // Determine whether install is required before update\n if (requireComposerDependencyInstallation(lockfile)) {\n const preCmd = 'composer';\n const preArgs = `install${getComposerArguments(config, composerToolConstraint)}`;\n logger.trace({ preCmd, preArgs }, 'composer pre-update command');\n commands.push('git stash -- composer.json');\n commands.push(`${preCmd} ${preArgs}`);\n commands.push({ command: ['git', 'stash', 'pop'], ignoreFailure: true });\n }\n\n if (config.isLockFileMaintenance) {\n logger.debug(\n `Removing ${lockFileName} first due to lock file maintenance upgrade`,\n );\n await deleteLocalFile(lockFileName);\n }\n\n const cmd = 'composer';\n let args: string;\n if (config.isLockFileMaintenance) {\n args = 'update';\n } else {\n args =\n (\n 'update ' +\n updatedDeps\n .map((dep) =>\n dep.newVersion\n ? quote(`${dep.depName}:${dep.newVersion}`)\n : quote(dep.depName!),\n )\n .filter(isString)\n .map((dep) => quote(dep))\n .join(' ')\n ).trim() +\n (config.postUpdateOptions?.includes('composerWithAll')\n ? ' --with-all-dependencies'\n : ' --with-dependencies');\n }\n args += getComposerUpdateArguments(config, composerToolConstraint);\n logger.trace({ cmd, args }, 'composer command');\n commands.push(`${cmd} ${args}`);\n\n await exec(commands, execOptions);\n const status = await getRepoStatus();\n if (!status.modified.includes(lockFileName)) {\n return null;\n }\n logger.debug('Returning updated composer.lock');\n const res: UpdateArtifactsResult[] = [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: await readLocalFile(lockFileName),\n },\n },\n ];\n\n if (!commitVendorFiles) {\n return res;\n }\n\n logger.debug(`Committing vendor files in ${vendorDir}`);\n for (const f of [...status.modified, ...status.not_added]) {\n if (f.startsWith(vendorDir)) {\n res.push({\n file: {\n type: 'addition',\n path: f,\n contents: await readLocalFile(f),\n },\n });\n }\n }\n for (const f of status.deleted) {\n res.push({\n file: {\n type: 'deletion',\n path: f,\n },\n });\n }\n\n return res;\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n if (\n err.message?.includes(\n 'Your requirements could not be resolved to an installable set of packages.',\n )\n ) {\n logger.info('Composer requirements cannot be resolved');\n } else if (err.message?.includes('write error (disk full?)')) {\n throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);\n } else {\n logger.debug({ err }, 'Failed to generate composer.lock');\n }\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: err.message,\n },\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiDA,SAAS,cAA6B;CACpC,MAAM,WAAqB,CAAC;CAE5B,MAAM,iBAAiBA,KAAe;EACpC,UAAU;EACV,KAAK;CACP,CAAC;CAED,MAAM,kBAAkBA,KAAe;EACrC,UAAU,kBAAkB;EAC5B,KAAK;CACP,CAAC;CAED,MAAM,sBAAsB,kCAC1B,sBAAsB,cAAc,IAChC,gBAAgB,cAAc,IAC9B,KAAA,GACJ,sBAAsB,eAAe,IACjC,gBAAgB,eAAe,IAC/B,KAAA,CACN;CAEA,IAAI,qBACF,SAAS,kBAAkB,EACzB,cAAc,oBAChB;CAGF,KAAK,MAAM,kBAAkBC,QAAkB,EAAE,UAAU,SAAS,CAAC,GAAG;EACtE,IAAI,CAAC,sBAAsB,cAAc,GACvC;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AO,mBAAmB,SAAS,iBAAiB,IACjD,6BACA;EAER,QAAQ,2BAA2B,QAAQ,sBAAsB;EACjE,OAAO,MAAM;GAAE;GAAK;EAAK,GAAG,kBAAkB;EAC9C,SAAS,KAAK,GAAG,IAAI,GAAG,MAAM;EAE9B,MAAM,KAAK,UAAU,WAAW;EAChC,MAAM,SAAS,MAAM,cAAc;EACnC,IAAI,CAAC,OAAO,SAAS,SAAS,YAAY,GACxC,OAAO;EAET,OAAO,MAAM,iCAAiC;EAC9C,MAAM,MAA+B,CACnC,EACE,MAAM;GACJ,MAAM;GACN,MAAM;GACN,UAAU,MAAM,cAAc,YAAY;EAC5C,EACF,CACF;EAEA,IAAI,CAAC,mBACH,OAAO;EAGT,OAAO,MAAM,8BAA8B,WAAW;EACtD,KAAK,MAAM,KAAK,CAAC,GAAG,OAAO,UAAU,GAAG,OAAO,SAAS,GACtD,IAAI,EAAE,WAAW,SAAS,GACxB,IAAI,KAAK,EACP,MAAM;GACJ,MAAM;GACN,MAAM;GACN,UAAU,MAAM,cAAc,CAAC;EACjC,EACF,CAAC;EAGL,KAAK,MAAM,KAAK,OAAO,SACrB,IAAI,KAAK,EACP,MAAM;GACJ,MAAM;GACN,MAAM;EACR,EACF,CAAC;EAGH,OAAO;CACT,SAAS,KAAK;;EAEZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,IACE,IAAI,SAAS,SACX,4EACF,GAEA,OAAO,KAAK,0CAA0C;OACjD,IAAI,IAAI,SAAS,SAAS,0BAA0B,GACzD,MAAM,IAAI,MAAM,8BAA8B;OAE9C,OAAO,MAAM,EAAE,IAAI,GAAG,kCAAkC;EAE1D,OAAO,CACL,EACE,eAAe;GACb,UAAU;GACV,QAAQ,IAAI;EACd,EACF,CACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":["hostRules.find","hostRules.findAll"],"sources":["../../../../lib/modules/manager/composer/artifacts.ts"],"sourcesContent":["import { isEmptyObject, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport { z } from 'zod/v4';\nimport {\n SYSTEM_INSUFFICIENT_DISK_SPACE,\n TEMPORARY_ERROR,\n} from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport {\n findGithubToken,\n takePersonalAccessTokenIfPossible,\n} from '../../../util/check-token.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type {\n CommandWithOptions,\n ExecOptions,\n ToolConstraint,\n} from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n ensureCacheDir,\n ensureLocalDir,\n getSiblingFileName,\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { collectFileChanges } from '../../../util/git/file-changes.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { Lazy } from '../../../util/lazy.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { Json } from '../../../util/schema-utils/index.ts';\nimport { coerceString } from '../../../util/string.ts';\nimport { GitTagsDatasource } from '../../datasource/git-tags/index.ts';\nimport { PackagistDatasource } from '../../datasource/packagist/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n artifactErrorResult,\n fileAddition,\n fileChangesToArtifactResults,\n resolveToolConstraint,\n} from '../util.ts';\nimport { Lockfile, PackageFile } from './schema.ts';\nimport type { AuthJson } from './types.ts';\nimport {\n extractConstraints,\n getComposerArguments,\n getComposerUpdateArguments,\n isArtifactAuthEnabled,\n requireComposerDependencyInstallation,\n} from './utils.ts';\n\nfunction getAuthJson(): string | null {\n const authJson: AuthJson = {};\n\n const githubHostRule = hostRules.find({\n hostType: 'github',\n url: 'https://api.github.com/',\n });\n\n const gitTagsHostRule = hostRules.find({\n hostType: GitTagsDatasource.id,\n url: 'https://github.com',\n });\n\n const selectedGithubToken = takePersonalAccessTokenIfPossible(\n isArtifactAuthEnabled(githubHostRule)\n ? findGithubToken(githubHostRule)\n : undefined,\n isArtifactAuthEnabled(gitTagsHostRule)\n ? findGithubToken(gitTagsHostRule)\n : undefined,\n );\n\n if (selectedGithubToken) {\n authJson['github-oauth'] = {\n 'github.com': selectedGithubToken,\n };\n }\n\n for (const gitlabHostRule of hostRules.findAll({ hostType: 'gitlab' })) {\n if (!isArtifactAuthEnabled(gitlabHostRule)) {\n continue;\n }\n\n // v8 ignore else -- a rule without a token does not pass the check above\n if (gitlabHostRule?.token) {\n const host = coerceString(gitlabHostRule.resolvedHost, 'gitlab.com');\n authJson['gitlab-token'] = coerceObject(authJson['gitlab-token']);\n authJson['gitlab-token'][host] = gitlabHostRule.token;\n // https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token\n authJson['gitlab-domains'] = [\n host,\n ...coerceArray(authJson['gitlab-domains']),\n ];\n }\n }\n\n for (const packagistHostRule of hostRules.findAll({\n hostType: PackagistDatasource.id,\n })) {\n if (!isArtifactAuthEnabled(packagistHostRule)) {\n continue;\n }\n\n const { resolvedHost, username, password, token } = packagistHostRule;\n if (resolvedHost && username && password) {\n authJson['http-basic'] = coerceObject(authJson['http-basic']);\n authJson['http-basic'][resolvedHost] = { username, password };\n } else if (resolvedHost && token) {\n authJson.bearer = coerceObject(authJson.bearer);\n authJson.bearer[resolvedHost] = token;\n }\n }\n\n return isEmptyObject(authJson) ? null : JSON.stringify(authJson);\n}\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`composer.updateArtifacts(${packageFileName})`);\n\n const file = Json.pipe(PackageFile).parse(newPackageFileContent);\n\n const lockFileName = packageFileName.replace(regEx(/\\.json$/), '.lock');\n const lockfile = await z\n .string()\n .transform((f) => readLocalFile(f, 'utf8'))\n .pipe(Json)\n .pipe(Lockfile)\n .nullable()\n .catch(null)\n .parseAsync(lockFileName);\n if (!lockfile) {\n logger.debug('Composer: unable to read lockfile');\n return null;\n }\n\n const vendorDir = getSiblingFileName(packageFileName, 'vendor');\n const commitVendorFiles = await localPathExists(vendorDir);\n await ensureLocalDir(vendorDir);\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n // `extractConstraints()` re-reads the updated package file, so its values win\n // over what extraction saw on the base branch. It only runs when a user\n // constraint is missing for at least one of the tools.\n const fileConstraints = new Lazy(() => extractConstraints(file, lockfile));\n\n const composerToolConstraint: ToolConstraint = {\n toolName: 'composer',\n constraint: await resolveToolConstraint(\n config,\n 'composer',\n () => fileConstraints.getValue().composer,\n ),\n };\n\n const phpToolConstraint: ToolConstraint = {\n toolName: 'php',\n constraint: await resolveToolConstraint(\n config,\n 'php',\n () => fileConstraints.getValue().php,\n ),\n };\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv: {\n COMPOSER_CACHE_DIR: await ensureCacheDir('composer'),\n COMPOSER_AUTH: getAuthJson(),\n },\n toolConstraints: [phpToolConstraint, composerToolConstraint],\n docker: {},\n };\n\n const commands: (string | CommandWithOptions)[] = [];\n\n // Determine whether install is required before update\n if (requireComposerDependencyInstallation(lockfile)) {\n const preCmd = 'composer';\n const preArgs = `install${getComposerArguments(config, composerToolConstraint)}`;\n logger.trace({ preCmd, preArgs }, 'composer pre-update command');\n commands.push('git stash -- composer.json');\n commands.push(`${preCmd} ${preArgs}`);\n commands.push({ command: ['git', 'stash', 'pop'], ignoreFailure: true });\n }\n\n if (config.isLockFileMaintenance) {\n logger.debug(\n `Removing ${lockFileName} first due to lock file maintenance upgrade`,\n );\n await deleteLocalFile(lockFileName);\n }\n\n const cmd = 'composer';\n let args: string;\n if (config.isLockFileMaintenance) {\n args = 'update';\n } else {\n args =\n (\n 'update ' +\n updatedDeps\n .map((dep) =>\n dep.newVersion\n ? quote(`${dep.depName}:${dep.newVersion}`)\n : quote(dep.depName!),\n )\n .filter(isString)\n .map((dep) => quote(dep))\n .join(' ')\n ).trim() +\n (config.postUpdateOptions?.includes('composerWithAll')\n ? ' --with-all-dependencies'\n : ' --with-dependencies');\n }\n args += getComposerUpdateArguments(config, composerToolConstraint);\n logger.trace({ cmd, args }, 'composer command');\n commands.push(`${cmd} ${args}`);\n\n await exec(commands, execOptions);\n const status = await getRepoStatus();\n if (!status.modified.includes(lockFileName)) {\n return null;\n }\n logger.debug('Returning updated composer.lock');\n const res: UpdateArtifactsResult[] = [\n fileAddition(lockFileName, await readLocalFile(lockFileName)),\n ];\n\n if (!commitVendorFiles) {\n return res;\n }\n\n logger.debug(`Committing vendor files in ${vendorDir}`);\n res.push(\n ...fileChangesToArtifactResults([\n ...(await collectFileChanges(status, {\n include: ['modified', 'not_added'],\n filter: (f) => f.startsWith(vendorDir),\n })),\n ...(await collectFileChanges(status, { include: ['deleted'] })),\n ]),\n );\n\n return res;\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n if (\n err.message?.includes(\n 'Your requirements could not be resolved to an installable set of packages.',\n )\n ) {\n logger.info('Composer requirements cannot be resolved');\n } else if (err.message?.includes('write error (disk full?)')) {\n throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);\n } else {\n logger.debug({ err }, 'Failed to generate composer.lock');\n }\n return artifactErrorResult(lockFileName, err);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuDA,SAAS,cAA6B;CACpC,MAAM,WAAqB,CAAC;CAE5B,MAAM,iBAAiBA,KAAe;EACpC,UAAU;EACV,KAAK;CACP,CAAC;CAED,MAAM,kBAAkBA,KAAe;EACrC,UAAU,kBAAkB;EAC5B,KAAK;CACP,CAAC;CAED,MAAM,sBAAsB,kCAC1B,sBAAsB,cAAc,IAChC,gBAAgB,cAAc,IAC9B,KAAA,GACJ,sBAAsB,eAAe,IACjC,gBAAgB,eAAe,IAC/B,KAAA,CACN;CAEA,IAAI,qBACF,SAAS,kBAAkB,EACzB,cAAc,oBAChB;CAGF,KAAK,MAAM,kBAAkBC,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