summaryrefslogtreecommitdiff
path: root/abi/wasm.zig
Commit message (Collapse)AuthorAge
* library: a language's browser module formats one file's diff with that ↵Gabriel Schneider7 days
| | | | | | | file's text: `patchFile(text, len, file, file_len)` beside `highlight` (xit writes its `@@` with nothing after it, so a hunk had no context at all; toilet has the file's blob), the same header and records as `patch`, with the declaration rows formatPatch stacks when it has a source (kind 3, as git's words are: a declaration's `path:line` row, its code_start its whole length, then its header's lines); the text is the first section's file, new or old (formatPatch finds each hunk on either side and numbers the labels as that side; tested both), a hunk the text does not hold and the diff's other files stack as with no text (tested: the same rows as `patch`); only abi/wasm.zig (the export, a `Given` source answering for the first path asked, `start` shared with highlight), build.zig (the export's name, the option named `language`) and the docs: formatPatch is unchanged; +7,031 bytes on rust's module (1,290,182 -> 1,297,213; about 7 KB on each language's), 18 ms against patch's 4 for a 28-hunk diff of a 1,100-line Zig file under node (the file's parse); test/consumer's node run calls it on a bare-`@@` rust diff with the new text, the old, another text and a second file Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* library: a patch row's text is its line without its end, said and tested: ↵Gabriel Schneider7 days
| | | | | | | hunks.format trims a diff line's `\r` before its `\n` (and diff.Walk.step, and each of a source's lines, so the two compare) on purpose, and nothing a consumer reads said so (toilet saw a CRLF file's rows without their `\r`); the Patch doc comment, lib_syntax's, abi/wasm.zig's record and docs/typ/building.typ (the patch view, the record's text) say it now; test/consumer: a CRLF diff stacks to the LF diff's rows with no file, and with a CRLF main.c handed in its lines still match the diff's (its declaration found above `main.c:3 *`); no code changes Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* library: a browser's module is pardes's build's to make: build.zig exports ↵Gabriel Schneider7 days
`wasmModule(b, .{ .language = "rust" })` (the user's ruling: the self-contained module is exposed to the consumer's build.zig): wasm32-wasi, a reactor, one language's grammar and what it needs with tree-sitter's runtime and the highlighter, or with no language the patch view alone; its exports are abi/wasm.zig's (beside the other boundaries: a module of its own whose few globals are the page's, not a core's), the same in every module: `reserve`/`release` (toilet's, at least one byte so reserve(0) is a pointer), `highlight(path, path_len, text, len)` (toilet's without its diff flag: diffs go to the patch view now), `patch(text, len)` (a 20-byte header: the rows' text, a style byte a byte, and nine-u32 records: kind, old, new (0 for none), code_start, the row's text and its path as offsets, flags bit 0 no newline), `memory`, `_initialize`; only those are exported (export_symbol_names, not rdynamic: tree-sitter's and libc's symbols stay inside), and a panic is one `fd_write` to stderr and a trap (std's handler writes through std.Io and imported 26 more WASI functions): a language's module imports fd_write, fd_seek, fd_close (libc's streams, tree-sitter's debug output), the patch view's none, 24,533 bytes (11,108 gzip; with tree-sitter's runtime in it, 139,337); rust's is 1,290,182 (183,568 gzip; its parser object alone 1,134,394); test/consumer makes both through `wasmModule` and runs them under node (wasm.mjs: a page with every WASI import a stub reads the header and records back: rows, numbers, paths, the changed `*`, a no-newline flag, reserve(0), a highlight), saying so when there is no node; `sizes` installs one module a language of the manifest Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T