litestar-vite 0.15.0__py3-none-any.whl → 0.15.0rc2__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.
Files changed (55) hide show
  1. litestar_vite/_codegen/__init__.py +26 -0
  2. litestar_vite/_codegen/inertia.py +407 -0
  3. litestar_vite/{codegen/_openapi.py → _codegen/openapi.py} +11 -58
  4. litestar_vite/{codegen/_routes.py → _codegen/routes.py} +43 -110
  5. litestar_vite/{codegen/_ts.py → _codegen/ts.py} +19 -19
  6. litestar_vite/_handler/__init__.py +8 -0
  7. litestar_vite/{handler/_app.py → _handler/app.py} +29 -117
  8. litestar_vite/cli.py +254 -155
  9. litestar_vite/codegen.py +39 -0
  10. litestar_vite/commands.py +6 -0
  11. litestar_vite/{config/__init__.py → config.py} +726 -99
  12. litestar_vite/deploy.py +3 -14
  13. litestar_vite/doctor.py +6 -8
  14. litestar_vite/executor.py +1 -45
  15. litestar_vite/handler.py +9 -0
  16. litestar_vite/html_transform.py +5 -148
  17. litestar_vite/inertia/__init__.py +0 -24
  18. litestar_vite/inertia/_utils.py +0 -5
  19. litestar_vite/inertia/exception_handler.py +16 -22
  20. litestar_vite/inertia/helpers.py +18 -546
  21. litestar_vite/inertia/plugin.py +11 -77
  22. litestar_vite/inertia/request.py +0 -48
  23. litestar_vite/inertia/response.py +17 -113
  24. litestar_vite/inertia/types.py +0 -19
  25. litestar_vite/loader.py +7 -7
  26. litestar_vite/plugin.py +2184 -0
  27. litestar_vite/templates/angular/package.json.j2 +1 -2
  28. litestar_vite/templates/angular-cli/package.json.j2 +1 -2
  29. litestar_vite/templates/base/package.json.j2 +1 -2
  30. litestar_vite/templates/react-inertia/package.json.j2 +1 -2
  31. litestar_vite/templates/vue-inertia/package.json.j2 +1 -2
  32. {litestar_vite-0.15.0.dist-info → litestar_vite-0.15.0rc2.dist-info}/METADATA +5 -5
  33. {litestar_vite-0.15.0.dist-info → litestar_vite-0.15.0rc2.dist-info}/RECORD +36 -49
  34. litestar_vite/codegen/__init__.py +0 -48
  35. litestar_vite/codegen/_export.py +0 -229
  36. litestar_vite/codegen/_inertia.py +0 -619
  37. litestar_vite/codegen/_utils.py +0 -141
  38. litestar_vite/config/_constants.py +0 -97
  39. litestar_vite/config/_deploy.py +0 -70
  40. litestar_vite/config/_inertia.py +0 -241
  41. litestar_vite/config/_paths.py +0 -63
  42. litestar_vite/config/_runtime.py +0 -235
  43. litestar_vite/config/_spa.py +0 -93
  44. litestar_vite/config/_types.py +0 -94
  45. litestar_vite/handler/__init__.py +0 -9
  46. litestar_vite/inertia/precognition.py +0 -274
  47. litestar_vite/plugin/__init__.py +0 -687
  48. litestar_vite/plugin/_process.py +0 -185
  49. litestar_vite/plugin/_proxy.py +0 -689
  50. litestar_vite/plugin/_proxy_headers.py +0 -244
  51. litestar_vite/plugin/_static.py +0 -37
  52. litestar_vite/plugin/_utils.py +0 -489
  53. /litestar_vite/{handler/_routing.py → _handler/routing.py} +0 -0
  54. {litestar_vite-0.15.0.dist-info → litestar_vite-0.15.0rc2.dist-info}/WHEEL +0 -0
  55. {litestar_vite-0.15.0.dist-info → litestar_vite-0.15.0rc2.dist-info}/licenses/LICENSE +0 -0
@@ -7,8 +7,7 @@
7
7
  "build": "vite build",
8
8
  "preview": "vite preview",
9
9
  "serve": "vite preview",
10
- "watch": "npm run serve",
11
- "update": "npm update"{% if generate_client %},
10
+ "watch": "npm run serve"{% if generate_client %},
12
11
  "generate-types": "openapi-ts"{% endif %}
13
12
  },
14
13
  "dependencies": {
@@ -8,8 +8,7 @@
8
8
  "start": "ng serve --proxy-config proxy.conf.json",
9
9
  "build": "ng build",
10
10
  "serve": "npx serve dist/{{ project_name }}/browser",
11
- "watch": "npm run serve",
12
- "update": "npm update"
11
+ "watch": "npm run serve"
13
12
  },
14
13
  "dependencies": {
15
14
  {%- for dep in dependencies %}
@@ -7,8 +7,7 @@
7
7
  "build": "vite build{% if use_typescript %} && {% if framework in ['vue', 'vue-inertia'] %}vue-tsc -b --noEmit{% else %}tsc -b --noEmit{% endif %}{% endif %}",
8
8
  "preview": "vite preview",
9
9
  "serve": "vite preview",
10
- "watch": "npm run serve",
11
- "update": "npm update"{% if generate_client %},
10
+ "watch": "npm run serve"{% if generate_client %},
12
11
  "generate-types": "openapi-ts"{% endif %}
13
12
  },
14
13
  "dependencies": {
@@ -15,8 +15,7 @@
15
15
  {% else %}
16
16
  "serve": "vite preview",
17
17
  {% endif %}
18
- "watch": "npm run serve",
19
- "update": "npm update"{% if generate_client %},
18
+ "watch": "npm run serve"{% if generate_client %},
20
19
  "generate-types": "openapi-ts"{% endif %}
21
20
  },
22
21
  "dependencies": {
@@ -15,8 +15,7 @@
15
15
  {% else %}
16
16
  "serve": "vite preview",
17
17
  {% endif %}
18
- "watch": "npm run serve",
19
- "update": "npm update"{% if generate_client %},
18
+ "watch": "npm run serve"{% if generate_client %},
20
19
  "generate-types": "openapi-ts"{% endif %}
21
20
  },
22
21
  "dependencies": {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: litestar-vite
3
- Version: 0.15.0
3
+ Version: 0.15.0rc2
4
4
  Summary: Vite plugin for Litestar
5
5
  Project-URL: Changelog, https://litestar-org.github.io/litestar-vite/latest/changelog
6
6
  Project-URL: Discord, https://discord.gg/X3FJqy8d2j
@@ -48,7 +48,7 @@ Litestar Vite connects the Litestar backend to a Vite toolchain. It supports SPA
48
48
  ## Features
49
49
 
50
50
  - One-port dev: proxies Vite HTTP + WS/HMR through Litestar by default; switch to two-port with `VITE_PROXY_MODE=direct`.
51
- - SSR framework support: use `mode="ssr"` for Astro, Nuxt, SvelteKit - proxies everything except your API routes.
51
+ - SSR framework support: use `proxy_mode="ssr"` for Astro, Nuxt, SvelteKit - proxies everything except your API routes.
52
52
  - Production assets: reads Vite manifest from `public/manifest.json` (configurable) and serves under `asset_url`.
53
53
  - Type-safe frontends: optional OpenAPI/routes export + `@hey-api/openapi-ts` via the Vite plugin.
54
54
  - Inertia support: v2 protocol with session middleware and optional SPA mode.
@@ -146,13 +146,13 @@ app = Litestar(
146
146
 
147
147
  ## Meta-frameworks (Astro, Nuxt, SvelteKit)
148
148
 
149
- Use `mode="ssr"` (or `mode="framework"`) to proxy non-API routes to the framework's dev server:
149
+ Use `proxy_mode="ssr"` to proxy non-API routes to the framework's dev server:
150
150
 
151
151
  ```python
152
152
  import os
153
153
  from pathlib import Path
154
154
  from litestar import Litestar
155
- from litestar_vite import VitePlugin, ViteConfig, PathConfig
155
+ from litestar_vite import VitePlugin, ViteConfig, PathConfig, RuntimeConfig
156
156
 
157
157
  here = Path(__file__).parent
158
158
  DEV_MODE = os.getenv("VITE_DEV_MODE", "true").lower() in ("true", "1", "yes")
@@ -160,9 +160,9 @@ DEV_MODE = os.getenv("VITE_DEV_MODE", "true").lower() in ("true", "1", "yes")
160
160
  app = Litestar(
161
161
  plugins=[
162
162
  VitePlugin(config=ViteConfig(
163
- mode="ssr",
164
163
  dev_mode=DEV_MODE,
165
164
  paths=PathConfig(root=here),
165
+ runtime=RuntimeConfig(proxy_mode="ssr"),
166
166
  ))
167
167
  ],
168
168
  )
@@ -1,48 +1,35 @@
1
1
  litestar_vite/__init__.py,sha256=6z2O7JKG-PplQmFczzTyW862wkOrW4M_xm1VI47bHHM,1421
2
2
  litestar_vite/__metadata__.py,sha256=dMGIPS6M11LcmiEfnMJJrbSPH8Lf00pU8crIIUsIBPw,478
3
- litestar_vite/cli.py,sha256=b-vEKyphvA1IpqNkM75xTC2CoRAR5MvfJpNOrzL8ST8,39343
4
- litestar_vite/commands.py,sha256=A2h5a9wdPPfv62P8CtvzJlG1RViTEFaMzEEAogh_Z6Y,2470
5
- litestar_vite/deploy.py,sha256=2scl2WAI7VttUk-PVCSD7BJB3Ryndfpha93BrZUwZ4I,12251
6
- litestar_vite/doctor.py,sha256=_fScfKrwRvfbPtdcuaPAGyGQGl1iUlkDVtRzY6dWzs0,47301
3
+ litestar_vite/cli.py,sha256=3ido1_BmM03OYvrEhHo23lXaxLrr2bDvA79FkAI8LBA,43701
4
+ litestar_vite/codegen.py,sha256=4v_I3wsJOTlSpPxNsM4gxEFRpixK7qI6n-8EGjUTnDg,1331
5
+ litestar_vite/commands.py,sha256=83ZZH5FaXhMwmomjr-4DaCkdEb9c5JFLGvzWpx7hP18,2643
6
+ litestar_vite/config.py,sha256=XkDv254B_INxY7fuXwCfBBwAGda_p2La6WJBo8MaLyo,59327
7
+ litestar_vite/deploy.py,sha256=WuGpnWrrZs6YXBRViYTZujVVN5WPUY-HZl2jo4-Mk7I,11828
8
+ litestar_vite/doctor.py,sha256=lAVgBCXzgNflTgmeeIs0kJOJMne1xG0VAQi9rxmE_Ws,47174
7
9
  litestar_vite/exceptions.py,sha256=9PfOfC1eLxY3ZmMBCxv1NLAbkREMz5BZzpPgVbgYfTA,2651
8
- litestar_vite/executor.py,sha256=sckMrixPullgPm1QnMSlvMzB7MYbD5Yq9CAZRaUxKyg,12536
9
- litestar_vite/html_transform.py,sha256=gZrKAd3s6gEaz7P9nCU-0GFaOo0tj4poKD3T1tzi6UQ,20988
10
- litestar_vite/loader.py,sha256=Z4q7SmI0X-HTIL2HqaKE3SGotBMRIVDFb2MouWB9t2E,18492
10
+ litestar_vite/executor.py,sha256=F9FXtEROztEYdT7nAkJmTgz84SLPwkgsB8KaFp3hm80,10696
11
+ litestar_vite/handler.py,sha256=2yHNyJBkffXA1xp-CsyNEGRiTymCX8To6-jq5OrGo0w,255
12
+ litestar_vite/html_transform.py,sha256=20aY0VsOX5zL9F2g_ba5Q7yRtfTt4Cf4s2XmTVbumFw,14924
13
+ litestar_vite/loader.py,sha256=69LKn3pc7qw5eBlkFA72pDybobwt5KSNkr-GDzk8DfU,18537
14
+ litestar_vite/plugin.py,sha256=iI-k5kq8QRMhMBnrIMY7siCdHdNi3HVd1UKySDtZsio,82594
11
15
  litestar_vite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- litestar_vite/codegen/__init__.py,sha256=606DhmDtOTFD_4ohST1d20oU6NE0cC1_J2tCrXD2qj8,1667
13
- litestar_vite/codegen/_export.py,sha256=lLEHly9YNp-K8GYwI4epxD3L3QIF9oLPuculsuEsDGU,8647
14
- litestar_vite/codegen/_inertia.py,sha256=DceTgMtK7jC5_YZehXgYNtBEZ8oZpL9dYbZCqdiQEAc,24126
15
- litestar_vite/codegen/_openapi.py,sha256=ln8F80gOLt_6b0mfwNcx8sM0hbmG414nCDL5DA6Uc8s,10353
16
- litestar_vite/codegen/_routes.py,sha256=JdKVm_4ur-GTnaeIBqQ2mPMvz7Fn7UWxxWopb1oRZmQ,24955
17
- litestar_vite/codegen/_ts.py,sha256=T0BQyLuE4BIju688o95hnCvqSjCufyRBbijx5cB0xTY,7940
18
- litestar_vite/codegen/_utils.py,sha256=zNPRV0IbgAXSy0MkM4e6iruebyiIJI3BPaisKSs-6HA,4990
19
- litestar_vite/config/__init__.py,sha256=q0WUB1Jb2XUR_Q_Q0jscPJUUtLfdJ7RHWf-_j8Bvr4g,34375
20
- litestar_vite/config/_constants.py,sha256=a1heIM2-2vERJ5NPVZpnSqaaeXOl06YeHODAvs_Ni90,2379
21
- litestar_vite/config/_deploy.py,sha256=USASwxh4WE0N8hRzcPBIqDSF81keznrnxrfff93_hcQ,3103
22
- litestar_vite/config/_inertia.py,sha256=r_8LkvOeORIjfJWh6iJk1hh8ibcwSv7UkzoNeQNLPuA,9177
23
- litestar_vite/config/_paths.py,sha256=TpniHT7kWZ4_O2gY4mXFokHiVsdBWtqXGNPzKdbWCEE,2827
24
- litestar_vite/config/_runtime.py,sha256=fmxAEAS4w19int3-89siihDH3yt591LM_GPYV26yc3k,9840
25
- litestar_vite/config/_spa.py,sha256=tPPl8XM_8-dFtbB8xIHBDcxzieJynVsyMRJv8Ph9Hvc,3330
26
- litestar_vite/config/_types.py,sha256=TuQiGtL-Up4nrGM0zYQskrOgh9kRW0HpHYm-EaNqywM,4199
27
- litestar_vite/handler/__init__.py,sha256=B01DmuRKV6QJMfy_LrLQuFvf8mZ7BE8nDyX0ZQLJLVA,218
28
- litestar_vite/handler/_app.py,sha256=a2hTDgtNatKEr4BlC3yCESweFp4rdboVz6T2XRfZvzM,23783
29
- litestar_vite/handler/_routing.py,sha256=rHO7zsWOtFgQ1-A02BGh-QU3vEvze9MvUGIqPiF8jTs,4540
30
- litestar_vite/inertia/__init__.py,sha256=3u880UBcZwq42bGvpeHZmxsw7LItW1IXeK_CGoan1I0,1893
31
- litestar_vite/inertia/_utils.py,sha256=aSP37Z0VmIHoYoNgne2uPBR8EYtkGHpnggeytklhDj0,3154
32
- litestar_vite/inertia/exception_handler.py,sha256=HLFnl5jSxonCoz4pRRO0ChbtdiBtcDXm9-7cjHDwmDQ,7803
33
- litestar_vite/inertia/helpers.py,sha256=syCOMPthz1kcAVvteUHY1o-_ttwgXSSD6KGKtZbQ8UU,52734
16
+ litestar_vite/_codegen/__init__.py,sha256=vFFcB-o0xoA6SkHgpoAM3Ji5e0gVoGAVPEjNq6Xf_5Y,780
17
+ litestar_vite/_codegen/inertia.py,sha256=pqI8xYGZL0hqFgp8luwn8uwwK3nhhE_b8ISo6PJO11Y,14261
18
+ litestar_vite/_codegen/openapi.py,sha256=Qvema_LiwUSBiOlbAVY-pDp8Mf1N_Y0Lz1WvotpnUDg,8293
19
+ litestar_vite/_codegen/routes.py,sha256=Z_oDyW1pxoQPq2yZZJo3C8rUhQz16DLWsoWK2s6yG5Y,22107
20
+ litestar_vite/_codegen/ts.py,sha256=ry9EvJr3P1yzxFxUwYM5gWTxx38QtyUmpI-Gh7gSneM,7960
21
+ litestar_vite/_handler/__init__.py,sha256=u-c7J29UI0YIFhzVW3w2dnHe2QgIOi36FE4Qcu-FE-w,183
22
+ litestar_vite/_handler/app.py,sha256=rlWWz59gqVlZdnRmUmVvWDYFy5Xm8rwswya21qvLxow,19748
23
+ litestar_vite/_handler/routing.py,sha256=rHO7zsWOtFgQ1-A02BGh-QU3vEvze9MvUGIqPiF8jTs,4540
24
+ litestar_vite/inertia/__init__.py,sha256=6SxGfPufyCo1Mp9ZRCe02XxdlY7i17l3visWklfW6pw,1364
25
+ litestar_vite/inertia/_utils.py,sha256=IkbqtPVyiJ_9k33Ff9ZgRpGz1MnuovzrQdPfD4Yw18k,2948
26
+ litestar_vite/inertia/exception_handler.py,sha256=uRRs_oRwQFByhRoE5Kc0A0lizjERgFktUmVu5aekBw8,7356
27
+ litestar_vite/inertia/helpers.py,sha256=dwbftJW_HofR6uVwm6XUV-7JnZPKRWuplaQD11BejM8,34852
34
28
  litestar_vite/inertia/middleware.py,sha256=GIwOl_KZyI6KAJ2VY4aK_WZiPM1F_LSgdH3yRFgkm1M,1998
35
- litestar_vite/inertia/plugin.py,sha256=5qDdnBcaFs8_wVzzfZa6W9JeZBFIKYvT2sclh-0JsSs,8362
36
- litestar_vite/inertia/precognition.py,sha256=DzeEJUBxKqxY4uxP8hLuj0Xb2c4Bbw5nIyvubZmKRcg,10476
37
- litestar_vite/inertia/request.py,sha256=uASJ0NTrbNlnWSvIrjjHL0HBdLTnKo6dY7aHotCgz-E,10916
38
- litestar_vite/inertia/response.py,sha256=CtMJ2ZyA53wM3nlQgaQ_3BwpWoxMO5teQSMIYs-C53Y,33726
39
- litestar_vite/inertia/types.py,sha256=dwYML3yLVrJ0EZExE4_p00aXvlLtzkuSrkKVLKrcK28,10694
40
- litestar_vite/plugin/__init__.py,sha256=FpnQj_kJ80EdJtea125On5oDzODrNUW69ZaNFSP2huU,26269
41
- litestar_vite/plugin/_process.py,sha256=OV04ft6u22H-arIp0Kwj5b6Z7SccydLk3IyXibZgIq0,7012
42
- litestar_vite/plugin/_proxy.py,sha256=cTgnRB8lfYk1ZzZ_Bubhcpjj_LO5K99Ek0n1gV30Q0w,26574
43
- litestar_vite/plugin/_proxy_headers.py,sha256=gPCFVJkccQYWkw_jjPHfTQHxVfezRW3jK9l8NPZdAOM,9613
44
- litestar_vite/plugin/_static.py,sha256=4Bzn4i8GTHDpaUtG7KcqqbvgW4o10m7BNTKwL1YLJp0,1421
45
- litestar_vite/plugin/_utils.py,sha256=Eh19QtwomASRFJ-ec3UnDAjqBTn3MnfakINWQ9XBifc,16035
29
+ litestar_vite/inertia/plugin.py,sha256=a4tRdiwrXPKXPa5Fv-pJ0oCwcvFibqh0uONLmZu1uNI,5179
30
+ litestar_vite/inertia/request.py,sha256=1UEra90zmP4XeN82wT92hRQ7FBRKOLRBQRoStDNt_iw,9196
31
+ litestar_vite/inertia/response.py,sha256=qeYCuIziiWoQOuxogXAqcAZMKR_zaLBnAk0QXuDIRLY,29771
32
+ litestar_vite/inertia/types.py,sha256=PHDh8b8SuWliTzFjWns9h8551qPzBmYW5hnmPDI6Syg,9902
46
33
  litestar_vite/scaffolding/__init__.py,sha256=3MkLZtAjyZYHh7THWYZF5HFsxXHHT9t3_pcF8zwL07g,652
47
34
  litestar_vite/scaffolding/generator.py,sha256=Y1PPT1-u-ujgaJ4aD43IdcnI_hal75HjsdOINNeCm8w,9172
48
35
  litestar_vite/scaffolding/templates.py,sha256=kX2jNmmddy48YqYQFdcMcWBaAo3IbGzEDcTYAgyVzcs,14371
@@ -50,7 +37,7 @@ litestar_vite/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
50
37
  litestar_vite/templates/addons/tailwindcss/tailwind.css.j2,sha256=QgcOC0W7IBsrg4pSqqpull-WTgtULZfx_lF_5ZxLdag,23
51
38
  litestar_vite/templates/angular/index.html.j2,sha256=lEnI1yFMq2BGK_cxnHwFnhx6rfHbsdFzdid0clsJM1o,319
52
39
  litestar_vite/templates/angular/openapi-ts.config.ts.j2,sha256=bsnHZ9GiNk98_BK1V0G02cNHUHwtbgINzWr0zuu3mHg,400
53
- litestar_vite/templates/angular/package.json.j2,sha256=zMOsRLWYKuAxSMCLb683uCS3oW3QcwBAHlUgFcsElSA,873
40
+ litestar_vite/templates/angular/package.json.j2,sha256=vRzZXTXRD96bFpArIGL4C6OSwCt6J8q2DBv6OoIeAo0,845
54
41
  litestar_vite/templates/angular/tsconfig.app.json.j2,sha256=O1STsrXFeL-TM1z4zv7l38hGK3LgV7wtflN2zfdb_V4,988
55
42
  litestar_vite/templates/angular/tsconfig.json.j2,sha256=aB2V5FFJXYvJWHccnLTcxjYr8aH6Ffxc0dVqOPueBZI,491
56
43
  litestar_vite/templates/angular/vite.config.ts.j2,sha256=7mN399dErmChKLhRDXovHBMuTaagyu6Am8PUoneyhGY,600
@@ -63,7 +50,7 @@ litestar_vite/templates/angular/src/app/app.config.ts.j2,sha256=vSMNCRyDqIIjIHUT
63
50
  litestar_vite/templates/angular-cli/.postcssrc.json.j2,sha256=bJanvszoCUi1KJeoloqBVkTXDb5kcieuYnqcyg7curs,54
64
51
  litestar_vite/templates/angular-cli/angular.json.j2,sha256=XboCBhSihwkpQjbowuUJPqjfbQ3U2tP_3qg9AHnZ5pw,1092
65
52
  litestar_vite/templates/angular-cli/openapi-ts.config.ts.j2,sha256=bsnHZ9GiNk98_BK1V0G02cNHUHwtbgINzWr0zuu3mHg,400
66
- litestar_vite/templates/angular-cli/package.json.j2,sha256=DNvg8m-3jiSfIXHXzMnJ6A8PRXRb2AbOI3Rwy9QAVNY,670
53
+ litestar_vite/templates/angular-cli/package.json.j2,sha256=mxQoc0nJWB2SRIJQ9Y5IzVmCzYRhUN1McXX6c70pdQ0,642
67
54
  litestar_vite/templates/angular-cli/proxy.conf.json.j2,sha256=63K860aZoEizF4BsL-dUjguko0VfsNRdVvjQ3wG1b94,337
68
55
  litestar_vite/templates/angular-cli/tailwind.config.js.j2,sha256=uZ_nSmbT7e4kVeX5IggRM_q10ZLRPaqk0aypUOubdbE,100
69
56
  litestar_vite/templates/angular-cli/tsconfig.app.json.j2,sha256=oNNNykaLX3mVSnzreqTm1HeUyH6O5qKb4mBMBNULJc0,416
@@ -83,7 +70,7 @@ litestar_vite/templates/astro/src/pages/index.astro.j2,sha256=f8zErww-qoLHLxR7g5
83
70
  litestar_vite/templates/astro/src/styles/global.css.j2,sha256=oxYbL_6aNdNc9gc0BKFQdxZ0ZYxbtyiuf7k-1O0KnLA,49
84
71
  litestar_vite/templates/base/.gitignore.j2,sha256=NeAMLX5IAWbNw_HlBma846zKEaQEVbQN-iO9akBuOKk,355
85
72
  litestar_vite/templates/base/openapi-ts.config.ts.j2,sha256=tBS4wDuPZOtxXKiod7ZNi1v93uaATIEdd-UZ6H9TPVE,356
86
- litestar_vite/templates/base/package.json.j2,sha256=FJhhApMQy8UK-CjeaGEzLkWdmSnSq8mXxbYu-TnWP1M,1124
73
+ litestar_vite/templates/base/package.json.j2,sha256=gBvl8oGfSNf8mbLOsadR5gthob2UepReu2qgk9E_bE0,1096
87
74
  litestar_vite/templates/base/tsconfig.json.j2,sha256=oLXhTh1ULIGka2aiTyyTRnRTzXgMyvPekPbBbH23VwU,1069
88
75
  litestar_vite/templates/base/resources/vite-env.d.ts.j2,sha256=ZZlpNvuwQpFfe3SiAPzd5-QQ8ypmmxq5WXz6pLD63bU,38
89
76
  litestar_vite/templates/htmx/vite.config.ts.j2,sha256=BVPMU1VADecUNIRbL2E9-9NLWvekak1aihyyVXr-U6g,865
@@ -101,7 +88,7 @@ litestar_vite/templates/react/src/App.css.j2,sha256=OxIIilAjaaZ9J5bhJ-bybunK6GgE
101
88
  litestar_vite/templates/react/src/App.tsx.j2,sha256=eTMcZCisXmjPDTxlvl9mv0_mVmRaNS4ctfK07NjKgmM,392
102
89
  litestar_vite/templates/react/src/main.tsx.j2,sha256=jn5402e-IPzroxfS25upeLPtvd8aJod_pGHaYUVWKDU,228
103
90
  litestar_vite/templates/react-inertia/index.html.j2,sha256=UI0OvfKMFHwz7KNyLa9lxHGK3Dhrd-L6vtsiEu4PklM,449
104
- litestar_vite/templates/react-inertia/package.json.j2,sha256=W_TQJUW2SwVNFgDrI5WaAYI4sB-bGbiq8Kd3Qtni_I4,1334
91
+ litestar_vite/templates/react-inertia/package.json.j2,sha256=m9Ev8y1Yv-HaN0pEziOopT8R9SxoWnArUciLaQumduo,1306
105
92
  litestar_vite/templates/react-inertia/vite.config.ts.j2,sha256=2CWY1i_U7RcLM-HMCkGeAlDN0doc9UcW-xVPpHzPEzw,1150
106
93
  litestar_vite/templates/react-inertia/resources/App.css.j2,sha256=TPVP6MVH2zEgSR7enDt-AXj4LUnDIoMu7NvLoWC8xAY,1056
107
94
  litestar_vite/templates/react-inertia/resources/main.tsx.j2,sha256=GZsP-KJ42HvI_XOHb7dcOGlhG_6EGZqzmT-45gos-a4,500
@@ -152,13 +139,13 @@ litestar_vite/templates/vue/src/main.ts.j2,sha256=Qaecy31EDctV3TooxqYgVsWbTod9n8
152
139
  litestar_vite/templates/vue/src/style.css.j2,sha256=dynk8iHiXQgZHAnsBxMPxoyewP4P5s5ebliXVC95xVw,872
153
140
  litestar_vite/templates/vue-inertia/env.d.ts.j2,sha256=FEzWdKE_58QVLmJj7EhACflloL4h4hxr9qCr6z8xjLU,189
154
141
  litestar_vite/templates/vue-inertia/index.html.j2,sha256=kEucsfi-lVPR151vAhjxyC6rdrU2-2VhegTqmK2Ptjs,448
155
- litestar_vite/templates/vue-inertia/package.json.j2,sha256=FK-cG8ZCmYXFfvakGxkdxB_wrV8bBaY3yDw-rYksjjw,1471
142
+ litestar_vite/templates/vue-inertia/package.json.j2,sha256=Th3npE3RMLob-eOvAkaA6wgurdbNWfAUB382TzRkqoo,1443
156
143
  litestar_vite/templates/vue-inertia/vite.config.ts.j2,sha256=vWK9Ur43tY3c_g_9RPMvzRt1_pgiFU-7seYLMaoiBXY,1142
157
144
  litestar_vite/templates/vue-inertia/resources/main.ts.j2,sha256=6wi8R1QXY_fS1WDCgup1vaDtXSswtgYY-tWWzEVIumE,526
158
145
  litestar_vite/templates/vue-inertia/resources/ssr.ts.j2,sha256=ptxNGMv8mBDVLYzozpTZWfp2vYXLM_OmfXRDjbJD8l0,686
159
146
  litestar_vite/templates/vue-inertia/resources/style.css.j2,sha256=iGKzknt04zJ29-zIdThkszGnTQe-C2pdyt6zAT_3rdE,462
160
147
  litestar_vite/templates/vue-inertia/resources/pages/Home.vue.j2,sha256=wcTvXgjQZ9CxQ6aTWp95w6YS6pE1RD-BITy1lJtBmrU,702
161
- litestar_vite-0.15.0.dist-info/METADATA,sha256=TRaiAryEAoGS9ODyqiEJn6ZF_eMBVqLTQvKDabO58D8,7674
162
- litestar_vite-0.15.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
163
- litestar_vite-0.15.0.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
164
- litestar_vite-0.15.0.dist-info/RECORD,,
148
+ litestar_vite-0.15.0rc2.dist-info/METADATA,sha256=JbvMynREO35tXobLELCOq5GzM6VkR9xXFfVVjcbmNuA,7709
149
+ litestar_vite-0.15.0rc2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
150
+ litestar_vite-0.15.0rc2.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
151
+ litestar_vite-0.15.0rc2.dist-info/RECORD,,
@@ -1,48 +0,0 @@
1
- """Public code generation API.
2
-
3
- This package provides code generation utilities for:
4
-
5
- - Unified asset export (``export_integration_assets``)
6
- - Route metadata export (``routes.json`` + Ziggy-compatible TS)
7
- - Inertia page props metadata export
8
-
9
- Internal implementation details (OpenAPI integration, TypeScript conversion)
10
- are kept in private submodules to keep the public API clean.
11
- """
12
-
13
- from litestar_vite.codegen._export import ExportResult, export_integration_assets
14
- from litestar_vite.codegen._inertia import (
15
- InertiaPageMetadata,
16
- extract_inertia_pages,
17
- generate_inertia_pages_json,
18
- get_openapi_schema_ref, # pyright: ignore[reportUnusedImport]
19
- get_return_type_name, # pyright: ignore[reportUnusedImport]
20
- )
21
- from litestar_vite.codegen._routes import (
22
- RouteMetadata,
23
- escape_ts_string, # pyright: ignore[reportUnusedImport]
24
- extract_route_metadata,
25
- generate_routes_json,
26
- generate_routes_ts,
27
- is_type_required, # pyright: ignore[reportUnusedImport]
28
- ts_type_for_param, # pyright: ignore[reportUnusedImport]
29
- )
30
- from litestar_vite.codegen._ts import (
31
- ts_type_from_openapi as _ts_type_from_openapi, # pyright: ignore[reportUnusedImport]
32
- )
33
- from litestar_vite.codegen._utils import encode_deterministic_json, strip_timestamp_for_comparison, write_if_changed
34
-
35
- __all__ = (
36
- "ExportResult",
37
- "InertiaPageMetadata",
38
- "RouteMetadata",
39
- "encode_deterministic_json",
40
- "export_integration_assets",
41
- "extract_inertia_pages",
42
- "extract_route_metadata",
43
- "generate_inertia_pages_json",
44
- "generate_routes_json",
45
- "generate_routes_ts",
46
- "strip_timestamp_for_comparison",
47
- "write_if_changed",
48
- )
@@ -1,229 +0,0 @@
1
- """Unified asset export pipeline for deterministic code generation.
2
-
3
- This module provides a single entry point for exporting all integration artifacts:
4
- - openapi.json (OpenAPI schema with Inertia types registered)
5
- - routes.json (route metadata)
6
- - routes.ts (Ziggy-style typed routes)
7
- - inertia-pages.json (Inertia page props metadata)
8
-
9
- Both CLI and Plugin should call this function to guarantee byte-identical output.
10
- """
11
-
12
- from dataclasses import dataclass, field
13
- from functools import partial
14
- from pathlib import Path
15
- from typing import TYPE_CHECKING, Any
16
-
17
- if TYPE_CHECKING:
18
- from collections.abc import Callable
19
-
20
- from litestar import Litestar
21
-
22
- from litestar_vite.config import TypeGenConfig, ViteConfig
23
-
24
-
25
- @dataclass
26
- class ExportResult:
27
- """Result of the export operation."""
28
-
29
- exported_files: list[str] = field(default_factory=list) # pyright: ignore[reportUnknownVariableType]
30
- """Files that were written (content changed)."""
31
-
32
- unchanged_files: list[str] = field(default_factory=list) # pyright: ignore[reportUnknownVariableType]
33
- """Files that were skipped (content unchanged)."""
34
-
35
- openapi_schema: "dict[str, Any] | None" = None
36
- """The OpenAPI schema dict (for downstream use)."""
37
-
38
-
39
- def fmt_path(path: Path) -> str:
40
- """Format path for display, using relative path when possible.
41
-
42
- Returns:
43
- The result.
44
- """
45
- try:
46
- return str(path.relative_to(Path.cwd()))
47
- except ValueError:
48
- return str(path)
49
-
50
-
51
- def export_integration_assets(
52
- app: "Litestar", config: "ViteConfig", *, serializer: "Callable[[Any], bytes] | None" = None
53
- ) -> ExportResult:
54
- """Export all integration artifacts with deterministic output.
55
-
56
- This is the single source of truth for code generation. Both CLI commands
57
- and Plugin startup should call this function to ensure byte-identical output.
58
-
59
- The export order is critical:
60
- 1. Register Inertia page prop types in OpenAPI schema (mutates schema_dict)
61
- 2. Export openapi.json (now includes session prop types)
62
- 3. Export routes.json (uses schema for component refs)
63
- 4. Export routes.ts (if enabled)
64
- 5. Export inertia-pages.json (if enabled)
65
-
66
- Args:
67
- app: The Litestar application instance.
68
- config: The ViteConfig instance.
69
- serializer: Optional custom serializer for OpenAPI schema encoding.
70
-
71
- Returns:
72
- ExportResult with lists of exported and unchanged files.
73
- """
74
- from litestar._openapi.plugin import OpenAPIPlugin
75
- from litestar.serialization import encode_json, get_serializer
76
-
77
- from litestar_vite.codegen._inertia import generate_inertia_pages_json
78
- from litestar_vite.config import InertiaConfig, InertiaTypeGenConfig, TypeGenConfig
79
-
80
- result = ExportResult()
81
-
82
- if not isinstance(config.types, TypeGenConfig):
83
- return result
84
-
85
- types_config = config.types
86
-
87
- # Check if OpenAPI is available
88
- openapi_plugin = next((p for p in app.plugins._plugins if isinstance(p, OpenAPIPlugin)), None) # pyright: ignore[reportPrivateUsage]
89
- has_openapi = openapi_plugin is not None and openapi_plugin._openapi_config is not None # pyright: ignore[reportPrivateUsage]
90
-
91
- if not has_openapi:
92
- return result
93
-
94
- # Get serializer for OpenAPI encoding
95
- if serializer is None:
96
- encoders: Any
97
- try:
98
- encoders = app.type_encoders # pyright: ignore[reportUnknownMemberType]
99
- except AttributeError:
100
- encoders = None
101
- serializer = partial(encode_json, serializer=get_serializer(encoders if isinstance(encoders, dict) else None)) # pyright: ignore[reportUnknownArgumentType]
102
-
103
- # Step 1: Get OpenAPI schema and register Inertia types
104
- schema_dict = app.openapi_schema.to_schema()
105
-
106
- # Register Inertia page prop types in OpenAPI schema BEFORE exporting
107
- # This ensures types like EmailSent, NoProps, CurrentTeam are included
108
- inertia_pages_data: dict[str, Any] | None = None
109
- if isinstance(config.inertia, InertiaConfig) and types_config.generate_page_props:
110
- inertia_type_gen = config.inertia.type_gen or InertiaTypeGenConfig()
111
- inertia_pages_data = generate_inertia_pages_json(
112
- app,
113
- openapi_schema=schema_dict,
114
- include_default_auth=inertia_type_gen.include_default_auth,
115
- include_default_flash=inertia_type_gen.include_default_flash,
116
- inertia_config=config.inertia,
117
- types_config=types_config,
118
- )
119
-
120
- result.openapi_schema = schema_dict
121
-
122
- # Step 2: Export openapi.json
123
- export_openapi(schema_dict=schema_dict, types_config=types_config, serializer=serializer, result=result)
124
-
125
- # Step 3: Export routes.json (always pass openapi_schema for consistency)
126
- export_routes_json(app=app, types_config=types_config, openapi_schema=schema_dict, result=result)
127
-
128
- # Step 4: Export routes.ts (if enabled)
129
- if types_config.generate_routes:
130
- export_routes_ts(app=app, types_config=types_config, openapi_schema=schema_dict, result=result)
131
-
132
- # Step 5: Export inertia-pages.json (if enabled)
133
- if (
134
- isinstance(config.inertia, InertiaConfig)
135
- and types_config.generate_page_props
136
- and types_config.page_props_path
137
- and inertia_pages_data is not None
138
- ):
139
- export_inertia_pages(pages_data=inertia_pages_data, types_config=types_config, result=result)
140
-
141
- return result
142
-
143
-
144
- def export_openapi(
145
- *,
146
- schema_dict: "dict[str, Any]",
147
- types_config: "TypeGenConfig",
148
- serializer: "Callable[[Any], bytes]",
149
- result: ExportResult,
150
- ) -> None:
151
- """Export OpenAPI schema to file."""
152
- from litestar_vite.codegen._utils import encode_deterministic_json, write_if_changed
153
-
154
- openapi_path = types_config.openapi_path
155
- if openapi_path is None:
156
- openapi_path = types_config.output / "openapi.json"
157
-
158
- schema_content = encode_deterministic_json(schema_dict, serializer=serializer)
159
-
160
- if write_if_changed(openapi_path, schema_content):
161
- result.exported_files.append(f"openapi: {fmt_path(openapi_path)}")
162
- else:
163
- result.unchanged_files.append("openapi.json")
164
-
165
-
166
- def export_routes_json(
167
- *, app: "Litestar", types_config: "TypeGenConfig", openapi_schema: "dict[str, Any]", result: ExportResult
168
- ) -> None:
169
- """Export routes metadata to JSON file."""
170
- from litestar_vite.codegen._routes import generate_routes_json
171
- from litestar_vite.codegen._utils import encode_deterministic_json, write_if_changed
172
-
173
- try:
174
- from litestar import __version__ as _version
175
-
176
- litestar_version = str(_version)
177
- except ImportError:
178
- litestar_version = "unknown"
179
-
180
- routes_path = types_config.routes_path
181
- if routes_path is None:
182
- routes_path = types_config.output / "routes.json"
183
-
184
- # Always pass openapi_schema for consistent output between CLI and plugin
185
- routes_data = generate_routes_json(app, include_components=True, openapi_schema=openapi_schema)
186
- routes_data["litestar_version"] = litestar_version
187
-
188
- routes_content = encode_deterministic_json(routes_data)
189
-
190
- if write_if_changed(routes_path, routes_content):
191
- result.exported_files.append(fmt_path(routes_path))
192
- else:
193
- result.unchanged_files.append("routes.json")
194
-
195
-
196
- def export_routes_ts(
197
- *, app: "Litestar", types_config: "TypeGenConfig", openapi_schema: "dict[str, Any]", result: ExportResult
198
- ) -> None:
199
- """Export typed routes TypeScript file."""
200
- from litestar_vite.codegen._routes import generate_routes_ts
201
- from litestar_vite.codegen._utils import write_if_changed
202
-
203
- routes_ts_path = types_config.routes_ts_path
204
- if routes_ts_path is None:
205
- routes_ts_path = types_config.output / "routes.ts"
206
-
207
- # Always pass openapi_schema for consistent output
208
- routes_ts_content = generate_routes_ts(app, openapi_schema=openapi_schema, global_route=types_config.global_route)
209
-
210
- if write_if_changed(routes_ts_path, routes_ts_content):
211
- result.exported_files.append(fmt_path(routes_ts_path))
212
- else:
213
- result.unchanged_files.append("routes.ts")
214
-
215
-
216
- def export_inertia_pages(*, pages_data: "dict[str, Any]", types_config: "TypeGenConfig", result: ExportResult) -> None:
217
- """Export Inertia pages metadata to JSON file."""
218
- from litestar_vite.codegen._utils import encode_deterministic_json, write_if_changed
219
-
220
- page_props_path = types_config.page_props_path
221
- if page_props_path is None:
222
- return
223
-
224
- pages_content = encode_deterministic_json(pages_data)
225
-
226
- if write_if_changed(page_props_path, pages_content):
227
- result.exported_files.append(fmt_path(page_props_path))
228
- else:
229
- result.unchanged_files.append("inertia-pages.json")