Skip to content

Commit 129c3c6

Browse files
committed
build(angular): Use the Angular compiler to compile the @sentry/angular SDK (WEB-622)
Switch to the Angular compiler (via Angular CLI) to ensure that all Angular 1st-class support items of the SDK are compiled in a way that the library are compatible with Angular. This fixes the compilation errors when using `TraceDirective` and `TraceModule` that are currently thrown on application compilation. Uses the Angular 10 compiler which ensures compatibility with Angular 10-13 apps. FIXES GH-3282 FIXES WEB-622
1 parent 21ae9f7 commit 129c3c6

23 files changed

+6783
-4093
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
},
2929
"workspaces": [
3030
"packages/angular",
31+
"packages/angularNew",
32+
"packages/angularNew10",
3133
"packages/browser",
3234
"packages/core",
3335
"packages/ember",
@@ -67,7 +69,7 @@
6769
"jest": "^24.9.0",
6870
"karma-browserstack-launcher": "^1.5.1",
6971
"karma-firefox-launcher": "^1.1.0",
70-
"lerna": "3.13.4",
72+
"lerna": "^3.13.4",
7173
"madge": "4.0.2",
7274
"mocha": "^6.1.4",
7375
"npm-run-all": "^4.1.5",

packages/angular/.npmignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/angular/LICENSE

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/angular/angular.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "../.././node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"sentry-angular": {
7+
"projectType": "library",
8+
"root": "lib",
9+
"sourceRoot": "lib/src",
10+
"prefix": "lib",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-angular:ng-packagr",
14+
"options": {
15+
"tsConfig": "lib/tsconfig.lib.json",
16+
"project": "lib/ng-package.json"
17+
},
18+
"configurations": {
19+
"production": {
20+
"tsConfig": "lib/tsconfig.lib.prod.json"
21+
}
22+
}
23+
}
24+
}
25+
}},
26+
"defaultProject": "sentry-angular"
27+
}

packages/angular/lib/ng-package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "../node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "../dist",
4+
"lib": {
5+
"entryFile": "src/index.ts",
6+
"umdModuleIds": {
7+
"@sentry/browser": "Sentry",
8+
"@sentry/utils": "utils"
9+
}
10+
},
11+
"whitelistedNonPeerDependencies": [
12+
"@sentry/browser",
13+
"@sentry/utils",
14+
"@sentry/types",
15+
"tslib"
16+
],
17+
"assets": ["README.md"]
18+
}

packages/angular/lib/package.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "@sentry/angular",
3+
"version": "6.18.0",
4+
"description": "Official Sentry SDK for Angular",
5+
"repository": "git://github.com/getsentry/sentry-javascript.git",
6+
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/angular",
7+
"author": "Sentry",
8+
"license": "MIT",
9+
"engines": {
10+
"node": ">=6"
11+
},
12+
"main": "dist/index.js",
13+
"module": "esm/index.js",
14+
"types": "dist/index.d.ts",
15+
"publishConfig": {
16+
"access": "public"
17+
},
18+
"peerDependencies": {
19+
"@angular/common": "10.x || 11.x || 12.x || 13.x",
20+
"@angular/core": "10.x || 11.x || 12.x || 13.x",
21+
"@angular/router": "10.x || 11.x || 12.x || 13.x"
22+
},
23+
"dependencies": {
24+
"@sentry/browser": "6.18.0",
25+
"@sentry/types": "6.18.0",
26+
"@sentry/utils": "6.18.0",
27+
"tslib": "^2.0.0"
28+
}
29+
}

packages/angular/src/errorhandler.ts renamed to packages/angular/lib/src/errorhandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { HttpErrorResponse } from '@angular/common/http';
2-
import { ErrorHandler as AngularErrorHandler, Injectable } from '@angular/core';
2+
import { ErrorHandler as AngularErrorHandler, Inject, Injectable } from '@angular/core';
33
import * as Sentry from '@sentry/browser';
44

55
import { runOutsideAngular } from './zone';
@@ -26,7 +26,7 @@ export interface ErrorHandlerOptions {
2626
class SentryErrorHandler implements AngularErrorHandler {
2727
protected readonly _options: ErrorHandlerOptions;
2828

29-
public constructor(options?: ErrorHandlerOptions) {
29+
public constructor(@Inject('errorHandlerOptions') options?: ErrorHandlerOptions) {
3030
this._options = {
3131
logErrors: true,
3232
...options,
File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/*
2+
* Public API Surface of angular
3+
*/
4+

0 commit comments

Comments
 (0)