@d0paminedriven/fs 10.1.0 → 12.0.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.
Files changed (60) hide show
  1. package/dist/docs/index.d.ts +151 -0
  2. package/dist/docs/index.js +1163 -0
  3. package/dist/extract/client.d.ts +56 -0
  4. package/dist/extract/client.js +116 -0
  5. package/dist/extract/index.d.ts +66 -0
  6. package/dist/extract/index.js +620 -0
  7. package/dist/fs/index.d.ts +18 -58
  8. package/dist/fs/index.js +89 -19
  9. package/dist/fs-atomic/index.d.ts +25 -39
  10. package/dist/fs-atomic/index.js +94 -13
  11. package/dist/fs-base/index.d.ts +105 -113
  12. package/dist/fs-base/index.js +197 -12
  13. package/dist/fs-core/index.d.ts +18 -26
  14. package/dist/fs-core/index.js +43 -16
  15. package/dist/fs-fetch/index.d.ts +48 -65
  16. package/dist/fs-fetch/index.js +183 -18
  17. package/dist/fs-size/index.d.ts +15 -31
  18. package/dist/fs-size/index.js +63 -15
  19. package/dist/fs-tmp/index.d.ts +178 -195
  20. package/dist/fs-tmp/index.js +320 -17
  21. package/dist/images/index.d.ts +443 -0
  22. package/dist/images/index.js +893 -0
  23. package/dist/images/workup.d.ts +26 -0
  24. package/dist/images/workup.js +316 -0
  25. package/dist/index.d.ts +48 -22
  26. package/dist/index.js +19 -64
  27. package/dist/ld/index.d.ts +14 -16
  28. package/dist/ld/index.js +54 -6
  29. package/dist/mime/index.d.ts +301 -296
  30. package/dist/mime/index.js +348 -13
  31. package/dist/mixins/index.d.ts +30 -0
  32. package/dist/mixins/index.js +54 -0
  33. package/dist/types/index.d.ts +339 -260
  34. package/dist/types/index.js +10 -6
  35. package/dist/types/stream.d.ts +7 -9
  36. package/dist/types/stream.js +1 -1
  37. package/dist/url/index.d.ts +18 -25
  38. package/dist/url/index.js +19 -8
  39. package/dist/utils/index.d.ts +18 -26
  40. package/dist/utils/index.js +80 -7
  41. package/package.json +42 -22
  42. package/dist/chunk-4D2YBCI6.js +0 -163
  43. package/dist/chunk-5CACVZVF.js +0 -386
  44. package/dist/chunk-5H6GE5AO.js +0 -14
  45. package/dist/chunk-7QVYU63E.js +0 -7
  46. package/dist/chunk-DNR5ZI2T.js +0 -75
  47. package/dist/chunk-JZ6JNZZ6.js +0 -77
  48. package/dist/chunk-L2QMQOEJ.js +0 -366
  49. package/dist/chunk-NJHN5OE3.js +0 -33
  50. package/dist/chunk-OHKRQJZH.js +0 -82
  51. package/dist/chunk-OT5JEQKW.js +0 -139
  52. package/dist/chunk-PATMSIQK.js +0 -367
  53. package/dist/chunk-PB5A7ZFD.js +0 -79
  54. package/dist/chunk-VDKUXJE7.js +0 -240
  55. package/dist/chunk-Y5QWE4EG.js +0 -1335
  56. package/dist/chunk-YRCJWFZD.js +0 -107
  57. package/dist/image/index.d.ts +0 -182
  58. package/dist/image/index.js +0 -13
  59. package/dist/image/workup.d.ts +0 -40
  60. package/dist/image/workup.js +0 -12
@@ -1,227 +1,205 @@
1
- import * as stream from 'stream';
2
- import stream__default from 'stream';
3
- import { ObjectEncodingOptions } from 'fs';
4
-
5
- type BufferEncodingUnion = Exclude<CTR<ObjEncodingOptions, "encoding">["encoding"], null>;
6
- interface Dict<T> {
7
- [key: string]: T | undefined;
1
+ import Stream from "stream";
2
+ import { ObjectEncodingOptions } from "fs";
3
+ import { DocMetadataExtractor } from "../docs/index.js";
4
+ import { ImgMetadataExtractor } from "../images/index.js";
5
+ export type BufferEncodingUnion = Exclude<CTR<ObjEncodingOptions, "encoding">["encoding"], null>;
6
+ export interface Dict<T> {
7
+ [key: string]: T | undefined;
8
8
  }
9
- interface ProcessEnv extends Dict<string> {
10
- readonly VERCEL_ENV: typeof process.env.VERCEL_ENV;
11
- readonly NODE_ENV: typeof process.env.NODE_ENV;
12
- /**
13
- * Can be used to change the default timezone at runtime
14
- */
15
- TZ?: string;
9
+ export interface ProcessEnv extends Dict<string> {
10
+ readonly VERCEL_ENV: typeof process.env.VERCEL_ENV;
11
+ readonly NODE_ENV: typeof process.env.NODE_ENV;
12
+ /**
13
+ * Can be used to change the default timezone at runtime
14
+ */
15
+ TZ?: string;
16
16
  }
17
- interface ProcessEnvOptions {
18
- uid?: number | undefined;
19
- gid?: number | undefined;
20
- cwd?: string | URL | undefined;
21
- env?: ProcessEnv | undefined;
17
+ export interface ProcessEnvOptions {
18
+ uid?: number | undefined;
19
+ gid?: number | undefined;
20
+ cwd?: string | URL | undefined;
21
+ env?: ProcessEnv | undefined;
22
22
  }
23
- interface CommonOptions extends ProcessEnvOptions {
24
- /**
25
- * @default false
26
- */
27
- windowsHide?: boolean | undefined;
28
- /**
29
- * @default 0
30
- */
31
- timeout?: number | undefined;
23
+ export interface CommonOptions extends ProcessEnvOptions {
24
+ /**
25
+ * @default false
26
+ */
27
+ windowsHide?: boolean | undefined;
28
+ /**
29
+ * @default 0
30
+ */
31
+ timeout?: number | undefined;
32
32
  }
33
- type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | BigUint64Array | BigInt64Array | Float32Array | Float64Array;
34
- type Signals = "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" | "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" | "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" | "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
35
- type ArrayBufferView = DataView | TypedArray;
36
- type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
37
- type StdioOptions = IOType | (IOType | "ipc" | stream.Stream | number | null | undefined)[];
38
- interface CommonExecOptions extends CommonOptions {
39
- input?: string | ArrayBufferView | undefined;
40
- /**
41
- * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings.
42
- * If passed as an array, the first element is used for `stdin`, the second for
43
- * `stdout`, and the third for `stderr`. A fourth element can be used to
44
- * specify the `stdio` behavior beyond the standard streams.
45
- *
46
- * @default 'pipe'
47
- */
48
- stdio?: StdioOptions | undefined;
49
- killSignal?: Signals | number | undefined;
50
- maxBuffer?: number | undefined;
51
- encoding?: BufferEncoding | "buffer" | null | undefined;
33
+ export type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | BigUint64Array | BigInt64Array | Float32Array | Float64Array;
34
+ export type Signals = "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" | "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" | "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" | "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
35
+ export type ArrayBufferView = DataView | TypedArray;
36
+ export type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
37
+ export type StdioOptions = IOType | (IOType | "ipc" | import("stream").Stream | number | null | undefined)[];
38
+ export interface CommonExecOptions extends CommonOptions {
39
+ input?: string | ArrayBufferView | undefined;
40
+ /**
41
+ * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings.
42
+ * If passed as an array, the first element is used for `stdin`, the second for
43
+ * `stdout`, and the third for `stderr`. A fourth element can be used to
44
+ * specify the `stdio` behavior beyond the standard streams.
45
+ *
46
+ * @default 'pipe'
47
+ */
48
+ stdio?: StdioOptions | undefined;
49
+ killSignal?: Signals | number | undefined;
50
+ maxBuffer?: number | undefined;
51
+ encoding?: BufferEncoding | "buffer" | null | undefined;
52
52
  }
53
- interface ExecSyncOptions extends CommonExecOptions {
54
- shell?: string | undefined;
53
+ export interface ExecSyncOptions extends CommonExecOptions {
54
+ shell?: string | undefined;
55
55
  }
56
- interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
57
- encoding: BufferEncoding;
56
+ export interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
57
+ encoding: BufferEncoding;
58
58
  }
59
- interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
60
- encoding?: "buffer" | null | undefined;
59
+ export interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
60
+ encoding?: "buffer" | null | undefined;
61
61
  }
62
- interface ObjEncodingOptions extends ObjectEncodingOptions {
62
+ export interface ObjEncodingOptions extends ObjectEncodingOptions {}
63
+ export type OpenMode = string | number;
64
+ export interface Abortable {
65
+ /**
66
+ * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
67
+ */
68
+ signal?: AbortSignal | undefined;
63
69
  }
64
- type OpenMode = string | number;
65
- interface Abortable {
66
- /**
67
- * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
68
- */
69
- signal?: AbortSignal | undefined;
70
+ export type Mode = string | number;
71
+ export interface MkDirOptions {
72
+ /**
73
+ * Indicates whether parent folders should be created.
74
+ * If a folder was created, the path to the first created folder will be returned.
75
+ * @default false
76
+ */
77
+ recursive?: boolean | undefined;
78
+ /**
79
+ * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
80
+ * @default 0o777
81
+ */
82
+ mode?: Mode | undefined;
70
83
  }
71
- type Mode = string | number;
72
- interface MkDirOptions {
73
- /**
74
- * Indicates whether parent folders should be created.
75
- * If a folder was created, the path to the first created folder will be returned.
76
- * @default false
77
- */
78
- recursive?: boolean | undefined;
79
- /**
80
- * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
81
- * @default 0o777
82
- */
83
- mode?: Mode | undefined;
84
- }
85
- type BashEnv = "development" | "production" | "test" | undefined;
86
- type WriteStreamProps<T extends string = string> = {
87
- data: WriteableDataType;
88
- cwd: string;
89
- path: T;
84
+ export type BashEnv = "development" | "production" | "test" | undefined;
85
+ export type WriteStreamProps<T extends string = string> = {
86
+ data: WriteableDataType;
87
+ cwd: string;
88
+ path: T;
90
89
  };
91
- type WriteStreamOptions = XOR<BufferEncodingUnion, {
92
- encoding?: BufferEncodingUnion;
93
- autoClose?: boolean;
94
- emitClose?: boolean;
95
- start?: number;
96
- highWaterMark?: number;
97
- flush?: boolean;
90
+ export type WriteStreamOptions = XOR<BufferEncodingUnion, {
91
+ encoding?: BufferEncodingUnion;
92
+ autoClose?: boolean;
93
+ emitClose?: boolean;
94
+ start?: number;
95
+ highWaterMark?: number;
96
+ flush?: boolean;
98
97
  }>;
99
- type WriteableDataType = string | Buffer | NodeJS.TypedArray | NodeJS.NonSharedDataView;
100
- type WriteFileAsyncDataType = string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | stream__default;
101
- interface ReadDirOptionsEntity extends ObjEncodingOptions {
102
- withFileTypes?: false | undefined;
103
- recursive?: boolean | undefined;
98
+ export type WriteableDataType = string | Buffer | NodeJS.TypedArray | NodeJS.NonSharedDataView;
99
+ export type WriteFileAsyncDataType = string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | Stream;
100
+ export interface ReadDirOptionsEntity extends ObjEncodingOptions {
101
+ withFileTypes?: false | undefined;
102
+ recursive?: boolean | undefined;
104
103
  }
105
- type ReadDirOptions = {
106
- [P in keyof ReadDirOptionsEntity]: ReadDirOptionsEntity[P];
107
- };
108
- type WriteFileAsyncOptions = XOR<ObjEncodingOptions & {
104
+ export type ReadDirOptions = { [P in keyof ReadDirOptionsEntity]: ReadDirOptionsEntity[P]; };
105
+ export type WriteFileAsyncOptions = XOR<ObjEncodingOptions & {
106
+ mode?: Mode | undefined;
107
+ flag?: OpenMode | undefined;
108
+ flush?: boolean | undefined;
109
+ } & Abortable, BufferEncodingUnion> | null;
110
+ export type WriteFileAsyncProps<T extends string = string> = {
111
+ path: T;
112
+ data: WriteableDataType;
113
+ options?: (ObjEncodingOptions & {
109
114
  mode?: Mode | undefined;
110
115
  flag?: OpenMode | undefined;
111
116
  flush?: boolean | undefined;
112
- } & Abortable, BufferEncodingUnion> | null;
113
- type WriteFileAsyncProps<T extends string = string> = {
114
- path: T;
115
- data: WriteableDataType;
116
- options?: (ObjEncodingOptions & {
117
- mode?: Mode | undefined;
118
- flag?: OpenMode | undefined;
119
- flush?: boolean | undefined;
120
- } & Abortable) | BufferEncodingUnion | null;
117
+ } & Abortable) | BufferEncodingUnion | null;
121
118
  };
122
- type RmOptions = {
123
- /**
124
- * When `true`, exceptions will be ignored if `path` does not exist.
125
- * @default true
126
- */
127
- force?: boolean | undefined;
128
- /**
129
- * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
130
- * `EPERM` error is encountered, Node.js will retry the operation with a linear
131
- * backoff wait of `retryDelay` ms longer on each try. This option represents the
132
- * number of retries. This option is ignored if the `recursive` option is not
133
- * `true`.
134
- * @default 0
135
- */
136
- maxRetries?: number | undefined;
137
- /**
138
- * If `true`, perform a recursive directory removal. In
139
- * recursive mode, operations are retried on failure.
140
- * @default true
141
- */
142
- recursive?: boolean | undefined;
143
- /**
144
- * The amount of time in milliseconds to wait between retries.
145
- * This option is ignored if the `recursive` option is not `true`.
146
- * @default 100
147
- */
148
- retryDelay?: number | undefined;
119
+ export type RmOptions = {
120
+ /**
121
+ * When `true`, exceptions will be ignored if `path` does not exist.
122
+ * @default true
123
+ */
124
+ force?: boolean | undefined;
125
+ /**
126
+ * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
127
+ * `EPERM` error is encountered, Node.js will retry the operation with a linear
128
+ * backoff wait of `retryDelay` ms longer on each try. This option represents the
129
+ * number of retries. This option is ignored if the `recursive` option is not
130
+ * `true`.
131
+ * @default 0
132
+ */
133
+ maxRetries?: number | undefined;
134
+ /**
135
+ * If `true`, perform a recursive directory removal. In
136
+ * recursive mode, operations are retried on failure.
137
+ * @default true
138
+ */
139
+ recursive?: boolean | undefined;
140
+ /**
141
+ * The amount of time in milliseconds to wait between retries.
142
+ * This option is ignored if the `recursive` option is not `true`.
143
+ * @default 100
144
+ */
145
+ retryDelay?: number | undefined;
149
146
  };
150
- type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
151
- type ReadDirProps<T extends string> = {
152
- path: T;
153
- options?: ReadDirOptions;
147
+ export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
148
+ export type ReadDirProps<T extends string> = {
149
+ path: T;
150
+ options?: ReadDirOptions;
154
151
  };
155
- type MkDirSyncOptions = Mode | (MkDirOptions & {
156
- recursive?: boolean | undefined;
152
+ export type MkDirSyncOptions = Mode | (MkDirOptions & {
153
+ recursive?: boolean | undefined;
157
154
  }) | null | undefined;
158
- type MkDirSyncProps<T extends string> = {
159
- cwd: string;
160
- path: T;
161
- options?: Mode | (MkDirOptions & {
162
- recursive?: boolean | undefined;
163
- }) | null | undefined;
155
+ export type MkDirSyncProps<T extends string> = {
156
+ cwd: string;
157
+ path: T;
158
+ options?: Mode | (MkDirOptions & {
159
+ recursive?: boolean | undefined;
160
+ }) | null | undefined;
164
161
  };
165
- interface ExecuteCommandProps<T extends string> extends ExecSyncOptionsWithBufferEncoding {
166
- command: T;
162
+ export interface ExecuteCommandProps<T extends string> extends ExecSyncOptionsWithBufferEncoding {
163
+ command: T;
167
164
  }
168
- type ConditionalPromise<T> = T | Promise<T>;
169
- type UnwrapPromise<T> = T extends Promise<infer U> | PromiseLike<infer U> ? U : T;
170
- type Unenumerate<T> = T extends (infer U)[] | readonly (infer U)[] ? U : T;
171
- type Rm<T, P extends keyof T = keyof T> = {
172
- [S in keyof T as Exclude<S, P>]: T[S];
173
- };
165
+ export type ConditionalPromise<T> = T | Promise<T>;
166
+ export type UnwrapPromise<T> = T extends Promise<infer U> | PromiseLike<infer U> ? U : T;
167
+ export type Unenumerate<T> = T extends (infer U)[] | readonly (infer U)[] ? U : T;
168
+ export type Rm<T, P extends keyof T = keyof T> = { [S in keyof T as Exclude<S, P>]: T[S]; };
174
169
  /**
175
170
  * helper workup for use in XOR type below
176
171
  * makes properties from U optional and undefined in T, and vice versa
177
172
  */
178
- type Without<T, U> = {
179
- [P in Exclude<keyof T, keyof U>]?: never;
180
- };
173
+ export type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never; };
181
174
  /**
182
175
  * enforces mutual exclusivity of T | U
183
176
  */
184
- type XOR<T, U> = [
185
- T,
186
- U
187
- ] extends [object, object] ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
177
+ export type XOR<T, U> = [T, U] extends [object, object] ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
188
178
  /**
189
179
  * Conditional to Required
190
180
  */
191
- type CTR<T, K extends keyof OnlyOptional<T> = keyof OnlyOptional<T>> = Rm<T, K> & {
192
- [Q in K]-?: T[Q];
193
- };
181
+ export type CTR<T, K extends keyof OnlyOptional<T> = keyof OnlyOptional<T>> = Rm<T, K> & { [Q in K]-?: T[Q]; };
194
182
  /**
195
183
  * Required to Conditional
196
184
  */
197
- type RTC<T, K extends keyof OnlyRequired<T> = keyof OnlyRequired<T>> = Rm<T, K> & {
198
- [Q in K]?: T[Q];
199
- };
200
- type IsExact<T, U> = [T] extends [U] ? [U] extends [T] ? true : false : false;
185
+ export type RTC<T, K extends keyof OnlyRequired<T> = keyof OnlyRequired<T>> = Rm<T, K> & { [Q in K]?: T[Q]; };
186
+ export type IsExact<T, U> = [T] extends [U] ? [U] extends [T] ? true : false : false;
201
187
  /**
202
188
  * To Conditionally never
203
189
  */
204
- type TCN<T, X extends keyof T = keyof T> = Rm<T, X> & {
205
- [Q in X]?: XOR<T[Q], never>;
206
- };
207
- type ArrFieldReplacer<T extends unknown[] | readonly unknown[], V extends keyof Unenumerate<T>, Q extends boolean = false, P = unknown> = T extends (infer U)[] | readonly (infer U)[] ? V extends keyof U ? Q extends true ? P extends Record<infer Y, infer X> ? (Rm<U, V> & Record<Y, X>)[] : (Rm<U, V> & P)[] : Q extends false ? Rm<U, V>[] : U : T : T;
208
- type IsOptional<T, K extends keyof T> = undefined extends T[K] ? object extends Pick<T, K> ? true : false : false;
209
- type OnlyOptional<T> = {
210
- [K in keyof T as IsOptional<T, K> extends true ? K : never]: T[K];
211
- };
212
- type OnlyRequired<T> = {
213
- [K in keyof T as IsOptional<T, K> extends false ? K : never]: T[K];
214
- };
190
+ export type TCN<T, X extends keyof T = keyof T> = Rm<T, X> & { [Q in X]?: XOR<T[Q], never>; };
191
+ export type ArrFieldReplacer<T extends unknown[] | readonly unknown[], V extends keyof Unenumerate<T>, Q extends boolean = false, P = unknown> = T extends (infer U)[] | readonly (infer U)[] ? V extends keyof U ? Q extends true ? P extends Record<infer Y, infer X> ? (Rm<U, V> & Record<Y, X>)[] : (Rm<U, V> & P)[] : Q extends false ? Rm<U, V>[] : U : T : T;
192
+ export type IsOptional<T, K extends keyof T> = undefined extends T[K] ? object extends Pick<T, K> ? true : false : false;
193
+ export type OnlyOptional<T> = { [K in keyof T as IsOptional<T, K> extends true ? K : never]: T[K]; };
194
+ export type OnlyRequired<T> = { [K in keyof T as IsOptional<T, K> extends false ? K : never]: T[K]; };
215
195
  /**
216
196
  * Expect that the thing passed to Expect<T> is true.
217
197
  *
218
198
  * For instance, `Expect<true>` won't error. But
219
199
  * `Expect<false>` will error.
220
200
  */
221
- type Expect<T extends true> = T;
222
- type RemoveFields<T, P extends keyof T = keyof T> = {
223
- [S in keyof T as Exclude<S, P>]: T[S];
224
- };
201
+ export type Expect<T extends true> = T;
202
+ export type RemoveFields<T, P extends keyof T = keyof T> = { [S in keyof T as Exclude<S, P>]: T[S]; };
225
203
  /**
226
204
  * Checks that X and Y are exactly equal.
227
205
  *
@@ -233,7 +211,7 @@ type RemoveFields<T, P extends keyof T = keyof T> = {
233
211
  * is true. But `Equal<{ a: string; b: string }, { a: string; } & { b: string }>`
234
212
  * is false.
235
213
  */
236
- type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
214
+ export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
237
215
  /**
238
216
  * Checks that Y is assignable to X.
239
217
  *
@@ -243,89 +221,190 @@ type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ?
243
221
  * But `Extends<'a', string>` is false. This is because a string
244
222
  * CANNOT be passed to a function which expects 'a'.
245
223
  */
246
- type Extends<X, Y> = Y extends X ? true : false;
247
- type DX<Y> = {
248
- [P in keyof Y]: Y[P];
249
- };
250
- type DeepPartial<T> = T extends object ? {
251
- [P in keyof T]?: DeepPartial<T[P]>;
252
- } : T;
253
- type DeepPartialFields<T, K extends keyof T> = Omit<T, K> & {
254
- [P in K]?: DeepPartial<T[P]>;
255
- };
256
- type DeepReplace<T, From, To> = T extends From ? To : T extends object ? {
257
- [K in keyof T]: DeepReplace<T[K], From, To>;
258
- } : T;
259
- type RequireNested<T, Path extends string> = Path extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rm<T, K> & Record<K, RequireNested<Required<T>[K], Rest>> : T : Path extends keyof T ? Rm<T, Path> & Record<Path, Required<T>[Path]> : T;
260
- type ConditionalToRequired<T, Z extends keyof T = keyof T> = Rm<T, Z> & {
261
- [Q in Z]-?: T[Q];
262
- };
263
- type RequiredToConditional<T, X extends keyof T = keyof T> = Rm<T, X> & {
264
- [Q in X]?: T[Q];
265
- };
266
- type FieldToConditionallyNever<T, X extends keyof T = keyof T> = Rm<T, X> & {
267
- [Q in X]?: XOR<T[Q], never>;
268
- };
269
- type ExcludeFieldEnumerable<T, K extends keyof T> = Rm<T, K>;
270
- type ArrayOrReadOnlyArray<T> = T[] | readonly T[];
271
- type Depth<Y extends {
272
- [record: string | symbol | number]: unknown;
273
- }, X extends keyof Y = keyof Y> = {
274
- [H in keyof Y[X]]: Y[X][H][keyof Y[X][H]];
275
- };
276
- type InferDepth<T> = T extends Depth<infer U, infer X> ? U[X] : T;
277
- type OmitSrc<T> = T extends `src/${infer U}` ? U : T;
278
- type InjectScriptsProps<T> = {
279
- content: {
280
- scripts: {
281
- [record: string]: string;
282
- };
283
- } & {
284
- [record: string]: string | number | boolean | {
285
- [record: string]: string;
286
- };
224
+ export type Extends<X, Y> = Y extends X ? true : false;
225
+ export type DX<Y> = { [P in keyof Y]: Y[P]; };
226
+ export type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T;
227
+ export type DeepPartialFields<T, K extends keyof T> = Omit<T, K> & { [P in K]?: DeepPartial<T[P]>; };
228
+ export type DeepReplace<T, From, To> = T extends From ? To : T extends object ? { [K in keyof T]: DeepReplace<T[K], From, To>; } : T;
229
+ export type RequireNested<T, Path extends string> = Path extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rm<T, K> & Record<K, RequireNested<Required<T>[K], Rest>> : T : Path extends keyof T ? Rm<T, Path> & Record<Path, Required<T>[Path]> : T;
230
+ export type ConditionalToRequired<T, Z extends keyof T = keyof T> = Rm<T, Z> & { [Q in Z]-?: T[Q]; };
231
+ export type RequiredToConditional<T, X extends keyof T = keyof T> = Rm<T, X> & { [Q in X]?: T[Q]; };
232
+ export type FieldToConditionallyNever<T, X extends keyof T = keyof T> = Rm<T, X> & { [Q in X]?: XOR<T[Q], never>; };
233
+ export type ExcludeFieldEnumerable<T, K extends keyof T> = Rm<T, K>;
234
+ export type ArrayOrReadOnlyArray<T> = T[] | readonly T[];
235
+ export type Depth<Y extends {
236
+ [record: string | symbol | number]: unknown;
237
+ }, X extends keyof Y = keyof Y> = { [H in keyof Y[X]]: Y[X][H][keyof Y[X][H]]; };
238
+ export type InferDepth<T> = T extends Depth<infer U, infer X> ? U[X] : T;
239
+ export type OmitSrc<T> = T extends `src/${infer U}` ? U : T;
240
+ export type InjectScriptsProps<T> = {
241
+ content: {
242
+ scripts: {
243
+ [record: string]: string;
244
+ };
245
+ } & {
246
+ [record: string]: string | number | boolean | {
247
+ [record: string]: string;
287
248
  };
288
- tuplesToInject: T;
249
+ };
250
+ tuplesToInject: T;
289
251
  };
290
- type ParsedUrlInfo = {
291
- href: string;
292
- protocol: string;
293
- baseUrl: string;
294
- host: string;
295
- pathname: string;
296
- search: string;
297
- hash: string;
252
+ export type ParsedUrlInfo = {
253
+ href: string;
254
+ protocol: string;
255
+ baseUrl: string;
256
+ host: string;
257
+ pathname: string;
258
+ search: string;
259
+ hash: string;
298
260
  };
299
- declare const unitsObj: {
300
- readonly PB: 5;
301
- readonly TB: 4;
302
- readonly GB: 3;
303
- readonly MB: 2;
304
- readonly KB: 1;
305
- readonly B: 0;
261
+ export declare const unitsObj: {
262
+ readonly PB: 5;
263
+ readonly TB: 4;
264
+ readonly GB: 3;
265
+ readonly MB: 2;
266
+ readonly KB: 1;
267
+ readonly B: 0;
306
268
  };
307
- type Unit = keyof typeof unitsObj;
308
- type SizeOpts = {
309
- decimals?: number;
310
- includeUnits?: boolean;
269
+ export type Unit = keyof typeof unitsObj;
270
+ export type SizeOpts = {
271
+ decimals?: number;
272
+ includeUnits?: boolean;
311
273
  };
312
- interface ImageSpecs {
313
- width: number;
314
- height: number;
315
- format: "apng" | "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "svg" | "ico" | "heic" | "tiff" | "unknown";
316
- frames: number;
317
- animated: boolean;
318
- hasAlpha: boolean | null;
319
- orientation: number | null;
320
- aspectRatio: number;
321
- colorModel: "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck" | "vector" | "lab" | "unknown";
322
- colorSpace: "unknown" | "srgb" | "display_p3" | "adobe_rgb" | "prophoto_rgb" | "rec2020" | "rec709" | "cmyk" | "lab" | "xyz" | "gray";
323
- iccProfile: string | null;
324
- exifDateTimeOriginal: string | null;
274
+ export interface ImageSpecs {
275
+ type: "IMAGE";
276
+ width: number;
277
+ height: number;
278
+ format: "apng" | "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "svg" | "ico" | "heic" | "tiff" | "unknown";
279
+ frames: number;
280
+ animated: boolean;
281
+ hasAlpha: boolean | null;
282
+ orientation: number | null;
283
+ aspectRatio: number;
284
+ colorModel: "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck" | "vector" | "lab" | "unknown";
285
+ colorSpace: "unknown" | "srgb" | "display_p3" | "adobe_rgb" | "prophoto_rgb" | "rec2020" | "rec709" | "cmyk" | "lab" | "xyz" | "gray";
286
+ iccProfile: string | null;
287
+ exifDateTimeOriginal: string | null;
288
+ metadata?: Record<string, string>;
289
+ }
290
+ export interface BoxInfo {
291
+ pos: number;
292
+ size: number;
293
+ }
294
+ export interface PdfDocSpecs {
295
+ pdfVersion: string | null;
296
+ isEncrypted: boolean | null;
297
+ isSearchable: boolean | null;
298
+ isLinearized: boolean | null;
299
+ hasForm: boolean | null;
300
+ hasSignatures: boolean | null;
301
+ hasAttachments: boolean | null;
302
+ hasJavaScript: boolean | null;
303
+ permissions: {
304
+ printing: boolean;
305
+ modifying: boolean;
306
+ copying: boolean;
307
+ annotating: boolean;
308
+ } | null;
309
+ }
310
+ export interface SpreadSheetDocSpecs {
311
+ sheetCount: number | null;
312
+ sheetNames: string[] | null;
313
+ hasFormulas: boolean | null;
314
+ hasMacros: boolean | null;
315
+ hasPivotTables: boolean | null;
316
+ hasCharts: boolean | null;
317
+ activeSheet: number | null;
318
+ }
319
+ export interface PresentationDocSpecs {
320
+ slideCount: number | null;
321
+ hasAnimations: boolean | null;
322
+ hasTransitions: boolean | null;
323
+ hasNotes: boolean | null;
324
+ hasMasterSlides: boolean | null;
325
+ presentationFormat: "standard" | "widescreen" | null;
326
+ }
327
+ export type PdfCommonImagesUnion = "jpeg" | "jpeg2000" | "png-like" | "ccitt-fax" | "jbig2" | "inline";
328
+ export type PdfImageCoverEstUnion = "none" | "moderate" | "minimal" | "heavy";
329
+ export interface PdfImageAnalysisMetadata {
330
+ hasImages: boolean;
331
+ imageCount: number;
332
+ estimatedImageCoverage: PdfImageCoverEstUnion;
333
+ isLikelyScanned: boolean;
334
+ hasVectorGraphics: boolean;
335
+ recommendation: "multimodal" | "text-only";
336
+ imageTypes: PdfCommonImagesUnion[];
337
+ }
338
+ export interface DocSpecs<T = unknown> {
339
+ type: "DOCUMENT";
340
+ format: string | null;
341
+ mimeType: string | null;
342
+ pageCount: number | null;
343
+ wordCount: number | null;
344
+ lineCount: number | null;
345
+ language: string | null;
346
+ encoding: string | null;
347
+ author: string | null;
348
+ subject: string | null;
349
+ keywords: string[] | null;
350
+ pdfVersion: string | null;
351
+ isEncrypted: boolean | null;
352
+ isSearchable: boolean | null;
353
+ isLinearized: boolean | null;
354
+ textPreview: string | null;
355
+ createdDate: string | null;
356
+ modifiedDate: string | null;
357
+ metadata?: T;
358
+ }
359
+ export type ZipEntry = {
360
+ name: string;
361
+ compressedSize: number;
362
+ uncompressedSize: number;
363
+ compressionMethod: number;
364
+ localHeaderOffset: number;
365
+ };
366
+ export interface ExpandedImgSpecs extends ImageSpecs {
367
+ source?: string;
368
+ fetchedBytes?: number;
369
+ byteSize?: number;
370
+ contentType?: string;
371
+ }
372
+ export interface ExpandedDocSpecs<T = unknown> extends DocSpecs<T> {
373
+ source?: string;
374
+ fetchedBytes?: number;
375
+ byteSize?: number;
376
+ contentType?: string;
377
+ }
378
+ export type Constructor<A extends any[] = any[], I = object> = new (...args: A) => I;
379
+ export interface ExtractorOptions {
380
+ img?: ImgMetadataExtractor;
381
+ docs?: DocMetadataExtractor;
325
382
  }
326
- interface BoxInfo {
327
- pos: number;
328
- size: number;
383
+ export interface ExtractorHardenedOptions extends ExtractorOptions {
384
+ headers?: {
385
+ [key: string]: string;
386
+ };
387
+ /** CORS mode for fetch requests (browser environments). Default: 'cors' */
388
+ corsMode?: RequestMode;
389
+ /** Credentials mode for fetch requests. Default: 'same-origin' */
390
+ credentials?: RequestCredentials;
391
+ /** Given a CF URL, return an origin (S3/R2) URL for the same object. */
392
+ originFallback?: (cfUrl: string) => Promise<string> | string;
393
+ /** Invalidate one CF key (path or full URL OK; implementer can map to key). */
394
+ invalidateCloudFrontKey?: (urlOrKey: string) => Promise<void>;
395
+ /** Quarantine duration for suspect URLs (ms). Default: 6h */
396
+ quarantineTtlMs?: number;
397
+ /** Custom UA string for diagnostics */
398
+ userAgent?: string;
399
+ /** Enable verbose debug logging */
400
+ debug?: boolean;
329
401
  }
330
-
331
- export { type Abortable, type ArrFieldReplacer, type ArrayBufferView, type ArrayOrReadOnlyArray, type BashEnv, type BoxInfo, type BufferEncodingUnion, type CTR, type CommonExecOptions, type CommonOptions, type ConditionalPromise, type ConditionalToRequired, type DX, type DeepPartial, type DeepPartialFields, type DeepReplace, type Depth, type Dict, type Equal, type ExcludeFieldEnumerable, type ExecSyncOptions, type ExecSyncOptionsWithBufferEncoding, type ExecSyncOptionsWithStringEncoding, type ExecuteCommandProps, type Expect, type Extends, type FieldToConditionallyNever, type IOType, type ImageSpecs, type InferDepth, type InjectScriptsProps, type IsExact, type IsOptional, type MkDirOptions, type MkDirSyncOptions, type MkDirSyncProps, type Mode, type NoParamCallback, type ObjEncodingOptions, type OmitSrc, type OnlyOptional, type OnlyRequired, type OpenMode, type ParsedUrlInfo, type ProcessEnv, type ProcessEnvOptions, type RTC, type ReadDirOptions, type ReadDirOptionsEntity, type ReadDirProps, type RemoveFields, type RequireNested, type RequiredToConditional, type Rm, type RmOptions, type Signals, type SizeOpts, type StdioOptions, type TCN, type TypedArray, type Unenumerate, type Unit, type UnwrapPromise, type Without, type WriteFileAsyncDataType, type WriteFileAsyncOptions, type WriteFileAsyncProps, type WriteStreamOptions, type WriteStreamProps, type WriteableDataType, type XOR, unitsObj };
402
+ export type CommonDiscriminants = "type" | "kind" | "event" | "tag" | "_tag" | "__typename";
403
+ export type LiteralUnion<TKnown extends string> = TKnown | (string & {});
404
+ export type DiscriminatedUnionToRecord<TUnion extends Record<TKey, string>, TKey extends string = LiteralUnion<CommonDiscriminants>> = TKey extends keyof TUnion ? { [K in TUnion[TKey] & string]: Extract<TUnion, Record<TKey, K>>; } : never;
405
+ export type UnionToRecord<TUnion extends {
406
+ type: string;
407
+ }, TDiscriminant extends string = TUnion["type"]> = { [K in TDiscriminant]: Extract<TUnion, {
408
+ type: K;
409
+ }>; };
410
+ //# sourceMappingURL=index.d.ts.map