Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,4 @@
**/__mocks__/**
**/__tests__/**
src
yarn.lock

View File

@@ -0,0 +1,124 @@
'use strict';var _require =
require('jest-regex-util');const replacePathSepForRegex = _require.replacePathSepForRegex; /**
* Copyright (c) 2014, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/const snapshotDirRegex = new RegExp(replacePathSepForRegex('\/__snapshots__\/'));const snapshotFileRegex = new RegExp(replacePathSepForRegex('__snapshots__\/(.*)\.snap'));const isSnapshotPath = path =>
!!path.match(snapshotDirRegex);
function compact(array) {
const result = [];
for (let i = 0; i < array.length; ++i) {
const element = array[i];
if (element != null) {
result.push(element);
}
}
return result;
}
/**
* DependencyResolver is used to resolve the direct dependencies of a module or
* to retrieve a list of all transitive inverse dependencies.
*/
class DependencyResolver {
constructor(resolver, hasteFS) {
this._resolver = resolver;
this._hasteFS = hasteFS;
}
resolve(file, options) {
const dependencies = this._hasteFS.getDependencies(file);
if (!dependencies) {
return [];
}
return compact(
dependencies.map(dependency => {
if (this._resolver.isCoreModule(dependency)) {
return null;
}
try {
return this._resolver.resolveModule(file, dependency, options);
} catch (e) {}
return this._resolver.getMockModule(file, dependency) || null;
}));
}
resolveInverse(
paths,
filter,
options)
{
const collectModules = (relatedPaths, moduleMap, changed) => {
const visitedModules = new Set();
while (changed.size) {
changed = new Set(
moduleMap.
filter(
module =>
!visitedModules.has(module.file) &&
module.dependencies.some(dep => dep && changed.has(dep))).
map(module => {
const file = module.file;
if (filter(file)) {
relatedPaths.add(file);
}
visitedModules.add(file);
return module.file;
}));
}
return relatedPaths;
};
if (!paths.size) {
return [];
}
const relatedPaths = new Set();
const changed = new Set();
for (const path of paths) {
if (this._hasteFS.exists(path)) {
// /path/to/__snapshots__/test.js.snap is always adjacent to
// /path/to/test.js
const modulePath = isSnapshotPath(path) ?
path.replace(snapshotFileRegex, '$1') :
path;
changed.add(modulePath);
if (filter(modulePath)) {
relatedPaths.add(modulePath);
}
}
}
const modules = this._hasteFS.getAllFiles().map(file => ({
dependencies: this.resolve(file, options),
file }));
return Array.from(collectModules(relatedPaths, modules, changed));
}}
module.exports = DependencyResolver;

View File

@@ -0,0 +1,45 @@
{
"_args": [
[
"jest-resolve-dependencies@20.0.3",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "jest-resolve-dependencies@20.0.3",
"_id": "jest-resolve-dependencies@20.0.3",
"_inBundle": false,
"_integrity": "sha1-bhSntxevDyyzZnxUneQK8Bexcjo=",
"_location": "/react-scripts/jest-resolve-dependencies",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "jest-resolve-dependencies@20.0.3",
"name": "jest-resolve-dependencies",
"escapedName": "jest-resolve-dependencies",
"rawSpec": "20.0.3",
"saveSpec": null,
"fetchSpec": "20.0.3"
},
"_requiredBy": [
"/react-scripts/jest/jest-cli"
],
"_resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-20.0.3.tgz",
"_spec": "20.0.3",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"dependencies": {
"jest-regex-util": "^20.0.3"
},
"homepage": "https://github.com/facebook/jest#readme",
"license": "BSD-3-Clause",
"main": "build/index.js",
"name": "jest-resolve-dependencies",
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/jest.git"
},
"version": "20.0.3"
}