(node: DefaultTreeAdapterMap['element'])
| 223 | } |
| 224 | |
| 225 | export function getScriptInfo(node: DefaultTreeAdapterMap['element']): { |
| 226 | src: Token.Attribute | undefined |
| 227 | srcSourceCodeLocation: Token.Location | undefined |
| 228 | isModule: boolean |
| 229 | isAsync: boolean |
| 230 | isIgnored: boolean |
| 231 | } { |
| 232 | let src: Token.Attribute | undefined |
| 233 | let srcSourceCodeLocation: Token.Location | undefined |
| 234 | let isModule = false |
| 235 | let isAsync = false |
| 236 | let isIgnored = false |
| 237 | for (const p of node.attrs) { |
| 238 | if (p.prefix !== undefined) continue |
| 239 | if (p.name === 'src') { |
| 240 | if (!src) { |
| 241 | src = p |
| 242 | srcSourceCodeLocation = node.sourceCodeLocation?.attrs!.src |
| 243 | } |
| 244 | } else if (p.name === 'type' && p.value === 'module') { |
| 245 | isModule = true |
| 246 | } else if (p.name === 'async') { |
| 247 | isAsync = true |
| 248 | } else if (p.name === 'vite-ignore') { |
| 249 | isIgnored = true |
| 250 | } |
| 251 | } |
| 252 | return { src, srcSourceCodeLocation, isModule, isAsync, isIgnored } |
| 253 | } |
| 254 | |
| 255 | const attrValueStartRE = /=\s*(.)/ |
| 256 |
no outgoing calls
no test coverage detected