How to use the isExportDefaultDeclaration function from @babel/types
Find comprehensive JavaScript @babel/types.isExportDefaultDeclaration code examples handpicked from public code repositorys.
11 12 13 14 15 16 17 18 19 20
if (!path) { return path; } if ( t.isExportDefaultDeclaration(path) || (t.isExportNamedDeclaration(path) && path.has('declaration')) ) { path = path.get('declaration'); }
510
0
3
191 192 193 194 195 196 197 198 199 200
function isExport(node) { return ( t.isExportAllDeclaration(node) || t.isExportDeclaration(node) || t.isExportDefaultDeclaration(node) || t.isExportNamedDeclaration(node) || t.isExportNamespaceSpecifier(node) ); }
2
35
2
+ 33 other calls in file
GitHub: startupjs/startupjs
27 28 29 30 31 32 33 34 35
if (!TSInterfaceDeclaration && t.isTSInterfaceDeclaration(node)) { TSInterfaceDeclaration = node } if (!ExportDefaultDeclaration && t.isExportDefaultDeclaration(node)) { ExportDefaultDeclaration = node } })
42
91
8
48 49 50 51 52 53 54 55 56
babelTraverse(ast, { ObjectMethod(path) { // 对象方法 const parent = path.parentPath.parent; const name = path.node.key.name; if (parent && t.isExportDefaultDeclaration(parent)) { if (name === 'data') { const body = path.node.body.body; state.data['_statements'] = [].concat(body);
1
8
2
+ 3 other calls in file
257 258 259 260 261 262 263 264 265 266
let parent = printStack[i]; while (i >= 0) { if (expressionStatement && t.isExpressionStatement(parent, { expression: node }) || exportDefault && t.isExportDefaultDeclaration(parent, { declaration: node }) || arrowBody && t.isArrowFunctionExpression(parent, { body: node }) || forHead && t.isForStatement(parent, {
0
0
0
+ 2 other calls in file
223 224 225 226 227 228 229 230 231 232
let parent = printStack[i]; while (i >= 0) { if (t.isExpressionStatement(parent, { expression: node }) || considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node }) || considerArrow && t.isArrowFunctionExpression(parent, { body: node })) {
0
0
0
91 92 93 94 95 96 97 98 99 100
let foundDeclaration = null let foundPath = null // 分析抽象代码语法树 this.traverse(ast, { enter: (path) => { if (!foundDeclaration && babelTypes.isExportDefaultDeclaration(path.node)) { if (!foundExportDefault) { foundExportDefault = true const declaration = path.node.declaration if (babelTypes.isObjectExpression(declaration)) {
0
0
0
@babel/types.identifier is the most popular function in @babel/types (20936 examples)