Registry / serialization / spoon
library0.1.10jsnpmunverified

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.

npm install spoon
INSTALL
IMPORT
SIG · SPOON
S
spoon
serializationjavascriptv0.1.10
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.

spoon
const spoon = require('spoon')
import spoon from 'spoon'
Package does not support ESM. Only CommonJS require works.
spoon.construct
const { construct } = require('spoon')
Use as named import from require. This method expects an Esprima AST.
spoon.render
const { render } = require('spoon')
Renders a CFG object back to JavaScript code string.

Transpile code to use callbacks for specified function calls, with minimal configuration.

const spoon = require('spoon'); const code = `var x = 1; var y = hardMath(x) * 2; console.log(y);`; const transformed = spoon(code, ['hardMath']); console.log(transformed); // Output uses callbacks for hardMath calls.
Debug
Known issues
breakingspoon() expects an array of function names as second argument, but many users pass a string or options object first.
fix
Always pass an array: spoon(code, ['funcName'], options)
affects: >=0.0.0
deprecatedThe package is unmaintained since 2012. No security patches or updates.
fix
Consider using modern alternatives like Babel plugins or Sweet.js for code transformation.
affects: >=0.0.0
gotchaSpoon uses UglifyJS for code generation, which may produce different formatting. The 'uglify' option is passed directly to UglifyJS; incorrect options may cause errors.
fix
Limit uglify options to known UglifyJS options from version 1.x.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'spoon'
Package not installed or not resolved in node_modules.
fix
Install with: npm install spoon
spoon is not a function
Incorrect import style (e.g., import default from ESM).
fix
Use: const spoon = require('spoon');
Cannot read property 'construct' of undefined
Using CommonJS but not requiring the module correctly.
fix
Ensure you are using: const spoon = require('spoon');
Upgrade
Version history
0.1.10latest on npm
Audit
Dependencies
esprimarequiredUsed for parsing JavaScript into AST
uglify-jsoptionalUsed for code generation (optional, can be specified via options)
Agent activity
6 hits · last 30 days
node
4
Amazon
1
Resources
spoon — npm install spoon · libregistry