@e-mc/types 0.11.4 → 0.11.7

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.4/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.11.7/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -198,10 +198,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
198
198
 
199
199
  ## References
200
200
 
201
- - https://www.unpkg.com/@e-mc/types@0.11.4/index.d.ts
202
- - https://www.unpkg.com/@e-mc/types@0.11.4/lib/logger.d.ts
203
- - https://www.unpkg.com/@e-mc/types@0.11.4/lib/module.d.ts
204
- - https://www.unpkg.com/@e-mc/types@0.11.4/lib/node.d.ts
201
+ - https://www.unpkg.com/@e-mc/types@0.11.7/index.d.ts
202
+ - https://www.unpkg.com/@e-mc/types@0.11.7/lib/logger.d.ts
203
+ - https://www.unpkg.com/@e-mc/types@0.11.7/lib/module.d.ts
204
+ - https://www.unpkg.com/@e-mc/types@0.11.7/lib/node.d.ts
205
205
 
206
206
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
207
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.4',
2
+ VERSION = '0.11.7',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.js CHANGED
@@ -356,7 +356,6 @@ function checkFlags(value, flags) {
356
356
  return typeof value === 'number' && (value & flags) === flags;
357
357
  }
358
358
  const padStart = (value, char) => value > 9 ? value.toString() : char + value;
359
- const convertScrypt = (key, iv, data) => crypto.scryptSync(key, iv, Math.ceil(data.length / 16) * 16);
360
359
  const isFunction = (value) => typeof value === 'function';
361
360
  var LOG_TYPE;
362
361
  (function (LOG_TYPE) {
@@ -980,22 +979,28 @@ function getEncoding(value, fallback = 'utf-8') {
980
979
  }
981
980
  function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
982
981
  if (checkCipherType(algorithm) && isString(data)) {
982
+ let result;
983
983
  try {
984
- const gcm = crypto.createCipheriv(algorithm, convertScrypt(key, iv, data), iv);
985
- return gcm.update(data, 'utf-8', encoding) + gcm.final(encoding);
984
+ const gcm = crypto.createCipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
985
+ result = gcm.update(data, 'utf8', encoding);
986
+ result += gcm.final(encoding);
986
987
  }
987
988
  catch {
988
989
  }
990
+ return result;
989
991
  }
990
992
  }
991
993
  function decryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
992
994
  if (checkCipherType(algorithm) && isString(data)) {
995
+ let result;
993
996
  try {
994
- const gcm = crypto.createDecipheriv(algorithm, convertScrypt(key, iv, data), iv);
995
- return gcm.update(data, encoding, 'utf-8') + gcm.final('utf-8');
997
+ const gcm = crypto.createDecipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
998
+ result = gcm.update(data, encoding, 'utf8');
999
+ result += gcm.final('utf8');
996
1000
  }
997
1001
  catch {
998
1002
  }
1003
+ return result;
999
1004
  }
1000
1005
  }
1001
1006
  function randomString(format, dictionary) {
@@ -1088,7 +1093,7 @@ async function importESM(name, isDefault, fromPath) {
1088
1093
  if (fromPath && path.isAbsolute(name)) {
1089
1094
  name = (0, node_url_1.pathToFileURL)(name).toString();
1090
1095
  }
1091
- const result = Function(`return import("${name}")`)();
1096
+ const result = import(name);
1092
1097
  if (isDefault) {
1093
1098
  const out = await result;
1094
1099
  if (isObject(out) && 'default' in out) {
package/lib/index.d.ts CHANGED
@@ -27,6 +27,7 @@ import type { LookupFunction } from 'node:net';
27
27
  import type { Readable, Writable } from 'node:stream';
28
28
  import type { SecureContextOptions } from 'node:tls';
29
29
  import type { BrotliCompress, Gzip } from 'node:zlib';
30
+ // @ts-ignore
30
31
  import type { FileTypeResult } from 'file-type';
31
32
 
32
33
  import type * as EventEmitter from 'node:events';
@@ -307,7 +308,7 @@ declare namespace functions {
307
308
  createServer(port: number, secure?: SecureOptions | null, active?: boolean): ws.Server | null;
308
309
  shutdown(): void;
309
310
  setTimeout(value: number | string): void;
310
- checkTimeout(client: ws | ws.WebSocket): boolean;
311
+ checkTimeout(client: ws.WebSocket): boolean;
311
312
  isConnectionError(err: unknown): boolean;
312
313
  readonly prototype: IWatch<T, U, V, W>;
313
314
  new(module?: V): IWatch<T, U, V, W>;
package/lib/watch.d.ts CHANGED
@@ -58,8 +58,8 @@ export interface IFileGroup<T extends ExternalAsset = ExternalAsset> extends IAb
58
58
 
59
59
  export interface FileGroupConstructor<T extends ExternalAsset = ExternalAsset> {
60
60
  CONNECTION_TIMEOUT: number;
61
- CLIENT_SESSION: Map<typeof ws, number>;
62
- checkTimeout(client: ws | ws.WebSocket): boolean;
61
+ CLIENT_SESSION: Map<ws.WebSocket, number>;
62
+ checkTimeout(client: ws.WebSocket): boolean;
63
63
  cloneAsset(asset: T): T;
64
64
  readonly prototype: IFileGroup<T>;
65
65
  new(uri: string, assets: T[], abortable: boolean): IFileGroup<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.11.4",
3
+ "version": "0.11.7",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",