Skip to content

Commit 647999d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feat/separate-source-reading
2 parents 012eff3 + ff923f9 commit 647999d

File tree

100 files changed

+2000
-569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2000
-569
lines changed

.eslintrc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ module.exports = {
3333
},
3434
},
3535
{
36-
files: ["scenarios/**"],
36+
files: ['scenarios/**'],
3737
parserOptions: {
38-
sourceType: "module",
38+
sourceType: 'module',
3939
},
4040
rules: {
41-
"no-console": "off",
41+
'no-console': 'off',
4242
},
4343
},
4444
],

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ jobs:
120120
if: github.ref == 'refs/heads/master' || github.event_name == 'pull_request'
121121
with:
122122
github_token: ${{ secrets.GITHUB_TOKEN }}
123+
# see https://github.com/getsentry/size-limit-action#usage
123124
skip_step: build
124125
workflow_name: 'build'
125126

@@ -213,6 +214,10 @@ jobs:
213214
steps:
214215
- name: Check out current commit (${{ github.sha }})
215216
uses: actions/checkout@v2
217+
# TODO: removing `fetch-depth` below seems to have no effect, and the commit which added it had no description,
218+
# so it's not clear why it's necessary. That said, right now ember tests are xfail, so it's a little hard to
219+
# tell if it's safe to remove. Once ember tests are fixed, let's try again with it turned off, and if all goes
220+
# well, we can pull it out.
216221
with:
217222
fetch-depth: 0
218223
- name: Set up Node
@@ -223,7 +228,6 @@ jobs:
223228
# that. If it passes, newer versions of Node should also be fine. This saves us from having to run the Ember
224229
# tests in our Node matrix above.
225230
node-version: '10'
226-
fetch-depth: 0
227231
- name: Check dependency cache
228232
uses: actions/cache@v2
229233
with:

.github/workflows/codeql-analysis.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
# the `language` matrix defined below to confirm you have the correct set of
1010
# supported CodeQL languages.
1111
#
12-
name: "CodeQL"
12+
name: 'CodeQL'
1313

1414
on:
1515
push:
1616
branches: [ master ]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ master ]
19+
branches: [master]
2020
schedule:
2121
- cron: '40 3 * * 0'
2222

@@ -28,40 +28,40 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
language: [ 'javascript' ]
31+
language: ['javascript']
3232
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
3333
# Learn more:
3434
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
3535

3636
steps:
37-
- name: Checkout repository
38-
uses: actions/checkout@v2
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
3939

40-
# Initializes the CodeQL tools for scanning.
41-
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v1
43-
with:
44-
languages: ${{ matrix.language }}
45-
# If you wish to specify custom queries, you can do so here or in a config file.
46-
# By default, queries listed here will override any specified in a config file.
47-
# Prefix the list here with "+" to use these queries and those in the config file.
48-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
40+
# Initializes the CodeQL tools for scanning.
41+
- name: Initialize CodeQL
42+
uses: github/codeql-action/init@v1
43+
with:
44+
languages: ${{ matrix.language }}
45+
# If you wish to specify custom queries, you can do so here or in a config file.
46+
# By default, queries listed here will override any specified in a config file.
47+
# Prefix the list here with "+" to use these queries and those in the config file.
48+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
4949

50-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51-
# If this step fails, then you should remove it and run the build manually (see below)
52-
- name: Autobuild
53-
uses: github/codeql-action/autobuild@v1
50+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51+
# If this step fails, then you should remove it and run the build manually (see below)
52+
- name: Autobuild
53+
uses: github/codeql-action/autobuild@v1
5454

55-
# ℹ️ Command-line programs to run using the OS shell.
56-
# 📚 https://git.io/JvXDl
55+
# ℹ️ Command-line programs to run using the OS shell.
56+
# 📚 https://git.io/JvXDl
5757

58-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
59-
# and modify them (or add more) to build your code if your project
60-
# uses a compiled language
58+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
59+
# and modify them (or add more) to build your code if your project
60+
# uses a compiled language
6161

62-
#- run: |
63-
# make bootstrap
64-
# make release
62+
#- run: |
63+
# make bootstrap
64+
# make release
6565

66-
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@v1
66+
- name: Perform CodeQL Analysis
67+
uses: github/codeql-action/analyze@v1

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"program": "${workspaceFolder}/node_modules/.bin/jest",
3030
"args": [
3131
"--watch",
32-
// this makes the output less noisy (and at some point in the past seemed necessary to fix... something)
32+
// this runs one test at a time, rather than running them in parallel (necessary for debugging so that you know
33+
// you're hitting a single test's breakpoints, in order)
3334
"--runInBand",
3435
// TODO: when we unify jest config, we may need to change this
3536
"--config",

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7-
## 6.17.0-beta.0
7+
## 6.17.0
88

9-
This beta releases contains several internal refactors that help reduce the bundle size of the SDK and help prep for our [upcoming major release](https://github.com/getsentry/sentry-javascript/issues/4240). There are no breaking changes in this patch unless you are using our internal `Dsn` class. We also deprecated our typescript enums and our internal `API` class. We've detailed how to update your sdk usage if you are using the `Dsn` class or any of the deprecated methods in our [migration documentation](./MIGRATION.md#upgrading-from-6.x-to-6.17.0).
9+
This release contains several internal refactors that help reduce the bundle size of the SDK and help prep for our [upcoming major release](https://github.com/getsentry/sentry-javascript/issues/4240). There are no breaking changes in this patch unless you are using our internal `Dsn` class, which has been removed. We also deprecated a few of our typescript enums and our internal `API` class. We've detailed in our [migration documentation](./MIGRATION.md#upgrading-from-6.x-to-6.17.0) how to update your sdk usage if you are using any of these in your code.
1010

11+
- feat: Undeprecate Severity Enum (#4412)
12+
- feat: Remove Dsn class (#4325)
13+
- feat(core): Add processing metadata to scope and event (#4252)
1114
- feat(core): Deprecate API class (#4281)
12-
- feat(dsn): Remove Dsn class (#4325)
1315
- feat(ember): Update ember dependencies (#4253)
16+
- fix(nextjs): Inject sentry.x.config.js into pages/_error (#4397)
1417
- fix(nextjs): Add sentry-cli existence check for enabling webpack plugin #4311
1518
- ref(tracing): deprecate span status enum (#4299)
1619
- ref(types): drop unused logLevel (#4317)
@@ -20,6 +23,8 @@ This beta releases contains several internal refactors that help reduce the bund
2023
- ref(types): deprecate status enum (#4298)
2124
- ref(types): deprecate severity enum (#4280)
2225

26+
Work in this release contributed by @yordis. Thank you for your contribution!
27+
2328
## 6.16.1
2429

2530
- feat(nextjs): Support Next.js v12 (#4093)

MIGRATION.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,11 @@ const envelopeEndpoint = api.getEnvelopeEndpointWithUrlEncodedAuth();
4444

4545
## Enum changes
4646

47-
We've detailed how to migrate off our enums `Severity`, `Status` and `SpanStatus`. We also made changes to deprecate `TransactionMethod`, `Outcome` and `RequestSessionStatus` enums, but those are internal only APIs.
47+
The enums `Status` and `SpanStatus` were deprecated, and we've detailed how to migrate away from them below. We also deprecated the `TransactionMethod`, `Outcome` and `RequestSessionStatus` enums, but those are internal-only APIs. If you are using them, we encourage you to take a look at the corresponding PRs to see how we've changed our code as a result.
4848

49-
#### Severity
50-
51-
We deprecated the `Severity` enum in `@sentry/types` and it will be removed in the next major release. We recommend using string literals to save on bundle size. [PR](https://github.com/getsentry/sentry-javascript/pull/4280). We also removed the `Severity.fromString` method. This was done to save on bundle size.
52-
53-
```js
54-
// New in 6.17.0:
55-
import { severityFromString } from '@sentry/utils';
56-
57-
const severity = severityFromString(level);
58-
59-
// Before:
60-
import { Severity } from '@sentry/types';
61-
62-
const severity = Severity.fromString(level);
63-
```
49+
- `TransactionMethod`: https://github.com/getsentry/sentry-javascript/pull/4314
50+
- `Outcome`: https://github.com/getsentry/sentry-javascript/pull/4315
51+
- `RequestSessionStatus`: https://github.com/getsentry/sentry-javascript/pull/4316
6452

6553
#### Status
6654

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"private": true,
33
"scripts": {
44
"build": "node ./scripts/verify-packages-versions.js && lerna run --stream --concurrency 1 --sort build",
5+
"build:bundle": "lerna run --stream --concurrency 1 --sort build:bundle",
56
"build:cjs": "lerna run --stream --concurrency 1 --sort build:cjs",
67
"build:dev": "lerna run --stream --concurrency 1 --sort build:dev",
78
"build:dev:filter": "lerna run --stream --concurrency 1 --sort build:dev --include-filtered-dependencies --include-filtered-dependents --scope",

packages/browser/rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ const terserInstance = terser({
1414
// want to have unnecessary debug functionality.
1515
global_defs: {
1616
__SENTRY_BROWSER_BUNDLE__: true,
17-
__SENTRY_NO_DEBUG__: true,
17+
__SENTRY_NO_DEBUG__: false,
1818
},
1919
},
2020
mangle: {
2121
// captureExceptions and captureMessage are public API methods and they don't need to be listed here
2222
// as mangler doesn't touch user-facing thing, however sentryWrapped is not, and it would be mangled into a minified version.
2323
// We need those full names to correctly detect our internal frames for stripping.
24-
// I listed all of them here just for the clarity sake, as they are all used in the frames manipulation process.
24+
// I listed all of them here just for the clarity's sake, as they are all used in the frame-manipulation process.
2525
reserved: ['captureException', 'captureMessage', 'sentryWrapped'],
2626
properties: {
2727
regex: /^_[^_]/,

packages/browser/src/backend.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BaseBackend } from '@sentry/core';
2-
import { Event, EventHint, Options, SeverityLevel, Transport } from '@sentry/types';
2+
import { Event, EventHint, Options, Severity, Transport } from '@sentry/types';
33
import { supportsFetch } from '@sentry/utils';
44

55
import { eventFromException, eventFromMessage } from './eventbuilder';
@@ -45,7 +45,7 @@ export class BrowserBackend extends BaseBackend<BrowserOptions> {
4545
/**
4646
* @inheritDoc
4747
*/
48-
public eventFromMessage(message: string, level: SeverityLevel = 'info', hint?: EventHint): PromiseLike<Event> {
48+
public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {
4949
return eventFromMessage(this._options, message, level, hint);
5050
}
5151

packages/browser/src/eventbuilder.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Event, EventHint, Options, SeverityLevel } from '@sentry/types';
1+
import { Event, EventHint, Options, Severity } from '@sentry/types';
22
import {
33
addExceptionMechanism,
44
addExceptionTypeValue,
@@ -15,7 +15,7 @@ import { eventFromPlainObject, eventFromStacktrace, prepareFramesForEvent } from
1515
import { computeStackTrace } from './tracekit';
1616

1717
/**
18-
* Builds and Event from a Exception
18+
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
1919
* @hidden
2020
*/
2121
export function eventFromException(options: Options, exception: unknown, hint?: EventHint): PromiseLike<Event> {
@@ -24,7 +24,7 @@ export function eventFromException(options: Options, exception: unknown, hint?:
2424
attachStacktrace: options.attachStacktrace,
2525
});
2626
addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }
27-
event.level = 'error';
27+
event.level = Severity.Error;
2828
if (hint && hint.event_id) {
2929
event.event_id = hint.event_id;
3030
}
@@ -38,7 +38,7 @@ export function eventFromException(options: Options, exception: unknown, hint?:
3838
export function eventFromMessage(
3939
options: Options,
4040
message: string,
41-
level: SeverityLevel = 'info',
41+
level: Severity = Severity.Info,
4242
hint?: EventHint,
4343
): PromiseLike<Event> {
4444
const syntheticException = (hint && hint.syntheticException) || undefined;
@@ -59,7 +59,7 @@ export function eventFromUnknownInput(
5959
exception: unknown,
6060
syntheticException?: Error,
6161
options: {
62-
rejection?: boolean;
62+
isRejection?: boolean;
6363
attachStacktrace?: boolean;
6464
} = {},
6565
): Event {
@@ -104,11 +104,11 @@ export function eventFromUnknownInput(
104104
return event;
105105
}
106106
if (isPlainObject(exception) || isEvent(exception)) {
107-
// If it is plain Object or Event, serialize it manually and extract options
108-
// This will allow us to group events based on top-level keys
109-
// which is much better than creating new group when any key/value change
107+
// If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize
108+
// it manually. This will allow us to group events based on top-level keys which is much better than creating a new
109+
// group on any key/value change.
110110
const objectException = exception as Record<string, unknown>;
111-
event = eventFromPlainObject(objectException, syntheticException, options.rejection);
111+
event = eventFromPlainObject(objectException, syntheticException, options.isRejection);
112112
addExceptionMechanism(event, {
113113
synthetic: true,
114114
});

packages/browser/src/exports.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export {
88
EventStatus,
99
Exception,
1010
Response,
11+
Severity,
1112
SeverityLevel,
1213
StackFrame,
1314
Stacktrace,

packages/browser/src/integrations/breadcrumbs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
22
/* eslint-disable max-lines */
33
import { getCurrentHub } from '@sentry/core';
4-
import { Event, Integration } from '@sentry/types';
4+
import { Event, Integration, Severity } from '@sentry/types';
55
import {
66
addInstrumentationHandler,
77
getEventDescription,
@@ -230,7 +230,7 @@ function _fetchBreadcrumb(handlerData: { [key: string]: any }): void {
230230
{
231231
category: 'fetch',
232232
data: handlerData.fetchData,
233-
level: 'error',
233+
level: Severity.Error,
234234
type: 'http',
235235
},
236236
{

packages/browser/src/integrations/globalhandlers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
22
import { getCurrentHub } from '@sentry/core';
3-
import { Event, EventHint, Hub, Integration, Primitive } from '@sentry/types';
3+
import { Event, EventHint, Hub, Integration, Primitive, Severity } from '@sentry/types';
44
import {
55
addExceptionMechanism,
66
addInstrumentationHandler,
@@ -94,7 +94,7 @@ function _installGlobalOnErrorHandler(): void {
9494
: _enhanceEventWithInitialFrame(
9595
eventFromUnknownInput(error || msg, undefined, {
9696
attachStacktrace,
97-
rejection: false,
97+
isRejection: false,
9898
}),
9999
url,
100100
line,
@@ -145,10 +145,10 @@ function _installGlobalOnUnhandledRejectionHandler(): void {
145145
? _eventFromRejectionWithPrimitive(error)
146146
: eventFromUnknownInput(error, undefined, {
147147
attachStacktrace,
148-
rejection: true,
148+
isRejection: true,
149149
});
150150

151-
event.level = 'error';
151+
event.level = Severity.Error;
152152

153153
addMechanismAndCapture(hub, error, event, 'onunhandledrejection');
154154
return;

packages/browser/src/transports/fetch.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export class FetchTransport extends BaseTransport {
3737
const options: RequestInit = {
3838
body: sentryRequest.body,
3939
method: 'POST',
40-
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default
41-
// https://caniuse.com/#feat=referrer-policy
42-
// It doesn't. And it throw exception instead of ignoring this parameter...
40+
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default'
41+
// (see https://caniuse.com/#feat=referrer-policy),
42+
// it doesn't. And it throws an exception instead of ignoring this parameter...
4343
// REF: https://github.com/getsentry/raven-js/issues/1233
4444
referrerPolicy: (supportsReferrerPolicy() ? 'origin' : '') as ReferrerPolicy,
4545
};

packages/core/src/basebackend.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Event, EventHint, Options, Session, SeverityLevel, Transport } from '@sentry/types';
1+
import { Event, EventHint, Options, Session, Severity, Transport } from '@sentry/types';
22
import { isDebugBuild, logger, SentryError } from '@sentry/utils';
33

44
import { NoopTransport } from './transports/noop';
@@ -24,12 +24,12 @@ import { NoopTransport } from './transports/noop';
2424
* @hidden
2525
*/
2626
export interface Backend {
27-
/** Creates a {@link Event} from an exception. */
27+
/** Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`. */
2828
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2929
eventFromException(exception: any, hint?: EventHint): PromiseLike<Event>;
3030

31-
/** Creates a {@link Event} from a plain message. */
32-
eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event>;
31+
/** Creates an {@link Event} from primitive inputs to `captureMessage`. */
32+
eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;
3333

3434
/** Submits the event to Sentry */
3535
sendEvent(event: Event): void;
@@ -83,7 +83,7 @@ export abstract class BaseBackend<O extends Options> implements Backend {
8383
/**
8484
* @inheritDoc
8585
*/
86-
public eventFromMessage(_message: string, _level?: SeverityLevel, _hint?: EventHint): PromiseLike<Event> {
86+
public eventFromMessage(_message: string, _level?: Severity, _hint?: EventHint): PromiseLike<Event> {
8787
throw new SentryError('Backend has to implement `eventFromMessage` method');
8888
}
8989

0 commit comments

Comments
 (0)