litestar-vite-plugin 0.24.0 → 0.25.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 +6 -6
- package/dist/js/astro.js +7 -8
- package/dist/js/dev-server-index.html +2 -2
- package/dist/js/index.js +20 -16
- package/dist/js/nuxt.js +5 -3
- package/dist/js/shared/vite-compat.d.ts +23 -15
- package/dist/js/shared/vite-compat.js +12 -6
- package/dist/js/sveltekit.js +7 -8
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -43,12 +43,12 @@ litestar run --reload
|
|
|
43
43
|
|
|
44
44
|
## Documentation
|
|
45
45
|
|
|
46
|
-
- **[Usage Guide](https://litestar-org.github.io/litestar-vite/
|
|
47
|
-
- **[Inertia](https://litestar-org.github.io/litestar-vite/
|
|
48
|
-
- **[Frameworks](https://litestar-org.github.io/litestar-vite/
|
|
49
|
-
- **[Reference](https://litestar-org.github.io/litestar-vite/
|
|
46
|
+
- **[Usage Guide](https://litestar-org.github.io/litestar-vite/usage/index.html)**: Core concepts, configuration, and type generation.
|
|
47
|
+
- **[Inertia](https://litestar-org.github.io/litestar-vite/frameworks/inertia/index.html)**: Fullstack protocols and SSR.
|
|
48
|
+
- **[Frameworks](https://litestar-org.github.io/litestar-vite/frameworks/index.html)**: Guides for React, Vue, Svelte, Angular, Astro, and Nuxt.
|
|
49
|
+
- **[Reference](https://litestar-org.github.io/litestar-vite/reference/index.html)**: API and CLI documentation.
|
|
50
50
|
|
|
51
|
-
For a full list of changes, see the [Changelog](https://litestar-org.github.io/litestar-vite/
|
|
51
|
+
For a full list of changes, see the [Changelog](https://litestar-org.github.io/litestar-vite/changelog.html).
|
|
52
52
|
|
|
53
53
|
## Common Commands
|
|
54
54
|
|
|
@@ -76,7 +76,7 @@ litestar-vite now defaults Inertia apps to script-element bootstrap. Inertia v3
|
|
|
76
76
|
|
|
77
77
|
## Links
|
|
78
78
|
|
|
79
|
-
- Docs: <https://litestar-org.github.io/litestar-vite
|
|
79
|
+
- Docs: <https://litestar-org.github.io/litestar-vite/>
|
|
80
80
|
- Examples: `examples/` (React, Vue, Svelte, HTMX, Inertia, Astro, Nuxt, SvelteKit, Angular)
|
|
81
81
|
- Real-world example: [litestar-fullstack](https://github.com/litestar-org/litestar-fullstack)
|
|
82
82
|
- Issues: <https://github.com/litestar-org/litestar-vite/issues/>
|
package/dist/js/astro.js
CHANGED
|
@@ -4,6 +4,7 @@ import { readBridgeConfig } from "./shared/bridge-schema.js";
|
|
|
4
4
|
import { DEBOUNCE_MS } from "./shared/constants.js";
|
|
5
5
|
import { normalizeHost, resolveHotFilePath, resolveLitestarPort } from "./shared/network.js";
|
|
6
6
|
import { createLitestarTypeGenPlugin } from "./shared/typegen-plugin.js";
|
|
7
|
+
import { hmrServerConfig } from "./shared/vite-compat.js";
|
|
7
8
|
function resolveConfig(config = {}) {
|
|
8
9
|
let hotFile;
|
|
9
10
|
let proxyMode = "vite";
|
|
@@ -136,14 +137,12 @@ function createProxyPlugin(config) {
|
|
|
136
137
|
strictPort: true
|
|
137
138
|
} : {},
|
|
138
139
|
// Route HMR through the Litestar port so DevTools never sees the framework port.
|
|
139
|
-
...config.litestarPort !== void 0 ? {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
} : {},
|
|
140
|
+
...config.litestarPort !== void 0 ? hmrServerConfig({
|
|
141
|
+
protocol: "ws",
|
|
142
|
+
host: "127.0.0.1",
|
|
143
|
+
clientPort: config.litestarPort,
|
|
144
|
+
path: hmrPath
|
|
145
|
+
}) : {},
|
|
147
146
|
proxy: {
|
|
148
147
|
[config.apiPrefix]: {
|
|
149
148
|
target: config.apiProxy,
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
9
9
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" />
|
|
10
|
-
<style rel="stylesheet" crossorigin>/*! tailwindcss v4.3.
|
|
11
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-duration:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}@layer theme{:root,:host{--font-sans:"Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;--font-mono:"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--spacing:.25rem;--container-lg:32rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--font-weight-light:300;--font-weight-medium:500;--font-weight-semibold:600;--tracking-widest:.1em;--leading-relaxed:1.625;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-navy:#202235;--color-navy-surface:#2a2d40;--color-navy-surface-variant:#1a1c2e;--color-gold:#edb641;--color-gold-light:#ffd480;--color-on-surface:#f8fafc;--color-on-surface-muted:#cbd5e1;--color-on-surface-subtle:#94a3b8;--color-outline:#334155;--color-success:#4ade80;--radius-brand:8px;--radius-brand-lg:12px;--shadow-text-glow-dark:0 0 24px #edb64138}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.mt-8{margin-top:calc(var(--spacing) * 8)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.mb-12{margin-bottom:calc(var(--spacing) * 12)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.inline{display:inline}.inline-flex{display:inline-flex}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-auto{width:auto}.w-full{width:100%}.max-w-lg{max-width:var(--container-lg)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.flex-none{flex:none}.animate-pulse-dot{animation:2s ease-in-out infinite pulse-dot}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.rounded-brand{border-radius:var(--radius-brand)}.rounded-brand-lg{border-radius:var(--radius-brand-lg)}.rounded-full{border-radius:3.40282e38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-\[3px\]{border-left-style:var(--tw-border-style);border-left-width:3px}.border-outline{border-color:var(--color-outline)}.border-l-gold{border-left-color:var(--color-gold)}.bg-navy-surface{background-color:var(--color-navy-surface)}.bg-navy-surface-variant{background-color:var(--color-navy-surface-variant)}.bg-success{background-color:var(--color-success)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-16{padding-block:calc(var(--spacing) * 16)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-all{word-break:break-all}.text-gold{color:var(--color-gold)}.text-on-surface{color:var(--color-on-surface)}.text-on-surface-muted{color:var(--color-on-surface-muted)}.text-on-surface-subtle{color:var(--color-on-surface-subtle)}.uppercase{text-transform:uppercase}.opacity-60{opacity:.6}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.select-all{-webkit-user-select:all;user-select:all}.text-brand-glow{text-shadow:var(--shadow-text-glow-dark)}@media (hover:hover){.group-hover\:translate-x-0\.5:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\:bg-navy:hover{background-color:var(--color-navy)}.hover\:text-gold:hover{color:var(--color-gold)}.hover\:text-gold-light:hover{color:var(--color-gold-light)}.hover\:opacity-80:hover{opacity:.8}}@media (width>=40rem){.sm\:px-10{padding-inline:calc(var(--spacing) * 10)}.sm\:py-10{padding-block:calc(var(--spacing) * 10)}.sm\:text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}}}html{font-family:var(--font-sans);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{background-color:var(--color-navy);color:var(--color-on-surface-muted);background-image:radial-gradient(#f8fafc0a 1px,#0000 1px);background-size:24px 24px}@keyframes pulse-dot{0%,to{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.92)}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}
|
|
10
|
+
<style rel="stylesheet" crossorigin>/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */
|
|
11
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-duration:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}@layer theme{:root,:host{--font-sans:"Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;--font-mono:"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--spacing:.25rem;--container-lg:32rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--font-weight-light:300;--font-weight-medium:500;--font-weight-semibold:600;--tracking-widest:.1em;--leading-relaxed:1.625;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-navy:#202235;--color-navy-surface:#2a2d40;--color-navy-surface-variant:#1a1c2e;--color-gold:#edb641;--color-gold-light:#ffd480;--color-on-surface:#f8fafc;--color-on-surface-muted:#cbd5e1;--color-on-surface-subtle:#94a3b8;--color-outline:#334155;--color-success:#4ade80;--radius-brand:8px;--radius-brand-lg:12px;--shadow-text-glow-dark:0 0 24px #edb64138}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.mt-8{margin-top:calc(var(--spacing) * 8)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.mb-12{margin-bottom:calc(var(--spacing) * 12)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.inline{display:inline}.inline-flex{display:inline-flex}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-auto{width:auto}.w-full{width:100%}.max-w-lg{max-width:var(--container-lg)}.min-w-0{min-width:0}.flex-1{flex:1}.flex-none{flex:none}.animate-pulse-dot{animation:2s ease-in-out infinite pulse-dot}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.rounded-brand{border-radius:var(--radius-brand)}.rounded-brand-lg{border-radius:var(--radius-brand-lg)}.rounded-full{border-radius:3.40282e38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-\[3px\]{border-left-style:var(--tw-border-style);border-left-width:3px}.border-outline{border-color:var(--color-outline)}.border-l-gold{border-left-color:var(--color-gold)}.bg-navy-surface{background-color:var(--color-navy-surface)}.bg-navy-surface-variant{background-color:var(--color-navy-surface-variant)}.bg-success{background-color:var(--color-success)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-16{padding-block:calc(var(--spacing) * 16)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-all{word-break:break-all}.text-gold{color:var(--color-gold)}.text-on-surface{color:var(--color-on-surface)}.text-on-surface-muted{color:var(--color-on-surface-muted)}.text-on-surface-subtle{color:var(--color-on-surface-subtle)}.uppercase{text-transform:uppercase}.opacity-60{opacity:.6}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.select-all{-webkit-user-select:all;user-select:all}.text-brand-glow{text-shadow:var(--shadow-text-glow-dark)}@media (hover:hover){.group-hover\:translate-x-0\.5:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\:bg-navy:hover{background-color:var(--color-navy)}.hover\:text-gold:hover{color:var(--color-gold)}.hover\:text-gold-light:hover{color:var(--color-gold-light)}.hover\:opacity-80:hover{opacity:.8}}@media (width>=40rem){.sm\:px-10{padding-inline:calc(var(--spacing) * 10)}.sm\:py-10{padding-block:calc(var(--spacing) * 10)}.sm\:text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}}}html{font-family:var(--font-sans);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{background-color:var(--color-navy);color:var(--color-on-surface-muted);background-image:radial-gradient(#f8fafc0a 1px,#0000 1px);background-size:24px 24px}@keyframes pulse-dot{0%,to{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.92)}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}
|
|
12
12
|
/*$vite$:1*/</style>
|
|
13
13
|
</head>
|
|
14
14
|
<body class="flex min-h-screen items-center justify-center px-6 py-16">
|
package/dist/js/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { createLogger } from "./shared/logger.js";
|
|
|
11
11
|
import { resolveLitestarPort } from "./shared/network.js";
|
|
12
12
|
import { resolveDefaultSdkClientPlugin } from "./shared/typegen-core.js";
|
|
13
13
|
import { createLitestarTypeGenPlugin } from "./shared/typegen-plugin.js";
|
|
14
|
-
import { buildInputOptions, resolveUserBuildInput } from "./shared/vite-compat.js";
|
|
14
|
+
import { buildInputOptions, hmrServerConfig, resolveUserBuildInput } from "./shared/vite-compat.js";
|
|
15
15
|
let exitHandlersBound = false;
|
|
16
16
|
let warnedMissingRuntimeConfig = false;
|
|
17
17
|
const MAX_TRANSFORM_PAYLOAD_BYTES = 1e6;
|
|
@@ -139,15 +139,19 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
139
139
|
},
|
|
140
140
|
server: {
|
|
141
141
|
origin: shouldForceDirectServerOrigin ? explicitServerOrigin ?? "__litestar_vite_placeholder__" : proxyOriginDefault,
|
|
142
|
-
// Auto-configure HMR to use a path that routes through Litestar proxy
|
|
143
|
-
//
|
|
144
|
-
//
|
|
145
|
-
|
|
142
|
+
// Auto-configure the HMR WebSocket to use a path that routes through the Litestar proxy.
|
|
143
|
+
// Auto-configure the HMR WebSocket to route through the Litestar proxy.
|
|
144
|
+
// Vite 8.1 moved the HMR network options (path/host/port/clientPort/protocol/timeout)
|
|
145
|
+
// from `server.hmr.*` to `server.ws.*`; on Vite 7 / 8.0 they stay under `server.hmr.*`.
|
|
146
|
+
// `hmrServerConfig` picks the right key for the running version (deprecation-free on each).
|
|
147
|
+
// Note: Vite prepends `base` to the path, so we use "vite-hmr" => "/static/vite-hmr".
|
|
148
|
+
...userConfig.server?.hmr === false || userConfig.server?.ws === false ? { hmr: false } : hmrServerConfig({
|
|
146
149
|
path: "vite-hmr",
|
|
147
150
|
...proxyHmrClientPort ? { clientPort: proxyHmrClientPort } : {},
|
|
148
|
-
...serverConfig?.
|
|
149
|
-
...userConfig.server?.
|
|
150
|
-
|
|
151
|
+
...serverConfig?.host ? { host: serverConfig.host } : {},
|
|
152
|
+
...typeof userConfig.server?.ws === "object" ? userConfig.server.ws : {},
|
|
153
|
+
...typeof userConfig.server?.hmr === "object" ? userConfig.server.hmr : {}
|
|
154
|
+
}),
|
|
151
155
|
// Auto-configure proxy to forward API requests to Litestar backend
|
|
152
156
|
// This allows the app to work when accessing Vite directly (not through Litestar proxy)
|
|
153
157
|
// Only proxies /api and /schema routes - everything else is handled by Vite
|
|
@@ -793,23 +797,25 @@ function createStaticPropsPlugin() {
|
|
|
793
797
|
};
|
|
794
798
|
}
|
|
795
799
|
function resolveDevServerUrl(address, config, userConfig) {
|
|
796
|
-
const
|
|
797
|
-
const
|
|
800
|
+
const configHmrNet = (typeof config.server.ws === "object" ? config.server.ws : null) ?? (typeof config.server.hmr === "object" ? config.server.hmr : null);
|
|
801
|
+
const configWsProtocol = configHmrNet?.protocol ?? null;
|
|
802
|
+
const clientProtocol = configWsProtocol ? configWsProtocol === "wss" ? "https" : "http" : null;
|
|
798
803
|
const serverProtocol = config.server.https ? "https" : "http";
|
|
799
804
|
const protocol = clientProtocol ?? serverProtocol;
|
|
800
|
-
const
|
|
805
|
+
const configWsHost = configHmrNet?.host ?? null;
|
|
801
806
|
const userHost = typeof userConfig.server?.host === "string" ? userConfig.server.host : null;
|
|
802
807
|
const configHost = typeof config.server.host === "string" ? config.server.host : null;
|
|
803
808
|
const remoteHost = process.env.VITE_ALLOW_REMOTE && !userConfig.server?.host ? isIpv6(address) ? "[::1]" : "127.0.0.1" : null;
|
|
804
809
|
const serverAddress = isIpv6(address) ? `[${address.address}]` : address.address;
|
|
805
|
-
let host =
|
|
810
|
+
let host = configWsHost ?? userHost ?? remoteHost ?? configHost ?? serverAddress;
|
|
806
811
|
if (host === "0.0.0.0") {
|
|
807
812
|
host = "127.0.0.1";
|
|
808
813
|
} else if (host === "::" || host === "[::]") {
|
|
809
814
|
host = "[::1]";
|
|
810
815
|
}
|
|
811
|
-
const
|
|
812
|
-
const
|
|
816
|
+
const userHmrNet = (typeof userConfig.server?.ws === "object" ? userConfig.server.ws : null) ?? (typeof userConfig.server?.hmr === "object" ? userConfig.server.hmr : null);
|
|
817
|
+
const userWsClientPort = userHmrNet?.clientPort ?? null;
|
|
818
|
+
const port = userWsClientPort ?? address.port;
|
|
813
819
|
return `${protocol}://${host}:${port}`;
|
|
814
820
|
}
|
|
815
821
|
function isIpv6(address) {
|
|
@@ -844,7 +850,6 @@ function resolveEnvironmentServerConfig(env) {
|
|
|
844
850
|
throw Error(`Unable to determine the host from the environment's APP_URL: [${env.APP_URL}].`);
|
|
845
851
|
}
|
|
846
852
|
return {
|
|
847
|
-
hmr: { host },
|
|
848
853
|
host,
|
|
849
854
|
https: {
|
|
850
855
|
key: fs.readFileSync(env.VITE_DEV_SERVER_KEY),
|
|
@@ -877,7 +882,6 @@ function resolveDevelopmentEnvironmentServerConfig(host) {
|
|
|
877
882
|
throw Error(`Unable to find certificate files for your host [${host}] in the [${configPath}/certs] directory.`);
|
|
878
883
|
}
|
|
879
884
|
return {
|
|
880
|
-
hmr: { host: resolvedHost },
|
|
881
885
|
host: resolvedHost,
|
|
882
886
|
https: {
|
|
883
887
|
key: keyPath,
|
package/dist/js/nuxt.js
CHANGED
|
@@ -5,6 +5,7 @@ import { readBridgeConfig } from "./shared/bridge-schema.js";
|
|
|
5
5
|
import { DEBOUNCE_MS } from "./shared/constants.js";
|
|
6
6
|
import { normalizeHost, resolveHotFilePath, resolveLitestarPort } from "./shared/network.js";
|
|
7
7
|
import { createLitestarTypeGenPlugin } from "./shared/typegen-plugin.js";
|
|
8
|
+
import { hmrServerConfig } from "./shared/vite-compat.js";
|
|
8
9
|
function resolveConfig(config = {}) {
|
|
9
10
|
let hotFile;
|
|
10
11
|
let proxyMode = "vite";
|
|
@@ -154,13 +155,14 @@ function createProxyPlugin(config) {
|
|
|
154
155
|
strictPort: true
|
|
155
156
|
} : {},
|
|
156
157
|
// Vite serves HMR on a separate internal port; browsers reach it through
|
|
157
|
-
// Litestar's /static/vite-hmr WebSocket handler.
|
|
158
|
-
hmr
|
|
158
|
+
// Litestar's /static/vite-hmr WebSocket handler. Vite 8.1 moved these network
|
|
159
|
+
// options from server.hmr.* to server.ws.*; hmrServerConfig picks the right key.
|
|
160
|
+
...hmrServerConfig({
|
|
159
161
|
port: hmrPort,
|
|
160
162
|
host: "127.0.0.1",
|
|
161
163
|
...browserHmrPort !== void 0 ? { clientPort: browserHmrPort } : {},
|
|
162
164
|
...config.litestarPort !== void 0 ? { path: hmrPath, protocol: "ws" } : {}
|
|
163
|
-
}
|
|
165
|
+
})
|
|
164
166
|
}
|
|
165
167
|
};
|
|
166
168
|
},
|
|
@@ -1,28 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parsed major version of the running Vite instance.
|
|
3
|
-
*/
|
|
1
|
+
/** Parsed major version of the running Vite instance. */
|
|
4
2
|
export declare const viteMajor: number;
|
|
3
|
+
/** Parsed minor version of the running Vite instance. */
|
|
4
|
+
export declare const viteMinor: number;
|
|
5
5
|
/**
|
|
6
|
-
* Whether the running Vite version is 8+, which uses Rolldown
|
|
7
|
-
*
|
|
8
|
-
* in place of the deprecated `rollupOptions` / `esbuildOptions`.
|
|
6
|
+
* Whether the running Vite version is 8+, which uses Rolldown and exposes
|
|
7
|
+
* `build.rolldownOptions` in place of Vite 7's `build.rollupOptions`.
|
|
9
8
|
*/
|
|
10
9
|
export declare const isVite8Plus: boolean;
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
* Whether the running Vite version is 8.1+, which moved the HMR network options
|
|
12
|
+
* (`host`/`protocol`/`port`/`clientPort`/`path`/`timeout`) from `server.hmr.*`
|
|
13
|
+
* to `server.ws.*`. On 8.1+ `server.hmr` only carries the enable/disable toggle.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isVite81Plus: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a `build` config fragment with the input placed under the bundler key
|
|
18
|
+
* for the running Vite version (`rolldownOptions` on 8+, `rollupOptions` on 7).
|
|
17
19
|
*/
|
|
18
20
|
export declare function buildInputOptions(input: string | string[] | undefined): Record<string, unknown>;
|
|
19
21
|
/**
|
|
20
|
-
* Reads the user-provided
|
|
21
|
-
*
|
|
22
|
+
* Reads the user-provided build input, preferring the version-appropriate key
|
|
23
|
+
* and falling back to the other so configs migrated across a Vite major still work.
|
|
22
24
|
*/
|
|
23
25
|
export declare function resolveUserBuildInput(userBuild: Record<string, any> | undefined): string | string[] | undefined;
|
|
24
26
|
/**
|
|
25
|
-
* Returns a `build` config fragment with arbitrary options placed under
|
|
26
|
-
*
|
|
27
|
+
* Returns a `build` config fragment with arbitrary options placed under the
|
|
28
|
+
* bundler key for the running Vite version.
|
|
27
29
|
*/
|
|
28
30
|
export declare function buildBundlerOptions(options: Record<string, unknown>): Record<string, unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Wraps HMR network options under the correct server key for the running Vite
|
|
33
|
+
* version: `server.ws` on 8.1+, `server.hmr` on 8.0 / 7. Lets the plugin and
|
|
34
|
+
* integrations emit one shape that is deprecation-free on every supported Vite.
|
|
35
|
+
*/
|
|
36
|
+
export declare function hmrServerConfig(network: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { version } from "vite";
|
|
2
|
-
const
|
|
2
|
+
const [viteMajorRaw, viteMinorRaw] = version.split(".");
|
|
3
|
+
const viteMajor = Number(viteMajorRaw);
|
|
4
|
+
const viteMinor = Number(viteMinorRaw);
|
|
3
5
|
const isVite8Plus = viteMajor >= 8;
|
|
6
|
+
const isVite81Plus = viteMajor > 8 || viteMajor === 8 && viteMinor >= 1;
|
|
4
7
|
function buildInputOptions(input) {
|
|
5
8
|
if (input === void 0) return {};
|
|
6
9
|
const key = isVite8Plus ? "rolldownOptions" : "rollupOptions";
|
|
@@ -8,19 +11,22 @@ function buildInputOptions(input) {
|
|
|
8
11
|
}
|
|
9
12
|
function resolveUserBuildInput(userBuild) {
|
|
10
13
|
if (!userBuild) return void 0;
|
|
11
|
-
|
|
12
|
-
return userBuild.rolldownOptions?.input ?? userBuild.rollupOptions?.input;
|
|
13
|
-
}
|
|
14
|
-
return userBuild.rollupOptions?.input ?? userBuild.rolldownOptions?.input;
|
|
14
|
+
return isVite8Plus ? userBuild.rolldownOptions?.input ?? userBuild.rollupOptions?.input : userBuild.rollupOptions?.input ?? userBuild.rolldownOptions?.input;
|
|
15
15
|
}
|
|
16
16
|
function buildBundlerOptions(options) {
|
|
17
17
|
const key = isVite8Plus ? "rolldownOptions" : "rollupOptions";
|
|
18
18
|
return { [key]: options };
|
|
19
19
|
}
|
|
20
|
+
function hmrServerConfig(network) {
|
|
21
|
+
return isVite81Plus ? { ws: network } : { hmr: network };
|
|
22
|
+
}
|
|
20
23
|
export {
|
|
21
24
|
buildBundlerOptions,
|
|
22
25
|
buildInputOptions,
|
|
26
|
+
hmrServerConfig,
|
|
27
|
+
isVite81Plus,
|
|
23
28
|
isVite8Plus,
|
|
24
29
|
resolveUserBuildInput,
|
|
25
|
-
viteMajor
|
|
30
|
+
viteMajor,
|
|
31
|
+
viteMinor
|
|
26
32
|
};
|
package/dist/js/sveltekit.js
CHANGED
|
@@ -5,6 +5,7 @@ import { readBridgeConfig } from "./shared/bridge-schema.js";
|
|
|
5
5
|
import { DEBOUNCE_MS } from "./shared/constants.js";
|
|
6
6
|
import { normalizeHost, resolveHotFilePath, resolveLitestarPort } from "./shared/network.js";
|
|
7
7
|
import { createLitestarTypeGenPlugin } from "./shared/typegen-plugin.js";
|
|
8
|
+
import { hmrServerConfig } from "./shared/vite-compat.js";
|
|
8
9
|
function resolveConfig(config = {}) {
|
|
9
10
|
let hotFile;
|
|
10
11
|
let proxyMode = "vite";
|
|
@@ -140,14 +141,12 @@ function litestarSvelteKit(userConfig = {}) {
|
|
|
140
141
|
strictPort: true
|
|
141
142
|
} : {},
|
|
142
143
|
// Route HMR through the Litestar port so DevTools never sees the framework port.
|
|
143
|
-
...config.litestarPort !== void 0 ? {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
} : {},
|
|
144
|
+
...config.litestarPort !== void 0 ? hmrServerConfig({
|
|
145
|
+
protocol: "ws",
|
|
146
|
+
host: "127.0.0.1",
|
|
147
|
+
clientPort: config.litestarPort,
|
|
148
|
+
path: hmrPath
|
|
149
|
+
}) : {},
|
|
151
150
|
proxy: {
|
|
152
151
|
[config.apiPrefix]: {
|
|
153
152
|
target: config.apiProxy,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litestar-vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Litestar plugin for Vite.",
|
|
6
6
|
"keywords": [
|
|
@@ -103,18 +103,18 @@
|
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@tailwindcss/vite": "^4.0.0",
|
|
106
|
-
"@types/node": "^
|
|
107
|
-
"@vitest/coverage-v8": "^
|
|
108
|
-
"esbuild": "0.
|
|
106
|
+
"@types/node": "^26.0.1",
|
|
107
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
108
|
+
"esbuild": "0.28.1",
|
|
109
109
|
"happy-dom": "^20.0.2",
|
|
110
|
-
"oxfmt": "^0.
|
|
110
|
+
"oxfmt": "^0.56.0",
|
|
111
111
|
"oxlint": "^1.66.0",
|
|
112
112
|
"svelte": "^5.56.0",
|
|
113
113
|
"tailwindcss": "^4.0.0",
|
|
114
|
-
"typescript": "^
|
|
115
|
-
"vite": "^8.
|
|
114
|
+
"typescript": "^6.0.3",
|
|
115
|
+
"vite": "^8.1.0",
|
|
116
116
|
"vite-plugin-singlefile": "^2.3.0",
|
|
117
|
-
"vitest": "^
|
|
117
|
+
"vitest": "^4.1.8"
|
|
118
118
|
},
|
|
119
119
|
"peerDependencies": {
|
|
120
120
|
"vite": "^7.0.0 || ^8.0.0"
|