@e-mc/module 0.11.8 → 0.12.1

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.
Files changed (4) hide show
  1. package/README.md +23 -23
  2. package/index.js +364 -384
  3. package/package.json +2 -2
  4. package/lib-v4.js +0 -158
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @e-mc/module
2
2
 
3
- * NodeJS 16 LTS
4
- * ES2021
3
+ * NodeJS 18
4
+ * ES2022
5
5
 
6
6
  ## General Usage
7
7
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.11.8/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.12.1/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogStatus } from "./squared";
@@ -17,7 +17,7 @@ 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, GlobDirOptions, MoveFileOptions, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, TempDirOptions, WriteFileOptions } from "./module";
20
+ import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GlobDirOptions, MoveFileOptions, PackageVersionOptions, 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
 
@@ -34,7 +34,6 @@ type CpuUsage = NodeJS.CpuUsage;
34
34
  interface IModule extends EventEmitter, IAbortComponent {
35
35
  readonly status: LogStatus<StatusType>[];
36
36
  readonly errors: unknown[];
37
- /** @deprecated Types.supported */
38
37
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
39
38
  supports(name: string, value?: boolean): boolean;
40
39
  getTempDir(options: TempDirOptions): string;
@@ -84,8 +83,8 @@ interface IModule extends EventEmitter, IAbortComponent {
84
83
  allSettled(values: readonly PromiseLike<unknown>[], rejected?: LogValue, options?: LogFailOptions): Promise<PromiseFulfilledResult<unknown>[]>;
85
84
  formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
86
85
  formatFail(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogFailOptions): void;
87
- writeFail(value: LogValue, message?: unknown, type?: LogType): void;
88
- writeFail(value: LogValue, message?: unknown, options?: LogFailOptions): void;
86
+ writeFail(value: LogValue, message: unknown, options: LogFailOptions): void;
87
+ writeFail(value: LogValue, message?: unknown, type?: LogType | LogFailOptions): void;
89
88
  writeTimeProcess(title: string, value: string, startTime: LogTime, options?: LogProcessOptions): void;
90
89
  writeTimeElapsed(title: string, value: LogValue, startTime: LogTime, options?: LogMessageOptions): void;
91
90
  checkPackage(err: unknown, name: string | undefined, type: LogType): boolean;
@@ -103,7 +102,9 @@ interface IModule extends EventEmitter, IAbortComponent {
103
102
  getLog(...type: StatusType[]): LogStatus<StatusType>[];
104
103
  flushLog(): void;
105
104
  willAbort(value: unknown): boolean;
105
+ /** @deprecated hasPermission("fs") */
106
106
  hasOwnPermission(): boolean;
107
+ hasPermission(type: "fs" | "memory" | "memory.user" | "worker" | string, ...values: unknown[]): boolean;
107
108
  isFatal(err?: unknown): boolean;
108
109
  detach(): void;
109
110
  reset(): void;
@@ -174,7 +175,8 @@ interface ModuleConstructor {
174
175
  readonly PLATFORM_WIN32: boolean;
175
176
  readonly MAX_TIMEOUT: number;
176
177
  readonly TEMP_DIR: string;
177
- /** @deprecated Types.supported */
178
+ constructorOf(value: unknown, moduleName?: string): value is ModuleConstructor;
179
+ /** @deprecated @e-mc/types */
178
180
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
179
181
  formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
180
182
  writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
@@ -184,7 +186,7 @@ interface ModuleConstructor {
184
186
  asString(value: unknown, cacheKey?: boolean | "throws"): string;
185
187
  asHash(data: BinaryLike, options?: AsHashOptions): string;
186
188
  asHash(data: BinaryLike, algorithm?: string, options?: AsHashOptions): string;
187
- asHash(data: BinaryLike, algorithm?: string, digest?: BinaryToTextEncoding): string;
189
+ asHash(data: BinaryLike, algorithm?: string, encoding?: BinaryToTextEncoding): string;
188
190
  readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
189
191
  toPosix(value: unknown, normalize: boolean): string;
190
192
  toPosix(value: unknown, filename?: string, normalize?: boolean): string;
@@ -225,17 +227,15 @@ interface ModuleConstructor {
225
227
  getMemUsage(format: true): string;
226
228
  getMemUsage(format?: boolean): number;
227
229
  formatCpuMem(start: CpuUsage, all?: boolean): string;
228
- /** @deprecated */
229
- getPackageVersion(name: string | [string, string], startDir: string, baseDir?: string): string;
230
- /** @deprecated */
231
- getPackageVersion(name: string | [string, string], unstable?: boolean, startDir?: string, baseDir?: string): string;
230
+ getPackageVersion(name: string | [string, string], options?: PackageVersionOptions): string;
232
231
  checkSemVer(name: string | [string, string], options: CheckSemVerOptions): boolean;
232
+ checkSemVer(name: string | [string, string], min: number | string, max?: number | string): boolean;
233
233
  checkSemVer(name: string | [string, string], min: number | string, max: number | string, options?: Omit<CheckSemVerOptions, "min" | "max" | "equals">): boolean;
234
- /** @deprecated */
234
+ /** @deprecated @e-mc/types */
235
235
  sanitizeCmd(value: string): string;
236
- /** @deprecated */
236
+ /** @deprecated @e-mc/types */
237
237
  sanitizeArgs(value: string, doubleQuote?: boolean): string;
238
- /** @deprecated */
238
+ /** @deprecated @e-mc/types */
239
239
  sanitizeArgs(values: string[], doubleQuote?: boolean): string[];
240
240
  purgeMemory(percent: number, parent: boolean): Promise<number>;
241
241
  purgeMemory(percent: number, limit: number, parent?: boolean): Promise<number>;
@@ -308,7 +308,7 @@ interface PermissionModule {
308
308
  }
309
309
 
310
310
  interface ErrorModule {
311
- out?: string | (err: Error, data: LogTypeValue, require?: NodeRequire) => void;
311
+ out?: string | (err: Error, data: LogTypeValue, require?: NodeJS.Require) => void;
312
312
  fatal?: boolean;
313
313
  }
314
314
 
@@ -376,7 +376,7 @@ interface LoggerModule {
376
376
  };
377
377
  broadcast?: {
378
378
  enabled?: boolean;
379
- out?: string | (value: string, options: LogMessageOptions, require?: NodeRequire) => void;
379
+ out?: string | (value: string, options: LogMessageOptions, require?: NodeJS.Require) => void;
380
380
  color?: boolean;
381
381
  port?: number | number[];
382
382
  secure?: {
@@ -414,11 +414,11 @@ interface LoggerModule {
414
414
 
415
415
  ## References
416
416
 
417
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/core.d.ts
418
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/logger.d.ts
419
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/module.d.ts
420
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/node.d.ts
421
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/settings.d.ts
417
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/core.d.ts
418
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/logger.d.ts
419
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/module.d.ts
420
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/node.d.ts
421
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/settings.d.ts
422
422
 
423
423
  * https://www.npmjs.com/package/@types/node
424
424