How to use the importDefaultSpecifier function from babel-types
Find comprehensive JavaScript babel-types.importDefaultSpecifier code examples handpicked from public code repositorys.
GitHub: wx-chevalier/ueact
61 62 63 64 65 66 67 68 69 70
idx = index; } }); if (!defaultSpecifier) { node.specifiers.unshift( t.importDefaultSpecifier(t.identifier(nervJsImportDefaultName)) ); } else { taroImportDefaultName = defaultSpecifier; node.specifiers[idx].local.name = nervJsImportDefaultName;
5
49
4
+ 2 other calls in file
8 9 10 11 12 13 14 15 16 17
let node = path.node let specifiers = node.specifiers let source = node.source if (state.opts.library === source.value && t.isImportDefaultSpecifier(specifiers[0])) { let declaration = specifiers.map(specifier => { let importDefaultSpecifier = t.importDefaultSpecifier(specifier.local) t.importDeclaration([importDefaultSpecifier], t.stringLiteral(`${source.value}/${specifier.imported.name}`)) }) path.replaceWithMultiple(declaration) }
3
16
2
57 58 59 60 61 62 63 64 65 66
// generate codes let paramIdx = 0 dependencies.forEach((dependence, idx) => { if (!ignoreDependencies.has(dependence) && paramIdx < parameters.length) { programBody.push(t.importDeclaration([ t.importDefaultSpecifier(t.identifier(parameters[paramIdx])) ], t.stringLiteral(dependence) )) paramIdx++
1
7
2
+ 6 other calls in file
30 31 32 33 34 35 36 37 38 39
path.parent.body.splice( node_i, 0, t.importDeclaration( [ t.importDefaultSpecifier(ns.local) ], t.stringLiteral( `${prefix}${encodeURIComponent(specifier)}&namespace` )
1
6
2
+ 19 other calls in file
16 17 18 19 20 21 22 23 24 25
const isAll = types.isImportNamespaceSpecifier(specifiers[0]); if (isBelong && !isDefault && !isAll) { const newImports = specifiers.map(specifier => { const stringLiteral = types.stringLiteral(`${libraryName}/lib/${specifier.local.name}`); const newSpecifier = types.importDefaultSpecifier(specifier.local); return types.importDeclaration([newSpecifier], stringLiteral); }) path.replaceWithMultiple(newImports);
0
3
2
+ 3 other calls in file
39 40 41 42 43 44 45 46 47 48
typeof identifier === 'string' ? identifier : identifier[0] ); let specifier; if (isDefault) { specifier = types.importDefaultSpecifier(localIdentifier); } else if (isNamespace) { specifier = types.importNamespaceSpecifier(localIdentifier); } else { specifier = types.importSpecifier(
0
2
1
+ 7 other calls in file
GitHub: MorningBells/taro
100 101 102 103 104 105 106 107 108 109
taroImportDefaultName = specifier.local.name specifier.local.name = reactImportDefaultName } else if (!hasAddReactImportDefaultName) { hasAddReactImportDefaultName = true node.specifiers.unshift( t.importDefaultSpecifier(t.identifier(reactImportDefaultName)) ) } const taroApisSpecifiers = [] specifiers.forEach((item, index) => {
0
2
0
422 423 424 425 426 427 428 429 430 431
specifier.local.name = nervJsImportDefaultName } else if (!hasAddNervJsImportDefaultName) { hasAddNervJsImportDefaultName = true //@fix // node.specifiers.unshift( // t.importDefaultSpecifier(t.identifier(nervJsImportDefaultName)) // ) } const taroApisSpecifiers = [] const deletedIdx = []
0
0
0
+ 7 other calls in file
GitHub: bebedon/mb-vux
138 139 140 141 142 143 144 145 146 147
var replace = transform(opts.transform, importName, matches); var newImportSpecifier = (opts.skipDefaultConversion) ? memberImport : types.importDefaultSpecifier(types.identifier(memberImport.local.name)); transforms.push(types.importDeclaration( [newImportSpecifier], types.stringLiteral(replace) ));
0
0
0
babel-types.identifier is the most popular function in babel-types (4076 examples)