{"id":25181,"library":"doof","title":"doof","description":"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.","status":"active","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/andrew24601/doof","tags":["javascript","typescript","cpp","transpiler","compiler","codegen"],"install":[{"cmd":"npm install doof","lang":"bash","label":"npm"},{"cmd":"yarn add doof","lang":"bash","label":"yarn"},{"cmd":"pnpm add doof","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally for type checking and parsing of the doof language","package":"typescript","optional":true}],"imports":[{"note":"CommonJS require works but ESM is preferred.","wrong":"const Transpiler = require('doof').Transpiler","symbol":"Transpiler","correct":"import { Transpiler } from 'doof'"},{"note":"transpile is a named export, not default.","wrong":"import transpile from 'doof'","symbol":"transpile","correct":"import { transpile } from 'doof'"},{"note":"TranspilerOptions is a type, should be imported using 'type' modifier to avoid runtime inclusion.","wrong":"import { TranspilerOptions } from 'doof'","symbol":"TranspilerOptions","correct":"import type { TranspilerOptions } from 'doof'"}],"quickstart":{"code":"import { transpile, Transpiler } from 'doof';\n\n// Simple single-file transpilation\nconst result = transpile(\n  `class Greeter {\n    name: string;\n    greet(): string {\n      return \\`Hello, \\${this.name}!\\`;\n    }\n  }\n  function main(): int {\n    let greeter = Greeter { name: \"World\" };\n    print(greeter.greet());\n    return 0;\n  }`,\n  { target: 'cpp' }\n);\nconsole.log(result.code);\n\n// Multi-file project transpilation\nconst transpiler = new Transpiler({ target: 'js', namespace: 'myapp' });\ntranspiler.transpileProject(['file1.do', 'file2.do']).then(projectResult => {\n  projectResult.files.forEach(f => console.log(f.path, f.code));\n});","lang":"typescript","description":"Shows both simple transpile and multi-file project transpilation with different targets."},"warnings":[{"fix":"Explicitly pass {target: 'js'} when you want JavaScript output.","message":"The default target is C++ (cpp), not JavaScript.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Pin to exact version in package.json: \"doof\": \"0.0.2\".","message":"Package version is 0.0.2, very early stage. Breaking changes can happen with minor updates.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Copy doof_runtime.cpp and doof_runtime.h to your project and compile them with your generated code.","message":"The transpiled C++ output requires the included runtime files (doof_runtime.cpp/.h) to compile.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use -t js or --target js; do not omit the flag.","message":"CLI options have changed between minor versions; '--target' requires a value (cpp/js/vm) and is not optional.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'doof' package only for the transpiler and manually copy runtime files from node_modules/doof/.","cause":"Trying to directly import runtime files without proper path.","error":"Error: Cannot find module 'doof/runtime'"},{"fix":"Change 'import transpile from \"doof\"' to 'import { transpile } from \"doof\"'.","cause":"Using default import instead of named import.","error":"TypeError: transpile is not a function"},{"fix":"Use target: 'js' (not 'javascript').","cause":"Using 'javascript' instead of 'js' as target.","error":"Error: Unknown target 'javascript'"},{"fix":"Use doof's built-in types: int, float, string, bool, array, map.","cause":"Using non-existent built-in types in doof language.","error":"error: cannot find class \"Array\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}