Updating NPM dependencies
This commit is contained in:
5
node_modules/jest-haste-map/build/HasteFS.d.ts
generated
vendored
5
node_modules/jest-haste-map/build/HasteFS.d.ts
generated
vendored
@@ -4,8 +4,8 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Config } from '@jest/types';
|
||||
import { FileData } from './types';
|
||||
import type { Config } from '@jest/types';
|
||||
import type { FileData } from './types';
|
||||
export default class HasteFS {
|
||||
private readonly _rootDir;
|
||||
private readonly _files;
|
||||
@@ -25,4 +25,3 @@ export default class HasteFS {
|
||||
matchFilesWithGlob(globs: Array<Config.Glob>, root: Config.Path | null): Set<Config.Path>;
|
||||
private _getFileData;
|
||||
}
|
||||
//# sourceMappingURL=HasteFS.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/HasteFS.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/HasteFS.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"HasteFS.d.ts","sourceRoot":"","sources":["../src/HasteFS.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAIjC,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;gBAEtB,EAAC,OAAO,EAAE,KAAK,EAAC,EAAE;QAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;QAAC,KAAK,EAAE,QAAQ,CAAA;KAAC;IAKrE,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,GAAG,IAAI;IAK/C,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,GAAG,IAAI;IAKzC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;IAYxD,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,GAAG,IAAI;IAKzC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,OAAO;IAIlC,WAAW,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;IAIjC,eAAe,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;IAIvC,uBAAuB,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;IAMjD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;IAaxD,kBAAkB,CAChB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EACzB,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI,GACvB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;IAWnB,OAAO,CAAC,YAAY;CAIrB"}
|
||||
162
node_modules/jest-haste-map/build/HasteFS.js
generated
vendored
162
node_modules/jest-haste-map/build/HasteFS.js
generated
vendored
@@ -5,53 +5,60 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _micromatch() {
|
||||
const data = _interopRequireDefault(require('micromatch'));
|
||||
|
||||
_micromatch = function _micromatch() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_jestUtil = function _jestUtil() {
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _constants = _interopRequireDefault(require('./constants'));
|
||||
|
||||
var fastPath = _interopRequireWildcard(require('./lib/fast_path'));
|
||||
|
||||
var _constants = _interopRequireDefault(require('./constants'));
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
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];
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
@@ -127,32 +134,8 @@ class HasteFS {
|
||||
}
|
||||
|
||||
*getAbsoluteFileIterator() {
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = this.getFileIterator()[Symbol.iterator](), _step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const file = _step.value;
|
||||
yield fastPath.resolve(this._rootDir, file);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
for (const file of this.getFileIterator()) {
|
||||
yield fastPath.resolve(this._rootDir, file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,35 +145,10 @@ class HasteFS {
|
||||
}
|
||||
|
||||
const files = [];
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator2 = this.getAbsoluteFileIterator()[Symbol.iterator](),
|
||||
_step2;
|
||||
!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done);
|
||||
_iteratorNormalCompletion2 = true
|
||||
) {
|
||||
const file = _step2.value;
|
||||
|
||||
if (pattern.test(file)) {
|
||||
files.push(file);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
for (const file of this.getAbsoluteFileIterator()) {
|
||||
if (pattern.test(file)) {
|
||||
files.push(file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,41 +157,13 @@ class HasteFS {
|
||||
|
||||
matchFilesWithGlob(globs, root) {
|
||||
const files = new Set();
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
const matcher = (0, _jestUtil().globsToMatcher)(globs);
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator3 = this.getAbsoluteFileIterator()[Symbol.iterator](),
|
||||
_step3;
|
||||
!(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done);
|
||||
_iteratorNormalCompletion3 = true
|
||||
) {
|
||||
const file = _step3.value;
|
||||
const filePath = root ? fastPath.relative(root, file) : file;
|
||||
for (const file of this.getAbsoluteFileIterator()) {
|
||||
const filePath = root ? fastPath.relative(root, file) : file;
|
||||
|
||||
if (
|
||||
_micromatch().default.some(
|
||||
(0, _jestUtil().replacePathSepForGlob)(filePath),
|
||||
globs
|
||||
)
|
||||
) {
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
if (matcher((0, _jestUtil().replacePathSepForGlob)(filePath))) {
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
5
node_modules/jest-haste-map/build/ModuleMap.d.ts
generated
vendored
5
node_modules/jest-haste-map/build/ModuleMap.d.ts
generated
vendored
@@ -4,8 +4,8 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Config } from '@jest/types';
|
||||
import { DuplicatesSet, HTypeValue, RawModuleMap, ModuleMapData, MockData } from './types';
|
||||
import type { Config } from '@jest/types';
|
||||
import type { DuplicatesSet, HTypeValue, MockData, ModuleMapData, RawModuleMap } from './types';
|
||||
declare type ValueType<T> = T extends Map<string, infer V> ? V : never;
|
||||
export declare type SerializableModuleMap = {
|
||||
duplicates: ReadonlyArray<[string, [string, [string, [string, number]]]]>;
|
||||
@@ -46,4 +46,3 @@ declare class DuplicateHasteCandidatesError extends Error {
|
||||
constructor(name: string, platform: string, supportsNativePlatform: boolean, duplicatesSet: DuplicatesSet);
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=ModuleMap.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/ModuleMap.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/ModuleMap.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ModuleMap.d.ts","sourceRoot":"","sources":["../src/ModuleMap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,aAAa,EACb,UAAU,EAEV,YAAY,EACZ,aAAa,EACb,QAAQ,EACT,MAAM,SAAS,CAAC;AAQjB,aAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE/D,oBAAY,qBAAqB,GAAG;IAClC,UAAU,EAAE,aAAa,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,GAAG,EAAE,aAAa,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IACvD,KAAK,EAAE,aAAa,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,MAAM,CAAC,6BAA6B,EAAE,OAAO,6BAA6B,CAAC;IAC3E,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,IAAI,CAAoC;IAEhD,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAYlC,OAAO,CAAC,MAAM,CAAC,qBAAqB;gBAYxB,GAAG,EAAE,YAAY;IAI7B,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,EACxB,sBAAsB,CAAC,EAAE,OAAO,GAAG,IAAI,EACvC,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,GACvB,MAAM,CAAC,IAAI,GAAG,IAAI;IAgBrB,UAAU,CACR,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,uBAAuB,EAAE,OAAO,GAAG,IAAI,GACtC,MAAM,CAAC,IAAI,GAAG,IAAI;IAIrB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,GAAG,SAAS;IAMpD,eAAe,IAAI,YAAY;IAS/B,MAAM,IAAI,qBAAqB;IAc/B,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;IAW5D;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAyC1B,OAAO,CAAC,mBAAmB;IA0B3B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI;CAQnC;AAED,cAAM,6BAA8B,SAAQ,KAAK;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;gBAG3B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,sBAAsB,EAAE,OAAO,EAC/B,aAAa,EAAE,aAAa;CAsB/B"}
|
||||
128
node_modules/jest-haste-map/build/ModuleMap.js
generated
vendored
128
node_modules/jest-haste-map/build/ModuleMap.js
generated
vendored
@@ -5,78 +5,54 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var fastPath = _interopRequireWildcard(require('./lib/fast_path'));
|
||||
|
||||
var _constants = _interopRequireDefault(require('./constants'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
var fastPath = _interopRequireWildcard(require('./lib/fast_path'));
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
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];
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return (
|
||||
_arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest()
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return _arr;
|
||||
return newObj;
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
if (Array.isArray(arr)) return arr;
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
@@ -245,36 +221,10 @@ class ModuleMap {
|
||||
|
||||
const previousSet = relativePathSet;
|
||||
const duplicates = new Map();
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = previousSet[Symbol.iterator](), _step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const _step$value = _slicedToArray(_step.value, 2),
|
||||
relativePath = _step$value[0],
|
||||
type = _step$value[1];
|
||||
|
||||
const duplicatePath = fastPath.resolve(this._raw.rootDir, relativePath);
|
||||
duplicates.set(duplicatePath, type);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
for (const [relativePath, type] of previousSet) {
|
||||
const duplicatePath = fastPath.resolve(this._raw.rootDir, relativePath);
|
||||
duplicates.set(duplicatePath, type);
|
||||
}
|
||||
|
||||
throw new DuplicateHasteCandidatesError(
|
||||
@@ -307,7 +257,7 @@ class DuplicateHasteCandidatesError extends Error {
|
||||
`cannot be resolved, because there exists several different ` +
|
||||
`files, or packages, that provide a module for ` +
|
||||
`that particular name and platform. ${platformMessage} You must ` +
|
||||
`delete or blacklist files until there remains only one of these:\n\n` +
|
||||
`delete or exclude files until there remains only one of these:\n\n` +
|
||||
Array.from(duplicatesSet)
|
||||
.map(
|
||||
([dupFilePath, dupFileType]) =>
|
||||
|
||||
1
node_modules/jest-haste-map/build/blacklist.d.ts
generated
vendored
1
node_modules/jest-haste-map/build/blacklist.d.ts
generated
vendored
@@ -6,4 +6,3 @@
|
||||
*/
|
||||
declare const extensions: Set<string>;
|
||||
export default extensions;
|
||||
//# sourceMappingURL=blacklist.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/blacklist.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/blacklist.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"blacklist.d.ts","sourceRoot":"","sources":["../src/blacklist.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,QAAA,MAAM,UAAU,EAAE,GAAG,CAAC,MAAM,CA0C1B,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
||||
1
node_modules/jest-haste-map/build/blacklist.js
generated
vendored
1
node_modules/jest-haste-map/build/blacklist.js
generated
vendored
@@ -19,6 +19,7 @@ exports.default = void 0;
|
||||
// reflected in the list. Adding "application/" is too risky since some text
|
||||
// file formats (like ".js" and ".json") have an "application/" MIME type.
|
||||
//
|
||||
// Feel free to add any extensions that cannot be a Haste module.
|
||||
const extensions = new Set([
|
||||
// JSONs are never haste modules, except for "package.json", which is handled.
|
||||
'.json', // Image extensions.
|
||||
|
||||
3
node_modules/jest-haste-map/build/constants.d.ts
generated
vendored
3
node_modules/jest-haste-map/build/constants.d.ts
generated
vendored
@@ -4,7 +4,6 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { HType } from './types';
|
||||
import type { HType } from './types';
|
||||
declare const constants: HType;
|
||||
export default constants;
|
||||
//# sourceMappingURL=constants.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/constants.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/constants.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,QAAA,MAAM,SAAS,EAAE,KAuBhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
||||
6
node_modules/jest-haste-map/build/constants.js
generated
vendored
6
node_modules/jest-haste-map/build/constants.js
generated
vendored
@@ -12,8 +12,6 @@ exports.default = void 0;
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
/*
|
||||
* This file exports a set of constants that are used for Jest's haste map
|
||||
* serialization. On very large repositories, the haste map cache becomes very
|
||||
@@ -22,6 +20,8 @@ exports.default = void 0;
|
||||
* This constant key map allows to keep the map smaller without having to build
|
||||
* a custom serialization library.
|
||||
*/
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
const constants = {
|
||||
/* dependency serialization */
|
||||
DEPENDENCY_DELIM: '\0',
|
||||
@@ -46,5 +46,7 @@ const constants = {
|
||||
GENERIC_PLATFORM: 'g',
|
||||
NATIVE_PLATFORM: 'native'
|
||||
};
|
||||
/* eslint-enable */
|
||||
|
||||
var _default = constants;
|
||||
exports.default = _default;
|
||||
|
||||
5
node_modules/jest-haste-map/build/crawlers/node.d.ts
generated
vendored
5
node_modules/jest-haste-map/build/crawlers/node.d.ts
generated
vendored
@@ -4,10 +4,9 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { InternalHasteMap, CrawlerOptions } from '../types';
|
||||
import type { CrawlerOptions, FileData, InternalHasteMap } from '../types';
|
||||
declare const _default: (options: CrawlerOptions) => Promise<{
|
||||
removedFiles: Map<string, [string, number, number, 0 | 1, string, string | null | undefined]>;
|
||||
removedFiles: FileData;
|
||||
hasteMap: InternalHasteMap;
|
||||
}>;
|
||||
export = _default;
|
||||
//# sourceMappingURL=node.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/crawlers/node.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/crawlers/node.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/crawlers/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,EAEL,gBAAgB,EAChB,cAAc,EAEf,MAAM,UAAU,CAAC;;;;;AAsHlB,kBA6CE"}
|
||||
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);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
7
node_modules/jest-haste-map/build/crawlers/watchman.d.ts
generated
vendored
7
node_modules/jest-haste-map/build/crawlers/watchman.d.ts
generated
vendored
@@ -4,11 +4,10 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { InternalHasteMap, CrawlerOptions } from '../types';
|
||||
import type { CrawlerOptions, FileData, InternalHasteMap } from '../types';
|
||||
declare const _default: (options: CrawlerOptions) => Promise<{
|
||||
changedFiles?: Map<string, [string, number, number, 0 | 1, string, string | null | undefined]> | undefined;
|
||||
removedFiles: Map<string, [string, number, number, 0 | 1, string, string | null | undefined]>;
|
||||
changedFiles?: FileData | undefined;
|
||||
removedFiles: FileData;
|
||||
hasteMap: InternalHasteMap;
|
||||
}>;
|
||||
export = _default;
|
||||
//# sourceMappingURL=watchman.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/crawlers/watchman.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/crawlers/watchman.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"watchman.d.ts","sourceRoot":"","sources":["../../src/crawlers/watchman.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EACL,gBAAgB,EAChB,cAAc,EAGf,MAAM,UAAU,CAAC;;;;;;AAclB,kBAwOE"}
|
||||
809
node_modules/jest-haste-map/build/crawlers/watchman.js
generated
vendored
809
node_modules/jest-haste-map/build/crawlers/watchman.js
generated
vendored
@@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -13,125 +13,96 @@ function _path() {
|
||||
function _fbWatchman() {
|
||||
const data = _interopRequireDefault(require('fb-watchman'));
|
||||
|
||||
_fbWatchman = function _fbWatchman() {
|
||||
_fbWatchman = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var fastPath = _interopRequireWildcard(require('../lib/fast_path'));
|
||||
function _constants() {
|
||||
const data = _interopRequireDefault(require('../constants'));
|
||||
|
||||
var _normalizePathSep = _interopRequireDefault(
|
||||
require('../lib/normalizePathSep')
|
||||
);
|
||||
_constants = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
var _constants = _interopRequireDefault(require('../constants'));
|
||||
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;
|
||||
}
|
||||
function fastPath() {
|
||||
const data = _interopRequireWildcard(require('../lib/fast_path'));
|
||||
|
||||
fastPath = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _normalizePathSep() {
|
||||
const data = _interopRequireDefault(require('../lib/normalizePathSep'));
|
||||
|
||||
_normalizePathSep = 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 _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;
|
||||
}
|
||||
}
|
||||
return _arr;
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
if (Array.isArray(arr)) return arr;
|
||||
}
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||
try {
|
||||
var info = gen[key](arg);
|
||||
var value = info.value;
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
if (info.done) {
|
||||
resolve(value);
|
||||
} else {
|
||||
Promise.resolve(value).then(_next, _throw);
|
||||
}
|
||||
}
|
||||
|
||||
function _asyncToGenerator(fn) {
|
||||
return function() {
|
||||
var self = this,
|
||||
args = arguments;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var gen = fn.apply(self, args);
|
||||
function _next(value) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
|
||||
}
|
||||
function _throw(err) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
|
||||
}
|
||||
_next(undefined);
|
||||
});
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
const watchmanURL =
|
||||
'https://facebook.github.io/watchman/docs/troubleshooting.html';
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
const watchmanURL = 'https://facebook.github.io/watchman/docs/troubleshooting';
|
||||
|
||||
function WatchmanError(error) {
|
||||
error.message =
|
||||
@@ -140,449 +111,217 @@ function WatchmanError(error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
module.exports =
|
||||
/*#__PURE__*/
|
||||
(function() {
|
||||
var _watchmanCrawl = _asyncToGenerator(function*(options) {
|
||||
const fields = ['name', 'exists', 'mtime_ms', 'size'];
|
||||
const data = options.data,
|
||||
extensions = options.extensions,
|
||||
ignore = options.ignore,
|
||||
rootDir = options.rootDir,
|
||||
roots = options.roots;
|
||||
const defaultWatchExpression = [
|
||||
'allof',
|
||||
['type', 'f'],
|
||||
['anyof', ...extensions.map(extension => ['suffix', extension])]
|
||||
];
|
||||
const clocks = data.clocks;
|
||||
const client = new (_fbWatchman()).default.Client();
|
||||
let clientError;
|
||||
client.on('error', error => (clientError = WatchmanError(error))); // TODO: type better than `any`
|
||||
module.exports = async function watchmanCrawl(options) {
|
||||
const fields = ['name', 'exists', 'mtime_ms', 'size'];
|
||||
const {data, extensions, ignore, rootDir, roots} = options;
|
||||
const defaultWatchExpression = [
|
||||
'allof',
|
||||
['type', 'f'],
|
||||
['anyof', ...extensions.map(extension => ['suffix', extension])]
|
||||
];
|
||||
const clocks = data.clocks;
|
||||
const client = new (_fbWatchman().default.Client)();
|
||||
let clientError;
|
||||
client.on('error', error => (clientError = WatchmanError(error))); // TODO: type better than `any`
|
||||
|
||||
const cmd = (...args) =>
|
||||
new Promise((resolve, reject) =>
|
||||
client.command(args, (error, result) =>
|
||||
error ? reject(WatchmanError(error)) : resolve(result)
|
||||
)
|
||||
);
|
||||
const cmd = (...args) =>
|
||||
new Promise((resolve, reject) =>
|
||||
client.command(args, (error, result) =>
|
||||
error ? reject(WatchmanError(error)) : resolve(result)
|
||||
)
|
||||
);
|
||||
|
||||
if (options.computeSha1) {
|
||||
const _ref = yield cmd('list-capabilities'),
|
||||
capabilities = _ref.capabilities;
|
||||
if (options.computeSha1) {
|
||||
const {capabilities} = await cmd('list-capabilities');
|
||||
|
||||
if (capabilities.indexOf('field-content.sha1hex') !== -1) {
|
||||
fields.push('content.sha1hex');
|
||||
if (capabilities.indexOf('field-content.sha1hex') !== -1) {
|
||||
fields.push('content.sha1hex');
|
||||
}
|
||||
}
|
||||
|
||||
async function getWatchmanRoots(roots) {
|
||||
const watchmanRoots = new Map();
|
||||
await Promise.all(
|
||||
roots.map(async root => {
|
||||
const response = await cmd('watch-project', root);
|
||||
const existing = watchmanRoots.get(response.watch); // A root can only be filtered if it was never seen with a
|
||||
// relative_path before.
|
||||
|
||||
const canBeFiltered = !existing || existing.length > 0;
|
||||
|
||||
if (canBeFiltered) {
|
||||
if (response.relative_path) {
|
||||
watchmanRoots.set(
|
||||
response.watch,
|
||||
(existing || []).concat(response.relative_path)
|
||||
);
|
||||
} else {
|
||||
// Make the filter directories an empty array to signal that this
|
||||
// root was already seen and needs to be watched for all files or
|
||||
// directories.
|
||||
watchmanRoots.set(response.watch, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
return watchmanRoots;
|
||||
}
|
||||
|
||||
function getWatchmanRoots(_x2) {
|
||||
return _getWatchmanRoots.apply(this, arguments);
|
||||
}
|
||||
async function queryWatchmanForDirs(rootProjectDirMappings) {
|
||||
const files = new Map();
|
||||
let isFresh = false;
|
||||
await Promise.all(
|
||||
Array.from(rootProjectDirMappings).map(
|
||||
async ([root, directoryFilters]) => {
|
||||
const expression = Array.from(defaultWatchExpression);
|
||||
const glob = [];
|
||||
|
||||
function _getWatchmanRoots() {
|
||||
_getWatchmanRoots = _asyncToGenerator(function*(roots) {
|
||||
const watchmanRoots = new Map();
|
||||
yield Promise.all(
|
||||
roots.map(
|
||||
/*#__PURE__*/
|
||||
(function() {
|
||||
var _ref2 = _asyncToGenerator(function*(root) {
|
||||
const response = yield cmd('watch-project', root);
|
||||
const existing = watchmanRoots.get(response.watch); // A root can only be filtered if it was never seen with a
|
||||
// relative_path before.
|
||||
if (directoryFilters.length > 0) {
|
||||
expression.push([
|
||||
'anyof',
|
||||
...directoryFilters.map(dir => ['dirname', dir])
|
||||
]);
|
||||
|
||||
const canBeFiltered = !existing || existing.length > 0;
|
||||
|
||||
if (canBeFiltered) {
|
||||
if (response.relative_path) {
|
||||
watchmanRoots.set(
|
||||
response.watch,
|
||||
(existing || []).concat(response.relative_path)
|
||||
);
|
||||
} else {
|
||||
// Make the filter directories an empty array to signal that this
|
||||
// root was already seen and needs to be watched for all files or
|
||||
// directories.
|
||||
watchmanRoots.set(response.watch, []);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return function(_x4) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})()
|
||||
)
|
||||
);
|
||||
return watchmanRoots;
|
||||
});
|
||||
return _getWatchmanRoots.apply(this, arguments);
|
||||
}
|
||||
|
||||
function queryWatchmanForDirs(_x3) {
|
||||
return _queryWatchmanForDirs.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _queryWatchmanForDirs() {
|
||||
_queryWatchmanForDirs = _asyncToGenerator(function*(
|
||||
rootProjectDirMappings
|
||||
) {
|
||||
const files = new Map();
|
||||
let isFresh = false;
|
||||
yield Promise.all(
|
||||
Array.from(rootProjectDirMappings).map(
|
||||
/*#__PURE__*/
|
||||
(function() {
|
||||
var _ref3 = _asyncToGenerator(function*([
|
||||
root,
|
||||
directoryFilters
|
||||
]) {
|
||||
const expression = Array.from(defaultWatchExpression);
|
||||
const glob = [];
|
||||
|
||||
if (directoryFilters.length > 0) {
|
||||
expression.push([
|
||||
'anyof',
|
||||
...directoryFilters.map(dir => ['dirname', dir])
|
||||
]);
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator2 = directoryFilters[Symbol.iterator](),
|
||||
_step2;
|
||||
!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next())
|
||||
.done);
|
||||
_iteratorNormalCompletion2 = true
|
||||
) {
|
||||
const directory = _step2.value;
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator3 = extensions[Symbol.iterator](),
|
||||
_step3;
|
||||
!(_iteratorNormalCompletion3 = (_step3 = _iterator3.next())
|
||||
.done);
|
||||
_iteratorNormalCompletion3 = true
|
||||
) {
|
||||
const extension = _step3.value;
|
||||
glob.push(`${directory}/**/*.${extension}`);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (
|
||||
!_iteratorNormalCompletion3 &&
|
||||
_iterator3.return != null
|
||||
) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (
|
||||
!_iteratorNormalCompletion2 &&
|
||||
_iterator2.return != null
|
||||
) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator4 = extensions[Symbol.iterator](), _step4;
|
||||
!(_iteratorNormalCompletion4 = (_step4 = _iterator4.next())
|
||||
.done);
|
||||
_iteratorNormalCompletion4 = true
|
||||
) {
|
||||
const extension = _step4.value;
|
||||
glob.push(`**/*.${extension}`);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (
|
||||
!_iteratorNormalCompletion4 &&
|
||||
_iterator4.return != null
|
||||
) {
|
||||
_iterator4.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const relativeRoot = fastPath.relative(rootDir, root);
|
||||
const query = clocks.has(relativeRoot) // Use the `since` generator if we have a clock available
|
||||
? {
|
||||
expression,
|
||||
fields,
|
||||
since: clocks.get(relativeRoot)
|
||||
} // Otherwise use the `glob` filter
|
||||
: {
|
||||
expression,
|
||||
fields,
|
||||
glob
|
||||
};
|
||||
const response = yield cmd('query', root, query);
|
||||
|
||||
if ('warning' in response) {
|
||||
console.warn('watchman warning: ', response.warning);
|
||||
}
|
||||
|
||||
isFresh = isFresh || response.is_fresh_instance;
|
||||
files.set(root, response);
|
||||
});
|
||||
|
||||
return function(_x5) {
|
||||
return _ref3.apply(this, arguments);
|
||||
};
|
||||
})()
|
||||
)
|
||||
);
|
||||
return {
|
||||
files,
|
||||
isFresh
|
||||
};
|
||||
});
|
||||
return _queryWatchmanForDirs.apply(this, arguments);
|
||||
}
|
||||
|
||||
let files = data.files;
|
||||
let removedFiles = new Map();
|
||||
const changedFiles = new Map();
|
||||
let watchmanFiles;
|
||||
let isFresh = false;
|
||||
|
||||
try {
|
||||
const watchmanRoots = yield getWatchmanRoots(roots);
|
||||
const watchmanFileResults = yield queryWatchmanForDirs(watchmanRoots); // Reset the file map if watchman was restarted and sends us a list of
|
||||
// files.
|
||||
|
||||
if (watchmanFileResults.isFresh) {
|
||||
files = new Map();
|
||||
removedFiles = new Map(data.files);
|
||||
isFresh = true;
|
||||
}
|
||||
|
||||
watchmanFiles = watchmanFileResults.files;
|
||||
} finally {
|
||||
client.end();
|
||||
}
|
||||
|
||||
if (clientError) {
|
||||
throw clientError;
|
||||
} // TODO: remove non-null
|
||||
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = watchmanFiles[Symbol.iterator](), _step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const _step$value = _slicedToArray(_step.value, 2),
|
||||
watchRoot = _step$value[0],
|
||||
response = _step$value[1];
|
||||
|
||||
const fsRoot = (0, _normalizePathSep.default)(watchRoot);
|
||||
const relativeFsRoot = fastPath.relative(rootDir, fsRoot);
|
||||
clocks.set(relativeFsRoot, response.clock);
|
||||
var _iteratorNormalCompletion5 = true;
|
||||
var _didIteratorError5 = false;
|
||||
var _iteratorError5 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator5 = response.files[Symbol.iterator](), _step5;
|
||||
!(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done);
|
||||
_iteratorNormalCompletion5 = true
|
||||
) {
|
||||
const fileData = _step5.value;
|
||||
const filePath =
|
||||
fsRoot +
|
||||
_path().default.sep +
|
||||
(0, _normalizePathSep.default)(fileData.name);
|
||||
const relativeFilePath = fastPath.relative(rootDir, filePath);
|
||||
const existingFileData = data.files.get(relativeFilePath); // If watchman is fresh, the removed files map starts with all files
|
||||
// and we remove them as we verify they still exist.
|
||||
|
||||
if (isFresh && existingFileData && fileData.exists) {
|
||||
removedFiles.delete(relativeFilePath);
|
||||
}
|
||||
|
||||
if (!fileData.exists) {
|
||||
// No need to act on files that do not exist and were not tracked.
|
||||
if (existingFileData) {
|
||||
files.delete(relativeFilePath); // If watchman is not fresh, we will know what specific files were
|
||||
// deleted since we last ran and can track only those files.
|
||||
|
||||
if (!isFresh) {
|
||||
removedFiles.set(relativeFilePath, existingFileData);
|
||||
}
|
||||
}
|
||||
} else if (!ignore(filePath)) {
|
||||
const mtime =
|
||||
typeof fileData.mtime_ms === 'number'
|
||||
? fileData.mtime_ms
|
||||
: fileData.mtime_ms.toNumber();
|
||||
const size = fileData.size;
|
||||
let sha1hex = fileData['content.sha1hex'];
|
||||
|
||||
if (typeof sha1hex !== 'string' || sha1hex.length !== 40) {
|
||||
sha1hex = null;
|
||||
}
|
||||
|
||||
let nextData;
|
||||
|
||||
if (
|
||||
existingFileData &&
|
||||
existingFileData[_constants.default.MTIME] === mtime
|
||||
) {
|
||||
nextData = existingFileData;
|
||||
} else if (
|
||||
existingFileData &&
|
||||
sha1hex &&
|
||||
existingFileData[_constants.default.SHA1] === sha1hex
|
||||
) {
|
||||
nextData = [
|
||||
existingFileData[0],
|
||||
mtime,
|
||||
existingFileData[2],
|
||||
existingFileData[3],
|
||||
existingFileData[4],
|
||||
existingFileData[5]
|
||||
];
|
||||
} else {
|
||||
// See ../constants.ts
|
||||
nextData = ['', mtime, size, 0, '', sha1hex];
|
||||
}
|
||||
|
||||
const mappings = options.mapper
|
||||
? options.mapper(filePath)
|
||||
: null;
|
||||
|
||||
if (mappings) {
|
||||
var _iteratorNormalCompletion6 = true;
|
||||
var _didIteratorError6 = false;
|
||||
var _iteratorError6 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator6 = mappings[Symbol.iterator](), _step6;
|
||||
!(_iteratorNormalCompletion6 = (_step6 = _iterator6.next())
|
||||
.done);
|
||||
_iteratorNormalCompletion6 = true
|
||||
) {
|
||||
const absoluteVirtualFilePath = _step6.value;
|
||||
|
||||
if (!ignore(absoluteVirtualFilePath)) {
|
||||
const relativeVirtualFilePath = fastPath.relative(
|
||||
rootDir,
|
||||
absoluteVirtualFilePath
|
||||
);
|
||||
files.set(relativeVirtualFilePath, nextData);
|
||||
changedFiles.set(relativeVirtualFilePath, nextData);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError6 = true;
|
||||
_iteratorError6 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (
|
||||
!_iteratorNormalCompletion6 &&
|
||||
_iterator6.return != null
|
||||
) {
|
||||
_iterator6.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError6) {
|
||||
throw _iteratorError6;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
files.set(relativeFilePath, nextData);
|
||||
changedFiles.set(relativeFilePath, nextData);
|
||||
}
|
||||
for (const directory of directoryFilters) {
|
||||
for (const extension of extensions) {
|
||||
glob.push(`${directory}/**/*.${extension}`);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError5 = true;
|
||||
_iteratorError5 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
||||
_iterator5.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError5) {
|
||||
throw _iteratorError5;
|
||||
}
|
||||
} else {
|
||||
for (const extension of extensions) {
|
||||
glob.push(`**/*.${extension}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.files = files;
|
||||
return {
|
||||
changedFiles: isFresh ? undefined : changedFiles,
|
||||
hasteMap: data,
|
||||
removedFiles
|
||||
};
|
||||
});
|
||||
const relativeRoot = fastPath().relative(rootDir, root);
|
||||
const query = clocks.has(relativeRoot) // Use the `since` generator if we have a clock available
|
||||
? {
|
||||
expression,
|
||||
fields,
|
||||
since: clocks.get(relativeRoot)
|
||||
} // Otherwise use the `glob` filter
|
||||
: {
|
||||
expression,
|
||||
fields,
|
||||
glob,
|
||||
glob_includedotfiles: true
|
||||
};
|
||||
const response = await cmd('query', root, query);
|
||||
|
||||
function watchmanCrawl(_x) {
|
||||
return _watchmanCrawl.apply(this, arguments);
|
||||
if ('warning' in response) {
|
||||
console.warn('watchman warning: ', response.warning);
|
||||
}
|
||||
|
||||
isFresh = isFresh || response.is_fresh_instance;
|
||||
files.set(root, response);
|
||||
}
|
||||
)
|
||||
);
|
||||
return {
|
||||
files,
|
||||
isFresh
|
||||
};
|
||||
}
|
||||
|
||||
let files = data.files;
|
||||
let removedFiles = new Map();
|
||||
const changedFiles = new Map();
|
||||
let watchmanFiles;
|
||||
let isFresh = false;
|
||||
|
||||
try {
|
||||
const watchmanRoots = await getWatchmanRoots(roots);
|
||||
const watchmanFileResults = await queryWatchmanForDirs(watchmanRoots); // Reset the file map if watchman was restarted and sends us a list of
|
||||
// files.
|
||||
|
||||
if (watchmanFileResults.isFresh) {
|
||||
files = new Map();
|
||||
removedFiles = new Map(data.files);
|
||||
isFresh = true;
|
||||
}
|
||||
|
||||
return watchmanCrawl;
|
||||
})();
|
||||
watchmanFiles = watchmanFileResults.files;
|
||||
} finally {
|
||||
client.end();
|
||||
}
|
||||
|
||||
if (clientError) {
|
||||
throw clientError;
|
||||
} // TODO: remove non-null
|
||||
|
||||
for (const [watchRoot, response] of watchmanFiles) {
|
||||
const fsRoot = (0, _normalizePathSep().default)(watchRoot);
|
||||
const relativeFsRoot = fastPath().relative(rootDir, fsRoot);
|
||||
clocks.set(relativeFsRoot, response.clock);
|
||||
|
||||
for (const fileData of response.files) {
|
||||
const filePath =
|
||||
fsRoot + path().sep + (0, _normalizePathSep().default)(fileData.name);
|
||||
const relativeFilePath = fastPath().relative(rootDir, filePath);
|
||||
const existingFileData = data.files.get(relativeFilePath); // If watchman is fresh, the removed files map starts with all files
|
||||
// and we remove them as we verify they still exist.
|
||||
|
||||
if (isFresh && existingFileData && fileData.exists) {
|
||||
removedFiles.delete(relativeFilePath);
|
||||
}
|
||||
|
||||
if (!fileData.exists) {
|
||||
// No need to act on files that do not exist and were not tracked.
|
||||
if (existingFileData) {
|
||||
files.delete(relativeFilePath); // If watchman is not fresh, we will know what specific files were
|
||||
// deleted since we last ran and can track only those files.
|
||||
|
||||
if (!isFresh) {
|
||||
removedFiles.set(relativeFilePath, existingFileData);
|
||||
}
|
||||
}
|
||||
} else if (!ignore(filePath)) {
|
||||
const mtime =
|
||||
typeof fileData.mtime_ms === 'number'
|
||||
? fileData.mtime_ms
|
||||
: fileData.mtime_ms.toNumber();
|
||||
const size = fileData.size;
|
||||
let sha1hex = fileData['content.sha1hex'];
|
||||
|
||||
if (typeof sha1hex !== 'string' || sha1hex.length !== 40) {
|
||||
sha1hex = null;
|
||||
}
|
||||
|
||||
let nextData;
|
||||
|
||||
if (
|
||||
existingFileData &&
|
||||
existingFileData[_constants().default.MTIME] === mtime
|
||||
) {
|
||||
nextData = existingFileData;
|
||||
} else if (
|
||||
existingFileData &&
|
||||
sha1hex &&
|
||||
existingFileData[_constants().default.SHA1] === sha1hex
|
||||
) {
|
||||
nextData = [
|
||||
existingFileData[0],
|
||||
mtime,
|
||||
existingFileData[2],
|
||||
existingFileData[3],
|
||||
existingFileData[4],
|
||||
existingFileData[5]
|
||||
];
|
||||
} else {
|
||||
// See ../constants.ts
|
||||
nextData = ['', mtime, size, 0, '', sha1hex];
|
||||
}
|
||||
|
||||
files.set(relativeFilePath, nextData);
|
||||
changedFiles.set(relativeFilePath, nextData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.files = files;
|
||||
return {
|
||||
changedFiles: isFresh ? undefined : changedFiles,
|
||||
hasteMap: data,
|
||||
removedFiles
|
||||
};
|
||||
};
|
||||
|
||||
1
node_modules/jest-haste-map/build/getMockName.d.ts
generated
vendored
1
node_modules/jest-haste-map/build/getMockName.d.ts
generated
vendored
@@ -6,4 +6,3 @@
|
||||
*/
|
||||
declare const getMockName: (filePath: string) => string;
|
||||
export default getMockName;
|
||||
//# sourceMappingURL=getMockName.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/getMockName.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/getMockName.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"getMockName.d.ts","sourceRoot":"","sources":["../src/getMockName.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,QAAA,MAAM,WAAW,8BAKhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
||||
52
node_modules/jest-haste-map/build/getMockName.js
generated
vendored
52
node_modules/jest-haste-map/build/getMockName.js
generated
vendored
@@ -5,18 +5,56 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,12 +63,12 @@ function _interopRequireDefault(obj) {
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const MOCKS_PATTERN = _path().default.sep + '__mocks__' + _path().default.sep;
|
||||
const MOCKS_PATTERN = path().sep + '__mocks__' + path().sep;
|
||||
|
||||
const getMockName = filePath => {
|
||||
const mockPath = filePath.split(MOCKS_PATTERN)[1];
|
||||
return mockPath
|
||||
.substring(0, mockPath.lastIndexOf(_path().default.extname(mockPath)))
|
||||
.substring(0, mockPath.lastIndexOf(path().extname(mockPath)))
|
||||
.replace(/\\/g, '/');
|
||||
};
|
||||
|
||||
|
||||
15
node_modules/jest-haste-map/build/index.d.ts
generated
vendored
15
node_modules/jest-haste-map/build/index.d.ts
generated
vendored
@@ -5,29 +5,27 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import EventEmitter from 'events';
|
||||
import { Config } from '@jest/types';
|
||||
import H from './constants';
|
||||
import { EventEmitter } from 'events';
|
||||
import type { Config } from '@jest/types';
|
||||
import HasteFS from './HasteFS';
|
||||
import HasteModuleMap, { SerializableModuleMap as HasteSerializableModuleMap } from './ModuleMap';
|
||||
import { ChangeEvent, HasteMap as InternalHasteMapObject, HasteRegExp, InternalHasteMap, Mapper } from './types';
|
||||
import H from './constants';
|
||||
import type { ChangeEvent, HasteRegExp, InternalHasteMap, HasteMap as InternalHasteMapObject } from './types';
|
||||
declare type HType = typeof H;
|
||||
declare type Options = {
|
||||
cacheDirectory?: string;
|
||||
computeDependencies?: boolean;
|
||||
computeSha1?: boolean;
|
||||
console?: Console;
|
||||
dependencyExtractor?: string;
|
||||
dependencyExtractor?: string | null;
|
||||
extensions: Array<string>;
|
||||
forceNodeFilesystemAPI?: boolean;
|
||||
hasteImplModulePath?: string;
|
||||
ignorePattern?: HasteRegExp;
|
||||
mapper?: Mapper;
|
||||
maxWorkers: number;
|
||||
mocksPattern?: string;
|
||||
name: string;
|
||||
platforms: Array<string>;
|
||||
providesModuleNodeModules?: Array<string>;
|
||||
resetCache?: boolean;
|
||||
retainAllFiles: boolean;
|
||||
rootDir: string;
|
||||
@@ -129,7 +127,6 @@ declare class HasteMap extends EventEmitter {
|
||||
private _console;
|
||||
private _options;
|
||||
private _watchers;
|
||||
private _whitelist;
|
||||
private _worker;
|
||||
constructor(options: Options);
|
||||
static getCacheFilePath(tmpdir: Config.Path, name: string, ...extra: Array<string>): string;
|
||||
@@ -177,7 +174,6 @@ declare class HasteMap extends EventEmitter {
|
||||
* Helpers
|
||||
*/
|
||||
private _ignore;
|
||||
private _isNodeModulesDir;
|
||||
private _createEmptyMap;
|
||||
static H: HType;
|
||||
static DuplicateError: typeof DuplicateError;
|
||||
@@ -189,4 +185,3 @@ declare class DuplicateError extends Error {
|
||||
constructor(mockPath1: string, mockPath2: string);
|
||||
}
|
||||
export = HasteMap;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/index.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAIH,OAAO,YAAY,MAAM,QAAQ,CAAC;AAMlC,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAMnC,OAAO,CAAC,MAAM,aAAa,CAAC;AAC5B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,cAAc,EAAE,EACrB,qBAAqB,IAAI,0BAA0B,EACpD,MAAM,aAAa,CAAC;AAQrB,OAAO,EACL,WAAW,EAGX,QAAQ,IAAI,sBAAsB,EAClC,WAAW,EACX,gBAAgB,EAChB,MAAM,EAOP,MAAM,SAAS,CAAC;AAEjB,aAAK,KAAK,GAAG,OAAO,CAAC,CAAC;AAEtB,aAAK,OAAO,GAAG;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,yBAAyB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAiCF,kBAAU,QAAQ,CAAC;IACjB,KAAY,SAAS,GAAG,cAAc,CAAC;IACvC,KAAY,qBAAqB,GAAG,0BAA0B,CAAC;IAC/D,KAAY,EAAE,GAAG,OAAO,CAAC;IACzB,KAAY,cAAc,GAAG,sBAAsB,CAAC;IACpD,KAAY,gBAAgB,GAAG,WAAW,CAAC;CAC5C;AAyCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AAEH,cAAM,QAAS,SAAQ,YAAY;IACjC,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,OAAO,CAAyB;gBAE5B,OAAO,EAAE,OAAO;IAiF5B,MAAM,CAAC,gBAAgB,CACrB,MAAM,EAAE,MAAM,CAAC,IAAI,EACnB,IAAI,EAAE,MAAM,EACZ,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GACtB,MAAM;IAQT,gBAAgB,IAAI,MAAM;IAI1B,KAAK,IAAI,OAAO,CAAC,sBAAsB,CAAC;IA2CxC;;OAEG;IACH,IAAI,IAAI,gBAAgB;IAYxB,aAAa,IAAI,cAAc;IAU/B;;OAEG;YACW,aAAa;IAe3B;;OAEG;IACH,OAAO,CAAC,YAAY;IAsNpB,OAAO,CAAC,cAAc;IA2DtB,OAAO,CAAC,QAAQ;IAYhB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAIhB;;OAEG;IACH,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,MAAM;IA8Cd;;OAEG;IACH,OAAO,CAAC,MAAM;IA6Md;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAgD1B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBpB;;OAEG;IACH,OAAO,CAAC,OAAO;IAaf,OAAO,CAAC,iBAAiB;IAsBzB,OAAO,CAAC,eAAe;IAUvB,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC;IAChB,MAAM,CAAC,cAAc,EAAE,OAAO,cAAc,CAAC;IAC7C,MAAM,CAAC,SAAS,EAAE,OAAO,cAAc,CAAC;CACzC;AAED,cAAM,cAAe,SAAQ,KAAK;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;gBAEN,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAMjD;AAcD,SAAS,QAAQ,CAAC"}
|
||||
507
node_modules/jest-haste-map/build/index.js
generated
vendored
507
node_modules/jest-haste-map/build/index.js
generated
vendored
@@ -3,7 +3,7 @@
|
||||
function _child_process() {
|
||||
const data = require('child_process');
|
||||
|
||||
_child_process = function _child_process() {
|
||||
_child_process = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -11,9 +11,9 @@ function _child_process() {
|
||||
}
|
||||
|
||||
function _crypto() {
|
||||
const data = _interopRequireDefault(require('crypto'));
|
||||
const data = require('crypto');
|
||||
|
||||
_crypto = function _crypto() {
|
||||
_crypto = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -21,9 +21,9 @@ function _crypto() {
|
||||
}
|
||||
|
||||
function _events() {
|
||||
const data = _interopRequireDefault(require('events'));
|
||||
const data = require('events');
|
||||
|
||||
_events = function _events() {
|
||||
_events = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -31,19 +31,19 @@ function _events() {
|
||||
}
|
||||
|
||||
function _os() {
|
||||
const data = _interopRequireDefault(require('os'));
|
||||
const data = require('os');
|
||||
|
||||
_os = function _os() {
|
||||
_os = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -51,19 +51,19 @@ function _path() {
|
||||
}
|
||||
|
||||
function _sane() {
|
||||
const data = _interopRequireDefault(require('sane'));
|
||||
const data = require('sane');
|
||||
|
||||
_sane = function _sane() {
|
||||
_sane = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _invariant() {
|
||||
const data = _interopRequireDefault(require('invariant'));
|
||||
function _jestRegexUtil() {
|
||||
const data = require('jest-regex-util');
|
||||
|
||||
_invariant = function _invariant() {
|
||||
_jestRegexUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ function _invariant() {
|
||||
function _jestSerializer() {
|
||||
const data = _interopRequireDefault(require('jest-serializer'));
|
||||
|
||||
_jestSerializer = function _jestSerializer() {
|
||||
_jestSerializer = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -83,141 +83,85 @@ function _jestSerializer() {
|
||||
function _jestWorker() {
|
||||
const data = _interopRequireDefault(require('jest-worker'));
|
||||
|
||||
_jestWorker = function _jestWorker() {
|
||||
_jestWorker = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _worker = require('./worker');
|
||||
var _HasteFS = _interopRequireDefault(require('./HasteFS'));
|
||||
|
||||
var _ModuleMap = _interopRequireDefault(require('./ModuleMap'));
|
||||
|
||||
var _constants = _interopRequireDefault(require('./constants'));
|
||||
|
||||
var _node = _interopRequireDefault(require('./crawlers/node'));
|
||||
|
||||
var _watchman = _interopRequireDefault(require('./crawlers/watchman'));
|
||||
|
||||
var _getMockName = _interopRequireDefault(require('./getMockName'));
|
||||
|
||||
var _FSEventsWatcher = _interopRequireDefault(require('./lib/FSEventsWatcher'));
|
||||
|
||||
var _WatchmanWatcher = _interopRequireDefault(require('./lib/WatchmanWatcher'));
|
||||
|
||||
var fastPath = _interopRequireWildcard(require('./lib/fast_path'));
|
||||
|
||||
var _getPlatformExtension = _interopRequireDefault(
|
||||
require('./lib/getPlatformExtension')
|
||||
);
|
||||
|
||||
var _constants = _interopRequireDefault(require('./constants'));
|
||||
|
||||
var _HasteFS = _interopRequireDefault(require('./HasteFS'));
|
||||
|
||||
var _ModuleMap = _interopRequireDefault(require('./ModuleMap'));
|
||||
|
||||
var _node = _interopRequireDefault(require('./crawlers/node'));
|
||||
|
||||
var _normalizePathSep = _interopRequireDefault(
|
||||
require('./lib/normalizePathSep')
|
||||
);
|
||||
|
||||
var _watchman = _interopRequireDefault(require('./crawlers/watchman'));
|
||||
|
||||
var _WatchmanWatcher = _interopRequireDefault(require('./lib/WatchmanWatcher'));
|
||||
|
||||
var _FSEventsWatcher = _interopRequireDefault(require('./lib/FSEventsWatcher'));
|
||||
|
||||
var fastPath = _interopRequireWildcard(require('./lib/fast_path'));
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
var _worker = require('./worker');
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return (
|
||||
_arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest()
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
return _arr;
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
if (Array.isArray(arr)) return arr;
|
||||
}
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||
try {
|
||||
var info = gen[key](arg);
|
||||
var value = info.value;
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
if (info.done) {
|
||||
resolve(value);
|
||||
} else {
|
||||
Promise.resolve(value).then(_next, _throw);
|
||||
}
|
||||
}
|
||||
|
||||
function _asyncToGenerator(fn) {
|
||||
return function() {
|
||||
var self = this,
|
||||
args = arguments;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var gen = fn.apply(self, args);
|
||||
function _next(value) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
|
||||
}
|
||||
function _throw(err) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
|
||||
}
|
||||
_next(undefined);
|
||||
});
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
@@ -234,16 +178,19 @@ function _defineProperty(obj, key, value) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
// TypeScript doesn't like us importing from outside `rootDir`, but it doesn't
|
||||
// understand `require`.
|
||||
const {version: VERSION} = require('../package.json');
|
||||
|
||||
const CHANGE_INTERVAL = 30;
|
||||
const MAX_WAIT_TIME = 240000;
|
||||
|
||||
const NODE_MODULES = _path().default.sep + 'node_modules' + _path().default.sep;
|
||||
|
||||
const PACKAGE_JSON = _path().default.sep + 'package.json'; // TypeScript doesn't like us importing from outside `rootDir`, but it doesn't
|
||||
// understand `require`.
|
||||
|
||||
const _require = require('../package.json'),
|
||||
VERSION = _require.version;
|
||||
const NODE_MODULES = path().sep + 'node_modules' + path().sep;
|
||||
const PACKAGE_JSON = path().sep + 'package.json';
|
||||
const VCS_DIRECTORIES = ['.git', '.hg']
|
||||
.map(vcs =>
|
||||
(0, _jestRegexUtil().escapePathForRegex)(path().sep + vcs + path().sep)
|
||||
)
|
||||
.join('|');
|
||||
|
||||
const canUseWatchman = (() => {
|
||||
try {
|
||||
@@ -251,33 +198,16 @@ const canUseWatchman = (() => {
|
||||
stdio: ['ignore']
|
||||
});
|
||||
return true;
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
|
||||
return false;
|
||||
})();
|
||||
|
||||
const escapePathSeparator = string =>
|
||||
_path().default.sep === '\\' ? string.replace(/(\/|\\)/g, '\\\\') : string;
|
||||
|
||||
const getWhiteList = list => {
|
||||
if (list && list.length) {
|
||||
const newList = list.map(item =>
|
||||
escapePathSeparator(item.replace(/(\/)/g, _path().default.sep))
|
||||
);
|
||||
return new RegExp(
|
||||
'(' +
|
||||
escapePathSeparator(NODE_MODULES) +
|
||||
'(?:' +
|
||||
newList.join('|') +
|
||||
')(?=$|' +
|
||||
escapePathSeparator(_path().default.sep) +
|
||||
'))',
|
||||
'g'
|
||||
);
|
||||
function invariant(condition, message) {
|
||||
if (!condition) {
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* HasteMap is a JavaScript implementation of Facebook's haste module system.
|
||||
*
|
||||
@@ -357,9 +287,7 @@ const getWhiteList = list => {
|
||||
*
|
||||
*/
|
||||
|
||||
/* eslint-disable-next-line no-redeclare */
|
||||
|
||||
class HasteMap extends _events().default {
|
||||
class HasteMap extends _events().EventEmitter {
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
@@ -375,23 +303,19 @@ class HasteMap extends _events().default {
|
||||
|
||||
_defineProperty(this, '_watchers', void 0);
|
||||
|
||||
_defineProperty(this, '_whitelist', void 0);
|
||||
|
||||
_defineProperty(this, '_worker', void 0);
|
||||
|
||||
this._options = {
|
||||
cacheDirectory: options.cacheDirectory || _os().default.tmpdir(),
|
||||
cacheDirectory: options.cacheDirectory || (0, _os().tmpdir)(),
|
||||
computeDependencies:
|
||||
options.computeDependencies === undefined
|
||||
? true
|
||||
: options.computeDependencies,
|
||||
computeSha1: options.computeSha1 || false,
|
||||
dependencyExtractor: options.dependencyExtractor,
|
||||
dependencyExtractor: options.dependencyExtractor || null,
|
||||
extensions: options.extensions,
|
||||
forceNodeFilesystemAPI: !!options.forceNodeFilesystemAPI,
|
||||
hasteImplModulePath: options.hasteImplModulePath,
|
||||
ignorePattern: options.ignorePattern,
|
||||
mapper: options.mapper,
|
||||
maxWorkers: options.maxWorkers,
|
||||
mocksPattern: options.mocksPattern
|
||||
? new RegExp(options.mocksPattern)
|
||||
@@ -409,18 +333,31 @@ class HasteMap extends _events().default {
|
||||
};
|
||||
this._console = options.console || global.console;
|
||||
|
||||
if (options.ignorePattern && !(options.ignorePattern instanceof RegExp)) {
|
||||
this._console.warn(
|
||||
'jest-haste-map: the `ignorePattern` options as a function is being ' +
|
||||
'deprecated. Provide a RegExp instead. See https://github.com/facebook/jest/pull/4063.'
|
||||
);
|
||||
if (options.ignorePattern) {
|
||||
if (options.ignorePattern instanceof RegExp) {
|
||||
this._options.ignorePattern = new RegExp(
|
||||
options.ignorePattern.source.concat('|' + VCS_DIRECTORIES),
|
||||
options.ignorePattern.flags
|
||||
);
|
||||
} else {
|
||||
const ignorePattern = options.ignorePattern;
|
||||
const vcsIgnoreRegExp = new RegExp(VCS_DIRECTORIES);
|
||||
|
||||
this._options.ignorePattern = filePath =>
|
||||
vcsIgnoreRegExp.test(filePath) || ignorePattern(filePath);
|
||||
|
||||
this._console.warn(
|
||||
'jest-haste-map: the `ignorePattern` options as a function is being ' +
|
||||
'deprecated. Provide a RegExp instead. See https://github.com/facebook/jest/pull/4063.'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this._options.ignorePattern = new RegExp(VCS_DIRECTORIES);
|
||||
}
|
||||
|
||||
const rootDirHash = _crypto()
|
||||
.default.createHash('md5')
|
||||
const rootDirHash = (0, _crypto().createHash)('md5')
|
||||
.update(options.rootDir)
|
||||
.digest('hex');
|
||||
|
||||
let hasteImplHash = '';
|
||||
let dependencyExtractorHash = '';
|
||||
|
||||
@@ -456,18 +393,14 @@ class HasteMap extends _events().default {
|
||||
hasteImplHash,
|
||||
dependencyExtractorHash
|
||||
);
|
||||
this._whitelist = getWhiteList(options.providesModuleNodeModules);
|
||||
this._buildPromise = null;
|
||||
this._watchers = [];
|
||||
this._worker = null;
|
||||
}
|
||||
|
||||
static getCacheFilePath(tmpdir, name, ...extra) {
|
||||
const hash = _crypto()
|
||||
.default.createHash('md5')
|
||||
.update(extra.join(''));
|
||||
|
||||
return _path().default.join(
|
||||
const hash = (0, _crypto().createHash)('md5').update(extra.join(''));
|
||||
return path().join(
|
||||
tmpdir,
|
||||
name.replace(/\W/g, '-') + '-' + hash.digest('hex')
|
||||
);
|
||||
@@ -478,11 +411,9 @@ class HasteMap extends _events().default {
|
||||
}
|
||||
|
||||
build() {
|
||||
var _this = this;
|
||||
|
||||
if (!this._buildPromise) {
|
||||
this._buildPromise = _asyncToGenerator(function*() {
|
||||
const data = yield _this._buildFileMap(); // Persist when we don't know if files changed (changedFiles undefined)
|
||||
this._buildPromise = (async () => {
|
||||
const data = await this._buildFileMap(); // Persist when we don't know if files changed (changedFiles undefined)
|
||||
// or when we know a file was changed or deleted.
|
||||
|
||||
let hasteMap;
|
||||
@@ -492,14 +423,14 @@ class HasteMap extends _events().default {
|
||||
data.changedFiles.size > 0 ||
|
||||
data.removedFiles.size > 0
|
||||
) {
|
||||
hasteMap = yield _this._buildHasteMap(data);
|
||||
hasteMap = await this._buildHasteMap(data);
|
||||
|
||||
_this._persist(hasteMap);
|
||||
this._persist(hasteMap);
|
||||
} else {
|
||||
hasteMap = data.hasteMap;
|
||||
}
|
||||
|
||||
const rootDir = _this._options.rootDir;
|
||||
const rootDir = this._options.rootDir;
|
||||
const hasteFS = new _HasteFS.default({
|
||||
files: hasteMap.files,
|
||||
rootDir
|
||||
@@ -514,7 +445,7 @@ class HasteMap extends _events().default {
|
||||
const __hasteMapForTest =
|
||||
(process.env.NODE_ENV === 'test' && hasteMap) || null;
|
||||
|
||||
yield _this._watch(hasteMap);
|
||||
await this._watch(hasteMap);
|
||||
return {
|
||||
__hasteMapForTest,
|
||||
hasteFS,
|
||||
@@ -534,7 +465,7 @@ class HasteMap extends _events().default {
|
||||
|
||||
try {
|
||||
hasteMap = _jestSerializer().default.readFileSync(this._cachePath);
|
||||
} catch (err) {
|
||||
} catch {
|
||||
hasteMap = this._createEmptyMap();
|
||||
}
|
||||
|
||||
@@ -554,23 +485,17 @@ class HasteMap extends _events().default {
|
||||
* 2. crawl the file system.
|
||||
*/
|
||||
|
||||
_buildFileMap() {
|
||||
var _this2 = this;
|
||||
async _buildFileMap() {
|
||||
let hasteMap;
|
||||
|
||||
return _asyncToGenerator(function*() {
|
||||
let hasteMap;
|
||||
try {
|
||||
const read = this._options.resetCache ? this._createEmptyMap : this.read;
|
||||
hasteMap = await read.call(this);
|
||||
} catch {
|
||||
hasteMap = this._createEmptyMap();
|
||||
}
|
||||
|
||||
try {
|
||||
const read = _this2._options.resetCache
|
||||
? _this2._createEmptyMap
|
||||
: _this2.read;
|
||||
hasteMap = yield read.call(_this2);
|
||||
} catch (_unused) {
|
||||
hasteMap = _this2._createEmptyMap();
|
||||
}
|
||||
|
||||
return _this2._crawl(hasteMap);
|
||||
})();
|
||||
return this._crawl(hasteMap);
|
||||
}
|
||||
/**
|
||||
* 3. parse and extract metadata from changed files.
|
||||
@@ -607,11 +532,9 @@ class HasteMap extends _events().default {
|
||||
'jest-haste-map: Haste module naming collision: ' + id,
|
||||
' The following files share their name; please adjust your hasteImpl:',
|
||||
' * <rootDir>' +
|
||||
_path().default.sep +
|
||||
path().sep +
|
||||
existingModule[_constants.default.PATH],
|
||||
' * <rootDir>' +
|
||||
_path().default.sep +
|
||||
module[_constants.default.PATH],
|
||||
' * <rootDir>' + path().sep + module[_constants.default.PATH],
|
||||
''
|
||||
].join('\n')
|
||||
);
|
||||
@@ -704,7 +627,7 @@ class HasteMap extends _events().default {
|
||||
if (typeof error !== 'object' || !error.message || !error.stack) {
|
||||
error = new Error(error);
|
||||
error.stack = ''; // Remove stack for stack-less errors.
|
||||
} // @ts-ignore: checking error code is OK if error comes from "fs".
|
||||
}
|
||||
|
||||
if (!['ENOENT', 'EACCES'].includes(error.code)) {
|
||||
throw error;
|
||||
@@ -715,7 +638,7 @@ class HasteMap extends _events().default {
|
||||
}; // If we retain all files in the virtual HasteFS representation, we avoid
|
||||
// reading them if they aren't important (node_modules).
|
||||
|
||||
if (this._options.retainAllFiles && this._isNodeModulesDir(filePath)) {
|
||||
if (this._options.retainAllFiles && filePath.includes(NODE_MODULES)) {
|
||||
if (computeSha1) {
|
||||
return this._getWorker(workerOptions)
|
||||
.getSha1({
|
||||
@@ -751,8 +674,8 @@ class HasteMap extends _events().default {
|
||||
[
|
||||
'jest-haste-map: duplicate manual mock found: ' + mockPath,
|
||||
' The following files share their name; please delete one of them:',
|
||||
' * <rootDir>' + _path().default.sep + existingMockPath,
|
||||
' * <rootDir>' + _path().default.sep + secondMockPath,
|
||||
' * <rootDir>' + path().sep + existingMockPath,
|
||||
' * <rootDir>' + path().sep + secondMockPath,
|
||||
''
|
||||
].join('\n')
|
||||
);
|
||||
@@ -810,9 +733,7 @@ class HasteMap extends _events().default {
|
||||
}
|
||||
|
||||
_buildHasteMap(data) {
|
||||
const removedFiles = data.removedFiles,
|
||||
changedFiles = data.changedFiles,
|
||||
hasteMap = data.hasteMap; // If any files were removed or we did not track what files changed, process
|
||||
const {removedFiles, changedFiles, hasteMap} = data; // If any files were removed or we did not track what files changed, process
|
||||
// every file looking for changes. Otherwise, process only changed files.
|
||||
|
||||
let map;
|
||||
@@ -829,84 +750,33 @@ class HasteMap extends _events().default {
|
||||
filesToProcess = changedFiles;
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = removedFiles[Symbol.iterator](), _step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const _step$value = _slicedToArray(_step.value, 2),
|
||||
relativeFilePath = _step$value[0],
|
||||
fileMetadata = _step$value[1];
|
||||
|
||||
this._recoverDuplicates(
|
||||
hasteMap,
|
||||
relativeFilePath,
|
||||
fileMetadata[_constants.default.ID]
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
for (const [relativeFilePath, fileMetadata] of removedFiles) {
|
||||
this._recoverDuplicates(
|
||||
hasteMap,
|
||||
relativeFilePath,
|
||||
fileMetadata[_constants.default.ID]
|
||||
);
|
||||
}
|
||||
|
||||
const promises = [];
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator2 = filesToProcess.keys()[Symbol.iterator](), _step2;
|
||||
!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done);
|
||||
_iteratorNormalCompletion2 = true
|
||||
for (const relativeFilePath of filesToProcess.keys()) {
|
||||
if (
|
||||
this._options.skipPackageJson &&
|
||||
relativeFilePath.endsWith(PACKAGE_JSON)
|
||||
) {
|
||||
const relativeFilePath = _step2.value;
|
||||
continue;
|
||||
} // SHA-1, if requested, should already be present thanks to the crawler.
|
||||
|
||||
if (
|
||||
this._options.skipPackageJson &&
|
||||
relativeFilePath.endsWith(PACKAGE_JSON)
|
||||
) {
|
||||
continue;
|
||||
} // SHA-1, if requested, should already be present thanks to the crawler.
|
||||
const filePath = fastPath.resolve(
|
||||
this._options.rootDir,
|
||||
relativeFilePath
|
||||
);
|
||||
|
||||
const filePath = fastPath.resolve(
|
||||
this._options.rootDir,
|
||||
relativeFilePath
|
||||
);
|
||||
const promise = this._processFile(hasteMap, map, mocks, filePath);
|
||||
|
||||
const promise = this._processFile(hasteMap, map, mocks, filePath);
|
||||
|
||||
if (promise) {
|
||||
promises.push(promise);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
if (promise) {
|
||||
promises.push(promise);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -927,10 +797,10 @@ class HasteMap extends _events().default {
|
||||
}
|
||||
|
||||
_cleanup() {
|
||||
const worker = this._worker; // @ts-ignore
|
||||
const worker = this._worker; // @ts-expect-error
|
||||
|
||||
if (worker && typeof worker.end === 'function') {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
worker.end();
|
||||
}
|
||||
|
||||
@@ -955,8 +825,8 @@ class HasteMap extends _events().default {
|
||||
worker: _worker.worker
|
||||
};
|
||||
} else {
|
||||
// @ts-ignore: assignment of a worker with custom properties.
|
||||
this._worker = new (_jestWorker()).default(
|
||||
// @ts-expect-error: assignment of a worker with custom properties.
|
||||
this._worker = new (_jestWorker().default)(
|
||||
require.resolve('./worker'),
|
||||
{
|
||||
exposedMethods: ['getSha1', 'worker'],
|
||||
@@ -985,7 +855,6 @@ class HasteMap extends _events().default {
|
||||
extensions: options.extensions,
|
||||
forceNodeFilesystemAPI: options.forceNodeFilesystemAPI,
|
||||
ignore,
|
||||
mapper: options.mapper,
|
||||
rootDir: options.rootDir,
|
||||
roots: options.roots
|
||||
};
|
||||
@@ -1038,7 +907,7 @@ class HasteMap extends _events().default {
|
||||
? _WatchmanWatcher.default
|
||||
: _FSEventsWatcher.default.isSupported()
|
||||
? _FSEventsWatcher.default
|
||||
: _sane().default.NodeWatcher;
|
||||
: _sane().NodeWatcher;
|
||||
const extensions = this._options.extensions;
|
||||
const ignorePattern = this._options.ignorePattern;
|
||||
const rootDir = this._options.rootDir;
|
||||
@@ -1048,9 +917,9 @@ class HasteMap extends _events().default {
|
||||
let mustCopy = true;
|
||||
|
||||
const createWatcher = root => {
|
||||
// @ts-ignore: TODO how? "Cannot use 'new' with an expression whose type lacks a call or construct signature."
|
||||
// @ts-expect-error: TODO how? "Cannot use 'new' with an expression whose type lacks a call or construct signature."
|
||||
const watcher = new Watcher(root, {
|
||||
dot: false,
|
||||
dot: true,
|
||||
glob: extensions.map(extension => '**/*.' + extension),
|
||||
ignored: ignorePattern
|
||||
});
|
||||
@@ -1089,10 +958,7 @@ class HasteMap extends _events().default {
|
||||
};
|
||||
|
||||
const onChange = (type, filePath, root, stat) => {
|
||||
filePath = _path().default.join(
|
||||
root,
|
||||
(0, _normalizePathSep.default)(filePath)
|
||||
);
|
||||
filePath = path().join(root, (0, _normalizePathSep.default)(filePath));
|
||||
|
||||
if (
|
||||
(stat && stat.isDirectory()) ||
|
||||
@@ -1102,6 +968,18 @@ class HasteMap extends _events().default {
|
||||
return;
|
||||
}
|
||||
|
||||
const relativeFilePath = fastPath.relative(rootDir, filePath);
|
||||
const fileMetadata = hasteMap.files.get(relativeFilePath); // The file has been accessed, not modified
|
||||
|
||||
if (
|
||||
type === 'change' &&
|
||||
fileMetadata &&
|
||||
stat &&
|
||||
fileMetadata[_constants.default.MTIME] === stat.mtime.getTime()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
changeQueue = changeQueue
|
||||
.then(() => {
|
||||
// If we get duplicate events for the same file, ignore them.
|
||||
@@ -1139,7 +1017,6 @@ class HasteMap extends _events().default {
|
||||
return null;
|
||||
};
|
||||
|
||||
const relativeFilePath = fastPath.relative(rootDir, filePath);
|
||||
const fileMetadata = hasteMap.files.get(relativeFilePath); // If it's not an addition, delete the file and all its metadata
|
||||
|
||||
if (fileMetadata != null) {
|
||||
@@ -1180,14 +1057,14 @@ class HasteMap extends _events().default {
|
||||
// parse it and update the haste map.
|
||||
|
||||
if (type === 'add' || type === 'change') {
|
||||
(0, _invariant().default)(
|
||||
invariant(
|
||||
stat,
|
||||
'since the file exists or changed, it should have stats'
|
||||
);
|
||||
const fileMetadata = [
|
||||
'',
|
||||
stat ? stat.mtime.getTime() : -1,
|
||||
stat ? stat.size : 0,
|
||||
stat.mtime.getTime(),
|
||||
stat.size,
|
||||
0,
|
||||
'',
|
||||
null
|
||||
@@ -1293,7 +1170,7 @@ class HasteMap extends _events().default {
|
||||
}
|
||||
|
||||
end() {
|
||||
// @ts-ignore: TODO TS cannot decide if `setInterval` and `clearInterval` comes from NodeJS or the DOM
|
||||
// @ts-expect-error: TODO TS cannot decide if `setInterval` and `clearInterval` comes from NodeJS or the DOM
|
||||
clearInterval(this._changeInterval);
|
||||
|
||||
if (!this._watchers.length) {
|
||||
@@ -1320,32 +1197,10 @@ class HasteMap extends _events().default {
|
||||
: ignorePattern && ignorePattern(filePath);
|
||||
return (
|
||||
ignoreMatched ||
|
||||
(!this._options.retainAllFiles && this._isNodeModulesDir(filePath))
|
||||
(!this._options.retainAllFiles && filePath.includes(NODE_MODULES))
|
||||
);
|
||||
}
|
||||
|
||||
_isNodeModulesDir(filePath) {
|
||||
if (!filePath.includes(NODE_MODULES)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this._whitelist) {
|
||||
const whitelist = this._whitelist;
|
||||
const match = whitelist.exec(filePath);
|
||||
const matchEndIndex = whitelist.lastIndex;
|
||||
whitelist.lastIndex = 0;
|
||||
|
||||
if (!match) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const filePathInPackage = filePath.substr(matchEndIndex);
|
||||
return filePathInPackage.startsWith(NODE_MODULES);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_createEmptyMap() {
|
||||
return {
|
||||
clocks: new Map(),
|
||||
|
||||
10
node_modules/jest-haste-map/build/lib/FSEventsWatcher.d.ts
generated
vendored
10
node_modules/jest-haste-map/build/lib/FSEventsWatcher.d.ts
generated
vendored
@@ -7,27 +7,26 @@
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
import anymatch from 'anymatch';
|
||||
import { Watcher } from 'fsevents';
|
||||
import { Matcher } from 'anymatch';
|
||||
/**
|
||||
* Export `FSEventsWatcher` class.
|
||||
* Watches `dir`.
|
||||
*/
|
||||
declare class FSEventsWatcher extends EventEmitter {
|
||||
readonly root: string;
|
||||
readonly ignored?: anymatch.Matcher;
|
||||
readonly ignored?: Matcher;
|
||||
readonly glob: Array<string>;
|
||||
readonly dot: boolean;
|
||||
readonly hasIgnore: boolean;
|
||||
readonly doIgnore: (path: string) => boolean;
|
||||
readonly watcher: Watcher;
|
||||
readonly fsEventsWatchStopper: () => Promise<void>;
|
||||
private _tracked;
|
||||
static isSupported(): boolean;
|
||||
private static normalizeProxy;
|
||||
private static recReaddir;
|
||||
constructor(dir: string, opts: {
|
||||
root: string;
|
||||
ignored?: anymatch.Matcher;
|
||||
ignored?: Matcher;
|
||||
glob: string | Array<string>;
|
||||
dot: boolean;
|
||||
});
|
||||
@@ -43,4 +42,3 @@ declare class FSEventsWatcher extends EventEmitter {
|
||||
private _emit;
|
||||
}
|
||||
export = FSEventsWatcher;
|
||||
//# sourceMappingURL=FSEventsWatcher.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/lib/FSEventsWatcher.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/lib/FSEventsWatcher.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"FSEventsWatcher.d.ts","sourceRoot":"","sources":["../../src/lib/FSEventsWatcher.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAIH,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAsBjC;;;GAGG;AACH,cAAM,eAAgB,SAAQ,YAAY;IACxC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3C,SAAgB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,SAAgB,GAAG,EAAE,OAAO,CAAC;IAC7B,SAAgB,SAAS,EAAE,OAAO,CAAC;IACnC,SAAgB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACpD,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,OAAO,CAAC,QAAQ,CAAc;IAE9B,MAAM,CAAC,WAAW;IAIlB,OAAO,CAAC,MAAM,CAAC,cAAc;IAO7B,OAAO,CAAC,MAAM,CAAC,UAAU;gBAqBvB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;QAC3B,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,GAAG,EAAE,OAAO,CAAC;KACd;IAqCH;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI;IAQ3B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,WAAW;IAgCnB;;OAEG;IACH,OAAO,CAAC,KAAK;CAId;AAED,SAAS,eAAe,CAAC"}
|
||||
133
node_modules/jest-haste-map/build/lib/FSEventsWatcher.js
generated
vendored
133
node_modules/jest-haste-map/build/lib/FSEventsWatcher.js
generated
vendored
@@ -1,29 +1,19 @@
|
||||
'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 _events() {
|
||||
const data = require('events');
|
||||
|
||||
_events = function _events() {
|
||||
_events = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -33,7 +23,17 @@ function _events() {
|
||||
function _anymatch() {
|
||||
const data = _interopRequireDefault(require('anymatch'));
|
||||
|
||||
_anymatch = function _anymatch() {
|
||||
_anymatch = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ function _anymatch() {
|
||||
function _micromatch() {
|
||||
const data = _interopRequireDefault(require('micromatch'));
|
||||
|
||||
_micromatch = function _micromatch() {
|
||||
_micromatch = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ function _micromatch() {
|
||||
function _walker() {
|
||||
const data = _interopRequireDefault(require('walker'));
|
||||
|
||||
_walker = function _walker() {
|
||||
_walker = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -64,6 +64,48 @@ function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
@@ -78,11 +120,13 @@ function _defineProperty(obj, key, value) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
let fsevents;
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
||||
// @ts-ignore: this is for CI which runs linux and might not have this
|
||||
let fsevents = null;
|
||||
|
||||
try {
|
||||
fsevents = require('fsevents');
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Optional dependency, only supported on Darwin.
|
||||
}
|
||||
|
||||
@@ -97,12 +141,11 @@ const ALL_EVENT = 'all';
|
||||
*/
|
||||
class FSEventsWatcher extends _events().EventEmitter {
|
||||
static isSupported() {
|
||||
return fsevents !== undefined;
|
||||
return fsevents !== null;
|
||||
}
|
||||
|
||||
static normalizeProxy(callback) {
|
||||
return (filepath, stats) =>
|
||||
callback(_path().default.normalize(filepath), stats);
|
||||
return (filepath, stats) => callback(path().normalize(filepath), stats);
|
||||
}
|
||||
|
||||
static recReaddir(
|
||||
@@ -146,7 +189,7 @@ class FSEventsWatcher extends _events().EventEmitter {
|
||||
|
||||
_defineProperty(this, 'doIgnore', void 0);
|
||||
|
||||
_defineProperty(this, 'watcher', void 0);
|
||||
_defineProperty(this, 'fsEventsWatchStopper', void 0);
|
||||
|
||||
_defineProperty(this, '_tracked', void 0);
|
||||
|
||||
@@ -158,9 +201,11 @@ class FSEventsWatcher extends _events().EventEmitter {
|
||||
this.doIgnore = opts.ignored
|
||||
? (0, _anymatch().default)(opts.ignored)
|
||||
: () => false;
|
||||
this.root = _path().default.resolve(dir);
|
||||
this.watcher = fsevents(this.root);
|
||||
this.watcher.start().on('change', this.handleEvent.bind(this));
|
||||
this.root = path().resolve(dir);
|
||||
this.fsEventsWatchStopper = fsevents.watch(
|
||||
this.root,
|
||||
this.handleEvent.bind(this)
|
||||
);
|
||||
this._tracked = new Set();
|
||||
FSEventsWatcher.recReaddir(
|
||||
this.root,
|
||||
@@ -180,12 +225,13 @@ class FSEventsWatcher extends _events().EventEmitter {
|
||||
*/
|
||||
|
||||
close(callback) {
|
||||
this.watcher.stop();
|
||||
this.removeAllListeners();
|
||||
this.fsEventsWatchStopper().then(() => {
|
||||
this.removeAllListeners();
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
process.nextTick(callback.bind(null, null, true));
|
||||
}
|
||||
if (typeof callback === 'function') {
|
||||
process.nextTick(callback.bind(null, null, true));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isFileIncluded(relativePath) {
|
||||
@@ -194,20 +240,21 @@ class FSEventsWatcher extends _events().EventEmitter {
|
||||
}
|
||||
|
||||
return this.glob.length
|
||||
? _micromatch().default.some(relativePath, this.glob, {
|
||||
? (0, _micromatch().default)([relativePath], this.glob, {
|
||||
dot: this.dot
|
||||
})
|
||||
: this.dot || _micromatch().default.some(relativePath, '**/*');
|
||||
}).length > 0
|
||||
: this.dot ||
|
||||
(0, _micromatch().default)([relativePath], '**/*').length > 0;
|
||||
}
|
||||
|
||||
handleEvent(filepath) {
|
||||
const relativePath = _path().default.relative(this.root, filepath);
|
||||
const relativePath = path().relative(this.root, filepath);
|
||||
|
||||
if (!this.isFileIncluded(relativePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_fs().default.lstat(filepath, (error, stat) => {
|
||||
fs().lstat(filepath, (error, stat) => {
|
||||
if (error && error.code !== 'ENOENT') {
|
||||
this.emit('error', error);
|
||||
return;
|
||||
|
||||
106
node_modules/jest-haste-map/build/lib/WatchmanWatcher.js
generated
vendored
106
node_modules/jest-haste-map/build/lib/WatchmanWatcher.js
generated
vendored
@@ -5,30 +5,10 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = WatchmanWatcher;
|
||||
|
||||
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 _assert() {
|
||||
const data = _interopRequireDefault(require('assert'));
|
||||
|
||||
_assert = function _assert() {
|
||||
_assert = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -38,7 +18,17 @@ function _assert() {
|
||||
function _events() {
|
||||
const data = require('events');
|
||||
|
||||
_events = function _events() {
|
||||
_events = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -48,7 +38,17 @@ function _events() {
|
||||
function _fbWatchman() {
|
||||
const data = _interopRequireDefault(require('fb-watchman'));
|
||||
|
||||
_fbWatchman = function _fbWatchman() {
|
||||
_fbWatchman = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ function _fbWatchman() {
|
||||
function _common() {
|
||||
const data = _interopRequireDefault(require('sane/src/common'));
|
||||
|
||||
_common = function _common() {
|
||||
_common = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -70,13 +70,55 @@ function _recrawlWarningDedupe() {
|
||||
require('sane/src/utils/recrawl-warning-dedupe')
|
||||
);
|
||||
|
||||
_recrawlWarningDedupe = function _recrawlWarningDedupe() {
|
||||
_recrawlWarningDedupe = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
@@ -119,13 +161,13 @@ WatchmanWatcher.prototype.__proto__ = _events().EventEmitter.prototype;
|
||||
* @private
|
||||
*/
|
||||
|
||||
WatchmanWatcher.prototype.init = function() {
|
||||
WatchmanWatcher.prototype.init = function () {
|
||||
if (this.client) {
|
||||
this.client.removeAllListeners();
|
||||
}
|
||||
|
||||
const self = this;
|
||||
this.client = new (_fbWatchman()).default.Client();
|
||||
this.client = new (_fbWatchman().default.Client)();
|
||||
this.client.on('error', error => {
|
||||
self.emit('error', error);
|
||||
});
|
||||
@@ -255,7 +297,7 @@ WatchmanWatcher.prototype.init = function() {
|
||||
* @private
|
||||
*/
|
||||
|
||||
WatchmanWatcher.prototype.handleChangeEvent = function(resp) {
|
||||
WatchmanWatcher.prototype.handleChangeEvent = function (resp) {
|
||||
_assert().default.equal(
|
||||
resp.subscription,
|
||||
SUB_NAME,
|
||||
@@ -281,7 +323,7 @@ WatchmanWatcher.prototype.handleChangeEvent = function(resp) {
|
||||
* @private
|
||||
*/
|
||||
|
||||
WatchmanWatcher.prototype.handleFileChange = function(changeDescriptor) {
|
||||
WatchmanWatcher.prototype.handleFileChange = function (changeDescriptor) {
|
||||
const self = this;
|
||||
let absPath;
|
||||
let relativePath;
|
||||
@@ -313,7 +355,7 @@ WatchmanWatcher.prototype.handleFileChange = function(changeDescriptor) {
|
||||
if (!changeDescriptor.exists) {
|
||||
self.emitEvent(DELETE_EVENT, relativePath, self.root);
|
||||
} else {
|
||||
_fs().default.lstat(absPath, (error, stat) => {
|
||||
fs().lstat(absPath, (error, stat) => {
|
||||
// Files can be deleted between the event and the lstat call
|
||||
// the most reliable thing to do here is to ignore the event.
|
||||
if (error && error.code === 'ENOENT') {
|
||||
@@ -342,7 +384,7 @@ WatchmanWatcher.prototype.handleFileChange = function(changeDescriptor) {
|
||||
* @private
|
||||
*/
|
||||
|
||||
WatchmanWatcher.prototype.emitEvent = function(
|
||||
WatchmanWatcher.prototype.emitEvent = function (
|
||||
eventType,
|
||||
filepath,
|
||||
root,
|
||||
@@ -358,7 +400,7 @@ WatchmanWatcher.prototype.emitEvent = function(
|
||||
* @private
|
||||
*/
|
||||
|
||||
WatchmanWatcher.prototype.close = function(callback) {
|
||||
WatchmanWatcher.prototype.close = function (callback) {
|
||||
this.client.removeAllListeners();
|
||||
this.client.end();
|
||||
callback && callback(null, true);
|
||||
|
||||
1
node_modules/jest-haste-map/build/lib/dependencyExtractor.d.ts
generated
vendored
1
node_modules/jest-haste-map/build/lib/dependencyExtractor.d.ts
generated
vendored
@@ -5,4 +5,3 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
export declare function extract(code: string): Set<string>;
|
||||
//# sourceMappingURL=dependencyExtractor.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/lib/dependencyExtractor.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/lib/dependencyExtractor.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"dependencyExtractor.d.ts","sourceRoot":"","sources":["../../src/lib/dependencyExtractor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuEH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAgBjD"}
|
||||
3
node_modules/jest-haste-map/build/lib/dependencyExtractor.js
generated
vendored
3
node_modules/jest-haste-map/build/lib/dependencyExtractor.js
generated
vendored
@@ -71,8 +71,7 @@ const IMPORT_OR_EXPORT_RE = createRegExp(
|
||||
const JEST_EXTENSIONS_RE = createRegExp(
|
||||
[
|
||||
...functionCallStart(
|
||||
'require\\s*\\.\\s*(?:requireActual|requireMock)',
|
||||
'jest\\s*\\.\\s*(?:requireActual|requireMock|genMockFromModule)'
|
||||
'jest\\s*\\.\\s*(?:requireActual|requireMock|genMockFromModule|createMockFromModule)'
|
||||
),
|
||||
CAPTURE_STRING_LITERAL(1),
|
||||
WHITESPACE,
|
||||
|
||||
1
node_modules/jest-haste-map/build/lib/fast_path.d.ts
generated
vendored
1
node_modules/jest-haste-map/build/lib/fast_path.d.ts
generated
vendored
@@ -6,4 +6,3 @@
|
||||
*/
|
||||
export declare function relative(rootDir: string, filename: string): string;
|
||||
export declare function resolve(rootDir: string, relativeFilename: string): string;
|
||||
//# sourceMappingURL=fast_path.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/lib/fast_path.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/lib/fast_path.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"fast_path.d.ts","sourceRoot":"","sources":["../../src/lib/fast_path.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIlE;AAMD,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAIzE"}
|
||||
58
node_modules/jest-haste-map/build/lib/fast_path.js
generated
vendored
58
node_modules/jest-haste-map/build/lib/fast_path.js
generated
vendored
@@ -6,18 +6,56 @@ Object.defineProperty(exports, '__esModule', {
|
||||
exports.relative = relative;
|
||||
exports.resolve = resolve;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,16 +66,16 @@ function _interopRequireDefault(obj) {
|
||||
*/
|
||||
// rootDir and filename must be absolute paths (resolved)
|
||||
function relative(rootDir, filename) {
|
||||
return filename.indexOf(rootDir + _path().default.sep) === 0
|
||||
return filename.indexOf(rootDir + path().sep) === 0
|
||||
? filename.substr(rootDir.length + 1)
|
||||
: _path().default.relative(rootDir, filename);
|
||||
: path().relative(rootDir, filename);
|
||||
}
|
||||
|
||||
const INDIRECTION_FRAGMENT = '..' + _path().default.sep; // rootDir must be an absolute path and relativeFilename must be simple
|
||||
const INDIRECTION_FRAGMENT = '..' + path().sep; // rootDir must be an absolute path and relativeFilename must be simple
|
||||
// (e.g.: foo/bar or ../foo/bar, but never ./foo or foo/../bar)
|
||||
|
||||
function resolve(rootDir, relativeFilename) {
|
||||
return relativeFilename.indexOf(INDIRECTION_FRAGMENT) === 0
|
||||
? _path().default.resolve(rootDir, relativeFilename)
|
||||
: rootDir + _path().default.sep + relativeFilename;
|
||||
? path().resolve(rootDir, relativeFilename)
|
||||
: rootDir + path().sep + relativeFilename;
|
||||
}
|
||||
|
||||
1
node_modules/jest-haste-map/build/lib/getPlatformExtension.d.ts
generated
vendored
1
node_modules/jest-haste-map/build/lib/getPlatformExtension.d.ts
generated
vendored
@@ -5,4 +5,3 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
export default function getPlatformExtension(file: string, platforms?: Array<string>): string | null;
|
||||
//# sourceMappingURL=getPlatformExtension.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/lib/getPlatformExtension.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/lib/getPlatformExtension.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"getPlatformExtension.d.ts","sourceRoot":"","sources":["../../src/lib/getPlatformExtension.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GACxB,MAAM,GAAG,IAAI,CAaf"}
|
||||
1
node_modules/jest-haste-map/build/lib/isRegExpSupported.d.ts
generated
vendored
1
node_modules/jest-haste-map/build/lib/isRegExpSupported.d.ts
generated
vendored
@@ -5,4 +5,3 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
export default function isRegExpSupported(value: string): boolean;
|
||||
//# sourceMappingURL=isRegExpSupported.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/lib/isRegExpSupported.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/lib/isRegExpSupported.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"isRegExpSupported.d.ts","sourceRoot":"","sources":["../../src/lib/isRegExpSupported.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAQhE"}
|
||||
2
node_modules/jest-haste-map/build/lib/isRegExpSupported.js
generated
vendored
2
node_modules/jest-haste-map/build/lib/isRegExpSupported.js
generated
vendored
@@ -16,7 +16,7 @@ function isRegExpSupported(value) {
|
||||
// eslint-disable-next-line no-new
|
||||
new RegExp(value);
|
||||
return true;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
1
node_modules/jest-haste-map/build/lib/normalizePathSep.d.ts
generated
vendored
1
node_modules/jest-haste-map/build/lib/normalizePathSep.d.ts
generated
vendored
@@ -6,4 +6,3 @@
|
||||
*/
|
||||
declare let normalizePathSep: (string: string) => string;
|
||||
export default normalizePathSep;
|
||||
//# sourceMappingURL=normalizePathSep.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/lib/normalizePathSep.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/lib/normalizePathSep.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"normalizePathSep.d.ts","sourceRoot":"","sources":["../../src/lib/normalizePathSep.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,QAAA,IAAI,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;AAOjD,eAAe,gBAAgB,CAAC"}
|
||||
52
node_modules/jest-haste-map/build/lib/normalizePathSep.js
generated
vendored
52
node_modules/jest-haste-map/build/lib/normalizePathSep.js
generated
vendored
@@ -5,18 +5,56 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,10 +65,10 @@ function _interopRequireDefault(obj) {
|
||||
*/
|
||||
let normalizePathSep;
|
||||
|
||||
if (_path().default.sep === '/') {
|
||||
if (path().sep === '/') {
|
||||
normalizePathSep = filePath => filePath;
|
||||
} else {
|
||||
normalizePathSep = filePath => filePath.replace(/\//g, _path().default.sep);
|
||||
normalizePathSep = filePath => filePath.replace(/\//g, path().sep);
|
||||
}
|
||||
|
||||
var _default = normalizePathSep;
|
||||
|
||||
24
node_modules/jest-haste-map/build/types.d.ts
generated
vendored
24
node_modules/jest-haste-map/build/types.d.ts
generated
vendored
@@ -5,16 +5,15 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import fs from 'fs';
|
||||
import { Config } from '@jest/types';
|
||||
import ModuleMap from './ModuleMap';
|
||||
import HasteFS from './HasteFS';
|
||||
import type { Stats } from 'graceful-fs';
|
||||
import type { Config } from '@jest/types';
|
||||
import type HasteFS from './HasteFS';
|
||||
import type ModuleMap from './ModuleMap';
|
||||
export declare type IgnoreMatcher = (item: string) => boolean;
|
||||
export declare type Mapper = (item: string) => Array<string> | null;
|
||||
export declare type WorkerMessage = {
|
||||
computeDependencies: boolean;
|
||||
computeSha1: boolean;
|
||||
dependencyExtractor?: string;
|
||||
dependencyExtractor?: string | null;
|
||||
rootDir: string;
|
||||
filePath: string;
|
||||
hasteImplModulePath?: string;
|
||||
@@ -31,7 +30,6 @@ export declare type CrawlerOptions = {
|
||||
extensions: Array<string>;
|
||||
forceNodeFilesystemAPI: boolean;
|
||||
ignore: IgnoreMatcher;
|
||||
mapper?: Mapper | null;
|
||||
rootDir: string;
|
||||
roots: Array<string>;
|
||||
};
|
||||
@@ -39,7 +37,14 @@ export declare type HasteImpl = {
|
||||
getHasteName(filePath: Config.Path): string | undefined;
|
||||
};
|
||||
export declare type FileData = Map<Config.Path, FileMetaData>;
|
||||
export declare type FileMetaData = [string, number, number, 0 | 1, string, string | null | undefined];
|
||||
export declare type FileMetaData = [
|
||||
string,
|
||||
number,
|
||||
number,
|
||||
0 | 1,
|
||||
string,
|
||||
string | null | undefined
|
||||
];
|
||||
export declare type MockData = Map<string, Config.Path>;
|
||||
export declare type ModuleMapData = Map<string, ModuleMapItem>;
|
||||
export declare type WatchmanClocks = Map<Config.Path, string>;
|
||||
@@ -86,7 +91,7 @@ export declare type HType = {
|
||||
export declare type HTypeValue = HType[keyof HType];
|
||||
export declare type EventsQueue = Array<{
|
||||
filePath: Config.Path;
|
||||
stat: fs.Stats | undefined;
|
||||
stat: Stats | undefined;
|
||||
type: string;
|
||||
}>;
|
||||
export declare type ChangeEvent = {
|
||||
@@ -95,4 +100,3 @@ export declare type ChangeEvent = {
|
||||
moduleMap: ModuleMap;
|
||||
};
|
||||
export {};
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/types.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/types.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,oBAAY,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AACtD,oBAAY,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAE5D,oBAAY,aAAa,GAAG;IAC1B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/C,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC9B,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,gBAAgB,CAAC;IACvB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,sBAAsB,EAAE,OAAO,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB,CAAC;AAEF,oBAAY,SAAS,GAAG;IACtB,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;CACzD,CAAC;AAEF,oBAAY,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAEtD,oBAAY,YAAY,GAAG,CAChB,MAAM,EACH,MAAM,EACP,MAAM,EACH,CAAC,GAAG,CAAC,EACA,MAAM,EACd,MAAM,GAAG,IAAI,GAAG,SAAS,CACrC,CAAC;AAEF,oBAAY,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;AAChD,oBAAY,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACvD,oBAAY,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACtD,oBAAY,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;AAE9D,oBAAY,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3D,oBAAY,eAAe,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAEtE,oBAAY,gBAAgB,GAAG;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,QAAQ,CAAC;IAChB,GAAG,EAAE,aAAa,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;CACjB,CAAC;AAEF,oBAAY,QAAQ,GAAG;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC7C,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;IACrB,UAAU,EAAE,eAAe,CAAC;IAC5B,GAAG,EAAE,aAAa,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;CACjB,CAAC;AAEF,aAAK,aAAa,GAAG;IAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAA;CAAC,CAAC;AAC1D,oBAAY,cAAc,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;AAE9D,oBAAY,KAAK,GAAG;IAClB,EAAE,EAAE,CAAC,CAAC;IACN,KAAK,EAAE,CAAC,CAAC;IACT,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,CAAC,CAAC;IACX,YAAY,EAAE,CAAC,CAAC;IAChB,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,CAAC,CAAC;IACV,OAAO,EAAE,CAAC,CAAC;IACX,gBAAgB,EAAE,GAAG,CAAC;IACtB,eAAe,EAAE,QAAQ,CAAC;IAC1B,gBAAgB,EAAE,IAAI,CAAC;CACxB,CAAC;AAEF,oBAAY,UAAU,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAE5C,oBAAY,WAAW,GAAG,KAAK,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC;IACtB,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,oBAAY,WAAW,GAAG;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC"}
|
||||
3
node_modules/jest-haste-map/build/worker.d.ts
generated
vendored
3
node_modules/jest-haste-map/build/worker.d.ts
generated
vendored
@@ -4,7 +4,6 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { WorkerMessage, WorkerMetadata } from './types';
|
||||
import type { WorkerMessage, WorkerMetadata } from './types';
|
||||
export declare function worker(data: WorkerMessage): Promise<WorkerMetadata>;
|
||||
export declare function getSha1(data: WorkerMessage): Promise<WorkerMetadata>;
|
||||
//# sourceMappingURL=worker.d.ts.map
|
||||
1
node_modules/jest-haste-map/build/worker.d.ts.map
generated
vendored
1
node_modules/jest-haste-map/build/worker.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAY,aAAa,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AAiBjE,wBAAsB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAwEzE;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAW1E"}
|
||||
303
node_modules/jest-haste-map/build/worker.js
generated
vendored
303
node_modules/jest-haste-map/build/worker.js
generated
vendored
@@ -7,29 +7,29 @@ exports.worker = worker;
|
||||
exports.getSha1 = getSha1;
|
||||
|
||||
function _crypto() {
|
||||
const data = _interopRequireDefault(require('crypto'));
|
||||
const data = require('crypto');
|
||||
|
||||
_crypto = function _crypto() {
|
||||
_crypto = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _gracefulFs() {
|
||||
const data = _interopRequireDefault(require('graceful-fs'));
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
_gracefulFs = function _gracefulFs() {
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -44,187 +44,154 @@ var dependencyExtractor = _interopRequireWildcard(
|
||||
require('./lib/dependencyExtractor')
|
||||
);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||
try {
|
||||
var info = gen[key](arg);
|
||||
var value = info.value;
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
if (info.done) {
|
||||
resolve(value);
|
||||
} else {
|
||||
Promise.resolve(value).then(_next, _throw);
|
||||
}
|
||||
}
|
||||
|
||||
function _asyncToGenerator(fn) {
|
||||
return function() {
|
||||
var self = this,
|
||||
args = arguments;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var gen = fn.apply(self, args);
|
||||
function _next(value) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
|
||||
}
|
||||
function _throw(err) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
|
||||
}
|
||||
_next(undefined);
|
||||
});
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
const PACKAGE_JSON = _path().default.sep + 'package.json';
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
const PACKAGE_JSON = path().sep + 'package.json';
|
||||
let hasteImpl = null;
|
||||
let hasteImplModulePath = null;
|
||||
|
||||
function sha1hex(content) {
|
||||
return _crypto()
|
||||
.default.createHash('sha1')
|
||||
.update(content)
|
||||
.digest('hex');
|
||||
return (0, _crypto().createHash)('sha1').update(content).digest('hex');
|
||||
}
|
||||
|
||||
function worker(_x) {
|
||||
return _worker.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _worker() {
|
||||
_worker = _asyncToGenerator(function*(data) {
|
||||
if (
|
||||
data.hasteImplModulePath &&
|
||||
data.hasteImplModulePath !== hasteImplModulePath
|
||||
) {
|
||||
if (hasteImpl) {
|
||||
throw new Error('jest-haste-map: hasteImplModulePath changed');
|
||||
}
|
||||
|
||||
hasteImplModulePath = data.hasteImplModulePath;
|
||||
hasteImpl = require(hasteImplModulePath);
|
||||
async function worker(data) {
|
||||
if (
|
||||
data.hasteImplModulePath &&
|
||||
data.hasteImplModulePath !== hasteImplModulePath
|
||||
) {
|
||||
if (hasteImpl) {
|
||||
throw new Error('jest-haste-map: hasteImplModulePath changed');
|
||||
}
|
||||
|
||||
let content;
|
||||
let dependencies;
|
||||
let id;
|
||||
let module;
|
||||
let sha1;
|
||||
const computeDependencies = data.computeDependencies,
|
||||
computeSha1 = data.computeSha1,
|
||||
rootDir = data.rootDir,
|
||||
filePath = data.filePath;
|
||||
hasteImplModulePath = data.hasteImplModulePath;
|
||||
hasteImpl = require(hasteImplModulePath);
|
||||
}
|
||||
|
||||
const getContent = () => {
|
||||
if (content === undefined) {
|
||||
content = _gracefulFs().default.readFileSync(filePath, 'utf8');
|
||||
let content;
|
||||
let dependencies;
|
||||
let id;
|
||||
let module;
|
||||
let sha1;
|
||||
const {computeDependencies, computeSha1, rootDir, filePath} = data;
|
||||
|
||||
const getContent = () => {
|
||||
if (content === undefined) {
|
||||
content = fs().readFileSync(filePath, 'utf8');
|
||||
}
|
||||
|
||||
return content;
|
||||
};
|
||||
|
||||
if (filePath.endsWith(PACKAGE_JSON)) {
|
||||
// Process a package.json that is returned as a PACKAGE type with its name.
|
||||
try {
|
||||
const fileData = JSON.parse(getContent());
|
||||
|
||||
if (fileData.name) {
|
||||
const relativeFilePath = path().relative(rootDir, filePath);
|
||||
id = fileData.name;
|
||||
module = [relativeFilePath, _constants.default.PACKAGE];
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`Cannot parse ${filePath} as JSON: ${err.message}`);
|
||||
}
|
||||
} else if (
|
||||
!_blacklist.default.has(filePath.substr(filePath.lastIndexOf('.')))
|
||||
) {
|
||||
// Process a random file that is returned as a MODULE.
|
||||
if (hasteImpl) {
|
||||
id = hasteImpl.getHasteName(filePath);
|
||||
}
|
||||
|
||||
return content;
|
||||
};
|
||||
|
||||
if (filePath.endsWith(PACKAGE_JSON)) {
|
||||
// Process a package.json that is returned as a PACKAGE type with its name.
|
||||
try {
|
||||
const fileData = JSON.parse(getContent());
|
||||
|
||||
if (fileData.name) {
|
||||
const relativeFilePath = _path().default.relative(rootDir, filePath);
|
||||
|
||||
id = fileData.name;
|
||||
module = [relativeFilePath, _constants.default.PACKAGE];
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`Cannot parse ${filePath} as JSON: ${err.message}`);
|
||||
}
|
||||
} else if (
|
||||
!_blacklist.default.has(filePath.substr(filePath.lastIndexOf('.')))
|
||||
) {
|
||||
// Process a random file that is returned as a MODULE.
|
||||
if (hasteImpl) {
|
||||
id = hasteImpl.getHasteName(filePath);
|
||||
}
|
||||
|
||||
if (computeDependencies) {
|
||||
const content = getContent();
|
||||
dependencies = Array.from(
|
||||
data.dependencyExtractor
|
||||
? require(data.dependencyExtractor).extract(
|
||||
content,
|
||||
filePath,
|
||||
dependencyExtractor.extract
|
||||
)
|
||||
: dependencyExtractor.extract(content)
|
||||
);
|
||||
}
|
||||
|
||||
if (id) {
|
||||
const relativeFilePath = _path().default.relative(rootDir, filePath);
|
||||
|
||||
module = [relativeFilePath, _constants.default.MODULE];
|
||||
}
|
||||
} // If a SHA-1 is requested on update, compute it.
|
||||
|
||||
if (computeSha1) {
|
||||
sha1 = sha1hex(
|
||||
getContent() || _gracefulFs().default.readFileSync(filePath)
|
||||
if (computeDependencies) {
|
||||
const content = getContent();
|
||||
dependencies = Array.from(
|
||||
data.dependencyExtractor
|
||||
? require(data.dependencyExtractor).extract(
|
||||
content,
|
||||
filePath,
|
||||
dependencyExtractor.extract
|
||||
)
|
||||
: dependencyExtractor.extract(content)
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
dependencies,
|
||||
id,
|
||||
module,
|
||||
sha1
|
||||
};
|
||||
});
|
||||
return _worker.apply(this, arguments);
|
||||
if (id) {
|
||||
const relativeFilePath = path().relative(rootDir, filePath);
|
||||
module = [relativeFilePath, _constants.default.MODULE];
|
||||
}
|
||||
} // If a SHA-1 is requested on update, compute it.
|
||||
|
||||
if (computeSha1) {
|
||||
sha1 = sha1hex(getContent() || fs().readFileSync(filePath));
|
||||
}
|
||||
|
||||
return {
|
||||
dependencies,
|
||||
id,
|
||||
module,
|
||||
sha1
|
||||
};
|
||||
}
|
||||
|
||||
function getSha1(_x2) {
|
||||
return _getSha.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _getSha() {
|
||||
_getSha = _asyncToGenerator(function*(data) {
|
||||
const sha1 = data.computeSha1
|
||||
? sha1hex(_gracefulFs().default.readFileSync(data.filePath))
|
||||
: null;
|
||||
return {
|
||||
dependencies: undefined,
|
||||
id: undefined,
|
||||
module: undefined,
|
||||
sha1
|
||||
};
|
||||
});
|
||||
return _getSha.apply(this, arguments);
|
||||
async function getSha1(data) {
|
||||
const sha1 = data.computeSha1
|
||||
? sha1hex(fs().readFileSync(data.filePath))
|
||||
: null;
|
||||
return {
|
||||
dependencies: undefined,
|
||||
id: undefined,
|
||||
module: undefined,
|
||||
sha1
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user