ts-jest 28.0.0-next.2 → 28.0.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.ts-jest-digest CHANGED
@@ -1 +1 @@
1
- a33d3c3435f0ce0d59e132c0594636ecb76175d9
1
+ fbf09f35f81a3ca3c5993075f6e3bd4218b3feb0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # [28.0.0-next.3](https://github.com/kulshekhar/ts-jest/compare/v28.0.0-next.2...v28.0.0-next.3) (2022-04-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **compiler:** bring back compiled output with inline sourcemap ([#3483](https://github.com/kulshekhar/ts-jest/issues/3483)) ([e96d5b3](https://github.com/kulshekhar/ts-jest/commit/e96d5b3c94348774011ac76e91bf746a3429ade0)), closes [#3482](https://github.com/kulshekhar/ts-jest/issues/3482)
7
+
8
+
9
+
1
10
  # [28.0.0-next.2](https://github.com/kulshekhar/ts-jest/compare/v28.0.0-next.1...v28.0.0-next.2) (2022-04-27)
2
11
 
3
12
 
@@ -0,0 +1,2 @@
1
+ export declare const SOURCE_MAPPING_PREFIX = "sourceMappingURL=";
2
+ export declare function updateOutput(outputText: string, normalizedFileName: string, sourceMap?: string): string;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateOutput = exports.SOURCE_MAPPING_PREFIX = void 0;
4
+ var utils_1 = require("../../utils");
5
+ exports.SOURCE_MAPPING_PREFIX = 'sourceMappingURL=';
6
+ function updateOutput(outputText, normalizedFileName, sourceMap) {
7
+ if (sourceMap) {
8
+ var base64Map = Buffer.from(updateSourceMap(sourceMap, normalizedFileName), 'utf8').toString('base64');
9
+ var sourceMapContent = "data:application/json;charset=utf-8;base64,".concat(base64Map);
10
+ return (outputText.slice(0, outputText.lastIndexOf(exports.SOURCE_MAPPING_PREFIX) + exports.SOURCE_MAPPING_PREFIX.length) +
11
+ sourceMapContent);
12
+ }
13
+ return outputText;
14
+ }
15
+ exports.updateOutput = updateOutput;
16
+ var updateSourceMap = function (sourceMapText, normalizedFileName) {
17
+ var sourceMap = JSON.parse(sourceMapText);
18
+ sourceMap.file = normalizedFileName;
19
+ sourceMap.sources = [normalizedFileName];
20
+ delete sourceMap.sourceRoot;
21
+ return (0, utils_1.stringify)(sourceMap);
22
+ };
@@ -57,6 +57,7 @@ var lodash_memoize_1 = __importDefault(require("lodash.memoize"));
57
57
  var constants_1 = require("../../constants");
58
58
  var utils_1 = require("../../utils");
59
59
  var messages_1 = require("../../utils/messages");
60
+ var compiler_utils_1 = require("./compiler-utils");
60
61
  var TsCompiler = (function () {
61
62
  function TsCompiler(configSet, runtimeCacheFS) {
62
63
  var _a;
@@ -146,13 +147,13 @@ var TsCompiler = (function () {
146
147
  file: (0, path_1.basename)(fileName),
147
148
  }));
148
149
  }
150
+ var outputFiles = output.outputFiles;
149
151
  return this._compilerOptions.sourceMap
150
152
  ? {
151
- code: output.outputFiles[1].text,
152
- map: output.outputFiles[0].text,
153
+ code: (0, compiler_utils_1.updateOutput)(outputFiles[1].text, fileName, outputFiles[0].text),
153
154
  }
154
155
  : {
155
- code: output.outputFiles[0].text,
156
+ code: (0, compiler_utils_1.updateOutput)(outputFiles[0].text, fileName),
156
157
  };
157
158
  }
158
159
  else {
@@ -162,8 +163,7 @@ var TsCompiler = (function () {
162
163
  this.configSet.raiseDiagnostics(result.diagnostics, fileName, this._logger);
163
164
  }
164
165
  return {
165
- code: result.outputText,
166
- map: result.sourceMapText,
166
+ code: (0, compiler_utils_1.updateOutput)(result.outputText, fileName, result.sourceMapText),
167
167
  };
168
168
  }
169
169
  };
@@ -10,6 +10,29 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
13
36
  var __values = (this && this.__values) || function(o) {
14
37
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
15
38
  if (m) return m.call(o);
@@ -58,6 +81,7 @@ var bs_logger_1 = require("bs-logger");
58
81
  var jest_util_1 = require("jest-util");
59
82
  var json5_1 = __importDefault(require("json5"));
60
83
  var constants_1 = require("../../constants");
84
+ var hoistJestTransformer = __importStar(require("../../transformers/hoist-jest"));
61
85
  var utils_1 = require("../../utils");
62
86
  var backports_1 = require("../../utils/backports");
63
87
  var importer_1 = require("../../utils/importer");
@@ -232,7 +256,13 @@ var ConfigSet = (function () {
232
256
  this.parsedTsConfig = this._getAndResolveTsConfig(typeof tsconfigOpt === 'object' ? tsconfigOpt : undefined, configFilePath);
233
257
  this.raiseDiagnostics(this.parsedTsConfig.errors, configFilePath);
234
258
  this.logger.debug({ tsconfig: this.parsedTsConfig }, 'normalized typescript config via ts-jest option');
235
- this.resolvedTransformers.before = [require('../../transformers/hoist-jest')];
259
+ this.resolvedTransformers.before = [
260
+ {
261
+ factory: hoistJestTransformer.factory,
262
+ name: hoistJestTransformer.name,
263
+ version: hoistJestTransformer.version,
264
+ },
265
+ ];
236
266
  var astTransformers = options.astTransformers;
237
267
  if (astTransformers) {
238
268
  var resolveTransformerFunc_1 = function (transformerPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "28.0.0-next.2",
3
+ "version": "28.0.0-next.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": {