@amritk/nish-aarch64-linux 0.49.1 → 0.51.0
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/INSTALL.md +1 -1
- package/bin/nish +0 -0
- package/docs/AI.md +237 -160
- package/package.json +1 -1
- package/runtime/gfx/nish-gfx.h +373 -61
- package/runtime/nish.d.ts +94 -11
- package/runtime/nish.h +5 -0
- package/runtime/runtime-host.c +21 -5
- package/std/README.md +14 -11
- package/std/base64.ts +74 -35
- package/std/bytes.ts +207 -97
- package/std/cli-args.ts +150 -107
- package/std/compress/checksum.ts +68 -10
- package/std/compress/deflate.ts +213 -115
- package/std/compress/gzip.ts +124 -49
- package/std/compress/zlib.ts +57 -15
- package/std/crypto/aes.ts +51 -9
- package/std/crypto/base64url.ts +93 -66
- package/std/crypto/bcrypt.ts +25 -21
- package/std/crypto/ed25519.ts +12 -10
- package/std/crypto/hkdf.ts +405 -283
- package/std/crypto/hmac.ts +484 -149
- package/std/crypto/jwt.ts +51 -40
- package/std/crypto/p256.ts +14 -19
- package/std/crypto/pki-roots.ts +35 -12
- package/std/crypto/pki.ts +43 -55
- package/std/crypto/rsa-sign.ts +1635 -0
- package/std/crypto/rsa.ts +26 -4
- package/std/crypto/sha256.ts +212 -90
- package/std/crypto/sha512.ts +135 -49
- package/std/crypto/x25519.ts +12 -11
- package/std/crypto/x509.ts +164 -40
- package/std/gpu/sys.ts +490 -0
- package/std/json-equal.ts +33 -18
- package/std/json-format.ts +39 -8
- package/std/json-number.ts +15 -3
- package/std/json-tokenizer.ts +4 -3
- package/std/json-typed.ts +12 -6
- package/std/json-value.ts +236 -119
- package/std/json.ts +81 -46
- package/std/net/buffer-pool.ts +25 -14
- package/std/net/dns-config.ts +18 -5
- package/std/net/dns-message.ts +60 -27
- package/std/net/dns-resolver.ts +35 -16
- package/std/net/dns.ts +3 -2
- package/std/net/fetch.ts +224 -61
- package/std/net/handler.ts +189 -88
- package/std/net/hpack.ts +216 -103
- package/std/net/http-compress.ts +104 -42
- package/std/net/http-fields.ts +327 -31
- package/std/net/http-server.ts +326 -24
- package/std/net/http1-client-codec.ts +159 -55
- package/std/net/http1-codec.ts +427 -237
- package/std/net/http1-server.ts +220 -38
- package/std/net/http2-cleartext.ts +10 -4
- package/std/net/http2-frame.ts +2 -2
- package/std/net/http2-tls.ts +3 -3
- package/std/net/http2.ts +69 -15
- package/std/net/http3-frame.ts +11 -14
- package/std/net/http3-server.ts +139 -60
- package/std/net/http3.ts +140 -79
- package/std/net/multipart.ts +592 -0
- package/std/net/outbound.ts +24 -8
- package/std/net/postgres-async.ts +97 -64
- package/std/net/postgres-carrier.ts +28 -4
- package/std/net/postgres.ts +166 -65
- package/std/net/prefork.ts +86 -5
- package/std/net/protobuf.ts +6 -2
- package/std/net/qpack.ts +147 -40
- package/std/net/quic-conn-ack.ts +27 -7
- package/std/net/quic-conn-cid.ts +13 -7
- package/std/net/quic-datagram.ts +6 -5
- package/std/net/quic-frame.ts +67 -23
- package/std/net/quic-listener.ts +61 -39
- package/std/net/quic-packet.ts +91 -50
- package/std/net/quic-recovery.ts +11 -9
- package/std/net/quic-stream.ts +36 -27
- package/std/net/quic.ts +84 -54
- package/std/net/router.ts +136 -24
- package/std/net/serve.ts +59 -5
- package/std/net/static.ts +86 -36
- package/std/net/tls/client.ts +81 -34
- package/std/net/tls/codec.ts +3 -4
- package/std/net/tls/record.ts +80 -35
- package/std/net/tls/schedule.ts +339 -149
- package/std/net/tls/ticket.ts +6 -5
- package/std/net/tls-tcp.ts +69 -30
- package/std/net/tls.ts +194 -50
- package/std/net/upstream.ts +83 -38
- package/std/net/url.ts +170 -94
- package/std/net/websocket.ts +19 -20
- package/std/net/webtransport.ts +123 -33
- package/std/raster.ts +12 -2
- package/std/regex.ts +600 -388
- package/std/sqlite.ts +37 -19
- package/std/sync/ring.ts +232 -115
- package/std/sync/shm.ts +11 -4
- package/std/temporal.ts +232 -133
- package/std/term-io.ts +12 -6
- package/std/term-pixels.ts +176 -24
- package/std/term-rate.ts +8 -3
- package/std/term.ts +4 -4
- package/std/text.ts +38 -16
- package/std/yaml-json.ts +238 -106
- package/std/yaml-lines.ts +47 -27
- package/std/yaml-write.ts +58 -24
- package/std/yaml.ts +808 -395
package/std/json-number.ts
CHANGED
|
@@ -289,16 +289,28 @@ class JsonNumberParts {
|
|
|
289
289
|
this.count = toI32(toI64(last) - toI64(first) + toI64(1))
|
|
290
290
|
// A digit's exponent is the exponent plus `intLen - 1 - place`. The parts
|
|
291
291
|
// that add and the parts that take away are summed apart, each below
|
|
292
|
-
// 2^51
|
|
292
|
+
// 2^51 since `big` was refused above, and the larger side decides the sign.
|
|
293
293
|
const up: u64 = toU64(intLen) + (minus ? toU64(0) : size)
|
|
294
294
|
const down: u64 = minus ? size + toU64(1) : toU64(1)
|
|
295
|
-
this.lead =
|
|
296
|
-
this.last =
|
|
295
|
+
this.lead = jsonNumberDifference(up, down + toU64(first))
|
|
296
|
+
this.last = jsonNumberDifference(up, down + toU64(last))
|
|
297
297
|
this.lastBiased = up + (toU64(1) << toU64(62)) - (down + toU64(last))
|
|
298
298
|
return 0
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
/**
|
|
303
|
+
* `up - down` as an `i64`, both below 2^63: the smaller is taken from the
|
|
304
|
+
* larger, so no subtraction wraps, and a negative answer is `~(down - up - 1)`.
|
|
305
|
+
*/
|
|
306
|
+
const jsonNumberDifference = (up: u64, down: u64): i64 => {
|
|
307
|
+
if (up >= down) {
|
|
308
|
+
return toI64(up - down)
|
|
309
|
+
}
|
|
310
|
+
const less: u64 = down - up - toU64(1)
|
|
311
|
+
return ~toI64(less)
|
|
312
|
+
}
|
|
313
|
+
|
|
302
314
|
/** `-1`, `0` or `1` as `a`'s size is below, equal to or above `b`'s, signs aside. */
|
|
303
315
|
const jsonNumberCompareSize = (a: JsonNumberParts, b: JsonNumberParts): i32 => {
|
|
304
316
|
if (a.lead !== b.lead) {
|
package/std/json-tokenizer.ts
CHANGED
|
@@ -323,7 +323,9 @@ const jsonTokSigned = (m: u64, negative: boolean): i64 => {
|
|
|
323
323
|
if (m === toU64(0)) {
|
|
324
324
|
return toI64(0)
|
|
325
325
|
}
|
|
326
|
-
|
|
326
|
+
// `m` is at least 1 here, so taking one away is exact.
|
|
327
|
+
const less: u64 = m - toU64(1)
|
|
328
|
+
return ~toI64(less)
|
|
327
329
|
}
|
|
328
330
|
|
|
329
331
|
/**
|
|
@@ -1841,8 +1843,7 @@ export class JsonTokenizer {
|
|
|
1841
1843
|
const src: u8[] = this.src
|
|
1842
1844
|
const start: i32 = this.tokStart
|
|
1843
1845
|
const end: i32 = this.tokEnd
|
|
1844
|
-
|
|
1845
|
-
if (start < 0 || start > end || end > n) {
|
|
1846
|
+
if (start < 0 || start > end || end > toI32(src.length)) {
|
|
1846
1847
|
return 0
|
|
1847
1848
|
}
|
|
1848
1849
|
return parseFloat(String.fromBytes(src, start, end))
|
package/std/json-typed.ts
CHANGED
|
@@ -823,8 +823,9 @@ export class JsonDecoder {
|
|
|
823
823
|
const src: u8[] = tok.src
|
|
824
824
|
// The width between the quotes is in `i64`, where it cannot wrap. The
|
|
825
825
|
// opening quote is a byte of `src`, so the `+ 1` fits, and a byte `at`
|
|
826
|
-
// past it is in `src` only when `at` is below the bytes left; then
|
|
827
|
-
// `
|
|
826
|
+
// past it is in `src` only when `at` is below the bytes left; then its
|
|
827
|
+
// index, `from + at`, is spelled as the length less the bytes after it,
|
|
828
|
+
// differences `src/bounds.ts` proves once each operand's sign is tested.
|
|
828
829
|
if (
|
|
829
830
|
toI64(n) !== toI64(tok.tokEnd) - toI64(start) - toI64(2) ||
|
|
830
831
|
at < 0 ||
|
|
@@ -834,13 +835,18 @@ export class JsonDecoder {
|
|
|
834
835
|
) {
|
|
835
836
|
return -1
|
|
836
837
|
}
|
|
838
|
+
const length: i32 = toI32(src.length)
|
|
837
839
|
const from: i32 = start + 1
|
|
838
|
-
const left: i32 =
|
|
839
|
-
if (at >= left) {
|
|
840
|
+
const left: i32 = length - from
|
|
841
|
+
if (left < 0 || at >= left) {
|
|
840
842
|
return -1
|
|
841
843
|
}
|
|
842
|
-
const
|
|
843
|
-
if (
|
|
844
|
+
const after: i32 = left - at
|
|
845
|
+
if (after <= 0) {
|
|
846
|
+
return -1
|
|
847
|
+
}
|
|
848
|
+
const i: i32 = length - after
|
|
849
|
+
if (i < 0 || i >= length) {
|
|
844
850
|
return -1
|
|
845
851
|
}
|
|
846
852
|
return toI32(src[i])
|