{"id":27193,"library":"objj-transpiler","title":"ObjJAcornCompiler - JavaScript/Objective-J Transpiler","description":"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.","status":"active","version":"1.0.0-10","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/mrcarlberg/ObjJAcornCompiler","tags":["javascript","source","source code","JavaScript","ECMAScript","Objective-J","preprocessor","pre-processor","pre processor"],"install":[{"cmd":"npm install objj-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add objj-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add objj-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package is ESM-only since v1.0.0; CommonJS require is not supported.","wrong":"const transpiler = require('objj-transpiler')","symbol":"default","correct":"import transpiler from 'objj-transpiler'"},{"note":"Named export for the main transpile function.","wrong":"","symbol":"transpile","correct":"import { transpile } from 'objj-transpiler'"},{"note":"The Parser class is a named export, not default.","wrong":"import Parser from 'objj-transpiler'","symbol":"Parser","correct":"import { Parser } from 'objj-transpiler'"}],"quickstart":{"code":"import { transpile } from 'objj-transpiler';\n\nconst code = `\n#define MAX(x, y) (x > y ? x : y)\nvar m1 = MAX(a, b);\nvar m2 = MAX(14, 20);\n`;\n\nconst result = transpile(code, {\n  module: false,\n  ecmaVersion: 'latest',\n  loose: false,\n  noObjj: false,\n  noPreprocess: false\n});\n\nconsole.log(result.code);\n// Output:\n// var m1 = a > b ? a : b;\n// var m2 = 14 > 20 ? 14 : 20;","lang":"typescript","description":"Transpile JavaScript with preprocessor macros (e.g., #define) using the transpile function, showing macro expansion."},"warnings":[{"fix":"Pin to a specific version and test thoroughly.","message":"Version 1.0.0-10 is a pre-release; API may change without notice.","severity":"breaking","affected_versions":">=1.0.0-10 <1.0.0-10"},{"fix":"Pass { module: true } to transpile instead of --module.","message":"The --module flag is replaced by parser options; use 'module' property in options object instead.","severity":"deprecated","affected_versions":">=1.0.0-0"},{"fix":"Ensure noObjj is false if using preprocessor directives.","message":"Preprocessor only works with Objective-J code; using --no-objj disables it.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Declare superclasses in the same file or use the Objective-J runtime.","message":"The transpiler cannot resolve cross-file Objective-J dependencies without the Objective-J runtime.","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":"Run 'npm install objj-transpiler@1.0.0-10' and ensure node_modules is in require path.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'objj-transpiler'"},{"fix":"Use 'loose: true' in options or ensure code is valid JavaScript/Objective-J.","cause":"Non-Objective-J code with loose settings may cause parsing errors.","error":"SyntaxError: Unexpected token: punc (;)"},{"fix":"Use 'import { transpile } from 'objj-transpiler'' instead of default import.","cause":"Using default import incorrectly; the package exports named exports.","error":"TypeError: transpiler is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}