@nuxt/devtools-nightly 3.2.4-29563482.f9a1d97 → 4.0.0-29884714.dcb247f
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/README.md +48 -10
- package/dist/chunks/analyze-build.mjs +31 -3
- package/dist/chunks/assets.mjs +24 -0
- package/dist/chunks/code-server.mjs +74 -0
- package/dist/chunks/data-inspector.mjs +82 -0
- package/dist/chunks/module-main.mjs +906 -10876
- package/dist/chunks/og.mjs +32 -0
- package/dist/chunks/timeline.mjs +102 -41
- package/dist/chunks/vite-inspect.mjs +89 -53
- package/dist/chunks/vue-devtools.mjs +48 -5
- package/dist/dirs.d.mts +1 -3
- package/dist/dirs.mjs +2 -4
- package/dist/module.d.mts +1 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +1 -1
- package/dist/runtime/plugins/devtools.client.d.ts +3 -2
- package/dist/runtime/plugins/devtools.client.js +3 -6
- package/dist/runtime/plugins/view/client.js +15 -82
- package/dist/runtime/plugins/vite-devtools.client.js +5 -1
- package/dist/runtime/shared/hooks.d.ts +10 -2
- package/dist/shared/{devtools-nightly.LsRDzDTD.d.mts → devtools-nightly.DIKI0iiX.d.mts} +1 -7
- package/dist/shared/devtools-nightly.DnJkSJYB.mjs +122 -0
- package/dist/types.d.mts +2 -31
- package/dist/webcomponents/index.mjs +42 -44
- package/package.json +90 -88
- package/.discoveryrc.cjs +0 -13
- package/dist/chunks/vscode.mjs +0 -170
- package/dist/client/200.html +0 -1
- package/dist/client/404.html +0 -1
- package/dist/client/_nuxt/__blank-cpzbm3dn.js +0 -1
- package/dist/client/_nuxt/_plugin-vue_export-helper-n58akrbk.js +0 -1
- package/dist/client/_nuxt/analyze-build-e7v5vkef.js +0 -1
- package/dist/client/_nuxt/assets-b5c187l4.js +0 -6
- package/dist/client/_nuxt/assets.css-hmxl533k.css +0 -1
- package/dist/client/_nuxt/builds/latest.json +0 -1
- package/dist/client/_nuxt/builds/meta/fac6756b-364c-424d-9354-b01ecbf17dce.json +0 -1
- package/dist/client/_nuxt/client-im47u3kz.js +0 -1
- package/dist/client/_nuxt/code-diff-idsu3m0z.js +0 -8
- package/dist/client/_nuxt/code-snippets-k81hoi4s.js +0 -1
- package/dist/client/_nuxt/color-b9xoe9j2.js +0 -1
- package/dist/client/_nuxt/components-bmictfph.js +0 -1
- package/dist/client/_nuxt/composable-item-cza22cup.js +0 -1
- package/dist/client/_nuxt/composables-b2ccklz4.js +0 -1
- package/dist/client/_nuxt/constants-ih922r91.js +0 -1
- package/dist/client/_nuxt/custom-_name_-gqm5kr56.js +0 -1
- package/dist/client/_nuxt/data-schema-button-b308wyi0.js +0 -1
- package/dist/client/_nuxt/data-schema-drawer-lr34uwsh.js +0 -2
- package/dist/client/_nuxt/debug-kgc8fptp.js +0 -1
- package/dist/client/_nuxt/default-jvhm51ri.js +0 -1
- package/dist/client/_nuxt/dev-auth-ojiqold5.js +0 -1
- package/dist/client/_nuxt/dist-duc3zu0y.js +0 -1
- package/dist/client/_nuxt/dist-m49wlq01.js +0 -1
- package/dist/client/_nuxt/dist-mnod32r1.js +0 -1
- package/dist/client/_nuxt/duration-display-f7ucshmo.js +0 -1
- package/dist/client/_nuxt/entry.css-me26coxn.css +0 -1
- package/dist/client/_nuxt/error-404-nggtc73s.js +0 -1
- package/dist/client/_nuxt/error-404.css-j1aav08u.css +0 -1
- package/dist/client/_nuxt/error-500-dym2gzqx.js +0 -1
- package/dist/client/_nuxt/error-500.css-eu9fz4va.css +0 -1
- package/dist/client/_nuxt/error-fqinfa1x.js +0 -9
- package/dist/client/_nuxt/filepath-item-e1s52fbh.js +0 -1
- package/dist/client/_nuxt/full-et0weok9.js +0 -1
- package/dist/client/_nuxt/help-fab-hz6r2oxa.js +0 -1
- package/dist/client/_nuxt/help-fab.css-ms50khsu.css +0 -1
- package/dist/client/_nuxt/hooks-i7nsduqp.js +0 -1
- package/dist/client/_nuxt/i1wyrjhl.js +0 -4
- package/dist/client/_nuxt/imports-9o2qs53q.js +0 -1
- package/dist/client/_nuxt/launch-page-hpkkqhit.js +0 -1
- package/dist/client/_nuxt/mitt.es-fjx0h8xe.js +0 -1
- package/dist/client/_nuxt/modules-jok0opuq.js +0 -1
- package/dist/client/_nuxt/nbadge-m66xoquo.js +0 -1
- package/dist/client/_nuxt/nbutton-gygn07c2.js +0 -1
- package/dist/client/_nuxt/ncard-mqcl8pso.js +0 -1
- package/dist/client/_nuxt/ncheckbox-c0r45qtu.js +0 -1
- package/dist/client/_nuxt/ncode-block-figzf35k.js +0 -2
- package/dist/client/_nuxt/ncode-block.css-o2ixs97j.css +0 -1
- package/dist/client/_nuxt/ndrawer-bgqyrlmt.js +0 -1
- package/dist/client/_nuxt/ndropdown-cip8lboe.js +0 -1
- package/dist/client/_nuxt/nicon-m1crov2l.js +0 -1
- package/dist/client/_nuxt/nicon-title-tqdvw0w0.js +0 -1
- package/dist/client/_nuxt/nlink-od4lllbl.js +0 -1
- package/dist/client/_nuxt/nmarkdown-hw0hmqw7.js +0 -1
- package/dist/client/_nuxt/nnavbar-lpozm5fj.js +0 -1
- package/dist/client/_nuxt/none-bdxkqeml.js +0 -1
- package/dist/client/_nuxt/npanel-grids-dd23ifsw.js +0 -1
- package/dist/client/_nuxt/nsection-block-lqrohs9v.js +0 -1
- package/dist/client/_nuxt/nsection-block.css-h05mpq8x.css +0 -1
- package/dist/client/_nuxt/nselect-gczoit0g.js +0 -1
- package/dist/client/_nuxt/nselect-tabs-bsw5fg3d.js +0 -1
- package/dist/client/_nuxt/nswitch-ke379yjx.js +0 -1
- package/dist/client/_nuxt/ntext-input-cygthohl.js +0 -1
- package/dist/client/_nuxt/ntip-ke63ovgc.js +0 -1
- package/dist/client/_nuxt/nuxt-link-bumooa9d.js +0 -1
- package/dist/client/_nuxt/nuxt-otp6bp04.js +0 -1
- package/dist/client/_nuxt/open-graph-lumhcitx.js +0 -3
- package/dist/client/_nuxt/open-graph.css-dk03m1qz.css +0 -1
- package/dist/client/_nuxt/overview-gvx68ogm.js +0 -1
- package/dist/client/_nuxt/pages-cf1hvns3.js +0 -1
- package/dist/client/_nuxt/pages-lgihsvbt.js +0 -1
- package/dist/client/_nuxt/payload-fvgw4hh9.js +0 -1
- package/dist/client/_nuxt/pinia-lmrgyjxw.js +0 -1
- package/dist/client/_nuxt/plugins-ccaip8nh.js +0 -1
- package/dist/client/_nuxt/ready-dadbdj5i.js +0 -1
- package/dist/client/_nuxt/render-tree-corj3giw.js +0 -1
- package/dist/client/_nuxt/rolldown-runtime-oipoa1or.js +0 -1
- package/dist/client/_nuxt/rpc-ez4fzlum.js +0 -1
- package/dist/client/_nuxt/runtime-configs-im0uu24n.js +0 -1
- package/dist/client/_nuxt/server-discovery-ffkkczqi.js +0 -1
- package/dist/client/_nuxt/server-route-inputs-lspeoiem.js +0 -1
- package/dist/client/_nuxt/server-routes-dhvqrowz.js +0 -7
- package/dist/client/_nuxt/server-tasks-mr9ezn8q.js +0 -1
- package/dist/client/_nuxt/settings-issronwn.js +0 -1
- package/dist/client/_nuxt/splitpanes.es-bxyirks2.js +0 -1
- package/dist/client/_nuxt/stacktrace-list-hiui24c3.js +0 -1
- package/dist/client/_nuxt/state-components-fbls8ka7.js +0 -1
- package/dist/client/_nuxt/state-editor-c7e04uj2.js +0 -1
- package/dist/client/_nuxt/state-modules-inqbwd7z.js +0 -1
- package/dist/client/_nuxt/state-routes-jln33b1m.js +0 -1
- package/dist/client/_nuxt/state-tabs-etl5jr30.js +0 -1
- package/dist/client/_nuxt/storage-husj5pg6.js +0 -1
- package/dist/client/_nuxt/storage-options-cth3coln.js +0 -1
- package/dist/client/_nuxt/telemetry-eqv6a0hn.js +0 -1
- package/dist/client/_nuxt/terminals-kitd8oja.js +0 -1
- package/dist/client/_nuxt/terminals.css-mejv43xm.css +0 -1
- package/dist/client/_nuxt/timeline-gr4tcvcz.js +0 -31
- package/dist/client/_nuxt/timeline.css-m03aec2q.css +0 -1
- package/dist/client/_nuxt/unocss-runtime-cpug61u1.js +0 -1
- package/dist/client/_nuxt/utils-nbkl6byi.js +0 -2
- package/dist/client/_nuxt/vendor/json-editor-vue-eojr4v24.js +0 -3869
- package/dist/client/_nuxt/vendor/json-editor-vue.css-lkbe0qhh.css +0 -1
- package/dist/client/_nuxt/vendor/markdown-it-ckeo8pwp.js +0 -14
- package/dist/client/_nuxt/vendor/quicktype-core-k4qx3809.js +0 -929
- package/dist/client/_nuxt/vendor/shiki-lqo1hg2n.js +0 -153
- package/dist/client/_nuxt/vendor/unocss-k727ub0h.js +0 -3
- package/dist/client/_nuxt/vendor/unocss.css-3gd0e2sv.css +0 -1
- package/dist/client/_nuxt/vendor/vis-id8udisj.js +0 -26
- package/dist/client/_nuxt/vendor/xterm-ed0pys2e.js +0 -36
- package/dist/client/_nuxt/vendor/xterm.css-jqmddlol.css +0 -1
- package/dist/client/_nuxt/virtual-files-ky9cc4av.js +0 -1
- package/dist/client/_nuxt/virtual-files.css-l97kh4kx.css +0 -1
- package/dist/client/_nuxt/vue-devtools-dunhx2nz.js +0 -4
- package/dist/client/_nuxt/vue-router-jbnxw7nb.js +0 -1
- package/dist/client/discovery/index.html +0 -611
- package/dist/client/index.html +0 -1
- package/dist/client/nuxt.svg +0 -3
- package/dist/runtime/plugins/view/state.d.ts +0 -2
- package/dist/runtime/plugins/view/state.js +0 -12
- package/dist/runtime/vue-devtools-client.d.ts +0 -2
- package/dist/runtime/vue-devtools-client.js +0 -8
- package/dist/shared/devtools-nightly.COlX0Gls.mjs +0 -114
- package/types.d.ts +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createOgDevframe } from '@devframes/plugin-og';
|
|
2
|
+
import { onDevtoolsReady, NUXT_DEVTOOLS_GROUP_ID } from '@nuxt/devtools-kit';
|
|
3
|
+
|
|
4
|
+
function setup({ nuxt }) {
|
|
5
|
+
const defaultUrl = nuxt.options.devServer?.url;
|
|
6
|
+
let liveOrigin;
|
|
7
|
+
nuxt.hook("listen", (_server, listener) => {
|
|
8
|
+
if (listener?.url)
|
|
9
|
+
liveOrigin = new URL(listener.url).origin;
|
|
10
|
+
});
|
|
11
|
+
const definition = createOgDevframe({
|
|
12
|
+
defaultUrl,
|
|
13
|
+
fetch: (input, init) => {
|
|
14
|
+
if (liveOrigin && defaultUrl) {
|
|
15
|
+
const configured = new URL(defaultUrl).origin;
|
|
16
|
+
if (input.startsWith(configured))
|
|
17
|
+
input = liveOrigin + input.slice(configured.length);
|
|
18
|
+
}
|
|
19
|
+
return fetch(input, init);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
onDevtoolsReady((kit) => {
|
|
23
|
+
return kit.install(definition, {
|
|
24
|
+
dock: {
|
|
25
|
+
groupId: NUXT_DEVTOOLS_GROUP_ID,
|
|
26
|
+
category: "analyze"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}, nuxt);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { setup };
|
package/dist/chunks/timeline.mjs
CHANGED
|
@@ -1,9 +1,90 @@
|
|
|
1
|
+
import { addBuildPlugin } from '@nuxt/kit';
|
|
1
2
|
import { resolve } from 'pathe';
|
|
2
|
-
import semver from 'semver';
|
|
3
3
|
import { runtimeDir } from '../dirs.mjs';
|
|
4
|
+
import escapeRE from 'escape-string-regexp';
|
|
5
|
+
import MagicString from 'magic-string';
|
|
6
|
+
import { findStaticImports, parseStaticImport } from 'mlly';
|
|
7
|
+
import { createUnplugin } from 'unplugin';
|
|
4
8
|
import 'node:path';
|
|
5
9
|
import 'node:url';
|
|
6
10
|
|
|
11
|
+
const HELPER_NAME = "__nuxtTimelineWrap";
|
|
12
|
+
const RENAME_PREFIX = "_$__";
|
|
13
|
+
const RUNTIME_DIR_RE = new RegExp(`^${escapeRE(runtimeDir)}`);
|
|
14
|
+
function importKey(source, name) {
|
|
15
|
+
return `${source}\0${name}`;
|
|
16
|
+
}
|
|
17
|
+
function TimelineWrapPlugin(options) {
|
|
18
|
+
return createUnplugin(() => ({
|
|
19
|
+
name: "nuxt:devtools:timeline-function-wrap",
|
|
20
|
+
enforce: "post",
|
|
21
|
+
transform: {
|
|
22
|
+
filter: {
|
|
23
|
+
id: {
|
|
24
|
+
include: [/^[^?]*\.(?:m?[jt]sx?|vue)(?:$|\?)/],
|
|
25
|
+
exclude: [
|
|
26
|
+
/^\0/,
|
|
27
|
+
/[\\/]node_modules[\\/]/,
|
|
28
|
+
/[?&]macro=true/,
|
|
29
|
+
/[?&]type=(?:style|template|custom)\b/,
|
|
30
|
+
RUNTIME_DIR_RE
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
code: { include: /\bimport\b/ }
|
|
34
|
+
},
|
|
35
|
+
async handler(code) {
|
|
36
|
+
const wrappable = await options.getWrappable();
|
|
37
|
+
if (!wrappable.size)
|
|
38
|
+
return;
|
|
39
|
+
return wrapTimelineImports(code, wrappable, options.helperPath);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
function wrapTimelineImports(code, wrappable, helperPath) {
|
|
45
|
+
if (code.includes(HELPER_NAME))
|
|
46
|
+
return;
|
|
47
|
+
const s = new MagicString(code);
|
|
48
|
+
const wrappers = [];
|
|
49
|
+
for (const imp of findStaticImports(code)) {
|
|
50
|
+
const { specifier, defaultImport, namespacedImport, namedImports } = parseStaticImport(imp);
|
|
51
|
+
let wrapped = false;
|
|
52
|
+
const importAs = (name, local) => {
|
|
53
|
+
if (!wrappable.has(importKey(specifier, name)))
|
|
54
|
+
return local;
|
|
55
|
+
wrapped = true;
|
|
56
|
+
wrappers.push(`const ${local} = ${HELPER_NAME}(${JSON.stringify(name === "default" ? local : name)}, ${RENAME_PREFIX}${local});`);
|
|
57
|
+
return RENAME_PREFIX + local;
|
|
58
|
+
};
|
|
59
|
+
const clause = [];
|
|
60
|
+
if (defaultImport)
|
|
61
|
+
clause.push(importAs("default", defaultImport));
|
|
62
|
+
if (namespacedImport)
|
|
63
|
+
clause.push(`* as ${namespacedImport}`);
|
|
64
|
+
const named = Object.entries(namedImports ?? {}).map(([name, local]) => {
|
|
65
|
+
const bound = importAs(name, local);
|
|
66
|
+
return name === bound ? name : `${name} as ${bound}`;
|
|
67
|
+
});
|
|
68
|
+
if (named.length)
|
|
69
|
+
clause.push(`{ ${named.join(", ")} }`);
|
|
70
|
+
if (!wrapped)
|
|
71
|
+
continue;
|
|
72
|
+
const clauseStart = imp.start + imp.code.indexOf(imp.imports);
|
|
73
|
+
s.overwrite(clauseStart, clauseStart + imp.imports.length, `${clause.join(", ")} `);
|
|
74
|
+
}
|
|
75
|
+
if (!wrappers.length)
|
|
76
|
+
return;
|
|
77
|
+
s.prepend([
|
|
78
|
+
`import { ${HELPER_NAME} } from ${JSON.stringify(helperPath)};`,
|
|
79
|
+
...wrappers,
|
|
80
|
+
""
|
|
81
|
+
].join("\n"));
|
|
82
|
+
return {
|
|
83
|
+
code: s.toString(),
|
|
84
|
+
map: s.generateMap({ hires: "boundary" })
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
7
88
|
const DEFINE_UPPER_RE = /^define[A-Z]/;
|
|
8
89
|
function setup({ nuxt, options }) {
|
|
9
90
|
const helperPath = resolve(runtimeDir, "function-metrics-helpers");
|
|
@@ -22,51 +103,31 @@ function setup({ nuxt, options }) {
|
|
|
22
103
|
if (item.type)
|
|
23
104
|
return false;
|
|
24
105
|
const name = item.as || item.name;
|
|
25
|
-
if (!include.some((f) => typeof f === "function" ? f(item) : typeof f === "string" ? name === f : f.test(name)))
|
|
106
|
+
if (!include.some((f) => typeof f === "function" ? f(item) : typeof f === "string" ? name === f : f.test(name))) {
|
|
26
107
|
return false;
|
|
27
|
-
|
|
108
|
+
}
|
|
109
|
+
if (exclude.some((f) => typeof f === "function" ? f(item) : typeof f === "string" ? name === f : f.test(name))) {
|
|
28
110
|
return false;
|
|
111
|
+
}
|
|
29
112
|
return true;
|
|
30
113
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return i;
|
|
43
|
-
const name = i.as || i.name;
|
|
44
|
-
return {
|
|
45
|
-
...i,
|
|
46
|
-
meta: {
|
|
47
|
-
wrapperOriginalAs: name
|
|
48
|
-
},
|
|
49
|
-
as: `_$__${name}`
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
injectImportsStringified(str, imports, s, id) {
|
|
54
|
-
if (id?.includes("?macro=true"))
|
|
55
|
-
return;
|
|
56
|
-
const code = s.toString();
|
|
57
|
-
const injected = imports.filter((i) => i.meta?.wrapperOriginalAs);
|
|
58
|
-
if (injected.length) {
|
|
59
|
-
const result = [
|
|
60
|
-
str,
|
|
61
|
-
code.includes("__nuxtTimelineWrap") ? "" : `import { __nuxtTimelineWrap } from ${JSON.stringify(helperPath)}`,
|
|
62
|
-
...injected.map((i) => `const ${i.meta.wrapperOriginalAs} = __nuxtTimelineWrap(${JSON.stringify(i.name)}, ${i.as})`),
|
|
63
|
-
""
|
|
64
|
-
].join(";");
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
114
|
+
let unimport;
|
|
115
|
+
nuxt.hook("imports:context", (ctx) => {
|
|
116
|
+
unimport = ctx;
|
|
117
|
+
});
|
|
118
|
+
async function getWrappable() {
|
|
119
|
+
if (!unimport)
|
|
120
|
+
return /* @__PURE__ */ new Set();
|
|
121
|
+
const imports = await unimport.getImports();
|
|
122
|
+
const factoryNames = new Set(nuxt.options.optimization.keyedComposableFactories?.map((f) => f.name));
|
|
123
|
+
return new Set(
|
|
124
|
+
imports.filter((i) => filter(i) && !factoryNames.has(i.name)).map((i) => importKey(i.from, i.name))
|
|
69
125
|
);
|
|
126
|
+
}
|
|
127
|
+
nuxt.hook("modules:done", () => {
|
|
128
|
+
nuxt.hook("build:before", () => {
|
|
129
|
+
addBuildPlugin(TimelineWrapPlugin({ helperPath, getWrappable }));
|
|
130
|
+
});
|
|
70
131
|
});
|
|
71
132
|
}
|
|
72
133
|
|
|
@@ -1,64 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { addVitePlugin } from '@nuxt/kit';
|
|
1
|
+
import { onDevtoolsReady } from '@nuxt/devtools-kit';
|
|
2
|
+
import { addVitePlugin, logger } from '@nuxt/kit';
|
|
3
|
+
import { createInstallLauncher } from '@vitejs/devtools-kit/node';
|
|
4
|
+
import { isPackageExists } from 'local-pkg';
|
|
5
|
+
import { R as RPC_NAMESPACE } from './module-main.mjs';
|
|
6
|
+
import 'node:os';
|
|
7
|
+
import 'consola/utils';
|
|
8
|
+
import 'devframe/utils/serve-static';
|
|
9
|
+
import 'pathe';
|
|
10
|
+
import 'verkit';
|
|
11
|
+
import 'vite';
|
|
12
|
+
import '../shared/devtools-nightly.DnJkSJYB.mjs';
|
|
13
|
+
import '../dirs.mjs';
|
|
14
|
+
import 'node:path';
|
|
15
|
+
import 'node:url';
|
|
16
|
+
import 'node:child_process';
|
|
17
|
+
import 'node:fs';
|
|
18
|
+
import 'node:fs/promises';
|
|
19
|
+
import 'node:util';
|
|
20
|
+
import 'tinyglobby';
|
|
21
|
+
import 'destr';
|
|
22
|
+
import '../../dist/runtime/shared/hooks.js';
|
|
23
|
+
import 'devframe/utils/hash';
|
|
24
|
+
import 'magicast';
|
|
25
|
+
import 'magicast/helpers';
|
|
26
|
+
import 'node:process';
|
|
27
|
+
import 'node:module';
|
|
28
|
+
import '@vitejs/devtools-kit/constants';
|
|
29
|
+
import 'perfect-debounce';
|
|
3
30
|
|
|
4
|
-
const DOUBLE_SLASH_RE = /\/\//g;
|
|
5
31
|
const VERSION_QUERY_RE = /\?v=\w+$/;
|
|
6
32
|
const VUE_EXT_RE = /\.vue($|\?v=)/;
|
|
33
|
+
const INSPECT_DOCK_ID = "vite-plugin-inspect";
|
|
34
|
+
const INSPECT_DOCK_TITLE = "Inspect";
|
|
35
|
+
const INSPECT_DOCK_ICON = "ph:magnifying-glass-duotone";
|
|
36
|
+
function isVitePluginInspectAvailable(rootDir) {
|
|
37
|
+
return isPackageExists("vite-plugin-inspect", {
|
|
38
|
+
paths: [rootDir]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
7
41
|
async function createVitePluginInspect(options) {
|
|
8
42
|
return await import('vite-plugin-inspect').then((r) => r.default(options));
|
|
9
43
|
}
|
|
10
|
-
async function setup(
|
|
44
|
+
async function setup(ctx) {
|
|
45
|
+
if (!isVitePluginInspectAvailable(ctx.nuxt.options.rootDir)) {
|
|
46
|
+
addVitePlugin(createInstallLauncher({
|
|
47
|
+
id: INSPECT_DOCK_ID,
|
|
48
|
+
title: INSPECT_DOCK_TITLE,
|
|
49
|
+
icon: INSPECT_DOCK_ICON,
|
|
50
|
+
label: "Vite Inspect",
|
|
51
|
+
install: ["vite-plugin-inspect"]
|
|
52
|
+
}));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
11
55
|
const plugin = await createVitePluginInspect();
|
|
12
56
|
addVitePlugin(plugin);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
name: "builtin-vite-inspect",
|
|
19
|
-
title: "Inspect",
|
|
20
|
-
icon: "carbon-ibm-watson-discovery",
|
|
21
|
-
category: "advanced",
|
|
22
|
-
view: {
|
|
23
|
-
type: "iframe",
|
|
24
|
-
src: `${nuxt.options.app.baseURL}${nuxt.options.app.buildAssetsDir}/__inspect/`.replace(DOUBLE_SLASH_RE, "/")
|
|
25
|
-
}
|
|
26
|
-
}), nuxt);
|
|
27
|
-
async function getComponentsRelationships() {
|
|
28
|
-
const meta = await api?.rpc.getMetadata();
|
|
29
|
-
const modules = (meta && meta.instances[0] ? await api?.rpc.getModulesList({
|
|
30
|
-
vite: meta.instances[0].vite,
|
|
31
|
-
env: meta.instances[0].environments[0]
|
|
32
|
-
}) : null) || [];
|
|
33
|
-
const components = await rpc.functions.getComponents() || [];
|
|
34
|
-
const vueModules = modules.filter((m) => {
|
|
35
|
-
const plainId = m.id.replace(VERSION_QUERY_RE, "");
|
|
36
|
-
if (components.some((c) => c.filePath === plainId))
|
|
37
|
-
return true;
|
|
38
|
-
return m.id.match(VUE_EXT_RE);
|
|
39
|
-
});
|
|
40
|
-
const graph = vueModules.map((i) => {
|
|
41
|
-
function searchForVueDeps(id, seen = /* @__PURE__ */ new Set()) {
|
|
42
|
-
if (seen.has(id))
|
|
43
|
-
return [];
|
|
44
|
-
seen.add(id);
|
|
45
|
-
const module = modules.find((m) => m.id === id);
|
|
46
|
-
if (!module)
|
|
47
|
-
return [];
|
|
48
|
-
return module.deps.flatMap((i2) => {
|
|
49
|
-
if (vueModules.some((m) => m.id === i2))
|
|
50
|
-
return [i2];
|
|
51
|
-
return searchForVueDeps(i2, seen);
|
|
52
|
-
});
|
|
57
|
+
onDevtoolsReady((kit) => {
|
|
58
|
+
async function getComponentsRelationships() {
|
|
59
|
+
if (!kit.rpc.has("vite-plugin-inspect:get-metadata")) {
|
|
60
|
+
logger.warn("[nuxt-devtools] vite-plugin-inspect RPC functions not registered, component relationships unavailable");
|
|
61
|
+
return [];
|
|
53
62
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
const meta = await kit.rpc.invokeLocal("vite-plugin-inspect:get-metadata");
|
|
64
|
+
const modules = (meta && meta.instances[0] ? await kit.rpc.invokeLocal("vite-plugin-inspect:get-modules-list", {
|
|
65
|
+
vite: meta.instances[0].vite,
|
|
66
|
+
env: meta.instances[0].environments[0]
|
|
67
|
+
}) : null) || [];
|
|
68
|
+
const components = await kit.rpc.invokeLocal(`${RPC_NAMESPACE}:getComponents`) || [];
|
|
69
|
+
const vueModules = modules.filter((m) => {
|
|
70
|
+
const plainId = m.id.replace(VERSION_QUERY_RE, "");
|
|
71
|
+
if (components.some((c) => c.filePath === plainId))
|
|
72
|
+
return true;
|
|
73
|
+
return m.id.match(VUE_EXT_RE);
|
|
74
|
+
});
|
|
75
|
+
const graph = vueModules.map((i) => {
|
|
76
|
+
function searchForVueDeps(id, seen = /* @__PURE__ */ new Set()) {
|
|
77
|
+
if (seen.has(id))
|
|
78
|
+
return [];
|
|
79
|
+
seen.add(id);
|
|
80
|
+
const module = modules.find((m) => m.id === id);
|
|
81
|
+
if (!module)
|
|
82
|
+
return [];
|
|
83
|
+
return module.deps.flatMap((i2) => {
|
|
84
|
+
if (vueModules.some((m) => m.id === i2))
|
|
85
|
+
return [i2];
|
|
86
|
+
return searchForVueDeps(i2, seen);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
id: i.id,
|
|
91
|
+
deps: searchForVueDeps(i.id)
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
return graph;
|
|
95
|
+
}
|
|
96
|
+
kit.rpc.register({ name: `${RPC_NAMESPACE}:getComponentsRelationships`, handler: getComponentsRelationships }, true);
|
|
97
|
+
}, ctx.nuxt);
|
|
62
98
|
}
|
|
63
99
|
|
|
64
|
-
export { createVitePluginInspect, setup };
|
|
100
|
+
export { createVitePluginInspect, isVitePluginInspectAvailable, setup };
|
|
@@ -1,17 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { addVitePlugin, addPluginTemplate } from '@nuxt/kit';
|
|
2
|
+
import { vueDevtools } from 'vite-plugin-vue-devtools';
|
|
3
|
+
import { s as skipInSSR } from './module-main.mjs';
|
|
4
|
+
import 'node:os';
|
|
5
|
+
import '@nuxt/devtools-kit';
|
|
6
|
+
import 'consola/utils';
|
|
7
|
+
import 'devframe/utils/serve-static';
|
|
8
|
+
import 'pathe';
|
|
9
|
+
import 'verkit';
|
|
10
|
+
import 'vite';
|
|
11
|
+
import '../shared/devtools-nightly.DnJkSJYB.mjs';
|
|
12
|
+
import '../dirs.mjs';
|
|
4
13
|
import 'node:path';
|
|
5
14
|
import 'node:url';
|
|
15
|
+
import 'node:child_process';
|
|
16
|
+
import 'node:fs';
|
|
17
|
+
import 'node:fs/promises';
|
|
18
|
+
import 'node:util';
|
|
19
|
+
import 'tinyglobby';
|
|
20
|
+
import 'destr';
|
|
21
|
+
import '../../dist/runtime/shared/hooks.js';
|
|
22
|
+
import 'devframe/utils/hash';
|
|
23
|
+
import 'magicast';
|
|
24
|
+
import 'magicast/helpers';
|
|
25
|
+
import 'node:process';
|
|
26
|
+
import 'node:module';
|
|
27
|
+
import 'local-pkg';
|
|
28
|
+
import '@vitejs/devtools-kit/constants';
|
|
29
|
+
import 'perfect-debounce';
|
|
6
30
|
|
|
7
|
-
|
|
31
|
+
function setup({ nuxt }) {
|
|
8
32
|
if (!nuxt.options.dev || nuxt.options.test)
|
|
9
33
|
return;
|
|
34
|
+
const plugins = vueDevtools().map((plugin) => {
|
|
35
|
+
const { devtools } = plugin;
|
|
36
|
+
if (!devtools?.setup)
|
|
37
|
+
return plugin;
|
|
38
|
+
return {
|
|
39
|
+
...plugin,
|
|
40
|
+
devtools: {
|
|
41
|
+
...devtools,
|
|
42
|
+
setup: (ctx) => skipInSSR(ctx) ? void 0 : devtools.setup(ctx)
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
addVitePlugin(plugins);
|
|
10
47
|
addPluginTemplate({
|
|
48
|
+
filename: "devtools/vue-devtools-client.mjs",
|
|
11
49
|
name: "vue-devtools-client",
|
|
12
50
|
mode: "client",
|
|
13
51
|
order: -1e3,
|
|
14
|
-
|
|
52
|
+
getContents: () => [
|
|
53
|
+
`import 'virtual:vue-devtools-client'`,
|
|
54
|
+
``,
|
|
55
|
+
`export default () => {}`,
|
|
56
|
+
``
|
|
57
|
+
].join("\n")
|
|
15
58
|
});
|
|
16
59
|
}
|
|
17
60
|
|
package/dist/dirs.d.mts
CHANGED
package/dist/dirs.mjs
CHANGED
|
@@ -2,8 +2,6 @@ import { resolve } from 'node:path';
|
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
|
|
4
4
|
const packageDir = resolve(fileURLToPath(import.meta.url), "../..");
|
|
5
|
-
const
|
|
6
|
-
const runtimeDir = resolve(distDir, "runtime");
|
|
7
|
-
const clientDir = resolve(distDir, "client");
|
|
5
|
+
const runtimeDir = resolve(fileURLToPath(import.meta.url), "../runtime");
|
|
8
6
|
|
|
9
|
-
export {
|
|
7
|
+
export { packageDir, runtimeDir };
|
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@nuxt/kit';
|
|
2
|
-
export { m as default } from './shared/devtools-nightly.
|
|
2
|
+
export { m as default } from './shared/devtools-nightly.DnJkSJYB.mjs';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { Plugin } from 'nuxt/app';
|
|
2
|
+
declare const plugin: Plugin;
|
|
3
|
+
export default plugin;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { defineNuxtPlugin, useRouter, useState } from "#imports";
|
|
2
1
|
import { shallowReactive, watchEffect } from "vue";
|
|
2
|
+
import { defineNuxtPlugin, useRouter, useState } from "#imports";
|
|
3
3
|
import { setupHooksDebug } from "../shared/hooks.js";
|
|
4
|
-
|
|
4
|
+
const plugin = defineNuxtPlugin((nuxt) => {
|
|
5
5
|
if (typeof document === "undefined" || typeof window === "undefined")
|
|
6
6
|
return;
|
|
7
7
|
try {
|
|
8
8
|
if (window.__NUXT_DEVTOOLS_DISABLE__ || window.parent?.__NUXT_DEVTOOLS_DISABLE__)
|
|
9
9
|
return;
|
|
10
|
-
if (parent && window.self !== parent) {
|
|
11
|
-
if (parent.__NUXT_DEVTOOLS_VIEW__)
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
10
|
} catch (e) {
|
|
15
11
|
console.error("Nuxt DevTools: Failed to check parent window");
|
|
16
12
|
console.error(e);
|
|
@@ -54,3 +50,4 @@ export default defineNuxtPlugin((nuxt) => {
|
|
|
54
50
|
);
|
|
55
51
|
});
|
|
56
52
|
});
|
|
53
|
+
export default plugin;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDevframeClientContext } from "@devframes/hub/client";
|
|
2
2
|
import { NuxtDevtoolsInspectPanel } from "@nuxt/devtools/webcomponents";
|
|
3
|
-
import { getDevToolsClientContext } from "@vitejs/devtools-kit/client";
|
|
4
|
-
import { setIframeServerContext } from "@vue/devtools-kit";
|
|
5
3
|
import { createHooks } from "hookable";
|
|
6
4
|
import { debounce } from "perfect-debounce";
|
|
7
5
|
import { events as inspectorEvents, hasData as inspectorHasData, state as inspectorState } from "vite-plugin-vue-tracer/client/overlay";
|
|
8
6
|
import { computed, markRaw, nextTick, reactive, ref, shallowReactive, shallowRef, toRef, watch } from "vue";
|
|
7
|
+
import { useAppConfig } from "#imports";
|
|
9
8
|
import { initTimelineMetrics } from "../../function-metrics-helpers.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return getDevToolsClientContext();
|
|
9
|
+
const NUXT_DOCK_ANCHOR_ID = "nuxt:devtools";
|
|
10
|
+
function getDevframeContext() {
|
|
11
|
+
return getDevframeClientContext();
|
|
14
12
|
}
|
|
15
13
|
const clientRef = shallowRef();
|
|
16
14
|
export { clientRef as client };
|
|
@@ -20,7 +18,6 @@ export async function setupDevToolsClient({
|
|
|
20
18
|
timeMetric,
|
|
21
19
|
router
|
|
22
20
|
}) {
|
|
23
|
-
let iframe;
|
|
24
21
|
let inspector;
|
|
25
22
|
const colorMode = useClientColorMode();
|
|
26
23
|
const timeline = initTimelineMetrics();
|
|
@@ -28,31 +25,29 @@ export async function setupDevToolsClient({
|
|
|
28
25
|
nuxt: markRaw(nuxt),
|
|
29
26
|
hooks: createHooks(),
|
|
30
27
|
inspector: getInspectorInstance(),
|
|
31
|
-
getIframe,
|
|
32
|
-
syncClient,
|
|
33
28
|
devtools: {
|
|
34
29
|
toggle() {
|
|
35
|
-
const ctx =
|
|
30
|
+
const ctx = getDevframeContext();
|
|
36
31
|
if (ctx)
|
|
37
|
-
ctx.docks.toggleEntry(
|
|
32
|
+
ctx.docks.toggleEntry(NUXT_DOCK_ANCHOR_ID);
|
|
38
33
|
},
|
|
39
34
|
close() {
|
|
40
|
-
const ctx =
|
|
35
|
+
const ctx = getDevframeContext();
|
|
41
36
|
if (ctx)
|
|
42
|
-
ctx.panel.
|
|
37
|
+
ctx.panel.session.open = false;
|
|
43
38
|
},
|
|
44
39
|
open() {
|
|
45
|
-
const ctx =
|
|
40
|
+
const ctx = getDevframeContext();
|
|
46
41
|
if (ctx) {
|
|
47
|
-
ctx.panel.
|
|
48
|
-
ctx.docks.switchEntry(
|
|
42
|
+
ctx.panel.session.open = true;
|
|
43
|
+
ctx.docks.switchEntry(NUXT_DOCK_ANCHOR_ID);
|
|
49
44
|
}
|
|
50
45
|
},
|
|
51
46
|
async navigate(path) {
|
|
52
|
-
const ctx =
|
|
47
|
+
const ctx = getDevframeContext();
|
|
53
48
|
if (ctx) {
|
|
54
|
-
ctx.panel.
|
|
55
|
-
ctx.docks.switchEntry(
|
|
49
|
+
ctx.panel.session.open = true;
|
|
50
|
+
ctx.docks.switchEntry(NUXT_DOCK_ANCHOR_ID);
|
|
56
51
|
}
|
|
57
52
|
await client.hooks.callHook("host:action:navigate", path);
|
|
58
53
|
},
|
|
@@ -72,7 +67,6 @@ export async function setupDevToolsClient({
|
|
|
72
67
|
router.push(path);
|
|
73
68
|
},
|
|
74
69
|
colorMode,
|
|
75
|
-
frameState: state,
|
|
76
70
|
$fetch: globalThis.$fetch
|
|
77
71
|
},
|
|
78
72
|
metrics: {
|
|
@@ -84,64 +78,6 @@ export async function setupDevToolsClient({
|
|
|
84
78
|
revision: ref(0)
|
|
85
79
|
});
|
|
86
80
|
window.__NUXT_DEVTOOLS_HOST__ = client;
|
|
87
|
-
function syncClient() {
|
|
88
|
-
if (!client.inspector)
|
|
89
|
-
client.inspector = getInspectorInstance();
|
|
90
|
-
try {
|
|
91
|
-
iframe?.contentWindow?.__NUXT_DEVTOOLS_VIEW__?.setClient(client);
|
|
92
|
-
} catch (e) {
|
|
93
|
-
console.error("[nuxt-devtools] Failed to connect view", e);
|
|
94
|
-
}
|
|
95
|
-
return client;
|
|
96
|
-
}
|
|
97
|
-
function getIframe() {
|
|
98
|
-
if (!iframe) {
|
|
99
|
-
const runtimeConfig = useRuntimeConfig();
|
|
100
|
-
const CLIENT_BASE = "/__nuxt_devtools__/client";
|
|
101
|
-
const CLIENT_PATH = `${runtimeConfig.app.baseURL.replace(CLIENT_BASE, "/")}${CLIENT_BASE}`.replace(MULTIPLE_SLASHES_RE, "/");
|
|
102
|
-
const initialUrl = CLIENT_PATH + state.value.route;
|
|
103
|
-
iframe = document.createElement("iframe");
|
|
104
|
-
for (const [key, value] of Object.entries(runtimeConfig.app.devtools?.iframeProps || {}))
|
|
105
|
-
iframe.setAttribute(key, String(value));
|
|
106
|
-
iframe.id = "nuxt-devtools-iframe";
|
|
107
|
-
iframe.src = initialUrl;
|
|
108
|
-
iframe.onload = async () => {
|
|
109
|
-
try {
|
|
110
|
-
setIframeServerContext(iframe);
|
|
111
|
-
await waitForClientInjection();
|
|
112
|
-
client.syncClient();
|
|
113
|
-
} catch (e) {
|
|
114
|
-
console.error("Nuxt DevTools client injection failed");
|
|
115
|
-
console.error(e);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
return iframe;
|
|
120
|
-
}
|
|
121
|
-
function waitForClientInjection(retry = 20, timeout = 300) {
|
|
122
|
-
let lastError;
|
|
123
|
-
const test = () => {
|
|
124
|
-
try {
|
|
125
|
-
return !!iframe?.contentWindow?.__NUXT_DEVTOOLS_VIEW__;
|
|
126
|
-
} catch (e) {
|
|
127
|
-
lastError = e;
|
|
128
|
-
}
|
|
129
|
-
return false;
|
|
130
|
-
};
|
|
131
|
-
if (test())
|
|
132
|
-
return;
|
|
133
|
-
return new Promise((resolve, reject) => {
|
|
134
|
-
const interval = setInterval(() => {
|
|
135
|
-
if (test()) {
|
|
136
|
-
clearInterval(interval);
|
|
137
|
-
resolve();
|
|
138
|
-
} else if (retry-- <= 0) {
|
|
139
|
-
clearInterval(interval);
|
|
140
|
-
reject(lastError);
|
|
141
|
-
}
|
|
142
|
-
}, timeout);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
81
|
function getInspectorInstance() {
|
|
146
82
|
if (inspector)
|
|
147
83
|
return inspector;
|
|
@@ -318,7 +254,4 @@ function setupReactivity(client, router, timeMetric) {
|
|
|
318
254
|
client.nuxt.hook("app:mounted", () => {
|
|
319
255
|
refreshReactivity();
|
|
320
256
|
});
|
|
321
|
-
client.hooks.hook("devtools:navigate", (path) => {
|
|
322
|
-
state.value.route = path;
|
|
323
|
-
});
|
|
324
257
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { DEVTOOLS_MOUNT_PATH } from "@vitejs/devtools-kit/constants";
|
|
1
2
|
import { defineNuxtPlugin } from "#imports";
|
|
2
3
|
export default defineNuxtPlugin(() => {
|
|
3
|
-
|
|
4
|
+
const script = document.createElement("script");
|
|
5
|
+
script.type = "module";
|
|
6
|
+
script.src = `${DEVTOOLS_MOUNT_PATH}embedded.js`;
|
|
7
|
+
document.body.appendChild(script);
|
|
4
8
|
});
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { HookInfo } from '@nuxt/devtools/types';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface HookableLike {
|
|
3
|
+
beforeEach: (fn: (event: {
|
|
4
|
+
name: string;
|
|
5
|
+
}) => void) => void;
|
|
6
|
+
afterEach: (fn: (event: {
|
|
7
|
+
name: string;
|
|
8
|
+
}) => void) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function setupHooksDebug<T extends HookableLike>(hooks: T): Record<string, HookInfo>;
|
|
11
|
+
export {};
|