renovate 44.163.0 → 44.164.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,8 @@ var BaseGoDatasource = class BaseGoDatasource {
16
16
  static gitlabHttpsRegExp = regEx(/^(?<httpsRegExpUrl>https:\/\/[^/]*gitlab\.[^/]*)\/(?<httpsRegExpName>.+?)(?:\/v\d+)?[/]?$/);
17
17
  static gitlabRegExp = regEx(/^(?<regExpUrl>gitlab\.[^/]*)\/(?<regExpPath>.+?)(?:\/v\d+)?[/]?$/);
18
18
  static gitVcsRegexp = regEx(/^(?:[^/]+)\/(?<module>.*)\.git(?:$|\/)/);
19
+ static goImportRegexp = regEx(/<meta\s+name="?go-import"?\s+content="(?<prefix>[^"\s]+)\s+(?<proto>[^"\s]+)\s+(?<goImportURL>[^"\s]+)/);
20
+ static goImportAllRegexp = regEx(BaseGoDatasource.goImportRegexp.source, "g");
19
21
  static id = "go";
20
22
  static http = new Http(BaseGoDatasource.id);
21
23
  static async getDatasource(goModule) {
@@ -93,9 +95,46 @@ var BaseGoDatasource = class BaseGoDatasource {
93
95
  }
94
96
  return await BaseGoDatasource.goGetDatasource(goModule);
95
97
  }
96
- static async goGetDatasource(goModule) {
98
+ /**
99
+ * Returns the module proxy URL that a `go-import` meta tag with the `mod` VCS advertises for the module.
100
+ *
101
+ * @see https://go.dev/ref/mod#serving-from-proxy
102
+ */
103
+ static async getModProxyUrl(goModule) {
104
+ const html = await BaseGoDatasource.goGet(goModule);
105
+ return BaseGoDatasource.findModProxyUrl(html, goModule);
106
+ }
107
+ /**
108
+ * Finds the first `go-import` meta tag with the `mod` VCS whose prefix is a path prefix of the module.
109
+ *
110
+ * The proxy URL is controlled by the host serving the page, so only a valid `https:` URL is accepted, as with `go` (unless `GOINSECURE` is set).
111
+ */
112
+ static findModProxyUrl(html, goModule) {
113
+ for (const match of html.matchAll(BaseGoDatasource.goImportAllRegexp)) {
114
+ const { prefix, proto, goImportURL } = match.groups;
115
+ if (proto !== "mod" || !(goModule === prefix || goModule.startsWith(`${prefix}/`))) continue;
116
+ if (parseUrl(goImportURL)?.protocol !== "https:") {
117
+ logger.debug({
118
+ goModule,
119
+ goImportURL
120
+ }, "Ignoring go-import mod proxy URL which is not a valid https URL");
121
+ continue;
122
+ }
123
+ return goImportURL;
124
+ }
125
+ return null;
126
+ }
127
+ static async goGet(goModule) {
97
128
  const pkgUrl = `https://${goModule.replace(regEx(/\.git(?:\/[a-z0-9/]*)?$/), "")}?go-get=1`;
98
- const { body: html } = await BaseGoDatasource.http.getText(pkgUrl);
129
+ const { body } = await BaseGoDatasource.http.getText(pkgUrl);
130
+ return body;
131
+ }
132
+ static async goGetDatasource(goModule) {
133
+ const html = await BaseGoDatasource.goGet(goModule);
134
+ if (BaseGoDatasource.findModProxyUrl(html, goModule)) {
135
+ logger.debug({ goModule }, "Preferring go-import mod proxy over other go-import and go-source entries");
136
+ return null;
137
+ }
99
138
  const goSourceHeader = BaseGoDatasource.goSourceHeader(html, goModule);
100
139
  if (goSourceHeader) return goSourceHeader;
101
140
  const goImport = BaseGoDatasource.goImportHeader(html, goModule);
@@ -158,7 +197,7 @@ var BaseGoDatasource = class BaseGoDatasource {
158
197
  return null;
159
198
  }
160
199
  static goImportHeader(html, goModule) {
161
- const importMatchGroups = regEx(/<meta\s+name="?go-import"?\s+content="(?<prefix>[^"\s]+)\s+(?<proto>[^"\s]+)\s+(?<goImportURL>[^"\s]+)/).exec(html)?.groups;
200
+ const importMatchGroups = BaseGoDatasource.goImportRegexp.exec(html)?.groups;
162
201
  if (!importMatchGroups) {
163
202
  logger.trace({ goModule }, "No go-source or go-import header found");
164
203
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","names":["modulePath","hostRules.hostType"],"sources":["../../../../lib/modules/datasource/go/base.ts"],"sourcesContent":["// TODO: types (#22198)\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { detectPlatform } from '../../../util/common.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { Http } from '../../../util/http/index.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport {\n parseUrl,\n trimLeadingSlash,\n trimTrailingSlash,\n} from '../../../util/url.ts';\nimport { BitbucketTagsDatasource } from '../bitbucket-tags/index.ts';\nimport { ForgejoTagsDatasource } from '../forgejo-tags/index.ts';\nimport { GitTagsDatasource } from '../git-tags/index.ts';\nimport { GiteaTagsDatasource } from '../gitea-tags/index.ts';\nimport { GithubTagsDatasource } from '../github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../gitlab-tags/index.ts';\nimport type { DataSource } from './types.ts';\n\n// TODO: figure out class hierarchy (#10532)\nexport class BaseGoDatasource {\n private static readonly gitlabHttpsRegExp = regEx(\n /^(?<httpsRegExpUrl>https:\\/\\/[^/]*gitlab\\.[^/]*)\\/(?<httpsRegExpName>.+?)(?:\\/v\\d+)?[/]?$/,\n );\n private static readonly gitlabRegExp = regEx(\n /^(?<regExpUrl>gitlab\\.[^/]*)\\/(?<regExpPath>.+?)(?:\\/v\\d+)?[/]?$/,\n );\n private static readonly gitVcsRegexp = regEx(\n /^(?:[^/]+)\\/(?<module>.*)\\.git(?:$|\\/)/,\n );\n\n private static readonly id = 'go';\n private static readonly http = new Http(BaseGoDatasource.id);\n\n static async getDatasource(goModule: string): Promise<DataSource | null> {\n if (goModule.startsWith('gopkg.in/')) {\n const [pkg] = goModule.replace('gopkg.in/', '').split('.');\n const packageName = pkg.includes('/') ? pkg : `go-${pkg}/${pkg}`;\n return {\n datasource: GithubTagsDatasource.id,\n packageName,\n registryUrl: 'https://github.com',\n };\n }\n\n if (goModule.startsWith('github.com/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: GithubTagsDatasource.id,\n packageName,\n registryUrl: 'https://github.com',\n };\n }\n\n if (goModule.startsWith('bitbucket.org/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: BitbucketTagsDatasource.id,\n packageName,\n registryUrl: 'https://bitbucket.org',\n };\n }\n\n if (goModule.startsWith('code.cloudfoundry.org/')) {\n const packageName = goModule.replace(\n 'code.cloudfoundry.org',\n 'cloudfoundry',\n );\n return {\n datasource: GithubTagsDatasource.id,\n packageName,\n registryUrl: 'https://github.com',\n };\n }\n\n if (goModule.startsWith('dev.azure.com/')) {\n const split = goModule.split('/');\n if ((split.length > 4 && split[3] === '_git') || split.length > 3) {\n const packageName = `https://dev.azure.com/${split[1]}/${split[2]}/_git/${(split[3] === '_git' ? split[4] : split[3]).replace(regEx(/\\.git$/), '')}`;\n return {\n datasource: GitTagsDatasource.id,\n packageName,\n };\n }\n }\n\n //#region known gitea compatible hosts\n if (goModule.startsWith('gitea.com/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: GiteaTagsDatasource.id,\n packageName,\n registryUrl: 'https://gitea.com',\n };\n }\n\n if (goModule.startsWith('code.forgejo.org/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: ForgejoTagsDatasource.id,\n packageName,\n registryUrl: 'https://code.forgejo.org',\n };\n }\n\n if (goModule.startsWith('codeberg.org/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: ForgejoTagsDatasource.id,\n packageName,\n registryUrl: 'https://codeberg.org',\n };\n }\n //#endregion\n\n return await BaseGoDatasource.goGetDatasource(goModule);\n }\n\n private static async goGetDatasource(\n goModule: string,\n ): Promise<DataSource | null> {\n const goModuleUrl = goModule.replace(regEx(/\\.git(?:\\/[a-z0-9/]*)?$/), '');\n const pkgUrl = `https://${goModuleUrl}?go-get=1`;\n const { body: html } = await BaseGoDatasource.http.getText(pkgUrl);\n\n const goSourceHeader = BaseGoDatasource.goSourceHeader(html, goModule);\n if (goSourceHeader) {\n return goSourceHeader;\n }\n\n // GitHub Enterprise only returns a go-import meta\n const goImport = BaseGoDatasource.goImportHeader(html, goModule);\n if (goImport) {\n return goImport;\n }\n\n logger.trace({ goModule }, 'No go-source or go-import header found');\n /* istanbul ignore next */\n return null;\n }\n\n private static goSourceHeader(\n html: string,\n goModule: string,\n ): DataSource | null {\n const sourceMatchGroups = regEx(\n /<meta\\s+name=\"?go-source\"?\\s+content=\"(?<prefix>[^\"\\s]+)\\s+(?<goSourceUrl>[^\"\\s]+)/,\n ).exec(html)?.groups;\n if (!sourceMatchGroups) {\n return null;\n }\n const { prefix, goSourceUrl } = sourceMatchGroups;\n\n if (!goModule.startsWith(prefix)) {\n logger.trace({ goModule }, 'go-source header prefix not match');\n return null;\n }\n\n logger.debug(`Go lookup source url ${goSourceUrl} for module ${goModule}`);\n return this.detectDatasource(goSourceUrl, goModule);\n }\n\n private static detectDatasource(\n metadataUrl: string,\n goModule: string,\n ): DataSource | null {\n if (metadataUrl.startsWith('https://github.com/')) {\n return {\n datasource: GithubTagsDatasource.id,\n packageName: metadataUrl\n .replace('https://github.com/', '')\n .replace(regEx(/\\/$/), ''),\n registryUrl: 'https://github.com',\n };\n }\n\n const gitlabModuleName =\n BaseGoDatasource.gitlabRegExp.exec(goModule)?.groups?.regExpPath;\n const vcsIndicatedModule =\n BaseGoDatasource.gitVcsRegexp.exec(goModule)?.groups?.module;\n\n const metadataUrlMatchGroups =\n BaseGoDatasource.gitlabHttpsRegExp.exec(metadataUrl)?.groups;\n if (metadataUrlMatchGroups) {\n const { httpsRegExpUrl, httpsRegExpName } = metadataUrlMatchGroups;\n\n let packageName = vcsIndicatedModule ?? gitlabModuleName;\n\n // Detect submodules in monorepos by comparing metadata path and module path\n if (!vcsIndicatedModule && httpsRegExpName && gitlabModuleName) {\n const metadataPath = httpsRegExpName;\n const modulePath = gitlabModuleName;\n\n if (modulePath.startsWith(`${metadataPath}/`)) {\n packageName = metadataPath;\n }\n }\n\n // If we still don't have a package name, fall back to the metadata URL path\n packageName = packageName ?? httpsRegExpName;\n\n return {\n datasource: GitlabTagsDatasource.id,\n registryUrl: httpsRegExpUrl,\n packageName,\n };\n }\n\n if (hostRules.hostType({ url: metadataUrl }) === 'gitlab') {\n const parsedUrl = parseUrl(metadataUrl);\n if (!parsedUrl) {\n logger.trace({ goModule }, 'Could not parse go-source URL');\n return null;\n }\n\n const endpoint = GlobalConfig.get('endpoint');\n const endpointPrefix = regEx(\n /https:\\/\\/[^/]+\\/(?<prefix>.*?\\/)(?:api\\/v4\\/?)?/,\n ).exec(endpoint)?.groups?.prefix;\n\n let packageName =\n // a .git path indicates a concrete git repository, which can be different from metadata returned by gitlab\n vcsIndicatedModule ?? trimLeadingSlash(parsedUrl.pathname);\n if (endpointPrefix && endpointPrefix !== 'api/') {\n packageName = packageName.replace(endpointPrefix, '');\n }\n\n const registryUrl = endpointPrefix\n ? endpoint.replace(regEx(/\\/api\\/v4\\/?$/), '/')\n : `${parsedUrl.protocol}//${parsedUrl.host}`;\n\n return {\n datasource: GitlabTagsDatasource.id,\n registryUrl,\n packageName,\n };\n }\n return null;\n }\n\n private static goImportHeader(\n html: string,\n goModule: string,\n ): DataSource | null {\n const importMatchGroups = regEx(\n /<meta\\s+name=\"?go-import\"?\\s+content=\"(?<prefix>[^\"\\s]+)\\s+(?<proto>[^\"\\s]+)\\s+(?<goImportURL>[^\"\\s]+)/,\n ).exec(html)?.groups;\n if (!importMatchGroups) {\n logger.trace({ goModule }, 'No go-source or go-import header found');\n return null;\n }\n const { prefix, proto, goImportURL } = importMatchGroups;\n\n if (!goModule.startsWith(prefix)) {\n logger.trace({ goModule }, 'go-import header prefix not match');\n return null;\n }\n\n if (proto !== 'git') {\n logger.trace({ goModule }, 'go-import header proto not git');\n return null;\n }\n\n // get server base url from import url\n const parsedUrl = parseUrl(goImportURL);\n if (!parsedUrl) {\n logger.trace({ goModule }, 'Could not parse go-import URL');\n return null;\n }\n\n logger.debug(`Go module: ${goModule} lookup import url ${goImportURL}`);\n\n const datasource = this.detectDatasource(\n goImportURL.replace(regEx(/\\.git$/), ''),\n goModule,\n );\n if (datasource !== null) {\n return datasource;\n }\n // fall back to old behavior if detection did not work\n\n switch (detectPlatform(goImportURL)) {\n case 'github': {\n // split the go module from the URL: host/go/module -> go/module\n // TODO: `parsedUrl.pathname` can be undefined\n const packageName = trimTrailingSlash(`${parsedUrl.pathname}`)\n .replace(regEx(/\\.git$/), '')\n .split('/')\n .slice(-2)\n .join('/');\n\n return {\n datasource: GithubTagsDatasource.id,\n registryUrl: `${parsedUrl.protocol}//${parsedUrl.host}`,\n packageName,\n };\n }\n case 'azure': {\n return {\n datasource: GitTagsDatasource.id,\n packageName: goImportURL.replace(regEx(/\\.git$/), ''),\n };\n }\n default: {\n return {\n datasource: GitTagsDatasource.id,\n packageName: goImportURL,\n };\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAa,mBAAb,MAAa,iBAAiB;CAC5B,OAAwB,oBAAoB,MAC1C,2FACF;CACA,OAAwB,eAAe,MACrC,kEACF;CACA,OAAwB,eAAe,MACrC,wCACF;CAEA,OAAwB,KAAK;CAC7B,OAAwB,OAAO,IAAI,KAAK,iBAAiB,EAAE;CAE3D,aAAa,cAAc,UAA8C;EACvE,IAAI,SAAS,WAAW,WAAW,GAAG;GACpC,MAAM,CAAC,OAAO,SAAS,QAAQ,aAAa,EAAE,CAAC,CAAC,MAAM,GAAG;GACzD,MAAM,cAAc,IAAI,SAAS,GAAG,IAAI,MAAM,MAAM,IAAI,GAAG;GAC3D,OAAO;IACL,YAAY,qBAAqB;IACjC;IACA,aAAa;GACf;EACF;EAEA,IAAI,SAAS,WAAW,aAAa,GAAG;GACtC,MAAM,QAAQ,SAAS,MAAM,GAAG;GAChC,MAAM,cAAc,GAAG,MAAM,GAAG,GAAG,MAAM;GACzC,OAAO;IACL,YAAY,qBAAqB;IACjC;IACA,aAAa;GACf;EACF;EAEA,IAAI,SAAS,WAAW,gBAAgB,GAAG;GACzC,MAAM,QAAQ,SAAS,MAAM,GAAG;GAChC,MAAM,cAAc,GAAG,MAA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,MAAM,aAAa,KAAK,iBACtB,YAAY,QAAQ,MAAM,QAAQ,GAAG,EAAE,GACvC,QACF;EACA,IAAI,eAAe,MACjB,OAAO;EAIT,QAAQ,eAAe,WAAW,GAAlC;GACE,KAAK,UAAU;IAGb,MAAM,cAAc,kBAAkB,GAAG,UAAU,UAAU,CAAC,CAC3D,QAAQ,MAAM,QAAQ,GAAG,EAAE,CAAC,CAC5B,MAAM,GAAG,CAAC,CACV,MAAM,EAAE,CAAC,CACT,KAAK,GAAG;IAEX,OAAO;KACL,YAAY,qBAAqB;KACjC,aAAa,GAAG,UAAU,SAAS,IAAI,UAAU;KACjD;IACF;GACF;GACA,KAAK,SACH,OAAO;IACL,YAAY,kBAAkB;IAC9B,aAAa,YAAY,QAAQ,MAAM,QAAQ,GAAG,EAAE;GACtD;GAEF,SACE,OAAO;IACL,YAAY,kBAAkB;IAC9B,aAAa;GACf;EAEJ;CACF;AACF"}
1
+ {"version":3,"file":"base.js","names":["modulePath","hostRules.hostType"],"sources":["../../../../lib/modules/datasource/go/base.ts"],"sourcesContent":["// TODO: types (#22198)\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { detectPlatform } from '../../../util/common.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { Http } from '../../../util/http/index.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport {\n parseUrl,\n trimLeadingSlash,\n trimTrailingSlash,\n} from '../../../util/url.ts';\nimport { BitbucketTagsDatasource } from '../bitbucket-tags/index.ts';\nimport { ForgejoTagsDatasource } from '../forgejo-tags/index.ts';\nimport { GitTagsDatasource } from '../git-tags/index.ts';\nimport { GiteaTagsDatasource } from '../gitea-tags/index.ts';\nimport { GithubTagsDatasource } from '../github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../gitlab-tags/index.ts';\nimport type { DataSource } from './types.ts';\n\n// TODO: figure out class hierarchy (#10532)\nexport class BaseGoDatasource {\n private static readonly gitlabHttpsRegExp = regEx(\n /^(?<httpsRegExpUrl>https:\\/\\/[^/]*gitlab\\.[^/]*)\\/(?<httpsRegExpName>.+?)(?:\\/v\\d+)?[/]?$/,\n );\n private static readonly gitlabRegExp = regEx(\n /^(?<regExpUrl>gitlab\\.[^/]*)\\/(?<regExpPath>.+?)(?:\\/v\\d+)?[/]?$/,\n );\n private static readonly gitVcsRegexp = regEx(\n /^(?:[^/]+)\\/(?<module>.*)\\.git(?:$|\\/)/,\n );\n private static readonly goImportRegexp = regEx(\n /<meta\\s+name=\"?go-import\"?\\s+content=\"(?<prefix>[^\"\\s]+)\\s+(?<proto>[^\"\\s]+)\\s+(?<goImportURL>[^\"\\s]+)/,\n );\n private static readonly goImportAllRegexp = regEx(\n BaseGoDatasource.goImportRegexp.source,\n 'g',\n );\n\n private static readonly id = 'go';\n private static readonly http = new Http(BaseGoDatasource.id);\n\n static async getDatasource(goModule: string): Promise<DataSource | null> {\n if (goModule.startsWith('gopkg.in/')) {\n const [pkg] = goModule.replace('gopkg.in/', '').split('.');\n const packageName = pkg.includes('/') ? pkg : `go-${pkg}/${pkg}`;\n return {\n datasource: GithubTagsDatasource.id,\n packageName,\n registryUrl: 'https://github.com',\n };\n }\n\n if (goModule.startsWith('github.com/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: GithubTagsDatasource.id,\n packageName,\n registryUrl: 'https://github.com',\n };\n }\n\n if (goModule.startsWith('bitbucket.org/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: BitbucketTagsDatasource.id,\n packageName,\n registryUrl: 'https://bitbucket.org',\n };\n }\n\n if (goModule.startsWith('code.cloudfoundry.org/')) {\n const packageName = goModule.replace(\n 'code.cloudfoundry.org',\n 'cloudfoundry',\n );\n return {\n datasource: GithubTagsDatasource.id,\n packageName,\n registryUrl: 'https://github.com',\n };\n }\n\n if (goModule.startsWith('dev.azure.com/')) {\n const split = goModule.split('/');\n if ((split.length > 4 && split[3] === '_git') || split.length > 3) {\n const packageName = `https://dev.azure.com/${split[1]}/${split[2]}/_git/${(split[3] === '_git' ? split[4] : split[3]).replace(regEx(/\\.git$/), '')}`;\n return {\n datasource: GitTagsDatasource.id,\n packageName,\n };\n }\n }\n\n //#region known gitea compatible hosts\n if (goModule.startsWith('gitea.com/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: GiteaTagsDatasource.id,\n packageName,\n registryUrl: 'https://gitea.com',\n };\n }\n\n if (goModule.startsWith('code.forgejo.org/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: ForgejoTagsDatasource.id,\n packageName,\n registryUrl: 'https://code.forgejo.org',\n };\n }\n\n if (goModule.startsWith('codeberg.org/')) {\n const split = goModule.split('/');\n const packageName = `${split[1]}/${split[2]}`;\n return {\n datasource: ForgejoTagsDatasource.id,\n packageName,\n registryUrl: 'https://codeberg.org',\n };\n }\n //#endregion\n\n return await BaseGoDatasource.goGetDatasource(goModule);\n }\n\n /**\n * Returns the module proxy URL that a `go-import` meta tag with the `mod` VCS advertises for the module.\n *\n * @see https://go.dev/ref/mod#serving-from-proxy\n */\n static async getModProxyUrl(goModule: string): Promise<string | null> {\n const html = await BaseGoDatasource.goGet(goModule);\n return BaseGoDatasource.findModProxyUrl(html, goModule);\n }\n\n /**\n * Finds the first `go-import` meta tag with the `mod` VCS whose prefix is a path prefix of the module.\n *\n * The proxy URL is controlled by the host serving the page, so only a valid `https:` URL is accepted, as with `go` (unless `GOINSECURE` is set).\n */\n private static findModProxyUrl(\n html: string,\n goModule: string,\n ): string | null {\n for (const match of html.matchAll(BaseGoDatasource.goImportAllRegexp)) {\n const { prefix, proto, goImportURL } = match.groups as Record<\n string,\n string\n >;\n\n if (\n proto !== 'mod' ||\n !(goModule === prefix || goModule.startsWith(`${prefix}/`))\n ) {\n continue;\n }\n\n if (parseUrl(goImportURL)?.protocol !== 'https:') {\n logger.debug(\n { goModule, goImportURL },\n 'Ignoring go-import mod proxy URL which is not a valid https URL',\n );\n continue;\n }\n\n return goImportURL;\n }\n\n return null;\n }\n\n private static async goGet(goModule: string): Promise<string> {\n const goModuleUrl = goModule.replace(regEx(/\\.git(?:\\/[a-z0-9/]*)?$/), '');\n const pkgUrl = `https://${goModuleUrl}?go-get=1`;\n const { body } = await BaseGoDatasource.http.getText(pkgUrl);\n return body;\n }\n\n private static async goGetDatasource(\n goModule: string,\n ): Promise<DataSource | null> {\n const html = await BaseGoDatasource.goGet(goModule);\n\n // `go` prefers a `mod` proxy over a VCS for the same module, so leave it to the caller to look it up\n if (BaseGoDatasource.findModProxyUrl(html, goModule)) {\n logger.debug(\n { goModule },\n 'Preferring go-import mod proxy over other go-import and go-source entries',\n );\n return null;\n }\n\n const goSourceHeader = BaseGoDatasource.goSourceHeader(html, goModule);\n if (goSourceHeader) {\n return goSourceHeader;\n }\n\n // GitHub Enterprise only returns a go-import meta\n const goImport = BaseGoDatasource.goImportHeader(html, goModule);\n if (goImport) {\n return goImport;\n }\n\n logger.trace({ goModule }, 'No go-source or go-import header found');\n /* istanbul ignore next */\n return null;\n }\n\n private static goSourceHeader(\n html: string,\n goModule: string,\n ): DataSource | null {\n const sourceMatchGroups = regEx(\n /<meta\\s+name=\"?go-source\"?\\s+content=\"(?<prefix>[^\"\\s]+)\\s+(?<goSourceUrl>[^\"\\s]+)/,\n ).exec(html)?.groups;\n if (!sourceMatchGroups) {\n return null;\n }\n const { prefix, goSourceUrl } = sourceMatchGroups;\n\n if (!goModule.startsWith(prefix)) {\n logger.trace({ goModule }, 'go-source header prefix not match');\n return null;\n }\n\n logger.debug(`Go lookup source url ${goSourceUrl} for module ${goModule}`);\n return this.detectDatasource(goSourceUrl, goModule);\n }\n\n private static detectDatasource(\n metadataUrl: string,\n goModule: string,\n ): DataSource | null {\n if (metadataUrl.startsWith('https://github.com/')) {\n return {\n datasource: GithubTagsDatasource.id,\n packageName: metadataUrl\n .replace('https://github.com/', '')\n .replace(regEx(/\\/$/), ''),\n registryUrl: 'https://github.com',\n };\n }\n\n const gitlabModuleName =\n BaseGoDatasource.gitlabRegExp.exec(goModule)?.groups?.regExpPath;\n const vcsIndicatedModule =\n BaseGoDatasource.gitVcsRegexp.exec(goModule)?.groups?.module;\n\n const metadataUrlMatchGroups =\n BaseGoDatasource.gitlabHttpsRegExp.exec(metadataUrl)?.groups;\n if (metadataUrlMatchGroups) {\n const { httpsRegExpUrl, httpsRegExpName } = metadataUrlMatchGroups;\n\n let packageName = vcsIndicatedModule ?? gitlabModuleName;\n\n // Detect submodules in monorepos by comparing metadata path and module path\n if (!vcsIndicatedModule && httpsRegExpName && gitlabModuleName) {\n const metadataPath = httpsRegExpName;\n const modulePath = gitlabModuleName;\n\n if (modulePath.startsWith(`${metadataPath}/`)) {\n packageName = metadataPath;\n }\n }\n\n // If we still don't have a package name, fall back to the metadata URL path\n packageName = packageName ?? httpsRegExpName;\n\n return {\n datasource: GitlabTagsDatasource.id,\n registryUrl: httpsRegExpUrl,\n packageName,\n };\n }\n\n if (hostRules.hostType({ url: metadataUrl }) === 'gitlab') {\n const parsedUrl = parseUrl(metadataUrl);\n if (!parsedUrl) {\n logger.trace({ goModule }, 'Could not parse go-source URL');\n return null;\n }\n\n const endpoint = GlobalConfig.get('endpoint');\n const endpointPrefix = regEx(\n /https:\\/\\/[^/]+\\/(?<prefix>.*?\\/)(?:api\\/v4\\/?)?/,\n ).exec(endpoint)?.groups?.prefix;\n\n let packageName =\n // a .git path indicates a concrete git repository, which can be different from metadata returned by gitlab\n vcsIndicatedModule ?? trimLeadingSlash(parsedUrl.pathname);\n if (endpointPrefix && endpointPrefix !== 'api/') {\n packageName = packageName.replace(endpointPrefix, '');\n }\n\n const registryUrl = endpointPrefix\n ? endpoint.replace(regEx(/\\/api\\/v4\\/?$/), '/')\n : `${parsedUrl.protocol}//${parsedUrl.host}`;\n\n return {\n datasource: GitlabTagsDatasource.id,\n registryUrl,\n packageName,\n };\n }\n return null;\n }\n\n private static goImportHeader(\n html: string,\n goModule: string,\n ): DataSource | null {\n const importMatchGroups =\n BaseGoDatasource.goImportRegexp.exec(html)?.groups;\n if (!importMatchGroups) {\n logger.trace({ goModule }, 'No go-source or go-import header found');\n return null;\n }\n const { prefix, proto, goImportURL } = importMatchGroups;\n\n if (!goModule.startsWith(prefix)) {\n logger.trace({ goModule }, 'go-import header prefix not match');\n return null;\n }\n\n if (proto !== 'git') {\n logger.trace({ goModule }, 'go-import header proto not git');\n return null;\n }\n\n // get server base url from import url\n const parsedUrl = parseUrl(goImportURL);\n if (!parsedUrl) {\n logger.trace({ goModule }, 'Could not parse go-import URL');\n return null;\n }\n\n logger.debug(`Go module: ${goModule} lookup import url ${goImportURL}`);\n\n const datasource = this.detectDatasource(\n goImportURL.replace(regEx(/\\.git$/), ''),\n goModule,\n );\n if (datasource !== null) {\n return datasource;\n }\n // fall back to old behavior if detection did not work\n\n switch (detectPlatform(goImportURL)) {\n case 'github': {\n // split the go module from the URL: host/go/module -> go/module\n // TODO: `parsedUrl.pathname` can be undefined\n const packageName = trimTrailingSlash(`${parsedUrl.pathname}`)\n .replace(regEx(/\\.git$/), '')\n .split('/')\n .slice(-2)\n .join('/');\n\n return {\n datasource: GithubTagsDatasource.id,\n registryUrl: `${parsedUrl.protocol}//${parsedUrl.host}`,\n packageName,\n };\n }\n case 'azure': {\n return {\n datasource: GitTagsDatasource.id,\n packageName: goImportURL.replace(regEx(/\\.git$/), ''),\n };\n }\n default: {\n return {\n datasource: GitTagsDatasource.id,\n packageName: goImportURL,\n };\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAa,mBAAb,MAAa,iBAAiB;CAC5B,OAAwB,oBAAoB,MAC1C,2FACF;CACA,OAAwB,eAAe,MACrC,kEACF;CACA,OAAwB,eAAe,MACrC,wCACF;CACA,OAAwB,iBAAiB,MACvC,wGACF;CACA,OAAwB,oBAAoB,MAC1C,iBAAiB,eAAe,QAChC,GACF;CAEA,OAAwB,KAAK;C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AqB,aAAa;EAEtE,MAAM,aAAa,KAAK,iBACtB,YAAY,QAAQ,MAAM,QAAQ,GAAG,EAAE,GACvC,QACF;EACA,IAAI,eAAe,MACjB,OAAO;EAIT,QAAQ,eAAe,WAAW,GAAlC;GACE,KAAK,UAAU;IAGb,MAAM,cAAc,kBAAkB,GAAG,UAAU,UAAU,CAAC,CAC3D,QAAQ,MAAM,QAAQ,GAAG,EAAE,CAAC,CAC5B,MAAM,GAAG,CAAC,CACV,MAAM,EAAE,CAAC,CACT,KAAK,GAAG;IAEX,OAAO;KACL,YAAY,qBAAqB;KACjC,aAAa,GAAG,UAAU,SAAS,IAAI,UAAU;KACjD;IACF;GACF;GACA,KAAK,SACH,OAAO;IACL,YAAY,kBAAkB;IAC9B,aAAa,YAAY,QAAQ,MAAM,QAAQ,GAAG,EAAE;GACtD;GAEF,SACE,OAAO;IACL,YAAY,kBAAkB;IAC9B,aAAa;GACf;EAEJ;CACF;AACF"}
@@ -76,20 +76,20 @@ var GoProxyDatasource = class GoProxyDatasource extends Datasource {
76
76
  const { packageName } = config;
77
77
  logger.trace(`goproxy.getReleases(${packageName})`);
78
78
  const goproxy = getEnv().GOPROXY ?? `https://proxy.golang.org,direct`;
79
- if (goproxy === "direct") return this.direct.getReleases(config);
79
+ if (goproxy === "direct") return this.getDirectReleases(config);
80
80
  const proxyList = parseGoproxy(goproxy);
81
81
  const noproxy = parseNoproxy();
82
82
  let result = null;
83
83
  let servedByProxy = false;
84
84
  if (noproxy?.test(packageName)) {
85
85
  logger.debug(`Fetching ${packageName} via GONOPROXY match`);
86
- result = await this.direct.getReleases(config);
86
+ result = await this.getDirectReleases(config);
87
87
  return result;
88
88
  }
89
89
  for (const { url, fallback } of proxyList) try {
90
90
  if (url === "off") break;
91
91
  else if (url === "direct") {
92
- result = await this.direct.getReleases(config);
92
+ result = await this.getDirectReleases(config);
93
93
  break;
94
94
  }
95
95
  const res = await this.getVersionsWithInfo(url, packageName, config.constraintsFiltering);
@@ -117,6 +117,21 @@ var GoProxyDatasource = class GoProxyDatasource extends Datasource {
117
117
  return result;
118
118
  }
119
119
  /**
120
+ * Looks up a module directly from its source, or from the module proxy its `go-import` meta tag advertises with the `mod` VCS, as with private Buf Schema Registries.
121
+ */
122
+ async getDirectReleases(config) {
123
+ const { packageName } = config;
124
+ if (!await BaseGoDatasource.getDatasource(packageName)) {
125
+ const modProxyUrl = await BaseGoDatasource.getModProxyUrl(packageName);
126
+ if (modProxyUrl) {
127
+ logger.debug(`Fetching ${packageName} via go-import mod proxy ${modProxyUrl}`);
128
+ const res = await this.getVersionsWithInfo(modProxyUrl, packageName, config.constraintsFiltering);
129
+ return res.releases.length ? res : null;
130
+ }
131
+ }
132
+ return this.direct.getReleases(config);
133
+ }
134
+ /**
120
135
  * A Go proxy reports the commit time of the tagged commit as a version's `Time`, which can be much earlier than the point at which that version was released.
121
136
  *
122
137
  * When the module is hosted on GitHub, a GitHub Release's publication time, or - if there's no Release - the git tag's own creation time (distinct from the commit time for an annotated tag), is a better indicator of when the version became available. A Release is preferred over a tag when both exist for the same version.
@@ -1 +1 @@
1
- {"version":3,"file":"releases-goproxy.js","names":["p.map","HttpError","goVersioning"],"sources":["../../../../lib/modules/datasource/go/releases-goproxy.ts"],"sourcesContent":["import {\n isNonEmptyString,\n isNonEmptyStringAndNotWhitespace,\n isTruthy,\n} from '@sindresorhus/is';\nimport type { ConstraintsFilter } from '../../../config/types.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport { buildCacheKey } from '../../../util/cache/package/key.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { detectPlatform } from '../../../util/common.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { filterMap } from '../../../util/filter-map.ts';\nimport {\n queryReleases,\n queryTags,\n} from '../../../util/github/graphql/index.ts';\nimport { GithubHttp } from '../../../util/http/github.ts';\nimport { HttpError } from '../../../util/http/index.ts';\nimport * as p from '../../../util/promises.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\nimport type { Timestamp } from '../../../util/timestamp.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport {\n joinUrlParts,\n parseUrl,\n trimLeadingSlash,\n trimTrailingSlash,\n} from '../../../util/url.ts';\nimport goVersioning from '../../versioning/go-mod-directive/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport { GithubReleasesDatasource } from '../github-releases/index.ts';\nimport type { GetReleasesConfig, Release, ReleaseResult } from '../types.ts';\nimport { BaseGoDatasource } from './base.ts';\nimport { getSourceUrl, isPublicGoPackage, publicGoproxyUrl } from './common.ts';\nimport { parseGoproxy, parseNoproxy } from './goproxy-parser.ts';\nimport { GoDirectDatasource } from './releases-direct.ts';\nimport { VersionInfo } from './schema.ts';\nimport { GoVersionTimestampCache } from './timestamp-cache.ts';\n\n/** TODO #42566 */\nconst goVersionRegex = regEx(/^\\s*go\\s+(?<version>[^\\s]+)\\s*$/);\n\nconst modRegex = regEx(/^(?<baseMod>.*?)(?:[./]v(?<majorVersion>\\d+))?$/);\n\nconst versionTagRegex = regEx(/^v\\d/);\n\n/**\n * Modules with a major version of v2 or above which have no `go.mod` are reported by a Go proxy with a `+incompatible` suffix, which is absent from the tag they were published as.\n *\n * @see https://go.dev/ref/mod#non-module-compat\n */\nconst incompatibleSuffixRegex = regEx(/\\+incompatible$/);\n\n/**\n * @see https://go.dev/ref/mod#pseudo-versions\n */\nconst pseudoVersionRegex = regEx(\n /v\\d+\\.\\d+\\.\\d+-(?:\\w+\\.)?(?:0\\.)?(?<timestamp>\\d{14})-(?<digest>[a-f0-9]{12})/i,\n);\n\nexport function pseudoVersionToRelease(pseudoVersion: string): Release | null {\n const match = pseudoVersion.match(pseudoVersionRegex)?.groups;\n if (!match) {\n return null;\n }\n\n const { digest: newDigest, timestamp } = match;\n const releaseTimestamp = asTimestamp(timestamp);\n\n return {\n version: pseudoVersion,\n newDigest,\n releaseTimestamp,\n };\n}\n\n/**\n * A Go module which lives in a subdirectory of its repository is tagged with that subdirectory as a prefix, so `github.com/aws/aws-sdk-go-v2/service/s3` publishes `v1.2.3` as the tag `service/s3/v1.2.3`.\n *\n * @see https://go.dev/ref/mod#vcs-version\n *\n * Because we can't tell from the module path alone where the repository ends and the subdirectory begins, we try each candidate prefix - longest first - against the tags we actually found, in the same way as `filterByPrefix` does for direct lookups.\n */\nexport function getTagPrefix(goModule: string, tags: Iterable<string>): string {\n const nameParts = goModule\n .replace(regEx(/\\/v\\d+$/), '')\n .split('/')\n .slice(1);\n const tagNames = [...tags];\n\n while (nameParts.length) {\n const prefix = `${nameParts.join('/')}/`;\n\n const isUsed = tagNames.some(\n (tag) =>\n tag.startsWith(prefix) &&\n versionTagRegex.test(tag.slice(prefix.length)),\n );\n if (isUsed) {\n return prefix;\n }\n\n nameParts.shift();\n }\n\n return '';\n}\n\nexport class GoProxyDatasource extends Datasource {\n static readonly id = 'go-proxy';\n\n constructor() {\n super(GoProxyDatasource.id);\n }\n\n readonly direct = new GoDirectDatasource();\n\n private readonly githubHttp = new GithubHttp(GithubReleasesDatasource.id);\n\n private async _getReleases(\n config: GetReleasesConfig,\n ): Promise<ReleaseResult | null> {\n const { packageName } = config;\n logger.trace(`goproxy.getReleases(${packageName})`);\n const goproxy = getEnv().GOPROXY ?? `${publicGoproxyUrl},direct`;\n if (goproxy === 'direct') {\n return this.direct.getReleases(config);\n }\n const proxyList = parseGoproxy(goproxy);\n const noproxy = parseNoproxy();\n\n let result: ReleaseResult | null = null;\n let servedByProxy = false;\n\n if (noproxy?.test(packageName)) {\n logger.debug(`Fetching ${packageName} via GONOPROXY match`);\n result = await this.direct.getReleases(config);\n return result;\n }\n\n for (const { url, fallback } of proxyList) {\n try {\n if (url === 'off') {\n break;\n } else if (url === 'direct') {\n result = await this.direct.getReleases(config);\n break;\n }\n\n const res = await this.getVersionsWithInfo(\n url,\n packageName,\n config.constraintsFiltering,\n );\n if (res.releases.length) {\n result = res;\n servedByProxy = true;\n break;\n }\n } catch (err) {\n const potentialHttpError =\n err instanceof ExternalHostError ? err.err : err;\n const statusCode = potentialHttpError?.response?.statusCode;\n const canFallback =\n fallback === '|' ? true : statusCode === 404 || statusCode === 410;\n if (!canFallback) {\n logger.debug(\n { err },\n 'Goproxy error: not falling back to other URLs provided with GOPROXY, rethrowing',\n );\n this.handleGenericErrors(err);\n }\n logger.debug(\n { err },\n 'Goproxy error: trying next URL provided with GOPROXY',\n );\n }\n }\n\n if (result && !result.sourceUrl) {\n try {\n const datasource = await BaseGoDatasource.getDatasource(packageName);\n const sourceUrl = getSourceUrl(datasource);\n if (sourceUrl) {\n result.sourceUrl = sourceUrl;\n }\n } catch (err) {\n logger.trace({ err }, `Can't get datasource for ${packageName}`);\n }\n }\n\n if (result?.sourceUrl && servedByProxy) {\n await this.addGithubTimestamps(\n packageName,\n result.sourceUrl,\n result.releases,\n );\n }\n\n return result;\n }\n\n /**\n * A Go proxy reports the commit time of the tagged commit as a version's `Time`, which can be much earlier than the point at which that version was released.\n *\n * When the module is hosted on GitHub, a GitHub Release's publication time, or - if there's no Release - the git tag's own creation time (distinct from the commit time for an annotated tag), is a better indicator of when the version became available. A Release is preferred over a tag when both exist for the same version.\n */\n async addGithubTimestamps(\n packageName: string,\n sourceUrl: string,\n releases: Release[],\n ): Promise<void> {\n if (detectPlatform(sourceUrl) !== 'github') {\n return;\n }\n\n const parsedUrl = parseUrl(sourceUrl);\n /* v8 ignore next -- detectPlatform only returns a platform for parseable URLs */\n if (!parsedUrl) {\n return;\n }\n\n const repository = trimTrailingSlash(\n trimLeadingSlash(parsedUrl.pathname),\n ).replace(regEx(/\\.git$/), '');\n const githubConfig = {\n packageName: repository,\n registryUrl: parsedUrl.origin,\n };\n\n const [githubTags, githubReleases] = await Promise.all([\n queryTags(githubConfig, this.githubHttp).catch((err) => {\n logger.debug(\n { err, packageName },\n 'Error fetching GitHub Tags for Go module',\n );\n return [];\n }),\n queryReleases(githubConfig, this.githubHttp).catch((err) => {\n logger.debug(\n { err, packageName },\n 'Error fetching GitHub Releases for Go module',\n );\n return [];\n }),\n ]);\n\n const timestamps = new Map<string, Timestamp>();\n for (const { version, releaseTimestamp } of githubTags) {\n timestamps.set(version, releaseTimestamp);\n }\n for (const { version, releaseTimestamp } of githubReleases) {\n timestamps.set(version, releaseTimestamp);\n }\n\n const tagPrefix = getTagPrefix(packageName, timestamps.keys());\n for (const release of releases) {\n const version = release.version.replace(incompatibleSuffixRegex, '');\n const releaseTimestamp = timestamps.get(`${tagPrefix}${version}`);\n if (\n releaseTimestamp &&\n (!release.releaseTimestamp ||\n releaseTimestamp > release.releaseTimestamp)\n ) {\n release.releaseTimestamp = releaseTimestamp;\n }\n }\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n return withCache(\n {\n namespace: `datasource-${GoProxyDatasource.id}`,\n key: GoProxyDatasource.getCacheKey(config),\n cacheable: isPublicGoPackage(config.packageName),\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n\n /**\n * Avoid ambiguity when serving from case-insensitive file systems.\n *\n * @see https://golang.org/ref/mod#goproxy-protocol\n */\n encodeCase(input: string): string {\n return input.replace(regEx(/(?:[A-Z])/g), (x) => `!${x.toLowerCase()}`);\n }\n\n async listVersions(baseUrl: string, packageName: string): Promise<Release[]> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n 'list',\n );\n const { body } = await this.http.getText(url);\n return filterMap(body.split(newlineRegex), (str) => {\n if (!isNonEmptyStringAndNotWhitespace(str)) {\n return null;\n }\n\n const [version, timestamp] = str.trim().split(regEx(/\\s+/));\n const release: Release = pseudoVersionToRelease(version) ?? { version };\n\n const releaseTimestamp = asTimestamp(timestamp);\n if (releaseTimestamp) {\n release.releaseTimestamp = releaseTimestamp;\n }\n\n return release;\n });\n }\n\n async versionInfo(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<Release> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n `${version}.info`,\n );\n const res = await this.http.getJson(url, VersionInfo);\n\n const result: Release = {\n version: res.body.Version,\n };\n\n const releaseTimestamp = asTimestamp(res.body.Time);\n if (releaseTimestamp) {\n result.releaseTimestamp = releaseTimestamp;\n }\n\n return result;\n }\n\n /**\n * Retrieve the `go` directive for a given Go Module.\n *\n * NOTE that this means the `go` directive, not the `toolchain` directive.\n */\n async retrieveGoDirectiveForModule(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<string | undefined> {\n return withCache(\n {\n namespace: `datasource-${GoProxyDatasource.id}`,\n key: GoProxyDatasource.getVersionedCacheKey(packageName, version),\n // a module's `go.mod` should /never/ change after it's published. If going via the Go Proxy and the Go Checksum Database, a change in this value will result in build failures.\n ttlMinutes: 100 * 24 * 60,\n cacheable: isPublicGoPackage(packageName),\n },\n () => this._retrieveGoDirectiveForModule(baseUrl, packageName, version),\n );\n }\n\n async _retrieveGoDirectiveForModule(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<string | undefined> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n `${version}.mod`,\n );\n const res = await this.http.getText(url);\n\n let goDirective: string | undefined = undefined;\n\n for (const line of res.body.split('\\n')) {\n const goVersionMatches = goVersionRegex.exec(line)?.groups;\n if (goVersionMatches) {\n goDirective = goVersionMatches.version;\n break;\n }\n }\n\n if (!goDirective) {\n return goDirective;\n }\n\n // always return it in full SemVer format, which can then be matched on using `semver` or `semver-coerced`\n const parts = goDirective.split('.');\n if (parts.length === 1) {\n return `${parts[0]}.0.0`;\n }\n if (parts.length === 2) {\n return `${parts[0]}.${parts[1]}.0`;\n }\n return `${parts[0]}.${parts[1]}.${parts[2]}`;\n }\n\n async getLatestVersion(\n baseUrl: string,\n packageName: string,\n ): Promise<{ version: string; sourceUrl?: string } | null> {\n try {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@latest',\n );\n const res = await this.http.getJson(url, VersionInfo);\n const { Version: version, Origin: origin } = res.body;\n // Extract sourceUrl from GOPROXY Origin when present, avoiding go-get to\n // vanity hosts (https://github.com/renovatebot/renovate/discussions/44898)\n const sourceUrl =\n origin?.VCS === 'git' && isNonEmptyString(origin.URL)\n ? origin.URL.replace(regEx(/\\.git$/), '')\n : undefined;\n return { version, sourceUrl };\n } catch (err) {\n logger.trace({ err }, 'Failed to get latest version');\n return null;\n }\n }\n\n async getVersionsWithInfo(\n baseUrl: string,\n packageName: string,\n constraintsFiltering: ConstraintsFilter | undefined,\n ): Promise<ReleaseResult> {\n const isGopkgin = packageName.startsWith('gopkg.in/');\n const majorSuffixSeparator = isGopkgin ? '.' : '/';\n const modParts = packageName.match(modRegex)?.groups;\n /* v8 ignore start: defensive - modRegex matches any non-empty package name, so baseMod is always set */\n const baseMod = modParts?.baseMod ?? packageName;\n /* v8 ignore stop */\n const packageMajor = parseInt(modParts?.majorVersion ?? '0', 10);\n\n const result: ReleaseResult = { releases: [] };\n for (let major = packageMajor; ; major += 1) {\n let pkg = `${baseMod}${majorSuffixSeparator}v${major}`;\n if (!isGopkgin && major < 2) {\n pkg = baseMod;\n major += 1; // v0 and v1 are the same module\n }\n\n let releases: Release[] = [];\n\n try {\n const res = await this.listVersions(baseUrl, pkg);\n\n // Artifactory returns all versions in any major (past and future),\n // so starting from v2, we filter them in order to avoid the infinite loop\n const filteredReleases = res.filter(({ version }) => {\n if (major < 2) {\n return true;\n }\n\n return (\n version.split(regEx(/[^\\d]+/)).find(isTruthy) === major.toString()\n );\n });\n\n const timestamps = await GoVersionTimestampCache.init(baseUrl, pkg);\n\n releases = await p.map(filteredReleases, async (versionInfo) => {\n const { version, newDigest, releaseTimestamp } = versionInfo;\n\n if (releaseTimestamp) {\n return { version, newDigest, releaseTimestamp };\n }\n\n const cachedTimestamp = timestamps.get(version);\n if (cachedTimestamp) {\n return { version, releaseTimestamp: cachedTimestamp };\n }\n\n try {\n const release = await this.versionInfo(baseUrl, pkg, version);\n if (release.releaseTimestamp) {\n timestamps.set(version, release.releaseTimestamp);\n }\n return release;\n } catch (err) {\n logger.trace({ err }, `Can't obtain data from ${baseUrl}`);\n return { version };\n }\n });\n\n await timestamps.save();\n\n if (constraintsFiltering === 'strict') {\n releases = await p.map(releases, async (rel) => {\n try {\n const goDirective = await this.retrieveGoDirectiveForModule(\n baseUrl,\n pkg,\n rel.version,\n );\n if (goDirective) {\n rel.constraints ??= {};\n rel.constraints['%goMod'] ??= [];\n rel.constraints['%goMod'].push(goDirective);\n }\n } catch (err) {\n logger.trace(\n { err },\n `Can't obtain \\`go\\` directive from ${baseUrl}`,\n );\n }\n\n return rel;\n });\n }\n\n result.releases.push(...releases);\n } catch (err) {\n const potentialHttpError =\n err instanceof ExternalHostError ? err.err : err;\n const status = potentialHttpError.response?.statusCode;\n if (\n potentialHttpError instanceof HttpError &&\n (status === 404 || status === 403) &&\n major !== packageMajor\n ) {\n break;\n }\n\n throw err;\n }\n\n const latest = await this.getLatestVersion(baseUrl, pkg);\n if (latest) {\n const { version: latestVersion, sourceUrl } = latest;\n result.tags ??= {};\n result.tags.latest ??= latestVersion;\n if (goVersioning.isGreaterThan(latestVersion, result.tags.latest)) {\n result.tags.latest = latestVersion;\n }\n if (sourceUrl) {\n result.sourceUrl ??= sourceUrl;\n }\n if (!result.releases.length) {\n const releaseFromLatest = pseudoVersionToRelease(latestVersion);\n // v8 ignore else -- needs an empty version list plus a non-pseudo latest\n if (releaseFromLatest) {\n result.releases.push(releaseFromLatest);\n }\n }\n }\n\n if (!releases.length) {\n break;\n }\n }\n\n return result;\n }\n\n static getCacheKey({\n packageName,\n constraintsFiltering,\n }: GetReleasesConfig): string {\n const goproxy = getEnv().GOPROXY;\n const noproxy = parseNoproxy();\n const constraintsFilteringKey =\n constraintsFiltering === 'none' ? '' : constraintsFiltering;\n return buildCacheKey(\n 'getReleases',\n packageName,\n goproxy,\n noproxy?.toString(),\n constraintsFilteringKey,\n );\n }\n\n static getVersionedCacheKey(packageName: string, version: string): string {\n const goproxy = getEnv().GOPROXY;\n const noproxy = parseNoproxy();\n return buildCacheKey(\n 'goDirective',\n packageName,\n version,\n goproxy,\n noproxy?.toString(),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,iBAAiB,MAAM,iCAAiC;AAE9D,MAAM,WAAW,MAAM,iDAAiD;AAExE,MAAM,kBAAkB,MAAM,MAAM;;;;;;AAOpC,MAAM,0BAA0B,MAAM,iBAAiB;;;;AAKvD,MAAM,qBAAqB,MACzB,gFACF;AAEA,SAAgB,uBAAuB,eAAuC;CAC5E,MAAM,QAAQ,cAAc,MAAM,kBAAkB,CAAC,EAAE;CACvD,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,EAAE,QAAQ,WAAW,cAAc;CAGzC,OAAO;EACL,SAAS;EACT;EACA,kBALuB,YAAY,SAKpB;CACjB;AACF;;;;;;;;AASA,SAAgB,aAAa,UAAkB,MAAgC;CAC7E,MAAM,YAAY,SACf,QAAQ,MAAM,SAAS,GAAG,EAAE,CAAC,CAC7B,MAAM,GAAG,CAAC,CACV,MAAM,CAAC;CACV,MAAM,WAAW,CAAC,GAAG,IAAI;CAEzB,OAAO,UAAU,QAAQ;EACvB,MAAM,SAAS,GAAG,UAAU,KAAK,GAAG,EAAE;EAOtC,IALe,SAAS,MACrB,QACC,IAAI,WAAW,MAAM,KACrB,gBAAgB,KAAK,IAAI,MAAM,OAAO,MAAM,CAAC,CAExC,GACP,OAAO;EAGT,UAAU,MAAM;CAClB;CAEA,OAAO;AACT;AAEA,IAAa,oBAAb,MAAa,0BAA0B,WAAW;CAChD,OAAgB,KAAK;CAErB,cAAc;EACZ,MAAM,kBAAkB,EAAE;CAC5B;CAEA,SAAkB,IAAI,mBAAmB;CAEzC,aAA8B,IAAI,WAAW,yBAAyB,EAAE;CAExE,MAAc,aACZ,QAC+B;EAC/B,MAAM,EAAE,gBAAgB;EACxB,OAAO,MAAM,uBAAuB,YAAY,EAAE;EAClD,MAAM,UAAU,OAAO,CAAC,CAA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ACZ,MAAM,qBACJ,eAAe,oBAAoB,IAAI,MAAM;IAC/C,MAAM,SAAS,mBAAmB,UAAU;IAC5C,IACE,8BAA8BC,iBAC7B,WAAW,OAAO,WAAW,QAC9B,UAAU,cAEV;IAGF,MAAM;GACR;GAEA,MAAM,SAAS,MAAM,KAAK,iBAAiB,SAAS,GAAG;GACvD,IAAI,QAAQ;IACV,MAAM,EAAE,SAAS,eAAe,cAAc;IAC9C,OAAO,SAAS,CAAC;IACjB,OAAO,KAAK,WAAW;IACvB,IAAIC,IAAa,cAAc,eAAe,OAAO,KAAK,MAAM,GAC9D,OAAO,KAAK,SAAS;IAEvB,IAAI,WACF,OAAO,cAAc;IAEvB,IAAI,CAAC,OAAO,SAAS,QAAQ;KAC3B,MAAM,oBAAoB,uBAAuB,aAAa;;KAE9D,IAAI,mBACF,OAAO,SAAS,KAAK,iBAAiB;IAE1C;GACF;GAEA,IAAI,CAAC,SAAS,QACZ;EAEJ;EAEA,OAAO;CACT;CAEA,OAAO,YAAY,EACjB,aACA,wBAC4B;EAC5B,MAAM,UAAU,OAAO,CAAC,CAAC;EACzB,MAAM,UAAU,aAAa;EAC7B,MAAM,0BACJ,yBAAyB,SAAS,KAAK;EACzC,OAAO,cACL,eACA,aACA,SACA,SAAS,SAAS,GAClB,uBACF;CACF;CAEA,OAAO,qBAAqB,aAAqB,SAAyB;EACxE,MAAM,UAAU,OAAO,CAAC,CAAC;EACzB,MAAM,UAAU,aAAa;EAC7B,OAAO,cACL,eACA,aACA,SACA,SACA,SAAS,SAAS,CACpB;CACF;AACF"}
1
+ {"version":3,"file":"releases-goproxy.js","names":["p.map","HttpError","goVersioning"],"sources":["../../../../lib/modules/datasource/go/releases-goproxy.ts"],"sourcesContent":["import {\n isNonEmptyString,\n isNonEmptyStringAndNotWhitespace,\n isTruthy,\n} from '@sindresorhus/is';\nimport type { ConstraintsFilter } from '../../../config/types.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport { buildCacheKey } from '../../../util/cache/package/key.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { detectPlatform } from '../../../util/common.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { filterMap } from '../../../util/filter-map.ts';\nimport {\n queryReleases,\n queryTags,\n} from '../../../util/github/graphql/index.ts';\nimport { GithubHttp } from '../../../util/http/github.ts';\nimport { HttpError } from '../../../util/http/index.ts';\nimport * as p from '../../../util/promises.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\nimport type { Timestamp } from '../../../util/timestamp.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport {\n joinUrlParts,\n parseUrl,\n trimLeadingSlash,\n trimTrailingSlash,\n} from '../../../util/url.ts';\nimport goVersioning from '../../versioning/go-mod-directive/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport { GithubReleasesDatasource } from '../github-releases/index.ts';\nimport type { GetReleasesConfig, Release, ReleaseResult } from '../types.ts';\nimport { BaseGoDatasource } from './base.ts';\nimport { getSourceUrl, isPublicGoPackage, publicGoproxyUrl } from './common.ts';\nimport { parseGoproxy, parseNoproxy } from './goproxy-parser.ts';\nimport { GoDirectDatasource } from './releases-direct.ts';\nimport { VersionInfo } from './schema.ts';\nimport { GoVersionTimestampCache } from './timestamp-cache.ts';\n\n/** TODO #42566 */\nconst goVersionRegex = regEx(/^\\s*go\\s+(?<version>[^\\s]+)\\s*$/);\n\nconst modRegex = regEx(/^(?<baseMod>.*?)(?:[./]v(?<majorVersion>\\d+))?$/);\n\nconst versionTagRegex = regEx(/^v\\d/);\n\n/**\n * Modules with a major version of v2 or above which have no `go.mod` are reported by a Go proxy with a `+incompatible` suffix, which is absent from the tag they were published as.\n *\n * @see https://go.dev/ref/mod#non-module-compat\n */\nconst incompatibleSuffixRegex = regEx(/\\+incompatible$/);\n\n/**\n * @see https://go.dev/ref/mod#pseudo-versions\n */\nconst pseudoVersionRegex = regEx(\n /v\\d+\\.\\d+\\.\\d+-(?:\\w+\\.)?(?:0\\.)?(?<timestamp>\\d{14})-(?<digest>[a-f0-9]{12})/i,\n);\n\nexport function pseudoVersionToRelease(pseudoVersion: string): Release | null {\n const match = pseudoVersion.match(pseudoVersionRegex)?.groups;\n if (!match) {\n return null;\n }\n\n const { digest: newDigest, timestamp } = match;\n const releaseTimestamp = asTimestamp(timestamp);\n\n return {\n version: pseudoVersion,\n newDigest,\n releaseTimestamp,\n };\n}\n\n/**\n * A Go module which lives in a subdirectory of its repository is tagged with that subdirectory as a prefix, so `github.com/aws/aws-sdk-go-v2/service/s3` publishes `v1.2.3` as the tag `service/s3/v1.2.3`.\n *\n * @see https://go.dev/ref/mod#vcs-version\n *\n * Because we can't tell from the module path alone where the repository ends and the subdirectory begins, we try each candidate prefix - longest first - against the tags we actually found, in the same way as `filterByPrefix` does for direct lookups.\n */\nexport function getTagPrefix(goModule: string, tags: Iterable<string>): string {\n const nameParts = goModule\n .replace(regEx(/\\/v\\d+$/), '')\n .split('/')\n .slice(1);\n const tagNames = [...tags];\n\n while (nameParts.length) {\n const prefix = `${nameParts.join('/')}/`;\n\n const isUsed = tagNames.some(\n (tag) =>\n tag.startsWith(prefix) &&\n versionTagRegex.test(tag.slice(prefix.length)),\n );\n if (isUsed) {\n return prefix;\n }\n\n nameParts.shift();\n }\n\n return '';\n}\n\nexport class GoProxyDatasource extends Datasource {\n static readonly id = 'go-proxy';\n\n constructor() {\n super(GoProxyDatasource.id);\n }\n\n readonly direct = new GoDirectDatasource();\n\n private readonly githubHttp = new GithubHttp(GithubReleasesDatasource.id);\n\n private async _getReleases(\n config: GetReleasesConfig,\n ): Promise<ReleaseResult | null> {\n const { packageName } = config;\n logger.trace(`goproxy.getReleases(${packageName})`);\n const goproxy = getEnv().GOPROXY ?? `${publicGoproxyUrl},direct`;\n if (goproxy === 'direct') {\n return this.getDirectReleases(config);\n }\n const proxyList = parseGoproxy(goproxy);\n const noproxy = parseNoproxy();\n\n let result: ReleaseResult | null = null;\n let servedByProxy = false;\n\n if (noproxy?.test(packageName)) {\n logger.debug(`Fetching ${packageName} via GONOPROXY match`);\n result = await this.getDirectReleases(config);\n return result;\n }\n\n for (const { url, fallback } of proxyList) {\n try {\n if (url === 'off') {\n break;\n } else if (url === 'direct') {\n result = await this.getDirectReleases(config);\n break;\n }\n\n const res = await this.getVersionsWithInfo(\n url,\n packageName,\n config.constraintsFiltering,\n );\n if (res.releases.length) {\n result = res;\n servedByProxy = true;\n break;\n }\n } catch (err) {\n const potentialHttpError =\n err instanceof ExternalHostError ? err.err : err;\n const statusCode = potentialHttpError?.response?.statusCode;\n const canFallback =\n fallback === '|' ? true : statusCode === 404 || statusCode === 410;\n if (!canFallback) {\n logger.debug(\n { err },\n 'Goproxy error: not falling back to other URLs provided with GOPROXY, rethrowing',\n );\n this.handleGenericErrors(err);\n }\n logger.debug(\n { err },\n 'Goproxy error: trying next URL provided with GOPROXY',\n );\n }\n }\n\n if (result && !result.sourceUrl) {\n try {\n const datasource = await BaseGoDatasource.getDatasource(packageName);\n const sourceUrl = getSourceUrl(datasource);\n if (sourceUrl) {\n result.sourceUrl = sourceUrl;\n }\n } catch (err) {\n logger.trace({ err }, `Can't get datasource for ${packageName}`);\n }\n }\n\n if (result?.sourceUrl && servedByProxy) {\n await this.addGithubTimestamps(\n packageName,\n result.sourceUrl,\n result.releases,\n );\n }\n\n return result;\n }\n\n /**\n * Looks up a module directly from its source, or from the module proxy its `go-import` meta tag advertises with the `mod` VCS, as with private Buf Schema Registries.\n */\n private async getDirectReleases(\n config: GetReleasesConfig,\n ): Promise<ReleaseResult | null> {\n const { packageName } = config;\n\n const source = await BaseGoDatasource.getDatasource(packageName);\n if (!source) {\n const modProxyUrl = await BaseGoDatasource.getModProxyUrl(packageName);\n if (modProxyUrl) {\n logger.debug(\n `Fetching ${packageName} via go-import mod proxy ${modProxyUrl}`,\n );\n const res = await this.getVersionsWithInfo(\n modProxyUrl,\n packageName,\n config.constraintsFiltering,\n );\n return res.releases.length ? res : null;\n }\n }\n\n return this.direct.getReleases(config);\n }\n\n /**\n * A Go proxy reports the commit time of the tagged commit as a version's `Time`, which can be much earlier than the point at which that version was released.\n *\n * When the module is hosted on GitHub, a GitHub Release's publication time, or - if there's no Release - the git tag's own creation time (distinct from the commit time for an annotated tag), is a better indicator of when the version became available. A Release is preferred over a tag when both exist for the same version.\n */\n async addGithubTimestamps(\n packageName: string,\n sourceUrl: string,\n releases: Release[],\n ): Promise<void> {\n if (detectPlatform(sourceUrl) !== 'github') {\n return;\n }\n\n const parsedUrl = parseUrl(sourceUrl);\n /* v8 ignore next -- detectPlatform only returns a platform for parseable URLs */\n if (!parsedUrl) {\n return;\n }\n\n const repository = trimTrailingSlash(\n trimLeadingSlash(parsedUrl.pathname),\n ).replace(regEx(/\\.git$/), '');\n const githubConfig = {\n packageName: repository,\n registryUrl: parsedUrl.origin,\n };\n\n const [githubTags, githubReleases] = await Promise.all([\n queryTags(githubConfig, this.githubHttp).catch((err) => {\n logger.debug(\n { err, packageName },\n 'Error fetching GitHub Tags for Go module',\n );\n return [];\n }),\n queryReleases(githubConfig, this.githubHttp).catch((err) => {\n logger.debug(\n { err, packageName },\n 'Error fetching GitHub Releases for Go module',\n );\n return [];\n }),\n ]);\n\n const timestamps = new Map<string, Timestamp>();\n for (const { version, releaseTimestamp } of githubTags) {\n timestamps.set(version, releaseTimestamp);\n }\n for (const { version, releaseTimestamp } of githubReleases) {\n timestamps.set(version, releaseTimestamp);\n }\n\n const tagPrefix = getTagPrefix(packageName, timestamps.keys());\n for (const release of releases) {\n const version = release.version.replace(incompatibleSuffixRegex, '');\n const releaseTimestamp = timestamps.get(`${tagPrefix}${version}`);\n if (\n releaseTimestamp &&\n (!release.releaseTimestamp ||\n releaseTimestamp > release.releaseTimestamp)\n ) {\n release.releaseTimestamp = releaseTimestamp;\n }\n }\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n return withCache(\n {\n namespace: `datasource-${GoProxyDatasource.id}`,\n key: GoProxyDatasource.getCacheKey(config),\n cacheable: isPublicGoPackage(config.packageName),\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n\n /**\n * Avoid ambiguity when serving from case-insensitive file systems.\n *\n * @see https://golang.org/ref/mod#goproxy-protocol\n */\n encodeCase(input: string): string {\n return input.replace(regEx(/(?:[A-Z])/g), (x) => `!${x.toLowerCase()}`);\n }\n\n async listVersions(baseUrl: string, packageName: string): Promise<Release[]> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n 'list',\n );\n const { body } = await this.http.getText(url);\n return filterMap(body.split(newlineRegex), (str) => {\n if (!isNonEmptyStringAndNotWhitespace(str)) {\n return null;\n }\n\n const [version, timestamp] = str.trim().split(regEx(/\\s+/));\n const release: Release = pseudoVersionToRelease(version) ?? { version };\n\n const releaseTimestamp = asTimestamp(timestamp);\n if (releaseTimestamp) {\n release.releaseTimestamp = releaseTimestamp;\n }\n\n return release;\n });\n }\n\n async versionInfo(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<Release> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n `${version}.info`,\n );\n const res = await this.http.getJson(url, VersionInfo);\n\n const result: Release = {\n version: res.body.Version,\n };\n\n const releaseTimestamp = asTimestamp(res.body.Time);\n if (releaseTimestamp) {\n result.releaseTimestamp = releaseTimestamp;\n }\n\n return result;\n }\n\n /**\n * Retrieve the `go` directive for a given Go Module.\n *\n * NOTE that this means the `go` directive, not the `toolchain` directive.\n */\n async retrieveGoDirectiveForModule(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<string | undefined> {\n return withCache(\n {\n namespace: `datasource-${GoProxyDatasource.id}`,\n key: GoProxyDatasource.getVersionedCacheKey(packageName, version),\n // a module's `go.mod` should /never/ change after it's published. If going via the Go Proxy and the Go Checksum Database, a change in this value will result in build failures.\n ttlMinutes: 100 * 24 * 60,\n cacheable: isPublicGoPackage(packageName),\n },\n () => this._retrieveGoDirectiveForModule(baseUrl, packageName, version),\n );\n }\n\n async _retrieveGoDirectiveForModule(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<string | undefined> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n `${version}.mod`,\n );\n const res = await this.http.getText(url);\n\n let goDirective: string | undefined = undefined;\n\n for (const line of res.body.split('\\n')) {\n const goVersionMatches = goVersionRegex.exec(line)?.groups;\n if (goVersionMatches) {\n goDirective = goVersionMatches.version;\n break;\n }\n }\n\n if (!goDirective) {\n return goDirective;\n }\n\n // always return it in full SemVer format, which can then be matched on using `semver` or `semver-coerced`\n const parts = goDirective.split('.');\n if (parts.length === 1) {\n return `${parts[0]}.0.0`;\n }\n if (parts.length === 2) {\n return `${parts[0]}.${parts[1]}.0`;\n }\n return `${parts[0]}.${parts[1]}.${parts[2]}`;\n }\n\n async getLatestVersion(\n baseUrl: string,\n packageName: string,\n ): Promise<{ version: string; sourceUrl?: string } | null> {\n try {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@latest',\n );\n const res = await this.http.getJson(url, VersionInfo);\n const { Version: version, Origin: origin } = res.body;\n // Extract sourceUrl from GOPROXY Origin when present, avoiding go-get to\n // vanity hosts (https://github.com/renovatebot/renovate/discussions/44898)\n const sourceUrl =\n origin?.VCS === 'git' && isNonEmptyString(origin.URL)\n ? origin.URL.replace(regEx(/\\.git$/), '')\n : undefined;\n return { version, sourceUrl };\n } catch (err) {\n logger.trace({ err }, 'Failed to get latest version');\n return null;\n }\n }\n\n async getVersionsWithInfo(\n baseUrl: string,\n packageName: string,\n constraintsFiltering: ConstraintsFilter | undefined,\n ): Promise<ReleaseResult> {\n const isGopkgin = packageName.startsWith('gopkg.in/');\n const majorSuffixSeparator = isGopkgin ? '.' : '/';\n const modParts = packageName.match(modRegex)?.groups;\n /* v8 ignore start: defensive - modRegex matches any non-empty package name, so baseMod is always set */\n const baseMod = modParts?.baseMod ?? packageName;\n /* v8 ignore stop */\n const packageMajor = parseInt(modParts?.majorVersion ?? '0', 10);\n\n const result: ReleaseResult = { releases: [] };\n for (let major = packageMajor; ; major += 1) {\n let pkg = `${baseMod}${majorSuffixSeparator}v${major}`;\n if (!isGopkgin && major < 2) {\n pkg = baseMod;\n major += 1; // v0 and v1 are the same module\n }\n\n let releases: Release[] = [];\n\n try {\n const res = await this.listVersions(baseUrl, pkg);\n\n // Artifactory returns all versions in any major (past and future),\n // so starting from v2, we filter them in order to avoid the infinite loop\n const filteredReleases = res.filter(({ version }) => {\n if (major < 2) {\n return true;\n }\n\n return (\n version.split(regEx(/[^\\d]+/)).find(isTruthy) === major.toString()\n );\n });\n\n const timestamps = await GoVersionTimestampCache.init(baseUrl, pkg);\n\n releases = await p.map(filteredReleases, async (versionInfo) => {\n const { version, newDigest, releaseTimestamp } = versionInfo;\n\n if (releaseTimestamp) {\n return { version, newDigest, releaseTimestamp };\n }\n\n const cachedTimestamp = timestamps.get(version);\n if (cachedTimestamp) {\n return { version, releaseTimestamp: cachedTimestamp };\n }\n\n try {\n const release = await this.versionInfo(baseUrl, pkg, version);\n if (release.releaseTimestamp) {\n timestamps.set(version, release.releaseTimestamp);\n }\n return release;\n } catch (err) {\n logger.trace({ err }, `Can't obtain data from ${baseUrl}`);\n return { version };\n }\n });\n\n await timestamps.save();\n\n if (constraintsFiltering === 'strict') {\n releases = await p.map(releases, async (rel) => {\n try {\n const goDirective = await this.retrieveGoDirectiveForModule(\n baseUrl,\n pkg,\n rel.version,\n );\n if (goDirective) {\n rel.constraints ??= {};\n rel.constraints['%goMod'] ??= [];\n rel.constraints['%goMod'].push(goDirective);\n }\n } catch (err) {\n logger.trace(\n { err },\n `Can't obtain \\`go\\` directive from ${baseUrl}`,\n );\n }\n\n return rel;\n });\n }\n\n result.releases.push(...releases);\n } catch (err) {\n const potentialHttpError =\n err instanceof ExternalHostError ? err.err : err;\n const status = potentialHttpError.response?.statusCode;\n if (\n potentialHttpError instanceof HttpError &&\n (status === 404 || status === 403) &&\n major !== packageMajor\n ) {\n break;\n }\n\n throw err;\n }\n\n const latest = await this.getLatestVersion(baseUrl, pkg);\n if (latest) {\n const { version: latestVersion, sourceUrl } = latest;\n result.tags ??= {};\n result.tags.latest ??= latestVersion;\n if (goVersioning.isGreaterThan(latestVersion, result.tags.latest)) {\n result.tags.latest = latestVersion;\n }\n if (sourceUrl) {\n result.sourceUrl ??= sourceUrl;\n }\n if (!result.releases.length) {\n const releaseFromLatest = pseudoVersionToRelease(latestVersion);\n // v8 ignore else -- needs an empty version list plus a non-pseudo latest\n if (releaseFromLatest) {\n result.releases.push(releaseFromLatest);\n }\n }\n }\n\n if (!releases.length) {\n break;\n }\n }\n\n return result;\n }\n\n static getCacheKey({\n packageName,\n constraintsFiltering,\n }: GetReleasesConfig): string {\n const goproxy = getEnv().GOPROXY;\n const noproxy = parseNoproxy();\n const constraintsFilteringKey =\n constraintsFiltering === 'none' ? '' : constraintsFiltering;\n return buildCacheKey(\n 'getReleases',\n packageName,\n goproxy,\n noproxy?.toString(),\n constraintsFilteringKey,\n );\n }\n\n static getVersionedCacheKey(packageName: string, version: string): string {\n const goproxy = getEnv().GOPROXY;\n const noproxy = parseNoproxy();\n return buildCacheKey(\n 'goDirective',\n packageName,\n version,\n goproxy,\n noproxy?.toString(),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,iBAAiB,MAAM,iCAAiC;AAE9D,MAAM,WAAW,MAAM,iDAAiD;AAExE,MAAM,kBAAkB,MAAM,MAAM;;;;;;AAOpC,MAAM,0BAA0B,MAAM,iBAAiB;;;;AAKvD,MAAM,qBAAqB,MACzB,gFACF;AAEA,SAAgB,uBAAuB,eAAuC;CAC5E,MAAM,QAAQ,cAAc,MAAM,kBAAkB,CAAC,EAAE;CACvD,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,EAAE,QAAQ,WAAW,cAAc;CAGzC,OAAO;EACL,SAAS;EACT;EACA,kBALuB,YAAY,SAKpB;CACjB;AAC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SAAS,MAAM,KAAK,iBAAiB,SAAS,GAAG;GACvD,IAAI,QAAQ;IACV,MAAM,EAAE,SAAS,eAAe,cAAc;IAC9C,OAAO,SAAS,CAAC;IACjB,OAAO,KAAK,WAAW;IACvB,IAAIC,IAAa,cAAc,eAAe,OAAO,KAAK,MAAM,GAC9D,OAAO,KAAK,SAAS;IAEvB,IAAI,WACF,OAAO,cAAc;IAEvB,IAAI,CAAC,OAAO,SAAS,QAAQ;KAC3B,MAAM,oBAAoB,uBAAuB,aAAa;;KAE9D,IAAI,mBACF,OAAO,SAAS,KAAK,iBAAiB;IAE1C;GACF;GAEA,IAAI,CAAC,SAAS,QACZ;EAEJ;EAEA,OAAO;CACT;CAEA,OAAO,YAAY,EACjB,aACA,wBAC4B;EAC5B,MAAM,UAAU,OAAO,CAAC,CAAC;EACzB,MAAM,UAAU,aAAa;EAC7B,MAAM,0BACJ,yBAAyB,SAAS,KAAK;EACzC,OAAO,cACL,eACA,aACA,SACA,SAAS,SAAS,GAClB,uBACF;CACF;CAEA,OAAO,qBAAqB,aAAqB,SAAyB;EACxE,MAAM,UAAU,OAAO,CAAC,CAAC;EACzB,MAAM,UAAU,aAAa;EAC7B,OAAO,cACL,eACA,aACA,SACA,SACA,SAAS,SAAS,CACpB;CACF;AACF"}
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": "44.163.0",
4
+ "version": "44.164.0",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "renovate": "dist/renovate.js",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$id": "https://docs.renovatebot.com/renovate-schema.json",
3
- "title": "JSON schema for Renovate 44.163.0 config files (https://renovatebot.com/)",
3
+ "title": "JSON schema for Renovate 44.164.0 config files (https://renovatebot.com/)",
4
4
  "$schema": "http://json-schema.org/draft-07/schema#",
5
- "x-renovate-version": "44.163.0",
5
+ "x-renovate-version": "44.164.0",
6
6
  "allowComments": true,
7
7
  "type": "object",
8
8
  "definitions": {