nish 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.
Files changed (62) hide show
  1. package/README.md +7 -6
  2. package/docs/AI.md +118 -26
  3. package/docs/INSTALL.md +16 -8
  4. package/llms.txt +4 -2
  5. package/package.json +5 -6
  6. package/runtime/core/host.d.ts +2 -1
  7. package/runtime/core/host.mjs +4 -0
  8. package/runtime/core.d.ts +47 -0
  9. package/runtime/core.mjs +67 -0
  10. package/runtime/nish.d.ts +176 -0
  11. package/runtime/nish.h +120 -6
  12. package/runtime/nish.mjs +24 -4
  13. package/runtime/runtime-checksum.c +270 -0
  14. package/runtime/runtime-net.c +386 -5
  15. package/runtime/runtime-os.c +59 -8
  16. package/runtime/runtime-parallel.c +81 -5
  17. package/runtime/runtime-sandbox.c +479 -0
  18. package/runtime/runtime-sha256.c +239 -0
  19. package/runtime/runtime-shm.c +541 -0
  20. package/runtime/runtime.c +827 -791
  21. package/scripts/build.sh +79 -28
  22. package/scripts/changelog-gen.mjs +71 -18
  23. package/scripts/fuzz.sh +4 -0
  24. package/scripts/gen-pow10-table.py +80 -0
  25. package/scripts/gen-regex-unicode.mjs +822 -0
  26. package/scripts/gen-union-scale.mjs +294 -0
  27. package/scripts/size-report.sh +2 -2
  28. package/std/README.md +25 -13
  29. package/std/collections.ts +5 -5
  30. package/std/compress/checksum.ts +88 -75
  31. package/std/compress/deflate.ts +224 -0
  32. package/std/compress/gzip.ts +52 -0
  33. package/std/crypto/bcrypt.ts +816 -280
  34. package/std/crypto/hmac.ts +305 -2
  35. package/std/crypto/jwt.ts +1661 -0
  36. package/std/json-equal.ts +335 -0
  37. package/std/json-format.ts +1070 -0
  38. package/std/json-number.ts +428 -0
  39. package/std/json-pointer.ts +245 -0
  40. package/std/json-typed.ts +34 -0
  41. package/std/json-value.ts +510 -17
  42. package/std/json.ts +35 -6
  43. package/std/net/handler.ts +1348 -0
  44. package/std/net/http-client.ts +97 -16
  45. package/std/net/http-compress.ts +301 -16
  46. package/std/net/http1-client.ts +104 -19
  47. package/std/net/http1-server.ts +127 -24
  48. package/std/net/http1.ts +24 -4
  49. package/std/net/outbound.ts +409 -0
  50. package/std/net/postgres.ts +405 -0
  51. package/std/net/prefork.ts +344 -20
  52. package/std/net/websocket.ts +295 -14
  53. package/std/regex.ts +613 -52
  54. package/std/secret.ts +1 -1
  55. package/std/sync/ring.ts +587 -0
  56. package/std/sync/shm.ts +284 -0
  57. package/std/term-io.ts +35 -8
  58. package/std/term-rate.ts +13 -1
  59. package/std/threads.ts +35 -3
  60. package/std/yaml-json.ts +841 -0
  61. package/scripts/gen-pow5-tables.py +0 -50
  62. /package/runtime/{LICENSE-ryu → LICENSE-zmij} +0 -0
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Regenerate the two power-of-five tables `runtime/runtime.c` uses for Ryu.
3
-
4
- python3 scripts/gen-pow5-tables.py
5
-
6
- Prints the C to stdout; paste it over the `NISH_POW5_INV_SPLIT` and
7
- `NISH_POW5_SPLIT` definitions. The point of having this in the tree is that
8
- the ~10 KB of constants in the runtime are *derived*, with exact integer
9
- arithmetic, rather than transcribed from somewhere -- so a reader can check
10
- them rather than trust them. See docs/wp15-performance.md section 7a.
11
-
12
- The code that reads the tables is adapted from Ryu (ryu/d2s.c and
13
- ryu/common.h, Copyright 2018 Ulf Adams) under the Boost Software License,
14
- Version 1.0; runtime/LICENSE-ryu has the text and THIRD_PARTY_NOTICES.md the
15
- entry.
16
- """
17
- INV_BITCOUNT = 125
18
- BITCOUNT = 125
19
- M = (1 << 64) - 1
20
-
21
- def pow5bits(i):
22
- return (5 ** i).bit_length()
23
-
24
- inv = []
25
- for i in range(292):
26
- p = 5 ** i
27
- j = p.bit_length() - 1 + INV_BITCOUNT
28
- v = (1 << j) // p + 1
29
- assert v >> 128 == 0, i
30
- inv.append((v & M, v >> 64))
31
-
32
- spl = []
33
- for i in range(326):
34
- p = 5 ** i
35
- j = p.bit_length() - BITCOUNT
36
- v = p << -j if j < 0 else p >> j
37
- assert v >> 128 == 0, i
38
- spl.append((v & M, v >> 64))
39
-
40
- def emit(name, rows):
41
- out = [f"static const uint64_t {name}[{len(rows)}][2] = {{"]
42
- for lo, hi in rows:
43
- out.append(f" {{ {lo}u, {hi}u }},")
44
- out.append("};")
45
- return "\n".join(out)
46
-
47
- print("/* Generated by scripts/gen-pow5-tables.py; do not hand-edit. */")
48
- print(emit("NISH_POW5_INV_SPLIT", inv))
49
- print()
50
- print(emit("NISH_POW5_SPLIT", spl))
File without changes