jelenjs-compiler
v0.1.7
Published
Compiler and build-time tools for JelenJS framework
Downloads
23
Maintainers
Readme
JelenJS Compiler
Build-time tools and compilers for the JelenJS framework.
Overview
This package contains all the compilation and build-time analysis tools for JelenJS, separated from the runtime for better modularity and smaller bundle sizes.
Features
- AST-based compilation - Uses TypeScript and Meriyah parsers for robust code analysis
- Static analysis - Analyzes signal usage and component dependencies
- Conditional expression transformation - Automatically wraps reactive conditional expressions
- Production optimizations - Advanced optimizations for production builds
- Caching - Intelligent caching for faster builds
Installation
npm install jelenjs-compilerUsage
Basic Compilation
import { compile } from 'jelenjs-compiler';
const result = compile(sourceCode, {
filename: 'component.tsx',
production: false
});Static Analysis
import { analyzeComponent } from 'jelenjs-compiler';
const analysis = analyzeComponent(sourceCode, 'component.tsx');
console.log('Signals found:', analysis.signals);
console.log('Components used:', analysis.components);AST Utilities
import {
parseSourceToAST,
isReactiveConditionalExpression,
findSignalDeclarations
} from 'jelenjs-compiler';
const ast = parseSourceToAST(sourceCode);
const signals = findSignalDeclarations(sourceCode);Architecture
This package is designed to be used at build-time only. The main JelenJS runtime (jelenjs package) does not include any compilation code, keeping it lightweight for production use.
Modules
- compiler.ts - Main compilation logic
- compiler-prod.ts - Production-specific optimizations
- static-analyzer.ts - Code analysis and signal detection
- ast-utils.ts - AST manipulation utilities
- parser.ts - Source code parsing
- cache.ts - Build caching system
Integration
This package is automatically used by:
jelenjs-vite- Vite plugin for JelenJS- Other build tools and bundlers
License
MIT
