video-fps-probe 0.3.0 → 0.4.0-beta.2

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +19 -11
  3. package/dist/analyze.js +10 -1
  4. package/dist/api/codes.d.ts +6 -0
  5. package/dist/api/codes.js +90 -0
  6. package/dist/aspect/index.d.ts +13 -0
  7. package/dist/aspect/index.js +180 -0
  8. package/dist/aspect/rational.js +61 -0
  9. package/dist/cjs/analyze.d.cts +9 -0
  10. package/dist/cjs/api/agreement.d.cts +18 -0
  11. package/dist/cjs/api/codes.d.cts +6 -0
  12. package/dist/cjs/api/errors.d.cts +12 -0
  13. package/dist/cjs/api/guards.d.cts +4 -0
  14. package/dist/cjs/api/summary.d.cts +22 -0
  15. package/dist/cjs/aspect/index.d.cts +13 -0
  16. package/dist/cjs/aspect.cjs +1 -0
  17. package/dist/cjs/check/index.d.cts +60 -0
  18. package/dist/cjs/check.cjs +1 -0
  19. package/dist/cjs/chunks/boxes-B0T2nt3e.cjs +1 -0
  20. package/dist/cjs/chunks/build-DhETwJLO.cjs +1 -0
  21. package/dist/cjs/chunks/color-xqJHSfhZ.cjs +1 -0
  22. package/dist/cjs/chunks/compare-B_HKNwqg.cjs +1 -0
  23. package/dist/cjs/chunks/config-CSbXzEqr.cjs +1 -0
  24. package/dist/cjs/chunks/errors-0oBg1Ai6.cjs +1 -0
  25. package/dist/cjs/chunks/fallback-CyPIR3RM.cjs +1 -0
  26. package/dist/cjs/chunks/guards-DbQNcAZS.cjs +1 -0
  27. package/dist/cjs/chunks/inline-Bx-TQg8f.cjs +1 -0
  28. package/dist/cjs/chunks/isobmff-4RrRf9N-.cjs +1 -0
  29. package/dist/cjs/chunks/matroska-BhgWtuPU.cjs +1 -0
  30. package/dist/cjs/chunks/metadata-ECdzNLkE.cjs +1 -0
  31. package/dist/cjs/chunks/options-B_vLHxHd.cjs +1 -0
  32. package/dist/cjs/chunks/probe-Cn1DtL-C.cjs +1 -0
  33. package/dist/cjs/chunks/rational-Dq5Vza-Q.cjs +1 -0
  34. package/dist/cjs/chunks/reader-Dw11ozVU.cjs +1 -0
  35. package/dist/cjs/chunks/rfps-C-pyKnu8.cjs +1 -0
  36. package/dist/cjs/chunks/runtime-BgAlQQee.cjs +1 -0
  37. package/dist/cjs/chunks/segments-B1H6bDz-.cjs +1 -0
  38. package/dist/cjs/chunks/sniff-CXwqOGwh.cjs +1 -0
  39. package/dist/cjs/chunks/stats-DW7dVdFa.cjs +1 -0
  40. package/dist/cjs/client/types.d.cts +96 -0
  41. package/dist/cjs/color/index.d.cts +7 -0
  42. package/dist/cjs/color.cjs +1 -0
  43. package/dist/cjs/core/reader.d.cts +47 -0
  44. package/dist/cjs/core/types.d.cts +194 -0
  45. package/dist/cjs/engines/types.d.cts +69 -0
  46. package/dist/cjs/header/index.d.cts +28 -0
  47. package/dist/cjs/header/limits.d.cts +26 -0
  48. package/dist/cjs/header.cjs +1 -0
  49. package/dist/cjs/index.cjs +1 -0
  50. package/dist/cjs/index.d.cts +13 -0
  51. package/dist/cjs/plugins/types.d.cts +17 -0
  52. package/dist/cjs/presets/index.d.cts +19 -0
  53. package/dist/cjs/presets.cjs +1 -0
  54. package/dist/cjs/probe.d.cts +3 -0
  55. package/dist/cjs/url/index.d.cts +47 -0
  56. package/dist/cjs/url.cjs +1 -0
  57. package/dist/cjs/worker/protocol.d.cts +47 -0
  58. package/dist/color/codec-string.js +121 -0
  59. package/dist/color/config.js +199 -0
  60. package/dist/color/index.d.ts +7 -0
  61. package/dist/color/index.js +139 -0
  62. package/dist/color/names.js +33 -0
  63. package/dist/color/sps.js +275 -0
  64. package/dist/core/dispatch.js +18 -29
  65. package/dist/core/isobmff/boxes.js +6 -5
  66. package/dist/core/isobmff/build.js +401 -0
  67. package/dist/core/isobmff/config.js +34 -0
  68. package/dist/core/isobmff/header.js +677 -0
  69. package/dist/core/isobmff/index.js +9 -381
  70. package/dist/core/isobmff/moof.js +2 -2
  71. package/dist/core/isobmff/moov.js +3 -3
  72. package/dist/core/matroska/header.js +10 -4
  73. package/dist/core/matroska/index.js +11 -5
  74. package/dist/core/options.js +1 -0
  75. package/dist/core/reader.d.ts +3 -0
  76. package/dist/core/reader.js +13 -7
  77. package/dist/core/result.js +1 -0
  78. package/dist/core/stats.js +3 -0
  79. package/dist/core/types.d.ts +60 -1
  80. package/dist/engines/common.js +2 -0
  81. package/dist/header/index.d.ts +28 -0
  82. package/dist/header/index.js +182 -0
  83. package/dist/header/limits.d.ts +26 -0
  84. package/dist/header/limits.js +144 -0
  85. package/dist/header/metadata.js +2 -0
  86. package/dist/index.d.ts +1 -0
  87. package/dist/index.js +1 -0
  88. package/dist/standalone/own-isobmff.worker.js +1 -1
  89. package/dist/standalone/own-matroska.worker.js +1 -1
  90. package/dist/standalone/own.worker.js +1 -1
  91. package/dist/url/index.d.ts +47 -0
  92. package/dist/url/index.js +335 -0
  93. package/dist/worker/single.js +2 -1
  94. package/package.json +117 -2
@@ -0,0 +1,335 @@
1
+ export class RangeSourceError extends Error {
2
+ code;
3
+ status;
4
+ constructor(code, message, options = {}) {
5
+ super(message, options.cause === undefined ? undefined : { cause: options.cause });
6
+ this.name = 'RangeSourceError';
7
+ this.code = code;
8
+ this.status = typeof options.status === 'number' ? options.status : null;
9
+ }
10
+ }
11
+ const HEAD_BYTES = 65536;
12
+ const CONTENT_RANGE = /^\s*bytes\s+(\d+)-(\d+)\/(\d+|\*)\s*$/i;
13
+ const noop = () => { };
14
+ const tag = (v) => Object.prototype.toString.call(v);
15
+ function shown(value) {
16
+ if (typeof value === 'string')
17
+ return JSON.stringify(value);
18
+ if (typeof value === 'object' && value !== null)
19
+ return Array.isArray(value) ? 'an array' : 'an object';
20
+ return String(value);
21
+ }
22
+ function count(value, what, min = 0) {
23
+ if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < min)
24
+ throw new TypeError(`${what} must be a non-negative safe integer${min > 0 ? ` of at least ${min}` : ''}, got ${shown(value)}`);
25
+ return value;
26
+ }
27
+ function signalOf(value, what) {
28
+ if (value === undefined || value === null)
29
+ return null;
30
+ const s = value;
31
+ if (typeof s !== 'object' || typeof s.aborted !== 'boolean' || typeof s.addEventListener !== 'function' || typeof s.removeEventListener !== 'function')
32
+ throw new TypeError(`${what} must be an AbortSignal, got ${shown(value)}`);
33
+ return value;
34
+ }
35
+ function objectOf(value, what) {
36
+ if (value === undefined)
37
+ return {};
38
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
39
+ throw new TypeError(`${what} must be an object, got ${shown(value)}`);
40
+ return value;
41
+ }
42
+ function fetcherOf(value) {
43
+ if (typeof value !== 'function')
44
+ throw new TypeError(`fetcher must be a function, got ${shown(value)}`);
45
+ return value;
46
+ }
47
+ const reasonOf = (signal) => signal.reason ?? new DOMException('This operation was aborted', 'AbortError');
48
+ function throwIfAborted(signal) {
49
+ if (signal?.aborted)
50
+ throw reasonOf(signal);
51
+ }
52
+ function linked(a, b) {
53
+ if (!a || !b || a === b || a.aborted || b.aborted)
54
+ return [a?.aborted || !b ? a : b, noop];
55
+ const c = new AbortController();
56
+ const fromA = () => c.abort(reasonOf(a));
57
+ const fromB = () => c.abort(reasonOf(b));
58
+ a.addEventListener('abort', fromA, { once: true });
59
+ b.addEventListener('abort', fromB, { once: true });
60
+ return [c.signal, () => (a.removeEventListener('abort', fromA), b.removeEventListener('abort', fromB))];
61
+ }
62
+ function untilAborted(pending, signal, late = noop) {
63
+ return new Promise((resolve, reject) => {
64
+ const stop = () => reject(reasonOf(signal));
65
+ if (signal?.aborted)
66
+ stop();
67
+ else
68
+ signal?.addEventListener('abort', stop, { once: true });
69
+ pending.then((value) => {
70
+ signal?.removeEventListener('abort', stop);
71
+ if (signal?.aborted)
72
+ late(value);
73
+ else
74
+ resolve(value);
75
+ }, (e) => {
76
+ signal?.removeEventListener('abort', stop);
77
+ reject(!signal?.aborted && e?.name === 'AbortError' ? Object.assign(new Error(String(e), { cause: e }), { name: '' }) : e);
78
+ });
79
+ });
80
+ }
81
+ function attempt(run) {
82
+ try {
83
+ return Promise.resolve(run());
84
+ }
85
+ catch (e) {
86
+ return Promise.reject(e);
87
+ }
88
+ }
89
+ function discard(reply) {
90
+ attempt(() => reply?.discard?.()).catch(noop);
91
+ }
92
+ function parseRange(value) {
93
+ const m = CONTENT_RANGE.exec(value);
94
+ if (!m)
95
+ return null;
96
+ const first = Number(m[1]);
97
+ const last = Number(m[2]);
98
+ const total = m[3] === '*' ? null : Number(m[3]);
99
+ if (!Number.isSafeInteger(first) || !Number.isSafeInteger(last) || first > last || (total !== null && !Number.isSafeInteger(total)))
100
+ return null;
101
+ return { first, last, total };
102
+ }
103
+ const present = (value) => value !== undefined && value !== null;
104
+ const contentRangeOf = ({ contentRange: v }) => (typeof v === 'string' ? (v.trim() === '' ? null : v) : present(v) ? String(v) : null);
105
+ function replyOf(value, range) {
106
+ if (typeof value !== 'object' || value === null)
107
+ throw new RangeSourceError('invalid-reply', `the reply to ${range} is ${shown(value)}, not an object`);
108
+ return value;
109
+ }
110
+ function refusal(reply, start, end, size, range) {
111
+ const status = present(reply.status) ? reply.status : null;
112
+ const contentRange = contentRangeOf(reply);
113
+ if (status === null && contentRange === null)
114
+ return new RangeSourceError('unverifiable-reply', `the reply to ${range} has neither a status nor a Content-Range, so it cannot be checked`);
115
+ if (status !== null && status !== 206 && !(status === 200 && start === 0 && end === size)) {
116
+ return new RangeSourceError('unexpected-status', `status ${shown(status)} to ${range} of an object of ${size} bytes, expected 206${start === 0 && end === size ? ' or 200' : ''}`, { status });
117
+ }
118
+ if (contentRange !== null) {
119
+ const r = parseRange(contentRange);
120
+ if (r && r.total !== null && r.total !== size)
121
+ return new RangeSourceError('size-changed', `Content-Range ${shown(contentRange)} gives an object of ${r.total} bytes, the source was opened at ${size} bytes`, { status });
122
+ if (!r || r.first !== start || r.last !== end - 1)
123
+ return new RangeSourceError('range-mismatch', `Content-Range ${shown(contentRange)} does not match ${range}`, { status });
124
+ }
125
+ if (present(reply.contentLength) && reply.contentLength !== end - start)
126
+ return new RangeSourceError('length-mismatch', `Content-Length ${shown(reply.contentLength)} does not match ${range} (${end - start} bytes)`, { status });
127
+ return null;
128
+ }
129
+ function exactly(value, length, what) {
130
+ let bytes;
131
+ if (ArrayBuffer.isView(value))
132
+ bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
133
+ else if (tag(value) === '[object ArrayBuffer]')
134
+ bytes = new Uint8Array(value);
135
+ else
136
+ throw new RangeSourceError('invalid-reply', `${what} is ${value === null ? 'null' : typeof value}, not bytes`);
137
+ if (bytes.byteLength > length)
138
+ throw new RangeSourceError('body-too-long', `${what} holds ${bytes.byteLength} bytes, more than the ${length} requested`);
139
+ if (bytes.byteLength < length)
140
+ throw new RangeSourceError('body-too-short', `${what} holds ${bytes.byteLength} of the ${length} bytes requested`);
141
+ return bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength && tag(bytes.buffer) === '[object ArrayBuffer]' ? bytes : bytes.slice();
142
+ }
143
+ async function bodyOf(reply, length, range, signal) {
144
+ const what = `the body of ${range}`;
145
+ try {
146
+ if (present(reply.bytes))
147
+ return exactly(reply.bytes, length, what);
148
+ const read = reply.body;
149
+ if (typeof read !== 'function')
150
+ throw new RangeSourceError('invalid-reply', `the reply to ${range} has neither bytes nor a body function`);
151
+ return exactly(await untilAborted(attempt(() => read.call(reply, length)), signal), length, what);
152
+ }
153
+ catch (e) {
154
+ discard(reply);
155
+ throw e;
156
+ }
157
+ }
158
+ function request(fetcher, start, end, signal) {
159
+ const range = `bytes=${start}-${end - 1}`;
160
+ return [range, untilAborted(attempt(() => fetcher({ start, end, range, signal })), signal, discard).then((value) => replyOf(value, range))];
161
+ }
162
+ function sourceOf(fetcher, size, own, head) {
163
+ const read = async (start, end, signal) => {
164
+ count(start, 'start');
165
+ count(end, 'end');
166
+ if (start > end || end > size)
167
+ throw new RangeError(`read needs start <= end <= size (${size}), got ${start} and ${end}`);
168
+ const [joined, release] = linked(own, signalOf(signal, 'signal'));
169
+ try {
170
+ throwIfAborted(joined);
171
+ if (start === end)
172
+ return new Uint8Array(0);
173
+ if (head && end <= head.byteLength)
174
+ return head.slice(start, end);
175
+ const [range, pending] = request(fetcher, start, end, joined);
176
+ const reply = await pending;
177
+ const refused = refusal(reply, start, end, size, range);
178
+ if (refused) {
179
+ discard(reply);
180
+ throw refused;
181
+ }
182
+ return await bodyOf(reply, end - start, range, joined);
183
+ }
184
+ finally {
185
+ release();
186
+ }
187
+ };
188
+ const clamp = (value, fallback) => {
189
+ if (value === undefined)
190
+ return fallback;
191
+ const n = Math.round(Number(value)) || 0;
192
+ return n < 0 ? Math.max(size + n, 0) : Math.min(n, size);
193
+ };
194
+ return {
195
+ size,
196
+ read,
197
+ slice(start, end) {
198
+ const from = clamp(start, 0);
199
+ const to = Math.max(from, clamp(end, size));
200
+ return { arrayBuffer: () => read(from, to, own).then((bytes) => bytes.buffer) };
201
+ },
202
+ };
203
+ }
204
+ export function rangeSource(fetcher, init) {
205
+ const f = fetcherOf(fetcher);
206
+ const o = objectOf(init, 'init');
207
+ return sourceOf(f, count(o.size, 'init.size'), signalOf(o.signal, 'init.signal'), null);
208
+ }
209
+ export async function openRangeSource(fetcher, init = {}) {
210
+ const f = fetcherOf(fetcher);
211
+ const o = objectOf(init, 'init');
212
+ const signal = signalOf(o.signal, 'init.signal');
213
+ if (o.size !== undefined)
214
+ return sourceOf(f, count(o.size, 'init.size'), signal, null);
215
+ const headBytes = o.headBytes === undefined ? HEAD_BYTES : count(o.headBytes, 'init.headBytes', 1);
216
+ throwIfAborted(signal);
217
+ const [range, pending] = request(f, 0, headBytes, signal);
218
+ const reply = await pending;
219
+ const status = present(reply.status) ? reply.status : null;
220
+ const contentRange = contentRangeOf(reply);
221
+ const r = contentRange === null ? null : parseRange(contentRange);
222
+ const length = present(reply.contentLength) ? reply.contentLength : null;
223
+ const refuse = (code, message) => {
224
+ discard(reply);
225
+ throw new RangeSourceError(code, message, { status });
226
+ };
227
+ if ((status === 416 || status === null) && contentRange !== null && /^\s*bytes\s+\*\/0\s*$/i.test(contentRange)) {
228
+ discard(reply);
229
+ return sourceOf(f, 0, signal, new Uint8Array(0));
230
+ }
231
+ let size;
232
+ if (status === 200) {
233
+ if (length === null || !Number.isSafeInteger(length) || length < 0 || length > headBytes)
234
+ refuse('unexpected-status', `status 200 to ${range} with ${length === null ? 'no Content-Length' : `Content-Length ${shown(length)}`}: the server sent the whole object instead of the range, and only an object of at most ${headBytes} bytes is accepted that way`);
235
+ if (contentRange !== null && (!r || r.first !== 0 || r.last !== length - 1 || r.total !== length))
236
+ refuse('range-mismatch', `Content-Range ${shown(contentRange)} does not match the whole object of ${length} bytes`);
237
+ size = length;
238
+ }
239
+ else if (status === 206 || (status === null && contentRange !== null)) {
240
+ if (contentRange === null)
241
+ refuse('unverifiable-reply', `the 206 reply to ${range} has no Content-Range, or does not expose it to a cross-origin page, so the object size is unknown: pass init.size`);
242
+ if (!r || r.total === null || r.first !== 0 || r.last !== Math.min(headBytes, r.total) - 1)
243
+ refuse('range-mismatch', `Content-Range ${shown(contentRange)} does not match ${range} of an object of known size`);
244
+ if (length !== null && length !== r.last + 1)
245
+ refuse('length-mismatch', `Content-Length ${shown(length)} does not match Content-Range ${shown(contentRange)}`);
246
+ size = r.total;
247
+ }
248
+ else if (status === null) {
249
+ return refuse('unverifiable-reply', `the reply to ${range} has neither a status nor a Content-Range, so it cannot be checked`);
250
+ }
251
+ else {
252
+ return refuse('unexpected-status', `status ${shown(status)} to ${range}, expected 206`);
253
+ }
254
+ return sourceOf(f, size, signal, await bodyOf(reply, Math.min(size, headBytes), range, signal));
255
+ }
256
+ function named(e, signal) {
257
+ const c = e?.cause;
258
+ const detail = c?.code ?? c?.message;
259
+ return signal?.aborted || e?.name !== 'TypeError' || typeof detail !== 'string' ? e : new TypeError(`${e.message}: ${detail}`, { cause: e });
260
+ }
261
+ export function httpRange(url, init = {}) {
262
+ const href = typeof url === 'string' ? url : typeof url?.href === 'string' ? url.href : null;
263
+ if (!href)
264
+ throw new TypeError(`url must be a non-empty string or a URL, got ${shown(url)}`);
265
+ const o = objectOf(init, 'init');
266
+ const headers = objectOf(o.headers, 'init.headers');
267
+ const run = o.fetch ?? globalThis.fetch;
268
+ if (typeof run !== 'function')
269
+ throw new TypeError('httpRange needs a fetch function: pass init.fetch where globalThis.fetch does not exist');
270
+ return async ({ range, signal }) => {
271
+ const h = new Headers(headers);
272
+ h.set('range', range);
273
+ h.set('accept-encoding', 'identity');
274
+ const fail = (e) => {
275
+ throw named(e, signal);
276
+ };
277
+ const res = await run(href, { headers: h, signal }).catch(fail);
278
+ const length = res.headers.get('content-length');
279
+ return {
280
+ status: res.status,
281
+ contentRange: res.headers.get('content-range'),
282
+ contentLength: length === null ? null : /^\s*\d+\s*$/.test(length) ? Number(length) : Number.NaN,
283
+ body: (expectedLength) => (res.body ? readCapped(res.body, expectedLength, signal).catch(fail) : Promise.resolve(new Uint8Array(0))),
284
+ discard: () => void res.body?.cancel().catch(noop),
285
+ };
286
+ };
287
+ }
288
+ export async function readCapped(body, expectedLength, signal = null) {
289
+ count(expectedLength, 'expectedLength');
290
+ const s = signalOf(signal, 'signal');
291
+ let next;
292
+ let stop;
293
+ const b = body;
294
+ if (typeof b?.getReader === 'function') {
295
+ const reader = body.getReader();
296
+ next = () => reader.read();
297
+ stop = () => void reader.cancel().catch(noop);
298
+ }
299
+ else if (typeof b?.[Symbol.asyncIterator] === 'function') {
300
+ const it = body[Symbol.asyncIterator]();
301
+ next = () => it.next();
302
+ stop = () => {
303
+ attempt(() => body.destroy?.()).catch(noop);
304
+ attempt(() => it.return?.()).catch(noop);
305
+ };
306
+ }
307
+ else {
308
+ throw new TypeError(`body must be a ReadableStream or an async iterable, got ${shown(body)}`);
309
+ }
310
+ const out = new Uint8Array(expectedLength);
311
+ let got = 0;
312
+ try {
313
+ for (;;) {
314
+ throwIfAborted(s);
315
+ const step = await untilAborted(attempt(next), s);
316
+ if (step.done)
317
+ break;
318
+ const chunk = step.value;
319
+ const view = ArrayBuffer.isView(chunk) ? new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength) : tag(chunk) === '[object ArrayBuffer]' ? new Uint8Array(chunk) : null;
320
+ if (!view)
321
+ throw new RangeSourceError('invalid-reply', `the body gave a ${chunk === null ? 'null' : typeof chunk} chunk, not bytes`);
322
+ if (got + view.byteLength > expectedLength)
323
+ throw new RangeSourceError('body-too-long', `the body passed the ${expectedLength} bytes requested`);
324
+ out.set(view, got);
325
+ got += view.byteLength;
326
+ }
327
+ }
328
+ catch (e) {
329
+ stop();
330
+ throw e;
331
+ }
332
+ if (got < expectedLength)
333
+ throw new RangeSourceError('body-too-short', `the body ended after ${got} of the ${expectedLength} bytes requested`);
334
+ return out;
335
+ }
@@ -1,4 +1,5 @@
1
1
  import { analyzeWith } from "../core/dispatch.js";
2
+ import { withErrorCode } from "../core/reader.js";
2
3
  const LABEL = { isobmff: 'ISO BMFF', matroska: 'Matroska' };
3
4
  export const wrongFamily = (served, found) => `the own ${LABEL[served]} worker does not read ${LABEL[found]}`;
4
5
  export function singleContainerEngine(kind, analyzer) {
@@ -6,7 +7,7 @@ export function singleContainerEngine(kind, analyzer) {
6
7
  containers: 'any',
7
8
  run: (blob, name, opts) => analyzeWith(blob, name, opts, (found) => {
8
9
  if (found !== kind)
9
- throw new Error(wrongFamily(kind, found));
10
+ throw withErrorCode('unsupported-container', wrongFamily(kind, found));
10
11
  return analyzer;
11
12
  }),
12
13
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "video-fps-probe",
3
3
  "private": false,
4
- "version": "0.3.0",
4
+ "version": "0.4.0-beta.2",
5
5
  "description": "Video frame rate, frame count and VFR detection from MP4/MOV/WebM/MKV container headers in a Web Worker. Matches ffprobe 8.1.1 on the test corpus (0 mismatches), no decoding.",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -32,6 +32,7 @@
32
32
  "dist",
33
33
  "CHANGELOG.md"
34
34
  ],
35
+ "main": "./dist/cjs/index.cjs",
35
36
  "types": "./dist/index.d.ts",
36
37
  "module": "./dist/index.js",
37
38
  "typesVersions": {
@@ -51,6 +52,18 @@
51
52
  "check": [
52
53
  "dist/check/index.d.ts"
53
54
  ],
55
+ "header": [
56
+ "dist/header/index.d.ts"
57
+ ],
58
+ "url": [
59
+ "dist/url/index.d.ts"
60
+ ],
61
+ "color": [
62
+ "dist/color/index.d.ts"
63
+ ],
64
+ "aspect": [
65
+ "dist/aspect/index.d.ts"
66
+ ],
54
67
  "presets": [
55
68
  "dist/presets/index.d.ts"
56
69
  ],
@@ -79,6 +92,18 @@
79
92
  },
80
93
  "exports": {
81
94
  ".": {
95
+ "module-sync": {
96
+ "types": "./dist/index.d.ts",
97
+ "default": "./dist/index.js"
98
+ },
99
+ "module": {
100
+ "types": "./dist/index.d.ts",
101
+ "default": "./dist/index.js"
102
+ },
103
+ "require": {
104
+ "types": "./dist/cjs/index.d.cts",
105
+ "default": "./dist/cjs/index.cjs"
106
+ },
82
107
  "types": "./dist/index.d.ts",
83
108
  "default": "./dist/index.js"
84
109
  },
@@ -99,10 +124,98 @@
99
124
  "default": "./dist/react/index.js"
100
125
  },
101
126
  "./check": {
127
+ "module-sync": {
128
+ "types": "./dist/check/index.d.ts",
129
+ "default": "./dist/check/index.js"
130
+ },
131
+ "module": {
132
+ "types": "./dist/check/index.d.ts",
133
+ "default": "./dist/check/index.js"
134
+ },
135
+ "require": {
136
+ "types": "./dist/cjs/check/index.d.cts",
137
+ "default": "./dist/cjs/check.cjs"
138
+ },
102
139
  "types": "./dist/check/index.d.ts",
103
140
  "default": "./dist/check/index.js"
104
141
  },
142
+ "./header": {
143
+ "module-sync": {
144
+ "types": "./dist/header/index.d.ts",
145
+ "default": "./dist/header/index.js"
146
+ },
147
+ "module": {
148
+ "types": "./dist/header/index.d.ts",
149
+ "default": "./dist/header/index.js"
150
+ },
151
+ "require": {
152
+ "types": "./dist/cjs/header/index.d.cts",
153
+ "default": "./dist/cjs/header.cjs"
154
+ },
155
+ "types": "./dist/header/index.d.ts",
156
+ "default": "./dist/header/index.js"
157
+ },
158
+ "./url": {
159
+ "module-sync": {
160
+ "types": "./dist/url/index.d.ts",
161
+ "default": "./dist/url/index.js"
162
+ },
163
+ "module": {
164
+ "types": "./dist/url/index.d.ts",
165
+ "default": "./dist/url/index.js"
166
+ },
167
+ "require": {
168
+ "types": "./dist/cjs/url/index.d.cts",
169
+ "default": "./dist/cjs/url.cjs"
170
+ },
171
+ "types": "./dist/url/index.d.ts",
172
+ "default": "./dist/url/index.js"
173
+ },
174
+ "./color": {
175
+ "module-sync": {
176
+ "types": "./dist/color/index.d.ts",
177
+ "default": "./dist/color/index.js"
178
+ },
179
+ "module": {
180
+ "types": "./dist/color/index.d.ts",
181
+ "default": "./dist/color/index.js"
182
+ },
183
+ "require": {
184
+ "types": "./dist/cjs/color/index.d.cts",
185
+ "default": "./dist/cjs/color.cjs"
186
+ },
187
+ "types": "./dist/color/index.d.ts",
188
+ "default": "./dist/color/index.js"
189
+ },
190
+ "./aspect": {
191
+ "module-sync": {
192
+ "types": "./dist/aspect/index.d.ts",
193
+ "default": "./dist/aspect/index.js"
194
+ },
195
+ "module": {
196
+ "types": "./dist/aspect/index.d.ts",
197
+ "default": "./dist/aspect/index.js"
198
+ },
199
+ "require": {
200
+ "types": "./dist/cjs/aspect/index.d.cts",
201
+ "default": "./dist/cjs/aspect.cjs"
202
+ },
203
+ "types": "./dist/aspect/index.d.ts",
204
+ "default": "./dist/aspect/index.js"
205
+ },
105
206
  "./presets": {
207
+ "module-sync": {
208
+ "types": "./dist/presets/index.d.ts",
209
+ "default": "./dist/presets/index.js"
210
+ },
211
+ "module": {
212
+ "types": "./dist/presets/index.d.ts",
213
+ "default": "./dist/presets/index.js"
214
+ },
215
+ "require": {
216
+ "types": "./dist/cjs/presets/index.d.cts",
217
+ "default": "./dist/cjs/presets.cjs"
218
+ },
106
219
  "types": "./dist/presets/index.d.ts",
107
220
  "default": "./dist/presets/index.js"
108
221
  },
@@ -166,7 +279,9 @@
166
279
  "build:demo": "tsc -b && vite build --config demo/vite.config.ts",
167
280
  "preview": "vite preview --config demo/vite.config.ts",
168
281
  "check:package": "publint --strict && node scripts/check-dist.mjs",
169
- "check:types": "npx --yes @arethetypeswrong/cli@0.18.5 --pack . --ignore-rules cjs-resolves-to-esm --exclude-entrypoints ./standalone/own.worker.js ./standalone/own-isobmff.worker.js ./standalone/own-matroska.worker.js",
282
+ "check:types": "npm run check:types:server && npm run check:types:browser",
283
+ "check:types:server": "npx --yes @arethetypeswrong/cli@0.18.5 --pack . --entrypoints . ./header ./url ./color ./aspect ./check ./presets",
284
+ "check:types:browser": "npx --yes @arethetypeswrong/cli@0.18.5 --pack . --ignore-rules cjs-resolves-to-esm --exclude-entrypoints . ./header ./url ./color ./aspect ./check ./presets ./standalone/own.worker.js ./standalone/own-isobmff.worker.js ./standalone/own-matroska.worker.js",
170
285
  "prepack": "npm run build:lib && node scripts/check-dist.mjs",
171
286
  "check:aliases": "node scripts/src-aliases.mjs --check",
172
287
  "check:stable-chunks": "node scripts/check-stable-chunks.mjs",