getsentry / getsentry/sentry-javascript

Restructure core package in v11

Offen
#20,995 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
javascript
Vorherrschende Sprache
TypeScript
Sterne
8.7k
Forks
1.8k
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
515

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.