@e-mc/types 0.12.3 → 0.12.4

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 CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.12.2/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.12.4/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -32,6 +32,7 @@ function existsFlag(value: unknown): boolean;
32
32
  function getLogCurrent(): LogArguments | null;
33
33
  function setLogCurrent(value: LogArguments): void;
34
34
  function setTempDir(value: string): boolean;
35
+ function getTempDir(create: true, prefix?: string): string;
35
36
  function getTempDir(...values: string[]): string;
36
37
  function isArray(value: unknown): value is unknown[];
37
38
  function isObject(value: unknown): value is object;
@@ -200,10 +201,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
200
201
 
201
202
  ## References
202
203
 
203
- - https://www.unpkg.com/@e-mc/types@0.12.2/index.d.ts
204
- - https://www.unpkg.com/@e-mc/types@0.12.2/lib/logger.d.ts
205
- - https://www.unpkg.com/@e-mc/types@0.12.2/lib/module.d.ts
206
- - https://www.unpkg.com/@e-mc/types@0.12.2/lib/node.d.ts
204
+ - https://www.unpkg.com/@e-mc/types@0.12.4/index.d.ts
205
+ - https://www.unpkg.com/@e-mc/types@0.12.4/lib/logger.d.ts
206
+ - https://www.unpkg.com/@e-mc/types@0.12.4/lib/module.d.ts
207
+ - https://www.unpkg.com/@e-mc/types@0.12.4/lib/node.d.ts
207
208
 
208
209
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
209
210
  * https://www.npmjs.com/package/@types/bytes
package/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.12.3',
2
+ VERSION = '0.12.4',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
@@ -301,6 +301,17 @@ export const enum LOG_STATE {
301
301
  STDERR
302
302
  }
303
303
 
304
+ export const enum STATUS_TYPE {
305
+ UNKNOWN,
306
+ FATAL,
307
+ ERROR,
308
+ WARN,
309
+ INFO,
310
+ DEBUG,
311
+ ASSERT,
312
+ TRACE
313
+ }
314
+
304
315
  export const enum READDIR_SORT {
305
316
  FILE,
306
317
  DIRECTORY,
package/index.d.ts CHANGED
@@ -298,6 +298,7 @@ declare namespace types {
298
298
  function getLogCurrent(): LogArguments | null;
299
299
  function setLogCurrent(value: LogArguments | null): void;
300
300
  function setTempDir(value: string): boolean;
301
+ function getTempDir(create: true, prefix?: string): string;
301
302
  function getTempDir(...values: string[]): string;
302
303
  function isArray<T>(value: unknown): value is T[];
303
304
  function isObject<T extends object>(value: unknown): value is T;
package/index.js CHANGED
@@ -51,6 +51,7 @@ const path = require("node:path");
51
51
  const fs = require("node:fs");
52
52
  const crypto = require("node:crypto");
53
53
  const bytes = require("bytes");
54
+ const node_os_1 = require("node:os");
54
55
  const node_url_1 = require("node:url");
55
56
  const PATTERN_CHARS = {
56
57
  '&': '\\x26',
@@ -583,7 +584,13 @@ function setLogCurrent(value) {
583
584
  LOG_CURRENT = value;
584
585
  }
585
586
  function getTempDir(...values) {
586
- return values.length > 0 ? path.join(TEMP_DIR, ...values) : TEMP_DIR;
587
+ if (values.length === 0) {
588
+ return TEMP_DIR;
589
+ }
590
+ if (typeof values[0] === 'boolean' && values.shift()) {
591
+ return fs.mkdtempSync(isString(values[0]) ? path.join((0, node_os_1.tmpdir)(), values[0]) : (0, node_os_1.tmpdir)() + path.sep);
592
+ }
593
+ return path.join(TEMP_DIR, ...values);
587
594
  }
588
595
  function setTempDir(value) {
589
596
  try {
@@ -998,7 +1005,6 @@ function getEncoding(value, fallback) {
998
1005
  switch (value = value.trim().toLowerCase()) {
999
1006
  case 'utf8':
1000
1007
  case 'utf-8':
1001
- case 'unicode-1-1-utf-8':
1002
1008
  return 'utf8';
1003
1009
  case 'utf16le':
1004
1010
  case 'utf-16le':
package/lib/index.d.ts CHANGED
@@ -28,6 +28,8 @@ import type { Readable, Writable } from 'node:stream';
28
28
  import type { SecureContextOptions } from 'node:tls';
29
29
  import type { BrotliCompress, BrotliOptions, Gzip, ZlibOptions } from 'node:zlib';
30
30
  // @ts-ignore
31
+ import type { Unit } from 'bytes';
32
+ // @ts-ignore
31
33
  import type { FileTypeResult } from 'file-type';
32
34
 
33
35
  import type * as EventEmitter from 'node:events';
@@ -816,8 +818,8 @@ declare namespace functions {
816
818
  initCpuUsage(instance?: IModule): CpuUsage;
817
819
  getCpuUsage(start: CpuUsage, format: true): string;
818
820
  getCpuUsage(start: CpuUsage, format?: boolean): number;
819
- getMemUsage(format: true): string;
820
- getMemUsage(format?: boolean): number;
821
+ getMemUsage(format: true | "%" | Unit, free?: boolean): string;
822
+ getMemUsage(format?: boolean, free?: boolean): number;
821
823
  formatCpuMem(start: CpuUsage, all?: boolean): string;
822
824
  getPackageVersion(name: string | [string, string], options?: PackageVersionOptions): string;
823
825
  /** @deprecated */
package/lib/request.d.ts CHANGED
@@ -143,6 +143,7 @@ export interface OpenOptions extends KeepAliveAction, SilentAction, EncodingActi
143
143
  pipeTo?: string | Writable;
144
144
  postData?: unknown;
145
145
  connected?: ((headers: IncomingHttpHeaders) => boolean | void);
146
+ trailers?: (headers: IncomingHttpHeaders) => void;
146
147
  statusMessage?: string;
147
148
  progressId?: number | string;
148
149
  outFormat?: { out: BufferFormat; parser?: PlainObject };
package/lib/settings.d.ts CHANGED
@@ -461,6 +461,7 @@ export interface LoggerProcessSettings extends LoggerColor {
461
461
  cpu_single_core?: boolean;
462
462
  mem?: boolean;
463
463
  mem_format?: "%" | Unit;
464
+ mem_free?: boolean;
464
465
  }
465
466
 
466
467
  export interface LoggerFormatColor {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.12.3",
3
+ "version": "0.12.4",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",