Registry / serialization / xcompile

xcompile

JSON →
library0.6.1jsnpmunverified

XCompile is a robust tokenizer, parser, and transpiler for translating between programming languages. Current stable version is 0.6.1, released in 2025 with improved Clang parsing, XIR JSON target, and TypeScript emitter enhancements. It uses a custom intermediate representation (XIR) and supports translating Clang AST JSON into TypeScript. Key differentiators include native Clang bindings, ESM-only support (Node >= 20), and built-in CLI. Release cadence is irregular with major features added incrementally.

npm install xcompile
INSTALL
IMPORT
SIG · XCOMPILE
X
xcompile
serializationjavascriptv0.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

xcompile
✓ import { xcompile } from 'xcompile'
✗ const xcompile = require('xcompile')
Package is ESM-only since v0.6.0; CommonJS require will fail.
XCompile
✓ import { XCompile } from 'xcompile'
✗ import XCompile from 'xcompile'
XCompile is a named export, not a default export.
clang
✓ import { clang } from 'xcompile'
✗ import { clang } from 'xcompile/clang'
clang module is exported from the main package since v0.5.0.

Shows basic C to TypeScript transpilation using XCompile class and transpile method.

import { xcompile, XCompile } from 'xcompile'; const xc = new XCompile(); const source = `int add(int a, int b) { return a + b; }`; const result = xc.transpile(source, { from: 'c', to: 'ts' }); console.log(result.code); // Expected output: function add(a: number, b: number): number { return a + b; }
xcompile --version
Debug
Known issues
breakingRenamed clang.parse to clang.parseRaw and added new clang.parse in v0.5.0
fix
Use clang.parseRaw for old behavior or update to new clang.parse API.
affects: >=0.5.0
breakingRemoved custom tokenizer and parser in v0.4.0; replaced with XIR and Clang AST JSON
fix
Existing tokenizer/parser APIs are removed; use new XIR-based pipeline.
affects: >=0.4.0
breakingChanged snake_case to camelCase in v0.3.0
fix
Update API calls to use camelCase property names.
affects: >=0.3.0
deprecatedOptions like config.compress are deprecated since v0.3.0; removed in v0.4.0
fix
Avoid using deprecated options; check current API documentation.
affects: >=0.3.0 <0.4.0
gotchaESM-only package; require() fails on Node < 20
fix
Use ES modules or upgrade Node to >=20.
affects: >=0.6.0
gotchaTypeScript types shipped but may not be stable across minor versions
fix
Pin to a specific minor version if type stability is required.
affects: >=0.1.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Package is ESM-only; using CommonJS require()
fix
Use import syntax or set type: module in package.json
TypeError: xcompile is not a function
Default import used when only named export exists
fix
Use named import: import { xcompile } from 'xcompile'
Error: Cannot find module 'xcompile'
Package not installed or incorrect import path
fix
Run npm install xcompile and use correct import path 'xcompile'
TypeError: clang.parse is not a function
API change in v0.5.0: clang.parse renamed to clang.parseRaw
fix
Use clang.parseRaw or upgrade to new clang.parse API
Upgrade
Version history
0.6.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources