litestar-vite 0.8.1__py3-none-any.whl → 0.8.2__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 +1 -5
- litestar_vite/commands.py +21 -13
- litestar_vite/config.py +2 -0
- litestar_vite/templates/vite.config.ts.j2 +0 -1
- {litestar_vite-0.8.1.dist-info → litestar_vite-0.8.2.dist-info}/METADATA +1 -1
- {litestar_vite-0.8.1.dist-info → litestar_vite-0.8.2.dist-info}/RECORD +8 -8
- {litestar_vite-0.8.1.dist-info → litestar_vite-0.8.2.dist-info}/WHEEL +0 -0
- {litestar_vite-0.8.1.dist-info → litestar_vite-0.8.2.dist-info}/licenses/LICENSE +0 -0
litestar_vite/cli.py
CHANGED
|
@@ -125,6 +125,7 @@ def vite_init(
|
|
|
125
125
|
config = plugin._config # pyright: ignore[reportPrivateUsage]
|
|
126
126
|
|
|
127
127
|
console.rule("[yellow]Initializing Vite[/]", align="left")
|
|
128
|
+
root_path = Path(root_path or config.root_dir or Path.cwd())
|
|
128
129
|
resource_path = Path(resource_path or config.resource_dir)
|
|
129
130
|
public_path = Path(public_path or config.public_dir)
|
|
130
131
|
bundle_path = Path(bundle_path or config.bundle_dir)
|
|
@@ -132,7 +133,6 @@ def vite_init(
|
|
|
132
133
|
asset_url = asset_url or config.asset_url
|
|
133
134
|
vite_port = vite_port or config.port
|
|
134
135
|
hot_file = Path(bundle_path / config.hot_file)
|
|
135
|
-
root_path = Path(root_path or config.root_dir or resource_path.parent)
|
|
136
136
|
|
|
137
137
|
if any(output_path.exists() for output_path in (bundle_path, resource_path)) and not any(
|
|
138
138
|
[overwrite, no_prompt],
|
|
@@ -143,10 +143,6 @@ def vite_init(
|
|
|
143
143
|
if not confirm_overwrite:
|
|
144
144
|
console.print("Skipping Vite initialization")
|
|
145
145
|
sys.exit(2)
|
|
146
|
-
for output_path in (bundle_path, resource_path, root_path):
|
|
147
|
-
if output_path.exists():
|
|
148
|
-
console.print(f" * Creating {output_path!s}")
|
|
149
|
-
output_path.mkdir(parents=True, exist_ok=True)
|
|
150
146
|
|
|
151
147
|
enable_ssr = (
|
|
152
148
|
True
|
litestar_vite/commands.py
CHANGED
|
@@ -12,10 +12,10 @@ if TYPE_CHECKING:
|
|
|
12
12
|
VITE_INIT_TEMPLATES: set[str] = {"package.json.j2", "tsconfig.json.j2", "vite.config.ts.j2"}
|
|
13
13
|
DEFAULT_RESOURCES: set[str] = {"styles.css.j2", "main.ts.j2"}
|
|
14
14
|
DEFAULT_DEV_DEPENDENCIES: dict[str, str] = {
|
|
15
|
-
"typescript": "^5.
|
|
16
|
-
"vite": "^
|
|
17
|
-
"litestar-vite-plugin": "^0.
|
|
18
|
-
"@types/node": "^
|
|
15
|
+
"typescript": "^5.7.2",
|
|
16
|
+
"vite": "^6.0.3",
|
|
17
|
+
"litestar-vite-plugin": "^0.8.2",
|
|
18
|
+
"@types/node": "^22.10.1",
|
|
19
19
|
}
|
|
20
20
|
DEFAULT_DEPENDENCIES: dict[str, str] = {"axios": "^1.7.2"}
|
|
21
21
|
|
|
@@ -78,10 +78,14 @@ def init_vite(
|
|
|
78
78
|
template_name: get_template(environment=vite_template_env, name=template_name)
|
|
79
79
|
for template_name in enabled_templates
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
# Prepare root_path
|
|
83
|
+
root_path.mkdir(parents=True, exist_ok=True)
|
|
81
84
|
for template_name, template in templates.items():
|
|
82
85
|
target_file_name = template_name[:-3] if template_name.endswith(".j2") else template_name
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
target_file_path = root_path / target_file_name
|
|
87
|
+
with target_file_path.open(mode="w") as file:
|
|
88
|
+
console.print(f" * Writing {target_file_name} to {target_file_path!s}")
|
|
85
89
|
|
|
86
90
|
file.write(
|
|
87
91
|
template.render(
|
|
@@ -92,10 +96,10 @@ def init_vite(
|
|
|
92
96
|
enable_ssr=enable_ssr,
|
|
93
97
|
asset_url=asset_url,
|
|
94
98
|
root_path=root_path,
|
|
95
|
-
resource_path=str(resource_path
|
|
96
|
-
public_path=str(public_path
|
|
97
|
-
bundle_path=str(bundle_path
|
|
98
|
-
hot_file=str(hot_file
|
|
99
|
+
resource_path=str(resource_path),
|
|
100
|
+
public_path=str(public_path),
|
|
101
|
+
bundle_path=str(bundle_path),
|
|
102
|
+
hot_file=str(hot_file),
|
|
99
103
|
vite_port=str(vite_port),
|
|
100
104
|
litestar_port=litestar_port,
|
|
101
105
|
dependencies=to_json(dependencies),
|
|
@@ -103,12 +107,16 @@ def init_vite(
|
|
|
103
107
|
),
|
|
104
108
|
)
|
|
105
109
|
|
|
110
|
+
(root_path / bundle_path).mkdir(parents=True, exist_ok=True)
|
|
111
|
+
(root_path / public_path).mkdir(parents=True, exist_ok=True)
|
|
112
|
+
(root_path / resource_path).mkdir(parents=True, exist_ok=True)
|
|
106
113
|
for resource_name in enabled_resources:
|
|
107
114
|
template = get_template(environment=vite_template_env, name=resource_name)
|
|
108
|
-
target_file_name = f"{
|
|
109
|
-
|
|
115
|
+
target_file_name = f"{resource_name[:-3] if resource_name.endswith('.j2') else resource_name}"
|
|
116
|
+
target_file_path = root_path / resource_path / target_file_name
|
|
117
|
+
with target_file_path.open(mode="w") as file:
|
|
110
118
|
console.print(
|
|
111
|
-
f" * Writing {resource_name[:-3] if resource_name.endswith('.j2') else resource_name} to {
|
|
119
|
+
f" * Writing {resource_name[:-3] if resource_name.endswith('.j2') else resource_name} to {target_file_path!s}",
|
|
112
120
|
)
|
|
113
121
|
file.write(template.render())
|
|
114
122
|
console.print("[yellow]Vite initialization completed.[/]")
|
litestar_vite/config.py
CHANGED
|
@@ -111,6 +111,8 @@ class ViteConfig:
|
|
|
111
111
|
"""Ensure that directory is set if engine is a class."""
|
|
112
112
|
if self.root_dir is not None and isinstance(self.root_dir, str):
|
|
113
113
|
self.root_dir = Path(self.root_dir)
|
|
114
|
+
elif self.root_dir is None:
|
|
115
|
+
self.root_dir = Path()
|
|
114
116
|
if self.template_dir is not None and isinstance(self.template_dir, str):
|
|
115
117
|
self.template_dir = Path(self.template_dir)
|
|
116
118
|
if self.public_dir and isinstance(self.public_dir, str):
|
|
@@ -8,7 +8,6 @@ const VITE_PORT = process.env.VITE_PORT || "5173";
|
|
|
8
8
|
const VITE_HOST = process.env.VITE_HOST || "localhost";
|
|
9
9
|
export default defineConfig({
|
|
10
10
|
base: `${ASSET_URL}`,
|
|
11
|
-
{% if root_path and root_path != '.' %} root: "{{ root_path }}",{% endif %}
|
|
12
11
|
server: {
|
|
13
12
|
host: "0.0.0.0",
|
|
14
13
|
port: +`${VITE_PORT}`,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
litestar_vite/__init__.py,sha256=S2zgWHas3O16FhXukd1j3tGCMP9skj7Rp-BvMQA7sd8,402
|
|
2
2
|
litestar_vite/__metadata__.py,sha256=_Wo-vNQuj5co9J4FwJAB2rRafbFo8ztTHrXmEPrYrV8,514
|
|
3
|
-
litestar_vite/cli.py,sha256=
|
|
4
|
-
litestar_vite/commands.py,sha256=
|
|
5
|
-
litestar_vite/config.py,sha256=
|
|
3
|
+
litestar_vite/cli.py,sha256=iRJlHa72ch9IPtu88BsalrqzDGXI3F78b2ug8JT5UWA,10756
|
|
4
|
+
litestar_vite/commands.py,sha256=Tt78BJRqxYRyO6SgSQZLhF9DmjD_iTjy5cvUs7W5Lis,5227
|
|
5
|
+
litestar_vite/config.py,sha256=IA5MU6TOxXPYrCehGoBK_dFniu2PrYvOGwQPV7XkX5I,7756
|
|
6
6
|
litestar_vite/loader.py,sha256=gK0RlenM-enNV_pS-jEwW9hanAmq053m2P75rfQuGCg,8227
|
|
7
7
|
litestar_vite/plugin.py,sha256=p4VPKYdWw5qIYZ1OwfdMRcwM_Q-vfoDEmIbu3IyF7oI,5166
|
|
8
8
|
litestar_vite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -23,8 +23,8 @@ litestar_vite/templates/main.ts.j2,sha256=Nzr5m_hXMAjeDL_4yQNP3DMCf7Blh3dwg5m-67
|
|
|
23
23
|
litestar_vite/templates/package.json.j2,sha256=0JWgdTuaSZ25EmCltF_zbqDdpxfvCLeYuzBjXrziXNw,299
|
|
24
24
|
litestar_vite/templates/styles.css.j2,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
litestar_vite/templates/tsconfig.json.j2,sha256=q1REIuVyXUHCy4Zi2kgTkmrhdT98vyY89k-WTrImOj8,843
|
|
26
|
-
litestar_vite/templates/vite.config.ts.j2,sha256=
|
|
27
|
-
litestar_vite-0.8.
|
|
28
|
-
litestar_vite-0.8.
|
|
29
|
-
litestar_vite-0.8.
|
|
30
|
-
litestar_vite-0.8.
|
|
26
|
+
litestar_vite/templates/vite.config.ts.j2,sha256=bF5kOPFafYMkhhV0VkIwetN-_zoVMGVM1jEMX_wKoNc,1037
|
|
27
|
+
litestar_vite-0.8.2.dist-info/METADATA,sha256=HWuJaArFAiuVAc8ulnkvFg4XxZuWLbeP3lYXJWxA7Ow,6022
|
|
28
|
+
litestar_vite-0.8.2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
29
|
+
litestar_vite-0.8.2.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
|
|
30
|
+
litestar_vite-0.8.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|