Registry / web-framework / atom-expression-compiler

atom-expression-compiler

JSON →
library2.2.4jsnpmunverified

A Vue expression compiler for server-side rendering (SSR) that pre-compiles Vue template expressions into executable JavaScript functions. Version 2.2.4 supports modern Vue 3 syntax and provides faster runtime evaluation compared to traditional string-based evaluation. It handles interpolation, filters, and complex expressions with proper scoping. The package is lightweight, has no runtime dependencies, and is designed specifically for SSR optimization in Vue applications. It is actively maintained with monthly releases.

npm install atom-expression-compiler
INSTALL
IMPORT
SIG · ATOM-EXPRESSION-CO
A
atom-expression-compiler
web-frameworkjavascriptv2.2.4
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.

compileExpression
import { compileExpression } from 'atom-expression-compiler'
const { compileExpression } = require('atom-expression-compiler')
ESM-only since v2. CommonJS require will fail.
CompileResult
import type { CompileResult } from 'atom-expression-compiler'
TypeScript consumers should use type import for the return type interface.
default
import compiler from 'atom-expression-compiler'
import { default as compiler } from 'atom-expression-compiler'
Default export is available but named export recommended.

Demonstrates compiling a simple Vue template expression into a render function with compact output.

import { compileExpression } from 'atom-expression-compiler'; const expr = 'name + " - " + age'; const code = compileExpression(expr, { compact: true, sourceMap: false }); console.log(code); // Output: function anonymous($event,_ctx,_c,_ssrAttr) { return _ctx.name + ' - ' + _ctx.age }
Debug
Known issues
breakingRequirement for ESM imports only; CommonJS require throws error.
fix
Use ES module imports (import syntax) instead of require(). If using CommonJS, stick with version 1.x.
affects: >=2.0.0
deprecatedThe 'sourceMap' option is deprecated and will be removed in v3.
fix
Remove 'sourceMap' option from compile call; it is now always false.
affects: >=2.0.0 <3.0.0
gotchaCompiled functions rely on global _ctx variable; ensure context is passed correctly.
fix
Wrap compiled code with proper scope passing _ctx, e.g., using Function.prototype.call.
affects: >=1.0.0
breakingReturn type changed from string to object in v2.
fix
Access compiled code via .code property instead of directly using the returned value.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'atom-expression-compiler'
Package not installed or incorrect import path.
fix
Run 'npm install atom-expression-compiler' and ensure import path is correct.
'require' is not defined in ES module scope
Using require() with ESM-only version.
fix
Use import statement or downgrade to version 1.x.
TypeError: compiler is not a function
Default import used for a named export.
fix
Use named import: import { compileExpression } from 'atom-expression-compiler'.
Unexpected token 'export'
Running code in a CommonJS environment without ESM support.
fix
Enable ESM in package.json ("type": "module") or use bundler.
Upgrade
Version history
2.2.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
atom-expression-compiler — npm install atom-expression-compiler · libregistry