Commit Graph
40 Commits
Author SHA1 Message Date
Chris Tate 8faad2f639 feat: add Node.js compatibility matrix (#284)
* feat: add Node.js compatibility matrix

- Add generated Node.js v24 compatibility inventory with static and dynamic support classifications.
- Publish the interactive /compatibility matrix and wire manifest generation into runtime and docs checks.

* fix: correct compatibility matrix generation

* fix: address PR 284 review findings

* fix: address PR 284 review findings

* test: exercise stream web loader through npm graph

* fix: correct dynamic global availability

* fix: keep compatibility module mappings precise
2026-09-02 16:03:36 -05:00
Chris Tate c41f1a8be9 Expand LLVM native output targets (#280)
* Expand LLVM native output targets

- Add owned helper and runtime-pack contracts for macOS x64, Linux glibc/musl, Windows x64, and WASI.
- Generalize LLVM target selection, package validation, linker plans, and release/CI matrices.
- Document linker boundaries and add focused native-output and runtime-pack coverage.

* Pin Windows LLVM helper CI to VS 2022

The official LLVM archive needs the Visual Studio 2022 CMake generator, which is not guaranteed by windows-latest.

* Align bootstrap cache with LLVM runtime-pack builds

Use the same target-specific helper and linker identity before and after compiler loading so routed executable cache hits remain lightweight.

* Install Windows LLVM CI tools with Chocolatey

windows-2022 includes Visual Studio but not winget; use its available Chocolatey bootstrap for CMake and Ninja.

* Prevent Zig version probes from leaving runtime-pack objects

Run runtime-pack compiler version probes in a private temporary directory and remove the accidental tracked WASI a.o file.

* Use 7-Zip for Windows LLVM setup

Extract the official LLVM development archive with two-stage 7-Zip instead of Windows tar.exe, which timed out while materializing the toolchain tree.

* Define ssize_t for the MSVC runtime pack

Clang's MSVC target does not expose POSIX ssize_t through sys/types.h; define the pointer-sized runtime type without affecting MinGW.

* Build the Windows runtime pack with Zig

Use the MinGW-compatible Windows sysroot required by the runtime while retaining COFF helper output and installing Zig in the Windows native CI lane.

* Give macOS LLVM differential shard time to finish

Shard 1 passed its setup and focused contracts but was cancelled during its cold LLVM differential slice at the 20-minute job limit.
2026-09-01 13:41:34 -05:00
Chris Tate 1cec922d95 Separate native linking from C compilation (#278)
* Separate native linking from C compilation

 - Split the helper-object runtime-pack path into explicit link planning and platform linking.
 - Reserve SCRIPTC_LINKER for object-only executable links while retaining a deprecated SCRIPTC_CC compatibility path.
 - Add no-legacy-C coverage and document the linker/SDK boundary.

* Preserve runtime pack link errors

* Fix linker cache invalidation and warnings

* Fix C executable cache routing

- Keep explicit C builds on compiler-backed cache identities.
- Cover linker-only environment changes across exact C repeats.
2026-08-31 20:29:59 -05:00
Chris Tate 64b2a285d5 feat(runtime): ship precompiled macOS artifacts (#248)
* feat(runtime): ship precompiled macOS artifacts

- Add a versioned macOS arm64 runtime pack with deterministic feature selection and artifact verification.
- Link LLVM helper objects against release-built runtime and vendor inputs without compiling user-machine C.
- Wire package publishing, cache validation, documentation, and full-gate coverage for the new path.

* fix(runtime): harden precompiled artifact handling

* fix(runtime): make precompiled artifacts reproducible

* fix(runtime): reject opaque linkers from executable cache

* fix(runtime): normalize precompiled archive metadata

* fix(runtime): harden precompiled artifact caching

* fix(runtime): close executable cache link race

* fix(runtime): stage verified pack artifacts

* fix(runtime): bracket helper cache inputs

* fix(runtime): preserve executable link identity

* fix(runtime): trace selected linker dependencies
2026-08-28 09:29:21 -05:00
Chris Tate 73efea6ab3 feat(cli): expose native object link info (#247)
* feat(cli): expose native object link info

- add versioned, cache-independent native link metadata for program objects

- document the experimental runtime ABI and provide C-driver and Apple linker examples

- verify ABI mismatch, FFI parity, packed installs, and external linking in CI

* fix(example): validate native runtime pack identity
2026-08-27 13:47:09 -05:00
Chris Tate 401338f437 feat(compiler): add native LLVM object emission (#242)
* feat(compiler): add native LLVM object emission

- ship the pinned macOS arm64 LLVM helper and platform package
- add assembly/object CLI outputs, caching, diagnostics, and runtime ABI checks
- validate helper artifacts through CI, packaging, docs, and differential coverage

* fix(compiler): harden native LLVM emission

* fix(compiler): harden LLVM helper packaging

* fix(compiler): stabilize LLVM helper package size

* fix(compiler): harden native helper validation

* fix(compiler): harden LLVM helper verification

* fix(compiler): harden native object emission
2026-08-27 10:30:40 -05:00
Chris Tate 77fad3c4cc feat(cli): add source-level output kinds (#241)
* feat(cli): add source-level output kinds

- add typed IR, C, and LLVM primary artifacts without native toolchain discovery
- centralize output paths, compatibility validation, and stale artifact cleanup
- document and test the new CLI contract

* fix(cli): harden source output contracts

* fix(cli): harden source output compatibility
2026-08-26 15:26:24 -05:00
Chris Tate 97585a8b5d Update description (#234) 2026-08-24 01:27:26 -05:00
Chris Tate af333016d4 perf: preseed native build caches (#192)
* perf: preseed native build caches

- Warm runtime, TLS, and dynamic-engine artifacts during npm installation
- Add an explicit toolchain-aware cache warm command for images and CI
- Move vendor artifacts into the user cache and build QuickJS directly

* fix: harden native cache warming

* fix: promote staged vendor cache entries

* fix: isolate shared native cache entries

* fix: validate shared vendor cache artifacts
2026-08-21 19:52:25 -05:00
Chris TateandDemonGPT a737fde346 feat(ffi): marshal foreign-thread callbacks (#164)
* feat(ffi): marshal foreign-thread callbacks

- Add format 5 foreign callback descriptors with strict retained, context, and void-return validation.
- Marshal copied callback arguments through an optional MPSC event-loop queue in both C and LLVM backends.
- Cover concurrent delivery, liveness, fairness, teardown, cross-platform builds, and document the boundary contract.

Co-authored-by: DemonGPT <127974011+DemonGPT@users.noreply.github.com>

* fix(ffi): preserve callback checkpoints

---------

Co-authored-by: DemonGPT <127974011+DemonGPT@users.noreply.github.com>
2026-08-16 22:59:02 -05:00
Chris TateandDemonGPT b53285d650 feat(ffi): add retained callbacks (#163)
* feat(ffi): add retained callbacks

- Add format 4 retained registration and explicit release descriptors with pointer-identity validation.
- Pin callbacks in runtime registration tables and emit matching C/LLVM adapters with deferred exception checks.
- Cover lifecycle and sanitizer cases, and document the same-thread callback boundary.

Co-authored-by: DemonGPT <127974011+DemonGPT@users.noreply.github.com>

* fix(ffi): harden retained callback lifecycle

* fix(ffi): reject same-call retained releases

* fix(ffi): reject inline retained releases

* fix(ffi): preserve plain exit listener timing

---------

Co-authored-by: DemonGPT <127974011+DemonGPT@users.noreply.github.com>
2026-08-16 20:43:18 -05:00
Chris TateandDemonGPT da9a8f5524 feat(ffi): copy callback strings and spans (#162)
* feat(ffi): copy callback strings and spans

- Add format 3 callback classes for cstrings, UTF-8 spans, and byte spans.
- Materialize owned callback arguments in both backends with strict null handling.
- Cover validation, ownership, sanitizers, and document the boundary contract.

Co-authored-by: DemonGPT <127974011+DemonGPT@users.noreply.github.com>

* fix(ir): bump schema for callback spans

---------

Co-authored-by: DemonGPT <127974011+DemonGPT@users.noreply.github.com>
2026-08-16 08:52:45 -05:00
Chris TateandArth Tyagi 6f50205dfd feat: support aarch64 Linux musl (#159)
- Implement the Zig 0.16.0 AArch64 musl runtime and preserve compiler failure diagnostics.

- Promote the target through executable, library, localization, and documentation matrices.

- Verify both backends and the complete arm64 Alpine differential contract.

Co-authored-by: Arth Tyagi <41021374+arthtyagi@users.noreply.github.com>
2026-08-15 10:53:06 -05:00
Chris Tate 81b70b0ee6 feat: add host-callback channels to library mode (#148)
* feat: add host-callback channels to library mode

- the profile's `callbacks` array declares named channels and
  `abi.callback_register_symbol` names the one registration entry point:
  `int32_t <sym>(const char *name, void (*fn)(void), void *ctx)` — 0 on
  success, -1 for an unknown or NULL name, latest registration wins, a
  NULL fn clears, registrations persist across init/reset. The stored
  pointer's typed shape is the channel's with the opaque context first,
  the panic sink's layout
- channel signatures ride the existing marshalling classes: params are
  f64/bool/string/bytes plus the u8/u32/i32 plumbing classes (outbound
  plumbing keeps JS's ToUint32/ToInt32, the executable FFI rule);
  returns are scalar only (f64/bool/u8/u32/i32/void — a buffer return
  needs an ownership contract the mode does not define). string/bytes
  parameters arrive as (ptr, len) pairs borrowed for the call's duration
- compiled code reaches a channel as a signature-only ambient function
  declaration whose direct calls deliver synchronously on the calling
  thread; the recognition rides the FFI import machinery under a library
  flavor: SC4024 refuses a call the channels cannot serve (undeclared
  name or off-class signature), unused channels are legal capacity, and
  callback-free profiles keep the ambient ReferenceError semantics
- calling an unregistered channel is the SC4025 runtime trap: a detected
  trap through the library funnel, so the structured sink message names
  the channel in its text and the entry the host called in its symbol
  field, and profile teachings/remediations overlay it like the rest of
  the runtime family
- registration slots are per copy of the runtime state, the sink's story:
  per-archive under abi.localize_runtime (the register symbol joins the
  localization keep-list), per-thread instance under
  abi.instance_per_thread. The host callback must not reenter any library
  entry or unwind across library frames
- both emissions produce identical behavior by construction: the slot
  store/fetch lives in scr_library.c (scr_library_cb_set/_require/_ctx),
  the generated TU emits the registration dispatch and typed indirect
  calls, and the trap text is assembled once at export resolution
- callback-free profiles emit byte-identical program TUs and serialized
  IR, and executable builds are byte-identical end to end
- conformance: the CB suite (tests/harness/library-callbacks.test.ts)
  covers the acceptance stream, unregistered and pre-registration traps,
  symbol exactness, teaching overlays, SC4024 refusals, capacity and
  callback-free postures, the localized+thread-instanced composition
  probe, and ASan reruns; profile-shape refusals join
  library-profile.test.ts

* fix: preserve callback binding identity

* fix: harden library callback contracts

* fix: recognize project callback declarations

* fix: enforce host callback declarations
2026-08-13 21:44:55 -05:00
Chris Tate 2ea62825cb feat: add mobile library targets for iOS and Android (#145)
* feat: add mobile library targets for iOS and Android

- three library-mode-only triples join SCRIPTC_TARGET:
  aarch64-apple-ios, aarch64-apple-ios-simulator (darwin hosts with
  Xcode's iPhoneOS/iPhoneSimulator SDKs), and aarch64-linux-android
  (any host with an NDK). The consuming pattern is an embedding app
  linking profile-configured static archives — Xcode on the Apple side,
  Gradle/NDK on the Android side — so the executable lane refuses the
  triples with SC3002 and the pointer to --lib
- zig bundles no Apple or bionic libc: resolveCc discovers the sysroot
  (xcrun for the selected Apple SDK; ANDROID_NDK_ROOT or the newest
  ndk/<version> under the SDK root) and spells it into targetArgs,
  where every cache tier already keys it. The canonical LLVM spellings
  map to zig's own with the minimum-version floors pinned:
  aarch64-ios.15.0[-simulator] stamps LC_BUILD_VERSION minos 15.0 into
  every object, aarch64-linux-android.26 pins the bionic stub level an
  embedder's minSdkVersion must meet. API 26 bionic carries everything
  the library-lane units call (arc4random_buf included), so no shim TU
  joins the archive
- localization follows the existing object-format rule: both iOS
  platforms ride the Mach-O host-ld64 arm (ld64 reads iOS objects and
  preserves platform/minos through the -r merge), Android rides the
  cross-ELF arm (zig relocatable merge + in-process demotion) via the
  driver's zig spelling. abi.instance_per_thread needed no per-target
  work — thread-local statics compile identically on all three
- admission is a pure env/host check ahead of toolchain discovery: an
  iOS triple off a darwin host and near-miss mobile spellings refuse
  SC3002 with the pairing or the supported set named, in compile() and
  compileLibrary() both, decorated by the profile teaching machinery
- library-multi grows the mobile lanes: M12 admission shape always
  runs; SCRIPTC_IOS=1 builds localized a/b archives per target and
  emission (M1 symbol exactness, ambient audit, version floor), links
  probes with the Xcode clang, and EXECUTES the two-instance and
  four-thread probes on a booted simulator byte-for-byte against the
  desktop expectations (device-arch archives are build+link verified);
  SCRIPTC_ANDROID=1 does the same through the NDK clang and an
  emulator, reusing a running device or writing and booting a headless
  arm64 AVD directly
- the surface manifest's coverage notes record the mobile posture (the
  library-admissible surface only; no mobile claim outside it), the
  profile spec and the platforms page carry the mobile matrix with the
  version floors, and non-mobile builds are unchanged byte-for-byte

* fix: harden mobile target tooling

* Harden mobile target test isolation
2026-08-13 09:48:09 -05:00
Chris TateandAlbert 31f268be2b feat: support wasm32-wasi as a production target (#133)
* feat: support wasm32-wasi as a production target

- Add production LLVM WASI codegen with a 32-bit ABI, coroutines, and dynamic modules
- Integrate WASI builds and execution into the CLI with capability diagnostics
- Add differential coverage and document the fourth production target

Co-authored-by: Albert <57402359+bulatovv@users.noreply.github.com>

* fix: address wasm target review findings

* fix WASI guest paths and fetch alias detection

* fix WASI async bridge and fetch detection

---------

Co-authored-by: Albert <57402359+bulatovv@users.noreply.github.com>
2026-08-11 14:12:59 -05:00
Chris Tateandsqlpxc 2c164dd374 feat: support x86_64 Linux musl targets (#131)
* feat: support x86_64 Linux musl targets

- add musl runtime shims for randomness, fibers, and child-process cwd support
- validate executable and library outputs against Alpine Linux
- document x86_64-linux-musl cross-compilation

Co-authored-by: sqlpxc <38583139+sqlpxc@users.noreply.github.com>

* fix: harden musl runtime portability

* fix: keep child fixture portable across hosts

---------

Co-authored-by: sqlpxc <38583139+sqlpxc@users.noreply.github.com>
2026-08-11 12:10:03 -05:00
Chris Tateandmike douges e135ae28bf docs: reflect Windows HTTP and fetch support (#132)
- Document static and dynamic HTTP/fetch support for Windows cross targets.
- Keep Windows fetch differential fixtures hermetic and parity-correct under filtering.

Co-authored-by: mike douges <6801309+itsdouges@users.noreply.github.com>
2026-08-11 09:17:20 -05:00
Chris TateandDemonGPT adea269659 feat(ffi): support call-scoped native callbacks (#128)
* feat(ffi): support call-scoped native callbacks

- Add format-2 callback/context declarations with exact ABI positions and strict lifetime validation.
- Emit capture-aware C and LLVM trampolines with scalar coercion and exception propagation.
- Document the callback contract and cover both backends in plain and sanitized tests.

Co-authored-by: DemonGPT <127974011+DemonGPT@users.noreply.github.com>

* fix FFI callback safety

---------

Co-authored-by: DemonGPT <127974011+DemonGPT@users.noreply.github.com>
2026-08-11 08:25:29 -05:00
Chris Tateandsensei-woo e5c875bd97 Support Date instance lowering (#101)
* Support Date instance lowering

- Lower read-only Date values and constructors through the C and LLVM backends.

- Add portable calendar helpers, differential coverage, and documented surface contracts.

- Fence unsupported mutation, identity, locale, and component-constructor forms.

Co-authored-by: sensei-woo <sensei-woo@users.noreply.github.com>

* Fix Date exception and timezone semantics

* fix: harden Date lowering edge cases

* fix Date lowering edge cases

* Fix Date union fences and offset clipping

---------

Co-authored-by: sensei-woo <sensei-woo@users.noreply.github.com>
2026-08-08 23:17:58 -05:00
Chris Tate 0d5bc0dd0d feat(coverage): resolve external host type surfaces (#80)
* feat(coverage): resolve external host type surfaces

- Add repeatable --external-types mappings for checker-only module resolution.
- Keep host runtime values as explicit blockers with tests and documentation.

* fix: validate external type mappings

* fix: fence external host runtime edges

* fix(compiler): skip empty external type lookup

* fix(compiler): honor external type boundaries
2026-08-02 19:41:35 -05:00
Chris Tate c356ff0ac0 Merge pull request #73 from vercel-labs/ctate/no-persist-compile
Persist native compilation cache
2026-08-02 14:58:35 -05:00
Chris Tate 68263610e3 fix(compiler): prevent stale native cache hits 2026-08-02 13:59:06 -05:00
Chris Tateandsachinmour b2dc9866c2 docs: update stale limitations
Co-authored-by: sachinmour <11920517+sachinmour@users.noreply.github.com>
2026-08-02 13:38:05 -05:00
Chris Tate a1215f6ef9 fix(compiler): bypass cache for opaque wrappers 2026-08-02 13:00:17 -05:00
Chris Tate 24904ddff7 fix native cache invalidation and safety 2026-08-02 12:03:56 -05:00
Chris Tate dcc5a03a52 fix: validate native cache state and artifacts 2026-08-01 18:38:22 -05:00
Chris Tate 1f1f7d42a7 fix native cache invalidation 2026-08-01 15:39:44 -05:00
Chris Tate 6b996ea4a8 fix: harden persistent compilation cache 2026-08-01 15:39:44 -05:00
Chris Tate c23741ba75 fix: relink ambient system libraries 2026-08-01 15:39:44 -05:00
Chris Tate d1dff3879e fix(compiler): close persistent cache correctness gaps 2026-08-01 15:39:43 -05:00
Chris Tate a578a9ab9b Persist native compilation cache
- Enable bounded platform-native caching for production executable and library builds.

- Reuse library runtime objects across edits and avoid duplicate no-npm frontend loading.

- Cover cache defaults, invalidation, bypass behavior, and artifact equivalence; document controls.
2026-08-01 15:39:43 -05:00
Chris Tate 1544ccda88 fix(fetch): align static stream and body coercion 2026-08-01 09:10:35 -05:00
Chris Tate d7cb22a325 test: pin Array.toSorted evaluation order 2026-07-29 15:11:04 -05:00
Chris Tate 9b0ad004f8 Fix top-level await rejection checkpoints 2026-07-29 01:32:26 -05:00
Chris Tate bed63d3223 feat: add outbound native FFI
- Add a strict versioned manifest and direct C ABI lowering for both backends.
- Link declared native inputs through the CLI and compiler APIs with precise diagnostics.
- Cover the ABI under plain and sanitized integration tests and document its contracts.
2026-07-25 09:56:48 -05:00
Chris Tate 1dd25bc823 Docs: the type-surface note on the limitations page
- names the deliberately re-typed ambient surface, the second-chance preflight, and the declared-but-fenced console members
- the union-edges bullet drops console.log(u), which now dispatches per arm
2026-07-23 01:29:02 -05:00
Chris Tate 005a54caa2 Default OG and tagline: TypeScript-to-Native Compiler 2026-07-22 19:04:55 -05:00
Chris Tate bcc094862b Docs: TypeScript-to-Native Compiler hero, npm install quickstart
- Quickstart installs from npm; from-source moves to a pointer at the repo
- Node floor matches the package engines field
2026-07-22 18:45:02 -05:00
Chris Tate 23d5918a53 init 2026-07-22 18:08:04 -05:00