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 CHANGED
@@ -65,7 +65,6 @@ if (!hasProductionBuild) {
65
65
  )
66
66
  }
67
67
  console.log(`Serving provider docs for: ${options.dir}`)
68
- console.log(`MCP endpoint: http://localhost:${options.port}/mcp`)
69
68
 
70
69
  const child = spawn(process.execPath, [viteBin, ...viteArgs], {
71
70
  cwd: packageRoot,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulumi-package-docs",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Local documentation viewer for the parameterized/local Pulumi providers used by a Pulumi project.",
5
5
  "type": "module",
6
6
  "license": "MIT",
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