{"id":25008,"library":"boilerplate-compiler","title":"Boilerplate Compiler","description":"A compiler for the Boilerplate cellular automaton game, converting grid layouts into executable JavaScript that simulates shuttle movement and pressure. Current version 1.0.3 (unstable, no recent updates). Includes a parser (coffee-script) from grid JSON to an AST-like structure and a JS codegen outputting either bare functions, Node modules, or IIFE wrappers. Key limitations: cannot compile worlds where two shuttles could conflict, lacks button support, and has a primitive pressure API. No TypeScript types, limited test coverage, and brittle against grid complexity.","status":"maintenance","version":"1.0.3","language":"javascript","source_language":"en","source_url":"git://github.com/josephg/boilerplate-compiler","tags":["javascript","boilerplate","compiler"],"install":[{"cmd":"npm install boilerplate-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add boilerplate-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add boilerplate-compiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package only provides CommonJS exports; default import works in ESM via bundlers.","wrong":"const compiler = require('boilerplate-compiler')","symbol":"default","correct":"import compiler from 'boilerplate-compiler'"},{"note":"CommonJS usage is safer; named import may fail in Node ESM or bundlers without named exports.","wrong":"import { compileFile } from 'boilerplate-compiler';","symbol":"compileFile","correct":"const { compileFile } = require('boilerplate-compiler');"},{"note":"compileGrid is not a default export; default export is an object with methods.","wrong":"import compileGrid from 'boilerplate-compiler';","symbol":"compileGrid","correct":"const { compileGrid } = require('boilerplate-compiler');"},{"note":"parse is a named export available via destructuring require.","wrong":"import { parse } from 'boilerplate-compiler';","symbol":"parse","correct":"const { parse } = require('boilerplate-compiler');"}],"quickstart":{"code":"const compiler = require('boilerplate-compiler');\nconst grid = {\"0,0\":\"shuttle\",\"1,0\":\"nothing\",\"2,0\":\"negative\"};\nconst result = compiler.compileGrid(grid, { stream: process.stdout, fillMode: 'shuttles', module: 'bare' });\nconsole.log('Compiled output:');\nconsole.log(result);","lang":"javascript","description":"Demonstrates importing the compiler, defining a simple grid, and compiling it with options. Note: compileGrid returns undefined when stream is set; output goes to stream."},"warnings":[{"fix":"Redesign grid layout to ensure shuttles never have overlapping potential states.","message":"The compiler rejects grids where two shuttles could ever occupy the same cell, even if path constraints prevent it.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Avoid using stream; capture output via string concatenation or implement a wrapper.","message":"The 'stream' option in compileFile/compileGrid is fragile and output may be silently lost if stream closes early.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Do not rely on specific property names or nesting; treat parser result as opaque.","message":"The parser output format (AST structure) is unstable and may change between minor versions.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Remove buttons from the grid before compiling.","message":"No button support: any grid with buttons will cause compile errors or undefined behavior.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Wrap the compiled module to track pressure manually by analyzing region geometry.","message":"Pressure querying is not exposed – the compiled output's step function returns states but not pressure values.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Modify shuttle paths or initial positions to eliminate overlap.","cause":"Two shuttles have potential states in the same cell, even if never simultaneously reachable.","error":"Error: Grid contains overlapping shuttle states"},{"fix":"Ensure grid object uses string keys like '0,0' and values are valid Boilerplate cell types.","cause":"Missing or malformed grid data (e.g., key not in 'x,y' format).","error":"Cannot read property '0' of undefined"},{"fix":"Use const compiler = require('boilerplate-compiler'); then compiler.compileGrid(...).","cause":"Importing default export but calling as named method (wrong import style).","error":"TypeError: compiler.compileGrid is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}