Lunet Transpiler
raw JSON → 0.0.8 verified Fri May 01 auth: no javascript
The Lunet Transpiler is a build tool for the Lunet web frontend library (version 0.0.8, pre-release). It transpiles Lunet components or templates into standard JavaScript/HTML/CSS for browser consumption. Key differentiator: designed specifically for the Lunet ecosystem, offering custom syntax and optimizations not available in general-purpose transpilers like Babel. Release cadence is unstable as it is still in early development; breaking changes are expected between minor versions. Not suitable for production use yet.
Common errors
error Error: Cannot find module 'lunet' ↓
cause lunet-transpiler requires lunet core to be installed.
fix
npm install lunet
error TypeError: transpile is not a function ↓
cause Incorrect import: default vs named export.
fix
Use import { transpile } from 'lunet-transpiler'
Warnings
breaking API may change without notice in pre-1.0 versions ↓
fix Pin to a specific version and monitor changelog.
gotcha Missing dependency 'lunet' at runtime if not using bundled output ↓
fix Ensure 'lunet' core library is installed as a peer dependency.
Install
npm install lunet-transpiler yarn add lunet-transpiler pnpm add lunet-transpiler Imports
- transpile wrong
const transpile = require('lunet-transpiler')correctimport { transpile } from 'lunet-transpiler' - compile
import { compile } from 'lunet-transpiler' - default wrong
import * as transpiler from 'lunet-transpiler'correctimport transpiler from 'lunet-transpiler'
Quickstart
import { transpile } from 'lunet-transpiler';
const input = `
<template>
<div>{message}</div>
</template>
<script>
export default {
data() {
return { message: 'Hello, Lunet!' };
}
}
</script>`;
const output = transpile(input, { module: true, sourceMap: false });
console.log(output.code);