Skip to content

feat(nuxt): add integration with chrome devtools workspaces #32084

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

Merged
merged 2 commits into from
Jun 2, 2025

Conversation

danielroe
Copy link
Member

🔗 Linked issue

resolves #31978

📚 Description

This adds support for the new Chrome DevTools Project Settings API, which at the moment only supports Automatic Workspace configuration.

I suggest we migrate this to an internal module when more features are supported.

cc: @bmeurer

@danielroe danielroe self-assigned this May 12, 2025
@Copilot Copilot AI review requested due to automatic review settings May 12, 2025 14:28
Copy link

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

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Chrome DevTools integration via the new Project Settings API for Nuxt projects, enabling automatic workspace configuration. Key changes include the addition of a new schema property and experimental flag ("chromeDevtoolsProjectSettings") and updates in the Nitro server to serve the corresponding configuration file.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/schema/src/types/schema.ts Added a new boolean config property with documentation.
packages/schema/src/config/experimental.ts Introduced the experimental flag with a default value.
packages/nuxt/src/core/nitro.ts Integrated file handling to support Chrome DevTools workspaces.

Copy link

coderabbitai bot commented May 12, 2025

Walkthrough

An experimental feature was added to enable integration with Chrome DevTools Workspaces in Nuxt projects. This includes a new boolean configuration option, chromeDevtoolsProjectSettings, in the experimental section of the Nuxt configuration schema, defaulting to true. When enabled, the Nitro server reads or creates a chrome-workspace.json file in the Nuxt cache directory. A Nitro development handler is registered at a specific route to serve this configuration as JSON, incorporating the Nuxt root directory path. The change adds necessary imports for file system operations and UUID generation, with no modifications to public APIs besides the new configuration property.

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 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 ea4a725 and 9790f73.

📒 Files selected for processing (1)
  • packages/nuxt/src/core/nitro.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/nuxt/src/core/nitro.ts
✨ 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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: 0

🧹 Nitpick comments (1)
packages/nuxt/src/core/nitro.ts (1)

568-589: Implementation of Chrome DevTools Project Settings integration

This implementation correctly handles the new experimental feature:

  1. Checks for existing configuration in the Nuxt cache directory
  2. Creates a new configuration with a random UUID if one doesn't exist
  3. Registers a development handler to serve the workspace configuration at the standard Chrome DevTools endpoint

The TODO comment indicates this might be refactored into a dedicated module as the feature expands, which is a good approach.

Consider adding error handling for the file write operation:

-      await writeFile(resolve(nuxt.options.rootDir, 'node_modules/.cache/nuxt/chrome-workspace.json'), JSON.stringify(projectConfiguration), 'utf-8')
+      try {
+        await writeFile(resolve(nuxt.options.rootDir, 'node_modules/.cache/nuxt/chrome-workspace.json'), JSON.stringify(projectConfiguration), 'utf-8')
+      } catch (error) {
+        console.warn('Failed to write Chrome DevTools workspace configuration:', error)
+      }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 285d46c and ea4a725.

📒 Files selected for processing (3)
  • packages/nuxt/src/core/nitro.ts (3 hunks)
  • packages/schema/src/config/experimental.ts (1 hunks)
  • packages/schema/src/types/schema.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: codeql (javascript-typescript)
🔇 Additional comments (4)
packages/schema/src/types/schema.ts (1)

1487-1494: New experimental feature added for Chrome DevTools Workspaces integration

The new configuration option enables Chrome DevTools Workspaces integration, allowing for better development experience with direct editing capabilities. The feature is enabled by default via the experimental.chromeDevtoolsProjectSettings setting.

packages/schema/src/config/experimental.ts (1)

496-501: Configuration option added with appropriate documentation

The Chrome DevTools Workspaces integration is properly defined with a default value of true and includes a reference to the Google documentation. This matches the type definition in the schema file.

packages/nuxt/src/core/nitro.ts (2)

4-5: Added necessary filesystem and crypto imports

These new imports are required for reading/writing the workspace configuration file and generating UUIDs for new workspace configurations.


14-14: Added H3 event handler import

The defineEventHandler function is now correctly imported, which is needed for registering the Chrome DevTools API endpoint.

Copy link

pkg-pr-new bot commented May 12, 2025

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@32084

nuxt

npm i https://pkg.pr.new/nuxt@32084

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@32084

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@32084

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@32084

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@32084

commit: 9790f73

Copy link

codspeed-hq bot commented May 12, 2025

CodSpeed Performance Report

Merging #32084 will not alter performance

Comparing feat/devtools-projects (9790f73) with main (285d46c)

Summary

✅ 10 untouched benchmarks

@pi0
Copy link
Member

pi0 commented May 12, 2025

Added upstream tracker also for nitro to possibly support in dev server (via shared config) nitrojs/nitro#3360

@danielroe danielroe added this to the 3.18 milestone May 13, 2025
@Stretsh
Copy link

Stretsh commented May 15, 2025

Not sure if you're aware that there's a "Vite Plugin for DevTools Project Settings (devtools.json)" at https://github.com/ChromeDevTools/vite-plugin-devtools-json. If you are, just ignore this message 😃

@danielroe
Copy link
Member Author

I am aware, but this integration works with webpack, rspack, and any other bundlers people might use Nuxt with.

@danielroe danielroe merged commit 4215159 into main Jun 2, 2025
82 of 83 checks passed
@danielroe danielroe deleted the feat/devtools-projects branch June 2, 2025 08:24
@github-actions github-actions bot mentioned this pull request Jun 2, 2025
@dsvgl
Copy link

dsvgl commented Jun 2, 2025

Will this fix come to nuxt 3, too?

@danielroe
Copy link
Member Author

yep!

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.

[Vue Router warn]: No match found for location with path "/.well-known/appspecific/com.chrome.devtools.json"
4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy