Updating NPM dependencies
This commit is contained in:
315
node_modules/jest-haste-map/build/crawlers/node.js
generated
vendored
315
node_modules/jest-haste-map/build/crawlers/node.js
generated
vendored
@@ -1,107 +1,140 @@
|
||||
'use strict';
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require('fs'));
|
||||
|
||||
_fs = function _fs() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _child_process() {
|
||||
const data = require('child_process');
|
||||
|
||||
_child_process = function _child_process() {
|
||||
_child_process = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _constants = _interopRequireDefault(require('../constants'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
var fastPath = _interopRequireWildcard(require('../lib/fast_path'));
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var newObj = {};
|
||||
if (obj != null) {
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: {};
|
||||
if (desc.get || desc.set) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _constants() {
|
||||
const data = _interopRequireDefault(require('../constants'));
|
||||
|
||||
_constants = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function fastPath() {
|
||||
const data = _interopRequireWildcard(require('../lib/fast_path'));
|
||||
|
||||
fastPath = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return (
|
||||
_arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest()
|
||||
);
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _nonIterableRest() {
|
||||
throw new TypeError('Invalid attempt to destructure non-iterable instance');
|
||||
}
|
||||
|
||||
function _iterableToArrayLimit(arr, i) {
|
||||
var _arr = [];
|
||||
var _n = true;
|
||||
var _d = false;
|
||||
var _e = undefined;
|
||||
try {
|
||||
for (
|
||||
var _i = arr[Symbol.iterator](), _s;
|
||||
!(_n = (_s = _i.next()).done);
|
||||
_n = true
|
||||
) {
|
||||
_arr.push(_s.value);
|
||||
if (i && _arr.length === i) break;
|
||||
}
|
||||
} catch (err) {
|
||||
_d = true;
|
||||
_e = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_n && _i['return'] != null) _i['return']();
|
||||
} finally {
|
||||
if (_d) throw _e;
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return _arr;
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
if (Array.isArray(arr)) return arr;
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
async function hasNativeFindSupport(forceNodeFilesystemAPI) {
|
||||
if (forceNodeFilesystemAPI) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return await new Promise(resolve => {
|
||||
// Check the find binary supports the non-POSIX -iname parameter wrapped in parens.
|
||||
const args = [
|
||||
'.',
|
||||
'-type',
|
||||
'f',
|
||||
'(',
|
||||
'-iname',
|
||||
'*.ts',
|
||||
'-o',
|
||||
'-iname',
|
||||
'*.js',
|
||||
')'
|
||||
];
|
||||
const child = (0, _child_process().spawn)('find', args, {
|
||||
cwd: __dirname
|
||||
});
|
||||
child.on('error', () => {
|
||||
resolve(false);
|
||||
});
|
||||
child.on('exit', code => {
|
||||
resolve(code === 0);
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function find(roots, extensions, ignore, callback) {
|
||||
@@ -110,51 +143,69 @@ function find(roots, extensions, ignore, callback) {
|
||||
|
||||
function search(directory) {
|
||||
activeCalls++;
|
||||
fs().readdir(
|
||||
directory,
|
||||
{
|
||||
withFileTypes: true
|
||||
},
|
||||
(err, entries) => {
|
||||
activeCalls--;
|
||||
|
||||
_fs().default.readdir(directory, (err, names) => {
|
||||
activeCalls--;
|
||||
|
||||
if (err) {
|
||||
callback(result);
|
||||
return;
|
||||
}
|
||||
|
||||
names.forEach(file => {
|
||||
file = _path().default.join(directory, file);
|
||||
|
||||
if (ignore(file)) {
|
||||
if (err) {
|
||||
callback(result);
|
||||
return;
|
||||
}
|
||||
} // node < v10.10 does not support the withFileTypes option, and
|
||||
// entry will be a string.
|
||||
|
||||
activeCalls++;
|
||||
entries.forEach(entry => {
|
||||
const file = path().join(
|
||||
directory,
|
||||
typeof entry === 'string' ? entry : entry.name
|
||||
);
|
||||
|
||||
_fs().default.lstat(file, (err, stat) => {
|
||||
activeCalls--;
|
||||
if (ignore(file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!err && stat && !stat.isSymbolicLink()) {
|
||||
if (stat.isDirectory()) {
|
||||
if (typeof entry !== 'string') {
|
||||
if (entry.isSymbolicLink()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
search(file);
|
||||
} else {
|
||||
const ext = _path()
|
||||
.default.extname(file)
|
||||
.substr(1);
|
||||
|
||||
if (extensions.indexOf(ext) !== -1) {
|
||||
result.push([file, stat.mtime.getTime(), stat.size]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (activeCalls === 0) {
|
||||
callback(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
activeCalls++;
|
||||
fs().lstat(file, (err, stat) => {
|
||||
activeCalls--; // This logic is unnecessary for node > v10.10, but leaving it in
|
||||
// since we need it for backwards-compatibility still.
|
||||
|
||||
if (activeCalls === 0) {
|
||||
callback(result);
|
||||
if (!err && stat && !stat.isSymbolicLink()) {
|
||||
if (stat.isDirectory()) {
|
||||
search(file);
|
||||
} else {
|
||||
const ext = path().extname(file).substr(1);
|
||||
|
||||
if (extensions.indexOf(ext) !== -1) {
|
||||
result.push([file, stat.mtime.getTime(), stat.size]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (activeCalls === 0) {
|
||||
callback(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (activeCalls === 0) {
|
||||
callback(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
if (roots.length > 0) {
|
||||
@@ -208,7 +259,7 @@ function findNative(roots, extensions, ignore, callback) {
|
||||
callback([]);
|
||||
} else {
|
||||
lines.forEach(path => {
|
||||
_fs().default.stat(path, (err, stat) => {
|
||||
fs().stat(path, (err, stat) => {
|
||||
if (!err && stat) {
|
||||
result.push([path, stat.mtime.getTime(), stat.size]);
|
||||
}
|
||||
@@ -222,27 +273,29 @@ function findNative(roots, extensions, ignore, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function nodeCrawl(options) {
|
||||
const data = options.data,
|
||||
extensions = options.extensions,
|
||||
forceNodeFilesystemAPI = options.forceNodeFilesystemAPI,
|
||||
ignore = options.ignore,
|
||||
rootDir = options.rootDir,
|
||||
roots = options.roots;
|
||||
module.exports = async function nodeCrawl(options) {
|
||||
const {
|
||||
data,
|
||||
extensions,
|
||||
forceNodeFilesystemAPI,
|
||||
ignore,
|
||||
rootDir,
|
||||
roots
|
||||
} = options;
|
||||
const useNativeFind = await hasNativeFindSupport(forceNodeFilesystemAPI);
|
||||
return new Promise(resolve => {
|
||||
const callback = list => {
|
||||
const files = new Map();
|
||||
const removedFiles = new Map(data.files);
|
||||
list.forEach(fileData => {
|
||||
const _fileData = _slicedToArray(fileData, 3),
|
||||
filePath = _fileData[0],
|
||||
mtime = _fileData[1],
|
||||
size = _fileData[2];
|
||||
|
||||
const relativeFilePath = fastPath.relative(rootDir, filePath);
|
||||
const [filePath, mtime, size] = fileData;
|
||||
const relativeFilePath = fastPath().relative(rootDir, filePath);
|
||||
const existingFile = data.files.get(relativeFilePath);
|
||||
|
||||
if (existingFile && existingFile[_constants.default.MTIME] === mtime) {
|
||||
if (
|
||||
existingFile &&
|
||||
existingFile[_constants().default.MTIME] === mtime
|
||||
) {
|
||||
files.set(relativeFilePath, existingFile);
|
||||
} else {
|
||||
// See ../constants.js; SHA-1 will always be null and fulfilled later.
|
||||
@@ -258,10 +311,10 @@ module.exports = function nodeCrawl(options) {
|
||||
});
|
||||
};
|
||||
|
||||
if (forceNodeFilesystemAPI || process.platform === 'win32') {
|
||||
find(roots, extensions, ignore, callback);
|
||||
} else {
|
||||
if (useNativeFind) {
|
||||
findNative(roots, extensions, ignore, callback);
|
||||
} else {
|
||||
find(roots, extensions, ignore, callback);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user