Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 8 additions & 6 deletions packages/shared/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@launchdarkly/js-sdk-common",
"version": "2.10.0",
"type": "module",
"main": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"main": "./dist/esm/index.mjs",
"types": "./dist/esm/index.d.ts",
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/common",
"repository": {
"type": "git",
Expand All @@ -19,13 +19,15 @@
"client"
],
"exports": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"require": { "types": "./dist/cjs/index.d.ts", "default": "./dist/cjs/index.cjs"},
Copy link
Member Author

Choose a reason for hiding this comment

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

The CJS and ESM have to be in different folders in order for this approach to work.

"import": { "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.mjs"}
},
"scripts": {
"test": "npx jest --ci",
"build": "npx tsc --noEmit && rollup -c rollup.config.js",
"make-cjs-package-json": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
"make-esm-package-json": "echo '{\"type\":\"module\"}' > dist/esm/package.json",
"make-package-jsons": "npm run make-cjs-package-json && npm run make-esm-package-json",
"build": "npx tsc --noEmit && rollup -c rollup.config.js && npm run make-package-jsons",
"clean": "rimraf dist",
"lint": "npx eslint . --ext .ts",
"lint:fix": "yarn run lint --fix",
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/common/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getSharedConfig = (format, file) => ({

export default [
{
...getSharedConfig('es', 'dist/index.mjs'),
...getSharedConfig('es', 'dist/esm/index.mjs'),
plugins: [
typescript({
module: 'esnext',
Expand All @@ -35,7 +35,7 @@ export default [
],
},
{
...getSharedConfig('cjs', 'dist/index.cjs'),
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), json()],
...getSharedConfig('cjs', 'dist/cjs/index.cjs'),
plugins: [typescript({ tsconfig: './tsconfig.json', outputToFilesystem: true, }), common(), json()],
},
];
3 changes: 1 addition & 2 deletions packages/shared/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"sourceMap": true,
"declaration": true,
"declarationMap": true, // enables importers to jump to source
"stripInternal": true,
"composite": true
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 prevents a caching issue and we don't need the composite anymore.

"stripInternal": true
},
"include": ["src"],
"exclude": ["**/*.test.ts", "dist", "node_modules", "__tests__"]
Expand Down
5 changes: 2 additions & 3 deletions packages/shared/sdk-client/src/DataManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
ProcessStreamResponse,
subsystem,
} from '@launchdarkly/js-sdk-common';
import { LDStreamProcessor } from '@launchdarkly/js-sdk-common/dist/api/subsystem';
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 import should not have been allowed.


import { LDIdentifyOptions } from './api/LDIdentifyOptions';
import { Configuration } from './configuration/Configuration';
Expand Down Expand Up @@ -203,9 +202,9 @@ export abstract class BaseDataManager implements DataManager {
}

private _decorateProcessorWithStatusReporting(
processor: LDStreamProcessor,
processor: subsystem.LDStreamProcessor,
statusManager: DataSourceStatusManager,
): LDStreamProcessor {
): subsystem.LDStreamProcessor {
return {
start: () => {
// update status before starting processor to ensure potential errors are reported after initializing
Expand Down
Loading