@amritk/nish-x86_64-linux 0.27.2 → 0.29.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 +16 -8
- package/bin/nish +0 -0
- package/docs/AI.md +118 -26
- package/package.json +1 -1
- package/runtime/core/host.d.ts +2 -1
- package/runtime/core/host.mjs +4 -0
- package/runtime/core.d.ts +47 -0
- package/runtime/core.mjs +67 -0
- package/runtime/nish.d.ts +176 -0
- package/runtime/nish.h +120 -6
- package/runtime/nish.mjs +24 -4
- package/runtime/runtime-checksum.c +270 -0
- package/runtime/runtime-net.c +386 -5
- package/runtime/runtime-os.c +59 -8
- package/runtime/runtime-parallel.c +81 -5
- package/runtime/runtime-sandbox.c +479 -0
- package/runtime/runtime-sha256.c +239 -0
- package/runtime/runtime-shm.c +541 -0
- package/runtime/runtime.c +827 -791
- package/scripts/build.sh +79 -28
- package/std/README.md +25 -13
- package/std/collections.ts +5 -5
- package/std/compress/checksum.ts +88 -75
- package/std/compress/deflate.ts +224 -0
- package/std/compress/gzip.ts +52 -0
- package/std/crypto/bcrypt.ts +816 -280
- package/std/crypto/hmac.ts +305 -2
- package/std/crypto/jwt.ts +1661 -0
- package/std/json-equal.ts +335 -0
- package/std/json-format.ts +1070 -0
- package/std/json-number.ts +428 -0
- package/std/json-pointer.ts +245 -0
- package/std/json-typed.ts +34 -0
- package/std/json-value.ts +510 -17
- package/std/json.ts +35 -6
- package/std/net/handler.ts +1348 -0
- package/std/net/http-client.ts +97 -16
- package/std/net/http-compress.ts +301 -16
- package/std/net/http1-client.ts +104 -19
- package/std/net/http1-server.ts +127 -24
- package/std/net/http1.ts +24 -4
- package/std/net/outbound.ts +409 -0
- package/std/net/postgres.ts +405 -0
- package/std/net/prefork.ts +344 -20
- package/std/net/websocket.ts +295 -14
- package/std/regex.ts +613 -52
- package/std/secret.ts +1 -1
- package/std/sync/ring.ts +587 -0
- package/std/sync/shm.ts +284 -0
- package/std/term-io.ts +35 -8
- package/std/term-rate.ts +13 -1
- package/std/threads.ts +35 -3
- package/std/yaml-json.ts +841 -0
- /package/runtime/{LICENSE-ryu → LICENSE-zmij} +0 -0
package/std/json.ts
CHANGED
|
@@ -1791,16 +1791,45 @@ const jsonWriterPutDigits64 = (w: JsonWriter, v: i64): boolean => {
|
|
|
1791
1791
|
}
|
|
1792
1792
|
|
|
1793
1793
|
/**
|
|
1794
|
-
* The digits `${v}` spells for a finite `v`,
|
|
1794
|
+
* The digits `${v}` spells for a finite `v`, in `buf` from `at`: the new end,
|
|
1795
|
+
* or -1, with nothing written, when `at` is negative or they do not fit —
|
|
1796
|
+
* `jsonWriterPutText`'s rule. Natively the compiler replaces the one call to
|
|
1797
|
+
* it with the runtime's `nish_json_put_f64` (`src/kernels.ts`), which formats
|
|
1798
|
+
* into the stack and copies, so no string is built at all; that is why the
|
|
1799
|
+
* walk takes the array and the cursor rather than the writer.
|
|
1800
|
+
*
|
|
1801
|
+
* As written, which is what Node and `--emit-ts` run, the digits are a string
|
|
1795
1802
|
* the runtime builds, and nothing holds it once its bytes are copied, so the
|
|
1796
1803
|
* function's automatic arena scope (LANGUAGE.md, "Memory model", item 2)
|
|
1797
1804
|
* gives it back before the call returns: a loop of `f64` writes keeps
|
|
1798
|
-
* `Arena.used()` flat like every other write, and
|
|
1799
|
-
* measures it. The scope is the compiler's rather
|
|
1800
|
-
* block because this module also runs under Node,
|
|
1801
|
-
* to `JSON.stringify`, and Node 22 does not parse
|
|
1805
|
+
* `Arena.used()` flat like every other write either way, and
|
|
1806
|
+
* `tests/link/std_json_writer` measures it. The scope is the compiler's rather
|
|
1807
|
+
* than a `using a = arena()` block because this module also runs under Node,
|
|
1808
|
+
* which `tests/run.js` holds to `JSON.stringify`, and Node 22 does not parse
|
|
1809
|
+
* `using`.
|
|
1802
1810
|
*/
|
|
1803
|
-
const
|
|
1811
|
+
const jsonPutF64Walk = (buf: u8[], at: i32, v: f64): i32 => {
|
|
1812
|
+
const text: string = `${v}`
|
|
1813
|
+
const n: i32 = toI32(text.length)
|
|
1814
|
+
if (at < 0 || at > toI32(buf.length) - n) {
|
|
1815
|
+
return -1
|
|
1816
|
+
}
|
|
1817
|
+
for (let k: i32 = 0; k < n && at + k < toI32(buf.length); k += 1) {
|
|
1818
|
+
buf[at + k] = toU8(text.charCodeAt(k))
|
|
1819
|
+
}
|
|
1820
|
+
return at + n
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
/** The digits `${v}` spells for a finite `v`, at the cursor; all of them or, with `JSON_WRITE_FULL`, none. */
|
|
1824
|
+
const jsonWriterPutF64 = (w: JsonWriter, v: f64): boolean => {
|
|
1825
|
+
const stop: i32 = jsonPutF64Walk(w.buf, w.end, v)
|
|
1826
|
+
if (stop < 0) {
|
|
1827
|
+
w.failed = JSON_WRITE_FULL
|
|
1828
|
+
return false
|
|
1829
|
+
}
|
|
1830
|
+
w.end = stop
|
|
1831
|
+
return true
|
|
1832
|
+
}
|
|
1804
1833
|
|
|
1805
1834
|
/**
|
|
1806
1835
|
* `s` as `JSON.stringify(s)` writes it — quoted, with the escapes
|