@nuxt/devtools-onboard-nightly 0.0.0-stage β 4.2.2-29933310.853f239
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 +162 -2
- package/dist/module.d.mts +5 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +105 -0
- package/dist/types.d.mts +7 -0
- package/package.json +41 -3
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
CHANGED
|
@@ -1,3 +1,163 @@
|
|
|
1
|
-
|
|
1
|
+
<a href="https://nuxt.com/modules/devtools"><img width="1200" alt="Nuxt DevTools" src="https://github-production-user-asset-6210df.s3.amazonaws.com/904724/261577617-a10567bd-ad33-48cc-9bda-9e37dbe1929f.png"></a>
|
|
2
|
+
<br>
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
<h1>
|
|
5
|
+
Nuxt DevTools
|
|
6
|
+
</h1>
|
|
7
|
+
|
|
8
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
9
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
10
|
+
[![License][license-src]][license-href]
|
|
11
|
+
[![Nuxt][nuxt-src]][nuxt-href]
|
|
12
|
+
[![Volta][volta-src]][volta-href]
|
|
13
|
+
|
|
14
|
+
<p>
|
|
15
|
+
Unleash Nuxt Developer Experience.
|
|
16
|
+
<br>Nuxt DevTools is a set of visual tools that help you to know your app better.
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p>
|
|
20
|
+
<a href="https://nuxt.com/blog/nuxt-devtools-v1-0">π Introduction</a> |
|
|
21
|
+
<a href="https://github.com/nuxt/devtools/discussions/29">π‘ Ideas & Suggestions</a> |
|
|
22
|
+
<a href="https://github.com/nuxt/devtools/discussions/31">πΊοΈ Project Roadmap</a> |
|
|
23
|
+
<a href="https://nuxt.com/modules/devtools">π Documentation</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
> [!NOTE]
|
|
27
|
+
> You are at the `main` branch for v4. The v3 branch is [`v3`](https://github.com/nuxt/devtools/tree/v3).
|
|
28
|
+
|
|
29
|
+
<br>
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
> Nuxt DevTools v4 requires **Nuxt v4.5.0 or higher** (Vite 8). It is built on [Vite DevTools](https://github.com/vitejs/devtools) and shows up as the `Nuxt` group inside the Vite DevTools panel.
|
|
34
|
+
|
|
35
|
+
Nuxt DevTools is **enabled by default**. You can press <kbd>Shift</kbd> + <kbd>Alt</kbd> / <kbd>β§ Shift</kbd> + <kbd>β₯ Option</kbd> + <kbd>D</kbd> in your app to open it up.
|
|
36
|
+
|
|
37
|
+
If you want to explicitly enable or disable Nuxt DevTools, you can update your `nuxt.config` with:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
export default defineNuxtConfig({
|
|
41
|
+
devtools: {
|
|
42
|
+
enabled: true // or false to disable
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Nuxt 4
|
|
48
|
+
|
|
49
|
+
Nuxt 5 ships `@nuxt/devtools-onboard`, which offers to install Nuxt DevTools v4 the first time you run `nuxt dev`; you can also install `@nuxt/devtools` with your package manager. Nuxt 4.5+ still bundles v3; override `@nuxt/devtools` to `^4.0.0` with your package manager (`overrides` in `package.json` for npm, in `pnpm-workspace.yaml` for pnpm, `resolutions` for yarn), remove your lockfile and reinstall. See the [upgrade guide](https://nuxt.com/modules/devtools/upgrading-to-v4) for details and for what changed.
|
|
50
|
+
|
|
51
|
+
### Nightly Release Channel
|
|
52
|
+
|
|
53
|
+
Similar to [Nuxt's Nightly Channel](https://nuxt.com/docs/guide/going-further/nightly-release-channel), DevTools also offers a nightly release channel, that automatically releases for every commit to `main` branch.
|
|
54
|
+
|
|
55
|
+
You can opt-in to the nightly release channel by using package manager resolutions:
|
|
56
|
+
|
|
57
|
+
<details>
|
|
58
|
+
<summary>npm</summary>
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"overrides": {
|
|
63
|
+
"@nuxt/devtools": "npm:@nuxt/devtools-nightly@latest"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
</details>
|
|
69
|
+
|
|
70
|
+
<details>
|
|
71
|
+
<summary>yarn</summary>
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"resolutions": {
|
|
76
|
+
"@nuxt/devtools": "npm:@nuxt/devtools-nightly@latest"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
</details>
|
|
82
|
+
|
|
83
|
+
<details>
|
|
84
|
+
<summary>pnpm</summary>
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
# pnpm-workspace.yaml
|
|
88
|
+
overrides:
|
|
89
|
+
'@nuxt/devtools': 'npm:@nuxt/devtools-nightly@latest'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
</details>
|
|
93
|
+
|
|
94
|
+
Remove lockfile (`package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml`) and reinstall dependencies.
|
|
95
|
+
|
|
96
|
+
### Module Options
|
|
97
|
+
|
|
98
|
+
To configure Nuxt DevTools, you can pass the `devtools` options.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
// nuxt.config.ts
|
|
102
|
+
export default defineNuxtConfig({
|
|
103
|
+
devtools: {
|
|
104
|
+
// Enable devtools (default: true)
|
|
105
|
+
enabled: true,
|
|
106
|
+
// Coder code-server options (enabled by default)
|
|
107
|
+
codeServer: {},
|
|
108
|
+
// ...other options
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
For all options available, please refer to TSDocs in your IDE, or the [type definition file](https://github.com/nuxt/devtools/blob/main/packages/devtools-kit/src/_types/options.ts).
|
|
114
|
+
|
|
115
|
+
## Features
|
|
116
|
+
|
|
117
|
+
Read the [**Announcement Blog Post π**](https://nuxt.com/blog/nuxt-devtools-v1-0) for why we built Nuxt DevTools and what it can do!
|
|
118
|
+
|
|
119
|
+
## Module Authors
|
|
120
|
+
|
|
121
|
+
Please refer to the [Module Authors Guide](https://nuxt.com/modules/devtools/module-authors).
|
|
122
|
+
|
|
123
|
+
## Contribution Guide
|
|
124
|
+
|
|
125
|
+
Please refer to the [Contribution Guide](https://nuxt.com/modules/devtools/contributing).
|
|
126
|
+
|
|
127
|
+
## Anonymous Usage Analytics
|
|
128
|
+
|
|
129
|
+
Nuxt DevTools collects anonymous telemetry data about general usage. This helps us to accurately gauge feature usage and customization across all our users. This data will let us better understand how each features in Nuxt DevTools are used, measuring improvements made (DX and performances) and their relevance. It would also help us to prioritize our efforts and focus on the features that matter the most to our users.
|
|
130
|
+
|
|
131
|
+
Nuxt DevTools' telemetry data is piped through [Nuxt Telemetry](https://github.com/nuxt/telemetry), meaning that Nuxt DevTools will respect your local and global Nuxt Telemetry settings. You can also opt-out Nuxt DevTools' telemetry in the Nuxt DevTools settings.
|
|
132
|
+
|
|
133
|
+
Nuxt DevTools also respects the [`DO_NOT_TRACK`](https://donottrack.sh/) environment variable convention β set `DO_NOT_TRACK=1` in your environment to disable Nuxt DevTools telemetry regardless of any other setting.
|
|
134
|
+
|
|
135
|
+
The data we collect is completely anonymous, not traceable to the source (using hash+seed), and only meaningful in aggregate form. No data we collect is personally identifiable or trackable.
|
|
136
|
+
|
|
137
|
+
### Events
|
|
138
|
+
|
|
139
|
+
On top of the [default Nuxt Telemetry events](https://github.com/nuxt/telemetry#events), Nuxt DevTools also collects the following events:
|
|
140
|
+
|
|
141
|
+
- Versions of Nuxt DevTools
|
|
142
|
+
- Navigations between tabs/feature
|
|
143
|
+
- This helps us to understand which features are used the most to prioritize our efforts.
|
|
144
|
+
- Browser and OS names and versions
|
|
145
|
+
- This helps us improve compatibility across different browsers and operating systems.
|
|
146
|
+
- Click event on some action buttons
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
[MIT](./LICENSE)
|
|
151
|
+
|
|
152
|
+
<!-- Badges -->
|
|
153
|
+
|
|
154
|
+
[npm-version-src]: https://img.shields.io/npm/v/@nuxt/devtools/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
155
|
+
[npm-version-href]: https://npmjs.com/package/@nuxt/devtools
|
|
156
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@nuxt/devtools.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
157
|
+
[npm-downloads-href]: https://npm.chart.dev/@nuxt/devtools
|
|
158
|
+
[license-src]: https://img.shields.io/npm/l/@nuxt/devtools.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
159
|
+
[license-href]: https://npmjs.com/package/@nuxt/devtools
|
|
160
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt
|
|
161
|
+
[nuxt-href]: https://nuxt.com
|
|
162
|
+
[volta-src]: https://user-images.githubusercontent.com/904724/209143798-32345f6c-3cf8-4e06-9659-f4ace4a6acde.svg
|
|
163
|
+
[volta-href]: https://volta.net/nuxt/devtools?utm_source=nuxt_devtools_readme
|
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { defineNuxtModule, tryResolveModule, installModule, logger } from '@nuxt/kit';
|
|
3
|
+
import { readPackageJSON } from 'pkg-types';
|
|
4
|
+
import process from 'node:process';
|
|
5
|
+
|
|
6
|
+
const NUXT_LOGO_SVG = '<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M281.44 397.667H438.32C443.326 397.667 448.118 395.908 452.453 393.427C456.789 390.946 461.258 387.831 463.76 383.533C466.262 379.236 468.002 374.36 468 369.399C467.998 364.437 466.266 359.563 463.76 355.268L357.76 172.947C355.258 168.65 352.201 165.534 347.867 163.053C343.532 160.573 337.325 158.813 332.32 158.813C327.315 158.813 322.521 160.573 318.187 163.053C313.852 165.534 310.795 168.65 308.293 172.947L281.44 219.587L227.733 129.13C225.229 124.834 222.176 120.307 217.84 117.827C213.504 115.346 208.713 115 203.707 115C198.701 115 193.909 115.346 189.573 117.827C185.238 120.307 180.771 124.834 178.267 129.13L46.8267 355.268C44.3208 359.563 44.0022 364.437 44 369.399C43.9978 374.36 44.3246 379.235 46.8267 383.533C49.3288 387.83 53.7979 390.946 58.1333 393.427C62.4688 395.908 67.2603 397.667 72.2667 397.667H171.2C210.401 397.667 238.934 380.082 258.827 346.787L306.88 263.4L332.32 219.587L410.053 352.44H306.88L281.44 397.667ZM169.787 352.44H100.533L203.707 174.36L256 263.4L221.361 323.784C208.151 345.387 193.089 352.44 169.787 352.44Z" fill="#00DC82"/></svg>';
|
|
7
|
+
const NUXT_LOGO = `data:image/svg+xml,${encodeURIComponent(NUXT_LOGO_SVG)}`;
|
|
8
|
+
|
|
9
|
+
const ANSWER_TIMEOUT = 5 * 6e4;
|
|
10
|
+
function confirmInTerminal(command, { input = process.stdin, ask, warn }) {
|
|
11
|
+
const run = `\`${command.join(" ")}\``;
|
|
12
|
+
if (!input.isTTY) {
|
|
13
|
+
warn(`A browser asked to install Nuxt DevTools, but no terminal can confirm it, so it was refused. Run ${run} yourself.`);
|
|
14
|
+
return Promise.resolve(false);
|
|
15
|
+
}
|
|
16
|
+
const answerWith = input.isRaw ? "Press y" : "Type yes and press Enter";
|
|
17
|
+
ask(`${answerWith} to allow installing Nuxt DevTools; anything else refuses.
|
|
18
|
+
The browser asked to run ${run}. If you did not click Install, refuse it: another device can reach this dev server.`);
|
|
19
|
+
const flowing = input.readableFlowing;
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
const timer = setTimeout(() => {
|
|
22
|
+
warn("Nobody allowed installing Nuxt DevTools within 5 minutes, so it was refused.");
|
|
23
|
+
answer(false);
|
|
24
|
+
}, ANSWER_TIMEOUT);
|
|
25
|
+
const onData = (chunk) => answer(/^y(?:es)?$/i.test(String(chunk).trim()));
|
|
26
|
+
function answer(allowed) {
|
|
27
|
+
clearTimeout(timer);
|
|
28
|
+
input.off("data", onData);
|
|
29
|
+
if (!flowing)
|
|
30
|
+
input.pause();
|
|
31
|
+
resolve(allowed);
|
|
32
|
+
}
|
|
33
|
+
input.on("data", onData);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const DEVTOOLS = "@nuxt/devtools";
|
|
38
|
+
const DEVTOOLS_NIGHTLY = `${DEVTOOLS}-nightly`;
|
|
39
|
+
const DEVTOOLS_MODULES = /* @__PURE__ */ new Set([DEVTOOLS, DEVTOOLS_NIGHTLY, `${DEVTOOLS}-edge`]);
|
|
40
|
+
const DEVTOOLS_PACKAGES = [DEVTOOLS_NIGHTLY, DEVTOOLS];
|
|
41
|
+
const BASE = "/__devtools/";
|
|
42
|
+
function listsDevtools(modules) {
|
|
43
|
+
return modules.some((entry) => {
|
|
44
|
+
const id = Array.isArray(entry) ? entry[0] : entry;
|
|
45
|
+
return typeof id === "string" && DEVTOOLS_MODULES.has(id);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async function devtoolsSpec() {
|
|
49
|
+
const { version, peerDependencies } = await readPackageJSON(fileURLToPath(import.meta.url));
|
|
50
|
+
const range = peerDependencies?.[DEVTOOLS] ?? "";
|
|
51
|
+
return `${DEVTOOLS}@${range.startsWith("npm:") ? range : `^${version}`}`;
|
|
52
|
+
}
|
|
53
|
+
const module$1 = defineNuxtModule({
|
|
54
|
+
meta: {
|
|
55
|
+
name: "@nuxt/devtools-onboard"
|
|
56
|
+
},
|
|
57
|
+
async setup(_, nuxt) {
|
|
58
|
+
const { devtools } = nuxt.options;
|
|
59
|
+
if (devtools === false || typeof devtools === "object" && devtools.enabled === false)
|
|
60
|
+
return;
|
|
61
|
+
if (listsDevtools(nuxt.options.modules))
|
|
62
|
+
return;
|
|
63
|
+
for (const name of DEVTOOLS_PACKAGES) {
|
|
64
|
+
const installed = await tryResolveModule(name, nuxt.options.modulesDir);
|
|
65
|
+
if (installed)
|
|
66
|
+
return installModule(installed);
|
|
67
|
+
}
|
|
68
|
+
if (!nuxt.options.dev)
|
|
69
|
+
return;
|
|
70
|
+
const { createOnboarding } = await import('@devframes/hub-ui-onboard');
|
|
71
|
+
const onboarding = createOnboarding({
|
|
72
|
+
cwd: nuxt.options.rootDir,
|
|
73
|
+
base: BASE,
|
|
74
|
+
packages: [await devtoolsSpec()],
|
|
75
|
+
branding: {
|
|
76
|
+
productName: "Nuxt DevTools",
|
|
77
|
+
primaryColor: "#099e61",
|
|
78
|
+
logo: NUXT_LOGO
|
|
79
|
+
},
|
|
80
|
+
messages: {
|
|
81
|
+
restart: "Installed. Restarting the dev server\u2026"
|
|
82
|
+
},
|
|
83
|
+
// Upstream's own question refuses at once under nuxi's TUI (DF9007).
|
|
84
|
+
onConfirm: ({ command }) => confirmInTerminal(command, {
|
|
85
|
+
ask: (message) => logger.box(message),
|
|
86
|
+
warn: (message) => logger.warn(message)
|
|
87
|
+
}),
|
|
88
|
+
onInstalled() {
|
|
89
|
+
setTimeout(() => nuxt.callHook("restart", { hard: true }), 100);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
nuxt.hook("vite:serverCreated", (server, { isClient }) => {
|
|
93
|
+
if (!isClient)
|
|
94
|
+
return;
|
|
95
|
+
server.middlewares.use(BASE.slice(0, -1), (req, res, next) => {
|
|
96
|
+
req.url = req.originalUrl || req.url;
|
|
97
|
+
onboarding.nodeMiddleware(req, res, next);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
if (!onboarding.disabled)
|
|
101
|
+
(nuxt.options.app.head.script ??= []).push({ type: "module", src: onboarding.scriptSrc, tagPosition: "bodyClose" });
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export { module$1 as default };
|
package/dist/types.d.mts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/devtools-onboard-nightly",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "4.2.2-29933310.853f239",
|
|
5
|
+
"description": "The entry point of Nuxt DevTools: loads it when installed, otherwise offers to install it from a floating button.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://nuxt.com/modules/devtools",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/nuxt/devtools.git",
|
|
11
|
+
"directory": "packages/devtools-onboard"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./dist/module.mjs"
|
|
15
|
+
},
|
|
16
|
+
"types": "./dist/module.d.mts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@nuxt/devtools": "npm:@nuxt/devtools-nightly@4.2.2-29933310.853f239",
|
|
22
|
+
"@nuxt/kit": "^4.0.0-0 || ^5.0.0-0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependenciesMeta": {
|
|
25
|
+
"@nuxt/devtools": {
|
|
26
|
+
"optional": true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@devframes/hub-ui-onboard": "^1.4.0",
|
|
31
|
+
"pkg-types": "^2.4.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-2611010234-c709ec8",
|
|
35
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-2611010234-c709ec8",
|
|
36
|
+
"nuxt": "npm:nuxt-nightly@5.0.0-2611010234-c709ec8",
|
|
37
|
+
"vite": "^8.3.8"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "nuxt-build-module build",
|
|
41
|
+
"stub": "nuxt-build-module build --stub",
|
|
42
|
+
"dev:prepare": "pnpm run stub"
|
|
43
|
+
}
|
|
6
44
|
}
|