refactor(tools): return complete analysis results inline
This commit is contained in:
Vendored
+1
-14
@@ -1,4 +1,4 @@
|
||||
"""Execute REA's bridge regex helpers without starting a Hopper socket."""
|
||||
"""Exercise REA's bridge inventory search without starting a Hopper socket."""
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -15,19 +15,6 @@ def _load_bridge(path):
|
||||
def _probe(namespace, payload):
|
||||
action = payload["action"]
|
||||
try:
|
||||
if action == "match":
|
||||
flags = (
|
||||
0
|
||||
if payload.get("case_sensitive", False)
|
||||
else namespace["re"].IGNORECASE
|
||||
)
|
||||
expression = namespace["re"].compile(payload["pattern"], flags)
|
||||
matched = expression.search(payload["value"]) is not None
|
||||
return {
|
||||
"action": action,
|
||||
"ok": True,
|
||||
"matched": matched,
|
||||
}
|
||||
if action == "search":
|
||||
inventory = tuple(tuple(item) for item in payload["items"])
|
||||
namespace["_search_inventory"] = lambda _document, _kind: inventory
|
||||
|
||||
Vendored
+2
-1
@@ -12,6 +12,7 @@ interface FakeV8InspectorOptions {
|
||||
readonly targetUrl: string;
|
||||
readonly targetType?: "node" | "page";
|
||||
readonly scriptUrls?: readonly string[];
|
||||
readonly scriptHashes?: readonly string[];
|
||||
readonly additionalTargetUrl?: string;
|
||||
readonly additionalTargetCount?: number;
|
||||
readonly closeOnMethod?: string;
|
||||
@@ -126,7 +127,7 @@ export const startFakeV8Inspector = async (
|
||||
scriptId: String(index + 1),
|
||||
url,
|
||||
executionContextId: 1,
|
||||
hash: `hash-${String(index)}`,
|
||||
hash: options.scriptHashes?.[index] ?? `hash-${String(index)}`,
|
||||
length: 100 + index,
|
||||
isModule: index % 2 === 0,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user