Registry / serialization / livescript-compiler

livescript-compiler

JSON →
library0.1.1jsnpmunverified

Pluggable LiveScript compiler that extends the original compiler with plugin support for code transformation and AST manipulation. It is part of the livescript-system ecosystem and requires the master branch of livescript (not the npm version). Version 0.1.1 is a work-in-progress, with constant development and a messy codebase; not recommended for production use. It provides plugins for ES modules, implicit async, and Object.create-based cloning. Released under BSD-3-Clause.

npm install livescript-compiler
INSTALL
IMPORT
SIG · LIVESCRIPT-COMPILE
L
livescript-compiler
serializationjavascriptv0.1.1
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 'livescript-compiler'
const { compile } = require('livescript-compiler')
Package is ESM-only; CommonJS require will fail.
SourceNode
import { SourceNode } from 'livescript-compiler'
import SourceNode from 'livescript-compiler'
SourceNode is a named export, not default.
default (compiler instance)
import compiler from 'livescript-compiler'
import { compiler } from 'livescript-compiler'
Default export is the compiler instance; no named export 'compiler'.

Demonstrates importing the compiler, using compile to transform LiveScript to JavaScript, and creating a SourceNode for source map generation.

import compiler, { compile, SourceNode } from 'livescript-compiler'; import livescript from 'livescript'; // must be from GitHub master const code = 'x = 1\ny = 2\nx + y'; const result = compile(code, { bare: true }); console.log(result.js); // compiled JavaScript const node = new SourceNode(null, null, null, 'generated code'); console.log(node.toStringWithSourceMap());
Debug
Known issues
deprecatedPackage is work-in-progress and not stable. Not recommended for production use.
fix
Use official livescript package instead.
affects: >=0.0.0
breakingRequires livescript from GitHub master branch; npm version is incompatible.
fix
Install livescript from GitHub: npm install 'https://github.com/gkz/LiveScript'
affects: >=0.0.0
gotchaPackage is ESM-only; does not export CommonJS.
fix
Use import syntax or dynamic import(). Do not use require().
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'livescript'
livescript not installed from GitHub master branch
fix
npm install 'https://github.com/gkz/LiveScript'
SyntaxError: Cannot use import statement outside a module
Trying to use ESM import in a CommonJS file
fix
Add 'type': 'module' to package.json or use a .mjs extension.
TypeError: compiler.compile is not a function
Incorrect import of default export as named export
fix
Use: import compiler from 'livescript-compiler'; then compiler.compile(...).
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
livescriptrequiredRequired from GitHub master branch; npm version incompatible
Agent activity
4 hits · last 30 days
node
4
Resources
livescript-compiler — npm install livescript-compiler · libregistry