Skip to content

Commit 7316e9f

Browse files
committed
split into multiple files so its faster
1 parent b595dc8 commit 7316e9f

15 files changed

+309
-255
lines changed

nx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"test": {
2020
"inputs": ["default"],
21-
"cache": true
21+
"cache": false
2222
},
2323
"check:types": {
2424
"inputs": ["sharedGlobals"],
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { test, expect } from "vitest";
2+
import { readAllFiles } from "../utils";
3+
import { getEmptyOutputDir, runRolldown } from "./utils";
4+
5+
const outputDir = getEmptyOutputDir(import.meta.url, "application-key");
6+
7+
test("Application key injection", () => {
8+
runRolldown("application-key.config.ts");
9+
const files = readAllFiles(outputDir);
10+
expect(files).toMatchInlineSnapshot(`
11+
{
12+
"basic.js": "//#region src/basic.js
13+
!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(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];if(null!=a)for(var t in a)a.hasOwnProperty(t)&&(e[t]=a[t])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],{"_sentryBundlerPluginAppKey:1234567890abcdef":true});var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b699d9c1-b033-4536-aa25-233c92609b54",e._sentryDebugIdIdentifier="sentry-dbid-b699d9c1-b033-4536-aa25-233c92609b54");}catch(e){}}();console.log("hello world");
14+
15+
//#endregion",
16+
}
17+
`);
18+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { test, expect } from "vitest";
2+
import { readAllFiles } from "../utils";
3+
import { getEmptyOutputDir, runRolldown } from "./utils";
4+
5+
const outputDir = getEmptyOutputDir(import.meta.url, "basic-release-disabled");
6+
7+
test("Release injection disabled", () => {
8+
runRolldown("basic-release-disabled.config.ts");
9+
const files = readAllFiles(outputDir);
10+
expect(files).toMatchInlineSnapshot(`
11+
{
12+
"basic.js": "//#region src/basic.js
13+
!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]="b699d9c1-b033-4536-aa25-233c92609b54",e._sentryDebugIdIdentifier="sentry-dbid-b699d9c1-b033-4536-aa25-233c92609b54");}catch(e){}}();console.log("hello world");
14+
15+
//#endregion",
16+
}
17+
`);
18+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test, expect } from "vitest";
2+
import { readAllFiles } from "../utils";
3+
import { getEmptyOutputDir, runRolldown } from "./utils";
4+
5+
const outputDir = getEmptyOutputDir(import.meta.url, "basic-sourcemaps");
6+
7+
test("Basic with sourcemaps", () => {
8+
runRolldown("basic-sourcemaps.config.ts");
9+
const files = readAllFiles(outputDir);
10+
expect(files).toMatchInlineSnapshot(`
11+
{
12+
"basic.js": "//#region src/basic.js
13+
!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"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b699d9c1-b033-4536-aa25-233c92609b54",e._sentryDebugIdIdentifier="sentry-dbid-b699d9c1-b033-4536-aa25-233c92609b54");}catch(e){}}();console.log("hello world");
14+
15+
//#endregion
16+
//# sourceMappingURL=basic.js.map",
17+
"basic.js.map": "{"version":3,"file":"basic.js","names":[],"sources":["../../src/basic.js"],"sourcesContent":["// eslint-disable-next-line no-console\\nconsole.log(\\"hello world\\");\\n"],"mappings":";scACA,OAAA,CAAQ,GAAA,CAAI,CAAA,KAAA,CAAA,KAAA,CAAA,CAAc"}",
18+
}
19+
`);
20+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { test, expect } from "vitest";
2+
import { readAllFiles } from "../utils";
3+
import { getEmptyOutputDir, runRolldown } from "./utils";
4+
5+
const outputDir = getEmptyOutputDir(import.meta.url, "basic");
6+
7+
test("Basic", () => {
8+
runRolldown("basic.config.ts");
9+
const files = readAllFiles(outputDir);
10+
expect(files).toMatchInlineSnapshot(`
11+
{
12+
"basic.js": "//#region src/basic.js
13+
!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"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b699d9c1-b033-4536-aa25-233c92609b54",e._sentryDebugIdIdentifier="sentry-dbid-b699d9c1-b033-4536-aa25-233c92609b54");}catch(e){}}();console.log("hello world");
14+
15+
//#endregion",
16+
}
17+
`);
18+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { test, expect } from "vitest";
2+
import { readAllFiles } from "../utils";
3+
import { getEmptyOutputDir, runRolldown } from "./utils";
4+
5+
const outputDir = getEmptyOutputDir(import.meta.url, "component-annotation-disabled");
6+
7+
test("Component annotation disabled", () => {
8+
runRolldown("component-annotation-disabled.config.ts");
9+
const files = readAllFiles(outputDir);
10+
expect(files).toMatchInlineSnapshot(`
11+
{
12+
"app.js": "!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"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ea5adc74-2664-4c38-8492-6e4971efd2be",e._sentryDebugIdIdentifier="sentry-dbid-ea5adc74-2664-4c38-8492-6e4971efd2be");}catch(e){}}();import { jsx, jsxs } from "../node_modules/react/jsx-runtime.js";
13+
14+
//#region src/component-a.jsx
15+
function ComponentA() {
16+
return /* @__PURE__ */ jsx("span", { children: "Component A" });
17+
}
18+
19+
//#endregion
20+
//#region src/app.jsx
21+
function App() {
22+
return /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx(ComponentA, {}), ";"] });
23+
}
24+
25+
//#endregion
26+
export { App as default };",
27+
}
28+
`);
29+
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { test, expect } from "vitest";
2+
import { readAllFiles } from "../utils";
3+
import { getEmptyOutputDir, runRolldown } from "./utils";
4+
5+
const outputDir = getEmptyOutputDir(import.meta.url, "component-annotation-next");
6+
7+
test("Component annotation experimental", () => {
8+
runRolldown("component-annotation-next.config.ts");
9+
const files = readAllFiles(outputDir);
10+
expect(files).toMatchInlineSnapshot(`
11+
{
12+
"app.js": "!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"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="aa1666c7-eaca-4b84-8c40-9ac56cc75bfb",e._sentryDebugIdIdentifier="sentry-dbid-aa1666c7-eaca-4b84-8c40-9ac56cc75bfb");}catch(e){}}();import { jsx, jsxs } from "../node_modules/react/jsx-runtime.js";
13+
14+
//#region src/component-a.jsx
15+
function ComponentA() {
16+
return /* @__PURE__ */ jsx("span", {
17+
"data-sentry-component": "ComponentA",
18+
children: "Component A"
19+
});
20+
}
21+
22+
//#endregion
23+
//#region src/app.jsx
24+
function App() {
25+
return /* @__PURE__ */ jsxs("span", {
26+
"data-sentry-component": "App",
27+
children: [/* @__PURE__ */ jsx(ComponentA, {}), ";"]
28+
});
29+
}
30+
31+
//#endregion
32+
export { App as default };",
33+
}
34+
`);
35+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { test, expect } from "vitest";
2+
import { readAllFiles } from "../utils";
3+
import { getEmptyOutputDir, runRolldown } from "./utils";
4+
5+
const outputDir = getEmptyOutputDir(import.meta.url, "component-annotation");
6+
7+
test("Component annotation", () => {
8+
runRolldown("component-annotation.config.ts");
9+
const files = readAllFiles(outputDir);
10+
expect(files).toMatchInlineSnapshot(`
11+
{
12+
"app.js": "!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"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="adb3af3a-5b4a-49fd-b8ae-7ea0905020b6",e._sentryDebugIdIdentifier="sentry-dbid-adb3af3a-5b4a-49fd-b8ae-7ea0905020b6");}catch(e){}}();import { jsx, jsxs } from "../node_modules/react/jsx-runtime.js";
13+
14+
//#region src/component-a.jsx
15+
function ComponentA() {
16+
return /* @__PURE__ */ jsx("span", {
17+
"data-sentry-component": "ComponentA",
18+
"data-sentry-source-file": "component-a.jsx",
19+
children: "Component A"
20+
});
21+
}
22+
23+
//#endregion
24+
//#region src/app.jsx
25+
function App() {
26+
return /* @__PURE__ */ jsxs("span", {
27+
"data-sentry-component": "App",
28+
"data-sentry-source-file": "app.jsx",
29+
children: [/* @__PURE__ */ jsx(ComponentA, {
30+
"data-sentry-element": "ComponentA",
31+
"data-sentry-source-file": "app.jsx"
32+
}), ";"]
33+
});
34+
}
35+
36+
//#endregion
37+
export { App as default };",
38+
}
39+
`);
40+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test, expect } from "vitest";
2+
import { readAllFiles } from "../utils";
3+
import { getEmptyOutputDir, runRolldown } from "./utils";
4+
5+
const outputDir = getEmptyOutputDir(import.meta.url, "debugid-disabled");
6+
7+
test("Debug ID injection disabled", () => {
8+
runRolldown("debugid-disabled.config.ts");
9+
const files = readAllFiles(outputDir);
10+
expect(files).toMatchInlineSnapshot(`
11+
{
12+
"basic.js": "//#region src/basic.js
13+
console.log("hello world");
14+
15+
//#endregion
16+
//# sourceMappingURL=basic.js.map",
17+
"basic.js.map": "{"version":3,"file":"basic.js","names":[],"sources":["../../src/basic.js"],"sourcesContent":["// eslint-disable-next-line no-console\\nconsole.log(\\"hello world\\");\\n"],"mappings":";AACA,QAAQ,IAAI,cAAc"}",
18+
}
19+
`);
20+
});

packages/integration-tests-next/fixtures/rolldown/debugids-already-injected.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default defineConfig({
1111
plugins: [
1212
sentryRollupPlugin({
1313
telemetry: false,
14+
// We need to specify these so that upload is attempted. Debug IDs will be injected before then...
1415
authToken: "fake-auth",
1516
org: "fake-org",
1617
project: "fake-project",

0 commit comments

Comments
 (0)