litestar-vite 0.13.0__py3-none-any.whl → 0.13.1__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.
Potentially problematic release.
This version of litestar-vite might be problematic. Click here for more details.
- litestar_vite/__init__.py +0 -2
- litestar_vite/__metadata__.py +0 -2
- litestar_vite/cli.py +33 -38
- litestar_vite/commands.py +45 -35
- litestar_vite/config.py +6 -7
- litestar_vite/inertia/_utils.py +53 -17
- litestar_vite/inertia/config.py +5 -7
- litestar_vite/inertia/exception_handler.py +22 -8
- litestar_vite/inertia/helpers.py +57 -61
- litestar_vite/inertia/middleware.py +4 -6
- litestar_vite/inertia/plugin.py +22 -9
- litestar_vite/inertia/request.py +58 -20
- litestar_vite/inertia/response.py +42 -40
- litestar_vite/inertia/routes.py +7 -9
- litestar_vite/inertia/types.py +6 -8
- litestar_vite/loader.py +93 -29
- litestar_vite/plugin.py +41 -33
- {litestar_vite-0.13.0.dist-info → litestar_vite-0.13.1.dist-info}/METADATA +3 -3
- litestar_vite-0.13.1.dist-info/RECORD +30 -0
- litestar_vite-0.13.0.dist-info/RECORD +0 -30
- {litestar_vite-0.13.0.dist-info → litestar_vite-0.13.1.dist-info}/WHEEL +0 -0
- {litestar_vite-0.13.0.dist-info → litestar_vite-0.13.1.dist-info}/licenses/LICENSE +0 -0
litestar_vite/inertia/routes.py
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
1
|
from dataclasses import dataclass
|
|
4
2
|
from functools import cached_property
|
|
5
|
-
from typing import TYPE_CHECKING
|
|
3
|
+
from typing import TYPE_CHECKING, Optional
|
|
6
4
|
|
|
7
5
|
from litestar.app import DEFAULT_OPENAPI_CONFIG
|
|
8
6
|
from litestar.cli._utils import (
|
|
9
|
-
remove_default_schema_routes,
|
|
10
|
-
remove_routes_with_patterns,
|
|
7
|
+
remove_default_schema_routes, # pyright: ignore[reportPrivateImportUsage]
|
|
8
|
+
remove_routes_with_patterns, # pyright: ignore[reportPrivateImportUsage]
|
|
11
9
|
)
|
|
12
10
|
from litestar.routes import ASGIRoute, WebSocketRoute
|
|
13
11
|
from litestar.serialization import encode_json
|
|
@@ -29,10 +27,10 @@ EXCLUDED_METHODS = {"HEAD", "OPTIONS", "TRACE"}
|
|
|
29
27
|
|
|
30
28
|
|
|
31
29
|
def generate_js_routes(
|
|
32
|
-
app: Litestar,
|
|
33
|
-
exclude: tuple[str, ...]
|
|
34
|
-
schema: bool = False,
|
|
35
|
-
) -> Routes:
|
|
30
|
+
app: "Litestar",
|
|
31
|
+
exclude: "Optional[tuple[str, ...]]" = None,
|
|
32
|
+
schema: "bool" = False,
|
|
33
|
+
) -> "Routes":
|
|
36
34
|
sorted_routes = sorted(app.routes, key=lambda r: r.path)
|
|
37
35
|
if not schema:
|
|
38
36
|
openapi_config = app.openapi_config or DEFAULT_OPENAPI_CONFIG
|
litestar_vite/inertia/types.py
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
1
|
from dataclasses import dataclass
|
|
4
|
-
from typing import Any, Generic, TypedDict, TypeVar
|
|
2
|
+
from typing import Any, Generic, Optional, TypedDict, TypeVar
|
|
5
3
|
|
|
6
4
|
__all__ = (
|
|
7
5
|
"InertiaHeaderType",
|
|
@@ -32,8 +30,8 @@ class InertiaProps(Generic[T]):
|
|
|
32
30
|
class InertiaHeaderType(TypedDict, total=False):
|
|
33
31
|
"""Type for inertia_headers parameter in get_headers()."""
|
|
34
32
|
|
|
35
|
-
enabled: bool
|
|
36
|
-
version: str
|
|
37
|
-
location: str
|
|
38
|
-
partial_data: str
|
|
39
|
-
partial_component: str
|
|
33
|
+
enabled: "Optional[bool]"
|
|
34
|
+
version: "Optional[str]"
|
|
35
|
+
location: "Optional[str]"
|
|
36
|
+
partial_data: "Optional[str]"
|
|
37
|
+
partial_component: "Optional[str]"
|
litestar_vite/loader.py
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
1
|
import json
|
|
4
2
|
from functools import cached_property
|
|
5
3
|
from pathlib import Path
|
|
6
4
|
from textwrap import dedent
|
|
7
|
-
from typing import TYPE_CHECKING, Any,
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Optional, Union, cast
|
|
8
6
|
from urllib.parse import urljoin
|
|
9
7
|
|
|
10
8
|
import markupsafe
|
|
11
9
|
from litestar.exceptions import ImproperlyConfiguredException
|
|
12
10
|
|
|
13
11
|
if TYPE_CHECKING:
|
|
12
|
+
from collections.abc import Mapping
|
|
13
|
+
|
|
14
14
|
from litestar.connection import Request
|
|
15
15
|
|
|
16
16
|
from litestar_vite.config import ViteConfig
|
|
17
17
|
from litestar_vite.plugin import VitePlugin
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def _get_request_from_context(context: Mapping[str, Any]) -> Request[Any, Any, Any]:
|
|
20
|
+
def _get_request_from_context(context: "Mapping[str, Any]") -> "Request[Any, Any, Any]":
|
|
21
21
|
"""Get the request from the template context.
|
|
22
22
|
|
|
23
23
|
Args:
|
|
@@ -29,7 +29,7 @@ def _get_request_from_context(context: Mapping[str, Any]) -> Request[Any, Any, A
|
|
|
29
29
|
return cast("Request[Any, Any, Any]", context["request"])
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def render_hmr_client(context: Mapping[str, Any], /) -> markupsafe.Markup:
|
|
32
|
+
def render_hmr_client(context: "Mapping[str, Any]", /) -> "markupsafe.Markup":
|
|
33
33
|
"""Render the HMR client.
|
|
34
34
|
|
|
35
35
|
Args:
|
|
@@ -44,8 +44,8 @@ def render_hmr_client(context: Mapping[str, Any], /) -> markupsafe.Markup:
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
def render_asset_tag(
|
|
47
|
-
context: Mapping[str, Any], /, path: str
|
|
48
|
-
) -> markupsafe.Markup:
|
|
47
|
+
context: "Mapping[str, Any]", /, path: "Union[str, list[str]]", scripts_attrs: "Optional[dict[str, str]]" = None
|
|
48
|
+
) -> "markupsafe.Markup":
|
|
49
49
|
"""Render an asset tag.
|
|
50
50
|
|
|
51
51
|
Args:
|
|
@@ -61,42 +61,84 @@ def render_asset_tag(
|
|
|
61
61
|
).asset_loader.render_asset_tag(path, scripts_attrs)
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
class
|
|
64
|
+
class SingletonMeta(type):
|
|
65
|
+
"""Singleton metaclass."""
|
|
66
|
+
|
|
67
|
+
_instances: "dict[type, Any]" = {}
|
|
68
|
+
|
|
69
|
+
def __call__(cls, *args: "Any", **kwargs: "Any") -> "Any":
|
|
70
|
+
if cls not in cls._instances: # pyright: ignore[reportUnnecessaryContains]
|
|
71
|
+
cls._instances[cls] = super().__call__(*args, **kwargs)
|
|
72
|
+
return cls._instances[cls]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class ViteAssetLoader(metaclass=SingletonMeta):
|
|
65
76
|
"""Vite manifest loader.
|
|
66
77
|
|
|
67
78
|
Please see: https://vitejs.dev/guide/backend-integration.html
|
|
68
79
|
"""
|
|
69
80
|
|
|
70
|
-
|
|
81
|
+
_config: "ViteConfig"
|
|
82
|
+
_manifest: "dict[str, Any]"
|
|
83
|
+
_manifest_content: "str"
|
|
84
|
+
_vite_base_path: "Optional[str]"
|
|
85
|
+
|
|
86
|
+
def __init__(self, config: "ViteConfig") -> None:
|
|
87
|
+
"""Initialize the manifest loader.
|
|
71
88
|
|
|
72
|
-
|
|
89
|
+
Args:
|
|
90
|
+
config: The Vite configuration.
|
|
91
|
+
"""
|
|
73
92
|
self._config = config
|
|
74
|
-
self._manifest: dict[str, Any] = {}
|
|
75
|
-
self._manifest_content: str = ""
|
|
76
|
-
self._vite_base_path: str
|
|
93
|
+
self._manifest: "dict[str, Any]" = {}
|
|
94
|
+
self._manifest_content: "str" = ""
|
|
95
|
+
self._vite_base_path: "Optional[str]" = None
|
|
77
96
|
|
|
78
97
|
@classmethod
|
|
79
|
-
def initialize_loader(cls, config: ViteConfig) -> ViteAssetLoader:
|
|
80
|
-
"""
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
98
|
+
def initialize_loader(cls, config: "ViteConfig") -> "ViteAssetLoader":
|
|
99
|
+
"""Initialize the manifest loader.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
config: The Vite configuration.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
The manifest loader.
|
|
106
|
+
"""
|
|
107
|
+
return cls(config=config)
|
|
85
108
|
|
|
86
109
|
@cached_property
|
|
87
110
|
def version_id(self) -> str:
|
|
88
|
-
|
|
111
|
+
"""Get the version ID of the manifest.
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
The version ID of the manifest.
|
|
115
|
+
"""
|
|
116
|
+
if self._manifest_content:
|
|
89
117
|
return str(hash(self.manifest_content))
|
|
90
118
|
return "1.0"
|
|
91
119
|
|
|
92
|
-
def render_hmr_client(self) -> markupsafe.Markup:
|
|
93
|
-
"""
|
|
120
|
+
def render_hmr_client(self) -> "markupsafe.Markup":
|
|
121
|
+
"""Render the HMR client.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
The HMR client.
|
|
125
|
+
"""
|
|
94
126
|
return markupsafe.Markup(
|
|
95
127
|
f"{self.generate_react_hmr_tags()}{self.generate_ws_client_tags()}",
|
|
96
128
|
)
|
|
97
129
|
|
|
98
|
-
def render_asset_tag(
|
|
99
|
-
|
|
130
|
+
def render_asset_tag(
|
|
131
|
+
self, path: "Union[str, list[str]]", scripts_attrs: "Optional[dict[str, str]]" = None
|
|
132
|
+
) -> "markupsafe.Markup":
|
|
133
|
+
"""Render an asset tag.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
path: The path to the asset.
|
|
137
|
+
scripts_attrs: The attributes for the script tag.
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
The asset tag.
|
|
141
|
+
"""
|
|
100
142
|
path = [str(p) for p in path] if isinstance(path, list) else [str(path)]
|
|
101
143
|
return markupsafe.Markup(
|
|
102
144
|
"".join([self.generate_asset_tags(p, scripts_attrs=scripts_attrs) for p in path]),
|
|
@@ -131,6 +173,9 @@ class ViteAssetLoader:
|
|
|
131
173
|
}
|
|
132
174
|
|
|
133
175
|
The manifest is parsed and stored in memory for asset resolution during template rendering.
|
|
176
|
+
|
|
177
|
+
Raises:
|
|
178
|
+
RuntimeError: If the manifest file is not found or cannot be read.
|
|
134
179
|
"""
|
|
135
180
|
if self._config.hot_reload and self._config.dev_mode:
|
|
136
181
|
hot_file_path = Path(
|
|
@@ -191,9 +236,18 @@ class ViteAssetLoader:
|
|
|
191
236
|
""")
|
|
192
237
|
return ""
|
|
193
238
|
|
|
194
|
-
def generate_asset_tags(
|
|
239
|
+
def generate_asset_tags(
|
|
240
|
+
self, path: "Union[str, list[str]]", scripts_attrs: "Optional[dict[str, str]]" = None
|
|
241
|
+
) -> str:
|
|
195
242
|
"""Generate all assets include tags for the file in argument.
|
|
196
243
|
|
|
244
|
+
Args:
|
|
245
|
+
path: The path to the asset.
|
|
246
|
+
scripts_attrs: The attributes for the script tag.
|
|
247
|
+
|
|
248
|
+
Raises:
|
|
249
|
+
ImproperlyConfiguredException: If the manifest file is not found or cannot be read.
|
|
250
|
+
|
|
197
251
|
Returns:
|
|
198
252
|
str: All tags to import this asset in your HTML page.
|
|
199
253
|
"""
|
|
@@ -250,7 +304,7 @@ class ViteAssetLoader:
|
|
|
250
304
|
)
|
|
251
305
|
return "".join(tags)
|
|
252
306
|
|
|
253
|
-
def _vite_server_url(self, path: str
|
|
307
|
+
def _vite_server_url(self, path: "Optional[str]" = None) -> str:
|
|
254
308
|
"""Generate an URL to and asset served by the Vite development server.
|
|
255
309
|
|
|
256
310
|
Keyword Arguments:
|
|
@@ -265,14 +319,24 @@ class ViteAssetLoader:
|
|
|
265
319
|
urljoin(self._config.asset_url, path if path is not None else ""),
|
|
266
320
|
)
|
|
267
321
|
|
|
268
|
-
|
|
269
|
-
|
|
322
|
+
@staticmethod
|
|
323
|
+
def _script_tag(src: str, attrs: "Optional[dict[str, str]]" = None) -> str:
|
|
324
|
+
"""Generate an HTML script tag.
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
src: The source of the script.
|
|
328
|
+
attrs: The attributes for the script tag.
|
|
329
|
+
|
|
330
|
+
Returns:
|
|
331
|
+
str: The script tag.
|
|
332
|
+
"""
|
|
270
333
|
if attrs is None:
|
|
271
334
|
attrs = {}
|
|
272
335
|
attrs_str = " ".join([f'{key}="{value}"' for key, value in attrs.items()])
|
|
273
336
|
return f'<script {attrs_str} src="{src}"></script>'
|
|
274
337
|
|
|
275
|
-
|
|
338
|
+
@staticmethod
|
|
339
|
+
def _style_tag(href: str) -> str:
|
|
276
340
|
"""Generate and HTML <link> stylesheet tag for CSS.
|
|
277
341
|
|
|
278
342
|
Args:
|
litestar_vite/plugin.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
1
|
import os
|
|
4
2
|
import platform
|
|
5
3
|
import signal
|
|
@@ -8,14 +6,16 @@ import threading
|
|
|
8
6
|
from contextlib import contextmanager
|
|
9
7
|
from dataclasses import dataclass
|
|
10
8
|
from pathlib import Path
|
|
11
|
-
from typing import TYPE_CHECKING, Any,
|
|
9
|
+
from typing import TYPE_CHECKING, Any, Optional, Union
|
|
12
10
|
|
|
13
|
-
from litestar.cli._utils import console
|
|
11
|
+
from litestar.cli._utils import console # pyright: ignore[reportPrivateImportUsage]
|
|
14
12
|
from litestar.contrib.jinja import JinjaTemplateEngine
|
|
15
13
|
from litestar.plugins import CLIPlugin, InitPluginProtocol
|
|
16
14
|
from litestar.static_files import create_static_files_router # pyright: ignore[reportUnknownVariableType]
|
|
17
15
|
|
|
18
16
|
if TYPE_CHECKING:
|
|
17
|
+
from collections.abc import Iterator, Sequence
|
|
18
|
+
|
|
19
19
|
from click import Group
|
|
20
20
|
from litestar import Litestar
|
|
21
21
|
from litestar.config.app import AppConfig
|
|
@@ -34,40 +34,43 @@ if TYPE_CHECKING:
|
|
|
34
34
|
from litestar_vite.loader import ViteAssetLoader
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def set_environment(config: ViteConfig) -> None:
|
|
37
|
+
def set_environment(config: "ViteConfig") -> None:
|
|
38
38
|
"""Configure environment for easier integration"""
|
|
39
|
+
from litestar import __version__ as litestar_version
|
|
40
|
+
|
|
39
41
|
os.environ.setdefault("ASSET_URL", config.asset_url)
|
|
40
42
|
os.environ.setdefault("VITE_ALLOW_REMOTE", str(True))
|
|
41
43
|
os.environ.setdefault("VITE_PORT", str(config.port))
|
|
42
44
|
os.environ.setdefault("VITE_HOST", config.host)
|
|
43
45
|
os.environ.setdefault("VITE_PROTOCOL", config.protocol)
|
|
44
|
-
os.environ.setdefault("
|
|
46
|
+
os.environ.setdefault("LITESTAR_VERSION", litestar_version.formatted())
|
|
47
|
+
os.environ.setdefault("APP_URL", f"http://localhost:{os.environ.get('LITESTAR_PORT', '8000')}")
|
|
45
48
|
if config.dev_mode:
|
|
46
49
|
os.environ.setdefault("VITE_DEV_MODE", str(config.dev_mode))
|
|
47
50
|
|
|
48
51
|
|
|
49
52
|
@dataclass
|
|
50
53
|
class StaticFilesConfig:
|
|
51
|
-
after_request: AfterRequestHookHandler
|
|
52
|
-
after_response: AfterResponseHookHandler
|
|
53
|
-
before_request: BeforeRequestHookHandler
|
|
54
|
-
cache_control: CacheControlHeader
|
|
55
|
-
exception_handlers: ExceptionHandlersMap
|
|
56
|
-
guards: list[Guard]
|
|
57
|
-
middleware: Sequence[Middleware]
|
|
58
|
-
opt: dict[str, Any]
|
|
59
|
-
security: Sequence[SecurityRequirement]
|
|
60
|
-
tags: Sequence[str]
|
|
54
|
+
after_request: "Optional[AfterRequestHookHandler]" = None
|
|
55
|
+
after_response: "Optional[AfterResponseHookHandler]" = None
|
|
56
|
+
before_request: "Optional[BeforeRequestHookHandler]" = None
|
|
57
|
+
cache_control: "Optional[CacheControlHeader]" = None
|
|
58
|
+
exception_handlers: "Optional[ExceptionHandlersMap]" = None
|
|
59
|
+
guards: "Optional[list[Guard]]" = None
|
|
60
|
+
middleware: "Optional[Sequence[Middleware]]" = None
|
|
61
|
+
opt: "Optional[dict[str, Any]]" = None
|
|
62
|
+
security: "Optional[Sequence[SecurityRequirement]]" = None
|
|
63
|
+
tags: "Optional[Sequence[str]]" = None
|
|
61
64
|
|
|
62
65
|
|
|
63
66
|
class ViteProcess:
|
|
64
67
|
"""Manages the Vite process."""
|
|
65
68
|
|
|
66
69
|
def __init__(self) -> None:
|
|
67
|
-
self.process: subprocess.Popen
|
|
70
|
+
self.process: "Optional[subprocess.Popen]" = None # pyright: ignore[reportUnknownMemberType,reportMissingTypeArgument]
|
|
68
71
|
self._lock = threading.Lock()
|
|
69
72
|
|
|
70
|
-
def start(self, command: list[str], cwd: Path
|
|
73
|
+
def start(self, command: "list[str]", cwd: "Union[Path, str, None]") -> None:
|
|
71
74
|
"""Start the Vite process."""
|
|
72
75
|
|
|
73
76
|
try:
|
|
@@ -114,9 +117,9 @@ class VitePlugin(InitPluginProtocol, CLIPlugin):
|
|
|
114
117
|
|
|
115
118
|
def __init__(
|
|
116
119
|
self,
|
|
117
|
-
config: ViteConfig
|
|
118
|
-
asset_loader: ViteAssetLoader
|
|
119
|
-
static_files_config: StaticFilesConfig
|
|
120
|
+
config: "Optional[ViteConfig]" = None,
|
|
121
|
+
asset_loader: "Optional[ViteAssetLoader]" = None,
|
|
122
|
+
static_files_config: "Optional[StaticFilesConfig]" = None,
|
|
120
123
|
) -> None:
|
|
121
124
|
"""Initialize ``Vite``.
|
|
122
125
|
|
|
@@ -132,30 +135,33 @@ class VitePlugin(InitPluginProtocol, CLIPlugin):
|
|
|
132
135
|
self._config = config
|
|
133
136
|
self._asset_loader = asset_loader
|
|
134
137
|
self._vite_process = ViteProcess()
|
|
135
|
-
self._static_files_config: dict[str, Any] = static_files_config.__dict__ if static_files_config else {}
|
|
138
|
+
self._static_files_config: "dict[str, Any]" = static_files_config.__dict__ if static_files_config else {}
|
|
136
139
|
|
|
137
140
|
@property
|
|
138
|
-
def config(self) -> ViteConfig:
|
|
141
|
+
def config(self) -> "ViteConfig":
|
|
139
142
|
return self._config
|
|
140
143
|
|
|
141
144
|
@property
|
|
142
|
-
def asset_loader(self) -> ViteAssetLoader:
|
|
145
|
+
def asset_loader(self) -> "ViteAssetLoader":
|
|
143
146
|
from litestar_vite.loader import ViteAssetLoader
|
|
144
147
|
|
|
145
148
|
if self._asset_loader is None:
|
|
146
149
|
self._asset_loader = ViteAssetLoader.initialize_loader(config=self._config)
|
|
147
150
|
return self._asset_loader
|
|
148
151
|
|
|
149
|
-
def on_cli_init(self, cli: Group) -> None:
|
|
152
|
+
def on_cli_init(self, cli: "Group") -> None:
|
|
150
153
|
from litestar_vite.cli import vite_group
|
|
151
154
|
|
|
152
155
|
cli.add_command(vite_group)
|
|
153
156
|
|
|
154
|
-
def on_app_init(self, app_config: AppConfig) -> AppConfig:
|
|
157
|
+
def on_app_init(self, app_config: "AppConfig") -> "AppConfig":
|
|
155
158
|
"""Configure application for use with Vite.
|
|
156
159
|
|
|
157
160
|
Args:
|
|
158
161
|
app_config: The :class:`AppConfig <litestar.config.app.AppConfig>` instance.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
The :class:`AppConfig <litestar.config.app.AppConfig>` instance.
|
|
159
165
|
"""
|
|
160
166
|
from litestar_vite.loader import render_asset_tag, render_hmr_client
|
|
161
167
|
|
|
@@ -185,8 +191,15 @@ class VitePlugin(InitPluginProtocol, CLIPlugin):
|
|
|
185
191
|
return app_config
|
|
186
192
|
|
|
187
193
|
@contextmanager
|
|
188
|
-
def server_lifespan(self, app: Litestar) -> Iterator[None]:
|
|
189
|
-
"""Manage Vite server process lifecycle.
|
|
194
|
+
def server_lifespan(self, app: "Litestar") -> "Iterator[None]":
|
|
195
|
+
"""Manage Vite server process lifecycle.
|
|
196
|
+
|
|
197
|
+
Args:
|
|
198
|
+
app: The :class:`Litestar <litestar.app.Litestar>` instance.
|
|
199
|
+
|
|
200
|
+
Yields:
|
|
201
|
+
An iterator of None.
|
|
202
|
+
"""
|
|
190
203
|
|
|
191
204
|
if self._config.use_server_lifespan and self._config.dev_mode:
|
|
192
205
|
command_to_run = self._config.run_command if self._config.hot_reload else self._config.build_watch_command
|
|
@@ -206,9 +219,4 @@ class VitePlugin(InitPluginProtocol, CLIPlugin):
|
|
|
206
219
|
self._vite_process.stop()
|
|
207
220
|
console.print("[yellow]Vite process stopped.[/]")
|
|
208
221
|
else:
|
|
209
|
-
manifest_path = Path(f"{self._config.bundle_dir}/{self._config.manifest_name}")
|
|
210
|
-
if manifest_path.exists():
|
|
211
|
-
console.rule(f"[yellow]Serving assets using manifest at `{manifest_path!s}`.[/]", align="left")
|
|
212
|
-
else:
|
|
213
|
-
console.rule(f"[yellow]Serving assets without manifest at `{manifest_path!s}`.[/]", align="left")
|
|
214
222
|
yield
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: litestar-vite
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.1
|
|
4
4
|
Summary: Vite plugin for Litestar
|
|
5
5
|
Project-URL: Changelog, https://cofin.github.io/litestar-vite/latest/changelog
|
|
6
6
|
Project-URL: Discord, https://discord.gg/X3FJqy8d2j
|
|
@@ -19,16 +19,16 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
19
19
|
Classifier: Natural Language :: English
|
|
20
20
|
Classifier: Operating System :: OS Independent
|
|
21
21
|
Classifier: Programming Language :: Python
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.9
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.10
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.11
|
|
26
25
|
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
27
|
Classifier: Topic :: Database
|
|
28
28
|
Classifier: Topic :: Database :: Database Engines/Servers
|
|
29
29
|
Classifier: Topic :: Software Development
|
|
30
30
|
Classifier: Typing :: Typed
|
|
31
|
-
Requires-Python: >=3.
|
|
31
|
+
Requires-Python: >=3.9
|
|
32
32
|
Requires-Dist: litestar[jinja]>=2.7.0
|
|
33
33
|
Provides-Extra: nodeenv
|
|
34
34
|
Requires-Dist: nodeenv; extra == 'nodeenv'
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
litestar_vite/__init__.py,sha256=QykOZjCNHyDZJNIF84fa-6ze-lajDAGcoi18LxeV-0E,241
|
|
2
|
+
litestar_vite/__metadata__.py,sha256=dMGIPS6M11LcmiEfnMJJrbSPH8Lf00pU8crIIUsIBPw,478
|
|
3
|
+
litestar_vite/cli.py,sha256=_BlglaeRbRf2zja0uCg51FpCier7hPVrte5XHJYDDR4,11208
|
|
4
|
+
litestar_vite/commands.py,sha256=O4B6-C7r45NJfEl6xuHL4rSCz7JjITMN3UnsB_94dgs,5385
|
|
5
|
+
litestar_vite/config.py,sha256=K3C3uhfcllINGAkOUS4tTah-mhhx74GYwNF4ME92eOA,4592
|
|
6
|
+
litestar_vite/loader.py,sha256=gHhLUb4GgJF8zxEl-5xirNX_cU1ZyMz4ZT9f8WCg8XY,11746
|
|
7
|
+
litestar_vite/plugin.py,sha256=_4ZWdfUBzF93hT5qG9fiPW54LaSFJvYsRmavUcAgQQI,9277
|
|
8
|
+
litestar_vite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
litestar_vite/inertia/__init__.py,sha256=KGvxCZhnOw06Pqx5_qjUxj0WWsCR3BR0cVnuNMT7sKQ,1136
|
|
10
|
+
litestar_vite/inertia/_utils.py,sha256=HZOedWduCu3fCMniuFvstEcXzP2FA1IBwPZ3E2XNBEo,2529
|
|
11
|
+
litestar_vite/inertia/config.py,sha256=M8YStJKvUGSWc4LOzkbIuj8_q70vDNHsUyy3dtBHvNY,1220
|
|
12
|
+
litestar_vite/inertia/exception_handler.py,sha256=FfaPp7eiU_yo6sNU6WVRpKTkn6Npti7lFp1Rg-94Tqs,5576
|
|
13
|
+
litestar_vite/inertia/helpers.py,sha256=rk8P7Gh705JPaKLh9LONr-hDHrMBOEdUn-89NMEu_Bg,10876
|
|
14
|
+
litestar_vite/inertia/middleware.py,sha256=gyKZIOtsQmEq0nPjr2CJ-_qddZ1JsepROLO-CDSNEZM,1621
|
|
15
|
+
litestar_vite/inertia/plugin.py,sha256=qRxJr8clCj52_B2y0y99lTvAhAXUMEqLBryDrpXZe44,4064
|
|
16
|
+
litestar_vite/inertia/request.py,sha256=VF74lzboSV_FdlaYT0LGac6RWDX00Cp_vR--OsKg9D4,4590
|
|
17
|
+
litestar_vite/inertia/response.py,sha256=W6SrNcqhVnrEz7ZAaKA12m8qDgoRy2IKHBYZ2AKD9y8,14060
|
|
18
|
+
litestar_vite/inertia/routes.py,sha256=JKeZtbRMSoI7dokrxgwb_9U4YZPsbzh67NKQgoGoj9M,1857
|
|
19
|
+
litestar_vite/inertia/types.py,sha256=qKkFBcc637nnQpbsOUI_aTf19vnY4Qo5c0jsMYsOqQk,701
|
|
20
|
+
litestar_vite/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
litestar_vite/templates/index.html.j2,sha256=Xue1cTl6piEOZkW3UG68SnW80NeL9PxaOp-Xr23kpr4,322
|
|
22
|
+
litestar_vite/templates/main.ts.j2,sha256=Nzr5m_hXMAjeDL_4yQNP3DMCf7Blh3dwg5m-67GJVbY,22
|
|
23
|
+
litestar_vite/templates/package.json.j2,sha256=0JWgdTuaSZ25EmCltF_zbqDdpxfvCLeYuzBjXrziXNw,299
|
|
24
|
+
litestar_vite/templates/styles.css.j2,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
+
litestar_vite/templates/tsconfig.json.j2,sha256=q1REIuVyXUHCy4Zi2kgTkmrhdT98vyY89k-WTrImOj8,843
|
|
26
|
+
litestar_vite/templates/vite.config.ts.j2,sha256=bF5kOPFafYMkhhV0VkIwetN-_zoVMGVM1jEMX_wKoNc,1037
|
|
27
|
+
litestar_vite-0.13.1.dist-info/METADATA,sha256=X9oK-Oj6UfzsBoposYyD0Q6CatC5FpXGQMZkoDeZiqY,6245
|
|
28
|
+
litestar_vite-0.13.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
+
litestar_vite-0.13.1.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
|
|
30
|
+
litestar_vite-0.13.1.dist-info/RECORD,,
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
litestar_vite/__init__.py,sha256=OioNGhH88mdivQlFz9JlbJV8R6wyjSYE3c8C-RIM4Ls,277
|
|
2
|
-
litestar_vite/__metadata__.py,sha256=_Wo-vNQuj5co9J4FwJAB2rRafbFo8ztTHrXmEPrYrV8,514
|
|
3
|
-
litestar_vite/cli.py,sha256=CBSRohDLU9cDeKMAfSbFiw1x8OE_b15ZlUaxji9Rdw8,10749
|
|
4
|
-
litestar_vite/commands.py,sha256=NFRTA_VoeFuZVk6bOINJTdP9DGGSAIZRVsM-SlDykNk,5228
|
|
5
|
-
litestar_vite/config.py,sha256=cZWIwTwNnBYScCty8OxxPaOL8cELx57dm7JQeV8og3Y,4565
|
|
6
|
-
litestar_vite/loader.py,sha256=nrXL2txXoBZEsdLZnysgBYZSreMXQ7ckLuNcu7MqnSM,10277
|
|
7
|
-
litestar_vite/plugin.py,sha256=nglizc45_CBG1gqZRDxyGo8cc_KZ1yOJfAS0XiSadpg,9119
|
|
8
|
-
litestar_vite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
litestar_vite/inertia/__init__.py,sha256=KGvxCZhnOw06Pqx5_qjUxj0WWsCR3BR0cVnuNMT7sKQ,1136
|
|
10
|
-
litestar_vite/inertia/_utils.py,sha256=ijO9Lgka7ZPIAHkby9szbTGoSg0nDShC2bqWT9cDxi0,1956
|
|
11
|
-
litestar_vite/inertia/config.py,sha256=0Je9SLg0acv0eRvudk3aJLj5k1DjPxULoVOwAfpjnUc,1232
|
|
12
|
-
litestar_vite/inertia/exception_handler.py,sha256=BU7vOK7C2iW52_J5xGJZMjYX3EqIg1OpAF3PgbaLSZ4,5349
|
|
13
|
-
litestar_vite/inertia/helpers.py,sha256=9XVQUAqmiXOTUGVLgxPWPgftkRCx99jr6LXPiD35YJE,10571
|
|
14
|
-
litestar_vite/inertia/middleware.py,sha256=23HfQ8D2wNGXUXt_isuGfZ8AFKrr1d_498qGFLynocs,1650
|
|
15
|
-
litestar_vite/inertia/plugin.py,sha256=iVF1c8E7M6IdZK_S1nZW8ZTi7vfIllMAnIUX0pVdrFQ,3686
|
|
16
|
-
litestar_vite/inertia/request.py,sha256=Ogt_ikauWrsgKafaip7IL1YhbybwjdBAQ0PQS7cImoQ,3848
|
|
17
|
-
litestar_vite/inertia/response.py,sha256=YjfabkYkGxDwbuo-WLgbUAHcCi0jgZYM_qdnUbI6Pas,13767
|
|
18
|
-
litestar_vite/inertia/routes.py,sha256=QksJm2RUfL-WbuhOieYnPXXWO5GYnPtmsYEm6Ef8Yeo,1782
|
|
19
|
-
litestar_vite/inertia/types.py,sha256=tLp0pm1N__hcWC875khf6wH1nuFlKS9-VjDqgsRkXnw,702
|
|
20
|
-
litestar_vite/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
-
litestar_vite/templates/index.html.j2,sha256=Xue1cTl6piEOZkW3UG68SnW80NeL9PxaOp-Xr23kpr4,322
|
|
22
|
-
litestar_vite/templates/main.ts.j2,sha256=Nzr5m_hXMAjeDL_4yQNP3DMCf7Blh3dwg5m-67GJVbY,22
|
|
23
|
-
litestar_vite/templates/package.json.j2,sha256=0JWgdTuaSZ25EmCltF_zbqDdpxfvCLeYuzBjXrziXNw,299
|
|
24
|
-
litestar_vite/templates/styles.css.j2,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
-
litestar_vite/templates/tsconfig.json.j2,sha256=q1REIuVyXUHCy4Zi2kgTkmrhdT98vyY89k-WTrImOj8,843
|
|
26
|
-
litestar_vite/templates/vite.config.ts.j2,sha256=bF5kOPFafYMkhhV0VkIwetN-_zoVMGVM1jEMX_wKoNc,1037
|
|
27
|
-
litestar_vite-0.13.0.dist-info/METADATA,sha256=qxVk_WT5C6YZaPsDHfPaoauTTXJQh9dL_6BUCVrUeCY,6244
|
|
28
|
-
litestar_vite-0.13.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
-
litestar_vite-0.13.0.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
|
|
30
|
-
litestar_vite-0.13.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|