@poe-platform/safe-bash 0.1.791 → 0.1.792
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.
|
@@ -10,16 +10,16 @@ function duration(arguments_) {
|
|
|
10
10
|
const base = 1000000000n;
|
|
11
11
|
const maximum = BigInt(Number.MAX_SAFE_INTEGER);
|
|
12
12
|
const columns = /* @__PURE__ */ new Map();
|
|
13
|
-
for (const
|
|
14
|
-
const
|
|
15
|
-
const match = /^[ \t\n\r\v\f]*\+?((?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?|0[xX](?:[\da-fA-F]+(?:\.[\da-fA-F]*)?|\.[\da-fA-F]+)(?:[pP][+-]?\d+)?)([smhd]?)$/.exec(value);
|
|
13
|
+
for (const value of arguments_) {
|
|
14
|
+
const match = /^[ \t\n\r\v\f]*([+-]?)((?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?|0[xX](?:[\da-fA-F]+(?:\.[\da-fA-F]*)?|\.[\da-fA-F]+)(?:[pP][+-]?\d+)?)([smhd]?)$/.exec(value);
|
|
16
15
|
if (!match) throw new CommandFailure(`invalid time interval: ${value}`);
|
|
17
|
-
const hexadecimal = /^0[xX]([\da-fA-F]*)(?:\.([\da-fA-F]*))?(?:[pP]([+-]?\d+))?$/.exec(match[
|
|
16
|
+
const hexadecimal = /^0[xX]([\da-fA-F]*)(?:\.([\da-fA-F]*))?(?:[pP]([+-]?\d+))?$/.exec(match[2]);
|
|
18
17
|
let digits, scale;
|
|
19
18
|
if (hexadecimal) {
|
|
20
19
|
const fraction = hexadecimal[2] ?? "";
|
|
21
20
|
let coefficient2 = BigInt(`0x${hexadecimal[1]}${fraction}`);
|
|
22
21
|
if (!coefficient2) continue;
|
|
22
|
+
if (match[1] === "-") throw new CommandFailure(`invalid time interval: ${value}`);
|
|
23
23
|
const exponent = BigInt(hexadecimal[3] ?? "0") - 4n * BigInt(fraction.length);
|
|
24
24
|
const bits = BigInt(coefficient2.toString(2).length);
|
|
25
25
|
if (bits + exponent > 44n) throw new CommandFailure("time interval exceeds supported finite range");
|
|
@@ -33,13 +33,14 @@ function duration(arguments_) {
|
|
|
33
33
|
}
|
|
34
34
|
digits = coefficient2.toString();
|
|
35
35
|
} else {
|
|
36
|
-
const parts = /^(\d*)(?:\.(\d*))?(?:[eE]([+-]?\d+))?$/.exec(match[
|
|
36
|
+
const parts = /^(\d*)(?:\.(\d*))?(?:[eE]([+-]?\d+))?$/.exec(match[2]);
|
|
37
37
|
const fraction = parts[2] ?? "";
|
|
38
38
|
digits = `${parts[1]}${fraction}`.replace(/^0+/, "");
|
|
39
39
|
scale = BigInt(parts[3] ?? "0") - BigInt(fraction.length) + 3n;
|
|
40
40
|
}
|
|
41
41
|
if (!digits) continue;
|
|
42
|
-
|
|
42
|
+
if (match[1] === "-") throw new CommandFailure(`invalid time interval: ${value}`);
|
|
43
|
+
const multiplier = match[3] === "d" ? 86400n : match[3] === "h" ? 3600n : match[3] === "m" ? 60n : 1n;
|
|
43
44
|
const coefficient = (BigInt(digits) * multiplier).toString();
|
|
44
45
|
if (BigInt(coefficient.length) + scale > 16n) throw new CommandFailure("time interval exceeds supported finite range");
|
|
45
46
|
const shift = (scale % 9n + 9n) % 9n;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-bash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.792",
|
|
4
4
|
"description": "Extensible virtual shell with pluggable filesystems and streaming commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -869,7 +869,7 @@
|
|
|
869
869
|
"access": "public"
|
|
870
870
|
},
|
|
871
871
|
"dependencies": {
|
|
872
|
-
"@poe-platform/safe-fs": "0.1.
|
|
872
|
+
"@poe-platform/safe-fs": "0.1.792",
|
|
873
873
|
"pdf-lib": "1.17.1",
|
|
874
874
|
"@noble/hashes": "2.4.0",
|
|
875
875
|
"pako": "3.0.1",
|