-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathtypes.ts
72 lines (65 loc) · 2.14 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import type { CompileOptions } from 'svelte/types/compiler';
import type { PreprocessorGroup } from 'svelte/types/compiler/preprocess';
// Adds an id property to the preprocessor object we can use to check for duplication
// in the preprocessors array
export interface SentryPreprocessorGroup extends PreprocessorGroup {
sentryId?: string;
}
/**
* The object exported from `svelte.config.js`
*/
export type SvelteConfig = {
[key: string]: unknown;
preprocess?: PreprocessorGroup[] | PreprocessorGroup;
compilerOptions?: CompileOptions;
};
/**
* Options users can provide to `withSentryConfig` to customize what Sentry adds too the Svelte config
*/
export type SentrySvelteConfigOptions = {
componentTracking?: ComponentTrackingInitOptions;
};
export type SpanOptions = {
/**
* If true, a span is recorded between a component's initialization and its
* onMount lifecycle hook. This span tells how long it takes a component
* to be created and inserted into the DOM.
*
* @default `true` if component tracking is enabled
*/
trackInit?: boolean;
/**
* If true, a span is recorded between a component's beforeUpdate and afterUpdate
* lifecycle hooks.
*
* Caution: Component updates can only be tracked in Svelte versions prior to version 5
* or in Svelte 5 in legacy mode (i.e. without Runes).
*
* @default `false` if component tracking is enabled
*/
trackUpdates?: boolean;
};
/**
* Control which components and which operations should be tracked
* and recorded as spans
*/
export type ComponentTrackingInitOptions = {
/**
* Control if all your Svelte components should be tracked or only a specified list
* of components.
* If set to true, all components will be tracked.
* If you only want to track a selection of components, specify the component names
* as an array.
*
* Defaults to true if the preprocessor is used
*/
trackComponents?: boolean | string[];
} & SpanOptions;
export type TrackComponentOptions = {
/**
* The name of the component to be used in the recorded spans.
*
* @default to <Svelte Component> if not specified
*/
componentName?: string;
} & SpanOptions;