getsentry / getsentry/sentry-javascript

Restructure core package in v11

Đang mở
#20,995 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
javascript
Ngôn ngữ chính
TypeScript
Star
8.7k
Fork
1.8k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
515

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.