@e-mc/types 0.10.2 → 0.10.4

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/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, CompressLevel, ReadableOptions, TryFileCompressor } from './compress';
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,34 +15,33 @@ 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, FileTypeFormat, MoveFileOptions, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, TempDirOptions, WriteFileOptions } from './module';
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
- import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit, StatusOnCallback } from './request';
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';
20
22
  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, BinaryToTextEncoding, HashOptions } from 'crypto';
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';
28
30
  import type { Readable, Writable } from 'stream';
29
31
  import type { SecureContextOptions } from 'tls';
30
32
  import type { BrotliCompress, Gzip } from 'zlib';
33
+ // @ts-ignore
34
+ import type { FileTypeResult } from 'file-type';
31
35
 
32
36
  import type * as EventEmitter from 'events';
33
-
34
37
  // @ts-ignore
35
38
  import type * as ws from 'ws';
36
- import type { FileTypeResult } from 'file-type';
37
39
 
38
40
  type BufferView = Bufferable | NodeJS.ArrayBufferView;
39
41
  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 = CompressModule, U extends CompressSettings = CompressSettings> extends IModule, IExternalConfig<T, U> {
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, options?: ReadableOptions): Readable;
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, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
82
- singleton(): ICompress<T, U>;
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<void>;
202
- uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, options: UploadAssetOptions): Promise<void>[];
203
- uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, ignoreProcess: boolean): Promise<void>[];
204
- uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, contentType?: string | boolean | UploadAssetOptions, ignoreProcess?: boolean): Promise<void>[];
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?: unknown[]): U[];
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: number | string): void;
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 = RequestModule, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
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?: number | string, timeout?: number): void;
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;
@@ -327,6 +328,9 @@ declare namespace functions {
327
328
  opts(url: string | URL, options?: OpenOptions): HostConfig;
328
329
  open(uri: string | URL, options: OpenOptions): HttpRequestClient;
329
330
  head(uri: string | URL, options?: OpenOptions): ClientRequest;
331
+ put<V extends { format: undefined; encoding: undefined }>(uri: string | URL, data: unknown, contentType: string): Promise<DataObjectResult<V>>;
332
+ put<V extends PutOptions>(uri: string | URL, data: unknown, options: V): Promise<DataObjectResult<V>>;
333
+ put<V extends PutOptions>(uri: string | URL, data: unknown, contentType?: string | V, options?: V): Promise<DataObjectResult<V>>;
330
334
  post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, data: unknown, contentType: string): Promise<DataObjectResult<V>>;
331
335
  post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
332
336
  post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, form: AnyObject, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
@@ -344,13 +348,13 @@ declare namespace functions {
344
348
  get ipVersion(): InternetProtocolVersion;
345
349
  }
346
350
 
347
- interface RequestConstructor<T extends RequestModule = RequestModule, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
351
+ interface RequestConstructor<T extends RequestModule<U> = RequestModule<any>, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
348
352
  readCACert(value: string, cache?: boolean): string;
349
353
  readTLSKey(value: string, cache?: boolean): string;
350
354
  readTLSCert(value: string, cache?: boolean): string;
351
355
  isCert(value: string): boolean;
352
356
  fromURL(url: URL, value: string): string;
353
- fromStatusCode(value: number | string): string;
357
+ fromStatusCode(value: NumString): string;
354
358
  defineHttpAgent(options: HttpAgentSettings): void;
355
359
  defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
356
360
  getAria2Path(): string;
@@ -362,13 +366,13 @@ declare namespace functions {
362
366
  processTimeout: number;
363
367
  cacheToDisk: IHttpDiskCache<T>;
364
368
  cacheToMemory: IHttpMemoryCache<T>;
365
- Request: IRequest;
369
+ Request: IRequest<RequestModule>;
366
370
  Document: InstallData<IDocument<IFileManager<T>, T>, DocumentConstructor<IFileManager<T>, T>>[];
367
371
  Task: InstallData<ITask, TaskConstructor>[];
368
372
  Image: Null<ImageMimeMap>;
369
373
  Cloud: Null<ICloud>;
370
374
  Watch: Null<WatchInstance<T>>;
371
- Compress: Null<ICompress>;
375
+ Compress: Null<ICompress<CompressModule>>;
372
376
  readonly documentAssets: T[];
373
377
  readonly taskAssets: (T & Required<TaskAction>)[];
374
378
  readonly dataSourceItems: DataSource[];
@@ -392,8 +396,8 @@ declare namespace functions {
392
396
  install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
393
397
  install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
394
398
  install(name: "watch", module: WatchModule): Undef<WatchInstance<T>>;
395
- install(name: "watch", interval?: number | string, port?: number | string, securePort?: number | string, extensions?: unknown[]): Undef<WatchInstance<T>>;
396
- 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>>;
397
401
  install(name: string, ...args: unknown[]): Undef<IModule>;
398
402
  using(...items: FirstOf<T>): this;
399
403
  contains(item: T, condition?: FunctionArgs<[T], boolean>): boolean;
@@ -410,7 +414,6 @@ declare namespace functions {
410
414
  hasDocument(instance: IModule, document: Undef<ArrayOf<string>>): boolean;
411
415
  getDocumentAssets(instance: IModule, condition?: FunctionArgs<[T], boolean>): T[];
412
416
  getDataSourceItems(instance: IModule, condition?: FunctionArgs<[DataSource], boolean>): DataSource[];
413
- checkFilename(file: T, pathname?: string): string;
414
417
  setLocalUri(file: T, replace?: boolean): FileOutput;
415
418
  getLocalUri(data: FileData<T>): string;
416
419
  getMimeType(data: FileData<T>): string;
@@ -442,7 +445,7 @@ declare namespace functions {
442
445
  fetchBuffer<U extends OpenOptions>(uri: string | URL, options?: U): Promise<DataEncodedResult<U>>;
443
446
  fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
444
447
  fetchFiles(uri: string | URL, options?: Aria2Options): Promise<string[]>;
445
- updateProgress(name: "request", id: number | string, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
448
+ updateProgress(name: "request", id: NumString, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
446
449
  start(emptyDir?: boolean): Promise<FinalizeResult>;
447
450
  processAssets(emptyDir?: boolean, using?: T[]): void;
448
451
  deleteFile<U extends Promise<void>>(src: string, promises: boolean): U;
@@ -451,12 +454,11 @@ declare namespace functions {
451
454
  deleteFile<U extends NoParamCallback>(src: string, options: DeleteFileOptions & DeleteFileAddendum, callback?: U): unknown;
452
455
  restart(recursive?: boolean | "abort", emptyDir?: boolean): void;
453
456
  restart(recursive?: boolean | "abort", exclusions?: string[], emptyDir?: boolean): void;
454
- finalizeCompress(assets: T[]): Promise<void>;
455
- finalizeDocument(): Promise<void>;
456
- finalizeTask(assets: (T & Required<TaskAction>)[]): Promise<void>;
457
- finalizeCloud(): Promise<void>;
458
- finalizeChecksum(): Promise<void>;
459
- 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>;
460
462
  finalize(): Promise<void>;
461
463
  close(): void;
462
464
  reset(): boolean;
@@ -520,7 +522,7 @@ declare namespace functions {
520
522
  verifyChecksum(root: string, options: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
521
523
  verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
522
524
  createFileThread(host: IFileManager<T>, file: T): IFileThread<T>;
523
- setTimeout(options: ObjectMap<number | string>): void;
525
+ setTimeout(options: ObjectMap<NumString>): void;
524
526
  defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
525
527
  defineHttpConnect(options: HttpConnectSettings): void;
526
528
  readonly prototype: IFileManager<T>;
@@ -540,8 +542,8 @@ declare namespace functions {
540
542
  willLog(name: string): boolean;
541
543
  ignoreLog(values: boolean | ArrayOf<string>): void;
542
544
  collectLog(level?: boolean): LogStatus<StatusType>[];
543
- pauseLog(type?: string): void;
544
- resumeLog(type?: string): void;
545
+ pauseLog(): void;
546
+ resumeLog(): void;
545
547
  hasLog(type: string): boolean;
546
548
  delayMessage(...args: unknown[]): void;
547
549
  willAbort(value: string | IModule): boolean;
@@ -573,7 +575,6 @@ declare namespace functions {
573
575
  getThreadCount(full: true): ThreadCountStat;
574
576
  getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
575
577
  getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
576
- getLogDelayed(): FormatMessageArgs[];
577
578
  getPermissionFromSettings(): IPermission;
578
579
  readonly prototype: IHost;
579
580
  new(config?: HostInitConfig): IHost;
@@ -582,9 +583,10 @@ declare namespace functions {
582
583
  interface IModule<T extends IHost = IHost> extends EventEmitter, IAbortComponent {
583
584
  readonly status: LogStatus<StatusType>[];
584
585
  readonly errors: unknown[];
586
+ /** @deprecated */
585
587
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
586
588
  supports(name: string, value?: boolean): boolean;
587
- getTempDir(options: TempDirOptions): string;
589
+ getTempDir(options: GetTempDirOptions): string;
588
590
  getTempDir(uuidDir: boolean, createDir: boolean): string;
589
591
  getTempDir(pathname: string, createDir: boolean): string;
590
592
  getTempDir(uuidDir: boolean, filename?: string, createDir?: boolean): string;
@@ -592,7 +594,7 @@ declare namespace functions {
592
594
  canRead(uri: string | URL, options?: PermissionOptions): boolean;
593
595
  canWrite(uri: string | URL, options?: PermissionOptions): boolean;
594
596
  readFile(src: string | URL): Undef<Buffer>;
595
- readFile<U extends ReadFileOptions>(src: string | URL, options?: U): Undef<U extends { encoding: string } ? U extends { minStreamSize: number | string } ? Promise<string> : string : U extends { minStreamSize: number | string } ? Promise<Buffer> : Buffer>;
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>;
596
598
  readFile<U extends Buffer>(src: string | URL, promises: true): Promise<Undef<U>>;
597
599
  readFile<U extends Bufferable, V extends ReadFileOptions>(src: string | URL, options: V, promises: true): Promise<Undef<V extends { encoding: string } ? string : U>>;
598
600
  readFile<U extends ReadFileCallback>(src: string | URL, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : Bufferable>;
@@ -667,10 +669,8 @@ declare namespace functions {
667
669
  get sessionId(): string;
668
670
  set broadcastId(value);
669
671
  get broadcastId(): ArrayOf<string>;
670
- set silent(value);
671
- get silent(): boolean;
672
672
  get logType(): LOG_TYPE;
673
- set logLevel(value: number | string);
673
+ set logLevel(value: NumString);
674
674
  get logLevel(): number;
675
675
  get statusType(): STATUS_TYPE;
676
676
  set tempDir(value);
@@ -718,20 +718,17 @@ declare namespace functions {
718
718
  readonly LOG_TYPE: LOG_TYPE;
719
719
  readonly LOG_FORMAT: LoggerFormatSettings<LoggerFormat<number>>;
720
720
  readonly STATUS_TYPE: STATUS_TYPE;
721
- readonly PLATFORM_WIN32: boolean;
722
721
  readonly MAX_TIMEOUT: number;
723
722
  readonly TEMP_DIR: string;
724
- /** @deprecated Types.supported */
725
723
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
726
724
  formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
727
725
  writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
728
726
  enabled(key: string, username?: string): boolean;
729
- parseFunction<U = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U>>;
730
- parseFunction<U = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U>>;
727
+ parseFunction<U = unknown, V = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U, V>>;
728
+ parseFunction<U = unknown, V = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U, V>>;
731
729
  asString(value: unknown, cacheKey?: boolean | "throws"): string;
732
- asHash(data: BinaryLike, options?: AsHashOptions): string;
733
- asHash(data: BinaryLike, algorithm?: string, options?: HashOptions): string;
734
- asHash(data: BinaryLike, algorithm?: string, digest?: BinaryToTextEncoding): string;
730
+ asHash(data: BinaryLike, options: AsHashOptions): string;
731
+ asHash(data: BinaryLike, algorithm?: unknown, digest?: unknown): string;
735
732
  readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
736
733
  toPosix(value: unknown, normalize: boolean): string;
737
734
  toPosix(value: unknown, filename?: string, normalize?: boolean): string;
@@ -747,22 +744,24 @@ declare namespace functions {
747
744
  resolvePath(value: string, base: string | URL): string;
748
745
  joinPath(...values: [...paths: unknown[], normalize: boolean][]): string;
749
746
  joinPath(...values: unknown[]): string;
750
- normalizePath(value: unknown, flags?: boolean | number): string;
747
+ normalizePath(value: unknown, flags?: boolean | NormalizeFlags): string;
751
748
  createDir(value: string | URL, overwrite?: boolean): boolean;
752
749
  removeDir(value: string | URL, sinceCreated: number, recursive?: boolean): boolean;
753
750
  removeDir(value: string | URL, empty?: boolean, recursive?: boolean): boolean;
754
751
  copyDir(src: string | URL, dest: string | URL, move?: boolean, recursive?: boolean): Promise<CopyDirResult>;
755
752
  copyDir(src: string | URL, dest: string | URL, options?: CopyDirOptions): Promise<CopyDirResult>;
753
+ globDir(src: string | URL, pattern: ArrayOf<string>, recursive: boolean | number): Promise<string[]>;
754
+ globDir(src: string | URL, pattern: ArrayOf<string>, options?: GlobDirOptions): Promise<string[]>;
756
755
  renameFile(src: string | URL, dest: string | URL, throws?: boolean): boolean;
757
756
  streamFile<U extends Bufferable>(value: string | URL, cache: boolean): Promise<U>;
758
757
  streamFile<U extends ReadBufferOptions>(value: string | URL, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
759
758
  streamFile<U extends ReadBufferOptions>(value: string | URL, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
760
759
  readText(value: string | URL, cache: boolean): string;
761
- readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<string> : string;
760
+ readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<string> : string;
762
761
  readText(value: string | URL, encoding?: BufferEncoding | ReadTextOptions, cache?: boolean): string;
763
- readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<Null<Buffer>> : Null<Buffer>;
762
+ readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<Null<Buffer>> : Null<Buffer>;
764
763
  readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Null<Buffer>;
765
- resolveMime(data: FileTypeFormat): Promise<Undef<FileTypeResult>>;
764
+ resolveMime(data: string | Buffer | Uint8Array | ArrayBuffer): Promise<Undef<FileTypeResult>>;
766
765
  lookupMime(value: string, extension?: boolean): string;
767
766
  initCpuUsage(instance?: IModule): CpuUsage;
768
767
  getCpuUsage(start: CpuUsage, format: true): string;
@@ -773,9 +772,9 @@ declare namespace functions {
773
772
  getPackageVersion(name: string | TupleOf<string>, startDir: string, baseDir?: string): string;
774
773
  getPackageVersion(name: string | TupleOf<string>, unstable?: boolean, startDir?: string, baseDir?: string): string;
775
774
  checkSemVer(name: string | TupleOf<string>, options: CheckSemVerOptions): boolean;
775
+ checkSemVer(name: string | TupleOf<string>, min: NumString, max?: NumString, unstable?: boolean, startDir?: string): boolean;
776
776
  /** @deprecated options */
777
- checkSemVer(name: string | TupleOf<string>, min: number | string, max?: number | string, unstable?: boolean, startDir?: string): boolean;
778
- 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;
779
778
  sanitizeCmd(value: string): string;
780
779
  sanitizeArgs(value: string, doubleQuote?: boolean): string;
781
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
- export const enum NORMALIZE_FLAGS {
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, ThrowsAction {
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
  }
@@ -100,6 +101,14 @@ export interface CopyDirResult {
100
101
  ignored: string[];
101
102
  }
102
103
 
104
+ export interface GlobDirOptions {
105
+ exclude?: ArrayOf<string>;
106
+ recursive?: boolean | number;
107
+ matchBase?: boolean;
108
+ dot?: boolean;
109
+ contains?: boolean;
110
+ }
111
+
103
112
  export interface StreamBase extends StreamAction {
104
113
  signal?: AbortSignal;
105
114
  }
@@ -113,9 +122,12 @@ export interface ReadBufferOptions extends StreamBase {
113
122
  cache?: boolean;
114
123
  }
115
124
 
116
- export interface AsHashOptions extends HashOptions, ChecksumBase {}
125
+ export interface AsHashOptions extends HashOptions, ChecksumBase {
126
+ /** @deprecated */
127
+ minLength?: number;
128
+ }
117
129
 
118
- export interface TempDirOptions {
130
+ export interface GetTempDirOptions {
119
131
  pathname?: string;
120
132
  filename?: string;
121
133
  moduleDir?: boolean;
@@ -124,7 +136,18 @@ export interface TempDirOptions {
124
136
  increment?: number;
125
137
  }
126
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];
127
150
  export type ReadTextOptions = ReadBufferOptions;
128
151
  export type ReadFileCallback<T extends Bufferable = Bufferable> = (err: Null<NodeJS.ErrnoException>, data?: T) => void;
129
152
  export type ProtocolType = "http" | "https" | "http/s" | "ftp" | "sftp" | "s/ftp" | "torrent" | "unc" | "file";
130
- export type FileTypeFormat = Bufferable | Uint8Array | ArrayBuffer | Readable;
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, HostInitLog } from './core';
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, U extends HostInitLog = HostInitLog> extends Readonly<Omit<IRequestData, "log">>, Readonly<HostInitConfig<U>> {
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
@@ -1,3 +1,5 @@
1
+ /* eslint @typescript-eslint/no-redeclare: "off" */
2
+
1
3
  interface Point {
2
4
  x: number;
3
5
  y: number;
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(values: string[]): void;
51
- defineProtocolNegotiation(data: ObjectMap<string[]>): void;
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,24 +54,24 @@ 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
- method?: "GET" | "POST" | "HEAD";
59
+ method?: HttpMethod | Lowercase<HttpMethod>;
64
60
  search?: StringMap;
65
61
  /** @deprecated followRedirect */
66
62
  follow_redirect?: boolean;
67
63
  followRedirect?: boolean;
68
64
  encoding?: BufferEncoding;
69
- maxBufferSize?: number | string;
65
+ maxBufferSize?: NumString;
70
66
  format?: BufferFormat | { out?: BufferFormat; parser?: PlainObject };
71
- headers?: OutgoingHttpHeaders;
67
+ headers?: OutgoingHttpHeaders | Headers;
68
+ signal?: AbortSignal;
72
69
  timeout?: number;
73
70
  pipeTo?: string | Writable;
74
71
  postData?: unknown;
75
72
  connected?: (headers: IncomingHttpHeaders) => Void<boolean>;
76
73
  statusMessage?: string;
77
- progressId?: number | string;
74
+ progressId?: NumString;
78
75
  outFormat?: { out: BufferFormat; parser?: PlainObject };
79
76
  outFilename?: Null<string>;
80
77
  outHeaders?: Null<IncomingHttpHeaders>;
@@ -82,12 +79,15 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
82
79
  outAbort?: AbortController;
83
80
  }
84
81
 
85
- export interface PostOptions extends OpenOptions {
82
+ export interface PutOptions extends OpenOptions {
86
83
  contentType?: string;
87
- formData?: ArrayOf<FormDataPart>;
88
84
  dataEncoding?: BufferEncoding;
89
85
  }
90
86
 
87
+ export interface PostOptions extends PutOptions {
88
+ formData?: ArrayOf<FormDataPart>;
89
+ }
90
+
91
91
  export interface FormDataPart {
92
92
  name?: string;
93
93
  data?: Buffer | Readable | string;
@@ -98,7 +98,8 @@ export interface FormDataPart {
98
98
 
99
99
  export interface Aria2Options extends BinaryAction, SilentAction {
100
100
  pathname?: string;
101
- headers?: OutgoingHttpHeaders;
101
+ headers?: OutgoingHttpHeaders | Headers;
102
+ signal?: AbortSignal;
102
103
  }
103
104
 
104
105
  export interface HostConfig extends OpenOptions {
@@ -133,6 +134,7 @@ export interface ApplyOptions extends ProtocolAction, PlainObject {
133
134
  keepAlive?: boolean;
134
135
  }
135
136
 
137
+ export type HttpMethod = "GET" | "POST" | "PUT" | "HEAD" | "DELETE";
136
138
  export type BufferFormat = "json" | "yaml" | "json5" | "xml" | "toml";
137
139
  export type ReadExpectType = "always" | "string" | "none";
138
140
  export type DataEncodedResult<T extends { encoding?: BufferEncoding }> = T extends { encoding: BufferEncoding } ? string : Null<Bufferable>;