jest-changed-files
Advanced tools
Comparing version 29.7.0 to 30.0.0-alpha.1
@@ -1,9 +0,321 @@ | ||
'use strict'; | ||
/*! | ||
* /** | ||
* * 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. | ||
* * / | ||
*/ | ||
/******/ (() => { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ var __webpack_modules__ = ({ | ||
Object.defineProperty(exports, '__esModule', { | ||
/***/ "./src/git.ts": | ||
/***/ ((__unused_webpack_module, exports) => { | ||
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(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
/** | ||
* 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 = exports["default"] = adapter; | ||
/***/ }), | ||
/***/ "./src/hg.ts": | ||
/***/ ((__unused_webpack_module, exports) => { | ||
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(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
/** | ||
* 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 = exports["default"] = adapter; | ||
/***/ }), | ||
/***/ "./src/sl.ts": | ||
/***/ ((__unused_webpack_module, exports) => { | ||
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(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
/** | ||
* 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 = exports["default"] = adapter; | ||
/***/ }) | ||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
/******/ if (cachedModule !== undefined) { | ||
/******/ return cachedModule.exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
var __webpack_exports__ = {}; | ||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. | ||
(() => { | ||
var exports = __webpack_exports__; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.getChangedFilesForRoots = exports.findRepos = void 0; | ||
function _pLimit() { | ||
const data = _interopRequireDefault(require('p-limit')); | ||
const data = _interopRequireDefault(require("p-limit")); | ||
_pLimit = function () { | ||
@@ -15,3 +327,3 @@ return data; | ||
function _jestUtil() { | ||
const data = require('jest-util'); | ||
const data = require("jest-util"); | ||
_jestUtil = function () { | ||
@@ -22,8 +334,6 @@ 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}; | ||
} | ||
var _git = _interopRequireDefault(__webpack_require__("./src/git.ts")); | ||
var _hg = _interopRequireDefault(__webpack_require__("./src/hg.ts")); | ||
var _sl = _interopRequireDefault(__webpack_require__("./src/sl.ts")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -49,14 +359,6 @@ * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
}; | ||
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) => { | ||
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) { | ||
@@ -74,7 +376,3 @@ allFiles.add(file); | ||
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)) | ||
]); | ||
const [gitRepos, hgRepos, slRepos] = await Promise.all([Promise.all(roots.map(findGitRoot)), Promise.all(roots.map(findHgRoot)), Promise.all(roots.map(findSlRoot))]); | ||
return { | ||
@@ -87,1 +385,6 @@ git: new Set(gitRepos.filter(_jestUtil().isNonNullable)), | ||
exports.findRepos = findRepos; | ||
})(); | ||
module.exports = __webpack_exports__; | ||
/******/ })() | ||
; |
{ | ||
"name": "jest-changed-files", | ||
"version": "29.7.0", | ||
"version": "30.0.0-alpha.1", | ||
"repository": { | ||
@@ -15,2 +15,4 @@ "type": "git", | ||
"types": "./build/index.d.ts", | ||
"require": "./build/index.js", | ||
"import": "./build/index.mjs", | ||
"default": "./build/index.js" | ||
@@ -22,7 +24,7 @@ }, | ||
"execa": "^5.0.0", | ||
"jest-util": "^29.7.0", | ||
"jest-util": "30.0.0-alpha.1", | ||
"p-limit": "^3.1.0" | ||
}, | ||
"engines": { | ||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0" | ||
"node": "^16.10.0 || ^18.12.0 || >=20.0.0" | ||
}, | ||
@@ -32,3 +34,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630" | ||
"gitHead": "d005cb2505c041583e0c5636d006e08666a54b63" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
18438
6
397
2
1
+ Added@jest/schemas@30.0.0-alpha.1(transitive)
+ Added@jest/types@30.0.0-alpha.1(transitive)
+ Added@sinclair/typebox@0.31.28(transitive)
+ Addedci-info@4.0.0(transitive)
+ Addedjest-util@30.0.0-alpha.1(transitive)
- Removed@jest/schemas@29.6.3(transitive)
- Removed@jest/types@29.6.3(transitive)
- Removed@sinclair/typebox@0.27.8(transitive)
- Removedci-info@3.9.0(transitive)
- Removedjest-util@29.7.0(transitive)
Updatedjest-util@30.0.0-alpha.1