feat: initial commit
This commit is contained in:
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) Meta Platforms, Inc. and 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.
|
95
node_modules/jest-changed-files/README.md
generated
vendored
Normal file
95
node_modules/jest-changed-files/README.md
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
# 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: Options): Promise<ChangedFiles>`
|
||||
|
||||
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#roots-arraystring).
|
||||
|
||||
options: Object literal with keys
|
||||
|
||||
- lastCommit: boolean
|
||||
- withAncestor: boolean
|
||||
- changedSince: string
|
||||
|
||||
### Returns
|
||||
|
||||
A Promise of Object literal with keys
|
||||
|
||||
- changedFiles: Set\<string>
|
||||
- repos:
|
||||
- git: Set\<string>
|
||||
- hg: Set\<string>
|
||||
|
||||
### findRepos(roots: Array<string>): Promise<Repos>
|
||||
|
||||
Get a set of git and hg repositories.
|
||||
|
||||
#### Parameters
|
||||
|
||||
roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration#roots-arraystring).
|
||||
|
||||
### Returns
|
||||
|
||||
A Promise of Object literal with keys
|
||||
|
||||
- git: Set\<string>
|
||||
- hg: Set\<string>
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import {getChangedFilesForRoots} from 'jest-changed-files';
|
||||
|
||||
getChangedFilesForRoots(['/path/to/test'], {
|
||||
lastCommit: true,
|
||||
withAncestor: true,
|
||||
}).then(files => {
|
||||
/*
|
||||
{
|
||||
repos: [],
|
||||
changedFiles: []
|
||||
}
|
||||
*/
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
import {getChangedFilesForRoots} from 'jest-changed-files';
|
||||
|
||||
getChangedFilesForRoots(['/path/to/test'], {
|
||||
changedSince: 'main',
|
||||
}).then(files => {
|
||||
/*
|
||||
{
|
||||
repos: [],
|
||||
changedFiles: []
|
||||
}
|
||||
*/
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
import {findRepos} from 'jest-changed-files';
|
||||
|
||||
findRepos(['/path/to/test']).then(repos => {
|
||||
/*
|
||||
{
|
||||
git: Set<Path>,
|
||||
hg: Set<Path>
|
||||
}
|
||||
*/
|
||||
});
|
||||
```
|
169
node_modules/jest-changed-files/build/git.js
generated
vendored
Normal file
169
node_modules/jest-changed-files/build/git.js
generated
vendored
Normal file
@ -0,0 +1,169 @@
|
||||
'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 _util() {
|
||||
const data = require('util');
|
||||
_util = 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(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;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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) {
|
||||
if (_util().types.isNativeError(e)) {
|
||||
const err = e;
|
||||
// TODO: Should we keep the original `message`?
|
||||
err.message = err.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.withAncestor === true ? 'HEAD^' : options.changedSince;
|
||||
const includePaths = (options.includePaths ?? []).map(absoluteRoot =>
|
||||
path().normalize(path().relative(cwd, absoluteRoot))
|
||||
);
|
||||
if (options.lastCommit === true) {
|
||||
return findChangedFilesUsingCommand(
|
||||
['show', '--name-only', '--pretty=format:', 'HEAD', '--'].concat(
|
||||
includePaths
|
||||
),
|
||||
cwd
|
||||
);
|
||||
}
|
||||
if (changedSince != null && changedSince.length > 0) {
|
||||
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;
|
130
node_modules/jest-changed-files/build/hg.js
generated
vendored
Normal file
130
node_modules/jest-changed-files/build/hg.js
generated
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
'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 _util() {
|
||||
const data = require('util');
|
||||
_util = 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(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;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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.includePaths ?? [];
|
||||
const args = ['status', '-amnu'];
|
||||
if (options.withAncestor === true) {
|
||||
args.push('--rev', 'first(min(!public() & ::.)^+.^)');
|
||||
} else if (
|
||||
options.changedSince != null &&
|
||||
options.changedSince.length > 0
|
||||
) {
|
||||
args.push('--rev', `ancestor(., ${options.changedSince})`);
|
||||
} else if (options.lastCommit === true) {
|
||||
args.push('--change', '.');
|
||||
}
|
||||
args.push(...includePaths);
|
||||
let result;
|
||||
try {
|
||||
result = await (0, _execa().default)('hg', args, {
|
||||
cwd,
|
||||
env
|
||||
});
|
||||
} catch (e) {
|
||||
if (_util().types.isNativeError(e)) {
|
||||
const err = e;
|
||||
// TODO: Should we keep the original `message`?
|
||||
err.message = err.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;
|
36
node_modules/jest-changed-files/build/index.d.ts
generated
vendored
Normal file
36
node_modules/jest-changed-files/build/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
export declare type ChangedFiles = {
|
||||
repos: Repos;
|
||||
changedFiles: Paths;
|
||||
};
|
||||
|
||||
export declare type ChangedFilesPromise = Promise<ChangedFiles>;
|
||||
|
||||
export declare const findRepos: (roots: Array<string>) => Promise<Repos>;
|
||||
|
||||
export declare const getChangedFilesForRoots: (
|
||||
roots: Array<string>,
|
||||
options: Options,
|
||||
) => ChangedFilesPromise;
|
||||
|
||||
declare type Options = {
|
||||
lastCommit?: boolean;
|
||||
withAncestor?: boolean;
|
||||
changedSince?: string;
|
||||
includePaths?: Array<string>;
|
||||
};
|
||||
|
||||
declare type Paths = Set<string>;
|
||||
|
||||
declare type Repos = {
|
||||
git: Paths;
|
||||
hg: Paths;
|
||||
sl: Paths;
|
||||
};
|
||||
|
||||
export {};
|
82
node_modules/jest-changed-files/build/index.js
generated
vendored
Normal file
82
node_modules/jest-changed-files/build/index.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.getChangedFilesForRoots = exports.findRepos = void 0;
|
||||
function _pLimit() {
|
||||
const data = _interopRequireDefault(require('p-limit'));
|
||||
_pLimit = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _git = _interopRequireDefault(require('./git'));
|
||||
var _hg = _interopRequireDefault(require('./hg'));
|
||||
var _sl = _interopRequireDefault(require('./sl'));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
// 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, _pLimit().default)(5);
|
||||
const findGitRoot = dir => mutex(() => _git.default.getRoot(dir));
|
||||
const findHgRoot = dir => mutex(() => _hg.default.getRoot(dir));
|
||||
const findSlRoot = dir => mutex(() => _sl.default.getRoot(dir));
|
||||
const getChangedFilesForRoots = async (roots, options) => {
|
||||
const repos = await findRepos(roots);
|
||||
const changedFilesOptions = {
|
||||
includePaths: roots,
|
||||
...options
|
||||
};
|
||||
const gitPromises = Array.from(repos.git, repo =>
|
||||
_git.default.findChangedFiles(repo, changedFilesOptions)
|
||||
);
|
||||
const hgPromises = Array.from(repos.hg, repo =>
|
||||
_hg.default.findChangedFiles(repo, changedFilesOptions)
|
||||
);
|
||||
const slPromises = Array.from(repos.sl, repo =>
|
||||
_sl.default.findChangedFiles(repo, changedFilesOptions)
|
||||
);
|
||||
const changedFiles = (
|
||||
await Promise.all([...gitPromises, ...hgPromises, ...slPromises])
|
||||
).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, hgRepos, slRepos] = await Promise.all([
|
||||
Promise.all(roots.map(findGitRoot)),
|
||||
Promise.all(roots.map(findHgRoot)),
|
||||
Promise.all(roots.map(findSlRoot))
|
||||
]);
|
||||
return {
|
||||
git: new Set(gitRepos.filter(_jestUtil().isNonNullable)),
|
||||
hg: new Set(hgRepos.filter(_jestUtil().isNonNullable)),
|
||||
sl: new Set(slRepos.filter(_jestUtil().isNonNullable))
|
||||
};
|
||||
};
|
||||
exports.findRepos = findRepos;
|
134
node_modules/jest-changed-files/build/sl.js
generated
vendored
Normal file
134
node_modules/jest-changed-files/build/sl.js
generated
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
'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 _util() {
|
||||
const data = require('util');
|
||||
_util = 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(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;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Disable any configuration settings that might change Sapling's default output.
|
||||
* More info in `sl help environment`. _HG_PLAIN is intentional
|
||||
*/
|
||||
const env = {
|
||||
...process.env,
|
||||
HGPLAIN: '1'
|
||||
};
|
||||
const adapter = {
|
||||
findChangedFiles: async (cwd, options) => {
|
||||
const includePaths = options.includePaths ?? [];
|
||||
const args = ['status', '-amnu'];
|
||||
if (options.withAncestor === true) {
|
||||
args.push('--rev', 'first(min(!public() & ::.)^+.^)');
|
||||
} else if (
|
||||
options.changedSince != null &&
|
||||
options.changedSince.length > 0
|
||||
) {
|
||||
args.push('--rev', `ancestor(., ${options.changedSince})`);
|
||||
} else if (options.lastCommit === true) {
|
||||
args.push('--change', '.');
|
||||
}
|
||||
args.push(...includePaths);
|
||||
let result;
|
||||
try {
|
||||
result = await (0, _execa().default)('sl', args, {
|
||||
cwd,
|
||||
env
|
||||
});
|
||||
} catch (e) {
|
||||
if (_util().types.isNativeError(e)) {
|
||||
const err = e;
|
||||
// TODO: Should we keep the original `message`?
|
||||
err.message = err.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)('sl', ['root'], {
|
||||
cwd,
|
||||
env
|
||||
});
|
||||
return result.stdout;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
var _default = adapter;
|
||||
exports.default = _default;
|
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';
|
42
node_modules/jest-changed-files/node_modules/p-limit/index.d.ts
generated
vendored
Normal file
42
node_modules/jest-changed-files/node_modules/p-limit/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
declare namespace pLimit {
|
||||
interface Limit {
|
||||
/**
|
||||
The number of promises that are currently running.
|
||||
*/
|
||||
readonly activeCount: number;
|
||||
|
||||
/**
|
||||
The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
|
||||
*/
|
||||
readonly pendingCount: number;
|
||||
|
||||
/**
|
||||
Discard pending promises that are waiting to run.
|
||||
|
||||
This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
|
||||
|
||||
Note: This does not cancel promises that are already running.
|
||||
*/
|
||||
clearQueue: () => void;
|
||||
|
||||
/**
|
||||
@param fn - Promise-returning/async function.
|
||||
@param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions.
|
||||
@returns The promise returned by calling `fn(...arguments)`.
|
||||
*/
|
||||
<Arguments extends unknown[], ReturnType>(
|
||||
fn: (...arguments: Arguments) => PromiseLike<ReturnType> | ReturnType,
|
||||
...arguments: Arguments
|
||||
): Promise<ReturnType>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Run multiple promise-returning & async functions with limited concurrency.
|
||||
|
||||
@param concurrency - Concurrency limit. Minimum: `1`.
|
||||
@returns A `limit` function.
|
||||
*/
|
||||
declare function pLimit(concurrency: number): pLimit.Limit;
|
||||
|
||||
export = pLimit;
|
71
node_modules/jest-changed-files/node_modules/p-limit/index.js
generated
vendored
Normal file
71
node_modules/jest-changed-files/node_modules/p-limit/index.js
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
'use strict';
|
||||
const Queue = require('yocto-queue');
|
||||
|
||||
const pLimit = concurrency => {
|
||||
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
||||
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
||||
}
|
||||
|
||||
const queue = new Queue();
|
||||
let activeCount = 0;
|
||||
|
||||
const next = () => {
|
||||
activeCount--;
|
||||
|
||||
if (queue.size > 0) {
|
||||
queue.dequeue()();
|
||||
}
|
||||
};
|
||||
|
||||
const run = async (fn, resolve, ...args) => {
|
||||
activeCount++;
|
||||
|
||||
const result = (async () => fn(...args))();
|
||||
|
||||
resolve(result);
|
||||
|
||||
try {
|
||||
await result;
|
||||
} catch {}
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
const enqueue = (fn, resolve, ...args) => {
|
||||
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
||||
|
||||
(async () => {
|
||||
// This function needs to wait until the next microtask before comparing
|
||||
// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
|
||||
// when the run function is dequeued and called. The comparison in the if-statement
|
||||
// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
|
||||
await Promise.resolve();
|
||||
|
||||
if (activeCount < concurrency && queue.size > 0) {
|
||||
queue.dequeue()();
|
||||
}
|
||||
})();
|
||||
};
|
||||
|
||||
const generator = (fn, ...args) => new Promise(resolve => {
|
||||
enqueue(fn, resolve, ...args);
|
||||
});
|
||||
|
||||
Object.defineProperties(generator, {
|
||||
activeCount: {
|
||||
get: () => activeCount
|
||||
},
|
||||
pendingCount: {
|
||||
get: () => queue.size
|
||||
},
|
||||
clearQueue: {
|
||||
value: () => {
|
||||
queue.clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return generator;
|
||||
};
|
||||
|
||||
module.exports = pLimit;
|
9
node_modules/jest-changed-files/node_modules/p-limit/license
generated
vendored
Normal file
9
node_modules/jest-changed-files/node_modules/p-limit/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
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.
|
52
node_modules/jest-changed-files/node_modules/p-limit/package.json
generated
vendored
Normal file
52
node_modules/jest-changed-files/node_modules/p-limit/package.json
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "p-limit",
|
||||
"version": "3.1.0",
|
||||
"description": "Run multiple promise-returning & async functions with limited concurrency",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-limit",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"limit",
|
||||
"limited",
|
||||
"concurrency",
|
||||
"throttle",
|
||||
"throat",
|
||||
"rate",
|
||||
"batch",
|
||||
"ratelimit",
|
||||
"task",
|
||||
"queue",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"yocto-queue": "^0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"delay": "^4.4.0",
|
||||
"in-range": "^2.0.0",
|
||||
"random-int": "^2.0.1",
|
||||
"time-span": "^4.0.0",
|
||||
"tsd": "^0.13.1",
|
||||
"xo": "^0.35.0"
|
||||
}
|
||||
}
|
101
node_modules/jest-changed-files/node_modules/p-limit/readme.md
generated
vendored
Normal file
101
node_modules/jest-changed-files/node_modules/p-limit/readme.md
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
# p-limit
|
||||
|
||||
> Run multiple promise-returning & async functions with limited concurrency
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install p-limit
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pLimit = require('p-limit');
|
||||
|
||||
const limit = pLimit(1);
|
||||
|
||||
const input = [
|
||||
limit(() => fetchSomething('foo')),
|
||||
limit(() => fetchSomething('bar')),
|
||||
limit(() => doSomething())
|
||||
];
|
||||
|
||||
(async () => {
|
||||
// Only one promise is run at once
|
||||
const result = await Promise.all(input);
|
||||
console.log(result);
|
||||
})();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### pLimit(concurrency)
|
||||
|
||||
Returns a `limit` function.
|
||||
|
||||
#### concurrency
|
||||
|
||||
Type: `number`\
|
||||
Minimum: `1`\
|
||||
Default: `Infinity`
|
||||
|
||||
Concurrency limit.
|
||||
|
||||
### limit(fn, ...args)
|
||||
|
||||
Returns the promise returned by calling `fn(...args)`.
|
||||
|
||||
#### fn
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Promise-returning/async function.
|
||||
|
||||
#### args
|
||||
|
||||
Any arguments to pass through to `fn`.
|
||||
|
||||
Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions.
|
||||
|
||||
### limit.activeCount
|
||||
|
||||
The number of promises that are currently running.
|
||||
|
||||
### limit.pendingCount
|
||||
|
||||
The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
|
||||
|
||||
### limit.clearQueue()
|
||||
|
||||
Discard pending promises that are waiting to run.
|
||||
|
||||
This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
|
||||
|
||||
Note: This does not cancel promises that are already running.
|
||||
|
||||
## FAQ
|
||||
|
||||
### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package?
|
||||
|
||||
This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue.
|
||||
|
||||
## Related
|
||||
|
||||
- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control
|
||||
- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions
|
||||
- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions
|
||||
- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-p-limit?utm_source=npm-p-limit&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
31
node_modules/jest-changed-files/package.json
generated
vendored
Normal file
31
node_modules/jest-changed-files/package.json
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "jest-changed-files",
|
||||
"version": "29.7.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-changed-files"
|
||||
},
|
||||
"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": {
|
||||
"execa": "^5.0.0",
|
||||
"jest-util": "^29.7.0",
|
||||
"p-limit": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
|
||||
}
|
Reference in New Issue
Block a user