Registry / web-framework / boilerplate-compiler

boilerplate-compiler

JSON →
library1.0.3jsnpmunverified

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.

npm install boilerplate-compiler
INSTALL
IMPORT
SIG · BOILERPLATE-COMPIL
B
boilerplate-compiler
web-frameworkjavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import compiler from 'boilerplate-compiler'
const compiler = require('boilerplate-compiler')
Package only provides CommonJS exports; default import works in ESM via bundlers.
compileFile
const { compileFile } = require('boilerplate-compiler');
import { compileFile } from 'boilerplate-compiler';
CommonJS usage is safer; named import may fail in Node ESM or bundlers without named exports.
compileGrid
const { compileGrid } = require('boilerplate-compiler');
import compileGrid from 'boilerplate-compiler';
compileGrid is not a default export; default export is an object with methods.
parse
const { parse } = require('boilerplate-compiler');
import { parse } from 'boilerplate-compiler';
parse is a named export available via destructuring require.

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.

const compiler = require('boilerplate-compiler'); const grid = {"0,0":"shuttle","1,0":"nothing","2,0":"negative"}; const result = compiler.compileGrid(grid, { stream: process.stdout, fillMode: 'shuttles', module: 'bare' }); console.log('Compiled output:'); console.log(result);
boilerplate-compiler --version
Debug
Known issues
breakingThe compiler rejects grids where two shuttles could ever occupy the same cell, even if path constraints prevent it.
fix
Redesign grid layout to ensure shuttles never have overlapping potential states.
affects: >=0.0.0
deprecatedThe 'stream' option in compileFile/compileGrid is fragile and output may be silently lost if stream closes early.
fix
Avoid using stream; capture output via string concatenation or implement a wrapper.
affects: >=1.0.0
gotchaThe parser output format (AST structure) is unstable and may change between minor versions.
fix
Do not rely on specific property names or nesting; treat parser result as opaque.
affects: >=0.0.0
gotchaNo button support: any grid with buttons will cause compile errors or undefined behavior.
fix
Remove buttons from the grid before compiling.
affects: >=0.0.0
gotchaPressure querying is not exposed – the compiled output's step function returns states but not pressure values.
fix
Wrap the compiled module to track pressure manually by analyzing region geometry.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Grid contains overlapping shuttle states
Two shuttles have potential states in the same cell, even if never simultaneously reachable.
fix
Modify shuttle paths or initial positions to eliminate overlap.
Cannot read property '0' of undefined
Missing or malformed grid data (e.g., key not in 'x,y' format).
fix
Ensure grid object uses string keys like '0,0' and values are valid Boilerplate cell types.
TypeError: compiler.compileGrid is not a function
Importing default export but calling as named method (wrong import style).
fix
Use const compiler = require('boilerplate-compiler'); then compiler.compileGrid(...).
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
8
OpenAI (training)
1
Resources
boilerplate-compiler — npm install boilerplate-compiler · libregistry