Bebop Tools

raw JSON →
3.2.3 verified Fri May 01 auth: no javascript

bebop-tools is the official CLI compiler for Bebop, a blazing fast, typesafe binary serialization library. Current stable version is 3.2.3. It compiles .bop schema files and generates idiomatic code for TypeScript, C#, Rust, C, and more. Unlike Protocol Buffers or FlatBuffers, Bebop focuses on minimal wire size and zero-copy parsing. Releases are frequent, with active development under the RainwayApp/6over3 organization.

error Error: Cannot find module 'bebop-tools'
cause Package not installed.
fix
Run 'npm install bebop-tools'.
error TypeError: bebop_tools_1.compile is not a function
cause Incorrect import style (used default instead of named).
fix
Use 'import { compile } from 'bebop-tools''.
error SyntaxError: Unexpected token 'export'
cause Using require() in a CommonJS environment with ESM-only package.
fix
Switch to ESM or use dynamic import().
error Error: No language specified
cause Missing 'language' option in compile() call.
fix
Pass options with { language: 'typescript' }.
breaking beopc CLI renamed to bebopc in v2.0.0.
fix Use 'bebopc' instead of 'beopc'.
breaking ESM-only since v3.0.0 – CommonJS require() no longer works.
fix Use dynamic import() or switch project to ESM (set "type": "module" in package.json).
gotcha Default export is not available; only named exports are provided.
fix Import named exports like { compile, BebopCompiler }.
deprecated The 'runtime' package is separate and not bundled in bebop-tools.
fix Install @bebop/runtime for runtime helpers.
npm install bebop-tools
yarn add bebop-tools
pnpm add bebop-tools

Demonstrates compiling a Bebop schema string to TypeScript code using the compile function.

import { compile } from 'bebop-tools';
import { writeFileSync } from 'fs';

const schema = `
  message Person {
    string name;
    int32 age;
  }
`;

const result = compile(schema, {
  language: 'typescript',
  namespace: 'MyApp'
});

if (result.success) {
  writeFileSync('Person.ts', result.code);
  console.log('Generated TypeScript code');
} else {
  console.error(result.errors);
}