1
0
mirror of https://github.com/sahadev/vue-component-creater-ui.git synced 2025-12-18 16:34:17 +08:00
Files
vue-component-creater-ui/src/utils/get-imports.js
shangbin e87ebafdcb init
2021-04-09 20:06:44 +08:00

19 lines
426 B
JavaScript

export default function(code, { imports }) {
return {
name: 'get-imports',
visitor: {
ImportDeclaration(path) {
imports.push({
variables: path.node.specifiers.map(spec => ({
local: spec.local.name,
imported: spec.imported ? spec.imported.name : 'default'
})),
module: path.node.source.value
});
path.remove();
}
}
};
}