@sentry/ember 11.0.0-alpha.0 → 11.0.0-alpha.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 +97 -115
- package/addon-main.cjs +4 -0
- package/declarations/index.d.ts +10 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/init.d.ts +23 -0
- package/declarations/init.d.ts.map +1 -0
- package/{utils → declarations/utils}/browserTracingIntegration.d.ts +7 -2
- package/declarations/utils/browserTracingIntegration.d.ts.map +1 -0
- package/{utils → declarations/utils}/instrumentEmberAppInstanceForPerformance.d.ts +11 -3
- package/declarations/utils/instrumentEmberAppInstanceForPerformance.d.ts.map +1 -0
- package/declarations/utils/instrumentEmberGlobals.d.ts +22 -0
- package/declarations/utils/instrumentEmberGlobals.d.ts.map +1 -0
- package/declarations/utils/instrumentRoutePerformance.d.ts +28 -0
- package/declarations/utils/instrumentRoutePerformance.d.ts.map +1 -0
- package/declarations/utils/utils.d.ts +7 -0
- package/declarations/utils/utils.d.ts.map +1 -0
- package/dist/index.js +569 -0
- package/dist/index.js.map +1 -0
- package/package.json +74 -71
- package/src/index.ts +13 -0
- package/src/init.ts +32 -0
- package/{addon → src}/utils/browserTracingIntegration.ts +40 -30
- package/{addon → src}/utils/instrumentEmberAppInstanceForPerformance.ts +180 -141
- package/{addon → src}/utils/instrumentEmberGlobals.ts +28 -30
- package/src/utils/instrumentRoutePerformance.ts +79 -0
- package/src/utils/utils.ts +25 -0
- package/.oxlintrc.json +0 -13
- package/LICENSE +0 -21
- package/addon/index.ts +0 -117
- package/addon/instance-initializers/sentry-performance.ts +0 -23
- package/addon/runloop.d.ts +0 -19
- package/addon/types.ts +0 -39
- package/addon/utils/performance.ts +0 -80
- package/app/instance-initializers/sentry-performance.js +0 -1
- package/config/environment.js +0 -5
- package/index.d.ts +0 -14
- package/index.js +0 -115
- package/instance-initializers/sentry-performance.d.ts +0 -7
- package/runloop.d.ts +0 -19
- package/tsconfig.json +0 -25
- package/types/dummy/index.d.ts +0 -0
- package/types/global.d.ts +0 -15
- package/types.d.ts +0 -36
- package/utils/instrumentEmberGlobals.d.ts +0 -9
- package/utils/performance.d.ts +0 -9
- package/vendor/initial-load-body.js +0 -3
- package/vendor/initial-load-head.js +0 -3
package/addon/index.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// import/export got a false positive, and affects most of our index barrel files
|
|
2
|
-
// can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703
|
|
3
|
-
/* eslint-disable import/export */
|
|
4
|
-
import { assert } from '@ember/debug';
|
|
5
|
-
import type Route from '@ember/routing/route';
|
|
6
|
-
import { getOwnConfig } from '@embroider/macros';
|
|
7
|
-
import { CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes';
|
|
8
|
-
import { GENERAL_FUNCTION_SPAN_OP } from '@sentry/conventions/op';
|
|
9
|
-
import type { BrowserOptions } from '@sentry/browser';
|
|
10
|
-
import { startSpan } from '@sentry/browser';
|
|
11
|
-
import * as Sentry from '@sentry/browser';
|
|
12
|
-
import type { Client, TransactionSource } from '@sentry/core';
|
|
13
|
-
import {
|
|
14
|
-
applySdkMetadata,
|
|
15
|
-
GLOBAL_OBJ,
|
|
16
|
-
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
|
|
17
|
-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
|
|
18
|
-
} from '@sentry/core';
|
|
19
|
-
import type { EmberSentryConfig, GlobalConfig, OwnConfig } from './types';
|
|
20
|
-
|
|
21
|
-
function _getSentryInitConfig(): EmberSentryConfig['sentry'] {
|
|
22
|
-
const _global = GLOBAL_OBJ as typeof GLOBAL_OBJ & GlobalConfig;
|
|
23
|
-
_global.__sentryEmberConfig = _global.__sentryEmberConfig ?? {};
|
|
24
|
-
return _global.__sentryEmberConfig;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Initialize the Sentry SDK for Ember.
|
|
29
|
-
*/
|
|
30
|
-
export function init(_runtimeConfig?: BrowserOptions): Client | undefined {
|
|
31
|
-
const environmentConfig = getOwnConfig<OwnConfig>().sentryConfig;
|
|
32
|
-
|
|
33
|
-
assert('Missing configuration.', environmentConfig);
|
|
34
|
-
assert('Missing configuration for Sentry.', environmentConfig.sentry || _runtimeConfig);
|
|
35
|
-
|
|
36
|
-
if (!environmentConfig.sentry) {
|
|
37
|
-
// If environment config is not specified but the above assertion passes, use runtime config.
|
|
38
|
-
environmentConfig.sentry = { ..._runtimeConfig };
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Merge runtime config into environment config, preferring runtime.
|
|
42
|
-
Object.assign(environmentConfig.sentry, _runtimeConfig || {});
|
|
43
|
-
const initConfig = Object.assign({}, environmentConfig.sentry);
|
|
44
|
-
|
|
45
|
-
applySdkMetadata(initConfig, 'ember');
|
|
46
|
-
|
|
47
|
-
// Persist Sentry init options so they are identical when performance initializers call init again.
|
|
48
|
-
const sentryInitConfig = _getSentryInitConfig();
|
|
49
|
-
Object.assign(sentryInitConfig, initConfig);
|
|
50
|
-
|
|
51
|
-
return Sentry.init(initConfig);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;
|
|
55
|
-
|
|
56
|
-
export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute: T): T => {
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
-
const instrumentFunction = async <X extends (...args: unknown[]) => any>(
|
|
59
|
-
hookName: string,
|
|
60
|
-
name: string,
|
|
61
|
-
fn: X,
|
|
62
|
-
args: Parameters<X>,
|
|
63
|
-
source: TransactionSource,
|
|
64
|
-
): Promise<ReturnType<X>> => {
|
|
65
|
-
return startSpan(
|
|
66
|
-
{
|
|
67
|
-
attributes: {
|
|
68
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
|
|
69
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember',
|
|
70
|
-
[SENTRY_OP]: GENERAL_FUNCTION_SPAN_OP,
|
|
71
|
-
[CODE_FUNCTION_NAME]: hookName,
|
|
72
|
-
},
|
|
73
|
-
name,
|
|
74
|
-
onlyIfParent: true,
|
|
75
|
-
},
|
|
76
|
-
() => {
|
|
77
|
-
return fn(...args);
|
|
78
|
-
},
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const routeName = BaseRoute.name;
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
// @ts-expect-error TS2545 We do not need to redefine a constructor here
|
|
86
|
-
[routeName]: class extends BaseRoute {
|
|
87
|
-
public beforeModel(...args: unknown[]): void | Promise<unknown> {
|
|
88
|
-
return instrumentFunction('beforeModel', this.fullRouteName, super.beforeModel.bind(this), args, 'custom');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
public async model(...args: unknown[]): Promise<unknown> {
|
|
92
|
-
return instrumentFunction('model', this.fullRouteName, super.model.bind(this), args, 'custom');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
public afterModel(...args: unknown[]): void | Promise<unknown> {
|
|
96
|
-
return instrumentFunction('afterModel', this.fullRouteName, super.afterModel.bind(this), args, 'custom');
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public setupController(...args: unknown[]): void | Promise<unknown> {
|
|
100
|
-
return instrumentFunction(
|
|
101
|
-
'setupController',
|
|
102
|
-
this.fullRouteName,
|
|
103
|
-
super.setupController.bind(this),
|
|
104
|
-
args,
|
|
105
|
-
'custom',
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
}[routeName] as T;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export * from '@sentry/browser';
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Ember-specific browser tracing integration
|
|
116
|
-
*/
|
|
117
|
-
export { browserTracingIntegration } from './utils/browserTracingIntegration';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type ApplicationInstance from '@ember/application/instance';
|
|
2
|
-
import { instrumentForPerformance, getSentryConfig } from '../utils/performance';
|
|
3
|
-
|
|
4
|
-
export function initialize(appInstance: ApplicationInstance): void {
|
|
5
|
-
// Disable in fastboot - we only want to run Sentry client-side
|
|
6
|
-
const fastboot = appInstance.lookup('service:fastboot') as unknown as { isFastBoot: boolean } | undefined;
|
|
7
|
-
if (fastboot?.isFastBoot) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const config = getSentryConfig();
|
|
12
|
-
if (config['disablePerformance']) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Run this in the next tick to ensure the ember router etc. is properly initialized
|
|
17
|
-
instrumentForPerformance(appInstance);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default {
|
|
21
|
-
initialize,
|
|
22
|
-
name: 'sentry-performance',
|
|
23
|
-
};
|
package/addon/runloop.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Backburner } from '@ember/runloop/-private/backburner';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Backburner needs to be extended as it's missing the 'off' method.
|
|
5
|
-
*/
|
|
6
|
-
interface ExtendedBackburner extends Backburner {
|
|
7
|
-
off(...args: unknown[]): void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Runloop needs to be extended to expose backburner as suggested here:
|
|
12
|
-
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ember__runloop/ember__runloop-tests.ts#L9
|
|
13
|
-
*/
|
|
14
|
-
declare module '@ember/runloop' {
|
|
15
|
-
interface RunNamespace {
|
|
16
|
-
backburner?: ExtendedBackburner;
|
|
17
|
-
}
|
|
18
|
-
export const _backburner: ExtendedBackburner; // Ember 4.0
|
|
19
|
-
}
|
package/addon/types.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { BrowserOptions, browserTracingIntegration } from '@sentry/browser';
|
|
2
|
-
|
|
3
|
-
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0];
|
|
4
|
-
|
|
5
|
-
export type EmberSentryConfig = {
|
|
6
|
-
sentry: BrowserOptions & { browserTracingOptions?: BrowserTracingOptions };
|
|
7
|
-
transitionTimeout: number;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated This option is no longer used and will be removed in the next major version.
|
|
10
|
-
*/
|
|
11
|
-
ignoreEmberOnErrorWarning: boolean;
|
|
12
|
-
disableInstrumentComponents: boolean;
|
|
13
|
-
disablePerformance: boolean;
|
|
14
|
-
disablePostTransitionRender: boolean;
|
|
15
|
-
disableRunloopPerformance: boolean;
|
|
16
|
-
disableInitialLoadInstrumentation: boolean;
|
|
17
|
-
enableComponentDefinitions: boolean;
|
|
18
|
-
minimumRunloopQueueDuration: number;
|
|
19
|
-
minimumComponentRenderDuration: number;
|
|
20
|
-
browserTracingOptions: BrowserTracingOptions;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type OwnConfig = {
|
|
24
|
-
sentryConfig: EmberSentryConfig;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// This is private in Ember and not really exported, so we "mock" these types here.
|
|
28
|
-
export interface EmberRouterMain {
|
|
29
|
-
location: {
|
|
30
|
-
getURL?: () => string;
|
|
31
|
-
formatURL?: (url: string) => string;
|
|
32
|
-
implementation?: string;
|
|
33
|
-
rootURL: string;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type GlobalConfig = {
|
|
38
|
-
__sentryEmberConfig: EmberSentryConfig['sentry'];
|
|
39
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type ApplicationInstance from '@ember/application/instance';
|
|
2
|
-
import { _backburner, run } from '@ember/runloop';
|
|
3
|
-
import { getOwnConfig, importSync, isTesting, macroCondition } from '@embroider/macros';
|
|
4
|
-
import { getClient } from '@sentry/browser';
|
|
5
|
-
import { addIntegration, GLOBAL_OBJ } from '@sentry/core';
|
|
6
|
-
import type { ExtendedBackburner } from '@sentry/ember/runloop';
|
|
7
|
-
import type { EmberSentryConfig, GlobalConfig, OwnConfig } from '../types';
|
|
8
|
-
import type { browserTracingIntegration as browserTracingIntegrationType } from './browserTracingIntegration';
|
|
9
|
-
|
|
10
|
-
export function getSentryConfig(): EmberSentryConfig {
|
|
11
|
-
const _global = GLOBAL_OBJ as typeof GLOBAL_OBJ & GlobalConfig;
|
|
12
|
-
_global.__sentryEmberConfig = _global.__sentryEmberConfig ?? {};
|
|
13
|
-
const environmentConfig = getOwnConfig<OwnConfig>().sentryConfig;
|
|
14
|
-
if (!environmentConfig.sentry) {
|
|
15
|
-
environmentConfig.sentry = {
|
|
16
|
-
browserTracingOptions: {},
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
Object.assign(environmentConfig.sentry, _global.__sentryEmberConfig);
|
|
20
|
-
return environmentConfig;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function getBackburner(): Pick<ExtendedBackburner, 'on' | 'off'> {
|
|
24
|
-
if (_backburner) {
|
|
25
|
-
return _backburner;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if ((run as unknown as { backburner?: Pick<ExtendedBackburner, 'on' | 'off'> }).backburner) {
|
|
29
|
-
return (run as unknown as { backburner: Pick<ExtendedBackburner, 'on' | 'off'> }).backburner;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
on() {
|
|
34
|
-
// noop
|
|
35
|
-
},
|
|
36
|
-
off() {
|
|
37
|
-
// noop
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Utility to register the browser tracing integration and instrument the app instance for performance.
|
|
44
|
-
*/
|
|
45
|
-
export function instrumentForPerformance(appInstance: ApplicationInstance): void {
|
|
46
|
-
const config = getSentryConfig();
|
|
47
|
-
// Maintaining backwards compatibility with config.browserTracingOptions, but passing it with Sentry options is preferred.
|
|
48
|
-
const browserTracingOptions = config.browserTracingOptions || config.sentry.browserTracingOptions || {};
|
|
49
|
-
|
|
50
|
-
const { browserTracingIntegration } = importSync('./browserTracingIntegration') as {
|
|
51
|
-
browserTracingIntegration: typeof browserTracingIntegrationType;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const idleTimeout = config.transitionTimeout || 5000;
|
|
55
|
-
|
|
56
|
-
const emberSpecificConfig = {
|
|
57
|
-
minimumRunloopQueueDuration: config.minimumRunloopQueueDuration,
|
|
58
|
-
minimumComponentRenderDuration: config.minimumComponentRenderDuration,
|
|
59
|
-
enableComponentDefinitions: config.enableComponentDefinitions,
|
|
60
|
-
disableInitialLoadInstrumentation: config.disableInitialLoadInstrumentation,
|
|
61
|
-
disableRunloopPerformance: config.disableRunloopPerformance,
|
|
62
|
-
disableInstrumentComponents: config.disableInstrumentComponents,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const browserTracing = browserTracingIntegration({
|
|
66
|
-
appInstance,
|
|
67
|
-
idleTimeout,
|
|
68
|
-
...browserTracingOptions,
|
|
69
|
-
...emberSpecificConfig,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const client = getClient();
|
|
73
|
-
const isAlreadyInitialized = macroCondition(isTesting()) ? client?.getIntegrationByName('BrowserTracing') : false;
|
|
74
|
-
addIntegration(browserTracing);
|
|
75
|
-
|
|
76
|
-
// Ensure this is re-run in tests even if the integration is already initialized
|
|
77
|
-
if (isAlreadyInitialized && client) {
|
|
78
|
-
browserTracing.afterAllSetup?.(client);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default, initialize } from '@sentry/ember/instance-initializers/sentry-performance';
|
package/config/environment.js
DELETED
package/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type Route from '@ember/routing/route';
|
|
2
|
-
import type { BrowserOptions } from '@sentry/browser';
|
|
3
|
-
import type { Client } from '@sentry/core';
|
|
4
|
-
/**
|
|
5
|
-
* Initialize the Sentry SDK for Ember.
|
|
6
|
-
*/
|
|
7
|
-
export declare function init(_runtimeConfig?: BrowserOptions): Client | undefined;
|
|
8
|
-
type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;
|
|
9
|
-
export declare const instrumentRoutePerformance: <T extends RouteConstructor>(BaseRoute: T) => T;
|
|
10
|
-
export * from '@sentry/browser';
|
|
11
|
-
/**
|
|
12
|
-
* Ember-specific browser tracing integration
|
|
13
|
-
*/
|
|
14
|
-
export { browserTracingIntegration } from './utils/browserTracingIntegration';
|
package/index.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const crypto = require('crypto');
|
|
4
|
-
|
|
5
|
-
function readSnippet(fileName) {
|
|
6
|
-
return fs.readFileSync(`${__dirname}/vendor/${fileName}`, 'utf8');
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function hashSha256base64(string) {
|
|
10
|
-
return crypto.createHash('sha256').update(string).digest('base64');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const initialLoadHeadSnippet = readSnippet('initial-load-head.js');
|
|
14
|
-
const initialLoadBodySnippet = readSnippet('initial-load-body.js');
|
|
15
|
-
|
|
16
|
-
const initialLoadHeadSnippetHash = hashSha256base64(initialLoadHeadSnippet);
|
|
17
|
-
const initialLoadBodySnippetHash = hashSha256base64(initialLoadBodySnippet);
|
|
18
|
-
|
|
19
|
-
module.exports = {
|
|
20
|
-
name: require('./package').name,
|
|
21
|
-
options: {
|
|
22
|
-
babel: {
|
|
23
|
-
plugins: [require.resolve('ember-auto-import/babel-plugin')],
|
|
24
|
-
},
|
|
25
|
-
'@embroider/macros': {
|
|
26
|
-
setOwnConfig: {},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
included() {
|
|
31
|
-
const app = this._findHost();
|
|
32
|
-
const config = app.project.config(app.env);
|
|
33
|
-
const addonConfig = dropUndefinedKeys(config['@sentry/ember'] || {});
|
|
34
|
-
|
|
35
|
-
if (!isSerializable(addonConfig)) {
|
|
36
|
-
// eslint-disable-next-line no-console
|
|
37
|
-
console.warn(
|
|
38
|
-
`Warning: You passed a non-serializable config to \`ENV['@sentry/ember'].sentry\`.
|
|
39
|
-
Non-serializable config (e.g. RegExp, ...) can only be passed directly to \`Sentry.init()\`, which is usually defined in app/app.js.
|
|
40
|
-
The reason for this is that @embroider/macros, which is used under the hood to handle environment config, requires serializable configuration.`,
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
this.options['@embroider/macros'].setOwnConfig.sentryConfig = addonConfig;
|
|
45
|
-
|
|
46
|
-
this._super.included.apply(this, arguments);
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
contentFor(type, config) {
|
|
50
|
-
const addonConfig = config['@sentry/ember'] || {};
|
|
51
|
-
const { disablePerformance, disableInitialLoadInstrumentation } = addonConfig;
|
|
52
|
-
|
|
53
|
-
if (disablePerformance || disableInitialLoadInstrumentation) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (type === 'head') {
|
|
58
|
-
return `<script type="text/javascript">${initialLoadHeadSnippet}</script>`;
|
|
59
|
-
} else if (type === 'body-footer') {
|
|
60
|
-
return `<script type="text/javascript">${initialLoadBodySnippet}</script>`;
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
injectedScriptHashes: [initialLoadHeadSnippetHash, initialLoadBodySnippetHash],
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
function isSerializable(obj) {
|
|
68
|
-
if (isScalar(obj)) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (Array.isArray(obj)) {
|
|
73
|
-
return !obj.some(arrayItem => !isSerializable(arrayItem));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (isPlainObject(obj)) {
|
|
77
|
-
// eslint-disable-next-line guard-for-in
|
|
78
|
-
for (let property in obj) {
|
|
79
|
-
let value = obj[property];
|
|
80
|
-
if (!isSerializable(value)) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function isScalar(val) {
|
|
92
|
-
return (
|
|
93
|
-
typeof val === 'undefined' ||
|
|
94
|
-
typeof val === 'string' ||
|
|
95
|
-
typeof val === 'boolean' ||
|
|
96
|
-
typeof val === 'number' ||
|
|
97
|
-
val === null
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function isPlainObject(obj) {
|
|
102
|
-
return typeof obj === 'object' && obj.constructor === Object && obj.toString() === '[object Object]';
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function dropUndefinedKeys(obj) {
|
|
106
|
-
const newObj = {};
|
|
107
|
-
|
|
108
|
-
for (const key in obj) {
|
|
109
|
-
if (obj[key] !== undefined) {
|
|
110
|
-
newObj[key] = obj[key];
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return newObj;
|
|
115
|
-
}
|
package/runloop.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Backburner } from '@ember/runloop/-private/backburner';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Backburner needs to be extended as it's missing the 'off' method.
|
|
5
|
-
*/
|
|
6
|
-
interface ExtendedBackburner extends Backburner {
|
|
7
|
-
off(...args: unknown[]): void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Runloop needs to be extended to expose backburner as suggested here:
|
|
12
|
-
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ember__runloop/ember__runloop-tests.ts#L9
|
|
13
|
-
*/
|
|
14
|
-
declare module '@ember/runloop' {
|
|
15
|
-
interface RunNamespace {
|
|
16
|
-
backburner?: ExtendedBackburner;
|
|
17
|
-
}
|
|
18
|
-
export const _backburner: ExtendedBackburner; // Ember 4.0
|
|
19
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es2022",
|
|
5
|
-
"lib": ["DOM", "ES2022"],
|
|
6
|
-
"allowJs": true,
|
|
7
|
-
"allowSyntheticDefaultImports": true,
|
|
8
|
-
"alwaysStrict": true,
|
|
9
|
-
"strictNullChecks": true,
|
|
10
|
-
"strictPropertyInitialization": true,
|
|
11
|
-
"noEmitOnError": false,
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"experimentalDecorators": true,
|
|
14
|
-
"paths": {
|
|
15
|
-
"dummy/tests/*": ["./tests/*"],
|
|
16
|
-
"dummy/*": ["./tests/dummy/app/*", "./app/*"],
|
|
17
|
-
"@sentry/ember": ["./addon"],
|
|
18
|
-
"@sentry/ember/*": ["./addon/*"],
|
|
19
|
-
"@sentry/ember/test-support": ["./addon-test-support"],
|
|
20
|
-
"@sentry/ember/test-support/*": ["./addon-test-support/*"],
|
|
21
|
-
"*": ["./types/*"]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"include": ["app/**/*", "addon/**/*", "tests/**/*", "types/**/*", "test-support/**/*", "addon-test-support/**/*"]
|
|
25
|
-
}
|
package/types/dummy/index.d.ts
DELETED
|
File without changes
|
package/types/global.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Types for compiled templates
|
|
2
|
-
declare module '@sentry/ember/templates/*' {
|
|
3
|
-
import type { TemplateFactory } from 'htmlbars-inline-precompile';
|
|
4
|
-
const tmpl: TemplateFactory;
|
|
5
|
-
export default tmpl;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This is private as of now.
|
|
10
|
-
* See https://github.com/emberjs/ember.js/blob/master/packages/@ember/instrumentation/index.ts
|
|
11
|
-
*/
|
|
12
|
-
declare module '@ember/instrumentation' {
|
|
13
|
-
// oxlint-disable-next-line typescript/no-explicit-any
|
|
14
|
-
export function subscribe(pattern: string, object: {}): any;
|
|
15
|
-
}
|
package/types.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { BrowserOptions, browserTracingIntegration } from '@sentry/browser';
|
|
2
|
-
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0];
|
|
3
|
-
export type EmberSentryConfig = {
|
|
4
|
-
sentry: BrowserOptions & {
|
|
5
|
-
browserTracingOptions?: BrowserTracingOptions;
|
|
6
|
-
};
|
|
7
|
-
transitionTimeout: number;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated This option is no longer used and will be removed in the next major version.
|
|
10
|
-
*/
|
|
11
|
-
ignoreEmberOnErrorWarning: boolean;
|
|
12
|
-
disableInstrumentComponents: boolean;
|
|
13
|
-
disablePerformance: boolean;
|
|
14
|
-
disablePostTransitionRender: boolean;
|
|
15
|
-
disableRunloopPerformance: boolean;
|
|
16
|
-
disableInitialLoadInstrumentation: boolean;
|
|
17
|
-
enableComponentDefinitions: boolean;
|
|
18
|
-
minimumRunloopQueueDuration: number;
|
|
19
|
-
minimumComponentRenderDuration: number;
|
|
20
|
-
browserTracingOptions: BrowserTracingOptions;
|
|
21
|
-
};
|
|
22
|
-
export type OwnConfig = {
|
|
23
|
-
sentryConfig: EmberSentryConfig;
|
|
24
|
-
};
|
|
25
|
-
export interface EmberRouterMain {
|
|
26
|
-
location: {
|
|
27
|
-
getURL?: () => string;
|
|
28
|
-
formatURL?: (url: string) => string;
|
|
29
|
-
implementation?: string;
|
|
30
|
-
rootURL: string;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export type GlobalConfig = {
|
|
34
|
-
__sentryEmberConfig: EmberSentryConfig['sentry'];
|
|
35
|
-
};
|
|
36
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** This is global, so should only be run once in tests! */
|
|
2
|
-
export declare function instrumentGlobalsForPerformance(config: {
|
|
3
|
-
disableRunloopPerformance?: boolean;
|
|
4
|
-
minimumRunloopQueueDuration?: number;
|
|
5
|
-
disableInstrumentComponents?: boolean;
|
|
6
|
-
minimumComponentRenderDuration?: number;
|
|
7
|
-
enableComponentDefinitions?: boolean;
|
|
8
|
-
disableInitialLoadInstrumentation?: boolean;
|
|
9
|
-
}): void;
|
package/utils/performance.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type ApplicationInstance from '@ember/application/instance';
|
|
2
|
-
import type { ExtendedBackburner } from '@sentry/ember/runloop';
|
|
3
|
-
import type { EmberSentryConfig } from '../types';
|
|
4
|
-
export declare function getSentryConfig(): EmberSentryConfig;
|
|
5
|
-
export declare function getBackburner(): Pick<ExtendedBackburner, 'on' | 'off'>;
|
|
6
|
-
/**
|
|
7
|
-
* Utility to register the browser tracing integration and instrument the app instance for performance.
|
|
8
|
-
*/
|
|
9
|
-
export declare function instrumentForPerformance(appInstance: ApplicationInstance): void;
|