litestar-vite-plugin 0.1.1 → 0.1.3
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/dev-server-index.html +2 -785
- package/dist/index.cjs +103 -36
- package/dist/index.d.ts +28 -10
- package/dist/index.mjs +106 -37
- package/package.json +1 -1
|
@@ -12,790 +12,7 @@
|
|
|
12
12
|
rel="stylesheet"
|
|
13
13
|
/>
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
<style>
|
|
17
|
-
/* ! tailwindcss v3.1.4 | MIT License | https://tailwindcss.com */
|
|
18
|
-
*,
|
|
19
|
-
:before,
|
|
20
|
-
:after {
|
|
21
|
-
box-sizing: border-box;
|
|
22
|
-
border-width: 0;
|
|
23
|
-
border-style: solid;
|
|
24
|
-
border-color: #e5e7eb;
|
|
25
|
-
}
|
|
26
|
-
:before,
|
|
27
|
-
:after {
|
|
28
|
-
--tw-content: "";
|
|
29
|
-
}
|
|
30
|
-
html {
|
|
31
|
-
line-height: 1.5;
|
|
32
|
-
-webkit-text-size-adjust: 100%;
|
|
33
|
-
-moz-tab-size: 4;
|
|
34
|
-
-o-tab-size: 4;
|
|
35
|
-
tab-size: 4;
|
|
36
|
-
font-family: Nunito, ui-sans-serif, system-ui, -apple-system,
|
|
37
|
-
BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial,
|
|
38
|
-
Noto Sans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
|
39
|
-
Segoe UI Symbol, "Noto Color Emoji";
|
|
40
|
-
}
|
|
41
|
-
body {
|
|
42
|
-
margin: 0;
|
|
43
|
-
line-height: inherit;
|
|
44
|
-
}
|
|
45
|
-
hr {
|
|
46
|
-
height: 0;
|
|
47
|
-
color: inherit;
|
|
48
|
-
border-top-width: 1px;
|
|
49
|
-
}
|
|
50
|
-
abbr:where([title]) {
|
|
51
|
-
-webkit-text-decoration: underline dotted;
|
|
52
|
-
text-decoration: underline dotted;
|
|
53
|
-
}
|
|
54
|
-
h1,
|
|
55
|
-
h2,
|
|
56
|
-
h3,
|
|
57
|
-
h4,
|
|
58
|
-
h5,
|
|
59
|
-
h6 {
|
|
60
|
-
font-size: inherit;
|
|
61
|
-
font-weight: inherit;
|
|
62
|
-
}
|
|
63
|
-
a {
|
|
64
|
-
color: inherit;
|
|
65
|
-
text-decoration: inherit;
|
|
66
|
-
}
|
|
67
|
-
b,
|
|
68
|
-
strong {
|
|
69
|
-
font-weight: bolder;
|
|
70
|
-
}
|
|
71
|
-
code,
|
|
72
|
-
kbd,
|
|
73
|
-
samp,
|
|
74
|
-
pre {
|
|
75
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco,
|
|
76
|
-
Consolas, Liberation Mono, Courier New, monospace;
|
|
77
|
-
font-size: 1em;
|
|
78
|
-
}
|
|
79
|
-
small {
|
|
80
|
-
font-size: 80%;
|
|
81
|
-
}
|
|
82
|
-
sub,
|
|
83
|
-
sup {
|
|
84
|
-
font-size: 75%;
|
|
85
|
-
line-height: 0;
|
|
86
|
-
position: relative;
|
|
87
|
-
vertical-align: baseline;
|
|
88
|
-
}
|
|
89
|
-
sub {
|
|
90
|
-
bottom: -0.25em;
|
|
91
|
-
}
|
|
92
|
-
sup {
|
|
93
|
-
top: -0.5em;
|
|
94
|
-
}
|
|
95
|
-
table {
|
|
96
|
-
text-indent: 0;
|
|
97
|
-
border-color: inherit;
|
|
98
|
-
border-collapse: collapse;
|
|
99
|
-
}
|
|
100
|
-
button,
|
|
101
|
-
input,
|
|
102
|
-
optgroup,
|
|
103
|
-
select,
|
|
104
|
-
textarea {
|
|
105
|
-
font-family: inherit;
|
|
106
|
-
font-size: 100%;
|
|
107
|
-
font-weight: inherit;
|
|
108
|
-
line-height: inherit;
|
|
109
|
-
color: inherit;
|
|
110
|
-
margin: 0;
|
|
111
|
-
padding: 0;
|
|
112
|
-
}
|
|
113
|
-
button,
|
|
114
|
-
select {
|
|
115
|
-
text-transform: none;
|
|
116
|
-
}
|
|
117
|
-
button,
|
|
118
|
-
[type="button"],
|
|
119
|
-
[type="reset"],
|
|
120
|
-
[type="submit"] {
|
|
121
|
-
-webkit-appearance: button;
|
|
122
|
-
background-color: transparent;
|
|
123
|
-
background-image: none;
|
|
124
|
-
}
|
|
125
|
-
:-moz-focusring {
|
|
126
|
-
outline: auto;
|
|
127
|
-
}
|
|
128
|
-
:-moz-ui-invalid {
|
|
129
|
-
box-shadow: none;
|
|
130
|
-
}
|
|
131
|
-
progress {
|
|
132
|
-
vertical-align: baseline;
|
|
133
|
-
}
|
|
134
|
-
::-webkit-inner-spin-button,
|
|
135
|
-
::-webkit-outer-spin-button {
|
|
136
|
-
height: auto;
|
|
137
|
-
}
|
|
138
|
-
[type="search"] {
|
|
139
|
-
-webkit-appearance: textfield;
|
|
140
|
-
outline-offset: -2px;
|
|
141
|
-
}
|
|
142
|
-
::-webkit-search-decoration {
|
|
143
|
-
-webkit-appearance: none;
|
|
144
|
-
}
|
|
145
|
-
::-webkit-file-upload-button {
|
|
146
|
-
-webkit-appearance: button;
|
|
147
|
-
font: inherit;
|
|
148
|
-
}
|
|
149
|
-
summary {
|
|
150
|
-
display: list-item;
|
|
151
|
-
}
|
|
152
|
-
blockquote,
|
|
153
|
-
dl,
|
|
154
|
-
dd,
|
|
155
|
-
h1,
|
|
156
|
-
h2,
|
|
157
|
-
h3,
|
|
158
|
-
h4,
|
|
159
|
-
h5,
|
|
160
|
-
h6,
|
|
161
|
-
hr,
|
|
162
|
-
figure,
|
|
163
|
-
p,
|
|
164
|
-
pre {
|
|
165
|
-
margin: 0;
|
|
166
|
-
}
|
|
167
|
-
fieldset {
|
|
168
|
-
margin: 0;
|
|
169
|
-
padding: 0;
|
|
170
|
-
}
|
|
171
|
-
legend {
|
|
172
|
-
padding: 0;
|
|
173
|
-
}
|
|
174
|
-
ol,
|
|
175
|
-
ul,
|
|
176
|
-
menu {
|
|
177
|
-
list-style: none;
|
|
178
|
-
margin: 0;
|
|
179
|
-
padding: 0;
|
|
180
|
-
}
|
|
181
|
-
textarea {
|
|
182
|
-
resize: vertical;
|
|
183
|
-
}
|
|
184
|
-
input::-moz-placeholder,
|
|
185
|
-
textarea::-moz-placeholder {
|
|
186
|
-
opacity: 1;
|
|
187
|
-
color: #9ca3af;
|
|
188
|
-
}
|
|
189
|
-
input::placeholder,
|
|
190
|
-
textarea::placeholder {
|
|
191
|
-
opacity: 1;
|
|
192
|
-
color: #9ca3af;
|
|
193
|
-
}
|
|
194
|
-
button,
|
|
195
|
-
[role="button"] {
|
|
196
|
-
cursor: pointer;
|
|
197
|
-
}
|
|
198
|
-
:disabled {
|
|
199
|
-
cursor: default;
|
|
200
|
-
}
|
|
201
|
-
img,
|
|
202
|
-
svg,
|
|
203
|
-
video,
|
|
204
|
-
canvas,
|
|
205
|
-
audio,
|
|
206
|
-
iframe,
|
|
207
|
-
embed,
|
|
208
|
-
object {
|
|
209
|
-
display: block;
|
|
210
|
-
vertical-align: middle;
|
|
211
|
-
}
|
|
212
|
-
img,
|
|
213
|
-
video {
|
|
214
|
-
max-width: 100%;
|
|
215
|
-
height: auto;
|
|
216
|
-
}
|
|
217
|
-
*,
|
|
218
|
-
:before,
|
|
219
|
-
:after {
|
|
220
|
-
--tw-border-spacing-x: 0;
|
|
221
|
-
--tw-border-spacing-y: 0;
|
|
222
|
-
--tw-translate-x: 0;
|
|
223
|
-
--tw-translate-y: 0;
|
|
224
|
-
--tw-rotate: 0;
|
|
225
|
-
--tw-skew-x: 0;
|
|
226
|
-
--tw-skew-y: 0;
|
|
227
|
-
--tw-scale-x: 1;
|
|
228
|
-
--tw-scale-y: 1;
|
|
229
|
-
--tw-pan-x: ;
|
|
230
|
-
--tw-pan-y: ;
|
|
231
|
-
--tw-pinch-zoom: ;
|
|
232
|
-
--tw-scroll-snap-strictness: proximity;
|
|
233
|
-
--tw-ordinal: ;
|
|
234
|
-
--tw-slashed-zero: ;
|
|
235
|
-
--tw-numeric-figure: ;
|
|
236
|
-
--tw-numeric-spacing: ;
|
|
237
|
-
--tw-numeric-fraction: ;
|
|
238
|
-
--tw-ring-inset: ;
|
|
239
|
-
--tw-ring-offset-width: 0px;
|
|
240
|
-
--tw-ring-offset-color: #fff;
|
|
241
|
-
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
242
|
-
--tw-ring-offset-shadow: 0 0 #0000;
|
|
243
|
-
--tw-ring-shadow: 0 0 #0000;
|
|
244
|
-
--tw-shadow: 0 0 #0000;
|
|
245
|
-
--tw-shadow-colored: 0 0 #0000;
|
|
246
|
-
--tw-blur: ;
|
|
247
|
-
--tw-brightness: ;
|
|
248
|
-
--tw-contrast: ;
|
|
249
|
-
--tw-grayscale: ;
|
|
250
|
-
--tw-hue-rotate: ;
|
|
251
|
-
--tw-invert: ;
|
|
252
|
-
--tw-saturate: ;
|
|
253
|
-
--tw-sepia: ;
|
|
254
|
-
--tw-drop-shadow: ;
|
|
255
|
-
--tw-backdrop-blur: ;
|
|
256
|
-
--tw-backdrop-brightness: ;
|
|
257
|
-
--tw-backdrop-contrast: ;
|
|
258
|
-
--tw-backdrop-grayscale: ;
|
|
259
|
-
--tw-backdrop-hue-rotate: ;
|
|
260
|
-
--tw-backdrop-invert: ;
|
|
261
|
-
--tw-backdrop-opacity: ;
|
|
262
|
-
--tw-backdrop-saturate: ;
|
|
263
|
-
--tw-backdrop-sepia: ;
|
|
264
|
-
}
|
|
265
|
-
::backdrop {
|
|
266
|
-
--tw-border-spacing-x: 0;
|
|
267
|
-
--tw-border-spacing-y: 0;
|
|
268
|
-
--tw-translate-x: 0;
|
|
269
|
-
--tw-translate-y: 0;
|
|
270
|
-
--tw-rotate: 0;
|
|
271
|
-
--tw-skew-x: 0;
|
|
272
|
-
--tw-skew-y: 0;
|
|
273
|
-
--tw-scale-x: 1;
|
|
274
|
-
--tw-scale-y: 1;
|
|
275
|
-
--tw-pan-x: ;
|
|
276
|
-
--tw-pan-y: ;
|
|
277
|
-
--tw-pinch-zoom: ;
|
|
278
|
-
--tw-scroll-snap-strictness: proximity;
|
|
279
|
-
--tw-ordinal: ;
|
|
280
|
-
--tw-slashed-zero: ;
|
|
281
|
-
--tw-numeric-figure: ;
|
|
282
|
-
--tw-numeric-spacing: ;
|
|
283
|
-
--tw-numeric-fraction: ;
|
|
284
|
-
--tw-ring-inset: ;
|
|
285
|
-
--tw-ring-offset-width: 0px;
|
|
286
|
-
--tw-ring-offset-color: #fff;
|
|
287
|
-
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
288
|
-
--tw-ring-offset-shadow: 0 0 #0000;
|
|
289
|
-
--tw-ring-shadow: 0 0 #0000;
|
|
290
|
-
--tw-shadow: 0 0 #0000;
|
|
291
|
-
--tw-shadow-colored: 0 0 #0000;
|
|
292
|
-
--tw-blur: ;
|
|
293
|
-
--tw-brightness: ;
|
|
294
|
-
--tw-contrast: ;
|
|
295
|
-
--tw-grayscale: ;
|
|
296
|
-
--tw-hue-rotate: ;
|
|
297
|
-
--tw-invert: ;
|
|
298
|
-
--tw-saturate: ;
|
|
299
|
-
--tw-sepia: ;
|
|
300
|
-
--tw-drop-shadow: ;
|
|
301
|
-
--tw-backdrop-blur: ;
|
|
302
|
-
--tw-backdrop-brightness: ;
|
|
303
|
-
--tw-backdrop-contrast: ;
|
|
304
|
-
--tw-backdrop-grayscale: ;
|
|
305
|
-
--tw-backdrop-hue-rotate: ;
|
|
306
|
-
--tw-backdrop-invert: ;
|
|
307
|
-
--tw-backdrop-opacity: ;
|
|
308
|
-
--tw-backdrop-saturate: ;
|
|
309
|
-
--tw-backdrop-sepia: ;
|
|
310
|
-
}
|
|
311
|
-
.fixed {
|
|
312
|
-
position: fixed;
|
|
313
|
-
}
|
|
314
|
-
.relative {
|
|
315
|
-
position: relative;
|
|
316
|
-
}
|
|
317
|
-
.top-0 {
|
|
318
|
-
top: 0px;
|
|
319
|
-
}
|
|
320
|
-
.right-0 {
|
|
321
|
-
right: 0px;
|
|
322
|
-
}
|
|
323
|
-
.z-0 {
|
|
324
|
-
z-index: 0;
|
|
325
|
-
}
|
|
326
|
-
.mx-auto {
|
|
327
|
-
margin-left: auto;
|
|
328
|
-
margin-right: auto;
|
|
329
|
-
}
|
|
330
|
-
.ml-3 {
|
|
331
|
-
margin-left: 0.75rem;
|
|
332
|
-
}
|
|
333
|
-
.-ml-px {
|
|
334
|
-
margin-left: -1px;
|
|
335
|
-
}
|
|
336
|
-
.ml-1 {
|
|
337
|
-
margin-left: 0.25rem;
|
|
338
|
-
}
|
|
339
|
-
.mt-2 {
|
|
340
|
-
margin-top: 0.5rem;
|
|
341
|
-
}
|
|
342
|
-
.mr-2 {
|
|
343
|
-
margin-right: 0.5rem;
|
|
344
|
-
}
|
|
345
|
-
.ml-2 {
|
|
346
|
-
margin-left: 0.5rem;
|
|
347
|
-
}
|
|
348
|
-
.mt-4 {
|
|
349
|
-
margin-top: 1rem;
|
|
350
|
-
}
|
|
351
|
-
.ml-4 {
|
|
352
|
-
margin-left: 1rem;
|
|
353
|
-
}
|
|
354
|
-
.mt-8 {
|
|
355
|
-
margin-top: 2rem;
|
|
356
|
-
}
|
|
357
|
-
.ml-12 {
|
|
358
|
-
margin-left: 3rem;
|
|
359
|
-
}
|
|
360
|
-
.-mt-px {
|
|
361
|
-
margin-top: -1px;
|
|
362
|
-
}
|
|
363
|
-
.mt-6 {
|
|
364
|
-
margin-top: 1.5rem;
|
|
365
|
-
}
|
|
366
|
-
.flex {
|
|
367
|
-
display: flex;
|
|
368
|
-
}
|
|
369
|
-
.inline-flex {
|
|
370
|
-
display: inline-flex;
|
|
371
|
-
}
|
|
372
|
-
.table {
|
|
373
|
-
display: table;
|
|
374
|
-
}
|
|
375
|
-
.grid {
|
|
376
|
-
display: grid;
|
|
377
|
-
}
|
|
378
|
-
.hidden {
|
|
379
|
-
display: none;
|
|
380
|
-
}
|
|
381
|
-
.h-5 {
|
|
382
|
-
height: 1.25rem;
|
|
383
|
-
}
|
|
384
|
-
.h-8 {
|
|
385
|
-
height: 2rem;
|
|
386
|
-
}
|
|
387
|
-
.h-16 {
|
|
388
|
-
height: 4rem;
|
|
389
|
-
}
|
|
390
|
-
.h-6 {
|
|
391
|
-
height: 1.5rem;
|
|
392
|
-
}
|
|
393
|
-
.min-h-screen {
|
|
394
|
-
min-height: 100vh;
|
|
395
|
-
}
|
|
396
|
-
.w-5 {
|
|
397
|
-
width: 1.25rem;
|
|
398
|
-
}
|
|
399
|
-
.w-8 {
|
|
400
|
-
width: 2rem;
|
|
401
|
-
}
|
|
402
|
-
.w-auto {
|
|
403
|
-
width: auto;
|
|
404
|
-
}
|
|
405
|
-
.w-6 {
|
|
406
|
-
width: 1.5rem;
|
|
407
|
-
}
|
|
408
|
-
.max-w-xl {
|
|
409
|
-
max-width: 36rem;
|
|
410
|
-
}
|
|
411
|
-
.max-w-6xl {
|
|
412
|
-
max-width: 72rem;
|
|
413
|
-
}
|
|
414
|
-
.flex-1 {
|
|
415
|
-
flex: 1 1 0%;
|
|
416
|
-
}
|
|
417
|
-
.cursor-default {
|
|
418
|
-
cursor: default;
|
|
419
|
-
}
|
|
420
|
-
.resize {
|
|
421
|
-
resize: both;
|
|
422
|
-
}
|
|
423
|
-
.grid-cols-1 {
|
|
424
|
-
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
425
|
-
}
|
|
426
|
-
.flex-col {
|
|
427
|
-
flex-direction: column;
|
|
428
|
-
}
|
|
429
|
-
.items-center {
|
|
430
|
-
align-items: center;
|
|
431
|
-
}
|
|
432
|
-
.justify-center {
|
|
433
|
-
justify-content: center;
|
|
434
|
-
}
|
|
435
|
-
.justify-between {
|
|
436
|
-
justify-content: space-between;
|
|
437
|
-
}
|
|
438
|
-
.justify-items-center {
|
|
439
|
-
justify-items: center;
|
|
440
|
-
}
|
|
441
|
-
.space-x-6 > :not([hidden]) ~ :not([hidden]) {
|
|
442
|
-
--tw-space-x-reverse: 0;
|
|
443
|
-
margin-right: calc(1.5rem * var(--tw-space-x-reverse));
|
|
444
|
-
margin-left: calc(1.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
445
|
-
}
|
|
446
|
-
.divide-y > :not([hidden]) ~ :not([hidden]) {
|
|
447
|
-
--tw-divide-y-reverse: 0;
|
|
448
|
-
border-top-width: calc(
|
|
449
|
-
1px * calc(1 - var(--tw-divide-y-reverse))
|
|
450
|
-
);
|
|
451
|
-
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
|
|
452
|
-
}
|
|
453
|
-
.divide-gray-300 > :not([hidden]) ~ :not([hidden]) {
|
|
454
|
-
--tw-divide-opacity: 1;
|
|
455
|
-
border-color: rgb(209 213 219 / var(--tw-divide-opacity));
|
|
456
|
-
}
|
|
457
|
-
.overflow-hidden {
|
|
458
|
-
overflow: hidden;
|
|
459
|
-
}
|
|
460
|
-
.rounded-md {
|
|
461
|
-
border-radius: 0.375rem;
|
|
462
|
-
}
|
|
463
|
-
.rounded-lg {
|
|
464
|
-
border-radius: 0.5rem;
|
|
465
|
-
}
|
|
466
|
-
.rounded-l-md {
|
|
467
|
-
border-top-left-radius: 0.375rem;
|
|
468
|
-
border-bottom-left-radius: 0.375rem;
|
|
469
|
-
}
|
|
470
|
-
.rounded-r-md {
|
|
471
|
-
border-top-right-radius: 0.375rem;
|
|
472
|
-
border-bottom-right-radius: 0.375rem;
|
|
473
|
-
}
|
|
474
|
-
.border {
|
|
475
|
-
border-width: 1px;
|
|
476
|
-
}
|
|
477
|
-
.border-t {
|
|
478
|
-
border-top-width: 1px;
|
|
479
|
-
}
|
|
480
|
-
.border-r {
|
|
481
|
-
border-right-width: 1px;
|
|
482
|
-
}
|
|
483
|
-
.border-gray-300 {
|
|
484
|
-
--tw-border-opacity: 1;
|
|
485
|
-
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
|
486
|
-
}
|
|
487
|
-
.border-gray-200 {
|
|
488
|
-
--tw-border-opacity: 1;
|
|
489
|
-
border-color: rgb(229 231 235 / var(--tw-border-opacity));
|
|
490
|
-
}
|
|
491
|
-
.border-gray-400 {
|
|
492
|
-
--tw-border-opacity: 1;
|
|
493
|
-
border-color: rgb(156 163 175 / var(--tw-border-opacity));
|
|
494
|
-
}
|
|
495
|
-
.bg-white {
|
|
496
|
-
--tw-bg-opacity: 1;
|
|
497
|
-
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
498
|
-
}
|
|
499
|
-
.bg-gray-100 {
|
|
500
|
-
--tw-bg-opacity: 1;
|
|
501
|
-
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
|
502
|
-
}
|
|
503
|
-
.p-6 {
|
|
504
|
-
padding: 1.5rem;
|
|
505
|
-
}
|
|
506
|
-
.px-4 {
|
|
507
|
-
padding-left: 1rem;
|
|
508
|
-
padding-right: 1rem;
|
|
509
|
-
}
|
|
510
|
-
.py-2 {
|
|
511
|
-
padding-top: 0.5rem;
|
|
512
|
-
padding-bottom: 0.5rem;
|
|
513
|
-
}
|
|
514
|
-
.px-2 {
|
|
515
|
-
padding-left: 0.5rem;
|
|
516
|
-
padding-right: 0.5rem;
|
|
517
|
-
}
|
|
518
|
-
.py-4 {
|
|
519
|
-
padding-top: 1rem;
|
|
520
|
-
padding-bottom: 1rem;
|
|
521
|
-
}
|
|
522
|
-
.px-6 {
|
|
523
|
-
padding-left: 1.5rem;
|
|
524
|
-
padding-right: 1.5rem;
|
|
525
|
-
}
|
|
526
|
-
.py-6 {
|
|
527
|
-
padding-top: 1.5rem;
|
|
528
|
-
padding-bottom: 1.5rem;
|
|
529
|
-
}
|
|
530
|
-
.py-8 {
|
|
531
|
-
padding-top: 2rem;
|
|
532
|
-
padding-bottom: 2rem;
|
|
533
|
-
}
|
|
534
|
-
.pt-8 {
|
|
535
|
-
padding-top: 2rem;
|
|
536
|
-
}
|
|
537
|
-
.pt-10 {
|
|
538
|
-
padding-top: 2.5rem;
|
|
539
|
-
}
|
|
540
|
-
.pb-8 {
|
|
541
|
-
padding-bottom: 2rem;
|
|
542
|
-
}
|
|
543
|
-
.text-center {
|
|
544
|
-
text-align: center;
|
|
545
|
-
}
|
|
546
|
-
.text-sm {
|
|
547
|
-
font-size: 0.875rem;
|
|
548
|
-
line-height: 1.25rem;
|
|
549
|
-
}
|
|
550
|
-
.text-lg {
|
|
551
|
-
font-size: 1.125rem;
|
|
552
|
-
line-height: 1.75rem;
|
|
553
|
-
}
|
|
554
|
-
.text-base {
|
|
555
|
-
font-size: 1rem;
|
|
556
|
-
line-height: 1.5rem;
|
|
557
|
-
}
|
|
558
|
-
.font-medium {
|
|
559
|
-
font-weight: 500;
|
|
560
|
-
}
|
|
561
|
-
.font-semibold {
|
|
562
|
-
font-weight: 600;
|
|
563
|
-
}
|
|
564
|
-
.font-bold {
|
|
565
|
-
font-weight: 700;
|
|
566
|
-
}
|
|
567
|
-
.uppercase {
|
|
568
|
-
text-transform: uppercase;
|
|
569
|
-
}
|
|
570
|
-
.leading-5 {
|
|
571
|
-
line-height: 1.25rem;
|
|
572
|
-
}
|
|
573
|
-
.leading-7 {
|
|
574
|
-
line-height: 1.75rem;
|
|
575
|
-
}
|
|
576
|
-
.tracking-wider {
|
|
577
|
-
letter-spacing: 0.05em;
|
|
578
|
-
}
|
|
579
|
-
.text-gray-500 {
|
|
580
|
-
--tw-text-opacity: 1;
|
|
581
|
-
color: rgb(107 114 128 / var(--tw-text-opacity));
|
|
582
|
-
}
|
|
583
|
-
.text-gray-700 {
|
|
584
|
-
--tw-text-opacity: 1;
|
|
585
|
-
color: rgb(55 65 81 / var(--tw-text-opacity));
|
|
586
|
-
}
|
|
587
|
-
.text-gray-200 {
|
|
588
|
-
--tw-text-opacity: 1;
|
|
589
|
-
color: rgb(229 231 235 / var(--tw-text-opacity));
|
|
590
|
-
}
|
|
591
|
-
.text-gray-300 {
|
|
592
|
-
--tw-text-opacity: 1;
|
|
593
|
-
color: rgb(209 213 219 / var(--tw-text-opacity));
|
|
594
|
-
}
|
|
595
|
-
.text-gray-400 {
|
|
596
|
-
--tw-text-opacity: 1;
|
|
597
|
-
color: rgb(156 163 175 / var(--tw-text-opacity));
|
|
598
|
-
}
|
|
599
|
-
.text-gray-600 {
|
|
600
|
-
--tw-text-opacity: 1;
|
|
601
|
-
color: rgb(75 85 99 / var(--tw-text-opacity));
|
|
602
|
-
}
|
|
603
|
-
.text-gray-900 {
|
|
604
|
-
--tw-text-opacity: 1;
|
|
605
|
-
color: rgb(17 24 39 / var(--tw-text-opacity));
|
|
606
|
-
}
|
|
607
|
-
.text-red-500 {
|
|
608
|
-
--tw-text-opacity: 1;
|
|
609
|
-
color: rgb(239 68 68 / var(--tw-text-opacity));
|
|
610
|
-
}
|
|
611
|
-
.text-red-600 {
|
|
612
|
-
--tw-text-opacity: 1;
|
|
613
|
-
color: rgb(220 38 38 / var(--tw-text-opacity));
|
|
614
|
-
}
|
|
615
|
-
.underline {
|
|
616
|
-
text-decoration-line: underline;
|
|
617
|
-
}
|
|
618
|
-
.antialiased {
|
|
619
|
-
-webkit-font-smoothing: antialiased;
|
|
620
|
-
-moz-osx-font-smoothing: grayscale;
|
|
621
|
-
}
|
|
622
|
-
.shadow-sm {
|
|
623
|
-
--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
624
|
-
--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
|
|
625
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000),
|
|
626
|
-
var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
627
|
-
}
|
|
628
|
-
.shadow {
|
|
629
|
-
--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1),
|
|
630
|
-
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
631
|
-
--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color),
|
|
632
|
-
0 1px 2px -1px var(--tw-shadow-color);
|
|
633
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000),
|
|
634
|
-
var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
635
|
-
}
|
|
636
|
-
.shadow-xl {
|
|
637
|
-
--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1),
|
|
638
|
-
0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
639
|
-
--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color),
|
|
640
|
-
0 8px 10px -6px var(--tw-shadow-color);
|
|
641
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000),
|
|
642
|
-
var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
643
|
-
}
|
|
644
|
-
.ring-1 {
|
|
645
|
-
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
|
|
646
|
-
var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
647
|
-
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0
|
|
648
|
-
calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
649
|
-
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
|
|
650
|
-
var(--tw-shadow, 0 0 #0000);
|
|
651
|
-
}
|
|
652
|
-
.ring-gray-300 {
|
|
653
|
-
--tw-ring-opacity: 1;
|
|
654
|
-
--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity));
|
|
655
|
-
}
|
|
656
|
-
.ring-gray-900 {
|
|
657
|
-
--tw-ring-opacity: 1;
|
|
658
|
-
--tw-ring-color: rgb(17 24 39 / var(--tw-ring-opacity));
|
|
659
|
-
}
|
|
660
|
-
.ring-gray-900\/5 {
|
|
661
|
-
--tw-ring-color: rgb(17 24 39 / 0.05);
|
|
662
|
-
}
|
|
663
|
-
.transition {
|
|
664
|
-
transition-property: color, background-color, border-color,
|
|
665
|
-
text-decoration-color, fill, stroke, opacity, box-shadow,
|
|
666
|
-
transform, filter, -webkit-backdrop-filter;
|
|
667
|
-
transition-property: color, background-color, border-color,
|
|
668
|
-
text-decoration-color, fill, stroke, opacity, box-shadow,
|
|
669
|
-
transform, filter, backdrop-filter;
|
|
670
|
-
transition-property: color, background-color, border-color,
|
|
671
|
-
text-decoration-color, fill, stroke, opacity, box-shadow,
|
|
672
|
-
transform, filter, backdrop-filter, -webkit-backdrop-filter;
|
|
673
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
674
|
-
transition-duration: 0.15s;
|
|
675
|
-
}
|
|
676
|
-
.duration-150 {
|
|
677
|
-
transition-duration: 0.15s;
|
|
678
|
-
}
|
|
679
|
-
.ease-in-out {
|
|
680
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
681
|
-
}
|
|
682
|
-
.hover\:text-gray-500:hover {
|
|
683
|
-
--tw-text-opacity: 1;
|
|
684
|
-
color: rgb(107 114 128 / var(--tw-text-opacity));
|
|
685
|
-
}
|
|
686
|
-
.hover\:text-gray-400:hover {
|
|
687
|
-
--tw-text-opacity: 1;
|
|
688
|
-
color: rgb(156 163 175 / var(--tw-text-opacity));
|
|
689
|
-
}
|
|
690
|
-
.hover\:text-red-600:hover {
|
|
691
|
-
--tw-text-opacity: 1;
|
|
692
|
-
color: rgb(220 38 38 / var(--tw-text-opacity));
|
|
693
|
-
}
|
|
694
|
-
.focus\:z-10:focus {
|
|
695
|
-
z-index: 10;
|
|
696
|
-
}
|
|
697
|
-
.focus\:border-blue-300:focus {
|
|
698
|
-
--tw-border-opacity: 1;
|
|
699
|
-
border-color: rgb(147 197 253 / var(--tw-border-opacity));
|
|
700
|
-
}
|
|
701
|
-
.focus\:outline-none:focus {
|
|
702
|
-
outline: 2px solid transparent;
|
|
703
|
-
outline-offset: 2px;
|
|
704
|
-
}
|
|
705
|
-
.focus\:ring:focus {
|
|
706
|
-
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
|
|
707
|
-
var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
708
|
-
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0
|
|
709
|
-
calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
710
|
-
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
|
|
711
|
-
var(--tw-shadow, 0 0 #0000);
|
|
712
|
-
}
|
|
713
|
-
.active\:bg-gray-100:active {
|
|
714
|
-
--tw-bg-opacity: 1;
|
|
715
|
-
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
|
716
|
-
}
|
|
717
|
-
.active\:text-gray-700:active {
|
|
718
|
-
--tw-text-opacity: 1;
|
|
719
|
-
color: rgb(55 65 81 / var(--tw-text-opacity));
|
|
720
|
-
}
|
|
721
|
-
.active\:text-gray-500:active {
|
|
722
|
-
--tw-text-opacity: 1;
|
|
723
|
-
color: rgb(107 114 128 / var(--tw-text-opacity));
|
|
724
|
-
}
|
|
725
|
-
@media (prefers-color-scheme: dark) {
|
|
726
|
-
.dark\:divide-gray-700 > :not([hidden]) ~ :not([hidden]) {
|
|
727
|
-
--tw-divide-opacity: 1;
|
|
728
|
-
border-color: rgb(55 65 81 / var(--tw-divide-opacity));
|
|
729
|
-
}
|
|
730
|
-
.dark\:bg-gray-900 {
|
|
731
|
-
--tw-bg-opacity: 1;
|
|
732
|
-
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
|
|
733
|
-
}
|
|
734
|
-
.dark\:bg-gray-800 {
|
|
735
|
-
--tw-bg-opacity: 1;
|
|
736
|
-
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
|
|
737
|
-
}
|
|
738
|
-
.dark\:text-gray-400 {
|
|
739
|
-
--tw-text-opacity: 1;
|
|
740
|
-
color: rgb(156 163 175 / var(--tw-text-opacity));
|
|
741
|
-
}
|
|
742
|
-
.dark\:text-gray-100 {
|
|
743
|
-
--tw-text-opacity: 1;
|
|
744
|
-
color: rgb(243 244 246 / var(--tw-text-opacity));
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
@media (min-width: 640px) {
|
|
748
|
-
.sm\:mx-auto {
|
|
749
|
-
margin-left: auto;
|
|
750
|
-
margin-right: auto;
|
|
751
|
-
}
|
|
752
|
-
.sm\:flex {
|
|
753
|
-
display: flex;
|
|
754
|
-
}
|
|
755
|
-
.sm\:hidden {
|
|
756
|
-
display: none;
|
|
757
|
-
}
|
|
758
|
-
.sm\:max-w-xl {
|
|
759
|
-
max-width: 36rem;
|
|
760
|
-
}
|
|
761
|
-
.sm\:flex-1 {
|
|
762
|
-
flex: 1 1 0%;
|
|
763
|
-
}
|
|
764
|
-
.sm\:items-center {
|
|
765
|
-
align-items: center;
|
|
766
|
-
}
|
|
767
|
-
.sm\:justify-start {
|
|
768
|
-
justify-content: flex-start;
|
|
769
|
-
}
|
|
770
|
-
.sm\:justify-between {
|
|
771
|
-
justify-content: space-between;
|
|
772
|
-
}
|
|
773
|
-
.sm\:rounded-lg {
|
|
774
|
-
border-radius: 0.5rem;
|
|
775
|
-
}
|
|
776
|
-
.sm\:px-6 {
|
|
777
|
-
padding-left: 1.5rem;
|
|
778
|
-
padding-right: 1.5rem;
|
|
779
|
-
}
|
|
780
|
-
.sm\:py-12 {
|
|
781
|
-
padding-top: 3rem;
|
|
782
|
-
padding-bottom: 3rem;
|
|
783
|
-
}
|
|
784
|
-
.sm\:px-10 {
|
|
785
|
-
padding-left: 2.5rem;
|
|
786
|
-
padding-right: 2.5rem;
|
|
787
|
-
}
|
|
788
|
-
.sm\:pt-0 {
|
|
789
|
-
padding-top: 0;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
@media (min-width: 1024px) {
|
|
793
|
-
.lg\:px-8 {
|
|
794
|
-
padding-left: 2rem;
|
|
795
|
-
padding-right: 2rem;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
</style>
|
|
15
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
799
16
|
</head>
|
|
800
17
|
<body class="antialiased">
|
|
801
18
|
<div
|
|
@@ -808,7 +25,7 @@
|
|
|
808
25
|
<div class="flex items-center justify-center space-x-6">
|
|
809
26
|
<a href="https://litestar.dev">
|
|
810
27
|
<svg
|
|
811
|
-
viewBox="0 0
|
|
28
|
+
viewBox="0 0 410 470"
|
|
812
29
|
xmlns="http://www.w3.org/2000/svg"
|
|
813
30
|
class="h-16 w-auto"
|
|
814
31
|
>
|
package/dist/index.cjs
CHANGED
|
@@ -54,7 +54,7 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
54
54
|
let resolvedConfig;
|
|
55
55
|
let userConfig;
|
|
56
56
|
const defaultAliases = {
|
|
57
|
-
"@": "/resources/
|
|
57
|
+
"@": pluginConfig.resourceDirectory || "/resources/"
|
|
58
58
|
};
|
|
59
59
|
return {
|
|
60
60
|
name: "litestar",
|
|
@@ -63,11 +63,13 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
63
63
|
userConfig = config;
|
|
64
64
|
const ssr = !!userConfig.build?.ssr;
|
|
65
65
|
const env = (0, import_vite.loadEnv)(mode, userConfig.envDir || process.cwd(), "");
|
|
66
|
-
const assetUrl = env.ASSET_URL
|
|
67
|
-
const serverConfig = command === "serve" ? resolveDevelopmentEnvironmentServerConfig(
|
|
66
|
+
const assetUrl = env.ASSET_URL || pluginConfig.assetUrl;
|
|
67
|
+
const serverConfig = command === "serve" ? resolveDevelopmentEnvironmentServerConfig(
|
|
68
|
+
pluginConfig.detectTls
|
|
69
|
+
) ?? resolveEnvironmentServerConfig(env) : void 0;
|
|
68
70
|
ensureCommandShouldRunInEnvironment(command, env);
|
|
69
71
|
return {
|
|
70
|
-
base: userConfig.base ?? (command === "build" ? resolveBase(pluginConfig, assetUrl) :
|
|
72
|
+
base: userConfig.base ?? (command === "build" ? resolveBase(pluginConfig, assetUrl) : pluginConfig.assetUrl),
|
|
71
73
|
publicDir: userConfig.publicDir ?? false,
|
|
72
74
|
build: {
|
|
73
75
|
manifest: userConfig.build?.manifest ?? !ssr,
|
|
@@ -118,7 +120,10 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
118
120
|
},
|
|
119
121
|
transform(code) {
|
|
120
122
|
if (resolvedConfig.command === "serve") {
|
|
121
|
-
code = code.replace(
|
|
123
|
+
code = code.replace(
|
|
124
|
+
/__litestar_vite_placeholder__/g,
|
|
125
|
+
viteDevServerUrl
|
|
126
|
+
);
|
|
122
127
|
return pluginConfig.transformOnServe(code, viteDevServerUrl);
|
|
123
128
|
}
|
|
124
129
|
},
|
|
@@ -129,13 +134,34 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
129
134
|
const address = server.httpServer?.address();
|
|
130
135
|
const isAddressInfo = (x) => typeof x === "object";
|
|
131
136
|
if (isAddressInfo(address)) {
|
|
132
|
-
viteDevServerUrl = resolveDevServerUrl(
|
|
137
|
+
viteDevServerUrl = resolveDevServerUrl(
|
|
138
|
+
address,
|
|
139
|
+
server.config,
|
|
140
|
+
userConfig
|
|
141
|
+
);
|
|
133
142
|
import_fs.default.writeFileSync(pluginConfig.hotFile, viteDevServerUrl);
|
|
134
143
|
setTimeout(() => {
|
|
135
|
-
server.config.logger.info(
|
|
136
|
-
|
|
144
|
+
server.config.logger.info(
|
|
145
|
+
`
|
|
146
|
+
${import_picocolors.default.red(
|
|
147
|
+
`${import_picocolors.default.bold(
|
|
148
|
+
"LITESTAR"
|
|
149
|
+
)} ${litestarVersion()}`
|
|
150
|
+
)} ${import_picocolors.default.dim("plugin")} ${import_picocolors.default.bold(
|
|
151
|
+
`v${pluginVersion()}`
|
|
152
|
+
)}`
|
|
153
|
+
);
|
|
137
154
|
server.config.logger.info("");
|
|
138
|
-
server.config.logger.info(
|
|
155
|
+
server.config.logger.info(
|
|
156
|
+
` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold(
|
|
157
|
+
"APP_URL"
|
|
158
|
+
)}: ${import_picocolors.default.cyan(
|
|
159
|
+
appUrl.replace(
|
|
160
|
+
/:(\d+)/,
|
|
161
|
+
(_, port) => `:${import_picocolors.default.bold(port)}`
|
|
162
|
+
)
|
|
163
|
+
)}`
|
|
164
|
+
);
|
|
139
165
|
}, 100);
|
|
140
166
|
}
|
|
141
167
|
});
|
|
@@ -155,7 +181,12 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
155
181
|
if (req.url === "/index.html") {
|
|
156
182
|
res.statusCode = 404;
|
|
157
183
|
res.end(
|
|
158
|
-
import_fs.default.readFileSync(
|
|
184
|
+
import_fs.default.readFileSync(
|
|
185
|
+
import_path.default.join(
|
|
186
|
+
dirname(),
|
|
187
|
+
"dev-server-index.html"
|
|
188
|
+
)
|
|
189
|
+
).toString().replace(/{{ APP_URL }}/g, appUrl)
|
|
159
190
|
);
|
|
160
191
|
}
|
|
161
192
|
next();
|
|
@@ -168,23 +199,24 @@ function ensureCommandShouldRunInEnvironment(command, env) {
|
|
|
168
199
|
return;
|
|
169
200
|
}
|
|
170
201
|
if (typeof env.LITESTAR_MODE !== "undefined") {
|
|
171
|
-
throw Error(
|
|
202
|
+
throw Error(
|
|
203
|
+
"You should not run the Vite HMR server when Litestar is in production. You should build your assets for production instead. To disable this ENV check you may set LITESTAR_BYPASS_ENV_CHECK=1"
|
|
204
|
+
);
|
|
172
205
|
}
|
|
173
206
|
if (typeof env.CI !== "undefined") {
|
|
174
|
-
throw Error(
|
|
207
|
+
throw Error(
|
|
208
|
+
"You should not run the Vite HMR server in CI environments. You should build your assets for production instead. To disable this ENV check you may set LITESTAR_BYPASS_ENV_CHECK=1"
|
|
209
|
+
);
|
|
175
210
|
}
|
|
176
211
|
}
|
|
177
212
|
function litestarVersion() {
|
|
178
|
-
|
|
179
|
-
const composer = JSON.parse(import_fs.default.readFileSync("composer.lock").toString());
|
|
180
|
-
return composer.packages?.find((composerPackage) => composerPackage.name === "litestar/framework")?.version ?? "";
|
|
181
|
-
} catch {
|
|
182
|
-
return "";
|
|
183
|
-
}
|
|
213
|
+
return "";
|
|
184
214
|
}
|
|
185
215
|
function pluginVersion() {
|
|
186
216
|
try {
|
|
187
|
-
return JSON.parse(
|
|
217
|
+
return JSON.parse(
|
|
218
|
+
import_fs.default.readFileSync(import_path.default.join(dirname(), "../package.json")).toString()
|
|
219
|
+
)?.version;
|
|
188
220
|
} catch {
|
|
189
221
|
return "";
|
|
190
222
|
}
|
|
@@ -197,18 +229,38 @@ function resolvePluginConfig(config) {
|
|
|
197
229
|
config = { input: config, ssr: config };
|
|
198
230
|
}
|
|
199
231
|
if (typeof config.input === "undefined") {
|
|
200
|
-
throw new Error(
|
|
232
|
+
throw new Error(
|
|
233
|
+
'litestar-vite-plugin: missing configuration for "input".'
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
if (typeof config.rootDirectory === "undefined") {
|
|
237
|
+
config.rootDirectory = "";
|
|
238
|
+
}
|
|
239
|
+
if (typeof config.rootDirectory === "string") {
|
|
240
|
+
config.rootDirectory = config.rootDirectory.trim().replace(/^\/+/, "");
|
|
241
|
+
}
|
|
242
|
+
if (typeof config.resourceDirectory === "string") {
|
|
243
|
+
config.resourceDirectory = config.resourceDirectory.trim().replace(/^\/+/, "");
|
|
244
|
+
if (config.resourceDirectory === "") {
|
|
245
|
+
throw new Error(
|
|
246
|
+
"litestar-vite-plugin: resourceDirectory must be a subdirectory. E.g. 'resources'."
|
|
247
|
+
);
|
|
248
|
+
}
|
|
201
249
|
}
|
|
202
|
-
if (typeof config.
|
|
203
|
-
config.
|
|
204
|
-
if (config.
|
|
205
|
-
throw new Error(
|
|
250
|
+
if (typeof config.assetDirectory === "string") {
|
|
251
|
+
config.assetDirectory = config.assetDirectory.trim().replace(/^\/+/, "");
|
|
252
|
+
if (config.assetDirectory === "") {
|
|
253
|
+
throw new Error(
|
|
254
|
+
"litestar-vite-plugin: assetDirectory must be a subdirectory. E.g. 'assets'."
|
|
255
|
+
);
|
|
206
256
|
}
|
|
207
257
|
}
|
|
208
258
|
if (typeof config.buildDirectory === "string") {
|
|
209
259
|
config.buildDirectory = config.buildDirectory.trim().replace(/^\/+/, "").replace(/\/+$/, "");
|
|
210
260
|
if (config.buildDirectory === "") {
|
|
211
|
-
throw new Error(
|
|
261
|
+
throw new Error(
|
|
262
|
+
"litestar-vite-plugin: buildDirectory must be a subdirectory. E.g. 'public'."
|
|
263
|
+
);
|
|
212
264
|
}
|
|
213
265
|
}
|
|
214
266
|
if (typeof config.ssrOutputDirectory === "string") {
|
|
@@ -219,18 +271,21 @@ function resolvePluginConfig(config) {
|
|
|
219
271
|
}
|
|
220
272
|
return {
|
|
221
273
|
input: config.input,
|
|
222
|
-
|
|
223
|
-
|
|
274
|
+
assetUrl: config.assetUrl || (config.assetUrl ?? "static"),
|
|
275
|
+
rootDirectory: config.rootDirectory ?? void 0,
|
|
276
|
+
resourceDirectory: config.resourceDirectory ?? "",
|
|
277
|
+
assetDirectory: config.assetDirectory ?? "",
|
|
278
|
+
buildDirectory: config.buildDirectory || (config.buildDirectory ?? "public"),
|
|
224
279
|
ssr: config.ssr ?? config.input,
|
|
225
280
|
ssrOutputDirectory: config.ssrOutputDirectory ?? "bootstrap/ssr",
|
|
226
281
|
refresh: config.refresh ?? false,
|
|
227
|
-
hotFile: config.hotFile ?? import_path.default.join(config.
|
|
282
|
+
hotFile: config.hotFile ?? import_path.default.join(config.assetDirectory ?? "hot"),
|
|
228
283
|
detectTls: config.detectTls ?? false,
|
|
229
284
|
transformOnServe: config.transformOnServe ?? ((code) => code)
|
|
230
285
|
};
|
|
231
286
|
}
|
|
232
287
|
function resolveBase(config, assetUrl) {
|
|
233
|
-
return assetUrl + (assetUrl.endsWith("/") ? "" : "/")
|
|
288
|
+
return assetUrl + (config.assetUrl.endsWith("/") ? "" : "/");
|
|
234
289
|
}
|
|
235
290
|
function resolveInput(config, ssr) {
|
|
236
291
|
if (ssr) {
|
|
@@ -242,9 +297,11 @@ function resolveOutDir(config, ssr) {
|
|
|
242
297
|
if (ssr) {
|
|
243
298
|
return config.ssrOutputDirectory;
|
|
244
299
|
}
|
|
245
|
-
return import_path.default.join(config.
|
|
300
|
+
return import_path.default.join(config.buildDirectory);
|
|
246
301
|
}
|
|
247
|
-
function resolveFullReloadConfig({
|
|
302
|
+
function resolveFullReloadConfig({
|
|
303
|
+
refresh: config
|
|
304
|
+
}) {
|
|
248
305
|
if (typeof config === "boolean") {
|
|
249
306
|
return [];
|
|
250
307
|
}
|
|
@@ -299,11 +356,15 @@ function resolveEnvironmentServerConfig(env) {
|
|
|
299
356
|
return;
|
|
300
357
|
}
|
|
301
358
|
if (!import_fs.default.existsSync(env.VITE_DEV_SERVER_KEY) || !import_fs.default.existsSync(env.VITE_DEV_SERVER_CERT)) {
|
|
302
|
-
throw Error(
|
|
359
|
+
throw Error(
|
|
360
|
+
`Unable to find the certificate files specified in your environment. Ensure you have correctly configured VITE_DEV_SERVER_KEY: [${env.VITE_DEV_SERVER_KEY}] and VITE_DEV_SERVER_CERT: [${env.VITE_DEV_SERVER_CERT}].`
|
|
361
|
+
);
|
|
303
362
|
}
|
|
304
363
|
const host = resolveHostFromEnv(env);
|
|
305
364
|
if (!host) {
|
|
306
|
-
throw Error(
|
|
365
|
+
throw Error(
|
|
366
|
+
`Unable to determine the host from the environment's APP_URL: [${env.APP_URL}].`
|
|
367
|
+
);
|
|
307
368
|
}
|
|
308
369
|
return {
|
|
309
370
|
hmr: { host },
|
|
@@ -330,7 +391,9 @@ function resolveDevelopmentEnvironmentServerConfig(host) {
|
|
|
330
391
|
const keyPath = import_path.default.resolve(configPath, "certs", `${host}.key`);
|
|
331
392
|
const certPath = import_path.default.resolve(configPath, "certs", `${host}.crt`);
|
|
332
393
|
if (!import_fs.default.existsSync(keyPath) || !import_fs.default.existsSync(certPath)) {
|
|
333
|
-
throw Error(
|
|
394
|
+
throw Error(
|
|
395
|
+
`Unable to find certificate files for your host [${host}] in the [${configPath}/certs] directory.`
|
|
396
|
+
);
|
|
334
397
|
}
|
|
335
398
|
return {
|
|
336
399
|
hmr: { host },
|
|
@@ -351,9 +414,13 @@ function determineDevelopmentEnvironmentConfigPath() {
|
|
|
351
414
|
function resolveDevelopmentEnvironmentHost(configPath) {
|
|
352
415
|
const configFile = import_path.default.resolve(configPath, "config.json");
|
|
353
416
|
if (!import_fs.default.existsSync(configFile)) {
|
|
354
|
-
throw Error(
|
|
417
|
+
throw Error(
|
|
418
|
+
`Unable to find the configuration file [${configFile}]. You will need to manually specify the host in the \`detectTls\` configuration option.`
|
|
419
|
+
);
|
|
355
420
|
}
|
|
356
|
-
const config = JSON.parse(
|
|
421
|
+
const config = JSON.parse(
|
|
422
|
+
import_fs.default.readFileSync(configFile, "utf-8")
|
|
423
|
+
);
|
|
357
424
|
return import_path.default.basename(process.cwd()) + "." + config.tld;
|
|
358
425
|
}
|
|
359
426
|
function dirname() {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,44 @@
|
|
|
1
|
-
import { Plugin, UserConfig, ConfigEnv } from
|
|
2
|
-
import { Config as FullReloadConfig } from
|
|
1
|
+
import { Plugin, UserConfig, ConfigEnv } from "vite";
|
|
2
|
+
import { Config as FullReloadConfig } from "vite-plugin-full-reload";
|
|
3
3
|
interface PluginConfig {
|
|
4
4
|
/**
|
|
5
5
|
* The path or paths of the entry points to compile.
|
|
6
6
|
*/
|
|
7
7
|
input: string | string[];
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* The base path to use for all asset URLs.
|
|
10
10
|
*
|
|
11
|
-
* @default '
|
|
11
|
+
* @default '/static/'
|
|
12
|
+
*/
|
|
13
|
+
assetUrl?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The base directory for all Vite source
|
|
16
|
+
*
|
|
17
|
+
* @default undefined
|
|
12
18
|
*/
|
|
13
|
-
|
|
19
|
+
rootDirectory?: string | undefined;
|
|
14
20
|
/**
|
|
15
|
-
* The public
|
|
21
|
+
* The public directory where all compiled assets should be written.
|
|
16
22
|
*
|
|
17
|
-
* @default '
|
|
23
|
+
* @default 'public'
|
|
18
24
|
*/
|
|
19
25
|
buildDirectory?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The directory where all typescript/javascript source are written. This is used as the default "@" alias is pointed.
|
|
28
|
+
*
|
|
29
|
+
* @default 'resources'
|
|
30
|
+
*/
|
|
31
|
+
resourceDirectory?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Litestar's public assets directory. These are the assets that Vite will serve when developing.
|
|
34
|
+
*
|
|
35
|
+
* @default '${resourceDirectory}/assets'
|
|
36
|
+
*/
|
|
37
|
+
assetDirectory?: string;
|
|
20
38
|
/**
|
|
21
39
|
* The path to the "hot" file.
|
|
22
40
|
*
|
|
23
|
-
* @default `${
|
|
41
|
+
* @default `${assetDirectory}/hot`
|
|
24
42
|
*/
|
|
25
43
|
hotFile?: string;
|
|
26
44
|
/**
|
|
@@ -30,7 +48,7 @@ interface PluginConfig {
|
|
|
30
48
|
/**
|
|
31
49
|
* The directory where the SSR bundle should be written.
|
|
32
50
|
*
|
|
33
|
-
* @default 'bootstrap/ssr'
|
|
51
|
+
* @default '${assetDirectory}/bootstrap/ssr'
|
|
34
52
|
*/
|
|
35
53
|
ssrOutputDirectory?: string;
|
|
36
54
|
/**
|
|
@@ -58,7 +76,7 @@ interface RefreshConfig {
|
|
|
58
76
|
interface LitestarPlugin extends Plugin {
|
|
59
77
|
config: (config: UserConfig, env: ConfigEnv) => UserConfig;
|
|
60
78
|
}
|
|
61
|
-
type DevServerUrl = `${
|
|
79
|
+
type DevServerUrl = `${"http" | "https"}://${string}:${number}`;
|
|
62
80
|
export declare const refreshPaths: string[];
|
|
63
81
|
/**
|
|
64
82
|
* Litestar plugin for Vite.
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,9 @@ import fs from "fs";
|
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import colors from "picocolors";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
loadEnv
|
|
7
|
+
} from "vite";
|
|
6
8
|
import fullReload from "vite-plugin-full-reload";
|
|
7
9
|
let exitHandlersBound = false;
|
|
8
10
|
const refreshPaths = [
|
|
@@ -23,7 +25,7 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
23
25
|
let resolvedConfig;
|
|
24
26
|
let userConfig;
|
|
25
27
|
const defaultAliases = {
|
|
26
|
-
"@": "/resources/
|
|
28
|
+
"@": pluginConfig.resourceDirectory || "/resources/"
|
|
27
29
|
};
|
|
28
30
|
return {
|
|
29
31
|
name: "litestar",
|
|
@@ -32,11 +34,13 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
32
34
|
userConfig = config;
|
|
33
35
|
const ssr = !!userConfig.build?.ssr;
|
|
34
36
|
const env = loadEnv(mode, userConfig.envDir || process.cwd(), "");
|
|
35
|
-
const assetUrl = env.ASSET_URL
|
|
36
|
-
const serverConfig = command === "serve" ? resolveDevelopmentEnvironmentServerConfig(
|
|
37
|
+
const assetUrl = env.ASSET_URL || pluginConfig.assetUrl;
|
|
38
|
+
const serverConfig = command === "serve" ? resolveDevelopmentEnvironmentServerConfig(
|
|
39
|
+
pluginConfig.detectTls
|
|
40
|
+
) ?? resolveEnvironmentServerConfig(env) : void 0;
|
|
37
41
|
ensureCommandShouldRunInEnvironment(command, env);
|
|
38
42
|
return {
|
|
39
|
-
base: userConfig.base ?? (command === "build" ? resolveBase(pluginConfig, assetUrl) :
|
|
43
|
+
base: userConfig.base ?? (command === "build" ? resolveBase(pluginConfig, assetUrl) : pluginConfig.assetUrl),
|
|
40
44
|
publicDir: userConfig.publicDir ?? false,
|
|
41
45
|
build: {
|
|
42
46
|
manifest: userConfig.build?.manifest ?? !ssr,
|
|
@@ -87,7 +91,10 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
87
91
|
},
|
|
88
92
|
transform(code) {
|
|
89
93
|
if (resolvedConfig.command === "serve") {
|
|
90
|
-
code = code.replace(
|
|
94
|
+
code = code.replace(
|
|
95
|
+
/__litestar_vite_placeholder__/g,
|
|
96
|
+
viteDevServerUrl
|
|
97
|
+
);
|
|
91
98
|
return pluginConfig.transformOnServe(code, viteDevServerUrl);
|
|
92
99
|
}
|
|
93
100
|
},
|
|
@@ -98,13 +105,34 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
98
105
|
const address = server.httpServer?.address();
|
|
99
106
|
const isAddressInfo = (x) => typeof x === "object";
|
|
100
107
|
if (isAddressInfo(address)) {
|
|
101
|
-
viteDevServerUrl = resolveDevServerUrl(
|
|
108
|
+
viteDevServerUrl = resolveDevServerUrl(
|
|
109
|
+
address,
|
|
110
|
+
server.config,
|
|
111
|
+
userConfig
|
|
112
|
+
);
|
|
102
113
|
fs.writeFileSync(pluginConfig.hotFile, viteDevServerUrl);
|
|
103
114
|
setTimeout(() => {
|
|
104
|
-
server.config.logger.info(
|
|
105
|
-
|
|
115
|
+
server.config.logger.info(
|
|
116
|
+
`
|
|
117
|
+
${colors.red(
|
|
118
|
+
`${colors.bold(
|
|
119
|
+
"LITESTAR"
|
|
120
|
+
)} ${litestarVersion()}`
|
|
121
|
+
)} ${colors.dim("plugin")} ${colors.bold(
|
|
122
|
+
`v${pluginVersion()}`
|
|
123
|
+
)}`
|
|
124
|
+
);
|
|
106
125
|
server.config.logger.info("");
|
|
107
|
-
server.config.logger.info(
|
|
126
|
+
server.config.logger.info(
|
|
127
|
+
` ${colors.green("\u279C")} ${colors.bold(
|
|
128
|
+
"APP_URL"
|
|
129
|
+
)}: ${colors.cyan(
|
|
130
|
+
appUrl.replace(
|
|
131
|
+
/:(\d+)/,
|
|
132
|
+
(_, port) => `:${colors.bold(port)}`
|
|
133
|
+
)
|
|
134
|
+
)}`
|
|
135
|
+
);
|
|
108
136
|
}, 100);
|
|
109
137
|
}
|
|
110
138
|
});
|
|
@@ -124,7 +152,12 @@ function resolveLitestarPlugin(pluginConfig) {
|
|
|
124
152
|
if (req.url === "/index.html") {
|
|
125
153
|
res.statusCode = 404;
|
|
126
154
|
res.end(
|
|
127
|
-
fs.readFileSync(
|
|
155
|
+
fs.readFileSync(
|
|
156
|
+
path.join(
|
|
157
|
+
dirname(),
|
|
158
|
+
"dev-server-index.html"
|
|
159
|
+
)
|
|
160
|
+
).toString().replace(/{{ APP_URL }}/g, appUrl)
|
|
128
161
|
);
|
|
129
162
|
}
|
|
130
163
|
next();
|
|
@@ -137,23 +170,24 @@ function ensureCommandShouldRunInEnvironment(command, env) {
|
|
|
137
170
|
return;
|
|
138
171
|
}
|
|
139
172
|
if (typeof env.LITESTAR_MODE !== "undefined") {
|
|
140
|
-
throw Error(
|
|
173
|
+
throw Error(
|
|
174
|
+
"You should not run the Vite HMR server when Litestar is in production. You should build your assets for production instead. To disable this ENV check you may set LITESTAR_BYPASS_ENV_CHECK=1"
|
|
175
|
+
);
|
|
141
176
|
}
|
|
142
177
|
if (typeof env.CI !== "undefined") {
|
|
143
|
-
throw Error(
|
|
178
|
+
throw Error(
|
|
179
|
+
"You should not run the Vite HMR server in CI environments. You should build your assets for production instead. To disable this ENV check you may set LITESTAR_BYPASS_ENV_CHECK=1"
|
|
180
|
+
);
|
|
144
181
|
}
|
|
145
182
|
}
|
|
146
183
|
function litestarVersion() {
|
|
147
|
-
|
|
148
|
-
const composer = JSON.parse(fs.readFileSync("composer.lock").toString());
|
|
149
|
-
return composer.packages?.find((composerPackage) => composerPackage.name === "litestar/framework")?.version ?? "";
|
|
150
|
-
} catch {
|
|
151
|
-
return "";
|
|
152
|
-
}
|
|
184
|
+
return "";
|
|
153
185
|
}
|
|
154
186
|
function pluginVersion() {
|
|
155
187
|
try {
|
|
156
|
-
return JSON.parse(
|
|
188
|
+
return JSON.parse(
|
|
189
|
+
fs.readFileSync(path.join(dirname(), "../package.json")).toString()
|
|
190
|
+
)?.version;
|
|
157
191
|
} catch {
|
|
158
192
|
return "";
|
|
159
193
|
}
|
|
@@ -166,18 +200,38 @@ function resolvePluginConfig(config) {
|
|
|
166
200
|
config = { input: config, ssr: config };
|
|
167
201
|
}
|
|
168
202
|
if (typeof config.input === "undefined") {
|
|
169
|
-
throw new Error(
|
|
203
|
+
throw new Error(
|
|
204
|
+
'litestar-vite-plugin: missing configuration for "input".'
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
if (typeof config.rootDirectory === "undefined") {
|
|
208
|
+
config.rootDirectory = "";
|
|
209
|
+
}
|
|
210
|
+
if (typeof config.rootDirectory === "string") {
|
|
211
|
+
config.rootDirectory = config.rootDirectory.trim().replace(/^\/+/, "");
|
|
212
|
+
}
|
|
213
|
+
if (typeof config.resourceDirectory === "string") {
|
|
214
|
+
config.resourceDirectory = config.resourceDirectory.trim().replace(/^\/+/, "");
|
|
215
|
+
if (config.resourceDirectory === "") {
|
|
216
|
+
throw new Error(
|
|
217
|
+
"litestar-vite-plugin: resourceDirectory must be a subdirectory. E.g. 'resources'."
|
|
218
|
+
);
|
|
219
|
+
}
|
|
170
220
|
}
|
|
171
|
-
if (typeof config.
|
|
172
|
-
config.
|
|
173
|
-
if (config.
|
|
174
|
-
throw new Error(
|
|
221
|
+
if (typeof config.assetDirectory === "string") {
|
|
222
|
+
config.assetDirectory = config.assetDirectory.trim().replace(/^\/+/, "");
|
|
223
|
+
if (config.assetDirectory === "") {
|
|
224
|
+
throw new Error(
|
|
225
|
+
"litestar-vite-plugin: assetDirectory must be a subdirectory. E.g. 'assets'."
|
|
226
|
+
);
|
|
175
227
|
}
|
|
176
228
|
}
|
|
177
229
|
if (typeof config.buildDirectory === "string") {
|
|
178
230
|
config.buildDirectory = config.buildDirectory.trim().replace(/^\/+/, "").replace(/\/+$/, "");
|
|
179
231
|
if (config.buildDirectory === "") {
|
|
180
|
-
throw new Error(
|
|
232
|
+
throw new Error(
|
|
233
|
+
"litestar-vite-plugin: buildDirectory must be a subdirectory. E.g. 'public'."
|
|
234
|
+
);
|
|
181
235
|
}
|
|
182
236
|
}
|
|
183
237
|
if (typeof config.ssrOutputDirectory === "string") {
|
|
@@ -188,18 +242,21 @@ function resolvePluginConfig(config) {
|
|
|
188
242
|
}
|
|
189
243
|
return {
|
|
190
244
|
input: config.input,
|
|
191
|
-
|
|
192
|
-
|
|
245
|
+
assetUrl: config.assetUrl || (config.assetUrl ?? "static"),
|
|
246
|
+
rootDirectory: config.rootDirectory ?? void 0,
|
|
247
|
+
resourceDirectory: config.resourceDirectory ?? "",
|
|
248
|
+
assetDirectory: config.assetDirectory ?? "",
|
|
249
|
+
buildDirectory: config.buildDirectory || (config.buildDirectory ?? "public"),
|
|
193
250
|
ssr: config.ssr ?? config.input,
|
|
194
251
|
ssrOutputDirectory: config.ssrOutputDirectory ?? "bootstrap/ssr",
|
|
195
252
|
refresh: config.refresh ?? false,
|
|
196
|
-
hotFile: config.hotFile ?? path.join(config.
|
|
253
|
+
hotFile: config.hotFile ?? path.join(config.assetDirectory ?? "hot"),
|
|
197
254
|
detectTls: config.detectTls ?? false,
|
|
198
255
|
transformOnServe: config.transformOnServe ?? ((code) => code)
|
|
199
256
|
};
|
|
200
257
|
}
|
|
201
258
|
function resolveBase(config, assetUrl) {
|
|
202
|
-
return assetUrl + (assetUrl.endsWith("/") ? "" : "/")
|
|
259
|
+
return assetUrl + (config.assetUrl.endsWith("/") ? "" : "/");
|
|
203
260
|
}
|
|
204
261
|
function resolveInput(config, ssr) {
|
|
205
262
|
if (ssr) {
|
|
@@ -211,9 +268,11 @@ function resolveOutDir(config, ssr) {
|
|
|
211
268
|
if (ssr) {
|
|
212
269
|
return config.ssrOutputDirectory;
|
|
213
270
|
}
|
|
214
|
-
return path.join(config.
|
|
271
|
+
return path.join(config.buildDirectory);
|
|
215
272
|
}
|
|
216
|
-
function resolveFullReloadConfig({
|
|
273
|
+
function resolveFullReloadConfig({
|
|
274
|
+
refresh: config
|
|
275
|
+
}) {
|
|
217
276
|
if (typeof config === "boolean") {
|
|
218
277
|
return [];
|
|
219
278
|
}
|
|
@@ -268,11 +327,15 @@ function resolveEnvironmentServerConfig(env) {
|
|
|
268
327
|
return;
|
|
269
328
|
}
|
|
270
329
|
if (!fs.existsSync(env.VITE_DEV_SERVER_KEY) || !fs.existsSync(env.VITE_DEV_SERVER_CERT)) {
|
|
271
|
-
throw Error(
|
|
330
|
+
throw Error(
|
|
331
|
+
`Unable to find the certificate files specified in your environment. Ensure you have correctly configured VITE_DEV_SERVER_KEY: [${env.VITE_DEV_SERVER_KEY}] and VITE_DEV_SERVER_CERT: [${env.VITE_DEV_SERVER_CERT}].`
|
|
332
|
+
);
|
|
272
333
|
}
|
|
273
334
|
const host = resolveHostFromEnv(env);
|
|
274
335
|
if (!host) {
|
|
275
|
-
throw Error(
|
|
336
|
+
throw Error(
|
|
337
|
+
`Unable to determine the host from the environment's APP_URL: [${env.APP_URL}].`
|
|
338
|
+
);
|
|
276
339
|
}
|
|
277
340
|
return {
|
|
278
341
|
hmr: { host },
|
|
@@ -299,7 +362,9 @@ function resolveDevelopmentEnvironmentServerConfig(host) {
|
|
|
299
362
|
const keyPath = path.resolve(configPath, "certs", `${host}.key`);
|
|
300
363
|
const certPath = path.resolve(configPath, "certs", `${host}.crt`);
|
|
301
364
|
if (!fs.existsSync(keyPath) || !fs.existsSync(certPath)) {
|
|
302
|
-
throw Error(
|
|
365
|
+
throw Error(
|
|
366
|
+
`Unable to find certificate files for your host [${host}] in the [${configPath}/certs] directory.`
|
|
367
|
+
);
|
|
303
368
|
}
|
|
304
369
|
return {
|
|
305
370
|
hmr: { host },
|
|
@@ -320,9 +385,13 @@ function determineDevelopmentEnvironmentConfigPath() {
|
|
|
320
385
|
function resolveDevelopmentEnvironmentHost(configPath) {
|
|
321
386
|
const configFile = path.resolve(configPath, "config.json");
|
|
322
387
|
if (!fs.existsSync(configFile)) {
|
|
323
|
-
throw Error(
|
|
388
|
+
throw Error(
|
|
389
|
+
`Unable to find the configuration file [${configFile}]. You will need to manually specify the host in the \`detectTls\` configuration option.`
|
|
390
|
+
);
|
|
324
391
|
}
|
|
325
|
-
const config = JSON.parse(
|
|
392
|
+
const config = JSON.parse(
|
|
393
|
+
fs.readFileSync(configFile, "utf-8")
|
|
394
|
+
);
|
|
326
395
|
return path.basename(process.cwd()) + "." + config.tld;
|
|
327
396
|
}
|
|
328
397
|
function dirname() {
|