Move remaining Metro Bundler files around.

Reviewed By: jeanlauliac

Differential Revision: D5154653

fbshipit-source-id: 482bf9829263d5d8f3d0b951ee58e2020236cc2c
This commit is contained in:
Christoph Pojer 2017-05-31 11:00:41 -07:00 committed by Facebook Github Bot
parent db5e2e5a8a
commit 921005d44d
24 changed files with 46 additions and 44 deletions

View File

@ -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",

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -11,7 +11,7 @@
jest.disableAutomock();
const ModuleGraph = require('../ModuleGraph');
const defaults = require('../../../defaults');
const defaults = require('../../defaults');
const FILE_TYPE = 'module';

View File

@ -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';

View File

@ -286,7 +286,7 @@ function countLines(module) {
function lineByLineMap(file) {
return {
file: file,
file,
mappings: 'AAAA;',
names: [],
sources: [file],

View 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');

View File

@ -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');

View File

@ -11,7 +11,7 @@
jest.useRealTimers();
jest.unmock('../');
jest.unmock('../../../defaults');
jest.unmock('../../defaults');
jest.mock('path');
const {join: pathJoin} = require.requireActual('path');

View File

@ -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';

View File

@ -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');

View File

@ -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 = [

View File

@ -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,

View File

@ -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');

View File

@ -50,7 +50,7 @@ function saveBundleAndMap(
bundleEncoding: encoding,
dev,
sourcemapOutput,
sourcemapSourcesRoot
sourcemapSourcesRoot,
} = options;
log('start');

View File

@ -78,7 +78,7 @@ function saveAsAssets(
return Promise.all([
writeUnbundle,
sourcemapOutput && writeSourceMap(sourcemapOutput, JSON.stringify(sourceMap), log)
sourcemapOutput && writeSourceMap(sourcemapOutput, JSON.stringify(sourceMap), log),
]);
}

View File

@ -190,7 +190,7 @@ function buildTableAndContents(
return [
fileHeader,
table,
startupCodeBuffer
startupCodeBuffer,
].concat(moduleBuffers.map(({buffer}) => buffer));
}

View File

@ -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