Registry / web-framework / processing-transpiler

processing-transpiler

JSON →
library1.0.1jsnpmunverified

A Node.js utility that converts Processing (Java-based) sketches into p5.js JavaScript code. Current stable version is 1.0.1. The tool parses Processing code using java-parser, applies transformations (e.g., converting size() to createCanvas()), and formats output with js-beautify. Unlike manual conversion or similar tools, it provides automated conversion with formatting. Release cadence is low; updates are occasional.

npm install processing-transpiler
INSTALL
IMPORT
SIG · PROCESSING-TRANSPI
P
processing-transpiler
web-frameworkjavascriptv1.0.1
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.

convertToP5
import { convertToP5 } from 'processing-transpiler'
const convertToP5 = require('processing-transpiler')
ESM-only; CommonJS require is not supported.
convertToP5
import { convertToP5 } from 'processing-transpiler'
import convertToP5 from 'processing-transpiler'
Named export, not default.
ProcessingTranspiler
import { ProcessingTranspiler } from 'processing-transpiler'
import ProcessingTranspiler from 'processing-transpiler'
The library also exports a class with additional options.

Shows how to import and use the convertToP5 function to transpile a simple Processing sketch.

import { convertToP5 } from 'processing-transpiler'; const processingCode = ` void setup() { size(400, 400); } void draw() { ellipse(mouseX, mouseY, 50, 50); } `; const jsCode = convertToP5(processingCode); console.log(jsCode); // Output: // function setup() { // createCanvas(400, 400); // } // function draw() { // ellipse(mouseX, mouseY, 50, 50); // }
processing-transpiler --version
Debug
Known issues
breakingMismatched braces or semicolons in Processing code can cause parse errors or incomplete transpilation.
fix
Ensure Processing code is syntactically correct Java-like code without unsupported constructs (e.g., classes, arrays).
affects: all
deprecatedSome Processing functions (e.g., smooth(), noSmooth()) may not be supported in p5.js; they are either skipped or cause warnings.
fix
Check the p5.js reference and manually adjust unsupported calls.
affects: <1.1
gotchaThe library does not handle Processing's built-in classes (e.g., PVector, PFont) or custom Java classes.
fix
Manually translate class usage to p5.js equivalents (objects, functions).
affects: all
Errors
Common errors & fixes
SyntaxError: Unexpected token
Processing code contains Java-specific syntax like classes, generics, or enhanced for-loops.
fix
Simplify code to basic functions and variables; avoid OOP constructs.
TypeError: convertToP5 is not a function
Using default import instead of named import.
fix
Use `import { convertToP5 } from 'processing-transpiler'`.
Error: Cannot find module 'processing-transpiler'
Package not installed or wrong import path.
fix
Run `npm install processing-transpiler` and ensure the import path is correct.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
java-parserrequiredParses Processing Java code into a concrete syntax tree
js-beautifyrequiredFormats the generated JavaScript code
Agent activity
4 hits · last 30 days
node
4
Resources
processing-transpiler — npm install processing-transpiler · libregistry