{"id":24983,"library":"bay-lang","title":"BayLang Compiler","description":"BayLang Compiler (v1.2.2) is the core compiler for the BayLang programming language, a full-stack language that automatically splits code into backend and frontend, supporting reactivity and server-side rendering. This package compiles BayLang to Node.js. Release cadence is irregular, with recent updates adding frontend component support (1.2.2), HTML template translation (1.2.1), and async/await features (1.2). Key differentiator: single codebase for both client and server with automatic platform adaptation. Designed for web application, website, and CRM development with an integrated constructor and widget ecosystem.","status":"active","version":"1.2.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install bay-lang","lang":"bash","label":"npm"},{"cmd":"yarn add bay-lang","lang":"bash","label":"yarn"},{"cmd":"pnpm add bay-lang","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM default export; CommonJS require may not work in newer versions.","wrong":"const bayLang = require('bay-lang')","symbol":"default","correct":"import bayLang from 'bay-lang'"},{"note":"Named export; do not use subpath imports.","wrong":"import compile from 'bay-lang/compile'","symbol":"compile","correct":"import { compile } from 'bay-lang'"},{"note":"Property is lowercase; also accessible as bayLang.version.","wrong":"import { VERSION } from 'bay-lang'","symbol":"version","correct":"import { version } from 'bay-lang'"},{"note":"Runtime is a named export for runtime library; not default.","symbol":"Runtime","correct":"import { Runtime } from 'bay-lang'"}],"quickstart":{"code":"import { compile, version } from 'bay-lang';\nimport fs from 'fs';\n\nconst sourceCode = `\nfunction greet(name: string) {\n  return \"Hello, \" + name;\n}\n`;\n\ntry {\n  const result = compile(sourceCode, { target: 'nodejs' });\n  console.log('Compiled JS:', result.code);\n  console.log('BayLang version:', version);\n} catch (err) {\n  console.error('Compilation failed:', err.message);\n}\n","lang":"typescript","description":"Compiles a simple BayLang function to Node.js JavaScript."},"warnings":[{"fix":"Use new Runtime from 'bay-lang' instead of separate 'bay-lang-runtime' package.","message":"Version 1.0 removed legacy runtime core; existing projects must update imports.","severity":"breaking","affected_versions":">=1.0"},{"fix":"Use 'npx bay-lang version' or call programmatically.","message":"The CLI command 'bay-lang-nodejs version' is deprecated; use 'bay-lang version'.","severity":"deprecated","affected_versions":">=1.2"},{"fix":"Use import statements or dynamic import().","message":"ESM-only from version 1.0; CommonJS require() will fail.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Replace 'fn' keyword with 'pure' in BayLang source.","message":"Version 0.7.0 changed lambda syntax from 'fn' to 'pure' for functions.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"Upgrade Node.js to version 14 or higher.","message":"BayLang compiler requires Node.js >=14; older versions may have runtime issues.","severity":"gotcha","affected_versions":">=1.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 bay-lang' and use dynamic import: 'const bayLang = await import('bay-lang');'","cause":"Package not installed or ESM import used in CommonJS environment.","error":"Cannot find module 'bay-lang'"},{"fix":"Use 'import { compile } from 'bay-lang';' instead of default import.","cause":"Default import instead of named import for compile.","error":"TypeError: bayLang.compile is not a function"},{"fix":"Check package version; upgrade to >=1.0 or use default import 'import bayLang from 'bay-lang'' then bayLang.compile.","cause":"Using named import with a version that exports differently (pre-1.0).","error":"SyntaxError: The requested module 'bay-lang' does not provide an export named 'compile'"},{"fix":"Use target 'nodejs' for frontend or 'php' for backend.","cause":"Only 'nodejs' and 'php' targets supported; 'react' is not valid.","error":"Error: Unsupported target 'react'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}