Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
10fe77f
ref(tracing): Remove references to @sentry/apm (#4845)
AbhiPrasad Apr 7, 2022
f501391
ref(core): Delete `API` class (#4848)
AbhiPrasad Apr 7, 2022
1997ad5
ref(tracing): Delete deprecated `startSpan` and `child` methods (#4849)
AbhiPrasad Apr 7, 2022
5f0d7c2
ref(core): Remove `whitelistUrls`/`blacklistUrls` (#4850)
AbhiPrasad Apr 7, 2022
67bbb65
ref(gatsby): Remove `Sentry` from window (#4857)
AbhiPrasad Apr 7, 2022
c481f55
ref(hub): Remove `getActiveDomain` (#4858)
AbhiPrasad Apr 7, 2022
8ed1e9e
ref(types): Remove deprecated `user` dsn field (#4864)
AbhiPrasad Apr 7, 2022
ba4561c
ref(hub): Remove `setTransaction` scope method (#4865)
AbhiPrasad Apr 7, 2022
ebff719
ref: Drop support for Node 6 (#4851)
AbhiPrasad Apr 7, 2022
5a050ee
ref(tracing): Rename `registerRequestInstrumentation` -> `instrumentO…
AbhiPrasad Apr 7, 2022
bd509d0
fix(test): Increase MongoMemoryServer creation timeout (#4881)
Lms24 Apr 7, 2022
729aced
ref(node): Remove deprecated `frameContextLines` (#4884)
timfish Apr 7, 2022
0604aef
ref(browser): Remove top level eventbuilder exports (#4887)
timfish Apr 7, 2022
fc6aa54
ref(build): Update to TypeScript 3.8.3 (#4895)
lobsterkatie Apr 7, 2022
804640d
ref(bundles): Stop publishing CDN bundles on npm (#4901)
Apr 8, 2022
c64ca5e
ref(types): Delete `RequestSessionStatus` enum (#4889)
AbhiPrasad Apr 8, 2022
d096b02
ref(types): Delete Status enum (#4891)
AbhiPrasad Apr 8, 2022
9b1dfdf
ref(build): Rename `dist` directories to `cjs` (#4900)
Lms24 Apr 8, 2022
7f56b0f
ref(integrations): Remove old `angular`, `ember`, and `vue` integrati…
AbhiPrasad Apr 8, 2022
e6149ad
ref(types): Delete `SessionStatus` enum (#4890)
AbhiPrasad Apr 8, 2022
dcb1bb8
meta: 7.0.0-alpha.0 changelog (#4892)
AbhiPrasad Apr 8, 2022
87e9894
fix(build): Skip flags file when building integration bundles (#4906)
lobsterkatie Apr 9, 2022
bac2d91
fix(dev): Standardize yarn `clean` scripts (#4909)
lobsterkatie Apr 11, 2022
62e7189
chore(dev): Remove redundant `.gitignore` in `utils` package (#4905)
lobsterkatie Apr 11, 2022
53027de
ref(dev): Centralize jest config (#4907)
lobsterkatie Apr 11, 2022
f5a6ca8
release: 7.0.0-alpha.0
getsentry-bot Apr 11, 2022
b42472a
feat(docs): Add migration guide for v7 (#4910)
Apr 11, 2022
075d59b
feat(browser): Add debugging hints to browser integration tests (#4914)
lobsterkatie Apr 11, 2022
07d4ffd
ref(various): Remove usage of deprecated `event.stacktrace` (#4885)
timfish Apr 11, 2022
5d38a7e
chore(dev): Update `jest` and friends (#4897)
lobsterkatie Apr 11, 2022
05292b9
fix(dev): Fix unit test debugging configuration (#4915)
lobsterkatie Apr 12, 2022
a9cc619
ref: Port functionality from `Backend` to `Client` (#4911)
Lms24 Apr 12, 2022
43cb4a1
feat(docs): Add section for renaming of CDN bundles (#4918)
Apr 12, 2022
ea09e78
ref(backend): Delete `Backend` classes (#4919)
Lms24 Apr 12, 2022
2ffd78c
fix(wasm): Ensure wasm bundle exists before running wasm tests (#4916)
lobsterkatie Apr 12, 2022
6f09dd7
feat: Expose configurable stack parser (#4902)
timfish Apr 12, 2022
08f50c8
ref(browser): Remove stack parser support for Opera pre v15 (#4923)
timfish Apr 12, 2022
052263b
ref(tracing): Update `setMeasurements` to only set a single measureme…
Apr 13, 2022
b35fed9
feat(tracing): Make `setMeasurement` public API (#4933)
Apr 13, 2022
254e40e
ref(types): Stop using `Severity` enum (#4926)
lobsterkatie Apr 14, 2022
e214325
ref(build): Turn on `isolatedModules` TS option (#4896)
lobsterkatie Apr 14, 2022
3c7faf9
chore(types): Update `@types/jest` (#4929)
lobsterkatie Apr 14, 2022
fa34914
ref: Inject Transports into Client (#4921)
Lms24 Apr 14, 2022
b7c2494
feat(docs): Add `Backend` removal and `Transport` injection to migrat…
Lms24 Apr 14, 2022
b15912a
feat(docs): Add enum removal and deprecation section to migration doc…
Lms24 Apr 14, 2022
ec5ebe9
feat: Add `name` field to `EventProcessor` (#4932)
Apr 14, 2022
362375c
meta: 7.0.0-alpha.1 changelog (#4939)
AbhiPrasad Apr 14, 2022
23f8d6e
release: 7.0.0-alpha.1
getsentry-bot Apr 14, 2022
e5f26a5
chore(gatsby): Create type declarations for gatsby plugin files (#4928)
lobsterkatie Apr 14, 2022
92bf5d3
chore(dev): Remove `tslint` (#4940)
AbhiPrasad Apr 14, 2022
e816c34
ref(test): Switch to `mongodb-memory-server-global` (#4872)
onurtemizkan Apr 14, 2022
9cf57fd
fix(tests): Use non-delayed success endpoints to test `crashed` and `…
onurtemizkan Apr 14, 2022
9f3253d
ref(utils): Remove `forget` async utility function (#4941)
Lms24 Apr 14, 2022
1660047
feat(tracing): Add GB unit to device memory tag value (#4935)
dashed Apr 14, 2022
3f43c39
fix(build): Cache gatsby plugin types files in CI (#4944)
lobsterkatie Apr 14, 2022
d62c758
fix(tests): Fix type errors in tests (#4908)
lobsterkatie Apr 14, 2022
0d811bd
ref(node): Remove `raven-node` backward-compat code (#4942)
AbhiPrasad Apr 18, 2022
fe845d9
ref(build): Split up rollup config code (#4950)
lobsterkatie Apr 19, 2022
34d4ddb
ref(tests): Suppress unconstructive listener and open handle warnings…
onurtemizkan Apr 19, 2022
5ed6066
feat(core): Introduce separate client options (#4927)
AbhiPrasad Apr 19, 2022
1cc0e8a
fix(dev): Check out correct commit in manual GHA `Build & Test` workf…
lobsterkatie Apr 20, 2022
1b32e54
ref(core): Simplify the setup logic of integrations (#4952)
Apr 20, 2022
03d978a
ref(build): Rename CDN bundles to be es6 per default (#4958)
Apr 21, 2022
67cb07a
fix(angular): Use Angular compiler to compile @sentry/angular (#4641)
Lms24 Apr 21, 2022
4581faa
doc(angular): Add Angular migration instructions to migration doc (#4…
Lms24 Apr 21, 2022
deac0eb
ref: Enforce `stackParser` through options. (#4953)
AbhiPrasad Apr 21, 2022
c2ebd42
feat(tracing): Add Prisma ORM integration. (#4931)
onurtemizkan Apr 21, 2022
ec384db
meta(gha): Deploy action `enforce-license-compliance.yml` (#4961)
chadwhitacre Apr 21, 2022
df555d1
fix(dev): Correctly lint `scripts` typescript files (#4963)
lobsterkatie Apr 21, 2022
18257b1
feat(angular): Log warning if SDK is used with an older Angular versi…
Lms24 Apr 22, 2022
b5abe03
ref: Switch to new transports (#4943)
AbhiPrasad Apr 25, 2022
4a35b8d
chore(dev): Update `caniuse-lite` (#4975)
lobsterkatie Apr 26, 2022
8d52e14
chore(dev): Update `ts-node` to 10.7 (#4976)
lobsterkatie Apr 26, 2022
84555ac
fix(build): Replace `git.io` links with redirect targets (#4986)
asottile-sentry Apr 26, 2022
e6a51cb
fix(tracing): Adjust `sideEffects` package.json entry for v7 (#4987)
Lms24 Apr 26, 2022
a8591ea
ref: Delete old transports (#4967)
AbhiPrasad Apr 26, 2022
e0374a3
ref(minimal): Delete `@sentry/minimal` (#4971)
AbhiPrasad Apr 26, 2022
5037d76
fix(nextjs): Fix missing types build in `install-sentry-from-branch` …
kamilogorek Apr 26, 2022
299aeb3
ref: Delete store endpoint code (#4969)
AbhiPrasad Apr 26, 2022
a5c3808
fix(dev): Fix linting for top-level `scripts` folder (#4977)
lobsterkatie Apr 27, 2022
4176bcb
chore: set ignoreSentryErrors to true (#4994)
vladanpaunovic Apr 27, 2022
4ca2de2
ref(tests): Move top-level jest config to `jest` folder (#4978)
lobsterkatie Apr 27, 2022
87cf8c5
fix(tests): Silence dummy output in tests (#4979)
lobsterkatie Apr 27, 2022
8145ce9
ref(nextjs): Update webpack-plugin and change how cli binary is detec…
AbhiPrasad Apr 27, 2022
a71cfb9
fix(dev): Remove eslint cache when cleaning repo (#4980)
lobsterkatie Apr 27, 2022
e86fa94
ref(core): Delete API Details (#4999)
AbhiPrasad Apr 27, 2022
3a512bc
feat(dev): Add VSCode debugger config for ts-node scripts (#4990)
lobsterkatie Apr 27, 2022
7856952
ref: Add argument-less overload to `resolvedSyncPromise` (#5000)
Apr 27, 2022
d619372
fix(hub): Add missing parameter to `captureException` docstring (#5001)
lobsterkatie Apr 27, 2022
c55003f
chore(build): Remove unnecessary `esModuleInterop` settings (#4991)
lobsterkatie Apr 27, 2022
69028bf
ref: Remove unneeded logic from transports (#5002)
Apr 28, 2022
9e46944
ref(build): Switch tsconfig `target` to es6 (#5005)
lobsterkatie Apr 28, 2022
7f04d33
feat(build): Add sucrase build foundations (#4992)
lobsterkatie Apr 28, 2022
aefa9b1
ref: Refactor transport, request, and client report types (#5007)
Apr 28, 2022
ebc938a
fix(serverless): Adjust v6 Lambda layer hotfix for v7 (#5006)
Lms24 Apr 28, 2022
de2822b
feat(transport): Add client report hook to `makeTransport` (#5008)
Apr 28, 2022
389f4ee
ref(browser): Remove showReportDialog on browser client (#4973)
AbhiPrasad Apr 28, 2022
b3fddcd
feat(hub): Remove _invokeClient (#4972)
AbhiPrasad Apr 28, 2022
f979104
docs(transports): Update Migration document with custom Transport cha…
Lms24 Apr 28, 2022
1c5bff0
ref(core): Make event processing logs warnings (#5010)
AbhiPrasad Apr 28, 2022
031ffa7
docs(core): Improve documentation of `Options` and `ClientOptions` pr…
Lms24 Apr 29, 2022
dd1fb29
ref: Record dropped events in `BaseClient` (#5017)
Apr 29, 2022
b450538
ref: Add back client reporting to `BrowserClient` (#5018)
Apr 29, 2022
e16a699
test(tracing): Add Prisma ORM integration tests. (#4962)
onurtemizkan Apr 29, 2022
f18a938
fix(gatsby): Add script to ensure types files exist when testing (#5020)
lobsterkatie Apr 29, 2022
69e6275
fix(build): Fix temporary sucrase CI jobs (#5021)
lobsterkatie Apr 29, 2022
1130c1c
feat(build): Add various rollup plugins to sucrase build (#4993)
lobsterkatie Apr 30, 2022
16356cb
fix(tests): Add `const`-to-`var` ts-jest transformer (#5022)
lobsterkatie May 2, 2022
2df499b
ref: Make it easier to use stackParser (#5015)
AbhiPrasad May 3, 2022
d8fc94c
test(utils): Remove usage of testOnlyIfNodeVersionAtLeast(8) (#5025)
AbhiPrasad May 3, 2022
00c00fa
ref(browser): Don't use Breadcrumbs integration in send event flow (#…
May 3, 2022
39553b5
ref: Remove unused `_sendEvent` method in base client (#5026)
May 3, 2022
c9e8997
meta: 7.0.0-beta.0 CHANGELOG (#5011)
AbhiPrasad May 3, 2022
3532b33
feat: Export browser integrations individually (#5028)
AbhiPrasad May 3, 2022
50361b6
release: 7.0.0-beta.0
getsentry-bot May 3, 2022
add82b4
Merge branch 'release/7.0.0-beta.0' into 7.x
May 4, 2022
1b924e7
chore(browser): Rename `UserAgent` integration to `HttpContext` (#5027)
Lms24 May 4, 2022
794f65b
fix(browser): Change `UserAgent` export to `HttpContext` (#5033)
Lms24 May 4, 2022
6496a11
ref: Remove `critical` severity (#5032)
May 4, 2022
9782d69
ref: Delete unneeded `SDK_NAME` (#5040)
May 5, 2022
419416a
docs(migration): Add TLDR to v7 migration docs (#5041)
May 5, 2022
1e210fe
chore: update sentry logo in readme files (#5045)
mattjohnsonpint May 5, 2022
c9e3602
fix(tracing): Remove `isInstanceOf` check in Hub constructor (#5046)
Lms24 May 6, 2022
8b16378
ref(tracing): Reset IdleTimeout based on activities count (#5044)
AbhiPrasad May 6, 2022
8d475b1
ref(utils): Clean up dangerous type casts in object helper file (#5047)
May 9, 2022
5bd31ac
chore: Add NextJS cli fix to changelog (#5055)
AbhiPrasad May 9, 2022
8d36f0b
ref(utils): Add logic to enable skipping of normalization (#5052)
May 9, 2022
19a9d00
feat(build): Vendor polyfills injected during build (#5051)
lobsterkatie May 9, 2022
904b2d3
fix(integrations): Mark ExtraErrorData as already normalized (#5053)
May 9, 2022
cb9260f
feat(build): Add polyfill-extraction rollup plugin (#5023)
lobsterkatie May 10, 2022
1342c42
ref(node): Explicitly pass down node transport options (#5057)
AbhiPrasad May 10, 2022
52af0b1
ref(browser): Unify BrowserTransportOptions (#5058)
AbhiPrasad May 10, 2022
94554b3
ref(nextjs): Use new build process in vercel script (#5065)
lobsterkatie May 10, 2022
f715933
ref(build): Use rollup/sucrase for non-watch npm builds (#5035)
lobsterkatie May 10, 2022
529650c
chore(build): Handle npm tarballs (#5067)
lobsterkatie May 10, 2022
73ee42b
fix yarn.lock
lobsterkatie May 11, 2022
46400ff
chore(dev): Update `caniuse-lite` (#5069)
lobsterkatie May 11, 2022
5beee11
fix(utils): Consider 429 responses in transports (#5062)
May 11, 2022
656d7c4
ref(hub): Convert `Session` class to object and functions (#5054)
Lms24 May 11, 2022
8c185db
fix(build): Fix references to `rollup.bundle.config.js` (#5074)
lobsterkatie May 11, 2022
7bf6540
fix(tests): Fix node integration test linting and type errors (#5070)
lobsterkatie May 11, 2022
6536eb6
chore(docs): Fix unresolved rebase conflict in Migration.MD (#5076)
Lms24 May 11, 2022
cd71864
feat(react): Add react-router-v6 integration (#5042)
onurtemizkan May 11, 2022
7723d32
ref(build): Use sucrase for `watch` npm builds (#5059)
lobsterkatie May 11, 2022
6b3ea05
ref(build): Improve logging in prepack scripts (#5071)
lobsterkatie May 11, 2022
c8d9905
ref(build): Remove `es5`, `cjs`, and `esm` build commands (#5073)
lobsterkatie May 11, 2022
23982cf
chore(dev): Remove redundant `prepublishOnly` build step in CI (#5083)
lobsterkatie May 12, 2022
e5bfbaa
feat(dev): Add default Node version for CI jobs (#5081)
lobsterkatie May 12, 2022
d9722dc
ref(dev): Use `lerna exec` for top-level `link:yarn` yarn script (#5084)
lobsterkatie May 12, 2022
e39b3f6
feat(build): Add args and templates to rollup debugger plugin (#5085)
lobsterkatie May 12, 2022
042e96e
fix(types): Make `@sentry/types` a runtime dependency in gatsby and n…
lobsterkatie May 12, 2022
f4a1840
ref(utils): Remove `Object.setPrototypeOf` polyfill (#5087)
lobsterkatie May 12, 2022
1badac1
ref(node): Improve Node manual test logging (#5088)
lobsterkatie May 12, 2022
28c09ad
ref(core): Log warning on NOK transport response (#5091)
May 12, 2022
845346a
fix(dev): Restrict size check action to PRs (#5082)
lobsterkatie May 12, 2022
10bca50
meta: 7.0.0-beta.1 changelog (#5092)
AbhiPrasad May 12, 2022
30a9092
release: 7.0.0-beta.1
getsentry-bot May 12, 2022
472a473
Merge branch 'release/7.0.0-beta.1' into 7.x
May 12, 2022
e0ad5c1
fix(ember): Export sha hashes of injected scripts (#5089)
May 13, 2022
5c34152
ref(serverless): Do not throw on flush error (#5090)
May 13, 2022
8a4039d
ref(serverless): Use GitHub action to zip lambda layer (second try) (…
antonpirker May 13, 2022
25aed4d
ref(serverless): Improve handling of SDK version in GitHub action (#5…
antonpirker May 13, 2022
fa7e3b7
ref(serverless): Correctly exit on failed version extraction during b…
kamilogorek May 13, 2022
ce665e2
ref(build): Run repo-level builds in parallel (#5094)
lobsterkatie May 13, 2022
3534f15
ref(dev): Split up top-level `yarn clean` script (#5095)
lobsterkatie May 13, 2022
cac6312
fix(build): Fix express import in `gcpfunction` (#5097)
lobsterkatie May 13, 2022
98bc01a
ref(dev): Consolidate `.gitignore` files (#5096)
lobsterkatie May 13, 2022
78d7304
add changelog entries (#5102)
lobsterkatie May 13, 2022
6b6e746
fix(build): Narrow scope of build cache in GHA (#5105)
lobsterkatie May 17, 2022
774065f
chore(dev): Clean up main tsconfigs (#5114)
lobsterkatie May 17, 2022
797fe90
fix(build): Strip `eslint-enable` comments in rollup plugin (#5112)
lobsterkatie May 17, 2022
95db446
fix(build): Prevent redundant typechecking (#5115)
lobsterkatie May 17, 2022
66a6b59
ref(build): Use sucrase for es6 bundles (#5111)
lobsterkatie May 17, 2022
33e48ca
chore(tests): Fix react `act` warning in tests (#5113)
lobsterkatie May 17, 2022
0a6b4f2
feat(utils): Introduce Baggage API (#5066)
AbhiPrasad May 17, 2022
888f2b8
chore(build): Move aws lambda build step (#5123)
lobsterkatie May 18, 2022
a917dda
fix(build): Ensure bundle builds have needed dependencies (#5119)
lobsterkatie May 18, 2022
efbd343
docs(migration): Add upgrading information for multiple Sentry packag…
Lms24 May 18, 2022
d478c77
feat(core): Send Baggage in Envelope Header (#5104)
Lms24 May 18, 2022
8d08a8b
Change DSN in Lambda Layer to point to relay running in Lambda Extens…
antonpirker May 18, 2022
457b806
feat: Add attachments API (#5004)
timfish May 18, 2022
152e3c5
feat(ci): Add Node 18 to test matrix (#5049)
AbhiPrasad May 19, 2022
263257f
feat(build): Add rollup config for Node bundles (#5142)
lobsterkatie May 20, 2022
7c71013
feat(build): Allow for multiple bundle entrypoints (#5143)
lobsterkatie May 20, 2022
161d302
feat(build): Add ability to combine package-specific rollup config wi…
lobsterkatie May 20, 2022
18af87d
feat(build): Add option to build only specified bundle variants (#5145)
lobsterkatie May 20, 2022
9759e27
ref: Rename baggage env header to trace (#5128)
AbhiPrasad May 23, 2022
d48711f
feat(tracing): Add empty baggage header propagation to outgoing reque…
Lms24 May 23, 2022
945437a
ref(tracing): Reduce metrics bundle size (#5122)
AbhiPrasad May 23, 2022
5a782c3
Deactivated deployment of Lambda Layer until new Lambda Extension is …
antonpirker May 23, 2022
06930f5
meta: Update 7.0.0-beta.2 CHANGELOG (#5137)
AbhiPrasad May 23, 2022
c146db5
release: 7.0.0-beta.2
getsentry-bot May 23, 2022
2808c6e
Merge branch 'release/7.0.0-beta.2' into 7.x
May 23, 2022
bbc9d3d
fix(browser): Fix memory leak in `addEventListener` instrumentation (…
May 24, 2022
fa5712e
fix(tracing): Don't use `querySelector` when not available (#5160)
May 24, 2022
b0950aa
ref(dev): Improve labeling of checkout step in GHA (#5156)
lobsterkatie May 24, 2022
ef9a5d9
ref(core): Remove unnecessary nested `dropUndefinedKeys` call (#5161)
Lms24 May 25, 2022
7b9747f
ref(core): Actually ensure attachments are added to the envelope (#5159)
timfish May 25, 2022
31595e3
ref(core): Make hint callback argument non-optional (#5141)
timfish May 25, 2022
0ad2971
fix(utils): Fix infinite recursion in `dropUndefinedKeys` (#5163)
May 25, 2022
98c2ccc
ref(core): Test mutation of attachments in hint (#5140)
timfish May 25, 2022
549512d
ref(build): Use rollup to build AWS lambda layer (#5146)
lobsterkatie May 25, 2022
2b36cab
feat(nextjs): Make tracing package treeshakable (#5166)
May 25, 2022
1823003
meta: Update 7.0.0-rc.0 CHANGELOG (#5165)
May 25, 2022
8f0cb52
release: 7.0.0-rc.0
getsentry-bot May 25, 2022
23e04f5
Merge branch 'release/7.0.0-rc.0' into 7.x
May 25, 2022
b0919ef
ref(node): Allow node stack parser to work in browser context (#5135)
timfish May 27, 2022
e80ccdc
meta: 7.0.0 CHANGELOG (#5177)
AbhiPrasad May 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(build): Ensure bundle builds have needed dependencies (#5119)
In #5094, a change was made to parallelize our repo-level build commands as much as possible. In that PR, it was stated that `build:bundle` could run independent of, and therefore in parallel with, the types and rollup builds, and at the time that was true. When TS (through rollup) builds a bundle, it creates a giant AST out of the bundled package and all of its monorepo dependencies, based on the original source code, then transpiles the whole thing - no prework needed.

But in #5111 we switched our ES6 bundles to use sucrase for transpilation (still through rollup), and that changed things. Sucrase (along with every other non-TS transpilation tool) only considers files one by one, not as part of a larger whole, and won't reach across package boundaries, even within the monorepo. As a result, rollup needs all dependencies to already exist in transpiled form, since sucrase doesn't touch them, which becomes a problem if both processes are happening at once.

(_But how has CI even been passing since that second PR, then?_, you may ask. The answer is, sucrase is very fast, and lerna can only start so many things at once. It ends up being a race condition between sucrase finishing with the dependencies and lerna kicking off the bundle builds, and almost all the time, sucrase wins. And the other situations in which this is broken all involve using something other than the top-level `build` script to create bundles in a repo with no existing build artifacts, and CI just never does that.)

So TL;DR, we need to have already transpiled a packages's monorepo dependencies before that package can be turned into a bundle. For `build:bundle` at both the repo and package level, and for `build` at the package level, this means that if they're not there, we have to build them. For `build` at the repo level, where transpilation of all packages does in fact already happen, we have two options:
1) Push bundle builds to happen alongside `build:extras`, after rollup builds have finished.
2) Mimic what happens when the race condition is successful, but in a way that isn't flaky. In other words, continue to run `build:bundle` in parallel with the types and npm package builds, but guarantee that the needed dependencies have finished building themselves before starting the bundle build.

Of the two options, the first is certainly simpler, but it also forces the two longest parts of the build (bundle and types builds) to be sequential, which is the exact _opposite_ of what we want, given that the goal all along has been to make the builds noticeably faster. Choosing the second solution also gives us an excuse to add the extra few lines of code needed to fix the repo-level-build:bundle/package-level-build/package-level-build:bundle problem, which we otherwise probably wouldn't fix. 

This implements that second strategy, by polling at 5 second intervals for the existence of the needed files, for up to 60 seconds, before beginning the bundle builds. (In practice, it fairly reliably seems to take two retries, or ten seconds, before the bundle build can begin.) It also handles the other three situations above, by building the missing files when necessary. Finally, it fixes a type import to rely on the main types package, rather than a built version of it. This prevents our ES5 bundles (which still use TS for transpilation, in order to also take advantage of its ability to down-compile) from running to the same problem as the sucrase bundles are having.
  • Loading branch information
lobsterkatie authored May 18, 2022
commit a917ddaf8d71c8ac527925ded7c604e16c6efcb1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"scripts": {
"build": "node ./scripts/verify-packages-versions.js && yarn run-p build:rollup build:types build:bundle && yarn build:extras",
"build:bundle": "lerna run --parallel build:bundle",
"build:bundle": "yarn ts-node scripts/ensure-bundle-deps.ts && yarn lerna run --parallel build:bundle",
"build:dev": "run-p build:types build:rollup",
"build:extras": "lerna run --parallel build:extras",
"build:rollup": "lerna run --parallel build:rollup",
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"scripts": {
"build": "run-p build:rollup build:bundle build:types",
"build:bundle": "rollup --config rollup.bundle.config.js",
"build:bundle": "yarn ts-node ../../scripts/ensure-bundle-deps.ts && yarn rollup --config rollup.bundle.config.js",
"build:dev": "run-p build:rollup build:types",
"build:rollup": "rollup -c rollup.npm.config.js",
"build:types": "tsc -p tsconfig.types.json",
Expand Down
3 changes: 1 addition & 2 deletions packages/hub/src/session.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Session, SessionContext, SessionStatus } from '@sentry/types';
import { SerializedSession } from '@sentry/types/build/types/session';
import { SerializedSession, Session, SessionContext, SessionStatus } from '@sentry/types';
import { dropUndefinedKeys, timestampInSeconds, uuid4 } from '@sentry/utils';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"scripts": {
"build": "run-p build:rollup build:types build:bundle",
"build:bundle": "bash scripts/buildBundles.sh",
"build:bundle": "yarn ts-node ../../scripts/ensure-bundle-deps.ts && bash scripts/buildBundles.sh",
"build:dev": "run-p build:rollup build:types",
"build:rollup": "rollup -c rollup.npm.config.js",
"build:types": "tsc -p tsconfig.types.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/tracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"scripts": {
"build": "run-p build:rollup build:types build:bundle && yarn build:extras #necessary for integration tests",
"build:bundle": "rollup --config rollup.bundle.config.js",
"build:bundle": "yarn ts-node ../../scripts/ensure-bundle-deps.ts && yarn rollup --config rollup.bundle.config.js",
"build:dev": "run-p build:rollup build:types",
"build:extras": "yarn build:prepack",
"build:prepack": "ts-node ../../scripts/prepack.ts --bundles",
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type {
RequestSession,
RequestSessionStatus,
SessionFlusherLike,
SerializedSession,
} from './session';

// eslint-disable-next-line deprecation/deprecation
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"scripts": {
"build": "run-p build:rollup build:types",
"build:bundle": "rollup --config rollup.bundle.config.js",
"build:bundle": "yarn ts-node ../../scripts/ensure-bundle-deps.ts && yarn rollup --config rollup.bundle.config.js",
"build:dev": "run-p build:rollup build:types",
"build:rollup": "rollup -c rollup.npm.config.js",
"build:types": "tsc -p tsconfig.types.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"scripts": {
"build": "run-p build:rollup build:bundle build:types",
"build:bundle": "rollup --config rollup.bundle.config.js",
"build:bundle": "yarn ts-node ../../scripts/ensure-bundle-deps.ts && yarn rollup --config rollup.bundle.config.js",
"build:dev": "run-p build:rollup build:types",
"build:rollup": "rollup -c rollup.npm.config.js",
"build:types": "tsc -p tsconfig.types.json",
Expand Down
155 changes: 155 additions & 0 deletions scripts/ensure-bundle-deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/* eslint-disable no-console */
import * as childProcess from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
import * as util from 'util';

/**
* Ensure that `build:bundle` has all of the dependencies it needs to run. Works at both the repo and package level.
*/
async function ensureBundleBuildPrereqs(options: { dependencies: string[]; maxRetries?: number }): Promise<void> {
const { maxRetries = 12, dependencies } = options;

const {
// The directory in which the yarn command was originally invoked (which won't necessarily be the same as
// `process.cwd()`)
INIT_CWD: yarnInitialDir,
// JSON containing the args passed to `yarn`
npm_config_argv: yarnArgJSON,
} = process.env;

if (!yarnInitialDir || !yarnArgJSON) {
const received = { INIT_CWD: yarnInitialDir, npm_config_argv: yarnArgJSON };
throw new Error(
`Missing environment variables needed for ensuring bundle dependencies. Received:\n${util.inspect(received)}\n`,
);
}

// Did this build get invoked by a repo-level script, or a package-level script, and which script was it?
const isTopLevelBuild = path.basename(yarnInitialDir) === 'sentry-javascript';
const yarnScript = (JSON.parse(yarnArgJSON) as { original: string[] }).original[0];

// convert '@sentry/xyz` to `xyz`
const dependencyDirs = dependencies.map(npmPackageName => npmPackageName.split('/')[1]);

// The second half of the conditional tests if this script is being run by the original top-level command or a
// package-level command spawned by it.
const packagesDir = isTopLevelBuild && yarnInitialDir === process.cwd() ? 'packages' : '..';

if (checkForBundleDeps(packagesDir, dependencyDirs)) {
// We're good, nothing to do, the files we need are there
return;
}

// If we get here, the at least some of the dependencies are missing, but how we handle that depends on how we got
// here. There are six possibilities:
// - We ran `build` or `build:bundle` at the repo level
// - We ran `build` or `build:bundle` at the package level
// - We ran `build` or `build:bundle` at the repo level and lerna then ran `build:bundle` at the package level. (We
// shouldn't ever land here under this scenario - the top-level build should already have handled any missing
// dependencies - but it's helpful to consider all the possibilities.)
//
// In the first version of the first scenario (repo-level `build` -> repo-level `build:bundle`), all we have to do is
// wait, because other parts of `build` are creating them as this check is being done. (Waiting 5 or 10 or even 15
// seconds to start running `build:bundle` in parallel is better than pushing it to the second half of `build`,
// because `build:bundle` is the slowest part of the build and therefore the one we most want to parallelize with
// other slow parts, like `build:types`.)
//
// In all other scenarios, if the dependencies are missing, we have to build them ourselves - with `build:bundle` at
// either level, we're the only thing happening (so no one's going to do it for us), and with package-level `build`,
// types and npm assets are being built simultaneously, but only for the package being bundled, not for its
// dependencies. Either way, it's on us to fix the problem.
//
// TODO: This actually *doesn't* work for package-level `build`, not because of a flaw in this logic, but because
// `build:rollup` has similar dependency needs (it needs types rather than npm builds). We should do something like
// this for that at some point.

if (isTopLevelBuild && yarnScript === 'build') {
let retries = 0;

console.log('\nSearching for bundle dependencies...');

while (retries < maxRetries && !checkForBundleDeps(packagesDir, dependencyDirs)) {
console.log('Bundle dependencies not found. Trying again in 5 seconds.');
retries += 1;
await sleep(5000);
}

if (retries === maxRetries) {
throw new Error(
`\nERROR: \`yarn build:bundle\` (triggered by \`yarn build\`) cannot find its depdendencies, despite waiting ${
5 * maxRetries
} seconds for the rest of \`yarn build\` to create them. Something is wrong - it shouldn't take that long. Exiting.`,
);
}

console.log(`\nFound all bundle dependencies after ${retries} retries. Beginning bundle build...`);
}

// top-level `build:bundle`, package-level `build` and `build:bundle`
else {
console.warn('\nWARNING: Missing dependencies for bundle build. They will be built before continuing.');

for (const dependencyDir of dependencyDirs) {
console.log(`\nBuilding \`${dependencyDir}\` package...`);
run('yarn build:rollup', { cwd: `${packagesDir}/${dependencyDir}` });
}

console.log('\nAll dependencies built successfully. Beginning bundle build...');
}
}

/**
* See if all of the necessary dependencies exist
*/
function checkForBundleDeps(packagesDir: string, dependencyDirs: string[]): boolean {
for (const dependencyDir of dependencyDirs) {
const depBuildDir = `${packagesDir}/${dependencyDir}/build`;

// Checking that the directories exist isn't 100% the same as checking that the files themselves exist, of course,
// but it's a decent proxy, and much simpler to do than checking for individual files.
if (
!(
(fs.existsSync(`${depBuildDir}/cjs`) && fs.existsSync(`${depBuildDir}/esm`)) ||
(fs.existsSync(`${depBuildDir}/npm/cjs`) && fs.existsSync(`${depBuildDir}/npm/esm`))
)
) {
// Fail fast
return false;
}
}

return true;
}

/**
* Wait the given number of milliseconds before continuing.
*/
async function sleep(ms: number): Promise<void> {
await new Promise(resolve =>
setTimeout(() => {
resolve();
}, ms),
);
}

/**
* Run the given shell command, piping the shell process's `stdin`, `stdout`, and `stderr` to that of the current
* process. Returns contents of `stdout`.
*/
function run(cmd: string, options?: childProcess.ExecSyncOptions): string {
return String(childProcess.execSync(cmd, { stdio: 'inherit', ...options }));
}

// TODO: Not ideal that we're hard-coding this, and it's easy to get when we're in a package directory, but would take
// more work to get from the repo level. Fortunately this list is unlikely to change very often, and we're the only ones
// we'll break if it gets out of date.
const dependencies = ['@sentry/utils', '@sentry/hub', '@sentry/core'];

if (['sentry-javascript', 'tracing', 'wasm'].includes(path.basename(process.cwd()))) {
dependencies.push('@sentry/browser');
}

void ensureBundleBuildPrereqs({
dependencies,
});