@d0paminedriven/fs 6.1.0 → 6.3.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/README.md +322 -64
- package/dist/chunk-C6AZRX7V.js +307 -0
- package/dist/{chunk-QMN5ZCE4.js → chunk-IUGBPDQJ.js} +21 -16
- package/dist/{chunk-4X5DVWVM.js → chunk-MXEE2WS7.js} +1 -1
- package/dist/{chunk-XIAKCF2X.js → chunk-NGBMZGGU.js} +358 -8
- package/dist/fs/index.cjs +503 -8
- package/dist/fs/index.d.cts +142 -4
- package/dist/fs/index.d.ts +142 -4
- package/dist/fs/index.js +3 -3
- package/dist/index.cjs +525 -23
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -5
- package/dist/mime/index.cjs +152 -5
- package/dist/mime/index.d.cts +243 -11
- package/dist/mime/index.d.ts +243 -11
- package/dist/mime/index.js +5 -3
- package/dist/types/index.d.cts +93 -31
- package/dist/types/index.d.ts +93 -31
- package/dist/types/index.js +1 -1
- package/dist/utils/index.cjs +20 -15
- package/dist/utils/index.d.cts +2 -6
- package/dist/utils/index.d.ts +2 -6
- package/dist/utils/index.js +1 -1
- package/package.json +14 -14
- package/dist/chunk-EHOBCDHE.js +0 -161
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
177
|
-
|
|
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
|
-
|
|
180
|
-
|
|
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
|
-
|
|
183
|
-
|
|
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
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
|
192
|
-
type
|
|
193
|
-
|
|
194
|
-
|
|
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
|
|
198
|
-
|
|
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 };
|
package/dist/types/index.js
CHANGED
package/dist/utils/index.cjs
CHANGED
|
@@ -52,19 +52,21 @@ var UtilsService = class {
|
|
|
52
52
|
b64ToBlob(b64Data) {
|
|
53
53
|
{
|
|
54
54
|
const sliceSize = 512;
|
|
55
|
-
const typeMatch =
|
|
56
|
-
|
|
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
|
|
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.
|
|
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
|
-
(
|
|
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();
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -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
|
|
18
|
-
|
|
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;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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
|
|
18
|
-
|
|
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;
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d0paminedriven/fs",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "convenient fs helpers",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -47,26 +47,26 @@
|
|
|
47
47
|
"./utils": "./dist/utils/index.js"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"dotenv": "^
|
|
50
|
+
"dotenv": "^17.2.1",
|
|
51
51
|
"dotenv-expand": "^12.0.2",
|
|
52
|
-
"sharp": "^0.34.
|
|
52
|
+
"sharp": "^0.34.3"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@types/node": "^24.
|
|
55
|
+
"@types/node": "^24.3.0",
|
|
56
56
|
"chokidar": "^4.0.3",
|
|
57
|
-
"dotenv-cli": "^
|
|
58
|
-
"eslint": "^9.
|
|
59
|
-
"jiti": "^2.
|
|
60
|
-
"prettier": "^3.
|
|
61
|
-
"terser": "^5.
|
|
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.
|
|
65
|
-
"typescript": "^5.
|
|
66
|
-
"typescript-eslint": "^8.
|
|
67
|
-
"@d0paminedriven/
|
|
64
|
+
"tsx": "^4.20.4",
|
|
65
|
+
"typescript": "^5.9.2",
|
|
66
|
+
"typescript-eslint": "^8.40.0",
|
|
67
|
+
"@d0paminedriven/eslint-config": "0.1.0",
|
|
68
68
|
"@d0paminedriven/prettier-config": "0.1.0",
|
|
69
|
-
"@d0paminedriven/
|
|
69
|
+
"@d0paminedriven/tsconfig": "0.1.0"
|
|
70
70
|
},
|
|
71
71
|
"prettier": "@d0paminedriven/prettier-config",
|
|
72
72
|
"scripts": {
|
package/dist/chunk-EHOBCDHE.js
DELETED
|
@@ -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
|