@adhisang/minecraft-modding-mcp 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/README.md +36 -23
- package/dist/build-suggested-call.d.ts +29 -0
- package/dist/build-suggested-call.js +58 -0
- package/dist/cache-registry.d.ts +3 -1
- package/dist/cache-registry.js +50 -6
- package/dist/entry-tools/analyze-symbol-service.d.ts +16 -16
- package/dist/entry-tools/batch-class-members-service.d.ts +34 -0
- package/dist/entry-tools/batch-class-members-service.js +97 -0
- package/dist/entry-tools/batch-class-source-service.d.ts +37 -0
- package/dist/entry-tools/batch-class-source-service.js +100 -0
- package/dist/entry-tools/batch-mappings-service.d.ts +36 -0
- package/dist/entry-tools/batch-mappings-service.js +66 -0
- package/dist/entry-tools/batch-runner.d.ts +72 -0
- package/dist/entry-tools/batch-runner.js +90 -0
- package/dist/entry-tools/batch-symbol-exists-service.d.ts +46 -0
- package/dist/entry-tools/batch-symbol-exists-service.js +113 -0
- package/dist/entry-tools/compare-minecraft-service.d.ts +6 -6
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +83 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +80 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +248 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +60 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.js +54 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +100 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.js +155 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.js +49 -0
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +1042 -0
- package/dist/entry-tools/inspect-minecraft/internal.js +448 -0
- package/dist/entry-tools/inspect-minecraft-service.d.ts +193 -308
- package/dist/entry-tools/inspect-minecraft-service.js +20 -1244
- package/dist/entry-tools/manage-cache-service.d.ts +16 -16
- package/dist/entry-tools/validate-project/cases/access-transformer.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-transformer.js +106 -0
- package/dist/entry-tools/validate-project/cases/access-widener.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-widener.js +86 -0
- package/dist/entry-tools/validate-project/cases/mixin.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/mixin.js +90 -0
- package/dist/entry-tools/validate-project/cases/project-summary.d.ts +97 -0
- package/dist/entry-tools/validate-project/cases/project-summary.js +346 -0
- package/dist/entry-tools/validate-project/internal.d.ts +135 -0
- package/dist/entry-tools/validate-project/internal.js +287 -0
- package/dist/entry-tools/validate-project-service.d.ts +63 -47
- package/dist/entry-tools/validate-project-service.js +12 -562
- package/dist/entry-tools/verify-mixin-target-service.d.ts +133 -0
- package/dist/entry-tools/verify-mixin-target-service.js +323 -0
- package/dist/error-mapping.d.ts +40 -0
- package/dist/error-mapping.js +139 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +142 -1352
- package/dist/mapping/internal-types.d.ts +54 -0
- package/dist/mapping/internal-types.js +14 -0
- package/dist/mapping/loaders/mojang.d.ts +2 -0
- package/dist/mapping/loaders/mojang.js +64 -0
- package/dist/mapping/loaders/tiny-loom.d.ts +2 -0
- package/dist/mapping/loaders/tiny-loom.js +73 -0
- package/dist/mapping/loaders/tiny-maven.d.ts +2 -0
- package/dist/mapping/loaders/tiny-maven.js +104 -0
- package/dist/mapping/loaders/types.d.ts +14 -0
- package/dist/mapping/loaders/types.js +2 -0
- package/dist/mapping/lookup.d.ts +52 -0
- package/dist/mapping/lookup.js +496 -0
- package/dist/mapping/parsers/normalize.d.ts +10 -0
- package/dist/mapping/parsers/normalize.js +52 -0
- package/dist/mapping/parsers/proguard.d.ts +20 -0
- package/dist/mapping/parsers/proguard.js +138 -0
- package/dist/mapping/parsers/symbol-records.d.ts +27 -0
- package/dist/mapping/parsers/symbol-records.js +216 -0
- package/dist/mapping/parsers/tiny.d.ts +9 -0
- package/dist/mapping/parsers/tiny.js +96 -0
- package/dist/mapping/types.d.ts +147 -0
- package/dist/mapping/types.js +2 -0
- package/dist/mapping-pipeline-service.js +3 -2
- package/dist/mapping-service.d.ts +3 -144
- package/dist/mapping-service.js +19 -1201
- package/dist/mixin/access-validators.d.ts +9 -0
- package/dist/mixin/access-validators.js +257 -0
- package/dist/mixin/annotation-validators.d.ts +5 -0
- package/dist/mixin/annotation-validators.js +162 -0
- package/dist/mixin/helpers.d.ts +28 -0
- package/dist/mixin/helpers.js +315 -0
- package/dist/mixin/parsed-validator.d.ts +8 -0
- package/dist/mixin/parsed-validator.js +337 -0
- package/dist/mixin/types.d.ts +208 -0
- package/dist/mixin/types.js +28 -0
- package/dist/mixin-validator.d.ts +9 -201
- package/dist/mixin-validator.js +8 -1020
- package/dist/source/access-validate.d.ts +4 -0
- package/dist/source/access-validate.js +254 -0
- package/dist/source/artifact-resolver.d.ts +110 -0
- package/dist/source/artifact-resolver.js +1174 -0
- package/dist/source/cache-metrics.d.ts +26 -0
- package/dist/source/cache-metrics.js +172 -0
- package/dist/source/class-source/members-builder.d.ts +34 -0
- package/dist/source/class-source/members-builder.js +46 -0
- package/dist/source/class-source/snippet-builder.d.ts +19 -0
- package/dist/source/class-source/snippet-builder.js +46 -0
- package/dist/source/class-source-helpers.d.ts +34 -0
- package/dist/source/class-source-helpers.js +140 -0
- package/dist/source/class-source.d.ts +42 -0
- package/dist/source/class-source.js +883 -0
- package/dist/source/descriptor-utils.d.ts +6 -0
- package/dist/source/descriptor-utils.js +37 -0
- package/dist/source/file-access.d.ts +4 -0
- package/dist/source/file-access.js +102 -0
- package/dist/source/indexer.d.ts +82 -0
- package/dist/source/indexer.js +505 -0
- package/dist/source/lifecycle/diff-utils.d.ts +9 -0
- package/dist/source/lifecycle/diff-utils.js +107 -0
- package/dist/source/lifecycle/diff.d.ts +2 -0
- package/dist/source/lifecycle/diff.js +265 -0
- package/dist/source/lifecycle/mapping-helpers.d.ts +22 -0
- package/dist/source/lifecycle/mapping-helpers.js +327 -0
- package/dist/source/lifecycle/runtime-check.d.ts +2 -0
- package/dist/source/lifecycle/runtime-check.js +142 -0
- package/dist/source/lifecycle/trace.d.ts +2 -0
- package/dist/source/lifecycle/trace.js +231 -0
- package/dist/source/lifecycle.d.ts +4 -0
- package/dist/source/lifecycle.js +5 -0
- package/dist/source/search.d.ts +51 -0
- package/dist/source/search.js +676 -0
- package/dist/source/shared-utils.d.ts +6 -0
- package/dist/source/shared-utils.js +55 -0
- package/dist/source/state.d.ts +21 -0
- package/dist/source/state.js +19 -0
- package/dist/source/symbol-resolver.d.ts +3 -0
- package/dist/source/symbol-resolver.js +212 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.js +41 -0
- package/dist/source/validate-mixin/pipeline/parse.d.ts +2 -0
- package/dist/source/validate-mixin/pipeline/parse.js +10 -0
- package/dist/source/validate-mixin/pipeline/resolve.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/resolve.js +78 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.d.ts +6 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.js +260 -0
- package/dist/source/validate-mixin/pipeline-context.d.ts +72 -0
- package/dist/source/validate-mixin/pipeline-context.js +93 -0
- package/dist/source/validate-mixin.d.ts +22 -0
- package/dist/source/validate-mixin.js +799 -0
- package/dist/source/workspace-target.d.ts +18 -0
- package/dist/source/workspace-target.js +305 -0
- package/dist/source-service.d.ts +147 -170
- package/dist/source-service.js +67 -6116
- package/dist/stage-emitter.d.ts +13 -0
- package/dist/stage-emitter.js +30 -0
- package/dist/stdio-supervisor.d.ts +61 -0
- package/dist/stdio-supervisor.js +326 -9
- package/dist/tool-contract-manifest.d.ts +1 -1
- package/dist/tool-contract-manifest.js +23 -6
- package/dist/tool-guidance.d.ts +82 -0
- package/dist/tool-guidance.js +734 -0
- package/dist/tool-schema-registry.d.ts +16 -0
- package/dist/tool-schema-registry.js +37 -0
- package/dist/tool-schemas.d.ts +3518 -0
- package/dist/tool-schemas.js +813 -0
- package/dist/types.d.ts +36 -0
- package/dist/version-service.js +7 -6
- package/dist/workspace-context-cache.d.ts +32 -0
- package/dist/workspace-context-cache.js +66 -0
- package/dist/workspace-mapping-service.d.ts +16 -0
- package/dist/workspace-mapping-service.js +173 -1
- package/docs/README-ja.md +414 -0
- package/docs/examples.md +483 -0
- package/docs/tool-reference.md +459 -0
- package/package.json +3 -2
|
@@ -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,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,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,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,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;
|