@e-mc/types 0.8.23 → 0.8.25

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
- - https://www.unpkg.com/@e-mc/types@0.8.23/index.d.ts
12
+ - https://www.unpkg.com/@e-mc/types@0.8.25/index.d.ts
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -186,8 +186,8 @@ const IMPORT_MAP: Record<string, string | undefined>;
186
186
 
187
187
  ## References
188
188
 
189
- - https://www.unpkg.com/@e-mc/types@0.8.23/lib/logger.d.ts
190
- - https://www.unpkg.com/@e-mc/types@0.8.23/lib/module.d.ts
189
+ - https://www.unpkg.com/@e-mc/types@0.8.25/lib/logger.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.8.25/lib/module.d.ts
191
191
 
192
192
  * https://nodejs.org/api/perf_hooks.html
193
193
  * 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.8.23',
2
+ VERSION = '0.8.25',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.js CHANGED
@@ -148,7 +148,6 @@ function recurseObject(data, parseString, completed, cache) {
148
148
  }
149
149
  return data;
150
150
  }
151
- const convertScrypt = (key, iv, data) => crypto.scryptSync(key, iv, Math.ceil(data.length / 16) * 16);
152
151
  const isFunction = (value) => typeof value === 'function';
153
152
  var LOG_TYPE;
154
153
  (function (LOG_TYPE) {
@@ -603,7 +602,7 @@ function alignSize(value, kb = 0, factor = 0) {
603
602
  }
604
603
  if (kb > 0) {
605
604
  kb = Math.ceil(kb) * 1024;
606
- return Math.ceil(result / kb) * kb;
605
+ return Math.ceil(Math.max(result, 1) / kb) * kb;
607
606
  }
608
607
  return result;
609
608
  }
@@ -753,8 +752,10 @@ function coerceObject(data, parseString, cache) {
753
752
  const removeQuotes = (content) => content.trim().replace(/^["']/g, '').replace(/["']$/g, '').trim();
754
753
  const errorCreate = () => errorValue('Invalid parameters', match[2].trim());
755
754
  switch (match[1]) {
756
- case 'Date':
757
- return new Date(match[2].replace(/["']/g, '').trim());
755
+ case 'Date': {
756
+ const text = match[2].replace(/["']/g, '').trim();
757
+ return text ? new Date(text) : new Date();
758
+ }
758
759
  case 'URL':
759
760
  case 'RegExp': {
760
761
  const pattern = /^("[^"]+"|'[^']+'|[^\s,]+)(?:\s*,\s*("[^"]+"|'[^']+'|\S+))?$/.exec(match[2].trim());
@@ -878,23 +879,29 @@ function getEncoding(value, fallback = 'utf-8') {
878
879
  exports.getEncoding = getEncoding;
879
880
  function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
880
881
  if (checkCipherType(algorithm) && isString(data)) {
882
+ let result;
881
883
  try {
882
- const gcm = crypto.createCipheriv(algorithm, convertScrypt(key, iv, data), iv);
883
- return gcm.update(data, 'utf-8', encoding) + gcm.final(encoding);
884
+ const gcm = crypto.createCipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
885
+ result = gcm.update(data, 'utf8', encoding);
886
+ result += gcm.final(encoding);
884
887
  }
885
888
  catch {
886
889
  }
890
+ return result;
887
891
  }
888
892
  }
889
893
  exports.encryptUTF8 = encryptUTF8;
890
894
  function decryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
891
895
  if (checkCipherType(algorithm) && isString(data)) {
896
+ let result;
892
897
  try {
893
- const gcm = crypto.createDecipheriv(algorithm, convertScrypt(key, iv, data), iv);
894
- return gcm.update(data, encoding, 'utf-8') + gcm.final('utf-8');
898
+ const gcm = crypto.createDecipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
899
+ result = gcm.update(data, encoding, 'utf8');
900
+ result += gcm.final('utf8');
895
901
  }
896
902
  catch {
897
903
  }
904
+ return result;
898
905
  }
899
906
  }
900
907
  exports.decryptUTF8 = decryptUTF8;
package/lib/index.d.ts CHANGED
@@ -103,6 +103,7 @@ declare namespace functions {
103
103
  }
104
104
 
105
105
  interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
106
+ /** @deprecated */
106
107
  readonly REGEXP_SIZERANGE: RegExp;
107
108
  transform(file: string, command: string, options?: TransformOptions): Promise<Null<Buffer> | string>;
108
109
  clamp(value: unknown, min?: number, max?: number): number;
@@ -291,7 +292,7 @@ declare namespace functions {
291
292
  createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
292
293
  shutdown(): void;
293
294
  setTimeout(value: NumString): void;
294
- checkTimeout(client: ws): boolean;
295
+ checkTimeout(client: ws.WebSocket): boolean;
295
296
  readonly prototype: IWatch<T, U, V, W>;
296
297
  new(module?: V): IWatch<T, U, V, W>;
297
298
  /* @deprecated */
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<ws, number>;
62
- checkTimeout(client: ws): 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.8.23",
3
+ "version": "0.8.25",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",