{"id":25967,"library":"muffin-js","title":"MuffinJS","description":"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.","status":"maintenance","version":"1.1.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install muffin-js","lang":"bash","label":"npm"},{"cmd":"yarn add muffin-js","lang":"bash","label":"yarn"},{"cmd":"pnpm add muffin-js","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package does not support ESM imports; use CommonJS require.","wrong":"import muffin from 'muffin';","symbol":"default","correct":"const muffin = require('muffin');"},{"note":"prompt, confirm, and localStorage must be defined externally before using eval(output).","wrong":"// Missing prompt object will cause ReferenceError at runtime","symbol":"prompt","correct":"const prompt = (data) => readline.question(chalk.green(data.toUpperCase()) + chalk.green('\\n\\nINPUT> '));"},{"note":"Exact implementation required; note the .toUpperCase() typo in README (data.toString()toUpperCase() is invalid).","wrong":"// Missing confirm will crash when scripts call confirm","symbol":"confirm","correct":"const confirm = (...rest) => { console.clear(); console.log(...rest.map(e => chalk.green(e.toString().toUpperCase()))); readline.question(chalk.green('\\nPRESS ENTER> ')); return true; };"},{"note":"Requires node:fs; ensure storage directory exists.","wrong":"// Missing localStorage or incorrect method signatures cause runtime errors","symbol":"localStorage","correct":"const localStorage = { getItem: (name) => { ... }, setItem: (name, value) => { ... }, clear: () => { ... } };"}],"quickstart":{"code":"// Install globally or locally: npm i muffin-js\n// Create a Muffin script file: hello.muffin\n// Write: print \"Hello, Muffin!\"\n// Compile and run: muffin hello.muffin\n\n// Alternatively, use programmatically:\nconst muffin = require('muffin');\nconst my_code = 'print \"Hello, World!\"';\nconst output = muffin(my_code);\neval(output); // EVAL IS EVIL - ensure prompt, confirm, localStorage are defined","lang":"javascript","description":"Shows how to compile and run a Muffin script via CLI and programmatically, highlighting the need for external dependencies."},"warnings":[{"fix":"Inject these objects as shown in the README before calling eval().","message":"prompt, confirm, and localStorage objects must be defined globally before using eval(output) or running compiled code.","severity":"gotcha","affected_versions":"*"},{"fix":"Do not use semicolons inside Muffin scripts to avoid unexpected line merging.","message":"The parser treats lines ending with semicolon as continuation lines, not newlines.","severity":"gotcha","affected_versions":"*"},{"fix":"Pin chalk to version 4.0.0 when using the provided prompt/confirm implementation.","message":"Package uses chalk@4.0.0 which is outdated; newer versions may break due to ESM conversion.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Review the provided code and fix syntax errors before use.","message":"The README contains typos such as 'Stringif' instead of 'stringify' and 'toUpperCase()' incorrect chaining, causing runtime errors if copied verbatim.","severity":"gotcha","affected_versions":"*"},{"fix":"Avoid using eval() with untrusted Muffin scripts; consider sandboxing or pre-compiling.","message":"eval() is used to execute compiled output, which is a security risk if input is untrusted.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Define prompt as shown in the README before calling eval(output).","cause":"The compiled Muffin script calls prompt, but the global prompt object has not been defined.","error":"ReferenceError: prompt is not defined"},{"fix":"Implement localStorage with getItem, setItem, and clear methods as specified.","cause":"localStorage object is missing or incorrectly implemented.","error":"TypeError: localStorage.getItem is not a function"},{"fix":"Avoid semicolons in Muffin source code.","cause":"Using semicolons in Muffin scripts causes parser to treat next line as continuation, leading to invalid generated JavaScript.","error":"SyntaxError: Unexpected identifier"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}