Yox Expression Compiler
raw JSON → 0.18.0 verified Fri May 01 auth: no javascript
An expression compiler for Yox.js, version 0.18.0. It compiles template expressions into executable code for reactive rendering. Part of the Yox.js ecosystem, this package is designed to work with yox-common and is maintained as part of the broader Yox framework. It offers a lightweight, performant alternative to larger template compilers by focusing specifically on expression compilation.
Common errors
error Cannot find module 'yox-expression-compiler' or its corresponding type declarations. ↓
cause Missing or mismatched peer dependency or incorrect import path.
fix
Ensure yox-common is installed and correct version: npm install yox-common@^0.20.0
error Attempted import error: 'compileExpression' is not exported from 'yox-expression-compiler'. ↓
cause Using a version prior to 0.18.0 where the function may have different name or not exported.
fix
Upgrade to version 0.18.0 and use named import as documented.
Warnings
breaking Removed default export in version 0.18.0; all exports are now named. ↓
fix Use named imports like `import { compileExpression } from 'yox-expression-compiler'` instead of default import.
breaking yox-common peer dependency updated to ^0.20.0; incompatible with older versions. ↓
fix Ensure yox-common version 0.20.0 or compatible is installed in your project.
gotcha Expression types are only available in TypeScript projects; plain JavaScript users cannot import them. ↓
fix If using JavaScript, avoid importing type-only symbols.
Install
npm install yox-expression-compiler yarn add yox-expression-compiler pnpm add yox-expression-compiler Imports
- compileExpression wrong
const compileExpression = require('yox-expression-compiler');correctimport { compileExpression } from 'yox-expression-compiler' - Expression wrong
import { Expression } from 'yox-expression-compiler'correctimport type { Expression } from 'yox-expression-compiler' - createExpression wrong
import createExpression from 'yox-expression-compiler'correctimport { createExpression } from 'yox-expression-compiler'
Quickstart
import { compileExpression } from 'yox-expression-compiler';
const expr = "a + b";
const compiled = compileExpression(expr);
console.log(compiled); // { code: 'var _f = function(a,b) { return a + b; };', ... }