Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Inline @sentry/core dependency #242

Merged
merged 4 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions .changeset/brown-ears-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@codecov/bundler-plugin-core": minor
"@codecov/astro-plugin": minor
"@codecov/bundle-analyzer": minor
"@codecov/nextjs-webpack-plugin": minor
"@codecov/nuxt-plugin": minor
"@codecov/remix-vite-plugin": minor
"@codecov/rollup-plugin": minor
"@codecov/solidstart-plugin": minor
"@codecov/sveltekit-plugin": minor
"@codecov/vite-plugin": minor
"@codecov/webpack-plugin": minor
---

Inline @sentry/core dependency
2 changes: 1 addition & 1 deletion examples/bundle-analyzer-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"type": "module",
"scripts": {
"build": "rollup -c && pnpm bundle-analyzer ./dist -v --bundle-name=@codecov/example-bundle-analyzer-cli --upload-token=$BUNDLE_ANALYZER_UPLOAD_TOKEN --api-url=$BUNDLE_ANALYZER_API_URL --config-file=./baconfig.json"
"build": "rollup -c && pnpm bundle-analyzer ./dist -v --bundle-name=@codecov/example-bundle-analyzer-cli --upload-token=$BUNDLE_ANALYZER_UPLOAD_TOKEN --api-url=$BUNDLE_ANALYZER_API_URL --config-file=./baconfig.json --debug"
},
"devDependencies": {
"@codecov/bundle-analyzer": "workspace:^",
Expand Down
20 changes: 19 additions & 1 deletion packages/bundler-plugin-core/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,25 @@ export default defineBuildConfig({
},
},
hooks: {
"rollup:options": (_ctx, opts) => {
"rollup:options": (ctx, opts) => {
// We want to ensure that `@sentry/core` is not externalized
// So we do not ship this dependency to users, as this may lead to conflicts with their installed Sentry versions
// TODO: When unbuild is updated to 3.3.0, this can be simplified by configuring `inlineDependencies`
// See: https://github.com/unjs/unbuild/releases/tag/v3.3.0
// Inspired by https://github.com/nuxt/nuxt/blob/f0ce20388d2ab533eba016de0565c150ea3c5172/packages/schema/build.config.ts#L23-L34
ctx.options.rollup.dts.respectExternal = false;
const isExternal = opts.external as (
id: string,
importer?: string,
isResolved?: boolean,
) => boolean;
opts.external = (source, importer, isResolved) => {
if (source === "@sentry/core") {
return false;
}
return isExternal(source, importer, isResolved);
};

if (process.env.PLUGIN_CODECOV_TOKEN && Array.isArray(opts.plugins)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-floating-promises
opts.plugins = [
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-plugin-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@sentry/core": "^8.42.0",
"chalk": "4.1.2",
"semver": "^7.5.4",
"unplugin": "^1.10.1",
"zod": "^3.22.4"
},
"devDependencies": {
"@octokit/webhooks-definitions": "^3.67.3",
"@sentry/core": "^8.42.0",
"@types/node": "^20.11.15",
"@types/semver": "^7.5.6",
"@vitest/coverage-v8": "^2.1.8",
Expand Down
Loading
Loading