litestar-vite 0.1.7__py3-none-any.whl → 0.1.9__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/cli.py +7 -17
- litestar_vite/commands.py +19 -10
- litestar_vite/config.py +24 -14
- litestar_vite/loader.py +8 -8
- litestar_vite/plugin.py +2 -2
- litestar_vite/templates/init/index.html.j2 +1 -1
- litestar_vite/templates/init/package.json.j2 +1 -0
- litestar_vite/templates/init/vite.config.ts.j2 +11 -2
- {litestar_vite-0.1.7.dist-info → litestar_vite-0.1.9.dist-info}/METADATA +17 -9
- {litestar_vite-0.1.7.dist-info → litestar_vite-0.1.9.dist-info}/RECORD +12 -12
- {litestar_vite-0.1.7.dist-info → litestar_vite-0.1.9.dist-info}/WHEEL +1 -1
- {litestar_vite-0.1.7.dist-info → litestar_vite-0.1.9.dist-info}/licenses/LICENSE +0 -0
litestar_vite/cli.py
CHANGED
|
@@ -38,13 +38,6 @@ def vite_group() -> None:
|
|
|
38
38
|
default=None,
|
|
39
39
|
required=False,
|
|
40
40
|
)
|
|
41
|
-
@option(
|
|
42
|
-
"--asset-path",
|
|
43
|
-
type=ClickPath(dir_okay=True, file_okay=False, path_type=Path),
|
|
44
|
-
help="The path to your Javascript/Typescript source and associated assets. If this were a standalone Vue or React app, this would point to your `src/` folder.",
|
|
45
|
-
default=None,
|
|
46
|
-
required=False,
|
|
47
|
-
)
|
|
48
41
|
@option("--asset-url", type=str, help="Base url to serve assets from.", default=None, required=False)
|
|
49
42
|
@option(
|
|
50
43
|
"--vite-port",
|
|
@@ -78,7 +71,6 @@ def vite_init(
|
|
|
78
71
|
vite_port: int | None,
|
|
79
72
|
enable_ssr: bool | None,
|
|
80
73
|
asset_url: str | None,
|
|
81
|
-
asset_path: Path | None,
|
|
82
74
|
bundle_path: Path | None,
|
|
83
75
|
resource_path: Path | None,
|
|
84
76
|
overwrite: bool,
|
|
@@ -103,15 +95,14 @@ def vite_init(
|
|
|
103
95
|
config = plugin._config # noqa: SLF001
|
|
104
96
|
|
|
105
97
|
console.rule("[yellow]Initializing Vite[/]", align="left")
|
|
106
|
-
resource_path = resource_path or config.resource_dir
|
|
107
|
-
|
|
108
|
-
bundle_path = bundle_path or config.bundle_dir
|
|
98
|
+
resource_path = Path(resource_path or config.resource_dir)
|
|
99
|
+
bundle_path = Path(bundle_path or config.bundle_dir)
|
|
109
100
|
enable_ssr = enable_ssr or config.ssr_enabled
|
|
110
101
|
asset_url = asset_url or config.asset_url
|
|
111
102
|
vite_port = vite_port or config.port
|
|
112
103
|
hot_file = Path(bundle_path / config.hot_file)
|
|
113
104
|
root_path = resource_path.parent
|
|
114
|
-
if any(output_path.exists() for output_path in (
|
|
105
|
+
if any(output_path.exists() for output_path in (bundle_path, resource_path)) and not any(
|
|
115
106
|
[overwrite, no_prompt],
|
|
116
107
|
):
|
|
117
108
|
confirm_overwrite = Confirm.ask(
|
|
@@ -120,7 +111,7 @@ def vite_init(
|
|
|
120
111
|
if not confirm_overwrite:
|
|
121
112
|
console.print("Skipping Vite initialization")
|
|
122
113
|
sys.exit(2)
|
|
123
|
-
for output_path in (
|
|
114
|
+
for output_path in (bundle_path, resource_path):
|
|
124
115
|
output_path.mkdir(parents=True, exist_ok=True)
|
|
125
116
|
enable_ssr = (
|
|
126
117
|
True
|
|
@@ -138,7 +129,6 @@ def vite_init(
|
|
|
138
129
|
vite_port=vite_port,
|
|
139
130
|
asset_url=asset_url,
|
|
140
131
|
resource_path=resource_path,
|
|
141
|
-
asset_path=asset_path,
|
|
142
132
|
bundle_path=bundle_path,
|
|
143
133
|
hot_file=hot_file,
|
|
144
134
|
litestar_port=env.port or 8000,
|
|
@@ -163,7 +153,7 @@ def vite_install(app: Litestar, verbose: bool) -> None:
|
|
|
163
153
|
app.debug = True
|
|
164
154
|
console.rule("[yellow]Starting Vite package installation process[/]", align="left")
|
|
165
155
|
plugin = app.plugins.get(VitePlugin)
|
|
166
|
-
run_vite(" ".join(plugin._config.install_command)) # noqa: SLF001
|
|
156
|
+
run_vite(" ".join(plugin._config.install_command), app) # noqa: SLF001
|
|
167
157
|
|
|
168
158
|
|
|
169
159
|
@vite_group.command( # type: ignore # noqa: PGH003
|
|
@@ -184,7 +174,7 @@ def vite_build(app: Litestar, verbose: bool) -> None:
|
|
|
184
174
|
app.debug = True
|
|
185
175
|
console.rule("[yellow]Starting Vite build process[/]", align="left")
|
|
186
176
|
plugin = app.plugins.get(VitePlugin)
|
|
187
|
-
run_vite(" ".join(plugin._config.build_command)) # noqa: SLF001
|
|
177
|
+
run_vite(" ".join(plugin._config.build_command), app) # noqa: SLF001
|
|
188
178
|
|
|
189
179
|
|
|
190
180
|
@vite_group.command( # type: ignore # noqa: PGH003
|
|
@@ -212,4 +202,4 @@ def vite_serve(app: Litestar, verbose: bool) -> None:
|
|
|
212
202
|
command_to_run = (
|
|
213
203
|
plugin._config.run_command if plugin._config.hot_reload else plugin._config.build_watch_command # noqa: SLF001
|
|
214
204
|
)
|
|
215
|
-
run_vite(" ".join(command_to_run))
|
|
205
|
+
run_vite(" ".join(command_to_run), app)
|
litestar_vite/commands.py
CHANGED
|
@@ -4,10 +4,12 @@ import contextlib
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import TYPE_CHECKING, Any, MutableMapping
|
|
6
6
|
|
|
7
|
+
from anyio import create_task_group
|
|
7
8
|
from jinja2 import select_autoescape
|
|
8
9
|
from litestar.serialization import encode_json
|
|
9
10
|
|
|
10
11
|
if TYPE_CHECKING:
|
|
12
|
+
from anyio.abc import Process
|
|
11
13
|
from jinja2 import Environment, Template
|
|
12
14
|
from litestar import Litestar
|
|
13
15
|
|
|
@@ -40,7 +42,6 @@ def init_vite(
|
|
|
40
42
|
app: Litestar,
|
|
41
43
|
root_path: Path,
|
|
42
44
|
resource_path: Path,
|
|
43
|
-
asset_path: Path,
|
|
44
45
|
asset_url: str,
|
|
45
46
|
bundle_path: Path,
|
|
46
47
|
enable_ssr: bool,
|
|
@@ -75,10 +76,9 @@ def init_vite(
|
|
|
75
76
|
entry_point=entry_point,
|
|
76
77
|
enable_ssr=enable_ssr,
|
|
77
78
|
asset_url=asset_url,
|
|
78
|
-
root_path=str(root_path
|
|
79
|
+
root_path=str(root_path),
|
|
79
80
|
resource_path=str(resource_path.relative_to(root_path)),
|
|
80
81
|
bundle_path=str(bundle_path.relative_to(root_path)),
|
|
81
|
-
asset_path=str(asset_path.relative_to(root_path)),
|
|
82
82
|
hot_file=str(hot_file.relative_to(root_path)),
|
|
83
83
|
vite_port=str(vite_port),
|
|
84
84
|
litestar_port=litestar_port,
|
|
@@ -97,22 +97,31 @@ def get_template(
|
|
|
97
97
|
return environment.get_template(name=name, parent=parent, globals=globals)
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
def run_vite(command_to_run: str) -> None:
|
|
100
|
+
def run_vite(command_to_run: str, app: Litestar) -> None:
|
|
101
101
|
"""Run Vite in a subprocess."""
|
|
102
102
|
|
|
103
103
|
import anyio
|
|
104
104
|
|
|
105
105
|
with contextlib.suppress(KeyboardInterrupt):
|
|
106
|
-
anyio.run(_run_vite, command_to_run)
|
|
106
|
+
anyio.run(_run_vite, command_to_run, app)
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
async def _run_vite(command_to_run: str) -> None:
|
|
109
|
+
async def _run_vite(command_to_run: str, app: Litestar) -> None:
|
|
110
110
|
"""Run Vite in a subprocess."""
|
|
111
111
|
|
|
112
112
|
from anyio import open_process
|
|
113
113
|
from anyio.streams.text import TextReceiveStream
|
|
114
|
-
from litestar.cli._utils import console
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
logger = app.get_logger("vite")
|
|
116
|
+
|
|
117
|
+
async def read_stdout(vite_process: Process) -> None:
|
|
118
|
+
async for stdout in TextReceiveStream(vite_process.stdout): # type: ignore[arg-type]
|
|
119
|
+
logger.info(stdout.replace("\n", ""))
|
|
120
|
+
|
|
121
|
+
async def read_stderr(vite_process: Process) -> None:
|
|
122
|
+
async for stdout in TextReceiveStream(vite_process.stderr): # type: ignore[arg-type]
|
|
123
|
+
logger.warning(stdout.replace("\n", ""))
|
|
124
|
+
|
|
125
|
+
async with await open_process(command_to_run) as vite_process, create_task_group() as tg:
|
|
126
|
+
tg.start_soon(read_stdout, vite_process)
|
|
127
|
+
tg.start_soon(read_stderr, vite_process)
|
litestar_vite/config.py
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import os
|
|
3
4
|
from dataclasses import dataclass, field
|
|
4
5
|
from functools import cached_property
|
|
5
6
|
from inspect import isclass
|
|
7
|
+
from pathlib import Path
|
|
6
8
|
from typing import TYPE_CHECKING, Generic, TypeVar, cast
|
|
7
9
|
|
|
8
10
|
from litestar.exceptions import ImproperlyConfiguredException
|
|
@@ -13,7 +15,6 @@ __all__ = ["ViteConfig", "ViteTemplateConfig"]
|
|
|
13
15
|
|
|
14
16
|
if TYPE_CHECKING:
|
|
15
17
|
from collections.abc import Callable
|
|
16
|
-
from pathlib import Path
|
|
17
18
|
|
|
18
19
|
from litestar.types import PathType
|
|
19
20
|
|
|
@@ -31,24 +32,17 @@ class ViteConfig:
|
|
|
31
32
|
'plugins' key.
|
|
32
33
|
"""
|
|
33
34
|
|
|
34
|
-
bundle_dir: Path
|
|
35
|
+
bundle_dir: Path | str = field(default="public")
|
|
35
36
|
"""Location of the compiled assets from Vite.
|
|
36
37
|
|
|
37
38
|
The manifest file will also be found here.
|
|
38
39
|
"""
|
|
39
|
-
resource_dir: Path
|
|
40
|
+
resource_dir: Path | str = field(default="resources")
|
|
40
41
|
"""The directory where all typescript/javascript source are written.
|
|
41
42
|
|
|
42
43
|
In a standalone Vue or React application, this would be equivalent to the ``./src`` directory.
|
|
43
44
|
"""
|
|
44
|
-
|
|
45
|
-
"""These are the assets that Vite will serve when developing.
|
|
46
|
-
|
|
47
|
-
This should include any images, CSS, or other media referenced.
|
|
48
|
-
|
|
49
|
-
These will be included in the bundle directory on build.
|
|
50
|
-
"""
|
|
51
|
-
templates_dir: Path
|
|
45
|
+
template_dir: Path | str = field(default="templates")
|
|
52
46
|
"""Location of the Jinja2 template file.
|
|
53
47
|
"""
|
|
54
48
|
manifest_name: str = ".vite/manifest.json"
|
|
@@ -62,9 +56,9 @@ class ViteConfig:
|
|
|
62
56
|
"""Enable HMR for Vite development server."""
|
|
63
57
|
ssr_enabled: bool = False
|
|
64
58
|
"""Enable SSR."""
|
|
65
|
-
ssr_output_dir: Path | None = None
|
|
59
|
+
ssr_output_dir: Path | str | None = None
|
|
66
60
|
"""SSR Output path"""
|
|
67
|
-
root_dir: Path | None = None
|
|
61
|
+
root_dir: Path | str | None = None
|
|
68
62
|
"""The is the base path to your application.
|
|
69
63
|
|
|
70
64
|
In a standalone Vue or React application, this would be equivalent to the ``./src`` directory.
|
|
@@ -85,7 +79,7 @@ class ViteConfig:
|
|
|
85
79
|
"""Default port to use for Vite server."""
|
|
86
80
|
run_command: list[str] = field(default_factory=lambda: ["npm", "run", "dev"])
|
|
87
81
|
"""Default command to use for running Vite."""
|
|
88
|
-
build_watch_command: list[str] = field(default_factory=lambda: ["npm", "run", "
|
|
82
|
+
build_watch_command: list[str] = field(default_factory=lambda: ["npm", "run", "watch"])
|
|
89
83
|
"""Default command to use for dev building with Vite."""
|
|
90
84
|
build_command: list[str] = field(default_factory=lambda: ["npm", "run", "build"])
|
|
91
85
|
"""Default command to use for building with Vite."""
|
|
@@ -96,6 +90,22 @@ class ViteConfig:
|
|
|
96
90
|
dev_mode: bool = False
|
|
97
91
|
"""When True, Vite will run with HMR or watch build"""
|
|
98
92
|
|
|
93
|
+
def __post_init__(self) -> None:
|
|
94
|
+
"""Ensure that directory is set if engine is a class."""
|
|
95
|
+
if self.root_dir is not None and isinstance(self.root_dir, str):
|
|
96
|
+
self.root_dir = Path(self.root_dir)
|
|
97
|
+
if isinstance(self.resource_dir, str):
|
|
98
|
+
self.resource_dir = Path(self.resource_dir)
|
|
99
|
+
if isinstance(self.ssr_output_dir, str):
|
|
100
|
+
self.ssr_output_dir = Path(self.ssr_output_dir)
|
|
101
|
+
os.environ.setdefault("LITESTAR_ASSET_URL", self.asset_url)
|
|
102
|
+
os.environ.setdefault("LITESTAR_VITE_ALLOW_REMOTE", str(True))
|
|
103
|
+
os.environ.setdefault("VITE_PORT", str(self.port))
|
|
104
|
+
os.environ.setdefault("VITE_HOST", self.host)
|
|
105
|
+
os.environ.setdefault("VITE_PROTOCOL", self.protocol)
|
|
106
|
+
if self.dev_mode:
|
|
107
|
+
os.environ.setdefault("VITE_DEV_MODE", str(self.dev_mode))
|
|
108
|
+
|
|
99
109
|
|
|
100
110
|
@dataclass
|
|
101
111
|
class ViteTemplateConfig(Generic[T]):
|
litestar_vite/loader.py
CHANGED
|
@@ -64,22 +64,22 @@ class ViteAssetLoader:
|
|
|
64
64
|
RuntimeError: if cannot load the file or JSON in file is malformed.
|
|
65
65
|
"""
|
|
66
66
|
if self._config.hot_reload:
|
|
67
|
-
if
|
|
68
|
-
self._config.bundle_dir
|
|
67
|
+
if Path(
|
|
68
|
+
f"{self._config.bundle_dir}/{self._config.hot_file}",
|
|
69
69
|
).exists():
|
|
70
|
-
with Path(self._config.bundle_dir
|
|
70
|
+
with Path(f"{self._config.bundle_dir}/{self._config.manifest_name}").open() as hot_file:
|
|
71
71
|
self._vite_base_path = hot_file.read()
|
|
72
72
|
|
|
73
73
|
else:
|
|
74
|
-
with Path(self._config.bundle_dir
|
|
74
|
+
with Path(f"{self._config.bundle_dir}/{self._config.manifest_name}").open() as manifest_file:
|
|
75
75
|
manifest_content = manifest_file.read()
|
|
76
76
|
try:
|
|
77
77
|
self._manifest = json.loads(manifest_content)
|
|
78
78
|
except Exception as exc: # noqa: BLE001
|
|
79
|
-
msg = "Cannot read Vite manifest file at %s"
|
|
79
|
+
msg = "Cannot read Vite manifest file at %s. Did you forget to build your assets?"
|
|
80
80
|
raise RuntimeError(
|
|
81
81
|
msg,
|
|
82
|
-
Path(self._config.bundle_dir
|
|
82
|
+
Path(f"{self._config.bundle_dir}/{self._config.manifest_name}"),
|
|
83
83
|
) from exc
|
|
84
84
|
|
|
85
85
|
def generate_ws_client_tags(self) -> str:
|
|
@@ -138,11 +138,11 @@ class ViteAssetLoader:
|
|
|
138
138
|
)
|
|
139
139
|
|
|
140
140
|
if any(p for p in path if p not in self._manifest):
|
|
141
|
-
msg = "Cannot find %s in Vite manifest at %s"
|
|
141
|
+
msg = "Cannot find %s in Vite manifest at %s. Did you forget to build your assets?"
|
|
142
142
|
raise RuntimeError(
|
|
143
143
|
msg,
|
|
144
144
|
path,
|
|
145
|
-
Path(self._config.bundle_dir
|
|
145
|
+
Path(f"{self._config.bundle_dir}/{self._config.manifest_name}"),
|
|
146
146
|
)
|
|
147
147
|
|
|
148
148
|
tags: list[str] = []
|
litestar_vite/plugin.py
CHANGED
|
@@ -45,7 +45,7 @@ class VitePlugin(InitPluginProtocol, CLIPlugin):
|
|
|
45
45
|
app_config.template_config = ViteTemplateConfig( # type: ignore[assignment]
|
|
46
46
|
engine=ViteTemplateEngine,
|
|
47
47
|
config=self._config,
|
|
48
|
-
directory=self._config.
|
|
48
|
+
directory=self._config.template_dir,
|
|
49
49
|
)
|
|
50
50
|
return app_config
|
|
51
51
|
|
|
@@ -60,7 +60,7 @@ class VitePlugin(InitPluginProtocol, CLIPlugin):
|
|
|
60
60
|
|
|
61
61
|
vite_process = multiprocessing.Process(
|
|
62
62
|
target=run_vite,
|
|
63
|
-
args=[command_to_run],
|
|
63
|
+
args=[command_to_run, app],
|
|
64
64
|
)
|
|
65
65
|
try:
|
|
66
66
|
vite_process.start()
|
|
@@ -3,8 +3,18 @@ import { defineConfig } from "vite";
|
|
|
3
3
|
{% if include_react %}import vue from "@vitejs/plugin-react";{% endif %}
|
|
4
4
|
import litestar from "litestar-vite-plugin";
|
|
5
5
|
|
|
6
|
+
const ASSET_URL =
|
|
7
|
+
process.env.LITESTAR_ASSET_URL || process.env.ASSET_URL || "{{ asset_url }}";
|
|
8
|
+
const VITE_PORT = process.env.VITE_PORT || "5173";
|
|
9
|
+
const VITE_HOST = process.env.VITE_HOST || "localhost";
|
|
6
10
|
export default defineConfig({
|
|
11
|
+
base: `${ASSET_URL}`,
|
|
7
12
|
root: "{{ root_path }}",
|
|
13
|
+
server: {
|
|
14
|
+
host: `${VITE_HOST}`,
|
|
15
|
+
port: +`${VITE_PORT}`,
|
|
16
|
+
cors: true,
|
|
17
|
+
},
|
|
8
18
|
plugins: [
|
|
9
19
|
{% if include_vue %}vue(),{% endif %}
|
|
10
20
|
{% if include_react %}react(),{% endif %}
|
|
@@ -12,8 +22,7 @@ export default defineConfig({
|
|
|
12
22
|
input: [
|
|
13
23
|
{% if entry_point %}"{{ entry_point | join(', \"') }}"{% endif %}
|
|
14
24
|
],
|
|
15
|
-
assetUrl:
|
|
16
|
-
assetDirectory: "{{ asset_path }}",
|
|
25
|
+
assetUrl: `${ASSET_URL}`,
|
|
17
26
|
bundleDirectory: "{{ bundle_path }}",
|
|
18
27
|
resourceDirectory: "{{ resource_path }}",
|
|
19
28
|
hotFile: "{{ hot_file }}"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: litestar-vite
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
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
|
|
@@ -55,7 +55,7 @@ from __future__ import annotations
|
|
|
55
55
|
|
|
56
56
|
from pathlib import Path
|
|
57
57
|
|
|
58
|
-
from litestar import Controller, get
|
|
58
|
+
from litestar import Controller, get, Litestar
|
|
59
59
|
from litestar.response import Template
|
|
60
60
|
from litestar.status_codes import HTTP_200_OK
|
|
61
61
|
from litestar_vite import ViteConfig, VitePlugin
|
|
@@ -73,9 +73,8 @@ class WebController(Controller):
|
|
|
73
73
|
vite = VitePlugin(
|
|
74
74
|
config=ViteConfig(
|
|
75
75
|
bundle_dir=Path("./public"),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
templates_dir=Path("./templates"),
|
|
76
|
+
resource_dir=Path("./resources"),
|
|
77
|
+
template_dir=Path("./templates"),
|
|
79
78
|
# Should be False when in production
|
|
80
79
|
dev_mode=True,
|
|
81
80
|
hot_reload=True, # Websocket HMR asset reloading is enabled when true.
|
|
@@ -83,6 +82,7 @@ vite = VitePlugin(
|
|
|
83
82
|
)
|
|
84
83
|
app = Litestar(plugins=[vite], route_handlers=[WebController])
|
|
85
84
|
|
|
85
|
+
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
Create a template to serve the application in `./templates/index.html.h2`:
|
|
@@ -102,12 +102,16 @@ Create a template to serve the application in `./templates/index.html.h2`:
|
|
|
102
102
|
|
|
103
103
|
<body class="font-sans leading-none text-gray-700 antialiased">
|
|
104
104
|
<div id="app"></div>
|
|
105
|
-
{{ vite_hmr() }} {{ vite('main.ts') }}
|
|
105
|
+
{{ vite_hmr() }} {{ vite('resources/main.ts') }}
|
|
106
106
|
</body>
|
|
107
107
|
</html>
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
### Template initialization (Optional)
|
|
111
|
+
|
|
112
|
+
This is a command to help initialize Vite for your project. This is generally only needed a single time. You may also manually configure Vite and skip this step.
|
|
113
|
+
|
|
114
|
+
to initialize a Vite configuration:
|
|
111
115
|
|
|
112
116
|
```shell
|
|
113
117
|
❯ litestar assets init
|
|
@@ -135,10 +139,12 @@ INFO - 2023-12-11 12:33:41,456 - root - commands - Writing tsconfig.json
|
|
|
135
139
|
└── assets
|
|
136
140
|
```
|
|
137
141
|
|
|
138
|
-
###
|
|
142
|
+
### Install Javascript/Typescript Packages
|
|
139
143
|
|
|
140
144
|
Install the packages required for development:
|
|
141
145
|
|
|
146
|
+
**Note** This is equivalent to the the `npm install` by default. This command is configurable.
|
|
147
|
+
|
|
142
148
|
```shell
|
|
143
149
|
❯ litestar assets install
|
|
144
150
|
Using Litestar app from app:app
|
|
@@ -154,6 +160,8 @@ added 25 packages, and audited 26 packages in 1s
|
|
|
154
160
|
found 0 vulnerabilities
|
|
155
161
|
```
|
|
156
162
|
|
|
163
|
+
### Development
|
|
164
|
+
|
|
157
165
|
To automatically start and stop the Vite instance with the Litestar application, you can enable the `use_server_lifespan` hooks in the `ViteConfig`.
|
|
158
166
|
|
|
159
167
|
Alternately, to start the development server manually, you can run the following
|
|
@@ -173,7 +181,7 @@ vite v5.0.7 building for production...
|
|
|
173
181
|
|
|
174
182
|
```
|
|
175
183
|
|
|
176
|
-
**Note** This is equivalent to the the `npm run dev` command
|
|
184
|
+
**Note** This is equivalent to the the `npm run dev` command when `hot_reload` is enabled. Otherwise it is equivalent to `npm run build --watch`. This command is configurable.
|
|
177
185
|
|
|
178
186
|
### Building for Production
|
|
179
187
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
litestar_vite/__init__.py,sha256=9X3i67Q8DJN2lQYAMa9NSPTZGzHASGn8X8yeWJqBvWg,357
|
|
2
2
|
litestar_vite/__metadata__.py,sha256=Eml1c9xezV-GSodmysksrT8jPWqE__x0ENO1wM5g6q0,319
|
|
3
|
-
litestar_vite/cli.py,sha256=
|
|
4
|
-
litestar_vite/commands.py,sha256=
|
|
5
|
-
litestar_vite/config.py,sha256=
|
|
6
|
-
litestar_vite/loader.py,sha256=
|
|
7
|
-
litestar_vite/plugin.py,sha256=
|
|
3
|
+
litestar_vite/cli.py,sha256=phkVmx9cchEv1dkA0n4qMINbvwDu_9yY0fvvzYEO-po,6387
|
|
4
|
+
litestar_vite/commands.py,sha256=zh3fn0JySMeagtUJkHQPSC5tOeoUj-3_omcRjuKkfJY,4114
|
|
5
|
+
litestar_vite/config.py,sha256=hgXaAfpcOup7uiwRDzofJS6cWaSvv9IIxPA6yxkMVsI,5641
|
|
6
|
+
litestar_vite/loader.py,sha256=zYAZllSQLG028YsP2WcXsRTEaoSWgb-XBFiMMz8_xPI,7237
|
|
7
|
+
litestar_vite/plugin.py,sha256=mHpl1pCLXljBtPWjLWjQA7YLG51BAKxoE8fQVrNz6fE,2178
|
|
8
8
|
litestar_vite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
litestar_vite/template_engine.py,sha256=s7fV4Hhi8Sd95ywylims24UpyTBFXmthEcMp4TLaRYg,2962
|
|
10
10
|
litestar_vite/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
litestar_vite/templates/init/index.html.j2,sha256=
|
|
12
|
-
litestar_vite/templates/init/package.json.j2,sha256=
|
|
11
|
+
litestar_vite/templates/init/index.html.j2,sha256=b1qkjMjDR5Clk3sA-CxJsxhO2EDiMDed2l9hkreAKeM,453
|
|
12
|
+
litestar_vite/templates/init/package.json.j2,sha256=0JWgdTuaSZ25EmCltF_zbqDdpxfvCLeYuzBjXrziXNw,299
|
|
13
13
|
litestar_vite/templates/init/tsconfig.json.j2,sha256=323T2tsrc5_J5ClfA2ClPzPR02vpj3Jt2LQTCupFHww,832
|
|
14
|
-
litestar_vite/templates/init/vite.config.ts.j2,sha256=
|
|
14
|
+
litestar_vite/templates/init/vite.config.ts.j2,sha256=8aSvRqx_uRYH6aiTqXb0MFY5hUdGcFbW_p_s8h0kMjg,1055
|
|
15
15
|
litestar_vite/templates/init/htmx/main.css.j2,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
litestar_vite/templates/init/htmx/main.js.j2,sha256=Fzic2sDw7QKnEcYtKuXB91rgounuP2FJmtidI0czc1E,35
|
|
17
17
|
litestar_vite/templates/init/react/App.tsx.j2,sha256=mXns5PRkbxOVFevO5CIb6ZTC_MoWSvW3TEk4rAzNB6w,120
|
|
@@ -22,7 +22,7 @@ litestar_vite/templates/init/tailwindcss/tailwind.config.js.j2,sha256=DyP-ShjY06
|
|
|
22
22
|
litestar_vite/templates/init/vanilla/main.css.j2,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
litestar_vite/templates/init/vue/App.vue.j2,sha256=r73CGdnzcg8KTNw1XEgg78nrw7IFyBAADJcAGkMfTT4,63
|
|
24
24
|
litestar_vite/templates/init/vue/main.ts.j2,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
-
litestar_vite-0.1.
|
|
26
|
-
litestar_vite-0.1.
|
|
27
|
-
litestar_vite-0.1.
|
|
28
|
-
litestar_vite-0.1.
|
|
25
|
+
litestar_vite-0.1.9.dist-info/METADATA,sha256=4VYNaJIBvDz1tnb9eEk5MCtwI-u6BDffw_K-lnY8hnY,6784
|
|
26
|
+
litestar_vite-0.1.9.dist-info/WHEEL,sha256=rKV0FgtKSxe-Q3jTBlmgn27qdhTm0_K1YKwPwAPskZ0,87
|
|
27
|
+
litestar_vite-0.1.9.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
|
|
28
|
+
litestar_vite-0.1.9.dist-info/RECORD,,
|
|
File without changes
|