File tree Expand file tree Collapse file tree 1 file changed +0
-38
lines changed
packages/babel-plugin-jsx/src Expand file tree Collapse file tree 1 file changed +0
-38
lines changed Original file line number Diff line number Diff line change @@ -191,44 +191,6 @@ export default declare<VueJSXPluginOptions, BabelCore.PluginObj<State>>(
191191 }
192192 }
193193 } ,
194- exit ( path ) {
195- const body = path . get ( 'body' ) as NodePath [ ] ;
196- const specifiersMap = new Map < string , t . ImportSpecifier > ( ) ;
197-
198- body
199- . filter (
200- ( nodePath ) =>
201- t . isImportDeclaration ( nodePath . node ) &&
202- nodePath . node . source . value === 'vue'
203- )
204- . forEach ( ( nodePath ) => {
205- const { specifiers } = nodePath . node as t . ImportDeclaration ;
206- let shouldRemove = false ;
207- specifiers . forEach ( ( specifier ) => {
208- if (
209- ! specifier . loc &&
210- t . isImportSpecifier ( specifier ) &&
211- t . isIdentifier ( specifier . imported )
212- ) {
213- specifiersMap . set ( specifier . imported . name , specifier ) ;
214- shouldRemove = true ;
215- }
216- } ) ;
217- if ( shouldRemove ) {
218- nodePath . remove ( ) ;
219- }
220- } ) ;
221-
222- const specifiers = [ ...specifiersMap . keys ( ) ] . map (
223- ( imported ) => specifiersMap . get ( imported ) !
224- ) ;
225- if ( specifiers . length ) {
226- path . unshiftContainer (
227- 'body' ,
228- t . importDeclaration ( specifiers , t . stringLiteral ( 'vue' ) )
229- ) ;
230- }
231- } ,
232194 } ,
233195 } ,
234196 } ;
You can’t perform that action at this time.
0 commit comments