Skip to content

ref(cloudflare): Build the Vite auto-instrument on the rewriter core - #26102

Merged
timfish merged 3 commits into
developfrom
ref/cloudflare-call-site-rewriter
Nov 30, 2026
Merged

timfish merged 3 commits into
developfrom
ref/cloudflare-call-site-rewriter

Conversation

@timfish

@timfish timfish commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Why: The export handling moves into the shared rewriter core, so SvelteKit and TanStack Start get the same export forms in the next PRs. The emitted code is the same as before for every existing test. Sibling modules are now parsed with oxc instead of a regex scanner, so TypeScript syntax is read, not guessed.

Two small behaviour changes: when this.parse cannot read the entry, it now falls back to oxc instead of skipping the entry, and when nothing changes the plugin returns undefined instead of the unchanged code.

How to review: transform.ts is mostly deletions of code that moved to the core. In the tests only the parseJS helper changed.

Ref #25776

@timfish
timfish added this pull request to stack #26105 November 4, 2026 13:58
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: b0fc2c8 (PR test merge using develop at 87d528a)

Against: 87d528a (develop) · base run #68325

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.55 kB - -
@sentry/browser - with treeshaking flags 28.74 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.61 kB - -
@sentry/browser (incl. Tracing) 53.69 kB - -
@sentry/browser (incl. Tracing Core) 40.62 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 53.69 kB - -
@sentry/browser (incl. Tracing, Profiling) 56.58 kB - -
@sentry/browser (incl. Tracing, Replay) 93.61 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 82.42 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 98.47 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 111.42 kB - -
@sentry/browser (incl. Feedback) 48.41 kB - -
@sentry/browser (incl. sendFeedback) 31.12 kB - -
@sentry/browser (incl. FeedbackAsync) 36.18 kB - -
@sentry/browser (incl. Metrics) 31.87 kB - -
@sentry/browser (incl. Logs) 32.15 kB - -
@sentry/browser (incl. Metrics & Logs) 32.81 kB - -
@sentry/react 32.58 kB - -
@sentry/react (incl. Tracing) 56.43 kB - -
@sentry/vue 38.76 kB - -
@sentry/vue (incl. Tracing) 56.7 kB - -
@sentry/svelte 30.58 kB - -
@sentry/effect (client) 42.23 kB - -
@sentry/effect (client, incl. Tracing) 54.97 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 66.32 kB - -
@sentry/remix (Remix 3 client bundle) 59.43 kB - -
CDN Bundle 32.39 kB - -
CDN Bundle (incl. Tracing) 54.07 kB - -
CDN Bundle (incl. Logs, Metrics) 35.14 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 56.53 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.1 kB - -
CDN Bundle (incl. Tracing, Replay) 91.86 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 94.39 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.8 kB - -
CDN Bundle - uncompressed 94.58 kB - -
CDN Bundle (incl. Tracing) - uncompressed 159.89 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.92 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 167.52 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.32 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 280.33 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 287.96 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.26 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 299.88 kB - -
@sentry/nextjs (client) 60.24 kB - -
@sentry/sveltekit (client) 55.04 kB - -
@sentry/core/server 45.84 kB - -
@sentry/core/browser 14.49 kB - -
@sentry/node 157.7 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.59 kB - -
@sentry/node - without tracing 89.95 kB - -
@sentry/node - without channel injection 146.68 kB - -
@sentry/aws-serverless 100.6 kB - -
@sentry/cloudflare (withSentry) - minified 212.33 kB - -
@sentry/cloudflare (withSentry) 492.43 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 215.28 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 237.55 kB - -

View base workflow run

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

All optional checks were successful. 65 successful. See the run.

Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hapi-21 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (bun) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E hono-5 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E hapi-21 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hono-5 (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E hono-5 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hono-5 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 (MCP SDK OpenTelemetry) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (deno) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-4-sourcemaps (Vite server) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps enabled by Sentry) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (delete all) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (delete all) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (manual upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (manual upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E vinext-cf-workers (workers cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (no upload) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (cloudflare) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 1m Details

@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch from 800fc8f to 59a7cd3 Compare November 4, 2026 14:23
@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch from 59a7cd3 to 2a1a14a Compare November 23, 2026 15:27
@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch from 2a1a14a to 72f4c3a Compare November 25, 2026 20:31
@timfish
timfish marked this pull request as ready for review November 25, 2026 20:47
@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch 4 times, most recently from f5223e3 to f6fc0a9 Compare November 26, 2026 10:46

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/cloudflare/package.json Resolved
@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch from f6fc0a9 to 8cc5991 Compare November 26, 2026 12:45
@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch from 8cc5991 to 61534a3 Compare November 26, 2026 12:59
@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch from 61534a3 to c3dab93 Compare November 26, 2026 13:34

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c3dab93. Configure here.

{ parse },
).transform(code, normalizedId);

return output ?? undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parse fallback can emit TypeScript

Medium Severity

When this.parse fails, the plugin now parses the entry with oxc and returns the rewriter output. oxc can read TypeScript, but the rewriter only splices wrappers and does not strip types. This plugin runs with enforce: 'post', so that output can become the final module source. Previously the hook returned undefined and left the file to the rest of the pipeline.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c3dab93. Configure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rewriter only adds plain JavaScript, so if TypeScript reached this point the output would contain the same TypeScript that the input already had.

@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch from c3dab93 to 869404b Compare November 26, 2026 14:07
@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch from 869404b to 892f682 Compare November 26, 2026 14:40
Base automatically changed from feat/call-site-rewriter-core to develop November 26, 2026 14:59
@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch 2 times, most recently from 2c10a70 to 34871b4 Compare November 28, 2026 11:16
@timfish
timfish removed this pull request from stack #26105 November 28, 2026 14:31
@timfish
timfish changed the base branch from develop to fix/rewriter-assigned-super-class November 28, 2026 14:31
@timfish
timfish added this pull request to stack #26968 November 28, 2026 14:32
Base automatically changed from fix/rewriter-assigned-super-class to develop November 30, 2026 09:10
JPeer264 pushed a commit that referenced this pull request Nov 30, 2026
The rewriter core now finds the base class when a decorator transform
caches it in an assignment, as in `class A extends (_Agent = Agent)`.

`@babel/traverse` 8.1.4 changed the decorator transform that
`agents/vite` runs to emit that form. The core only read a plain name or
a member expression, so decorated Agents in the worker entry were
wrapped as plain Durable Objects, and `cloudflare-autoinstrument` broke
on `develop`. The Cloudflare plugin on `develop` does not use the core
yet, so the e2e test passes again once #26102, which is stacked on this
PR, lands.
@JPeer264
JPeer264 force-pushed the ref/cloudflare-call-site-rewriter branch from a1708ca to 408ab28 Compare November 30, 2026 09:10
The export handling moves into the shared rewriter core, so SvelteKit and TanStack Start get the same export forms.

Sibling modules are now parsed with oxc instead of a regex scanner, which reads TypeScript without guessing at its syntax. The entry falls back to oxc when `this.parse` cannot read it, where it was skipped before.
@timfish
timfish force-pushed the ref/cloudflare-call-site-rewriter branch from 408ab28 to 7644fa6 Compare November 30, 2026 12:47
@timfish
timfish enabled stacked auto-merge (squash) November 30, 2026 12:51
@timfish
timfish merged commit 8d1de95 into develop Nov 30, 2026
530 checks passed
@timfish
timfish deleted the ref/cloudflare-call-site-rewriter branch November 30, 2026 12:55
chargome added a commit that referenced this pull request Nov 30, 2026
Bumps the `@sentry/bundler-plugins` dependency that #26102 added to
`@sentry/cloudflare` from 11.20.0 to 11.21.0, so it keeps linking the
workspace package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants