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

Function ImportDeclaration

packages/main/src/babel/babel.ts:132–161  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

130
131 // Track imported references to sources
132 ImportDeclaration(path) {
133
134 const source = path.node.source.value
135 const targets = SOURCE_MODULES[source]
136 if (!targets) return
137
138 for (const s of path.node.specifiers) {
139 // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
140 switch (s.type) {
141 // import * as local from "solid-js"
142 case 'ImportNamespaceSpecifier':
143 for (const target of targets) {
144 Sources[target].push(t.memberExpression(s.local, t.identifier(target)))
145 FileWithImports = true
146 }
147 break
148 // import { createSignal } from "solid-js"
149 // import { createSignal as local } from "solid-js"
150 // import { "createSignal" as local } from "solid-js"
151 case 'ImportSpecifier': {
152 const name = s.imported.type === 'Identifier' ? s.imported.name : s.imported.value
153 if (targets.has(name)) {
154 Sources[name as Source].push(s.local)
155 FileWithImports = true
156 }
157 break
158 }
159 }
160 }
161 },
162
163 VariableDeclaration(path) {
164 if (!FileWithImports) return

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…