@sentry/ember 11.0.0-alpha.1 → 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.
Files changed (46) hide show
  1. package/README.md +97 -115
  2. package/addon-main.cjs +4 -0
  3. package/declarations/index.d.ts +10 -0
  4. package/declarations/index.d.ts.map +1 -0
  5. package/declarations/init.d.ts +23 -0
  6. package/declarations/init.d.ts.map +1 -0
  7. package/{utils → declarations/utils}/browserTracingIntegration.d.ts +7 -2
  8. package/declarations/utils/browserTracingIntegration.d.ts.map +1 -0
  9. package/{utils → declarations/utils}/instrumentEmberAppInstanceForPerformance.d.ts +11 -3
  10. package/declarations/utils/instrumentEmberAppInstanceForPerformance.d.ts.map +1 -0
  11. package/{utils → declarations/utils}/instrumentEmberGlobals.d.ts +1 -0
  12. package/declarations/utils/instrumentEmberGlobals.d.ts.map +1 -0
  13. package/declarations/utils/instrumentRoutePerformance.d.ts +28 -0
  14. package/declarations/utils/instrumentRoutePerformance.d.ts.map +1 -0
  15. package/declarations/utils/utils.d.ts +7 -0
  16. package/declarations/utils/utils.d.ts.map +1 -0
  17. package/dist/index.js +569 -0
  18. package/dist/index.js.map +1 -0
  19. package/package.json +74 -71
  20. package/src/index.ts +13 -0
  21. package/src/init.ts +32 -0
  22. package/{addon → src}/utils/browserTracingIntegration.ts +40 -30
  23. package/{addon → src}/utils/instrumentEmberAppInstanceForPerformance.ts +180 -141
  24. package/{addon → src}/utils/instrumentEmberGlobals.ts +17 -16
  25. package/src/utils/instrumentRoutePerformance.ts +79 -0
  26. package/src/utils/utils.ts +25 -0
  27. package/.oxlintrc.json +0 -13
  28. package/LICENSE +0 -21
  29. package/addon/index.ts +0 -117
  30. package/addon/instance-initializers/sentry-performance.ts +0 -23
  31. package/addon/runloop.d.ts +0 -19
  32. package/addon/types.ts +0 -39
  33. package/addon/utils/performance.ts +0 -80
  34. package/app/instance-initializers/sentry-performance.js +0 -1
  35. package/config/environment.js +0 -5
  36. package/index.d.ts +0 -14
  37. package/index.js +0 -115
  38. package/instance-initializers/sentry-performance.d.ts +0 -7
  39. package/runloop.d.ts +0 -19
  40. package/tsconfig.json +0 -25
  41. package/types/dummy/index.d.ts +0 -0
  42. package/types/global.d.ts +0 -15
  43. package/types.d.ts +0 -36
  44. package/utils/performance.d.ts +0 -9
  45. package/vendor/initial-load-body.js +0 -3
  46. package/vendor/initial-load-head.js +0 -3
package/package.json CHANGED
@@ -1,96 +1,99 @@
1
1
  {
2
2
  "name": "@sentry/ember",
3
- "version": "11.0.0-alpha.1",
3
+ "version": "11.0.0-alpha.2",
4
4
  "description": "Official Sentry SDK for Ember.js",
5
- "repository": "git://github.com/getsentry/sentry-javascript.git",
6
- "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/ember",
7
- "author": "Sentry",
8
- "license": "MIT",
9
5
  "keywords": [
10
6
  "ember-addon"
11
7
  ],
12
- "publishConfig": {
13
- "access": "public"
8
+ "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/ember",
9
+ "repository": "git://github.com/getsentry/sentry-javascript.git",
10
+ "license": "MIT",
11
+ "author": "Sentry",
12
+ "imports": {
13
+ "#src/*": "./src/*"
14
14
  },
15
- "directories": {
16
- "doc": "doc",
17
- "test": "tests"
15
+ "exports": {
16
+ ".": {
17
+ "types": "./declarations/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./addon-main.js": "./addon-main.cjs"
18
21
  },
22
+ "files": [
23
+ "addon-main.cjs",
24
+ "declarations",
25
+ "dist",
26
+ "src"
27
+ ],
19
28
  "scripts": {
20
- "build:tarball": "ember ts:precompile && npm pack && ember ts:clean",
21
- "clean": "yarn rimraf sentry-ember-*.tgz dist tmp build .node_modules.ember-try package.json.ember-try instance-initializers index.d.ts runloop.d.ts types.d.ts",
22
- "lint": "run-p lint:js lint:hbs lint:ts",
23
- "lint:hbs": "ember-template-lint .",
24
- "lint:js": "oxlint . --type-aware",
25
- "lint:ts": "tsc",
29
+ "build": "rollup --config",
30
+ "build:dev": "yarn build",
31
+ "build:tarball": "npm pack",
32
+ "build:watch": "rollup --config --watch",
33
+ "circularDepCheck": "madge --circular src/index.ts",
34
+ "clean": "rimraf dist declarations *.tgz .turbo",
26
35
  "lint:fix": "oxlint . --fix --type-aware",
27
- "start": "ember serve",
28
- "test": "ember b --prod && ember test",
29
- "prepack": "ember ts:precompile",
30
- "postpack": "ember ts:clean"
36
+ "lint": "oxlint . --type-aware",
37
+ "lint:types": "oxlint src --type-aware --type-check",
38
+ "prepack": "rollup --config",
39
+ "test": "yarn test:unit",
40
+ "test:unit": "vitest run",
41
+ "test:unit:watch": "vitest --watch",
42
+ "yalc:publish": "yalc publish --push --sig"
31
43
  },
32
44
  "dependencies": {
33
- "@babel/core": "^7.29.6",
34
- "@embroider/macros": "^1.16.0",
35
- "@sentry/browser": "11.0.0-alpha.1",
36
- "@sentry/core": "11.0.0-alpha.1",
37
- "@sentry/conventions": "^0.19.0",
38
- "ember-auto-import": "^2.7.2",
39
- "ember-cli-babel": "^8.2.0",
40
- "ember-cli-htmlbars": "^6.1.1",
41
- "ember-cli-typescript": "^5.3.0"
42
- },
43
- "peerDependencies": {
44
- "ember-cli": ">=4"
45
- },
46
- "peerDependenciesMeta": {
47
- "ember-cli": {
48
- "optional": true
49
- }
45
+ "@embroider/addon-shim": "^1.10.2",
46
+ "@embroider/macros": "^1.20.2",
47
+ "@sentry/browser": "11.0.0-alpha.2",
48
+ "@sentry/conventions": "^0.20.0",
49
+ "@sentry/core": "11.0.0-alpha.2",
50
+ "decorator-transforms": "^2.3.2"
50
51
  },
51
52
  "devDependencies": {
52
- "@ember/optional-features": "~1.3.0",
53
- "@ember/test-helpers": "4.0.4",
54
- "@embroider/test-setup": "~4.0.0",
55
- "@glimmer/component": "~1.1.2",
56
- "@glimmer/tracking": "~1.1.2",
57
- "@types/ember": "~3.16.5",
58
- "@types/ember-resolver": "5.0.13",
59
- "@types/ember__debug": "^4.0.8",
60
- "@types/qunit": "~2.19.11",
61
- "@types/rsvp": "~4.0.9",
62
- "babel-eslint": "~10.1.0",
63
- "broccoli-asset-rev": "~3.0.0",
64
- "ember-cli": "~4.12.3",
65
- "ember-cli-dependency-checker": "~3.3.2",
66
- "ember-cli-inject-live-reload": "~2.1.0",
67
- "ember-cli-terser": "~4.0.2",
68
- "ember-load-initializers": "~2.1.1",
69
- "ember-qunit": "~8.1.0",
70
- "ember-resolver": "13.1.1",
71
- "ember-sinon-qunit": "7.5.0",
72
- "ember-source": "~4.12.4",
73
- "ember-template-lint": "~4.16.1",
74
- "eslint-plugin-ember": "11.9.0",
75
- "eslint-plugin-n": "15.0.0",
76
- "eslint-plugin-qunit": "8.0.0",
77
- "loader.js": "~4.7.0",
78
- "qunit": "~2.22.0",
79
- "qunit-dom": "~3.5.0",
80
- "sinon": "21.0.1",
81
- "typescript": "~5.8.0",
82
- "webpack": "~5.104.1"
53
+ "@babel/core": "^7.29.0",
54
+ "@babel/eslint-parser": "^7.28.6",
55
+ "@babel/plugin-transform-typescript": "^7.28.6",
56
+ "@ember/app-tsconfig": "^2.0.0",
57
+ "@ember/library-tsconfig": "^2.0.0",
58
+ "@embroider/addon-dev": "^8.3.0",
59
+ "@embroider/compat": "^4.1.17",
60
+ "@embroider/core": "^4.4.7",
61
+ "@embroider/vite": "^1.7.2",
62
+ "@glint/ember-tsc": "^1.5.0",
63
+ "@rollup/plugin-babel": "^7.0.0",
64
+ "ember-source": "^6.12.0",
65
+ "typescript": "~5.8.0"
83
66
  },
84
67
  "engines": {
85
68
  "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0"
86
69
  },
70
+ "volta": {
71
+ "extends": "../../package.json"
72
+ },
73
+ "publishConfig": {
74
+ "access": "public"
75
+ },
87
76
  "ember": {
88
77
  "edition": "octane"
89
78
  },
90
79
  "ember-addon": {
91
- "configPath": "tests/dummy/config"
80
+ "version": 2,
81
+ "type": "addon",
82
+ "main": "addon-main.cjs"
92
83
  },
93
- "volta": {
94
- "extends": "../../package.json"
84
+ "nx": {
85
+ "targets": {
86
+ "build:transpile": {
87
+ "dependsOn": [
88
+ "^build:transpile",
89
+ "^build:types"
90
+ ],
91
+ "outputs": [
92
+ "{projectRoot}/dist",
93
+ "{projectRoot}/**/*.d.ts",
94
+ "{projectRoot}/declarations/*.d.ts.map"
95
+ ]
96
+ }
97
+ }
95
98
  }
96
99
  }
package/src/index.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @sentry/ember - Official Sentry SDK for Ember.js
3
+ *
4
+ * @see {@link https://docs.sentry.io/platforms/javascript/guides/ember/ Sentry Ember Documentation}
5
+ */
6
+
7
+ // Re-export everything from @sentry/browser
8
+ export * from '@sentry/browser';
9
+
10
+ // Sentry-specific utilities
11
+ export { init } from './init.ts';
12
+ export { instrumentRoutePerformance } from './utils/instrumentRoutePerformance.ts';
13
+ export { browserTracingIntegration, instrumentAppInstancePerformance } from './utils/browserTracingIntegration.ts';
package/src/init.ts ADDED
@@ -0,0 +1,32 @@
1
+ import * as Sentry from '@sentry/browser';
2
+ import { applySdkMetadata } from '@sentry/core';
3
+
4
+ import type { BrowserOptions } from '@sentry/browser';
5
+ import type { Client } from '@sentry/core';
6
+
7
+ /**
8
+ * Initialize the Sentry SDK for Ember.
9
+ *
10
+ * This should be called early in your application's startup, typically in app/app.ts
11
+ * before your Application class is defined.
12
+ *
13
+ * @param config - Sentry browser options
14
+ * @returns The Sentry client instance
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import * as Sentry from '@sentry/ember';
19
+ *
20
+ * Sentry.init({
21
+ * dsn: 'YOUR_DSN_HERE',
22
+ * tracesSampleRate: 1.0,
23
+ * });
24
+ * ```
25
+ */
26
+ export function init(config?: BrowserOptions): Client | undefined {
27
+ const initConfig = { ...config };
28
+
29
+ applySdkMetadata(initConfig, 'ember');
30
+
31
+ return Sentry.init(initConfig);
32
+ }
@@ -1,17 +1,17 @@
1
1
  import {
2
+ addIntegration,
2
3
  browserTracingIntegration as originalBrowserTracingIntegration,
3
4
  startBrowserTracingNavigationSpan,
4
5
  startBrowserTracingPageLoadSpan,
5
6
  } from '@sentry/browser';
6
- import { consoleSandbox, type Integration } from '@sentry/core';
7
+ import type { Integration } from '@sentry/core';
7
8
  import type ApplicationInstance from '@ember/application/instance';
8
- import { instrumentEmberAppInstanceForPerformance } from './instrumentEmberAppInstanceForPerformance';
9
- import { instrumentGlobalsForPerformance } from './instrumentEmberGlobals';
9
+ import { instrumentEmberAppInstanceForPerformance } from './instrumentEmberAppInstanceForPerformance.ts';
10
+ import { instrumentGlobalsForPerformance } from './instrumentEmberGlobals.ts';
10
11
  import { isTesting, macroCondition } from '@embroider/macros';
11
12
 
12
13
  type EmberBrowserTracingIntegrationOptions = Parameters<typeof originalBrowserTracingIntegration>[0] & {
13
- // TODO(v11): make this required
14
- appInstance?: ApplicationInstance;
14
+ appInstance: ApplicationInstance;
15
15
  disableRunloopPerformance?: boolean;
16
16
  minimumRunloopQueueDuration?: number;
17
17
  disableInstrumentComponents?: boolean;
@@ -54,34 +54,44 @@ export function browserTracingIntegration(options: EmberBrowserTracingIntegratio
54
54
  afterAllSetup(client) {
55
55
  integration.afterAllSetup(client);
56
56
 
57
- // Run this in the next tick to ensure the ember router etc. is properly initialized
57
+ instrumentEmberAppInstanceForPerformance(
58
+ client,
59
+ appInstance,
60
+ appInstancePerformanceConfig,
61
+ startBrowserTracingPageLoadSpan,
62
+ startBrowserTracingNavigationSpan,
63
+ );
58
64
 
59
- setTimeout(() => {
60
- if (appInstance) {
61
- instrumentEmberAppInstanceForPerformance(
62
- client,
63
- appInstance,
64
- appInstancePerformanceConfig,
65
- startBrowserTracingPageLoadSpan,
66
- startBrowserTracingNavigationSpan,
67
- );
68
- } else {
69
- consoleSandbox(() => {
70
- // eslint-disable-next-line no-console
71
- console.warn('Skipping router instrumentation because appInstance is not provided.');
72
- });
65
+ // We only want to run this once in tests!
66
+ if (macroCondition(isTesting())) {
67
+ if (_initialized) {
68
+ return;
73
69
  }
70
+ }
74
71
 
75
- // We only want to run this once in tests!
76
- if (macroCondition(isTesting())) {
77
- if (_initialized) {
78
- return;
79
- }
80
- }
81
-
82
- instrumentGlobalsForPerformance(globalsPerformanceConfig);
83
- _initialized = true;
84
- });
72
+ instrumentGlobalsForPerformance(globalsPerformanceConfig);
73
+ _initialized = true;
85
74
  },
86
75
  };
87
76
  }
77
+
78
+ /**
79
+ * Utility to simplify adding the browser tracing integration to an app instance.
80
+ */
81
+ export function instrumentAppInstancePerformance(
82
+ appInstance: ApplicationInstance,
83
+ options?: Partial<Parameters<typeof browserTracingIntegration>[0]>,
84
+ ): void {
85
+ // Disable in FastBoot — we only want to run Sentry client-side
86
+ const fastboot = appInstance.lookup('service:fastboot') as { isFastBoot: boolean } | undefined;
87
+ if (fastboot?.isFastBoot) {
88
+ return;
89
+ }
90
+
91
+ addIntegration(
92
+ browserTracingIntegration({
93
+ ...options,
94
+ appInstance,
95
+ }),
96
+ );
97
+ }