Files
rea/src/application/WebModulePorts.ts
T
ysopwnable f430c416c7 feat(browser): trace captured website source-map locations (#897)
* refactor(browser): share captured-script acquisition boundaries

Reuse stable capture/source acquisition and identity validation for module
and source-map analysis. Preserve host I/O, malformed input, unavailable
source and digest mismatch diagnostics.

Refs #851

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)

* feat(browser): trace captured website source-map locations

Refs #851. Preserve selected capture/map byte identity, duplicate mappings and embedded source evidence through the pinned upstream codec.

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)

* test(browser): verify source-map artifacts and synchronize generated contracts

Cover byte-preserving map reads and actionable filesystem constraints. Refresh generated public schemas and metadata on current main.

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)

* fix(browser): preserve inert source-map URL context

The selected URL is local codec context and grants no transport authority. Preserve its reported text and verify normal/userinfo contexts through real public interfaces, alongside independent manifest byte identity.

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
2026-10-07 16:21:18 +08:00

53 lines
1.8 KiB
TypeScript

import type { AnalysisError } from "../domain/analysisErrorBase.js";
import type { JsonValue } from "../domain/jsonValue.js";
import type { Result } from "../domain/result.js";
import type {
WebModuleFile,
WebModuleResolution,
WebModuleTraceInput,
} from "../domain/webModuleTrace.js";
import type { SelectedWebScriptArtifacts } from "../domain/webScriptArtifacts.js";
import type { ExecutionOptions } from "./AnalysisProvider.js";
type JsonObject = Record<string, JsonValue>;
/** Verified selected source and capture metadata; provider protocols stay outside. */
export interface WebModuleArtifacts extends SelectedWebScriptArtifacts {
readonly importMap: {
readonly file: WebModuleFile;
readonly baseUrl: string;
readonly value: JsonObject;
} | null;
}
/** Read selected local artifacts without refetching website assets. */
export interface WebModuleArtifactPort {
load(
input: WebModuleTraceInput,
options?: ExecutionOptions,
): Promise<Result<WebModuleArtifacts, AnalysisError>>;
}
/** Resolve literal specifiers in a selected URL/map context without executing the selected application. */
export interface WebModuleResolutionBatch {
readonly engine: { readonly id: string; readonly version: string };
readonly resolutions: readonly WebModuleResolution[];
readonly diagnostics: readonly string[];
readonly rawResult: JsonObject;
}
/** Replaceable native resolution engine, with no provider protocol in callers. */
export interface WebModuleResolutionPort {
resolve(
input: {
readonly importerUrl: string;
readonly importMap: {
readonly baseUrl: string;
readonly value: JsonObject;
} | null;
readonly specifiers: readonly string[];
},
options?: ExecutionOptions,
): Promise<Result<WebModuleResolutionBatch, AnalysisError>>;
}