@e-mc/module 0.9.7 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -18
- package/index.d.ts +4 -4
- package/index.js +733 -524
- package/lib-v4.d.ts +4 -4
- package/lib-v4.js +14 -14
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.0/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -17,15 +17,14 @@ import type { LogStatus } from "./squared";
|
|
|
17
17
|
import type { IHost } from "./index";
|
|
18
18
|
import type { IAbortComponent, IPermission } from "./core";
|
|
19
19
|
import type { LOG_TYPE, STATUS_TYPE, ExecCommand, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogTime, LogType, LogValue, LoggerFormat, StatusType } from "./logger";
|
|
20
|
-
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions,
|
|
20
|
+
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, MoveFileOptions, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, TempDirOptions, WriteFileOptions } from "./module";
|
|
21
21
|
import type { Settings } from "./node";
|
|
22
22
|
import type { LoggerFormatSettings } from "/settings";
|
|
23
23
|
|
|
24
24
|
import type { SpawnOptions } from "child_process";
|
|
25
|
-
import type { BinaryLike } from "crypto";
|
|
25
|
+
import type { BinaryLike, HashOptions } from "crypto";
|
|
26
26
|
import type { FileTypeResult } from "file-type";
|
|
27
27
|
import type { NoParamCallback } from "fs";
|
|
28
|
-
|
|
29
28
|
import type * as EventEmitter from "events";
|
|
30
29
|
|
|
31
30
|
type BufferView = Buffer | string | NodeJS.ArrayBufferView;
|
|
@@ -34,9 +33,10 @@ type CpuUsage = NodeJS.CpuUsage;
|
|
|
34
33
|
interface IModule extends EventEmitter, IAbortComponent {
|
|
35
34
|
readonly status: LogStatus<StatusType>[];
|
|
36
35
|
readonly errors: unknown[];
|
|
36
|
+
/** @deprecated Types.supported */
|
|
37
37
|
supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
38
38
|
supports(name: string, value?: boolean): boolean;
|
|
39
|
-
getTempDir(options:
|
|
39
|
+
getTempDir(options: TempDirOptions): string;
|
|
40
40
|
getTempDir(uuidDir: boolean, createDir: boolean): string;
|
|
41
41
|
getTempDir(pathname: string, createDir: boolean): string;
|
|
42
42
|
getTempDir(uuidDir: boolean, filename?: string, createDir?: boolean): string;
|
|
@@ -119,6 +119,8 @@ interface IModule extends EventEmitter, IAbortComponent {
|
|
|
119
119
|
get sessionId(): string;
|
|
120
120
|
set broadcastId(value);
|
|
121
121
|
get broadcastId(): string | string[];
|
|
122
|
+
set silent(value);
|
|
123
|
+
get silent(): boolean;
|
|
122
124
|
get logType(): LOG_TYPE;
|
|
123
125
|
set logLevel(value: number | string);
|
|
124
126
|
get logLevel(): number;
|
|
@@ -168,8 +170,10 @@ interface ModuleConstructor {
|
|
|
168
170
|
readonly LOG_TYPE: LOG_TYPE;
|
|
169
171
|
readonly LOG_FORMAT: LoggerFormatSettings<LoggerFormat<number>>;
|
|
170
172
|
readonly STATUS_TYPE: STATUS_TYPE;
|
|
173
|
+
readonly PLATFORM_WIN32: boolean;
|
|
171
174
|
readonly MAX_TIMEOUT: number;
|
|
172
175
|
readonly TEMP_DIR: string;
|
|
176
|
+
/** @deprecated Types.supported */
|
|
173
177
|
supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
174
178
|
formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
|
|
175
179
|
writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
|
|
@@ -177,8 +181,9 @@ interface ModuleConstructor {
|
|
|
177
181
|
parseFunction(value: unknown, options?: ParseFunctionOptions): ((...args: unknown[]) => Promise<unknown> | unknown) | null;
|
|
178
182
|
parseFunction(value: unknown, absolute: boolean, sync?: boolean): ((...args: unknown[]) => Promise<unknown> | unknown) | null;
|
|
179
183
|
asString(value: unknown, cacheKey?: boolean | "throws"): string;
|
|
180
|
-
asHash(data: BinaryLike, options
|
|
181
|
-
asHash(data: BinaryLike, algorithm?:
|
|
184
|
+
asHash(data: BinaryLike, options?: AsHashOptions): string;
|
|
185
|
+
asHash(data: BinaryLike, algorithm?: string, options?: AsHashOptions): string;
|
|
186
|
+
asHash(data: BinaryLike, algorithm?: string, digest?: BinaryToTextEncoding): string;
|
|
182
187
|
readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
|
|
183
188
|
toPosix(value: unknown, normalize: boolean): string;
|
|
184
189
|
toPosix(value: unknown, filename?: string, normalize?: boolean): string;
|
|
@@ -194,7 +199,7 @@ interface ModuleConstructor {
|
|
|
194
199
|
resolvePath(value: string, base: string | URL): string;
|
|
195
200
|
joinPath(...values: [...paths: unknown[], normalize: boolean][]): string;
|
|
196
201
|
joinPath(...values: unknown[]): string;
|
|
197
|
-
normalizePath(value: unknown, flags?: boolean |
|
|
202
|
+
normalizePath(value: unknown, flags?: boolean | number): string;
|
|
198
203
|
createDir(value: string | URL, overwrite?: boolean): boolean;
|
|
199
204
|
removeDir(value: string | URL, sinceCreated: number, recursive?: boolean): boolean;
|
|
200
205
|
removeDir(value: string | URL, empty?: boolean, recursive?: boolean): boolean;
|
|
@@ -238,10 +243,9 @@ interface ModuleConstructor {
|
|
|
238
243
|
## Settings
|
|
239
244
|
|
|
240
245
|
```typescript
|
|
241
|
-
import type { LogMessageOptions, LogTypeValue, LoggerStatus } from "./logger";
|
|
246
|
+
import type { BackgroundColor, ForegroundColor, LogMessageOptions, LogTypeValue, LoggerProgress, LoggerStatus } from "./logger";
|
|
242
247
|
import type { LoggerProcessSettings } from "./settings";
|
|
243
248
|
|
|
244
|
-
import type { BackgroundColor as IBackgroundColor, ForegroundColor as IForegroundColor } from "chalk";
|
|
245
249
|
import type { BinaryLike, CipherGCMTypes } from "crypto";
|
|
246
250
|
import type { SecureVersion } from "tls";
|
|
247
251
|
|
|
@@ -297,6 +301,7 @@ interface ErrorModule {
|
|
|
297
301
|
|
|
298
302
|
interface TempModule {
|
|
299
303
|
dir?: string;
|
|
304
|
+
env?: string;
|
|
300
305
|
write?: boolean;
|
|
301
306
|
}
|
|
302
307
|
|
|
@@ -311,6 +316,7 @@ interface LoggerModule {
|
|
|
311
316
|
bg_color?: BackgroundColor;
|
|
312
317
|
bold?: boolean;
|
|
313
318
|
justify?: "left" | "center" | "right";
|
|
319
|
+
braces?: string;
|
|
314
320
|
as?: StringMap;
|
|
315
321
|
};
|
|
316
322
|
value?: {
|
|
@@ -325,6 +331,7 @@ interface LoggerModule {
|
|
|
325
331
|
color?: ForegroundColor;
|
|
326
332
|
bg_color?: BackgroundColor;
|
|
327
333
|
bold?: boolean;
|
|
334
|
+
braces?: [string, string];
|
|
328
335
|
as?: StringMap;
|
|
329
336
|
unit?: "auto" | "s" | "ms";
|
|
330
337
|
};
|
|
@@ -333,6 +340,7 @@ interface LoggerModule {
|
|
|
333
340
|
color?: ForegroundColor;
|
|
334
341
|
bg_color?: BackgroundColor;
|
|
335
342
|
bold?: boolean;
|
|
343
|
+
braces?: [string, string];
|
|
336
344
|
};
|
|
337
345
|
meter?: {
|
|
338
346
|
color?: ForegroundColor;
|
|
@@ -340,6 +348,12 @@ interface LoggerModule {
|
|
|
340
348
|
bg_alt_color?: BackgroundColor;
|
|
341
349
|
bold?: boolean;
|
|
342
350
|
};
|
|
351
|
+
error?: {
|
|
352
|
+
color?: ForegroundColor;
|
|
353
|
+
alt_color?: ForegroundColor;
|
|
354
|
+
bg_color?: BackgroundColor;
|
|
355
|
+
braces?: [string, string];
|
|
356
|
+
};
|
|
343
357
|
};
|
|
344
358
|
meter?: {
|
|
345
359
|
http?: number;
|
|
@@ -365,6 +379,7 @@ interface LoggerModule {
|
|
|
365
379
|
stdout?: boolean;
|
|
366
380
|
abort?: boolean;
|
|
367
381
|
status?: boolean | LoggerStatus;
|
|
382
|
+
progress?: LoggerProgress;
|
|
368
383
|
unknown?: boolean | LoggerColor;
|
|
369
384
|
system?: boolean | LoggerColor;
|
|
370
385
|
process?: boolean | LoggerProcessSettings;
|
|
@@ -382,18 +397,15 @@ interface LoggerModule {
|
|
|
382
397
|
session_id?: boolean | number;
|
|
383
398
|
stack_trace?: boolean | number;
|
|
384
399
|
}
|
|
385
|
-
|
|
386
|
-
type BackgroundColor = typeof IBackgroundColor | `#${string}`;
|
|
387
|
-
type ForegroundColor = typeof IForegroundColor | `#${string}`;
|
|
388
400
|
```
|
|
389
401
|
|
|
390
402
|
## References
|
|
391
403
|
|
|
392
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
393
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
394
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
395
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
396
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
404
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/core.d.ts
|
|
405
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/logger.d.ts
|
|
406
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/module.d.ts
|
|
407
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/node.d.ts
|
|
408
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/settings.d.ts
|
|
397
409
|
|
|
398
410
|
* https://www.npmjs.com/package/@types/node
|
|
399
411
|
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ModuleConstructor } from '../types/lib';
|
|
2
|
-
|
|
3
|
-
declare const Module: ModuleConstructor;
|
|
4
|
-
|
|
1
|
+
import type { ModuleConstructor } from '../types/lib';
|
|
2
|
+
|
|
3
|
+
declare const Module: ModuleConstructor;
|
|
4
|
+
|
|
5
5
|
export = Module;
|