getsentry / getsentry/sentry-javascript

Restructure core package in v11

Aperta
#20,995 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
javascript
Lingua principale
TypeScript
Stelle
8.7k
Fork
1.8k
Merge medio
1g 17h
PR unite (30g)
515

Descrizione

Today, we have three export paths in the core package:

* `@sentry/core` exports everything
* `@sentry/core/browser` exports everything that works in browser runtimes
* `@sentry/core/server` exports everything that works in server runtimes

This has two main downsides:

1. ambiguous where to import from, auto complete may pick stuff from anywhere?
2. In meta frameworks, you are forced to use `@sentry/core` anyhow as you do not know which runtime this may run in.

Because of this, I propose to restructure this a bit in v11:

* `@sentry/core` contains *only* isomorphic exports that work everywhere
* `@sentry/core/browser` contains *only* browser-specific exports (so not the things contained in `@sentry/core`)
* `@sentry/core/server` contains *only* server-specific exports.

I would also propose to move files in the core package to match this, e.g. have the following layout:

* packages/core/src
* browser/
* server/
* … other general stuff here

to make it easier to grok this.

This also makes it easier to know what can be safely used in metaframework code, as generally you should only use core APIs there when you cannot be sure in what runtime something is running etc.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.