@jest/create-cache-key-function
Advanced tools
Comparing version 29.7.0 to 30.0.0-alpha.1
@@ -1,9 +0,23 @@ | ||
'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_exports__ = {}; | ||
// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). | ||
(() => { | ||
var exports = __webpack_exports__; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
}); | ||
exports.default = createCacheKey; | ||
})); | ||
exports["default"] = createCacheKey; | ||
function _crypto() { | ||
const data = require('crypto'); | ||
const data = require("crypto"); | ||
_crypto = function () { | ||
@@ -15,3 +29,3 @@ return data; | ||
function _fs() { | ||
const data = require('fs'); | ||
const data = require("fs"); | ||
_fs = function () { | ||
@@ -23,3 +37,3 @@ return data; | ||
function _path() { | ||
const data = require('path'); | ||
const data = require("path"); | ||
_path = function () { | ||
@@ -44,16 +58,8 @@ return data; | ||
const {NODE_ENV, BABEL_ENV} = process.env; | ||
const { | ||
NODE_ENV, | ||
BABEL_ENV | ||
} = process.env; | ||
function getGlobalCacheKey(files, values, length) { | ||
return [ | ||
NODE_ENV, | ||
BABEL_ENV, | ||
...values, | ||
...files.map(file => (0, _fs().readFileSync)(file)) | ||
] | ||
.reduce( | ||
(hash, chunk) => hash.update('\0', 'utf8').update(chunk || ''), | ||
(0, _crypto().createHash)('sha1') | ||
) | ||
.digest('hex') | ||
.substring(0, length); | ||
return [NODE_ENV, BABEL_ENV, ...values, ...files.map(file => (0, _fs().readFileSync)(file))].reduce((hash, chunk) => hash.update('\0', 'utf8').update(chunk || ''), (0, _crypto().createHash)('sha1')).digest('hex').substring(0, length); | ||
} | ||
@@ -65,15 +71,7 @@ function getCacheKeyFunction(globalCacheKey, length) { | ||
const inferredOptions = options || configString; | ||
const {config, instrument} = inferredOptions; | ||
return (0, _crypto().createHash)('sha1') | ||
.update(globalCacheKey) | ||
.update('\0', 'utf8') | ||
.update(sourceText) | ||
.update('\0', 'utf8') | ||
.update( | ||
config.rootDir ? (0, _path().relative)(config.rootDir, sourcePath) : '' | ||
) | ||
.update('\0', 'utf8') | ||
.update(instrument ? 'instrument' : '') | ||
.digest('hex') | ||
.substring(0, length); | ||
const { | ||
config, | ||
instrument | ||
} = inferredOptions; | ||
return (0, _crypto().createHash)('sha1').update(globalCacheKey).update('\0', 'utf8').update(sourceText).update('\0', 'utf8').update(config.rootDir ? (0, _path().relative)(config.rootDir, sourcePath) : '').update('\0', 'utf8').update(instrument ? 'instrument' : '').digest('hex').substring(0, length); | ||
}; | ||
@@ -90,8 +88,9 @@ } | ||
*/ | ||
function createCacheKey( | ||
files = [], | ||
values = [], | ||
length = process.platform === 'win32' ? 16 : 32 | ||
) { | ||
function createCacheKey(files = [], values = [], length = process.platform === 'win32' ? 16 : 32) { | ||
return getCacheKeyFunction(getGlobalCacheKey(files, values, length), length); | ||
} | ||
})(); | ||
module.exports = __webpack_exports__; | ||
/******/ })() | ||
; |
{ | ||
"name": "@jest/create-cache-key-function", | ||
"version": "29.7.0", | ||
"version": "30.0.0-alpha.1", | ||
"repository": { | ||
@@ -10,10 +10,10 @@ "type": "git", | ||
"dependencies": { | ||
"@jest/types": "^29.6.3" | ||
"@jest/types": "30.0.0-alpha.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "*", | ||
"jest-util": "^29.7.0" | ||
"jest-util": "30.0.0-alpha.1" | ||
}, | ||
"engines": { | ||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0" | ||
"node": "^16.10.0 || ^18.12.0 || >=20.0.0" | ||
}, | ||
@@ -26,2 +26,4 @@ "license": "MIT", | ||
"types": "./build/index.d.ts", | ||
"require": "./build/index.js", | ||
"import": "./build/index.mjs", | ||
"default": "./build/index.js" | ||
@@ -34,3 +36,3 @@ }, | ||
}, | ||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630" | ||
"gitHead": "d005cb2505c041583e0c5636d006e08666a54b63" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
8155
6
130
2
+ 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)
- Removed@jest/schemas@29.6.3(transitive)
- Removed@jest/types@29.6.3(transitive)
- Removed@sinclair/typebox@0.27.8(transitive)
Updated@jest/types@30.0.0-alpha.1