@e-mc/types 0.11.0 → 0.11.2

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.11.0/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.11.2/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -47,7 +47,7 @@ function convertTime(value: number | string): number;
47
47
  function convertTime(value: HighResolutionTime, format: true): string;
48
48
  function convertTime(value: HighResolutionTime, format?: boolean): number;
49
49
  function hasGlob(value: string): boolean;
50
- function escapePattern(value: unknown, lookBehind?: boolean): string;
50
+ function escapePattern(value: unknown, symbols?: boolean): string;
51
51
  function renameExt(value: string, ext: string, when?: string): string;
52
52
  function formatSize(value: string): number;
53
53
  function formatSize(value: number, options?: BytesOptions): string;
@@ -69,6 +69,7 @@ function validateUUID(value: unknown): boolean;
69
69
  function randomString(format: string, dictionary?: string): string;
70
70
  function errorValue(value: string, hint?: string): Error;
71
71
  function errorMessage(title: number | string, value: string, hint?: string): Error;
72
+ function supported(major: number, minor: number, lts: boolean): boolean;
72
73
  function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
73
74
  function importESM<T = unknown>(name: string, isDefault?: boolean, fromPath?: boolean): Promise<T>;
74
75
  function purgeMemory(percent?: number): number;
@@ -197,10 +198,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
197
198
 
198
199
  ## References
199
200
 
200
- - https://www.unpkg.com/@e-mc/types@0.11.0/index.d.ts
201
- - https://www.unpkg.com/@e-mc/types@0.11.0/lib/logger.d.ts
202
- - https://www.unpkg.com/@e-mc/types@0.11.0/lib/module.d.ts
203
- - https://www.unpkg.com/@e-mc/types@0.11.0/lib/node.d.ts
201
+ - https://www.unpkg.com/@e-mc/types@0.11.2/index.d.ts
202
+ - https://www.unpkg.com/@e-mc/types@0.11.2/lib/logger.d.ts
203
+ - https://www.unpkg.com/@e-mc/types@0.11.2/lib/module.d.ts
204
+ - https://www.unpkg.com/@e-mc/types@0.11.2/lib/node.d.ts
204
205
 
205
206
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
206
207
  * 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.11.0',
2
+ VERSION = '0.11.2',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
@@ -309,6 +309,7 @@ export const enum SETTINGS_KEY_NAME {
309
309
  NODE_REQUIRE_EXT = "node.require.ext",
310
310
  NODE_REQUIRE_NPM = "node.require.npm",
311
311
  NODE_REQUIRE_INLINE = "node.require.inline",
312
+ NODE_POSIX_STRICT = "node.posix.strict",
312
313
  NODE_PACKAGE_MANAGER = "node.settings.package_manager",
313
314
  TEMP_DIR = "temp.dir",
314
315
  TEMP_WRITE = "temp.write",
package/index.d.ts CHANGED
@@ -252,12 +252,14 @@ declare namespace types {
252
252
  FILEMANAGER_INTERVAL: number;
253
253
  WATCH_INTERVAL: number;
254
254
  WATCH_CHANGE: number;
255
+ LOGGER_METER_INCREMENT: number;
255
256
  }
256
257
 
257
258
  const THRESHOLD: {
258
259
  FILEMANAGER_INTERVAL: number;
259
260
  WATCH_INTERVAL: number;
260
261
  WATCH_CHANGE: number;
262
+ LOGGER_METER_INCREMENT: number;
261
263
  };
262
264
 
263
265
  const IMPORT_MAP: StringMap;
@@ -308,7 +310,7 @@ declare namespace types {
308
310
  function convertTime(value: HighResolutionTime, format: true): string;
309
311
  function convertTime(value: HighResolutionTime, format?: boolean): number;
310
312
  function hasGlob(value: string): boolean;
311
- function escapePattern(value: unknown, lookBehind?: boolean): string;
313
+ function escapePattern(value: unknown, symbols?: boolean): string;
312
314
  function renameExt(value: string, ext: string, when?: string): string;
313
315
  function formatSize(value: string): number;
314
316
  function formatSize(value: number, options?: BytesOptions): string;
@@ -330,6 +332,7 @@ declare namespace types {
330
332
  function randomString(format: string, dictionary?: string): string;
331
333
  function errorValue(value: string, hint?: string): Error;
332
334
  function errorMessage(title: number | string, value: string, hint?: string): Error;
335
+ function supported(major: number, minor: number, lts: boolean): boolean;
333
336
  function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
334
337
  function importESM<T = unknown>(name: string, isDefault?: boolean, fromPath?: boolean): Promise<T>;
335
338
  function purgeMemory(percent?: number): number;
package/index.js CHANGED
@@ -64,7 +64,6 @@ class AbortError extends Error {
64
64
  }
65
65
  }
66
66
  const PATTERN_CHARS = {
67
- '-': '\\x2d',
68
67
  '&': '\\x26',
69
68
  '!': '\\x21',
70
69
  '#': '\\x23',
@@ -107,6 +106,9 @@ function fromObject(value, typedArray) {
107
106
  if (value instanceof RegExp) {
108
107
  return new RegExp(value);
109
108
  }
109
+ if (value instanceof URL) {
110
+ return new URL(value);
111
+ }
110
112
  if (typedArray) {
111
113
  if (value instanceof Buffer) {
112
114
  return Buffer.from(value);
@@ -475,6 +477,7 @@ var THRESHOLD;
475
477
  THRESHOLD[THRESHOLD["FILEMANAGER_INTERVAL"] = 100] = "FILEMANAGER_INTERVAL";
476
478
  THRESHOLD[THRESHOLD["WATCH_INTERVAL"] = 500] = "WATCH_INTERVAL";
477
479
  THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
480
+ THRESHOLD[THRESHOLD["LOGGER_METER_INCREMENT"] = 250] = "LOGGER_METER_INCREMENT";
478
481
  })(THRESHOLD || (exports.THRESHOLD = THRESHOLD = {}));
479
482
  exports.IMPORT_MAP = {
480
483
  "atlas": "@pi-r/atlas",
@@ -690,20 +693,20 @@ function convertTime(value, format) {
690
693
  else {
691
694
  return parseTime(value);
692
695
  }
693
- return (format ? formatTime(result) : result);
696
+ return format ? formatTime(result) : result;
694
697
  }
695
698
  function hasGlob(value) {
696
699
  return REGEXP_GLOB.test(value);
697
700
  }
698
- function escapePattern(value, lookBehind) {
701
+ function escapePattern(value, symbols) {
699
702
  switch (typeof value) {
700
703
  case 'string': {
701
704
  let result = '', j = 0;
702
705
  for (let i = 0, length = value.length, ch; i < length; ++i) {
703
- if (lookBehind && value[i - 1] === '\\') {
704
- continue;
705
- }
706
706
  switch (ch = value[i]) {
707
+ case '-':
708
+ ch = '\\x2d';
709
+ break;
707
710
  case '.':
708
711
  case '+':
709
712
  case '*':
@@ -721,7 +724,7 @@ function escapePattern(value, lookBehind) {
721
724
  ch = '\\' + ch;
722
725
  break;
723
726
  default:
724
- if (!(ch = PATTERN_CHARS[ch])) {
727
+ if (!(symbols && (ch = PATTERN_CHARS[ch]))) {
725
728
  continue;
726
729
  }
727
730
  break;
@@ -1040,10 +1043,12 @@ function errorValue(value, hint) {
1040
1043
  return new Error(value + (hint ? ` (${hint})` : ''));
1041
1044
  }
1042
1045
  function errorMessage(title, value, hint) {
1043
- return new Error((title !== '' ? title + ': ' : '') + value + (hint ? ` (${hint})` : ''));
1046
+ return new Error((isString(title) || typeof title === 'number' ? title + ': ' : '') + value + (hint ? ` (${hint})` : ''));
1044
1047
  }
1045
1048
  function purgeMemory(percent) {
1046
1049
  CACHE_COERCED = new WeakSet();
1050
+ INCREMENT_COUNT = 65536;
1051
+ LOG_CURRENT = null;
1047
1052
  }
1048
1053
  function incrementUUID(restart) {
1049
1054
  if (restart || INCREMENT_COUNT === 65536) {
@@ -1060,10 +1065,14 @@ function hashKey(data, algorithm = 'md5', encoding = 'base64') {
1060
1065
  return crypto.randomUUID();
1061
1066
  }
1062
1067
  }
1063
- function supported(major, minor = 0, patch = 0, lts) {
1068
+ function supported(major, minor = 0, patch = 0, lts = false) {
1064
1069
  if (VER_MAJOR < major) {
1065
1070
  return false;
1066
1071
  }
1072
+ if (typeof patch === 'boolean') {
1073
+ lts = patch;
1074
+ patch = 0;
1075
+ }
1067
1076
  if (VER_MAJOR === major) {
1068
1077
  if (VER_MINOR < minor) {
1069
1078
  return false;
@@ -1090,4 +1099,4 @@ async function importESM(name, isDefault, fromPath) {
1090
1099
  }
1091
1100
  exports.generateUUID = crypto.randomUUID.bind(crypto);
1092
1101
  SUPPORTED_DOMEXCEPTION = supported(17);
1093
- SUPPORTED_HASHSINGLE = supported(20, 12, 0, true) || supported(21, 7);
1102
+ SUPPORTED_HASHSINGLE = supported(20, 12, true) || supported(21, 7);
package/lib/settings.d.ts CHANGED
@@ -54,6 +54,9 @@ export interface NodeModule<T = NodeSettings> extends HandlerSettings<T> {
54
54
  npm?: boolean;
55
55
  inline?: boolean;
56
56
  };
57
+ posix?: {
58
+ strict?: boolean;
59
+ };
57
60
  }
58
61
 
59
62
  export interface NodeSettings extends PlainObject {
package/lib/squared.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference path="type.d.ts" />
2
2
 
3
- import type { BinaryToTextEncoding } from "crypto";
3
+ import type { BinaryToTextEncoding } from "node:crypto";
4
4
 
5
5
  interface Asset extends MimeTypeAction {
6
6
  uri?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,7 +20,8 @@
20
20
  "license": "BSD-3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "bytes": "^3.1.2"
23
+ "bytes": "^3.1.2",
24
+ "chalk": "4.1.2"
24
25
  },
25
26
  "devDependencies": {
26
27
  "typescript": "5.7.2"