mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +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
24 lines
648 B
TypeScript
24 lines
648 B
TypeScript
// K4 fixture: init re-run determinism. Module state (a scalar, a
|
|
// refcounted array, the run-once module guards) fully resets between
|
|
// sessions — two init calls produce identical observable outputs, and
|
|
// under the sanitize flavor the reset seam asserts zero live heap between
|
|
// sessions (the library RC-audit counters).
|
|
let counter = 0;
|
|
const seen: string[] = [];
|
|
|
|
export function bump(): number {
|
|
counter = counter + 1;
|
|
return counter;
|
|
}
|
|
|
|
export function note(s: string): number {
|
|
seen.push(s);
|
|
return seen.length;
|
|
}
|
|
|
|
export function recall(): string {
|
|
return seen.join(",");
|
|
}
|
|
|
|
console.log(`session start counter=${counter}`);
|