@rightkit/release 0.2.125 → 0.2.126

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/ownership.mjs CHANGED
@@ -15,7 +15,7 @@ export const EXCEPTIONS_FILE = path.join(".rightkit", "ownership-exceptions.json
15
15
  const CODE_EXT = new Set([".rs", ".ts", ".tsx", ".js", ".mjs", ".cjs", ".jsx", ".swift", ".m", ".mm", ".c", ".cc", ".cpp", ".h", ".py", ".go", ".kt", ".java", ".cs"]);
16
16
  // Listed installed/build inputs retain explicit coverage diagnostics.
17
17
  const OPAQUE_DIRS = new Set(["target", ".build", "DerivedData", "Pods"]);
18
- export const SCANNER_VERSION = "2.3.0";
18
+ export const SCANNER_VERSION = "2.4.0";
19
19
  export const catalogDigest = (manifest) => sha256(manifest);
20
20
  const byteDigest = (bytes) => createHash("sha256").update(bytes).digest("hex");
21
21
  const inputDigest = (file) => file.digest ?? byteDigest(file.bytes);
@@ -25,7 +25,7 @@ const catalogCache = new Map();
25
25
  function sourceMatchers(manifest) {
26
26
  const digest = catalogDigest(manifest);
27
27
  if (catalogCache.has(digest)) return catalogCache.get(digest);
28
- const sources = manifest.capabilities.flatMap((c) => c.fingerprints.filter((f) => f.type === "source").map((f) => ({ c, f, re: new RegExp(f.pattern, f.flags ?? "") })));
28
+ const sources = manifest.capabilities.flatMap((c) => c.fingerprints.filter((f) => f.type === "source").map((f) => ({ c, f, re: new RegExp(f.pattern, f.codeOnly ? `${(f.flags ?? "").replace(/[gy]/g, "")}g` : f.flags ?? "") })));
29
29
  let prefilter;
30
30
  try {
31
31
  // Backreferences cannot be relocated safely inside one alternation. In that
@@ -40,15 +40,74 @@ function sourceMatchers(manifest) {
40
40
  return matchers;
41
41
  }
42
42
 
43
+ // Code-only patterns may consume string arguments, but must start outside
44
+ // literals/comments. Keep offsets/newlines intact for multiline call reporting.
45
+ function sourceNonCode(text, rust) {
46
+ const nonCode = new Uint8Array(text.length);
47
+ for (let i = 0; i < text.length;) {
48
+ const start = i;
49
+ if (text.startsWith("//", i) || text.startsWith("/*", i)) {
50
+ if (text[i + 1] === "/") {
51
+ i = text.indexOf("\n", i + 2);
52
+ if (i === -1) i = text.length;
53
+ } else {
54
+ i += 2;
55
+ let depth = 1;
56
+ while (i < text.length && depth) {
57
+ if (rust && text.startsWith("/*", i)) { depth++; i += 2; }
58
+ else if (text.startsWith("*/", i)) { depth--; i += 2; }
59
+ else i++;
60
+ }
61
+ }
62
+ nonCode.fill(1, start, i);
63
+ continue;
64
+ }
65
+ const raw = rust && (i === 0 || !/[\w]/.test(text[i - 1])) && /^(?:br|cr|r)(#*)"/.exec(text.slice(i));
66
+ if (raw) {
67
+ const closing = `"${raw[1]}`, end = text.indexOf(closing, i + raw[0].length);
68
+ i = end === -1 ? text.length : end + closing.length;
69
+ } else if (text[i] === '"' || (!rust && (text[i] === "'" || text[i] === "`")) ||
70
+ (rust && text[i] === "'" && /^'(?:\\(?:u\{[\da-fA-F]+\}|x[\da-fA-F]{2}|[^\r\n])|[^'\\\r\n])'/.test(text.slice(i)))) {
71
+ const quote = text[i++];
72
+ while (i < text.length) {
73
+ if (text[i] === "\\") i = Math.min(i + 2, text.length);
74
+ else if (text[i++] === quote) break;
75
+ }
76
+ } else { i++; continue; }
77
+ nonCode.fill(1, start, i);
78
+ }
79
+ return nonCode;
80
+ }
81
+
43
82
  function sourceFindings(file, matchers) {
44
- const key = `${matchers.digest}:${file.cacheKey ?? inputDigest(file)}`;
83
+ const ext = path.posix.extname(file.rel).toLowerCase();
84
+ const key = `${matchers.digest}:${ext}:${file.cacheKey ?? inputDigest(file)}`;
45
85
  if (sourceCache.has(key)) return sourceCache.get(key);
46
86
  const text = file.bytes.toString("utf8"), findings = [];
47
87
  if (matchers.prefilter.test(text)) {
48
- for (const [i, line] of text.split(/\r?\n/).entries()) if (!commentOnly(line)) for (const { c, f, re } of matchers.sources) {
88
+ const lines = text.split(/\r?\n/);
89
+ const applicable = matchers.sources.filter(({ f }) => !f.extensions || f.extensions.includes(ext));
90
+ const lineMatchers = applicable.filter(({ f }) => !f.codeOnly);
91
+ for (const [i, line] of lines.entries()) if (!commentOnly(line)) for (const { c, f, re } of lineMatchers) {
49
92
  re.lastIndex = 0;
50
93
  if (re.test(line)) findings.push({ fingerprint: f.id, capability: c.capability, package: c.package, line: i + 1, text: line.trim().slice(0, 160) });
51
94
  }
95
+ const codeMatchers = applicable.filter(({ f }) => f.codeOnly);
96
+ if (codeMatchers.length) {
97
+ const nonCode = sourceNonCode(text, ext === ".rs");
98
+ for (const { c, f, re } of codeMatchers) {
99
+ re.lastIndex = 0;
100
+ const reported = new Set();
101
+ let line = 1, offset = 0;
102
+ for (const match of text.matchAll(re)) {
103
+ if (!match[0] || nonCode[match.index]) continue;
104
+ for (; offset < match.index; offset++) if (text[offset] === "\n") line++;
105
+ if (reported.has(line)) continue;
106
+ reported.add(line);
107
+ findings.push({ fingerprint: f.id, capability: c.capability, package: c.package, line, text: lines[line - 1].trim().slice(0, 160) });
108
+ }
109
+ }
110
+ }
52
111
  }
53
112
  sourceCache.set(key, findings);
54
113
  if (sourceCache.size > 16384) sourceCache.delete(sourceCache.keys().next().value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.2.125",
3
+ "version": "0.2.126",
4
4
  "description": "Portable release CLI/SDK with fail-closed public GitHub Releases and private R2 + RightApps distribution.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -287,7 +287,16 @@
287
287
  {
288
288
  "id": "ort.env.dylib",
289
289
  "type": "source",
290
- "pattern": "ORT_DYLIB_PATH"
290
+ "pattern": "\\b(?:set_var|remove_var)\\s*\\(\\s*(?:\"ORT_DYLIB_PATH\"|ORT_DYLIB_PATH)\\s*(?=[,)])|\\bprocess\\s*\\.\\s*env\\s*\\.\\s*ORT_DYLIB_PATH\\s*=(?!=|>)|\\bdelete\\s+process\\s*\\.\\s*env\\s*\\.\\s*ORT_DYLIB_PATH\\b",
291
+ "codeOnly": true,
292
+ "extensions": [".rs", ".ts", ".tsx", ".js", ".mjs", ".cjs", ".jsx"]
293
+ },
294
+ {
295
+ "id": "ort.api.init",
296
+ "type": "source",
297
+ "pattern": "\\bort\\s*::\\s*init(?:_from)?\\s*\\(",
298
+ "codeOnly": true,
299
+ "extensions": [".rs"]
291
300
  }
292
301
  ]
293
302
  },
@@ -29,7 +29,7 @@
29
29
  "@rightkit/platform-ui": "0.1.2",
30
30
  "@rightkit/qa": "0.3.0",
31
31
  "@rightkit/qa-chrome": "0.1.3",
32
- "@rightkit/release": "0.2.125",
32
+ "@rightkit/release": "0.2.126",
33
33
  "@rightkit/settings-ui": "0.2.7",
34
34
  "@rightkit/shell": "0.1.0",
35
35
  "@rightkit/tauri": "0.1.1",
@@ -148,7 +148,8 @@
148
148
  "0.2.121",
149
149
  "0.2.122",
150
150
  "0.2.123",
151
- "0.2.124"
151
+ "0.2.124",
152
+ "0.2.125"
152
153
  ],
153
154
  "@rightkit/qa": [
154
155
  "0.1.0",
@@ -329,7 +330,7 @@
329
330
  "@rightkit/platform-ui": "0.1.2",
330
331
  "@rightkit/qa": "0.3.0",
331
332
  "@rightkit/qa-chrome": "0.1.3",
332
- "@rightkit/release": "0.2.124",
333
+ "@rightkit/release": "0.2.125",
333
334
  "@rightkit/settings-ui": "0.2.7",
334
335
  "@rightkit/shell": "0.1.0",
335
336
  "@rightkit/tauri": "0.1.1",