@flareapp/vue 1.2.0 → 2.0.0

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.
@@ -0,0 +1,176 @@
1
+ import * as vue from "vue";
2
+ import { ComponentPublicInstance, Plugin, PropType } from "vue";
3
+
4
+ //#region src/types.d.ts
5
+ type ErrorOrigin = 'setup' | 'render' | 'lifecycle' | 'event' | 'watcher' | 'unknown';
6
+ type ComponentHierarchyFrame = {
7
+ component: string;
8
+ file: string | null;
9
+ props?: Record<string, unknown>;
10
+ };
11
+ type RouteParamValue = string | string[];
12
+ type RouteQueryValue = string | null;
13
+ type RouteContext = {
14
+ name: string | null;
15
+ path: string;
16
+ fullPath: string;
17
+ params: Record<string, RouteParamValue>;
18
+ query: Record<string, RouteQueryValue | RouteQueryValue[]>;
19
+ hash: string;
20
+ matched: string[];
21
+ };
22
+ type FlareVueContext = {
23
+ vue: {
24
+ info: string;
25
+ errorOrigin: ErrorOrigin;
26
+ componentName: string;
27
+ componentProps?: Record<string, unknown>;
28
+ componentHierarchy: string[];
29
+ componentHierarchyFrames: ComponentHierarchyFrame[];
30
+ route?: RouteContext;
31
+ };
32
+ };
33
+ type FlareVueWarningContext = {
34
+ vue: {
35
+ type: 'warning';
36
+ info: string;
37
+ componentName: string;
38
+ componentTrace: string;
39
+ route?: RouteContext;
40
+ };
41
+ };
42
+ type FlareErrorBoundaryHookParams = {
43
+ error: Error;
44
+ instance: ComponentPublicInstance | null;
45
+ info: string;
46
+ };
47
+ type FlareVueOptions = {
48
+ captureWarnings?: boolean;
49
+ attachProps?: boolean;
50
+ propsMaxDepth?: number;
51
+ propsDenylist?: RegExp;
52
+ replaceDefaultDenylist?: boolean;
53
+ beforeEvaluate?: (params: FlareErrorBoundaryHookParams) => void;
54
+ beforeSubmit?: (params: FlareErrorBoundaryHookParams & {
55
+ context: FlareVueContext;
56
+ }) => FlareVueContext;
57
+ afterSubmit?: (params: FlareErrorBoundaryHookParams & {
58
+ context: FlareVueContext;
59
+ }) => void;
60
+ };
61
+ type FlareErrorBoundaryFallbackProps = {
62
+ error: Error;
63
+ componentProps?: Record<string, unknown>;
64
+ componentHierarchy: string[];
65
+ componentHierarchyFrames: ComponentHierarchyFrame[];
66
+ resetErrorBoundary: () => void;
67
+ };
68
+ //#endregion
69
+ //#region src/FlareErrorBoundary.d.ts
70
+ declare const FlareErrorBoundary: vue.DefineComponent<vue.ExtractPropTypes<{
71
+ beforeEvaluate: {
72
+ type: PropType<(params: FlareErrorBoundaryHookParams) => void>;
73
+ default: undefined;
74
+ };
75
+ beforeSubmit: {
76
+ type: PropType<(params: FlareErrorBoundaryHookParams & {
77
+ context: FlareVueContext;
78
+ }) => FlareVueContext>;
79
+ default: undefined;
80
+ };
81
+ afterSubmit: {
82
+ type: PropType<(params: FlareErrorBoundaryHookParams & {
83
+ context: FlareVueContext;
84
+ }) => void>;
85
+ default: undefined;
86
+ };
87
+ onReset: {
88
+ type: PropType<(error: Error | null) => void>;
89
+ default: undefined;
90
+ };
91
+ resetKeys: {
92
+ type: PropType<unknown[]>;
93
+ default: undefined;
94
+ };
95
+ attachProps: {
96
+ type: BooleanConstructor;
97
+ default: boolean;
98
+ };
99
+ propsMaxDepth: {
100
+ type: NumberConstructor;
101
+ default: number;
102
+ };
103
+ propsDenylist: {
104
+ type: PropType<RegExp>;
105
+ default: undefined;
106
+ };
107
+ replaceDefaultDenylist: {
108
+ type: BooleanConstructor;
109
+ default: boolean;
110
+ };
111
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
112
+ [key: string]: any;
113
+ }>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
114
+ beforeEvaluate: {
115
+ type: PropType<(params: FlareErrorBoundaryHookParams) => void>;
116
+ default: undefined;
117
+ };
118
+ beforeSubmit: {
119
+ type: PropType<(params: FlareErrorBoundaryHookParams & {
120
+ context: FlareVueContext;
121
+ }) => FlareVueContext>;
122
+ default: undefined;
123
+ };
124
+ afterSubmit: {
125
+ type: PropType<(params: FlareErrorBoundaryHookParams & {
126
+ context: FlareVueContext;
127
+ }) => void>;
128
+ default: undefined;
129
+ };
130
+ onReset: {
131
+ type: PropType<(error: Error | null) => void>;
132
+ default: undefined;
133
+ };
134
+ resetKeys: {
135
+ type: PropType<unknown[]>;
136
+ default: undefined;
137
+ };
138
+ attachProps: {
139
+ type: BooleanConstructor;
140
+ default: boolean;
141
+ };
142
+ propsMaxDepth: {
143
+ type: NumberConstructor;
144
+ default: number;
145
+ };
146
+ propsDenylist: {
147
+ type: PropType<RegExp>;
148
+ default: undefined;
149
+ };
150
+ replaceDefaultDenylist: {
151
+ type: BooleanConstructor;
152
+ default: boolean;
153
+ };
154
+ }>> & Readonly<{}>, {
155
+ beforeEvaluate: (params: FlareErrorBoundaryHookParams) => void;
156
+ beforeSubmit: (params: FlareErrorBoundaryHookParams & {
157
+ context: FlareVueContext;
158
+ }) => FlareVueContext;
159
+ afterSubmit: (params: FlareErrorBoundaryHookParams & {
160
+ context: FlareVueContext;
161
+ }) => void;
162
+ onReset: (error: Error | null) => void;
163
+ resetKeys: unknown[];
164
+ attachProps: boolean;
165
+ propsMaxDepth: number;
166
+ propsDenylist: RegExp;
167
+ replaceDefaultDenylist: boolean;
168
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
169
+ //#endregion
170
+ //#region src/flareVue.d.ts
171
+ declare const flareVue: Plugin<[FlareVueOptions?]>;
172
+ //#endregion
173
+ //#region src/constants.d.ts
174
+ declare const DEFAULT_PROPS_DENYLIST: RegExp;
175
+ //#endregion
176
+ export { type ComponentHierarchyFrame, DEFAULT_PROPS_DENYLIST, type ErrorOrigin, FlareErrorBoundary, type FlareErrorBoundaryFallbackProps, type FlareErrorBoundaryHookParams, type FlareVueContext, type FlareVueOptions, type FlareVueWarningContext, type RouteContext, type RouteParamValue, type RouteQueryValue, flareVue };
package/dist/index.d.mts CHANGED
@@ -1,25 +1,176 @@
1
- import { flare } from '@flareapp/js';
1
+ import * as vue from "vue";
2
+ import { ComponentPublicInstance, Plugin, PropType } from "vue";
2
3
 
3
- function flareVue(app) {
4
- const initialErrorHandler = app.config.errorHandler;
5
-
6
- app.config.errorHandler = (error, vm, info) => {
7
- const componentName = vm && vm.$options && vm.$options.name ? vm.$options.name : 'AnonymousComponent';
8
-
9
- const context = {
10
- vue: { info, componentName },
11
- };
12
-
13
- flare.report(error, context, { vue: { vm, info } });
14
-
15
- if (typeof initialErrorHandler === 'function') {
16
- initialErrorHandler(error, vm, info);
17
-
18
- return;
19
- }
20
-
21
- throw error;
22
- };
23
- }
24
-
25
- export { flareVue };
4
+ //#region src/types.d.ts
5
+ type ErrorOrigin = 'setup' | 'render' | 'lifecycle' | 'event' | 'watcher' | 'unknown';
6
+ type ComponentHierarchyFrame = {
7
+ component: string;
8
+ file: string | null;
9
+ props?: Record<string, unknown>;
10
+ };
11
+ type RouteParamValue = string | string[];
12
+ type RouteQueryValue = string | null;
13
+ type RouteContext = {
14
+ name: string | null;
15
+ path: string;
16
+ fullPath: string;
17
+ params: Record<string, RouteParamValue>;
18
+ query: Record<string, RouteQueryValue | RouteQueryValue[]>;
19
+ hash: string;
20
+ matched: string[];
21
+ };
22
+ type FlareVueContext = {
23
+ vue: {
24
+ info: string;
25
+ errorOrigin: ErrorOrigin;
26
+ componentName: string;
27
+ componentProps?: Record<string, unknown>;
28
+ componentHierarchy: string[];
29
+ componentHierarchyFrames: ComponentHierarchyFrame[];
30
+ route?: RouteContext;
31
+ };
32
+ };
33
+ type FlareVueWarningContext = {
34
+ vue: {
35
+ type: 'warning';
36
+ info: string;
37
+ componentName: string;
38
+ componentTrace: string;
39
+ route?: RouteContext;
40
+ };
41
+ };
42
+ type FlareErrorBoundaryHookParams = {
43
+ error: Error;
44
+ instance: ComponentPublicInstance | null;
45
+ info: string;
46
+ };
47
+ type FlareVueOptions = {
48
+ captureWarnings?: boolean;
49
+ attachProps?: boolean;
50
+ propsMaxDepth?: number;
51
+ propsDenylist?: RegExp;
52
+ replaceDefaultDenylist?: boolean;
53
+ beforeEvaluate?: (params: FlareErrorBoundaryHookParams) => void;
54
+ beforeSubmit?: (params: FlareErrorBoundaryHookParams & {
55
+ context: FlareVueContext;
56
+ }) => FlareVueContext;
57
+ afterSubmit?: (params: FlareErrorBoundaryHookParams & {
58
+ context: FlareVueContext;
59
+ }) => void;
60
+ };
61
+ type FlareErrorBoundaryFallbackProps = {
62
+ error: Error;
63
+ componentProps?: Record<string, unknown>;
64
+ componentHierarchy: string[];
65
+ componentHierarchyFrames: ComponentHierarchyFrame[];
66
+ resetErrorBoundary: () => void;
67
+ };
68
+ //#endregion
69
+ //#region src/FlareErrorBoundary.d.ts
70
+ declare const FlareErrorBoundary: vue.DefineComponent<vue.ExtractPropTypes<{
71
+ beforeEvaluate: {
72
+ type: PropType<(params: FlareErrorBoundaryHookParams) => void>;
73
+ default: undefined;
74
+ };
75
+ beforeSubmit: {
76
+ type: PropType<(params: FlareErrorBoundaryHookParams & {
77
+ context: FlareVueContext;
78
+ }) => FlareVueContext>;
79
+ default: undefined;
80
+ };
81
+ afterSubmit: {
82
+ type: PropType<(params: FlareErrorBoundaryHookParams & {
83
+ context: FlareVueContext;
84
+ }) => void>;
85
+ default: undefined;
86
+ };
87
+ onReset: {
88
+ type: PropType<(error: Error | null) => void>;
89
+ default: undefined;
90
+ };
91
+ resetKeys: {
92
+ type: PropType<unknown[]>;
93
+ default: undefined;
94
+ };
95
+ attachProps: {
96
+ type: BooleanConstructor;
97
+ default: boolean;
98
+ };
99
+ propsMaxDepth: {
100
+ type: NumberConstructor;
101
+ default: number;
102
+ };
103
+ propsDenylist: {
104
+ type: PropType<RegExp>;
105
+ default: undefined;
106
+ };
107
+ replaceDefaultDenylist: {
108
+ type: BooleanConstructor;
109
+ default: boolean;
110
+ };
111
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
112
+ [key: string]: any;
113
+ }>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
114
+ beforeEvaluate: {
115
+ type: PropType<(params: FlareErrorBoundaryHookParams) => void>;
116
+ default: undefined;
117
+ };
118
+ beforeSubmit: {
119
+ type: PropType<(params: FlareErrorBoundaryHookParams & {
120
+ context: FlareVueContext;
121
+ }) => FlareVueContext>;
122
+ default: undefined;
123
+ };
124
+ afterSubmit: {
125
+ type: PropType<(params: FlareErrorBoundaryHookParams & {
126
+ context: FlareVueContext;
127
+ }) => void>;
128
+ default: undefined;
129
+ };
130
+ onReset: {
131
+ type: PropType<(error: Error | null) => void>;
132
+ default: undefined;
133
+ };
134
+ resetKeys: {
135
+ type: PropType<unknown[]>;
136
+ default: undefined;
137
+ };
138
+ attachProps: {
139
+ type: BooleanConstructor;
140
+ default: boolean;
141
+ };
142
+ propsMaxDepth: {
143
+ type: NumberConstructor;
144
+ default: number;
145
+ };
146
+ propsDenylist: {
147
+ type: PropType<RegExp>;
148
+ default: undefined;
149
+ };
150
+ replaceDefaultDenylist: {
151
+ type: BooleanConstructor;
152
+ default: boolean;
153
+ };
154
+ }>> & Readonly<{}>, {
155
+ beforeEvaluate: (params: FlareErrorBoundaryHookParams) => void;
156
+ beforeSubmit: (params: FlareErrorBoundaryHookParams & {
157
+ context: FlareVueContext;
158
+ }) => FlareVueContext;
159
+ afterSubmit: (params: FlareErrorBoundaryHookParams & {
160
+ context: FlareVueContext;
161
+ }) => void;
162
+ onReset: (error: Error | null) => void;
163
+ resetKeys: unknown[];
164
+ attachProps: boolean;
165
+ propsMaxDepth: number;
166
+ propsDenylist: RegExp;
167
+ replaceDefaultDenylist: boolean;
168
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
169
+ //#endregion
170
+ //#region src/flareVue.d.ts
171
+ declare const flareVue: Plugin<[FlareVueOptions?]>;
172
+ //#endregion
173
+ //#region src/constants.d.ts
174
+ declare const DEFAULT_PROPS_DENYLIST: RegExp;
175
+ //#endregion
176
+ export { type ComponentHierarchyFrame, DEFAULT_PROPS_DENYLIST, type ErrorOrigin, FlareErrorBoundary, type FlareErrorBoundaryFallbackProps, type FlareErrorBoundaryHookParams, type FlareVueContext, type FlareVueOptions, type FlareVueWarningContext, type RouteContext, type RouteParamValue, type RouteQueryValue, flareVue };