ts-jest
Advanced tools
Comparing version 27.1.0 to 27.1.1
import { Logger } from 'bs-logger'; | ||
import type { Diagnostic, ParsedCommandLine } from 'typescript'; | ||
import type * as ts from 'typescript'; | ||
import type { RawCompilerOptions } from '../raw-compiler-options'; | ||
@@ -15,3 +15,3 @@ import type { ProjectConfigTsJest, TsJestAstTransformer, TTypeScript } from '../types'; | ||
tsCacheDir: string | undefined; | ||
parsedTsConfig: ParsedCommandLine | Record<string, any>; | ||
parsedTsConfig: ts.ParsedCommandLine | Record<string, any>; | ||
resolvedTransformers: TsJestAstTransformer; | ||
@@ -23,3 +23,3 @@ useESM: boolean; | ||
shouldStringifyContent(filePath: string): boolean; | ||
raiseDiagnostics(diagnostics: Diagnostic[], filePath?: string, logger?: Logger): void; | ||
raiseDiagnostics(diagnostics: ts.Diagnostic[], filePath?: string, logger?: Logger): void; | ||
shouldReportDiagnostics(filePath: string): boolean; | ||
@@ -26,0 +26,0 @@ resolvePath(inputPath: string, { throwIfMissing, nodeResolve }?: { |
@@ -58,3 +58,2 @@ "use strict"; | ||
var bs_logger_1 = require("bs-logger"); | ||
var esbuild_1 = require("esbuild"); | ||
var jest_util_1 = require("jest-util"); | ||
@@ -242,3 +241,5 @@ var json5_1 = __importDefault(require("json5")); | ||
if ((0, path_1.extname)(transformerPath) === '.ts') { | ||
var compiledTransformer = (0, esbuild_1.transformSync)((0, fs_1.readFileSync)(transformerPath, 'utf-8'), { | ||
var compiledTransformer = importer_1.importer | ||
.esBuild("Using \"esbuild\" requires this package to be installed.") | ||
.transformSync((0, fs_1.readFileSync)(transformerPath, 'utf-8'), { | ||
loader: 'ts', | ||
@@ -245,0 +246,0 @@ format: 'cjs', |
@@ -85,2 +85,3 @@ "use strict"; | ||
var utils_1 = require("./utils"); | ||
var importer_1 = require("./utils/importer"); | ||
var messages_1 = require("./utils/messages"); | ||
@@ -165,2 +166,8 @@ var sha1_1 = require("./utils/sha1"); | ||
var isTsFile = !isDefinitionFile && constants_1.TS_TSX_REGEX.test(filePath); | ||
var hooksFile = process.env.TS_JEST_HOOKS; | ||
var hooks; | ||
if (hooksFile) { | ||
hooksFile = path_1.default.resolve(configs.cwd, hooksFile); | ||
hooks = importer_1.importer.tryTheseOr(hooksFile, {}); | ||
} | ||
if (shouldStringifyContent) { | ||
@@ -192,2 +199,9 @@ result = "module.exports=".concat((0, utils_1.stringify)(fileContent)); | ||
} | ||
if (hooks === null || hooks === void 0 ? void 0 : hooks.afterProcess) { | ||
this._logger.debug({ fileName: filePath, hookName: 'afterProcess' }, 'calling afterProcess hook'); | ||
var newResult = hooks.afterProcess([fileContent, filePath, transformOptions.config, transformOptions], result); | ||
if (newResult) { | ||
return newResult; | ||
} | ||
} | ||
return result; | ||
@@ -194,0 +208,0 @@ }; |
import type { TransformOptions } from '@jest/transform'; | ||
import type { Config } from '@jest/types'; | ||
import type * as _babel from 'babel__core'; | ||
import type * as _esbuild from 'esbuild'; | ||
import type * as _ts from 'typescript'; | ||
@@ -15,2 +16,3 @@ import type { ConfigSet } from './config'; | ||
export declare type TTypeScript = typeof _ts; | ||
export declare type TEsBuild = typeof _esbuild; | ||
export declare type BabelConfig = _babel.TransformOptions; | ||
@@ -17,0 +19,0 @@ export declare type TsJestPresets = Pick<Config.InitialOptions, 'extensionsToTreatAsEsm' | 'moduleFileExtensions' | 'transform' | 'testMatch'>; |
@@ -82,2 +82,5 @@ "use strict"; | ||
}; | ||
Importer.prototype.esBuild = function (why) { | ||
return this._import(why, 'esbuild'); | ||
}; | ||
Importer.prototype.tryThese = function (moduleName) { | ||
@@ -84,0 +87,0 @@ var fallbacks = []; |
{ | ||
"name": "ts-jest", | ||
"version": "27.1.0", | ||
"version": "27.1.1", | ||
"main": "dist/index.js", | ||
@@ -55,3 +55,2 @@ "types": "dist/index.d.ts", | ||
"bs-logger": "0.x", | ||
"esbuild": "~0.14.0", | ||
"fast-json-stable-stringify": "2.x", | ||
@@ -69,2 +68,3 @@ "jest-util": "^27.0.0", | ||
"babel-jest": ">=27.0.0 <28", | ||
"esbuild": "~0.14.0", | ||
"jest": "^27.0.0", | ||
@@ -74,5 +74,2 @@ "typescript": ">=3.8 <5.0" | ||
"peerDependenciesMeta": { | ||
"babel-jest": { | ||
"optional": true | ||
}, | ||
"@babel/core": { | ||
@@ -83,2 +80,8 @@ "optional": true | ||
"optional": true | ||
}, | ||
"babel-jest": { | ||
"optional": true | ||
}, | ||
"esbuild": { | ||
"optional": true | ||
} | ||
@@ -107,3 +110,3 @@ }, | ||
"@types/micromatch": "4.x", | ||
"@types/node": "16.11.11", | ||
"@types/node": "16.11.12", | ||
"@types/node-fetch": "^3.0.3", | ||
@@ -119,3 +122,4 @@ "@types/react": "17.x", | ||
"cross-spawn": "latest", | ||
"eslint": "8.3.0", | ||
"esbuild": "~0.14.2", | ||
"eslint": "8.4.1", | ||
"eslint-config-prettier": "latest", | ||
@@ -122,0 +126,0 @@ "eslint-plugin-import": "latest", |
@@ -56,3 +56,3 @@ <h1 align="center">ts-jest</h1> | ||
We **DO NOT** use [SemVer](http://semver.org/) for versioning. Though you can think about SemVer when reading our version, except our major number follows the one of Jest. For the versions available, see the [tags on this repository](https://github.com/kulshekhar/ts-jest/tags). | ||
We **DO NOT** use [SemVer](https://semver.org/) for versioning. Though you can think about SemVer when reading our version, except our major number follows the one of Jest. For the versions available, see the [tags on this repository](https://github.com/kulshekhar/ts-jest/tags). | ||
@@ -59,0 +59,0 @@ ## Authors/maintainers |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
257885
3228
48
26
- Removedesbuild@~0.14.0