Socket
Socket
Sign inDemoInstall

@jest/create-cache-key-function

Package Overview
Dependencies
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jest/create-cache-key-function - npm Package Compare versions

Comparing version 29.7.0 to 30.0.0-alpha.1

build/index.mjs

75

build/index.js

@@ -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"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc