Skip to content

Commit 2bec1be

Browse files
authored
Merge branch 'main' into fix/747-esbuild-default-export-warning
2 parents 98321cb + 2d6e401 commit 2bec1be

432 files changed

Lines changed: 7397 additions & 1493 deletions

File tree

Some content is hidden

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

.github/workflows/checks.yml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -190,44 +190,6 @@ jobs:
190190
path: packages
191191
- run: yarn test:integration-next
192192

193-
test-e2e:
194-
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks
195-
# Dependabot PRs sadly also don't have access to secrets, so we skip them as well
196-
if:
197-
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
198-
github.actor != 'dependabot[bot]' &&
199-
false # Debug ID backend changes broke the E2E tests, we need to revisit them
200-
needs: build
201-
name: E2E Tests
202-
runs-on: ubuntu-latest
203-
env:
204-
SENTRY_AUTH_TOKEN: ${{ secrets.E2E_TESTS_SENTRY_AUTH_TOKEN }}
205-
steps:
206-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
207-
- uses: volta-cli/action@007b1509d3ea9999dbba62ca34f4eb968363bb78 # v3
208-
- name: Use dependency cache
209-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
210-
id: dependency-cache
211-
with:
212-
path: "**/node_modules"
213-
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }}
214-
- name: Use build cache
215-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
216-
with:
217-
path: .nxcache
218-
key: build-cache-key-${{ runner.os }}-${{ matrix.target }}-${{ matrix.jobIndex }}-${{ github.run_id }}
219-
restore-keys: |
220-
build-cache-key-${{ runner.os }}-${{ matrix.target }}-${{ matrix.jobIndex }}-
221-
- name: Install dependencies
222-
run: yarn --frozen-lockfile --ignore-engines
223-
if: steps.dependency-cache.outputs.cache-hit != 'true'
224-
- name: Download build artifacts
225-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
226-
with:
227-
name: dist-artifacts-${{ github.run_id }}
228-
path: packages
229-
- run: yarn test:e2e
230-
231193
lint:
232194
needs: build
233195
name: Linter check

.oxfmtrc.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@
33
"printWidth": 100,
44
"experimentalSortPackageJson": false,
55
"trailingComma": "es5",
6-
"ignorePatterns": [
7-
"packages/e2e-tests/scenarios/*/ref/**/*",
8-
"packages/bundler-plugin-core/test/fixtures",
9-
".nxcache"
10-
]
6+
"ignorePatterns": ["packages/bundler-plugin-core/test/fixtures", ".nxcache"]
117
}

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Changelog
22

3+
## 5.2.0
4+
5+
### New Features ✨
6+
7+
- (core) Pass `mapDir` to `rewriteSourcesHook` by @chargome in [#908](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/908)
8+
- Use `crypto.randomUUID` rather than `uuid` by @timfish in [#892](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/892)
9+
10+
### Bug Fixes 🐛
11+
12+
- (core) Conditionally add tracing headers by @chargome in [#907](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/907)
13+
- (e2e-tests) Pin axios to 1.13.5 to avoid compromised 1.14.1 by @andreiborza in [#906](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/906)
14+
- (rollup) Make rollup an optional peer dependency by @andreiborza in [#913](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/913)
15+
- Add missing webpack5 entrypoint in webpack-plugin by @brunodccarvalho in [#905](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/905)
16+
17+
### Internal Changes 🔧
18+
19+
- (deps) Bump vulnerable webpack version by @chargome in [#909](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/909)
20+
- (tests) Use deterministic debugids by @chargome in [#912](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/912)
21+
- Add esbuild integration tests by @timfish in [#911](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/911)
22+
- Vite integration tests by @timfish in [#899](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/899)
23+
- Webpack integration tests by @timfish in [#904](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/904)
24+
- Isolate integration test package installs by @timfish in [#902](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/902)
25+
- Pin GitHub Actions to full-length commit SHAs by @joshuarli in [#900](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/900)
26+
- Rollup integration tests by @timfish in [#897](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/897)
27+
- New integration tests by @timfish in [#896](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/896)
28+
- Remove lerna by @timfish in [#895](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/895)
29+
- Migrate to Vitest by @timfish in [#894](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/894)
30+
331
## 5.1.1
432

533
### Bug Fixes 🐛

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"packages/babel-plugin-component-annotate",
1010
"packages/bundler-plugin-core",
1111
"packages/dev-utils",
12-
"packages/e2e-tests",
1312
"packages/esbuild-plugin",
1413
"packages/eslint-configs",
1514
"packages/integration-tests",
@@ -28,12 +27,10 @@
2827
"check:types": "nx run-many --target=check:types --all",
2928
"clean": "nx run-many --target=clean --all",
3029
"clean:all": "nx run-many --target=clean:all --all && yarn",
31-
"test": "nx run-many --target=test --all --exclude=@sentry-internal/bundler-plugin-e2e-tests",
32-
"test:all": "nx run-many --target=test --all",
33-
"test:unit": "nx run-many --target=test --all --exclude=@sentry-internal/integration-tests,@sentry-internal/integration-tests-next,@sentry-internal/bundler-plugin-e2e-tests",
30+
"test": "nx run-many --target=test --all",
31+
"test:unit": "nx run-many --target=test --all --exclude=@sentry-internal/integration-tests,@sentry-internal/integration-tests-next",
3432
"test:integration": "nx run @sentry-internal/integration-tests:test",
3533
"test:integration-next": "nx run @sentry-internal/integration-tests-next:test",
36-
"test:e2e": "nx run @sentry-internal/bundler-plugin-e2e-tests:test",
3734
"lint": "nx run-many --target=lint --all",
3835
"check:formatting": "oxfmt --check .",
3936
"fix:formatting": "oxfmt ."

packages/babel-plugin-component-annotate/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/babel-plugin-component-annotate",
3-
"version": "5.1.1",
3+
"version": "5.2.0",
44
"description": "A Babel plugin that annotates frontend components with additional data to enrich the experience in Sentry",
55
"repository": "git://github.com/getsentry/sentry-javascript-bundler-plugins.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript-bundler-plugins/tree/main/packages/babel-plugin-component-annotate",
@@ -52,13 +52,13 @@
5252
"devDependencies": {
5353
"@babel/core": "7.18.5",
5454
"@babel/preset-react": "^7.23.3",
55-
"@sentry-internal/eslint-config": "5.1.1",
56-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "5.1.1",
55+
"@sentry-internal/eslint-config": "5.2.0",
56+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "5.2.0",
5757
"@types/node": "^18.6.3",
5858
"eslint": "^8.18.0",
5959
"vitest": "^4.0.0",
6060
"premove": "^4.0.0",
61-
"rolldown": "^1.0.0-rc.6",
61+
"rolldown": "1.0.0-rc.10",
6262
"ts-node": "^10.9.1",
6363
"typescript": "^4.7.4"
6464
},

packages/bundler-plugin-core/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/bundler-plugin-core",
3-
"version": "5.1.1",
3+
"version": "5.2.0",
44
"description": "Sentry Bundler Plugin Core",
55
"repository": "git://github.com/getsentry/sentry-javascript-bundler-plugins.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript-bundler-plugins/tree/main/packages/bundler-plugin-core",
@@ -55,24 +55,24 @@
5555
},
5656
"dependencies": {
5757
"@babel/core": "^7.18.5",
58-
"@sentry/babel-plugin-component-annotate": "5.1.1",
58+
"@sentry/babel-plugin-component-annotate": "5.2.0",
5959
"@sentry/cli": "^2.58.5",
6060
"dotenv": "^16.3.1",
6161
"find-up": "^5.0.0",
6262
"glob": "^13.0.6",
6363
"magic-string": "~0.30.8"
6464
},
6565
"devDependencies": {
66-
"@sentry-internal/eslint-config": "5.1.1",
67-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "5.1.1",
66+
"@sentry-internal/eslint-config": "5.2.0",
67+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "5.2.0",
6868
"@sentry/core": "8.30.0",
6969
"@sentry/types": "8.30.0",
7070
"@sentry/utils": "8.30.0",
7171
"@types/node": "^18.6.3",
7272
"eslint": "^8.18.0",
7373
"vitest": "^4.0.0",
7474
"premove": "^4.0.0",
75-
"rolldown": "^1.0.0-rc.6",
75+
"rolldown": "1.0.0-rc.10",
7676
"typescript": "^4.7.4"
7777
},
7878
"volta": {

packages/bundler-plugin-core/src/build-plugin-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function createCliInstance(options: NormalizedOptions): SentryCli {
117117
url: options.url,
118118
vcsRemote: options.release.vcsRemote,
119119
headers: {
120-
...getTraceData(),
120+
...(options.telemetry ? getTraceData() : {}),
121121
...options.headers,
122122
},
123123
});

packages/bundler-plugin-core/src/debug-id-upload.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,10 @@ async function prepareSourceMapForDebugIdUpload(
219219
}
220220

221221
if (map["sources"] && Array.isArray(map["sources"])) {
222-
map["sources"] = map["sources"].map((source: string) => rewriteSourcesHook(source, map));
222+
const mapDir = path.dirname(sourceMapPath);
223+
map["sources"] = map["sources"].map((source: string) =>
224+
rewriteSourcesHook(source, map, { mapDir })
225+
);
223226
}
224227

225228
try {

packages/bundler-plugin-core/src/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ export interface Options {
138138
/**
139139
* Hook to rewrite the `sources` field inside the source map before being uploaded to Sentry. Does not modify the actual source map.
140140
*
141+
* The hook receives the source path, the parsed source map object, and a context object containing `mapDir` -
142+
* the directory of the source map file, useful for resolving relative source paths.
143+
*
141144
* Defaults to making all sources relative to `process.cwd()` while building.
142145
*/
143146
rewriteSources?: RewriteSourcesHook;
@@ -427,7 +430,7 @@ export interface Options {
427430
}
428431

429432
// eslint-disable-next-line @typescript-eslint/no-explicit-any
430-
export type RewriteSourcesHook = (source: string, map: any) => string;
433+
export type RewriteSourcesHook = (source: string, map: any, context?: { mapDir: string }) => string;
431434

432435
export type ResolveSourceMapHook = (
433436
artifactPath: string,

packages/bundler-plugin-core/test/build-plugin-manager.test.ts

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ import { globFiles } from "../src/glob";
77
import { prepareBundleForDebugIdUpload } from "../src/debug-id-upload";
88
import { describe, it, expect, afterEach, beforeEach, vi, MockedFunction } from "vitest";
99

10-
const { mockCliExecute, mockCliUploadSourceMaps, mockCliNewDeploy } = vi.hoisted(() => ({
11-
mockCliExecute: vi.fn(),
12-
mockCliUploadSourceMaps: vi.fn(),
13-
mockCliNewDeploy: vi.fn(),
14-
}));
10+
const { mockCliExecute, mockCliUploadSourceMaps, mockCliNewDeploy, mockCliConstructor } =
11+
vi.hoisted(() => ({
12+
mockCliExecute: vi.fn(),
13+
mockCliUploadSourceMaps: vi.fn(),
14+
mockCliNewDeploy: vi.fn(),
15+
mockCliConstructor: vi.fn(),
16+
}));
1517

1618
vi.mock("@sentry/cli", () => ({
1719
default: class {
20+
constructor(...args: unknown[]) {
21+
mockCliConstructor(...args);
22+
}
1823
execute = mockCliExecute;
1924
releases = {
2025
uploadSourceMaps: mockCliUploadSourceMaps,
@@ -640,6 +645,41 @@ describe("createSentryBuildPluginManager", () => {
640645
});
641646
});
642647

648+
describe("telemetry option", () => {
649+
it("should not pass sentry-trace or baggage headers to CLI when telemetry is false", async () => {
650+
mockCliExecute.mockResolvedValue(undefined);
651+
652+
const buildPluginManager = createSentryBuildPluginManager(
653+
{
654+
authToken: "test-token",
655+
org: "test-org",
656+
project: "test-project",
657+
telemetry: false,
658+
},
659+
{
660+
buildTool: "webpack",
661+
loggerPrefix: "[sentry-webpack-plugin]",
662+
}
663+
);
664+
665+
// Trigger a CLI operation so createCliInstance is called
666+
await buildPluginManager.injectDebugIds(["/path/to/bundle"]);
667+
668+
// Find the CLI constructor call that was made by createCliInstance (not the one from allowedToSendTelemetry)
669+
const cliConstructorCalls = mockCliConstructor.mock.calls;
670+
expect(cliConstructorCalls.length).toBeGreaterThan(0);
671+
672+
// Check that none of the CLI instances were created with sentry-trace or baggage headers
673+
for (const call of cliConstructorCalls) {
674+
const options = call[1] as { headers?: Record<string, string> };
675+
if (options?.headers) {
676+
expect(options.headers).not.toHaveProperty("sentry-trace");
677+
expect(options.headers).not.toHaveProperty("baggage");
678+
}
679+
}
680+
});
681+
});
682+
643683
describe("createRelease deploy deduplication", () => {
644684
beforeEach(() => {
645685
vi.clearAllMocks();

0 commit comments

Comments
 (0)