metascope 0.8.4 → 0.9.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.
Files changed (103) hide show
  1. package/dist/bin/cli.js +30426 -29237
  2. package/dist/bin/{jiti-DDHyYNLW.js → jiti-B26uDQuv.js} +2 -2
  3. package/dist/bin/renovate-CEC0BhMB.js +1 -0
  4. package/dist/bin/shared-Ch5JsD6s.js +8 -0
  5. package/dist/bin/shared2-Dhjk_Okb.js +1 -0
  6. package/dist/bin/web-tree-sitter.wasm +0 -0
  7. package/dist/lib/data/license-urls.js +2904 -0
  8. package/dist/lib/file-matching.js +5 -2
  9. package/dist/lib/log.d.ts +0 -1
  10. package/dist/lib/metadata-types.d.ts +16 -9
  11. package/dist/lib/metadata.d.ts +0 -1
  12. package/dist/lib/metadata.js +5 -5
  13. package/dist/lib/package.js +1 -1
  14. package/dist/lib/parsers/configparser-parser.js +14 -12
  15. package/dist/lib/parsers/gemspec-parser.js +41 -42
  16. package/dist/lib/parsers/go-mod-parser.js +51 -45
  17. package/dist/lib/parsers/makefile-config-parser.js +7 -6
  18. package/dist/lib/parsers/properties-parser.js +1 -1
  19. package/dist/lib/parsers/rfc822-header-parser.js +8 -6
  20. package/dist/lib/parsers/setup-py-parser.js +28 -24
  21. package/dist/lib/source.d.ts +6 -2
  22. package/dist/lib/sources/arduino-library-properties.d.ts +0 -1
  23. package/dist/lib/sources/arduino-library-properties.js +6 -7
  24. package/dist/lib/sources/cinder-cinderblock-xml.d.ts +0 -1
  25. package/dist/lib/sources/cinder-cinderblock-xml.js +5 -5
  26. package/dist/lib/sources/code-stats.d.ts +3 -2
  27. package/dist/lib/sources/codemeta-json.d.ts +0 -1
  28. package/dist/lib/sources/codemeta-json.js +21 -20
  29. package/dist/lib/sources/dependency-updates.d.ts +17 -8
  30. package/dist/lib/sources/dependency-updates.js +38 -34
  31. package/dist/lib/sources/file-stats.d.ts +7 -4
  32. package/dist/lib/sources/git-config.d.ts +0 -1
  33. package/dist/lib/sources/git-stats.d.ts +47 -24
  34. package/dist/lib/sources/git-stats.js +51 -33
  35. package/dist/lib/sources/github-actions.d.ts +0 -1
  36. package/dist/lib/sources/github-actions.js +4 -3
  37. package/dist/lib/sources/github.d.ts +156 -78
  38. package/dist/lib/sources/github.js +11 -8
  39. package/dist/lib/sources/go-go-mod.d.ts +0 -1
  40. package/dist/lib/sources/go-goreleaser-yaml.d.ts +0 -1
  41. package/dist/lib/sources/go-goreleaser-yaml.js +5 -3
  42. package/dist/lib/sources/java-pom-xml.d.ts +0 -1
  43. package/dist/lib/sources/java-pom-xml.js +12 -12
  44. package/dist/lib/sources/license-file.d.ts +0 -1
  45. package/dist/lib/sources/metadata-file.d.ts +0 -1
  46. package/dist/lib/sources/metadata-file.js +9 -10
  47. package/dist/lib/sources/metascope.d.ts +9 -5
  48. package/dist/lib/sources/node-npm-registry.d.ts +21 -11
  49. package/dist/lib/sources/node-npm-registry.js +12 -6
  50. package/dist/lib/sources/node-package-json.d.ts +0 -1
  51. package/dist/lib/sources/obsidian-plugin-manifest-json.d.ts +17 -9
  52. package/dist/lib/sources/obsidian-plugin-manifest-json.js +2 -2
  53. package/dist/lib/sources/obsidian-plugin-registry.d.ts +3 -2
  54. package/dist/lib/sources/obsidian-plugin-registry.js +2 -1
  55. package/dist/lib/sources/openframeworks-addon-config-mk.d.ts +0 -1
  56. package/dist/lib/sources/openframeworks-install-xml.d.ts +0 -1
  57. package/dist/lib/sources/openframeworks-install-xml.js +3 -3
  58. package/dist/lib/sources/processing-library-properties.d.ts +0 -1
  59. package/dist/lib/sources/processing-library-properties.js +9 -10
  60. package/dist/lib/sources/processing-sketch-properties.d.ts +0 -1
  61. package/dist/lib/sources/processing-sketch-properties.js +13 -20
  62. package/dist/lib/sources/publiccode-yaml.d.ts +0 -1
  63. package/dist/lib/sources/publiccode-yaml.js +61 -58
  64. package/dist/lib/sources/python-pkg-info.d.ts +0 -1
  65. package/dist/lib/sources/python-pkg-info.js +6 -5
  66. package/dist/lib/sources/python-pypi-registry.d.ts +21 -11
  67. package/dist/lib/sources/python-pypi-registry.js +23 -16
  68. package/dist/lib/sources/python-pyproject-toml.d.ts +0 -1
  69. package/dist/lib/sources/python-setup-cfg.d.ts +2 -3
  70. package/dist/lib/sources/python-setup-cfg.js +10 -9
  71. package/dist/lib/sources/python-setup-py.d.ts +0 -1
  72. package/dist/lib/sources/readme-file.d.ts +0 -1
  73. package/dist/lib/sources/readme-file.js +4 -3
  74. package/dist/lib/sources/ruby-gemspec.d.ts +0 -1
  75. package/dist/lib/sources/rust-cargo-toml.d.ts +0 -1
  76. package/dist/lib/sources/rust-cargo-toml.js +1 -1
  77. package/dist/lib/sources/xcode-info-plist.d.ts +0 -1
  78. package/dist/lib/sources/xcode-info-plist.js +29 -31
  79. package/dist/lib/sources/xcode-project-pbxproj.d.ts +0 -1
  80. package/dist/lib/sources/xcode-project-pbxproj.js +17 -16
  81. package/dist/lib/templates/codemeta-json.d.ts +1 -0
  82. package/dist/lib/templates/codemeta.d.ts +1 -0
  83. package/dist/lib/templates/codemeta.js +98 -89
  84. package/dist/lib/templates/frontmatter.d.ts +2 -1
  85. package/dist/lib/templates/frontmatter.js +1 -1
  86. package/dist/lib/templates/index.d.ts +2 -1
  87. package/dist/lib/templates/index.js +1 -1
  88. package/dist/lib/templates/metadata.d.ts +1 -0
  89. package/dist/lib/templates/project.d.ts +1 -0
  90. package/dist/lib/utilities/codemeta-helpers.js +14 -13
  91. package/dist/lib/utilities/fetch.js +18 -2
  92. package/dist/lib/utilities/formatting.js +1 -1
  93. package/dist/lib/utilities/github.js +2 -2
  94. package/dist/lib/utilities/license-identification.d.ts +9 -4
  95. package/dist/lib/utilities/license-identification.js +37 -23
  96. package/dist/lib/utilities/template-helpers.d.ts +7 -5
  97. package/dist/lib/utilities/template-helpers.js +15 -14
  98. package/dist/lib/utilities/tree-sitter-wasm.d.ts +0 -1
  99. package/dist/lib/utilities/tree-sitter-wasm.js +1 -1
  100. package/package.json +18 -17
  101. package/readme.md +13 -11
  102. package/dist/bin/renovate-CpDMbQZd.js +0 -1
  103. package/dist/bin/shared-Dix5HPlG.js +0 -6
@@ -1,3 +1,4 @@
1
+ import license_urls_default from "../data/license-urls.js";
1
2
  import spdxLicenseList from "spdx-license-list/full.js";
2
3
  //#region src/lib/utilities/license-identification.ts
3
4
  /**
@@ -16,6 +17,10 @@ import spdxLicenseList from "spdx-license-list/full.js";
16
17
  * - YAML front matter stripping
17
18
  */
18
19
  const SPDX_BASE_URL = "https://spdx.org/licenses/";
20
+ /** Leading `www.` subdomain. */
21
+ const WWW_PREFIX_REGEX = /^www\./v;
22
+ /** Direct URLs resolved by the explicit `update-license-urls` content step. */
23
+ const directLicenseUrls = new Map(Object.entries(license_urls_default).map(([spdxId, entry]) => [spdxId, entry.url]));
19
24
  /** Minimum similarity score to consider a match. */
20
25
  const CONFIDENCE_THRESHOLD = .75;
21
26
  /**
@@ -50,6 +55,7 @@ function identifyLicense(text) {
50
55
  */
51
56
  function buildMatch(spdxId, confidence) {
52
57
  const entry = spdxLicenseList[spdxId];
58
+ if (entry === void 0) throw new Error(`Unknown SPDX license ID "${spdxId}"`);
53
59
  return {
54
60
  confidence,
55
61
  name: entry.name,
@@ -65,13 +71,13 @@ function spdxIdToUrl(spdxId) {
65
71
  return `${SPDX_BASE_URL}${spdxId}`;
66
72
  }
67
73
  /**
68
- * Resolve the canonical URL for an SPDX license ID. Prefers the upstream URL
69
- * recorded in the SPDX list (e.g. `https://opensource.org/license/mit/`) and
70
- * falls back to the SPDX registry URL for the handful of entries whose upstream
71
- * URL is missing at runtime.
74
+ * Resolve an audited HTTPS URL for an SPDX license ID from the checked-in URL
75
+ * audit. Falls back to the stable SPDX registry URL for IDs missing from the
76
+ * generated data.
72
77
  */
73
78
  function getLicenseUrl(spdxId) {
74
- return spdxLicenseList[spdxId]?.url ?? spdxIdToUrl(spdxId);
79
+ const fallback = spdxIdToUrl(spdxId);
80
+ return directLicenseUrls.get(spdxId) ?? fallback;
75
81
  }
76
82
  /**
77
83
  * Strip YAML front matter (--- delimited blocks at the start of a file).
@@ -88,7 +94,7 @@ function stripFrontMatter(text) {
88
94
  * collapse whitespace, strip copyright lines, remove URLs, lowercase.
89
95
  */
90
96
  function normalizeText(text) {
91
- return text.replaceAll(/^#+\s+/gm, "").replaceAll(/^copyright.*$/gim, "").replaceAll(/^\|.*\|$/gm, "").replaceAll(/^[-|:\s]+$/gm, "").replaceAll(/https?:\/\/\S+/g, "").replaceAll(/\S+@\S+/g, "").replaceAll(/[[\]()]/g, " ").replaceAll(/\s+/g, " ").trim().toLowerCase();
97
+ return text.replaceAll(/^#+\s+/gmv, "").replaceAll(/^copyright.*$/gimv, "").replaceAll(/^\|.*\|$/gmv, "").replaceAll(/^[\-\|:\s]+$/gmv, "").replaceAll(/https?:\/\/\S+/gv, "").replaceAll(/\S+@\S+/gv, "").replaceAll(/[\[\]\(\)]/gv, " ").replaceAll(/\s+/gv, " ").trim().toLowerCase();
92
98
  }
93
99
  /**
94
100
  * Normalize input text (user-provided license file). Applies additional cleanup
@@ -141,19 +147,19 @@ function diceCoefficientCached(inputBigrams, inputTotal, referenceBigrams, refer
141
147
  */
142
148
  const HEADER_PATTERNS = [
143
149
  {
144
- pattern: /gnu lesser general public license\s+version 3/i,
150
+ pattern: /gnu lesser general public license\s+version 3/iv,
145
151
  spdxId: "LGPL-3.0-only"
146
152
  },
147
153
  {
148
- pattern: /gnu lesser general public license\s+version 2\.1/i,
154
+ pattern: /gnu lesser general public license\s+version 2\.1/iv,
149
155
  spdxId: "LGPL-2.1-only"
150
156
  },
151
157
  {
152
- pattern: /gnu lesser general public license\s+version 2(?:\.0)?(?!\.\d)/i,
158
+ pattern: /gnu lesser general public license\s+version 2(?:\.0)?(?!\.\d)/iv,
153
159
  spdxId: "LGPL-2.0-only"
154
160
  },
155
161
  {
156
- pattern: /gnu affero general public license\s+version 3/i,
162
+ pattern: /gnu affero general public license\s+version 3/iv,
157
163
  spdxId: "AGPL-3.0-only"
158
164
  }
159
165
  ];
@@ -166,21 +172,20 @@ function identifyByHeader(text) {
166
172
  * punctuation that commonly follows a URL in prose (`.`, `,`, `)`, `]`, etc.)
167
173
  * but is not part of the URL itself.
168
174
  */
169
- const URL_REGEX = /https?:\/\/[^\s<>"')\]}]+/gi;
170
- /** Leading `www.` subdomain. */
171
- const WWW_PREFIX_REGEX = /^www\./;
175
+ const URL_REGEX = /https?:\/\/[^\s<>"'\)\]\}]+/giv;
172
176
  /** Trailing `/legalcode` or `/legalcode.<ext>` on Creative Commons URLs. */
173
- const LEGALCODE_SUFFIX_REGEX = /\/legalcode(?:\.[a-z]+)?$/;
177
+ const LEGALCODE_SUFFIX_REGEX = /\/legalcode(?:\.[a-z]+)?$/v;
174
178
  /** Trailing slashes. */
175
- const TRAILING_SLASH_REGEX = /\/+$/;
179
+ const TRAILING_SLASH_REGEX = /\/+$/v;
176
180
  /** Trailing prose punctuation after a URL extracted from text. */
177
- const TRAILING_PUNCTUATION_REGEX = /[.,;:!?]+$/;
181
+ const TRAILING_PUNCTUATION_REGEX = /[.,;:!?]+$/v;
178
182
  /**
179
183
  * Normalize a URL for comparison: lowercase host+path, drop scheme, strip
180
184
  * `www.`, strip trailing slashes, and strip trailing `/legalcode(.ext)?`
181
185
  * suffixes used by Creative Commons canonical URLs.
182
186
  */
183
187
  function normalizeUrl(url) {
188
+ if (url === void 0 || url === "") return;
184
189
  let parsed;
185
190
  try {
186
191
  parsed = new URL(url.trim());
@@ -221,24 +226,33 @@ function getUrlIndex() {
221
226
  const index = /* @__PURE__ */ new Map();
222
227
  for (const [spdxId, entry] of Object.entries(spdxLicenseList)) {
223
228
  index.set(`spdx.org/licenses/${spdxId.toLowerCase()}`, spdxId);
224
- if (!entry.url) continue;
225
- const normalized = normalizeUrl(entry.url);
226
- if (!normalized) continue;
227
- const existing = index.get(normalized);
228
- index.set(normalized, existing ? preferSpdxId(existing, spdxId) : spdxId);
229
+ indexLicenseUrls(index, spdxId, entry.url);
229
230
  }
230
231
  urlIndex = index;
231
232
  return index;
232
233
  }
234
+ /**
235
+ * Add every normalized form of a license's URLs to the index, keeping the
236
+ * preferred SPDX ID when several IDs share a URL.
237
+ */
238
+ function indexLicenseUrls(index, spdxId, upstreamUrl) {
239
+ const candidates = /* @__PURE__ */ new Set([getLicenseUrl(spdxId), upstreamUrl]);
240
+ for (const candidate of candidates) {
241
+ const normalized = normalizeUrl(candidate);
242
+ if (normalized === void 0 || normalized === "") continue;
243
+ const existing = index.get(normalized);
244
+ index.set(normalized, existing === void 0 ? spdxId : preferSpdxId(existing, spdxId));
245
+ }
246
+ }
233
247
  function identifyByUrl(text) {
234
248
  const matches = text.match(URL_REGEX);
235
249
  if (!matches) return;
236
250
  const index = getUrlIndex();
237
251
  for (const raw of matches) {
238
252
  const normalized = normalizeUrl(raw.replace(TRAILING_PUNCTUATION_REGEX, ""));
239
- if (!normalized) continue;
253
+ if (normalized === void 0 || normalized === "") continue;
240
254
  const spdxId = index.get(normalized);
241
- if (spdxId) return buildMatch(spdxId, 1);
255
+ if (spdxId !== void 0 && spdxId !== "") return buildMatch(spdxId, 1);
242
256
  }
243
257
  }
244
258
  //#endregion
@@ -1,7 +1,5 @@
1
1
  import { CodeMetaJson } from "../sources/codemeta-json.js";
2
2
  import { NodePackageJsonData } from "../sources/node-package-json.js";
3
-
4
- //#region src/lib/utilities/template-helpers.d.ts
5
3
  declare namespace template_helpers_d_exports {
6
4
  export { REPLACEMENTS, collectArrayField, collectField, dependencyNames, ensureArray, firstOf, hasDependencyWithId, isAuthoredBy, isOnGithubAccountOf, isValidUrl, mixedStringsToArray, nonEmpty, splitCommaSeparated, stripNamespace, stripUndefined, toAlias, toBasicLicense, toBasicLicenses, toBasicNames, toDelimitedString, toLocalUrl, toMarkdownLink, toMb, toOptionalMarkdownLink, toStatus, toStatusLegacy, usesPnpm };
7
5
  }
@@ -125,15 +123,19 @@ declare function isAuthoredBy(codemetaAuthorName?: CodeMetaPersonOrOrg | CodeMet
125
123
  /**
126
124
  * True if project is on a specific GitHub account(s).
127
125
  */
128
- declare function isOnGithubAccountOf(codeRepository?: string, githubUserName?: string | string[]): boolean | undefined;
126
+ declare function isOnGithubAccountOf(codeRepo?: string, githubUsername?: string | string[]): boolean | undefined;
129
127
  /**
130
128
  * Legacy heuristic project status based on authorship and GitHub account.
131
129
  */
132
- declare function toStatusLegacy(codeRepository?: string, codemetaAuthorName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], authorName?: string | string[], githubUserName?: string | string[]): /** It's a fork on GitHub */('fork' /** I am original author, local or on github */ | 'source' /** Someone else's local code */ | 'unmaintained') | undefined;
130
+ declare function toStatusLegacy(codeRepo?: string, codemetaAuthorName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], authorName?: string | string[], githubUsername?: string | string[]): /** It's a fork on GitHub */ ('fork' |
131
+ /** I am original author, local or on github */
132
+ 'source' |
133
+ /** Someone else's local code */
134
+ 'unmaintained') | undefined;
133
135
  /**
134
136
  * Heuristic project status based on authorship and GitHub account.
135
137
  */
136
- declare function toStatus(codeRepository?: string, codemetaAuthorName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], codemetaContributorOrMaintainerName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], isGitHubFork?: boolean, myAuthorName?: string | string[], myGithubUserName?: string | string[]): 'author' /** I wrote the repo */ | 'maintainer' /** I contribute or help maintain it */ | 'observer' /** I look at this repo */ | 'unknown' /** It's unclear */;
138
+ declare function toStatus(codeRepo?: string, codemetaAuthorName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], codemetaContributorOrMaintainerName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], isGitHubFork?: boolean, myAuthorName?: string | string[], myGithubUsername?: string | string[]): 'author' | /** I wrote the repo */ 'maintainer' | /** I contribute or help maintain it */ 'observer' | /** I look at this repo */ 'unknown' /** It's unclear */;
137
139
  /**
138
140
  * True if valid url
139
141
  */
@@ -143,7 +143,7 @@ function stripNamespace(value) {
143
143
  */
144
144
  function toAlias(value) {
145
145
  if (is.nonEmptyString(value)) {
146
- const result = titleCase(stripNamespace(value)).replaceAll(/ {2,}/g, " ").trim();
146
+ const result = titleCase(stripNamespace(value)).replaceAll(/ {2,}/gv, " ").trim();
147
147
  return replaceCore(result, casePoliceDict) ?? result;
148
148
  }
149
149
  }
@@ -151,7 +151,7 @@ function toAlias(value) {
151
151
  * Escape a string for use in a regular expression.
152
152
  */
153
153
  function escapeRegExp(string_) {
154
- return string_.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
154
+ return string_.replaceAll(/[.*+?^$\{\}\(\)\|\[\]\\]/gv, String.raw`\$&`);
155
155
  }
156
156
  const REPLACEMENTS = /* @__PURE__ */ new Map([["javascript", "JavaScript"], ["typescript", "TypeScript"]]);
157
157
  /**
@@ -162,7 +162,7 @@ const compiledReplacementsCache = /* @__PURE__ */ new WeakMap();
162
162
  function getCompiledReplacements(replacements) {
163
163
  let compiled = compiledReplacementsCache.get(replacements);
164
164
  if (!compiled) {
165
- compiled = Array.from(replacements, ([search, replace]) => [new RegExp(escapeRegExp(search), "gi"), replace]);
165
+ compiled = Array.from(replacements, ([search, replace]) => [new RegExp(escapeRegExp(search), "giv"), replace]);
166
166
  compiledReplacementsCache.set(replacements, compiled);
167
167
  }
168
168
  return compiled;
@@ -206,7 +206,8 @@ function stripUndefined(value) {
206
206
  if (is.plainObject(value)) {
207
207
  const result = {};
208
208
  let hasKeys = false;
209
- for (const [key, theValue] of Object.entries(value)) if (theValue !== void 0) {
209
+ for (const [key, theValue] of Object.entries(value)) {
210
+ if (theValue === void 0) continue;
210
211
  const stripped = stripUndefined(theValue);
211
212
  if (stripped !== void 0) {
212
213
  result[key] = stripped;
@@ -223,7 +224,7 @@ function stripUndefined(value) {
223
224
  */
224
225
  function toBasicLicense(source) {
225
226
  if (source === void 0) return;
226
- return source.replace("http://spdx.org/licenses/", "").replace("https://spdx.org/licenses/", "");
227
+ return source.replace("https://spdx.org/licenses/", "").replace("https://spdx.org/licenses/", "");
227
228
  }
228
229
  /**
229
230
  * Normalize one or more license values to plain SPDX identifiers, stripping URL
@@ -280,29 +281,29 @@ function isAuthoredBy(codemetaAuthorName, expectedAuthorName) {
280
281
  /**
281
282
  * True if project is on a specific GitHub account(s).
282
283
  */
283
- function isOnGithubAccountOf(codeRepository, githubUserName) {
284
- if (codeRepository === void 0 || githubUserName === void 0) return;
285
- const cleanRepo = codeRepository.toLocaleLowerCase().trim();
284
+ function isOnGithubAccountOf(codeRepo, githubUsername) {
285
+ if (codeRepo === void 0 || githubUsername === void 0) return;
286
+ const cleanRepo = codeRepo.toLocaleLowerCase().trim();
286
287
  if (!cleanRepo.includes("github.com/")) return false;
287
- return ensureArray(githubUserName).some((userName) => cleanRepo.includes(`/${userName.toLocaleLowerCase().trim()}/`));
288
+ return ensureArray(githubUsername).some((username) => cleanRepo.includes(`/${username.toLocaleLowerCase().trim()}/`));
288
289
  }
289
290
  /**
290
291
  * Legacy heuristic project status based on authorship and GitHub account.
291
292
  */
292
- function toStatusLegacy(codeRepository, codemetaAuthorName, authorName, githubUserName) {
293
- if (codeRepository === void 0 || authorName === void 0 || githubUserName === void 0) return;
293
+ function toStatusLegacy(codeRepo, codemetaAuthorName, authorName, githubUsername) {
294
+ if (codeRepo === void 0 || authorName === void 0 || githubUsername === void 0) return;
294
295
  const isAuthoredByAuthorName = isAuthoredBy(codemetaAuthorName, authorName);
295
- const isOnGithub = isOnGithubAccountOf(codeRepository, githubUserName);
296
+ const isOnGithub = isOnGithubAccountOf(codeRepo, githubUsername);
296
297
  if (isAuthoredByAuthorName === void 0 || isOnGithub === void 0) return;
297
298
  return !isAuthoredByAuthorName && isOnGithub ? "fork" : isAuthoredByAuthorName ? "source" : "unmaintained";
298
299
  }
299
300
  /**
300
301
  * Heuristic project status based on authorship and GitHub account.
301
302
  */
302
- function toStatus(codeRepository, codemetaAuthorName, codemetaContributorOrMaintainerName, isGitHubFork, myAuthorName, myGithubUserName) {
303
+ function toStatus(codeRepo, codemetaAuthorName, codemetaContributorOrMaintainerName, isGitHubFork, myAuthorName, myGithubUsername) {
303
304
  const author = isAuthoredBy(codemetaAuthorName, myAuthorName);
304
305
  const maintainer = isAuthoredBy(codemetaContributorOrMaintainerName, myAuthorName);
305
- const githubStatus = isOnGithubAccountOf(codeRepository, myGithubUserName);
306
+ const githubStatus = isOnGithubAccountOf(codeRepo, myGithubUsername);
306
307
  const github = githubStatus === void 0 ? "missing" : githubStatus ? isGitHubFork ? "my-fork" : "my-source" : isGitHubFork ? "their-fork" : "their-source";
307
308
  const me = author === true ? "author" : maintainer === true ? "maintainer" : "missing";
308
309
  if (github === "missing" && me === "author") return "author";
@@ -1,5 +1,4 @@
1
1
  import { Language, Parser } from "web-tree-sitter";
2
-
3
2
  //#region src/lib/utilities/tree-sitter-wasm.d.ts
4
3
  /**
5
4
  * Override the directory where tree-sitter WASM grammars are loaded from. Can
@@ -25,7 +25,7 @@ function findGrammarDirectory(moduleDirectory) {
25
25
  }
26
26
  /** Resolve a grammar WASM file path relative to the dist/ directory. */
27
27
  function resolveGrammar(filename) {
28
- if (grammarDirectoryOverride) return resolve(grammarDirectoryOverride, filename);
28
+ if (grammarDirectoryOverride !== void 0 && grammarDirectoryOverride !== "") return resolve(grammarDirectoryOverride, filename);
29
29
  return resolve(findGrammarDirectory(dirname(fileURLToPath(import.meta.url))), filename);
30
30
  }
31
31
  /** Initialize web-tree-sitter (idempotent) and return a new Parser instance. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metascope",
3
- "version": "0.8.4",
3
+ "version": "0.9.0",
4
4
  "description": "A CLI tool and TypeScript library to easily extract metadata from all kinds of software repositories.",
5
5
  "keywords": [
6
6
  "metadata",
@@ -50,15 +50,15 @@
50
50
  "@types/yargs": "^17.0.35",
51
51
  "case-police": "^2.2.1",
52
52
  "defu": "^6.1.7",
53
- "fast-xml-parser": "^5.9.3",
53
+ "fast-xml-parser": "^5.10.1",
54
54
  "find-workspaces": "^0.3.1",
55
55
  "git-url-parse": "^16.1.0",
56
56
  "gray-matter-es": "^0.2.1",
57
57
  "jiti": "^2.7.0",
58
- "lognow": "^0.6.2",
58
+ "lognow": "^0.7.1",
59
59
  "octokit": "^5.0.5",
60
60
  "package-json": "^10.0.1",
61
- "picomatch": "^4.0.4",
61
+ "picomatch": "^4.0.5",
62
62
  "pkg-types": "^2.3.1",
63
63
  "plist": "^5.0.0",
64
64
  "pretty-ms": "^9.3.0",
@@ -68,36 +68,36 @@
68
68
  "semver": "^7.8.5",
69
69
  "simple-git": "^3.36.0",
70
70
  "smol-toml": "^1.7.0",
71
- "spdx-license-list": "^6.11.0",
71
+ "spdx-license-list": "^6.12.0",
72
72
  "string-ts": "^2.3.1",
73
73
  "tinyexec": "^1.2.4",
74
74
  "tinyglobby": "^0.2.17",
75
75
  "unified": "^11.0.5",
76
- "updates": "^17.18.1",
77
- "web-tree-sitter": "^0.26.10",
76
+ "updates": "^17.19.1",
77
+ "web-tree-sitter": "^0.26.11",
78
78
  "yaml": "^2.9.0",
79
79
  "yargs": "^18.0.0",
80
80
  "zod": "^4.4.3"
81
81
  },
82
82
  "devDependencies": {
83
- "@arethetypeswrong/core": "^0.18.4",
83
+ "@arethetypeswrong/core": "^0.18.5",
84
84
  "@fast-csv/parse": "^5.0.7",
85
- "@kitschpatrol/shared-config": "^7.6.4",
85
+ "@kitschpatrol/shared-config": "^8.4.0",
86
86
  "@types/jsonld": "^1.5.15",
87
87
  "@types/picomatch": "^4.0.3",
88
88
  "@types/semver": "^7.7.1",
89
- "bumpp": "^11.1.0",
89
+ "bumpp": "^12.0.0",
90
90
  "jsonld": "^9.0.0",
91
91
  "mdat-plugin-cli-help": "^3.0.2",
92
- "msw": "2.12.14",
92
+ "msw": "^2.15.0",
93
93
  "publint": "^0.3.21",
94
94
  "shx": "^0.4.0",
95
95
  "tree-sitter-python": "^0.25.0",
96
96
  "tree-sitter-ruby": "^0.23.1",
97
- "tsdown": "^0.22.3",
98
- "tsx": "^4.22.4",
99
- "typescript": "~5.9.3",
100
- "vitest": "^4.1.9"
97
+ "tsdown": "^0.22.14",
98
+ "tsx": "^4.23.1",
99
+ "typescript": "~6.0.3",
100
+ "vitest": "^4.1.10"
101
101
  },
102
102
  "engines": {
103
103
  "node": ">=22.17.0"
@@ -105,7 +105,7 @@
105
105
  "devEngines": {
106
106
  "runtime": {
107
107
  "name": "node",
108
- "version": ">=22.22.2"
108
+ "version": ">=24.16.0"
109
109
  }
110
110
  },
111
111
  "scripts": {
@@ -119,6 +119,7 @@
119
119
  "release": "bumpp --commit 'Release: %s' && pnpm build && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token') pnpm publish",
120
120
  "pretest": "tsx scripts/copy-grammars.ts",
121
121
  "test": "vitest run",
122
- "test:live": "METASCOPE_TEST_MOCK=false vitest run"
122
+ "test:live": "METASCOPE_TEST_MOCK=false vitest run",
123
+ "update-license-urls": "tsx ./scripts/update-license-urls.ts"
123
124
  }
124
125
  }
package/readme.md CHANGED
@@ -361,8 +361,8 @@ Metascope extracts data from a wide range of data sources:
361
361
  | Agnostic | [CodeMeta (v3)](https://codemeta.github.io/) | `codemetaJson` | [`codemeta.json`](https://raw.githubusercontent.com/codemeta/codemeta/3.0/codemeta.jsonld) |
362
362
  | Agnostic | [Documented below](#about-metadatajson) | `metadataFile` | `metadata.json` (and `.yaml` / `.yml` variants) |
363
363
  | Agnostic | [Git](https://git-scm.com/) | `gitConfig` | `.git/config` |
364
- | Agnostic | [Public Code](https://publiccode.net/) | `publiccodeYaml` | [`publiccode.yml`](https://yml.publiccode.tools/schema.core.html) (Also matches `.yaml`) |
365
- | Agnostic | [SPDX](https://spdx.org/) | `licenseFile` | `LICENSE`, `LICENCE`, `COPYING`, `UNLICENSE` (and `.md`/`.txt` variants) |
364
+ | Agnostic | [Public Code](https://www.publiccode.net/) | `publiccodeYaml` | [`publiccode.yml`](https://yml.publiccode.tools/schema.core.html) (Also matches `.yaml`) |
365
+ | Agnostic | [SPDX](https://spdx.dev/) | `licenseFile` | `LICENSE`, `LICENCE`, `COPYING`, `UNLICENSE` (and `.md`/`.txt` variants) |
366
366
  | Apple | [Apple Info.plist](https://developer.apple.com/documentation/bundleresources/information-property-list) | `xcodeInfoPlist` | [`Info.plist`](https://developer.apple.com/documentation/bundleresources/information-property-list) |
367
367
  | Apple | [Xcode Project](https://developer.apple.com/xcode/) | `xcodeProjectPbxproj` | [`*.xcodeproj/project.pbxproj`](https://developer.apple.com/documentation/xcode) |
368
368
  | C++ | [Arduino Library](https://docs.arduino.cc/arduino-cli/library-specification/) | `arduinoLibraryProperties` | [`library.properties`](https://docs.arduino.cc/arduino-cli/library-specification/) |
@@ -374,10 +374,10 @@ Metascope extracts data from a wide range of data sources:
374
374
  | Java | [Maven](https://search.maven.org/) | `javaPomXml` | [`pom.xml`](https://maven.apache.org/pom.html) |
375
375
  | Java | [Processing Library](https://github.com/benfry/processing4/wiki/Library-Guidelines) | `processingLibraryProperties` | [`library.properties`](https://github.com/benfry/processing4/wiki/Library-Guidelines) |
376
376
  | Java | [Processing Sketch](https://processing.org/) | `processingSketchProperties` | [`sketch.properties`](https://github.com/benfry/processing4) (Not really specified...) |
377
- | JavaScript | [NPM](https://www.npmjs.com/) | `nodePackageJson` | [`package.json`](https://docs.npmjs.com/cli/v11/configuring-npm/package-json) |
377
+ | JavaScript | [NPM](https://www.npmjs.com/) | `nodePackageJson` | [`package.json`](https://docs.npmjs.com/cli/v11/configuring-npm/package-json/) |
378
378
  | Obsidian | [Obsidian](https://obsidian.md/) | `obsidianPluginManifestJson` | [`manifest.json`](https://docs.obsidian.md/Reference/Manifest) |
379
- | Python | [PyPi (Distutils)](https://pypi.org/) | `pythonSetupCfg` | [`setup.cfg`](https://docs.python.org/3/distutils/apiref.html#distutils.config) |
380
- | Python | [PyPi (Distutils)](https://pypi.org/) | `pythonSetupPy` | [`setup.py`](https://docs.python.org/3/distutils/setupscript.html) |
379
+ | Python | [PyPi (Distutils)](https://pypi.org/) | `pythonSetupCfg` | [`setup.cfg`](https://setuptools.pypa.io/en/latest/userguide/declarative_config.html) |
380
+ | Python | [PyPi (Distutils)](https://pypi.org/) | `pythonSetupPy` | [`setup.py`](https://setuptools.pypa.io/en/latest/references/keywords.html) |
381
381
  | Python | [PyPi (pep-0621)](https://pypi.org/) | `pythonPyprojectToml` | [`pyproject.toml`](https://peps.python.org/pep-0621/) |
382
382
  | Python | [PyPi (PKG-INFO)](https://pypi.org/) | `pythonPkgInfo` | [`.egg-info/PKG-INFO`](https://packaging.python.org/en/latest/specifications/) |
383
383
  | Ruby | [Ruby Gems](https://rubygems.org/) | `rubyGemspec` | [`*.gemspec`](https://guides.rubygems.org/specification-reference/) |
@@ -396,12 +396,12 @@ Metascope extracts data from a wide range of data sources:
396
396
 
397
397
  You can skip network calls by passing `--offline` to the CLI.
398
398
 
399
- | Ecosystem | Organization | Metascope Key | Source Specifications |
400
- | ---------- | --------------------------------------------------------------------------------------- | ------------------------ | -------------------------------------------------------------------- |
401
- | Agnostic | [GitHub Repository Metadata](https://docs.github.com/rest/repos/repos#get-a-repository) | `github` | _GitHub GraphQL metadata_ |
402
- | JavaScript | [NPM Registry](https://www.npmjs.com/) | `nodeNpmRegistry` | _NPM registry API_ (download counts, publish dates, latest version) |
403
- | Obsidian | [Obsidian Community Plugins](https://obsidian.md/plugins) | `obsidianPluginRegistry` | _Obsidian community plugin stats_ (download counts) |
404
- | Python | [PyPI Registry](https://pypi.org/) | `pythonPypiRegistry` | _PyPI registry API_ (download counts, publish dates, latest version) |
399
+ | Ecosystem | Organization | Metascope Key | Source Specifications |
400
+ | ---------- | ------------------------------------------------------------------------------------------ | ------------------------ | -------------------------------------------------------------------- |
401
+ | Agnostic | [GitHub Repository Metadata](https://docs.github.com/en/rest/repos/repos#get-a-repository) | `github` | _GitHub GraphQL metadata_ |
402
+ | JavaScript | [NPM Registry](https://www.npmjs.com/) | `nodeNpmRegistry` | _NPM registry API_ (download counts, publish dates, latest version) |
403
+ | Obsidian | [Obsidian Community Plugins](https://community.obsidian.md/) | `obsidianPluginRegistry` | _Obsidian community plugin stats_ (download counts) |
404
+ | Python | [PyPI Registry](https://pypi.org/) | `pythonPypiRegistry` | _PyPI registry API_ (download counts, publish dates, latest version) |
405
405
 
406
406
  ### About metadata.json
407
407
 
@@ -574,6 +574,8 @@ Metascope was built to support automated generation of project dashboards, badge
574
574
  Offline command-line Git information tool (Rust)
575
575
  - [Sokrates](https://www.sokrates.dev/)\
576
576
  Polyglot source code examination tool (Java)
577
+ - [ecosyste.ms](https://ecosyste.ms/)
578
+ Massive project metadatabase and [public API](https://packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/metascope) (Ruby)
577
579
 
578
580
  ## Slop factor
579
581
 
@@ -1 +0,0 @@
1
- import{a as e,i as t,n,r}from"./shared-Dix5HPlG.js";import{join as i}from"node:path";import{readFile as a}from"node:fs/promises";const o=[`renovate.json`,`renovate.json5`,...[`.github`,`.gitea`,`.forgejo`,`.gitlab`].flatMap(e=>[`${e}/renovate.json`,`${e}/renovate.json5`]),`.renovaterc`,`.renovaterc.json`,`.renovaterc.json5`],s={y:365,year:365,years:365,mo:30,month:30,months:30,w:7,week:7,weeks:7,d:1,day:1,days:1,h:1/24,hour:1/24,hours:1/24,min:1/1440,minute:1/1440,minutes:1/1440,s:1/86400,second:1/86400,seconds:1/86400};function c(e){let t=0,n=!1,r=/(\d+(?:\.\d+)?)\s*([a-z]+)/gi,i;for(;(i=r.exec(e))!==null;){let e=s[i[2].toLowerCase()];if(e===void 0)return;t+=Number(i[1])*e,n=!0}return n?t:void 0}function l(e){return!Array.isArray(e.matchPackageNames)||!e.matchPackageNames.length?!1:Object.keys(e).every(e=>!e.startsWith(`match`)||e===`matchPackageNames`)}async function u(e){for(let t of o){let n=i(e,...t.split(`/`));try{return{path:n,text:await a(n,`utf8`)}}catch{}}try{let t=await a(i(e,`package.json`),`utf8`),n=JSON.parse(t);if(n&&typeof n==`object`&&n.renovate&&typeof n.renovate==`object`)return{path:`package.json`,text:JSON.stringify(n.renovate)}}catch{}}function d(e){let t=/^\/(.+)\/([a-z]*)$/.exec(e);if(!t)return e;try{return new RegExp(t[1],t[2])}catch{return e}}function f(e){return/[*?[\]{}!()|+]/.test(e)}function p(t,n){let r={};if(n.cooldown&&typeof t.minimumReleaseAge==`string`){let e=c(t.minimumReleaseAge);e!==void 0&&e>0&&(r.cooldown=e)}let i=[],a={};if(Array.isArray(t.ignoreDeps))for(let e of t.ignoreDeps)typeof e==`string`&&e&&i.push(e);if(Array.isArray(t.packageRules))for(let n of t.packageRules){if(!n||typeof n!=`object`||!l(n))continue;let t=n.matchPackageNames.filter(e=>typeof e==`string`&&!!e);if(n.enabled===!1)for(let e of t)i.push(d(e));if(typeof n.allowedVersions==`string`&&e(n.allowedVersions))for(let e of t)!f(e)&&typeof d(e)==`string`&&(a[e]=n.allowedVersions)}return i.length&&(r.exclude=i),Object.keys(a).length&&(r.pin=a),r}const m=r(e=>t(e,async e=>{let t=await u(e);if(!t)return null;let r;try{r=n(t.text)}catch(e){throw Error(`Unable to parse renovate config ${t.path}: ${e.message}`)}return!r||typeof r!=`object`?null:{parsed:r,path:t.path}}));async function h(e,t={}){let n=await m(e);return n?p(n.parsed,t):{}}export{h as loadRenovateConfig};
@@ -1,6 +0,0 @@
1
- import{accessSync as e,globSync as t,lstatSync as n,readFileSync as r,readdirSync as i,statSync as a,truncateSync as o,writeFileSync as s}from"node:fs";import{basename as c,dirname as l,join as u,relative as d,resolve as f}from"node:path";import{homedir as p}from"node:os";import{cwd as m,env as h,pid as g,platform as _,stderr as v}from"node:process";import{styleText as y}from"node:util";import{access as b,mkdir as x,readFile as S,rename as C,writeFile as w}from"node:fs/promises";import{pathToFileURL as ee}from"node:url";import{createHash as te}from"node:crypto";function T(e){let t={},n=t,r=e.split(/\r?\n/);for(let e=0;e<r.length;e++){let i=r[e],a=ce(i).trim();if(!a)continue;let o=/^\[\[([^\]]+)\]\]$/.exec(a);if(o){let e=t,r=se(o[1]);for(let t=0;t<r.length-1;t++){let n=e[r[t]];Array.isArray(n)?e=n[n.length-1]:((!n||typeof n!=`object`)&&(e[r[t]]={}),e=e[r[t]])}let i=r[r.length-1];Array.isArray(e[i])||(e[i]=[]);let a={};e[i].push(a),n=a;continue}let s=/^\[([^[\]]+)\]$/.exec(a);if(s){n=de(t,se(s[1]));continue}let c=le(a,`=`);if(c<0)continue;let l=a.slice(0,c).trim(),u=a.slice(c+1).trim(),d=se(l),f=de(n,d.slice(0,-1)),p=d[d.length-1],m=ne(u);if(u.startsWith(`[`)&&!ae(u)){let t=u,n=e+1;for(;n<r.length&&(t+=`\n${ce(r[n])}`,!ae(t));n++);e=n,f[p]=re(t)}else if(u.startsWith(`{`)&&!ae(u)){let t=u,n=e+1;for(;n<r.length&&(t+=`\n${ce(r[n])}`,!ae(t));n++);e=n,f[p]=D(t)}else if(m){let t=u.slice(3),n=e+1;for(;n<r.length;n++){let e=r[n].indexOf(m);if(e>=0){t+=(t?`
2
- `:``)+r[n].slice(0,e);break}t+=(t?`
3
- `:``)+r[n]}e=n,f[p]=re(m+t+m)}else f[p]=re(u)}return t}function E(e,t){let n=e.trim();if(n)for(let e of oe(n)){let n=e.trim();n&&t.push(re(n))}}function ne(e){let t=e.slice(0,3);return t!==`"""`&&t!==`'''`||e.includes(t,3)?``:t}function re(e){if(e.startsWith(`[`)){let t=[],n=ue(e,`]`);return E(e.slice(1,n<0?e.length:n),t),t}return e.startsWith(`{`)?D(e):e.startsWith(`"""`)?k(e.slice(3,e.lastIndexOf(`"""`))):e.startsWith(`'''`)?e.slice(3,e.lastIndexOf(`'''`)):e.startsWith(`"`)?k(e.slice(1,e.lastIndexOf(`"`))):e.startsWith(`'`)?e.slice(1,e.lastIndexOf(`'`)):ie(e)}function ie(e){return e===`true`?!0:e===`false`?!1:/^[+-]?\d+(\.\d+)?$/.test(e)?Number(e):e}function D(e){let t={},n=e.slice(1,e.lastIndexOf(`}`)).trim();if(!n)return t;for(let e of oe(n)){let n=e.indexOf(`=`);if(n<0)continue;let r=e.slice(0,n).trim().replace(/^["']|["']$/g,``);t[r]=re(e.slice(n+1).trim())}return t}function ae(e){let t=0,n=null;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(i===`\\`&&n===`"`){r++;continue}i===n&&(n=null)}else if(i===`"`||i===`'`)n=i;else if(i===`{`||i===`[`)t++;else if((i===`}`||i===`]`)&&(t--,t===0))return!0}return!1}function oe(e){let t=[],n=0,r=null,i=0;for(let a=0;a<e.length;a++){let o=e[a];if(r){if(o===`\\`&&r===`"`){a++;continue}o===r&&(r=null)}else o===`"`||o===`'`?r=o:o===`[`||o===`{`?n++:o===`]`||o===`}`?n--:o===`,`&&n===0&&(t.push(e.slice(i,a)),i=a+1)}return i<e.length&&t.push(e.slice(i)),t}function se(e){let t=[],n=``,r=null;for(let i of e)if(r){if(i===r){r=null;continue}n+=i}else i===`"`||i===`'`?r=i:i===`.`?(t.push(n.trim()),n=``):n+=i;return n.trim()&&t.push(n.trim()),t}function ce(e){let t=le(e,`#`);return t<0?e:e.slice(0,t)}function*O(e,t){let n=null;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(i===`\\`&&n===`"`){r++;continue}i===n&&(n=null)}else i===`"`||i===`'`?n=i:i===t&&(yield r)}}function le(e,t){return O(e,t).next().value??-1}function ue(e,t){let n=-1;for(let r of O(e,t))n=r;return n}function de(e,t){for(let n of t)(!(n in e)||typeof e[n]!=`object`||Array.isArray(e[n]))&&(e[n]={}),e=e[n];return e}function k(e){return e.replace(/\\(["\\bfnrt]|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/g,(e,t)=>{switch(t[0]){case`"`:return`"`;case`\\`:return`\\`;case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
4
- `;case`r`:return`\r`;case`t`:return` `;case`u`:case`U`:return String.fromCodePoint(Number.parseInt(t.slice(1),16));default:return t}})}const A=/^v?(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*))?(?:\+[a-zA-Z0-9._-]+)?$/,j=new Map;function M(e){if(typeof e!=`string`)return null;let t=j.get(e);if(t!==void 0)return t;let n=A.exec(e.trim());if(!n)return j.set(e,null),null;let r=Number(n[1]),i=Number(n[2]),a=Number(n[3]),o=n[4]?n[4].split(`.`).map(e=>/^\d+$/.test(e)?Number(e):e):[],s={major:r,minor:i,patch:a,prerelease:o,version:`${r}.${i}.${a}${o.length?`-${o.join(`.`)}`:``}`};return j.set(e,s),s}function fe(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?e-t:n?-1:r?1:e<t?-1:+(e>t)}function pe(e,t){return e.major-t.major||e.minor-t.minor||e.patch-t.patch}function N(e,t){let n=pe(e,t);if(n!==0)return n;let r=e.prerelease.length>0,i=t.prerelease.length>0;if(!r&&!i)return 0;if(r&&!i)return-1;if(!r&&i)return 1;let a=Math.max(e.prerelease.length,t.prerelease.length);for(let n=0;n<a;n++){if(e.prerelease[n]===void 0)return-1;if(t.prerelease[n]===void 0)return 1;let r=fe(e.prerelease[n],t.prerelease[n]);if(r!==0)return r}return 0}function me(e){return M(e)?.version??null}function P(e){return M(e)}const F=new Map,he=/(?:^|[^.\d])(\d+)(?:\.(\d+))?(?:\.(\d+))?/;function I(e){if(typeof e!=`string`)return null;let t=F.get(e);if(t!==void 0)return t;let n=he.exec(e);if(!n)return F.set(e,null),null;let r={version:`${n[1]}.${n[2]||`0`}.${n[3]||`0`}`};return F.set(e,r),r}function L(e,t){let n=M(e),r=M(t);return!n||!r?null:ge(n,r)}function ge(e,t){if(e.version===t.version)return null;let n=N(e,t),r=n>0?e:t,i=n>0?t:e,a=r.prerelease.length>0;if(i.prerelease.length>0&&!a){if(!i.patch&&!i.minor)return`major`;if(pe(i,r)===0)return i.minor&&!i.patch?`minor`:`patch`}let o=a?`pre`:``;return e.major===t.major?e.minor===t.minor?e.patch===t.patch?`prerelease`:`${o}patch`:`${o}minor`:`${o}major`}function _e(e,t){let n=M(e),r=M(t);return n&&r?N(n,r):null}function R(e,t){return(_e(e,t)??-1)>0}function ve(e,t){return(_e(e,t)??-1)>=0}function ye(e,t){return(_e(e,t)??1)<0}function be(e){let t=/^(>=|<=|>|<|=)?\s*v?(\d+)(?:\.(\d+))?(?:\.(\d+))?((?:-[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*)?)$/.exec(e.trim());if(!t)return null;let n=t[2],r=M(`${n}.${t[3]??`0`}.${t[4]??`0`}${t[5]||``}`);return r?{op:t[1]||`=`,semver:r}:null}function xe(e,t){let n=N(e,t.semver);switch(t.op){case`>=`:return n>=0;case`<=`:return n<=0;case`>`:return n>0;case`<`:return n<0;case`=`:return n===0;default:return n===0}}function z(e,t,n){return`${e}.${t}.${n}-0`}function Se(e){return e.replace(/~\s*v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.[xX*])*((?:-[a-zA-Z0-9._-]+)?)/g,(e,t,n,r,i)=>{let a=Number(t);if(n===void 0)return`>=${a}.0.0 <${z(a+1,0,0)}`;let o=Number(n);return`>=${a}.${o}.${r===void 0?0:Number(r)}${i||``} <${z(a,o+1,0)}`})}function Ce(e){return e.replace(/\^\s*v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.[xX*])*((?:-[a-zA-Z0-9._-]+)?)/g,(e,t,n,r,i)=>{let a=Number(t),o=i||``;if(n===void 0)return`>=${a}.0.0 <${z(a+1,0,0)}`;let s=Number(n);if(r===void 0)return a===0?`>=${a}.${s}.0 <${z(a,s+1,0)}`:`>=${a}.${s}.0 <${z(a+1,0,0)}`;let c=Number(r);return a===0?s===0?`>=${a}.${s}.${c}${o} <${z(a,s,c+1)}`:`>=${a}.${s}.${c}${o} <${z(a,s+1,0)}`:`>=${a}.${s}.${c}${o} <${z(a+1,0,0)}`})}function we(e){return e.replace(/v?(\d+)(?:\.(\d+))?(?:\.(\d+))?((?:-[a-zA-Z0-9._-]+)?)\s+-\s+v?(\d+)(?:\.(\d+))?(?:\.(\d+))?((?:-[a-zA-Z0-9._-]+)?)/g,(e,t,n,r,i,a,o,s,c)=>{let l=Number(t),u=n===void 0?0:Number(n),d=r===void 0?0:Number(r),f=i||``,p=Number(a),m;return m=s===void 0?o===void 0?`<${z(p+1,0,0)}`:`<${z(p,Number(o)+1,0)}`:`<=${p}.${Number(o)}.${Number(s)}${c||``}`,`>=${l}.${u}.${d}${f} ${m}`})}function B(e,t,n,r){return!e||e===`=`?r?`>=${t}.0.0 <${z(t+1,0,0)}`:`>=${t}.${n}.0 <${z(t,n+1,0)}`:e===`>`?r?`>=${t+1}.0.0`:`>=${t}.${n+1}.0`:e===`<=`?r?`<${z(t+1,0,0)}`:`<${z(t,n+1,0)}`:e===`<`?r?`<${t}.0.0-0`:`<${t}.${n}.0-0`:r?`>=${t}.0.0`:`>=${t}.${n}.0`}function Te(e){return/^\s*[*xX]\s*$/.test(e)?`>=0.0.0`:(e=e.replace(/(>=|<=|>|<|=)?\s*v?(\d+)\.(\d+)\.[xX*]/g,(e,t,n,r)=>B(t,Number(n),Number(r),!1)),e=e.replace(/(>=|<=|>|<|=)?\s*v?(\d+)\.[xX*](?:\.[xX*])?/g,(e,t,n)=>B(t,Number(n),0,!0)),e=e.replace(/(^|[\s|])(>=|<=|>|<|=)?\s*v?(\d+)\.(\d+)(?=\s|$)/g,(e,t,n,r,i)=>`${t}${B(n,Number(r),Number(i),!1)}`),e=e.replace(/(^|[\s|])(>=|<=|>|<|=)?\s*v?(\d+)(?=\s|$)/g,(e,t,n,r)=>`${t}${B(n,Number(r),0,!0)}`),e)}const V=new Map;function Ee(e){let t=V.get(e);if(t!==void 0)return t;let n=e.split(`||`).map(e=>e.trim()),r=[];for(let t of n){if(!t){r.push([]);continue}t=we(t),t=Ce(t),t=Se(t),t=Te(t),t=t.replace(/(>=|<=|>|<|=)\s+/g,`$1`),t=t.replace(/(^|[\s])v?(\d+\.\d+\.\d+(?:-[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*)?)\b/g,(e,t,n)=>`${t}=${n}`);let n=t.split(/\s+/).filter(Boolean),i=[];for(let t of n){let n=be(t);if(!n)return V.set(e,null),null;i.push(n)}if(i.length===0)return V.set(e,null),null;r.push(i)}let i=r.length?r:null;return V.set(e,i),i}function De(e,t){return t.some(t=>!xe(e,t))?!1:e.prerelease.length>0?t.some(t=>t.semver.prerelease.length>0&&t.semver.major===e.major&&t.semver.minor===e.minor&&t.semver.patch===e.patch):!0}function H(e,t){let n=M(e);if(!n)return!1;let r=Ee(t);if(!r)return!1;for(let e of r)if(e.length===0||De(n,e))return!0;return!1}function Oe(e){return typeof e==`string`&&Ee(e)?e:null}const ke=[[1e3,6e4,`sec`],[6e4,36e5,`min`],[36e5,864e5,`hour`],[864e5,6048e5,`day`],[6048e5,2628e6,`week`],[2628e6,31536e6,`month`],[31536e6,1/0,`year`]],Ae={"1 day ago":`yesterday`,"1 week ago":`last week`,"1 month ago":`last month`,"1 year ago":`last year`,"in 1 day":`tomorrow`,"in 1 week":`next week`,"in 1 month":`next month`,"in 1 year":`next year`},je={sec:`second`,min:`minute`};function Me(e){return e instanceof Date?e.getTime():typeof e==`string`?Date.parse(e):e}function Ne(e,{now:t,noAffix:n=!1,times:r=ke,nowThreshold:i=2e3,nowString:a=`now`,unknownString:o=``,aliases:s=!1,aliasesMap:c=Ae,longUnits:l=!1}={}){let u=Me(e),d=t===void 0?Date.now():Me(t);if(u!==u)return o||String(e);let f=d-u,p=f<0;if(p&&(f=-f),f<i)return a;let m=0,h=``;for(let e=0,t=r.length;e<t;e++){let t=r[e];if(!(f>=t[1])){m=f/t[0]|0,h=(l&&je[t[2]]||t[2])+(m>1?`s`:``);break}}let g=`${m} ${h}`,_;return _=n?g:p?`in ${g}`:`${g} ago`,s?c[_]??_:_}function Pe(e){let t=[];for(let n of e){let e=/^([^<>=~!]+)(?:==|>=?|<=?|~=)([0-9.a-z]+)$/.exec(n.replaceAll(/\s+/g,``));if(!e)continue;let r=e[1].replace(/\[.*?\]$/,``);r&&t.push({name:r,version:e[2]})}return t}const Fe=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`,`resolutions`,`packageManager`],Ie=[`node`,`deno`,`bun`],Le=[`project.dependencies`,`project.optional-dependencies`,`dependency-groups.dev`,`dependency-groups.lint`,`dependency-groups.test`],Re=[`deps`,`indirect`,`replace`,`tool`],ze=[`dependencies`,`dev-dependencies`,`build-dependencies`,`workspace.dependencies`];function U(e,t){if(t===!0)return!0;if(!(t instanceof Set))return!1;for(let n of t)if(n.test(e))return!0;return!1}function Be(e,t){return t.split(`.`).reduce((e,t)=>e?.[t]??null,e)}function Ve(){let e=new Date,t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`),r=String(e.getHours()).padStart(2,`0`),i=String(e.getMinutes()).padStart(2,`0`),a=String(e.getSeconds()).padStart(2,`0`),o=String(e.getMilliseconds()).padStart(3,`0`);return`${e.getFullYear()}-${t}-${n} ${r}:${i}:${a}.${o}`}const He={y:365,m:30,w:7,d:1,h:1/24,s:1/86400};function Ue(e){let t=/^(\d+(?:\.\d+)?)\s*([a-z])$/i.exec(e);if(t){let[,e,n]=t,r=He[n.toLowerCase()];if(r)return Number(e)*r}if(!/^\d+(?:\.\d+)?$/.test(e))throw Error(`Invalid cooldown value: ${e}`);return Number(e)}async function W(e,t,{concurrency:n=1/0}={}){let r=Array.from(e);if(!Number.isFinite(n))return Promise.all(r.map(t));let i=Array(r.length),a=0;return await Promise.all(Array.from({length:Math.min(Math.max(n,1),r.length)},async()=>{for(;a<r.length;){let e=a++;i[e]=await t(r[e])}})),i}async function We(e){try{return await e}catch{return null}}const G=e=>RegExp.escape?RegExp.escape(e):e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);async function Ge(e,t){let n=e;for(;;){let e=await t(n);if(e)return e;let r=l(n);if(r===n)return null;n=r}}function Ke(e){let t=new Map;return n=>{let r=t.get(n);return r||(r=e(n),t.set(n,r)),r}}const qe=u(_===`win32`?h.LOCALAPPDATA||u(p(),`AppData`,`Local`):h.XDG_CACHE_HOME||u(p(),`.cache`),`updates`);let Je=null;const Ye=new Map;function Xe(e){let t=Ye.get(e);return t===void 0&&(t=te(`sha256`).update(e).digest(`hex`).substring(0,16),Ye.set(e,t)),t}async function Ze(e){try{let t=await S(u(qe,`${Xe(e)}.cache`),`utf8`),n=t.indexOf(`
5
- `);if(n===-1)return null;let r=t.substring(0,n),i=t.substring(n+1);return r&&i?{etag:r,body:i}:null}catch{return null}}const Qe=new Set;let $e=0;function et(e,t,n){let r=(async()=>{try{await(Je??=x(qe,{recursive:!0}))}catch{Je=null;return}try{let r=u(qe,`${Xe(e)}.cache`),i=`${r}.${g}-${$e++}.tmp`;await w(i,`${t}\n${n}`),await C(i,r)}catch{}})();Qe.add(r),(async()=>{await r,Qe.delete(r)})()}async function tt(){for(;Qe.size;)await Promise.all(Qe)}var nt=`17.18.2`;function rt(e,t,n){if(!t||!n||!e)return!0;let r=Date.parse(e);return Number.isNaN(r)?!0:(n-r)/(24*3600*1e3)>=t}const it=nt,K=e=>e[0]===`v`?e.substring(1):e,at=e=>e.endsWith(`/`)?e.slice(0,-1):e;function ot(e,t){return{headers:{"user-agent":`updates/${it}`,"accept-encoding":`gzip, deflate, br`,...t&&{Authorization:`${e} ${t}`}}}}const st=new Set([`ECONNRESET`,`ECONNREFUSED`,`ETIMEDOUT`,`EAI_AGAIN`,`EPIPE`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`]);function ct(e){if(e?.name===`TimeoutError`||e?.name===`AbortError`)return!0;let t=e?.code??e?.cause?.code;return typeof t==`string`&&st.has(t)}async function lt(e,t){try{return await fetch(e,t)}catch(t){let n=Error(`Failed to fetch ${e}${t?.message?`: ${t.message}`:``}`,{cause:t});throw n.transient=ct(t),n}}async function q(e,t,n={}){for(let r=0;;r++)try{return await e.doFetch(t,{...n,signal:AbortSignal.timeout(e.fetchTimeout)})}catch(e){if(r>=2||!e?.transient)throw e}}async function ut(e){return typeof e.text==`function`?e.text():JSON.stringify(await e.json())}function dt(e,t){if(!t||e.length<16384)return e;try{return JSON.stringify(t(JSON.parse(e)))}catch{return e}}async function ft(e,t,n={},r){let i=t.noCache?null:await Ze(e),a=n.headers,o=i?{...a,"if-none-match":i.etag}:a,s=await q(t,e,{...n,headers:o});if(!s)return{res:void 0};if(s.status===304&&i)return{body:i.body,res:s};if(!s.ok)return{res:s};let c=dt(await ut(s),r),l=s.headers?.get?.(`etag`);return l&&!t.noCache&&et(e,l,c),{body:c,res:s}}async function pt(e,t,n={},r){if(!t.noCache){let t=await Ze(e);if(t)return{body:t.body}}let i=await q(t,e,n);if(!i)return{res:void 0};if(!i.ok)return{res:i};let a=dt(await ut(i),r);return t.noCache||et(e,`immutable`,a),{body:a,res:i}}function mt(e){return(P(e)?.prerelease.length??0)>0}function ht(e){return/[0-9]+\.[0-9]+\.[0-9]+-.+/.test(e)}const gt=new WeakMap;function _t(e){let t=gt.get(e);if(t)return t;let n=new Set(e);return n.add(`prerelease`),e.has(`patch`)&&n.add(`prepatch`),e.has(`minor`)&&n.add(`preminor`),e.has(`major`)&&n.add(`premajor`),gt.set(e,n),n}function vt(e,t,{useRel:n,allowDowngrade:r,name:i,matchesAny:a}){let o=J(e),s=J(t);if(!o||!s)return!0;let c=ht(e)||mt(e),l=mt(t);return c&&!l?ve(s,o)||n:!l&&ye(s,o)?a(i,r):!0}function J(e){return I(e)?.version??``}function yt(e,t,{range:n,semvers:r,usePre:i,useRel:a,useGreatest:o,pinnedRange:s,cooldownDays:c,now:l,getVersionDate:u}){let d=J(n);if(!d)return d;let f=ht(n)||i,p=f?_t(r):r,m=e?.time,h=!!m,g=o||!h,_=!!(c&&l),v=0,y=!1,b=d,x=P(d);for(let e of t){let t=P(e);if(!t?.version||t.prerelease.length&&(!f||a))continue;let n=t.version;if(s&&!H(n,s))continue;let r;if(_&&(r=u?u(e):h?m[e]:void 0,!rt(r,c,l)))continue;let i=ge(x,t);if(!(!i||!p.has(i)))if(g)((y?N(t,x)>0:pe(t,x)>=0)||s&&!H(b,s))&&(b=n,x=t,y=!0);else{let i=Date.parse(r??m[e]);i>=0&&i>v&&(b=n,x=t,v=i)}}return b||null}function bt(e,{mode:t,range:n,useGreatest:r,useRel:i,usePre:a,semvers:o,pinnedRange:s,cooldownDays:c,now:l},{allowDowngrade:u,matchesAny:d,isGoPseudoVersion:f}){if(n===`*`||n.includes(`||`)||/\d\s/.test(n))return null;let p=[],m;if(t===`pypi`){let t=e.releases;p=Object.keys(t),m=e=>t?.[e]?.[0]?.upload_time_iso_8601}else if(t===`npm`||t===`cargo`)p=Object.keys(e.versions);else if(t===`go`){let t=J(n);if(!t)return null;let r=a||ht(n),p=e=>mt(e)&&(!r||i),m={useRel:i,allowDowngrade:u,name:e.name,matchesAny:d},h=e.old||n,g=J(e.new);if(g&&!f(e.new)&&!p(e.new)){let n=L(t,g);if(n&&o.has(n)&&vt(h,e.new,m)&&rt(e.Time,c,l)&&(!s||H(g,s)))return e.new}let _=J(e.sameMajorNew);if(_&&!f(e.sameMajorNew)&&!p(e.sameMajorNew)){let n=L(t,_);if(n&&o.has(n)&&vt(h,e.sameMajorNew,m)&&rt(e.sameMajorTime,c,l)&&(!s||H(_,s)))return e.Time=e.sameMajorTime,delete e.newPath,e.sameMajorNew}if(c&&l&&e.olderEligible&&!p(e.olderEligible.version)){let n=J(e.olderEligible.version);if(n){let r=L(t,n);if(r&&o.has(r)&&vt(h,e.olderEligible.version,m)&&(!s||H(n,s)))return e.Time=e.olderEligible.time,delete e.newPath,e.olderEligible.version}}return null}let h=yt(e,p,{range:n,semvers:o,usePre:a,useRel:i,useGreatest:r,pinnedRange:s,cooldownDays:c,now:l,getVersionDate:m});if(!h)return null;if(r)return h;{let r=``,f=``,p=!1;t===`pypi`?(f=e.info.version,r=J(e.info.version),p=mt(f)):(r=e[`dist-tags`].latest,p=mt(r));let m=J(n),g=ht(n),_=mt(h),v={useRel:i,allowDowngrade:u,name:e.name,matchesAny:d};if(!i&&a||g&&_)return h;if(g&&!_)return vt(n,h,v)?h:null;let y=L(m,r);return y&&y!==`prerelease`&&!o.has(y.replace(/^pre/,``))||i&&p?h:ye(r,m)&&!p?vt(n,r,v)?r:R(h,m)?h:null:!g&&p&&!a||s&&!H(r,s)||c&&l&&!rt(t===`pypi`?e.releases?.[f||r]?.[0]?.upload_time_iso_8601:e.time?.[r],c,l)?h:f||r}}const xt=new Map;if(h.UPDATES_FORGE_TOKENS)for(let e of h.UPDATES_FORGE_TOKENS.split(`,`)){let t=e.indexOf(`:`);t>0&&xt.set(e.substring(0,t),e.substring(t+1))}const St=[`UPDATES_GITHUB_API_TOKEN`,`GITHUB_API_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`HOMEBREW_GITHUB_API_TOKEN`];function Ct(){return Array.from(new Set(St.map(e=>h[e]).filter(Boolean)))}let wt;function Tt(){let e=Ct();return e.length?Promise.resolve(e):wt??=(async()=>{try{let[{execFile:e},{promisify:t}]=await Promise.all([import(`node:child_process`),import(`node:util`)]),{stdout:n}=await t(e)(`gh`,[`auth`,`token`],{encoding:`utf8`,timeout:5e3}),r=n.trim();return r?[r]:[]}catch{return[]}})()}const Et=new Map;async function Dt(e,t){if(!e)return[];let n=xt.get(e);if(n)return[n];let r=``;try{r=new URL(t).hostname}catch{}return e===`api.github.com`||e===`github.com`||e===r?Tt():[]}async function Ot(e,t,n){let r;try{r=new URL(e).hostname}catch{r=``}let i=await Dt(r,t.forgeApiUrl),a=e=>{let t=ot(`Bearer`,e);return n&&(t.headers={...t.headers,...n}),t};if(!i.length)return q(t,e,a());let o=r?Et.get(r):void 0;if(o)return q(t,e,a(o));for(let n of i){let i=await q(t,e,a(n));if(i.status!==401&&i.status!==403)return r&&Et.set(r,n),i}return q(t,e,a())}function kt(e,t){let n=K(t);if(!me(n))return null;let r=``,i=``;for(let t of e){let e=K(t);me(e)&&(!r||R(e,i))&&(r=t,i=e)}return r&&R(i,n)?r:null}function At(e){let t=e.replace(`git@`,``).replace(/.+?\/\//,`https://`).replace(/\.git$/,``);return/^[a-z]+:[a-z0-9-]+\/[a-z0-9-]+$/.test(t)?t.replace(/^(.+?):/,(e,t)=>`https://${t}.com/`):/^[a-z0-9-]+\/[a-z0-9-]+$/.test(t)?`https://github.com/${t}`:t}const jt=/^[0-9a-f]{7,}$/i;function Mt(e){return e.map(e=>({name:e.name,commitSha:e.commit?.sha||``}))}async function Nt(e,t){let n=t.noCache?null:await Ze(e),r=await Ot(e,t,n?{"if-none-match":n.etag}:void 0);if(r?.status===304&&n)try{let e=JSON.parse(n.body);return{tags:e.tags||[],link:e.link||``}}catch{return null}if(!r?.ok)return null;let i=Mt(await r.json()),a=r.headers.get(`link`)||``,o=r.headers.get(`etag`);return o&&!t.noCache&&et(e,o,JSON.stringify({link:a,tags:i})),{tags:i,link:a}}async function Pt(e,t,n,r){let i=r=>`${e}/repos/${t}/${n}/tags?per_page=100&page=${r}`;try{let e=await Nt(i(1),r);if(!e)return[];let t=e.tags,n=/<([^>]+)>;\s*rel="last"/.exec(e.link);if(!n)return t;let a=Math.min(Number(new URL(n[1]).searchParams.get(`page`)),10);if(a<2)return t;let o=await Promise.all(Array.from({length:a-1},(e,t)=>Nt(i(t+2),r)));for(let e of o)e&&t.push(...e.tags);return t}catch{return[]}}function Ft(e,t,n,r){throw e?.status&&e.statusText?Error(`Received ${e.status} ${e.statusText} from ${t}`):Error(`Unable to fetch ${n} from ${r}`)}function It(e,t,n=``){let r=t.startsWith(`v`),i=K(e),a=K(t).split(`.`).length,o=i.split(`.`),s;return s=a===1?o[0]:a===2?`${o[0]}.${o[1]||`0`}`:i,`${r?`v`:``}${s}${n}`}function Lt(e){return e.startsWith(`https://bitbucket.org`)?`src/HEAD`:`tree/HEAD`}function Rt({repository:e,homepage:t,info:n},r,i){if(n){let t=n.project_urls;for(let n of[`repository`,`Repository`,`repo`,`Repo`,`source`,`Source`,`source code`,`Source code`,`Source Code`,`homepage`,`Homepage`])if(t?.[n]){e=t[n];break}e??=`https://pypi.org/project/${i}/`}let a=``;return r===`https://npm.pkg.github.com`?`https://github.com/${i.replace(/^@/,``)}`:(e&&(a=At(typeof e==`string`?e:e.url),a&&typeof e!=`string`&&e.directory&&(a+=`/${Lt(a)}/${e.directory}`)),a||t||``)}function zt(e,t){return RegExp(`^${G(e).replaceAll(`\\*`,`.*`)}$`,t?`i`:``)}function Bt(e,t,n){if(t&&typeof e==`string`)return/^\/.+\/$/.test(e)?new RegExp(e.slice(1,-1)):zt(e,n);{let t=e instanceof RegExp?e:zt(e,n);return/[gy]/.test(t.flags)?new RegExp(t.source,t.flags.replace(/[gy]/g,``)):t}}function Y(e){return new Set(e.map(e=>Bt(e,!1,!0)))}function Vt(e){return typeof e==`boolean`?e:!Array.isArray(e)||!e.length?!1:Y(e)}async function Ht(e){let t=await Promise.all([`js`,`ts`,`mjs`,`mts`].map(async t=>{let n=`updates.config.${t}`,r=u(e,n);try{await b(r)}catch{return null}try{return{configDir:e,filename:n,default:(await import(ee(r).href)).default??{}}}catch(e){return Error(`Unable to parse config file ${n}: ${e?.message??e}`)}}));for(let e of t)if(e&&!(e instanceof Error))return e;for(let e of t)if(e instanceof Error)throw e;return null}const Ut=Ke(e=>Ge(e,Ht));async function Wt(e){let t=await Ut(e),n=t?.default??{},{loadRenovateConfig:r}=await import(`./renovate-CpDMbQZd.js`);return{...await r(t?.configDir??e,n.inherit?.renovate),...n}}function Gt(e){if(/^\s*\{/.test(e))return JSON.parse(e);let t={};for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`#`)||e.startsWith(`;`))continue;let r=e.indexOf(`=`);if(r===-1)continue;let i=e.slice(r+1).trim();i.length>=2&&(i.startsWith(`"`)&&i.endsWith(`"`)||i.startsWith(`'`)&&i.endsWith(`'`))&&(i=i.slice(1,-1)),t[e.slice(0,r).trim()]=i}return t}function Kt(e){try{return Gt(r(e,`utf-8`))}catch{return}}function qt(e){let t=m();for(;;){let n=u(t,e);try{if(a(n).isFile())return n}catch{}let r=l(t);if(r===t)break;t=r}}function Jt(e){let t={},n=e.toLowerCase();for(let[r,i]of Object.entries(h)){if(!r.toLowerCase().startsWith(n))continue;let a=r.substring(e.length).split(`__`).filter(Boolean);if(a.length===0)continue;let o=t;for(let e=0;e<a.length;e++){let t=a[e];if(e===a.length-1)o[t]=i;else if(o[t]===void 0&&(o[t]={}),typeof o[t]==`object`)o=o[t];else break}}return t}function Yt(e,t={}){let n=_===`win32`,r=n?h.USERPROFILE:h.HOME,i=[{...t}],a=[];function o(e){if(!e||a.includes(e))return;let t=Kt(e);t&&(i.push(t),a.push(e))}n||(o(u(`/etc`,e,`config`)),o(u(`/etc`,`${e}rc`))),r&&(o(u(r,`.config`,e,`config`)),o(u(r,`.config`,e)),o(u(r,`.${e}`,`config`)),o(u(r,`.${e}rc`))),o(qt(`.${e}rc`));let s=Jt(`${e}_`);return s.config&&o(s.config),Object.assign({},...i,s,a.length?{configs:a,config:a[a.length-1]}:void 0)}const Xt=/^.*?:\/\/(.*?@)?(github\.com[:/])/i,Zt=/^([^/]+)\/([^/]+)\/(?:.*\/)?([0-9a-f]+|v?[0-9]+\.[0-9]+\.[0-9]+)$/i,Qt=/[0-9]+(\.[0-9]+)?(\.[0-9]+)?/g,$t=/[0-9]+\.[0-9]+\.[0-9]+(-.+)?/g,en=/(@[^/]+\/)?([^/]+)/g;function tn(e){let t=e.match(en);return t?t[t.length-1]:e}const nn=`https://registry.npmjs.org`;let rn=null;const an=new Map;function on(){return rn??=Yt(`npm`,{registry:nn})}function sn(e){return e.replace(/^\$\{?([^}]*)\}?$/,(e,t)=>h[t]||``)}function cn(e,t){let n=n=>t[`${e}:${n}`]||t[`${e}/:${n}`],r=n(`_authToken`);if(r)return{token:sn(r),type:`Bearer`};let i=n(`username`),a=n(`_password`);if(i&&a){let e=Buffer.from(sn(a),`base64`).toString(`utf8`);return{token:Buffer.from(`${i}:${e}`).toString(`base64`),type:`Basic`,username:i,password:e}}let o=n(`_auth`);if(o)return{token:sn(o),type:`Basic`}}function ln(e,t){let n=new URL(e.startsWith(`//`)?`http:${e}`:e),r;for(;r!==`/`&&n.pathname!==r;){r=n.pathname||`/`;let e=cn(`//${n.host}${r.replace(/\/$/,``)}`,t);if(e)return e;let i=r.endsWith(`/`)?r:`${r}/`;n.pathname=new URL(`..`,new URL(i,`http://x`)).pathname}let i=t._auth;if(i)return{token:sn(i),type:`Basic`}}function un(e,t){let n=t[`${e}:registry`]||t.registry;return n.endsWith(`/`)?n:`${n}/`}function dn(e,t){rn||=on();let n=e.startsWith(`@`)?e.split(`/`)[0]:``,r=`${n}:${t}`,i=an.get(r);if(i)return i;let a=()=>({auth:ln(t,rn),registry:t}),o;if(!e.startsWith(`@`))o=a();else{let e=at(un(n,rn));if(e!==t)try{let t=ln(e,rn);o=t?.token?{auth:t,registry:e}:a()}catch{o=a()}else o=a()}return an.set(r,o),o}function fn(e,t,n){rn||=on();let r=at((typeof n.registry==`string`?n.registry:!1)||t.registry||rn.registry||nn);return{...dn(e,r),originalRegistry:r}}function pn(e,t,n){let r=`${e}/${t.replace(/\//g,`%2f`)}`;return n?`${r}/${n}`:r}const mn=new Map,hn=new Map,gn=new Map;function _n(e){let t={};for(let n of Object.keys(e.versions??{}))t[n]={};return{name:e.name,"dist-tags":e[`dist-tags`],versions:t,time:e.time,error:e.error}}async function vn(e,t,n,r,i){let{auth:a,registry:o}=fn(e,n,r),s=pn(o,t===`resolutions`?tn(e):e),c=mn.get(s);if(!c){let t=ot(a?.type,a?.token);t.headers={...t.headers,accept:`application/vnd.npm.install-v1+json`},c=(async()=>{try{let n=await ft(s,i,t,_n);return`body`in n||Ft(n.res,s,e,o),JSON.parse(n.body)}catch(e){throw mn.delete(s),e}})(),mn.set(s,c)}return[await c,t,o,e]}async function yn(e,t,n,r,i){let{auth:a,registry:o}=fn(e,n,r),s=pn(o,e,t),c=hn.get(s);if(c)return c;let l=(async()=>{try{let n=ot(a?.type,a?.token),r=await pt(s,i,n,e=>({repository:e.repository,homepage:e.homepage,_npmOperationalInternal:e._npmOperationalInternal?.tmp?{tmp:e._npmOperationalInternal.tmp}:void 0}));if(!(`body`in r))return{};let c=JSON.parse(r.body),l=``,u=c?._npmOperationalInternal?.tmp;if(u){let e=/(\d{13})/.exec(u);e&&(l=new Date(Number(e[1])).toISOString())}if(!l){let r=pn(o,e),a=gn.get(r);a||(a=(async()=>{try{let e=await q(i,r,n);return e?.ok?await e.json():null}catch{return gn.delete(r),null}})(),gn.set(r,a)),l=(await a)?.time?.[t]||``}return{repository:c.repository,homepage:c.homepage,date:l}}catch{return{}}})();return hn.set(s,l),l}function bn(e){return e.startsWith(`npm:@jsr/`)||e.startsWith(`jsr:`)}function xn(e){return e.startsWith(`link:`)||e.startsWith(`file:`)}function Sn(e,t){if(e.startsWith(`npm:@jsr/`)){let t=/^npm:@jsr\/([^_]+)__([^@]+)@(.+)$/.exec(e);if(t)return{scope:t[1],name:t[2],version:t[3]}}else if(e.startsWith(`jsr:@`)){let t=/^jsr:@([^/]+)\/([^@]+)@(.+)$/.exec(e);if(t)return{scope:t[1],name:t[2],version:t[3]}}else if(e.startsWith(`jsr:`)){let n=e.substring(4);if(t?.startsWith(`@`)){let e=/^@([^/]+)\/(.+)$/.exec(t);if(e)return{scope:e[1],name:e[2],version:n}}}return{scope:null,name:null,version:``}}async function Cn(e,t,n){let r=/^@([^/]+)\/(.+)$/.exec(e);if(!r)throw Error(`Invalid JSR package name: ${e}`);let[,i,a]=r,o=`${n.jsrApiUrl}/@${i}/${a}/meta.json`,s=await ft(o,n,{headers:{"accept-encoding":`gzip, deflate, br`}},e=>({latest:e.latest,versions:Object.fromEntries(Object.entries(e.versions??{}).map(([e,t])=>[e,{createdAt:t?.createdAt}]))}));if(`body`in s){let r=JSON.parse(s.body),i={},a={};for(let[e,t]of Object.entries(r.versions??{}))i[e]={version:e,time:t.createdAt},a[e]=t.createdAt;return[{name:e,"dist-tags":{latest:r.latest},versions:i,time:a},t,n.jsrApiUrl,e]}Ft(s.res,o,e,`JSR`)}function wn(e,t){let n=new Map;for(let[e,{old:r,oldOrig:i,new:a}]of Object.entries(t)){let[t,o]=e.split(`\0`),s=i||r;t===`packageManager`?n.set(`${t}\0${o}@${s}`,`"${t}": "${o}@${a}"`):n.set(`${o}\0${s}`,`"${o}": "${a}"`)}return n.size?e.replace(/"((?:[^"\\]|\\.)*)": *"((?:[^"\\]|\\.)*)"/g,(e,t,r)=>n.get(`${t}\0${r}`)??e):e}function Tn(e,t,n){let r=e.replace($t,t);if(!n||n===e)return r;let i=/^([\^~]|>=\s*)([\d.]+)$/.exec(n);if(!i)return r;let[,a,o]=i,s=t.split(/[-+]/)[0];if(s!==t)return r;let c=o.split(`.`).length,l=s.split(`.`);return l.length===c?r:`${a}${l.slice(0,c).join(`.`)}`}function X(e){if(/[xX*]/.test(e))return e;let t=e.match(Qt);return t?.length===1?e.replace(Qt,J(t[0])):e}async function En(e,t,n){let r=`${n.forgeApiUrl}/repos/${e}/${t}/commits`;try{let e=n.noCache?null:await Ze(r),t=await Ot(r,n,e?{"if-none-match":e.etag}:void 0),i;if(t?.status===304&&e)i=e.body;else if(t?.ok){let{sha:e,commit:a}=JSON.parse(await t.text())[0];i=JSON.stringify([{sha:e,commit:{committer:a?.committer,author:a?.author}}]);let o=t.headers.get(`etag`);o&&!n.noCache&&et(r,o,i)}else return{hash:``,commit:{}};let{sha:a,commit:o}=JSON.parse(i)[0];return{hash:a,commit:o}}catch{return{hash:``,commit:{}}}}async function Dn(e,t,n){return(await Pt(n.forgeApiUrl,e,t,n)).map(e=>e.name)}async function On(e,t,n){let r=t.old.replace(Xt,``),[,i,a,o]=Zt.exec(r)||[];if(!i||!a||!o)return null;let s=e=>{let n=t.old.lastIndexOf(o);return t.old.slice(0,n)+e+t.old.slice(n+o.length)};if(jt.test(o)){let{hash:t,commit:r}=await En(i,a,n);if(!t)return null;let c=r?.committer?.date??r?.author?.date,l=t.substring(0,o.length);if(o.toLowerCase()!==l.toLowerCase())return{key:e,newRange:s(l),user:i,repo:a,oldRef:o,newRef:l,newDate:c}}else{let t=kt(await Dn(i,a,n),o);if(t)return{key:e,newRange:s(t),user:i,repo:a,oldRef:o,newRef:t}}return null}function kn(e){let t={};for(let[n,r]of Object.entries(e.releases??{}))t[n]=(r??[]).slice(0,1).map(e=>e.upload_time_iso_8601?{upload_time_iso_8601:e.upload_time_iso_8601}:{});let{name:n,version:r,project_urls:i}=e.info??{};return{info:{name:n,version:r,project_urls:i},releases:t}}async function An(e,t,n){let r=`${n.pypiApiUrl}/pypi/${e}/json`,i=await ft(r,n,{headers:{"accept-encoding":`gzip, deflate, br`}},kn);if(`body`in i)return[JSON.parse(i.body),t,null,e];Ft(i.res,r,e,n.pypiApiUrl)}function jn(e,t){let n=e;for(let[e,{old:r,oldOrig:i}]of Object.entries(t)){let a=e.split(`\0`)[1],o=i||r;n=n.replace(RegExp(`(['"])(${G(a)} *(?:\\[[^\\]]+\\])? *[<>=~]+ *)${G(o)}\\1`,`g`),(n,r,i)=>`${r}${i}${t[e].new}${r}`)}return n}let Mn;async function Nn(){let[{execFile:e},{promisify:t}]=await Promise.all([import(`node:child_process`),import(`node:util`)]);return t(e)}function Pn(){return Mn??=Nn()}function Fn(){let e=h.GOPROXY||`https://proxy.golang.org,direct`;for(let t of e.split(/[,|]/)){let e=t.trim();if(e&&e!==`direct`&&e!==`off`)return at(e)}return`https://proxy.golang.org`}function In(){return(h.GONOPROXY||h.GOPRIVATE||``).split(`,`).map(e=>e.trim()).filter(Boolean)}function Ln(e,t){return t.some(t=>e===t||e.startsWith(`${t}/`))}function Rn(e){return e.replace(/[A-Z]/g,e=>`!${e.toLowerCase()}`)}const zn=/\/v(\d+)$/;function Bn(e){let t=zn.exec(e);return t?Number.parseInt(t[1]):1}function Vn(e,t){let n=e.replace(zn,``);return t<=1?n:`${n}/v${t}`}function Hn(e,t){if(t.includes(`+incompatible`))return e;let n=Number.parseInt(K(t).split(`.`)[0]);return Number.isNaN(n)||n<=1||n===Bn(e)?e:Vn(e,n)}function Un(e,t){let n=t?/^(\S+)(?:\s+v\S+)?\s+=>\s+(\S+)\s+(v\S+)/.exec(e):/^replace\s+(\S+)(?:\s+v\S+)?\s+=>\s+(\S+)\s+(v\S+)/.exec(e);if(!n)return null;let[,r,i,a]=n;return i.startsWith(`./`)||i.startsWith(`/`)||i.startsWith(`../`)?null:{origModule:r,targetModule:i,targetVersion:a}}function Wn(e,t,n){return t===`indirect`||e.startsWith(`golang.org/x/`)||Gn(n)}function Gn(e){return/\d{14}-[0-9a-f]{12}$/.test(e)}function Kn(e,t,n){return[{name:e,old:t,new:t},n,null,e]}async function qn(e,t,n){if(!t)return null;let r=t,i=e+101,a=e+2,o=7;for(;a<=i;){let e=Math.min(a+o-1,i),t=await Promise.all(Array.from({length:e-a+1},(e,t)=>n(a+t))),s=t.indexOf(null),c=s===-1?t:t.slice(0,s);if(c.length&&(r=c.at(-1)),s!==-1)break;a=e+1,o*=2}return r}function Jn(e,t,n,r,i,a){let o=r?.Version??i,s=r?.Time??a,c=r?.path??e;return[{name:e,old:n,new:K(o),Time:s,...c!==e&&{newPath:c},sameMajorNew:K(i),sameMajorTime:a},t,null,e]}function Yn(e){let t={},n={},r={},i={},a=new Set,o=[],s=e.split(/\r?\n/),c=!1,l=!1,u=!1;for(let e of s){let i=e.trim();if(/^require\s*\(/.test(i)){c=!0;continue}if(/^replace\s*\(/.test(i)){l=!0;continue}if(/^tool\s*\(/.test(i)){u=!0;continue}if(i===`)`){c=!1,l=!1,u=!1;continue}if(i.startsWith(`//`))continue;if(u){i&&!i.startsWith(`//`)&&o.push(i);continue}let s=/^tool\s+(\S+)/.exec(i);if(s){o.push(s[1]);continue}let d=i.includes(`// indirect`);if(l||/^replace\s+/.test(i)){let e=Un(i,l);e&&(r[e.targetModule]=e.targetVersion,a.add(e.origModule));continue}let f=c?/^(\S+)\s+(v\S+)/.exec(i):/^require\s+(\S+)\s+(v\S+)/.exec(i);f&&((d?n:t)[f[1]]=f[2])}for(let e of a)delete t[e],delete n[e];if(o.length){let e=[...Object.keys(n),...Object.keys(t)];for(let r of o){let a=``;for(let t of e)(r===t||r.startsWith(`${t}/`))&&t.length>a.length&&(a=t);let o=n[a]?n:t[a]?t:null;o&&(i[a]=o[a],delete o[a])}}return{deps:t,indirect:n,replace:r,tool:i}}async function Xn(e,t,n,r,i){let a=Bn(e),o=async(e,t)=>{try{let{stdout:n}=await(await Pn())(`go`,[`list`,`-m`,`-json`,`${e}@latest`],{timeout:t,cwd:r,env:h}),i=JSON.parse(n);return{Version:i.Version,Time:i.Time||``,path:e}}catch{return null}},s=Wn(e,t,n),[c,l]=await Promise.all([o(e,i.fetchTimeout),s?null:o(Vn(e,a+1),i.goProbeTimeout)]);return c?Jn(e,t,n,await qn(a,l,t=>o(Vn(e,t),i.goProbeTimeout)),c.Version,c.Time):Kn(e,n,t)}async function Zn(e,t,n,r,i,a){if(Ln(e,a))return Xn(e,t,n,r,i);let o=Rn(e),s=Bn(e),c=async t=>{let n=Vn(e,t);try{let e=await i.doFetch(`${i.goProxyUrl}/${Rn(n)}/@latest`,{signal:AbortSignal.timeout(i.goProbeTimeout),headers:{"accept-encoding":`gzip, deflate, br`}});return e.ok?{...await e.json(),path:n}:null}catch{return null}},l=Wn(e,t,n),[u,d]=await Promise.all([q(i,`${i.goProxyUrl}/${o}/@latest`,{headers:{"accept-encoding":`gzip, deflate, br`}}),l?null:c(s+1)]);if(!u.ok)return Kn(e,n,t);let f,p;try{let e=await u.json();f=e.Version,p=e.Time}catch{return Kn(e,n,t)}return Jn(e,t,n,await qn(s,d,c),f,p)}function Qn(e,t){if(!e.includes(`replace`))return e;let n=G(t);return e=e.replace(RegExp(`^replace\\s+${n}(\\s+v\\S+)?\\s+=>\\s+\\S+(\\s+v\\S+)?\\s*\\n`,`gm`),``),e=e.replace(RegExp(`^\\s+${n}(\\s+v\\S+)?\\s+=>\\s+\\S+(\\s+v\\S+)?\\s*\\n`,`gm`),``),e=e.replace(/^replace\s*\(\s*\)\s*\n/gm,``),e}function $n(e,t){let n=e,r={};for(let[e,{old:i,oldOrig:a}]of Object.entries(t)){let[o,s]=e.split(`\0`),c=a||i,l=t[e].new;if(o===`replace`){n=n.replace(RegExp(`(=>\\s+${G(s)}\\s+)v${G(c)}`,`g`),`$1v${l}`);continue}if(o===`indirect`){n=n.replace(RegExp(`(${G(s)}) +v${G(c)}`,`g`),`$1 v${l}`);continue}let u=Hn(s,l);u===s?n=n.replace(RegExp(`(${G(s)}) +v${G(c)}`,`g`),`$1 v${l}`):(n=n.replace(RegExp(`${G(s)} +v${G(c)}`,`g`),`${u} v${l}`),o===`tool`&&(n=n.replace(RegExp(`(^\\s+|^tool\\s+)${G(s)}(/\\S+)?\\s*$`,`gm`),`$1${u}$2`)),r[s]=u),o!==`tool`&&(n=Qn(n,s))}return[n,r]}function er(e,n,i){let a=Object.entries(n);if(!a.length)return;let o=new Map(a),s=a.map(([e])=>e).sort((e,t)=>t.length-e.length),c=RegExp(`"(${s.map(G).join(`|`)})(/|")`,`g`),l=t(`**/*.go`,{cwd:e});for(let t of l){let n=u(e,t),a=r(n,`utf8`),s=a.replace(c,(e,t,n)=>`"${o.get(t)}${n}`);s!==a&&i(n,s)}}function tr(e){let t=[],n={},r=e.split(/\r?\n/),i=!1,a=!1;for(let e of r){let r=e.trim();if(/^use\s*\(/.test(r)){i=!0;continue}if(/^replace\s*\(/.test(r)){a=!0;continue}if(r===`)`){i=!1,a=!1;continue}if(i){let e=/^(\S+)/.exec(r);e&&!r.startsWith(`//`)&&t.push(e[1]);continue}let o=/^use\s+(\S+)/.exec(r);if(o){t.push(o[1]);continue}if(a||/^replace\s+/.test(r)){let e=Un(r,a);e&&(n[e.targetModule]=e.targetVersion)}}return{use:t,replace:n}}function nr(e){let t=`https://${rr(e)}`,n=new URL(t),r=n.pathname.split(`/`);if(r.length>3){let[,e,i,...a]=r;return n.pathname=`/${e}/${i}/${Lt(t)}/${a.join(`/`)}`,n.href}else return t}function rr(e){return zn.test(e)?l(e):e}function ir(e){return e.replace(/(\d{7})\d{7}-[0-9a-f]{12}$/,`$1`)}const ar=/^\s*(?:-\s*)?uses:\s*['"]?([^'"#\s]+)['"]?/gm;function or(e){if(e.startsWith(`docker://`)||e.startsWith(`./`))return null;let t=/^https?:\/\/([^/]+)\/(.+)$/.exec(e),n=t?.[1]??null,r=t?.[2]??e,i=r.indexOf(`@`);if(i===-1)return null;let a=r.substring(0,i),o=r.substring(i+1);if(!o)return null;let s=a.split(`/`);if(s.length<2)return null;let c=n?`${n}/${a}`:a;return{host:n,owner:s[0],repo:s[1],ref:o,name:c,isHash:jt.test(o)}}function sr(e,t){return e?e===`github.com`?`https://api.github.com`:`https://${e}/api/v1`:t}async function cr(e,t,n,r,i){let a=`${e}/repos/${t}/${n}/git/commits/${r}`;if(!i.noCache){let e=await Ze(a);if(e)return e.body}try{let e=await Ot(a,i);if(!e.ok)return``;let t=await e.json(),n=t?.committer?.date||t?.author?.date||``;return n&&!i.noCache&&et(a,`immutable`,n),n}catch{return``}}function lr(e,t){return It(P(K(e))?.version??K(e),t)}function ur(e,t){let n=e;for(let{name:e,oldRef:r,newRef:i}of t){let t=RegExp(`(uses:\\s*['"]?(?:https?:\\/\\/)?)${G(e)}@${G(r)}(?![\\w.-])`,`g`);n=n.replace(t,`$1${e}@${i}`)}return n}const dr=[`.github`,`.gitea`,`.forgejo`],fr=RegExp(`(?:^|/)(?:${dr.map(G).join(`|`)})\\/(?:workflows\\/[^/]+|(?:[^/]+\\/)*action)\\.ya?ml$`);function pr(e){return fr.test(e.replace(/\\/g,`/`))}function mr(e){let t=new Set;try{for(let n of i(u(e,`workflows`)))/\.ya?ml$/.test(n)&&t.add(f(u(e,`workflows`,n)))}catch{}try{for(let n of i(e,{recursive:!0,withFileTypes:!0}))!n.isFile()||!/^action\.ya?ml$/.test(n.name)||t.add(f(u(n.parentPath,n.name)))}catch{}return Array.from(t)}const hr=/^(v?\d+(?:\.\d+){0,2})(-.+)?$/,gr=/^\s*FROM\s+(?:--platform=\S+\s+)?(\S+)/gm,_r=/^\s*image:\s*['"]?([^\s'"#]+)['"]?/gm,vr=/^\s*container:\s*['"]?([^\s'"#{}]+:[^\s'"#{}:]+)['"]?\s*$/gm,yr=/^\s*(?:-\s*)?uses:\s*['"]?docker:\/\/([^'"#\s]+)['"]?/gm;function br(e){let t=e.split(`/`);return t.length===1?{registry:null,namespace:`library`,repo:t[0]}:t.length===2&&!t[0].includes(`.`)&&!t[0].includes(`:`)?{registry:null,namespace:t[0],repo:t[1]}:{registry:t[0],namespace:t.slice(1,-1).join(`/`),repo:t[t.length-1]}}function xr(e){if(e=e.replace(/^docker:\/\//,``),e.includes(`@`))return null;let t=e.lastIndexOf(`:`);if(t===-1||e.lastIndexOf(`/`)>t)return null;let n=e.substring(0,t),r=e.substring(t+1);if(!r||!hr.test(r))return null;let{registry:i,namespace:a,repo:o}=br(n);return{registry:i,namespace:a,repo:o,tag:r,fullImage:n}}function Sr(e){let t=hr.exec(e);return t?{version:t[1],suffix:t[2]||``}:null}function Cr(e,t){let n=Sr(t);return n?It(e,n.version,n.suffix):t}function wr(e,t){let n=[];for(let r of e.matchAll(t)){let e=xr(r[1]);e&&n.push({ref:e,match:r[1]})}return n}const Tr=new WeakMap;function Er(e,t,n){let r=Tr.get(n);r||Tr.set(n,r=new Map);let i=`${e}/${t}`,a=r.get(i);return a||r.set(i,a=Dr(e,t,n)),a}async function Dr(e,t,n){let r={},i=`${n.dockerApiUrl}/v2/repositories/${e}/${t}/tags`,a=e=>`${i}?page_size=100&ordering=last_updated&page=${e}`,o={headers:{"accept-encoding":`gzip, deflate, br`}},s=e=>({count:e.count,results:(e.results||[]).map(e=>({name:e.name,tag_last_pushed:e.tag_last_pushed,last_updated:e.last_updated}))}),c=async e=>{try{let t=await ft(a(e),n,o,s);return`body`in t?JSON.parse(t.body):null}catch{return null}},l=await c(1);if(!l)return r;for(let e of l.results||[])r[e.name]=e.tag_last_pushed||e.last_updated||``;let u=Math.min(Math.ceil((l.count||0)/100),10);if(u<2)return r;let d=await Promise.all(Array.from({length:u-1},(e,t)=>c(t+2)));for(let e of d)if(e)for(let t of e.results||[])r[t.name]=t.tag_last_pushed||t.last_updated||``;return r}async function Or(e,t,n,r){let i=`${r.dockerApiUrl}/v2/repositories/${e}/${t}/tags/${n}`;try{let e=await ft(i,r,{headers:{"accept-encoding":`gzip, deflate, br`}},e=>({digest:e.digest}));if(!(`body`in e))return null;let t=JSON.parse(e.body).digest;return typeof t==`string`?t:null}catch{return null}}async function kr(e,t,n){let{registry:r,namespace:i,repo:a}=br(e);if(r)throw Error(`Non-Docker-Hub registries are not yet supported: ${r}`);return[{tags:await Er(i,a,n),name:e},t,null,e]}function Ar(e,t,n,r,i,a){let o=Sr(t);if(!o)return null;let s=I(K(o.version))?.version;if(!s)return null;let c=s,l=``,u=``;for(let[t,s]of Object.entries(e)){let e=Sr(t);if(!e||e.suffix!==o.suffix)continue;let d=I(K(e.version))?.version;if(!d||a&&!H(d,a)||!rt(s,r,i))continue;if(d===c){l&&Date.parse(s)>Date.parse(u)&&(l=t,u=s);continue}let f=L(c,d);!f||!n.has(f)||R(d,c)&&(c=d,l=t,u=s)}if(!l||c===s)return null;let d=Cr(c,t);return d===t?null:{newTag:d,hubTag:l,date:u}}function jr(e,t,n){let r=e;for(let[e,i]of Object.entries(t)){let t=e.split(`\0`)[1],a=i.oldOrig||i.old;for(let e of n)r=r.replace(e(G(t),G(a)),`$1${t}:${i.new}`)}return r}function Mr(e,t){return jr(e,t,[(e,t)=>RegExp(`(FROM\\s+(?:--platform=\\S+\\s+)?)${e}:${t}(?![\\w.-])`,`g`)])}function Nr(e,t){return jr(e,t,[(e,t)=>RegExp(`(image:\\s*['"]?)${e}:${t}(?![\\w.-])`,`g`)])}function Pr(e,t){return jr(e,t,[(e,t)=>RegExp(`((?:container|image):\\s*['"]?)${e}:${t}(?![\\w.-])`,`g`),(e,t)=>RegExp(`(uses:\\s*['"]?docker://)${e}:${t}(?![\\w.-])`,`g`)])}const Fr=[`Dockerfile`,`docker-compose.yml`,`docker-compose.yaml`];function Ir(e){return/^docker-.+\.ya?ml$/.test(e)}function Lr(e){return/^Dockerfile(\..+)?$/.test(e)}function Rr(e){return Lr(e)||Ir(e)}function zr(e){return Lr(e)?gr:_r}function Br(e){return e.registry?``:e.namespace===`library`?`https://hub.docker.com/_/${e.repo}`:`https://hub.docker.com/r/${e.namespace}/${e.repo}`}const Vr=[`Makefile`,`makefile`,`GNUmakefile`];function Hr(e){return Vr.includes(e)||e.endsWith(`.mk`)}const Ur=String.raw`^\s*[A-Za-z_][\w.]*\s*(?:::=|:=|\?=|\+=|=)\s*`,Wr=RegExp(`${Ur}${String.raw`(\S+)@(v\d\S*)\s*$`}`),Gr=/^[^/\s]+\.[^/\s]+\//;function Kr(e){let t=e.indexOf(`#`);return t===-1?e:e.slice(0,t)}function qr(e){let t=[];for(let n of e.split(/\r?\n/)){let e=Kr(n),r=Wr.exec(e);if(!r)continue;let[,i,a]=r;Gr.test(i)&&t.push({installPath:i,version:a})}return t}const Jr=RegExp(`${Ur}${String.raw`(\S+)\s*$`}`),Yr=/@(sha256:[0-9a-f]{64})$/;function Xr(e,t,n){return`${e}:${t}${n?`@${n}`:``}`}function Zr(e){let t=null,n=e,r=Yr.exec(e);r&&(t=r[1],n=e.slice(0,r.index));let i=xr(n.replace(/^docker\.io\//,``));return!i||i.registry||i.namespace===`library`?null:{writtenImage:n.slice(0,n.lastIndexOf(`:`)),ref:i,digest:t}}function Qr(e){let t=[];for(let n of e.split(/\r?\n/)){let e=Jr.exec(Kr(n));if(!e)continue;let r=Zr(e[1]);r&&t.push(r)}return t}const $r=/\/v(?:[2-9]|[1-9]\d+)(?=\/|$)/;function ei(e){let t=$r.exec(e);return t?e.slice(0,t.index+t[0].length):null}function ti(e){let t=e.split(`/`),n=[];for(let e=t.length;e>=2;e--)n.push(t.slice(0,e).join(`/`));return n}async function ni(e,t){let n=ei(e);if(n)return n;let r=ti(e);return(await Promise.all(r.map(async e=>{try{return(await t.doFetch(`${t.goProxyUrl}/${Rn(e)}/@latest`,{signal:AbortSignal.timeout(t.goProbeTimeout)})).ok?e:null}catch{return null}}))).find(Boolean)??null}async function ri(e,t,n,r,i,a){let o=await ni(e,r);if(!o)return null;let[s]=await Zn(o,`tool`,K(t),n,r,i),c=bt(s,{mode:`go`,range:K(t),semvers:a.semvers,useGreatest:a.useGreatest,usePre:a.usePre,useRel:a.useRel,pinnedRange:a.pinnedRange,cooldownDays:a.cooldownDays,now:a.now},{allowDowngrade:a.allowDowngrade,matchesAny:U,isGoPseudoVersion:Gn});if(!c)return null;let l=s.newPath??Hn(o,c),u=`${l}${e.slice(o.length)}`,d=It(c,t);return u===e&&d===t?null:{newInstallPath:u,newVersion:d,date:s.Time??``,info:nr(l)}}async function ii(e,t,n){let{namespace:r,repo:i,fullImage:a,tag:o}=e.ref,[s]=await kr(a,`docker`,t),c=Ar(s.tags,o,n.semvers,n.cooldownDays,n.now,n.pinnedRange);if(!c)return null;let l=null;return e.digest&&(l=await Or(r,i,c.hubTag,t),!l)?null:{newTag:c.newTag,newDigest:l,date:c.date,info:Br(e.ref)}}function ai(e,t){for(let{oldSpec:n,newSpec:r}of t){let t=RegExp(`^([^#\\n]*?)${G(n)}(?=[\\s#]|$)`,`gm`);e=e.replace(t,`$1${r}`)}return e}const oi=new Map,si=e=>({versions:(e.versions||[]).filter(e=>!e.yanked).map(e=>({num:e.num,created_at:e.created_at}))});async function ci(e,t,n){let r=`${at(n.cratesIoUrl)}/api/v1/crates/${encodeURIComponent(e)}/versions?per_page=100`,i=oi.get(r);return i||(i=(async()=>{try{let t=await ft(r,n,ot(),si);`body`in t||Ft(t.res,r,e,n.cratesIoUrl);let i;try{i=JSON.parse(t.body)}catch{throw Error(`Invalid JSON from ${r}`)}let a=(i.versions||[]).filter(e=>!e.yanked),o={},s={};for(let e of a)e.num&&(o[e.num]={},s[e.num]=e.created_at||``);return{name:e,versions:o,time:s,"dist-tags":{latest:a[0]?.num??``}}}catch(e){throw oi.delete(r),e}})(),oi.set(r,i)),[await i,t,null,e]}function li(e){let t=new Map;for(let n of e.split(`[[package]]`)){let e=/\bname\s*=\s*"([^"]+)"/.exec(n),r=/\bversion\s*=\s*"([^"]+)"/.exec(n);if(!e||!r)continue;let i=e[1],a=r[1];if(!me(a))continue;let o=t.get(i);o||t.set(i,o=[]),o.push(a)}return t}const ui=/^\d/;function di(e,t){return ui.test(e)?Tn(X(`^${e}`),t,`^${e}`).replace(/^\^/,``):Tn(X(e),t,e)}function fi(e,t,n){let r=e.get(t);if(!r)return;let i=ui.test(n)?`^${n}`:n,a;for(let e of r)H(e,i)&&(!a||R(e,a))&&(a=e);return a}const pi=ze.map(G).join(`|`);function mi(e,t){let n=e;for(let[e,r]of Object.entries(t)){let[,t]=e.split(`\0`),i=r.oldOrig||r.old,a=r.new,o=G(t),s=G(i);n=n.replace(RegExp(`^(\\s*${o}\\s*=\\s*["'])${s}(["'].*)$`,`gm`),`$1${a}$2`),n=n.replace(RegExp(`^(\\s*${o}\\s*=\\s*\\{(?:"[^"]*"|'[^']*'|[^}\\n])*?\\bversion\\s*=\\s*["'])${s}(["'])`,`gm`),`$1${a}$2`),n=n.replace(RegExp(`(\\[(?:${pi})\\.${o}\\](?:(?!\\n\\[)[\\s\\S])*?version\\s*=\\s*["'])${s}(["'])`,`g`),`$1${a}$2`)}return n}function hi(e){return e.split(`|`)[0]}function gi(e,t){let n=t===`.`?``:`|${t}`,r={};for(let[t,i]of Object.entries(e)){let[e,a]=t.split(`\0`),o=hi(e);e===`${o}${n}`&&(r[`${o}${a}`]=i)}return r}const _i=/[*?{[]/;async function vi(e,n,r,i=32){let a=e.filter(e=>!e.startsWith(`!`)),o=e.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1)),s=new Set(o.flatMap(e=>t(e,{cwd:n})).map(e=>e.replace(/\\/g,`/`))),c=new Set,l=[];for(let e of a){let i=_i.test(e)?t(e,{cwd:n}).map(e=>f(u(n,e))):[f(u(n,e))];for(let e of i){let t=d(n,e).replace(/\\/g,`/`);if(s.has(t))continue;let i=u(e,r);c.has(i)||(c.add(i),l.push({absPath:i,memberPath:`./${t}`}))}}return(await W(l,async({absPath:e,memberPath:t})=>{try{return{absPath:e,content:await S(e,`utf8`),memberPath:t}}catch{return null}},{concurrency:i})).filter(e=>e!==null)}function yi(e){let t=[],n=e.split(/\r?\n/),r=!1;for(let e of n){if(/^packages\s*:/.test(e)){r=!0;continue}if(r){let n=e.trim();if(!n||n.startsWith(`#`))continue;if(!n.startsWith(`-`))break;let r=/^\s*-\s+['"]?([^'"#\s]+)['"]?/.exec(e);r&&t.push(r[1])}}return t}const bi={"pnpm-workspace.yaml":`npm`,"package.json":`npm`,"pyproject.toml":`pypi`,"go.work":`go`,"go.mod":`go`,"Cargo.toml":`cargo`},xi=new Set([`npm`,`pypi`,`go`,`cargo`,`actions`,`docker`,`make`]),Si=(e,t)=>typeof e==`string`?at(e):typeof t==`function`?t():t;function Ci(t,n){let r=new Map,i=new Set(t),a=n;for(;i.size;){for(let t of i){let n=u(a,t);try{e(n),r.set(t,n),i.delete(t)}catch{}}let t=l(a);if(t===a)break;a=t}return r}async function wi(e,t){let n=await W(e,async e=>{try{return[e,await S(e,`utf8`)]}catch(t){throw Error(`Unable to open ${e}: ${t.message}`)}},{concurrency:t});return new Map(n)}function Z(e,t){t&&(e.date=t,e.age=Ne(t,{noAffix:!0}))}function Ti(e){let t=0;for(let n of Object.values(e))t+=Object.keys(n).length;return t}function Ei(e){console.error(`${Ve()} ${e}`)}function Q(e,t,n,r,i){if(i===`engines`&&Ie.includes(e)||t===`pypi`&&e===`python`)return!1;if(!n.size&&!r.size)return!0;let a=t===`go`?rr(e):e;for(let t of r)if(t.test(e)||t.test(a))return!1;for(let t of n)if(t.test(e)||t.test(a))return!0;return!n.size}function Di(e){let t=new Set;if(e)for(let r of e){let e;try{e=n(r)}catch(e){throw Error(`Unable to open ${r}: ${e.message}`)}if(e.isFile())t.add(f(r));else if(e.isDirectory()){for(let e of Object.keys(bi)){let i=u(r,e),a=null;try{a=n(i)}catch{}a?.isFile()&&t.add(f(i))}try{for(let e of i(r,{withFileTypes:!0}))e.isFile()&&(Rr(e.name)||Hr(e.name))&&t.add(f(u(r,e.name)))}catch{}let e=f(r).replace(/\\/g,`/`),a=dr.some(t=>e.endsWith(`/${t}/workflows`)),o=!a&&dr.some(t=>e.endsWith(`/${t}`)),s=a?[l(e)]:o?[e]:dr.map(t=>u(e,t));for(let e of s)for(let n of mr(e))t.add(n)}else throw Error(`${r} is neither a file nor directory`)}else{let e=new Set(dr),n=[...Object.keys(bi),...Fr,...Vr,...dr];for(let[r,i]of Ci(n,m()))if(e.has(r))for(let e of mr(i))t.add(e);else t.add(f(i));try{for(let e of i(m(),{withFileTypes:!0})){let n=Rr(e.name)&&!Fr.includes(e.name),r=Hr(e.name)&&!Vr.includes(e.name);e.isFile()&&(n||r)&&t.add(f(u(m(),e.name)))}}catch{}}for(let e of Array.from(t))c(e)===`go.work`&&t.delete(u(l(e),`go.mod`));for(let e of Array.from(t))c(e)===`pnpm-workspace.yaml`&&t.delete(u(l(e),`package.json`));return t}function $(e,t){_===`win32`&&o(e,0),s(e,t,_===`win32`?{flag:`r+`}:void 0)}function Oi(e){let t={results:{}};for(let[n,r]of Object.entries(e))for(let[e,i]of Object.entries(r)){typeof i.oldPrint==`string`&&(i.old=i.oldPrint),typeof i.newPrint==`string`&&(i.new=i.newPrint),typeof i.oldOrig==`string`&&!bn(i.oldOrig)&&(i.old=n===`go`?ir(i.oldOrig):i.oldOrig),n===`go`?i.new=ir(i.new):n===`actions`&&(i.old=K(i.old),i.new=K(i.new)),delete i.oldPrint,delete i.newPrint,delete i.oldOrig,delete i.date;let[r,a]=e.split(`\0`),o=t.results[n]??={};(o[r]??={})[a]=i}return t}let ki=!1;async function Ai(e={}){if(!ki){let{enableDnsCache:e}=await import(`./dns-Cz6xXkw_.js`);e(),ki=!0}let t={...e},n=t.sockets??25,r=t.timeout??0,i=Si(e.forgeapi,`https://api.github.com`),a=Si(e.pypiapi,`https://pypi.org`),o=Si(e.jsrapi,`https://jsr.io`),s=Si(e.goproxy,Fn),d=Si(e.cargoapi,`https://crates.io`),p=Si(e.dockerapi,`https://hub.docker.com`),h=In(),g=t.color||!t.noColor&&v.isTTY,_=e=>g?t=>y(e,String(t)):String,b=_(`magenta`),x=_(`green`),C=_(`red`),w={fetchTimeout:r||5e3,goProbeTimeout:r?r/2:2500,forgeApiUrl:i,pypiApiUrl:a,jsrApiUrl:o,goProxyUrl:s,cratesIoUrl:d,dockerApiUrl:p,doFetch:async(e,n)=>{t.verbose&&Ei(`${b(n?.method||`GET`)} ${e}`);let r=await lt(e,n);return t.verbose&&Ei(`${r.ok?x(r.status):C(r.status)} ${e}`),r},noCache:!!t.noCache},ee=Vt(t.greatest),te=Vt(t.prerelease),E=Vt(t.release),ne=Vt(t.patch),re=Vt(t.minor),ie=Vt(t.allowDowngrade),D=t.modes?.length?new Set(t.modes):xi,ae=(t.overrides??[]).map(e=>({include:e.include?.length?Y(e.include):void 0,exclude:e.exclude?.length?Y(e.exclude):void 0,greatest:e.greatest,prerelease:e.prerelease,release:e.release,patch:e.patch,minor:e.minor,allowDowngrade:e.allowDowngrade,cooldownDays:e.cooldown===void 0?void 0:Ue(String(e.cooldown))})),oe=(e,t)=>e.include&&!U(t,e.include)?!1:!e.exclude||!U(t,e.exclude),se=ae.some(e=>e.cooldownDays);D.has(`actions`)&&Tt();let ce=new Map;function O(e){let t=ce.get(e);if(!t){let n=U(e,ee),r=U(e,te),i=U(e,E),a=U(e,ne),o=U(e,re),s=U(e,ie),c;for(let t of ae)oe(t,e)&&(t.greatest!==void 0&&(n=t.greatest),t.prerelease!==void 0&&(r=t.prerelease),t.release!==void 0&&(i=t.release),t.patch!==void 0&&(a=t.patch),t.minor!==void 0&&(o=t.minor),t.allowDowngrade!==void 0&&(s=t.allowDowngrade),t.cooldownDays!==void 0&&(c=t.cooldownDays));let l=new Set(a?[`patch`]:o?[`patch`,`minor`]:[`patch`,`minor`,`major`]);t={useGreatest:n,usePre:r,useRel:i,semvers:l,allowDowngrade:s,cooldownOverride:c},ce.set(e,t)}return t}let le=Y(t.include??[]),ue=Y(t.exclude??[]),de=t.pin??{},k={},A={},j={},M=Date.now(),fe=e=>{let n=t.cooldown??e;return n?Ue(String(n)):0},pe=m(),N=e=>e.replace(`${pe}/`,``).replace(`${pe}\\`,``),P=0,F=(e,t,n,r,i,a)=>{k[e][`${t}${n}${r}`]={old:i,oldOrig:a}},he=Di(t.files?.length?new Set(t.files):!1),I=await wi(Array.from(he).filter(e=>{if(pr(e))return D.has(`actions`)||D.has(`docker`);let t=c(e);if(Rr(t))return D.has(`docker`);if(Hr(t))return D.has(`make`);let n=bi[t];return!!n&&D.has(n)}),n),L={},ge={},_e={},R=[],ve=null,ye=[],be=!1,xe=[],z=!1,Se=[],Ce=[],we=[],B={};async function Te(e){let n=await Wt(e);return{modeConfig:n,modeInclude:n.include?.length?Y([...t.include??[],...n.include]):le,modeExclude:n.exclude?.length?Y([...t.exclude??[],...n.exclude]):ue,pin:{...n.pin,...de}}}function V(e,n){return t.types?.length?t.types:n?.types?.length?n.types:e===`npm`?Fe:e===`pypi`?Le:e===`go`?t.indirect?Re:Re.filter(e=>e!==`indirect`):e===`cargo`?ze:[]}function Ee(e,t,n,r){k.docker??={};for(let i of n)for(let{ref:n}of wr(e,i)){if(!Q(n.fullImage,`docker`,r.include,r.exclude,`docker`))continue;let e=`${t}${n.fullImage}`;if(k.docker[e])continue;let i=Sr(n.tag);i&&(k.docker[e]={old:i.version,oldOrig:n.tag},Ce.push({key:e,fullImage:n.fullImage,ref:n,filePin:r.pin,fileCooldownDays:r.cooldownDays}))}}async function De(e){let n=await Wt(e);return{include:n.include?.length?Y([...t.include??[],...n.include]):le,exclude:n.exclude?.length?Y([...t.exclude??[],...n.exclude]):ue,pin:n.pin??{},cooldownDays:fe(n.cooldown)}}let H=new Set,ke=new Map;for(let e of he){let t=c(e);if(t===`go.work`)H.add(`go`);else if(t===`pnpm-workspace.yaml`)H.add(`npm`);else if(t===`Cargo.toml`){let t=I.get(e);if(!t)continue;try{let n=T(t);ke.set(e,n);let r=n.workspace?.members;Array.isArray(r)&&r.length&&H.add(`cargo`)}catch{}}}for(let e of he){if(pr(e)){let t=D.has(`actions`),n=D.has(`docker`);if(!t&&!n)continue;let r=I.get(e),a=N(e),o=await De(l(e));if(L[a]={absPath:e,content:r},t){k.actions??={};let e=Array.from(r.matchAll(ar),e=>or(e[1])).filter(e=>e!==null);for(let t of e){if(!Q(t.name,`actions`,o.include,o.exclude,`actions`))continue;let e=`${a}${t.name}`;k.actions[e]||(k.actions[e]={old:t.ref},Se.push({...t,key:e,apiUrl:sr(t.host,i),filePin:o.pin,fileCooldownDays:o.cooldownDays}))}}n&&(ge[a]={absPath:e,content:r,fileType:`workflow`},Ee(r,a,[_r,vr,yr],o));continue}let t=c(e);if(Rr(t)){if(!D.has(`docker`))continue;let n=I.get(e),r=N(e),i=Lr(t)?`dockerfile`:`compose`,a=await De(l(e));ge[r]={absPath:e,content:n,fileType:i},Ee(n,r,[zr(t)],a);continue}if(Hr(t)){if(!D.has(`make`))continue;let t=I.get(e),n=N(e),r=await De(l(e));_e[n]={absPath:e,content:t},k.make??={};let i={projectDir:l(e),filePin:r.pin,fileCooldownDays:r.cooldownDays};for(let{installPath:e,version:a}of qr(t)){if(!Q(e,`make`,r.include,r.exclude,`make`))continue;let t=`${n}${e}`;k.make[t]||(k.make[t]={old:K(a),oldOrig:a},we.push({kind:`go`,key:t,name:e,oldSpec:`${e}@${a}`,installPath:e,version:a,...i}))}for(let e of Qr(t)){if(!Q(e.writtenImage,`make`,r.include,r.exclude,`make`))continue;let t=`${n}${e.writtenImage}`;if(k.make[t])continue;let a=Sr(e.ref.tag);if(!a)continue;let o=Xr(e.writtenImage,e.ref.tag,e.digest);k.make[t]={old:a.version,oldOrig:e.ref.tag},we.push({kind:`docker`,key:t,name:e.writtenImage,oldSpec:o,image:e,...i})}continue}let r=bi[t];if(!D.has(r))continue;if(t===`go.work`){k[r]??={};let t=l(f(e)),i=I.get(e);ve={file:e,content:i};let a=tr(i),[o,s]=await Promise.all([Te(t),W(a.use,async e=>{let n=f(u(t,e,`go.mod`));try{return{usePath:e,modPath:n,content:await S(n,`utf8`)}}catch{return null}},{concurrency:n})]),{modeConfig:c,modeInclude:d,modeExclude:p,pin:m}=o,h=V(r,c);B[r]={modeConfig:c,projectDir:t,pin:m};for(let e of s){if(!e)continue;let{usePath:t,modPath:n,content:i}=e,a=Yn(i),o=l(n);R.push({absPath:n,content:i,projectDir:o,usePath:t});let s=t===`.`?``:`|${t}`;for(let e of h){let t=a[e]||{};for(let[n,i]of Object.entries(t))Q(n,r,d,p,e)&&F(r,e,s,n,ir(i),K(i))}}for(let[e,t]of Object.entries(a.replace))Q(e,r,d,p,`replace`)&&F(r,`replace`,``,e,ir(t),K(t));P+=Object.keys(k[r]).length;continue}if(t===`go.mod`&&R.some(t=>t.absPath===f(e))||t===`package.json`&&xe.some(t=>t.absPath===f(e)))continue;if(t===`Cargo.toml`){k[r]??={};let t=Object.keys(k[r]).length,i=I.get(e),a=ke.get(e)??T(i),o=l(f(e)),s=Ci([`Cargo.lock`],o).get(`Cargo.lock`),c=a.workspace?.members,u=Array.isArray(c)&&c.length,[d,p,m]=await Promise.all([Te(o),s?S(s,`utf8`):Promise.resolve(null),u?vi(c,o,`Cargo.toml`,n):Promise.resolve([])]),{modeConfig:h,modeInclude:g,modeExclude:_,pin:v}=d,y=V(r,h),b=p?li(p):new Map,x=(e,t)=>{for(let n of y){let i=Be(e,n)||{};if(!(typeof i!=`object`||Array.isArray(i))){for(let[e,a]of Object.entries(i))if(Q(e,r,g,_,n))if(typeof a==`object`&&a&&`version`in a&&!(`git`in a)&&!(`path`in a)){let i=a.version;Oe(i)&&F(r,n,t,e,fi(b,e,i)??X(i),i)}else typeof a==`string`&&Oe(a)&&F(r,n,t,e,fi(b,e,a)??X(a),a)}}};if(u){be=!0,B[r]={modeConfig:h,projectDir:o,pin:v},x(a,``),ye.push({absPath:f(e),content:i,memberPath:`.`});for(let e of m){ye.push(e);try{x(T(e.content),`|${e.memberPath}`)}catch(t){throw Error(`Error parsing ${e.absPath}: ${t.message}`)}}}else{let t=j[r]??=[],n=!t.length&&!H.has(r),s=n?`.`:N(e);t.push({absPath:f(e),content:i,memberPath:s,projectDir:o,modeConfig:h,pin:v,modeCooldownDays:fe(h.cooldown)}),n&&(B[r]={modeConfig:h,projectDir:o,pin:v}),x(a,s===`.`?``:`|${s}`)}P+=Object.keys(k[r]).length-t;continue}if(t===`pnpm-workspace.yaml`){k[r]??={};let t=l(f(e)),i=I.get(e);z=!0;let a=yi(i),o=u(t,`package.json`),[s,c,d]=await Promise.all([Te(t),We(S(o,`utf8`)),vi(a,t,`package.json`,n)]),{modeConfig:p,modeInclude:m,modeExclude:h,pin:g}=s,_=V(r,p);B[r]={modeConfig:p,projectDir:t,pin:g};let v=(e,t)=>{for(let n of _){let i=e[n]||{};if(typeof i==`string`){let[e,a]=i.split(`@`);Q(e,r,m,h,n)&&F(r,n,t,e,X(a),a)}else if(typeof i==`object`&&!Array.isArray(i))for(let[e,a]of Object.entries(i))Q(e,r,m,h,n)&&(bn(a)?F(r,n,t,e,Sn(a,e).version,a):Oe(a)?F(r,n,t,e,X(a),a):xn(a)?F(r,n,t,e,`0.0.0`,a):A[`${n}${t}${e}`]={old:a})}};if(c!==null){let e;try{e=JSON.parse(c)}catch(e){throw Error(`Error parsing ${o}: ${e.message}`)}xe.push({absPath:f(o),content:c,memberPath:`.`}),v(e,``)}for(let e of d){let t;try{t=JSON.parse(e.content)}catch(t){throw Error(`Error parsing ${e.absPath}: ${t.message}`)}xe.push(e),v(t,`|${e.memberPath}`)}P+=Object.keys(k[r]).length+Object.keys(A).length;continue}k[r]??={};let a=l(f(e)),{modeConfig:o,modeInclude:s,modeExclude:d,pin:p}=await Te(a),m=V(r,o),h=j[r]??=[],g=!h.length&&!H.has(r),_=g?`.`:N(e),v=_===`.`?``:`|${_}`,y=I.get(e);h.push({absPath:f(e),content:y,memberPath:_,projectDir:a,modeConfig:o,pin:p,modeCooldownDays:fe(o.cooldown)});let b={};try{r===`npm`?b=JSON.parse(y):r===`pypi`?b=T(y):r===`go`&&(b=Yn(y))}catch(t){throw Error(`Error parsing ${e}: ${t.message}`)}let x=Object.keys(k[r]).length,C=Object.keys(A).length;for(let e of m){let t;if(t=r===`npm`||r===`go`?b[e]||{}:Be(b,e)||{},Array.isArray(t)&&r===`pypi`)for(let{name:n,version:i}of Pe(t))Q(n,r,s,d,e)&&F(r,e,v,n,X(i),i);else if(typeof t==`string`){let[n,i]=t.split(`@`);Q(n,r,s,d,e)&&F(r,e,v,n,X(i),i)}else for(let[n,i]of Object.entries(t))Q(n,r,s,d,e)&&(r===`npm`&&bn(i)?F(r,e,v,n,Sn(i,n).version,i):r!==`go`&&Oe(i)?F(r,e,v,n,X(i),i):r===`npm`&&xn(i)?F(r,e,v,n,`0.0.0`,i):r===`npm`?A[`${e}${v}${n}`]={old:i}:r===`go`&&F(r,e,v,n,ir(i),K(i)))}P+=Object.keys(k[r]).length-x+(Object.keys(A).length-C),g&&(B[r]={modeConfig:o,projectDir:a,pin:p})}if(k.actions&&(P+=Object.keys(k.actions).length),k.docker&&(P+=Object.keys(k.docker).length),k.make&&(P+=Object.keys(k.make).length),P===0)return{results:{},message:`No dependencies found, nothing to do.`};let Ae=[],je={registry:t.registry};for(let[e,t]of Object.entries(B)){let r=k[e]&&Object.keys(k[e]).length>0,i=e===`npm`&&Object.keys(A).length>0;if(!r&&!i)continue;let{modeConfig:a,projectDir:o,pin:s}=t,c=fe(a.cooldown);Ae.push((async()=>{let t=new Map;for(let n of j[e]??[])n.memberPath!==`.`&&t.set(`|${n.memberPath}`,n);let r={modeConfig:a,projectDir:o,pin:s,modeCooldownDays:c},i=e=>{let n=e.slice(hi(e).length);return n&&t.get(n)||r},l=new Map,u=e=>{for(let[t,{date:n}]of Object.entries(e)){if(!n)continue;let{modeCooldownDays:r}=i(t.split(`\0`)[0]);if(!r&&!se)continue;let[,a]=t.split(`\0`),o=O(a).cooldownOverride??r;o&&!rt(n,o,M)&&delete e[t]}};if(await W(Object.keys(k[e]),async t=>{let[n,r]=t.split(`\0`),a=hi(n),{modeConfig:o,projectDir:s,pin:c,modeCooldownDays:u}=i(n),d=k[e][t],f=null;if(e===`npm`){let{oldOrig:n}=d;if(n&&bn(n))f=await Cn(r,a,w);else if(n&&xn(n))try{f=await vn(r,a,o,je,w)}catch{delete k[e][t];return}else f=await vn(r,a,o,je,w)}else f=e===`go`?await Zn(r,a,d.oldOrig||d.old,s,w,h):e===`cargo`?await ci(r,a,w):await An(r,a,w);if(!f)return;let[p,,m]=f;if(p.error)throw Error(p.error);let{useGreatest:g,usePre:_,useRel:v,semvers:y,allowDowngrade:b,cooldownOverride:x}=O(p.name),S=d.old,C=d.oldOrig,ee=c[r],te=x??u,T=bt(p,{usePre:_,useRel:v,useGreatest:g,semvers:y,range:S,mode:e,pinnedRange:ee,cooldownDays:te||void 0,now:te?M:void 0},{allowDowngrade:b,matchesAny:U,isGoPseudoVersion:Gn}),E=``;if([`go`,`pypi`].includes(e)&&T)E=T;else if(e===`cargo`&&T&&C)E=di(C,T);else if(T)if(C&&xn(C))E=String(on()[`save-exact`])===`true`?T:`^${T}`;else if(C&&bn(C)){let e=/^(npm:@jsr\/[^@]+@|jsr:@[^@]+@)(.+)$/.exec(C);e?E=`${e[1]}${T}`:C.startsWith(`jsr:`)&&(E=`jsr:${T}`)}else E=Tn(S,T,C);if(!T||T===S||C&&C===E){delete k[e][t];return}let ne=``;e===`pypi`&&p.releases?.[T]?.[0]?.upload_time_iso_8601?ne=p.releases[T][0].upload_time_iso_8601:e===`go`&&p.Time?ne=p.Time:e===`cargo`&&p.time?.[T]&&(ne=p.time[T]),d.new=E,C&&bn(C)&&(d.newPrint=T),e===`npm`?l.set(t,{name:r,promise:yn(p.name,T,o,je,w)}):e===`pypi`?d.info=Rt(p,m,p.info.name):e===`go`?d.info=nr(p.newPath||r):e===`cargo`&&(d.info=`https://crates.io/crates/${r}`),ne&&Z(d,ne)},{concurrency:n}),await Promise.all(Array.from(l,async([t,{name:n,promise:r}])=>{let i=await r,a=k[e][t];a&&(a.info=Rt({repository:i.repository,homepage:i.homepage},null,n),i.date&&Z(a,i.date))})),e===`npm`&&Object.keys(A).length){let t=(await W(Object.entries(A),([e,t])=>On(e,t,w),{concurrency:n})).filter(e=>e!==null);for(let n of t){let{key:t,newRange:r,user:i,repo:a,oldRef:o,newRef:s,newDate:c}=n;k[e][t]={old:A[t].old,new:r,oldPrint:jt.test(o)?o.substring(0,7):o,newPrint:jt.test(s)?s.substring(0,7):s,info:`https://github.com/${i}/${a}`},c&&Z(k[e][t],c)}}u(k[e])})())}Se.length&&Ae.push((async()=>{let e=new Map;for(let t of Se){let n=`${t.apiUrl}/${t.owner}/${t.repo}`,r=e.get(n);r||e.set(n,r={apiUrl:t.apiUrl,owner:t.owner,repo:t.repo,infos:[]}),r.infos.push(t)}await W(e.values(),async({apiUrl:e,owner:t,repo:r,infos:i})=>{let a=await Pt(e,t,r,w),o=[],s=new Map,c=new Map,l=new Map;for(let e of a){c.set(e.name,e);let t=K(e.name);me(t)&&(o.push(t),s.has(t)||s.set(t,e.name)),e.commitSha&&l.set(e.commitSha,e.name)}let u=new Map;async function d(n){if(u.has(n))return u.get(n);let i=await cr(e,t,r,n,w);return u.set(n,i),i}async function f(e){let t=new Set;for(let n=0;n<20;n++){let n=yt({},t.size?o.filter(e=>!t.has(e)):o,e);if(!n||n===e.range)return null;let r=s.get(n);if(!r){t.add(n);continue}let i=c.get(r)?.commitSha||``;if(!e.cooldownDays)return{version:n,tag:r,commitSha:i,date:``};let a=i?await d(i):``;if(rt(a,e.cooldownDays,e.now))return{version:n,tag:r,commitSha:i,date:a};t.add(n)}return null}await W(i,async({key:e,host:n,ref:i,name:a,isHash:o,filePin:s,fileCooldownDays:u})=>{let p=k.actions[e],m=`https://${n||`github.com`}/${t}/${r}`,h=de[a]??s[a];if(o){let{usePre:t,useRel:n,cooldownOverride:r}=O(a),o=r??u,s=await f({range:`0.0.0`,semvers:new Set([`patch`,`minor`,`major`]),usePre:t,useRel:n,useGreatest:!0,pinnedRange:h,cooldownDays:o||void 0,now:o?M:void 0});if(!s){delete k.actions[e];return}let{tag:c,commitSha:d,date:g}=s;if(!d||d===i||d.startsWith(i)||i.startsWith(d)){delete k.actions[e];return}let _=l.get(i);if(!_){for(let[e,t]of l)if(e.startsWith(i)){_=t;break}}p.old=i,p.new=d.substring(0,i.length),p.oldPrint=_||i.substring(0,7),p.newPrint=c,p.info=m,g&&Z(p,g)}else{let t=J(K(i));if(!t){delete k.actions[e];return}let{usePre:n,useRel:r,semvers:o,cooldownOverride:s}=O(a),l=s??u,g=await f({range:t,semvers:o,usePre:n,useRel:r,useGreatest:!0,pinnedRange:h,cooldownDays:l||void 0,now:l?M:void 0});if(!g){delete k.actions[e];return}let{tag:_,commitSha:v,date:y}=g,b=lr(_,i);if(b===i){delete k.actions[e];return}if(p.new=c.has(b)?b:_,p.info=m,v&&y)Z(p,y);else if(v){let e=await d(v);e&&Z(p,e)}}},{concurrency:n})},{concurrency:n}),Object.keys(k.actions).length||delete k.actions})()),Ce.length&&Ae.push((async()=>{let e=new Map;for(let t of Ce){let n=e.get(t.fullImage);n||e.set(t.fullImage,n=[]),n.push(t)}await W(e.entries(),async([e,t])=>{let n;try{let[t]=await kr(e,`docker`,w);n=t}catch{for(let e of t)delete k.docker[e.key];return}for(let e of t){let t=k.docker[e.key],r=t.oldOrig||t.old,{semvers:i,cooldownOverride:a}=O(e.fullImage),o=de[e.fullImage]??e.filePin[e.fullImage],s=a??e.fileCooldownDays,c=Ar(n.tags,r,i,s||void 0,s?M:void 0,o);if(!c){delete k.docker[e.key];continue}t.new=c.newTag,t.info=Br(e.ref),Z(t,c.date)}},{concurrency:n}),Object.keys(k.docker).length||delete k.docker})()),we.length&&Ae.push((async()=>{await W(we,async e=>{let{useGreatest:t,usePre:n,useRel:r,semvers:i,allowDowngrade:a,cooldownOverride:o}=O(e.name),s=de[e.name]??e.filePin[e.name],c=o??e.fileCooldownDays,l={semvers:i,useGreatest:t,usePre:n,useRel:r,allowDowngrade:a,pinnedRange:s,cooldownDays:c||void 0,now:c?M:void 0},u=k.make[e.key],d;if(e.kind===`go`){let t=await We(ri(e.installPath,e.version,e.projectDir,w,h,l));if(!t){delete k.make[e.key];return}e.newSpec=`${t.newInstallPath}@${t.newVersion}`,u.new=t.newVersion,d=t}else{let t=await We(ii(e.image,w,l));if(!t){delete k.make[e.key];return}e.newSpec=Xr(e.image.writtenImage,t.newTag,e.image.digest?t.newDigest:null),u.new=t.newTag,d=t}u.info=d.info,d.date&&Z(u,d.date)},{concurrency:n}),Object.keys(k.make).length||delete k.make})());try{await Promise.all(Ae)}finally{await tt()}if(!Ti(k))return{results:{},message:`All dependencies are up to date.`};if(t.update){let e=(e,t,n)=>{for(let r of t){let t=gi(k[e],r.memberPath);Object.keys(t).length&&$(r.absPath,n(r.content,t))}},t=new Map;if(k.actions)for(let[e,n]of Object.entries(k.actions)){let[r,i]=e.split(`\0`),a=t.get(r);a||t.set(r,a=[]),a.push({name:i,oldRef:n.old,newRef:n.new})}let n=new Map;if(k.docker)for(let[e,t]of Object.entries(k.docker)){let[r]=e.split(`\0`),i=n.get(r);i||n.set(r,i={}),i[e]=t}let r=new Map;if(k.make)for(let e of we){if(!e.newSpec||!k.make[e.key])continue;let t=e.key.split(`\0`)[0],n=r.get(t);n||r.set(t,n=[]),n.push({oldSpec:e.oldSpec,newSpec:e.newSpec})}let i=Object.keys(k).sort((e,t)=>(e===`docker`)-+(t===`docker`));for(let a of i)if(Object.keys(k[a]).length){if(a===`actions`){for(let[e,n]of t){let{absPath:t,content:r}=L[e]||{};if(!t)continue;let i=ur(r,n);$(t,i),ge[e]&&(ge[e].content=i)}continue}if(a===`docker`){for(let[e,t]of n){let n=ge[e];if(!n)continue;let{absPath:r,content:i,fileType:a}=n;$(r,(a===`dockerfile`?Mr:a===`compose`?Nr:Pr)(i,t))}continue}if(a===`make`){for(let[e,t]of r){let n=_e[e];n&&$(n.absPath,ai(n.content,t))}continue}if(a===`go`){if(ve){for(let e of R){let t=gi(k[a],e.usePath);if(!Object.keys(t).length)continue;let[n,r]=$n(e.content,t);n!==e.content&&$(e.absPath,n),er(e.projectDir,r,$)}let e={};for(let[t,n]of Object.entries(k[a]))t.split(`\0`)[0]===`replace`&&(e[t]=n);if(Object.keys(e).length){let[t]=$n(ve.content,e);t!==ve.content&&$(ve.file,t)}}for(let e of j.go??[]){let t=gi(k[a],e.memberPath);if(!Object.keys(t).length)continue;let[n,r]=$n(e.content,t);$(e.absPath,n),er(e.projectDir,r,$)}}else a===`cargo`?(be&&e(a,ye,mi),e(a,j.cargo??[],mi)):a===`npm`?(z&&e(a,xe,wn),e(a,j.npm??[],wn)):e(a,j[a]??[],jn)}}return Oi(k)}function ji(e){let t=``,n=0,r=e.length,i=-1;for(;n<r;){let a=e[n];if(a===`"`){for(i=-1,t+=a,n++;n<r;){let i=e[n];if(t+=i,n++,i===`\\`&&n<r){t+=e[n],n++;continue}if(i===`"`)break}continue}if(a===`/`&&n+1<r&&e[n+1]===`/`){for(n+=2;n<r&&e[n]!==`
6
- `;)n++;continue}if(a===`/`&&n+1<r&&e[n+1]===`*`){for(n+=2;n<r&&(e[n]!==`*`||e[n+1]!==`/`);)n++;n+=2;continue}if(a===`,`){i=t.length,t+=a,n++;continue}if(a===`}`||a===`]`){i>=0&&(t=t.slice(0,i)+t.slice(i+1)),i=-1,t+=a,n++;continue}/\s/.test(a)||(i=-1),t+=a,n++}return JSON.parse(t)}export{Oe as a,Ge as i,ji as n,Ke as r,Ai as t};