@d1g1tal/media-type 6.0.0 → 6.0.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,243 @@
1
+ ## [6.0.1](https://github.com/D1g1talEntr0py/media-type/compare/v6.0.0...v6.0.1) (2026-03-01)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **ci:** add workflow_dispatch trigger, correct tarball glob, and add type-check script (a46c2c19baf6c49b3b4e57da3e36de08a6df9e1f)
6
+
7
+ ### Code Refactoring
8
+
9
+ * **parser:** simplify component collection API (681e8f275b46cc39a6f146f1bcdddd85a277136a)
10
+ Replaces the options-object-based filterComponent method with a
11
+ straighter collect function returning a tuple, eliminating unnecessary
12
+ parameter grouping and making call sites easier to read.
13
+
14
+ Switches the whitespace character lookup from an array (O(n) includes)
15
+ to a Set (O(1) has) for a small but consistent performance gain.
16
+
17
+
18
+ ### Documentation
19
+
20
+ * update README badges and fix minor formatting (51cf9457fc604cccde032c060ecb86bf876a9713)
21
+ Replaces static badge URLs with dynamic ones that show live npm download
22
+ counts and the new CI/Codecov status badges, giving visitors an
23
+ immediate signal of project health.
24
+
25
+ Fixes trailing-whitespace and import-block formatting issues.
26
+
27
+
28
+ ### Miscellaneous Chores
29
+
30
+ * **release:** 5.1.0 [skip ci] (f3c6cbffe6ed87a59a5c7b321fc69d269ac61d28)
31
+ ## [5.1.0](https://github.com/D1g1talEntr0py/media-type/compare/v5.0.0...v5.1.0) (2026-03-01)
32
+
33
+ ### Features
34
+
35
+ * convert to TypeScript (06901a60aa3d0643815e5f3c53d934f2dae0b361)
36
+
37
+ ### Code Refactoring
38
+
39
+ * **parser:** simplify component collection API (681e8f275b46cc39a6f146f1bcdddd85a277136a)
40
+ Replaces the options-object-based filterComponent method with a
41
+ straighter collect function returning a tuple, eliminating unnecessary
42
+ parameter grouping and making call sites easier to read.
43
+
44
+ Switches the whitespace character lookup from an array (O(n) includes)
45
+ to a Set (O(1) has) for a small but consistent performance gain.
46
+
47
+ ### Documentation
48
+
49
+ * update README badges and fix minor formatting (51cf9457fc604cccde032c060ecb86bf876a9713)
50
+ Replaces static badge URLs with dynamic ones that show live npm download
51
+ counts and the new CI/Codecov status badges, giving visitors an
52
+ immediate signal of project health.
53
+
54
+ Fixes trailing-whitespace and import-block formatting issues.
55
+
56
+ ### Miscellaneous Chores
57
+
58
+ * upgrade dev dependencies to latest versions (6b54d8b1cddf7dbc824dba54fd5933570b66a262)
59
+ Bumps eslint to v10, typescript-eslint to 8.56, vitest/coverage-v8/ui
60
+ to 4.0.18, @types/node to 25, @types/web to 0.0.338, and several
61
+ transitive deps (esbuild, rollup, vite, acorn, ajv, etc.).
62
+
63
+ Adds @d1g1tal/tsbuild as the project build tool, replacing the previous
64
+ build setup, and introduces a type-check script. Removes the duplicate
65
+ coverage script alias. Sets the minimum Node.js engine to >=20.16.0.
66
+
67
+ Updates .gitignore to track .tsbuild/ output directory.
68
+
69
+ ### Build System
70
+
71
+ * add semantic-release config and release docs (1cdaab0d9db81c363cf1d81e8ae36e758b2b7c57)
72
+ Adds a .releaserc.json that configures semantic-release with the
73
+ conventionalcommits preset, custom release rules (refactor triggers a
74
+ patch bump), grouped changelog sections, npm pack + publish with
75
+ provenance, and a git commit of CHANGELOG.md and package.json after
76
+ each release.
77
+
78
+ Adds a release-process.md guide explaining how to author commits,
79
+ open PRs, merge to main, and verify the automated release, including
80
+ a dry-run section and a troubleshooting FAQ.
81
+
82
+ ### Continuous Integration
83
+
84
+ * add GitHub Actions workflows for CI and release (4ad266f7984742e7c5dd722340dc3c0786e4c7c9)
85
+ Adds a CI workflow that runs lint, type-check, tests with coverage, and
86
+ build across Node.js 20, 22, and 24 on every push and pull request to
87
+ main. Coverage is uploaded to Codecov from the Node 24 run only.
88
+
89
+ Adds a release workflow powered by semantic-release that triggers on
90
+ merges to main and fully automates versioning, changelog generation, npm
91
+ publish with provenance, and GitHub Release creation.
92
+
93
+ Adds a commit-msg git hook that enforces Conventional Commits format so
94
+ that semantic-release can reliably determine version bumps.
95
+
96
+ * add packageManager field for pnpm/action-setup (ee441628159346a66013bb429bf30e583d687b03)
97
+ * trigger actions (836151dd5d4e73e3bf51f2a6d5b11f462eef25a8)
98
+ * trigger actions (c415c4a08169fa103acbaaa9a1268485df6eb4e0)
99
+ * trigger actions (fc350c91e7e2546604361aade7f0f55530095b38)
100
+
101
+ * **release:** 5.1.1 [skip ci] (f4d1336e1031a2d42ff9e2f091019ae0bb90d5f5)
102
+ ## [5.1.1](https://github.com/D1g1talEntr0py/media-type/compare/v5.1.0...v5.1.1) (2026-03-01)
103
+
104
+ ### Bug Fixes
105
+
106
+ * **ci:** add workflow_dispatch trigger, correct tarball glob, and add type-check script (a46c2c19baf6c49b3b4e57da3e36de08a6df9e1f)
107
+
108
+ ### Tests
109
+
110
+ * removed web-platform-tests from .gitignore (db2fbdd787928e9b5ac2661bd4a738221f084280)
111
+
112
+ ### Continuous Integration
113
+
114
+ * added missing test data (12d03ca176a8c4407610774e599325df7790e0bc)
115
+
116
+ * restore correct version and revert bad 5.1.1 changelog entry (c47f3bf32826152f6f6b363e4ed63a9d61ea61dd)
117
+ * upgrade dev dependencies to latest versions (6b54d8b1cddf7dbc824dba54fd5933570b66a262)
118
+ Bumps eslint to v10, typescript-eslint to 8.56, vitest/coverage-v8/ui
119
+ to 4.0.18, @types/node to 25, @types/web to 0.0.338, and several
120
+ transitive deps (esbuild, rollup, vite, acorn, ajv, etc.).
121
+
122
+ Adds @d1g1tal/tsbuild as the project build tool, replacing the previous
123
+ build setup, and introduces a type-check script. Removes the duplicate
124
+ coverage script alias. Sets the minimum Node.js engine to >=20.16.0.
125
+
126
+ Updates .gitignore to track .tsbuild/ output directory.
127
+
128
+
129
+ ### Tests
130
+
131
+ * removed web-platform-tests from .gitignore (db2fbdd787928e9b5ac2661bd4a738221f084280)
132
+
133
+ ### Build System
134
+
135
+ * add semantic-release config and release docs (1cdaab0d9db81c363cf1d81e8ae36e758b2b7c57)
136
+ Adds a .releaserc.json that configures semantic-release with the
137
+ conventionalcommits preset, custom release rules (refactor triggers a
138
+ patch bump), grouped changelog sections, npm pack + publish with
139
+ provenance, and a git commit of CHANGELOG.md and package.json after
140
+ each release.
141
+
142
+ Adds a release-process.md guide explaining how to author commits,
143
+ open PRs, merge to main, and verify the automated release, including
144
+ a dry-run section and a troubleshooting FAQ.
145
+
146
+
147
+ ### Continuous Integration
148
+
149
+ * add GitHub Actions workflows for CI and release (4ad266f7984742e7c5dd722340dc3c0786e4c7c9)
150
+ Adds a CI workflow that runs lint, type-check, tests with coverage, and
151
+ build across Node.js 20, 22, and 24 on every push and pull request to
152
+ main. Coverage is uploaded to Codecov from the Node 24 run only.
153
+
154
+ Adds a release workflow powered by semantic-release that triggers on
155
+ merges to main and fully automates versioning, changelog generation, npm
156
+ publish with provenance, and GitHub Release creation.
157
+
158
+ Adds a commit-msg git hook that enforces Conventional Commits format so
159
+ that semantic-release can reliably determine version bumps.
160
+
161
+ * add packageManager field for pnpm/action-setup (ee441628159346a66013bb429bf30e583d687b03)
162
+ * added missing test data (12d03ca176a8c4407610774e599325df7790e0bc)
163
+ * trigger actions (836151dd5d4e73e3bf51f2a6d5b11f462eef25a8)
164
+ * trigger actions (c415c4a08169fa103acbaaa9a1268485df6eb4e0)
165
+ * trigger actions (fc350c91e7e2546604361aade7f0f55530095b38)
166
+
167
+ ## [5.1.0](https://github.com/D1g1talEntr0py/media-type/compare/v5.0.0...v5.1.0) (2026-03-01)
168
+
169
+ ### Features
170
+
171
+ * convert to TypeScript (06901a60aa3d0643815e5f3c53d934f2dae0b361)
172
+
173
+ ### Code Refactoring
174
+
175
+ * **parser:** simplify component collection API (681e8f275b46cc39a6f146f1bcdddd85a277136a)
176
+ Replaces the options-object-based filterComponent method with a
177
+ straighter collect function returning a tuple, eliminating unnecessary
178
+ parameter grouping and making call sites easier to read.
179
+
180
+ Switches the whitespace character lookup from an array (O(n) includes)
181
+ to a Set (O(1) has) for a small but consistent performance gain.
182
+
183
+
184
+ ### Documentation
185
+
186
+ * update README badges and fix minor formatting (51cf9457fc604cccde032c060ecb86bf876a9713)
187
+ Replaces static badge URLs with dynamic ones that show live npm download
188
+ counts and the new CI/Codecov status badges, giving visitors an
189
+ immediate signal of project health.
190
+
191
+ Fixes trailing-whitespace and import-block formatting issues.
192
+
193
+
194
+ ### Miscellaneous Chores
195
+
196
+ * upgrade dev dependencies to latest versions (6b54d8b1cddf7dbc824dba54fd5933570b66a262)
197
+ Bumps eslint to v10, typescript-eslint to 8.56, vitest/coverage-v8/ui
198
+ to 4.0.18, @types/node to 25, @types/web to 0.0.338, and several
199
+ transitive deps (esbuild, rollup, vite, acorn, ajv, etc.).
200
+
201
+ Adds @d1g1tal/tsbuild as the project build tool, replacing the previous
202
+ build setup, and introduces a type-check script. Removes the duplicate
203
+ coverage script alias. Sets the minimum Node.js engine to >=20.16.0.
204
+
205
+ Updates .gitignore to track .tsbuild/ output directory.
206
+
207
+
208
+ ### Build System
209
+
210
+ * add semantic-release config and release docs (1cdaab0d9db81c363cf1d81e8ae36e758b2b7c57)
211
+ Adds a .releaserc.json that configures semantic-release with the
212
+ conventionalcommits preset, custom release rules (refactor triggers a
213
+ patch bump), grouped changelog sections, npm pack + publish with
214
+ provenance, and a git commit of CHANGELOG.md and package.json after
215
+ each release.
216
+
217
+ Adds a release-process.md guide explaining how to author commits,
218
+ open PRs, merge to main, and verify the automated release, including
219
+ a dry-run section and a troubleshooting FAQ.
220
+
221
+
222
+ ### Continuous Integration
223
+
224
+ * add GitHub Actions workflows for CI and release (4ad266f7984742e7c5dd722340dc3c0786e4c7c9)
225
+ Adds a CI workflow that runs lint, type-check, tests with coverage, and
226
+ build across Node.js 20, 22, and 24 on every push and pull request to
227
+ main. Coverage is uploaded to Codecov from the Node 24 run only.
228
+
229
+ Adds a release workflow powered by semantic-release that triggers on
230
+ merges to main and fully automates versioning, changelog generation, npm
231
+ publish with provenance, and GitHub Release creation.
232
+
233
+ Adds a commit-msg git hook that enforces Conventional Commits format so
234
+ that semantic-release can reliably determine version bumps.
235
+
236
+ * add packageManager field for pnpm/action-setup (ee441628159346a66013bb429bf30e583d687b03)
237
+ * trigger actions (836151dd5d4e73e3bf51f2a6d5b11f462eef25a8)
238
+ * trigger actions (c415c4a08169fa103acbaaa9a1268485df6eb4e0)
239
+ * trigger actions (fc350c91e7e2546604361aade7f0f55530095b38)
240
+
1
241
  # Changelog
2
242
 
3
243
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  # Parse, serialize, and manipulate media types
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@d1g1tal/media-type.svg)](https://www.npmjs.com/package/@d1g1tal/media-type)
4
- [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
5
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org/)
6
- [![Node Version](https://img.shields.io/node/v/@d1g1tal/media-type.svg)](https://nodejs.org)
3
+ [![npm version](https://img.shields.io/npm/v/@d1g1tal/media-type?color=blue)](https://www.npmjs.com/package/@d1g1tal/media-type)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@d1g1tal/media-type)](https://www.npmjs.com/package/@d1g1tal/media-type)
5
+ [![CI](https://github.com/D1g1talEntr0py/media-type/actions/workflows/ci.yml/badge.svg)](https://github.com/D1g1talEntr0py/media-type/actions/workflows/ci.yml)
6
+ [![codecov](https://codecov.io/gh/D1g1talEntr0py/media-type/graph/badge.svg)](https://codecov.io/gh/D1g1talEntr0py/media-type)
7
+ [![License: ISC](https://img.shields.io/github/license/D1g1talEntr0py/media-type)](https://github.com/D1g1talEntr0py/media-type/blob/main/LICENSE)
8
+ [![Node.js](https://img.shields.io/node/v/@d1g1tal/media-type)](https://nodejs.org)
9
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
10
 
8
11
  > **Note**: This is a TypeScript rewrite and fork of the original [`whatwg-mimetype`](https://github.com/jsdom/whatwg-mimetype) package. See [CHANGELOG.md](./CHANGELOG.md) for migration information.
9
12
 
@@ -151,12 +154,12 @@ In addition to the main `MediaType` class, this package also exports:
151
154
  - **Type exports**: `MediaTypeComponent`, `ParsedMediaType` (TypeScript types)
152
155
 
153
156
  ```typescript
154
- import {
155
- MediaType,
156
- MediaTypeParameters,
157
+ import {
158
+ MediaType,
159
+ MediaTypeParameters,
157
160
  MediaTypeParser,
158
161
  type MediaTypeComponent,
159
- type ParsedMediaType
162
+ type ParsedMediaType
160
163
  } from '@d1g1tal/media-type';
161
164
  ```
162
165
 
@@ -201,7 +204,7 @@ This project is a fork and substantial rewrite of the excellent [`whatwg-mimetyp
201
204
  - Optimize bundle size and performance
202
205
  - Maintain WHATWG standard compliance
203
206
 
204
- **Original Author**: Domenic Denicola
207
+ **Original Author**: Domenic Denicola
205
208
  **Current Maintainer**: Jason DiMeo
206
209
 
207
210
  The original contributors' excellent work is acknowledged with gratitude. This fork maintains the same commitment to WHATWG standards compliance while providing a modern TypeScript-first experience.
package/package.json CHANGED
@@ -1,80 +1,85 @@
1
1
  {
2
- "name": "@d1g1tal/media-type",
3
- "description": "Parses, serializes, and manipulates media types, according to the WHATWG MIME Sniffing Standard",
4
- "version": "6.0.0",
5
- "author": "Domenic Denicola <d@domenic.me> (https://domenic.me/)",
6
- "maintainers": [
7
- {
8
- "name": "Jason DiMeo",
9
- "email": "jason.dimeo@gmail.com"
10
- }
11
- ],
12
- "license": "ISC",
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/D1g1talEntr0py/media-type.git"
16
- },
17
- "bugs": {
18
- "url": "https://github.com/D1g1talEntr0py/media-type/issues"
19
- },
20
- "homepage": "https://github.com/D1g1talEntr0py/media-type#readme",
21
- "publishConfig": {
22
- "access": "public"
23
- },
24
- "type": "module",
25
- "exports": {
26
- ".": {
27
- "types": "./dist/media-type.d.ts",
28
- "import": "./dist/media-type.js"
29
- }
30
- },
31
- "files": [
32
- "/dist",
33
- "README.md",
34
- "LICENSE",
35
- "CHANGELOG.md"
36
- ],
37
- "keywords": [
38
- "content-type",
39
- "mime type",
40
- "media type",
41
- "mimesniff",
42
- "mime",
43
- "http",
44
- "whatwg",
45
- "typescript",
46
- "esm",
47
- "parser",
48
- "serializer"
49
- ],
50
- "devDependencies": {
51
- "@eslint/js": "^9.39.0",
52
- "@types/node": "^24.9.2",
53
- "@typescript-eslint/eslint-plugin": "^8.46.2",
54
- "@typescript-eslint/parser": "^8.46.2",
55
- "@typescript/lib-dom": "npm:@types/web@^0.0.288",
56
- "@vitest/coverage-v8": "4.0.6",
57
- "@vitest/ui": "^4.0.6",
58
- "eslint": "^9.39.0",
59
- "eslint-plugin-jsdoc": "^61.1.11",
60
- "printable-string": "^0.3.0",
61
- "typescript": "^5.9.3",
62
- "typescript-eslint": "^8.46.2",
63
- "vitest": "^4.0.6",
64
- "whatwg-encoding": "^3.1.1"
65
- },
66
- "browserslist": [
67
- "defaults and fully supports es6-module",
68
- "maintained node versions"
69
- ],
70
- "scripts": {
71
- "build": "tsbuild",
72
- "test": "vitest run",
73
- "test:watch": "vitest",
74
- "test:ui": "vitest run --ui",
75
- "test:coverage": "vitest run --coverage",
76
- "lint": "eslint",
77
- "coverage": "vitest run --coverage",
78
- "pretest": "node tests/scripts/get-latest-platform-tests.ts"
79
- }
80
- }
2
+ "name": "@d1g1tal/media-type",
3
+ "description": "Parses, serializes, and manipulates media types, according to the WHATWG MIME Sniffing Standard",
4
+ "version": "6.0.1",
5
+ "author": "Domenic Denicola <d@domenic.me> (https://domenic.me/)",
6
+ "maintainers": [
7
+ {
8
+ "name": "Jason DiMeo",
9
+ "email": "jason.dimeo@gmail.com"
10
+ }
11
+ ],
12
+ "license": "ISC",
13
+ "packageManager": "pnpm@10.30.3",
14
+ "engines": {
15
+ "node": ">=20.16.0"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/D1g1talEntr0py/media-type.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/D1g1talEntr0py/media-type/issues"
23
+ },
24
+ "homepage": "https://github.com/D1g1talEntr0py/media-type#readme",
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "type": "module",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/media-type.d.ts",
32
+ "import": "./dist/media-type.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "/dist",
37
+ "README.md",
38
+ "LICENSE",
39
+ "CHANGELOG.md"
40
+ ],
41
+ "keywords": [
42
+ "content-type",
43
+ "mime type",
44
+ "media type",
45
+ "mimesniff",
46
+ "mime",
47
+ "http",
48
+ "whatwg",
49
+ "typescript",
50
+ "esm",
51
+ "parser",
52
+ "serializer"
53
+ ],
54
+ "scripts": {
55
+ "build": "tsbuild",
56
+ "type-check": "tsbuild --noEmit",
57
+ "test": "vitest run",
58
+ "test:watch": "vitest",
59
+ "test:ui": "vitest run --ui",
60
+ "test:coverage": "vitest run --coverage",
61
+ "lint": "eslint",
62
+ "pretest": "node tests/scripts/get-latest-platform-tests.ts"
63
+ },
64
+ "devDependencies": {
65
+ "@d1g1tal/tsbuild": "^1.3.0",
66
+ "@eslint/js": "^10.0.1",
67
+ "@types/node": "^25.3.3",
68
+ "@typescript-eslint/eslint-plugin": "^8.56.1",
69
+ "@typescript-eslint/parser": "^8.56.1",
70
+ "@typescript/lib-dom": "npm:@types/web@^0.0.338",
71
+ "@vitest/coverage-v8": "4.0.18",
72
+ "@vitest/ui": "^4.0.18",
73
+ "eslint": "^10.0.2",
74
+ "eslint-plugin-jsdoc": "^62.7.1",
75
+ "printable-string": "^0.3.0",
76
+ "typescript": "^5.9.3",
77
+ "typescript-eslint": "^8.56.1",
78
+ "vitest": "^4.0.18",
79
+ "whatwg-encoding": "^3.1.1"
80
+ },
81
+ "browserslist": [
82
+ "defaults and fully supports es6-module",
83
+ "maintained node versions"
84
+ ]
85
+ }
@@ -1,184 +0,0 @@
1
- /**
2
- * Class representing the parameters for a media type record.
3
- * This class extends a JavaScript Map<string, string>.
4
- *
5
- * However, MediaTypeParameters methods will always interpret their arguments
6
- * as appropriate for media types, so parameter names will be lowercased,
7
- * and attempting to set invalid characters will throw an Error.
8
- *
9
- * @see https://mimesniff.spec.whatwg.org
10
- * @author D1g1talEntr0py <jason.dimeo@gmail.com>
11
- */
12
- declare class MediaTypeParameters extends Map<string, string> {
13
- /**
14
- * Create a new MediaTypeParameters instance.
15
- *
16
- * @param entries An array of [ name, value ] tuples.
17
- */
18
- constructor(entries?: Iterable<[string, string]>);
19
- /**
20
- * Indicates whether the supplied name and value are valid media type parameters.
21
- *
22
- * @param name The name of the media type parameter to validate.
23
- * @param value The media type parameter value to validate.
24
- * @returns true if the media type parameter is valid, false otherwise.
25
- */
26
- static isValid(name: string, value: string): boolean;
27
- /**
28
- * Gets the media type parameter value for the supplied name.
29
- *
30
- * @param name The name of the media type parameter to retrieve.
31
- * @returns The media type parameter value.
32
- */
33
- get(name: string): string | undefined;
34
- /**
35
- * Indicates whether the media type parameter with the specified name exists or not.
36
- *
37
- * @param name The name of the media type parameter to check.
38
- * @returns true if the media type parameter exists, false otherwise.
39
- */
40
- has(name: string): boolean;
41
- /**
42
- * Adds a new media type parameter using the specified name and value to the MediaTypeParameters.
43
- * If an parameter with the same name already exists, the parameter will be updated.
44
- *
45
- * @param name The name of the media type parameter to set.
46
- * @param value The media type parameter value.
47
- * @returns This instance.
48
- */
49
- set(name: string, value: string): this;
50
- /**
51
- * Removes the media type parameter using the specified name.
52
- *
53
- * @param name The name of the media type parameter to delete.
54
- * @returns true if the parameter existed and has been removed, or false if the parameter does not exist.
55
- */
56
- delete(name: string): boolean;
57
- /**
58
- * Returns a string representation of the media type parameters.
59
- *
60
- * @returns The string representation of the media type parameters.
61
- */
62
- toString(): string;
63
- /**
64
- * Returns the name of this class.
65
- *
66
- * @returns The name of this class.
67
- */
68
- get [Symbol.toStringTag](): string;
69
- }
70
-
71
- /**
72
- * Class used to parse media types.
73
- * @see https://mimesniff.spec.whatwg.org/#understanding-mime-types
74
- */
75
- declare class MediaType {
76
- private readonly _type;
77
- private readonly _subtype;
78
- private readonly _parameters;
79
- /**
80
- * Create a new MediaType instance from a string representation.
81
- * @param mediaType The media type to parse.
82
- * @param parameters Optional parameters.
83
- */
84
- constructor(mediaType: string, parameters?: Record<string, string>);
85
- /**
86
- * Parses a media type string.
87
- * @param mediaType The media type to parse.
88
- * @returns The parsed media type or null if the mediaType cannot be parsed.
89
- */
90
- static parse(mediaType: string): MediaType | null;
91
- /**
92
- * Gets the type.
93
- * @returns The type.
94
- */
95
- get type(): string;
96
- /**
97
- * Gets the subtype.
98
- * @returns The subtype.
99
- */
100
- get subtype(): string;
101
- /**
102
- * Gets the media type essence (type/subtype).
103
- * @returns The media type without any parameters
104
- */
105
- get essence(): string;
106
- /**
107
- * Gets the parameters.
108
- * @returns The media type parameters.
109
- */
110
- get parameters(): MediaTypeParameters;
111
- /**
112
- * Checks if the media type matches the specified type.
113
- *
114
- * @param mediaType The media type to check.
115
- * @returns true if the media type matches the specified type, false otherwise.
116
- */
117
- matches(mediaType: MediaType | string): boolean;
118
- /**
119
- * Gets the serialized version of the media type.
120
- *
121
- * @returns The serialized media type.
122
- */
123
- toString(): string;
124
- /**
125
- * Gets the name of the class.
126
- * @returns The class name
127
- */
128
- get [Symbol.toStringTag](): string;
129
- }
130
-
131
- interface MediaTypeComponent {
132
- position?: number;
133
- input: string;
134
- lowerCase?: boolean;
135
- trim?: boolean;
136
- }
137
- interface ParsedMediaType {
138
- type: string;
139
- subtype: string;
140
- parameters: MediaTypeParameters;
141
- }
142
- /**
143
- * Parser for media types.
144
- * @see https://mimesniff.spec.whatwg.org/#parsing-a-mime-type
145
- * @author D1g1talEntr0py <jason.dimeo@gmail.com>
146
- */
147
- declare class MediaTypeParser {
148
- /**
149
- * Function to parse a media type.
150
- * @param input The media type to parse
151
- * @returns An object populated with the parsed media type properties and any parameters.
152
- */
153
- static parse(input: string): ParsedMediaType;
154
- /**
155
- * Gets the name of this class.
156
- * @returns The string tag of this class.
157
- */
158
- get [Symbol.toStringTag](): string;
159
- /**
160
- * Filters a component from the input string.
161
- * @param options The options.
162
- * @param charactersToFilter The characters to filter.
163
- * @returns An object that includes the resulting string and updated position.
164
- */
165
- private static filterComponent;
166
- /**
167
- * Collects all the HTTP quoted strings.
168
- * This variant only implements it with the extract-value flag set.
169
- * @param input The string to process.
170
- * @param position The starting position.
171
- * @returns An array that includes the resulting string and updated position.
172
- */
173
- private static collectHttpQuotedString;
174
- /**
175
- * Generates an error message.
176
- * @param component The component name.
177
- * @param value The component value.
178
- * @returns The error message.
179
- */
180
- private static generateErrorMessage;
181
- }
182
-
183
- export { MediaType, MediaTypeParameters, MediaTypeParser };
184
- export type { MediaTypeComponent, ParsedMediaType };
@@ -1,283 +0,0 @@
1
- // src/utils.ts
2
- var httpTokenCodePoints = /^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u;
3
-
4
- // src/media-type-parameters.ts
5
- var matcher = /(["\\])/ug;
6
- var httpQuotedStringTokenCodePoints = /^[\t\u0020-\u007E\u0080-\u00FF]*$/u;
7
- var MediaTypeParameters = class _MediaTypeParameters extends Map {
8
- /**
9
- * Create a new MediaTypeParameters instance.
10
- *
11
- * @param entries An array of [ name, value ] tuples.
12
- */
13
- constructor(entries = []) {
14
- super(entries);
15
- }
16
- /**
17
- * Indicates whether the supplied name and value are valid media type parameters.
18
- *
19
- * @param name The name of the media type parameter to validate.
20
- * @param value The media type parameter value to validate.
21
- * @returns true if the media type parameter is valid, false otherwise.
22
- */
23
- static isValid(name, value) {
24
- return httpTokenCodePoints.test(name) && httpQuotedStringTokenCodePoints.test(value);
25
- }
26
- /**
27
- * Gets the media type parameter value for the supplied name.
28
- *
29
- * @param name The name of the media type parameter to retrieve.
30
- * @returns The media type parameter value.
31
- */
32
- get(name) {
33
- return super.get(name.toLowerCase());
34
- }
35
- /**
36
- * Indicates whether the media type parameter with the specified name exists or not.
37
- *
38
- * @param name The name of the media type parameter to check.
39
- * @returns true if the media type parameter exists, false otherwise.
40
- */
41
- has(name) {
42
- return super.has(name.toLowerCase());
43
- }
44
- /**
45
- * Adds a new media type parameter using the specified name and value to the MediaTypeParameters.
46
- * If an parameter with the same name already exists, the parameter will be updated.
47
- *
48
- * @param name The name of the media type parameter to set.
49
- * @param value The media type parameter value.
50
- * @returns This instance.
51
- */
52
- set(name, value) {
53
- if (!_MediaTypeParameters.isValid(name, value)) {
54
- throw new Error(`Invalid media type parameter name/value: ${name}/${value}`);
55
- }
56
- super.set(name.toLowerCase(), value);
57
- return this;
58
- }
59
- /**
60
- * Removes the media type parameter using the specified name.
61
- *
62
- * @param name The name of the media type parameter to delete.
63
- * @returns true if the parameter existed and has been removed, or false if the parameter does not exist.
64
- */
65
- delete(name) {
66
- return super.delete(name.toLowerCase());
67
- }
68
- /**
69
- * Returns a string representation of the media type parameters.
70
- *
71
- * @returns The string representation of the media type parameters.
72
- */
73
- toString() {
74
- return Array.from(this).map(([name, value]) => `;${name}=${!value || !httpTokenCodePoints.test(value) ? `"${value.replace(matcher, "\\$1")}"` : value}`).join("");
75
- }
76
- /**
77
- * Returns the name of this class.
78
- *
79
- * @returns The name of this class.
80
- */
81
- get [Symbol.toStringTag]() {
82
- return "MediaTypeParameters";
83
- }
84
- };
85
-
86
- // src/media-type-parser.ts
87
- var whitespaceCharacters = [" ", " ", "\n", "\r"];
88
- var trailingWhitespace = /[ \t\n\r]+$/u;
89
- var leadingAndTrailingWhitespace = /^[ \t\n\r]+|[ \t\n\r]+$/ug;
90
- var MediaTypeParser = class _MediaTypeParser {
91
- /**
92
- * Function to parse a media type.
93
- * @param input The media type to parse
94
- * @returns An object populated with the parsed media type properties and any parameters.
95
- */
96
- static parse(input) {
97
- input = input.replace(leadingAndTrailingWhitespace, "");
98
- const length = input.length, trim = true, lowerCase = false;
99
- const { position: initialPosition, result: type } = _MediaTypeParser.filterComponent({ input }, "/");
100
- let position = initialPosition;
101
- if (!type.length || position >= length || !httpTokenCodePoints.test(type)) {
102
- throw new TypeError(_MediaTypeParser.generateErrorMessage("type", type));
103
- }
104
- let subtype = "";
105
- ({ position, result: subtype } = _MediaTypeParser.filterComponent({ position: ++position, input, trim }, ";"));
106
- if (!subtype.length || !httpTokenCodePoints.test(subtype)) {
107
- throw new TypeError(_MediaTypeParser.generateErrorMessage("subtype", subtype));
108
- }
109
- let parameterName = "";
110
- let parameterValue = null;
111
- const parameters = new MediaTypeParameters();
112
- while (position++ < length) {
113
- while (whitespaceCharacters.includes(input[position])) {
114
- ++position;
115
- }
116
- ({ position, result: parameterName } = _MediaTypeParser.filterComponent({ position, input, lowerCase }, ";", "="));
117
- if (position < length) {
118
- if (input[position] == ";") {
119
- continue;
120
- }
121
- ++position;
122
- }
123
- if (input[position] === '"') {
124
- [parameterValue, position] = _MediaTypeParser.collectHttpQuotedString(input, position);
125
- while (position < length && input[position] !== ";") {
126
- ++position;
127
- }
128
- } else {
129
- ({ position, result: parameterValue } = _MediaTypeParser.filterComponent({ position, input, lowerCase, trim }, ";"));
130
- if (!parameterValue) {
131
- continue;
132
- }
133
- }
134
- if (parameterName && parameterValue !== null && MediaTypeParameters.isValid(parameterName, parameterValue) && !parameters.has(parameterName)) {
135
- parameters.set(parameterName, parameterValue);
136
- }
137
- }
138
- return { type, subtype, parameters };
139
- }
140
- /**
141
- * Gets the name of this class.
142
- * @returns The string tag of this class.
143
- */
144
- get [Symbol.toStringTag]() {
145
- return "MediaTypeParser";
146
- }
147
- /**
148
- * Filters a component from the input string.
149
- * @param options The options.
150
- * @param charactersToFilter The characters to filter.
151
- * @returns An object that includes the resulting string and updated position.
152
- */
153
- static filterComponent({ position = 0, input, lowerCase = true, trim = false }, ...charactersToFilter) {
154
- let result = "";
155
- for (const length = input.length; position < length && !charactersToFilter.includes(input[position]); position++) {
156
- result += input[position];
157
- }
158
- if (lowerCase) {
159
- result = result.toLowerCase();
160
- }
161
- if (trim) {
162
- result = result.replace(trailingWhitespace, "");
163
- }
164
- return { position, result };
165
- }
166
- /**
167
- * Collects all the HTTP quoted strings.
168
- * This variant only implements it with the extract-value flag set.
169
- * @param input The string to process.
170
- * @param position The starting position.
171
- * @returns An array that includes the resulting string and updated position.
172
- */
173
- static collectHttpQuotedString(input, position) {
174
- let value = "";
175
- for (let length = input.length, char; ++position < length; ) {
176
- if ((char = input[position]) === '"') {
177
- break;
178
- }
179
- value += char == "\\" && ++position < length ? input[position] : char;
180
- }
181
- return [value, position];
182
- }
183
- /**
184
- * Generates an error message.
185
- * @param component The component name.
186
- * @param value The component value.
187
- * @returns The error message.
188
- */
189
- static generateErrorMessage(component, value) {
190
- return `Invalid ${component} "${value}": only HTTP token code points are valid.`;
191
- }
192
- };
193
-
194
- // src/media-type.ts
195
- var MediaType = class _MediaType {
196
- _type;
197
- _subtype;
198
- _parameters;
199
- /**
200
- * Create a new MediaType instance from a string representation.
201
- * @param mediaType The media type to parse.
202
- * @param parameters Optional parameters.
203
- */
204
- constructor(mediaType, parameters = {}) {
205
- if (parameters === null || typeof parameters !== "object" || Array.isArray(parameters)) {
206
- throw new TypeError("The parameters argument must be an object");
207
- }
208
- ({ type: this._type, subtype: this._subtype, parameters: this._parameters } = MediaTypeParser.parse(mediaType));
209
- for (const [name, value] of Object.entries(parameters)) {
210
- this._parameters.set(name, value);
211
- }
212
- }
213
- /**
214
- * Parses a media type string.
215
- * @param mediaType The media type to parse.
216
- * @returns The parsed media type or null if the mediaType cannot be parsed.
217
- */
218
- static parse(mediaType) {
219
- try {
220
- return new _MediaType(mediaType);
221
- } catch {
222
- }
223
- return null;
224
- }
225
- /**
226
- * Gets the type.
227
- * @returns The type.
228
- */
229
- get type() {
230
- return this._type;
231
- }
232
- /**
233
- * Gets the subtype.
234
- * @returns The subtype.
235
- */
236
- get subtype() {
237
- return this._subtype;
238
- }
239
- /**
240
- * Gets the media type essence (type/subtype).
241
- * @returns The media type without any parameters
242
- */
243
- get essence() {
244
- return `${this._type}/${this._subtype}`;
245
- }
246
- /**
247
- * Gets the parameters.
248
- * @returns The media type parameters.
249
- */
250
- get parameters() {
251
- return this._parameters;
252
- }
253
- /**
254
- * Checks if the media type matches the specified type.
255
- *
256
- * @param mediaType The media type to check.
257
- * @returns true if the media type matches the specified type, false otherwise.
258
- */
259
- matches(mediaType) {
260
- return typeof mediaType === "string" ? this.essence.includes(mediaType) : this._type === mediaType._type && this._subtype === mediaType._subtype;
261
- }
262
- /**
263
- * Gets the serialized version of the media type.
264
- *
265
- * @returns The serialized media type.
266
- */
267
- toString() {
268
- return `${this.essence}${this._parameters.toString()}`;
269
- }
270
- /**
271
- * Gets the name of the class.
272
- * @returns The class name
273
- */
274
- get [Symbol.toStringTag]() {
275
- return "MediaType";
276
- }
277
- };
278
- export {
279
- MediaType,
280
- MediaTypeParameters,
281
- MediaTypeParser
282
- };
283
- //# sourceMappingURL=media-type.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/utils.ts", "../src/media-type-parameters.ts", "../src/media-type-parser.ts", "../src/media-type.ts"],
4
- "sourcesContent": ["export const httpTokenCodePoints: RegExp = /^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u;", "import { httpTokenCodePoints } from './utils.js';\n\nconst matcher: RegExp = /([\"\\\\])/ug;\nconst httpQuotedStringTokenCodePoints: RegExp = /^[\\t\\u0020-\\u007E\\u0080-\\u00FF]*$/u;\n\n/**\n * Class representing the parameters for a media type record.\n * This class extends a JavaScript Map<string, string>.\n *\n * However, MediaTypeParameters methods will always interpret their arguments\n * as appropriate for media types, so parameter names will be lowercased,\n * and attempting to set invalid characters will throw an Error.\n *\n * @see https://mimesniff.spec.whatwg.org\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class MediaTypeParameters extends Map<string, string> {\n\t/**\n\t * Create a new MediaTypeParameters instance.\n\t *\n\t * @param entries An array of [ name, value ] tuples.\n\t */\n\tconstructor(entries: Iterable<[string, string]> = []) {\n\t\tsuper(entries);\n\t}\n\n\t/**\n\t * Indicates whether the supplied name and value are valid media type parameters.\n\t *\n\t * @param name The name of the media type parameter to validate.\n\t * @param value The media type parameter value to validate.\n\t * @returns true if the media type parameter is valid, false otherwise.\n\t */\n\tstatic isValid(name: string, value: string): boolean {\n\t\treturn httpTokenCodePoints.test(name) && httpQuotedStringTokenCodePoints.test(value);\n\t}\n\n\t/**\n\t * Gets the media type parameter value for the supplied name.\n\t *\n\t * @param name The name of the media type parameter to retrieve.\n\t * @returns The media type parameter value.\n\t */\n\toverride get(name: string): string | undefined {\n\t\treturn super.get(name.toLowerCase());\n\t}\n\n\t/**\n\t * Indicates whether the media type parameter with the specified name exists or not.\n\t *\n\t * @param name The name of the media type parameter to check.\n\t * @returns true if the media type parameter exists, false otherwise.\n\t */\n\toverride has(name: string): boolean {\n\t\treturn super.has(name.toLowerCase());\n\t}\n\n\t/**\n\t * Adds a new media type parameter using the specified name and value to the MediaTypeParameters.\n\t * If an parameter with the same name already exists, the parameter will be updated.\n\t *\n\t * @param name The name of the media type parameter to set.\n\t * @param value The media type parameter value.\n\t * @returns This instance.\n\t */\n\toverride set(name: string, value: string): this {\n\t\tif (!MediaTypeParameters.isValid(name, value)) {\n\t\t\tthrow new Error(`Invalid media type parameter name/value: ${name}/${value}`);\n\t\t}\n\n\t\tsuper.set(name.toLowerCase(), value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes the media type parameter using the specified name.\n\t *\n\t * @param name The name of the media type parameter to delete.\n\t * @returns true if the parameter existed and has been removed, or false if the parameter does not exist.\n\t */\n\toverride delete(name: string): boolean {\n\t\treturn super.delete(name.toLowerCase());\n\t}\n\n\t/**\n\t * Returns a string representation of the media type parameters.\n\t *\n\t * @returns The string representation of the media type parameters.\n\t */\n\toverride toString(): string {\n\t\treturn Array.from(this).map(([ name, value ]) => `;${name}=${!value || !httpTokenCodePoints.test(value) ? `\"${value.replace(matcher, '\\\\$1')}\"` : value}`).join('');\n\t}\n\n\t/**\n\t * Returns the name of this class.\n\t *\n\t * @returns The name of this class.\n\t */\n\toverride get [Symbol.toStringTag](): string {\n\t\treturn 'MediaTypeParameters';\n\t}\n}", "import { MediaTypeParameters } from './media-type-parameters.js';\nimport { httpTokenCodePoints } from './utils.js';\n\nconst whitespaceCharacters: string[] = [' ', '\\t', '\\n', '\\r'];\nconst trailingWhitespace: RegExp = /[ \\t\\n\\r]+$/u;\nconst leadingAndTrailingWhitespace: RegExp = /^[ \\t\\n\\r]+|[ \\t\\n\\r]+$/ug;\n\nexport interface MediaTypeComponent {\n\tposition?: number;\n\tinput: string;\n\tlowerCase?: boolean;\n\ttrim?: boolean;\n}\n\nexport interface ParsedMediaType {\n\ttype: string;\n\tsubtype: string;\n\tparameters: MediaTypeParameters;\n}\n\n/**\n * Parser for media types.\n * @see https://mimesniff.spec.whatwg.org/#parsing-a-mime-type\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class MediaTypeParser {\n\t/**\n\t * Function to parse a media type.\n\t * @param input The media type to parse\n\t * @returns An object populated with the parsed media type properties and any parameters.\n\t */\n\tstatic parse(input: string): ParsedMediaType {\n\t\tinput = input.replace(leadingAndTrailingWhitespace, '');\n\n\t\tconst length = input.length, trim = true, lowerCase = false;\n\t\tconst { position: initialPosition, result: type } = MediaTypeParser.filterComponent({ input }, '/');\n\t\tlet position = initialPosition;\n\n\t\tif (!type.length || position >= length || !httpTokenCodePoints.test(type)) {\n\t\t\tthrow new TypeError(MediaTypeParser.generateErrorMessage('type', type));\n\t\t}\n\n\t\tlet subtype = '';\n\t\t({ position, result: subtype } = MediaTypeParser.filterComponent({ position: ++position, input, trim }, ';')); // `++position` Skips past \"/\"\n\n\t\tif (!subtype.length || !httpTokenCodePoints.test(subtype)) {\n\t\t\tthrow new TypeError(MediaTypeParser.generateErrorMessage('subtype', subtype));\n\t\t}\n\n\t\tlet parameterName = '';\n\t\tlet parameterValue: string | null = null;\n\t\tconst parameters = new MediaTypeParameters();\n\n\t\twhile (position++ < length) { // `position++` Skips past \"/\"\n\t\t\twhile (whitespaceCharacters.includes(input[position]!)) { ++position }\n\n\t\t\t({ position, result: parameterName } = MediaTypeParser.filterComponent({ position, input, lowerCase }, ';', '='));\n\n\t\t\tif (position < length) {\n\t\t\t\tif (input[position] == ';') { continue }\n\n\t\t\t\t// Skip past \"=\"\n\t\t\t\t++position;\n\t\t\t}\n\n\t\t\tif (input[position] === '\"') {\n\t\t\t\t[ parameterValue, position ] = MediaTypeParser.collectHttpQuotedString(input, position);\n\n\t\t\t\twhile (position < length && input[position] !== ';') { ++position }\n\t\t\t} else {\n\t\t\t\t({ position, result: parameterValue } = MediaTypeParser.filterComponent({ position, input, lowerCase, trim }, ';'));\n\n\t\t\t\tif (!parameterValue) { continue }\n\t\t\t}\n\n\t\t\tif (parameterName && parameterValue !== null && MediaTypeParameters.isValid(parameterName, parameterValue) && !parameters.has(parameterName)) {\n\t\t\t\tparameters.set(parameterName, parameterValue);\n\t\t\t}\n\t\t}\n\n\t\treturn { type, subtype, parameters };\n\t}\n\n\t/**\n\t * Gets the name of this class.\n\t * @returns The string tag of this class.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'MediaTypeParser';\n\t}\n\n\t/**\n\t * Filters a component from the input string.\n\t * @param options The options.\n\t * @param charactersToFilter The characters to filter.\n\t * @returns An object that includes the resulting string and updated position.\n\t */\n\tprivate static filterComponent({ position = 0, input, lowerCase = true, trim = false }: MediaTypeComponent, ...charactersToFilter: string[]): { position: number, result: string } {\n\t\tlet result = '';\n\t\tfor (const length = input.length; position < length && !charactersToFilter.includes(input[position]!); position++) {\n\t\t\tresult += input[position];\n\t\t}\n\n\t\tif (lowerCase) { result = result.toLowerCase() }\n\t\tif (trim) { result = result.replace(trailingWhitespace, '') }\n\n\t\treturn { position, result };\n\t}\n\n\t/**\n\t * Collects all the HTTP quoted strings.\n\t * This variant only implements it with the extract-value flag set.\n\t * @param input The string to process.\n\t * @param position The starting position.\n\t * @returns An array that includes the resulting string and updated position.\n\t */\n\tprivate static collectHttpQuotedString(input: string, position: number): [string, number] {\n\t\tlet value = '';\n\n\t\tfor (let length = input.length, char; ++position < length;) {\n\t\t\tif ((char = input[position]) === '\"') { break }\n\n\t\t\tvalue += char == '\\\\' && ++position < length ? input[position] : char;\n\t\t}\n\n\t\treturn [ value, position ];\n\t}\n\n\t/**\n\t * Generates an error message.\n\t * @param component The component name.\n\t * @param value The component value.\n\t * @returns The error message.\n\t */\n\tprivate static generateErrorMessage(component: string, value: string): string {\n\t\treturn `Invalid ${component} \"${value}\": only HTTP token code points are valid.`;\n\t}\n}", "import { MediaTypeParser } from './media-type-parser.js';\nimport { MediaTypeParameters } from './media-type-parameters.js';\n\n/**\n * Class used to parse media types.\n * @see https://mimesniff.spec.whatwg.org/#understanding-mime-types\n */\nexport class MediaType {\n\tprivate readonly _type: string;\n\tprivate readonly _subtype: string;\n\tprivate readonly _parameters: MediaTypeParameters;\n\n\t/**\n\t * Create a new MediaType instance from a string representation.\n\t * @param mediaType The media type to parse.\n\t * @param parameters Optional parameters.\n\t */\n\tconstructor(mediaType: string, parameters: Record<string, string> = {}) {\n\t\tif (parameters === null || typeof parameters !== 'object' || Array.isArray(parameters)) {\n\t\t\tthrow new TypeError('The parameters argument must be an object');\n\t\t}\n\n\t\t({ type: this._type, subtype: this._subtype, parameters: this._parameters } = MediaTypeParser.parse(mediaType));\n\n\t\tfor (const [ name, value ] of Object.entries(parameters)) { this._parameters.set(name, value) }\n\t}\n\n\t/**\n\t * Parses a media type string.\n\t * @param mediaType The media type to parse.\n\t * @returns The parsed media type or null if the mediaType cannot be parsed.\n\t */\n\tstatic parse(mediaType: string): MediaType | null {\n\t\ttry {\n\t\t\treturn new MediaType(mediaType);\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Gets the type.\n\t * @returns The type.\n\t */\n\tget type(): string {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * Gets the subtype.\n\t * @returns The subtype.\n\t */\n\tget subtype(): string {\n\t\treturn this._subtype;\n\t}\n\n\t/**\n\t * Gets the media type essence (type/subtype).\n\t * @returns The media type without any parameters\n\t */\n\tget essence(): string {\n\t\treturn `${this._type}/${this._subtype}`;\n\t}\n\n\t/**\n\t * Gets the parameters.\n\t * @returns The media type parameters.\n\t */\n\tget parameters(): MediaTypeParameters {\n\t\treturn this._parameters;\n\t}\n\n\t/**\n\t * Checks if the media type matches the specified type.\n\t *\n\t * @param mediaType The media type to check.\n\t * @returns true if the media type matches the specified type, false otherwise.\n\t */\n\tmatches(mediaType: MediaType | string): boolean {\n\t\treturn typeof mediaType === 'string' ? this.essence.includes(mediaType) : this._type === mediaType._type && this._subtype === mediaType._subtype;\n\t}\n\n\t/**\n\t * Gets the serialized version of the media type.\n\t *\n\t * @returns The serialized media type.\n\t */\n\ttoString(): string {\n\t\treturn `${this.essence}${this._parameters.toString()}`;\n\t}\n\n\t/**\n\t * Gets the name of the class.\n\t * @returns The class name\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'MediaType';\n\t}\n}"],
5
- "mappings": ";AAAO,IAAM,sBAA8B;;;ACE3C,IAAM,UAAkB;AACxB,IAAM,kCAA0C;AAazC,IAAM,sBAAN,MAAM,6BAA4B,IAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5D,YAAY,UAAsC,CAAC,GAAG;AACrD,UAAM,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,OAAO,QAAQ,MAAc,OAAwB;AACpD,WAAO,oBAAoB,KAAK,IAAI,KAAK,gCAAgC,KAAK,KAAK;AAAA,EACpF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQS,IAAI,MAAkC;AAC9C,WAAO,MAAM,IAAI,KAAK,YAAY,CAAC;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQS,IAAI,MAAuB;AACnC,WAAO,MAAM,IAAI,KAAK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