Registry / web-framework / objj-transpiler

objj-transpiler

JSON →
library1.0.0-10jsnpmunverified

ObjJAcornCompiler is a tiny, fast JavaScript and Objective-J transpiler with a built-in C-like preprocessor, written in JavaScript. The current version is 1.0.0-10 (pre-release), built on an extended Acorn parser. It supports multiple ECMAScript versions (ECMA5, ECMA8, latest), loose mode, and various output options like AST generation and source maps. Key differentiators: it is the primary transpiler for the Cappuccino framework, targeting Objective-J 2.0 syntax; includes a preprocessor for macros and conditionals; and is available as an npm package. However, it cannot compile Objective-J code that depends on other files without the Objective-J runtime.

npm install objj-transpiler
INSTALL
IMPORT
SIG · OBJJ-TRANSPILER
O
objj-transpiler
web-frameworkjavascriptv1.0.0-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.

default
import transpiler from 'objj-transpiler'
const transpiler = require('objj-transpiler')
The package is ESM-only since v1.0.0; CommonJS require is not supported.
transpile
import { transpile } from 'objj-transpiler'
Named export for the main transpile function.
Parser
import { Parser } from 'objj-transpiler'
import Parser from 'objj-transpiler'
The Parser class is a named export, not default.

Transpile JavaScript with preprocessor macros (e.g., #define) using the transpile function, showing macro expansion.

import { transpile } from 'objj-transpiler'; const code = ` #define MAX(x, y) (x > y ? x : y) var m1 = MAX(a, b); var m2 = MAX(14, 20); `; const result = transpile(code, { module: false, ecmaVersion: 'latest', loose: false, noObjj: false, noPreprocess: false }); console.log(result.code); // Output: // var m1 = a > b ? a : b; // var m2 = 14 > 20 ? 14 : 20;
Debug
Known issues
breakingVersion 1.0.0-10 is a pre-release; API may change without notice.
fix
Pin to a specific version and test thoroughly.
affects: >=1.0.0-10 <1.0.0-10
deprecatedThe --module flag is replaced by parser options; use 'module' property in options object instead.
fix
Pass { module: true } to transpile instead of --module.
affects: >=1.0.0-0
gotchaPreprocessor only works with Objective-J code; using --no-objj disables it.
fix
Ensure noObjj is false if using preprocessor directives.
affects: >=0.0.0
gotchaThe transpiler cannot resolve cross-file Objective-J dependencies without the Objective-J runtime.
fix
Declare superclasses in the same file or use the Objective-J runtime.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'objj-transpiler'
Package not installed or not in node_modules.
fix
Run 'npm install objj-transpiler@1.0.0-10' and ensure node_modules is in require path.
SyntaxError: Unexpected token: punc (;)
Non-Objective-J code with loose settings may cause parsing errors.
fix
Use 'loose: true' in options or ensure code is valid JavaScript/Objective-J.
TypeError: transpiler is not a function
Using default import incorrectly; the package exports named exports.
fix
Use 'import { transpile } from 'objj-transpiler'' instead of default import.
Upgrade
Version history
1.0.0-10latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
objj-transpiler — npm install objj-transpiler · libregistry