litestar-vite 0.1.8__tar.gz → 0.1.9__tar.gz

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.

Files changed (71) hide show
  1. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/PKG-INFO +5 -4
  2. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/README.md +4 -3
  3. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/htmx/app.py +1 -1
  4. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/react/app.py +1 -1
  5. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/app.py +1 -1
  6. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/cli.py +0 -7
  7. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/commands.py +3 -3
  8. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/config.py +2 -4
  9. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/plugin.py +1 -1
  10. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/vite.config.ts.j2 +2 -3
  11. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/pyproject.toml +1 -1
  12. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/.github/CODEOWNERS +0 -0
  13. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/.github/workflows/cd.yaml +0 -0
  14. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/.github/workflows/ci.yaml +0 -0
  15. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/.github/workflows/docs-preview.yaml +0 -0
  16. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/.github/workflows/docs.yaml +0 -0
  17. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/.github/workflows/pr-title.yaml +0 -0
  18. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/.github/workflows/publish.yaml +0 -0
  19. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/.gitignore +0 -0
  20. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/.pre-commit-config.yaml +0 -0
  21. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/CONTRIBUTING.rst +0 -0
  22. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/LICENSE +0 -0
  23. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/Makefile +0 -0
  24. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/docs/Makefile +0 -0
  25. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/docs/conf.py +0 -0
  26. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/docs/contribution-guide.rst +0 -0
  27. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/docs/fix_missing_references.py +0 -0
  28. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/docs/index.rst +0 -0
  29. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/docs/reference/config.rst +0 -0
  30. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/docs/reference/plugin.rst +0 -0
  31. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/docs/usage/index.rst +0 -0
  32. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/docs/usage/placeholder.rst +0 -0
  33. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/__init__.py +0 -0
  34. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/htmx/package.json +0 -0
  35. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/htmx/tsconfig.json +0 -0
  36. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/htmx/vite.config.ts +0 -0
  37. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/__init__.py +0 -0
  38. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/package-lock.json +0 -0
  39. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/package.json +0 -0
  40. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/tsconfig.json +0 -0
  41. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/vite.config.ts +0 -0
  42. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/web/__init__.py +0 -0
  43. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/web/controllers.py +0 -0
  44. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/web/public/.gitkeep +0 -0
  45. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/web/resources/App.vue +0 -0
  46. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/web/resources/assets/vue.svg +0 -0
  47. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/web/resources/main.ts +0 -0
  48. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/web/resources/styles.css +0 -0
  49. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/examples/vue/web/templates/index.html.j2 +0 -0
  50. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/__init__.py +0 -0
  51. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/__metadata__.py +0 -0
  52. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/loader.py +0 -0
  53. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/py.typed +0 -0
  54. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/template_engine.py +0 -0
  55. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/__init__.py +0 -0
  56. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/htmx/main.css.j2 +0 -0
  57. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/htmx/main.js.j2 +0 -0
  58. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/index.html.j2 +0 -0
  59. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/package.json.j2 +0 -0
  60. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/react/App.tsx.j2 +0 -0
  61. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/react/main.tsx.j2 +0 -0
  62. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/tailwindcss/main.css.j2 +0 -0
  63. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/tailwindcss/postcss.config.ts.j2 +0 -0
  64. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/tailwindcss/tailwind.config.js.j2 +0 -0
  65. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/tsconfig.json.j2 +0 -0
  66. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/vanilla/main.css.j2 +0 -0
  67. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/vue/App.vue.j2 +0 -0
  68. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/litestar_vite/templates/init/vue/main.ts.j2 +0 -0
  69. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/pdm.lock +0 -0
  70. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/tests/__init__.py +0 -0
  71. {litestar_vite-0.1.8 → litestar_vite-0.1.9}/tests/docker-compose.yml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: litestar-vite
3
- Version: 0.1.8
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,8 +73,8 @@ class WebController(Controller):
73
73
  vite = VitePlugin(
74
74
  config=ViteConfig(
75
75
  bundle_dir=Path("./public"),
76
- resources_dir=Path("./resources"),
77
- templates_dir=Path("./templates"),
76
+ resource_dir=Path("./resources"),
77
+ template_dir=Path("./templates"),
78
78
  # Should be False when in production
79
79
  dev_mode=True,
80
80
  hot_reload=True, # Websocket HMR asset reloading is enabled when true.
@@ -82,6 +82,7 @@ vite = VitePlugin(
82
82
  )
83
83
  app = Litestar(plugins=[vite], route_handlers=[WebController])
84
84
 
85
+
85
86
  ```
86
87
 
87
88
  Create a template to serve the application in `./templates/index.html.h2`:
@@ -18,7 +18,7 @@ from __future__ import annotations
18
18
 
19
19
  from pathlib import Path
20
20
 
21
- from litestar import Controller, get
21
+ from litestar import Controller, get, Litestar
22
22
  from litestar.response import Template
23
23
  from litestar.status_codes import HTTP_200_OK
24
24
  from litestar_vite import ViteConfig, VitePlugin
@@ -36,8 +36,8 @@ class WebController(Controller):
36
36
  vite = VitePlugin(
37
37
  config=ViteConfig(
38
38
  bundle_dir=Path("./public"),
39
- resources_dir=Path("./resources"),
40
- templates_dir=Path("./templates"),
39
+ resource_dir=Path("./resources"),
40
+ template_dir=Path("./templates"),
41
41
  # Should be False when in production
42
42
  dev_mode=True,
43
43
  hot_reload=True, # Websocket HMR asset reloading is enabled when true.
@@ -45,6 +45,7 @@ vite = VitePlugin(
45
45
  )
46
46
  app = Litestar(plugins=[vite], route_handlers=[WebController])
47
47
 
48
+
48
49
  ```
49
50
 
50
51
  Create a template to serve the application in `./templates/index.html.h2`:
@@ -12,7 +12,7 @@ vite = VitePlugin(
12
12
  config=ViteConfig(
13
13
  bundle_dir=Path(here / "web" / "public"),
14
14
  resource_dir=Path(here / "web" / "resources"),
15
- templates_dir=Path(here / "web" / "templates"),
15
+ template_dir=Path(here / "web" / "templates"),
16
16
  hot_reload=True,
17
17
  ),
18
18
  )
@@ -12,7 +12,7 @@ vite = VitePlugin(
12
12
  config=ViteConfig(
13
13
  bundle_dir=Path(here / "web" / "public"),
14
14
  resource_dir=Path(here / "web" / "resources"),
15
- templates_dir=Path(here / "web" / "templates"),
15
+ template_dir=Path(here / "web" / "templates"),
16
16
  hot_reload=True,
17
17
  ),
18
18
  )
@@ -13,7 +13,7 @@ vite = VitePlugin(
13
13
  config=ViteConfig(
14
14
  bundle_dir=Path(here / "web" / "public"),
15
15
  resource_dir=Path(here / "web" / "resources"),
16
- templates_dir=Path(here / "web" / "templates"),
16
+ template_dir=Path(here / "web" / "templates"),
17
17
  hot_reload=True,
18
18
  port=3006,
19
19
  ),
@@ -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",
@@ -76,7 +76,7 @@ def init_vite(
76
76
  entry_point=entry_point,
77
77
  enable_ssr=enable_ssr,
78
78
  asset_url=asset_url,
79
- root_path=str(root_path.relative_to(Path.cwd())),
79
+ root_path=str(root_path),
80
80
  resource_path=str(resource_path.relative_to(root_path)),
81
81
  bundle_path=str(bundle_path.relative_to(root_path)),
82
82
  hot_file=str(hot_file.relative_to(root_path)),
@@ -116,11 +116,11 @@ async def _run_vite(command_to_run: str, app: Litestar) -> None:
116
116
 
117
117
  async def read_stdout(vite_process: Process) -> None:
118
118
  async for stdout in TextReceiveStream(vite_process.stdout): # type: ignore[arg-type]
119
- logger.info(stdout)
119
+ logger.info(stdout.replace("\n", ""))
120
120
 
121
121
  async def read_stderr(vite_process: Process) -> None:
122
122
  async for stdout in TextReceiveStream(vite_process.stderr): # type: ignore[arg-type]
123
- logger.warning(stdout)
123
+ logger.warning(stdout.replace("\n", ""))
124
124
 
125
125
  async with await open_process(command_to_run) as vite_process, create_task_group() as tg:
126
126
  tg.start_soon(read_stdout, vite_process)
@@ -42,7 +42,7 @@ class ViteConfig:
42
42
 
43
43
  In a standalone Vue or React application, this would be equivalent to the ``./src`` directory.
44
44
  """
45
- templates_dir: Path | str = field(default="templates")
45
+ template_dir: Path | str = field(default="templates")
46
46
  """Location of the Jinja2 template file.
47
47
  """
48
48
  manifest_name: str = ".vite/manifest.json"
@@ -92,10 +92,8 @@ class ViteConfig:
92
92
 
93
93
  def __post_init__(self) -> None:
94
94
  """Ensure that directory is set if engine is a class."""
95
- if isinstance(self.root_dir, str):
95
+ if self.root_dir is not None and isinstance(self.root_dir, str):
96
96
  self.root_dir = Path(self.root_dir)
97
- if self.root_dir is None:
98
- self.root_dir = Path.cwd()
99
97
  if isinstance(self.resource_dir, str):
100
98
  self.resource_dir = Path(self.resource_dir)
101
99
  if isinstance(self.ssr_output_dir, str):
@@ -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.templates_dir,
48
+ directory=self._config.template_dir,
49
49
  )
50
50
  return app_config
51
51
 
@@ -1,5 +1,4 @@
1
1
  import { defineConfig } from "vite";
2
- import path from "path";
3
2
  {% if include_vue %}import vue from "@vitejs/plugin-vue";{% endif %}
4
3
  {% if include_react %}import vue from "@vitejs/plugin-react";{% endif %}
5
4
  import litestar from "litestar-vite-plugin";
@@ -10,7 +9,7 @@ const VITE_PORT = process.env.VITE_PORT || "5173";
10
9
  const VITE_HOST = process.env.VITE_HOST || "localhost";
11
10
  export default defineConfig({
12
11
  base: `${ASSET_URL}`,
13
- root: path.resolve(__dirname, "{{ root_path }}"),
12
+ root: "{{ root_path }}",
14
13
  server: {
15
14
  host: `${VITE_HOST}`,
16
15
  port: +`${VITE_PORT}`,
@@ -31,7 +30,7 @@ export default defineConfig({
31
30
  ],
32
31
  resolve: {
33
32
  alias: {
34
- "@": path.resolve(__dirname, "{{ resource_path }}")
33
+ "@": "{{ resource_path }}"
35
34
  },
36
35
  },
37
36
  });
@@ -33,7 +33,7 @@ license = {text = "MIT"}
33
33
  name = "litestar-vite"
34
34
  readme = "README.md"
35
35
  requires-python = ">=3.8"
36
- version = "0.1.8"
36
+ version = "0.1.9"
37
37
 
38
38
  [project.urls]
39
39
  Changelog = "https://cofin.github.io/litestar-vite/latest/changelog"
File without changes
File without changes
File without changes
File without changes