browser-runtime-solid
v0.0.13
Published
Solid JSX compiler and renderer adapter for browser-module-runtime.
Maintainers
Readme
browser-runtime-solid
Solid 2 JSX compiler/renderer adapter for browser-module-runtime. This plugin is optional; generic runtime imports do not load Solid unless you register the adapter.
Pinned Solid 2 family (recommended for standalone browser modules)
import {createRuntime} from 'browser-module-runtime';
import {solid} from 'browser-module-frameworks'; // or 'browser-runtime-solid'
const runtime=createRuntime({plugins:[solid({version:'2.0.0-rc.13',provider:'esm.sh'})]});
runtime.define('/Counter.jsx',`
import {createSignal} from 'solid-js';
export default function Counter(){
const [count,setCount]=createSignal(0);
return <button onClick={()=>setCount(n=>n+1)}>Count: {count()}</button>;
}
`,{type:'solid-jsx'});
const mount=await runtime.mount({module:'/Counter.jsx',target:'#app'});
// Later: await mount.dispose(); await runtime.dispose();A pinned adapter controls four framework packages as one compatible family: solid-js, @solidjs/web, @solidjs/html, and @solidjs/signals. The pinned JSX transformer solid-tag has a separate tagVersion (default 0.0.4), so solid-tag need not match the Solid release. Generated imports, including solid-js/internal and the solid-js/web alias to @solidjs/web, are linked through the same runtime-local policy used to load the renderer. The tested Solid version is 2.0.0-rc.13. This does not change or depend on a browser-global Solid import map.
One standalone HTML page can import just the generic engine and aggregator using esmesm:
<script src="https://raw.esm.sh/[email protected]/bootstrap.js"
data-map="[email protected]; [email protected]"></script>The rest is controlled per runtime by solid({version,...}). See examples/02-solid.html in the workspace; before npm publication of this release candidate run the local workspace with npm run dev.
Host-managed imports (backward-compatible)
const runtime=createRuntime({plugins:[solid({source:'host'})]});
// equivalent to solid() or solid({source:'auto'}) without a version/providerUse this when an application bundler or esmesm import map already coordinates the Solid packages and solid-tag. Host mode does not silently mix partially resolved host modules with CDN fallbacks. For pinned mode, the adapter selects only the esm.sh provider because other providers have not passed Solid-family identity checks.
Options
| Option | Description |
| --- | --- |
| version | Exact Solid 2 family semver; enables runtime-local pinning |
| provider | esm.sh for pinned mode; other providers reject for now |
| source | auto (default), host, esm.sh; auto uses pinned mode when configured, otherwise host |
| fallbackProvider | Enables a deterministic provider-managed default version when version is omitted |
| tagVersion | Separate exact solid-tag compiler release, default 0.0.4 in pinned mode |
| compiler, render, web | Existing compiler/renderer injection and optional @solidjs/web namespace |
| transformOptions | Forwarded to solid-tag.transformModule |
| delegatedEvents | Iterable of Solid delegated event names; omitted uses renderer or compatibility defaults |
| modules | Host namespaces supported in host mode; family names forbidden in pinned mode |
A pinned mode owns solid-js, @solidjs/web, @solidjs/html, @solidjs/signals, and solid-tag. Conflicting application pins and host namespaces are rejected before importing the CDN compiler. After mounting, Solid 2 document delegation is set up once per document/renderer; individual component disposals stay independent. Shadow DOM is not part of the currently verified delegation surface.
The plugin is not a drop-in replacement for [email protected] or its specialized HTML controller. Browser integration tests should be run before publishing new Solid provider versions.
