; JavaScript import extraction queries
; Same as TypeScript (no type-only imports in JS grammar)

; === ES module imports ===

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

; === CommonJS require ===

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

; === Dynamic import ===

; import('./dynamic')
(call_expression
  function: (import)
  arguments: (arguments
    (string
      (string_fragment) @source))) @node
