Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/sdk/server-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"exports": {
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems to make everything happy. I tried require and import in JS with node, and I tried import in TS with node. Everything worked and showed types. I needed the "typesVersions" before vscode intellisense worked correctly for integrations.

I have not done this much, so I am not a domain expert here.

import { TestData } from '@launchdarkly/node-server-sdk/integrations';

I am still exporting integrations from the main package. Probably safe for now.

".": {
"default": "./dist/src/index.js",
"types": "./dist/src/index.d.ts"
},
"./integrations": {
"default": "./dist/src/integrations.js",
"types": "./dist/src/integrations.d.ts"
}
},
"typesVersions": {
"*": {
"integrations": ["./dist/src/integrations.d.ts"]
}
},
"files": [
"dist"
],
Expand Down
15 changes: 15 additions & 0 deletions packages/sdk/server-node/src/integrations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { integrations } from '@launchdarkly/js-server-sdk-common';

const {
FileDataSourceFactory,
TestData,
TestDataFlagBuilder,
TestDataRuleBuilder
} = integrations;

export {
FileDataSourceFactory,
TestData,
TestDataFlagBuilder,
TestDataRuleBuilder
}