@swifty.js/sentry 0.0.4 → 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.
- package/LICENSE +21 -0
- package/README.md +124 -144
- package/dist/constants/index.cjs +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/core/api.cjs +1 -1
- package/dist/core/api.d.ts +28 -9
- package/dist/core/api.js +1 -1
- package/dist/core/breadcrumb.cjs +1 -1
- package/dist/core/breadcrumb.js +1 -1
- package/dist/core/decorate-http.cjs +1 -1
- package/dist/core/decorate-http.js +1 -1
- package/dist/core/decorate-route.cjs +1 -1
- package/dist/core/decorate-route.js +1 -1
- package/dist/core/decorates.cjs +1 -1
- package/dist/core/decorates.js +1 -1
- package/dist/core/error-dedup.cjs +1 -0
- package/dist/core/error-dedup.js +1 -0
- package/dist/core/framework-error.cjs +1 -1
- package/dist/core/framework-error.js +1 -1
- package/dist/core/handle-code-error.cjs +1 -1
- package/dist/core/handle-code-error.js +1 -1
- package/dist/core/handle-error.cjs +1 -1
- package/dist/core/handle-error.js +1 -1
- package/dist/core/handle-events.cjs +1 -1
- package/dist/core/handle-events.js +1 -1
- package/dist/core/handle-route.cjs +1 -1
- package/dist/core/handle-route.js +1 -1
- package/dist/core/identity.cjs +1 -1
- package/dist/core/identity.js +1 -1
- package/dist/core/options-schema.cjs +1 -1
- package/dist/core/options-schema.d.ts +42 -45
- package/dist/core/options-schema.js +1 -1
- package/dist/core/pv-lifecycle.cjs +1 -1
- package/dist/core/pv-lifecycle.js +1 -1
- package/dist/core/sdk-lifecycle.cjs +1 -1
- package/dist/core/sdk-lifecycle.d.ts +1 -1
- package/dist/core/sdk-lifecycle.js +1 -1
- package/dist/core/setup.cjs +1 -1
- package/dist/core/setup.js +1 -1
- package/dist/core/white-screen.cjs +1 -1
- package/dist/core/white-screen.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +1 -1
- package/dist/node/dev-endpoint.cjs +1 -0
- package/dist/node/dev-endpoint.js +1 -0
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/plugins/exposure/index.cjs +1 -1
- package/dist/plugins/exposure/index.d.ts +0 -1
- package/dist/plugins/exposure/index.js +1 -1
- package/dist/plugins/performance/first-screen-paint.cjs +1 -1
- package/dist/plugins/performance/first-screen-paint.js +1 -1
- package/dist/plugins/performance/index.cjs +1 -1
- package/dist/plugins/performance/index.d.ts +0 -1
- package/dist/plugins/performance/index.js +1 -1
- package/dist/plugins/performance/navigation-timing.cjs +1 -1
- package/dist/plugins/performance/navigation-timing.js +1 -1
- package/dist/plugins/performance/perf.cjs +1 -1
- package/dist/plugins/performance/perf.js +1 -1
- package/dist/plugins/performance/resource-element-fallback.cjs +1 -1
- package/dist/plugins/performance/resource-element-fallback.js +1 -1
- package/dist/plugins/performance/resource-timing.cjs +1 -1
- package/dist/plugins/performance/resource-timing.js +1 -1
- package/dist/plugins/screen-record/index.cjs +1 -1
- package/dist/plugins/screen-record/index.js +1 -1
- package/dist/plugins/screen-record/recorder.cjs +1 -1
- package/dist/plugins/screen-record/recorder.d.ts +1 -1
- package/dist/plugins/screen-record/recorder.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.d.ts +7 -80
- package/dist/react.js +1 -1
- package/dist/reporter/index.cjs +1 -1
- package/dist/reporter/index.js +1 -1
- package/dist/reporter/network-listener.cjs +1 -1
- package/dist/reporter/network-listener.js +1 -1
- package/dist/reporter/offline-cache.cjs +1 -1
- package/dist/reporter/offline-cache.js +1 -1
- package/dist/reporter/report-data-schema.cjs +1 -1
- package/dist/reporter/report-data-schema.js +1 -1
- package/dist/reporter/report-data.cjs +1 -1
- package/dist/reporter/report-data.js +1 -1
- package/dist/reporter/server-recovery.cjs +1 -1
- package/dist/reporter/server-recovery.js +1 -1
- package/dist/reporter/transports.cjs +1 -1
- package/dist/reporter/transports.js +1 -1
- package/dist/source-map/source-map.cjs +1 -0
- package/dist/source-map/source-map.js +1 -0
- package/dist/source-map/vite.cjs +1 -0
- package/dist/source-map/vite.js +1 -0
- package/dist/source-map/webpack.cjs +1 -0
- package/dist/source-map/webpack.js +1 -0
- package/dist/types/common.d.ts +10 -11
- package/dist/types/enums.cjs +1 -1
- package/dist/types/enums.d.ts +1 -45
- package/dist/types/enums.js +1 -1
- package/dist/types/options.d.ts +9 -13
- package/dist/types/plugin.cjs +1 -1
- package/dist/types/plugin.d.ts +0 -3
- package/dist/types/plugin.js +1 -1
- package/dist/utils/click-data.cjs +1 -1
- package/dist/utils/click-data.js +1 -1
- package/dist/utils/data-structures.cjs +1 -1
- package/dist/utils/data-structures.js +1 -1
- package/dist/utils/dom2str.cjs +1 -0
- package/dist/utils/dom2str.js +1 -0
- package/dist/utils/get-base-data.cjs +1 -1
- package/dist/utils/get-base-data.js +1 -1
- package/dist/utils/logger.cjs +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/noop.cjs +1 -0
- package/dist/utils/noop.js +1 -0
- package/dist/utils/sentry.cjs +1 -1
- package/dist/utils/sentry.js +1 -1
- package/dist/utils/session.cjs +1 -1
- package/dist/utils/session.js +1 -1
- package/dist/utils/throttle.cjs +1 -1
- package/dist/utils/throttle.js +1 -1
- package/dist/utils/transform-http-data.cjs +1 -1
- package/dist/utils/transform-http-data.js +1 -1
- package/dist/utils/uuid.cjs +1 -0
- package/dist/utils/uuid.js +1 -0
- package/dist/vite.cjs +1 -1
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +1 -1
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +22 -26
- package/dist/core/ip.cjs +0 -1
- package/dist/core/ip.d.ts +0 -24
- package/dist/core/ip.js +0 -1
- package/dist/reporter/batch.cjs +0 -1
- package/dist/reporter/batch.js +0 -1
- package/dist/sourcemap/sourcemap.cjs +0 -1
- package/dist/sourcemap/sourcemap.js +0 -1
- package/dist/sourcemap/vite.cjs +0 -1
- package/dist/sourcemap/vite.js +0 -1
- package/dist/sourcemap/webpack.cjs +0 -1
- package/dist/sourcemap/webpack.js +0 -1
- package/dist/utils/base64.cjs +0 -1
- package/dist/utils/base64.js +0 -1
package/dist/types/enums.d.ts
CHANGED
|
@@ -19,21 +19,6 @@
|
|
|
19
19
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
20
|
* SOFTWARE.
|
|
21
21
|
*/
|
|
22
|
-
declare enum HttpStatus {
|
|
23
|
-
OK = "OK",// 200
|
|
24
|
-
BadRequest = "Bad Request",// 400
|
|
25
|
-
Unauthorized = "Unauthorized",// 401
|
|
26
|
-
Forbidden = "Forbidden",// 403
|
|
27
|
-
NotFound = "NotFound",// 404
|
|
28
|
-
Conflict = "Conflict",// 409
|
|
29
|
-
PayloadTooLarge = "Payload Too Large",// 413
|
|
30
|
-
TooManyRequests = "Too Many Requests",// 429
|
|
31
|
-
InternalServerError = "Internal Server Error",// 500
|
|
32
|
-
NotImplemented = "Not Implemented",// 501
|
|
33
|
-
ServiceUnavailable = "Service Unavailable",// 503
|
|
34
|
-
GatewayTimeout = "Gateway Timeout",// 504
|
|
35
|
-
UnknownError = "Unknown Error"
|
|
36
|
-
}
|
|
37
22
|
declare enum BreadcrumbType {
|
|
38
23
|
Http = "Http",
|
|
39
24
|
Click = "Click",
|
|
@@ -65,34 +50,5 @@ declare enum EventType {
|
|
|
65
50
|
Custom = "Custom",
|
|
66
51
|
PV = "PV"
|
|
67
52
|
}
|
|
68
|
-
declare enum HttpType {
|
|
69
|
-
Xhr = "XMLHttpRequest",
|
|
70
|
-
Fetch = "fetch"
|
|
71
|
-
}
|
|
72
|
-
declare enum HttpStatusCode {
|
|
73
|
-
OK = 200,
|
|
74
|
-
BadRequest = 400,
|
|
75
|
-
Unauthorized = 401,
|
|
76
|
-
Forbidden = 403,
|
|
77
|
-
NotFound = 404,
|
|
78
|
-
Conflict = 409,
|
|
79
|
-
PayloadTooLarge = 413,
|
|
80
|
-
TooManyRequests = 429,
|
|
81
|
-
InternalServerError = 500,
|
|
82
|
-
NotImplemented = 501,
|
|
83
|
-
ServiceUnavailable = 503,
|
|
84
|
-
GatewayTimeout = 504
|
|
85
|
-
}
|
|
86
|
-
declare enum HttpMethod {
|
|
87
|
-
Get = "GET",
|
|
88
|
-
Head = "HEAD",
|
|
89
|
-
Post = "POST",
|
|
90
|
-
Put = "PUT",
|
|
91
|
-
Delete = "DELETE",
|
|
92
|
-
Connect = "CONNECT",
|
|
93
|
-
Options = "OPTIONS",
|
|
94
|
-
Trace = "TRACE",
|
|
95
|
-
Patch = "PATCH"
|
|
96
|
-
}
|
|
97
53
|
|
|
98
|
-
export { BreadcrumbType, EventType,
|
|
54
|
+
export { BreadcrumbType, EventType, Status };
|
package/dist/types/enums.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,
|
|
1
|
+
var e,r,o;!function(e){e.Http="Http",e.Click="Click",e.Route="Route",e.Resource="Resource",e.CodeError="Code Error",e.Custom="Custom"}(e||(e={})),function(e){e.Error="Error",e.OK="OK"}(r||(r={})),function(e){e.Xhr="XMLHttpRequest",e.Fetch="fetch",e.Click="Click",e.HashChange="Event hashchange",e.History="History",e.Resource="Resource",e.UnhandledRejection="Event unhandledrejection",e.Error="Error",e.Vue="Vue",e.React="React",e.OtherFrameworks="OtherFrameworks",e.Performance="Performance",e.ScreenRecord="ScreenRecord",e.Exposure="Exposure",e.WhiteScreen="WhiteScreen",e.Custom="Custom",e.PV="PV"}(o||(o={}));export{e as BreadcrumbType,o as EventType,r as Status};
|
package/dist/types/options.d.ts
CHANGED
|
@@ -23,9 +23,10 @@ import { EventType } from './enums.js';
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
type
|
|
27
|
-
type
|
|
28
|
-
type
|
|
26
|
+
type BeforeSendHook = (data: IReportData) => Promise<IReportData | false> | IReportData | false;
|
|
27
|
+
type BeforeSendBatchHook = (data: readonly IReportData[]) => Promise<readonly IReportData[] | false> | readonly IReportData[] | false;
|
|
28
|
+
type AfterSendHook = (data: readonly IReportData[]) => Promise<void> | void;
|
|
29
|
+
type BeforeBreadcrumbHook = (data: IBreadcrumbItem) => IBreadcrumbItem;
|
|
29
30
|
interface IOptions {
|
|
30
31
|
dsn: string;
|
|
31
32
|
projectId: string;
|
|
@@ -38,36 +39,31 @@ interface IOptions {
|
|
|
38
39
|
enableUnhandledRejection: boolean;
|
|
39
40
|
enableHashChange: boolean;
|
|
40
41
|
enableHistory: boolean;
|
|
41
|
-
enablePerformance: boolean;
|
|
42
|
-
enableScreenRecord: boolean;
|
|
43
42
|
enableWhiteScreen: boolean;
|
|
44
43
|
enableFingerprint: boolean;
|
|
45
44
|
anonymousId: string;
|
|
46
45
|
visitorId: string;
|
|
47
|
-
useImageReport: boolean;
|
|
48
46
|
screenRecordDurationMs: number;
|
|
49
47
|
screenRecordEventTypes: EventType[];
|
|
50
48
|
hasSkeleton: boolean;
|
|
51
49
|
rootCssSelectors: string[];
|
|
52
50
|
clickThrottleDelay: number;
|
|
53
|
-
requestTimeoutMilliseconds: number;
|
|
54
51
|
maxBreadcrumbs: number;
|
|
55
52
|
repeatCodeError: boolean;
|
|
56
53
|
enableHttpPerformance: boolean;
|
|
57
54
|
ignoreErrors: (string | RegExp)[];
|
|
58
55
|
excludeApis: (string | RegExp)[];
|
|
59
|
-
|
|
56
|
+
beforeBreadcrumb?: BeforeBreadcrumbHook | undefined;
|
|
60
57
|
cacheMaxLength: number;
|
|
61
58
|
cacheWaitingTime: number;
|
|
62
59
|
maxQueueLength: number;
|
|
63
60
|
retryIntervalMilliseconds: number;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
beforeSend?: BeforeSendHook | undefined;
|
|
62
|
+
beforeSendBatch?: BeforeSendBatchHook | undefined;
|
|
63
|
+
afterSend?: AfterSendHook | undefined;
|
|
67
64
|
offlineCacheKey: string;
|
|
68
65
|
tracesSampleRate: number;
|
|
69
|
-
handleHttpError?: (<T>(data: T) => boolean) | undefined;
|
|
70
66
|
debug: boolean;
|
|
71
67
|
}
|
|
72
68
|
|
|
73
|
-
export type {
|
|
69
|
+
export type { AfterSendHook, BeforeBreadcrumbHook, BeforeSendBatchHook, BeforeSendHook, IOptions };
|
package/dist/types/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.SentryPlugin=class{
|
|
1
|
+
"use strict";exports.SentryPlugin=class{};
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EventType } from './enums.js';
|
|
2
1
|
import { IReportPayload } from './common.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -27,8 +26,6 @@ type WithSentry<T, S extends IReportPayload = IReportPayload> = T & {
|
|
|
27
26
|
__sentry__: S;
|
|
28
27
|
};
|
|
29
28
|
declare abstract class SentryPlugin {
|
|
30
|
-
type: EventType;
|
|
31
|
-
constructor(type: EventType);
|
|
32
29
|
abstract init(): void;
|
|
33
30
|
destroy?(): void;
|
|
34
31
|
}
|
package/dist/types/plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class
|
|
1
|
+
class s{}export{s as SentryPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";var t=require("./dom2str.cjs");const e="swifty-sentry-",n=new Set(["view","msg","ev"]);function r(t){return t.hasAttribute("swifty-sentry-el")||t.hasAttribute("swifty-sentry-ev")||t.hasAttribute("swifty-sentry-msg")}function s(t){const e=(n=t)?n.getAttribute("swifty-sentry-msg")??n.title:"";var n;if(e)return e;const r=t.textContent?.trim();return r||t.getAttribute("aria-label")||t.tagName.toLowerCase()}function i(t,e){for(const n of t){const t=n.getAttribute(e);if(t)return t}return null}function o(t){const e=i(t,"swifty-sentry-ev");if(e)return e;const n=i(t,"title");if(n)return n;const r=i(t,"swifty-sentry-el");return r||(t[0]?.tagName.toLowerCase()??"unknown")}function a(t){const r=t.find(t=>Array.from(t.attributes).some(t=>t.name.startsWith(e)));return r?Array.from(r.attributes).reduce((t,r)=>{if(!r.name.startsWith(e))return t;const s=r.name.replace(e,"");return n.has(s)||(t[s]=r.value||null),t},{}):{}}exports.getDeclarativeClickData=function(e){const n=function(t){return t.composedPath().filter(t=>t instanceof HTMLElement)}(e),i=n.length>0?n:function(t){if(!(t instanceof HTMLElement))return[];const e=[];let n=t;for(;n;)e.push(n),n=n.parentElement;return e}(e.target),u=i.find(r);if(!u)return null;const c=e.target instanceof HTMLElement?e.target:u,{top:f,left:l}=c.getBoundingClientRect(),{scrollTop:m,scrollLeft:g}=document.documentElement;return{ev:o(i),msg:s(u),triggerPageUrl:location.href,x:l+g,y:f+m,params:a(i),elementPath:t.default(u),triggerTime:Date.now()}};
|
package/dist/utils/click-data.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import t from"./dom2str.js";const e="swifty-sentry-",n=new Set(["view","msg","ev"]);function r(t){return t.hasAttribute("swifty-sentry-el")||t.hasAttribute("swifty-sentry-ev")||t.hasAttribute("swifty-sentry-msg")}function s(t){const e=(n=t)?n.getAttribute("swifty-sentry-msg")??n.title:"";var n;if(e)return e;const r=t.textContent?.trim();return r||t.getAttribute("aria-label")||t.tagName.toLowerCase()}function o(t,e){for(const n of t){const t=n.getAttribute(e);if(t)return t}return null}function i(t){const e=o(t,"swifty-sentry-ev");if(e)return e;const n=o(t,"title");if(n)return n;const r=o(t,"swifty-sentry-el");return r||(t[0]?.tagName.toLowerCase()??"unknown")}function u(t){const r=t.find(t=>Array.from(t.attributes).some(t=>t.name.startsWith(e)));return r?Array.from(r.attributes).reduce((t,r)=>{if(!r.name.startsWith(e))return t;const s=r.name.replace(e,"");return n.has(s)||(t[s]=r.value||null),t},{}):{}}function a(e){const n=function(t){return t.composedPath().filter(t=>t instanceof HTMLElement)}(e),o=n.length>0?n:function(t){if(!(t instanceof HTMLElement))return[];const e=[];let n=t;for(;n;)e.push(n),n=n.parentElement;return e}(e.target),a=o.find(r);if(!a)return null;const f=e.target instanceof HTMLElement?e.target:a,{top:c,left:l}=f.getBoundingClientRect(),{scrollTop:m,scrollLeft:g}=document.documentElement;return{ev:i(o),msg:s(a),triggerPageUrl:location.href,x:l+g,y:c+m,params:u(o),elementPath:t(a),triggerTime:Date.now()}}export{a as getDeclarativeClickData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("../constants/index.cjs");exports.
|
|
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
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});function e(e){let t=e.tagName.toLowerCase();e.id&&(t+=`#${e.id}`);const{className:n}=e;if(n&&"string"==typeof n)for(const e of n.split(/\s+/))e&&(t+=`.${e}`);return t}exports.default=function(t){try{const n=[];let r=0,o=0,s=t;for(;s&&o++<5;){const t=e(s),l=r+3*n.length+t.length;if("html"===t||o>1&&l>=128)break;n.push(t),r+=t.length,s=s.parentElement}return n.reverse().join(" > ")}catch{return"<unknown>"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){let e=t.tagName.toLowerCase();t.id&&(e+=`#${t.id}`);const{className:n}=t;if(n&&"string"==typeof n)for(const t of n.split(/\s+/))t&&(e+=`.${t}`);return e}function e(e){try{const n=[];let r=0,o=0,s=e;for(;s&&o++<5;){const e=t(s),a=r+3*n.length+e.length;if("html"===e||o>1&&a>=128)break;n.push(e),r+=e.length,s=s.parentElement}return n.reverse().join(" > ")}catch{return"<unknown>"}}export{e as default};
|
|
@@ -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:
|
|
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
|
|
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};
|
package/dist/utils/logger.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=
|
|
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;
|
package/dist/utils/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o=
|
|
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};
|
package/dist/utils/sentry.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../constants/index.cjs"),
|
|
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;
|
package/dist/utils/sentry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_OPTIONS as e,UNKNOWN as
|
|
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};
|
package/dist/utils/session.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t="swifty_sentry_device_id",
|
|
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()}};
|
package/dist/utils/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
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};
|
package/dist/utils/throttle.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.throttle=function(t,
|
|
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))}};
|
package/dist/utils/throttle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,n
|
|
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
|
|
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
|
|
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
|
|
30
|
-
declare function
|
|
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{
|
|
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?.
|
|
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,
|
|
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
|
|
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{
|
|
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.
|
|
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",
|
|
@@ -61,18 +61,6 @@
|
|
|
61
61
|
"require": "./dist/webpack.cjs"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"scripts": {
|
|
65
|
-
"test": "vitest run --config ./vitest.config.ts",
|
|
66
|
-
"test:watch": "vitest --config ./vitest.config.ts",
|
|
67
|
-
"test:coverage": "vitest run --config ./vitest.config.ts --coverage",
|
|
68
|
-
"typecheck": "tsc --noEmit",
|
|
69
|
-
"vite7": "pnpm add -D vite7@npm:vite@7.3.3",
|
|
70
|
-
"format": "oxfmt --write ./",
|
|
71
|
-
"prepublishOnly": "pnpm build",
|
|
72
|
-
"build": "rollup -c ./rollup.config.ts",
|
|
73
|
-
"build:watch": "rollup -c ./rollup.config.ts -w",
|
|
74
|
-
"build:tsup": "tsup --config ./tsup.config.ts"
|
|
75
|
-
},
|
|
76
64
|
"dependencies": {
|
|
77
65
|
"@fingerprintjs/fingerprintjs": "^5.2.0",
|
|
78
66
|
"@rrweb/record": "2.1.0",
|
|
@@ -88,29 +76,27 @@
|
|
|
88
76
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
89
77
|
"@rollup/plugin-terser": "^1.0.0",
|
|
90
78
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
91
|
-
"@rrweb/record": "2.1.0",
|
|
92
79
|
"@types/jsdom": "^28.0.3",
|
|
93
|
-
"@types/node": "^25.9.
|
|
80
|
+
"@types/node": "^25.9.5",
|
|
94
81
|
"@types/pako": "^2.0.4",
|
|
95
|
-
"@types/react": "^19.2.
|
|
96
|
-
"@types/react-dom": "^19.2.
|
|
82
|
+
"@types/react": "^19.2.18",
|
|
83
|
+
"@types/react-dom": "^19.2.4",
|
|
97
84
|
"@vitest/coverage-v8": "^1.6.1",
|
|
98
85
|
"jsdom": "^24.1.3",
|
|
99
86
|
"oxfmt": "^0.54.0",
|
|
100
|
-
"react": "^19.2.
|
|
101
|
-
"rollup": "^4.62.
|
|
102
|
-
"rollup-plugin-dts": "^6.
|
|
103
|
-
"tsup": "^8.5.1",
|
|
87
|
+
"react": "^19.2.8",
|
|
88
|
+
"rollup": "^4.62.4",
|
|
89
|
+
"rollup-plugin-dts": "^6.5.1",
|
|
104
90
|
"typescript": "^6.0.3",
|
|
105
|
-
"vite": "^8.1
|
|
91
|
+
"vite": "^8.2.1",
|
|
106
92
|
"vite7": "npm:vite@7.3.3",
|
|
107
93
|
"vitest": "^1.6.1",
|
|
108
|
-
"vue": "^3.5.
|
|
109
|
-
"webpack": "^5.
|
|
94
|
+
"vue": "^3.5.41",
|
|
95
|
+
"webpack": "^5.109.2",
|
|
110
96
|
"webpack-dev-server": "^5.2.6"
|
|
111
97
|
},
|
|
112
98
|
"peerDependencies": {
|
|
113
|
-
"react": "^19.0.0",
|
|
99
|
+
"react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
114
100
|
"vite": "^7.0.0 || ^8.0.0",
|
|
115
101
|
"vue": "^3.0.0",
|
|
116
102
|
"webpack": "^4.0.0 || ^5.0.0"
|
|
@@ -131,5 +117,15 @@
|
|
|
131
117
|
"webpack-dev-server": {
|
|
132
118
|
"optional": true
|
|
133
119
|
}
|
|
120
|
+
},
|
|
121
|
+
"scripts": {
|
|
122
|
+
"test": "vitest run --config ./vitest.config.ts",
|
|
123
|
+
"test:watch": "vitest --config ./vitest.config.ts",
|
|
124
|
+
"test:coverage": "vitest run --config ./vitest.config.ts --coverage",
|
|
125
|
+
"typecheck": "tsc --noEmit",
|
|
126
|
+
"vite7": "pnpm add -D vite7@npm:vite@7.3.3",
|
|
127
|
+
"format": "oxfmt --write ./",
|
|
128
|
+
"build": "rollup -c ./rollup.config.ts",
|
|
129
|
+
"build:watch": "rollup -c ./rollup.config.ts -w"
|
|
134
130
|
}
|
|
135
|
-
}
|
|
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};
|
package/dist/reporter/batch.cjs
DELETED
|
@@ -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)};
|
package/dist/reporter/batch.js
DELETED
|
@@ -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";var n=require("source-map"),t=require("zod");const e=t.z.object({version:t.z.union([t.z.number(),t.z.string()]),sources:t.z.array(t.z.string().nullable()),names:t.z.array(t.z.string()),mappings:t.z.string()}),r=t.z.looseObject({type:t.z.string().optional(),name:t.z.string().optional(),payload:t.z.looseObject({line:t.z.number().optional(),column:t.z.number().optional(),extra:t.z.unknown().optional(),stack:t.z.unknown().optional()}).optional()}),o=/^\s*at (?:(.+?)\s+)?\(?(\S+?):(\d+):(\d+)\)?\s*$/,s=/^\s*(?:(.*?)@)?(\S+?):(\d+):(\d+)\s*$/;function a(n){const t=[];for(const e of n.split("\n")){if(t.length>=30)break;const n=o.exec(e)??s.exec(e);if(!n)continue;const[,r,a,c,i]=n;if(!a||!c||!i)continue;const u={url:a,line:Number.parseInt(c,10),column:Number.parseInt(i,10)};r&&(u.func=r),t.push(u)}return t}async function c(t,r){const o={resolved:!1,...r};try{const s=await t(r.url);return e.safeParse(s).success?await n.SourceMapConsumer.with(JSON.stringify(s),null,n=>{const t=n.originalPositionFor({line:r.line,column:Math.max(0,r.column-1)});if(null===t.source||null===t.line)return o;const e=n.sourceContentFor(t.source,!0),s={...o,resolved:!0,source:t.source,originalLine:t.line};return null!==t.column&&(s.originalColumn=t.column),null!==t.name&&(s.name=t.name),e&&(s.snippet=function(n,t){const e=n.split("\n"),r=Math.max(1,t-3),o=Math.min(e.length,t+3),s=[];for(let n=r;n<=o;n++)s.push({line:n,code:e[n-1]??"",highlight:n===t});return s}(e,t.line)),s}):o}catch{return o}}async function i(n,t){const e=a(t),r=[];for(const t of e)r.push(await c(n,t));return r}async function u(n,t){const e=r.safeParse(t);if(!e.success)return t;const o=e.data,s=o.payload;if(!s)return t;const a=[];var u;return"Error"===o.type&&"string"==typeof o.name&&"number"==typeof s.line&&"number"==typeof s.column?a.push(await c(n,{url:o.name,line:s.line,column:s.column})):"string"==typeof s.extra&&(u=s.extra,/(^|\n)\s*at .+:\d+:\d+/.test(u)||/@.+:\d+:\d+/.test(u))?a.push(...await i(n,s.extra)):"React"!==o.type&&"Vue"!==o.type||"string"!=typeof s.stack||a.push(...await i(n,s.stack)),0===a.length?t:{...o,sourcemap:{frames:a}}}exports.enrichReportData=async function(n,t){if(!Array.isArray(t))return t;const e=[];for(const r of t)e.push(await u(n,r));return e},exports.parseStack=a,exports.resolveFrame=c,exports.resolveStack=i,exports.splitScriptUrl=function(n){try{const t=new URL(n);return{pathname:t.pathname,search:t.search}}catch{const t=n.search(/[?#]/);return-1!==t?{pathname:n.slice(0,t),search:n.slice(t)}:{pathname:n,search:""}}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{SourceMapConsumer as n}from"source-map";import{z as t}from"zod";const e=t.object({version:t.union([t.number(),t.string()]),sources:t.array(t.string().nullable()),names:t.array(t.string()),mappings:t.string()}),o=t.looseObject({type:t.string().optional(),name:t.string().optional(),payload:t.looseObject({line:t.number().optional(),column:t.number().optional(),extra:t.unknown().optional(),stack:t.unknown().optional()}).optional()}),r=/^\s*at (?:(.+?)\s+)?\(?(\S+?):(\d+):(\d+)\)?\s*$/,s=/^\s*(?:(.*?)@)?(\S+?):(\d+):(\d+)\s*$/;function a(n){const t=[];for(const e of n.split("\n")){if(t.length>=30)break;const n=r.exec(e)??s.exec(e);if(!n)continue;const[,o,a,c,i]=n;if(!a||!c||!i)continue;const u={url:a,line:Number.parseInt(c,10),column:Number.parseInt(i,10)};o&&(u.func=o),t.push(u)}return t}function c(n){try{const t=new URL(n);return{pathname:t.pathname,search:t.search}}catch{const t=n.search(/[?#]/);return-1!==t?{pathname:n.slice(0,t),search:n.slice(t)}:{pathname:n,search:""}}}async function i(t,o){const r={resolved:!1,...o};try{const s=await t(o.url);return e.safeParse(s).success?await n.with(JSON.stringify(s),null,n=>{const t=n.originalPositionFor({line:o.line,column:Math.max(0,o.column-1)});if(null===t.source||null===t.line)return r;const e=n.sourceContentFor(t.source,!0),s={...r,resolved:!0,source:t.source,originalLine:t.line};return null!==t.column&&(s.originalColumn=t.column),null!==t.name&&(s.name=t.name),e&&(s.snippet=function(n,t){const e=n.split("\n"),o=Math.max(1,t-3),r=Math.min(e.length,t+3),s=[];for(let n=o;n<=r;n++)s.push({line:n,code:e[n-1]??"",highlight:n===t});return s}(e,t.line)),s}):r}catch{return r}}async function u(n,t){const e=a(t),o=[];for(const t of e)o.push(await i(n,t));return o}async function l(n,t){const e=o.safeParse(t);if(!e.success)return t;const r=e.data,s=r.payload;if(!s)return t;const a=[];var c;return"Error"===r.type&&"string"==typeof r.name&&"number"==typeof s.line&&"number"==typeof s.column?a.push(await i(n,{url:r.name,line:s.line,column:s.column})):"string"==typeof s.extra&&(c=s.extra,/(^|\n)\s*at .+:\d+:\d+/.test(c)||/@.+:\d+:\d+/.test(c))?a.push(...await u(n,s.extra)):"React"!==r.type&&"Vue"!==r.type||"string"!=typeof s.stack||a.push(...await u(n,s.stack)),0===a.length?t:{...r,sourcemap:{frames:a}}}async function p(n,t){if(!Array.isArray(t))return t;const e=[];for(const o of t)e.push(await l(n,o));return e}export{p as enrichReportData,a as parseStack,i as resolveFrame,u as resolveStack,c as splitScriptUrl};
|
package/dist/sourcemap/vite.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var r=require("./sourcemap.cjs");exports.parseStack=r.parseStack,exports.enrichReportData=async function(t,e){return r.enrichReportData(function(t){return async e=>{const{pathname:a,search:n}=r.splitScriptUrl(e),s=await t.moduleGraph.getModuleByUrl(a+n)??await t.moduleGraph.getModuleByUrl(a);return s?.transformResult?.map??null}}(t),e)};
|
package/dist/sourcemap/vite.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{enrichReportData as r,splitScriptUrl as a}from"./sourcemap.js";export{parseStack}from"./sourcemap.js";async function e(e,t){return r(function(r){return async e=>{const{pathname:t,search:o}=a(e),n=await r.moduleGraph.getModuleByUrl(t+o)??await r.moduleGraph.getModuleByUrl(t);return n?.transformResult?.map??null}}(e),t)}export{e as enrichReportData};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./sourcemap.cjs");function r(e){return e.replace(/\\/g,"/").replace(/^\/+/,"")}exports.enrichReportData=e.enrichReportData,exports.parseStack=e.parseStack,exports.resolveFrame=e.resolveFrame,exports.resolveStack=e.resolveStack,exports.createAssetMapStore=function(){const t=new Map;return{put:(e,a)=>{const s=r(e);s.endsWith(".map")&&t.set(s,a)},loadMap:async a=>{const{pathname:s}=e.splitScriptUrl(a),o=r(s);if(!o)return null;let p=t.get(`${o}.map`);if(void 0===p){const e=`${o.split("/").pop()}.map`;for(const[r,a]of t)if(r===e||r.endsWith(`/${e}`)){p=a;break}}if(void 0===p)return null;try{return JSON.parse(p)}catch{return null}}}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{splitScriptUrl as e}from"./sourcemap.js";export{enrichReportData,parseStack,resolveFrame,resolveStack}from"./sourcemap.js";function r(e){return e.replace(/\\/g,"/").replace(/^\/+/,"")}function t(){const t=new Map;return{put:(e,n)=>{const o=r(e);o.endsWith(".map")&&t.set(o,n)},loadMap:async n=>{const{pathname:o}=e(n),a=r(o);if(!a)return null;let p=t.get(`${a}.map`);if(void 0===p){const e=`${a.split("/").pop()}.map`;for(const[r,n]of t)if(r===e||r.endsWith(`/${e}`)){p=n;break}}if(void 0===p)return null;try{return JSON.parse(p)}catch{return null}}}}export{t as createAssetMapStore};
|
package/dist/utils/base64.cjs
DELETED
|
@@ -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(/=+$/,"")};
|
package/dist/utils/base64.js
DELETED
|
@@ -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};
|