Skip to content

Commit 5d46458

Browse files
author
Luca Forstner
committed
dont revert stuff we dont wanna revert
1 parent e9d28d4 commit 5d46458

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
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,5 +1,5 @@
11
try {
2-
var globalObject =
2+
let globalObject =
33
"undefined" != typeof window
44
? window
55
: "undefined" != typeof global
@@ -10,7 +10,7 @@ try {
1010
? self
1111
: {};
1212

13-
var stack = new globalObject.Error().stack;
13+
let stack = new globalObject.Error().stack;
1414

1515
if (stack) {
1616
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="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},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="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export function generateGlobalInjectorCode({
315315
// The code below is mostly ternary operators because it saves bundle size.
316316
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
317317
let code = `{
318-
const _global =
318+
let _global =
319319
typeof window !== 'undefined' ?
320320
window :
321321
typeof global !== 'undefined' ?
@@ -346,7 +346,7 @@ export function generateModuleMetadataInjectorCode(metadata: any) {
346346
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
347347
// We are merging the metadata objects in case modules are bundled twice with the plugin
348348
return `{
349-
const _sentryModuleMetadataGlobal =
349+
let _sentryModuleMetadataGlobal =
350350
typeof window !== "undefined"
351351
? window
352352
: typeof global !== "undefined"

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=\\"undefined\\"!=typeof window?window:\\"undefined\\"!=typeof global?global:\\"undefined\\"!=typeof globalThis?globalThis:\\"undefined\\"!=typeof self?self:{},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=\\"undefined\\"!=typeof window?window:\\"undefined\\"!=typeof global?global:\\"undefined\\"!=typeof globalThis?globalThis:\\"undefined\\"!=typeof self?self:{},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-
const _sentryModuleMetadataGlobal =
224+
let _sentryModuleMetadataGlobal =
225225
typeof window !== \\"undefined\\"
226226
? window
227227
: typeof global !== \\"undefined\\"
@@ -256,7 +256,7 @@ describe("generateModuleMetadataInjectorCode", () => {
256256
});
257257
expect(generatedCode).toMatchInlineSnapshot(`
258258
"{
259-
const _sentryModuleMetadataGlobal =
259+
let _sentryModuleMetadataGlobal =
260260
typeof window !== \\"undefined\\"
261261
? window
262262
: typeof global !== \\"undefined\\"

0 commit comments

Comments
 (0)