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/babel-preset-react-compat

v0.2.3

Published

Canonical React compatibility pipeline for migrating React-authored source onto LitSX

Readme

@litsx/babel-preset-react-compat

npm Release Module Provenance

Canonical Babel preset for migrating React-authored source onto the LitSX runtime model.

What It Includes

This preset wires the supported React compatibility pipeline in a fixed order:

  1. React attribute aliases such as className
  2. React context lowering (createContext, Provider, Consumer, useContext)
  3. LitSX component lowering
  4. React hooks, useState, and useRef
  5. React lazy and React suspense lowering
  6. Native LitSX suspense lowering
  7. React-style error boundaries
  8. React propTypes compat lowering to native static properties = ...
  9. scoped elements
  10. React DOM/form attribute compatibility
  11. React event lowering

That ordering makes compatibility for React 19-style ref props, forwardRef(...), and wrappers such as memo(...) part of one explicit migration contract instead of accidental composition.

This preset is the supported public entrypoint for React migration. React event aliasing, effect lowering, wrapper lowering, ref handling, and other migration stages are internal to the preset.

propTypes support here should be read as migration compatibility only. Native LitSX authoring should use TypeScript prop inference or explicit static properties = ... hoists instead of Component.propTypes = { ... }.

React context support here should also be read as migration compatibility only. It lowers onto @lit/context through the LitSX runtime surface; it is not a native LitSX authoring primitive.

Wrapper Semantics

memo(...) is accepted as a migration wrapper so React-authored components can pass through the compatibility pipeline without being rewritten first. The transform emits a warning because LitSX removes memo(...) during lowering, and memo(Component, areEqual) emits an additional warning because the comparator is ignored.

In React, memo is commonly used because parent renders can re-run child components even when their props have not changed. LitSX does not use that same re-render model: a host updates from its own reactive properties and state rather than from a parent repeatedly re-invoking a component tree.

So memo(...) support here should be read as compatibility with existing source, not as a promise of React-style bailout semantics or as a native LitSX performance primitive.

Usage

{
  "presets": ["@litsx/babel-preset-react-compat"]
}

By default the preset compiles all the way to Lit html tagged templates. Set jsxTemplate: false when you intentionally want the intermediate JSX-shaped LitSX output instead:

{
  "presets": [
    ["@litsx/babel-preset-react-compat", { "jsxTemplate": false }]
  ]
}

Use domMode: "light" when a migration needs every authored component in that compilation to participate in global CSS instead of shadow-root encapsulation:

{
  "presets": [
    ["@litsx/babel-preset-react-compat", { "domMode": "light" }]
  ]
}

domMode defaults to "shadow". This option only affects components lowered by the preset in the current compilation; it does not rewrite imported components from elsewhere.

Scope

This preset is for migration. Native LitSX projects should prefer the native tooling surface directly instead of authoring React-shaped source long-term.