@teamscale/javascript-instrumenter 0.0.1-beta.37 → 0.0.1-beta.39
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": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.39",
|
|
4
4
|
"description": "Istanbul-based coverage instrumenter with coverage forwarding via WebSockets",
|
|
5
5
|
"main": "dist/src/main.js",
|
|
6
6
|
"bin": "dist/src/main.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@cqse/commons": "^0.0.1-beta.1",
|
|
55
55
|
"@types/micromatch": "^4.0.2",
|
|
56
56
|
"argparse": "^2.0.1",
|
|
57
|
-
"async": "^3.2.
|
|
57
|
+
"async": "^3.2.4",
|
|
58
58
|
"bunyan": "^1.8.15",
|
|
59
59
|
"convert-source-map": "^1.7.0",
|
|
60
60
|
"foreground-child": "^2.0.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Instrumenter.d.ts","sourceRoot":"","sources":["../../../src/instrumenter/Instrumenter.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EAGnB,WAAW,EACX,UAAU,EACV,MAAM,QAAQ,CAAC;AAUhB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,eAAO,MAAM,qBAAqB,8CAA8C,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC3D;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACzD;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC;;OAEG;IACH,OAAO,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;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAK3B;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAcpC;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;CAe1B"}
|
|
@@ -110,7 +110,7 @@ class IstanbulInstrumenter {
|
|
|
110
110
|
// The main instrumentation (adding coverage statements) is performed now:
|
|
111
111
|
instrumentedSource = instrumenter
|
|
112
112
|
.instrumentSync(inputFileSource, taskElement.fromFile, inputSourceMap)
|
|
113
|
-
.replace(/
|
|
113
|
+
.replace(/actualCoverage\s*=\s*coverage\[path\]/g, 'actualCoverage=makeCoverageInterceptor(coverage[path])')
|
|
114
114
|
.replace(/new Function\("return this"\)\(\)/g, "typeof window === 'object' ? window : this");
|
|
115
115
|
this.logger.debug('Instrumentation source maps to:', (_b = instrumenter.lastSourceMap()) === null || _b === void 0 ? void 0 : _b.sources);
|
|
116
116
|
// In case of a bundle, the initial instrumentation step might have added
|
package/dist/vaccine.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var L=Object.create;var p=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var P=e=>p(e,"__esModule",{value:!0});var E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var j=(e,t,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of H(t))!B.call(e,r)&&r!=="default"&&p(e,r,{get:()=>t[r],enumerable:!(n=D(t,r))||n.enumerable});return e},S=e=>j(P(p(e!=null?L(U(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var O=E((re,R)=>{R.exports=!1});var $=E(()=>{});function m(e){let t=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(t),r=new Worker(n);return URL.revokeObjectURL(n),r}function g(){return m('var a=class{constructor(e){this.cachedMessages=[];this.url=e,this.socket=this.createSocket()}createSocket(){let e=new WebSocket(this.url);return e.onopen=()=>this.onopen(),e.onclose=()=>this.onclose(),e}onclose(){this.socket=this.createSocket()}onopen(){console.log("Connection to Coverage Collector established."),this.cachedMessages.forEach(e=>this.socket.send(e)),this.cachedMessages=[]}send(e){this.socket.readyState===WebSocket.OPEN?this.socket.send(e):(this.cachedMessages.push(e),this.cachedMessages.length%500===0&&console.log(`More than ${this.cachedMessages.length} messages are queued to be sent.`))}};var E=20,v=1e3,g=class{constructor(e,t){this.milliseconds=e;this.onCountedToZero=t;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)}},c=class{constructor(e){this.socket=e,this.cachedCoveredRanges=new Map,this.numberOfCachedPositions=0,this.flushCountdown=new g(v,()=>this.flush())}addRange(e,t){let o=this.cachedCoveredRanges.get(e);o||(o=new Set,this.cachedCoveredRanges.set(e,o)),o.add(t),this.numberOfCachedPositions+=1,this.flushCountdown.restartCountdown(),this.numberOfCachedPositions>=E&&this.flush()}flush(){this.numberOfCachedPositions!==0&&(this.flushCountdown.stopCountdown(),this.cachedCoveredRanges.forEach((e,t)=>{let o=Array.from(e).map(n=>`${n.start.line}:${n.start.column}:${n.end.line}:${n.end.column}`);this.socket.send(`${"c"} ${t} ${o.join(" ")}`),e.clear()}),this.cachedCoveredRanges.clear(),this.numberOfCachedPositions=0)}};var C="s",m="b";console.log("Starting coverage forwarding worker.");var p=new a("$REPORT_TO_URL/socket"),d=new c(p),h=new Map;onmessage=s=>{let e=s.data;if(e.startsWith("s"))p.send(e);else if(e.startsWith("i")){let t=JSON.parse(e.substring(2));h.set(t.hash,t),console.info(`Received coverage mapping information for "${t.hash}".`)}else e.startsWith("u")?S(e):e==="unload"?d.flush():console.error(`No handler for message: ${e}`)};function S(s){var l;let e=s.split(" ");if(e.length<4||h===null)return;let t=e[1],o=e[2],n=h.get(t);if(!n){console.log(`No coverage mapping information for ${t} available!`);return}if(o===C){let i=e[3],r=n.statementMap[i];r&&d.addRange(t,r)}else if(o===m){let i=e[3],r=Number.parseInt(e[4]),u=(l=n.branchMap[i])==null?void 0:l.locations[r];u&&d.addRange(t,u)}}\n')}var b="s",w="b";var a;(function(o){o.MESSAGE_TYPE_SOURCEMAP="s",o.MESSAGE_TYPE_COVERAGE="c",o.ISTANBUL_COV_OBJECT="i",o.UNRESOLVED_CODE_ENTITY="u"})(a||(a={}));var k=class{constructor(t,n,r){this.worker=t;this.fileHash=n;this.path=r}get(t,n,r){let o=t[n];return o!==Object(o)?o:C(this.worker,this.fileHash,o,[...this.path,n])}set(t,n,r){let o=[...this.path,n],i=o[0];if(i===b){let s=o[1];this.worker.postMessage(`${a.UNRESOLVED_CODE_ENTITY} ${this.fileHash} ${b} ${s}`)}else if(i===w){let s=o[1],u=o[2];this.worker.postMessage(`${a.UNRESOLVED_CODE_ENTITY} ${this.fileHash} ${w} ${s} ${u}`)}return!0}};function C(e,t,n,r){return new Proxy(n,new k(e,t,r))}var T=S(O());function G(e){if(!(typeof WorkerGlobalScope=="function"&&self instanceof WorkerGlobalScope)){if(typeof window.addEventListener!="function")return;window.addEventListener("beforeunload",function(){e()},!0),window.addEventListener("unload",function(){e()},!0)}}var _={add:G};var W=S($()),V=T.default?W.default:_,c=new Set,M=!1;function Y(){M||(M=!0,V.add(J))}function x(e){if(Y(),typeof e!="function")throw new Error("Listener is no function");c.add(e);var t={remove:function(){return c.delete(e)},run:function(){return c.delete(e),e()}};return t}function J(){var e=[];return c.forEach(function(t){e.push(t()),c.delete(t)}),Promise.all(e)}function l(){return d()}function A(){return typeof window!="undefined"}function d(){return window}function v(e,t){let n=l()[e];return n||(n=t,l()[e]=n),n}var I=v("__TS_AGENT",{});function h(){return I._$BcWorker}function z(e){return I._$BcWorker=e,e}var N=new Set;l().makeCoverageInterceptor=function(e){let t=e.hash;if(N.has(t)){console.log(`Coverage interceptor added twice for ${t}. This seems to be a bug in the instrumentation.`);return}else N.add(t);if(!h()){let n=z(new g);(function(){let o=function(i){let s=d()[i];d()[i]=function(...u){if(n.postMessage("unload"),s)return s.apply(this,u)},A()&&Object.defineProperty(d(),i,{get:function(){return s},set:function(u){s=u}})};o("onunload"),o("onbeforeunload"),x(()=>n.postMessage("unload"))})()}return function(){h().postMessage(`${a.ISTANBUL_COV_OBJECT} ${JSON.stringify(e)}`);let r=v("sentMaps",new Set);e.inputSourceMap&&(r.has(e.path)||(h().postMessage(`${a.MESSAGE_TYPE_SOURCEMAP} ${t}:${JSON.stringify(e.inputSourceMap)}`),r.add(e.path)))}(),function(){let r=new Set;l()._$Bc=(o,i,s,u,y)=>{let f=`${o}:${i}:${s}:${u}:${y}`;r.has(f)||(h().postMessage(f),r.add(f))}}(),C(h(),e.hash,e,[])};})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamscale/javascript-instrumenter",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.39",
|
|
4
4
|
"description": "Istanbul-based coverage instrumenter with coverage forwarding via WebSockets",
|
|
5
5
|
"main": "dist/src/main.js",
|
|
6
6
|
"bin": "dist/src/main.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@cqse/commons": "^0.0.1-beta.1",
|
|
55
55
|
"@types/micromatch": "^4.0.2",
|
|
56
56
|
"argparse": "^2.0.1",
|
|
57
|
-
"async": "^3.2.
|
|
57
|
+
"async": "^3.2.4",
|
|
58
58
|
"bunyan": "^1.8.15",
|
|
59
59
|
"convert-source-map": "^1.7.0",
|
|
60
60
|
"foreground-child": "^2.0.0",
|