Repository navigation
feat(deno): Add modulesIntegration - #26689
Conversation
size-limit report 📦Compared: c3fa85c (PR test merge using develop at fa863db) Against: fa863db (develop) · base run #68397 ✅ Baseline matches: this diff contains only this PR's changes.
|
|
One or more gzipped bundles increased by more than 500 bytes. If this increase is intentional, add the Accept Bundlesize Increase label to this PR to rerun and accept the check. |
08bb207 to
b4bcaf1
Compare
fbcde43 to
860014c
Compare
Optional E2E testsSome optional checks were not successful. They do not block the merge. 1 not successful, 26 successful. See the run.
Successful checks
|
8ddc24f to
1523597
Compare
e9f9ee8 to
dc440a7
Compare
3107010 to
043e3d8
Compare
1e067b7 to
489e0aa
Compare
ab0464f to
8bf5a66
Compare
9972bcc to
19de852
Compare
8bf5a66 to
9e9eba6
Compare
Reports the app's packages from deno.lock (jsr: and npm: specifiers) and from package.json/node_modules via the shared resolver. Files are only read when read permission is already granted, so it never prompts. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
19de852 to
785802e
Compare
9e9eba6 to
44875b3
Compare
`@sentry/deno` now has `modulesIntegration`, so the two modules suites no longer need to be excluded. The tests that expect packages which were loaded but not declared in `package.json` stay Node and Bun only, because the Deno integration does not read the CommonJS module cache. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
| const _modulesIntegration = (() => { | ||
| let modules: Record<string, string> | undefined; | ||
| return { | ||
| name: 'Modules', |
There was a problem hiding this comment.
| name: 'Modules', | |
| name: 'Modules' as const, |
Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
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 550c807. Configure here.
| // not readable | ||
| } | ||
| return undefined; | ||
| } |
There was a problem hiding this comment.
cwd is never found with scoped read permission
Low Severity
readFile() with no path also acts as the cwd getter. It calls Deno.permissions.querySync with path: undefined, which only reports granted when read access to everything is allowed. With a scoped permission such as --allow-read=., cwd is always undefined. When the main module isn't a file: URL, nothing is collected even though the files can be read.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 550c807. Configure here.
There was a problem hiding this comment.
Fixed in 9aa514b47b. cwd now comes from Deno.cwd(), which needs no permission, so scoped --allow-read flags find it.
| function readFile(path?: string): string | undefined { | ||
| try { | ||
| if (Deno.permissions.querySync({ name: 'read', path }).state === 'granted') { | ||
| return path ? Deno.readTextFileSync(path) : Deno.cwd(); |
There was a problem hiding this comment.
l: With a scoped flag like --allow-read=., querySync({ name: 'read' }) without a path returns prompt, so cwd is always undefined (as Bugbot said, I probed it on Deno 2.9.8). Deno.cwd() needs no permission since Deno 2 and our minimum is 2.8.3, so we can simplify this:
| function readFile(path?: string): string | undefined { | |
| try { | |
| if (Deno.permissions.querySync({ name: 'read', path }).state === 'granted') { | |
| return path ? Deno.readTextFileSync(path) : Deno.cwd(); | |
| function readFile(path: string): string | undefined { | |
| try { | |
| if (Deno.permissions.querySync({ name: 'read', path }).state === 'granted') { | |
| return Deno.readTextFileSync(path); |
There was a problem hiding this comment.
Applied in 9aa514b47b: readFile now always takes a path and cwd comes from Deno.cwd(). I confirmed on Deno 2.8.3 and 2.9.8 that Deno.cwd() works without any read permission, and that querySync({ name: 'read' }) returns prompt under --allow-read=..
| "name": "deno-modules-fixture", | ||
| "private": true, | ||
| "dependencies": { | ||
| "left-pad": "^1.3.0" |
Querying read permission without a path only reports granted for a blanket --allow-read, so with a scoped flag like --allow-read=. the cwd was never found. Deno.cwd() needs no permission since Deno 2. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>



What
@sentry/denonow includesmodulesIntegrationby default. It reports exact versions ofjsr:andnpm:packages from the nearestdeno.lock(lockfile versions 3 to 5). For apps with apackage.json, it also reports those dependencies, using the shared resolver from #26637.Why
Deno had no modules integration, so its events had no package versions. The integration only reads files when read permission is already granted, checked with
Deno.permissions.querySync. So it never prompts, and it does nothing without--allow-read. Withoutnode_modules, the resolver only knows the ranges declared inpackage.json, so the exact versions indeno.locktake precedence.packages/deno/test/fixtures/modules/deno.lockis force-added becausedeno.lockis gitignored. The test runs the fixture with--no-lockso Deno doesn't rewrite it.via @mydea.
--
View Session [Sentry]