String preprocessor implementing C/GLSL preprocessor-style directives (#define, #if, #ifdef, #elif, #else, #endif) for JavaScript environments. Version 2.0+ uses ESM and uses 'subscript' for expression evaluation. Designed for glsl-transpiler, it supports variable interpolation and macro functions. Lightweight, no external dependencies. Ideal for preprocessing GLSL shader code or any string that benefits from compile-time conditionals.
npm install preprNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of prepr with #define, #ifdef, and variable interpolation.
Use `import prepr from 'prepr'` in an ESM context or use dynamic import.
Test expressions with new evaluator; avoid unsupported features.
Use provided variables or macros directly; do not rely on full C preprocessor.
Change to import: `import prepr from 'prepr'` and ensure project type: module or use .mjs extension.
Either convert to ESM or use dynamic import: `const prepr = (await import('prepr')).default`No dependency data recorded yet.