litestar-vite-plugin 0.1.5 → 0.1.7

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/dist/index.cjs CHANGED
@@ -40,6 +40,7 @@ const refreshPaths = [
40
40
  "**/*.py",
41
41
  "**/*.j2",
42
42
  "**/*.html.j2",
43
+ "**/*.html",
43
44
  "**/assets/**/*"
44
45
  ];
45
46
  function litestar(config) {
@@ -63,7 +64,7 @@ function resolveLitestarPlugin(pluginConfig) {
63
64
  userConfig = config;
64
65
  const ssr = !!userConfig.build?.ssr;
65
66
  const env = (0, import_vite.loadEnv)(mode, userConfig.envDir || process.cwd(), "");
66
- const assetUrl = env.ASSET_URL || pluginConfig.assetUrl;
67
+ const assetUrl = env.LITESTAR_ASSET_URL || pluginConfig.assetUrl;
67
68
  const serverConfig = command === "serve" ? resolveDevelopmentEnvironmentServerConfig(
68
69
  pluginConfig.detectTls
69
70
  ) ?? resolveEnvironmentServerConfig(env) : void 0;
@@ -249,11 +250,11 @@ function resolvePluginConfig(config) {
249
250
  );
250
251
  }
251
252
  }
252
- if (typeof config.buildDirectory === "string") {
253
- config.buildDirectory = config.buildDirectory.trim().replace(/^\/+/, "").replace(/\/+$/, "");
254
- if (config.buildDirectory === "") {
253
+ if (typeof config.bundleDirectory === "string") {
254
+ config.bundleDirectory = config.bundleDirectory.trim().replace(/^\/+/, "").replace(/\/+$/, "");
255
+ if (config.bundleDirectory === "") {
255
256
  throw new Error(
256
- "litestar-vite-plugin: buildDirectory must be a subdirectory. E.g. 'public'."
257
+ "litestar-vite-plugin: bundleDirectory must be a subdirectory. E.g. 'public'."
257
258
  );
258
259
  }
259
260
  }
@@ -268,7 +269,7 @@ function resolvePluginConfig(config) {
268
269
  assetUrl: config.assetUrl || (config.assetUrl ?? "static"),
269
270
  resourceDirectory: config.resourceDirectory ?? "/resources/",
270
271
  assetDirectory: config.assetDirectory ?? "assets",
271
- buildDirectory: config.buildDirectory || (config.buildDirectory ?? "public"),
272
+ bundleDirectory: config.bundleDirectory || (config.bundleDirectory ?? "public"),
272
273
  ssr: config.ssr ?? config.input,
273
274
  ssrOutputDirectory: config.ssrOutputDirectory ?? "bootstrap/ssr",
274
275
  refresh: config.refresh ?? false,
@@ -290,7 +291,7 @@ function resolveOutDir(config, ssr) {
290
291
  if (ssr) {
291
292
  return config.ssrOutputDirectory;
292
293
  }
293
- return import_path.default.join(config.buildDirectory);
294
+ return import_path.default.join(config.bundleDirectory);
294
295
  }
295
296
  function resolveFullReloadConfig({
296
297
  refresh: config
package/dist/index.d.ts CHANGED
@@ -12,11 +12,11 @@ interface PluginConfig {
12
12
  */
13
13
  assetUrl?: string;
14
14
  /**
15
- * The public directory where all compiled assets should be written.
15
+ * The public directory where all compiled/bundled assets should be written.
16
16
  *
17
17
  * @default 'public'
18
18
  */
19
- buildDirectory?: string;
19
+ bundleDirectory?: string;
20
20
  /**
21
21
  * The directory where all typescript/javascript source are written. This is used as the default "@" alias is pointed.
22
22
  *
@@ -32,7 +32,7 @@ interface PluginConfig {
32
32
  /**
33
33
  * The path to the "hot" file.
34
34
  *
35
- * @default `${buildDirectory}/hot`
35
+ * @default `${bundleDirectory}/hot`
36
36
  */
37
37
  hotFile?: string;
38
38
  /**
@@ -42,7 +42,7 @@ interface PluginConfig {
42
42
  /**
43
43
  * The directory where the SSR bundle should be written.
44
44
  *
45
- * @default '${buildDirectory}/bootstrap/ssr'
45
+ * @default '${bundleDirectory}/bootstrap/ssr'
46
46
  */
47
47
  ssrOutputDirectory?: string;
48
48
  /**
package/dist/index.mjs CHANGED
@@ -11,6 +11,7 @@ const refreshPaths = [
11
11
  "**/*.py",
12
12
  "**/*.j2",
13
13
  "**/*.html.j2",
14
+ "**/*.html",
14
15
  "**/assets/**/*"
15
16
  ];
16
17
  function litestar(config) {
@@ -34,7 +35,7 @@ function resolveLitestarPlugin(pluginConfig) {
34
35
  userConfig = config;
35
36
  const ssr = !!userConfig.build?.ssr;
36
37
  const env = loadEnv(mode, userConfig.envDir || process.cwd(), "");
37
- const assetUrl = env.ASSET_URL || pluginConfig.assetUrl;
38
+ const assetUrl = env.LITESTAR_ASSET_URL || pluginConfig.assetUrl;
38
39
  const serverConfig = command === "serve" ? resolveDevelopmentEnvironmentServerConfig(
39
40
  pluginConfig.detectTls
40
41
  ) ?? resolveEnvironmentServerConfig(env) : void 0;
@@ -220,11 +221,11 @@ function resolvePluginConfig(config) {
220
221
  );
221
222
  }
222
223
  }
223
- if (typeof config.buildDirectory === "string") {
224
- config.buildDirectory = config.buildDirectory.trim().replace(/^\/+/, "").replace(/\/+$/, "");
225
- if (config.buildDirectory === "") {
224
+ if (typeof config.bundleDirectory === "string") {
225
+ config.bundleDirectory = config.bundleDirectory.trim().replace(/^\/+/, "").replace(/\/+$/, "");
226
+ if (config.bundleDirectory === "") {
226
227
  throw new Error(
227
- "litestar-vite-plugin: buildDirectory must be a subdirectory. E.g. 'public'."
228
+ "litestar-vite-plugin: bundleDirectory must be a subdirectory. E.g. 'public'."
228
229
  );
229
230
  }
230
231
  }
@@ -239,7 +240,7 @@ function resolvePluginConfig(config) {
239
240
  assetUrl: config.assetUrl || (config.assetUrl ?? "static"),
240
241
  resourceDirectory: config.resourceDirectory ?? "/resources/",
241
242
  assetDirectory: config.assetDirectory ?? "assets",
242
- buildDirectory: config.buildDirectory || (config.buildDirectory ?? "public"),
243
+ bundleDirectory: config.bundleDirectory || (config.bundleDirectory ?? "public"),
243
244
  ssr: config.ssr ?? config.input,
244
245
  ssrOutputDirectory: config.ssrOutputDirectory ?? "bootstrap/ssr",
245
246
  refresh: config.refresh ?? false,
@@ -261,7 +262,7 @@ function resolveOutDir(config, ssr) {
261
262
  if (ssr) {
262
263
  return config.ssrOutputDirectory;
263
264
  }
264
- return path.join(config.buildDirectory);
265
+ return path.join(config.bundleDirectory);
265
266
  }
266
267
  function resolveFullReloadConfig({
267
268
  refresh: config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litestar-vite-plugin",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Litestar plugin for Vite.",
5
5
  "keywords": [
6
6
  "litestar",