mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-17 05:09:24 +08:00
- CLI: the core verb becomes `scriptc build --lib --profile <p.json>` (no positional; profile names the entry); artifact renames to <name>.lib.a with .lib.ll/.lib.c/.lib.ir.json siblings - SC4xxx diagnostic text and hints say library, never core; trap-message strings likewise (LIBRARY RC AUDIT, library reset registry, library inbound bytes) - internals: compileLibrary/compileLibArchive, IrModule.lib + IrLibSection/IrLibExport, moduleLibAsyncSurface, libRoots, loadLibraryProfile/LibraryProfile under src/library/, frontend/lib-exports.ts, emitLibEntries/emitLibDefs - runtime: scr_core.c -> scr_library.c with scr_library_* symbols and the SCR_LIB macro (scr_lib_* was taken by the stdlib unit); scr_lib_session_cleanup - tests: tests/library-mode/ fixtures (entries lib.ts), library-*.test.ts harness files
19 lines
544 B
TypeScript
19 lines
544 B
TypeScript
// K5/K6/K7 fixture: a deliberately trapping export (array index OOB — the
|
|
// runtime's own range trap), a throwing export (the escaped-exception
|
|
// channel: "Uncaught ..." rendered into the sink), and a benign export the
|
|
// poisoned-library probe calls after a trap (which must abort, never run).
|
|
export function boom(i: number): number {
|
|
const xs = [1, 2, 3];
|
|
return xs[i]!;
|
|
}
|
|
|
|
export function fail(msg: string): number {
|
|
throw new Error(msg);
|
|
}
|
|
|
|
export function ok(x: number): number {
|
|
return x + 1;
|
|
}
|
|
|
|
console.log("traps ready");
|