Skip to content

fix(sdk-server-common): use subpath import for semver module - #1885

Open
joker23 wants to merge 4 commits into
mainfrom
skz/sdk-2976/semver-import
Open

fix(sdk-server-common): use subpath import for semver module#1885
joker23 wants to merge 4 commits into
mainfrom
skz/sdk-2976/semver-import

Conversation

@joker23

@joker23 joker23 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

NOTE: this PR is stacked on top of #1972

This PR will use subpath imports for semver to reduce package size per suggestion from @jthorupp


Note

Overview
@launchdarkly/js-server-sdk-common switches from tsc-only CommonJS to a dual ESM + CJS publish via tsup, with conditional exports, separate .d.ts / .d.cts, sideEffects: false, and ESNext + bundler TypeScript settings.

Operations.ts now imports semver/functions/parse.js (and the SemVer type from a subpath) instead of the semver package root, with an explicit .js extension so Node ESM resolution works; this is intended to shrink bundled server SDK output.

The common package index adds named re-exports for integration test helpers (FileDataSourceFactory, TestData, etc.); server-node’s integrations.ts mirrors that with a direct re-export instead of pulling from the integrations namespace object.

Vercel EdgeFeatureStore tests mock reviveFullPayload at the module level and assert on the shared mock (with beforeEach restoring the real implementation after resetAllMocks), replacing per-test spyOn usage.

Reviewed by Cursor Bugbot for commit 78ded9f. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 180265 bytes
Compressed size limit: 200000
Uncompressed size: 833635 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26360 bytes
Compressed size limit: 29000
Uncompressed size: 129188 bytes

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 32512 bytes
Compressed size limit: 34000
Uncompressed size: 116455 bytes

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25517 bytes
Compressed size limit: 44000
Uncompressed size: 165887 bytes

@joker23
joker23 marked this pull request as ready for review August 25, 2026 21:05
@joker23
joker23 requested a review from a team as a code owner August 25, 2026 21:05

@devin-ai-integration devin-ai-integration Bot left a comment

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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

*/
import type SemVer from 'semver/classes/semver';
// eslint-disable-next-line @typescript-eslint/no-require-imports
import parse = require('semver/functions/parse');

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.

So, we have leaf-node packages that compile to ESM, this doesn't seem like a safe plan.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea this change does have a bad smell to it... it would probably be worth it to hold this off until we can produce shared ESM packages? I think we should head toward that direction so we can do tree-shaking.

@joker23
joker23 force-pushed the skz/sdk-2976/semver-import branch from 63b54ba to 3ce2e3e Compare August 28, 2026 13:47
cursor[bot]

This comment was marked as resolved.

@joker23
joker23 force-pushed the skz/sdk-2976/semver-import branch from 3ce2e3e to 78ded9f Compare September 1, 2026 20:28
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.

2 participants