rdesign/frontend/node_modules/@lit-labs/ssr-dom-shim
Jeff Emmett 80f1e96e6b Fix frontend build: type errors, SDK handling, docker context
- Use jq to cleanly remove encryptid SDK from package.json in Docker
- Fix TypeScript strict mode errors in dashboard and assistant
- Add .dockerignore to exclude node_modules from build context
- Use project root as Docker build context for frontend
- Fix Traefik routing: separate frontend/api/studio paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 02:21:52 +00:00
..
lib Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
README.md Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
index.d.ts Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
index.d.ts.map Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
index.js Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
index.js.map Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
package.json Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
register-css-hook.d.ts Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
register-css-hook.d.ts.map Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
register-css-hook.js Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00
register-css-hook.js.map Fix frontend build: type errors, SDK handling, docker context 2026-03-24 02:21:52 +00:00

README.md

@lit-labs/ssr-dom-shim

Overview

This package provides minimal implementations of Element, HTMLElement, EventTarget, Event, CustomEvent, CustomElementRegistry, and customElements, designed to be used when Server Side Rendering (SSR) web components from Node, including Lit components.

Usage

Usage from Lit

Lit itself automatically imports these shims when running in Node, so Lit users should typically not need to directly depend on or import from this package.

See the lit.dev SSR docs for general information about server-side rendering with Lit.

Usage in other contexts

Other libraries or frameworks who wish to support SSR are welcome to also depend on these shims. (This package is planned to eventually move to @webcomponents/ssr-dom-shim to better reflect this use case). There are two main patterns for providing access to these shims to users:

  1. Assigning shims to globalThis, ensuring that assignment occurs before user-code runs.

  2. Importing shims directly from the module that provides your base class, using the node export condition to ensure this only happens when running in Node, and not in the browser.

Lit takes approach #2 for all of the shims except for customElements, Event and CustomEvent, so that users who have imported lit are able to call customElements.define or new Event(...)/new CustomEvent(...) in their components from Node.

Exports

The main module exports the following values. Note that no globals are set by this module.

CSS Node.js customization hook

@lit-labs/ssr-dom-shim/register-css-hook.js implements/registers a Node.js customization hook (Node.js >= 18.6.0) to import CSS files/modules as instances of CSSStyleSheet.

import styles from 'my-styles.css' with {type: 'css'};
// styles is now an instance of CSSStyleSheet

This can either be used as a parameter with the Node.js CLI (e.g. node --import @lit-labs/ssr-dom-shim/register-css-hook.js my-script.js or via environment variable NODE_OPTIONS="--import @lit-labs/ssr-dom-shim/register-css-hook.js") or imported inline, and it will apply to any module dynamically imported afterwards (e.g. import @lit-labs/ssr-dom-shim/register-css-hook.js and subsequently await import('./my-component.js')).

Contributing

Please see CONTRIBUTING.md.