@nuxt/devtools-nightly 0.0.0 → 2.0.0-28994861.d6e2583
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/.discoveryrc.cjs +13 -0
- package/LICENSE +21 -0
- package/README.md +129 -0
- package/cli.mjs +2 -0
- package/dist/chunks/analyze-build.mjs +58 -0
- package/dist/chunks/module-main.mjs +18278 -0
- package/dist/chunks/plugin-metrics.mjs +68 -0
- package/dist/chunks/timeline.mjs +73 -0
- package/dist/chunks/vite-inspect.mjs +61 -0
- package/dist/chunks/vscode.mjs +202 -0
- package/dist/chunks/vue-devtools.mjs +18 -0
- package/dist/chunks/vue-inspector.mjs +15 -0
- package/dist/client/200.html +29 -0
- package/dist/client/404.html +29 -0
- package/dist/client/_nuxt/__blank-ld6vcstp.js +1 -0
- package/dist/client/_nuxt/acad01t0.js +17 -0
- package/dist/client/_nuxt/analyze-build-fqlgmp0b.js +1 -0
- package/dist/client/_nuxt/assets-cbko7l2l.js +16 -0
- package/dist/client/_nuxt/assets.css-hmxl533k.css +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -0
- package/dist/client/_nuxt/builds/meta/1b7ac8d3-8a5e-4fdc-9d27-275eda520648.json +1 -0
- package/dist/client/_nuxt/client-edufhzwa.js +1 -0
- package/dist/client/_nuxt/code-diff.vue-f9cnbhzc.js +8 -0
- package/dist/client/_nuxt/code-snippets.vue-lrwojb4h.js +1 -0
- package/dist/client/_nuxt/components-h5b91akq.js +1 -0
- package/dist/client/_nuxt/composable-item.vue-fdcr7ss7.js +1 -0
- package/dist/client/_nuxt/constants-b32h69zq.js +1 -0
- package/dist/client/_nuxt/custom-_name_-km7litcg.js +1 -0
- package/dist/client/_nuxt/data-schema-button.vue-mtwh5suc.js +1 -0
- package/dist/client/_nuxt/data-schema-drawer-du5ak03s.js +2 -0
- package/dist/client/_nuxt/default-jkfq6jr9.js +1 -0
- package/dist/client/_nuxt/duration-display.vue-gu7el5x3.js +1 -0
- package/dist/client/_nuxt/entry.css-jfo9gib8.css +1 -0
- package/dist/client/_nuxt/error-404-m6fhf98f.js +1 -0
- package/dist/client/_nuxt/error-404.css-fhr5m6vx.css +1 -0
- package/dist/client/_nuxt/error-500-mnjkar2r.js +1 -0
- package/dist/client/_nuxt/error-500.css-cx0169ub.css +1 -0
- package/dist/client/_nuxt/error-ljlxlkq6.js +9 -0
- package/dist/client/_nuxt/filepath-item.vue-jteqhbym.js +1 -0
- package/dist/client/_nuxt/full-fmvt90u3.js +1 -0
- package/dist/client/_nuxt/help-fab.css-ms50khsu.css +1 -0
- package/dist/client/_nuxt/help-fab.vue-l8z6nz69.js +1 -0
- package/dist/client/_nuxt/hooks-l6hy41d5.js +1 -0
- package/dist/client/_nuxt/imports-djs3fv7k.js +1 -0
- package/dist/client/_nuxt/index-isy4x1zk.js +1 -0
- package/dist/client/_nuxt/index-obsucz0g.js +1 -0
- package/dist/client/_nuxt/launch-page.vue-m36wh07r.js +1 -0
- package/dist/client/_nuxt/modules-eqx4mvkj.js +1 -0
- package/dist/client/_nuxt/nbadge-iie5ebea.js +1 -0
- package/dist/client/_nuxt/ncheckbox.vue-hsio0xo0.js +1 -0
- package/dist/client/_nuxt/ncode-block.css-lvdc77tw.css +1 -0
- package/dist/client/_nuxt/ncode-block.vue-msaaoy71.js +2 -0
- package/dist/client/_nuxt/ndrawer.vue-lxe9449e.js +1 -0
- package/dist/client/_nuxt/ndropdown.vue-fg4qqvpn.js +1 -0
- package/dist/client/_nuxt/nicon-title.vue-j1ceohu1.js +1 -0
- package/dist/client/_nuxt/nlink.vue-h4d6zo87.js +1 -0
- package/dist/client/_nuxt/nmarkdown.vue-oxfi26vk.js +1 -0
- package/dist/client/_nuxt/nnavbar.vue-m6cf24fa.js +1 -0
- package/dist/client/_nuxt/none-w92i5kpk.js +1 -0
- package/dist/client/_nuxt/nsection-block-j4awv0k4.js +1 -0
- package/dist/client/_nuxt/nsection-block.css-e7kbjm7k.css +1 -0
- package/dist/client/_nuxt/nselect-tabs.vue-m7y9xr5j.js +1 -0
- package/dist/client/_nuxt/nselect.vue-ns9nms6j.js +1 -0
- package/dist/client/_nuxt/nswitch.vue-l8xqfho0.js +1 -0
- package/dist/client/_nuxt/open-graph-kkdf0nia.js +3 -0
- package/dist/client/_nuxt/open-graph.css-e21qzmvj.css +1 -0
- package/dist/client/_nuxt/overview-hdsksmkk.js +1 -0
- package/dist/client/_nuxt/pages-ksiceycf.js +1 -0
- package/dist/client/_nuxt/payload-lv00tqsw.js +1 -0
- package/dist/client/_nuxt/pinia-ixzbsb3t.js +1 -0
- package/dist/client/_nuxt/plugins-mpy2qpq3.js +1 -0
- package/dist/client/_nuxt/render-tree-ci9wg23h.js +1 -0
- package/dist/client/_nuxt/runtime-configs-nrwa1kqq.js +1 -0
- package/dist/client/_nuxt/server-discovery-nynjnb91.js +1 -0
- package/dist/client/_nuxt/server-route-inputs.vue-hjq5i7um.js +1 -0
- package/dist/client/_nuxt/server-routes-ni4dketr.js +9 -0
- package/dist/client/_nuxt/server-tasks-h63b0d8g.js +1 -0
- package/dist/client/_nuxt/settings-pd1b5hup.js +1 -0
- package/dist/client/_nuxt/stacktrace-list.vue-i09nx4tx.js +1 -0
- package/dist/client/_nuxt/state-components-krs67u9s.js +1 -0
- package/dist/client/_nuxt/state-editor.vue-ji5p8iwi.js +1 -0
- package/dist/client/_nuxt/state-modules-jr1gc8aq.js +1 -0
- package/dist/client/_nuxt/storage-o8ue9npr.js +1 -0
- package/dist/client/_nuxt/terminals-n14qkg4d.js +1 -0
- package/dist/client/_nuxt/terminals.css-mejv43xm.css +1 -0
- package/dist/client/_nuxt/timeline-fhd8y3t4.js +31 -0
- package/dist/client/_nuxt/timeline.css-lhkpu01p.css +1 -0
- package/dist/client/_nuxt/unocss-runtime-gc1hqonm.js +1 -0
- package/dist/client/_nuxt/vendor/json-editor-vue-npezbdce.js +3818 -0
- package/dist/client/_nuxt/vendor/json-editor-vue.css-mqq5uooj.css +1 -0
- package/dist/client/_nuxt/vendor/markdown-it-fvu08dbs.js +16 -0
- package/dist/client/_nuxt/vendor/quicktype-core-i8ym98gu.js +1006 -0
- package/dist/client/_nuxt/vendor/shiki-du3ou1on.js +282 -0
- package/dist/client/_nuxt/vendor/unocss-hjqyvvq7.js +2 -0
- package/dist/client/_nuxt/vendor/unocss.css-mhvipxpl.css +1 -0
- package/dist/client/_nuxt/vendor/vis-fzckz0r6.js +98 -0
- package/dist/client/_nuxt/vendor/xterm-b1jefe3j.js +9 -0
- package/dist/client/_nuxt/vendor/xterm.css-egmhki83.css +32 -0
- package/dist/client/_nuxt/virtual-files-co0rkquj.js +1 -0
- package/dist/client/_nuxt/virtual-files.css-gqpg2wnb.css +1 -0
- package/dist/client/_nuxt/vue-devtools-hmost1g2.js +2 -0
- package/dist/client/_nuxt/vue-virtual-scroller.esm-guzt9iin.js +2 -0
- package/dist/client/discovery/index.html +611 -0
- package/dist/client/index.html +29 -0
- package/dist/client/nuxt.svg +3 -0
- package/dist/dirs.d.mts +7 -0
- package/dist/dirs.d.ts +7 -0
- package/dist/dirs.mjs +28 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +9 -0
- package/dist/module.d.ts +9 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +6 -0
- package/dist/runtime/auth/index.html +76 -0
- package/dist/runtime/function-metrics-helpers.d.ts +3 -0
- package/dist/runtime/function-metrics-helpers.js +69 -0
- package/dist/runtime/nitro/inline.d.ts +3 -0
- package/dist/runtime/nitro/inline.js +6 -0
- package/dist/runtime/plugins/devtools.client.d.ts +2 -0
- package/dist/runtime/plugins/devtools.client.js +56 -0
- package/dist/runtime/plugins/devtools.server.d.ts +2 -0
- package/dist/runtime/plugins/devtools.server.js +7 -0
- package/dist/runtime/plugins/view/FrameBox.vue +167 -0
- package/dist/runtime/plugins/view/Main.vue +415 -0
- package/dist/runtime/plugins/view/client.d.ts +12 -0
- package/dist/runtime/plugins/view/client.js +335 -0
- package/dist/runtime/plugins/view/state.d.ts +5 -0
- package/dist/runtime/plugins/view/state.js +17 -0
- package/dist/runtime/plugins/view/utils.d.ts +31 -0
- package/dist/runtime/plugins/view/utils.js +156 -0
- package/dist/runtime/settings.d.ts +4 -0
- package/dist/runtime/settings.js +2 -0
- package/dist/runtime/shared/hooks.d.ts +2 -0
- package/dist/runtime/shared/hooks.js +33 -0
- package/dist/runtime/use-nuxt-devtools.d.ts +8 -0
- package/dist/runtime/use-nuxt-devtools.js +23 -0
- package/dist/runtime/vue-devtools-client.d.ts +2 -0
- package/dist/runtime/vue-devtools-client.js +8 -0
- package/dist/shared/devtools-nightly.2e078e30.d.mts +66 -0
- package/dist/shared/devtools-nightly.2e078e30.d.ts +66 -0
- package/dist/shared/devtools-nightly.60b2ba4d.mjs +122 -0
- package/dist/types.d.mts +42 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.mjs +1 -0
- package/package.json +128 -2
- package/types.d.ts +1 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
function setup({ nuxt }) {
|
|
2
|
+
if (!nuxt.options.dev || nuxt.options.test)
|
|
3
|
+
return;
|
|
4
|
+
nuxt.hook("app:templates", (app) => {
|
|
5
|
+
app.templates.filter((i) => i.filename?.startsWith("plugins/")).forEach((i) => {
|
|
6
|
+
if (!i.getContents)
|
|
7
|
+
return;
|
|
8
|
+
const original = i.getContents;
|
|
9
|
+
i.getContents = async (...args) => {
|
|
10
|
+
let content = await original(...args);
|
|
11
|
+
const PAYLOAD_KEY = "__NUXT_DEVTOOLS_PLUGINS_METRIC__";
|
|
12
|
+
const WRAPPER_KEY = "__DEVTOOLS_WRAPPER__";
|
|
13
|
+
if (content.includes(PAYLOAD_KEY))
|
|
14
|
+
return content;
|
|
15
|
+
const snippets = `
|
|
16
|
+
if (!globalThis.${PAYLOAD_KEY}) {
|
|
17
|
+
Object.defineProperty(globalThis, '${PAYLOAD_KEY}', {
|
|
18
|
+
value: [],
|
|
19
|
+
enumerable: false,
|
|
20
|
+
configurable: true,
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function ${WRAPPER_KEY} (plugin, src) {
|
|
25
|
+
if (!plugin)
|
|
26
|
+
return plugin
|
|
27
|
+
|
|
28
|
+
return defineNuxtPlugin({
|
|
29
|
+
...plugin,
|
|
30
|
+
async setup (...args) {
|
|
31
|
+
const start = performance.now()
|
|
32
|
+
const result = await plugin.apply(this, args)
|
|
33
|
+
const end = performance.now()
|
|
34
|
+
globalThis.${PAYLOAD_KEY}.push({
|
|
35
|
+
src,
|
|
36
|
+
start,
|
|
37
|
+
end,
|
|
38
|
+
duration: end - start,
|
|
39
|
+
})
|
|
40
|
+
return result
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
const imports = Array.from(content.matchAll(/(?:\n|^)import (.*) from ['"](.*)['"]/g)).map(([, name, path]) => ({ name, path }));
|
|
46
|
+
content = content.replace(/\nexport default\s*\[([\s\S]*)\]/, (_, itemsRaw) => {
|
|
47
|
+
const items = itemsRaw.split(",").map((i2) => i2.trim()).map((i2) => {
|
|
48
|
+
const importItem = imports.find(({ name }) => name === i2);
|
|
49
|
+
if (!importItem)
|
|
50
|
+
return i2;
|
|
51
|
+
return `${WRAPPER_KEY}(${i2}, ${JSON.stringify(importItem.path)})`;
|
|
52
|
+
});
|
|
53
|
+
return `
|
|
54
|
+
${snippets}
|
|
55
|
+
export default [
|
|
56
|
+
${items.join(",\n")}
|
|
57
|
+
]
|
|
58
|
+
`;
|
|
59
|
+
});
|
|
60
|
+
content = `import { defineNuxtPlugin } from "#imports"
|
|
61
|
+
${content}`;
|
|
62
|
+
return content;
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { setup };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { resolve } from 'pathe';
|
|
2
|
+
import semver from 'semver';
|
|
3
|
+
import { runtimeDir } from '../dirs.mjs';
|
|
4
|
+
import 'node:path';
|
|
5
|
+
import 'node:url';
|
|
6
|
+
import 'is-installed-globally';
|
|
7
|
+
|
|
8
|
+
function setup({ nuxt, options }) {
|
|
9
|
+
const helperPath = resolve(runtimeDir, "function-metrics-helpers");
|
|
10
|
+
const includeFrom = options.timeline?.functions?.includeFrom || [
|
|
11
|
+
"#app",
|
|
12
|
+
"@unhead/vue"
|
|
13
|
+
];
|
|
14
|
+
const include = options.timeline?.functions?.include || [
|
|
15
|
+
(i) => includeFrom.includes(i.from),
|
|
16
|
+
(i) => i.from.includes("composables")
|
|
17
|
+
];
|
|
18
|
+
const exclude = options.timeline?.functions?.exclude || [
|
|
19
|
+
/^define[A-Z]/
|
|
20
|
+
];
|
|
21
|
+
function filter(item) {
|
|
22
|
+
if (item.type)
|
|
23
|
+
return false;
|
|
24
|
+
const name = item.as || item.name;
|
|
25
|
+
if (!include.some((f) => typeof f === "function" ? f(item) : typeof f === "string" ? name === f : f.test(name)))
|
|
26
|
+
return false;
|
|
27
|
+
if (exclude.some((f) => typeof f === "function" ? f(item) : typeof f === "string" ? name === f : f.test(name)))
|
|
28
|
+
return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
nuxt.hook("imports:context", (unimport) => {
|
|
32
|
+
const ctx = unimport.getInternalContext();
|
|
33
|
+
if (!ctx.version || !semver.gte(ctx.version, "3.1.0"))
|
|
34
|
+
throw new Error(`[Nuxt DevTools] The timeline feature requires \`unimport\` >= v3.1.0, but got \`${ctx.version || "(unknown)"}\`. Please upgrade using \`nuxi upgrade --force\`.`);
|
|
35
|
+
ctx.addons.push(
|
|
36
|
+
{
|
|
37
|
+
injectImportsResolved(imports, _code, id) {
|
|
38
|
+
if (id?.includes("?macro=true"))
|
|
39
|
+
return;
|
|
40
|
+
return imports.map((i) => {
|
|
41
|
+
if (!filter(i))
|
|
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
|
+
}
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { setup };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { addCustomTab } from '@nuxt/devtools-kit';
|
|
2
|
+
import { addVitePlugin } from '@nuxt/kit';
|
|
3
|
+
|
|
4
|
+
async function createVitePluginInspect(options) {
|
|
5
|
+
return await import('vite-plugin-inspect').then((r) => r.default(options));
|
|
6
|
+
}
|
|
7
|
+
async function setup({ nuxt, rpc }) {
|
|
8
|
+
const plugin = await createVitePluginInspect();
|
|
9
|
+
addVitePlugin(plugin);
|
|
10
|
+
let api;
|
|
11
|
+
nuxt.hook("vite:serverCreated", () => {
|
|
12
|
+
api = plugin.api;
|
|
13
|
+
});
|
|
14
|
+
addCustomTab(() => ({
|
|
15
|
+
name: "builtin-vite-inspect",
|
|
16
|
+
title: "Inspect",
|
|
17
|
+
icon: "carbon-ibm-watson-discovery",
|
|
18
|
+
category: "advanced",
|
|
19
|
+
view: {
|
|
20
|
+
type: "iframe",
|
|
21
|
+
src: `${nuxt.options.app.baseURL}${nuxt.options.app.buildAssetsDir}/__inspect/`.replace(/\/\//g, "/")
|
|
22
|
+
}
|
|
23
|
+
}), nuxt);
|
|
24
|
+
async function getComponentsRelationships() {
|
|
25
|
+
const meta = await api?.rpc.getMetadata();
|
|
26
|
+
const modules = (meta ? await api?.rpc.getModulesList({
|
|
27
|
+
vite: meta?.instances[0].vite,
|
|
28
|
+
env: meta?.instances[0].environments[0]
|
|
29
|
+
}) : null) || [];
|
|
30
|
+
const components = await rpc.functions.getComponents() || [];
|
|
31
|
+
const vueModules = modules.filter((m) => {
|
|
32
|
+
const plainId = m.id.replace(/\?v=\w+$/, "");
|
|
33
|
+
if (components.some((c) => c.filePath === plainId))
|
|
34
|
+
return true;
|
|
35
|
+
return m.id.match(/\.vue($|\?v=)/);
|
|
36
|
+
});
|
|
37
|
+
const graph = vueModules.map((i) => {
|
|
38
|
+
function searchForVueDeps(id, seen = /* @__PURE__ */ new Set()) {
|
|
39
|
+
if (seen.has(id))
|
|
40
|
+
return [];
|
|
41
|
+
seen.add(id);
|
|
42
|
+
const module = modules.find((m) => m.id === id);
|
|
43
|
+
if (!module)
|
|
44
|
+
return [];
|
|
45
|
+
return module.deps.flatMap((i2) => {
|
|
46
|
+
if (vueModules.find((m) => m.id === i2))
|
|
47
|
+
return [i2];
|
|
48
|
+
return searchForVueDeps(i2, seen);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
id: i.id,
|
|
53
|
+
deps: searchForVueDeps(i.id)
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
return graph;
|
|
57
|
+
}
|
|
58
|
+
rpc.functions.getComponentsRelationships = getComponentsRelationships;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { createVitePluginInspect, setup };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import fsp from 'node:fs/promises';
|
|
3
|
+
import { hostname } from 'node:os';
|
|
4
|
+
import { resolve } from 'node:path';
|
|
5
|
+
import { startSubprocess } from '@nuxt/devtools-kit';
|
|
6
|
+
import { logger } from '@nuxt/kit';
|
|
7
|
+
import { execa } from 'execa';
|
|
8
|
+
import { checkPort, getPort } from 'get-port-please';
|
|
9
|
+
import which from 'which';
|
|
10
|
+
import { L as LOG_PREFIX } from './module-main.mjs';
|
|
11
|
+
import 'consola/utils';
|
|
12
|
+
import 'pathe';
|
|
13
|
+
import 'sirv';
|
|
14
|
+
import 'vite';
|
|
15
|
+
import '../shared/devtools-nightly.60b2ba4d.mjs';
|
|
16
|
+
import '../dirs.mjs';
|
|
17
|
+
import 'node:url';
|
|
18
|
+
import 'is-installed-globally';
|
|
19
|
+
import 'ohash';
|
|
20
|
+
import 'birpc';
|
|
21
|
+
import 'structured-clone-es';
|
|
22
|
+
import 'simple-git';
|
|
23
|
+
import 'tinyglobby';
|
|
24
|
+
import 'image-meta';
|
|
25
|
+
import 'perfect-debounce';
|
|
26
|
+
import 'destr';
|
|
27
|
+
import '../../dist/runtime/shared/hooks.js';
|
|
28
|
+
import 'node:process';
|
|
29
|
+
import 'node:module';
|
|
30
|
+
import 'pkg-types';
|
|
31
|
+
import 'node:assert';
|
|
32
|
+
import 'node:v8';
|
|
33
|
+
import 'node:util';
|
|
34
|
+
import 'os';
|
|
35
|
+
import 'path';
|
|
36
|
+
import 'util';
|
|
37
|
+
import 'stream';
|
|
38
|
+
import 'events';
|
|
39
|
+
import 'fs';
|
|
40
|
+
import 'local-pkg';
|
|
41
|
+
import 'magicast';
|
|
42
|
+
import 'magicast/helpers';
|
|
43
|
+
import 'nypm';
|
|
44
|
+
import 'semver';
|
|
45
|
+
|
|
46
|
+
const codeBinaryOptions = {
|
|
47
|
+
"ms-code-cli": {
|
|
48
|
+
codeBinary: "code",
|
|
49
|
+
launchArg: "serve-web",
|
|
50
|
+
licenseTermsArg: "--accept-server-license-terms",
|
|
51
|
+
connectionTokenArg: "--without-connection-token"
|
|
52
|
+
},
|
|
53
|
+
"ms-code-server": {
|
|
54
|
+
codeBinary: "code-server",
|
|
55
|
+
launchArg: "serve-local",
|
|
56
|
+
licenseTermsArg: "--accept-server-license-terms",
|
|
57
|
+
connectionTokenArg: "--without-connection-token"
|
|
58
|
+
},
|
|
59
|
+
"coder-code-server": {
|
|
60
|
+
codeBinary: "code-server",
|
|
61
|
+
launchArg: "serve-local",
|
|
62
|
+
licenseTermsArg: "",
|
|
63
|
+
connectionTokenArg: ""
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
async function setup({ nuxt, options, openInEditorHooks, rpc }) {
|
|
67
|
+
const vsOptions = options?.vscode || {};
|
|
68
|
+
const codeServer = vsOptions?.codeServer || "ms-code-server";
|
|
69
|
+
const { codeBinary, launchArg, licenseTermsArg, connectionTokenArg } = codeBinaryOptions[codeServer];
|
|
70
|
+
const installed = !!await which(codeBinary).catch(() => null);
|
|
71
|
+
let port = vsOptions?.port || 3080;
|
|
72
|
+
let url = `http://localhost:${port}`;
|
|
73
|
+
const host = vsOptions?.host ? `--host=${vsOptions.host}` : "--host=127.0.0.1";
|
|
74
|
+
let loaded = false;
|
|
75
|
+
let promise = null;
|
|
76
|
+
const mode = vsOptions?.mode || "local-serve";
|
|
77
|
+
const computerHostName = vsOptions.tunnel?.name || hostname().split(".").join("");
|
|
78
|
+
const root = nuxt.options.rootDir;
|
|
79
|
+
const vscodeServerControllerFile = resolve(root, ".vscode", ".server-controller-port.log");
|
|
80
|
+
openInEditorHooks.push(async (file) => {
|
|
81
|
+
if (!existsSync(vscodeServerControllerFile))
|
|
82
|
+
return false;
|
|
83
|
+
try {
|
|
84
|
+
const { port: port2 } = JSON.parse(await fsp.readFile(vscodeServerControllerFile, "utf-8"));
|
|
85
|
+
const url2 = `http://localhost:${port2}/open?path=${encodeURIComponent(`${root}/${file}`)}`;
|
|
86
|
+
await fetch(url2);
|
|
87
|
+
rpc.broadcast.navigateTo("/modules/custom-builtin-vscode");
|
|
88
|
+
return true;
|
|
89
|
+
} catch (e) {
|
|
90
|
+
console.debug(`Failed to open file "${file}" in VS Code Server`);
|
|
91
|
+
console.debug(e);
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
async function startCodeServer() {
|
|
96
|
+
if (existsSync(vscodeServerControllerFile))
|
|
97
|
+
await fsp.rm(vscodeServerControllerFile, { force: true });
|
|
98
|
+
if (vsOptions?.reuseExistingServer && !await checkPort(port)) {
|
|
99
|
+
loaded = true;
|
|
100
|
+
url = `http://localhost:${port}/?folder=${encodeURIComponent(root)}`;
|
|
101
|
+
logger.info(LOG_PREFIX, `Existing VS Code Server found at port ${port}...`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
port = await getPort({ port });
|
|
105
|
+
url = `http://localhost:${port}/?folder=${encodeURIComponent(root)}`;
|
|
106
|
+
logger.info(LOG_PREFIX, `Starting VS Code Server at ${url} ...`);
|
|
107
|
+
execa(codeBinary, [
|
|
108
|
+
"--install-extension",
|
|
109
|
+
"antfu.vscode-server-controller"
|
|
110
|
+
], { stderr: "inherit", stdout: "ignore", reject: false });
|
|
111
|
+
startSubprocess(
|
|
112
|
+
{
|
|
113
|
+
command: codeBinary,
|
|
114
|
+
args: [
|
|
115
|
+
launchArg,
|
|
116
|
+
licenseTermsArg,
|
|
117
|
+
connectionTokenArg,
|
|
118
|
+
`--port=${port}`,
|
|
119
|
+
host
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "devtools:vscode",
|
|
124
|
+
name: "VS Code Server",
|
|
125
|
+
icon: "logos-visual-studio-code"
|
|
126
|
+
},
|
|
127
|
+
nuxt
|
|
128
|
+
);
|
|
129
|
+
for (let i = 0; i < 100; i++) {
|
|
130
|
+
if (await fetch(url).then((r) => r.ok).catch(() => false))
|
|
131
|
+
break;
|
|
132
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
133
|
+
}
|
|
134
|
+
await new Promise((resolve2) => setTimeout(resolve2, 2e3));
|
|
135
|
+
loaded = true;
|
|
136
|
+
}
|
|
137
|
+
async function startCodeTunnel() {
|
|
138
|
+
const { stdout: currentDir } = await execa("pwd");
|
|
139
|
+
url = `https://vscode.dev/tunnel/${computerHostName}${currentDir}`;
|
|
140
|
+
logger.info(LOG_PREFIX, `Starting VS Code tunnel at ${url} ...`);
|
|
141
|
+
const command = execa("code", [
|
|
142
|
+
"tunnel",
|
|
143
|
+
"--accept-server-license-terms",
|
|
144
|
+
"--name",
|
|
145
|
+
`${computerHostName}`
|
|
146
|
+
]);
|
|
147
|
+
command.stderr?.pipe(process.stderr);
|
|
148
|
+
command.stdout?.pipe(process.stdout);
|
|
149
|
+
nuxt.hook("close", () => {
|
|
150
|
+
command.kill();
|
|
151
|
+
});
|
|
152
|
+
for (let i = 0; i < 100; i++) {
|
|
153
|
+
if (await fetch(url).then((r) => r.ok).catch(() => false))
|
|
154
|
+
break;
|
|
155
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
156
|
+
}
|
|
157
|
+
await new Promise((resolve2) => setTimeout(resolve2, 2e3));
|
|
158
|
+
loaded = true;
|
|
159
|
+
}
|
|
160
|
+
async function start() {
|
|
161
|
+
if (mode === "tunnel")
|
|
162
|
+
await startCodeTunnel();
|
|
163
|
+
else
|
|
164
|
+
await startCodeServer();
|
|
165
|
+
}
|
|
166
|
+
nuxt.hook("devtools:customTabs", (tabs) => {
|
|
167
|
+
tabs.push({
|
|
168
|
+
name: "builtin-vscode",
|
|
169
|
+
title: "VS Code",
|
|
170
|
+
icon: "bxl-visual-studio",
|
|
171
|
+
category: "modules",
|
|
172
|
+
requireAuth: true,
|
|
173
|
+
view: !installed && !(vsOptions?.mode === "tunnel") ? {
|
|
174
|
+
type: "launch",
|
|
175
|
+
title: "Install VS Code Server",
|
|
176
|
+
description: `It seems you don't have code-server installed.
|
|
177
|
+
|
|
178
|
+
Learn more about it with <a href="https://code.visualstudio.com/blogs/2022/07/07/vscode-server" target="_blank">this guide</a>.
|
|
179
|
+
Once installed, restart Nuxt and visit this tab again.`,
|
|
180
|
+
actions: []
|
|
181
|
+
} : !loaded ? {
|
|
182
|
+
type: "launch",
|
|
183
|
+
description: "Launch VS Code right in the devtools!",
|
|
184
|
+
actions: [{
|
|
185
|
+
label: promise ? "Starting..." : "Launch",
|
|
186
|
+
pending: !!promise,
|
|
187
|
+
handle: () => {
|
|
188
|
+
promise = promise || start();
|
|
189
|
+
return promise;
|
|
190
|
+
}
|
|
191
|
+
}]
|
|
192
|
+
} : {
|
|
193
|
+
type: "iframe",
|
|
194
|
+
src: url
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
if (vsOptions?.startOnBoot)
|
|
199
|
+
promise = promise || start();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export { setup };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { addPluginTemplate, resolvePath } from '@nuxt/kit';
|
|
2
|
+
import { join } from 'pathe';
|
|
3
|
+
import { runtimeDir } from '../dirs.mjs';
|
|
4
|
+
import 'node:path';
|
|
5
|
+
import 'node:url';
|
|
6
|
+
import 'is-installed-globally';
|
|
7
|
+
|
|
8
|
+
async function setup({ nuxt }) {
|
|
9
|
+
if (!nuxt.options.dev || nuxt.options.test)
|
|
10
|
+
return;
|
|
11
|
+
addPluginTemplate({
|
|
12
|
+
name: "vue-devtools-client",
|
|
13
|
+
mode: "client",
|
|
14
|
+
src: await resolvePath(join(runtimeDir, "vue-devtools-client"))
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { setup };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { addVitePlugin } from '@nuxt/kit';
|
|
2
|
+
import VueInspector from 'vite-plugin-vue-inspector';
|
|
3
|
+
|
|
4
|
+
function setup({ nuxt, options }) {
|
|
5
|
+
if (!nuxt.options.dev || nuxt.options.test)
|
|
6
|
+
return;
|
|
7
|
+
addVitePlugin(VueInspector({
|
|
8
|
+
toggleComboKey: "",
|
|
9
|
+
...typeof options.componentInspector === "boolean" ? {} : options.componentInspector,
|
|
10
|
+
appendTo: /\/entry\.m?js$/,
|
|
11
|
+
toggleButtonVisibility: "never"
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { setup };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html><html data-capo=""><head><meta charset="utf-8">
|
|
2
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
3
|
+
<link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/entry.css-jfo9gib8.css" crossorigin>
|
|
4
|
+
<link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue.css-mqq5uooj.css" crossorigin>
|
|
5
|
+
<link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss.css-mhvipxpl.css" crossorigin>
|
|
6
|
+
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/acad01t0.js">
|
|
7
|
+
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue-npezbdce.js">
|
|
8
|
+
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss-hjqyvvq7.js">
|
|
9
|
+
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/shiki-du3ou1on.js">
|
|
10
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/markdown-it-fvu08dbs.js">
|
|
11
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/default-jkfq6jr9.js">
|
|
12
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/full-fmvt90u3.js">
|
|
13
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/none-w92i5kpk.js">
|
|
14
|
+
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/ncode-block.css-lvdc77tw.css">
|
|
15
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/data-schema-drawer-du5ak03s.js">
|
|
16
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/nselect.vue-ns9nms6j.js">
|
|
17
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/nswitch.vue-l8xqfho0.js">
|
|
18
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/ndropdown.vue-fg4qqvpn.js">
|
|
19
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/ncode-block.vue-msaaoy71.js">
|
|
20
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/client-edufhzwa.js">
|
|
21
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/ndrawer.vue-lxe9449e.js">
|
|
22
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/quicktype-core-i8ym98gu.js">
|
|
23
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/unocss-runtime-gc1hqonm.js">
|
|
24
|
+
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404.css-fhr5m6vx.css">
|
|
25
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404-m6fhf98f.js">
|
|
26
|
+
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500.css-cx0169ub.css">
|
|
27
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500-mnjkar2r.js">
|
|
28
|
+
<script type="module" src="/__NUXT_DEVTOOLS_BASE__/_nuxt/acad01t0.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1739691684545,false]</script>
|
|
29
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_BASE__/",buildId:"1b7ac8d3-8a5e-4fdc-9d27-275eda520648",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html><html data-capo=""><head><meta charset="utf-8">
|
|
2
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
3
|
+
<link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/entry.css-jfo9gib8.css" crossorigin>
|
|
4
|
+
<link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue.css-mqq5uooj.css" crossorigin>
|
|
5
|
+
<link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss.css-mhvipxpl.css" crossorigin>
|
|
6
|
+
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/acad01t0.js">
|
|
7
|
+
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue-npezbdce.js">
|
|
8
|
+
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss-hjqyvvq7.js">
|
|
9
|
+
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/shiki-du3ou1on.js">
|
|
10
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/markdown-it-fvu08dbs.js">
|
|
11
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/default-jkfq6jr9.js">
|
|
12
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/full-fmvt90u3.js">
|
|
13
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/none-w92i5kpk.js">
|
|
14
|
+
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/ncode-block.css-lvdc77tw.css">
|
|
15
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/data-schema-drawer-du5ak03s.js">
|
|
16
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/nselect.vue-ns9nms6j.js">
|
|
17
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/nswitch.vue-l8xqfho0.js">
|
|
18
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/ndropdown.vue-fg4qqvpn.js">
|
|
19
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/ncode-block.vue-msaaoy71.js">
|
|
20
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/client-edufhzwa.js">
|
|
21
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/ndrawer.vue-lxe9449e.js">
|
|
22
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/quicktype-core-i8ym98gu.js">
|
|
23
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/unocss-runtime-gc1hqonm.js">
|
|
24
|
+
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404.css-fhr5m6vx.css">
|
|
25
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404-m6fhf98f.js">
|
|
26
|
+
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500.css-cx0169ub.css">
|
|
27
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500-mnjkar2r.js">
|
|
28
|
+
<script type="module" src="/__NUXT_DEVTOOLS_BASE__/_nuxt/acad01t0.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1739691684546,false]</script>
|
|
29
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_BASE__/",buildId:"1b7ac8d3-8a5e-4fdc-9d27-275eda520648",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e,W as n,U as t}from"./vendor/json-editor-vue-npezbdce.js";const c={"h-screen":"","w-screen":"","bg-black":""},r=e({__name:"__blank",setup(o){return(s,_)=>(t(),n("div",c))}});export{r as default};
|