@pracht/vite-plugin 0.8.0 → 0.9.0
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 +23 -9
- package/dist/index.d.mts +22 -0
- package/dist/index.mjs +356 -90
- package/dist/pages-router-KcCRkhnf.mjs +588 -0
- package/dist/pages-router.d.mts +3 -1
- package/dist/pages-router.mjs +1 -1
- package/package.json +6 -4
- package/dist/pages-router-BQlG21oC.mjs +0 -319
package/README.md
CHANGED
|
@@ -56,12 +56,11 @@ pracht({
|
|
|
56
56
|
Keep it opt-in for now: it is best suited to SSR-heavy pages with large static
|
|
57
57
|
DOM subtrees and should be benchmarked against your app before enabling broadly.
|
|
58
58
|
|
|
59
|
-
##
|
|
59
|
+
## Additional Route Extensions
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
your `plugins` array alongside `pracht()`:
|
|
61
|
+
Use `additionalExtensions` when a Vite plugin compiles route or shell modules
|
|
62
|
+
with another file extension. For example, TSRX can use the explicit generic
|
|
63
|
+
configuration (while remaining implicitly supported for compatibility):
|
|
65
64
|
|
|
66
65
|
```ts
|
|
67
66
|
// vite.config.ts
|
|
@@ -70,13 +69,28 @@ import { pracht } from "@pracht/vite-plugin";
|
|
|
70
69
|
import { tsrxPreact } from "@tsrx/vite-plugin-preact";
|
|
71
70
|
|
|
72
71
|
export default defineConfig({
|
|
73
|
-
plugins: [tsrxPreact(), pracht()],
|
|
72
|
+
plugins: [tsrxPreact(), pracht({ additionalExtensions: [".tsrx"] })],
|
|
74
73
|
});
|
|
75
74
|
```
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
Extensions must be dot-prefixed. Pracht discovers configured extensions in
|
|
77
|
+
route and shell directories for both manifest and pages-router modes and strips
|
|
78
|
+
server-only route exports from client bundles. Vite-scannable component formats
|
|
79
|
+
join initial dependency scanning automatically; other format plugins must opt
|
|
80
|
+
their extension into Vite's dependency optimizer. The companion plugin remains
|
|
81
|
+
responsible for compiling the file format, and the app should provide any
|
|
82
|
+
ambient TypeScript module declaration that format requires. Keep the array
|
|
83
|
+
inline or in a directly referenced `const` for complete CLI verification;
|
|
84
|
+
dynamic expressions still build but produce a verification warning.
|
|
85
|
+
|
|
86
|
+
Configured formats are treated as potentially head-bearing even when their raw
|
|
87
|
+
source has no JavaScript `head()` export. The companion transform may synthesize
|
|
88
|
+
that export from frontmatter or other custom syntax, so loaderless client
|
|
89
|
+
navigation conservatively keeps its route-state request.
|
|
90
|
+
|
|
91
|
+
Existing `.tsrx` routes and shells remain discovered without
|
|
92
|
+
`additionalExtensions`, and Pracht keeps its ambient `.tsrx` declaration so a
|
|
93
|
+
compatible CLI patch cannot strand applications on the previous plugin minor.
|
|
80
94
|
|
|
81
95
|
## Peer Dependencies
|
|
82
96
|
|
package/dist/index.d.mts
CHANGED
|
@@ -91,6 +91,18 @@ interface PrachtAdapter {
|
|
|
91
91
|
* into the server output.
|
|
92
92
|
*/
|
|
93
93
|
edge?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* If true, the adapter produces a pure static export with no server at
|
|
96
|
+
* runtime (e.g. `@pracht/adapter-static`). Production builds then define
|
|
97
|
+
* `__PRACHT_STATIC_TARGET__` as `true`, which switches the client router's
|
|
98
|
+
* route-state fetching from the live `x-pracht-route-state-request`
|
|
99
|
+
* endpoint to the serialized `/_pracht/state/…` files that `pracht build`
|
|
100
|
+
* emits. Dev servers keep the live endpoint (the flag only applies to
|
|
101
|
+
* builds). Custom static targets must also expose the static artifact hooks
|
|
102
|
+
* generated by `@pracht/adapter-static`; the CLI fails when a configured
|
|
103
|
+
* not-found or fallback artifact cannot be rendered.
|
|
104
|
+
*/
|
|
105
|
+
staticTarget?: boolean;
|
|
94
106
|
}
|
|
95
107
|
//#endregion
|
|
96
108
|
//#region src/plugin-options.d.ts
|
|
@@ -131,6 +143,14 @@ interface PrachtPluginOptions {
|
|
|
131
143
|
middlewareDir?: string;
|
|
132
144
|
apiDir?: string;
|
|
133
145
|
serverDir?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Additional dot-prefixed route and shell module extensions to discover,
|
|
148
|
+
* such as `[".vue"]`. Register the Vite plugin that transforms the format
|
|
149
|
+
* separately; Pracht only discovers the modules and applies its route
|
|
150
|
+
* client/server handling. Defaults to no additional extensions. `.tsrx`
|
|
151
|
+
* remains discovered without configuration for backward compatibility.
|
|
152
|
+
*/
|
|
153
|
+
additionalExtensions?: readonly string[];
|
|
134
154
|
/**
|
|
135
155
|
* Directory containing island components hydrated on
|
|
136
156
|
* `hydration: "islands"` routes. Defaults to "/src/islands".
|
|
@@ -194,6 +214,8 @@ declare function createPrachtIslandsClientModuleSource(options?: PrachtPluginOpt
|
|
|
194
214
|
declare function createPrachtServerModuleSource(options?: PrachtPluginOptions, buildOptions?: {
|
|
195
215
|
root?: string;
|
|
196
216
|
isBuild?: boolean;
|
|
217
|
+
base?: string;
|
|
218
|
+
configuredBase?: string;
|
|
197
219
|
}): string;
|
|
198
220
|
declare function createPrachtRegistryModuleSource(options?: PrachtPluginOptions): string;
|
|
199
221
|
//#endregion
|