fix(parsers): preserve format boundaries and query occurrence identity

Normalize parsed facts at their owning boundaries across PE exports and certificates, ELF section names, GPU bundles, IL2CPP generic types, dyld slice selection, source maps, environment replay, and JavaScript mapped arguments. Preserve partial facts and explicit unsupported cases; clarify the corresponding documentation.

Validation: 831 affected tests passed with one existing skip across 23 files; build, typecheck/lint, documentation, formatting, and 2133-file test discovery passed. Format controls are synthetic; real Unity, GPU, and ARM-device execution is unverified.

Fixes #6709
Fixes #6688
Fixes #6719
Fixes #6718
Fixes #6704
Fixes #6703
Fixes #6692
Fixes #6723
Fixes #6687
Fixes #6726
Fixes #6696
Fixes #6691
Fixes #6727
This commit is contained in:
morluto
2026-10-23 22:01:16 +08:00
parent 4193bc5bf8
commit 5f702dd6cc
60 changed files with 2069 additions and 211 deletions
@@ -54,35 +54,44 @@ export const resolveJavaScriptSourceMapReferences = (
});
};
/** Resolve a source declaration using the same pinned format implementation as map consumers. */
/** Resolve one source declaration with ECMA-426's WHATWG URL parsing rule. */
export const resolveJavaScriptSourceMapUrl = (
source: string | null,
sourceRoot: string | null | undefined,
mapUrl: string,
): string | null => {
if (source === null) return null;
return (
URL.parse(sourceMapReference(source, sourceRoot), mapUrl)?.href ?? null
);
};
const sourceMapReference = (
source: string,
sourceRoot: string | null | undefined,
): string => {
const resolved = resolveSourceMapUrls([source ?? ""], sourceRoot, mapUrl)[0];
if (resolved === undefined)
throw new TypeError(
"TraceMap did not resolve its single source declaration",
);
return resolved;
if (sourceRoot == null) return source;
return `${sourceRoot}${sourceRoot.endsWith("/") ? "" : "/"}${source}`;
};
const resolveSourceMapUrls = (
sources: string[],
sourceRoot: string | null | undefined,
mapUrl: string,
): readonly string[] =>
new TraceMap(
): readonly string[] => {
// ECMA-426 prefixes each source when sourceRoot is non-null, adding `/`
// only when the root does not already end with one. Do this before handing
// the references to TraceMap so its URL resolver cannot duplicate a slash.
return new TraceMap(
{
version: 3,
names: [],
sources,
...(sourceRoot == null ? {} : { sourceRoot }),
sources: sources.map((source) => sourceMapReference(source, sourceRoot)),
mappings: "",
},
mapUrl,
).resolvedSources;
};
/** Resolve a source-map URL reference without changing its recorded identity. */
const resolveJavaScriptSourceMapPath = (