nish 0.47.0 → 0.49.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/README.md +4 -0
- package/docs/AI.md +3 -1
- package/package.json +5 -5
- package/runtime/gfx/README.md +55 -0
- package/runtime/gfx/nish-gfx.c +1063 -0
- package/runtime/gfx/nish-gfx.h +221 -0
- package/runtime/gfx/nish-gfx.overrides.json +14 -0
- package/runtime/nish.d.ts +22 -5
- package/runtime/nish.mjs +1 -0
- package/runtime/runtime-net.c +53 -27
- package/runtime/runtime-uring.c +39 -7
- package/runtime/sqlite/README.md +17 -0
- package/runtime/sqlite/nish-sqlite.c +97 -0
- package/scripts/build.sh +88 -3
- package/std/compress/deflate.ts +1371 -704
- package/std/net/handler.ts +24 -6
- package/std/net/http-server.ts +543 -156
- package/std/net/http1-server.ts +29 -2
- package/std/net/http2-cleartext.ts +30 -1
- package/std/raster.ts +35 -21
- package/std/sync/shm.ts +6 -3
- package/std/synth.ts +9 -1
package/README.md
CHANGED
|
@@ -283,6 +283,10 @@ Pre-alpha and on 0.x, with no compatibility promise: a construct's spelling,
|
|
|
283
283
|
a flag's name and the IR either lowers to can change between minor releases.
|
|
284
284
|
Every commit compiles, tests and rebuilds the compiler with itself.
|
|
285
285
|
|
|
286
|
+
What comes next is on the **[Roadmap issue](https://github.com/amritk/nish/issues/1849)**:
|
|
287
|
+
one sub-issue per plan, in the order the work is built, and under each plan
|
|
288
|
+
one issue per stage.
|
|
289
|
+
|
|
286
290
|
## Contributing, security and license
|
|
287
291
|
|
|
288
292
|
- **Contributing:** building the compiler, the tests and the conventions are in
|
package/docs/AI.md
CHANGED
|
@@ -1677,7 +1677,9 @@ export const main = (): i32 => {
|
|
|
1677
1677
|
write; a C function that does either is declared to take a `CPtr` instead.
|
|
1678
1678
|
`string | null` passes `NULL` for `null`. A string with a NUL byte in it
|
|
1679
1679
|
panics (`ffi-nul`) before the call, because C would read only up to it; a
|
|
1680
|
-
literal with no NUL is not checked
|
|
1680
|
+
literal with no NUL is not checked, nor is a local after
|
|
1681
|
+
`if (s.indexOf("\u0000") >= 0) { return … }`, which is how a
|
|
1682
|
+
`--deny-panics` program hands C a string it did not write.
|
|
1681
1683
|
|
|
1682
1684
|
<!-- nish:ok -->
|
|
1683
1685
|
```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nish",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "Nish: an ahead-of-time compiler from a static subset of TypeScript to LLVM IR",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -114,9 +114,9 @@
|
|
|
114
114
|
"typescript": "^5.6.0"
|
|
115
115
|
},
|
|
116
116
|
"optionalDependencies": {
|
|
117
|
-
"@amritk/nish-aarch64-darwin": "0.
|
|
118
|
-
"@amritk/nish-aarch64-linux": "0.
|
|
119
|
-
"@amritk/nish-x86_64-darwin": "0.
|
|
120
|
-
"@amritk/nish-x86_64-linux": "0.
|
|
117
|
+
"@amritk/nish-aarch64-darwin": "0.49.0",
|
|
118
|
+
"@amritk/nish-aarch64-linux": "0.49.0",
|
|
119
|
+
"@amritk/nish-x86_64-darwin": "0.49.0",
|
|
120
|
+
"@amritk/nish-x86_64-linux": "0.49.0"
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# runtime/gfx/
|
|
2
|
+
|
|
3
|
+
The C shim a Nish program draws through: `nish-gfx.h` and `nish-gfx.c`, a thin
|
|
4
|
+
synchronous layer over [wgpu-native](https://github.com/gfx-rs/wgpu-native)
|
|
5
|
+
(WebGPU) and [SDL3](https://libsdl.org/) (windows and input). Neither library
|
|
6
|
+
is vendored: `scripts/fetch-gfx.sh` downloads and pins them into
|
|
7
|
+
`build/gfx/<platform>/`, or `NISH_GFX_PREFIX` names an install made another
|
|
8
|
+
way.
|
|
9
|
+
|
|
10
|
+
| | wgpu-native | SDL |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| Version | v29.0.1.1 | 3.4.20 |
|
|
13
|
+
| From | `wgpu-<platform>-release.zip` from <https://github.com/gfx-rs/wgpu-native/releases/tag/v29.0.1.1> | `SDL3-3.4.20.tar.gz` from <https://github.com/libsdl-org/SDL/releases/tag/release-3.4.20>, built by `fetch-gfx.sh` as a static library |
|
|
14
|
+
| SHA-256 | one per platform, in `scripts/fetch-gfx.sh` | `f3bb06f55bed9557227a700af2ea62e49497ebdf58037732a731a5fb3ef8581f` |
|
|
15
|
+
| Licence | MIT or Apache-2.0, at the user's choice; its `webgpu.h` is BSD-3-Clause (Copyright 2019-2023 WebGPU-Native developers) | zlib (Copyright (C) 1997-2026 Sam Lantinga) |
|
|
16
|
+
|
|
17
|
+
A binary that links the shim carries both libraries, statically, so whoever
|
|
18
|
+
ships it ships their notices too: SDL's zlib licence asks that its notice not
|
|
19
|
+
be removed from source distributions, and wgpu-native's MIT and Apache-2.0
|
|
20
|
+
terms ask that the notice travel with copies. Neither library's code is in
|
|
21
|
+
this repository, so neither is listed in `THIRD_PARTY_NOTICES.md`.
|
|
22
|
+
|
|
23
|
+
## The shim's rules
|
|
24
|
+
|
|
25
|
+
- `nish-gfx.h` is what `nish c-import` reads, with
|
|
26
|
+
`nish-gfx.overrides.json` naming its buffers and nullable parameters. Every
|
|
27
|
+
parameter is a scalar, an opaque handle or a struct by pointer: no unions,
|
|
28
|
+
structs by value, callbacks or variadics. It does not include `webgpu.h`.
|
|
29
|
+
- Every WebGPU request that answers through a callback is made synchronous
|
|
30
|
+
with a bounded `wgpuInstanceProcessEvents` loop, never `wgpuInstanceWaitAny`
|
|
31
|
+
or a timed wait.
|
|
32
|
+
- Errors are queued, never called back into Nish: each device and instance
|
|
33
|
+
keeps a ring of 16 reports of at most 255 bytes, and counts the ones that
|
|
34
|
+
found it full.
|
|
35
|
+
- Offscreen targets read back through rows padded to 256 bytes and copy only
|
|
36
|
+
the unpadded rows into a buffer whose length is checked first.
|
|
37
|
+
|
|
38
|
+
The security record is [`docs/security/gfx.md`](../../docs/security/gfx.md).
|
|
39
|
+
|
|
40
|
+
## How it is linked
|
|
41
|
+
|
|
42
|
+
`scripts/build.sh` compiles every `*.c` here for a link whose IR declares a
|
|
43
|
+
`nishgfx_*` function, and for no other link, and adds `-lSDL3 -lwgpu_native`
|
|
44
|
+
with the platform's system libraries. A link that needs the libraries and
|
|
45
|
+
finds none fails with a message naming `scripts/fetch-gfx.sh`. `wasm`,
|
|
46
|
+
`wasm-host` and `wasi` builds refuse the shim. `tests/gfx.js` ("gfx") draws
|
|
47
|
+
`tests/gfx/triangle.c` offscreen and checks its pixels.
|
|
48
|
+
|
|
49
|
+
## Updating
|
|
50
|
+
|
|
51
|
+
1. Change the versions and SHA-256 pins in `scripts/fetch-gfx.sh` and the
|
|
52
|
+
table above, then run `scripts/fetch-gfx.sh --force`.
|
|
53
|
+
2. Rebuild against the new `webgpu.h`; its structs are filled through its
|
|
54
|
+
`WGPU_*_INIT` macros, so a field added upstream needs no change here.
|
|
55
|
+
3. Run `node tests/run.js gfx`.
|