diff --git a/packages/metro/src/JSTransformer/worker/__tests__/constant-folding-plugin-test.js b/packages/metro/src/JSTransformer/worker/__tests__/constant-folding-plugin-test.js index e27d89f5..41ae0205 100644 --- a/packages/metro/src/JSTransformer/worker/__tests__/constant-folding-plugin-test.js +++ b/packages/metro/src/JSTransformer/worker/__tests__/constant-folding-plugin-test.js @@ -12,8 +12,8 @@ const constantFoldingPlugin = require('../constant-folding-plugin'); -const {transformSync} = require('../../../babel-bridge'); -const {transformFromAstSync} = require('../../../babel-bridge'); +const {transformSync} = require('@babel/core'); +const {transformFromAstSync} = require('@babel/core'); import type {TransformResult} from '@babel/core'; diff --git a/packages/metro/src/JSTransformer/worker/__tests__/inline-plugin-test.js b/packages/metro/src/JSTransformer/worker/__tests__/inline-plugin-test.js index 0ef14d23..b03625b6 100644 --- a/packages/metro/src/JSTransformer/worker/__tests__/inline-plugin-test.js +++ b/packages/metro/src/JSTransformer/worker/__tests__/inline-plugin-test.js @@ -13,8 +13,8 @@ const inlinePlugin = require('../inline-plugin'); const invariant = require('fbjs/lib/invariant'); -const {transformSync} = require('../../../babel-bridge'); -const {transformFromAstSync} = require('../../../babel-bridge'); +const {transformSync} = require('@babel/core'); +const {transformFromAstSync} = require('@babel/core'); import type {TransformResult} from '@babel/core'; import type {Ast} from 'babel-core'; diff --git a/packages/metro/src/ModuleGraph/worker/optimize-module.js b/packages/metro/src/ModuleGraph/worker/optimize-module.js index 70d26c5b..671d49aa 100644 --- a/packages/metro/src/ModuleGraph/worker/optimize-module.js +++ b/packages/metro/src/ModuleGraph/worker/optimize-module.js @@ -18,7 +18,7 @@ const invariant = require('fbjs/lib/invariant'); const optimizeDependencies = require('./optimizeDependencies'); const sourceMap = require('source-map'); -const {transformSync} = require('../../babel-bridge'); +const {transformSync} = require('@babel/core'); import type {PostMinifyProcess} from '../../Bundler'; import type {TransformedSourceFile, TransformResult} from '../types.flow'; diff --git a/packages/metro/src/babel-bridge.js b/packages/metro/src/babel-bridge.js index 108c17bd..72d16a86 100644 --- a/packages/metro/src/babel-bridge.js +++ b/packages/metro/src/babel-bridge.js @@ -13,15 +13,14 @@ // This is a temporary migration bridge to switch between babel 6 and 7 -const babelCore7 = require('@babel/core'); const babelGenerate7 = require('@babel/generator').default; const babelTemplate7 = require('@babel/template').default; const babelTraverse7 = require('@babel/traverse').default; 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'); + const makeHMRConfig7 = makeMakeHMRConfig7(); function resolvePlugins7(plugins: Array) { /** @@ -53,10 +52,6 @@ function resolvePlugins7(plugins: Array) { } module.exports = { - // need to abstract the transform* funcs here since their name changed - transformSync: babelCore7.transformSync, - transformFileSync: babelCore7.transformFileSync, - transformFromAstSync: babelCore7.transformFromAstSync, babelGenerate: babelGenerate7, babelTemplate: babelTemplate7, babelTraverse: babelTraverse7, diff --git a/packages/metro/src/defaultTransform.js b/packages/metro/src/defaultTransform.js index 8391e46a..bfa4dd09 100644 --- a/packages/metro/src/defaultTransform.js +++ b/packages/metro/src/defaultTransform.js @@ -9,7 +9,7 @@ */ 'use strict'; -const {transformSync} = require('./babel-bridge'); +const {transformSync} = require('@babel/core'); import type {TransformOptions} from './JSTransformer/worker'; import type {Plugins as BabelPlugins} from 'babel-core'; diff --git a/packages/metro/src/lib/__tests__/__snapshots__/getTransformCacheKeyFn-test.js.snap b/packages/metro/src/lib/__tests__/__snapshots__/getTransformCacheKeyFn-test.js.snap index c90b192a..f7c2c81c 100644 --- a/packages/metro/src/lib/__tests__/__snapshots__/getTransformCacheKeyFn-test.js.snap +++ b/packages/metro/src/lib/__tests__/__snapshots__/getTransformCacheKeyFn-test.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`getTransformCacheKeyFn Should return always the same key for the same params 1`] = `"e65336d380f8bf43e00f5cd94b8bf541b1b08f5c"`; +exports[`getTransformCacheKeyFn Should return always the same key for the same params 1`] = `"21cd943759b1802bca8cea636538f13b2f7b89a8"`; diff --git a/packages/metro/src/lib/polyfills/__tests__/require-test.js b/packages/metro/src/lib/polyfills/__tests__/require-test.js index 2eaf9abd..fca0f82a 100644 --- a/packages/metro/src/lib/polyfills/__tests__/require-test.js +++ b/packages/metro/src/lib/polyfills/__tests__/require-test.js @@ -15,7 +15,7 @@ const fs = require('fs'); const {getBabelRegisterConfig} = require('../../../babel-bridge'); -const {transformSync} = require('../../../babel-bridge'); +const {transformSync} = require('@babel/core'); const babelConfig = getBabelRegisterConfig(); diff --git a/packages/metro/src/transformer.js b/packages/metro/src/transformer.js index c542a565..d65b3d96 100644 --- a/packages/metro/src/transformer.js +++ b/packages/metro/src/transformer.js @@ -21,7 +21,7 @@ const {getPreset} = require('./babel-bridge'); const {inlineRequiresPlugin} = require('./babel-bridge'); const {makeHMRConfig} = require('./babel-bridge'); const {resolvePlugins} = require('./babel-bridge'); -const {transformSync} = require('./babel-bridge'); +const {transformSync} = require('@babel/core'); import type {Transformer, TransformOptions} from './JSTransformer/worker'; import type {Plugins as BabelPlugins} from 'babel-core';