@jest/transform
Advanced tools
Comparing version 30.0.0-alpha.2 to 30.0.0-alpha.3
@@ -167,5 +167,5 @@ /*! | ||
if (transformerCacheKey != null) { | ||
return (0, _crypto().createHash)('sha1').update(transformerCacheKey).update(CACHE_VERSION).digest('hex').substring(0, 32); | ||
return (0, _crypto().createHash)('sha1').update(transformerCacheKey).update(CACHE_VERSION).digest('hex').slice(0, 32); | ||
} | ||
return (0, _crypto().createHash)('sha1').update(fileData).update(transformOptions.configString).update(transformOptions.instrument ? 'instrument' : '').update(filename).update(CACHE_VERSION).digest('hex').substring(0, 32); | ||
return (0, _crypto().createHash)('sha1').update(fileData).update(transformOptions.configString).update(transformOptions.instrument ? 'instrument' : '').update(filename).update(CACHE_VERSION).digest('hex').slice(0, 32); | ||
} | ||
@@ -222,3 +222,3 @@ _buildTransformCacheKey(pattern, filepath) { | ||
const cacheDir = path().join(baseCacheDir, cacheKey[0] + cacheKey[1]); | ||
const cacheFilenamePrefix = path().basename(filename, path().extname(filename)).replace(/\W/g, ''); | ||
const cacheFilenamePrefix = path().basename(filename, path().extname(filename)).replaceAll(/\W/g, ''); | ||
return (0, _slash().default)(path().join(cacheDir, `${cacheFilenamePrefix}_${cacheKey}`)); | ||
@@ -239,4 +239,4 @@ } | ||
} | ||
for (let i = 0; i < transformEntry.length; i++) { | ||
const [transformRegExp, transformPath] = transformEntry[i]; | ||
for (const item of transformEntry) { | ||
const [transformRegExp, transformPath] = item; | ||
if (transformRegExp.test(filename)) { | ||
@@ -265,3 +265,3 @@ return [transformRegExp.source, transformPath]; | ||
if (typeof transformer.process !== 'function' && typeof transformer.processAsync !== 'function') { | ||
throw new Error((0, _runtimeErrorsAndWarnings.makeInvalidTransformerError)(transformPath)); | ||
throw new TypeError((0, _runtimeErrorsAndWarnings.makeInvalidTransformerError)(transformPath)); | ||
} | ||
@@ -495,7 +495,7 @@ const res = { | ||
}; | ||
} catch (e) { | ||
if (!(e instanceof Error)) { | ||
throw e; | ||
} catch (error) { | ||
if (!(error instanceof Error)) { | ||
throw error; | ||
} | ||
throw (0, _enhanceUnexpectedTokenMessage.default)(e); | ||
throw (0, _enhanceUnexpectedTokenMessage.default)(error); | ||
} | ||
@@ -527,7 +527,7 @@ } | ||
}; | ||
} catch (e) { | ||
if (!(e instanceof Error)) { | ||
throw e; | ||
} catch (error) { | ||
if (!(error instanceof Error)) { | ||
throw error; | ||
} | ||
throw (0, _enhanceUnexpectedTokenMessage.default)(e); | ||
throw (0, _enhanceUnexpectedTokenMessage.default)(error); | ||
} | ||
@@ -583,10 +583,12 @@ } | ||
} | ||
async requireAndTranspileModule(moduleName, callback, options = { | ||
applyInteropRequireDefault: true, | ||
instrument: false, | ||
supportsDynamicImport: false, | ||
supportsExportNamespaceFrom: false, | ||
supportsStaticESM: false, | ||
supportsTopLevelAwait: false | ||
}) { | ||
async requireAndTranspileModule(moduleName, callback, options) { | ||
options = { | ||
applyInteropRequireDefault: true, | ||
instrument: false, | ||
supportsDynamicImport: false, | ||
supportsExportNamespaceFrom: false, | ||
supportsStaticESM: false, | ||
supportsTopLevelAwait: false, | ||
...options | ||
}; | ||
let transforming = false; | ||
@@ -679,3 +681,3 @@ const { | ||
function writeCodeCacheFile(cachePath, code) { | ||
const checksum = (0, _crypto().createHash)('sha1').update(code).digest('hex').substring(0, 32); | ||
const checksum = (0, _crypto().createHash)('sha1').update(code).digest('hex').slice(0, 32); | ||
writeCacheFile(cachePath, `${checksum}\n${code}`); | ||
@@ -695,5 +697,5 @@ } | ||
} | ||
const code = content.substring(33); | ||
const checksum = (0, _crypto().createHash)('sha1').update(code).digest('hex').substring(0, 32); | ||
if (checksum === content.substring(0, 32)) { | ||
const code = content.slice(33); | ||
const checksum = (0, _crypto().createHash)('sha1').update(code).digest('hex').slice(0, 32); | ||
if (checksum === content.slice(0, 32)) { | ||
return code; | ||
@@ -716,12 +718,12 @@ } | ||
}); | ||
} catch (e) { | ||
if (!(e instanceof Error)) { | ||
throw e; | ||
} catch (error) { | ||
if (!(error instanceof Error)) { | ||
throw error; | ||
} | ||
if (cacheWriteErrorSafeToIgnore(e, cachePath)) { | ||
if (cacheWriteErrorSafeToIgnore(error, cachePath)) { | ||
return; | ||
} | ||
e.message = `jest: failed to cache transform results in: ${cachePath}\nFailure message: ${e.message}`; | ||
error.message = `jest: failed to cache transform results in: ${cachePath}\nFailure message: ${error.message}`; | ||
removeFile(cachePath); | ||
throw e; | ||
throw error; | ||
} | ||
@@ -744,14 +746,14 @@ }; | ||
fileData = fs().readFileSync(cachePath, 'utf8'); | ||
} catch (e) { | ||
if (!(e instanceof Error)) { | ||
throw e; | ||
} catch (error) { | ||
if (!(error instanceof Error)) { | ||
throw error; | ||
} | ||
// on windows write-file-atomic is not atomic which can | ||
// result in this error | ||
if (e.code === 'ENOENT' && process.platform === 'win32') { | ||
if (error.code === 'ENOENT' && process.platform === 'win32') { | ||
return null; | ||
} | ||
e.message = `jest: failed to read cache file: ${cachePath}\nFailure message: ${e.message}`; | ||
error.message = `jest: failed to read cache file: ${cachePath}\nFailure message: ${error.message}`; | ||
removeFile(cachePath); | ||
throw e; | ||
throw error; | ||
} | ||
@@ -780,4 +782,4 @@ if (fileData == null) { | ||
const transformRegexp = []; | ||
for (let i = 0; i < config.transform.length; i++) { | ||
transformRegexp.push([new RegExp(config.transform[i][0]), config.transform[i][1], config.transform[i][2]]); | ||
for (const item of config.transform) { | ||
transformRegexp.push([new RegExp(item[0]), item[1], item[2]]); | ||
} | ||
@@ -858,3 +860,3 @@ return transformRegexp; | ||
${e.stack ?? ''}`.trimRight(); | ||
${e.stack ?? ''}`.trimEnd(); | ||
return e; | ||
@@ -896,3 +898,3 @@ } | ||
const BULLET = '\u25cf '; | ||
const BULLET = '\u25CF '; | ||
const DOCUMENTATION_NOTE = ` ${_chalk().default.bold('Code Transformation Documentation:')} | ||
@@ -997,3 +999,3 @@ https://jestjs.io/docs/code-transformation | ||
} | ||
if (config.coveragePathIgnorePatterns.some(pattern => !!filename.match(pattern))) { | ||
if (config.coveragePathIgnorePatterns.some(pattern => new RegExp(pattern).test(filename))) { | ||
return false; | ||
@@ -1035,3 +1037,3 @@ } | ||
module.exports = JSON.parse('{"name":"@jest/transform","version":"30.0.0-alpha.1","repository":{"type":"git","url":"https://github.com/jestjs/jest.git","directory":"packages/jest-transform"},"license":"MIT","main":"./build/index.js","types":"./build/index.d.ts","exports":{".":{"types":"./build/index.d.ts","require":"./build/index.js","import":"./build/index.mjs","default":"./build/index.js"},"./package.json":"./package.json"},"dependencies":{"@babel/core":"^7.11.6","@jest/types":"workspace:*","@jridgewell/trace-mapping":"^0.3.18","babel-plugin-istanbul":"^6.1.1","chalk":"^4.0.0","convert-source-map":"^2.0.0","fast-json-stable-stringify":"^2.1.0","graceful-fs":"^4.2.9","jest-haste-map":"workspace:*","jest-regex-util":"workspace:*","jest-util":"workspace:*","micromatch":"^4.0.4","pirates":"^4.0.4","slash":"^3.0.0","write-file-atomic":"^5.0.0"},"devDependencies":{"@jest/test-utils":"workspace:*","@types/babel__core":"^7.1.14","@types/convert-source-map":"^2.0.0","@types/graceful-fs":"^4.1.3","@types/micromatch":"^4.0.1","@types/write-file-atomic":"^4.0.0","dedent":"^1.0.0"},"engines":{"node":"^16.10.0 || ^18.12.0 || >=20.0.0"},"publishConfig":{"access":"public"}}'); | ||
module.exports = JSON.parse('{"name":"@jest/transform","version":"30.0.0-alpha.2","repository":{"type":"git","url":"https://github.com/jestjs/jest.git","directory":"packages/jest-transform"},"license":"MIT","main":"./build/index.js","types":"./build/index.d.ts","exports":{".":{"types":"./build/index.d.ts","require":"./build/index.js","import":"./build/index.mjs","default":"./build/index.js"},"./package.json":"./package.json"},"dependencies":{"@babel/core":"^7.11.6","@jest/types":"workspace:*","@jridgewell/trace-mapping":"^0.3.18","babel-plugin-istanbul":"^6.1.1","chalk":"^4.0.0","convert-source-map":"^2.0.0","fast-json-stable-stringify":"^2.1.0","graceful-fs":"^4.2.9","jest-haste-map":"workspace:*","jest-regex-util":"workspace:*","jest-util":"workspace:*","micromatch":"^4.0.4","pirates":"^4.0.4","slash":"^3.0.0","write-file-atomic":"^5.0.0"},"devDependencies":{"@jest/test-utils":"workspace:*","@types/babel__core":"^7.1.14","@types/convert-source-map":"^2.0.0","@types/graceful-fs":"^4.1.3","@types/micromatch":"^4.0.1","@types/write-file-atomic":"^4.0.0","dedent":"^1.0.0"},"engines":{"node":"^16.10.0 || ^18.12.0 || >=20.0.0"},"publishConfig":{"access":"public"}}'); | ||
@@ -1038,0 +1040,0 @@ /***/ }) |
{ | ||
"name": "@jest/transform", | ||
"version": "30.0.0-alpha.2", | ||
"version": "30.0.0-alpha.3", | ||
"repository": { | ||
@@ -23,3 +23,3 @@ "type": "git", | ||
"@babel/core": "^7.11.6", | ||
"@jest/types": "30.0.0-alpha.2", | ||
"@jest/types": "30.0.0-alpha.3", | ||
"@jridgewell/trace-mapping": "^0.3.18", | ||
@@ -31,5 +31,5 @@ "babel-plugin-istanbul": "^6.1.1", | ||
"graceful-fs": "^4.2.9", | ||
"jest-haste-map": "30.0.0-alpha.2", | ||
"jest-regex-util": "30.0.0-alpha.2", | ||
"jest-util": "30.0.0-alpha.2", | ||
"jest-haste-map": "30.0.0-alpha.3", | ||
"jest-regex-util": "30.0.0-alpha.3", | ||
"jest-util": "30.0.0-alpha.3", | ||
"micromatch": "^4.0.4", | ||
@@ -41,3 +41,3 @@ "pirates": "^4.0.4", | ||
"devDependencies": { | ||
"@jest/test-utils": "30.0.0-alpha.2", | ||
"@jest/test-utils": "30.0.0-alpha.3", | ||
"@types/babel__core": "^7.1.14", | ||
@@ -56,3 +56,3 @@ "@types/convert-source-map": "^2.0.0", | ||
}, | ||
"gitHead": "c04d13d7abd22e47b0997f6027886aed225c9ce4" | ||
"gitHead": "e267aff33d105399f2134bad7c8f82285104f3da" | ||
} |
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
53197
1274
+ Added@jest/schemas@30.0.0-alpha.3(transitive)
+ Added@jest/types@30.0.0-alpha.3(transitive)
+ Added@sinclair/typebox@0.32.35(transitive)
+ Addedjest-haste-map@30.0.0-alpha.3(transitive)
+ Addedjest-regex-util@30.0.0-alpha.3(transitive)
+ Addedjest-util@30.0.0-alpha.3(transitive)
+ Addedjest-worker@30.0.0-alpha.3(transitive)
- Removed@jest/schemas@30.0.0-alpha.2(transitive)
- Removed@jest/types@30.0.0-alpha.2(transitive)
- Removed@sinclair/typebox@0.31.28(transitive)
- Removedjest-haste-map@30.0.0-alpha.2(transitive)
- Removedjest-regex-util@30.0.0-alpha.2(transitive)
- Removedjest-util@30.0.0-alpha.2(transitive)
- Removedjest-worker@30.0.0-alpha.2(transitive)
Updated@jest/types@30.0.0-alpha.3
Updatedjest-util@30.0.0-alpha.3