nuxt-files-sdk 0.0.4 → 0.1.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/LICENSE +1 -1
- package/README.md +44 -3
- package/dist/config/load.js +67 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/merge.d.ts +5 -0
- package/dist/config/merge.js +22 -0
- package/dist/config/merge.js.map +1 -0
- package/dist/config/prune.js +55 -0
- package/dist/config/prune.js.map +1 -0
- package/dist/config.d.ts +103 -91
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/devtools/auth.js +49 -0
- package/dist/devtools/auth.js.map +1 -0
- package/dist/devtools/client/app.js +8 -0
- package/dist/devtools/client/browser-agent-rpc-BXhoSh1z-DRoP5jHQ.js +1 -0
- package/dist/devtools/client/index.html +392 -72
- package/dist/devtools/devframe.js +66 -7
- package/dist/devtools/devframe.js.map +1 -1
- package/dist/devtools/diagnostics.d.ts +37 -0
- package/dist/devtools/diagnostics.js +39 -0
- package/dist/devtools/diagnostics.js.map +1 -0
- package/dist/devtools/enabled.d.ts +9 -0
- package/dist/devtools/enabled.js +3 -2
- package/dist/devtools/enabled.js.map +1 -1
- package/dist/devtools/files-read.d.ts +5 -0
- package/dist/devtools/files-read.js +7 -0
- package/dist/devtools/files-read.js.map +1 -0
- package/dist/devtools/files-write.d.ts +5 -0
- package/dist/devtools/files-write.js +7 -0
- package/dist/devtools/files-write.js.map +1 -0
- package/dist/devtools/files.js +51 -0
- package/dist/devtools/files.js.map +1 -0
- package/dist/devtools/index.js +30 -5
- package/dist/devtools/index.js.map +1 -1
- package/dist/devtools/nuxt-v3-handler.js +16 -4
- package/dist/devtools/nuxt-v3-handler.js.map +1 -1
- package/dist/devtools/nuxt-v3.js +1 -1
- package/dist/devtools/nuxt-v3.js.map +1 -1
- package/dist/devtools/nuxt-v4.js +37 -6
- package/dist/devtools/nuxt-v4.js.map +1 -1
- package/dist/devtools/snapshot.d.ts +12 -7
- package/dist/devtools/snapshot.js +15 -3
- package/dist/devtools/snapshot.js.map +1 -1
- package/dist/devtools/token.d.ts +14 -0
- package/dist/devtools/token.js +17 -0
- package/dist/devtools/token.js.map +1 -0
- package/dist/integration/nitro.d.ts +12 -1
- package/dist/integration/nitro.js +162 -41
- package/dist/integration/nitro.js.map +1 -1
- package/dist/module.d.ts +4 -6
- package/dist/module.js +37 -14
- package/dist/module.js.map +1 -1
- package/dist/nitro.d.ts +2 -4
- package/dist/nitro.js +2 -4
- package/dist/nitro.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/runtime/internal.d.ts +11 -0
- package/dist/runtime/internal.js +30 -0
- package/dist/runtime/internal.js.map +1 -0
- package/dist/runtime/normalize.js +29 -0
- package/dist/runtime/normalize.js.map +1 -0
- package/dist/runtime/provider-types.d.ts +53 -0
- package/dist/runtime/registry.d.ts +55 -8
- package/dist/runtime/registry.js +130 -63
- package/dist/runtime/registry.js.map +1 -1
- package/dist/runtime.d.ts +8 -9
- package/dist/runtime.js +8 -20
- package/dist/runtime.js.map +1 -1
- package/package.json +25 -19
- package/dist/plugins/versioning.d.ts +0 -3
- package/dist/plugins/versioning.js +0 -2
- package/dist/plugins.d.ts +0 -31
- package/dist/plugins.js +0 -16
|
@@ -6,22 +6,127 @@
|
|
|
6
6
|
<title>Files</title>
|
|
7
7
|
<style>
|
|
8
8
|
:root {
|
|
9
|
-
color-scheme: light
|
|
10
|
-
font-family:
|
|
9
|
+
color-scheme: light;
|
|
10
|
+
font-family:
|
|
11
|
+
Inter,
|
|
12
|
+
ui-sans-serif,
|
|
13
|
+
system-ui,
|
|
14
|
+
-apple-system,
|
|
15
|
+
BlinkMacSystemFont,
|
|
16
|
+
'Segoe UI',
|
|
17
|
+
sans-serif;
|
|
18
|
+
--background: #fafafa;
|
|
19
|
+
--surface: #ffffff;
|
|
20
|
+
--surface-muted: #f4f4f5;
|
|
21
|
+
--border: #e4e4e7;
|
|
22
|
+
--text: #18181b;
|
|
23
|
+
--muted: #71717a;
|
|
24
|
+
--accent: #00a96e;
|
|
25
|
+
--accent-soft: #e6f8f1;
|
|
26
|
+
--warning: #b45309;
|
|
27
|
+
--warning-soft: #fff7ed;
|
|
28
|
+
--error: #dc2626;
|
|
29
|
+
--error-soft: #fef2f2;
|
|
30
|
+
}
|
|
31
|
+
@media (prefers-color-scheme: dark) {
|
|
32
|
+
:root {
|
|
33
|
+
color-scheme: dark;
|
|
34
|
+
--background: #09090b;
|
|
35
|
+
--surface: #18181b;
|
|
36
|
+
--surface-muted: #27272a;
|
|
37
|
+
--border: #27272a;
|
|
38
|
+
--text: #f4f4f5;
|
|
39
|
+
--muted: #a1a1aa;
|
|
40
|
+
--accent: #00dc82;
|
|
41
|
+
--accent-soft: #0b3328;
|
|
42
|
+
--warning: #fbbf24;
|
|
43
|
+
--warning-soft: #3a2a12;
|
|
44
|
+
--error: #f87171;
|
|
45
|
+
--error-soft: #3b171c;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
* {
|
|
49
|
+
box-sizing: border-box;
|
|
11
50
|
}
|
|
12
51
|
body {
|
|
13
52
|
margin: 0;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
53
|
+
min-width: 320px;
|
|
54
|
+
min-height: 100vh;
|
|
55
|
+
background: var(--background);
|
|
56
|
+
color: var(--text);
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
line-height: 1.5;
|
|
59
|
+
-webkit-font-smoothing: antialiased;
|
|
60
|
+
}
|
|
61
|
+
.page-header {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 12px;
|
|
65
|
+
min-height: 64px;
|
|
66
|
+
padding: 12px 20px;
|
|
67
|
+
border-bottom: 1px solid var(--border);
|
|
68
|
+
background: color-mix(in srgb, var(--surface) 92%, transparent);
|
|
69
|
+
}
|
|
70
|
+
.app-icon {
|
|
71
|
+
display: grid;
|
|
72
|
+
flex: 0 0 auto;
|
|
73
|
+
width: 36px;
|
|
74
|
+
height: 36px;
|
|
75
|
+
place-items: center;
|
|
76
|
+
border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
|
|
77
|
+
border-radius: 9px;
|
|
78
|
+
background: var(--accent-soft);
|
|
79
|
+
color: var(--accent);
|
|
80
|
+
}
|
|
81
|
+
.app-icon svg {
|
|
82
|
+
width: 20px;
|
|
83
|
+
height: 20px;
|
|
17
84
|
}
|
|
18
85
|
h1 {
|
|
19
|
-
margin: 0
|
|
20
|
-
font-size:
|
|
86
|
+
margin: 0;
|
|
87
|
+
font-size: 15px;
|
|
88
|
+
font-weight: 600;
|
|
89
|
+
letter-spacing: -0.01em;
|
|
21
90
|
}
|
|
22
91
|
#summary {
|
|
23
|
-
margin: 0 0
|
|
24
|
-
color:
|
|
92
|
+
margin: 2px 0 0;
|
|
93
|
+
color: var(--muted);
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
}
|
|
96
|
+
.content {
|
|
97
|
+
display: grid;
|
|
98
|
+
gap: 16px;
|
|
99
|
+
padding: 20px;
|
|
100
|
+
}
|
|
101
|
+
.panel {
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
border: 1px solid var(--border);
|
|
104
|
+
border-radius: 10px;
|
|
105
|
+
background: var(--surface);
|
|
106
|
+
}
|
|
107
|
+
.panel-header {
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: space-between;
|
|
111
|
+
gap: 12px;
|
|
112
|
+
padding: 12px 14px;
|
|
113
|
+
border-bottom: 1px solid var(--border);
|
|
114
|
+
}
|
|
115
|
+
.panel-title {
|
|
116
|
+
min-width: 0;
|
|
117
|
+
}
|
|
118
|
+
h2 {
|
|
119
|
+
margin: 0;
|
|
120
|
+
font-size: 13px;
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
}
|
|
123
|
+
.panel-description {
|
|
124
|
+
margin: 2px 0 0;
|
|
125
|
+
color: var(--muted);
|
|
126
|
+
font-size: 12px;
|
|
127
|
+
}
|
|
128
|
+
.table-scroll {
|
|
129
|
+
overflow-x: auto;
|
|
25
130
|
}
|
|
26
131
|
table {
|
|
27
132
|
width: 100%;
|
|
@@ -29,85 +134,300 @@
|
|
|
29
134
|
}
|
|
30
135
|
th,
|
|
31
136
|
td {
|
|
32
|
-
padding: 10px;
|
|
33
|
-
border-bottom: 1px solid
|
|
137
|
+
padding: 10px 14px;
|
|
138
|
+
border-bottom: 1px solid var(--border);
|
|
34
139
|
text-align: left;
|
|
140
|
+
white-space: nowrap;
|
|
35
141
|
}
|
|
36
142
|
th {
|
|
143
|
+
background: var(--surface-muted);
|
|
144
|
+
color: var(--muted);
|
|
145
|
+
font-size: 11px;
|
|
146
|
+
font-weight: 500;
|
|
147
|
+
}
|
|
148
|
+
tbody tr:last-child td {
|
|
149
|
+
border-bottom: 0;
|
|
150
|
+
}
|
|
151
|
+
tbody tr:hover {
|
|
152
|
+
background: color-mix(in srgb, var(--surface-muted) 55%, transparent);
|
|
153
|
+
}
|
|
154
|
+
td:nth-child(2),
|
|
155
|
+
td:nth-child(3) {
|
|
156
|
+
font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
|
|
37
157
|
font-size: 12px;
|
|
38
|
-
color: GrayText;
|
|
39
|
-
text-transform: uppercase;
|
|
40
158
|
}
|
|
41
|
-
|
|
42
|
-
|
|
159
|
+
button,
|
|
160
|
+
select,
|
|
161
|
+
.upload-button {
|
|
162
|
+
min-height: 30px;
|
|
163
|
+
border: 1px solid var(--border);
|
|
164
|
+
border-radius: 7px;
|
|
165
|
+
background: var(--surface);
|
|
166
|
+
color: var(--text);
|
|
167
|
+
font: inherit;
|
|
168
|
+
}
|
|
169
|
+
button,
|
|
170
|
+
.upload-button {
|
|
171
|
+
padding: 5px 9px;
|
|
172
|
+
cursor: pointer;
|
|
173
|
+
}
|
|
174
|
+
button:hover,
|
|
175
|
+
.upload-button:hover {
|
|
176
|
+
background: var(--surface-muted);
|
|
177
|
+
}
|
|
178
|
+
button:focus-visible,
|
|
179
|
+
select:focus-visible,
|
|
180
|
+
.upload-button:focus-within {
|
|
181
|
+
outline: 2px solid var(--accent);
|
|
182
|
+
outline-offset: 2px;
|
|
183
|
+
}
|
|
184
|
+
select {
|
|
185
|
+
padding: 4px 28px 4px 9px;
|
|
186
|
+
}
|
|
187
|
+
.browser-actions,
|
|
188
|
+
.actions {
|
|
189
|
+
display: flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
gap: 8px;
|
|
192
|
+
}
|
|
193
|
+
.upload-button {
|
|
194
|
+
display: inline-flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
background: var(--accent);
|
|
197
|
+
color: #fff;
|
|
198
|
+
border-color: var(--accent);
|
|
199
|
+
}
|
|
200
|
+
.upload-button:hover {
|
|
201
|
+
background: color-mix(in srgb, var(--accent) 85%, #000);
|
|
202
|
+
}
|
|
203
|
+
.upload-button[hidden] {
|
|
204
|
+
display: none;
|
|
205
|
+
}
|
|
206
|
+
.upload-button input {
|
|
207
|
+
position: absolute;
|
|
208
|
+
width: 1px;
|
|
209
|
+
height: 1px;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
clip: rect(0, 0, 0, 0);
|
|
212
|
+
}
|
|
213
|
+
.browser-toolbar {
|
|
214
|
+
display: flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
justify-content: space-between;
|
|
217
|
+
gap: 12px;
|
|
218
|
+
min-height: 44px;
|
|
219
|
+
padding: 6px 14px;
|
|
220
|
+
border-bottom: 1px solid var(--border);
|
|
221
|
+
background: var(--surface-muted);
|
|
222
|
+
}
|
|
223
|
+
#breadcrumbs {
|
|
224
|
+
display: flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
gap: 6px;
|
|
227
|
+
min-width: 0;
|
|
228
|
+
overflow-x: auto;
|
|
229
|
+
color: var(--muted);
|
|
230
|
+
}
|
|
231
|
+
.breadcrumb,
|
|
232
|
+
.folder,
|
|
233
|
+
.row-action {
|
|
234
|
+
min-height: auto;
|
|
235
|
+
padding: 2px 5px;
|
|
236
|
+
border: 0;
|
|
237
|
+
background: transparent;
|
|
238
|
+
}
|
|
239
|
+
.breadcrumb,
|
|
240
|
+
.folder {
|
|
241
|
+
color: var(--text);
|
|
242
|
+
}
|
|
243
|
+
.folder {
|
|
244
|
+
padding: 0;
|
|
245
|
+
font-weight: 500;
|
|
246
|
+
}
|
|
247
|
+
.row-action {
|
|
248
|
+
color: var(--accent);
|
|
249
|
+
font-size: 12px;
|
|
250
|
+
}
|
|
251
|
+
.file-name {
|
|
252
|
+
max-width: 360px;
|
|
253
|
+
overflow: hidden;
|
|
254
|
+
text-overflow: ellipsis;
|
|
255
|
+
}
|
|
256
|
+
.folder-detail,
|
|
257
|
+
#browser-status {
|
|
258
|
+
color: var(--muted);
|
|
259
|
+
font-size: 12px;
|
|
260
|
+
}
|
|
261
|
+
#browser-status {
|
|
262
|
+
margin: 0;
|
|
263
|
+
padding: 8px 14px;
|
|
264
|
+
border-top: 1px solid var(--border);
|
|
265
|
+
}
|
|
266
|
+
.error-text {
|
|
267
|
+
color: var(--error) !important;
|
|
268
|
+
}
|
|
269
|
+
.access-badge {
|
|
270
|
+
padding: 2px 8px;
|
|
271
|
+
border-radius: 999px;
|
|
272
|
+
background: var(--surface-muted);
|
|
273
|
+
color: var(--muted);
|
|
274
|
+
font-size: 11px;
|
|
275
|
+
white-space: nowrap;
|
|
276
|
+
}
|
|
277
|
+
.access-badge.write {
|
|
278
|
+
background: var(--accent-soft);
|
|
279
|
+
color: var(--accent);
|
|
280
|
+
}
|
|
281
|
+
.status {
|
|
282
|
+
display: inline-flex;
|
|
283
|
+
align-items: center;
|
|
284
|
+
gap: 6px;
|
|
285
|
+
padding: 2px 8px;
|
|
286
|
+
border-radius: 999px;
|
|
287
|
+
font-size: 11px;
|
|
288
|
+
font-weight: 500;
|
|
289
|
+
}
|
|
290
|
+
.status::before {
|
|
291
|
+
width: 6px;
|
|
292
|
+
height: 6px;
|
|
293
|
+
border-radius: 999px;
|
|
294
|
+
background: currentColor;
|
|
295
|
+
content: '';
|
|
296
|
+
}
|
|
297
|
+
.status.success {
|
|
298
|
+
background: var(--accent-soft);
|
|
299
|
+
color: var(--accent);
|
|
300
|
+
}
|
|
301
|
+
.status.idle {
|
|
302
|
+
background: var(--surface-muted);
|
|
303
|
+
color: var(--muted);
|
|
304
|
+
}
|
|
305
|
+
#diagnostics {
|
|
306
|
+
padding: 14px;
|
|
307
|
+
}
|
|
308
|
+
.empty-state {
|
|
309
|
+
color: var(--muted);
|
|
310
|
+
font-size: 12px;
|
|
43
311
|
}
|
|
44
312
|
.warning,
|
|
45
313
|
.error {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
314
|
+
margin: 0 0 8px;
|
|
315
|
+
padding: 10px 12px;
|
|
316
|
+
border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
|
|
317
|
+
border-radius: 8px;
|
|
318
|
+
background: var(--warning-soft);
|
|
319
|
+
color: var(--warning);
|
|
49
320
|
}
|
|
50
321
|
.error {
|
|
51
|
-
|
|
322
|
+
border-color: color-mix(in srgb, var(--error) 30%, transparent);
|
|
323
|
+
background: var(--error-soft);
|
|
324
|
+
color: var(--error);
|
|
325
|
+
}
|
|
326
|
+
.warning:last-child,
|
|
327
|
+
.error:last-child {
|
|
328
|
+
margin-bottom: 0;
|
|
329
|
+
}
|
|
330
|
+
@media (max-width: 640px) {
|
|
331
|
+
.page-header,
|
|
332
|
+
.content {
|
|
333
|
+
padding-right: 14px;
|
|
334
|
+
padding-left: 14px;
|
|
335
|
+
}
|
|
336
|
+
.panel-header,
|
|
337
|
+
.browser-toolbar {
|
|
338
|
+
align-items: flex-start;
|
|
339
|
+
flex-direction: column;
|
|
340
|
+
}
|
|
341
|
+
.browser-actions {
|
|
342
|
+
width: 100%;
|
|
343
|
+
flex-wrap: wrap;
|
|
344
|
+
}
|
|
52
345
|
}
|
|
53
346
|
</style>
|
|
54
347
|
</head>
|
|
55
348
|
<body>
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
349
|
+
<header class="page-header">
|
|
350
|
+
<span class="app-icon" aria-hidden="true">
|
|
351
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75">
|
|
352
|
+
<path
|
|
353
|
+
d="M3.75 6.75A1.75 1.75 0 0 1 5.5 5h4l2 2h7A1.75 1.75 0 0 1 20.25 8.75v8.75a1.75 1.75 0 0 1-1.75 1.75h-13a1.75 1.75 0 0 1-1.75-1.75V6.75Z"
|
|
354
|
+
/>
|
|
355
|
+
</svg>
|
|
356
|
+
</span>
|
|
357
|
+
<div>
|
|
358
|
+
<h1>Files</h1>
|
|
359
|
+
<p id="summary" aria-live="polite">Loading resolved configuration…</p>
|
|
360
|
+
</div>
|
|
361
|
+
</header>
|
|
362
|
+
<main class="content">
|
|
363
|
+
<section class="panel" aria-labelledby="browser-heading">
|
|
364
|
+
<header class="panel-header">
|
|
365
|
+
<div class="panel-title">
|
|
366
|
+
<h2 id="browser-heading">File browser</h2>
|
|
367
|
+
<p class="panel-description">Browse and manage the selected development storage.</p>
|
|
368
|
+
</div>
|
|
369
|
+
<div class="browser-actions">
|
|
370
|
+
<span id="access-badge" class="access-badge" hidden></span>
|
|
371
|
+
<select id="storage-select" aria-label="Storage" hidden></select>
|
|
372
|
+
<button id="refresh" type="button">Refresh</button>
|
|
373
|
+
<label class="upload-button" hidden>
|
|
374
|
+
Upload
|
|
375
|
+
<input id="upload" type="file" />
|
|
376
|
+
</label>
|
|
377
|
+
</div>
|
|
378
|
+
</header>
|
|
379
|
+
<nav id="breadcrumbs" class="browser-toolbar" aria-label="Current folder"></nav>
|
|
380
|
+
<div class="table-scroll">
|
|
381
|
+
<table>
|
|
382
|
+
<thead>
|
|
383
|
+
<tr>
|
|
384
|
+
<th>Name</th>
|
|
385
|
+
<th>Size</th>
|
|
386
|
+
<th>Type</th>
|
|
387
|
+
<th>Modified</th>
|
|
388
|
+
<th>Actions</th>
|
|
389
|
+
</tr>
|
|
390
|
+
</thead>
|
|
391
|
+
<tbody id="files"></tbody>
|
|
392
|
+
</table>
|
|
393
|
+
</div>
|
|
394
|
+
<div aria-label="File pages">
|
|
395
|
+
<button id="previous-page" type="button" disabled>Previous</button>
|
|
396
|
+
<button id="next-page" type="button" disabled>Next</button>
|
|
397
|
+
</div>
|
|
398
|
+
<p id="browser-status" aria-live="polite">Loading…</p>
|
|
399
|
+
</section>
|
|
400
|
+
<section class="panel" aria-labelledby="storages-heading">
|
|
401
|
+
<header class="panel-header">
|
|
402
|
+
<div class="panel-title">
|
|
403
|
+
<h2 id="storages-heading">Storages</h2>
|
|
404
|
+
<p class="panel-description">Resolved adapters and runtime initialization status.</p>
|
|
405
|
+
</div>
|
|
406
|
+
</header>
|
|
407
|
+
<div class="table-scroll">
|
|
408
|
+
<table>
|
|
409
|
+
<thead>
|
|
410
|
+
<tr>
|
|
411
|
+
<th>Name</th>
|
|
412
|
+
<th>Adapter</th>
|
|
413
|
+
<th>Plugins</th>
|
|
414
|
+
<th>Status</th>
|
|
415
|
+
</tr>
|
|
416
|
+
</thead>
|
|
417
|
+
<tbody id="storages"></tbody>
|
|
418
|
+
</table>
|
|
419
|
+
</div>
|
|
73
420
|
</section>
|
|
74
|
-
<section aria-labelledby="diagnostics-heading">
|
|
75
|
-
<
|
|
76
|
-
|
|
421
|
+
<section class="panel" aria-labelledby="diagnostics-heading">
|
|
422
|
+
<header class="panel-header">
|
|
423
|
+
<div class="panel-title">
|
|
424
|
+
<h2 id="diagnostics-heading">Diagnostics</h2>
|
|
425
|
+
<p class="panel-description">Integration issues detected by the current development server.</p>
|
|
426
|
+
</div>
|
|
427
|
+
</header>
|
|
428
|
+
<div id="diagnostics" class="empty-state"></div>
|
|
77
429
|
</section>
|
|
78
430
|
</main>
|
|
79
|
-
<script type="module">
|
|
80
|
-
const snapshot = await fetch('./snapshot').then((response) => response.json())
|
|
81
|
-
document.querySelector('#summary').textContent =
|
|
82
|
-
`${snapshot.storages.length} configured storage${snapshot.storages.length === 1 ? '' : 's'}`
|
|
83
|
-
document.querySelector('#storages').replaceChildren(
|
|
84
|
-
...snapshot.storages.map((storage) => {
|
|
85
|
-
const row = document.createElement('tr')
|
|
86
|
-
for (const value of [
|
|
87
|
-
storage.name ?? 'Single storage',
|
|
88
|
-
storage.adapter,
|
|
89
|
-
storage.plugins.join(', ') || '—',
|
|
90
|
-
storage.source,
|
|
91
|
-
storage.initialized ? 'Initialized' : 'Not initialized',
|
|
92
|
-
]) {
|
|
93
|
-
const cell = document.createElement('td')
|
|
94
|
-
cell.textContent = value
|
|
95
|
-
row.append(cell)
|
|
96
|
-
}
|
|
97
|
-
return row
|
|
98
|
-
}),
|
|
99
|
-
)
|
|
100
|
-
const diagnostics = document.querySelector('#diagnostics')
|
|
101
|
-
if (!snapshot.diagnostics.length) diagnostics.textContent = 'No integration diagnostics.'
|
|
102
|
-
else
|
|
103
|
-
diagnostics.replaceChildren(
|
|
104
|
-
...snapshot.diagnostics.map((item) => {
|
|
105
|
-
const message = document.createElement('p')
|
|
106
|
-
message.className = item.level
|
|
107
|
-
message.textContent = `${item.code}: ${item.message}`
|
|
108
|
-
return message
|
|
109
|
-
}),
|
|
110
|
-
)
|
|
111
|
-
</script>
|
|
431
|
+
<script type="module" src="./app.js"></script>
|
|
112
432
|
</body>
|
|
113
433
|
</html>
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { createFilesDevtoolsToken } from "./auth.js";
|
|
2
|
+
import { FILES_DEVTOOLS_DIAGNOSTICS, createFilesDevtoolsDiagnostic, isFilesDevtoolsDiagnostic, isFilesDevtoolsFailure } from "./diagnostics.js";
|
|
1
3
|
import { FILES_DEVTOOLS_PATH } from "./snapshot.js";
|
|
2
4
|
import { version } from "../package.js";
|
|
3
5
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { defineDevframe } from "devframe";
|
|
6
|
+
import { defineDevframe, defineRpcFunction } from "devframe";
|
|
5
7
|
//#region src/devtools/devframe.ts
|
|
6
|
-
|
|
8
|
+
const clientAssets = fileURLToPath(new URL("./client", import.meta.url));
|
|
9
|
+
const messageTitles = {
|
|
10
|
+
upload: "Files upload failed",
|
|
11
|
+
delete: "Files delete failed",
|
|
12
|
+
initialization: "Files storage initialization failed",
|
|
13
|
+
gateway: "Files DevTools gateway failed"
|
|
14
|
+
};
|
|
15
|
+
const createFilesDevframe = ({ write, maxUploadSize, tokenSecret, notifyFailure }) => defineDevframe({
|
|
7
16
|
id: "nuxt-files-sdk",
|
|
8
17
|
name: "Files",
|
|
9
18
|
version,
|
|
@@ -12,13 +21,63 @@ var devframe_default = defineDevframe({
|
|
|
12
21
|
homepage: "https://github.com/liria24/nuxt-files-sdk",
|
|
13
22
|
description: "Files SDK storage and integration diagnostics for Nuxt.",
|
|
14
23
|
icon: "ph:files-duotone",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
context.views.hostStatic(FILES_DEVTOOLS_PATH,
|
|
24
|
+
clientAssets,
|
|
25
|
+
async setup(context) {
|
|
26
|
+
await context.host.mountConnectionMeta?.(FILES_DEVTOOLS_PATH);
|
|
27
|
+
context.views.hostStatic(FILES_DEVTOOLS_PATH, clientAssets);
|
|
28
|
+
const definitions = Object.fromEntries(Object.entries(FILES_DEVTOOLS_DIAGNOSTICS).map(([code, diagnostic]) => [code, {
|
|
29
|
+
why: ({ message }) => message ?? diagnostic.message,
|
|
30
|
+
fix: diagnostic.hint,
|
|
31
|
+
docs: diagnostic.docs
|
|
32
|
+
}]));
|
|
33
|
+
const diagnostics = context.diagnostics.defineDiagnostics({ codes: definitions });
|
|
34
|
+
context.diagnostics.register(diagnostics);
|
|
35
|
+
const reported = /* @__PURE__ */ new Set();
|
|
36
|
+
const reportDiagnostic = (diagnostic, cause) => {
|
|
37
|
+
const key = `${diagnostic.code}:${diagnostic.message}`;
|
|
38
|
+
if (reported.has(key)) return;
|
|
39
|
+
reported.add(key);
|
|
40
|
+
diagnostics[diagnostic.code]?.({
|
|
41
|
+
message: diagnostic.message,
|
|
42
|
+
...cause === void 0 ? {} : { cause }
|
|
43
|
+
}, { method: diagnostic.level === "info" ? "log" : diagnostic.level === "warning" ? "warn" : "error" });
|
|
44
|
+
};
|
|
45
|
+
const scoped = context.scope("nuxt-files-sdk");
|
|
46
|
+
scoped.rpc.register(defineRpcFunction({
|
|
47
|
+
name: "issue-http-token",
|
|
48
|
+
type: "query",
|
|
49
|
+
handler: () => createFilesDevtoolsToken(tokenSecret)
|
|
50
|
+
}));
|
|
51
|
+
scoped.rpc.register(defineRpcFunction({
|
|
52
|
+
name: "report-diagnostics",
|
|
53
|
+
type: "event",
|
|
54
|
+
handler(value) {
|
|
55
|
+
if (Array.isArray(value)) value.filter(isFilesDevtoolsDiagnostic).forEach((item) => reportDiagnostic(item));
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
scoped.rpc.register(defineRpcFunction({
|
|
59
|
+
name: "report-failure",
|
|
60
|
+
type: "event",
|
|
61
|
+
handler(value) {
|
|
62
|
+
if (!isFilesDevtoolsFailure(value)) return;
|
|
63
|
+
if (!write && (value.kind === "upload" || value.kind === "delete")) return;
|
|
64
|
+
const description = value.kind === "upload" ? `${value.message}\nMaximum upload size: ${maxUploadSize} bytes.` : value.message;
|
|
65
|
+
notifyFailure({
|
|
66
|
+
id: `nuxt-files-sdk:${value.kind}:${value.target ?? "default"}`,
|
|
67
|
+
message: messageTitles[value.kind],
|
|
68
|
+
level: "error",
|
|
69
|
+
description,
|
|
70
|
+
category: "nuxt-files-sdk",
|
|
71
|
+
labels: ["nuxt-files-sdk", value.kind],
|
|
72
|
+
notify: true
|
|
73
|
+
});
|
|
74
|
+
if (value.kind === "initialization") reportDiagnostic(createFilesDevtoolsDiagnostic("NUXT_FILES_ADAPTER_INIT_FAILED"), value.message);
|
|
75
|
+
else if (value.kind === "gateway") reportDiagnostic(createFilesDevtoolsDiagnostic("NUXT_FILES_GATEWAY_FAILED"), value.message);
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
19
78
|
}
|
|
20
79
|
});
|
|
21
80
|
//#endregion
|
|
22
|
-
export {
|
|
81
|
+
export { createFilesDevframe };
|
|
23
82
|
|
|
24
83
|
//# sourceMappingURL=devframe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devframe.js","names":[],"sources":["../../src/devtools/devframe.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url'\n\nimport { defineDevframe } from 'devframe'\n\nimport { version } from '../../package.json'\nimport { FILES_DEVTOOLS_PATH } from './snapshot'\n\nexport
|
|
1
|
+
{"version":3,"file":"devframe.js","names":[],"sources":["../../src/devtools/devframe.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url'\n\nimport { defineDevframe, defineRpcFunction } from 'devframe'\n\nimport { version } from '../../package.json'\nimport { createFilesDevtoolsToken } from './auth'\nimport {\n createFilesDevtoolsDiagnostic,\n FILES_DEVTOOLS_DIAGNOSTICS,\n isFilesDevtoolsDiagnostic,\n isFilesDevtoolsFailure,\n type FilesDevtoolsDiagnostic,\n} from './diagnostics'\nimport { FILES_DEVTOOLS_PATH } from './snapshot'\n\ninterface FilesDevframeMessage {\n id: string\n message: string\n level: 'error'\n description: string\n category: string\n labels: string[]\n notify: true\n}\n\nexport interface FilesDevframeOptions {\n write: boolean\n maxUploadSize: number\n tokenSecret: string\n notifyFailure: (message: FilesDevframeMessage) => unknown\n}\n\nconst clientAssets = fileURLToPath(new URL('./client', import.meta.url))\nconst messageTitles = {\n upload: 'Files upload failed',\n delete: 'Files delete failed',\n initialization: 'Files storage initialization failed',\n gateway: 'Files DevTools gateway failed',\n} as const\n\nexport const createFilesDevframe = ({ write, maxUploadSize, tokenSecret, notifyFailure }: FilesDevframeOptions) =>\n defineDevframe({\n id: 'nuxt-files-sdk',\n name: 'Files',\n version,\n packageName: 'nuxt-files-sdk',\n importMetaUrl: import.meta.url,\n homepage: 'https://github.com/liria24/nuxt-files-sdk',\n description: 'Files SDK storage and integration diagnostics for Nuxt.',\n icon: 'ph:files-duotone',\n clientAssets,\n async setup(context) {\n await context.host.mountConnectionMeta?.(FILES_DEVTOOLS_PATH)\n context.views.hostStatic(FILES_DEVTOOLS_PATH, clientAssets)\n\n const definitions = Object.fromEntries(\n Object.entries(FILES_DEVTOOLS_DIAGNOSTICS).map(([code, diagnostic]) => [\n code,\n {\n why: ({ message }: { message?: string }) => message ?? diagnostic.message,\n fix: diagnostic.hint,\n docs: diagnostic.docs,\n },\n ]),\n )\n const diagnostics = context.diagnostics.defineDiagnostics({ codes: definitions })\n context.diagnostics.register(diagnostics)\n const reported = new Set<string>()\n const reportDiagnostic = (diagnostic: FilesDevtoolsDiagnostic, cause?: unknown): void => {\n const key = `${diagnostic.code}:${diagnostic.message}`\n if (reported.has(key)) return\n reported.add(key)\n diagnostics[diagnostic.code]?.(\n { message: diagnostic.message, ...(cause === undefined ? {} : { cause }) },\n { method: diagnostic.level === 'info' ? 'log' : diagnostic.level === 'warning' ? 'warn' : 'error' },\n )\n }\n\n const scoped = context.scope('nuxt-files-sdk')\n scoped.rpc.register(\n defineRpcFunction({\n name: 'issue-http-token',\n type: 'query',\n handler: () => createFilesDevtoolsToken(tokenSecret),\n }),\n )\n scoped.rpc.register(\n defineRpcFunction({\n name: 'report-diagnostics',\n type: 'event',\n handler(value: unknown) {\n if (Array.isArray(value))\n value.filter(isFilesDevtoolsDiagnostic).forEach((item) => reportDiagnostic(item))\n },\n }),\n )\n scoped.rpc.register(\n defineRpcFunction({\n name: 'report-failure',\n type: 'event',\n handler(value: unknown) {\n if (!isFilesDevtoolsFailure(value)) return\n if (!write && (value.kind === 'upload' || value.kind === 'delete')) return\n const description =\n value.kind === 'upload'\n ? `${value.message}\\nMaximum upload size: ${maxUploadSize} bytes.`\n : value.message\n void notifyFailure({\n id: `nuxt-files-sdk:${value.kind}:${value.target ?? 'default'}`,\n message: messageTitles[value.kind],\n level: 'error',\n description,\n category: 'nuxt-files-sdk',\n labels: ['nuxt-files-sdk', value.kind],\n notify: true,\n })\n if (value.kind === 'initialization') {\n reportDiagnostic(\n createFilesDevtoolsDiagnostic('NUXT_FILES_ADAPTER_INIT_FAILED'),\n value.message,\n )\n } else if (value.kind === 'gateway') {\n reportDiagnostic(createFilesDevtoolsDiagnostic('NUXT_FILES_GATEWAY_FAILED'), value.message)\n }\n },\n }),\n )\n },\n })\n"],"mappings":";;;;;;;AAgCA,MAAM,eAAe,cAAc,IAAI,IAAI,YAAY,YAAY,GAAG,CAAC;AACvE,MAAM,gBAAgB;CAClB,QAAQ;CACR,QAAQ;CACR,gBAAgB;CAChB,SAAS;AACb;AAEA,MAAa,uBAAuB,EAAE,OAAO,eAAe,aAAa,oBACrE,eAAe;CACX,IAAI;CACJ,MAAM;CACN;CACA,aAAa;CACb,eAAe,YAAY;CAC3B,UAAU;CACV,aAAa;CACb,MAAM;CACN;CACA,MAAM,MAAM,SAAS;EACjB,MAAM,QAAQ,KAAK,sBAAsB,mBAAmB;EAC5D,QAAQ,MAAM,WAAW,qBAAqB,YAAY;EAE1D,MAAM,cAAc,OAAO,YACvB,OAAO,QAAQ,0BAA0B,CAAC,CAAC,KAAK,CAAC,MAAM,gBAAgB,CACnE,MACA;GACI,MAAM,EAAE,cAAoC,WAAW,WAAW;GAClE,KAAK,WAAW;GAChB,MAAM,WAAW;EACrB,CACJ,CAAC,CACL;EACA,MAAM,cAAc,QAAQ,YAAY,kBAAkB,EAAE,OAAO,YAAY,CAAC;EAChF,QAAQ,YAAY,SAAS,WAAW;EACxC,MAAM,2BAAW,IAAI,IAAY;EACjC,MAAM,oBAAoB,YAAqC,UAA0B;GACrF,MAAM,MAAM,GAAG,WAAW,KAAK,GAAG,WAAW;GAC7C,IAAI,SAAS,IAAI,GAAG,GAAG;GACvB,SAAS,IAAI,GAAG;GAChB,YAAY,WAAW,KAAK,GACxB;IAAE,SAAS,WAAW;IAAS,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;GAAG,GACzE,EAAE,QAAQ,WAAW,UAAU,SAAS,QAAQ,WAAW,UAAU,YAAY,SAAS,QAAQ,CACtG;EACJ;EAEA,MAAM,SAAS,QAAQ,MAAM,gBAAgB;EAC7C,OAAO,IAAI,SACP,kBAAkB;GACd,MAAM;GACN,MAAM;GACN,eAAe,yBAAyB,WAAW;EACvD,CAAC,CACL;EACA,OAAO,IAAI,SACP,kBAAkB;GACd,MAAM;GACN,MAAM;GACN,QAAQ,OAAgB;IACpB,IAAI,MAAM,QAAQ,KAAK,GACnB,MAAM,OAAO,yBAAyB,CAAC,CAAC,SAAS,SAAS,iBAAiB,IAAI,CAAC;GACxF;EACJ,CAAC,CACL;EACA,OAAO,IAAI,SACP,kBAAkB;GACd,MAAM;GACN,MAAM;GACN,QAAQ,OAAgB;IACpB,IAAI,CAAC,uBAAuB,KAAK,GAAG;IACpC,IAAI,CAAC,UAAU,MAAM,SAAS,YAAY,MAAM,SAAS,WAAW;IACpE,MAAM,cACF,MAAM,SAAS,WACT,GAAG,MAAM,QAAQ,yBAAyB,cAAc,WACxD,MAAM;IAChB,cAAmB;KACf,IAAI,kBAAkB,MAAM,KAAK,GAAG,MAAM,UAAU;KACpD,SAAS,cAAc,MAAM;KAC7B,OAAO;KACP;KACA,UAAU;KACV,QAAQ,CAAC,kBAAkB,MAAM,IAAI;KACrC,QAAQ;IACZ,CAAC;IACD,IAAI,MAAM,SAAS,kBACf,iBACI,8BAA8B,gCAAgC,GAC9D,MAAM,OACV;SACG,IAAI,MAAM,SAAS,WACtB,iBAAiB,8BAA8B,2BAA2B,GAAG,MAAM,OAAO;GAElG;EACJ,CAAC,CACL;CACJ;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/devtools/diagnostics.d.ts
|
|
2
|
+
export interface FilesDevtoolsDiagnostic {
|
|
3
|
+
code: FilesDevtoolsDiagnosticCode;
|
|
4
|
+
level: 'info' | 'warning' | 'error';
|
|
5
|
+
message: string;
|
|
6
|
+
hint?: string;
|
|
7
|
+
docs?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const FILES_DEVTOOLS_DIAGNOSTICS: {
|
|
10
|
+
readonly NUXT_FILES_NOT_CONFIGURED: {
|
|
11
|
+
readonly level: 'warning';
|
|
12
|
+
readonly message: 'The Files registry has not been configured.';
|
|
13
|
+
readonly hint: 'Check that files.config.ts is loaded by the Nuxt or Nitro integration.';
|
|
14
|
+
readonly docs: "https://github.com/liria24/nuxt-files-sdk/blob/main/docs/content/4.reference/4.troubleshooting.md";
|
|
15
|
+
};
|
|
16
|
+
readonly NUXT_FILES_INVALID_CONFIG: {
|
|
17
|
+
readonly level: 'error';
|
|
18
|
+
readonly message: 'The Files registry rejected the storage configuration.';
|
|
19
|
+
readonly hint: 'Check the storage shape in the active files.config.ts environment.';
|
|
20
|
+
readonly docs: "https://github.com/liria24/nuxt-files-sdk/blob/main/docs/content/4.reference/4.troubleshooting.md";
|
|
21
|
+
};
|
|
22
|
+
readonly NUXT_FILES_ADAPTER_INIT_FAILED: {
|
|
23
|
+
readonly level: 'error';
|
|
24
|
+
readonly message: 'A configured storage adapter could not be initialized.';
|
|
25
|
+
readonly hint: 'Check the provider package, runtime support, and required configuration.';
|
|
26
|
+
readonly docs: "https://github.com/liria24/nuxt-files-sdk/blob/main/docs/content/4.reference/4.troubleshooting.md";
|
|
27
|
+
};
|
|
28
|
+
readonly NUXT_FILES_GATEWAY_FAILED: {
|
|
29
|
+
readonly level: 'error';
|
|
30
|
+
readonly message: 'The Files DevTools gateway could not complete a request.';
|
|
31
|
+
readonly hint: 'Check the Nitro development server and the Files registry diagnostics.';
|
|
32
|
+
readonly docs: "https://github.com/liria24/nuxt-files-sdk/blob/main/docs/content/4.reference/4.troubleshooting.md";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type FilesDevtoolsDiagnosticCode = keyof typeof FILES_DEVTOOLS_DIAGNOSTICS;
|
|
36
|
+
//#endregion
|
|
37
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|