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

fix(types): Add has|usingPlugin to typedef by adding stubs which are removed from builds #8811

Merged
merged 7 commits into from
Aug 12, 2024

Conversation

mister-ben
Copy link
Contributor

@mister-ben mister-ben commented Jul 21, 2024

Description

tsc doesn't understand mixins and ignores jsdoc not followed by code. The jsdoc for the plugin methods usingPlugin() and hasPlugin() in Player are being ignored. To get them included in type outputs we need to have otherwise unnecessary stubs codes, as we already have for on() etc, which adds unnecessary, even if a small amount of, code to the outputs.

Specific Changes proposed

  • Slight refactor of Player to include those stubs.
  • Adds a rollup plugin to delete lines between certain comments, so those stubs are deleted from the outputs.
  • Applies those comments to the on() etc stubs in Component and the new plugin stubs in Player.

Any code surrounded by these comments, and the comments themselves, is deleted from the dist and test builds:

/* start-delete-from-build */
  console.log('hi');
/* start-delete-from-build */

Compared to main, video.min.js is 53 bytes smaller.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chrome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
    • Has no DOM changes which impact accessiblilty or trigger warnings (e.g. Chrome issues tab)
    • Has no changes to JSDoc which cause npm run docs:api to error
  • Reviewed by Two Core Contributors

Copy link

codecov bot commented Jul 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.78%. Comparing base (57c27f8) to head (0336001).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8811      +/-   ##
==========================================
+ Coverage   83.12%   83.78%   +0.66%     
==========================================
  Files         120      120              
  Lines        8052     8047       -5     
  Branches     1931     1931              
==========================================
+ Hits         6693     6742      +49     
+ Misses       1359     1305      -54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mister-ben mister-ben changed the title fix(types): Add has|usingPlugin to typedef fix(types): Add has|usingPlugin to typedef by adding stubs which are removed from builds Aug 9, 2024
@mister-ben mister-ben marked this pull request as ready for review August 9, 2024 07:53
@mister-ben mister-ben added the needs: LGTM Needs one or more additional approvals label Aug 9, 2024
Copy link
Member

@misteroneill misteroneill left a comment

Choose a reason for hiding this comment

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

Not a huge fan of needing to do this, but if it's the only thing that works...

@misteroneill misteroneill added confirmed and removed needs: LGTM Needs one or more additional approvals labels Aug 12, 2024
@mister-ben mister-ben merged commit 820ef38 into videojs:main Aug 12, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants