@e-mc/module 0.11.7 → 0.12.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.
Files changed (3) hide show
  1. package/README.md +24 -23
  2. package/index.js +383 -393
  3. package/package.json +3 -3
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.7/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.12.0/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;
@@ -172,9 +173,11 @@ interface ModuleConstructor {
172
173
  readonly LOG_FORMAT: LoggerFormatSettings<LoggerFormat<number>>;
173
174
  readonly STATUS_TYPE: STATUS_TYPE;
174
175
  readonly PLATFORM_WIN32: boolean;
176
+ readonly REQUIRE_ESM: boolean;
175
177
  readonly MAX_TIMEOUT: number;
176
178
  readonly TEMP_DIR: string;
177
- /** @deprecated Types.supported */
179
+ constructorOf(value: unknown, moduleName?: string): value is ModuleConstructor;
180
+ /** @deprecated @e-mc/types */
178
181
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
179
182
  formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
180
183
  writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
@@ -184,7 +187,7 @@ interface ModuleConstructor {
184
187
  asString(value: unknown, cacheKey?: boolean | "throws"): string;
185
188
  asHash(data: BinaryLike, options?: AsHashOptions): string;
186
189
  asHash(data: BinaryLike, algorithm?: string, options?: AsHashOptions): string;
187
- asHash(data: BinaryLike, algorithm?: string, digest?: BinaryToTextEncoding): string;
190
+ asHash(data: BinaryLike, algorithm?: string, encoding?: BinaryToTextEncoding): string;
188
191
  readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
189
192
  toPosix(value: unknown, normalize: boolean): string;
190
193
  toPosix(value: unknown, filename?: string, normalize?: boolean): string;
@@ -225,17 +228,15 @@ interface ModuleConstructor {
225
228
  getMemUsage(format: true): string;
226
229
  getMemUsage(format?: boolean): number;
227
230
  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;
231
+ getPackageVersion(name: string | [string, string], options?: PackageVersionOptions): string;
232
232
  checkSemVer(name: string | [string, string], options: CheckSemVerOptions): boolean;
233
+ checkSemVer(name: string | [string, string], min: number | string, max?: number | string): boolean;
233
234
  checkSemVer(name: string | [string, string], min: number | string, max: number | string, options?: Omit<CheckSemVerOptions, "min" | "max" | "equals">): boolean;
234
- /** @deprecated */
235
+ /** @deprecated @e-mc/types */
235
236
  sanitizeCmd(value: string): string;
236
- /** @deprecated */
237
+ /** @deprecated @e-mc/types */
237
238
  sanitizeArgs(value: string, doubleQuote?: boolean): string;
238
- /** @deprecated */
239
+ /** @deprecated @e-mc/types */
239
240
  sanitizeArgs(values: string[], doubleQuote?: boolean): string[];
240
241
  purgeMemory(percent: number, parent: boolean): Promise<number>;
241
242
  purgeMemory(percent: number, limit: number, parent?: boolean): Promise<number>;
@@ -308,7 +309,7 @@ interface PermissionModule {
308
309
  }
309
310
 
310
311
  interface ErrorModule {
311
- out?: string | (err: Error, data: LogTypeValue, require?: NodeRequire) => void;
312
+ out?: string | (err: Error, data: LogTypeValue, require?: NodeJS.Require) => void;
312
313
  fatal?: boolean;
313
314
  }
314
315
 
@@ -376,7 +377,7 @@ interface LoggerModule {
376
377
  };
377
378
  broadcast?: {
378
379
  enabled?: boolean;
379
- out?: string | (value: string, options: LogMessageOptions, require?: NodeRequire) => void;
380
+ out?: string | (value: string, options: LogMessageOptions, require?: NodeJS.Require) => void;
380
381
  color?: boolean;
381
382
  port?: number | number[];
382
383
  secure?: {
@@ -414,11 +415,11 @@ interface LoggerModule {
414
415
 
415
416
  ## References
416
417
 
417
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/core.d.ts
418
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/logger.d.ts
419
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/module.d.ts
420
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/node.d.ts
421
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/settings.d.ts
418
+ - https://www.unpkg.com/@e-mc/types@0.12.0/lib/core.d.ts
419
+ - https://www.unpkg.com/@e-mc/types@0.12.0/lib/logger.d.ts
420
+ - https://www.unpkg.com/@e-mc/types@0.12.0/lib/module.d.ts
421
+ - https://www.unpkg.com/@e-mc/types@0.12.0/lib/node.d.ts
422
+ - https://www.unpkg.com/@e-mc/types@0.12.0/lib/settings.d.ts
422
423
 
423
424
  * https://www.npmjs.com/package/@types/node
424
425