@plannotator/sem-jiff 0.0.0-stage → 0.2.2

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 (70) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/LICENSE-APACHE +191 -0
  3. package/LICENSE-MIT +21 -0
  4. package/README.md +122 -2
  5. package/THIRD-PARTY-NOTICES +367 -0
  6. package/dist/candidate.d.ts +14 -0
  7. package/dist/candidate.js +1 -0
  8. package/dist/classifier.d.ts +25 -0
  9. package/dist/classifier.js +32 -0
  10. package/dist/copy-wasm-bin.d.ts +2 -0
  11. package/dist/copy-wasm-bin.js +11 -0
  12. package/dist/copy-wasm.d.ts +3 -0
  13. package/dist/copy-wasm.js +43 -0
  14. package/dist/coverage.d.ts +7 -0
  15. package/dist/coverage.js +43 -0
  16. package/dist/edits.d.ts +10 -0
  17. package/dist/edits.js +230 -0
  18. package/dist/extract.d.ts +5 -0
  19. package/dist/extract.js +24 -0
  20. package/dist/grammars.d.ts +22 -0
  21. package/dist/grammars.js +37 -0
  22. package/dist/index.d.ts +79 -0
  23. package/dist/index.js +581 -0
  24. package/dist/inline.d.ts +21 -0
  25. package/dist/inline.js +959 -0
  26. package/dist/languages.d.ts +2 -0
  27. package/dist/languages.js +28 -0
  28. package/dist/linediff.d.ts +28 -0
  29. package/dist/linediff.js +205 -0
  30. package/dist/opinions.d.ts +84 -0
  31. package/dist/opinions.js +201 -0
  32. package/dist/pairing.d.ts +10 -0
  33. package/dist/pairing.js +269 -0
  34. package/dist/parse.d.ts +119 -0
  35. package/dist/parse.js +1293 -0
  36. package/dist/pierre-types.d.ts +101 -0
  37. package/dist/pierre-types.js +5 -0
  38. package/dist/runtime.d.ts +48 -0
  39. package/dist/runtime.js +60 -0
  40. package/dist/structure.d.ts +23 -0
  41. package/dist/structure.js +1111 -0
  42. package/dist/summary.d.ts +19 -0
  43. package/dist/summary.js +15 -0
  44. package/dist/symbol-types.d.ts +18 -0
  45. package/dist/symbol-types.js +1 -0
  46. package/dist/symbols.d.ts +6 -0
  47. package/dist/symbols.js +458 -0
  48. package/dist/syntax.d.ts +69 -0
  49. package/dist/syntax.js +450 -0
  50. package/dist/textdiff.d.ts +15 -0
  51. package/dist/textdiff.js +64 -0
  52. package/dist/textmoves.d.ts +8 -0
  53. package/dist/textmoves.js +143 -0
  54. package/package.json +108 -4
  55. package/src/candidate.ts +10 -0
  56. package/src/grammars.ts +44 -0
  57. package/src/opinions.ts +271 -0
  58. package/wasm/SHA256SUMS +12 -0
  59. package/wasm/tree-sitter-c_sharp.wasm +0 -0
  60. package/wasm/tree-sitter-go.wasm +0 -0
  61. package/wasm/tree-sitter-java.wasm +0 -0
  62. package/wasm/tree-sitter-kotlin.wasm +0 -0
  63. package/wasm/tree-sitter-php.wasm +0 -0
  64. package/wasm/tree-sitter-python.wasm +0 -0
  65. package/wasm/tree-sitter-ruby.wasm +0 -0
  66. package/wasm/tree-sitter-rust.wasm +0 -0
  67. package/wasm/tree-sitter-swift.wasm +0 -0
  68. package/wasm/tree-sitter-tsx.wasm +0 -0
  69. package/wasm/tree-sitter-typescript.wasm +0 -0
  70. package/wasm/web-tree-sitter.wasm +0 -0
@@ -0,0 +1,367 @@
1
+ THIRD-PARTY NOTICES
2
+
3
+ @plannotator/sem-jiff is licensed MIT OR Apache-2.0 (LICENSE-MIT, LICENSE-APACHE). It ships the
4
+ WebAssembly files below, built by their authors and copied unchanged into wasm/, and code copied
5
+ from Pierre. Each keeps its own licence, reproduced here.
6
+
7
+
8
+ web-tree-sitter
9
+ ---------------
10
+ Files: wasm/web-tree-sitter.wasm
11
+ Version: 0.27.1 (npm)
12
+ Source: https://github.com/tree-sitter/tree-sitter
13
+ License: MIT
14
+ Copyright (c) 2018 Max Brunsfeld
15
+
16
+ The MIT License (MIT)
17
+
18
+ Copyright (c) 2018 Max Brunsfeld
19
+
20
+ Permission is hereby granted, free of charge, to any person obtaining a copy
21
+ of this software and associated documentation files (the "Software"), to deal
22
+ in the Software without restriction, including without limitation the rights
23
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ copies of the Software, and to permit persons to whom the Software is
25
+ furnished to do so, subject to the following conditions:
26
+
27
+ The above copyright notice and this permission notice shall be included in all
28
+ copies or substantial portions of the Software.
29
+
30
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
+ SOFTWARE.
37
+
38
+
39
+ tree-sitter-typescript
40
+ ----------------------
41
+ Files: wasm/tree-sitter-typescript.wasm, wasm/tree-sitter-tsx.wasm
42
+ Version: 0.23.2 (npm)
43
+ Source: https://github.com/tree-sitter/tree-sitter-typescript
44
+ License: MIT
45
+ Copyright (c) 2017 Max Brunsfeld
46
+
47
+ The MIT License (MIT)
48
+
49
+ Copyright (c) 2017 Max Brunsfeld
50
+
51
+ Permission is hereby granted, free of charge, to any person obtaining a copy
52
+ of this software and associated documentation files (the "Software"), to deal
53
+ in the Software without restriction, including without limitation the rights
54
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55
+ copies of the Software, and to permit persons to whom the Software is
56
+ furnished to do so, subject to the following conditions:
57
+
58
+ The above copyright notice and this permission notice shall be included in all
59
+ copies or substantial portions of the Software.
60
+
61
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
66
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
67
+ SOFTWARE.
68
+
69
+
70
+ tree-sitter-python
71
+ ------------------
72
+ Files: wasm/tree-sitter-python.wasm
73
+ Version: 0.25.0 (npm)
74
+ Source: https://github.com/tree-sitter/tree-sitter-python
75
+ License: MIT
76
+ Copyright (c) 2016 Max Brunsfeld
77
+
78
+ The MIT License (MIT)
79
+
80
+ Copyright (c) 2016 Max Brunsfeld
81
+
82
+ Permission is hereby granted, free of charge, to any person obtaining a copy
83
+ of this software and associated documentation files (the "Software"), to deal
84
+ in the Software without restriction, including without limitation the rights
85
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
86
+ copies of the Software, and to permit persons to whom the Software is
87
+ furnished to do so, subject to the following conditions:
88
+
89
+ The above copyright notice and this permission notice shall be included in all
90
+ copies or substantial portions of the Software.
91
+
92
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
94
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
95
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
97
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
98
+ SOFTWARE.
99
+
100
+
101
+ tree-sitter-go
102
+ --------------
103
+ Files: wasm/tree-sitter-go.wasm
104
+ Version: 0.25.0 (npm)
105
+ Source: https://github.com/tree-sitter/tree-sitter-go
106
+ License: MIT
107
+ Copyright (c) 2014 Max Brunsfeld
108
+
109
+ The MIT License (MIT)
110
+
111
+ Copyright (c) 2014 Max Brunsfeld
112
+
113
+ Permission is hereby granted, free of charge, to any person obtaining a copy
114
+ of this software and associated documentation files (the "Software"), to deal
115
+ in the Software without restriction, including without limitation the rights
116
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
117
+ copies of the Software, and to permit persons to whom the Software is
118
+ furnished to do so, subject to the following conditions:
119
+
120
+ The above copyright notice and this permission notice shall be included in all
121
+ copies or substantial portions of the Software.
122
+
123
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
124
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
125
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
126
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
127
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
128
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
129
+ SOFTWARE.
130
+
131
+
132
+ tree-sitter-rust
133
+ ----------------
134
+ Files: wasm/tree-sitter-rust.wasm
135
+ Version: 0.24.0 (npm)
136
+ Source: https://github.com/tree-sitter/tree-sitter-rust
137
+ License: MIT
138
+ Copyright (c) 2017 Maxim Sokolov
139
+
140
+ The MIT License (MIT)
141
+
142
+ Copyright (c) 2017 Maxim Sokolov
143
+
144
+ Permission is hereby granted, free of charge, to any person obtaining a copy
145
+ of this software and associated documentation files (the "Software"), to deal
146
+ in the Software without restriction, including without limitation the rights
147
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
148
+ copies of the Software, and to permit persons to whom the Software is
149
+ furnished to do so, subject to the following conditions:
150
+
151
+ The above copyright notice and this permission notice shall be included in all
152
+ copies or substantial portions of the Software.
153
+
154
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
155
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
156
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
157
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
158
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
159
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
160
+ SOFTWARE.
161
+
162
+
163
+ tree-sitter-java
164
+ ----------------
165
+ Files: wasm/tree-sitter-java.wasm
166
+ Version: 0.23.5 (npm)
167
+ Source: https://github.com/tree-sitter/tree-sitter-java
168
+ License: MIT
169
+ Copyright (c) 2017 Ayman Nadeem
170
+
171
+ MIT License
172
+
173
+ Copyright (c) 2017 Ayman Nadeem
174
+
175
+ Permission is hereby granted, free of charge, to any person obtaining a copy
176
+ of this software and associated documentation files (the "Software"), to deal
177
+ in the Software without restriction, including without limitation the rights
178
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
179
+ copies of the Software, and to permit persons to whom the Software is
180
+ furnished to do so, subject to the following conditions:
181
+
182
+ The above copyright notice and this permission notice shall be included in all
183
+ copies or substantial portions of the Software.
184
+
185
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
186
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
187
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
188
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
189
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
190
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
191
+ SOFTWARE.
192
+
193
+
194
+ tree-sitter-c-sharp
195
+ -------------------
196
+ Files: wasm/tree-sitter-c_sharp.wasm
197
+ Version: 0.23.5 (npm)
198
+ Source: https://github.com/tree-sitter/tree-sitter-c-sharp
199
+ License: MIT
200
+ Copyright (c) 2014-2023 Max Brunsfeld, Damien Guard, Amaan Qureshi, and contributors.
201
+
202
+ The MIT License (MIT)
203
+
204
+ Copyright (c) 2014-2023 Max Brunsfeld, Damien Guard, Amaan Qureshi, and contributors.
205
+
206
+ Permission is hereby granted, free of charge, to any person obtaining a copy
207
+ of this software and associated documentation files (the "Software"), to deal
208
+ in the Software without restriction, including without limitation the rights
209
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
210
+ copies of the Software, and to permit persons to whom the Software is
211
+ furnished to do so, subject to the following conditions:
212
+
213
+ The above copyright notice and this permission notice shall be included in all
214
+ copies or substantial portions of the Software.
215
+
216
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
217
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
218
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
219
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
220
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
221
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
222
+ SOFTWARE.
223
+
224
+
225
+ tree-sitter-php
226
+ ---------------
227
+ Files: wasm/tree-sitter-php.wasm
228
+ Version: 0.24.2 (npm)
229
+ Source: https://github.com/tree-sitter/tree-sitter-php
230
+ License: MIT
231
+ Copyright (c) 2017 Josh Vera, GitHub
232
+ Copyright (c) 2019 Max Brunsfeld, Amaan Qureshi, Christian Frøystad, Caleb White
233
+
234
+ The MIT License (MIT)
235
+
236
+ Copyright (c) 2017 Josh Vera, GitHub
237
+ Copyright (c) 2019 Max Brunsfeld, Amaan Qureshi, Christian Frøystad, Caleb White
238
+
239
+ Permission is hereby granted, free of charge, to any person obtaining a copy
240
+ of this software and associated documentation files (the "Software"), to deal
241
+ in the Software without restriction, including without limitation the rights
242
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
243
+ copies of the Software, and to permit persons to whom the Software is
244
+ furnished to do so, subject to the following conditions:
245
+
246
+ The above copyright notice and this permission notice shall be included in all
247
+ copies or substantial portions of the Software.
248
+
249
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
250
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
251
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
252
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
253
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
254
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
255
+ SOFTWARE.
256
+
257
+
258
+ tree-sitter-ruby
259
+ ----------------
260
+ Files: wasm/tree-sitter-ruby.wasm
261
+ Version: 0.23.1 (npm)
262
+ Source: https://github.com/tree-sitter/tree-sitter-ruby
263
+ License: MIT
264
+ Copyright (c) 2016 Rob Rix
265
+
266
+ The MIT License (MIT)
267
+
268
+ Copyright (c) 2016 Rob Rix
269
+
270
+ Permission is hereby granted, free of charge, to any person obtaining a copy
271
+ of this software and associated documentation files (the "Software"), to deal
272
+ in the Software without restriction, including without limitation the rights
273
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
274
+ copies of the Software, and to permit persons to whom the Software is
275
+ furnished to do so, subject to the following conditions:
276
+
277
+ The above copyright notice and this permission notice shall be included in all
278
+ copies or substantial portions of the Software.
279
+
280
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
281
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
282
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
283
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
284
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
285
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
286
+ SOFTWARE.
287
+
288
+
289
+ @tree-sitter-grammars/tree-sitter-kotlin
290
+ ----------------------------------------
291
+ Files: wasm/tree-sitter-kotlin.wasm
292
+ Version: 1.1.0 (release asset of tag v1.1.0, commit 77dd60e; vendored in vendor/tree-sitter-kotlin/)
293
+ Source: https://github.com/tree-sitter-grammars/tree-sitter-kotlin
294
+ License: MIT
295
+ Copyright (c) 2024 Amaan Qureshi <amaanq12@gmail.com>
296
+
297
+ The MIT License (MIT)
298
+
299
+ Copyright (c) 2024 Amaan Qureshi <amaanq12@gmail.com>
300
+
301
+ Permission is hereby granted, free of charge, to any person obtaining a copy
302
+ of this software and associated documentation files (the "Software"), to deal
303
+ in the Software without restriction, including without limitation the rights
304
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
305
+ copies of the Software, and to permit persons to whom the Software is
306
+ furnished to do so, subject to the following conditions:
307
+
308
+ The above copyright notice and this permission notice shall be included in all
309
+ copies or substantial portions of the Software.
310
+
311
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
312
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
313
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
314
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
315
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
316
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
317
+ SOFTWARE.
318
+
319
+
320
+ tree-sitter-swift
321
+ -----------------
322
+ Files: wasm/tree-sitter-swift.wasm
323
+ Version: 0.7.3 (release asset of tag 0.7.3, commit b8b22bf; vendored in vendor/tree-sitter-swift/)
324
+ Source: https://github.com/alex-pinkus/tree-sitter-swift
325
+ License: MIT
326
+ Copyright (c) 2021 alex-pinkus
327
+
328
+ MIT License
329
+
330
+ Copyright (c) 2021 alex-pinkus
331
+
332
+ Permission is hereby granted, free of charge, to any person obtaining a copy
333
+ of this software and associated documentation files (the "Software"), to deal
334
+ in the Software without restriction, including without limitation the rights
335
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
336
+ copies of the Software, and to permit persons to whom the Software is
337
+ furnished to do so, subject to the following conditions:
338
+
339
+ The above copyright notice and this permission notice shall be included in all
340
+ copies or substantial portions of the Software.
341
+
342
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
343
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
344
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
345
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
346
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
347
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
348
+ SOFTWARE.
349
+
350
+
351
+ Pierre (@pierre/diffs)
352
+ ----------------------
353
+ Files: dist/pierre-types.js, dist/pierre-types.d.ts (compiled from src/pierre-types.ts, the operation types
354
+ copied from pierrecomputer/pierre, packages/diffs/src/types.ts); test/fixtures/pierre-inlined-function-go.json
355
+ (from packages/diffs/test/mocks.ts) in the source repository
356
+ Source: https://github.com/pierrecomputer/pierre
357
+ License: Apache-2.0
358
+ Copyright 2025 Pierre Computer Company
359
+
360
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
361
+ this file except in compliance with the License. The full text of the License is
362
+ in LICENSE-APACHE in this package, and at http://www.apache.org/licenses/LICENSE-2.0
363
+
364
+ Unless required by applicable law or agreed to in writing, software distributed
365
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
366
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
367
+ specific language governing permissions and limitations under the License.
@@ -0,0 +1,14 @@
1
+ /** One extract/inline candidate, as a second opinion sees it. */
2
+ export interface Candidate {
3
+ kind: 'extract' | 'inline';
4
+ /** The file's name, as given to `semanticDiffFile` (filled in for per-diff second opinions). */
5
+ file?: string;
6
+ helper: string;
7
+ caller: string;
8
+ /** Source text. For an extract, `caller` is the new caller and `callerNew` the old one (extract is inline run backwards). */
9
+ code: {
10
+ helper: string;
11
+ caller: string;
12
+ callerNew: string;
13
+ };
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ export interface Evidence {
2
+ helperTokens: number;
3
+ freshTokens: number;
4
+ statements: number;
5
+ movedStatements: number;
6
+ strictPairs: number;
7
+ strictShare: number;
8
+ strictMeanSim: number;
9
+ loosePairs: number;
10
+ looseShare: number;
11
+ bagDice: number;
12
+ nameOverlap: number;
13
+ hasValue: boolean;
14
+ valueTokens: number;
15
+ valueInFresh: boolean;
16
+ calls: number;
17
+ oneLine: boolean;
18
+ sizeRatio: number;
19
+ extract: boolean;
20
+ }
21
+ /** Accept at or above this probability: in the leave-one-project-out test it added 19 real finds, no wrong or borderline claims. */
22
+ export declare const LEARNED_THRESHOLD = 0.96;
23
+ /** How likely the helper's code really moved out of (or into) the caller. */
24
+ export declare function probabilityMoved(e: Evidence): number;
25
+ export declare const likelyMoved: (e: Evidence) => boolean;
@@ -0,0 +1,32 @@
1
+ // The learned check: logistic regression over the evidence the rules already compute
2
+ // (src/inline.ts `evidence`). When enabled (`learned: true`, or SEMANTIC_LEARNED=1) it accepts a
3
+ // candidate the strict rules rejected only when it is very sure, and only if the rules' guards
4
+ // still pass. Off by default: on held-out sets it added no finds (and a few borderline claims). Weights are fitted on the practice labels only (never the held-out sets) by
5
+ // harness/classifier/train.py, tested by leaving one project out at a time: at the threshold
6
+ // below it added real finds and no wrong claims on projects it had not seen.
7
+ // Regenerate with: node harness/classifier/collect.ts ... && python3 harness/classifier/train.py ...
8
+ /** Trained on 2497 labelled practice candidates. */
9
+ const WEIGHTS = [0.586754, 0.159521, -0.821424, -0.123089, -0.0664206, 0.394717, 0.333287, 0.395416, 0.0742788, 0.234799, 0.541936, 1.62382, -0.111766, 0.369967, 0.220235, -0.0340056, 0.103244, -0.0111614, 0.321449];
10
+ const MEAN = [0, 4.06016, 5.15742, 1.20636, 0.8487, 0.353072, 0.194875, 0.275466, 0.463732, 0.242795, 0.410743, 0.621634, 0.787345, 2.19216, 0.18302, 0.833884, 0.221466, 0.545169, 0.809772];
11
+ const SCALE = [1, 1.01747, 1.65572, 0.555586, 0.770106, 0.617633, 0.334477, 0.426533, 0.63914, 0.337316, 0.322124, 0.319834, 0.409186, 1.67004, 0.386683, 0.312158, 0.415233, 0.651023, 0.392481];
12
+ /** Accept at or above this probability: in the leave-one-project-out test it added 19 real finds, no wrong or borderline claims. */
13
+ export const LEARNED_THRESHOLD = 0.96;
14
+ /** The same features, in the same order, as harness/classifier/train.py `feats`. */
15
+ function features(e) {
16
+ const L = Math.log1p;
17
+ return [
18
+ 1, L(e.helperTokens), L(e.freshTokens), L(e.statements), L(e.movedStatements),
19
+ L(e.strictPairs), e.strictShare, e.strictMeanSim, L(e.loosePairs), e.looseShare,
20
+ e.bagDice, e.nameOverlap, +e.hasValue, L(e.valueTokens), +e.valueInFresh,
21
+ L(e.calls), +e.oneLine, Math.min(e.sizeRatio, 5), +e.extract,
22
+ ];
23
+ }
24
+ /** How likely the helper's code really moved out of (or into) the caller. */
25
+ export function probabilityMoved(e) {
26
+ const x = features(e);
27
+ let z = 0;
28
+ for (let i = 0; i < x.length; i++)
29
+ z += WEIGHTS[i] * (x[i] - MEAN[i]) / SCALE[i];
30
+ return 1 / (1 + Math.exp(-Math.max(-30, Math.min(30, z))));
31
+ }
32
+ export const likelyMoved = (e) => probabilityMoved(e) >= LEARNED_THRESHOLD;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ // `sem-jiff-copy-wasm <dest-dir>`: copy every wasm file the package ships into <dest-dir> (see copy-wasm.ts).
3
+ import { copyWasm } from "./copy-wasm.js";
4
+ const { argv, exit } = globalThis.process;
5
+ const dest = argv[2] ?? '';
6
+ if (!dest) {
7
+ console.error('usage: sem-jiff-copy-wasm <dest-dir>');
8
+ exit(2);
9
+ }
10
+ const written = await copyWasm(dest);
11
+ console.log(`sem-jiff: ${written.length} wasm files in ${dest}`);
@@ -0,0 +1,3 @@
1
+ import { type SemDiffWasmFile } from './grammars.js';
2
+ /** Copy `files` (default: all of SEM_DIFF_WASM_FILES) into `destDir`, creating it; returns the paths written. */
3
+ export declare function copyWasm(destDir: string, files?: readonly SemDiffWasmFile[]): Promise<string[]>;
@@ -0,0 +1,43 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
9
+ // Copies the package's wasm files (web-tree-sitter's runtime and every grammar) into a host's own folder, for a
10
+ // page or a compiled binary that serves or embeds them under these names. Node only. Each file is checked against
11
+ // the package's wasm/SHA256SUMS on the way. Also the `sem-jiff-copy-wasm <dest-dir>` bin.
12
+ import { SEM_DIFF_WASM_FILES } from "./grammars.js";
13
+ /** Copy `files` (default: all of SEM_DIFF_WASM_FILES) into `destDir`, creating it; returns the paths written. */
14
+ export async function copyWasm(destDir, files = SEM_DIFF_WASM_FILES) {
15
+ const fsName = 'node:fs';
16
+ const pathName = 'node:path';
17
+ const urlName = 'node:url';
18
+ const cryptoName = 'node:crypto';
19
+ // Node's modules, loaded only when called, typed by what is used here (the package builds without Node's types).
20
+ const fs = (await import(__rewriteRelativeImportExtension(/* @vite-ignore */ fsName)));
21
+ const path = (await import(__rewriteRelativeImportExtension(/* @vite-ignore */ pathName)));
22
+ const { fileURLToPath } = (await import(__rewriteRelativeImportExtension(/* @vite-ignore */ urlName)));
23
+ const { createHash } = (await import(__rewriteRelativeImportExtension(/* @vite-ignore */ cryptoName)));
24
+ // Built in a variable: a template in `new URL(..., import.meta.url)` would make bundlers glob the folder.
25
+ const folderPath = '../wasm/';
26
+ const folder = fileURLToPath(new URL(/* @vite-ignore */ folderPath, import.meta.url));
27
+ const sums = new Map(fs.readFileSync(path.join(folder, 'SHA256SUMS'), 'utf8').trim().split('\n').map((line) => {
28
+ const [sum, name] = line.split(/\s+/);
29
+ return [name, sum];
30
+ }));
31
+ fs.mkdirSync(destDir, { recursive: true });
32
+ const written = [];
33
+ for (const name of files) {
34
+ const bytes = fs.readFileSync(path.join(folder, name));
35
+ const got = createHash('sha256').update(bytes).digest('hex');
36
+ if (got !== sums.get(name))
37
+ throw new Error(`sem-jiff: ${name} has sha256 ${got}, expected ${sums.get(name) ?? 'none (not in SHA256SUMS)'}`);
38
+ const to = path.join(destDir, name);
39
+ fs.writeFileSync(to, bytes);
40
+ written.push(to);
41
+ }
42
+ return written;
43
+ }
@@ -0,0 +1,7 @@
1
+ import type { SemanticDiffOperation } from './pierre-types.js';
2
+ import type { ChangeBlock } from './linediff.js';
3
+ /** `inString`: blank lines inside multi-line strings, which are content, not spacing. */
4
+ export declare function uncoveredChanges(blocks: ChangeBlock[], oldText: string, newText: string, ops: SemanticDiffOperation[], inString?: {
5
+ old: Set<number>;
6
+ new: Set<number>;
7
+ }): SemanticDiffOperation[];
@@ -0,0 +1,43 @@
1
+ import { range } from "./syntax.js";
2
+ /** `inString`: blank lines inside multi-line strings, which are content, not spacing. */
3
+ export function uncoveredChanges(blocks, oldText, newText, ops, inString = { old: new Set(), new: new Set() }) {
4
+ const owned = { old: new Set(), new: new Set() };
5
+ for (const op of ops)
6
+ for (const side of ['old', 'new'])
7
+ for (const l of op.lines[side])
8
+ for (let n = l.start; n <= l.end; n++)
9
+ owned[side].add(n);
10
+ const oldLines = oldText.split('\n');
11
+ const newLines = newText.split('\n');
12
+ const missing = [];
13
+ for (const b of blocks) {
14
+ if (b.old)
15
+ for (let l = b.old.start; l <= b.old.end; l++)
16
+ if (((oldLines[l - 1] ?? '').trim() || inString.old.has(l)) && !owned.old.has(l))
17
+ missing.push({ side: 'old', line: l, other: b.new?.start ?? b.newAt });
18
+ if (b.new)
19
+ for (let l = b.new.start; l <= b.new.end; l++)
20
+ if (((newLines[l - 1] ?? '').trim() || inString.new.has(l)) && !owned.new.has(l))
21
+ missing.push({ side: 'new', line: l, other: b.old?.start ?? b.oldAt });
22
+ }
23
+ // Consecutive lines on one side become one operation.
24
+ const out = [];
25
+ const newCount = Math.max(1, newText.split('\n').length - (newText.endsWith('\n') ? 1 : 0));
26
+ const oldCount = Math.max(1, oldText.split('\n').length - (oldText.endsWith('\n') ? 1 : 0));
27
+ for (let i = 0; i < missing.length;) {
28
+ const first = missing[i];
29
+ let j = i;
30
+ while (j + 1 < missing.length && missing[j + 1].side === first.side && missing[j + 1].line === missing[j].line + 1)
31
+ j++;
32
+ const last = missing[j];
33
+ const lines = { start: first.line, end: last.line };
34
+ const otherCount = first.side === 'old' ? newCount : oldCount;
35
+ const attach = first.other <= otherCount ? { line: first.other, edge: 'before' } : { line: otherCount, edge: 'after' };
36
+ const r = range({ line: lines.start, character: 0 }, { line: lines.end + 1, character: 0 });
37
+ out.push(first.side === 'old'
38
+ ? { type: 'deleted', spans: [{ role: 'root', relation: 'removed', old: [r] }], lines: { old: [{ ...lines, spanIndex: 0, attachment: attach }], new: [] } }
39
+ : { type: 'added', spans: [{ role: 'root', relation: 'introduced', new: [r] }], lines: { old: [], new: [{ ...lines, spanIndex: 0, attachment: attach }] } });
40
+ i = j + 1;
41
+ }
42
+ return out;
43
+ }
@@ -0,0 +1,10 @@
1
+ import type { SemanticDiffOperation } from './pierre-types.js';
2
+ import type { ChangeBlock } from './linediff.js';
3
+ /** A text replacement in file offsets: old [start, end) becomes newText. */
4
+ export interface Replacement {
5
+ start: number;
6
+ end: number;
7
+ newText: string;
8
+ }
9
+ export declare function detectEdits(replacements: Replacement[], oldText: string, newText: string): SemanticDiffOperation[];
10
+ export declare function replacementsFromBlocks(blocks: ChangeBlock[], oldText: string, newText: string): Replacement[];