JSPP Compiler
raw JSON → 2.0.8 verified Fri May 01 auth: no javascript
JSPP Compiler (v2.0.8) transpiles JSPP entry files and included modules into standalone JavaScript. It automatically resolves includes without manual std inclusion. Released as an npm package, it is the primary compiler for the JSPP language aimed at browser-compatible output. Minimal configuration: entry file, root directory, and output file.
Common errors
error Error: Cannot find module 'jspp-compiler' ↓
cause Package not installed
fix
Run 'npm install jspp-compiler'
error TypeError: compile is not a function ↓
cause Importing incorrectly (default vs named)
fix
Use named import: import { compile } from 'jspp-compiler'
Warnings
gotcha The root directory must be provided and must be absolute or relative to the current working directory. Incorrect root may cause include resolution failures. ↓
fix Use absolute paths or ensure relative paths are correct.
breaking Version 2.0.0 changed the API from callback-based to promise-based. Old code using callbacks will break. ↓
fix Migrate to async/await or .then() patterns.
Install
npm install jspp-compiler yarn add jspp-compiler pnpm add jspp-compiler Imports
- compile
import { compile } from 'jspp-compiler'; - compileFile wrong
const compileFile = require('jspp-compiler').compileFile;correctimport { compileFile } from 'jspp-compiler';
Quickstart
import { compileFile } from 'jspp-compiler';
const inputFilePath = 'path/to/entry.jspp';
const rootDir = 'path/to/root';
const outputFilePath = 'path/to/output.js';
compileFile({ input: inputFilePath, root: rootDir, output: outputFilePath });