npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@litsx/vite-plugin

v0.2.5

Published

Official Vite plugin for LitSX compilation

Readme

@litsx/vite-plugin

npm Release Module Provenance

Official Vite integration for LitSX.

This package is the recommended default for:

  • Vite apps
  • Storybook using the Vite builder
  • any Vite-based toolchain that needs to compile authored LitSX source

Internally it uses @litsx/compiler, so callers do not need to wire Babel parser setup, sourcemap chaining, or Lit template sourcemap patching manually.

Installation

npm install -D @litsx/vite-plugin vite

Your project will also need the usual runtime dependencies used by compiled LitSX output, such as lit, @litsx/litsx, and, when targeting browsers without native scoped registries, @webcomponents/scoped-custom-element-registry.

Basic Usage

import { defineConfig } from "vite";
import { litsx } from "@litsx/vite-plugin";

export default defineConfig({
  plugins: [litsx()],
});

This transforms authored .jsx and .tsx modules before the rest of the Vite pipeline.

What the Plugin Handles

The plugin applies the supported LitSX compilation pipeline through @litsx/compiler, including:

  • @litsx/babel-parser
  • LitSX Babel plugin ordering
  • virtualization sourcemap chaining
  • final Lit-style attribute sourcemap patching

That means Vite consumers do not need to know about:

  • getLitsxVirtualizationMetadata(...)
  • inputSourceMap
  • patchLitAttributeSourcemap(...)

API

litsx(options?)

Returns a Vite plugin with:

  • name: "litsx"
  • enforce: "pre"

Default behavior:

  • transforms .jsx, .tsx, .litsx, and .litsx.jsx
  • returns { code, map }
  • delegates compilation to @litsx/compiler

Options

@litsx/vite-plugin accepts all @litsx/compiler options except filename, which is supplied from the Vite module id.

include?: RegExp | ((id: string) => boolean)

Controls which module ids are transformed.

Default behavior:

/\.(jsx|tsx|litsx)$/

Examples:

litsx({
  include: /\.demo$/,
});
litsx({
  include(id) {
    return id.endsWith(".jsx") || id.endsWith(".tsx") || id.endsWith(".litsx");
  },
});

sourceMaps?: boolean

Enables sourcemap emission from the compiler facade.

Example:

export default defineConfig({
  plugins: [
    litsx({
      sourceMaps: true,
    }),
  ],
});

parserPlugins?: string[]

Extra parser plugins forwarded to @litsx/compiler.

.tsx files automatically enable the TypeScript parser plugin when no explicit parser plugin list is provided.

jsxTemplate?: boolean

Controls whether JSX is lowered to Lit template literals.

Default: true

jsxTemplateOptions?: object

Forwarded to @litsx/babel-plugin-transform-jsx-html-template.

authoringPlugins?: unknown[]

Extra Babel plugins applied after LitSX virtualization/parsing and before the built-in LitSX lowering pipeline.

outputPlugins?: unknown[]

Extra Babel plugins appended after the built-in LitSX transform pipeline.

Storybook Example

For @storybook/web-components-vite:

import { litsx } from "@litsx/vite-plugin";

export default {
  framework: "@storybook/web-components-vite",
  stories: ["../src/**/*.stories.@(js|jsx|mdx)", "../src/**/*.docs.mdx"],
  async viteFinal(config) {
    return {
      ...config,
      plugins: [...(config.plugins ?? []), litsx()],
    };
  },
};

When to Use @litsx/compiler Instead

Use @litsx/compiler directly when:

  • you are writing a custom build tool integration
  • you need programmatic compilation outside Vite
  • you need direct access to compilation metadata

If you are already on Vite, @litsx/vite-plugin should be the default choice.

Scope

This package only provides Vite integration.

It does not:

  • own docs-site-specific module resolution
  • provide Rollup or esbuild plugins
  • replace runtime dependencies such as lit or litsx

Stability

@litsx/vite-plugin is the supported public integration surface for Vite-based consumers.

The underlying implementation details remain internal to @litsx/compiler, so consumers should not need to reproduce the LitSX Babel pipeline themselves.