Socket
Socket
Sign inDemoInstall

@jest/create-cache-key-function

Package Overview
Dependencies
Maintainers
7
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 26.6.2 to 27.0.0-next.0

11

build/index.d.ts

@@ -9,8 +9,15 @@ /**

import type { Config } from '@jest/types';
declare type CacheKeyOptions = {
declare type OldCacheKeyOptions = {
config: Config.ProjectConfig;
instrument: boolean;
};
declare type GetCacheKeyFunction = (fileData: string, filePath: Config.Path, configStr: string, options: CacheKeyOptions) => string;
declare type NewCacheKeyOptions = {
config: Config.ProjectConfig;
configString: string;
instrument: boolean;
};
declare type OldGetCacheKeyFunction = (fileData: string, filePath: Config.Path, configStr: string, options: OldCacheKeyOptions) => string;
declare type NewGetCacheKeyFunction = (sourceText: string, sourcePath: Config.Path, options: NewCacheKeyOptions) => string;
declare type GetCacheKeyFunction = OldGetCacheKeyFunction | NewGetCacheKeyFunction;
declare const _default: (files?: Array<string>, values?: Array<string>) => GetCacheKeyFunction;
export default _default;

13

build/index.js

@@ -61,10 +61,15 @@ 'use strict';

function getCacheKeyFunction(globalCacheKey) {
return (src, file, _configString, options) => {
const {config, instrument} = options;
return (sourceText, sourcePath, configString, options) => {
// Jest 27 passes a single options bag which contains `configString` rather than as a separate argument.
// We can hide that API difference, though, so this module is usable for both jest@<27 and jest@>=27
const inferredOptions = options || configString;
const {config, instrument} = inferredOptions;
return (0, _crypto().createHash)('md5')
.update(globalCacheKey)
.update('\0', 'utf8')
.update(src)
.update(sourceText)
.update('\0', 'utf8')
.update(config.rootDir ? (0, _path().relative)(config.rootDir, file) : '')
.update(
config.rootDir ? (0, _path().relative)(config.rootDir, sourcePath) : ''
)
.update('\0', 'utf8')

@@ -71,0 +76,0 @@ .update(instrument ? 'instrument' : '')

{
"name": "@jest/create-cache-key-function",
"version": "26.6.2",
"version": "27.0.0-next.0",
"repository": {

@@ -10,3 +10,3 @@ "type": "git",

"dependencies": {
"@jest/types": "^26.6.2"
"@jest/types": "^27.0.0-next.0"
},

@@ -17,11 +17,15 @@ "devDependencies": {

"engines": {
"node": ">= 10.14.2"
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
},
"license": "MIT",
"main": "build/index.js",
"types": "build/index.d.ts",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": "./build/index.js",
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public"
},
"gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5"
"gitHead": "4f77c70602cab8419794f10fa39510f13baafef8"
}
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