feat(compiler): run the TypeScript program host natively

- Share program creation, checker queries, virtual files, and snapshot lifetimes between Node and native compiler clients.
- Preserve typed async-context results and opaque compiler objects through checked native boundaries.
- Support native realpath and Unicode Windows filesystem operations needed by the compiler host.
This commit is contained in:
Chris Tate
2026-09-28 10:40:26 -05:00
committed by GitHub
parent 26b68b33d3
commit 5d6611d52f
39 changed files with 1349 additions and 378 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ const results = await Promise.all(jobs); // number[] — compiles
**The `any`/`unknown` boundary**
- `any` without `--dynamic` is generally a compile error (SC2011) — use `unknown` and a checked cast, or opt into the engine. Native Map and Set type arguments may use `any`; their slots use the same checked values as `unknown` without embedding an engine.
- `any` and `unknown` ride locals, parameters, and returns; record and tuple fields hold `unknown`. JavaScript instance fields can also hold native checked values without a JavaScript engine: bare fields start as `undefined`, and redeclaring a field with the same checked-value type resets it in initialization order. Explicit TypeScript `any`/`unknown` class fields, static checked-value fields, statically typed array elements, and union arms remain unsupported in static builds. Program class instances can pass through `unknown` and recover at their exact static class type without losing identity, as can supported native handles; JSON-shaped records and arrays retain the copy boundary described below.
- `any` and `unknown` ride locals, parameters, and returns; record and tuple fields hold `unknown`. JavaScript instance fields can also hold native checked values without a JavaScript engine: bare fields start as `undefined`, and redeclaring a field with the same checked-value type resets it in initialization order. Explicit TypeScript `any`/`unknown` class fields, static checked-value fields, statically typed array elements, and union arms remain unsupported in static builds. Program class instances can pass through `unknown` and recover at their exact static class type without losing identity, including classes with internal collections. Dynamic property inspection of a class whose own fields cannot cross the checked-value boundary throws a catchable `TypeError`. Supported native handles also retain identity; JSON-shaped records and arrays retain the copy boundary described below.
- Operations on `unknown` beyond the supported surface (truthiness, `typeof` narrowing, property access, `+`, `switch`, `throw`) need a checked cast first.
**Type surface**
@@ -2,6 +2,6 @@
"schemaVersion": 3,
"nodeVersion": "24.15.0",
"nodeCommit": "848430679556aed0bd073f2bc263331ad84fa119",
"artifactVersion": "7d4a5066f94b28d7740b",
"artifactVersion": "32ff384d1109c5f95380",
"rowCount": 3662
}
@@ -458,9 +458,9 @@
"apiEntries": 276,
"static": {
"supported": 0,
"partial": 48,
"partial": 49,
"refused": 0,
"not-implemented": 228,
"not-implemented": 227,
"by-design": 0,
"unreviewed": 0,
"not-applicable": 0
@@ -39213,9 +39213,9 @@
"inherited": true
},
"static": {
"status": "not-implemented",
"detail": "No static compiler lowering is registered for this API yet.",
"verification": "registry-gap"
"status": "partial",
"detail": "Implemented for the call shapes accepted by the compiler lowering.",
"verification": "test-backed"
},
"dynamic": {
"status": "not-implemented",