Move remaining Metro Bundler files around.
Reviewed By: jeanlauliac Differential Revision: D5154653 fbshipit-source-id: 482bf9829263d5d8f3d0b951ee58e2020236cc2c
This commit is contained in:
parent
3aedbbbf96
commit
57bb955ba1
|
@ -11,7 +11,7 @@
|
|||
'use strict';
|
||||
|
||||
const babel = require('babel-core');
|
||||
const babelRegisterOnly = require('../packager/babelRegisterOnly');
|
||||
const babelRegisterOnly = require('../packager/src/babelRegisterOnly');
|
||||
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
|
||||
const path = require('path');
|
||||
|
||||
|
@ -23,7 +23,7 @@ const nodeOptions = babelRegisterOnly.config([nodeFiles]);
|
|||
|
||||
babelRegisterOnly([]);
|
||||
// has to be required after setting up babelRegisterOnly
|
||||
const transformer = require('../packager/transformer.js');
|
||||
const transformer = require('../packager/src/transformer.js');
|
||||
|
||||
module.exports = {
|
||||
process(src/*: string*/, file/*: string*/) {
|
||||
|
@ -49,7 +49,7 @@ module.exports = {
|
|||
|
||||
getCacheKey: createCacheKeyFunction([
|
||||
__filename,
|
||||
path.join(__dirname, '../packager/transformer.js'),
|
||||
path.join(__dirname, '../packager/src/transformer.js'),
|
||||
require.resolve('babel-core/package.json'),
|
||||
]),
|
||||
};
|
||||
|
|
|
@ -19,10 +19,10 @@ const TransformCaching = require('../../packager/src/lib/TransformCaching');
|
|||
const outputBundle = require('../../packager/src/shared/output/bundle');
|
||||
const path = require('path');
|
||||
const saveAssets = require('./saveAssets');
|
||||
const defaultAssetExts = require('../../packager/defaults').assetExts;
|
||||
const defaultSourceExts = require('../../packager/defaults').sourceExts;
|
||||
const defaultPlatforms = require('../../packager/defaults').platforms;
|
||||
const defaultProvidesModuleNodeModules = require('../../packager/defaults').providesModuleNodeModules;
|
||||
const defaultAssetExts = require('../../packager/src/defaults').assetExts;
|
||||
const defaultSourceExts = require('../../packager/src/defaults').sourceExts;
|
||||
const defaultPlatforms = require('../../packager/src/defaults').platforms;
|
||||
const defaultProvidesModuleNodeModules = require('../../packager/src/defaults').providesModuleNodeModules;
|
||||
|
||||
import type {RequestOptions, OutputOptions} from './types.flow';
|
||||
import type {ConfigT} from '../util/Config';
|
||||
|
|
|
@ -20,10 +20,10 @@ const attachHMRServer = require('./util/attachHMRServer');
|
|||
const connect = require('connect');
|
||||
const copyToClipBoardMiddleware = require('./middleware/copyToClipBoardMiddleware');
|
||||
const cpuProfilerMiddleware = require('./middleware/cpuProfilerMiddleware');
|
||||
const defaultAssetExts = require('../../packager/defaults').assetExts;
|
||||
const defaultSourceExts = require('../../packager/defaults').sourceExts;
|
||||
const defaultPlatforms = require('../../packager/defaults').platforms;
|
||||
const defaultProvidesModuleNodeModules = require('../../packager/defaults')
|
||||
const defaultAssetExts = require('../../packager/src/defaults').assetExts;
|
||||
const defaultSourceExts = require('../../packager/src/defaults').sourceExts;
|
||||
const defaultPlatforms = require('../../packager/src/defaults').platforms;
|
||||
const defaultProvidesModuleNodeModules = require('../../packager/src/defaults')
|
||||
.providesModuleNodeModules;
|
||||
const getDevToolsMiddleware = require('./middleware/getDevToolsMiddleware');
|
||||
const http = require('http');
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
const blacklist = require('../../packager/blacklist');
|
||||
const blacklist = require('../../packager/src/blacklist');
|
||||
const fs = require('fs');
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
const path = require('path');
|
||||
|
||||
const {providesModuleNodeModules} = require('../../packager/defaults');
|
||||
const {providesModuleNodeModules} = require('../../packager/src/defaults');
|
||||
|
||||
const RN_CLI_CONFIG = 'rn-cli.config.js';
|
||||
|
||||
|
@ -120,7 +120,7 @@ const defaultConfig: ConfigT = {
|
|||
getProjectRoots: () => [process.cwd()],
|
||||
getProvidesModuleNodeModules: () => providesModuleNodeModules.slice(),
|
||||
getSourceExts: () => [],
|
||||
getTransformModulePath: () => path.resolve(__dirname, '../../packager/transformer.js'),
|
||||
getTransformModulePath: () => path.resolve(__dirname, '../../packager/src/transformer.js'),
|
||||
getTransformOptions: async () => ({}),
|
||||
postMinifyProcess: x => x,
|
||||
postProcessModules: modules => modules,
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{
|
||||
"version": "0.6.1",
|
||||
"name": "react-native-packager",
|
||||
"description": "Build native apps with React!",
|
||||
"version": "0.7.0",
|
||||
"name": "metro-bundler",
|
||||
"description": "🚇 The JavaScript bundler for React Native.",
|
||||
"main": "src/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:facebook/react-native.git"
|
||||
"url": "git@github.com:facebook/metro-bundler.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"absolute-path": "^0.0.0",
|
||||
|
@ -12,6 +13,7 @@
|
|||
"babel-core": "^6.24.1",
|
||||
"babel-generator": "^6.24.1",
|
||||
"babel-plugin-external-helpers": "^6.18.0",
|
||||
"babel-preset-es2015-node": "^6.1.1",
|
||||
"babel-preset-fbjs": "^2.1.0",
|
||||
"babel-preset-react-native": "^1.9.1",
|
||||
"babel-register": "^6.24.1",
|
||||
|
@ -35,6 +37,7 @@
|
|||
"request": "^2.79.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"source-map": "^0.5.6",
|
||||
"temp": "0.8.3",
|
||||
"throat": "^3.0.0",
|
||||
"uglify-js": "2.7.5",
|
||||
"write-file-atomic": "^1.2.0",
|
||||
|
|
|
@ -30,7 +30,7 @@ jest
|
|||
|
||||
var Bundler = require('../');
|
||||
var Resolver = require('../../Resolver');
|
||||
var defaults = require('../../../defaults');
|
||||
var defaults = require('../../defaults');
|
||||
var sizeOf = require('image-size');
|
||||
var fs = require('fs');
|
||||
const os = require('os');
|
||||
|
|
|
@ -24,7 +24,7 @@ const ModuleTransport = require('../lib/ModuleTransport');
|
|||
const imageSize = require('image-size');
|
||||
const path = require('path');
|
||||
const denodeify = require('denodeify');
|
||||
const defaults = require('../../defaults');
|
||||
const defaults = require('../../src/defaults');
|
||||
const os = require('os');
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
const toLocalPath = require('../node-haste/lib/toLocalPath');
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const babelRegisterOnly = require('../../../babelRegisterOnly');
|
||||
const babelRegisterOnly = require('../../babelRegisterOnly');
|
||||
const constantFolding = require('./constant-folding');
|
||||
const extractDependencies = require('./extract-dependencies');
|
||||
const inline = require('./inline');
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
const defaults = require('../../defaults');
|
||||
const defaults = require('../defaults');
|
||||
const nullthrows = require('fbjs/lib/nullthrows');
|
||||
const parallel = require('async/parallel');
|
||||
const seq = require('async/seq');
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
jest.disableAutomock();
|
||||
|
||||
const ModuleGraph = require('../ModuleGraph');
|
||||
const defaults = require('../../../defaults');
|
||||
const defaults = require('../../defaults');
|
||||
|
||||
const FILE_TYPE = 'module';
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ const Module = require('./Module');
|
|||
const ModuleCache = require('./ModuleCache');
|
||||
const ResolutionRequest = require('../../node-haste/DependencyGraph/ResolutionRequest');
|
||||
|
||||
const defaults = require('../../../defaults');
|
||||
const defaults = require('../../defaults');
|
||||
|
||||
import type {Moduleish, Packageish} from '../../node-haste/DependencyGraph/ResolutionRequest';
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ function countLines(module) {
|
|||
|
||||
function lineByLineMap(file) {
|
||||
return {
|
||||
file: file,
|
||||
file,
|
||||
mappings: 'AAAA;',
|
||||
names: [],
|
||||
sources: [file],
|
||||
|
|
|
@ -12,7 +12,7 @@ jest.disableAutomock();
|
|||
|
||||
const optimizeModule = require('../optimize-module');
|
||||
const transformModule = require('../transform-module');
|
||||
const transformer = require('../../../../transformer.js');
|
||||
const transformer = require('../../../transformer.js');
|
||||
const {SourceMapConsumer} = require('source-map');
|
||||
const {fn} = require('../../test-helpers');
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ const JsFileWrapping = require('./JsFileWrapping');
|
|||
|
||||
const asyncify = require('async/asyncify');
|
||||
const collectDependencies = require('./collect-dependencies');
|
||||
const defaults = require('../../../defaults');
|
||||
const defaults = require('../../defaults');
|
||||
const docblock = require('../../node-haste/DependencyGraph/docblock');
|
||||
const generate = require('./generate');
|
||||
const path = require('path');
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
jest.useRealTimers();
|
||||
|
||||
jest.unmock('../');
|
||||
jest.unmock('../../../defaults');
|
||||
jest.unmock('../../defaults');
|
||||
jest.mock('path');
|
||||
|
||||
const {join: pathJoin} = require.requireActual('path');
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
const DependencyGraph = require('../node-haste/DependencyGraph');
|
||||
|
||||
const defaults = require('../../defaults');
|
||||
const defaults = require('../defaults');
|
||||
const pathJoin = require('path').join;
|
||||
|
||||
import type ResolutionResponse from '../node-haste/DependencyGraph/ResolutionResponse';
|
||||
|
|
|
@ -15,7 +15,7 @@ const AssetServer = require('../AssetServer');
|
|||
const Bundler = require('../Bundler');
|
||||
const MultipartResponse = require('./MultipartResponse');
|
||||
|
||||
const defaults = require('../../defaults');
|
||||
const defaults = require('../defaults');
|
||||
const emptyFunction = require('fbjs/lib/emptyFunction');
|
||||
const mime = require('mime-types');
|
||||
const parsePlatformFilePath = require('../node-haste/lib/parsePlatformFilePath');
|
||||
|
|
|
@ -19,20 +19,20 @@ exports.assetExts = [
|
|||
|
||||
exports.sourceExts = ['js', 'json'];
|
||||
|
||||
exports.moduleSystem = require.resolve('./src/Resolver/polyfills/require.js');
|
||||
exports.moduleSystem = require.resolve('./Resolver/polyfills/require.js');
|
||||
|
||||
exports.platforms = ['ios', 'android', 'windows', 'web'];
|
||||
|
||||
exports.polyfills = [
|
||||
require.resolve('./src/Resolver/polyfills/Object.es6.js'),
|
||||
require.resolve('./src/Resolver/polyfills/console.js'),
|
||||
require.resolve('./src/Resolver/polyfills/error-guard.js'),
|
||||
require.resolve('./src/Resolver/polyfills/Number.es6.js'),
|
||||
require.resolve('./src/Resolver/polyfills/String.prototype.es6.js'),
|
||||
require.resolve('./src/Resolver/polyfills/Array.prototype.es6.js'),
|
||||
require.resolve('./src/Resolver/polyfills/Array.es6.js'),
|
||||
require.resolve('./src/Resolver/polyfills/Object.es7.js'),
|
||||
require.resolve('./src/Resolver/polyfills/babelHelpers.js'),
|
||||
require.resolve('./Resolver/polyfills/Object.es6.js'),
|
||||
require.resolve('./Resolver/polyfills/console.js'),
|
||||
require.resolve('./Resolver/polyfills/error-guard.js'),
|
||||
require.resolve('./Resolver/polyfills/Number.es6.js'),
|
||||
require.resolve('./Resolver/polyfills/String.prototype.es6.js'),
|
||||
require.resolve('./Resolver/polyfills/Array.prototype.es6.js'),
|
||||
require.resolve('./Resolver/polyfills/Array.es6.js'),
|
||||
require.resolve('./Resolver/polyfills/Object.es7.js'),
|
||||
require.resolve('./Resolver/polyfills/babelHelpers.js'),
|
||||
];
|
||||
|
||||
exports.providesModuleNodeModules = [
|
|
@ -11,18 +11,18 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const Logger = require('./src/Logger');
|
||||
const TransformCaching = require('./src/lib/TransformCaching');
|
||||
const Logger = require('./Logger');
|
||||
const TransformCaching = require('./lib/TransformCaching');
|
||||
|
||||
const debug = require('debug');
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
|
||||
import type {PostProcessModules, PostMinifyProcess} from './src/Bundler';
|
||||
import type Server from './src/Server';
|
||||
import type {GlobalTransformCache} from './src/lib/GlobalTransformCache';
|
||||
import type {TransformCache} from './src/lib/TransformCaching';
|
||||
import type {Reporter} from './src/lib/reporting';
|
||||
import type {HasteImpl} from './src/node-haste/Module';
|
||||
import type {PostProcessModules, PostMinifyProcess} from './Bundler';
|
||||
import type Server from './Server';
|
||||
import type {GlobalTransformCache} from './lib/GlobalTransformCache';
|
||||
import type {TransformCache} from './lib/TransformCaching';
|
||||
import type {Reporter} from './lib/reporting';
|
||||
import type {HasteImpl} from './node-haste/Module';
|
||||
|
||||
exports.createServer = createServer;
|
||||
exports.Logger = Logger;
|
||||
|
@ -78,7 +78,7 @@ function assertPublicBundleOptions(bo: mixed): PublicBundleOptions {
|
|||
|
||||
exports.buildBundle = function(options: Options, bundleOptions: PublicBundleOptions) {
|
||||
var server = createNonPersistentServer(options);
|
||||
const ServerClass = require('./src/Server');
|
||||
const ServerClass = require('./Server');
|
||||
return server.buildBundle({
|
||||
...ServerClass.DEFAULT_BUNDLE_OPTIONS,
|
||||
...assertPublicBundleOptions(bundleOptions),
|
||||
|
@ -129,7 +129,7 @@ function createServer(options: StrictOptions): Server {
|
|||
}
|
||||
const serverOptions = Object.assign({}, options);
|
||||
delete serverOptions.verbose;
|
||||
const ServerClass = require('./src/Server');
|
||||
const ServerClass = require('./Server');
|
||||
return new ServerClass(serverOptions);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ function createNonPersistentServer(options: Options): Server {
|
|||
// It's unsound to set-up the reporter here,
|
||||
// but this allows backward compatibility.
|
||||
reporter: options.reporter == null
|
||||
? require('./src/lib/reporting').nullReporter
|
||||
? require('./lib/reporting').nullReporter
|
||||
: options.reporter,
|
||||
...options,
|
||||
watch: !options.nonPersistent,
|
|
@ -18,7 +18,6 @@ const fs = require('fs');
|
|||
const invariant = require('fbjs/lib/invariant');
|
||||
const isAbsolutePath = require('absolute-path');
|
||||
const jsonStableStringify = require('json-stable-stringify');
|
||||
const path = require('path');
|
||||
|
||||
const {join: joinPath, relative: relativePath, extname} = require('path');
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ function saveBundleAndMap(
|
|||
bundleEncoding: encoding,
|
||||
dev,
|
||||
sourcemapOutput,
|
||||
sourcemapSourcesRoot
|
||||
sourcemapSourcesRoot,
|
||||
} = options;
|
||||
|
||||
log('start');
|
||||
|
|
|
@ -78,7 +78,7 @@ function saveAsAssets(
|
|||
|
||||
return Promise.all([
|
||||
writeUnbundle,
|
||||
sourcemapOutput && writeSourceMap(sourcemapOutput, JSON.stringify(sourceMap), log)
|
||||
sourcemapOutput && writeSourceMap(sourcemapOutput, JSON.stringify(sourceMap), log),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ function buildTableAndContents(
|
|||
return [
|
||||
fileHeader,
|
||||
table,
|
||||
startupCodeBuffer
|
||||
startupCodeBuffer,
|
||||
].concat(moduleBuffers.map(({buffer}) => buffer));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ const makeHMRConfig = require('babel-preset-react-native/configs/hmr');
|
|||
const path = require('path');
|
||||
const resolvePlugins = require('babel-preset-react-native/lib/resolvePlugins');
|
||||
|
||||
const {compactMapping} = require('./src/Bundler/source-map');
|
||||
const {compactMapping} = require('./Bundler/source-map');
|
||||
|
||||
import type {Plugins as BabelPlugins} from 'babel-core';
|
||||
import type {Transformer, TransformOptions} from './src/JSTransformer/worker';
|
||||
import type {Transformer, TransformOptions} from './JSTransformer/worker';
|
||||
|
||||
const cacheKeyParts = [
|
||||
fs.readFileSync(__filename),
|
||||
|
@ -63,7 +63,7 @@ const getBabelRC = (function() {
|
|||
if (!projectBabelRCPath || !fs.existsSync(projectBabelRCPath)) {
|
||||
babelRC = json5.parse(
|
||||
fs.readFileSync(
|
||||
path.resolve(__dirname, 'rn-babelrc.json'))
|
||||
path.resolve(__dirname, '..', 'rn-babelrc.json'))
|
||||
);
|
||||
|
||||
// Require the babel-preset's listed in the default babel config
|
|
@ -9,14 +9,12 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const babelRegisterOnly = require('./packager/babelRegisterOnly');
|
||||
const babelRegisterOnly = require('./packager/src/babelRegisterOnly');
|
||||
const escapeRegExp = require('lodash/escapeRegExp');
|
||||
const path = require('path');
|
||||
|
||||
const BABEL_ENABLED_PATHS = [
|
||||
'packager/index.js',
|
||||
'packager/src',
|
||||
'packager/transformer.js',
|
||||
'local-cli',
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue