Skip to content

Commit edc9929

Browse files
committed
Merge remote-tracking branch 'upstream/7.x' into 7.x
2 parents a0792da + f3e9384 commit edc9929

File tree

156 files changed

+2560
-2700
lines changed

Some content is hidden

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

156 files changed

+2560
-2700
lines changed

.eslintrc.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ module.exports = {
1010
ecmaVersion: 2018,
1111
},
1212
extends: ['@sentry-internal/sdk'],
13-
ignorePatterns: ['coverage/**', 'build/**', 'dist/**', 'esm/**', 'examples/**', 'test/manual/**', 'types/**'],
13+
ignorePatterns: [
14+
'coverage/**',
15+
'build/**',
16+
'dist/**',
17+
'cjs/**',
18+
'esm/**',
19+
'examples/**',
20+
'test/manual/**',
21+
'types/**',
22+
],
1423
overrides: [
1524
{
1625
files: ['*.ts', '*.tsx', '*.d.ts'],

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323

2424
CACHED_BUILD_PATHS: |
2525
${{ github.workspace }}/packages/**/build
26-
${{ github.workspace }}/packages/**/dist
26+
${{ github.workspace }}/packages/**/cjs
2727
${{ github.workspace }}/packages/**/esm
2828
${{ github.workspace }}/packages/ember/*.d.ts
2929
${{ github.workspace }}/packages/ember/instance-initializers
@@ -410,6 +410,8 @@ jobs:
410410
uses: actions/checkout@v2
411411
- name: Set up Node
412412
uses: actions/setup-node@v1
413+
with:
414+
node-version: '16'
413415
- name: Check dependency cache
414416
uses: actions/cache@v2
415417
with:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package-lock.json
55

66
# build and test
77
build/
8-
packages/*/dist/
8+
packages/*/cjs/
99
packages/*/esm/
1010
coverage/
1111
scratch/

.npmignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
*
55

6-
# TODO remove bundles (which in the tarball are inside `build`) in v7
7-
!/build/**/*
8-
9-
!/dist/**/*
6+
!/cjs/**/*
107
!/esm/**/*
118
!/types/**/*

.vscode/launch.json

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
"version": "0.2.0",
66
"inputs": [
77
{
8-
"id": "getPackageName",
9-
"type": "command",
10-
"command": "shellCommand.execute",
11-
"args": {
12-
"command": "echo '${file}' | sed s/'.*sentry-javascript\\/packages\\/'// | grep --extended-regexp --only-matching --max-count 1 '[^\\/]+' | head -1",
13-
"cwd": "${workspaceFolder}" ,
14-
// normally `input` commands bring up a selector for the user, but given that there should only be one
15-
// choice here, this lets us skip the prompt
16-
"useSingleResult": true
17-
}
8+
"id": "getPackageName",
9+
"type": "command",
10+
"command": "shellCommand.execute",
11+
"args": {
12+
"command": "echo '${file}' | sed s/'.*sentry-javascript\\/packages\\/'// | grep --extended-regexp --only-matching --max-count 1 '[^\\/]+' | head -1",
13+
"cwd": "${workspaceFolder}",
14+
// normally `input` commands bring up a selector for the user, but given that there should only be one
15+
// choice here, this lets us skip the prompt
16+
"useSingleResult": true
17+
}
1818
}
1919
],
2020
"configurations": [
@@ -25,18 +25,9 @@
2525
"cwd": "${workspaceFolder}/packages/${input:getPackageName}",
2626
"request": "launch",
2727
"runtimeExecutable": "yarn",
28-
"runtimeArgs": [
29-
"rollup",
30-
"-c",
31-
"${file}"
32-
],
33-
"skipFiles": [
34-
"<node_internals>/**"
35-
],
36-
"outFiles": [
37-
"${workspaceFolder}/**/*.js",
38-
"!**/node_modules/**"
39-
],
28+
"runtimeArgs": ["rollup", "-c", "${file}"],
29+
"skipFiles": ["<node_internals>/**"],
30+
"outFiles": ["${workspaceFolder}/**/*.js", "!**/node_modules/**"],
4031
"sourceMaps": true,
4132
"smartStep": true,
4233
"internalConsoleOptions": "openOnSessionStart",
@@ -56,9 +47,6 @@
5647
// this runs one test at a time, rather than running them in parallel (necessary for debugging so that you know
5748
// you're hitting a single test's breakpoints, in order)
5849
"--runInBand",
59-
// TODO: when we unify jest config, we may need to change this
60-
"--config",
61-
"${workspaceFolder}/packages/${input:getPackageName}/package.json",
6250
// coverage messes up the source maps
6351
"--coverage",
6452
"false",
@@ -67,14 +55,13 @@
6755
],
6856
"sourceMaps": true,
6957
"smartStep": true,
70-
// otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on
71-
// "outputCapture" option here; default is to show console logs), but not both
58+
// otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on
59+
// "outputCapture" option here; default is to show console logs), but not both
7260
"console": "integratedTerminal",
7361
// since we're not using it, don't automatically switch to it
74-
"internalConsoleOptions": "neverOpen",
62+
"internalConsoleOptions": "neverOpen"
7563
},
7664

77-
7865
// @sentry/nextjs - Run a specific integration test file
7966
// Must have test file in currently active tab when hitting the play button, and must already have run `yarn` in test app directory
8067
{
@@ -105,18 +92,17 @@
10592
// this controls which files are sourcemapped
10693
"outFiles": [
10794
// our SDK code
108-
"${workspaceFolder}/**/dist/**/*.js",
95+
"${workspaceFolder}/**/cjs/**/*.js",
10996
// the built test app
11097
"${workspaceFolder}/packages/nextjs/test/integration/.next/**/*.js",
11198
"!**/node_modules/**"
11299
],
113100
"resolveSourceMapLocations": [
114-
"${workspaceFolder}/**/dist/**",
101+
"${workspaceFolder}/**/cjs/**",
115102
"${workspaceFolder}/packages/nextjs/test/integration/.next/**",
116103
"!**/node_modules/**"
117104
],
118105
"internalConsoleOptions": "openOnSessionStart"
119-
120-
},
106+
}
121107
]
122108
}

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@
44

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

7+
## 7.0.0-alpha.0
8+
9+
- **breaking** feat: Drop support for Node 6 (#4851)
10+
- **breaking** feat: Remove references to @sentry/apm (#4845)
11+
- **breaking** feat: Delete deprecated startSpan and child methods (#4849)
12+
- **breaking** feat(bundles): Stop publishing CDN bundles on npm (#4901)
13+
- **breaking** ref(build): Rename dist directories to cjs (#4900)
14+
- **breaking** ref(build): Update to TypeScript 3.8.3 (#4895)
15+
- **breaking** feat(browser): Remove top level eventbuilder exports (#4887)
16+
- **breaking** feat(core): Delete API class (#4848)
17+
- **breaking** feat(core): Remove whitelistUrls/blacklistUrls (#4850)
18+
- **breaking** feat(gatsby): Remove Sentry from window (#4857)
19+
- **breaking** feat(hub): Remove getActiveDomain (#4858)
20+
- **breaking** feat(hub): Remove setTransaction scope method (#4865)
21+
- **breaking** feat(integrations): Remove old angular, ember, and vue integrations (#4893)
22+
- **breaking** feat(node): Remove deprecated frameContextLines (#4884)
23+
- **breaking** feat(tracing): Rename registerRequestInstrumentation -> instrumentOutgoingRequests (#4859)
24+
- **breaking** feat(types): Remove deprecated user dsn field (#4864)
25+
- **breaking** feat(types): Delete RequestSessionStatus enum (#4889)
26+
- **breaking** feat(types): Delete Status enum (#4891)
27+
- **breaking** feat(types): Delete SessionStatus enum (#4890)
28+
729
## 6.19.6
830

931
- fix(typing): Fix typing API in CaptureConsle (#4879)

MIGRATION.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,97 @@
1+
## Upgrading from 6.x to 7.x
2+
3+
The main goal of version 7 is to reduce bundle size. This version is breaking because we removed deprecated APIs, upgraded our build tooling, and restructured npm package contents.
4+
Below we will outline all the breaking changes you should consider when upgrading.
5+
6+
### Dropping Support for Node.js v6
7+
8+
Node.js version 6 has reached end of life in April 2019. For Sentry JavaScript SDK version 7, we will no longer be supporting version 6 of Node.js.
9+
10+
As far as SDK development goes, dropping support means no longer running integration tests for Node.js version 6, and also no longer handling edge cases specific to version 6.
11+
Running the new SDK version on Node.js v6 is therefore highly discouraged.
12+
13+
### Removal Of Old Platform Integrations From `@sentry/integrations` Package
14+
15+
The following classes will be removed from the `@sentry/integrations` package and can no longer be used:
16+
17+
- `Angular`
18+
- `Ember`
19+
- `Vue`
20+
21+
These classes have been superseded and were moved into their own packages, `@sentry/angular`, `@sentry/ember`, and `@sentry/vue` in a previous version.
22+
Refer to those packages if you want to integrate Sentry into your Angular, Ember, or Vue application.
23+
24+
### Moving To ES6 For CommonJS Files
25+
26+
From version 7 onwards, the CommonJS files in Sentry JavaScript SDK packages will use ES6.
27+
28+
If you need to support Internet Explorer 11 or old Node.js versions, we recommend using a preprocessing tool like [Babel](https://babeljs.io/) to convert Sentry packages to ES5.
29+
30+
### Renaming Of CDN Bundles
31+
32+
CDN bundles will be ES6 by default. Files that followed the naming scheme `bundle.es6.min.js` were renamed to `bundle.min.js` and any bundles using ES5 (files without `.es6`) turned into `bundle.es5.min.js`.
33+
34+
See our [docs on CDN bundles](https://docs.sentry.io/platforms/javascript/install/cdn/) for more information.
35+
36+
### Restructuring Of Package Content
37+
38+
Up until v6.x, we have published our packages on npm with the following structure:
39+
40+
- `build` folder contained CDN bundles
41+
- `dist` folder contained CommonJS files and TypeScript declarations
42+
- `esm` folder contained ESM files and TypeScript declarations
43+
44+
Moving forward the JavaScript SDK packages will generally have the following structure:
45+
46+
- `cjs` folder contains CommonJS files
47+
- `esm` folder contains ESM files
48+
- `types` folder contains TypeScript declarations
49+
50+
**CDN bundles of version 7 or higher will no longer be distributed through our npm package.**
51+
This means that most third-party CDNs like [unpkg](https://unpkg.com/) or [jsDelivr](https://www.jsdelivr.com/) will also not provide them.
52+
53+
If you depend on any specific files in a Sentry JavaScript npm package, you will most likely need to update their references.
54+
For example, imports on `@sentry/browser/dist/client` will become `@sentry/browser/cjs/client`.
55+
However, directly importing from specific files is discouraged.
56+
57+
### Removing the `API` class from `@sentry/core`
58+
59+
The internal `API` class was removed in favor of the `initAPIDetails` function and the `APIDetails` type. More details can be found in the [PR that deprecated this class](https://github.com/getsentry/sentry-javascript/pull/4281). To migrate, see the following example.
60+
61+
```js
62+
// New in v7:
63+
import {
64+
initAPIDetails,
65+
getEnvelopeEndpointWithUrlEncodedAuth,
66+
getStoreEndpointWithUrlEncodedAuth,
67+
} from '@sentry/core';
68+
69+
const dsn = initAPIDetails(dsn, metadata, tunnel);
70+
const dsn = api.dsn;
71+
const storeEndpoint = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);
72+
const envelopeEndpoint = getStoreEndpointWithUrlEncodedAuth(api.dsn);
73+
74+
// Before:
75+
import { API } from '@sentry/core';
76+
77+
const api = new API(dsn, metadata, tunnel);
78+
const dsn = api.getDsn();
79+
const storeEndpoint = api.getStoreEndpointWithUrlEncodedAuth();
80+
const envelopeEndpoint = api.getEnvelopeEndpointWithUrlEncodedAuth();
81+
```
82+
83+
### General API Changes
84+
85+
For our efforts to reduce bundle size of the SDK we had to remove and refactor parts of the package which introduced a few changes to the API:
86+
87+
- Remove support for deprecated `@sentry/apm` package. `@sentry/tracing` should be used instead.
88+
- Remove deprecated `user` field from DSN. `publicKey` should be used instead.
89+
- Remove deprecated `whitelistUrls` and `blacklistUrls` options from `Sentry.init`. They have been superseded by `allowUrls` and `denyUrls` specifically. See [our docs page on inclusive language](https://develop.sentry.dev/inclusion/) for more details.
90+
- Gatsby SDK: Remove `Sentry` from `window` object.
91+
- Remove deprecated `Status`, `SessionStatus`, and `RequestSessionStatus` enums. These were only part of an internal API. If you are using these enums, we encourage you to to look at [b177690d](https://github.com/getsentry/sentry-javascript/commit/b177690d89640aef2587039113c614672c07d2be), [5fc3147d](https://github.com/getsentry/sentry-javascript/commit/5fc3147dfaaf1a856d5923e4ba409479e87273be), and [f99bdd16](https://github.com/getsentry/sentry-javascript/commit/f99bdd16539bf6fac14eccf1a974a4988d586b28) to to see the changes we've made to our code as result. We generally recommend using string literals instead of the removed enums.
92+
- Remove deprecated `getActiveDomain` method and `DomainAsCarrier` type from `@sentry/hub`.
93+
- Rename `registerRequestInstrumentation` to `instrumentOutgoingRequests` in `@sentry/tracing`.
94+
195
# Upgrading from 6.17.x to 6.18.0
296

397
Version 6.18.0 deprecates the `frameContextLines` top-level option for the Node SDK. This option will be removed in an upcoming major version. To migrate off of the top-level option, pass it instead to the new `ContextLines` integration.

jest.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
rootDir: process.cwd(),
3+
collectCoverage: true,
4+
transform: {
5+
'^.+\\.ts$': 'ts-jest',
6+
'^.+\\.tsx$': 'ts-jest',
7+
},
8+
coverageDirectory: '<rootDir>/coverage',
9+
moduleFileExtensions: ['js', 'ts', 'tsx'],
10+
testMatch: ['<rootDir>/**/*.test.ts', '<rootDir>/**/*.test.tsx'],
11+
globals: {
12+
'ts-jest': {
13+
tsconfig: '<rootDir>/tsconfig.test.json',
14+
diagnostics: false,
15+
},
16+
},
17+
testPathIgnorePatterns: ['<rootDir>/build/', '<rootDir>/node_modules/'],
18+
};

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"lerna": "3.4.0",
3-
"version": "6.19.6",
3+
"version": "7.0.0-alpha.0",
44
"packages": "packages/*",
55
"npmClient": "yarn",
66
"useWorkspaces": true

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,17 @@
6262
"@strictsoftware/typedoc-plugin-monorepo": "^0.3.1",
6363
"@types/chai": "^4.1.3",
6464
"@types/jest": "^24.0.11",
65+
"@types/jsdom": "^16.2.3",
6566
"@types/mocha": "^5.2.0",
6667
"@types/node": "~10.17.0",
6768
"@types/sinon": "^7.0.11",
6869
"chai": "^4.1.2",
6970
"codecov": "^3.6.5",
7071
"deepmerge": "^4.2.2",
7172
"eslint": "7.32.0",
72-
"jest": "^24.9.0",
73+
"jest": "^27.5.1",
74+
"jest-environment-node": "^27.5.1",
75+
"jsdom": "^19.0.0",
7376
"karma-browserstack-launcher": "^1.5.1",
7477
"karma-firefox-launcher": "^1.1.0",
7578
"lerna": "3.13.4",
@@ -85,15 +88,14 @@
8588
"rollup-plugin-typescript2": "^0.31.2",
8689
"sinon": "^7.3.2",
8790
"size-limit": "^4.5.5",
88-
"ts-jest": "^24.3.0",
91+
"ts-jest": "^27.1.4",
8992
"ts-node": "^8.10.2",
9093
"tslib": "^2.3.1",
9194
"typedoc": "^0.18.0",
9295
"typescript": "3.8.3"
9396
},
9497
"resolutions": {
95-
"**/agent-base": "5",
96-
"**/jest-environment-node": "24"
98+
"**/agent-base": "5"
9799
},
98100
"version": "0.0.0",
99101
"dependencies": {}

0 commit comments

Comments
 (0)