ExportNamedDeclaration()

in packages/babel-plugin-named-asset-import/index.js [38:64]


      ExportNamedDeclaration(path, { opts: { loaderMap } }) {
        if (!path.node.source) {
          return;
        }

        replaceMatchingSpecifiers(path, loaderMap, (specifier, sourcePath) => {
          if (t.isExportDefaultSpecifier(specifier)) {
            return t.exportDeclaration(
              [t.exportDefaultSpecifier(t.identifier(specifier.local.name))],
              t.stringLiteral(sourcePath)
            );
          }

          return t.exportNamedDeclaration(
            null,
            [
              t.exportSpecifier(
                t.identifier(specifier.local.name),
                t.identifier(specifier.exported.name)
              ),
            ],
            t.stringLiteral(
              generateNewSourcePath(loaderMap, specifier.local.name, sourcePath)
            )
          );
        });
      },