trousse 2.8.0 → 2.9.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/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/mimes.d.ts +8 -0
- package/dist/mimes.js +103 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { omitEmpty } from "./arrays.js";
|
|
2
|
-
import { AnyOf, DeepOmit, IsPlainObject, MaybePromise, NormalizeOptions, Nullish, PartialNullish, Pattern, RegistrableDomainOptions } from "./types.js";
|
|
2
|
+
import { AnyOf, DeepOmit, IsPlainObject, MaybePromise, NormalizeOptions, Nullish, PartialNullish, Pattern, RegistrableDomainOptions, WeightedMimeType } from "./types.js";
|
|
3
3
|
import { coerceArray, coerceBoolean, coerceDate, coerceNumber, coerceSingular, coerceString } from "./coercions.js";
|
|
4
4
|
import { archiveExtensions, audioExtensions, codeExtensions, documentExtensions, flashExtensions, fontExtensions, imageExtensions, installerExtensions, subtitleExtensions, videoExtensions } from "./files.js";
|
|
5
5
|
import { isBoolean, isFunction, isNonEmptyString, isNullish, isNumber, isObject, isPlainObject, isPresent, isString, isValidDate } from "./is.js";
|
|
6
6
|
import { isJsonLike, isParseableJson } from "./json.js";
|
|
7
7
|
import { escapeHtml, t, tx } from "./locales.js";
|
|
8
8
|
import { anyWordMatchesAnyOf, endsWithAnyOf, escapeRegex, getAnyOf, includesAnyOf, isAnyOf, startsWithAnyOf } from "./matching.js";
|
|
9
|
+
import { createAcceptHeader, feedMimeTypes, genericFeedMimeTypes, genericHtmlMimeTypes, htmlMimeTypes } from "./mimes.js";
|
|
9
10
|
import { omit, pick, toMap, trimObject } from "./objects.js";
|
|
10
11
|
import { sleep } from "./timers.js";
|
|
11
12
|
import { addMissingProtocol, addMissingScheme, decodeSegment, fixMalformedProtocol, fixMalformedScheme, getPathSegments, getRegistrableDomain, getSubdomain, isHostOf, isHostOrSubdomainOf, isHttpUrl, isIpAddress, isSubdomainOf, normalizeUrl, parseUrl, resolveFeedProtocol, resolveFeedScheme, resolveUrl, stripWww, upgradeProtocol, upgradeScheme } from "./urls.js";
|
|
12
|
-
export { type AnyOf, type DeepOmit, type IsPlainObject, type MaybePromise, type NormalizeOptions, type Nullish, type PartialNullish, type Pattern, type RegistrableDomainOptions, addMissingProtocol, addMissingScheme, anyWordMatchesAnyOf, archiveExtensions, audioExtensions, codeExtensions, coerceArray, coerceBoolean, coerceDate, coerceNumber, coerceSingular, coerceString, decodeSegment, documentExtensions, endsWithAnyOf, escapeHtml, escapeRegex, fixMalformedProtocol, fixMalformedScheme, flashExtensions, fontExtensions, getAnyOf, getPathSegments, getRegistrableDomain, getSubdomain, imageExtensions, includesAnyOf, installerExtensions, isAnyOf, isBoolean, isFunction, isHostOf, isHostOrSubdomainOf, isHttpUrl, isIpAddress, isJsonLike, isNonEmptyString, isNullish, isNumber, isObject, isParseableJson, isPlainObject, isPresent, isString, isSubdomainOf, isValidDate, normalizeUrl, omit, omitEmpty, parseUrl, pick, resolveFeedProtocol, resolveFeedScheme, resolveUrl, sleep, startsWithAnyOf, stripWww, subtitleExtensions, t, toMap, trimObject, tx, upgradeProtocol, upgradeScheme, videoExtensions };
|
|
13
|
+
export { type AnyOf, type DeepOmit, type IsPlainObject, type MaybePromise, type NormalizeOptions, type Nullish, type PartialNullish, type Pattern, type RegistrableDomainOptions, type WeightedMimeType, addMissingProtocol, addMissingScheme, anyWordMatchesAnyOf, archiveExtensions, audioExtensions, codeExtensions, coerceArray, coerceBoolean, coerceDate, coerceNumber, coerceSingular, coerceString, createAcceptHeader, decodeSegment, documentExtensions, endsWithAnyOf, escapeHtml, escapeRegex, feedMimeTypes, fixMalformedProtocol, fixMalformedScheme, flashExtensions, fontExtensions, genericFeedMimeTypes, genericHtmlMimeTypes, getAnyOf, getPathSegments, getRegistrableDomain, getSubdomain, htmlMimeTypes, imageExtensions, includesAnyOf, installerExtensions, isAnyOf, isBoolean, isFunction, isHostOf, isHostOrSubdomainOf, isHttpUrl, isIpAddress, isJsonLike, isNonEmptyString, isNullish, isNumber, isObject, isParseableJson, isPlainObject, isPresent, isString, isSubdomainOf, isValidDate, normalizeUrl, omit, omitEmpty, parseUrl, pick, resolveFeedProtocol, resolveFeedScheme, resolveUrl, sleep, startsWithAnyOf, stripWww, subtitleExtensions, t, toMap, trimObject, tx, upgradeProtocol, upgradeScheme, videoExtensions };
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import { archiveExtensions, audioExtensions, codeExtensions, documentExtensions,
|
|
|
5
5
|
import { isJsonLike, isParseableJson } from "./json.js";
|
|
6
6
|
import { escapeHtml, t, tx } from "./locales.js";
|
|
7
7
|
import { anyWordMatchesAnyOf, endsWithAnyOf, escapeRegex, getAnyOf, includesAnyOf, isAnyOf, startsWithAnyOf } from "./matching.js";
|
|
8
|
+
import { createAcceptHeader, feedMimeTypes, genericFeedMimeTypes, genericHtmlMimeTypes, htmlMimeTypes } from "./mimes.js";
|
|
8
9
|
import { omit, pick, toMap, trimObject } from "./objects.js";
|
|
9
10
|
import { sleep } from "./timers.js";
|
|
10
11
|
import { addMissingProtocol, addMissingScheme, decodeSegment, fixMalformedProtocol, fixMalformedScheme, getPathSegments, getRegistrableDomain, getSubdomain, isHostOf, isHostOrSubdomainOf, isHttpUrl, isIpAddress, isSubdomainOf, normalizeUrl, parseUrl, resolveFeedProtocol, resolveFeedScheme, resolveUrl, stripWww, upgradeProtocol, upgradeScheme } from "./urls.js";
|
|
11
|
-
export { addMissingProtocol, addMissingScheme, anyWordMatchesAnyOf, archiveExtensions, audioExtensions, codeExtensions, coerceArray, coerceBoolean, coerceDate, coerceNumber, coerceSingular, coerceString, decodeSegment, documentExtensions, endsWithAnyOf, escapeHtml, escapeRegex, fixMalformedProtocol, fixMalformedScheme, flashExtensions, fontExtensions, getAnyOf, getPathSegments, getRegistrableDomain, getSubdomain, imageExtensions, includesAnyOf, installerExtensions, isAnyOf, isBoolean, isFunction, isHostOf, isHostOrSubdomainOf, isHttpUrl, isIpAddress, isJsonLike, isNonEmptyString, isNullish, isNumber, isObject, isParseableJson, isPlainObject, isPresent, isString, isSubdomainOf, isValidDate, normalizeUrl, omit, omitEmpty, parseUrl, pick, resolveFeedProtocol, resolveFeedScheme, resolveUrl, sleep, startsWithAnyOf, stripWww, subtitleExtensions, t, toMap, trimObject, tx, upgradeProtocol, upgradeScheme, videoExtensions };
|
|
12
|
+
export { addMissingProtocol, addMissingScheme, anyWordMatchesAnyOf, archiveExtensions, audioExtensions, codeExtensions, coerceArray, coerceBoolean, coerceDate, coerceNumber, coerceSingular, coerceString, createAcceptHeader, decodeSegment, documentExtensions, endsWithAnyOf, escapeHtml, escapeRegex, feedMimeTypes, fixMalformedProtocol, fixMalformedScheme, flashExtensions, fontExtensions, genericFeedMimeTypes, genericHtmlMimeTypes, getAnyOf, getPathSegments, getRegistrableDomain, getSubdomain, htmlMimeTypes, imageExtensions, includesAnyOf, installerExtensions, isAnyOf, isBoolean, isFunction, isHostOf, isHostOrSubdomainOf, isHttpUrl, isIpAddress, isJsonLike, isNonEmptyString, isNullish, isNumber, isObject, isParseableJson, isPlainObject, isPresent, isString, isSubdomainOf, isValidDate, normalizeUrl, omit, omitEmpty, parseUrl, pick, resolveFeedProtocol, resolveFeedScheme, resolveUrl, sleep, startsWithAnyOf, stripWww, subtitleExtensions, t, toMap, trimObject, tx, upgradeProtocol, upgradeScheme, videoExtensions };
|
package/dist/mimes.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WeightedMimeType } from "./types.js";
|
|
2
|
+
//#region src/mimes.d.ts
|
|
3
|
+
export declare const feedMimeTypes: Array<WeightedMimeType>;
|
|
4
|
+
export declare const genericFeedMimeTypes: Array<WeightedMimeType>;
|
|
5
|
+
export declare const htmlMimeTypes: Array<WeightedMimeType>;
|
|
6
|
+
export declare const genericHtmlMimeTypes: Array<WeightedMimeType>;
|
|
7
|
+
export declare const createAcceptHeader: (types: ReadonlyArray<WeightedMimeType>) => string;
|
|
8
|
+
//#endregion
|
package/dist/mimes.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//#region src/mimes.ts
|
|
2
|
+
const feedMimeTypes = [
|
|
3
|
+
{
|
|
4
|
+
mime: "application/atom+xml",
|
|
5
|
+
quality: 1
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
mime: "application/rss+xml",
|
|
9
|
+
quality: 1
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
mime: "application/feed+json",
|
|
13
|
+
quality: 1
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
mime: "application/rdf+xml",
|
|
17
|
+
quality: 1
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
mime: "application/rss",
|
|
21
|
+
quality: .9
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
mime: "text/rss",
|
|
25
|
+
quality: .9
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
mime: "text/rss+xml",
|
|
29
|
+
quality: .9
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
mime: "application/x-rss+xml",
|
|
33
|
+
quality: .9
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
mime: "application/atom",
|
|
37
|
+
quality: .9
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
mime: "application/x.atom+xml",
|
|
41
|
+
quality: .9
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
mime: "application/x-atom+xml",
|
|
45
|
+
quality: .9
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
mime: "text/atom+xml",
|
|
49
|
+
quality: .9
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
mime: "text/atom",
|
|
53
|
+
quality: .9
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
mime: "text/rdf",
|
|
57
|
+
quality: .9
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
mime: "text/rdf+xml",
|
|
61
|
+
quality: .9
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
const genericFeedMimeTypes = [
|
|
65
|
+
{
|
|
66
|
+
mime: "application/xml",
|
|
67
|
+
quality: .8
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
mime: "text/xml",
|
|
71
|
+
quality: .8
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
mime: "application/json",
|
|
75
|
+
quality: .8
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
mime: "text/plain",
|
|
79
|
+
quality: .1
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
const htmlMimeTypes = [{
|
|
83
|
+
mime: "text/html",
|
|
84
|
+
quality: 1
|
|
85
|
+
}, {
|
|
86
|
+
mime: "application/xhtml+xml",
|
|
87
|
+
quality: 1
|
|
88
|
+
}];
|
|
89
|
+
const genericHtmlMimeTypes = [{
|
|
90
|
+
mime: "application/xml",
|
|
91
|
+
quality: .9
|
|
92
|
+
}, {
|
|
93
|
+
mime: "*/*",
|
|
94
|
+
quality: .8
|
|
95
|
+
}];
|
|
96
|
+
const createAcceptHeader = (types) => {
|
|
97
|
+
return types.map((type) => {
|
|
98
|
+
if (type.quality === 1) return type.mime;
|
|
99
|
+
return `${type.mime};q=${type.quality}`;
|
|
100
|
+
}).join(", ");
|
|
101
|
+
};
|
|
102
|
+
//#endregion
|
|
103
|
+
export { createAcceptHeader, feedMimeTypes, genericFeedMimeTypes, genericHtmlMimeTypes, htmlMimeTypes };
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED