@gjsify/perf_hooks 0.3.20 → 0.3.21

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.
Files changed (2) hide show
  1. package/lib/esm/index.js +1 -1
  2. package/package.json +3 -3
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- let e;if(globalThis.performance)e=globalThis.performance;else{let t,n;try{let e=globalThis.imports.gi.GLib;t=e.get_monotonic_time(),n=()=>(e.get_monotonic_time()-t)/1e3}catch{let e=Date.now();t=0,n=()=>Date.now()-e}let r=[],i=Date.now()-n();e={timeOrigin:i,now:n,mark(e){let t={name:e,entryType:`mark`,startTime:n(),duration:0};return r.push(t),t},measure(e,t,i){let a=0,o=n();if(t){let e=r.find(e=>e.entryType===`mark`&&e.name===t);e&&(a=e.startTime)}if(i){let e=r.find(e=>e.entryType===`mark`&&e.name===i);e&&(o=e.startTime)}let s={name:e,entryType:`measure`,startTime:a,duration:o-a};return r.push(s),s},getEntries(){return[...r]},getEntriesByName(e){return r.filter(t=>t.name===e)},getEntriesByType(e){return r.filter(t=>t.entryType===e)},clearMarks(e){for(let t=r.length-1;t>=0;t--)r[t].entryType===`mark`&&(!e||r[t].name===e)&&r.splice(t,1)},clearMeasures(e){for(let t=r.length-1;t>=0;t--)r[t].entryType===`measure`&&(!e||r[t].name===e)&&r.splice(t,1)},clearResourceTimings(){},setResourceTimingBufferSize(){},toJSON(){return{timeOrigin:i}}}}var t=class{_callback;constructor(e){this._callback=e}observe(e){}disconnect(){}takeRecords(){return[]}},n=class{name=``;entryType=``;startTime=0;duration=0;toJSON(){return{name:this.name,entryType:this.entryType,startTime:this.startTime,duration:this.duration}}},r=class{getEntries(){return[]}getEntriesByName(e){return[]}getEntriesByType(e){return[]}};const i=globalThis.PerformanceObserver||t,a=globalThis.PerformanceEntry||n,o=globalThis.PerformanceObserverEntryList||r,s=globalThis.PerformanceMark||class extends n{},c=globalThis.PerformanceMeasure||class extends n{};function l(e,t){return{idle:0,active:0,utilization:0}}function u(t){let n=function(...n){let r=e.now(),i=t.apply(this,n);return e.now()-r,i};return Object.defineProperty(n,`name`,{value:t.name}),n}function d(e){let t=new Map;return{enable(){},disable(){},reset(){},percentile(e){return 0},get min(){return 0},get max(){return 0},get mean(){return 0},get stddev(){return 0},get percentiles(){return t}}}var f={performance:e,PerformanceObserver:i,PerformanceEntry:a,PerformanceObserverEntryList:o,PerformanceMark:s,PerformanceMeasure:c,eventLoopUtilization:l,timerify:u,monitorEventLoopDelay:d};export{a as PerformanceEntry,s as PerformanceMark,c as PerformanceMeasure,i as PerformanceObserver,o as PerformanceObserverEntryList,f as default,l as eventLoopUtilization,d as monitorEventLoopDelay,e as performance,u as timerify};
1
+ let e;if(globalThis.performance)e=globalThis.performance;else{let t,_now;try{let e=globalThis.imports.gi.GLib;t=e.get_monotonic_time(),_now=()=>(e.get_monotonic_time()-t)/1e3}catch{let e=Date.now();t=0,_now=()=>Date.now()-e}let n=[],r=Date.now()-_now();e={timeOrigin:r,now:_now,mark(e){let t={name:e,entryType:`mark`,startTime:_now(),duration:0};return n.push(t),t},measure(e,t,r){let i=0,a=_now();if(t){let e=n.find(e=>e.entryType===`mark`&&e.name===t);e&&(i=e.startTime)}if(r){let e=n.find(e=>e.entryType===`mark`&&e.name===r);e&&(a=e.startTime)}let o={name:e,entryType:`measure`,startTime:i,duration:a-i};return n.push(o),o},getEntries(){return[...n]},getEntriesByName(e){return n.filter(t=>t.name===e)},getEntriesByType(e){return n.filter(t=>t.entryType===e)},clearMarks(e){for(let t=n.length-1;t>=0;t--)n[t].entryType===`mark`&&(!e||n[t].name===e)&&n.splice(t,1)},clearMeasures(e){for(let t=n.length-1;t>=0;t--)n[t].entryType===`measure`&&(!e||n[t].name===e)&&n.splice(t,1)},clearResourceTimings(){},setResourceTimingBufferSize(){},toJSON(){return{timeOrigin:r}}}}var PerformanceObserverStub=class{_callback;constructor(e){this._callback=e}observe(e){}disconnect(){}takeRecords(){return[]}},PerformanceEntryStub=class{name=``;entryType=``;startTime=0;duration=0;toJSON(){return{name:this.name,entryType:this.entryType,startTime:this.startTime,duration:this.duration}}},PerformanceObserverEntryListStub=class{getEntries(){return[]}getEntriesByName(e){return[]}getEntriesByType(e){return[]}};const t=globalThis.PerformanceObserver||PerformanceObserverStub,n=globalThis.PerformanceEntry||PerformanceEntryStub,r=globalThis.PerformanceObserverEntryList||PerformanceObserverEntryListStub,i=globalThis.PerformanceMark||class extends PerformanceEntryStub{},a=globalThis.PerformanceMeasure||class extends PerformanceEntryStub{};function eventLoopUtilization(e,t){return{idle:0,active:0,utilization:0}}function timerify(t){let wrapped=function(...n){let r=e.now(),i=t.apply(this,n);return e.now()-r,i};return Object.defineProperty(wrapped,`name`,{value:t.name}),wrapped}function monitorEventLoopDelay(e){let t=new Map;return{enable(){},disable(){},reset(){},percentile(e){return 0},get min(){return 0},get max(){return 0},get mean(){return 0},get stddev(){return 0},get percentiles(){return t}}}var o={performance:e,PerformanceObserver:t,PerformanceEntry:n,PerformanceObserverEntryList:r,PerformanceMark:i,PerformanceMeasure:a,eventLoopUtilization,timerify,monitorEventLoopDelay};export{n as PerformanceEntry,i as PerformanceMark,a as PerformanceMeasure,t as PerformanceObserver,r as PerformanceObserverEntryList,o as default,eventLoopUtilization,monitorEventLoopDelay,e as performance,timerify};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/perf_hooks",
3
- "version": "0.3.20",
3
+ "version": "0.3.21",
4
4
  "description": "Node.js perf_hooks module for Gjs",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -30,8 +30,8 @@
30
30
  "perf_hooks"
31
31
  ],
32
32
  "devDependencies": {
33
- "@gjsify/cli": "^0.3.20",
34
- "@gjsify/unit": "^0.3.20",
33
+ "@gjsify/cli": "^0.3.21",
34
+ "@gjsify/unit": "^0.3.21",
35
35
  "@types/node": "^25.6.2",
36
36
  "typescript": "^6.0.3"
37
37
  }