Files
rea/tests/fixtures/javascriptSourceSelection.ts
T
85c1d2587a feat(javascript): analyze selected application sources
Analyze exact selected sources in first-request order before unrelated
static scopes, preserving full artifact identity and byte verification.
Retain selection in CLI/MCP Evidence and summaries, with explicit unknowns
and partial coverage for unselected sources. Keep default full analysis.

Fixes #1848

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
2026-10-12 04:07:14 +08:00

25 lines
895 B
TypeScript

import { writeFile } from "node:fs/promises";
import { join } from "node:path";
/** Selected entry sources with unrelated malformed text and source-map inputs. */
export const writeJavaScriptSourceSelectionFixture = async (root: string) => {
const sources = new Map<string, Buffer>([
[
"main.mjs",
Buffer.from(
'import "./vendor.js"; export function selected(value) { return value + 1; } throw new Error("must never execute");\n',
),
],
[
"package.json",
Buffer.from('{"name":"rea-selected-source-fixture","main":"main.mjs"}\n'),
],
["vendor.js", Buffer.from("export const unrelated = ;\n")],
["invalid.mjs", Buffer.from([0xff, 0xfe, 0x80])],
["broken.json", Buffer.from("{")],
["main.mjs.map", Buffer.from("{")],
]);
for (const [path, bytes] of sources) await writeFile(join(root, path), bytes);
return sources;
};