getsentry / getsentry/sentry-javascript

Restructure core package in v11

Ouverte
#20,995 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
javascript
Langage dominant
TypeScript
Étoiles
8.7k
Forks
1.8k
Merge moyen
1 j 17 h
PR mergées (30 j)
515

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.