renovate 42.92.8 → 42.92.10
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/validation.js +13 -2
- package/dist/config/validation.js.map +1 -1
- package/dist/modules/datasource/npm/npmrc.js +1 -3
- package/dist/modules/datasource/npm/npmrc.js.map +1 -1
- package/dist/modules/datasource/pypi/index.js +2 -4
- package/dist/modules/datasource/pypi/index.js.map +1 -1
- package/dist/modules/datasource/sbt-plugin/index.js +6 -10
- package/dist/modules/datasource/sbt-plugin/index.js.map +1 -1
- package/dist/modules/manager/custom/regex/utils.js +1 -2
- package/dist/modules/manager/custom/regex/utils.js.map +1 -1
- package/dist/modules/manager/flux/schema.js +7 -15
- package/dist/modules/manager/flux/schema.js.map +1 -1
- package/dist/modules/manager/git-submodules/extract.js +1 -3
- package/dist/modules/manager/git-submodules/extract.js.map +1 -1
- package/dist/modules/manager/kubernetes/schema.js +16 -0
- package/dist/modules/manager/kubernetes/schema.js.map +1 -0
- package/dist/modules/manager/sveltos/schema.js +1 -1
- package/dist/modules/manager/sveltos/schema.js.map +1 -1
- package/dist/modules/platform/bitbucket-server/utils.js +1 -2
- package/dist/modules/platform/bitbucket-server/utils.js.map +1 -1
- package/dist/workers/repository/reconfigure/validate.js +5 -5
- package/dist/workers/repository/reconfigure/validate.js.map +1 -1
- package/package.json +2 -2
- package/renovate-schema.json +2 -2
|
@@ -507,9 +507,15 @@ async function validateGlobalConfig(key, val, type, warnings, errors, currentPat
|
|
|
507
507
|
if (val !== null) {
|
|
508
508
|
// v8 ignore else -- TODO: add test #40625
|
|
509
509
|
if (type === "string") if ((0, _sindresorhus_is.isString)(val)) {
|
|
510
|
-
if (key === "onboardingConfigFileName" && !
|
|
510
|
+
if (key === "onboardingConfigFileName" && !getPossibleConfigFileNames({
|
|
511
|
+
configFileNames: config.configFileNames,
|
|
512
|
+
platform: config.platform
|
|
513
|
+
}).includes(val)) warnings.push({
|
|
511
514
|
topic: "Configuration Error",
|
|
512
|
-
message: `Invalid value \`${val}\` for \`${currentPath}\`. The allowed values are ${
|
|
515
|
+
message: `Invalid value \`${val}\` for \`${currentPath}\`. The allowed values are ${getPossibleConfigFileNames({
|
|
516
|
+
configFileNames: config.configFileNames,
|
|
517
|
+
platform: config.platform
|
|
518
|
+
}).join(", ")}.`
|
|
513
519
|
});
|
|
514
520
|
else if (key === "repositoryCache" && ![
|
|
515
521
|
"enabled",
|
|
@@ -639,6 +645,11 @@ async function validateGlobalConfig(key, val, type, warnings, errors, currentPat
|
|
|
639
645
|
});
|
|
640
646
|
}
|
|
641
647
|
}
|
|
648
|
+
function getPossibleConfigFileNames({ configFileNames, platform }) {
|
|
649
|
+
const filenames = require_app_strings.getConfigFileNames(platform);
|
|
650
|
+
if ((0, _sindresorhus_is.isNonEmptyArray)(configFileNames)) return filenames.concat(configFileNames);
|
|
651
|
+
return filenames;
|
|
652
|
+
}
|
|
642
653
|
|
|
643
654
|
//#endregion
|
|
644
655
|
exports.validateConfig = validateConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","names":["getOptions","getManagerList","regEx","allManagersList","isFalseGlobal","is","getParentName","hasValidSchedule","isRegexMatch","getRegexPredicate","hasValidTimezone","validateNumber","resolveConfigPresets","migrateConfig","isCustomManager","validatePlainObject","GlobalConfig","matchRegexOrGlobList","allowedStatusCheckStrings","isString","parseUrl","getExpression","getConfigFileNames","supportedDatasources"],"sources":["../../lib/config/validation.ts"],"sourcesContent":["import is, {\n isArray,\n isEmptyString,\n isNonEmptyArray,\n isNonEmptyString,\n isObject,\n isPlainObject,\n isString,\n isUndefined,\n} from '@sindresorhus/is';\nimport { allManagersList, getManagerList } from '../modules/manager';\nimport { isCustomManager } from '../modules/manager/custom';\nimport type { CustomManager } from '../modules/manager/custom/types';\nimport type { HostRule } from '../types';\nimport { getExpression } from '../util/jsonata';\nimport { regEx } from '../util/regex';\nimport {\n getRegexPredicate,\n isRegexMatch,\n matchRegexOrGlobList,\n} from '../util/string-match';\nimport * as template from '../util/template';\nimport { parseUrl } from '../util/url';\nimport {\n hasValidSchedule,\n hasValidTimezone,\n} from '../workers/repository/update/branch/schedule';\nimport { getConfigFileNames } from './app-strings';\nimport { GlobalConfig } from './global';\nimport { migrateConfig } from './migration';\nimport { getOptions } from './options';\nimport { resolveConfigPresets } from './presets';\nimport { supportedDatasources } from './presets/internal/merge-confidence';\nimport type {\n AllConfig,\n AllowedParents,\n RenovateConfig,\n RenovateOptions,\n StatusCheckKey,\n ValidationMessage,\n ValidationResult,\n} from './types';\nimport { allowedStatusCheckStrings } from './types';\nimport * as matchBaseBranchesValidator from './validation-helpers/match-base-branches';\nimport * as regexOrGlobValidator from './validation-helpers/regex-glob-matchers';\nimport {\n getParentName,\n isFalseGlobal,\n validateJSONataManagerFields,\n validateNumber,\n validatePlainObject,\n validateRegexManagerFields,\n} from './validation-helpers/utils';\n\nconst options = getOptions();\n\nlet optionsInitialized = false;\nlet optionTypes: Record<string, RenovateOptions['type']>;\nlet optionParents: Record<string, AllowedParents[]>;\nlet optionGlobals: Set<string>;\nlet optionInherits: Set<string>;\nlet optionRegexOrGlob: Set<string>;\nlet optionAllowsNegativeIntegers: Set<string>;\n\nconst managerList = getManagerList();\n\nconst topLevelObjects = [...managerList, 'env'];\n\nconst ignoredNodes = [\n '$schema',\n 'headers',\n 'depType',\n 'npmToken',\n 'packageFile',\n 'forkToken',\n 'repository',\n 'vulnerabilityAlertsOnly',\n 'vulnerabilityAlert',\n 'isVulnerabilityAlert',\n 'vulnerabilityFixVersion', // not intended to be used by end users but may be by Mend apps\n 'copyLocalLibs', // deprecated - functionality is now enabled by default\n 'prBody', // deprecated\n 'minimumConfidence', // undocumented feature flag\n];\nconst tzRe = regEx(/^:timezone\\((.+)\\)$/);\nconst rulesRe = regEx(/p.*Rules\\[\\d+\\]$/);\n\nfunction isIgnored(key: string): boolean {\n return ignoredNodes.includes(key);\n}\n\nfunction getUnsupportedEnabledManagers(enabledManagers: string[]): string[] {\n return enabledManagers.filter(\n (manager) => !allManagersList.includes(manager.replace('custom.', '')),\n );\n}\n\nfunction getDeprecationMessage(option: string): string | undefined {\n const deprecatedOptions: Record<string, string | undefined> = {\n branchName: `Direct editing of branchName is now deprecated. Please edit branchPrefix, additionalBranchPrefix, or branchTopic instead`,\n commitMessage: `Direct editing of commitMessage is now deprecated. Please edit commitMessage's subcomponents instead.`,\n prTitle: `Direct editing of prTitle is now deprecated. Please edit commitMessage subcomponents instead as they will be passed through to prTitle.`,\n };\n return deprecatedOptions[option];\n}\n\nfunction isInhertConfigOption(key: string): boolean {\n return optionInherits.has(key);\n}\n\nfunction isRegexOrGlobOption(key: string): boolean {\n return optionRegexOrGlob.has(key);\n}\n\nfunction isGlobalOption(key: string): boolean {\n return optionGlobals.has(key);\n}\n\nfunction initOptions(): void {\n if (optionsInitialized) {\n return;\n }\n\n optionParents = {};\n optionInherits = new Set();\n optionTypes = {};\n optionRegexOrGlob = new Set();\n optionGlobals = new Set();\n optionAllowsNegativeIntegers = new Set();\n\n for (const option of options) {\n optionTypes[option.name] = option.type;\n\n if (option.parents) {\n optionParents[option.name] = option.parents;\n }\n\n if (option.inheritConfigSupport) {\n optionInherits.add(option.name);\n }\n\n if (option.patternMatch) {\n optionRegexOrGlob.add(option.name);\n }\n\n if (option.globalOnly) {\n optionGlobals.add(option.name);\n }\n\n if (option.allowNegative) {\n optionAllowsNegativeIntegers.add(option.name);\n }\n }\n\n optionsInitialized = true;\n}\n\nexport async function validateConfig(\n configType: 'global' | 'inherit' | 'repo',\n config: AllConfig,\n isPreset?: boolean,\n parentPath?: string,\n): Promise<ValidationResult> {\n initOptions();\n\n let errors: ValidationMessage[] = [];\n let warnings: ValidationMessage[] = [];\n\n for (const [key, val] of Object.entries(config)) {\n const currentPath = parentPath ? `${parentPath}.${key}` : key;\n /* v8 ignore next 7 -- TODO: add test */\n if (key === '__proto__') {\n errors.push({\n topic: 'Config security error',\n message: '__proto__',\n });\n continue;\n }\n if (\n parentPath &&\n parentPath !== 'onboardingConfig' &&\n topLevelObjects.includes(key)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `The \"${key}\" object can only be configured at the top level of a config but was found inside \"${parentPath}\"`,\n });\n }\n\n if (isGlobalOption(key)) {\n if (configType === 'global') {\n await validateGlobalConfig(\n key,\n val,\n optionTypes[key],\n warnings,\n errors,\n currentPath,\n config,\n );\n continue;\n } else if (\n !isFalseGlobal(key, parentPath) &&\n !(configType === 'inherit' && isInhertConfigOption(key))\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `The \"${key}\" option is a global option reserved only for Renovate's global configuration and cannot be configured within a repository's config file.`,\n });\n continue;\n }\n }\n if (key === 'enabledManagers' && val) {\n const unsupportedManagers = getUnsupportedEnabledManagers(\n val as string[],\n );\n if (isNonEmptyArray(unsupportedManagers)) {\n errors.push({\n topic: 'Configuration Error',\n message: `The following managers configured in enabledManagers are not supported: \"${unsupportedManagers.join(\n ', ',\n )}\"`,\n });\n }\n }\n if (\n !isIgnored(key) && // We need to ignore some reserved keys\n !(is as any).function(val) // Ignore all functions\n ) {\n if (getDeprecationMessage(key)) {\n warnings.push({\n topic: 'Deprecation Warning',\n message: getDeprecationMessage(key)!,\n });\n }\n const templateKeys = [\n 'branchName',\n 'commitBody',\n 'commitMessage',\n 'prTitle',\n 'semanticCommitScope',\n ];\n if ((key.endsWith('Template') || templateKeys.includes(key)) && val) {\n try {\n // TODO: validate string #22198\n let res = template.compile((val as string).toString(), config, false);\n res = template.compile(res, config, false);\n template.compile(res, config, false);\n } catch {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid template in config path: ${currentPath}`,\n });\n }\n }\n const parentName = getParentName(parentPath);\n if (\n !isPreset &&\n optionParents[key] &&\n !optionParents[key].includes(parentName as AllowedParents)\n ) {\n // TODO: types (#22198)\n const options = optionParents[key]?.toSorted().join(', ');\n const message = `\"${key}\" can't be used in \"${parentName}\". Allowed objects: ${options}.`;\n warnings.push({\n topic: `${parentPath ? `${parentPath}.` : ''}${key}`,\n message,\n });\n }\n if (!optionTypes[key]) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid configuration option: ${currentPath}`,\n });\n } else if (key === 'schedule') {\n const [validSchedule, errorMessage] = hasValidSchedule(val as string[]);\n if (!validSchedule) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid ${currentPath}: \\`${errorMessage}\\``,\n });\n }\n } else if (\n [\n 'allowedVersions',\n 'matchCurrentVersion',\n 'matchCurrentValue',\n 'matchNewValue',\n ].includes(key) &&\n isRegexMatch(val)\n ) {\n if (!getRegexPredicate(val)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid regExp for ${currentPath}: \\`${val}\\``,\n });\n }\n } else if (key === 'timezone' && val !== null) {\n const [validTimezone, errorMessage] = hasValidTimezone(val as string);\n if (!validTimezone) {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath}: ${errorMessage}`,\n });\n }\n } else if (val !== null) {\n const type = optionTypes[key];\n if (type === 'boolean') {\n if (val !== true && val !== false) {\n errors.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be boolean. Found: ${JSON.stringify(\n val,\n )} (${typeof val})`,\n });\n }\n } else if (type === 'integer') {\n const allowsNegative = optionAllowsNegativeIntegers.has(key);\n errors.push(...validateNumber(key, val, allowsNegative, currentPath));\n } else if (type === 'array' && val) {\n if (isArray(val)) {\n for (const [subIndex, subval] of val.entries()) {\n if (isObject(subval)) {\n const subValidation = await validateConfig(\n configType,\n subval as RenovateConfig,\n isPreset,\n `${currentPath}[${subIndex}]`,\n );\n warnings = warnings.concat(subValidation.warnings);\n errors = errors.concat(subValidation.errors);\n }\n }\n if (isRegexOrGlobOption(key)) {\n errors.push(\n ...regexOrGlobValidator.check({\n val,\n currentPath,\n }),\n );\n }\n if (key === 'extends') {\n for (const subval of val) {\n if (isString(subval)) {\n if (configType !== 'global' && subval.startsWith('global:')) {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath}: you cannot extend from \"global:\" presets in a repository config's \"extends\"`,\n });\n }\n\n if (\n parentName === 'packageRules' &&\n subval.startsWith('group:')\n ) {\n warnings.push({\n topic: 'Configuration Warning',\n message: `${currentPath}: you should not extend \"group:\" presets`,\n });\n }\n if (tzRe.test(subval)) {\n const [, timezone] = tzRe.exec(subval)!;\n const [validTimezone, errorMessage] =\n hasValidTimezone(timezone);\n if (!validTimezone) {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath}: ${errorMessage}`,\n });\n }\n }\n } else {\n errors.push({\n topic: 'Configuration Warning',\n message: `${currentPath}: preset value is not a string`,\n });\n }\n }\n }\n\n const selectors = [\n 'matchFileNames',\n 'matchLanguages',\n 'matchCategories',\n 'matchBaseBranches',\n 'matchManagers',\n 'matchDatasources',\n 'matchDepTypes',\n 'matchDepNames',\n 'matchPackageNames',\n 'matchCurrentValue',\n 'matchCurrentVersion',\n 'matchSourceUrls',\n 'matchUpdateTypes',\n 'matchConfidence',\n 'matchCurrentAge',\n 'matchRepositories',\n 'matchNewValue',\n 'matchJsonata',\n ];\n if (key === 'packageRules') {\n for (const [subIndex, packageRule] of val.entries()) {\n if (isObject(packageRule)) {\n const { config: resolved } = await resolveConfigPresets(\n packageRule as RenovateConfig,\n config,\n );\n const resolvedRule = migrateConfig({\n packageRules: [resolved],\n }).migratedConfig.packageRules![0];\n warnings.push(\n ...matchBaseBranchesValidator.check({\n resolvedRule,\n currentPath: `${currentPath}[${subIndex}]`,\n baseBranchPatterns: config.baseBranchPatterns!,\n }),\n );\n const selectorLength = Object.keys(resolvedRule).filter(\n (ruleKey) => selectors.includes(ruleKey),\n ).length;\n if (!selectorLength) {\n const message = `${currentPath}[${subIndex}]: Each packageRule must contain at least one match* or exclude* selector. Rule: ${JSON.stringify(\n packageRule,\n )}`;\n errors.push({\n topic: 'Configuration Error',\n message,\n });\n }\n if (selectorLength === Object.keys(resolvedRule).length) {\n const message = `${currentPath}[${subIndex}]: Each packageRule must contain at least one non-match* or non-exclude* field. Rule: ${JSON.stringify(\n packageRule,\n )}`;\n warnings.push({\n topic: 'Configuration Error',\n message,\n });\n }\n // It's too late to apply any of these options once you already have updates determined\n const preLookupOptions = [\n 'allowedVersions',\n 'extractVersion',\n 'followTag',\n 'ignoreDeps',\n 'ignoreUnstable',\n 'rangeStrategy',\n 'registryUrls',\n 'respectLatest',\n 'rollbackPrs',\n 'separateMajorMinor',\n 'separateMinorPatch',\n 'separateMultipleMajor',\n 'separateMultipleMinor',\n 'versioning',\n ] as const;\n if (isNonEmptyArray(resolvedRule.matchUpdateTypes)) {\n for (const option of preLookupOptions) {\n if (resolvedRule[option] !== undefined) {\n const message = `${currentPath}[${subIndex}]: packageRules cannot combine both matchUpdateTypes and ${option}. Rule: ${JSON.stringify(\n packageRule,\n )}`;\n errors.push({\n topic: 'Configuration Error',\n message,\n });\n }\n }\n }\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath} must contain JSON objects`,\n });\n }\n }\n }\n if (key === 'customManagers') {\n const allowedKeys = [\n 'customType',\n 'description',\n 'fileFormat',\n 'managerFilePatterns',\n 'matchStrings',\n 'matchStringsStrategy',\n 'depNameTemplate',\n 'packageNameTemplate',\n 'datasourceTemplate',\n 'versioningTemplate',\n 'registryUrlTemplate',\n 'currentValueTemplate',\n 'extractVersionTemplate',\n 'autoReplaceStringTemplate',\n 'depTypeTemplate',\n ];\n for (const customManager of val as CustomManager[]) {\n if (\n Object.keys(customManager).some(\n (k) => !allowedKeys.includes(k),\n )\n ) {\n const disallowedKeys = Object.keys(customManager).filter(\n (k) => !allowedKeys.includes(k),\n );\n errors.push({\n topic: 'Configuration Error',\n message: `Custom Manager contains disallowed fields: ${disallowedKeys.join(\n ', ',\n )}`,\n });\n } else if (\n isNonEmptyString(customManager.customType) &&\n isCustomManager(customManager.customType)\n ) {\n if (isNonEmptyArray(customManager.managerFilePatterns)) {\n switch (customManager.customType) {\n case 'regex':\n validateRegexManagerFields(\n customManager,\n currentPath,\n errors,\n );\n break;\n case 'jsonata':\n validateJSONataManagerFields(\n customManager,\n currentPath,\n errors,\n );\n break;\n }\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `Each Custom Manager must contain a non-empty managerFilePatterns array`,\n });\n }\n } else {\n if (\n isEmptyString(customManager.customType) ||\n isUndefined(customManager.customType)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `Each Custom Manager must contain a non-empty customType string`,\n });\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid customType: ${customManager.customType}. Key is not a custom manager`,\n });\n }\n }\n }\n }\n if (['matchPackageNames', 'matchDepNames'].includes(key)) {\n const startPattern = regEx(/!?\\//);\n const endPattern = regEx(/\\/g?i?$/);\n for (const pattern of val as string[]) {\n if (startPattern.test(pattern) && endPattern.test(pattern)) {\n try {\n // regEx isn't aware of our !/ prefix but can handle the suffix\n regEx(pattern.replace(startPattern, '/'));\n } catch {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid regExp for ${currentPath}: \\`${pattern}\\``,\n });\n }\n }\n }\n }\n if (key === 'baseBranchPatterns') {\n for (const baseBranchPattern of val as string[]) {\n if (\n isRegexMatch(baseBranchPattern) &&\n !getRegexPredicate(baseBranchPattern)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid regExp for ${currentPath}: \\`${baseBranchPattern}\\``,\n });\n }\n }\n }\n if (\n (selectors.includes(key) ||\n key === 'matchCurrentVersion' ||\n key === 'matchCurrentValue') &&\n // TODO: can be undefined ? #22198\n !rulesRe.test(parentPath!) && // Inside a packageRule\n (isString(parentPath) || !isPreset) // top level in a preset\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath}: ${key} should be inside a \\`packageRule\\` only`,\n });\n }\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a list (Array)`,\n });\n }\n } else if (type === 'string') {\n if (!isString(val)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a string`,\n });\n }\n } else if (\n type === 'object' &&\n currentPath !== 'compatibility' &&\n key !== 'constraints'\n ) {\n if (isPlainObject(val)) {\n if (key === 'registryAliases') {\n const res = validatePlainObject(val);\n if (res !== true) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${key}.${res}\\` configuration: value is not a string`,\n });\n }\n } else if (key === 'env') {\n const allowedEnvVars =\n configType === 'global'\n ? (config.allowedEnv ?? [])\n : GlobalConfig.get('allowedEnv', []);\n for (const [envVarName, envVarValue] of Object.entries(val)) {\n if (!isString(envVarValue)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid env variable value: \\`${currentPath}.${envVarName}\\` must be a string.`,\n });\n }\n if (!matchRegexOrGlobList(envVarName, allowedEnvVars)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Env variable name \\`${envVarName}\\` is not allowed by this bot's \\`allowedEnv\\`.`,\n });\n }\n }\n } else if (key === 'statusCheckNames') {\n for (const [statusCheckKey, statusCheckValue] of Object.entries(\n val,\n )) {\n if (\n !allowedStatusCheckStrings.includes(\n statusCheckKey as StatusCheckKey,\n )\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${key}.${statusCheckKey}\\` configuration: key is not allowed.`,\n });\n }\n if (\n !(isString(statusCheckValue) || null === statusCheckValue)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${statusCheckKey}\\` configuration: status check is not a string.`,\n });\n continue;\n }\n }\n } else if (key === 'customDatasources') {\n const allowedKeys = [\n 'description',\n 'defaultRegistryUrlTemplate',\n 'format',\n 'transformTemplates',\n ];\n for (const [\n customDatasourceName,\n customDatasourceValue,\n ] of Object.entries(val)) {\n if (!isPlainObject(customDatasourceValue)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${customDatasourceName}\\` configuration: customDatasource is not an object`,\n });\n continue;\n }\n for (const [subKey, subValue] of Object.entries(\n customDatasourceValue,\n )) {\n if (!allowedKeys.includes(subKey)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${subKey}\\` configuration: key is not allowed`,\n });\n } else if (subKey === 'transformTemplates') {\n if (!isArray(subValue, isString)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${subKey}\\` configuration: is not an array of string`,\n });\n }\n } else if (subKey === 'description') {\n if (!(isString(subValue) || isArray(subValue, isString))) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${subKey}\\` configuration: is not an array of strings`,\n });\n }\n } else if (!isString(subValue)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${subKey}\\` configuration: is a string`,\n });\n }\n }\n }\n } else {\n const ignoredObjects = options\n .filter((option) => option.freeChoice)\n .map((option) => option.name);\n if (!ignoredObjects.includes(key)) {\n const subValidation = await validateConfig(\n configType,\n val,\n isPreset,\n currentPath,\n );\n warnings = warnings.concat(subValidation.warnings);\n errors = errors.concat(subValidation.errors);\n }\n }\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a json object`,\n });\n }\n }\n }\n }\n\n if (key === 'hostRules' && isArray(val)) {\n const allowedHeaders =\n configType === 'global'\n ? (config.allowedHeaders ?? [])\n : GlobalConfig.get('allowedHeaders', []);\n for (const rule of val as HostRule[]) {\n if (isNonEmptyString(rule.matchHost)) {\n if (rule.matchHost.includes('://')) {\n if (parseUrl(rule.matchHost) === null) {\n errors.push({\n topic: 'Configuration Error',\n message: `hostRules matchHost \\`${rule.matchHost}\\` is not a valid URL.`,\n });\n }\n }\n } else if (isEmptyString(rule.matchHost)) {\n errors.push({\n topic: 'Configuration Error',\n message:\n 'Invalid value for hostRules matchHost. It cannot be an empty string.',\n });\n }\n\n if (!rule.headers) {\n continue;\n }\n for (const [header, value] of Object.entries(rule.headers)) {\n if (!isString(value)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid hostRules headers value configuration: header must be a string.`,\n });\n }\n if (!matchRegexOrGlobList(header, allowedHeaders)) {\n errors.push({\n topic: 'Configuration Error',\n message: `hostRules header \\`${header}\\` is not allowed by this bot's \\`allowedHeaders\\`.`,\n });\n }\n }\n }\n }\n\n if (key === 'matchJsonata' && isArray(val, isString)) {\n for (const expression of val) {\n const res = getExpression(expression);\n if (res instanceof Error) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid JSONata expression for ${currentPath}: ${res.message}`,\n });\n }\n }\n }\n }\n\n function sortAll(a: ValidationMessage, b: ValidationMessage): number {\n if (a.topic === b.topic) {\n return a.message > b.message ? 1 : -1;\n }\n return a.topic > b.topic ? 1 : -1;\n }\n\n errors.sort(sortAll);\n warnings.sort(sortAll);\n return { errors, warnings };\n}\n\n/**\n * Basic validation for global config options\n */\nasync function validateGlobalConfig(\n key: string,\n val: unknown,\n type: string,\n warnings: ValidationMessage[],\n errors: ValidationMessage[],\n currentPath: string | undefined,\n config: RenovateConfig,\n): Promise<void> {\n /* v8 ignore next 5 -- not testable yet */\n if (getDeprecationMessage(key)) {\n warnings.push({\n topic: 'Deprecation Warning',\n message: getDeprecationMessage(key)!,\n });\n }\n if (val !== null) {\n // v8 ignore else -- TODO: add test #40625\n if (type === 'string') {\n if (isString(val)) {\n if (\n key === 'onboardingConfigFileName' &&\n !getConfigFileNames().includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${getConfigFileNames().join(', ')}.`,\n });\n } else if (\n key === 'repositoryCache' &&\n !['enabled', 'disabled', 'reset'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['enabled', 'disabled', 'reset'].join(', ')}.`,\n });\n } else if (\n key === 'dryRun' &&\n !['extract', 'lookup', 'full'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['extract', 'lookup', 'full'].join(', ')}.`,\n });\n } else if (\n key === 'binarySource' &&\n !['docker', 'global', 'install', 'hermit'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['docker', 'global', 'install', 'hermit'].join(', ')}.`,\n });\n } else if (\n key === 'requireConfig' &&\n !['required', 'optional', 'ignored'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['required', 'optional', 'ignored'].join(', ')}.`,\n });\n } else if (\n key === 'gitUrl' &&\n !['default', 'ssh', 'endpoint'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['default', 'ssh', 'endpoint'].join(', ')}.`,\n });\n }\n\n if (\n key === 'reportType' &&\n ['s3', 'file'].includes(val) &&\n !isString(config.reportPath)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `reportType '${val}' requires a configured reportPath`,\n });\n }\n } else {\n warnings.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a string.`,\n });\n }\n } else if (type === 'integer') {\n const allowsNegative = optionAllowsNegativeIntegers.has(key);\n warnings.push(...validateNumber(key, val, allowsNegative, currentPath));\n } else if (type === 'boolean') {\n if (val !== true && val !== false) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a boolean. Found: ${JSON.stringify(\n val,\n )} (${typeof val}).`,\n });\n }\n } else if (type === 'array') {\n if (isArray(val)) {\n if (isRegexOrGlobOption(key)) {\n warnings.push(\n ...regexOrGlobValidator.check({\n val,\n currentPath: currentPath!,\n }),\n );\n }\n if (key === 'gitNoVerify') {\n const allowedValues = ['commit', 'push'];\n for (const value of val as string[]) {\n // v8 ignore else -- TODO: add test #40625\n if (!allowedValues.includes(value)) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value for \\`${currentPath}\\`. The allowed values are ${allowedValues.join(', ')}.`,\n });\n }\n }\n }\n if (key === 'mergeConfidenceDatasources') {\n const allowedValues = supportedDatasources;\n for (const value of val as string[]) {\n // v8 ignore else -- TODO: add test #40625\n if (!allowedValues.includes(value)) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${value}\\` for \\`${currentPath}\\`. The allowed values are ${allowedValues.join(', ')}.`,\n });\n }\n }\n }\n } else {\n warnings.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a list (Array).`,\n });\n }\n } else if (type === 'object') {\n if (isPlainObject(val)) {\n if (key === 'onboardingConfig') {\n const subValidation = await validateConfig('repo', val);\n for (const warning of subValidation.warnings.concat(\n subValidation.errors,\n )) {\n warnings.push(warning);\n }\n } else if (key === 'force') {\n const subValidation = await validateConfig('global', val);\n for (const warning of subValidation.warnings.concat(\n subValidation.errors,\n )) {\n warnings.push(warning);\n }\n } else if (key === 'cacheTtlOverride') {\n for (const [subKey, subValue] of Object.entries(val)) {\n const allowsNegative = optionAllowsNegativeIntegers.has(key);\n warnings.push(\n ...validateNumber(\n key,\n subValue,\n allowsNegative,\n currentPath,\n subKey,\n ),\n );\n }\n } else {\n const res = validatePlainObject(val);\n if (res !== true) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${res}\\` configuration: value must be a string.`,\n });\n }\n }\n } else {\n warnings.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a JSON object.`,\n });\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;0BAesC;6CAKR;sBAES;AAgCvC,MAAM,UAAUA,4BAAY;AAE5B,IAAI,qBAAqB;AACzB,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAIJ,MAAM,kBAAkB,CAAC,GAFLC,gCAAgB,EAEK,MAAM;AAE/C,MAA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Q,mBACjB,MAAK,MAAM,CAAC,QAAQ,aAAa,OAAO,QAAQ,IAAI,EAAE;GACpD,MAAM,iBAAiB,6BAA6B,IAAI,IAAI;AAC5D,YAAS,KACP,GAAGZ,6BACD,KACA,UACA,gBACA,aACA,OACD,CACF;;OAEE;GACL,MAAM,MAAMI,kCAAoB,IAAI;AACpC,OAAI,QAAQ,KACV,UAAS,KAAK;IACZ,OAAO;IACP,SAAS,aAAa,YAAY,GAAG,IAAI;IAC1C,CAAC;;MAIN,UAAS,KAAK;GACZ,OAAO;GACP,SAAS,0BAA0B,YAAY;GAChD,CAAC"}
|
|
1
|
+
{"version":3,"file":"validation.js","names":["getOptions","getManagerList","regEx","allManagersList","isFalseGlobal","is","getParentName","hasValidSchedule","isRegexMatch","getRegexPredicate","hasValidTimezone","validateNumber","resolveConfigPresets","migrateConfig","isCustomManager","validatePlainObject","GlobalConfig","matchRegexOrGlobList","allowedStatusCheckStrings","isString","parseUrl","getExpression","supportedDatasources","getConfigFileNames"],"sources":["../../lib/config/validation.ts"],"sourcesContent":["import is, {\n isArray,\n isEmptyString,\n isNonEmptyArray,\n isNonEmptyString,\n isObject,\n isPlainObject,\n isString,\n isUndefined,\n} from '@sindresorhus/is';\nimport type { PlatformId } from '../constants';\nimport { allManagersList, getManagerList } from '../modules/manager';\nimport { isCustomManager } from '../modules/manager/custom';\nimport type { CustomManager } from '../modules/manager/custom/types';\nimport type { HostRule } from '../types';\nimport { getExpression } from '../util/jsonata';\nimport { regEx } from '../util/regex';\nimport {\n getRegexPredicate,\n isRegexMatch,\n matchRegexOrGlobList,\n} from '../util/string-match';\nimport * as template from '../util/template';\nimport { parseUrl } from '../util/url';\nimport {\n hasValidSchedule,\n hasValidTimezone,\n} from '../workers/repository/update/branch/schedule';\nimport { getConfigFileNames } from './app-strings';\nimport { GlobalConfig } from './global';\nimport { migrateConfig } from './migration';\nimport { getOptions } from './options';\nimport { resolveConfigPresets } from './presets';\nimport { supportedDatasources } from './presets/internal/merge-confidence';\nimport type {\n AllConfig,\n AllowedParents,\n RenovateConfig,\n RenovateOptions,\n StatusCheckKey,\n ValidationMessage,\n ValidationResult,\n} from './types';\nimport { allowedStatusCheckStrings } from './types';\nimport * as matchBaseBranchesValidator from './validation-helpers/match-base-branches';\nimport * as regexOrGlobValidator from './validation-helpers/regex-glob-matchers';\nimport {\n getParentName,\n isFalseGlobal,\n validateJSONataManagerFields,\n validateNumber,\n validatePlainObject,\n validateRegexManagerFields,\n} from './validation-helpers/utils';\n\nconst options = getOptions();\n\nlet optionsInitialized = false;\nlet optionTypes: Record<string, RenovateOptions['type']>;\nlet optionParents: Record<string, AllowedParents[]>;\nlet optionGlobals: Set<string>;\nlet optionInherits: Set<string>;\nlet optionRegexOrGlob: Set<string>;\nlet optionAllowsNegativeIntegers: Set<string>;\n\nconst managerList = getManagerList();\n\nconst topLevelObjects = [...managerList, 'env'];\n\nconst ignoredNodes = [\n '$schema',\n 'headers',\n 'depType',\n 'npmToken',\n 'packageFile',\n 'forkToken',\n 'repository',\n 'vulnerabilityAlertsOnly',\n 'vulnerabilityAlert',\n 'isVulnerabilityAlert',\n 'vulnerabilityFixVersion', // not intended to be used by end users but may be by Mend apps\n 'copyLocalLibs', // deprecated - functionality is now enabled by default\n 'prBody', // deprecated\n 'minimumConfidence', // undocumented feature flag\n];\nconst tzRe = regEx(/^:timezone\\((.+)\\)$/);\nconst rulesRe = regEx(/p.*Rules\\[\\d+\\]$/);\n\nfunction isIgnored(key: string): boolean {\n return ignoredNodes.includes(key);\n}\n\nfunction getUnsupportedEnabledManagers(enabledManagers: string[]): string[] {\n return enabledManagers.filter(\n (manager) => !allManagersList.includes(manager.replace('custom.', '')),\n );\n}\n\nfunction getDeprecationMessage(option: string): string | undefined {\n const deprecatedOptions: Record<string, string | undefined> = {\n branchName: `Direct editing of branchName is now deprecated. Please edit branchPrefix, additionalBranchPrefix, or branchTopic instead`,\n commitMessage: `Direct editing of commitMessage is now deprecated. Please edit commitMessage's subcomponents instead.`,\n prTitle: `Direct editing of prTitle is now deprecated. Please edit commitMessage subcomponents instead as they will be passed through to prTitle.`,\n };\n return deprecatedOptions[option];\n}\n\nfunction isInhertConfigOption(key: string): boolean {\n return optionInherits.has(key);\n}\n\nfunction isRegexOrGlobOption(key: string): boolean {\n return optionRegexOrGlob.has(key);\n}\n\nfunction isGlobalOption(key: string): boolean {\n return optionGlobals.has(key);\n}\n\nfunction initOptions(): void {\n if (optionsInitialized) {\n return;\n }\n\n optionParents = {};\n optionInherits = new Set();\n optionTypes = {};\n optionRegexOrGlob = new Set();\n optionGlobals = new Set();\n optionAllowsNegativeIntegers = new Set();\n\n for (const option of options) {\n optionTypes[option.name] = option.type;\n\n if (option.parents) {\n optionParents[option.name] = option.parents;\n }\n\n if (option.inheritConfigSupport) {\n optionInherits.add(option.name);\n }\n\n if (option.patternMatch) {\n optionRegexOrGlob.add(option.name);\n }\n\n if (option.globalOnly) {\n optionGlobals.add(option.name);\n }\n\n if (option.allowNegative) {\n optionAllowsNegativeIntegers.add(option.name);\n }\n }\n\n optionsInitialized = true;\n}\n\nexport async function validateConfig(\n configType: 'global' | 'inherit' | 'repo',\n config: AllConfig,\n isPreset?: boolean,\n parentPath?: string,\n): Promise<ValidationResult> {\n initOptions();\n\n let errors: ValidationMessage[] = [];\n let warnings: ValidationMessage[] = [];\n\n for (const [key, val] of Object.entries(config)) {\n const currentPath = parentPath ? `${parentPath}.${key}` : key;\n /* v8 ignore next 7 -- TODO: add test */\n if (key === '__proto__') {\n errors.push({\n topic: 'Config security error',\n message: '__proto__',\n });\n continue;\n }\n if (\n parentPath &&\n parentPath !== 'onboardingConfig' &&\n topLevelObjects.includes(key)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `The \"${key}\" object can only be configured at the top level of a config but was found inside \"${parentPath}\"`,\n });\n }\n\n if (isGlobalOption(key)) {\n if (configType === 'global') {\n await validateGlobalConfig(\n key,\n val,\n optionTypes[key],\n warnings,\n errors,\n currentPath,\n config,\n );\n continue;\n } else if (\n !isFalseGlobal(key, parentPath) &&\n !(configType === 'inherit' && isInhertConfigOption(key))\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `The \"${key}\" option is a global option reserved only for Renovate's global configuration and cannot be configured within a repository's config file.`,\n });\n continue;\n }\n }\n if (key === 'enabledManagers' && val) {\n const unsupportedManagers = getUnsupportedEnabledManagers(\n val as string[],\n );\n if (isNonEmptyArray(unsupportedManagers)) {\n errors.push({\n topic: 'Configuration Error',\n message: `The following managers configured in enabledManagers are not supported: \"${unsupportedManagers.join(\n ', ',\n )}\"`,\n });\n }\n }\n if (\n !isIgnored(key) && // We need to ignore some reserved keys\n !(is as any).function(val) // Ignore all functions\n ) {\n if (getDeprecationMessage(key)) {\n warnings.push({\n topic: 'Deprecation Warning',\n message: getDeprecationMessage(key)!,\n });\n }\n const templateKeys = [\n 'branchName',\n 'commitBody',\n 'commitMessage',\n 'prTitle',\n 'semanticCommitScope',\n ];\n if ((key.endsWith('Template') || templateKeys.includes(key)) && val) {\n try {\n // TODO: validate string #22198\n let res = template.compile((val as string).toString(), config, false);\n res = template.compile(res, config, false);\n template.compile(res, config, false);\n } catch {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid template in config path: ${currentPath}`,\n });\n }\n }\n const parentName = getParentName(parentPath);\n if (\n !isPreset &&\n optionParents[key] &&\n !optionParents[key].includes(parentName as AllowedParents)\n ) {\n // TODO: types (#22198)\n const options = optionParents[key]?.toSorted().join(', ');\n const message = `\"${key}\" can't be used in \"${parentName}\". Allowed objects: ${options}.`;\n warnings.push({\n topic: `${parentPath ? `${parentPath}.` : ''}${key}`,\n message,\n });\n }\n if (!optionTypes[key]) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid configuration option: ${currentPath}`,\n });\n } else if (key === 'schedule') {\n const [validSchedule, errorMessage] = hasValidSchedule(val as string[]);\n if (!validSchedule) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid ${currentPath}: \\`${errorMessage}\\``,\n });\n }\n } else if (\n [\n 'allowedVersions',\n 'matchCurrentVersion',\n 'matchCurrentValue',\n 'matchNewValue',\n ].includes(key) &&\n isRegexMatch(val)\n ) {\n if (!getRegexPredicate(val)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid regExp for ${currentPath}: \\`${val}\\``,\n });\n }\n } else if (key === 'timezone' && val !== null) {\n const [validTimezone, errorMessage] = hasValidTimezone(val as string);\n if (!validTimezone) {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath}: ${errorMessage}`,\n });\n }\n } else if (val !== null) {\n const type = optionTypes[key];\n if (type === 'boolean') {\n if (val !== true && val !== false) {\n errors.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be boolean. Found: ${JSON.stringify(\n val,\n )} (${typeof val})`,\n });\n }\n } else if (type === 'integer') {\n const allowsNegative = optionAllowsNegativeIntegers.has(key);\n errors.push(...validateNumber(key, val, allowsNegative, currentPath));\n } else if (type === 'array' && val) {\n if (isArray(val)) {\n for (const [subIndex, subval] of val.entries()) {\n if (isObject(subval)) {\n const subValidation = await validateConfig(\n configType,\n subval as RenovateConfig,\n isPreset,\n `${currentPath}[${subIndex}]`,\n );\n warnings = warnings.concat(subValidation.warnings);\n errors = errors.concat(subValidation.errors);\n }\n }\n if (isRegexOrGlobOption(key)) {\n errors.push(\n ...regexOrGlobValidator.check({\n val,\n currentPath,\n }),\n );\n }\n if (key === 'extends') {\n for (const subval of val) {\n if (isString(subval)) {\n if (configType !== 'global' && subval.startsWith('global:')) {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath}: you cannot extend from \"global:\" presets in a repository config's \"extends\"`,\n });\n }\n\n if (\n parentName === 'packageRules' &&\n subval.startsWith('group:')\n ) {\n warnings.push({\n topic: 'Configuration Warning',\n message: `${currentPath}: you should not extend \"group:\" presets`,\n });\n }\n if (tzRe.test(subval)) {\n const [, timezone] = tzRe.exec(subval)!;\n const [validTimezone, errorMessage] =\n hasValidTimezone(timezone);\n if (!validTimezone) {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath}: ${errorMessage}`,\n });\n }\n }\n } else {\n errors.push({\n topic: 'Configuration Warning',\n message: `${currentPath}: preset value is not a string`,\n });\n }\n }\n }\n\n const selectors = [\n 'matchFileNames',\n 'matchLanguages',\n 'matchCategories',\n 'matchBaseBranches',\n 'matchManagers',\n 'matchDatasources',\n 'matchDepTypes',\n 'matchDepNames',\n 'matchPackageNames',\n 'matchCurrentValue',\n 'matchCurrentVersion',\n 'matchSourceUrls',\n 'matchUpdateTypes',\n 'matchConfidence',\n 'matchCurrentAge',\n 'matchRepositories',\n 'matchNewValue',\n 'matchJsonata',\n ];\n if (key === 'packageRules') {\n for (const [subIndex, packageRule] of val.entries()) {\n if (isObject(packageRule)) {\n const { config: resolved } = await resolveConfigPresets(\n packageRule as RenovateConfig,\n config,\n );\n const resolvedRule = migrateConfig({\n packageRules: [resolved],\n }).migratedConfig.packageRules![0];\n warnings.push(\n ...matchBaseBranchesValidator.check({\n resolvedRule,\n currentPath: `${currentPath}[${subIndex}]`,\n baseBranchPatterns: config.baseBranchPatterns!,\n }),\n );\n const selectorLength = Object.keys(resolvedRule).filter(\n (ruleKey) => selectors.includes(ruleKey),\n ).length;\n if (!selectorLength) {\n const message = `${currentPath}[${subIndex}]: Each packageRule must contain at least one match* or exclude* selector. Rule: ${JSON.stringify(\n packageRule,\n )}`;\n errors.push({\n topic: 'Configuration Error',\n message,\n });\n }\n if (selectorLength === Object.keys(resolvedRule).length) {\n const message = `${currentPath}[${subIndex}]: Each packageRule must contain at least one non-match* or non-exclude* field. Rule: ${JSON.stringify(\n packageRule,\n )}`;\n warnings.push({\n topic: 'Configuration Error',\n message,\n });\n }\n // It's too late to apply any of these options once you already have updates determined\n const preLookupOptions = [\n 'allowedVersions',\n 'extractVersion',\n 'followTag',\n 'ignoreDeps',\n 'ignoreUnstable',\n 'rangeStrategy',\n 'registryUrls',\n 'respectLatest',\n 'rollbackPrs',\n 'separateMajorMinor',\n 'separateMinorPatch',\n 'separateMultipleMajor',\n 'separateMultipleMinor',\n 'versioning',\n ] as const;\n if (isNonEmptyArray(resolvedRule.matchUpdateTypes)) {\n for (const option of preLookupOptions) {\n if (resolvedRule[option] !== undefined) {\n const message = `${currentPath}[${subIndex}]: packageRules cannot combine both matchUpdateTypes and ${option}. Rule: ${JSON.stringify(\n packageRule,\n )}`;\n errors.push({\n topic: 'Configuration Error',\n message,\n });\n }\n }\n }\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath} must contain JSON objects`,\n });\n }\n }\n }\n if (key === 'customManagers') {\n const allowedKeys = [\n 'customType',\n 'description',\n 'fileFormat',\n 'managerFilePatterns',\n 'matchStrings',\n 'matchStringsStrategy',\n 'depNameTemplate',\n 'packageNameTemplate',\n 'datasourceTemplate',\n 'versioningTemplate',\n 'registryUrlTemplate',\n 'currentValueTemplate',\n 'extractVersionTemplate',\n 'autoReplaceStringTemplate',\n 'depTypeTemplate',\n ];\n for (const customManager of val as CustomManager[]) {\n if (\n Object.keys(customManager).some(\n (k) => !allowedKeys.includes(k),\n )\n ) {\n const disallowedKeys = Object.keys(customManager).filter(\n (k) => !allowedKeys.includes(k),\n );\n errors.push({\n topic: 'Configuration Error',\n message: `Custom Manager contains disallowed fields: ${disallowedKeys.join(\n ', ',\n )}`,\n });\n } else if (\n isNonEmptyString(customManager.customType) &&\n isCustomManager(customManager.customType)\n ) {\n if (isNonEmptyArray(customManager.managerFilePatterns)) {\n switch (customManager.customType) {\n case 'regex':\n validateRegexManagerFields(\n customManager,\n currentPath,\n errors,\n );\n break;\n case 'jsonata':\n validateJSONataManagerFields(\n customManager,\n currentPath,\n errors,\n );\n break;\n }\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `Each Custom Manager must contain a non-empty managerFilePatterns array`,\n });\n }\n } else {\n if (\n isEmptyString(customManager.customType) ||\n isUndefined(customManager.customType)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `Each Custom Manager must contain a non-empty customType string`,\n });\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid customType: ${customManager.customType}. Key is not a custom manager`,\n });\n }\n }\n }\n }\n if (['matchPackageNames', 'matchDepNames'].includes(key)) {\n const startPattern = regEx(/!?\\//);\n const endPattern = regEx(/\\/g?i?$/);\n for (const pattern of val as string[]) {\n if (startPattern.test(pattern) && endPattern.test(pattern)) {\n try {\n // regEx isn't aware of our !/ prefix but can handle the suffix\n regEx(pattern.replace(startPattern, '/'));\n } catch {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid regExp for ${currentPath}: \\`${pattern}\\``,\n });\n }\n }\n }\n }\n if (key === 'baseBranchPatterns') {\n for (const baseBranchPattern of val as string[]) {\n if (\n isRegexMatch(baseBranchPattern) &&\n !getRegexPredicate(baseBranchPattern)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid regExp for ${currentPath}: \\`${baseBranchPattern}\\``,\n });\n }\n }\n }\n if (\n (selectors.includes(key) ||\n key === 'matchCurrentVersion' ||\n key === 'matchCurrentValue') &&\n // TODO: can be undefined ? #22198\n !rulesRe.test(parentPath!) && // Inside a packageRule\n (isString(parentPath) || !isPreset) // top level in a preset\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `${currentPath}: ${key} should be inside a \\`packageRule\\` only`,\n });\n }\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a list (Array)`,\n });\n }\n } else if (type === 'string') {\n if (!isString(val)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a string`,\n });\n }\n } else if (\n type === 'object' &&\n currentPath !== 'compatibility' &&\n key !== 'constraints'\n ) {\n if (isPlainObject(val)) {\n if (key === 'registryAliases') {\n const res = validatePlainObject(val);\n if (res !== true) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${key}.${res}\\` configuration: value is not a string`,\n });\n }\n } else if (key === 'env') {\n const allowedEnvVars =\n configType === 'global'\n ? (config.allowedEnv ?? [])\n : GlobalConfig.get('allowedEnv', []);\n for (const [envVarName, envVarValue] of Object.entries(val)) {\n if (!isString(envVarValue)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid env variable value: \\`${currentPath}.${envVarName}\\` must be a string.`,\n });\n }\n if (!matchRegexOrGlobList(envVarName, allowedEnvVars)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Env variable name \\`${envVarName}\\` is not allowed by this bot's \\`allowedEnv\\`.`,\n });\n }\n }\n } else if (key === 'statusCheckNames') {\n for (const [statusCheckKey, statusCheckValue] of Object.entries(\n val,\n )) {\n if (\n !allowedStatusCheckStrings.includes(\n statusCheckKey as StatusCheckKey,\n )\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${key}.${statusCheckKey}\\` configuration: key is not allowed.`,\n });\n }\n if (\n !(isString(statusCheckValue) || null === statusCheckValue)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${statusCheckKey}\\` configuration: status check is not a string.`,\n });\n continue;\n }\n }\n } else if (key === 'customDatasources') {\n const allowedKeys = [\n 'description',\n 'defaultRegistryUrlTemplate',\n 'format',\n 'transformTemplates',\n ];\n for (const [\n customDatasourceName,\n customDatasourceValue,\n ] of Object.entries(val)) {\n if (!isPlainObject(customDatasourceValue)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${customDatasourceName}\\` configuration: customDatasource is not an object`,\n });\n continue;\n }\n for (const [subKey, subValue] of Object.entries(\n customDatasourceValue,\n )) {\n if (!allowedKeys.includes(subKey)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${subKey}\\` configuration: key is not allowed`,\n });\n } else if (subKey === 'transformTemplates') {\n if (!isArray(subValue, isString)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${subKey}\\` configuration: is not an array of string`,\n });\n }\n } else if (subKey === 'description') {\n if (!(isString(subValue) || isArray(subValue, isString))) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${subKey}\\` configuration: is not an array of strings`,\n });\n }\n } else if (!isString(subValue)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${subKey}\\` configuration: is a string`,\n });\n }\n }\n }\n } else {\n const ignoredObjects = options\n .filter((option) => option.freeChoice)\n .map((option) => option.name);\n if (!ignoredObjects.includes(key)) {\n const subValidation = await validateConfig(\n configType,\n val,\n isPreset,\n currentPath,\n );\n warnings = warnings.concat(subValidation.warnings);\n errors = errors.concat(subValidation.errors);\n }\n }\n } else {\n errors.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a json object`,\n });\n }\n }\n }\n }\n\n if (key === 'hostRules' && isArray(val)) {\n const allowedHeaders =\n configType === 'global'\n ? (config.allowedHeaders ?? [])\n : GlobalConfig.get('allowedHeaders', []);\n for (const rule of val as HostRule[]) {\n if (isNonEmptyString(rule.matchHost)) {\n if (rule.matchHost.includes('://')) {\n if (parseUrl(rule.matchHost) === null) {\n errors.push({\n topic: 'Configuration Error',\n message: `hostRules matchHost \\`${rule.matchHost}\\` is not a valid URL.`,\n });\n }\n }\n } else if (isEmptyString(rule.matchHost)) {\n errors.push({\n topic: 'Configuration Error',\n message:\n 'Invalid value for hostRules matchHost. It cannot be an empty string.',\n });\n }\n\n if (!rule.headers) {\n continue;\n }\n for (const [header, value] of Object.entries(rule.headers)) {\n if (!isString(value)) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid hostRules headers value configuration: header must be a string.`,\n });\n }\n if (!matchRegexOrGlobList(header, allowedHeaders)) {\n errors.push({\n topic: 'Configuration Error',\n message: `hostRules header \\`${header}\\` is not allowed by this bot's \\`allowedHeaders\\`.`,\n });\n }\n }\n }\n }\n\n if (key === 'matchJsonata' && isArray(val, isString)) {\n for (const expression of val) {\n const res = getExpression(expression);\n if (res instanceof Error) {\n errors.push({\n topic: 'Configuration Error',\n message: `Invalid JSONata expression for ${currentPath}: ${res.message}`,\n });\n }\n }\n }\n }\n\n function sortAll(a: ValidationMessage, b: ValidationMessage): number {\n if (a.topic === b.topic) {\n return a.message > b.message ? 1 : -1;\n }\n return a.topic > b.topic ? 1 : -1;\n }\n\n errors.sort(sortAll);\n warnings.sort(sortAll);\n return { errors, warnings };\n}\n\n/**\n * Basic validation for global config options\n */\nasync function validateGlobalConfig(\n key: string,\n val: unknown,\n type: string,\n warnings: ValidationMessage[],\n errors: ValidationMessage[],\n currentPath: string | undefined,\n config: AllConfig,\n): Promise<void> {\n /* v8 ignore next 5 -- not testable yet */\n if (getDeprecationMessage(key)) {\n warnings.push({\n topic: 'Deprecation Warning',\n message: getDeprecationMessage(key)!,\n });\n }\n if (val !== null) {\n // v8 ignore else -- TODO: add test #40625\n if (type === 'string') {\n if (isString(val)) {\n if (\n key === 'onboardingConfigFileName' &&\n !getPossibleConfigFileNames({\n configFileNames: config.configFileNames,\n platform: config.platform,\n }).includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${getPossibleConfigFileNames(\n {\n configFileNames: config.configFileNames,\n platform: config.platform,\n },\n ).join(', ')}.`,\n });\n } else if (\n key === 'repositoryCache' &&\n !['enabled', 'disabled', 'reset'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['enabled', 'disabled', 'reset'].join(', ')}.`,\n });\n } else if (\n key === 'dryRun' &&\n !['extract', 'lookup', 'full'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['extract', 'lookup', 'full'].join(', ')}.`,\n });\n } else if (\n key === 'binarySource' &&\n !['docker', 'global', 'install', 'hermit'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['docker', 'global', 'install', 'hermit'].join(', ')}.`,\n });\n } else if (\n key === 'requireConfig' &&\n !['required', 'optional', 'ignored'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['required', 'optional', 'ignored'].join(', ')}.`,\n });\n } else if (\n key === 'gitUrl' &&\n !['default', 'ssh', 'endpoint'].includes(val)\n ) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${val}\\` for \\`${currentPath}\\`. The allowed values are ${['default', 'ssh', 'endpoint'].join(', ')}.`,\n });\n }\n\n if (\n key === 'reportType' &&\n ['s3', 'file'].includes(val) &&\n !isString(config.reportPath)\n ) {\n errors.push({\n topic: 'Configuration Error',\n message: `reportType '${val}' requires a configured reportPath`,\n });\n }\n } else {\n warnings.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a string.`,\n });\n }\n } else if (type === 'integer') {\n const allowsNegative = optionAllowsNegativeIntegers.has(key);\n warnings.push(...validateNumber(key, val, allowsNegative, currentPath));\n } else if (type === 'boolean') {\n if (val !== true && val !== false) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a boolean. Found: ${JSON.stringify(\n val,\n )} (${typeof val}).`,\n });\n }\n } else if (type === 'array') {\n if (isArray(val)) {\n if (isRegexOrGlobOption(key)) {\n warnings.push(\n ...regexOrGlobValidator.check({\n val,\n currentPath: currentPath!,\n }),\n );\n }\n if (key === 'gitNoVerify') {\n const allowedValues = ['commit', 'push'];\n for (const value of val as string[]) {\n // v8 ignore else -- TODO: add test #40625\n if (!allowedValues.includes(value)) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value for \\`${currentPath}\\`. The allowed values are ${allowedValues.join(', ')}.`,\n });\n }\n }\n }\n if (key === 'mergeConfidenceDatasources') {\n const allowedValues = supportedDatasources;\n for (const value of val as string[]) {\n // v8 ignore else -- TODO: add test #40625\n if (!allowedValues.includes(value)) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid value \\`${value}\\` for \\`${currentPath}\\`. The allowed values are ${allowedValues.join(', ')}.`,\n });\n }\n }\n }\n } else {\n warnings.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a list (Array).`,\n });\n }\n } else if (type === 'object') {\n if (isPlainObject(val)) {\n if (key === 'onboardingConfig') {\n const subValidation = await validateConfig('repo', val);\n for (const warning of subValidation.warnings.concat(\n subValidation.errors,\n )) {\n warnings.push(warning);\n }\n } else if (key === 'force') {\n const subValidation = await validateConfig('global', val);\n for (const warning of subValidation.warnings.concat(\n subValidation.errors,\n )) {\n warnings.push(warning);\n }\n } else if (key === 'cacheTtlOverride') {\n for (const [subKey, subValue] of Object.entries(val)) {\n const allowsNegative = optionAllowsNegativeIntegers.has(key);\n warnings.push(\n ...validateNumber(\n key,\n subValue,\n allowsNegative,\n currentPath,\n subKey,\n ),\n );\n }\n } else {\n const res = validatePlainObject(val);\n if (res !== true) {\n warnings.push({\n topic: 'Configuration Error',\n message: `Invalid \\`${currentPath}.${res}\\` configuration: value must be a string.`,\n });\n }\n }\n } else {\n warnings.push({\n topic: 'Configuration Error',\n message: `Configuration option \\`${currentPath}\\` should be a JSON object.`,\n });\n }\n }\n }\n}\n\nfunction getPossibleConfigFileNames({\n configFileNames,\n platform,\n}: {\n configFileNames?: string[];\n platform?: PlatformId;\n}): string[] {\n const filenames = getConfigFileNames(platform);\n if (isNonEmptyArray(configFileNames)) {\n return filenames.concat(configFileNames);\n }\n\n return filenames;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;0BAgBsC;6CAKR;sBAES;AAgCvC,MAAM,UAAUA,4BAAY;AAE5B,IAAI,qBAAqB;AACzB,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAIJ,MAAM,kBAAkB,CAAC,GAFLC,gCAAgB,EAEK,MAAM;AAE/C,MA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AU,IAAI;AACzD,QAAK,MAAM,WAAW,cAAc,SAAS,OAC3C,cAAc,OACf,CACC,UAAS,KAAK,QAAQ;aAEf,QAAQ,mBACjB,MAAK,MAAM,CAAC,QAAQ,aAAa,OAAO,QAAQ,IAAI,EAAE;GACpD,MAAM,iBAAiB,6BAA6B,IAAI,IAAI;AAC5D,YAAS,KACP,GAAGX,6BACD,KACA,UACA,gBACA,aACA,OACD,CACF;;OAEE;GACL,MAAM,MAAMI,kCAAoB,IAAI;AACpC,OAAI,QAAQ,KACV,UAAS,KAAK;IACZ,OAAO;IACP,SAAS,aAAa,YAAY,GAAG,IAAI;IAC1C,CAAC;;MAIN,UAAS,KAAK;GACZ,OAAO;GACP,SAAS,0BAA0B,YAAY;GAChD,CAAC;;;AAMV,SAAS,2BAA2B,EAClC,iBACA,YAIW;CACX,MAAM,YAAYQ,uCAAmB,SAAS;AAC9C,2CAAoB,gBAAgB,CAClC,QAAO,UAAU,OAAO,gBAAgB;AAG1C,QAAO"}
|
|
@@ -10,8 +10,6 @@ const require_common = require('./common.js');
|
|
|
10
10
|
let _sindresorhus_is = require("@sindresorhus/is");
|
|
11
11
|
let ini = require("ini");
|
|
12
12
|
ini = require_rolldown_runtime.__toESM(ini);
|
|
13
|
-
let node_url = require("node:url");
|
|
14
|
-
node_url = require_rolldown_runtime.__toESM(node_url);
|
|
15
13
|
|
|
16
14
|
//#region lib/modules/datasource/npm/npmrc.ts
|
|
17
15
|
require_index.init_logger();
|
|
@@ -133,7 +131,7 @@ function resolveRegistryUrl(packageName) {
|
|
|
133
131
|
return registryUrl;
|
|
134
132
|
}
|
|
135
133
|
function resolvePackageUrl(registryUrl, packageName) {
|
|
136
|
-
return
|
|
134
|
+
return new URL(encodeURIComponent(packageName).replace(require_regex.regEx(/^%40/), "@"), require_url.ensureTrailingSlash(registryUrl)).href;
|
|
137
135
|
}
|
|
138
136
|
|
|
139
137
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npmrc.js","names":["getEnv","regEx","fromBase64","isHttpUrl","GlobalConfig","defaultRegistryUrls","
|
|
1
|
+
{"version":3,"file":"npmrc.js","names":["getEnv","regEx","fromBase64","isHttpUrl","GlobalConfig","defaultRegistryUrls","ensureTrailingSlash"],"sources":["../../../../lib/modules/datasource/npm/npmrc.ts"],"sourcesContent":["import { isNonEmptyString, isString } from '@sindresorhus/is';\nimport ini from 'ini';\nimport { GlobalConfig } from '../../../config/global';\nimport type { PackageRule } from '../../../config/types';\nimport { logger } from '../../../logger';\nimport type { HostRule } from '../../../types';\nimport { getEnv } from '../../../util/env';\nimport * as hostRules from '../../../util/host-rules';\nimport { regEx } from '../../../util/regex';\nimport { fromBase64 } from '../../../util/string';\nimport { ensureTrailingSlash, isHttpUrl } from '../../../util/url';\nimport { defaultRegistryUrls } from './common';\nimport type { NpmrcRules } from './types';\n\nlet npmrc: Record<string, any> = {};\nlet npmrcRaw = '';\nlet packageRules: PackageRule[] = [];\n\nfunction envReplace(value: any, env = getEnv()): any {\n /* v8 ignore next 3 -- TODO: add test */\n if (!isString(value)) {\n return value;\n }\n\n const ENV_EXPR = regEx(/(\\\\*)\\$\\{([^}]+)\\}/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 if (npmrc) {\n logger.debug('Resetting npmrc');\n npmrc = {};\n npmrcRaw = '';\n packageRules = [];\n }\n}\n\nexport function resolveRegistryUrl(packageName: string): string {\n let registryUrl = defaultRegistryUrls[0];\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":";;;;;;;;;;;;;;2BAIyC;sBAEE;0BAEC;4BACM;sBACiB;AAInE,IAAI,QAA6B,EAAE;AACnC,IAAI,WAAW;AACf,IAAI,eAA8B,EAAE;AAEpC,SAAS,WAAW,OAAY,MAAMA,oBAAQ,EAAO;;AAEnD,KAAI,gCAAU,MAAM,CAClB,QAAO;CAGT,MAAM,WAAWC,oBAAM,sBAAsB;AAE7C,QAAO,MAAM,QAAQ,WAAW,OAAO,MAAM,eAAe;AAC1D,MAAI,IAAI,gBAAgB,QAAW;AACjC,wBAAO,KAAK,EAAE,OAAO,EAAE,kCAAkC;AACzD,SAAM,IAAI,MAAM,cAAc;;AAEhC,SAAO,IAAI;GACX;;AAGJ,SAAgB,0BAA0B,OAAuB;AAC/D,KAAI,MAAM,WAAW,KAAK,EAAE;EAC1B,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J,oBAAM,QAAQ,EAAE,GAAG,CAAC,CAGxE,eAAc,aAAc;;AAGhC,QAAO;;AAGT,SAAgB,kBACd,aACA,aACQ;AACR,QAAO,IAAI,IACT,mBAAmB,YAAY,CAAC,QAAQA,oBAAM,OAAO,EAAE,IAAI,EAC3DK,gCAAoB,YAAY,CACjC,CAAC"}
|
|
@@ -11,8 +11,6 @@ const require_index$1 = require('../../versioning/pep440/index.js');
|
|
|
11
11
|
const require_html = require('../../../util/html.js');
|
|
12
12
|
const require_common = require('./common.js');
|
|
13
13
|
let _sindresorhus_is = require("@sindresorhus/is");
|
|
14
|
-
let node_url = require("node:url");
|
|
15
|
-
node_url = require_rolldown_runtime.__toESM(node_url);
|
|
16
14
|
let changelog_filename_regex = require("changelog-filename-regex");
|
|
17
15
|
changelog_filename_regex = require_rolldown_runtime.__toESM(changelog_filename_regex);
|
|
18
16
|
|
|
@@ -79,7 +77,7 @@ var PypiDatasource = class PypiDatasource extends require_datasource.Datasource
|
|
|
79
77
|
return {};
|
|
80
78
|
}
|
|
81
79
|
async getDependency(packageName, hostUrl) {
|
|
82
|
-
const lookupUrl =
|
|
80
|
+
const lookupUrl = new URL(`${require_common.normalizePythonDepName(packageName)}/json`, hostUrl).href;
|
|
83
81
|
const dependency = { releases: [] };
|
|
84
82
|
require_index.logger.trace({ lookupUrl }, "Pypi api got lookup");
|
|
85
83
|
const headers = await this.getAuthHeaders(lookupUrl);
|
|
@@ -144,7 +142,7 @@ var PypiDatasource = class PypiDatasource extends require_datasource.Datasource
|
|
|
144
142
|
return html.replace(require_regex.regEx(/<\/?pre>/), "").replace(require_regex.regEx(/data-requires-python="([^"]*?)>([^"]*?)"/g), "data-requires-python=\"$1>$2\"").replace(require_regex.regEx(/data-requires-python="([^"]*?)<([^"]*?)"/g), "data-requires-python=\"$1<$2\"");
|
|
145
143
|
}
|
|
146
144
|
async getSimpleDependency(packageName, hostUrl) {
|
|
147
|
-
const lookupUrl =
|
|
145
|
+
const lookupUrl = new URL(require_url.ensureTrailingSlash(require_common.normalizePythonDepName(packageName)), hostUrl).href;
|
|
148
146
|
const dependency = { releases: [] };
|
|
149
147
|
const headers = await this.getAuthHeaders(lookupUrl);
|
|
150
148
|
const response = await this.http.getText(lookupUrl, { headers });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Datasource","getEnv","ensureTrailingSlash","normalizePythonDepName","parseUrl","getGoogleAuthToken","url","isGitHubRepo","changelogFilenameRegex","coerceArray","asTimestamp","isString","regEx","parse"],"sources":["../../../../lib/modules/datasource/pypi/index.ts"],"sourcesContent":["import url from 'node:url';\nimport { isString } 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(isString);\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"],"mappings":";;;;;;;;;;;;;;;;;;;2BAGyC;sBAEE;0BAGC;sBAEsB;AAQlE,IAAa,iBAAb,MAAa,uBAAuBA,8BAAW;CAC7C,OAAgB,KAAK;CAErB,cAAc;AACZ,QAAM,eAAe,GAAG;;CAG1B,AAAkB,UAAU;CAE5B,AAAkB,wBAAwB;CAE1C,OAAgB,aACdC,oBAAQ,CAAC,iBAAiB;CAC5B,AAAkB,sBAAsB,CAAC,eAAe,WAAW;CAEnE,AAAkB;CAElB,AAAkB,mBAAmB;CAErC,AAAkB,0BAA0B;CAC5C,AAAkB,uBAChB;CACF,AAAkB,mBAAmB;CACrC,AAAkB,gBAChB;CAEF,MAAM,YAAY,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,MAAM,MAAM,EACjB,YACD;AACD,OAAI,SAAS;IACX,MAAM,UAA2B,EAC/B,QAAQ,KAAK,aAAa,cAAc,EACzC;IACD,MAAM,iBAAiB,KAAK,aAAa,uBAAuB;AAChE,QAAI,eACF,SAAQ,kBAAkB;AAE5B,QAAI,CAAC,SAAS,SACZ,UAAS,WAAW,EAAE;AAExB,aAAS,SAAS,KAAK,QAAQ;;;AAInC,aAAW,WADM,OAAO,KAAK,SAAS,CACP,KAAK,YAAY;GAC9C,MAAM,kBAAkBJ,0BAAY,SAAS,SAAS;GACtD,MAAM,eAAe,gBAAgB,MAAM,EAAE,aAAa,OAAO;GACjE,MAAM,SAAkB,EAAE,SAAS;AACnC,OAAI,aACF,QAAO,eAAe;AAGxB,UAAO,cAAc,EAEnB,QAAQ,gBAAgB,KACrB,EAAE,sBAAsB,gBAC1B,EACF;AACD,UAAO;IACP;AACF,SAAO"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Datasource","getEnv","ensureTrailingSlash","normalizePythonDepName","parseUrl","getGoogleAuthToken","isGitHubRepo","changelogFilenameRegex","coerceArray","asTimestamp","isString","regEx","parse"],"sources":["../../../../lib/modules/datasource/pypi/index.ts"],"sourcesContent":["import { isString } 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 = new URL(\n `${normalizePythonDepName(packageName)}/json`,\n hostUrl,\n ).href;\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(isString);\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 = new URL(\n ensureTrailingSlash(normalizePythonDepName(packageName)),\n hostUrl,\n ).href;\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"],"mappings":";;;;;;;;;;;;;;;;;2BAEyC;sBAEE;0BAGC;sBAEsB;AA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AK,KAAK,QAAQ,WAAW,EAAE,SAAS,CAAC;EAChE,MAAM,MAAM,UAAU;AACtB,MAAI,CAAC,KAAK;AACR,wBAAO,MAAM,EAAE,YAAY,aAAa,EAAE,wBAAwB;AAClE,UAAO;;AAET,MAAI,SAAS,cACX,YAAW,YAAY;EAGzB,MAAM,QADOS,mBAAM,eAAe,gBAAgB,IAAI,CAAC,CACpC,iBAAiB,IAAI;EACxC,MAAM,WAAqB,EAAE;AAC7B,OAAK,MAAM,QAAQ,MAAM,KAAK,MAAM,EAAE;GACpC,MAAM,UAAU,eAAe,2BAC7B,KAAK,MAAM,MAAM,EACjB,YACD;AACD,OAAI,SAAS;IACX,MAAM,UAA2B,EAC/B,QAAQ,KAAK,aAAa,cAAc,EACzC;IACD,MAAM,iBAAiB,KAAK,aAAa,uBAAuB;AAChE,QAAI,eACF,SAAQ,kBAAkB;AAE5B,QAAI,CAAC,SAAS,SACZ,UAAS,WAAW,EAAE;AAExB,aAAS,SAAS,KAAK,QAAQ;;;AAInC,aAAW,WADM,OAAO,KAAK,SAAS,CACP,KAAK,YAAY;GAC9C,MAAM,kBAAkBJ,0BAAY,SAAS,SAAS;GACtD,MAAM,eAAe,gBAAgB,MAAM,EAAE,aAAa,OAAO;GACjE,MAAM,SAAkB,EAAE,SAAS;AACnC,OAAI,aACF,QAAO,eAAe;AAGxB,UAAO,cAAc,EAEnB,QAAQ,gBAAgB,KACrB,EAAE,sBAAsB,gBAC1B,EACF;AACD,UAAO;IACP;AACF,SAAO"}
|
|
@@ -32,9 +32,8 @@ var SbtPluginDatasource = class SbtPluginDatasource extends require_datasource.D
|
|
|
32
32
|
const pkgUrl = require_url.ensureTrailingSlash(searchRoot);
|
|
33
33
|
const indexContent = await require_util.downloadHttpContent(this.http, pkgUrl);
|
|
34
34
|
if (indexContent) {
|
|
35
|
-
const rootPath = new URL(pkgUrl).pathname;
|
|
36
35
|
let artifactSubdirs = require_util$1.extractPageLinks(indexContent, (href) => {
|
|
37
|
-
const path = href.
|
|
36
|
+
const path = href.split("/").at(-1);
|
|
38
37
|
if (path.startsWith(`${artifact}_native`) || path.startsWith(`${artifact}_sjs`)) return null;
|
|
39
38
|
if (path === artifact || path.startsWith(`${artifact}_`)) return path;
|
|
40
39
|
return null;
|
|
@@ -51,14 +50,11 @@ var SbtPluginDatasource = class SbtPluginDatasource extends require_datasource.D
|
|
|
51
50
|
for (const searchSubdir of artifactSubdirs) {
|
|
52
51
|
const pkgUrl = require_url.ensureTrailingSlash(`${searchRoot}/${searchSubdir}`);
|
|
53
52
|
const content = await require_util.downloadHttpContent(this.http, pkgUrl);
|
|
54
|
-
if (content) {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return path;
|
|
60
|
-
}).forEach((x) => releases.push(x));
|
|
61
|
-
}
|
|
53
|
+
if (content) require_util$1.extractPageLinks(content, (href) => {
|
|
54
|
+
const path = href.split("/").at(-1);
|
|
55
|
+
if (path.startsWith(".")) return null;
|
|
56
|
+
return path;
|
|
57
|
+
}).forEach((x) => releases.push(x));
|
|
62
58
|
}
|
|
63
59
|
if (releases.length) return [...new Set(releases)].sort(require_compare.compare);
|
|
64
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Datasource","MAVEN_REPO","Http","ensureTrailingSlash","downloadHttpContent","extractPageLinks","compare","XmlDocument","regEx","getLatestVersion"],"sources":["../../../../lib/modules/datasource/sbt-plugin/index.ts"],"sourcesContent":["import { XmlDocument } from 'xmldoc';\nimport { logger } from '../../../logger';\nimport { Http } from '../../../util/http';\nimport { regEx } from '../../../util/regex';\nimport { ensureTrailingSlash } from '../../../util/url';\nimport * as ivyVersioning from '../../versioning/ivy';\nimport { compare } from '../../versioning/maven/compare';\nimport { Datasource } from '../datasource';\nimport { MAVEN_REPO } from '../maven/common';\nimport { downloadHttpContent } from '../maven/util';\nimport { extractPageLinks, getLatestVersion } from '../sbt-package/util';\nimport type {\n GetReleasesConfig,\n RegistryStrategy,\n ReleaseResult,\n} from '../types';\n\nexport const SBT_PLUGINS_REPO =\n 'https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases';\n\nexport class SbtPluginDatasource extends Datasource {\n static readonly id = 'sbt-plugin';\n\n override readonly defaultRegistryUrls = [SBT_PLUGINS_REPO, MAVEN_REPO];\n\n override readonly defaultVersioning = ivyVersioning.id;\n\n override readonly registryStrategy: RegistryStrategy = 'merge';\n\n override readonly sourceUrlSupport = 'package';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `scm` tags in the results.';\n\n constructor() {\n super(SbtPluginDatasource.id);\n this.http = new Http('sbt');\n }\n\n // istanbul ignore next: to be rewritten\n async getArtifactSubdirs(\n searchRoot: string,\n artifact: string,\n scalaVersion: string,\n ): Promise<string[] | null> {\n const pkgUrl = ensureTrailingSlash(searchRoot);\n const indexContent = await downloadHttpContent(this.http, pkgUrl);\n if (indexContent) {\n const rootPath = new URL(pkgUrl).pathname;\n let artifactSubdirs = extractPageLinks(indexContent, (href) => {\n const path = href.replace(rootPath, '');\n if (\n path.startsWith(`${artifact}_native`) ||\n path.startsWith(`${artifact}_sjs`)\n ) {\n return null;\n }\n\n if (path === artifact || path.startsWith(`${artifact}_`)) {\n return path;\n }\n\n return null;\n });\n\n if (\n scalaVersion &&\n artifactSubdirs.includes(`${artifact}_${scalaVersion}`)\n ) {\n artifactSubdirs = [`${artifact}_${scalaVersion}`];\n }\n return artifactSubdirs;\n }\n\n return null;\n }\n\n // istanbul ignore next: to be rewritten\n async getPackageReleases(\n searchRoot: string,\n artifactSubdirs: string[] | null,\n ): Promise<string[] | null> {\n if (artifactSubdirs) {\n const releases: string[] = [];\n for (const searchSubdir of artifactSubdirs) {\n const pkgUrl = ensureTrailingSlash(`${searchRoot}/${searchSubdir}`);\n const content = await downloadHttpContent(this.http, pkgUrl);\n if (content) {\n const rootPath = new URL(pkgUrl).pathname;\n const subdirReleases = extractPageLinks(content, (href) => {\n const path = href.replace(rootPath, '');\n if (path.startsWith('.')) {\n return null;\n }\n\n return path;\n });\n\n subdirReleases.forEach((x) => releases.push(x));\n }\n }\n if (releases.length) {\n return [...new Set(releases)].sort(compare);\n }\n }\n\n return null;\n }\n\n // istanbul ignore next: to be rewritten\n async getUrls(\n searchRoot: string,\n artifactDirs: string[] | null,\n version: string | null,\n ): Promise<Partial<ReleaseResult>> {\n const result: Partial<ReleaseResult> = {};\n\n if (!artifactDirs?.length) {\n return result;\n }\n\n if (!version) {\n return result;\n }\n\n for (const artifactDir of artifactDirs) {\n const [artifact] = artifactDir.split('_');\n const pomFileNames = [\n `${artifactDir}-${version}.pom`,\n `${artifact}-${version}.pom`,\n ];\n\n for (const pomFileName of pomFileNames) {\n const pomUrl = `${searchRoot}/${artifactDir}/${version}/${pomFileName}`;\n const content = await downloadHttpContent(this.http, pomUrl);\n if (content) {\n const pomXml = new XmlDocument(content);\n\n const homepage = pomXml.valueWithPath('url');\n if (homepage) {\n result.homepage = homepage;\n }\n\n const sourceUrl = pomXml.valueWithPath('scm.url');\n if (sourceUrl) {\n result.sourceUrl = sourceUrl\n .replace(regEx(/^scm:/), '')\n .replace(regEx(/^git:/), '')\n .replace(regEx(/^git@github.com:/), 'https://github.com/')\n .replace(regEx(/\\.git$/), '');\n }\n\n return result;\n }\n }\n }\n\n return result;\n }\n\n async resolvePluginReleases(\n rootUrl: string,\n artifact: string,\n scalaVersion: string,\n ): Promise<string[] | null> {\n const searchRoot = `${rootUrl}/${artifact}`;\n const hrefFilterMap = (href: string): string | null => {\n if (href.startsWith('.')) {\n return null;\n }\n\n return href;\n };\n const searchRootContent = await downloadHttpContent(\n this.http,\n ensureTrailingSlash(searchRoot),\n );\n if (searchRootContent) {\n const releases: string[] = [];\n const scalaVersionItems = extractPageLinks(\n searchRootContent,\n hrefFilterMap,\n );\n const scalaVersions = scalaVersionItems.map((x) =>\n x.replace(regEx(/^scala_/), ''),\n );\n const searchVersions = scalaVersions.includes(scalaVersion)\n ? [scalaVersion]\n : scalaVersions;\n for (const searchVersion of searchVersions) {\n const searchSubRoot = `${searchRoot}/scala_${searchVersion}`;\n const subRootContent = await downloadHttpContent(\n this.http,\n ensureTrailingSlash(searchSubRoot),\n );\n if (subRootContent) {\n const sbtVersionItems = extractPageLinks(\n subRootContent,\n hrefFilterMap,\n );\n for (const sbtItem of sbtVersionItems) {\n const releasesRoot = `${searchSubRoot}/${sbtItem}`;\n const releasesIndexContent = await downloadHttpContent(\n this.http,\n ensureTrailingSlash(releasesRoot),\n );\n if (releasesIndexContent) {\n const releasesParsed = extractPageLinks(\n releasesIndexContent,\n hrefFilterMap,\n );\n releasesParsed.forEach((x) => releases.push(x));\n }\n }\n }\n }\n if (releases.length) {\n return [...new Set(releases)].sort(compare);\n }\n }\n return null;\n }\n\n override async getReleases({\n packageName,\n registryUrl,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n /* v8 ignore next 3 -- should never happen */\n if (!registryUrl) {\n return null;\n }\n\n const [groupId, artifactId] = packageName.split(':');\n const groupIdSplit = groupId.split('.');\n const artifactIdSplit = artifactId.split('_');\n const [artifact, scalaVersion] = artifactIdSplit;\n\n const repoRoot = ensureTrailingSlash(registryUrl);\n const searchRoots: string[] = [];\n // Optimize lookup order\n if (!registryUrl.startsWith(MAVEN_REPO)) {\n searchRoots.push(`${repoRoot}${groupIdSplit.join('.')}`);\n }\n searchRoots.push(`${repoRoot}${groupIdSplit.join('/')}`);\n\n for (const searchRoot of searchRoots) {\n let versions = await this.resolvePluginReleases(\n searchRoot,\n artifact,\n scalaVersion,\n );\n let urls = {};\n\n if (!versions?.length) {\n const artifactSubdirs = await this.getArtifactSubdirs(\n searchRoot,\n artifact,\n scalaVersion,\n );\n versions = await this.getPackageReleases(searchRoot, artifactSubdirs);\n const latestVersion = getLatestVersion(versions);\n urls = await this.getUrls(searchRoot, artifactSubdirs, latestVersion);\n }\n\n const dependencyUrl = `${searchRoot}/${artifact}`;\n\n logger.trace({ dependency: packageName, versions }, `Package versions`);\n if (versions) {\n return {\n ...urls,\n dependencyUrl,\n releases: versions.map((v) => ({ version: v })),\n };\n }\n }\n\n logger.debug(\n `No versions found for ${packageName} in ${searchRoots.length} repositories`,\n );\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;2BACyC;0BAEG;sBACY;AAaxD,MAAa,mBACX;AAEF,IAAa,sBAAb,MAAa,4BAA4BA,8BAAW;CAClD,OAAgB,KAAK;CAErB,AAAkB,sBAAsB,CAAC,kBAAkBC,0BAAW;CAEtE,AAAkB;CAElB,AAAkB,mBAAqC;CAEvD,AAAkB,mBAAmB;CACrC,AAAkB,gBAChB;CAEF,cAAc;AACZ,QAAM,oBAAoB,GAAG;AAC7B,OAAK,OAAO,IAAIC,qBAAK,MAAM;;;CAI7B,MAAM,mBACJ,YACA,UACA,cAC0B;EAC1B,MAAM,SAASC,gCAAoB,WAAW;EAC9C,MAAM,eAAe,MAAMC,iCAAoB,KAAK,MAAM,OAAO;AACjE,MAAI,cAAc;GAChB,MAAM,WAAW,IAAI,IAAI,OAAO,CAAC;GACjC,IAAI,kBAAkBC,gCAAiB,eAAe,SAAS;IAC7D,MAAM,OAAO,KAAK,QAAQ,UAAU,GAAG;AACvC,QACE,KAAK,WAAW,GAAG,SAAS,SAAS,IACrC,KAAK,WAAW,GAAG,SAAS,MAAM,CAElC,QAAO;AAGT,QAAI,SAAS,YAAY,KAAK,WAAW,GAAG,SAAS,GAAG,CACtD,QAAO;AAGT,WAAO;KACP;AAEF,OACE,gBACA,gBAAgB,SAAS,GAAG,SAAS,GAAG,eAAe,CAEvD,mBAAkB,CAAC,GAAG,SAAS,GAAG,eAAe;AAEnD,UAAO;;AAGT,SAAO;;;CAIT,MAAM,mBACJ,YACA,iBAC0B;AAC1B,MAAI,iBAAiB;GACnB,MAAM,WAAqB,EAAE;AAC7B,QAAK,MAAM,gBAAgB,iBAAiB;IAC1C,MAAM,SAASF,gCAAoB,GAAG,WAAW,GAAG,eAAe;IACnE,MAAM,UAAU,MAAMC,iCAAoB,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GAAG,WAAW,aAAa,KAAK,IAAI,GAAG;AAE1D,cAAY,KAAK,GAAG,WAAW,aAAa,KAAK,IAAI,GAAG;AAExD,OAAK,MAAM,cAAc,aAAa;GACpC,IAAI,WAAW,MAAM,KAAK,sBACxB,YACA,UACA,aACD;GACD,IAAI,OAAO,EAAE;AAEb,OAAI,CAAC,UAAU,QAAQ;IACrB,MAAM,kBAAkB,MAAM,KAAK,mBACjC,YACA,UACA,aACD;AACD,eAAW,MAAM,KAAK,mBAAmB,YAAY,gBAAgB;IACrE,MAAM,gBAAgBQ,gCAAiB,SAAS;AAChD,WAAO,MAAM,KAAK,QAAQ,YAAY,iBAAiB,cAAc;;GAGvE,MAAM,gBAAgB,GAAG,WAAW,GAAG;AAEvC,wBAAO,MAAM;IAAE,YAAY;IAAa;IAAU,EAAE,mBAAmB;AACvE,OAAI,SACF,QAAO;IACL,GAAG;IACH;IACA,UAAU,SAAS,KAAK,OAAO,EAAE,SAAS,GAAG,EAAE;IAChD;;AAIL,uBAAO,MACL,yBAAyB,YAAY,MAAM,YAAY,OAAO,eAC/D;AACD,SAAO"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Datasource","MAVEN_REPO","Http","ensureTrailingSlash","downloadHttpContent","extractPageLinks","compare","XmlDocument","regEx","getLatestVersion"],"sources":["../../../../lib/modules/datasource/sbt-plugin/index.ts"],"sourcesContent":["import { XmlDocument } from 'xmldoc';\nimport { logger } from '../../../logger';\nimport { Http } from '../../../util/http';\nimport { regEx } from '../../../util/regex';\nimport { ensureTrailingSlash } from '../../../util/url';\nimport * as ivyVersioning from '../../versioning/ivy';\nimport { compare } from '../../versioning/maven/compare';\nimport { Datasource } from '../datasource';\nimport { MAVEN_REPO } from '../maven/common';\nimport { downloadHttpContent } from '../maven/util';\nimport { extractPageLinks, getLatestVersion } from '../sbt-package/util';\nimport type {\n GetReleasesConfig,\n RegistryStrategy,\n ReleaseResult,\n} from '../types';\n\nexport const SBT_PLUGINS_REPO =\n 'https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases';\n\nexport class SbtPluginDatasource extends Datasource {\n static readonly id = 'sbt-plugin';\n\n override readonly defaultRegistryUrls = [SBT_PLUGINS_REPO, MAVEN_REPO];\n\n override readonly defaultVersioning = ivyVersioning.id;\n\n override readonly registryStrategy: RegistryStrategy = 'merge';\n\n override readonly sourceUrlSupport = 'package';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `scm` tags in the results.';\n\n constructor() {\n super(SbtPluginDatasource.id);\n this.http = new Http('sbt');\n }\n\n // istanbul ignore next: to be rewritten\n async getArtifactSubdirs(\n searchRoot: string,\n artifact: string,\n scalaVersion: string,\n ): Promise<string[] | null> {\n const pkgUrl = ensureTrailingSlash(searchRoot);\n const indexContent = await downloadHttpContent(this.http, pkgUrl);\n if (indexContent) {\n let artifactSubdirs = extractPageLinks(indexContent, (href) => {\n const path = href.split('/').at(-1)!;\n if (\n path.startsWith(`${artifact}_native`) ||\n path.startsWith(`${artifact}_sjs`)\n ) {\n return null;\n }\n\n if (path === artifact || path.startsWith(`${artifact}_`)) {\n return path;\n }\n\n return null;\n });\n\n if (\n scalaVersion &&\n artifactSubdirs.includes(`${artifact}_${scalaVersion}`)\n ) {\n artifactSubdirs = [`${artifact}_${scalaVersion}`];\n }\n return artifactSubdirs;\n }\n\n return null;\n }\n\n // istanbul ignore next: to be rewritten\n async getPackageReleases(\n searchRoot: string,\n artifactSubdirs: string[] | null,\n ): Promise<string[] | null> {\n if (artifactSubdirs) {\n const releases: string[] = [];\n for (const searchSubdir of artifactSubdirs) {\n const pkgUrl = ensureTrailingSlash(`${searchRoot}/${searchSubdir}`);\n const content = await downloadHttpContent(this.http, pkgUrl);\n if (content) {\n const subdirReleases = extractPageLinks(content, (href) => {\n const path = href.split('/').at(-1)!;\n if (path.startsWith('.')) {\n return null;\n }\n\n return path;\n });\n\n subdirReleases.forEach((x) => releases.push(x));\n }\n }\n if (releases.length) {\n return [...new Set(releases)].sort(compare);\n }\n }\n\n return null;\n }\n\n // istanbul ignore next: to be rewritten\n async getUrls(\n searchRoot: string,\n artifactDirs: string[] | null,\n version: string | null,\n ): Promise<Partial<ReleaseResult>> {\n const result: Partial<ReleaseResult> = {};\n\n if (!artifactDirs?.length) {\n return result;\n }\n\n if (!version) {\n return result;\n }\n\n for (const artifactDir of artifactDirs) {\n const [artifact] = artifactDir.split('_');\n const pomFileNames = [\n `${artifactDir}-${version}.pom`,\n `${artifact}-${version}.pom`,\n ];\n\n for (const pomFileName of pomFileNames) {\n const pomUrl = `${searchRoot}/${artifactDir}/${version}/${pomFileName}`;\n const content = await downloadHttpContent(this.http, pomUrl);\n if (content) {\n const pomXml = new XmlDocument(content);\n\n const homepage = pomXml.valueWithPath('url');\n if (homepage) {\n result.homepage = homepage;\n }\n\n const sourceUrl = pomXml.valueWithPath('scm.url');\n if (sourceUrl) {\n result.sourceUrl = sourceUrl\n .replace(regEx(/^scm:/), '')\n .replace(regEx(/^git:/), '')\n .replace(regEx(/^git@github.com:/), 'https://github.com/')\n .replace(regEx(/\\.git$/), '');\n }\n\n return result;\n }\n }\n }\n\n return result;\n }\n\n async resolvePluginReleases(\n rootUrl: string,\n artifact: string,\n scalaVersion: string,\n ): Promise<string[] | null> {\n const searchRoot = `${rootUrl}/${artifact}`;\n const hrefFilterMap = (href: string): string | null => {\n if (href.startsWith('.')) {\n return null;\n }\n\n return href;\n };\n const searchRootContent = await downloadHttpContent(\n this.http,\n ensureTrailingSlash(searchRoot),\n );\n if (searchRootContent) {\n const releases: string[] = [];\n const scalaVersionItems = extractPageLinks(\n searchRootContent,\n hrefFilterMap,\n );\n const scalaVersions = scalaVersionItems.map((x) =>\n x.replace(regEx(/^scala_/), ''),\n );\n const searchVersions = scalaVersions.includes(scalaVersion)\n ? [scalaVersion]\n : scalaVersions;\n for (const searchVersion of searchVersions) {\n const searchSubRoot = `${searchRoot}/scala_${searchVersion}`;\n const subRootContent = await downloadHttpContent(\n this.http,\n ensureTrailingSlash(searchSubRoot),\n );\n if (subRootContent) {\n const sbtVersionItems = extractPageLinks(\n subRootContent,\n hrefFilterMap,\n );\n for (const sbtItem of sbtVersionItems) {\n const releasesRoot = `${searchSubRoot}/${sbtItem}`;\n const releasesIndexContent = await downloadHttpContent(\n this.http,\n ensureTrailingSlash(releasesRoot),\n );\n if (releasesIndexContent) {\n const releasesParsed = extractPageLinks(\n releasesIndexContent,\n hrefFilterMap,\n );\n releasesParsed.forEach((x) => releases.push(x));\n }\n }\n }\n }\n if (releases.length) {\n return [...new Set(releases)].sort(compare);\n }\n }\n return null;\n }\n\n override async getReleases({\n packageName,\n registryUrl,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n /* v8 ignore next 3 -- should never happen */\n if (!registryUrl) {\n return null;\n }\n\n const [groupId, artifactId] = packageName.split(':');\n const groupIdSplit = groupId.split('.');\n const artifactIdSplit = artifactId.split('_');\n const [artifact, scalaVersion] = artifactIdSplit;\n\n const repoRoot = ensureTrailingSlash(registryUrl);\n const searchRoots: string[] = [];\n // Optimize lookup order\n if (!registryUrl.startsWith(MAVEN_REPO)) {\n searchRoots.push(`${repoRoot}${groupIdSplit.join('.')}`);\n }\n searchRoots.push(`${repoRoot}${groupIdSplit.join('/')}`);\n\n for (const searchRoot of searchRoots) {\n let versions = await this.resolvePluginReleases(\n searchRoot,\n artifact,\n scalaVersion,\n );\n let urls = {};\n\n if (!versions?.length) {\n const artifactSubdirs = await this.getArtifactSubdirs(\n searchRoot,\n artifact,\n scalaVersion,\n );\n versions = await this.getPackageReleases(searchRoot, artifactSubdirs);\n const latestVersion = getLatestVersion(versions);\n urls = await this.getUrls(searchRoot, artifactSubdirs, latestVersion);\n }\n\n const dependencyUrl = `${searchRoot}/${artifact}`;\n\n logger.trace({ dependency: packageName, versions }, `Package versions`);\n if (versions) {\n return {\n ...urls,\n dependencyUrl,\n releases: versions.map((v) => ({ version: v })),\n };\n }\n }\n\n logger.debug(\n `No versions found for ${packageName} in ${searchRoots.length} repositories`,\n );\n return null;\n }\n}\n"],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b,OAAI,CAAC,UAAU,QAAQ;IACrB,MAAM,kBAAkB,MAAM,KAAK,mBACjC,YACA,UACA,aACD;AACD,eAAW,MAAM,KAAK,mBAAmB,YAAY,gBAAgB;IACrE,MAAM,gBAAgBQ,gCAAiB,SAAS;AAChD,WAAO,MAAM,KAAK,QAAQ,YAAY,iBAAiB,cAAc;;GAGvE,MAAM,gBAAgB,GAAG,WAAW,GAAG;AAEvC,wBAAO,MAAM;IAAE,YAAY;IAAa;IAAU,EAAE,mBAAmB;AACvE,OAAI,SACF,QAAO;IACL,GAAG;IACH;IACA,UAAU,SAAS,KAAK,OAAO,EAAE,SAAS,GAAG,EAAE;IAChD;;AAIL,uBAAO,MACL,yBAAyB,YAAY,MAAM,YAAY,OAAO,eAC/D;AACD,SAAO"}
|
|
@@ -4,7 +4,6 @@ const require_index$1 = require('../../../../util/template/index.js');
|
|
|
4
4
|
const require_utils = require('../utils.js');
|
|
5
5
|
const require_datasource_migration = require('../../../../config/migrations/custom/datasource-migration.js');
|
|
6
6
|
let _sindresorhus_is = require("@sindresorhus/is");
|
|
7
|
-
let node_url = require("node:url");
|
|
8
7
|
|
|
9
8
|
//#region lib/modules/manager/custom/regex/utils.ts
|
|
10
9
|
require_index.init_logger();
|
|
@@ -12,7 +11,7 @@ function updateDependency(dependency, field, value) {
|
|
|
12
11
|
switch (field) {
|
|
13
12
|
case "registryUrl":
|
|
14
13
|
try {
|
|
15
|
-
dependency.registryUrls = [new
|
|
14
|
+
dependency.registryUrls = [new URL(value).toString()];
|
|
16
15
|
} catch {
|
|
17
16
|
require_index.logger.warn({ value }, "Invalid regex manager registryUrl");
|
|
18
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["
|
|
1
|
+
{"version":3,"file":"utils.js","names":["migrateDatasource","validMatchFields"],"sources":["../../../../../lib/modules/manager/custom/regex/utils.ts"],"sourcesContent":["import { isEmptyStringOrWhitespace } from '@sindresorhus/is';\nimport { migrateDatasource } from '../../../../config/migrations/custom/datasource-migration';\nimport { logger } from '../../../../logger';\nimport * as template from '../../../../util/template';\nimport type { PackageDependency } from '../../types';\nimport type { ValidMatchFields } from '../utils';\nimport { validMatchFields } from '../utils';\nimport type {\n ExtractionTemplate,\n PackageFileInfo,\n RegexManagerConfig,\n RegexManagerTemplates,\n} from './types';\n\nfunction updateDependency(\n dependency: PackageDependency,\n field: ValidMatchFields,\n value: string,\n): void {\n switch (field) {\n case 'registryUrl':\n // check if URL is valid and pack inside an array\n try {\n const url = new URL(value).toString();\n dependency.registryUrls = [url];\n } catch {\n logger.warn({ value }, 'Invalid regex manager registryUrl');\n }\n break;\n case 'datasource':\n dependency.datasource = migrateDatasource(value);\n break;\n case 'indentation':\n dependency.indentation = isEmptyStringOrWhitespace(value) ? value : '';\n break;\n default:\n dependency[field] = value;\n break;\n }\n}\n\nexport function createDependency(\n extractionTemplate: ExtractionTemplate,\n config: RegexManagerConfig,\n packageFileInfo: PackageFileInfo,\n dep?: PackageDependency,\n): PackageDependency | null {\n const dependency = dep ?? {};\n const { groups, replaceString } = extractionTemplate;\n const { packageFileName, packageFileDir } = packageFileInfo;\n\n for (const field of validMatchFields) {\n const fieldTemplate = `${field}Template` as keyof RegexManagerTemplates;\n const tmpl = config[fieldTemplate];\n if (tmpl) {\n try {\n const compiled = template.compile(\n tmpl,\n { ...groups, packageFile: packageFileName, packageFileDir },\n false,\n );\n updateDependency(dependency, field, compiled);\n } catch {\n logger.warn(\n { template: tmpl },\n 'Error compiling template for custom manager',\n );\n return null;\n }\n } else if (groups[field]) {\n updateDependency(dependency, field, groups[field]);\n }\n }\n dependency.replaceString = replaceString;\n return dependency;\n}\n\nexport function regexMatchAll(\n regex: RegExp,\n content: string,\n): RegExpMatchArray[] {\n const matches: RegExpMatchArray[] = [];\n let matchResult: RegExpMatchArray | null;\n let iterations = 0;\n const maxIterations = 10000;\n do {\n matchResult = regex.exec(content);\n if (matchResult) {\n matches.push(matchResult);\n }\n iterations += 1;\n } while (matchResult && iterations < maxIterations);\n if (iterations === maxIterations) {\n logger.warn('Max iterations reached for matchStrings');\n }\n return matches;\n}\n\nexport function mergeGroups(\n mergedGroup: Record<string, string>,\n secondGroup: Record<string, string>,\n): Record<string, string> {\n return { ...mergedGroup, ...secondGroup };\n}\n\nexport function mergeExtractionTemplate(\n base: ExtractionTemplate,\n addition: ExtractionTemplate,\n): ExtractionTemplate {\n return {\n groups: mergeGroups(base.groups, addition.groups),\n replaceString: addition.replaceString ?? base.replaceString,\n };\n}\n"],"mappings":";;;;;;;;2BAE4C;AAY5C,SAAS,iBACP,YACA,OACA,OACM;AACN,SAAQ,OAAR;EACE,KAAK;AAEH,OAAI;AAEF,eAAW,eAAe,CADd,IAAI,IAAI,MAAM,CAAC,UAAU,CACN;WACzB;AACN,yBAAO,KAAK,EAAE,OAAO,EAAE,oCAAoC;;AAE7D;EACF,KAAK;AACH,cAAW,aAAaA,+CAAkB,MAAM;AAChD;EACF,KAAK;AACH,cAAW,8DAAwC,MAAM,GAAG,QAAQ;AACpE;EACF;AACE,cAAW,SAAS;AACpB;;;AAIN,SAAgB,iBACd,oBACA,QACA,iBACA,KAC0B;CAC1B,MAAM,aAAa,OAAO,EAAE;CAC5B,MAAM,EAAE,QAAQ,kBAAkB;CAClC,MAAM,EAAE,iBAAiB,mBAAmB;AAE5C,MAAK,MAAM,SAASC,gCAAkB;EAEpC,MAAM,OAAO,OADS,GAAG,MAAM;AAE/B,MAAI,KACF,KAAI;AAMF,oBAAiB,YAAY,+BAJ3B,MACA;IAAE,GAAG;IAAQ,aAAa;IAAiB;IAAgB,EAC3D,MACD,CAC4C;UACvC;AACN,wBAAO,KACL,EAAE,UAAU,MAAM,EAClB,8CACD;AACD,UAAO;;WAEA,OAAO,OAChB,kBAAiB,YAAY,OAAO,OAAO,OAAO;;AAGtD,YAAW,gBAAgB;AAC3B,QAAO;;AAGT,SAAgB,cACd,OACA,SACoB;CACpB,MAAM,UAA8B,EAAE;CACtC,IAAI;CACJ,IAAI,aAAa;CACjB,MAAM,gBAAgB;AACtB,IAAG;AACD,gBAAc,MAAM,KAAK,QAAQ;AACjC,MAAI,YACF,SAAQ,KAAK,YAAY;AAE3B,gBAAc;UACP,eAAe,aAAa;AACrC,KAAI,eAAe,cACjB,sBAAO,KAAK,0CAA0C;AAExD,QAAO;;AAGT,SAAgB,YACd,aACA,aACwB;AACxB,QAAO;EAAE,GAAG;EAAa,GAAG;EAAa;;AAG3C,SAAgB,wBACd,MACA,UACoB;AACpB,QAAO;EACL,QAAQ,YAAY,KAAK,QAAQ,SAAS,OAAO;EACjD,eAAe,SAAS,iBAAiB,KAAK;EAC/C"}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_schema = require('../kubernetes/schema.js');
|
|
2
3
|
let zod = require("zod");
|
|
3
4
|
|
|
4
5
|
//#region lib/modules/manager/flux/schema.ts
|
|
5
|
-
const
|
|
6
|
-
apiVersion: zod.z.string(),
|
|
7
|
-
kind: zod.z.string(),
|
|
8
|
-
metadata: zod.z.object({
|
|
9
|
-
name: zod.z.string(),
|
|
10
|
-
namespace: zod.z.string().optional()
|
|
11
|
-
})
|
|
12
|
-
});
|
|
13
|
-
const HelmRelease = KubernetesResource.extend({
|
|
6
|
+
const HelmRelease = require_schema.KubernetesResource.extend({
|
|
14
7
|
apiVersion: zod.z.string().startsWith("helm.toolkit.fluxcd.io/"),
|
|
15
8
|
kind: zod.z.literal("HelmRelease"),
|
|
16
9
|
spec: zod.z.object({
|
|
@@ -31,7 +24,7 @@ const HelmRelease = KubernetesResource.extend({
|
|
|
31
24
|
values: zod.z.record(zod.z.unknown()).optional()
|
|
32
25
|
})
|
|
33
26
|
});
|
|
34
|
-
const HelmRepository = KubernetesResource.extend({
|
|
27
|
+
const HelmRepository = require_schema.KubernetesResource.extend({
|
|
35
28
|
apiVersion: zod.z.string().startsWith("source.toolkit.fluxcd.io/"),
|
|
36
29
|
kind: zod.z.literal("HelmRepository"),
|
|
37
30
|
spec: zod.z.object({
|
|
@@ -39,7 +32,7 @@ const HelmRepository = KubernetesResource.extend({
|
|
|
39
32
|
type: zod.z.enum(["oci", "default"]).optional()
|
|
40
33
|
})
|
|
41
34
|
});
|
|
42
|
-
const HelmChart = KubernetesResource.extend({
|
|
35
|
+
const HelmChart = require_schema.KubernetesResource.extend({
|
|
43
36
|
apiVersion: zod.z.string().startsWith("source.toolkit.fluxcd.io/"),
|
|
44
37
|
kind: zod.z.literal("HelmChart"),
|
|
45
38
|
spec: zod.z.object({
|
|
@@ -51,7 +44,7 @@ const HelmChart = KubernetesResource.extend({
|
|
|
51
44
|
})
|
|
52
45
|
})
|
|
53
46
|
});
|
|
54
|
-
const GitRepository = KubernetesResource.extend({
|
|
47
|
+
const GitRepository = require_schema.KubernetesResource.extend({
|
|
55
48
|
apiVersion: zod.z.string().startsWith("source.toolkit.fluxcd.io/"),
|
|
56
49
|
kind: zod.z.literal("GitRepository"),
|
|
57
50
|
spec: zod.z.object({
|
|
@@ -62,7 +55,7 @@ const GitRepository = KubernetesResource.extend({
|
|
|
62
55
|
}).optional()
|
|
63
56
|
})
|
|
64
57
|
});
|
|
65
|
-
const OCIRepository = KubernetesResource.extend({
|
|
58
|
+
const OCIRepository = require_schema.KubernetesResource.extend({
|
|
66
59
|
apiVersion: zod.z.string().startsWith("source.toolkit.fluxcd.io/"),
|
|
67
60
|
kind: zod.z.literal("OCIRepository"),
|
|
68
61
|
spec: zod.z.object({
|
|
@@ -73,7 +66,7 @@ const OCIRepository = KubernetesResource.extend({
|
|
|
73
66
|
}).optional()
|
|
74
67
|
})
|
|
75
68
|
});
|
|
76
|
-
const Kustomization = KubernetesResource.extend({
|
|
69
|
+
const Kustomization = require_schema.KubernetesResource.extend({
|
|
77
70
|
apiVersion: zod.z.string().startsWith("kustomize.toolkit.fluxcd.io/"),
|
|
78
71
|
kind: zod.z.literal("Kustomization"),
|
|
79
72
|
spec: zod.z.object({ images: zod.z.array(zod.z.object({
|
|
@@ -87,5 +80,4 @@ const FluxResource = HelmRelease.or(HelmRepository).or(HelmChart).or(GitReposito
|
|
|
87
80
|
|
|
88
81
|
//#endregion
|
|
89
82
|
exports.FluxResource = FluxResource;
|
|
90
|
-
exports.KubernetesResource = KubernetesResource;
|
|
91
83
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":["z"],"sources":["../../../../lib/modules/manager/flux/schema.ts"],"sourcesContent":["import { z } from 'zod';\
|
|
1
|
+
{"version":3,"file":"schema.js","names":["KubernetesResource","z"],"sources":["../../../../lib/modules/manager/flux/schema.ts"],"sourcesContent":["import { z } from 'zod';\nimport { KubernetesResource } from '../kubernetes/schema';\n\nexport const HelmRelease = KubernetesResource.extend({\n apiVersion: z.string().startsWith('helm.toolkit.fluxcd.io/'),\n kind: z.literal('HelmRelease'),\n spec: z.object({\n chart: z\n .object({\n spec: z.object({\n chart: z.string(),\n version: z.string().optional(),\n sourceRef: z\n .object({\n kind: z.string().optional(),\n name: z.string().optional(),\n namespace: z.string().optional(),\n })\n .optional(),\n }),\n })\n .optional(),\n chartRef: z\n .object({\n kind: z.string().optional(),\n name: z.string().optional(),\n namespace: z.string().optional(),\n })\n .optional(),\n values: z.record(z.unknown()).optional(),\n }),\n});\nexport type HelmRelease = z.infer<typeof HelmRelease>;\n\nexport const HelmRepository = KubernetesResource.extend({\n apiVersion: z.string().startsWith('source.toolkit.fluxcd.io/'),\n kind: z.literal('HelmRepository'),\n spec: z.object({\n url: z.string(),\n type: z.enum(['oci', 'default']).optional(),\n }),\n});\nexport type HelmRepository = z.infer<typeof HelmRepository>;\n\nexport const HelmChart = KubernetesResource.extend({\n apiVersion: z.string().startsWith('source.toolkit.fluxcd.io/'),\n kind: z.literal('HelmChart'),\n spec: z.object({\n chart: z.string(),\n version: z.string().optional(),\n sourceRef: z.object({\n kind: z.string().optional(),\n name: z.string().optional(),\n }),\n }),\n});\nexport type HelmChart = z.infer<typeof HelmChart>;\n\nexport const GitRepository = KubernetesResource.extend({\n apiVersion: z.string().startsWith('source.toolkit.fluxcd.io/'),\n kind: z.literal('GitRepository'),\n spec: z.object({\n url: z.string(),\n ref: z\n .object({\n tag: z.string().optional(),\n commit: z.string().optional(),\n })\n .optional(),\n }),\n});\n\nexport const OCIRepository = KubernetesResource.extend({\n apiVersion: z.string().startsWith('source.toolkit.fluxcd.io/'),\n kind: z.literal('OCIRepository'),\n spec: z.object({\n url: z.string(),\n ref: z\n .object({\n tag: z.string().optional(),\n digest: z.string().optional(),\n })\n .optional(),\n }),\n});\n\nexport const Kustomization = KubernetesResource.extend({\n apiVersion: z.string().startsWith('kustomize.toolkit.fluxcd.io/'),\n kind: z.literal('Kustomization'),\n spec: z.object({\n images: z\n .array(\n z.object({\n name: z.string(),\n newName: z.string().optional(),\n newTag: z.string().optional(),\n digest: z.string().optional(),\n }),\n )\n .optional(),\n }),\n});\n\nexport const FluxResource = HelmRelease.or(HelmRepository)\n .or(HelmChart)\n .or(GitRepository)\n .or(OCIRepository)\n .or(Kustomization);\nexport type FluxResource = z.infer<typeof FluxResource>;\n"],"mappings":";;;;;AAGA,MAAa,cAAcA,kCAAmB,OAAO;CACnD,YAAYC,MAAE,QAAQ,CAAC,WAAW,0BAA0B;CAC5D,MAAMA,MAAE,QAAQ,cAAc;CAC9B,MAAMA,MAAE,OAAO;EACb,OAAOA,MACJ,OAAO,EACN,MAAMA,MAAE,OAAO;GACb,OAAOA,MAAE,QAAQ;GACjB,SAASA,MAAE,QAAQ,CAAC,UAAU;GAC9B,WAAWA,MACR,OAAO;IACN,MAAMA,MAAE,QAAQ,CAAC,UAAU;IAC3B,MAAMA,MAAE,QAAQ,CAAC,UAAU;IAC3B,WAAWA,MAAE,QAAQ,CAAC,UAAU;IACjC,CAAC,CACD,UAAU;GACd,CAAC,EACH,CAAC,CACD,UAAU;EACb,UAAUA,MACP,OAAO;GACN,MAAMA,MAAE,QAAQ,CA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A,MAAE,OAAO;EACb,KAAKA,MAAE,QAAQ;EACf,KAAKA,MACF,OAAO;GACN,KAAKA,MAAE,QAAQ,CAAC,UAAU;GAC1B,QAAQA,MAAE,QAAQ,CAAC,UAAU;GAC9B,CAAC,CACD,UAAU;EACd,CAAC;CACH,CAAC;AAEF,MAAa,gBAAgBD,kCAAmB,OAAO;CACrD,YAAYC,MAAE,QAAQ,CAAC,WAAW,+BAA+B;CACjE,MAAMA,MAAE,QAAQ,gBAAgB;CAChC,MAAMA,MAAE,OAAO,EACb,QAAQA,MACL,MACCA,MAAE,OAAO;EACP,MAAMA,MAAE,QAAQ;EAChB,SAASA,MAAE,QAAQ,CAAC,UAAU;EAC9B,QAAQA,MAAE,QAAQ,CAAC,UAAU;EAC7B,QAAQA,MAAE,QAAQ,CAAC,UAAU;EAC9B,CAAC,CACH,CACA,UAAU,EACd,CAAC;CACH,CAAC;AAEF,MAAa,eAAe,YAAY,GAAG,eAAe,CACvD,GAAG,UAAU,CACb,GAAG,cAAc,CACjB,GAAG,cAAc,CACjB,GAAG,cAAc"}
|
|
@@ -10,8 +10,6 @@ let upath = require("upath");
|
|
|
10
10
|
upath = require_rolldown_runtime.__toESM(upath);
|
|
11
11
|
let simple_git = require("simple-git");
|
|
12
12
|
simple_git = require_rolldown_runtime.__toESM(simple_git);
|
|
13
|
-
let node_url = require("node:url");
|
|
14
|
-
node_url = require_rolldown_runtime.__toESM(node_url);
|
|
15
13
|
|
|
16
14
|
//#region lib/modules/manager/git-submodules/extract.ts
|
|
17
15
|
require_index.init_logger();
|
|
@@ -30,7 +28,7 @@ async function getUrl(git, gitModulesPath, submoduleName) {
|
|
|
30
28
|
"--get",
|
|
31
29
|
"remote.origin.url"
|
|
32
30
|
])).trim();
|
|
33
|
-
return
|
|
31
|
+
return new URL(path, `${remoteUrl}/`).href;
|
|
34
32
|
}
|
|
35
33
|
async function getBranch(git, gitModulesPath, submoduleName) {
|
|
36
34
|
const branchFromConfig = (await (0, simple_git.default)(require_config.simpleGitConfig()).raw([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","names":["simpleGitConfig","
|
|
1
|
+
{"version":3,"file":"extract.js","names":["simpleGitConfig","regEx","GlobalConfig","getHttpUrl","GitRefsDatasource"],"sources":["../../../../lib/modules/manager/git-submodules/extract.ts"],"sourcesContent":["import type { SimpleGit } from 'simple-git';\nimport Git from 'simple-git';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../../config/global';\nimport { logger } from '../../../logger';\nimport { simpleGitConfig } from '../../../util/git/config';\nimport { getHttpUrl } from '../../../util/git/url';\nimport { regEx } from '../../../util/regex';\nimport { GitRefsDatasource } from '../../datasource/git-refs';\nimport * as semVerVersioning from '../../versioning/semver';\nimport type { ExtractConfig, PackageFileContent } from '../types';\nimport type { GitModule } from './types';\n\nasync function getUrl(\n git: SimpleGit,\n gitModulesPath: string,\n submoduleName: string,\n): Promise<string> {\n const path = (\n await Git(simpleGitConfig()).raw([\n 'config',\n '--file',\n gitModulesPath,\n '--get',\n `submodule.${submoduleName}.url`,\n ])\n )?.trim();\n if (!path?.startsWith('../')) {\n return path;\n }\n const remoteUrl = (\n await git.raw(['config', '--get', 'remote.origin.url'])\n ).trim();\n return new URL(path, `${remoteUrl}/`).href;\n}\n\nasync function getBranch(\n git: SimpleGit,\n gitModulesPath: string,\n submoduleName: string,\n): Promise<string | null> {\n const branchFromConfig = (\n await Git(simpleGitConfig()).raw([\n 'config',\n '--file',\n gitModulesPath,\n '--get',\n `submodule.${submoduleName}.branch`,\n ])\n ).trim();\n\n return branchFromConfig === '.'\n ? (await git.branch(['--list'])).current.trim()\n : branchFromConfig || null;\n}\n\nasync function getModules(\n git: SimpleGit,\n gitModulesPath: string,\n): Promise<GitModule[]> {\n const res: GitModule[] = [];\n try {\n const modules = (\n (await git.raw([\n 'config',\n '--file',\n gitModulesPath,\n '--get-regexp',\n '\\\\.path',\n ])) ?? /* istanbul ignore next: should never happen */ ''\n )\n .trim()\n .split(regEx(/\\n/))\n .filter((s) => !!s);\n\n for (const line of modules) {\n const [, name, path] = line.split(regEx(/submodule\\.(.+?)\\.path\\s(.+)/));\n res.push({ name, path });\n }\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ err }, 'Error getting git submodules during extract');\n }\n return res;\n}\n\nexport default async function extractPackageFile(\n _content: string,\n packageFile: string,\n _config: ExtractConfig,\n): Promise<PackageFileContent | null> {\n const localDir = GlobalConfig.get('localDir');\n const git = Git(localDir, simpleGitConfig());\n const gitModulesPath = upath.join(localDir, packageFile);\n\n const depNames = await getModules(git, gitModulesPath);\n\n if (!depNames.length) {\n return null;\n }\n\n const deps = [];\n for (const { name, path } of depNames) {\n try {\n const [currentDigest] = (\n await git.subModule(['status', '--cached', path])\n )\n .trim()\n .replace(regEx(/^[-+]/), '')\n .split(regEx(/\\s/));\n const subModuleUrl = await getUrl(git, gitModulesPath, name);\n const httpSubModuleUrl = getHttpUrl(subModuleUrl);\n const branch = await getBranch(git, gitModulesPath, name);\n deps.push({\n depName: path,\n packageName: httpSubModuleUrl,\n sourceUrl: httpSubModuleUrl,\n currentValue: branch ?? undefined,\n currentDigest,\n ...(semVerVersioning.api.isVersion(branch)\n ? { versioning: semVerVersioning.id }\n : {}),\n });\n } catch (err) /* istanbul ignore next */ {\n logger.warn(\n { err, packageFile },\n 'Error mapping git submodules during extraction',\n );\n }\n }\n\n return { deps, datasource: GitRefsDatasource.id };\n}\n"],"mappings":";;;;;;;;;;;;;;2BAIyC;0BAGG;AAM5C,eAAe,OACb,KACA,gBACA,eACiB;CACjB,MAAM,QACJ,8BAAUA,gCAAiB,CAAC,CAAC,IAAI;EAC/B;EACA;EACA;EACA;EACA,aAAa,cAAc;EAC5B,CAAC,GACD,MAAM;AACT,KAAI,CAAC,MAAM,WAAW,MAAM,CAC1B,QAAO;CAET,MAAM,aACJ,MAAM,IAAI,IAAI;EAAC;EAAU;EAAS;EAAoB,CAAC,EACvD,MAAM;AACR,QAAO,IAAI,IAAI,MAAM,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AAK,gBAAgB,KAAK,CACX;EACjD,MAAM,SAAS,MAAM,UAAU,KAAK,gBAAgB,KAAK;AACzD,OAAK,KAAK;GACR,SAAS;GACT,aAAa;GACb,WAAW;GACX,cAAc,UAAU;GACxB;GACA,uBAAyB,UAAU,OAAO,GACtC,EAAE,gCAAiC,GACnC,EAAE;GACP,CAAC;UACK,iCAAgC;AACvC,uBAAO,KACL;GAAE;GAAK;GAAa,EACpB,iDACD;;AAIL,QAAO;EAAE;EAAM,YAAYC,kCAAkB;EAAI"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
|
|
4
|
+
//#region lib/modules/manager/kubernetes/schema.ts
|
|
5
|
+
const KubernetesResource = zod.z.object({
|
|
6
|
+
apiVersion: zod.z.string(),
|
|
7
|
+
kind: zod.z.string(),
|
|
8
|
+
metadata: zod.z.object({
|
|
9
|
+
name: zod.z.string(),
|
|
10
|
+
namespace: zod.z.string().optional()
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.KubernetesResource = KubernetesResource;
|
|
16
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":["z"],"sources":["../../../../lib/modules/manager/kubernetes/schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const KubernetesResource = z.object({\n apiVersion: z.string(),\n kind: z.string(),\n metadata: z.object({\n name: z.string(),\n namespace: z.string().optional(),\n }),\n});\n"],"mappings":";;;;AAEA,MAAa,qBAAqBA,MAAE,OAAO;CACzC,YAAYA,MAAE,QAAQ;CACtB,MAAMA,MAAE,QAAQ;CAChB,UAAUA,MAAE,OAAO;EACjB,MAAMA,MAAE,QAAQ;EAChB,WAAWA,MAAE,QAAQ,CAAC,UAAU;EACjC,CAAC;CACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_index = require('../../../util/schema-utils/index.js');
|
|
3
|
-
const require_schema = require('../
|
|
3
|
+
const require_schema = require('../kubernetes/schema.js');
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
|
|
6
6
|
//#region lib/modules/manager/sveltos/schema.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":["z","LooseArray","KubernetesResource"],"sources":["../../../../lib/modules/manager/sveltos/schema.ts"],"sourcesContent":["import { z } from 'zod';\nimport { LooseArray } from '../../../util/schema-utils';\nimport { KubernetesResource } from '../
|
|
1
|
+
{"version":3,"file":"schema.js","names":["z","LooseArray","KubernetesResource"],"sources":["../../../../lib/modules/manager/sveltos/schema.ts"],"sourcesContent":["import { z } from 'zod';\nimport { LooseArray } from '../../../util/schema-utils';\nimport { KubernetesResource } from '../kubernetes/schema';\n\nexport const SveltosHelmSource = z.object({\n repositoryURL: z.string(),\n repositoryName: z.string(),\n chartName: z.string(),\n chartVersion: z.string(),\n});\n\nexport type SveltosHelmSource = z.infer<typeof SveltosHelmSource>;\n\nexport const SveltosHelmSpec = z.object({\n helmCharts: LooseArray(SveltosHelmSource).optional(),\n});\nexport type SveltosHelmSpec = z.infer<typeof SveltosHelmSpec>;\n\nexport const ClusterProfile = KubernetesResource.extend({\n apiVersion: z.string().startsWith('config.projectsveltos.io/'),\n kind: z.literal('ClusterProfile'),\n spec: SveltosHelmSpec,\n});\n\nexport const Profile = KubernetesResource.extend({\n apiVersion: z.string().startsWith('config.projectsveltos.io/'),\n kind: z.literal('Profile'),\n spec: SveltosHelmSpec,\n});\n\nexport const EventTrigger = KubernetesResource.extend({\n apiVersion: z.string().startsWith('lib.projectsveltos.io/'),\n kind: z.literal('EventTrigger'),\n spec: SveltosHelmSpec,\n});\n\n// Create a union schema for ProfileDefinition\nexport const ProfileDefinition = z.union([\n Profile,\n ClusterProfile,\n EventTrigger,\n]);\nexport type ProfileDefinition = z.infer<typeof ProfileDefinition>;\n"],"mappings":";;;;;;AAIA,MAAa,oBAAoBA,MAAE,OAAO;CACxC,eAAeA,MAAE,QAAQ;CACzB,gBAAgBA,MAAE,QAAQ;CAC1B,WAAWA,MAAE,QAAQ;CACrB,cAAcA,MAAE,QAAQ;CACzB,CAAC;AAIF,MAAa,kBAAkBA,MAAE,OAAO,EACtC,YAAYC,yBAAW,kBAAkB,CAAC,UAAU,EACrD,CAAC;AAGF,MAAa,iBAAiBC,kCAAmB,OAAO;CACtD,YAAYF,MAAE,QAAQ,CAAC,WAAW,4BAA4B;CAC9D,MAAMA,MAAE,QAAQ,iBAAiB;CACjC,MAAM;CACP,CAAC;AAEF,MAAa,UAAUE,kCAAmB,OAAO;CAC/C,YAAYF,MAAE,QAAQ,CAAC,WAAW,4BAA4B;CAC9D,MAAMA,MAAE,QAAQ,UAAU;CAC1B,MAAM;CACP,CAAC;AAEF,MAAa,eAAeE,kCAAmB,OAAO;CACpD,YAAYF,MAAE,QAAQ,CAAC,WAAW,yBAAyB;CAC3D,MAAMA,MAAE,QAAQ,eAAe;CAC/B,MAAM;CACP,CAAC;AAGF,MAAa,oBAAoBA,MAAE,MAAM;CACvC;CACA;CACA;CACD,CAAC"}
|
|
@@ -6,7 +6,6 @@ const require_url = require('../../../util/url.js');
|
|
|
6
6
|
const require_index$1 = require('../../../util/git/index.js');
|
|
7
7
|
const require_pr_body = require('../pr-body.js');
|
|
8
8
|
let _sindresorhus_is = require("@sindresorhus/is");
|
|
9
|
-
let node_url = require("node:url");
|
|
10
9
|
|
|
11
10
|
//#region lib/modules/platform/bitbucket-server/utils.ts
|
|
12
11
|
require_error_messages.init_error_messages();
|
|
@@ -42,7 +41,7 @@ function getInvalidReviewers(err) {
|
|
|
42
41
|
return invalidReviewers;
|
|
43
42
|
}
|
|
44
43
|
function generateUrlFromEndpoint(defaultEndpoint, opts, repository) {
|
|
45
|
-
const url = new
|
|
44
|
+
const url = new URL(defaultEndpoint);
|
|
46
45
|
const authString = opts.username && opts.password ? `${opts.username}:${opts.password}` : opts.username ?? "";
|
|
47
46
|
const generatedUrl = require_index$1.getUrl({
|
|
48
47
|
protocol: url.protocol,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getPrBodyStruct","isNonEmptyString","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["getPrBodyStruct","isNonEmptyString","parseUrl","CONFIG_GIT_URL_UNAVAILABLE","regEx"],"sources":["../../../../lib/modules/platform/bitbucket-server/utils.ts"],"sourcesContent":["// SEE for the reference https://github.com/renovatebot/renovate/blob/c3e9e572b225085448d94aa121c7ec81c14d3955/lib/platform/bitbucket/utils.js\nimport { isNonEmptyString } from '@sindresorhus/is';\nimport { CONFIG_GIT_URL_UNAVAILABLE } from '../../../constants/error-messages';\nimport { logger } from '../../../logger';\nimport type { HostRule } from '../../../types';\nimport type { GitOptions, GitProtocol } from '../../../types/git';\nimport * as git from '../../../util/git';\nimport { regEx } from '../../../util/regex';\nimport { parseUrl } from '../../../util/url';\nimport { getPrBodyStruct } from '../pr-body';\nimport type { GitUrlOption } from '../types';\nimport type { BbsPr, BbsRestPr, BbsRestRepo, BitbucketError } from './types';\n\nexport const BITBUCKET_INVALID_REVIEWERS_EXCEPTION =\n 'com.atlassian.bitbucket.pull.InvalidPullRequestReviewersException';\n\n// https://docs.atlassian.com/bitbucket-server/rest/6.0.0/bitbucket-rest.html#idp250\nconst prStateMapping: any = {\n MERGED: 'merged',\n DECLINED: 'closed',\n OPEN: 'open',\n};\n\nexport function prInfo(pr: BbsRestPr): BbsPr {\n return {\n version: pr.version,\n number: pr.id,\n bodyStruct: getPrBodyStruct(pr.description),\n sourceBranch: pr.fromRef.displayId,\n targetBranch: pr.toRef.displayId,\n title: pr.title,\n state: prStateMapping[pr.state],\n createdAt: pr.createdDate,\n };\n}\n\nexport interface BitbucketCommitStatus {\n failed: number;\n inProgress: number;\n successful: number;\n}\n\nexport type BitbucketBranchState =\n | 'SUCCESSFUL'\n | 'FAILED'\n | 'INPROGRESS'\n | 'STOPPED';\n\nexport interface BitbucketStatus {\n key: string;\n state: BitbucketBranchState;\n}\n\nexport function isInvalidReviewersResponse(err: BitbucketError): boolean {\n const errors = err?.response?.body?.errors ?? [];\n return (\n errors.length > 0 &&\n errors.every(\n (error) => error.exceptionName === BITBUCKET_INVALID_REVIEWERS_EXCEPTION,\n )\n );\n}\n\nexport function getInvalidReviewers(err: BitbucketError): string[] {\n const errors = err?.response?.body?.errors ?? [];\n let invalidReviewers: string[] = [];\n for (const error of errors) {\n if (error.exceptionName === BITBUCKET_INVALID_REVIEWERS_EXCEPTION) {\n invalidReviewers = invalidReviewers.concat(\n error.reviewerErrors\n ?.map(({ context }) => context)\n .filter(isNonEmptyString) ?? [],\n );\n }\n }\n\n return invalidReviewers;\n}\n\nfunction generateUrlFromEndpoint(\n defaultEndpoint: string,\n opts: HostRule,\n repository: string,\n): string {\n const url = new URL(defaultEndpoint);\n const authString =\n opts.username && opts.password\n ? `${opts.username}:${opts.password}`\n : (opts.username ?? '');\n\n const generatedUrl = git.getUrl({\n protocol: url.protocol as GitProtocol,\n // TODO: types (#22198)\n auth: authString,\n host: `${url.host}${url.pathname}${\n /* v8 ignore next */\n url.pathname.endsWith('/') ? '' : '/'\n }scm`,\n repository,\n });\n logger.debug(`Using generated endpoint URL: ${generatedUrl}`);\n return generatedUrl;\n}\n\nfunction injectAuth(url: string, opts: HostRule): string {\n const repoUrl = parseUrl(url)!;\n if (!repoUrl) {\n logger.debug(`Invalid url: ${url}`);\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n if (!opts.token && opts.username && opts.password) {\n repoUrl.username = opts.username;\n repoUrl.password = opts.password;\n }\n return repoUrl.toString();\n}\n\nexport function getRepoGitUrl(\n repository: string,\n defaultEndpoint: string,\n gitUrl: GitUrlOption | undefined,\n info: BbsRestRepo,\n opts: HostRule,\n): string {\n switch (gitUrl) {\n case 'endpoint': {\n const generatedUrl = generateUrlFromEndpoint(\n defaultEndpoint,\n opts,\n repository,\n );\n logger.debug(`Using endpoint URL: ${generatedUrl}`);\n return generatedUrl;\n }\n case 'ssh': {\n const sshUrl = info.links.clone?.find(({ name }) => name === 'ssh');\n if (sshUrl === undefined) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n logger.debug(`Using ssh URL: ${sshUrl.href}`);\n return sshUrl.href;\n }\n case undefined:\n case 'default': {\n let cloneUrl = info.links.clone?.find(({ name }) => name === 'http');\n if (cloneUrl) {\n // Inject auth into the API provided URL\n return injectAuth(cloneUrl.href, opts);\n }\n // Http access might be disabled, try to find ssh url in this case\n cloneUrl = info.links.clone?.find(({ name }) => name === 'ssh');\n if (cloneUrl) {\n return cloneUrl.href;\n }\n // SSH urls can be used directly\n return generateUrlFromEndpoint(defaultEndpoint, opts, repository);\n }\n }\n}\n\nexport function getExtraCloneOpts(opts: HostRule): GitOptions {\n if (opts.token) {\n return {\n '-c': `http.extraHeader=Authorization: Bearer ${opts.token}`,\n };\n }\n return {};\n}\n\nexport function splitEscapedSpaces(str: string): string[] {\n const parts = str.split(' ');\n const result: string[] = [];\n let last: string | undefined;\n\n for (const part of parts) {\n if (last?.endsWith('\\\\\\\\')) {\n result[result.length - 1] = last.slice(0, -2) + ' ' + part;\n } else {\n result.push(part);\n }\n last = result.at(-1);\n }\n\n return result;\n}\n\nexport function parseModifier(value: string): number | null {\n const match = regEx('^random(?:\\\\((\\\\d+)\\\\))?$').exec(value);\n if (!match) {\n return null;\n }\n return parseInt(match[1] ?? '1');\n}\n"],"mappings":";;;;;;;;;;4CAE+E;2BACtC;0BAIG;sBACC;AAK7C,MAAa,wCACX;AAGF,MAAM,iBAAsB;CAC1B,QAAQ;CACR,UAAU;CACV,MAAM;CACP;AAED,SAAgB,OAAO,IAAsB;AAC3C,QAAO;EACL,SAAS,GAAG;EACZ,QAAQ,GAAG;EACX,YAAYA,gCAAgB,GAAG,YAAY;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$1 = require('../../../util/git/index.js');
|
|
5
5
|
const require_modules_platform_index = require('../../../modules/platform/index.js');
|
|
6
6
|
const require_massage = require('../../../config/massage.js');
|
|
7
|
-
const
|
|
7
|
+
const require_migrate_validate = require('../../../config/migrate-validate.js');
|
|
8
8
|
const require_comment = require('../../../modules/platform/comment.js');
|
|
9
9
|
const require_reconfigure_cache = require('./reconfigure-cache.js');
|
|
10
10
|
const require_utils = require('./utils.js');
|
|
@@ -25,13 +25,13 @@ async function validateReconfigureBranch(config, reconfigureConfig, configFileNa
|
|
|
25
25
|
return validationStatus === "green";
|
|
26
26
|
}
|
|
27
27
|
} else require_index.logger.debug("Status check is null or an empty string, skipping status check addition.");
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
require_index.logger.debug({ errors:
|
|
28
|
+
const res = await require_migrate_validate.migrateAndValidate({}, require_massage.massageConfig(reconfigureConfig));
|
|
29
|
+
if ((0, _sindresorhus_is.isNonEmptyArray)(res.errors)) {
|
|
30
|
+
require_index.logger.debug({ errors: res.errors.map((err) => err.message).join(", ") }, "Validation Errors");
|
|
31
31
|
if (reconfigurePr) {
|
|
32
32
|
let body = `There is an error with this repository's Renovate configuration that needs to be fixed.\n\n`;
|
|
33
33
|
body += `Location: \`${configFileName}\`\n`;
|
|
34
|
-
body += `Message: \`${
|
|
34
|
+
body += `Message: \`${res.errors.map((e) => e.message).join(", ").replace(require_regex.regEx(/`/g), "'")}\`\n`;
|
|
35
35
|
await require_comment.ensureComment({
|
|
36
36
|
number: reconfigurePr.number,
|
|
37
37
|
topic: "Action Required: Fix Renovate Configuration",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","names":["getReconfigureBranchName","getBranchCommit","platform","
|
|
1
|
+
{"version":3,"file":"validate.js","names":["getReconfigureBranchName","getBranchCommit","platform","migrateAndValidate","massageConfig","regEx","ensureComment","setBranchStatus"],"sources":["../../../../lib/workers/repository/reconfigure/validate.ts"],"sourcesContent":["import { isNonEmptyArray, isNonEmptyString } from '@sindresorhus/is';\nimport { massageConfig } from '../../../config/massage';\nimport { migrateAndValidate } from '../../../config/migrate-validate';\nimport type { RenovateConfig } from '../../../config/types';\nimport { logger } from '../../../logger';\nimport type { Pr } from '../../../modules/platform';\nimport { platform } from '../../../modules/platform';\nimport { ensureComment } from '../../../modules/platform/comment';\nimport { getBranchCommit } from '../../../util/git';\nimport { regEx } from '../../../util/regex';\nimport { setReconfigureBranchCache } from './reconfigure-cache';\nimport { getReconfigureBranchName, setBranchStatus } from './utils';\n\nexport async function validateReconfigureBranch(\n config: RenovateConfig,\n reconfigureConfig: RenovateConfig,\n configFileName: string,\n reconfigurePr: Pr | null,\n): Promise<boolean> {\n logger.debug('validateReconfigureBranch()');\n\n const context = config.statusCheckNames?.configValidation;\n const branchName = getReconfigureBranchName(config.branchPrefix!);\n const branchSha = getBranchCommit(branchName)!;\n\n if (context) {\n const validationStatus = await platform.getBranchStatusCheck(\n branchName,\n context,\n );\n\n // if old status check is present skip validation\n if (isNonEmptyString(validationStatus)) {\n logger.debug(\n 'Skipping validation check because status check already exists.',\n );\n return validationStatus === 'green';\n }\n } else {\n logger.debug(\n 'Status check is null or an empty string, skipping status check addition.',\n );\n }\n\n // perform validation and provide a passing or failing check based on result\n const massagedConfig = massageConfig(reconfigureConfig);\n const res = await migrateAndValidate({}, massagedConfig);\n\n // failing check\n if (isNonEmptyArray(res.errors)) {\n logger.debug(\n { errors: res.errors.map((err) => err.message).join(', ') },\n 'Validation Errors',\n );\n\n // add comment to reconfigure PR if it exists\n if (reconfigurePr) {\n let body = `There is an error with this repository's Renovate configuration that needs to be fixed.\\n\\n`;\n body += `Location: \\`${configFileName}\\`\\n`;\n body += `Message: \\`${res.errors\n .map((e) => e.message)\n .join(', ')\n .replace(regEx(/`/g), \"'\")}\\`\\n`;\n\n await ensureComment({\n number: reconfigurePr.number,\n topic: 'Action Required: Fix Renovate Configuration',\n content: body,\n });\n }\n\n await setBranchStatus(branchName, 'Validation Failed', 'red', context);\n setReconfigureBranchCache(branchSha, false);\n return false;\n }\n\n // passing check\n await setBranchStatus(branchName, 'Validation Successful', 'green', context);\n return true;\n}\n"],"mappings":";;;;;;;;;;;;;2BAIyC;0BAKG;AAI5C,eAAsB,0BACpB,QACA,mBACA,gBACA,eACkB;AAClB,sBAAO,MAAM,8BAA8B;CAE3C,MAAM,UAAU,OAAO,kBAAkB;CACzC,MAAM,aAAaA,uCAAyB,OAAO,aAAc;CACjE,MAAM,YAAYC,gCAAgB,WAAW;AAE7C,KAAI,SAAS;EACX,MAAM,mBAAmB,MAAMC,wCAAS,qBACtC,YACA,QACD;AAGD,6CAAqB,iBAAiB,EAAE;AACtC,wBAAO,MACL,iEACD;AACD,UAAO,qBAAqB;;OAG9B,sBAAO,MACL,2EACD;CAKH,MAAM,MAAM,MAAMC,4CAAmB,EAAE,EADhBC,8BAAc,kBAAkB,CACC;AAGxD,2CAAoB,IAAI,OAAO,EAAE;AAC/B,uBAAO,MACL,EAAE,QAAQ,IAAI,OAAO,KAAK,QAAQ,IAAI,QAAQ,CAAC,KAAK,KAAK,EAAE,EAC3D,oBACD;AAGD,MAAI,eAAe;GACjB,IAAI,OAAO;AACX,WAAQ,eAAe,eAAe;AACtC,WAAQ,cAAc,IAAI,OACvB,KAAK,MAAM,EAAE,QAAQ,CACrB,KAAK,KAAK,CACV,QAAQC,oBAAM,KAAK,EAAE,IAAI,CAAC;AAE7B,SAAMC,8BAAc;IAClB,QAAQ,cAAc;IACtB,OAAO;IACP,SAAS;IACV,CAAC;;AAGJ,QAAMC,8BAAgB,YAAY,qBAAqB,OAAO,QAAQ;AACtE,sDAA0B,WAAW,MAAM;AAC3C,SAAO;;AAIT,OAAMA,8BAAgB,YAAY,yBAAyB,SAAS,QAAQ;AAC5E,QAAO"}
|
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": "42.92.
|
|
4
|
+
"version": "42.92.10",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"renovate": "dist/renovate.js",
|
|
@@ -291,7 +291,7 @@
|
|
|
291
291
|
"nock": "14.0.10",
|
|
292
292
|
"npm-run-all2": "8.0.4",
|
|
293
293
|
"nyc": "17.1.0",
|
|
294
|
-
"oxlint": "1.
|
|
294
|
+
"oxlint": "1.41.0",
|
|
295
295
|
"rimraf": "6.1.2",
|
|
296
296
|
"tsdown": "0.20.1",
|
|
297
297
|
"semantic-release": "25.0.2",
|
package/renovate-schema.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"title": "JSON schema for Renovate 42.92.
|
|
2
|
+
"title": "JSON schema for Renovate 42.92.10 config files (https://renovatebot.com/)",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"x-renovate-version": "42.92.
|
|
4
|
+
"x-renovate-version": "42.92.10",
|
|
5
5
|
"allowComments": true,
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|