Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as esbuild from "esbuild";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import { sentryConfig } from "../configs/after-upload-deletion.config.js";

await esbuild.build({
entryPoints: ["./src/basic.js"],
bundle: true,
outfile: "./out/after-upload-deletion/basic.js",
minify: false,
format: "iife",
sourcemap: true,
plugins: [sentryEsbuildPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
runBundler();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"basic.js": "(() => {
// _sentry-injection-stub
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
e.SENTRY_RELEASE = { id: "CURRENT_SHA" };
} catch (e2) {
}
})();

// sentry-debug-id-stub:_sentry-debug-id-injection-stub?sentry-module-id=00000000-0000-0000-0000-000000000000
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
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 (e2) {
}
})();

// src/basic.js
console.log("hello world");

// src/basic.js?sentryDebugIdProxy=true
var basic_default = void 0;
})();
//# sourceMappingURL=basic.js.map
",
}
`);

const output = runFileInNode("basic.js");
expect(output).toBe("hello world\n");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as esbuild from "esbuild";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import { sentryConfig } from "../configs/application-key.config.js";

await esbuild.build({
entryPoints: ["./src/basic.js"],
bundle: true,
outfile: "./out/application-key/application-key.js",
minify: false,
format: "iife",
plugins: [sentryEsbuildPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
runBundler();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"application-key.js": "(() => {
// _sentry-injection-stub
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
e.SENTRY_RELEASE = { id: "CURRENT_SHA" };
e._sentryModuleMetadata = e._sentryModuleMetadata || {}, e._sentryModuleMetadata[new e.Error().stack] = (function(e2) {
for (var n = 1; n < arguments.length; n++) {
var a = arguments[n];
if (null != a) for (var t in a) a.hasOwnProperty(t) && (e2[t] = a[t]);
}
return e2;
})({}, e._sentryModuleMetadata[new e.Error().stack], { "_sentryBundlerPluginAppKey:1234567890abcdef": true });
} catch (e2) {
}
})();

// sentry-debug-id-stub:_sentry-debug-id-injection-stub?sentry-module-id=00000000-0000-0000-0000-000000000000
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
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 (e2) {
}
})();

// src/basic.js
console.log("hello world");

// src/basic.js?sentryDebugIdProxy=true
var basic_default = void 0;
})();
",
}
`);

const output = runFileInNode("application-key.js");
expect(output).toBe("hello world\n");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as esbuild from "esbuild";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import { sentryConfig } from "../configs/basic-release-disabled.config.js";

await esbuild.build({
entryPoints: ["./src/basic.js"],
bundle: true,
outfile: "./out/basic-release-disabled/basic-release-disabled.js",
minify: false,
format: "iife",
plugins: [sentryEsbuildPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
runBundler();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"basic-release-disabled.js": "(() => {
// sentry-debug-id-stub:_sentry-debug-id-injection-stub?sentry-module-id=00000000-0000-0000-0000-000000000000
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
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 (e2) {
}
})();

// src/basic.js
console.log("hello world");

// src/basic.js?sentryDebugIdProxy=true
var basic_default = void 0;
})();
",
}
`);

const output = runFileInNode("basic-release-disabled.js");
expect(output).toBe("hello world\n");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as esbuild from "esbuild";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import { sentryConfig } from "../configs/basic-sourcemaps.config.js";

await esbuild.build({
entryPoints: ["./src/basic.js"],
bundle: true,
outfile: "./out/basic-sourcemaps/basic-sourcemaps.js",
minify: false,
format: "iife",
sourcemap: true,
plugins: [sentryEsbuildPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
runBundler();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"basic-sourcemaps.js": "(() => {
// _sentry-injection-stub
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
e.SENTRY_RELEASE = { id: "CURRENT_SHA" };
} catch (e2) {
}
})();

// sentry-debug-id-stub:_sentry-debug-id-injection-stub?sentry-module-id=00000000-0000-0000-0000-000000000000
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
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 (e2) {
}
})();

// src/basic.js
console.log("hello world");

// src/basic.js?sentryDebugIdProxy=true
var basic_default = void 0;
})();
//# sourceMappingURL=basic-sourcemaps.js.map
",
"basic-sourcemaps.js.map": "{"version":3,"sources":["../../_sentry-injection-stub","sentry-debug-id-stub:_sentry-debug-id-injection-stub?sentry-module-id=00000000-0000-0000-0000-000000000000","../../src/basic.js","../../src/basic.js"],"sourcesContent":["!function(){try{var e=\\"undefined\\"!=typeof window?window:\\"undefined\\"!=typeof global?global:\\"undefined\\"!=typeof globalThis?globalThis:\\"undefined\\"!=typeof self?self:{};e.SENTRY_RELEASE={id:\\"CURRENT_SHA\\"};}catch(e){}}();","!function(){try{var e=\\"undefined\\"!=typeof window?window:\\"undefined\\"!=typeof global?global:\\"undefined\\"!=typeof globalThis?globalThis:\\"undefined\\"!=typeof self?self:{};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){}}();","// eslint-disable-next-line no-console\\nconsole.log(\\"hello world\\");\\n","\\n import \\"_sentry-debug-id-injection-stub\\";\\n import * as OriginalModule from \\"./src/basic.js\\";\\n export default OriginalModule.default;\\n export * from \\"./src/basic.js\\";"],"mappings":";;AAAA,IAAC,WAAU;AAAC,QAAG;AAAC,UAAI,IAAE,eAAa,OAAO,SAAO,SAAO,eAAa,OAAO,SAAO,SAAO,eAAa,OAAO,aAAW,aAAW,eAAa,OAAO,OAAK,OAAK,CAAC;AAAE,QAAE,iBAAe,EAAC,IAAG,2CAA0C;AAAA,IAAE,SAAOA,IAAE;AAAA,IAAC;AAAA,EAAC,GAAE;;;ACAnP,IAAC,WAAU;AAAC,QAAG;AAAC,UAAI,IAAE,eAAa,OAAO,SAAO,SAAO,eAAa,OAAO,SAAO,SAAO,eAAa,OAAO,aAAW,aAAW,eAAa,OAAO,OAAK,OAAK,CAAC;AAAE,UAAI,IAAG,IAAI,EAAE,QAAO;AAAM,YAAI,EAAE,kBAAgB,EAAE,mBAAiB,CAAC,GAAE,EAAE,gBAAgB,CAAC,IAAE,wCAAuC,EAAE,2BAAyB;AAAA,IAAoD,SAAOC,IAAE;AAAA,IAAC;AAAA,EAAC,GAAE;;;ACCnY,UAAQ,IAAI,aAAa;;;ACEX,MAAO,gBAAuB;","names":["e","e"]}",
"sentry-cli-mock.json": "["releases","new","CURRENT_SHA"],
["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"],
["releases","finalize","CURRENT_SHA"],
["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"],
",
}
`);

const output = runFileInNode("basic-sourcemaps.js");
expect(output).toBe("hello world\n");
});
12 changes: 12 additions & 0 deletions packages/integration-tests-next/fixtures/esbuild/basic.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as esbuild from "esbuild";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import { sentryConfig } from "../configs/basic.config.js";

await esbuild.build({
entryPoints: ["./src/basic.js"],
bundle: true,
outfile: "./out/basic/basic.js",
minify: false,
format: "iife",
plugins: [sentryEsbuildPlugin(sentryConfig)],
});
45 changes: 45 additions & 0 deletions packages/integration-tests-next/fixtures/esbuild/basic.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
runBundler();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"basic.js": "(() => {
// _sentry-injection-stub
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
e.SENTRY_RELEASE = { id: "CURRENT_SHA" };
} catch (e2) {
}
})();

// sentry-debug-id-stub:_sentry-debug-id-injection-stub?sentry-module-id=00000000-0000-0000-0000-000000000000
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
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 (e2) {
}
})();

// src/basic.js
console.log("hello world");

// src/basic.js?sentryDebugIdProxy=true
var basic_default = void 0;
})();
",
"sentry-cli-mock.json": "["releases","new","CURRENT_SHA"],
["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"],
["releases","finalize","CURRENT_SHA"],
["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"],
",
}
`);

const output = runFileInNode("basic.js");
expect(output).toBe("hello world\n");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as esbuild from "esbuild";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import { sentryConfig } from "../configs/build-info.config.js";

await esbuild.build({
entryPoints: ["./src/basic.js"],
bundle: true,
outfile: "./out/build-info/build-info.js",
minify: false,
format: "iife",
plugins: [sentryEsbuildPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
runBundler();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"build-info.js": "(() => {
// _sentry-injection-stub
!(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": ["@sentry/esbuild-plugin", "esbuild"], "depsVersions": {}, "nodeVersion":"NODE_VERSION" };
} catch (e2) {
}
})();

// sentry-debug-id-stub:_sentry-debug-id-injection-stub?sentry-module-id=00000000-0000-0000-0000-000000000000
!(function() {
try {
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
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 (e2) {
}
})();

// src/basic.js
console.log("hello world");

// src/basic.js?sentryDebugIdProxy=true
var basic_default = void 0;
})();
",
}
`);

const output = runFileInNode("build-info.js");
expect(output).toBe("hello world\n");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as esbuild from "esbuild";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import { sentryConfig } from "../configs/bundle-size-optimizations.config.js";

await esbuild.build({
entryPoints: ["./src/bundle.js"],
bundle: true,
outfile: "./out/bundle-size-optimizations/bundle-size-optimizations.js",
minify: false,
format: "iife",
plugins: [sentryEsbuildPlugin(sentryConfig)],
});
Loading
Loading