@sentry/ember 7.16.0 → 7.17.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.
package/LICENSE CHANGED
@@ -1,9 +1,14 @@
1
- The MIT License (MIT)
1
+ Copyright (c) 2020 Sentry (https://sentry.io) and individual contributors. All rights reserved.
2
2
 
3
- Copyright (c) 2020, Sentry
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
5
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
6
+ persons to whom the Software is furnished to do so, subject to the following conditions:
4
7
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
9
+ Software.
6
10
 
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
13
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -172,7 +172,8 @@ ENV['@sentry/ember'] = {
172
172
 
173
173
  ### Supported Versions
174
174
 
175
- `@sentry/ember` currently supports Ember **4.0+** for error monitoring.
175
+ * **Ember.js**: v4.0 or above
176
+ * **Node**: v14 or above
176
177
 
177
178
  ### Previous Integration
178
179
 
@@ -1,6 +1,6 @@
1
1
  import ApplicationInstance from '@ember/application/instance';
2
- import Ember from 'ember';
3
2
  import { run, _backburner, scheduleOnce } from '@ember/runloop';
3
+ import { subscribe } from '@ember/instrumentation';
4
4
  import * as Sentry from '@sentry/browser';
5
5
  import { ExtendedBackburner } from '@sentry/ember/runloop';
6
6
  import { Span, Transaction, Integration } from '@sentry/types';
@@ -9,6 +9,7 @@ import { getActiveTransaction } from '..';
9
9
  import { browserPerformanceTimeOrigin, GLOBAL_OBJ, timestampWithMs } from '@sentry/utils';
10
10
  import { macroCondition, isTesting, getOwnConfig } from '@embroider/macros';
11
11
  import { EmberSentryConfig, GlobalConfig, OwnConfig } from '../types';
12
+ import RouterService from '@ember/routing/router-service';
12
13
 
13
14
  function getSentryConfig() {
14
15
  const _global = GLOBAL_OBJ as typeof GLOBAL_OBJ & GlobalConfig;
@@ -279,7 +280,6 @@ function _instrumentComponents(config: EmberSentryConfig) {
279
280
  const beforeEntries = {} as RenderEntries;
280
281
  const beforeComponentDefinitionEntries = {} as RenderEntries;
281
282
 
282
- const subscribe = Ember.subscribe;
283
283
  function _subscribeToRenderEvents() {
284
284
  subscribe('render.component', {
285
285
  before(_name: string, _timestamp: number, payload: Payload) {
@@ -309,13 +309,14 @@ function _instrumentInitialLoad(config: EmberSentryConfig) {
309
309
  const startName = '@sentry/ember:initial-load-start';
310
310
  const endName = '@sentry/ember:initial-load-end';
311
311
 
312
- const { performance } = window;
313
- const HAS_PERFORMANCE = performance && performance.clearMarks && performance.clearMeasures;
312
+ let { HAS_PERFORMANCE, HAS_PERFORMANCE_TIMING } = _hasPerformanceSupport();
314
313
 
315
314
  if (!HAS_PERFORMANCE) {
316
315
  return;
317
316
  }
318
317
 
318
+ const { performance } = window;
319
+
319
320
  if (config.disableInitialLoadInstrumentation) {
320
321
  performance.clearMarks(startName);
321
322
  performance.clearMarks(endName);
@@ -323,8 +324,6 @@ function _instrumentInitialLoad(config: EmberSentryConfig) {
323
324
  }
324
325
 
325
326
  // Split performance check in two so clearMarks still happens even if timeOrigin isn't available.
326
- const HAS_PERFORMANCE_TIMING =
327
- performance.measure && performance.getEntriesByName && browserPerformanceTimeOrigin !== undefined;
328
327
  if (!HAS_PERFORMANCE_TIMING) {
329
328
  return;
330
329
  }
@@ -355,6 +354,26 @@ function _instrumentInitialLoad(config: EmberSentryConfig) {
355
354
  performance.clearMeasures(measureName);
356
355
  }
357
356
 
357
+ function _hasPerformanceSupport() {
358
+ // TS says that all of these methods are always available, but some of them may not be supported in older browsers
359
+ // So we "pretend" they are all optional in order to be able to check this properly without TS complaining
360
+ const _performance = window.performance as {
361
+ clearMarks?: Performance['clearMarks'];
362
+ clearMeasures?: Performance['clearMeasures'];
363
+ measure?: Performance['measure'];
364
+ getEntriesByName?: Performance['getEntriesByName'];
365
+ };
366
+ const HAS_PERFORMANCE = Boolean(_performance && _performance.clearMarks && _performance.clearMeasures);
367
+ const HAS_PERFORMANCE_TIMING = Boolean(
368
+ _performance.measure && _performance.getEntriesByName && browserPerformanceTimeOrigin !== undefined,
369
+ );
370
+
371
+ return {
372
+ HAS_PERFORMANCE,
373
+ HAS_PERFORMANCE_TIMING,
374
+ };
375
+ }
376
+
358
377
  export async function instrumentForPerformance(appInstance: ApplicationInstance) {
359
378
  const config = getSentryConfig();
360
379
  const sentryConfig = config.sentry;
@@ -372,7 +391,9 @@ export async function instrumentForPerformance(appInstance: ApplicationInstance)
372
391
  new tracing.Integrations.BrowserTracing({
373
392
  routingInstrumentation: (customStartTransaction, startTransactionOnPageLoad) => {
374
393
  const routerMain = appInstance.lookup('router:main');
375
- let routerService = appInstance.lookup('service:router');
394
+ let routerService = appInstance.lookup('service:router') as
395
+ | RouterService & { externalRouter?: RouterService; _hasMountedSentryPerformanceRouting?: boolean };
396
+
376
397
  if (routerService.externalRouter) {
377
398
  // Using ember-engines-router-service in an engine.
378
399
  routerService = routerService.externalRouter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/ember",
3
- "version": "7.16.0",
3
+ "version": "7.17.0",
4
4
  "description": "Official Sentry SDK for Ember.js",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/ember",
@@ -21,64 +21,68 @@
21
21
  "build:extras": "yarn build",
22
22
  "build:npm": "ember ts:precompile && npm pack && ember ts:clean",
23
23
  "clean": "yarn rimraf sentry-ember-*.tgz",
24
- "lint": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*",
24
+ "lint": "run-p lint:js lint:hbs lint:ts",
25
25
  "lint:hbs": "ember-template-lint .",
26
26
  "lint:js": "eslint . --cache --cache-location '../../eslintcache/'",
27
+ "lint:ts": "tsc",
27
28
  "start": "ember serve",
28
- "test": "ember try:each",
29
- "test:all": "node ./scripts/run-CI-tests.js"
29
+ "test": "ember test",
30
+ "test:all": "ember try:each"
30
31
  },
31
32
  "dependencies": {
32
- "@embroider/macros": "1.8.3",
33
- "@sentry/browser": "7.16.0",
34
- "@sentry/tracing": "7.16.0",
35
- "@sentry/types": "7.16.0",
36
- "@sentry/utils": "7.16.0",
37
- "ember-auto-import": "~1.12.1 || ~2.2.0",
38
- "ember-cli-babel": "~7.26.6",
39
- "ember-cli-htmlbars": "^6.0.1",
40
- "ember-cli-typescript": "^4.2.1"
33
+ "@embroider/macros": "^1.9.0",
34
+ "@sentry/browser": "7.17.0",
35
+ "@sentry/tracing": "7.17.0",
36
+ "@sentry/types": "7.17.0",
37
+ "@sentry/utils": "7.17.0",
38
+ "ember-auto-import": "^1.12.1 || ^2.4.3",
39
+ "ember-cli-babel": "^7.26.11",
40
+ "ember-cli-htmlbars": "^6.1.1",
41
+ "ember-cli-typescript": "^5.1.1"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@ember/optional-features": "~1.3.0",
44
- "@embroider/test-setup": "~0.47.2",
45
- "@glimmer/component": "~1.0.0",
46
- "@glimmer/tracking": "~1.0.0",
45
+ "@ember/test-helpers": "~2.8.1",
46
+ "@embroider/test-setup": "~1.8.3",
47
+ "@glimmer/component": "~1.1.2",
48
+ "@glimmer/tracking": "~1.1.2",
47
49
  "@types/ember": "~3.16.5",
48
50
  "@types/ember-qunit": "~3.4.9",
49
51
  "@types/ember__debug": "^3.16.5",
50
52
  "@types/ember__test-helpers": "~1.7.0",
51
53
  "@types/qunit": "~2.9.1",
52
54
  "@types/rsvp": "~4.0.3",
53
- "babel-eslint": "^10.1.0",
55
+ "babel-eslint": "~10.1.0",
54
56
  "broccoli-asset-rev": "~3.0.0",
55
- "ember-cli": "~3.24.0",
56
- "ember-cli-dependency-checker": "~3.2.0",
57
- "ember-cli-inject-live-reload": "~2.0.2",
57
+ "ember-cli": "~4.8.0",
58
+ "ember-cli-dependency-checker": "~3.3.1",
59
+ "ember-cli-inject-live-reload": "~2.1.0",
58
60
  "ember-cli-sri": "~2.1.1",
59
61
  "ember-cli-typescript-blueprints": "~3.0.0",
60
62
  "ember-cli-uglify": "~3.0.0",
61
63
  "ember-disable-prototype-extensions": "~1.1.3",
62
- "ember-export-application-global": "~2.0.1",
63
64
  "ember-load-initializers": "~2.1.1",
64
- "ember-maybe-import-regenerator": "~0.1.6",
65
- "ember-qunit": "~4.6.0",
66
- "ember-resolver": "~8.0.0",
67
- "ember-sinon-qunit": "~5.0.0",
68
- "ember-source": "~3.20.0",
65
+ "ember-maybe-import-regenerator": "~1.0.0",
66
+ "ember-qunit": "~6.0.0",
67
+ "ember-resolver": "~8.0.3",
68
+ "ember-sinon-qunit": "~6.0.0",
69
+ "ember-source": "~4.8.0",
69
70
  "ember-source-channel-url": "~2.0.1",
70
- "ember-template-lint": "~2.9.1",
71
- "ember-test-selectors": "~5.5.0",
72
- "ember-try": "~1.4.0",
73
- "ember-window-mock": "~0.7.1",
74
- "eslint-plugin-ember": "~8.6.0",
75
- "eslint-plugin-node": "^11.1.0",
71
+ "ember-template-lint": "~4.16.1",
72
+ "ember-test-selectors": "~6.0.0",
73
+ "ember-try": "~2.0.0",
74
+ "ember-window-mock": "~0.8.1",
75
+ "eslint-plugin-ember": "~11.1.0",
76
+ "eslint-plugin-node": "~11.1.0",
77
+ "eslint-plugin-qunit": "~7.3.1",
76
78
  "loader.js": "~4.7.0",
77
- "qunit-dom": "~1.2.0",
78
- "webpack": "^5.65.0"
79
+ "qunit": "~2.19.2",
80
+ "qunit-dom": "~2.0.0",
81
+ "typescript": "~4.5.2",
82
+ "webpack": "~5.74.0"
79
83
  },
80
84
  "engines": {
81
- "node": "10.* || >= 12"
85
+ "node": "14.* || 16.* || >= 18"
82
86
  },
83
87
  "ember": {
84
88
  "edition": "octane"
@@ -87,7 +91,6 @@
87
91
  "configPath": "tests/dummy/config"
88
92
  },
89
93
  "volta": {
90
- "node": "14.15.4",
91
- "yarn": "1.22.5"
94
+ "extends": "../../package.json"
92
95
  }
93
96
  }
package/types/global.d.ts CHANGED
@@ -4,3 +4,11 @@ declare module '@sentry/ember/templates/*' {
4
4
  const tmpl: TemplateFactory;
5
5
  export default tmpl;
6
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
+ export function subscribe(pattern: string, object: {}): any;
14
+ }
package/addon/ember.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import Ember from 'ember';
2
- declare module 'ember' {
3
- namespace Ember {
4
- export function subscribe(pattern: string, object: {}): any;
5
- }
6
- }
package/ember.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import Ember from 'ember';
2
- declare module 'ember' {
3
- namespace Ember {
4
- export function subscribe(pattern: string, object: {}): any;
5
- }
6
- }
@@ -1,17 +0,0 @@
1
- /*eslint-env node*/
2
- const { spawnSync } = require('child_process');
3
-
4
- console.log('Mimicking the CI environment in order to run tests against multiple versions of Ember');
5
-
6
- const result = spawnSync('yarn test', {
7
- shell: true,
8
- stdio: 'inherit',
9
- env: {
10
- ...process.env,
11
- GITHUB_ACTIONS: true,
12
- GITHUB_EVENT_NAME: 'push',
13
- GITHUB_HEAD_REF: 'master',
14
- },
15
- });
16
-
17
- process.exit(result.status);