@teamscale/javascript-instrumenter 1.0.0-beta.2 → 1.0.0-beta.4
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/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamscale/javascript-instrumenter",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "JavaScript coverage instrumenter with coverage forwarding to a collector process",
|
|
5
5
|
"main": "dist/src/main.js",
|
|
6
6
|
"bin": "dist/src/main.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@types/babel__traverse": "^7.20.6",
|
|
30
30
|
"@types/bunyan": "^1.8.11",
|
|
31
31
|
"@types/convert-source-map": "^2.0.3",
|
|
32
|
-
"@types/glob": "^
|
|
32
|
+
"@types/glob": "^9.0.0",
|
|
33
33
|
"@types/jest": "^29.5.14",
|
|
34
34
|
"@types/node": "^22.13.4",
|
|
35
35
|
"@types/ws": "^8.5.14",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstrumenterConfig.d.ts","sourceRoot":"","sources":["../../../src/instrumenter/InstrumenterConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,uBAAuB,EAGvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"InstrumenterConfig.d.ts","sourceRoot":"","sources":["../../../src/instrumenter/InstrumenterConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,uBAAuB,EAGvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAGxC;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAsBF;;;GAGG;AACH,wBAAgB,wCAAwC,IAAI,uBAAuB,CA0HlF"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildInstrumenterConfigurationParameters = buildInstrumenterConfigurationParameters;
|
|
4
4
|
const commons_1 = require("@cqse/commons");
|
|
5
|
+
const commons_2 = require("@cqse/commons");
|
|
5
6
|
const CONFIG_GROUP_INPUT = {
|
|
6
7
|
order: 1,
|
|
7
8
|
title: 'Instrumenter Input and Output'
|
|
@@ -115,6 +116,11 @@ function buildInstrumenterConfigurationParameters() {
|
|
|
115
116
|
}
|
|
116
117
|
});
|
|
117
118
|
parameters.addRequiredArgumentFor('commit');
|
|
119
|
+
parameters.addArgumentCheck(options => {
|
|
120
|
+
if (!(0, commons_2.isValidCommitInfo)(options.commit)) {
|
|
121
|
+
return 'The given commit must be of the form <branch>:<UNIX timestamp in milliseconds> or a Git hash.';
|
|
122
|
+
}
|
|
123
|
+
});
|
|
118
124
|
parameters.addArgumentCheck(options => {
|
|
119
125
|
if (!options.collector && !options.relativeCollector) {
|
|
120
126
|
return 'Either a collector URL or a relative collector URL must be specified.';
|
package/dist/vaccine.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{function u(e){let n=new Blob([e],{type:"text/javascript"}),t=URL.createObjectURL(n),a=new Worker(t);return URL.revokeObjectURL(t),a}function h(){return u('var
|
|
1
|
+
"use strict";(()=>{function u(e){let n=new Blob([e],{type:"text/javascript"}),t=URL.createObjectURL(n),a=new Worker(t);return URL.revokeObjectURL(t),a}function h(){return u('var r=class{constructor(){this.socket=null,this.url="",this.messageOnConnect="",this.cachedMessages=[],this.reconnectTimer=null}connect(e,s){this.url=e,this.messageOnConnect=s,this.socket=this.createSocket(),this.startReconnectTimer()}createSocket(){let e=new WebSocket(this.url);return e.onopen=()=>this.onopen(),e.onclose=()=>this.onclose(),e}startReconnectTimer(){this.reconnectTimer!==null&&clearInterval(this.reconnectTimer),this.reconnectTimer=setInterval(()=>{this.checkConnectionAndReconnect()},1e4)}checkConnectionAndReconnect(){var e;(this.socket===null||this.socket.readyState!==WebSocket.OPEN)&&((e=this.socket)==null||e.close(),console.log("Connection lost, attempting to reconnect..."),this.socket=this.createSocket())}onclose(){this.socket=this.createSocket()}onopen(){console.log("Connection to Coverage Collector established."),this.socket.send(this.messageOnConnect),this.cachedMessages.forEach(e=>this.socket.send(e)),this.cachedMessages=[]}send(e){if(this.socket!==null&&this.socket.readyState===WebSocket.OPEN)try{this.socket.send(e)}catch(s){console.error("Sending failed. Message will be re-sent when connection is available again.",s),this.addMessageToCache(e)}else this.addMessageToCache(e)}addMessageToCache(e){this.cachedMessages.push(e),this.cachedMessages.length%500===0&&console.log(`More than ${this.cachedMessages.length} messages are queued to be sent.`)}disconnect(){this.reconnectTimer!==null&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null),this.socket!==null&&(this.socket.close(),this.socket=null)}};var c=class{constructor(e,s){this.milliseconds=e;this.onCountedToZero=s;this.timerHandle=null}restartCountdown(){this.stopCountdown(),this.timerHandle=self.setTimeout(()=>{this.stopCountdown(),this.onCountedToZero()},this.milliseconds)}stopCountdown(){this.timerHandle!==null&&(self.clearTimeout(this.timerHandle),this.timerHandle=null)}};var v=20,f=1e3,S="c",g="b",a=class{constructor(e){this.socket=e,this.cachedCoveredRanges=new Map,this.numberOfCachedPositions=0,this.flushCountdown=new c(f,()=>this.flush())}addLines(e,s){let t=this.cachedCoveredRanges.get(e);t||(t=new Set,this.cachedCoveredRanges.set(e,t)),s.forEach(n=>t.add(n)),this.numberOfCachedPositions+=1,this.flushCountdown.restartCountdown(),this.numberOfCachedPositions>=v&&this.flush()}arrayToLineCov(e){let s=[];for(let t of e)s.push(`${t}`);return s.join(";")}flush(){if(this.numberOfCachedPositions===0)return;this.flushCountdown.stopCountdown();let e=[];this.cachedCoveredRanges.forEach((s,t)=>{e.push(`@${t}`),e.push(this.arrayToLineCov(s))}),this.socket.send(`${S} ${e.join(";")}`),this.cachedCoveredRanges.clear(),this.numberOfCachedPositions=0}};var l=class o{static resolve(e,s,t){switch(e.type){case"url":return e.url;case"relative":return o.resolveRelative(s,t,e)}}static resolveRelative(e,s,t){var u;let n=e;t.hostReplace&&(n=e.replace(t.hostReplace.search,t.hostReplace.replace));let C=(u=t.scheme)!=null?u:"ws",i;t.port===void 0?i="":t.port==="keep"?i=`:${s}`:i=`:${t.port}`;let h="";t.path&&(h=`/${t.path}`);let d=`${C}://${n}${i}${h}`;return console.debug(`Resolved collector URL ${d} from ${e}:${s}`),d}};console.log("Starting coverage forwarding worker.");var p=new r,m=new a(p);onmessage=o=>{if(Array.isArray(o.data)){let[e,s]=o.data;m.addLines(e,s)}else if(o.data==="unload")m.flush();else if(o.data.type==="location"){let e=o.data,s=l.resolve($COLLECTOR_SPECIFIER,e.hostname,e.port),t=`${g} $BUCKET_SPECIFIER`;p.connect(`${s}/socket`,t)}else console.error(`No handler for message: ${o.data}`)};\n')}function c(){return d()}function d(){return window}function g(e,n){let t=c()[e];return t||(t=n,c()[e]=t),t}function p(e,n){let t=new Map;function a(i){let o=t.get(i);return o||(o={lines:new Set},t.set(i,o),o)}function r(i,o,k=o){let f=a(i).lines;for(let l=o;l<=k;l++)f.add(l);f.size>255&&s()}function s(){n(t),t.clear()}return setInterval(()=>s(),e),{putLineCoverage:r,flush:s}}var v=g("__TS_AGENT",{});function m(){return v._$BcWorker}function b(e){return v._$BcWorker=e,e}var C=p(250,e=>{for(let n of e.entries())m().postMessage([n[0],Array.from(n[1].lines)])});c()._$l=C.putLineCoverage;if(!m()){let e=b(new h),n={type:"location",hostname:document.location.hostname,port:document.location.port};e.postMessage(n),function(){let a=()=>{C.flush(),e.postMessage("unload")},r=function(i,o){o&&o.addEventListener(i,a,{capture:!0})},s=d();r("blur",s),r("unload",s),r("visibilitychange",s),r("beforeunload",s)}()}})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamscale/javascript-instrumenter",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "JavaScript coverage instrumenter with coverage forwarding to a collector process",
|
|
5
5
|
"main": "dist/src/main.js",
|
|
6
6
|
"bin": "dist/src/main.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@types/babel__traverse": "^7.20.6",
|
|
22
22
|
"@types/bunyan": "^1.8.11",
|
|
23
23
|
"@types/convert-source-map": "^2.0.3",
|
|
24
|
-
"@types/glob": "^
|
|
24
|
+
"@types/glob": "^9.0.0",
|
|
25
25
|
"@types/jest": "^29.5.14",
|
|
26
26
|
"@types/node": "^22.13.4",
|
|
27
27
|
"@types/ws": "^8.5.14",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"unload": "^2.4.1",
|
|
56
56
|
"uuid": "^11.1.0",
|
|
57
57
|
"web-worker": "^1.5.0",
|
|
58
|
-
"@cqse/commons": "1.0.0-beta.
|
|
59
|
-
"@teamscale/lib-instrument": "1.0.0-beta.
|
|
58
|
+
"@cqse/commons": "1.0.0-beta.4",
|
|
59
|
+
"@teamscale/lib-instrument": "1.0.0-beta.4"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|