spy-client 2.1.15 → 2.2.1

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 (44) hide show
  1. package/.travis.yml +7 -4
  2. package/AGENTS.md +132 -0
  3. package/README.md +27 -19
  4. package/dist/head/base.d.ts +27 -26
  5. package/dist/head/error.d.ts +6 -6
  6. package/dist/head/observer.d.ts +5 -5
  7. package/dist/head/whitescreen.d.ts +6 -6
  8. package/dist/lib/data.d.ts +6 -6
  9. package/dist/lib/huffman.d.ts +9 -9
  10. package/dist/lib/interface.d.ts +209 -209
  11. package/dist/lib/spyHeadInterface.d.ts +36 -36
  12. package/dist/lib/util.d.ts +22 -22
  13. package/dist/module/fid.d.ts +15 -15
  14. package/dist/module/layoutShift.d.ts +18 -18
  15. package/dist/module/lcp.d.ts +17 -17
  16. package/dist/module/longtask.d.ts +46 -46
  17. package/dist/module/memory.d.ts +11 -11
  18. package/dist/module/navigatorInfo.d.ts +9 -9
  19. package/dist/module/resource.d.ts +39 -39
  20. package/dist/module/timing.d.ts +11 -11
  21. package/dist/module/tti.d.ts +19 -19
  22. package/dist/spy-client-basic.d.ts +118 -118
  23. package/dist/spy-client-basic.esm.js +298 -298
  24. package/dist/spy-client-basic.iife.js +298 -298
  25. package/dist/spy-client-basic.iife.min.js +1 -1
  26. package/dist/spy-client-basic.js +298 -298
  27. package/dist/spy-client-basic.min.js +1 -1
  28. package/dist/spy-client-basic.mjs +298 -298
  29. package/dist/spy-client.d.ts +32 -32
  30. package/dist/spy-client.esm.js +1430 -1423
  31. package/dist/spy-client.iife.js +1430 -1423
  32. package/dist/spy-client.iife.min.js +1 -1
  33. package/dist/spy-client.js +1430 -1423
  34. package/dist/spy-client.min.js +1 -1
  35. package/dist/spy-client.mjs +1430 -1423
  36. package/dist/spy-head.d.ts +6 -6
  37. package/dist/spy-head.js +359 -358
  38. package/dist/spy-head.min.js +1 -1
  39. package/dist/spy-local-cache.d.ts +18 -18
  40. package/dist/spy-local-cache.js +718 -711
  41. package/dist/spy-local-cache.min.js +1 -1
  42. package/package.json +26 -73
  43. package/test-results/.last-run.json +4 -0
  44. package/karma.conf.js +0 -111
@@ -1 +1 @@
1
- ((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SpyLocalCache=e()})(this,function(){var r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])}))(t,e)};function t(t,e){function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}e.prototype.preOrder=function(t){t.push(this),this.left&&this.left.preOrder(t),this.right&&this.right.preOrder(t)};var c=e;function e(t,e){this.data=t,this.weight=e}function o(t){var n;return null==t?null:(n={},function t(e,o,r){r=[].concat(r);r.push(o),null!=e&&(null==e.data?(t(e.left,"0",r),t(e.right,"1",r)):n[e.data]=r.join(""))}(t,"",[]),n)}function n(t){var e=o((t=>{for(var e=function(t,e){return t.weight-e.weight};1<t.length;){t.sort(e);var o,r=t.shift(),n=t.shift();r&&n&&((o=new c(null,r.weight+n.weight)).left=r,o.right=n,t.unshift(o))}return t.shift()})((t=>{for(var e=[],o={},r=0,n=t;r<n.length;r++){var i=n[r];null==o[i]?o[i]=1:o[i]++}for(var a=0,s=Object.entries(o);a<s.length;a++){var u=s[a],h=u[0];e.push(new c(h,u[1]))}return e})(t)));return{result:(t=>{for(var e=t.join(""),t=Math.ceil(e.length/8),o=new Array(t+1),r=0,n="",i=0;i<e.length;i+=8)n=e.substring(i,i+8),o[r]=parseInt(n,2),r++;return o[r]=n.length,o})(((t,e)=>{for(var o=[],r=0,n=t;r<n.length;r++){var i=n[r];o.push(e[i])}return o})(t,e)),codes:e}}function i(t,e){for(var o,r,n=[],i=0;i<e.length-1;i++){var a=i!==e.length-2;n.push((o=a,r=e[i],o&&(r|=256),r=Number(r).toString(2),o?r.substring(r.length-8):r))}var s=e[e.length-1],s="00000000".substring(8-(s-(s=n[n.length-1]).length))+s;n[n.length-1]=s;for(var u={},h=0,c=Object.entries(t);h<c.length;h++){var l=c[h],p=l[0];u[l[1]]=p}for(var f=n.join(""),d=[],g=f.length,i=0;i<g;){for(var v=1,a=!0,y=null;a&&i+v<=g;){if(""===(p=f.substring(i,i+v)))break;(y=u[p])?a=!1:v++}d.push(parseInt(y,10)),i+=v}return d}function a(t){for(var e=[],o=0;o<t.length;o++)e.push(t.charCodeAt(o));return e}function s(t){for(var e="",o=0,r=t;o<r.length;o++){var n=r[o];e+=String.fromCharCode(n)}return e}h.prototype.set=function(t,e){},h.prototype.get=function(t,e){},h.prototype.rm=function(t){};var u=h;function h(){}t(f,l=u),f.isSupport=function(){return!!window.localStorage},f.prototype.set=function(t,e){try{localStorage.setItem(t,e)}catch(t){console.error(t)}},f.prototype.get=function(t,e){var o=null;try{o=localStorage.getItem(t)}catch(t){console.error(t)}e&&e(o)},f.prototype.rm=function(t){try{localStorage.removeItem(t)}catch(t){console.error(t)}};var l,p=f;function f(){return null!==l&&l.apply(this,arguments)||this}t(v,d=u),v.isSupport=function(){return!!window.indexedDB},v.prototype.set=function(t,e){this.db?this.db.transaction([this.databaseName],"readwrite").objectStore(this.databaseName).add({key:t,value:e}):this.setQueue.push({key:t,value:e})},v.prototype.get=function(t,e){var o;this.db?(o=this.db.transaction([this.databaseName]).objectStore(this.databaseName).get(t)).onsuccess=function(){var t=o.result||{value:""};e(t.value)}:this.getQueue.push({key:t,cb:e})},v.prototype.runQueueTask=function(){var e=this;this.setQueue.forEach(function(t){e.set(t.key,t.value)}),this.getQueue.forEach(function(t){e.get(t.key,t.cb)})};var d,g=v;function v(){var e=d.call(this)||this,t=(e.databaseName="spyLC",e.db=null,e.setQueue=[],e.getQueue=[],window.indexedDB.open(e.databaseName));return t.onupgradeneeded=function(t){e.db=t.target&&t.target.result,e.db&&!e.db.objectStoreNames.contains(e.databaseName)&&e.db.createObjectStore(e.databaseName,{keyPath:"key"}),e.runQueueTask()},t.onsuccess=function(){e.db=t.result,e.runQueueTask()},e}function y(t,e){if(!t)return"";(e=void 0===e?!1:e)||(t=(t=>{for(var e="",o=0;o<t.length;o++){var r=t.charCodeAt(o);r<128?e+=String.fromCharCode(r):e=127<r&&r<2048?(e+=String.fromCharCode(r>>6|192))+String.fromCharCode(63&r|128):(e=(e+=String.fromCharCode(r>>12|224))+String.fromCharCode(r>>6&63|128))+String.fromCharCode(63&r|128)}return e})(t));function o(){s.push(1<u.length?String.fromCharCode(a[u]):u)}var r,n,i,a={},s=[],u=t.charAt(0),h=u,c=h,l=256;for(e&&s.push(u),r=1;r<t.length;r++)n=t.charAt(r),e?(i=t.charCodeAt(r),u=i<256?n:a[i]||u+h,s.push(u),h=u.charAt(0),a[l++]=c+h,c=u):a.hasOwnProperty(u+n)?u+=n:(o(),a[u+n]=l++,u=n);e||o();var p=s.join("");return p=e?(t=>{for(var e,o,r="",n=0,i=0;n<t.length;)(e=t.charCodeAt(n))<128?(r+=String.fromCharCode(e),n++):191<e&&e<224?(i=t.charCodeAt(n+1),r+=String.fromCharCode((31&e)<<6|63&i),n+=2):(i=t.charCodeAt(n+1),o=t.charCodeAt(n+2),r+=String.fromCharCode((15&e)<<12|(63&i)<<6|63&o),n+=3);return r})(p):p}function m(t){void 0===t&&(t={}),this.tmpList=[],this.option=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(Object.assign||function(t){for(var e,o=1,r=arguments.length;o<r;o++)for(var n in e=arguments[o])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,t)}({defaultTrigger:!0,compress:"lzw",key:"SpyLocalCache",interval:500,maxRecordLen:30,onFlush:function(){},onSave:function(){},onAdd:function(){return!0},storage:g.isSupport()?"indexedDB":p.isSupport()?"localstorage":"empty"},t),this.load=this.load.bind(this),this.init()}return m.prototype.init=function(){"indexedDB"===this.option.storage?this.storage=new g:"localstorage"===this.option.storage?this.storage=new p:this.storage=new u,"complete"===document.readyState?this.load():window.addEventListener("load",this.load)},m.prototype.load=function(){-1<location.search.indexOf("_FlushLogLocalCache=1")&&this.option.defaultTrigger&&this.flushLog()},m.prototype.addLog=function(t){var e=this;this.option.onAdd&&!this.option.onAdd(t)||(t=JSON.stringify(t),this.tmpList.push(t),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){e.save()},this.option.interval))},m.prototype.getData=function(r){var n=this;try{this.storage.get(this.option.key,function(o){o?n.storage.get(n.option.key+"Codes",function(t){var e=[];try{t=t&&JSON.parse(t);e=n.unzip(o,t).split("\n")}catch(t){console.error(t)}r(e)}):r([])})}catch(t){console.error(t),r([])}},m.prototype.save=function(){var a=this,s=Date.now();this.getData(function(t){var e=a.option.maxRecordLen-1,e=(t.length>e?t.slice(t.length-e,t.length):t).concat(a.tmpList),t=e.join("\n"),o=null,r=0;try{var n,i=a.zip(t);i.codes?(n=JSON.stringify(i.codes),a.storage.set(a.option.key+"Codes",n)):a.storage.rm(a.option.key+"Codes"),a.storage.set(a.option.key,i.result),r=i.result.length}catch(t){o=t,console.error(t)}a.tmpList=[],a.option.onSave&&a.option.onSave({cost:Date.now()-s,length:r/1024,list:e,error:o})})},m.prototype.flushLog=function(){var o=this;this.getData(function(e){try{for(var t=0;t<e.length;t++)e[t]=JSON.parse(e[t])}catch(t){e=[],o.storage.rm(o.option.key),console.error(t)}for(t=0;t<o.tmpList.length;t++)e.push(JSON.parse(o.tmpList[t]));o.option.onFlush&&o.option.onFlush(e)})},m.prototype.zip=function(t){var e,o;return"lzw"===this.option.compress?{codes:null,result:y(t)}:"huffman"===this.option.compress?(o=(e=n(a(e=t))).result,{codes:e.codes,result:s(o)}):{codes:null,result:t}},m.prototype.unzip=function(t,e){return"lzw"===this.option.compress?y(t,!0):"huffman"===this.option.compress?s(i(e,a(t))):t},m});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SpyLocalCache=e()}(this,function(){"use strict";var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};function e(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}"function"==typeof SuppressedError&&SuppressedError;var r=function(){function t(t,e){this.data=t,this.weight=e}return t.prototype.preOrder=function(t){t.push(this),this.left&&this.left.preOrder(t),this.right&&this.right.preOrder(t)},t}();function o(t){var e=function(t){for(var e=[],o={},n=0,i=t;n<i.length;n++){var a=i[n];null==o[a]?o[a]=1:o[a]++}for(var s=0,u=Object.entries(o);s<u.length;s++){var c=u[s],h=c[0],l=c[1];e.push(new r(h,l))}return e}(t),o=function(t){for(var e=function(t,e){return t.weight-e.weight};t.length>1;){t.sort(e);var o=t.shift(),n=t.shift();if(o&&n){var i=new r(null,o.weight+n.weight);i.left=o,i.right=n,t.unshift(i)}}return t.shift()}(e),n=function(t){if(null==t)return null;var e={};return function t(r,o,n){var i=[].concat(n);i.push(o),null!=r&&(null==r.data?(t(r.left,"0",i),t(r.right,"1",i)):e[r.data]=i.join(""))}(t,"",[]),e}(o),i=function(t,e){for(var r=[],o=0,n=t;o<n.length;o++){var i=n[o];r.push(e[i])}return r}(t,n);return{result:function(t){for(var e=t.join(""),r=Math.ceil(e.length/8),o=new Array(r+1),n=0,i="",a=0;a<e.length;a+=8)i=e.substring(a,a+8),o[n]=parseInt(i,2),n++;return o[n]=i.length,o}(i),codes:n}}function n(t,e){t&&(e|=256);var r=Number(e).toString(2);return t?r.substring(r.length-8):r}function i(t){for(var e=[],r=0;r<t.length;r++)e.push(t.charCodeAt(r));return e}function a(t){for(var e="",r=0,o=t;r<o.length;r++){var n=o[r];e+=String.fromCharCode(n)}return e}function s(t,e){return a(function(t,e){for(var r=[],o=0;o<e.length-1;o++){var i=o!==e.length-2;r.push(n(i,e[o]))}var a=r[r.length-1],s=e[e.length-1];a="00000000".substring(8-(s-a.length))+a,r[r.length-1]=a;for(var u={},c=0,h=Object.entries(t);c<h.length;c++){var l=h[c],f=l[0];u[l[1]]=f}var p=r.join(""),d=[],g=p.length;for(o=0;o<g;){for(var v=1,y=(i=!0,null);i&&o+v<=g&&""!==(f=p.substring(o,o+v));)(y=u[f])?i=!1:v++;d.push(parseInt(y,10)),o+=v}return d}(t,i(e)))}var u=function(){function t(){}return t.prototype.set=function(t,e){},t.prototype.get=function(t,e){},t.prototype.rm=function(t){},t}(),c=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.isSupport=function(){return!!window.localStorage},r.prototype.set=function(t,e){try{localStorage.setItem(t,e)}catch(t){console.error(t)}},r.prototype.get=function(t,e){var r=null;try{r=localStorage.getItem(t)}catch(t){console.error(t)}e&&e(r)},r.prototype.rm=function(t){try{localStorage.removeItem(t)}catch(t){console.error(t)}},r}(u),h=function(t){function r(){var e=t.call(this)||this;e.databaseName="spyLC",e.db=null,e.setQueue=[],e.getQueue=[];var r=window.indexedDB.open(e.databaseName);return r.onupgradeneeded=function(t){e.db=t.target&&t.target.result,e.db&&!e.db.objectStoreNames.contains(e.databaseName)&&e.db.createObjectStore(e.databaseName,{keyPath:"key"}),e.runQueueTask()},r.onsuccess=function(){e.db=r.result,e.runQueueTask()},e}return e(r,t),r.isSupport=function(){return!!window.indexedDB},r.prototype.set=function(t,e){this.db?this.db.transaction([this.databaseName],"readwrite").objectStore(this.databaseName).add({key:t,value:e}):this.setQueue.push({key:t,value:e})},r.prototype.get=function(t,e){if(this.db){var r=this.db.transaction([this.databaseName]).objectStore(this.databaseName).get(t);r.onsuccess=function(){var t=r.result?r.result:{value:""};e(t.value)}}else this.getQueue.push({key:t,cb:e})},r.prototype.runQueueTask=function(){var t=this;this.setQueue.forEach(function(e){t.set(e.key,e.value)}),this.getQueue.forEach(function(e){t.get(e.key,e.cb)})},r}(u);function l(t,e){if(void 0===e&&(e=!1),!t)return"";e||(t=function(t){for(var e="",r=0;r<t.length;r++){var o=t.charCodeAt(r);o<128?e+=String.fromCharCode(o):o>127&&o<2048?(e+=String.fromCharCode(o>>6|192),e+=String.fromCharCode(63&o|128)):(e+=String.fromCharCode(o>>12|224),e+=String.fromCharCode(o>>6&63|128),e+=String.fromCharCode(63&o|128))}return e}(t));var r,o,n,i={},a=[],s=t.charAt(0),u=s,c=u,h=256,l=function(){a.push(s.length>1?String.fromCharCode(i[s]):s)};for(e&&a.push(s),r=1;r<t.length;r++)o=t.charAt(r),e?(n=t.charCodeAt(r),s=n<256?o:i[n]||s+u,a.push(s),u=s.charAt(0),i[h++]=c+u,c=s):i.hasOwnProperty(s+o)?s+=o:(l(),i[s+o]=h++,s=o);e||l();var f=a.join("");return e&&(f=function(t){for(var e="",r=0,o=0,n=0,i=0;r<t.length;)(o=t.charCodeAt(r))<128?(e+=String.fromCharCode(o),r++):o>191&&o<224?(n=t.charCodeAt(r+1),e+=String.fromCharCode((31&o)<<6|63&n),r+=2):(n=t.charCodeAt(r+1),i=t.charCodeAt(r+2),e+=String.fromCharCode((15&o)<<12|(63&n)<<6|63&i),r+=3);return e}(f)),f}var f=function(){function t(t){void 0===t&&(t={}),this.tmpList=[],this.option=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.assign||function(t){for(var e=void 0,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t};return r.apply(null,t)}({defaultTrigger:!0,compress:"lzw",key:"SpyLocalCache",interval:500,maxRecordLen:30,onFlush:function(){},onSave:function(){},onAdd:function(){return!0},storage:h.isSupport()?"indexedDB":c.isSupport()?"localstorage":"empty"},t),this.load=this.load.bind(this),this.init()}return t.prototype.init=function(){"indexedDB"===this.option.storage?this.storage=new h:"localstorage"===this.option.storage?this.storage=new c:this.storage=new u,"complete"===document.readyState?this.load():window.addEventListener("load",this.load)},t.prototype.load=function(){location.search.indexOf("_FlushLogLocalCache=1")>-1&&this.option.defaultTrigger&&this.flushLog()},t.prototype.addLog=function(t){var e=this;this.option.onAdd&&!this.option.onAdd(t)||(t=JSON.stringify(t),this.tmpList.push(t),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){e.save()},this.option.interval))},t.prototype.getData=function(t){var e=this;try{this.storage.get(this.option.key,function(r){r?e.storage.get(e.option.key+"Codes",function(o){var n=[];try{o&&(o=JSON.parse(o)),n=e.unzip(r,o).split("\n")}catch(t){console.error(t)}t(n)}):t([])})}catch(e){console.error(e),t([])}},t.prototype.save=function(){var t=this,e=Date.now();this.getData(function(r){var o=t.option.maxRecordLen-1,n=(r.length>o?r.slice(r.length-o,r.length):r).concat(t.tmpList),i=n.join("\n"),a=null,s=0;try{var u=t.zip(i),c="";u.codes?(c=JSON.stringify(u.codes),t.storage.set(t.option.key+"Codes",c)):t.storage.rm(t.option.key+"Codes"),t.storage.set(t.option.key,u.result),s=u.result.length}catch(t){a=t,console.error(t)}t.tmpList=[],t.option.onSave&&t.option.onSave({cost:Date.now()-e,length:s/1024,list:n,error:a})})},t.prototype.flushLog=function(){var t=this;this.getData(function(e){try{for(var r=0;r<e.length;r++)e[r]=JSON.parse(e[r])}catch(r){e=[],t.storage.rm(t.option.key),console.error(r)}for(r=0;r<t.tmpList.length;r++)e.push(JSON.parse(t.tmpList[r]));t.option.onFlush&&t.option.onFlush(e)})},t.prototype.zip=function(t){return"lzw"===this.option.compress?{codes:null,result:l(t)}:"huffman"===this.option.compress?function(t){var e=o(i(t)),r=e.result;return{codes:e.codes,result:a(r)}}(t):{codes:null,result:t}},t.prototype.unzip=function(t,e){return"lzw"===this.option.compress?l(t,!0):"huffman"===this.option.compress?s(e,t):t},t}();return f});
package/package.json CHANGED
@@ -1,22 +1,23 @@
1
1
  {
2
2
  "name": "spy-client",
3
- "version": "2.1.15",
3
+ "version": "2.2.1",
4
4
  "description": "spy client",
5
5
  "main": "dist/spy-client.js",
6
6
  "module": "dist/spy-client.esm.js",
7
7
  "typings": "dist/spy-client.d.ts",
8
+ "packageManager": "pnpm@10.33.0",
9
+ "engines": {
10
+ "node": ">=24"
11
+ },
8
12
  "scripts": {
9
- "w_dev": "rm -fr dist && NODE_ENV=development webpack --config webpack.dev.config.ts",
10
- "w_watch": "rm -fr dist && NODE_ENV=development webpack -w --config webpack.dev.config.ts",
11
- "w_build": "rm -fr dist && NODE_ENV=production webpack --config webpack.prod.config.ts",
12
- "dev": "rollup -c --environment NODE_ENV:development",
13
- "watch": "NODE_OPTIONS='--max-old-space-size=4096' rollup -cw --environment NODE_ENV:development",
14
- "build": "rollup -c --environment NODE_ENV:production",
15
- "lint": "eslint src/**/*.ts",
16
- "example": "npm run dev && echo 'open url http://localhost:8000/example' && python -m SimpleHTTPServer 8000 ",
17
- "test": "karma start karma.conf.js",
18
- "release_pre": "rm -fr dist && npm run build && npm run lint && npm run test",
19
- "release": "npm version patch && npm publish --registry=https://registry.npmjs.org",
13
+ "dev": "rollup -c",
14
+ "watch": "NODE_OPTIONS='--max-old-space-size=4096' rollup -cw",
15
+ "build": "rm -fr dist && rollup -c && tsc -p tsconfig.json --declaration --emitDeclarationOnly --declarationDir dist",
16
+ "lint": "oxlint src",
17
+ "example": "pnpm run dev && echo 'open url http://localhost:8000/example' && python3 -m http.server 8000",
18
+ "test": "playwright test",
19
+ "release_pre": "pnpm run build && pnpm run lint && pnpm run test",
20
+ "release": "pnpm version patch && pnpm publish --registry=https://registry.npmjs.org",
20
21
  "release_post": "git push origin master && git push origin --tags"
21
22
  },
22
23
  "directories": {
@@ -26,55 +27,6 @@
26
27
  "dependencies": {
27
28
  "core-js": "^3.6.4"
28
29
  },
29
- "devDependencies": {
30
- "@babel/core": "^7.15.0",
31
- "@babel/eslint-parser": "^7.15.0",
32
- "@babel/eslint-plugin": "^7.14.5",
33
- "@babel/preset-env": "^7.5.5",
34
- "@ecomfe/eslint-config": "^7.2.1",
35
- "@rollup/plugin-commonjs": "^11.0.2",
36
- "@rollup/plugin-node-resolve": "^7.1.1",
37
- "@rollup/plugin-typescript": "^8.2.5",
38
- "@types/glob": "^7.1.1",
39
- "@types/jasmine": "^3.5.10",
40
- "@types/node": "^12.6.8",
41
- "@types/uglifyjs-webpack-plugin": "^1.1.0",
42
- "@types/webpack": "^4.4.35",
43
- "@types/webpack-merge": "^4.1.5",
44
- "@typescript-eslint/eslint-plugin": "^4.29.2",
45
- "@typescript-eslint/parser": "^4.29.2",
46
- "babel-eslint": "^10.1.0",
47
- "babel-loader": "^8.0.6",
48
- "cache-loader": "^4.1.0",
49
- "css-loader": "^3.1.0",
50
- "eslint": "^6.8.0",
51
- "eslint-plugin-babel": "^5.3.0",
52
- "eslint-plugin-import": "^2.24.1",
53
- "fastify": "^3.21.0",
54
- "fastify-cors": "^6.0.2",
55
- "fecs": "^1.6.4",
56
- "file-loader": "^4.1.0",
57
- "jasmine-core": "^3.4.0",
58
- "karma": "^6.3.4",
59
- "karma-chrome-launcher": "^3.1.0",
60
- "karma-jasmine": "^2.0.1",
61
- "karma-jasmine-html-reporter": "^1.4.2",
62
- "karma-typescript": "^5.5.2",
63
- "less": "^3.9.0",
64
- "less-loader": "^5.0.0",
65
- "rollup": "^2.56.2",
66
- "rollup-plugin-babel": "^4.4.0",
67
- "rollup-plugin-replace": "^2.2.0",
68
- "rollup-plugin-typescript2": "^0.30.0",
69
- "rollup-plugin-uglify": "^6.0.4",
70
- "stylus": "^0.54.5",
71
- "stylus-loader": "^3.0.2",
72
- "ts-loader": "^6.0.4",
73
- "ts-node": "^8.3.0",
74
- "typescript": "^4.3.5",
75
- "uglifyjs-webpack-plugin": "^2.1.3",
76
- "url-loader": "^2.1.0"
77
- },
78
30
  "keywords": [
79
31
  "spy",
80
32
  "client",
@@ -99,22 +51,23 @@
99
51
  },
100
52
  "author": "kaivean",
101
53
  "license": "ISC",
102
- "babel": {
103
- "comments": false,
104
- "presets": [],
105
- "env": {
106
- "test": {
107
- "plugins": [
108
- "istanbul"
109
- ]
110
- }
111
- }
112
- },
113
54
  "browserslist": [
114
55
  "> 1%",
115
56
  "last 2 versions",
116
57
  "ie >= 9",
117
58
  "android >= 4",
118
59
  "ios >= 9"
119
- ]
60
+ ],
61
+ "devDependencies": {
62
+ "@playwright/test": "^1.63.0",
63
+ "@rollup/plugin-commonjs": "^29.0.3",
64
+ "@rollup/plugin-node-resolve": "^16.0.3",
65
+ "@rollup/plugin-terser": "^1.0.0",
66
+ "@rollup/plugin-typescript": "^12.3.0",
67
+ "@types/node": "^26.4.1",
68
+ "oxlint": "^1.81.0",
69
+ "rollup": "^4.63.1",
70
+ "tslib": "^2.8.1",
71
+ "typescript": "^6.0.3"
72
+ }
120
73
  }
@@ -0,0 +1,4 @@
1
+ {
2
+ "status": "passed",
3
+ "failedTests": []
4
+ }
package/karma.conf.js DELETED
@@ -1,111 +0,0 @@
1
- /**
2
- * @file karma测试配置,放弃了karma-typescript,不支持相对导入,采用了webpack
3
- * @author kaivean
4
- */
5
-
6
-
7
- // const webpack = require('webpack');
8
-
9
- module.exports = config => {
10
- config.set({
11
-
12
- // base path that will be used to resolve all patterns (eg. files, exclude)
13
- basePath: './',
14
-
15
- // frameworks to use
16
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
17
- frameworks: ['jasmine', 'karma-typescript'],
18
-
19
- // plugins: ['karma-webpack'],
20
- client: {
21
- jasmine: {
22
- random: false,
23
- },
24
- },
25
-
26
- // list of files / patterns to load in the browser
27
- files: [
28
- 'dist/spy-head.js', // 先加载
29
- // 'dist/spy-client.js', // 先加载
30
- // 'src/index.ts',
31
- // 'test/**/basicSpec.ts',
32
- // 'test/**/headSpec.ts',
33
- // 'test/**/metricSpec.ts',
34
- // 'test/**/*Spec.ts',
35
- {
36
- pattern: 'test/**/*Spec.ts',
37
- watched: false, // 监听变化
38
- included: true, // script加载到页面里
39
- served: true, // be served by Karma's webserver
40
- nocache: false, // 为了保证测试到一些case,比如lcp等
41
- },
42
- ],
43
-
44
- // list of files / patterns to exclude
45
- exclude: [
46
-
47
- ],
48
-
49
- // preprocess matching files before serving them to the browser
50
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
51
- preprocessors: {
52
- 'test/**/*.ts': ['karma-typescript'],
53
- },
54
-
55
- karmaTypescriptConfig: {
56
- exclude: ['node_modules'],
57
- include: ['test/**/*.ts'],
58
- compilerOptions: {
59
- baseUrl: '.',
60
- paths: {
61
- 'spy-client': ['dist/spy-client.js'],
62
- },
63
- },
64
- transformPath(filepath) {
65
- return filepath.replace(/\.(ts|tsx)$/, '.js');
66
- },
67
- // tsconfig: './tsconfig.json',
68
- },
69
-
70
- reporters: ['progress', 'kjhtml', 'karma-typescript'],
71
-
72
- // web server port
73
- port: 9876,
74
-
75
- // enable / disable colors in the output (reporters and logs)
76
- colors: true,
77
-
78
- // level of logging
79
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
80
- logLevel: config.LOG_INFO,
81
-
82
- // enable / disable watching file and executing tests whenever any file changes
83
- autoWatch: true,
84
-
85
- // start these browsers
86
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
87
- browsers: ['Chrome'],
88
-
89
- // you can define custom flags
90
- customLaunchers: {
91
- ChromeHeadlessNoSandbox: {
92
- base: 'ChromeHeadless',
93
- flags: ['--no-sandbox'],
94
- },
95
- },
96
-
97
- // Continuous Integration mode
98
- // if true, Karma captures browsers, runs the tests and exits
99
- singleRun: true,
100
-
101
- // Concurrency level
102
- // how many browser should be started simultaneous
103
- concurrency: Infinity,
104
- });
105
-
106
- if (process.env.TRAVIS) {
107
- config.set({
108
- browsers: ['ChromeHeadless', 'ChromeHeadlessNoSandbox'],
109
- });
110
- }
111
- };