@dev.fast/diffr 0.1.11 → 0.1.12

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
@@ -11,8 +11,7 @@ const event = decodeStructuralDiffEvent(line);
11
11
  `diffrBinaryPath()` returns the executable from the `@dev.fast/diffr-<platform>-<arch>`
12
12
  optional dependency npm installed for this machine, or `undefined` when there is none
13
13
  (musl Linux, Windows arm64, or `--omit=optional`). Platforms: macOS arm64 and x64,
14
- glibc Linux arm64 and x64, Windows x64. It is the full edition, with every
15
- language.
14
+ glibc Linux arm64 and x64, Windows x64.
16
15
 
17
16
  ## Wire changes
18
17
 
@@ -20,7 +19,7 @@ Keep these files in sync:
20
19
 
21
20
  | Files (from repo root) | Check |
22
21
  |---|---|
23
- | `src/protocol/mod.rs`, `src/pairing.rs`, `diffr-ts/src/contract.ts` | Contract tests against the binary; Rust version check |
22
+ | `crates/diffr-core/src/protocol/mod.rs`, `crates/diffr-core/src/pairing.rs`, `diffr-ts/src/contract.ts` | Contract tests against the binary; Rust version check |
24
23
  | `docs/streaming.md` | Review against the wire format |
25
24
  | `tui/packages/hunk/src/diffr/wire.ts` (v3 only) | TUI fixture tests |
26
25
  | Review's `packages/review-protocol/package.json` and `packages/review/package.json` | Exact package version pins |
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Mirrors src/protocol/mod.rs and src/pairing.rs. See ../README.md for sync checks.
2
+ * Mirrors crates/diffr-core/src/protocol/mod.rs and crates/diffr-core/src/pairing.rs. See ../README.md for sync checks.
3
3
  * Import only zod: Review embeds this file in generated source.
4
4
  * Defaults are omitted, not null. Lines are zero-based, columns are UTF-8 bytes,
5
5
  * and ranges are half-open.
@@ -16,9 +16,7 @@ export type StructuralPairing<T> = {
16
16
  rhs: T;
17
17
  lhs?: never;
18
18
  };
19
- export declare const STRUCTURAL_DIFF_WIRE_VERSION = 4;
20
- /** Base stream version without --stream-annotations. */
21
- export declare const STRUCTURAL_DIFF_BASE_WIRE_VERSION = 3;
19
+ export declare const STRUCTURAL_DIFF_WIRE_VERSION = 3;
22
20
  export type StructuralDiffEvent = {
23
21
  type: "start";
24
22
  version: number;
@@ -28,16 +26,7 @@ export type StructuralDiffEvent = {
28
26
  } | ({
29
27
  type: "file";
30
28
  file: StructuralPairing<StructuralFileRef>;
31
- visibility?: StructuralVisibility;
32
29
  } & StructuralOutcome) | {
33
- type: "annotations";
34
- file: StructuralPairing<StructuralFileRef>;
35
- annotations: {
36
- region_id: number;
37
- label: string;
38
- }[];
39
- error?: StructuralProblem;
40
- } | {
41
30
  type: "complete";
42
31
  succeeded: number;
43
32
  failed: number;
@@ -109,7 +98,8 @@ export declare const StructuralDiffSchema: z.ZodType<StructuralDiff>;
109
98
  export type StructuralSource = {
110
99
  text: string;
111
100
  syntax?: StructuralSyntaxSpan[];
112
- regions?: StructuralRegion[];
101
+ /** The whole file, as one fold. Both sides' roots share a fold_state_id; its visibility is the file's. */
102
+ root: StructuralRegion;
113
103
  };
114
104
  export declare const StructuralSourceSchema: z.ZodType<StructuralSource>;
115
105
  export type StructuralBinaryRef = {
@@ -138,6 +128,10 @@ export type StructuralNode = {
138
128
  } | {
139
129
  kind: "fold";
140
130
  children: StructuralRegion[];
131
+ /** Where the fold's content starts. Collapsed rows sit at this column. */
132
+ indent: StructuralPos;
133
+ /** From the opener to the closer, before rounding to lines. Absent without an opener. */
134
+ syntax?: StructuralSourceRange;
141
135
  };
142
136
  export declare const StructuralNodeSchema: z.ZodType<StructuralNode>;
143
137
  export type StructuralSpan = {
package/dist/contract.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Mirrors src/protocol/mod.rs and src/pairing.rs. See ../README.md for sync checks.
2
+ * Mirrors crates/diffr-core/src/protocol/mod.rs and crates/diffr-core/src/pairing.rs. See ../README.md for sync checks.
3
3
  * Import only zod: Review embeds this file in generated source.
4
4
  * Defaults are omitted, not null. Lines are zero-based, columns are UTF-8 bytes,
5
5
  * and ranges are half-open.
@@ -13,9 +13,7 @@ function structuralPairingSchema(value) {
13
13
  ]);
14
14
  }
15
15
  const structuralU32 = z.number().int().min(0).max(0xffff_ffff);
16
- export const STRUCTURAL_DIFF_WIRE_VERSION = 4;
17
- /** Base stream version without --stream-annotations. */
18
- export const STRUCTURAL_DIFF_BASE_WIRE_VERSION = 3;
16
+ export const STRUCTURAL_DIFF_WIRE_VERSION = 3;
19
17
  export const StructuralDiffEventSchema = z.lazy(() => z.union([
20
18
  z.object({
21
19
  type: z.literal("start"),
@@ -28,15 +26,8 @@ export const StructuralDiffEventSchema = z.lazy(() => z.union([
28
26
  .object({
29
27
  type: z.literal("file"),
30
28
  file: structuralPairingSchema(StructuralFileRefSchema),
31
- visibility: StructuralVisibilitySchema.optional(),
32
29
  })
33
30
  .and(StructuralOutcomeSchema),
34
- z.object({
35
- type: z.literal("annotations"),
36
- file: structuralPairingSchema(StructuralFileRefSchema),
37
- annotations: z.array(z.object({ region_id: structuralU32, label: z.string() })),
38
- error: StructuralProblemSchema.optional(),
39
- }),
40
31
  z.object({
41
32
  type: z.literal("complete"),
42
33
  succeeded: structuralU32,
@@ -100,7 +91,7 @@ export const StructuralDiffSchema = z.lazy(() => z.union([
100
91
  export const StructuralSourceSchema = z.lazy(() => z.object({
101
92
  text: z.string(),
102
93
  syntax: z.array(StructuralSyntaxSpanSchema).optional(),
103
- regions: z.array(StructuralRegionSchema).optional(),
94
+ root: StructuralRegionSchema,
104
95
  }));
105
96
  export const StructuralBinaryRefSchema = z.lazy(() => z.object({ size: z.number().int().nonnegative() }));
106
97
  export const StructuralSyntaxSpanSchema = z.lazy(() => z.object({
@@ -127,6 +118,8 @@ export const StructuralNodeSchema = z.lazy(() => z.union([
127
118
  z.object({
128
119
  kind: z.literal("fold"),
129
120
  children: z.array(StructuralRegionSchema),
121
+ indent: StructuralPosSchema,
122
+ syntax: StructuralSourceRangeSchema.optional(),
130
123
  }),
131
124
  ]));
132
125
  export const StructuralSpanSchema = z.lazy(() => z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev.fast/diffr",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "diffr's NDJSON wire contract, validators, and the diffr binary for this platform",
5
5
  "repository": "https://github.com/devdotfast/diffr",
6
6
  "license": "MIT",
@@ -39,10 +39,10 @@
39
39
  "node": ">=20"
40
40
  },
41
41
  "optionalDependencies": {
42
- "@dev.fast/diffr-darwin-arm64": "0.1.11",
43
- "@dev.fast/diffr-darwin-x64": "0.1.11",
44
- "@dev.fast/diffr-linux-x64": "0.1.11",
45
- "@dev.fast/diffr-linux-arm64": "0.1.11",
46
- "@dev.fast/diffr-win32-x64": "0.1.11"
42
+ "@dev.fast/diffr-darwin-arm64": "0.1.12",
43
+ "@dev.fast/diffr-darwin-x64": "0.1.12",
44
+ "@dev.fast/diffr-linux-x64": "0.1.12",
45
+ "@dev.fast/diffr-linux-arm64": "0.1.12",
46
+ "@dev.fast/diffr-win32-x64": "0.1.12"
47
47
  }
48
48
  }
package/src/contract.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Mirrors src/protocol/mod.rs and src/pairing.rs. See ../README.md for sync checks.
2
+ * Mirrors crates/diffr-core/src/protocol/mod.rs and crates/diffr-core/src/pairing.rs. See ../README.md for sync checks.
3
3
  * Import only zod: Review embeds this file in generated source.
4
4
  * Defaults are omitted, not null. Lines are zero-based, columns are UTF-8 bytes,
5
5
  * and ranges are half-open.
@@ -24,9 +24,7 @@ function structuralPairingSchema<T>(
24
24
 
25
25
  const structuralU32 = z.number().int().min(0).max(0xffff_ffff);
26
26
 
27
- export const STRUCTURAL_DIFF_WIRE_VERSION = 4;
28
- /** Base stream version without --stream-annotations. */
29
- export const STRUCTURAL_DIFF_BASE_WIRE_VERSION = 3;
27
+ export const STRUCTURAL_DIFF_WIRE_VERSION = 3;
30
28
 
31
29
  export type StructuralDiffEvent =
32
30
  | {
@@ -39,14 +37,7 @@ export type StructuralDiffEvent =
39
37
  | ({
40
38
  type: "file";
41
39
  file: StructuralPairing<StructuralFileRef>;
42
- visibility?: StructuralVisibility;
43
40
  } & StructuralOutcome)
44
- | {
45
- type: "annotations";
46
- file: StructuralPairing<StructuralFileRef>;
47
- annotations: { region_id: number; label: string }[];
48
- error?: StructuralProblem;
49
- }
50
41
  | {
51
42
  type: "complete";
52
43
  succeeded: number;
@@ -68,17 +59,8 @@ export const StructuralDiffEventSchema: z.ZodType<StructuralDiffEvent> = z.lazy(
68
59
  .object({
69
60
  type: z.literal("file"),
70
61
  file: structuralPairingSchema(StructuralFileRefSchema),
71
- visibility: StructuralVisibilitySchema.optional(),
72
62
  })
73
63
  .and(StructuralOutcomeSchema),
74
- z.object({
75
- type: z.literal("annotations"),
76
- file: structuralPairingSchema(StructuralFileRefSchema),
77
- annotations: z.array(
78
- z.object({ region_id: structuralU32, label: z.string() }),
79
- ),
80
- error: StructuralProblemSchema.optional(),
81
- }),
82
64
  z.object({
83
65
  type: z.literal("complete"),
84
66
  succeeded: structuralU32,
@@ -233,14 +215,15 @@ export const StructuralDiffSchema: z.ZodType<StructuralDiff> = z.lazy(() =>
233
215
  export type StructuralSource = {
234
216
  text: string;
235
217
  syntax?: StructuralSyntaxSpan[];
236
- regions?: StructuralRegion[];
218
+ /** The whole file, as one fold. Both sides' roots share a fold_state_id; its visibility is the file's. */
219
+ root: StructuralRegion;
237
220
  };
238
221
 
239
222
  export const StructuralSourceSchema: z.ZodType<StructuralSource> = z.lazy(() =>
240
223
  z.object({
241
224
  text: z.string(),
242
225
  syntax: z.array(StructuralSyntaxSpanSchema).optional(),
243
- regions: z.array(StructuralRegionSchema).optional(),
226
+ root: StructuralRegionSchema,
244
227
  }),
245
228
  );
246
229
 
@@ -290,7 +273,14 @@ export const StructuralRegionSchema: z.ZodType<StructuralRegion> = z.lazy(() =>
290
273
 
291
274
  export type StructuralNode =
292
275
  | { kind: "leaf"; alignment_id: number; changed?: StructuralSpan[] }
293
- | { kind: "fold"; children: StructuralRegion[] };
276
+ | {
277
+ kind: "fold";
278
+ children: StructuralRegion[];
279
+ /** Where the fold's content starts. Collapsed rows sit at this column. */
280
+ indent: StructuralPos;
281
+ /** From the opener to the closer, before rounding to lines. Absent without an opener. */
282
+ syntax?: StructuralSourceRange;
283
+ };
294
284
 
295
285
  export const StructuralNodeSchema: z.ZodType<StructuralNode> = z.lazy(() =>
296
286
  z.union([
@@ -302,6 +292,8 @@ export const StructuralNodeSchema: z.ZodType<StructuralNode> = z.lazy(() =>
302
292
  z.object({
303
293
  kind: z.literal("fold"),
304
294
  children: z.array(StructuralRegionSchema),
295
+ indent: StructuralPosSchema,
296
+ syntax: StructuralSourceRangeSchema.optional(),
305
297
  }),
306
298
  ]),
307
299
  );