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

Migrates to WXT #105

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Migrates to WXT #105

wants to merge 21 commits into from

Conversation

Royal-lobster
Copy link
Owner

@Royal-lobster Royal-lobster commented Dec 29, 2024

Closes #103

Summary by CodeRabbit

  • New Features

    • Added a copy button in the chat interface that provides visual confirmation when messages are copied.
  • Enhancements

    • Updated the settings navigation to streamline access.
    • Expanded content script activation to work across all URLs.
  • Chores

    • Bumped the version from 1.5.3 to 1.5.4.
    • Performed various internal cleanups and configuration refinements.

Copy link

stackblitz bot commented Dec 29, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

changeset-bot bot commented Dec 29, 2024

⚠️ No Changeset found

Latest commit: 1ab6018

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Dec 29, 2024

Walkthrough

This pull request removes several redundant configuration, manifest, and type definition files while updating build settings and code style. The changes include version bumps, minor formatting adjustments, refactoring of background and content scripts, updated CSS/script source paths, and revised URL references. A new UI state is added for copy feedback, and certain message listener files were removed. Additionally, ignore lists and changelog entries have been updated.

Changes

Files Summary
.wxt/tsconfig.json, manifest.config.ts, tsconfig.node.json, .output/chrome-mv3/*, .wxt/types/*, .wxt/wxt.d.ts Deleted outdated configuration, manifest, and global TypeScript declaration files.
package.json, tsconfig.json, vite.config.ts, theme.ts Minor updates including version bump (1.5.3 → 1.5.4), newline addition, removal of custom build options, and type annotation change.
src/entrypoints/background/index.ts, src/entrypoints/content/index.ts, src/.../header.tsx, src/.../forwardContextMenu.ts, src/.../sidebar_bg.content/sidebar.tsx Updated entry point references and refactored background functionality (encapsulating multiple functions into a main method) along with URL path modifications.
src/entrypoints/settings/main.tsx, src/entrypoints/sidebar/main.tsx, src/entrypoints/options/index.html Updated CSS import paths (from index.css to styles.css) and changed script source from index.tsx to main.tsx.
wxt.config.ts, src/logs.tsx, src/entrypoints/quick-menu.content/*, src/.../sidebar_bg.content/index.ts Standardized code formatting and style adjustments (switching to single quotes, operator changes, removal of extra semicolons/blanks, and general reformatting).
src/components/Sidebar/chat/ChatList.tsx Introduced a new state variable for displaying a copy confirmation icon with a timed effect.
src/entrypoints/content/quick-menu/listenContextMenu.tsx, src/pages/content/quick-menu/listenContextMenu.tsx Removed context menu listener files.
.gitignore, biome.json, CHANGELOG.md Updated ignore lists (adding .wxt, .output, and more entries) and added a new patch entry (1.5.4 with copy button) in the changelog.

Sequence Diagram(s)

sequenceDiagram
  participant U as User/Event
  participant BG as Background (main)
  U->>BG: Trigger background functionality
  BG->>BG: Initialize logging, sidebar listeners, & quick menu
  BG-->>U: Complete setup
Loading
sequenceDiagram
  participant U as User
  participant CL as ChatList Component
  U->>CL: Clicks copy button
  CL->>CL: Set showCopiedText = true (display checkmark)
  Note right of CL: Wait for 3 seconds
  CL->>CL: Set showCopiedText = false (hide checkmark)
Loading

Poem

I'm a bunny with a sprightly code,
Hopping through files as they lighten the load.
Old configs and types have hopped away,
New states and paths make a brand new day.
With every line, my heart does tap—
A coding bunny's joyful rap! 🐇
Hop on and code, let’s bridge the gap!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f6dc97c and 1ab6018.

⛔ Files ignored due to path filters (32)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • src/public/icon-128.png is excluded by !**/*.png
  • src/public/icon-16.png is excluded by !**/*.png
  • src/public/icon-32.png is excluded by !**/*.png
  • src/public/icon-48.png is excluded by !**/*.png
  • src/public/robot.png is excluded by !**/*.png
  • .output/chrome-mv3/icon-128.png is excluded by !**/*.png
  • .output/chrome-mv3/icon-16.png is excluded by !**/*.png
  • .output/chrome-mv3/icon-32.png is excluded by !**/*.png
  • .output/chrome-mv3/icon-48.png is excluded by !**/*.png
  • .output/chrome-mv3/robot.png is excluded by !**/*.png
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • src/public/icon-128.png is excluded by !**/*.png
  • src/public/icon-16.png is excluded by !**/*.png
  • src/public/icon-32.png is excluded by !**/*.png
  • src/public/icon-48.png is excluded by !**/*.png
  • src/public/images/icon-128.png is excluded by !**/*.png
  • src/public/images/icon-16.png is excluded by !**/*.png
  • src/public/images/icon-32.png is excluded by !**/*.png
  • src/public/images/icon-48.png is excluded by !**/*.png
  • src/public/images/robot.png is excluded by !**/*.png
  • src/public/robot.png is excluded by !**/*.png
  • src/public/icon-128.png is excluded by !**/*.png
  • src/public/icon-16.png is excluded by !**/*.png
  • src/public/icon-32.png is excluded by !**/*.png
  • src/public/icon-48.png is excluded by !**/*.png
  • src/public/images/icon-128.png is excluded by !**/*.png
  • src/public/images/icon-16.png is excluded by !**/*.png
  • src/public/images/icon-32.png is excluded by !**/*.png
  • src/public/images/icon-48.png is excluded by !**/*.png
  • src/public/images/robot.png is excluded by !**/*.png
  • src/public/robot.png is excluded by !**/*.png
📒 Files selected for processing (95)
  • .wxt/tsconfig.json (1 hunks)
  • manifest.config.ts (0 hunks)
  • package.json (2 hunks)
  • tsconfig.json (2 hunks)
  • tsconfig.node.json (0 hunks)
  • vite.config.ts (1 hunks)
  • wxt.config.ts (1 hunks)
  • wxt.config.ts (1 hunks)
  • src/entrypoints/background/index.ts (1 hunks)
  • vite.config.ts (0 hunks)
  • src/entrypoints/settings/main.tsx (1 hunks)
  • src/entrypoints/sidebar/index.html (1 hunks)
  • src/entrypoints/sidebar/main.tsx (1 hunks)
  • .output/chrome-mv3/chunks/reload-html-BxzUToPe.js (1 hunks)
  • .output/chrome-mv3/manifest.json (1 hunks)
  • .output/chrome-mv3/settings.html (1 hunks)
  • .output/chrome-mv3/sidebar.html (1 hunks)
  • .wxt/tsconfig.json (1 hunks)
  • .wxt/types/globals.d.ts (1 hunks)
  • .wxt/types/i18n.d.ts (1 hunks)
  • .wxt/types/imports.d.ts (1 hunks)
  • .wxt/types/paths.d.ts (1 hunks)
  • .wxt/wxt.d.ts (1 hunks)
  • tsconfig.json (1 hunks)
  • package.json (1 hunks)
  • tsconfig.json (1 hunks)
  • theme.ts (1 hunks)
  • .gitignore (2 hunks)
  • .gitignore (1 hunks)
  • .output/chrome-mv3/manifest.json (2 hunks)
  • .wxt/types/imports.d.ts (2 hunks)
  • CHANGELOG.md (1 hunks)
  • package.json (1 hunks)
  • wxt.config.ts (1 hunks)
  • src/entrypoints/content/index.ts (1 hunks)
  • src/logs.tsx (1 hunks)
  • src/entrypoints/content/index.ts (1 hunks)
  • src/entrypoints/content/index.ts (2 hunks)
  • src/entrypoints/content/index.ts (0 hunks)
  • .output/chrome-mv3/manifest.json (2 hunks)
  • .wxt/types/paths.d.ts (1 hunks)
  • src/entrypoints/content/index.ts (1 hunks)
  • .gitignore (1 hunks)
  • .output/chrome-mv3/chunks/reload-html-BxzUToPe.js (0 hunks)
  • .output/chrome-mv3/manifest.json (0 hunks)
  • .output/chrome-mv3/settings.html (0 hunks)
  • .output/chrome-mv3/sidebar.html (0 hunks)
  • .wxt/tsconfig.json (0 hunks)
  • .wxt/types/globals.d.ts (0 hunks)
  • .wxt/types/i18n.d.ts (0 hunks)
  • .wxt/types/imports.d.ts (0 hunks)
  • .wxt/types/paths.d.ts (0 hunks)
  • .wxt/wxt.d.ts (0 hunks)
  • src/components/Sidebar/layout/header.tsx (1 hunks)
  • src/entrypoints/background/quick-menu/forwardContextMenu.ts (1 hunks)
  • src/entrypoints/content/quick-menu/listenContextMenu.tsx (0 hunks)
  • src/entrypoints/options/index.html (1 hunks)
  • src/entrypoints/quick-menu.content/index.ts (1 hunks)
  • src/entrypoints/quick-menu.content/initQuickMenu.tsx (2 hunks)
  • src/entrypoints/quick-menu.content/listenContextMenu.tsx (1 hunks)
  • src/entrypoints/sidebar_bg.content/index.ts (2 hunks)
  • src/entrypoints/sidebar_bg.content/sidebar.tsx (1 hunks)
  • wxt.config.ts (1 hunks)
  • .gitignore (1 hunks)
  • .output/chrome-mv3/chunks/reload-html-BxzUToPe.js (0 hunks)
  • .output/chrome-mv3/manifest.json (0 hunks)
  • .output/chrome-mv3/settings.html (0 hunks)
  • .output/chrome-mv3/sidebar.html (0 hunks)
  • .wxt/tsconfig.json (0 hunks)
  • .wxt/types/globals.d.ts (0 hunks)
  • .wxt/types/i18n.d.ts (0 hunks)
  • .wxt/types/imports.d.ts (0 hunks)
  • .wxt/types/paths.d.ts (0 hunks)
  • .wxt/wxt.d.ts (0 hunks)
  • src/components/Sidebar/layout/header.tsx (1 hunks)
  • src/entrypoints/background/quick-menu/forwardContextMenu.ts (1 hunks)
  • src/entrypoints/content/quick-menu/listenContextMenu.tsx (0 hunks)
  • src/entrypoints/options/index.html (1 hunks)
  • src/entrypoints/quick-menu.content/index.ts (1 hunks)
  • src/entrypoints/quick-menu.content/initQuickMenu.tsx (2 hunks)
  • src/entrypoints/quick-menu.content/listenContextMenu.tsx (1 hunks)
  • src/entrypoints/sidebar_bg.content/index.ts (2 hunks)
  • src/entrypoints/sidebar_bg.content/sidebar.tsx (1 hunks)
  • wxt.config.ts (1 hunks)
  • src/entrypoints/quick-menu.content/index.ts (1 hunks)
  • src/entrypoints/quick-menu.content/initQuickMenu.tsx (1 hunks)
  • src/entrypoints/quick-menu.content/listenContextMenu.tsx (0 hunks)
  • src/entrypoints/sidebar_bg.content/index.ts (1 hunks)
  • src/logs.tsx (1 hunks)
  • wxt.config.ts (1 hunks)
  • src/components/Sidebar/chat/ChatList.tsx (1 hunks)
  • src/components/Sidebar/chat/ChatList.tsx (4 hunks)
  • biome.json (1 hunks)
  • tsconfig.json (1 hunks)
  • src/pages/content/quick-menu/listenContextMenu.tsx (0 hunks)
💤 Files with no reviewable changes (5)
  • tsconfig.node.json
  • src/pages/content/quick-menu/listenContextMenu.tsx
  • src/entrypoints/content/quick-menu/listenContextMenu.tsx
  • src/entrypoints/content/quick-menu/listenContextMenu.tsx
  • manifest.config.ts
🔇 Additional comments (38)
biome.json (1)

12-19: Appropriate ignore list updates for WXT migration.

The addition of ".wxt", ".output", and "artifacts" to the ignore list is correctly aligned with the migration to WXT. These directories typically contain generated files that shouldn't be linted or formatted.

.wxt/wxt.d.ts (1)

1-6: Centralized TypeScript Definitions for WXT Migration

This new declaration file consolidates essential type definitions by referencing external definition files for environment, paths, i18n, globals, and imports. Verify that all the referenced files (i.e., "wxt/vite-builder-env", "./types/paths.d.ts", "./types/i18n.d.ts", "./types/globals.d.ts", and "./types/imports.d.ts") exist in the correct locations as per the updated project structure. This approach supports both type checking and IntelliSense in development environments during the migration.

.wxt/types/i18n.d.ts (1)

1-81: Type definitions look well-structured and properly documented.

This file provides proper TypeScript type definitions for internationalization (i18n) features in the WXT framework. The documentation includes links to Chrome's extension API references and clear descriptions of each special message identifier. This will help ensure type safety when using i18n features throughout the application.

The migration to WXT includes this auto-generated type definition file which will help catch potential i18n-related errors at compile time rather than runtime.

src/entrypoints/settings/main.tsx (1)

2-2: CSS Import Update to "styles.css"

The import statement has been updated from the old naming (likely "index.css") to "styles.css" to align with the standardized naming conventions across the project. Please verify that the "styles.css" file exists at the specified relative path and that all other entrypoints are consistently updated.

src/entrypoints/sidebar/main.tsx (2)

1-3: Consistent CSS import update.
The import has been updated from the previous filename (likely index.css) to styles.css, which aligns with the current naming convention across the project.


5-9: Clear initialization and rendering.
The init() function correctly checks for the root container and creates the React root for rendering. No issues found.

src/entrypoints/sidebar/index.html (1)

10-11: Updated script entry point.
The <script> tag now correctly points to main.tsx rather than the former index.tsx, ensuring coherence with the updated file structure for the sidebar entry.

src/entrypoints/options/index.html (1)

10-11: Consistent entry point update.
The changes correctly update the <script> reference to main.tsx, just as in the sidebar entry, ensuring consistency across the entrypoints for the extension’s UI.

CHANGELOG.md (1)

3-7: Changelog version and patch entry update.
A new version entry (## 1.5.4) with corresponding patch details has been added. This update clearly documents the addition of the copy button (commit f68c05e) and aligns with the overall release process.

src/logs.tsx (1)

2-2: Code style standardization adds semicolons consistently

The addition of semicolons throughout this file is consistent with modern TypeScript style conventions and likely aligns with WXT's preferred code style. These changes are purely stylistic and don't affect functionality.

Also applies to: 4-4, 7-8, 11-12

src/components/Sidebar/layout/header.tsx (1)

11-11: Consistent URL path update for WXT compatibility

This change updates the settings page URL to '/options.html', maintaining consistency with the same change in the context menu handler. This systematic update ensures that all navigation to the settings page uses the standardized WXT path structure.

src/entrypoints/sidebar_bg.content/sidebar.tsx (1)

17-17:

❓ Verification inconclusive

Updated sidebar iframe source to WXT standard path

This change updates the iframe source from a nested path ('/src/pages/sidebar/index.html') to the WXT convention ('/sidebar.html'), completing the systematic update of HTML page references throughout the codebase. This ensures the sidebar will load correctly in the new WXT structure.


🏁 Script executed:

#!/bin/bash
# Verify that the sidebar.html file exists in the project
ls -la *.html | grep sidebar.html

Length of output: 91


Below is a new shell script to search the repository recursively for the sidebar.html file. The previous command only looked in the current directory, so this should provide a more complete picture. Please run this script and share the output if the file isn’t found as expected:

If no output is produced, please perform a manual verification to ensure that sidebar.html is included (or appropriately generated/packaged) as part of the project.

Once the file’s location is confirmed, we can finalize the review comment on this update accordingly.


🏁 Script executed:

#!/bin/bash
find . -type f -name "sidebar.html"

Length of output: 157


Sidebar iframe source updated to WXT standard path – please verify file inclusion

This change correctly updates the iframe’s src from a nested path (e.g. /src/pages/sidebar/index.html) to the standardized /sidebar.html, completing the URL migration pattern for WXT compliance. However, automated search did not locate a sidebar.html file in the repository. Please ensure that this file is either generated during the build process or otherwise included in the project so that the sidebar loads properly.

  • Confirm that sidebar.html is present in the final build output or included in the deployment package.
  • If it is generated, verify that the build configuration correctly outputs the file at the expected location.
.gitignore (1)

10-15: New Ignore Patterns for Build Artifacts and WXT Configuration Added
The addition of .output, stats.html, stats-*.json, .wxt, and web-ext.config.ts helps align the ignore list with the new build artifacts and configuration changes for the WXT migration.

tsconfig.json (1)

6-10: Improved Formatting for the lib Array
Reformatting the lib property into a multi-line array improves readability without altering functionality.

src/components/Sidebar/chat/ChatList.tsx (4)

1-7: Great addition of the checkmark icon for UX improvement!

The inclusion of RiCheckLine from react-icons allows for visual feedback in the copy operation.


32-41: Well-implemented copy feedback mechanism!

The implementation of the copy feedback state with an automatic timeout is clean and follows React best practices. The timeout cleanup in the useEffect hook prevents memory leaks - nice work!


64-64: Good state update in copy handler!

Properly setting the feedback state when copying a message.


112-116: Clean conditional rendering implementation!

The conditional rendering between the checkmark and copy icon provides excellent visual feedback to users.

src/entrypoints/background/index.ts (1)

11-26: Successfully refactored for WXT compatibility!

The background script has been properly restructured to use WXT's defineBackground pattern with a main method. This follows the WXT framework conventions while maintaining the same functionality.

Good organization with the descriptive comments that group related functionality.

src/entrypoints/quick-menu.content/initQuickMenu.tsx (1)

36-36: No functional changes introduced.
Removing the semicolon from the export statement is purely a stylistic adjustment and does not impact functionality.

src/entrypoints/sidebar_bg.content/index.ts (1)

15-15:

✅ Verification successful

Confirm the new iframe source path.
Please verify that "sidebar.html" exists in the final extension build output. A mismatch could cause runtime errors if no file is generated at this location.

Run the following script to locate any references to "sidebar.html" and ensure it is generated or referenced correctly:


🏁 Script executed:

#!/bin/bash
# Look for "sidebar.html" references in the codebase to confirm generation paths
rg "sidebar.html" .

Length of output: 308


Confirm iframe source path is correctly configured

  • The search output confirms that "sidebar.html" is listed in wxt.config.ts under the resources array and is referenced in both src/entrypoints/sidebar_bg.content/index.ts and src/entrypoints/sidebar_bg.content/sidebar.tsx.
  • This verifies that the file is generated as part of the final extension build output, so the iframe source in index.ts using chrome.runtime.getURL('sidebar.html') should work as expected.
  • Note: The reference in sidebar.tsx uses a leading slash ('/sidebar.html'). Please verify that this discrepancy is intentional and does not lead to any inconsistencies in runtime behavior.
vite.config.ts (1)

1-20:

✅ Verification successful

Verify the WXT migration and build flow.
You've replaced the standard Vite configuration with WXT modules and reorganized the server/build sections. Ensure that your new setup successfully builds and bundles your extension without any regressions or untracked dependencies.

Run this shell script to confirm that the WXT configuration is recognized and that references to wxt or @wxt-dev/module-react are consistent throughout the codebase:


🏁 Script executed:

#!/bin/bash
# Searching references to "wxt" and "@wxt-dev/module-react" in the repository
rg "wxt" .
rg "@wxt-dev/module-react" .

Length of output: 2192


WXT integration verified: The configuration appears consistent across the repository.

After running the provided script, all references to both wxt and @wxt-dev/module-react are aligned in the codebase. The changes in vite.config.ts—importing from 'wxt' and including the module—are consistent with the usage seen in other places (such as in wxt.config.ts, package.json, and lockfiles).

Please ensure that the build and bundling flows (e.g., running wxt build and related commands) complete successfully without regressions.

src/entrypoints/content/index.ts (1)

69-76: LGTM: Effective implementation of the content script using WXT pattern

The overall structure follows the WXT pattern effectively by using defineContentScript with a main function that initializes the sidebar and sets up message handlers.

.wxt/tsconfig.json (2)

1-11: TypeScript Compiler Options Are Well Configured

The compiler options set here (including "target": "ESNext", "module": "ESNext", "moduleResolution": "Bundler", "noEmit": true, along with strict type-checking options) provide a robust configuration for modern development with TypeScript. These settings should help enforce consistency and catch potential type issues early.


12-21: Alias Paths Are Effectively Defined

The alias mappings set for "@", "@/*", "~", "~/*", etc., clearly define how modules are resolved to the source directories. Please verify that these paths reflect the intended project structure post-migration to WXT and that all module references throughout the codebase have been updated accordingly.

.output/chrome-mv3/manifest.json (2)

52-57: Update to Sidebar Script and URL Matching

The sidebar content script file path has been updated to "src/entrypoints/content/sidebar.tsx", and the match pattern now includes "<all_urls>". Please verify that this wide URL match is intentional given the migration to WXT, as it allows the script to run on all pages.


62-79: Update to Quick-Menu Scripts and Web Resources

The quick-menu scripts have been updated to use the new file paths "src/entrypoints/content/quick-menu/initQuickMenu.tsx" and "src/entrypoints/content/quick-menu/listenContextMenu.tsx". However, the AI summary mentioned that listenContextMenu.tsx should have been deleted. Please verify whether the reference to this file is intentional or if it should be removed from the manifest.

Additionally, the web accessible resources now reference the HTML files using "src/entrypoints/sidebar/index.html" and "src/entrypoints/settings/index.html". Consider reviewing the match pattern "http://*/*"—if your extension is expected to work over HTTPS as well, you might want to include a corresponding pattern.

Likely an incorrect or invalid review comment.

.output/chrome-mv3/chunks/reload-html-BxzUToPe.js (6)

1-37: Well-implemented modulepreload polyfill

This section implements a polyfill for the modulepreload link relation, which handles browsers that don't natively support this feature. The implementation correctly:

  • Checks for native support before applying the polyfill
  • Processes existing modulepreload links
  • Sets up a MutationObserver to handle dynamically added links
  • Respects integrity, referrerPolicy, and crossOrigin attributes

This is a standard approach for ensuring modulepreload functionality works across browsers.


38-51: Effective logging utility implementation

The logging utility provides a clean wrapper around console methods with consistent formatting. The implementation:

  • Adds a "[wxt]" prefix to all messages for easy identification
  • Supports both string and non-string arguments
  • Provides all standard logging levels (debug, log, warn, error)

This follows good practices for extension logging.


58-59: Clean WebSocket method extensions

The WebSocket object extensions are well-implemented:

  • addWxtEventListener provides a bound method for event handling
  • sendCustom handles JSON serialization of custom events with proper null checking via the optional chaining operator

These extensions facilitate the dev server communication protocol.


84-94: Reload functionality properly implemented

The page reload functionality is correctly implemented:

  • It properly handles errors that might occur during WebSocket setup
  • The pathname check ensures only the current page reloads when requested
  • The error logging provides useful context for debugging

This implementation follows best practices for live-reloading during development.


95-95: Source map correctly included

The source map is correctly included and provides mapping to the original source file, which will help with debugging during development.


52-83:

❓ Verification inconclusive

Verify WebSocket server configuration

The WebSocket implementation for dev server communication looks good overall, but the hardcoded server details warrant verification.

The code at line 55 uses hardcoded values: ws://localhost:3000 for the WebSocket connection. While this might be the standard WXT development server configuration, you should confirm this matches your actual development setup.


🏁 Script executed:

#!/bin/bash
# Check if there are any configuration files specifying different WebSocket ports
fd -t f -e ts -e js -e json | xargs grep -l "3000" | grep -i config

Length of output: 67


Action: Please manually verify that the hardcoded WebSocket endpoint is intentional.

  • Our initial search for configuration files (using a grep on “3000” in config-related files) produced no overrides.
  • The connection in the dev server code uses the default value ws://localhost:3000.
  • Confirm that this endpoint reflects your actual development setup or update it if a custom configuration is needed.
wxt.config.ts (1)

3-43: Well-structured manifest generation approach

Extracting the manifest generation into a separate function improves code organization and readability. This modular approach makes future maintenance easier.

package.json (3)

67-67: Addition of React module for WXT

The addition of @wxt-dev/module-react supports the migration to WXT by providing React integration capabilities that were likely previously handled by the removed Vite plugin.


72-72:

❓ Verification inconclusive

Verify TypeScript 5.x compatibility

The upgrade from TypeScript 4.9.5 to 5.6.3 is a major version change that may introduce breaking changes in type checking. Ensure all TypeScript code is compatible with version 5.x.


🏁 Script executed:

#!/bin/bash
# Check for any TypeScript errors after the upgrade
npx tsc --noEmit

Length of output: 645


Below is an updated verification suggestion that bypasses the unintended auto-install behavior. Instead of invoking TypeScript with a plain npx tsc (which can trigger the installation of an unexpected package), please run the following script to force usage of the local installation:

#!/bin/bash
# Verify that the locally installed TypeScript (expected version 5.6.3) is in use.
npx --no-install tsc --version

# Run a type-check without emitting files to ensure no TypeScript errors.
npx --no-install tsc --noEmit

Next Steps:

  • Confirm that the version output is indeed “5.6.3”.
  • Verify that no type errors are reported when running the --noEmit command.

Once these checks pass without issues, you can be confident that the upgrade to TypeScript 5.x did not break compatibility with your code.


73-73:

❓ Verification inconclusive

Verify intentional WXT version downgrade

The WXT version has been downgraded from 0.19.23 to 0.19.13. Is this intentional? If so, please document the reason for using an older version.


🌐 Web query:

What's the latest stable version of WXT?

💡 Result:

The latest stable version of WXT is v0.19.29, as indicated by the most recent release notes in its GitHub repository[2]. This version includes several fixes and updates, such as support for Vite 6 and improvements to the emulator's file-change detection[2].

For context:

  • WXT is currently in pre-release (versions labeled v0.X), where minor updates (e.g., v0.18v0.19) may contain breaking changes[1].
  • Recent updates include a switch to vite-node for entrypoint loading and adjustments to TypeScript configurations for service workers[1][2].

To upgrade, use:

pnpm i wxt@latest

Citations:


Action Required: Confirm and Document WXT Version Downgrade

The package.json file now specifies "wxt": "^0.19.13", which represents a downgrade from the previously used version (0.19.23) even though the latest stable version is 0.19.29. Please confirm whether this version downgrade was intentional. If so, add documentation or a code comment explaining the rationale behind choosing this older version (e.g., compatibility considerations, avoidance of breaking changes, etc.).

  • File: package.json (Line 73)
  • Diff Context:
        "wxt": "^0.19.13"
.wxt/types/imports.d.ts (1)

1-52:

❓ Verification inconclusive

Auto-generated file with hardcoded absolute paths.

This auto-generated file contains absolute file paths specific to a developer's machine (e.g., /Users/srujangurram/Developer/Personal/Syncia/src/hooks/useCurrentChat). While this is likely expected behavior for WXT's development workflow, be aware that these paths will be different for each developer's environment.

Can you verify this is expected behavior for WXT? This approach may work for local development, but could potentially cause issues in CI/CD environments or when other developers clone the repository.


🏁 Script executed:

#!/bin/bash
# Check WXT documentation or examples for how import paths are typically handled
rg -l "wxt/types/imports.d.ts" --type md

Length of output: 40


Absolute Paths in Auto-Generated File

The file .wxt/types/imports.d.ts is auto-generated and includes absolute paths (e.g., paths beginning with /Users/). While this appears to be intentional for local development, it raises concern over potential issues in CI/CD environments or on machines of other developers. Please verify whether:

  • This auto-generation with absolute paths is an expected and accepted behavior within WXT's development workflow.
  • There are safeguards in place (such as environment-based overrides) to prevent these paths from affecting CI/CD or shared development environments.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @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.

@Adebesin-Cell
Copy link
Collaborator

Help wanted?

@Royal-lobster
Copy link
Owner Author

Help wanted?

Oh yes ! help always welcome, for this you need this: then pnpm dev would open vivaldi with dev extension installed automatically

// web-ext.config.ts

import { defineRunnerConfig } from 'wxt'

export default defineRunnerConfig({
  binaries: {
    chrome: '/Applications/Vivaldi.app/Contents/MacOS/Vivaldi',
  },
})

@Adebesin-Cell
Copy link
Collaborator

Adebesin-Cell commented Jan 17, 2025

Help wanted?

Oh yes ! help always welcome, for this you need this: then pnpm dev would open vivaldi with dev extension installed automatically

// web-ext.config.ts

import { defineRunnerConfig } from 'wxt'

export default defineRunnerConfig({
  binaries: {
    chrome: '/Applications/Vivaldi.app/Contents/MacOS/Vivaldi',
  },
})

Got it, thanks! 👏

@Adebesin-Cell
Copy link
Collaborator

Screenshot 2025-01-19 at 7 04 54 PM

Perhaps I'm doing sth wrong, trying to run the extensions, I altered pages to point to entrypoints since it felt like a path issue, but get same error.
How did you resolve the error?

@Royal-lobster
Copy link
Owner Author

Perhaps I'm doing sth wrong, trying to run the extensions, I altered pages to point to entrypoints since it felt like a path issue, but get same error. How did you resolve the error?

Hmm seeing this for first time, but yeah i think first we need to do the folder structure refactoring to match wxt framework. i think it should work once we set it up

@Adebesin-Cell
Copy link
Collaborator

Perhaps I'm doing sth wrong, trying to run the extensions, I altered pages to point to entrypoints since it felt like a path issue, but get same error. How did you resolve the error?

Hmm seeing this for first time, but yeah i think first we need to do the folder structure refactoring to match wxt framework. i think it should work once we set it up

Screenshot 2025-01-25 at 9 43 39 PM

Yep, seems it's file path issue, different error this time 😅

@Royal-lobster Royal-lobster marked this pull request as ready for review March 11, 2025 15:49
Copy link
Contributor

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 7

🧹 Nitpick comments (14)
theme.ts (1)

90-90: Consider using a more specific type than any in a future update.

While using : any helps unblock the WXT migration by bypassing type errors, it reduces type safety. Consider replacing it with a more specific interface or type definition in a follow-up PR to maintain strong typing.

-  maxWidth: ({ theme, breakpoints }: any) => ({
+  maxWidth: ({ theme, breakpoints }: { theme: Record<string, any>; breakpoints: (screens: any) => Record<string, string> }) => ({
src/entrypoints/quick-menu.content/listenContextMenu.tsx (1)

1-10: New context menu listener file overview.
The new file imports the necessary functions (findPrompt and generatePromptInSidebar) and includes a descriptive comment outlining its purpose—to listen for messages (e.g., from chrome.tabs.sendMessage) and generate a prompt in the sidebar.

However, the file currently only includes the import statements and accompanying comments. Verify if the event listener logic (e.g., using chrome.runtime.onMessage.addListener) is intended to be implemented here or elsewhere. If not already handled, consider adding the actual event listening mechanism to complete the functionality.

.gitignore (1)

27-29: Duplicate Ignore Pattern Entries Detected
The entries for web-ext.config.ts, .wxt, and .output appear twice in the file. To avoid redundancy and simplify maintenance, consider removing the duplicate entries (lines 27–29) if they are not required for different contexts.

src/entrypoints/quick-menu.content/index.ts (2)

7-10: Content script setup looks good, with minor redundancy

The content script configuration uses correct WXT pattern with defineContentScript. However, the matches array includes both specific URL patterns and <all_urls>, which is redundant since <all_urls> already covers all possible URLs.

-  matches: ['http://*/*', 'https://*/*','<all_urls>'],
+  matches: ['<all_urls>'],

11-27: Add error handling for storage operations

The chrome storage operation lacks error handling. Consider adding error handling to gracefully manage potential storage access issues.

-    chrome.storage.sync.get(['SETTINGS'], (result) => {
+    chrome.storage.sync.get(['SETTINGS'], (result) => {
         const quickMenuSettings = result.SETTINGS?.quickMenu as Settings['quickMenu']
         if (quickMenuSettings) {
           if (quickMenuSettings.enabled) {
             if (quickMenuSettings.excludedSites.length === 0) initQuickMenu()
             else {
               const whitelister = new Whitelister(
                 quickMenuSettings.excludedSites || '*',
               )
               const isExcluded = whitelister.verify(window.location.href)
               if (!isExcluded) initQuickMenu()
             }
           }
         } else {
           initQuickMenu()
         }
-      })
+      }).catch(error => {
+        console.error('Error accessing settings:', error);
+        // Fallback behavior - could be to not initialize or to initialize with defaults
+      })
src/entrypoints/sidebar_bg.content/index.ts (1)

70-70: Remove redundant protocol matches.
"<all_urls>" already encompasses http://*/* and https://*/*. Leaving them in will not break anything, but removing them could make the configuration clearer.

Apply this diff for clarity:

-  matches: ['http://*/*', 'https://*/*','<all_urls>'],
+  matches: ['<all_urls>'],
src/entrypoints/content/index.ts (4)

12-12: Excessively large z-index value

The z-index value of '9000000000000000000' is unnecessarily high and may exceed JavaScript's safe integer limits. Consider using a more reasonable value like '2147483647' (max 32-bit integer) or '9999'.

-  iframe.style.zIndex = '9000000000000000000'
+  iframe.style.zIndex = '2147483647'

47-52: Clipboard operation is missing user feedback

Consider providing visual feedback to the user when content is copied to the clipboard or when the operation fails.

    if (action === 'copy-to-clipboard') {
      const { content } = _payload as { content: string }
-      navigator.clipboard.writeText(content).catch((err) => {
+      navigator.clipboard.writeText(content).then(() => {
+        iframe.contentWindow?.postMessage(
+          {
+            action: 'clipboard-copy-success',
+          },
+          chrome.runtime.getURL(''),
+        )
+      }).catch((err) => {
        console.error('Clipboard write failed', err)
+        iframe.contentWindow?.postMessage(
+          {
+            action: 'clipboard-copy-error',
+            payload: err.message,
+          },
+          chrome.runtime.getURL(''),
+        )
      })
    }

54-65: Potential UI flicker when taking screenshots

The current implementation hides and then shows the iframe when taking a screenshot, which could cause a visible UI flicker. Consider adding a transition effect or exploring alternative methods that don't require hiding the sidebar.

    if (action === 'get-screenshot-image') {
-      iframe.style.width = '0px'
+      // Store the current width before hiding
+      const currentWidth = iframe.style.width
+      iframe.style.transition = 'none' // Disable transitions temporarily
+      iframe.style.width = '0px'
      const image = await getScreenshotImage()
-      iframe.style.width = '400px'
+      iframe.style.width = currentWidth
+      // Re-enable transitions after a brief delay
+      setTimeout(() => {
+        iframe.style.transition = 'width 0.3s ease'
+      }, 50)
      iframe.contentWindow?.postMessage(
        {
          action: 'get-screenshot-image',
          payload: image,
        },
-        '*',
+        chrome.runtime.getURL(''),
      )
    }

31-34: Improve type safety for message handling

Using any for the payload type reduces type safety. Consider creating a proper type definition for the expected message structure.

+  type MessageEvent = {
+    action: 'get-page-content' | 'copy-to-clipboard' | 'get-screenshot-image';
+    _payload?: {
+      content?: string;
+    };
+  };
+
  window.addEventListener('message', async (event) => {
-    const { action, _payload } = event.data as {
-      action: string
-      _payload: any
-    }
+    const { action, _payload } = event.data as MessageEvent;
.wxt/tsconfig.json (2)

23-26: Broad Inclusion Patterns – Confirm Intent

The "include" pattern ["../**/*", "./wxt.d.ts"] is quite broad and may include more files than strictly necessary. Ensure that this pattern intentionally targets only the required source files and does not inadvertently compile unrelated files, which could affect build performance.


27-27: Exclude Configuration Check

Excluding the "../.output" directory is appropriate for preventing build artifacts from being processed. Consider reviewing if additional directories (such as node_modules or other build directories) should also be excluded to further optimize the compilation process.

wxt.config.ts (2)

33-40: Consider using strict equality for manifest version check

The condition uses != for comparison. For better TypeScript practices, consider using strict equality (!==) instead.

- if (import.meta.env.MANIFEST_VERSION != 2) {
+ if (import.meta.env.MANIFEST_VERSION !== 2) {

45-67: Missing documentation for background and content scripts

According to the PR summary, background and content scripts sections were removed. Consider adding a comment explaining where these are now defined in the WXT framework structure.

 export default defineConfig({
   extensionApi: "webextension-polyfill",
   srcDir: "src",
   manifest: generateManifest(),
+  // Note: Background scripts and content scripts are now defined in their respective 
+  // entrypoint files under the src/ directory according to WXT conventions
   hooks: {
🛑 Comments failed to post (7)
src/entrypoints/background/quick-menu/forwardContextMenu.ts (1)

5-5: 💡 Verification agent

❓ Verification inconclusive

Updated URL path to align with WXT convention

The URL path has been updated from a nested structure ('/src/pages/settings/index.html') to the standard WXT convention ('/options.html'). This change is appropriate for the WXT migration and maintains the same functionality.

Make sure the '/options.html' page exists and contains the proper settings UI.


🏁 Script executed:

#!/bin/bash
# Verify that the options.html file exists in the project
ls -la *.html | grep options.html

Length of output: 91


I'm not seeing evidence that the options page exists at the expected location. Let's re-run a more comprehensive search to verify if there's any file named options.html in the repository:

Please run this script and share the results so we can confirm the presence and correct location of the options page.


🏁 Script executed:

#!/bin/bash
# Recursively search the repository for options.html
find . -type f -name "options.html"

Length of output: 157


Missing options.html File Detected – Action Needed

The URL path has been updated to '/options.html' to follow the WXT migration conventions. However, our search did not find any file named "options.html" in the repository. Please confirm whether:

  • The "options.html" file exists but is located elsewhere (if so, update the URL accordingly), or
  • The file was inadvertently omitted and needs to be added to support the settings UI.

Ensure this is resolved so the settings page can be properly accessed in the extension.

tsconfig.json (1)

1-3: ⚠️ Potential issue

Critical Configuration Issue: "extends" Property Points to a Removed File
The "extends": ".wxt/tsconfig.json" line now references a file that has been deleted in this migration. This can lead to TypeScript compilation errors. Please update the inheritance reference to point to a valid configuration file or remove it if no longer needed. For example, if the intention is to have this as the primary configuration file, consider removing the extends property:

-  "extends": ".wxt/tsconfig.json",
📝 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.

{
  "compilerOptions": {
src/entrypoints/quick-menu.content/index.ts (1)

28-37: 🛠️ Refactor suggestion

Add null/error checking for prompt retrieval

The code assumes findPrompt(id) will always return an object with a valid prompt property. This could lead to runtime errors if the prompt isn't found.

       chrome.runtime.onMessage.addListener(async (request) => {
         const { payload } = request
         const { selectedText, id } = payload || {}
         if (selectedText && id) {
-          const prompt = (await findPrompt(id)).prompt
-          if (prompt) {
-            generatePromptInSidebar(prompt, selectedText)
-          }
+          try {
+            const promptResult = await findPrompt(id);
+            if (promptResult && promptResult.prompt) {
+              generatePromptInSidebar(promptResult.prompt, selectedText)
+            }
+          } catch (error) {
+            console.error('Error finding prompt:', error);
+          }
         }
       })
📝 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.

    })
    chrome.runtime.onMessage.addListener(async (request) => {
      const { payload } = request
      const { selectedText, id } = payload || {}
      if (selectedText && id) {
          try {
            const promptResult = await findPrompt(id);
            if (promptResult && promptResult.prompt) {
              generatePromptInSidebar(promptResult.prompt, selectedText)
            }
          } catch (error) {
            console.error('Error finding prompt:', error);
          }
      }
    })
src/entrypoints/content/index.ts (3)

1-3: ⚠️ Potential issue

Missing WXT framework import for defineContentScript

The defineContentScript function is used on line 69 but not imported. You need to add an import statement for this function from the WXT framework.

import { getScreenshotImage } from '../../lib/getScreenshotImage'
import { contentScriptLog } from '../../logs'
+import { defineContentScript } from 'wxt/sandbox'
📝 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.

import { getScreenshotImage } from '../../lib/getScreenshotImage'
import { contentScriptLog } from '../../logs'
import { defineContentScript } from 'wxt/sandbox'

15-15: 💡 Verification agent

🧩 Analysis chain

Path reference may need updating for WXT

The URL path '/src/pages/sidebar/index.html' appears to be using the old file structure. In WXT, the paths might work differently. Verify if this should be updated to match the new entrypoints structure.


🏁 Script executed:

#!/bin/bash
# Check if the sidebar HTML file exists at the specified path
if [ -f "src/pages/sidebar/index.html" ]; then
  echo "File exists at the current path"
else
  echo "File NOT found at the current path"
  
  # Check if it exists in the new structure
  if [ -f "src/entrypoints/sidebar/index.html" ]; then
    echo "File exists in the entrypoints directory structure"
  fi
fi

Length of output: 279


Action Required: Update Sidebar HTML File Reference for WXT

The shell script output confirms that the old file path (src/pages/sidebar/index.html) no longer exists, and the correct file is located at src/entrypoints/sidebar/index.html. Please update the URL reference in src/entrypoints/content/index.ts (line 15) to match the new entrypoints structure.


30-45: 🛠️ Refactor suggestion

Security concern with postMessage origin

Using '*' as the target origin in postMessage allows any website to receive the messages, which is a potential security risk. Consider specifying the extension's origin explicitly.

      iframe.contentWindow?.postMessage(
        {
          action: 'get-page-content',
          payload: pageContent,
        },
-        '*',
+        chrome.runtime.getURL(''),
      )

Also apply the same change to the other postMessage call on line 63.

📝 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.

// Instance from lines 30-45 (example context)
iframe.contentWindow?.postMessage(
  {
    action: 'get-page-content',
    payload: pageContent,
  },
  chrome.runtime.getURL(''),
)

// ... other code ...

// Update for the other postMessage call on line 63
iframe.contentWindow?.postMessage(
  {
    // Presumably similar keys; adjust as needed according to actual usage.
    action: 'another-action',
    payload: anotherPayload,
  },
  chrome.runtime.getURL(''),
)
.wxt/types/imports.d.ts (1)

39-51: 💡 Verification agent

🧩 Analysis chain

Consider the necessity of @ts-ignore comments.

The multiple @ts-ignore comments suggest potential type-checking issues with the global type exports. These might be necessary for WXT's approach to global type availability, but they bypass TypeScript's type checking.

Are these @ts-ignore comments standard practice in WXT projects? It might be worth checking if there's a way to structure the types that doesn't require suppressing TypeScript errors.


🌐 Web query:

Does WXT require @ts-ignore for global type definitions?

💡 Result:

WXT does not require @ts-ignore for global type definitions when configured properly. The framework provides multiple supported methods for handling type declarations:

1. Declaration Files

WXT allows you to generate type declaration files through modules[[1][4]]:

// Module generating a declaration file
wxt.hook('prepare:types', async (_, entries) => {
  entries.push({
    path: 'my-module/types.d.ts',
    text: `declare global { /* type extensions */ }`,
    tsReference: true // Required for inclusion in TS project
  });
});

This ensures global types are automatically included in the TypeScript project without manual @ts-ignore annotations.

2. TypeScript Configuration

WXT generates a base .wxt/tsconfig.json and recommends:

  • Extending this config in your root tsconfig.json[[2]]
  • Using include/exclude patterns to manage global types[[5][13]]
  • Avoiding direct modification of TSConfig paths (use WXT's alias config instead)[[2]]

3. Monorepo Example

In shared code setups, aliases and includes ensure type visibility[[5]]:

// tsconfig.json
{
  "include": ["../../packages/ui-base/src/**/*.ts"],
  "paths": {
    "@packages/ui-base/*": ["../../packages/ui-base/src/*"]
  }
}
// wxt.config.ts
alias: {
  "@packages/ui-base": resolve("../../packages/ui-base/src")
}

When You Might Need @ts-ignore:

  • Temporarily ignoring type errors in generated/manually modified code
  • Working with third-party libraries lacking proper typings
  • Transitional code during migrations[[10]]

For most cases, WXT's type system and module architecture eliminate the need for @ts-ignore when global types are properly declared in .d.ts files and included via standard configuration methods.

Citations:


Action Required: Remove Unnecessary @ts-ignore Comments

Based on the WXT documentation, global type definitions do not require the use of @ts-ignore when configured correctly. In this case, rather than bypassing TypeScript’s type checking, you can structure your global types using one of the supported approaches:

  • Declaration Files: Generate and include a proper declaration file via wxt.hook('prepare:types', …), so that the types are automatically recognized.
  • TypeScript Configurations: Utilize the generated .wxt/tsconfig.json (or extend it in your root tsconfig.json) with appropriate include/exclude patterns, eliminating the need for manual suppression.

Next Steps:

  • Remove or refactor the @ts-ignore comments in .wxt/types/imports.d.ts (lines 39–51).
  • Update your type declaration setup using one of the supported methods as described in the WXT documentation, ensuring full type checking is maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

Rewrite to use WXT
3 participants