BembaJS Core
raw JSON → 1.4.27 verified Fri May 01 auth: no javascript
The core compiler and runtime for the Bemba programming language, enabling React-based web development with Bemba syntax (a Zambian language). Current stable version is 1.4.27, with an active release cadence focused on React integration and tooling. Key differentiators: it is the first programming language based on an African language (Bemba), compiled to JavaScript with full React compatibility. It supports conditionals, loops, async/await, and state management with Bemba keywords. Notably, it requires React 18+ and ReactDOM as peer dependencies. Ships TypeScript definitions and supports ESM/CJS.
Common errors
error SyntaxError: Unexpected token in Bemba code ↓
cause Missing semicolon or incorrect Bemba keyword.
fix
Ensure all statements end with semicolon and check keyword spelling.
error Cannot find module 'bembajs-core' or its corresponding type declarations. ↓
cause Package not installed or TypeScript types missing.
fix
Run npm install bembajs-core and ensure tsconfig includes 'node_modules/@types'.
error ReferenceError: require is not defined in ES module scope ↓
cause Using require() with an ESM-only package version.
fix
Switch to import syntax or set 'type': 'module' in package.json.
error Error: The 'react' peer dependency is not installed. ↓
cause React is required but not listed in dependencies.
fix
Run npm install react react-dom.
Warnings
deprecated ukusungaKabili is deprecated and will be removed in v2.0. ↓
fix Replace with ukusunga and useEffect manually.
breaking ESM-only since v1.4.0 - CJS require() will fail. ↓
fix Use import syntax or migrate to ESM.
gotcha Peer dependencies react and react-dom must be installed separately. ↓
fix Run: npm install react react-dom
breaking State management keywords changed in v1.2.0 (ukusunga replaces ukusinga). ↓
fix Update code to use ukusunga instead of ukusinga.
gotcha .bemba files require a Babel plugin or custom build step to compile. ↓
fix Use the BembaJS Vite plugin or compile via CLI before bundling.
Install
npm install bembajs-core yarn add bembajs-core pnpm add bembajs-core Imports
- bembaJS wrong
const bembajs = require('bembajs-core')correctimport { bembajs } from 'bembajs-core' - compileBemba wrong
import compileBemba from 'bembajs-core'correctimport { compileBemba } from 'bembajs-core' - BembaRuntime
import { BembaRuntime } from 'bembajs-core'
Quickstart
import { compileBemba } from 'bembajs-core';
const bembaCode = `
ukusunga (@mut) count = 0;
ukulomba @mut count;
ukusapoti() {
@mut count += 1;
}
`;
const compiled = compileBemba(bembaCode);
console.log(compiled);
// Output: React component with hooks