@dev.fast/diffr 0.1.1 → 0.1.3

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 CHANGED
@@ -1,45 +1,40 @@
1
1
  # @dev.fast/diffr
2
2
 
3
- diffr's NDJSON wire contract as TypeScript with zod validators, plus a
4
- fetcher for the matching release binary. The package version is the diffr
5
- release it describes.
3
+ TypeScript types, zod validators, and a binary fetcher for diffr's NDJSON protocol.
4
+ The package version matches the diffr release.
6
5
 
7
6
  ```ts
8
7
  import { decodeStructuralDiffEvent } from "@dev.fast/diffr";
9
- for await (const line of lines) {
10
- const event = decodeStructuralDiffEvent(line); // throws on any shape drift
11
- }
8
+ const event = decodeStructuralDiffEvent(line);
12
9
  ```
13
10
 
14
11
  ```sh
15
- npx --package @dev.fast/diffr@0.1.1 diffr-fetch --into ./bin
16
- npx --package @dev.fast/diffr@0.1.1 diffr-fetch --into ./bin --check
12
+ npx --package @dev.fast/diffr@0.1.3 diffr-fetch --into ./bin --required
17
13
  ```
18
14
 
19
- Supports macOS arm64 and Linux x64. `--check` never downloads; `--required`
20
- makes network failures fatal. Without it, network failures warn and exit 0.
21
- Hash mismatches and invalid archives always fail.
15
+ Supports macOS arm64 and Linux x64. `--check` verifies an existing install without
16
+ network access. Downloads warn on network failure unless `--required`; invalid
17
+ hashes or archives always fail.
22
18
 
23
- ## Files that change together
19
+ ## Wire changes
24
20
 
25
- A wire-format change is not done until every row is updated.
21
+ Keep these files in sync:
26
22
 
27
- | Source of truth | Mirror | Checked by |
28
- |---|---|---|
29
- | `src/protocol/mod.rs`, `src/pairing.rs` | `npm/diffr/src/contract.ts` | `contract.test.ts` runs the built `diffr` and validates every record |
30
- | `src/protocol/mod.rs` `VERSION` | `contract.ts` `STRUCTURAL_DIFF_BASE_WIRE_VERSION` | `version.test.ts` |
31
- | `docs/streaming.md` | `contract.ts` doc comments | review |
32
- | `src/protocol/mod.rs` | `tui/packages/hunk/src/diffr/wire.ts` (v3 only) | `tui` tests on `tui/test/fixtures/comparison.ndjson` |
33
- | this package's version | consumers' exact-version dependency (Review: `packages/review-protocol` and `packages/review`) | the consumer's bump PR |
23
+ | Files (from repo root) | Check |
24
+ |---|---|
25
+ | `src/protocol/mod.rs`, `src/pairing.rs`, `diffr-ts/src/contract.ts` | Contract tests against the binary; Rust version check |
26
+ | `docs/streaming.md` | Review against the wire format |
27
+ | `tui/packages/hunk/src/diffr/wire.ts` (v3 only) | TUI fixture tests |
28
+ | Review's `packages/review-protocol/package.json` and `packages/review/package.json` | Exact package version pins |
34
29
 
35
- `contract.ts` imports only zod. Consumers concatenate it into generated
36
- source where zod is the only external, so keep it that way.
30
+ ## Release
37
31
 
38
- ## Releasing
32
+ After tagging the matching Rust release and building with `cargo build --locked`,
33
+ run from `diffr-ts`:
39
34
 
40
- 1. Merge the Rust and `contract.ts` change together.
41
- 2. Tag the release; wait for the archives.
42
- 3. From `npm/diffr`, `npm run pin` writes `pins.json` for this version.
43
- 4. Build the Rust binary, then run `bun install --frozen-lockfile`,
44
- `bun run typecheck`, and `bun test` in the package directory.
45
- 5. `npm publish --access public` builds the package before packing.
35
+ ```sh
36
+ bun install --frozen-lockfile
37
+ npm run pin
38
+ bun run typecheck && bun test
39
+ npm publish --access public
40
+ ```
@@ -1,16 +1,8 @@
1
1
  /**
2
- * Hand-maintained mirror of diffr's wire format. These files change together:
3
- * src/protocol/mod.rs and src/pairing.rs (the Rust source of truth)
4
- * docs/streaming.md (the documented shapes)
5
- * npm/diffr/src/contract.ts (this file)
6
- * tui/packages/hunk/src/diffr/wire.ts (the terminal UI's copy, v3 only)
7
- * contract.test.ts runs the built binary and validates every record against
8
- * these schemas; version.test.ts checks the Rust VERSION constant.
9
- *
10
- * This file may import only zod: consumers concatenate it into generated
11
- * source where zod is the sole external.
12
- * Serde omits default/empty fields rather than sending null. Lines are zero-based,
13
- * columns are UTF-8 byte offsets, and ranges are half-open.
2
+ * Mirrors src/protocol/mod.rs and src/pairing.rs. See ../README.md for sync checks.
3
+ * Import only zod: Review embeds this file in generated source.
4
+ * Defaults are omitted, not null. Lines are zero-based, columns are UTF-8 bytes,
5
+ * and ranges are half-open.
14
6
  */
15
7
  import { z } from "zod";
16
8
  /** A pairing always has at least one side; additions/deletions omit the other. */
package/dist/contract.js CHANGED
@@ -1,16 +1,8 @@
1
1
  /**
2
- * Hand-maintained mirror of diffr's wire format. These files change together:
3
- * src/protocol/mod.rs and src/pairing.rs (the Rust source of truth)
4
- * docs/streaming.md (the documented shapes)
5
- * npm/diffr/src/contract.ts (this file)
6
- * tui/packages/hunk/src/diffr/wire.ts (the terminal UI's copy, v3 only)
7
- * contract.test.ts runs the built binary and validates every record against
8
- * these schemas; version.test.ts checks the Rust VERSION constant.
9
- *
10
- * This file may import only zod: consumers concatenate it into generated
11
- * source where zod is the sole external.
12
- * Serde omits default/empty fields rather than sending null. Lines are zero-based,
13
- * columns are UTF-8 byte offsets, and ranges are half-open.
2
+ * Mirrors src/protocol/mod.rs and src/pairing.rs. See ../README.md for sync checks.
3
+ * Import only zod: Review embeds this file in generated source.
4
+ * Defaults are omitted, not null. Lines are zero-based, columns are UTF-8 bytes,
5
+ * and ranges are half-open.
14
6
  */
15
7
  import { z } from "zod";
16
8
  function structuralPairingSchema(value) {
package/dist/stream.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import { type StructuralDiffEvent } from "./contract.js";
2
- /** JSON is untrusted until the complete nested Rust wire contract validates. */
3
2
  export declare function decodeStructuralDiffEvent(line: string): StructuralDiffEvent;
package/dist/stream.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { StructuralDiffEventSchema } from "./contract.js";
2
- /** JSON is untrusted until the complete nested Rust wire contract validates. */
3
2
  export function decodeStructuralDiffEvent(line) {
4
3
  try {
5
4
  return StructuralDiffEventSchema.parse(JSON.parse(line));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev.fast/diffr",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "diffr's NDJSON wire contract, validators, and release binary fetcher",
5
5
  "repository": "https://github.com/devdotfast/diffr",
6
6
  "license": "MIT",
package/pins.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "version": "0.1.1",
2
+ "version": "0.1.3",
3
3
  "sha256": {
4
- "aarch64-apple-darwin": "7312213893286b804190da46d4c181cc9646320b6c651ada68a42fd97a84bb7f",
5
- "x86_64-unknown-linux-gnu": "1cce58b34031b274b1ab511bf929f501d9e99a8710d4ca33b0ed4cdc94d9ab60"
4
+ "aarch64-apple-darwin": "f4a8ab41893d7a670de7457cfa0090ea9367bdc585500b600e1b692eca216dbe",
5
+ "x86_64-unknown-linux-gnu": "2bbdc89ffbcd5356c0527cf97e58169ffd9d940db3e518715e24d6cc11f5d4ff"
6
6
  }
7
7
  }
package/src/contract.ts CHANGED
@@ -1,16 +1,8 @@
1
1
  /**
2
- * Hand-maintained mirror of diffr's wire format. These files change together:
3
- * src/protocol/mod.rs and src/pairing.rs (the Rust source of truth)
4
- * docs/streaming.md (the documented shapes)
5
- * npm/diffr/src/contract.ts (this file)
6
- * tui/packages/hunk/src/diffr/wire.ts (the terminal UI's copy, v3 only)
7
- * contract.test.ts runs the built binary and validates every record against
8
- * these schemas; version.test.ts checks the Rust VERSION constant.
9
- *
10
- * This file may import only zod: consumers concatenate it into generated
11
- * source where zod is the sole external.
12
- * Serde omits default/empty fields rather than sending null. Lines are zero-based,
13
- * columns are UTF-8 byte offsets, and ranges are half-open.
2
+ * Mirrors src/protocol/mod.rs and src/pairing.rs. See ../README.md for sync checks.
3
+ * Import only zod: Review embeds this file in generated source.
4
+ * Defaults are omitted, not null. Lines are zero-based, columns are UTF-8 bytes,
5
+ * and ranges are half-open.
14
6
  */
15
7
  import { z } from "zod";
16
8
 
package/src/stream.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { type StructuralDiffEvent, StructuralDiffEventSchema } from "./contract.js";
2
2
 
3
- /** JSON is untrusted until the complete nested Rust wire contract validates. */
4
3
  export function decodeStructuralDiffEvent(line: string): StructuralDiffEvent {
5
4
  try {
6
5
  return StructuralDiffEventSchema.parse(JSON.parse(line));