ImportDeclaration()

in packages/babel-plugin-named-asset-import/index.js [65:90]


      ImportDeclaration(path, { opts: { loaderMap } }) {
        replaceMatchingSpecifiers(path, loaderMap, (specifier, sourcePath) => {
          if (t.isImportDefaultSpecifier(specifier)) {
            return t.importDeclaration(
              [t.importDefaultSpecifier(t.identifier(specifier.local.name))],
              t.stringLiteral(sourcePath)
            );
          }

          return t.importDeclaration(
            [
              t.importSpecifier(
                t.identifier(specifier.local.name),
                t.identifier(specifier.imported.name)
              ),
            ],
            t.stringLiteral(
              generateNewSourcePath(
                loaderMap,
                specifier.imported.name,
                sourcePath
              )
            )
          );
        });
      },