@d0paminedriven/fs 6.1.0 → 6.5.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.
@@ -1,4 +1,8 @@
1
+ import { XOR } from '../types/index.js';
1
2
  import { UrlService } from '../url/index.js';
3
+ import 'stream';
4
+ import 'buffer';
5
+ import '../utils/index.js';
2
6
 
3
7
  declare const extMimeMap: {
4
8
  readonly aac: readonly ["audio/aac"];
@@ -10,7 +14,7 @@ declare const extMimeMap: {
10
14
  readonly avif: readonly ["image/avif"];
11
15
  readonly avi: readonly ["video/x-msvideo"];
12
16
  readonly azw: readonly ["application/vnd.amazon.ebook"];
13
- readonly bin: readonly ["application/octet-stream"];
17
+ readonly bin: readonly ["application/octet-stream", "multipart/voice-message"];
14
18
  readonly bmp: readonly ["image/bmp"];
15
19
  readonly bz: readonly ["application/x-bzip"];
16
20
  readonly bz2: readonly ["application/x-bzip2"];
@@ -28,7 +32,7 @@ declare const extMimeMap: {
28
32
  readonly gif: readonly ["image/gif"];
29
33
  readonly glb: readonly ["model/gltf-binary"];
30
34
  readonly gltf: readonly ["model/gltf+json"];
31
- readonly gz: readonly ["application/x-gzip", "application/gzip"];
35
+ readonly gz: readonly ["application/gzip", "application/x-gzip"];
32
36
  readonly hjif: readonly ["haptics/hjif"];
33
37
  readonly hmpg: readonly ["haptics/hmpg"];
34
38
  readonly htm: readonly ["text/html"];
@@ -36,6 +40,7 @@ declare const extMimeMap: {
36
40
  readonly ico: readonly ["image/vnd.microsoft.icon"];
37
41
  readonly ics: readonly ["text/calendar"];
38
42
  readonly ivs: readonly ["haptics/ivs"];
43
+ readonly ivt: readonly ["haptics/ivs"];
39
44
  readonly jar: readonly ["application/java-archive"];
40
45
  readonly jpeg: readonly ["image/jpeg"];
41
46
  readonly jpg: readonly ["image/jpeg"];
@@ -57,7 +62,8 @@ declare const extMimeMap: {
57
62
  readonly mpeg: readonly ["video/mpeg"];
58
63
  readonly mpkg: readonly ["application/vnd.apple.installer+xml"];
59
64
  readonly ndjson: readonly ["application/x-ndjson"];
60
- readonly obj: readonly ["application/octet-stream", "text/plain", "model/obj"];
65
+ readonly node: readonly ["application/node", "text/javascript"];
66
+ readonly obj: readonly ["model/obj", "application/octet-stream", "text/plain"];
61
67
  readonly odp: readonly ["application/vnd.oasis.opendocument.presentation"];
62
68
  readonly ods: readonly ["application/vnd.oasis.opendocument.spreadsheet"];
63
69
  readonly odt: readonly ["application/vnd.oasis.opendocument.text"];
@@ -76,9 +82,11 @@ declare const extMimeMap: {
76
82
  readonly py: readonly ["text/x-python"];
77
83
  readonly pyc: readonly ["application/x-python-code"];
78
84
  readonly rar: readonly ["application/vnd.rar"];
85
+ readonly rs: readonly ["text/rust"];
79
86
  readonly rtf: readonly ["application/rtf"];
80
87
  readonly sh: readonly ["application/x-sh"];
81
88
  readonly sql: readonly ["application/sql"];
89
+ readonly sse: readonly ["text/event-stream"];
82
90
  readonly svg: readonly ["image/svg+xml"];
83
91
  readonly tar: readonly ["application/x-tar"];
84
92
  readonly tif: readonly ["image/tiff"];
@@ -108,7 +116,117 @@ declare const extMimeMap: {
108
116
  readonly "3g2": readonly ["video/3gpp2"];
109
117
  readonly "7z": readonly ["application/x-7z-compressed"];
110
118
  };
119
+ declare const mimeToExt: {
120
+ readonly "application/epub+zip": readonly ["epub"];
121
+ readonly "application/font-sfnt": readonly ["ttf"];
122
+ readonly "application/gzip": readonly ["gz"];
123
+ readonly "application/java-archive": readonly ["jar"];
124
+ readonly "application/json": readonly ["json"];
125
+ readonly "application/ld+json": readonly ["jsonld"];
126
+ readonly "application/msword": readonly ["doc"];
127
+ readonly "application/node": readonly ["node", "js"];
128
+ readonly "application/octet-stream": readonly ["bin", "obj"];
129
+ readonly "application/ogg": readonly ["ogx"];
130
+ readonly "application/pdf": readonly ["pdf"];
131
+ readonly "application/rtf": readonly ["rtf"];
132
+ readonly "application/sql": readonly ["sql"];
133
+ readonly "application/toml": readonly ["toml"];
134
+ readonly "application/vnd.amazon.ebook": readonly ["azw"];
135
+ readonly "application/vnd.apple.installer+xml": readonly ["mpkg"];
136
+ readonly "application/vnd.apple.mpegurl": readonly ["m3u8"];
137
+ readonly "application/vnd.apple.pkpass": readonly ["pkpass"];
138
+ readonly "application/vnd.mozilla.xul+xml": readonly ["xul"];
139
+ readonly "application/vnd.ms-excel": readonly ["xls"];
140
+ readonly "application/vnd.ms-fontobject": readonly ["eot"];
141
+ readonly "application/vnd.ms-powerpoint": readonly ["ppt"];
142
+ readonly "application/vnd.oasis.opendocument.presentation": readonly ["odp"];
143
+ readonly "application/vnd.oasis.opendocument.spreadsheet": readonly ["ods"];
144
+ readonly "application/vnd.oasis.opendocument.text": readonly ["odt"];
145
+ readonly "application/vnd.openxmlformats-officedocument.presentationml.presentation": readonly ["pptx"];
146
+ readonly "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": readonly ["xlsx"];
147
+ readonly "application/vnd.openxmlformats-officedocument.wordprocessingml.document": readonly ["docx"];
148
+ readonly "application/vnd.rar": readonly ["rar"];
149
+ readonly "application/vnd.visio": readonly ["vsd"];
150
+ readonly "application/wasm": readonly ["wasm"];
151
+ readonly "application/x-7z-compressed": readonly ["7z"];
152
+ readonly "application/x-abiword": readonly ["abw"];
153
+ readonly "application/x-bzip": readonly ["bz"];
154
+ readonly "application/x-bzip2": readonly ["bz2"];
155
+ readonly "application/x-cdf": readonly ["cda"];
156
+ readonly "application/x-csh": readonly ["csh"];
157
+ readonly "application/x-freearc": readonly ["arc"];
158
+ readonly "application/x-gzip": readonly ["gz"];
159
+ readonly "application/x-httpd-php": readonly ["php"];
160
+ readonly "application/x-mdx": readonly ["mdx"];
161
+ readonly "application/x-ndjson": readonly ["ndjson"];
162
+ readonly "application/x-python-code": readonly ["pyc"];
163
+ readonly "application/x-sh": readonly ["sh"];
164
+ readonly "application/x-tar": readonly ["tar"];
165
+ readonly "application/x-zip-compressed": readonly ["zip"];
166
+ readonly "application/xhtml+xml": readonly ["xhtml"];
167
+ readonly "application/xml": readonly ["xml"];
168
+ readonly "application/yaml": readonly ["yml", "yaml"];
169
+ readonly "application/zip": readonly ["zip"];
170
+ readonly "audio/aac": readonly ["aac"];
171
+ readonly "audio/midi": readonly ["mid"];
172
+ readonly "audio/mp4": readonly ["m4a"];
173
+ readonly "audio/mpeg": readonly ["mp3"];
174
+ readonly "audio/ogg": readonly ["opus", "ogg", "oga"];
175
+ readonly "audio/wav": readonly ["wav"];
176
+ readonly "audio/x-midi": readonly ["midi"];
177
+ readonly "font/otf": readonly ["otf"];
178
+ readonly "font/ttf": readonly ["ttf"];
179
+ readonly "font/woff": readonly ["woff"];
180
+ readonly "font/woff2": readonly ["woff2"];
181
+ readonly "haptics/hjif": readonly ["hjif"];
182
+ readonly "haptics/hmpg": readonly ["hmpg"];
183
+ readonly "haptics/ivs": readonly ["ivs", "ivt"];
184
+ readonly "image/aces": readonly ["aces"];
185
+ readonly "image/apng": readonly ["apng"];
186
+ readonly "image/avci": readonly ["avci"];
187
+ readonly "image/avif": readonly ["avif"];
188
+ readonly "image/bmp": readonly ["bmp"];
189
+ readonly "image/dpx": readonly ["dpx"];
190
+ readonly "image/emf": readonly ["emf"];
191
+ readonly "image/gif": readonly ["gif"];
192
+ readonly "image/jpeg": readonly ["jpg", "jpeg"];
193
+ readonly "image/ktx": readonly ["ktx"];
194
+ readonly "image/ktx2": readonly ["ktx2"];
195
+ readonly "image/png": readonly ["png"];
196
+ readonly "image/svg+xml": readonly ["svg"];
197
+ readonly "image/tiff": readonly ["tiff", "tif"];
198
+ readonly "image/vnd.microsoft.icon": readonly ["ico"];
199
+ readonly "image/webp": readonly ["webp"];
200
+ readonly "model/gltf-binary": readonly ["glb"];
201
+ readonly "model/gltf+json": readonly ["gltf"];
202
+ readonly "model/obj": readonly ["obj"];
203
+ readonly "model/vnd.usdz+zip": readonly ["usdz"];
204
+ readonly "multipart/voice-message": readonly ["bin"];
205
+ readonly "text/calendar": readonly ["ics"];
206
+ readonly "text/css": readonly ["css"];
207
+ readonly "text/csv": readonly ["csv"];
208
+ readonly "text/event-stream": readonly ["sse", "ts", "rs", "py", "txt"];
209
+ readonly "text/html": readonly ["html", "htm"];
210
+ readonly "text/javascript": readonly ["cjs", "js", "mjs"];
211
+ readonly "text/markdown": readonly ["md"];
212
+ readonly "text/plain": readonly ["txt"];
213
+ readonly "text/rust": readonly ["rs"];
214
+ readonly "text/typescript": readonly ["ts"];
215
+ readonly "text/vtt": readonly ["vtt"];
216
+ readonly "text/x-python": readonly ["py"];
217
+ readonly "video/3gpp": readonly ["3gp"];
218
+ readonly "video/3gpp2": readonly ["3g2"];
219
+ readonly "video/mp2t": readonly ["ts"];
220
+ readonly "video/mp4": readonly ["mp4", "m4v"];
221
+ readonly "video/mpeg": readonly ["mpeg"];
222
+ readonly "video/ogg": readonly ["ogv"];
223
+ readonly "video/vnd.dlna.mpeg-tts": readonly ["ts"];
224
+ readonly "video/webm": readonly ["weba"];
225
+ readonly "video/x-msvideo": readonly ["avi"];
226
+ };
111
227
  type FileExtension = keyof typeof extMimeMap;
228
+ type MimeType = keyof typeof mimeToExt;
229
+ type MimeTypeToFileExtension<T extends XOR<typeof mimeToExt, typeof extMimeMap>> = T[keyof T];
112
230
  type FileExtensionToMimeType<T extends FileExtension> = (typeof extMimeMap)[T][number];
113
231
  type AllMimeTypes = FileExtensionToMimeType<FileExtension>;
114
232
  type InferTopLevelPresent<T> = T extends `${infer U}/${string}` ? U : T;
@@ -126,7 +244,7 @@ declare class MimeService extends UrlService {
126
244
  readonly avif: readonly ["image/avif"];
127
245
  readonly avi: readonly ["video/x-msvideo"];
128
246
  readonly azw: readonly ["application/vnd.amazon.ebook"];
129
- readonly bin: readonly ["application/octet-stream"];
247
+ readonly bin: readonly ["application/octet-stream", "multipart/voice-message"];
130
248
  readonly bmp: readonly ["image/bmp"];
131
249
  readonly bz: readonly ["application/x-bzip"];
132
250
  readonly bz2: readonly ["application/x-bzip2"];
@@ -144,7 +262,7 @@ declare class MimeService extends UrlService {
144
262
  readonly gif: readonly ["image/gif"];
145
263
  readonly glb: readonly ["model/gltf-binary"];
146
264
  readonly gltf: readonly ["model/gltf+json"];
147
- readonly gz: readonly ["application/x-gzip", "application/gzip"];
265
+ readonly gz: readonly ["application/gzip", "application/x-gzip"];
148
266
  readonly hjif: readonly ["haptics/hjif"];
149
267
  readonly hmpg: readonly ["haptics/hmpg"];
150
268
  readonly htm: readonly ["text/html"];
@@ -152,6 +270,7 @@ declare class MimeService extends UrlService {
152
270
  readonly ico: readonly ["image/vnd.microsoft.icon"];
153
271
  readonly ics: readonly ["text/calendar"];
154
272
  readonly ivs: readonly ["haptics/ivs"];
273
+ readonly ivt: readonly ["haptics/ivs"];
155
274
  readonly jar: readonly ["application/java-archive"];
156
275
  readonly jpeg: readonly ["image/jpeg"];
157
276
  readonly jpg: readonly ["image/jpeg"];
@@ -173,7 +292,8 @@ declare class MimeService extends UrlService {
173
292
  readonly mpeg: readonly ["video/mpeg"];
174
293
  readonly mpkg: readonly ["application/vnd.apple.installer+xml"];
175
294
  readonly ndjson: readonly ["application/x-ndjson"];
176
- readonly obj: readonly ["application/octet-stream", "text/plain", "model/obj"];
295
+ readonly node: readonly ["application/node", "text/javascript"];
296
+ readonly obj: readonly ["model/obj", "application/octet-stream", "text/plain"];
177
297
  readonly odp: readonly ["application/vnd.oasis.opendocument.presentation"];
178
298
  readonly ods: readonly ["application/vnd.oasis.opendocument.spreadsheet"];
179
299
  readonly odt: readonly ["application/vnd.oasis.opendocument.text"];
@@ -192,9 +312,11 @@ declare class MimeService extends UrlService {
192
312
  readonly py: readonly ["text/x-python"];
193
313
  readonly pyc: readonly ["application/x-python-code"];
194
314
  readonly rar: readonly ["application/vnd.rar"];
315
+ readonly rs: readonly ["text/rust"];
195
316
  readonly rtf: readonly ["application/rtf"];
196
317
  readonly sh: readonly ["application/x-sh"];
197
318
  readonly sql: readonly ["application/sql"];
319
+ readonly sse: readonly ["text/event-stream"];
198
320
  readonly svg: readonly ["image/svg+xml"];
199
321
  readonly tar: readonly ["application/x-tar"];
200
322
  readonly tif: readonly ["image/tiff"];
@@ -224,15 +346,126 @@ declare class MimeService extends UrlService {
224
346
  readonly "3g2": readonly ["video/3gpp2"];
225
347
  readonly "7z": readonly ["application/x-7z-compressed"];
226
348
  };
227
- assetType<const T extends string>(url: T): "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avif" | "avi" | "azw" | "bin" | "bmp" | "bz" | "bz2" | "cda" | "cjs" | "csh" | "css" | "csv" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "gif" | "glb" | "gltf" | "gz" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "jar" | "jpeg" | "jpg" | "js" | "json" | "jsonld" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpeg" | "mpkg" | "ndjson" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "png" | "pdf" | "php" | "pkpass" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rtf" | "sh" | "sql" | "svg" | "tar" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webp" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip" | "3gp" | "3g2" | "7z" | undefined;
228
- getMimes<const E extends FileExtension>(ext: E): readonly ["audio/aac"] | readonly ["application/x-abiword"] | readonly ["image/aces"] | readonly ["image/apng"] | readonly ["application/x-freearc"] | readonly ["image/avci"] | readonly ["image/avif"] | readonly ["video/x-msvideo"] | readonly ["application/vnd.amazon.ebook"] | readonly ["application/octet-stream"] | readonly ["image/bmp"] | readonly ["application/x-bzip"] | readonly ["application/x-bzip2"] | readonly ["application/x-cdf"] | readonly ["application/node", "text/javascript"] | readonly ["application/x-csh"] | readonly ["text/css"] | readonly ["text/csv"] | readonly ["application/msword"] | readonly ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] | readonly ["image/dpx"] | readonly ["image/emf"] | readonly ["application/vnd.ms-fontobject"] | readonly ["application/epub+zip"] | readonly ["image/gif"] | readonly ["model/gltf-binary"] | readonly ["model/gltf+json"] | readonly ["application/x-gzip", "application/gzip"] | readonly ["haptics/hjif"] | readonly ["haptics/hmpg"] | readonly ["text/html"] | readonly ["image/vnd.microsoft.icon"] | readonly ["text/calendar"] | readonly ["haptics/ivs"] | readonly ["application/java-archive"] | readonly ["image/jpeg"] | readonly ["application/json"] | readonly ["application/ld+json"] | readonly ["image/ktx"] | readonly ["image/ktx2"] | readonly ["application/vnd.apple.mpegurl"] | readonly ["audio/mp4"] | readonly ["video/mp4"] | readonly ["text/markdown"] | readonly ["application/x-mdx"] | readonly ["audio/midi"] | readonly ["audio/x-midi"] | readonly ["text/javascript"] | readonly ["audio/mpeg"] | readonly ["video/mpeg"] | readonly ["application/vnd.apple.installer+xml"] | readonly ["application/x-ndjson"] | readonly ["application/octet-stream", "text/plain", "model/obj"] | readonly ["application/vnd.oasis.opendocument.presentation"] | readonly ["application/vnd.oasis.opendocument.spreadsheet"] | readonly ["application/vnd.oasis.opendocument.text"] | readonly ["audio/ogg"] | readonly ["video/ogg"] | readonly ["application/ogg"] | readonly ["font/otf"] | readonly ["image/png"] | readonly ["application/pdf"] | readonly ["application/x-httpd-php"] | readonly ["application/vnd.apple.pkpass"] | readonly ["application/vnd.ms-powerpoint"] | readonly ["application/vnd.openxmlformats-officedocument.presentationml.presentation"] | readonly ["text/x-python"] | readonly ["application/x-python-code"] | readonly ["application/vnd.rar"] | readonly ["application/rtf"] | readonly ["application/x-sh"] | readonly ["application/sql"] | readonly ["image/svg+xml"] | readonly ["application/x-tar"] | readonly ["image/tiff"] | readonly ["application/toml"] | readonly ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"] | readonly ["application/font-sfnt", "font/ttf"] | readonly ["text/plain"] | readonly ["model/vnd.usdz+zip"] | readonly ["application/vnd.visio"] | readonly ["text/vtt"] | readonly ["application/wasm"] | readonly ["audio/wav"] | readonly ["video/webm"] | readonly ["image/webp"] | readonly ["font/woff"] | readonly ["font/woff2"] | readonly ["application/xhtml+xml"] | readonly ["application/vnd.ms-excel"] | readonly ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] | readonly ["application/xml"] | readonly ["application/vnd.mozilla.xul+xml"] | readonly ["application/yaml"] | readonly ["application/zip", "application/x-zip-compressed"] | readonly ["video/3gpp"] | readonly ["video/3gpp2"] | readonly ["application/x-7z-compressed"];
349
+ readonly toExtObj: {
350
+ readonly "application/epub+zip": readonly ["epub"];
351
+ readonly "application/font-sfnt": readonly ["ttf"];
352
+ readonly "application/gzip": readonly ["gz"];
353
+ readonly "application/java-archive": readonly ["jar"];
354
+ readonly "application/json": readonly ["json"];
355
+ readonly "application/ld+json": readonly ["jsonld"];
356
+ readonly "application/msword": readonly ["doc"];
357
+ readonly "application/node": readonly ["node", "js"];
358
+ readonly "application/octet-stream": readonly ["bin", "obj"];
359
+ readonly "application/ogg": readonly ["ogx"];
360
+ readonly "application/pdf": readonly ["pdf"];
361
+ readonly "application/rtf": readonly ["rtf"];
362
+ readonly "application/sql": readonly ["sql"];
363
+ readonly "application/toml": readonly ["toml"];
364
+ readonly "application/vnd.amazon.ebook": readonly ["azw"];
365
+ readonly "application/vnd.apple.installer+xml": readonly ["mpkg"];
366
+ readonly "application/vnd.apple.mpegurl": readonly ["m3u8"];
367
+ readonly "application/vnd.apple.pkpass": readonly ["pkpass"];
368
+ readonly "application/vnd.mozilla.xul+xml": readonly ["xul"];
369
+ readonly "application/vnd.ms-excel": readonly ["xls"];
370
+ readonly "application/vnd.ms-fontobject": readonly ["eot"];
371
+ readonly "application/vnd.ms-powerpoint": readonly ["ppt"];
372
+ readonly "application/vnd.oasis.opendocument.presentation": readonly ["odp"];
373
+ readonly "application/vnd.oasis.opendocument.spreadsheet": readonly ["ods"];
374
+ readonly "application/vnd.oasis.opendocument.text": readonly ["odt"];
375
+ readonly "application/vnd.openxmlformats-officedocument.presentationml.presentation": readonly ["pptx"];
376
+ readonly "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": readonly ["xlsx"];
377
+ readonly "application/vnd.openxmlformats-officedocument.wordprocessingml.document": readonly ["docx"];
378
+ readonly "application/vnd.rar": readonly ["rar"];
379
+ readonly "application/vnd.visio": readonly ["vsd"];
380
+ readonly "application/wasm": readonly ["wasm"];
381
+ readonly "application/x-7z-compressed": readonly ["7z"];
382
+ readonly "application/x-abiword": readonly ["abw"];
383
+ readonly "application/x-bzip": readonly ["bz"];
384
+ readonly "application/x-bzip2": readonly ["bz2"];
385
+ readonly "application/x-cdf": readonly ["cda"];
386
+ readonly "application/x-csh": readonly ["csh"];
387
+ readonly "application/x-freearc": readonly ["arc"];
388
+ readonly "application/x-gzip": readonly ["gz"];
389
+ readonly "application/x-httpd-php": readonly ["php"];
390
+ readonly "application/x-mdx": readonly ["mdx"];
391
+ readonly "application/x-ndjson": readonly ["ndjson"];
392
+ readonly "application/x-python-code": readonly ["pyc"];
393
+ readonly "application/x-sh": readonly ["sh"];
394
+ readonly "application/x-tar": readonly ["tar"];
395
+ readonly "application/x-zip-compressed": readonly ["zip"];
396
+ readonly "application/xhtml+xml": readonly ["xhtml"];
397
+ readonly "application/xml": readonly ["xml"];
398
+ readonly "application/yaml": readonly ["yml", "yaml"];
399
+ readonly "application/zip": readonly ["zip"];
400
+ readonly "audio/aac": readonly ["aac"];
401
+ readonly "audio/midi": readonly ["mid"];
402
+ readonly "audio/mp4": readonly ["m4a"];
403
+ readonly "audio/mpeg": readonly ["mp3"];
404
+ readonly "audio/ogg": readonly ["opus", "ogg", "oga"];
405
+ readonly "audio/wav": readonly ["wav"];
406
+ readonly "audio/x-midi": readonly ["midi"];
407
+ readonly "font/otf": readonly ["otf"];
408
+ readonly "font/ttf": readonly ["ttf"];
409
+ readonly "font/woff": readonly ["woff"];
410
+ readonly "font/woff2": readonly ["woff2"];
411
+ readonly "haptics/hjif": readonly ["hjif"];
412
+ readonly "haptics/hmpg": readonly ["hmpg"];
413
+ readonly "haptics/ivs": readonly ["ivs", "ivt"];
414
+ readonly "image/aces": readonly ["aces"];
415
+ readonly "image/apng": readonly ["apng"];
416
+ readonly "image/avci": readonly ["avci"];
417
+ readonly "image/avif": readonly ["avif"];
418
+ readonly "image/bmp": readonly ["bmp"];
419
+ readonly "image/dpx": readonly ["dpx"];
420
+ readonly "image/emf": readonly ["emf"];
421
+ readonly "image/gif": readonly ["gif"];
422
+ readonly "image/jpeg": readonly ["jpg", "jpeg"];
423
+ readonly "image/ktx": readonly ["ktx"];
424
+ readonly "image/ktx2": readonly ["ktx2"];
425
+ readonly "image/png": readonly ["png"];
426
+ readonly "image/svg+xml": readonly ["svg"];
427
+ readonly "image/tiff": readonly ["tiff", "tif"];
428
+ readonly "image/vnd.microsoft.icon": readonly ["ico"];
429
+ readonly "image/webp": readonly ["webp"];
430
+ readonly "model/gltf-binary": readonly ["glb"];
431
+ readonly "model/gltf+json": readonly ["gltf"];
432
+ readonly "model/obj": readonly ["obj"];
433
+ readonly "model/vnd.usdz+zip": readonly ["usdz"];
434
+ readonly "multipart/voice-message": readonly ["bin"];
435
+ readonly "text/calendar": readonly ["ics"];
436
+ readonly "text/css": readonly ["css"];
437
+ readonly "text/csv": readonly ["csv"];
438
+ readonly "text/event-stream": readonly ["sse", "ts", "rs", "py", "txt"];
439
+ readonly "text/html": readonly ["html", "htm"];
440
+ readonly "text/javascript": readonly ["cjs", "js", "mjs"];
441
+ readonly "text/markdown": readonly ["md"];
442
+ readonly "text/plain": readonly ["txt"];
443
+ readonly "text/rust": readonly ["rs"];
444
+ readonly "text/typescript": readonly ["ts"];
445
+ readonly "text/vtt": readonly ["vtt"];
446
+ readonly "text/x-python": readonly ["py"];
447
+ readonly "video/3gpp": readonly ["3gp"];
448
+ readonly "video/3gpp2": readonly ["3g2"];
449
+ readonly "video/mp2t": readonly ["ts"];
450
+ readonly "video/mp4": readonly ["mp4", "m4v"];
451
+ readonly "video/mpeg": readonly ["mpeg"];
452
+ readonly "video/ogg": readonly ["ogv"];
453
+ readonly "video/vnd.dlna.mpeg-tts": readonly ["ts"];
454
+ readonly "video/webm": readonly ["weba"];
455
+ readonly "video/x-msvideo": readonly ["avi"];
456
+ };
457
+ compareMimeToExt(p?: "mime" | "ext"): {
458
+ [k: string]: number;
459
+ };
460
+ assetType<const T extends string>(url: T): "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avif" | "avi" | "azw" | "bin" | "bmp" | "bz" | "bz2" | "cda" | "cjs" | "csh" | "css" | "csv" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "gif" | "glb" | "gltf" | "gz" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "ivt" | "jar" | "jpeg" | "jpg" | "js" | "json" | "jsonld" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpeg" | "mpkg" | "ndjson" | "node" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "png" | "pdf" | "php" | "pkpass" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rs" | "rtf" | "sh" | "sql" | "sse" | "svg" | "tar" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webp" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip" | "3gp" | "3g2" | "7z" | undefined;
461
+ getMimes<const E extends FileExtension>(ext: E): readonly ["audio/aac"] | readonly ["application/x-abiword"] | readonly ["image/aces"] | readonly ["image/apng"] | readonly ["application/x-freearc"] | readonly ["image/avci"] | readonly ["image/avif"] | readonly ["video/x-msvideo"] | readonly ["application/vnd.amazon.ebook"] | readonly ["application/octet-stream", "multipart/voice-message"] | readonly ["image/bmp"] | readonly ["application/x-bzip"] | readonly ["application/x-bzip2"] | readonly ["application/x-cdf"] | readonly ["application/node", "text/javascript"] | readonly ["application/x-csh"] | readonly ["text/css"] | readonly ["text/csv"] | readonly ["application/msword"] | readonly ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] | readonly ["image/dpx"] | readonly ["image/emf"] | readonly ["application/vnd.ms-fontobject"] | readonly ["application/epub+zip"] | readonly ["image/gif"] | readonly ["model/gltf-binary"] | readonly ["model/gltf+json"] | readonly ["application/gzip", "application/x-gzip"] | readonly ["haptics/hjif"] | readonly ["haptics/hmpg"] | readonly ["text/html"] | readonly ["image/vnd.microsoft.icon"] | readonly ["text/calendar"] | readonly ["haptics/ivs"] | readonly ["application/java-archive"] | readonly ["image/jpeg"] | readonly ["application/json"] | readonly ["application/ld+json"] | readonly ["image/ktx"] | readonly ["image/ktx2"] | readonly ["application/vnd.apple.mpegurl"] | readonly ["audio/mp4"] | readonly ["video/mp4"] | readonly ["text/markdown"] | readonly ["application/x-mdx"] | readonly ["audio/midi"] | readonly ["audio/x-midi"] | readonly ["text/javascript"] | readonly ["audio/mpeg"] | readonly ["video/mpeg"] | readonly ["application/vnd.apple.installer+xml"] | readonly ["application/x-ndjson"] | readonly ["model/obj", "application/octet-stream", "text/plain"] | readonly ["application/vnd.oasis.opendocument.presentation"] | readonly ["application/vnd.oasis.opendocument.spreadsheet"] | readonly ["application/vnd.oasis.opendocument.text"] | readonly ["audio/ogg"] | readonly ["video/ogg"] | readonly ["application/ogg"] | readonly ["font/otf"] | readonly ["image/png"] | readonly ["application/pdf"] | readonly ["application/x-httpd-php"] | readonly ["application/vnd.apple.pkpass"] | readonly ["application/vnd.ms-powerpoint"] | readonly ["application/vnd.openxmlformats-officedocument.presentationml.presentation"] | readonly ["text/x-python"] | readonly ["application/x-python-code"] | readonly ["application/vnd.rar"] | readonly ["text/rust"] | readonly ["application/rtf"] | readonly ["application/x-sh"] | readonly ["application/sql"] | readonly ["text/event-stream"] | readonly ["image/svg+xml"] | readonly ["application/x-tar"] | readonly ["image/tiff"] | readonly ["application/toml"] | readonly ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"] | readonly ["application/font-sfnt", "font/ttf"] | readonly ["text/plain"] | readonly ["model/vnd.usdz+zip"] | readonly ["application/vnd.visio"] | readonly ["text/vtt"] | readonly ["application/wasm"] | readonly ["audio/wav"] | readonly ["video/webm"] | readonly ["image/webp"] | readonly ["font/woff"] | readonly ["font/woff2"] | readonly ["application/xhtml+xml"] | readonly ["application/vnd.ms-excel"] | readonly ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] | readonly ["application/xml"] | readonly ["application/vnd.mozilla.xul+xml"] | readonly ["application/yaml"] | readonly ["application/zip", "application/x-zip-compressed"] | readonly ["video/3gpp"] | readonly ["video/3gpp2"] | readonly ["application/x-7z-compressed"];
229
462
  getMimeFor<const E extends FileExtension>(ext: E, opts?: {
230
463
  type?: MimeTopLevelType;
231
464
  }): FileExtensionToMimeType<E>;
232
- isMimeFor<const E extends FileExtension>(ext: E, mime: FileExtensionToMimeType<E>): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/x-gzip" | "application/gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "text/plain" | "model/obj" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "application/rtf" | "application/x-sh" | "application/sql" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed" | undefined;
465
+ isMimeFor<const E extends FileExtension>(ext: E, mime: FileExtensionToMimeType<E>): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/gzip" | "application/x-gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed" | undefined;
233
466
  getMimeTypeForPath<T extends string>(path: T, opts?: {
234
467
  type?: MimeTopLevelType;
235
- }): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/x-gzip" | "application/gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "text/plain" | "model/obj" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "application/rtf" | "application/x-sh" | "application/sql" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed";
468
+ }): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/gzip" | "application/x-gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed";
236
469
  }
237
470
 
238
- export { type AllMimeTypes, type FileExtension, type FileExtensionToMimeType, type InferTopLevelPresent, MimeService, type MimeTopLevelType, type PresentMimeTopLevelTypes, extMimeMap };
471
+ export { type AllMimeTypes, type FileExtension, type FileExtensionToMimeType, type InferTopLevelPresent, MimeService, type MimeTopLevelType, type MimeType, type MimeTypeToFileExtension, type PresentMimeTopLevelTypes, extMimeMap, mimeToExt };
@@ -1,11 +1,14 @@
1
1
  import {
2
2
  MimeService,
3
- extMimeMap
4
- } from "../chunk-EHOBCDHE.js";
5
- import "../chunk-XHN56MDK.js";
3
+ extMimeMap,
4
+ mimeToExt
5
+ } from "../chunk-O4BKLMFV.js";
6
+ import "../chunk-QBG7TFHM.js";
7
+ import "../chunk-IUGBPDQJ.js";
6
8
  import "../chunk-7QVYU63E.js";
7
9
  export {
8
10
  MimeService,
9
- extMimeMap
11
+ extMimeMap,
12
+ mimeToExt
10
13
  };
11
14
  //# sourceMappingURL=index.js.map
@@ -170,43 +170,50 @@ interface ExecuteCommandProps<T extends string> extends ExecSyncOptionsWithBuffe
170
170
  }
171
171
  type ConditionalPromise<T> = T | Promise<T>;
172
172
  type UnwrapPromise<T> = T extends Promise<infer U> | PromiseLike<infer U> ? U : T;
173
- type RemoveFields<T, P extends keyof T = keyof T> = {
173
+ type Unenumerate<T> = T extends (infer U)[] | readonly (infer U)[] ? U : T;
174
+ type Rm<T, P extends keyof T = keyof T> = {
174
175
  [S in keyof T as Exclude<S, P>]: T[S];
175
176
  };
176
- type ConditionalToRequired<T, Z extends keyof T = keyof T> = RemoveFields<T, Z> & {
177
- [Q in Z]-?: T[Q];
177
+ /**
178
+ * helper workup for use in XOR type below
179
+ * makes properties from U optional and undefined in T, and vice versa
180
+ */
181
+ type Without<T, U> = {
182
+ [P in Exclude<keyof T, keyof U>]?: never;
178
183
  };
179
- type RequiredToConditional<T, X extends keyof T = keyof T> = RemoveFields<T, X> & {
180
- [Q in X]?: T[Q];
184
+ /**
185
+ * enforces mutual exclusivity of T | U
186
+ */
187
+ type XOR<T, U> = [
188
+ T,
189
+ U
190
+ ] extends [object, object] ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
191
+ /**
192
+ * Conditional to Required
193
+ */
194
+ type CTR<T, K extends keyof OnlyOptional<T> = keyof OnlyOptional<T>> = Rm<T, K> & {
195
+ [Q in K]-?: T[Q];
181
196
  };
182
- type FieldToConditionallyNever<T, X extends keyof T = keyof T> = RemoveFields<T, X> & {
183
- [Q in X]?: XOR<T[Q], never>;
197
+ /**
198
+ * Required to Conditional
199
+ */
200
+ type RTC<T, K extends keyof OnlyRequired<T> = keyof OnlyRequired<T>> = Rm<T, K> & {
201
+ [Q in K]?: T[Q];
184
202
  };
185
- type ExcludeFieldEnumerable<T, K extends keyof T> = RemoveFields<T, K>;
186
- type ArrayOrReadOnlyArray<T> = T[] | readonly T[];
187
- type Unenumerate<T> = T extends readonly (infer U)[] | (infer U)[] ? U : T;
188
- type Without<T, U> = {
189
- [P in Exclude<keyof T, keyof U>]?: never;
203
+ type IsExact<T, U> = [T] extends [U] ? ([U] extends [T] ? true : false) : false;
204
+ /**
205
+ * To Conditionally never
206
+ */
207
+ type TCN<T, X extends keyof T = keyof T> = Rm<T, X> & {
208
+ [Q in X]?: XOR<T[Q], never>;
190
209
  };
191
- type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
192
- type Depth<Y extends {
193
- [record: string | symbol | number]: unknown;
194
- }, X extends keyof Y = keyof Y> = {
195
- [H in keyof Y[X]]: Y[X][H][keyof Y[X][H]];
210
+ type ArrFieldReplacer<T extends unknown[] | readonly unknown[], V extends keyof Unenumerate<T>, Q extends boolean = false, P = unknown> = T extends (infer U)[] | readonly (infer U)[] ? V extends keyof U ? Q extends true ? P extends Record<infer Y, infer X> ? (Rm<U, V> & Record<Y, X>)[] : (Rm<U, V> & P)[] : Q extends false ? Rm<U, V>[] : U : T : T;
211
+ type IsOptional<T, K extends keyof T> = undefined extends T[K] ? object extends Pick<T, K> ? true : false : false;
212
+ type OnlyOptional<T> = {
213
+ [K in keyof T as IsOptional<T, K> extends true ? K : never]: T[K];
196
214
  };
197
- type InferDepth<T> = T extends Depth<infer U, infer X> ? U[X] : T;
198
- type OmitSrc<T> = T extends `src/${infer U}` ? U : T;
199
- type InjectScriptsProps<T> = {
200
- content: {
201
- scripts: {
202
- [record: string]: string;
203
- };
204
- } & {
205
- [record: string]: string | number | boolean | {
206
- [record: string]: string;
207
- };
208
- };
209
- tuplesToInject: T;
215
+ type OnlyRequired<T> = {
216
+ [K in keyof T as IsOptional<T, K> extends false ? K : never]: T[K];
210
217
  };
211
218
  /**
212
219
  * Expect that the thing passed to Expect<T> is true.
@@ -215,6 +222,9 @@ type InjectScriptsProps<T> = {
215
222
  * `Expect<false>` will error.
216
223
  */
217
224
  type Expect<T extends true> = T;
225
+ type RemoveFields<T, P extends keyof T = keyof T> = {
226
+ [S in keyof T as Exclude<S, P>]: T[S];
227
+ };
218
228
  /**
219
229
  * Checks that X and Y are exactly equal.
220
230
  *
@@ -237,6 +247,49 @@ type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ?
237
247
  * CANNOT be passed to a function which expects 'a'.
238
248
  */
239
249
  type Extends<X, Y> = Y extends X ? true : false;
250
+ type DX<Y> = {
251
+ [P in keyof Y]: Y[P];
252
+ };
253
+ type DeepPartial<T> = T extends object ? {
254
+ [P in keyof T]?: DeepPartial<T[P]>;
255
+ } : T;
256
+ type DeepPartialFields<T, K extends keyof T> = Omit<T, K> & {
257
+ [P in K]?: DeepPartial<T[P]>;
258
+ };
259
+ type DeepReplace<T, From, To> = T extends From ? To : T extends object ? {
260
+ [K in keyof T]: DeepReplace<T[K], From, To>;
261
+ } : T;
262
+ type RequireNested<T, Path extends string> = Path extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rm<T, K> & Record<K, RequireNested<Required<T>[K], Rest>> : T : Path extends keyof T ? Rm<T, Path> & Record<Path, Required<T>[Path]> : T;
263
+ type ConditionalToRequired<T, Z extends keyof T = keyof T> = Rm<T, Z> & {
264
+ [Q in Z]-?: T[Q];
265
+ };
266
+ type RequiredToConditional<T, X extends keyof T = keyof T> = Rm<T, X> & {
267
+ [Q in X]?: T[Q];
268
+ };
269
+ type FieldToConditionallyNever<T, X extends keyof T = keyof T> = Rm<T, X> & {
270
+ [Q in X]?: XOR<T[Q], never>;
271
+ };
272
+ type ExcludeFieldEnumerable<T, K extends keyof T> = Rm<T, K>;
273
+ type ArrayOrReadOnlyArray<T> = T[] | readonly T[];
274
+ type Depth<Y extends {
275
+ [record: string | symbol | number]: unknown;
276
+ }, X extends keyof Y = keyof Y> = {
277
+ [H in keyof Y[X]]: Y[X][H][keyof Y[X][H]];
278
+ };
279
+ type InferDepth<T> = T extends Depth<infer U, infer X> ? U[X] : T;
280
+ type OmitSrc<T> = T extends `src/${infer U}` ? U : T;
281
+ type InjectScriptsProps<T> = {
282
+ content: {
283
+ scripts: {
284
+ [record: string]: string;
285
+ };
286
+ } & {
287
+ [record: string]: string | number | boolean | {
288
+ [record: string]: string;
289
+ };
290
+ };
291
+ tuplesToInject: T;
292
+ };
240
293
  type ParsedUrlInfo = {
241
294
  href: string;
242
295
  protocol: string;
@@ -259,5 +312,14 @@ type SizeOpts = {
259
312
  decimals?: number;
260
313
  includeUnits?: boolean;
261
314
  };
315
+ interface ImageSize {
316
+ width: number;
317
+ height: number;
318
+ type: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "unknown";
319
+ }
320
+ interface BoxInfo {
321
+ pos: number;
322
+ size: number;
323
+ }
262
324
 
263
- export { type Abortable, type ArrayBufferView, type ArrayOrReadOnlyArray, type BashEnv, type BufferEncodingUnion, type CoercionUnion, type CommonExecOptions, type CommonOptions, type ConditionalPromise, type ConditionalToRequired, type Depth, type Dict, type Equal, type ExcludeFieldEnumerable, type ExecSyncOptions, type ExecSyncOptionsWithBufferEncoding, type ExecSyncOptionsWithStringEncoding, type ExecuteCommandProps, type Expect, type Extends, type FieldToConditionallyNever, type IOType, type InferDepth, type InjectScriptsProps, type MkDirOptions, type MkDirSyncOptions, type MkDirSyncProps, type Mode, type ObjEncodingOptions, type OmitSrc, type OpenMode, type ParsedUrlInfo, type ProcessEnv, type ProcessEnvOptions, type ReadDirOptions, type ReadDirOptionsEntity, type ReadDirProps, type RemoveFields, type RequiredToConditional, type RmDirOptions, type RmDirProps, type Signals, type SizeOpts, type StdioOptions, type TypedArray, type Unenumerate, type Unit, type UnwrapPromise, type Without, type WriteFileAsyncDataUnion, type WriteFileAsyncOptions, type WriteFileAsyncProps, type WriteStreamDataShape, type WriteStreamOptions, type WriteStreamProps, type XOR, unitsObj };
325
+ export { type Abortable, type ArrFieldReplacer, type ArrayBufferView, type ArrayOrReadOnlyArray, type BashEnv, type BoxInfo, type BufferEncodingUnion, type CTR, type CoercionUnion, type CommonExecOptions, type CommonOptions, type ConditionalPromise, type ConditionalToRequired, type DX, type DeepPartial, type DeepPartialFields, type DeepReplace, type Depth, type Dict, type Equal, type ExcludeFieldEnumerable, type ExecSyncOptions, type ExecSyncOptionsWithBufferEncoding, type ExecSyncOptionsWithStringEncoding, type ExecuteCommandProps, type Expect, type Extends, type FieldToConditionallyNever, type IOType, type ImageSize, type InferDepth, type InjectScriptsProps, type IsExact, type IsOptional, type MkDirOptions, type MkDirSyncOptions, type MkDirSyncProps, type Mode, type ObjEncodingOptions, type OmitSrc, type OnlyOptional, type OnlyRequired, type OpenMode, type ParsedUrlInfo, type ProcessEnv, type ProcessEnvOptions, type RTC, type ReadDirOptions, type ReadDirOptionsEntity, type ReadDirProps, type RemoveFields, type RequireNested, type RequiredToConditional, type Rm, type RmDirOptions, type RmDirProps, type Signals, type SizeOpts, type StdioOptions, type TCN, type TypedArray, type Unenumerate, type Unit, type UnwrapPromise, type Without, type WriteFileAsyncDataUnion, type WriteFileAsyncOptions, type WriteFileAsyncProps, type WriteStreamDataShape, type WriteStreamOptions, type WriteStreamProps, type XOR, unitsObj };