@nuxt/devtools 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +242 -0
- package/cli.mjs +1 -2
- package/dist/chunks/index.mjs +47749 -0
- package/dist/chunks/module-main.mjs +8424 -0
- package/dist/chunks/vite-inspect.mjs +49 -0
- package/dist/chunks/vscode.mjs +40137 -0
- package/dist/chunks/vue-inspector.mjs +14 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.mjs +66 -0
- package/dist/client/200.html +7 -0
- package/dist/client/404.html +7 -0
- package/dist/client/__inspecting/index.html +7 -0
- package/dist/client/_nuxt/Badge.23dc2d8f.js +1 -0
- package/dist/client/_nuxt/ComponentItem.f7b53cb0.js +1 -0
- package/dist/client/_nuxt/ComponentItem.vue.d48d83d8.js +1 -0
- package/dist/client/_nuxt/ComponentsGraph.94420499.js +1 -0
- package/dist/client/_nuxt/ComponentsGraph.vue.687b60ce.js +1 -0
- package/dist/client/_nuxt/ComponentsList.27e171d0.js +1 -0
- package/dist/client/_nuxt/ComponentsList.vue.24e7149d.js +1 -0
- package/dist/client/_nuxt/ComposableItem.a0f590b3.js +1 -0
- package/dist/client/_nuxt/ComposableItem.vue.645a2668.js +1 -0
- package/dist/client/_nuxt/ComposableTree.08cf808f.js +1 -0
- package/dist/client/_nuxt/ComposableTree.vue.a160c715.js +1 -0
- package/dist/client/_nuxt/CurrentRoute.4a32c426.js +1 -0
- package/dist/client/_nuxt/Drawer.6d261f16.js +1 -0
- package/dist/client/_nuxt/Drawer.vue.4d7d190a.js +1 -0
- package/dist/client/_nuxt/DrawerItem.0c4e93e1.js +1 -0
- package/dist/client/_nuxt/DrawerItem.vue.30f032f8.js +1 -0
- package/dist/client/_nuxt/FileIcon.4f6c385a.js +1 -0
- package/dist/client/_nuxt/FileIcon.vue.e650fe14.js +1 -0
- package/dist/client/_nuxt/FilepathItem.6f861b0b.js +1 -0
- package/dist/client/_nuxt/FilepathItem.vue.fcbe3a7a.js +1 -0
- package/dist/client/_nuxt/HooksTable.e9c5c41d.js +1 -0
- package/dist/client/_nuxt/HooksTable.vue.93af23f8.js +1 -0
- package/dist/client/_nuxt/IconTitle.576c2413.js +1 -0
- package/dist/client/_nuxt/IconTitle.vue.909d2a6b.js +1 -0
- package/dist/client/_nuxt/IframeView.d58e614f.js +1 -0
- package/dist/client/_nuxt/IframeView.vue.46f9c325.js +1 -0
- package/dist/client/_nuxt/LaunchPage.7f56830a.js +1 -0
- package/dist/client/_nuxt/LaunchPage.vue.29133098.js +1 -0
- package/dist/client/_nuxt/ModuleItem.9523008d.js +1 -0
- package/dist/client/_nuxt/ModuleItem.vue.07190cb3.js +1 -0
- package/dist/client/_nuxt/ModuleTreeNode.040f6e05.js +1 -0
- package/dist/client/_nuxt/NButton.d5a0d397.js +1 -0
- package/dist/client/_nuxt/NButton.vue.3df758c5.js +1 -0
- package/dist/client/_nuxt/NCard.47038127.js +1 -0
- package/dist/client/_nuxt/NCheckbox.ec4f225e.js +1 -0
- package/dist/client/_nuxt/NCheckbox.vue.25b386b6.js +1 -0
- package/dist/client/_nuxt/NDarkToggle.46f06112.js +1 -0
- package/dist/client/_nuxt/NDarkToggle.vue.c227b1bd.js +1 -0
- package/dist/client/_nuxt/NDialog.09638209.js +7 -0
- package/dist/client/_nuxt/NDropdown.d94508d4.js +1 -0
- package/dist/client/_nuxt/NIcon.e9d8d4d5.js +1 -0
- package/dist/client/_nuxt/NIcon.vue.2481694f.js +1 -0
- package/dist/client/_nuxt/NLink.34fc60fd.js +1 -0
- package/dist/client/_nuxt/NLink.vue.17c2cd3a.js +1 -0
- package/dist/client/_nuxt/NRadio.a5c0205d.js +1 -0
- package/dist/client/_nuxt/NSwitch.4c2c96d6.js +1 -0
- package/dist/client/_nuxt/NSwitch.vue.36ec57ea.js +1 -0
- package/dist/client/_nuxt/NTextInput.3c1a9b08.js +1 -0
- package/dist/client/_nuxt/NTextInput.vue.2d3f9e19.js +1 -0
- package/dist/client/_nuxt/NTip.ff4fea4e.js +1 -0
- package/dist/client/_nuxt/Notification.f594eb13.js +1 -0
- package/dist/client/_nuxt/Notification.vue.b0304237.js +1 -0
- package/dist/client/_nuxt/NuxtContentLogo.1ca13565.js +1 -0
- package/dist/client/_nuxt/NuxtExampleLayout.904da69e.js +1 -0
- package/dist/client/_nuxt/NuxtLogo.acbeec62.js +1 -0
- package/dist/client/_nuxt/PluginItem.78f70695.js +1 -0
- package/dist/client/_nuxt/PluginItem.vue.a18a8580.js +1 -0
- package/dist/client/_nuxt/RoutePathItem.77ebd238.js +1 -0
- package/dist/client/_nuxt/RoutePathItem.vue.a16a2a5a.js +1 -0
- package/dist/client/_nuxt/RoutesTable.3a51b11e.js +1 -0
- package/dist/client/_nuxt/RoutesTable.vue.66423aa5.js +1 -0
- package/dist/client/_nuxt/SectionBlock.6bf10c9f.js +1 -0
- package/dist/client/_nuxt/SectionBlock.a75bb023.css +1 -0
- package/dist/client/_nuxt/Settings.ceefb680.js +1 -0
- package/dist/client/_nuxt/Settings.vue.6d6be237.js +1 -0
- package/dist/client/_nuxt/StateEditor.b25ca4bb.js +1 -0
- package/dist/client/_nuxt/StateEditor.f3649b84.css +1 -0
- package/dist/client/_nuxt/StateEditor.vue.4c95ce8f.js +135 -0
- package/dist/client/_nuxt/StateEditor.vue.94361847.js +1 -0
- package/dist/client/_nuxt/StateGroup.03356999.js +1 -0
- package/dist/client/_nuxt/StateGroup.vue.2dd6ea33.js +1 -0
- package/dist/client/_nuxt/TabIcon.0eec1314.js +1 -0
- package/dist/client/_nuxt/TabIcon.vue.8a3fdf6c.js +1 -0
- package/dist/client/_nuxt/UnoIcon.58399ac9.js +1 -0
- package/dist/client/_nuxt/__inspecting.06a43aaf.js +1 -0
- package/dist/client/_nuxt/_plugin-vue_export-helper.c27b6911.js +1 -0
- package/dist/client/_nuxt/app.config.a09258b3.js +1 -0
- package/dist/client/_nuxt/asyncData.0d07d609.js +1 -0
- package/dist/client/_nuxt/client-only.57dcb5bd.js +4 -0
- package/dist/client/_nuxt/client.ef9805ed.js +1 -0
- package/dist/client/_nuxt/color-mode-options.00c15dd1.js +1 -0
- package/dist/client/_nuxt/component.vue3.70214810.js +1 -0
- package/dist/client/_nuxt/components.238910b6.js +1 -0
- package/dist/client/_nuxt/components.bcdd3ff8.js +1 -0
- package/dist/client/_nuxt/components.client.73756aea.js +113 -0
- package/dist/client/_nuxt/composables.3d6ee8a2.js +1 -0
- package/dist/client/_nuxt/composables.7fd231ea.js +1 -0
- package/dist/client/_nuxt/context.dc73232e.js +1 -0
- package/dist/client/_nuxt/custom-_name_.3a92fd5f.js +1 -0
- package/dist/client/_nuxt/default.d86039a2.js +1 -0
- package/dist/client/_nuxt/dev-only.fb81821a.js +1 -0
- package/dist/client/_nuxt/editor.9a00fe97.js +1 -0
- package/dist/client/_nuxt/entry.1076cab0.js +1 -0
- package/dist/client/_nuxt/entry.53569115.css +1 -0
- package/dist/client/_nuxt/error-404.1469f10f.css +1 -0
- package/dist/client/_nuxt/error-404.f7be8ae4.js +1 -0
- package/dist/client/_nuxt/error-500.31030cf5.js +1 -0
- package/dist/client/_nuxt/error-500.92b94fae.css +1 -0
- package/dist/client/_nuxt/error-component.916ef420.js +3 -0
- package/dist/client/_nuxt/error.10b092f1.js +1 -0
- package/dist/client/_nuxt/fuse.esm.88e2763d.js +1 -0
- package/dist/client/_nuxt/hooks.03df1882.js +1 -0
- package/dist/client/_nuxt/icons.7b11eba5.js +1 -0
- package/dist/client/_nuxt/icons.d5925320.js +1 -0
- package/dist/client/_nuxt/icons.eca62571.js +1 -0
- package/dist/client/_nuxt/imports.0ab9b18e.js +1 -0
- package/dist/client/_nuxt/index.6cafd97e.js +1 -0
- package/dist/client/_nuxt/index.7c6751e3.js +1 -0
- package/dist/client/_nuxt/index.96e42b53.js +1 -0
- package/dist/client/_nuxt/index.a6656ecb.js +17 -0
- package/dist/client/_nuxt/index.adfbbcc3.js +1 -0
- package/dist/client/_nuxt/layout.50e89109.js +1 -0
- package/dist/client/_nuxt/layouts.22623cd4.js +1 -0
- package/dist/client/_nuxt/middleware.8875601d.js +1 -0
- package/dist/client/_nuxt/modules.4e9ddad7.js +1 -0
- package/dist/client/_nuxt/none.1c37aed4.js +1 -0
- package/dist/client/_nuxt/nuxt-error-boundary.fc4d7c25.js +1 -0
- package/dist/client/_nuxt/nuxt-link.724f8a66.js +1 -0
- package/dist/client/_nuxt/nuxt-loading-indicator.494ea32c.js +1 -0
- package/dist/client/_nuxt/overview.dca34e56.js +1 -0
- package/dist/client/_nuxt/page.8df04ed4.js +1 -0
- package/dist/client/_nuxt/pages.bdf1c147.js +1 -0
- package/dist/client/_nuxt/payload.8cf95895.js +1 -0
- package/dist/client/_nuxt/plugins.bb7d1e18.js +1 -0
- package/dist/client/_nuxt/rpc.65a41b65.js +1 -0
- package/dist/client/_nuxt/runtime-configs.e1c67255.js +1 -0
- package/dist/client/_nuxt/runtime-core.esm-bundler.5019e930.js +1 -0
- package/dist/client/_nuxt/runtime-dom.esm-bundler.b0076367.js +1 -0
- package/dist/client/_nuxt/server-placeholder.735ae8e9.js +1 -0
- package/dist/client/_nuxt/server-routes.ff745565.js +1 -0
- package/dist/client/_nuxt/state.5364a68a.js +1 -0
- package/dist/client/_nuxt/state.68f6a8e0.js +1 -0
- package/dist/client/_nuxt/storage.82519452.js +1 -0
- package/dist/client/_nuxt/unocss-runtime.cde2ffdd.js +2 -0
- package/dist/client/_nuxt/utils.3921fcc0.js +5 -0
- package/dist/client/_nuxt/utils.c2a3506b.js +1 -0
- package/dist/client/_nuxt/virtual-files.8b6129f7.js +9 -0
- package/dist/client/_nuxt/virtual-files.a8748389.css +1 -0
- package/dist/client/_nuxt/welcome.432c9232.js +1 -0
- package/dist/client/_nuxt/welcome.db724adb.css +1 -0
- package/dist/client/index.html +7 -0
- package/dist/client/modules/components/index.html +7 -0
- package/dist/client/modules/hooks/index.html +7 -0
- package/dist/client/modules/imports/index.html +7 -0
- package/dist/client/modules/layouts/index.html +7 -0
- package/dist/client/modules/middleware/index.html +7 -0
- package/dist/client/modules/modules/index.html +7 -0
- package/dist/client/modules/overview/index.html +7 -0
- package/dist/client/modules/pages/index.html +7 -0
- package/dist/client/modules/payload/index.html +7 -0
- package/dist/client/modules/plugins/index.html +7 -0
- package/dist/client/modules/runtime-configs/index.html +7 -0
- package/dist/client/modules/server-routes/index.html +7 -0
- package/dist/client/modules/virtual-files/index.html +7 -0
- package/dist/client/nuxt.svg +3 -0
- package/dist/dirs.d.ts +6 -0
- package/dist/dirs.mjs +9 -0
- package/dist/iframe-client.d.ts +13 -0
- package/dist/iframe-client.mjs +30 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.ts +33 -0
- package/dist/module.json +5 -0
- package/dist/module.mjs +6 -0
- package/dist/runtime/plugins/devtools.client.d.ts +2 -0
- package/dist/runtime/plugins/devtools.client.mjs +36 -0
- package/dist/runtime/plugins/view/Container.vue +95 -0
- package/dist/runtime/plugins/view/Frame.vue +270 -0
- package/dist/runtime/plugins/view/state.d.ts +10 -0
- package/dist/runtime/plugins/view/state.mjs +30 -0
- package/dist/runtime/plugins/view/utils.d.ts +4 -0
- package/dist/runtime/plugins/view/utils.mjs +39 -0
- package/dist/runtime/shared/hooks.d.ts +3 -0
- package/dist/runtime/shared/hooks.mjs +32 -0
- package/dist/shared/devtools.34d9e53a.mjs +68 -0
- package/dist/shared/devtools.7127abb3.mjs +4 -0
- package/dist/shared/devtools.8467d016.mjs +1504 -0
- package/dist/shared/devtools.861712a3.mjs +337 -0
- package/dist/types.d.ts +313 -0
- package/dist/types.mjs +1 -0
- package/iframe-client.d.ts +1 -0
- package/package.json +104 -2
- package/types.d.ts +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-PRESENT Nuxt Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
<img width="1200" alt="Nuxt DevTools" src="https://user-images.githubusercontent.com/11247099/215777354-7f04135e-a3c7-4ef2-880e-52d100b3fd33.png">
|
|
2
|
+
|
|
3
|
+
<br>
|
|
4
|
+
<br>
|
|
5
|
+
|
|
6
|
+
<h1 align="center">
|
|
7
|
+
Nuxt DevTools <sup>Preview</sup>
|
|
8
|
+
</h1>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
Unleash Nuxt Developer Experience.
|
|
12
|
+
<br>Nuxt DevTools is a set of visual tools that help you to know your app better.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://github.com/nuxt/devtools/discussions/29">💡 Ideas & Suggestions</a> |
|
|
17
|
+
<a href="https://github.com/nuxt/devtools/discussions/31">🗺️ Project Roadmap</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<br>
|
|
21
|
+
|
|
22
|
+
> **Warning**: Experimental and under heavy development. APIs are subject to change.
|
|
23
|
+
|
|
24
|
+
<br>
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
> Nuxt DevTools requires **Nuxt v3.1.0 or higher**.
|
|
29
|
+
|
|
30
|
+
You can opt-in Nuxt DevTools per-project by going to the project root and run:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx nuxi@latest devtools enable
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Restart your Nuxt server and open your app in browser. Click the Nuxt icon on the bottom (or press `Alt+D`) to toggle the DevTools.
|
|
37
|
+
|
|
38
|
+
When you run `nuxi devtools enable`, Nuxt DevTools will be installed as a global module and only activated for the projects you enabled. The configuration will be saved in your local `~/.nuxtrc` file, so it doesn't affect your team unless they also opt-in.
|
|
39
|
+
|
|
40
|
+
Similarly, you can disable it per-project by running:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx nuxi@latest devtools disable
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Install Manually
|
|
47
|
+
|
|
48
|
+
Nuxt DevTools is currently provided as a module (might be changed in the future). If you prefer, you can also install it locally, which will be activated for all your team members.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm i -D @nuxt/devtools
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// nuxt.config.ts
|
|
56
|
+
export default defineNuxtConfig({
|
|
57
|
+
modules: [
|
|
58
|
+
'@nuxt/devtools',
|
|
59
|
+
],
|
|
60
|
+
})
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Edge Release Channel
|
|
64
|
+
|
|
65
|
+
Similar to [Nuxt's Edge Channel](https://nuxt.com/docs/guide/going-further/edge-channel#opting-into-the-edge-channel), DevTools also offers an edge release channel, that automatically releases for every commit to `main` branch.
|
|
66
|
+
|
|
67
|
+
You can opt-in to the edge release channel by running:
|
|
68
|
+
|
|
69
|
+
```diff
|
|
70
|
+
{
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
-- "@nuxt/devtools": "^0.1.0"
|
|
73
|
+
++ "@nuxt/devtools": "npm:@nuxt/devtools-edge@latest"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Remove lockfile (`package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml`) and reinstall dependencies.
|
|
79
|
+
|
|
80
|
+
## Features
|
|
81
|
+
|
|
82
|
+
Nuxt DevTools is a set of visual tools available **right inside your app**.
|
|
83
|
+
|
|
84
|
+
Here are a few of features preview. You can learn more in our [roadmap](https://github.com/nuxt/devtools/discussions/31).
|
|
85
|
+
|
|
86
|
+
###### Overview
|
|
87
|
+
|
|
88
|
+
Shows a quick overview of your app, including the Nuxt version, the pages, the components, the modules, and the plugins you are using. In the future we will add more, and allow you to upgrade your Nuxt with a single click.
|
|
89
|
+
|
|
90
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670797-12c33a03-ca4f-490d-a18a-ab9008b89c15.png">
|
|
91
|
+
|
|
92
|
+
###### Pages
|
|
93
|
+
|
|
94
|
+
Pages tab shows your current routes, and provide a quick way to navigate to them. You can also use the textbox to see how each route is matched.
|
|
95
|
+
|
|
96
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670804-e48482af-de37-47be-88d8-d9515e796d5f.png">
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
###### Components
|
|
100
|
+
|
|
101
|
+
Components tab show all the components you are using in your app and where they are from. You can also search for them and go to the source code.
|
|
102
|
+
|
|
103
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670805-726eafd1-5364-4b11-9c2b-9253d068e7e3.png">
|
|
104
|
+
|
|
105
|
+
The graph view also show the relationship beetwen components, and know the dependencies of each component.
|
|
106
|
+
|
|
107
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670806-fb39aeff-3881-44e5-b9c8-6c757f5925fc.png">
|
|
108
|
+
|
|
109
|
+
You can also inspect your app's DOM tree and see which component is rendering it. Find the place to make changes are much easier.
|
|
110
|
+
|
|
111
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670809-7dcb4198-5a74-4818-95b1-b62ea6c04a6c.png">
|
|
112
|
+
|
|
113
|
+
###### Imports
|
|
114
|
+
|
|
115
|
+
Imports tab shows all the auto-imports registered to Nuxt. You can see which files are importing them, and where they are from. Some entries can also provide short descriptions and documentation links.
|
|
116
|
+
|
|
117
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670811-fa7c7249-5a21-48c9-abe8-ca02b2518a3a.png">
|
|
118
|
+
|
|
119
|
+
###### Modules
|
|
120
|
+
|
|
121
|
+
Modules tab shows all the modules you have installed and the links to their documentation. In the future, we will try to provide a visual UI to install new modules with one-click.
|
|
122
|
+
|
|
123
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670813-ce3da4b6-269c-430e-abb5-a2263ffe4938.png">
|
|
124
|
+
|
|
125
|
+
###### Hooks
|
|
126
|
+
|
|
127
|
+
Hooks tab can help you to monitor the time spent in each hook. It can be helpful to find performance bottlenecks.
|
|
128
|
+
|
|
129
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670815-80ec0ec3-7df1-4a07-96fb-4161fb6562a7.png">
|
|
130
|
+
|
|
131
|
+
###### Virtual Files
|
|
132
|
+
|
|
133
|
+
Virtual Files tab shows the virtual files generated by Nuxt to support the conventions.
|
|
134
|
+
|
|
135
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670817-abb0315a-6d92-4c5e-a4da-2327f22e0e8b.png">
|
|
136
|
+
|
|
137
|
+
###### Inspect
|
|
138
|
+
|
|
139
|
+
Inspect expose the [`vite-plugin-inspect`](https://github.com/antfu/vite-plugin-inspect) integration, allowing you to inspect transformation steps of Vite.
|
|
140
|
+
|
|
141
|
+
<img width="1284" src="https://user-images.githubusercontent.com/11247099/217670818-77f91135-7318-462e-9148-4ad504c82555.png">
|
|
142
|
+
|
|
143
|
+
## Module Authors
|
|
144
|
+
|
|
145
|
+
Nuxt DevTools is designed to be extensible. You can add your own modules' integration to the DevTools.
|
|
146
|
+
|
|
147
|
+
> **Warning**: APIs are subject to change.
|
|
148
|
+
|
|
149
|
+
### Contributing to View
|
|
150
|
+
|
|
151
|
+
Currently the only way to contribute to Nuxt DevTools View is via iframe. You need to serve your module's view yourself and then register it to the DevTools.
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
nuxt.hook('devtools:customTabs', (tabs) => {
|
|
155
|
+
tabs.push({
|
|
156
|
+
// unique identifier
|
|
157
|
+
name: 'my-module',
|
|
158
|
+
// title to display in the tab
|
|
159
|
+
title: 'My Module',
|
|
160
|
+
// any icon from Iconify, or a URL to an image
|
|
161
|
+
icon: 'carbon:apps',
|
|
162
|
+
// iframe view
|
|
163
|
+
view: {
|
|
164
|
+
type: 'iframe',
|
|
165
|
+
src: '/url-to-your-module-view',
|
|
166
|
+
},
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Lazy Service Launching
|
|
172
|
+
|
|
173
|
+
If the view you are contributing is heavy to load, you can have the tab first and let user launch it when they need it.
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
let isReady = false
|
|
177
|
+
const promise: Promise<any> | null = null
|
|
178
|
+
|
|
179
|
+
async function launchService() {
|
|
180
|
+
// ...launch your service
|
|
181
|
+
isReady = true
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
nuxt.hook('devtools:customTabs', (tabs) => {
|
|
185
|
+
tabs.push({
|
|
186
|
+
name: 'my-module',
|
|
187
|
+
title: 'My Module',
|
|
188
|
+
view: isReady
|
|
189
|
+
? {
|
|
190
|
+
type: 'iframe',
|
|
191
|
+
src: '/url-to-your-module-view',
|
|
192
|
+
}
|
|
193
|
+
: {
|
|
194
|
+
type: 'launch',
|
|
195
|
+
description: 'Launch My Module',
|
|
196
|
+
actions: [{
|
|
197
|
+
label: 'Start',
|
|
198
|
+
async handle() {
|
|
199
|
+
if (!promise)
|
|
200
|
+
promise = launchService()
|
|
201
|
+
await promise
|
|
202
|
+
},
|
|
203
|
+
}]
|
|
204
|
+
},
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
It will first display a launch page with a button to start the service. When user click the button, the `handle()` will be called, and the view will be updated to iframe.
|
|
210
|
+
|
|
211
|
+
When you need to refresh the custom tabs, you can call `nuxt.callHook('devtools:customTabs:refresh')` and the hooks on `devtools:customTabs` will be revaluated again.
|
|
212
|
+
|
|
213
|
+
### DevTools API from Custom View
|
|
214
|
+
|
|
215
|
+
To provide complex interactions for your module integrations, we recommend to host your own view and display it in devtools via iframe.
|
|
216
|
+
|
|
217
|
+
To get the infomation from the devtools and the client app, you can do this in your client app:
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
import { useDevtoolsClient } from '@nuxt/devtools/iframe-client'
|
|
221
|
+
|
|
222
|
+
export const devtoolsClient = useDevtoolsClient()
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
When the iframe been served with the same origin (CORS limitation), devtools will automatically inject `__NUXT_DEVTOOLS__` to the iframe's window object. You can access it as a ref using `useDevtoolsClient()` utility.
|
|
226
|
+
|
|
227
|
+
`devtoolsClient.value.host` contains APIs to communicate with the client app, and `devtoolsClient.value.devtools` contains APIs to communicate with the devtools. For example, you can get the router instance from the client app:
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
const router = computed(() => devtoolsClient.value?.host?.nuxt.vueApp.config.globalProperties?.$router)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Examples
|
|
234
|
+
|
|
235
|
+
- Built-in VS Code integration with lazy initialize: https://github.com/nuxt/devtools/blob/main/src/integrations/vscode.ts.
|
|
236
|
+
- VueUse adds a docs tab: https://github.com/vueuse/vueuse/blob/6158e660367b4417896926984670c5b91133c7c3/packages/nuxt/index.ts#L89-L99.
|
|
237
|
+
- UnoCSS Inspector: https://github.com/unocss/unocss/blob/25021a751494e99e85cfd82cca3855cdf78f6a12/packages/nuxt/src/index.ts#L81-L94
|
|
238
|
+
- Nuxt Vitest runner: https://github.com/danielroe/nuxt-vitest/blob/7bac68d96f27dea6c30c198b7caaaf0b495574ab/packages/nuxt-vitest/src/module.ts#L139-L181
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
[MIT](./LICENSE)
|
package/cli.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
process.exit(1)
|
|
2
|
+
import('./dist/cli.mjs')
|