@e-mc/types 0.10.5 → 0.10.7

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