@swifty.js/sentry 0.0.1 → 0.0.2
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/README.md +4 -19
- package/dist/core/decorates.cjs +1 -0
- package/dist/core/decorates.js +1 -0
- package/dist/core/setup.cjs +1 -1
- package/dist/core/setup.js +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/preact.cjs +1 -0
- package/dist/preact.d.ts +52 -0
- package/dist/preact.js +1 -0
- package/dist/reporter/report-data-schema.cjs +1 -1
- package/dist/reporter/report-data-schema.js +1 -1
- package/package.json +21 -7
- package/dist/core/decorate-publish.cjs +0 -1
- package/dist/core/decorate-publish.js +0 -1
- /package/dist/core/{decorate-http-publish.cjs → decorate-http.cjs} +0 -0
- /package/dist/core/{decorate-http-publish.js → decorate-http.js} +0 -0
- /package/dist/core/{decorate-route-publish.cjs → decorate-route.cjs} +0 -0
- /package/dist/core/{decorate-route-publish.js → decorate-route.js} +0 -0
package/README.md
CHANGED
|
@@ -24,11 +24,7 @@ npm install vue
|
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
26
|
import { init, destroy, isInitialized, pluginEnable } from "@swifty.js/sentry";
|
|
27
|
-
import {
|
|
28
|
-
PerformancePlugin,
|
|
29
|
-
ScreenRecordPlugin,
|
|
30
|
-
ExposurePlugin,
|
|
31
|
-
} from "@swifty.js/sentry/plugins";
|
|
27
|
+
import { PerformancePlugin, ScreenRecordPlugin, ExposurePlugin } from "@swifty.js/sentry/plugins";
|
|
32
28
|
import { ReactErrorBoundary } from "@swifty.js/sentry/react";
|
|
33
29
|
import { vuePlugin } from "@swifty.js/sentry/vue";
|
|
34
30
|
```
|
|
@@ -39,11 +35,7 @@ Each public export provides ESM, CJS, and TypeScript declaration files.
|
|
|
39
35
|
|
|
40
36
|
```ts
|
|
41
37
|
import { init, pluginEnable } from "@swifty.js/sentry";
|
|
42
|
-
import {
|
|
43
|
-
PerformancePlugin,
|
|
44
|
-
ScreenRecordPlugin,
|
|
45
|
-
ExposurePlugin,
|
|
46
|
-
} from "@swifty.js/sentry/plugins";
|
|
38
|
+
import { PerformancePlugin, ScreenRecordPlugin, ExposurePlugin } from "@swifty.js/sentry/plugins";
|
|
47
39
|
|
|
48
40
|
init({
|
|
49
41
|
dsn: "/api/log",
|
|
@@ -439,11 +431,7 @@ await sendLocal();
|
|
|
439
431
|
Register hooks after initialization or provide equivalent hooks in `init` options.
|
|
440
432
|
|
|
441
433
|
```ts
|
|
442
|
-
import {
|
|
443
|
-
afterSendData,
|
|
444
|
-
beforePushEventList,
|
|
445
|
-
beforeSendData,
|
|
446
|
-
} from "@swifty.js/sentry";
|
|
434
|
+
import { afterSendData, beforePushEventList, beforeSendData } from "@swifty.js/sentry";
|
|
447
435
|
|
|
448
436
|
beforeSendData((data) => {
|
|
449
437
|
if (data.type === "Click") {
|
|
@@ -585,10 +573,7 @@ Unsupported browser capabilities are skipped safely.
|
|
|
585
573
|
|
|
586
574
|
```ts
|
|
587
575
|
import { pluginEnable } from "@swifty.js/sentry";
|
|
588
|
-
import {
|
|
589
|
-
ScreenRecordPlugin,
|
|
590
|
-
unzipScreenRecord,
|
|
591
|
-
} from "@swifty.js/sentry/plugins";
|
|
576
|
+
import { ScreenRecordPlugin, unzipScreenRecord } from "@swifty.js/sentry/plugins";
|
|
592
577
|
|
|
593
578
|
pluginEnable(ScreenRecordPlugin);
|
|
594
579
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs");require("../constants/index.cjs");var t=require("../utils/decorate-prop.cjs"),r=require("../utils/get-base-data.cjs"),n=require("../utils/sentry.cjs"),c=require("../utils/throttle.cjs"),i=require("./bus.cjs"),u=require("./decorate-http.cjs"),s=require("./decorate-route.cjs");function a(){}exports.default=function(o){switch(o){case e.EventType.Click:return function(){const t=c.throttle(i.pub,n.default.options.clickThrottleDelay),u=function(n){t(e.EventType.Click,{...r.default(),type:e.EventType.Click,extra:n})};return document.addEventListener("click",u),()=>{document.removeEventListener("click",u)}}();case e.EventType.Error:return function(){const n=function(t){i.pub(e.EventType.Error,{...r.default(),type:e.EventType.Error,extra:t})};globalThis.addEventListener("error",n,!0);let c=!1;const u=t.default(console,"error",t=>function(...n){if(!c){c=!0;try{i.pub(e.EventType.Error,{...r.default(),type:e.EventType.Error,extra:n.find(e=>e instanceof Error)??n.join(" ")})}finally{c=!1}}t.call(this,...n)});return()=>{globalThis.removeEventListener("error",n,!0),u()}}();case e.EventType.Xhr:return u.pubXhr();case e.EventType.Fetch:return u.pubFetch();case e.EventType.History:return s.pubHistory();case e.EventType.UnhandledRejection:return function(){const t=function(t){i.pub(e.EventType.UnhandledRejection,{...r.default(),type:e.EventType.UnhandledRejection,extra:t})};return globalThis.addEventListener("unhandledrejection",t),()=>{globalThis.removeEventListener("unhandledrejection",t)}}();case e.EventType.HashChange:return function(){const t=function(t){i.pub(e.EventType.HashChange,{...r.default(),type:e.EventType.HashChange,extra:t})};return globalThis.addEventListener("hashchange",t),()=>{globalThis.removeEventListener("hashchange",t)}}();case e.EventType.WhiteScreen:return i.pub(e.EventType.WhiteScreen,{...r.default(),type:e.EventType.WhiteScreen,extra:"WhiteScreen"}),a;default:return a}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EventType as e}from"../types/enums.js";import"../constants/index.js";import t from"../utils/decorate-prop.js";import r from"../utils/get-base-data.js";import n from"../utils/sentry.js";import{throttle as o}from"../utils/throttle.js";import{pub as i}from"./bus.js";import{pubFetch as s,pubXhr as c}from"./decorate-http.js";import{pubHistory as a}from"./decorate-route.js";function l(){}function u(u){switch(u){case e.Click:return function(){const t=o(i,n.options.clickThrottleDelay),s=function(n){t(e.Click,{...r(),type:e.Click,extra:n})};return document.addEventListener("click",s),()=>{document.removeEventListener("click",s)}}();case e.Error:return function(){const n=function(t){i(e.Error,{...r(),type:e.Error,extra:t})};globalThis.addEventListener("error",n,!0);let o=!1;const s=t(console,"error",t=>function(...n){if(!o){o=!0;try{i(e.Error,{...r(),type:e.Error,extra:n.find(e=>e instanceof Error)??n.join(" ")})}finally{o=!1}}t.call(this,...n)});return()=>{globalThis.removeEventListener("error",n,!0),s()}}();case e.Xhr:return c();case e.Fetch:return s();case e.History:return a();case e.UnhandledRejection:return function(){const t=function(t){i(e.UnhandledRejection,{...r(),type:e.UnhandledRejection,extra:t})};return globalThis.addEventListener("unhandledrejection",t),()=>{globalThis.removeEventListener("unhandledrejection",t)}}();case e.HashChange:return function(){const t=function(t){i(e.HashChange,{...r(),type:e.HashChange,extra:t})};return globalThis.addEventListener("hashchange",t),()=>{globalThis.removeEventListener("hashchange",t)}}();case e.WhiteScreen:return i(e.WhiteScreen,{...r(),type:e.WhiteScreen,extra:"WhiteScreen"}),l;default:return l}}export{u as default};
|
package/dist/core/setup.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs");require("../constants/index.cjs");var n=require("../utils/sentry.cjs"),t=require("../utils/logger.cjs"),r=require("./bus.cjs"),s=require("./pv-lifecycle.cjs"),a=require("./handle-error.cjs"),i=require("./handle-route.cjs"),l=require("./handle-http.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs");require("../constants/index.cjs");var n=require("../utils/sentry.cjs"),t=require("../utils/logger.cjs"),r=require("./bus.cjs"),s=require("./pv-lifecycle.cjs"),a=require("./handle-error.cjs"),i=require("./handle-route.cjs"),l=require("./handle-http.cjs"),o=require("./handle-events.cjs"),u=require("./decorates.cjs");exports.default=function(){t.sentryLogger.info("Initializing SDK event subscriptions...");const c=[{enabled:n.default.options.enableXhr,type:e.EventType.Xhr,subscribe:()=>r.sub(e.EventType.Xhr,l.handleHttp),name:"Xhr"},{enabled:n.default.options.enableFetch,type:e.EventType.Fetch,subscribe:()=>r.sub(e.EventType.Fetch,l.handleHttp),name:"Fetch"},{enabled:n.default.options.enableError,type:e.EventType.Error,subscribe:()=>r.sub(e.EventType.Error,a.handleError),name:"Error"},{enabled:n.default.options.enableHistory,type:e.EventType.History,subscribe:()=>r.sub(e.EventType.History,i.handleHistory),name:"History"},{enabled:n.default.options.enableHashChange,type:e.EventType.HashChange,subscribe:()=>r.sub(e.EventType.HashChange,i.handleHashChange),name:"HashChange"},{enabled:n.default.options.enableUnhandledRejection,type:e.EventType.UnhandledRejection,subscribe:()=>r.sub(e.EventType.UnhandledRejection,o.handleUnhandledRejection),name:"UnhandledRejection"},{enabled:n.default.options.enableClick,type:e.EventType.Click,subscribe:()=>r.sub(e.EventType.Click,o.handleClick),name:"Click"},{enabled:n.default.options.enableWhiteScreen,type:e.EventType.WhiteScreen,subscribe:()=>r.sub(e.EventType.WhiteScreen,o.handleWhiteScreen),name:"WhiteScreen"}].filter(({enabled:e})=>e),b=[];c.forEach(({type:e,subscribe:n})=>{b.push(n()),b.push(u.default(e))}),s.initPageView();const d=()=>{s.flushCurrentPageDwell(!0)};return globalThis.addEventListener("beforeunload",d),b.push(()=>{globalThis.removeEventListener("beforeunload",d)}),t.sentryLogger.success("SDK setup completed",c.map(e=>({event:e.name,type:e.type}))),()=>{b.toReversed().forEach(e=>{e()}),s.resetPageView(),r.clearSubscriptions()}};
|
package/dist/core/setup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EventType as e}from"../types/enums.js";import"../constants/index.js";import n from"../utils/sentry.js";import{sentryLogger as t}from"../utils/logger.js";import{sub as r,clearSubscriptions as s}from"./bus.js";import{initPageView as o,flushCurrentPageDwell as i,resetPageView as a}from"./pv-lifecycle.js";import{handleError as l}from"./handle-error.js";import{handleHistory as b,handleHashChange as p}from"./handle-route.js";import{handleHttp as c}from"./handle-http.js";import{handleUnhandledRejection as h,handleClick as m,handleWhiteScreen as d}from"./handle-events.js";import u from"./
|
|
1
|
+
import{EventType as e}from"../types/enums.js";import"../constants/index.js";import n from"../utils/sentry.js";import{sentryLogger as t}from"../utils/logger.js";import{sub as r,clearSubscriptions as s}from"./bus.js";import{initPageView as o,flushCurrentPageDwell as i,resetPageView as a}from"./pv-lifecycle.js";import{handleError as l}from"./handle-error.js";import{handleHistory as b,handleHashChange as p}from"./handle-route.js";import{handleHttp as c}from"./handle-http.js";import{handleUnhandledRejection as h,handleClick as m,handleWhiteScreen as d}from"./handle-events.js";import u from"./decorates.js";function f(){t.info("Initializing SDK event subscriptions...");const f=[{enabled:n.options.enableXhr,type:e.Xhr,subscribe:()=>r(e.Xhr,c),name:"Xhr"},{enabled:n.options.enableFetch,type:e.Fetch,subscribe:()=>r(e.Fetch,c),name:"Fetch"},{enabled:n.options.enableError,type:e.Error,subscribe:()=>r(e.Error,l),name:"Error"},{enabled:n.options.enableHistory,type:e.History,subscribe:()=>r(e.History,b),name:"History"},{enabled:n.options.enableHashChange,type:e.HashChange,subscribe:()=>r(e.HashChange,p),name:"HashChange"},{enabled:n.options.enableUnhandledRejection,type:e.UnhandledRejection,subscribe:()=>r(e.UnhandledRejection,h),name:"UnhandledRejection"},{enabled:n.options.enableClick,type:e.Click,subscribe:()=>r(e.Click,m),name:"Click"},{enabled:n.options.enableWhiteScreen,type:e.WhiteScreen,subscribe:()=>r(e.WhiteScreen,d),name:"WhiteScreen"}].filter(({enabled:e})=>e),y=[];f.forEach(({type:e,subscribe:n})=>{y.push(n()),y.push(u(e))}),o();const j=()=>{i(!0)};return globalThis.addEventListener("beforeunload",j),y.push(()=>{globalThis.removeEventListener("beforeunload",j)}),t.success("SDK setup completed",f.map(e=>({event:e.name,type:e.type}))),()=>{y.toReversed().forEach(e=>{e()}),a(),s()}}export{f as default};
|
package/dist/package.json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="0.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="0.0.2",r={version:e};exports.default=r,exports.version=e;
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="0.0.
|
|
1
|
+
var a="0.0.2",e={version:a};export{e as default,a as version};
|
package/dist/preact.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var r=require("preact"),e=require("./types/enums.cjs"),t=require("./core/framework-error.cjs");class o extends r.Component{state={};static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,o){this.setState({error:r,errorInfo:o}),t.reportFrameworkError({type:e.EventType.React,error:r,context:o})}render(){const{error:r,errorInfo:e}=this.state;if(r){const{fallback:t}=this.props;return"function"==typeof t?t(r,e):t??null}return this.props.children??null}}exports.PreactErrorBoundary=o;
|
package/dist/preact.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Component, ComponentChildren, ErrorInfo } from 'preact';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Props for the {@link PreactErrorBoundary} component.
|
|
5
|
+
*
|
|
6
|
+
* The boundary renders `children` normally. When a descendant throws during
|
|
7
|
+
* rendering, it switches to rendering {@link fallback} and reports the error
|
|
8
|
+
* to the Sentry SDK.
|
|
9
|
+
*/
|
|
10
|
+
interface PreactErrorBoundaryProps {
|
|
11
|
+
/**
|
|
12
|
+
* The subtree to render when no error has occurred. When an error is
|
|
13
|
+
* caught, this is replaced by {@link fallback}.
|
|
14
|
+
*/
|
|
15
|
+
readonly children?: ComponentChildren;
|
|
16
|
+
/**
|
|
17
|
+
* The UI to display when a descendant throws.
|
|
18
|
+
*
|
|
19
|
+
* Can be a static `ComponentChildren` (no access to the error) or a render
|
|
20
|
+
* function that receives the caught error and Preact's component-stack info.
|
|
21
|
+
*
|
|
22
|
+
* @param error - The Error thrown by the descendant component.
|
|
23
|
+
* @param errorInfo - Preact's {@link ErrorInfo}, containing `componentStack`.
|
|
24
|
+
* `undefined` on the first render after the error is caught.
|
|
25
|
+
* @returns The fallback Preact subtree to render.
|
|
26
|
+
*/
|
|
27
|
+
readonly fallback?: ComponentChildren | ((error: Error, errorInfo?: ErrorInfo) => ComponentChildren);
|
|
28
|
+
}
|
|
29
|
+
/** Internal state tracking the caught error and component-stack info. */
|
|
30
|
+
interface PreactErrorBoundaryState {
|
|
31
|
+
readonly error?: Error;
|
|
32
|
+
readonly errorInfo?: ErrorInfo;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A Preact Error Boundary that reports caught errors to the Sentry SDK.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <PreactErrorBoundary fallback={<div>Something went wrong</div>}>
|
|
40
|
+
* <Page />
|
|
41
|
+
* </PreactErrorBoundary>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare class PreactErrorBoundary extends Component<PreactErrorBoundaryProps, PreactErrorBoundaryState> {
|
|
45
|
+
state: PreactErrorBoundaryState;
|
|
46
|
+
static getDerivedStateFromError(error: Error): PreactErrorBoundaryState;
|
|
47
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
48
|
+
render(): ComponentChildren;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { PreactErrorBoundary };
|
|
52
|
+
export type { PreactErrorBoundaryProps };
|
package/dist/preact.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Component as r}from"preact";import{EventType as t}from"./types/enums.js";import{reportFrameworkError as e}from"./core/framework-error.js";class o extends r{state={};static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,o){this.setState({error:r,errorInfo:o}),e({type:t.React,error:r,context:o})}render(){const{error:r,errorInfo:t}=this.state;if(r){const{fallback:e}=this.props;return"function"==typeof e?e(r,t):e??null}return this.props.children??null}}export{o as PreactErrorBoundary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("zod"),t=require("../types/enums.cjs");const r=e.z.object({browserName:e.z.string(),browserVersion:e.z.string(),osName:e.z.string(),osVersion:e.z.string(),userAgent:e.z.string(),deviceType:e.z.string(),deviceModel:e.z.string(),fingerprint:e.z.string(),language:e.z.string(),screenResolution:e.z.string()}),s=e.z.object({id:e.z.string(),type:e.z.
|
|
1
|
+
"use strict";var e=require("zod"),t=require("../types/enums.cjs");const r=e.z.object({browserName:e.z.string(),browserVersion:e.z.string(),osName:e.z.string(),osVersion:e.z.string(),userAgent:e.z.string(),deviceType:e.z.string(),deviceModel:e.z.string(),fingerprint:e.z.string(),language:e.z.string(),screenResolution:e.z.string()}),s=e.z.object({id:e.z.string(),type:e.z.enum(t.EventType),name:e.z.string(),time:e.z.string(),timestamp:e.z.number(),message:e.z.string(),status:e.z.enum(t.Status),url:e.z.string(),userId:e.z.string(),projectId:e.z.string(),sdkVersion:e.z.string(),deviceInfo:r,payload:e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),n=e.z.array(s);exports.deviceInfoSchema=r,exports.reportDataListSchema=n,exports.reportDataSchema=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";import{Status as
|
|
1
|
+
import{z as e}from"zod";import{Status as r,EventType as t}from"../types/enums.js";const s=e.object({browserName:e.string(),browserVersion:e.string(),osName:e.string(),osVersion:e.string(),userAgent:e.string(),deviceType:e.string(),deviceModel:e.string(),fingerprint:e.string(),language:e.string(),screenResolution:e.string()}),n=e.object({id:e.string(),type:e.enum(t),name:e.string(),time:e.string(),timestamp:e.number(),message:e.string(),status:e.enum(r),url:e.string(),userId:e.string(),projectId:e.string(),sdkVersion:e.string(),deviceInfo:s,payload:e.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),i=e.array(n);export{s as deviceInfoSchema,i as reportDataListSchema,n as reportDataSchema};
|
package/package.json
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swifty.js/sentry",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "sentry sdk",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Framework-agnostic sentry sdk with first-class support for react, vue3+, and preact",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sdk",
|
|
7
|
-
"sentry"
|
|
7
|
+
"sentry",
|
|
8
|
+
"react",
|
|
9
|
+
"vue",
|
|
10
|
+
"preact"
|
|
8
11
|
],
|
|
12
|
+
"homepage": "https://github.com/hangtiancheng/swifty-sentry/tree/main/sentry#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/hangtiancheng/swifty-sentry/issues"
|
|
15
|
+
},
|
|
9
16
|
"license": "MIT",
|
|
10
17
|
"author": "https://github.com/hangtiancheng",
|
|
11
|
-
"homepage": "https://github.com/hangtiancheng/swifty-sentry/tree/main/sentry#readme",
|
|
12
18
|
"repository": {
|
|
13
19
|
"type": "git",
|
|
14
20
|
"url": "git+https://github.com/hangtiancheng/swifty-sentry.git",
|
|
15
21
|
"directory": "sentry"
|
|
16
22
|
},
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/hangtiancheng/swifty-sentry/issues"
|
|
19
|
-
},
|
|
20
23
|
"files": [
|
|
21
24
|
"dist",
|
|
22
25
|
"README.md"
|
|
@@ -41,6 +44,11 @@
|
|
|
41
44
|
"import": "./dist/react.js",
|
|
42
45
|
"require": "./dist/react.cjs"
|
|
43
46
|
},
|
|
47
|
+
"./preact": {
|
|
48
|
+
"types": "./dist/preact.d.ts",
|
|
49
|
+
"import": "./dist/preact.js",
|
|
50
|
+
"require": "./dist/preact.cjs"
|
|
51
|
+
},
|
|
44
52
|
"./vue": {
|
|
45
53
|
"types": "./dist/vue.d.ts",
|
|
46
54
|
"import": "./dist/vue.js",
|
|
@@ -64,6 +72,7 @@
|
|
|
64
72
|
"typecheck": "tsc --noEmit",
|
|
65
73
|
"vite7": "pnpm add -D vite7@npm:vite@7.3.3",
|
|
66
74
|
"format": "oxfmt --write ./",
|
|
75
|
+
"prepublishOnly": "pnpm build",
|
|
67
76
|
"build": "rollup -c ./rollup.config.ts",
|
|
68
77
|
"build:tsup": "tsup --config ./tsup.config.ts"
|
|
69
78
|
},
|
|
@@ -90,6 +99,7 @@
|
|
|
90
99
|
"@vitest/coverage-v8": "^1.6.1",
|
|
91
100
|
"jsdom": "^24.1.3",
|
|
92
101
|
"oxfmt": "^0.54.0",
|
|
102
|
+
"preact": "^10.29.7",
|
|
93
103
|
"react": "^19.2.7",
|
|
94
104
|
"rollup": "^4.62.2",
|
|
95
105
|
"rollup-plugin-dts": "^6.4.1",
|
|
@@ -103,12 +113,16 @@
|
|
|
103
113
|
"webpack-dev-server": "^5.2.6"
|
|
104
114
|
},
|
|
105
115
|
"peerDependencies": {
|
|
116
|
+
"preact": "^10.0.0",
|
|
106
117
|
"react": "^19.0.0",
|
|
107
118
|
"vite": "^7.0.0 || ^8.0.0",
|
|
108
119
|
"vue": "^3.0.0",
|
|
109
120
|
"webpack": "^4.0.0 || ^5.0.0"
|
|
110
121
|
},
|
|
111
122
|
"peerDependenciesMeta": {
|
|
123
|
+
"preact": {
|
|
124
|
+
"optional": true
|
|
125
|
+
},
|
|
112
126
|
"react": {
|
|
113
127
|
"optional": true
|
|
114
128
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs");require("../constants/index.cjs");var t=require("../utils/decorate-prop.cjs"),r=require("../utils/get-base-data.cjs"),n=require("../utils/sentry.cjs"),i=require("../utils/throttle.cjs"),u=require("./bus.cjs"),c=require("./decorate-http-publish.cjs"),s=require("./decorate-route-publish.cjs");function a(){}exports.default=function(o){switch(o){case e.EventType.Click:return function(){const t=i.throttle(u.pub,n.default.options.clickThrottleDelay),c=function(n){t(e.EventType.Click,{...r.default(),type:e.EventType.Click,extra:n})};return document.addEventListener("click",c),()=>{document.removeEventListener("click",c)}}();case e.EventType.Error:return function(){const n=function(t){u.pub(e.EventType.Error,{...r.default(),type:e.EventType.Error,extra:t})};globalThis.addEventListener("error",n,!0);let i=!1;const c=t.default(console,"error",t=>function(...n){if(!i){i=!0;try{u.pub(e.EventType.Error,{...r.default(),type:e.EventType.Error,extra:n.find(e=>e instanceof Error)??n.join(" ")})}finally{i=!1}}t.call(this,...n)});return()=>{globalThis.removeEventListener("error",n,!0),c()}}();case e.EventType.Xhr:return c.pubXhr();case e.EventType.Fetch:return c.pubFetch();case e.EventType.History:return s.pubHistory();case e.EventType.UnhandledRejection:return function(){const t=function(t){u.pub(e.EventType.UnhandledRejection,{...r.default(),type:e.EventType.UnhandledRejection,extra:t})};return globalThis.addEventListener("unhandledrejection",t),()=>{globalThis.removeEventListener("unhandledrejection",t)}}();case e.EventType.HashChange:return function(){const t=function(t){u.pub(e.EventType.HashChange,{...r.default(),type:e.EventType.HashChange,extra:t})};return globalThis.addEventListener("hashchange",t),()=>{globalThis.removeEventListener("hashchange",t)}}();case e.EventType.WhiteScreen:return u.pub(e.EventType.WhiteScreen,{...r.default(),type:e.EventType.WhiteScreen,extra:"WhiteScreen"}),a;default:return a}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{EventType as e}from"../types/enums.js";import"../constants/index.js";import t from"../utils/decorate-prop.js";import r from"../utils/get-base-data.js";import n from"../utils/sentry.js";import{throttle as o}from"../utils/throttle.js";import{pub as i}from"./bus.js";import{pubFetch as s,pubXhr as c}from"./decorate-http-publish.js";import{pubHistory as a}from"./decorate-route-publish.js";function l(){}function u(u){switch(u){case e.Click:return function(){const t=o(i,n.options.clickThrottleDelay),s=function(n){t(e.Click,{...r(),type:e.Click,extra:n})};return document.addEventListener("click",s),()=>{document.removeEventListener("click",s)}}();case e.Error:return function(){const n=function(t){i(e.Error,{...r(),type:e.Error,extra:t})};globalThis.addEventListener("error",n,!0);let o=!1;const s=t(console,"error",t=>function(...n){if(!o){o=!0;try{i(e.Error,{...r(),type:e.Error,extra:n.find(e=>e instanceof Error)??n.join(" ")})}finally{o=!1}}t.call(this,...n)});return()=>{globalThis.removeEventListener("error",n,!0),s()}}();case e.Xhr:return c();case e.Fetch:return s();case e.History:return a();case e.UnhandledRejection:return function(){const t=function(t){i(e.UnhandledRejection,{...r(),type:e.UnhandledRejection,extra:t})};return globalThis.addEventListener("unhandledrejection",t),()=>{globalThis.removeEventListener("unhandledrejection",t)}}();case e.HashChange:return function(){const t=function(t){i(e.HashChange,{...r(),type:e.HashChange,extra:t})};return globalThis.addEventListener("hashchange",t),()=>{globalThis.removeEventListener("hashchange",t)}}();case e.WhiteScreen:return i(e.WhiteScreen,{...r(),type:e.WhiteScreen,extra:"WhiteScreen"}),l;default:return l}}export{u as default};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|