@e-mc/types 0.12.6 → 0.12.8

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.12.6/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.12.7/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -203,10 +203,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
203
203
 
204
204
  ## References
205
205
 
206
- - https://www.unpkg.com/@e-mc/types@0.12.6/index.d.ts
207
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/logger.d.ts
208
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/module.d.ts
209
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/node.d.ts
206
+ - https://www.unpkg.com/@e-mc/types@0.12.7/index.d.ts
207
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/logger.d.ts
208
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/module.d.ts
209
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/node.d.ts
210
210
 
211
211
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
212
212
  * 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.12.6',
2
+ VERSION = '0.12.8',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.js CHANGED
@@ -626,18 +626,15 @@ function parseTime(value, start = 0) {
626
626
  const seconds = +value;
627
627
  if (isNaN(seconds) && isString(value)) {
628
628
  let result = 0;
629
- for (const match of value.toLowerCase().matchAll(/\b([\d.]+)\s*(y|M|w|d|h|ms?|s)\b/g)) {
629
+ for (const match of value.matchAll(/\b([\d.]+)\s*(y|w|d|h|ms?|s)\b/gi)) {
630
630
  const n = +match[1];
631
631
  if (isNaN(n)) {
632
632
  continue;
633
633
  }
634
- switch (match[2]) {
634
+ switch (match[2].toLowerCase()) {
635
635
  case 'y':
636
636
  result += n * 31449600000;
637
637
  break;
638
- case 'M':
639
- result += n * 2592000000;
640
- break;
641
638
  case 'w':
642
639
  result += n * 604800000;
643
640
  break;
@@ -647,15 +644,15 @@ function parseTime(value, start = 0) {
647
644
  case 'h':
648
645
  result += n * 3600000;
649
646
  break;
650
- case 'm':
651
- result += n * 60000;
652
- break;
653
647
  case 's':
654
648
  result += n * 1000;
655
649
  break;
656
650
  case 'ms':
657
651
  result += Math.ceil(n);
658
652
  break;
653
+ default:
654
+ result += n * (match[2] === 'M' ? 2592000000 : 60000);
655
+ break;
659
656
  }
660
657
  }
661
658
  if (result > 0) {
@@ -690,10 +687,10 @@ function formatTime(value, elapsed, char = ' ') {
690
687
  if (value >= 60000) {
691
688
  const m = Math.floor(value / 60000);
692
689
  value -= m * 60000;
693
- result += padStart(m, result ? '0' : ' ') + ':';
690
+ result += (result ? padStart(m, '0') : m) + ':';
694
691
  }
695
692
  else {
696
- result += '0:';
693
+ result += result ? '00:' : '0:';
697
694
  }
698
695
  if (value >= 1000) {
699
696
  const s = Math.floor(value / 1000);
package/lib/core.d.ts CHANGED
@@ -109,7 +109,8 @@ export interface WorkerGroupConstructor {
109
109
  export interface IWorkerChannel<T = unknown> extends EventEmitter, Iterable<Worker>, WorkerInfo {
110
110
  [Symbol.iterator](): IteratorObject<Worker, BuiltinIteratorReturn>;
111
111
  sendObject(data: unknown, transferList?: Transferable[], callback?: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker;
112
- sendBuffer(data: Buffer, shared?: boolean, callback?: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker | null;
112
+ sendBuffer(data: Buffer | SharedArrayBuffer, callback: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker | null;
113
+ sendBuffer(data: Buffer | SharedArrayBuffer, shared?: boolean, callback?: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker | null;
113
114
  send(data: unknown, transferList?: Transferable[]): Promise<T>;
114
115
  drop(count?: number): number;
115
116
  join(group: IWorkerGroup, label?: string): void;
package/lib/request.d.ts CHANGED
@@ -116,9 +116,9 @@ export interface IHttpAdapter<T extends OpenOptions = OpenOptions> {
116
116
 
117
117
  export interface HttpAdapterConstructor<T extends OpenOptions = OpenOptions> {
118
118
  isUnsupported(value: number): boolean;
119
- isDowngrade(err: unknown): boolean;
120
- wasAborted(err: unknown): boolean;
121
- isConnectionError(err: unknown): boolean;
119
+ isDowngrade(err: unknown): err is Error;
120
+ wasAborted(err: unknown): err is Error;
121
+ isConnectionError(err: unknown): err is Error;
122
122
  defineHostConfig(settings: RequestModule): void;
123
123
  readonly prototype: IHttpAdapter<T>;
124
124
  new(instance: IRequest, state: ControllerState, uri: string | URL, options: T): IHttpAdapter<T>;
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.12.6",
3
+ "version": "0.12.8",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",