-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Utility Kit | ||
|
||
::alert{type=warning} | ||
APIs are subject to change. | ||
:: | ||
|
||
Since v0.3.0, we are now providing a utility kit for easier DevTools integrations, similar to `@nuxt/kit`. | ||
|
||
It can be access via `@nuxt/devtools/kit`: | ||
|
||
```ts | ||
import { addCustomTab } from '@nuxt/devtools/kit' | ||
``` | ||
|
||
Generally, we recommend to module authors to install `@nuxt/devtools` as a dev dependency and bundled `@nuxt/devtools/kit` into your module. | ||
|
||
## `addCustomTab()` | ||
|
||
A shorthand for calling the hook `devtools:customTabs`. | ||
|
||
```ts | ||
import { addCustomTab } from '@nuxt/devtools/kit' | ||
|
||
addCustomTab(() => ({ | ||
// unique identifier | ||
name: 'my-module', | ||
// title to display in the tab | ||
title: 'My Module', | ||
// any icon from Iconify, or a URL to an image | ||
icon: 'carbon:apps', | ||
// iframe view | ||
view: { | ||
type: 'iframe', | ||
src: '/url-to-your-module-view', | ||
}, | ||
})) | ||
``` | ||
|
||
## `refreshCustomTabs()` | ||
|
||
A shorthand for call hook `devtools:customTabs:refresh`. It will refresh all custom tabs. | ||
|
||
## `startSubprocess()` | ||
|
||
Start a sub process using `execa` and create a terminal tab in DevTools. | ||
|
||
```ts | ||
import { startSubprocess } from '@nuxt/devtools/kit' | ||
|
||
const subprocess = startSubprocess( | ||
{ | ||
command: 'code-server', | ||
args: [ | ||
'serve-local', | ||
'--accept-server-license-terms', | ||
'--without-connection-token', | ||
`--port=${port}`, | ||
], | ||
}, | ||
{ | ||
id: 'devtools:vscode', | ||
name: 'VS Code Server', | ||
icon: 'logos-visual-studio-code', | ||
}, | ||
) | ||
``` | ||
|
||
```ts | ||
subprocess.restart() | ||
subprocess.terminate() | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
export default defineNuxtConfig({ | ||
extends: '@nuxt-themes/docus', | ||
modules: ['@nuxtjs/plausible'], | ||
modules: [ | ||
'@nuxtjs/plausible', | ||
'../local', | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters