fix(sdk-server-common): use subpath import for semver module - #1885
fix(sdk-server-common): use subpath import for semver module#1885joker23 wants to merge 4 commits into
semver module#1885Conversation
|
@launchdarkly/browser size report |
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/js-client-sdk-common size report |
| */ | ||
| import type SemVer from 'semver/classes/semver'; | ||
| // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
| import parse = require('semver/functions/parse'); |
There was a problem hiding this comment.
So, we have leaf-node packages that compile to ESM, this doesn't seem like a safe plan.
There was a problem hiding this comment.
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.
63b54ba to
3ce2e3e
Compare
3ce2e3e to
78ded9f
Compare
This PR will use subpath imports for semver to reduce package size per suggestion from @jthorupp
Note
Overview
@launchdarkly/js-server-sdk-commonswitches from tsc-only CommonJS to a dual ESM + CJS publish via tsup, with conditionalexports, separate.d.ts/.d.cts,sideEffects: false, and ESNext + bundler TypeScript settings.Operations.tsnow importssemver/functions/parse.js(and theSemVertype from a subpath) instead of thesemverpackage root, with an explicit.jsextension 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’sintegrations.tsmirrors that with a direct re-export instead of pulling from theintegrationsnamespace object.Vercel
EdgeFeatureStoretests mockreviveFullPayloadat the module level and assert on the shared mock (withbeforeEachrestoring the real implementation afterresetAllMocks), replacing per-testspyOnusage.Reviewed by Cursor Bugbot for commit 78ded9f. Bugbot is set up for automated code reviews on this repo. Configure here.