MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / check_for_solid

Function check_for_solid

packages/shared/src/detect.ts:37–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35
36// initial version by @aquaductape
37export async function check_for_solid(): Promise<boolean> {
38
39 if (detectSolidDev()) return true
40
41 const $hy = (window as any)._$HY as unknown
42 if ($hy && typeof $hy === 'object' && 'completed' in $hy && $hy.completed instanceof WeakSet)
43 return true
44
45 if (document.querySelector('[data-hk]'))
46 return true
47
48 const resources = performance.getEntriesByType('resource') as PerformanceResourceTiming[]
49
50 for (const resource of resources) {
51 if (resource.initiatorType === 'script' && resource.name.startsWith(location.origin)) {
52 try {
53 const response = await fetch(resource.name)
54 const text = await response.text()
55 if (script_text_detect_solid(text)) {
56 return true
57 }
58 } catch (_) {/**/}
59 }
60 }
61
62 return false
63}
64
65export function detectSolidDev(): boolean {
66 return !!window[SOLID_DEV_GLOBAL]

Callers 1

detectSolidFunction · 0.85

Calls 2

detectSolidDevFunction · 0.85
script_text_detect_solidFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…