Skip to content

Commit 7ad3502

Browse files
ysh4296orionmizclaude
authored
feat(plugin-sentry): add plugin for sentry (#547)
Co-authored-by: JH.Lee <contact@jins.dev> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c92a1c4 commit 7ad3502

16 files changed

Lines changed: 432 additions & 0 deletions

.changeset/fix-plugin-sentry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@stackflow/plugin-sentry": minor
3+
---
4+
5+
feat(plugin-sentry): add Sentry browser tracing plugin for Stackflow navigation events

.pnp.cjs

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
2.06 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

extensions/plugin-sentry/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# plugin-sentry
2+
3+
Stackflow plugin for Sentry browser tracing. Automatically creates navigation spans and breadcrumbs for activity transitions (`push`, `pop`, `replace`) and step transitions (`stepPush`, `stepPop`, `stepReplace`).
4+
5+
## Setup
6+
7+
1. Initialize Sentry with the `stackflowBrowserTracingIntegration`:
8+
9+
```typescript
10+
import * as Sentry from "@sentry/browser";
11+
import { stackflowBrowserTracingIntegration } from "@stackflow/plugin-sentry";
12+
13+
Sentry.init({
14+
dsn: "https://xxx.ingest.us.sentry.io/xxx",
15+
integrations: [
16+
stackflowBrowserTracingIntegration(),
17+
// ... other integrations
18+
],
19+
});
20+
```
21+
22+
2. Add `sentryPlugin()` to your stackflow configuration:
23+
24+
```typescript
25+
import { stackflow } from "@stackflow/react";
26+
import { sentryPlugin } from "@stackflow/plugin-sentry";
27+
28+
const { Stack, useFlow } = stackflow({
29+
activities: {
30+
// ...
31+
},
32+
plugins: [
33+
sentryPlugin(),
34+
// ... other plugins
35+
],
36+
});
37+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const { context } = require("esbuild");
2+
const config = require("@stackflow/esbuild-config");
3+
const pkg = require("./package.json");
4+
5+
const watch = process.argv.includes("--watch");
6+
const external = Object.keys({
7+
...pkg.dependencies,
8+
...pkg.peerDependencies,
9+
});
10+
11+
Promise.all([
12+
context({
13+
...config({}),
14+
format: "cjs",
15+
external,
16+
}).then((ctx) =>
17+
watch ? ctx.watch() : ctx.rebuild().then(() => ctx.dispose()),
18+
),
19+
context({
20+
...config({}),
21+
format: "esm",
22+
outExtension: {
23+
".js": ".mjs",
24+
},
25+
external,
26+
}).then((ctx) =>
27+
watch ? ctx.watch() : ctx.rebuild().then(() => ctx.dispose()),
28+
),
29+
]).catch(() => process.exit(1));

0 commit comments

Comments
 (0)