litestar-vite-plugin 0.13.1 → 0.13.2

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.
Files changed (2) hide show
  1. package/dist/js/index.js +7 -7
  2. package/package.json +7 -7
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
- return fileURLToPath(new URL(".", import.meta.url));
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.13.1",
3
+ "version": "0.13.2",
4
4
  "type": "module",
5
5
  "description": "Litestar plugin for Vite.",
6
6
  "keywords": ["litestar", "vite", "vite-plugin"],
@@ -37,12 +37,12 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@biomejs/biome": "1.9.4",
40
- "@types/node": "^22.10.1",
41
- "esbuild": "0.25.0",
42
- "happy-dom": "^15.11.7",
43
- "typescript": "^5.7.2",
44
- "vite": "^6.0.1",
45
- "vitest": "^2.1.8"
40
+ "@types/node": "^22.15.3",
41
+ "esbuild": "0.25.3",
42
+ "happy-dom": "^17.4.6",
43
+ "typescript": "^5.8.3",
44
+ "vite": "^6.3.5",
45
+ "vitest": "^3.1.2"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "vite": "^5.0.0 || ^6.0.0"