feat(astro): Add sentryAstro
integration
#9218
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the
sentryAstro
Astro integration which will be the core component of the Astro SDK.The integration takes care of a few things:
clientInitPath
option is set, it will inject the file content from the specified file pathsentry.(client|server).config.(ts|js)
file is found in the root dir, the file content will be injectedThe idea is: Basic SDK setup will only require
sentryAstro
to be added by users. Everything else happens automatically. We also support a more custom setup but it will require additional config files. The reason is that we can only inject serialized code. We cannot take e.g. function callbacks (e.g.beforeSend
) in the options ofsentryAstro
.For more details how to set up the SDK, feel free to take a look at the README.
UPDATE: To satisfy Astros soft requirement of making the integration the default integration of the package, I decided to actually transiple the integration with the rest of the code. Therefore, I removed the "integration sync" logic that was initially in this PR. To make this work, I slightly adjusted our NPM rollup config to opt out of adding polyfills. These caused problems in Astro and are not necessary (Astro is Node 18+, so no need for polyfills injected by Sucrase).
This also means that this integration will be correctly installed when running
npx astro add @sentry/astro
. So we basically get half a wizard for free 🎉ref #9182