Add node modules and compiled JavaScript from main
This commit is contained in:
parent
8bccaeaf7c
commit
4181bfdf50
7465 changed files with 1775003 additions and 2 deletions
21
node_modules/jest-changed-files/LICENSE
generated
vendored
Normal file
21
node_modules/jest-changed-files/LICENSE
generated
vendored
Normal 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.
|
63
node_modules/jest-changed-files/README.md
generated
vendored
Normal file
63
node_modules/jest-changed-files/README.md
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
# jest-changed-files
|
||||
|
||||
A module used internally by Jest to check which files have changed since you last committed in git or hg.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save jest-changed-files
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `getChangedFilesForRoots(roots: <Array<string>>, options: ?object): Promise<?object>`
|
||||
|
||||
Get the list of files and repos that have changed since the last commit.
|
||||
|
||||
#### Parameters
|
||||
|
||||
roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration.html#roots-array-string).
|
||||
|
||||
options: Object literal with keys
|
||||
|
||||
- lastCommit: boolean
|
||||
- withAncestor: boolean
|
||||
|
||||
### findRepos(roots: <Array<string>>): Promise<?object>
|
||||
|
||||
Get a set of git and hg repositories.
|
||||
|
||||
#### Parameters
|
||||
|
||||
roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration.html#roots-array-string).
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import {getChangedFilesForRoots} from 'jest-changed-files';
|
||||
|
||||
getChangedFilesForRoots(['/path/to/test'], {
|
||||
lastCommit: true,
|
||||
withAncestor: true,
|
||||
}).then(files => {
|
||||
/*
|
||||
{
|
||||
repos: [],
|
||||
changedFiles: []
|
||||
}
|
||||
*/
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
import {findRepos} from 'jest-changed-files';
|
||||
|
||||
findRepos(['/path/to/test']).then(repos => {
|
||||
/*
|
||||
{
|
||||
git: Set<Path>,
|
||||
hg: Set<Path>
|
||||
}
|
||||
*/
|
||||
});
|
||||
```
|
10
node_modules/jest-changed-files/build/git.d.ts
generated
vendored
Normal file
10
node_modules/jest-changed-files/build/git.d.ts
generated
vendored
Normal 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 type { SCMAdapter } from './types';
|
||||
declare const adapter: SCMAdapter;
|
||||
export default adapter;
|
168
node_modules/jest-changed-files/build/git.js
generated
vendored
Normal file
168
node_modules/jest-changed-files/build/git.js
generated
vendored
Normal file
|
@ -0,0 +1,168 @@
|
|||
'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 _execa() {
|
||||
const data = _interopRequireDefault(require('execa'));
|
||||
|
||||
_execa = 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 findChangedFilesUsingCommand = async (args, cwd) => {
|
||||
let result;
|
||||
|
||||
try {
|
||||
result = await (0, _execa().default)('git', args, {
|
||||
cwd
|
||||
});
|
||||
} catch (e) {
|
||||
// TODO: Should we keep the original `message`?
|
||||
e.message = e.stderr;
|
||||
throw e;
|
||||
}
|
||||
|
||||
return result.stdout
|
||||
.split('\n')
|
||||
.filter(s => s !== '')
|
||||
.map(changedPath => path().resolve(cwd, changedPath));
|
||||
};
|
||||
|
||||
const adapter = {
|
||||
findChangedFiles: async (cwd, options) => {
|
||||
const changedSince =
|
||||
options && (options.withAncestor ? 'HEAD^' : options.changedSince);
|
||||
const includePaths = (
|
||||
(options && options.includePaths) ||
|
||||
[]
|
||||
).map(absoluteRoot => path().normalize(path().relative(cwd, absoluteRoot)));
|
||||
|
||||
if (options && options.lastCommit) {
|
||||
return findChangedFilesUsingCommand(
|
||||
['show', '--name-only', '--pretty=format:', 'HEAD'].concat(
|
||||
includePaths
|
||||
),
|
||||
cwd
|
||||
);
|
||||
}
|
||||
|
||||
if (changedSince) {
|
||||
const [committed, staged, unstaged] = await Promise.all([
|
||||
findChangedFilesUsingCommand(
|
||||
['diff', '--name-only', `${changedSince}...HEAD`].concat(
|
||||
includePaths
|
||||
),
|
||||
cwd
|
||||
),
|
||||
findChangedFilesUsingCommand(
|
||||
['diff', '--cached', '--name-only'].concat(includePaths),
|
||||
cwd
|
||||
),
|
||||
findChangedFilesUsingCommand(
|
||||
['ls-files', '--other', '--modified', '--exclude-standard'].concat(
|
||||
includePaths
|
||||
),
|
||||
cwd
|
||||
)
|
||||
]);
|
||||
return [...committed, ...staged, ...unstaged];
|
||||
}
|
||||
|
||||
const [staged, unstaged] = await Promise.all([
|
||||
findChangedFilesUsingCommand(
|
||||
['diff', '--cached', '--name-only'].concat(includePaths),
|
||||
cwd
|
||||
),
|
||||
findChangedFilesUsingCommand(
|
||||
['ls-files', '--other', '--modified', '--exclude-standard'].concat(
|
||||
includePaths
|
||||
),
|
||||
cwd
|
||||
)
|
||||
]);
|
||||
return [...staged, ...unstaged];
|
||||
},
|
||||
getRoot: async cwd => {
|
||||
const options = ['rev-parse', '--show-cdup'];
|
||||
|
||||
try {
|
||||
const result = await (0, _execa().default)('git', options, {
|
||||
cwd
|
||||
});
|
||||
return path().resolve(cwd, result.stdout);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
var _default = adapter;
|
||||
exports.default = _default;
|
10
node_modules/jest-changed-files/build/hg.d.ts
generated
vendored
Normal file
10
node_modules/jest-changed-files/build/hg.d.ts
generated
vendored
Normal 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 type { SCMAdapter } from './types';
|
||||
declare const adapter: SCMAdapter;
|
||||
export default adapter;
|
127
node_modules/jest-changed-files/build/hg.js
generated
vendored
Normal file
127
node_modules/jest-changed-files/build/hg.js
generated
vendored
Normal file
|
@ -0,0 +1,127 @@
|
|||
'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 _execa() {
|
||||
const data = _interopRequireDefault(require('execa'));
|
||||
|
||||
_execa = 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 env = {...process.env, HGPLAIN: '1'};
|
||||
const adapter = {
|
||||
findChangedFiles: async (cwd, options) => {
|
||||
const includePaths = (options && options.includePaths) || [];
|
||||
const args = ['status', '-amnu'];
|
||||
|
||||
if (options && options.withAncestor) {
|
||||
args.push('--rev', `min((!public() & ::.)+.)^`);
|
||||
} else if (options && options.changedSince) {
|
||||
args.push('--rev', `ancestor(., ${options.changedSince})`);
|
||||
} else if (options && options.lastCommit === true) {
|
||||
args.push('--change', '.');
|
||||
}
|
||||
|
||||
args.push(...includePaths);
|
||||
let result;
|
||||
|
||||
try {
|
||||
result = await (0, _execa().default)('hg', args, {
|
||||
cwd,
|
||||
env
|
||||
});
|
||||
} catch (e) {
|
||||
// TODO: Should we keep the original `message`?
|
||||
e.message = e.stderr;
|
||||
throw e;
|
||||
}
|
||||
|
||||
return result.stdout
|
||||
.split('\n')
|
||||
.filter(s => s !== '')
|
||||
.map(changedPath => path().resolve(cwd, changedPath));
|
||||
},
|
||||
getRoot: async cwd => {
|
||||
try {
|
||||
const result = await (0, _execa().default)('hg', ['root'], {
|
||||
cwd,
|
||||
env
|
||||
});
|
||||
return result.stdout;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
var _default = adapter;
|
||||
exports.default = _default;
|
12
node_modules/jest-changed-files/build/index.d.ts
generated
vendored
Normal file
12
node_modules/jest-changed-files/build/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* 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 { ChangedFilesPromise, Options, Repos } from './types';
|
||||
export type { ChangedFiles, ChangedFilesPromise } from './types';
|
||||
export declare const getChangedFilesForRoots: (roots: Array<Config.Path>, options: Options) => ChangedFilesPromise;
|
||||
export declare const findRepos: (roots: Array<Config.Path>) => Promise<Repos>;
|
86
node_modules/jest-changed-files/build/index.js
generated
vendored
Normal file
86
node_modules/jest-changed-files/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.findRepos = exports.getChangedFilesForRoots = void 0;
|
||||
|
||||
function _throat() {
|
||||
const data = _interopRequireDefault(require('throat'));
|
||||
|
||||
_throat = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _git = _interopRequireDefault(require('./git'));
|
||||
|
||||
var _hg = _interopRequireDefault(require('./hg'));
|
||||
|
||||
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 notEmpty(value) {
|
||||
return value != null;
|
||||
} // This is an arbitrary number. The main goal is to prevent projects with
|
||||
// many roots (50+) from spawning too many processes at once.
|
||||
|
||||
const mutex = (0, _throat().default)(5);
|
||||
|
||||
const findGitRoot = dir => mutex(() => _git.default.getRoot(dir));
|
||||
|
||||
const findHgRoot = dir => mutex(() => _hg.default.getRoot(dir));
|
||||
|
||||
const getChangedFilesForRoots = async (roots, options) => {
|
||||
const repos = await findRepos(roots);
|
||||
const changedFilesOptions = {
|
||||
includePaths: roots,
|
||||
...options
|
||||
};
|
||||
const gitPromises = Array.from(repos.git).map(repo =>
|
||||
_git.default.findChangedFiles(repo, changedFilesOptions)
|
||||
);
|
||||
const hgPromises = Array.from(repos.hg).map(repo =>
|
||||
_hg.default.findChangedFiles(repo, changedFilesOptions)
|
||||
);
|
||||
const changedFiles = (
|
||||
await Promise.all(gitPromises.concat(hgPromises))
|
||||
).reduce((allFiles, changedFilesInTheRepo) => {
|
||||
for (const file of changedFilesInTheRepo) {
|
||||
allFiles.add(file);
|
||||
}
|
||||
|
||||
return allFiles;
|
||||
}, new Set());
|
||||
return {
|
||||
changedFiles,
|
||||
repos
|
||||
};
|
||||
};
|
||||
|
||||
exports.getChangedFilesForRoots = getChangedFilesForRoots;
|
||||
|
||||
const findRepos = async roots => {
|
||||
const gitRepos = await Promise.all(
|
||||
roots.reduce((promises, root) => promises.concat(findGitRoot(root)), [])
|
||||
);
|
||||
const hgRepos = await Promise.all(
|
||||
roots.reduce((promises, root) => promises.concat(findHgRoot(root)), [])
|
||||
);
|
||||
return {
|
||||
git: new Set(gitRepos.filter(notEmpty)),
|
||||
hg: new Set(hgRepos.filter(notEmpty))
|
||||
};
|
||||
};
|
||||
|
||||
exports.findRepos = findRepos;
|
28
node_modules/jest-changed-files/build/types.d.ts
generated
vendored
Normal file
28
node_modules/jest-changed-files/build/types.d.ts
generated
vendored
Normal 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 type { Config } from '@jest/types';
|
||||
export declare type Options = {
|
||||
lastCommit?: boolean;
|
||||
withAncestor?: boolean;
|
||||
changedSince?: string;
|
||||
includePaths?: Array<Config.Path>;
|
||||
};
|
||||
declare type Paths = Set<Config.Path>;
|
||||
export declare type Repos = {
|
||||
git: Paths;
|
||||
hg: Paths;
|
||||
};
|
||||
export declare type ChangedFiles = {
|
||||
repos: Repos;
|
||||
changedFiles: Paths;
|
||||
};
|
||||
export declare type ChangedFilesPromise = Promise<ChangedFiles>;
|
||||
export declare type SCMAdapter = {
|
||||
findChangedFiles: (cwd: Config.Path, options: Options) => Promise<Array<Config.Path>>;
|
||||
getRoot: (cwd: Config.Path) => Promise<Config.Path | null>;
|
||||
};
|
||||
export {};
|
1
node_modules/jest-changed-files/build/types.js
generated
vendored
Normal file
1
node_modules/jest-changed-files/build/types.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
24
node_modules/jest-changed-files/package.json
generated
vendored
Normal file
24
node_modules/jest-changed-files/package.json
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "jest-changed-files",
|
||||
"version": "26.6.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/jest.git",
|
||||
"directory": "packages/jest-changed-files"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"dependencies": {
|
||||
"@jest/types": "^26.6.2",
|
||||
"execa": "^4.0.0",
|
||||
"throat": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.14.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue