Export Config/defaults on Metro's main module

Reviewed By: arcanis

Differential Revision: D6435529

fbshipit-source-id: a9549dc5900025fcc798ccb92b49e96c982c2e1e
This commit is contained in:
Christoph Nakazawa 2017-11-29 04:37:22 -08:00 committed by Facebook Github Bot
parent 654fed46f4
commit 0091496891
2 changed files with 16 additions and 14 deletions

View File

@ -29,25 +29,27 @@ const TerminalReporter = require('metro/src/lib/TerminalReporter');
* run Flow. */
const TransformCaching = require('metro/src/lib/TransformCaching');
const {defaults} = require('metro');
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const outputBundle = require('metro/src/shared/output/bundle');
const path = require('path');
const saveAssets = require('./saveAssets');
const defaultAssetExts = require('metro/src/defaults').assetExts;
const defaultSourceExts = require('metro/src/defaults').sourceExts;
const defaultPlatforms = require('metro/src/defaults').platforms;
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const defaultProvidesModuleNodeModules = require('metro/src/defaults').providesModuleNodeModules;
const {ASSET_REGISTRY_PATH} = require('../core/Constants');
import type {RequestOptions, OutputOptions} from './types.flow';
import type {ConfigT} from 'metro';
const defaultAssetExts = defaults.assetExts;
const defaultSourceExts = defaults.sourceExts;
const defaultPlatforms = defaults.platforms;
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const defaultProvidesModuleNodeModules = defaults.providesModuleNodeModules;
async function buildBundle(
args: OutputOptions & {
assetsDest: mixed,

View File

@ -16,7 +16,7 @@ require('../../setupBabel')();
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const ReactPackager = require('metro');
const Metro = require('metro');
const HmrServer = require('metro/src/HmrServer');
@ -31,14 +31,14 @@ const attachWebsocketServer = require('./util/attachWebsocketServer');
* run Flow. */
const connect = require('connect');
const copyToClipBoardMiddleware = require('./middleware/copyToClipBoardMiddleware');
const defaultAssetExts = require('metro/src/defaults').assetExts;
const defaultSourceExts = require('metro/src/defaults').sourceExts;
const defaultPlatforms = require('metro/src/defaults').platforms;
const defaultAssetExts = Metro.defaults.assetExts;
const defaultSourceExts = Metro.defaults.sourceExts;
const defaultPlatforms = Metro.defaults.platforms;
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const defaultProvidesModuleNodeModules = require('metro/src/defaults')
.providesModuleNodeModules;
const defaultProvidesModuleNodeModules =
Metro.defaults.providesModuleNodeModules;
const fs = require('fs');
const getDevToolsMiddleware = require('./middleware/getDevToolsMiddleware');
const http = require('http');
@ -178,7 +178,7 @@ function getPackagerServer(args, config, reporter) {
const providesModuleNodeModules =
args.providesModuleNodeModules || defaultProvidesModuleNodeModules;
return ReactPackager.createServer({
return Metro.createServer({
assetExts: defaultAssetExts.concat(args.assetExts),
assetRegistryPath: ASSET_REGISTRY_PATH,
blacklistRE: config.getBlacklistRE(),