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.
Files changed (62) hide show
  1. package/README.md +98 -4
  2. package/bin/args.js +62 -3
  3. package/bin/args.test.js +60 -0
  4. package/bin/cli-bun.js +55 -23
  5. package/bin/cli.js +74 -28
  6. package/bin/cli.test.js +18 -0
  7. package/bin/static.js +196 -0
  8. package/bin/static.test.js +176 -0
  9. package/dist/client/assets/MemberDetail-Du4HYTda.js +1 -0
  10. package/dist/client/assets/{token-oQmZfAP3.js → examples-zkHFEaMt.js} +1 -1
  11. package/dist/client/assets/index-g58gbZKl.js +12 -0
  12. package/dist/client/assets/matchContext-BfDTxnb0.js +2 -0
  13. package/dist/client/assets/providers._name-DztqmroK.js +1 -0
  14. package/dist/client/assets/providers._name.functions._token-Dds2hD5R.js +1 -0
  15. package/dist/client/assets/providers._name.functions._token-DkZe4R_v.js +1 -0
  16. package/dist/client/assets/providers._name.index-B6cK3ZCZ.js +1 -0
  17. package/dist/client/assets/providers._name.index-CvFTUtAs.js +1 -0
  18. package/dist/client/assets/providers._name.resources._token-Bf7TPYcB.js +1 -0
  19. package/dist/client/assets/providers._name.resources._token-CIjv9yb8.js +1 -0
  20. package/dist/client/assets/routes-Dz3Kksbm.js +1 -0
  21. package/dist/mcp/stdio.js +449 -0
  22. package/dist/server/assets/{MemberDetail-C5sAHNZW.js → MemberDetail-CdHUSmQD.js} +2 -1
  23. package/dist/server/assets/{_tanstack-start-manifest_v-B0J-S-em.js → _tanstack-start-manifest_v-Drm3Ru6D.js} +15 -15
  24. package/dist/server/assets/api-D49ZDhMh.js +27 -0
  25. package/dist/server/assets/{providers._name.functions._token-Gkw4zt3M.js → providers._name.functions._token-BvkwmQ-L.js} +3 -2
  26. package/dist/server/assets/{providers._name.index-CEXkl-76.js → providers._name.index-DBkfEjsy.js} +3 -2
  27. package/dist/server/assets/{providers._name.resources._token-R_i2MmRl.js → providers._name.resources._token-Sl31Qlvd.js} +3 -2
  28. package/dist/server/assets/{schema.server-B-VvU1qb.js → providers.server-B1ZHZ5jE.js} +48 -1
  29. package/dist/server/assets/{router-1INob9fh.js → router-_zs8P-B2.js} +24 -87
  30. package/dist/server/assets/{routes-4jiXnS1p.js → routes-BUxagg9r.js} +1 -1
  31. package/dist/server/assets/token-DBEFeZIN.js +92 -0
  32. package/dist/server/server.js +987 -375
  33. package/examples/github-pages.yml +56 -0
  34. package/examples/gitlab-ci.yml +22 -0
  35. package/package.json +7 -3
  36. package/src/components/ThemeToggle.tsx +37 -0
  37. package/src/lib/pulumi/api.ts +18 -69
  38. package/src/lib/pulumi/mcp.server.test.ts +112 -0
  39. package/src/lib/pulumi/mcp.server.ts +11 -6
  40. package/src/lib/pulumi/providers.server.ts +80 -0
  41. package/src/lib/pulumi/stdio.server.ts +16 -0
  42. package/src/lib/pulumi/token.test.ts +44 -1
  43. package/src/lib/pulumi/token.ts +28 -0
  44. package/src/lib/static-docs.ts +15 -0
  45. package/src/router.tsx +3 -0
  46. package/src/routes/__root.tsx +6 -3
  47. package/src/routes/providers.$name.functions.$token.tsx +7 -4
  48. package/src/routes/providers.$name.index.tsx +2 -2
  49. package/src/routes/providers.$name.resources.$token.tsx +7 -4
  50. package/vite.config.ts +41 -1
  51. package/dist/client/assets/MemberDetail-BS9DbqEt.js +0 -1
  52. package/dist/client/assets/index-2FzxAhzN.js +0 -13
  53. package/dist/client/assets/providers._name-FmJEVkdV.js +0 -1
  54. package/dist/client/assets/providers._name.functions._token-BzjmNHea.js +0 -1
  55. package/dist/client/assets/providers._name.functions._token-D768U6I-.js +0 -1
  56. package/dist/client/assets/providers._name.index-C42yQ95z.js +0 -1
  57. package/dist/client/assets/providers._name.index-Dm0YiZWP.js +0 -1
  58. package/dist/client/assets/providers._name.resources._token-CIYPoqyA.js +0 -1
  59. package/dist/client/assets/providers._name.resources._token-D0OLvgo_.js +0 -1
  60. package/dist/client/assets/routes-DKNWlgPZ.js +0 -1
  61. package/dist/client/assets/useSelector-BIt42tGI.js +0 -1
  62. package/dist/server/assets/api-C55bS4R6.js +0 -64
@@ -7,17 +7,17 @@ var tsrStartManifest = () => ({ routes: {
7
7
  "/mcp",
8
8
  "/providers/$name"
9
9
  ],
10
- preloads: ["/assets/index-2FzxAhzN.js", "/assets/useSelector-BIt42tGI.js"],
10
+ preloads: ["/assets/index-g58gbZKl.js", "/assets/matchContext-BfDTxnb0.js"],
11
11
  scripts: [{ attrs: {
12
12
  type: "module",
13
13
  async: !0,
14
- src: "/assets/index-2FzxAhzN.js"
14
+ src: "/assets/index-g58gbZKl.js"
15
15
  } }]
16
16
  },
17
17
  "/": {
18
18
  filePath: "/home/runner/work/pulumi-package-docs/pulumi-package-docs/src/routes/index.tsx",
19
19
  children: void 0,
20
- preloads: ["/assets/routes-DKNWlgPZ.js"]
20
+ preloads: ["/assets/routes-Dz3Kksbm.js"]
21
21
  },
22
22
  "/providers/$name": {
23
23
  filePath: "/home/runner/work/pulumi-package-docs/pulumi-package-docs/src/routes/providers.$name.tsx",
@@ -26,35 +26,35 @@ var tsrStartManifest = () => ({ routes: {
26
26
  "/providers/$name/functions/$token",
27
27
  "/providers/$name/resources/$token"
28
28
  ],
29
- preloads: ["/assets/providers._name-FmJEVkdV.js"]
29
+ preloads: ["/assets/providers._name-DztqmroK.js"]
30
30
  },
31
31
  "/providers/$name/": {
32
32
  filePath: "/home/runner/work/pulumi-package-docs/pulumi-package-docs/src/routes/providers.$name.index.tsx",
33
33
  children: void 0,
34
34
  preloads: [
35
- "/assets/providers._name.index-C42yQ95z.js",
36
- "/assets/providers._name.index-Dm0YiZWP.js",
37
- "/assets/token-oQmZfAP3.js"
35
+ "/assets/providers._name.index-B6cK3ZCZ.js",
36
+ "/assets/examples-zkHFEaMt.js",
37
+ "/assets/providers._name.index-CvFTUtAs.js"
38
38
  ]
39
39
  },
40
40
  "/providers/$name/functions/$token": {
41
41
  filePath: "/home/runner/work/pulumi-package-docs/pulumi-package-docs/src/routes/providers.$name.functions.$token.tsx",
42
42
  children: void 0,
43
43
  preloads: [
44
- "/assets/providers._name.functions._token-BzjmNHea.js",
45
- "/assets/providers._name.functions._token-D768U6I-.js",
46
- "/assets/MemberDetail-BS9DbqEt.js",
47
- "/assets/token-oQmZfAP3.js"
44
+ "/assets/providers._name.functions._token-Dds2hD5R.js",
45
+ "/assets/providers._name.functions._token-DkZe4R_v.js",
46
+ "/assets/MemberDetail-Du4HYTda.js",
47
+ "/assets/examples-zkHFEaMt.js"
48
48
  ]
49
49
  },
50
50
  "/providers/$name/resources/$token": {
51
51
  filePath: "/home/runner/work/pulumi-package-docs/pulumi-package-docs/src/routes/providers.$name.resources.$token.tsx",
52
52
  children: void 0,
53
53
  preloads: [
54
- "/assets/providers._name.resources._token-CIYPoqyA.js",
55
- "/assets/MemberDetail-BS9DbqEt.js",
56
- "/assets/token-oQmZfAP3.js",
57
- "/assets/providers._name.resources._token-D0OLvgo_.js"
54
+ "/assets/providers._name.resources._token-Bf7TPYcB.js",
55
+ "/assets/providers._name.resources._token-CIjv9yb8.js",
56
+ "/assets/MemberDetail-Du4HYTda.js",
57
+ "/assets/examples-zkHFEaMt.js"
58
58
  ]
59
59
  }
60
60
  } });
@@ -0,0 +1,27 @@
1
+ import { n as TSS_SERVER_FUNCTION, t as createServerFn } from "../server.js";
2
+ import { n as loadProviderDetail, t as loadProjectSummary } from "./providers.server-B1ZHZ5jE.js";
3
+ //#region node_modules/@tanstack/start-server-core/dist/esm/createServerRpc.js
4
+ var createServerRpc = (serverFnMeta, splitImportFn) => {
5
+ const url = "/_serverFn/" + serverFnMeta.id;
6
+ return Object.assign(splitImportFn, {
7
+ url,
8
+ serverFnMeta,
9
+ [TSS_SERVER_FUNCTION]: true
10
+ });
11
+ };
12
+ //#endregion
13
+ //#region src/lib/pulumi/api.ts?tss-serverfn-split
14
+ var listProviders_createServerFn_handler = createServerRpc({
15
+ id: "a3ba03544bae9a67523c84875835e6e9b6dfa1b22a99b2c4c57d7ae25dbf7350",
16
+ name: "listProviders",
17
+ filename: "src/lib/pulumi/api.ts"
18
+ }, (opts) => listProviders.__executeServer(opts));
19
+ var listProviders = createServerFn({ method: "GET" }).handler(listProviders_createServerFn_handler, () => loadProjectSummary());
20
+ var getProvider_createServerFn_handler = createServerRpc({
21
+ id: "20c32dac0b2237041a59da458130ed4f320ce92dddd59a28b88581987c58d61d",
22
+ name: "getProvider",
23
+ filename: "src/lib/pulumi/api.ts"
24
+ }, (opts) => getProvider.__executeServer(opts));
25
+ var getProvider = createServerFn({ method: "GET" }).validator((name) => name).handler(getProvider_createServerFn_handler, ({ data: name }) => loadProviderDetail(name));
26
+ //#endregion
27
+ export { getProvider_createServerFn_handler, listProviders_createServerFn_handler };
@@ -1,5 +1,6 @@
1
- import { a as tokenDisplayName, r as Route } from "./router-1INob9fh.js";
2
- import { t as MemberDetail } from "./MemberDetail-C5sAHNZW.js";
1
+ import { n as tokenDisplayName } from "./token-DBEFeZIN.js";
2
+ import { r as Route } from "./router-_zs8P-B2.js";
3
+ import { t as MemberDetail } from "./MemberDetail-CdHUSmQD.js";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  //#region src/routes/providers.$name.functions.$token.tsx?tsr-split=component
5
6
  function FunctionDetail() {
@@ -1,4 +1,5 @@
1
- import { a as tokenDisplayName, d as summarizeDescription, f as resolveDescription, i as Route } from "./router-1INob9fh.js";
1
+ import { c as resolveDescription, n as tokenDisplayName, r as tokenSlug, s as summarizeDescription } from "./token-DBEFeZIN.js";
2
+ import { i as Route } from "./router-_zs8P-B2.js";
2
3
  import { Link } from "@tanstack/react-router";
3
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
5
  //#region src/routes/providers.$name.index.tsx?tsr-split=component
@@ -12,7 +13,7 @@ function MemberListItem({ token, member, runtime, to, providerName }) {
12
13
  to,
13
14
  params: {
14
15
  name: providerName,
15
- token
16
+ token: tokenSlug(token)
16
17
  },
17
18
  children: /* @__PURE__ */ jsx("code", { children: tokenDisplayName(token) })
18
19
  }),
@@ -1,5 +1,6 @@
1
- import { a as tokenDisplayName, n as Route } from "./router-1INob9fh.js";
2
- import { t as MemberDetail } from "./MemberDetail-C5sAHNZW.js";
1
+ import { n as tokenDisplayName } from "./token-DBEFeZIN.js";
2
+ import { n as Route } from "./router-_zs8P-B2.js";
3
+ import { t as MemberDetail } from "./MemberDetail-CdHUSmQD.js";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  //#region src/routes/providers.$name.resources.$token.tsx?tsr-split=component
5
6
  function ResourceDetail() {
@@ -119,4 +119,51 @@ async function resolveProviderSchema(projectRoot, ref) {
119
119
  }
120
120
  }
121
121
  //#endregion
122
- export { getTargetDir as n, loadPulumiProject as r, resolveProviderSchema as t };
122
+ //#region src/lib/pulumi/providers.server.ts
123
+ /**
124
+ * The project + provider summaries shown on the index route and by the MCP
125
+ * `list_providers` tool. Plain async functions (no TanStack Start server-fn
126
+ * wrapper) so they can run either inside the web server or in the stdio MCP
127
+ * process, which has no HTTP server at all.
128
+ */
129
+ async function loadProjectSummary() {
130
+ const targetDir = getTargetDir();
131
+ const project = loadPulumiProject(targetDir);
132
+ if (!project) return {
133
+ targetDir,
134
+ project: null,
135
+ providers: []
136
+ };
137
+ const providers = (await Promise.all(project.packages.map((ref) => resolveProviderSchema(project.root, ref)))).map((entry) => ({
138
+ name: entry.ref.name,
139
+ source: entry.ref.source,
140
+ version: entry.ref.version,
141
+ parameters: entry.ref.parameters,
142
+ resourceCount: Object.keys(entry.schema?.resources ?? {}).length,
143
+ functionCount: Object.keys(entry.schema?.functions ?? {}).length,
144
+ origin: entry.origin,
145
+ error: entry.error
146
+ }));
147
+ return {
148
+ targetDir,
149
+ project: {
150
+ root: project.root,
151
+ name: project.name,
152
+ runtime: project.runtime
153
+ },
154
+ providers
155
+ };
156
+ }
157
+ /** The fully resolved schema for one local provider, or null if the project or provider isn't found. */
158
+ async function loadProviderDetail(name) {
159
+ const project = loadPulumiProject(getTargetDir());
160
+ if (!project) return null;
161
+ const ref = project.packages.find((p) => p.name === name);
162
+ if (!ref) return null;
163
+ return {
164
+ ...await resolveProviderSchema(project.root, ref),
165
+ runtime: project.runtime
166
+ };
167
+ }
168
+ //#endregion
169
+ export { loadPulumiProject as a, getTargetDir as i, loadProviderDetail as n, resolveProviderSchema as r, loadProjectSummary as t };
@@ -1,5 +1,6 @@
1
- import { n as getTargetDir, r as loadPulumiProject, t as resolveProviderSchema } from "./schema.server-B-VvU1qb.js";
1
+ import { a as loadPulumiProject, i as getTargetDir, n as loadProviderDetail, r as resolveProviderSchema, t as loadProjectSummary } from "./providers.server-B1ZHZ5jE.js";
2
2
  import { n as listProviders, t as getProvider } from "./api-BV6lykkP.js";
3
+ import { a as pickExample, c as resolveDescription, i as extractExamples, n as tokenDisplayName, o as stripExamples, s as summarizeDescription, t as findTokenBySlug } from "./token-DBEFeZIN.js";
3
4
  import { useEffect, useState } from "react";
4
5
  import { HeadContent, Link, Scripts, createFileRoute, createRootRoute, createRouter, lazyRouteComponent, notFound } from "@tanstack/react-router";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -328,71 +329,12 @@ function RootDocument({ children }) {
328
329
  }
329
330
  //#endregion
330
331
  //#region src/routes/index.tsx
331
- var $$splitComponentImporter$4 = () => import("./routes-4jiXnS1p.js");
332
+ var $$splitComponentImporter$4 = () => import("./routes-BUxagg9r.js");
332
333
  var Route$5 = createFileRoute("/")({
333
334
  loader: () => listProviders(),
334
335
  component: lazyRouteComponent($$splitComponentImporter$4, "component")
335
336
  });
336
337
  //#endregion
337
- //#region src/lib/pulumi/description.ts
338
- /**
339
- * Pulumi schema descriptions embed per-language text as HTML-ish spans, e.g.
340
- * `<span pulumi-lang-nodejs="`length`" pulumi-lang-python="`length`" ...>`length`</span>`.
341
- * pulumi.com's docs site picks an attribute based on the selected language tab;
342
- * we don't have tabs, so we resolve each span to the project's own runtime up
343
- * front and strip the markup rather than rendering (or leaking) raw HTML.
344
- */
345
- var LANG_SPAN_RE = /<span\s+((?:pulumi-lang-[a-z]+="[^"]*"\s*)+)>([\s\S]*?)<\/span>/g;
346
- var LANG_ATTR_RE = /pulumi-lang-([a-z]+)="([^"]*)"/g;
347
- function resolveLangSpans(text, runtime) {
348
- return text.replace(LANG_SPAN_RE, (_match, attrsSource, fallback) => {
349
- if (!runtime) return fallback;
350
- LANG_ATTR_RE.lastIndex = 0;
351
- let match;
352
- while (match = LANG_ATTR_RE.exec(attrsSource)) if (match[1] === runtime) return match[2];
353
- return fallback;
354
- });
355
- }
356
- /** Resolves a schema description's per-language spans for the given Pulumi runtime. */
357
- function resolveDescription(text, runtime) {
358
- if (!text) return text;
359
- return resolveLangSpans(text, runtime);
360
- }
361
- //#endregion
362
- //#region src/lib/pulumi/examples.ts
363
- var CODE_FENCE_RE = /```([a-zA-Z0-9+#-]+)\n([\s\S]*?)```/g;
364
- function extractExamples(text) {
365
- if (!text) return [];
366
- return [...text.matchAll(CODE_FENCE_RE)].map((match) => ({
367
- language: match[1].toLowerCase(),
368
- code: match[2].trimEnd()
369
- }));
370
- }
371
- /** The description text with any fenced code examples removed. */
372
- function stripExamples(text) {
373
- if (!text) return text;
374
- return text.replace(CODE_FENCE_RE, "").trim() || void 0;
375
- }
376
- /** A short summary for list views: the first prose paragraph, examples excluded. */
377
- function summarizeDescription(text) {
378
- const stripped = stripExamples(text);
379
- if (!stripped) return void 0;
380
- return stripped.split(/\n{2,}/)[0]?.trim() || void 0;
381
- }
382
- var RUNTIME_LANGUAGES = {
383
- nodejs: ["typescript", "javascript"],
384
- python: ["python"],
385
- go: ["go", "golang"],
386
- dotnet: ["csharp"],
387
- java: ["java"],
388
- yaml: ["yaml"]
389
- };
390
- /** Picks the example matching the project's runtime, falling back to the first available one. */
391
- function pickExample(examples, runtime) {
392
- const languages = runtime ? RUNTIME_LANGUAGES[runtime] : void 0;
393
- return (languages ? examples.find((example) => languages.includes(example.language)) : void 0) ?? examples[0];
394
- }
395
- //#endregion
396
338
  //#region src/lib/pulumi/format.ts
397
339
  function formatType(prop) {
398
340
  if (!prop) return "any";
@@ -428,18 +370,6 @@ function formatPropertyName(name, runtime) {
428
370
  }
429
371
  }
430
372
  //#endregion
431
- //#region src/lib/pulumi/token.ts
432
- /**
433
- * Schema tokens look like `random:index/randomString:RandomString` (resources)
434
- * or `random:index/randomInteger:randomInteger` (functions). The segment after
435
- * the last colon is the name every generated SDK exports for that member, and
436
- * is unique within the provider, so it makes a readable display name.
437
- */
438
- function tokenDisplayName(token) {
439
- const short = token.split(":").pop();
440
- return short && short.length > 0 ? short : token;
441
- }
442
- //#endregion
443
373
  //#region src/lib/pulumi/mcp.server.ts
444
374
  function textResult(data) {
445
375
  return { content: [{
@@ -449,7 +379,7 @@ function textResult(data) {
449
379
  }
450
380
  /** Loads a local provider's resolved schema, throwing a descriptive error a tool call can surface to the client. */
451
381
  async function requireProvider(providerName) {
452
- const detail = await getProvider({ data: providerName });
382
+ const detail = await loadProviderDetail(providerName);
453
383
  if (!detail) throw new Error(`No local provider named "${providerName}" was found. Call list_providers to see the providers declared in this project's Pulumi.yaml.`);
454
384
  if (!detail.schema) throw new Error(`Failed to load the schema for provider "${providerName}": ${detail.error ?? "unknown error"}`);
455
385
  return {
@@ -489,8 +419,10 @@ function memberDetail(provider, token, description, runtime, inputs, outputs, de
489
419
  };
490
420
  }
491
421
  /**
492
- * Builds a fresh MCP server with the local-provider-docs tools registered. Called once
493
- * per HTTP request (see `src/routes/mcp.ts`) so concurrent requests never share state.
422
+ * Builds a fresh MCP server with the local-provider-docs tools registered. Transport
423
+ * agnostic: `src/routes/mcp.ts` calls it once per HTTP request (so concurrent requests
424
+ * never share state), and `src/lib/pulumi/stdio.server.ts` calls it once for the
425
+ * lifetime of a stdio process.
494
426
  */
495
427
  function createMcpServer() {
496
428
  const server = new McpServer({
@@ -500,7 +432,7 @@ function createMcpServer() {
500
432
  server.registerTool("list_providers", {
501
433
  title: "List local providers",
502
434
  description: "List the local/parameterized Pulumi providers declared in this project's Pulumi.yaml (added with `pulumi package add`), with their source, version, and resource/function counts."
503
- }, async () => textResult(await listProviders()));
435
+ }, async () => textResult(await loadProjectSummary()));
504
436
  server.registerTool("list_resources", {
505
437
  title: "List a provider’s resources",
506
438
  description: "List the resource tokens for a local provider, each with a display name, a one-line summary, and whether it is deprecated. Use get_resource for full details (inputs/outputs/example) on one of them.",
@@ -622,7 +554,7 @@ var Route$3 = createFileRoute("/providers/$name")({ component: lazyRouteComponen
622
554
  //#endregion
623
555
  //#region src/routes/providers.$name.index.tsx
624
556
  var $$splitNotFoundComponentImporter$2 = () => import("./providers._name.index-BEwt-7U0.js");
625
- var $$splitComponentImporter$2 = () => import("./providers._name.index-CEXkl-76.js");
557
+ var $$splitComponentImporter$2 = () => import("./providers._name.index-DBkfEjsy.js");
626
558
  var Route$2 = createFileRoute("/providers/$name/")({
627
559
  loader: async ({ params }) => {
628
560
  const entry = await getProvider({ data: params.name });
@@ -635,15 +567,17 @@ var Route$2 = createFileRoute("/providers/$name/")({
635
567
  //#endregion
636
568
  //#region src/routes/providers.$name.functions.$token.tsx
637
569
  var $$splitNotFoundComponentImporter$1 = () => import("./providers._name.functions._token-D8LsoIum.js");
638
- var $$splitComponentImporter$1 = () => import("./providers._name.functions._token-Gkw4zt3M.js");
570
+ var $$splitComponentImporter$1 = () => import("./providers._name.functions._token-BvkwmQ-L.js");
639
571
  var Route$1 = createFileRoute("/providers/$name/functions/$token")({
640
572
  loader: async ({ params }) => {
641
573
  const entry = await getProvider({ data: params.name });
642
- const fn = entry?.schema?.functions?.[params.token];
643
- if (!fn) throw notFound();
574
+ const functions = entry?.schema?.functions;
575
+ const token = functions && findTokenBySlug(Object.keys(functions), params.token);
576
+ const fn = token ? functions[token] : void 0;
577
+ if (!token || !fn) throw notFound();
644
578
  return {
645
579
  providerName: params.name,
646
- token: params.token,
580
+ token,
647
581
  fn,
648
582
  runtime: entry?.runtime
649
583
  };
@@ -654,15 +588,17 @@ var Route$1 = createFileRoute("/providers/$name/functions/$token")({
654
588
  //#endregion
655
589
  //#region src/routes/providers.$name.resources.$token.tsx
656
590
  var $$splitNotFoundComponentImporter = () => import("./providers._name.resources._token-DJPF8nMg.js");
657
- var $$splitComponentImporter = () => import("./providers._name.resources._token-R_i2MmRl.js");
591
+ var $$splitComponentImporter = () => import("./providers._name.resources._token-Sl31Qlvd.js");
658
592
  var Route = createFileRoute("/providers/$name/resources/$token")({
659
593
  loader: async ({ params }) => {
660
594
  const entry = await getProvider({ data: params.name });
661
- const resource = entry?.schema?.resources?.[params.token];
662
- if (!resource) throw notFound();
595
+ const resources = entry?.schema?.resources;
596
+ const token = resources && findTokenBySlug(Object.keys(resources), params.token);
597
+ const resource = token ? resources[token] : void 0;
598
+ if (!token || !resource) throw notFound();
663
599
  return {
664
600
  providerName: params.name,
665
- token: params.token,
601
+ token,
666
602
  resource,
667
603
  runtime: entry?.runtime
668
604
  };
@@ -716,10 +652,11 @@ var router_exports = /* @__PURE__ */ __exportAll({ getRouter: () => getRouter })
716
652
  function getRouter() {
717
653
  return createRouter({
718
654
  routeTree,
655
+ basepath: "/",
719
656
  scrollRestoration: true,
720
657
  defaultPreload: "intent",
721
658
  defaultPreloadStaleTime: 0
722
659
  });
723
660
  }
724
661
  //#endregion
725
- export { tokenDisplayName as a, extractExamples as c, summarizeDescription as d, resolveDescription as f, getRouter, Route$2 as i, pickExample as l, Route as n, formatPropertyName as o, Route$5 as p, Route$1 as r, formatType as s, router_exports as t, stripExamples as u };
662
+ export { formatPropertyName as a, getRouter, Route$2 as i, Route as n, formatType as o, Route$1 as r, Route$5 as s, router_exports as t };
@@ -1,4 +1,4 @@
1
- import { p as Route } from "./router-1INob9fh.js";
1
+ import { s as Route } from "./router-_zs8P-B2.js";
2
2
  import { Link } from "@tanstack/react-router";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region src/routes/index.tsx?tsr-split=component
@@ -0,0 +1,92 @@
1
+ //#region src/lib/pulumi/description.ts
2
+ /**
3
+ * Pulumi schema descriptions embed per-language text as HTML-ish spans, e.g.
4
+ * `<span pulumi-lang-nodejs="`length`" pulumi-lang-python="`length`" ...>`length`</span>`.
5
+ * pulumi.com's docs site picks an attribute based on the selected language tab;
6
+ * we don't have tabs, so we resolve each span to the project's own runtime up
7
+ * front and strip the markup rather than rendering (or leaking) raw HTML.
8
+ */
9
+ var LANG_SPAN_RE = /<span\s+((?:pulumi-lang-[a-z]+="[^"]*"\s*)+)>([\s\S]*?)<\/span>/g;
10
+ var LANG_ATTR_RE = /pulumi-lang-([a-z]+)="([^"]*)"/g;
11
+ function resolveLangSpans(text, runtime) {
12
+ return text.replace(LANG_SPAN_RE, (_match, attrsSource, fallback) => {
13
+ if (!runtime) return fallback;
14
+ LANG_ATTR_RE.lastIndex = 0;
15
+ let match;
16
+ while (match = LANG_ATTR_RE.exec(attrsSource)) if (match[1] === runtime) return match[2];
17
+ return fallback;
18
+ });
19
+ }
20
+ /** Resolves a schema description's per-language spans for the given Pulumi runtime. */
21
+ function resolveDescription(text, runtime) {
22
+ if (!text) return text;
23
+ return resolveLangSpans(text, runtime);
24
+ }
25
+ //#endregion
26
+ //#region src/lib/pulumi/examples.ts
27
+ var CODE_FENCE_RE = /```([a-zA-Z0-9+#-]+)\n([\s\S]*?)```/g;
28
+ function extractExamples(text) {
29
+ if (!text) return [];
30
+ return [...text.matchAll(CODE_FENCE_RE)].map((match) => ({
31
+ language: match[1].toLowerCase(),
32
+ code: match[2].trimEnd()
33
+ }));
34
+ }
35
+ /** The description text with any fenced code examples removed. */
36
+ function stripExamples(text) {
37
+ if (!text) return text;
38
+ return text.replace(CODE_FENCE_RE, "").trim() || void 0;
39
+ }
40
+ /** A short summary for list views: the first prose paragraph, examples excluded. */
41
+ function summarizeDescription(text) {
42
+ const stripped = stripExamples(text);
43
+ if (!stripped) return void 0;
44
+ return stripped.split(/\n{2,}/)[0]?.trim() || void 0;
45
+ }
46
+ var RUNTIME_LANGUAGES = {
47
+ nodejs: ["typescript", "javascript"],
48
+ python: ["python"],
49
+ go: ["go", "golang"],
50
+ dotnet: ["csharp"],
51
+ java: ["java"],
52
+ yaml: ["yaml"]
53
+ };
54
+ /** Picks the example matching the project's runtime, falling back to the first available one. */
55
+ function pickExample(examples, runtime) {
56
+ const languages = runtime ? RUNTIME_LANGUAGES[runtime] : void 0;
57
+ return (languages ? examples.find((example) => languages.includes(example.language)) : void 0) ?? examples[0];
58
+ }
59
+ //#endregion
60
+ //#region src/lib/pulumi/token.ts
61
+ /**
62
+ * Schema tokens look like `random:index/randomString:RandomString` (resources)
63
+ * or `random:index/randomInteger:randomInteger` (functions). The segment after
64
+ * the last colon is the name every generated SDK exports for that member, and
65
+ * is unique within the provider, so it makes a readable display name.
66
+ */
67
+ function tokenDisplayName(token) {
68
+ const short = token.split(":").pop();
69
+ return short && short.length > 0 ? short : token;
70
+ }
71
+ /**
72
+ * A URL- and filesystem-safe form of a token, used as the `$token` route param.
73
+ *
74
+ * Tokens contain `:` and `/`, which only survive a URL as percent-escapes —
75
+ * and static hosts (GitHub/GitLab Pages) decode those before matching a file,
76
+ * so `random%3Aindex%2FrandomString%3ARandomString` would never resolve to the
77
+ * page generated for it. Replacing the separators keeps one URL shape that
78
+ * works both when served dynamically and as prerendered files on disk.
79
+ */
80
+ function tokenSlug(token) {
81
+ return token.replace(/[^a-zA-Z0-9._~-]+/g, "-");
82
+ }
83
+ /**
84
+ * Resolves a `$token` route param back to the schema token it names. Accepts
85
+ * either a slug (what links produce) or the raw token, so a URL pasted from
86
+ * schema output still works.
87
+ */
88
+ function findTokenBySlug(tokens, slug) {
89
+ for (const token of tokens) if (token === slug || tokenSlug(token) === slug) return token;
90
+ }
91
+ //#endregion
92
+ export { pickExample as a, resolveDescription as c, extractExamples as i, tokenDisplayName as n, stripExamples as o, tokenSlug as r, summarizeDescription as s, findTokenBySlug as t };