File tree Expand file tree Collapse file tree
packages/babel-core/src/transformation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import loadConfig from "../config" ;
2-
3- import type { Plugin } from "../config" ;
1+ import traverse from "@babel/traverse" ;
2+ import Plugin from "../config/plugin" ;
43
54let LOADED_PLUGIN : Plugin | void ;
65
76export default function loadBlockHoistPlugin ( ) : Plugin {
87 if ( ! LOADED_PLUGIN ) {
9- // Lazy-init the internal plugin to remove the init-time circular
10- // dependency between plugins being passed @babel /core's export object,
11- // which loads this file, and this 'loadConfig' loading plugins.
12- const config = loadConfig . sync ( {
13- babelrc : false ,
14- configFile : false ,
15- browserslistConfigFile : false ,
16- plugins : [ blockHoistPlugin ] ,
17- } ) ;
18- LOADED_PLUGIN = config ? config . passes [ 0 ] [ 0 ] : undefined ;
19- if ( ! LOADED_PLUGIN ) throw new Error ( "Assertion failure" ) ;
8+ // cache the loaded blockHoist plugin plugin
9+ LOADED_PLUGIN = new Plugin (
10+ {
11+ ...blockHoistPlugin ,
12+ visitor : traverse . explode ( blockHoistPlugin . visitor ) ,
13+ } ,
14+ { } ,
15+ ) ;
2016 }
2117
2218 return LOADED_PLUGIN ;
You can’t perform that action at this time.
0 commit comments