Skip to content

🚨 Prevent re-exporting values from @datadog/js-core - #4970

Open
BenoitZugmeyer wants to merge 3 commits into
mainfrom
benoit/prevent-reexports
Open

🚨 Prevent re-exporting values from @datadog/js-core#4970
BenoitZugmeyer wants to merge 3 commits into
mainfrom
benoit/prevent-reexports

Conversation

@BenoitZugmeyer

Copy link
Copy Markdown
Member

Motivation

Re-exporting values from @datadog/js-core through other packages (e.g. @datadog/browser-core) makes them appear as if they belong to the re-exporting package. This creates misleading import paths for consumers and blurs package boundaries. Consumers should import these values directly from @datadog/js-core so the source of each utility is explicit.

Changes

  • Added a local ESLint rule (disallow-re-exports-from-other-packages) that flags any export ... from "@datadog/js-core..." and reports a message directing consumers to import from @datadog/js-core directly
  • Removed existing @datadog/js-core re-exports from browser-core, browser-logs, browser-rum, and browser-rum-slim entry points
  • Updated all internal consumers to import the affected values directly from @datadog/js-core/util
  • Ensured yarn typecheck covers the browser-rum-nextjs package

Test instructions

  • Run yarn lint and confirm no disallow-re-exports-from-other-packages violations are reported
  • Run yarn typecheck and confirm it passes
  • In the sandbox, verify the SDK still initializes correctly (DD_LOGS.init() / DD_RUM.init()) since entry points no longer re-export ProxyFn, Site, ConsoleApiName, etc.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 21, 2026

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 181.20 KiB 181.15 KiB -49 B -0.03%
Rum Profiler 8.43 KiB 8.43 KiB -1 B -0.01%
Rum Recorder 22.31 KiB 22.31 KiB 0 B 0.00%
Logs 57.52 KiB 57.52 KiB 0 B 0.00%
Rum Salesforce N/A 139.23 KiB N/A N/A N/A
Rum Slim 139.21 KiB 139.22 KiB +6 B +0.00%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%
Rum Shopify N/A 202.08 KiB N/A N/A N/A
Rum-shopify Profiler N/A 8.43 KiB N/A N/A N/A
Rum-shopify Recorder N/A 3.72 KiB N/A N/A N/A

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 21, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 77.12% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b3d9d1a | Docs | View more details | Give us feedback!

@BenoitZugmeyer
BenoitZugmeyer marked this pull request as ready for review August 21, 2026 14:07
@BenoitZugmeyer
BenoitZugmeyer requested review from a team as code owners August 21, 2026 14:07

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 110a317b54

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/browser-logs/src/entries/main.ts
Comment thread eslint-local-rules/disallowReExportsFromOtherPackages.ts
Comment thread eslint-local-rules/disallowReExportsFromOtherPackages.ts
Re-exporting values from @datadog/js-core makes them look like they belong
to the re-exporting package. Add a local ESLint rule that flags any
`export ... from "@datadog/js-core..."` and tells consumers to import the
value directly from @datadog/js-core instead.
@BenoitZugmeyer
BenoitZugmeyer force-pushed the benoit/prevent-reexports branch from 110a317 to c730f95 Compare August 21, 2026 15:37
@BenoitZugmeyer
BenoitZugmeyer requested a review from a team as a code owner August 21, 2026 15:37

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c730f953a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/browser-core/src/index.ts
Remove `export ... from "@datadog/js-core/..."` re-exports from
browser-core, browser-logs, browser-rum, and browser-rum-slim entry
points and update all internal consumers to import the values
directly from @datadog/js-core/util instead.
@BenoitZugmeyer
BenoitZugmeyer force-pushed the benoit/prevent-reexports branch from c730f95 to b3d9d1a Compare August 21, 2026 15:46
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.

1 participant