@amritk/nish-aarch64-linux 0.36.0 → 0.38.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 +92 -71
- package/bin/nish +0 -0
- package/docs/AI.md +75 -14
- package/package.json +1 -1
- package/runtime/async.d.mts +2 -0
- package/runtime/async.mjs +7 -0
- package/runtime/core/arrays.d.ts +4 -0
- package/runtime/core/arrays.mjs +33 -0
- package/runtime/nish.d.ts +1045 -512
- package/runtime/nish.h +53 -6
- package/runtime/page.d.ts +53 -0
- package/runtime/page.mjs +146 -0
- package/runtime/runtime-async.c +740 -0
- package/runtime/runtime-cross.c +2 -1
- package/runtime/runtime-region.c +85 -7
- package/runtime/runtime-text.c +1068 -0
- package/runtime/runtime-wasm.c +65 -9
- package/runtime/runtime.c +50 -961
- package/runtime/vite.mjs +48 -11
- package/scripts/build.sh +231 -31
- package/std/LICENSE-fdlibm +8 -0
- package/std/README.md +109 -82
- package/std/array.ts +266 -0
- package/std/bytes.ts +23 -19
- package/std/compress/checksum.ts +1 -1
- package/std/crypto/aes.ts +48 -43
- package/std/crypto/base64url.ts +7 -5
- package/std/crypto/bcrypt-batch.ts +13 -13
- package/std/crypto/bcrypt.ts +33 -27
- package/std/crypto/chacha20poly1305.ts +16 -14
- package/std/crypto/ed25519.ts +19 -16
- package/std/crypto/hmac.ts +7 -6
- package/std/crypto/jwt.ts +23 -20
- package/std/crypto/p256.ts +63 -56
- package/std/crypto/p384.ts +23 -20
- package/std/crypto/pki.ts +18 -15
- package/std/crypto/rsa.ts +23 -19
- package/std/crypto/x25519.ts +11 -10
- package/std/crypto/x509.ts +69 -62
- package/std/host/ring.ts +124 -0
- package/std/host/text.ts +86 -0
- package/std/json-equal.ts +12 -11
- package/std/json-number.ts +12 -12
- package/std/json-tokenizer.ts +26 -22
- package/std/json-typed.ts +92 -78
- package/std/json-value.ts +38 -33
- package/std/json.ts +32 -28
- package/std/math.ts +743 -41
- package/std/net/dns-resolver.ts +46 -6
- package/std/net/dns.ts +50 -13
- package/std/net/fetch.ts +1744 -295
- package/std/net/handler.ts +30 -0
- package/std/net/hpack.ts +29 -26
- package/std/net/http-compress.ts +42 -28
- package/std/net/http-fields.ts +19 -4
- package/std/net/http1-client-codec.ts +29 -25
- package/std/net/http1-codec.ts +62 -91
- package/std/net/http1-server.ts +79 -57
- package/std/net/http2-frame.ts +17 -16
- package/std/net/http2-tls.ts +17 -15
- package/std/net/http2.ts +67 -54
- package/std/net/http3-frame.ts +11 -10
- package/std/net/http3-server.ts +36 -35
- package/std/net/http3.ts +70 -58
- package/std/net/postgres-async.ts +1005 -0
- package/std/net/postgres.ts +185 -164
- package/std/net/prefork.ts +38 -34
- package/std/net/qpack.ts +15 -14
- package/std/net/quic-conn-ack.ts +1 -0
- package/std/net/quic-conn-cid.ts +11 -0
- package/std/net/quic-conn-params.ts +41 -14
- package/std/net/quic-datagram.ts +7 -0
- package/std/net/quic-frame.ts +48 -12
- package/std/net/quic-listener.ts +61 -44
- package/std/net/quic-packet.ts +71 -52
- package/std/net/quic-recovery.ts +59 -21
- package/std/net/quic-stream.ts +83 -55
- package/std/net/quic.ts +204 -152
- package/std/net/serve.ts +763 -0
- package/std/net/tls/client.ts +1 -0
- package/std/net/tls/codec.ts +81 -12
- package/std/net/tls/record-client.ts +30 -18
- package/std/net/tls/record-server.ts +74 -46
- package/std/net/tls/record.ts +33 -24
- package/std/net/tls/ticket.ts +2 -0
- package/std/net/tls/verify.ts +8 -7
- package/std/net/tls-tcp.ts +58 -50
- package/std/net/tls.ts +55 -43
- package/std/net/url.ts +12 -9
- package/std/net/websocket.ts +23 -19
- package/std/net/webtransport.ts +24 -18
- package/std/random.ts +8 -6
- package/std/regex.ts +70 -59
- package/std/sync/ring.ts +24 -21
- package/std/sync/shm.ts +9 -7
- package/std/term-io.ts +17 -14
- package/std/term-probe.ts +11 -10
- package/std/term-rate.ts +71 -61
- package/std/term.ts +73 -59
- package/std/text.ts +242 -15
- package/std/threads.ts +19 -15
- package/std/yaml-json.ts +17 -15
- package/std/yaml-write.ts +21 -14
package/std/json-value.ts
CHANGED
|
@@ -31,14 +31,15 @@
|
|
|
31
31
|
* largest request seen, parsing allocates nothing.
|
|
32
32
|
*
|
|
33
33
|
* A handle carries the generation of the document's contents it was made in,
|
|
34
|
-
* which moves on at every `parse` and `clear`, so a handle kept from an
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
34
|
+
* which moves on at every `parse` and `clear`, so a handle kept from an earlier
|
|
35
|
+
* request names nothing in the next one, even when the next one has the same
|
|
36
|
+
* shape: it is `JSON_VALUE_NONE` to `kind`, and every reader answers its empty
|
|
37
|
+
* value for it rather than another document's.
|
|
38
|
+
*
|
|
39
|
+
* The generation has 511 values and moves by one at a `clear`, one at a parse
|
|
40
|
+
* and two at a parse that fails, so the check misses only a handle kept across
|
|
41
|
+
* exactly a multiple of 511 of those steps; a program must not keep handles
|
|
42
|
+
* across documents, and this catches the mistake rather than licensing it. A
|
|
42
43
|
* negative handle, or one past the last value, is `JSON_VALUE_NONE` too.
|
|
43
44
|
*
|
|
44
45
|
* **The document's size is bounded.** Each value costs about 46 bytes of the
|
|
@@ -67,25 +68,28 @@
|
|
|
67
68
|
* the range of bytes it was read from: `start(v)` and `end(v)` bound a value,
|
|
68
69
|
* `keyStart(o, i)` and `keyEnd(o, i)` the key of member `i`, its quotes
|
|
69
70
|
* included. They are offsets into the bytes `parseRanged` was given, or
|
|
70
|
-
* `parseTextRanged`'s string, so a line index over that text
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* `
|
|
88
|
-
*
|
|
71
|
+
* `parseTextRanged`'s string, so a line index over that text (`YamlLineIndex`
|
|
72
|
+
* is one) turns them into a line and a column.
|
|
73
|
+
*
|
|
74
|
+
* Under Node, where `parseTextRanged` takes one byte per UTF-16 code unit
|
|
75
|
+
* (below), its offsets count code units, so past the first non-ASCII character
|
|
76
|
+
* they differ from a native build's, which count UTF-8 bytes. Ranges cost about
|
|
77
|
+
* 20 bytes per value more: two offsets for the value, two for its key and about
|
|
78
|
+
* one on the parse's stacks, which grow with the nesting and the members
|
|
79
|
+
* pending. They are entry points of their own rather than a flag `parse` tests,
|
|
80
|
+
* so that `parse` keeps the loop it had before ranges existed.
|
|
81
|
+
*
|
|
82
|
+
* A plain `parse` writes nothing for them: ranges carry the generation they
|
|
83
|
+
* were written in, which `clear` moves anyway, so after a `parse` every reader
|
|
84
|
+
* answers `-1`, and their arrays are made on first use, so a document that
|
|
85
|
+
* never keeps ranges allocates none. A loader that builds a document from
|
|
86
|
+
* another text `clear`s, then gives each value it makes its range with
|
|
87
|
+
* `setRange` and each key with `setKeyRange`; until then a built value or key
|
|
88
|
+
* answers `-1`. `set` over an existing key keeps the member's key range and
|
|
89
|
+
* takes the new value's own.
|
|
90
|
+
*
|
|
91
|
+
* Under `JSON_VALUE_DUPLICATE_LAST` a repeated key's member keeps its first
|
|
92
|
+
* key's range and holds the last value, with that value's.
|
|
89
93
|
*
|
|
90
94
|
* **Objects keep insertion order**, the order the members were written in or
|
|
91
95
|
* added. `get` finds a member by its key with a scan, so it is for a handful of
|
|
@@ -125,12 +129,13 @@
|
|
|
125
129
|
* `set` can never contain itself: adding a value that is already in a
|
|
126
130
|
* container, or a container to itself or to anything inside it, is
|
|
127
131
|
* `JSON_VALUE_ERR_ATTACHED`, and writing always ends.
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* bytes; `parse` over a `u8[]`
|
|
132
|
+
*
|
|
133
|
+
* Strings handed to a builder are taken as their bytes, as `JsonWriter` takes
|
|
134
|
+
* them, and a string read back is made from the stored bytes in one allocation
|
|
135
|
+
* (`String.fromBytes`). Under Node a string is UTF-16, and `parseText` and the
|
|
136
|
+
* builders take one byte per code unit, so non-ASCII text is stored differently
|
|
137
|
+
* there than natively, where a string is its UTF-8 bytes; `parse` over a `u8[]`
|
|
138
|
+
* reads the same bytes both ways.
|
|
134
139
|
*
|
|
135
140
|
* **Public is not the whole API.** The compiler ignores `private`, so every
|
|
136
141
|
* member is reachable by a program; `private` and `@internal` mark what is
|
package/std/json.ts
CHANGED
|
@@ -70,28 +70,31 @@
|
|
|
70
70
|
* infinities as `null`. `jsonStringifyString` is the same string rule
|
|
71
71
|
* answered as a string.
|
|
72
72
|
*
|
|
73
|
-
* **Two modes**, both off by default and both kept across `reset`, so a
|
|
74
|
-
*
|
|
75
|
-
* `JSON.stringify(v, null, n)` and `JSON.stringify(v, null, "\t")` write:
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
73
|
+
* **Two modes**, both off by default and both kept across `reset`, so a server
|
|
74
|
+
* sets them once. `setIndent(n)` and `setIndentTab()` write what
|
|
75
|
+
* `JSON.stringify(v, null, n)` and `JSON.stringify(v, null, "\t")` write: one
|
|
76
|
+
* member or element a line, `": "` after a key, an empty `{}` or `[]` on one
|
|
77
|
+
* line, and `n` clamped to 10. The indent is one byte stored as many times as
|
|
78
|
+
* the depth asks, so the indented text allocates no more than the minified one,
|
|
79
|
+
* and a `raw` fragment is copied as it is, not re-indented.
|
|
80
|
+
*
|
|
81
|
+
* `setStrict(true)` makes NaN and the infinities, which JSON cannot spell, the
|
|
82
|
+
* sticky `JSON_WRITE_NON_FINITE` instead of `null`: for a caller to whom a
|
|
83
|
+
* `null` where a number was due would be a silently corrupt record.
|
|
83
84
|
*
|
|
84
85
|
* **Misuse is a sticky code**, as in `nish/net/hpack`: never a panic, and no
|
|
85
86
|
* `Result` to carry on the hot path. The first call that cannot be honoured
|
|
86
|
-
* sets `failed` to a negative `JSON_WRITE_*` code — a value where a key is
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
87
|
+
* sets `failed` to a negative `JSON_WRITE_*` code — a value where a key is due,
|
|
88
|
+
* a key where a value is due, an unbalanced or mismatched `end*`, nesting past
|
|
89
|
+
* `JSON_WRITER_MAX_DEPTH`, a buffer with no room, a second top-level value, a
|
|
90
|
+
* bad `raw` window or `start`, a non-finite `f64` in strict mode — and every
|
|
91
|
+
* later call does nothing.
|
|
92
|
+
*
|
|
93
|
+
* A call that fails writes nothing past `buf.length` (a full buffer is checked
|
|
94
|
+
* before the bytes go in, never by the bounds check), so the caller writes the
|
|
95
|
+
* whole value, reads `failed` once at the end, and grows the buffer and retries
|
|
96
|
+
* or answers a 500. `complete()` says whether one whole value was written with
|
|
97
|
+
* every container closed.
|
|
95
98
|
*
|
|
96
99
|
* **A string is its bytes** (WP33 class C, `docs/wp33-round-trip.md` §3.2,
|
|
97
100
|
* the first row). The writer escapes by byte and copies every byte at or
|
|
@@ -754,15 +757,16 @@ export const jsonField = (object: string, name: string): string | null => {
|
|
|
754
757
|
*
|
|
755
758
|
* The answer is a fresh array and the only allocation besides the values. Each
|
|
756
759
|
* value is stored into it by a plain `values[k] = text` statement, and the
|
|
757
|
-
* array is only stored into, tested and returned, so the values travel with
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
762
|
-
*
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
760
|
+
* array is only stored into, tested and returned, so the values travel with the
|
|
761
|
+
* array: the call lets nothing else out (LANGUAGE.md, "Memory model", a value
|
|
762
|
+
* stored into an array that is returned with it). A loop calling this keeps its
|
|
763
|
+
* per-pass release on a line older than the pass, as `jsonField`'s does, and a
|
|
764
|
+
* `using a = arena()` block may hold the call.
|
|
765
|
+
*
|
|
766
|
+
* On a line built in the pass neither reader keeps the release (LANGUAGE.md,
|
|
767
|
+
* "Memory model"). Reading `values` back, passing it to a function, or storing
|
|
768
|
+
* it anywhere before the return would undo this; `tests/link/std_json` pins the
|
|
769
|
+
* flat arena and the `using` block.
|
|
766
770
|
*
|
|
767
771
|
* @param object - the text of one JSON object.
|
|
768
772
|
* @param names - the fields to look for.
|