Skip to content

Commit d50cd0e

Browse files
author
Luca Forstner
committed
merge conflicts and stuff
1 parent aad44b9 commit d50cd0e

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

packages/bundler-plugin-core/sentry-esbuild-debugid-injection-file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
try {
2-
var globalObject = globalThis;
2+
let globalObject = globalThis;
33

4-
var stack = new globalObject.Error().stack;
4+
let stack = new globalObject.Error().stack;
55

66
if (stack) {
77
globalObject._sentryDebugIds = globalObject._sentryDebugIds || {};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ export function createComponentNameAnnotateHooks(ignoredComponents?: string[]) {
695695
}
696696

697697
export function getDebugIdSnippet(debugId: string): string {
698-
return `;!function(){try{var e=globalThis,n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="${debugId}",e._sentryDebugIdIdentifier="sentry-dbid-${debugId}")}catch(e){}}();`;
698+
return `;{try{let e=globalThis,n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="${debugId}",e._sentryDebugIdIdentifier="sentry-dbid-${debugId}")}catch(e){}};`;
699699
}
700700

701701
export { stringToUUID, replaceBooleanFlagsInCode } from "./utils";

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,8 @@ export function generateGlobalInjectorCode({
312312
release: string;
313313
injectBuildInformation: boolean;
314314
}) {
315-
let code = `
316-
var _global = globalThis;
317-
315+
let code = `{
316+
let _global = globalThis;
318317
_global.SENTRY_RELEASE={id:${JSON.stringify(release)}};`;
319318

320319
if (injectBuildInformation) {
@@ -333,7 +332,7 @@ export function generateGlobalInjectorCode({
333332
export function generateModuleMetadataInjectorCode(metadata: any) {
334333
// We are merging the metadata objects in case modules are bundled twice with the plugin
335334
return `{
336-
var _sentryModuleMetadataGlobal = globalThis;
335+
let _sentryModuleMetadataGlobal = globalThis;
337336
338337
_sentryModuleMetadataGlobal._sentryModuleMetadata =
339338
_sentryModuleMetadataGlobal._sentryModuleMetadata || {};

packages/bundler-plugin-core/test/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ describe("getDebugIdSnippet", () => {
44
it("returns the debugId injection snippet for a passed debugId", () => {
55
const snippet = getDebugIdSnippet("1234");
66
expect(snippet).toMatchInlineSnapshot(
7-
`";!function(){try{var e=globalThis,n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\\"1234\\",e._sentryDebugIdIdentifier=\\"sentry-dbid-1234\\")}catch(e){}}();"`
7+
`";{try{let e=globalThis,n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\\"1234\\",e._sentryDebugIdIdentifier=\\"sentry-dbid-1234\\")}catch(e){}};"`
88
);
99
});
1010
});

packages/bundler-plugin-core/test/utils.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ describe("generateModuleMetadataInjectorCode", () => {
221221
const generatedCode = generateModuleMetadataInjectorCode({});
222222
expect(generatedCode).toMatchInlineSnapshot(`
223223
"{
224-
var _sentryModuleMetadataGlobal = globalThis;
224+
let _sentryModuleMetadataGlobal = globalThis;
225225
226226
_sentryModuleMetadataGlobal._sentryModuleMetadata =
227227
_sentryModuleMetadataGlobal._sentryModuleMetadata || {};
@@ -247,7 +247,7 @@ describe("generateModuleMetadataInjectorCode", () => {
247247
});
248248
expect(generatedCode).toMatchInlineSnapshot(`
249249
"{
250-
var _sentryModuleMetadataGlobal = globalThis;
250+
let _sentryModuleMetadataGlobal = globalThis;
251251
252252
_sentryModuleMetadataGlobal._sentryModuleMetadata =
253253
_sentryModuleMetadataGlobal._sentryModuleMetadata || {};

0 commit comments

Comments
 (0)