@oro.ad/nuxt-claude-devtools-bc 1.0.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.md +674 -0
- package/README.md +227 -0
- package/dist/client/200.html +1 -0
- package/dist/client/404.html +1 -0
- package/dist/client/_nuxt/BkeABxse.js +1 -0
- package/dist/client/_nuxt/D_J0GzWk.js +9 -0
- package/dist/client/_nuxt/Kn4Iaa8g.js +1 -0
- package/dist/client/_nuxt/N02BnA5h.js +4 -0
- package/dist/client/_nuxt/W-9jjdUG.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -0
- package/dist/client/_nuxt/builds/meta/b0257768-6ba6-4f04-9da1-ec8a65a9539b.json +1 -0
- package/dist/client/_nuxt/entry.DbfI69ZY.css +1 -0
- package/dist/client/_nuxt/error-404.BLrjNXsr.css +1 -0
- package/dist/client/_nuxt/error-500.DLkAwcfL.css +1 -0
- package/dist/client/_nuxt/nSemZUqJ.js +1 -0
- package/dist/client/index.html +1 -0
- package/dist/module.d.mts +77 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +144 -0
- package/dist/runtime/composables/useTunnel.d.ts +12 -0
- package/dist/runtime/composables/useTunnel.js +12 -0
- package/dist/runtime/plugin.d.ts +12 -0
- package/dist/runtime/plugin.js +20 -0
- package/dist/runtime/server/api/__claude-devtools-bc-config.get.d.ts +2 -0
- package/dist/runtime/server/api/__claude-devtools-bc-config.get.js +12 -0
- package/dist/types.d.mts +3 -0
- package/package.json +74 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
|
|
3
|
+
interface TunnelConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Tunnel host (without protocol)
|
|
6
|
+
* @default process.env.DEV_TUNNEL_HOST
|
|
7
|
+
*/
|
|
8
|
+
host?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Protocol for tunnel connection
|
|
11
|
+
* @default 'https'
|
|
12
|
+
*/
|
|
13
|
+
protocol?: 'http' | 'https';
|
|
14
|
+
/**
|
|
15
|
+
* Port for HMR WebSocket
|
|
16
|
+
* @default 443 for https, 80 for http
|
|
17
|
+
*/
|
|
18
|
+
port?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Additional allowed hosts for Vite server
|
|
21
|
+
* @default []
|
|
22
|
+
*/
|
|
23
|
+
additionalHosts?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Enable/disable tunnel configuration
|
|
26
|
+
* @default true (but only applies config if host is set)
|
|
27
|
+
*/
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface ModuleOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Tunnel configuration for dev server
|
|
33
|
+
*/
|
|
34
|
+
tunnel?: TunnelConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Enable Nuxt Devtools integration
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
devtools?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Disable Nuxt DevTools authorization when tunnel is active.
|
|
42
|
+
* Required for accessing DevTools through tunnel.
|
|
43
|
+
* @default true (auto-disables auth when tunnel is configured)
|
|
44
|
+
*/
|
|
45
|
+
disableDevtoolsAuth?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface ResolvedTunnelConfig {
|
|
48
|
+
host: string;
|
|
49
|
+
protocol: 'http' | 'https';
|
|
50
|
+
port: number;
|
|
51
|
+
wsProtocol: 'ws' | 'wss';
|
|
52
|
+
origin: string;
|
|
53
|
+
allowedHosts: string[];
|
|
54
|
+
}
|
|
55
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
56
|
+
|
|
57
|
+
declare module '@nuxt/schema' {
|
|
58
|
+
interface NuxtConfig {
|
|
59
|
+
claudeDevtoolsBc?: ModuleOptions;
|
|
60
|
+
}
|
|
61
|
+
interface NuxtOptions {
|
|
62
|
+
claudeDevtoolsBc?: ModuleOptions;
|
|
63
|
+
}
|
|
64
|
+
interface PublicRuntimeConfig {
|
|
65
|
+
claudeDevtoolsBc?: {
|
|
66
|
+
tunnel: {
|
|
67
|
+
host: string;
|
|
68
|
+
protocol: 'http' | 'https';
|
|
69
|
+
port: number;
|
|
70
|
+
origin: string;
|
|
71
|
+
} | null;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { _default as default };
|
|
77
|
+
export type { ModuleOptions, ResolvedTunnelConfig, TunnelConfig };
|
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { useLogger, defineNuxtModule, createResolver, addPlugin, addImports, addServerHandler } from '@nuxt/kit';
|
|
2
|
+
import { defu } from 'defu';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
const DEVTOOLS_UI_ROUTE = "/__claude-devtools-bc";
|
|
6
|
+
const DEVTOOLS_UI_LOCAL_PORT = 3300;
|
|
7
|
+
function setupDevToolsUI(nuxt, resolver, tunnelConfig) {
|
|
8
|
+
const clientPath = resolver.resolve("./client");
|
|
9
|
+
const isProductionBuild = existsSync(clientPath);
|
|
10
|
+
if (isProductionBuild) {
|
|
11
|
+
nuxt.hook("vite:serverCreated", async (server) => {
|
|
12
|
+
const sirv = await import('sirv').then((r) => r.default || r);
|
|
13
|
+
server.middlewares.use(
|
|
14
|
+
DEVTOOLS_UI_ROUTE,
|
|
15
|
+
sirv(clientPath, { dev: true, single: true })
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
nuxt.hook("vite:extendConfig", (config) => {
|
|
20
|
+
config.server = config.server || {};
|
|
21
|
+
config.server.proxy = config.server.proxy || {};
|
|
22
|
+
config.server.proxy[DEVTOOLS_UI_ROUTE] = {
|
|
23
|
+
target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`,
|
|
24
|
+
changeOrigin: true,
|
|
25
|
+
followRedirects: true,
|
|
26
|
+
rewrite: (path) => path.replace(DEVTOOLS_UI_ROUTE, "")
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const isTunnelActive = tunnelConfig !== null;
|
|
31
|
+
nuxt.hook("devtools:customTabs", (tabs) => {
|
|
32
|
+
tabs.push({
|
|
33
|
+
name: "claude-devtools-bc",
|
|
34
|
+
title: "Claude BC",
|
|
35
|
+
icon: isTunnelActive ? "carbon:connection-signal" : "carbon:connection-signal-off",
|
|
36
|
+
view: {
|
|
37
|
+
type: "iframe",
|
|
38
|
+
src: DEVTOOLS_UI_ROUTE
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const logger = useLogger("@oro.ad/nuxt-claude-devtools-bc");
|
|
45
|
+
function resolveTunnelConfig(options = {}) {
|
|
46
|
+
const host = options.host || process.env.DEV_TUNNEL_HOST;
|
|
47
|
+
if (!host) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const protocol = options.protocol || process.env.DEV_TUNNEL_PROTOCOL || "https";
|
|
51
|
+
const port = options.port || Number(process.env.DEV_TUNNEL_PORT) || (protocol === "https" ? 443 : 80);
|
|
52
|
+
const wsProtocol = protocol === "https" ? "wss" : "ws";
|
|
53
|
+
const allowedHosts = [
|
|
54
|
+
host,
|
|
55
|
+
"localhost",
|
|
56
|
+
...options.additionalHosts || []
|
|
57
|
+
];
|
|
58
|
+
return {
|
|
59
|
+
host,
|
|
60
|
+
protocol,
|
|
61
|
+
port,
|
|
62
|
+
wsProtocol,
|
|
63
|
+
origin: `${protocol}://${host}`,
|
|
64
|
+
allowedHosts
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const module$1 = defineNuxtModule({
|
|
68
|
+
meta: {
|
|
69
|
+
name: "@oro.ad/nuxt-claude-devtools-bc",
|
|
70
|
+
configKey: "claudeDevtoolsBc",
|
|
71
|
+
compatibility: {
|
|
72
|
+
nuxt: ">=3.0.0"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
defaults: {
|
|
76
|
+
tunnel: {
|
|
77
|
+
enabled: true,
|
|
78
|
+
protocol: "https",
|
|
79
|
+
additionalHosts: []
|
|
80
|
+
},
|
|
81
|
+
devtools: true,
|
|
82
|
+
disableDevtoolsAuth: true
|
|
83
|
+
},
|
|
84
|
+
setup(options, nuxt) {
|
|
85
|
+
const resolver = createResolver(import.meta.url);
|
|
86
|
+
let resolvedTunnel = null;
|
|
87
|
+
if (nuxt.options.dev) {
|
|
88
|
+
if (options.tunnel?.enabled !== false) {
|
|
89
|
+
resolvedTunnel = resolveTunnelConfig(options.tunnel);
|
|
90
|
+
if (resolvedTunnel) {
|
|
91
|
+
logger.info(`Configuring for tunnel: ${resolvedTunnel.origin}`);
|
|
92
|
+
nuxt.options.vite = defu(nuxt.options.vite, {
|
|
93
|
+
server: {
|
|
94
|
+
allowedHosts: resolvedTunnel.allowedHosts,
|
|
95
|
+
origin: resolvedTunnel.origin,
|
|
96
|
+
hmr: {
|
|
97
|
+
protocol: resolvedTunnel.wsProtocol,
|
|
98
|
+
host: resolvedTunnel.host,
|
|
99
|
+
clientPort: resolvedTunnel.port
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
if (options.disableDevtoolsAuth !== false) {
|
|
104
|
+
nuxt.options.devtools = defu(nuxt.options.devtools, {
|
|
105
|
+
disableAuthorization: true
|
|
106
|
+
});
|
|
107
|
+
logger.info("DevTools authorization disabled for tunnel access");
|
|
108
|
+
}
|
|
109
|
+
logger.info("Vite server configured:");
|
|
110
|
+
logger.info(` Origin: ${resolvedTunnel.origin}`);
|
|
111
|
+
logger.info(` HMR: ${resolvedTunnel.wsProtocol}://${resolvedTunnel.host}:${resolvedTunnel.port}`);
|
|
112
|
+
logger.info(` Allowed hosts: ${resolvedTunnel.allowedHosts.join(", ")}`);
|
|
113
|
+
} else {
|
|
114
|
+
logger.info("No tunnel host configured (set DEV_TUNNEL_HOST env or tunnel.host option)");
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
logger.info("Tunnel configuration disabled");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
nuxt.options.runtimeConfig.public.claudeDevtoolsBc = {
|
|
121
|
+
tunnel: resolvedTunnel ? {
|
|
122
|
+
host: resolvedTunnel.host,
|
|
123
|
+
protocol: resolvedTunnel.protocol,
|
|
124
|
+
port: resolvedTunnel.port,
|
|
125
|
+
origin: resolvedTunnel.origin
|
|
126
|
+
} : null
|
|
127
|
+
};
|
|
128
|
+
addPlugin(resolver.resolve("./runtime/plugin"));
|
|
129
|
+
addImports({
|
|
130
|
+
name: "useTunnel",
|
|
131
|
+
as: "useTunnel",
|
|
132
|
+
from: resolver.resolve("./runtime/composables/useTunnel")
|
|
133
|
+
});
|
|
134
|
+
addServerHandler({
|
|
135
|
+
route: "/api/__claude-devtools-bc-config",
|
|
136
|
+
handler: resolver.resolve("./runtime/server/api/__claude-devtools-bc-config.get")
|
|
137
|
+
});
|
|
138
|
+
if (options.devtools && nuxt.options.dev) {
|
|
139
|
+
setupDevToolsUI(nuxt, resolver, resolvedTunnel);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export { module$1 as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface TunnelInfo {
|
|
2
|
+
host: string;
|
|
3
|
+
protocol: 'http' | 'https';
|
|
4
|
+
port: number;
|
|
5
|
+
origin: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function useTunnel(): {
|
|
8
|
+
isActive: import("vue").ComputedRef<boolean>;
|
|
9
|
+
origin: import("vue").ComputedRef<string | null>;
|
|
10
|
+
host: import("vue").ComputedRef<string | null>;
|
|
11
|
+
config: TunnelInfo | null;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useRuntimeConfig } from "#app";
|
|
3
|
+
export function useTunnel() {
|
|
4
|
+
const config = useRuntimeConfig();
|
|
5
|
+
const tunnelConfig = config.public?.claudeDevtoolsBc?.tunnel;
|
|
6
|
+
return {
|
|
7
|
+
isActive: computed(() => !!tunnelConfig),
|
|
8
|
+
origin: computed(() => tunnelConfig?.origin ?? null),
|
|
9
|
+
host: computed(() => tunnelConfig?.host ?? null),
|
|
10
|
+
config: tunnelConfig ?? null
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: import("#app").Plugin<{
|
|
2
|
+
claudeDevtoolsBc: {
|
|
3
|
+
tunnel: any;
|
|
4
|
+
isTunnelActive: boolean;
|
|
5
|
+
};
|
|
6
|
+
}> & import("#app").ObjectPlugin<{
|
|
7
|
+
claudeDevtoolsBc: {
|
|
8
|
+
tunnel: any;
|
|
9
|
+
isTunnelActive: boolean;
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
2
|
+
export default defineNuxtPlugin(() => {
|
|
3
|
+
const config = useRuntimeConfig();
|
|
4
|
+
const tunnelConfig = config.public.claudeDevtoolsBc?.tunnel;
|
|
5
|
+
if (import.meta.dev && tunnelConfig) {
|
|
6
|
+
console.log(
|
|
7
|
+
`%c[Claude DevTools BC]%c Tunnel active: ${tunnelConfig.origin}`,
|
|
8
|
+
"background: #10b981; color: white; padding: 2px 6px; border-radius: 3px;",
|
|
9
|
+
"color: #10b981;"
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
provide: {
|
|
14
|
+
claudeDevtoolsBc: {
|
|
15
|
+
tunnel: tunnelConfig,
|
|
16
|
+
isTunnelActive: tunnelConfig !== null
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineEventHandler, useRuntimeConfig } from "#imports";
|
|
2
|
+
export default defineEventHandler(() => {
|
|
3
|
+
const config = useRuntimeConfig();
|
|
4
|
+
return {
|
|
5
|
+
tunnel: config.public.claudeDevtoolsBc?.tunnel ?? null,
|
|
6
|
+
env: {
|
|
7
|
+
DEV_TUNNEL_HOST: process.env.DEV_TUNNEL_HOST || null,
|
|
8
|
+
DEV_TUNNEL_PROTOCOL: process.env.DEV_TUNNEL_PROTOCOL || null,
|
|
9
|
+
DEV_TUNNEL_PORT: process.env.DEV_TUNNEL_PORT || null
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
});
|
package/dist/types.d.mts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oro.ad/nuxt-claude-devtools-bc",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Nuxt module for automatic Vite dev server configuration with tunnels (Cloudflare, ngrok, etc.) and DevTools integration",
|
|
5
|
+
"license": "GPL-3.0-only",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/types.d.mts",
|
|
10
|
+
"import": "./dist/module.mjs"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"url": "https://github.com/oro-ad/nuxt-claude-devtools-bc"
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/module.mjs",
|
|
17
|
+
"author": "Simon Bystrov <jobsbystr@gmail.com> (https://sbystr.com/)",
|
|
18
|
+
"typesVersions": {
|
|
19
|
+
"*": {
|
|
20
|
+
".": [
|
|
21
|
+
"./dist/types.d.mts"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"prepack": "nuxt-module-build && npm run client:build",
|
|
30
|
+
"client:build": "nuxi generate client",
|
|
31
|
+
"client:dev": "nuxi dev client --port 3300",
|
|
32
|
+
"dev": "npm run play:dev",
|
|
33
|
+
"dev:prepare": "nuxt-module-build --stub && nuxi prepare client",
|
|
34
|
+
"prepare": "nuxi prepare client",
|
|
35
|
+
"play:dev": "nuxi dev playground",
|
|
36
|
+
"play:prod": "npm run prepack && nuxi dev playground",
|
|
37
|
+
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
38
|
+
"lint": "eslint ."
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@nuxt/devtools-kit": "^3.1.1",
|
|
42
|
+
"@nuxt/kit": "^4.2.2",
|
|
43
|
+
"defu": "^6.1.4",
|
|
44
|
+
"sirv": "^3.0.2"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@iconify-json/carbon": "^1.2.16",
|
|
48
|
+
"@nuxt/devtools": "^3.1.1",
|
|
49
|
+
"@nuxt/devtools-ui-kit": "^3.1.1",
|
|
50
|
+
"@nuxt/eslint-config": "^1.12.1",
|
|
51
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
52
|
+
"@nuxt/schema": "^4.2.2",
|
|
53
|
+
"changelogen": "^0.6.2",
|
|
54
|
+
"eslint": "^9.39.2",
|
|
55
|
+
"nuxt": "^4.2.2",
|
|
56
|
+
"vitest": "^4.0.17"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"nuxt": "^3.0.0 || ^4.0.0"
|
|
60
|
+
},
|
|
61
|
+
"keywords": [
|
|
62
|
+
"nuxt",
|
|
63
|
+
"nuxt-module",
|
|
64
|
+
"nuxt-claude-business-console",
|
|
65
|
+
"vite",
|
|
66
|
+
"hmr",
|
|
67
|
+
"dev-server",
|
|
68
|
+
"devtools",
|
|
69
|
+
"business-console"
|
|
70
|
+
],
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
}
|
|
74
|
+
}
|