mirror of https://github.com/status-im/metro.git
Updates from Wed 1 Jul
This commit is contained in:
commit
d8fc316032
10
blacklist.js
10
blacklist.js
|
@ -8,6 +8,8 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
|
||||
// Don't forget to everything listed here to `testConfig.json`
|
||||
// modulePathIgnorePatterns.
|
||||
var sharedBlacklist = [
|
||||
|
@ -24,7 +26,7 @@ var platformBlacklists = {
|
|||
ios: [
|
||||
'node_modules/react-tools/src/browser/ui/React.js',
|
||||
'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js',
|
||||
// 'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
|
||||
'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
|
||||
'.web.js',
|
||||
'.android.js',
|
||||
],
|
||||
|
@ -32,14 +34,16 @@ var platformBlacklists = {
|
|||
'node_modules/react-tools/src/browser/ui/React.js',
|
||||
'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js',
|
||||
'node_modules/react-tools/src/browser/ReactTextComponent.js',
|
||||
// 'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
|
||||
'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
|
||||
'.web.js',
|
||||
'.ios.js',
|
||||
],
|
||||
};
|
||||
|
||||
function escapeRegExp(str) {
|
||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
||||
var escaped = str.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
||||
// convert the '/' into an escaped local file separator
|
||||
return escaped.replace(/\//g,'\\' + path.sep);
|
||||
}
|
||||
|
||||
function blacklist(platform, additionalBlacklist) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"jest-cli": "0.4.5",
|
||||
"jest-cli": "git://github.com/facebook/jest#0.5.x",
|
||||
"eslint": "0.9.2"
|
||||
}
|
||||
}
|
||||
|
|
21
packager.js
21
packager.js
|
@ -12,6 +12,7 @@ var fs = require('fs');
|
|||
var path = require('path');
|
||||
var execFile = require('child_process').execFile;
|
||||
var http = require('http');
|
||||
var isAbsolutePath = require('absolute-path');
|
||||
|
||||
var getFlowTypeCheckMiddleware = require('./getFlowTypeCheckMiddleware');
|
||||
|
||||
|
@ -56,6 +57,11 @@ var options = parseCommandLine([{
|
|||
}, {
|
||||
command: 'nonPersistent',
|
||||
description: 'Disable file watcher'
|
||||
}, {
|
||||
command: 'transformer',
|
||||
type: 'string',
|
||||
default: require.resolve('./transformer.js'),
|
||||
description: 'Specify a custom transformer to be used (absolute path)'
|
||||
}]);
|
||||
|
||||
if (options.projectRoots) {
|
||||
|
@ -63,8 +69,9 @@ if (options.projectRoots) {
|
|||
options.projectRoots = options.projectRoots.split(',');
|
||||
}
|
||||
} else {
|
||||
if (__dirname.match(/node_modules\/react-native\/packager$/)) {
|
||||
// packager is running from node_modules of another project
|
||||
// match on either path separator
|
||||
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]packager$/)) {
|
||||
// packager is running from node_modules of another project
|
||||
options.projectRoots = [path.resolve(__dirname, '../../..')];
|
||||
} else if (__dirname.match(/Pods\/React\/packager$/)) {
|
||||
// packager is running from node_modules of another project
|
||||
|
@ -91,7 +98,8 @@ if (options.assetRoots) {
|
|||
});
|
||||
}
|
||||
} else {
|
||||
if (__dirname.match(/node_modules\/react-native\/packager$/)) {
|
||||
// match on either path separator
|
||||
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]packager$/)) {
|
||||
options.assetRoots = [path.resolve(__dirname, '../../..')];
|
||||
} else if (__dirname.match(/Pods\/React\/packager$/)) {
|
||||
options.assetRoots = [path.resolve(__dirname, '../../..')];
|
||||
|
@ -208,12 +216,17 @@ function statusPageMiddleware(req, res, next) {
|
|||
}
|
||||
|
||||
function getAppMiddleware(options) {
|
||||
var transformerPath = options.transformer;
|
||||
if (!isAbsolutePath(transformerPath)) {
|
||||
transformerPath = path.resolve(process.cwd(), transformerPath);
|
||||
}
|
||||
|
||||
return ReactPackager.middleware({
|
||||
nonPersistent: options.nonPersistent,
|
||||
projectRoots: options.projectRoots,
|
||||
blacklistRE: blacklist(options.platform),
|
||||
cacheVersion: '2',
|
||||
transformModulePath: require.resolve('./transformer.js'),
|
||||
transformModulePath: transformerPath,
|
||||
assetRoots: options.assetRoots,
|
||||
assetExts: ['png', 'jpeg', 'jpg'],
|
||||
polyfillModuleNames: [
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
require('babel/register')({
|
||||
require('babel-core/register')({
|
||||
only: /react-packager\/src/
|
||||
});
|
||||
|
||||
|
|
|
@ -2353,7 +2353,8 @@ describe('DependencyGraph', function() {
|
|||
}
|
||||
callbacks.push(callback);
|
||||
return this;
|
||||
}
|
||||
},
|
||||
isWatchman: () => Promise.resolve(false),
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ const validateOpts = declareOpts({
|
|||
},
|
||||
ignoreFilePath: {
|
||||
type: 'function',
|
||||
|
||||
default: function(){}
|
||||
},
|
||||
fileWatcher: {
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
const nodeCrawl = require('./node');
|
||||
//const watchmanCrawl = require('./watchman');
|
||||
const watchmanCrawl = require('./watchman');
|
||||
|
||||
function crawl(roots, options) {
|
||||
return nodeCrawl(roots, options);
|
||||
|
||||
// Although, in theory, watchman should be much faster;
|
||||
// there is currently a bottleneck somewhere in the
|
||||
// encoding/decoding that is causing it to be slower
|
||||
// than node crawling. However, this should be fixed soon.
|
||||
// https://github.com/facebook/watchman/issues/113
|
||||
/*
|
||||
const {fileWatcher} = options;
|
||||
return fileWatcher.isWatchman().then(isWatchman => {
|
||||
|
||||
console.log(isWatchman);
|
||||
if (!isWatchman) {
|
||||
return false;
|
||||
}
|
||||
|
@ -30,7 +20,7 @@ function crawl(roots, options) {
|
|||
}
|
||||
|
||||
return nodeCrawl(roots, options);
|
||||
});*/
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = crawl;
|
||||
|
|
|
@ -36,7 +36,7 @@ function watchmanRecReadDir(roots, {ignore, fileWatcher, exts}) {
|
|||
}
|
||||
}
|
||||
|
||||
const cmd = Promise.promisify(watcher.client.command.bind(watcher.client));
|
||||
const cmd = Promise.denodeify(watcher.client.command.bind(watcher.client));
|
||||
return cmd(['query', watchedRoot, {
|
||||
'suffix': exts,
|
||||
'expression': ['allof', ['type', 'f'], 'exists', dirExpr],
|
||||
|
|
|
@ -12,9 +12,11 @@ const EventEmitter = require('events').EventEmitter;
|
|||
const sane = require('sane');
|
||||
const Promise = require('promise');
|
||||
const exec = require('child_process').exec;
|
||||
const _ = require('underscore');
|
||||
|
||||
const MAX_WAIT_TIME = 25000;
|
||||
|
||||
// TODO(amasad): can we use watchman version command instead?r
|
||||
const detectingWatcherClass = new Promise(function(resolve) {
|
||||
exec('which watchman', function(err, out) {
|
||||
if (err || out.length === 0) {
|
||||
|
@ -79,9 +81,11 @@ class FileWatcher extends EventEmitter {
|
|||
|
||||
static createDummyWatcher() {
|
||||
const ev = new EventEmitter();
|
||||
ev.end = function() {
|
||||
return Promise.resolve();
|
||||
};
|
||||
_.extend(ev, {
|
||||
isWatchman: () => Promise.resolve(false),
|
||||
end: () => Promise.resolve(),
|
||||
});
|
||||
|
||||
return ev;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var babel = require('babel');
|
||||
var babel = require('babel-core');
|
||||
|
||||
function transform(srcTxt, filename, options) {
|
||||
var result = babel.transform(srcTxt, {
|
||||
|
|
Loading…
Reference in New Issue