; TypeScript import extraction queries
; Captures: @node (full import statement), @source (module path string)

; === ES module imports ===

; import { foo } from './module'
; import type { IFoo } from './types'
; import Def from 'pkg'
; import * as ns from 'pkg'
(import_statement
  source: (string
    (string_fragment) @source)) @node

; === CommonJS require ===

; const x = require('./mod')
; const { a, b } = require('./mod')
(lexical_declaration
  (variable_declarator
    value: (call_expression
      function: (identifier) @_fn
      arguments: (arguments
        (string
          (string_fragment) @source))))
  (#eq? @_fn "require")) @node

; === Dynamic import ===

; const x = await import('./dynamic')
; import('./dynamic').then(...)
(call_expression
  function: (import)
  arguments: (arguments
    (string
      (string_fragment) @source))) @node
