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

Provide a ponyfill for CustomEvent #2710

Merged
merged 2 commits into from
Aug 15, 2024
Merged

Conversation

matthieusieben
Copy link
Contributor

Node < 20 requires a runtime flag to make CustomEvent globally available (--experimental-global-customevent).

This change uses a local implementation of CustomEvent if a global one is not available.

The choice was made to use a local ponyfill instead of a polyfill in oauth-client-node for the following reasons:

  • Defining a global variable can have side effects
  • The ponyfill might be useful in other environments that do not have a CustomEvent implementation globally available.
  • The footprint on the minified output is only a few bytes

@matthieusieben matthieusieben force-pushed the msieben/custom-event-ponyfill branch 2 times, most recently from 97316bb to 75acf99 Compare August 13, 2024 08:38
@matthieusieben matthieusieben force-pushed the msieben/custom-event-ponyfill branch from 75acf99 to 3aba630 Compare August 13, 2024 08:40
Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

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

Good call piggy-backing Event.

@devinivy
Copy link
Collaborator

@matthieusieben once we add a changeset here, should be good to merge.

@matthieusieben matthieusieben merged commit 0411278 into main Aug 15, 2024
1 check passed
@matthieusieben matthieusieben deleted the msieben/custom-event-ponyfill branch August 15, 2024 16:44
@github-actions github-actions bot mentioned this pull request Aug 13, 2024
estrattonbailey added a commit that referenced this pull request Aug 15, 2024
* origin/main:
  Provide a ponyfill for CustomEvent (#2710)
  Ensure presence of DPoP related response headers (#2711)
  prettier ignore changelogs, as changesets not resolving prettier config properly
  Version packages (#2709)
  Export `AtpAgentOptions` type from @atproto/api (#2708)
  tidy
  Version packages (#2706)
  Update changeset to better reflect changes (#2707)
  Client SDK rework (#2483)
  Allow aud of pds or entryway for service auth tokens on pds (#2694)
  Version packages (#2692)
  Lex-cli prettier changes changeset (#2691)
  Version packages (#2689)
  PDS - inspect bearer tokens (#2688)
  Version packages (#2685)
  Service auth method binding - PDS (#2668)
  minor typos in descriptions and comments (#2681)
  Fix run-dev-env-logged command (#2682)
  Version packages (#2677)
  Tweak some wording in `oauth-client-browser` readme (#2678)
haileyok pushed a commit that referenced this pull request Aug 16, 2024
* fix(oauth-client): provide a ponyfill for CustomEvent (required by NodeJS < 20)
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