Registry / serialization / doof
library0.0.2jsnpmunverified

A TypeScript-like language transpiler targeting C++, JavaScript, and VM bytecode. Version 0.0.2 is the current stable release with an experimental development cadence. It offers a familiar TypeScript syntax for classes, type annotations, and templates, but transpiles to idiomatic C++ with optional runtime support, or JavaScript or abstract VM bytecode. Key differentiators include cross-language output from a single source, integrated C++ compile-and-run, and a format/lint tool. Note: Very early-stage, with limited ecosystem and documentation.

npm install doof
INSTALL
IMPORT
SIG · DOOF
D
doof
serializationjavascriptv0.0.2
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.

Transpiler
import { Transpiler } from 'doof'
const Transpiler = require('doof').Transpiler
CommonJS require works but ESM is preferred.
transpile
import { transpile } from 'doof'
import transpile from 'doof'
transpile is a named export, not default.
TranspilerOptions
import type { TranspilerOptions } from 'doof'
import { TranspilerOptions } from 'doof'
TranspilerOptions is a type, should be imported using 'type' modifier to avoid runtime inclusion.

Shows both simple transpile and multi-file project transpilation with different targets.

import { transpile, Transpiler } from 'doof'; // Simple single-file transpilation const result = transpile( `class Greeter { name: string; greet(): string { return \`Hello, \${this.name}!\`; } } function main(): int { let greeter = Greeter { name: "World" }; print(greeter.greet()); return 0; }`, { target: 'cpp' } ); console.log(result.code); // Multi-file project transpilation const transpiler = new Transpiler({ target: 'js', namespace: 'myapp' }); transpiler.transpileProject(['file1.do', 'file2.do']).then(projectResult => { projectResult.files.forEach(f => console.log(f.path, f.code)); });
doof --version
Debug
Known issues
gotchaThe default target is C++ (cpp), not JavaScript.
fix
Explicitly pass {target: 'js'} when you want JavaScript output.
affects: >=0.0.1
gotchaPackage version is 0.0.2, very early stage. Breaking changes can happen with minor updates.
fix
Pin to exact version in package.json: "doof": "0.0.2".
affects: >=0.0.1
gotchaThe transpiled C++ output requires the included runtime files (doof_runtime.cpp/.h) to compile.
fix
Copy doof_runtime.cpp and doof_runtime.h to your project and compile them with your generated code.
affects: >=0.0.1
gotchaCLI options have changed between minor versions; '--target' requires a value (cpp/js/vm) and is not optional.
fix
Use -t js or --target js; do not omit the flag.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'doof/runtime'
Trying to directly import runtime files without proper path.
fix
Use 'doof' package only for the transpiler and manually copy runtime files from node_modules/doof/.
TypeError: transpile is not a function
Using default import instead of named import.
fix
Change 'import transpile from "doof"' to 'import { transpile } from "doof"'.
Error: Unknown target 'javascript'
Using 'javascript' instead of 'js' as target.
fix
Use target: 'js' (not 'javascript').
error: cannot find class "Array"
Using non-existent built-in types in doof language.
fix
Use doof's built-in types: int, float, string, bool, array, map.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies
typescriptoptionalUsed internally for type checking and parsing of the doof language
Agent activity
6 hits · last 30 days
node
6
Resources
doof — npm install doof · libregistry