pulumi-package-docs 0.3.0 → 0.4.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/bin/cli.js +0 -1
- package/package.json +1 -1
- package/vite.config.ts +35 -1
package/bin/cli.js
CHANGED
package/package.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -1,12 +1,46 @@
|
|
|
1
1
|
import { defineConfig } from 'vite'
|
|
2
|
+
import type { Plugin, PreviewServer, ViteDevServer } from 'vite'
|
|
2
3
|
|
|
3
4
|
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
|
|
4
5
|
|
|
5
6
|
import viteReact from '@vitejs/plugin-react'
|
|
6
7
|
|
|
8
|
+
// Matches the ANSI styling Vite's own CLI uses for its "Local"/"Network"
|
|
9
|
+
// bullets (picocolors' green/bold/cyan), so this reads as one more item in
|
|
10
|
+
// that same list rather than a separately-styled line.
|
|
11
|
+
const green = (s: string) => `\x1b[32m${s}\x1b[39m`
|
|
12
|
+
const bold = (s: string) => `\x1b[1m${s}\x1b[22m`
|
|
13
|
+
const cyan = (s: string) => `\x1b[36m${s}\x1b[39m`
|
|
14
|
+
const colorUrl = (url: string) =>
|
|
15
|
+
cyan(url.replace(/:(\d+)\//, (_, port) => `:${bold(port)}/`))
|
|
16
|
+
|
|
17
|
+
/** Prints the MCP endpoint alongside Vite's own "Local"/"Network" bullets. */
|
|
18
|
+
function printMcpUrl(): Plugin {
|
|
19
|
+
function withMcpUrl(server: ViteDevServer | PreviewServer) {
|
|
20
|
+
const printUrls = server.printUrls.bind(server)
|
|
21
|
+
server.printUrls = () => {
|
|
22
|
+
printUrls()
|
|
23
|
+
const base = server.resolvedUrls?.local[0]
|
|
24
|
+
if (!base) return
|
|
25
|
+
const url = new URL('mcp', base).toString()
|
|
26
|
+
// Padded to the same 9-column label width Vite uses ("Local: " /
|
|
27
|
+
// "Network: " are both 9 characters before the URL).
|
|
28
|
+
server.config.logger.info(
|
|
29
|
+
` ${green('➜')} ${bold('MCP')}: ${colorUrl(url)}`,
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
name: 'print-mcp-url',
|
|
36
|
+
configureServer: withMcpUrl,
|
|
37
|
+
configurePreviewServer: withMcpUrl,
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
7
41
|
const config = defineConfig({
|
|
8
42
|
resolve: { tsconfigPaths: true },
|
|
9
|
-
plugins: [tanstackStart(), viteReact()],
|
|
43
|
+
plugins: [tanstackStart(), viteReact(), printMcpUrl()],
|
|
10
44
|
})
|
|
11
45
|
|
|
12
46
|
export default config
|