fix(javascript): align module lookup and source evidence

Preserve CommonJS literal paths and confined ESM URL semantics, including package main fallback, directory intent, Unicode identity, and present opaque modules. Parse extraction inputs at their AST/source owner, retain skipped HTML and source-map coverage, and distinguish endpoint candidates from proven receiver facts. Version structural fingerprints with computed literal contents and propagate them through worker contracts.

Reviewed fixes include #1810, #1840, #2642, #2700, #2702, #2714, #2803, #2960, #2968, #2986, #3035, and #3036.

Validation: 158 resolver tests passed; public CLI/MCP module lookup controls, package-main/Unicode workflows, and six builtin workflows passed in the current compiled lane. Worker schema/fingerprint regressions passed. Large public pdf.js completion and real Electron analysis remain unverified.
This commit is contained in:
morluto committed 2026-10-14 08:46:50 +08:00
1 parent 04672f2b91
commit b58adafa4f
63 files changed
+4066 -326

No files matched your search

@@ -1,3 +1,6 @@
import { execFile } from "node:child_process";
import { promisify } from "node:util";
import { expect } from "vitest";
import { z } from "zod";
@@ -5,6 +8,19 @@ import { javascriptApplicationAnalysisResultSchema } from "../../../src/domain/j
import { connectLocalToolsMcp } from "../../fixtures/localToolsMcp.js";
import type { TestCli } from "./cliFixture.js";
const execute = promisify(execFile);
export const runNodeJsonControl = async (
root: string,
filename: string,
): Promise<unknown> => {
const { stdout } = await execute(process.execPath, [filename], {
cwd: root,
timeout: 5_000,
});
return JSON.parse(stdout) as unknown;
};
/** Analyze a directory through a public adapter and validate its result contract. */
export const analyzeJavaScriptDirectory = async (
surface: "CLI" | "stdio MCP",