npm.io
1.0.1 • Published 3d ago

vite-plugin-levelojs

Licence
MIT
Version
1.0.1
Deps
4
Size
30 kB
Vulns
0
Weekly
0
Stars
1

vite-plugin-levelojs

Official Vite plugin for Levelo JS.

Transforms JSX into optimized h() calls at compile time with zero Virtual DOM overhead.

Features

  • JSX compilation for Levelo JS
  • TypeScript (.tsx) support
  • SVG namespace handling
  • MathML namespace handling
  • No React runtime required
  • Source map support

Installation

npm install levelojs vite-plugin-levelojs

or

pnpm add levelojs vite-plugin-levelojs

Usage

// vite.config.ts
import { defineConfig } from "vite";
import { leveloPlugin } from "vite-plugin-levelojs";

export default defineConfig({
  plugins: [leveloPlugin()],
  esbuild: {
    jsxFactory: 'h',
    jsxFragment: 'fragment',
    jsxInject: `import { h } from 'levelojs'`
  }
});

Example

import { render } from "levelojs";

function App() {
  return <h1>Hello Levelo</h1>;
}

render(App, document.getElementById("app"));

The plugin compiles JSX into optimized runtime calls:

<h1>Hello</h1>

h("h1", null, "Hello");

Supported Files

  • .jsx
  • .tsx

API

leveloPlugin(options?)
leveloPlugin({
  include,
  exclude,
});
Option Description
include Files to include
exclude Files to exclude

Requirements

  • vite
  • levelojs

Resources

License

MIT

Keywords