litestar-vite-plugin 0.13.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/js/index.js +7 -7
- package/package.json +9 -9
- package/tools/clean.js +0 -0
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ app = Litestar(plugins=[vite], template_config=template_config, route_handlers=[
|
|
|
37
37
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Create a template to serve the application in `./templates/index.html.
|
|
40
|
+
Create a template to serve the application in `./templates/index.html.j2`:
|
|
41
41
|
|
|
42
42
|
```html
|
|
43
43
|
<!DOCTYPE html>
|
package/dist/js/index.js
CHANGED
|
@@ -157,14 +157,10 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
157
157
|
server.middlewares.use(async (req, res, next) => {
|
|
158
158
|
const indexPath = await findIndexHtmlPath(server, pluginConfig);
|
|
159
159
|
if (indexPath && (req.url === "/" || req.url === "/index.html")) {
|
|
160
|
+
const currentUrl = req.url;
|
|
160
161
|
try {
|
|
161
162
|
const htmlContent = await fs.promises.readFile(indexPath, "utf-8");
|
|
162
|
-
const transformedHtml = await server.transformIndexHtml(
|
|
163
|
-
"/",
|
|
164
|
-
// Use '/' as the URL for transformation context to ensure scripts are injected correctly relative to root
|
|
165
|
-
htmlContent,
|
|
166
|
-
req.originalUrl
|
|
167
|
-
);
|
|
163
|
+
const transformedHtml = await server.transformIndexHtml(req.originalUrl ?? currentUrl, htmlContent, req.originalUrl);
|
|
168
164
|
res.statusCode = 200;
|
|
169
165
|
res.setHeader("Content-Type", "text/html");
|
|
170
166
|
res.end(transformedHtml);
|
|
@@ -401,7 +397,11 @@ function resolveDevelopmentEnvironmentTld(configPath) {
|
|
|
401
397
|
return config.tld;
|
|
402
398
|
}
|
|
403
399
|
function dirname() {
|
|
404
|
-
|
|
400
|
+
try {
|
|
401
|
+
return fileURLToPath(new URL(".", import.meta.url));
|
|
402
|
+
} catch {
|
|
403
|
+
return path.resolve(process.cwd(), "src/js/src");
|
|
404
|
+
}
|
|
405
405
|
}
|
|
406
406
|
export {
|
|
407
407
|
litestar as default,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litestar-vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Litestar plugin for Vite.",
|
|
6
6
|
"keywords": ["litestar", "vite", "vite-plugin"],
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@biomejs/biome": "1.9.4",
|
|
40
|
-
"@types/node": "^22.
|
|
41
|
-
"esbuild": "0.25.
|
|
42
|
-
"happy-dom": "^
|
|
43
|
-
"typescript": "^5.
|
|
44
|
-
"vite": "^
|
|
45
|
-
"vitest": "^
|
|
40
|
+
"@types/node": "^22.15.3",
|
|
41
|
+
"esbuild": "0.25.3",
|
|
42
|
+
"happy-dom": "^17.4.6",
|
|
43
|
+
"typescript": "^5.8.3",
|
|
44
|
+
"vite": "^7.1.2",
|
|
45
|
+
"vitest": "^3.1.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"vite": "^5.0.0 || ^6.0.0"
|
|
48
|
+
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
|
-
"node": "^
|
|
51
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"picocolors": "^1.1.1",
|
package/tools/clean.js
CHANGED
|
File without changes
|