uti 8.6.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/package.json +6 -6
- package/src/uti.mjs +7 -4
- package/src/well-known-utis.mjs +9 -3
- package/types/uti.d.mts +8 -8
- package/types/well-known-utis.d.mts +0 -22
package/README.md
CHANGED
|
@@ -50,6 +50,8 @@ public.plain-text
|
|
|
50
50
|
* [UTI](#uti)
|
|
51
51
|
* [Parameters](#parameters)
|
|
52
52
|
* [Properties](#properties)
|
|
53
|
+
* [name](#name)
|
|
54
|
+
* [conforms](#conforms)
|
|
53
55
|
* [conformsTo](#conformsto)
|
|
54
56
|
* [Parameters](#parameters-1)
|
|
55
57
|
* [toString](#tostring)
|
|
@@ -90,13 +92,21 @@ Object representing a UTI.
|
|
|
90
92
|
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
91
93
|
* `conforms` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[UTI](#uti)>** 
|
|
92
94
|
|
|
95
|
+
### name
|
|
96
|
+
|
|
97
|
+
Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
|
|
98
|
+
|
|
99
|
+
### conforms
|
|
100
|
+
|
|
101
|
+
Type: [Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[UTI](#uti)>
|
|
102
|
+
|
|
93
103
|
### conformsTo
|
|
94
104
|
|
|
95
105
|
Check for conformity.
|
|
96
106
|
|
|
97
107
|
#### Parameters
|
|
98
108
|
|
|
99
|
-
* `other` **[UTI](#uti)** 
|
|
109
|
+
* `other` **([UTI](#uti) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** 
|
|
100
110
|
|
|
101
111
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if other conforms to the receiver
|
|
102
112
|
|
|
@@ -148,7 +158,7 @@ Registers additional types.
|
|
|
148
158
|
|
|
149
159
|
#### Parameters
|
|
150
160
|
|
|
151
|
-
* `types` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[
|
|
161
|
+
* `types` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[UTI](#uti)>** 
|
|
152
162
|
|
|
153
163
|
### getUTI
|
|
154
164
|
|
|
@@ -174,7 +184,7 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl
|
|
|
174
184
|
|
|
175
185
|
Lookup a UTI for a file name.
|
|
176
186
|
First the file name extension is extracted.
|
|
177
|
-
Then a lookup in the
|
|
187
|
+
Then a lookup in the registered UTIs for file name extension is executed.
|
|
178
188
|
|
|
179
189
|
#### Parameters
|
|
180
190
|
|
|
@@ -203,7 +213,7 @@ Lookup a UTI for a file name and check conformance.
|
|
|
203
213
|
* `fileName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** file to detect UTI for
|
|
204
214
|
* `uti` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to check conformance against
|
|
205
215
|
|
|
206
|
-
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
|
|
216
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if utils for file name are conformant
|
|
207
217
|
|
|
208
218
|
### assignMimeTypes
|
|
209
219
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uti",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"ava": "^6.1.3",
|
|
42
|
-
"browser-ava": "^2.2.
|
|
43
|
-
"c8": "^
|
|
42
|
+
"browser-ava": "^2.2.27",
|
|
43
|
+
"c8": "^10.1.2",
|
|
44
44
|
"documentation": "^14.0.3",
|
|
45
|
-
"semantic-release": "^
|
|
46
|
-
"typescript": "^5.
|
|
45
|
+
"semantic-release": "^24.1.1",
|
|
46
|
+
"typescript": "^5.6.2"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
49
|
+
"node": ">=22.7.0",
|
|
50
50
|
"bun": ">=1.0.0"
|
|
51
51
|
},
|
|
52
52
|
"repository": {
|
package/src/uti.mjs
CHANGED
|
@@ -9,6 +9,9 @@ import types from "./well-known-utis.mjs";
|
|
|
9
9
|
* @property {Set<UTI>} conforms
|
|
10
10
|
*/
|
|
11
11
|
class UTI {
|
|
12
|
+
/** @type {string} */ name;
|
|
13
|
+
/** @type {Set<UTI>} */ conforms;
|
|
14
|
+
|
|
12
15
|
/**
|
|
13
16
|
* Object representing a UTI.
|
|
14
17
|
* @param {string} name
|
|
@@ -24,7 +27,7 @@ class UTI {
|
|
|
24
27
|
|
|
25
28
|
/**
|
|
26
29
|
* Check for conformity.
|
|
27
|
-
* @param {UTI} other
|
|
30
|
+
* @param {UTI|undefined} other
|
|
28
31
|
* @return {boolean} true if other conforms to the receiver
|
|
29
32
|
*/
|
|
30
33
|
conformsTo(other) {
|
|
@@ -84,7 +87,7 @@ export class UTIController {
|
|
|
84
87
|
|
|
85
88
|
/**
|
|
86
89
|
* Registers additional types.
|
|
87
|
-
* @param {
|
|
90
|
+
* @param {UTI[]} types
|
|
88
91
|
*/
|
|
89
92
|
register(types) {
|
|
90
93
|
for (const u of types) {
|
|
@@ -146,7 +149,7 @@ export class UTIController {
|
|
|
146
149
|
/**
|
|
147
150
|
* Lookup a UTI for a file name.
|
|
148
151
|
* First the file name extension is extracted.
|
|
149
|
-
* Then a lookup in the
|
|
152
|
+
* Then a lookup in the registered UTIs for file name extension is executed.
|
|
150
153
|
* @param {string} fileName file to detect UTI for
|
|
151
154
|
* @return {string[]} UTIs for the given fileName
|
|
152
155
|
*/
|
|
@@ -185,7 +188,7 @@ export class UTIController {
|
|
|
185
188
|
* Lookup a UTI for a file name and check conformance.
|
|
186
189
|
* @param {string} fileName file to detect UTI for
|
|
187
190
|
* @param {string} uti to check conformance against
|
|
188
|
-
* @return {boolean}
|
|
191
|
+
* @return {boolean} true if utils for file name are conformant
|
|
189
192
|
*/
|
|
190
193
|
fileNameConformsTo(fileName, uti) {
|
|
191
194
|
const utis = this.getUTIsForFileName(fileName);
|
package/src/well-known-utis.mjs
CHANGED
|
@@ -509,6 +509,12 @@ export default [
|
|
|
509
509
|
mimeType: ["image/jpeg"],
|
|
510
510
|
fileNameExtension: [".jpg", ".jpeg"]
|
|
511
511
|
},
|
|
512
|
+
{
|
|
513
|
+
name: "public.jxl",
|
|
514
|
+
conformsTo: "public.image",
|
|
515
|
+
mimeType: ["image/jxl"],
|
|
516
|
+
fileNameExtension: [".jxl"]
|
|
517
|
+
},
|
|
512
518
|
{
|
|
513
519
|
name: "public.jpeg2000",
|
|
514
520
|
conformsTo: "public.image",
|
|
@@ -573,19 +579,19 @@ export default [
|
|
|
573
579
|
{
|
|
574
580
|
name: "public.oci.image.layer.v1.tar",
|
|
575
581
|
conformsTo: "public.oci.image.layer.v1",
|
|
576
|
-
|
|
582
|
+
fileNameExtension: ".tar",
|
|
577
583
|
mimeType: "application/vnd.oci.image.layer.v1.tar"
|
|
578
584
|
},
|
|
579
585
|
{
|
|
580
586
|
name: "public.oci.image.layer.v1.tar.gzip",
|
|
581
587
|
conformsTo: "public.oci.image.layer.v1",
|
|
582
|
-
|
|
588
|
+
fileNameExtension: ".tar.gz",
|
|
583
589
|
mimeType: "application/vnd.oci.image.layer.v1.tar+gzip"
|
|
584
590
|
},
|
|
585
591
|
{
|
|
586
592
|
name: "public.oci.image.layer.v1.tar.zstd",
|
|
587
593
|
conformsTo: "public.oci.image.layer.v1",
|
|
588
|
-
|
|
594
|
+
fileNameExtension: ".tar.zstd",
|
|
589
595
|
mimeType: "application/vnd.oci.image.layer.v1.tar+zstd"
|
|
590
596
|
},
|
|
591
597
|
{
|
package/types/uti.d.mts
CHANGED
|
@@ -10,9 +10,9 @@ export class UTIController {
|
|
|
10
10
|
/** @type {Map<string,string[]>} */ utiByFileNameExtension: Map<string, string[]>;
|
|
11
11
|
/**
|
|
12
12
|
* Registers additional types.
|
|
13
|
-
* @param {
|
|
13
|
+
* @param {UTI[]} types
|
|
14
14
|
*/
|
|
15
|
-
register(types:
|
|
15
|
+
register(types: UTI[]): void;
|
|
16
16
|
/**
|
|
17
17
|
* Lookup a given UTI.
|
|
18
18
|
* @param {string} name UTI
|
|
@@ -28,7 +28,7 @@ export class UTIController {
|
|
|
28
28
|
/**
|
|
29
29
|
* Lookup a UTI for a file name.
|
|
30
30
|
* First the file name extension is extracted.
|
|
31
|
-
* Then a lookup in the
|
|
31
|
+
* Then a lookup in the registered UTIs for file name extension is executed.
|
|
32
32
|
* @param {string} fileName file to detect UTI for
|
|
33
33
|
* @return {string[]} UTIs for the given fileName
|
|
34
34
|
*/
|
|
@@ -45,7 +45,7 @@ export class UTIController {
|
|
|
45
45
|
* Lookup a UTI for a file name and check conformance.
|
|
46
46
|
* @param {string} fileName file to detect UTI for
|
|
47
47
|
* @param {string} uti to check conformance against
|
|
48
|
-
* @return {boolean}
|
|
48
|
+
* @return {boolean} true if utils for file name are conformant
|
|
49
49
|
*/
|
|
50
50
|
fileNameConformsTo(fileName: string, uti: string): boolean;
|
|
51
51
|
/**
|
|
@@ -79,14 +79,14 @@ declare class UTI {
|
|
|
79
79
|
* @property {Set<UTI>} conforms
|
|
80
80
|
*/
|
|
81
81
|
constructor(name: string, conforms: Set<UTI>);
|
|
82
|
-
name: string;
|
|
83
|
-
conforms: Set<UTI>;
|
|
82
|
+
/** @type {string} */ name: string;
|
|
83
|
+
/** @type {Set<UTI>} */ conforms: Set<UTI>;
|
|
84
84
|
/**
|
|
85
85
|
* Check for conformity.
|
|
86
|
-
* @param {UTI} other
|
|
86
|
+
* @param {UTI|undefined} other
|
|
87
87
|
* @return {boolean} true if other conforms to the receiver
|
|
88
88
|
*/
|
|
89
|
-
conformsTo(other: UTI): boolean;
|
|
89
|
+
conformsTo(other: UTI | undefined): boolean;
|
|
90
90
|
/**
|
|
91
91
|
* name of the UTI.
|
|
92
92
|
* @returns {string}
|
|
@@ -3,102 +3,80 @@ declare const _default: ({
|
|
|
3
3
|
conformsTo?: undefined;
|
|
4
4
|
mimeType?: undefined;
|
|
5
5
|
fileNameExtension?: undefined;
|
|
6
|
-
filNameExtension?: undefined;
|
|
7
6
|
} | {
|
|
8
7
|
name: string;
|
|
9
8
|
conformsTo: string;
|
|
10
9
|
mimeType?: undefined;
|
|
11
10
|
fileNameExtension?: undefined;
|
|
12
|
-
filNameExtension?: undefined;
|
|
13
11
|
} | {
|
|
14
12
|
name: string;
|
|
15
13
|
conformsTo: string[];
|
|
16
14
|
mimeType: string;
|
|
17
15
|
fileNameExtension: string;
|
|
18
|
-
filNameExtension?: undefined;
|
|
19
16
|
} | {
|
|
20
17
|
name: string;
|
|
21
18
|
conformsTo: string[];
|
|
22
19
|
fileNameExtension: string;
|
|
23
20
|
mimeType?: undefined;
|
|
24
|
-
filNameExtension?: undefined;
|
|
25
21
|
} | {
|
|
26
22
|
name: string;
|
|
27
23
|
conformsTo: string[];
|
|
28
24
|
mimeType?: undefined;
|
|
29
25
|
fileNameExtension?: undefined;
|
|
30
|
-
filNameExtension?: undefined;
|
|
31
26
|
} | {
|
|
32
27
|
name: string;
|
|
33
28
|
conformsTo: string;
|
|
34
29
|
fileNameExtension: string;
|
|
35
30
|
mimeType: string;
|
|
36
|
-
filNameExtension?: undefined;
|
|
37
31
|
} | {
|
|
38
32
|
name: string;
|
|
39
33
|
conformsTo: string;
|
|
40
34
|
fileNameExtension: string;
|
|
41
35
|
mimeType?: undefined;
|
|
42
|
-
filNameExtension?: undefined;
|
|
43
36
|
} | {
|
|
44
37
|
name: string;
|
|
45
38
|
conformsTo: string;
|
|
46
39
|
fileNameExtension: string[];
|
|
47
40
|
mimeType: string;
|
|
48
|
-
filNameExtension?: undefined;
|
|
49
41
|
} | {
|
|
50
42
|
name: string;
|
|
51
43
|
conformsTo: string;
|
|
52
44
|
fileNameExtension: string;
|
|
53
45
|
mimeType: string[];
|
|
54
|
-
filNameExtension?: undefined;
|
|
55
46
|
} | {
|
|
56
47
|
name: string;
|
|
57
48
|
conformsTo: string;
|
|
58
49
|
mimeType: string;
|
|
59
50
|
fileNameExtension?: undefined;
|
|
60
|
-
filNameExtension?: undefined;
|
|
61
51
|
} | {
|
|
62
52
|
name: string;
|
|
63
53
|
conformsTo: string;
|
|
64
54
|
fileNameExtension: string[];
|
|
65
55
|
mimeType?: undefined;
|
|
66
|
-
filNameExtension?: undefined;
|
|
67
56
|
} | {
|
|
68
57
|
name: string;
|
|
69
58
|
conformsTo: string[];
|
|
70
59
|
fileNameExtension: string[];
|
|
71
60
|
mimeType: string[];
|
|
72
|
-
filNameExtension?: undefined;
|
|
73
61
|
} | {
|
|
74
62
|
name: string;
|
|
75
63
|
conformsTo: string;
|
|
76
64
|
fileNameExtension: string[];
|
|
77
65
|
mimeType: string[];
|
|
78
|
-
filNameExtension?: undefined;
|
|
79
66
|
} | {
|
|
80
67
|
name: string;
|
|
81
68
|
conformsTo: string[];
|
|
82
69
|
fileNameExtension: string[];
|
|
83
70
|
mimeType?: undefined;
|
|
84
|
-
filNameExtension?: undefined;
|
|
85
71
|
} | {
|
|
86
72
|
name: string;
|
|
87
73
|
conformsTo: string[];
|
|
88
74
|
mimeType: string;
|
|
89
75
|
fileNameExtension: string[];
|
|
90
|
-
filNameExtension?: undefined;
|
|
91
|
-
} | {
|
|
92
|
-
name: string;
|
|
93
|
-
conformsTo: string;
|
|
94
|
-
filNameExtension: string;
|
|
95
|
-
mimeType: string;
|
|
96
|
-
fileNameExtension?: undefined;
|
|
97
76
|
} | {
|
|
98
77
|
name: string;
|
|
99
78
|
fileNameExtension: string[];
|
|
100
79
|
conformsTo?: undefined;
|
|
101
80
|
mimeType?: undefined;
|
|
102
|
-
filNameExtension?: undefined;
|
|
103
81
|
})[];
|
|
104
82
|
export default _default;
|