{"library":"node-elm-compiler","title":"node-elm-compiler","description":"Node.js interface to compile Elm 0.19 sources using the official Elm compiler binaries. Current stable version 5.0.6. Provides a programmatic API for compiling Elm files to JavaScript or HTML, finding module dependencies, and reporting compile errors. Key differentiators: wraps the Elm binary, supports sync and async compilation, debug and optimize modes, and respects the elm.json configuration. Notably, requires Elm itself to be installed separately and handles version-specific flags for Elm 0.19.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install node-elm-compiler"],"cli":null},"imports":["import { compile } from 'node-elm-compiler'","import { compileToString } from 'node-elm-compiler'","import { findAllDependencies } from 'node-elm-compiler'","import { compileSync } from 'node-elm-compiler'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { compileToString } from 'node-elm-compiler';\nimport path from 'path';\n\nconst elmSource = path.resolve('src/Main.elm');\n\nasync function build() {\n  try {\n    const jsString = await compileToString([elmSource], {\n      optimize: false,\n      debug: false,\n      cwd: process.cwd(),\n      pathToMake: '' // uses system PATH\n    });\n    console.log('Compiled output length:', jsString.length);\n    // write to file etc.\n  } catch (err) {\n    console.error('Compilation failed:', err.message);\n  }\n}\n\nbuild();","lang":"typescript","description":"Demonstrates async compilation of an Elm source file to a JavaScript string using named import and options object.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}