Skip to content

fix(wxt): add 'optional' to contentscript registration type - #2257

Closed
andoan16 wants to merge 1 commit into
wxt-dev:mainfrom
andoan16:contribai/improve/quality/add-optional-to-contentscript-registrati
Closed

andoan16 wants to merge 1 commit into
wxt-dev:mainfrom
andoan16:contribai/improve/quality/add-optional-to-contentscript-registrati

Conversation

@andoan16

Copy link
Copy Markdown

✨ Code Quality

Problem

Update the ContentScriptDefinition interface to include 'optional' as a valid value for the registration field. This allows content scripts to be registered with optional permissions instead of required host permissions.

Severity: high
File: packages/wxt/src/types/entrypoints.ts

Solution

Locate the ContentScriptDefinition interface (likely in types/entrypoints.ts or similar) and update the registration field type from 'manifest' | 'runtime' to 'manifest' | 'runtime' | 'optional'. Add JSDoc comments explaining that 'optional' moves matches to optional_host_permissions and requires dynamic registration.

Changes

  • packages/wxt/src/types/entrypoints.ts (new)

Overview

Manual Testing

Related Issue

This PR closes #<issue_number>


🤖 About this PR

This pull request was generated by ContribAI, an AI agent
that helps improve open source projects. The change was:

  1. Discovered by automated code analysis
  2. Generated by AI with context-aware code generation
  3. Self-reviewed by AI quality checks

If you have questions or feedback about this PR, please comment below.
We appreciate your time reviewing this contribution!

Closes #2239

Update the ContentScriptDefinition interface to include 'optional' as a valid value for the registration field. This allows content scripts to be registered with optional permissions instead of required host permissions.

Affected files: entrypoints.ts

Signed-off-by: andoan16 <[email protected]>
@andoan16
andoan16 requested a review from aklinker1 as a code owner April 13, 2026 12:30
@netlify

netlify Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for creative-fairy-df92c4 failed.

Name Link
🔨 Latest commit 648335a
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/69dce1eee73a2c0008ae02df

@github-actions github-actions Bot added the pkg/wxt Includes changes to the `packages/wxt` directory label Apr 13, 2026
@andoan16

Copy link
Copy Markdown
Author

Auto-closed: CI checks failed

The following checks failed: Redirect rules - creative-fairy-df92c4, Header rules - creative-fairy-df92c4, Pages changed - creative-fairy-df92c4

Closing this PR since required CI checks did not pass. Sorry for the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/wxt Includes changes to the `packages/wxt` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support new content script registration optional

1 participant