mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 01:25:39 +00:00
73c85e4f31
Reviewed By: kassens Differential Revision: D4777088 fbshipit-source-id: d07f4d1dd019a814c8bee4caeb57fc1dd3721c27
45 lines
1.2 KiB
JavaScript
45 lines
1.2 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';
|
|
|
|
var path = require('path');
|
|
|
|
// Don't forget to everything listed here to `package.json`
|
|
// modulePathIgnorePatterns.
|
|
var sharedBlacklist = [
|
|
/node_modules[/\\]react[/\\]dist[/\\].*/,
|
|
|
|
/website\/node_modules\/.*/,
|
|
|
|
/heapCapture\/bundle\.js/,
|
|
];
|
|
|
|
function escapeRegExp(pattern) {
|
|
if (Object.prototype.toString.call(pattern) === '[object RegExp]') {
|
|
return pattern.source.replace(/\//g, path.sep);
|
|
} else if (typeof pattern === 'string') {
|
|
var escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
// convert the '/' into an escaped local file separator
|
|
return escaped.replace(/\//g, '\\' + path.sep);
|
|
} else {
|
|
throw new Error('Unexpected packager blacklist pattern: ' + pattern);
|
|
}
|
|
}
|
|
|
|
function blacklist(additionalBlacklist) {
|
|
return new RegExp('(' +
|
|
(additionalBlacklist || []).concat(sharedBlacklist)
|
|
.map(escapeRegExp)
|
|
.join('|') +
|
|
')$'
|
|
);
|
|
}
|
|
|
|
module.exports = blacklist;
|