@solidjs/vite-plugin 3.0.0-next.36 → 3.0.0-next.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -8
- package/dist/cjs/index.cjs +462 -97
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +464 -99
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/src/diagnostics/index.d.ts +14 -1
- package/dist/types/src/index.d.ts +16 -8
- package/dist/types/src/server-functions/compile.d.ts +2 -0
- package/dist/types/src/server-functions/index.d.ts +17 -10
- package/dist/types/src/ssr/index.d.ts +12 -5
- package/dist/types/src/tsrx.d.ts +11 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ Join [solid discord](https://discord.com/invite/solidjs) and check the [troubles
|
|
|
23
23
|
- Drop-in installation as a vite plugin
|
|
24
24
|
- Minimal bundle size
|
|
25
25
|
- Support typescript (`.tsx`) out of the box
|
|
26
|
+
- Experimental TypeScript TSRX (`.tsrx`) support out of the box
|
|
26
27
|
- Support code splitting out of the box
|
|
27
28
|
|
|
28
29
|
## Requirements
|
|
@@ -499,8 +500,8 @@ assets.
|
|
|
499
500
|
**Entry resolution** (all paths relative to the Vite root):
|
|
500
501
|
|
|
501
502
|
1. Explicit `start.entryServer` / `start.entryClient` options.
|
|
502
|
-
2. Conventional files: `src/entry-server.{tsx,jsx,ts,js,mjs}` and
|
|
503
|
-
`src/entry-client.{tsx,jsx,ts,js,mjs}`. Entry files come in pairs —
|
|
503
|
+
2. Conventional files: `src/entry-server.{tsx,jsx,ts,js,mjs,tsrx}` and
|
|
504
|
+
`src/entry-client.{tsx,jsx,ts,js,mjs,tsrx}`. Entry files come in pairs —
|
|
504
505
|
providing only one is an error. The server entry must export
|
|
505
506
|
`render(request?, context?)` returning a `renderToStream` result, an HTML
|
|
506
507
|
string, or a `Response`; `context.clientEntry` carries the resolved
|
|
@@ -509,8 +510,8 @@ assets.
|
|
|
509
510
|
the hashed asset (the classic harness convention keeps working).
|
|
510
511
|
3. Generated entries (the zero-config path): when no entry files exist, both
|
|
511
512
|
are generated from a root component — `start.app`, defaulting to
|
|
512
|
-
`src/App.{tsx,jsx,ts,js}` (or lowercase `src/app.*`) — wrapped in a
|
|
513
|
-
document shell: `start.document`, defaulting to `src/Document.{tsx,jsx}`,
|
|
513
|
+
`src/App.{tsx,jsx,ts,js,tsrx}` (or lowercase `src/app.*`) — wrapped in a
|
|
514
|
+
document shell: `start.document`, defaulting to `src/Document.{tsx,jsx,tsrx}`,
|
|
514
515
|
else a built-in minimal shell. A custom document receives the app as
|
|
515
516
|
`props.children` and must render the full `<html>` document including
|
|
516
517
|
`<HydrationScript />`; the client entry script is injected into `<head>`
|
|
@@ -683,9 +684,18 @@ handle that automatically. Combined with SSR start mode
|
|
|
683
684
|
document wiring is emitted too: server components render inline in the
|
|
684
685
|
SSR'd document and are adopted
|
|
685
686
|
at boot with zero endpoint requests. With authored entries, the app-side
|
|
686
|
-
pieces (the render plugin
|
|
687
|
-
|
|
688
|
-
|
|
687
|
+
pieces (the render plugin and the client's `installServerComponents()`
|
|
688
|
+
call, both from `@solidjs/web/frames`) live in your entry files instead.
|
|
689
|
+
See `examples/start-ssr` for a complete page.
|
|
690
|
+
|
|
691
|
+
Composing hosts (e.g. the Astro adapter or TanStack Start's Solid
|
|
692
|
+
integration) that emit that document wiring themselves — the render plugin
|
|
693
|
+
around their renders plus a client-side `installServerComponents()` call —
|
|
694
|
+
should set `components: 'external'` instead of `true`. It behaves
|
|
695
|
+
identically (all the same transforms and codegen), and declares the host
|
|
696
|
+
owns the wiring, so the plugin skips the warning it otherwise prints when
|
|
697
|
+
the option is enabled without SSR start mode. It reuses the plugin's
|
|
698
|
+
`external` vocabulary (cf. `start.external` — a host owns the server).
|
|
689
699
|
|
|
690
700
|
#### options.compiler
|
|
691
701
|
|
|
@@ -714,12 +724,40 @@ export default defineConfig({
|
|
|
714
724
|
});
|
|
715
725
|
```
|
|
716
726
|
|
|
727
|
+
#### Experimental TSRX
|
|
728
|
+
|
|
729
|
+
Files ending in `.tsrx` are recognized automatically as TypeScript TSRX; they
|
|
730
|
+
do not need to be listed in `options.extensions`. Both the native and Babel
|
|
731
|
+
compiler backends preserve the `.tsrx` filename when invoking their TSRX
|
|
732
|
+
frontends.
|
|
733
|
+
|
|
734
|
+
Scoped CSS emitted by either backend is exposed as a sibling virtual CSS
|
|
735
|
+
sidecar and imported once from the compiled module. The sidecar goes through
|
|
736
|
+
Vite's normal CSS pipeline, so extraction and injection work in development,
|
|
737
|
+
production builds, and SSR, including client HMR and SSR development style
|
|
738
|
+
collection. A file that emits no CSS has no sidecar import.
|
|
739
|
+
|
|
740
|
+
The Babel backend chains TSRX source maps through the later lazy-module and
|
|
741
|
+
refresh transforms. The native compiler does not currently emit the required
|
|
742
|
+
TSRX projection map, so native `.tsrx` transforms return no source map. With
|
|
743
|
+
`compiler: "native"` and custom `babel` options, the custom Babel support pass
|
|
744
|
+
runs after native TSRX lowering (on ordinary JavaScript); ordinary JSX/TSX
|
|
745
|
+
keeps the existing pre-native ordering.
|
|
746
|
+
|
|
747
|
+
With `serverFunctions` enabled, function-level `"use server"` directives work
|
|
748
|
+
in `.tsrx` with both compiler backends. The plugin lowers TSRX first, then runs
|
|
749
|
+
the same native directive transform while retaining the authored `.tsrx` path
|
|
750
|
+
for stable client/server function IDs. TSRX's host-defined
|
|
751
|
+
`module server { ... }` profile is not supported.
|
|
752
|
+
|
|
717
753
|
#### options.babel
|
|
718
754
|
|
|
719
755
|
- Type: Babel.TransformOptions
|
|
720
756
|
- Default: {}
|
|
721
757
|
|
|
722
758
|
Pass any additional [babel transform options](https://babeljs.io/docs/en/options). Those will be merged with the transformations required by Solid.
|
|
759
|
+
With the native compiler these options normally run before JSX lowering; for
|
|
760
|
+
`.tsrx` only, they run after native TSRX lowering as described above.
|
|
723
761
|
|
|
724
762
|
#### options.solid
|
|
725
763
|
|
|
@@ -744,7 +782,8 @@ Pass any additional [@babel/preset-typescript](https://babeljs.io/docs/en/babel-
|
|
|
744
782
|
- Default: []
|
|
745
783
|
|
|
746
784
|
An array of custom extension that will be passed through the solid compiler.
|
|
747
|
-
By default, the plugin
|
|
785
|
+
By default, the plugin transforms `jsx`, `tsx`, and experimental `tsrx` files.
|
|
786
|
+
TSRX is always recognized and does not need to be added here.
|
|
748
787
|
This is useful if you want to transform `mdx` files for example.
|
|
749
788
|
|
|
750
789
|
## `server-only` and `client-only` boundary markers
|