Skip to content

Commit 2ac8f9e

Browse files
committed
resolve merge conflict
2 parents 0e8c329 + b2a0529 commit 2ac8f9e

Some content is hidden

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

56 files changed

+1497
-500
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ jobs:
230230
- name: pack
231231
run: yarn build:npm
232232
- name: archive artifacts
233-
uses: actions/upload-artifact@v3
233+
uses: actions/upload-artifact@v4
234234
with:
235235
name: ${{ github.sha }}
236236
path: |

.github/workflows/release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@ jobs:
1616
runs-on: ubuntu-latest
1717
name: "Release a new version"
1818
steps:
19+
- name: Get auth token
20+
id: token
21+
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
22+
with:
23+
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
24+
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
1925
- uses: actions/checkout@v4
2026
with:
21-
token: ${{ secrets.GH_RELEASE_PAT }}
27+
token: ${{ steps.token.outputs.token }}
2228
fetch-depth: 0
2329
- name: Prepare release
2430
uses: getsentry/action-prepare-release@v1
2531
env:
26-
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }}
32+
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
2733
with:
2834
version: ${{ github.event.inputs.version }}
2935
force: ${{ github.event.inputs.force }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules
22
yarn-error.log
33

44
.vscode/settings.json
5+
.idea
56

67
*.tgz
78

CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,53 @@
44

55
- "You know what they say ‘Fool me once, strike one, but fool me twice… strike three.’" — Michael Scott
66

7+
## 2.22.7
8+
9+
- deps: Bump `@sentry/cli` to `2.39.1` and require specific version (#632)
10+
- feat(telemetry): Record if plugin is run in CI (#627)
11+
12+
## 2.22.6
13+
14+
- fix(core): Use sha256 instead of md5 to generate uuids from string (#619)
15+
16+
## 2.22.5
17+
18+
- fix: Ignore stderr output from git command (#613)
19+
- feat: Update Sentry telemetry to v8 (#604)
20+
- deps: Update `@sentry/cli` to `2.36.1` (#609)
21+
22+
## 2.22.4
23+
24+
- feat(react-component-annotate): Handle function body returning a ternary (#598)
25+
- fix: Allow injection plugins to apply to files with query parameters and fragments in their name (#597)
26+
27+
Work in this release contributed by @Thristhart. Thank you for your contribution!
28+
29+
## 2.22.3
30+
31+
- fix(core): Always instantiate global `Error` class in injected code snippets (#594)
32+
33+
## 2.22.2
34+
35+
- fix: Disable debug ID injection when `sourcemaps.disable` is set (#589)
36+
37+
## 2.22.1
38+
39+
- fix: Use `sourcemaps.disable` to disable debug ID upload instead of legacy upload (#587)
40+
- fix: Escape release string in injection snippet (#585)
41+
42+
## 2.22.0
43+
44+
- deps: Bump `@sentry/cli` to `2.33.1` (#581)
45+
- feat: Add `bundleSizeOptimizations.excludeTracing` option as alias to deprecated `bundleSizeOptimizations.excludePerformanceMonitoring` (#582)
46+
- fix(vite-plugin): Ensure `post` order of `sentry-vite-release-injection-plugin` to avoid breaking `@rollup/plugin-commonjs` step (#578)
47+
48+
## 2.21.1
49+
50+
- fix: Do not delete files before all upload tasks executed (#572)
51+
52+
Work in this release contributed by @tyouzu1. Thank you for your contribution!
53+
754
## 2.21.0
855

956
- fix: Use `sequential` and `post` order for vite artifact deletion (#568)

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "2.21.0",
3+
"version": "2.22.7",
44
"npmClient": "yarn",
55
"useWorkspaces": true
66
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/babel-plugin-component-annotate",
3-
"version": "2.21.0",
3+
"version": "2.22.7",
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",
@@ -56,8 +56,8 @@
5656
"@babel/preset-typescript": "7.17.12",
5757
"@rollup/plugin-babel": "5.3.1",
5858
"@rollup/plugin-node-resolve": "13.3.0",
59-
"@sentry-internal/eslint-config": "2.21.0",
60-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.21.0",
59+
"@sentry-internal/eslint-config": "2.22.7",
60+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.22.7",
6161
"@swc/core": "^1.2.205",
6262
"@swc/jest": "^0.2.21",
6363
"@types/jest": "^28.1.3",

packages/babel-plugin-component-annotate/src/index.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export default function componentNameAnnotatePlugin({ types: t }: typeof Babel):
8282
ArrowFunctionExpression(path, state) {
8383
// We're expecting a `VariableDeclarator` like `const MyComponent =`
8484
const parent = path.parent;
85+
8586
if (
8687
!parent ||
8788
!("id" in parent) ||
@@ -187,6 +188,36 @@ function functionBodyPushAttributes(
187188
return;
188189
}
189190

191+
// Handle the case of a function body returning a ternary operation.
192+
// `return (maybeTrue ? '' : (<SubComponent />))`
193+
if (arg.isConditionalExpression()) {
194+
const consequent = arg.get("consequent");
195+
if (consequent.isJSXFragment() || consequent.isJSXElement()) {
196+
processJSX(
197+
annotateFragments,
198+
t,
199+
consequent,
200+
componentName,
201+
sourceFileName,
202+
attributeNames,
203+
ignoredComponents
204+
);
205+
}
206+
const alternate = arg.get("alternate");
207+
if (alternate.isJSXFragment() || alternate.isJSXElement()) {
208+
processJSX(
209+
annotateFragments,
210+
t,
211+
alternate,
212+
componentName,
213+
sourceFileName,
214+
attributeNames,
215+
ignoredComponents
216+
);
217+
}
218+
return;
219+
}
220+
190221
if (!arg.isJSXFragment() && !arg.isJSXElement()) {
191222
return;
192223
}
@@ -221,7 +252,6 @@ function processJSX(
221252
if (!jsxNode) {
222253
return;
223254
}
224-
225255
// NOTE: I don't know of a case where `openingElement` would have more than one item,
226256
// but it's safer to always iterate
227257
const paths = jsxNode.get("openingElement");

packages/babel-plugin-component-annotate/test/__snapshots__/test-plugin.test.ts.snap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,16 @@ class componentName extends Component {
223223
export default componentName;"
224224
`;
225225

226+
exports[`handles ternary operation returned by function body 1`] = `
227+
"const maybeTrue = Math.random() > 0.5;
228+
export default function componentName() {
229+
return maybeTrue ? '' : /*#__PURE__*/React.createElement(SubComponent, {
230+
\\"data-sentry-element\\": \\"SubComponent\\",
231+
\\"data-sentry-component\\": \\"componentName\\"
232+
});
233+
}"
234+
`;
235+
226236
exports[`nonJSX snapshot matches 1`] = `
227237
"import React, { Component } from 'react';
228238
class TestClass extends Component {

packages/babel-plugin-component-annotate/test/test-plugin.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,3 +1173,45 @@ it("skips components marked in ignoreComponents", () => {
11731173
});"
11741174
`);
11751175
});
1176+
1177+
it("Bananas incompatible plugin @react-navigation source snapshot matches", () => {
1178+
const result = transform(BananasStandardInput, {
1179+
filename: "test/node_modules/@react-navigation/core/filename-test.js",
1180+
presets: ["@babel/preset-react"],
1181+
plugins: [[plugin, { native: true }]],
1182+
});
1183+
expect(result?.code).toMatchInlineSnapshot(`
1184+
"import React, { Component } from 'react';
1185+
import { Image } from 'react-native';
1186+
class Bananas extends Component {
1187+
render() {
1188+
let pic = {
1189+
uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'
1190+
};
1191+
return /*#__PURE__*/React.createElement(Image, {
1192+
source: pic,
1193+
style: {
1194+
width: 193,
1195+
height: 110,
1196+
marginTop: 10
1197+
},
1198+
fsClass: \\"test-class\\"
1199+
});
1200+
}
1201+
}"
1202+
`);
1203+
});
1204+
1205+
it("handles ternary operation returned by function body", () => {
1206+
const result = transform(
1207+
`const maybeTrue = Math.random() > 0.5;
1208+
export default function componentName() {
1209+
return (maybeTrue ? '' : (<SubComponent />))
1210+
}`,
1211+
{
1212+
presets: ["@babel/preset-react"],
1213+
plugins: [[plugin, { "annotate-fragments": true }]],
1214+
}
1215+
);
1216+
expect(result?.code).toMatchSnapshot();
1217+
});

packages/bundler-plugin-core/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/bundler-plugin-core",
3-
"version": "2.21.0",
3+
"version": "2.22.7",
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",
@@ -53,8 +53,8 @@
5353
},
5454
"dependencies": {
5555
"@babel/core": "^7.18.5",
56-
"@sentry/babel-plugin-component-annotate": "2.21.0",
57-
"@sentry/cli": "^2.22.3",
56+
"@sentry/babel-plugin-component-annotate": "2.22.7",
57+
"@sentry/cli": "2.39.1",
5858
"dotenv": "^16.3.1",
5959
"find-up": "^5.0.0",
6060
"glob": "^9.3.2",
@@ -68,10 +68,11 @@
6868
"@rollup/plugin-json": "4.1.0",
6969
"@rollup/plugin-node-resolve": "13.3.0",
7070
"@rollup/plugin-replace": "^4.0.0",
71-
"@sentry-internal/eslint-config": "2.21.0",
72-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.21.0",
73-
"@sentry/node": "7.102.0",
74-
"@sentry/utils": "7.102.0",
71+
"@sentry-internal/eslint-config": "2.22.7",
72+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.22.7",
73+
"@sentry/core": "8.30.0",
74+
"@sentry/types": "8.30.0",
75+
"@sentry/utils": "8.30.0",
7576
"@swc/core": "^1.2.205",
7677
"@swc/jest": "^0.2.21",
7778
"@types/jest": "^28.1.3",

0 commit comments

Comments
 (0)