diff options
author | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
commit | 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 (patch) | |
tree | 360f7eb50f956e2367ef38fa1fc6ac7ac5258042 /node_modules/jest-resolve-dependencies | |
parent | b500a50f1b97d93c98b36ed9a980f8188d648147 (diff) | |
download | LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.tar.gz LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.zip |
Added node_modules for the updating to work properly.
Diffstat (limited to 'node_modules/jest-resolve-dependencies')
-rw-r--r-- | node_modules/jest-resolve-dependencies/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/jest-resolve-dependencies/build/index.d.ts | 27 | ||||
-rw-r--r-- | node_modules/jest-resolve-dependencies/build/index.js | 238 | ||||
-rw-r--r-- | node_modules/jest-resolve-dependencies/package.json | 37 |
4 files changed, 323 insertions, 0 deletions
diff --git a/node_modules/jest-resolve-dependencies/LICENSE b/node_modules/jest-resolve-dependencies/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/jest-resolve-dependencies/LICENSE @@ -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. diff --git a/node_modules/jest-resolve-dependencies/build/index.d.ts b/node_modules/jest-resolve-dependencies/build/index.d.ts new file mode 100644 index 0000000..9e55786 --- /dev/null +++ b/node_modules/jest-resolve-dependencies/build/index.d.ts @@ -0,0 +1,27 @@ +/** + * 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 type { Config } from '@jest/types'; +import type { FS as HasteFS } from 'jest-haste-map'; +import type { ResolveModuleConfig, default as Resolver } from 'jest-resolve'; +import { SnapshotResolver } from 'jest-snapshot'; +export declare type ResolvedModule = { + file: Config.Path; + dependencies: Array<Config.Path>; +}; +/** + * DependencyResolver is used to resolve the direct dependencies of a module or + * to retrieve a list of all transitive inverse dependencies. + */ +export declare class DependencyResolver { + private _hasteFS; + private _resolver; + private _snapshotResolver; + constructor(resolver: Resolver, hasteFS: HasteFS, snapshotResolver: SnapshotResolver); + resolve(file: Config.Path, options?: ResolveModuleConfig): Array<Config.Path>; + resolveInverseModuleMap(paths: Set<Config.Path>, filter: (file: Config.Path) => boolean, options?: ResolveModuleConfig): Array<ResolvedModule>; + resolveInverse(paths: Set<Config.Path>, filter: (file: Config.Path) => boolean, options?: ResolveModuleConfig): Array<Config.Path>; +} diff --git a/node_modules/jest-resolve-dependencies/build/index.js b/node_modules/jest-resolve-dependencies/build/index.js new file mode 100644 index 0000000..d175152 --- /dev/null +++ b/node_modules/jest-resolve-dependencies/build/index.js @@ -0,0 +1,238 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.DependencyResolver = void 0; + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function _jestSnapshot() { + const data = require('jest-snapshot'); + + _jestSnapshot = function () { + return data; + }; + + return data; +} + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== 'function') return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function (nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== 'default' && 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; +} + +/** + * 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, snapshotResolver) { + _defineProperty(this, '_hasteFS', void 0); + + _defineProperty(this, '_resolver', void 0); + + _defineProperty(this, '_snapshotResolver', void 0); + + this._resolver = resolver; + this._hasteFS = hasteFS; + this._snapshotResolver = snapshotResolver; + } + + resolve(file, options) { + const dependencies = this._hasteFS.getDependencies(file); + + if (!dependencies) { + return []; + } + + return dependencies.reduce((acc, dependency) => { + if (this._resolver.isCoreModule(dependency)) { + return acc; + } + + let resolvedDependency; + let resolvedMockDependency; + + try { + resolvedDependency = this._resolver.resolveModule( + file, + dependency, + options + ); + } catch { + try { + resolvedDependency = this._resolver.getMockModule(file, dependency); + } catch { + // leave resolvedDependency as undefined if nothing can be found + } + } + + if (!resolvedDependency) { + return acc; + } + + acc.push(resolvedDependency); // If we resolve a dependency, then look for a mock dependency + // of the same name in that dependency's directory. + + try { + resolvedMockDependency = this._resolver.getMockModule( + resolvedDependency, + path().basename(dependency) + ); + } catch { + // leave resolvedMockDependency as undefined if nothing can be found + } + + if (resolvedMockDependency) { + const dependencyMockDir = path().resolve( + path().dirname(resolvedDependency), + '__mocks__' + ); + resolvedMockDependency = path().resolve(resolvedMockDependency); // make sure mock is in the correct directory + + if (dependencyMockDir === path().dirname(resolvedMockDependency)) { + acc.push(resolvedMockDependency); + } + } + + return acc; + }, []); + } + + resolveInverseModuleMap(paths, filter, options) { + if (!paths.size) { + return []; + } + + const collectModules = (related, moduleMap, changed) => { + const visitedModules = new Set(); + const result = []; + + while (changed.size) { + changed = new Set( + moduleMap.reduce((acc, module) => { + if ( + visitedModules.has(module.file) || + !module.dependencies.some(dep => changed.has(dep)) + ) { + return acc; + } + + const file = module.file; + + if (filter(file)) { + result.push(module); + related.delete(file); + } + + visitedModules.add(file); + acc.push(file); + return acc; + }, []) + ); + } + + return result.concat( + Array.from(related).map(file => ({ + dependencies: [], + file + })) + ); + }; + + const relatedPaths = new Set(); + const changed = new Set(); + + for (const path of paths) { + if (this._hasteFS.exists(path)) { + const modulePath = (0, _jestSnapshot().isSnapshotPath)(path) + ? this._snapshotResolver.resolveTestPath(path) + : path; + changed.add(modulePath); + + if (filter(modulePath)) { + relatedPaths.add(modulePath); + } + } + } + + const modules = []; + + for (const file of this._hasteFS.getAbsoluteFileIterator()) { + modules.push({ + dependencies: this.resolve(file, options), + file + }); + } + + return collectModules(relatedPaths, modules, changed); + } + + resolveInverse(paths, filter, options) { + return this.resolveInverseModuleMap(paths, filter, options).map( + module => module.file + ); + } +} + +exports.DependencyResolver = DependencyResolver; diff --git a/node_modules/jest-resolve-dependencies/package.json b/node_modules/jest-resolve-dependencies/package.json new file mode 100644 index 0000000..4739dbc --- /dev/null +++ b/node_modules/jest-resolve-dependencies/package.json @@ -0,0 +1,37 @@ +{ + "name": "jest-resolve-dependencies", + "version": "27.5.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-resolve-dependencies" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "@jest/types": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-snapshot": "^27.5.1" + }, + "devDependencies": { + "@jest/test-utils": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-runtime": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} |