Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ESM support for common and common-client (rollup) #604

Merged
merged 22 commits into from
Oct 2, 2024

Conversation

kinyoklion
Copy link
Member

No description provided.

@@ -21,3 +21,4 @@ yarn-error.log
.vscode
dump.rdb
.wrangler
stats.html
Copy link
Member Author

Choose a reason for hiding this comment

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

Added for analyzing bundle size.

@@ -3,9 +3,6 @@ export default {
verbose: true,
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'jest-environment-jsdom',
transform: {
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 preset takes care of this and works now.

@@ -10,10 +10,10 @@ import {
LDClientImpl,
LDContext,
LDEmitter,
LDEmitterEventName,
Copy link
Member Author

Choose a reason for hiding this comment

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

EventName was being imported inside a 'dist' which is a curse of VSCode auto imports. Now the es modules don't allow that (hurray). So it needed fixed and the EventName name was already used.

@@ -73,7 +73,7 @@ export default class GoalTracker {
);

const pageviewGoals = goalsMatchingUrl.filter((goal) => goal.kind === 'pageview');
const clickGoals = goalsMatchingUrl.filter((goal) => goal.kind === 'click');
const clickGoals = goalsMatchingUrl.filter((goal) => goal.kind === 'click') as ClickGoal[];
Copy link
Member Author

Choose a reason for hiding this comment

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

Typescript spontaneously became more strict about this.

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 file was cjs, but jest would insist it was esm because the package was ESM.

});

export default [
{
...getSharedConfig('es', 'dist/index.es.js'),
...getSharedConfig('es', 'dist/index.mjs'),
Copy link
Member Author

Choose a reason for hiding this comment

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

To appease jest.

@@ -2,9 +2,10 @@
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"target": "ES2017",
"target": "ES2020",
Copy link
Member Author

Choose a reason for hiding this comment

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

So that the spread operator for object literals will not be transformed. Helps with size of the web bundle.

@kinyoklion kinyoklion marked this pull request as ready for review October 2, 2024 18:37
@kinyoklion kinyoklion requested a review from a team as a code owner October 2, 2024 18:37
@kinyoklion kinyoklion merged commit 8cd0cdc into main Oct 2, 2024
21 checks passed
@kinyoklion kinyoklion deleted the rlamb/sdk-166/esm-common branch October 2, 2024 20:10
@github-actions github-actions bot mentioned this pull request Oct 2, 2024
kinyoklion pushed a commit that referenced this pull request Oct 9, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[1.2.1](akamai-edgeworker-sdk-common-v1.2.0...akamai-edgeworker-sdk-common-v1.2.1)
(2024-10-09)


### Dependencies

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

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

##
[2.1.17](akamai-server-base-sdk-v2.1.16...akamai-server-base-sdk-v2.1.17)
(2024-10-09)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.2.0 to
^1.2.1
    * @launchdarkly/js-server-sdk-common bumped from ^2.7.0 to ^2.8.0
</details>

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

##
[1.1.17](akamai-server-edgekv-sdk-v1.1.16...akamai-server-edgekv-sdk-v1.1.17)
(2024-10-09)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.2.0 to
^1.2.1
    * @launchdarkly/js-server-sdk-common bumped from ^2.7.0 to ^2.8.0
</details>

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

##
[2.5.15](cloudflare-server-sdk-v2.5.14...cloudflare-server-sdk-v2.5.15)
(2024-10-09)


### Dependencies

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

<details><summary>js-client-sdk-common: 1.9.0</summary>

##
[1.9.0](js-client-sdk-common-v1.8.0...js-client-sdk-common-v1.9.0)
(2024-10-09)


### Features

* Add basic secure mode support for browser SDK.
([#598](#598))
([3389983](3389983))
* Add bootstrap support.
([#600](#600))
([4e5dbee](4e5dbee))
* Add ESM support for common and common-client (rollup)
([#604](#604))
([8cd0cdc](8cd0cdc))
* Add support for hooks.
([#605](#605))
([04d347b](04d347b))
* Add visibility handling to allow proactive event flushing.
([#607](#607))
([819a311](819a311))
* adds datasource status to sdk-client
([#590](#590))
([6f26204](6f26204))
* adds support for individual flag change listeners
([#608](#608))
([da31436](da31436))
* Browser-SDK Automatically start streaming based on event handlers.
([#592](#592))
([f2e5cbf](f2e5cbf))


### Bug Fixes

* Ensure client logger is always wrapped in a safe logger.
([#599](#599))
([980e4da](980e4da))
* Use flagVersion in analytics events.
([#611](#611))
([35fa033](35fa033))


### Dependencies

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

<details><summary>js-sdk-common: 2.10.0</summary>

##
[2.10.0](js-sdk-common-v2.9.0...js-sdk-common-v2.10.0)
(2024-10-09)


### Features

* Add ESM support for common and common-client (rollup)
([#604](#604))
([8cd0cdc](8cd0cdc))
* Add visibility handling to allow proactive event flushing.
([#607](#607))
([819a311](819a311))
* adds datasource status to sdk-client
([#590](#590))
([6f26204](6f26204))
</details>

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

##
[2.8.0](js-server-sdk-common-v2.7.0...js-server-sdk-common-v2.8.0)
(2024-10-09)


### Features

* adds datasource status to sdk-client
([#590](#590))
([6f26204](6f26204))


### Dependencies

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

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

##
[2.4.1](js-server-sdk-common-edge-v2.4.0...js-server-sdk-common-edge-v2.4.1)
(2024-10-09)


### Dependencies

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

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

##
[9.6.1](node-server-sdk-v9.6.0...node-server-sdk-v9.6.1)
(2024-10-09)


### Dependencies

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

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

##
[6.1.23](node-server-sdk-dynamodb-v6.1.22...node-server-sdk-dynamodb-v6.1.23)
(2024-10-09)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.6.0 to 9.6.1
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.6.1
</details>

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

##
[1.0.15](node-server-sdk-otel-v1.0.14...node-server-sdk-otel-v1.0.15)
(2024-10-09)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.6.0 to 9.6.1
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.6.1
</details>

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

##
[4.1.23](node-server-sdk-redis-v4.1.22...node-server-sdk-redis-v4.1.23)
(2024-10-09)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.6.0 to 9.6.1
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.6.1
</details>

<details><summary>react-native-client-sdk: 10.8.0</summary>

##
[10.8.0](react-native-client-sdk-v10.7.0...react-native-client-sdk-v10.8.0)
(2024-10-09)


### Features

* Add support for hooks.
([#605](#605))
([04d347b](04d347b))


### Bug Fixes

* Ensure client logger is always wrapped in a safe logger.
([#599](#599))
([980e4da](980e4da))
* Fix base64 encoding of unicode characters.
([#613](#613))
([35ec8d1](35ec8d1))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk-common bumped from 1.8.0 to 1.9.0
</details>

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

##
[1.3.18](vercel-server-sdk-v1.3.17...vercel-server-sdk-v1.3.18)
(2024-10-09)


### Dependencies

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

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

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Oct 9, 2024
kinyoklion pushed a commit that referenced this pull request Oct 10, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>js-client-sdk: 0.0.1</summary>

## 0.0.1 (2024-10-10)


### Features

* Add basic secure mode support for browser SDK.
([#598](#598))
([3389983](3389983))
* Add bootstrap support.
([#600](#600))
([4e5dbee](4e5dbee))
* Add browser info.
([#576](#576))
([a2f4398](a2f4398))
* Add ESM support for common and common-client (rollup)
([#604](#604))
([8cd0cdc](8cd0cdc))
* Add support for browser contract tests.
([#582](#582))
([38f081e](38f081e))
* Add support for hooks.
([#605](#605))
([04d347b](04d347b))
* Add support for js-client-sdk style initialization.
([53f5bb8](53f5bb8))
* Add support for localStorage for the browser platform.
([#566](#566))
([4792391](4792391))
* Add URLs for custom events and URL filtering.
([#587](#587))
([7131e69](7131e69))
* Add visibility handling to allow proactive event flushing.
([#607](#607))
([819a311](819a311))
* adds datasource status to sdk-client
([#590](#590))
([6f26204](6f26204))
* Adds support for REPORT.
([#575](#575))
([916b724](916b724))
* Browser-SDK Automatically start streaming based on event handlers.
([#592](#592))
([f2e5cbf](f2e5cbf))
* Implement browser crypto and encoding.
([#574](#574))
([e763e5d](e763e5d))
* Implement goals for client-side SDKs.
([#585](#585))
([fd38a8f](fd38a8f))
* Implement support for browser requests.
([#578](#578))
([887548a](887548a))
* Refactor data source connection handling.
([53f5bb8](53f5bb8))
* Scaffold browser client.
([#579](#579))
([0848ab7](0848ab7))


### Bug Fixes

* Ensure browser contract tests run during top-level build.
([#589](#589))
([7dfb14d](7dfb14d))
* Ensure client logger is always wrapped in a safe logger.
([#599](#599))
([980e4da](980e4da))
</details>

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

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