Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
"types": "./build/types/request.d.ts",
"default": "./build/cjs/request.js"
}
},
"./nodejs_compat": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Drop the nodejs_? Just compat?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That would be an option. This is at least getting rid of the _ which I'm not a big fan of

"import": {
"types": "./build/types/nodejs_compat/index.d.ts",
"default": "./build/esm/nodejs_compat/index.js"
},
"require": {
"types": "./build/types/nodejs_compat/index.d.ts",
"default": "./build/cjs/nodejs_compat/index.js"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing E2E for entrypoint

Low Severity

This feat PR adds the public @sentry/cloudflare/nodejs_compat export but does not include an integration or E2E test that imports that subpath under Wrangler with nodejs_compat enabled, so broken export or bundle paths could ship unnoticed.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit a9079a0. Configure here.

Comment on lines +42 to +48

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The typesVersions field in package.json is missing an entry for the new ./nodejs_compat export, which can cause type issues for older TypeScript versions.
Severity: MEDIUM

Suggested Fix

Update the typesVersions field in packages/cloudflare/package.json to include a mapping for the new ./nodejs_compat entrypoint, pointing to its down-leveled type definition file. Specifically, add "build/types/nodejs_compat/index.d.ts": ["build/types-ts3.8/nodejs_compat/index.d.ts"] under the "<5.0" key.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/cloudflare/package.json#L42-L48

Potential issue: The new `./nodejs_compat` entrypoint in `@sentry/cloudflare` lacks a
corresponding entry in the `typesVersions` field of `package.json`. While users on
TypeScript 5.0+ will get correct types via the `exports` field, users on older
TypeScript versions (< 5.0) will not receive the down-leveled types. This can lead to
type compatibility errors for those users when they import from
`@sentry/cloudflare/nodejs_compat`. Other multi-entrypoint packages in the repository,
like `@sentry/hono`, correctly map all entrypoints in `typesVersions`, establishing a
precedent that was not followed here.

Did we get this right? 👍 / 👎 to inform future reviews.

}
},
"typesVersions": {
Expand Down
6 changes: 5 additions & 1 deletion packages/cloudflare/rollup.npm.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';

export default makeNPMConfigVariants(makeBaseNPMConfig());
export default makeNPMConfigVariants(
makeBaseNPMConfig({
entrypoints: ['src/index.ts', 'src/nodejs_compat/index.ts'],
}),
);
1 change: 1 addition & 0 deletions packages/cloudflare/src/nodejs_compat/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../index';
Loading