@pracht/vite-plugin 0.1.4 → 0.2.2
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/LICENSE +21 -0
- package/README.md +6 -3
- package/dist/index.d.mts +12 -0
- package/dist/index.mjs +3 -5
- package/package.json +6 -15
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jovi De Croock
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -29,6 +29,9 @@ export default defineConfig({
|
|
|
29
29
|
|
|
30
30
|
## Peer Dependencies
|
|
31
31
|
|
|
32
|
-
- `vite@^8.0.0`
|
|
33
|
-
|
|
34
|
-
-
|
|
32
|
+
- `vite@^7.0.0 || ^8.0.0`
|
|
33
|
+
|
|
34
|
+
Target-specific Vite plugins (e.g. `@cloudflare/vite-plugin`) are pulled in by
|
|
35
|
+
the adapter package you install (`@pracht/adapter-cloudflare`,
|
|
36
|
+
`@pracht/adapter-vercel`, etc.). The default path uses `@pracht/adapter-node`,
|
|
37
|
+
which ships as a dependency of this package.
|
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,18 @@ interface PrachtAdapter {
|
|
|
23
23
|
* request handler or default export.
|
|
24
24
|
*/
|
|
25
25
|
createServerEntryModule(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Additional Vite plugins the adapter needs (e.g. `@cloudflare/vite-plugin`).
|
|
28
|
+
* Returned plugins are appended to the plugin array returned by `pracht()`.
|
|
29
|
+
*/
|
|
30
|
+
vitePlugins?(): Plugin[] | Promise<Plugin[]>;
|
|
31
|
+
/**
|
|
32
|
+
* If true, the adapter owns dev-server request handling and the vite-plugin
|
|
33
|
+
* will not install its own SSR middleware. Used when the adapter contributes
|
|
34
|
+
* a Vite plugin that runs the dev server in a platform-specific runtime
|
|
35
|
+
* (e.g. Cloudflare workerd via `@cloudflare/vite-plugin`).
|
|
36
|
+
*/
|
|
37
|
+
ownsDevServer?: boolean;
|
|
26
38
|
}
|
|
27
39
|
type RenderMode = "spa" | "ssr" | "ssg" | "isg";
|
|
28
40
|
interface PrachtPluginOptions {
|
package/dist/index.mjs
CHANGED
|
@@ -119,7 +119,7 @@ async function pracht(options = {}) {
|
|
|
119
119
|
if (f.startsWith(abs)) server.restart();
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
if (resolved.adapter.
|
|
122
|
+
if (resolved.adapter.ownsDevServer) return;
|
|
123
123
|
return () => {
|
|
124
124
|
server.middlewares.use(createDevSSRMiddleware(server, resolved));
|
|
125
125
|
};
|
|
@@ -151,10 +151,8 @@ async function pracht(options = {}) {
|
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
const plugins = [...preact(), prachtPlugin];
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
plugins.push(...cloudflare({ config: { main: "virtual:pracht/server" } }));
|
|
157
|
-
}
|
|
154
|
+
const adapterPlugins = await resolved.adapter.vitePlugins?.();
|
|
155
|
+
if (adapterPlugins?.length) plugins.push(...adapterPlugins);
|
|
158
156
|
return plugins;
|
|
159
157
|
}
|
|
160
158
|
function createPrachtClientModuleSource(options = {}, buildOptions = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pracht/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"homepage": "https://github.com/JoviDeCroock/pracht/tree/main/packages/vite-plugin",
|
|
5
6
|
"bugs": {
|
|
6
7
|
"url": "https://github.com/JoviDeCroock/pracht/issues"
|
|
@@ -29,22 +30,12 @@
|
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@preact/preset-vite": "^2.10.5",
|
|
32
|
-
"@
|
|
33
|
-
"@pracht/adapter-
|
|
34
|
-
"@pracht/core": "0.2.
|
|
33
|
+
"@prefresh/vite": "^2.0.0",
|
|
34
|
+
"@pracht/adapter-node": "0.1.6",
|
|
35
|
+
"@pracht/core": "0.2.5"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
|
-
"
|
|
38
|
-
"vite": "^8.0.0",
|
|
39
|
-
"wrangler": "^4.81.0"
|
|
40
|
-
},
|
|
41
|
-
"peerDependenciesMeta": {
|
|
42
|
-
"@cloudflare/vite-plugin": {
|
|
43
|
-
"optional": true
|
|
44
|
-
},
|
|
45
|
-
"wrangler": {
|
|
46
|
-
"optional": true
|
|
47
|
-
}
|
|
38
|
+
"vite": "^7.0.0 || ^8.0.0"
|
|
48
39
|
},
|
|
49
40
|
"scripts": {
|
|
50
41
|
"build": "tsdown"
|