UNPKG

2.55 kBTypeScriptView Raw
1import type { StackFrame } from '@sentry/types';
2type StackFrameIteratee = (frame: StackFrame) => StackFrame;
3interface RewriteFramesOptions {
4 /**
5 * Root path (the beginning of the path) that will be stripped from the frames' filename.
6 *
7 * This option has slightly different behaviour in the browser and on servers:
8 * - In the browser, the value you provide in `root` will be stripped from the beginning stack frames' paths (if the path started with the value).
9 * - On the server, the root value will only replace the beginning of stack frame filepaths, when the path is absolute. If no `root` value is provided and the path is absolute, the frame will be reduced to only the filename and the provided `prefix` option.
10 *
11 * Browser example:
12 * - Original frame: `'http://example.com/my/path/static/asset.js'`
13 * - `root: 'http://example.com/my/path'`
14 * - `assetPrefix: 'app://'`
15 * - Resulting frame: `'app:///static/asset.js'`
16 *
17 * Server example:
18 * - Original frame: `'/User/local/my/path/static/asset.js'`
19 * - `root: '/User/local/my/path'`
20 * - `assetPrefix: 'app://'`
21 * - Resulting frame: `'app:///static/asset.js'`
22 */
23 root?: string;
24 /**
25 * A custom prefix that stack frames will be prepended with.
26 *
27 * Default: `'app://'`
28 *
29 * This option has slightly different behaviour in the browser and on servers:
30 * - In the browser, the value you provide in `prefix` will prefix the resulting filename when the value you provided in `root` was applied. Effectively replacing whatever `root` matched in the beginning of the frame with `prefix`.
31 * - On the server, the prefix is applied to all stackframes with absolute paths. On Windows, the drive identifier (e.g. "C://") is replaced with the prefix.
32 */
33 prefix?: string;
34 /**
35 * Defines an iterator that is used to iterate through all of the stack frames for modification before being sent to Sentry.
36 * Setting this option will effectively disable both the `root` and the `prefix` options.
37 */
38 iteratee?: StackFrameIteratee;
39}
40/**
41 * Rewrite event frames paths.
42 */
43export declare const rewriteFramesIntegration: (options?: RewriteFramesOptions | undefined) => import("@sentry/types").Integration;
44/**
45 * Exported only for tests.
46 */
47export declare function generateIteratee({ isBrowser, root, prefix, }: {
48 isBrowser: boolean;
49 root?: string;
50 prefix: string;
51}): StackFrameIteratee;
52export {};
53//# sourceMappingURL=rewriteframes.d.ts.map
\No newline at end of file