(imp)
| 20 | const importDeclaration = pragmaImport(options.import || false); |
| 21 | |
| 22 | function pragmaImport(imp) { |
| 23 | if (pragmaString === false || imp === false) { |
| 24 | return null; |
| 25 | } |
| 26 | const pragmaRoot = t.identifier(pragmaString.split('.')[0]); |
| 27 | const { module, export: export_ } = typeof imp !== 'string' ? imp : { |
| 28 | module: imp, |
| 29 | export: null |
| 30 | }; |
| 31 | |
| 32 | let specifier; |
| 33 | if (export_ === '*') { |
| 34 | specifier = t.importNamespaceSpecifier(pragmaRoot); |
| 35 | } |
| 36 | else if (export_ === 'default') { |
| 37 | specifier = t.importDefaultSpecifier(pragmaRoot); |
| 38 | } |
| 39 | else { |
| 40 | specifier = t.importSpecifier(pragmaRoot, export_ ? t.identifier(export_) : pragmaRoot); |
| 41 | } |
| 42 | return t.importDeclaration([specifier], t.stringLiteral(module)); |
| 43 | } |
| 44 | |
| 45 | function dottedIdentifier(keypath) { |
| 46 | const path = keypath.split('.'); |
no outgoing calls
no test coverage detected
searching dependent graphs…