Registry / serialization / avdl-compiler

avdl-compiler

JSON →
library1.4.10jsnpmunverified

AVDL (Avro IDL) compiler that generates Go, Python, and TypeScript source code from protocol definition files. Current stable version is 1.4.10, released infrequently as a Keybase internal tool. Key differentiators: supports multi-language output (Go, Python, TypeScript) from a single AVDL schema, implements the Avro interface description language, and is written in IcedCoffeeScript. Compared to other Avro tools like avro-tools or avrodoc, this compiler is specifically designed for generating bot SDK code across Keybase's supported languages.

npm install avdl-compiler
INSTALL
IMPORT
SIG · AVDL-COMPILER
A
avdl-compiler
serializationjavascriptv1.4.10
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.

default
const compile = require('avdl-compiler')
import compile from 'avdl-compiler'
Package is CommonJS only; ESM import is not supported.
compileFile
const { compileFile } = require('avdl-compiler')
import { compileFile } from 'avdl-compiler'
Named export available via require; ESM not supported.
compileString
const { compileString } = require('avdl-compiler')
Compiles AVDL from a string variable.
CompileOptions
const { CompileOptions } = require('avdl-compiler')
TypeScript interface; use with JSDoc or TypeScript types.

Compiles an AVDL file to Go using compileFile and shows the output.

const { compileFile } = require('avdl-compiler'); const fs = require('fs'); // Example AVDL content: protocol Example { record Person { string name; int age; } } const avdlContent = `protocol Example { record Person { string name; int age; } }`; fs.writeFileSync('example.avdl', avdlContent); const options = { language: 'go', packageName: 'main', namespace: 'com.example', }; const result = compileFile('example.avdl', options); console.log(result); // Output: Go code representing the Person record fs.unlinkSync('example.avdl');
avdl --version
Debug
Known issues
gotchaThe compiler requires IcedCoffeeScript, which might conflict with other CoffeeScript versions in your project.
fix
Use a separate Node environment or containerize your build.
affects: <=1.4.10
deprecatedThe Python code generation might be incomplete or experimental.
fix
Prefer Go or TypeScript output for production use.
affects: >=1.0.0
breakingOutput format can change between minor versions without notice.
fix
Pin to a specific version in your package.json.
affects: >=1.0.0
gotchaOnly supports a subset of Avro schema features (e.g., no unions with null).
fix
Check the AVDL specification against supported schema features.
affects: <=1.4.10
gotchaThe compiler is written in IcedCoffeeScript, which is an unmaintained fork of CoffeeScript.
fix
There is no fix; consider migrating to a different Avro compiler.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'iced-coffee-script'
Missing iced-coffee-script dependency.
fix
Install required peer dependency: npm install iced-coffee-script
TypeError: compileFile is not a function
Importing the package incorrectly; compileFile is a named export.
fix
Use const { compileFile } = require('avdl-compiler'); not const compileFile = require('avdl-compiler');
SyntaxError: Unexpected token on line 1 of AVDL file
Invalid AVDL syntax, possibly missing protocol declaration.
fix
Ensure AVDL starts with 'protocol ProtocolName {' and follows Avro IDL syntax.
Upgrade
Version history
1.4.10latest on npm
Audit
Dependencies
iced-coffee-scriptrequiredRuntime dependency; the compiler is written in IcedCoffeeScript and requires it to execute.
Agent activity
24 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
avdl-compiler — npm install avdl-compiler · libregistry