vectorvesper 2.0.7 → 2.1.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.
@@ -29,13 +29,27 @@ function findHook(name) {
29
29
  const manifest = loadHookManifest();
30
30
  if (!manifest) return null;
31
31
  const wanted = name.toLowerCase();
32
- return manifest.hooks.find((h) => h.name.toLowerCase() === wanted) ?? // Tolerate "sensor-bus" / "sensorbus" / "SensorBus" for "useSensorBus".
32
+ return manifest.hooks.find((h) => h.name.toLowerCase() === wanted) ?? // Core entries are also reachable by the export they document:
33
+ // get_hook("getConductor") answers with the FrameConductor entry.
34
+ manifest.hooks.find((h) => h.exports?.some((e) => e.toLowerCase() === wanted)) ?? // Tolerate "sensor-bus" / "sensorbus" for "useSensorBus". React hooks win
35
+ // this fuzzy pass — a core twin (SensorBus) stays reachable by its exact
36
+ // name or the export it documents, both matched above.
33
37
  manifest.hooks.find(
38
+ (h) => h.name.toLowerCase().startsWith("use") && h.name.toLowerCase().replace(/^use/, "") === wanted.replace(/^use/, "").replace(/-/g, "")
39
+ ) ?? manifest.hooks.find(
34
40
  (h) => h.name.toLowerCase().replace(/^use/, "") === wanted.replace(/^use/, "").replace(/-/g, "")
35
- ) ?? null;
41
+ ) ?? // Last resort: an exact alias ("frame loop", "count up").
42
+ manifest.hooks.find((h) => h.aliases?.some((a) => a.toLowerCase() === wanted)) ?? null;
43
+ }
44
+ function findPattern(name) {
45
+ const manifest = loadHookManifest();
46
+ if (!manifest?.patterns) return null;
47
+ const wanted = name.toLowerCase().replace(/\s+/g, "-");
48
+ return manifest.patterns.find((p) => p.name === wanted) ?? manifest.patterns.find((p) => p.aliases?.some((a) => a.toLowerCase() === name.toLowerCase())) ?? null;
36
49
  }
37
50
 
38
51
  export {
39
52
  loadHookManifest,
40
- findHook
53
+ findHook,
54
+ findPattern
41
55
  };