@e-mc/types 0.5.18 → 0.5.20

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/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.5.18',
2
+ VERSION = '0.5.20',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.js CHANGED
@@ -146,7 +146,6 @@ function recurseObject(data, parseString, completed, cache) {
146
146
  }
147
147
  return data;
148
148
  }
149
- const convertScrypt = (key, iv, data) => crypto.scryptSync(key, iv, Math.ceil(data.length / 16) * 16);
150
149
  const isFunction = (value) => typeof value === 'function';
151
150
  var LOG_TYPE;
152
151
  (function (LOG_TYPE) {
@@ -826,23 +825,29 @@ function getEncoding(value, fallback = 'utf-8') {
826
825
  exports.getEncoding = getEncoding;
827
826
  function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
828
827
  if (checkCipherType(algorithm) && isString(data)) {
828
+ let result;
829
829
  try {
830
- const gcm = crypto.createCipheriv(algorithm, convertScrypt(key, iv, data), iv);
831
- return gcm.update(data, 'utf-8', encoding) + gcm.final(encoding);
830
+ const gcm = crypto.createCipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
831
+ result = gcm.update(data, 'utf8', encoding);
832
+ result += gcm.final(encoding);
832
833
  }
833
834
  catch {
834
835
  }
836
+ return result;
835
837
  }
836
838
  }
837
839
  exports.encryptUTF8 = encryptUTF8;
838
840
  function decryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
839
841
  if (checkCipherType(algorithm) && isString(data)) {
842
+ let result;
840
843
  try {
841
- const gcm = crypto.createDecipheriv(algorithm, convertScrypt(key, iv, data), iv);
842
- return gcm.update(data, encoding, 'utf-8') + gcm.final('utf-8');
844
+ const gcm = crypto.createDecipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
845
+ result = gcm.update(data, encoding, 'utf8');
846
+ result += gcm.final('utf8');
843
847
  }
844
848
  catch {
845
849
  }
850
+ return result;
846
851
  }
847
852
  }
848
853
  exports.decryptUTF8 = decryptUTF8;
package/lib/document.d.ts CHANGED
@@ -80,7 +80,7 @@ export interface TransformOptions<T = AnyObject, U = T> extends TransformOutput
80
80
  supplementChunks: ChunkData[];
81
81
  }
82
82
 
83
- export interface ITransformSeries<T = AnyObject, U = T> extends IModule, TransformOptions<T, U> {
83
+ export interface ITransformSeries<T = AnyObject, U = T, V = object> extends IModule, TransformOptions<T, U> {
84
84
  readonly type: string;
85
85
  init(instance: IModule, dirname?: string): this;
86
86
  close(instance: IModule): void;
@@ -88,11 +88,11 @@ export interface ITransformSeries<T = AnyObject, U = T> extends IModule, Transfo
88
88
  getMainFile(code?: string, imports?: StringMap): Undef<SourceInput<string>>;
89
89
  getSourceFiles(imports?: StringMap): Undef<SourceInput>;
90
90
  toBaseConfig(all?: boolean): T;
91
- upgrade<V = unknown>(context: V, dirname?: string, name?: string): V;
91
+ upgrade<W = unknown>(context: W, dirname?: string, name?: string): W;
92
92
  set code(value);
93
93
  get code(): string;
94
94
  get out(): IOut;
95
- get metadata(): object;
95
+ get metadata(): V;
96
96
  get options(): TransformOutput;
97
97
  get productionRelease(): boolean;
98
98
  get imported(): boolean;
package/lib/index.d.ts CHANGED
@@ -285,7 +285,7 @@ declare namespace functions {
285
285
  createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Undef<ws.Server>;
286
286
  shutdown(): void;
287
287
  setTimeout(value: NumString): void;
288
- checkTimeout(client: ws | ws.WebSocket): boolean;
288
+ checkTimeout(client: ws.WebSocket): boolean;
289
289
  readonly prototype: IWatch<T, U, V, W>;
290
290
  new(module?: V): IWatch<T, U, V, W>;
291
291
  new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
package/lib/watch.d.ts CHANGED
@@ -57,8 +57,8 @@ export interface IFileGroup<T extends ExternalAsset = ExternalAsset> extends IAb
57
57
 
58
58
  export interface FileGroupConstructor<T extends ExternalAsset = ExternalAsset> {
59
59
  CONNECTION_TIMEOUT: number;
60
- CLIENT_SESSION: Map<typeof ws, number>;
61
- checkTimeout(client: ws | ws.WebSocket): boolean;
60
+ CLIENT_SESSION: Map<ws.WebSocket, number>;
61
+ checkTimeout(client: ws.WebSocket): boolean;
62
62
  cloneAsset(asset: T): T;
63
63
  readonly prototype: IFileGroup<T>;
64
64
  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.5.18",
3
+ "version": "0.5.20",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",