@e-mc/types 0.12.5 → 0.12.7
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 +5 -5
- package/constant.d.ts +2 -1
- package/index.d.ts +1 -0
- package/index.js +7 -10
- package/lib/core.d.ts +2 -1
- package/lib/index.d.ts +0 -6
- package/lib/task.d.ts +9 -9
- package/package.json +1 -1
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.
|
|
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.
|
|
207
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
208
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
209
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
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.
|
|
2
|
+
VERSION = '0.12.7',
|
|
3
3
|
TEMP_DIR = 'tmp',
|
|
4
4
|
CJS = '__cjs__'
|
|
5
5
|
}
|
|
@@ -78,6 +78,7 @@ export const enum ERR_MESSAGE {
|
|
|
78
78
|
UNSUPPORTED_READ = 'Not permitted to read file',
|
|
79
79
|
UNSUPPORTED_WRITE = 'Not permitted to write file',
|
|
80
80
|
UNSUPPORTED_OVERWRITE = 'Not permitted to overwrite file',
|
|
81
|
+
UNSUPPORTED_PATH = 'Not permitted to set absolute path',
|
|
81
82
|
NOTFOUND_PATH = 'Path not found',
|
|
82
83
|
NOTFOUND_FILE = 'File not found',
|
|
83
84
|
NOTFOUND_BINARY = 'Binary not found',
|
package/index.d.ts
CHANGED
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.
|
|
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,
|
|
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
|
|
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/index.d.ts
CHANGED
|
@@ -822,15 +822,9 @@ declare namespace functions {
|
|
|
822
822
|
getMemUsage(format?: boolean, free?: boolean): number;
|
|
823
823
|
formatCpuMem(start: CpuUsage, all?: boolean): string;
|
|
824
824
|
getPackageVersion(name: string | [string, string], options?: PackageVersionOptions): string;
|
|
825
|
-
/** @deprecated */
|
|
826
|
-
getPackageVersion(name: string | [string, string], startDir: string, baseDir?: string): string;
|
|
827
|
-
/** @deprecated */
|
|
828
|
-
getPackageVersion(name: string | [string, string], unstable?: boolean, startDir?: string, baseDir?: string): string;
|
|
829
825
|
checkSemVer(name: string | [string, string], options: CheckSemVerOptions): boolean;
|
|
830
826
|
checkSemVer(name: string | [string, string], min: number | string, max?: number | string): boolean;
|
|
831
827
|
checkSemVer(name: string | [string, string], min: number | string, max: number | string, options?: Omit<CheckSemVerOptions, "min" | "max" | "equals">): boolean;
|
|
832
|
-
/** @deprecated */
|
|
833
|
-
checkSemVer(name: string | [string, string], min: number | string, max?: number | string, unstable?: boolean, startDir?: string): boolean;
|
|
834
828
|
/** @deprecated @e-mc/types */
|
|
835
829
|
sanitizeCmd(value: string, ...args: unknown[]): string;
|
|
836
830
|
/** @deprecated @e-mc/types */
|
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
|
}
|