{"id":26088,"library":"polysol-js-core","title":"PolySol-JS","description":"PolySol-JS is a modular transpiler that converts JavaScript/TypeScript source code into an intermediate JSON representation (IR) and then into Solidity smart contracts. Version 1.0.1 is the current stable release. The project is in early stages with no public npm release, only installation via git clone. Its key differentiators are a standardized IR decoupling parsing from code generation, enabling extensibility to other source languages and target blockchains, and an educational focus on transpiler internals. Alternatives like Sol2Ink compile Solidity to Rust, while PolySol-JS targets Solidity from JS/TS.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","solidity","transpiler","compiler","java"],"install":[{"cmd":"npm install polysol-js-core","lang":"bash","label":"npm"},{"cmd":"yarn add polysol-js-core","lang":"bash","label":"yarn"},{"cmd":"pnpm add polysol-js-core","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for TypeScript compilation; listed as devDependency but needed for development.","package":"typescript","optional":true}],"imports":[{"note":"ESM-only; package does not provide CommonJS exports.","wrong":"const PolySol = require('polysol-js-core')","symbol":"PolySol","correct":"import { PolySol } from 'polysol-js-core'"},{"note":"IRSchema is in a subpath; not exported from main entry.","wrong":"import { IRSchema } from 'polysol-js-core'","symbol":"IRSchema","correct":"import { IRSchema } from 'polysol-js-core/ir'"},{"note":"Parser is a named export from a subpath, not default export.","wrong":"import Parser from 'polysol-js-core'","symbol":"Parser","correct":"import { Parser } from 'polysol-js-core/parser'"}],"quickstart":{"code":"import { parseJavaScript } from 'polysol-js-core/parser';\nimport { generateSolidity } from 'polysol-js-core/generator';\nimport { readFileSync } from 'fs';\n\nconst sourceCode = readFileSync('contract.js', 'utf8');\nconst ir = parseJavaScript(sourceCode); // returns IR object\nconst solidityCode = generateSolidity(ir);\nconsole.log(solidityCode);\n","lang":"typescript","description":"Shows how to transpile a JS file to Solidity using the modular parser and generator."},"warnings":[{"fix":"Use import syntax or configure Node.js for ESM (type: 'module' in package.json).","message":"ESM-only: Package does not support CommonJS require().","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Import directly from subpaths like 'polysol-js-core/parser', 'polysol-js-core/generator'.","message":"Subpath exports: Core symbols are not re-exported from the main entry.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Run: git clone https://github.com/your-username/polysol-js.git","message":"No public npm registry: Install via git clone only.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Upgrade Node.js to v14 or higher.","message":"Requires Node.js v14+; older versions will throw syntax errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check repository roadmap; currently using the IR schema only.","message":"Parser and generator prototypes; actual transpilation is not yet implemented.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Run 'npm run build' first, then 'npm start' (if scripts are configured).","message":"npm start command may not work due to missing build step.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install locally: npm install /path/to/polysol-js","cause":"Package not published to npm; installed via git clone.","error":"Cannot find module 'polysol-js-core'"},{"fix":"Use import syntax or set type: 'module' and use import().","cause":"Package is ESM-only, CommonJS require() fails.","error":"require() of ES Module not supported"},{"fix":"Use import { IRSchema } from 'polysol-js-core/ir'","cause":"Importing from main entry instead of subpath 'polysol-js-core/ir'.","error":"Module 'polysol-js-core' has no exported member 'IRSchema'"},{"fix":"Add \"type\": \"module\" to package.json or use .mjs extension.","cause":"Running as CommonJS without ESM support.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}