@e-mc/types 0.9.17 → 0.9.18

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.9.17/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.9.18/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -194,8 +194,8 @@ const IMPORT_MAP: Record<string, string | undefined>;
194
194
 
195
195
  ## References
196
196
 
197
- - https://www.unpkg.com/@e-mc/types@0.9.17/lib/logger.d.ts
198
- - https://www.unpkg.com/@e-mc/types@0.9.17/lib/module.d.ts
197
+ - https://www.unpkg.com/@e-mc/types@0.9.18/lib/logger.d.ts
198
+ - https://www.unpkg.com/@e-mc/types@0.9.18/lib/module.d.ts
199
199
 
200
200
  * https://nodejs.org/api/perf_hooks.html
201
201
  * 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.9.17',
2
+ VERSION = '0.9.18',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.js CHANGED
@@ -680,7 +680,7 @@ function alignSize(value, kb = 0, factor = 0) {
680
680
  }
681
681
  if (kb > 0) {
682
682
  kb = Math.ceil(kb) * 1024;
683
- return Math.ceil(result / kb) * kb;
683
+ return Math.ceil(Math.max(result, 1) / kb) * kb;
684
684
  }
685
685
  return result;
686
686
  }
@@ -820,8 +820,10 @@ function coerceObject(data, parseString, cache) {
820
820
  const removeQuotes = (content) => content.trim().replace(/^["']/g, '').replace(/["']$/g, '').trim();
821
821
  const errorCreate = () => errorValue("Invalid parameters", match[2].trim());
822
822
  switch (match[1]) {
823
- case 'Date':
824
- return new Date(match[2].replace(/["']/g, '').trim());
823
+ case 'Date': {
824
+ const text = match[2].replace(/["']/g, '').trim();
825
+ return text ? new Date(text) : new Date();
826
+ }
825
827
  case 'URL':
826
828
  case 'RegExp': {
827
829
  const pattern = /^("[^"]+"|'[^']+'|[^\s,]+)(?:\s*,\s*("[^"]+"|'[^']+'|\S+))?$/.exec(match[2].trim());
package/lib/index.d.ts CHANGED
@@ -106,6 +106,7 @@ declare namespace functions {
106
106
  }
107
107
 
108
108
  interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
109
+ /** @deprecated */
109
110
  readonly REGEXP_SIZERANGE: RegExp;
110
111
  transform<V extends TransformOptions>(file: string, command: string, options?: V): Promise<V extends { tempFile: true } ? string : Null<Buffer>>;
111
112
  clamp(value: unknown, min?: number, max?: number): number;
@@ -297,7 +298,7 @@ declare namespace functions {
297
298
  createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
298
299
  shutdown(): void;
299
300
  setTimeout(value: NumString): void;
300
- checkTimeout(client: ws): boolean;
301
+ checkTimeout(client: ws | ws.WebSocket): boolean;
301
302
  readonly prototype: IWatch<T, U, V, W>;
302
303
  new(module?: V): IWatch<T, U, V, W>;
303
304
  new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): 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<ws, number>;
62
- checkTimeout(client: ws): boolean;
61
+ CLIENT_SESSION: Map<typeof ws, number>;
62
+ checkTimeout(client: ws | 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.9.17",
3
+ "version": "0.9.18",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",