isolet packages any component into a self-contained widget with configurable isolation (shadow DOM, scoped div, or none). Framework-agnostic core with optional adapters for React, vanilla, etc.
packages/isolet: core runtime, adapters, build plugins, and CLI (single package:isolet-js)
- TypeScript strict mode, ESM-first
- Use
node:prefix for Node.js built-in imports - Prefer explicit types over inference for public API
- No default exports, use named exports
- Use
.jsextensions in relative imports (ESM resolution)
- vite-plus with
packconfig (tsdown under the hood) - css-text plugin converts CSS to JS strings for shadow DOM injection
- IIFE output exposes
Isoletglobal - ESM/CJS outputs with
.d.tsgeneration - CLI builds as ESM-only for Node.js
- Use vitest (via vite-plus-test override)
- Test shadow DOM mounting in jsdom/happy-dom
- Keep the core framework-agnostic. Framework-specific code goes in adapters.
- All styles must work inside shadow DOM (no
remunits, convert topx) - Respect CSP nonces when injecting styles
- Support all three isolation modes: shadow-dom, scoped, none
- Support both script-tag (IIFE) and npm (ESM/CJS) consumption