Skip to content

Commit 17262ea

Browse files
authored
ref(bundler-plugins): Keep the Babel plugin export for React Native
1 parent 051900c commit 17262ea

19 files changed

Lines changed: 7119 additions & 337 deletions

‎dev-packages/bundler-plugin-integration-tests/fixtures/rollup3/build-info.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles }) => {
66
expect(readOutputFiles()).toMatchInlineSnapshot(`
77
{
88
"basic.js": "// eslint-disable-next-line no-console
9-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"build-information-injection-test"};e.SENTRY_BUILD_INFO={"deps":["@babel/preset-react","@rollup/plugin-babel","@rollup/plugin-node-resolve","@sentry/bundler-plugins","react","rollup"],"depsVersions":{"react":19,"rollup":3},"nodeVersion":"NODE_VERSION"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00000000-0000-0000-0000-000000000000",e._sentryDebugIdIdentifier="sentry-dbid-00000000-0000-0000-0000-000000000000");}catch(e){}}();console.log("hello world");
9+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"build-information-injection-test"};e.SENTRY_BUILD_INFO={"deps":["@rollup/plugin-babel","@rollup/plugin-node-resolve","@sentry/bundler-plugins","react","rollup"],"depsVersions":{"react":19,"rollup":3},"nodeVersion":"NODE_VERSION"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00000000-0000-0000-0000-000000000000",e._sentryDebugIdIdentifier="sentry-dbid-00000000-0000-0000-0000-000000000000");}catch(e){}}();console.log("hello world");
1010
",
1111
}
1212
`);

‎dev-packages/bundler-plugin-integration-tests/fixtures/rollup3/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"react": "19.2.4",
88
"rollup": "3.30.0",
99
"@rollup/plugin-babel": "6.0.4",
10-
"@babel/preset-react": "7.23.3",
1110
"@rollup/plugin-node-resolve": "15.2.3",
1211
"@sentry/bundler-plugins": "10.67.0"
1312
},

‎dev-packages/bundler-plugin-integration-tests/fixtures/rollup4/build-info.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles }) => {
66
expect(readOutputFiles()).toMatchInlineSnapshot(`
77
{
88
"basic.js": "// eslint-disable-next-line no-console
9-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"build-information-injection-test"};e.SENTRY_BUILD_INFO={"deps":["@babel/preset-react","@rollup/plugin-babel","@rollup/plugin-node-resolve","@sentry/bundler-plugins","react","rollup"],"depsVersions":{"react":19,"rollup":4},"nodeVersion":"NODE_VERSION"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00000000-0000-0000-0000-000000000000",e._sentryDebugIdIdentifier="sentry-dbid-00000000-0000-0000-0000-000000000000");}catch(e){}}();console.log("hello world");
9+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"build-information-injection-test"};e.SENTRY_BUILD_INFO={"deps":["@rollup/plugin-babel","@rollup/plugin-node-resolve","@sentry/bundler-plugins","react","rollup"],"depsVersions":{"react":19,"rollup":4},"nodeVersion":"NODE_VERSION"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00000000-0000-0000-0000-000000000000",e._sentryDebugIdIdentifier="sentry-dbid-00000000-0000-0000-0000-000000000000");}catch(e){}}();console.log("hello world");
1010
",
1111
}
1212
`);

‎dev-packages/bundler-plugin-integration-tests/fixtures/rollup4/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"react": "19.2.4",
88
"rollup": "4.59.0",
99
"@rollup/plugin-babel": "6.0.4",
10-
"@babel/preset-react": "7.23.3",
1110
"@rollup/plugin-node-resolve": "16.0.3",
1211
"@sentry/bundler-plugins": "10.67.0"
1312
},

‎packages/bundler-plugins/package.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
"import": "./build/esm/core/index.js",
4545
"require": "./build/cjs/core/index.js"
4646
},
47+
"./babel-plugin": {
48+
"types": "./build/types/babel-plugin/index.d.ts",
49+
"import": "./build/esm/babel-plugin/index.js",
50+
"require": "./build/cjs/babel-plugin/index.js"
51+
},
4752
"./sentry-release-injection-file": {
4853
"import": "./sentry-release-injection-file.js",
4954
"require": "./sentry-release-injection-file.js"
@@ -109,10 +114,14 @@
109114
"supports-color": "^8.1.1"
110115
},
111116
"peerDependencies": {
117+
"@babel/core": "^7.18.5",
112118
"rollup": ">=3.2.0",
113119
"webpack": ">=5.1.0"
114120
},
115121
"peerDependenciesMeta": {
122+
"@babel/core": {
123+
"optional": true
124+
},
116125
"rollup": {
117126
"optional": true
118127
},
@@ -121,6 +130,9 @@
121130
}
122131
},
123132
"devDependencies": {
133+
"@babel/core": "^7.18.5",
134+
"@babel/preset-react": "^7.23.3",
135+
"@types/babel__core": "^7.20.5",
124136
"@types/node": "^18.6.3",
125137
"premove": "^4.0.0",
126138
"rolldown": "^1.0.0",

‎packages/bundler-plugins/rollup.npm.config.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default makeNPMConfigVariants(
99
'src/esbuild/index.ts',
1010
'src/webpack/index.ts',
1111
'src/webpack/component-annotation-transform.ts',
12+
'src/babel-plugin/index.ts',
1213
],
1314
packageSpecificConfig: {
1415
output: {

packages/bundler-plugins/src/core/component-annotation.ts renamed to packages/bundler-plugins/src/babel-plugin/component-annotation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { DEFAULT_IGNORED_ELEMENTS } from './component-annotation-constants';
1+
import { DEFAULT_IGNORED_ELEMENTS } from './constants';
22

33
export const WEB_COMPONENT_NAME = 'data-sentry-component';
44
export const WEB_ELEMENT_NAME = 'data-sentry-element';
55
export const WEB_SOURCE_FILE_NAME = 'data-sentry-source-file';
66

7+
export const NATIVE_COMPONENT_NAME = 'dataSentryComponent';
8+
export const NATIVE_ELEMENT_NAME = 'dataSentryElement';
9+
export const NATIVE_SOURCE_FILE_NAME = 'dataSentrySourceFile';
10+
711
export type ComponentAnnotationAttributeNames = readonly [string, string, string];
812

913
export type ComponentAnnotationAttribute = [string, string];

packages/bundler-plugins/src/core/component-annotation-constants.ts renamed to packages/bundler-plugins/src/babel-plugin/constants.ts

File renamed without changes.

0 commit comments

Comments
 (0)