@e-mc/types 0.10.3 → 0.10.5
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 +5 -5
- package/constant.d.ts +8 -37
- package/index.d.ts +14 -27
- package/lib/asset.d.ts +2 -2
- package/lib/cloud.d.ts +1 -1
- package/lib/compat-v4.d.ts +6 -11
- package/lib/compress.d.ts +8 -9
- package/lib/core.d.ts +7 -7
- package/lib/db.d.ts +14 -16
- package/lib/document.d.ts +4 -6
- package/lib/filemanager.d.ts +9 -10
- package/lib/http.d.ts +1 -2
- package/lib/index.d.ts +47 -53
- package/lib/logger.d.ts +0 -3
- package/lib/module.d.ts +38 -23
- package/lib/node.d.ts +2 -2
- package/lib/object.d.ts +2 -0
- package/lib/request.d.ts +4 -8
- package/lib/settings.d.ts +70 -93
- package/lib/squared.d.ts +45 -9
- package/lib/type.d.ts +6 -9
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
2
|
+
|
|
1
3
|
/// <reference path="type.d.ts" />
|
|
2
4
|
/// <reference path="object.d.ts" />
|
|
3
5
|
|
|
4
|
-
import type { DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction, ViewEngine } from './squared';
|
|
6
|
+
import type { CompressLevel, DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction, ViewEngine } from './squared';
|
|
5
7
|
|
|
6
8
|
import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
|
|
7
9
|
import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, UploadAssetOptions } from './cloud';
|
|
8
|
-
import type { BufferResult, CompressFormat,
|
|
10
|
+
import type { BufferResult, CompressFormat, TryFileCompressor } from './compress';
|
|
9
11
|
import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
|
|
10
12
|
import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
|
|
11
13
|
import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
|
|
@@ -13,7 +15,7 @@ import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutp
|
|
|
13
15
|
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
|
|
14
16
|
import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
|
|
15
17
|
import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogState, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
|
|
16
|
-
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions,
|
|
18
|
+
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, GlobDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, WriteFileOptions } from './module';
|
|
17
19
|
import type { RequestData, Settings } from './node';
|
|
18
20
|
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, PutOptions, ReadExpectType, RequestInit, StatusOnCallback } from './request';
|
|
19
21
|
import type { ClientModule, CloudAuthSettings, CloudModule, CloudServiceOptions, CompressModule, CompressSettings, DbCoerceSettings, DbModule, DbSourceOptions, DnsLookupSettings, DocumentComponent, DocumentComponentOption, DocumentModule, HandlerSettings, HttpConnectSettings, HttpMemorySettings, ImageModule, LoggerFormat, LoggerFormatSettings, PoolConfig, RequestModule, RequestSettings, TaskModule, WatchModule } from './settings';
|
|
@@ -21,7 +23,7 @@ import type { Command, SpawnResult } from './task';
|
|
|
21
23
|
import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
|
|
22
24
|
|
|
23
25
|
import type { SpawnOptions } from 'child_process';
|
|
24
|
-
import type { BinaryLike
|
|
26
|
+
import type { BinaryLike } from 'crypto';
|
|
25
27
|
import type { NoParamCallback, WriteStream } from 'fs';
|
|
26
28
|
import type { ClientRequest, OutgoingHttpHeaders } from 'http';
|
|
27
29
|
import type { LookupFunction } from 'net';
|
|
@@ -40,7 +42,6 @@ type CpuUsage = NodeJS.CpuUsage;
|
|
|
40
42
|
|
|
41
43
|
declare namespace functions {
|
|
42
44
|
type WatchInstance<T extends ExternalAsset, U extends WatchModule = WatchModule> = IWatch<IFileManager<T>, T, U, ModifiedPostFinalizeListener<T>>;
|
|
43
|
-
type FormatMessageArgs = [type: LogType, title: string, value: LogValue, message: unknown, options: LogMessageOptions];
|
|
44
45
|
|
|
45
46
|
interface IScopeOrigin<T extends IHost = IHost, U extends IModule = IModule> {
|
|
46
47
|
host?: T;
|
|
@@ -58,12 +59,13 @@ declare namespace functions {
|
|
|
58
59
|
get extensions(): T[];
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
interface ICompress<T extends CompressModule
|
|
62
|
+
interface ICompress<T extends CompressModule<U>, U extends CompressSettings = CompressSettings> extends IModule, IExternalConfig<T, U> {
|
|
62
63
|
level: ObjectMap<number>;
|
|
63
64
|
compressors: ObjectMap<TryFileCompressor>;
|
|
65
|
+
chunkSize?: number;
|
|
64
66
|
register(format: string, callback: TryFileCompressor): void;
|
|
65
67
|
getLevel(value: string, fallback?: number): Undef<number>;
|
|
66
|
-
getReadable(file: string | URL | Buffer
|
|
68
|
+
getReadable(file: string | URL | Buffer): Readable;
|
|
67
69
|
createGzip(file: string | Buffer, options?: CompressLevel): Gzip;
|
|
68
70
|
createBrotliCompress(file: string | Buffer, options?: CompressLevel): BrotliCompress;
|
|
69
71
|
createWriteStreamAsGzip(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
|
|
@@ -74,12 +76,10 @@ declare namespace functions {
|
|
|
74
76
|
tryFile(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
|
|
75
77
|
tryImage(file: string, options: CompressFormat): Promise<BufferResult>;
|
|
76
78
|
tryImage(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
|
|
77
|
-
set chunkSize(value: Undef<number | string>);
|
|
78
|
-
get chunkSize(): Undef<number>;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
interface CompressConstructor<T extends CompressModule = CompressModule
|
|
82
|
-
singleton(): ICompress<
|
|
81
|
+
interface CompressConstructor<T extends CompressModule<U> = CompressModule<any>, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
|
|
82
|
+
singleton(): ICompress<CompressModule>;
|
|
83
83
|
readonly prototype: ICompress<T, U>;
|
|
84
84
|
new(module?: U): ICompress<T, U>;
|
|
85
85
|
}
|
|
@@ -91,6 +91,7 @@ declare namespace functions {
|
|
|
91
91
|
qualityData?: QualityData;
|
|
92
92
|
methodData?: [string, unknown[]?][];
|
|
93
93
|
opacityValue?: number;
|
|
94
|
+
outputType?: string;
|
|
94
95
|
setCommand(value: string | CommandData, outputAs?: string): void;
|
|
95
96
|
getCommand(): string;
|
|
96
97
|
parseCommand(value: string): CommandData;
|
|
@@ -198,10 +199,10 @@ declare namespace functions {
|
|
|
198
199
|
LOG_CLOUD_DOWNLOAD: LogMessageOptions;
|
|
199
200
|
LOG_CLOUD_DELETE: LogMessageOptions;
|
|
200
201
|
LOG_CLOUD_DELAYED: LogMessageOptions;
|
|
201
|
-
finalize(this: T, instance: ICloud<T, U, V>): Promise<
|
|
202
|
-
uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, options: UploadAssetOptions): Promise<
|
|
203
|
-
uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, ignoreProcess: boolean): Promise<
|
|
204
|
-
uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, contentType?: string | boolean | UploadAssetOptions, ignoreProcess?: boolean): Promise<
|
|
202
|
+
finalize(this: T, instance: ICloud<T, U, V>): Promise<unknown>;
|
|
203
|
+
uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, options: UploadAssetOptions): Promise<unknown>[];
|
|
204
|
+
uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, ignoreProcess: boolean): Promise<unknown>[];
|
|
205
|
+
uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, contentType?: string | boolean | UploadAssetOptions, ignoreProcess?: boolean): Promise<unknown>[];
|
|
205
206
|
sanitizeAssets<W extends ExternalAsset>(assets: W[]): W[];
|
|
206
207
|
readonly prototype: ICloud<T, U, V>;
|
|
207
208
|
new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
|
|
@@ -264,7 +265,7 @@ declare namespace functions {
|
|
|
264
265
|
updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
|
|
265
266
|
generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
|
|
266
267
|
cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
|
|
267
|
-
sanitizeAssets?(assets: U[], exclusions?:
|
|
268
|
+
sanitizeAssets?(assets: U[], exclusions?: U[]): U[];
|
|
268
269
|
readonly prototype: IDocument<T, U, V, W, X, Y>;
|
|
269
270
|
new(module?: V, ...args: unknown[]): IDocument<T, U, V, W, X, Y>;
|
|
270
271
|
}
|
|
@@ -295,14 +296,14 @@ declare namespace functions {
|
|
|
295
296
|
createServer(port: number, active: boolean): Null<ws.Server>;
|
|
296
297
|
createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
|
|
297
298
|
shutdown(): void;
|
|
298
|
-
setTimeout(value:
|
|
299
|
+
setTimeout(value: NumString): void;
|
|
299
300
|
checkTimeout(client: ws): boolean;
|
|
300
301
|
readonly prototype: IWatch<T, U, V, W>;
|
|
301
302
|
new(module?: V): IWatch<T, U, V, W>;
|
|
302
303
|
new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
|
|
303
304
|
}
|
|
304
305
|
|
|
305
|
-
interface IRequest<T extends RequestModule
|
|
306
|
+
interface IRequest<T extends RequestModule<U>, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
|
|
306
307
|
startTime: number;
|
|
307
308
|
acceptEncoding: boolean;
|
|
308
309
|
keepAlive: Null<boolean>;
|
|
@@ -312,7 +313,7 @@ declare namespace functions {
|
|
|
312
313
|
init(config?: RequestInit): this;
|
|
313
314
|
apply(options: ApplyOptions): this;
|
|
314
315
|
addDns(hostname: string, address: string, timeout: number): void;
|
|
315
|
-
addDns(hostname: string, address: string, family?:
|
|
316
|
+
addDns(hostname: string, address: string, family?: NumString, timeout?: number): void;
|
|
316
317
|
lookupDns(hostname: string): LookupFunction;
|
|
317
318
|
proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
|
|
318
319
|
statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
|
|
@@ -347,13 +348,13 @@ declare namespace functions {
|
|
|
347
348
|
get ipVersion(): InternetProtocolVersion;
|
|
348
349
|
}
|
|
349
350
|
|
|
350
|
-
interface RequestConstructor<T extends RequestModule = RequestModule
|
|
351
|
+
interface RequestConstructor<T extends RequestModule<U> = RequestModule<any>, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
|
|
351
352
|
readCACert(value: string, cache?: boolean): string;
|
|
352
353
|
readTLSKey(value: string, cache?: boolean): string;
|
|
353
354
|
readTLSCert(value: string, cache?: boolean): string;
|
|
354
355
|
isCert(value: string): boolean;
|
|
355
356
|
fromURL(url: URL, value: string): string;
|
|
356
|
-
fromStatusCode(value:
|
|
357
|
+
fromStatusCode(value: NumString): string;
|
|
357
358
|
defineHttpAgent(options: HttpAgentSettings): void;
|
|
358
359
|
defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
|
|
359
360
|
getAria2Path(): string;
|
|
@@ -365,13 +366,13 @@ declare namespace functions {
|
|
|
365
366
|
processTimeout: number;
|
|
366
367
|
cacheToDisk: IHttpDiskCache<T>;
|
|
367
368
|
cacheToMemory: IHttpMemoryCache<T>;
|
|
368
|
-
Request: IRequest
|
|
369
|
+
Request: IRequest<RequestModule>;
|
|
369
370
|
Document: InstallData<IDocument<IFileManager<T>, T>, DocumentConstructor<IFileManager<T>, T>>[];
|
|
370
371
|
Task: InstallData<ITask, TaskConstructor>[];
|
|
371
372
|
Image: Null<ImageMimeMap>;
|
|
372
373
|
Cloud: Null<ICloud>;
|
|
373
374
|
Watch: Null<WatchInstance<T>>;
|
|
374
|
-
Compress: Null<ICompress
|
|
375
|
+
Compress: Null<ICompress<CompressModule>>;
|
|
375
376
|
readonly documentAssets: T[];
|
|
376
377
|
readonly taskAssets: (T & Required<TaskAction>)[];
|
|
377
378
|
readonly dataSourceItems: DataSource[];
|
|
@@ -395,8 +396,8 @@ declare namespace functions {
|
|
|
395
396
|
install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
|
|
396
397
|
install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
|
|
397
398
|
install(name: "watch", module: WatchModule): Undef<WatchInstance<T>>;
|
|
398
|
-
install(name: "watch", interval?:
|
|
399
|
-
install(name: "compress", module?: CompressModule): Undef<ICompress
|
|
399
|
+
install(name: "watch", interval?: NumString, port?: NumString, securePort?: NumString, extensions?: unknown[]): Undef<WatchInstance<T>>;
|
|
400
|
+
install(name: "compress", module?: CompressModule): Undef<ICompress<CompressModule>>;
|
|
400
401
|
install(name: string, ...args: unknown[]): Undef<IModule>;
|
|
401
402
|
using(...items: FirstOf<T>): this;
|
|
402
403
|
contains(item: T, condition?: FunctionArgs<[T], boolean>): boolean;
|
|
@@ -413,7 +414,6 @@ declare namespace functions {
|
|
|
413
414
|
hasDocument(instance: IModule, document: Undef<ArrayOf<string>>): boolean;
|
|
414
415
|
getDocumentAssets(instance: IModule, condition?: FunctionArgs<[T], boolean>): T[];
|
|
415
416
|
getDataSourceItems(instance: IModule, condition?: FunctionArgs<[DataSource], boolean>): DataSource[];
|
|
416
|
-
checkFilename(file: T, pathname?: string): string;
|
|
417
417
|
setLocalUri(file: T, replace?: boolean): FileOutput;
|
|
418
418
|
getLocalUri(data: FileData<T>): string;
|
|
419
419
|
getMimeType(data: FileData<T>): string;
|
|
@@ -445,7 +445,7 @@ declare namespace functions {
|
|
|
445
445
|
fetchBuffer<U extends OpenOptions>(uri: string | URL, options?: U): Promise<DataEncodedResult<U>>;
|
|
446
446
|
fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
|
|
447
447
|
fetchFiles(uri: string | URL, options?: Aria2Options): Promise<string[]>;
|
|
448
|
-
updateProgress(name: "request", id:
|
|
448
|
+
updateProgress(name: "request", id: NumString, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
|
|
449
449
|
start(emptyDir?: boolean): Promise<FinalizeResult>;
|
|
450
450
|
processAssets(emptyDir?: boolean, using?: T[]): void;
|
|
451
451
|
deleteFile<U extends Promise<void>>(src: string, promises: boolean): U;
|
|
@@ -454,12 +454,11 @@ declare namespace functions {
|
|
|
454
454
|
deleteFile<U extends NoParamCallback>(src: string, options: DeleteFileOptions & DeleteFileAddendum, callback?: U): unknown;
|
|
455
455
|
restart(recursive?: boolean | "abort", emptyDir?: boolean): void;
|
|
456
456
|
restart(recursive?: boolean | "abort", exclusions?: string[], emptyDir?: boolean): void;
|
|
457
|
-
finalizeCompress(assets: T[]): Promise<
|
|
458
|
-
finalizeDocument(): Promise<
|
|
459
|
-
finalizeTask(assets: (T & Required<TaskAction>)[]): Promise<
|
|
460
|
-
finalizeCloud(): Promise<
|
|
461
|
-
|
|
462
|
-
finalizeCleanup(): Promise<void>;
|
|
457
|
+
finalizeCompress(assets: T[]): Promise<unknown>;
|
|
458
|
+
finalizeDocument(): Promise<unknown>;
|
|
459
|
+
finalizeTask(assets: (T & Required<TaskAction>)[]): Promise<unknown>;
|
|
460
|
+
finalizeCloud(): Promise<unknown>;
|
|
461
|
+
finalizeCleanup(): Promise<unknown>;
|
|
463
462
|
finalize(): Promise<void>;
|
|
464
463
|
close(): void;
|
|
465
464
|
reset(): boolean;
|
|
@@ -523,7 +522,7 @@ declare namespace functions {
|
|
|
523
522
|
verifyChecksum(root: string, options: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
|
|
524
523
|
verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
|
|
525
524
|
createFileThread(host: IFileManager<T>, file: T): IFileThread<T>;
|
|
526
|
-
setTimeout(options: ObjectMap<
|
|
525
|
+
setTimeout(options: ObjectMap<NumString>): void;
|
|
527
526
|
defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
|
|
528
527
|
defineHttpConnect(options: HttpConnectSettings): void;
|
|
529
528
|
readonly prototype: IFileManager<T>;
|
|
@@ -543,8 +542,8 @@ declare namespace functions {
|
|
|
543
542
|
willLog(name: string): boolean;
|
|
544
543
|
ignoreLog(values: boolean | ArrayOf<string>): void;
|
|
545
544
|
collectLog(level?: boolean): LogStatus<StatusType>[];
|
|
546
|
-
pauseLog(
|
|
547
|
-
resumeLog(
|
|
545
|
+
pauseLog(): void;
|
|
546
|
+
resumeLog(): void;
|
|
548
547
|
hasLog(type: string): boolean;
|
|
549
548
|
delayMessage(...args: unknown[]): void;
|
|
550
549
|
willAbort(value: string | IModule): boolean;
|
|
@@ -576,7 +575,6 @@ declare namespace functions {
|
|
|
576
575
|
getThreadCount(full: true): ThreadCountStat;
|
|
577
576
|
getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
|
|
578
577
|
getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
|
|
579
|
-
getLogDelayed(): FormatMessageArgs[];
|
|
580
578
|
getPermissionFromSettings(): IPermission;
|
|
581
579
|
readonly prototype: IHost;
|
|
582
580
|
new(config?: HostInitConfig): IHost;
|
|
@@ -585,9 +583,10 @@ declare namespace functions {
|
|
|
585
583
|
interface IModule<T extends IHost = IHost> extends EventEmitter, IAbortComponent {
|
|
586
584
|
readonly status: LogStatus<StatusType>[];
|
|
587
585
|
readonly errors: unknown[];
|
|
586
|
+
/** @deprecated */
|
|
588
587
|
supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
589
588
|
supports(name: string, value?: boolean): boolean;
|
|
590
|
-
getTempDir(options:
|
|
589
|
+
getTempDir(options: GetTempDirOptions): string;
|
|
591
590
|
getTempDir(uuidDir: boolean, createDir: boolean): string;
|
|
592
591
|
getTempDir(pathname: string, createDir: boolean): string;
|
|
593
592
|
getTempDir(uuidDir: boolean, filename?: string, createDir?: boolean): string;
|
|
@@ -595,7 +594,7 @@ declare namespace functions {
|
|
|
595
594
|
canRead(uri: string | URL, options?: PermissionOptions): boolean;
|
|
596
595
|
canWrite(uri: string | URL, options?: PermissionOptions): boolean;
|
|
597
596
|
readFile(src: string | URL): Undef<Buffer>;
|
|
598
|
-
readFile<U extends ReadFileOptions>(src: string | URL, options?: U): Undef<U extends { encoding: string } ? U extends { minStreamSize:
|
|
597
|
+
readFile<U extends ReadFileOptions>(src: string | URL, options?: U): Undef<U extends { encoding: string } ? U extends { minStreamSize: NumString } ? Promise<string> : string : U extends { minStreamSize: NumString } ? Promise<Buffer> : Buffer>;
|
|
599
598
|
readFile<U extends Buffer>(src: string | URL, promises: true): Promise<Undef<U>>;
|
|
600
599
|
readFile<U extends Bufferable, V extends ReadFileOptions>(src: string | URL, options: V, promises: true): Promise<Undef<V extends { encoding: string } ? string : U>>;
|
|
601
600
|
readFile<U extends ReadFileCallback>(src: string | URL, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : Bufferable>;
|
|
@@ -670,10 +669,8 @@ declare namespace functions {
|
|
|
670
669
|
get sessionId(): string;
|
|
671
670
|
set broadcastId(value);
|
|
672
671
|
get broadcastId(): ArrayOf<string>;
|
|
673
|
-
set silent(value);
|
|
674
|
-
get silent(): boolean;
|
|
675
672
|
get logType(): LOG_TYPE;
|
|
676
|
-
set logLevel(value:
|
|
673
|
+
set logLevel(value: NumString);
|
|
677
674
|
get logLevel(): number;
|
|
678
675
|
get statusType(): STATUS_TYPE;
|
|
679
676
|
set tempDir(value);
|
|
@@ -721,10 +718,8 @@ declare namespace functions {
|
|
|
721
718
|
readonly LOG_TYPE: LOG_TYPE;
|
|
722
719
|
readonly LOG_FORMAT: LoggerFormatSettings<LoggerFormat<number>>;
|
|
723
720
|
readonly STATUS_TYPE: STATUS_TYPE;
|
|
724
|
-
readonly PLATFORM_WIN32: boolean;
|
|
725
721
|
readonly MAX_TIMEOUT: number;
|
|
726
722
|
readonly TEMP_DIR: string;
|
|
727
|
-
/** @deprecated Types.supported */
|
|
728
723
|
supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
729
724
|
formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
|
|
730
725
|
writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
|
|
@@ -732,9 +727,8 @@ declare namespace functions {
|
|
|
732
727
|
parseFunction<U = unknown, V = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U, V>>;
|
|
733
728
|
parseFunction<U = unknown, V = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U, V>>;
|
|
734
729
|
asString(value: unknown, cacheKey?: boolean | "throws"): string;
|
|
735
|
-
asHash(data: BinaryLike, options
|
|
736
|
-
asHash(data: BinaryLike, algorithm?:
|
|
737
|
-
asHash(data: BinaryLike, algorithm?: string, digest?: BinaryToTextEncoding): string;
|
|
730
|
+
asHash(data: BinaryLike, options: AsHashOptions): string;
|
|
731
|
+
asHash(data: BinaryLike, algorithm?: unknown, digest?: unknown): string;
|
|
738
732
|
readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
|
|
739
733
|
toPosix(value: unknown, normalize: boolean): string;
|
|
740
734
|
toPosix(value: unknown, filename?: string, normalize?: boolean): string;
|
|
@@ -750,7 +744,7 @@ declare namespace functions {
|
|
|
750
744
|
resolvePath(value: string, base: string | URL): string;
|
|
751
745
|
joinPath(...values: [...paths: unknown[], normalize: boolean][]): string;
|
|
752
746
|
joinPath(...values: unknown[]): string;
|
|
753
|
-
normalizePath(value: unknown, flags?: boolean |
|
|
747
|
+
normalizePath(value: unknown, flags?: boolean | NormalizeFlags): string;
|
|
754
748
|
createDir(value: string | URL, overwrite?: boolean): boolean;
|
|
755
749
|
removeDir(value: string | URL, sinceCreated: number, recursive?: boolean): boolean;
|
|
756
750
|
removeDir(value: string | URL, empty?: boolean, recursive?: boolean): boolean;
|
|
@@ -763,11 +757,11 @@ declare namespace functions {
|
|
|
763
757
|
streamFile<U extends ReadBufferOptions>(value: string | URL, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
|
|
764
758
|
streamFile<U extends ReadBufferOptions>(value: string | URL, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
|
|
765
759
|
readText(value: string | URL, cache: boolean): string;
|
|
766
|
-
readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize:
|
|
760
|
+
readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<string> : string;
|
|
767
761
|
readText(value: string | URL, encoding?: BufferEncoding | ReadTextOptions, cache?: boolean): string;
|
|
768
|
-
readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize:
|
|
762
|
+
readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<Null<Buffer>> : Null<Buffer>;
|
|
769
763
|
readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Null<Buffer>;
|
|
770
|
-
resolveMime(data:
|
|
764
|
+
resolveMime(data: string | Buffer | Uint8Array | ArrayBuffer): Promise<Undef<FileTypeResult>>;
|
|
771
765
|
lookupMime(value: string, extension?: boolean): string;
|
|
772
766
|
initCpuUsage(instance?: IModule): CpuUsage;
|
|
773
767
|
getCpuUsage(start: CpuUsage, format: true): string;
|
|
@@ -778,9 +772,9 @@ declare namespace functions {
|
|
|
778
772
|
getPackageVersion(name: string | TupleOf<string>, startDir: string, baseDir?: string): string;
|
|
779
773
|
getPackageVersion(name: string | TupleOf<string>, unstable?: boolean, startDir?: string, baseDir?: string): string;
|
|
780
774
|
checkSemVer(name: string | TupleOf<string>, options: CheckSemVerOptions): boolean;
|
|
775
|
+
checkSemVer(name: string | TupleOf<string>, min: NumString, max?: NumString, unstable?: boolean, startDir?: string): boolean;
|
|
781
776
|
/** @deprecated options */
|
|
782
|
-
checkSemVer(name: string | TupleOf<string>, min:
|
|
783
|
-
checkSemVer(name: string | TupleOf<string>, min: number | string, max: number | string, options?: Omit<CheckSemVerOptions, "min" | "max" | "equals">): boolean;
|
|
777
|
+
checkSemVer(name: string | TupleOf<string>, min: NumString, max: NumString, options?: CheckSemVerOptions): boolean;
|
|
784
778
|
sanitizeCmd(value: string): string;
|
|
785
779
|
sanitizeArgs(value: string, doubleQuote?: boolean): string;
|
|
786
780
|
sanitizeArgs(values: string[], doubleQuote?: boolean): string[];
|
package/lib/logger.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export interface LogBaseOptions extends LoggerColor, Pick<LogOptions, "queue" |
|
|
|
12
12
|
sessionId?: string;
|
|
13
13
|
abortable?: boolean;
|
|
14
14
|
titleJustify?: TextAlign;
|
|
15
|
-
rawOutput?: boolean;
|
|
16
15
|
broadcastId?: BroadcastValue;
|
|
17
16
|
newline?: boolean | number;
|
|
18
17
|
}
|
|
@@ -53,7 +52,6 @@ export interface LogMessageOptions extends LogBaseOptions {
|
|
|
53
52
|
messageUnit?: string;
|
|
54
53
|
messageUnitMinWidth?: number;
|
|
55
54
|
messageUnitIndent?: number | [number, string];
|
|
56
|
-
messageTextWrap?: boolean | TextWrapStyle;
|
|
57
55
|
progressBar?: boolean;
|
|
58
56
|
alwaysVisible?: boolean;
|
|
59
57
|
titleIndent?: boolean | number;
|
|
@@ -108,7 +106,6 @@ export type LogComponent = Partial<Pick<LogStatus<StatusType>, "type" | "value"
|
|
|
108
106
|
export type BackgroundColor = typeof IBackgroundColor | HexColor;
|
|
109
107
|
export type ForegroundColor = typeof IForegroundColor | HexColor;
|
|
110
108
|
export type TextAlign = "left" | "center" | "right";
|
|
111
|
-
export type TextWrapStyle = "ellipsis" | "nowrap" | "ellipsis-end" | "nowrap-end" | "none";
|
|
112
109
|
export type ErrorOutMethod = (err: Error, data: LogTypeValue, require?: NodeRequire) => void;
|
|
113
110
|
export type BroadcastOutMethod = (value: string, options: LogMessageOptions, require?: NodeRequire) => void;
|
|
114
111
|
export type BroadcastValue = ArrayOf<string> | { value: ArrayOf<string>; stripAnsi?: boolean };
|
package/lib/module.d.ts
CHANGED
|
@@ -3,9 +3,8 @@ import type { ChecksumBase } from './squared';
|
|
|
3
3
|
import type { StreamAction } from './asset';
|
|
4
4
|
|
|
5
5
|
import type { HashOptions } from 'crypto';
|
|
6
|
-
import type { Readable } from 'stream';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
declare enum NORMALIZE_FLAGS {
|
|
9
8
|
NONE = 0,
|
|
10
9
|
RESOLVE = 1,
|
|
11
10
|
ENSURE_DIR = 2,
|
|
@@ -16,29 +15,16 @@ export interface RequireAction {
|
|
|
16
15
|
requireExt?: ArrayOf<string> | boolean;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
export interface ThrowsAction {
|
|
20
|
-
throwsPermission?: boolean;
|
|
21
|
-
throwsDoesNotExist?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface ExecAction {
|
|
25
|
-
uid?: number | string;
|
|
26
|
-
gid?: number | string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface IncludeAction<T = string[]> {
|
|
30
|
-
include?: T;
|
|
31
|
-
exclude?: T;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
18
|
export interface PermissionOptions {
|
|
35
19
|
ownPermissionOnly?: boolean;
|
|
36
20
|
hostPermissionOnly?: boolean;
|
|
37
21
|
}
|
|
38
22
|
|
|
39
|
-
export interface FileSystemOptions extends PermissionOptions
|
|
23
|
+
export interface FileSystemOptions extends PermissionOptions {
|
|
40
24
|
absolutePath?: boolean;
|
|
41
25
|
ignorePermission?: boolean;
|
|
26
|
+
throwsPermission?: boolean;
|
|
27
|
+
throwsDoesNotExist?: boolean;
|
|
42
28
|
}
|
|
43
29
|
|
|
44
30
|
export interface ReadFileOptions extends FileSystemOptions, StreamBase, RequireAction {
|
|
@@ -69,6 +55,10 @@ export interface RemoveDirOptions extends FileSystemOptions {
|
|
|
69
55
|
export type MoveFileOptions = CopyFileOptions;
|
|
70
56
|
export type CreateDirOptions = FileSystemOptions;
|
|
71
57
|
|
|
58
|
+
export interface GetFunctionsOptions extends ParseFunctionOptions {
|
|
59
|
+
outFailed?: string[];
|
|
60
|
+
}
|
|
61
|
+
|
|
72
62
|
export interface ParseFunctionOptions extends RequireAction {
|
|
73
63
|
absolute?: boolean;
|
|
74
64
|
sync?: boolean;
|
|
@@ -76,9 +66,20 @@ export interface ParseFunctionOptions extends RequireAction {
|
|
|
76
66
|
context?: unknown;
|
|
77
67
|
}
|
|
78
68
|
|
|
69
|
+
export interface CloneObjectOptions<T = unknown> {
|
|
70
|
+
target?: T;
|
|
71
|
+
deep?: boolean;
|
|
72
|
+
deepIgnore?: WeakSet<object>;
|
|
73
|
+
typedArray?: boolean;
|
|
74
|
+
mergeArray?: MergeArrayMethod;
|
|
75
|
+
mergeDepth?: number;
|
|
76
|
+
symbol?: boolean;
|
|
77
|
+
inherited?: boolean;
|
|
78
|
+
nonenumerable?: boolean;
|
|
79
|
+
preserve?: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
79
82
|
export interface CheckSemVerOptions extends MinMax {
|
|
80
|
-
equals?: string;
|
|
81
|
-
includes?: boolean;
|
|
82
83
|
startDir?: string;
|
|
83
84
|
unstable?: boolean;
|
|
84
85
|
}
|
|
@@ -121,9 +122,12 @@ export interface ReadBufferOptions extends StreamBase {
|
|
|
121
122
|
cache?: boolean;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
export interface AsHashOptions extends HashOptions, ChecksumBase {
|
|
125
|
+
export interface AsHashOptions extends HashOptions, ChecksumBase {
|
|
126
|
+
/** @deprecated */
|
|
127
|
+
minLength?: number;
|
|
128
|
+
}
|
|
125
129
|
|
|
126
|
-
export interface
|
|
130
|
+
export interface GetTempDirOptions {
|
|
127
131
|
pathname?: string;
|
|
128
132
|
filename?: string;
|
|
129
133
|
moduleDir?: boolean;
|
|
@@ -132,7 +136,18 @@ export interface TempDirOptions {
|
|
|
132
136
|
increment?: number;
|
|
133
137
|
}
|
|
134
138
|
|
|
139
|
+
export interface ExecAction {
|
|
140
|
+
uid?: NumString;
|
|
141
|
+
gid?: NumString;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface IncludeAction<T = string[]> {
|
|
145
|
+
include?: T;
|
|
146
|
+
exclude?: T;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export type NormalizeFlags = typeof NORMALIZE_FLAGS[keyof typeof NORMALIZE_FLAGS];
|
|
135
150
|
export type ReadTextOptions = ReadBufferOptions;
|
|
136
151
|
export type ReadFileCallback<T extends Bufferable = Bufferable> = (err: Null<NodeJS.ErrnoException>, data?: T) => void;
|
|
137
152
|
export type ProtocolType = "http" | "https" | "http/s" | "ftp" | "sftp" | "s/ftp" | "torrent" | "unc" | "file";
|
|
138
|
-
export type
|
|
153
|
+
export type MergeArrayMethod = "concat" | "concat-pre" | "includes" | "unshift" | "push" | "flat" | "join" | "slice" | "reverse" | ["flat", number] | ["join", string] | ["slice", number, number?];
|
package/lib/node.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RequestData as IRequestData } from './squared';
|
|
2
2
|
|
|
3
3
|
import type { ExternalAsset } from './asset';
|
|
4
|
-
import type { HostInitConfig
|
|
4
|
+
import type { HostInitConfig } from './core';
|
|
5
5
|
import type { DownloadModule, ErrorModule, LoggerModule, MemoryModule, NodeModule, PermissionModule, ProcessModule, RequestModule, TempModule } from './settings';
|
|
6
6
|
|
|
7
|
-
export interface RequestData<T extends ExternalAsset = ExternalAsset
|
|
7
|
+
export interface RequestData<T extends ExternalAsset = ExternalAsset> extends Readonly<Omit<IRequestData, "log">>, Readonly<HostInitConfig> {
|
|
8
8
|
readonly assets?: T[];
|
|
9
9
|
}
|
|
10
10
|
|
package/lib/object.d.ts
CHANGED
package/lib/request.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { BinaryAction } from './asset';
|
|
2
2
|
import type { HttpProtocolVersion, InternetProtocolVersion } from './http';
|
|
3
|
-
import type { HttpHostSettings } from './settings';
|
|
4
3
|
|
|
5
4
|
import type { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
|
|
6
5
|
import type { Readable, Writable } from 'stream';
|
|
@@ -40,16 +39,14 @@ export interface IHttpHost {
|
|
|
40
39
|
get hostname(): string;
|
|
41
40
|
get port(): string;
|
|
42
41
|
get origin(): string;
|
|
43
|
-
get streamSize(): number;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
export interface HttpHostConstructor {
|
|
47
45
|
normalizeOrigin(value: string): string;
|
|
48
46
|
formatBasicAuth(url: URL): string;
|
|
49
47
|
getBasicAuth(url: URL): Undef<OutgoingHttpHeaders>;
|
|
50
|
-
defineLocalHost(
|
|
51
|
-
defineProtocolNegotiation(
|
|
52
|
-
defineHostConfig(settings: HttpHostSettings): void;
|
|
48
|
+
defineLocalHost(value: string[]): void;
|
|
49
|
+
defineProtocolNegotiation(value: ObjectMap<string[]>): void;
|
|
53
50
|
readonly prototype: IHttpHost;
|
|
54
51
|
new(url: URL, httpVersion?: HttpProtocolVersion): IHttpHost;
|
|
55
52
|
}
|
|
@@ -57,7 +54,6 @@ export interface HttpHostConstructor {
|
|
|
57
54
|
export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
58
55
|
host?: IHttpHost;
|
|
59
56
|
url?: URL;
|
|
60
|
-
base?: boolean;
|
|
61
57
|
socketPath?: string;
|
|
62
58
|
httpVersion?: HttpProtocolVersion;
|
|
63
59
|
method?: HttpMethod | Lowercase<HttpMethod>;
|
|
@@ -66,7 +62,7 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
|
66
62
|
follow_redirect?: boolean;
|
|
67
63
|
followRedirect?: boolean;
|
|
68
64
|
encoding?: BufferEncoding;
|
|
69
|
-
maxBufferSize?:
|
|
65
|
+
maxBufferSize?: NumString;
|
|
70
66
|
format?: BufferFormat | { out?: BufferFormat; parser?: PlainObject };
|
|
71
67
|
headers?: OutgoingHttpHeaders | Headers;
|
|
72
68
|
signal?: AbortSignal;
|
|
@@ -75,7 +71,7 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
|
|
|
75
71
|
postData?: unknown;
|
|
76
72
|
connected?: (headers: IncomingHttpHeaders) => Void<boolean>;
|
|
77
73
|
statusMessage?: string;
|
|
78
|
-
progressId?:
|
|
74
|
+
progressId?: NumString;
|
|
79
75
|
outFormat?: { out: BufferFormat; parser?: PlainObject };
|
|
80
76
|
outFilename?: Null<string>;
|
|
81
77
|
outHeaders?: Null<IncomingHttpHeaders>;
|