@adhisang/minecraft-modding-mcp 4.0.0 → 4.1.1

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 (176) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +40 -23
  3. package/dist/build-suggested-call.d.ts +29 -0
  4. package/dist/build-suggested-call.js +58 -0
  5. package/dist/cache-registry.d.ts +3 -1
  6. package/dist/cache-registry.js +50 -6
  7. package/dist/entry-tools/analyze-symbol-service.d.ts +16 -16
  8. package/dist/entry-tools/batch-class-members-service.d.ts +34 -0
  9. package/dist/entry-tools/batch-class-members-service.js +97 -0
  10. package/dist/entry-tools/batch-class-source-service.d.ts +37 -0
  11. package/dist/entry-tools/batch-class-source-service.js +100 -0
  12. package/dist/entry-tools/batch-mappings-service.d.ts +36 -0
  13. package/dist/entry-tools/batch-mappings-service.js +66 -0
  14. package/dist/entry-tools/batch-runner.d.ts +72 -0
  15. package/dist/entry-tools/batch-runner.js +90 -0
  16. package/dist/entry-tools/batch-symbol-exists-service.d.ts +46 -0
  17. package/dist/entry-tools/batch-symbol-exists-service.js +113 -0
  18. package/dist/entry-tools/compare-minecraft-service.d.ts +6 -6
  19. package/dist/entry-tools/inspect-minecraft/handlers/artifact.d.ts +5 -0
  20. package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +83 -0
  21. package/dist/entry-tools/inspect-minecraft/handlers/class-members.d.ts +6 -0
  22. package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +80 -0
  23. package/dist/entry-tools/inspect-minecraft/handlers/class-overview.d.ts +5 -0
  24. package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +248 -0
  25. package/dist/entry-tools/inspect-minecraft/handlers/class-source.d.ts +5 -0
  26. package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +60 -0
  27. package/dist/entry-tools/inspect-minecraft/handlers/file.d.ts +5 -0
  28. package/dist/entry-tools/inspect-minecraft/handlers/file.js +54 -0
  29. package/dist/entry-tools/inspect-minecraft/handlers/list-files.d.ts +5 -0
  30. package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +100 -0
  31. package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +5 -0
  32. package/dist/entry-tools/inspect-minecraft/handlers/search.js +155 -0
  33. package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +6 -0
  34. package/dist/entry-tools/inspect-minecraft/handlers/versions.js +49 -0
  35. package/dist/entry-tools/inspect-minecraft/internal.d.ts +1042 -0
  36. package/dist/entry-tools/inspect-minecraft/internal.js +448 -0
  37. package/dist/entry-tools/inspect-minecraft-service.d.ts +193 -308
  38. package/dist/entry-tools/inspect-minecraft-service.js +20 -1244
  39. package/dist/entry-tools/manage-cache-service.d.ts +16 -16
  40. package/dist/entry-tools/validate-project/cases/access-transformer.d.ts +6 -0
  41. package/dist/entry-tools/validate-project/cases/access-transformer.js +106 -0
  42. package/dist/entry-tools/validate-project/cases/access-widener.d.ts +6 -0
  43. package/dist/entry-tools/validate-project/cases/access-widener.js +86 -0
  44. package/dist/entry-tools/validate-project/cases/mixin.d.ts +6 -0
  45. package/dist/entry-tools/validate-project/cases/mixin.js +90 -0
  46. package/dist/entry-tools/validate-project/cases/project-summary.d.ts +102 -0
  47. package/dist/entry-tools/validate-project/cases/project-summary.js +415 -0
  48. package/dist/entry-tools/validate-project/internal.d.ts +142 -0
  49. package/dist/entry-tools/validate-project/internal.js +303 -0
  50. package/dist/entry-tools/validate-project-service.d.ts +67 -47
  51. package/dist/entry-tools/validate-project-service.js +13 -563
  52. package/dist/entry-tools/verify-mixin-target-service.d.ts +133 -0
  53. package/dist/entry-tools/verify-mixin-target-service.js +323 -0
  54. package/dist/error-mapping.d.ts +40 -0
  55. package/dist/error-mapping.js +139 -0
  56. package/dist/errors.d.ts +6 -0
  57. package/dist/errors.js +6 -0
  58. package/dist/index.d.ts +2 -0
  59. package/dist/index.js +147 -1354
  60. package/dist/mapping/internal-types.d.ts +54 -0
  61. package/dist/mapping/internal-types.js +14 -0
  62. package/dist/mapping/loaders/mojang.d.ts +2 -0
  63. package/dist/mapping/loaders/mojang.js +64 -0
  64. package/dist/mapping/loaders/tiny-loom.d.ts +2 -0
  65. package/dist/mapping/loaders/tiny-loom.js +73 -0
  66. package/dist/mapping/loaders/tiny-maven.d.ts +2 -0
  67. package/dist/mapping/loaders/tiny-maven.js +104 -0
  68. package/dist/mapping/loaders/types.d.ts +14 -0
  69. package/dist/mapping/loaders/types.js +2 -0
  70. package/dist/mapping/lookup.d.ts +52 -0
  71. package/dist/mapping/lookup.js +496 -0
  72. package/dist/mapping/parsers/normalize.d.ts +10 -0
  73. package/dist/mapping/parsers/normalize.js +52 -0
  74. package/dist/mapping/parsers/proguard.d.ts +20 -0
  75. package/dist/mapping/parsers/proguard.js +138 -0
  76. package/dist/mapping/parsers/symbol-records.d.ts +27 -0
  77. package/dist/mapping/parsers/symbol-records.js +216 -0
  78. package/dist/mapping/parsers/tiny.d.ts +9 -0
  79. package/dist/mapping/parsers/tiny.js +96 -0
  80. package/dist/mapping/types.d.ts +147 -0
  81. package/dist/mapping/types.js +2 -0
  82. package/dist/mapping-pipeline-service.js +3 -2
  83. package/dist/mapping-service.d.ts +8 -145
  84. package/dist/mapping-service.js +30 -1207
  85. package/dist/mixin/access-validators.d.ts +9 -0
  86. package/dist/mixin/access-validators.js +257 -0
  87. package/dist/mixin/annotation-validators.d.ts +5 -0
  88. package/dist/mixin/annotation-validators.js +162 -0
  89. package/dist/mixin/helpers.d.ts +28 -0
  90. package/dist/mixin/helpers.js +315 -0
  91. package/dist/mixin/parsed-validator.d.ts +8 -0
  92. package/dist/mixin/parsed-validator.js +337 -0
  93. package/dist/mixin/types.d.ts +208 -0
  94. package/dist/mixin/types.js +28 -0
  95. package/dist/mixin-validator.d.ts +9 -201
  96. package/dist/mixin-validator.js +8 -1020
  97. package/dist/source/access-validate.d.ts +4 -0
  98. package/dist/source/access-validate.js +254 -0
  99. package/dist/source/artifact-resolver.d.ts +111 -0
  100. package/dist/source/artifact-resolver.js +1271 -0
  101. package/dist/source/cache-metrics.d.ts +26 -0
  102. package/dist/source/cache-metrics.js +172 -0
  103. package/dist/source/class-source/members-builder.d.ts +34 -0
  104. package/dist/source/class-source/members-builder.js +46 -0
  105. package/dist/source/class-source/snippet-builder.d.ts +19 -0
  106. package/dist/source/class-source/snippet-builder.js +46 -0
  107. package/dist/source/class-source-helpers.d.ts +34 -0
  108. package/dist/source/class-source-helpers.js +140 -0
  109. package/dist/source/class-source.d.ts +42 -0
  110. package/dist/source/class-source.js +883 -0
  111. package/dist/source/descriptor-utils.d.ts +6 -0
  112. package/dist/source/descriptor-utils.js +37 -0
  113. package/dist/source/file-access.d.ts +4 -0
  114. package/dist/source/file-access.js +102 -0
  115. package/dist/source/indexer.d.ts +82 -0
  116. package/dist/source/indexer.js +522 -0
  117. package/dist/source/lifecycle/diff-utils.d.ts +9 -0
  118. package/dist/source/lifecycle/diff-utils.js +107 -0
  119. package/dist/source/lifecycle/diff.d.ts +2 -0
  120. package/dist/source/lifecycle/diff.js +265 -0
  121. package/dist/source/lifecycle/mapping-helpers.d.ts +22 -0
  122. package/dist/source/lifecycle/mapping-helpers.js +327 -0
  123. package/dist/source/lifecycle/runtime-check.d.ts +2 -0
  124. package/dist/source/lifecycle/runtime-check.js +142 -0
  125. package/dist/source/lifecycle/trace.d.ts +2 -0
  126. package/dist/source/lifecycle/trace.js +231 -0
  127. package/dist/source/lifecycle.d.ts +4 -0
  128. package/dist/source/lifecycle.js +5 -0
  129. package/dist/source/search.d.ts +51 -0
  130. package/dist/source/search.js +676 -0
  131. package/dist/source/shared-utils.d.ts +6 -0
  132. package/dist/source/shared-utils.js +55 -0
  133. package/dist/source/state.d.ts +26 -0
  134. package/dist/source/state.js +24 -0
  135. package/dist/source/symbol-resolver.d.ts +3 -0
  136. package/dist/source/symbol-resolver.js +212 -0
  137. package/dist/source/validate-mixin/pipeline/mapping-health.d.ts +3 -0
  138. package/dist/source/validate-mixin/pipeline/mapping-health.js +41 -0
  139. package/dist/source/validate-mixin/pipeline/parse.d.ts +2 -0
  140. package/dist/source/validate-mixin/pipeline/parse.js +10 -0
  141. package/dist/source/validate-mixin/pipeline/resolve.d.ts +3 -0
  142. package/dist/source/validate-mixin/pipeline/resolve.js +78 -0
  143. package/dist/source/validate-mixin/pipeline/target-lookup.d.ts +6 -0
  144. package/dist/source/validate-mixin/pipeline/target-lookup.js +260 -0
  145. package/dist/source/validate-mixin/pipeline-context.d.ts +72 -0
  146. package/dist/source/validate-mixin/pipeline-context.js +93 -0
  147. package/dist/source/validate-mixin.d.ts +22 -0
  148. package/dist/source/validate-mixin.js +799 -0
  149. package/dist/source/workspace-target.d.ts +18 -0
  150. package/dist/source/workspace-target.js +305 -0
  151. package/dist/source-resolver.d.ts +1 -0
  152. package/dist/source-resolver.js +1 -1
  153. package/dist/source-service.d.ts +164 -170
  154. package/dist/source-service.js +70 -6116
  155. package/dist/stage-emitter.d.ts +13 -0
  156. package/dist/stage-emitter.js +30 -0
  157. package/dist/stdio-supervisor.d.ts +61 -0
  158. package/dist/stdio-supervisor.js +326 -9
  159. package/dist/tool-contract-manifest.d.ts +1 -1
  160. package/dist/tool-contract-manifest.js +23 -6
  161. package/dist/tool-guidance.d.ts +82 -0
  162. package/dist/tool-guidance.js +734 -0
  163. package/dist/tool-schema-registry.d.ts +16 -0
  164. package/dist/tool-schema-registry.js +37 -0
  165. package/dist/tool-schemas.d.ts +3518 -0
  166. package/dist/tool-schemas.js +813 -0
  167. package/dist/types.d.ts +36 -0
  168. package/dist/version-service.js +7 -6
  169. package/dist/workspace-context-cache.d.ts +32 -0
  170. package/dist/workspace-context-cache.js +66 -0
  171. package/dist/workspace-mapping-service.d.ts +16 -0
  172. package/dist/workspace-mapping-service.js +173 -1
  173. package/docs/README-ja.md +416 -0
  174. package/docs/examples.md +483 -0
  175. package/docs/tool-reference.md +462 -0
  176. package/package.json +17 -4
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Internal types shared between the MappingService class and the parser
3
+ * modules under `src/mapping/parsers/`. Public mapping API types live in
4
+ * `src/mapping-service.ts`; this file is intentionally limited to types
5
+ * the parsers need to operate on indexes.
6
+ */
7
+ import type { SourceMapping } from "../types.js";
8
+ export type PairKey = `${SourceMapping}->${SourceMapping}`;
9
+ export type MappingSymbolKind = "class" | "field" | "method";
10
+ export type MappingSymbolRecord = {
11
+ kind: MappingSymbolKind;
12
+ symbol: string;
13
+ owner?: string;
14
+ name: string;
15
+ descriptor?: string;
16
+ };
17
+ export type DirectionIndex = {
18
+ exact: Map<string, Set<string>>;
19
+ normalized: Map<string, Set<string>>;
20
+ simple: Map<string, Set<string>>;
21
+ records: Map<string, MappingSymbolRecord>;
22
+ };
23
+ export type MappingLookupSource = "loom-cache" | "maven" | "mojang-client-mappings";
24
+ export type PairRecord = {
25
+ index: DirectionIndex;
26
+ source: MappingLookupSource;
27
+ mappingArtifact: string;
28
+ };
29
+ export declare const MATCH_RANK: {
30
+ readonly exact: 3;
31
+ readonly normalized: 2;
32
+ readonly "simple-name": 1;
33
+ };
34
+ export declare const DESCRIPTOR_FALLBACK_CONFIDENCE = 0.85;
35
+ export declare const MAX_CANDIDATES = 200;
36
+ export type MatchRankKey = keyof typeof MATCH_RANK;
37
+ export type GraphLoadMode = "full" | "obfuscated-mojang-only";
38
+ export type CandidateAccumulator = {
39
+ key: string;
40
+ record: MappingSymbolRecord;
41
+ matchKind: import("./types.js").MappingMatchKind;
42
+ confidence: number;
43
+ rank: number;
44
+ };
45
+ export type LoadedGraph = {
46
+ version: string;
47
+ priority: import("../types.js").MappingSourcePriority;
48
+ mode: GraphLoadMode;
49
+ pairs: Map<PairKey, PairRecord>;
50
+ adjacency: Map<import("../types.js").SourceMapping, import("../types.js").SourceMapping[]>;
51
+ pathCache: Map<PairKey, import("../types.js").SourceMapping[] | undefined>;
52
+ recordsByTarget: Map<import("../types.js").SourceMapping, MappingSymbolRecord[]>;
53
+ warnings: string[];
54
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Internal types shared between the MappingService class and the parser
3
+ * modules under `src/mapping/parsers/`. Public mapping API types live in
4
+ * `src/mapping-service.ts`; this file is intentionally limited to types
5
+ * the parsers need to operate on indexes.
6
+ */
7
+ export const MATCH_RANK = {
8
+ exact: 3,
9
+ normalized: 2,
10
+ "simple-name": 1
11
+ };
12
+ export const DESCRIPTOR_FALLBACK_CONFIDENCE = 0.85;
13
+ export const MAX_CANDIDATES = 200;
14
+ //# sourceMappingURL=internal-types.js.map
@@ -0,0 +1,2 @@
1
+ import type { MappingLoaderDeps, MappingLoaderResult } from "./types.js";
2
+ export declare function loadMojangPairs(deps: MappingLoaderDeps, version: string): Promise<MappingLoaderResult>;
@@ -0,0 +1,64 @@
1
+ import { existsSync } from "node:fs";
2
+ import { mkdir, readFile } from "node:fs/promises";
3
+ import { dirname, join } from "node:path";
4
+ import { downloadToCache } from "../../repo-downloader.js";
5
+ import { parseClientMappings } from "../parsers/proguard.js";
6
+ export async function loadMojangPairs(deps, version) {
7
+ const warnings = [];
8
+ let metadata;
9
+ try {
10
+ metadata = await deps.versionService.resolveVersionMappings(version);
11
+ }
12
+ catch (caughtError) {
13
+ return {
14
+ pairs: new Map(),
15
+ warnings: [
16
+ `Failed to resolve version metadata for "${version}": ${caughtError instanceof Error ? caughtError.message : String(caughtError)}`
17
+ ],
18
+ mappingArtifact: `version:${version}`
19
+ };
20
+ }
21
+ const clientMappingsUrl = metadata.clientMappingsUrl ?? metadata.mappingsUrl;
22
+ if (!clientMappingsUrl) {
23
+ warnings.push(`Minecraft version "${version}" does not expose client mappings URL.`);
24
+ return {
25
+ pairs: new Map(),
26
+ warnings,
27
+ mappingArtifact: metadata.versionDetailUrl
28
+ };
29
+ }
30
+ const mappingsPath = join(deps.config.cacheDir, "mappings", version, "client_mappings.txt");
31
+ if (!existsSync(mappingsPath)) {
32
+ await mkdir(dirname(mappingsPath), { recursive: true });
33
+ const downloaded = await downloadToCache(clientMappingsUrl, mappingsPath, {
34
+ fetchFn: deps.fetchFn,
35
+ retries: deps.config.fetchRetries,
36
+ timeoutMs: deps.config.fetchTimeoutMs
37
+ });
38
+ if (!downloaded.ok || !downloaded.path) {
39
+ warnings.push(`Failed to download client mappings from "${clientMappingsUrl}" (status: ${downloaded.statusCode ?? "unknown"}).`);
40
+ return {
41
+ pairs: new Map(),
42
+ warnings,
43
+ mappingArtifact: clientMappingsUrl
44
+ };
45
+ }
46
+ }
47
+ try {
48
+ const content = await readFile(mappingsPath, "utf8");
49
+ return {
50
+ pairs: parseClientMappings(content),
51
+ warnings,
52
+ mappingArtifact: clientMappingsUrl
53
+ };
54
+ }
55
+ catch (caughtError) {
56
+ warnings.push(`Failed to parse client mappings for "${version}": ${caughtError instanceof Error ? caughtError.message : String(caughtError)}`);
57
+ return {
58
+ pairs: new Map(),
59
+ warnings,
60
+ mappingArtifact: clientMappingsUrl
61
+ };
62
+ }
63
+ }
64
+ //# sourceMappingURL=mojang.js.map
@@ -0,0 +1,2 @@
1
+ import type { MappingLoaderResult } from "./types.js";
2
+ export declare function loadTinyPairsFromLoom(version: string, projectPath?: string): Promise<MappingLoaderResult>;
@@ -0,0 +1,73 @@
1
+ import { existsSync } from "node:fs";
2
+ import { readFile } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import fastGlob from "fast-glob";
5
+ import { buildVersionSourceSearchRoots } from "../../gradle-paths.js";
6
+ import { effectiveLoomSearchProjectPath } from "../lookup.js";
7
+ import { mergeDirectionIndexes } from "../parsers/symbol-records.js";
8
+ import { parseTinyMappings } from "../parsers/tiny.js";
9
+ const GLOB_SPECIAL_CHARS = /[\\!*+?()[\]{}@|]/g;
10
+ export async function loadTinyPairsFromLoom(version, projectPath) {
11
+ const searchRoots = buildVersionSourceSearchRoots(effectiveLoomSearchProjectPath(projectPath));
12
+ const merged = new Map();
13
+ const discoveredPaths = new Set();
14
+ for (const root of searchRoots) {
15
+ let discovered = [];
16
+ const versionRoot = join(root, version);
17
+ try {
18
+ discovered = existsSync(versionRoot)
19
+ ? await fastGlob.glob(["**/*.tiny", "**/*.tinyv2"], {
20
+ cwd: versionRoot,
21
+ absolute: true,
22
+ onlyFiles: true
23
+ })
24
+ : await fastGlob.glob([`${version.replace(GLOB_SPECIAL_CHARS, "\\$&")}/**/*.tiny`, `${version.replace(GLOB_SPECIAL_CHARS, "\\$&")}/**/*.tinyv2`], {
25
+ cwd: root,
26
+ absolute: true,
27
+ onlyFiles: true
28
+ });
29
+ }
30
+ catch {
31
+ continue;
32
+ }
33
+ const byVersion = discovered
34
+ .filter((path) => path.replaceAll("\\", "/").includes(`/${version}/`))
35
+ .sort((left, right) => left.localeCompare(right));
36
+ if (byVersion.length === 0) {
37
+ continue;
38
+ }
39
+ for (const path of byVersion) {
40
+ discoveredPaths.add(path);
41
+ try {
42
+ const content = await readFile(path, "utf8");
43
+ const parsed = parseTinyMappings(content);
44
+ for (const [key, index] of parsed.entries()) {
45
+ const existing = merged.get(key);
46
+ if (!existing) {
47
+ merged.set(key, index);
48
+ }
49
+ else {
50
+ mergeDirectionIndexes(existing, index);
51
+ }
52
+ }
53
+ }
54
+ catch {
55
+ // best effort: skip unreadable or invalid files
56
+ }
57
+ }
58
+ }
59
+ const orderedPaths = [...discoveredPaths].sort((left, right) => left.localeCompare(right));
60
+ if (orderedPaths.length > 0) {
61
+ return {
62
+ pairs: merged,
63
+ warnings: [],
64
+ mappingArtifact: orderedPaths[0]
65
+ };
66
+ }
67
+ return {
68
+ pairs: new Map(),
69
+ warnings: [`No Loom tiny mapping files matched version "${version}".`],
70
+ mappingArtifact: "loom-cache:none"
71
+ };
72
+ }
73
+ //# sourceMappingURL=tiny-loom.js.map
@@ -0,0 +1,2 @@
1
+ import type { MappingLoaderDeps, MappingLoaderResult } from "./types.js";
2
+ export declare function loadTinyPairsFromMaven(deps: MappingLoaderDeps, version: string): Promise<MappingLoaderResult>;
@@ -0,0 +1,104 @@
1
+ import { defaultDownloadPath, downloadToCache } from "../../repo-downloader.js";
2
+ import { collectMatchedJarEntriesAsUtf8 } from "../../source-jar-reader.js";
3
+ import { mergeDirectionIndexes } from "../parsers/symbol-records.js";
4
+ import { parseTinyMappings } from "../parsers/tiny.js";
5
+ async function fetchYarnCoordinates(fetchFn, repoBase, version) {
6
+ const metadataUrl = `${repoBase}/net/fabricmc/yarn/maven-metadata.xml`;
7
+ try {
8
+ const response = await fetchFn(metadataUrl);
9
+ if (!response.ok) {
10
+ return [];
11
+ }
12
+ const xml = await response.text();
13
+ const versions = [...xml.matchAll(/<version>([^<]+)<\/version>/g)]
14
+ .map((match) => match[1]?.trim() ?? "")
15
+ .filter((value) => value.startsWith(`${version}+build.`));
16
+ const sorted = versions.sort((left, right) => {
17
+ const leftBuild = Number.parseInt(left.split("+build.")[1] ?? "0", 10);
18
+ const rightBuild = Number.parseInt(right.split("+build.")[1] ?? "0", 10);
19
+ return rightBuild - leftBuild;
20
+ });
21
+ if (sorted.length > 0) {
22
+ return sorted.slice(0, 3);
23
+ }
24
+ return [version];
25
+ }
26
+ catch {
27
+ return [version];
28
+ }
29
+ }
30
+ async function parseTinyFromJar(jarPath) {
31
+ const tinyEntries = (await collectMatchedJarEntriesAsUtf8(jarPath, (entry) => entry.toLowerCase().endsWith(".tiny") || entry.toLowerCase().endsWith(".tinyv2"), { continueOnError: true })).sort((left, right) => left.filePath.localeCompare(right.filePath));
32
+ const merged = new Map();
33
+ for (const entry of tinyEntries) {
34
+ try {
35
+ const parsed = parseTinyMappings(entry.content);
36
+ for (const [key, index] of parsed.entries()) {
37
+ const existing = merged.get(key);
38
+ if (!existing) {
39
+ merged.set(key, index);
40
+ }
41
+ else {
42
+ mergeDirectionIndexes(existing, index);
43
+ }
44
+ }
45
+ }
46
+ catch {
47
+ // skip malformed tiny entries
48
+ }
49
+ }
50
+ return merged;
51
+ }
52
+ export async function loadTinyPairsFromMaven(deps, version) {
53
+ const warnings = [];
54
+ const merged = new Map();
55
+ const repos = deps.config.sourceRepos;
56
+ const intermediaryUrls = [];
57
+ const yarnUrls = [];
58
+ const repoBases = repos.map((repo) => repo.replace(/\/+$/, ""));
59
+ const yarnCoordinatesByRepo = await Promise.all(repoBases.map(async (base) => ({
60
+ base,
61
+ yarnCoordinates: await fetchYarnCoordinates(deps.fetchFn, base, version)
62
+ })));
63
+ for (const { base, yarnCoordinates } of yarnCoordinatesByRepo) {
64
+ intermediaryUrls.push(`${base}/net/fabricmc/intermediary/${version}/intermediary-${version}-v2.jar`, `${base}/net/fabricmc/intermediary/${version}/intermediary-${version}.jar`);
65
+ for (const coordinate of yarnCoordinates) {
66
+ yarnUrls.push(`${base}/net/fabricmc/yarn/${coordinate}/yarn-${coordinate}-v2.jar`, `${base}/net/fabricmc/yarn/${coordinate}/yarn-${coordinate}.jar`);
67
+ }
68
+ }
69
+ const allUrls = [...intermediaryUrls, ...yarnUrls];
70
+ const parsedResults = await Promise.allSettled(allUrls.map(async (url) => {
71
+ const downloaded = await downloadToCache(url, defaultDownloadPath(deps.config.cacheDir, url), {
72
+ fetchFn: deps.fetchFn,
73
+ retries: deps.config.fetchRetries,
74
+ timeoutMs: deps.config.fetchTimeoutMs
75
+ });
76
+ if (!downloaded.ok || !downloaded.path) {
77
+ return undefined;
78
+ }
79
+ return parseTinyFromJar(downloaded.path);
80
+ }));
81
+ for (const result of parsedResults) {
82
+ if (result.status !== "fulfilled" || !result.value) {
83
+ continue;
84
+ }
85
+ for (const [key, index] of result.value.entries()) {
86
+ const existing = merged.get(key);
87
+ if (!existing) {
88
+ merged.set(key, index);
89
+ }
90
+ else {
91
+ mergeDirectionIndexes(existing, index);
92
+ }
93
+ }
94
+ }
95
+ if (merged.size === 0) {
96
+ warnings.push(`No Maven tiny mappings could be loaded for "${version}".`);
97
+ }
98
+ return {
99
+ pairs: merged,
100
+ warnings,
101
+ mappingArtifact: allUrls[0] ?? "maven:none"
102
+ };
103
+ }
104
+ //# sourceMappingURL=tiny-maven.js.map
@@ -0,0 +1,14 @@
1
+ import type { Config } from "../../types.js";
2
+ import type { VersionService } from "../../version-service.js";
3
+ import type { DirectionIndex, PairKey } from "../internal-types.js";
4
+ export type VersionMappingsResolver = Pick<VersionService, "resolveVersionMappings">;
5
+ export type MappingLoaderDeps = {
6
+ config: Config;
7
+ fetchFn: typeof fetch;
8
+ versionService: VersionMappingsResolver;
9
+ };
10
+ export type MappingLoaderResult = {
11
+ pairs: Map<PairKey, DirectionIndex>;
12
+ warnings: string[];
13
+ mappingArtifact: string;
14
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,52 @@
1
+ import type { MappingSourcePriority, SourceMapping } from "../types.js";
2
+ import type { CandidateAccumulator, DirectionIndex, LoadedGraph, MappingLookupSource, MappingSymbolRecord, MatchRankKey, PairKey, PairRecord } from "./internal-types.js";
3
+ import { MAX_CANDIDATES } from "./internal-types.js";
4
+ import type { ClassApiMatrixKind, DescriptorProjection, MappingLookupCandidate, ResolutionCandidate, SymbolQueryInput, SymbolReference } from "./types.js";
5
+ export type { DescriptorProjection };
6
+ export { MAX_CANDIDATES };
7
+ export declare function addCandidates(target: Map<string, CandidateAccumulator>, index: DirectionIndex, symbols: Set<string> | undefined, kind: MatchRankKey, confidence: number): void;
8
+ export declare function lookupCandidates(index: DirectionIndex, query: MappingSymbolRecord): MappingLookupCandidate[];
9
+ export declare function mappingPriorityFromInput(configPriority: MappingSourcePriority, override: MappingSourcePriority | undefined): MappingSourcePriority;
10
+ export declare function mappingSourceOrder(priority: MappingSourcePriority): Array<"loom-cache" | "maven">;
11
+ export declare function requiresOnlyObfuscatedMojangGraph(sourceMapping: SourceMapping, targetMapping?: SourceMapping): boolean;
12
+ export declare function namespacePath(graph: LoadedGraph, sourceMapping: SourceMapping, targetMapping: SourceMapping): SourceMapping[] | undefined;
13
+ export declare function pathUsesSource(pairs: Map<PairKey, PairRecord>, path: SourceMapping[], source: MappingLookupSource): boolean;
14
+ export declare function pathToTransformChain(path: SourceMapping[]): string[];
15
+ export declare function toLookupCandidate(record: MappingSymbolRecord): MappingLookupCandidate;
16
+ export declare function toSymbolReference(record: MappingSymbolRecord): SymbolReference;
17
+ export declare function toResolutionCandidate(candidate: MappingLookupCandidate): SymbolReference & Pick<MappingLookupCandidate, "matchKind" | "confidence">;
18
+ export declare function invalidInputError(message: string, details: Record<string, unknown>): import("../errors.js").AppError;
19
+ export declare function normalizeMemberName(name: string): string;
20
+ /**
21
+ * Validate a JVM method descriptor such as `(I)V`, `()Lfoo/Bar;`, `(Lfoo/Bar;[I)V`.
22
+ * Rejects empty strings, missing/mis-positioned parens, empty return type, and invalid base
23
+ * type tokens so "(" or "()" style half-descriptors surface as ERR_INVALID_INPUT instead of
24
+ * being silently accepted.
25
+ */
26
+ export declare function normalizeMethodDescriptor(descriptor: string | undefined): string;
27
+ export declare function isValidMethodDescriptor(descriptor: string): boolean;
28
+ export declare function consumeFieldType(descriptor: string, position: number, allowVoid: boolean): number;
29
+ export declare function normalizeQuerySymbol(input: SymbolQueryInput, signatureMode?: "exact" | "name-only", options?: {
30
+ allowShortClassName?: boolean;
31
+ }): {
32
+ record: MappingSymbolRecord;
33
+ querySymbol: SymbolReference;
34
+ };
35
+ export declare function normalizeOwnerHint(ownerHint: string | undefined): string | undefined;
36
+ export declare function normalizeDescriptorHint(descriptorHint: string | undefined): string | undefined;
37
+ export declare function applyDisambiguationHints(candidates: MappingLookupCandidate[], disambiguation: {
38
+ ownerHint?: string;
39
+ descriptorHint?: string;
40
+ } | undefined): MappingLookupCandidate[];
41
+ export declare function projectLookupCandidateDescriptor(candidate: MappingLookupCandidate, sourceDescriptor: string, targetDescriptor: string | undefined): MappingLookupCandidate;
42
+ export declare function effectiveLoomSearchProjectPath(projectPath: string | undefined): string | undefined;
43
+ export declare function collectTargetRecords(graph: LoadedGraph, targetMapping: SourceMapping): MappingSymbolRecord[];
44
+ export declare function normalizeIncludedKinds(inputKinds: ClassApiMatrixKind[] | undefined): Set<ClassApiMatrixKind>;
45
+ export declare function inferAmbiguityReasons(candidates: ResolutionCandidate[], usedMojangClientMappings: boolean): string[];
46
+ export declare function clampCandidateLimit(limit: number | undefined): number;
47
+ export declare function limitResolutionCandidates(candidates: ResolutionCandidate[], requestedLimit: number | undefined): {
48
+ candidates: ResolutionCandidate[];
49
+ candidateCount: number;
50
+ candidatesTruncated?: boolean;
51
+ };
52
+ export declare function clampRowLimit(limit: number | undefined): number | undefined;