perf(js): Make attribute descriptions tree-shakeable - #562
Conversation
ATTRIBUTE_METADATA mixes runtime fields with descriptions, examples, and changelogs, making metadata consumers ship about 43 KB gzip. Add focused metadata and documentation subpaths while leaving the existing attributes export alone. The runtime entry is about 11.5 KB gzip and constant imports still tree-shake down to basically nothing. Co-Authored-By: Codex <noreply@openai.com>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
The first pass kept a full compatibility copy, so existing metadata imports stayed at 43 KB and the generated data was duplicated. Make ATTRIBUTE_METADATA runtime-only at the existing entry point and keep the documentation fields exclusively in ATTRIBUTE_DOCUMENTATION. This is the actual split. Co-Authored-By: Codex <noreply@openai.com>
ATTRIBUTE_METADATA is already runtime-only at the existing attributes entry, so the extra metadata subpath is just another spelling and generated shim. Remove it and keep the split to attributes plus attributes/documentation. Co-Authored-By: Codex <noreply@openai.com>
| }, | ||
| 'ai.response_format': { | ||
| brief: 'For an AI model call, the format of the response', |
There was a problem hiding this comment.
i guess we probably want the brief
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e8f9572. Configure here.
| "./attributes/documentation": { | ||
| "import": "./dist/attributeDocumentation.mjs", | ||
| "require": "./dist/attributeDocumentation.cjs" | ||
| }, |
There was a problem hiding this comment.
Missing legacy documentation export shims
Low Severity
The new @sentry/conventions/attributes/documentation export is only wired through package.json exports, with no root compatibility shims like attributes and op already have. Tooling that ignores exports (for example webpack 4 or older TypeScript) cannot resolve the documented import path.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit e8f9572. Configure here.
Sentry only reads the browser name and version descriptions in the frontend, but accessing them through ATTRIBUTE_METADATA pulls in the entire table. Export per-attribute brief strings from the documentation entry. The same Rspack import drops from 240 KB minified to 93 bytes. Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com> # Conflicts: # javascript/sentry-conventions/src/attributes.ts
|
i'm not sure this is the right way to go |


Sentry only uses the browser name and version descriptions in its frontend, but reading them from
ATTRIBUTE_METADATApulls in the entire table.This moves documentation fields to an opt-in entry and adds named brief exports:
With Rspack, that Sentry import drops from 240,110 bytes minified to 93 bytes.
ATTRIBUTE_DOCUMENTATIONremains available for build-time tooling that needs every description.