From 0cc70fc25adeca8c7c1c3107bc80d03b80283a83 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 19 Jun 2025 15:32:16 -0700 Subject: [PATCH 1/8] docs: improvements to the `devtools-json` docs --- documentation/docs/30-add-ons/60-devtools-json.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/documentation/docs/30-add-ons/60-devtools-json.md b/documentation/docs/30-add-ons/60-devtools-json.md index 6fabf641..28b66789 100644 --- a/documentation/docs/30-add-ons/60-devtools-json.md +++ b/documentation/docs/30-add-ons/60-devtools-json.md @@ -2,13 +2,7 @@ title: devtools-json --- -`devtools-json` is essentially a vite plugin [vite-plugin-devtools-json](https://github.com/ChromeDevTools/vite-plugin-devtools-json/) for generating the Chrome DevTools project settings file on-the-fly in the devserver. - -It will prevent this server log: - -```sh -Not found: /.well-known/appspecific/com.chrome.devtools.json -``` +[`vite-plugin-devtools-json`](https://github.com/ChromeDevTools/vite-plugin-devtools-json/) is a Vite plugin for generating a Chromium DevTools project settings file on-the-fly in the development server. This file is served from `/.well-known/appspecific/com.chrome.devtools.json` and tells Chromium browsers where your project's source code lives so that you can use [the workspaces feature](https://developer.chrome.com/docs/devtools/workspaces) to edit source files in the browser. ## Usage @@ -18,4 +12,4 @@ npx sv add devtools-json ## What you get -- the `vite` plugin added to your vite plugin options. +- `vite-plugin-devtools-json` added to your Vite plugin options From fbd95a694dbe4933adc20679c42cb05f83cfc492 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 19 Jun 2025 15:34:04 -0700 Subject: [PATCH 2/8] Update 60-devtools-json.md --- documentation/docs/30-add-ons/60-devtools-json.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/30-add-ons/60-devtools-json.md b/documentation/docs/30-add-ons/60-devtools-json.md index 28b66789..53ed4db7 100644 --- a/documentation/docs/30-add-ons/60-devtools-json.md +++ b/documentation/docs/30-add-ons/60-devtools-json.md @@ -2,7 +2,7 @@ title: devtools-json --- -[`vite-plugin-devtools-json`](https://github.com/ChromeDevTools/vite-plugin-devtools-json/) is a Vite plugin for generating a Chromium DevTools project settings file on-the-fly in the development server. This file is served from `/.well-known/appspecific/com.chrome.devtools.json` and tells Chromium browsers where your project's source code lives so that you can use [the workspaces feature](https://developer.chrome.com/docs/devtools/workspaces) to edit source files in the browser. +The `devtools-json` add-on installs [`vite-plugin-devtools-json`](https://github.com/ChromeDevTools/vite-plugin-devtools-json/), which is a Vite plugin for generating a Chromium DevTools project settings file on-the-fly in the development server. This file is served from `/.well-known/appspecific/com.chrome.devtools.json` and tells Chromium browsers where your project's source code lives so that you can use [the workspaces feature](https://developer.chrome.com/docs/devtools/workspaces) to edit source files in the browser. ## Usage From 6c11b2ef19360db18534da6f2b599adb24e514e0 Mon Sep 17 00:00:00 2001 From: Manuel Serret Date: Fri, 20 Jun 2025 15:27:07 +0200 Subject: [PATCH 3/8] add note --- documentation/docs/30-add-ons/60-devtools-json.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/documentation/docs/30-add-ons/60-devtools-json.md b/documentation/docs/30-add-ons/60-devtools-json.md index 53ed4db7..fad526f1 100644 --- a/documentation/docs/30-add-ons/60-devtools-json.md +++ b/documentation/docs/30-add-ons/60-devtools-json.md @@ -4,6 +4,9 @@ title: devtools-json The `devtools-json` add-on installs [`vite-plugin-devtools-json`](https://github.com/ChromeDevTools/vite-plugin-devtools-json/), which is a Vite plugin for generating a Chromium DevTools project settings file on-the-fly in the development server. This file is served from `/.well-known/appspecific/com.chrome.devtools.json` and tells Chromium browsers where your project's source code lives so that you can use [the workspaces feature](https://developer.chrome.com/docs/devtools/workspaces) to edit source files in the browser. +> [!NOTE] +> Installing the plugin enables the feature for all users connecting to the dev server with a Chromium browser, and allows the browser to read and write all files within the directory. If using Chrome's AI Assistance feature, this may also result in data being sent to Google. + ## Usage ```bash From e205f626e341c124824c8ed5f3be38f995f1f44f Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 20 Jun 2025 12:16:10 -0700 Subject: [PATCH 4/8] Update documentation/docs/30-add-ons/60-devtools-json.md Co-authored-by: Rich Harris --- documentation/docs/30-add-ons/60-devtools-json.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/documentation/docs/30-add-ons/60-devtools-json.md b/documentation/docs/30-add-ons/60-devtools-json.md index fad526f1..901623a6 100644 --- a/documentation/docs/30-add-ons/60-devtools-json.md +++ b/documentation/docs/30-add-ons/60-devtools-json.md @@ -7,6 +7,20 @@ The `devtools-json` add-on installs [`vite-plugin-devtools-json`](https://github > [!NOTE] > Installing the plugin enables the feature for all users connecting to the dev server with a Chromium browser, and allows the browser to read and write all files within the directory. If using Chrome's AI Assistance feature, this may also result in data being sent to Google. +Alternatively, you can prevent the warning by handling the request yourself, for example by adding logic to your [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook: + +```js +/// file: src/hooks.server.js +import { dev } from '$app/environment'; + +export function handle({ event, resolve }) { + if (dev && event.url.pathname === '/.well-known/appspecific/com.chrome.devtools.json') { + return new Response(undefined, { status: 404 }); + } + + return resolve(event); +} + ## Usage ```bash From 6061d2f2dfe3695fafe274a8f8155ac21d892267 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 20 Jun 2025 12:20:12 -0700 Subject: [PATCH 5/8] Update documentation/docs/30-add-ons/60-devtools-json.md --- documentation/docs/30-add-ons/60-devtools-json.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/30-add-ons/60-devtools-json.md b/documentation/docs/30-add-ons/60-devtools-json.md index 901623a6..c7873146 100644 --- a/documentation/docs/30-add-ons/60-devtools-json.md +++ b/documentation/docs/30-add-ons/60-devtools-json.md @@ -7,7 +7,7 @@ The `devtools-json` add-on installs [`vite-plugin-devtools-json`](https://github > [!NOTE] > Installing the plugin enables the feature for all users connecting to the dev server with a Chromium browser, and allows the browser to read and write all files within the directory. If using Chrome's AI Assistance feature, this may also result in data being sent to Google. -Alternatively, you can prevent the warning by handling the request yourself, for example by adding logic to your [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook: +You can also prevent the warning by handling the request yourself. For example, you can create a file named `.well-known/appspecific/com.chrome.devtools.json` with the contents `"Go away, Chrome DevTools!"` or you can add logic to your [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook: ```js /// file: src/hooks.server.js From 7cc98b1bf155a4344cbdedf26bbac5df99835f2c Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 20 Jun 2025 12:22:21 -0700 Subject: [PATCH 6/8] Update documentation/docs/30-add-ons/60-devtools-json.md --- documentation/docs/30-add-ons/60-devtools-json.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/30-add-ons/60-devtools-json.md b/documentation/docs/30-add-ons/60-devtools-json.md index c7873146..5103f2f3 100644 --- a/documentation/docs/30-add-ons/60-devtools-json.md +++ b/documentation/docs/30-add-ons/60-devtools-json.md @@ -7,7 +7,7 @@ The `devtools-json` add-on installs [`vite-plugin-devtools-json`](https://github > [!NOTE] > Installing the plugin enables the feature for all users connecting to the dev server with a Chromium browser, and allows the browser to read and write all files within the directory. If using Chrome's AI Assistance feature, this may also result in data being sent to Google. -You can also prevent the warning by handling the request yourself. For example, you can create a file named `.well-known/appspecific/com.chrome.devtools.json` with the contents `"Go away, Chrome DevTools!"` or you can add logic to your [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook: +You can also prevent the warning for all developers of your application by handling the request yourself. For example, you can create a file named `.well-known/appspecific/com.chrome.devtools.json` with the contents `"Go away, Chrome DevTools!"` or you can add logic to respond to the request in your [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook: ```js /// file: src/hooks.server.js From 7cfaf901808854e08aaea3f737968c0d69a26a33 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 20 Jun 2025 12:25:12 -0700 Subject: [PATCH 7/8] Update documentation/docs/30-add-ons/60-devtools-json.md --- documentation/docs/30-add-ons/60-devtools-json.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/documentation/docs/30-add-ons/60-devtools-json.md b/documentation/docs/30-add-ons/60-devtools-json.md index 5103f2f3..87aa2c3a 100644 --- a/documentation/docs/30-add-ons/60-devtools-json.md +++ b/documentation/docs/30-add-ons/60-devtools-json.md @@ -7,7 +7,9 @@ The `devtools-json` add-on installs [`vite-plugin-devtools-json`](https://github > [!NOTE] > Installing the plugin enables the feature for all users connecting to the dev server with a Chromium browser, and allows the browser to read and write all files within the directory. If using Chrome's AI Assistance feature, this may also result in data being sent to Google. -You can also prevent the warning for all developers of your application by handling the request yourself. For example, you can create a file named `.well-known/appspecific/com.chrome.devtools.json` with the contents `"Go away, Chrome DevTools!"` or you can add logic to respond to the request in your [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook: +You can prevent the request from being issued on your machine by disabling the feature in your browser. You can do this in Chrome by visiting `chrome://flags` and disabling the "DevTools Project Settings". You may also be interested in disabling "DevTools Automatic Workspace Folders" since it’s closely related. + +You can also prevent the web server from issuing a notice regarding the incoming request for all developers of your application by handling the request yourself. For example, you can create a file named `.well-known/appspecific/com.chrome.devtools.json` with the contents `"Go away, Chrome DevTools!"` or you can add logic to respond to the request in your [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook: ```js /// file: src/hooks.server.js From 727fb33feeec4c980b623503fdc171e4a79eba9c Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 21 Jun 2025 00:15:00 -0400 Subject: [PATCH 8/8] chore: don't select `devtools-json` by default (#605) * dont select devtools-json by default * Create brown-peas-shop.md --------- Co-authored-by: Manuel <30698007+manuel3108@users.noreply.github.com> --- .changeset/brown-peas-shop.md | 5 +++++ packages/addons/devtools-json/index.ts | 7 ------- packages/cli/commands/add/index.ts | 13 +++---------- packages/cli/commands/create.ts | 3 +-- packages/cli/lib/install.ts | 8 ++------ packages/core/addon/config.ts | 8 +------- 6 files changed, 12 insertions(+), 32 deletions(-) create mode 100644 .changeset/brown-peas-shop.md diff --git a/.changeset/brown-peas-shop.md b/.changeset/brown-peas-shop.md new file mode 100644 index 00000000..268da463 --- /dev/null +++ b/.changeset/brown-peas-shop.md @@ -0,0 +1,5 @@ +--- +"sv": patch +--- + +chore: don't select `devtools-json` by default diff --git a/packages/addons/devtools-json/index.ts b/packages/addons/devtools-json/index.ts index fe8ba6fe..27f3c6e0 100644 --- a/packages/addons/devtools-json/index.ts +++ b/packages/addons/devtools-json/index.ts @@ -8,13 +8,6 @@ export default defineAddon({ homepage: 'https://github.com/ChromeDevTools/vite-plugin-devtools-json', options: {}, - setup: ({ defaultSelection }) => { - defaultSelection({ - create: true, - add: false - }); - }, - run: ({ sv, typescript }) => { const ext = typescript ? 'ts' : 'js'; diff --git a/packages/cli/commands/add/index.ts b/packages/cli/commands/add/index.ts index f8b46045..fedc6652 100644 --- a/packages/cli/commands/add/index.ts +++ b/packages/cli/commands/add/index.ts @@ -201,7 +201,7 @@ export const add = new Command('add') common.runCommand(async () => { const selectedAddonIds = selectedAddons.map(({ id }) => id); - const { nextSteps } = await runAddCommand(options, selectedAddonIds, 'add'); + const { nextSteps } = await runAddCommand(options, selectedAddonIds); if (nextSteps) p.note(nextSteps, 'Next steps', { format: (line: string) => line }); }); }); @@ -209,8 +209,7 @@ export const add = new Command('add') type SelectedAddon = { type: 'official' | 'community'; addon: AddonWithoutExplicitArgs }; export async function runAddCommand( options: Options, - selectedAddonIds: string[], - from: 'create' | 'add' + selectedAddonIds: string[] ): Promise<{ nextSteps?: string; packageManager?: AgentName | null }> { const selectedAddons: SelectedAddon[] = selectedAddonIds.map((id) => ({ type: 'official', @@ -391,11 +390,6 @@ export async function runAddCommand( const setups = selectedAddons.length ? selectedAddons.map(({ addon }) => addon) : officialAddons; const addonSetupResults = setupAddons(setups, workspace); - // get all addons that have been marked to be preselected - const initialValues = Object.entries(addonSetupResults) - .filter(([_, value]) => value.defaultSelection[from] === true) - .map(([key]) => key); - // prompt which addons to apply if (selectedAddons.length === 0) { const addonOptions = officialAddons @@ -410,8 +404,7 @@ export async function runAddCommand( const selected = await p.multiselect({ message: `What would you like to add to your project? ${pc.dim('(use arrow keys / space bar)')}`, options: addonOptions, - required: false, - initialValues + required: false }); if (p.isCancel(selected)) { p.cancel('Operation cancelled.'); diff --git a/packages/cli/commands/create.ts b/packages/cli/commands/create.ts index b7ffcaa6..5d259c31 100644 --- a/packages/cli/commands/create.ts +++ b/packages/cli/commands/create.ts @@ -184,8 +184,7 @@ async function createProject(cwd: ProjectPath, options: Options) { community: [], addons: {} }, - [], - 'create' + [] ); packageManager = pm; addOnNextSteps = nextSteps; diff --git a/packages/cli/lib/install.ts b/packages/cli/lib/install.ts index 1ae3d874..86bef827 100644 --- a/packages/cli/lib/install.ts +++ b/packages/cli/lib/install.ts @@ -90,8 +90,7 @@ export function setupAddons( const setupResult: AddonSetupResult = { unsupported: [], dependsOn: [], - runsAfter: [], - defaultSelection: { create: false, add: false } + runsAfter: [] }; addon.setup?.({ ...workspace, @@ -100,10 +99,7 @@ export function setupAddons( setupResult.runsAfter.push(name); }, unsupported: (reason) => setupResult.unsupported.push(reason), - runsAfter: (name) => setupResult.runsAfter.push(name), - defaultSelection: (defaultSelection) => { - setupResult.defaultSelection = defaultSelection; - } + runsAfter: (name) => setupResult.runsAfter.push(name) }); addonSetupResults[addon.id] = setupResult; } diff --git a/packages/core/addon/config.ts b/packages/core/addon/config.ts index dd9daf08..fbce3775 100644 --- a/packages/core/addon/config.ts +++ b/packages/core/addon/config.ts @@ -38,7 +38,6 @@ export type Addon = { dependsOn: (name: string) => void; unsupported: (reason: string) => void; runsAfter: (addonName: string) => void; - defaultSelection: (args: { create: boolean; add: boolean }) => void; } ) => MaybePromise; run: (workspace: Workspace & { sv: SvApi }) => MaybePromise; @@ -61,12 +60,7 @@ export function defineAddon(config: Addon): return config; } -export type AddonSetupResult = { - dependsOn: string[]; - unsupported: string[]; - runsAfter: string[]; - defaultSelection: { create: boolean; add: boolean }; -}; +export type AddonSetupResult = { dependsOn: string[]; unsupported: string[]; runsAfter: string[] }; export type AddonWithoutExplicitArgs = Addon>; export type AddonConfigWithoutExplicitArgs = Addon>;