circle-ir 4.18.1 → 4.20.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.
Files changed (185) hide show
  1. package/dist/analysis/advisories.d.ts +21 -3
  2. package/dist/analysis/advisories.d.ts.map +1 -1
  3. package/dist/analysis/advisories.js +26 -8
  4. package/dist/analysis/advisories.js.map +1 -1
  5. package/dist/analysis/arg-executing-programs.d.ts +16 -0
  6. package/dist/analysis/arg-executing-programs.d.ts.map +1 -0
  7. package/dist/analysis/arg-executing-programs.js +24 -0
  8. package/dist/analysis/arg-executing-programs.js.map +1 -0
  9. package/dist/analysis/config-loader.d.ts.map +1 -1
  10. package/dist/analysis/config-loader.js +32 -23
  11. package/dist/analysis/config-loader.js.map +1 -1
  12. package/dist/analysis/constant-caller-gate.d.ts +3 -1
  13. package/dist/analysis/constant-caller-gate.d.ts.map +1 -1
  14. package/dist/analysis/constant-caller-gate.js +108 -1
  15. package/dist/analysis/constant-caller-gate.js.map +1 -1
  16. package/dist/analysis/constant-propagation/index.d.ts.map +1 -1
  17. package/dist/analysis/constant-propagation/index.js +1 -1
  18. package/dist/analysis/constant-propagation/index.js.map +1 -1
  19. package/dist/analysis/constant-propagation/patterns.d.ts.map +1 -1
  20. package/dist/analysis/constant-propagation/patterns.js +5 -0
  21. package/dist/analysis/constant-propagation/patterns.js.map +1 -1
  22. package/dist/analysis/constant-propagation/propagator.d.ts +1 -1
  23. package/dist/analysis/constant-propagation/propagator.d.ts.map +1 -1
  24. package/dist/analysis/constant-propagation/propagator.js +15 -1
  25. package/dist/analysis/constant-propagation/propagator.js.map +1 -1
  26. package/dist/analysis/constant-propagation/types.d.ts +2 -0
  27. package/dist/analysis/constant-propagation/types.d.ts.map +1 -1
  28. package/dist/analysis/dependency-versions.d.ts +33 -0
  29. package/dist/analysis/dependency-versions.d.ts.map +1 -1
  30. package/dist/analysis/dependency-versions.js +70 -0
  31. package/dist/analysis/dependency-versions.js.map +1 -1
  32. package/dist/analysis/interprocedural.d.ts +6 -0
  33. package/dist/analysis/interprocedural.d.ts.map +1 -1
  34. package/dist/analysis/interprocedural.js +53 -6
  35. package/dist/analysis/interprocedural.js.map +1 -1
  36. package/dist/analysis/js-helper-return.d.ts +12 -0
  37. package/dist/analysis/js-helper-return.d.ts.map +1 -0
  38. package/dist/analysis/js-helper-return.js +64 -0
  39. package/dist/analysis/js-helper-return.js.map +1 -0
  40. package/dist/analysis/passes/constant-propagation-pass.d.ts.map +1 -1
  41. package/dist/analysis/passes/constant-propagation-pass.js +1 -0
  42. package/dist/analysis/passes/constant-propagation-pass.js.map +1 -1
  43. package/dist/analysis/passes/cross-file-pass.d.ts.map +1 -1
  44. package/dist/analysis/passes/cross-file-pass.js +61 -0
  45. package/dist/analysis/passes/cross-file-pass.js.map +1 -1
  46. package/dist/analysis/passes/csharp-sanitizer-credit.d.ts.map +1 -1
  47. package/dist/analysis/passes/csharp-sanitizer-credit.js +60 -3
  48. package/dist/analysis/passes/csharp-sanitizer-credit.js.map +1 -1
  49. package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts +15 -0
  50. package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts.map +1 -1
  51. package/dist/analysis/passes/deserialization-safety-gate-pass.js +60 -1
  52. package/dist/analysis/passes/deserialization-safety-gate-pass.js.map +1 -1
  53. package/dist/analysis/passes/interprocedural-pass.d.ts +23 -1
  54. package/dist/analysis/passes/interprocedural-pass.d.ts.map +1 -1
  55. package/dist/analysis/passes/interprocedural-pass.js +148 -6
  56. package/dist/analysis/passes/interprocedural-pass.js.map +1 -1
  57. package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
  58. package/dist/analysis/passes/language-sources-pass.js +150 -7
  59. package/dist/analysis/passes/language-sources-pass.js.map +1 -1
  60. package/dist/analysis/passes/resource-leak-pass.d.ts.map +1 -1
  61. package/dist/analysis/passes/resource-leak-pass.js +20 -4
  62. package/dist/analysis/passes/resource-leak-pass.js.map +1 -1
  63. package/dist/analysis/passes/sink-filter-pass.d.ts.map +1 -1
  64. package/dist/analysis/passes/sink-filter-pass.js +229 -8
  65. package/dist/analysis/passes/sink-filter-pass.js.map +1 -1
  66. package/dist/analysis/passes/taint-propagation-pass.d.ts +7 -3
  67. package/dist/analysis/passes/taint-propagation-pass.d.ts.map +1 -1
  68. package/dist/analysis/passes/taint-propagation-pass.js +176 -15
  69. package/dist/analysis/passes/taint-propagation-pass.js.map +1 -1
  70. package/dist/analysis/passes/xml-entity-expansion-pass.d.ts.map +1 -1
  71. package/dist/analysis/passes/xml-entity-expansion-pass.js +50 -6
  72. package/dist/analysis/passes/xml-entity-expansion-pass.js.map +1 -1
  73. package/dist/analysis/pep440-version.d.ts +40 -0
  74. package/dist/analysis/pep440-version.d.ts.map +1 -0
  75. package/dist/analysis/pep440-version.js +149 -0
  76. package/dist/analysis/pep440-version.js.map +1 -0
  77. package/dist/analysis/rules.d.ts.map +1 -1
  78. package/dist/analysis/rules.js +6 -0
  79. package/dist/analysis/rules.js.map +1 -1
  80. package/dist/analysis/sbom.d.ts +43 -4
  81. package/dist/analysis/sbom.d.ts.map +1 -1
  82. package/dist/analysis/sbom.js +265 -33
  83. package/dist/analysis/sbom.js.map +1 -1
  84. package/dist/analysis/taint-matcher.d.ts.map +1 -1
  85. package/dist/analysis/taint-matcher.js +107 -5
  86. package/dist/analysis/taint-matcher.js.map +1 -1
  87. package/dist/analyzer.d.ts +6 -0
  88. package/dist/analyzer.d.ts.map +1 -1
  89. package/dist/analyzer.js +27 -1
  90. package/dist/analyzer.js.map +1 -1
  91. package/dist/browser/circle-ir.js +3379 -101
  92. package/dist/core/circle-ir-core.cjs +218 -35
  93. package/dist/core/circle-ir-core.js +218 -35
  94. package/dist/core/extractors/dfg.js +46 -7
  95. package/dist/core/extractors/dfg.js.map +1 -1
  96. package/dist/core/extractors/ts-declaration-detail.d.ts +8 -0
  97. package/dist/core/extractors/ts-declaration-detail.d.ts.map +1 -1
  98. package/dist/core/extractors/ts-declaration-detail.js +22 -0
  99. package/dist/core/extractors/ts-declaration-detail.js.map +1 -1
  100. package/dist/facts/arrow.d.ts +106 -0
  101. package/dist/facts/arrow.d.ts.map +1 -0
  102. package/dist/facts/arrow.js +196 -0
  103. package/dist/facts/arrow.js.map +1 -0
  104. package/dist/facts/facts2.d.ts +59 -0
  105. package/dist/facts/facts2.d.ts.map +1 -0
  106. package/dist/facts/facts2.js +362 -0
  107. package/dist/facts/facts2.js.map +1 -0
  108. package/dist/facts/index.d.ts +20 -0
  109. package/dist/facts/index.d.ts.map +1 -0
  110. package/dist/facts/index.js +14 -0
  111. package/dist/facts/index.js.map +1 -0
  112. package/dist/facts/java-facts.d.ts +56 -0
  113. package/dist/facts/java-facts.d.ts.map +1 -0
  114. package/dist/facts/java-facts.js +250 -0
  115. package/dist/facts/java-facts.js.map +1 -0
  116. package/dist/facts/order.d.ts +39 -0
  117. package/dist/facts/order.d.ts.map +1 -0
  118. package/dist/facts/order.js +120 -0
  119. package/dist/facts/order.js.map +1 -0
  120. package/dist/facts/schema.d.ts +60 -0
  121. package/dist/facts/schema.d.ts.map +1 -0
  122. package/dist/facts/schema.js +126 -0
  123. package/dist/facts/schema.js.map +1 -0
  124. package/dist/facts/schema2.d.ts +47 -0
  125. package/dist/facts/schema2.d.ts.map +1 -0
  126. package/dist/facts/schema2.js +194 -0
  127. package/dist/facts/schema2.js.map +1 -0
  128. package/dist/facts/table.d.ts +80 -0
  129. package/dist/facts/table.d.ts.map +1 -0
  130. package/dist/facts/table.js +548 -0
  131. package/dist/facts/table.js.map +1 -0
  132. package/dist/graph-facts/dead-code.d.ts +2 -0
  133. package/dist/graph-facts/dead-code.d.ts.map +1 -1
  134. package/dist/graph-facts/dead-code.js +1 -1
  135. package/dist/graph-facts/dead-code.js.map +1 -1
  136. package/dist/graph-facts/reach.d.ts +24 -6
  137. package/dist/graph-facts/reach.d.ts.map +1 -1
  138. package/dist/graph-facts/reach.js +52 -12
  139. package/dist/graph-facts/reach.js.map +1 -1
  140. package/dist/graph-facts/removal-reach.d.ts +2 -0
  141. package/dist/graph-facts/removal-reach.d.ts.map +1 -1
  142. package/dist/graph-facts/removal-reach.js +1 -1
  143. package/dist/graph-facts/removal-reach.js.map +1 -1
  144. package/dist/index.d.ts +10 -4
  145. package/dist/index.d.ts.map +1 -1
  146. package/dist/index.js +13 -2
  147. package/dist/index.js.map +1 -1
  148. package/dist/navigation/java-graph.d.ts +23 -0
  149. package/dist/navigation/java-graph.d.ts.map +1 -1
  150. package/dist/navigation/java-graph.js +222 -8
  151. package/dist/navigation/java-graph.js.map +1 -1
  152. package/dist/navigation/navigation-index.d.ts +9 -0
  153. package/dist/navigation/navigation-index.d.ts.map +1 -1
  154. package/dist/navigation/navigation-index.js +25 -0
  155. package/dist/navigation/navigation-index.js.map +1 -1
  156. package/dist/navigation/ts-call-edges.d.ts +9 -0
  157. package/dist/navigation/ts-call-edges.d.ts.map +1 -1
  158. package/dist/navigation/ts-call-edges.js.map +1 -1
  159. package/dist/resolution/cross-file.d.ts +46 -0
  160. package/dist/resolution/cross-file.d.ts.map +1 -1
  161. package/dist/resolution/cross-file.js +281 -13
  162. package/dist/resolution/cross-file.js.map +1 -1
  163. package/dist/stable-ids/files.d.ts +22 -0
  164. package/dist/stable-ids/files.d.ts.map +1 -0
  165. package/dist/stable-ids/files.js +28 -0
  166. package/dist/stable-ids/files.js.map +1 -0
  167. package/dist/stable-ids/hash.d.ts +16 -4
  168. package/dist/stable-ids/hash.d.ts.map +1 -1
  169. package/dist/stable-ids/hash.js +266 -80
  170. package/dist/stable-ids/hash.js.map +1 -1
  171. package/dist/stable-ids/index.d.ts +3 -2
  172. package/dist/stable-ids/index.d.ts.map +1 -1
  173. package/dist/stable-ids/index.js +3 -2
  174. package/dist/stable-ids/index.js.map +1 -1
  175. package/dist/stable-ids/nodes.d.ts +45 -1
  176. package/dist/stable-ids/nodes.d.ts.map +1 -1
  177. package/dist/stable-ids/nodes.js +118 -15
  178. package/dist/stable-ids/nodes.js.map +1 -1
  179. package/dist/stable-ids/ts-parse-errors.d.ts +5 -1
  180. package/dist/stable-ids/ts-parse-errors.d.ts.map +1 -1
  181. package/dist/stable-ids/ts-parse-errors.js +35 -2
  182. package/dist/stable-ids/ts-parse-errors.js.map +1 -1
  183. package/package.json +8 -4
  184. package/schemas/facts@1.json +134 -0
  185. package/schemas/facts@2.json +216 -0
@@ -8,6 +8,10 @@
8
8
  * edit to one function therefore leaves every other function's node ids
9
9
  * unchanged, and the index is safe because a body id names one body version.
10
10
  */
11
+ import { blake3Short128Into, digest128Bytes } from './hash.js';
12
+ import { STABLE_ID_SCHEME } from './types.js';
13
+ const NODE_TAG = { block: 'b', def: 'd', use: 'u', call: 'c' };
14
+ const NODE_KIND_OF_TAG = { b: 'block', d: 'def', u: 'use', c: 'call' };
11
15
  /** Position compare on (line, column); `column` absent means the whole line. */
12
16
  function encloses(d, line, column) {
13
17
  if (line < d.start_line || line > d.end_line)
@@ -26,16 +30,28 @@ function spanSize(d) {
26
30
  }
27
31
  class Locator {
28
32
  spans;
33
+ /** Spans enclosing a line, by line, filled on first use: a file's nodes cluster on few lines, and a snapshot asks a million times. */
34
+ byLine = new Map();
29
35
  constructor(file) {
30
36
  this.spans = file.decls
31
37
  .filter(d => d.body_hash !== '')
32
38
  .map(decl => ({ decl, size: spanSize(decl) }));
33
39
  }
40
+ onLine(line) {
41
+ let list = this.byLine.get(line);
42
+ if (list === undefined) {
43
+ list = this.spans.filter(s => line >= s.decl.start_line && line <= s.decl.end_line);
44
+ this.byLine.set(line, list);
45
+ }
46
+ return list;
47
+ }
34
48
  /** Innermost declaration enclosing the position. */
35
49
  at(line, column) {
50
+ const candidates = this.onLine(line);
36
51
  let best = null;
37
- for (const s of this.spans) {
38
- if (!encloses(s.decl, line, column))
52
+ for (let i = 0; i < candidates.length; i++) {
53
+ const s = candidates[i];
54
+ if (column !== undefined && !encloses(s.decl, line, column))
39
55
  continue;
40
56
  if (best === null || s.size <= best.size)
41
57
  best = s;
@@ -62,16 +78,103 @@ export function declLocator(file) {
62
78
  const loc = new Locator(file);
63
79
  return (line, column) => loc.at(line, column);
64
80
  }
65
- function keyAll(items, tag, find) {
81
+ /**
82
+ * Places every item of one IR array (all of one node kind) in its innermost
83
+ * enclosing body and numbers it there, in array order, per body — the local
84
+ * index of an `ids@0.1` node id. `null` where no body encloses the item.
85
+ */
86
+ export function locateNodes(file, items, find) {
87
+ const loc = new Locator(file);
88
+ const at = (line, column) => loc.at(line, column);
89
+ // Counted per declaration object; two declarations never share a body id in one file.
66
90
  const counters = new Map();
67
- return items.map(item => {
68
- const decl = find(item);
69
- if (!decl)
70
- return null;
71
- const n = counters.get(decl.body_id) ?? 0;
72
- counters.set(decl.body_id, n + 1);
73
- return `${decl.body_id}/${tag}${n}`;
74
- });
91
+ const out = new Array(items.length);
92
+ for (let i = 0; i < items.length; i++) {
93
+ const decl = find(items[i], at);
94
+ if (!decl) {
95
+ out[i] = null;
96
+ continue;
97
+ }
98
+ const ordinal = counters.get(decl) ?? 0;
99
+ counters.set(decl, ordinal + 1);
100
+ out[i] = { decl, ordinal };
101
+ }
102
+ return out;
103
+ }
104
+ function keyAll(file, items, kind, find) {
105
+ return locateNodes(file, items, find).map(n => (n === null ? null : printedNodeId(n.decl.body_id, kind, n.ordinal)));
106
+ }
107
+ /** The printed `ids@0.1` node id: `<body_id>/<tag><ordinal>`. */
108
+ export function printedNodeId(bodyId, kind, ordinal) {
109
+ return `${bodyId}/${NODE_TAG[kind]}${ordinal}`;
110
+ }
111
+ /**
112
+ * The fixed-width form of an `ids@0.1` node id (stable-ids design decision
113
+ * 1a, 2026-11-01): the 128-bit `digest128` over the parts
114
+ * `ids@0.1 · node · <body_id> · <kind> · <ordinal>` — the scheme, the
115
+ * literal `node`, the printed body id (`<decl id>.<body_hash>`), the kind
116
+ * word (`block`, `def`, `use`, `call`) and the ordinal in decimal — each
117
+ * followed by NUL, BLAKE3, first 16 bytes. The same width as every other id,
118
+ * so a `facts@1` `fixed16` column can hold it; it is a function of the
119
+ * printed node id and nothing else.
120
+ */
121
+ export function nodeIdBytes(bodyId, kind, ordinal) {
122
+ return digest128Bytes([STABLE_ID_SCHEME, 'node', bodyId, kind, String(ordinal)]);
123
+ }
124
+ /** `nodeIdBytes` of a printed node id (`<body_id>/<tag><ordinal>`). */
125
+ export function nodeIdBytesOfPrinted(printed) {
126
+ const slash = printed.lastIndexOf('/');
127
+ const kind = slash >= 0 ? NODE_KIND_OF_TAG[printed[slash + 1]] : undefined;
128
+ const ordinal = slash >= 0 ? Number(printed.slice(slash + 2)) : NaN;
129
+ if (kind === undefined || !Number.isInteger(ordinal) || ordinal < 0 || String(ordinal) !== printed.slice(slash + 2)) {
130
+ throw new Error(`stable-ids: not a printed node id: ${JSON.stringify(printed)}`);
131
+ }
132
+ return nodeIdBytes(printed.slice(0, slash), kind, ordinal);
133
+ }
134
+ const encoder = new TextEncoder();
135
+ /**
136
+ * `nodeIdBytes` for many nodes of one body and kind without re-encoding the
137
+ * parts: the fixed prefix (`ids@0.1 NUL node NUL <body_id> NUL <kind> NUL`)
138
+ * is encoded once, each ordinal's decimal digits and NUL are written after
139
+ * it, and the 16 bytes land in `out` at `offset`. Equal to `nodeIdBytes`
140
+ * byte for byte (tested).
141
+ */
142
+ export class NodeIdWriter {
143
+ buffer = new Uint8Array(256);
144
+ prefixLength = 0;
145
+ bodyId = '';
146
+ kind = '';
147
+ /** Select the body and kind the next `write` calls are for. */
148
+ forBody(bodyId, kind) {
149
+ if (bodyId === this.bodyId && kind === this.kind)
150
+ return;
151
+ this.bodyId = bodyId;
152
+ this.kind = kind;
153
+ const prefix = `${STABLE_ID_SCHEME}\u0000node\u0000${bodyId}\u0000${kind}\u0000`;
154
+ const { read, written } = encoder.encodeInto(prefix, this.buffer);
155
+ // An ids@0.1 body id is 53 characters; the buffer leaves room for the ordinal after it.
156
+ if (read !== prefix.length || written > this.buffer.length - 24)
157
+ throw new RangeError(`stable-ids: body id too long for a node id: ${JSON.stringify(bodyId)}`);
158
+ this.prefixLength = written;
159
+ }
160
+ write(ordinal, out, offset) {
161
+ const b = this.buffer;
162
+ let n = this.prefixLength;
163
+ if (ordinal === 0)
164
+ b[n++] = 0x30;
165
+ else {
166
+ const start = n;
167
+ for (let v = ordinal; v > 0; v = Math.floor(v / 10))
168
+ b[n++] = 0x30 + (v % 10);
169
+ for (let i = start, j = n - 1; i < j; i++, j--) {
170
+ const t = b[i];
171
+ b[i] = b[j];
172
+ b[j] = t;
173
+ }
174
+ }
175
+ b[n++] = 0;
176
+ blake3Short128Into(b.subarray(0, n), out, offset);
177
+ }
75
178
  }
76
179
  /**
77
180
  * Node ids parallel to the IR arrays: `<body_id>/b<n>` for CFG blocks,
@@ -83,10 +186,10 @@ function keyAll(items, tag, find) {
83
186
  export function assignNodeIds(file, ir) {
84
187
  const loc = new Locator(file);
85
188
  return {
86
- cfg_blocks: keyAll(ir.cfg?.blocks ?? [], 'b', b => loc.range(b.start_line, b.end_line)),
87
- dfg_defs: keyAll(ir.dfg?.defs ?? [], 'd', d => loc.at(d.line, d.column)),
88
- dfg_uses: keyAll(ir.dfg?.uses ?? [], 'u', u => loc.at(u.line, u.column)),
89
- calls: keyAll(ir.calls ?? [], 'c', c => loc.at(c.location.line, c.location.column)),
189
+ cfg_blocks: keyAll(file, ir.cfg?.blocks ?? [], 'block', b => loc.range(b.start_line, b.end_line)),
190
+ dfg_defs: keyAll(file, ir.dfg?.defs ?? [], 'def', (d, at) => at(d.line, d.column)),
191
+ dfg_uses: keyAll(file, ir.dfg?.uses ?? [], 'use', (u, at) => at(u.line, u.column)),
192
+ calls: keyAll(file, ir.calls ?? [], 'call', (c, at) => at(c.location.line, c.location.column)),
90
193
  };
91
194
  }
92
195
  //# sourceMappingURL=nodes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/stable-ids/nodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAiBH,gFAAgF;AAChF,SAAS,QAAQ,CAAC,CAA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CAAC;KAC/F,CAAC;AACJ,CAAC"}
@@ -9,7 +9,11 @@
9
9
  * `ERROR` node inside the `type_annotation`;
10
10
  * - in a `const x: import('m').T[]` / `type A = import('m').T[]` declaration
11
11
  * the parser inserts a `MISSING ";"` after the import type and reads the
12
- * `[]` (plus any initializer) as the next expression statement.
12
+ * `[]` (plus any initializer) as the next expression statement; with a
13
+ * union or intersection (`import('m').T[] | undefined`) that statement is
14
+ * `[] | undefined`;
15
+ * - `importOriginal<typeof import('m')>()` as a declarator's value leaves an
16
+ * `ERROR` of `>()` after the declarator.
13
17
  *
14
18
  * Either way every declaration is still in the tree, so the file is not
15
19
  * "partial" for stable ids or dead code. Any other error still is.
@@ -1 +1 @@
1
- {"version":3,"file":"ts-parse-errors.d.ts","sourceRoot":"","sources":["../../src/stable-ids/ts-parse-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA0DjD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE7D;AAED,uEAAuE;AACvE,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,GAAG,SAAS,CAElF"}
1
+ {"version":3,"file":"ts-parse-errors.d.ts","sourceRoot":"","sources":["../../src/stable-ids/ts-parse-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAuFjD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE7D;AAED,uEAAuE;AACvE,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,GAAG,SAAS,CAElF"}
@@ -21,7 +21,13 @@ function insideTypeContext(n) {
21
21
  function isSplitArraySuffix(n) {
22
22
  if (!n || n.type !== 'expression_statement')
23
23
  return false;
24
- const e = n.namedChild(0);
24
+ let e = n.namedChild(0);
25
+ // `import('m').T[] | undefined` / `… & B`: the rest of a union or
26
+ // intersection type is read as `[] | undefined`, a bitwise expression whose
27
+ // leftmost operand is the split-off `[]` (cognium-dev#1004).
28
+ while (e && e.type === 'binary_expression' && /^[|&]$/.test(e.child(1)?.type ?? '')) {
29
+ e = e.childForFieldName('left');
30
+ }
25
31
  if (!e)
26
32
  return false;
27
33
  if (e.type === 'array')
@@ -53,9 +59,36 @@ function isSplitImportArrayDeclaration(missing) {
53
59
  const holder = decl.parent?.type === 'export_statement' ? decl.parent : decl;
54
60
  return isSplitArraySuffix(holder.nextNamedSibling);
55
61
  }
62
+ /**
63
+ * `const actual = await importOriginal<typeof import('m')>();` (the vitest
64
+ * mock idiom): the grammar reads `<` as a comparison against
65
+ * `typeof import('m')`, and the leftover `>()` becomes an `ERROR` holding `>`
66
+ * and an empty parameter list, right after the declarator. The declaration is
67
+ * still in the tree and nothing follows inside the error (cognium-dev#1004).
68
+ * When the recovery instead swallows the next statement (a `class` read as an
69
+ * expression), the error sits elsewhere and still counts.
70
+ */
71
+ function isSplitTypeofImportCall(n) {
72
+ if (n.parent?.type !== 'lexical_declaration' || n.childCount !== 2)
73
+ return false;
74
+ const [gt, params] = [n.child(0), n.child(1)];
75
+ if (gt?.type !== '>' || params?.type !== 'formal_parameters' || params.namedChildCount !== 0)
76
+ return false;
77
+ const declarator = n.previousNamedSibling;
78
+ if (declarator?.type !== 'variable_declarator')
79
+ return false;
80
+ const value = declarator.childForFieldName('value');
81
+ if (value?.type !== 'binary_expression' || value.child(1)?.type !== '<')
82
+ return false;
83
+ const right = value.childForFieldName('right');
84
+ if (right?.type !== 'unary_expression' || right.child(0)?.type !== 'typeof')
85
+ return false;
86
+ const arg = right.namedChild(0);
87
+ return arg?.type === 'call_expression' && arg.childForFieldName('function')?.type === 'import';
88
+ }
56
89
  function isBenign(n) {
57
90
  if (n.type === 'ERROR')
58
- return insideTypeContext(n);
91
+ return insideTypeContext(n) || isSplitTypeofImportCall(n);
59
92
  if (n.isMissing)
60
93
  return n.type === ';' && isSplitImportArrayDeclaration(n);
61
94
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"ts-parse-errors.js","sourceRoot":"","sources":["../../src/stable-ids/ts-parse-errors.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACrE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAExG,6FAA6F;AAC7F,SAAS,sBAAsB,CAAC,CAAc;IAC5C,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,mBAAmB;QAAE,OAAO,KAAK,CAAC;IACvD,MAAM,GAAG,GAAG,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,IAAI,GAAG,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,IAAI,KAAK,QAAQ,CAAC;AACzG,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAO;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;QACvC,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAC3C,IAAI,CAAC,CAAC,IAAI,KAAK,iBAAiB,IAAI,CAAC,CAAC,IAAI,KAAK,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CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IACtF,MAAM,KAAK,GAAG,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC/C,IAAI,KAAK,EAAE,IAAI,KAAK,kBAAkB,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC1F,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,OAAO,GAAG,EAAE,IAAI,KAAK,iBAAiB,IAAI,GAAG,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,IAAI,KAAK,QAAQ,CAAC;AACjG,CAAC;AAED,SAAS,QAAQ,CAAC,CAAO;IACvB,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC,IAAI,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAClF,IAAI,CAAC,CAAC,SAAS;QAAE,OAAO,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,6BAA6B,CAAC,CAAC,CAAC,CAAC;IAC3E,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAU;IAClD,OAAO,2BAA2B,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;AACzD,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,2BAA2B,CAAC,IAAU;IACpD,OAAO,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "circle-ir",
3
- "version": "4.18.1",
3
+ "version": "4.20.0",
4
4
  "description": "High-performance Static Application Security Testing (SAST) library for detecting security vulnerabilities through taint analysis",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -27,6 +27,7 @@
27
27
  "dist",
28
28
  "configs",
29
29
  "examples",
30
+ "schemas",
30
31
  "docs/SPEC.md"
31
32
  ],
32
33
  "scripts": {
@@ -34,8 +35,8 @@
34
35
  "test:watch": "vitest",
35
36
  "test:coverage": "vitest run --coverage",
36
37
  "build": "tsc && node scripts/copy-wasm.mjs",
37
- "build:browser": "esbuild src/browser.ts --bundle --format=esm --platform=browser --external:fs --external:fs/promises --external:path --external:module --external:crypto --outfile=dist/browser/circle-ir.js && mkdir -p dist/wasm && cp ../../node_modules/web-tree-sitter/web-tree-sitter.wasm dist/wasm/ && cp wasm/*.wasm dist/wasm/",
38
- "build:core": "esbuild src/core-lib.ts --bundle --format=esm --platform=neutral --external:fs --external:fs/promises --external:path --external:module --external:crypto --outfile=dist/core/circle-ir-core.js && esbuild src/core-lib.ts --bundle --format=cjs --platform=neutral --external:fs --external:fs/promises --external:path --external:module --external:crypto --outfile=dist/core/circle-ir-core.cjs && cp dist/core-lib.d.ts dist/core/circle-ir-core.d.ts",
38
+ "build:browser": "esbuild src/browser.ts --bundle --format=esm --platform=browser --external:fs --external:fs/promises --external:path --external:module --external:crypto --external:apache-arrow --outfile=dist/browser/circle-ir.js && mkdir -p dist/wasm && cp ../../node_modules/web-tree-sitter/web-tree-sitter.wasm dist/wasm/ && cp wasm/*.wasm dist/wasm/",
39
+ "build:core": "esbuild src/core-lib.ts --bundle --format=esm --platform=neutral --external:fs --external:fs/promises --external:path --external:module --external:crypto --external:apache-arrow --outfile=dist/core/circle-ir-core.js && esbuild src/core-lib.ts --bundle --format=cjs --platform=neutral --external:fs --external:fs/promises --external:path --external:module --external:crypto --external:apache-arrow --outfile=dist/core/circle-ir-core.cjs && cp dist/core-lib.d.ts dist/core/circle-ir-core.d.ts",
39
40
  "build:all": "npm run build && npm run build:browser && npm run build:core",
40
41
  "clean": "rm -rf dist coverage *.tsbuildinfo *.tgz",
41
42
  "typecheck": "tsc --noEmit",
@@ -98,7 +99,7 @@
98
99
  "yaml": "^2.9.1"
99
100
  },
100
101
  "devDependencies": {
101
- "@types/node": "^26.6.5",
102
+ "@types/node": "^26.6.6",
102
103
  "@vitest/coverage-v8": "^5.0.5",
103
104
  "esbuild": "^0.28.0",
104
105
  "tree-sitter-bash": "^0.25.1",
@@ -109,5 +110,8 @@
109
110
  "tree-sitter-typescript": "^0.23.2",
110
111
  "typescript": "^7.0.2",
111
112
  "vitest": "^5.0.1"
113
+ },
114
+ "optionalDependencies": {
115
+ "apache-arrow": "21.1.0"
112
116
  }
113
117
  }
@@ -0,0 +1,134 @@
1
+ {
2
+ "$comment": "facts@1 (graph-store plan 0.1, T1). The fact relations circle-ir owes the store, as Arrow columns in canonical order keyed by ids@0.1 (stable-ids plan adopted 2026-11-01). The contract follows the 2026-11-01 reconciliation record (decisions 1-11) and the stable-ids decision 1a of the same evening (fixed-width node ids, so flow fills): 128-bit ids, sets with no nulls, the producer's metadata keys, hex digests. This file is the schema the store reads; the TypeScript mirror is src/facts/schema.ts and tests/facts/schema.test.ts locks the two together.",
3
+ "scheme": "facts@1",
4
+ "ids": "ids@0.1",
5
+ "id_encoding": {
6
+ "$comment": "An ids@0.1 id is 128 bits printed as 26 lowercase base32 characters (RFC 4648, unpadded). In a column it is the 16 raw bytes, so every id column is FixedSizeBinary(16); the 2 trailing padding bits of the printed form are always zero. Node ids (the flow endpoints) have the same width: see node_id.",
7
+ "arrow": "fixed_size_binary",
8
+ "width": 16
9
+ },
10
+ "node_id": {
11
+ "$comment": "The fixed-width form of an ids@0.1 node id (stable-ids design decision 1a, adopted 2026-11-01): digest128 over the parts listed, i.e. BLAKE3 of the UTF-8 parts each followed by NUL, first 16 bytes - the same construction as every other ids@0.1 id, printed as 26 base32 characters where a printed form is needed. body_id is the printed body id of the innermost declaration whose body encloses the node (<decl id>.<body_hash>, 53 characters; after the snapshot's #n re-key where decl applied one); kind is the IR array the node comes from; ordinal counts the nodes of that kind inside that body in IR array order, from 0, in decimal without leading zeros. It is a function of the printed node id <body_id>/<tag><ordinal> (tags b, d, u, c) and nothing else: an edit to one body re-keys only that body's nodes. The example is a test vector (tests/facts/schema.test.ts recomputes it).",
12
+ "parts": ["ids@0.1", "node", "<body_id>", "<kind>", "<ordinal>"],
13
+ "kinds": ["block", "def", "use", "call"],
14
+ "example": {
15
+ "printed": "aaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbb/u7",
16
+ "body_id": "aaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbb",
17
+ "kind": "use",
18
+ "ordinal": 7,
19
+ "hex": "cd071ce8a3b6d97cc2dd1264742bb62d",
20
+ "base32": "zudrz2fdw3mxzqw5cjshik5wfu"
21
+ }
22
+ },
23
+ "types": {
24
+ "$comment": "The closed set of column types. `dict` is Dictionary<Int8 index, Utf8 value> over a fixed vocabulary listed on the column; the whole vocabulary is written as the dictionary, in the listed order, whether or not every value occurs.",
25
+ "fixed16": "FixedSizeBinary(16)",
26
+ "u32": "Uint32",
27
+ "utf8": "Utf8",
28
+ "bool": "Bool",
29
+ "dict": "Dictionary<Int8, Utf8>"
30
+ },
31
+ "canonical_order": {
32
+ "$comment": "Within a relation rows are sorted ascending by the key columns in key order, then by every remaining column in schema order, so the comparator is total and a relation has one byte form. Column orders: fixed16 by unsigned bytes; u32 numerically; utf8 and dict by Unicode code point (which equals UTF-8 byte order), never by UTF-16 code unit or dictionary index; bool false before true; null before every value (a dead branch: no column is nullable). Relations are sets: after the sort exact duplicate rows are dropped and counted (manifest duplicates_dropped per relation), so rows are strictly increasing and a store may refuse equal rows.",
33
+ "key_then_remaining_columns": true,
34
+ "null_first": true,
35
+ "strings": "code-point",
36
+ "sets": true
37
+ },
38
+ "chunking": {
39
+ "$comment": "After the canonical sort a relation is cut into record batches of chunk_rows rows each (the last one shorter); a relation with no rows has no record batch. One Arrow IPC file per relation, so the batch boundaries are part of the bytes. Fixed row-count chunks were chosen over the design's file_id ranges because five of the eight relations are not keyed by file_id; see the plan's open questions.",
40
+ "chunk_rows": 65536,
41
+ "ipc": "file"
42
+ },
43
+ "metadata": {
44
+ "$comment": "Schema-level custom metadata, and nothing else (no timestamps, no host): facts (the value facts@1, never a -draft) and ids always; engine and parser when the caller names them. The producer's manifest.json beside the files repeats them and adds source, chunk_rows and per relation file, rows, batches, bytes, blake3 (file-byte digest, hex) and duplicates_dropped.",
45
+ "facts": "facts@1",
46
+ "ids": "ids@0.1",
47
+ "engine": "optional, e.g. circle-ir@4.19.0",
48
+ "parser": "optional, e.g. tree-sitter-java@0.23.5"
49
+ },
50
+ "relations": {
51
+ "files": {
52
+ "key": ["file_id"],
53
+ "columns": [
54
+ { "name": "file_id", "type": "u32", "nullable": false, "doc": "0-based index of the file in the snapshot's path-sorted (code point order) file list; dense and per snapshot." },
55
+ { "name": "path", "type": "utf8", "nullable": false, "doc": "Repository-relative, /-separated." },
56
+ { "name": "content_hash", "type": "fixed16", "nullable": false, "doc": "blake3 of the file's UTF-8 bytes, first 16 bytes." },
57
+ { "name": "language", "type": "dict", "nullable": false, "values": ["java", "typescript", "javascript", "python", "go"] }
58
+ ]
59
+ },
60
+ "decl": {
61
+ "key": ["id"],
62
+ "columns": [
63
+ { "name": "id", "type": "fixed16", "nullable": false, "doc": "ids@0.1 declaration id. Unique per snapshot: when two files derive the same id (two package-info.java of one package in different bundles), the later one in file order takes the stable-ids #n suffix on its qualified_name and the id derived from it, as the ids@0.1 duplicate rule does within one scope." },
64
+ { "name": "kind", "type": "dict", "nullable": false, "values": ["module", "type", "method", "field", "function"] },
65
+ { "name": "qualified_name", "type": "utf8", "nullable": false },
66
+ { "name": "signature", "type": "utf8", "nullable": false, "doc": "The ids@0.1 canonical signature as written; empty for modules and types without type parameters." },
67
+ { "name": "file_id", "type": "u32", "nullable": false },
68
+ { "name": "line", "type": "u32", "nullable": false, "doc": "1-based start line." },
69
+ { "name": "body_hash", "type": "fixed16", "nullable": false, "doc": "ids@0.1 body hash; all-zero bytes when the engine derived none (no nulls in facts@1; Java always derives one)." }
70
+ ]
71
+ },
72
+ "call": {
73
+ "key": ["caller_id", "site_file", "site_line", "site_col", "callee_id"],
74
+ "columns": [
75
+ { "name": "caller_id", "type": "fixed16", "nullable": false, "doc": "The enclosing declaration (the module's id for top-level code)." },
76
+ { "name": "callee_id", "type": "fixed16", "nullable": false, "doc": "The declaration that can run; one row per candidate body on polymorphic." },
77
+ { "name": "tier", "type": "dict", "nullable": false, "values": ["exact", "polymorphic", "inferred"] },
78
+ { "name": "method_name", "type": "utf8", "nullable": false, "doc": "The name as written at the site. Not in the design's column list: a (file, line, col) site names more than one call in a chained expression, and the name is what tells them apart." },
79
+ { "name": "site_file", "type": "u32", "nullable": false },
80
+ { "name": "site_line", "type": "u32", "nullable": false, "doc": "1-based." },
81
+ { "name": "site_col", "type": "u32", "nullable": false, "doc": "0-based." }
82
+ ]
83
+ },
84
+ "unresolved": {
85
+ "key": ["site_file", "site_line", "site_col", "method_name", "receiver", "reason"],
86
+ "doc": "Key: the site and the name as written (reconciliation row 9) plus receiver and reason, because on real data one site and name still carries several rows that differ only in those (T4, 2026-11-01). caller_id is a function of the site and not in the key.",
87
+ "columns": [
88
+ { "name": "caller_id", "type": "fixed16", "nullable": false },
89
+ { "name": "reason", "type": "dict", "nullable": false, "values": ["external", "dynamic", "generated", "overload-ambiguous", "parse-error", "unsupported-language", "unknown"] },
90
+ { "name": "receiver", "type": "utf8", "nullable": false, "doc": "The library type the call lands on; empty when unknown (no nulls in facts@1)." },
91
+ { "name": "method_name", "type": "utf8", "nullable": false },
92
+ { "name": "site_file", "type": "u32", "nullable": false },
93
+ { "name": "site_line", "type": "u32", "nullable": false },
94
+ { "name": "site_col", "type": "u32", "nullable": false }
95
+ ]
96
+ },
97
+ "flow": {
98
+ "key": ["from_id", "to_id", "kind"],
99
+ "columns": [
100
+ { "name": "from_id", "type": "fixed16", "nullable": false },
101
+ { "name": "to_id", "type": "fixed16", "nullable": false },
102
+ { "name": "kind", "type": "dict", "nullable": false, "values": ["def-use", "taint"] }
103
+ ],
104
+ "doc": "Def-use and taint edges on ids@0.1 node ids in their fixed-width form (node_id). The java-graph@0.1 post-pass writes one def-use row per DFG use with a reaching definition in the same file: from_id = the definition's node id (kind def), to_id = the use's node id (kind use); data flows from from_id to to_id. taint rows are not written by the post-pass yet (the engine's taint flows are line-keyed, not node-keyed); the kind stays in the vocabulary for them."
105
+ },
106
+ "imports": {
107
+ "key": ["file_id", "target", "wildcard"],
108
+ "columns": [
109
+ { "name": "file_id", "type": "u32", "nullable": false },
110
+ { "name": "target", "type": "utf8", "nullable": false, "doc": "The imported name as written, without a trailing `.*`; a static import's member path for `import static`." },
111
+ { "name": "wildcard", "type": "bool", "nullable": false, "doc": "In the key: one file may import both X and X.*, which share target." }
112
+ ]
113
+ },
114
+ "entries": {
115
+ "key": ["decl_id", "kind", "source"],
116
+ "columns": [
117
+ { "name": "decl_id", "type": "fixed16", "nullable": false },
118
+ { "name": "kind", "type": "dict", "nullable": false, "values": ["main", "route", "listener", "scheduled", "export", "di", "reflection", "lifecycle", "test", "osgi-ds", "extension-point", "data-declared", "script"], "doc": "entry-index@0.1 kinds plus the design's data-declared kinds; the engine's `bean` is written as `di` (one meaning, one word)." },
119
+ { "name": "source", "type": "utf8", "nullable": false, "doc": "What declared the entry — the annotation, the supertype member, the manifest or file; the engine's evidence line." },
120
+ { "name": "certainty", "type": "dict", "nullable": false, "values": ["declared", "conventional", "inferred"] }
121
+ ]
122
+ },
123
+ "moved": {
124
+ "key": ["old_id", "new_id"],
125
+ "columns": [
126
+ { "name": "old_id", "type": "fixed16", "nullable": false },
127
+ { "name": "new_id", "type": "fixed16", "nullable": false },
128
+ { "name": "kind", "type": "dict", "nullable": false, "values": ["moved", "renamed"] },
129
+ { "name": "evidence", "type": "utf8", "nullable": false }
130
+ ],
131
+ "doc": "Moves and renames between two snapshots: facts, not delete + insert. Empty from a single-snapshot post-pass."
132
+ }
133
+ }
134
+ }