Skip to content
ContractSpec
Start here

Package manual · tools

·CLI, authoring and agent tooling

lib.typescript-runtime

Owned TypeScript compiler API boundary for ContractSpec tooling

toolslibraryv2.0.5experimentalservernode
@lssm-tech/lib.typescript-runtime
bun add @lssm-tech/lib.typescript-runtime
Package source ↗Manifest ↗

Manifest declarations describe the current workspace; they do not verify registry publication or runtime execution.

Package guide

Owned runtime boundary for TypeScript compiler and AST access.

Consumers import AST helpers and source parsing from this package so TypeScript upgrades have one repair point. The adapter isolates TypeScript 7's unstable AST and asynchronous compiler APIs while preserving a stable asynchronous parser contract for callers.

ts
import {
	TypeScriptSourceParser,
	isVariableStatement,
} from "@lssm-tech/lib.typescript-runtime";

Call close() on long-lived parsers after use.

The explicit server-only @lssm-tech/lib.typescript-runtime/docs-manifest-builder entry owns compiler-backed same-file DocBlock extraction and package manifest generation. It exports extractModuleDocData and buildPackageDocManifest with their existing asynchronous signatures and is the canonical import path. The deprecated @lssm-tech/lib.contracts-spec/docs/manifest-builder subpath forwards the same function identities until the next major release of @lssm-tech/lib.contracts-spec removes it; new code imports this entry. This entry rejects browser resolution and is not reexported by the root AST adapter. Manifest and DocBlock types remain owned by surface-runtime and contracts-spec-core, respectively.

buildPackageDocManifest({ followReexports: true, ... }) additionally follows static value reexports to canonical same-file DocBlocks. The option is additive and defaults to false; existing callers keep their source-root-only behavior. The compatibility package's docs:manifest producer imports this entry directly and enables it so moving a contract into its canonical owner does not remove its documentation. Traversal does not execute source modules or scan private sibling files. Named aliases, cycles, and explicit export precedence are respected; ambiguous documentation bindings, duplicate identifiers/routes, and missing references fail validation. DocBlock identifiers and payloads are preserved, while sourceModule identifies the canonical package and source file for documentation outside the input root.

Each parser owns an isolated temporary workspace and native TypeScript session. On Windows, the adapter uses the compiler client's supported stdio transport; other platforms retain Unix sockets. This avoids Windows named-pipe readiness and naming races without changing the asynchronous parser API or snapshot semantics. The matching native TypeScript executable must be installed.

The root build targets Node-compatible server execution (including Bun). It requires filesystem, process, or native compiler facilities and does not advertise a browser export condition. Browser applications should use the relevant browser-safe contracts or UI entry points instead of importing this server root.

Relationships

THIS PACKAGElib.typescript-runtime2 import paths

Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.

3 declarations

Declared capabilities

Lib Typescript Runtime

Owned TypeScript compiler API boundary for ContractSpec tooling

Scripts

  • buildcontractspec-bun-build build
  • build:bundlecontractspec-bun-build transpile
  • build:typescontractspec-bun-build types
  • cleanrm -rf dist
  • devcontractspec-bun-build dev
  • lintbun run lint:fix
  • lint:checknode ../../../scripts/biome.cjs check .
  • lint:fixnode ../../../scripts/biome.cjs check --write .
  • prebuildcontractspec-bun-build prebuild
  • testbun test
  • typechecktsgo --noEmit