@madenowhere/phaze-check
v0.0.1
Published
Headless type-checker for projects using .phaze files. Wraps @volar/typescript's runTsc with @madenowhere/phaze-language-tools' string-keyed LanguagePlugin so every tsc CLI flag passes through (--noEmit, --watch, --project). Same pattern as vue-tsc / svel
Readme
@madenowhere/phaze-check
Headless type-checker for projects using .phaze files. Wraps the real
TypeScript compiler with the same Volar LanguagePlugin the VSCode
extension uses, so every tsc flag passes through and .phaze errors
land at the right line.
pnpm add -D @madenowhere/phaze-check
pnpm exec phaze-check --noEmitWhat it does
phaze-check runs tsc against your project with two patches applied:
.phazeis registered as a script extension TypeScript recognises.- Each
.phazefile is parsed through@madenowhere/phaze-compile's format transform to produce a virtual.tsx+ a v3 sourcemap, and the TS service drives type-checking against the virtual code. Diagnostics are routed back through the sourcemap to.phazelines.
Same pattern as vue-tsc, svelte-check, astro check — built on the
@volar/typescript
runTsc helper.
Why a separate tool from tsc
tsc doesn't know .phaze files exist. Without phaze-check:
tsc --noEmitskips every.phazefile (extension not recognised), so CI never catches type errors in pages written as.phaze.- Adding
.phazetotsconfig.json'sincludeproduces a "File '…' has an unsupported extension" error.
phaze-check is the bridge — it teaches tsc about .phaze and runs
the same checker over the synthesised .tsx so type errors are caught
exactly as they would be in handwritten .tsx.
Usage
Drop-in replacement for tsc --noEmit in CI:
// package.json
{
"scripts": {
"check": "phaze-check --noEmit"
}
}All tsc flags work:
pnpm exec phaze-check --noEmit
pnpm exec phaze-check --noEmit --watch
pnpm exec phaze-check --project tsconfig.app.json
pnpm exec phaze-check --noEmit --noUnusedLocals(The bin passes process.argv straight through to tsc.)
What it doesn't do
- No autofix. Same scope as
tsc— report errors, exit non-zero. - No formatting. Use Prettier (or a future Phaze formatter — out of scope here).
- No phaze-compile diagnostics. Parse / fence-shape errors surface
at build time via the Vite plugin's code-frame overlay.
phaze-checkis type-error-only.
Architecture
phaze-check (bin/phaze-check.js)
│
▼
src/run.ts
│
┌──────────────┴──────────────┐
▼ ▼
@volar/typescript @madenowhere/phaze-
.runTsc(tscPath, language-tools
['.phaze'], .getPhazeLanguage
() => [plugin]) PluginForTsc()
│ │
└──────────────┬──────────────┘
▼
patched real `tsc.js`
(TypeScript compiler — your project's version)
│
▼
exit 0 (no errors) or 1 (errors found)The patching is a one-shot rewrite of tsc.js's source as it loads:
runTsc intercepts fs.readFileSync for the tsc path, splices in
the extra extension + proxyCreateProgram call, then requires the
patched source. The original tsc binary on disk is never modified.
Files
| Path | Role |
|---|---|
| package.json | Bin (phaze-check), dep on @madenowhere/phaze-language-tools + @volar/typescript. |
| bin/phaze-check.js | Executable. Imports runPhazeCheck from dist/run.js. |
| src/run.ts | Wraps runTsc with the string-keyed LanguagePlugin. |
| src/index.ts | Re-exports runPhazeCheck for programmatic embed. |
Related
@madenowhere/phaze-language-tools— the VolarLanguagePluginthis CLI consumes (same plugin the VSCode extension's LSP uses).phaze-vscode— VSCode extension that drives the same plugin as an LSP for interactive editing.- Tooling docs: https://phaze.build/tooling/phaze-check/.
