@redocly/framework 1.0.0-next.4 → 1.0.0-next.5

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 (163) hide show
  1. package/dist/bundler/build/output-metadata.js +1 -1
  2. package/dist/bundler/build/run.js +1 -1
  3. package/dist/bundler/build/vite-config.js +2 -2
  4. package/dist/bundler/dev/materialization-sweeper.js +1 -1
  5. package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
  6. package/dist/bundler/dev/routes/source-sync-route.js +1 -1
  7. package/dist/bundler/dev/run.js +1 -1
  8. package/dist/bundler/dev/runtime-app.js +1 -1
  9. package/dist/bundler/dev/vite-chunk-url.js +1 -1
  10. package/dist/bundler/user-markdoc-schema.js +1 -1
  11. package/dist/bundler/vite-config.base.js +3 -3
  12. package/dist/cli/commands/build.js +1 -1
  13. package/dist/cli/commands/dev.js +1 -1
  14. package/dist/cli/commands/ingest.js +1 -1
  15. package/dist/cli/commands/translate.js +2 -2
  16. package/dist/cli/dev-console/index.js +1 -1
  17. package/dist/cli/log-output/index.js +1 -1
  18. package/dist/cli/validate-react-pages.js +1 -1
  19. package/dist/client/RuntimeLink.js +1 -1
  20. package/dist/client/ai-search/use-ai-search.js +1 -1
  21. package/dist/client/analytics-page-view.js +1 -1
  22. package/dist/client/app.js +3 -3
  23. package/dist/client/client-entry.js +1 -1
  24. package/dist/client/contexts.js +1 -1
  25. package/dist/client/dev-problems/ProblemsBar.js +1 -1
  26. package/dist/client/feedback.js +1 -1
  27. package/dist/client/l10n/use-l10n-config.js +1 -1
  28. package/dist/client/products.js +1 -1
  29. package/dist/client/review/ReviewBar.js +50 -50
  30. package/dist/client/review/use-review.js +1 -1
  31. package/dist/client/sidebar/SidebarDataProvider.js +1 -1
  32. package/dist/client/sidebar/drilldown.js +1 -1
  33. package/dist/client/ssr.js +1 -1
  34. package/dist/client/telemetry/config.js +1 -1
  35. package/dist/client/use-entity-revisions.js +1 -1
  36. package/dist/client/use-page-versions.js +1 -1
  37. package/dist/client/use-search.js +1 -1
  38. package/dist/client/webmcp/tools/shared.js +1 -1
  39. package/dist/client/webmcp/tools/site-tools.js +1 -1
  40. package/dist/client/webmcp/use-webmcp-tools.js +1 -1
  41. package/dist/content-layer/config.js +1 -1
  42. package/dist/content-layer/database/invalidation.js +26 -26
  43. package/dist/content-layer/ingest/finalize-phase.js +1 -1
  44. package/dist/content-layer/ingest/normalize-artifacts.js +1 -1
  45. package/dist/content-layer/ingest/run.js +1 -1
  46. package/dist/content-layer/ingest/search-sync.js +1 -1
  47. package/dist/content-layer/ingest/sync.js +1 -1
  48. package/dist/content-layer/link-checker/load-view.js +1 -1
  49. package/dist/content-layer/link-checker/validate.js +1 -1
  50. package/dist/content-layer/loaders/context.js +1 -1
  51. package/dist/content-layer/markdown/client/markdown-text.js +1 -1
  52. package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
  53. package/dist/content-layer/markdown/constants/markdown-text-tag-set.js +1 -1
  54. package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
  55. package/dist/content-layer/markdown/nodes/heading.js +1 -1
  56. package/dist/content-layer/markdown/resolve/ast.js +1 -1
  57. package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.js +1 -1
  58. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
  59. package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
  60. package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
  61. package/dist/content-layer/markdown/resolve/references.js +1 -1
  62. package/dist/content-layer/markdown/search/to-markdown.js +1 -1
  63. package/dist/content-layer/markdown/search/to-sections.js +1 -1
  64. package/dist/content-layer/markdown/server/render.js +1 -1
  65. package/dist/content-layer/markdown/service.js +1 -1
  66. package/dist/content-layer/markdown/tags/partial.d.ts +7 -2
  67. package/dist/content-layer/markdown/tags/partial.js +1 -1
  68. package/dist/content-layer/markdown/tags/variant.js +1 -1
  69. package/dist/content-layer/markdown/types/service.d.ts +2 -0
  70. package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
  71. package/dist/content-layer/markdown/utils/reparse-example-fences.d.ts +4 -1
  72. package/dist/content-layer/markdown/utils/reparse-example-fences.js +1 -1
  73. package/dist/content-layer/markdown/utils/substitute-variables.js +1 -1
  74. package/dist/content-layer/markdown/utils/walk-markdoc-ast.d.ts +2 -2
  75. package/dist/content-layer/markdown/utils/walk-markdoc-ast.js +1 -1
  76. package/dist/content-layer/plugins/index.js +1 -1
  77. package/dist/content-layer/plugins/internal/api-docs/client/template.js +2 -2
  78. package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
  79. package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.js +13 -13
  80. package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
  81. package/dist/content-layer/plugins/internal/app-data/banner.js +1 -1
  82. package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
  83. package/dist/content-layer/plugins/internal/catalog-classic/client/use-catalog-classic.js +1 -1
  84. package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
  85. package/dist/content-layer/plugins/internal/index.js +1 -1
  86. package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
  87. package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
  88. package/dist/content-layer/plugins/internal/mcp/constants.d.ts +6 -0
  89. package/dist/content-layer/plugins/internal/mcp/constants.js +1 -1
  90. package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
  91. package/dist/content-layer/plugins/internal/mcp/ignored-routes.js +1 -1
  92. package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
  93. package/dist/content-layer/plugins/internal/mcp/server/codemode/capabilities.js +3 -3
  94. package/dist/content-layer/plugins/internal/mcp/server/codemode/constants.js +1 -1
  95. package/dist/content-layer/plugins/internal/mcp/server/codemode/discover.js +1 -1
  96. package/dist/content-layer/plugins/internal/mcp/server/codemode/execute-schema.js +1 -1
  97. package/dist/content-layer/plugins/internal/mcp/server/codemode/execution-budget.js +1 -0
  98. package/dist/content-layer/plugins/internal/mcp/server/codemode/index.js +1 -1
  99. package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
  100. package/dist/content-layer/plugins/internal/mcp/server/codemode/read-result.js +1 -0
  101. package/dist/content-layer/plugins/internal/mcp/server/codemode/return-last-expression.js +6 -0
  102. package/dist/content-layer/plugins/internal/mcp/server/codemode/returns-from-top-level.js +1 -0
  103. package/dist/content-layer/plugins/internal/mcp/server/codemode/sandbox.js +1 -1
  104. package/dist/content-layer/plugins/internal/mcp/server/codemode/tool-declarations.js +4 -0
  105. package/dist/content-layer/plugins/internal/mcp/server/codemode/tool-list.js +1 -1
  106. package/dist/content-layer/plugins/internal/mcp/server/codemode/unknown-tool-hint.js +3 -0
  107. package/dist/content-layer/plugins/internal/mcp/server/gateway/api-call-operations.js +1 -1
  108. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/site-branding.js +1 -1
  109. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
  110. package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +6 -6
  111. package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
  112. package/dist/content-layer/plugins/internal/mcp/server/gateway/subject.js +1 -1
  113. package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
  114. package/dist/content-layer/plugins/internal/mcp/server/gateway/upstream-auth-scheme.js +2 -2
  115. package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
  116. package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
  117. package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
  118. package/dist/content-layer/plugins/internal/mcp/server/rate-limit.js +1 -1
  119. package/dist/content-layer/plugins/internal/mcp/server/server-info.js +1 -1
  120. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql-constants.js +1 -0
  121. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql-document.js +1 -1
  122. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql.js +1 -1
  123. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-catalog.js +1 -1
  124. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-document.js +1 -1
  125. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi.js +1 -1
  126. package/dist/content-layer/plugins/internal/mcp/server/tools/pages-constants.js +1 -0
  127. package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
  128. package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +3 -3
  129. package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -0
  130. package/dist/content-layer/plugins/internal/mcp/server/tools/search.js +1 -1
  131. package/dist/content-layer/plugins/internal/mcp/server/tools/submit-feedback.js +1 -1
  132. package/dist/content-layer/plugins/internal/mcp/server/tools/whoami.js +1 -1
  133. package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
  134. package/dist/content-layer/plugins/internal/scorecard-classic/index.js +1 -1
  135. package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
  136. package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
  137. package/dist/content-layer/plugins/internal/skills/index.js +1 -1
  138. package/dist/content-layer/plugins/project/load.js +2 -2
  139. package/dist/content-layer/plugins/utils/link-access.js +1 -1
  140. package/dist/content-layer/plugins/utils/route-index.js +1 -1
  141. package/dist/content-layer/versions/redirect.js +1 -1
  142. package/dist/content-layer/versions/resolve.js +1 -1
  143. package/dist/server/__tests__/rbac-fixture.js +1 -1
  144. package/dist/server/app.js +3 -3
  145. package/dist/server/ask-ai/route.js +1 -1
  146. package/dist/server/auth/middleware.js +1 -1
  147. package/dist/server/auth/request.js +1 -1
  148. package/dist/server/auth/routes.js +1 -1
  149. package/dist/server/constants/system-routes.js +1 -1
  150. package/dist/server/content.js +13 -13
  151. package/dist/server/cors-proxy/handler.js +1 -1
  152. package/dist/server/feedback/route.js +1 -1
  153. package/dist/server/lambda-entry.js +1 -1
  154. package/dist/server/manifest-assets.js +4 -4
  155. package/dist/server/node-entry.js +1 -1
  156. package/dist/server/plugin-context.js +1 -1
  157. package/dist/server/rbac/l10n-rules.js +1 -1
  158. package/dist/server/rbac/team-templates.js +1 -1
  159. package/dist/server/search/route.js +1 -1
  160. package/dist/server/seo-tags.js +2 -2
  161. package/dist/server/static-files/serve.js +1 -1
  162. package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
  163. package/package.json +2 -4
@@ -1 +1 @@
1
- import{jsonExampleTag as e,jsonSchemaTag as t,openapiCodeSampleTag as n,openapiExampleTag as r,openapiResponseSampleTag as i,replayOpenapiTag as a}from"../tags/openapi.js";import{codeSnippetTag as o}from"../tags/code-snippet.js";import{diagramTag as s}from"../tags/diagram.js";import{html as c}from"../tags/html.js";import{MARKDOC_ERROR_TAG as l,markdocError as u}from"../tags/markdoc-error.js";import{partial as d}from"../tags/partial.js";import{variant as f}from"../tags/variant.js";import{fence as p}from"../nodes/fence.js";import{heading as m}from"../nodes/heading.js";import{item as h}from"../nodes/gfm-list-item.js";import{table as g,td as _,th as v}from"../nodes/table.js";import{text as y}from"../nodes/text.js";import{VARIANT_TAG as b}from"@redocly/theme/markdoc/tags/variant";import x from"@redocly/markdoc";import{accordion as S}from"@redocly/theme/markdoc/tags/accordion";import{accordionGroup as C}from"@redocly/theme/markdoc/tags/accordion-group";import{admonition as w}from"@redocly/theme/markdoc/tags/admonition";import{card as T}from"@redocly/theme/markdoc/tags/card";import{cards as E}from"@redocly/theme/markdoc/tags/cards";import{codeGroup as D}from"@redocly/theme/markdoc/tags/code-group";import{codeStep as O}from"@redocly/theme/markdoc/tags/code-step";import{toggle as k}from"@redocly/theme/markdoc/tags/code-toggle";import{codeWalkthrough as A}from"@redocly/theme/markdoc/tags/code-walkthrough";import{connectMcp as j}from"@redocly/theme/markdoc/tags/connect-mcp";import{debug as M}from"@redocly/theme/markdoc/tags/debug";import{experiment as N}from"@redocly/theme/markdoc/tags/experiment";import{icon as P}from"@redocly/theme/markdoc/tags/icon";import{img as F}from"@redocly/theme/markdoc/tags/img";import{inlineSvg as I}from"@redocly/theme/markdoc/tags/inline-svg";import{input as L}from"@redocly/theme/markdoc/tags/input";import{loginButton as R}from"@redocly/theme/markdoc/tags/login-button";import{markdocExample as z}from"@redocly/theme/markdoc/tags/markdoc-example";import{numberedItem as B}from"@redocly/theme/markdoc/tags/numbered-item";import{numberedList as V}from"@redocly/theme/markdoc/tags/numbered-list";import{prompt as H}from"@redocly/theme/markdoc/tags/prompt";import{tab as U}from"@redocly/theme/markdoc/tags/tab";import{tabs as W}from"@redocly/theme/markdoc/tags/tabs";import{visibility as G}from"@redocly/theme/markdoc/tags/visibility";const K=[A.tagName,O.tagName,k.tagName,L.tagName],q={[S.tagName]:S.schema,[C.tagName]:C.schema,[w.tagName]:w.schema,[T.tagName]:T.schema,[E.tagName]:E.schema,[D.tagName]:D.schema,"code-snippet":o,[O.tagName]:O.schema,[A.tagName]:A.schema,[j.tagName]:j.schema,[M.tagName]:M.schema,diagram:s,[N.tagName]:N.schema,html:c,[P.tagName]:P.schema,[F.tagName]:F.schema,[I.tagName]:I.schema,[L.tagName]:L.schema,"json-example":e,"json-schema":t,[R.tagName]:R.schema,[l]:u,[z.tagName]:z.schema,[B.tagName]:B.schema,[V.tagName]:V.schema,"openapi-code-sample":n,"openapi-example":r,"openapi-response-sample":i,partial:d,[H.tagName]:H.schema,"replay-openapi":a,[U.tagName]:U.schema,[W.tagName]:W.schema,[k.tagName]:k.schema,[b]:f,[G.tagName]:G.schema},J=(e,t)=>({...e,children:[...e.children??[],...t]}),Y={link:J({...x.nodes.link,render:`MarkdownLink`},[`softbreak`,`image`]),strong:J(x.nodes.strong,[`softbreak`,`em`,`strong`]),em:J(x.nodes.em,[`softbreak`,`em`,`strong`]),s:J(x.nodes.s,[`softbreak`]),image:{...x.nodes.image,render:`Image`},fence:p,heading:m,item:h,table:g,td:_,th:v,text:y};export{K as CODE_WALKTHROUGH_TAG_NAMES,Y as builtInMarkdocNodes,q as builtInMarkdocTags};
1
+ import{jsonExampleTag as e,jsonSchemaTag as t,openapiCodeSampleTag as n,openapiExampleTag as r,openapiResponseSampleTag as i,replayOpenapiTag as a}from"../tags/openapi.js";import{codeSnippetTag as o}from"../tags/code-snippet.js";import{diagramTag as s}from"../tags/diagram.js";import{html as c}from"../tags/html.js";import{MARKDOC_ERROR_TAG as l,markdocError as u}from"../tags/markdoc-error.js";import{partial as d}from"../tags/partial.js";import{variant as f}from"../tags/variant.js";import{fence as p}from"../nodes/fence.js";import{heading as m}from"../nodes/heading.js";import{item as h}from"../nodes/gfm-list-item.js";import{table as g,td as _,th as v}from"../nodes/table.js";import{text as y}from"../nodes/text.js";import b from"@redocly/markdoc";import{accordion as x}from"@redocly/theme/markdoc/tags/accordion";import{accordionGroup as S}from"@redocly/theme/markdoc/tags/accordion-group";import{admonition as C}from"@redocly/theme/markdoc/tags/admonition";import{card as w}from"@redocly/theme/markdoc/tags/card";import{cards as T}from"@redocly/theme/markdoc/tags/cards";import{codeGroup as E}from"@redocly/theme/markdoc/tags/code-group";import{codeStep as D}from"@redocly/theme/markdoc/tags/code-step";import{toggle as O}from"@redocly/theme/markdoc/tags/code-toggle";import{codeWalkthrough as k}from"@redocly/theme/markdoc/tags/code-walkthrough";import{connectMcp as A}from"@redocly/theme/markdoc/tags/connect-mcp";import{debug as j}from"@redocly/theme/markdoc/tags/debug";import{experiment as M}from"@redocly/theme/markdoc/tags/experiment";import{icon as N}from"@redocly/theme/markdoc/tags/icon";import{img as P}from"@redocly/theme/markdoc/tags/img";import{inlineSvg as F}from"@redocly/theme/markdoc/tags/inline-svg";import{input as I}from"@redocly/theme/markdoc/tags/input";import{loginButton as L}from"@redocly/theme/markdoc/tags/login-button";import{markdocExample as R}from"@redocly/theme/markdoc/tags/markdoc-example";import{numberedItem as z}from"@redocly/theme/markdoc/tags/numbered-item";import{numberedList as B}from"@redocly/theme/markdoc/tags/numbered-list";import{prompt as V}from"@redocly/theme/markdoc/tags/prompt";import{tab as H}from"@redocly/theme/markdoc/tags/tab";import{tabs as U}from"@redocly/theme/markdoc/tags/tabs";import{VARIANT_TAG as W}from"@redocly/theme/markdoc/tags/variant";import{visibility as G}from"@redocly/theme/markdoc/tags/visibility";const K=[k.tagName,D.tagName,O.tagName,I.tagName],q={[x.tagName]:x.schema,[S.tagName]:S.schema,[C.tagName]:C.schema,[w.tagName]:w.schema,[T.tagName]:T.schema,[E.tagName]:E.schema,"code-snippet":o,[D.tagName]:D.schema,[k.tagName]:k.schema,[A.tagName]:A.schema,[j.tagName]:j.schema,diagram:s,[M.tagName]:M.schema,html:c,[N.tagName]:N.schema,[P.tagName]:P.schema,[F.tagName]:F.schema,[I.tagName]:I.schema,"json-example":e,"json-schema":t,[L.tagName]:L.schema,[l]:u,[R.tagName]:R.schema,[z.tagName]:z.schema,[B.tagName]:B.schema,"openapi-code-sample":n,"openapi-example":r,"openapi-response-sample":i,partial:d,[V.tagName]:V.schema,"replay-openapi":a,[H.tagName]:H.schema,[U.tagName]:U.schema,[O.tagName]:O.schema,[W]:f,[G.tagName]:G.schema},J=(e,t)=>({...e,children:[...e.children??[],...t]}),Y={link:J({...b.nodes.link,render:`MarkdownLink`},[`softbreak`,`image`]),strong:J(b.nodes.strong,[`softbreak`,`em`,`strong`]),em:J(b.nodes.em,[`softbreak`,`em`,`strong`]),s:J(b.nodes.s,[`softbreak`]),image:{...b.nodes.image,render:`Image`},fence:p,heading:m,item:h,table:g,td:_,th:v,text:y};export{K as CODE_WALKTHROUGH_TAG_NAMES,Y as builtInMarkdocNodes,q as builtInMarkdocTags};
@@ -1 +1 @@
1
- import{builtInMarkdocFunctions as e}from"./builtin-functions.js";import{builtInMarkdocNodes as t,builtInMarkdocTags as n}from"./builtin-tags.js";import{isSchemaLike as r}from"./tag-sets.js";import{getAttributeBuildTimeResolver as i}from"../resolve/attribute-resolver-key.js";import a from"@redocly/markdoc";const o=/* @__PURE__ */ new Set([`codeSnippetFile`,`svgContent`,`tagRawContent`,`codeWalkthroughFilesets`,`partialFile`,`jsonSchemaRef`,`sampleFromJsonSchema`,`jsonExampleRef`,`openapiCodeSamples`,`openapiCodeSamplePanel`,`openapiReplay`,`openapiResponseSamples`,`openapiResponsePanel`,`openapiExample`]),s=/* @__PURE__ */ new Set([`diagram`]);function c(e){return Object.values(e.attributes??{}).some(e=>i(e)!==null)}function l(e,t){return s.has(e)||Object.values(t.attributes??{}).some(e=>{let t=i(e);return t!==null&&o.has(t)})}function u(e){return{transform:()=>new a.Tag(`Admonition`,{type:`danger`},[`The "${e}" tag is not available in inline markdown.`])}}function d(i){let o={};for(let[e,t]of Object.entries(n))o[e]=l(e,t)?u(e):t;let s={...t};for(let[e,t]of[[`tags`,o],[`nodes`,s]])for(let[n,a]of Object.entries(i?.[e]??{}))r(a)&&!c(a)&&(t[n]=a);return o[`ai-citation`]={render:`AiCitation`,selfClosing:!0,attributes:{number:{type:Number,required:!0},url:{type:String,required:!0}}},s.document={...a.nodes.document,render:`div`},{tags:o,nodes:s,functions:{...i?.functions,...e}}}export{d as buildMarkdownTextTagSet};
1
+ import{builtInMarkdocNodes as e,builtInMarkdocTags as t}from"./builtin-tags.js";import{getAttributeBuildTimeResolver as n}from"../resolve/attribute-resolver-key.js";import{builtInMarkdocFunctions as r}from"./builtin-functions.js";import{isSchemaLike as i}from"./tag-sets.js";import a from"@redocly/markdoc";const o=/* @__PURE__ */ new Set([`codeSnippetFile`,`svgContent`,`tagRawContent`,`codeWalkthroughFilesets`,`partialFile`,`jsonSchemaRef`,`sampleFromJsonSchema`,`jsonExampleRef`,`openapiCodeSamples`,`openapiCodeSamplePanel`,`openapiReplay`,`openapiResponseSamples`,`openapiResponsePanel`,`openapiExample`]),s=/* @__PURE__ */ new Set([`diagram`]);function c(e){return Object.values(e.attributes??{}).some(e=>n(e)!==null)}function l(e,t){return s.has(e)||Object.values(t.attributes??{}).some(e=>{let t=n(e);return t!==null&&o.has(t)})}function u(e){return{transform:()=>new a.Tag(`Admonition`,{type:`danger`},[`The "${e}" tag is not available in inline markdown.`])}}function d(n){let o={};for(let[e,n]of Object.entries(t))o[e]=l(e,n)?u(e):n;let s={...e};for(let[e,t]of[[`tags`,o],[`nodes`,s]])for(let[r,a]of Object.entries(n?.[e]??{}))i(a)&&!c(a)&&(t[r]=a);return o[`ai-citation`]={render:`AiCitation`,selfClosing:!0,attributes:{number:{type:Number,required:!0},url:{type:String,required:!0}}},s.document={...a.nodes.document,render:`div`},{tags:o,nodes:s,functions:{...n?.functions,...r}}}export{d as buildMarkdownTextTagSet};
@@ -1 +1 @@
1
- import{builtInMarkdocFunctions as e}from"./builtin-functions.js";import{builtInMarkdocNodes as t,builtInMarkdocTags as n}from"./builtin-tags.js";const r=`@theme/markdoc/schema.ts`;let i,a,o=!1;function s(e,t,n){globalThis.__REALM_MARKDOC_USER_SCHEMA__=e,i=t,a=n,o=!1}function c(e){s(void 0,void 0,e),o=!0}function l(){return a}function u(){return Object.keys(globalThis.__REALM_MARKDOC_USER_SCHEMA__?.tags??{})}function d(){return a!==void 0&&!o}function f(){return i}const p=`builtin`,m=`api-docs`,h={[m]:async()=>{let{apiDocsMarkdocNodes:e,apiDocsMarkdocTags:t}=await import(`@redocly/api-docs/lib/components/markdoc/defaultMarkdocConfig.js`);return{tags:t,nodes:e}}},g=/* @__PURE__ */ new Map;let _;const v=/* @__PURE__ */ new Set,y=e=>!!e&&typeof e==`object`;function b(t,n){let r={tags:{...t.tags},nodes:{...t.nodes},functions:{...e,...t.functions}};for(let e of[`tags`,`nodes`,`functions`])for(let[t,i]of Object.entries(n[e]??{}))if(y(i)){if(e===`functions`&&t in r.functions){v.has(t)||(v.add(t),console.warn(`[markdoc] The user schema defines the "${t}" function, but the engine already defines it. The engine function is used.`));continue}r[e][t]=i}return r}async function x(r){let i=globalThis.__REALM_MARKDOC_USER_SCHEMA__;i!==_&&(_=i,g.clear(),v.clear());let a=r??`builtin`,o=g.get(a);if(o)return o;let s={tags:n,nodes:t,functions:e};if(i&&(s=b(s,i)),a!==`builtin`){let e=await h[a]?.();if(!e)throw Error(`Unknown markdoc tag set "${a}".`);s={tags:{...s.tags,...e.tags},nodes:{...s.nodes,...e.nodes},functions:{...s.functions,...e.functions}}}return g.set(a,s),s}const S=`page-validation`;async function C(){let e=await x(),t=await x(m),n=g.get(S);if(n)return n;let r={...t,tags:{...t.tags,...e.tags},nodes:{...t.nodes,...e.nodes}};return g.set(S,r),r}export{m as API_DOCS_MARKDOC_TAG_SET,p as BUILTIN_MARKDOC_TAG_SET,r as USER_MARKDOC_SCHEMA_FILE,d as isMarkdocValidationEnabled,y as isSchemaLike,s as registerUserMarkdocSchema,c as registerUserMarkdocSchemaFailure,x as resolveMarkdocTagSet,C as resolveMarkdownPageValidationSet,f as userMarkdocSchemaDigest,l as userMarkdocSchemaFiles,u as userMarkdocTagNames};
1
+ import{builtInMarkdocNodes as e,builtInMarkdocTags as t}from"./builtin-tags.js";import{builtInMarkdocFunctions as n}from"./builtin-functions.js";const r=`@theme/markdoc/schema.ts`;let i,a,o=!1;function s(e,t,n){globalThis.__REALM_MARKDOC_USER_SCHEMA__=e,i=t,a=n,o=!1}function c(e){s(void 0,void 0,e),o=!0}function l(){return a}function u(){return Object.keys(globalThis.__REALM_MARKDOC_USER_SCHEMA__?.tags??{})}function d(){return a!==void 0&&!o}function f(){return i}const p=`builtin`,m=`api-docs`,h={[m]:async()=>{let{apiDocsMarkdocNodes:e,apiDocsMarkdocTags:t}=await import(`@redocly/api-docs/lib/components/markdoc/defaultMarkdocConfig.js`);return{tags:t,nodes:e}}},g=/* @__PURE__ */ new Map;let _;const v=/* @__PURE__ */ new Set,y=e=>!!e&&typeof e==`object`;function b(e,t){let r={tags:{...e.tags},nodes:{...e.nodes},functions:{...n,...e.functions}};for(let e of[`tags`,`nodes`,`functions`])for(let[n,i]of Object.entries(t[e]??{}))if(y(i)){if(e===`functions`&&n in r.functions){v.has(n)||(v.add(n),console.warn(`[markdoc] The user schema defines the "${n}" function, but the engine already defines it. The engine function is used.`));continue}r[e][n]=i}return r}async function x(r){let i=globalThis.__REALM_MARKDOC_USER_SCHEMA__;i!==_&&(_=i,g.clear(),v.clear());let a=r??`builtin`,o=g.get(a);if(o)return o;let s={tags:t,nodes:e,functions:n};if(i&&(s=b(s,i)),a!==`builtin`){let e=await h[a]?.();if(!e)throw Error(`Unknown markdoc tag set "${a}".`);s={tags:{...s.tags,...e.tags},nodes:{...s.nodes,...e.nodes},functions:{...s.functions,...e.functions}}}return g.set(a,s),s}const S=`page-validation`;async function C(){let e=await x(),t=await x(m),n=g.get(S);if(n)return n;let r={...t,tags:{...t.tags,...e.tags},nodes:{...t.nodes,...e.nodes}};return g.set(S,r),r}export{m as API_DOCS_MARKDOC_TAG_SET,p as BUILTIN_MARKDOC_TAG_SET,r as USER_MARKDOC_SCHEMA_FILE,d as isMarkdocValidationEnabled,y as isSchemaLike,s as registerUserMarkdocSchema,c as registerUserMarkdocSchemaFailure,x as resolveMarkdocTagSet,C as resolveMarkdownPageValidationSet,f as userMarkdocSchemaDigest,l as userMarkdocSchemaFiles,u as userMarkdocTagNames};
@@ -1 +1 @@
1
- import{getInnerText as e}from"../utils/get-inner-text.js";import{headingSlugger as t}from"../utils/heading-slugger.js";import n from"@redocly/markdoc";const r={children:[`inline`],attributes:{id:{type:String},level:{type:Number,required:!0,default:1}},transform(r,i){let a=r.transformAttributes(i),o=r.transformChildren(i),s=typeof a.id==`string`?t.explicit(a.id):t.slug(e(o));return new n.Tag(`Heading`,{...a,id:s,level:r.attributes.level},o)}};export{r as heading};
1
+ import{headingSlugger as e}from"../utils/heading-slugger.js";import{getInnerText as t}from"../utils/get-inner-text.js";import n from"@redocly/markdoc";const r={children:[`inline`],attributes:{id:{type:String},level:{type:Number,required:!0,default:1}},transform(r,i){let a=r.transformAttributes(i),o=r.transformChildren(i),s=typeof a.id==`string`?e.explicit(a.id):e.slug(t(o));return new n.Tag(`Heading`,{...a,id:s,level:r.attributes.level},o)}};export{r as heading};
@@ -1 +1 @@
1
- import{markdocNodeRange as e}from"../utils/node-source-range.js";import{builtInMarkdocTags as t}from"../constants/builtin-tags.js";import{getExampleContent as n,walkWithExampleContent as r}from"../utils/reparse-example-fences.js";import{parseMarkdownDocument as i}from"../utils/parse-cache.js";import{substituteStaticVariables as a}from"../utils/substitute-variables.js";import{collectMarkdocTagNames as o,isPromptTag as s,resolveMarkdocBuildTimeAttributes as c}from"./markdoc.js";import{inlineRawPartials as l}from"./raw-partials.js";import{renderMarkdocDiagrams as u}from"./render-diagrams.js";import d from"@redocly/markdoc";const f=/* @__PURE__ */ new Set([`parse-error`,`missing-opening`,`missing-closing`,`fence-tag-error`,`no-inline-annotations`]);async function p(e,n,r){let s=await l(e,n,r.resolverContext),f=i(s.source),p=r.validation?v(f,n,h(r.validation)):[],{entityDeps:m,assetUsages:g,linkRefs:_,problems:y}=await c(f,{tags:r.tags??t,sourceFilePath:n,resolverContext:r.resolverContext,source:s.source});r.variables&&a(f,r.variables);let x=await u(f,n,r.resolverContext.logger),S=b(f,n),C=r.transform?.(f)??[];return{ast:d.compact(f),entityDeps:[...s.entityDeps,...m],assetUsages:g,linkRefs:_,tagList:o(f),problems:[...s.problems,...y,...S,...p,...C,...x]}}const m=/* @__PURE__ */ new WeakMap;function h(e){let t=m.get(e);return t===void 0&&(t=d.prepareConfig({...e,tags:g(e.tags),nodes:g(e.nodes)}),m.set(e,t)),t}function g(e){if(e!==void 0)return Object.fromEntries(Object.entries(e).map(([e,t])=>{let{validate:n}=t;return n===void 0?[e,t]:[e,{...t,validate(e,t){try{return n.call(this,e,t)}catch(t){return[{id:`validate-failed`,level:`error`,message:`The validate() of '${e.tag??e.type}' failed: ${_(t)}`}]}}}]}))}const _=e=>e instanceof Error?e.message:String(e);function v(e,t,i){let a=[e],o=/* @__PURE__ */ new Set,c=[];for(let t of r(e,s)){for(let e of t.errors??[])o.add(e);let e=n(t);e&&a.push(e),s(t)&&c.push({node:t,children:t.children})}for(let e of c)e.node.children=[];try{return a.flatMap(e=>d.validate(e,i)).filter(e=>!o.has(e.error)).map(e=>y(e,t))}catch(e){return[{code:`markdoc/validation-error`,message:`Markdoc validation failed: ${_(e)}`,location:{filePath:t,range:{start:{line:1},end:{line:1}}}}]}finally{for(let e of c)e.node.children=e.children}}function y(t,n){let{level:r,message:i}=t.error,a={code:`markdoc/validation-error`,message:i,location:{filePath:n,range:e(t)??{start:{line:1},end:{line:1}}}};return r!==`error`&&r!==`critical`&&(a.severity=`warning`),a}function b(t,n){let i=[];for(let a of r(t))for(let t of a.errors){let r=f.has(t.id)?`markdoc/parse-error`:`markdoc/validation-error`;i.push({code:r,message:t.message,location:{filePath:n,range:e(a)??{start:{line:1},end:{line:1}}}})}return i}export{p as resolveMarkdownAst};
1
+ import{isObject as e}from"../../../shared/utils/is-object.js";import{markdocNodeRange as t}from"../utils/node-source-range.js";import{PARTIAL_L10N_ATTRIBUTE as n}from"../tags/partial.js";import{builtInMarkdocTags as r}from"../constants/builtin-tags.js";import{walkMarkdocAst as i}from"../utils/walk-markdoc-ast.js";import{getExampleContent as a,walkWithExampleContent as o}from"../utils/reparse-example-fences.js";import{parseMarkdownDocument as s}from"../utils/parse-cache.js";import{substituteStaticVariables as c}from"../utils/substitute-variables.js";import{collectMarkdocTagNames as l,isPromptTag as u,resolveMarkdocBuildTimeAttributes as d}from"./markdoc.js";import{inlineRawPartials as f}from"./raw-partials.js";import{renderMarkdocDiagrams as p}from"./render-diagrams.js";import m from"@redocly/markdoc";const h=/* @__PURE__ */ new Set([`parse-error`,`missing-opening`,`missing-closing`,`fence-tag-error`,`no-inline-annotations`]);async function g(e,t,n){let i=await f(e,t,n.resolverContext),a=s(i.source),o=n.validation?x(a,t,v(n.validation)):[],{entityDeps:u,assetUsages:h,linkRefs:g,problems:_}=await d(a,{tags:n.tags??r,sourceFilePath:t,resolverContext:n.resolverContext,source:i.source});n.variables&&c(a,n.variables);let y=await p(a,t,n.resolverContext.logger),b=w(a,t),S=n.transform?.(a)??[];return C(a),{ast:m.compact(a),entityDeps:[...i.entityDeps,...u],assetUsages:h,linkRefs:g,tagList:l(a),problems:[...i.problems,..._,...b,...o,...S,...y]}}const _=/* @__PURE__ */ new WeakMap;function v(e){let t=_.get(e);return t===void 0&&(t=m.prepareConfig({...e,tags:y(e.tags),nodes:y(e.nodes)}),_.set(e,t)),t}function y(e){if(e!==void 0)return Object.fromEntries(Object.entries(e).map(([e,t])=>{let{validate:n}=t;return n===void 0?[e,t]:[e,{...t,validate(e,t){try{return n.call(this,e,t)}catch(t){return[{id:`validate-failed`,level:`error`,message:`The validate() of '${e.tag??e.type}' failed: ${b(t)}`}]}}}]}))}const b=e=>e instanceof Error?e.message:String(e);function x(e,t,n){let r=[e],i=/* @__PURE__ */ new Set,s=[];for(let t of o(e,u)){for(let e of t.errors??[])i.add(e);let e=a(t);e&&r.push(e),u(t)&&s.push({node:t,children:t.children})}for(let e of s)e.node.children=[];try{return r.flatMap(e=>m.validate(e,n)).filter(e=>!i.has(e.error)).map(e=>S(e,t))}catch(e){return[{code:`markdoc/validation-error`,message:`Markdoc validation failed: ${b(e)}`,location:{filePath:t,range:{start:{line:1},end:{line:1}}}}]}finally{for(let e of s)e.node.children=e.children}}function S(e,n){let{level:r,message:i}=e.error,a={code:`markdoc/validation-error`,message:i,location:{filePath:n,range:t(e)??{start:{line:1},end:{line:1}}}};return r!==`error`&&r!==`critical`&&(a.severity=`warning`),a}function C(t){for(let r of i(t)){let t=r.tag===`partial`?r.attributes[n]:void 0;e(t)&&(r.attributes[n]=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,m.compact(t)])))}}function w(e,n){let r=[];for(let i of o(e))for(let e of i.errors){let a=h.has(e.id)?`markdoc/parse-error`:`markdoc/validation-error`;r.push({code:a,message:e.message,location:{filePath:n,range:t(i)??{start:{line:1},end:{line:1}}}})}return r}export{g as resolveMarkdownAst};
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../shared/utils/is-object.js";import{markdocNodeProblem as t}from"../../utils/node-source-range.js";import{toContainedContentPath as n}from"../../../ingest/scan.js";import{resolveResolverTarget as r}from"./context-paths.js";import{join as i}from"node:path";async function a(e,t){let{bundle:n,createConfig:r,Source:a}=await import(`@redocly/openapi-core`),s=JSON.parse(JSON.stringify({openapi:`3.1.0`,components:{schemas:{__root:t}}})),c=i(e.contentDir,e.sourceFilePath),l=await n({config:await r({}),doc:{source:new a(c,``),parsed:s}}),u=l.bundle.parsed,d=u.components?.schemas,f=d?.__root?.$ref,p=typeof f==`string`?f.split(`/`).at(-1):void 0;return{oas:u,schema:p?d?.[p]:d?.__root,errors:(l.problems??[]).slice(0,1).map(e=>e.message),fileDeps:o(l.fileDependencies,e.contentDir,c)}}function o(e,t,r){if(e===void 0)return[];let i=/* @__PURE__ */ new Set;for(let a of e){let e=n(t,a);a!==r&&e!==null&&i.add(e)}return[...i].sort()}function s(e,t=[]){return e.length>0||t.length>0?{entityDeps:e.map(e=>({kind:`file`,path:e})),problems:t}:null}function c(e,n){let{node:r,attributeName:i}=e;return r.attributes[`${i}ResolvedErrors`]=n,e.logger?.warn(`${r.tag} in ${e.sourceFilePath}: ${n[0]}`),t(r,n[0],e.sourceFilePath)}async function l(t){let{node:n,attributeName:r}=t,i=n.attributes[r];if(!e(i))return null;let{oas:o,errors:l,fileDeps:u}=await a(t,i);return n.attributes[`${r}Resolved`]=o,l.length>0?s(u,[c(t,l)]):s(u)}async function u(t){let{node:n,attributeName:r}=t,i=n.attributes[r];if(!e(i)||n.attributes.value!==void 0)return null;let{oas:o,schema:l,errors:u,fileDeps:d}=await a(t,i);if(u.length>0)return s(d,[c(t,u)]);let f=n.attributes.mode,p=await import(`openapi-sampler`);try{n.attributes[`${r}Resolved`]=p.sample(l,{...f===`read`?{skipWriteOnly:!0}:void 0,...f===`write`?{skipReadOnly:!0}:void 0},o)}catch(e){return s(d,[c(t,[`Failed to generate a sample from the schema: ${e?.message??e}`])])}return s(d)}async function d(t){let{node:n,attributeName:i}=t,a=n.attributes[i],o=e=>({problems:[c(t,[e])]});if(a!==void 0&&n.attributes.schema!==void 0)return o(`The "schema" and "value" attributes are mutually exclusive, use only one.`);if(a===void 0)return n.attributes.schema===void 0?o(`The tag requires a "schema" or "value" attribute.`):null;let s=e(a)?a.$ref:void 0;if(typeof s!=`string`)return n.attributes[`${i}Resolved`]=a,null;let[l,u]=s.split(`#`),d=l?r(t,l):null;if(d===null||t.io===void 0)return o(`Invalid $ref "${s}": the path must stay inside the content directory.`);if(!await t.io.exists(d.absolutePath))return o(`Invalid $ref: no such file ${d.contentPath}`);let p=await t.io.readFile(d.absolutePath),m=[{kind:`file`,path:d.contentPath}],h;try{h=(await import(`js-yaml`)).load(p)}catch(e){return{entityDeps:m,...o(`File ${d.contentPath} must be valid JSON or YAML: ${e.message}`)}}let g=u?f(h,u):h;return u&&g===void 0?{entityDeps:m,...o(`Invalid $ref: ${d.contentPath} has no value at #${u}`)}:(n.attributes[`${i}Resolved`]=g,{entityDeps:m})}function f(t,n){let r=t;for(let t of n.split(`/`).slice(+!!n.startsWith(`/`))){let n=t.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(Array.isArray(r))r=r[Number(n)];else if(e(r))r=r[n];else return}return r}export{d as resolveJsonExampleRefAttribute,l as resolveJsonSchemaRefAttribute,u as resolveSampleFromJsonSchemaAttribute};
1
+ import{isObject as e}from"../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../ingest/scan.js";import{markdocNodeProblem as n}from"../../utils/node-source-range.js";import{resolveResolverTarget as r}from"./context-paths.js";import{join as i}from"node:path";async function a(e,t){let{bundle:n,createConfig:r,Source:a}=await import(`@redocly/openapi-core`),s=JSON.parse(JSON.stringify({openapi:`3.1.0`,components:{schemas:{__root:t}}})),c=i(e.contentDir,e.sourceFilePath),l=await n({config:await r({}),doc:{source:new a(c,``),parsed:s}}),u=l.bundle.parsed,d=u.components?.schemas,f=d?.__root?.$ref,p=typeof f==`string`?f.split(`/`).at(-1):void 0;return{oas:u,schema:p?d?.[p]:d?.__root,errors:(l.problems??[]).slice(0,1).map(e=>e.message),fileDeps:o(l.fileDependencies,e.contentDir,c)}}function o(e,n,r){if(e===void 0)return[];let i=/* @__PURE__ */ new Set;for(let a of e){let e=t(n,a);a!==r&&e!==null&&i.add(e)}return[...i].sort()}function s(e,t=[]){return e.length>0||t.length>0?{entityDeps:e.map(e=>({kind:`file`,path:e})),problems:t}:null}function c(e,t){let{node:r,attributeName:i}=e;return r.attributes[`${i}ResolvedErrors`]=t,e.logger?.warn(`${r.tag} in ${e.sourceFilePath}: ${t[0]}`),n(r,t[0],e.sourceFilePath)}async function l(t){let{node:n,attributeName:r}=t,i=n.attributes[r];if(!e(i))return null;let{oas:o,errors:l,fileDeps:u}=await a(t,i);return n.attributes[`${r}Resolved`]=o,l.length>0?s(u,[c(t,l)]):s(u)}async function u(t){let{node:n,attributeName:r}=t,i=n.attributes[r];if(!e(i)||n.attributes.value!==void 0)return null;let{oas:o,schema:l,errors:u,fileDeps:d}=await a(t,i);if(u.length>0)return s(d,[c(t,u)]);let f=n.attributes.mode,p=await import(`openapi-sampler`);try{n.attributes[`${r}Resolved`]=p.sample(l,{...f===`read`?{skipWriteOnly:!0}:void 0,...f===`write`?{skipReadOnly:!0}:void 0},o)}catch(e){return s(d,[c(t,[`Failed to generate a sample from the schema: ${e?.message??e}`])])}return s(d)}async function d(t){let{node:n,attributeName:i}=t,a=n.attributes[i],o=e=>({problems:[c(t,[e])]});if(a!==void 0&&n.attributes.schema!==void 0)return o(`The "schema" and "value" attributes are mutually exclusive, use only one.`);if(a===void 0)return n.attributes.schema===void 0?o(`The tag requires a "schema" or "value" attribute.`):null;let s=e(a)?a.$ref:void 0;if(typeof s!=`string`)return n.attributes[`${i}Resolved`]=a,null;let[l,u]=s.split(`#`),d=l?r(t,l):null;if(d===null||t.io===void 0)return o(`Invalid $ref "${s}": the path must stay inside the content directory.`);if(!await t.io.exists(d.absolutePath))return o(`Invalid $ref: no such file ${d.contentPath}`);let p=await t.io.readFile(d.absolutePath),m=[{kind:`file`,path:d.contentPath}],h;try{h=(await import(`js-yaml`)).load(p)}catch(e){return{entityDeps:m,...o(`File ${d.contentPath} must be valid JSON or YAML: ${e.message}`)}}let g=u?f(h,u):h;return u&&g===void 0?{entityDeps:m,...o(`Invalid $ref: ${d.contentPath} has no value at #${u}`)}:(n.attributes[`${i}Resolved`]=g,{entityDeps:m})}function f(t,n){let r=t;for(let t of n.split(`/`).slice(+!!n.startsWith(`/`))){let n=t.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(Array.isArray(r))r=r[Number(n)];else if(e(r))r=r[n];else return}return r}export{d as resolveJsonExampleRefAttribute,l as resolveJsonSchemaRefAttribute,u as resolveSampleFromJsonSchemaAttribute};
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../shared/utils/is-object.js";import{markdocNodeProblem as t}from"../../utils/node-source-range.js";import{compileRouteAccessMatcher as n,matchContentScope as r}from"../../../../server/rbac/engine.js";import{SPEC_KIND_OPENAPI as i}from"../../../plugins/types/api-entity.js";import{createLruCache as a}from"../../../../shared/utils/lru-cache.js";import{parseMarkdownCached as o}from"../../utils/parse-cache.js";import{resolveResolverTarget as s}from"./context-paths.js";import{createApiEntityKey as c}from"../../../plugins/utils/api-entity-key.js";import{withMockServerOption as l}from"../../../plugins/internal/api-docs/server/options.js";import{annotateApiDocsRbac as u}from"../../../../server/rbac/api-docs.js";import{posix as d}from"node:path";import{REDOCLY_TEAMS_RBAC as f}from"@redocly/config";const p={curl:`shell`,JavaScript:`javascript`,"Node.js":`javascript`,Python:`python`,Java:`java`,"Java8+Apache":`java`,"C#":`csharp`,"C#+Newtonsoft":`csharp`,PHP:`php`,Go:`go`,Ruby:`ruby`,R:`r`},m=/* @__PURE__ */ new WeakMap;async function h(e){let t=m.get(e.node);t===void 0&&(t=g(e),m.set(e.node,t));let n=await t;return{definition:n.definition,problems:n.problems.splice(0)}}async function g(e){let t=e.node.attributes.descriptionFile;if(typeof t!=`string`||t===``||e.entities===void 0)return{definition:null,problems:[]};let n=s(e,t);if(n===null)return _(e,`descriptionFile "${t}" must stay inside the content directory`);let r=c(n.contentPath),i=await e.entities.get(r);return i===null||i.type!==`api`?_(e,`no API description found at ${n.contentPath}`):i.metadata?.specType===`openapi`?{definition:{contentPath:n.contentPath,document:await e.entities.load(r),metadata:i.metadata??{},dataHash:i.status===`ready`?i.dataHash??null:null},problems:[]}:_(e,`${n.contentPath} is not an OpenAPI description`)}function _(e,n){return e.logger?.warn(`${e.node.tag} in ${e.sourceFilePath}: ${n}`),e.node.attributes.descriptionFileInvalid=!0,{definition:null,problems:[t(e.node,n,e.sourceFilePath)]}}const v=(e,t)=>e.node.attributes[t]??void 0;function y(t){let n=e(t.options)?t.options:{};return e(n.mockServer)?{...n,mockServer:{...n.mockServer,position:`off`}}:n}function b(t,n){let r=v(t,`language`),i=v(t,`options`);return{...n,...i,codeSamples:{...e(n.codeSamples)?n.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function x(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{buildCodeSamples:r,getRequestBodySamples:i,normalizeOptions:a,resolveOperationSampleContext:s}=await import(`@redocly/api-docs`),c=a({specType:`openapi`,...b(e,y(t.metadata)),markdownParser:o}),l=s(t.document,c,{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!l)return null;let u={exampleKey:v(e,`exampleKey`),mimeType:v(e,`mimeType`),parameters:v(e,`parameters`),requestBody:v(e,`requestBody`),environments:v(e,`environments`),environment:v(e,`environment`)},d=r(l,u).map(e=>({lang:p[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),f=c.codeSamples?.languages??[],m=f.findIndex(({lang:e})=>e===`Payload`);if(m!==-1){let e=i(l,{exampleKey:u.exampleKey,mimeType:u.mimeType,titlePrefix:f[m].label});d.splice(m,0,...e)}return d.length>0&&(e.node.attributes[e.attributeName]=d),null}async function S(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{getResponseSamples:r,normalizeOptions:i,resolveOperationSampleContext:a}=await import(`@redocly/api-docs`),s=a(t.document,i({specType:`openapi`,...y(t.metadata),markdownParser:o}),{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!s)return null;let c=r(s,{exampleKey:v(e,`exampleKey`)});return c.length>0&&(e.node.attributes[e.attributeName]=c),null}const C=a({budget:4});function w(e,t,n){let r=async()=>{let{buildItems:r}=await import(`@redocly/api-docs`),a=u(t.document,i,{warn:t=>e.logger?.warn(t)}),{items:s,store:c}=await r({type:i,document:a,options:{...n,specType:i,markdownParser:o},basePath:`/`,markdownParser:o});return{items:s,store:c}};if(t.dataHash===null)return r();let a=JSON.stringify([t.contentPath,t.dataHash,n]),s=C.get(a);return s===void 0&&(s=r(),C.set(a,s)),s}function T(e){return e.startsWith(`#`)?e.slice(1):e}function E(e,t){let n=v(t,`pointer`),r=v(t,`operationId`);if(n!==void 0||r!==void 0)for(let i of e){let e=i.content?.meta;if(n!==void 0&&e?.pointer!==void 0&&T(e.pointer)===T(n)||r!==void 0&&e?.sourceId===r)return i;let a=E(i.items??[],t);if(a!==void 0)return a}}function D(e){return e[f]}function O(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=D(r)??n;for(let n of r.panels??[]){let r=`children`in n?n.children.find(t):void 0;if(r!==void 0){let t=D(n)??e;return{entry:r,scope:t===void 0?{}:{[f]:t}}}}let i=O(r.children,t,e);if(i!==void 0)return i}}async function k(e,t){return F(e,t,await P(e,t))}async function A(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`code-sample`,D(o)):void 0;if(s===void 0)return null;let c=s.entry,{appendUndeclaredConfigureParameters:l}=await import(`@redocly/api-docs`),u=v(e,`parameters`),d={apiStore:a,options:b(e,r),panel:{...c,source:l(c.source,{...u?.path&&{path:u.path},...u?.query&&{query:u.query},...u?.header&&{headers:u.header},...u?.cookie&&{cookie:u.cookie}}),...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=d,null}async function j(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,D(o)):void 0;if(s?.entry.responseCodes===void 0)return null;let c={apiStore:a,options:r,panel:{responseCodes:s.entry.responseCodes,...s.entry.schemaId!==void 0&&{schemaId:s.entry.schemaId},...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=c,null}async function M(e){let t=v(e,`pointer`);if(t===void 0)return null;let{definition:n,problems:r}=await h(e);if(n===null)return{problems:r};let i=y(n.metadata),{items:a,store:o}=await w(e,n,i),s=T(t).replace(/^\//,``),c=Object.fromEntries([s,s.replace(/\/value$/,``)].filter(e=>o.exampleStore[e]!==void 0).map(e=>[e,o.exampleStore[e]]));if(Object.keys(c).length===0)return null;let l=(await import(`@redocly/api-docs`)).findExampleEncoding(a,t),u={apiStore:{schemaStore:{},exampleStore:c,securitySchemeStore:{}},options:{...i,...v(e,`options`)},...l!==void 0&&{encoding:l},...await k(e,n.contentPath)};return e.node.attributes[e.attributeName]=u,null}function N(e,t,n,r,i){if(!e.requestBody||!t&&!n)return e;let a={...e.requestBody};if(t&&(a=a[t]?{[t]:a[t]}:{}),n)for(let[e,t]of Object.entries(a)){let o=t.exampleIds?.filter(e=>r[e]?.key!==void 0);if(!o?.length)continue;let s=i(o,n,e=>r[e]);a[e]={...t,exampleIds:s?[s]:[]}}return{...e,requestBody:a}}async function P(e,t){let n=d.relative(d.dirname(e.sourceFilePath),t),{result:r}=await e.markdown.resolveLocalReference(n,e.sourceFilePath);return r.kind===`pageUrl`?r.url:void 0}function F(e,t,i){let a=n(e.config);if(a===null)return{};let o=r(a,{filePath:t,slug:i??null});return{[f]:o??{}}}async function I(t){let{definition:n,problems:r}=await h(t);if(n===null)return{problems:r};let{findExampleIdByKey:a,JsonPointer:s,normalizeOptions:c,resolveOperationSampleContext:d}=await import(`@redocly/api-docs`),f=n.metadata,p=e(f.options)?f.options:{},m=await P(t,n.contentPath),g=l(p,t.config,m),_=v(t,`options`),y={...g,..._??{}},b=c({specType:`openapi`,...y,markdownParser:o}),x=u(n.document,i,{warn:e=>t.logger?.warn(e)}),S=d(x,b,{operationId:v(t,`operationId`),pointer:v(t,`pointer`)});if(!S)return null;let C=N(S.source,v(t,`mimeType`),v(t,`exampleKey`),S.storeCtx.exampleStore,a),w={apiStore:{schemaStore:S.storeCtx.schemaStore,exampleStore:S.storeCtx.exampleStore,securitySchemeStore:S.storeCtx.securitySchemeStore,specVersion:x.openapi},definition:x,operationId:S.operation.operationId??``,operationSource:C,options:y,pointer:s.compile([`paths`,S.pathName,S.method.toLowerCase()]),...F(t,n.contentPath,m)};return t.node.attributes[t.attributeName]=w,null}export{A as resolveOpenapiCodeSamplePanelAttribute,x as resolveOpenapiCodeSamplesAttribute,M as resolveOpenapiExampleAttribute,I as resolveOpenapiReplayAttribute,j as resolveOpenapiResponsePanelAttribute,S as resolveOpenapiResponseSamplesAttribute};
1
+ import{compileRouteAccessMatcher as e,matchContentScope as t}from"../../../../server/rbac/engine.js";import{isObject as n}from"../../../../shared/utils/is-object.js";import{SPEC_KIND_OPENAPI as r}from"../../../plugins/types/api-entity.js";import{markdocNodeProblem as i}from"../../utils/node-source-range.js";import{createLruCache as a}from"../../../../shared/utils/lru-cache.js";import{parseMarkdownCached as o}from"../../utils/parse-cache.js";import{resolveResolverTarget as s}from"./context-paths.js";import{createApiEntityKey as c}from"../../../plugins/utils/api-entity-key.js";import{withMockServerOption as l}from"../../../plugins/internal/api-docs/server/options.js";import{annotateApiDocsRbac as u}from"../../../../server/rbac/api-docs.js";import{posix as d}from"node:path";import{REDOCLY_TEAMS_RBAC as f}from"@redocly/config";const p={curl:`shell`,JavaScript:`javascript`,"Node.js":`javascript`,Python:`python`,Java:`java`,"Java8+Apache":`java`,"C#":`csharp`,"C#+Newtonsoft":`csharp`,PHP:`php`,Go:`go`,Ruby:`ruby`,R:`r`},m=/* @__PURE__ */ new WeakMap;async function h(e){let t=m.get(e.node);t===void 0&&(t=g(e),m.set(e.node,t));let n=await t;return{definition:n.definition,problems:n.problems.splice(0)}}async function g(e){let t=e.node.attributes.descriptionFile;if(typeof t!=`string`||t===``||e.entities===void 0)return{definition:null,problems:[]};let n=s(e,t);if(n===null)return _(e,`descriptionFile "${t}" must stay inside the content directory`);let r=c(n.contentPath),i=await e.entities.get(r);return i===null||i.type!==`api`?_(e,`no API description found at ${n.contentPath}`):i.metadata?.specType===`openapi`?{definition:{contentPath:n.contentPath,document:await e.entities.load(r),metadata:i.metadata??{},dataHash:i.status===`ready`?i.dataHash??null:null},problems:[]}:_(e,`${n.contentPath} is not an OpenAPI description`)}function _(e,t){return e.logger?.warn(`${e.node.tag} in ${e.sourceFilePath}: ${t}`),e.node.attributes.descriptionFileInvalid=!0,{definition:null,problems:[i(e.node,t,e.sourceFilePath)]}}const v=(e,t)=>e.node.attributes[t]??void 0;function y(e){let t=n(e.options)?e.options:{};return n(t.mockServer)?{...t,mockServer:{...t.mockServer,position:`off`}}:t}function b(e,t){let r=v(e,`language`),i=v(e,`options`);return{...t,...i,codeSamples:{...n(t.codeSamples)?t.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function x(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{buildCodeSamples:r,getRequestBodySamples:i,normalizeOptions:a,resolveOperationSampleContext:s}=await import(`@redocly/api-docs`),c=a({specType:`openapi`,...b(e,y(t.metadata)),markdownParser:o}),l=s(t.document,c,{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!l)return null;let u={exampleKey:v(e,`exampleKey`),mimeType:v(e,`mimeType`),parameters:v(e,`parameters`),requestBody:v(e,`requestBody`),environments:v(e,`environments`),environment:v(e,`environment`)},d=r(l,u).map(e=>({lang:p[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),f=c.codeSamples?.languages??[],m=f.findIndex(({lang:e})=>e===`Payload`);if(m!==-1){let e=i(l,{exampleKey:u.exampleKey,mimeType:u.mimeType,titlePrefix:f[m].label});d.splice(m,0,...e)}return d.length>0&&(e.node.attributes[e.attributeName]=d),null}async function S(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{getResponseSamples:r,normalizeOptions:i,resolveOperationSampleContext:a}=await import(`@redocly/api-docs`),s=a(t.document,i({specType:`openapi`,...y(t.metadata),markdownParser:o}),{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!s)return null;let c=r(s,{exampleKey:v(e,`exampleKey`)});return c.length>0&&(e.node.attributes[e.attributeName]=c),null}const C=a({budget:4});function w(e,t,n){let i=async()=>{let{buildItems:i}=await import(`@redocly/api-docs`),a=u(t.document,r,{warn:t=>e.logger?.warn(t)}),{items:s,store:c}=await i({type:r,document:a,options:{...n,specType:r,markdownParser:o},basePath:`/`,markdownParser:o});return{items:s,store:c}};if(t.dataHash===null)return i();let a=JSON.stringify([t.contentPath,t.dataHash,n]),s=C.get(a);return s===void 0&&(s=i(),C.set(a,s)),s}function T(e){return e.startsWith(`#`)?e.slice(1):e}function E(e,t){let n=v(t,`pointer`),r=v(t,`operationId`);if(n!==void 0||r!==void 0)for(let i of e){let e=i.content?.meta;if(n!==void 0&&e?.pointer!==void 0&&T(e.pointer)===T(n)||r!==void 0&&e?.sourceId===r)return i;let a=E(i.items??[],t);if(a!==void 0)return a}}function D(e){return e[f]}function O(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=D(r)??n;for(let n of r.panels??[]){let r=`children`in n?n.children.find(t):void 0;if(r!==void 0){let t=D(n)??e;return{entry:r,scope:t===void 0?{}:{[f]:t}}}}let i=O(r.children,t,e);if(i!==void 0)return i}}async function k(e,t){return F(e,t,await P(e,t))}async function A(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`code-sample`,D(o)):void 0;if(s===void 0)return null;let c=s.entry,{appendUndeclaredConfigureParameters:l}=await import(`@redocly/api-docs`),u=v(e,`parameters`),d={apiStore:a,options:b(e,r),panel:{...c,source:l(c.source,{...u?.path&&{path:u.path},...u?.query&&{query:u.query},...u?.header&&{headers:u.header},...u?.cookie&&{cookie:u.cookie}}),...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=d,null}async function j(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,D(o)):void 0;if(s?.entry.responseCodes===void 0)return null;let c={apiStore:a,options:r,panel:{responseCodes:s.entry.responseCodes,...s.entry.schemaId!==void 0&&{schemaId:s.entry.schemaId},...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=c,null}async function M(e){let t=v(e,`pointer`);if(t===void 0)return null;let{definition:n,problems:r}=await h(e);if(n===null)return{problems:r};let i=y(n.metadata),{items:a,store:o}=await w(e,n,i),s=T(t).replace(/^\//,``),c=Object.fromEntries([s,s.replace(/\/value$/,``)].filter(e=>o.exampleStore[e]!==void 0).map(e=>[e,o.exampleStore[e]]));if(Object.keys(c).length===0)return null;let l=(await import(`@redocly/api-docs`)).findExampleEncoding(a,t),u={apiStore:{schemaStore:{},exampleStore:c,securitySchemeStore:{}},options:{...i,...v(e,`options`)},...l!==void 0&&{encoding:l},...await k(e,n.contentPath)};return e.node.attributes[e.attributeName]=u,null}function N(e,t,n,r,i){if(!e.requestBody||!t&&!n)return e;let a={...e.requestBody};if(t&&(a=a[t]?{[t]:a[t]}:{}),n)for(let[e,t]of Object.entries(a)){let o=t.exampleIds?.filter(e=>r[e]?.key!==void 0);if(!o?.length)continue;let s=i(o,n,e=>r[e]);a[e]={...t,exampleIds:s?[s]:[]}}return{...e,requestBody:a}}async function P(e,t){let n=d.relative(d.dirname(e.sourceFilePath),t),{result:r}=await e.markdown.resolveLocalReference(n,e.sourceFilePath);return r.kind===`pageUrl`?r.url:void 0}function F(n,r,i){let a=e(n.config);if(a===null)return{};let o=t(a,{filePath:r,slug:i??null});return{[f]:o??{}}}async function I(e){let{definition:t,problems:i}=await h(e);if(t===null)return{problems:i};let{findExampleIdByKey:a,JsonPointer:s,normalizeOptions:c,resolveOperationSampleContext:d}=await import(`@redocly/api-docs`),f=t.metadata,p=n(f.options)?f.options:{},m=await P(e,t.contentPath),g=l(p,e.config,m),_=v(e,`options`),y={...g,..._??{}},b=c({specType:`openapi`,...y,markdownParser:o}),x=u(t.document,r,{warn:t=>e.logger?.warn(t)}),S=d(x,b,{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!S)return null;let C=N(S.source,v(e,`mimeType`),v(e,`exampleKey`),S.storeCtx.exampleStore,a),w={apiStore:{schemaStore:S.storeCtx.schemaStore,exampleStore:S.storeCtx.exampleStore,securitySchemeStore:S.storeCtx.securitySchemeStore,specVersion:x.openapi},definition:x,operationId:S.operation.operationId??``,operationSource:C,options:y,pointer:s.compile([`paths`,S.pathName,S.method.toLowerCase()]),...F(e,t.contentPath,m)};return e.node.attributes[e.attributeName]=w,null}export{A as resolveOpenapiCodeSamplePanelAttribute,x as resolveOpenapiCodeSamplesAttribute,M as resolveOpenapiExampleAttribute,I as resolveOpenapiReplayAttribute,j as resolveOpenapiResponsePanelAttribute,S as resolveOpenapiResponseSamplesAttribute};
@@ -1 +1 @@
1
- import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../../tags/markdoc-error.js";import{shiftRange as n}from"../../../../shared/utils/shift-range.js";import{inlinedLinkRefs as r}from"../../../link-checker/node-ref.js";import{resolveResolverTarget as i}from"./context-paths.js";import{getPartialsFolders as a,isPartialPath as o}from"../../utils/partials.js";import{FRONTMATTER_BLOCK_RE as s,computeFrontmatterLineOffset as c}from"../../utils/frontmatter-offset.js";import{substituteStaticVariables as l}from"../../utils/substitute-variables.js";import{resolveMarkdocBuildTimeAttributes as u}from"../markdoc.js";async function d(n){let{node:d,attributeName:p}=n,m=d.attributes[p];if(typeof m!=`string`||m===``||n.io===void 0)return null;let h=i(n,m);if(h===null)return null;if(!o(h.contentPath,n.config)){let t=`Partial ${h.contentPath} must live in a partials folder (markdown.partialsFolders: ${a(n.config).join(`, `)})`;return e(d,t,n.sourceFilePath)}let g=n.partialChain??[n.sourceFilePath];if(g.includes(h.contentPath))return t(d,`Circular partial inclusion: ${[...g,h.contentPath].join(` -> `)}`),{entityDeps:[{kind:`file`,path:h.contentPath}]};if(!await n.io.exists(h.absolutePath)){let t=`Partial file ${h.contentPath} does not exist`;return e(d,t,n.sourceFilePath,[{kind:`file`,path:h.contentPath}])}let _=await n.io.readFile(h.absolutePath),v=_.replace(s,``),y=structuredClone(n.markdown.parseCached(v)),b=await u(y,{tags:n.tags,sourceFilePath:h.contentPath,resolverContext:{config:n.config,contentDir:n.contentDir,entities:n.entities,file:n.file,io:n.io,logger:n.logger,markdown:n.markdown,plugin:n.plugin},partialChain:[...g,h.contentPath],source:v}),x=d.attributes.variables;typeof x==`object`&&x&&!Array.isArray(x)&&l(y,x),d.children=y.children;let S=c(_);return{entityDeps:[{kind:`file`,path:h.contentPath},...b.entityDeps],assetUsages:b.assetUsages,linkRefs:r(b.linkRefs,h.contentPath,S),problems:b.problems.map(e=>f(e,S))}}function f(e,t){if(t===0||e.location?.range===void 0)return e;let r={...e.location,range:n(e.location.range,t)};return{...e,location:r}}export{d as resolvePartialFileAttribute};
1
+ import{L10N_DIR as e}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as r,replaceWithMarkdocError as i}from"../../tags/markdoc-error.js";import{PARTIAL_L10N_ATTRIBUTE as a}from"../../tags/partial.js";import{shiftRange as o}from"../../../../shared/utils/shift-range.js";import{inlinedLinkRefs as s}from"../../../link-checker/node-ref.js";import{resolveResolverTarget as c}from"./context-paths.js";import{getPartialsFolders as l,isPartialPath as u}from"../../utils/partials.js";import{FRONTMATTER_BLOCK_RE as d,computeFrontmatterLineOffset as f}from"../../utils/frontmatter-offset.js";import{substituteStaticVariables as p}from"../../utils/substitute-variables.js";import{resolveMarkdocBuildTimeAttributes as m}from"../markdoc.js";import{join as h}from"node:path";async function g(o){let{node:s,attributeName:d}=o,f=s.attributes[d];if(typeof f!=`string`||f===``||o.io===void 0)return null;let p=c(o,f);if(p===null)return null;if(!u(p.contentPath,o.config)){let e=`Partial ${p.contentPath} must live in a partials folder (markdown.partialsFolders: ${l(o.config).join(`, `)})`;return r(s,e,o.sourceFilePath)}let m=n(o.sourceFilePath),g=[],v=m!==void 0&&n(p.contentPath)===void 0?`${e}/${m}/${p.contentPath}`:p.contentPath;if(!await o.io.exists(h(o.contentDir,v))){g.push({kind:`file`,path:v});let e=t(v);if(e!==void 0&&g.push({kind:`file`,path:e}),e===void 0||!await o.io.exists(h(o.contentDir,e))){let e=`Partial file ${p.contentPath} does not exist`;return r(s,e,o.sourceFilePath,g)}v=e}let y=o.partialChain??[o.sourceFilePath];if(y.includes(v))return i(s,`Circular partial inclusion: ${[...y,v].join(` -> `)}`),{entityDeps:[{kind:`file`,path:v}]};let b=await o.io.readFile(h(o.contentDir,v)),x=await _(o,v,b,y);s.children=x.ast.children;let S=[{entityDeps:g},x.result];if(m===void 0&&n(p.contentPath)===void 0){let t={};for(let n of o.markdown.contentLocales){let r=`${e}/${n}/${p.contentPath}`,i=h(o.contentDir,r);if(!await o.io.exists(i)){S.push({entityDeps:[{kind:`file`,path:r}]});continue}let a=await _(o,r,await o.io.readFile(i),y);t[n]=a.ast,S.push(a.result)}Object.keys(t).length>0&&(s.attributes[a]=t)}return{entityDeps:S.flatMap(e=>e.entityDeps??[]),assetUsages:S.flatMap(e=>e.assetUsages??[]),linkRefs:S.flatMap(e=>e.linkRefs??[]),problems:S.flatMap(e=>e.problems??[])}}async function _(e,t,n,r){let i=n.replace(d,``),a=structuredClone(e.markdown.parseCached(i)),o=await m(a,{tags:e.tags,sourceFilePath:t,resolverContext:{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin},partialChain:[...r,t],source:i}),c=e.node.attributes.variables;typeof c==`object`&&c&&!Array.isArray(c)&&p(a,c);let l=f(n);return{ast:a,result:{entityDeps:[{kind:`file`,path:t},...o.entityDeps],assetUsages:o.assetUsages,linkRefs:s(o.linkRefs,t,l),problems:o.problems.map(e=>v(e,l))}}}function v(e,t){if(t===0||e.location?.range===void 0)return e;let n={...e.location,range:o(e.location.range,t)};return{...e,location:n}}export{g as resolvePartialFileAttribute};
@@ -1 +1 @@
1
- import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../tags/markdoc-error.js";import{getAttributeBuildTimeResolver as n}from"./attribute-resolver-key.js";import{walkMarkdocAst as r}from"../utils/walk-markdoc-ast.js";import{getExampleContent as i,walkWithExampleContent as a}from"../utils/reparse-example-fences.js";import{isLocalReference as o}from"./references.js";import{resolveLinkAttribute as s}from"./markdoc-resolvers/link.js";import{resolveIconAttribute as c,resolveImageAttribute as l,resolveImageSrcSetAttribute as u}from"./markdoc-resolvers/image.js";import{resolveCodeSnippetFileAttribute as d}from"./markdoc-resolvers/code-snippet.js";import{resolveSvgContentAttribute as f}from"./markdoc-resolvers/svg-content.js";import{resolveTagRawContentAttribute as p}from"./markdoc-resolvers/tag-raw-content.js";import{resolveHtmlAttrsAttribute as m}from"./markdoc-resolvers/html-attrs.js";import{resolveImageGalleryAttribute as h}from"./markdoc-resolvers/image-gallery.js";import{resolveCodeWalkthroughFilesetsAttribute as g}from"./markdoc-resolvers/code-walkthrough/filesets.js";import{resolvePartialFileAttribute as _}from"./markdoc-resolvers/partial.js";import{resolveDiagramFileAttribute as v}from"./markdoc-resolvers/diagram-file.js";import{resolveParsedYamlAttribute as y,resolveRawContentAttribute as b,resolveRelativePathAttribute as x}from"./markdoc-resolvers/file-reference.js";import{resolveJsonExampleRefAttribute as S,resolveJsonSchemaRefAttribute as C,resolveSampleFromJsonSchemaAttribute as w}from"./markdoc-resolvers/json-schema.js";import{resolveOpenapiCodeSamplePanelAttribute as T,resolveOpenapiCodeSamplesAttribute as E,resolveOpenapiExampleAttribute as D,resolveOpenapiReplayAttribute as O,resolveOpenapiResponsePanelAttribute as k,resolveOpenapiResponseSamplesAttribute as A}from"./markdoc-resolvers/operation-samples.js";import{PROMPT_TAG as j}from"@redocly/theme/core/constants";import{convertGithubAlertToAdmonition as M}from"@redocly/theme/markdoc/tags/admonition";async function N(e,o){let s=o.tags??{},c=F,l={entityDeps:[],assetUsages:[],linkRefs:[],problems:[]},u=o.resolverContext?.markdown?.disabledTags,d=R(o.source),f=[...r(e,{skipChildren:z})],p=f.flatMap(e=>{let t=i(e);return t?[...a(t,z)]:[]});for(let e of[...f,...p])M(e);let m=p.filter(e=>e.type===`tag`);for(let e of[...f,...m])if(e.type===`link`)await L(c.nativeMdLink,e,`href`,o,l,d);else if(e.type===`image`)await L(c.imageSrc,e,`src`,o,l,d);else if(e.type===`tag`){if(typeof e.tag==`string`&&u?.has(e.tag)){t(e,`The "${e.tag}" tag is not available here.`);continue}let r=typeof e.tag==`string`?s[e.tag]:void 0;for(let[t,i]of Object.entries(r?.attributes??{})){let r=n(i);if(!r)continue;let a=c[r];a&&await L(a,e,t,o,l,d)}}return l}const P=({attributeName:e,markdown:t,node:n,partialChain:r,sourceFilePath:i})=>s(n,e,i,t,r?.[0]),F={imageSrc({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return l(n,e,r,t)},imageSrcSet({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return u(n,e,r,t)},link:P,nativeMdLink:P,async relativeOrCdnIcon(e){let{attributeName:t,markdown:n,node:r,sourceFilePath:i}=e,a=r.attributes[t];return typeof a==`string`&&B(a)&&await f(e,{optional:!0}),c(r,t,i,n)},codeSnippetFile:d,diagramFile:v,svgContent:f,tagRawContent:p,htmlAttrs:m,imageGallery:h,codeWalkthroughFilesets:g,partialFile:_,jsonSchemaRef:C,sampleFromJsonSchema:w,jsonExampleRef:S,openapiCodeSamples:E,openapiCodeSamplePanel:T,openapiReplay:O,openapiResponseSamples:A,openapiResponsePanel:k,openapiExample:D,rawContent:b,parsedYaml:y,relativePath:x};function I(e){let t=/* @__PURE__ */ new Set;for(let n of a(e))n.type===`tag`&&typeof n.tag==`string`&&t.add(n.tag);return[...t].sort()}async function L(t,n,r,i,a,o){let s;try{s=await t({...i.resolverContext,attributeName:r,node:n,sourceFilePath:i.sourceFilePath,tags:i.tags,partialChain:i.partialChain,readSourceLines:o})}catch(t){let r=t instanceof Error?t.message:String(t);s=e(n,r,i.sourceFilePath)}s&&(s.entityDeps&&a.entityDeps.push(...s.entityDeps),s.assetUsages&&a.assetUsages.push(...s.assetUsages),s.linkRefs&&a.linkRefs.push(...s.linkRefs),s.problems&&a.problems.push(...s.problems))}function R(e){let t;return()=>(t??=e.split(/\r?\n/),t)}function z(e){return e.type===`tag`&&e.tag===j}function B(e){let t=(e.split(`#`,1)[0]??e).split(`?`,1)[0]??e;return/\.svg$/i.test(t)&&o(e)}export{F as builtInMarkdocAttributeResolvers,I as collectMarkdocTagNames,z as isPromptTag,N as resolveMarkdocBuildTimeAttributes};
1
+ import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../tags/markdoc-error.js";import{walkMarkdocAst as n}from"../utils/walk-markdoc-ast.js";import{getExampleContent as r,walkWithExampleContent as i}from"../utils/reparse-example-fences.js";import{isLocalReference as a}from"./references.js";import{resolveLinkAttribute as o}from"./markdoc-resolvers/link.js";import{resolveIconAttribute as s,resolveImageAttribute as c,resolveImageSrcSetAttribute as l}from"./markdoc-resolvers/image.js";import{resolveCodeSnippetFileAttribute as u}from"./markdoc-resolvers/code-snippet.js";import{resolveSvgContentAttribute as d}from"./markdoc-resolvers/svg-content.js";import{resolveTagRawContentAttribute as f}from"./markdoc-resolvers/tag-raw-content.js";import{resolveHtmlAttrsAttribute as p}from"./markdoc-resolvers/html-attrs.js";import{resolveImageGalleryAttribute as m}from"./markdoc-resolvers/image-gallery.js";import{resolveCodeWalkthroughFilesetsAttribute as h}from"./markdoc-resolvers/code-walkthrough/filesets.js";import{resolvePartialFileAttribute as g}from"./markdoc-resolvers/partial.js";import{resolveDiagramFileAttribute as _}from"./markdoc-resolvers/diagram-file.js";import{resolveParsedYamlAttribute as v,resolveRawContentAttribute as y,resolveRelativePathAttribute as b}from"./markdoc-resolvers/file-reference.js";import{resolveJsonExampleRefAttribute as x,resolveJsonSchemaRefAttribute as S,resolveSampleFromJsonSchemaAttribute as C}from"./markdoc-resolvers/json-schema.js";import{resolveOpenapiCodeSamplePanelAttribute as w,resolveOpenapiCodeSamplesAttribute as T,resolveOpenapiExampleAttribute as E,resolveOpenapiReplayAttribute as D,resolveOpenapiResponsePanelAttribute as O,resolveOpenapiResponseSamplesAttribute as k}from"./markdoc-resolvers/operation-samples.js";import{getAttributeBuildTimeResolver as A}from"./attribute-resolver-key.js";import{PROMPT_TAG as j}from"@redocly/theme/core/constants";import{convertGithubAlertToAdmonition as M}from"@redocly/theme/markdoc/tags/admonition";async function N(e,a){let o=a.tags??{},s=F,c={entityDeps:[],assetUsages:[],linkRefs:[],problems:[]},l=a.resolverContext?.markdown?.disabledTags,u=R(a.source),d=[...n(e,{skipChildren:z})],f=d.flatMap(e=>{let t=r(e);return t?[...i(t,z)]:[]});for(let e of[...d,...f])M(e);let p=f.filter(e=>e.type===`tag`);for(let e of[...d,...p])if(e.type===`link`)await L(s.nativeMdLink,e,`href`,a,c,u);else if(e.type===`image`)await L(s.imageSrc,e,`src`,a,c,u);else if(e.type===`tag`){if(typeof e.tag==`string`&&l?.has(e.tag)){t(e,`The "${e.tag}" tag is not available here.`);continue}let n=typeof e.tag==`string`?o[e.tag]:void 0;for(let[t,r]of Object.entries(n?.attributes??{})){let n=A(r);if(!n)continue;let i=s[n];i&&await L(i,e,t,a,c,u)}}return c}const P=({attributeName:e,markdown:t,node:n,partialChain:r,sourceFilePath:i})=>o(n,e,i,t,r?.[0]),F={imageSrc({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return c(n,e,r,t)},imageSrcSet({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return l(n,e,r,t)},link:P,nativeMdLink:P,async relativeOrCdnIcon(e){let{attributeName:t,markdown:n,node:r,sourceFilePath:i}=e,a=r.attributes[t];return typeof a==`string`&&B(a)&&await d(e,{optional:!0}),s(r,t,i,n)},codeSnippetFile:u,diagramFile:_,svgContent:d,tagRawContent:f,htmlAttrs:p,imageGallery:m,codeWalkthroughFilesets:h,partialFile:g,jsonSchemaRef:S,sampleFromJsonSchema:C,jsonExampleRef:x,openapiCodeSamples:T,openapiCodeSamplePanel:w,openapiReplay:D,openapiResponseSamples:k,openapiResponsePanel:O,openapiExample:E,rawContent:y,parsedYaml:v,relativePath:b};function I(e){let t=/* @__PURE__ */ new Set;for(let n of i(e))n.type===`tag`&&typeof n.tag==`string`&&t.add(n.tag);return[...t].sort()}async function L(t,n,r,i,a,o){let s;try{s=await t({...i.resolverContext,attributeName:r,node:n,sourceFilePath:i.sourceFilePath,tags:i.tags,partialChain:i.partialChain,readSourceLines:o})}catch(t){let r=t instanceof Error?t.message:String(t);s=e(n,r,i.sourceFilePath)}s&&(s.entityDeps&&a.entityDeps.push(...s.entityDeps),s.assetUsages&&a.assetUsages.push(...s.assetUsages),s.linkRefs&&a.linkRefs.push(...s.linkRefs),s.problems&&a.problems.push(...s.problems))}function R(e){let t;return()=>(t??=e.split(/\r?\n/),t)}function z(e){return e.type===`tag`&&e.tag===j}function B(e){let t=(e.split(`#`,1)[0]??e).split(`?`,1)[0]??e;return/\.svg$/i.test(t)&&a(e)}export{F as builtInMarkdocAttributeResolvers,I as collectMarkdocTagNames,z as isPromptTag,N as resolveMarkdocBuildTimeAttributes};
@@ -1 +1 @@
1
- import{L10N_DIR as e}from"../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n,toLocaleSlug as r}from"../../../shared/utils/l10n.js";import{buildContentAssetUrl as i}from"../../plugins/internal/assets/url.js";import{resolveContentPath as a}from"../../../shared/utils/resolve-content-path.js";import{computePathPrefixes as o}from"../../../shared/utils/routes/compute-path-prefixes.js";import{IMAGE_EXTENSIONS as s}from"../../plugins/internal/assets/extensions.js";import{isRouteSlugTarget as c}from"../../../shared/utils/routes/is-route-slug-target.js";import{safeDecodeURI as l}from"../../../shared/utils/safe-decode-uri.js";import{joinSrcSet as u,parseSrcSet as d}from"../../plugins/internal/assets/srcset.js";import{isIndexPagePath as f,resolveRelativeSlug as p}from"../../../shared/utils/routes/resolve-relative-slug.js";import{posix as m}from"node:path";const h=/[[\]()*_`#!|<>~]|\{%|^\s{0,3}([-+*]\s|\d+\.\s|>|-{3,}|={2,})/m;function g(e){return h.test(e)}function _(e){return e.startsWith(`#`)||e.startsWith(`//`)||/^[a-z][a-z0-9+.-]*:/i.test(e)?!1:!e.startsWith(`/`)||!c(y(e).path)}function v(e){let t=e.indexOf(`?`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function y(e){let t=e.indexOf(`#`);return t===-1?{path:e,hash:``}:{path:e.slice(0,t),hash:e.slice(t)}}async function b(e,n){let r=await n(e);if(r)return r;let i=t(e);if(i!==void 0){let t=await n(i);if(t){let n=e.slice(0,e.length-i.length),r=t.entityDeps.filter(e=>e.kind===`file`).map(e=>({kind:`file`,path:`${n}${e.path}`}));return{...t,entityDeps:[...r,...t.entityDeps]}}}return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]}}async function x(e,r){let i=t(e),a=n(e);if(i===void 0||a===void 0)return null;let o=await r(i,a);return o===null?null:{...o,entityDeps:[{kind:`file`,path:e},...o.entityDeps]}}async function S(t,n,r,a,o){let[s]=t.assetUsages;if(!s||!a?.length||t.result.kind!==`assetRef`||n.startsWith(`@l10n/`))return t;let c=i(s.path,s.hash,s.tag),l=[];for(let t of a){let n=`${e}/${t}/${s.path}`,i=r.filesByPath.get(n);if(!i)continue;let a=await o?.(n)??null;l.push({path:n,hash:i.hash,kind:s.kind,tag:a,l10n:{locale:t,canonicalUrl:c}})}return l.length===0?t:{...t,assetUsages:[s,...l]}}function C(e,t){let n=e.routeBySlug.get(t);return n===void 0?o(t).reverse().map(t=>e.routeBySlug.get(t)).find(e=>e?.wildcardPrefix===!0):n}async function w(e,t,n,o,c,u){if(!_(e))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:d,hash:h}=y(e),g=async(e,t)=>{let a=n.primaryRouteByFilePath.get(e);if(a!==void 0)return{result:{kind:`pageUrl`,url:`${t===void 0?a:r(a,t)}${h}`},entityDeps:[{kind:`file`,path:e}],assetUsages:[]};let c=n.filesByPath.get(e);if(c){let t=m.extname(e).toLowerCase(),n=s.has(t)?`image`:`file`,r=await o?.(e)??null;return{result:{kind:`assetRef`,url:`${i(e,c.hash,r)}${h}`,path:e,hash:c.hash},entityDeps:[{kind:`file`,path:e}],assetUsages:[{path:e,hash:c.hash,kind:n,tag:r}]}}return null};return S(await b(t,async e=>{let t=a(l(d),e);if(t===null)return null;let r=await g(t)??await x(t,g);if(r!==null)return r;let[i=``,o=``]=v(d);if(!d.startsWith(`/`)&&m.extname(i)===``){let t=u??e,r=n.primaryRouteByFilePath.get(t),a=r===void 0?void 0:p(i,r,f(t)),s=a===void 0?void 0:C(n,a);if(a!==void 0&&s!==void 0)return{result:{kind:`pageUrl`,url:`${a}${o}${h}`},entityDeps:s.originFilePath===null?[]:[{kind:`file`,path:s.originFilePath}],assetUsages:[]}}return null}),t,n,c,o)}async function T(e,t,n,r,o){if(!_(e))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:s}=y(e),c=async e=>{let t=n.filesByPath.get(e);if(!t)return null;let a=await r?.(e)??null;return{result:{kind:`assetRef`,url:i(e,t.hash,a),path:e,hash:t.hash},entityDeps:[{kind:`file`,path:e}],assetUsages:[{path:e,hash:t.hash,kind:`image`,tag:a}]}};return S(await b(t,async e=>{let t=a(l(s),e);return t===null?null:await c(t)??await x(t,c)}),t,n,o,r)}async function E(e,t,n,r,i){let a=[],o=[],s=d(e);if(!s||s.length===0)return{value:e,entityDeps:a,assetUsages:o};let c=await Promise.all(s.map(async e=>{let s=await T(e.src,t,n,r,i);return s.result.kind===`assetRef`&&(a.push(...s.entityDeps),o.push(...s.assetUsages),e.src=s.result.url),e}));return{value:u(c),entityDeps:a,assetUsages:o}}export{_ as isLocalReference,g as looksLikeMarkdown,T as resolveImageReference,E as resolveImageSrcSet,w as resolveLocalReference,y as splitHash};
1
+ import{buildContentAssetUrl as e}from"../../plugins/internal/assets/url.js";import{L10N_DIR as t}from"../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as n,l10nDirOf as r,toLocaleSlug as i}from"../../../shared/utils/l10n.js";import{resolveContentPath as a}from"../../../shared/utils/resolve-content-path.js";import{computePathPrefixes as o}from"../../../shared/utils/routes/compute-path-prefixes.js";import{IMAGE_EXTENSIONS as s}from"../../plugins/internal/assets/extensions.js";import{isRouteSlugTarget as c}from"../../../shared/utils/routes/is-route-slug-target.js";import{safeDecodeURI as l}from"../../../shared/utils/safe-decode-uri.js";import{joinSrcSet as u,parseSrcSet as d}from"../../plugins/internal/assets/srcset.js";import{isIndexPagePath as f,resolveRelativeSlug as p}from"../../../shared/utils/routes/resolve-relative-slug.js";import{posix as m}from"node:path";const h=/[[\]()*_`#!|<>~]|\{%|^\s{0,3}([-+*]\s|\d+\.\s|>|-{3,}|={2,})/m;function g(e){return h.test(e)}function _(e){return e.startsWith(`#`)||e.startsWith(`//`)||/^[a-z][a-z0-9+.-]*:/i.test(e)?!1:!e.startsWith(`/`)||!c(y(e).path)}function v(e){let t=e.indexOf(`?`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function y(e){let t=e.indexOf(`#`);return t===-1?{path:e,hash:``}:{path:e.slice(0,t),hash:e.slice(t)}}async function b(e,t){let r=await t(e);if(r)return r;let i=n(e);if(i!==void 0){let n=await t(i);if(n){let t=e.slice(0,e.length-i.length),r=n.entityDeps.filter(e=>e.kind===`file`).map(e=>({kind:`file`,path:`${t}${e.path}`}));return{...n,entityDeps:[...r,...n.entityDeps]}}}return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]}}async function x(e,t){let i=n(e),a=r(e);if(i===void 0||a===void 0)return null;let o=await t(i,a);return o===null?null:{...o,entityDeps:[{kind:`file`,path:e},...o.entityDeps]}}async function S(n,r,i,a,o){let[s]=n.assetUsages;if(!s||!a?.length||n.result.kind!==`assetRef`||r.startsWith(`@l10n/`))return n;let c=e(s.path,s.hash,s.tag),l=[];for(let e of a){let n=`${t}/${e}/${s.path}`,r=i.filesByPath.get(n);if(!r)continue;let a=await o?.(n)??null;l.push({path:n,hash:r.hash,kind:s.kind,tag:a,l10n:{locale:e,canonicalUrl:c}})}return l.length===0?n:{...n,assetUsages:[s,...l]}}function C(e,t){let n=e.routeBySlug.get(t);return n===void 0?o(t).reverse().map(t=>e.routeBySlug.get(t)).find(e=>e?.wildcardPrefix===!0):n}async function w(t,n,r,o,c,u){if(!_(t))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:d,hash:h}=y(t),g=async(t,n)=>{let a=r.primaryRouteByFilePath.get(t);if(a!==void 0)return{result:{kind:`pageUrl`,url:`${n===void 0?a:i(a,n)}${h}`},entityDeps:[{kind:`file`,path:t}],assetUsages:[]};let c=r.filesByPath.get(t);if(c){let n=m.extname(t).toLowerCase(),r=s.has(n)?`image`:`file`,i=await o?.(t)??null;return{result:{kind:`assetRef`,url:`${e(t,c.hash,i)}${h}`,path:t,hash:c.hash},entityDeps:[{kind:`file`,path:t}],assetUsages:[{path:t,hash:c.hash,kind:r,tag:i}]}}return null};return S(await b(n,async e=>{let t=a(l(d),e);if(t===null)return null;let n=await g(t)??await x(t,g);if(n!==null)return n;let[i=``,o=``]=v(d);if(!d.startsWith(`/`)&&m.extname(i)===``){let t=u??e,n=r.primaryRouteByFilePath.get(t),a=n===void 0?void 0:p(i,n,f(t)),s=a===void 0?void 0:C(r,a);if(a!==void 0&&s!==void 0)return{result:{kind:`pageUrl`,url:`${a}${o}${h}`},entityDeps:s.originFilePath===null?[]:[{kind:`file`,path:s.originFilePath}],assetUsages:[]}}return null}),n,r,c,o)}async function T(t,n,r,i,o){if(!_(t))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:s}=y(t),c=async t=>{let n=r.filesByPath.get(t);if(!n)return null;let a=await i?.(t)??null;return{result:{kind:`assetRef`,url:e(t,n.hash,a),path:t,hash:n.hash},entityDeps:[{kind:`file`,path:t}],assetUsages:[{path:t,hash:n.hash,kind:`image`,tag:a}]}};return S(await b(n,async e=>{let t=a(l(s),e);return t===null?null:await c(t)??await x(t,c)}),n,r,o,i)}async function E(e,t,n,r,i){let a=[],o=[],s=d(e);if(!s||s.length===0)return{value:e,entityDeps:a,assetUsages:o};let c=await Promise.all(s.map(async e=>{let s=await T(e.src,t,n,r,i);return s.result.kind===`assetRef`&&(a.push(...s.entityDeps),o.push(...s.assetUsages),e.src=s.result.url),e}));return{value:u(c),entityDeps:a,assetUsages:o}}export{_ as isLocalReference,g as looksLikeMarkdown,T as resolveImageReference,E as resolveImageSrcSet,w as resolveLocalReference,y as splitHash};
@@ -1,4 +1,4 @@
1
- import{getInnerText as e}from"../utils/get-inner-text.js";import{headingSlugger as t}from"../utils/heading-slugger.js";import{builtInMarkdocNodes as n,builtInMarkdocTags as r}from"../constants/builtin-tags.js";import{PROMPT_TAG as i}from"@redocly/theme/core/constants";import a from"@redocly/markdoc";const o=/* @__PURE__ */ new Set([`if`,`else`,i]),s=[`title`,`name`,`label`],c=((e,t)=>typeof t==`string`?t:e??``);function l(e,t={}){return f(e).map(e=>p({type:`document`,children:e},t)).filter(e=>e!==``)}function u(e,n={}){t.reset();let r=[],i=[];for(let t of f(e)){let e=p({type:`document`,children:t},n);e!==``&&(r.push(e),i.push(d(t[0],n.variables)))}return{chunks:r,headings:i}}function d(t,i){if(!v(t)||t.type!==`heading`)return null;let o=a.transform(a.Ast.fromJSON(JSON.stringify(t)),{nodes:n,tags:r,variables:i});if(!a.Tag.isTag(o))return null;let s=typeof o.attributes.id==`string`?o.attributes.id:``;return{heading:e(o.children),anchor:s}}function f(e){let t=v(e)&&Array.isArray(e.children)?e.children:[e],n=[],r=[];for(let e of t)(v(e)&&e.type===`heading`||n.length===0)&&(r=[],n.push(r)),r.push(e);return n}function p(e,t){let n=[];return g(e,n,{listDepth:0,ordered:!1,index:0,options:t}),n.join(``).replace(/(?<![ \t])[ \t]+\n/g,`
1
+ import{headingSlugger as e}from"../utils/heading-slugger.js";import{getInnerText as t}from"../utils/get-inner-text.js";import{builtInMarkdocNodes as n,builtInMarkdocTags as r}from"../constants/builtin-tags.js";import{PROMPT_TAG as i}from"@redocly/theme/core/constants";import a from"@redocly/markdoc";const o=/* @__PURE__ */ new Set([`if`,`else`,i]),s=[`title`,`name`,`label`],c=((e,t)=>typeof t==`string`?t:e??``);function l(e,t={}){return f(e).map(e=>p({type:`document`,children:e},t)).filter(e=>e!==``)}function u(t,n={}){e.reset();let r=[],i=[];for(let e of f(t)){let t=p({type:`document`,children:e},n);t!==``&&(r.push(t),i.push(d(e[0],n.variables)))}return{chunks:r,headings:i}}function d(e,i){if(!v(e)||e.type!==`heading`)return null;let o=a.transform(a.Ast.fromJSON(JSON.stringify(e)),{nodes:n,tags:r,variables:i});if(!a.Tag.isTag(o))return null;let s=typeof o.attributes.id==`string`?o.attributes.id:``;return{heading:t(o.children),anchor:s}}function f(e){let t=v(e)&&Array.isArray(e.children)?e.children:[e],n=[],r=[];for(let e of t)(v(e)&&e.type===`heading`||n.length===0)&&(r=[],n.push(r)),r.push(e);return n}function p(e,t){let n=[];return g(e,n,{listDepth:0,ordered:!1,index:0,options:t}),n.join(``).replace(/(?<![ \t])[ \t]+\n/g,`
2
2
  `).replace(/\n{3,}/g,`
3
3
 
4
4
  `).trim()}function m(e,t={}){if(a.Ast.isVariable(e))return Object.hasOwn(t,String(e.path[0]))?new a.Ast.Variable(e.path).resolve({variables:t}):e;if(Array.isArray(e)){let n;for(let r=0;r<e.length;r++){let i=m(e[r],t);i!==e[r]&&((n??=e.slice())[r]=i)}return n??e}if(!v(e)||a.Ast.isAst(e))return e;let n;for(let[r,i]of Object.entries(e)){let a=m(i,t);a!==i&&((n??={...e})[r]=a)}return n??e}function h(e,t){let n=[];for(let r of e??[])g(r,n,t);return n.join(``).trim()}function g(e,t,n){if(!v(e)||e.type===`tag`&&e.tag!==void 0&&o.has(e.tag))return;let r=e.attributes??{},i=r.content;switch(e.type){case`text`:{let e=a.Ast.isVariable(i)?new a.Ast.Variable(i.path).resolve({variables:n.options.variables}):i;typeof e==`string`&&t.push(e);return}case`code`:typeof i==`string`&&t.push(`\`${i}\``);return;case`fence`:{let a=typeof r.language==`string`?r.language:``,o=[];for(let t of e.children??[])g(t,o,n);let s=e.children?.length?o.join(``):i,c=typeof s==`string`?s.replace(/\n$/,``):``;t.push(`\n\`\`\`${a}\n${c}\n\`\`\`\n\n`);return}case`softbreak`:t.push(`
@@ -1 +1 @@
1
- import{HeadingSlugger as e}from"../utils/heading-slugger.js";import"../../../server/rbac/types.js";import{hidesBodyFromSearch as t,markdocAstToText as n}from"./to-text.js";import{renderedHeadingText as r}from"../utils/heading-text.js";import{isNonControlVariant as i}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as a}from"@redocly/theme/markdoc/tags/visibility";const o=/^(page|section-\d+)-team-\d+$/;function s(e){return o.exec(e)?.[1]??e}function c(t,i,a={}){let o=g(t)&&Array.isArray(t.children)?t.children:[],s=new e,c={title:i,body:[]},u=[],d=c,f=!1,p=[],_=e=>{let t=e.attributes?.id;return typeof t==`string`?t:s.slug(r(e,a))};for(let e of o){if(!g(e)||e.type!==`heading`){d.body.push(e);for(let t of h(e))_(t);continue}let t=r(e,a),n=_(e),o=m(e);if(o===1){!f&&t!==``&&(c.title=t,f=!0),d=c,p.length=0;continue}let s=t||i,l=p.slice(0,o).filter(e=>e!==void 0);p.length=o,p[o]=s;let v={anchor:n,title:s,ancestors:l,body:[]};u.push(v),d=v}let v=e=>n({type:`document`,children:e}),y=(e,t)=>[e,...l(t).map(({teams:t,children:n},r)=>({...e,docKey:`${e.docKey}-team-${r+1}`,text:v(n),rbacTeams:t})).filter(e=>e.text!==``)];return[...y({docKey:`page`,title:c.title,text:v(c.body)},c.body),...u.flatMap((e,t)=>y({docKey:`section-${t+1}`,anchor:e.anchor,title:e.title,text:v(e.body),path:[c.title,...e.ancestors,e.title]},e.body))]}function l(e){let n=[],r=(e,i)=>{if(g(e)&&!t(e)){if(e.type===`tag`&&e.tag===`if`){let t=u(e.attributes?.primary);if(t===void 0)return;let a=i===void 0?t:t.filter(e=>i.includes(e));if(a.length===0)return;let o=e.children??[],s=o.findIndex(e=>g(e)&&e.type===`tag`&&e.tag===`else`),c=s===-1?o:o.slice(0,s);n.push({teams:a,children:c});for(let e of c)r(e,a);return}for(let t of Object.values(e.slots??{}))r(t,i);for(let t of e.children??[])r(t,i)}};for(let t of e)r(t,void 0);return n}function u(e){if(!f(e))return;let t=Object.values(e.parameters??{});if(e.name===`includes`){let e=d(t);return e===void 0?void 0:[e]}if(e.name!==`or`)return;let n=t.map(e=>f(e)&&e.name===`includes`?d(Object.values(e.parameters??{})):void 0).filter(e=>e!==void 0);return n.length===0?void 0:n}function d([e,t]){let n=p(e,`Variable`)?e.path:void 0;return Array.isArray(n)&&n.length===2&&n[0]===`rbac`&&n[1]===`teams`&&typeof t==`string`&&t!==`*`?t:void 0}function f(e){return p(e,`Function`)}function p(e,t){return typeof e==`object`&&!!e&&e.$$mdtype===t}function m(e){let t=e.attributes?.level;return typeof t==`number`?t:2}function*h(e){if(!(!g(e)||a(e)||i(e))){for(let t of e.children??[])g(t)&&t.type===`heading`&&(yield t),yield*h(t);for(let t of Object.values(e.slots??{}))yield*h(t)}}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{c as markdocAstToSearchSections,s as teamBlockSectionKey};
1
+ import"../../../server/rbac/types.js";import{HeadingSlugger as e}from"../utils/heading-slugger.js";import{hidesBodyFromSearch as t,markdocAstToText as n}from"./to-text.js";import{renderedHeadingText as r}from"../utils/heading-text.js";import{isNonControlVariant as i}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as a}from"@redocly/theme/markdoc/tags/visibility";const o=/^(page|section-\d+)-team-\d+$/;function s(e){return o.exec(e)?.[1]??e}function c(t,i,a={}){let o=g(t)&&Array.isArray(t.children)?t.children:[],s=new e,c={title:i,body:[]},u=[],d=c,f=!1,p=[],_=e=>{let t=e.attributes?.id;return typeof t==`string`?t:s.slug(r(e,a))};for(let e of o){if(!g(e)||e.type!==`heading`){d.body.push(e);for(let t of h(e))_(t);continue}let t=r(e,a),n=_(e),o=m(e);if(o===1){!f&&t!==``&&(c.title=t,f=!0),d=c,p.length=0;continue}let s=t||i,l=p.slice(0,o).filter(e=>e!==void 0);p.length=o,p[o]=s;let v={anchor:n,title:s,ancestors:l,body:[]};u.push(v),d=v}let v=e=>n({type:`document`,children:e}),y=(e,t)=>[e,...l(t).map(({teams:t,children:n},r)=>({...e,docKey:`${e.docKey}-team-${r+1}`,text:v(n),rbacTeams:t})).filter(e=>e.text!==``)];return[...y({docKey:`page`,title:c.title,text:v(c.body)},c.body),...u.flatMap((e,t)=>y({docKey:`section-${t+1}`,anchor:e.anchor,title:e.title,text:v(e.body),path:[c.title,...e.ancestors,e.title]},e.body))]}function l(e){let n=[],r=(e,i)=>{if(g(e)&&!t(e)){if(e.type===`tag`&&e.tag===`if`){let t=u(e.attributes?.primary);if(t===void 0)return;let a=i===void 0?t:t.filter(e=>i.includes(e));if(a.length===0)return;let o=e.children??[],s=o.findIndex(e=>g(e)&&e.type===`tag`&&e.tag===`else`),c=s===-1?o:o.slice(0,s);n.push({teams:a,children:c});for(let e of c)r(e,a);return}for(let t of Object.values(e.slots??{}))r(t,i);for(let t of e.children??[])r(t,i)}};for(let t of e)r(t,void 0);return n}function u(e){if(!f(e))return;let t=Object.values(e.parameters??{});if(e.name===`includes`){let e=d(t);return e===void 0?void 0:[e]}if(e.name!==`or`)return;let n=t.map(e=>f(e)&&e.name===`includes`?d(Object.values(e.parameters??{})):void 0).filter(e=>e!==void 0);return n.length===0?void 0:n}function d([e,t]){let n=p(e,`Variable`)?e.path:void 0;return Array.isArray(n)&&n.length===2&&n[0]===`rbac`&&n[1]===`teams`&&typeof t==`string`&&t!==`*`?t:void 0}function f(e){return p(e,`Function`)}function p(e,t){return typeof e==`object`&&!!e&&e.$$mdtype===t}function m(e){let t=e.attributes?.level;return typeof t==`number`?t:2}function*h(e){if(!(!g(e)||a(e)||i(e))){for(let t of e.children??[])g(t)&&t.type===`heading`&&(yield t),yield*h(t);for(let t of Object.values(e.slots??{}))yield*h(t)}}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{c as markdocAstToSearchSections,s as teamBlockSectionKey};
@@ -1 +1 @@
1
- import{isObject as e}from"../../../shared/utils/is-object.js";import"../../../shared/constants/content-assets.js";import{stampHeadingIndexes as t}from"../utils/collect-headings.js";import{builtInMarkdocFunctions as n,rbacTeamList as r}from"../constants/builtin-functions.js";import{headingSlugger as i}from"../utils/heading-slugger.js";import{resolveMarkdocTagSet as a}from"../constants/tag-sets.js";import{getPublicEnv as o}from"../../../shared/public-env.js";import{isPackedMarkdocAst as s,unpackMarkdocAst as c}from"../utils/packed-ast.js";import{joinSrcSet as l,parseSrcSet as u}from"../../plugins/internal/assets/srcset.js";import{frontmatterVariable as d}from"../utils/frontmatter-variable.js";import f from"@redocly/markdoc";function p(e){let t=e.viewer,n=t?.isAuthenticated===!0;return{userAgent:n?e.userAgent:null,userIp:n?e.ip:null,remoteAddr:{ipAddress:n?e.ip:null},rbac:{teams:r(e.teams)},user:t?.isAuthenticated?{isAuthenticated:!0,name:t.name??null,email:t.email??null,teams:t.teams}:{isAuthenticated:!1,name:null,email:null,teams:[]}}}function m(e){let t=e=>{Array.isArray(e)?e.forEach(t):f.Tag.isTag(e)&&(e.children=e.children.map(e=>typeof e==`object`&&e&&!f.Tag.isTag(e)?JSON.stringify(e,null,2):(t(e),e)))};return t(e),e}function h(e){return!!e&&typeof e==`object`&&e.$$mdtype===`Node`}function g(e){return f.Ast.fromJSON(e)}function _(e){return e.includes(`"$$mdtype":"Node"`)||e.includes(`"$$mdpack":`)?{}:null}async function v(r,i,s,c){let{tags:l,nodes:u,functions:d}=await a(i.tagSet),f=x(r,{functions:d??n,tags:l,nodes:u,variables:{...p(s),env:o(),frontmatter:b(r),lang:c}});e(f)&&f.ast&&t(f.ast);let m=i.l10nAssets?.[c];return m?y(f,m):f}function y(e,t){let n=e=>{if(!e.includes(`/content-assets`))return e;let n=u(e);if(!n||n.length===0)return e;let r=!1,i=n.map(e=>{let n=e.src.search(/[?#]/),i=t[n===-1?e.src:e.src.slice(0,n)];return i===void 0?e:(r=!0,e.src=n===-1?i:`${i}${e.src.slice(n)}`,e)});return r?l(i):e},r=e=>{if(typeof e==`string`)return n(e);if(Array.isArray(e)){let t=!1,n=e.map(e=>{let n=r(e);return t||=n!==e,n});return t?n:e}if(e&&typeof e==`object`){let t=!1,n=Object.entries(e).map(([e,n])=>{let i=r(n);return t||=i!==n,[e,i]});return t?Object.fromEntries(n):e}return e},i=e=>{f.Tag.isTag(e)?(e.attributes=r(e.attributes),e.children.forEach(i)):Array.isArray(e)?e.forEach(i):e&&typeof e==`object`&&Object.values(e).forEach(i)};return i(e),e}function b(t){return e(t)?d(e(t.frontmatter)?t.frontmatter:{},t.title):{}}function x(e,t){i.reset();let n=e=>e instanceof f.Ast.Node,r=e=>{if(n(e))return m(f.transform(e,t));if(s(e)){let n=c(e);return m(f.transform(n,t))}if(h(e))return m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t));if(Array.isArray(e))return e.length>0&&e.every(n)?m(f.transform(e,t)):e.length>0&&e.every(h)?m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t)):e.map(r);if(e&&typeof e==`object`){let t={};for(let[n,i]of Object.entries(e))t[n]=r(i);return t}return e};return r(e)}export{p as buildMarkdownRuntimeVariables,_ as detectMarkdocPayloadFlag,h as isMarkdocAstNode,y as localizeMarkdocAssetUrls,g as parseMarkdocPayloadDeep,x as transformMarkdocDeep,v as transformMarkdocPayload};
1
+ import"../../../shared/constants/content-assets.js";import{isObject as e}from"../../../shared/utils/is-object.js";import{getPublicEnv as t}from"../../../shared/public-env.js";import{isPackedMarkdocAst as n,unpackMarkdocAst as r}from"../utils/packed-ast.js";import{headingSlugger as i}from"../utils/heading-slugger.js";import{joinSrcSet as a,parseSrcSet as o}from"../../plugins/internal/assets/srcset.js";import{builtInMarkdocFunctions as s,rbacTeamList as c}from"../constants/builtin-functions.js";import{resolveMarkdocTagSet as l}from"../constants/tag-sets.js";import{frontmatterVariable as u}from"../utils/frontmatter-variable.js";import{stampHeadingIndexes as d}from"../utils/collect-headings.js";import f from"@redocly/markdoc";function p(e){let t=e.viewer,n=t?.isAuthenticated===!0;return{userAgent:n?e.userAgent:null,userIp:n?e.ip:null,remoteAddr:{ipAddress:n?e.ip:null},rbac:{teams:c(e.teams)},user:t?.isAuthenticated?{isAuthenticated:!0,name:t.name??null,email:t.email??null,teams:t.teams}:{isAuthenticated:!1,name:null,email:null,teams:[]}}}function m(e){let t=e=>{Array.isArray(e)?e.forEach(t):f.Tag.isTag(e)&&(e.children=e.children.map(e=>typeof e==`object`&&e&&!f.Tag.isTag(e)?JSON.stringify(e,null,2):(t(e),e)))};return t(e),e}function h(e){return!!e&&typeof e==`object`&&e.$$mdtype===`Node`}function g(e){return f.Ast.fromJSON(e)}function _(e){return e.includes(`"$$mdtype":"Node"`)||e.includes(`"$$mdpack":`)?{}:null}async function v(n,r,i,a){let{tags:o,nodes:c,functions:u}=await l(r.tagSet),f=x(n,{functions:u??s,tags:o,nodes:c,variables:{...p(i),env:t(),frontmatter:b(n),lang:a}});e(f)&&f.ast&&d(f.ast);let m=r.l10nAssets?.[a];return m?y(f,m):f}function y(e,t){let n=e=>{if(!e.includes(`/content-assets`))return e;let n=o(e);if(!n||n.length===0)return e;let r=!1,i=n.map(e=>{let n=e.src.search(/[?#]/),i=t[n===-1?e.src:e.src.slice(0,n)];return i===void 0?e:(r=!0,e.src=n===-1?i:`${i}${e.src.slice(n)}`,e)});return r?a(i):e},r=e=>{if(typeof e==`string`)return n(e);if(Array.isArray(e)){let t=!1,n=e.map(e=>{let n=r(e);return t||=n!==e,n});return t?n:e}if(e&&typeof e==`object`){let t=!1,n=Object.entries(e).map(([e,n])=>{let i=r(n);return t||=i!==n,[e,i]});return t?Object.fromEntries(n):e}return e},i=e=>{f.Tag.isTag(e)?(e.attributes=r(e.attributes),e.children.forEach(i)):Array.isArray(e)?e.forEach(i):e&&typeof e==`object`&&Object.values(e).forEach(i)};return i(e),e}function b(t){return e(t)?u(e(t.frontmatter)?t.frontmatter:{},t.title):{}}function x(e,t){i.reset();let a=e=>e instanceof f.Ast.Node,o=e=>{if(a(e))return m(f.transform(e,t));if(n(e)){let n=r(e);return m(f.transform(n,t))}if(h(e))return m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t));if(Array.isArray(e))return e.length>0&&e.every(a)?m(f.transform(e,t)):e.length>0&&e.every(h)?m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t)):e.map(o);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=o(r);return t}return e};return o(e)}export{p as buildMarkdownRuntimeVariables,_ as detectMarkdocPayloadFlag,h as isMarkdocAstNode,y as localizeMarkdocAssetUrls,g as parseMarkdocPayloadDeep,x as transformMarkdocDeep,v as transformMarkdocPayload};
@@ -1 +1 @@
1
- import{parseMarkdownCached as e}from"./utils/parse-cache.js";import{looksLikeMarkdown as t,resolveImageReference as n,resolveImageSrcSet as r,resolveLocalReference as i}from"./resolve/references.js";function a(a){return{disabledTags:a.disabledTags??/* @__PURE__ */ new Set,looksLikeMarkdown:t,parseCached:e,resolveLocalReference:(e,t,n)=>i(e,t,a.state,a.resolveAudienceTag,a.contentLocales,n),resolveImageReference:(e,t)=>n(e,t,a.state,a.resolveAudienceTag,a.contentLocales),resolveImageSrcSet:(e,t)=>r(e,t,a.state,a.resolveAudienceTag,a.contentLocales)}}export{a as createMarkdownService};
1
+ import{parseMarkdownCached as e}from"./utils/parse-cache.js";import{looksLikeMarkdown as t,resolveImageReference as n,resolveImageSrcSet as r,resolveLocalReference as i}from"./resolve/references.js";function a(a){return{disabledTags:a.disabledTags??/* @__PURE__ */ new Set,contentLocales:a.contentLocales??[],looksLikeMarkdown:t,parseCached:e,resolveLocalReference:(e,t,n)=>i(e,t,a.state,a.resolveAudienceTag,a.contentLocales,n),resolveImageReference:(e,t)=>n(e,t,a.state,a.resolveAudienceTag,a.contentLocales),resolveImageSrcSet:(e,t)=>r(e,t,a.state,a.resolveAudienceTag,a.contentLocales)}}export{a as createMarkdownService};
@@ -1,7 +1,12 @@
1
- import type { Schema } from '@redocly/markdoc';
1
+ import type { Node, Schema } from '@redocly/markdoc';
2
+ /** The resolved `@l10n/<locale>/` twins of a root page's partial, by locale. */
3
+ export declare const PARTIAL_L10N_ATTRIBUTE = "l10n";
4
+ /** The resolved locale twins a `partial` tag carries; none for any other node. */
5
+ export declare function getPartialTwins(node: Node): Node[];
2
6
  /**
3
7
  * Build-time-inlined partial: the `partialFile` resolver reads the file, inlines
4
8
  * its resolved AST as children, and substitutes the static `variables` map. As in
5
- * Markdoc's own `partial` tag, the children render with `variables` in scope.
9
+ * Markdoc's own `partial` tag, the children render with `variables` in scope. A page
10
+ * of a locale (`$lang`) renders the partial's twin in that locale instead, when it has one.
6
11
  */
7
12
  export declare const partial: Schema;
@@ -1 +1 @@
1
- import{isObject as e}from"../../../shared/utils/is-object.js";const t={selfClosing:!0,attributes:{file:{type:String,required:!0,render:!1,buildTimeResolver:`partialFile`},variables:{type:Object,render:!1}},transform(t,n){let r=t.attributes.variables;return e(r)?t.transformChildren({...n,variables:{...n.variables,...r}}):t.transformChildren(n)}};export{t as partial};
1
+ import{isObject as e}from"../../../shared/utils/is-object.js";const t=`l10n`;function n(n){let r=n.tag===`partial`?n.attributes[t]:void 0;return e(r)?Object.values(r):[]}const r={selfClosing:!0,attributes:{file:{type:String,required:!0,render:!1,buildTimeResolver:`partialFile`},variables:{type:Object,render:!1}},transform(n,r){let i=n.attributes[t],a=r.variables?.lang,o=typeof a==`string`&&i?.[a]||n,s=n.attributes.variables;return e(s)?o.transformChildren({...r,variables:{...r.variables,...s}}):o.transformChildren(r)}};export{t as PARTIAL_L10N_ATTRIBUTE,n as getPartialTwins,r as partial};
@@ -1 +1 @@
1
- import{headingSlugger as e}from"../utils/heading-slugger.js";import{variant as t}from"@redocly/theme/markdoc/tags/variant";import n from"@redocly/markdoc";import{CONTROL as r}from"@redocly/theme/core/constants/experiments";const i={...t.schema,transform(i,a){let o=()=>new n.Tag(t.schema.render,i.transformAttributes(a),i.transformChildren(a)),{name:s}=i.attributes;return typeof s==`string`&&s!==r?e.withScope(s,o):o()}};export{i as variant};
1
+ import{headingSlugger as e}from"../utils/heading-slugger.js";import t from"@redocly/markdoc";import{variant as n}from"@redocly/theme/markdoc/tags/variant";import{CONTROL as r}from"@redocly/theme/core/constants/experiments";const i={...n.schema,transform(i,a){let o=()=>new t.Tag(n.schema.render,i.transformAttributes(a),i.transformChildren(a)),{name:s}=i.attributes;return typeof s==`string`&&s!==r?e.withScope(s,o):o()}};export{i as variant};
@@ -3,6 +3,8 @@ import type { ReferenceResolution, ResolveImageSrcSetResult } from '../resolve/r
3
3
  export type MarkdownService = {
4
4
  /** Engine-internal gate (empty until R11): a listed tag resolves to an error node. */
5
5
  disabledTags: ReadonlySet<string>;
6
+ /** Content locales whose `@l10n/<locale>/` twins a root source reports. */
7
+ contentLocales: readonly string[];
6
8
  looksLikeMarkdown(value: string): boolean;
7
9
  parseCached(rawSource: string): ParsedMarkdown;
8
10
  /** `includingPagePath`: the page a partial source is inlined into. */
@@ -1 +1 @@
1
- import{MARKDOC_ERROR_TAG as e}from"../tags/markdoc-error.js";import{hashBlobContent as t}from"../../materialization/data-ref.js";import{createLruCache as n}from"../../../shared/utils/lru-cache.js";import{reparseExampleFences as r}from"./reparse-example-fences.js";import i from"@redocly/markdoc";import{htmlTags as a}from"@redocly/markdoc/html";const o={html:a({errorTag:e}),allowIndentation:!0,allowComments:!0,slots:!0};function s(e){return i.parse(e,o)}function c(e){let t=s(e);return r(t,e,s),t}function l(e){let r=n(e);return e=>{let n=t(e),i=r.get(n);if(i!==void 0)return i;let a=c(e);return r.set(n,a),a}}function u(e,t){return i.parseFirstHeading(e,{...o,skip:t})}const d=l({budget:100});export{l as createCachedMarkdownParser,s as parseMarkdown,d as parseMarkdownCached,c as parseMarkdownDocument,u as parseMarkdownFirstHeading};
1
+ import{hashBlobContent as e}from"../../materialization/data-ref.js";import{MARKDOC_ERROR_TAG as t}from"../tags/markdoc-error.js";import{createLruCache as n}from"../../../shared/utils/lru-cache.js";import{reparseExampleFences as r}from"./reparse-example-fences.js";import i from"@redocly/markdoc";import{htmlTags as a}from"@redocly/markdoc/html";const o={html:a({errorTag:t}),allowIndentation:!0,allowComments:!0,slots:!0};function s(e){return i.parse(e,o)}function c(e){let t=s(e);return r(t,e,s),t}function l(t){let r=n(t);return t=>{let n=e(t),i=r.get(n);if(i!==void 0)return i;let a=c(t);return r.set(n,a),a}}function u(e,t){return i.parseFirstHeading(e,{...o,skip:t})}const d=l({budget:100});export{l as createCachedMarkdownParser,s as parseMarkdown,d as parseMarkdownCached,c as parseMarkdownDocument,u as parseMarkdownFirstHeading};
@@ -8,6 +8,9 @@ type ParseMarkdownFn = (content: string) => MarkdocNode;
8
8
  export declare function reparseExampleFences(ast: MarkdocNode, source: string, parseMarkdown: ParseMarkdownFn): void;
9
9
  /** The parsed body of a `{% markdoc-example %}` tag; `undefined` for any other node. */
10
10
  export declare function getExampleContent(node: MarkdocNode): MarkdocNode | undefined;
11
- /** Every node of `ast` and of the example bodies in it, nested ones included, in one walk. */
11
+ /**
12
+ * Every node of `ast`, of the example bodies in it and of the locale twins of its partials,
13
+ * nested ones included, in one walk.
14
+ */
12
15
  export declare function walkWithExampleContent(ast: MarkdocNode, skipChildren?: WalkMarkdocAstOptions['skipChildren']): Generator<MarkdocNode>;
13
16
  export {};
@@ -1 +1 @@
1
- import{walkMarkdocAst as e}from"./walk-markdoc-ast.js";import{EXAMPLE_CONTENT_ATTRIBUTE as t,MARKDOC_EXAMPLE_TAG as n}from"@redocly/theme/core/constants";function r(e,i,a){if(i.includes(n))for(let n of o(e)){if(!n.children.length)continue;let{content:e}=n.attributes;if(typeof e!=`string`)continue;let i=a(e),o=(n.location?.start.line??0)+1;for(let e of i.children)c(e,o);n.children=[],n.slots={},n.errors=n.errors.filter(e=>e.id!==`no-inline-annotations`),n.attributes[t]=i,r(i,e,a)}}function i(e){return s(e)?.attributes[t]}function a(t,n){return e(t,{getExtraNode:i,skipChildren:n})}function*o(t){for(let n of e(t)){let e=s(n);e&&(yield e)}}function s(e){if(e.type!==`tag`||e.tag!==n)return;let[t]=e.children;return t?.type===`fence`?t:void 0}function c(t,n){for(let r of e(t)){let{location:e}=r;e&&(typeof e.start?.line==`number`&&(e.start.line+=n),typeof e.end?.line==`number`&&(e.end.line+=n))}}export{i as getExampleContent,r as reparseExampleFences,a as walkWithExampleContent};
1
+ import{getPartialTwins as e}from"../tags/partial.js";import{walkMarkdocAst as t}from"./walk-markdoc-ast.js";import{EXAMPLE_CONTENT_ATTRIBUTE as n,MARKDOC_EXAMPLE_TAG as r}from"@redocly/theme/core/constants";function i(e,t,a){if(t.includes(r))for(let t of s(e)){if(!t.children.length)continue;let{content:e}=t.attributes;if(typeof e!=`string`)continue;let r=a(e),o=(t.location?.start.line??0)+1;for(let e of r.children)l(e,o);t.children=[],t.slots={},t.errors=t.errors.filter(e=>e.id!==`no-inline-annotations`),t.attributes[n]=r,i(r,e,a)}}function a(e){return c(e)?.attributes[n]}function o(n,r){return t(n,{getExtraNodes:t=>{let n=a(t);return n?[n]:e(t)},skipChildren:r})}function*s(e){for(let n of t(e)){let e=c(n);e&&(yield e)}}function c(e){if(e.type!==`tag`||e.tag!==r)return;let[t]=e.children;return t?.type===`fence`?t:void 0}function l(e,n){for(let r of t(e)){let{location:e}=r;e&&(typeof e.start?.line==`number`&&(e.start.line+=n),typeof e.end?.line==`number`&&(e.end.line+=n))}}export{a as getExampleContent,i as reparseExampleFences,o as walkWithExampleContent};
@@ -1 +1 @@
1
- function e(e,n){let r=e=>{e.attributes=t(e.attributes,n);for(let t of e.children)r(t);for(let t of Object.values(e.slots??{}))r(t)};r(e)}function t(e,n){if(Array.isArray(e))return e.map(e=>t(e,n));if(typeof e!=`object`||!e)return e;let r=e;if(r.$$mdtype===`Variable`&&Array.isArray(r.path)){let[t,...i]=r.path;if(typeof t==`string`&&t in n){let e=n[t];for(let t of i){if(typeof e!=`object`||!e)return;e=e[t]}return e}return e}if(r.$$mdtype===`Function`){let r=e;return r.parameters&&=t(r.parameters,n),e}if(r.$$mdtype!==void 0)return e;let i={};for(let[r,a]of Object.entries(e))i[r]=t(a,n);return i}export{e as substituteStaticVariables};
1
+ import{getPartialTwins as e}from"../tags/partial.js";function t(t,r){let i=t=>{t.attributes=n(t.attributes,r);for(let e of t.children)i(e);for(let e of Object.values(t.slots??{}))i(e);for(let n of e(t))i(n)};i(t)}function n(e,t){if(Array.isArray(e))return e.map(e=>n(e,t));if(typeof e!=`object`||!e)return e;let r=e;if(r.$$mdtype===`Variable`&&Array.isArray(r.path)){let[n,...i]=r.path;if(typeof n==`string`&&n in t){let e=t[n];for(let t of i){if(typeof e!=`object`||!e)return;e=e[t]}return e}return e}if(r.$$mdtype===`Function`){let r=e;return r.parameters&&=n(r.parameters,t),e}if(r.$$mdtype!==void 0)return e;let i={};for(let[r,a]of Object.entries(e))i[r]=n(a,t);return i}export{t as substituteStaticVariables};
@@ -1,7 +1,7 @@
1
1
  import type { Node as MarkdocNode } from '@redocly/markdoc';
2
2
  export type WalkMarkdocAstOptions = {
3
- /** Returns one more tree to walk under a node, before its children. */
4
- getExtraNode?: (node: MarkdocNode) => MarkdocNode | undefined;
3
+ /** Returns more trees to walk under a node, before its children. */
4
+ getExtraNodes?: (node: MarkdocNode) => readonly MarkdocNode[];
5
5
  /** A node for which this returns `true` is yielded, but nothing under it is walked. */
6
6
  skipChildren?: (node: MarkdocNode) => boolean;
7
7
  };
@@ -1 +1 @@
1
- function*e(n,r={}){if(yield n,r.skipChildren?.(n))return;let i=r.getExtraNode?.(n);i&&(yield*e(i,r));for(let i of n.children)t(i)&&(yield*e(i,r));let a=n.slots??{};for(let n of Object.values(a))t(n)&&(yield*e(n,r))}function t(e){return typeof e==`object`&&!!e&&`type`in e&&`children`in e}export{e as walkMarkdocAst};
1
+ function*e(n,r={}){if(yield n,r.skipChildren?.(n))return;for(let t of r.getExtraNodes?.(n)??[])yield*e(t,r);for(let i of n.children)t(i)&&(yield*e(i,r));let i=n.slots??{};for(let n of Object.values(i))t(n)&&(yield*e(n,r))}function t(e){return typeof e==`object`&&!!e&&`type`in e&&`children`in e}export{e as walkMarkdocAst};
@@ -1 +1 @@
1
- import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import{APP_DATA_STATIC_DATA_SLUG as x}from"../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as S}from"../../shared/constants/route-deps.js";import{createContentPluginIO as C,createPluginIO as w,createRecordingPluginIO as T}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as E,STATIC_FOLDER_PREFIX as D,isStaticFolderPath as O,staticFolderContentPlugin as k}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as A,createContentPluginRegistry as j,matchesContentPluginFilter as M,resolveContentPluginsForFile as N}from"./registry.js";import{dedupeFileDependencies as P,extractFileContributions as F,runContentPluginFinalize as I}from"./execute.js";import{createSourceFile as L}from"./source-file.js";import{createRouteIndex as R,createRouteQueryEvaluator as z,dedupeRouteQueryDependencies as B,isRouteQueryStale as V}from"./utils/route-index.js";import{MOCK_SERVER_ROUTE_PREFIX as H,SPEC_KIND_ARAZZO as U,SPEC_KIND_ASYNCAPI as W,SPEC_KIND_GRAPHQL as G,SPEC_KIND_OPENAPI as K,mockPathPrefix as q}from"./types/api-entity.js";import{createContentOriginKey as J}from"./utils/origin-key.js";import{ASSETS_PLUGIN_ID as Y,ASSET_ENTITY_KEY_PREFIX as X,assetsContentPlugin as Z}from"./internal/assets/index.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as Q,SIDEBAR_AGGREGATOR_LOADER_ID as $,SIDEBAR_FILENAME_REGEX as ee,SIDEBAR_PLUGIN_ID as te,isTabbedSidebar as ne,resolveAutoSidebar as re,sidebarContentPlugin as ie}from"./internal/sidebar/index.js";import{APP_DATA_PLUGIN_ID as ae,APP_DATA_PLUGIN_VERSION as oe,APP_DATA_STATIC_DATA_LOADER_ID as se,appDataContentPlugin as ce,appDataSystemEntityDescriptor as le,buildConfigAppData as ue,isAppDataFragment as de}from"./internal/app-data/index.js";import{BUILT_IN_CLASSIC_PLUGINS as fe,DEFAULT_PROJECT_PLUGIN_FILES as pe,INTERNAL_PLUGIN_ID_PREFIX as me,PLAN_GATED_PLUGINS as he}from"./project/constants.js";import{getLoadedProjectPlugins as ge,setLoadedProjectPlugins as _e,warnWhenProjectPluginsAreNotLoaded as ve}from"./project/loaded-set.js";import{apiDocsContentPlugin as ye}from"./internal/api-docs/index.js";import"./internal/api-functions/constants.js";import{API_FUNCTIONS_PLUGIN_ID as be,apiFunctionsContentPlugin as xe}from"./internal/api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as Se,CATALOG_CLASSIC_PLUGIN_ID as Ce,CATALOG_CLASSIC_SERVER_FN_ID as we,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as Te,CATALOG_CLASSIC_TEMPLATE_ID as Ee,catalogClassicContentPlugin as De}from"./internal/catalog-classic/index.js";import{L10N_PLUGIN_ID as Oe}from"./internal/l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as ke,l10nContentPlugin as Ae}from"./internal/l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as je,MARKDOC_SEARCH_GROUP as Me,MARKDOC_SIDEBAR_ITEM_LOADER_ID as Ne,MARKDOC_TEMPLATE_ID as Pe,markdocContentPlugin as Fe}from"./internal/markdoc/index.js";import{mcpContentPlugin as Ie}from"./internal/mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as Le,MOCK_SERVER_ROUTE_PATH as Re,mockServerContentPlugin as ze}from"./internal/mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as Be,reactPageContentPlugin as Ve}from"./internal/react-page/index.js";import{REVISIONS_PLUGIN_ID as He,revisionsContentPlugin as Ue}from"./internal/revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as We,SCORECARD_CLASSIC_TEMPLATE_ID as Ge,scorecardClassicContentPlugin as Ke}from"./internal/scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as qe,SKILL_MARKDOWN_ROUTE_PATH as Je,skillsContentPlugin as Ye}from"./internal/skills/index.js";import{VERSIONS_PLUGIN_ID as Xe,versionsContentPlugin as Ze}from"./internal/versions/index.js";import{createInternalContentPlugins as Qe}from"./internal/index.js";import{createContentPlugins as $e}from"./create-content-plugins.js";import{createProjectPluginLoadError as et,formatProjectPluginDiagnostics as tt,loadAndRegisterProjectPlugins as nt,loadProjectPlugins as rt,readPluginEntries as it,resolveProjectPluginPath as at}from"./project/load.js";import{reloadProjectPluginsIfChanged as ot}from"./project/reload.js";export{be as API_FUNCTIONS_PLUGIN_ID,ae as APP_DATA_PLUGIN_ID,oe as APP_DATA_PLUGIN_VERSION,se as APP_DATA_STATIC_DATA_LOADER_ID,x as APP_DATA_STATIC_DATA_SLUG,Y as ASSETS_PLUGIN_ID,X as ASSET_ENTITY_KEY_PREFIX,fe as BUILT_IN_CLASSIC_PLUGINS,Se as CATALOG_CLASSIC_LOADER_ID,Ce as CATALOG_CLASSIC_PLUGIN_ID,we as CATALOG_CLASSIC_SERVER_FN_ID,Te as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,Ee as CATALOG_CLASSIC_TEMPLATE_ID,pe as DEFAULT_PROJECT_PLUGIN_FILES,t as ENTITY_LOADER_REFERENCE_KIND,Q as FOLDER_SIDEBAR_FILENAME_REGEX,n as INLINE_ENTITY_REFERENCE_KIND,me as INTERNAL_PLUGIN_ID_PREFIX,Oe as L10N_PLUGIN_ID,ke as L10N_PLUGIN_VERSION,je as MARKDOC_DOCUMENT_LOADER_ID,Me as MARKDOC_SEARCH_GROUP,Ne as MARKDOC_SIDEBAR_ITEM_LOADER_ID,Pe as MARKDOC_TEMPLATE_ID,A as MCP_TOOL_NAME_PATTERN,Le as MOCK_SERVER_PLUGIN_ID,Re as MOCK_SERVER_ROUTE_PATH,H as MOCK_SERVER_ROUTE_PREFIX,he as PLAN_GATED_PLUGINS,Be as REACT_PAGE_SEARCH_LOADER_KEY,He as REVISIONS_PLUGIN_ID,We as SCORECARD_CLASSIC_PLUGIN_ID,Ge as SCORECARD_CLASSIC_TEMPLATE_ID,d as SERVER_FN_REFERENCE_KIND,$ as SIDEBAR_AGGREGATOR_LOADER_ID,ee as SIDEBAR_FILENAME_REGEX,te as SIDEBAR_PLUGIN_ID,S as SIDEBAR_ROUTE_DEP_KEY,qe as SKILLS_PLUGIN_ID,Je as SKILL_MARKDOWN_ROUTE_PATH,U as SPEC_KIND_ARAZZO,W as SPEC_KIND_ASYNCAPI,G as SPEC_KIND_GRAPHQL,K as SPEC_KIND_OPENAPI,E as STATIC_FOLDER_PLUGIN_ID,D as STATIC_FOLDER_PREFIX,f as STORED_ENTITY_REFERENCE_KIND,Xe as VERSIONS_PLUGIN_ID,ye as apiDocsContentPlugin,xe as apiFunctionsContentPlugin,ce as appDataContentPlugin,le as appDataSystemEntityDescriptor,Z as assetsContentPlugin,ue as buildConfigAppData,De as catalogClassicContentPlugin,J as createContentOriginKey,C as createContentPluginIO,j as createContentPluginRegistry,$e as createContentPlugins,r as createEntityLoader,i as createInlineEntity,a as createInlineEntityReference,Qe as createInternalContentPlugins,w as createPluginIO,y as createPluginScopedId,et as createProjectPluginLoadError,T as createRecordingPluginIO,R as createRouteIndex,z as createRouteQueryEvaluator,p as createServerFn,L as createSourceFile,m as createStoredEntityReference,P as dedupeFileDependencies,B as dedupeRouteQueryDependencies,e as defineContentPlugin,F as extractFileContributions,tt as formatProjectPluginDiagnostics,ge as getLoadedProjectPlugins,h as getRegisteredServerFnLoader,de as isAppDataFragment,o as isEntityLoaderReference,s as isInlineEntityReference,c as isRawEntityReference,V as isRouteQueryStale,g as isServerFnReference,O as isStaticFolderPath,ne as isTabbedSidebar,Ae as l10nContentPlugin,nt as loadAndRegisterProjectPlugins,rt as loadProjectPlugins,Fe as markdocContentPlugin,M as matchesContentPluginFilter,Ie as mcpContentPlugin,q as mockPathPrefix,ze as mockServerContentPlugin,_ as normalizeServerFnId,Ve as reactPageContentPlugin,it as readPluginEntries,ot as reloadProjectPluginsIfChanged,re as resolveAutoSidebar,N as resolveContentPluginsForFile,at as resolveProjectPluginPath,l as resolveRuntimeFilePath,v as resolveServerModuleReference,Ue as revisionsContentPlugin,I as runContentPluginFinalize,u as runtimeFile,b as runtimeTemplate,Ke as scorecardClassicContentPlugin,_e as setLoadedProjectPlugins,ie as sidebarContentPlugin,Ye as skillsContentPlugin,k as staticFolderContentPlugin,Ze as versionsContentPlugin,ve as warnWhenProjectPluginsAreNotLoaded};
1
+ import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import{createContentPluginIO as x,createPluginIO as S,createRecordingPluginIO as C}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as w,STATIC_FOLDER_PREFIX as T,isStaticFolderPath as E,staticFolderContentPlugin as D}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as O,createContentPluginRegistry as k,matchesContentPluginFilter as A,resolveContentPluginsForFile as j}from"./registry.js";import{dedupeFileDependencies as M,extractFileContributions as N,runContentPluginFinalize as P}from"./execute.js";import{createSourceFile as F}from"./source-file.js";import{createRouteIndex as I,createRouteQueryEvaluator as L,dedupeRouteQueryDependencies as R,isRouteQueryStale as z}from"./utils/route-index.js";import{MOCK_SERVER_ROUTE_PREFIX as B,SPEC_KIND_ARAZZO as V,SPEC_KIND_ASYNCAPI as H,SPEC_KIND_GRAPHQL as U,SPEC_KIND_OPENAPI as W,mockPathPrefix as G}from"./types/api-entity.js";import{createContentOriginKey as K}from"./utils/origin-key.js";import{ASSETS_PLUGIN_ID as q,ASSET_ENTITY_KEY_PREFIX as J,assetsContentPlugin as Y}from"./internal/assets/index.js";import{APP_DATA_STATIC_DATA_SLUG as X}from"../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as Z}from"../../shared/constants/route-deps.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as Q,SIDEBAR_AGGREGATOR_LOADER_ID as $,SIDEBAR_FILENAME_REGEX as ee,SIDEBAR_PLUGIN_ID as te,isTabbedSidebar as ne,resolveAutoSidebar as re,sidebarContentPlugin as ie}from"./internal/sidebar/index.js";import{APP_DATA_PLUGIN_ID as ae,APP_DATA_PLUGIN_VERSION as oe,APP_DATA_STATIC_DATA_LOADER_ID as se,appDataContentPlugin as ce,appDataSystemEntityDescriptor as le,buildConfigAppData as ue,isAppDataFragment as de}from"./internal/app-data/index.js";import{BUILT_IN_CLASSIC_PLUGINS as fe,DEFAULT_PROJECT_PLUGIN_FILES as pe,INTERNAL_PLUGIN_ID_PREFIX as me,PLAN_GATED_PLUGINS as he}from"./project/constants.js";import{getLoadedProjectPlugins as ge,setLoadedProjectPlugins as _e,warnWhenProjectPluginsAreNotLoaded as ve}from"./project/loaded-set.js";import{apiDocsContentPlugin as ye}from"./internal/api-docs/index.js";import"./internal/api-functions/constants.js";import{API_FUNCTIONS_PLUGIN_ID as be,apiFunctionsContentPlugin as xe}from"./internal/api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as Se,CATALOG_CLASSIC_PLUGIN_ID as Ce,CATALOG_CLASSIC_SERVER_FN_ID as we,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as Te,CATALOG_CLASSIC_TEMPLATE_ID as Ee,catalogClassicContentPlugin as De}from"./internal/catalog-classic/index.js";import{L10N_PLUGIN_ID as Oe}from"./internal/l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as ke,l10nContentPlugin as Ae}from"./internal/l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as je,MARKDOC_SEARCH_GROUP as Me,MARKDOC_SIDEBAR_ITEM_LOADER_ID as Ne,MARKDOC_TEMPLATE_ID as Pe,markdocContentPlugin as Fe}from"./internal/markdoc/index.js";import{mcpContentPlugin as Ie}from"./internal/mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as Le,MOCK_SERVER_ROUTE_PATH as Re,mockServerContentPlugin as ze}from"./internal/mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as Be,reactPageContentPlugin as Ve}from"./internal/react-page/index.js";import{REVISIONS_PLUGIN_ID as He,revisionsContentPlugin as Ue}from"./internal/revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as We,SCORECARD_CLASSIC_TEMPLATE_ID as Ge,scorecardClassicContentPlugin as Ke}from"./internal/scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as qe,SKILL_MARKDOWN_ROUTE_PATH as Je,skillsContentPlugin as Ye}from"./internal/skills/index.js";import{VERSIONS_PLUGIN_ID as Xe,versionsContentPlugin as Ze}from"./internal/versions/index.js";import{createInternalContentPlugins as Qe}from"./internal/index.js";import{createContentPlugins as $e}from"./create-content-plugins.js";import{createProjectPluginLoadError as et,formatProjectPluginDiagnostics as tt,loadAndRegisterProjectPlugins as nt,loadProjectPlugins as rt,readPluginEntries as it,resolveProjectPluginPath as at}from"./project/load.js";import{reloadProjectPluginsIfChanged as ot}from"./project/reload.js";export{be as API_FUNCTIONS_PLUGIN_ID,ae as APP_DATA_PLUGIN_ID,oe as APP_DATA_PLUGIN_VERSION,se as APP_DATA_STATIC_DATA_LOADER_ID,X as APP_DATA_STATIC_DATA_SLUG,q as ASSETS_PLUGIN_ID,J as ASSET_ENTITY_KEY_PREFIX,fe as BUILT_IN_CLASSIC_PLUGINS,Se as CATALOG_CLASSIC_LOADER_ID,Ce as CATALOG_CLASSIC_PLUGIN_ID,we as CATALOG_CLASSIC_SERVER_FN_ID,Te as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,Ee as CATALOG_CLASSIC_TEMPLATE_ID,pe as DEFAULT_PROJECT_PLUGIN_FILES,t as ENTITY_LOADER_REFERENCE_KIND,Q as FOLDER_SIDEBAR_FILENAME_REGEX,n as INLINE_ENTITY_REFERENCE_KIND,me as INTERNAL_PLUGIN_ID_PREFIX,Oe as L10N_PLUGIN_ID,ke as L10N_PLUGIN_VERSION,je as MARKDOC_DOCUMENT_LOADER_ID,Me as MARKDOC_SEARCH_GROUP,Ne as MARKDOC_SIDEBAR_ITEM_LOADER_ID,Pe as MARKDOC_TEMPLATE_ID,O as MCP_TOOL_NAME_PATTERN,Le as MOCK_SERVER_PLUGIN_ID,Re as MOCK_SERVER_ROUTE_PATH,B as MOCK_SERVER_ROUTE_PREFIX,he as PLAN_GATED_PLUGINS,Be as REACT_PAGE_SEARCH_LOADER_KEY,He as REVISIONS_PLUGIN_ID,We as SCORECARD_CLASSIC_PLUGIN_ID,Ge as SCORECARD_CLASSIC_TEMPLATE_ID,d as SERVER_FN_REFERENCE_KIND,$ as SIDEBAR_AGGREGATOR_LOADER_ID,ee as SIDEBAR_FILENAME_REGEX,te as SIDEBAR_PLUGIN_ID,Z as SIDEBAR_ROUTE_DEP_KEY,qe as SKILLS_PLUGIN_ID,Je as SKILL_MARKDOWN_ROUTE_PATH,V as SPEC_KIND_ARAZZO,H as SPEC_KIND_ASYNCAPI,U as SPEC_KIND_GRAPHQL,W as SPEC_KIND_OPENAPI,w as STATIC_FOLDER_PLUGIN_ID,T as STATIC_FOLDER_PREFIX,f as STORED_ENTITY_REFERENCE_KIND,Xe as VERSIONS_PLUGIN_ID,ye as apiDocsContentPlugin,xe as apiFunctionsContentPlugin,ce as appDataContentPlugin,le as appDataSystemEntityDescriptor,Y as assetsContentPlugin,ue as buildConfigAppData,De as catalogClassicContentPlugin,K as createContentOriginKey,x as createContentPluginIO,k as createContentPluginRegistry,$e as createContentPlugins,r as createEntityLoader,i as createInlineEntity,a as createInlineEntityReference,Qe as createInternalContentPlugins,S as createPluginIO,y as createPluginScopedId,et as createProjectPluginLoadError,C as createRecordingPluginIO,I as createRouteIndex,L as createRouteQueryEvaluator,p as createServerFn,F as createSourceFile,m as createStoredEntityReference,M as dedupeFileDependencies,R as dedupeRouteQueryDependencies,e as defineContentPlugin,N as extractFileContributions,tt as formatProjectPluginDiagnostics,ge as getLoadedProjectPlugins,h as getRegisteredServerFnLoader,de as isAppDataFragment,o as isEntityLoaderReference,s as isInlineEntityReference,c as isRawEntityReference,z as isRouteQueryStale,g as isServerFnReference,E as isStaticFolderPath,ne as isTabbedSidebar,Ae as l10nContentPlugin,nt as loadAndRegisterProjectPlugins,rt as loadProjectPlugins,Fe as markdocContentPlugin,A as matchesContentPluginFilter,Ie as mcpContentPlugin,G as mockPathPrefix,ze as mockServerContentPlugin,_ as normalizeServerFnId,Ve as reactPageContentPlugin,it as readPluginEntries,ot as reloadProjectPluginsIfChanged,re as resolveAutoSidebar,j as resolveContentPluginsForFile,at as resolveProjectPluginPath,l as resolveRuntimeFilePath,v as resolveServerModuleReference,Ue as revisionsContentPlugin,P as runContentPluginFinalize,u as runtimeFile,b as runtimeTemplate,Ke as scorecardClassicContentPlugin,_e as setLoadedProjectPlugins,ie as sidebarContentPlugin,Ye as skillsContentPlugin,D as staticFolderContentPlugin,Ze as versionsContentPlugin,ve as warnWhenProjectPluginsAreNotLoaded};
@@ -1,7 +1,7 @@
1
- import{ApiDocsLayoutContext as e,PageContext as t}from"../../../../../client/contexts.js";import{withPathPrefix as n}from"../../../../../shared/path-prefix.js";import{MarkdocRenderer as r,markdocComponents as i}from"../../../../markdown/client/markdoc-components.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as a,API_DOCS_RENDER_DEP_KEY as o,apiPageTitle as s}from"../server/shared.js";import{rebaseItemLinks as c}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as l}from"../../../../../client/telemetry/config.js";import{withReplayOptions as u}from"../../../../../client/replay-options.js";import{REPLAY_OAUTH2_ROUTE_PATH as d}from"../../../../../shared/constants/replay.js";import{JsonSchemaTag as f}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as p}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as m}from"./event-handlers.js";import{useContext as h,useEffect as g,useMemo as _}from"react";import{useLocation as v}from"react-router";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import S from"styled-components";import{useThemeConfig as C}from"@redocly/theme/core/hooks";import{LayoutVariant as w}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as T}from"virtual:realm-runtime";import{userMarkdocComponents as E}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as D,apiDocsMarkdocComponents as O}from"@redocly/api-docs";import{Breadcrumbs as k}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as A}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as j}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as M}from"@redocly/theme/layouts/ThreePanelLayout";const N={...i,JsonSchema:E.JsonSchema??f,JsonExample:E.JsonExample??p,...O},P={parse:e=>e,render:e=>/* @__PURE__ */ b(r,{ast:e,components:N})},F={MiddlePanelHeader:I};function I(){return/* @__PURE__ */ x(y,{children:[/* @__PURE__ */ b(k,{}),/* @__PURE__ */ b(V,{})]})}function L(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function R({page:t}){let n=T(o),r=T(a),{layout:i}=h(e),s=z(),d=_(()=>n&&{...m(u(n.options)),oAuth2RedirectURI:B(),userClaims:s,unstable_hooks:F},[n,s]),f=t.slug.toLowerCase(),p=_(()=>n&&n.basePath!==f?c(n.items,n.basePath,f):n?.items,[n,f]);if(U(t.metadata,p,n?.title),!n)return null;let g=l();return/* @__PURE__ */ x(y,{children:[r&&/* @__PURE__ */ b(H,{layout:i,children:/* @__PURE__ */ b(A,{metadata:r})}),/* @__PURE__ */ b(D,{items:p,store:n.store,options:d,basePath:f,layout:i,markdownAdapter:P,telemetryConfig:g})]})}function z(){let e=h(t)?.auth?.userInfo,n=e?.isAuthenticated?e.email:void 0,r=e?.isAuthenticated?e.name:void 0;return _(()=>({email:n,name:r}),[n,r])}function B(){if(typeof window<`u`)return new URL(n(d),window.location.origin).toString()}const V=S(j)`
1
+ import{REPLAY_OAUTH2_ROUTE_PATH as e}from"../../../../../shared/constants/replay.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as n,API_DOCS_RENDER_DEP_KEY as r,apiPageTitle as i}from"../server/shared.js";import{ApiDocsLayoutContext as a,PageContext as o}from"../../../../../client/contexts.js";import{MarkdocRenderer as s,markdocComponents as c}from"../../../../markdown/client/markdoc-components.js";import{rebaseItemLinks as l}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as u}from"../../../../../client/telemetry/config.js";import{withReplayOptions as d}from"../../../../../client/replay-options.js";import{JsonSchemaTag as f}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as p}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as m}from"./event-handlers.js";import{useContext as h,useEffect as g,useMemo as _}from"react";import{useLocation as v}from"react-router";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import S from"styled-components";import{useThemeConfig as C}from"@redocly/theme/core/hooks";import{LayoutVariant as w}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as T}from"virtual:realm-runtime";import{userMarkdocComponents as E}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as D,apiDocsMarkdocComponents as O}from"@redocly/api-docs";import{Breadcrumbs as k}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as A}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as j}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as M}from"@redocly/theme/layouts/ThreePanelLayout";const N={...c,JsonSchema:E.JsonSchema??f,JsonExample:E.JsonExample??p,...O},P={parse:e=>e,render:e=>/* @__PURE__ */ b(s,{ast:e,components:N})},F={MiddlePanelHeader:I};function I(){return/* @__PURE__ */ x(y,{children:[/* @__PURE__ */ b(k,{}),/* @__PURE__ */ b(V,{})]})}function L(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function R({page:e}){let t=T(r),i=T(n),{layout:o}=h(a),s=z(),c=_(()=>t&&{...m(d(t.options)),oAuth2RedirectURI:B(),userClaims:s,unstable_hooks:F},[t,s]),f=e.slug.toLowerCase(),p=_(()=>t&&t.basePath!==f?l(t.items,t.basePath,f):t?.items,[t,f]);if(U(e.metadata,p,t?.title),!t)return null;let g=u();return/* @__PURE__ */ x(y,{children:[i&&/* @__PURE__ */ b(H,{layout:o,children:/* @__PURE__ */ b(A,{metadata:i})}),/* @__PURE__ */ b(D,{items:p,store:t.store,options:c,basePath:f,layout:o,markdownAdapter:P,telemetryConfig:g})]})}function z(){let e=h(o)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,n=e?.isAuthenticated?e.name:void 0;return _(()=>({email:t,name:n}),[t,n])}function B(){if(typeof window<`u`)return new URL(t(e),window.location.origin).toString()}const V=S(j)`
2
2
  width: 100%;
3
3
  `,H=S(M)`
4
4
  && {
5
5
  padding-right: ${({layout:e})=>e===w.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
6
6
  }
7
- `;function U(e,t,n){let{pathname:r}=v(),{seo:i}=C(),a=i?.projectTitle,o=t?s(e,t,L(r),n):void 0;g(()=>{o&&(document.title=a?`${o} | ${a}`:o)},[o,a])}export{R as default};
7
+ `;function U(e,t,n){let{pathname:r}=v(),{seo:a}=C(),o=a?.projectTitle,s=t?i(e,t,L(r),n):void 0;g(()=>{s&&(document.title=o?`${s} | ${o}`:s)},[s,o])}export{R as default};
@@ -1 +1 @@
1
- import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{TRANSLATIONS_FILE_PATTERN as d}from"../../../../shared/constants/l10n/defaults.js";import{isObject as f}from"../../../../shared/utils/is-object.js";import{API_DOCS_API_LOADER_ID as p,API_DOCS_PLUGIN_ID as m,API_DOCS_RENDER_DEP_KEY as h,API_DOCS_RENDER_LOADER_ID as g,API_DOCS_SIDEBAR_LOADER_ID as _,API_DOCS_TEMPLATE_ID as v,SPEC_DOWNLOAD_ROUTE_PATHS as y,SPEC_PATH_PARAM as b}from"./server/shared.js";import{API_DOCS_MARKDOC_TAG_SET as x,resolveMarkdocTagSet as ee}from"../../../markdown/constants/tag-sets.js";import{toPosixPath as te}from"../../../../shared/utils/to-posix-path.js";import{notInPlanProblem as ne}from"../../../plan-gates.js";import{filePathToRouteSlug as re}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as S,SPEC_KIND_ASYNCAPI as C,SPEC_KIND_GRAPHQL as w,SPEC_KIND_OPENAPI as T}from"../../types/api-entity.js";import{isPlanFeatureGranted as E}from"../../../../shared/plan-gates.js";import{packMarkdocAstsDeep as D,unpackMarkdocAstsDeep as O}from"../../../markdown/utils/packed-ast.js";import{parseMarkdownCached as k}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as A}from"../../utils/api-entity-key.js";import{resolveApiBundleConfig as ie,resolveApiOptions as ae,resolveNestedFeedback as oe,schemaCatalogLink as se,withDownloadUrls as ce,withFeedbackOption as le,withMockServerOption as ue}from"./server/options.js";import{annotateApiDocsRbac as de}from"../../../../server/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as j}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as fe}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as M}from"../../../api-outputs.js";import{pageLocale as N}from"../../utils/page-locale.js";import{buildBundledApiDefinition as P,resolveLlmsDescriptions as F}from"./server/build-definition.js";import{collectSidebarSubpathTargets as I,toSidebarSubtree as L,toSubpathTarget as R}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as z}from"./server/markdown-docs.js";import{join as B,relative as V}from"node:path";import pe from"@redocly/markdoc";const me=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],he={[T]:`OpenAPI`,[C]:`AsyncAPI`,[w]:`GraphQL`,[S]:`Arazzo`},H=t(g,async e=>{let{buildItems:t}=await import(`@redocly/api-docs`),n=G(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=ce(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?ue(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=W(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await P({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:K(e.args,c),metadata:Y(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),d={...f(u.document)&&f(u.document.info)?{infoDescription:u.document.info.description}:{},...await F(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&f(u.document)&&(u.document[`x-schema-catalog-link`]=se(e.file.path)),u.options=le(u.options,u.document,e.args.feedback??e.config.feedback);let p=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:p,markdownParser:e=>pe.compact(k(e))}),_=JSON.stringify({items:D(m),store:D(h),options:u.options,specType:g,basePath:p,title:xe(u.document,e.args.kind,m),metadata:be(u.document),[j]:{llms:d}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...J(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:x},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=O(e),r=await Ee(t.entities,t.route.originFilePath),d={...t.route.metadata,...f(n.metadata)?n.metadata:{}},{category:p,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:p,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=O(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(A(r)).catch(()=>void 0):void 0,{tags:a}=await ee(x);return z(n,ye(i,n[j]?.llms),r,{tags:a,locale:N(t)})},usesProjectMarkdocSchema:!0}),U=t(p,async e=>{let t=G(e),n=await e.io.readFile(t.absolutePath),r=W(e.contentDir),i=await P({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:K(e.args,r),metadata:Y(e.args.options)}),a=e.args.kind===w,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),..._e(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:J(e.file.path,[...i.fileDependencies,...r.paths])}});function W(e){let t=fe(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>te(V(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function G(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:B(e.contentDir,t)}}function ge(e){let t=e[M];return f(t)&&typeof t.root==`string`?t.root:void 0}function K(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function _e(e,t){let n=f(e)&&f(e.info)?e.info:{},r=f(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const q=t(_,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs`),r=await e.entities.load(A(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=de(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:k}),s=L(o),c=n(o).map(({from:e})=>R(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...I(s),...c]}]}});function J(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const ve={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function ye(e,t){if(t===void 0||!f(e))return e;let n=f(e.info)?e.info:{},r=f(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function be(e){let t=f(e)&&f(e.info)?e.info:{};return f(t[`x-metadata`])?t[`x-metadata`]:{}}function xe(e,t,n){let r=f(e)&&f(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=f(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:ve[t]}const Se=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Ce(e,t){let n=f(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),f(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),f(t.metadata)&&Object.assign(r,t.metadata);for(let e of Se)delete r[e];return r}function Y(e){return f(e.metadata)?e.metadata:void 0}function X(e){let t=Y(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=X(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...f(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function we(e){if(e.ext===`.gql`||e.ext===`.graphql`)return w;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?T:Q(r)?C:Q(i)?S:null}const Te=e({id:m,version:`0.43.0`,content:{filter:{extensions:me},async extractFile(e,t){if(d.test(e.path))return null;let n=we(e);if(n===null)return null;if(n!==`arazzo`&&!E(t.config,n))return{routes:[],problems:[ne(`${he[n]} documents`)]};let r=e.path,i=ge(e.manifest),a=i??r,{rbac:o,...s}=await ae(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!E(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await oe(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await ie(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=U.withArgs(c,{stableKey:A(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let f=Ce(e,s);s.excludeFromSearch===!0&&(f.excludeFromSearch=!0),f.type=n,c.rbac!==void 0&&(f.rbac=c.rbac);let p=H.withArgs(c,{stableKey:`api-docs:render:${r}`}),m=q.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),g=re(r);return{routes:[{deps:{[h]:p},metadata:f,routeId:`page`,sidebarSubtree:m,slug:null,slugHint:g,template:v,wildcardPrefix:!0}],entities:[u,p,m]}}},loaders:[U,H,q],templates:{[v]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(y.bundle,`bundle`),$(y.deprecatedBundle,`bundle`),$(y.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+b,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Ee(e,t){if(t)try{return await e.load(A(t))}catch{return}}export{Te as apiDocsContentPlugin};
1
+ import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{toPosixPath as d}from"../../../../shared/utils/to-posix-path.js";import{TRANSLATIONS_FILE_PATTERN as f}from"../../../../shared/constants/l10n/defaults.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{notInPlanProblem as m}from"../../../plan-gates.js";import{filePathToRouteSlug as h}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as g,SPEC_KIND_ASYNCAPI as _,SPEC_KIND_GRAPHQL as v,SPEC_KIND_OPENAPI as y}from"../../types/api-entity.js";import{isPlanFeatureGranted as b}from"../../../../shared/plan-gates.js";import{packMarkdocAstsDeep as x,unpackMarkdocAstsDeep as S}from"../../../markdown/utils/packed-ast.js";import{parseMarkdownCached as C}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as w}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as T,API_DOCS_PLUGIN_ID as ee,API_DOCS_RENDER_DEP_KEY as E,API_DOCS_RENDER_LOADER_ID as D,API_DOCS_SIDEBAR_LOADER_ID as te,API_DOCS_TEMPLATE_ID as O,SPEC_DOWNLOAD_ROUTE_PATHS as k,SPEC_PATH_PARAM as ne}from"./server/shared.js";import{resolveApiBundleConfig as re,resolveApiOptions as ie,resolveNestedFeedback as ae,schemaCatalogLink as oe,withDownloadUrls as se,withFeedbackOption as ce,withMockServerOption as le}from"./server/options.js";import{annotateApiDocsRbac as ue}from"../../../../server/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as A}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as de}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as j}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as M,resolveMarkdocTagSet as N}from"../../../markdown/constants/tag-sets.js";import{pageLocale as P}from"../../utils/page-locale.js";import{buildBundledApiDefinition as F,resolveLlmsDescriptions as I}from"./server/build-definition.js";import{collectSidebarSubpathTargets as L,toSidebarSubtree as R,toSubpathTarget as z}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as B}from"./server/markdown-docs.js";import{join as V,relative as H}from"node:path";import fe from"@redocly/markdoc";const pe=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],me={[y]:`OpenAPI`,[_]:`AsyncAPI`,[v]:`GraphQL`,[g]:`Arazzo`},U=t(D,async e=>{let{buildItems:t}=await import(`@redocly/api-docs`),n=K(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=se(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?le(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=G(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await F({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:q(e.args,c),metadata:X(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),d={...p(u.document)&&p(u.document.info)?{infoDescription:u.document.info.description}:{},...await I(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&p(u.document)&&(u.document[`x-schema-catalog-link`]=oe(e.file.path)),u.options=ce(u.options,u.document,e.args.feedback??e.config.feedback);let f=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:f,markdownParser:e=>fe.compact(C(e))}),_=JSON.stringify({items:x(m),store:x(h),options:u.options,specType:g,basePath:f,title:be(u.document,e.args.kind,m),metadata:ye(u.document),[A]:{llms:d}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...Y(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:M},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=S(e),r=await Ee(t.entities,t.route.originFilePath),d={...t.route.metadata,...p(n.metadata)?n.metadata:{}},{category:f,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=S(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(w(r)).catch(()=>void 0):void 0,{tags:a}=await N(M);return B(n,ve(i,n[A]?.llms),r,{tags:a,locale:P(t)})},usesProjectMarkdocSchema:!0}),W=t(T,async e=>{let t=K(e),n=await e.io.readFile(t.absolutePath),r=G(e.contentDir),i=await F({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:q(e.args,r),metadata:X(e.args.options)}),a=e.args.kind===v,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),...ge(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:Y(e.file.path,[...i.fileDependencies,...r.paths])}});function G(e){let t=de(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>d(H(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function K(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:V(e.contentDir,t)}}function he(e){let t=e[j];return p(t)&&typeof t.root==`string`?t.root:void 0}function q(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function ge(e,t){let n=p(e)&&p(e.info)?e.info:{},r=p(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const J=t(te,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs`),r=await e.entities.load(w(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=ue(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:C}),s=R(o),c=n(o).map(({from:e})=>z(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...L(s),...c]}]}});function Y(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const _e={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function ve(e,t){if(t===void 0||!p(e))return e;let n=p(e.info)?e.info:{},r=p(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function ye(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function be(e,t,n){let r=p(e)&&p(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=p(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:_e[t]}const xe=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Se(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),p(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),p(t.metadata)&&Object.assign(r,t.metadata);for(let e of xe)delete r[e];return r}function X(e){return p(e.metadata)?e.metadata:void 0}function Ce(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=Ce(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...p(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function we(e){if(e.ext===`.gql`||e.ext===`.graphql`)return v;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?y:Q(r)?_:Q(i)?g:null}const Te=e({id:ee,version:`0.44.0`,content:{filter:{extensions:pe},async extractFile(e,t){if(f.test(e.path))return null;let n=we(e);if(n===null)return null;if(n!==`arazzo`&&!b(t.config,n))return{routes:[],problems:[m(`${me[n]} documents`)]};let r=e.path,i=he(e.manifest),a=i??r,{rbac:o,...s}=await ie(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!b(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await ae(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await re(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=W.withArgs(c,{stableKey:w(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let d=Se(e,s);s.excludeFromSearch===!0&&(d.excludeFromSearch=!0),d.type=n,c.rbac!==void 0&&(d.rbac=c.rbac);let p=U.withArgs(c,{stableKey:`api-docs:render:${r}`}),g=J.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),_=h(r);return{routes:[{deps:{[E]:p},metadata:d,routeId:`page`,sidebarSubtree:g,slug:null,slugHint:_,template:O,wildcardPrefix:!0}],entities:[u,p,g]}}},loaders:[W,U,J],templates:{[O]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(k.bundle,`bundle`),$(k.deprecatedBundle,`bundle`),$(k.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+ne,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Ee(e,t){if(t)try{return await e.load(w(t))}catch{return}}export{Te as apiDocsContentPlugin};