pulumi-package-docs 0.8.0 → 0.9.1
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 +98 -4
- package/bin/args.js +62 -3
- package/bin/args.test.js +60 -0
- package/bin/cli-bun.js +55 -23
- package/bin/cli.js +74 -28
- package/bin/cli.test.js +18 -0
- package/bin/static.js +196 -0
- package/bin/static.test.js +176 -0
- package/dist/client/assets/MemberDetail-Du4HYTda.js +1 -0
- package/dist/client/assets/{token-oQmZfAP3.js → examples-zkHFEaMt.js} +1 -1
- package/dist/client/assets/index-g58gbZKl.js +12 -0
- package/dist/client/assets/matchContext-BfDTxnb0.js +2 -0
- package/dist/client/assets/providers._name-DztqmroK.js +1 -0
- package/dist/client/assets/providers._name.functions._token-Dds2hD5R.js +1 -0
- package/dist/client/assets/providers._name.functions._token-DkZe4R_v.js +1 -0
- package/dist/client/assets/providers._name.index-B6cK3ZCZ.js +1 -0
- package/dist/client/assets/providers._name.index-CvFTUtAs.js +1 -0
- package/dist/client/assets/providers._name.resources._token-Bf7TPYcB.js +1 -0
- package/dist/client/assets/providers._name.resources._token-CIjv9yb8.js +1 -0
- package/dist/client/assets/routes-Dz3Kksbm.js +1 -0
- package/dist/mcp/stdio.js +449 -0
- package/dist/server/assets/{MemberDetail-C5sAHNZW.js → MemberDetail-CdHUSmQD.js} +2 -1
- package/dist/server/assets/{_tanstack-start-manifest_v-B0J-S-em.js → _tanstack-start-manifest_v-Drm3Ru6D.js} +15 -15
- package/dist/server/assets/api-D49ZDhMh.js +27 -0
- package/dist/server/assets/{providers._name.functions._token-Gkw4zt3M.js → providers._name.functions._token-BvkwmQ-L.js} +3 -2
- package/dist/server/assets/{providers._name.index-CEXkl-76.js → providers._name.index-DBkfEjsy.js} +3 -2
- package/dist/server/assets/{providers._name.resources._token-R_i2MmRl.js → providers._name.resources._token-Sl31Qlvd.js} +3 -2
- package/dist/server/assets/{schema.server-B-VvU1qb.js → providers.server-B1ZHZ5jE.js} +48 -1
- package/dist/server/assets/{router-1INob9fh.js → router-_zs8P-B2.js} +24 -87
- package/dist/server/assets/{routes-4jiXnS1p.js → routes-BUxagg9r.js} +1 -1
- package/dist/server/assets/token-DBEFeZIN.js +92 -0
- package/dist/server/server.js +987 -375
- package/examples/github-pages.yml +56 -0
- package/examples/gitlab-ci.yml +22 -0
- package/package.json +7 -3
- package/src/components/ThemeToggle.tsx +37 -0
- package/src/lib/pulumi/api.ts +18 -69
- package/src/lib/pulumi/mcp.server.test.ts +112 -0
- package/src/lib/pulumi/mcp.server.ts +11 -6
- package/src/lib/pulumi/providers.server.ts +80 -0
- package/src/lib/pulumi/stdio.server.ts +16 -0
- package/src/lib/pulumi/token.test.ts +44 -1
- package/src/lib/pulumi/token.ts +28 -0
- package/src/lib/static-docs.ts +15 -0
- package/src/router.tsx +3 -0
- package/src/routes/__root.tsx +6 -3
- package/src/routes/providers.$name.functions.$token.tsx +7 -4
- package/src/routes/providers.$name.index.tsx +2 -2
- package/src/routes/providers.$name.resources.$token.tsx +7 -4
- package/vite.config.ts +41 -1
- package/dist/client/assets/MemberDetail-BS9DbqEt.js +0 -1
- package/dist/client/assets/index-2FzxAhzN.js +0 -13
- package/dist/client/assets/providers._name-FmJEVkdV.js +0 -1
- package/dist/client/assets/providers._name.functions._token-BzjmNHea.js +0 -1
- package/dist/client/assets/providers._name.functions._token-D768U6I-.js +0 -1
- package/dist/client/assets/providers._name.index-C42yQ95z.js +0 -1
- package/dist/client/assets/providers._name.index-Dm0YiZWP.js +0 -1
- package/dist/client/assets/providers._name.resources._token-CIYPoqyA.js +0 -1
- package/dist/client/assets/providers._name.resources._token-D0OLvgo_.js +0 -1
- package/dist/client/assets/routes-DKNWlgPZ.js +0 -1
- package/dist/client/assets/useSelector-BIt42tGI.js +0 -1
- package/dist/server/assets/api-C55bS4R6.js +0 -64
|
@@ -2,16 +2,19 @@ import { Link, createFileRoute, notFound } from '@tanstack/react-router'
|
|
|
2
2
|
|
|
3
3
|
import { MemberDetail } from '@/components/MemberDetail'
|
|
4
4
|
import { getProvider } from '@/lib/pulumi/api'
|
|
5
|
-
import { tokenDisplayName } from '@/lib/pulumi/token'
|
|
5
|
+
import { findTokenBySlug, tokenDisplayName } from '@/lib/pulumi/token'
|
|
6
6
|
|
|
7
7
|
export const Route = createFileRoute('/providers/$name/functions/$token')({
|
|
8
8
|
loader: async ({ params }) => {
|
|
9
9
|
const entry = await getProvider({ data: params.name })
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
const functions = entry?.schema?.functions
|
|
11
|
+
const token =
|
|
12
|
+
functions && findTokenBySlug(Object.keys(functions), params.token)
|
|
13
|
+
const fn = token ? functions[token] : undefined
|
|
14
|
+
if (!token || !fn) throw notFound()
|
|
12
15
|
return {
|
|
13
16
|
providerName: params.name,
|
|
14
|
-
token
|
|
17
|
+
token,
|
|
15
18
|
fn,
|
|
16
19
|
runtime: entry?.runtime,
|
|
17
20
|
}
|
|
@@ -3,7 +3,7 @@ import { Link, createFileRoute, notFound } from '@tanstack/react-router'
|
|
|
3
3
|
import { getProvider } from '@/lib/pulumi/api'
|
|
4
4
|
import { resolveDescription } from '@/lib/pulumi/description'
|
|
5
5
|
import { summarizeDescription } from '@/lib/pulumi/examples'
|
|
6
|
-
import { tokenDisplayName } from '@/lib/pulumi/token'
|
|
6
|
+
import { tokenDisplayName, tokenSlug } from '@/lib/pulumi/token'
|
|
7
7
|
import type { SchemaFunction, SchemaResource } from '@/lib/pulumi/types'
|
|
8
8
|
|
|
9
9
|
export const Route = createFileRoute('/providers/$name/')({
|
|
@@ -43,7 +43,7 @@ function MemberListItem({
|
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<li className="doc-list-item">
|
|
46
|
-
<Link to={to} params={{ name: providerName, token }}>
|
|
46
|
+
<Link to={to} params={{ name: providerName, token: tokenSlug(token) }}>
|
|
47
47
|
<code>{tokenDisplayName(token)}</code>
|
|
48
48
|
</Link>
|
|
49
49
|
{deprecated && <span className="badge badge-warning">Deprecated</span>}
|
|
@@ -2,16 +2,19 @@ import { Link, createFileRoute, notFound } from '@tanstack/react-router'
|
|
|
2
2
|
|
|
3
3
|
import { MemberDetail } from '@/components/MemberDetail'
|
|
4
4
|
import { getProvider } from '@/lib/pulumi/api'
|
|
5
|
-
import { tokenDisplayName } from '@/lib/pulumi/token'
|
|
5
|
+
import { findTokenBySlug, tokenDisplayName } from '@/lib/pulumi/token'
|
|
6
6
|
|
|
7
7
|
export const Route = createFileRoute('/providers/$name/resources/$token')({
|
|
8
8
|
loader: async ({ params }) => {
|
|
9
9
|
const entry = await getProvider({ data: params.name })
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
const resources = entry?.schema?.resources
|
|
11
|
+
const token =
|
|
12
|
+
resources && findTokenBySlug(Object.keys(resources), params.token)
|
|
13
|
+
const resource = token ? resources[token] : undefined
|
|
14
|
+
if (!token || !resource) throw notFound()
|
|
12
15
|
return {
|
|
13
16
|
providerName: params.name,
|
|
14
|
-
token
|
|
17
|
+
token,
|
|
15
18
|
resource,
|
|
16
19
|
runtime: entry?.runtime,
|
|
17
20
|
}
|
package/vite.config.ts
CHANGED
|
@@ -38,9 +38,49 @@ function printMcpUrl(): Plugin {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// Set by `pulumi-package-docs static` (see bin/static.js). A static build
|
|
42
|
+
// prerenders every page to HTML under `dist-static/client` so the result can
|
|
43
|
+
// be published to GitHub/GitLab Pages, where there's no server to render them.
|
|
44
|
+
const staticDocs = process.env.VITE_STATIC_DOCS === 'true'
|
|
45
|
+
// The path the site is served under, e.g. "/<repo>/" for a GitHub/GitLab
|
|
46
|
+
// Pages project site. Vite prefixes asset URLs with it, and the router picks
|
|
47
|
+
// it up as its basepath via `import.meta.env.BASE_URL`.
|
|
48
|
+
const base = process.env.PULUMI_DOCS_BASE || '/'
|
|
49
|
+
|
|
41
50
|
const config = defineConfig({
|
|
51
|
+
base,
|
|
52
|
+
// A static build goes to its own output directory, so generating a site
|
|
53
|
+
// never clobbers the `dist/` build that `pulumi-package-docs` serves.
|
|
54
|
+
...(staticDocs
|
|
55
|
+
? {
|
|
56
|
+
build: { outDir: 'dist-static' },
|
|
57
|
+
preview: { host: '127.0.0.1' },
|
|
58
|
+
}
|
|
59
|
+
: {}),
|
|
42
60
|
resolve: { tsconfigPaths: true },
|
|
43
|
-
plugins: [
|
|
61
|
+
plugins: [
|
|
62
|
+
tanstackStart(
|
|
63
|
+
staticDocs
|
|
64
|
+
? {
|
|
65
|
+
// Crawling from the index reaches every provider page and, from
|
|
66
|
+
// there, every resource/function page — so the page list follows
|
|
67
|
+
// whatever the project's Pulumi.yaml declares, with nothing to
|
|
68
|
+
// enumerate here.
|
|
69
|
+
pages: [{ path: '/' }],
|
|
70
|
+
prerender: {
|
|
71
|
+
enabled: true,
|
|
72
|
+
crawlLinks: true,
|
|
73
|
+
failOnError: true,
|
|
74
|
+
// `/mcp` is a server endpoint (Streamable HTTP), not a page;
|
|
75
|
+
// there's nothing to prerender and no server to serve it from.
|
|
76
|
+
filter: (page) => page.path !== '/mcp',
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
: undefined,
|
|
80
|
+
),
|
|
81
|
+
viteReact(),
|
|
82
|
+
printMcpUrl(),
|
|
83
|
+
],
|
|
44
84
|
})
|
|
45
85
|
|
|
46
86
|
export default config
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./useSelector-BIt42tGI.js";import{o as t}from"./index-2FzxAhzN.js";import{i as n,n as r,o as i,r as a}from"./token-oQmZfAP3.js";var o=e();function s({example:e}){return e?(0,o.jsxs)(`div`,{className:`code-example`,children:[(0,o.jsx)(`span`,{className:`code-example-lang`,children:e.language}),(0,o.jsx)(`pre`,{children:(0,o.jsx)(`code`,{children:e.code})})]}):(0,o.jsx)(`p`,{className:`empty-state`,children:`No examples in the schema.`})}function c(e){if(!e)return`any`;if(e.$ref){let t=e.$ref.split(`/`).pop()??e.$ref;return decodeURIComponent(t)}return e.type===`array`&&e.items?`${c(e.items)}[]`:e.type??`any`}function l(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1_$2`).toLowerCase()}function u(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function d(e,t){switch(t){case`python`:return l(e);case`go`:case`dotnet`:return u(e);default:return e}}function f({properties:e,required:t,runtime:n}){let r=Object.keys(e??{});if(r.length===0)return(0,o.jsx)(`p`,{className:`empty-state`,children:`None`});let a=new Set(t??[]);return(0,o.jsxs)(`table`,{className:`props-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:`Name`}),(0,o.jsx)(`th`,{children:`Type`}),(0,o.jsx)(`th`,{children:`Required`}),(0,o.jsx)(`th`,{children:`Description`})]})}),(0,o.jsx)(`tbody`,{children:r.map(t=>{let r=e[t];return(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`code`,{children:d(t,n)})}),(0,o.jsx)(`td`,{children:(0,o.jsx)(`code`,{children:c(r)})}),(0,o.jsx)(`td`,{children:a.has(t)?`yes`:`no`}),(0,o.jsx)(`td`,{children:i(r.description,n)??``})]},t)})})]})}function p({providerName:e,kind:c,displayName:l,token:u,description:d,deprecationMessage:p,runtime:m,inputProperties:h,requiredInputs:g,outputProperties:_,requiredOutputs:v}){let y=i(d,m),b=n(y),x=a(r(y),m);return(0,o.jsxs)(`main`,{className:`provider-detail`,children:[(0,o.jsxs)(t,{to:`/providers/$name`,params:{name:e},className:`back-link`,children:[`← Back to `,e]}),(0,o.jsx)(`h1`,{children:l}),(0,o.jsxs)(`p`,{className:`subtitle`,children:[(0,o.jsx)(`span`,{className:`badge ${c===`Resource`?`badge-resource`:`badge-function`}`,children:c}),` `,`· `,(0,o.jsx)(`code`,{children:u})]}),p&&(0,o.jsxs)(`p`,{className:`banner banner-warning`,children:[`Deprecated: `,p]}),b?.split(/\n{2,}/).map((e,t)=>(0,o.jsx)(`p`,{children:e},t)),(0,o.jsx)(`h2`,{children:`Example`}),(0,o.jsx)(s,{example:x}),(0,o.jsx)(`h2`,{children:`Inputs`}),(0,o.jsx)(f,{properties:h,required:g,runtime:m}),(0,o.jsx)(`h2`,{children:`Outputs`}),(0,o.jsx)(f,{properties:_,required:v,runtime:m})]})}export{p as t};
|