mirror of
https://github.com/sahadev/vue-component-creater-ui.git
synced 2025-12-18 16:34:17 +08:00
19 lines
426 B
JavaScript
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();
|
|
}
|
|
}
|
|
};
|
|
}
|