mirror of
https://github.com/status-im/react-native.git
synced 2025-01-13 11:05:21 +00:00
Remove react-packager
indirection.
Summary: This moves the `src` directory one level up and removes the `react-packager` folder. Personally, I always disliked this indirection. I'm reorganizing some things in RNP, so this seems to make sense. Not sure if I forgot to update any paths. Can anyone advice if there are more places that need change? Reviewed By: jeanlauliac Differential Revision: D4487867 fbshipit-source-id: d63f9c79d6238300df9632d2e6a4e6a4196d5ccb
This commit is contained in:
parent
0ecc4047af
commit
a2c84d14ce
@ -12,7 +12,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// This is a stub for flow to make it understand require('./icon.png')
|
// This is a stub for flow to make it understand require('./icon.png')
|
||||||
// See packager/react-packager/src/Bundler/index.js
|
// See packager/src/Bundler/index.js
|
||||||
|
|
||||||
var AssetRegistry = require('AssetRegistry');
|
var AssetRegistry = require('AssetRegistry');
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ const path = require('path');
|
|||||||
|
|
||||||
const nodeFiles = RegExp([
|
const nodeFiles = RegExp([
|
||||||
'/local-cli/',
|
'/local-cli/',
|
||||||
'/packager/(?!react-packager/src/Resolver/polyfills/)',
|
'/packager/(?!src/Resolver/polyfills/)',
|
||||||
].join('|'));
|
].join('|'));
|
||||||
const nodeOptions = babelRegisterOnly.config([nodeFiles]);
|
const nodeOptions = babelRegisterOnly.config([nodeFiles]);
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
const mockComponent = require.requireActual('./mockComponent');
|
const mockComponent = require.requireActual('./mockComponent');
|
||||||
|
|
||||||
require.requireActual('../packager/react-packager/src/Resolver/polyfills/babelHelpers.js');
|
require.requireActual('../packager/src/Resolver/polyfills/babelHelpers.js');
|
||||||
require.requireActual('../packager/react-packager/src/Resolver/polyfills/Object.es7.js');
|
require.requireActual('../packager/src/Resolver/polyfills/Object.es7.js');
|
||||||
require.requireActual('../packager/react-packager/src/Resolver/polyfills/error-guard');
|
require.requireActual('../packager/src/Resolver/polyfills/error-guard');
|
||||||
|
|
||||||
global.__DEV__ = true;
|
global.__DEV__ = true;
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const log = require('../util/log').out('bundle');
|
const log = require('../util/log').out('bundle');
|
||||||
const Server = require('../../packager/react-packager/src/Server');
|
const Server = require('../../packager/src/Server');
|
||||||
const TerminalReporter = require('../../packager/react-packager/src/lib/TerminalReporter');
|
const TerminalReporter = require('../../packager/src/lib/TerminalReporter');
|
||||||
|
|
||||||
const outputBundle = require('./output/bundle');
|
const outputBundle = require('./output/bundle');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const meta = require('./meta');
|
const meta = require('./meta');
|
||||||
const relativizeSourceMap = require('../../../packager/react-packager/src/lib/relativizeSourceMap');
|
const relativizeSourceMap = require('../../../packager/src//lib/relativizeSourceMap');
|
||||||
const writeFile = require('./writeFile');
|
const writeFile = require('./writeFile');
|
||||||
|
|
||||||
import type Bundle from '../../../packager/react-packager/src/Bundler/Bundle';
|
import type Bundle from '../../../packager/src//Bundler/Bundle';
|
||||||
import type Server from '../../../packager/react-packager/src/Server';
|
import type Server from '../../../packager/src//Server';
|
||||||
import type {OutputOptions, RequestOptions} from '../types.flow';
|
import type {OutputOptions, RequestOptions} from '../types.flow';
|
||||||
|
|
||||||
function buildBundle(packagerClient: Server, requestOptions: RequestOptions) {
|
function buildBundle(packagerClient: Server, requestOptions: RequestOptions) {
|
||||||
|
@ -15,13 +15,13 @@ const MAGIC_UNBUNDLE_NUMBER = require('./magic-number');
|
|||||||
const buildSourceMapWithMetaData = require('./build-unbundle-sourcemap-with-metadata');
|
const buildSourceMapWithMetaData = require('./build-unbundle-sourcemap-with-metadata');
|
||||||
const mkdirp = require('mkdirp');
|
const mkdirp = require('mkdirp');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const relativizeSourceMap = require('../../../../packager/react-packager/src/lib/relativizeSourceMap');
|
const relativizeSourceMap = require('../../../../packager/src//lib/relativizeSourceMap');
|
||||||
const writeFile = require('../writeFile');
|
const writeFile = require('../writeFile');
|
||||||
const writeSourceMap = require('./write-sourcemap');
|
const writeSourceMap = require('./write-sourcemap');
|
||||||
|
|
||||||
const {joinModules} = require('./util');
|
const {joinModules} = require('./util');
|
||||||
|
|
||||||
import type Bundle from '../../../../packager/react-packager/src/Bundler/Bundle';
|
import type Bundle from '../../../../packager/src//Bundler/Bundle';
|
||||||
import type {OutputOptions} from '../../types.flow';
|
import type {OutputOptions} from '../../types.flow';
|
||||||
|
|
||||||
// must not start with a dot, as that won't go into the apk
|
// must not start with a dot, as that won't go into the apk
|
||||||
|
@ -14,12 +14,12 @@ const MAGIC_UNBUNDLE_FILE_HEADER = require('./magic-number');
|
|||||||
|
|
||||||
const buildSourceMapWithMetaData = require('./build-unbundle-sourcemap-with-metadata');
|
const buildSourceMapWithMetaData = require('./build-unbundle-sourcemap-with-metadata');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const relativizeSourceMap = require('../../../../packager/react-packager/src/lib/relativizeSourceMap');
|
const relativizeSourceMap = require('../../../../packager/src//lib/relativizeSourceMap');
|
||||||
const writeSourceMap = require('./write-sourcemap');
|
const writeSourceMap = require('./write-sourcemap');
|
||||||
|
|
||||||
const {joinModules} = require('./util');
|
const {joinModules} = require('./util');
|
||||||
|
|
||||||
import type ModuleTransport from '../../../../packager/react-packager/src/lib/ModuleTransport';
|
import type ModuleTransport from '../../../../packager/src//lib/ModuleTransport';
|
||||||
import type {Bundle, ModuleGroups, OutputOptions} from '../../types.flow';
|
import type {Bundle, ModuleGroups, OutputOptions} from '../../types.flow';
|
||||||
|
|
||||||
const SIZEOF_UINT32 = 4;
|
const SIZEOF_UINT32 = 4;
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
const asAssets = require('./as-assets');
|
const asAssets = require('./as-assets');
|
||||||
const asIndexedFile = require('./as-indexed-file');
|
const asIndexedFile = require('./as-indexed-file');
|
||||||
|
|
||||||
import type Bundle from '../../../../packager/react-packager/src/Bundler/Bundle';
|
import type Bundle from '../../../../packager/src//Bundler/Bundle';
|
||||||
import type Server from '../../../../packager/react-packager/src/Server';
|
import type Server from '../../../../packager/src//Server';
|
||||||
import type {OutputOptions, RequestOptions} from '../../types.flow';
|
import type {OutputOptions, RequestOptions} from '../../types.flow';
|
||||||
|
|
||||||
function buildBundle(packagerClient: Server, requestOptions: RequestOptions) {
|
function buildBundle(packagerClient: Server, requestOptions: RequestOptions) {
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import type Bundle from '../../packager/react-packager/src/Bundler/Bundle';
|
import type Bundle from '../../packager/src/Bundler/Bundle';
|
||||||
import type {Unbundle} from '../../packager/react-packager/src/Bundler/Bundle';
|
import type {Unbundle} from '../../packager/src/Bundler/Bundle';
|
||||||
import type ModuleTransport from '../../packager/react-packager/src/lib/ModuleTransport';
|
import type ModuleTransport from '../../packager/src/lib/ModuleTransport';
|
||||||
import type {MixedSourceMap} from '../../packager/react-packager/src/lib/SourceMap';
|
import type {MixedSourceMap} from '../../packager/src/lib/SourceMap';
|
||||||
|
|
||||||
export type {Bundle, ModuleTransport, MixedSourceMap as SourceMap, Unbundle};
|
export type {Bundle, ModuleTransport, MixedSourceMap as SourceMap, Unbundle};
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ const Config = require('../util/Config');
|
|||||||
const defaultConfig = require('./default.config');
|
const defaultConfig = require('./default.config');
|
||||||
const minimist = require('minimist');
|
const minimist = require('minimist');
|
||||||
|
|
||||||
import type {GetTransformOptions} from '../../packager/react-packager/src/Bundler';
|
import type {GetTransformOptions} from '../../packager/src/Bundler';
|
||||||
import type {CommandT} from '../commands';
|
import type {CommandT} from '../commands';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
const InspectorProxy = require('./util/inspectorProxy.js');
|
const InspectorProxy = require('./util/inspectorProxy.js');
|
||||||
const ReactPackager = require('../../packager/react-packager');
|
const ReactPackager = require('../../packager/react-packager');
|
||||||
const TerminalReporter = require('../../packager/react-packager/src/lib/TerminalReporter');
|
const TerminalReporter = require('../../packager/src/lib/TerminalReporter');
|
||||||
|
|
||||||
const attachHMRServer = require('./util/attachHMRServer');
|
const attachHMRServer = require('./util/attachHMRServer');
|
||||||
const connect = require('connect');
|
const connect = require('connect');
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
const querystring = require('querystring');
|
const querystring = require('querystring');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
|
|
||||||
const {getInverseDependencies} = require('../../../packager/react-packager/src/node-haste');
|
const {getInverseDependencies} = require('../../../packager/src//node-haste');
|
||||||
|
|
||||||
const blacklist = [
|
const blacklist = [
|
||||||
'Libraries/Utilities/HMRClient.js',
|
'Libraries/Utilities/HMRClient.js',
|
||||||
|
@ -17,20 +17,20 @@ exports.assetExts = [
|
|||||||
'html', 'pdf', // Document formats
|
'html', 'pdf', // Document formats
|
||||||
];
|
];
|
||||||
|
|
||||||
exports.moduleSystem = require.resolve('./react-packager/src/Resolver/polyfills/require.js');
|
exports.moduleSystem = require.resolve('./src/Resolver/polyfills/require.js');
|
||||||
|
|
||||||
exports.platforms = ['ios', 'android', 'windows', 'web'];
|
exports.platforms = ['ios', 'android', 'windows', 'web'];
|
||||||
|
|
||||||
exports.polyfills = [
|
exports.polyfills = [
|
||||||
require.resolve('./react-packager/src/Resolver/polyfills/polyfills.js'),
|
require.resolve('./src/Resolver/polyfills/polyfills.js'),
|
||||||
require.resolve('./react-packager/src/Resolver/polyfills/console.js'),
|
require.resolve('./src/Resolver/polyfills/console.js'),
|
||||||
require.resolve('./react-packager/src/Resolver/polyfills/error-guard.js'),
|
require.resolve('./src/Resolver/polyfills/error-guard.js'),
|
||||||
require.resolve('./react-packager/src/Resolver/polyfills/Number.es6.js'),
|
require.resolve('./src/Resolver/polyfills/Number.es6.js'),
|
||||||
require.resolve('./react-packager/src/Resolver/polyfills/String.prototype.es6.js'),
|
require.resolve('./src/Resolver/polyfills/String.prototype.es6.js'),
|
||||||
require.resolve('./react-packager/src/Resolver/polyfills/Array.prototype.es6.js'),
|
require.resolve('./src/Resolver/polyfills/Array.prototype.es6.js'),
|
||||||
require.resolve('./react-packager/src/Resolver/polyfills/Array.es6.js'),
|
require.resolve('./src/Resolver/polyfills/Array.es6.js'),
|
||||||
require.resolve('./react-packager/src/Resolver/polyfills/Object.es7.js'),
|
require.resolve('./src/Resolver/polyfills/Object.es7.js'),
|
||||||
require.resolve('./react-packager/src/Resolver/polyfills/babelHelpers.js'),
|
require.resolve('./src/Resolver/polyfills/babelHelpers.js'),
|
||||||
];
|
];
|
||||||
|
|
||||||
exports.providesModuleNodeModules = [
|
exports.providesModuleNodeModules = [
|
||||||
|
@ -11,5 +11,5 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('../../setupBabel')();
|
require('../setupBabel')();
|
||||||
module.exports = require('./react-packager');
|
module.exports = require('./react-packager');
|
@ -1,8 +0,0 @@
|
|||||||
*~
|
|
||||||
*.swm
|
|
||||||
*.swn
|
|
||||||
*.swp
|
|
||||||
*.DS_STORE
|
|
||||||
npm-debug.log
|
|
||||||
.cache
|
|
||||||
node_modules
|
|
@ -28,7 +28,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');
|
||||||
|
|
@ -143,8 +143,9 @@ class Bundler {
|
|||||||
cacheKey: transformCacheKey,
|
cacheKey: transformCacheKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
/* $FlowFixMe: in practice it's always here. */
|
this._transformer = new Transformer({
|
||||||
this._transformer = new Transformer(opts.transformModulePath);
|
transformModulePath: opts.transformModulePath,
|
||||||
|
});
|
||||||
|
|
||||||
this._resolver = new Resolver({
|
this._resolver = new Resolver({
|
||||||
assetExts: opts.assetExts,
|
assetExts: opts.assetExts,
|
@ -25,7 +25,7 @@ var Transformer = require('../');
|
|||||||
const {any} = jasmine;
|
const {any} = jasmine;
|
||||||
|
|
||||||
describe('Transformer', function() {
|
describe('Transformer', function() {
|
||||||
let workers, Cache;
|
let options, workers, Cache;
|
||||||
const fileName = '/an/arbitrary/file.js';
|
const fileName = '/an/arbitrary/file.js';
|
||||||
const transformModulePath = __filename;
|
const transformModulePath = __filename;
|
||||||
|
|
||||||
@ -34,6 +34,7 @@ describe('Transformer', function() {
|
|||||||
Cache.prototype.get = jest.fn((a, b, c) => c());
|
Cache.prototype.get = jest.fn((a, b, c) => c());
|
||||||
|
|
||||||
fs.writeFileSync.mockClear();
|
fs.writeFileSync.mockClear();
|
||||||
|
options = {transformModulePath};
|
||||||
workerFarm.mockClear();
|
workerFarm.mockClear();
|
||||||
workerFarm.mockImplementation((opts, path, methods) => {
|
workerFarm.mockImplementation((opts, path, methods) => {
|
||||||
const api = workers = {};
|
const api = workers = {};
|
||||||
@ -42,11 +43,11 @@ describe('Transformer', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('passes transform module path, file path, source code' +
|
it('passes transform module path, file path, source code,' +
|
||||||
' to the worker farm when transforming', () => {
|
' and options to the worker farm when transforming', () => {
|
||||||
const transformOptions = {arbitrary: 'options'};
|
const transformOptions = {arbitrary: 'options'};
|
||||||
const code = 'arbitrary(code)';
|
const code = 'arbitrary(code)';
|
||||||
new Transformer(transformModulePath).transformFile(fileName, code, transformOptions);
|
new Transformer(options).transformFile(fileName, code, transformOptions);
|
||||||
expect(workers.transformAndExtractDependencies).toBeCalledWith(
|
expect(workers.transformAndExtractDependencies).toBeCalledWith(
|
||||||
transformModulePath,
|
transformModulePath,
|
||||||
fileName,
|
fileName,
|
||||||
@ -57,7 +58,7 @@ describe('Transformer', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should add file info to parse errors', function() {
|
it('should add file info to parse errors', function() {
|
||||||
const transformer = new Transformer(transformModulePath);
|
const transformer = new Transformer(options);
|
||||||
var message = 'message';
|
var message = 'message';
|
||||||
var snippet = 'snippet';
|
var snippet = 'snippet';
|
||||||
|
|
@ -13,13 +13,12 @@
|
|||||||
|
|
||||||
const Logger = require('../Logger');
|
const Logger = require('../Logger');
|
||||||
|
|
||||||
const debug = require('debug')('RNP:JStransformer');
|
const declareOpts = require('../lib/declareOpts');
|
||||||
const denodeify = require('denodeify');
|
const denodeify = require('denodeify');
|
||||||
const invariant = require('fbjs/lib/invariant');
|
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const path = require('path');
|
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const workerFarm = require('worker-farm');
|
const workerFarm = require('worker-farm');
|
||||||
|
const debug = require('debug')('RNP:JStransformer');
|
||||||
|
|
||||||
import type {Data as TransformData, Options as TransformOptions} from './worker/worker';
|
import type {Data as TransformData, Options as TransformOptions} from './worker/worker';
|
||||||
import type {SourceMap} from '../lib/SourceMap';
|
import type {SourceMap} from '../lib/SourceMap';
|
||||||
@ -30,11 +29,36 @@ import type {SourceMap} from '../lib/SourceMap';
|
|||||||
const MAX_CALLS_PER_WORKER = 600;
|
const MAX_CALLS_PER_WORKER = 600;
|
||||||
|
|
||||||
// Worker will timeout if one of the callers timeout.
|
// Worker will timeout if one of the callers timeout.
|
||||||
const TRANSFORM_TIMEOUT_INTERVAL = 301000;
|
const DEFAULT_MAX_CALL_TIME = 301000;
|
||||||
|
|
||||||
// How may times can we tolerate failures from the worker.
|
// How may times can we tolerate failures from the worker.
|
||||||
const MAX_RETRIES = 2;
|
const MAX_RETRIES = 2;
|
||||||
|
|
||||||
|
const validateOpts = declareOpts({
|
||||||
|
transformModulePath: {
|
||||||
|
type:'string',
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
transformTimeoutInterval: {
|
||||||
|
type: 'number',
|
||||||
|
default: DEFAULT_MAX_CALL_TIME,
|
||||||
|
},
|
||||||
|
worker: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
type: 'array',
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
type Options = {
|
||||||
|
transformModulePath?: ?string,
|
||||||
|
transformTimeoutInterval?: ?number,
|
||||||
|
worker?: ?string,
|
||||||
|
methods?: ?Array<string>,
|
||||||
|
};
|
||||||
|
|
||||||
const maxConcurrentWorkers = ((cores, override) => {
|
const maxConcurrentWorkers = ((cores, override) => {
|
||||||
if (override) {
|
if (override) {
|
||||||
return Math.min(cores, override);
|
return Math.min(cores, override);
|
||||||
@ -69,8 +93,14 @@ function makeFarm(worker, methods, timeout) {
|
|||||||
|
|
||||||
class Transformer {
|
class Transformer {
|
||||||
|
|
||||||
|
_opts: {
|
||||||
|
transformModulePath?: ?string,
|
||||||
|
transformTimeoutInterval: number,
|
||||||
|
worker: ?string,
|
||||||
|
methods: Array<string>,
|
||||||
|
};
|
||||||
_workers: {[name: string]: mixed};
|
_workers: {[name: string]: mixed};
|
||||||
_transformModulePath: string;
|
_transformModulePath: ?string;
|
||||||
_transform: (
|
_transform: (
|
||||||
transform: string,
|
transform: string,
|
||||||
filename: string,
|
filename: string,
|
||||||
@ -83,18 +113,32 @@ class Transformer {
|
|||||||
sourceMap: SourceMap,
|
sourceMap: SourceMap,
|
||||||
) => Promise<{code: string, map: SourceMap}>;
|
) => Promise<{code: string, map: SourceMap}>;
|
||||||
|
|
||||||
constructor(transformModulePath: string) {
|
constructor(options: Options) {
|
||||||
invariant(path.isAbsolute(transformModulePath), 'transform module path should be absolute');
|
const opts = this._opts = validateOpts(options);
|
||||||
this._transformModulePath = transformModulePath;
|
|
||||||
|
const {transformModulePath} = opts;
|
||||||
|
|
||||||
|
if (opts.worker) {
|
||||||
|
this._workers =
|
||||||
|
makeFarm(opts.worker, opts.methods, opts.transformTimeoutInterval);
|
||||||
|
opts.methods.forEach(name => {
|
||||||
|
/* $FlowFixMe: assigning the class object fields directly is
|
||||||
|
* questionable, because it's prone to conflicts. */
|
||||||
|
this[name] = this._workers[name];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (transformModulePath) {
|
||||||
|
this._transformModulePath = require.resolve(transformModulePath);
|
||||||
|
|
||||||
this._workers = makeFarm(
|
this._workers = makeFarm(
|
||||||
require.resolve('./worker'),
|
require.resolve('./worker'),
|
||||||
['minify', 'transformAndExtractDependencies'],
|
['minify', 'transformAndExtractDependencies'],
|
||||||
TRANSFORM_TIMEOUT_INTERVAL,
|
opts.transformTimeoutInterval,
|
||||||
);
|
);
|
||||||
this._transform = denodeify(this._workers.transformAndExtractDependencies);
|
this._transform = denodeify(this._workers.transformAndExtractDependencies);
|
||||||
this.minify = denodeify(this._workers.minify);
|
this.minify = denodeify(this._workers.minify);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
kill() {
|
kill() {
|
||||||
this._workers && workerFarm.end(this._workers);
|
this._workers && workerFarm.end(this._workers);
|
||||||
@ -106,6 +150,7 @@ class Transformer {
|
|||||||
}
|
}
|
||||||
debug('transforming file', fileName);
|
debug('transforming file', fileName);
|
||||||
return this
|
return this
|
||||||
|
/* $FlowFixMe: _transformModulePath may be empty, see constructor */
|
||||||
._transform(this._transformModulePath, fileName, code, options)
|
._transform(this._transformModulePath, fileName, code, options)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
Logger.log(data.transformFileStartLogEntry);
|
Logger.log(data.transformFileStartLogEntry);
|
||||||
@ -117,7 +162,7 @@ class Transformer {
|
|||||||
if (error.type === 'TimeoutError') {
|
if (error.type === 'TimeoutError') {
|
||||||
const timeoutErr = new Error(
|
const timeoutErr = new Error(
|
||||||
`TimeoutError: transforming ${fileName} took longer than ` +
|
`TimeoutError: transforming ${fileName} took longer than ` +
|
||||||
`${TRANSFORM_TIMEOUT_INTERVAL / 1000} seconds.\n` +
|
`${this._opts.transformTimeoutInterval / 1000} seconds.\n` +
|
||||||
'You can adjust timeout via the \'transformTimeoutInterval\' option'
|
'You can adjust timeout via the \'transformTimeoutInterval\' option'
|
||||||
);
|
);
|
||||||
/* $FlowFixMe: monkey-patch Error */
|
/* $FlowFixMe: monkey-patch Error */
|
||||||
@ -126,7 +171,8 @@ class Transformer {
|
|||||||
} else if (error.type === 'ProcessTerminatedError') {
|
} else if (error.type === 'ProcessTerminatedError') {
|
||||||
const uncaughtError = new Error(
|
const uncaughtError = new Error(
|
||||||
'Uncaught error in the transformer worker: ' +
|
'Uncaught error in the transformer worker: ' +
|
||||||
this._transformModulePath
|
/* $FlowFixMe: _transformModulePath may be empty, see constructor */
|
||||||
|
this._opts.transformModulePath
|
||||||
);
|
);
|
||||||
/* $FlowFixMe: monkey-patch Error */
|
/* $FlowFixMe: monkey-patch Error */
|
||||||
uncaughtError.type = 'ProcessTerminatedError';
|
uncaughtError.type = 'ProcessTerminatedError';
|
@ -9,5 +9,5 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('../../../../../setupBabel')();
|
require('../../../../setupBabel')();
|
||||||
module.exports = require('./worker');
|
module.exports = require('./worker');
|
@ -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';
|
||||||
|
|
@ -28,7 +28,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');
|
||||||
|
|
||||||
type ResolveOptions = {|
|
type ResolveOptions = {|
|
||||||
assetExts: Extensions,
|
assetExts: Extensions,
|
@ -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 transform = require('../../../../../transformer.js');
|
const transform = require('../../../../transformer.js');
|
||||||
const {SourceMapConsumer} = require('source-map');
|
const {SourceMapConsumer} = require('source-map');
|
||||||
|
|
||||||
const {objectContaining} = jasmine;
|
const {objectContaining} = jasmine;
|
@ -9,7 +9,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
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');
|
const DependencyGraph = require('../node-haste');
|
||||||
|
|
||||||
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';
|
@ -166,8 +166,8 @@ function loadModuleImplementation(moduleId, module) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// keep args in sync with with defineModuleCode in
|
// keep args in sync with with defineModuleCode in
|
||||||
// packager/react-packager/src/Resolver/index.js
|
// packager/src//Resolver/index.js
|
||||||
// and packager/react-packager/src/ModuleGraph/worker.js
|
// and packager/src//ModuleGraph/worker.js
|
||||||
factory(global, require, moduleObject, exports, dependencyMap);
|
factory(global, require, moduleObject, exports, dependencyMap);
|
||||||
|
|
||||||
// avoid removing factory in DEV mode as it breaks HMR
|
// avoid removing factory in DEV mode as it breaks HMR
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user