This commit is contained in:
eric sciple 2020-01-24 12:20:19 -05:00
parent beb1329f9f
commit 2b95e76931
7736 changed files with 1874747 additions and 51184 deletions

19
node_modules/jest-resolve/build/defaultResolver.d.ts generated vendored Normal file
View file

@ -0,0 +1,19 @@
/**
* 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';
declare type ResolverOptions = {
basedir: Config.Path;
browser?: boolean;
defaultResolver: typeof defaultResolver;
extensions?: Array<string>;
moduleDirectory?: Array<string>;
paths?: Array<Config.Path>;
rootDir?: Config.Path;
};
export default function defaultResolver(path: Config.Path, options: ResolverOptions): Config.Path;
export {};
//# sourceMappingURL=defaultResolver.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"defaultResolver.d.ts","sourceRoot":"","sources":["../src/defaultResolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAInC,aAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,eAAe,CAAC;IACxC,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,OAAO,EAAE,eAAe,GACvB,MAAM,CAAC,IAAI,CAgBb"}

247
node_modules/jest-resolve/build/defaultResolver.js generated vendored Normal file
View file

@ -0,0 +1,247 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = defaultResolver;
function _fs() {
const data = _interopRequireDefault(require('fs'));
_fs = function _fs() {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require('path'));
_path = function _path() {
return data;
};
return data;
}
function _browserResolve() {
const data = _interopRequireDefault(require('browser-resolve'));
_browserResolve = function _browserResolve() {
return data;
};
return data;
}
function _jestPnpResolver() {
const data = _interopRequireDefault(require('jest-pnp-resolver'));
_jestPnpResolver = function _jestPnpResolver() {
return data;
};
return data;
}
var _isBuiltinModule = _interopRequireDefault(require('./isBuiltinModule'));
var _nodeModulesPaths = _interopRequireDefault(require('./nodeModulesPaths'));
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.
*/
function defaultResolver(path, options) {
// @ts-ignore: the "pnp" version named isn't in DefinitelyTyped
if (process.versions.pnp) {
return (0, _jestPnpResolver().default)(path, options);
}
const resolve = options.browser
? _browserResolve().default.sync
: resolveSync;
return resolve(path, {
basedir: options.basedir,
defaultResolver,
extensions: options.extensions,
moduleDirectory: options.moduleDirectory,
paths: options.paths,
rootDir: options.rootDir
});
}
const REGEX_RELATIVE_IMPORT = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[\\\/])/;
function resolveSync(target, options) {
const basedir = options.basedir;
const extensions = options.extensions || ['.js'];
const paths = options.paths || [];
if (REGEX_RELATIVE_IMPORT.test(target)) {
// resolve relative import
const resolveTarget = _path().default.resolve(basedir, target);
const result = tryResolve(resolveTarget);
if (result) {
return result;
}
} else {
// otherwise search for node_modules
const dirs = (0, _nodeModulesPaths.default)(basedir, {
moduleDirectory: options.moduleDirectory,
paths
});
for (let i = 0; i < dirs.length; i++) {
const resolveTarget = _path().default.join(dirs[i], target);
const result = tryResolve(resolveTarget);
if (result) {
return result;
}
}
}
if ((0, _isBuiltinModule.default)(target)) {
return target;
}
const err = new Error(
"Cannot find module '" + target + "' from '" + basedir + "'"
);
err.code = 'MODULE_NOT_FOUND';
throw err;
/*
* contextual helper functions
*/
function tryResolve(name) {
const dir = _path().default.dirname(name);
let result;
if (isDirectory(dir)) {
result = resolveAsFile(name) || resolveAsDirectory(name);
}
if (result) {
// Dereference symlinks to ensure we don't create a separate
// module instance depending on how it was referenced.
result = _fs().default.realpathSync(result);
}
return result;
}
function resolveAsFile(name) {
if (isFile(name)) {
return name;
}
for (let i = 0; i < extensions.length; i++) {
const file = name + extensions[i];
if (isFile(file)) {
return file;
}
}
return undefined;
}
function resolveAsDirectory(name) {
if (!isDirectory(name)) {
return undefined;
}
const pkgfile = _path().default.join(name, 'package.json');
let pkgmain;
try {
const body = _fs().default.readFileSync(pkgfile, 'utf8');
pkgmain = JSON.parse(body).main;
} catch (e) {}
if (pkgmain && !isCurrentDirectory(pkgmain)) {
const resolveTarget = _path().default.resolve(name, pkgmain);
const result = tryResolve(resolveTarget);
if (result) {
return result;
}
}
return resolveAsFile(_path().default.join(name, 'index'));
}
}
var IPathType;
(function(IPathType) {
IPathType[(IPathType['FILE'] = 1)] = 'FILE';
IPathType[(IPathType['DIRECTORY'] = 2)] = 'DIRECTORY';
IPathType[(IPathType['OTHER'] = 3)] = 'OTHER';
})(IPathType || (IPathType = {}));
const checkedPaths = new Map();
function statSyncCached(path) {
const result = checkedPaths.get(path);
if (result !== undefined) {
return result;
}
let stat;
try {
stat = _fs().default.statSync(path);
} catch (e) {
if (!(e && (e.code === 'ENOENT' || e.code === 'ENOTDIR'))) {
throw e;
}
}
if (stat) {
if (stat.isFile() || stat.isFIFO()) {
checkedPaths.set(path, IPathType.FILE);
return IPathType.FILE;
} else if (stat.isDirectory()) {
checkedPaths.set(path, IPathType.DIRECTORY);
return IPathType.DIRECTORY;
}
}
checkedPaths.set(path, IPathType.OTHER);
return IPathType.OTHER;
}
/*
* helper functions
*/
function isFile(file) {
return statSyncCached(file) === IPathType.FILE;
}
function isDirectory(dir) {
return statSyncCached(dir) === IPathType.DIRECTORY;
}
const CURRENT_DIRECTORY = _path().default.resolve('.');
function isCurrentDirectory(testPath) {
return CURRENT_DIRECTORY === _path().default.resolve(testPath);
}

54
node_modules/jest-resolve/build/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,54 @@
/**
* 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 { ModuleMap } from 'jest-haste-map';
import { ResolverConfig } from './types';
declare type FindNodeModuleConfig = {
basedir: Config.Path;
browser?: boolean;
extensions?: Array<string>;
moduleDirectory?: Array<string>;
paths?: Array<Config.Path>;
resolver?: Config.Path | null;
rootDir?: Config.Path;
};
declare type BooleanObject = {
[key: string]: boolean;
};
declare namespace Resolver {
type ResolveModuleConfig = {
skipNodeResolution?: boolean;
paths?: Array<Config.Path>;
};
}
declare class Resolver {
private readonly _options;
private readonly _moduleMap;
private readonly _moduleIDCache;
private readonly _moduleNameCache;
private readonly _modulePathCache;
private readonly _supportsNativePlatform;
constructor(moduleMap: ModuleMap, options: ResolverConfig);
static findNodeModule(path: Config.Path, options: FindNodeModuleConfig): Config.Path | null;
resolveModuleFromDirIfExists(dirname: Config.Path, moduleName: string, options?: Resolver.ResolveModuleConfig): Config.Path | null;
resolveModule(from: Config.Path, moduleName: string, options?: Resolver.ResolveModuleConfig): Config.Path;
isCoreModule(moduleName: string): boolean;
getModule(name: string): Config.Path | null;
getModulePath(from: Config.Path, moduleName: string): string;
getPackage(name: string): Config.Path | null;
getMockModule(from: Config.Path, name: string): Config.Path | null;
getModulePaths(from: Config.Path): Array<Config.Path>;
getModuleID(virtualMocks: BooleanObject, from: Config.Path, _moduleName?: string): string;
private _getModuleType;
private _getAbsolutePath;
private _getMockPath;
private _getVirtualMockPath;
private _isModuleResolved;
resolveStubModuleName(from: Config.Path, moduleName: string): Config.Path | null;
}
export = Resolver;
//# sourceMappingURL=index.d.ts.map

1
node_modules/jest-resolve/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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"}

490
node_modules/jest-resolve/build/index.js generated vendored Normal file
View file

@ -0,0 +1,490 @@
'use strict';
function _path() {
const data = _interopRequireDefault(require('path'));
_path = function _path() {
return data;
};
return data;
}
function _realpathNative() {
const data = require('realpath-native');
_realpathNative = function _realpathNative() {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
return data;
};
return data;
}
var _nodeModulesPaths = _interopRequireDefault(require('./nodeModulesPaths'));
var _isBuiltinModule = _interopRequireDefault(require('./isBuiltinModule'));
var _defaultResolver = _interopRequireDefault(require('./defaultResolver'));
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;
}
const NATIVE_PLATFORM = 'native'; // We might be inside a symlink.
const cwd = process.cwd();
const resolvedCwd = (0, _realpathNative().sync)(cwd) || cwd;
const NODE_PATH = process.env.NODE_PATH;
const nodePaths = NODE_PATH
? NODE_PATH.split(_path().default.delimiter)
.filter(Boolean) // The resolver expects absolute paths.
.map(p => _path().default.resolve(resolvedCwd, p))
: null;
/* eslint-disable-next-line no-redeclare */
class Resolver {
constructor(moduleMap, options) {
_defineProperty(this, '_options', void 0);
_defineProperty(this, '_moduleMap', void 0);
_defineProperty(this, '_moduleIDCache', void 0);
_defineProperty(this, '_moduleNameCache', void 0);
_defineProperty(this, '_modulePathCache', void 0);
_defineProperty(this, '_supportsNativePlatform', void 0);
this._options = {
browser: options.browser,
defaultPlatform: options.defaultPlatform,
extensions: options.extensions,
hasCoreModules:
options.hasCoreModules === undefined ? true : options.hasCoreModules,
moduleDirectories: options.moduleDirectories || ['node_modules'],
moduleNameMapper: options.moduleNameMapper,
modulePaths: options.modulePaths,
platforms: options.platforms,
resolver: options.resolver,
rootDir: options.rootDir
};
this._supportsNativePlatform = options.platforms
? options.platforms.includes(NATIVE_PLATFORM)
: false;
this._moduleMap = moduleMap;
this._moduleIDCache = new Map();
this._moduleNameCache = new Map();
this._modulePathCache = new Map();
}
static findNodeModule(path, options) {
const resolver = options.resolver
? require(options.resolver)
: _defaultResolver.default;
const paths = options.paths;
try {
return resolver(path, {
basedir: options.basedir,
browser: options.browser,
defaultResolver: _defaultResolver.default,
extensions: options.extensions,
moduleDirectory: options.moduleDirectory,
paths: paths ? (nodePaths || []).concat(paths) : nodePaths,
rootDir: options.rootDir
});
} catch (e) {}
return null;
}
resolveModuleFromDirIfExists(dirname, moduleName, options) {
const paths = (options && options.paths) || this._options.modulePaths;
const moduleDirectory = this._options.moduleDirectories;
const key = dirname + _path().default.delimiter + moduleName;
const defaultPlatform = this._options.defaultPlatform;
const extensions = this._options.extensions.slice();
let module;
if (this._supportsNativePlatform) {
extensions.unshift(
...this._options.extensions.map(ext => '.' + NATIVE_PLATFORM + ext)
);
}
if (defaultPlatform) {
extensions.unshift(
...this._options.extensions.map(ext => '.' + defaultPlatform + ext)
);
} // 1. If we have already resolved this module for this directory name,
// return a value from the cache.
const cacheResult = this._moduleNameCache.get(key);
if (cacheResult) {
return cacheResult;
} // 2. Check if the module is a haste module.
module = this.getModule(moduleName);
if (module) {
this._moduleNameCache.set(key, module);
return module;
} // 3. Check if the module is a node module and resolve it based on
// the node module resolution algorithm. If skipNodeResolution is given we
// ignore all modules that look like node modules (ie. are not relative
// requires). This enables us to speed up resolution when we build a
// dependency graph because we don't have to look at modules that may not
// exist and aren't mocked.
const skipResolution =
options &&
options.skipNodeResolution &&
!moduleName.includes(_path().default.sep);
const resolveNodeModule = name =>
Resolver.findNodeModule(name, {
basedir: dirname,
browser: this._options.browser,
extensions,
moduleDirectory,
paths,
resolver: this._options.resolver,
rootDir: this._options.rootDir
});
if (!skipResolution) {
module = resolveNodeModule(moduleName);
if (module) {
this._moduleNameCache.set(key, module);
return module;
}
} // 4. Resolve "haste packages" which are `package.json` files outside of
// `node_modules` folders anywhere in the file system.
const parts = moduleName.split('/');
const hastePackage = this.getPackage(parts.shift());
if (hastePackage) {
try {
const module = _path().default.join.apply(
_path().default,
[_path().default.dirname(hastePackage)].concat(parts)
); // try resolving with custom resolver first to support extensions,
// then fallback to require.resolve
const resolvedModule =
resolveNodeModule(module) || require.resolve(module);
this._moduleNameCache.set(key, resolvedModule);
return resolvedModule;
} catch (ignoredError) {}
}
return null;
}
resolveModule(from, moduleName, options) {
const dirname = _path().default.dirname(from);
const module =
this.resolveStubModuleName(from, moduleName) ||
this.resolveModuleFromDirIfExists(dirname, moduleName, options);
if (module) return module; // 5. Throw an error if the module could not be found. `resolve.sync` only
// produces an error based on the dirname but we have the actual current
// module name available.
const relativePath = _path().default.relative(dirname, from);
const err = new Error(
`Cannot find module '${moduleName}' from '${relativePath || '.'}'`
);
err.code = 'MODULE_NOT_FOUND';
throw err;
}
isCoreModule(moduleName) {
return (
this._options.hasCoreModules && (0, _isBuiltinModule.default)(moduleName)
);
}
getModule(name) {
return this._moduleMap.getModule(
name,
this._options.defaultPlatform,
this._supportsNativePlatform
);
}
getModulePath(from, moduleName) {
if (moduleName[0] !== '.' || _path().default.isAbsolute(moduleName)) {
return moduleName;
}
return _path().default.normalize(
_path().default.dirname(from) + '/' + moduleName
);
}
getPackage(name) {
return this._moduleMap.getPackage(
name,
this._options.defaultPlatform,
this._supportsNativePlatform
);
}
getMockModule(from, name) {
const mock = this._moduleMap.getMockModule(name);
if (mock) {
return mock;
} else {
const moduleName = this.resolveStubModuleName(from, name);
if (moduleName) {
return this.getModule(moduleName) || moduleName;
}
}
return null;
}
getModulePaths(from) {
const cachedModule = this._modulePathCache.get(from);
if (cachedModule) {
return cachedModule;
}
const moduleDirectory = this._options.moduleDirectories;
const paths = (0, _nodeModulesPaths.default)(from, {
moduleDirectory
});
if (paths[paths.length - 1] === undefined) {
// circumvent node-resolve bug that adds `undefined` as last item.
paths.pop();
}
this._modulePathCache.set(from, paths);
return paths;
}
getModuleID(virtualMocks, from, _moduleName) {
const moduleName = _moduleName || '';
const key = from + _path().default.delimiter + moduleName;
const cachedModuleID = this._moduleIDCache.get(key);
if (cachedModuleID) {
return cachedModuleID;
}
const moduleType = this._getModuleType(moduleName);
const absolutePath = this._getAbsolutePath(virtualMocks, from, moduleName);
const mockPath = this._getMockPath(from, moduleName);
const sep = _path().default.delimiter;
const id =
moduleType +
sep +
(absolutePath ? absolutePath + sep : '') +
(mockPath ? mockPath + sep : '');
this._moduleIDCache.set(key, id);
return id;
}
_getModuleType(moduleName) {
return this.isCoreModule(moduleName) ? 'node' : 'user';
}
_getAbsolutePath(virtualMocks, from, moduleName) {
if (this.isCoreModule(moduleName)) {
return moduleName;
}
return this._isModuleResolved(from, moduleName)
? this.getModule(moduleName)
: this._getVirtualMockPath(virtualMocks, from, moduleName);
}
_getMockPath(from, moduleName) {
return !this.isCoreModule(moduleName)
? this.getMockModule(from, moduleName)
: null;
}
_getVirtualMockPath(virtualMocks, from, moduleName) {
const virtualMockPath = this.getModulePath(from, moduleName);
return virtualMocks[virtualMockPath]
? virtualMockPath
: moduleName
? this.resolveModule(from, moduleName)
: from;
}
_isModuleResolved(from, moduleName) {
return !!(
this.getModule(moduleName) || this.getMockModule(from, moduleName)
);
}
resolveStubModuleName(from, moduleName) {
const dirname = _path().default.dirname(from);
const paths = this._options.modulePaths;
const extensions = this._options.extensions.slice();
const moduleDirectory = this._options.moduleDirectories;
const moduleNameMapper = this._options.moduleNameMapper;
const resolver = this._options.resolver;
const defaultPlatform = this._options.defaultPlatform;
if (this._supportsNativePlatform) {
extensions.unshift(
...this._options.extensions.map(ext => '.' + NATIVE_PLATFORM + ext)
);
}
if (defaultPlatform) {
extensions.unshift(
...this._options.extensions.map(ext => '.' + defaultPlatform + ext)
);
}
if (moduleNameMapper) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (
var _iterator = moduleNameMapper[Symbol.iterator](), _step;
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
_iteratorNormalCompletion = true
) {
const _step$value = _step.value,
mappedModuleName = _step$value.moduleName,
regex = _step$value.regex;
if (regex.test(moduleName)) {
// Note: once a moduleNameMapper matches the name, it must result
// in a module, or else an error is thrown.
const matches = moduleName.match(regex);
const updatedName = matches
? mappedModuleName.replace(
/\$([0-9]+)/g,
(_, index) => matches[parseInt(index, 10)]
)
: mappedModuleName;
const module =
this.getModule(updatedName) ||
Resolver.findNodeModule(updatedName, {
basedir: dirname,
browser: this._options.browser,
extensions,
moduleDirectory,
paths,
resolver,
rootDir: this._options.rootDir
});
if (!module) {
throw createNoMappedModuleFoundError(
moduleName,
updatedName,
mappedModuleName,
regex,
resolver
);
}
return module;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
return null;
}
}
const createNoMappedModuleFoundError = (
moduleName,
updatedName,
mappedModuleName,
regex,
resolver
) => {
const error = new Error(
_chalk().default.red(`${_chalk().default.bold('Configuration error')}:
Could not locate module ${_chalk().default.bold(moduleName)} mapped as:
${_chalk().default.bold(updatedName)}.
Please check your configuration for these entries:
{
"moduleNameMapper": {
"${regex.toString()}": "${_chalk().default.bold(mappedModuleName)}"
},
"resolver": ${_chalk().default.bold(String(resolver))}
}`)
);
error.name = '';
return error;
};
module.exports = Resolver;

8
node_modules/jest-resolve/build/isBuiltinModule.d.ts generated vendored Normal file
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 isBuiltinModule(module: string): boolean;
//# sourceMappingURL=isBuiltinModule.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"isBuiltinModule.d.ts","sourceRoot":"","sources":["../src/isBuiltinModule.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE/D"}

39
node_modules/jest-resolve/build/isBuiltinModule.js generated vendored Normal file
View file

@ -0,0 +1,39 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = isBuiltinModule;
function _module2() {
const data = _interopRequireDefault(require('module'));
_module2 = function _module2() {
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 EXPERIMENTAL_MODULES = ['worker_threads'];
const BUILTIN_MODULES = new Set(
_module2().default.builtinModules
? _module2().default.builtinModules.concat(EXPERIMENTAL_MODULES)
: Object.keys(process.binding('natives'))
.filter(module => !/^internal\//.test(module))
.concat(EXPERIMENTAL_MODULES)
);
function isBuiltinModule(module) {
return BUILTIN_MODULES.has(module);
}

16
node_modules/jest-resolve/build/nodeModulesPaths.d.ts generated vendored Normal file
View file

@ -0,0 +1,16 @@
/**
* 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.
*
* Adapted from: https://github.com/substack/node-resolve
*/
import { Config } from '@jest/types';
declare type NodeModulesPathsOptions = {
moduleDirectory?: Array<string>;
paths?: Array<Config.Path>;
};
export default function nodeModulesPaths(basedir: Config.Path, options: NodeModulesPathsOptions): Array<Config.Path>;
export {};
//# sourceMappingURL=nodeModulesPaths.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"nodeModulesPaths.d.ts","sourceRoot":"","sources":["../src/nodeModulesPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAGnC,aAAK,uBAAuB,GAAG;IAC7B,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,OAAO,EAAE,MAAM,CAAC,IAAI,EACpB,OAAO,EAAE,uBAAuB,GAC/B,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAmDpB"}

92
node_modules/jest-resolve/build/nodeModulesPaths.js generated vendored Normal file
View file

@ -0,0 +1,92 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = nodeModulesPaths;
function _path() {
const data = _interopRequireDefault(require('path'));
_path = function _path() {
return data;
};
return data;
}
function _realpathNative() {
const data = require('realpath-native');
_realpathNative = function _realpathNative() {
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.
*
* Adapted from: https://github.com/substack/node-resolve
*/
function nodeModulesPaths(basedir, options) {
const modules =
options && options.moduleDirectory
? Array.from(options.moduleDirectory)
: ['node_modules']; // ensure that `basedir` is an absolute path at this point,
// resolving against the process' current working directory
const basedirAbs = _path().default.resolve(basedir);
let prefix = '/';
if (/^([A-Za-z]:)/.test(basedirAbs)) {
prefix = '';
} else if (/^\\\\/.test(basedirAbs)) {
prefix = '\\\\';
} // The node resolution algorithm (as implemented by NodeJS and TypeScript)
// traverses parents of the physical path, not the symlinked path
let physicalBasedir;
try {
physicalBasedir = (0, _realpathNative().sync)(basedirAbs);
} catch (err) {
// realpath can throw, e.g. on mapped drives
physicalBasedir = basedirAbs;
}
const paths = [physicalBasedir];
let parsed = _path().default.parse(physicalBasedir);
while (parsed.dir !== paths[paths.length - 1]) {
paths.push(parsed.dir);
parsed = _path().default.parse(parsed.dir);
}
const dirs = paths
.reduce(
(dirs, aPath) =>
dirs.concat(
modules.map(moduleDir =>
_path().default.isAbsolute(moduleDir)
? aPath === basedirAbs
? moduleDir
: ''
: _path().default.join(prefix, aPath, moduleDir)
)
),
[]
)
.filter(dir => dir !== '');
return options.paths ? dirs.concat(options.paths) : dirs;
}

25
node_modules/jest-resolve/build/types.d.ts generated vendored Normal file
View file

@ -0,0 +1,25 @@
/**
* 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';
export declare type ResolverConfig = {
browser?: boolean;
defaultPlatform?: string | null;
extensions: Array<string>;
hasCoreModules: boolean;
moduleDirectories: Array<string>;
moduleNameMapper?: Array<ModuleNameMapperConfig> | null;
modulePaths: Array<Config.Path>;
platforms?: Array<string>;
resolver?: Config.Path | null;
rootDir: Config.Path;
};
declare type ModuleNameMapperConfig = {
regex: RegExp;
moduleName: string;
};
export {};
//# sourceMappingURL=types.d.ts.map

1
node_modules/jest-resolve/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":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,oBAAY,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,gBAAgB,CAAC,EAAE,KAAK,CAAC,sBAAsB,CAAC,GAAG,IAAI,CAAC;IACxD,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;CACtB,CAAC;AAEF,aAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}

1
node_modules/jest-resolve/build/types.js generated vendored Normal file
View file

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