{"id":26424,"library":"spoon","title":"spoon","description":"Spoon is a JavaScript transpiler that converts synchronous code into continuation-passing style (CPS) by identifying specified function calls and rewriting the surrounding code to use callbacks. It parses JavaScript using Esprima, constructs a High-Level Intermediate Representation (HIR) in the form of a Control Flow Graph (CFG), and then renders the transformed code back to JavaScript. Current stable version is 0.1.10, with no recent releases. It is primarily a proof-of-concept for transpilation techniques and is not actively maintained. Differentiators include low-level CFG manipulation and selective transpilation via declaration comments.","status":"abandoned","version":"0.1.10","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install spoon","lang":"bash","label":"npm"},{"cmd":"yarn add spoon","lang":"bash","label":"yarn"},{"cmd":"pnpm add spoon","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for parsing JavaScript into AST","package":"esprima","optional":false},{"reason":"Used for code generation (optional, can be specified via options)","package":"uglify-js","optional":true}],"imports":[{"note":"Package does not support ESM. Only CommonJS require works.","wrong":"import spoon from 'spoon'","symbol":"spoon","correct":"const spoon = require('spoon')"},{"note":"Use as named import from require. This method expects an Esprima AST.","wrong":null,"symbol":"spoon.construct","correct":"const { construct } = require('spoon')"},{"note":"Renders a CFG object back to JavaScript code string.","wrong":null,"symbol":"spoon.render","correct":"const { render } = require('spoon')"}],"quickstart":{"code":"const spoon = require('spoon');\nconst code = `var x = 1; var y = hardMath(x) * 2; console.log(y);`;\nconst transformed = spoon(code, ['hardMath']);\nconsole.log(transformed);\n// Output uses callbacks for hardMath calls.","lang":"javascript","description":"Transpile code to use callbacks for specified function calls, with minimal configuration."},"warnings":[{"fix":"Always pass an array: spoon(code, ['funcName'], options)","message":"spoon() expects an array of function names as second argument, but many users pass a string or options object first.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Consider using modern alternatives like Babel plugins or Sweet.js for code transformation.","message":"The package is unmaintained since 2012. No security patches or updates.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Limit uglify options to known UglifyJS options from version 1.x.","message":"Spoon uses UglifyJS for code generation, which may produce different formatting. The 'uglify' option is passed directly to UglifyJS; incorrect options may cause errors.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with: npm install spoon","cause":"Package not installed or not resolved in node_modules.","error":"Cannot find module 'spoon'"},{"fix":"Use: const spoon = require('spoon');","cause":"Incorrect import style (e.g., import default from ESM).","error":"spoon is not a function"},{"fix":"Ensure you are using: const spoon = require('spoon');","cause":"Using CommonJS but not requiring the module correctly.","error":"Cannot read property 'construct' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}