{"id":25231,"library":"eo2js","title":"eo2js","description":"eo2js is a transpiler that converts EOLANG (EO) programs to JavaScript, enabling execution in Node.js and browser environments. Current version 0.0.8 is pre-1.0 with active development. It translates EO objects and contracts into equivalent JS classes and functions, preserving the purely object-oriented paradigm. Unlike general transpilers, it is purpose-built for EO's abstract object model, including attributes, dataization, and runtime type checking. Release cadence is irregular; frequent breaking changes expected. Differentiators: native EO-to-JS mapping, minimal runtime, and support for EO's freeze/lock semantics.","status":"active","version":"0.0.8","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","eolang","translator"],"install":[{"cmd":"npm install eo2js","lang":"bash","label":"npm"},{"cmd":"yarn add eo2js","lang":"bash","label":"yarn"},{"cmd":"pnpm add eo2js","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime for EOLANG base objects (e.g., bytes, int, string)","package":"eolang","optional":false}],"imports":[{"note":"Package uses ESM only; CJS require will fail with ERR_REQUIRE_ESM","wrong":"const eo2js = require('eo2js')","symbol":"eo2js","correct":"import eo2js from 'eo2js'"},{"note":"compile is a named export, not default","wrong":"import compile from 'eo2js'","symbol":"compile","correct":"import { compile } from 'eo2js'"},{"note":"Used for object composition; available since 0.0.5","wrong":"","symbol":"Package","correct":"import { Package } from 'eo2js'"}],"quickstart":{"code":"import eo2js from 'eo2js';\n\n// Sample EO program\nconst eoCode = `\n[] > main\n  \"Hello, EO!\" > msg\n  QQ.io.stdout > @\n    msg\n    \\n\n`;\n\ntry {\n  const jsCode = eo2js(eoCode, { target: 'node' });\n  console.log('Transpiled JS:');\n  console.log(jsCode);\n  // Execute the generated JS (requires eolang runtime)\n  const { evaluate } = await import('eolang');\n  const result = await evaluate(jsCode);\n  console.log('Output:', result);\n} catch (err) {\n  console.error('Transpilation failed:', err);\n}\n","lang":"javascript","description":"This code transpiles a simple EO program to JavaScript and executes it using the eolang runtime."},"warnings":[{"fix":"Update calls to use new parameter order: eo2js(source, options)","message":"API changes between minor versions: eo2js function signature changed in 0.0.5 from (code, options) to (source, options).","severity":"breaking","affected_versions":"<0.0.5"},{"fix":"import { compile } from 'eo2js' instead of import eo2js from 'eo2js'","message":"Default export removed in 0.0.7; use named exports like compile instead.","severity":"breaking","affected_versions":">=0.0.7"},{"fix":"Ensure eolang package is installed and imported before executing transpiled code","message":"Transpiled JS requires eolang runtime to execute; not standalone.","severity":"gotcha","affected_versions":"*"},{"fix":"Replace target with platform in options object","message":"Options.target deprecated since 0.0.6; use options.platform instead.","severity":"deprecated","affected_versions":">=0.0.6"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run npm install eo2js and ensure you are using ESM import syntax (not require).","cause":"Package is not installed or import path incorrect.","error":"Error: Cannot find module 'eo2js'"},{"fix":"Change to import statement and use .mjs file extension or 'type':'module' in package.json.","cause":"Using CommonJS require() with an ESM-only package.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Use import { compile } from 'eo2js' or import * as eo2js from 'eo2js' and call eo2js.compile().","cause":"Default import used when package only provides named exports.","error":"TypeError: eo2js is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}