Skip to content

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

Merged
joker23 merged 4 commits into
mainfrom
skz/sdk-2976/semver-import
Sep 16, 2026
Merged

joker23 merged 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 is republished as a dual ESM/CJS package (tsup instead of tsc), with conditional exports, sideEffects: false, and TypeScript set to ESNext / bundler resolution.

Semver usage is narrowed in Operations.ts via semver/functions/parse.js and semver/classes/semver (with an explicit .js extension so Node’s ESM loader can resolve the subpath).

Integration test helpers (FileDataSourceFactory, TestData, builders) are re-exported by name from the common package root and from server-node’s integrations.ts (direct re-export instead of destructuring). Vercel EdgeFeatureStore tests mock reviveFullPayload at module scope and assert call counts on that shared mock, with the real implementation restored in beforeEach after resetAllMocks.

Reviewed by Cursor Bugbot for commit 96e8ab3. 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

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26983 bytes
Compressed size limit: 29000
Uncompressed size: 131377 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: 32597 bytes
Compressed size limit: 34000
Uncompressed size: 116806 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: 25421 bytes
Compressed size limit: 44000
Uncompressed size: 165321 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.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

✅ 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
* package size for server SDKs. The `.js` extension is required: this package now
* compiles with `"module": "ESNext"` and `"moduleResolution": "bundler"`, and Node's own
* ESM resolver (unlike `require` or a bundler's resolution) does not probe for extensions
* on bare subpath specifiers, so the published ESM entry point fails to load without it.

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.

This makes me pretty uneasy. So I am hoping for considerable exploration of how an end-2-end package behaves after this change.

@joker23
joker23 force-pushed the skz/sdk-2976/semver-import branch from 78ded9f to fcb7d11 Compare September 16, 2026 13:28
cursor[bot]

This comment was marked as resolved.

@joker23
joker23 force-pushed the skz/sdk-2976/semver-import branch from fcb7d11 to 96e8ab3 Compare September 16, 2026 15:03

@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 found 1 new potential issue.

Devin Review

entry: {
index: 'src/index.ts',
},
format: ['esm', 'cjs'],

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.

🔴 Node 14 bundle fails to load

On Node 14, tsup-node can preserve ??= because no ES2017 target is configured. The supported runtime then rejects the bundle before SDK initialization.

Learn more

The old TypeScript build explicitly targeted ES2017, so syntax newer than Node 14 was downleveled. The new tsup build does not carry that target forward. tsup-node therefore uses its own newer default target and can retain logical nullish assignment from Evaluator. Node 14 cannot parse that syntax, although the Node SDK still declares Node 14 compatibility.

Example: A Node 14 service imports @launchdarkly/node-server-sdk. Loading its bundled server-common dependency reaches code containing state.events ??= []. Node throws a syntax error before the application can create a client.

Recommended fix: Set the tsup target to es2017, matching the replaced TypeScript build and the package's existing runtime contract. Add a smoke test that imports both published CJS and ESM outputs under the oldest supported Node version.

Suggested change
format: ['esm', 'cjs'],
format: ['esm', 'cjs'],
target: 'es2017',
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

This is a false positive - the final compilation happens in the leaf SDK and all of our builds are far past node 14

@joker23
joker23 merged commit 2de6c8c into main Sep 16, 2026
56 checks passed
@joker23
joker23 deleted the skz/sdk-2976/semver-import branch September 16, 2026 15:44
@github-actions github-actions Bot mentioned this pull request Sep 16, 2026
joker23 pushed a commit that referenced this pull request Sep 16, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>akamai-edgeworker-sdk-common: 2.0.35</summary>

##
[2.0.35](akamai-edgeworker-sdk-common-v2.0.34...akamai-edgeworker-sdk-common-v2.0.35)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from ^2.21.3 to ^2.21.4
</details>

<details><summary>akamai-server-base-sdk: 3.0.36</summary>

##
[3.0.36](akamai-server-base-sdk-v3.0.35...akamai-server-base-sdk-v3.0.36)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.34 to
^2.0.35
</details>

<details><summary>akamai-server-edgekv-sdk: 1.4.38</summary>

##
[1.4.38](akamai-server-edgekv-sdk-v1.4.37...akamai-server-edgekv-sdk-v1.4.38)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.34 to
^2.0.35
    * @launchdarkly/js-server-sdk-common bumped from ^2.21.3 to ^2.21.4
</details>

<details><summary>client-testing-plugin: 1.0.17</summary>

##
[1.0.17](client-testing-plugin-v1.0.16...client-testing-plugin-v1.0.17)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/react-sdk bumped from 4.1.18 to 4.1.19
  * peerDependencies
    * @launchdarkly/react-sdk bumped from ^4.1.4 to ^4.1.19
</details>

<details><summary>cloudflare-server-sdk: 2.7.37</summary>

##
[2.7.37](cloudflare-server-sdk-v2.7.36...cloudflare-server-sdk-v2.7.37)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/js-server-sdk-common-edge bumped from 2.6.32 to 2.6.33
</details>

<details><summary>fastly-server-sdk: 0.2.27</summary>

##
[0.2.27](fastly-server-sdk-v0.2.26...fastly-server-sdk-v0.2.27)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.21.3 to 2.21.4
</details>

<details><summary>js-server-sdk-common: 2.21.4</summary>

##
[2.21.4](js-server-sdk-common-v2.21.3...js-server-sdk-common-v2.21.4)
(2026-09-16)


### Bug Fixes

* **sdk-server-common:** use subpath import for `semver` module
([#1885](#1885))
([2de6c8c](2de6c8c))
</details>

<details><summary>js-server-sdk-common-edge: 2.6.33</summary>

##
[2.6.33](js-server-sdk-common-edge-v2.6.32...js-server-sdk-common-edge-v2.6.33)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.21.3 to 2.21.4
</details>

<details><summary>node-server-sdk: 9.13.6</summary>

##
[9.13.6](node-server-sdk-v9.13.5...node-server-sdk-v9.13.6)
(2026-09-16)


### Bug Fixes

* **sdk-server-common:** use subpath import for `semver` module
([#1885](#1885))
([2de6c8c](2de6c8c))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.21.3 to 2.21.4
</details>

<details><summary>node-server-sdk-dynamodb: 6.2.42</summary>

##
[6.2.42](node-server-sdk-dynamodb-v6.2.41...node-server-sdk-dynamodb-v6.2.42)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.13.5 to 9.13.6
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.11.3 to >=9.13.6
</details>

<details><summary>node-server-sdk-otel: 1.3.29</summary>

##
[1.3.29](node-server-sdk-otel-v1.3.28...node-server-sdk-otel-v1.3.29)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.13.5 to 9.13.6
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.11.3 to >=9.13.6
</details>

<details><summary>node-server-sdk-redis: 4.2.41</summary>

##
[4.2.41](node-server-sdk-redis-v4.2.40...node-server-sdk-redis-v4.2.41)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.13.5 to 9.13.6
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.11.3 to >=9.13.6
</details>

<details><summary>openfeature-cloudflare-server: 0.1.7</summary>

##
[0.1.7](openfeature-cloudflare-server-v0.1.6...openfeature-cloudflare-server-v0.1.7)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/cloudflare-server-sdk bumped from 2.7.36 to 2.7.37
  * peerDependencies
    * @launchdarkly/cloudflare-server-sdk bumped from ^2.7.0 to ^2.7.37
</details>

<details><summary>openfeature-node-server: 2.0.5</summary>

##
[2.0.5](openfeature-node-server-v2.0.4...openfeature-node-server-v2.0.5)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.13.5 to 9.13.6
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from ^9.0.0 to ^9.13.6
</details>

<details><summary>react-sdk: 4.1.19</summary>

##
[4.1.19](react-sdk-v4.1.18...react-sdk-v4.1.19)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from ^2.21.3 to ^2.21.4
</details>

<details><summary>server-sdk-ai: 2.0.6</summary>

##
[2.0.6](server-sdk-ai-v2.0.5...server-sdk-ai-v2.0.6)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.21.3 to 2.21.4
  * peerDependencies
    * @launchdarkly/js-server-sdk-common bumped from ^2.0.0 to ^2.21.4
</details>

<details><summary>server-sdk-ai-langchain: 0.8.16</summary>

##
[0.8.16](server-sdk-ai-langchain-v0.8.15...server-sdk-ai-langchain-v0.8.16)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^2.0.5 to ^2.0.6
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^1.1.1 to ^2.0.6
</details>

<details><summary>server-sdk-ai-openai: 0.7.16</summary>

##
[0.7.16](server-sdk-ai-openai-v0.7.15...server-sdk-ai-openai-v0.7.16)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.21.3 to 2.21.4
    * @launchdarkly/server-sdk-ai bumped from ^2.0.5 to ^2.0.6
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^1.1.1 to ^2.0.6
</details>

<details><summary>server-sdk-ai-vercel: 0.7.16</summary>

##
[0.7.16](server-sdk-ai-vercel-v0.7.15...server-sdk-ai-vercel-v0.7.16)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^2.0.5 to ^2.0.6
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^1.1.1 to ^2.0.6
</details>

<details><summary>shopify-oxygen-sdk: 0.1.25</summary>

##
[0.1.25](shopify-oxygen-sdk-v0.1.24...shopify-oxygen-sdk-v0.1.25)
(2026-09-16)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.21.3 to 2.21.4
</details>

<details><summary>vercel-server-sdk: 1.3.60</summary>

##
[1.3.60](vercel-server-sdk-v1.3.59...vercel-server-sdk-v1.3.60)
(2026-09-16)


### Bug Fixes

* **sdk-server-common:** use subpath import for `semver` module
([#1885](#1885))
([2de6c8c](2de6c8c))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/js-server-sdk-common-edge bumped from 2.6.32 to 2.6.33
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> **Release Please** cut that publishes a coordinated monorepo release.
The only functional change carried forward is
**`@launchdarkly/js-server-sdk-common` 2.21.4**, which fixes **`semver`
imports** to use subpath imports
([#1885](#1885)).
> 
> Everything else in the diff is version propagation: patch bumps to
**Node server SDK (9.13.6)**,
**Vercel/Cloudflare/Fastly/Akamai/Shopify** edge SDKs, **React
(4.1.19)**, **server AI** and **AI provider** packages, **OpenFeature**
wrappers, **DynamoDB/Redis/OTEL** plugins, and matching **changelog**,
**`package.json`**, **`x-release-please-version`** strings, example
apps, and **`.release-please-manifest.json`**. Several AI provider
changelogs also tighten **`@launchdarkly/server-sdk-ai` peer** ranges to
**^2.0.6**.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
05435e0. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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