Registry / web-framework / eo2js
library0.0.8jsnpmunverified

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.

npm install eo2js
INSTALL
IMPORT
SIG · EO2JS
E
eo2js
web-frameworkjavascriptv0.0.8
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.

eo2js
import eo2js from 'eo2js'
const eo2js = require('eo2js')
Package uses ESM only; CJS require will fail with ERR_REQUIRE_ESM
compile
import { compile } from 'eo2js'
import compile from 'eo2js'
compile is a named export, not default
Package
import { Package } from 'eo2js'
Used for object composition; available since 0.0.5

This code transpiles a simple EO program to JavaScript and executes it using the eolang runtime.

import eo2js from 'eo2js'; // Sample EO program const eoCode = ` [] > main "Hello, EO!" > msg QQ.io.stdout > @ msg \n `; try { const jsCode = eo2js(eoCode, { target: 'node' }); console.log('Transpiled JS:'); console.log(jsCode); // Execute the generated JS (requires eolang runtime) const { evaluate } = await import('eolang'); const result = await evaluate(jsCode); console.log('Output:', result); } catch (err) { console.error('Transpilation failed:', err); }
eo2js --version
Debug
Known issues
breakingAPI changes between minor versions: eo2js function signature changed in 0.0.5 from (code, options) to (source, options).
fix
Update calls to use new parameter order: eo2js(source, options)
affects: <0.0.5
breakingDefault export removed in 0.0.7; use named exports like compile instead.
fix
import { compile } from 'eo2js' instead of import eo2js from 'eo2js'
affects: >=0.0.7
gotchaTranspiled JS requires eolang runtime to execute; not standalone.
fix
Ensure eolang package is installed and imported before executing transpiled code
affects: *
deprecatedOptions.target deprecated since 0.0.6; use options.platform instead.
fix
Replace target with platform in options object
affects: >=0.0.6
Errors
Common errors & fixes
Error: Cannot find module 'eo2js'
Package is not installed or import path incorrect.
fix
Run npm install eo2js and ensure you are using ESM import syntax (not require).
SyntaxError: Unexpected token 'export'
Using CommonJS require() with an ESM-only package.
fix
Change to import statement and use .mjs file extension or 'type':'module' in package.json.
TypeError: eo2js is not a function
Default import used when package only provides named exports.
fix
Use import { compile } from 'eo2js' or import * as eo2js from 'eo2js' and call eo2js.compile().
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies
eolangrequiredRuntime for EOLANG base objects (e.g., bytes, int, string)
Agent activity
4 hits · last 30 days
node
4
Resources
eo2js — npm install eo2js · libregistry