René's URL Explorer Experiment


Title: Use the Angular compiler to compile @sentry/angular · Issue #4644 · getsentry/sentry-javascript · GitHub

Open Graph Title: Use the Angular compiler to compile @sentry/angular · Issue #4644 · getsentry/sentry-javascript

X Title: Use the Angular compiler to compile @sentry/angular · Issue #4644 · getsentry/sentry-javascript

Description: Problem Statement As initially brought up in #3282, our Angular SDK currently causes a compiler error at application build time when TraceDirective or TraceModule are imported and used to trace the initialization spans of (custom) Angula...

Open Graph Description: Problem Statement As initially brought up in #3282, our Angular SDK currently causes a compiler error at application build time when TraceDirective or TraceModule are imported and used to trace the...

X Description: Problem Statement As initially brought up in #3282, our Angular SDK currently causes a compiler error at application build time when TraceDirective or TraceModule are imported and used to trace the...

Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/4644

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use the Angular compiler to compile @sentry/angular","articleBody":"### Problem Statement\r\n\r\nAs initially brought up in #3282, our Angular SDK currently causes a compiler error at application build time when `TraceDirective` or `TraceModule` are imported and used to trace the initialization spans of (custom) Angular components. While working on this issue it turned out that the fix requires a change to the build procedure of our Angular SDK which will a) fix this problem but b) also allow us to support Angular better in the future. \r\n\r\nCurrently, our Angular SDK is using `tsc` as a compiler like most of our JS SDKs. With `tsc` we can compile our current Angular SDK and it detects and compiles the Angular-specific decorators as (experimental) JS decorators (they are in proposal for JS according to [TS docs](https://www.typescriptlang.org/docs/handbook/decorators.html)). During compilation they are treated like JS decorators in the generated JS. In contrast, the Angular compiler, detects Angular specific decorators and compiles them differently s.t. the information in the decorators about components, directives, pipes, etc. is understood correctly by the NG runtime. Running `ng build` or similar aot compiles projects and libraries to this Angular specific JS that’s understood by the NG runtime. \r\n\r\n### Example\r\n\r\n`TraceDirective` is an Angular directive and hence the `@Directive` decorator is used:\r\n```typescript\r\n@Directive({ selector: '[trace]' })\r\nexport class TraceDirective implements OnInit, AfterViewInit {...}\r\n``` \r\n\r\nThe `tsc`-compiled output treats the `@Directive` like a \"normal\" decorator which is not what Angular expects at application compile time (or runtime):\r\n```javascript\r\nvar TraceDirective = /** @class */ (function () {\r\n    ...\r\n    tslib_1.__decorate([\r\n        core_1.Input('trace')\r\n    ], TraceDirective.prototype, \"componentName\", void 0);\r\n    TraceDirective = tslib_1.__decorate([\r\n        core_1.Directive({ selector: '[trace]' })\r\n    ], TraceDirective);\r\n    return TraceDirective;\r\n}());\r\nexports.TraceDirective = TraceDirective;\r\n```\r\n\r\nInstead, Angular expects Angular-specific JS syntax that treats the decorators differently. This syntax is even Angular version specific, as for Angular 10 (Ivy Off):\r\n\r\n```javascript\r\nclass TraceDirective {...}\r\nTraceDirective.decorators = [\r\n    { type: Directive, args: [{ selector: '[trace]' },] }\r\n];\r\nTraceDirective.propDecorators = {\r\n    componentName: [{ type: Input, args: ['trace',] }]\r\n};\r\n```\r\n\r\nor Angular 13:\r\n```js\r\nclass TraceDirective {...}\r\nTraceDirective.ɵfac = i0.ɵɵngDeclareFactory(...);\r\nTraceDirective.ɵdir = i0.ɵɵngDeclareDirective(...);\r\ni0.ɵɵngDeclareClassMetadata(...);\r\n```\r\n\r\n### Solution Brainstorm\r\n\r\nThe solution to this problem is to use the Angular compiler instead of `tsc` to compile our Angular SDK. After a successful PoC implementation, we're currently tracking the changes required for this in PR #4641. Given that this is a rather big change to our build procedure (possibly even breaking), this will be introduced with v7. It should be noted that this change does not only fix the original bug (#3282) but it also enables us to a) support Angular better in the future (e.g. with additional directives/components/etc.) and it aligns the compilation of our SDK with the [recommendations for library creation from the Angular team](https://v10.angular.io/guide/creating-libraries). \r\n\r\nHere's what will change:\r\n* Instead of `tsc` we will use the Angular 10 CLI and `ng-packagr` to build the SDK\r\n  * The produced package conforms to the [Angular Package Format (APF) for Angular 10](https://docs.google.com/document/d/1uh2D6XqaGh2yjjXwfF4SrJqWl1MBhMPntlNBBsk6rbw/edit)\r\n  * The package will contain the ESM2015, FESM2015 and UMD JS module formats which are all required for Angular 10 libraries.\r\n  * In case an Angular application shall support ES5, the angular CLI will downlevel the ESM2015 JS to ES5 at application compile time.\r\n  * Newer versions of Angular (11-13) will use `ngcc` or the Angular linker to make the library compatible at application build time.\r\n* Due to the forward compatibility of Angular libraries, this will limit the usage of the SDK to Angular >= 10, as we will be using Angular 10 to build the SDK. This enables compatibility with Angular 10-13. \r\n  * So far we have not explicitly stated which Angular versions are supported by our SDK, although our peer dependencies also list Angular 10-13. \r\n  * Therefore, people could be using the SDK with earlier versions than Angular 10 which as a result would break their applications if they update to v7. How to procede here remains TBD but one option would be to further offer a `tsc`-compiled \"legacy\" version of the SDK for Angular \u003c10 users which will work but not support `TraceDirective` (and hence `TraceModule`).\r\n* Our Angular SDK documentation should be updated w.r.t. supported Angular versions and the usage of `TraceDirective`.","author":{"url":"https://github.com/Lms24","@type":"Person","name":"Lms24"},"datePublished":"2022-02-25T16:53:16Z","url":"https://github.com/getsentry/sentry-javascript/issues/4644"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3c1118e9-d4c6-c5f1-2254-f936e1580d29
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCAE4:CFE11:8F0CB9:C7F211:6B0428AF
html-safe-noncecd14e8d7a8f752327030b39a3aaf2112c178e62b9e9cff85c2d3a7c827cc170f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUU0OkNGRTExOjhGMENCOTpDN0YyMTE6NkIwNDI4QUYiLCJ2aXNpdG9yX2lkIjoiNTk5NjM5OTc5MzAzMzk4MDA3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac966308ce8e0ade205984a02311d1601b35966af352dca709f774fea3adb59dfd
hovercard-subject-tagissue:1150659674
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/4644/issue_layout
twitter:imagehttps://opengraph.githubassets.com/92f497fe438993f92266bf584e489595b74e42a5f51122c84696a52d37c02763/getsentry/sentry-javascript/issues/4644
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/92f497fe438993f92266bf584e489595b74e42a5f51122c84696a52d37c02763/getsentry/sentry-javascript/issues/4644
og:image:altProblem Statement As initially brought up in #3282, our Angular SDK currently causes a compiler error at application build time when TraceDirective or TraceModule are imported and used to trace the...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameLms24
hostnamegithub.com
expected-hostnamegithub.com
Noneb7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3328572
octolytics-dimension-repository_nwogetsentry/sentry-javascript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3328572
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec3dd496c3da6ea6b77e69c09279d2b81604654f1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/issues/4644#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F4644
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F4644
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/issues/4644
Reloadhttps://github.com/getsentry/sentry-javascript/issues/4644
Reloadhttps://github.com/getsentry/sentry-javascript/issues/4644
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues341 (341)https://github.com/getsentry/sentry-javascript/issues
Pull requests59 (59)https://github.com/getsentry/sentry-javascript/pulls
Discussionshttps://github.com/getsentry/sentry-javascript/discussions
Actionshttps://github.com/getsentry/sentry-javascript/actions
Security and quality7 (7)https://github.com/getsentry/sentry-javascript/security
Insightshttps://github.com/getsentry/sentry-javascript/insights
https://github.com/getsentry/sentry-javascript
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/4644
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/4644
#4641https://github.com/getsentry/sentry-javascript/pull/4641
Use the Angular compiler to compile @sentry/angularhttps://github.com/getsentry/sentry-javascript/issues/4644#top
#4641https://github.com/getsentry/sentry-javascript/pull/4641
https://github.com/Lms24
Meta: Breakinghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Meta%3A%20Breaking%22
Type: Improvementhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Type%3A%20Improvement%22
7.0.0https://github.com/getsentry/sentry-javascript/milestone/7
https://github.com/Lms24
Lms24https://github.com/Lms24
on Feb 25, 2022https://github.com/getsentry/sentry-javascript/issues/4644#issue-1150659674
#3282https://github.com/getsentry/sentry-javascript/issues/3282
TS docshttps://www.typescriptlang.org/docs/handbook/decorators.html
#4641https://github.com/getsentry/sentry-javascript/pull/4641
#3282https://github.com/getsentry/sentry-javascript/issues/3282
recommendations for library creation from the Angular teamhttps://v10.angular.io/guide/creating-libraries
Angular Package Format (APF) for Angular 10https://docs.google.com/document/d/1uh2D6XqaGh2yjjXwfF4SrJqWl1MBhMPntlNBBsk6rbw/edit
Lms24https://github.com/Lms24
Type: Improvementhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Type%3A%20Improvement%22
Meta: Breakinghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Meta%3A%20Breaking%22
on Feb 25, 2022https://github.com/getsentry/sentry-javascript/issues/4644#event-6140394657
Lms24https://github.com/Lms24
7.0.0https://github.com/getsentry/sentry-javascript/milestone/7
on Feb 25, 2022https://github.com/getsentry/sentry-javascript/issues/4644#event-6140394685
Lms24https://github.com/Lms24
on Feb 25, 2022https://github.com/getsentry/sentry-javascript/issues/4644#event-6140396273
AbhiPrasadhttps://github.com/AbhiPrasad
Status: Backloghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Backlog%22
on Feb 25, 2022https://github.com/getsentry/sentry-javascript/issues/4644#event-6140401223
https://github.com/AbhiPrasad
AbhiPrasadhttps://github.com/AbhiPrasad
on Feb 25, 2022https://github.com/getsentry/sentry-javascript/issues/4644#issuecomment-1051024124
#4240 (comment)https://github.com/getsentry/sentry-javascript/issues/4240#issuecomment-1035323682
Lms24https://github.com/Lms24
Jirahttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Jira%22
on Feb 28, 2022https://github.com/getsentry/sentry-javascript/issues/4644#event-6156235327
Lms24https://github.com/Lms24
Status: Fixedhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Fixed%22
Status: Backloghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Backlog%22
on May 4, 2022https://github.com/getsentry/sentry-javascript/issues/4644#event-6548508445
Lms24https://github.com/Lms24
completedhttps://github.com/getsentry/sentry-javascript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on May 4, 2022https://github.com/getsentry/sentry-javascript/issues/4644#event-6548509470
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-javascript/issues/4644
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/4644
Lms24https://github.com/Lms24
Meta: Breakinghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Meta%3A%20Breaking%22
Type: Improvementhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Type%3A%20Improvement%22
7.0.0https://github.com/getsentry/sentry-javascript/milestone/7
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.