@jest/create-cache-key-function
Advanced tools
Comparing version 26.6.2 to 27.0.0-next.0
@@ -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; |
@@ -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" | ||
} |
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
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
4704
91
2
+ Added@jest/types@27.5.1(transitive)
+ Added@types/yargs@16.0.9(transitive)
- Removed@jest/types@26.6.2(transitive)
- Removed@types/yargs@15.0.19(transitive)
Updated@jest/types@^27.0.0-next.0