How to use the isImportNamespaceSpecifier function from babel-types

Find comprehensive JavaScript babel-types.isImportNamespaceSpecifier code examples handpicked from public code repositorys.

11
12
13
14
15
16
17
18
19
20
// 判断是否是需要按需加载的库
const isBelong = state.opts.libraryName === libraryName;
// 判断是否是 默认导入
const isDefault = types.isImportDefaultSpecifier(specifiers[0]);
// 判断是否是 * as 方式导入
const isAll = types.isImportNamespaceSpecifier(specifiers[0]);

if (isBelong && !isDefault && !isAll) {
  const newImports = specifiers.map(specifier => {
    const stringLiteral = types.stringLiteral(`${libraryName}/lib/${specifier.local.name}`);
fork icon0
star icon3
watch icon2

+ 3 other calls in file

39
40
41
42
43
44
45
46
47
48
self.forEach((it) => {
  if (
    types.isImportDeclaration(it) &&
    it.specifiers.some(
      (s) =>
        types.isImportNamespaceSpecifier(s) &&
        s.local.name === specifier.local.name
    )
  ) {
    acc[name] = {
fork icon0
star icon0
watch icon0

+ 2 other calls in file

29
30
31
32
33
34
35
36
37
38

self.forEach((it) => {
  if (
    types.isImportDeclaration(it) &&
    it.specifiers.some(
      (s) => types.isImportNamespaceSpecifier(s) && s.local.name === specifier.local.name,
    )
  ) {
    acc[name] = {
      path: relative(it.source.value),
fork icon0
star icon0
watch icon0

Other functions in babel-types

Sorted by popularity

function icon

babel-types.identifier is the most popular function in babel-types (4076 examples)