Update node_modules

This commit is contained in:
crazy-max
2020-01-23 08:49:02 +00:00
parent 80426e98c8
commit c8a47ad4bb
9923 changed files with 950627 additions and 38 deletions

21
node_modules/jest-haste-map/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Facebook, Inc. and its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

28
node_modules/jest-haste-map/build/HasteFS.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
/**
* 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.
*/
import { Config } from '@jest/types';
import { FileData } from './types';
export default class HasteFS {
private readonly _rootDir;
private readonly _files;
constructor({ rootDir, files }: {
rootDir: Config.Path;
files: FileData;
});
getModuleName(file: Config.Path): string | null;
getSize(file: Config.Path): number | null;
getDependencies(file: Config.Path): Array<string> | null;
getSha1(file: Config.Path): string | null;
exists(file: Config.Path): boolean;
getAllFiles(): Array<Config.Path>;
getFileIterator(): Iterable<Config.Path>;
getAbsoluteFileIterator(): Iterable<Config.Path>;
matchFiles(pattern: RegExp | string): Array<Config.Path>;
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 Normal file
View File

@@ -0,0 +1 @@
{"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"}

193
node_modules/jest-haste-map/build/HasteFS.js generated vendored Normal file
View File

@@ -0,0 +1,193 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _micromatch() {
const data = _interopRequireDefault(require('micromatch'));
_micromatch = function() {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function() {
return data;
};
return data;
}
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;
}
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};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class HasteFS {
constructor({rootDir, files}) {
_defineProperty(this, '_rootDir', void 0);
_defineProperty(this, '_files', void 0);
this._rootDir = rootDir;
this._files = files;
}
getModuleName(file) {
const fileMetadata = this._getFileData(file);
return (fileMetadata && fileMetadata[_constants.default.ID]) || null;
}
getSize(file) {
const fileMetadata = this._getFileData(file);
return (fileMetadata && fileMetadata[_constants.default.SIZE]) || null;
}
getDependencies(file) {
const fileMetadata = this._getFileData(file);
if (fileMetadata) {
return fileMetadata[_constants.default.DEPENDENCIES]
? fileMetadata[_constants.default.DEPENDENCIES].split(
_constants.default.DEPENDENCY_DELIM
)
: [];
} else {
return null;
}
}
getSha1(file) {
const fileMetadata = this._getFileData(file);
return (fileMetadata && fileMetadata[_constants.default.SHA1]) || null;
}
exists(file) {
return this._getFileData(file) != null;
}
getAllFiles() {
return Array.from(this.getAbsoluteFileIterator());
}
getFileIterator() {
return this._files.keys();
}
*getAbsoluteFileIterator() {
for (const file of this.getFileIterator()) {
yield fastPath.resolve(this._rootDir, file);
}
}
matchFiles(pattern) {
if (!(pattern instanceof RegExp)) {
pattern = new RegExp(pattern);
}
const files = [];
for (const file of this.getAbsoluteFileIterator()) {
if (pattern.test(file)) {
files.push(file);
}
}
return files;
}
matchFilesWithGlob(globs, root) {
const files = new Set();
for (const file of this.getAbsoluteFileIterator()) {
const filePath = root ? fastPath.relative(root, file) : file;
if (
(0, _micromatch().default)(
[(0, _jestUtil().replacePathSepForGlob)(filePath)],
globs
).length > 0
) {
files.add(file);
}
}
return files;
}
_getFileData(file) {
const relativePath = fastPath.relative(this._rootDir, file);
return this._files.get(relativePath);
}
}
exports.default = HasteFS;

49
node_modules/jest-haste-map/build/ModuleMap.d.ts generated vendored Normal file
View File

@@ -0,0 +1,49 @@
/**
* 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.
*/
import { Config } from '@jest/types';
import { 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]]]]>;
map: ReadonlyArray<[string, ValueType<ModuleMapData>]>;
mocks: ReadonlyArray<[string, ValueType<MockData>]>;
rootDir: Config.Path;
};
export default class ModuleMap {
static DuplicateHasteCandidatesError: typeof DuplicateHasteCandidatesError;
private readonly _raw;
private json;
private static mapToArrayRecursive;
private static mapFromArrayRecursive;
constructor(raw: RawModuleMap);
getModule(name: string, platform?: string | null, supportsNativePlatform?: boolean | null, type?: HTypeValue | null): Config.Path | null;
getPackage(name: string, platform: string | null | undefined, _supportsNativePlatform: boolean | null): Config.Path | null;
getMockModule(name: string): Config.Path | undefined;
getRawModuleMap(): RawModuleMap;
toJSON(): SerializableModuleMap;
static fromJSON(serializableModuleMap: SerializableModuleMap): ModuleMap;
/**
* When looking up a module's data, we walk through each eligible platform for
* the query. For each platform, we want to check if there are known
* duplicates for that name+platform pair. The duplication logic normally
* removes elements from the `map` object, but we want to check upfront to be
* extra sure. If metadata exists both in the `duplicates` object and the
* `map`, this would be a bug.
*/
private _getModuleMetadata;
private _assertNoDuplicates;
static create(rootDir: Config.Path): ModuleMap;
}
declare class DuplicateHasteCandidatesError extends Error {
hasteName: string;
platform: string | null;
supportsNativePlatform: boolean;
duplicatesSet: DuplicatesSet;
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 Normal file
View File

@@ -0,0 +1 @@
{"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,EACV,QAAQ,EACR,aAAa,EAEb,YAAY,EACb,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"}

305
node_modules/jest-haste-map/build/ModuleMap.js generated vendored Normal file
View File

@@ -0,0 +1,305 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
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};
}
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, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
const EMPTY_OBJ = {};
const EMPTY_MAP = new Map();
class ModuleMap {
static mapToArrayRecursive(map) {
let arr = Array.from(map);
if (arr[0] && arr[0][1] instanceof Map) {
arr = arr.map(el => [el[0], this.mapToArrayRecursive(el[1])]);
}
return arr;
}
static mapFromArrayRecursive(arr) {
if (arr[0] && Array.isArray(arr[1])) {
arr = arr.map(el => [el[0], this.mapFromArrayRecursive(el[1])]);
}
return new Map(arr);
}
constructor(raw) {
_defineProperty(this, '_raw', void 0);
_defineProperty(this, 'json', void 0);
this._raw = raw;
}
getModule(name, platform, supportsNativePlatform, type) {
if (type == null) {
type = _constants.default.MODULE;
}
const module = this._getModuleMetadata(
name,
platform,
!!supportsNativePlatform
);
if (module && module[_constants.default.TYPE] === type) {
const modulePath = module[_constants.default.PATH];
return modulePath && fastPath.resolve(this._raw.rootDir, modulePath);
}
return null;
}
getPackage(name, platform, _supportsNativePlatform) {
return this.getModule(name, platform, null, _constants.default.PACKAGE);
}
getMockModule(name) {
const mockPath =
this._raw.mocks.get(name) || this._raw.mocks.get(name + '/index');
return mockPath && fastPath.resolve(this._raw.rootDir, mockPath);
}
getRawModuleMap() {
return {
duplicates: this._raw.duplicates,
map: this._raw.map,
mocks: this._raw.mocks,
rootDir: this._raw.rootDir
};
}
toJSON() {
if (!this.json) {
this.json = {
duplicates: ModuleMap.mapToArrayRecursive(this._raw.duplicates),
map: Array.from(this._raw.map),
mocks: Array.from(this._raw.mocks),
rootDir: this._raw.rootDir
};
}
return this.json;
}
static fromJSON(serializableModuleMap) {
return new ModuleMap({
duplicates: ModuleMap.mapFromArrayRecursive(
serializableModuleMap.duplicates
),
map: new Map(serializableModuleMap.map),
mocks: new Map(serializableModuleMap.mocks),
rootDir: serializableModuleMap.rootDir
});
}
/**
* When looking up a module's data, we walk through each eligible platform for
* the query. For each platform, we want to check if there are known
* duplicates for that name+platform pair. The duplication logic normally
* removes elements from the `map` object, but we want to check upfront to be
* extra sure. If metadata exists both in the `duplicates` object and the
* `map`, this would be a bug.
*/
_getModuleMetadata(name, platform, supportsNativePlatform) {
const map = this._raw.map.get(name) || EMPTY_OBJ;
const dupMap = this._raw.duplicates.get(name) || EMPTY_MAP;
if (platform != null) {
this._assertNoDuplicates(
name,
platform,
supportsNativePlatform,
dupMap.get(platform)
);
if (map[platform] != null) {
return map[platform];
}
}
if (supportsNativePlatform) {
this._assertNoDuplicates(
name,
_constants.default.NATIVE_PLATFORM,
supportsNativePlatform,
dupMap.get(_constants.default.NATIVE_PLATFORM)
);
if (map[_constants.default.NATIVE_PLATFORM]) {
return map[_constants.default.NATIVE_PLATFORM];
}
}
this._assertNoDuplicates(
name,
_constants.default.GENERIC_PLATFORM,
supportsNativePlatform,
dupMap.get(_constants.default.GENERIC_PLATFORM)
);
if (map[_constants.default.GENERIC_PLATFORM]) {
return map[_constants.default.GENERIC_PLATFORM];
}
return null;
}
_assertNoDuplicates(name, platform, supportsNativePlatform, relativePathSet) {
if (relativePathSet == null) {
return;
} // Force flow refinement
const previousSet = relativePathSet;
const duplicates = new Map();
for (const [relativePath, type] of previousSet) {
const duplicatePath = fastPath.resolve(this._raw.rootDir, relativePath);
duplicates.set(duplicatePath, type);
}
throw new DuplicateHasteCandidatesError(
name,
platform,
supportsNativePlatform,
duplicates
);
}
static create(rootDir) {
return new ModuleMap({
duplicates: new Map(),
map: new Map(),
mocks: new Map(),
rootDir
});
}
}
exports.default = ModuleMap;
_defineProperty(ModuleMap, 'DuplicateHasteCandidatesError', void 0);
class DuplicateHasteCandidatesError extends Error {
constructor(name, platform, supportsNativePlatform, duplicatesSet) {
const platformMessage = getPlatformMessage(platform);
super(
`The name \`${name}\` was looked up in the Haste module map. It ` +
`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` +
Array.from(duplicatesSet)
.map(
([dupFilePath, dupFileType]) =>
` * \`${dupFilePath}\` (${getTypeMessage(dupFileType)})\n`
)
.sort()
.join('')
);
_defineProperty(this, 'hasteName', void 0);
_defineProperty(this, 'platform', void 0);
_defineProperty(this, 'supportsNativePlatform', void 0);
_defineProperty(this, 'duplicatesSet', void 0);
this.hasteName = name;
this.platform = platform;
this.supportsNativePlatform = supportsNativePlatform;
this.duplicatesSet = duplicatesSet;
}
}
function getPlatformMessage(platform) {
if (platform === _constants.default.GENERIC_PLATFORM) {
return 'The platform is generic (no extension).';
}
return `The platform extension is \`${platform}\`.`;
}
function getTypeMessage(type) {
switch (type) {
case _constants.default.MODULE:
return 'module';
case _constants.default.PACKAGE:
return 'package';
}
return 'unknown';
}
ModuleMap.DuplicateHasteCandidatesError = DuplicateHasteCandidatesError;

9
node_modules/jest-haste-map/build/blacklist.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
* 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.
*/
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 Normal file
View File

@@ -0,0 +1 @@
{"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"}

59
node_modules/jest-haste-map/build/blacklist.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
/**
* 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.
*/
// This list is compiled after the MDN list of the most common MIME types (see
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/
// Complete_list_of_MIME_types).
//
// Only MIME types starting with "image/", "video/", "audio/" and "font/" are
// 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.
'.bmp',
'.gif',
'.ico',
'.jpeg',
'.jpg',
'.png',
'.svg',
'.tiff',
'.tif',
'.webp', // Video extensions.
'.avi',
'.mp4',
'.mpeg',
'.mpg',
'.ogv',
'.webm',
'.3gp',
'.3g2', // Audio extensions.
'.aac',
'.midi',
'.mid',
'.mp3',
'.oga',
'.wav',
'.3gp',
'.3g2', // Font extensions.
'.eot',
'.otf',
'.ttf',
'.woff',
'.woff2'
]);
var _default = extensions;
exports.default = _default;

10
node_modules/jest-haste-map/build/constants.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* 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.
*/
import { 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 Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAG9B,QAAA,MAAM,SAAS,EAAE,KAuBhB,CAAC;AAGF,eAAe,SAAS,CAAC"}

52
node_modules/jest-haste-map/build/constants.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
/**
* 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.
*/
/*
* 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
* large to the point where it is the largest overhead in starting up Jest.
*
* 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',
/* file map attributes */
ID: 0,
MTIME: 1,
SIZE: 2,
VISITED: 3,
DEPENDENCIES: 4,
SHA1: 5,
/* module map attributes */
PATH: 0,
TYPE: 1,
/* module types */
MODULE: 0,
PACKAGE: 1,
/* platforms */
GENERIC_PLATFORM: 'g',
NATIVE_PLATFORM: 'native'
};
/* eslint-enable */
var _default = constants;
exports.default = _default;

13
node_modules/jest-haste-map/build/crawlers/node.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/**
* 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.
*/
import { CrawlerOptions, FileData, InternalHasteMap } from '../types';
declare const _default: (options: CrawlerOptions) => Promise<{
removedFiles: FileData;
hasteMap: InternalHasteMap;
}>;
export = _default;
//# sourceMappingURL=node.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/crawlers/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,EACL,cAAc,EACd,QAAQ,EAER,gBAAgB,EACjB,MAAM,UAAU,CAAC;;;;;AAsHlB,kBA6CE"}

264
node_modules/jest-haste-map/build/crawlers/node.js generated vendored Normal file
View File

@@ -0,0 +1,264 @@
'use strict';
function fs() {
const data = _interopRequireWildcard(require('fs'));
fs = function() {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require('path'));
path = function() {
return data;
};
return data;
}
function _child_process() {
const data = require('child_process');
_child_process = 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 _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;
}
/**
* 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.
*/
function find(roots, extensions, ignore, callback) {
const result = [];
let activeCalls = 0;
function search(directory) {
activeCalls++;
fs().readdir(directory, (err, names) => {
activeCalls--;
if (err) {
callback(result);
return;
}
names.forEach(file => {
file = path().join(directory, file);
if (ignore(file)) {
return;
}
activeCalls++;
fs().lstat(file, (err, stat) => {
activeCalls--;
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) {
roots.forEach(search);
} else {
callback(result);
}
}
function findNative(roots, extensions, ignore, callback) {
const args = Array.from(roots);
args.push('-type', 'f');
if (extensions.length) {
args.push('(');
}
extensions.forEach((ext, index) => {
if (index) {
args.push('-o');
}
args.push('-iname');
args.push('*.' + ext);
});
if (extensions.length) {
args.push(')');
}
const child = (0, _child_process().spawn)('find', args);
let stdout = '';
if (child.stdout === null) {
throw new Error(
'stdout is null - this should never happen. Please open up an issue at https://github.com/facebook/jest'
);
}
child.stdout.setEncoding('utf-8');
child.stdout.on('data', data => (stdout += data));
child.stdout.on('close', () => {
const lines = stdout
.trim()
.split('\n')
.filter(x => !ignore(x));
const result = [];
let count = lines.length;
if (!count) {
callback([]);
} else {
lines.forEach(path => {
fs().stat(path, (err, stat) => {
if (!err && stat) {
result.push([path, stat.mtime.getTime(), stat.size]);
}
if (--count === 0) {
callback(result);
}
});
});
}
});
}
module.exports = function nodeCrawl(options) {
const {
data,
extensions,
forceNodeFilesystemAPI,
ignore,
rootDir,
roots
} = options;
return new Promise(resolve => {
const callback = list => {
const files = new Map();
const removedFiles = new Map(data.files);
list.forEach(fileData => {
const [filePath, mtime, size] = fileData;
const relativeFilePath = fastPath().relative(rootDir, filePath);
const existingFile = data.files.get(relativeFilePath);
if (
existingFile &&
existingFile[_constants().default.MTIME] === mtime
) {
files.set(relativeFilePath, existingFile);
} else {
// See ../constants.js; SHA-1 will always be null and fulfilled later.
files.set(relativeFilePath, ['', mtime, size, 0, '', null]);
}
removedFiles.delete(relativeFilePath);
});
data.files = files;
resolve({
hasteMap: data,
removedFiles
});
};
if (forceNodeFilesystemAPI || process.platform === 'win32') {
find(roots, extensions, ignore, callback);
} else {
findNative(roots, extensions, ignore, callback);
}
});
};

View File

@@ -0,0 +1,14 @@
/**
* 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.
*/
import { CrawlerOptions, FileData, InternalHasteMap } from '../types';
declare const _default: (options: CrawlerOptions) => Promise<{
changedFiles?: FileData | undefined;
removedFiles: FileData;
hasteMap: InternalHasteMap;
}>;
export = _default;
//# sourceMappingURL=watchman.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"watchman.d.ts","sourceRoot":"","sources":["../../src/crawlers/watchman.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EACL,cAAc,EACd,QAAQ,EAER,gBAAgB,EACjB,MAAM,UAAU,CAAC;;;;;;AAclB,kBAwOE"}

342
node_modules/jest-haste-map/build/crawlers/watchman.js generated vendored Normal file
View File

@@ -0,0 +1,342 @@
'use strict';
function path() {
const data = _interopRequireWildcard(require('path'));
path = function() {
return data;
};
return data;
}
function _fbWatchman() {
const data = _interopRequireDefault(require('fb-watchman'));
_fbWatchman = function() {
return data;
};
return data;
}
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 _constants() {
const data = _interopRequireDefault(require('../constants'));
_constants = 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;
}
/**
* 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.html';
function WatchmanError(error) {
error.message =
`Watchman error: ${error.message.trim()}. Make sure watchman ` +
`is running for this project. See ${watchmanURL}.`;
return error;
}
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)
)
);
if (options.computeSha1) {
const {capabilities} = await cmd('list-capabilities');
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;
}
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 = [];
if (directoryFilters.length > 0) {
expression.push([
'anyof',
...directoryFilters.map(dir => ['dirname', dir])
]);
for (const directory of directoryFilters) {
for (const extension of extensions) {
glob.push(`${directory}/**/*.${extension}`);
}
}
} else {
for (const extension of extensions) {
glob.push(`**/*.${extension}`);
}
}
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 = await 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 {
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;
}
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];
}
const mappings = options.mapper ? options.mapper(filePath) : null;
if (mappings) {
for (const absoluteVirtualFilePath of mappings) {
if (!ignore(absoluteVirtualFilePath)) {
const relativeVirtualFilePath = fastPath().relative(
rootDir,
absoluteVirtualFilePath
);
files.set(relativeVirtualFilePath, nextData);
changedFiles.set(relativeVirtualFilePath, nextData);
}
}
} else {
files.set(relativeFilePath, nextData);
changedFiles.set(relativeFilePath, nextData);
}
}
}
}
data.files = files;
return {
changedFiles: isFresh ? undefined : changedFiles,
hasteMap: data,
removedFiles
};
};

9
node_modules/jest-haste-map/build/getMockName.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
* 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.
*/
declare const getMockName: (filePath: string) => string;
export default getMockName;
//# sourceMappingURL=getMockName.d.ts.map

View File

@@ -0,0 +1 @@
{"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"}

76
node_modules/jest-haste-map/build/getMockName.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function path() {
const data = _interopRequireWildcard(require('path'));
path = 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;
}
/**
* 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 MOCKS_PATTERN = path().sep + '__mocks__' + path().sep;
const getMockName = filePath => {
const mockPath = filePath.split(MOCKS_PATTERN)[1];
return mockPath
.substring(0, mockPath.lastIndexOf(path().extname(mockPath)))
.replace(/\\/g, '/');
};
var _default = getMockName;
exports.default = _default;

192
node_modules/jest-haste-map/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,192 @@
/**
* 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.
*/
/// <reference types="node" />
import { EventEmitter } from 'events';
import { Config } from '@jest/types';
import H from './constants';
import HasteFS from './HasteFS';
import HasteModuleMap, { SerializableModuleMap as HasteSerializableModuleMap } from './ModuleMap';
import { ChangeEvent, HasteRegExp, InternalHasteMap, HasteMap as InternalHasteMapObject, Mapper } from './types';
declare type HType = typeof H;
declare type Options = {
cacheDirectory?: string;
computeDependencies?: boolean;
computeSha1?: boolean;
console?: Console;
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;
roots: Array<string>;
skipPackageJson?: boolean;
throwOnModuleCollision?: boolean;
useWatchman?: boolean;
watch?: boolean;
};
declare namespace HasteMap {
type ModuleMap = HasteModuleMap;
type SerializableModuleMap = HasteSerializableModuleMap;
type FS = HasteFS;
type HasteMapObject = InternalHasteMapObject;
type HasteChangeEvent = ChangeEvent;
}
/**
* HasteMap is a JavaScript implementation of Facebook's haste module system.
*
* This implementation is inspired by https://github.com/facebook/node-haste
* and was built with for high-performance in large code repositories with
* hundreds of thousands of files. This implementation is scalable and provides
* predictable performance.
*
* Because the haste map creation and synchronization is critical to startup
* performance and most tasks are blocked by I/O this class makes heavy use of
* synchronous operations. It uses worker processes for parallelizing file
* access and metadata extraction.
*
* The data structures created by `jest-haste-map` can be used directly from the
* cache without further processing. The metadata objects in the `files` and
* `map` objects contain cross-references: a metadata object from one can look
* up the corresponding metadata object in the other map. Note that in most
* projects, the number of files will be greater than the number of haste
* modules one module can refer to many files based on platform extensions.
*
* type HasteMap = {
* clocks: WatchmanClocks,
* files: {[filepath: string]: FileMetaData},
* map: {[id: string]: ModuleMapItem},
* mocks: {[id: string]: string},
* }
*
* // Watchman clocks are used for query synchronization and file system deltas.
* type WatchmanClocks = {[filepath: string]: string};
*
* type FileMetaData = {
* id: ?string, // used to look up module metadata objects in `map`.
* mtime: number, // check for outdated files.
* size: number, // size of the file in bytes.
* visited: boolean, // whether the file has been parsed or not.
* dependencies: Array<string>, // all relative dependencies of this file.
* sha1: ?string, // SHA-1 of the file, if requested via options.
* };
*
* // Modules can be targeted to a specific platform based on the file name.
* // Example: platform.ios.js and Platform.android.js will both map to the same
* // `Platform` module. The platform should be specified during resolution.
* type ModuleMapItem = {[platform: string]: ModuleMetaData};
*
* //
* type ModuleMetaData = {
* path: string, // the path to look up the file object in `files`.
* type: string, // the module type (either `package` or `module`).
* };
*
* Note that the data structures described above are conceptual only. The actual
* implementation uses arrays and constant keys for metadata storage. Instead of
* `{id: 'flatMap', mtime: 3421, size: 42, visited: true, dependencies: []}` the real
* representation is similar to `['flatMap', 3421, 42, 1, []]` to save storage space
* and reduce parse and write time of a big JSON blob.
*
* The HasteMap is created as follows:
* 1. read data from the cache or create an empty structure.
*
* 2. crawl the file system.
* * empty cache: crawl the entire file system.
* * cache available:
* * if watchman is available: get file system delta changes.
* * if watchman is unavailable: crawl the entire file system.
* * build metadata objects for every file. This builds the `files` part of
* the `HasteMap`.
*
* 3. parse and extract metadata from changed files.
* * this is done in parallel over worker processes to improve performance.
* * the worst case is to parse all files.
* * the best case is no file system access and retrieving all data from
* the cache.
* * the average case is a small number of changed files.
*
* 4. serialize the new `HasteMap` in a cache file.
* Worker processes can directly access the cache through `HasteMap.read()`.
*
*/
declare class HasteMap extends EventEmitter {
private _buildPromise;
private _cachePath;
private _changeInterval?;
private _console;
private _options;
private _watchers;
private _whitelist;
private _worker;
constructor(options: Options);
static getCacheFilePath(tmpdir: Config.Path, name: string, ...extra: Array<string>): string;
getCacheFilePath(): string;
build(): Promise<InternalHasteMapObject>;
/**
* 1. read data from the cache or create an empty structure.
*/
read(): InternalHasteMap;
readModuleMap(): HasteModuleMap;
/**
* 2. crawl the file system.
*/
private _buildFileMap;
/**
* 3. parse and extract metadata from changed files.
*/
private _processFile;
private _buildHasteMap;
private _cleanup;
/**
* 4. serialize the new `HasteMap` in a cache file.
*/
private _persist;
/**
* Creates workers or parses files and extracts metadata in-process.
*/
private _getWorker;
private _crawl;
/**
* Watch mode
*/
private _watch;
/**
* This function should be called when the file under `filePath` is removed
* or changed. When that happens, we want to figure out if that file was
* part of a group of files that had the same ID. If it was, we want to
* remove it from the group. Furthermore, if there is only one file
* remaining in the group, then we want to restore that single file as the
* correct resolution for its ID, and cleanup the duplicates index.
*/
private _recoverDuplicates;
end(): Promise<void>;
/**
* Helpers
*/
private _ignore;
private _isNodeModulesDir;
private _createEmptyMap;
static H: HType;
static DuplicateError: typeof DuplicateError;
static ModuleMap: typeof HasteModuleMap;
}
declare class DuplicateError extends Error {
mockPath1: string;
mockPath2: string;
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 Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}

1256
node_modules/jest-haste-map/build/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,45 @@
/**
* 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.
*
*/
/// <reference types="node" />
import { EventEmitter } from 'events';
import { Matcher } from 'anymatch';
/**
* Export `FSEventsWatcher` class.
* Watches `dir`.
*/
declare class FSEventsWatcher extends EventEmitter {
readonly root: string;
readonly ignored?: Matcher;
readonly glob: Array<string>;
readonly dot: boolean;
readonly hasIgnore: boolean;
readonly doIgnore: (path: string) => boolean;
readonly fsEventsWatchStopper: () => Promise<void>;
private _tracked;
static isSupported(): boolean;
private static normalizeProxy;
private static recReaddir;
constructor(dir: string, opts: {
root: string;
ignored?: Matcher;
glob: string | Array<string>;
dot: boolean;
});
/**
* End watching.
*/
close(callback?: () => void): void;
private isFileIncluded;
private handleEvent;
/**
* Emit events.
*/
private _emit;
}
export = FSEventsWatcher;
//# sourceMappingURL=FSEventsWatcher.d.ts.map

View File

@@ -0,0 +1 @@
{"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,OAAiB,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAwB3C;;;GAGG;AACH,cAAM,eAAgB,SAAQ,YAAY;IACxC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClC,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,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,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,OAAO,CAAC;QAClB,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,GAAG,EAAE,OAAO,CAAC;KACd;IAuCH;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI;IAS3B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,WAAW;IAgCnB;;OAEG;IACH,OAAO,CAAC,KAAK;CAId;AAED,SAAS,eAAe,CAAC"}

View File

@@ -0,0 +1,294 @@
'use strict';
function fs() {
const data = _interopRequireWildcard(require('fs'));
fs = function() {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require('path'));
path = function() {
return data;
};
return data;
}
function _events() {
const data = require('events');
_events = function() {
return data;
};
return data;
}
function _anymatch() {
const data = _interopRequireDefault(require('anymatch'));
_anymatch = function() {
return data;
};
return data;
}
function _micromatch() {
const data = _interopRequireDefault(require('micromatch'));
_micromatch = function() {
return data;
};
return data;
}
function _walker() {
const data = _interopRequireDefault(require('walker'));
_walker = 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;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
// @ts-ignore: this is for CI which runs linux and might not have this
let fsevents = null;
try {
fsevents = require('fsevents');
} catch (e) {
// Optional dependency, only supported on Darwin.
}
const CHANGE_EVENT = 'change';
const DELETE_EVENT = 'delete';
const ADD_EVENT = 'add';
const ALL_EVENT = 'all';
/**
* Export `FSEventsWatcher` class.
* Watches `dir`.
*/
class FSEventsWatcher extends _events().EventEmitter {
static isSupported() {
return fsevents !== null;
}
static normalizeProxy(callback) {
return (filepath, stats) => callback(path().normalize(filepath), stats);
}
static recReaddir(
dir,
dirCallback,
fileCallback,
endCallback,
errorCallback,
ignored
) {
(0, _walker().default)(dir)
.filterDir(
currentDir => !ignored || !(0, _anymatch().default)(ignored, currentDir)
)
.on('dir', FSEventsWatcher.normalizeProxy(dirCallback))
.on('file', FSEventsWatcher.normalizeProxy(fileCallback))
.on('error', errorCallback)
.on('end', () => {
endCallback();
});
}
constructor(dir, opts) {
if (!fsevents) {
throw new Error(
'`fsevents` unavailable (this watcher can only be used on Darwin)'
);
}
super();
_defineProperty(this, 'root', void 0);
_defineProperty(this, 'ignored', void 0);
_defineProperty(this, 'glob', void 0);
_defineProperty(this, 'dot', void 0);
_defineProperty(this, 'hasIgnore', void 0);
_defineProperty(this, 'doIgnore', void 0);
_defineProperty(this, 'fsEventsWatchStopper', void 0);
_defineProperty(this, '_tracked', void 0);
this.dot = opts.dot || false;
this.ignored = opts.ignored;
this.glob = Array.isArray(opts.glob) ? opts.glob : [opts.glob];
this.hasIgnore =
Boolean(opts.ignored) && !(Array.isArray(opts) && opts.length > 0);
this.doIgnore = opts.ignored
? (0, _anymatch().default)(opts.ignored)
: () => false;
this.root = path().resolve(dir);
this.fsEventsWatchStopper = fsevents.watch(
this.root,
this.handleEvent.bind(this)
);
this._tracked = new Set();
FSEventsWatcher.recReaddir(
this.root,
filepath => {
this._tracked.add(filepath);
},
filepath => {
this._tracked.add(filepath);
},
this.emit.bind(this, 'ready'),
this.emit.bind(this, 'error'),
this.ignored
);
}
/**
* End watching.
*/
close(callback) {
this.fsEventsWatchStopper().then(() => {
this.removeAllListeners();
if (typeof callback === 'function') {
process.nextTick(callback.bind(null, null, true));
}
});
}
isFileIncluded(relativePath) {
if (this.doIgnore(relativePath)) {
return false;
}
return this.glob.length
? (0, _micromatch().default)([relativePath], this.glob, {
dot: this.dot
}).length > 0
: this.dot ||
(0, _micromatch().default)([relativePath], '**/*').length > 0;
}
handleEvent(filepath) {
const relativePath = path().relative(this.root, filepath);
if (!this.isFileIncluded(relativePath)) {
return;
}
fs().lstat(filepath, (error, stat) => {
if (error && error.code !== 'ENOENT') {
this.emit('error', error);
return;
}
if (error) {
// Ignore files that aren't tracked and don't exist.
if (!this._tracked.has(filepath)) {
return;
}
this._emit(DELETE_EVENT, relativePath);
this._tracked.delete(filepath);
return;
}
if (this._tracked.has(filepath)) {
this._emit(CHANGE_EVENT, relativePath, stat);
} else {
this._tracked.add(filepath);
this._emit(ADD_EVENT, relativePath, stat);
}
});
}
/**
* Emit events.
*/
_emit(type, file, stat) {
this.emit(type, file, this.root, stat);
this.emit(ALL_EVENT, type, file, this.root, stat);
}
}
module.exports = FSEventsWatcher;

View File

@@ -0,0 +1,400 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = WatchmanWatcher;
function _fs() {
const data = _interopRequireDefault(require('fs'));
_fs = function() {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require('path'));
_path = function() {
return data;
};
return data;
}
function _assert() {
const data = _interopRequireDefault(require('assert'));
_assert = function() {
return data;
};
return data;
}
function _events() {
const data = require('events');
_events = function() {
return data;
};
return data;
}
function _fbWatchman() {
const data = _interopRequireDefault(require('fb-watchman'));
_fbWatchman = function() {
return data;
};
return data;
}
function _common() {
const data = _interopRequireDefault(require('sane/src/common'));
_common = function() {
return data;
};
return data;
}
function _recrawlWarningDedupe() {
const data = _interopRequireDefault(
require('sane/src/utils/recrawl-warning-dedupe')
);
_recrawlWarningDedupe = function() {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* 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 CHANGE_EVENT = _common().default.CHANGE_EVENT;
const DELETE_EVENT = _common().default.DELETE_EVENT;
const ADD_EVENT = _common().default.ADD_EVENT;
const ALL_EVENT = _common().default.ALL_EVENT;
const SUB_NAME = 'sane-sub';
/**
* Watches `dir`.
*
* @class PollWatcher
* @param String dir
* @param {Object} opts
* @public
*/
function WatchmanWatcher(dir, opts) {
_common().default.assignOptions(this, opts);
this.root = _path().default.resolve(dir);
this.init();
} // eslint-disable-next-line no-proto
WatchmanWatcher.prototype.__proto__ = _events().EventEmitter.prototype;
/**
* Run the watchman `watch` command on the root and subscribe to changes.
*
* @private
*/
WatchmanWatcher.prototype.init = function() {
if (this.client) {
this.client.removeAllListeners();
}
const self = this;
this.client = new (_fbWatchman().default.Client)();
this.client.on('error', error => {
self.emit('error', error);
});
this.client.on('subscription', this.handleChangeEvent.bind(this));
this.client.on('end', () => {
console.warn('[sane] Warning: Lost connection to watchman, reconnecting..');
self.init();
});
this.watchProjectInfo = null;
function getWatchRoot() {
return self.watchProjectInfo ? self.watchProjectInfo.root : self.root;
}
function onCapability(error, resp) {
if (handleError(self, error)) {
// The Watchman watcher is unusable on this system, we cannot continue
return;
}
handleWarning(resp);
self.capabilities = resp.capabilities;
if (self.capabilities.relative_root) {
self.client.command(['watch-project', getWatchRoot()], onWatchProject);
} else {
self.client.command(['watch', getWatchRoot()], onWatch);
}
}
function onWatchProject(error, resp) {
if (handleError(self, error)) {
return;
}
handleWarning(resp);
self.watchProjectInfo = {
relativePath: resp.relative_path ? resp.relative_path : '',
root: resp.watch
};
self.client.command(['clock', getWatchRoot()], onClock);
}
function onWatch(error, resp) {
if (handleError(self, error)) {
return;
}
handleWarning(resp);
self.client.command(['clock', getWatchRoot()], onClock);
}
function onClock(error, resp) {
if (handleError(self, error)) {
return;
}
handleWarning(resp);
const options = {
fields: ['name', 'exists', 'new'],
since: resp.clock
}; // If the server has the wildmatch capability available it supports
// the recursive **/*.foo style match and we can offload our globs
// to the watchman server. This saves both on data size to be
// communicated back to us and compute for evaluating the globs
// in our node process.
if (self.capabilities.wildmatch) {
if (self.globs.length === 0) {
if (!self.dot) {
// Make sure we honor the dot option if even we're not using globs.
options.expression = [
'match',
'**',
'wholename',
{
includedotfiles: false
}
];
}
} else {
options.expression = ['anyof'];
for (const i in self.globs) {
options.expression.push([
'match',
self.globs[i],
'wholename',
{
includedotfiles: self.dot
}
]);
}
}
}
if (self.capabilities.relative_root) {
options.relative_root = self.watchProjectInfo.relativePath;
}
self.client.command(
['subscribe', getWatchRoot(), SUB_NAME, options],
onSubscribe
);
}
function onSubscribe(error, resp) {
if (handleError(self, error)) {
return;
}
handleWarning(resp);
self.emit('ready');
}
self.client.capabilityCheck(
{
optional: ['wildmatch', 'relative_root']
},
onCapability
);
};
/**
* Handles a change event coming from the subscription.
*
* @param {Object} resp
* @private
*/
WatchmanWatcher.prototype.handleChangeEvent = function(resp) {
_assert().default.equal(
resp.subscription,
SUB_NAME,
'Invalid subscription event.'
);
if (resp.is_fresh_instance) {
this.emit('fresh_instance');
}
if (resp.is_fresh_instance) {
this.emit('fresh_instance');
}
if (Array.isArray(resp.files)) {
resp.files.forEach(this.handleFileChange, this);
}
};
/**
* Handles a single change event record.
*
* @param {Object} changeDescriptor
* @private
*/
WatchmanWatcher.prototype.handleFileChange = function(changeDescriptor) {
const self = this;
let absPath;
let relativePath;
if (this.capabilities.relative_root) {
relativePath = changeDescriptor.name;
absPath = _path().default.join(
this.watchProjectInfo.root,
this.watchProjectInfo.relativePath,
relativePath
);
} else {
absPath = _path().default.join(this.root, changeDescriptor.name);
relativePath = changeDescriptor.name;
}
if (
!(self.capabilities.wildmatch && !this.hasIgnore) &&
!_common().default.isFileIncluded(
this.globs,
this.dot,
this.doIgnore,
relativePath
)
) {
return;
}
if (!changeDescriptor.exists) {
self.emitEvent(DELETE_EVENT, relativePath, self.root);
} else {
_fs().default.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') {
return;
}
if (handleError(self, error)) {
return;
}
const eventType = changeDescriptor.new ? ADD_EVENT : CHANGE_EVENT; // Change event on dirs are mostly useless.
if (!(eventType === CHANGE_EVENT && stat.isDirectory())) {
self.emitEvent(eventType, relativePath, self.root, stat);
}
});
}
};
/**
* Dispatches the event.
*
* @param {string} eventType
* @param {string} filepath
* @param {string} root
* @param {fs.Stat} stat
* @private
*/
WatchmanWatcher.prototype.emitEvent = function(
eventType,
filepath,
root,
stat
) {
this.emit(eventType, filepath, root, stat);
this.emit(ALL_EVENT, eventType, filepath, root, stat);
};
/**
* Closes the watcher.
*
* @param {function} callback
* @private
*/
WatchmanWatcher.prototype.close = function(callback) {
this.client.removeAllListeners();
this.client.end();
callback && callback(null, true);
};
/**
* Handles an error and returns true if exists.
*
* @param {WatchmanWatcher} self
* @param {Error} error
* @private
*/
function handleError(self, error) {
if (error != null) {
self.emit('error', error);
return true;
} else {
return false;
}
}
/**
* Handles a warning in the watchman resp object.
*
* @param {object} resp
* @private
*/
function handleWarning(resp) {
if ('warning' in resp) {
if (_recrawlWarningDedupe().default.isRecrawlWarningDupe(resp.warning)) {
return true;
}
console.warn(resp.warning);
return true;
} else {
return false;
}
}

View File

@@ -0,0 +1,8 @@
/**
* 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.
*/
export declare function extract(code: string): Set<string>;
//# sourceMappingURL=dependencyExtractor.d.ts.map

View File

@@ -0,0 +1 @@
{"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"}

View File

@@ -0,0 +1,100 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.extract = extract;
var _isRegExpSupported = _interopRequireDefault(require('./isRegExpSupported'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* 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.
*/
// Negative look behind is only supported in Node 9+
const NOT_A_DOT = (0, _isRegExpSupported.default)('(?<!\\.\\s*)')
? '(?<!\\.\\s*)'
: '(?:^|[^.]\\s*)';
const CAPTURE_STRING_LITERAL = pos => `([\`'"])([^'"\`]*?)(?:\\${pos})`;
const WORD_SEPARATOR = '\\b';
const LEFT_PARENTHESIS = '\\(';
const RIGHT_PARENTHESIS = '\\)';
const WHITESPACE = '\\s*';
const OPTIONAL_COMMA = '(:?,\\s*)?';
function createRegExp(parts, flags) {
return new RegExp(parts.join(''), flags);
}
function alternatives(...parts) {
return `(?:${parts.join('|')})`;
}
function functionCallStart(...names) {
return [
NOT_A_DOT,
WORD_SEPARATOR,
alternatives(...names),
WHITESPACE,
LEFT_PARENTHESIS,
WHITESPACE
];
}
const BLOCK_COMMENT_RE = /\/\*[^]*?\*\//g;
const LINE_COMMENT_RE = /\/\/.*/g;
const REQUIRE_OR_DYNAMIC_IMPORT_RE = createRegExp(
[
...functionCallStart('require', 'import'),
CAPTURE_STRING_LITERAL(1),
WHITESPACE,
OPTIONAL_COMMA,
RIGHT_PARENTHESIS
],
'g'
);
const IMPORT_OR_EXPORT_RE = createRegExp(
[
'\\b(?:import|export)\\s+(?!type(?:of)?\\s+)(?:[^\'"]+\\s+from\\s+)?',
CAPTURE_STRING_LITERAL(1)
],
'g'
);
const JEST_EXTENSIONS_RE = createRegExp(
[
...functionCallStart(
'require\\s*\\.\\s*(?:requireActual|requireMock)',
'jest\\s*\\.\\s*(?:requireActual|requireMock|genMockFromModule)'
),
CAPTURE_STRING_LITERAL(1),
WHITESPACE,
OPTIONAL_COMMA,
RIGHT_PARENTHESIS
],
'g'
);
function extract(code) {
const dependencies = new Set();
const addDependency = (match, _, dep) => {
dependencies.add(dep);
return match;
};
code
.replace(BLOCK_COMMENT_RE, '')
.replace(LINE_COMMENT_RE, '')
.replace(IMPORT_OR_EXPORT_RE, addDependency)
.replace(REQUIRE_OR_DYNAMIC_IMPORT_RE, addDependency)
.replace(JEST_EXTENSIONS_RE, addDependency);
return dependencies;
}

9
node_modules/jest-haste-map/build/lib/fast_path.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
* 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.
*/
export declare function relative(rootDir: string, filename: string): string;
export declare function resolve(rootDir: string, relativeFilename: string): string;
//# sourceMappingURL=fast_path.d.ts.map

View File

@@ -0,0 +1 @@
{"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"}

81
node_modules/jest-haste-map/build/lib/fast_path.js generated vendored Normal file
View File

@@ -0,0 +1,81 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.relative = relative;
exports.resolve = resolve;
function path() {
const data = _interopRequireWildcard(require('path'));
path = 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;
}
/**
* 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.
*/
// rootDir and filename must be absolute paths (resolved)
function relative(rootDir, filename) {
return filename.indexOf(rootDir + path().sep) === 0
? filename.substr(rootDir.length + 1)
: path().relative(rootDir, filename);
}
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().resolve(rootDir, relativeFilename)
: rootDir + path().sep + relativeFilename;
}

View File

@@ -0,0 +1,8 @@
/**
* 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.
*/
export default function getPlatformExtension(file: string, platforms?: Array<string>): string | null;
//# sourceMappingURL=getPlatformExtension.d.ts.map

View File

@@ -0,0 +1 @@
{"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"}

View File

@@ -0,0 +1,31 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getPlatformExtension;
/**
* 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 SUPPORTED_PLATFORM_EXTS = new Set(['android', 'ios', 'native', 'web']); // Extract platform extension: index.ios.js -> ios
function getPlatformExtension(file, platforms) {
const last = file.lastIndexOf('.');
const secondToLast = file.lastIndexOf('.', last - 1);
if (secondToLast === -1) {
return null;
}
const platform = file.substring(secondToLast + 1, last); // If an overriding platform array is passed, check that first
if (platforms && platforms.indexOf(platform) !== -1) {
return platform;
}
return SUPPORTED_PLATFORM_EXTS.has(platform) ? platform : null;
}

View File

@@ -0,0 +1,8 @@
/**
* 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.
*/
export default function isRegExpSupported(value: string): boolean;
//# sourceMappingURL=isRegExpSupported.d.ts.map

View File

@@ -0,0 +1 @@
{"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"}

View File

@@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = isRegExpSupported;
/**
* 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.
*/
function isRegExpSupported(value) {
try {
// eslint-disable-next-line no-new
new RegExp(value);
return true;
} catch (e) {
return false;
}
}

View File

@@ -0,0 +1,9 @@
/**
* 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.
*/
declare let normalizePathSep: (string: string) => string;
export default normalizePathSep;
//# sourceMappingURL=normalizePathSep.d.ts.map

View File

@@ -0,0 +1 @@
{"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"}

View File

@@ -0,0 +1,75 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function path() {
const data = _interopRequireWildcard(require('path'));
path = 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;
}
/**
* 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.
*/
let normalizePathSep;
if (path().sep === '/') {
normalizePathSep = filePath => filePath;
} else {
normalizePathSep = filePath => filePath.replace(/\//g, path().sep);
}
var _default = normalizePathSep;
exports.default = _default;

98
node_modules/jest-haste-map/build/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,98 @@
/**
* 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.
*/
/// <reference types="node" />
import * as fs from 'fs';
import { Config } from '@jest/types';
import ModuleMap from './ModuleMap';
import HasteFS from './HasteFS';
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 | null;
rootDir: string;
filePath: string;
hasteImplModulePath?: string;
};
export declare type WorkerMetadata = {
dependencies: Array<string> | undefined | null;
id: string | undefined | null;
module: ModuleMetaData | undefined | null;
sha1: string | undefined | null;
};
export declare type CrawlerOptions = {
computeSha1: boolean;
data: InternalHasteMap;
extensions: Array<string>;
forceNodeFilesystemAPI: boolean;
ignore: IgnoreMatcher;
mapper?: Mapper | null;
rootDir: string;
roots: Array<string>;
};
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 MockData = Map<string, Config.Path>;
export declare type ModuleMapData = Map<string, ModuleMapItem>;
export declare type WatchmanClocks = Map<Config.Path, string>;
export declare type HasteRegExp = RegExp | ((str: string) => boolean);
export declare type DuplicatesSet = Map<string, /* type */ number>;
export declare type DuplicatesIndex = Map<string, Map<string, DuplicatesSet>>;
export declare type InternalHasteMap = {
clocks: WatchmanClocks;
duplicates: DuplicatesIndex;
files: FileData;
map: ModuleMapData;
mocks: MockData;
};
export declare type HasteMap = {
hasteFS: HasteFS;
moduleMap: ModuleMap;
__hasteMapForTest?: InternalHasteMap | null;
};
export declare type RawModuleMap = {
rootDir: Config.Path;
duplicates: DuplicatesIndex;
map: ModuleMapData;
mocks: MockData;
};
declare type ModuleMapItem = {
[platform: string]: ModuleMetaData;
};
export declare type ModuleMetaData = [Config.Path, /* type */ number];
export declare type HType = {
ID: 0;
MTIME: 1;
SIZE: 2;
VISITED: 3;
DEPENDENCIES: 4;
SHA1: 5;
PATH: 0;
TYPE: 1;
MODULE: 0;
PACKAGE: 1;
GENERIC_PLATFORM: 'g';
NATIVE_PLATFORM: 'native';
DEPENDENCY_DELIM: '\0';
};
export declare type HTypeValue = HType[keyof HType];
export declare type EventsQueue = Array<{
filePath: Config.Path;
stat: fs.Stats | undefined;
type: string;
}>;
export declare type ChangeEvent = {
eventsQueue: EventsQueue;
hasteFS: HasteFS;
moduleMap: ModuleMap;
};
export {};
//# sourceMappingURL=types.d.ts.map

1
node_modules/jest-haste-map/build/types.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}

1
node_modules/jest-haste-map/build/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

10
node_modules/jest-haste-map/build/worker.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* 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.
*/
import { 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 Normal file
View File

@@ -0,0 +1 @@
{"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;AAgBjE,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"}

199
node_modules/jest-haste-map/build/worker.js generated vendored Normal file
View File

@@ -0,0 +1,199 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.worker = worker;
exports.getSha1 = getSha1;
function _crypto() {
const data = require('crypto');
_crypto = function() {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require('path'));
path = function() {
return data;
};
return data;
}
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
fs = function() {
return data;
};
return data;
}
var _blacklist = _interopRequireDefault(require('./blacklist'));
var _constants = _interopRequireDefault(require('./constants'));
var dependencyExtractor = _interopRequireWildcard(
require('./lib/dependencyExtractor')
);
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;
}
/**
* 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 (0, _crypto().createHash)('sha1')
.update(content)
.digest('hex');
}
async function worker(data) {
if (
data.hasteImplModulePath &&
data.hasteImplModulePath !== hasteImplModulePath
) {
if (hasteImpl) {
throw new Error('jest-haste-map: hasteImplModulePath changed');
}
hasteImplModulePath = data.hasteImplModulePath;
hasteImpl = require(hasteImplModulePath);
}
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);
}
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().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
};
}
async function getSha1(data) {
const sha1 = data.computeSha1
? sha1hex(fs().readFileSync(data.filePath))
: null;
return {
dependencies: undefined,
id: undefined,
module: undefined,
sha1
};
}

View File

@@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,133 @@
# graceful-fs
graceful-fs functions as a drop-in replacement for the fs module,
making various improvements.
The improvements are meant to normalize behavior across different
platforms and environments, and to make filesystem access more
resilient to errors.
## Improvements over [fs module](https://nodejs.org/api/fs.html)
* Queues up `open` and `readdir` calls, and retries them once
something closes if there is an EMFILE error from too many file
descriptors.
* fixes `lchmod` for Node versions prior to 0.6.2.
* implements `fs.lutimes` if possible. Otherwise it becomes a noop.
* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or
`lchown` if the user isn't root.
* makes `lchmod` and `lchown` become noops, if not available.
* retries reading a file if `read` results in EAGAIN error.
On Windows, it retries renaming a file for up to one second if `EACCESS`
or `EPERM` error occurs, likely because antivirus software has locked
the directory.
## USAGE
```javascript
// use just like fs
var fs = require('graceful-fs')
// now go and do stuff with it...
fs.readFileSync('some-file-or-whatever')
```
## Global Patching
If you want to patch the global fs module (or any other fs-like
module) you can do this:
```javascript
// Make sure to read the caveat below.
var realFs = require('fs')
var gracefulFs = require('graceful-fs')
gracefulFs.gracefulify(realFs)
```
This should only ever be done at the top-level application layer, in
order to delay on EMFILE errors from any fs-using dependencies. You
should **not** do this in a library, because it can cause unexpected
delays in other parts of the program.
## Changes
This module is fairly stable at this point, and used by a lot of
things. That being said, because it implements a subtle behavior
change in a core part of the node API, even modest changes can be
extremely breaking, and the versioning is thus biased towards
bumping the major when in doubt.
The main change between major versions has been switching between
providing a fully-patched `fs` module vs monkey-patching the node core
builtin, and the approach by which a non-monkey-patched `fs` was
created.
The goal is to trade `EMFILE` errors for slower fs operations. So, if
you try to open a zillion files, rather than crashing, `open`
operations will be queued up and wait for something else to `close`.
There are advantages to each approach. Monkey-patching the fs means
that no `EMFILE` errors can possibly occur anywhere in your
application, because everything is using the same core `fs` module,
which is patched. However, it can also obviously cause undesirable
side-effects, especially if the module is loaded multiple times.
Implementing a separate-but-identical patched `fs` module is more
surgical (and doesn't run the risk of patching multiple times), but
also imposes the challenge of keeping in sync with the core module.
The current approach loads the `fs` module, and then creates a
lookalike object that has all the same methods, except a few that are
patched. It is safe to use in all versions of Node from 0.8 through
7.0.
### v4
* Do not monkey-patch the fs module. This module may now be used as a
drop-in dep, and users can opt into monkey-patching the fs builtin
if their app requires it.
### v3
* Monkey-patch fs, because the eval approach no longer works on recent
node.
* fixed possible type-error throw if rename fails on windows
* verify that we *never* get EMFILE errors
* Ignore ENOSYS from chmod/chown
* clarify that graceful-fs must be used as a drop-in
### v2.1.0
* Use eval rather than monkey-patching fs.
* readdir: Always sort the results
* win32: requeue a file if error has an OK status
### v2.0
* A return to monkey patching
* wrap process.cwd
### v1.1
* wrap readFile
* Wrap fs.writeFile.
* readdir protection
* Don't clobber the fs builtin
* Handle fs.read EAGAIN errors by trying again
* Expose the curOpen counter
* No-op lchown/lchmod if not implemented
* fs.rename patch only for win32
* Patch fs.rename to handle AV software on Windows
* Close #4 Chown should not fail on einval or eperm if non-root
* Fix isaacs/fstream#1 Only wrap fs one time
* Fix #3 Start at 1024 max files, then back off on EMFILE
* lutimes that doens't blow up on Linux
* A full on-rewrite using a queue instead of just swallowing the EMFILE error
* Wrap Read/Write streams as well
### 1.0
* Update engines for node 0.6
* Be lstat-graceful on Windows
* first

View File

@@ -0,0 +1,19 @@
'use strict'
module.exports = clone
function clone (obj) {
if (obj === null || typeof obj !== 'object')
return obj
if (obj instanceof Object)
var copy = { __proto__: obj.__proto__ }
else
var copy = Object.create(null)
Object.getOwnPropertyNames(obj).forEach(function (key) {
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
})
return copy
}

View File

@@ -0,0 +1,346 @@
var fs = require('fs')
var polyfills = require('./polyfills.js')
var legacy = require('./legacy-streams.js')
var clone = require('./clone.js')
var util = require('util')
/* istanbul ignore next - node 0.x polyfill */
var gracefulQueue
var previousSymbol
/* istanbul ignore else - node 0.x polyfill */
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
gracefulQueue = Symbol.for('graceful-fs.queue')
// This is used in testing by future versions
previousSymbol = Symbol.for('graceful-fs.previous')
} else {
gracefulQueue = '___graceful-fs.queue'
previousSymbol = '___graceful-fs.previous'
}
function noop () {}
var debug = noop
if (util.debuglog)
debug = util.debuglog('gfs4')
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
debug = function() {
var m = util.format.apply(util, arguments)
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
console.error(m)
}
// Once time initialization
if (!global[gracefulQueue]) {
// This queue can be shared by multiple loaded instances
var queue = []
Object.defineProperty(global, gracefulQueue, {
get: function() {
return queue
}
})
// Patch fs.close/closeSync to shared queue version, because we need
// to retry() whenever a close happens *anywhere* in the program.
// This is essential when multiple graceful-fs instances are
// in play at the same time.
fs.close = (function (fs$close) {
function close (fd, cb) {
return fs$close.call(fs, fd, function (err) {
// This function uses the graceful-fs shared queue
if (!err) {
retry()
}
if (typeof cb === 'function')
cb.apply(this, arguments)
})
}
Object.defineProperty(close, previousSymbol, {
value: fs$close
})
return close
})(fs.close)
fs.closeSync = (function (fs$closeSync) {
function closeSync (fd) {
// This function uses the graceful-fs shared queue
fs$closeSync.apply(fs, arguments)
retry()
}
Object.defineProperty(closeSync, previousSymbol, {
value: fs$closeSync
})
return closeSync
})(fs.closeSync)
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
process.on('exit', function() {
debug(global[gracefulQueue])
require('assert').equal(global[gracefulQueue].length, 0)
})
}
}
module.exports = patch(clone(fs))
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
module.exports = patch(fs)
fs.__patched = true;
}
function patch (fs) {
// Everything that references the open() function needs to be in here
polyfills(fs)
fs.gracefulify = patch
fs.createReadStream = createReadStream
fs.createWriteStream = createWriteStream
var fs$readFile = fs.readFile
fs.readFile = readFile
function readFile (path, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$readFile(path, options, cb)
function go$readFile (path, options, cb) {
return fs$readFile(path, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readFile, [path, options, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
var fs$writeFile = fs.writeFile
fs.writeFile = writeFile
function writeFile (path, data, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$writeFile(path, data, options, cb)
function go$writeFile (path, data, options, cb) {
return fs$writeFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$writeFile, [path, data, options, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
var fs$appendFile = fs.appendFile
if (fs$appendFile)
fs.appendFile = appendFile
function appendFile (path, data, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$appendFile(path, data, options, cb)
function go$appendFile (path, data, options, cb) {
return fs$appendFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$appendFile, [path, data, options, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
var fs$readdir = fs.readdir
fs.readdir = readdir
function readdir (path, options, cb) {
var args = [path]
if (typeof options !== 'function') {
args.push(options)
} else {
cb = options
}
args.push(go$readdir$cb)
return go$readdir(args)
function go$readdir$cb (err, files) {
if (files && files.sort)
files.sort()
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readdir, [args]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
}
}
function go$readdir (args) {
return fs$readdir.apply(fs, args)
}
if (process.version.substr(0, 4) === 'v0.8') {
var legStreams = legacy(fs)
ReadStream = legStreams.ReadStream
WriteStream = legStreams.WriteStream
}
var fs$ReadStream = fs.ReadStream
if (fs$ReadStream) {
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
ReadStream.prototype.open = ReadStream$open
}
var fs$WriteStream = fs.WriteStream
if (fs$WriteStream) {
WriteStream.prototype = Object.create(fs$WriteStream.prototype)
WriteStream.prototype.open = WriteStream$open
}
Object.defineProperty(fs, 'ReadStream', {
get: function () {
return ReadStream
},
set: function (val) {
ReadStream = val
},
enumerable: true,
configurable: true
})
Object.defineProperty(fs, 'WriteStream', {
get: function () {
return WriteStream
},
set: function (val) {
WriteStream = val
},
enumerable: true,
configurable: true
})
// legacy names
var FileReadStream = ReadStream
Object.defineProperty(fs, 'FileReadStream', {
get: function () {
return FileReadStream
},
set: function (val) {
FileReadStream = val
},
enumerable: true,
configurable: true
})
var FileWriteStream = WriteStream
Object.defineProperty(fs, 'FileWriteStream', {
get: function () {
return FileWriteStream
},
set: function (val) {
FileWriteStream = val
},
enumerable: true,
configurable: true
})
function ReadStream (path, options) {
if (this instanceof ReadStream)
return fs$ReadStream.apply(this, arguments), this
else
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
}
function ReadStream$open () {
var that = this
open(that.path, that.flags, that.mode, function (err, fd) {
if (err) {
if (that.autoClose)
that.destroy()
that.emit('error', err)
} else {
that.fd = fd
that.emit('open', fd)
that.read()
}
})
}
function WriteStream (path, options) {
if (this instanceof WriteStream)
return fs$WriteStream.apply(this, arguments), this
else
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
}
function WriteStream$open () {
var that = this
open(that.path, that.flags, that.mode, function (err, fd) {
if (err) {
that.destroy()
that.emit('error', err)
} else {
that.fd = fd
that.emit('open', fd)
}
})
}
function createReadStream (path, options) {
return new fs.ReadStream(path, options)
}
function createWriteStream (path, options) {
return new fs.WriteStream(path, options)
}
var fs$open = fs.open
fs.open = open
function open (path, flags, mode, cb) {
if (typeof mode === 'function')
cb = mode, mode = null
return go$open(path, flags, mode, cb)
function go$open (path, flags, mode, cb) {
return fs$open(path, flags, mode, function (err, fd) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$open, [path, flags, mode, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
return fs
}
function enqueue (elem) {
debug('ENQUEUE', elem[0].name, elem[1])
global[gracefulQueue].push(elem)
}
function retry () {
var elem = global[gracefulQueue].shift()
if (elem) {
debug('RETRY', elem[0].name, elem[1])
elem[0].apply(null, elem[1])
}
}

View File

@@ -0,0 +1,118 @@
var Stream = require('stream').Stream
module.exports = legacy
function legacy (fs) {
return {
ReadStream: ReadStream,
WriteStream: WriteStream
}
function ReadStream (path, options) {
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
Stream.call(this);
var self = this;
this.path = path;
this.fd = null;
this.readable = true;
this.paused = false;
this.flags = 'r';
this.mode = 438; /*=0666*/
this.bufferSize = 64 * 1024;
options = options || {};
// Mixin options into this
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.encoding) this.setEncoding(this.encoding);
if (this.start !== undefined) {
if ('number' !== typeof this.start) {
throw TypeError('start must be a Number');
}
if (this.end === undefined) {
this.end = Infinity;
} else if ('number' !== typeof this.end) {
throw TypeError('end must be a Number');
}
if (this.start > this.end) {
throw new Error('start must be <= end');
}
this.pos = this.start;
}
if (this.fd !== null) {
process.nextTick(function() {
self._read();
});
return;
}
fs.open(this.path, this.flags, this.mode, function (err, fd) {
if (err) {
self.emit('error', err);
self.readable = false;
return;
}
self.fd = fd;
self.emit('open', fd);
self._read();
})
}
function WriteStream (path, options) {
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
Stream.call(this);
this.path = path;
this.fd = null;
this.writable = true;
this.flags = 'w';
this.encoding = 'binary';
this.mode = 438; /*=0666*/
this.bytesWritten = 0;
options = options || {};
// Mixin options into this
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.start !== undefined) {
if ('number' !== typeof this.start) {
throw TypeError('start must be a Number');
}
if (this.start < 0) {
throw new Error('start must be >= zero');
}
this.pos = this.start;
}
this.busy = false;
this._queue = [];
if (this.fd === null) {
this._open = fs.open;
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
this.flush();
}
}
}

View File

@@ -0,0 +1,79 @@
{
"_from": "graceful-fs@^4.2.3",
"_id": "graceful-fs@4.2.3",
"_inBundle": false,
"_integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==",
"_location": "/jest-haste-map/graceful-fs",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "graceful-fs@^4.2.3",
"name": "graceful-fs",
"escapedName": "graceful-fs",
"rawSpec": "^4.2.3",
"saveSpec": null,
"fetchSpec": "^4.2.3"
},
"_requiredBy": [
"/jest-haste-map"
],
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz",
"_shasum": "4a12ff1b60376ef09862c2093edd908328be8423",
"_spec": "graceful-fs@^4.2.3",
"_where": "/home/runner/work/ghaction-upx/ghaction-upx/node_modules/jest-haste-map",
"bugs": {
"url": "https://github.com/isaacs/node-graceful-fs/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "A drop-in replacement for fs, making various improvements.",
"devDependencies": {
"import-fresh": "^2.0.0",
"mkdirp": "^0.5.0",
"rimraf": "^2.2.8",
"tap": "^12.7.0"
},
"directories": {
"test": "test"
},
"files": [
"fs.js",
"graceful-fs.js",
"legacy-streams.js",
"polyfills.js",
"clone.js"
],
"homepage": "https://github.com/isaacs/node-graceful-fs#readme",
"keywords": [
"fs",
"module",
"reading",
"retry",
"retries",
"queue",
"error",
"errors",
"handling",
"EMFILE",
"EAGAIN",
"EINVAL",
"EPERM",
"EACCESS"
],
"license": "ISC",
"main": "graceful-fs.js",
"name": "graceful-fs",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/node-graceful-fs.git"
},
"scripts": {
"postpublish": "git push origin --follow-tags",
"postversion": "npm publish",
"preversion": "npm test",
"test": "node test.js | tap -"
},
"version": "4.2.3"
}

View File

@@ -0,0 +1,342 @@
var constants = require('constants')
var origCwd = process.cwd
var cwd = null
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
process.cwd = function() {
if (!cwd)
cwd = origCwd.call(process)
return cwd
}
try {
process.cwd()
} catch (er) {}
var chdir = process.chdir
process.chdir = function(d) {
cwd = null
chdir.call(process, d)
}
module.exports = patch
function patch (fs) {
// (re-)implement some things that are known busted or missing.
// lchmod, broken prior to 0.6.2
// back-port the fix here.
if (constants.hasOwnProperty('O_SYMLINK') &&
process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
patchLchmod(fs)
}
// lutimes implementation, or no-op
if (!fs.lutimes) {
patchLutimes(fs)
}
// https://github.com/isaacs/node-graceful-fs/issues/4
// Chown should not fail on einval or eperm if non-root.
// It should not fail on enosys ever, as this just indicates
// that a fs doesn't support the intended operation.
fs.chown = chownFix(fs.chown)
fs.fchown = chownFix(fs.fchown)
fs.lchown = chownFix(fs.lchown)
fs.chmod = chmodFix(fs.chmod)
fs.fchmod = chmodFix(fs.fchmod)
fs.lchmod = chmodFix(fs.lchmod)
fs.chownSync = chownFixSync(fs.chownSync)
fs.fchownSync = chownFixSync(fs.fchownSync)
fs.lchownSync = chownFixSync(fs.lchownSync)
fs.chmodSync = chmodFixSync(fs.chmodSync)
fs.fchmodSync = chmodFixSync(fs.fchmodSync)
fs.lchmodSync = chmodFixSync(fs.lchmodSync)
fs.stat = statFix(fs.stat)
fs.fstat = statFix(fs.fstat)
fs.lstat = statFix(fs.lstat)
fs.statSync = statFixSync(fs.statSync)
fs.fstatSync = statFixSync(fs.fstatSync)
fs.lstatSync = statFixSync(fs.lstatSync)
// if lchmod/lchown do not exist, then make them no-ops
if (!fs.lchmod) {
fs.lchmod = function (path, mode, cb) {
if (cb) process.nextTick(cb)
}
fs.lchmodSync = function () {}
}
if (!fs.lchown) {
fs.lchown = function (path, uid, gid, cb) {
if (cb) process.nextTick(cb)
}
fs.lchownSync = function () {}
}
// on Windows, A/V software can lock the directory, causing this
// to fail with an EACCES or EPERM if the directory contains newly
// created files. Try again on failure, for up to 60 seconds.
// Set the timeout this long because some Windows Anti-Virus, such as Parity
// bit9, may lock files for up to a minute, causing npm package install
// failures. Also, take care to yield the scheduler. Windows scheduling gives
// CPU to a busy looping process, which can cause the program causing the lock
// contention to be starved of CPU by node, so the contention doesn't resolve.
if (platform === "win32") {
fs.rename = (function (fs$rename) { return function (from, to, cb) {
var start = Date.now()
var backoff = 0;
fs$rename(from, to, function CB (er) {
if (er
&& (er.code === "EACCES" || er.code === "EPERM")
&& Date.now() - start < 60000) {
setTimeout(function() {
fs.stat(to, function (stater, st) {
if (stater && stater.code === "ENOENT")
fs$rename(from, to, CB);
else
cb(er)
})
}, backoff)
if (backoff < 100)
backoff += 10;
return;
}
if (cb) cb(er)
})
}})(fs.rename)
}
// if read() returns EAGAIN, then just try it again.
fs.read = (function (fs$read) {
function read (fd, buffer, offset, length, position, callback_) {
var callback
if (callback_ && typeof callback_ === 'function') {
var eagCounter = 0
callback = function (er, _, __) {
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
eagCounter ++
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
}
callback_.apply(this, arguments)
}
}
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
}
// This ensures `util.promisify` works as it does for native `fs.read`.
read.__proto__ = fs$read
return read
})(fs.read)
fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
var eagCounter = 0
while (true) {
try {
return fs$readSync.call(fs, fd, buffer, offset, length, position)
} catch (er) {
if (er.code === 'EAGAIN' && eagCounter < 10) {
eagCounter ++
continue
}
throw er
}
}
}})(fs.readSync)
function patchLchmod (fs) {
fs.lchmod = function (path, mode, callback) {
fs.open( path
, constants.O_WRONLY | constants.O_SYMLINK
, mode
, function (err, fd) {
if (err) {
if (callback) callback(err)
return
}
// prefer to return the chmod error, if one occurs,
// but still try to close, and report closing errors if they occur.
fs.fchmod(fd, mode, function (err) {
fs.close(fd, function(err2) {
if (callback) callback(err || err2)
})
})
})
}
fs.lchmodSync = function (path, mode) {
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
// prefer to return the chmod error, if one occurs,
// but still try to close, and report closing errors if they occur.
var threw = true
var ret
try {
ret = fs.fchmodSync(fd, mode)
threw = false
} finally {
if (threw) {
try {
fs.closeSync(fd)
} catch (er) {}
} else {
fs.closeSync(fd)
}
}
return ret
}
}
function patchLutimes (fs) {
if (constants.hasOwnProperty("O_SYMLINK")) {
fs.lutimes = function (path, at, mt, cb) {
fs.open(path, constants.O_SYMLINK, function (er, fd) {
if (er) {
if (cb) cb(er)
return
}
fs.futimes(fd, at, mt, function (er) {
fs.close(fd, function (er2) {
if (cb) cb(er || er2)
})
})
})
}
fs.lutimesSync = function (path, at, mt) {
var fd = fs.openSync(path, constants.O_SYMLINK)
var ret
var threw = true
try {
ret = fs.futimesSync(fd, at, mt)
threw = false
} finally {
if (threw) {
try {
fs.closeSync(fd)
} catch (er) {}
} else {
fs.closeSync(fd)
}
}
return ret
}
} else {
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
fs.lutimesSync = function () {}
}
}
function chmodFix (orig) {
if (!orig) return orig
return function (target, mode, cb) {
return orig.call(fs, target, mode, function (er) {
if (chownErOk(er)) er = null
if (cb) cb.apply(this, arguments)
})
}
}
function chmodFixSync (orig) {
if (!orig) return orig
return function (target, mode) {
try {
return orig.call(fs, target, mode)
} catch (er) {
if (!chownErOk(er)) throw er
}
}
}
function chownFix (orig) {
if (!orig) return orig
return function (target, uid, gid, cb) {
return orig.call(fs, target, uid, gid, function (er) {
if (chownErOk(er)) er = null
if (cb) cb.apply(this, arguments)
})
}
}
function chownFixSync (orig) {
if (!orig) return orig
return function (target, uid, gid) {
try {
return orig.call(fs, target, uid, gid)
} catch (er) {
if (!chownErOk(er)) throw er
}
}
}
function statFix (orig) {
if (!orig) return orig
// Older versions of Node erroneously returned signed integers for
// uid + gid.
return function (target, options, cb) {
if (typeof options === 'function') {
cb = options
options = null
}
function callback (er, stats) {
if (stats) {
if (stats.uid < 0) stats.uid += 0x100000000
if (stats.gid < 0) stats.gid += 0x100000000
}
if (cb) cb.apply(this, arguments)
}
return options ? orig.call(fs, target, options, callback)
: orig.call(fs, target, callback)
}
}
function statFixSync (orig) {
if (!orig) return orig
// Older versions of Node erroneously returned signed integers for
// uid + gid.
return function (target, options) {
var stats = options ? orig.call(fs, target, options)
: orig.call(fs, target)
if (stats.uid < 0) stats.uid += 0x100000000
if (stats.gid < 0) stats.gid += 0x100000000
return stats;
}
}
// ENOSYS means that the fs doesn't support the op. Just ignore
// that, because it doesn't matter.
//
// if there's no getuid, or if getuid() is something other
// than 0, and the error is EINVAL or EPERM, then just ignore
// it.
//
// This specific case is a silent failure in cp, install, tar,
// and most other unix tools that manage permissions.
//
// When running as root, or if other types of errors are
// encountered, then it's strict.
function chownErOk (er) {
if (!er)
return true
if (er.code === "ENOSYS")
return true
var nonroot = !process.getuid || process.getuid() !== 0
if (nonroot) {
if (er.code === "EINVAL" || er.code === "EPERM")
return true
}
return false
}
}

74
node_modules/jest-haste-map/package.json generated vendored Normal file
View File

@@ -0,0 +1,74 @@
{
"_from": "jest-haste-map@^25.1.0",
"_id": "jest-haste-map@25.1.0",
"_inBundle": false,
"_integrity": "sha512-/2oYINIdnQZAqyWSn1GTku571aAfs8NxzSErGek65Iu5o8JYb+113bZysRMcC/pjE5v9w0Yz+ldbj9NxrFyPyw==",
"_location": "/jest-haste-map",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "jest-haste-map@^25.1.0",
"name": "jest-haste-map",
"escapedName": "jest-haste-map",
"rawSpec": "^25.1.0",
"saveSpec": null,
"fetchSpec": "^25.1.0"
},
"_requiredBy": [
"/@jest/test-sequencer",
"/@jest/transform",
"/jest-runner",
"/jest-runtime"
],
"_resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.1.0.tgz",
"_shasum": "ae12163d284f19906260aa51fd405b5b2e5a4ad3",
"_spec": "jest-haste-map@^25.1.0",
"_where": "/home/runner/work/ghaction-upx/ghaction-upx/node_modules/jest-runtime",
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"bundleDependencies": false,
"dependencies": {
"@jest/types": "^25.1.0",
"anymatch": "^3.0.3",
"fb-watchman": "^2.0.0",
"fsevents": "^2.1.2",
"graceful-fs": "^4.2.3",
"jest-serializer": "^25.1.0",
"jest-util": "^25.1.0",
"jest-worker": "^25.1.0",
"micromatch": "^4.0.2",
"sane": "^4.0.3",
"walker": "^1.0.7"
},
"deprecated": false,
"devDependencies": {
"@types/anymatch": "^1.3.1",
"@types/fb-watchman": "^2.0.0",
"@types/graceful-fs": "^4.1.2",
"@types/micromatch": "^4.0.0",
"@types/sane": "^2.0.0"
},
"engines": {
"node": ">= 8.3"
},
"gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638",
"homepage": "https://github.com/facebook/jest#readme",
"license": "MIT",
"main": "build/index.js",
"name": "jest-haste-map",
"optionalDependencies": {
"fsevents": "^2.1.2"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/jest.git",
"directory": "packages/jest-haste-map"
},
"types": "build/index.d.ts",
"version": "25.1.0"
}