mirror of
https://github.com/status-im/react-native.git
synced 2025-01-11 18:14:14 +00:00
Add option to disable internal transforms
Reviewed By: davidaurelio Differential Revision: D2815307 fb-gh-sync-id: 17ed8f13de7b4c41111efa4a5f2af5283e6ef3e0
This commit is contained in:
parent
1dc56a6758
commit
8604bd1812
@ -28,6 +28,7 @@ function buildBundle(args, config, output = outputBundle) {
|
|||||||
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
|
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
|
||||||
transformModulePath: args.transformer,
|
transformModulePath: args.transformer,
|
||||||
verbose: args.verbose,
|
verbose: args.verbose,
|
||||||
|
disableInternalTransforms: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const requestOpts = {
|
const requestOpts = {
|
||||||
|
5
packager/react-packager/src/Bundler/index.js
vendored
5
packager/react-packager/src/Bundler/index.js
vendored
@ -80,6 +80,10 @@ const validateOpts = declareOpts({
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
|
disableInternalTransforms: {
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
class Bundler {
|
class Bundler {
|
||||||
@ -131,6 +135,7 @@ class Bundler {
|
|||||||
blacklistRE: opts.blacklistRE,
|
blacklistRE: opts.blacklistRE,
|
||||||
cache: this._cache,
|
cache: this._cache,
|
||||||
transformModulePath: opts.transformModulePath,
|
transformModulePath: opts.transformModulePath,
|
||||||
|
disableInternalTransforms: opts.disableInternalTransforms,
|
||||||
});
|
});
|
||||||
|
|
||||||
this._projectRoots = opts.projectRoots;
|
this._projectRoots = opts.projectRoots;
|
||||||
|
@ -54,6 +54,10 @@ const validateOpts = declareOpts({
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
default: DEFAULT_MAX_CALL_TIME,
|
default: DEFAULT_MAX_CALL_TIME,
|
||||||
},
|
},
|
||||||
|
disableInternalTransforms: {
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
class Transformer {
|
class Transformer {
|
||||||
@ -64,14 +68,20 @@ class Transformer {
|
|||||||
this._transformModulePath = opts.transformModulePath;
|
this._transformModulePath = opts.transformModulePath;
|
||||||
|
|
||||||
if (opts.transformModulePath != null) {
|
if (opts.transformModulePath != null) {
|
||||||
this._workerWrapperPath = temp.path();
|
let transformer;
|
||||||
fs.writeFileSync(
|
|
||||||
this._workerWrapperPath,
|
if (opts.disableInternalTransforms) {
|
||||||
`
|
transformer = opts.transformModulePath;
|
||||||
module.exports = require(${JSON.stringify(require.resolve('./worker'))});
|
} else {
|
||||||
require(${JSON.stringify(String(opts.transformModulePath))});
|
transformer = this._workerWrapperPath = temp.path();
|
||||||
`
|
fs.writeFileSync(
|
||||||
);
|
this._workerWrapperPath,
|
||||||
|
`
|
||||||
|
module.exports = require(${JSON.stringify(require.resolve('./worker'))});
|
||||||
|
require(${JSON.stringify(String(opts.transformModulePath))});
|
||||||
|
`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
this._workers = workerFarm({
|
this._workers = workerFarm({
|
||||||
autoStart: true,
|
autoStart: true,
|
||||||
@ -79,7 +89,7 @@ class Transformer {
|
|||||||
maxCallsPerWorker: MAX_CALLS_PER_WORKER,
|
maxCallsPerWorker: MAX_CALLS_PER_WORKER,
|
||||||
maxCallTime: opts.transformTimeoutInterval,
|
maxCallTime: opts.transformTimeoutInterval,
|
||||||
maxRetries: MAX_RETRIES,
|
maxRetries: MAX_RETRIES,
|
||||||
}, this._workerWrapperPath);
|
}, transformer);
|
||||||
|
|
||||||
this._transform = Promise.denodeify(this._workers);
|
this._transform = Promise.denodeify(this._workers);
|
||||||
}
|
}
|
||||||
@ -87,7 +97,8 @@ class Transformer {
|
|||||||
|
|
||||||
kill() {
|
kill() {
|
||||||
this._workers && workerFarm.end(this._workers);
|
this._workers && workerFarm.end(this._workers);
|
||||||
if (typeof this._workerWrapperPath === 'string') {
|
if (this._workerWrapperPath &&
|
||||||
|
typeof this._workerWrapperPath === 'string') {
|
||||||
fs.unlink(this._workerWrapperPath, () => {}); // we don't care about potential errors here
|
fs.unlink(this._workerWrapperPath, () => {}); // we don't care about potential errors here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
packager/react-packager/src/Server/index.js
vendored
6
packager/react-packager/src/Server/index.js
vendored
@ -67,7 +67,11 @@ const validateOpts = declareOpts({
|
|||||||
getTransformOptionsModulePath: {
|
getTransformOptionsModulePath: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
required: false,
|
required: false,
|
||||||
}
|
},
|
||||||
|
disableInternalTransforms: {
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const bundleOpts = declareOpts({
|
const bundleOpts = declareOpts({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user