initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

192
node_modules/jest-resolve/build/default_resolver.js generated vendored Normal file
View File

@@ -0,0 +1,192 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = defaultResolver;
var _browserResolve;
function _load_browserResolve() {
return _browserResolve = _interopRequireDefault(require('browser-resolve'));
}
var _fs;
function _load_fs() {
return _fs = _interopRequireDefault(require('fs'));
}
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _is_builtin_module;
function _load_is_builtin_module() {
return _is_builtin_module = _interopRequireDefault(require('./is_builtin_module'));
}
var _node_modules_paths;
function _load_node_modules_paths() {
return _node_modules_paths = _interopRequireDefault(require('./node_modules_paths'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. 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) {
const resolve = options.browser ? (_browserResolve || _load_browserResolve()).default.sync : resolveSync;
return resolve(path, {
basedir: options.basedir,
extensions: options.extensions,
moduleDirectory: options.moduleDirectory,
paths: options.paths,
rootDir: options.rootDir
});
}
/*
* Adapted from: https://github.com/substack/node-resolve
*/
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 || _load_path()).default.resolve(basedir, target);
const result = tryResolve(resolveTarget);
if (result) {
return result;
}
} else {
// otherwise search for node_modules
const dirs = (0, (_node_modules_paths || _load_node_modules_paths()).default)(basedir, {
moduleDirectory: options.moduleDirectory,
paths
});
for (let i = 0; i < dirs.length; i++) {
const resolveTarget = (_path || _load_path()).default.join(dirs[i], target);
const result = tryResolve(resolveTarget);
if (result) {
return result;
}
}
}
if ((0, (_is_builtin_module || _load_is_builtin_module()).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 || _load_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 || _load_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 || _load_path()).default.join(name, 'package.json');
let pkgmain;
try {
const body = (_fs || _load_fs()).default.readFileSync(pkgfile, 'utf8');
pkgmain = JSON.parse(body).main;
} catch (e) {}
if (pkgmain && pkgmain !== '.') {
const resolveTarget = (_path || _load_path()).default.resolve(name, pkgmain);
const result = tryResolve(resolveTarget);
if (result) {
return result;
}
}
return resolveAsFile((_path || _load_path()).default.join(name, 'index'));
}
}
/*
* helper functions
*/
function isFile(file) {
let result;
try {
const stat = (_fs || _load_fs()).default.statSync(file);
result = stat.isFile() || stat.isFIFO();
} catch (e) {
if (!(e && e.code === 'ENOENT')) {
throw e;
}
result = false;
}
return result;
}
function isDirectory(dir) {
let result;
try {
const stat = (_fs || _load_fs()).default.statSync(dir);
result = stat.isDirectory();
} catch (e) {
if (!(e && (e.code === 'ENOENT' || e.code === 'ENOTDIR'))) {
throw e;
}
result = false;
}
return result;
}

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

@@ -0,0 +1,329 @@
'use strict';
var _fs;
function _load_fs() {
return _fs = _interopRequireDefault(require('fs'));
}
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _node_modules_paths;
function _load_node_modules_paths() {
return _node_modules_paths = _interopRequireDefault(require('./node_modules_paths'));
}
var _is_builtin_module;
function _load_is_builtin_module() {
return _is_builtin_module = _interopRequireDefault(require('./is_builtin_module'));
}
var _default_resolver;
function _load_default_resolver() {
return _default_resolver = _interopRequireDefault(require('./default_resolver.js'));
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } /**
* Copyright (c) 2014-present, Facebook, Inc. 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 NATIVE_PLATFORM = 'native';
// We might be inside a symlink.
const cwd = process.cwd();
const resolvedCwd = (_fs || _load_fs()).default.realpathSync(cwd) || cwd;
const nodePaths = process.env.NODE_PATH ? process.env.NODE_PATH.split((_path || _load_path()).default.delimiter).filter(Boolean)
// The resolver expects absolute paths.
.map(p => (_path || _load_path()).default.resolve(resolvedCwd, p)) : null;
class Resolver {
constructor(moduleMap, options) {
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._moduleMap = moduleMap;
this._moduleIDCache = Object.create(null);
this._moduleNameCache = Object.create(null);
this._modulePathCache = Object.create(null);
}
static findNodeModule(path, options) {
const resolver = options.resolver ? /* $FlowFixMe */
require(options.resolver) : (_default_resolver || _load_default_resolver()).default;
const paths = options.paths;
try {
return resolver(path, {
basedir: options.basedir,
browser: options.browser,
extensions: options.extensions,
moduleDirectory: options.moduleDirectory,
paths: paths ? (nodePaths || []).concat(paths) : nodePaths,
rootDir: options.rootDir
});
} catch (e) {}
return null;
}
resolveModule(from, moduleName, options) {
const dirname = (_path || _load_path()).default.dirname(from);
const paths = this._options.modulePaths;
const moduleDirectory = this._options.moduleDirectories;
const key = dirname + (_path || _load_path()).default.delimiter + moduleName;
const defaultPlatform = this._options.defaultPlatform;
const extensions = this._options.extensions.slice();
if (this._supportsNativePlatform()) {
extensions.unshift.apply(extensions, _toConsumableArray(this._options.extensions.map(ext => '.' + NATIVE_PLATFORM + ext)));
}
if (defaultPlatform) {
extensions.unshift.apply(extensions, _toConsumableArray(this._options.extensions.map(ext => '.' + defaultPlatform + ext)));
}
// 0. If we have already resolved this module for this directory name,
// return a value from the cache.
if (this._moduleNameCache[key]) {
return this._moduleNameCache[key];
}
// 1. Check if the module is a haste module.
let module = this.getModule(moduleName);
if (module) {
return this._moduleNameCache[key] = module;
}
// 2. 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 || _load_path()).default.sep);
const resolveNodeModule = name => {
return 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) {
return this._moduleNameCache[key] = module;
}
}
// 3. 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 || _load_path()).default.join.apply((_path || _load_path()).default, [(_path || _load_path()).default.dirname(hastePackage)].concat(parts));
// try resolving with custom resolver first to support extensions,
// then fallback to require.resolve
return this._moduleNameCache[key] = resolveNodeModule(module) || require.resolve(module);
} catch (ignoredError) {}
}
// 4. 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 || _load_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, (_is_builtin_module || _load_is_builtin_module()).default)(moduleName);
}
getModule(name) {
return this._moduleMap.getModule(name, this._options.defaultPlatform, this._supportsNativePlatform());
}
getModulePath(from, moduleName) {
if (moduleName[0] !== '.' || (_path || _load_path()).default.isAbsolute(moduleName)) {
return moduleName;
}
return (_path || _load_path()).default.normalize((_path || _load_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) {
if (!this._modulePathCache[from]) {
const moduleDirectory = this._options.moduleDirectories;
const paths = (0, (_node_modules_paths || _load_node_modules_paths()).default)(from, { moduleDirectory });
if (paths[paths.length - 1] === undefined) {
// circumvent node-resolve bug that adds `undefined` as last item.
paths.pop();
}
this._modulePathCache[from] = paths;
}
return this._modulePathCache[from];
}
getModuleID(virtualMocks, from, _moduleName) {
const moduleName = _moduleName || '';
const key = from + (_path || _load_path()).default.delimiter + moduleName;
if (this._moduleIDCache[key]) {
return this._moduleIDCache[key];
}
const moduleType = this._getModuleType(moduleName);
const absolutePath = this._getAbsolutPath(virtualMocks, from, moduleName);
const mockPath = this._getMockPath(from, moduleName);
const sep = (_path || _load_path()).default.delimiter;
const id = moduleType + sep + (absolutePath ? absolutePath + sep : '') + (mockPath ? mockPath + sep : '');
return this._moduleIDCache[key] = id;
}
_getModuleType(moduleName) {
return this.isCoreModule(moduleName) ? 'node' : 'user';
}
_getAbsolutPath(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 || _load_path()).default.dirname(from);
const paths = this._options.modulePaths;
const extensions = this._options.extensions;
const moduleDirectory = this._options.moduleDirectories;
const moduleNameMapper = this._options.moduleNameMapper;
const resolver = this._options.resolver;
if (moduleNameMapper) {
for (const _ref of moduleNameMapper) {
const mappedModuleName = _ref.moduleName;
const regex = _ref.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) {
const error = new Error((_chalk || _load_chalk()).default.red(`${(_chalk || _load_chalk()).default.bold('Configuration error')}:
Could not locate module ${(_chalk || _load_chalk()).default.bold(moduleName)} (mapped as ${(_chalk || _load_chalk()).default.bold(updatedName)})
Please check:
"moduleNameMapper": {
"${regex.toString()}": "${(_chalk || _load_chalk()).default.bold(mappedModuleName)}"
},
"resolver": ${(_chalk || _load_chalk()).default.bold(resolver)}`));
error.stack = '';
throw error;
}
return module;
}
}
}
if (resolver) {
// if moduleNameMapper didn't match anything, fallback to just the
// regular resolver
const module = this.getModule(moduleName) || Resolver.findNodeModule(moduleName, {
basedir: dirname,
browser: this._options.browser,
extensions,
moduleDirectory,
paths,
resolver,
rootDir: this._options.rootDir
});
return module;
}
return null;
}
_supportsNativePlatform() {
return (this._options.platforms || []).indexOf(NATIVE_PLATFORM) !== -1;
}
}
module.exports = Resolver;

27
node_modules/jest-resolve/build/is_builtin_module.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isBuiltinModule;
var _module;
function _load_module() {
return _module = require('module');
}
// https://github.com/facebook/flow/pull/5160
const BUILTIN_MODULES = (_module || _load_module()).builtinModules || Object.keys(process.binding('natives')).filter(module => !/^internal\//.test(module)); /**
* Copyright (c) 2014-present, Facebook, Inc. 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.
*
*
*/
// $FlowFixMe: Flow doesn't know about the `module` module
function isBuiltinModule(module) {
return BUILTIN_MODULES.indexOf(module) !== -1;
}

55
node_modules/jest-resolve/build/node_modules_paths.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = nodeModulesPaths;
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. 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 ? [].concat(options.moduleDirectory) : ['node_modules'];
// ensure that `basedir` is an absolute path at this point,
// resolving against the process' current working directory
const basedirAbs = (_path || _load_path()).default.resolve(basedir);
let prefix = '/';
if (/^([A-Za-z]:)/.test(basedirAbs)) {
prefix = '';
} else if (/^\\\\/.test(basedirAbs)) {
prefix = '\\\\';
}
const paths = [basedirAbs];
let parsed = (_path || _load_path()).default.parse(basedirAbs);
while (parsed.dir !== paths[paths.length - 1]) {
paths.push(parsed.dir);
parsed = (_path || _load_path()).default.parse(parsed.dir);
}
const dirs = paths.reduce((dirs, aPath) => {
return dirs.concat(modules.map(moduleDir => {
return (_path || _load_path()).default.isAbsolute(moduleDir) ? aPath === basedirAbs ? moduleDir : '' : (_path || _load_path()).default.join(prefix, aPath, moduleDir);
}));
}, []).filter(dir => dir !== '');
return options.paths ? dirs.concat(options.paths) : dirs;
}