browser-runtime-solid1
v0.0.13
Published
Solid 1 JSX/TSX compiler and renderer adapter for browser-module-runtime
Downloads
400
Maintainers
Readme
browser-runtime-solid1
Independent Solid 1.x plugin for Browser Module Runtime 0.0.13. The existing solid() adapter remains Solid 2.
Usage
import {createRuntime} from 'browser-module-runtime';
import {solid1} from 'browser-runtime-solid1';
const runtime=createRuntime({plugins:[solid1({version:'1.9.10'})]});
runtime.define('/Counter.jsx',`import {createSignal} from 'solid-js'; export default function Counter(){const [n,setN]=createSignal(0);return <button onClick={()=>setN(v=>v+1)}>{n()}</button>}`,{type:'solid1-jsx'});
await runtime.mount({module:'/Counter.jsx',target:'#app'});For declarative syntax, use <script type="solid1-jsx" module="/Counter.jsx" scope="demo"> and <runtime-render scope="demo" module="/Counter.jsx">, then await runtime.html.process({scope:'demo'}).
Use solid1({source:'host'}) only with page import-map entries for solid-js, solid-js/web, solid-js/html, and solid-tag-1. Explicit version uses esm.sh URL pinning per runtime (does not modify the page import map). One Solid major per BMR runtime: using solid1() and solid() together is intentionally rejected.
The compiler imports [email protected] directly and uses its transform(source,{filename}) API. JSX and TSX types are solid1-jsx and solid1-tsx; explicit type is recommended. Component props update in place with full snapshot replacement; authored custom-element children project as props.children. Solid 1 solid-js/html uses dynamic code generation in some paths (strict CSP may require adjustments). SSR, hydration, named slots, and dynamic authored-light-DOM mutation are out of scope.
