Files
rea/tests/fixtures/strippedAsarAddon.ts
T
记得吃中饭 9c14999efd feat(ghidra): support raw NMOS 6502 analysis (#2079)
* feat(ghidra): admit raw NMOS 6502 analysis

* test(ghidra): require verified POSIX verifier cleanup

* test(ghidra): verify 6502 low-memory raw imports

* docs(skill): document raw NMOS 6502 support

* fix(ghidra): preserve requested Windows raw source paths

* docs(ghidra): include raw 6502 in Windows installation scope

* test(ghidra): verify Windows raw junction rejection through CLI and MCP

* fix(validation): make fixtures portable and preserve explicit Codex home

* fix(ghidra): attest raw mapping state and address space

* fix(ghidra): align diagnostics and regression groups

* fix(ghidra): bind raw attestation to language address space

* chore(ghidra): avoid verifier insertion conflict

* docs(ghidra): align linked raw admission guides

* fix(ghidra): retain 6502 verifier workspace on failure

* test(ghidra): isolate Windows authority doctor fixture

* fix(binary): re-admit Windows raw paths on session reopen

* test(binary): require fresh provider execution after path change

* Constrain 6502 to raw lifecycle and snapshot targets

* Bypass saved reads for unadmitted Windows paths

* Guard direct CLI snapshot replay on Windows paths

* fix(snapshot): gate Windows Ghidra replay on native admission

* fix(snapshot): constrain nested 6502 subjects to raw images

* test: make dyld slice fixtures portable
2026-10-13 21:13:01 +08:00

39 lines
1.5 KiB
TypeScript

import { mkdir, writeFile } from "node:fs/promises";
import { dirname, join } from "node:path";
import { createPackageWithOptions } from "@electron/asar";
import { createTestTempDirectory } from "./temporaryDirectory.js";
interface AdditionalAsarFile {
readonly path: string;
readonly contents: string;
}
/** Create an Electron ASAR, then model a distro-stripped unpacked native addon. */
export const createStrippedAsarAddon = async (
additionalFiles: readonly AdditionalAsarFile[] = [],
) => {
const root = await createTestTempDirectory("rea-stripped-asar-addon-");
const source = join(root, "source");
const archive = join(root, "app.asar");
const addon = "node_modules/btime/binding.node";
const addonPath = join(source, "node_modules", "btime", "binding.node");
const original = Buffer.from("upstream native addon bytes");
const stripped = Buffer.from("stripped native addon");
await mkdir(join(source, "node_modules", "btime"), { recursive: true });
await writeFile(join(source, "main.js"), "module.exports = 'observed';\n");
await writeFile(addonPath, original);
for (const file of additionalFiles) {
const path = join(source, file.path);
await mkdir(dirname(path), { recursive: true });
await writeFile(path, file.contents);
}
await createPackageWithOptions(source, archive, { unpack: "*.node" });
await writeFile(
join(`${archive}.unpacked`, "node_modules", "btime", "binding.node"),
stripped,
);
return { root, archive, addon, original, stripped };
};