@teamscale/lib-instrument 0.1.0-beta.4 → 0.1.0-beta.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"visitor.d.ts","sourceRoot":"","sources":["../src/visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAQ,MAAM,aAAa,CAAC;AAElD,OAAO,EAK8C,OAAO,EAE3D,MAAM,cAAc,CAAC;AAEtB,KAAK,UAAU,GAAG,cAAc,cAAc,CAAC,CAAA;AAE/C,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAC,sBAAsB,EAAC,MAAM,SAAS,CAAC;AAykB/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EACjB,sBAAsB,EAAE,iBAAiB,GAAG,SAAS,EACrD,IAAI,EAAE,sBAAsB;gBAYvC,SAAS,OAAO,CAAC,GAAG,IAAI;eASzB,SAAS,OAAO,CAAC;EA+BnC"}
1
+ {"version":3,"file":"visitor.d.ts","sourceRoot":"","sources":["../src/visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAQ,MAAM,aAAa,CAAC;AAElD,OAAO,EAK8C,OAAO,EAE3D,MAAM,cAAc,CAAC;AAEtB,KAAK,UAAU,GAAG,cAAc,cAAc,CAAC,CAAA;AAE/C,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAC,sBAAsB,EAAC,MAAM,SAAS,CAAC;AAglB/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EACjB,sBAAsB,EAAE,iBAAiB,GAAG,SAAS,EACrD,IAAI,EAAE,sBAAsB;gBAYvC,SAAS,OAAO,CAAC,GAAG,IAAI;eASzB,SAAS,OAAO,CAAC;EA+BnC"}
package/lib/visitor.js CHANGED
@@ -215,14 +215,19 @@ class VisitState {
215
215
  * Create a line coverage reporting statement node.
216
216
  */
217
217
  function newLineCoverageExpression(originFileId, range) {
218
+ let argumentList = [
219
+ { type: 'Identifier', name: originFileId },
220
+ { type: 'NumericLiteral', value: range.start.line }
221
+ ];
222
+ // Only pass end line argument if they are different.
223
+ // See also https://v8.dev/blog/adaptor-frame for performance considerations
224
+ if (range.start.line !== range.end.line) {
225
+ argumentList.push({ type: 'NumericLiteral', value: range.end.line });
226
+ }
218
227
  return {
219
228
  type: 'CallExpression',
220
229
  callee: { type: 'Identifier', name: '_$l' },
221
- arguments: [
222
- { type: 'Identifier', name: originFileId },
223
- { type: 'NumericLiteral', value: range.start.line },
224
- { type: 'NumericLiteral', value: range.end.line },
225
- ]
230
+ arguments: argumentList
226
231
  };
227
232
  }
228
233
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamscale/lib-instrument",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.6",
4
4
  "description": "Library for adding coverage statements to JS code; forked from istanbul-lib-coverage",
5
5
  "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>",
6
6
  "maintainers": [
@@ -14,24 +14,24 @@
14
14
  "lib"
15
15
  ],
16
16
  "dependencies": {
17
- "@babel/core": "^7.23.7",
18
- "@babel/parser": "^7.23.6",
19
- "@babel/traverse": "^7.23.7",
20
- "@types/node": "^20.11.0",
17
+ "@babel/core": "^7.23.9",
18
+ "@babel/parser": "^7.23.9",
19
+ "@babel/traverse": "^7.23.9",
20
+ "@types/node": "^20.11.19",
21
21
  "source-map": "^0.7.4",
22
22
  "typescript": "^5.3.3"
23
23
  },
24
24
  "devDependencies": {
25
- "@babel/cli": "^7.23.4",
26
- "@babel/types": "^7.23.6",
25
+ "@babel/cli": "^7.23.9",
26
+ "@babel/types": "^7.23.9",
27
27
  "@types/babel__core": "^7.20.5",
28
28
  "@types/clone": "^2.1.4",
29
29
  "@types/js-yaml": "^4.0.9",
30
- "@types/jest": "^29.5.11",
30
+ "@types/jest": "^29.5.12",
31
31
  "babel-jest": "^29.7.0",
32
32
  "clone": "^2.1.2",
33
33
  "js-yaml": "^4.1.0",
34
- "ts-jest": "^29.1.1",
34
+ "ts-jest": "^29.1.2",
35
35
  "jest": "^29.7.0",
36
36
  "rimraf": "^5.0.5"
37
37
  },