Repository navigation
Conversation
size-limit report 📦Compared: c958b2c (PR test merge using develop at a3249b6) Against: 71f41ed (develop) · base run #68183
|
Optional E2E testsAll optional checks were successful. 6 successful. See the run. Successful checks
|
51b3096 to
a13330c
Compare
a13330c to
8ff429f
Compare
8ff429f to
e410d72
Compare
6d82c1a to
5750fcb
Compare
5750fcb to
c609009
Compare
c609009 to
08f8117
Compare
s1gr1d
left a comment
There was a problem hiding this comment.
all good, just one thing before merging this
| include: { id: SOURCE_FILE_REGEX, contains }, | ||
| apply: ctx => { | ||
| wrapSites(ctx, findSites, debug); | ||
| if (ctx.state.needsImport && !hasImport(ctx.ast, SENTRY_MODULE, WRAPPER)) { |
There was a problem hiding this comment.
There could be an issue with double-imports. Can you check that?
When a route file imports wrapMiddlewaresWithSentry from a re-export (e.g. ~/lib/sentry) and has an unwrapped site, we add a second import of the same name, and the build fails with "Identifier 'wrapMiddlewaresWithSentry' has already been declared". Could we check collectDeclaringStatements(ctx.ast).has(WRAPPER) instead of hasImport, and add a test with a re-exported import?
08f8117 to
8cef040
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8cef040. Configure here.
8cef040 to
69d041e
Compare
69d041e to
c8ab5e8
Compare
c8ab5e8 to
f111856
Compare
f111856 to
be3b775
Compare
The regex rewrite broke on nested arrays and on a `]` inside a string. It skipped a whole file once `wrapMiddlewaresWithSentry` appeared anywhere in it, and it found start files by `start` in the file path. Wrapped files also lost their source maps. The plugin now finds middleware arrays in the AST, skips each wrapped site on its own, and returns a source map. A start file is any file that calls `createStart()`.
…he module already binds it
…ule has only a type import of it
be3b775 to
8bdae62
Compare

Why: The regex rewrite broke on nested arrays and on a
]inside a string. It skipped the whole file oncewrapMiddlewaresWithSentryappeared anywhere in it, it found start files bystartin the file path, and the rewritten files had no source maps. The plugin now finds middleware arrays in the AST, skips each wrapped site on its own, and returns a source map. A start file is now any file that callscreateStart(), and the plugin only wrapsrequestMiddlewareandfunctionMiddlewareinside that call. The warning text is unchanged.How to review:
src/vite/autoInstrumentMiddleware.ts, then the new test cases.Unsure about: A middleware array followed by
as constis not wrapped, and the plugin gives no warning for it.Ref #25776