@exactjs/compiler
v0.7.2
Published
The native TypeScript and TSX compiler for eXact applications.
Maintainers
Readme
@exactjs/compiler
The native TypeScript and TSX compiler for eXact applications.
It analyzes components, reactivity, tasks, bindings, and placement, then emits runtime artifacts.
Most applications use @exactjs/vite-plugin, @exactjs/webpack-plugin, or @exactjs/bun-plugin.
Use it directly for build tools, language tools, and custom artifact pipelines.
The package selects your platform's native binary, so application developers do not need Go.
It builds on Microsoft's Go compiler in microsoft/TypeScript and includes upstream notices.
Check an application
npx exactc --check --project tsconfig.jsonCheck mode validates eXact semantics, lowers compiler-owned TSX, and checks the resulting
TypeScript without emitting files. It defaults to tsconfig.json in the current directory.
Project file selection includes unreferenced fixtures. Explicit paths override that selection
while retaining compiler options. See project file selection.
Component props retain required/excess prop checks, spreads, generic inference, callback types,
and children. Form bindings are checked after normalization. Syntax-only compilation omits
semantic checks. Use check mode or semantic validation to reject type errors.
Build a library
npx exactc build-library
npx exactc build-library --watchThe builder emits declarations, paired unbundled ESM modules, and static package metadata.
It validates compiled exports, proven component placement, and all required runtime dependencies
before replacing dist/. Failed builds retain the previous output. Staging and locks use .exact/.
Calls from Bun scripts require Node on PATH for export checks.
Watch mode rebuilds on source/configuration changes and closes on Ctrl+C. The consumer's dev
server must observe the published files. Wait for the first successful library build before
starting consumer SSR. A consumer that imports separately generated artifacts regenerates them
after publication, before reloading its SSR graph. Linked source reads its own package-scoped enhancements
statically from its package configuration.
The selected tsconfig controls source roots. Imported production sources belong to the build even
when excluded as roots. Test, spec, Jest, and test-support modules remain unpublished, and importing
them from production fails before replacement. Keep shared production helpers in published source.
.mts and .mjs retain .mjs output extensions. CommonJS compilation is unsupported.
A shared declaration tree such as dist/types is copied once. Declaration output must avoid paired
target directories, which exactTargetDirectories can rename.
Use --project tsconfig.types.json for a separate declaration configuration or --skip-declarations
when another pipeline owns TypeScript output. Custom tooling can call buildLibrary() from
@exactjs/compiler/library-build. See library setup and configuration.
Rebuild libraries with compiler 0.7.1 to publish registration products for automatic discovery of library islands and continuation plans, then regenerate consumer artifacts. Older protocol-1 metadata remains accepted. Publish both targets and metadata from one build together. Generated identities and enhancement facades depend on physical source location. Different checkout paths are not guaranteed to produce identical bytes. Retain the actual release tarball. Publish CSS through an ordinary package subpath marked as a side effect. The application adapter bundles browser stylesheet imports alongside JSX helpers. Server artifacts omit client stylesheet execution. The library builder does not bundle CSS.
Programmatic integration
The package exposes source transforms, compiler sessions, diagnostics, artifact planning,
client-isolation checks, and createExactLanguageService() for editors. Dispose owned sessions
when the host closes. Compilation returns emitted paths and build facts. Semantic analysis and
generated component, operation, continuation, and registry identities remain compiler-owned.
When rootDir and outDir are supplied, outside inputs fail before output paths are derived.
Artifact projects stage the complete output set and restore previous files on publication failure.
For concrete runtime bundles, componentContractProjection: 'hydrate' retains resumptions and
'client' omits them. Leaving it unset preserves a rendering-mode-neutral contract. Both omit
analysis inventories already present in componentBuild.
Enhanced paired artifacts are bundler input. Unbundled execution uses single-target compileProject
output and physical facades. With sourceMap enabled, moduleTransform must return a version 3
map. See native compiler integration.
Custom library pipelines can write validated static facts through
@exactjs/compiler/component-library-build. The writer does not implement consumer trust policy.
See the component language. Documentation | Source on GitHub
