diff --git a/packages/metro/src/Bundler/util.js b/packages/metro/src/Bundler/util.js index 5d516a37..1074b0d3 100644 --- a/packages/metro/src/Bundler/util.js +++ b/packages/metro/src/Bundler/util.js @@ -10,8 +10,9 @@ 'use strict'; +const babelTypes = require('@babel/types'); + const {babylon} = require('../babel-bridge'); -const {babelTypes} = require('../babel-bridge'); import type {AssetDataWithoutFiles} from '../Assets'; import type {ModuleTransportLike} from '../shared/types.flow'; diff --git a/packages/metro/src/JSTransformer/worker/constant-folding-plugin.js b/packages/metro/src/JSTransformer/worker/constant-folding-plugin.js index d14a8eac..02cf719a 100644 --- a/packages/metro/src/JSTransformer/worker/constant-folding-plugin.js +++ b/packages/metro/src/JSTransformer/worker/constant-folding-plugin.js @@ -10,7 +10,7 @@ 'use strict'; -import typeof {types as BabelTypes} from 'babel-core'; +import typeof {types as BabelTypes} from '@babel/core'; function constantFoldingPlugin(context: {types: BabelTypes}) { const t = context.types; diff --git a/packages/metro/src/JSTransformer/worker/inline-platform.js b/packages/metro/src/JSTransformer/worker/inline-platform.js index c404b89b..3396c165 100644 --- a/packages/metro/src/JSTransformer/worker/inline-platform.js +++ b/packages/metro/src/JSTransformer/worker/inline-platform.js @@ -10,7 +10,7 @@ 'use strict'; -import typeof {types as BabelTypes} from 'babel-core'; +import typeof {types as BabelTypes} from '@babel/core'; const importMap = new Map([['ReactNative', 'react-native']]); diff --git a/packages/metro/src/JSTransformer/worker/inline-plugin.js b/packages/metro/src/JSTransformer/worker/inline-plugin.js index 1499a6f5..ba8fea7a 100644 --- a/packages/metro/src/JSTransformer/worker/inline-plugin.js +++ b/packages/metro/src/JSTransformer/worker/inline-plugin.js @@ -12,7 +12,7 @@ const createInlinePlatformChecks = require('./inline-platform'); -import typeof {types as BabelTypes} from 'babel-core'; +import typeof {types as BabelTypes} from '@babel/core'; import type {Ast} from 'babel-core'; type Context = {types: BabelTypes}; diff --git a/packages/metro/src/ModuleGraph/worker/JsFileWrapping.js b/packages/metro/src/ModuleGraph/worker/JsFileWrapping.js index 7e30eca0..13d86fa1 100644 --- a/packages/metro/src/ModuleGraph/worker/JsFileWrapping.js +++ b/packages/metro/src/ModuleGraph/worker/JsFileWrapping.js @@ -11,7 +11,8 @@ 'use strict'; /* eslint-disable lint/no-unclear-flowtypes */ -const {babelTypes} = require('../../babel-bridge'); +const babelTypes = require('@babel/types'); + const traverse = require('@babel/traverse').default; const MODULE_FACTORY_PARAMETERS = ['global', 'require', 'module', 'exports']; diff --git a/packages/metro/src/ModuleGraph/worker/__tests__/transform-module-test.js b/packages/metro/src/ModuleGraph/worker/__tests__/transform-module-test.js index b9cd9468..206557e9 100644 --- a/packages/metro/src/ModuleGraph/worker/__tests__/transform-module-test.js +++ b/packages/metro/src/ModuleGraph/worker/__tests__/transform-module-test.js @@ -14,6 +14,7 @@ const invariant = require('fbjs/lib/invariant'); const nullthrows = require('fbjs/lib/nullthrows'); const transformModule = require('../transform-module'); +const types = require('@babel/types'); const generate = require('@babel/generator').default; const traverse = require('@babel/traverse').default; @@ -21,7 +22,6 @@ const traverse = require('@babel/traverse').default; const { babylon: {parse}, } = require('../../../babel-bridge'); -const {babelTypes: types} = require('../../../babel-bridge'); const {fn} = require('../../test-helpers'); const {SourceMapConsumer} = require('source-map'); diff --git a/packages/metro/src/ModuleGraph/worker/collectDependencies.js b/packages/metro/src/ModuleGraph/worker/collectDependencies.js index 5c1986b0..0ad9d291 100644 --- a/packages/metro/src/ModuleGraph/worker/collectDependencies.js +++ b/packages/metro/src/ModuleGraph/worker/collectDependencies.js @@ -11,13 +11,12 @@ 'use strict'; const nullthrows = require('fbjs/lib/nullthrows'); +const types = require('@babel/types'); const babelTemplate = require('@babel/template').default; const generate = require('@babel/generator').default; const traverse = require('@babel/traverse').default; -const {babelTypes: types} = require('../../babel-bridge'); - import type {TransformResultDependency} from '../types.flow'; import type {Ast} from '@babel/core'; diff --git a/packages/metro/src/babel-bridge.js b/packages/metro/src/babel-bridge.js index 4b132be9..baa3a53f 100644 --- a/packages/metro/src/babel-bridge.js +++ b/packages/metro/src/babel-bridge.js @@ -13,7 +13,6 @@ // This is a temporary migration bridge to switch between babel 6 and 7 -const babelTypes7 = require('@babel/types'); const babylon7 = require('metro-babylon7'); const externalHelpersPlugin7 = require('babel-plugin-external-helpers'); const inlineRequiresPlugin7 = require('babel-preset-fbjs/plugins/inline-requires'); @@ -49,7 +48,6 @@ function resolvePlugins7(plugins: Array) { } module.exports = { - babelTypes: babelTypes7, getBabelRegisterConfig: getBabelRegisterConfig7, babylon: babylon7,