@redocly/framework 1.0.0-next.1 → 1.0.0-next.11

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 (484) 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/theme-global-style-compiler.js +1 -0
  4. package/dist/bundler/build/theme-global-stylesheets.js +1 -0
  5. package/dist/bundler/build/vite-config.js +2 -2
  6. package/dist/bundler/dev/dev-content-build.js +1 -0
  7. package/dist/bundler/dev/dev-problems.js +1 -1
  8. package/dist/bundler/dev/dev-reporter.js +1 -1
  9. package/dist/bundler/dev/routes/dev-content-build-route.js +1 -0
  10. package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
  11. package/dist/bundler/dev/run.js +1 -1
  12. package/dist/bundler/dev/runtime-app.js +1 -1
  13. package/dist/bundler/dev/vite-config.js +1 -1
  14. package/dist/bundler/node-bundle.js +1 -0
  15. package/dist/bundler/runtime-files.js +1 -1
  16. package/dist/bundler/user-markdoc-schema.js +1 -1
  17. package/dist/bundler/vite-config.base.js +12 -12
  18. package/dist/cli/api-docs-build-event.js +1 -0
  19. package/dist/cli/commands/build.js +1 -1
  20. package/dist/cli/commands/ingest.js +1 -1
  21. package/dist/cli/commands/translate.js +1 -1
  22. package/dist/cli/dev-console/{sweep.js → content-build.js} +1 -1
  23. package/dist/cli/dev-console/index.js +1 -1
  24. package/dist/cli/dev-console/lines.js +2 -2
  25. package/dist/cli/dev-console/plain.js +1 -1
  26. package/dist/cli/dev-console/tui.js +2 -2
  27. package/dist/cli/output.js +12 -12
  28. package/dist/cli/validate-react-pages.js +1 -1
  29. package/dist/client/ApiAccess.js +3 -0
  30. package/dist/client/NavigationProgress.js +1 -1
  31. package/dist/client/ProductsProvider.js +1 -1
  32. package/dist/client/RouteErrorBoundary.js +1 -1
  33. package/dist/client/RuntimeLink.js +1 -0
  34. package/dist/client/ThemeGlobalStyle.js +1 -0
  35. package/dist/client/UnversionedVersionButton.js +1 -1
  36. package/dist/client/app.js +2 -7
  37. package/dist/client/client-entry.js +1 -1
  38. package/dist/client/dev-problems/ProblemsBar.js +75 -15
  39. package/dist/client/dev-problems/ProblemsModal.js +15 -15
  40. package/dist/client/dev-problems/build-segment.js +1 -0
  41. package/dist/client/dev-problems/index.js +1 -1
  42. package/dist/client/dev-problems/use-dev-problems.js +1 -1
  43. package/dist/client/experiments/runtime.js +1 -1
  44. package/dist/client/history-mount.js +1 -0
  45. package/dist/client/l10n/use-l10n-config.js +1 -1
  46. package/dist/client/l10n/use-l10n-href.js +1 -1
  47. package/dist/client/l10n/use-translate.js +1 -1
  48. package/dist/client/products.js +1 -1
  49. package/dist/client/review/ReviewBar.js +163 -69
  50. package/dist/client/review/login-url.js +1 -0
  51. package/dist/client/revisions-history.js +1 -1
  52. package/dist/client/sidebar/PoweredByRedocly.js +2 -2
  53. package/dist/client/ssr.js +1 -1
  54. package/dist/client/telemetry/report-preload-failure.js +1 -0
  55. package/dist/client/templates/dev-login.js +4 -4
  56. package/dist/client/templates/unauthorized.js +5 -5
  57. package/dist/client/theme-global-css.js +1 -0
  58. package/dist/client/use-banner.js +1 -1
  59. package/dist/client/use-bar-position.js +1 -0
  60. package/dist/client/use-page-versions.js +1 -1
  61. package/dist/client/use-router-for-local-links.js +1 -1
  62. package/dist/client/use-search.js +1 -1
  63. package/dist/client/utils/routes/is-router-path.js +1 -0
  64. package/dist/client/webmcp/tools/shared.js +1 -1
  65. package/dist/content-layer/allowed-packages.js +1 -1
  66. package/dist/content-layer/api-outputs.js +1 -1
  67. package/dist/content-layer/config-schema.d.ts +12 -3
  68. package/dist/content-layer/config-schema.js +1 -1
  69. package/dist/content-layer/config.d.ts +30 -12
  70. package/dist/content-layer/config.js +1 -1
  71. package/dist/content-layer/context.d.ts +2 -0
  72. package/dist/content-layer/context.js +1 -1
  73. package/dist/content-layer/database/adapters/node-sqlite-client.js +1 -1
  74. package/dist/content-layer/database/assets.js +1 -1
  75. package/dist/content-layer/database/blobs.js +1 -1
  76. package/dist/content-layer/database/connection.js +1 -1
  77. package/dist/content-layer/database/entity-store.d.ts +24 -3
  78. package/dist/content-layer/database/entity-store.js +1 -1
  79. package/dist/content-layer/database/files.js +1 -1
  80. package/dist/content-layer/database/finalize.js +1 -1
  81. package/dist/content-layer/database/invalidation.d.ts +6 -0
  82. package/dist/content-layer/database/invalidation.js +26 -26
  83. package/dist/content-layer/database/link-refs.js +1 -1
  84. package/dist/content-layer/database/origins.d.ts +2 -4
  85. package/dist/content-layer/database/origins.js +1 -1
  86. package/dist/content-layer/database/problems.d.ts +2 -0
  87. package/dist/content-layer/database/problems.js +1 -1
  88. package/dist/content-layer/database/reset.js +1 -1
  89. package/dist/content-layer/database/route-query-deps.js +1 -1
  90. package/dist/content-layer/database/schema.d.ts +50 -0
  91. package/dist/content-layer/database/schema.js +1 -1
  92. package/dist/content-layer/database/search-vocab.js +2 -2
  93. package/dist/content-layer/database/site-config.d.ts +23 -0
  94. package/dist/content-layer/database/site-config.js +1 -1
  95. package/dist/content-layer/database/static-files.js +1 -1
  96. package/dist/content-layer/ingest/extract-all-phase.js +1 -1
  97. package/dist/content-layer/ingest/finalize-phase.js +1 -1
  98. package/dist/content-layer/ingest/git-last-modified.js +3 -3
  99. package/dist/content-layer/ingest/hash.js +1 -1
  100. package/dist/content-layer/ingest/hook-inputs.js +1 -1
  101. package/dist/content-layer/ingest/l10n-warnings.js +1 -1
  102. package/dist/content-layer/ingest/markdoc-schema-problem.js +1 -0
  103. package/dist/content-layer/ingest/rbac-teams.js +1 -1
  104. package/dist/content-layer/ingest/run.js +1 -1
  105. package/dist/content-layer/ingest/scan.d.ts +1 -1
  106. package/dist/content-layer/ingest/scan.js +1 -1
  107. package/dist/content-layer/ingest/search-sync.js +1 -1
  108. package/dist/content-layer/ingest/slugger/resolve-final-slugs.js +1 -1
  109. package/dist/content-layer/ingest/sync.js +1 -1
  110. package/dist/content-layer/link-checker/delta.js +1 -1
  111. package/dist/content-layer/link-checker/fingerprint.js +1 -1
  112. package/dist/content-layer/link-checker/load-view.js +1 -1
  113. package/dist/content-layer/link-checker/run-build.js +1 -1
  114. package/dist/content-layer/link-checker/validate.js +1 -1
  115. package/dist/content-layer/link-checker/view.js +1 -1
  116. package/dist/content-layer/loaders/context.js +1 -1
  117. package/dist/content-layer/loaders/define.d.ts +3 -0
  118. package/dist/content-layer/markdown/client/JsonSchemaTag.js +1 -1
  119. package/dist/content-layer/markdown/client/OpenapiTagComponents.js +2 -2
  120. package/dist/content-layer/markdown/client/code-highlight-notation.js +3 -3
  121. package/dist/content-layer/markdown/client/dynamic-components.js +1 -1
  122. package/dist/content-layer/markdown/client/markdoc-components.js +2 -2
  123. package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
  124. package/dist/content-layer/markdown/constants/markdown-text-tag-set.js +1 -1
  125. package/dist/content-layer/markdown/constants/tag-sets.d.ts +20 -5
  126. package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
  127. package/dist/content-layer/markdown/nodes/fence.js +1 -1
  128. package/dist/content-layer/markdown/nodes/heading.js +1 -1
  129. package/dist/content-layer/markdown/nodes/table.js +1 -1
  130. package/dist/content-layer/markdown/resolve/ast.js +1 -1
  131. package/dist/content-layer/markdown/resolve/attribute-resolver-key.d.ts +8 -1
  132. package/dist/content-layer/markdown/resolve/attribute-resolver-key.js +1 -1
  133. package/dist/content-layer/markdown/resolve/audience-tag.d.ts +2 -6
  134. package/dist/content-layer/markdown/resolve/audience-tag.js +1 -1
  135. package/dist/content-layer/markdown/resolve/markdoc-resolvers/code-snippet.js +5 -4
  136. package/dist/content-layer/markdown/resolve/markdoc-resolvers/code-walkthrough/filesets.js +1 -1
  137. package/dist/content-layer/markdown/resolve/markdoc-resolvers/diagram-file.js +1 -1
  138. package/dist/content-layer/markdown/resolve/markdoc-resolvers/file-reference.js +1 -1
  139. package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.d.ts +2 -1
  140. package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.js +1 -1
  141. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.d.ts +1 -1
  142. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
  143. package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
  144. package/dist/content-layer/markdown/resolve/markdoc-resolvers/svg-content.js +1 -1
  145. package/dist/content-layer/markdown/resolve/markdoc.d.ts +2 -1
  146. package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
  147. package/dist/content-layer/markdown/resolve/raw-partials.d.ts +2 -1
  148. package/dist/content-layer/markdown/resolve/raw-partials.js +1 -1
  149. package/dist/content-layer/markdown/resolve/references.d.ts +3 -1
  150. package/dist/content-layer/markdown/resolve/references.js +1 -1
  151. package/dist/content-layer/markdown/resolve/render-diagrams.d.ts +8 -1
  152. package/dist/content-layer/markdown/resolve/render-diagrams.js +1 -1
  153. package/dist/content-layer/markdown/search/to-markdown.js +2 -2
  154. package/dist/content-layer/markdown/search/to-sections.d.ts +8 -3
  155. package/dist/content-layer/markdown/search/to-sections.js +1 -1
  156. package/dist/content-layer/markdown/search/to-text.d.ts +4 -1
  157. package/dist/content-layer/markdown/search/to-text.js +5 -5
  158. package/dist/content-layer/markdown/server/render.d.ts +4 -2
  159. package/dist/content-layer/markdown/server/render.js +1 -1
  160. package/dist/content-layer/markdown/service.js +1 -1
  161. package/dist/content-layer/markdown/tags/html.d.ts +5 -2
  162. package/dist/content-layer/markdown/tags/html.js +1 -1
  163. package/dist/content-layer/markdown/tags/markdoc-error.d.ts +8 -0
  164. package/dist/content-layer/markdown/tags/markdoc-error.js +1 -1
  165. package/dist/content-layer/markdown/tags/openapi.d.ts +1 -1
  166. package/dist/content-layer/markdown/tags/openapi.js +1 -1
  167. package/dist/content-layer/markdown/tags/partial.d.ts +9 -3
  168. package/dist/content-layer/markdown/tags/partial.js +1 -1
  169. package/dist/content-layer/markdown/tags/variant.d.ts +6 -0
  170. package/dist/content-layer/markdown/tags/variant.js +1 -0
  171. package/dist/content-layer/markdown/types/service.d.ts +6 -0
  172. package/dist/content-layer/markdown/utils/collect-anchors.js +1 -1
  173. package/dist/content-layer/markdown/utils/collect-headings.d.ts +3 -1
  174. package/dist/content-layer/markdown/utils/collect-headings.js +1 -1
  175. package/dist/content-layer/markdown/utils/first-heading.js +1 -1
  176. package/dist/content-layer/markdown/utils/heading-slugger.d.ts +8 -0
  177. package/dist/content-layer/markdown/utils/heading-slugger.js +1 -1
  178. package/dist/content-layer/markdown/utils/node-source-range.d.ts +3 -3
  179. package/dist/content-layer/markdown/utils/node-source-range.js +1 -1
  180. package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
  181. package/dist/content-layer/markdown/utils/reparse-example-fences.d.ts +4 -1
  182. package/dist/content-layer/markdown/utils/reparse-example-fences.js +1 -1
  183. package/dist/content-layer/markdown/utils/substitute-variables.js +1 -1
  184. package/dist/content-layer/markdown/utils/walk-markdoc-ast.d.ts +2 -2
  185. package/dist/content-layer/markdown/utils/walk-markdoc-ast.js +1 -1
  186. package/dist/content-layer/materialization/asset-reconcile.js +1 -1
  187. package/dist/content-layer/materialization/entity.js +1 -1
  188. package/dist/content-layer/materialization/materializer.js +1 -0
  189. package/dist/content-layer/materialization/static-files.js +1 -1
  190. package/dist/content-layer/plan-gates.d.ts +3 -2
  191. package/dist/content-layer/plan-gates.js +1 -1
  192. package/dist/content-layer/plugins/execute.js +1 -1
  193. package/dist/content-layer/plugins/index.js +1 -1
  194. package/dist/content-layer/plugins/internal/api-docs/client/event-handlers.js +1 -1
  195. package/dist/content-layer/plugins/internal/api-docs/client/rebase-item-links.js +1 -1
  196. package/dist/content-layer/plugins/internal/api-docs/client/template.js +12 -4
  197. package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
  198. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.d.ts +28 -13
  199. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
  200. package/dist/content-layer/plugins/internal/api-docs/server/build-sidebar.js +1 -1
  201. package/dist/content-layer/plugins/internal/api-docs/server/declares-proto-service.d.ts +2 -0
  202. package/dist/content-layer/plugins/internal/api-docs/server/declares-proto-service.js +3 -0
  203. package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.d.ts +14 -0
  204. package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.js +23 -0
  205. package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.d.ts +1 -4
  206. package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.js +1 -1
  207. package/dist/content-layer/plugins/internal/api-docs/server/options.d.ts +4 -2
  208. package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
  209. package/dist/content-layer/plugins/internal/api-docs/server/search-documents.d.ts +1 -1
  210. package/dist/content-layer/plugins/internal/api-docs/server/search-documents.js +1 -1
  211. package/dist/content-layer/plugins/internal/api-docs/server/spec-download.js +1 -1
  212. package/dist/content-layer/plugins/internal/api-functions/index.js +1 -1
  213. package/dist/content-layer/plugins/internal/api-functions/server/access.js +1 -1
  214. package/dist/content-layer/plugins/internal/api-functions/server/api-function-telemetry.js +1 -0
  215. package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
  216. package/dist/content-layer/plugins/internal/app-data/banner.js +1 -1
  217. package/dist/content-layer/plugins/internal/app-data/index.d.ts +1 -1
  218. package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
  219. package/dist/content-layer/plugins/internal/app-data/products.d.ts +2 -0
  220. package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
  221. package/dist/content-layer/plugins/internal/catalog-classic/client/catalog-filtering.js +1 -1
  222. package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
  223. package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.d.ts +1 -1
  224. package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.js +1 -1
  225. package/dist/content-layer/plugins/internal/catalog-classic/sidebars.d.ts +1 -1
  226. package/dist/content-layer/plugins/internal/index.js +1 -1
  227. package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
  228. package/dist/content-layer/plugins/internal/l10n/translations-loader.js +1 -1
  229. package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
  230. package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
  231. package/dist/content-layer/plugins/internal/markdoc/server/shared.d.ts +1 -1
  232. package/dist/content-layer/plugins/internal/mcp/constants.d.ts +20 -0
  233. package/dist/content-layer/plugins/internal/mcp/constants.js +1 -1
  234. package/dist/content-layer/plugins/internal/mcp/content-tools.d.ts +4 -1
  235. package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
  236. package/dist/content-layer/plugins/internal/mcp/index.js +1 -1
  237. package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
  238. package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
  239. package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
  240. package/dist/content-layer/plugins/internal/mcp/server/code-credentials.js +2 -2
  241. package/dist/content-layer/plugins/internal/mcp/server/codemode/capabilities.js +6 -6
  242. package/dist/content-layer/plugins/internal/mcp/server/codemode/constants.js +1 -1
  243. package/dist/content-layer/plugins/internal/mcp/server/codemode/discover.js +1 -1
  244. package/dist/content-layer/plugins/internal/mcp/server/codemode/execute-schema.js +1 -1
  245. package/dist/content-layer/plugins/internal/mcp/server/codemode/index.js +1 -1
  246. package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
  247. package/dist/content-layer/plugins/internal/mcp/server/config-gate.js +1 -1
  248. package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
  249. package/dist/content-layer/plugins/internal/mcp/server/gateway/allowed-http-methods.js +1 -1
  250. package/dist/content-layer/plugins/internal/mcp/server/gateway/api-call-operations.js +1 -1
  251. package/dist/content-layer/plugins/internal/mcp/server/gateway/call-api.js +2 -0
  252. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +10 -10
  253. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/outcome-pages.js +1 -1
  254. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
  255. package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +7 -6
  256. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/allowed-hosts.js +1 -1
  257. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-bridge.js +1 -1
  258. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-errors.js +1 -1
  259. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/ssrf-guard.js +1 -1
  260. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/upstream-detail.js +1 -1
  261. package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
  262. package/dist/content-layer/plugins/internal/mcp/server/gateway/secret-store.js +1 -1
  263. package/dist/content-layer/plugins/internal/mcp/server/gateway/tool-list.js +1 -0
  264. package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
  265. package/dist/content-layer/plugins/internal/mcp/server/gateway/upstream-auth-scheme.js +2 -2
  266. package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
  267. package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
  268. package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
  269. package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
  270. package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
  271. package/dist/content-layer/plugins/internal/mcp/server/rate-limit.js +1 -1
  272. package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
  273. package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
  274. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql-catalog.js +1 -1
  275. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-catalog.js +1 -1
  276. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-document.js +1 -1
  277. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-refs.js +1 -1
  278. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi.js +1 -1
  279. package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
  280. package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +2 -2
  281. package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -1
  282. package/dist/content-layer/plugins/internal/mcp/server/workflows/catalog.js +1 -0
  283. package/dist/content-layer/plugins/internal/mcp/server/workflows/document-resolver.js +1 -0
  284. package/dist/content-layer/plugins/internal/mcp/server/workflows/operations-subset.js +1 -0
  285. package/dist/content-layer/plugins/internal/mcp/server/workflows/resolve-workflows.js +1 -0
  286. package/dist/content-layer/plugins/internal/mcp/server/workflows/run-workflow.js +1 -0
  287. package/dist/content-layer/plugins/internal/mcp/server/workflows/schemas.js +1 -0
  288. package/dist/content-layer/plugins/internal/mcp/server/workflows/tools.js +1 -0
  289. package/dist/content-layer/plugins/internal/mcp/server/workflows/types.js +1 -0
  290. package/dist/content-layer/plugins/internal/mcp/server/workflows/workflow-references.js +1 -0
  291. package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
  292. package/dist/content-layer/plugins/internal/react-page/index.d.ts +3 -2
  293. package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
  294. package/dist/content-layer/plugins/internal/scorecard-classic/client/Grid.js +11 -11
  295. package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardViews.js +1 -1
  296. package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardWidgets.js +7 -7
  297. package/dist/content-layer/plugins/internal/scorecard-classic/client/template.js +2 -2
  298. package/dist/content-layer/plugins/internal/sidebar/bundle.d.ts +18 -17
  299. package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
  300. package/dist/content-layer/plugins/internal/sidebar/index.d.ts +5 -3
  301. package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
  302. package/dist/content-layer/plugins/internal/sidebar/subtree.js +1 -1
  303. package/dist/content-layer/plugins/internal/skills/index.js +1 -1
  304. package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
  305. package/dist/content-layer/plugins/internal/versions/index.js +1 -1
  306. package/dist/content-layer/plugins/project/load.js +2 -2
  307. package/dist/content-layer/plugins/registry.js +1 -1
  308. package/dist/content-layer/plugins/request-context.d.ts +5 -0
  309. package/dist/content-layer/plugins/types/api-entity.d.ts +2 -6
  310. package/dist/content-layer/plugins/types/api-entity.js +1 -1
  311. package/dist/content-layer/plugins/types/markdoc.d.ts +2 -0
  312. package/dist/content-layer/plugins/types/plugin.d.ts +13 -0
  313. package/dist/content-layer/plugins/types/search.d.ts +14 -3
  314. package/dist/content-layer/plugins/utils/link-access.d.ts +2 -0
  315. package/dist/content-layer/plugins/utils/link-access.js +1 -1
  316. package/dist/content-layer/plugins/utils/route-index.d.ts +1 -1
  317. package/dist/content-layer/plugins/utils/route-index.js +1 -1
  318. package/dist/content-layer/plugins/utils/sidebar-label.d.ts +4 -1
  319. package/dist/content-layer/plugins/utils/sidebar-label.js +1 -1
  320. package/dist/content-layer/plugins/utils/version-path.js +1 -1
  321. package/dist/content-layer/plugins/work-time.js +1 -0
  322. package/dist/content-layer/problems/codes.d.ts +10 -0
  323. package/dist/content-layer/problems/codes.js +1 -1
  324. package/dist/content-layer/revisions/config.js +1 -1
  325. package/dist/content-layer/revisions/delete.js +1 -1
  326. package/dist/content-layer/search/engine/core/content-parser.js +1 -1
  327. package/dist/content-layer/search/engine/core/search-engine.js +1 -1
  328. package/dist/content-layer/search/facet-rows.js +1 -1
  329. package/dist/content-layer/search/keywords.d.ts +18 -0
  330. package/dist/content-layer/search/keywords.js +1 -0
  331. package/dist/content-layer/search/postings/fragment-field.d.ts +2 -0
  332. package/dist/content-layer/search/postings/fragment-field.js +1 -1
  333. package/dist/content-layer/search/postings/postings-store.d.ts +14 -0
  334. package/dist/content-layer/search/postings/postings-store.js +1 -1
  335. package/dist/content-layer/search/store.d.ts +14 -1
  336. package/dist/content-layer/server/context.js +1 -1
  337. package/dist/content-layer/server/database.js +1 -1
  338. package/dist/content-layer/server/materialize.js +1 -1
  339. package/dist/content-layer/static/audience.js +1 -1
  340. package/dist/content-layer/static/registry.js +1 -1
  341. package/dist/content-layer/templates/template-set.js +1 -1
  342. package/dist/content-layer/versions/group-info.d.ts +21 -0
  343. package/dist/content-layer/versions/group-info.js +1 -0
  344. package/dist/content-layer/versions/redirect.d.ts +24 -17
  345. package/dist/content-layer/versions/redirect.js +1 -1
  346. package/dist/content-layer/versions/resolve.d.ts +1 -21
  347. package/dist/content-layer/versions/resolve.js +1 -1
  348. package/dist/content-layer/versions/version-groups.d.ts +5 -1
  349. package/dist/content-layer/versions/version-groups.js +1 -1
  350. package/dist/plugin-api.d.ts +3 -0
  351. package/dist/plugin-api.js +1 -1
  352. package/dist/server/analytics-tags.js +1 -1
  353. package/dist/server/app.js +3 -3
  354. package/dist/server/ask-ai/feature-gate.js +1 -1
  355. package/dist/server/ask-ai/route.js +1 -1
  356. package/dist/server/auth/access-config.js +1 -1
  357. package/dist/server/auth/gate.js +1 -1
  358. package/dist/server/auth/middleware.js +1 -1
  359. package/dist/server/auth/oidc.js +1 -1
  360. package/dist/server/auth/request.js +1 -1
  361. package/dist/server/auth/routes.js +1 -1
  362. package/dist/server/auth/runtime.js +1 -1
  363. package/dist/server/content-assets/access.js +1 -1
  364. package/dist/server/content.js +14 -13
  365. package/dist/server/feedback/route.js +1 -1
  366. package/dist/server/html-tags.js +2 -1
  367. package/dist/server/lambda-entry.js +1 -1
  368. package/dist/server/llms-txt.js +1 -1
  369. package/dist/server/manifest-assets.js +2 -2
  370. package/dist/server/metrics/request-metrics.js +1 -1
  371. package/dist/server/node-entry.js +1 -1
  372. package/dist/server/page-handlers.js +1 -1
  373. package/dist/server/plugin-context.js +1 -1
  374. package/dist/server/plugin-routes.js +1 -1
  375. package/dist/server/public-url.js +1 -0
  376. package/dist/server/rbac/content-asset-access.js +1 -1
  377. package/dist/server/redirects.js +1 -1
  378. package/dist/server/replay-oauth2/route.js +1 -1
  379. package/dist/server/review/route.js +1 -1
  380. package/dist/server/runtime-config.js +1 -1
  381. package/dist/server/search/cache.js +1 -0
  382. package/dist/server/search/route.js +1 -1
  383. package/dist/server/search/search-telemetry.js +1 -0
  384. package/dist/server/seo-tags.js +2 -2
  385. package/dist/server/ssrf/ssrf-blocklist.js +1 -1
  386. package/dist/server/static-files/serve.js +1 -1
  387. package/dist/server/subprocess/runner.js +1 -1
  388. package/dist/server/telemetry/mock-server-events.js +1 -0
  389. package/dist/server/telemetry/redirect-event.js +1 -0
  390. package/dist/server/telemetry/route.js +1 -1
  391. package/dist/server/telemetry/sender.js +1 -1
  392. package/dist/server/telemetry/server-events.js +1 -1
  393. package/dist/server/template-ids.js +1 -1
  394. package/dist/shared/constants/api-spec-kinds.d.ts +7 -0
  395. package/dist/shared/constants/api-spec-kinds.js +1 -0
  396. package/dist/shared/constants/content-update.js +1 -1
  397. package/dist/shared/constants/dependency-pack.js +1 -1
  398. package/dist/shared/constants/dev-content-build.js +1 -0
  399. package/dist/shared/constants/dev-problems.js +1 -1
  400. package/dist/shared/constants/dev-source-sync.js +1 -1
  401. package/dist/shared/constants/l10n/langs/ar.js +1 -1
  402. package/dist/shared/constants/l10n/langs/de.js +1 -1
  403. package/dist/shared/constants/l10n/langs/en.js +1 -1
  404. package/dist/shared/constants/l10n/langs/es.js +1 -1
  405. package/dist/shared/constants/l10n/langs/fr.js +1 -1
  406. package/dist/shared/constants/l10n/langs/hi.js +1 -1
  407. package/dist/shared/constants/l10n/langs/it.js +1 -1
  408. package/dist/shared/constants/l10n/langs/ja.js +1 -1
  409. package/dist/shared/constants/l10n/langs/ko.js +1 -1
  410. package/dist/shared/constants/l10n/langs/pl.js +1 -1
  411. package/dist/shared/constants/l10n/langs/pt-br.js +1 -1
  412. package/dist/shared/constants/l10n/langs/pt.js +1 -1
  413. package/dist/shared/constants/l10n/langs/ru.js +1 -1
  414. package/dist/shared/constants/l10n/langs/uk.js +1 -1
  415. package/dist/shared/constants/l10n/langs/zh.js +1 -1
  416. package/dist/shared/constants/manifest-version.d.ts +3 -1
  417. package/dist/shared/constants/openapi-operation-methods.d.ts +2 -0
  418. package/dist/shared/constants/openapi-operation-methods.js +1 -0
  419. package/dist/shared/constants/review.d.ts +5 -0
  420. package/dist/shared/constants/review.js +1 -1
  421. package/dist/{server → shared}/constants/system-routes.d.ts +1 -1
  422. package/dist/shared/constants/system-routes.js +1 -0
  423. package/dist/shared/constants/versions.d.ts +2 -0
  424. package/dist/shared/constants/versions.js +1 -1
  425. package/dist/shared/experiments.js +1 -1
  426. package/dist/shared/load-dot-env.js +1 -1
  427. package/dist/shared/plan-gates.d.ts +9 -3
  428. package/dist/shared/plan-gates.js +1 -1
  429. package/dist/shared/products.js +1 -1
  430. package/dist/shared/project-env.d.ts +12 -0
  431. package/dist/shared/project-env.js +1 -0
  432. package/dist/shared/public-env.d.ts +9 -0
  433. package/dist/shared/public-env.js +1 -1
  434. package/dist/{server → shared}/rbac/api-docs.d.ts +3 -2
  435. package/dist/shared/rbac/api-docs.js +1 -0
  436. package/dist/{server → shared}/rbac/engine.d.ts +13 -10
  437. package/dist/shared/rbac/engine.js +0 -0
  438. package/dist/{server → shared}/rbac/filter.d.ts +2 -0
  439. package/dist/shared/rbac/filter.js +1 -0
  440. package/dist/{server → shared}/rbac/l10n-rules.d.ts +1 -1
  441. package/dist/shared/rbac/l10n-rules.js +1 -0
  442. package/dist/{server → shared}/rbac/route-scope.d.ts +1 -1
  443. package/dist/shared/rbac/route-scope.js +1 -0
  444. package/dist/{server → shared}/rbac/team-templates.d.ts +6 -2
  445. package/dist/shared/rbac/team-templates.js +1 -0
  446. package/dist/{server → shared}/rbac/teams.d.ts +1 -1
  447. package/dist/shared/rbac/types.js +1 -0
  448. package/dist/shared/search/facets.d.ts +5 -0
  449. package/dist/shared/search/facets.js +1 -1
  450. package/dist/shared/types/auth.d.ts +1 -0
  451. package/dist/shared/types/config.d.ts +5 -0
  452. package/dist/shared/types/search.d.ts +8 -2
  453. package/dist/shared/types/sidebar.d.ts +1 -0
  454. package/dist/shared/utils/l10n.js +1 -1
  455. package/dist/shared/utils/redirect-match.js +1 -0
  456. package/dist/shared/utils/routes/markdown-copy-url.js +1 -0
  457. package/drizzle/20261103061150_site_config_effective_hash/migration.sql +1 -0
  458. package/drizzle/20261105151816_search_http_path_tokens/migration.sql +1 -0
  459. package/drizzle/20261111152552_page_markdown_rbac_scope/migration.sql +1 -0
  460. package/package.json +37 -13
  461. package/dist/bundler/dev/__tests__/reset-content-update-state.js +0 -1
  462. package/dist/bundler/dev/materialization-sweeper.js +0 -1
  463. package/dist/client/dev-problems/sweep-segment.js +0 -1
  464. package/dist/client/review/use-bar-position.js +0 -1
  465. package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.d.ts +0 -5
  466. package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.js +0 -26
  467. package/dist/content-layer/plugins/internal/mcp/server/gateway/__tests__/fake-kv.js +0 -1
  468. package/dist/content-layer/server/config.js +0 -1
  469. package/dist/server/__tests__/rbac-fixture.js +0 -1
  470. package/dist/server/__tests__/test-session.js +0 -1
  471. package/dist/server/constants/system-routes.js +0 -1
  472. package/dist/server/rbac/api-docs.js +0 -1
  473. package/dist/server/rbac/engine.js +0 -0
  474. package/dist/server/rbac/filter.js +0 -1
  475. package/dist/server/rbac/l10n-rules.js +0 -1
  476. package/dist/server/rbac/route-scope.js +0 -1
  477. package/dist/server/rbac/team-templates.js +0 -1
  478. package/dist/server/rbac/types.js +0 -1
  479. package/dist/shared/utils/routes/markdown-path.js +0 -1
  480. /package/dist/{server → shared}/rbac/entity-scope.js +0 -0
  481. /package/dist/{server → shared}/rbac/teams.js +0 -0
  482. /package/dist/{server → shared}/rbac/types.d.ts +0 -0
  483. /package/dist/{content-layer/markdown → shared}/utils/packed-ast.d.ts +0 -0
  484. /package/dist/{content-layer/markdown → shared}/utils/packed-ast.js +0 -0
@@ -1,4 +1,4 @@
1
- import"../../../shared/constants/content-assets.js";import{withPathPrefix as e,withPathPrefixForSrcSet as t}from"../../../shared/path-prefix.js";import{resolveRelativeHref as n}from"../../../client/utils/routes/resolve-relative-href.js";import*as r from"react";import{Link as i,useLocation as a}from"react-router";import{jsx as o}from"react/jsx-runtime";import{dynamic as s}from"@redocly/theme/core/utils";import c from"styled-components";import{CodeSnippetProvider as l,PageActionsContext as u}from"@redocly/theme/core/contexts";import{Accordion as d}from"@redocly/theme/markdoc/components/Accordion/Accordion";import{AccordionGroup as f}from"@redocly/theme/markdoc/components/Accordion/AccordionGroup";import{Admonition as p}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{Card as m}from"@redocly/theme/markdoc/components/Cards/Card";import{Cards as h}from"@redocly/theme/markdoc/components/Cards/Cards";import{CodeBlock as g}from"@redocly/theme/markdoc/components/CodeBlock/CodeBlock";import{CodeGroup as _}from"@redocly/theme/markdoc/components/CodeGroup/CodeGroup";import{CodeStep as v}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeStep";import{CodeToggle as y}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeToggle";import{CodeWalkthrough as b}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeWalkthrough";import{ConnectMCP as x}from"@redocly/theme/markdoc/components/ConnectMCP/ConnectMCP";import{Diagram as S}from"@redocly/theme/markdoc/components/Diagram/Diagram";import{Heading as C}from"@redocly/theme/markdoc/components/Heading/Heading";import{Input as w}from"@redocly/theme/markdoc/components/CodeWalkthrough/Input";import{Icon as T}from"@redocly/theme/markdoc/components/Icon/Icon";import{Image as E}from"@redocly/theme/markdoc/components/Image/Image";import{InlineSvg as D}from"@redocly/theme/markdoc/components/InlineSvg/InlineSvg";import{LoginButton as O}from"@redocly/theme/markdoc/components/LoginButton/LoginButton";import{MarkdocExample as k}from"@redocly/theme/markdoc/components/MarkdocExample/MarkdocExample";import{NumberedItem as A}from"@redocly/theme/markdoc/components/NumberedList/NumberedItem";import{NumberedList as j}from"@redocly/theme/markdoc/components/NumberedList/NumberedList";import{Prompt as M}from"@redocly/theme/markdoc/components/Prompt/Prompt";import{Tabs as N}from"@redocly/theme/markdoc/components/Tabs/Tabs";import{TabItemFragment as P}from"@redocly/theme/markdoc/components/Tabs/TabItemFragment";import{Markdown as F}from"@redocly/theme/components/Markdown/Markdown";import{SearchAiCitation as I}from"@redocly/theme/components/Search/SearchAiCitation";import L from"@redocly/markdoc/dist/react.js";import{useL10nHref as R}from"virtual:realm-runtime";import{userMarkdocComponents as z}from"virtual:realm-markdoc-components";const B=t=>typeof t==`string`?e(t):void 0,V=e=>typeof e==`string`?t(e):void 0;function H({href:t,children:r,...s}){let c=R(),{pathname:l}=a(),u=!!t&&/^(https?:|\/\/)/.test(t),d=!t||u||t.startsWith(`mailto:`),f=u?`_blank`:void 0;if(d)return/* @__PURE__ */ o(`a`,{href:t,target:f,...s,rel:typeof s.rel==`string`?s.rel:`noreferrer`,children:r});if(t.startsWith(`/content-assets/`))return/* @__PURE__ */ o(`a`,{href:e(t),...s,children:r});let p=c(n(t,l));return/* @__PURE__ */ o(i,{to:p,...s,children:r})}function U({src:e,srcSet:t,...n}){return/* @__PURE__ */ o(E,{...n,src:B(e),srcSet:V(t)})}let W=Promise.resolve();function G(){return W}function K(e,t){return new Promise(n=>{t&&(e.addEventListener(`load`,()=>n()),e.addEventListener(`error`,()=>n())),document.body.appendChild(e),t||n()})}function q({src:e,children:t,...n}){return r.useEffect(()=>{let i=typeof e==`string`?e:void 0;if(i&&document.querySelector(`script[src="${CSS.escape(i)}"]`))return;let a=document.createElement(`script`);i?a.src=i:t!=null&&(a.textContent=r.Children.toArray(t).join(``));for(let[e,t]of Object.entries(n))(typeof t==`string`||typeof t==`boolean`)&&a.setAttribute(e,String(t));i&&n.async?K(a,!0):W=W.then(()=>K(a,!!i))},[e]),null}function J({image:e,icon:t,...n}){return/* @__PURE__ */ o(m,{...n,image:B(e),icon:B(t)})}const Y=c.span.attrs({role:`alert`,"data-component-name":`MarkdocInlineError`})`
1
+ import{withPathPrefix as e,withPathPrefixForSrcSet as t}from"../../../shared/path-prefix.js";import{isRouterPath as n}from"../../../client/utils/routes/is-router-path.js";import{resolveRelativeHref as r}from"../../../client/utils/routes/resolve-relative-href.js";import*as i from"react";import a from"styled-components";import{Link as o,useLocation as s}from"react-router";import{dynamic as c}from"@redocly/theme/core/utils";import{jsx as l}from"react/jsx-runtime";import{CodeSnippetProvider as u,PageActionsContext as ee}from"@redocly/theme/core/contexts";import{Accordion as te}from"@redocly/theme/markdoc/components/Accordion/Accordion";import{AccordionGroup as d}from"@redocly/theme/markdoc/components/Accordion/AccordionGroup";import{Admonition as f}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{Card as p}from"@redocly/theme/markdoc/components/Cards/Card";import{Cards as m}from"@redocly/theme/markdoc/components/Cards/Cards";import{CodeBlock as h}from"@redocly/theme/markdoc/components/CodeBlock/CodeBlock";import{CodeGroup as g}from"@redocly/theme/markdoc/components/CodeGroup/CodeGroup";import{CodeStep as _}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeStep";import{CodeToggle as v}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeToggle";import{CodeWalkthrough as y}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeWalkthrough";import{ConnectMCP as ne}from"@redocly/theme/markdoc/components/ConnectMCP/ConnectMCP";import{Diagram as re}from"@redocly/theme/markdoc/components/Diagram/Diagram";import{Experiment as ie}from"@redocly/theme/components/Experiment/Experiment";import{Variant as b}from"@redocly/theme/components/Experiment/Variant";import{Heading as x}from"@redocly/theme/markdoc/components/Heading/Heading";import{Input as S}from"@redocly/theme/markdoc/components/CodeWalkthrough/Input";import{Icon as C}from"@redocly/theme/markdoc/components/Icon/Icon";import{Image as w}from"@redocly/theme/markdoc/components/Image/Image";import{InlineSvg as T}from"@redocly/theme/markdoc/components/InlineSvg/InlineSvg";import{LoginButton as E}from"@redocly/theme/markdoc/components/LoginButton/LoginButton";import{MarkdocExample as D}from"@redocly/theme/markdoc/components/MarkdocExample/MarkdocExample";import{NumberedItem as O}from"@redocly/theme/markdoc/components/NumberedList/NumberedItem";import{NumberedList as k}from"@redocly/theme/markdoc/components/NumberedList/NumberedList";import{Prompt as A}from"@redocly/theme/markdoc/components/Prompt/Prompt";import{Tabs as j}from"@redocly/theme/markdoc/components/Tabs/Tabs";import{TabItemFragment as M}from"@redocly/theme/markdoc/components/Tabs/TabItemFragment";import{Markdown as N}from"@redocly/theme/components/Markdown/Markdown";import{SearchAiCitation as P}from"@redocly/theme/components/Search/SearchAiCitation";import F from"@redocly/markdoc/dist/react.js";import{useL10nHref as I}from"virtual:realm-runtime";import{userMarkdocComponents as L}from"virtual:realm-markdoc-components";const R=t=>typeof t==`string`?e(t):void 0,ae=e=>typeof e==`string`?t(e):void 0,z=e=>/^(https?:|\/\/)/.test(e);function B(e){let t=I(),{pathname:i}=s();if(!e||z(e)||e.startsWith(`mailto:`))return{kind:`external`,href:e};let a=r(e,i);return n(a)?{kind:`page`,href:t(a)}:{kind:`file`,href:a}}function V({href:t,children:n,...r}){let i=B(t);if(i.kind===`external`){let e=t&&z(t)?`_blank`:void 0;return/* @__PURE__ */ l(`a`,{href:t,target:e,...r,rel:typeof r.rel==`string`?r.rel:`noreferrer`,children:n})}return i.kind===`file`?/* @__PURE__ */ l(`a`,{href:e(i.href),...r,children:n}):/* @__PURE__ */ l(o,{to:i.href,...r,children:n})}function H(e){return function({href:t,...n}){return/* @__PURE__ */ l(e,{...n,href:B(t).href})}}const{MarkdownLink:U,...W}=L;function G({src:e,srcSet:t,...n}){return/* @__PURE__ */ l(w,{...n,src:R(e),srcSet:ae(t)})}let K=Promise.resolve();function q(){return K}function J(e,t){return new Promise(n=>{t&&(e.addEventListener(`load`,()=>n()),e.addEventListener(`error`,()=>n())),document.body.appendChild(e),t||n()})}function Y({src:e,children:t,...n}){return i.useEffect(()=>{let r=typeof e==`string`?e:void 0;if(r&&document.querySelector(`script[src="${CSS.escape(r)}"]`))return;let a=document.createElement(`script`);r?a.src=r:t!=null&&(a.textContent=i.Children.toArray(t).join(``));for(let[e,t]of Object.entries(n))(typeof t==`string`||typeof t==`boolean`)&&a.setAttribute(e,String(t));r&&n.async?J(a,!0):K=K.then(()=>J(a,!!r))},[e]),null}function X({image:e,icon:t,...n}){return/* @__PURE__ */ l(p,{...n,image:R(e),icon:R(t)})}const oe=a.span.attrs({role:`alert`,"data-component-name":`MarkdocInlineError`})`
2
2
  display: inline;
3
3
  padding: 0 var(--spacing-xs);
4
4
  border: var(--admonition-danger-border);
@@ -6,4 +6,4 @@ import"../../../shared/constants/content-assets.js";import{withPathPrefix as e,w
6
6
  background-color: var(--admonition-danger-bg-color);
7
7
  color: var(--admonition-danger-text-color);
8
8
  font-size: var(--font-size-sm);
9
- `,X={Accordion:d,AccordionGroup:f,Admonition:p,AiCitation:I,Card:J,Cards:h,CodeBlock:g,CodeGroup:_,CodeStep:v,CodeToggle:y,CodeWalkthrough:b,ConnectMCP:x,Diagram:S,Heading:C,HtmlScript:q,Icon:T,Image:U,InlineSvg:D,Input:w,JsonExample:s(()=>import(`./OpenapiTagComponents.js`).then(e=>e.JsonExample)),JsonSchema:s(()=>import(`./JsonSchemaTag.js`).then(e=>e.JsonSchemaTag)),LoginButton:O,MarkdocExample:k,MarkdocInlineError:Y,NumberedItem:A,NumberedList:j,OpenApiCodeSample:s(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiCodeSample)),OpenApiExample:s(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiExample)),OpenApiResponseSample:s(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiResponseSample)),Prompt:M,ReplayOpenApi:s(()=>import(`./ReplayOpenApiTag.js`).then(e=>e.ReplayOpenApiTag)),Tabs:N,TabItemFragment:P,Link:H,...z},Z=L;function Q(e,t=X){return/* @__PURE__ */ o(l,{children:Z(e,r,{components:t})})}function $({ast:e,components:t=X,withPageActions:n}){let i=r.useMemo(()=>Q(e,t),[e,t]);return/* @__PURE__ */ o(u.Provider,{value:n??null,children:/* @__PURE__ */ o(F,{children:i})})}export{q as HtmlScript,J as MarkdocCard,U as MarkdocImage,H as MarkdocLink,$ as MarkdocRenderer,X as markdocComponents,Q as renderMarkdocAst,G as waitForMarkdownScripts};
9
+ `,Z={Accordion:te,AccordionGroup:d,Admonition:f,AiCitation:P,Card:X,Cards:m,CodeBlock:h,CodeGroup:g,CodeStep:_,CodeToggle:v,CodeWalkthrough:y,ConnectMCP:ne,Diagram:re,Experiment:ie,ExperimentVariant:b,Heading:x,HtmlScript:Y,Icon:C,Image:G,InlineSvg:T,Input:S,JsonExample:c(()=>import(`./OpenapiTagComponents.js`).then(e=>e.JsonExample)),JsonSchema:c(()=>import(`./JsonSchemaTag.js`).then(e=>e.JsonSchemaTag)),LoginButton:E,MarkdocExample:D,MarkdocInlineError:oe,NumberedItem:O,NumberedList:k,OpenApiCodeSample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiCodeSample)),OpenApiExample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiExample)),OpenApiResponseSample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiResponseSample)),Prompt:A,ReplayOpenApi:c(()=>import(`./ReplayOpenApiTag.js`).then(e=>e.ReplayOpenApiTag)),Tabs:j,TabItemFragment:M,Link:V,...W,MarkdownLink:U===void 0?V:H(U)},Q=F;function $(e,t=Z){return/* @__PURE__ */ l(u,{children:Q(e,i,{components:t})})}function se({ast:e,components:t=Z,withPageActions:n}){let r=i.useMemo(()=>$(e,t),[e,t]);return/* @__PURE__ */ l(ee.Provider,{value:n??null,children:/* @__PURE__ */ l(N,{children:r})})}function ce({ast:e,components:t}){return i.useMemo(()=>/* @__PURE__ */ l(u,{children:le(e).map((e,n)=>/* @__PURE__ */ l(N,{as:`div`,children:typeof e==`string`?/* @__PURE__ */ l(`p`,{children:e}):Q(e,i,{components:t})},n))}),[e,t])}function le(e){return(Array.isArray(e)?e:[e]).flatMap(e=>e===null||e===``?[]:ue(e)?e.children:[e])}function ue(e){let t=e;return typeof e==`object`&&t?.$$mdtype===`Tag`&&t.name===`article`}export{Y as HtmlScript,ce as MarkdocBlocks,X as MarkdocCard,G as MarkdocImage,V as MarkdocLink,se as MarkdocRenderer,Z as markdocComponents,$ as renderMarkdocAst,q as waitForMarkdownScripts};
@@ -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{fence as f}from"../nodes/fence.js";import{heading as p}from"../nodes/heading.js";import{item as m}from"../nodes/gfm-list-item.js";import{table as h,td as g,th as _}from"../nodes/table.js";import{text as v}from"../nodes/text.js";import y from"@redocly/markdoc";import{accordion as b}from"@redocly/theme/markdoc/tags/accordion";import{accordionGroup as x}from"@redocly/theme/markdoc/tags/accordion-group";import{admonition as S}from"@redocly/theme/markdoc/tags/admonition";import{card as C}from"@redocly/theme/markdoc/tags/card";import{cards as w}from"@redocly/theme/markdoc/tags/cards";import{codeGroup as T}from"@redocly/theme/markdoc/tags/code-group";import{codeStep as E}from"@redocly/theme/markdoc/tags/code-step";import{toggle as D}from"@redocly/theme/markdoc/tags/code-toggle";import{codeWalkthrough as O}from"@redocly/theme/markdoc/tags/code-walkthrough";import{connectMcp as k}from"@redocly/theme/markdoc/tags/connect-mcp";import{debug as A}from"@redocly/theme/markdoc/tags/debug";import{icon as j}from"@redocly/theme/markdoc/tags/icon";import{img as M}from"@redocly/theme/markdoc/tags/img";import{inlineSvg as N}from"@redocly/theme/markdoc/tags/inline-svg";import{input as P}from"@redocly/theme/markdoc/tags/input";import{loginButton as F}from"@redocly/theme/markdoc/tags/login-button";import{markdocExample as I}from"@redocly/theme/markdoc/tags/markdoc-example";import{numberedItem as L}from"@redocly/theme/markdoc/tags/numbered-item";import{numberedList as R}from"@redocly/theme/markdoc/tags/numbered-list";import{prompt as z}from"@redocly/theme/markdoc/tags/prompt";import{tab as B}from"@redocly/theme/markdoc/tags/tab";import{tabs as V}from"@redocly/theme/markdoc/tags/tabs";import{visibility as H}from"@redocly/theme/markdoc/tags/visibility";const U=[O.tagName,E.tagName,D.tagName,P.tagName],W={[b.tagName]:b.schema,[x.tagName]:x.schema,[S.tagName]:S.schema,[C.tagName]:C.schema,[w.tagName]:w.schema,[T.tagName]:T.schema,"code-snippet":o,[E.tagName]:E.schema,[O.tagName]:O.schema,[k.tagName]:k.schema,[A.tagName]:A.schema,diagram:s,html:c,[j.tagName]:j.schema,[M.tagName]:M.schema,[N.tagName]:N.schema,[P.tagName]:P.schema,"json-example":e,"json-schema":t,[F.tagName]:F.schema,[l]:u,[I.tagName]:I.schema,[L.tagName]:L.schema,[R.tagName]:R.schema,"openapi-code-sample":n,"openapi-example":r,"openapi-response-sample":i,partial:d,[z.tagName]:z.schema,"replay-openapi":a,[B.tagName]:B.schema,[V.tagName]:V.schema,[D.tagName]:D.schema,[H.tagName]:H.schema},G=(e,t)=>({...e,children:[...e.children??[],...t]}),K={link:G({...y.nodes.link,render:`Link`},[`softbreak`,`image`]),strong:G(y.nodes.strong,[`softbreak`,`em`,`strong`]),em:G(y.nodes.em,[`softbreak`,`em`,`strong`]),s:G(y.nodes.s,[`softbreak`]),image:{...y.nodes.image,render:`Image`},fence:f,heading:p,item:m,table:h,td:g,th:_,text:v};export{U as CODE_WALKTHROUGH_TAG_NAMES,K as builtInMarkdocNodes,W 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{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
+ 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,4 +1,5 @@
1
1
  import type { ConfigFunction, Schema } from '@redocly/markdoc';
2
+ import type { RealmConfig } from '../../../shared/types/config';
2
3
  export type MarkdocTagSet = {
3
4
  tags: Record<string, Schema>;
4
5
  nodes: Record<string, Schema>;
@@ -28,21 +29,35 @@ export declare function registerUserMarkdocSchema(schema: UserMarkdocSchema | un
28
29
  * dependency on the files and are not validated until it loads: without it, each of its
29
30
  * tags would be reported as undefined.
30
31
  */
31
- export declare function registerUserMarkdocSchemaFailure(files: readonly string[]): void;
32
+ export declare function registerUserMarkdocSchemaFailure(files: readonly string[], message: string): void;
33
+ /**
34
+ * Why the project schema is not in use; `undefined` when it loaded or there is none. The CLI
35
+ * load and the dev server's import both set it.
36
+ */
37
+ export declare function userMarkdocSchemaFailure(): string | undefined;
38
+ export declare function setUserMarkdocSchemaFailure(message: string | undefined): void;
32
39
  /** The files the CLI loaded the project schema from; `undefined` when it did not load one. */
33
40
  export declare function userMarkdocSchemaFiles(): readonly string[] | undefined;
34
- /** Whether the CLI validates pages: it registered the project schema, or found none. */
41
+ /** The tags only the registered project schema defines; empty without one. */
42
+ export declare function customMarkdocTagNames(): string[];
43
+ /**
44
+ * Whether the CLI validates pages: it registered the project schema, or found none. A schema
45
+ * that failed is not registered, so each of its tags would be undefined.
46
+ */
35
47
  export declare function isMarkdocValidationEnabled(): boolean;
36
48
  /** The digest of the registered project schema; `undefined` without one. */
37
49
  export declare function userMarkdocSchemaDigest(): string | undefined;
38
50
  export declare const BUILTIN_MARKDOC_TAG_SET = "builtin";
39
51
  export declare const API_DOCS_MARKDOC_TAG_SET = "api-docs";
40
52
  export declare const isSchemaLike: (value: unknown) => value is Schema;
41
- /** Resolve a named tag set (extensions merge over the builtin set); no name → builtin. */
42
- export declare function resolveMarkdocTagSet(name?: string): Promise<MarkdocTagSet>;
53
+ /**
54
+ * Resolve a named tag set (extensions merge over the builtin set); no name → builtin. For a
55
+ * `config` whose plan lacks custom Markdoc tags, a project tag does not replace a builtin one.
56
+ */
57
+ export declare function resolveMarkdocTagSet(name: string | undefined, config: Pick<RealmConfig, 'planGates'>): Promise<MarkdocTagSet>;
43
58
  /**
44
59
  * The set a Markdown page is validated against: the builtin set it renders with, over the
45
60
  * API docs set, whose tags a page may also use. The result is the same object until the
46
61
  * project schema changes.
47
62
  */
48
- export declare function resolveMarkdownPageValidationSet(): Promise<MarkdocTagSet>;
63
+ export declare function resolveMarkdownPageValidationSet(config: Pick<RealmConfig, 'planGates'>): Promise<MarkdocTagSet>;
@@ -1 +1 @@
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 a!==void 0&&!o}function d(){return i}const f=`builtin`,p=`api-docs`,m={[p]:async()=>{let{apiDocsMarkdocNodes:e,apiDocsMarkdocTags:t}=await import(`@redocly/api-docs/lib/components/markdoc/defaultMarkdocConfig.js`);return{tags:t,nodes:e}}},h=/* @__PURE__ */ new Map;let g;const _=/* @__PURE__ */ new Set,v=e=>!!e&&typeof e==`object`;function y(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(v(i)){if(e===`functions`&&n in r.functions){_.has(n)||(_.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 b(r){let i=globalThis.__REALM_MARKDOC_USER_SCHEMA__;i!==g&&(g=i,h.clear(),_.clear());let a=r??`builtin`,o=h.get(a);if(o)return o;let s={tags:t,nodes:e,functions:n};if(i&&(s=y(s,i)),a!==`builtin`){let e=await m[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 h.set(a,s),s}const x=`page-validation`;async function S(){let e=await b(),t=await b(p),n=h.get(x);if(n)return n;let r={...t,tags:{...t.tags,...e.tags},nodes:{...t.nodes,...e.nodes}};return h.set(x,r),r}export{p as API_DOCS_MARKDOC_TAG_SET,f as BUILTIN_MARKDOC_TAG_SET,r as USER_MARKDOC_SCHEMA_FILE,u as isMarkdocValidationEnabled,v as isSchemaLike,s as registerUserMarkdocSchema,c as registerUserMarkdocSchemaFailure,b as resolveMarkdocTagSet,S as resolveMarkdownPageValidationSet,d as userMarkdocSchemaDigest,l as userMarkdocSchemaFiles};
1
+ import{isPlanFeatureGranted as e}from"../../../shared/plan-gates.js";import{builtInMarkdocFunctions as t}from"./builtin-functions.js";import{builtInMarkdocNodes as n,builtInMarkdocTags as r}from"./builtin-tags.js";const i=`@theme/markdoc/schema.ts`;let a,o,s;function c(e,t,n){globalThis.__REALM_MARKDOC_USER_SCHEMA__=e,a=t,o=n,s=void 0}function l(e,t){c(void 0,void 0,e),s=t}function u(){return s}function d(e){s=e}function f(){return o}function p(){return Object.keys(globalThis.__REALM_MARKDOC_USER_SCHEMA__?.tags??{}).filter(e=>!(e in r))}function m(){return o!==void 0&&s===void 0}function h(){return a}const g=`builtin`,_=`api-docs`,v={[_]:async()=>{let{apiDocsMarkdocNodes:e,apiDocsMarkdocTags:t}=await import(`@redocly/api-docs/markdoc`);return{tags:t,nodes:e}}},y=/* @__PURE__ */ new Map;let b;const x=/* @__PURE__ */ new Set,S=e=>!!e&&typeof e==`object`;function C(e,n,r){let i={tags:{...e.tags},nodes:{...e.nodes},functions:{...t,...e.functions}};for(let t of[`tags`,`nodes`,`functions`])for(let[a,o]of Object.entries(n[t]??{}))if(S(o)&&!(t===`tags`&&!r&&a in e.tags)){if(t===`functions`&&a in i.functions){x.has(a)||(x.add(a),console.warn(`[markdoc] The user schema defines the "${a}" function, but the engine already defines it. The engine function is used.`));continue}i[t][a]=o}return i}async function w(i,a){let o=globalThis.__REALM_MARKDOC_USER_SCHEMA__;o!==b&&(b=o,y.clear(),x.clear());let s=i??`builtin`,c=e(a,`customMarkdocTags`),l=T(s,c),u=y.get(l);if(u)return u;let d={tags:r,nodes:n,functions:t};if(o&&(d=C(d,o,c)),s!==`builtin`){let e=await v[s]?.();if(!e)throw Error(`Unknown markdoc tag set "${s}".`);d={tags:{...d.tags,...e.tags},nodes:{...d.nodes,...e.nodes},functions:{...d.functions,...e.functions}}}return y.set(l,d),d}const T=(e,t)=>t?e:`${e}:builtin-tags-kept`;async function E(t){let n=await w(void 0,t),r=await w(_,t),i=T(`page-validation`,e(t,`customMarkdocTags`)),a=y.get(i);if(a)return a;let o={...r,tags:{...r.tags,...n.tags},nodes:{...r.nodes,...n.nodes}};return y.set(i,o),o}export{_ as API_DOCS_MARKDOC_TAG_SET,g as BUILTIN_MARKDOC_TAG_SET,i as USER_MARKDOC_SCHEMA_FILE,p as customMarkdocTagNames,m as isMarkdocValidationEnabled,S as isSchemaLike,c as registerUserMarkdocSchema,l as registerUserMarkdocSchemaFailure,w as resolveMarkdocTagSet,E as resolveMarkdownPageValidationSet,d as setUserMarkdocSchemaFailure,h as userMarkdocSchemaDigest,u as userMarkdocSchemaFailure,f as userMarkdocSchemaFiles};
@@ -1 +1 @@
1
- import{EXAMPLE_CONTENT_ATTRIBUTE as e}from"@redocly/theme/core/constants";import t from"@redocly/markdoc";const n=/* @__PURE__ */ new Set([`mermaid`,`excalidraw`,`plantuml`]),r={...t.nodes.fence,attributes:{...t.nodes.fence.attributes,label:{type:String,render:`data-label`},title:{type:String,render:`data-title`},highlight:{type:String,render:`data-highlight`},align:{type:String,matches:[`left`,`center`,`right`]},width:{type:String},[e]:{type:Object,render:!1}},transform(e,r){let i=e.transformAttributes(r),a=e.transformChildren(r),o=i[`data-language`],s=i[`data-title`];if(e.attributes.process===!1&&(a=[e.attributes.content]),typeof a[0]!=`string`)return new t.Tag(e.tag,i,a);if(typeof o==`string`&&n.has(o)){let{diagramHtml:n,diagramHtmlDark:r,diagramError:s}=e.attributes;if(typeof n==`string`||typeof s==`string`)return new t.Tag(`Diagram`,{...i,diagramType:o,diagramSource:a[0],diagramHtml:n,diagramHtmlDark:r,diagramError:s},[])}let c=a.map(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e.toString():t.Tag.isTag(e)?String(e.attributes?.rawtag??``):``).join(``);return new t.Tag(`CodeBlock`,{...i,header:{title:s,controls:{copy:{}}},source:c,lang:o},[])}};export{n as DIAGRAM_LANGUAGES,r as fence};
1
+ import e from"@redocly/markdoc";import{EXAMPLE_CONTENT_ATTRIBUTE as t}from"@redocly/theme/core/constants";const n=/* @__PURE__ */ new Set([`mermaid`,`excalidraw`,`plantuml`]),r={...e.nodes.fence,attributes:{...e.nodes.fence.attributes,label:{type:String,render:`data-label`},title:{type:String,render:`data-title`},highlight:{type:String,render:`data-highlight`},align:{type:String,matches:[`left`,`center`,`right`]},width:{type:String},[t]:{type:Object,render:!1}},transform(t,r){let i=t.transformAttributes(r),a=t.transformChildren(r),o=i[`data-language`],s=i[`data-title`];if(t.attributes.process===!1&&(a=[t.attributes.content]),typeof a[0]!=`string`)return new e.Tag(t.tag,i,a);if(typeof o==`string`&&n.has(o)){let{diagramHtml:n,diagramHtmlDark:r,diagramError:s}=t.attributes;if(typeof n==`string`||typeof s==`string`)return new e.Tag(`Diagram`,{...i,diagramType:o,diagramSource:a[0],diagramHtml:n,diagramHtmlDark:r,diagramError:s},[])}let c=a.map(t=>typeof t==`string`||typeof t==`number`||typeof t==`boolean`?t.toString():e.Tag.isTag(t)?String(t.attributes?.rawtag??``):``).join(``);return new e.Tag(`CodeBlock`,{...i,header:{title:s,controls:{copy:{}}},source:c,lang:o},[])}};export{n as DIAGRAM_LANGUAGES,r as fence};
@@ -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`?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{MARKDOWN_CLASS_NAME as e}from"@redocly/theme/core/constants";import t from"@redocly/markdoc";const n={transform(n,r){let i=n.transformAttributes(r),a=n.transformChildren(r);return o(a),new t.Tag(`div`,{className:`md-table-wrapper`},[new t.Tag(`table`,{...i,className:e},a)])}},r={type:String,matches:[`top`,`middle`,`bottom`],render:`vAlign`},i={...t.nodes.td,attributes:{...t.nodes.td.attributes,valign:r}},a={...t.nodes.th,attributes:{...t.nodes.th.attributes,valign:r}};function o([e]){if(t.Tag.isTag(e)&&e.name===`thead`){for(let n of e.children)if(t.Tag.isTag(n))for(let e of n.children)t.Tag.isTag(e)&&e.name===`th`&&(e.attributes[`data-label`]=s(e.children))}}function s(e){return e.map(e=>typeof e==`string`||typeof e==`number`?String(e):t.Tag.isTag(e)?s(e.children):``).join(``).trim()}export{n as table,i as td,a as th};
1
+ import e from"@redocly/markdoc";import{MARKDOWN_CLASS_NAME as t}from"@redocly/theme/core/constants";const n={transform(n,r){let{class:i,...a}=n.transformAttributes(r),s=n.transformChildren(r);return o(s),new e.Tag(`div`,{className:`md-table-wrapper`},[new e.Tag(`table`,{...a,className:[t,i].filter(Boolean).join(` `)},s)])}},r={type:String,matches:[`top`,`middle`,`bottom`],render:`vAlign`},i={...e.nodes.td,attributes:{...e.nodes.td.attributes,valign:r}},a={...e.nodes.th,attributes:{...e.nodes.th.attributes,valign:r}};function o([t]){if(e.Tag.isTag(t)&&t.name===`thead`){for(let n of t.children)if(e.Tag.isTag(n))for(let t of n.children)e.Tag.isTag(t)&&t.name===`th`&&(t.attributes[`data-label`]=s(t.children))}}function s(t){return t.map(t=>typeof t==`string`||typeof t==`number`?String(t):e.Tag.isTag(t)?s(t.children):``).join(``).trim()}export{n as table,i as td,a as th};
@@ -1 +1 @@
1
- import{builtInMarkdocTags as e}from"../constants/builtin-tags.js";import{getExampleContent as t,walkWithExampleContent as n}from"../utils/reparse-example-fences.js";import{parseMarkdownDocument as r}from"../utils/parse-cache.js";import{markdocNodeRange as i}from"../utils/node-source-range.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(t,n,i){let s=await l(t,n,i.resolverContext),f=r(s.source),p=i.validation?v(f,n,h(i.validation)):[],{entityDeps:m,assetUsages:g,linkRefs:_,problems:y}=await c(f,{tags:i.tags??e,sourceFilePath:n,resolverContext:i.resolverContext,source:s.source});i.variables&&a(f,i.variables),await u(f,i.resolverContext.logger);let x=b(f,n),S=i.transform?.(f)??[];return{ast:d.compact(f),entityDeps:[...s.entityDeps,...m],assetUsages:g,linkRefs:_,tagList:o(f),problems:[...s.problems,...y,...x,...p,...S]}}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,r,i){let a=[e],o=/* @__PURE__ */ new Set,c=[];for(let r of n(e,s)){for(let e of r.errors??[])o.add(e);let e=t(r);e&&a.push(e),s(r)&&c.push({node:r,children:r.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,r))}catch(e){return[{code:`markdoc/validation-error`,message:`Markdoc validation failed: ${_(e)}`,location:{filePath:r,range:{start:{line:1},end:{line:1}}}}]}finally{for(let e of c)e.node.children=e.children}}function y(e,t){let{level:n,message:r}=e.error,a={code:`markdoc/validation-error`,message:r,location:{filePath:t,range:i(e)??{start:{line:1},end:{line:1}}}};return n!==`error`&&n!==`critical`&&(a.severity=`warning`),a}function b(e,t){let r=[];for(let a of n(e))for(let e of a.errors){let n=f.has(e.id)?`markdoc/parse-error`:`markdoc/validation-error`;r.push({code:n,message:e.message,location:{filePath:t,range:i(a)??{start:{line:1},end:{line:1}}}})}return r}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,2 +1,9 @@
1
- /** The resolver name an attribute schema declares: explicit key, or the attribute type's static `resolver`. */
1
+ import type { MarkdocResolverName, MarkdocTagSchema } from '@redocly/theme/markdoc/tags/types';
2
+ /** Every resolver Realm Plus implements: the theme's contract plus the Realm Plus tags' own. */
3
+ export type RealmPlusResolverName = MarkdocResolverName | 'nativeMdLink' | 'htmlAttrs' | 'partialFile' | 'jsonSchemaRef' | 'sampleFromJsonSchema' | 'jsonExampleRef' | 'openapiCodeSamples' | 'openapiCodeSamplePanel' | 'openapiReplay' | 'openapiResponseSamples' | 'openapiResponsePanel' | 'openapiExample' | 'rawContent' | 'parsedYaml';
4
+ export type RealmPlusTagSchema = MarkdocTagSchema<RealmPlusResolverName>;
5
+ /**
6
+ * The resolver name an attribute schema declares in `resolver`, or through the
7
+ * attribute type's static `resolver` (the deprecated theme marker classes).
8
+ */
2
9
  export declare function getAttributeBuildTimeResolver(attribute: unknown): string | null;
@@ -1 +1 @@
1
- function e(e){if(!n(e))return null;let r=e,i=r.buildTimeResolver??r.resolver;return typeof i==`string`&&i.trim()!==``?i:t(r.type)??null}function t(e){if(Array.isArray(e))for(let n of e){let e=t(n);if(e)return e}if(!n(e)&&typeof e!=`function`)return null;let r=e.resolver;return typeof r==`string`&&r.trim()!==``?r:null}function n(e){return typeof e==`object`&&!!e}export{e as getAttributeBuildTimeResolver};
1
+ function e(e){return r(e)?n(e)??t(e.type):null}function t(e){if(Array.isArray(e))for(let n of e){let e=t(n);if(e)return e}return!r(e)&&typeof e!=`function`?null:n(e)}function n(e){let{resolver:t}=e;return typeof t==`string`&&t.trim()!==``?t:null}function r(e){return typeof e==`object`&&!!e}export{e as getAttributeBuildTimeResolver};
@@ -1,4 +1,4 @@
1
- import { type AssetAudienceDescriptor } from '../../../server/rbac/engine.js';
1
+ import { type AssetAudienceDescriptor } from '../../../shared/rbac/engine.js';
2
2
  export type AudienceTagResolver = (path: string) => Promise<string | null>;
3
3
  /**
4
4
  * Builds a per-invocation resolver from a raw `access.rbac` config value —
@@ -16,12 +16,8 @@ export type AudienceTagResolver = (path: string) => Promise<string | null>;
16
16
  * Absent config (`parseRbacConfigData` returns `null`) -> every path
17
17
  * resolves to `null` (no tag), preserving today's fully-public behavior for
18
18
  * every project that hasn't configured RBAC.
19
- *
20
- * `warn`, when given, is called once per path that matches no rule at all —
21
- * an unsatisfiable-by-anyone audience, almost always a missing catch-all
22
- * `'**'` rule rather than an intentional lockout.
23
19
  */
24
- export declare function createAudienceTagResolver(rawRbacConfig: unknown, warn?: (message: string) => void): AudienceTagResolver;
20
+ export declare function createAudienceTagResolver(rawRbacConfig: unknown): AudienceTagResolver;
25
21
  /**
26
22
  * The `{tag -> descriptor}` table for a raw `access.rbac` config value and a
27
23
  * concrete asset-path set — `compileAssetAudiences` behind the same raw-config
@@ -1 +1 @@
1
- import{compileAssetAudiences as e,compileRbacMatcher as t,deriveAssetTag as n,parseRbacConfigData as r,resolveAssetTagInputs as i}from"../../../server/rbac/engine.js";function a(e,a){let o=r(e);if(!o)return async()=>null;let s=t(o);return async e=>{let t=i(s,e);return t===null?null:(t.pattern===``&&a?.(`rbac config: "${e}" matches no content rule — it will be unreachable by any viewer. Add a catch-all "**" rule if this asset should be public.`),n(t))}}async function o(n,i){let a=r(n);return a?e(t(a),i):null}export{o as compileAssetAudienceTable,a as createAudienceTagResolver};
1
+ import{compileAssetAudiences as e,compileRbacMatcher as t,deriveAssetTag as n,parseRbacConfigData as r,resolveAssetTagInputs as i}from"../../../shared/rbac/engine.js";function a(e){let a=r(e);if(!a)return async()=>null;let o=t(a);return async e=>{let t=i(o,e);return t===null?null:n(t)}}async function o(n,i){let a=r(n);return a?e(t(a),i):null}export{o as compileAssetAudienceTable,a as createAudienceTagResolver};
@@ -1,6 +1,7 @@
1
- import{replaceWithMarkdocError as e}from"../../tags/markdoc-error.js";import{markdocNodeProblem as t}from"../../utils/node-source-range.js";import{resolveResolverTarget as n}from"./context-paths.js";async function r(r){let{node:a,attributeName:o}=r,s=a.attributes[o];if(typeof s!=`string`||s===``||r.io===void 0)return null;let c=n(r,s);if(c===null)return null;let l={entityDeps:[{kind:`file`,path:c.contentPath}]};if(!await r.io.exists(c.absolutePath))return d(`Code snippet file ${c.contentPath} does not exist`);let u=await r.io.readFile(c.absolutePath);try{a.attributes.rawContent=i(u,{from:a.attributes.from,to:a.attributes.to,after:a.attributes.after,before:a.attributes.before,prefix:typeof a.attributes.prefix==`string`?a.attributes.prefix:``,contentPath:c.contentPath})}catch(e){return d(e instanceof Error?e.message:String(e))}return a.children=[],l;function d(n){return e(a,n),{...l,problems:[t(a,n,r.sourceFilePath)]}}}function i(e,t){let n=t.from??t.after,r=t.to??t.before,i=t.after!=null,a=t.before!=null,o=(typeof n==`number`?Math.max(n||0,1):1)+ +!!i,s=(typeof r==`number`?r:1/0)-+!!a,c=e;if(typeof n==`string`){let e=c.indexOf(n);if(e===-1)throw Error(`Cannot find start text "${n}" in snippet file ${t.contentPath}`);for(;c[e]!==`
1
+ import{markdocErrorResult as e}from"../../tags/markdoc-error.js";import{resolveResolverTarget as t}from"./context-paths.js";async function n(n){let{node:i,attributeName:a}=n,o=i.attributes[a];if(typeof o!=`string`||o===``||n.io===void 0)return null;let s=t(n,o);if(s===null)return null;let c=[{kind:`file`,path:s.contentPath}];if(!await n.io.exists(s.absolutePath)){let t=`Code snippet file ${s.contentPath} does not exist`;return e(i,t,n.sourceFilePath,c)}let l=await n.io.readFile(s.absolutePath);try{i.attributes.rawContent=r(l,{from:i.attributes.from,to:i.attributes.to,after:i.attributes.after,before:i.attributes.before,prefix:typeof i.attributes.prefix==`string`?i.attributes.prefix:``,contentPath:s.contentPath})}catch(t){let r=t instanceof Error?t.message:String(t);return e(i,r,n.sourceFilePath,c)}return i.children=[],{entityDeps:c}}function r(e,t){let n=t.from??t.after,r=t.to??t.before,i=t.after!=null,a=t.before!=null,o=(typeof n==`number`?Math.max(n||0,1):1)+ +!!i,s=(typeof r==`number`?r:1/0)-+!!a,c=e;if(typeof n==`string`){let e=c.indexOf(n);if(e===-1)throw Error(`Cannot find start text "${n}" in snippet file ${t.contentPath}`);for(;c[e]!==`
2
2
  `&&e>0;)e--;Number.isFinite(s)&&e>0&&(s-=c.slice(0,e).split(`
3
- `).length),c=e===0?c:c.slice(e+1)}if(typeof r==`string`){let e=c.indexOf(r);if(e===-1)throw Error(`Cannot find end text "${r}" in snippet file ${t.contentPath}`);c[e-1]===`
4
- `&&e--,c=c.slice(0,e)}let l=c.split(`
3
+ `).length),c=e===0?c:c.slice(e+1)}if(typeof r==`string`){let e=c.indexOf(r);if(e===-1)throw Error(`Cannot find end text "${r}" in snippet file ${t.contentPath}`);if(a)c[e-1]===`
4
+ `&&e--;else{let t=c.indexOf(`
5
+ `,e);e=t===-1?c.length:t}c=c.slice(0,e)}let l=c.split(`
5
6
  `);if(a)for(;l[l.length-1]===``;)l.pop();return t.prefix+l.slice(o-1,s).join(`
6
- `)}export{i as extractSnippetRegion,r as resolveCodeSnippetFileAttribute};
7
+ `)}export{r as extractSnippetRegion,n as resolveCodeSnippetFileAttribute};
@@ -1 +1 @@
1
- import{replaceWithMarkdocError as e}from"../../../tags/markdoc-error.js";import{markdocNodeProblem as t}from"../../../utils/node-source-range.js";import{resolveResolverTarget as n}from"../context-paths.js";import{mapFileExtensionToLanguage as r}from"./map-file-extension-to-language.js";import{parseFileChunks as i}from"./file-chunk-parser.js";import{join as a,posix as o}from"node:path";import s from"picomatch";async function c(c){let{node:l,attributeName:u}=c,d=c.io,f=l.attributes[u];if(!Array.isArray(f)||d===void 0)return l.attributes.resolvedFilesets=[],null;let p=d,m=[];async function h(e){let t=n(c,e);if(t===null)return c.logger?.warn(`code-walkthrough: cannot resolve "${e}" from ${c.sourceFilePath}`),[];let l=s.scan(t.contentPath).isGlob?await p.glob?.(t.contentPath)??[]:[t.contentPath];return(await Promise.all(l.map(async e=>{m.push({kind:`file`,path:e});let t=a(c.contentDir,e);if(!await p.exists(t))return c.logger?.warn(`code-walkthrough: file ${e} does not exist`),null;let n=await p.readFile(t),{root:s,metadata:l}=i(n,e);return{path:e,content:s,metadata:l,basename:o.basename(e),language:r(o.extname(e))}}))).filter(e=>e!==null)}let g;try{g=await Promise.all(f.map(async e=>{let t=Array.isArray(e.files)?e.files:[],n=Array.isArray(e.downloadAssociatedFiles)?e.downloadAssociatedFiles:[],[r,i]=await Promise.all([Promise.all(t.map(h)),Promise.all(n.map(h))]);return{when:e.when,unless:e.unless,files:r.flat(),downloadAssociatedFiles:i.flat()}}))}catch(n){let r=n instanceof Error?n.message:String(n);return e(l,r),{entityDeps:m,problems:[t(l,r,c.sourceFilePath)]}}return l.attributes.resolvedFilesets=g,{entityDeps:m}}export{c as resolveCodeWalkthroughFilesetsAttribute};
1
+ import{markdocErrorResult as e}from"../../../tags/markdoc-error.js";import{resolveResolverTarget as t}from"../context-paths.js";import{mapFileExtensionToLanguage as n}from"./map-file-extension-to-language.js";import{parseFileChunks as r}from"./file-chunk-parser.js";import{join as i,posix as a}from"node:path";import o from"picomatch";async function s(s){let{node:c,attributeName:l}=s,u=s.io,d=c.attributes[l];if(!Array.isArray(d)||u===void 0)return c.attributes.resolvedFilesets=[],null;let f=u,p=[];async function m(e){let c=t(s,e);if(c===null)return s.logger?.warn(`code-walkthrough: cannot resolve "${e}" from ${s.sourceFilePath}`),[];let l=o.scan(c.contentPath).isGlob?await f.glob?.(c.contentPath)??[]:[c.contentPath];return(await Promise.all(l.map(async e=>{p.push({kind:`file`,path:e});let t=i(s.contentDir,e);if(!await f.exists(t))return s.logger?.warn(`code-walkthrough: file ${e} does not exist`),null;let o=await f.readFile(t),{root:c,metadata:l}=r(o,e);return{path:e,content:c,metadata:l,basename:a.basename(e),language:n(a.extname(e))}}))).filter(e=>e!==null)}let h;try{h=await Promise.all(d.map(async e=>{let t=Array.isArray(e.files)?e.files:[],n=Array.isArray(e.downloadAssociatedFiles)?e.downloadAssociatedFiles:[],[r,i]=await Promise.all([Promise.all(t.map(m)),Promise.all(n.map(m))]);return{when:e.when,unless:e.unless,files:r.flat(),downloadAssociatedFiles:i.flat()}}))}catch(t){let n=t instanceof Error?t.message:String(t);return e(c,n,s.sourceFilePath,p)}return c.attributes.resolvedFilesets=h,{entityDeps:p}}export{s as resolveCodeWalkthroughFilesetsAttribute};
@@ -1 +1 @@
1
- import{replaceWithMarkdocError as e}from"../../tags/markdoc-error.js";import{resolveResolverTarget as t}from"./context-paths.js";async function n(n){let{node:r,attributeName:i}=n,a=r.attributes[i];if(typeof a!=`string`||a===``||n.io===void 0)return null;let o=t(n,a);return o===null?null:await n.io.exists(o.absolutePath)?(r.attributes.rawContent=await n.io.readFile(o.absolutePath),r.children=[],{entityDeps:[{kind:`file`,path:o.contentPath}]}):(e(r,`Diagram file ${o.contentPath} does not exist`),{entityDeps:[{kind:`file`,path:o.contentPath}]})}export{n as resolveDiagramFileAttribute};
1
+ import{markdocErrorResult as e}from"../../tags/markdoc-error.js";import{resolveResolverTarget as t}from"./context-paths.js";async function n(n){let{node:r,attributeName:i}=n,a=r.attributes[i];if(typeof a!=`string`||a===``||n.io===void 0)return null;let o=t(n,a);if(o===null)return null;if(!await n.io.exists(o.absolutePath)){let t=`Diagram file ${o.contentPath} does not exist`;return e(r,t,n.sourceFilePath,[{kind:`file`,path:o.contentPath}])}return r.attributes.rawContent=await n.io.readFile(o.absolutePath),r.children=[],{entityDeps:[{kind:`file`,path:o.contentPath}]}}export{n as resolveDiagramFileAttribute};
@@ -1 +1 @@
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{replaceWithMarkdocError as r}from"../../tags/markdoc-error.js";import{resolveResolverTarget as i}from"./context-paths.js";import a from"js-yaml";function o(e){return l(e,`RawContent`,e=>e)}function s(e){return l(e,`Resolved`,e=>a.load(e))}function c(t){let{node:r,attributeName:a,sourceFilePath:o}=t,s=r.attributes[a];if(typeof s!=`string`||s===``)return null;let c=n(o),l=c!==void 0&&s.startsWith(`/`)&&n(s.slice(1))===void 0?`/${e}/${c}${s}`:s,u=i(t,l)?.contentPath;return u!==void 0&&(r.attributes[a]=u),null}async function l(e,n,a){let o=e.node.attributes[e.attributeName];if(typeof o!=`string`||o===``||e.io===void 0)return null;let s=i(e,o);if(s===null)return null;let c=[{kind:`file`,path:s.contentPath}],l=s;if(!await e.io.exists(s.absolutePath)){let n=t(e.sourceFilePath);if(l=n===void 0?null:i({...e,sourceFilePath:n},o),l!==null&&c.push({kind:`file`,path:l.contentPath}),l===null||!await e.io.exists(l.absolutePath))return r(e.node,`File ${s.contentPath} does not exist`),{entityDeps:c}}let u=await e.io.readFile(l.absolutePath),d;try{d=a(u)}catch(t){let n=t instanceof Error?t.message:String(t);return r(e.node,`File ${l.contentPath} is not valid: ${n}`),{entityDeps:c}}return e.node.attributes[`${e.attributeName}${n}`]=d,{entityDeps:c}}export{s as resolveParsedYamlAttribute,o as resolveRawContentAttribute,c as resolveRelativePathAttribute};
1
+ import{markdocErrorResult as e}from"../../tags/markdoc-error.js";import{L10N_DIR as t}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as n,l10nDirOf as r}from"../../../../shared/utils/l10n.js";import{resolveResolverTarget as i}from"./context-paths.js";import a from"js-yaml";function o(e){return l(e,`RawContent`,e=>e)}function s(e){return l(e,`Resolved`,e=>a.load(e))}function c(e){let{node:n,attributeName:a,sourceFilePath:o}=e,s=n.attributes[a];if(typeof s!=`string`||s===``)return null;let c=r(o),l=c!==void 0&&s.startsWith(`/`)&&r(s.slice(1))===void 0?`/${t}/${c}${s}`:s,u=i(e,l)?.contentPath;return u!==void 0&&(n.attributes[a]=u),null}async function l(t,r,a){let o=t.node.attributes[t.attributeName];if(typeof o!=`string`||o===``||t.io===void 0)return null;let s=i(t,o);if(s===null)return null;let c=[{kind:`file`,path:s.contentPath}],l=s;if(!await t.io.exists(s.absolutePath)){let r=n(t.sourceFilePath);if(l=r===void 0?null:i({...t,sourceFilePath:r},o),l!==null&&c.push({kind:`file`,path:l.contentPath}),l===null||!await t.io.exists(l.absolutePath)){let n=`File ${s.contentPath} does not exist`;return e(t.node,n,t.sourceFilePath,c)}}let u=await t.io.readFile(l.absolutePath),d;try{d=a(u)}catch(n){let r=n instanceof Error?n.message:String(n),i=`File ${l.contentPath} is not valid: ${r}`;return e(t.node,i,t.sourceFilePath,c)}return t.node.attributes[`${t.attributeName}${r}`]=d,{entityDeps:c}}export{s as resolveParsedYamlAttribute,o as resolveRawContentAttribute,c as resolveRelativePathAttribute};
@@ -4,5 +4,6 @@ export declare function resolveJsonSchemaRefAttribute(ctx: MarkdocAttributeResol
4
4
  /** `{% json-example schema={...} %}`: generate a sample value from the resolved schema. */
5
5
  export declare function resolveSampleFromJsonSchemaAttribute(ctx: MarkdocAttributeResolverContext): Promise<MarkdocAttributeResolverResult | null>;
6
6
  /** `{% json-example value={...} %}`: a literal value passes through; a `{ $ref: "file#/pointer" }`
7
- * loads the pointed value (a tracked file dep). Failures land in `valueResolvedErrors`. */
7
+ * loads the pointed value (a tracked file dep). Failures land in `valueResolvedErrors` and
8
+ * a problem on the tag's line. */
8
9
  export declare function resolveJsonExampleRefAttribute(ctx: MarkdocAttributeResolverContext): Promise<MarkdocAttributeResolverResult | null>;
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../ingest/scan.js";import{resolveResolverTarget as n}from"./context-paths.js";import{join as r}from"node:path";async function i(e,t){let{bundle:n,createConfig:i,Source:o}=await import(`@redocly/openapi-core`),s=JSON.parse(JSON.stringify({openapi:`3.1.0`,components:{schemas:{__root:t}}})),c=r(e.contentDir,e.sourceFilePath),l=await n({config:await i({}),doc:{source:new o(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:a(l.fileDependencies,e.contentDir,c)}}function a(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 o(e){return e.length>0?{entityDeps:e.map(e=>({kind:`file`,path:e}))}:null}async function s(t){let{node:n,attributeName:r}=t,a=n.attributes[r];if(!e(a))return null;let{oas:s,errors:c,fileDeps:l}=await i(t,a);return n.attributes[`${r}Resolved`]=s,c.length>0&&(n.attributes[`${r}ResolvedErrors`]=c,t.logger?.warn(`json-schema in ${t.sourceFilePath}: ${c[0]}`)),o(l)}async function c(t){let{node:n,attributeName:r}=t,a=n.attributes[r];if(!e(a)||n.attributes.value!==void 0)return null;let{oas:s,schema:c,errors:l,fileDeps:u}=await i(t,a);if(l.length>0)return n.attributes[`${r}ResolvedErrors`]=l,t.logger?.warn(`json-example in ${t.sourceFilePath}: ${l[0]}`),o(u);let d=n.attributes.mode,f=await import(`openapi-sampler`);try{n.attributes[`${r}Resolved`]=f.sample(c,{...d===`read`?{skipWriteOnly:!0}:void 0,...d===`write`?{skipReadOnly:!0}:void 0},s)}catch(e){let i=`Failed to generate a sample from the schema: ${e?.message??e}`;n.attributes[`${r}ResolvedErrors`]=[i],t.logger?.warn(`json-example in ${t.sourceFilePath}: ${i}`)}return o(u)}async function l(t){let{node:r,attributeName:i}=t,a=r.attributes[i],o=e=>(r.attributes[`${i}ResolvedErrors`]=[e],t.logger?.warn(`json-example in ${t.sourceFilePath}: ${e}`),null);if(a!==void 0&&r.attributes.schema!==void 0)return o(`The "schema" and "value" attributes are mutually exclusive, use only one.`);if(a===void 0)return r.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 r.attributes[`${i}Resolved`]=a,null;let[c,l]=s.split(`#`),d=c?n(t,c):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 f=await t.io.readFile(d.absolutePath),p={entityDeps:[{kind:`file`,path:d.contentPath}]},m;try{m=(await import(`js-yaml`)).load(f)}catch(e){return o(`File ${d.contentPath} must be valid JSON or YAML: ${e.message}`),p}let h=l?u(m,l):m;return l&&h===void 0?(o(`Invalid $ref: ${d.contentPath} has no value at #${l}`),p):(r.attributes[`${i}Resolved`]=h,p)}function u(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{l as resolveJsonExampleRefAttribute,s as resolveJsonSchemaRefAttribute,c as resolveSampleFromJsonSchemaAttribute};
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,n){let{bundle:r,createConfig:a,Source:o}=await import(`@redocly/openapi-core`),{createBundleConfig:l,resolvePendingMarkdown:u}=await import(`../../../plugins/internal/api-docs/server/build-definition.js`),d=n?{markdown:e.markdown,loader:{...e,inJsonSchemaDescription:!0},sink:n}:void 0,f=JSON.parse(JSON.stringify({openapi:`3.1.0`,components:{schemas:{__root:t}}})),p=i(e.contentDir,e.sourceFilePath),m=await r({config:await l(a,{bundle:{config:{},configDir:``,plugins:[]},specRelativePath:e.sourceFilePath,rootDir:e.contentDir,resolution:d}),doc:{source:new o(p,``),parsed:f}}),h=m.bundle.parsed,g;if(d){let n=structuredClone(h),{sink:r}=d;await u(d,r.pending,e.contentDir,e.sourceFilePath),r.pending.some(e=>typeof e.read()==`object`)&&(g=n),r.problems=s(e,r.problems,t)}let _=h.components?.schemas,v=_?.__root?.$ref,y=typeof v==`string`?v.split(`/`).at(-1):void 0,b=y?_?.[y]:_?.__root;return{oas:h,asWritten:g,schema:b,errors:(m.problems??[]).slice(0,1).map(e=>e.message),fileDeps:c(m.fileDependencies,e.contentDir,p)}}function o(){return{entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]}}function s(n,r,i){let a=r.find(e=>e.code.startsWith(`markdoc/`));if(a===void 0)return r;let o=e(i)?i.$ref:void 0,s=typeof o==`string`?`the schema ${o}`:`the schema`;return[...r.filter(e=>!e.code.startsWith(`markdoc/`)),{...t(n.node,`A description in ${s} is not valid Markdoc, so it renders as text: ${a.message}`,n.sourceFilePath,a.code),severity:`warning`}]}function c(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 l(e,t=[]){return e.length>0||t.length>0?{entityDeps:e.map(e=>({kind:`file`,path:e})),problems:t}:null}function u(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 d(t){let{node:n,attributeName:r}=t,i=n.attributes[r];if(!e(i))return null;let s=o(),{oas:c,asWritten:l,errors:d,fileDeps:f}=await a(t,i,t.inJsonSchemaDescription?void 0:s);n.attributes[`${r}Resolved`]=c,l!==void 0&&(n.attributes[`${r}AsWritten`]=l);let p=d.length>0?[u(t,d)]:[];return{entityDeps:[...f.map(e=>({kind:`file`,path:e})),...s.entityDeps],assetUsages:s.assetUsages,linkRefs:s.linkRefs,problems:[...p,...s.problems]}}async function f(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:s,errors:c,fileDeps:d}=await a(t,i);if(c.length>0)return l(d,[u(t,c)]);let f=n.attributes.mode,p=await import(`openapi-sampler`);try{n.attributes[`${r}Resolved`]=p.sample(s,{...f===`read`?{skipWriteOnly:!0}:void 0,...f===`write`?{skipReadOnly:!0}:void 0},o)}catch(e){return l(d,[u(t,[`Failed to generate a sample from the schema: ${e?.message??e}`])])}return l(d)}async function p(t){let{node:n,attributeName:i}=t,a=n.attributes[i],o=e=>({problems:[u(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[c,l]=s.split(`#`),d=c?r(t,c):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 f=await t.io.readFile(d.absolutePath),p=[{kind:`file`,path:d.contentPath}],h;try{h=(await import(`js-yaml`)).load(f)}catch(e){return{entityDeps:p,...o(`File ${d.contentPath} must be valid JSON or YAML: ${e.message}`)}}let g=l?m(h,l):h;return l&&g===void 0?{entityDeps:p,...o(`Invalid $ref: ${d.contentPath} has no value at #${l}`)}:(n.attributes[`${i}Resolved`]=g,{entityDeps:p})}function m(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{p as resolveJsonExampleRefAttribute,d as resolveJsonSchemaRefAttribute,f as resolveSampleFromJsonSchemaAttribute};
@@ -1,7 +1,7 @@
1
1
  import type { ApiStore, CodeSamplePanelItem, CodeSampleSource, OpenAPIDefinition, ResponseCodeItem, findExampleEncoding } from '@redocly/api-docs';
2
2
  import { REDOCLY_TEAMS_RBAC } from '@redocly/config';
3
3
  import type { MarkdocAttributeResolverContext, MarkdocAttributeResolverResult } from '../../../plugins/types/markdoc.js';
4
- import type { RbacScope } from '../../../../server/rbac/types.js';
4
+ import type { RbacScope } from '../../../../shared/rbac/types.js';
5
5
  export type ResolvedSampleBlock = {
6
6
  lang: string;
7
7
  title: string;
@@ -1 +1 @@
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{createLruCache as i}from"../../../../shared/utils/lru-cache.js";import{parseMarkdownCached as a}from"../../utils/parse-cache.js";import{resolveResolverTarget as o}from"./context-paths.js";import{createApiEntityKey as s}from"../../../plugins/utils/api-entity-key.js";import{withMockServerOption as c}from"../../../plugins/internal/api-docs/server/options.js";import{annotateApiDocsRbac as l}from"../../../../server/rbac/api-docs.js";import{posix as u}from"node:path";import{REDOCLY_TEAMS_RBAC as d}from"@redocly/config";const f={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`},p=/* @__PURE__ */ new WeakMap;function m(e){let t=p.get(e.node);return t===void 0&&(t=h(e),p.set(e.node,t)),t}async function h(e){let t=e.node.attributes.descriptionFile;if(typeof t!=`string`||t===``||e.entities===void 0)return null;let n=o(e,t);if(n===null)return g(e,`descriptionFile "${t}" must stay inside the content directory`);let r=s(n.contentPath),i=await e.entities.get(r);return i===null||i.type!==`api`?g(e,`no API description found at ${n.contentPath}`):i.metadata?.specType===`openapi`?{contentPath:n.contentPath,document:await e.entities.load(r),metadata:i.metadata??{},dataHash:i.status===`ready`?i.dataHash??null:null}:g(e,`${n.contentPath} is not an OpenAPI description`)}function g(e,t){return e.logger?.warn(`${e.node.tag} in ${e.sourceFilePath}: ${t}`),e.node.attributes.descriptionFileInvalid=!0,null}const _=(e,t)=>e.node.attributes[t]??void 0;function v(e){let t=n(e.options)?e.options:{};return n(t.mockServer)?{...t,mockServer:{...t.mockServer,position:`off`}}:t}function y(e,t){let r=_(e,`language`),i=_(e,`options`);return{...t,...i,codeSamples:{...n(t.codeSamples)?t.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function b(e){let t=await m(e);if(t===null)return null;let{buildCodeSamples:n,getRequestBodySamples:r,normalizeOptions:i,resolveOperationSampleContext:o}=await import(`@redocly/api-docs`),s=i({specType:`openapi`,...y(e,v(t.metadata)),markdownParser:a}),c=o(t.document,s,{operationId:_(e,`operationId`),pointer:_(e,`pointer`)});if(!c)return null;let l={exampleKey:_(e,`exampleKey`),mimeType:_(e,`mimeType`),parameters:_(e,`parameters`),requestBody:_(e,`requestBody`),environments:_(e,`environments`),environment:_(e,`environment`)},u=n(c,l).map(e=>({lang:f[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),d=s.codeSamples?.languages??[],p=d.findIndex(({lang:e})=>e===`Payload`);if(p!==-1){let e=r(c,{exampleKey:l.exampleKey,mimeType:l.mimeType,titlePrefix:d[p].label});u.splice(p,0,...e)}return u.length>0&&(e.node.attributes[e.attributeName]=u),null}async function x(e){let t=await m(e);if(t===null)return null;let{getResponseSamples:n,normalizeOptions:r,resolveOperationSampleContext:i}=await import(`@redocly/api-docs`),o=i(t.document,r({specType:`openapi`,...v(t.metadata),markdownParser:a}),{operationId:_(e,`operationId`),pointer:_(e,`pointer`)});if(!o)return null;let s=n(o,{exampleKey:_(e,`exampleKey`)});return s.length>0&&(e.node.attributes[e.attributeName]=s),null}const S=i({budget:4});function C(e,t,n){let i=async()=>{let{buildItems:i}=await import(`@redocly/api-docs`),o=l(t.document,r,{warn:t=>e.logger?.warn(t)}),{items:s,store:c}=await i({type:r,document:o,options:{...n,specType:r,markdownParser:a},basePath:`/`,markdownParser:a});return{items:s,store:c}};if(t.dataHash===null)return i();let o=JSON.stringify([t.contentPath,t.dataHash,n]),s=S.get(o);return s===void 0&&(s=i(),S.set(o,s)),s}function w(e){return e.startsWith(`#`)?e.slice(1):e}function T(e,t){let n=_(t,`pointer`),r=_(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&&w(e.pointer)===w(n)||r!==void 0&&e?.sourceId===r)return i;let a=T(i.items??[],t);if(a!==void 0)return a}}function E(e){return e[d]}function D(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=E(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=E(n)??e;return{entry:r,scope:t===void 0?{}:{[d]:t}}}}let i=D(r.children,t,e);if(i!==void 0)return i}}async function O(e,t){return P(e,t,await N(e,t))}async function k(e){let t=await m(e);if(t===null)return null;let n=v(t.metadata),{items:r,store:i}=await C(e,t,n),a=T(r,e),o=a?.content?D(a.content.children,e=>e.kind===`code-sample`,E(a)):void 0;if(o===void 0)return null;let s=o.entry,{appendUndeclaredConfigureParameters:c}=await import(`@redocly/api-docs`),l=_(e,`parameters`),u={apiStore:i,options:y(e,n),panel:{...s,source:c(s.source,{...l?.path&&{path:l.path},...l?.query&&{query:l.query},...l?.header&&{headers:l.header},...l?.cookie&&{cookie:l.cookie}}),...o.scope},...await O(e,t.contentPath)};return e.node.attributes[e.attributeName]=u,null}async function A(e){let t=await m(e);if(t===null)return null;let n=v(t.metadata),{items:r,store:i}=await C(e,t,n),a=T(r,e),o=a?.content?D(a.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,E(a)):void 0;if(o?.entry.responseCodes===void 0)return null;let s={apiStore:i,options:n,panel:{responseCodes:o.entry.responseCodes,...o.entry.schemaId!==void 0&&{schemaId:o.entry.schemaId},...o.scope},...await O(e,t.contentPath)};return e.node.attributes[e.attributeName]=s,null}async function j(e){let t=_(e,`pointer`),n=t===void 0?null:await m(e);if(t===void 0||n===null)return null;let r=v(n.metadata),{items:i,store:a}=await C(e,n,r),o=w(t).replace(/^\//,``),s=Object.fromEntries([o,o.replace(/\/value$/,``)].filter(e=>a.exampleStore[e]!==void 0).map(e=>[e,a.exampleStore[e]]));if(Object.keys(s).length===0)return null;let c=(await import(`@redocly/api-docs`)).findExampleEncoding(i,t),l={apiStore:{schemaStore:{},exampleStore:s,securitySchemeStore:{}},options:{...r,..._(e,`options`)},...c!==void 0&&{encoding:c},...await O(e,n.contentPath)};return e.node.attributes[e.attributeName]=l,null}function M(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 N(e,t){let n=u.relative(u.dirname(e.sourceFilePath),t),{result:r}=await e.markdown.resolveLocalReference(n,e.sourceFilePath);return r.kind===`pageUrl`?r.url:void 0}function P(n,r,i){let a=e(n.config);if(a===null)return{};let o=t(a,{filePath:r,slug:i??null});return{[d]:o??{}}}async function F(e){let t=await m(e);if(t===null)return null;let{findExampleIdByKey:i,JsonPointer:o,normalizeOptions:s,resolveOperationSampleContext:u}=await import(`@redocly/api-docs`),d=t.metadata,f=n(d.options)?d.options:{},p=await N(e,t.contentPath),h=c(f,e.config,p),g=_(e,`options`),v={...h,...g??{}},y=s({specType:`openapi`,...v,markdownParser:a}),b=l(t.document,r,{warn:t=>e.logger?.warn(t)}),x=u(b,y,{operationId:_(e,`operationId`),pointer:_(e,`pointer`)});if(!x)return null;let S=M(x.source,_(e,`mimeType`),_(e,`exampleKey`),x.storeCtx.exampleStore,i),C={apiStore:{schemaStore:x.storeCtx.schemaStore,exampleStore:x.storeCtx.exampleStore,securitySchemeStore:x.storeCtx.securitySchemeStore,specVersion:b.openapi},definition:b,operationId:x.operation.operationId??``,operationSource:S,options:v,pointer:o.compile([`paths`,x.pathName,x.method.toLowerCase()]),...P(e,t.contentPath,p)};return e.node.attributes[e.attributeName]=C,null}export{k as resolveOpenapiCodeSamplePanelAttribute,b as resolveOpenapiCodeSamplesAttribute,j as resolveOpenapiExampleAttribute,F as resolveOpenapiReplayAttribute,A as resolveOpenapiResponsePanelAttribute,x as resolveOpenapiResponseSamplesAttribute};
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"../../../../shared/rbac/engine.js";import{SPEC_KIND_OPENAPI as i}from"../../../../shared/constants/api-spec-kinds.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"../../../../shared/rbac/api-docs.js";import{REDOCLY_TEAMS_RBAC as d}from"@redocly/config";const f={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`},p=/* @__PURE__ */ new WeakMap;async function m(e){let t=p.get(e.node);t===void 0&&(t=h(e),p.set(e.node,t));let n=await t;return{definition:n.definition,problems:n.problems.splice(0)}}async function h(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 g(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`?g(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:[]}:g(e,`${n.contentPath} is not an OpenAPI description`)}function g(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 _=(e,t)=>e.node.attributes[t]??void 0;function v(t){let n=e(t.options)?t.options:{};return e(n.mockServer)?{...n,mockServer:{...n.mockServer,position:`off`}}:n}function y(t,n){let r=_(t,`language`),i=_(t,`options`);return{...n,...i,codeSamples:{...e(n.codeSamples)?n.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function b(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let{buildCodeSamples:r,getRequestBodySamples:i,normalizeOptions:a,resolveOperationSampleContext:s}=await import(`@redocly/api-docs/server`),c=a({specType:`openapi`,...y(e,v(t.metadata)),markdownParser:o}),l=s(t.document,c,{operationId:_(e,`operationId`),pointer:_(e,`pointer`)});if(!l)return null;let u={exampleKey:_(e,`exampleKey`),mimeType:_(e,`mimeType`),parameters:_(e,`parameters`),requestBody:_(e,`requestBody`),environments:_(e,`environments`),environment:_(e,`environment`)},d=r(l,u).map(e=>({lang:f[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),p=c.codeSamples?.languages??[],h=p.findIndex(({lang:e})=>e===`Payload`);if(h!==-1){let e=i(l,{exampleKey:u.exampleKey,mimeType:u.mimeType,titlePrefix:p[h].label});d.splice(h,0,...e)}return d.length>0&&(e.node.attributes[e.attributeName]=d),null}async function x(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let{getResponseSamples:r,normalizeOptions:i,resolveOperationSampleContext:a}=await import(`@redocly/api-docs/server`),s=a(t.document,i({specType:`openapi`,...v(t.metadata),markdownParser:o}),{operationId:_(e,`operationId`),pointer:_(e,`pointer`)});if(!s)return null;let c=r(s,{exampleKey:_(e,`exampleKey`)});return c.length>0&&(e.node.attributes[e.attributeName]=c),null}const S=a({budget:4});function C(e,t,n){let r=async()=>{let{buildItems:r}=await import(`@redocly/api-docs/server`),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=S.get(a);return s===void 0&&(s=r(),S.set(a,s)),s}function w(e){return e.startsWith(`#`)?e.slice(1):e}function T(e,t){let n=_(t,`pointer`),r=_(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&&w(e.pointer)===w(n)||r!==void 0&&e?.sourceId===r)return i;let a=T(i.items??[],t);if(a!==void 0)return a}}function E(e){return e[d]}function D(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=E(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=E(n)??e;return{entry:r,scope:t===void 0?{}:{[d]:t}}}}let i=D(r.children,t,e);if(i!==void 0)return i}}async function O(e,t){return N(e,t,e.markdown.pageRouteSlug(t))}async function k(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let r=v(t.metadata),{items:i,store:a}=await C(e,t,r),o=T(i,e),s=o?.content?D(o.content.children,e=>e.kind===`code-sample`,E(o)):void 0;if(s===void 0)return null;let c=s.entry,{appendUndeclaredConfigureParameters:l}=await import(`@redocly/api-docs/server`),u=_(e,`parameters`),d={apiStore:a,options:y(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 O(e,t.contentPath)};return e.node.attributes[e.attributeName]=d,null}async function A(e){let{definition:t,problems:n}=await m(e);if(t===null)return{problems:n};let r=v(t.metadata),{items:i,store:a}=await C(e,t,r),o=T(i,e),s=o?.content?D(o.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,E(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 O(e,t.contentPath)};return e.node.attributes[e.attributeName]=c,null}async function j(e){let t=_(e,`pointer`);if(t===void 0)return null;let{definition:n,problems:r}=await m(e);if(n===null)return{problems:r};let i=v(n.metadata),{items:a,store:o}=await C(e,n,i),s=w(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/server`)).findExampleEncoding(a,t),u={apiStore:{schemaStore:{},exampleStore:c,securitySchemeStore:{}},options:{...i,..._(e,`options`)},...l!==void 0&&{encoding:l},...await O(e,n.contentPath)};return e.node.attributes[e.attributeName]=u,null}function M(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}}function N(e,t,i){let a=n(e.config);if(a===null)return{};let o=r(a,{filePath:t,slug:i??null});return{[d]:o}}async function P(t){let{definition:n,problems:r}=await m(t);if(n===null)return{problems:r};let{findExampleIdByKey:a,JsonPointer:s,normalizeOptions:c,resolveOperationSampleContext:d}=await import(`@redocly/api-docs/server`),f=n.metadata,p=e(f.options)?f.options:{},h=t.markdown.pageRouteSlug(n.contentPath),g=l(p,t.config,h),v=_(t,`options`),y={...g,...v??{}},b=c({specType:`openapi`,...y,markdownParser:o}),x=u(n.document,i,{warn:e=>t.logger?.warn(e)}),S=d(x,b,{operationId:_(t,`operationId`),pointer:_(t,`pointer`)});if(!S)return null;let C=M(S.source,_(t,`mimeType`),_(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()]),...N(t,n.contentPath,h)};return t.node.attributes[t.attributeName]=w,null}export{k as resolveOpenapiCodeSamplePanelAttribute,b as resolveOpenapiCodeSamplesAttribute,j as resolveOpenapiExampleAttribute,P as resolveOpenapiReplayAttribute,A as resolveOpenapiResponsePanelAttribute,x as resolveOpenapiResponseSamplesAttribute};
@@ -1 +1 @@
1
- import{replaceWithMarkdocError as e}from"../../tags/markdoc-error.js";import{markdocNodeProblem as t}from"../../utils/node-source-range.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 r=`Partial ${h.contentPath} must live in a partials folder (markdown.partialsFolders: ${a(n.config).join(`, `)})`;return e(d,r),{problems:[t(d,r,n.sourceFilePath)]}}let g=n.partialChain??[n.sourceFilePath];if(g.includes(h.contentPath))return e(d,`Circular partial inclusion: ${[...g,h.contentPath].join(` -> `)}`),{entityDeps:[{kind:`file`,path:h.contentPath}]};if(!await n.io.exists(h.absolutePath)){let r=`Partial file ${h.contentPath} does not exist`;return e(d,r),{entityDeps:[{kind:`file`,path:h.contentPath}],problems:[t(d,r,n.sourceFilePath)]}}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{markdocErrorResult as e,replaceWithMarkdocError as t}from"../../tags/markdoc-error.js";import{PARTIAL_L10N_ATTRIBUTE as n}from"../../tags/partial.js";import{L10N_DIR as r}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as i,l10nDirOf as a}from"../../../../shared/utils/l10n.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 t=`Partial ${p.contentPath} must live in a partials folder (markdown.partialsFolders: ${l(o.config).join(`, `)})`;return e(s,t,o.sourceFilePath)}let m=a(o.sourceFilePath),g=[],v=m!==void 0&&a(p.contentPath)===void 0?`${r}/${m}/${p.contentPath}`:p.contentPath;if(!await o.io.exists(h(o.contentDir,v))){g.push({kind:`file`,path:v});let t=i(v);if(t!==void 0&&g.push({kind:`file`,path:t}),t===void 0||!await o.io.exists(h(o.contentDir,t))){let t=`Partial file ${p.contentPath} does not exist`;return e(s,t,o.sourceFilePath,g)}v=t}let y=o.partialChain??[o.sourceFilePath];if(y.includes(v))return t(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&&a(p.contentPath)===void 0){let e={},t=a(o.file.path);for(let n of o.markdown.contentLocales){let i=`${r}/${n}/${o.file.path}`;if(t===void 0&&S.push({entityDeps:[{kind:`file`,path:i}]}),t===void 0?o.markdown.hasPageRoute(i):n!==t)continue;let a=`${r}/${n}/${p.contentPath}`,s=h(o.contentDir,a);if(!await o.io.exists(s)){S.push({entityDeps:[{kind:`file`,path:a}]});continue}let c=await _(o,a,await o.io.readFile(s),y);e[n]=c.ast,S.push(c.result)}Object.keys(e).length>0&&(s.attributes[n]=e)}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{delocalizeL10nPath as e}from"../../../../shared/utils/l10n.js";import{replaceWithMarkdocError as t}from"../../tags/markdoc-error.js";import{markdocNodeProblem as n}from"../../utils/node-source-range.js";import{resolveResolverTarget as r}from"./context-paths.js";import{prefixSvgIds as i}from"../../utils/prefix-svg-ids.js";async function a(a,o={}){let{node:s,attributeName:c}=a,l=s.attributes[c];if(typeof l!=`string`||l===``||a.io===void 0)return null;let u=r(a,l);if(u===null)return null;let d=[{kind:`file`,path:u.contentPath}],f=u;if(!await a.io.exists(u.absolutePath)){let i=e(a.sourceFilePath);if(f=i===void 0?null:r({...a,sourceFilePath:i},l),f===null||!await a.io.exists(f.absolutePath)){if(o.optional)return null;let e=`SVG file ${u.contentPath} does not exist`;return t(s,e),{entityDeps:d,problems:[n(s,e,a.sourceFilePath)]}}d.push({kind:`file`,path:f.contentPath})}let p=await a.io.readFile(f.absolutePath),m=f.contentPath.replace(/[^a-zA-Z0-9_-]/g,`-`);return s.attributes[`${c}RawContent`]=i(p,m),{entityDeps:d}}export{a as resolveSvgContentAttribute};
1
+ import{markdocErrorResult as e}from"../../tags/markdoc-error.js";import{delocalizeL10nPath as t}from"../../../../shared/utils/l10n.js";import{resolveResolverTarget as n}from"./context-paths.js";import{prefixSvgIds as r}from"../../utils/prefix-svg-ids.js";async function i(i,a={}){let{node:o,attributeName:s}=i,c=o.attributes[s];if(typeof c!=`string`||c===``||i.io===void 0)return null;let l=n(i,c);if(l===null)return null;let u=[{kind:`file`,path:l.contentPath}],d=l;if(!await i.io.exists(l.absolutePath)){let r=t(i.sourceFilePath);if(d=r===void 0?null:n({...i,sourceFilePath:r},c),d===null||!await i.io.exists(d.absolutePath)){if(a.optional)return null;let t=`SVG file ${l.contentPath} does not exist`;return e(o,t,i.sourceFilePath,u)}u.push({kind:`file`,path:d.contentPath})}let f=await i.io.readFile(d.absolutePath),p=d.contentPath.replace(/[^a-zA-Z0-9_-]/g,`-`);return o.attributes[`${s}RawContent`]=r(f,p),{entityDeps:u}}export{i as resolveSvgContentAttribute};
@@ -4,6 +4,7 @@ import type { LinkRefDraft } from '../../link-checker/classify.js';
4
4
  import type { ProblemDraft } from '../../problems/types.js';
5
5
  import type { EntityInvalidationDep } from '../../plugins/types/plugin.js';
6
6
  import type { MarkdocAttributeResolver, MarkdocAttributeResolverContext } from '../../plugins/types/markdoc.js';
7
+ import { type RealmPlusResolverName } from './attribute-resolver-key.js';
7
8
  export type MarkdocResolverContextBase = Omit<MarkdocAttributeResolverContext, 'attributeName' | 'node' | 'sourceFilePath' | 'readSourceLines'>;
8
9
  export type ResolveMarkdocBuildTimeAttributesOptions = {
9
10
  resolverContext?: MarkdocResolverContextBase;
@@ -22,7 +23,7 @@ export type ResolveMarkdocBuildTimeAttributesResult = {
22
23
  /** Resolver failures, located at the file each tag is written in. */
23
24
  problems: ProblemDraft[];
24
25
  };
25
- type MarkdocAttributeResolverMap = Record<string, MarkdocAttributeResolver>;
26
+ type MarkdocAttributeResolverMap = Record<RealmPlusResolverName, MarkdocAttributeResolver>;
26
27
  /**
27
28
  * Walk the parsed Markdoc AST and resolve local references so that the stored
28
29
  * tree contains final URLs rather than raw file paths.
@@ -1 +1 @@
1
- import{replaceWithMarkdocError as e}from"../tags/markdoc-error.js";import{walkMarkdocAst as t}from"../utils/walk-markdoc-ast.js";import{getExampleContent as n,walkWithExampleContent as r}from"../utils/reparse-example-fences.js";import{markdocNodeProblem as i}from"../utils/node-source-range.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(i,a){let o=a.tags??{},s=F,c={entityDeps:[],assetUsages:[],linkRefs:[],problems:[]},l=a.resolverContext?.markdown?.disabledTags,u=R(a.source),d=[...t(i,{skipChildren:z})],f=d.flatMap(e=>{let t=n(e);return t?[...r(t,z)]:[]});for(let e of[...d,...f])M(e);let p=f.filter(e=>e.type===`tag`);for(let t of[...d,...p])if(t.type===`link`)await L(s.nativeMdLink,t,`href`,a,c,u);else if(t.type===`image`)await L(s.imageSrc,t,`src`,a,c,u);else if(t.type===`tag`){if(typeof t.tag==`string`&&l?.has(t.tag)){e(t,`The "${t.tag}" tag is not available here.`);continue}let n=typeof t.tag==`string`?o[t.tag]:void 0;for(let[e,r]of Object.entries(n?.attributes??{})){let n=A(r);if(!n)continue;let i=s[n];i&&await L(i,t,e,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 r(e))n.type===`tag`&&typeof n.tag==`string`&&t.add(n.tag);return[...t].sort()}async function L(t,n,r,a,o,s){let c;try{c=await t({...a.resolverContext,attributeName:r,node:n,sourceFilePath:a.sourceFilePath,tags:a.tags,partialChain:a.partialChain,readSourceLines:s})}catch(t){let r=t instanceof Error?t.message:String(t);e(n,r),o.problems.push(i(n,r,a.sourceFilePath));return}c&&(c.entityDeps&&o.entityDeps.push(...c.entityDeps),c.assetUsages&&o.assetUsages.push(...c.assetUsages),c.linkRefs&&o.linkRefs.push(...c.linkRefs),c.problems&&o.problems.push(...c.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
+ 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{convertGithubAlertToAdmonition as j}from"@redocly/theme/markdoc/tags/admonition";import{PROMPT_TAG as M}from"@redocly/theme/core/constants";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])j(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);n&&Object.hasOwn(s,n)&&await L(s[n],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===M}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};
@@ -9,7 +9,8 @@ export type InlineRawPartialsResult = {
9
9
  /**
10
10
  * Classic Realm's `{% raw-partial file="…" /%}`: the text of a Markdown file from a partials
11
11
  * folder, inlined before parsing, so link reference definitions in it apply to the page. A
12
- * `/` path is content-root-relative, any other is relative to the including file. A file
12
+ * `/` path is content-root-relative, any other is relative to the including file. A missing
13
+ * `@l10n/<locale>/` file falls back to its default-locale twin, as in classic Realm. A file
13
14
  * that is missing, not Markdown, outside the partials folders, or already being inlined
14
15
  * inlines nothing and reports a problem.
15
16
  */
@@ -1 +1 @@
1
- import{resolveContentPath as e}from"../../../shared/utils/resolve-content-path.js";import{isPartialPath as t}from"../utils/partials.js";import{join as n}from"node:path";const r=/\{% ?raw-partial file="([^"]+)" ?\/?%\}/g;async function i(o,s,c,l=[s]){let u={source:o,entityDeps:[],problems:[]};if(!o.includes(`raw-partial`)||c.io===void 0)return u;let d=/* @__PURE__ */ new Map;for(let[,f]of o.matchAll(r)){if(f===void 0||d.has(f))continue;let r=e(f,s),o=``;if(r===null||!r.endsWith(`.md`)||!t(r,c.config))u.problems.push(a(s,`Raw partial "${f}" must be a Markdown file in a partials folder.`));else if(l.includes(r))u.problems.push(a(s,`Circular raw partial inclusion: ${[...l,r].join(` -> `)}`));else{u.entityDeps.push({kind:`file`,path:r});let e=n(c.contentDir,r);if(await c.io.exists(e)){let t=await i(await c.io.readFile(e),r,c,[...l,r]);o=t.source,u.entityDeps.push(...t.entityDeps),u.problems.push(...t.problems)}else u.problems.push(a(s,`Raw partial file ${r} does not exist.`))}d.set(f,o)}return u.source=o.replace(r,(e,t)=>d.get(t)??``),u}function a(e,t){return{code:`markdoc/validation-error`,severity:`warning`,message:t,location:{filePath:e}}}export{i as inlineRawPartials};
1
+ import{delocalizeL10nPath as e}from"../../../shared/utils/l10n.js";import{resolveContentPath as t}from"../../../shared/utils/resolve-content-path.js";import{isPartialPath as n}from"../utils/partials.js";import{join as r}from"node:path";const i=/\{% ?raw-partial file="([^"]+)" ?\/?%\}/g;async function a(s,c,l,u=[c]){let d={source:s,entityDeps:[],problems:[]};if(!s.includes(`raw-partial`)||l.io===void 0)return d;let f=/* @__PURE__ */ new Map;for(let[,p]of s.matchAll(i)){if(p===void 0||f.has(p))continue;let i=t(p,c),s=``;if(i===null||!i.endsWith(`.md`)||!n(i,l.config))d.problems.push(o(c,`Raw partial "${p}" must be a Markdown file in a partials folder.`));else if(u.includes(i))d.problems.push(o(c,`Circular raw partial inclusion: ${[...u,i].join(` -> `)}`));else{d.entityDeps.push({kind:`file`,path:i});let t=e(i),n=i;if(await l.io.exists(r(l.contentDir,i))||(t!==void 0&&d.entityDeps.push({kind:`file`,path:t}),n=t!==void 0&&await l.io.exists(r(l.contentDir,t))?t:null),n!==null){let e=await a(await l.io.readFile(r(l.contentDir,n)),i,l,[...u,i]);s=e.source,d.entityDeps.push(...e.entityDeps),d.problems.push(...e.problems)}else d.problems.push(o(c,`Raw partial file ${i} does not exist.`))}f.set(p,s)}return d.source=s.replace(i,(e,t)=>f.get(t)??``),d}function o(e,t){return{code:`markdoc/validation-error`,severity:`warning`,message:t,location:{filePath:e}}}export{a as inlineRawPartials};
@@ -1,4 +1,4 @@
1
- import type { ContentStateView } from '../../database/types/content-state.js';
1
+ import type { ContentStateRouteInfo, ContentStateView } from '../../database/types/content-state.js';
2
2
  import type { EntityInvalidationDep } from '../../plugins/types/plugin.js';
3
3
  import type { AssetUsage } from '../types/asset-usage.js';
4
4
  import type { AudienceTagResolver } from './audience-tag.js';
@@ -36,6 +36,8 @@ export type ResolveImageSrcSetResult = {
36
36
  entityDeps: EntityInvalidationDep[];
37
37
  assetUsages: AssetUsage[];
38
38
  };
39
+ /** The route that serves `slug`: its own, else the nearest wildcard route above it. */
40
+ export declare function findServingRoute(state: ContentStateView, slug: string): ContentStateRouteInfo | undefined;
39
41
  export declare function resolveLocalReference(rawHref: string, sourceFilePath: string, state: ContentStateView, resolveAudienceTag?: AudienceTagResolver, contentLocales?: readonly string[], includingPagePath?: string): Promise<ReferenceResolution>;
40
42
  export declare function resolveImageReference(rawSrc: string, sourceFilePath: string, state: ContentStateView, resolveAudienceTag?: AudienceTagResolver, contentLocales?: readonly string[]): Promise<ReferenceResolution>;
41
43
  export declare function resolveImageSrcSet(rawSrcSet: string, sourceFilePath: string, state: ContentStateView, resolveAudienceTag?: AudienceTagResolver, contentLocales?: readonly string[]): Promise<ResolveImageSrcSetResult>;
@@ -1 +1 @@
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
+ 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=/[[\]()*_`#!|<>~]|\{%|\n[ \t\r]*\n|^\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?m.extname(t).toLowerCase()===`.md`?void 0:p(i,`/${t}`,!1):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{C as findServingRoute,_ as isLocalReference,g as looksLikeMarkdown,T as resolveImageReference,E as resolveImageSrcSet,w as resolveLocalReference,y as splitHash};