mirror of
https://github.com/sahadev/vue-component-creater-ui.git
synced 2025-12-20 01:35:49 +08:00
init
This commit is contained in:
18
src/utils/get-imports.js
Normal file
18
src/utils/get-imports.js
Normal file
@@ -0,0 +1,18 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user