Object.freeze, Object.seal and Object.preventExtensions of a class instance held in an untyped value threw SC2020 at run time. Node changes the instance itself: writes through its typed references then throw the read-only TypeError in strict mode code, adding properties through any reference fails, and Object.isFrozen, isSealed and isExtensible report the state through either reference. - In a program that freezes, seals or prevents extensions of an untyped value that is not a fresh literal, every class hierarchy that can be held there gets the integrity word that static Object.freeze already uses, and with it the existing write checks. - The runtime applies the operation to the instance's checked view and commits the view. The commit of such a hierarchy stores the view's integrity state in the word (scr_dyn_class_view_integrity) and makes the instance's property bag not extensible with it. A hierarchy without the word still throws SC2020. - These commits replace and remove the bag's field entries whatever their attributes, so a sealed or frozen view does not leave stale field values in the bag. - The analysis behind records and arrays now starts from these calls only, rather than from every untyped freeze the lowering emits, such as the frozen strings array of a tagged template. - Programs without such calls compile as before. The runtime ABI moves to v38. Corpus 7407 covers freeze, seal and preventExtensions through unknown of classes and subclasses, writes through typed and untyped references and through methods, properties added before and after the operation, and the integrity queries, and matches Node. Refs #1374 Co-authored-by: blurname <50226652+blurname@users.noreply.github.com>
scriptc
Compile TypeScript and JavaScript to native executables or WASI WebAssembly modules that run without Node.js installed.
$ cat fib.ts
function fib(n: number): number {
return n < 2 ? n : fib(n - 1) + fib(n - 2);
}
console.log(fib(30));
$ scriptc run fib.ts
832040
$ scriptc build fib.ts -o fib >/dev/null && ./fib
832040
scriptc compiles the same TypeScript you run on Node.js, type-checked by the TypeScript compiler. npm packages your program imports compile along with it. Code scriptc can't compile fails the build with an error code and, where available, a rewrite hint.
scriptc is experimental. See the limitations and the Node.js compatibility reference.
Install
$ npm install -g scriptc
npm installs the native compiler for your platform (macOS, Linux, or Windows). Node.js 24 or later is needed to install it and to run WASI modules with scriptc run; compiling and running executables doesn't need Node.js.
Building executables needs a linker and the platform SDK or sysroot, such as the Xcode Command Line Tools on macOS. Set SCRIPTC_LINKER to choose the linker driver. --emit=ir|llvm|asm|obj needs no external tools. See the quickstart for details.
Commands
scriptc build <file.ts>: compile to a native executable or another artifact selected with--emit.scriptc run <file.ts>: compile and run.scriptc coverage <file.ts>: report what compiles, and explain what doesn't.scriptc build --lib --profile <profile.json>: compile a static library, or a Wasm reactor onwasm32-wasi.
See the CLI reference for every option.
Cross-compilation and WebAssembly
Set SCRIPTC_TARGET to build for another platform, for example SCRIPTC_TARGET=aarch64-linux-gnu.2.36 or SCRIPTC_TARGET=wasm32-wasi. Install the matching @scriptc/runtime-<target> package in your project, at the same version as scriptc --version, or set SCRIPTC_RUNTIME_PACK to a runtime pack directory. See platform support and WebAssembly modules.
Native code
Call C functions by declaring their signatures in TypeScript and binding them to C symbols in a manifest passed with --ffi <manifest.json>. See the Native FFI guide.
Build cache
Builds reuse a bounded persistent cache. Set SCRIPTC_NO_CACHE=1 to bypass it or SCRIPTC_CACHE_DIR to choose its location.
Docs: scriptc.dev