chore: remove stray refaudit.py — accidental scratchpad commit in #1021 (#1022)
The committed reference check is test/module-refs.test.mjs (runs in npm test); this loose Python duplicate slipped into the repo root when a worktree copied it in. Not a repo artifact.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 file changed,
+0
−35
refaudit.py+0 −35
diff --git a/refaudit.py b/refaudit.py| deleted file mode 100644 |
| index 18c4586..0000000 |
| --- a/refaudit.py |
| +++ /dev/null |
| @@ -1,35 +0,0 @@ |
| -import pathlib, re, sys |
| -# Reference audit: EVERY identifier token (not just calls) unresolved against |
| -# the module's imports, declarations (scope-blind), parameters, and globals. |
| -src = pathlib.Path(sys.argv[1]).read_text() |
| -code = re.sub(r"//[^\n]*", "", src) |
| -code = re.sub(r"`(?:[^`\\]|\\.)*`", "``", code, flags=re.S) |
| -code = re.sub(r'"(?:[^"\\]|\\.)*"', '""', code) |
| -code = re.sub(r"'(?:[^'\\]|\\.)*'", "''", code) |
| -# drop property accesses (.foo) and object keys (foo:) |
| -code2 = re.sub(r"\.\s*[A-Za-z_$][\w$]*", ".", code) |
| -code2 = re.sub(r"\b[A-Za-z_$][\w$]*\s*:", ":", code2) |
| -used = set(re.findall(r"\b([A-Za-z_$][\w$]*)\b", code2)) |
| -declared = set(re.findall(r"function\s+([A-Za-z_$][\w$]*)", code)) |
| -declared |= set(re.findall(r"(?:const|let|var)\s+([A-Za-z_$][\w$]*)", code)) |
| -declared |= set(re.findall(r"(?:const|let|var)\s*\[([^\]]*)\]", code) and |
| - [w.strip() for grp in re.findall(r"(?:const|let|var)\s*\[([^\]]*)\]", code) for w in grp.split(",") if w.strip()]) |
| -declared |= set(w.strip() for grp in re.findall(r"(?:const|let|var)\s*\{([^}]*)\}", code) for w in grp.replace(":", ",").split(",") if w.strip()) |
| -declared |= set(w.strip().split(" as ")[-1].strip() for imp in re.findall(r"import\s*\{([^}]*)\}", code) for w in imp.split(",") if w.strip()) |
| -for pl in re.findall(r"\(([^()]*)\)\s*(?:=>|\{)", code): |
| - declared |= set(w.strip().split("=")[0].strip().lstrip(".") for w in pl.split(",") if w.strip()) |
| -for m in re.findall(r"catch\s*\(([^)]*)\)", code): declared.add(m.strip()) |
| -for m in re.findall(r"for\s*\(\s*(?:const|let|var)?\s*([A-Za-z_$][\w$]*)", code): declared.add(m) |
| -GLOBALS = set("""if else for while switch case default catch finally return await async new typeof delete void in of do break continue |
| -try throw this true false null undefined function const let var class extends super static get set yield |
| -fetch encodeURIComponent decodeURIComponent atob btoa JSON Promise Date Math Object Array String Number Boolean |
| -URL URLSearchParams Blob File Uint8Array ArrayBuffer FileReader Set Map WeakMap WeakSet RegExp Error TypeError RangeError |
| -console document window location history navigator crypto performance screen |
| -localStorage sessionStorage matchMedia requestAnimationFrame cancelAnimationFrame setTimeout setInterval clearTimeout |
| -clearInterval alert confirm prompt structuredClone AbortController CustomEvent Event KeyboardEvent MouseEvent WebSocket |
| -TextEncoder TextDecoder Intl isNaN isFinite parseInt parseFloat Function Symbol Proxy Reflect queueMicrotask createImageBitmap |
| -Audio Image Notification getComputedStyle getSelection open close focus blur scrollTo requestIdleCallback |
| -NaN Infinity globalThis arguments verbs""".split()) |
| -unresolved = sorted(used - declared - GLOBALS) |
| -print(f"--- {sys.argv[1]}") |
| -print("\n".join(unresolved) if unresolved else "REFS CLEAN") |