{"id":26403,"library":"smack-js-compiler","title":"Smack JS Compiler","description":"A compiler/transpiler for the purely functional language 'Smack', converting Smack source code to JavaScript. The current stable version is 1.1.1, with moderate release cadence. Key differentiator: it compiles a minimal functional language to JavaScript, targeting both Node.js and browser environments. Written in JavaScript, it includes a parser and intermediary representation. Not to be confused with other Smack-related tools.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/bvellacott/smack-js-compiler#readme","tags":["javascript","pure","functional","language","smack","parser","compiler","intermediary"],"install":[{"cmd":"npm install smack-js-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add smack-js-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add smack-js-compiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; named export.","wrong":"const compile = require('smack-js-compiler')","symbol":"compile","correct":"import { compile } from 'smack-js-compiler'"},{"note":"Named export, not default.","wrong":"import parse from 'smack-js-compiler'","symbol":"parse","correct":"import { parse } from 'smack-js-compiler'"},{"note":"Class export, named.","wrong":"import SmackCompiler from 'smack-js-compiler'","symbol":"SmackCompiler","correct":"import { SmackCompiler } from 'smack-js-compiler'"}],"quickstart":{"code":"import { compile } from 'smack-js-compiler';\n\nconst smackCode = `\n  def main = add(2, 3)\n  def add(a, b) = a + b\n`;\n\ntry {\n  const jsCode = compile(smackCode);\n  console.log(jsCode);\n} catch (err) {\n  console.error('Compilation failed:', err.message);\n}","lang":"typescript","description":"Compiles a simple Smack function definition to JavaScript using the named compile export."},"warnings":[{"fix":"Add a declaration file or use `// @ts-ignore`.","message":"The package does not provide type definitions; TypeScript users may need to declare module.","severity":"gotcha","affected_versions":"*"},{"fix":"Update imports from `import compile from 'smack-js-compiler'` to `import { compile } from 'smack-js-compiler'`.","message":"Version 1.0.0 changed the primary export from default to named (`compile`).","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Replace `parse(code)` with `compile(code, { parseOnly: true })`.","message":"The `parse` function was marked deprecated in v1.1.0; use `compile` with parse options instead.","severity":"deprecated","affected_versions":">=1.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Switch to ESM imports: `import { compile } from 'smack-js-compiler'`.","cause":"Using CommonJS require in an ESM-only package.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Install the package: `npm install smack-js-compiler`.","cause":"Package not installed or incorrect import path.","error":"Cannot find module 'smack-js-compiler'"},{"fix":"Use named import: `import { compile } from 'smack-js-compiler'`.","cause":"Default import used when export is named.","error":"TypeError: compile is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}