@e-mc/types 0.5.16 → 0.5.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/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.5.16',
2
+ VERSION = '0.5.18',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.js CHANGED
@@ -34,6 +34,9 @@ function fromObject(value, typedArray) {
34
34
  if (value instanceof RegExp) {
35
35
  return new RegExp(value);
36
36
  }
37
+ if (value instanceof URL) {
38
+ return new URL(value);
39
+ }
37
40
  if (typedArray) {
38
41
  if (value instanceof Buffer) {
39
42
  return Buffer.from(value);
@@ -711,8 +714,10 @@ function coerceObject(data, parseString, cache) {
711
714
  const removeQuotes = (content) => content.trim().replace(/^["']/g, '').replace(/["']$/g, '').trim();
712
715
  const errorCreate = () => errorValue('Invalid parameters', match[2].trim());
713
716
  switch (match[1]) {
714
- case 'Date':
715
- return new Date(match[2].replace(/["']/g, '').trim());
717
+ case 'Date': {
718
+ const text = match[2].replace(/["']/g, '').trim();
719
+ return text ? new Date(text) : new Date();
720
+ }
716
721
  case 'URL':
717
722
  case 'RegExp': {
718
723
  const pattern = /^("[^"]+"|'[^']+'|[^\s,]+)(?:\s*,\s*("[^"]+"|'[^']+'|\S+))?$/.exec(match[2].trim());
package/lib/image.d.ts CHANGED
@@ -1,44 +1,44 @@
1
- import type { MimeTypeAction } from './squared';
2
-
3
- import type { BroadcastValue, LogTime } from './logger';
4
- import type { ImageModule } from './settings';
5
-
6
- export interface CommandData {
7
- resize?: ResizeData;
8
- crop?: CropData;
9
- rotate?: RotateData;
10
- quality?: QualityData;
11
- method?: MethodData;
12
- opacity?: number;
13
- }
14
-
15
- export interface RotateData {
16
- values: number[];
17
- color: number;
18
- }
19
-
20
- export interface ResizeData extends Dimension {
21
- mode: string;
22
- color: number;
23
- align: Undef<string>[];
24
- algorithm?: string;
25
- }
26
-
27
- export interface CropData extends Point, Dimension {}
28
-
29
- export interface QualityData {
30
- value: number;
31
- nearLossless: number;
32
- method: number;
33
- preset?: string;
34
- }
35
-
36
- export interface TransformOptions extends MimeTypeAction {
37
- tempFile?: boolean;
38
- startTime?: LogTime;
39
- module?: ImageModule;
40
- broadcastId?: BroadcastValue;
41
- cache?: boolean;
42
- }
43
-
1
+ import type { MimeTypeAction } from './squared';
2
+
3
+ import type { BroadcastValue, LogTime } from './logger';
4
+ import type { ImageModule } from './settings';
5
+
6
+ export interface CommandData {
7
+ resize?: ResizeData;
8
+ crop?: CropData;
9
+ rotate?: RotateData;
10
+ quality?: QualityData;
11
+ method?: MethodData;
12
+ opacity?: number;
13
+ }
14
+
15
+ export interface RotateData {
16
+ values: number[];
17
+ color: number;
18
+ }
19
+
20
+ export interface ResizeData extends Dimension {
21
+ mode: string;
22
+ color: number;
23
+ align: Undef<string>[];
24
+ algorithm?: string;
25
+ }
26
+
27
+ export interface CropData extends Point, Dimension {}
28
+
29
+ export interface QualityData {
30
+ value: number;
31
+ nearLossless: number;
32
+ method: number;
33
+ preset?: string;
34
+ }
35
+
36
+ export interface TransformOptions extends MimeTypeAction {
37
+ tempFile?: boolean;
38
+ startTime?: LogTime;
39
+ module?: ImageModule;
40
+ broadcastId?: BroadcastValue;
41
+ cache?: boolean;
42
+ }
43
+
44
44
  export type MethodData = [string, unknown[]?][];
package/lib/index.d.ts CHANGED
@@ -104,6 +104,7 @@ declare namespace functions {
104
104
  }
105
105
 
106
106
  interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
107
+ /** @deprecated */
107
108
  readonly REGEXP_SIZERANGE: RegExp;
108
109
  transform(file: string, command: string, options?: TransformOptions): Promise<Null<Buffer> | string>;
109
110
  clamp(value: unknown, min?: number, max?: number): number;
@@ -284,7 +285,7 @@ declare namespace functions {
284
285
  createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Undef<ws.Server>;
285
286
  shutdown(): void;
286
287
  setTimeout(value: NumString): void;
287
- checkTimeout(client: ws): boolean;
288
+ checkTimeout(client: ws | ws.WebSocket): boolean;
288
289
  readonly prototype: IWatch<T, U, V, W>;
289
290
  new(module?: V): IWatch<T, U, V, W>;
290
291
  new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
package/lib/task.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export interface Command<T = unknown> extends PlainObject {
2
- task: string;
3
- origDir: string;
4
- data: T;
5
- }
6
-
7
- export interface SpawnResult {
8
- added?: string[];
9
- deleted?: string[];
1
+ export interface Command<T = unknown> extends PlainObject {
2
+ task: string;
3
+ origDir: string;
4
+ data: T;
5
+ }
6
+
7
+ export interface SpawnResult {
8
+ added?: string[];
9
+ deleted?: string[];
10
10
  }
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<ws, number>;
61
- checkTimeout(client: ws): boolean;
60
+ CLIENT_SESSION: Map<typeof ws, number>;
61
+ checkTimeout(client: ws | 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.16",
3
+ "version": "0.5.18",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",