npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bembajs-core

v1.3.0

Published

BembaJS Core - Compiler and runtime for Bemba language with conditionals, loops, and async/await support

Readme

BembaJS Core

npm version License: MIT

BembaJS Core - The compiler and runtime engine for Bemba language 🇿🇲

📦 Installation

npm install bembajs-core

🚀 Quick Start

const { compile, parse, transform, generate } = require('bembajs-core');

// Compile Bemba code to HTML/JavaScript
const result = compile(`
  pangaIpepa('Home', {
    umutwe: 'Mwaiseni ku BembaJS!',
    ilyashi: 'Welcome to BembaJS framework'
  });
`);

console.log(result);

🔧 API Reference

compile(code, options)

Compiles Bemba code to HTML/JavaScript.

Parameters:

  • code (string) - Bemba source code
  • options (object) - Compilation options

Returns: Compiled HTML string

Example:

const html = compile(`
  pangaWebusaiti("My App", {
    ifiputulwa: [{
      umutwe: "Welcome",
      ilyashi: "Hello from BembaJS!",
      amabatani: [{
        ilembo: "Click Me",
        pakuKlikisha: "londolola('Hello!')"
      }]
    }]
  });
`);

parse(code)

Parses Bemba code into an Abstract Syntax Tree (AST).

Parameters:

  • code (string) - Bemba source code

Returns: AST object

Example:

const ast = parse(`
  fyambaIcipanda('Button', {
    ilembo: 'Click Me',
    pakuKlikisha: 'handleClick()'
  });
`);

transform(ast)

Transforms Bemba AST to React-compatible AST.

Parameters:

  • ast (object) - Bemba AST

Returns: React-compatible AST

generate(ast)

Generates JavaScript code from AST.

Parameters:

  • ast (object) - React-compatible AST

Returns: Generated JavaScript string

🏗️ Architecture

BembaJS Core consists of four main components:

1. Lexer (BembaLexer)

Tokenizes Bemba source code into tokens.

const { BembaLexer } = require('bembajs-core');
const lexer = new BembaLexer();
const tokens = lexer.tokenize(code);

2. Parser (BembaParser)

Parses tokens into an Abstract Syntax Tree.

const { BembaParser } = require('bembajs-core');
const parser = new BembaParser();
const ast = parser.parse(tokens);

3. Transformer (BembaTransformer)

Transforms Bemba AST to React-compatible AST.

const { BembaTransformer } = require('bembajs-core');
const transformer = new BembaTransformer();
const reactAST = transformer.transform(bembaAST);

4. Generator (BembaGenerator)

Generates JavaScript/React code from AST.

const { BembaGenerator } = require('bembajs-core');
const generator = new BembaGenerator();
const jsCode = generator.generate(reactAST);

🎯 Bemba Language Features

Components

fyambaIcipanda('MyComponent', {
  umutwe: 'Component Title',
  ilyashi: 'Component content',
  amabatani: [{
    ilembo: 'Button Text',
    pakuKlikisha: 'handleClick()'
  }]
});

Pages

pangaIpepa('Home', {
  umutwe: 'Welcome to BembaJS',
  ilyashi: 'Build amazing web applications'
});

API Routes

pangaMaapi('/api/hello', {
  method: 'GET',
  response: 'Hello from BembaJS!'
});

Hooks

// State management
const [count, setCount] = useUmubili(0);

// Effects
useMulemba(() => {
  console.log('Component mounted');
}, []);

// Context
const theme = useMukulu('theme');

🔧 Constants

Bemba Keywords

const { BEMBA_KEYWORDS } = require('bembajs-core');
console.log(BEMBA_KEYWORDS);
// Output: ['fyambaIcipanda', 'pangaIpepa', 'pangaMaapi', ...]

Bemba Folders

const { BEMBA_FOLDERS } = require('bembajs-core');
console.log(BEMBA_FOLDERS);
// Output: { pages: 'amapeji', components: 'ifikopo', api: 'maapi', ... }

🧪 Testing

npm test

📖 Examples

Basic Component

const { compile } = require('bembajs-core');

const code = `
  fyambaIcipanda('Welcome', {
    umutwe: 'Mwaiseni ku BembaJS!',
    ilyashi: 'This is a Bemba component',
    amabatani: [{
      ilembo: 'Get Started',
      pakuKlikisha: 'startApp()'
    }]
  });
`;

const result = compile(code);

Form Component

const code = `
  fyambaIcipanda('ContactForm', {
    umutwe: 'Contact Us',
    ilyashi: 'Send us a message',
    amabatani: [{
      ilembo: 'Submit',
      pakuKlikisha: 'submitForm()'
    }]
  });
`;

🔗 Related Packages

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

We welcome contributions! Please see our Contributing Guide.


Made with ❤️ in Zambia 🇿🇲