@e-mc/types 0.10.5 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1,13 +1,10 @@
1
- /* eslint @typescript-eslint/no-explicit-any: "off" */
2
-
3
1
  /// <reference path="type.d.ts" />
4
- /// <reference path="object.d.ts" />
5
2
 
6
- import type { CompressLevel, DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction, ViewEngine } from './squared';
3
+ import type { DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction, ViewEngine } from './squared';
7
4
 
8
5
  import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
9
- import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, UploadAssetOptions } from './cloud';
10
- import type { BufferResult, CompressFormat, TryFileCompressor } from './compress';
6
+ import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, DeleteObjectsOptions, UploadAssetOptions } from './cloud';
7
+ import type { BufferResult, CompressFormat, CompressLevel, ReadableOptions, TryFileCompressor } from './compress';
11
8
  import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
12
9
  import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
13
10
  import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
@@ -15,25 +12,24 @@ import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutp
15
12
  import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
16
13
  import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
17
14
  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';
19
- import type { RequestData, Settings } from './node';
20
- import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, PutOptions, ReadExpectType, RequestInit, StatusOnCallback } from './request';
15
+ 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';
16
+ import type { HighResolutionTime, RequestData, Settings } from './node';
17
+ import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, IHttpAdapter, OpenOptions, PostOptions, ProxySettings, PutOptions, ReadExpectType, RequestInit, StatusOnCallback } from './request';
21
18
  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';
22
19
  import type { Command, SpawnResult } from './task';
23
20
  import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
24
21
 
25
- import type { SpawnOptions } from 'child_process';
26
- import type { BinaryLike } from 'crypto';
27
- import type { NoParamCallback, WriteStream } from 'fs';
28
- import type { ClientRequest, OutgoingHttpHeaders } from 'http';
29
- import type { LookupFunction } from 'net';
30
- import type { Readable, Writable } from 'stream';
31
- import type { SecureContextOptions } from 'tls';
32
- import type { BrotliCompress, Gzip } from 'zlib';
33
- // @ts-ignore
22
+ import type { SpawnOptions } from 'node:child_process';
23
+ import type { BinaryLike, BinaryToTextEncoding, HashOptions } from 'node:crypto';
24
+ import type { NoParamCallback, WriteStream } from 'node:fs';
25
+ import type { ClientRequest, OutgoingHttpHeaders } from 'node:http';
26
+ import type { LookupFunction } from 'node:net';
27
+ import type { Readable, Writable } from 'node:stream';
28
+ import type { SecureContextOptions } from 'node:tls';
29
+ import type { BrotliCompress, Gzip } from 'node:zlib';
34
30
  import type { FileTypeResult } from 'file-type';
35
31
 
36
- import type * as EventEmitter from 'events';
32
+ import type * as EventEmitter from 'node:events';
37
33
  // @ts-ignore
38
34
  import type * as ws from 'ws';
39
35
 
@@ -42,6 +38,7 @@ type CpuUsage = NodeJS.CpuUsage;
42
38
 
43
39
  declare namespace functions {
44
40
  type WatchInstance<T extends ExternalAsset, U extends WatchModule = WatchModule> = IWatch<IFileManager<T>, T, U, ModifiedPostFinalizeListener<T>>;
41
+ type FormatMessageArgs = [type: LogType, title: string, value: LogValue, message: unknown, options: LogMessageOptions];
45
42
 
46
43
  interface IScopeOrigin<T extends IHost = IHost, U extends IModule = IModule> {
47
44
  host?: T;
@@ -59,13 +56,12 @@ declare namespace functions {
59
56
  get extensions(): T[];
60
57
  }
61
58
 
62
- interface ICompress<T extends CompressModule<U>, U extends CompressSettings = CompressSettings> extends IModule, IExternalConfig<T, U> {
59
+ interface ICompress<T extends CompressModule = CompressModule, U extends CompressSettings = CompressSettings> extends IModule, IExternalConfig<T, U> {
63
60
  level: ObjectMap<number>;
64
61
  compressors: ObjectMap<TryFileCompressor>;
65
- chunkSize?: number;
66
62
  register(format: string, callback: TryFileCompressor): void;
67
- getLevel(value: string, fallback?: number): Undef<number>;
68
- getReadable(file: string | URL | Buffer): Readable;
63
+ getLevel(value: string, fallback?: number): number | undefined;
64
+ getReadable(file: string | URL | Buffer, options?: ReadableOptions): Readable;
69
65
  createGzip(file: string | Buffer, options?: CompressLevel): Gzip;
70
66
  createBrotliCompress(file: string | Buffer, options?: CompressLevel): BrotliCompress;
71
67
  createWriteStreamAsGzip(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
@@ -76,38 +72,42 @@ declare namespace functions {
76
72
  tryFile(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
77
73
  tryImage(file: string, options: CompressFormat): Promise<BufferResult>;
78
74
  tryImage(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
75
+ set chunkSize(value: number | string | undefined);
76
+ get chunkSize(): number | undefined;
79
77
  }
80
78
 
81
- interface CompressConstructor<T extends CompressModule<U> = CompressModule<any>, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
82
- singleton(): ICompress<CompressModule>;
79
+ interface CompressConstructor<T extends CompressModule = CompressModule, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
80
+ singleton(): ICompress<T, U>;
83
81
  readonly prototype: ICompress<T, U>;
84
82
  new(module?: U): ICompress<T, U>;
85
83
  }
86
84
 
87
85
  interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule> extends IClient<T, U> {
88
- resizeData?: ResizeData;
89
- cropData?: CropData;
90
- rotateData?: RotateData;
91
- qualityData?: QualityData;
92
- methodData?: [string, unknown[]?][];
86
+ resizeData?: ResizeData | null;
87
+ cropData?: CropData | null;
88
+ rotateData?: RotateData | null;
89
+ qualityData?: QualityData | null;
90
+ methodData?: [string, unknown[]?][] | null;
93
91
  opacityValue?: number;
94
92
  outputType?: string;
95
93
  setCommand(value: string | CommandData, outputAs?: string): void;
96
94
  getCommand(): string;
97
95
  parseCommand(value: string): CommandData;
98
- parseMethod(value: string): Undef<[string, unknown[]?][]>;
99
- parseResize(value: string): Undef<ResizeData>;
100
- parseCrop(value: string): Undef<CropData>;
101
- parseRotate(value: string): Undef<RotateData>;
102
- parseQuality(value: string): Undef<QualityData>;
96
+ parseMethod(value: string): Optional<[string, unknown[]?][]>;
97
+ parseResize(value: string): Optional<ResizeData>;
98
+ parseCrop(value: string): Optional<CropData>;
99
+ parseRotate(value: string): Optional<RotateData>;
100
+ parseQuality(value: string): Optional<QualityData>;
103
101
  parseOpacity(value: string): number;
104
102
  using?<V extends ExternalAsset>(data: IFileThread<V>, command: string): Promise<unknown>;
105
103
  get outputAs(): string;
104
+ set host(value);
105
+ get host(): T | null;
106
106
  }
107
107
 
108
108
  interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
109
109
  readonly REGEXP_SIZERANGE: RegExp;
110
- transform<V extends TransformOptions>(file: string, command: string, options?: V): Promise<V extends { tempFile: true } ? string : Null<Buffer>>;
110
+ transform<V extends TransformOptions>(file: string, command: string, options?: V): Promise<V extends { tempFile: true } ? string : Buffer | null>;
111
111
  clamp(value: unknown, min?: number, max?: number): number;
112
112
  isBinary(mime: unknown): mime is string;
113
113
  toABGR(buffer: Uint8Array | Buffer): Buffer;
@@ -118,11 +118,13 @@ declare namespace functions {
118
118
  interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule> extends IClient<T, U> {
119
119
  using?<V extends ExternalAsset>(data: IFileThread<V>): Promise<unknown>;
120
120
  collect?(items: unknown[], preceding?: boolean): Promise<SpawnResult>[];
121
- map?(tasks: Command[]): Promise<Void<SpawnResult>>[];
121
+ map?(tasks: Command[]): Promise<SpawnResult | void>[];
122
122
  series?(tasks: Command[]): Promise<unknown>;
123
123
  parallel?(tasks: Command[]): Promise<unknown>;
124
124
  spawn?(task: PlainObject, callback: (result?: SpawnResult) => void): void;
125
125
  execute?<V extends IFileManager<W>, W extends ExternalAsset>(manager: V, task: PlainObject, callback: (value?: unknown) => void): void;
126
+ set host(value);
127
+ get host(): T | null;
126
128
  }
127
129
 
128
130
  interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ModuleConstructor {
@@ -133,7 +135,7 @@ declare namespace functions {
133
135
 
134
136
  interface IDb<T extends IHost = IHost, U extends DbModule = DbModule, V extends DbDataSource = DbDataSource, W extends DbSourceOptions = DbSourceOptions, X extends DbCoerceSettings = DbCoerceSettings> extends IClientDb<T, U, V, W, X> {
135
137
  setCredential(item: V): Promise<void>;
136
- getCredential<Y = PlainObject>(item: V): Undef<Y>;
138
+ getCredential<Y = PlainObject>(item: V): Y | undefined;
137
139
  hasSource(source: string, ...type: number[]): boolean;
138
140
  applyCommand(...items: V[]): void;
139
141
  executeQuery(item: V, callback: ErrorQueryCallback): Promise<QueryResult>;
@@ -142,8 +144,8 @@ declare namespace functions {
142
144
  executeBatchQuery(batch: V[], callback: ErrorQueryCallback, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
143
145
  executeBatchQuery(batch: V[], sessionKey: string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
144
146
  executeBatchQuery(batch: V[], options?: ExecuteBatchQueryOptions | string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
145
- processRows(batch: V[], tasks: Promise<Null<QueryResult>>[], parallel: boolean): Promise<BatchQueryResult>;
146
- processRows(batch: V[], tasks: Promise<Null<QueryResult>>[], options?: ProcessRowsOptions, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
147
+ processRows(batch: V[], tasks: Promise<QueryResult | null>[], parallel: boolean): Promise<BatchQueryResult>;
148
+ processRows(batch: V[], tasks: Promise<QueryResult | null>[], options?: ProcessRowsOptions, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
147
149
  handleFail(err: unknown, item: V, options?: HandleFailOptions): boolean;
148
150
  readTLSCert(value: unknown, cache?: boolean): string;
149
151
  readTLSConfig(options: SecureContextOptions, cache?: boolean): void;
@@ -151,14 +153,16 @@ declare namespace functions {
151
153
  settingsOf(source: string, name: "coerce", component: keyof X): unknown;
152
154
  settingsKey(source: string, name: keyof Omit<W, "coerce">): unknown;
153
155
  settingsKey(source: string, name: "coerce", component: keyof X): unknown;
154
- getPoolConfig(source: string, uuidKey?: string): Undef<Required<PoolConfig>>;
156
+ getPoolConfig(source: string, uuidKey?: string): Required<PoolConfig> | undefined;
155
157
  get sourceType(): DB_TYPE;
156
158
  get commandType(): SQL_COMMAND;
159
+ set host(value);
160
+ get host(): T | null;
157
161
  }
158
162
 
159
163
  interface DbConstructor<T extends IHost = IHost, U extends DbModule = DbModule, V extends DbDataSource = DbDataSource> extends ClientDbConstructor<T> {
160
164
  setPoolConfig(value: ObjectMap<PoolConfig>): void;
161
- getPoolConfig(source: string): Undef<Required<PoolConfig>>;
165
+ getPoolConfig(source: string): Required<PoolConfig> | undefined;
162
166
  readonly prototype: IDb<T, U, V>;
163
167
  new(module?: U, database?: V[], ...args: unknown[]): IDb<T, U, V>;
164
168
  }
@@ -171,10 +175,11 @@ declare namespace functions {
171
175
  setBucketPolicy(service: string, credential: unknown, bucket: string, options: unknown): Promise<boolean>;
172
176
  setBucketTagging(service: string, credential: unknown, bucket: string, options: unknown): Promise<boolean>;
173
177
  setBucketWebsite(service: string, credential: unknown, bucket: string, options: BucketWebsiteOptions): Promise<boolean>;
174
- deleteObjects(service: string, credential: unknown, bucket: string, recursive?: boolean): Promise<void>;
175
- uploadObject(service: string, credential: unknown, bucket: string, upload: CloudStorageUpload, localUri: string, beforeResolve?: (value: string) => Void<Promise<void>>): Promise<string>;
176
- downloadObject(service: string, credential: unknown, bucket: string, download: CloudStorageDownload, beforeResolve?: (value: Null<Bufferable>) => Void<Promise<Undef<string>>>): Promise<Bufferable>;
177
- getStorage(action: CloudFunctions, data: Undef<CloudStorage[]>): Undef<CloudStorage>;
178
+ deleteObjects(service: string, credential: unknown, bucket: string, options: DeleteObjectsOptions): Promise<void>;
179
+ deleteObjects(service: string, credential: unknown, bucket: string, recursive?: boolean | DeleteObjectsOptions): Promise<void>;
180
+ uploadObject(service: string, credential: unknown, bucket: string, upload: CloudStorageUpload, localUri: string, beforeResolve?: ((value: string) => Promise<void> | void)): Promise<string>;
181
+ downloadObject(service: string, credential: unknown, bucket: string, download: CloudStorageDownload, beforeResolve?: ((value: Bufferable | null) => Promise<string | undefined> | void)): Promise<Bufferable>;
182
+ getStorage(action: CloudFunctions, data: CloudStorage[] | undefined): CloudStorage | undefined;
178
183
  hasStorage(action: CloudFunctions, storage: CloudStorage): CloudStorageUpload | false;
179
184
  getDatabaseRows(item: V, ignoreErrors: boolean, sessionKey?: string): Promise<QueryResult>;
180
185
  getDatabaseRows(item: V, sessionKey?: string): Promise<QueryResult>;
@@ -182,13 +187,15 @@ declare namespace functions {
182
187
  getDatabaseBatchRows(batch: V[], sessionKey?: string): Promise<BatchQueryResult>;
183
188
  hasCredential(feature: CloudFeatures, data: CloudService, credential?: unknown): boolean;
184
189
  getCredential(item: CloudService, unused?: boolean): PlainObject;
185
- getSettings(service: string): Undef<AnyObject>;
190
+ getSettings(service: string): AnyObject | undefined;
186
191
  settingsOf(service: string, name: "cache"): unknown;
187
192
  settingsOf(service: string, name: "coerce", component: keyof DbCoerceSettings): unknown;
188
193
  settingsOf(service: string, name: "auth", component: keyof CloudAuthSettings): unknown;
189
194
  getUploadHandler(service: string, credential: unknown): FunctionType<void>;
190
195
  getDownloadHandler(service: string, credential: unknown): FunctionType<void>;
191
196
  resolveService(service: string, folder?: string): string;
197
+ set host(value);
198
+ get host(): T | null;
192
199
  }
193
200
 
194
201
  interface CloudConstructor<T extends IHost = IHost, U extends CloudModule = CloudModule, V extends CloudDatabase = CloudDatabase> extends ClientDbConstructor<T> {
@@ -199,17 +206,17 @@ declare namespace functions {
199
206
  LOG_CLOUD_DOWNLOAD: LogMessageOptions;
200
207
  LOG_CLOUD_DELETE: LogMessageOptions;
201
208
  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>[];
209
+ finalize(this: T, instance: ICloud<T, U, V>): Promise<void>;
210
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, options: UploadAssetOptions): Promise<void>[];
211
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, ignoreProcess: boolean): Promise<void>[];
212
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, contentType?: string | boolean | UploadAssetOptions, ignoreProcess?: boolean): Promise<void>[];
206
213
  sanitizeAssets<W extends ExternalAsset>(assets: W[]): W[];
207
214
  readonly prototype: ICloud<T, U, V>;
208
215
  new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
209
216
  }
210
217
 
211
218
  interface IDocument<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends IClient<T, V, TransformCallback<T, U>> {
212
- Db: Null<IDb>;
219
+ Db: IDb | null;
213
220
  assets: U[];
214
221
  config: StandardMap;
215
222
  init(assets: U[], config?: HostInitConfig): this;
@@ -218,40 +225,42 @@ declare namespace functions {
218
225
  loadConfig(data: object, name: string): Optional<ConfigOrTransformer>;
219
226
  asSourceFile(value: string, cache: boolean): unknown;
220
227
  asSourceFile(value: string, options?: AsSourceFileOptions): unknown;
221
- findVersion(name: ArrayOf<string>, fallback?: string): string;
228
+ findVersion(name: string | string[], fallback?: string): string;
222
229
  findSourceScope(uri: string, imports: AnyObject): StringMap[];
223
- findSourceRoot(uri: string, imports?: StringMap): Undef<string>;
224
- resolveDir(name: string, ...paths: string[]): Undef<string>;
225
- locateSourceFiles(file: U, code?: string, bundleContent?: string[]): (imports?: StringMap) => Undef<SourceInput>;
226
- resolveSourceFile(file: U): (code?: string, imports?: StringMap) => Undef<SourceInput<string>>;
230
+ findSourceRoot(uri: string, imports?: StringMap): string | undefined;
231
+ resolveDir(name: string, ...paths: string[]): string | undefined;
232
+ locateSourceFiles(file: U, code?: string, bundleContent?: string[]): (imports?: StringMap) => SourceInput | undefined;
233
+ resolveSourceFile(file: U): (code?: string, imports?: StringMap) => SourceInput<string> | undefined;
227
234
  tryParse(source: string, format: string, options?: PlainObject): unknown;
228
235
  forDb(item: DataSource): boolean;
229
236
  hasEval(name: string): boolean;
230
237
  settingsOf(name: keyof W, option: keyof X): unknown;
231
- parseTemplate(viewEngine: ViewEngine | string, template: string, data: unknown[]): Promise<Null<string>>;
232
- transform(type: string, code: string, format: ArrayOf<string>, options?: TransformOutput & TransformAction): Promise<Void<TransformResult>>;
238
+ parseTemplate(viewEngine: ViewEngine | string, template: string, data: unknown[]): Promise<string | null>;
239
+ transform(type: string, code: string, format: string | string[], options?: TransformOutput & TransformAction): Promise<TransformResult | void>;
233
240
  abort(err: Error): void;
234
241
  abort(name?: keyof W, reason?: unknown): void;
235
242
  restart(): void;
236
243
  using?(data: IFileThread<U>): Promise<unknown>;
237
244
  setLocalUri?(file: U, replace?: boolean): void;
238
245
  resolveUri?(file: U, source: string): string;
239
- resolveUri?(file: U, source: string, trailing: string): TupleOf<string>;
240
- resolveImports?(file: U, code: string, baseFile?: string | U): Undef<string>;
241
- replaceContent?(source: string, statement: RegExpExecArray | string, mimeType?: string): Undef<string>;
242
- addCopy?(data: FileCommand<U>, saveAs: string, replace?: boolean): Undef<string>;
246
+ resolveUri?(file: U, source: string, trailing: string): [string, string];
247
+ resolveImports?(file: U, code: string, baseFile?: string | U): string | undefined;
248
+ replaceContent?(source: string, statement: RegExpExecArray | string, mimeType?: string): string | undefined;
249
+ addCopy?(data: FileCommand<U>, saveAs: string, replace?: boolean): string | undefined;
243
250
  writeImage?(output: OutputFinalize<U>): boolean;
244
251
  cloudInit?(state: IScopeOrigin<T, Y>): void;
245
252
  cloudObject?(state: IScopeOrigin<T, Y>, file: U): boolean;
246
253
  cloudUpload?(state: IScopeOrigin<T, Y>, file: U, url: string, active: boolean): Promise<boolean>;
247
254
  cloudFinalize?(state: IScopeOrigin<T, Y>): Promise<unknown[]>;
248
- watchInit?(watch: IFileGroup<U>, assets: U[], sanitize?: boolean): Undef<WatchInitResult>;
255
+ watchInit?(watch: IFileGroup<U>, assets: U[], sanitize?: boolean): WatchInitResult | undefined;
249
256
  watchModified?(watch: IFileGroup<U>, assets?: U[]): PostFinalizeCallback;
250
257
  set dataSource(value: DataSource[]);
251
258
  get dataSource(): DataSource[];
252
259
  set imports(value);
253
260
  get imports(): StringMap;
254
261
  get watching(): boolean;
262
+ set host(value);
263
+ get host(): T | null;
255
264
  }
256
265
 
257
266
  interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends ModuleConstructor {
@@ -260,12 +269,12 @@ declare namespace functions {
260
269
  createSourceMap(code: string, remove: boolean): SourceMap;
261
270
  /** @deprecated */
262
271
  createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
263
- writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): Undef<string>;
272
+ writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): string | undefined;
264
273
  updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
265
274
  updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
266
275
  generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
267
276
  cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
268
- sanitizeAssets?(assets: U[], exclusions?: U[]): U[];
277
+ sanitizeAssets?(assets: U[], exclusions?: unknown[]): U[];
269
278
  readonly prototype: IDocument<T, U, V, W, X, Y>;
270
279
  new(module?: V, ...args: unknown[]): IDocument<T, U, V, W, X, Y>;
271
280
  }
@@ -273,8 +282,8 @@ declare namespace functions {
273
282
  interface IWatch<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends IClient<T, V, W> {
274
283
  connectTimeout: number;
275
284
  init(config?: HostInitConfig): this;
276
- start(assets: U[], permission?: Null<IPermission>): void;
277
- modified(watch: IFileGroup<U>): Promise<Void<FinalizeResult>>;
285
+ start(assets: U[], permission?: IPermission | null): void;
286
+ modified(watch: IFileGroup<U>): Promise<FinalizeResult | void>;
278
287
  configureServer(options: SecureOptions): boolean;
279
288
  setCA(value: string): boolean;
280
289
  setSSLKey(value: string): boolean;
@@ -290,42 +299,45 @@ declare namespace functions {
290
299
  get port(): number;
291
300
  set securePort(value);
292
301
  get securePort(): number;
302
+ set host(value);
303
+ get host(): T | null;
293
304
  }
294
305
 
295
306
  interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ModuleConstructor {
296
- createServer(port: number, active: boolean): Null<ws.Server>;
297
- createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
307
+ createServer(port: number, active: boolean): ws.Server | null;
308
+ createServer(port: number, secure?: SecureOptions | null, active?: boolean): ws.Server | null;
298
309
  shutdown(): void;
299
- setTimeout(value: NumString): void;
310
+ setTimeout(value: number | string): void;
300
311
  checkTimeout(client: ws): boolean;
312
+ isConnectionError(err: unknown): boolean;
301
313
  readonly prototype: IWatch<T, U, V, W>;
302
314
  new(module?: V): IWatch<T, U, V, W>;
303
315
  new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
304
316
  }
305
317
 
306
- interface IRequest<T extends RequestModule<U>, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
318
+ interface IRequest<T extends RequestModule = RequestModule, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
307
319
  startTime: number;
308
320
  acceptEncoding: boolean;
309
- keepAlive: Null<boolean>;
321
+ keepAlive: boolean | null;
310
322
  readTimeout: number;
311
323
  readExpect: ReadExpectType;
312
- proxy: Null<ProxySettings>;
324
+ proxy: ProxySettings | null;
313
325
  init(config?: RequestInit): this;
314
326
  apply(options: ApplyOptions): this;
315
327
  addDns(hostname: string, address: string, timeout: number): void;
316
- addDns(hostname: string, address: string, family?: NumString, timeout?: number): void;
328
+ addDns(hostname: string, address: string, family?: number | string, timeout?: number): void;
317
329
  lookupDns(hostname: string): LookupFunction;
318
- proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
319
- statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
320
- statusOn(name: ArrayOf<number>, globUrl: string, callback: StatusOnCallback): void;
321
- headersOn(name: ArrayOf<string>, callback: HeadersOnCallback): void;
322
- headersOn(name: ArrayOf<string>, globUrl: string, callback: HeadersOnCallback): void;
323
- headersOf(uri: string): Undef<OutgoingHttpHeaders>;
330
+ proxyOf(uri: string, localhost?: boolean): ProxySettings | undefined;
331
+ statusOn(name: number | number[], callback: StatusOnCallback): void;
332
+ statusOn(name: number | number[], globUrl: string, callback: StatusOnCallback): void;
333
+ headersOn(name: string | string[], callback: HeadersOnCallback): void;
334
+ headersOn(name: string | string[], globUrl: string, callback: HeadersOnCallback): void;
335
+ headersOf(uri: string): OutgoingHttpHeaders | undefined;
324
336
  aria2c(uri: string | URL, pathname: string): Promise<string[]>;
325
337
  aria2c(uri: string | URL, options?: Aria2Options): Promise<string[]>;
326
- json(uri: string | URL, options?: OpenOptions): Promise<Null<object>>;
338
+ json(uri: string | URL, options?: OpenOptions): Promise<object | null>;
327
339
  pipe(uri: string | URL, to: Writable, options?: OpenOptions): Promise<null>;
328
- opts(url: string | URL, options?: OpenOptions): HostConfig;
340
+ opts<V extends OpenOptions>(url: string | URL, options?: V): HostConfig & V;
329
341
  open(uri: string | URL, options: OpenOptions): HttpRequestClient;
330
342
  head(uri: string | URL, options?: OpenOptions): ClientRequest;
331
343
  put<V extends { format: undefined; encoding: undefined }>(uri: string | URL, data: unknown, contentType: string): Promise<DataObjectResult<V>>;
@@ -336,25 +348,28 @@ declare namespace functions {
336
348
  post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, form: AnyObject, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
337
349
  post<V extends PostOptions>(uri: string | URL, data: unknown, options: V): Promise<DataObjectResult<V>>;
338
350
  post<V extends PostOptions>(uri: string | URL, data: unknown, contentType?: string | FormDataPart[] | V, options?: V): Promise<DataObjectResult<V>>;
339
- get<V extends OpenOptions, W extends V | BufferFormat>(uri: string | URL, options?: W): Promise<W extends BufferFormat ? Null<object> : DataEncodedResult<V>>;
351
+ get<V extends OpenOptions, W extends V | BufferFormat>(uri: string | URL, options?: W): Promise<W extends BufferFormat ? object | null : DataEncodedResult<V>>;
340
352
  detach(singleton?: boolean): void;
341
- reset(): void;
353
+ reset(adapter?: IHttpAdapter): void;
342
354
  close(): void;
355
+ set adapter(value: unknown);
343
356
  set agentTimeout(value);
344
357
  get agentTimeout(): number;
345
358
  set httpVersion(value);
346
- get httpVersion(): Null<HttpProtocolVersion>;
359
+ get httpVersion(): HttpProtocolVersion | null;
347
360
  set ipVersion(value);
348
361
  get ipVersion(): InternetProtocolVersion;
349
362
  }
350
363
 
351
- interface RequestConstructor<T extends RequestModule<U> = RequestModule<any>, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
364
+ interface RequestConstructor<T extends RequestModule = RequestModule, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
352
365
  readCACert(value: string, cache?: boolean): string;
353
366
  readTLSKey(value: string, cache?: boolean): string;
354
367
  readTLSCert(value: string, cache?: boolean): string;
355
368
  isCert(value: string): boolean;
369
+ /** @deprecated */
356
370
  fromURL(url: URL, value: string): string;
357
- fromStatusCode(value: NumString): string;
371
+ /** @deprecated */
372
+ fromStatusCode(value: number | string): string;
358
373
  defineHttpAgent(options: HttpAgentSettings): void;
359
374
  defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
360
375
  getAria2Path(): string;
@@ -364,17 +379,15 @@ declare namespace functions {
364
379
 
365
380
  interface IFileManager<T extends ExternalAsset = ExternalAsset> extends IHost, Set<string> {
366
381
  processTimeout: number;
367
- cacheToDisk: IHttpDiskCache<T>;
368
- cacheToMemory: IHttpMemoryCache<T>;
369
- Request: IRequest<RequestModule>;
382
+ Request: IRequest;
370
383
  Document: InstallData<IDocument<IFileManager<T>, T>, DocumentConstructor<IFileManager<T>, T>>[];
371
384
  Task: InstallData<ITask, TaskConstructor>[];
372
- Image: Null<ImageMimeMap>;
373
- Cloud: Null<ICloud>;
374
- Watch: Null<WatchInstance<T>>;
375
- Compress: Null<ICompress<CompressModule>>;
385
+ Image: ImageMimeMap | null;
386
+ Cloud: ICloud | null;
387
+ Watch: WatchInstance<T> | null;
388
+ Compress: ICompress | null;
376
389
  readonly documentAssets: T[];
377
- readonly taskAssets: (T & Required<TaskAction>)[];
390
+ readonly taskAssets: Array<T & Required<TaskAction>>;
378
391
  readonly dataSourceItems: DataSource[];
379
392
  readonly files: Set<string>;
380
393
  readonly filesQueued: Set<string>;
@@ -386,39 +399,43 @@ declare namespace functions {
386
399
  readonly fetchedAssets: T[];
387
400
  readonly copiedAssets: T[];
388
401
  readonly emptyDir: Set<string>;
389
- install(name: "document", handler: string, module?: DocumentModule, ...args: unknown[]): Undef<IDocument<IFileManager<T>, T>>;
390
- install(name: "document", target: DocumentConstructor<IFileManager<T>, T>, module?: DocumentModule, ...args: unknown[]): Undef<IDocument<IFileManager<T>, T>>;
391
- install(name: "task", handler: string, module?: TaskModule, ...args: unknown[]): Undef<ITask>;
392
- install(name: "task", target: TaskConstructor, module?: TaskModule, ...args: unknown[]): Undef<ITask>;
393
- install(name: "cloud", handler: string, module?: CloudModule, ...args: unknown[]): Undef<ICloud>;
394
- install(name: "cloud", module?: CloudModule): Undef<ICloud>;
395
- install(name: "image", handler: string, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
396
- install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
402
+ readonly cacheToDisk: IHttpDiskCache<T>;
403
+ readonly cacheToMemory: IHttpMemoryCache<T>;
404
+ install(name: "document", handler: string, module?: DocumentModule, ...args: unknown[]): IDocument<IFileManager<T>, T> | undefined;
405
+ install(name: "document", target: DocumentConstructor<IFileManager<T>, T>, module?: DocumentModule, ...args: unknown[]): IDocument<IFileManager<T>, T> | undefined;
406
+ install(name: "task", handler: string, module?: TaskModule, ...args: unknown[]): ITask | undefined;
407
+ install(name: "task", target: TaskConstructor, module?: TaskModule, ...args: unknown[]): ITask | undefined;
408
+ install(name: "cloud", handler: string, module?: CloudModule, ...args: unknown[]): ICloud | undefined;
409
+ install(name: "cloud", module?: CloudModule): ICloud | undefined;
410
+ install(name: "image", handler: string, module?: ImageModule, ...args: unknown[]): IImage | undefined;
411
+ install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): IImage | undefined;
397
412
  install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
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>>;
401
- install(name: string, ...args: unknown[]): Undef<IModule>;
413
+ install(name: "watch", handler: string, module?: WatchModule, ...args: unknown[]): WatchInstance<T> | undefined;
414
+ install(name: "watch", target: WatchConstructor<IFileManager<T>, T>, module?: WatchModule, ...args: unknown[]): WatchInstance<T> | undefined;
415
+ install(name: "watch", module: WatchModule): WatchInstance<T> | undefined;
416
+ install(name: "compress", module?: CompressModule): ICompress | undefined;
417
+ install(name: string, ...args: unknown[]): IModule | undefined;
402
418
  using(...items: FirstOf<T>): this;
403
419
  contains(item: T, condition?: FunctionArgs<[T], boolean>): boolean;
404
420
  removeCwd(value: unknown): string;
405
- findAsset(value: string | URL, instance?: IModule | FindAssetOptions<T>): Undef<T>;
421
+ findAsset(value: string | URL, instance?: IModule | FindAssetOptions<T>): T | undefined;
406
422
  removeAsset(file: T): boolean;
407
- replace(file: T, replaceWith: string, mimeType: Undef<string>): boolean;
423
+ replace(file: T, replaceWith: string, mimeType: string | undefined): boolean;
408
424
  replace(file: T, replaceWith: string, options?: ReplaceOptions): boolean;
409
425
  rename(file: T, value: string): boolean;
410
426
  performAsyncTask(): void;
411
427
  removeAsyncTask(): void;
412
428
  completeAsyncTask(err?: unknown, uri?: string, parent?: T, type?: number): void;
413
429
  performFinalize(override?: boolean): void;
414
- hasDocument(instance: IModule, document: Undef<ArrayOf<string>>): boolean;
430
+ hasDocument(instance: IModule, document: string | string[] | undefined): boolean;
415
431
  getDocumentAssets(instance: IModule, condition?: FunctionArgs<[T], boolean>): T[];
416
432
  getDataSourceItems(instance: IModule, condition?: FunctionArgs<[DataSource], boolean>): DataSource[];
433
+ checkFilename(file: T, pathname?: string): string;
417
434
  setLocalUri(file: T, replace?: boolean): FileOutput;
418
435
  getLocalUri(data: FileData<T>): string;
419
436
  getMimeType(data: FileData<T>): string;
420
437
  openThread(instance: IModule, data: IFileThread<T>, timeout?: number): boolean;
421
- closeThread(instance: Null<IModule>, data: IFileThread<T>, callback?: FunctionType<void>): boolean;
438
+ closeThread(instance: IModule | null, data: IFileThread<T>, callback?: FunctionType<void>): boolean;
422
439
  addProcessTimeout(instance: IModule, file: T, timeout: number): void;
423
440
  removeProcessTimeout(instance: IModule, file: T): void;
424
441
  getProcessTimeout(handler: InstallData): number;
@@ -428,24 +445,24 @@ declare namespace functions {
428
445
  setTaskLimit(value: number): void;
429
446
  addDownload(value: number | Bufferable, encoding: BufferEncoding): number;
430
447
  addDownload(value: number | Bufferable, type?: number | BufferEncoding, encoding?: BufferEncoding): number;
431
- getDownload(type?: number): TupleOf<number>;
448
+ getDownload(type?: number): [number, number];
432
449
  transformAsset(data: IFileThread<T>, parent?: T, override?: boolean): Promise<boolean>;
433
- addCopy(data: FileCommand<T>, saveAs?: string, replace?: boolean): Undef<string>;
450
+ addCopy(data: FileCommand<T>, saveAs?: string, replace?: boolean): string | undefined;
434
451
  findMime(file: T, rename?: boolean): Promise<string>;
435
452
  getUTF8String(file: T, uri?: string): string;
436
- getBuffer<U>(file: T, minStreamSize?: U): U extends number ? Promise<Null<Buffer>> : Null<Buffer>;
453
+ getBuffer<U>(file: T, minStreamSize?: U): U extends number ? Promise<Buffer | null> : Buffer | null;
437
454
  getCacheDir(url: string | URL, createDir?: boolean): string;
438
455
  setAssetContent(file: T, content: string, options?: AssetContentOptions): string;
439
- getAssetContent(file: T, content?: string): Undef<string>;
440
- writeBuffer(file: T, options?: WriteFileOptions): Null<Buffer>;
441
- writeImage(document: ArrayOf<string>, output: OutputFinalize<T>): boolean;
456
+ getAssetContent(file: T, content?: string): string | undefined;
457
+ writeBuffer(file: T, options?: WriteFileOptions): Buffer | null;
458
+ writeImage(document: string | string[], output: OutputFinalize<T>): boolean;
442
459
  compressFile(file: T, overwrite?: boolean): Promise<unknown>;
443
- fetchObject(uri: string | URL, format: BufferFormat): Promise<Null<object>>;
444
- fetchObject(uri: string | URL, options?: OpenOptions | BufferFormat): Promise<Null<object>>;
460
+ fetchObject(uri: string | URL, format: BufferFormat): Promise<object | null>;
461
+ fetchObject(uri: string | URL, options?: OpenOptions | BufferFormat): Promise<object | null>;
445
462
  fetchBuffer<U extends OpenOptions>(uri: string | URL, options?: U): Promise<DataEncodedResult<U>>;
446
463
  fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
447
464
  fetchFiles(uri: string | URL, options?: Aria2Options): Promise<string[]>;
448
- updateProgress(name: "request", id: NumString, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
465
+ updateProgress(name: "request", id: number | string, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
449
466
  start(emptyDir?: boolean): Promise<FinalizeResult>;
450
467
  processAssets(emptyDir?: boolean, using?: T[]): void;
451
468
  deleteFile<U extends Promise<void>>(src: string, promises: boolean): U;
@@ -454,11 +471,12 @@ declare namespace functions {
454
471
  deleteFile<U extends NoParamCallback>(src: string, options: DeleteFileOptions & DeleteFileAddendum, callback?: U): unknown;
455
472
  restart(recursive?: boolean | "abort", emptyDir?: boolean): void;
456
473
  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>;
474
+ finalizeCompress(assets: T[]): Promise<void>;
475
+ finalizeDocument(): Promise<void>;
476
+ finalizeTask(assets: Array<T & Required<TaskAction>>): Promise<void>;
477
+ finalizeCloud(): Promise<void>;
478
+ finalizeChecksum(): Promise<void>;
479
+ finalizeCleanup(): Promise<void>;
462
480
  finalize(): Promise<void>;
463
481
  close(): void;
464
482
  reset(): boolean;
@@ -518,16 +536,17 @@ declare namespace functions {
518
536
  loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
519
537
  sanitizeAssets(assets: T[], exclusions?: string[]): T[];
520
538
  writeChecksum(root: string, options: ChecksumOptions): Promise<string[]>;
521
- writeChecksum(root: string, to?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<string[]>>;
522
- verifyChecksum(root: string, options: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
523
- verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
539
+ writeChecksum(root: string, to?: string | ChecksumOptions, options?: ChecksumOptions): Promise<string[] | null>;
540
+ verifyChecksum(root: string, options: ChecksumOptions): Promise<[string[], string[], number] | null>;
541
+ verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<[string[], string[], number] | null>;
524
542
  createFileThread(host: IFileManager<T>, file: T): IFileThread<T>;
525
- setTimeout(options: ObjectMap<NumString>): void;
543
+ setTimeout(options: ObjectMap<number | string>): void;
526
544
  defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
527
545
  defineHttpConnect(options: HttpConnectSettings): void;
546
+ defineHttpAdapter(module: unknown): void;
528
547
  readonly prototype: IFileManager<T>;
529
548
  new(baseDirectory: string, config: RequestData<T>, postFinalize?: PostFinalizeCallback): IFileManager<T>;
530
- new(baseDirectory: string, config: RequestData<T>, permission?: Null<IPermission>, postFinalize?: PostFinalizeCallback): IFileManager<T>;
549
+ new(baseDirectory: string, config: RequestData<T>, permission?: IPermission | null, postFinalize?: PostFinalizeCallback): IFileManager<T>;
531
550
  }
532
551
 
533
552
  interface IHost extends IModule {
@@ -537,17 +556,17 @@ declare namespace functions {
537
556
  readonly startTime: number;
538
557
  using(...items: FirstOf<unknown>): this;
539
558
  contains(item: unknown, condition?: FunctionType<boolean, any>): boolean;
540
- find(name: string): Undef<IModule>;
559
+ find(name: string): IModule | undefined;
541
560
  findAll(name: string): IModule[];
542
561
  willLog(name: string): boolean;
543
- ignoreLog(values: boolean | ArrayOf<string>): void;
562
+ ignoreLog(values: boolean | string | string[]): void;
544
563
  collectLog(level?: boolean): LogStatus<StatusType>[];
545
- pauseLog(): void;
546
- resumeLog(): void;
564
+ pauseLog(type?: string): void;
565
+ resumeLog(type?: string): void;
547
566
  hasLog(type: string): boolean;
548
567
  delayMessage(...args: unknown[]): void;
549
568
  willAbort(value: string | IModule): boolean;
550
- loadModule(name: string, ...args: any[]): Null<IModule>;
569
+ loadModule(name: string, ...args: any[]): IModule | null;
551
570
  retain(process: IModule): void;
552
571
  release(process: IModule, log?: boolean): boolean;
553
572
  restart(...args: unknown[]): void;
@@ -558,6 +577,8 @@ declare namespace functions {
558
577
  get host(): null;
559
578
  get config(): Readonly<HostInitConfig>;
560
579
  get username(): string;
580
+ get ipV4(): string;
581
+ get ipV6(): string;
561
582
  set done(value);
562
583
  get done(): boolean;
563
584
  get queued(): boolean;
@@ -571,10 +592,11 @@ declare namespace functions {
571
592
  isPermission(value: unknown): value is IPermission;
572
593
  createPermission(all?: boolean, freeze?: boolean): IPermission;
573
594
  kill(username: string, iv: BinaryLike, all: true): number;
574
- kill(username: string, iv: BinaryLike, pid: ArrayOf<number>): number;
595
+ kill(username: string, iv: BinaryLike, pid: number | number[]): number;
575
596
  getThreadCount(full: true): ThreadCountStat;
576
597
  getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
577
598
  getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
599
+ getLogDelayed(): FormatMessageArgs[];
578
600
  getPermissionFromSettings(): IPermission;
579
601
  readonly prototype: IHost;
580
602
  new(config?: HostInitConfig): IHost;
@@ -583,22 +605,21 @@ declare namespace functions {
583
605
  interface IModule<T extends IHost = IHost> extends EventEmitter, IAbortComponent {
584
606
  readonly status: LogStatus<StatusType>[];
585
607
  readonly errors: unknown[];
586
- /** @deprecated */
587
608
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
588
609
  supports(name: string, value?: boolean): boolean;
589
- getTempDir(options: GetTempDirOptions): string;
610
+ getTempDir(options: TempDirOptions): string;
590
611
  getTempDir(uuidDir: boolean, createDir: boolean): string;
591
612
  getTempDir(pathname: string, createDir: boolean): string;
592
613
  getTempDir(uuidDir: boolean, filename?: string, createDir?: boolean): string;
593
614
  getTempDir(pathname?: string, filename?: string, createDir?: boolean): string;
594
615
  canRead(uri: string | URL, options?: PermissionOptions): boolean;
595
616
  canWrite(uri: string | URL, options?: PermissionOptions): boolean;
596
- 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>;
598
- readFile<U extends Buffer>(src: string | URL, promises: true): Promise<Undef<U>>;
599
- readFile<U extends Bufferable, V extends ReadFileOptions>(src: string | URL, options: V, promises: true): Promise<Undef<V extends { encoding: string } ? string : U>>;
600
- readFile<U extends ReadFileCallback>(src: string | URL, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : Bufferable>;
601
- readFile<U extends ReadFileCallback, V extends ReadFileOptions>(src: string | URL, options: V, callback: U): Undef<V extends { encoding: string } ? string : U extends ReadFileCallback<infer W> ? W : Bufferable>;
617
+ readFile(src: string | URL): Buffer | undefined;
618
+ readFile<U extends ReadFileOptions>(src: string | URL, options?: U): (U extends { encoding: string } ? U extends { minStreamSize: number | string } ? Promise<string> : string : U extends { minStreamSize: number | string } ? Promise<Buffer> : Buffer) | undefined;
619
+ readFile<U extends Buffer>(src: string | URL, promises: true): Promise<U> | undefined;
620
+ readFile<U extends Bufferable, V extends ReadFileOptions>(src: string | URL, options: V, promises: true): Promise<(V extends { encoding: string } ? string : U) | undefined>;
621
+ readFile<U extends ReadFileCallback>(src: string | URL, callback: U): (U extends ReadFileCallback<infer W> ? W : Bufferable) | undefined;
622
+ readFile<U extends ReadFileCallback, V extends ReadFileOptions>(src: string | URL, options: V, callback: U): (V extends { encoding: string } ? string : U extends ReadFileCallback<infer W> ? W : Bufferable) | undefined;
602
623
  writeFile<U extends boolean>(src: string | URL, data: BufferView, options?: WriteFileOptions): U;
603
624
  writeFile<U extends Promise<boolean>>(src: string | URL, data: BufferView, promises: true): U;
604
625
  writeFile<U extends Promise<boolean>>(src: string | URL, data: BufferView, options: WriteFileOptions, promises: true): U;
@@ -637,10 +658,10 @@ declare namespace functions {
637
658
  writeFail(value: LogValue, message?: unknown, options?: LogFailOptions): void;
638
659
  writeTimeProcess(title: string, value: string, startTime: LogTime, options?: LogProcessOptions): void;
639
660
  writeTimeElapsed(title: string, value: LogValue, startTime: LogTime, options?: LogMessageOptions): void;
640
- checkPackage(err: unknown, name: Undef<string>, type: LogType): boolean;
641
- checkPackage(err: unknown, name: Undef<string>, options: LogFailOptions): boolean;
642
- checkPackage(err: unknown, name: Undef<string>, value?: LogValue, options?: LogFailOptions | LogType): boolean;
643
- checkFail(message: unknown, options: LogFailOptions): Undef<LogArguments | false>;
661
+ checkPackage(err: unknown, name: string | undefined, type: LogType): boolean;
662
+ checkPackage(err: unknown, name: string | undefined, options: LogFailOptions): boolean;
663
+ checkPackage(err: unknown, name: string | undefined, value?: LogValue, options?: LogFailOptions | LogType): boolean;
664
+ checkFail(message: unknown, options: LogFailOptions): LogArguments | false | undefined;
644
665
  writeLog(component: LogComponent, queue?: boolean): void;
645
666
  writeLog(type: StatusType, value: unknown, options: LogOptions): void;
646
667
  writeLog(type: StatusType, value: unknown, timeStamp?: LogDate, duration?: number): void;
@@ -658,9 +679,9 @@ declare namespace functions {
658
679
  reset(): void;
659
680
  get moduleName(): string;
660
681
  set host(value);
661
- get host(): Null<T>;
682
+ get host(): T | null;
662
683
  set permission(value);
663
- get permission(): Null<IPermission>;
684
+ get permission(): IPermission | null;
664
685
  get aborted(): boolean;
665
686
  set abortable(value);
666
687
  get abortable(): boolean;
@@ -668,9 +689,11 @@ declare namespace functions {
668
689
  set sessionId(value);
669
690
  get sessionId(): string;
670
691
  set broadcastId(value);
671
- get broadcastId(): ArrayOf<string>;
692
+ get broadcastId(): string | string[];
693
+ set silent(value);
694
+ get silent(): boolean;
672
695
  get logType(): LOG_TYPE;
673
- set logLevel(value: NumString);
696
+ set logLevel(value: number | string);
674
697
  get logLevel(): number;
675
698
  get statusType(): STATUS_TYPE;
676
699
  set tempDir(value);
@@ -718,17 +741,20 @@ declare namespace functions {
718
741
  readonly LOG_TYPE: LOG_TYPE;
719
742
  readonly LOG_FORMAT: LoggerFormatSettings<LoggerFormat<number>>;
720
743
  readonly STATUS_TYPE: STATUS_TYPE;
744
+ readonly PLATFORM_WIN32: boolean;
721
745
  readonly MAX_TIMEOUT: number;
722
746
  readonly TEMP_DIR: string;
747
+ /** @deprecated Types.supported */
723
748
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
724
749
  formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
725
750
  writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
726
751
  enabled(key: string, username?: string): boolean;
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>>;
752
+ parseFunction<U = unknown, V = unknown>(value: unknown, options?: ParseFunctionOptions): FunctionType<Promise<U> | U, V> | null;
753
+ parseFunction<U = unknown, V = unknown>(value: unknown, absolute: boolean, sync?: boolean): FunctionType<Promise<U> | U, V> | null;
729
754
  asString(value: unknown, cacheKey?: boolean | "throws"): string;
730
- asHash(data: BinaryLike, options: AsHashOptions): string;
731
- asHash(data: BinaryLike, algorithm?: unknown, digest?: unknown): string;
755
+ asHash(data: BinaryLike, options?: AsHashOptions): string;
756
+ asHash(data: BinaryLike, algorithm?: string, options?: HashOptions): string;
757
+ asHash(data: BinaryLike, algorithm?: string, digest?: BinaryToTextEncoding): string;
732
758
  readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
733
759
  toPosix(value: unknown, normalize: boolean): string;
734
760
  toPosix(value: unknown, filename?: string, normalize?: boolean): string;
@@ -744,24 +770,24 @@ declare namespace functions {
744
770
  resolvePath(value: string, base: string | URL): string;
745
771
  joinPath(...values: [...paths: unknown[], normalize: boolean][]): string;
746
772
  joinPath(...values: unknown[]): string;
747
- normalizePath(value: unknown, flags?: boolean | NormalizeFlags): string;
773
+ normalizePath(value: unknown, flags?: boolean | number): string;
748
774
  createDir(value: string | URL, overwrite?: boolean): boolean;
749
775
  removeDir(value: string | URL, sinceCreated: number, recursive?: boolean): boolean;
750
776
  removeDir(value: string | URL, empty?: boolean, recursive?: boolean): boolean;
751
777
  copyDir(src: string | URL, dest: string | URL, move?: boolean, recursive?: boolean): Promise<CopyDirResult>;
752
778
  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[]>;
779
+ globDir(src: string | URL, pattern: string | string[], recursive: boolean | number): Promise<string[]>;
780
+ globDir(src: string | URL, pattern: string | string[], options?: GlobDirOptions): Promise<string[]>;
755
781
  renameFile(src: string | URL, dest: string | URL, throws?: boolean): boolean;
756
782
  streamFile<U extends Bufferable>(value: string | URL, cache: boolean): Promise<U>;
757
783
  streamFile<U extends ReadBufferOptions>(value: string | URL, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
758
784
  streamFile<U extends ReadBufferOptions>(value: string | URL, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
759
785
  readText(value: string | URL, cache: boolean): string;
760
- readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<string> : string;
786
+ readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<string> : string;
761
787
  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>;
763
- readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Null<Buffer>;
764
- resolveMime(data: string | Buffer | Uint8Array | ArrayBuffer): Promise<Undef<FileTypeResult>>;
788
+ readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<Buffer | null> : Buffer | null;
789
+ readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Buffer | null;
790
+ resolveMime(data: FileTypeFormat): Promise<FileTypeResult | undefined>;
765
791
  lookupMime(value: string, extension?: boolean): string;
766
792
  initCpuUsage(instance?: IModule): CpuUsage;
767
793
  getCpuUsage(start: CpuUsage, format: true): string;
@@ -769,12 +795,11 @@ declare namespace functions {
769
795
  getMemUsage(format: true): string;
770
796
  getMemUsage(format?: boolean): number;
771
797
  formatCpuMem(start: CpuUsage, all?: boolean): string;
772
- getPackageVersion(name: string | TupleOf<string>, startDir: string, baseDir?: string): string;
773
- getPackageVersion(name: string | TupleOf<string>, unstable?: boolean, startDir?: string, baseDir?: string): string;
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
- /** @deprecated options */
777
- checkSemVer(name: string | TupleOf<string>, min: NumString, max: NumString, options?: CheckSemVerOptions): boolean;
798
+ getPackageVersion(name: string | [string, string], startDir: string, baseDir?: string): string;
799
+ getPackageVersion(name: string | [string, string], unstable?: boolean, startDir?: string, baseDir?: string): string;
800
+ checkSemVer(name: string | [string, string], options: CheckSemVerOptions): boolean;
801
+ checkSemVer(name: string | [string, string], min: number | string, max?: number | string, unstable?: boolean, startDir?: string): boolean;
802
+ checkSemVer(name: string | [string, string], min: number | string, max: number | string, options?: Omit<CheckSemVerOptions, "min" | "max" | "equals">): boolean;
778
803
  sanitizeCmd(value: string): string;
779
804
  sanitizeArgs(value: string, doubleQuote?: boolean): string;
780
805
  sanitizeArgs(values: string[], doubleQuote?: boolean): string[];