@d0paminedriven/fs 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-QBG7TFHM.js → chunk-6FJJLFJL.js} +2 -2
- package/dist/{chunk-3WB2TSBO.js → chunk-GH6MFTV5.js} +2 -2
- package/dist/{chunk-LFHV4PPA.js → chunk-KUGIFRTF.js} +2 -2
- package/dist/{chunk-RJ2YQE3C.js → chunk-MRKO3PAA.js} +1 -1
- package/dist/{chunk-IUGBPDQJ.js → chunk-O2P3L3CJ.js} +1 -1
- package/dist/{chunk-3REIEDSC.js → chunk-SYISQ57E.js} +155 -5
- package/dist/fs/index.d.ts +50 -3
- package/dist/fs/index.js +6 -6
- package/dist/image/index.js +4 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -6
- package/dist/mime/index.d.ts +4 -4
- package/dist/mime/index.js +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +1 -1
- package/dist/types/stream.d.ts +9 -0
- package/dist/types/stream.js +1 -0
- package/dist/url/index.js +2 -2
- package/dist/utils/index.js +1 -1
- package/package.json +7 -3
- package/dist/fs/index.cjs +0 -1818
- package/dist/fs/index.d.cts +0 -464
- package/dist/image/index.cjs +0 -1071
- package/dist/image/index.d.cts +0 -88
- package/dist/index.cjs +0 -1838
- package/dist/index.d.cts +0 -10
- package/dist/mime/index.cjs +0 -509
- package/dist/mime/index.d.cts +0 -502
- package/dist/types/index.cjs +0 -38
- package/dist/types/index.d.cts +0 -333
- package/dist/url/index.cjs +0 -181
- package/dist/url/index.d.cts +0 -33
- package/dist/utils/index.cjs +0 -157
- package/dist/utils/index.d.cts +0 -25
package/dist/types/index.d.cts
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
import * as stream from 'stream';
|
|
2
|
-
import { WithImplicitCoercion } from 'buffer';
|
|
3
|
-
|
|
4
|
-
type BufferEncodingUnion = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex" | "utf-16le";
|
|
5
|
-
interface Dict<T> {
|
|
6
|
-
[key: string]: T | undefined;
|
|
7
|
-
}
|
|
8
|
-
interface ProcessEnv extends Dict<string> {
|
|
9
|
-
readonly VERCEL_ENV: typeof process.env.VERCEL_ENV;
|
|
10
|
-
readonly NODE_ENV: typeof process.env.NODE_ENV;
|
|
11
|
-
/**
|
|
12
|
-
* Can be used to change the default timezone at runtime
|
|
13
|
-
*/
|
|
14
|
-
TZ?: string;
|
|
15
|
-
}
|
|
16
|
-
interface ProcessEnvOptions {
|
|
17
|
-
uid?: number | undefined;
|
|
18
|
-
gid?: number | undefined;
|
|
19
|
-
cwd?: string | URL | undefined;
|
|
20
|
-
env?: ProcessEnv | undefined;
|
|
21
|
-
}
|
|
22
|
-
interface CommonOptions extends ProcessEnvOptions {
|
|
23
|
-
/**
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
windowsHide?: boolean | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* @default 0
|
|
29
|
-
*/
|
|
30
|
-
timeout?: number | undefined;
|
|
31
|
-
}
|
|
32
|
-
type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | BigUint64Array | BigInt64Array | Float32Array | Float64Array;
|
|
33
|
-
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";
|
|
34
|
-
type ArrayBufferView = DataView | TypedArray;
|
|
35
|
-
type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
|
36
|
-
type StdioOptions = IOType | (IOType | "ipc" | stream.Stream | number | null | undefined)[];
|
|
37
|
-
interface CommonExecOptions extends CommonOptions {
|
|
38
|
-
input?: string | ArrayBufferView | undefined;
|
|
39
|
-
/**
|
|
40
|
-
* Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings.
|
|
41
|
-
* If passed as an array, the first element is used for `stdin`, the second for
|
|
42
|
-
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
|
43
|
-
* specify the `stdio` behavior beyond the standard streams.
|
|
44
|
-
*
|
|
45
|
-
* @default 'pipe'
|
|
46
|
-
*/
|
|
47
|
-
stdio?: StdioOptions | undefined;
|
|
48
|
-
killSignal?: Signals | number | undefined;
|
|
49
|
-
maxBuffer?: number | undefined;
|
|
50
|
-
encoding?: BufferEncoding | "buffer" | null | undefined;
|
|
51
|
-
}
|
|
52
|
-
interface ExecSyncOptions extends CommonExecOptions {
|
|
53
|
-
shell?: string | undefined;
|
|
54
|
-
}
|
|
55
|
-
interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
|
56
|
-
encoding: BufferEncoding;
|
|
57
|
-
}
|
|
58
|
-
interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
|
59
|
-
encoding?: "buffer" | null | undefined;
|
|
60
|
-
}
|
|
61
|
-
interface ObjEncodingOptions {
|
|
62
|
-
encoding?: BufferEncodingUnion | null | undefined;
|
|
63
|
-
}
|
|
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
|
-
}
|
|
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 CoercionUnion = string | Uint8Array | readonly number[];
|
|
87
|
-
type WriteStreamDataShape = WithImplicitCoercion<CoercionUnion> | CoercionUnion;
|
|
88
|
-
type WriteStreamProps<T extends string = string> = {
|
|
89
|
-
data: WithImplicitCoercion<CoercionUnion>;
|
|
90
|
-
cwd: string;
|
|
91
|
-
path: T;
|
|
92
|
-
};
|
|
93
|
-
type WriteStreamOptions = BufferEncodingUnion | {
|
|
94
|
-
encoding?: BufferEncodingUnion;
|
|
95
|
-
autoClose?: boolean;
|
|
96
|
-
emitClose?: boolean;
|
|
97
|
-
start?: number;
|
|
98
|
-
highWaterMark?: number;
|
|
99
|
-
flush?: boolean;
|
|
100
|
-
};
|
|
101
|
-
type WriteFileAsyncDataUnion = WithImplicitCoercion<string> | {
|
|
102
|
-
[Symbol.toPrimitive](hint: "string"): string;
|
|
103
|
-
};
|
|
104
|
-
interface ReadDirOptionsEntity extends ObjEncodingOptions {
|
|
105
|
-
withFileTypes?: false | undefined;
|
|
106
|
-
recursive?: boolean | undefined;
|
|
107
|
-
}
|
|
108
|
-
type ReadDirOptions = {
|
|
109
|
-
[P in keyof ReadDirOptionsEntity]: ReadDirOptionsEntity[P];
|
|
110
|
-
};
|
|
111
|
-
type WriteFileAsyncOptions = (ObjEncodingOptions & {
|
|
112
|
-
mode?: Mode | undefined;
|
|
113
|
-
flag?: OpenMode | undefined;
|
|
114
|
-
} & Abortable) | BufferEncodingUnion | null;
|
|
115
|
-
type WriteFileAsyncProps<T extends string = string> = {
|
|
116
|
-
path: T;
|
|
117
|
-
cwd: string;
|
|
118
|
-
data: WriteFileAsyncDataUnion;
|
|
119
|
-
options?: (ObjEncodingOptions & {
|
|
120
|
-
mode?: Mode | undefined;
|
|
121
|
-
flag?: OpenMode | undefined;
|
|
122
|
-
} & Abortable) | BufferEncodingUnion | null;
|
|
123
|
-
};
|
|
124
|
-
type RmDirOptions = {
|
|
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
|
-
* @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning
|
|
136
|
-
* `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file.
|
|
137
|
-
* Use `fs.rm(path, { recursive: true, force: true })` instead.
|
|
138
|
-
*
|
|
139
|
-
* If `true`, perform a recursive directory removal. In
|
|
140
|
-
* recursive mode, operations are retried on failure.
|
|
141
|
-
* @default false
|
|
142
|
-
*/
|
|
143
|
-
recursive?: boolean | undefined;
|
|
144
|
-
/**
|
|
145
|
-
* The amount of time in milliseconds to wait between retries.
|
|
146
|
-
* This option is ignored if the `recursive` option is not `true`.
|
|
147
|
-
* @default 100
|
|
148
|
-
*/
|
|
149
|
-
retryDelay?: number | undefined;
|
|
150
|
-
};
|
|
151
|
-
type RmDirProps = {
|
|
152
|
-
options?: RmDirOptions;
|
|
153
|
-
}["options"];
|
|
154
|
-
type ReadDirProps<T extends string> = {
|
|
155
|
-
path: T;
|
|
156
|
-
options?: ReadDirOptions;
|
|
157
|
-
};
|
|
158
|
-
type MkDirSyncOptions = Mode | (MkDirOptions & {
|
|
159
|
-
recursive?: boolean | undefined;
|
|
160
|
-
}) | null | undefined;
|
|
161
|
-
type MkDirSyncProps<T extends string> = {
|
|
162
|
-
cwd: string;
|
|
163
|
-
path: T;
|
|
164
|
-
options?: Mode | (MkDirOptions & {
|
|
165
|
-
recursive?: boolean | undefined;
|
|
166
|
-
}) | null | undefined;
|
|
167
|
-
};
|
|
168
|
-
interface ExecuteCommandProps<T extends string> extends ExecSyncOptionsWithBufferEncoding {
|
|
169
|
-
command: T;
|
|
170
|
-
}
|
|
171
|
-
type ConditionalPromise<T> = T | Promise<T>;
|
|
172
|
-
type UnwrapPromise<T> = T extends Promise<infer U> | PromiseLike<infer U> ? U : T;
|
|
173
|
-
type Unenumerate<T> = T extends (infer U)[] | readonly (infer U)[] ? U : T;
|
|
174
|
-
type Rm<T, P extends keyof T = keyof T> = {
|
|
175
|
-
[S in keyof T as Exclude<S, P>]: T[S];
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* helper workup for use in XOR type below
|
|
179
|
-
* makes properties from U optional and undefined in T, and vice versa
|
|
180
|
-
*/
|
|
181
|
-
type Without<T, U> = {
|
|
182
|
-
[P in Exclude<keyof T, keyof U>]?: never;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* enforces mutual exclusivity of T | U
|
|
186
|
-
*/
|
|
187
|
-
type XOR<T, U> = [
|
|
188
|
-
T,
|
|
189
|
-
U
|
|
190
|
-
] extends [object, object] ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
|
191
|
-
/**
|
|
192
|
-
* Conditional to Required
|
|
193
|
-
*/
|
|
194
|
-
type CTR<T, K extends keyof OnlyOptional<T> = keyof OnlyOptional<T>> = Rm<T, K> & {
|
|
195
|
-
[Q in K]-?: T[Q];
|
|
196
|
-
};
|
|
197
|
-
/**
|
|
198
|
-
* Required to Conditional
|
|
199
|
-
*/
|
|
200
|
-
type RTC<T, K extends keyof OnlyRequired<T> = keyof OnlyRequired<T>> = Rm<T, K> & {
|
|
201
|
-
[Q in K]?: T[Q];
|
|
202
|
-
};
|
|
203
|
-
type IsExact<T, U> = [T] extends [U] ? [U] extends [T] ? true : false : false;
|
|
204
|
-
/**
|
|
205
|
-
* To Conditionally never
|
|
206
|
-
*/
|
|
207
|
-
type TCN<T, X extends keyof T = keyof T> = Rm<T, X> & {
|
|
208
|
-
[Q in X]?: XOR<T[Q], never>;
|
|
209
|
-
};
|
|
210
|
-
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;
|
|
211
|
-
type IsOptional<T, K extends keyof T> = undefined extends T[K] ? object extends Pick<T, K> ? true : false : false;
|
|
212
|
-
type OnlyOptional<T> = {
|
|
213
|
-
[K in keyof T as IsOptional<T, K> extends true ? K : never]: T[K];
|
|
214
|
-
};
|
|
215
|
-
type OnlyRequired<T> = {
|
|
216
|
-
[K in keyof T as IsOptional<T, K> extends false ? K : never]: T[K];
|
|
217
|
-
};
|
|
218
|
-
/**
|
|
219
|
-
* Expect that the thing passed to Expect<T> is true.
|
|
220
|
-
*
|
|
221
|
-
* For instance, `Expect<true>` won't error. But
|
|
222
|
-
* `Expect<false>` will error.
|
|
223
|
-
*/
|
|
224
|
-
type Expect<T extends true> = T;
|
|
225
|
-
type RemoveFields<T, P extends keyof T = keyof T> = {
|
|
226
|
-
[S in keyof T as Exclude<S, P>]: T[S];
|
|
227
|
-
};
|
|
228
|
-
/**
|
|
229
|
-
* Checks that X and Y are exactly equal.
|
|
230
|
-
*
|
|
231
|
-
* For instance, `Equal<'a', 'a'>` is true. But
|
|
232
|
-
* `Equal<'a', 'b'>` is false.
|
|
233
|
-
*
|
|
234
|
-
* This also checks for exact intersection equality. So
|
|
235
|
-
* `Equal<{ a: string; b: string }, { a: string; b: string }>`
|
|
236
|
-
* is true. But `Equal<{ a: string; b: string }, { a: string; } & { b: string }>`
|
|
237
|
-
* is false.
|
|
238
|
-
*/
|
|
239
|
-
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
240
|
-
/**
|
|
241
|
-
* Checks that Y is assignable to X.
|
|
242
|
-
*
|
|
243
|
-
* For instance, `Extends<string, 'a'>` is true. This is because
|
|
244
|
-
* 'a' can be passed to a function which expects a string.
|
|
245
|
-
*
|
|
246
|
-
* But `Extends<'a', string>` is false. This is because a string
|
|
247
|
-
* CANNOT be passed to a function which expects 'a'.
|
|
248
|
-
*/
|
|
249
|
-
type Extends<X, Y> = Y extends X ? true : false;
|
|
250
|
-
type DX<Y> = {
|
|
251
|
-
[P in keyof Y]: Y[P];
|
|
252
|
-
};
|
|
253
|
-
type DeepPartial<T> = T extends object ? {
|
|
254
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
255
|
-
} : T;
|
|
256
|
-
type DeepPartialFields<T, K extends keyof T> = Omit<T, K> & {
|
|
257
|
-
[P in K]?: DeepPartial<T[P]>;
|
|
258
|
-
};
|
|
259
|
-
type DeepReplace<T, From, To> = T extends From ? To : T extends object ? {
|
|
260
|
-
[K in keyof T]: DeepReplace<T[K], From, To>;
|
|
261
|
-
} : T;
|
|
262
|
-
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;
|
|
263
|
-
type ConditionalToRequired<T, Z extends keyof T = keyof T> = Rm<T, Z> & {
|
|
264
|
-
[Q in Z]-?: T[Q];
|
|
265
|
-
};
|
|
266
|
-
type RequiredToConditional<T, X extends keyof T = keyof T> = Rm<T, X> & {
|
|
267
|
-
[Q in X]?: T[Q];
|
|
268
|
-
};
|
|
269
|
-
type FieldToConditionallyNever<T, X extends keyof T = keyof T> = Rm<T, X> & {
|
|
270
|
-
[Q in X]?: XOR<T[Q], never>;
|
|
271
|
-
};
|
|
272
|
-
type ExcludeFieldEnumerable<T, K extends keyof T> = Rm<T, K>;
|
|
273
|
-
type ArrayOrReadOnlyArray<T> = T[] | readonly T[];
|
|
274
|
-
type Depth<Y extends {
|
|
275
|
-
[record: string | symbol | number]: unknown;
|
|
276
|
-
}, X extends keyof Y = keyof Y> = {
|
|
277
|
-
[H in keyof Y[X]]: Y[X][H][keyof Y[X][H]];
|
|
278
|
-
};
|
|
279
|
-
type InferDepth<T> = T extends Depth<infer U, infer X> ? U[X] : T;
|
|
280
|
-
type OmitSrc<T> = T extends `src/${infer U}` ? U : T;
|
|
281
|
-
type InjectScriptsProps<T> = {
|
|
282
|
-
content: {
|
|
283
|
-
scripts: {
|
|
284
|
-
[record: string]: string;
|
|
285
|
-
};
|
|
286
|
-
} & {
|
|
287
|
-
[record: string]: string | number | boolean | {
|
|
288
|
-
[record: string]: string;
|
|
289
|
-
};
|
|
290
|
-
};
|
|
291
|
-
tuplesToInject: T;
|
|
292
|
-
};
|
|
293
|
-
type ParsedUrlInfo = {
|
|
294
|
-
href: string;
|
|
295
|
-
protocol: string;
|
|
296
|
-
baseUrl: string;
|
|
297
|
-
host: string;
|
|
298
|
-
pathname: string;
|
|
299
|
-
search: string;
|
|
300
|
-
hash: string;
|
|
301
|
-
};
|
|
302
|
-
declare const unitsObj: {
|
|
303
|
-
readonly PB: 5;
|
|
304
|
-
readonly TB: 4;
|
|
305
|
-
readonly GB: 3;
|
|
306
|
-
readonly MB: 2;
|
|
307
|
-
readonly KB: 1;
|
|
308
|
-
readonly B: 0;
|
|
309
|
-
};
|
|
310
|
-
type Unit = keyof typeof unitsObj;
|
|
311
|
-
type SizeOpts = {
|
|
312
|
-
decimals?: number;
|
|
313
|
-
includeUnits?: boolean;
|
|
314
|
-
};
|
|
315
|
-
interface ImageSpecs {
|
|
316
|
-
width: number;
|
|
317
|
-
height: number;
|
|
318
|
-
format: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "unknown";
|
|
319
|
-
frames: number;
|
|
320
|
-
animated: boolean;
|
|
321
|
-
hasAlpha: boolean | null;
|
|
322
|
-
orientation: number | null;
|
|
323
|
-
aspectRatio: number;
|
|
324
|
-
colorSpace: "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck" | "unknown";
|
|
325
|
-
iccProfile: string | null;
|
|
326
|
-
exifDateTimeOriginal: string | null;
|
|
327
|
-
}
|
|
328
|
-
interface BoxInfo {
|
|
329
|
-
pos: number;
|
|
330
|
-
size: number;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
export { type Abortable, type ArrFieldReplacer, type ArrayBufferView, type ArrayOrReadOnlyArray, type BashEnv, type BoxInfo, type BufferEncodingUnion, type CTR, type CoercionUnion, 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 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 RmDirOptions, type RmDirProps, type Signals, type SizeOpts, type StdioOptions, type TCN, type TypedArray, type Unenumerate, type Unit, type UnwrapPromise, type Without, type WriteFileAsyncDataUnion, type WriteFileAsyncOptions, type WriteFileAsyncProps, type WriteStreamDataShape, type WriteStreamOptions, type WriteStreamProps, type XOR, unitsObj };
|
package/dist/url/index.cjs
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/url/index.ts
|
|
22
|
-
var url_exports = {};
|
|
23
|
-
__export(url_exports, {
|
|
24
|
-
UrlService: () => UrlService
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(url_exports);
|
|
27
|
-
|
|
28
|
-
// src/utils/index.ts
|
|
29
|
-
var UtilsService = class {
|
|
30
|
-
static {
|
|
31
|
-
__name(this, "UtilsService");
|
|
32
|
-
}
|
|
33
|
-
chunkArray(arr, maxChunkLength) {
|
|
34
|
-
const chunks = Array.of();
|
|
35
|
-
let currentChunkLength = 0;
|
|
36
|
-
let currentChunk = Array.of();
|
|
37
|
-
for (const [index, val] of arr.entries()) {
|
|
38
|
-
if (val.length + currentChunkLength >= maxChunkLength) {
|
|
39
|
-
if (currentChunk.length) {
|
|
40
|
-
chunks.push(currentChunk);
|
|
41
|
-
}
|
|
42
|
-
currentChunkLength = val.length;
|
|
43
|
-
currentChunk = [val];
|
|
44
|
-
} else {
|
|
45
|
-
currentChunk.push(val);
|
|
46
|
-
currentChunkLength += val.length + 1;
|
|
47
|
-
}
|
|
48
|
-
if (arr.length === index + 1) {
|
|
49
|
-
chunks.push(currentChunk);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return chunks.length ? chunks : [arr];
|
|
53
|
-
}
|
|
54
|
-
b64ToBlob(b64Data) {
|
|
55
|
-
{
|
|
56
|
-
const sliceSize = 512;
|
|
57
|
-
const typeMatch = /^data:((?:image|application|haptics|video|text|font|model|audio|multipart)\/[A-Za-z0-9+-.]+(?:;[^,]+)*);base64,(.+)$/i.exec(
|
|
58
|
-
b64Data
|
|
59
|
-
);
|
|
60
|
-
if (!typeMatch) {
|
|
61
|
-
throw new Error(`${b64Data} is not a valid data Url`);
|
|
62
|
-
}
|
|
63
|
-
const type = typeMatch[1];
|
|
64
|
-
const base64Data = typeMatch?.[2] ?? "";
|
|
65
|
-
const byteCharacters = Buffer.from(base64Data, "base64").toString(
|
|
66
|
-
"binary"
|
|
67
|
-
);
|
|
68
|
-
const byteArrays = Array.of();
|
|
69
|
-
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
|
70
|
-
const slice = byteCharacters.slice(offset, offset + sliceSize);
|
|
71
|
-
const byteNumbers = new Array(slice.length);
|
|
72
|
-
for (let i = 0; i < slice.length; i++) {
|
|
73
|
-
byteNumbers[i] = slice.charCodeAt(i);
|
|
74
|
-
}
|
|
75
|
-
const byteArray = new Uint8Array(byteNumbers);
|
|
76
|
-
byteArrays.push(byteArray);
|
|
77
|
-
}
|
|
78
|
-
const blob = new Blob(byteArrays, { type });
|
|
79
|
-
return blob;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
arrToArrOfArrs = /* @__PURE__ */ __name(({
|
|
83
|
-
arrToFragment = Array.of(),
|
|
84
|
-
arrOfArrsAggregator = Array.of(),
|
|
85
|
-
interval
|
|
86
|
-
}) => new Promise(
|
|
87
|
-
(resolve, _reject) => resolve(
|
|
88
|
-
((interval2) => {
|
|
89
|
-
for (let i = 0; i <= arrToFragment.length; i++) {
|
|
90
|
-
if ((i % interval2 === 0 || i === 0) && i <= arrToFragment.length) {
|
|
91
|
-
let segment = arrToFragment.slice(i, i + interval2);
|
|
92
|
-
arrOfArrsAggregator.push(segment);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
})(interval)
|
|
96
|
-
)
|
|
97
|
-
).then((_) => arrOfArrsAggregator), "arrToArrOfArrs");
|
|
98
|
-
extractTuple(obj, props) {
|
|
99
|
-
return [props, obj[props]];
|
|
100
|
-
}
|
|
101
|
-
sort(obj, order) {
|
|
102
|
-
return Object.fromEntries(
|
|
103
|
-
Object.entries(obj).sort(
|
|
104
|
-
([a, _aa], [b, _bb]) => order === "DESC" ? b.localeCompare(a) - a.localeCompare(b) : a.localeCompare(b) - b.localeCompare(a)
|
|
105
|
-
)
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
excludeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
|
|
109
|
-
const resolve = Object.fromEntries(
|
|
110
|
-
Object.entries(obj).map(([key, val]) => {
|
|
111
|
-
if (props.includes(key)) {
|
|
112
|
-
return ["omit", "omit"];
|
|
113
|
-
} else return [key, val];
|
|
114
|
-
}).filter(([t, _v]) => /omit/.test(t) === false)
|
|
115
|
-
);
|
|
116
|
-
return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
|
|
117
|
-
}, "excludeTargeted");
|
|
118
|
-
includeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
|
|
119
|
-
const resolve = Object.fromEntries(
|
|
120
|
-
props.map((val) => this.extractTuple(obj, val))
|
|
121
|
-
);
|
|
122
|
-
return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
|
|
123
|
-
}, "includeTargeted");
|
|
124
|
-
countsSorter = /* @__PURE__ */ __name((counter, keySort = "ASC", valSort = "DESC") => Object.fromEntries(
|
|
125
|
-
Array.from(Object.entries(counter)).sort(
|
|
126
|
-
([aStr, _aNum], [bStr, _bNum]) => keySort === "DESC" ? bStr.localeCompare(aStr) - aStr.localeCompare(bStr) : aStr.localeCompare(bStr) - bStr.localeCompare(aStr)
|
|
127
|
-
).sort(([aStr, aNum], [bStr, bNum]) => {
|
|
128
|
-
if (typeof (aNum && bNum) === "number") {
|
|
129
|
-
return valSort === "ASC" ? aNum - bNum : bNum - aNum;
|
|
130
|
-
} else if (typeof (aNum && bNum) === "string") {
|
|
131
|
-
return valSort === "ASC" ? aStr.localeCompare(bStr) - bStr.localeCompare(aStr) : bStr.localeCompare(aStr) - aStr.localeCompare(bStr);
|
|
132
|
-
} else
|
|
133
|
-
throw new Error(
|
|
134
|
-
"only Record<string, string> and Record<string,number> types supported"
|
|
135
|
-
);
|
|
136
|
-
})
|
|
137
|
-
), "countsSorter");
|
|
138
|
-
range(from, to) {
|
|
139
|
-
const values = Array.of();
|
|
140
|
-
for (let i = from; i < to; i++) {
|
|
141
|
-
values.push(i);
|
|
142
|
-
}
|
|
143
|
-
return values;
|
|
144
|
-
}
|
|
145
|
-
isPrimeNumber = /* @__PURE__ */ __name((n) => {
|
|
146
|
-
for (let i = 2; n > i; i++) {
|
|
147
|
-
if (n % i === 0) {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return n > 1;
|
|
152
|
-
}, "isPrimeNumber");
|
|
153
|
-
acceptor = /* @__PURE__ */ __name((num) => [...Array(num !== 0 ? num : this.range(num = -101, num = 101)).keys()].reverse().filter(this.isPrimeNumber), "acceptor");
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
// src/url/index.ts
|
|
157
|
-
var UrlService = class extends UtilsService {
|
|
158
|
-
static {
|
|
159
|
-
__name(this, "UrlService");
|
|
160
|
-
}
|
|
161
|
-
URL_REGEX = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
|
|
162
|
-
parseUrl(url) {
|
|
163
|
-
const parsed = this.URL_REGEX.exec(url);
|
|
164
|
-
if (parsed) {
|
|
165
|
-
return {
|
|
166
|
-
href: parsed[0],
|
|
167
|
-
protocol: parsed[1] ?? "",
|
|
168
|
-
baseUrl: `${parsed[1]}${parsed[3]}`,
|
|
169
|
-
host: parsed[4] ?? "",
|
|
170
|
-
pathname: parsed[5] ?? "",
|
|
171
|
-
search: parsed[6] ?? "",
|
|
172
|
-
hash: parsed[8] ?? ""
|
|
173
|
-
};
|
|
174
|
-
} else return null;
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
178
|
-
0 && (module.exports = {
|
|
179
|
-
UrlService
|
|
180
|
-
});
|
|
181
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/url/index.d.cts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { UtilsService } from '../utils/index.cjs';
|
|
2
|
-
import '../types/index.cjs';
|
|
3
|
-
import 'stream';
|
|
4
|
-
import 'buffer';
|
|
5
|
-
|
|
6
|
-
type HandleQueryParamsOrHash<T> = T extends `${infer X}?${string}` ? X : T extends `${infer X}#${string}` ? X : T;
|
|
7
|
-
type SplitForwardSlash<S extends string> = S extends `${infer First}/${infer Rest}` ? [First, ...SplitForwardSlash<Rest>] : S extends "" ? [] : [S];
|
|
8
|
-
type LastSegment<T extends unknown[]> = T extends [...infer _, infer L] ? L : never;
|
|
9
|
-
type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXTENSION";
|
|
10
|
-
/**
|
|
11
|
-
* usage
|
|
12
|
-
*
|
|
13
|
-
* ```ts
|
|
14
|
-
* type FileExtExample = UrlFileExt<"https://raw.githubusercontent.com/mrdoob/three.js/refs/heads/dev/examples/models/gltf/collision-world.glb"> // "glb"
|
|
15
|
-
* type NoFileExtExample = UrlFileExt<"https://raw.githubusercontent.com/mrdoob/three.js/refs/heads/dev/examples/models/gltf/collision-world"> // "NO_EXTENSION"
|
|
16
|
-
*
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
type UrlFileExt<S extends string> = InferExtensionIfPresent<LastSegment<SplitForwardSlash<HandleQueryParamsOrHash<S>>>>;
|
|
20
|
-
declare class UrlService extends UtilsService {
|
|
21
|
-
private URL_REGEX;
|
|
22
|
-
parseUrl(url: string): {
|
|
23
|
-
href: string;
|
|
24
|
-
protocol: string;
|
|
25
|
-
baseUrl: string;
|
|
26
|
-
host: string;
|
|
27
|
-
pathname: string;
|
|
28
|
-
search: string;
|
|
29
|
-
hash: string;
|
|
30
|
-
} | null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { type HandleQueryParamsOrHash, type InferExtensionIfPresent, type LastSegment, type SplitForwardSlash, type UrlFileExt, UrlService };
|