Skip to content

Remove @bugsnag/core/lib/es-utils/includes #2465

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

Open
wants to merge 4 commits into
base: integration/typescript
Choose a base branch
from

Conversation

AnastasiiaSvietlova
Copy link
Contributor

@AnastasiiaSvietlova AnastasiiaSvietlova commented Jun 13, 2025

Goal

Remove @bugsnag/core/lib/es-utils/includes and replace it with Array.prototype.includes().

Design

Publish core as ES module with TypeScript

Changeset

Delete @bugsnag/core/lib/es-utils/includes
Delete breadcrumb-types.ts as we already have that types in common.ts

Testing

Covered by existing end to end and unit tests

import { add, clear, merge } from './lib/feature-flag-delegate'
import { BreadcrumbType, Config, Delivery, FeatureFlag, LoggerConfig, NotifiableError, Notifier, OnBreadcrumbCallback, OnErrorCallback, OnSessionCallback, Plugin, SessionDelegate, User } from './common'
import { BreadcrumbType, BREADCRUMB_TYPES, Config, Delivery, FeatureFlag, LoggerConfig, NotifiableError, Notifier, OnBreadcrumbCallback, OnErrorCallback, OnSessionCallback, Plugin, SessionDelegate, User } from './common'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why it was doubled. But I replace BREADCRUMB_TYPES from lib/breadcrumb-types with ones from common. They are identical.

const types = this._config.enabledBreadcrumbTypes

return types === null || includes(types, type)
return types === null || types.includes(type)
Copy link
Contributor Author

@AnastasiiaSvietlova AnastasiiaSvietlova Jun 13, 2025

Choose a reason for hiding this comment

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

Here is a little complication. As we were having type as string TS complaining that in line 327: TS2345: Argument of type string is not assignable to parameter of type BreadcrumbType. Because const types: BreadcrumbType[].
And if I will change it to BreadcrumbType, I'm having an issue in plugin-browser-session/src/session.
_isBreadcrumbTypeEnabled: (type: ConsoleMethod) => boolean

So currently I set (type: any).

@AnastasiiaSvietlova AnastasiiaSvietlova marked this pull request as ready for review June 17, 2025 13:07
@gingerbenw gingerbenw force-pushed the PLAT-13688-includes branch from 08f2229 to e13793d Compare June 25, 2025 07:10
Copy link

github-actions bot commented Jun 25, 2025

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 81.41 kB 18.60 kB
After 80.81 kB 18.38 kB
± -600 bytes -218 bytes

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against a862683

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.

1 participant