Skip to content
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
21 changes: 21 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
run: yarn --frozen-lockfile --ignore-engines
if: steps.dependency-cache.outputs.cache-hit != 'true'
- run: yarn build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifacts-${{ github.run_id }}
path: packages/*/dist
retention-days: 1

type-check:
needs: build
Expand Down Expand Up @@ -112,6 +118,11 @@ jobs:
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines
if: steps.dependency-cache.outputs.cache-hit != 'true'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifacts-${{ github.run_id }}
path: packages
- run: yarn test:unit

test-integration:
Expand Down Expand Up @@ -154,6 +165,11 @@ jobs:
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines
if: steps.dependency-cache.outputs.cache-hit != 'true'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifacts-${{ github.run_id }}
path: packages
- run: yarn test:integration

test-e2e:
Expand Down Expand Up @@ -187,6 +203,11 @@ jobs:
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines
if: steps.dependency-cache.outputs.cache-hit != 'true'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifacts-${{ github.run_id }}
path: packages
- run: yarn test:e2e

lint:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ yarn-error.log
.nxcache
packages/**/yarn.lock

.DS_Store
.DS_Store
packages/bundler-plugin-core/src/version.ts
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
packages/e2e-tests/scenarios/*/ref/**/*
packages/bundler-plugin-core/test/fixtures
.nxcache
# current prettier version doesn't support import assertions
rollup.config.mjs
1 change: 0 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
},
"test": {
"inputs": ["sharedGlobals"],
"dependsOn": ["^build"],
"outputs": []
},
"check:types": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"ts-node": "^10.9.2"
},
"volta": {
"node": "18.20.8",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: Are there any downsides to upgrade to v22 here? In the JS SDK we use v20, and I'm not sure if we can upgrade that easily (maybe we can)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see any downside! We just have to be aware that every CI job that doesn't override the Node version will use this.

"node": "22.22.0",
"yarn": "1.22.22"
}
}
3 changes: 0 additions & 3 deletions packages/babel-plugin-component-annotate/.babelrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/babel-plugin-component-annotate/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const jestPackageJson = require("jest/package.json");
module.exports = {
root: true,
extends: ["@sentry-internal/eslint-config/jest", "@sentry-internal/eslint-config/base"],
ignorePatterns: [".eslintrc.js", "dist", "jest.config.js", "rollup.config.js"],
ignorePatterns: [".eslintrc.js", "dist", "jest.config.js", "rollup.config.mjs"],
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./src/tsconfig.json", "./test/tsconfig.json"],
Expand Down
10 changes: 3 additions & 7 deletions packages/babel-plugin-component-annotate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"scripts": {
"build": "premove ./out && run-p build:rollup build:types",
"build:watch": "run-p build:rollup:watch build:types:watch",
"build:rollup": "rollup --config rollup.config.js",
"build:rollup:watch": "rollup --config rollup.config.js --watch --no-watch.clearScreen",
"build:rollup": "rolldown --config rollup.config.mjs",
"build:rollup:watch": "rolldown --config rollup.config.mjs --watch --no-watch.clearScreen",
"build:types": "tsc --project types.tsconfig.json",
"build:types:watch": "tsc --project types.tsconfig.json --watch --preserveWatchOutput",
"build:npm": "npm pack",
Expand All @@ -51,11 +51,7 @@
},
"devDependencies": {
"@babel/core": "7.18.5",
"@babel/preset-env": "7.18.2",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "7.17.12",
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-node-resolve": "13.3.0",
"@sentry-internal/eslint-config": "4.9.1",
"@sentry-internal/sentry-bundler-plugin-tsconfig": "4.9.1",
"@swc/core": "^1.2.205",
Expand All @@ -66,7 +62,7 @@
"eslint": "^8.18.0",
"jest": "^28.1.1",
"premove": "^4.0.0",
"rollup": "2.75.7",
"rolldown": "^1.0.0-rc.4",
"ts-node": "^10.9.1",
"typescript": "^4.7.4"
},
Expand Down
48 changes: 0 additions & 48 deletions packages/babel-plugin-component-annotate/rollup.config.js

This file was deleted.

22 changes: 22 additions & 0 deletions packages/babel-plugin-component-annotate/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import packageJson from "./package.json" with { type: "json" };
import modulePackage from "module";

export default {
platform: "node",
input: ["src/index.ts"],
external: Object.keys(packageJson.dependencies ?? []),
output: [
{
file: packageJson.module,
format: "esm",
exports: "named",
sourcemap: true,
},
{
file: packageJson.main,
format: "cjs",
exports: "named",
sourcemap: true,
},
],
};
3 changes: 0 additions & 3 deletions packages/bundler-plugin-core/.babelrc.json

This file was deleted.

5 changes: 1 addition & 4 deletions packages/bundler-plugin-core/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
".eslintrc.js",
"dist",
"jest.config.js",
"rollup.config.js",
"rollup.config.mjs",
"test/fixtures/**/*",
"sentry-release-injection-file.js",
"sentry-esbuild-debugid-injection-file.js",
Expand All @@ -17,9 +17,6 @@ module.exports = {
tsconfigRootDir: __dirname,
project: ["./src/tsconfig.json", "./test/tsconfig.json"],
},
globals: {
__PACKAGE_VERSION__: "readonly",
},
env: {
node: true,
},
Expand Down
17 changes: 1 addition & 16 deletions packages/bundler-plugin-core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@ module.exports = {
testEnvironment: "node",
modulePathIgnorePatterns: ["fixtures"],
transform: {
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
jsc: {
transform: {
optimizer: {
globals: {
vars: {
__PACKAGE_VERSION__: packageJson.version,
},
},
},
},
},
},
],
"^.+\\.(t|j)sx?$": ["@swc/jest"],
},
};
14 changes: 5 additions & 9 deletions packages/bundler-plugin-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
"module": "dist/esm/index.mjs",
"types": "dist/types/index.d.ts",
"scripts": {
"prebuild": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
"build": "premove ./out && run-p build:rollup build:types",
"build:watch": "run-p build:rollup:watch build:types:watch",
"build:rollup": "rollup --config rollup.config.js",
"build:rollup:watch": "rollup --config rollup.config.js --watch --no-watch.clearScreen",
"build:rollup": "rolldown --config rollup.config.mjs",
"build:rollup:watch": "rolldown --config rollup.config.mjs --watch --no-watch.clearScreen",
"build:types": "tsc --project types.tsconfig.json",
"build:types:watch": "tsc --project types.tsconfig.json --watch --preserveWatchOutput",
"build:npm": "npm pack",
Expand All @@ -47,6 +48,7 @@
"clean:all": "run-p clean clean:deps",
"clean:build": "premove ./dist *.tgz",
"clean:deps": "premove node_modules",
"pretest": "yarn prebuild",
"test": "jest",
"lint": "eslint ./src ./test",
"fix": "eslint ./src ./test --format stylish --fix"
Expand All @@ -61,12 +63,6 @@
"magic-string": "0.30.8"
},
"devDependencies": {
"@babel/preset-env": "7.18.2",
"@babel/preset-typescript": "7.17.12",
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@sentry-internal/eslint-config": "4.9.1",
"@sentry-internal/sentry-bundler-plugin-tsconfig": "4.9.1",
"@sentry/core": "8.30.0",
Expand All @@ -79,7 +75,7 @@
"eslint": "^8.18.0",
"jest": "^28.1.1",
"premove": "^4.0.0",
"rollup": "2.75.7",
"rolldown": "^1.0.0-rc.4",
"typescript": "^4.7.4"
},
"volta": {
Expand Down
56 changes: 0 additions & 56 deletions packages/bundler-plugin-core/rollup.config.js

This file was deleted.

22 changes: 22 additions & 0 deletions packages/bundler-plugin-core/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import modulePackage from "module";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The Rollup config for bundler-plugin-core doesn't mark Node.js built-in modules as external, which will cause them to be incorrectly bundled and lead to runtime errors.
Severity: HIGH

Suggested Fix

Update the external array in packages/bundler-plugin-core/rollup.config.mjs to include Node.js built-in modules. Change external: Object.keys(packageJson.dependencies) to external: [...Object.keys(packageJson.dependencies), ...modulePackage.builtinModules]. This will correctly mark the built-ins as external, preventing them from being bundled.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/bundler-plugin-core/rollup.config.mjs#L1

Potential issue: The `rollup.config.mjs` for `bundler-plugin-core` fails to list Node.js
built-in modules like `fs`, `os`, `path`, and `crypto` in its `external` configuration.
The package's source code uses these modules. Consequently, Rollup will attempt to
bundle these built-ins instead of treating them as external dependencies. This will lead
to runtime errors when the distributed bundle is consumed by other tools, as the
references to these Node.js modules will not be resolved correctly.

Copy link
Collaborator Author

@timfish timfish Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total rubbish, Rolldown handles this with the node platform. Here is the build output:

image

import packageJson from "./package.json" with { type: "json" };

export default {
platform: "node",
input: ["src/index.ts"],
external: Object.keys(packageJson.dependencies),
output: [
{
file: packageJson.module,
format: "esm",
exports: "named",
sourcemap: true,
},
{
file: packageJson.main,
format: "cjs",
exports: "named",
sourcemap: true,
},
],
};
5 changes: 2 additions & 3 deletions packages/bundler-plugin-core/src/build-plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
} from "./utils";
import { glob } from "glob";
import { defaultRewriteSourcesHook, prepareBundleForDebugIdUpload } from "./debug-id-upload";
import { LIB_VERSION } from "./version";

// Module-level guard to prevent duplicate deploy records when multiple bundler plugin
// instances run in the same process (e.g. Next.js creates separate webpack compilers
Expand Down Expand Up @@ -238,9 +239,7 @@ export function createSentryBuildPluginManager(
});

// Set the User-Agent that Sentry CLI will use when interacting with Sentry
process.env[
"SENTRY_PIPELINE"
] = `${bundlerPluginMetaContext.buildTool}-plugin/${__PACKAGE_VERSION__}`;
process.env["SENTRY_PIPELINE"] = `${bundlerPluginMetaContext.buildTool}-plugin/${LIB_VERSION}`;

// Propagate debug flag to Sentry CLI via environment variable
// Only set if not already defined to respect user's explicit configuration
Expand Down
5 changes: 0 additions & 5 deletions packages/bundler-plugin-core/src/globals.d.ts

This file was deleted.

Loading
Loading