@e-mc/types 0.11.3 → 0.11.5

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.3/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.11.5/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.3/index.d.ts
202
- - https://www.unpkg.com/@e-mc/types@0.11.3/lib/logger.d.ts
203
- - https://www.unpkg.com/@e-mc/types@0.11.3/lib/module.d.ts
204
- - https://www.unpkg.com/@e-mc/types@0.11.3/lib/node.d.ts
201
+ - https://www.unpkg.com/@e-mc/types@0.11.5/index.d.ts
202
+ - https://www.unpkg.com/@e-mc/types@0.11.5/lib/logger.d.ts
203
+ - https://www.unpkg.com/@e-mc/types@0.11.5/lib/module.d.ts
204
+ - https://www.unpkg.com/@e-mc/types@0.11.5/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.3',
2
+ VERSION = '0.11.5',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.js CHANGED
@@ -284,10 +284,10 @@ function parseStringDefault(value) {
284
284
  const match = REGEXP_NATIVE.exec(value.trimEnd());
285
285
  if (match) {
286
286
  try {
287
- const text = match[2].trim();
287
+ let text = match[2].trim();
288
288
  switch (match[1]) {
289
289
  case 'Date':
290
- return new Date(trimQuote(text));
290
+ return (text = trimQuote(text)) ? new Date(text) : new Date();
291
291
  case 'URL':
292
292
  case 'RegExp': {
293
293
  const pattern = /^("[^"]+"|'[^']+'|[^\s,]+)(?:\s*,\s*("[^"]+"|'[^']+'|\S+))?$/.exec(text);
@@ -792,7 +792,7 @@ function alignSize(value, kb = 0, factor = 0) {
792
792
  }
793
793
  if (kb > 0) {
794
794
  kb = Math.ceil(kb) * 1024;
795
- return Math.ceil(result / kb) * kb;
795
+ return Math.ceil(Math.max(result, 1) / kb) * kb;
796
796
  }
797
797
  return result;
798
798
  }
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';
@@ -106,6 +107,7 @@ declare namespace functions {
106
107
  }
107
108
 
108
109
  interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
110
+ /** @deprecated */
109
111
  readonly REGEXP_SIZERANGE: RegExp;
110
112
  transform<V extends TransformOptions>(file: string, command: string, options?: V): Promise<V extends { tempFile: true } ? string : Buffer | null>;
111
113
  clamp(value: unknown, min?: number, max?: number): number;
@@ -265,9 +267,7 @@ declare namespace functions {
265
267
 
266
268
  interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends ModuleConstructor {
267
269
  finalize(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
268
- /** @deprecated */
269
270
  createSourceMap(code: string, remove: boolean): SourceMap;
270
- /** @deprecated */
271
271
  createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
272
272
  writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): string | undefined;
273
273
  updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
@@ -308,7 +308,7 @@ declare namespace functions {
308
308
  createServer(port: number, secure?: SecureOptions | null, active?: boolean): ws.Server | null;
309
309
  shutdown(): void;
310
310
  setTimeout(value: number | string): void;
311
- checkTimeout(client: ws): boolean;
311
+ checkTimeout(client: ws.WebSocket): boolean;
312
312
  isConnectionError(err: unknown): boolean;
313
313
  readonly prototype: IWatch<T, U, V, W>;
314
314
  new(module?: V): IWatch<T, U, V, W>;
@@ -795,13 +795,19 @@ declare namespace functions {
795
795
  getMemUsage(format: true): string;
796
796
  getMemUsage(format?: boolean): number;
797
797
  formatCpuMem(start: CpuUsage, all?: boolean): string;
798
+ /** @deprecated */
798
799
  getPackageVersion(name: string | [string, string], startDir: string, baseDir?: string): string;
800
+ /** @deprecated */
799
801
  getPackageVersion(name: string | [string, string], unstable?: boolean, startDir?: string, baseDir?: string): string;
800
802
  checkSemVer(name: string | [string, string], options: CheckSemVerOptions): boolean;
803
+ /** @deprecated */
801
804
  checkSemVer(name: string | [string, string], min: number | string, max?: number | string, unstable?: boolean, startDir?: string): boolean;
802
805
  checkSemVer(name: string | [string, string], min: number | string, max: number | string, options?: Omit<CheckSemVerOptions, "min" | "max" | "equals">): boolean;
806
+ /** @deprecated */
803
807
  sanitizeCmd(value: string): string;
808
+ /** @deprecated */
804
809
  sanitizeArgs(value: string, doubleQuote?: boolean): string;
810
+ /** @deprecated */
805
811
  sanitizeArgs(values: string[], doubleQuote?: boolean): string[];
806
812
  purgeMemory(percent: number, limit: number, parent?: boolean): Promise<number>;
807
813
  purgeMemory(percent?: number, limit?: number | boolean, parent?: unknown): Promise<number>;
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.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",