mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
2d4055e513
Summary: @public Fixes #773, #1055 The resolver was getting a bit unwieldy because a lot has changed since the initial writing (porting node-haste). This also splits up a large complex file into the following: * Makes use of classes: Module, AssetModule, Package, and AssetModule_DEPRECATED (`image!` modules) * DependencyGraph is lazy for everything that isn't haste modules and packages (need to read ahead of time) * Lazy makes it fast, easier to reason about, and easier to add new loaders * Has a centralized filesystem wrapper: fast-fs (ffs) * ffs is async and lazy for any read operation and sync for directory/file lookup which makes it fast * we can easily drop in different adapters for ffs to be able to build up the tree: watchman, git ls-files, etc * use es6 for classes and easier to read promise-based code Follow up diffs will include: * Using new types (Module, AssetModule etc) in the rest of the codebase (currently we convert to plain object which is a bit of a hack) * using watchman to build up the fs * some caching at the object creation level (we are recreating Modules and Packages many times, we can cache them) * A plugin system for loaders (e.g. @tadeuzagallo wants to add a native module loader) Test Plan: * ./runJestTests.sh react-packager * ./runJestTests.sh PackagerIntegration * Export open source and run the e2e test * reset cache * ./fbrnios.sh run and click around
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
'use strict';
|
|
|
|
// Don't forget to everything listed here to `testConfig.json`
|
|
// modulePathIgnorePatterns.
|
|
var sharedBlacklist = [
|
|
'website',
|
|
'node_modules/react-tools/src/utils/ImmutableObject.js',
|
|
'node_modules/react-tools/src/core/ReactInstanceHandles.js',
|
|
'node_modules/react-tools/src/event/EventPropagators.js'
|
|
];
|
|
|
|
var platformBlacklists = {
|
|
web: [
|
|
'.ios.js'
|
|
],
|
|
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',
|
|
'.web.js',
|
|
'.android.js',
|
|
],
|
|
android: [
|
|
'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',
|
|
'.web.js',
|
|
'.ios.js',
|
|
],
|
|
};
|
|
|
|
function escapeRegExp(str) {
|
|
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
}
|
|
|
|
function blacklist(platform, additionalBlacklist) {
|
|
return new RegExp('(' +
|
|
(additionalBlacklist || []).concat(sharedBlacklist)
|
|
.concat(platformBlacklists[platform] || [])
|
|
.map(escapeRegExp)
|
|
.join('|') +
|
|
')$'
|
|
);
|
|
}
|
|
|
|
module.exports = blacklist;
|