@d0paminedriven/fs 6.1.0 → 6.5.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.
@@ -170,43 +170,50 @@ interface ExecuteCommandProps<T extends string> extends ExecSyncOptionsWithBuffe
170
170
  }
171
171
  type ConditionalPromise<T> = T | Promise<T>;
172
172
  type UnwrapPromise<T> = T extends Promise<infer U> | PromiseLike<infer U> ? U : T;
173
- type RemoveFields<T, P extends keyof T = keyof T> = {
173
+ type Unenumerate<T> = T extends (infer U)[] | readonly (infer U)[] ? U : T;
174
+ type Rm<T, P extends keyof T = keyof T> = {
174
175
  [S in keyof T as Exclude<S, P>]: T[S];
175
176
  };
176
- type ConditionalToRequired<T, Z extends keyof T = keyof T> = RemoveFields<T, Z> & {
177
- [Q in Z]-?: T[Q];
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;
178
183
  };
179
- type RequiredToConditional<T, X extends keyof T = keyof T> = RemoveFields<T, X> & {
180
- [Q in X]?: T[Q];
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];
181
196
  };
182
- type FieldToConditionallyNever<T, X extends keyof T = keyof T> = RemoveFields<T, X> & {
183
- [Q in X]?: XOR<T[Q], never>;
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];
184
202
  };
185
- type ExcludeFieldEnumerable<T, K extends keyof T> = RemoveFields<T, K>;
186
- type ArrayOrReadOnlyArray<T> = T[] | readonly T[];
187
- type Unenumerate<T> = T extends readonly (infer U)[] | (infer U)[] ? U : T;
188
- type Without<T, U> = {
189
- [P in Exclude<keyof T, keyof U>]?: never;
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>;
190
209
  };
191
- type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
192
- type Depth<Y extends {
193
- [record: string | symbol | number]: unknown;
194
- }, X extends keyof Y = keyof Y> = {
195
- [H in keyof Y[X]]: Y[X][H][keyof Y[X][H]];
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];
196
214
  };
197
- type InferDepth<T> = T extends Depth<infer U, infer X> ? U[X] : T;
198
- type OmitSrc<T> = T extends `src/${infer U}` ? U : T;
199
- type InjectScriptsProps<T> = {
200
- content: {
201
- scripts: {
202
- [record: string]: string;
203
- };
204
- } & {
205
- [record: string]: string | number | boolean | {
206
- [record: string]: string;
207
- };
208
- };
209
- tuplesToInject: T;
215
+ type OnlyRequired<T> = {
216
+ [K in keyof T as IsOptional<T, K> extends false ? K : never]: T[K];
210
217
  };
211
218
  /**
212
219
  * Expect that the thing passed to Expect<T> is true.
@@ -215,6 +222,9 @@ type InjectScriptsProps<T> = {
215
222
  * `Expect<false>` will error.
216
223
  */
217
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
+ };
218
228
  /**
219
229
  * Checks that X and Y are exactly equal.
220
230
  *
@@ -237,6 +247,49 @@ type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ?
237
247
  * CANNOT be passed to a function which expects 'a'.
238
248
  */
239
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
+ };
240
293
  type ParsedUrlInfo = {
241
294
  href: string;
242
295
  protocol: string;
@@ -259,5 +312,14 @@ type SizeOpts = {
259
312
  decimals?: number;
260
313
  includeUnits?: boolean;
261
314
  };
315
+ interface ImageSize {
316
+ width: number;
317
+ height: number;
318
+ type: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "unknown";
319
+ }
320
+ interface BoxInfo {
321
+ pos: number;
322
+ size: number;
323
+ }
262
324
 
263
- export { type Abortable, type ArrayBufferView, type ArrayOrReadOnlyArray, type BashEnv, type BufferEncodingUnion, type CoercionUnion, type CommonExecOptions, type CommonOptions, type ConditionalPromise, type ConditionalToRequired, 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 InferDepth, type InjectScriptsProps, type MkDirOptions, type MkDirSyncOptions, type MkDirSyncProps, type Mode, type ObjEncodingOptions, type OmitSrc, type OpenMode, type ParsedUrlInfo, type ProcessEnv, type ProcessEnvOptions, type ReadDirOptions, type ReadDirOptionsEntity, type ReadDirProps, type RemoveFields, type RequiredToConditional, type RmDirOptions, type RmDirProps, type Signals, type SizeOpts, type StdioOptions, 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 };
325
+ 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 ImageSize, 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 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unitsObj
3
- } from "../chunk-4X5DVWVM.js";
3
+ } from "../chunk-MXEE2WS7.js";
4
4
  import "../chunk-7QVYU63E.js";
5
5
  export {
6
6
  unitsObj
@@ -24,7 +24,137 @@ __export(url_exports, {
24
24
  UrlService: () => UrlService
25
25
  });
26
26
  module.exports = __toCommonJS(url_exports);
27
- var UrlService = class {
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 {
28
158
  static {
29
159
  __name(this, "UrlService");
30
160
  }
@@ -1,3 +1,8 @@
1
+ import { UtilsService } from '../utils/index.cjs';
2
+ import '../types/index.cjs';
3
+ import 'stream';
4
+ import 'buffer';
5
+
1
6
  type HandleQueryParamsOrHash<T> = T extends `${infer X}?${string}` ? X : T extends `${infer X}#${string}` ? X : T;
2
7
  type SplitForwardSlash<S extends string> = S extends `${infer First}/${infer Rest}` ? [First, ...SplitForwardSlash<Rest>] : S extends "" ? [] : [S];
3
8
  type LastSegment<T extends unknown[]> = T extends [...infer _, infer L] ? L : never;
@@ -12,7 +17,7 @@ type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXT
12
17
  * ```
13
18
  */
14
19
  type UrlFileExt<S extends string> = InferExtensionIfPresent<LastSegment<SplitForwardSlash<HandleQueryParamsOrHash<S>>>>;
15
- declare class UrlService {
20
+ declare class UrlService extends UtilsService {
16
21
  private URL_REGEX;
17
22
  parseUrl(url: string): {
18
23
  href: string;
@@ -1,3 +1,8 @@
1
+ import { UtilsService } from '../utils/index.js';
2
+ import '../types/index.js';
3
+ import 'stream';
4
+ import 'buffer';
5
+
1
6
  type HandleQueryParamsOrHash<T> = T extends `${infer X}?${string}` ? X : T extends `${infer X}#${string}` ? X : T;
2
7
  type SplitForwardSlash<S extends string> = S extends `${infer First}/${infer Rest}` ? [First, ...SplitForwardSlash<Rest>] : S extends "" ? [] : [S];
3
8
  type LastSegment<T extends unknown[]> = T extends [...infer _, infer L] ? L : never;
@@ -12,7 +17,7 @@ type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXT
12
17
  * ```
13
18
  */
14
19
  type UrlFileExt<S extends string> = InferExtensionIfPresent<LastSegment<SplitForwardSlash<HandleQueryParamsOrHash<S>>>>;
15
- declare class UrlService {
20
+ declare class UrlService extends UtilsService {
16
21
  private URL_REGEX;
17
22
  parseUrl(url: string): {
18
23
  href: string;
package/dist/url/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  UrlService
3
- } from "../chunk-XHN56MDK.js";
3
+ } from "../chunk-QBG7TFHM.js";
4
+ import "../chunk-IUGBPDQJ.js";
4
5
  import "../chunk-7QVYU63E.js";
5
6
  export {
6
7
  UrlService
@@ -52,19 +52,21 @@ var UtilsService = class {
52
52
  b64ToBlob(b64Data) {
53
53
  {
54
54
  const sliceSize = 512;
55
- const typeMatch = b64Data.match(
56
- /^data:(?:image|application|haptics|video|text|font|model|audio|multipart)\/[A-Za-z0-9+-.]+(?:;[^,]+)*;base64,/i
55
+ const typeMatch = /^data:((?:image|application|haptics|video|text|font|model|audio|multipart)\/[A-Za-z0-9+-.]+(?:;[^,]+)*);base64,(.+)$/i.exec(
56
+ b64Data
57
57
  );
58
- const type = typeMatch?.[1];
59
58
  if (!typeMatch) {
60
59
  throw new Error(`${b64Data} is not a valid data Url`);
61
60
  }
62
- const byteCharacters = Buffer.from(b64Data, "base64").toString("utf-8");
61
+ const type = typeMatch[1];
62
+ const base64Data = typeMatch?.[2] ?? "";
63
+ const byteCharacters = Buffer.from(base64Data, "base64").toString(
64
+ "binary"
65
+ );
63
66
  const byteArrays = Array.of();
64
67
  for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
65
68
  const slice = byteCharacters.slice(offset, offset + sliceSize);
66
- const byteNumbers = Array.of();
67
- byteNumbers.push(slice.length);
69
+ const byteNumbers = new Array(slice.length);
68
70
  for (let i = 0; i < slice.length; i++) {
69
71
  byteNumbers[i] = slice.charCodeAt(i);
70
72
  }
@@ -117,16 +119,19 @@ var UtilsService = class {
117
119
  );
118
120
  return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
119
121
  }, "includeTargeted");
120
- countsSorter = /* @__PURE__ */ __name(({
121
- counter,
122
- keySort,
123
- valSort
124
- }) => Object.fromEntries(
125
- Object.entries(counter).sort(
122
+ countsSorter = /* @__PURE__ */ __name((counter, keySort = "ASC", valSort = "DESC") => Object.fromEntries(
123
+ Array.from(Object.entries(counter)).sort(
126
124
  ([aStr, _aNum], [bStr, _bNum]) => keySort === "DESC" ? bStr.localeCompare(aStr) - aStr.localeCompare(bStr) : aStr.localeCompare(bStr) - bStr.localeCompare(aStr)
127
- ).sort(
128
- ([_aStr, aNum], [_bStr, bNum]) => valSort === "ASC" ? aNum - bNum : bNum - aNum
129
- )
125
+ ).sort(([aStr, aNum], [bStr, bNum]) => {
126
+ if (typeof (aNum && bNum) === "number") {
127
+ return valSort === "ASC" ? aNum - bNum : bNum - aNum;
128
+ } else if (typeof (aNum && bNum) === "string") {
129
+ return valSort === "ASC" ? aStr.localeCompare(bStr) - bStr.localeCompare(aStr) : bStr.localeCompare(aStr) - aStr.localeCompare(bStr);
130
+ } else
131
+ throw new Error(
132
+ "only Record<string, string> and Record<string,number> types supported"
133
+ );
134
+ })
130
135
  ), "countsSorter");
131
136
  range(from, to) {
132
137
  const values = Array.of();
@@ -14,12 +14,8 @@ declare class UtilsService {
14
14
  sort<const S extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const K extends "ASC" | "DESC" | undefined>(obj: S, order?: K): S;
15
15
  excludeTargeted: <const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T, const S extends Parameters<typeof this.sort>["1"]>(obj: T, props: V[], sort?: S) => RemoveFields<T, Unenumerate<typeof props>>;
16
16
  includeTargeted: <const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T, const S extends Parameters<typeof this.sort>["1"]>(obj: T, props: V[], sort?: S) => Pick<T, Unenumerate<typeof props>>;
17
- countsSorter: <T extends Record<string, number> | Readonly<Record<string, number>>, K extends "ASC" | "DESC" | undefined, V extends "ASC" | "DESC" | undefined>({ counter, keySort, valSort }: {
18
- counter: T;
19
- keySort?: K;
20
- valSort?: V;
21
- }) => {
22
- [k: string]: number;
17
+ countsSorter: <const T extends object>(counter: T, keySort?: "ASC" | "DESC", valSort?: "DESC" | "ASC") => {
18
+ [k: string]: any;
23
19
  };
24
20
  range(from: number, to: number): number[];
25
21
  isPrimeNumber: <const T extends number>(n: T) => boolean;
@@ -14,12 +14,8 @@ declare class UtilsService {
14
14
  sort<const S extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const K extends "ASC" | "DESC" | undefined>(obj: S, order?: K): S;
15
15
  excludeTargeted: <const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T, const S extends Parameters<typeof this.sort>["1"]>(obj: T, props: V[], sort?: S) => RemoveFields<T, Unenumerate<typeof props>>;
16
16
  includeTargeted: <const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T, const S extends Parameters<typeof this.sort>["1"]>(obj: T, props: V[], sort?: S) => Pick<T, Unenumerate<typeof props>>;
17
- countsSorter: <T extends Record<string, number> | Readonly<Record<string, number>>, K extends "ASC" | "DESC" | undefined, V extends "ASC" | "DESC" | undefined>({ counter, keySort, valSort }: {
18
- counter: T;
19
- keySort?: K;
20
- valSort?: V;
21
- }) => {
22
- [k: string]: number;
17
+ countsSorter: <const T extends object>(counter: T, keySort?: "ASC" | "DESC", valSort?: "DESC" | "ASC") => {
18
+ [k: string]: any;
23
19
  };
24
20
  range(from: number, to: number): number[];
25
21
  isPrimeNumber: <const T extends number>(n: T) => boolean;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  UtilsService
3
- } from "../chunk-QMN5ZCE4.js";
3
+ } from "../chunk-IUGBPDQJ.js";
4
4
  import "../chunk-7QVYU63E.js";
5
5
  export {
6
6
  UtilsService
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d0paminedriven/fs",
3
- "version": "6.1.0",
3
+ "version": "6.5.0",
4
4
  "description": "convenient fs helpers",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -47,25 +47,25 @@
47
47
  "./utils": "./dist/utils/index.js"
48
48
  },
49
49
  "dependencies": {
50
- "dotenv": "^16.5.0",
50
+ "dotenv": "^17.2.1",
51
51
  "dotenv-expand": "^12.0.2",
52
- "sharp": "^0.34.2"
52
+ "sharp": "^0.34.3"
53
53
  },
54
54
  "devDependencies": {
55
- "@types/node": "^24.0.0",
55
+ "@types/node": "^24.3.0",
56
56
  "chokidar": "^4.0.3",
57
- "dotenv-cli": "^8.0.0",
58
- "eslint": "^9.28.0",
59
- "jiti": "^2.4.2",
60
- "prettier": "^3.5.3",
61
- "terser": "^5.42.0",
57
+ "dotenv-cli": "^10.0.0",
58
+ "eslint": "^9.33.0",
59
+ "jiti": "^2.5.1",
60
+ "prettier": "^3.6.2",
61
+ "terser": "^5.43.1",
62
62
  "tslib": "^2.8.1",
63
63
  "tsup": "^8.5.0",
64
- "tsx": "^4.19.4",
65
- "typescript": "^5.8.3",
66
- "typescript-eslint": "^8.34.0",
67
- "@d0paminedriven/tsconfig": "0.1.0",
64
+ "tsx": "^4.20.4",
65
+ "typescript": "^5.9.2",
66
+ "typescript-eslint": "^8.40.0",
68
67
  "@d0paminedriven/prettier-config": "0.1.0",
68
+ "@d0paminedriven/tsconfig": "0.1.0",
69
69
  "@d0paminedriven/eslint-config": "0.1.0"
70
70
  },
71
71
  "prettier": "@d0paminedriven/prettier-config",
@@ -1,161 +0,0 @@
1
- import {
2
- UrlService
3
- } from "./chunk-XHN56MDK.js";
4
- import {
5
- __name
6
- } from "./chunk-7QVYU63E.js";
7
-
8
- // src/mime/index.ts
9
- var extMimeMap = {
10
- aac: ["audio/aac"],
11
- abw: ["application/x-abiword"],
12
- aces: ["image/aces"],
13
- apng: ["image/apng"],
14
- arc: ["application/x-freearc"],
15
- avci: ["image/avci"],
16
- avif: ["image/avif"],
17
- avi: ["video/x-msvideo"],
18
- azw: ["application/vnd.amazon.ebook"],
19
- bin: ["application/octet-stream"],
20
- bmp: ["image/bmp"],
21
- bz: ["application/x-bzip"],
22
- bz2: ["application/x-bzip2"],
23
- cda: ["application/x-cdf"],
24
- cjs: ["application/node", "text/javascript"],
25
- csh: ["application/x-csh"],
26
- css: ["text/css"],
27
- csv: ["text/csv"],
28
- doc: ["application/msword"],
29
- docx: [
30
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
31
- ],
32
- dpx: ["image/dpx"],
33
- emf: ["image/emf"],
34
- eot: ["application/vnd.ms-fontobject"],
35
- epub: ["application/epub+zip"],
36
- gif: ["image/gif"],
37
- glb: ["model/gltf-binary"],
38
- gltf: ["model/gltf+json"],
39
- gz: ["application/x-gzip", "application/gzip"],
40
- hjif: ["haptics/hjif"],
41
- hmpg: ["haptics/hmpg"],
42
- htm: ["text/html"],
43
- html: ["text/html"],
44
- ico: ["image/vnd.microsoft.icon"],
45
- ics: ["text/calendar"],
46
- ivs: ["haptics/ivs"],
47
- jar: ["application/java-archive"],
48
- jpeg: ["image/jpeg"],
49
- jpg: ["image/jpeg"],
50
- js: ["application/node", "text/javascript"],
51
- json: ["application/json"],
52
- jsonld: ["application/ld+json"],
53
- ktx: ["image/ktx"],
54
- ktx2: ["image/ktx2"],
55
- m3u8: ["application/vnd.apple.mpegurl"],
56
- m4a: ["audio/mp4"],
57
- m4v: ["video/mp4"],
58
- md: ["text/markdown"],
59
- mdx: ["application/x-mdx"],
60
- mid: ["audio/midi"],
61
- midi: ["audio/x-midi"],
62
- mjs: ["text/javascript"],
63
- mp3: ["audio/mpeg"],
64
- mp4: ["video/mp4"],
65
- mpeg: ["video/mpeg"],
66
- mpkg: ["application/vnd.apple.installer+xml"],
67
- ndjson: ["application/x-ndjson"],
68
- obj: ["application/octet-stream", "text/plain", "model/obj"],
69
- odp: ["application/vnd.oasis.opendocument.presentation"],
70
- ods: ["application/vnd.oasis.opendocument.spreadsheet"],
71
- odt: ["application/vnd.oasis.opendocument.text"],
72
- oga: ["audio/ogg"],
73
- ogg: ["audio/ogg"],
74
- ogv: ["video/ogg"],
75
- ogx: ["application/ogg"],
76
- opus: ["audio/ogg"],
77
- otf: ["font/otf"],
78
- png: ["image/png"],
79
- pdf: ["application/pdf"],
80
- php: ["application/x-httpd-php"],
81
- pkpass: ["application/vnd.apple.pkpass"],
82
- ppt: ["application/vnd.ms-powerpoint"],
83
- pptx: [
84
- "application/vnd.openxmlformats-officedocument.presentationml.presentation"
85
- ],
86
- py: ["text/x-python"],
87
- pyc: ["application/x-python-code"],
88
- rar: ["application/vnd.rar"],
89
- rtf: ["application/rtf"],
90
- sh: ["application/x-sh"],
91
- sql: ["application/sql"],
92
- svg: ["image/svg+xml"],
93
- tar: ["application/x-tar"],
94
- tif: ["image/tiff"],
95
- tiff: ["image/tiff"],
96
- toml: ["application/toml"],
97
- ts: ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"],
98
- ttf: ["application/font-sfnt", "font/ttf"],
99
- txt: ["text/plain"],
100
- usdz: ["model/vnd.usdz+zip"],
101
- vsd: ["application/vnd.visio"],
102
- vtt: ["text/vtt"],
103
- wasm: ["application/wasm"],
104
- wav: ["audio/wav"],
105
- weba: ["video/webm"],
106
- webp: ["image/webp"],
107
- woff: ["font/woff"],
108
- woff2: ["font/woff2"],
109
- xhtml: ["application/xhtml+xml"],
110
- xls: ["application/vnd.ms-excel"],
111
- xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
112
- xml: ["application/xml"],
113
- xul: ["application/vnd.mozilla.xul+xml"],
114
- yaml: ["application/yaml"],
115
- yml: ["application/yaml"],
116
- zip: ["application/zip", "application/x-zip-compressed"],
117
- "3gp": ["video/3gpp"],
118
- "3g2": ["video/3gpp2"],
119
- "7z": ["application/x-7z-compressed"]
120
- };
121
- var MimeService = class extends UrlService {
122
- static {
123
- __name(this, "MimeService");
124
- }
125
- constructor() {
126
- super();
127
- }
128
- mimeTypeObj = extMimeMap;
129
- assetType(url) {
130
- const parsed = this.parseUrl(url);
131
- if (!parsed) return void 0;
132
- const ext = parsed.pathname.split(/([.])/g)?.reverse()?.[0]?.toLowerCase();
133
- return ext && ext in this.mimeTypeObj ? ext : void 0;
134
- }
135
- getMimes(ext) {
136
- return this.mimeTypeObj[ext];
137
- }
138
- getMimeFor(ext, opts) {
139
- const mimes = this.getMimes(ext);
140
- if (mimes.length === 1) return mimes[0];
141
- if (opts?.type) {
142
- const found = mimes.find((mime) => mime.startsWith(opts.type + "/"));
143
- return found ?? mimes[0];
144
- }
145
- return mimes[0];
146
- }
147
- isMimeFor(ext, mime) {
148
- return this.getMimes(ext).find((s) => s === mime);
149
- }
150
- getMimeTypeForPath(path, opts) {
151
- const ext = this.assetType(path);
152
- if (!ext) return "application/octet-stream";
153
- return this.getMimeFor(ext, opts);
154
- }
155
- };
156
-
157
- export {
158
- extMimeMap,
159
- MimeService
160
- };
161
- //# sourceMappingURL=chunk-EHOBCDHE.js.map