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

Modernise browser packages #2224

Draft
wants to merge 231 commits into
base: next
Choose a base branch
from
Draft

Modernise browser packages #2224

wants to merge 231 commits into from

Conversation

gingerbenw
Copy link
Member

@gingerbenw gingerbenw commented Oct 16, 2024

Goal

Convert packages to TypeScript using rollup to bundle both ES modules and Common JS modules for maximum compatibility

Changeset

  • Install and configure rollup
  • Add type annotations to browser packages
  • Update build scripts to generate es modules

Testing

Covered by CI

Outstanding

  • Test tree shaking manually

@gingerbenw gingerbenw changed the title Convert packages to typescript and es modules Convert packages to TypeScript and ES Modules Oct 16, 2024
Copy link

github-actions bot commented Oct 16, 2024

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 46.96 kB 14.02 kB
After 51.47 kB 15.76 kB
± ⚠️ +4,509 bytes ⚠️ +1,732 bytes

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against 419f45f

@gingerbenw gingerbenw force-pushed the integration/typescript branch 2 times, most recently from 0b18a5e to 25ca84e Compare October 24, 2024 10:23
@gingerbenw gingerbenw changed the title Convert packages to TypeScript and ES Modules Modernise browser packages Oct 25, 2024
@gingerbenw gingerbenw force-pushed the integration/typescript branch from 4d6971c to eade9df Compare November 12, 2024 16:17

if (typeof exportValue === 'string') {
targetFilePath = exportKey.endsWith('*')
? exportValue.replace(

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of /\*/.

Copilot Autofix AI 1 day ago

To fix the problem, we need to ensure that all occurrences of the asterisk (*) in exportValue are replaced with the appropriate substring of submoduleName. This can be achieved by using a regular expression with the global flag (g) in the replace method.

  • Change the replace method call on line 146 to use a regular expression with the global flag.
  • Ensure that the replacement logic remains the same, i.e., replacing the asterisk (*) with the appropriate substring of submoduleName.
Suggested changeset 1
jest/node-exports-resolver.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/jest/node-exports-resolver.js b/jest/node-exports-resolver.js
--- a/jest/node-exports-resolver.js
+++ b/jest/node-exports-resolver.js
@@ -146,3 +146,3 @@
                 ? exportValue.replace(
-                  /\*/, submoduleName.slice(exportKey.length - 1)
+                  /\*/g, submoduleName.slice(exportKey.length - 1)
                 )
EOF
@@ -146,3 +146,3 @@
? exportValue.replace(
/\*/, submoduleName.slice(exportKey.length - 1)
/\*/g, submoduleName.slice(exportKey.length - 1)
)
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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.

3 participants