slnodejs 6.1.930 → 6.1.933
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slnodejs",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.933",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "tsOutputs/api.js",
|
|
6
6
|
"workspaces": [
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"lodash.filter": "^4.6.0",
|
|
57
57
|
"lodash.flatmap": "^4.5.0",
|
|
58
58
|
"md5": "2.0.0",
|
|
59
|
-
"micromatch": "4.0.
|
|
59
|
+
"micromatch": "4.0.8",
|
|
60
60
|
"mkdirp": "0.5.5",
|
|
61
61
|
"nopt": "3.0.4",
|
|
62
62
|
"nopt-usage": "0.1.0",
|
|
@@ -7,5 +7,6 @@ export declare class SourceMapData {
|
|
|
7
7
|
getSourcePosition(relativePath: string, absolutePath: string, start: IPositionFull, projectRoot: string, slMapping: {
|
|
8
8
|
[key: string]: string;
|
|
9
9
|
}): IUniqueIdParts;
|
|
10
|
+
private isMathRandomMocked;
|
|
10
11
|
private getSourceMapForModule;
|
|
11
12
|
}
|
|
@@ -3,24 +3,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SourceMapData = void 0;
|
|
4
4
|
const source_maps_utils_1 = require("../source-maps-utils");
|
|
5
5
|
const source_map_handler_1 = require("../source-map-handler");
|
|
6
|
+
const cockpit_notifier_1 = require("../agent-events/cockpit-notifier");
|
|
6
7
|
class SourceMapData {
|
|
7
8
|
constructor(logger) {
|
|
8
9
|
this.logger = logger;
|
|
9
10
|
this.pathToConsumer = new Map();
|
|
10
11
|
}
|
|
11
12
|
getSourcePosition(relativePath, absolutePath, start, projectRoot, slMapping) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
try {
|
|
14
|
+
const sourceMapForModule = this.getSourceMapForModule(absolutePath);
|
|
15
|
+
if (sourceMapForModule) {
|
|
16
|
+
const startPositionArr = [start.line, start.column];
|
|
17
|
+
const handler = new source_map_handler_1.SourceMapHandler(sourceMapForModule, absolutePath, startPositionArr, [], projectRoot, this.logger);
|
|
18
|
+
handler.resolvePaths();
|
|
19
|
+
if (!handler.shouldSkipped) {
|
|
20
|
+
const relativeSourcePath = slMapping[handler.start.source] || handler.relativePath;
|
|
21
|
+
return {
|
|
22
|
+
relativePath: relativeSourcePath,
|
|
23
|
+
absolutePath: handler.absolutePath,
|
|
24
|
+
start: { line: handler.start.line, column: handler.start.column }
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
const errorMsg = `Error processing source map for module at path: ${absolutePath}. Error: ${error.message}`;
|
|
31
|
+
this.logger.error(errorMsg, error);
|
|
32
|
+
cockpit_notifier_1.CockpitNotifier.sendGenericMessage(errorMsg);
|
|
33
|
+
// Check if the error might be related to Math.random being mocked
|
|
34
|
+
if (this.isMathRandomMocked()) {
|
|
35
|
+
const additionalMsg = `It appears that an internal Node module (likely Math or Math.random) has been mocked. This can cause issues in the source map module. As a result of the source map not being loaded, you may see reduced coverage percentage.`;
|
|
36
|
+
this.logger.error(additionalMsg);
|
|
37
|
+
cockpit_notifier_1.CockpitNotifier.sendGenericMessage(additionalMsg);
|
|
20
38
|
}
|
|
21
39
|
}
|
|
22
40
|
return null;
|
|
23
41
|
}
|
|
42
|
+
isMathRandomMocked() {
|
|
43
|
+
const descriptor = Object.getOwnPropertyDescriptor(Math, 'random');
|
|
44
|
+
if (typeof Math.random !== 'function' || Math.random.toString().includes('[native code]') === false || descriptor && !descriptor.configurable && !descriptor.writable) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
24
49
|
getSourceMapForModule(absolutePath) {
|
|
25
50
|
if (!this.pathToConsumer.get(absolutePath)) {
|
|
26
51
|
this.pathToConsumer.set(absolutePath, source_maps_utils_1.SourceMapsUtils.readSourceMaps(absolutePath));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-map-data.js","sourceRoot":"","sources":["../../../common/footprints-process-v6/source-map-data.ts"],"names":[],"mappings":";;;AAAA,4DAAqD;AAErD,8DAAuD;
|
|
1
|
+
{"version":3,"file":"source-map-data.js","sourceRoot":"","sources":["../../../common/footprints-process-v6/source-map-data.ts"],"names":[],"mappings":";;;AAAA,4DAAqD;AAErD,8DAAuD;AAGvD,uEAAiE;AAGjE,MAAa,aAAa;IAKtB,YAAY,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;IACpC,CAAC;IAGM,iBAAiB,CAAC,YAAoB,EAAE,YAAoB,EAAE,KAAoB,EAAE,WAAmB,EAAE,SAAkC;QAC9I,IAAI;YACA,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;YACpE,IAAI,kBAAkB,EAAE;gBACpB,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACpD,MAAM,OAAO,GAAG,IAAI,qCAAgB,CAAC,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvH,OAAO,CAAC,YAAY,EAAE,CAAC;gBAEvB,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;oBACxB,MAAM,kBAAkB,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC;oBACnF,OAAO;wBACH,YAAY,EAAE,kBAAk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