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

chore: @types/dom-webcodecs #2557

Merged
merged 2 commits into from
Feb 13, 2025
Merged

chore: @types/dom-webcodecs #2557

merged 2 commits into from
Feb 13, 2025

Conversation

MrKou47
Copy link
Member

@MrKou47 MrKou47 commented Feb 13, 2025

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

Summary by CodeRabbit

  • Chores

    • Added an enhanced development dependency for improved type support.
    • Streamlined commands used for generating project documentation.
  • Refactor

    • Optimized internal media processing to boost overall reliability.

Copy link

coderabbitai bot commented Feb 13, 2025

Warning

Rate limit exceeded

@MrKou47 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 32 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9c66140 and 334d688.

📒 Files selected for processing (1)
  • .github/workflows/typedoc.yml (1 hunks)

Walkthrough

This pull request introduces three distinct changes. First, it adds a new development dependency to package.json to include type definitions for web codecs. Second, it refines the setImageSource method in GLTexture2DArray.ts by updating the type assertion for improved safety. Third, it updates the Typedoc script by replacing npx with pnpx in command calls. The changes focus on enhancing type safety and streamlining tooling commands without altering the overall functionality.

Changes

File(s) Change Summary
package.json Added "@types/dom-webcodecs": "^0.1.13" to devDependencies for improved TypeScript support for web codecs.
packages/rhi-webgl/src/GLTexture2DArray.ts Modified the setImageSource method to cast imageSource to unknown before VideoFrame for better type safety.
scripts/typedoc.sh Replaced npx with pnpx in commands for executing Typedoc, maintaining the script’s overall structure.

Suggested labels

ignore for release

Suggested reviewers

  • GuoLei1990

Poem

I'm a bunny coding through the night,
Hopping over bugs with pure delight,
With type-safe bounds and commands so new,
My fluffy paws make every line true,
Carrots of code, in fields so bright!
Happy hops to a cleaner code sight!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 68.92%. Comparing base (78f7415) to head (334d688).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
packages/rhi-webgl/src/GLTexture2DArray.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2557      +/-   ##
==========================================
+ Coverage   68.90%   68.92%   +0.01%     
==========================================
  Files         961      961              
  Lines      100266   100266              
  Branches     8679     8686       +7     
==========================================
+ Hits        69092    69107      +15     
+ Misses      30914    30899      -15     
  Partials      260      260              
Flag Coverage Δ
unittests 68.92% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78f7415 and 9c66140.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • package.json (1 hunks)
  • packages/rhi-webgl/src/GLTexture2DArray.ts (1 hunks)
  • scripts/typedoc.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: release
  • GitHub Check: build (22.x, windows-latest)
  • GitHub Check: codecov
  • GitHub Check: build (22.x, macos-latest)
  • GitHub Check: lint
  • GitHub Check: e2e (22.x)
🔇 Additional comments (2)
package.json (1)

36-36:

✅ Verification successful

Verify @types/dom-webcodecs version compatibility.

Let's ensure we're using the latest compatible version of the type definitions.


🌐 Web query:

What is the latest version of @types/dom-webcodecs on npm?

💡 Result:

The latest version of @types/dom-webcodecs on npm is 0.1.13, last published on October 8, 2024[4][6]. This package provides TypeScript definitions for the WebCodecs API specifications[4][7].

For installation, use:

npm install --save @types/dom-webcodecs

The package has no dependencies and is maintained under the DefinitelyTyped repository[4][7]. Note that updates to these types may occasionally align with upcoming TypeScript releases before they become stable[1].

Citations:


@types/dom-webcodecs version is up-to-date

We verified via npm that version 0.1.13 is the latest release for the type definitions. Since the current package.json dependency already specifies "^0.1.13", no changes are necessary.

scripts/typedoc.sh (1)

17-18:

❓ Verification inconclusive

LGTM! Change to pnpx aligns with project's package manager.

The switch from npx to pnpx is correct as the project uses pnpm as its package manager.

Let's verify we're using the latest stable version of typedoc:


🌐 Web query:

What is the latest version of typedoc?

💡 Result:

The latest version of TypeDoc is 0.27.7, released on February 9, 2025[1][2][5]. This update includes features like improved file injection support with @includeCode and @inline tags, enhanced watch mode functionality, and fixes for handling type references and documentation warnings[2][4]. It supports TypeScript versions 5.0 through 5.7 and requires Node.js v18 or newer[1][3]. The package can be installed via npm with npm install typedoc[5].

Citations:


PNPX usage confirmed; verify TypeDoc dependency version.

The change from using npx to pnpx is appropriate given our use of pnpm. One note: our current setup appears to pin the TypeDoc version to 0.23.28, yet the latest stable release is 0.27.7 (released February 9, 2025). Please verify if we should update the dependency or if the current version is intentionally maintained.

Comment on lines +94 to +95
(<Exclude<TexImageSource, VideoFrame>>imageSource).width ?? (imageSource as unknown as VideoFrame).codedWidth,
(<Exclude<TexImageSource, VideoFrame>>imageSource).height ?? (imageSource as unknown as VideoFrame).codedHeight,
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify type assertions and add null checks.

The current type assertions are complex and could be simplified while improving type safety.

Consider this safer implementation:

-      (<Exclude<TexImageSource, VideoFrame>>imageSource).width ?? (imageSource as unknown as VideoFrame).codedWidth,
-      (<Exclude<TexImageSource, VideoFrame>>imageSource).height ?? (imageSource as unknown as VideoFrame).codedHeight,
+      'codedWidth' in imageSource ? imageSource.codedWidth : imageSource.width,
+      'codedHeight' in imageSource ? imageSource.codedHeight : imageSource.height,

This approach:

  1. Uses property checks instead of type assertions
  2. Eliminates potential undefined access
  3. Is more maintainable and type-safe
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
(<Exclude<TexImageSource, VideoFrame>>imageSource).width ?? (imageSource as unknown as VideoFrame).codedWidth,
(<Exclude<TexImageSource, VideoFrame>>imageSource).height ?? (imageSource as unknown as VideoFrame).codedHeight,
'codedWidth' in imageSource ? imageSource.codedWidth : imageSource.width,
'codedHeight' in imageSource ? imageSource.codedHeight : imageSource.height,

@MrKou47 MrKou47 merged commit 813242e into main Feb 13, 2025
7 checks passed
@MrKou47 MrKou47 deleted the chore/webcodecs-type branch February 13, 2025 09:25
@GuoLei1990 GuoLei1990 added the ignore for release ignore for release label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore for release ignore for release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants