Registry / serialization / muffin-js

muffin-js

JSON →
library1.1.2jsnpmunverified

MuffinJS v1.1.2 is a transpiler and runtime for the Muffin scripting language, designed to compile and execute Muffin scripts on Node.js. It offers a simple alternative to JavaScript with custom syntax for variables, loops, conditions, and functions, and supports including external scripts and libraries. Unlike general-purpose languages, it focuses on ease of use with automatic disk persistence for variables and built-in I/O abstraction. Release cadence is low; the project appears in maintenance mode with limited recent updates.

npm install muffin-js
INSTALL
IMPORT
SIG · MUFFIN-JS
M
muffin-js
serializationjavascriptv1.1.2
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 muffin = require('muffin');
import muffin from 'muffin';
Package does not support ESM imports; use CommonJS require.
prompt
const prompt = (data) => readline.question(chalk.green(data.toUpperCase()) + chalk.green('\n\nINPUT> '));
// Missing prompt object will cause ReferenceError at runtime
prompt, confirm, and localStorage must be defined externally before using eval(output).
confirm
const confirm = (...rest) => { console.clear(); console.log(...rest.map(e => chalk.green(e.toString().toUpperCase()))); readline.question(chalk.green('\nPRESS ENTER> ')); return true; };
// Missing confirm will crash when scripts call confirm
Exact implementation required; note the .toUpperCase() typo in README (data.toString()toUpperCase() is invalid).
localStorage
const localStorage = { getItem: (name) => { ... }, setItem: (name, value) => { ... }, clear: () => { ... } };
// Missing localStorage or incorrect method signatures cause runtime errors
Requires node:fs; ensure storage directory exists.

Shows how to compile and run a Muffin script via CLI and programmatically, highlighting the need for external dependencies.

// Install globally or locally: npm i muffin-js // Create a Muffin script file: hello.muffin // Write: print "Hello, Muffin!" // Compile and run: muffin hello.muffin // Alternatively, use programmatically: const muffin = require('muffin'); const my_code = 'print "Hello, World!"'; const output = muffin(my_code); eval(output); // EVAL IS EVIL - ensure prompt, confirm, localStorage are defined
muffin --version
Debug
Known issues
gotchaprompt, confirm, and localStorage objects must be defined globally before using eval(output) or running compiled code.
fix
Inject these objects as shown in the README before calling eval().
affects: *
gotchaThe parser treats lines ending with semicolon as continuation lines, not newlines.
fix
Do not use semicolons inside Muffin scripts to avoid unexpected line merging.
affects: *
deprecatedPackage uses chalk@4.0.0 which is outdated; newer versions may break due to ESM conversion.
fix
Pin chalk to version 4.0.0 when using the provided prompt/confirm implementation.
affects: >=1.0.0
gotchaThe README contains typos such as 'Stringif' instead of 'stringify' and 'toUpperCase()' incorrect chaining, causing runtime errors if copied verbatim.
fix
Review the provided code and fix syntax errors before use.
affects: *
gotchaeval() is used to execute compiled output, which is a security risk if input is untrusted.
fix
Avoid using eval() with untrusted Muffin scripts; consider sandboxing or pre-compiling.
affects: *
Errors
Common errors & fixes
ReferenceError: prompt is not defined
The compiled Muffin script calls prompt, but the global prompt object has not been defined.
fix
Define prompt as shown in the README before calling eval(output).
TypeError: localStorage.getItem is not a function
localStorage object is missing or incorrectly implemented.
fix
Implement localStorage with getItem, setItem, and clear methods as specified.
SyntaxError: Unexpected identifier
Using semicolons in Muffin scripts causes parser to treat next line as continuation, leading to invalid generated JavaScript.
fix
Avoid semicolons in Muffin source code.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
muffin-js — npm install muffin-js · libregistry