in packages/babel-plugin-wind/src/index.js [42:82]
ImportDeclaration(path) {
importCollection.clear()
const { source, specifiers } = path.node
if (!isStringLiteral(source)) {
return
}
const { value: sourceValue } = source
cache.set(sourceValue, true)
if (sourceValue === library) {
const importIdentifier = getImportIdentifier(specifiers)
if (!_.isPlainObject(importIdentifier)) {
return
}
const {
defaults,
identifiers,
} = importIdentifier
if (defaults || !identifiers || !identifiers.length) {
return
}
_.each(identifiers, (identifier) => {
const { importedName, localName } = identifier
const item = {
originSource: sourceValue,
localName,
importedName,
cwd,
}
importCollection.add(item, { transformSource })
})
path.replaceWithMultiple(importCollection.generate())
}
},