@swifty.js/sentry 0.0.5 → 0.0.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.
Files changed (123) hide show
  1. package/README.md +108 -110
  2. package/dist/constants/index.cjs +1 -1
  3. package/dist/constants/index.js +1 -1
  4. package/dist/core/api.cjs +1 -1
  5. package/dist/core/api.d.ts +28 -9
  6. package/dist/core/api.js +1 -1
  7. package/dist/core/breadcrumb.cjs +1 -1
  8. package/dist/core/breadcrumb.js +1 -1
  9. package/dist/core/decorate-http.cjs +1 -1
  10. package/dist/core/decorate-http.js +1 -1
  11. package/dist/core/decorate-route.cjs +1 -1
  12. package/dist/core/decorate-route.js +1 -1
  13. package/dist/core/decorates.cjs +1 -1
  14. package/dist/core/decorates.js +1 -1
  15. package/dist/core/error-dedup.cjs +1 -0
  16. package/dist/core/error-dedup.js +1 -0
  17. package/dist/core/framework-error.cjs +1 -1
  18. package/dist/core/framework-error.js +1 -1
  19. package/dist/core/handle-code-error.cjs +1 -1
  20. package/dist/core/handle-code-error.js +1 -1
  21. package/dist/core/handle-error.cjs +1 -1
  22. package/dist/core/handle-error.js +1 -1
  23. package/dist/core/handle-events.cjs +1 -1
  24. package/dist/core/handle-events.js +1 -1
  25. package/dist/core/handle-route.cjs +1 -1
  26. package/dist/core/handle-route.js +1 -1
  27. package/dist/core/options-schema.cjs +1 -1
  28. package/dist/core/options-schema.d.ts +42 -44
  29. package/dist/core/options-schema.js +1 -1
  30. package/dist/core/pv-lifecycle.cjs +1 -1
  31. package/dist/core/pv-lifecycle.js +1 -1
  32. package/dist/core/sdk-lifecycle.cjs +1 -1
  33. package/dist/core/sdk-lifecycle.js +1 -1
  34. package/dist/core/setup.cjs +1 -1
  35. package/dist/core/setup.js +1 -1
  36. package/dist/core/white-screen.cjs +1 -1
  37. package/dist/core/white-screen.js +1 -1
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.d.ts +4 -5
  40. package/dist/index.js +1 -1
  41. package/dist/node/dev-endpoint.cjs +1 -0
  42. package/dist/node/dev-endpoint.js +1 -0
  43. package/dist/package.json.cjs +1 -1
  44. package/dist/package.json.js +1 -1
  45. package/dist/plugins/exposure/index.cjs +1 -1
  46. package/dist/plugins/exposure/index.d.ts +0 -1
  47. package/dist/plugins/exposure/index.js +1 -1
  48. package/dist/plugins/performance/first-screen-paint.cjs +1 -1
  49. package/dist/plugins/performance/first-screen-paint.js +1 -1
  50. package/dist/plugins/performance/index.cjs +1 -1
  51. package/dist/plugins/performance/index.d.ts +0 -1
  52. package/dist/plugins/performance/index.js +1 -1
  53. package/dist/plugins/performance/navigation-timing.cjs +1 -1
  54. package/dist/plugins/performance/navigation-timing.js +1 -1
  55. package/dist/plugins/performance/perf.cjs +1 -1
  56. package/dist/plugins/performance/perf.js +1 -1
  57. package/dist/plugins/performance/resource-element-fallback.cjs +1 -1
  58. package/dist/plugins/performance/resource-element-fallback.js +1 -1
  59. package/dist/plugins/performance/resource-timing.cjs +1 -1
  60. package/dist/plugins/performance/resource-timing.js +1 -1
  61. package/dist/plugins/screen-record/index.cjs +1 -1
  62. package/dist/plugins/screen-record/index.js +1 -1
  63. package/dist/plugins/screen-record/recorder.cjs +1 -1
  64. package/dist/plugins/screen-record/recorder.d.ts +1 -1
  65. package/dist/plugins/screen-record/recorder.js +1 -1
  66. package/dist/react.d.ts +6 -80
  67. package/dist/reporter/index.cjs +1 -1
  68. package/dist/reporter/index.js +1 -1
  69. package/dist/reporter/network-listener.cjs +1 -1
  70. package/dist/reporter/network-listener.js +1 -1
  71. package/dist/reporter/offline-cache.cjs +1 -1
  72. package/dist/reporter/offline-cache.js +1 -1
  73. package/dist/reporter/report-data-schema.cjs +1 -1
  74. package/dist/reporter/report-data-schema.js +1 -1
  75. package/dist/reporter/report-data.cjs +1 -1
  76. package/dist/reporter/report-data.js +1 -1
  77. package/dist/reporter/server-recovery.cjs +1 -1
  78. package/dist/reporter/server-recovery.js +1 -1
  79. package/dist/reporter/transports.cjs +1 -1
  80. package/dist/reporter/transports.js +1 -1
  81. package/dist/source-map/source-map.cjs +1 -1
  82. package/dist/source-map/source-map.js +1 -1
  83. package/dist/types/common.d.ts +9 -10
  84. package/dist/types/enums.cjs +1 -1
  85. package/dist/types/enums.d.ts +1 -43
  86. package/dist/types/enums.js +1 -1
  87. package/dist/types/options.d.ts +9 -13
  88. package/dist/types/plugin.cjs +1 -1
  89. package/dist/types/plugin.d.ts +0 -3
  90. package/dist/types/plugin.js +1 -1
  91. package/dist/utils/data-structures.cjs +1 -1
  92. package/dist/utils/data-structures.js +1 -1
  93. package/dist/utils/get-base-data.cjs +1 -1
  94. package/dist/utils/get-base-data.js +1 -1
  95. package/dist/utils/logger.cjs +1 -1
  96. package/dist/utils/logger.js +1 -1
  97. package/dist/utils/noop.cjs +1 -0
  98. package/dist/utils/noop.js +1 -0
  99. package/dist/utils/sentry.cjs +1 -1
  100. package/dist/utils/sentry.js +1 -1
  101. package/dist/utils/session.cjs +1 -1
  102. package/dist/utils/session.js +1 -1
  103. package/dist/utils/throttle.cjs +1 -1
  104. package/dist/utils/throttle.js +1 -1
  105. package/dist/utils/transform-http-data.cjs +1 -1
  106. package/dist/utils/transform-http-data.js +1 -1
  107. package/dist/utils/uuid.cjs +1 -0
  108. package/dist/utils/uuid.js +1 -0
  109. package/dist/vite.cjs +1 -1
  110. package/dist/vite.d.ts +2 -2
  111. package/dist/vite.js +1 -1
  112. package/dist/vue.cjs +1 -1
  113. package/dist/vue.js +1 -1
  114. package/dist/webpack.cjs +1 -1
  115. package/dist/webpack.js +1 -1
  116. package/package.json +2 -5
  117. package/dist/core/ip.cjs +0 -1
  118. package/dist/core/ip.d.ts +0 -24
  119. package/dist/core/ip.js +0 -1
  120. package/dist/reporter/batch.cjs +0 -1
  121. package/dist/reporter/batch.js +0 -1
  122. package/dist/utils/base64.cjs +0 -1
  123. package/dist/utils/base64.js +0 -1
@@ -1 +1 @@
1
- "use strict";var t=require("../constants/index.cjs");exports.BoundedSet=class{map=new Map;capacity;constructor(t){this.capacity=t}has(t){return this.map.has(t)}add(t){if(this.map.has(t)&&this.map.delete(t),this.map.set(t,!0),this.map.size>this.capacity){const t=this.map.keys().next().value;void 0!==t&&this.map.delete(t)}}clear(){this.map.clear()}},exports.CallbackQueue=class{cbList=[];isFlushing=!1;push(t,s,...i){"function"==typeof t&&this.callByRequestIdleCallback(t,s,...i)}callByRequestIdleCallback(t,s,...i){this.cbList.push(t.bind(s,...i)),this.isFlushing||(this.isFlushing=!0,"function"==typeof requestIdleCallback?requestIdleCallback(()=>{this.flushFuncList()}):Promise.resolve().then(()=>{this.flushFuncList()}))}clear(){this.cbList=[],this.isFlushing=!1}flushFuncList(){const t=this.cbList;this.cbList=[],this.isFlushing=!1,t.forEach(t=>{t()})}},exports.MinHeap=class{capacity=t.MAX_BREADCRUMBS;heap=[];get size(){return this.heap.length}constructor(s=t.MAX_BREADCRUMBS,i=[]){if(this.capacity=s,this.heap=i.slice(0,s),this.buildHeap(),i.length>s){const t=i.slice(s);for(const s of t)s.timestamp>=this.heap[0].timestamp&&(this.heap[0]=s,this.heapifyDown(0))}}push(t){return this.size<this.capacity?(this.heap.push(t),this.heapifyUp(this.size-1),!0):t.timestamp>=this.heap[0].timestamp&&(this.heap[0]=t,this.heapifyDown(0),!0)}peek(){return this.heap[0]}heapifyUp(t){for(;t>0;){const s=Math.floor((t-1)/2);if(this.heap[s].timestamp<=this.heap[t].timestamp)break;[this.heap[t],this.heap[s]]=[this.heap[s],this.heap[t]],t=s}}heapifyDown(t){for(;;){let s=t;const i=2*t+1,e=2*t+2;if(i<this.size&&this.heap[i].timestamp<this.heap[s].timestamp&&(s=i),e<this.size&&this.heap[e].timestamp<this.heap[s].timestamp&&(s=e),s===t)break;[this.heap[t],this.heap[s]]=[this.heap[s],this.heap[t]],t=s}}buildHeap(){const t=this.size-1;for(let s=Math.floor((t-1)/2);s>=0;s--)this.heapifyDown(s)}dump(){return[...this.heap].sort((t,s)=>t.timestamp-s.timestamp)}clear(){this.heap=[]}pop(){if(0===this.size)return;const t=this.heap[0];return this.heap[0]=this.heap[this.size-1],this.heap.pop(),this.size>0&&this.heapifyDown(0),t}};
1
+ "use strict";var t=require("../constants/index.cjs");exports.BoundedList=class{capacity;items=[];constructor(s=t.MAX_BREADCRUMBS){this.capacity=s}push(t){this.items.push(t),this.items.length>this.capacity&&this.items.splice(0,this.items.length-this.capacity)}dump(){return[...this.items]}clear(){this.items=[]}},exports.BoundedSet=class{map=new Map;capacity;constructor(t){this.capacity=t}has(t){return this.map.has(t)}add(t){if(this.map.has(t)&&this.map.delete(t),this.map.set(t,!0),this.map.size>this.capacity){const t=this.map.keys().next().value;void 0!==t&&this.map.delete(t)}}clear(){this.map.clear()}};
@@ -1 +1 @@
1
- import{MAX_BREADCRUMBS as t}from"../constants/index.js";class s{capacity=t;heap=[];get size(){return this.heap.length}constructor(s=t,i=[]){if(this.capacity=s,this.heap=i.slice(0,s),this.buildHeap(),i.length>s){const t=i.slice(s);for(const s of t)s.timestamp>=this.heap[0].timestamp&&(this.heap[0]=s,this.heapifyDown(0))}}push(t){return this.size<this.capacity?(this.heap.push(t),this.heapifyUp(this.size-1),!0):t.timestamp>=this.heap[0].timestamp&&(this.heap[0]=t,this.heapifyDown(0),!0)}peek(){return this.heap[0]}heapifyUp(t){for(;t>0;){const s=Math.floor((t-1)/2);if(this.heap[s].timestamp<=this.heap[t].timestamp)break;[this.heap[t],this.heap[s]]=[this.heap[s],this.heap[t]],t=s}}heapifyDown(t){for(;;){let s=t;const i=2*t+1,h=2*t+2;if(i<this.size&&this.heap[i].timestamp<this.heap[s].timestamp&&(s=i),h<this.size&&this.heap[h].timestamp<this.heap[s].timestamp&&(s=h),s===t)break;[this.heap[t],this.heap[s]]=[this.heap[s],this.heap[t]],t=s}}buildHeap(){const t=this.size-1;for(let s=Math.floor((t-1)/2);s>=0;s--)this.heapifyDown(s)}dump(){return[...this.heap].sort((t,s)=>t.timestamp-s.timestamp)}clear(){this.heap=[]}pop(){if(0===this.size)return;const t=this.heap[0];return this.heap[0]=this.heap[this.size-1],this.heap.pop(),this.size>0&&this.heapifyDown(0),t}}class i{map=new Map;capacity;constructor(t){this.capacity=t}has(t){return this.map.has(t)}add(t){if(this.map.has(t)&&this.map.delete(t),this.map.set(t,!0),this.map.size>this.capacity){const t=this.map.keys().next().value;void 0!==t&&this.map.delete(t)}}clear(){this.map.clear()}}class h{cbList=[];isFlushing=!1;push(t,s,...i){"function"==typeof t&&this.callByRequestIdleCallback(t,s,...i)}callByRequestIdleCallback(t,s,...i){this.cbList.push(t.bind(s,...i)),this.isFlushing||(this.isFlushing=!0,"function"==typeof requestIdleCallback?requestIdleCallback(()=>{this.flushFuncList()}):Promise.resolve().then(()=>{this.flushFuncList()}))}clear(){this.cbList=[],this.isFlushing=!1}flushFuncList(){const t=this.cbList;this.cbList=[],this.isFlushing=!1,t.forEach(t=>{t()})}}export{i as BoundedSet,h as CallbackQueue,s as MinHeap};
1
+ import{MAX_BREADCRUMBS as t}from"../constants/index.js";class s{capacity;items=[];constructor(s=t){this.capacity=s}push(t){this.items.push(t),this.items.length>this.capacity&&this.items.splice(0,this.items.length-this.capacity)}dump(){return[...this.items]}clear(){this.items=[]}}class i{map=new Map;capacity;constructor(t){this.capacity=t}has(t){return this.map.has(t)}add(t){if(this.map.has(t)&&this.map.delete(t),this.map.set(t,!0),this.map.size>this.capacity){const t=this.map.keys().next().value;void 0!==t&&this.map.delete(t)}}clear(){this.map.clear()}}export{s as BoundedList,i as BoundedSet};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs"),t=require("./session.cjs");exports.default=function(){return{id:crypto.randomUUID?crypto.randomUUID():t.getDeviceId(),deviceId:t.getDeviceId(),sessionId:t.getSessionId(),message:"",timestamp:Date.now(),time:(new Date).toISOString(),name:"",status:e.Status.OK,type:e.EventType.Custom}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs"),t=require("./session.cjs"),s=require("./uuid.cjs");exports.default=function(){return{id:s.generateUUID(),deviceId:t.getDeviceId(),sessionId:t.getSessionId(),message:"",timestamp:Date.now(),time:(new Date).toISOString(),name:"",status:e.Status.OK,type:e.EventType.Custom}};
@@ -1 +1 @@
1
- import{EventType as t,Status as e}from"../types/enums.js";import{getSessionId as s,getDeviceId as o}from"./session.js";function m(){return{id:crypto.randomUUID?crypto.randomUUID():o(),deviceId:o(),sessionId:s(),message:"",timestamp:Date.now(),time:(new Date).toISOString(),name:"",status:e.OK,type:t.Custom}}export{m as default};
1
+ import{EventType as t,Status as e}from"../types/enums.js";import{getSessionId as s,getDeviceId as m}from"./session.js";import{generateUUID as o}from"./uuid.js";function i(){return{id:o(),deviceId:m(),sessionId:s(),message:"",timestamp:Date.now(),time:(new Date).toISOString(),name:"",status:e.OK,type:t.Custom}}export{i as default};
@@ -1 +1 @@
1
- "use strict";const o="#74d4ff",s="#bbf450",e="#ffb869",r="#ffa2a2",l="#62748e",n="font-family: Iosevka, Maple Mono, Menlo, Cascadia Code;",c=o=>`color: ${o}; ${n}`,a=o=>`color: ${l}; background: ${o}; border-radius: 4px; ${n}`,i={info:{message:c(o),prefix:a(o)},success:{message:c(s),prefix:a(s)},warn:{message:c(e),prefix:a(e)},error:{message:c(r),prefix:a(r)}},g={get isEnabled(){return globalThis.__sentry__?.options.debug??!1},info(o,s,e,r="@swifty.js/sentry"){this.isEnabled&&(console.groupCollapsed(`%c ${r} %c ${o} `,i.info.prefix,i.info.message),void 0!==s&&(Array.isArray(s)?e?console.table(s,e):console.table(s):"object"==typeof s&&null!==s?(console.group("Details"),console.log(s),console.groupEnd()):console.log(s)),console.groupEnd())},success(o,s,e,r="@swifty.js/sentry"){this.isEnabled&&(console.groupCollapsed(`%c ${r} %c ${o} `,i.success.prefix,i.success.message),void 0!==e&&console.log(`%c Time cost %c ${e}ms`,i.success.prefix,i.success.message),void 0!==s&&(Array.isArray(s)?console.table(s):"object"==typeof s&&null!==s?(console.group("Response Data"),console.log(s),console.groupEnd()):console.log(s)),console.groupEnd())},warn(o,s,e="@swifty.js/sentry"){this.isEnabled&&(console.groupCollapsed(`%c ${e} %c ${o} `,i.warn.prefix,i.warn.message),void 0!==s&&(Array.isArray(s)?console.table(s):"object"==typeof s&&null!==s?(console.group("Warning Details"),console.log(s),console.groupEnd()):console.log(s)),console.groupEnd())},error(o,s,e="@swifty.js/sentry"){this.isEnabled&&(console.groupCollapsed(`%c ${e} %c ${o} `,i.error.prefix,i.error.message),void 0!==s&&(console.group("Error Details"),console.error(s),console.groupEnd()),console.groupEnd())}};exports.sentryLogger=g;
1
+ "use strict";const o="#74d4ff",e="#bbf450",s="#ffa2a2",r="#62748e",n="font-family: Iosevka, Maple Mono, Menlo, Cascadia Code;",c=o=>`color: ${o}; ${n}`,l=o=>`color: ${r}; background: ${o}; border-radius: 4px; ${n}`,i={info:{message:c(o),prefix:l(o)},success:{message:c(e),prefix:l(e)},error:{message:c(s),prefix:l(s)}},t=console.error.bind(console),a="@swifty.js/sentry";function f(){return globalThis.__sentry__?.options.debug??!1}function u(o,e,s,r){f()&&(console.groupCollapsed(`%c ${e} %c ${s} `,i[o].prefix,i[o].message),r(),console.groupEnd())}function g(o,e){if(void 0!==o){if(!Array.isArray(o))return"object"==typeof o&&null!==o?(console.group("Details"),console.log(o),void console.groupEnd()):void console.log(o);e?console.table(o,e):console.table(o)}}const d={get isEnabled(){return f()},info(o,e,s,r=a){u("info",r,o,()=>{g(e,s)})},success(o,e,s,r=a){u("success",r,o,()=>{void 0!==s&&console.log(`%c Time cost %c ${s}ms`,i.success.prefix,i.success.message),g(e)})},error(o,e,s=a){u("error",s,o,()=>{void 0!==e&&(console.group("Details"),t(e),console.groupEnd())})}};exports.sentryLogger=d;
@@ -1 +1 @@
1
- const o="#74d4ff",e="#bbf450",s="#ffb869",r="#ffa2a2",l="#62748e",n="font-family: Iosevka, Maple Mono, Menlo, Cascadia Code;",c=o=>`color: ${o}; ${n}`,a=o=>`color: ${l}; background: ${o}; border-radius: 4px; ${n}`,i={info:{message:c(o),prefix:a(o)},success:{message:c(e),prefix:a(e)},warn:{message:c(s),prefix:a(s)},error:{message:c(r),prefix:a(r)}},g={get isEnabled(){return globalThis.__sentry__?.options.debug??!1},info(o,e,s,r="@swifty.js/sentry"){this.isEnabled&&(console.groupCollapsed(`%c ${r} %c ${o} `,i.info.prefix,i.info.message),void 0!==e&&(Array.isArray(e)?s?console.table(e,s):console.table(e):"object"==typeof e&&null!==e?(console.group("Details"),console.log(e),console.groupEnd()):console.log(e)),console.groupEnd())},success(o,e,s,r="@swifty.js/sentry"){this.isEnabled&&(console.groupCollapsed(`%c ${r} %c ${o} `,i.success.prefix,i.success.message),void 0!==s&&console.log(`%c Time cost %c ${s}ms`,i.success.prefix,i.success.message),void 0!==e&&(Array.isArray(e)?console.table(e):"object"==typeof e&&null!==e?(console.group("Response Data"),console.log(e),console.groupEnd()):console.log(e)),console.groupEnd())},warn(o,e,s="@swifty.js/sentry"){this.isEnabled&&(console.groupCollapsed(`%c ${s} %c ${o} `,i.warn.prefix,i.warn.message),void 0!==e&&(Array.isArray(e)?console.table(e):"object"==typeof e&&null!==e?(console.group("Warning Details"),console.log(e),console.groupEnd()):console.log(e)),console.groupEnd())},error(o,e,s="@swifty.js/sentry"){this.isEnabled&&(console.groupCollapsed(`%c ${s} %c ${o} `,i.error.prefix,i.error.message),void 0!==e&&(console.group("Error Details"),console.error(e),console.groupEnd()),console.groupEnd())}};export{g as sentryLogger};
1
+ const o="#74d4ff",e="#bbf450",s="#ffa2a2",r="#62748e",n="font-family: Iosevka, Maple Mono, Menlo, Cascadia Code;",c=o=>`color: ${o}; ${n}`,l=o=>`color: ${r}; background: ${o}; border-radius: 4px; ${n}`,i={info:{message:c(o),prefix:l(o)},success:{message:c(e),prefix:l(e)},error:{message:c(s),prefix:l(s)}},a=console.error.bind(console),f="@swifty.js/sentry";function t(){return globalThis.__sentry__?.options.debug??!1}function u(o,e,s,r){t()&&(console.groupCollapsed(`%c ${e} %c ${s} `,i[o].prefix,i[o].message),r(),console.groupEnd())}function d(o,e){if(void 0!==o){if(!Array.isArray(o))return"object"==typeof o&&null!==o?(console.group("Details"),console.log(o),void console.groupEnd()):void console.log(o);e?console.table(o,e):console.table(o)}}const g={get isEnabled(){return t()},info(o,e,s,r=f){u("info",r,o,()=>{d(e,s)})},success(o,e,s,r=f){u("success",r,o,()=>{void 0!==s&&console.log(`%c Time cost %c ${s}ms`,i.success.prefix,i.success.message),d(e)})},error(o,e,s=f){u("error",s,o,()=>{void 0!==e&&(console.group("Details"),a(e),console.groupEnd())})}};export{g as sentryLogger};
@@ -0,0 +1 @@
1
+ "use strict";exports.noop=function(){};
@@ -0,0 +1 @@
1
+ function n(){}export{n as noop};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../constants/index.cjs"),t=require("./data-structures.cjs"),n=require("ua-parser-js");const r=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e})();function s(){try{const e=document.createElement("canvas"),t=e.getContext("2d");if(t){t.textBaseline="top",t.font="14px 'Arial'",t.fillStyle="#f60",t.fillRect(125,1,62,20),t.fillStyle="#069",t.fillText("@swifty.js/sentry",2,15),t.fillStyle="rgba(102, 204, 0, 0.7)",t.fillText("@swifty.js/sentry",4,17);const n=e.toDataURL().replace("data:image/png;base64,","");return function(e){let t=4294967295;for(let n=0;n<e.length;n++)t=r[255&(t^e.charCodeAt(n))]^t>>>8;return(4294967295^t)>>>0}(atob(n)).toString(16)}}catch{return o()}return o()}function o(){return globalThis.crypto&&"function"==typeof globalThis.crypto.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}class i{static#e;static get instance(){return this.#e||(this.#e=new i,globalThis.__sentry__=this.#e),this.#e}codeErrors=new t.BoundedSet(1e3);whiteScreenTimer=null;options=e.DEFAULT_OPTIONS;deviceInfo;shouldScreenRecord=!1;constructor(){const t=(new n.UAParser).getResult();this.deviceInfo={browserName:t.browser.name??e.UNKNOWN,browserVersion:t.browser.version??e.UNKNOWN,osName:t.os.name??e.UNKNOWN,osVersion:t.os.version??e.UNKNOWN,userAgent:t.ua,deviceModel:t.device.model??e.UNKNOWN,deviceType:t.device.type??e.UNKNOWN,fingerprint:s(),language:"navigator"in globalThis&&globalThis.navigator.language||e.UNKNOWN,screenResolution:"screen"in globalThis?`${globalThis.screen.width}x${globalThis.screen.height}`:e.UNKNOWN}}setOptions(e){i.#e.options={...this.options,...e}}}var a=i.instance;exports.default=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../constants/index.cjs"),s=require("./data-structures.cjs"),o=require("ua-parser-js");const r=new class{codeErrors=new s.BoundedSet(1e3);options={...e.DEFAULT_OPTIONS};shouldScreenRecord=!1;#e=null;get deviceInfo(){return this.#e??=function(){const s=(new o.UAParser).getResult();return{browserName:s.browser.name??e.UNKNOWN,browserVersion:s.browser.version??e.UNKNOWN,osName:s.os.name??e.UNKNOWN,osVersion:s.os.version??e.UNKNOWN,userAgent:s.ua,deviceModel:s.device.model??e.UNKNOWN,deviceType:s.device.type??e.UNKNOWN,language:"navigator"in globalThis&&globalThis.navigator.language||e.UNKNOWN,screenResolution:"screen"in globalThis?`${globalThis.screen.width}x${globalThis.screen.height}`:e.UNKNOWN}}(),this.#e}setOptions(e){this.options={...this.options,...e}}};globalThis.__sentry__=r,exports.default=r;
@@ -1 +1 @@
1
- import{DEFAULT_OPTIONS as e,UNKNOWN as t}from"../constants/index.js";import{BoundedSet as n}from"./data-structures.js";import{UAParser as o}from"ua-parser-js";const s=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e})();function r(){try{const e=document.createElement("canvas"),t=e.getContext("2d");if(t){t.textBaseline="top",t.font="14px 'Arial'",t.fillStyle="#f60",t.fillRect(125,1,62,20),t.fillStyle="#069",t.fillText("@swifty.js/sentry",2,15),t.fillStyle="rgba(102, 204, 0, 0.7)",t.fillText("@swifty.js/sentry",4,17);const n=e.toDataURL().replace("data:image/png;base64,","");return function(e){let t=4294967295;for(let n=0;n<e.length;n++)t=s[255&(t^e.charCodeAt(n))]^t>>>8;return(4294967295^t)>>>0}(atob(n)).toString(16)}}catch{return i()}return i()}function i(){return globalThis.crypto&&"function"==typeof globalThis.crypto.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}class a{static#e;static get instance(){return this.#e||(this.#e=new a,globalThis.__sentry__=this.#e),this.#e}codeErrors=new n(1e3);whiteScreenTimer=null;options=e;deviceInfo;shouldScreenRecord=!1;constructor(){const e=(new o).getResult();this.deviceInfo={browserName:e.browser.name??t,browserVersion:e.browser.version??t,osName:e.os.name??t,osVersion:e.os.version??t,userAgent:e.ua,deviceModel:e.device.model??t,deviceType:e.device.type??t,fingerprint:r(),language:"navigator"in globalThis&&globalThis.navigator.language||t,screenResolution:"screen"in globalThis?`${globalThis.screen.width}x${globalThis.screen.height}`:t}}setOptions(e){a.#e.options={...this.options,...e}}}var l=a.instance;export{l as default};
1
+ import{DEFAULT_OPTIONS as e,UNKNOWN as o}from"../constants/index.js";import{BoundedSet as s}from"./data-structures.js";import{UAParser as n}from"ua-parser-js";const r=new class{codeErrors=new s(1e3);options={...e};shouldScreenRecord=!1;#e=null;get deviceInfo(){return this.#e??=function(){const e=(new n).getResult();return{browserName:e.browser.name??o,browserVersion:e.browser.version??o,osName:e.os.name??o,osVersion:e.os.version??o,userAgent:e.ua,deviceModel:e.device.model??o,deviceType:e.device.type??o,language:"navigator"in globalThis&&globalThis.navigator.language||o,screenResolution:"screen"in globalThis?`${globalThis.screen.width}x${globalThis.screen.height}`:o}}(),this.#e}setOptions(e){this.options={...this.options,...e}}};globalThis.__sentry__=r;export{r as default};
@@ -1 +1 @@
1
- "use strict";const t="swifty_sentry_device_id",e="swifty_sentry_session_id";exports.getDeviceId=function(){try{let e=localStorage.getItem(t);return e||(e=crypto.randomUUID(),localStorage.setItem(t,e)),e}catch{return crypto.randomUUID()}},exports.getSessionId=function(){try{let t=sessionStorage.getItem(e);return t||(t=crypto.randomUUID(),sessionStorage.setItem(e,t)),t}catch{return crypto.randomUUID()}};
1
+ "use strict";var e=require("./uuid.cjs");const t="swifty_sentry_device_id",r="swifty_sentry_session_id";exports.getDeviceId=function(){try{let r=localStorage.getItem(t);return r||(r=e.generateUUID(),localStorage.setItem(t,r)),r}catch{return e.generateUUID()}},exports.getSessionId=function(){try{let t=sessionStorage.getItem(r);return t||(t=e.generateUUID(),sessionStorage.setItem(r,t)),t}catch{return e.generateUUID()}};
@@ -1 +1 @@
1
- const t="swifty_sentry_device_id",e="swifty_sentry_session_id";function r(){try{let e=localStorage.getItem(t);return e||(e=crypto.randomUUID(),localStorage.setItem(t,e)),e}catch{return crypto.randomUUID()}}function o(){try{let t=sessionStorage.getItem(e);return t||(t=crypto.randomUUID(),sessionStorage.setItem(e,t)),t}catch{return crypto.randomUUID()}}export{r as getDeviceId,o as getSessionId};
1
+ import{generateUUID as t}from"./uuid.js";const e="swifty_sentry_device_id",r="swifty_sentry_session_id";function s(){try{let r=localStorage.getItem(e);return r||(r=t(),localStorage.setItem(e,r)),r}catch{return t()}}function o(){try{let e=sessionStorage.getItem(r);return e||(e=t(),sessionStorage.setItem(r,e)),e}catch{return t()}}export{s as getDeviceId,o as getSessionId};
@@ -1 +1 @@
1
- "use strict";exports.throttle=function(t,e=300){let n=0;return function(...o){if(Date.now()-n>e)return n=Date.now(),void t.apply(this,o)}};
1
+ "use strict";exports.throttle=function(t,n){if(n<=0)return function(...n){t.apply(this,n)};let e=Number.NEGATIVE_INFINITY;return function(...r){const i=Date.now();i-e>=n&&(e=i,t.apply(this,r))}};
@@ -1 +1 @@
1
- function t(t,n=300){let e=0;return function(...o){if(Date.now()-e>n)return e=Date.now(),void t.apply(this,o)}}export{t as throttle};
1
+ function t(t,n){if(n<=0)return function(...n){t.apply(this,n)};let e=Number.NEGATIVE_INFINITY;return function(...i){const o=Date.now();o-e>=n&&(e=o,t.apply(this,i))}}export{t as throttle};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs");exports.default=function(s){const{statusCode:r}=s;let t,o;return r>=100&&r<200?(t="Informational response",o=e.Status.OK):r>=200&&r<300?(t="Successful responses",o=e.Status.OK):r>=300&&r<400?(t="Redirection messages",o=e.Status.OK):r>=400&&r<500?(t="Client error responses",o=e.Status.Error):r>=500&&r<600?(t="Server error responses",o=e.Status.Error):(t="Invalid status code",o=e.Status.Error),{...s,message:t,status:o}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs");exports.default=function(s){const{statusCode:r}=s;let t,o;return 0===r?(t=s.message||"Network error",o=e.Status.Error):r>=100&&r<200?(t="Informational response",o=e.Status.OK):r>=200&&r<300?(t="Successful responses",o=e.Status.OK):r>=300&&r<400?(t="Redirection messages",o=e.Status.OK):r>=400&&r<500?(t="Client error responses",o=e.Status.Error):r>=500&&r<600?(t="Server error responses",o=e.Status.Error):(t="Invalid status code",o=e.Status.Error),{...s,message:t,status:o}};
@@ -1 +1 @@
1
- import{Status as s}from"../types/enums.js";function e(e){const{statusCode:r}=e;let o,t;return r>=100&&r<200?(o="Informational response",t=s.OK):r>=200&&r<300?(o="Successful responses",t=s.OK):r>=300&&r<400?(o="Redirection messages",t=s.OK):r>=400&&r<500?(o="Client error responses",t=s.Error):r>=500&&r<600?(o="Server error responses",t=s.Error):(o="Invalid status code",t=s.Error),{...e,message:o,status:t}}export{e as default};
1
+ import{Status as r}from"../types/enums.js";function e(e){const{statusCode:s}=e;let o,t;return 0===s?(o=e.message||"Network error",t=r.Error):s>=100&&s<200?(o="Informational response",t=r.OK):s>=200&&s<300?(o="Successful responses",t=r.OK):s>=300&&s<400?(o="Redirection messages",t=r.OK):s>=400&&s<500?(o="Client error responses",t=r.Error):s>=500&&s<600?(o="Server error responses",t=r.Error):(o="Invalid status code",t=r.Error),{...e,message:o,status:t}}export{e as default};
@@ -0,0 +1 @@
1
+ "use strict";exports.generateUUID=function(){const n=globalThis.crypto;if(n&&"function"==typeof n.randomUUID)return n.randomUUID();if(n&&"function"==typeof n.getRandomValues){const t=n.getRandomValues(new Uint8Array(16));t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=Array.from(t,n=>n.toString(16).padStart(2,"0"));return[o.slice(0,4).join(""),o.slice(4,6).join(""),o.slice(6,8).join(""),o.slice(8,10).join(""),o.slice(10).join("")].join("-")}return`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`};
@@ -0,0 +1 @@
1
+ function n(){const n=globalThis.crypto;if(n&&"function"==typeof n.randomUUID)return n.randomUUID();if(n&&"function"==typeof n.getRandomValues){const o=n.getRandomValues(new Uint8Array(16));o[6]=15&o[6]|64,o[8]=63&o[8]|128;const t=Array.from(o,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10).join("")].join("-")}return`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}export{n as generateUUID};
package/dist/vite.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("node:buffer"),t=require("node:path"),n=require("node:fs");require("./constants/index.cjs"),require("./types/enums.cjs");var r=require("./utils/sentry.cjs");require("./utils/is-type.cjs");var s=require("./utils/logger.cjs"),i=require("./source-map/vite.cjs");function o(t,n){return"string"==typeof n?t+n:e.Buffer.isBuffer(n)?t+n.toString("utf8"):n instanceof Uint8Array?t+e.Buffer.from(n).toString("utf8"):t}function c(e){return JSON.parse(e)}const u=(e,t)=>n=>{n.middlewares.use((r,s,u)=>{if(r.url===e&&"POST"===r.method){let e="";r.on("data",t=>{e=o(e,t)}),r.on("end",async()=>{if(e)try{const r=c(e),s=await i.enrichReportData(n,r);t.write(JSON.stringify(s)+"\n")}catch{t.write(e+"\n")}s.setHeader("Content-Type","application/json"),s.statusCode=200,s.end(JSON.stringify({code:0,message:"success"}))})}else u()})},a=(e,t)=>n=>{n.middlewares.use((r,s,u)=>{if(r.url===e&&"POST"===r.method){let e="";r.on("data",t=>{e=o(e,t)}),r.on("end",async()=>{if(e)try{const r=c(e),s=await i.enrichReportData(n,r);t.write(JSON.stringify(s)+"\n")}catch{t.write(e+"\n")}s.setHeader("Content-Type","application/json"),s.statusCode=200,s.end(JSON.stringify({code:0,message:"success"}))})}else u()})};function l(){const e=t.join(process.cwd(),"logs");n.existsSync(e)||n.mkdirSync(e,{recursive:!0});const r=(new Date).toISOString().replace(/[-:.]/g,"").slice(0,14),s=t.join(e,`sentry_${r}.jsonl`);return{fileStream:n.createWriteStream(s,{flags:"a"}),logFile:s}}function f({dsn:e}){const{fileStream:t,logFile:n}=l();return s.sentryLogger.info(`Sentry mock plugin initialized, logs will be written to ${n}`),{name:"vite-plugin-sentry",configureServer:a(e||r.default.options.dsn||"/sentry",t),closeBundle(){t&&t.close()}}}exports.default=f,exports.sentryPlugin=f,exports.sentryPlugin7=function({dsn:e}={}){const{fileStream:t,logFile:n}=l();return s.sentryLogger.info(`Sentry mock plugin initialized, logs will be written to ${n}`),{name:"vite-plugin-sentry",configureServer:u(e||r.default.options.dsn||"/sentry",t),closeBundle(){t&&t.close()}}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./node/dev-endpoint.cjs"),r=require("./source-map/vite.cjs");function t({dsn:t}){const n=t??e.DEFAULT_MOCK_DSN;let o=null;return{name:"vite-plugin-sentry",apply:"serve",configureServer(t){o=e.createLogStream(),console.log(`[@swifty.js/sentry] mock report endpoint active, logging to ${o.logFile}`),t.middlewares.use(e.createMockMiddleware(n,o.fileStream,e=>r.enrichReportData(t,e)))},closeBundle(){o&&e.closeLogStream(o.fileStream)}}}function n(e={}){return t(e)}exports.default=n,exports.sentryPlugin=n,exports.sentryPlugin7=function(e={}){return t(e)};
package/dist/vite.d.ts CHANGED
@@ -26,8 +26,8 @@ import { Plugin } from 'vite';
26
26
  interface ISentryPluginOptions {
27
27
  dsn?: string;
28
28
  }
29
- declare function sentryPlugin7({ dsn }?: ISentryPluginOptions): Plugin$1;
30
- declare function sentryPlugin({ dsn }: ISentryPluginOptions): Plugin;
29
+ declare function sentryPlugin(options?: ISentryPluginOptions): Plugin;
30
+ declare function sentryPlugin7(options?: ISentryPluginOptions): Plugin$1;
31
31
 
32
32
  export { sentryPlugin as default, sentryPlugin, sentryPlugin7 };
33
33
  export type { ISentryPluginOptions };
package/dist/vite.js CHANGED
@@ -1 +1 @@
1
- import{Buffer as e}from"node:buffer";import{join as t}from"node:path";import{existsSync as n,mkdirSync as i,createWriteStream as s}from"node:fs";import"./constants/index.js";import"./types/enums.js";import o from"./utils/sentry.js";import"./utils/is-type.js";import{sentryLogger as r}from"./utils/logger.js";import{enrichReportData as l}from"./source-map/vite.js";function a(t,n){return"string"==typeof n?t+n:e.isBuffer(n)?t+n.toString("utf8"):n instanceof Uint8Array?t+e.from(n).toString("utf8"):t}function c(e){return JSON.parse(e)}const f=(e,t)=>n=>{n.middlewares.use((i,s,o)=>{if(i.url===e&&"POST"===i.method){let e="";i.on("data",t=>{e=a(e,t)}),i.on("end",async()=>{if(e)try{const i=c(e),s=await l(n,i);t.write(JSON.stringify(s)+"\n")}catch{t.write(e+"\n")}s.setHeader("Content-Type","application/json"),s.statusCode=200,s.end(JSON.stringify({code:0,message:"success"}))})}else o()})},u=(e,t)=>n=>{n.middlewares.use((i,s,o)=>{if(i.url===e&&"POST"===i.method){let e="";i.on("data",t=>{e=a(e,t)}),i.on("end",async()=>{if(e)try{const i=c(e),s=await l(n,i);t.write(JSON.stringify(s)+"\n")}catch{t.write(e+"\n")}s.setHeader("Content-Type","application/json"),s.statusCode=200,s.end(JSON.stringify({code:0,message:"success"}))})}else o()})};function d(){const e=t(process.cwd(),"logs");n(e)||i(e,{recursive:!0});const o=(new Date).toISOString().replace(/[-:.]/g,"").slice(0,14),r=t(e,`sentry_${o}.jsonl`);return{fileStream:s(r,{flags:"a"}),logFile:r}}function m({dsn:e}={}){const{fileStream:t,logFile:n}=d();return r.info(`Sentry mock plugin initialized, logs will be written to ${n}`),{name:"vite-plugin-sentry",configureServer:f(e||o.options.dsn||"/sentry",t),closeBundle(){t&&t.close()}}}function p({dsn:e}){const{fileStream:t,logFile:n}=d();return r.info(`Sentry mock plugin initialized, logs will be written to ${n}`),{name:"vite-plugin-sentry",configureServer:u(e||o.options.dsn||"/sentry",t),closeBundle(){t&&t.close()}}}export{p as default,p as sentryPlugin,m as sentryPlugin7};
1
+ import{createLogStream as e,createMockMiddleware as n,DEFAULT_MOCK_DSN as t,closeLogStream as o}from"./node/dev-endpoint.js";import{enrichReportData as r}from"./source-map/vite.js";function i({dsn:i}){const l=i??t;let s=null;return{name:"vite-plugin-sentry",apply:"serve",configureServer(t){s=e(),console.log(`[@swifty.js/sentry] mock report endpoint active, logging to ${s.logFile}`),t.middlewares.use(n(l,s.fileStream,e=>r(t,e)))},closeBundle(){s&&o(s.fileStream)}}}function l(e={}){return i(e)}function s(e={}){return i(e)}export{l as default,l as sentryPlugin,s as sentryPlugin7};
package/dist/vue.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var r=require("./core/sdk-lifecycle.cjs"),e=require("./types/enums.cjs"),o=require("./core/framework-error.cjs");exports.vuePlugin=(c,n)=>{const t=c.config.errorHandler;c.config.errorHandler=(r,c,n)=>{o.reportFrameworkError({type:e.EventType.Vue,error:r,context:{vueInstance:c,info:n}}),t?.call(null,r,c,n)},r.init(n)};
1
+ "use strict";var r=require("./core/sdk-lifecycle.cjs"),e=require("./types/enums.cjs"),o=require("./core/framework-error.cjs");exports.vuePlugin=(c,n)=>{const t=c.config.errorHandler;c.config.errorHandler=(r,c,n)=>{o.reportFrameworkError({type:e.EventType.Vue,error:r,context:{vueInstance:c,info:n}}),t?.(r,c,n)},r.init(n)};
package/dist/vue.js CHANGED
@@ -1 +1 @@
1
- import{init as r}from"./core/sdk-lifecycle.js";import{EventType as o}from"./types/enums.js";import{reportFrameworkError as e}from"./core/framework-error.js";const n=(n,c)=>{const t=n.config.errorHandler;n.config.errorHandler=(r,n,c)=>{e({type:o.Vue,error:r,context:{vueInstance:n,info:c}}),t?.call(null,r,n,c)},r(c)};export{n as vuePlugin};
1
+ import{init as r}from"./core/sdk-lifecycle.js";import{EventType as o}from"./types/enums.js";import{reportFrameworkError as e}from"./core/framework-error.js";const n=(n,t)=>{const c=n.config.errorHandler;n.config.errorHandler=(r,n,t)=>{e({type:o.Vue,error:r,context:{vueInstance:n,info:t}}),c?.(r,n,t)},r(t)};export{n as vuePlugin};
package/dist/webpack.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("node:buffer"),t=require("node:path"),r=require("node:fs");require("./constants/index.cjs"),require("./types/enums.cjs");var n=require("./utils/sentry.cjs");require("./utils/is-type.cjs");var s=require("./utils/logger.cjs"),i=require("./source-map/webpack.cjs"),o=require("./source-map/source-map.cjs");function a(t,r,n){return(s,i,a)=>{if(s.url===t&&"POST"===s.method){let t="";s.on("data",r=>{t=function(t,r){return"string"==typeof r?t+r:e.Buffer.isBuffer(r)?t+r.toString("utf8"):r instanceof Uint8Array?t+e.Buffer.from(r).toString("utf8"):t}(t,r)}),s.on("end",async()=>{if(t)try{const e=function(e){return JSON.parse(e)}(t),s=n?await o.enrichReportData(n,e):e;r.write(JSON.stringify(s)+"\n")}catch{r.write(t+"\n")}i.setHeader("Content-Type","application/json"),i.statusCode=200,i.end(JSON.stringify({code:0,message:"success"}))})}else a()}}function u(){const e=t.join(process.cwd(),"logs");r.existsSync(e)||r.mkdirSync(e,{recursive:!0});const n=(new Date).toISOString().replace(/[-:.]/g,"").slice(0,14),s=t.join(e,`sentry_${n}.jsonl`);return{fileStream:r.createWriteStream(s,{flags:"a"}),logFile:s}}class c{dsn;constructor(e={}){this.dsn=e.dsn}apply(e){if(!e.options.devServer)return;const t=e.options.devServer,{fileStream:r,logFile:o}=u(),c=this.dsn||n.default.options.dsn||"/sentry",l=i.createAssetMapStore(),d=a(c,r,l.loadMap);e.hooks.assetEmitted.tap("SentryWebpackPlugin",(e,{content:t})=>{e.endsWith(".map")&&l.put(e,t.toString("utf8"))}),s.sentryLogger.info(`Sentry mock plugin initialized, logs will be written to ${o}`);const p=t.setupMiddlewares;t.setupMiddlewares=(e,t)=>{const r=p?p(e,t):e,n={name:"sentry-mock",middleware:d};return r.unshift(n),r},e.hooks.shutdown.tap("SentryWebpackPlugin",()=>{r&&!r.destroyed&&r.close()})}}function l(e={}){return new c(e)}exports.SentryWebpackPlugin=c,exports.default=l,exports.sentryMiddleware=function(e={}){const{fileStream:t,logFile:r}=u();return s.sentryLogger.info(`Sentry mock middleware initialized, logs will be written to ${r}`),a(e.dsn||n.default.options.dsn||"/sentry",t)},exports.sentryPlugin=l;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./node/dev-endpoint.cjs"),t=require("./source-map/webpack.cjs"),r=require("./source-map/source-map.cjs");class o{dsn;constructor(e={}){this.dsn=e.dsn}apply(o){if(!o.options.devServer)return;const s=o.options.devServer,{fileStream:n,logFile:a}=e.createLogStream(),i=t.createAssetMapStore(),c=e.createMockMiddleware(this.dsn??e.DEFAULT_MOCK_DSN,n,e=>r.enrichReportData(i.loadMap,e));o.hooks.assetEmitted.tap("SentryWebpackPlugin",(e,{content:t})=>{e.endsWith(".map")&&i.put(e,t.toString("utf8"))}),console.log(`[@swifty.js/sentry] mock report endpoint active, logging to ${a}`);const d=s.setupMiddlewares;s.setupMiddlewares=(e,t)=>{const r=d?d(e,t):e,o={name:"sentry-mock",middleware:c};return r.unshift(o),r},o.hooks.shutdown.tap("SentryWebpackPlugin",()=>{e.closeLogStream(n)})}}function s(e={}){return new o(e)}exports.SentryWebpackPlugin=o,exports.default=s,exports.sentryMiddleware=function(t={}){const{fileStream:r,logFile:o}=e.createLogStream();return console.log(`[@swifty.js/sentry] mock report endpoint active, logging to ${o}`),e.createMockMiddleware(t.dsn??e.DEFAULT_MOCK_DSN,r)},exports.sentryPlugin=s;
package/dist/webpack.js CHANGED
@@ -1 +1 @@
1
- import{Buffer as t}from"node:buffer";import{join as e}from"node:path";import{existsSync as n,mkdirSync as o,createWriteStream as s}from"node:fs";import"./constants/index.js";import"./types/enums.js";import r from"./utils/sentry.js";import"./utils/is-type.js";import{sentryLogger as i}from"./utils/logger.js";import{createAssetMapStore as a}from"./source-map/webpack.js";import{enrichReportData as l}from"./source-map/source-map.js";function c(e,n,o){return(s,r,i)=>{if(s.url===e&&"POST"===s.method){let e="";s.on("data",n=>{e=function(e,n){return"string"==typeof n?e+n:t.isBuffer(n)?e+n.toString("utf8"):n instanceof Uint8Array?e+t.from(n).toString("utf8"):e}(e,n)}),s.on("end",async()=>{if(e)try{const t=function(t){return JSON.parse(t)}(e),s=o?await l(o,t):t;n.write(JSON.stringify(s)+"\n")}catch{n.write(e+"\n")}r.setHeader("Content-Type","application/json"),r.statusCode=200,r.end(JSON.stringify({code:0,message:"success"}))})}else i()}}function p(){const t=e(process.cwd(),"logs");n(t)||o(t,{recursive:!0});const r=(new Date).toISOString().replace(/[-:.]/g,"").slice(0,14),i=e(t,`sentry_${r}.jsonl`);return{fileStream:s(i,{flags:"a"}),logFile:i}}function u(t={}){const{fileStream:e,logFile:n}=p();i.info(`Sentry mock middleware initialized, logs will be written to ${n}`);return c(t.dsn||r.options.dsn||"/sentry",e)}class d{dsn;constructor(t={}){this.dsn=t.dsn}apply(t){if(!t.options.devServer)return;const e=t.options.devServer,{fileStream:n,logFile:o}=p(),s=this.dsn||r.options.dsn||"/sentry",l=a(),u=c(s,n,l.loadMap);t.hooks.assetEmitted.tap("SentryWebpackPlugin",(t,{content:e})=>{t.endsWith(".map")&&l.put(t,e.toString("utf8"))}),i.info(`Sentry mock plugin initialized, logs will be written to ${o}`);const d=e.setupMiddlewares;e.setupMiddlewares=(t,e)=>{const n=d?d(t,e):t,o={name:"sentry-mock",middleware:u};return n.unshift(o),n},t.hooks.shutdown.tap("SentryWebpackPlugin",()=>{n&&!n.destroyed&&n.close()})}}function f(t={}){return new d(t)}export{d as SentryWebpackPlugin,f as default,u as sentryMiddleware,f as sentryPlugin};
1
+ import{createLogStream as t,createMockMiddleware as e,DEFAULT_MOCK_DSN as o,closeLogStream as n}from"./node/dev-endpoint.js";import{createAssetMapStore as s}from"./source-map/webpack.js";import{enrichReportData as r}from"./source-map/source-map.js";function i(n={}){const{fileStream:s,logFile:r}=t();return console.log(`[@swifty.js/sentry] mock report endpoint active, logging to ${r}`),e(n.dsn??o,s)}class p{dsn;constructor(t={}){this.dsn=t.dsn}apply(i){if(!i.options.devServer)return;const p=i.options.devServer,{fileStream:a,logFile:c}=t(),d=s(),l=e(this.dsn??o,a,t=>r(d.loadMap,t));i.hooks.assetEmitted.tap("SentryWebpackPlugin",(t,{content:e})=>{t.endsWith(".map")&&d.put(t,e.toString("utf8"))}),console.log(`[@swifty.js/sentry] mock report endpoint active, logging to ${c}`);const u=p.setupMiddlewares;p.setupMiddlewares=(t,e)=>{const o=u?u(t,e):t,n={name:"sentry-mock",middleware:l};return o.unshift(n),o},i.hooks.shutdown.tap("SentryWebpackPlugin",()=>{n(a)})}}function a(t={}){return new p(t)}export{p as SentryWebpackPlugin,a as default,i as sentryMiddleware,a as sentryPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swifty.js/sentry",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Framework-agnostic sentry sdk with first-class support for react and vue3+",
5
5
  "keywords": [
6
6
  "error-tracking",
@@ -76,7 +76,6 @@
76
76
  "@rollup/plugin-node-resolve": "^16.0.3",
77
77
  "@rollup/plugin-terser": "^1.0.0",
78
78
  "@rollup/plugin-typescript": "^12.3.0",
79
- "@rrweb/record": "2.1.0",
80
79
  "@types/jsdom": "^28.0.3",
81
80
  "@types/node": "^25.9.5",
82
81
  "@types/pako": "^2.0.4",
@@ -88,7 +87,6 @@
88
87
  "react": "^19.2.8",
89
88
  "rollup": "^4.62.4",
90
89
  "rollup-plugin-dts": "^6.5.1",
91
- "tsup": "^8.5.1",
92
90
  "typescript": "^6.0.3",
93
91
  "vite": "^8.2.1",
94
92
  "vite7": "npm:vite@7.3.3",
@@ -128,7 +126,6 @@
128
126
  "vite7": "pnpm add -D vite7@npm:vite@7.3.3",
129
127
  "format": "oxfmt --write ./",
130
128
  "build": "rollup -c ./rollup.config.ts",
131
- "build:watch": "rollup -c ./rollup.config.ts -w",
132
- "build:tsup": "tsup --config ./tsup.config.ts"
129
+ "build:watch": "rollup -c ./rollup.config.ts -w"
133
130
  }
134
131
  }
package/dist/core/ip.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";const e=/([0-9]{1,3}(?:\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){2,7})/gi;exports.getIPs=function(t=500){return new Promise(n=>{if("function"!=typeof globalThis.RTCPeerConnection)return void n([]);const c=new Set,a=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]}),o=()=>{a.onicecandidate=null,a.close(),n([...c])};a.onicecandidate=t=>{t.candidate&&function(t,n){(t.match(e)??[]).forEach(e=>{n.add(e)})}(t.candidate.candidate,c)},a.createDataChannel("@swifty.js/sentry-IP-probe"),a.createOffer().then(e=>a.setLocalDescription(e)).catch(o),setTimeout(o,Math.max(t,100))})};
package/dist/core/ip.d.ts DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) 2026 hangtiancheng
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
- declare function getIPs(timeout?: number): Promise<readonly string[]>;
23
-
24
- export { getIPs };
package/dist/core/ip.js DELETED
@@ -1 +0,0 @@
1
- const e=/([0-9]{1,3}(?:\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){2,7})/gi;function n(n=500){return new Promise(t=>{if("function"!=typeof globalThis.RTCPeerConnection)return void t([]);const a=new Set,c=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]}),o=()=>{c.onicecandidate=null,c.close(),t([...a])};c.onicecandidate=n=>{n.candidate&&function(n,t){(n.match(e)??[]).forEach(e=>{t.add(e)})}(n.candidate.candidate,a)},c.createDataChannel("@swifty.js/sentry-IP-probe"),c.createOffer().then(e=>c.setLocalDescription(e)).catch(o),setTimeout(o,Math.max(n,100))})}export{n as getIPs};
@@ -1 +0,0 @@
1
- "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var s=require("./promise.cjs");function r(e){return!1===e?[]:[...e]}exports.applyBeforePushHook=function(t){const i=e.default.options.beforePushEventList?e.default.options.beforePushEventList(t):t;return s.isPromise(i)?i.then(r):r(i)};
@@ -1 +0,0 @@
1
- import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import"../utils/is-type.js";import{isPromise as s}from"./promise.js";function o(o){const e=t.options.beforePushEventList?t.options.beforePushEventList(o):o;return s(e)?e.then(n):n(e)}function n(t){return!1===t?[]:[...t]}export{o as applyBeforePushHook};
@@ -1 +0,0 @@
1
- "use strict";exports.base64v2=function(e){const r=(new TextEncoder).encode(e);let o="";for(const e of r)o+=String.fromCharCode(e);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")};
@@ -1 +0,0 @@
1
- function e(e){const o=(new TextEncoder).encode(e);let r="";for(const e of o)r+=String.fromCharCode(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}export{e as base64v2};