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