Registry / devops / live-elements-js-compiler

live-elements-js-compiler

JSON →
library0.1.20jsnpmunverified

A compiler that translates Live Elements (.lv) files into JavaScript modules. Version 0.1.20 is the current stable release, with an undocumented release cadence. It resolves dependencies and handles imports automatically. Compared to other transpilers, it is specific to Live Elements, providing options for base components, implicit types, and output extensions. Targeted at the Live Elements ecosystem for building web components.

npm install live-elements-js-compiler
INSTALL
IMPORT
SIG · LIVE-ELEMENTS-JS-C
L
live-elements-js-compiler
devopsjavascriptv0.1.20
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.

compile
import { compile } from 'live-elements-js-compiler'
import compile from 'live-elements-js-compiler'
The package uses named export compile, not default export.
compile
const { compile } = require('live-elements-js-compiler')
const compile = require('live-elements-js-compiler')
CommonJS require with destructuring is required.
type CompileOptions
import type { CompileOptions } from 'live-elements-js-compiler'
Type import for TypeScript users.

Shows how to compile a Live Elements .lv file into a JavaScript module using the compile function with options and a callback.

import { compile } from 'live-elements-js-compiler'; const options = { baseComponent: 'BaseElement', baseComponentPath: 'live-elements-core/baseelement.js', implicitTypes: ['document', 'Error', 'Object', 'Math'], importLocalPath: 'node_modules', packageBuildPath: 'build', outputExtension: 'mjs' }; compile('main.lv', options, (result, err) => { if (err) { console.log('Error: ' + err.message); return; } console.log('Compiled file at: ' + result); });
Debug
Known issues
breakingIn version 0.1.0, the callback signature changed from (err, result) to (result, err).
fix
Update callback parameter order to (result, err).
affects: >=0.1.0
deprecatedThe 'compile' function is the only export; future versions may split into separate exports for parsing and codegen.
fix
Prepare to import from subpaths if needed in v1.
affects: <1.0
gotchaThe 'options' object must not contain undefined values; otherwise, compile may throw silently.
fix
Ensure all options parameters are explicitly defined or set to empty strings.
affects: all
gotchaIf 'outputExtension' is omitted, files are written with .mjs extension by default, which may cause issues with CJS projects.
fix
Set outputExtension explicitly to 'js' if targeting CommonJS.
affects: all
gotchaThe 'pathToLvFile' must be an absolute path; relative paths cause an error.
fix
Use path.resolve() to convert relative paths to absolute.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'live-elements-js-compiler'
Package not installed or import path incorrect.
fix
Run 'npm install live-elements-js-compiler' and ensure import is correct.
TypeError: compile is not a function
Default import used instead of named import.
fix
Use 'import { compile }' instead of 'import compile'.
Error: ENOENT: no such file or directory, open '...'
The pathToLvFile does not exist or is relative.
fix
Provide an absolute path to the .lv file.
Upgrade
Version history
0.1.20latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
live-elements-js-compiler — npm install live-elements-js-compiler · libregistry