How to use the isImportDeclaration function from babel-types
Find comprehensive JavaScript babel-types.isImportDeclaration code examples handpicked from public code repositorys.
9 10 11 12 13 14 15 16 17 18
Program: { exit(path) { const bodyPaths = path.get('body'); bodyPaths.forEach(bodyPath => { if ( t.isImportDeclaration(bodyPath.node) && bodyPath.node.specifiers.length === 1 && isJSSThemeReactorImport(bodyPath.get('specifiers')[0]) ) { bodyPath.remove();
12
28
5
+ 13 other calls in file
36 37 38 39 40 41 42 43 44 45
declaration.specifiers.forEach((specifier) => { const name = specifier.exported.name; self.forEach((it) => { if ( types.isImportDeclaration(it) && it.specifiers.some( (s) => types.isImportNamespaceSpecifier(s) && s.local.name === specifier.local.name
0
0
0
+ 2 other calls in file
10 11 12 13 14 15 16 17 18 19
const traverse = require('babel-traverse').default; const types = require('babel-types'); const generate = require('babel-generator').default; const isImportDeclaration = path => types.isImportDeclaration(path.node) || types.isImportSpecifier(path.parent) || types.isImportDeclaration(path.parent) || types.isImportSpecifier(path.parent) || types.isImportDefaultSpecifier(path.parent);
0
0
3
+ 3 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)