litestar-vite 0.1.1__py3-none-any.whl → 0.15.0__py3-none-any.whl
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.
- litestar_vite/__init__.py +54 -4
- litestar_vite/__metadata__.py +12 -7
- litestar_vite/cli.py +1048 -10
- litestar_vite/codegen/__init__.py +48 -0
- litestar_vite/codegen/_export.py +229 -0
- litestar_vite/codegen/_inertia.py +619 -0
- litestar_vite/codegen/_openapi.py +280 -0
- litestar_vite/codegen/_routes.py +720 -0
- litestar_vite/codegen/_ts.py +235 -0
- litestar_vite/codegen/_utils.py +141 -0
- litestar_vite/commands.py +73 -0
- litestar_vite/config/__init__.py +997 -0
- litestar_vite/config/_constants.py +97 -0
- litestar_vite/config/_deploy.py +70 -0
- litestar_vite/config/_inertia.py +241 -0
- litestar_vite/config/_paths.py +63 -0
- litestar_vite/config/_runtime.py +235 -0
- litestar_vite/config/_spa.py +93 -0
- litestar_vite/config/_types.py +94 -0
- litestar_vite/deploy.py +366 -0
- litestar_vite/doctor.py +1181 -0
- litestar_vite/exceptions.py +78 -0
- litestar_vite/executor.py +360 -0
- litestar_vite/handler/__init__.py +9 -0
- litestar_vite/handler/_app.py +612 -0
- litestar_vite/handler/_routing.py +130 -0
- litestar_vite/html_transform.py +569 -0
- litestar_vite/inertia/__init__.py +77 -0
- litestar_vite/inertia/_utils.py +119 -0
- litestar_vite/inertia/exception_handler.py +178 -0
- litestar_vite/inertia/helpers.py +1571 -0
- litestar_vite/inertia/middleware.py +54 -0
- litestar_vite/inertia/plugin.py +199 -0
- litestar_vite/inertia/precognition.py +274 -0
- litestar_vite/inertia/request.py +334 -0
- litestar_vite/inertia/response.py +802 -0
- litestar_vite/inertia/types.py +335 -0
- litestar_vite/loader.py +464 -123
- litestar_vite/plugin/__init__.py +687 -0
- litestar_vite/plugin/_process.py +185 -0
- litestar_vite/plugin/_proxy.py +689 -0
- litestar_vite/plugin/_proxy_headers.py +244 -0
- litestar_vite/plugin/_static.py +37 -0
- litestar_vite/plugin/_utils.py +489 -0
- litestar_vite/py.typed +0 -0
- litestar_vite/scaffolding/__init__.py +20 -0
- litestar_vite/scaffolding/generator.py +270 -0
- litestar_vite/scaffolding/templates.py +437 -0
- litestar_vite/templates/__init__.py +0 -0
- litestar_vite/templates/addons/tailwindcss/tailwind.css.j2 +1 -0
- litestar_vite/templates/angular/index.html.j2 +12 -0
- litestar_vite/templates/angular/openapi-ts.config.ts.j2 +18 -0
- litestar_vite/templates/angular/package.json.j2 +36 -0
- litestar_vite/templates/angular/src/app/app.component.css.j2 +3 -0
- litestar_vite/templates/angular/src/app/app.component.html.j2 +1 -0
- litestar_vite/templates/angular/src/app/app.component.ts.j2 +9 -0
- litestar_vite/templates/angular/src/app/app.config.ts.j2 +5 -0
- litestar_vite/templates/angular/src/main.ts.j2 +9 -0
- litestar_vite/templates/angular/src/styles.css.j2 +9 -0
- litestar_vite/templates/angular/tsconfig.app.json.j2 +34 -0
- litestar_vite/templates/angular/tsconfig.json.j2 +20 -0
- litestar_vite/templates/angular/vite.config.ts.j2 +21 -0
- litestar_vite/templates/angular-cli/.postcssrc.json.j2 +5 -0
- litestar_vite/templates/angular-cli/angular.json.j2 +36 -0
- litestar_vite/templates/angular-cli/openapi-ts.config.ts.j2 +18 -0
- litestar_vite/templates/angular-cli/package.json.j2 +28 -0
- litestar_vite/templates/angular-cli/proxy.conf.json.j2 +18 -0
- litestar_vite/templates/angular-cli/src/app/app.component.css.j2 +3 -0
- litestar_vite/templates/angular-cli/src/app/app.component.html.j2 +1 -0
- litestar_vite/templates/angular-cli/src/app/app.component.ts.j2 +9 -0
- litestar_vite/templates/angular-cli/src/app/app.config.ts.j2 +5 -0
- litestar_vite/templates/angular-cli/src/index.html.j2 +13 -0
- litestar_vite/templates/angular-cli/src/main.ts.j2 +6 -0
- litestar_vite/templates/angular-cli/src/styles.css.j2 +10 -0
- litestar_vite/templates/angular-cli/tailwind.config.js.j2 +4 -0
- litestar_vite/templates/angular-cli/tsconfig.app.json.j2 +16 -0
- litestar_vite/templates/angular-cli/tsconfig.json.j2 +26 -0
- litestar_vite/templates/angular-cli/tsconfig.spec.json.j2 +9 -0
- litestar_vite/templates/astro/astro.config.mjs.j2 +28 -0
- litestar_vite/templates/astro/openapi-ts.config.ts.j2 +15 -0
- litestar_vite/templates/astro/src/layouts/Layout.astro.j2 +63 -0
- litestar_vite/templates/astro/src/pages/index.astro.j2 +36 -0
- litestar_vite/templates/astro/src/styles/global.css.j2 +1 -0
- litestar_vite/templates/base/.gitignore.j2 +42 -0
- litestar_vite/templates/base/openapi-ts.config.ts.j2 +15 -0
- litestar_vite/templates/base/package.json.j2 +39 -0
- litestar_vite/templates/base/resources/vite-env.d.ts.j2 +1 -0
- litestar_vite/templates/base/tsconfig.json.j2 +37 -0
- litestar_vite/templates/htmx/src/main.js.j2 +8 -0
- litestar_vite/templates/htmx/templates/base.html.j2.j2 +56 -0
- litestar_vite/templates/htmx/templates/index.html.j2.j2 +13 -0
- litestar_vite/templates/htmx/vite.config.ts.j2 +40 -0
- litestar_vite/templates/nuxt/app.vue.j2 +29 -0
- litestar_vite/templates/nuxt/composables/useApi.ts.j2 +33 -0
- litestar_vite/templates/nuxt/nuxt.config.ts.j2 +31 -0
- litestar_vite/templates/nuxt/openapi-ts.config.ts.j2 +15 -0
- litestar_vite/templates/nuxt/pages/index.vue.j2 +54 -0
- litestar_vite/templates/react/index.html.j2 +13 -0
- litestar_vite/templates/react/src/App.css.j2 +56 -0
- litestar_vite/templates/react/src/App.tsx.j2 +19 -0
- litestar_vite/templates/react/src/main.tsx.j2 +10 -0
- litestar_vite/templates/react/vite.config.ts.j2 +39 -0
- litestar_vite/templates/react-inertia/index.html.j2 +14 -0
- litestar_vite/templates/react-inertia/package.json.j2 +47 -0
- litestar_vite/templates/react-inertia/resources/App.css.j2 +68 -0
- litestar_vite/templates/react-inertia/resources/main.tsx.j2 +17 -0
- litestar_vite/templates/react-inertia/resources/pages/Home.tsx.j2 +18 -0
- litestar_vite/templates/react-inertia/resources/ssr.tsx.j2 +19 -0
- litestar_vite/templates/react-inertia/vite.config.ts.j2 +59 -0
- litestar_vite/templates/react-router/index.html.j2 +12 -0
- litestar_vite/templates/react-router/src/App.css.j2 +17 -0
- litestar_vite/templates/react-router/src/App.tsx.j2 +7 -0
- litestar_vite/templates/react-router/src/main.tsx.j2 +10 -0
- litestar_vite/templates/react-router/vite.config.ts.j2 +39 -0
- litestar_vite/templates/react-tanstack/index.html.j2 +12 -0
- litestar_vite/templates/react-tanstack/openapi-ts.config.ts.j2 +18 -0
- litestar_vite/templates/react-tanstack/src/App.css.j2 +17 -0
- litestar_vite/templates/react-tanstack/src/main.tsx.j2 +21 -0
- litestar_vite/templates/react-tanstack/src/routeTree.gen.ts.j2 +7 -0
- litestar_vite/templates/react-tanstack/src/routes/__root.tsx.j2 +9 -0
- litestar_vite/templates/react-tanstack/src/routes/books.tsx.j2 +9 -0
- litestar_vite/templates/react-tanstack/src/routes/index.tsx.j2 +9 -0
- litestar_vite/templates/react-tanstack/vite.config.ts.j2 +39 -0
- litestar_vite/templates/svelte/index.html.j2 +13 -0
- litestar_vite/templates/svelte/src/App.svelte.j2 +30 -0
- litestar_vite/templates/svelte/src/app.css.j2 +45 -0
- litestar_vite/templates/svelte/src/main.ts.j2 +8 -0
- litestar_vite/templates/svelte/src/vite-env.d.ts.j2 +2 -0
- litestar_vite/templates/svelte/svelte.config.js.j2 +5 -0
- litestar_vite/templates/svelte/vite.config.ts.j2 +39 -0
- litestar_vite/templates/svelte-inertia/index.html.j2 +14 -0
- litestar_vite/templates/svelte-inertia/resources/app.css.j2 +21 -0
- litestar_vite/templates/svelte-inertia/resources/main.ts.j2 +11 -0
- litestar_vite/templates/svelte-inertia/resources/pages/Home.svelte.j2 +43 -0
- litestar_vite/templates/svelte-inertia/resources/vite-env.d.ts.j2 +2 -0
- litestar_vite/templates/svelte-inertia/svelte.config.js.j2 +5 -0
- litestar_vite/templates/svelte-inertia/vite.config.ts.j2 +37 -0
- litestar_vite/templates/sveltekit/openapi-ts.config.ts.j2 +15 -0
- litestar_vite/templates/sveltekit/src/app.css.j2 +40 -0
- litestar_vite/templates/sveltekit/src/app.html.j2 +12 -0
- litestar_vite/templates/sveltekit/src/hooks.server.ts.j2 +55 -0
- litestar_vite/templates/sveltekit/src/routes/+layout.svelte.j2 +12 -0
- litestar_vite/templates/sveltekit/src/routes/+page.svelte.j2 +34 -0
- litestar_vite/templates/sveltekit/svelte.config.js.j2 +12 -0
- litestar_vite/templates/sveltekit/tsconfig.json.j2 +14 -0
- litestar_vite/templates/sveltekit/vite.config.ts.j2 +31 -0
- litestar_vite/templates/vue/env.d.ts.j2 +7 -0
- litestar_vite/templates/vue/index.html.j2 +13 -0
- litestar_vite/templates/vue/src/App.vue.j2 +28 -0
- litestar_vite/templates/vue/src/main.ts.j2 +5 -0
- litestar_vite/templates/vue/src/style.css.j2 +45 -0
- litestar_vite/templates/vue/vite.config.ts.j2 +39 -0
- litestar_vite/templates/vue-inertia/env.d.ts.j2 +7 -0
- litestar_vite/templates/vue-inertia/index.html.j2 +14 -0
- litestar_vite/templates/vue-inertia/package.json.j2 +50 -0
- litestar_vite/templates/vue-inertia/resources/main.ts.j2 +18 -0
- litestar_vite/templates/vue-inertia/resources/pages/Home.vue.j2 +22 -0
- litestar_vite/templates/vue-inertia/resources/ssr.ts.j2 +21 -0
- litestar_vite/templates/vue-inertia/resources/style.css.j2 +21 -0
- litestar_vite/templates/vue-inertia/vite.config.ts.j2 +59 -0
- litestar_vite-0.15.0.dist-info/METADATA +230 -0
- litestar_vite-0.15.0.dist-info/RECORD +164 -0
- {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0.dist-info}/WHEEL +1 -1
- litestar_vite/config.py +0 -100
- litestar_vite/plugin.py +0 -45
- litestar_vite/template_engine.py +0 -103
- litestar_vite-0.1.1.dist-info/METADATA +0 -68
- litestar_vite-0.1.1.dist-info/RECORD +0 -11
- {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: litestar-vite
|
|
3
|
+
Version: 0.15.0
|
|
4
|
+
Summary: Vite plugin for Litestar
|
|
5
|
+
Project-URL: Changelog, https://litestar-org.github.io/litestar-vite/latest/changelog
|
|
6
|
+
Project-URL: Discord, https://discord.gg/X3FJqy8d2j
|
|
7
|
+
Project-URL: Documentation, https://litestar-org.github.io/litestar-vite/latest/
|
|
8
|
+
Project-URL: Homepage, https://litestar-org.github.io/litestar-vite/latest/
|
|
9
|
+
Project-URL: Issue, https://github.com/litestar-org/litestar-vite/issues/
|
|
10
|
+
Project-URL: Source, https://github.com/litestar-org/litestar-vite
|
|
11
|
+
Author-email: Cody Fincher <cody.fincher@gmail.com>
|
|
12
|
+
License: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: litestar,vite
|
|
15
|
+
Classifier: Environment :: Web Environment
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Natural Language :: English
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Programming Language :: Python
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
27
|
+
Classifier: Topic :: Database
|
|
28
|
+
Classifier: Topic :: Database :: Database Engines/Servers
|
|
29
|
+
Classifier: Topic :: Software Development
|
|
30
|
+
Classifier: Typing :: Typed
|
|
31
|
+
Requires-Python: >=3.10
|
|
32
|
+
Requires-Dist: httpx>=0.24.1
|
|
33
|
+
Requires-Dist: litestar>=2.7.0
|
|
34
|
+
Requires-Dist: typing-extensions
|
|
35
|
+
Requires-Dist: websockets>=12.0
|
|
36
|
+
Provides-Extra: http2
|
|
37
|
+
Requires-Dist: h2>=4.0.0; extra == 'http2'
|
|
38
|
+
Provides-Extra: jinja
|
|
39
|
+
Requires-Dist: jinja2; extra == 'jinja'
|
|
40
|
+
Provides-Extra: nodeenv
|
|
41
|
+
Requires-Dist: nodeenv; extra == 'nodeenv'
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
# Litestar Vite
|
|
45
|
+
|
|
46
|
+
Litestar Vite connects the Litestar backend to a Vite toolchain. It supports SPA, Template, and Inertia flows, and can proxy Vite dev traffic through your ASGI port or run Vite directly.
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- One-port dev: proxies Vite HTTP + WS/HMR through Litestar by default; switch to two-port with `VITE_PROXY_MODE=direct`.
|
|
51
|
+
- SSR framework support: use `mode="ssr"` for Astro, Nuxt, SvelteKit - proxies everything except your API routes.
|
|
52
|
+
- Production assets: reads Vite manifest from `public/manifest.json` (configurable) and serves under `asset_url`.
|
|
53
|
+
- Type-safe frontends: optional OpenAPI/routes export + `@hey-api/openapi-ts` via the Vite plugin.
|
|
54
|
+
- Inertia support: v2 protocol with session middleware and optional SPA mode.
|
|
55
|
+
|
|
56
|
+
## Quick Start (SPA)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install litestar-vite
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import os
|
|
64
|
+
from pathlib import Path
|
|
65
|
+
from litestar import Litestar
|
|
66
|
+
from litestar_vite import VitePlugin, ViteConfig, PathConfig
|
|
67
|
+
|
|
68
|
+
DEV_MODE = os.getenv("VITE_DEV_MODE", "true").lower() in ("true", "1", "yes")
|
|
69
|
+
|
|
70
|
+
app = Litestar(
|
|
71
|
+
plugins=[VitePlugin(config=ViteConfig(
|
|
72
|
+
dev_mode=DEV_MODE,
|
|
73
|
+
paths=PathConfig(root=Path(__file__).parent),
|
|
74
|
+
))]
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
litestar run --reload # Vite dev server is proxied automatically
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Scaffold a frontend: `litestar assets init --template vue` (or `react`, `svelte`, `htmx`, `react-inertia`, `vue-inertia`, `angular`, `astro`, `nuxt`, `sveltekit`).
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
To contribute or run the development project:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Install all dependencies and build packages
|
|
90
|
+
make install && make build
|
|
91
|
+
|
|
92
|
+
# Install frontend dependencies for an example
|
|
93
|
+
uv run litestar --app-dir examples/vue-inertia assets install
|
|
94
|
+
|
|
95
|
+
# Run the development server
|
|
96
|
+
uv run litestar --app-dir examples/vue-inertia run
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Replace `vue-inertia` with any other example: `vue`, `react`, `svelte`, `react-inertia`, `htmx`, `angular`, `astro`, `nuxt`, or `sveltekit`.
|
|
100
|
+
|
|
101
|
+
## Template / HTMX
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from pathlib import Path
|
|
105
|
+
from litestar import Litestar
|
|
106
|
+
from litestar.contrib.jinja import JinjaTemplateEngine
|
|
107
|
+
from litestar.template import TemplateConfig
|
|
108
|
+
from litestar_vite import VitePlugin, ViteConfig, PathConfig
|
|
109
|
+
|
|
110
|
+
here = Path(__file__).parent
|
|
111
|
+
|
|
112
|
+
app = Litestar(
|
|
113
|
+
template_config=TemplateConfig(directory=here / "templates", engine=JinjaTemplateEngine),
|
|
114
|
+
plugins=[VitePlugin(config=ViteConfig(
|
|
115
|
+
dev_mode=True,
|
|
116
|
+
paths=PathConfig(root=here),
|
|
117
|
+
))],
|
|
118
|
+
)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Inertia (v2)
|
|
122
|
+
|
|
123
|
+
Requires session middleware (32-char secret).
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
import os
|
|
127
|
+
from pathlib import Path
|
|
128
|
+
from litestar import Litestar
|
|
129
|
+
from litestar.middleware.session.client_side import CookieBackendConfig
|
|
130
|
+
from litestar_vite import VitePlugin, ViteConfig, PathConfig
|
|
131
|
+
from litestar_vite.inertia import InertiaConfig
|
|
132
|
+
|
|
133
|
+
here = Path(__file__).parent
|
|
134
|
+
SECRET_KEY = os.environ.get("SECRET_KEY", "development-only-secret-32-chars")
|
|
135
|
+
session = CookieBackendConfig(secret=SECRET_KEY.encode("utf-8"))
|
|
136
|
+
|
|
137
|
+
app = Litestar(
|
|
138
|
+
middleware=[session.middleware],
|
|
139
|
+
plugins=[VitePlugin(config=ViteConfig(
|
|
140
|
+
dev_mode=True,
|
|
141
|
+
paths=PathConfig(root=here),
|
|
142
|
+
inertia=InertiaConfig(root_template="index.html"),
|
|
143
|
+
))],
|
|
144
|
+
)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Meta-frameworks (Astro, Nuxt, SvelteKit)
|
|
148
|
+
|
|
149
|
+
Use `mode="ssr"` (or `mode="framework"`) to proxy non-API routes to the framework's dev server:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
import os
|
|
153
|
+
from pathlib import Path
|
|
154
|
+
from litestar import Litestar
|
|
155
|
+
from litestar_vite import VitePlugin, ViteConfig, PathConfig
|
|
156
|
+
|
|
157
|
+
here = Path(__file__).parent
|
|
158
|
+
DEV_MODE = os.getenv("VITE_DEV_MODE", "true").lower() in ("true", "1", "yes")
|
|
159
|
+
|
|
160
|
+
app = Litestar(
|
|
161
|
+
plugins=[
|
|
162
|
+
VitePlugin(config=ViteConfig(
|
|
163
|
+
mode="ssr",
|
|
164
|
+
dev_mode=DEV_MODE,
|
|
165
|
+
paths=PathConfig(root=here),
|
|
166
|
+
))
|
|
167
|
+
],
|
|
168
|
+
)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Proxy Modes
|
|
172
|
+
|
|
173
|
+
| Mode | Alias | Use Case |
|
|
174
|
+
|------|-------|----------|
|
|
175
|
+
| `vite` | - | SPAs - proxies Vite assets only (default) |
|
|
176
|
+
| `direct` | - | Two-port dev - expose Vite port directly |
|
|
177
|
+
| `proxy` | `ssr` | Meta-frameworks - proxies everything except API routes |
|
|
178
|
+
|
|
179
|
+
### Production Deployment
|
|
180
|
+
|
|
181
|
+
**Astro (static):** Astro generates static HTML by default. Build and serve with Litestar:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
litestar --app-dir examples/astro assets install
|
|
185
|
+
litestar --app-dir examples/astro assets build
|
|
186
|
+
VITE_DEV_MODE=false litestar --app-dir examples/astro run
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Nuxt/SvelteKit (SSR):** These run their own Node servers. Deploy as two services:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Terminal 1: SSR server
|
|
193
|
+
litestar --app-dir examples/nuxt assets build
|
|
194
|
+
litestar --app-dir examples/nuxt assets serve
|
|
195
|
+
|
|
196
|
+
# Terminal 2: Litestar API
|
|
197
|
+
VITE_DEV_MODE=false litestar --app-dir examples/nuxt run --port 8001
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Type generation
|
|
201
|
+
|
|
202
|
+
```python
|
|
203
|
+
VitePlugin(config=ViteConfig(types=True)) # enable exports
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
litestar assets generate-types # one-off or CI
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## CLI cheat sheet
|
|
211
|
+
|
|
212
|
+
- `litestar assets doctor` — diagnose/fix config
|
|
213
|
+
- `litestar assets init --template react|vue|svelte|...` — scaffold frontend
|
|
214
|
+
- `litestar assets build` / `serve` — build or watch
|
|
215
|
+
- `litestar assets deploy --storage gcs://bucket/assets` — upload via fsspec
|
|
216
|
+
- `litestar assets generate-types` — OpenAPI + routes → TS types
|
|
217
|
+
- `litestar assets install` — install frontend deps with the configured executor
|
|
218
|
+
|
|
219
|
+
### Doctor command highlights
|
|
220
|
+
|
|
221
|
+
- Prints Python vs Vite config snapshot (asset URLs, bundle/hot paths, ports, modes).
|
|
222
|
+
- Flags missing hot file (dev proxy), missing manifest (prod), type-gen exports, env/config mismatches, and plugin install issues.
|
|
223
|
+
- `--fix` can rewrite simple vite.config values (assetUrl, bundleDir, hotFile, type paths) after creating a backup.
|
|
224
|
+
|
|
225
|
+
## Links
|
|
226
|
+
|
|
227
|
+
- Docs: <https://litestar-org.github.io/litestar-vite/>
|
|
228
|
+
- Examples: `examples/` (react, vue, svelte, react-inertia, vue-inertia, astro, nuxt, sveltekit, htmx)
|
|
229
|
+
- Real-world example: [litestar-fullstack](https://github.com/litestar-org/litestar-fullstack) - Full-featured application using litestar-vite
|
|
230
|
+
- Issues: <https://github.com/litestar-org/litestar-vite/issues/>
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
litestar_vite/__init__.py,sha256=6z2O7JKG-PplQmFczzTyW862wkOrW4M_xm1VI47bHHM,1421
|
|
2
|
+
litestar_vite/__metadata__.py,sha256=dMGIPS6M11LcmiEfnMJJrbSPH8Lf00pU8crIIUsIBPw,478
|
|
3
|
+
litestar_vite/cli.py,sha256=b-vEKyphvA1IpqNkM75xTC2CoRAR5MvfJpNOrzL8ST8,39343
|
|
4
|
+
litestar_vite/commands.py,sha256=A2h5a9wdPPfv62P8CtvzJlG1RViTEFaMzEEAogh_Z6Y,2470
|
|
5
|
+
litestar_vite/deploy.py,sha256=2scl2WAI7VttUk-PVCSD7BJB3Ryndfpha93BrZUwZ4I,12251
|
|
6
|
+
litestar_vite/doctor.py,sha256=_fScfKrwRvfbPtdcuaPAGyGQGl1iUlkDVtRzY6dWzs0,47301
|
|
7
|
+
litestar_vite/exceptions.py,sha256=9PfOfC1eLxY3ZmMBCxv1NLAbkREMz5BZzpPgVbgYfTA,2651
|
|
8
|
+
litestar_vite/executor.py,sha256=sckMrixPullgPm1QnMSlvMzB7MYbD5Yq9CAZRaUxKyg,12536
|
|
9
|
+
litestar_vite/html_transform.py,sha256=gZrKAd3s6gEaz7P9nCU-0GFaOo0tj4poKD3T1tzi6UQ,20988
|
|
10
|
+
litestar_vite/loader.py,sha256=Z4q7SmI0X-HTIL2HqaKE3SGotBMRIVDFb2MouWB9t2E,18492
|
|
11
|
+
litestar_vite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
litestar_vite/codegen/__init__.py,sha256=606DhmDtOTFD_4ohST1d20oU6NE0cC1_J2tCrXD2qj8,1667
|
|
13
|
+
litestar_vite/codegen/_export.py,sha256=lLEHly9YNp-K8GYwI4epxD3L3QIF9oLPuculsuEsDGU,8647
|
|
14
|
+
litestar_vite/codegen/_inertia.py,sha256=DceTgMtK7jC5_YZehXgYNtBEZ8oZpL9dYbZCqdiQEAc,24126
|
|
15
|
+
litestar_vite/codegen/_openapi.py,sha256=ln8F80gOLt_6b0mfwNcx8sM0hbmG414nCDL5DA6Uc8s,10353
|
|
16
|
+
litestar_vite/codegen/_routes.py,sha256=JdKVm_4ur-GTnaeIBqQ2mPMvz7Fn7UWxxWopb1oRZmQ,24955
|
|
17
|
+
litestar_vite/codegen/_ts.py,sha256=T0BQyLuE4BIju688o95hnCvqSjCufyRBbijx5cB0xTY,7940
|
|
18
|
+
litestar_vite/codegen/_utils.py,sha256=zNPRV0IbgAXSy0MkM4e6iruebyiIJI3BPaisKSs-6HA,4990
|
|
19
|
+
litestar_vite/config/__init__.py,sha256=q0WUB1Jb2XUR_Q_Q0jscPJUUtLfdJ7RHWf-_j8Bvr4g,34375
|
|
20
|
+
litestar_vite/config/_constants.py,sha256=a1heIM2-2vERJ5NPVZpnSqaaeXOl06YeHODAvs_Ni90,2379
|
|
21
|
+
litestar_vite/config/_deploy.py,sha256=USASwxh4WE0N8hRzcPBIqDSF81keznrnxrfff93_hcQ,3103
|
|
22
|
+
litestar_vite/config/_inertia.py,sha256=r_8LkvOeORIjfJWh6iJk1hh8ibcwSv7UkzoNeQNLPuA,9177
|
|
23
|
+
litestar_vite/config/_paths.py,sha256=TpniHT7kWZ4_O2gY4mXFokHiVsdBWtqXGNPzKdbWCEE,2827
|
|
24
|
+
litestar_vite/config/_runtime.py,sha256=fmxAEAS4w19int3-89siihDH3yt591LM_GPYV26yc3k,9840
|
|
25
|
+
litestar_vite/config/_spa.py,sha256=tPPl8XM_8-dFtbB8xIHBDcxzieJynVsyMRJv8Ph9Hvc,3330
|
|
26
|
+
litestar_vite/config/_types.py,sha256=TuQiGtL-Up4nrGM0zYQskrOgh9kRW0HpHYm-EaNqywM,4199
|
|
27
|
+
litestar_vite/handler/__init__.py,sha256=B01DmuRKV6QJMfy_LrLQuFvf8mZ7BE8nDyX0ZQLJLVA,218
|
|
28
|
+
litestar_vite/handler/_app.py,sha256=a2hTDgtNatKEr4BlC3yCESweFp4rdboVz6T2XRfZvzM,23783
|
|
29
|
+
litestar_vite/handler/_routing.py,sha256=rHO7zsWOtFgQ1-A02BGh-QU3vEvze9MvUGIqPiF8jTs,4540
|
|
30
|
+
litestar_vite/inertia/__init__.py,sha256=3u880UBcZwq42bGvpeHZmxsw7LItW1IXeK_CGoan1I0,1893
|
|
31
|
+
litestar_vite/inertia/_utils.py,sha256=aSP37Z0VmIHoYoNgne2uPBR8EYtkGHpnggeytklhDj0,3154
|
|
32
|
+
litestar_vite/inertia/exception_handler.py,sha256=HLFnl5jSxonCoz4pRRO0ChbtdiBtcDXm9-7cjHDwmDQ,7803
|
|
33
|
+
litestar_vite/inertia/helpers.py,sha256=syCOMPthz1kcAVvteUHY1o-_ttwgXSSD6KGKtZbQ8UU,52734
|
|
34
|
+
litestar_vite/inertia/middleware.py,sha256=GIwOl_KZyI6KAJ2VY4aK_WZiPM1F_LSgdH3yRFgkm1M,1998
|
|
35
|
+
litestar_vite/inertia/plugin.py,sha256=5qDdnBcaFs8_wVzzfZa6W9JeZBFIKYvT2sclh-0JsSs,8362
|
|
36
|
+
litestar_vite/inertia/precognition.py,sha256=DzeEJUBxKqxY4uxP8hLuj0Xb2c4Bbw5nIyvubZmKRcg,10476
|
|
37
|
+
litestar_vite/inertia/request.py,sha256=uASJ0NTrbNlnWSvIrjjHL0HBdLTnKo6dY7aHotCgz-E,10916
|
|
38
|
+
litestar_vite/inertia/response.py,sha256=CtMJ2ZyA53wM3nlQgaQ_3BwpWoxMO5teQSMIYs-C53Y,33726
|
|
39
|
+
litestar_vite/inertia/types.py,sha256=dwYML3yLVrJ0EZExE4_p00aXvlLtzkuSrkKVLKrcK28,10694
|
|
40
|
+
litestar_vite/plugin/__init__.py,sha256=FpnQj_kJ80EdJtea125On5oDzODrNUW69ZaNFSP2huU,26269
|
|
41
|
+
litestar_vite/plugin/_process.py,sha256=OV04ft6u22H-arIp0Kwj5b6Z7SccydLk3IyXibZgIq0,7012
|
|
42
|
+
litestar_vite/plugin/_proxy.py,sha256=cTgnRB8lfYk1ZzZ_Bubhcpjj_LO5K99Ek0n1gV30Q0w,26574
|
|
43
|
+
litestar_vite/plugin/_proxy_headers.py,sha256=gPCFVJkccQYWkw_jjPHfTQHxVfezRW3jK9l8NPZdAOM,9613
|
|
44
|
+
litestar_vite/plugin/_static.py,sha256=4Bzn4i8GTHDpaUtG7KcqqbvgW4o10m7BNTKwL1YLJp0,1421
|
|
45
|
+
litestar_vite/plugin/_utils.py,sha256=Eh19QtwomASRFJ-ec3UnDAjqBTn3MnfakINWQ9XBifc,16035
|
|
46
|
+
litestar_vite/scaffolding/__init__.py,sha256=3MkLZtAjyZYHh7THWYZF5HFsxXHHT9t3_pcF8zwL07g,652
|
|
47
|
+
litestar_vite/scaffolding/generator.py,sha256=Y1PPT1-u-ujgaJ4aD43IdcnI_hal75HjsdOINNeCm8w,9172
|
|
48
|
+
litestar_vite/scaffolding/templates.py,sha256=kX2jNmmddy48YqYQFdcMcWBaAo3IbGzEDcTYAgyVzcs,14371
|
|
49
|
+
litestar_vite/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
|
+
litestar_vite/templates/addons/tailwindcss/tailwind.css.j2,sha256=QgcOC0W7IBsrg4pSqqpull-WTgtULZfx_lF_5ZxLdag,23
|
|
51
|
+
litestar_vite/templates/angular/index.html.j2,sha256=lEnI1yFMq2BGK_cxnHwFnhx6rfHbsdFzdid0clsJM1o,319
|
|
52
|
+
litestar_vite/templates/angular/openapi-ts.config.ts.j2,sha256=bsnHZ9GiNk98_BK1V0G02cNHUHwtbgINzWr0zuu3mHg,400
|
|
53
|
+
litestar_vite/templates/angular/package.json.j2,sha256=zMOsRLWYKuAxSMCLb683uCS3oW3QcwBAHlUgFcsElSA,873
|
|
54
|
+
litestar_vite/templates/angular/tsconfig.app.json.j2,sha256=O1STsrXFeL-TM1z4zv7l38hGK3LgV7wtflN2zfdb_V4,988
|
|
55
|
+
litestar_vite/templates/angular/tsconfig.json.j2,sha256=aB2V5FFJXYvJWHccnLTcxjYr8aH6Ffxc0dVqOPueBZI,491
|
|
56
|
+
litestar_vite/templates/angular/vite.config.ts.j2,sha256=7mN399dErmChKLhRDXovHBMuTaagyu6Am8PUoneyhGY,600
|
|
57
|
+
litestar_vite/templates/angular/src/main.ts.j2,sha256=GoGPeumY5SN3DZj7pbD3ct8_d6V5pVlc_-1Sk5Y7ips,327
|
|
58
|
+
litestar_vite/templates/angular/src/styles.css.j2,sha256=ok41iiQlpVywb0lohl0x1HVAiPq19PX_6u8pEPDZvxM,242
|
|
59
|
+
litestar_vite/templates/angular/src/app/app.component.css.j2,sha256=7CyJ_ekTyv90G6oLDzz2iprLXoVGfk8htsgk_a0gE5Q,28
|
|
60
|
+
litestar_vite/templates/angular/src/app/app.component.html.j2,sha256=JtDZXjjOC8_g1GDMGiN8GCxkki8rGnfS2g_HpRD5RXs,14
|
|
61
|
+
litestar_vite/templates/angular/src/app/app.component.ts.j2,sha256=SGbzdLsv_bijTbt6vCGF5rBLx4s3vixX-P9IB8GmAK8,207
|
|
62
|
+
litestar_vite/templates/angular/src/app/app.config.ts.j2,sha256=vSMNCRyDqIIjIHUTZoa6mhjW1PrEeeKjpEkqrZtsFRA,123
|
|
63
|
+
litestar_vite/templates/angular-cli/.postcssrc.json.j2,sha256=bJanvszoCUi1KJeoloqBVkTXDb5kcieuYnqcyg7curs,54
|
|
64
|
+
litestar_vite/templates/angular-cli/angular.json.j2,sha256=XboCBhSihwkpQjbowuUJPqjfbQ3U2tP_3qg9AHnZ5pw,1092
|
|
65
|
+
litestar_vite/templates/angular-cli/openapi-ts.config.ts.j2,sha256=bsnHZ9GiNk98_BK1V0G02cNHUHwtbgINzWr0zuu3mHg,400
|
|
66
|
+
litestar_vite/templates/angular-cli/package.json.j2,sha256=DNvg8m-3jiSfIXHXzMnJ6A8PRXRb2AbOI3Rwy9QAVNY,670
|
|
67
|
+
litestar_vite/templates/angular-cli/proxy.conf.json.j2,sha256=63K860aZoEizF4BsL-dUjguko0VfsNRdVvjQ3wG1b94,337
|
|
68
|
+
litestar_vite/templates/angular-cli/tailwind.config.js.j2,sha256=uZ_nSmbT7e4kVeX5IggRM_q10ZLRPaqk0aypUOubdbE,100
|
|
69
|
+
litestar_vite/templates/angular-cli/tsconfig.app.json.j2,sha256=oNNNykaLX3mVSnzreqTm1HeUyH6O5qKb4mBMBNULJc0,416
|
|
70
|
+
litestar_vite/templates/angular-cli/tsconfig.json.j2,sha256=T2mVozneR2j34lBHB-pkpJ22CSEoN7f3lNmgYFJ9u9g,716
|
|
71
|
+
litestar_vite/templates/angular-cli/tsconfig.spec.json.j2,sha256=Vt3nU6jZ_u1L8QELTX8KDwl4tVduRJ6S-EEd_BjXq-g,192
|
|
72
|
+
litestar_vite/templates/angular-cli/src/index.html.j2,sha256=1MUNk69gJtKhc4hb3jSWiQaay7V6fZ66ACfvbLRJRhI,332
|
|
73
|
+
litestar_vite/templates/angular-cli/src/main.ts.j2,sha256=71dZCa10Rw_gd3bbTkige2RFKGP5W7PIVjc4nUHvILY,248
|
|
74
|
+
litestar_vite/templates/angular-cli/src/styles.css.j2,sha256=JW-NAUrCgTYsijNRWhOeuMPyYp0QMk2QPptpGB6-h_g,243
|
|
75
|
+
litestar_vite/templates/angular-cli/src/app/app.component.css.j2,sha256=7CyJ_ekTyv90G6oLDzz2iprLXoVGfk8htsgk_a0gE5Q,28
|
|
76
|
+
litestar_vite/templates/angular-cli/src/app/app.component.html.j2,sha256=JtDZXjjOC8_g1GDMGiN8GCxkki8rGnfS2g_HpRD5RXs,14
|
|
77
|
+
litestar_vite/templates/angular-cli/src/app/app.component.ts.j2,sha256=SGbzdLsv_bijTbt6vCGF5rBLx4s3vixX-P9IB8GmAK8,207
|
|
78
|
+
litestar_vite/templates/angular-cli/src/app/app.config.ts.j2,sha256=vSMNCRyDqIIjIHUTZoa6mhjW1PrEeeKjpEkqrZtsFRA,123
|
|
79
|
+
litestar_vite/templates/astro/astro.config.mjs.j2,sha256=iV3C-g7vuJOhqeZ5CFXJQRArPFL59N-jgcctSOMDT7o,854
|
|
80
|
+
litestar_vite/templates/astro/openapi-ts.config.ts.j2,sha256=SLbesyZvl5tDPy-e3wR2tcPYcQI2Osq21S8G5zS_T5w,356
|
|
81
|
+
litestar_vite/templates/astro/src/layouts/Layout.astro.j2,sha256=fBwznyNapGZJgcGHBLmLvMjxuPsZ5ssPU_Ooae2oXJw,1252
|
|
82
|
+
litestar_vite/templates/astro/src/pages/index.astro.j2,sha256=f8zErww-qoLHLxR7g5Ac7YFlx6LJJ2WrXyVQU56ICMw,626
|
|
83
|
+
litestar_vite/templates/astro/src/styles/global.css.j2,sha256=oxYbL_6aNdNc9gc0BKFQdxZ0ZYxbtyiuf7k-1O0KnLA,49
|
|
84
|
+
litestar_vite/templates/base/.gitignore.j2,sha256=NeAMLX5IAWbNw_HlBma846zKEaQEVbQN-iO9akBuOKk,355
|
|
85
|
+
litestar_vite/templates/base/openapi-ts.config.ts.j2,sha256=tBS4wDuPZOtxXKiod7ZNi1v93uaATIEdd-UZ6H9TPVE,356
|
|
86
|
+
litestar_vite/templates/base/package.json.j2,sha256=FJhhApMQy8UK-CjeaGEzLkWdmSnSq8mXxbYu-TnWP1M,1124
|
|
87
|
+
litestar_vite/templates/base/tsconfig.json.j2,sha256=oLXhTh1ULIGka2aiTyyTRnRTzXgMyvPekPbBbH23VwU,1069
|
|
88
|
+
litestar_vite/templates/base/resources/vite-env.d.ts.j2,sha256=ZZlpNvuwQpFfe3SiAPzd5-QQ8ypmmxq5WXz6pLD63bU,38
|
|
89
|
+
litestar_vite/templates/htmx/vite.config.ts.j2,sha256=BVPMU1VADecUNIRbL2E9-9NLWvekak1aihyyVXr-U6g,865
|
|
90
|
+
litestar_vite/templates/htmx/src/main.js.j2,sha256=F0qsnUECff7SBdYSF4eM087H04XH3uzjYo701T1nXb4,176
|
|
91
|
+
litestar_vite/templates/htmx/templates/base.html.j2.j2,sha256=I8IUuSvADnKhyxbuTTMIDtCcLrVv2vIc8aoPAVCh6YU,1395
|
|
92
|
+
litestar_vite/templates/htmx/templates/index.html.j2.j2,sha256=Lx7i_pdR5UaEUGTWpxsxBCXaU1Ppm9ZBP1wJROP1Icc,367
|
|
93
|
+
litestar_vite/templates/nuxt/app.vue.j2,sha256=iiHHOzTsXiLau4o6al-W4fkubWNoFq4ImU47hUFZrKQ,551
|
|
94
|
+
litestar_vite/templates/nuxt/nuxt.config.ts.j2,sha256=uW6_4zt-DvYrSxVDyQIeNOlfe3aFzai4PhO_p3SJdJ8,982
|
|
95
|
+
litestar_vite/templates/nuxt/openapi-ts.config.ts.j2,sha256=ttFYDARQhtgZo5y1RPfJDm0n8GYsERKv8KtHs14K9hU,317
|
|
96
|
+
litestar_vite/templates/nuxt/composables/useApi.ts.j2,sha256=G6Oqi9VMzquLPwkDVV3IsljGpUV6OycdlS-l1tXdbzI,905
|
|
97
|
+
litestar_vite/templates/nuxt/pages/index.vue.j2,sha256=LxC7s_N-qXZhjdzW6-77_fGDxIbpVzJkEUvlnkOoCaA,851
|
|
98
|
+
litestar_vite/templates/react/index.html.j2,sha256=vJQk1SeeL8zj7eh_R5Z9hulPhVqGogiC9wys72vff_I,382
|
|
99
|
+
litestar_vite/templates/react/vite.config.ts.j2,sha256=4yoCesOaPcipOVV82AneKaBQHjz4rsBBD0PcKoTpDO0,811
|
|
100
|
+
litestar_vite/templates/react/src/App.css.j2,sha256=OxIIilAjaaZ9J5bhJ-bybunK6GgEaCootwYL-sdghrM,987
|
|
101
|
+
litestar_vite/templates/react/src/App.tsx.j2,sha256=eTMcZCisXmjPDTxlvl9mv0_mVmRaNS4ctfK07NjKgmM,392
|
|
102
|
+
litestar_vite/templates/react/src/main.tsx.j2,sha256=jn5402e-IPzroxfS25upeLPtvd8aJod_pGHaYUVWKDU,228
|
|
103
|
+
litestar_vite/templates/react-inertia/index.html.j2,sha256=UI0OvfKMFHwz7KNyLa9lxHGK3Dhrd-L6vtsiEu4PklM,449
|
|
104
|
+
litestar_vite/templates/react-inertia/package.json.j2,sha256=W_TQJUW2SwVNFgDrI5WaAYI4sB-bGbiq8Kd3Qtni_I4,1334
|
|
105
|
+
litestar_vite/templates/react-inertia/vite.config.ts.j2,sha256=2CWY1i_U7RcLM-HMCkGeAlDN0doc9UcW-xVPpHzPEzw,1150
|
|
106
|
+
litestar_vite/templates/react-inertia/resources/App.css.j2,sha256=TPVP6MVH2zEgSR7enDt-AXj4LUnDIoMu7NvLoWC8xAY,1056
|
|
107
|
+
litestar_vite/templates/react-inertia/resources/main.tsx.j2,sha256=GZsP-KJ42HvI_XOHb7dcOGlhG_6EGZqzmT-45gos-a4,500
|
|
108
|
+
litestar_vite/templates/react-inertia/resources/ssr.tsx.j2,sha256=_vfiqA3_Dzma0omyjFfM7qqBDhmOz241NGZSLNsVHkE,614
|
|
109
|
+
litestar_vite/templates/react-inertia/resources/pages/Home.tsx.j2,sha256=S1XAbXKFymCt3WSC_qayE5YA2btSG7S-XwTpF-jYa1k,375
|
|
110
|
+
litestar_vite/templates/react-router/index.html.j2,sha256=M7mULWfMMDN_V7usfKw2v2Iw2-e-fuwn0-AIuOxaL6o,319
|
|
111
|
+
litestar_vite/templates/react-router/vite.config.ts.j2,sha256=4yoCesOaPcipOVV82AneKaBQHjz4rsBBD0PcKoTpDO0,811
|
|
112
|
+
litestar_vite/templates/react-router/src/App.css.j2,sha256=oKhbDtTpOdIQGI4llLwf6NPiGPx4h9FhzdvVpywlNHQ,346
|
|
113
|
+
litestar_vite/templates/react-router/src/App.tsx.j2,sha256=uUzE_BV5THUCn2xIHo2DJJP9W8ADGsCY9yGbN0PWZik,119
|
|
114
|
+
litestar_vite/templates/react-router/src/main.tsx.j2,sha256=6sAB4YrC8wyRYEFdfYegClpVvh4WT79yxwxV7HQ3NeA,227
|
|
115
|
+
litestar_vite/templates/react-tanstack/index.html.j2,sha256=M7mULWfMMDN_V7usfKw2v2Iw2-e-fuwn0-AIuOxaL6o,319
|
|
116
|
+
litestar_vite/templates/react-tanstack/openapi-ts.config.ts.j2,sha256=BdrmDeRh0dKHVyJOEBYNxNfDkivr5w_oF5o1v14HXlE,404
|
|
117
|
+
litestar_vite/templates/react-tanstack/vite.config.ts.j2,sha256=7jTZ5quvBDSnBFqQZ7-R8Of5H4TtHKUbS1ZtDLFo1lA,870
|
|
118
|
+
litestar_vite/templates/react-tanstack/src/App.css.j2,sha256=oKhbDtTpOdIQGI4llLwf6NPiGPx4h9FhzdvVpywlNHQ,346
|
|
119
|
+
litestar_vite/templates/react-tanstack/src/main.tsx.j2,sha256=aRh7VWjNojS6V-pMTddoK2HxCz51FLoP-Ojtst5emvI,569
|
|
120
|
+
litestar_vite/templates/react-tanstack/src/routeTree.gen.ts.j2,sha256=E7frsgniLGgl3jUkINs8KJJhy6wIIl0lNJA6XzIKzDg,294
|
|
121
|
+
litestar_vite/templates/react-tanstack/src/routes/__root.tsx.j2,sha256=FH2STyfqDJGmtJPdcwGpK6IQVBdBcdpWIIrrqrD4lL0,176
|
|
122
|
+
litestar_vite/templates/react-tanstack/src/routes/books.tsx.j2,sha256=VlChNKb4ggK8NRvOrshw-tzB4agdtem2Rr3YsSlcR38,186
|
|
123
|
+
litestar_vite/templates/react-tanstack/src/routes/index.tsx.j2,sha256=8aVZrx0MV5m_qYRzSGRS-kcjCjil9uWUZ4bqzFPVmsQ,181
|
|
124
|
+
litestar_vite/templates/svelte/index.html.j2,sha256=LW991plBL1vlU7tdoyJ-5aB54NztbKDCOXX-N3SK7ok,380
|
|
125
|
+
litestar_vite/templates/svelte/svelte.config.js.j2,sha256=J7deVkC7BMu73RMcfX0LJxidaQgEMPNdDunarZzpmTA,116
|
|
126
|
+
litestar_vite/templates/svelte/vite.config.ts.j2,sha256=6GqupB_dqHllrsi4Cglwc7cRIq7bCiKW8LVRBCR86Jk,824
|
|
127
|
+
litestar_vite/templates/svelte/src/App.svelte.j2,sha256=D0LAFvgqLakIM192CYOIETNNtwaMQTZ4nIOjEacSrMc,444
|
|
128
|
+
litestar_vite/templates/svelte/src/app.css.j2,sha256=danFuvZ3cTKGCS-GumMTlpxpqocQ_9rE80nDPdHOcwk,872
|
|
129
|
+
litestar_vite/templates/svelte/src/main.ts.j2,sha256=4rroqhfFf5cqn6adcC-0MvvEGTt16yCJnPmIA-Aexh0,143
|
|
130
|
+
litestar_vite/templates/svelte/src/vite-env.d.ts.j2,sha256=zJwBq4LNhm1ZaxEChjeihMPMpLEV0qpaAsMdLFmXf8E,71
|
|
131
|
+
litestar_vite/templates/svelte-inertia/index.html.j2,sha256=kEucsfi-lVPR151vAhjxyC6rdrU2-2VhegTqmK2Ptjs,448
|
|
132
|
+
litestar_vite/templates/svelte-inertia/svelte.config.js.j2,sha256=J7deVkC7BMu73RMcfX0LJxidaQgEMPNdDunarZzpmTA,116
|
|
133
|
+
litestar_vite/templates/svelte-inertia/vite.config.ts.j2,sha256=RfC11aqGLEaKxuXoCRY_hYPuggXWl739fPDtvh0Nb14,768
|
|
134
|
+
litestar_vite/templates/svelte-inertia/resources/app.css.j2,sha256=iGKzknt04zJ29-zIdThkszGnTQe-C2pdyt6zAT_3rdE,462
|
|
135
|
+
litestar_vite/templates/svelte-inertia/resources/main.ts.j2,sha256=jP5KTQRn1jQLdn-70AypUxghSDs1wRi5p60i6Nufv74,346
|
|
136
|
+
litestar_vite/templates/svelte-inertia/resources/vite-env.d.ts.j2,sha256=zJwBq4LNhm1ZaxEChjeihMPMpLEV0qpaAsMdLFmXf8E,71
|
|
137
|
+
litestar_vite/templates/svelte-inertia/resources/pages/Home.svelte.j2,sha256=QGOmxp2Y8-HxW1LXJJVDjVdeYqMVwUn0c43nrFe6Tao,740
|
|
138
|
+
litestar_vite/templates/sveltekit/openapi-ts.config.ts.j2,sha256=MpSEEQwJQ2zz-6wg_2kRsBVshoDYk1vS87i2xwEWMvQ,334
|
|
139
|
+
litestar_vite/templates/sveltekit/svelte.config.js.j2,sha256=dvoVhI4FP-PlIf4tkKuXAt-m9J8OouN-nNWew45mrFA,270
|
|
140
|
+
litestar_vite/templates/sveltekit/tsconfig.json.j2,sha256=Su4tOAJKM9eEI7rHcGxAjf_ya85j0Eigym1-2UQnnhw,363
|
|
141
|
+
litestar_vite/templates/sveltekit/vite.config.ts.j2,sha256=l3buMnky7psThMwBfHUcgv7FIiyA5Ge5_G2AQqeNep4,942
|
|
142
|
+
litestar_vite/templates/sveltekit/src/app.css.j2,sha256=pkFVaARbo97abjGZ60dCjLPi_VdFrOo7xHnqDQI_IsY,786
|
|
143
|
+
litestar_vite/templates/sveltekit/src/app.html.j2,sha256=5FiwObWMDo2rDaxGG4-5BFPGj0_lO1NKHMOEsLR1mkc,360
|
|
144
|
+
litestar_vite/templates/sveltekit/src/hooks.server.ts.j2,sha256=JeIKNDzctwlKqvbBq3yFBcACYSG6sCPh_HFmyLsPPLY,2239
|
|
145
|
+
litestar_vite/templates/sveltekit/src/routes/+layout.svelte.j2,sha256=fKXQZNrYOURUPPTmiBo9F7crDLxwudh3-tQ2g9P_5aM,202
|
|
146
|
+
litestar_vite/templates/sveltekit/src/routes/+page.svelte.j2,sha256=AXTPN9l_k1_zITu3hP_DHYE17EDChVdDA95th0AX0YU,504
|
|
147
|
+
litestar_vite/templates/vue/env.d.ts.j2,sha256=FEzWdKE_58QVLmJj7EhACflloL4h4hxr9qCr6z8xjLU,189
|
|
148
|
+
litestar_vite/templates/vue/index.html.j2,sha256=LW991plBL1vlU7tdoyJ-5aB54NztbKDCOXX-N3SK7ok,380
|
|
149
|
+
litestar_vite/templates/vue/vite.config.ts.j2,sha256=KXXZhYxRCQ8YKwElTATXbT7d1L0yUwe2_fEFKPA1YrA,804
|
|
150
|
+
litestar_vite/templates/vue/src/App.vue.j2,sha256=K8Zano4I_CZUQkCe16JIYPi2QMkpYj_576y1Lhr8Zb4,469
|
|
151
|
+
litestar_vite/templates/vue/src/main.ts.j2,sha256=Qaecy31EDctV3TooxqYgVsWbTod9n8vhfJzV1_u-LBQ,115
|
|
152
|
+
litestar_vite/templates/vue/src/style.css.j2,sha256=dynk8iHiXQgZHAnsBxMPxoyewP4P5s5ebliXVC95xVw,872
|
|
153
|
+
litestar_vite/templates/vue-inertia/env.d.ts.j2,sha256=FEzWdKE_58QVLmJj7EhACflloL4h4hxr9qCr6z8xjLU,189
|
|
154
|
+
litestar_vite/templates/vue-inertia/index.html.j2,sha256=kEucsfi-lVPR151vAhjxyC6rdrU2-2VhegTqmK2Ptjs,448
|
|
155
|
+
litestar_vite/templates/vue-inertia/package.json.j2,sha256=FK-cG8ZCmYXFfvakGxkdxB_wrV8bBaY3yDw-rYksjjw,1471
|
|
156
|
+
litestar_vite/templates/vue-inertia/vite.config.ts.j2,sha256=vWK9Ur43tY3c_g_9RPMvzRt1_pgiFU-7seYLMaoiBXY,1142
|
|
157
|
+
litestar_vite/templates/vue-inertia/resources/main.ts.j2,sha256=6wi8R1QXY_fS1WDCgup1vaDtXSswtgYY-tWWzEVIumE,526
|
|
158
|
+
litestar_vite/templates/vue-inertia/resources/ssr.ts.j2,sha256=ptxNGMv8mBDVLYzozpTZWfp2vYXLM_OmfXRDjbJD8l0,686
|
|
159
|
+
litestar_vite/templates/vue-inertia/resources/style.css.j2,sha256=iGKzknt04zJ29-zIdThkszGnTQe-C2pdyt6zAT_3rdE,462
|
|
160
|
+
litestar_vite/templates/vue-inertia/resources/pages/Home.vue.j2,sha256=wcTvXgjQZ9CxQ6aTWp95w6YS6pE1RD-BITy1lJtBmrU,702
|
|
161
|
+
litestar_vite-0.15.0.dist-info/METADATA,sha256=TRaiAryEAoGS9ODyqiEJn6ZF_eMBVqLTQvKDabO58D8,7674
|
|
162
|
+
litestar_vite-0.15.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
163
|
+
litestar_vite-0.15.0.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
|
|
164
|
+
litestar_vite-0.15.0.dist-info/RECORD,,
|
litestar_vite/config.py
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass, field
|
|
4
|
-
from functools import cached_property
|
|
5
|
-
from inspect import isclass
|
|
6
|
-
from typing import TYPE_CHECKING, Generic, TypeVar, cast
|
|
7
|
-
|
|
8
|
-
from litestar.exceptions import ImproperlyConfiguredException
|
|
9
|
-
from litestar.template import TemplateEngineProtocol
|
|
10
|
-
|
|
11
|
-
__all__ = ["ViteConfig", "ViteTemplateConfig"]
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if TYPE_CHECKING:
|
|
15
|
-
from collections.abc import Callable
|
|
16
|
-
from pathlib import Path
|
|
17
|
-
|
|
18
|
-
from litestar.types import PathType
|
|
19
|
-
|
|
20
|
-
from litestar_vite.template_engine import ViteTemplateEngine
|
|
21
|
-
|
|
22
|
-
T = TypeVar("T", bound=TemplateEngineProtocol)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@dataclass
|
|
26
|
-
class ViteConfig:
|
|
27
|
-
"""Configuration for ViteJS support.
|
|
28
|
-
|
|
29
|
-
To enable Vite integration, pass an instance of this class to the
|
|
30
|
-
:class:`Litestar <litestar.app.Litestar>` constructor using the
|
|
31
|
-
'plugins' key.
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
static_dir: Path
|
|
35
|
-
"""Location of the manifest file.
|
|
36
|
-
|
|
37
|
-
The path relative to the `static_url` location
|
|
38
|
-
"""
|
|
39
|
-
templates_dir: Path
|
|
40
|
-
"""Location of the Jinja2 template file.
|
|
41
|
-
"""
|
|
42
|
-
manifest_name: str = "manifest.json"
|
|
43
|
-
"""Name of the manifest file."""
|
|
44
|
-
hot_reload: bool = False
|
|
45
|
-
"""Enable HMR for Vite development server."""
|
|
46
|
-
is_react: bool = False
|
|
47
|
-
"""Enable React components."""
|
|
48
|
-
static_url: str = "/static/"
|
|
49
|
-
"""Base URL to generate for static asset references.
|
|
50
|
-
|
|
51
|
-
This should match what you have for the STATIC_URL
|
|
52
|
-
"""
|
|
53
|
-
host: str = "localhost"
|
|
54
|
-
"""Default host to use for Vite server."""
|
|
55
|
-
protocol: str = "http"
|
|
56
|
-
"""Protocol to use for communication"""
|
|
57
|
-
port: int = 3000
|
|
58
|
-
"""Default port to use for Vite server."""
|
|
59
|
-
run_command: str = "npm run dev"
|
|
60
|
-
"""Default command to use for running Vite."""
|
|
61
|
-
build_command: str = "npm run build"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
@dataclass
|
|
65
|
-
class ViteTemplateConfig(Generic[T]):
|
|
66
|
-
"""Configuration for Templating.
|
|
67
|
-
|
|
68
|
-
To enable templating, pass an instance of this class to the
|
|
69
|
-
:class:`Litestar <litestar.app.Litestar>` constructor using the
|
|
70
|
-
'template_config' key.
|
|
71
|
-
"""
|
|
72
|
-
|
|
73
|
-
engine: type[ViteTemplateEngine]
|
|
74
|
-
"""A template engine adhering to the :class:`TemplateEngineProtocol
|
|
75
|
-
<litestar.template.base.TemplateEngineProtocol>`."""
|
|
76
|
-
config: ViteConfig
|
|
77
|
-
"""A a config for the vite engine`."""
|
|
78
|
-
directory: PathType | None = field(default=None)
|
|
79
|
-
"""A directory or list of directories from which to serve templates."""
|
|
80
|
-
engine_callback: Callable[[T], None] | None = field(default=None)
|
|
81
|
-
"""A callback function that allows modifying the instantiated templating
|
|
82
|
-
protocol."""
|
|
83
|
-
|
|
84
|
-
def __post_init__(self) -> None:
|
|
85
|
-
"""Ensure that directory is set if engine is a class."""
|
|
86
|
-
if isclass(self.engine) and not self.directory:
|
|
87
|
-
msg = "directory is a required kwarg when passing a template engine class"
|
|
88
|
-
raise ImproperlyConfiguredException(msg)
|
|
89
|
-
|
|
90
|
-
def to_engine(self) -> T:
|
|
91
|
-
"""Instantiate the template engine."""
|
|
92
|
-
template_engine = cast("T", self.engine(self.directory, self.config) if isclass(self.engine) else self.engine)
|
|
93
|
-
if callable(self.engine_callback):
|
|
94
|
-
self.engine_callback(template_engine)
|
|
95
|
-
return template_engine
|
|
96
|
-
|
|
97
|
-
@cached_property
|
|
98
|
-
def engine_instance(self) -> T:
|
|
99
|
-
"""Return the template engine instance."""
|
|
100
|
-
return self.to_engine()
|
litestar_vite/plugin.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import TYPE_CHECKING
|
|
4
|
-
|
|
5
|
-
from litesatr_vite.config import ViteTemplateConfig
|
|
6
|
-
from litesatr_vite.template_engine import ViteTemplateEngine
|
|
7
|
-
from litestar.plugins import CLIPluginProtocol, InitPluginProtocol
|
|
8
|
-
|
|
9
|
-
if TYPE_CHECKING:
|
|
10
|
-
from click import Group
|
|
11
|
-
from litesatr_vite.config import ViteConfig
|
|
12
|
-
from litestar.config.app import AppConfig
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class VitePlugin(InitPluginProtocol, CLIPluginProtocol):
|
|
16
|
-
"""Vite plugin."""
|
|
17
|
-
|
|
18
|
-
__slots__ = ("_config",)
|
|
19
|
-
|
|
20
|
-
def __init__(self, config: ViteConfig) -> None:
|
|
21
|
-
"""Initialize ``Vite``.
|
|
22
|
-
|
|
23
|
-
Args:
|
|
24
|
-
config: configure and start Vite.
|
|
25
|
-
"""
|
|
26
|
-
self._config = config
|
|
27
|
-
|
|
28
|
-
def on_cli_init(self, cli: Group) -> None:
|
|
29
|
-
from litestar_vite.cli import vite_group
|
|
30
|
-
|
|
31
|
-
cli.add_command(vite_group)
|
|
32
|
-
return super().on_cli_init(cli)
|
|
33
|
-
|
|
34
|
-
def on_app_init(self, app_config: AppConfig) -> AppConfig:
|
|
35
|
-
"""Configure application for use with Vite.
|
|
36
|
-
|
|
37
|
-
Args:
|
|
38
|
-
app_config: The :class:`AppConfig <.config.app.AppConfig>` instance.
|
|
39
|
-
"""
|
|
40
|
-
app_config.template_config = ViteTemplateConfig(
|
|
41
|
-
directory=self._config.templates_dir,
|
|
42
|
-
engine=ViteTemplateEngine,
|
|
43
|
-
config=self._config,
|
|
44
|
-
)
|
|
45
|
-
return app_config
|
litestar_vite/template_engine.py
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import TYPE_CHECKING, Any, TypeVar
|
|
4
|
-
|
|
5
|
-
import markupsafe
|
|
6
|
-
from jinja2 import TemplateNotFound as JinjaTemplateNotFound
|
|
7
|
-
from jinja2 import pass_context
|
|
8
|
-
from litestar.contrib.jinja import JinjaTemplateEngine
|
|
9
|
-
from litestar.exceptions import TemplateNotFoundException
|
|
10
|
-
from litestar.template.base import (
|
|
11
|
-
TemplateEngineProtocol,
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
from .loader import ViteAssetLoader
|
|
15
|
-
|
|
16
|
-
if TYPE_CHECKING:
|
|
17
|
-
from collections.abc import Callable
|
|
18
|
-
|
|
19
|
-
from jinja2 import Template as JinjaTemplate
|
|
20
|
-
from litesatr_vite.config import ViteConfig
|
|
21
|
-
from pydantic import DirectoryPath
|
|
22
|
-
|
|
23
|
-
T = TypeVar("T", bound=TemplateEngineProtocol)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class ViteTemplateEngine(JinjaTemplateEngine):
|
|
27
|
-
"""Jinja Template Engine with Vite Integration."""
|
|
28
|
-
|
|
29
|
-
def __init__(self, directory: DirectoryPath | list[DirectoryPath], config: ViteConfig) -> None:
|
|
30
|
-
"""Jinja2 based TemplateEngine.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
directory: Direct path or list of directory paths from which to serve templates.
|
|
34
|
-
config: Vite config
|
|
35
|
-
"""
|
|
36
|
-
super().__init__(directory=directory)
|
|
37
|
-
self.config = config
|
|
38
|
-
self.asset_loader = ViteAssetLoader.initialize_loader(config=self.config)
|
|
39
|
-
self.engine.globals["vite_hmr_client"] = self.hmr_client
|
|
40
|
-
self.engine.globals["vite_asset"] = self.resource
|
|
41
|
-
|
|
42
|
-
def get_template(self, template_name: str) -> JinjaTemplate:
|
|
43
|
-
"""Retrieve a template by matching its name (dotted path) with files in the directory or directories provided.
|
|
44
|
-
|
|
45
|
-
Args:
|
|
46
|
-
template_name: A dotted path
|
|
47
|
-
|
|
48
|
-
Returns:
|
|
49
|
-
JinjaTemplate instance
|
|
50
|
-
|
|
51
|
-
Raises:
|
|
52
|
-
TemplateNotFoundException: if no template is found.
|
|
53
|
-
"""
|
|
54
|
-
try:
|
|
55
|
-
return self.engine.get_template(name=template_name)
|
|
56
|
-
except JinjaTemplateNotFound as exc:
|
|
57
|
-
raise TemplateNotFoundException(template_name=template_name) from exc
|
|
58
|
-
|
|
59
|
-
def register_template_callable(self, key: str, template_callable: Callable[[dict[str, Any]], Any]) -> None:
|
|
60
|
-
"""Register a callable on the template engine.
|
|
61
|
-
|
|
62
|
-
Args:
|
|
63
|
-
key: The callable key, i.e. the value to use inside the template to call the callable.
|
|
64
|
-
template_callable: A callable to register.
|
|
65
|
-
|
|
66
|
-
Returns:
|
|
67
|
-
None
|
|
68
|
-
"""
|
|
69
|
-
self.engine.globals[key] = pass_context(template_callable)
|
|
70
|
-
|
|
71
|
-
def hmr_client(self) -> markupsafe.Markup:
|
|
72
|
-
"""Generate the script tag for the Vite WS client for HMR.
|
|
73
|
-
|
|
74
|
-
Only used when hot module reloading is enabled, in production this method returns an empty string.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Returns:
|
|
78
|
-
str: The script tag or an empty string.
|
|
79
|
-
"""
|
|
80
|
-
tags = [self.asset_loader.generate_react_hmr_tags()]
|
|
81
|
-
tags.append(self.asset_loader.generate_ws_client_tags())
|
|
82
|
-
return markupsafe.Markup("".join(tags))
|
|
83
|
-
|
|
84
|
-
def resource(self, path: str, scripts_attrs: dict[str, str] | None = None) -> markupsafe.Markup:
|
|
85
|
-
"""Generate all assets include tags for the file in argument.
|
|
86
|
-
|
|
87
|
-
Generates all scripts tags for this file and all its dependencies
|
|
88
|
-
(JS and CSS) by reading the manifest file (for production only).
|
|
89
|
-
In development Vite imports all dependencies by itself.
|
|
90
|
-
Place this tag in <head> section of your page
|
|
91
|
-
(this function marks automatically <script> as "async" and "defer").
|
|
92
|
-
|
|
93
|
-
Arguments:
|
|
94
|
-
path: Path to a Vite asset to include.
|
|
95
|
-
scripts_attrs: script attributes
|
|
96
|
-
|
|
97
|
-
Keyword Arguments:
|
|
98
|
-
scripts_attrs {Optional[Dict[str, str]]}: Override attributes added to scripts tags. (default: {None})
|
|
99
|
-
|
|
100
|
-
Returns:
|
|
101
|
-
str: All tags to import this asset in your HTML page.
|
|
102
|
-
"""
|
|
103
|
-
return markupsafe.Markup(self.asset_loader.generate_asset_tags(path, scripts_attrs=scripts_attrs))
|