Skip to content

Commit 0dd456f

Browse files
committed
Merge remote-tracking branch 'upstream/7.x' into feat/attachments
2 parents 8db6659 + 7f04d33 commit 0dd456f

Some content is hidden

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

67 files changed

+693
-306
lines changed

.github/workflows/build.yml

Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,45 @@ jobs:
105105
# `job_build` can't see `job_install_deps` and what it returned)
106106
dependency_cache_key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
107107

108+
# This isn't a full `yarn build` using sucrase - it's just the cache from the normal build, with `build/cjs` and
109+
# `build/esm` overwritten by sucrase. This way we don't need to worry about all of the other random stuff which
110+
# packages build, because it will already be there.
111+
job_build_with_sucrase:
112+
name: Sucrase Build
113+
needs: [job_install_deps, job_build]
114+
runs-on: ubuntu-latest
115+
timeout-minutes: 20
116+
steps:
117+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
118+
uses: actions/checkout@v2
119+
with:
120+
ref: ${{ env.HEAD_COMMIT }}
121+
- name: Set up Node
122+
uses: actions/setup-node@v1
123+
- name: Check dependency cache
124+
uses: actions/cache@v2
125+
with:
126+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
127+
key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
128+
- name: Check tsc build cache
129+
uses: actions/cache@v2
130+
with:
131+
path: ${{ env.CACHED_BUILD_PATHS }}
132+
key: ${{ env.BUILD_CACHE_KEY }}
133+
- name: Check sucrase build cache
134+
uses: actions/cache@v2
135+
id: cache_built_sucrase_packages
136+
with:
137+
path: ${{ env.CACHED_BUILD_PATHS }}
138+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
139+
- name: Build packages with sucrase
140+
if: steps.cache_built_sucrase_packages.outputs.cache-hit == ''
141+
run: 'yarn build:rollup'
142+
outputs:
143+
# this needs to be passed on, because the `needs` context only looks at direct ancestors (so steps which depend on
144+
# `job_build` can't see `job_install_deps` and what it returned)
145+
dependency_cache_key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
146+
108147
job_size_check:
109148
name: Size Check
110149
needs: job_build
@@ -492,3 +531,269 @@ jobs:
492531
run: |
493532
cd packages/node-integration-tests
494533
yarn test
534+
535+
job_unit_test_sucrase:
536+
name: Sucrase Test (Node ${{ matrix.node }})
537+
needs: job_build_with_sucrase
538+
continue-on-error: true
539+
timeout-minutes: 30
540+
runs-on: ubuntu-latest
541+
strategy:
542+
matrix:
543+
node: [8, 10, 12, 14, 16]
544+
steps:
545+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
546+
uses: actions/checkout@v2
547+
with:
548+
ref: ${{ env.HEAD_COMMIT }}
549+
- name: Set up Node
550+
uses: actions/setup-node@v1
551+
with:
552+
node-version: ${{ matrix.node }}
553+
- name: Check dependency cache
554+
uses: actions/cache@v2
555+
with:
556+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
557+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
558+
- name: Check build cache
559+
uses: actions/cache@v2
560+
with:
561+
path: ${{ env.CACHED_BUILD_PATHS }}
562+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
563+
- name: Run tests
564+
env:
565+
NODE_VERSION: ${{ matrix.node }}
566+
run: |
567+
[[ $NODE_VERSION == 8 ]] && yarn add --dev --ignore-engines --ignore-scripts --ignore-workspace-root-check [email protected]
568+
yarn test-ci
569+
- name: Compute test coverage
570+
uses: codecov/codecov-action@v1
571+
572+
job_nextjs_integration_test_sucrase:
573+
name: Sucrase Test @sentry/nextjs on (Node ${{ matrix.node }})
574+
needs: job_build_with_sucrase
575+
continue-on-error: true
576+
timeout-minutes: 30
577+
runs-on: ubuntu-latest
578+
strategy:
579+
matrix:
580+
node: [10, 12, 14, 16]
581+
steps:
582+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
583+
uses: actions/checkout@v2
584+
with:
585+
ref: ${{ env.HEAD_COMMIT }}
586+
- name: Set up Node
587+
uses: actions/setup-node@v1
588+
with:
589+
node-version: ${{ matrix.node }}
590+
- name: Check dependency cache
591+
uses: actions/cache@v2
592+
with:
593+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
594+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
595+
- name: Check build cache
596+
uses: actions/cache@v2
597+
with:
598+
path: ${{ env.CACHED_BUILD_PATHS }}
599+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
600+
- name: Run tests
601+
env:
602+
NODE_VERSION: ${{ matrix.node }}
603+
run: |
604+
cd packages/nextjs
605+
yarn test:integration
606+
607+
# Ember tests are separate from the rest because they are the slowest part of the test suite, and making them a
608+
# separate job allows them to run in parallel with the other tests.
609+
job_ember_tests_sucrase:
610+
name: Sucrase Test @sentry/ember
611+
needs: job_build_with_sucrase
612+
continue-on-error: true
613+
timeout-minutes: 30
614+
runs-on: ubuntu-latest
615+
steps:
616+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
617+
uses: actions/checkout@v2
618+
with:
619+
ref: ${{ env.HEAD_COMMIT }}
620+
# TODO: removing `fetch-depth` below seems to have no effect, and the commit which added it had no description,
621+
# so it's not clear why it's necessary. That said, right now ember tests are xfail, so it's a little hard to
622+
# tell if it's safe to remove. Once ember tests are fixed, let's try again with it turned off, and if all goes
623+
# well, we can pull it out.
624+
fetch-depth: 0
625+
- name: Set up Node
626+
uses: actions/setup-node@v1
627+
with:
628+
# The only danger with Ember in terms of Node versions is that the build tool, ember-cli, won't work if Node
629+
# is too old. Since Oct 2019, Node 10 has been the oldest version supported by ember-cli, so test against
630+
# that. If it passes, newer versions of Node should also be fine. This saves us from having to run the Ember
631+
# tests in our Node matrix above.
632+
node-version: '10'
633+
- name: Check dependency cache
634+
uses: actions/cache@v2
635+
with:
636+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
637+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
638+
- name: Check build cache
639+
uses: actions/cache@v2
640+
with:
641+
path: ${{ env.CACHED_BUILD_PATHS }}
642+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
643+
- name: Run Ember tests
644+
run: yarn test --scope=@sentry/ember
645+
- name: Compute test coverage
646+
uses: codecov/codecov-action@v1
647+
648+
job_browser_playwright_tests_sucrase:
649+
name: Sucrase Playwright - ${{ (matrix.tracing_only && 'Browser + Tracing') || 'Browser' }} (${{ matrix.bundle }})
650+
needs: job_build_with_sucrase
651+
runs-on: ubuntu-latest
652+
strategy:
653+
matrix:
654+
bundle:
655+
- esm
656+
- cjs
657+
tracing_only:
658+
- true
659+
- false
660+
exclude:
661+
# `tracing_only` only makes a difference for bundles - tests of the esm and cjs builds always include the
662+
# tracing tests
663+
- bundle: esm
664+
tracing_only: false
665+
- bundle: cjs
666+
tracing_only: false
667+
steps:
668+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
669+
uses: actions/checkout@v2
670+
with:
671+
ref: ${{ env.HEAD_COMMIT }}
672+
- name: Set up Node
673+
uses: actions/setup-node@v1
674+
with:
675+
node-version: '16'
676+
- name: Check dependency cache
677+
uses: actions/cache@v2
678+
with:
679+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
680+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
681+
- name: Check build cache
682+
uses: actions/cache@v2
683+
with:
684+
path: ${{ env.CACHED_BUILD_PATHS }}
685+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
686+
- name: Run Playwright tests
687+
env:
688+
PW_BUNDLE: ${{ matrix.bundle }}
689+
PW_TRACING_ONLY: ${{ matrix.tracing_only }}
690+
run: |
691+
cd packages/integration-tests
692+
yarn run playwright install-deps webkit
693+
yarn test:ci
694+
695+
job_browser_integration_tests_sucrase:
696+
name: Sucrase Old Browser Integration Tests (${{ matrix.browser }})
697+
needs: job_build_with_sucrase
698+
runs-on: ubuntu-latest
699+
timeout-minutes: 10
700+
continue-on-error: true
701+
strategy:
702+
matrix:
703+
browser:
704+
- ChromeHeadless
705+
- FirefoxHeadless
706+
- WebkitHeadless
707+
steps:
708+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
709+
uses: actions/checkout@v2
710+
with:
711+
ref: ${{ env.HEAD_COMMIT }}
712+
- name: Set up Node
713+
uses: actions/setup-node@v1
714+
- name: Check dependency cache
715+
uses: actions/cache@v2
716+
with:
717+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
718+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
719+
- name: Check build cache
720+
uses: actions/cache@v2
721+
with:
722+
path: ${{ env.CACHED_BUILD_PATHS }}
723+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
724+
- name: Run integration tests
725+
env:
726+
KARMA_BROWSER: ${{ matrix.browser }}
727+
run: |
728+
cd packages/browser
729+
[[ $KARMA_BROWSER == WebkitHeadless ]] && yarn run playwright install-deps webkit
730+
yarn test:integration
731+
732+
job_browser_build_tests_sucrase:
733+
name: Sucrase Browser Build Tests
734+
needs: job_build_with_sucrase
735+
runs-on: ubuntu-latest
736+
timeout-minutes: 5
737+
continue-on-error: true
738+
steps:
739+
- name: Check out current commit (${ env.HEAD_COMMIT }})
740+
uses: actions/checkout@v2
741+
with:
742+
ref: ${{ env.HEAD_COMMIT }}
743+
- name: Set up Node
744+
uses: actions/setup-node@v1
745+
with:
746+
node-version: '16'
747+
- name: Check dependency cache
748+
uses: actions/cache@v2
749+
with:
750+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
751+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
752+
- name: Check build cache
753+
uses: actions/cache@v2
754+
with:
755+
path: ${{ env.CACHED_BUILD_PATHS }}
756+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
757+
- name: Run browser build tests
758+
run: |
759+
cd packages/browser
760+
yarn test:package
761+
- name: Run utils build tests
762+
run: |
763+
cd packages/utils
764+
yarn test:package
765+
766+
job_node_integration_tests_sucrase:
767+
name: Sucrase Node SDK Integration Tests (${{ matrix.node }})
768+
needs: job_build_with_sucrase
769+
runs-on: ubuntu-latest
770+
timeout-minutes: 10
771+
continue-on-error: true
772+
strategy:
773+
matrix:
774+
node: [10, 12, 14, 16]
775+
steps:
776+
- name: Check out current commit (${{ github.sha }})
777+
uses: actions/checkout@v2
778+
with:
779+
ref: ${{ env.HEAD_COMMIT }}
780+
- name: Set up Node
781+
uses: actions/setup-node@v1
782+
with:
783+
node-version: ${{ matrix.node }}
784+
- name: Check dependency cache
785+
uses: actions/cache@v2
786+
with:
787+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
788+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
789+
- name: Check build cache
790+
uses: actions/cache@v2
791+
with:
792+
path: ${{ env.CACHED_BUILD_PATHS }}
793+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
794+
- name: Run integration tests
795+
env:
796+
NODE_VERSION: ${{ matrix.node }}
797+
run: |
798+
cd packages/node-integration-tests
799+
yarn test

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"build:dev:filter": "lerna run --stream --concurrency 1 --sort build:dev --include-filtered-dependencies --include-filtered-dependents --scope",
99
"build:es5": "yarn lerna run --stream --concurrency 1 --sort build:cjs # *** backwards compatibility - remove in v7 ***",
1010
"build:esm": "lerna run --stream --concurrency 1 --sort build:esm",
11+
"build:rollup": "lerna run --stream --concurrency 1 --sort build:rollup",
1112
"build:types": "lerna run --stream --concurrency 1 --sort build:types",
1213
"build:watch": "lerna run --parallel build:watch",
1314
"build:dev:watch": "lerna run --parallel build:dev:watch",
@@ -57,6 +58,7 @@
5758
"@rollup/plugin-commonjs": "^21.0.1",
5859
"@rollup/plugin-node-resolve": "^13.1.3",
5960
"@rollup/plugin-replace": "^3.0.1",
61+
"@rollup/plugin-sucrase": "^4.0.3",
6062
"@size-limit/preset-small-lib": "^4.5.5",
6163
"@strictsoftware/typedoc-plugin-monorepo": "^0.3.1",
6264
"@types/chai": "^4.1.3",

packages/browser/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@
4949
"build:dev": "run-p build:cjs build:esm build:types",
5050
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",
5151
"build:esm": "tsc -p tsconfig.esm.json",
52+
"build:rollup": "rollup -c rollup.npm.config.js",
5253
"build:types": "tsc -p tsconfig.types.json",
5354
"build:watch": "run-p build:cjs:watch build:esm:watch build:bundle:watch build:types:watch",
5455
"build:bundle:watch": "rollup --config --watch",
5556
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
5657
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
5758
"build:dev:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
5859
"build:esm:watch": "tsc -p tsconfig.esm.json --watch",
60+
"build:rollup:watch": "rollup -c rollup.npm.config.js --watch",
5961
"build:types:watch": "tsc -p tsconfig.types.json --watch",
6062
"build:npm": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm",
6163
"circularDepCheck": "madge --circular src/index.ts",

packages/browser/rollup.npm.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js';
2+
3+
export default makeNPMConfigVariants(
4+
makeBaseNPMConfig({
5+
// packages with bundles have a different build directory structure
6+
hasBundles: true,
7+
}),
8+
);

packages/browser/src/exports.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ export type {
55
SdkInfo,
66
Event,
77
EventHint,
8-
EventStatus,
98
Exception,
10-
Response,
119
// eslint-disable-next-line deprecation/deprecation
1210
Severity,
1311
SeverityLevel,

packages/browser/src/transports/fetch.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,12 @@ export function makeFetchTransport(
2222
...options.requestOptions,
2323
};
2424

25-
return nativeFetch(options.url, requestOptions).then(response => {
26-
return response.text().then(body => ({
27-
body,
28-
headers: {
29-
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
30-
'retry-after': response.headers.get('Retry-After'),
31-
},
32-
reason: response.statusText,
33-
statusCode: response.status,
34-
}));
35-
});
25+
return nativeFetch(options.url, requestOptions).then(response => ({
26+
headers: {
27+
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
28+
'retry-after': response.headers.get('Retry-After'),
29+
},
30+
}));
3631
}
3732

3833
return createTransport({ bufferSize: options.bufferSize }, makeRequest);

0 commit comments

Comments
 (0)