@sentry/junior-dashboard 0.58.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +1 -1
- package/dist/handler.js +1 -1
- package/dist/nitro.js +36 -2
- package/package.json +2 -2
- package/src/auth.ts +1 -1
- package/src/nitro.ts +39 -0
package/dist/app.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createJuniorReporting } from "@sentry/junior/reporting";
|
|
|
6
6
|
import { initSentry } from "@sentry/junior/instrumentation";
|
|
7
7
|
|
|
8
8
|
// src/auth.ts
|
|
9
|
-
import { betterAuth } from "better-auth";
|
|
9
|
+
import { betterAuth } from "better-auth/minimal";
|
|
10
10
|
var DEFAULT_SESSION_MAX_AGE_SECONDS = 60 * 60 * 8;
|
|
11
11
|
function sanitizeDashboardSession(session) {
|
|
12
12
|
const { email, emailVerified, hostedDomain, name } = session.user;
|
package/dist/handler.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createJuniorReporting } from "@sentry/junior/reporting";
|
|
|
9
9
|
import { initSentry } from "@sentry/junior/instrumentation";
|
|
10
10
|
|
|
11
11
|
// src/auth.ts
|
|
12
|
-
import { betterAuth } from "better-auth";
|
|
12
|
+
import { betterAuth } from "better-auth/minimal";
|
|
13
13
|
var DEFAULT_SESSION_MAX_AGE_SECONDS = 60 * 60 * 8;
|
|
14
14
|
function sanitizeDashboardSession(session) {
|
|
15
15
|
const { email, emailVerified, hostedDomain, name } = session.user;
|
package/dist/nitro.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// src/nitro.ts
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { cpSync, existsSync, mkdirSync } from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
var dashboardAssetNames = ["client.js", "tailwind.css"];
|
|
6
|
+
function normalizePath(path2, fallback) {
|
|
7
|
+
const value = path2?.trim() || fallback;
|
|
4
8
|
const withSlash = value.startsWith("/") ? value : `/${value}`;
|
|
5
9
|
return stripTrailingSlashes(withSlash);
|
|
6
10
|
}
|
|
@@ -14,6 +18,33 @@ function stripTrailingSlashes(value) {
|
|
|
14
18
|
function routeEntry(handler) {
|
|
15
19
|
return { handler };
|
|
16
20
|
}
|
|
21
|
+
function dashboardAssetPath(fileName) {
|
|
22
|
+
const candidates = [
|
|
23
|
+
fileURLToPath(new URL(`./${fileName}`, import.meta.url)),
|
|
24
|
+
fileURLToPath(new URL(`../dist/${fileName}`, import.meta.url))
|
|
25
|
+
];
|
|
26
|
+
for (const candidate of candidates) {
|
|
27
|
+
if (existsSync(candidate)) {
|
|
28
|
+
return candidate;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw new Error(
|
|
32
|
+
`Junior dashboard asset ${fileName} was not built; run pnpm --filter @sentry/junior-dashboard build before building Nitro`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function copyDashboardAssets(serverDir) {
|
|
36
|
+
const targetDir = path.join(
|
|
37
|
+
serverDir,
|
|
38
|
+
"node_modules",
|
|
39
|
+
"@sentry",
|
|
40
|
+
"junior-dashboard",
|
|
41
|
+
"dist"
|
|
42
|
+
);
|
|
43
|
+
mkdirSync(targetDir, { recursive: true });
|
|
44
|
+
for (const fileName of dashboardAssetNames) {
|
|
45
|
+
cpSync(dashboardAssetPath(fileName), path.join(targetDir, fileName));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
17
48
|
function virtualHandler(config) {
|
|
18
49
|
return `import { defineHandler } from "nitro";
|
|
19
50
|
import { createDashboardApp } from "@sentry/junior-dashboard";
|
|
@@ -61,6 +92,9 @@ function juniorDashboardNitro(options) {
|
|
|
61
92
|
};
|
|
62
93
|
nitro.options.virtual[handler] = virtualHandler(dashboardConfig);
|
|
63
94
|
nitro.options.virtual["#junior-dashboard/config"] = `export const dashboard = ${JSON.stringify(dashboardConfig)};`;
|
|
95
|
+
nitro.hooks.hook("compiled", () => {
|
|
96
|
+
copyDashboardAssets(nitro.options.output.serverDir);
|
|
97
|
+
});
|
|
64
98
|
const dashboardRoutes = {
|
|
65
99
|
...dashboardPageRoutes(basePath, handler),
|
|
66
100
|
"/api/dashboard/**": routeEntry(handler),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-dashboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react-router": "^7.16.0",
|
|
40
40
|
"recharts": "^3.8.1",
|
|
41
41
|
"shiki": "4.1.0",
|
|
42
|
-
"@sentry/junior": "0.
|
|
42
|
+
"@sentry/junior": "0.60.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tailwindcss/cli": "^4.3.0",
|
package/src/auth.ts
CHANGED
package/src/nitro.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { cpSync, existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
1
4
|
import type { Nitro } from "nitro/types";
|
|
2
5
|
|
|
3
6
|
export interface JuniorDashboardNitroOptions {
|
|
@@ -12,6 +15,7 @@ export interface JuniorDashboardNitroOptions {
|
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
type NitroRouteConfig = NonNullable<Nitro["options"]["routes"]>;
|
|
18
|
+
const dashboardAssetNames = ["client.js", "tailwind.css"] as const;
|
|
15
19
|
|
|
16
20
|
function normalizePath(path: string | undefined, fallback: string): string {
|
|
17
21
|
const value = path?.trim() || fallback;
|
|
@@ -31,6 +35,38 @@ function routeEntry(handler: string): { handler: string } {
|
|
|
31
35
|
return { handler };
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
function dashboardAssetPath(fileName: string): string {
|
|
39
|
+
const candidates = [
|
|
40
|
+
fileURLToPath(new URL(`./${fileName}`, import.meta.url)),
|
|
41
|
+
fileURLToPath(new URL(`../dist/${fileName}`, import.meta.url)),
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
for (const candidate of candidates) {
|
|
45
|
+
if (existsSync(candidate)) {
|
|
46
|
+
return candidate;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
throw new Error(
|
|
51
|
+
`Junior dashboard asset ${fileName} was not built; run pnpm --filter @sentry/junior-dashboard build before building Nitro`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function copyDashboardAssets(serverDir: string): void {
|
|
56
|
+
const targetDir = path.join(
|
|
57
|
+
serverDir,
|
|
58
|
+
"node_modules",
|
|
59
|
+
"@sentry",
|
|
60
|
+
"junior-dashboard",
|
|
61
|
+
"dist",
|
|
62
|
+
);
|
|
63
|
+
mkdirSync(targetDir, { recursive: true });
|
|
64
|
+
|
|
65
|
+
for (const fileName of dashboardAssetNames) {
|
|
66
|
+
cpSync(dashboardAssetPath(fileName), path.join(targetDir, fileName));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
34
70
|
function virtualHandler(config: Record<string, unknown>): string {
|
|
35
71
|
return `import { defineHandler } from "nitro";
|
|
36
72
|
import { createDashboardApp } from "@sentry/junior-dashboard";
|
|
@@ -92,6 +128,9 @@ export function juniorDashboardNitro(options: JuniorDashboardNitroOptions): {
|
|
|
92
128
|
nitro.options.virtual[handler] = virtualHandler(dashboardConfig);
|
|
93
129
|
nitro.options.virtual["#junior-dashboard/config"] =
|
|
94
130
|
`export const dashboard = ${JSON.stringify(dashboardConfig)};`;
|
|
131
|
+
nitro.hooks.hook("compiled", () => {
|
|
132
|
+
copyDashboardAssets(nitro.options.output.serverDir);
|
|
133
|
+
});
|
|
95
134
|
|
|
96
135
|
const dashboardRoutes: NitroRouteConfig = {
|
|
97
136
|
...dashboardPageRoutes(basePath, handler),
|