@redocly/reef 0.131.0-next.5 → 0.131.0-next.7

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 (215) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/cli/stats/collectors/openapi.js +1 -1
  3. package/dist/cli/telemetry/index.js +1 -1
  4. package/dist/client/App.js +1 -1
  5. package/dist/client/app/hooks/useAutoScroll.js +1 -1
  6. package/dist/client/app/hooks/utils/pathname-matches-active-section.d.ts +6 -0
  7. package/dist/client/app/hooks/utils/pathname-matches-active-section.js +1 -0
  8. package/dist/client/app/markdoc/custom-components/html-script.js +1 -0
  9. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -0
  10. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -0
  11. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -0
  12. package/dist/client/app/markdoc/hooks/use-store.js +1 -0
  13. package/dist/{server/plugins/asyncapi-docs/template → client/templates/asyncapi-docs}/helpers.d.ts +3 -3
  14. package/dist/client/templates/asyncapi-docs/helpers.js +1 -0
  15. package/dist/{server/plugins/asyncapi-docs/template/AsyncApiDocs.d.ts → client/templates/asyncapi-docs/template.d.ts} +1 -1
  16. package/dist/client/templates/asyncapi-docs/template.js +11 -0
  17. package/dist/client/templates/openapi-docs/helpers.js +5 -0
  18. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.d.ts → client/templates/openapi-docs/template.d.ts} +1 -1
  19. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.js → client/templates/openapi-docs/template.js} +1 -1
  20. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-inner-text.d.ts +1 -1
  21. package/dist/markdoc/helpers/get-inner-text.js +2 -0
  22. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-variable.d.ts +2 -2
  23. package/dist/markdoc/helpers/get-variable.js +1 -0
  24. package/dist/markdoc/nodes/fence/index.js +1 -0
  25. package/dist/markdoc/nodes/heading.js +1 -0
  26. package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.d.ts +6 -6
  27. package/dist/markdoc/tags/json-example.d.ts +3 -0
  28. package/dist/markdoc/tags/json-schema.d.ts +3 -0
  29. package/dist/markdoc/tags/openapi-code-sample.d.ts +3 -0
  30. package/dist/markdoc/tags/openapi-example.d.ts +3 -0
  31. package/dist/markdoc/tags/openapi-response-sample.d.ts +3 -0
  32. package/dist/markdoc/tags/replay-openapi.d.ts +3 -0
  33. package/dist/markdoc/types.d.ts +8 -0
  34. package/dist/markdoc/types.js +0 -0
  35. package/dist/server/config/env-schema.d.ts +6 -3
  36. package/dist/server/config/env-schemas/database.d.ts +1 -1
  37. package/dist/server/config/env-schemas/database.js +1 -1
  38. package/dist/server/config/env-schemas/organization-project.d.ts +3 -0
  39. package/dist/server/config/env-schemas/organization-project.js +1 -1
  40. package/dist/server/plugins/asyncapi-docs/index.js +1 -1
  41. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +2 -2
  42. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
  43. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
  44. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +1 -1
  45. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  46. package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.js +1 -1
  47. package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.js +1 -1
  48. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.js +1 -1
  49. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.js +1 -1
  50. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.js +1 -1
  51. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.js +1 -1
  52. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
  53. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.js +1 -1
  54. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  55. package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.js +1 -1
  56. package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.js +1 -1
  57. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
  58. package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.js +1 -1
  59. package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.js +1 -1
  60. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.js +1 -1
  61. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.js +1 -1
  62. package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.js +1 -1
  63. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
  64. package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
  65. package/dist/server/plugins/markdown/markdoc/partials.js +1 -1
  66. package/dist/server/plugins/markdown/markdoc/plugins/headings.js +1 -1
  67. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  68. package/dist/server/plugins/markdown/runtime-transform.js +1 -1
  69. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  70. package/dist/server/plugins/markdown/search/get-search-documents.js +2 -2
  71. package/dist/server/plugins/markdown/search/nodes/section-node.js +1 -1
  72. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  73. package/dist/server/plugins/markdown/search/to-markdown.js +1 -1
  74. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  75. package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.js +1 -1
  76. package/dist/server/plugins/openapi-docs/index.js +1 -1
  77. package/dist/server/plugins/openapi-docs/search-indexer.js +1 -1
  78. package/dist/server/plugins/scorecard-classic/lint.js +1 -1
  79. package/dist/server/plugins/scorecards/database/scorecards-config-service.js +1 -1
  80. package/dist/server/plugins/sidebars/index.js +2 -2
  81. package/dist/server/ssr/render.js +1 -1
  82. package/dist/server/store.js +1 -1
  83. package/dist/server/telemetry/index.js +1 -1
  84. package/dist/server/types/plugins/markdown.d.ts +0 -7
  85. package/dist/server/utils/fs.js +1 -1
  86. package/dist/server/utils/index.d.ts +2 -2
  87. package/dist/server/utils/index.js +1 -1
  88. package/dist/{server/utils → utils}/slugger.d.ts +13 -0
  89. package/package.json +6 -6
  90. package/dist/server/plugins/asyncapi-docs/template/AsyncApiDocs.js +0 -11
  91. package/dist/server/plugins/asyncapi-docs/template/helpers.js +0 -1
  92. package/dist/server/plugins/markdown/markdoc/custom-components/html-script.js +0 -1
  93. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-code-sample.js +0 -1
  94. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-response-sample.js +0 -1
  95. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/replay-openapi.js +0 -1
  96. package/dist/server/plugins/markdown/markdoc/helpers/get-inner-text.js +0 -2
  97. package/dist/server/plugins/markdown/markdoc/helpers/get-variable.js +0 -1
  98. package/dist/server/plugins/markdown/markdoc/hooks/use-store.js +0 -1
  99. package/dist/server/plugins/markdown/markdoc/nodes/fence/index.js +0 -1
  100. package/dist/server/plugins/markdown/markdoc/nodes/heading.js +0 -1
  101. package/dist/server/plugins/markdown/markdoc/tags/json-example.d.ts +0 -3
  102. package/dist/server/plugins/markdown/markdoc/tags/json-schema.d.ts +0 -3
  103. package/dist/server/plugins/markdown/markdoc/tags/openapi-code-sample.d.ts +0 -3
  104. package/dist/server/plugins/markdown/markdoc/tags/openapi-example.d.ts +0 -3
  105. package/dist/server/plugins/markdown/markdoc/tags/openapi-response-sample.d.ts +0 -3
  106. package/dist/server/plugins/markdown/markdoc/tags/replay-openapi.d.ts +0 -3
  107. package/dist/server/plugins/openapi-docs/template/helpers.js +0 -5
  108. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/html-script.d.ts +0 -0
  109. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.d.ts +0 -0
  110. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.js +0 -0
  111. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.d.ts +0 -0
  112. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.js +0 -0
  113. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.d.ts +0 -0
  114. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.js +0 -0
  115. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.d.ts +0 -0
  116. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.js +0 -0
  117. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.d.ts +0 -0
  118. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.js +0 -0
  119. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.d.ts +0 -0
  120. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.js +0 -0
  121. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.d.ts +0 -0
  122. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.js +0 -0
  123. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.d.ts +0 -0
  124. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.js +0 -0
  125. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.d.ts +0 -0
  126. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.js +0 -0
  127. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.d.ts +0 -0
  128. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.js +0 -0
  129. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.d.ts +0 -0
  130. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.js +0 -0
  131. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.d.ts +0 -0
  132. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.js +0 -0
  133. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.d.ts +0 -0
  134. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.js +0 -0
  135. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-code-sample.d.ts +0 -0
  136. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.d.ts +0 -0
  137. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.js +0 -0
  138. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-response-sample.d.ts +0 -0
  139. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/replay-openapi.d.ts +0 -0
  140. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.d.ts +0 -0
  141. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.js +0 -0
  142. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.d.ts +0 -0
  143. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.js +0 -0
  144. /package/dist/{server/plugins/markdown → client/app}/markdoc/hooks/use-store.d.ts +0 -0
  145. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/helpers.d.ts +0 -0
  146. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.d.ts +0 -0
  147. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.js +0 -0
  148. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.d.ts +0 -0
  149. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.js +0 -0
  150. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.d.ts +0 -0
  151. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.js +0 -0
  152. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.d.ts +0 -0
  153. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.js +0 -0
  154. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.d.ts +0 -0
  155. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.js +0 -0
  156. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.d.ts +0 -0
  157. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.js +0 -0
  158. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.d.ts +0 -0
  159. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.js +0 -0
  160. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.d.ts +0 -0
  161. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.js +0 -0
  162. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.d.ts +0 -0
  163. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.js +0 -0
  164. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.d.ts +0 -0
  165. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.js +0 -0
  166. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.d.ts +0 -0
  167. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.js +0 -0
  168. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.d.ts +0 -0
  169. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.js +0 -0
  170. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.d.ts +0 -0
  171. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.js +0 -0
  172. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.d.ts +0 -0
  173. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.js +0 -0
  174. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.d.ts +0 -0
  175. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.js +0 -0
  176. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.d.ts +0 -0
  177. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.js +0 -0
  178. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.d.ts +0 -0
  179. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.js +0 -0
  180. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.d.ts +0 -0
  181. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.js +0 -0
  182. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.d.ts +0 -0
  183. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.js +0 -0
  184. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.d.ts +0 -0
  185. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.js +0 -0
  186. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.d.ts +0 -0
  187. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.js +0 -0
  188. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.d.ts +0 -0
  189. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.js +0 -0
  190. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.d.ts +0 -0
  191. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.js +0 -0
  192. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.d.ts +0 -0
  193. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.js +0 -0
  194. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.d.ts +0 -0
  195. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.js +0 -0
  196. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/index.d.ts +0 -0
  197. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.d.ts +0 -0
  198. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.js +0 -0
  199. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/heading.d.ts +0 -0
  200. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.d.ts +0 -0
  201. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.js +0 -0
  202. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.d.ts +0 -0
  203. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.js +0 -0
  204. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.d.ts +0 -0
  205. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.js +0 -0
  206. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.js +0 -0
  207. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-example.js +0 -0
  208. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-schema.js +0 -0
  209. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-code-sample.js +0 -0
  210. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-example.js +0 -0
  211. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-response-sample.js +0 -0
  212. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/replay-openapi.js +0 -0
  213. /package/dist/{server/utils → utils}/conflict-resolvers.d.ts +0 -0
  214. /package/dist/{server/utils → utils}/conflict-resolvers.js +0 -0
  215. /package/dist/{server/utils → utils}/slugger.js +0 -0
@@ -1 +1 @@
1
- import b from"@markdoc/markdoc";import{getPathnameForLocale as A}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as u}from"../constants/common.js";import{DEFAULT_TITLE as C}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{isObject as O}from"../utils/guards/is-object.js";import{mapObject as T}from"../utils/object/map-object.js";import{getValueDeep as S}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as M}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as f}from"../utils/path/normalize-route-slug.js";import{isLocalLink as L}from"../utils/path/is-local-link.js";import{reporter as w}from"./tools/notifiers/reporter.js";import{logger as p}from"./tools/notifiers/logger.js";import{sha1 as k}from"./utils/crypto/sha1.js";import{writeEnvVariable as _}from"./utils/envs/write-env-variable.js";import{envConfig as F}from"./config/env-config.js";import{KvService as G}from"./persistence/kv/services/kv-service.js";import{writeSharedData as B}from"./utils/index.js";import{renderComponents as I}from"./ssr/render.js";import{readStaticData as N,writeStaticData as V}from"./utils/static-data.js";import{parseAndResolveMarkdoc as j}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as H}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as y}from"./entitlements/entitlements-provider.js";import{isL10nPath as K}from"./fs/utils/is-l10n-path.js";import{resolveMetadataGlobs as U}from"./utils/globs.js";import{replaceEnvVariablesDeep as J}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{addWildcardRedirectToTree as q}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as $}from"../cli/telemetry/helpers/trace-step.js";const R={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map"},g="markdown/partials",bt="markdown/partials-deps",v="PLAN_GATES",W=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],At="userDefinedApiFunctions";class E{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#t={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},rbac:{},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#e=new Map;constructor({outdir:t,contentDir:e,serverMode:s=!1,serverOutDir:r}){this.#r=e,this.outdir=t,this.serverMode=s,this.serverOutDir=r,this.userCodeReady=new Promise(a=>{this.#a=a})}on(t,e){const s=this.listeners.get(t);s?s.add(e):this.listeners.set(t,new Set([e]))}queueEvent=(t,e,...s)=>{this.#e.set(t+String(e),[t,e,...s])};runListeners=(t,e,...s)=>{for(const r of this.listeners.get(t)||new Set)e?r(e,...s):r(...s)};startPluginsRun(){this.clear(),this.#o=new Promise(t=>{this.#i=t})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const t of this.#e.values())this.runListeners(...t);this.#e.clear()}startEsbuildRun(){this.#n=new Promise(t=>{this.#c=t})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await $("build.reload_markdoc_options",async()=>{const t=y.instance(),e=await H(this.serverOutDir),s=Object.fromEntries(Object.entries(e.tags).filter(([r])=>D[r]!=null?t.canAccessFeature(D[r]):!0));this.#s={...e,tags:s}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(g),themeConfig:this.config.markdown}}setGlobalData=t=>{const e=this.globalData,s={...this.globalData,...t};this.globalData=s,JSON.stringify(s)!==JSON.stringify(e)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;getKv=async()=>G.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async(t,e,s)=>{const{data:{info:r,ast:a},compoundHash:c}=await j(t,this.markdocOptions,{actions:this,context:e});for(const o of r.sharedDataDeps||[]){for(const i of s?.routeSlugs||[])this.addRouteSharedData(i,o,o);for(const i of s?.sharedDataIds||[]){const n=this.sharedDataDeps.get(i)||new Set;n.add(o),this.sharedDataDeps.set(i,n)}}for(const o of r.dynamicMarkdocComponents||[]){for(const i of s?.routeSlugs||[]){const n=this.routesDynamicComponents.get(i)||new Set;n.add(o),this.routesDynamicComponents.set(i,n)}for(const i of s?.sharedDataIds||[]){const n=this.sharedDataMarkdocComponents.get(i)||new Set;n.add(o),this.sharedDataMarkdocComponents.set(i,n)}}if(s?.routeSlugs&&r.partials?.length)for(const o of s.routeSlugs){const i=this.routesPartials.get(o)||[];for(const n of r.partials)i.includes(n)||i.push(n);this.routesPartials.set(o,i)}return{info:r,ast:a,compoundHash:c}};async loadOpenApiDefinitions(t){return(await t.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(t){return(await t.cache.load(".","asyncapi-docs")).data}setSearchEngine(t){this.searchEngine=t}setSearchFacets=t=>{this.searchFacets=t};setGlobalConfig=t=>{const e=Object.keys(t);for(const c of e)for(const o in this.replacedEnvVars)if(o===c||o.startsWith(`${c}:`)){const i=o.split(":"),{error:n,value:l}=S(t,i);(n||l!==this.replacedEnvVars[o].replaced)&&delete this.replacedEnvVars[o]}const{resolvedObj:s,unsetEnvVars:r,replacedValues:a}=J(t);for(const c of r)this.unsetEnvVars.add(c);Object.assign(this.replacedEnvVars,a),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=t=>this.config[t];getSearchFacets=()=>this.searchFacets;addRedirect=(t,e)=>{if(!y.instance().canAccessFeature("redirects")&&t!=="/")return;this.config.redirects||(this.config.redirects={});const a=f(t).toLowerCase();this.config.redirects[a]=e,a.endsWith("*")&&q(this.config.wildcardRedirectsTree,a)};getRedirect=t=>{const e=f(t).toLowerCase();return x(e,this.config.redirects,this.config.wildcardRedirectsTree)};createSharedData=async(t,e,s)=>{if(s&&this.#t[t]===s)return t;const r=JSON.stringify(e),a=s??k(r);return this.#t[t]===a||(this.#t[t]=a,await B(t,r,this.outdir),this.queueEvent("shared-data-updated",t)),t};addRouteSharedData=(t,e,s)=>{const r=M(t),a=this.routesSharedData.get(r)||{};a[e]=s,this.routesSharedData.set(r,a),p.verbose(`Adding shared data to ${t}, ${e}, ${s}`)};getRouteSharedDataByFsPath=t=>{const e=this.routesByFsPath.get(t);return e?this.routesSharedData.get(e)||{}:{}};getPartialsForRoute=t=>{const e=this.getGlobalConfig(g)||{},s=this.routesPartials.get(t);if(!s||s.length===0)return{};const r={};for(const a of s)e[a]&&(r[a]=e[a]);return r};addRoute=t=>{const s={...U(t.fsPath,this.config.metadataGlobs),...t.metadata||{}};this.newRoutes.push({...t,metadata:s}),p.verbose("Created route %s",t.slug)};addRouteSharedDataToAllLocales=(t,e,s)=>{const r=[u,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const c=A(t,u,a.code,r);this.addRouteSharedData(c,e,s)}};addApiRoute=t=>{this.apiRoutes.push(t),p.verbose("Created API route %s",t.slug)};addMiddleware=t=>{this.middleware.push(t),p.verbose("Created middleware %s",t.id)};getRouteByFsPath=t=>{const e=this.routesByFsPath.get(t);return e?this.getRouteBySlug(e):void 0};getRouteBySlug=(t,e={})=>{const{followRedirect:s=!0}=e,r=this.getRedirect(t);return s&&r?this.routesBySlug.get(f(r.to)):this.routesBySlug.get(t)};slugHasRouteOrRedirect=t=>{if(this.routesBySlug.has(t))return!0;const e=this.getRedirect(t);if(!e)return!1;if(!L(e.to))return!0;const s=f(e.to);return this.routesBySlug.has(s)};getRoutesByTemplateId=t=>this.newRoutes.filter(e=>e.templateId===t);getAllRoutesForLocale=(t=u)=>{const e=Array.from(this.routesBySlug.values()),s=t.toLowerCase();return e.filter(r=>t===u?!K(r.fsPath):r.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=t=>this.templates.get(t);getRequestHandler=t=>this.apiRoutesRequestHandlers.get(t);createTemplate=(t,e)=>(this.templates.set(t,e),t);addBrowserPlugin=t=>{this.browserPlugins.add(t)};createRequestHandler=(t,e)=>(this.apiRoutesRequestHandlers.set(t,e),t);registerServerPropsGetter=(t,e)=>(this.serverPropsGetters.set(t,e),t);registerPagePropsGetter=(t,e)=>{this.pagePropsGetters.set(t,e)};async writeRouteStaticData(t,e){const s=await this.resolveRouteStaticData(t,e,!1);s&&V(t.slug,s,this.outdir)}async resolveRouteStaticData(t,e,s){if(this.serverMode)return N(t.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:(l,d)=>this.parseMarkdoc(l,d,{routeSlugs:[t.slug]})},a=await t.getStaticData?.(t,r)||{},c=new Set(this.routesDynamicComponents.get(t.slug)),o=this.routesSharedData.get(t.slug)||{};for(const l of Object.values(o)){const d=this.sharedDataMarkdocComponents.get(l);d&&d.forEach(h=>c.add(h));const m=this.sharedDataDeps.get(l);m&&m.forEach(h=>this.addRouteSharedData(t.slug,h,h))}const i=this.getGlobalConfig("seo"),n=a?.frontmatter||{};return{...a,frontmatter:{...n,seo:{...n?.seo,title:n?.seo?.title||await t.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(c),metadata:{...a?.props?.metadata,...t.metadata},seo:{title:C,...i,...a.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!t.fsPath?null:await this.lifecycleContext?.fs.getLastModified(t.fsPath)}}addSsrComponents(t,e){if(!t?.length)return;const s=typeof t[0]=="string"?t.join(""):I(t);s&&(e==="head"?this.ssr.headTags.push(s):e==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const t=[];for(const[s,r]of Object.entries(R))switch(r){case"map":const a=Array.from(this[s].entries());t.push([s,a]);break;case"object":s==="config"&&t.push([s,await this.getConfigWithEnvPlaceholders()]),t.push([s,this[s]]);break;default:throw new Error("Invalid format")}const e=Object.fromEntries(t);return e[v]=F.PLAN_GATES,e}static fromJson(t,e){const s=new E(e);for(const[a,c]of Object.entries(R))switch(c){case"map":s[a]=new Map(t[a]);break;case"object":if(a==="config"){s.setGlobalConfig(t[a]);break}s[a]=t[a];break;default:throw new Error("Invalid format")}s.config[g]=z(s.config[g]||{});const r=t[v];return r&&_("PLAN_GATES",r),s}async getConfigWithEnvPlaceholders(){const t=JSON.parse(JSON.stringify(this.config));for(const e in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[e],r=e.split(":"),a=r.pop(),{error:c,value:o}=S(t,r);if(c||!O(o)&&!Array.isArray(o)){await w.panicOnBuild(`Failed to replace env var with env name for ${e}`);continue}o[a]=s}return t}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const t=Array.from(this.unsetEnvVars).filter(s=>!W.includes(s));if(t.length===0)return;const e=`Failed to resolve config. The following environment variables are not set: ${t.join(", ")}`;await w.panicOnBuildContentError(e)}}function z(P){return T(P,t=>b.Ast.fromJSON(JSON.stringify(t)))}export{g as MARKDOC_PARTIALS_DATA_KEY,bt as MARKDOC_PARTIALS_DEPS_KEY,E as Store,At as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
1
+ import b from"@markdoc/markdoc";import{getPathnameForLocale as A}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as u}from"../constants/common.js";import{DEFAULT_TITLE as C}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{isObject as O}from"../utils/guards/is-object.js";import{mapObject as T}from"../utils/object/map-object.js";import{getValueDeep as S}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as M}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as f}from"../utils/path/normalize-route-slug.js";import{isLocalLink as L}from"../utils/path/is-local-link.js";import{reporter as w}from"./tools/notifiers/reporter.js";import{logger as p}from"./tools/notifiers/logger.js";import{sha1 as k}from"./utils/crypto/sha1.js";import{writeEnvVariable as _}from"./utils/envs/write-env-variable.js";import{envConfig as F}from"./config/env-config.js";import{KvService as G}from"./persistence/kv/services/kv-service.js";import{writeSharedData as B}from"./utils/index.js";import{renderComponents as I}from"./ssr/render.js";import{readStaticData as N,writeStaticData as V}from"./utils/static-data.js";import{parseAndResolveMarkdoc as j}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as H}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as y}from"./entitlements/entitlements-provider.js";import{isL10nPath as K}from"./fs/utils/is-l10n-path.js";import{resolveMetadataGlobs as U}from"./utils/globs.js";import{replaceEnvVariablesDeep as J}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{addWildcardRedirectToTree as q}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as $}from"../cli/telemetry/helpers/trace-step.js";const R={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map"},g="markdown/partials",W="markdown/partials-deps",v="PLAN_GATES",z=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],At="userDefinedApiFunctions";class E{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#t={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},rbac:{},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#e=new Map;constructor({outdir:t,contentDir:e,serverMode:s=!1,serverOutDir:r}){this.#r=e,this.outdir=t,this.serverMode=s,this.serverOutDir=r,this.userCodeReady=new Promise(a=>{this.#a=a})}on(t,e){const s=this.listeners.get(t);s?s.add(e):this.listeners.set(t,new Set([e]))}queueEvent=(t,e,...s)=>{this.#e.set(t+String(e),[t,e,...s])};runListeners=(t,e,...s)=>{for(const r of this.listeners.get(t)||new Set)e?r(e,...s):r(...s)};startPluginsRun(){this.clear(),this.#o=new Promise(t=>{this.#i=t})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const t of this.#e.values())this.runListeners(...t);this.#e.clear()}startEsbuildRun(){this.#n=new Promise(t=>{this.#c=t})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await $("build.reload_markdoc_options",async()=>{const t=y.instance(),e=await H(this.serverOutDir),s=Object.fromEntries(Object.entries(e.tags).filter(([r])=>D[r]!=null?t.canAccessFeature(D[r]):!0));this.#s={...e,tags:s}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(g),themeConfig:this.config.markdown}}setGlobalData=t=>{const e=this.globalData,s={...this.globalData,...t};this.globalData=s,JSON.stringify(s)!==JSON.stringify(e)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;getKv=async()=>G.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async(t,e,s)=>{const{data:{info:r,ast:a},compoundHash:n}=await j(t,this.markdocOptions,{actions:this,context:e});for(const i of r.sharedDataDeps||[]){for(const o of s?.routeSlugs||[])this.addRouteSharedData(o,i,i);for(const o of s?.sharedDataIds||[]){const c=this.sharedDataDeps.get(o)||new Set;c.add(i),this.sharedDataDeps.set(o,c)}}for(const i of r.dynamicMarkdocComponents||[]){for(const o of s?.routeSlugs||[]){const c=this.routesDynamicComponents.get(o)||new Set;c.add(i),this.routesDynamicComponents.set(o,c)}for(const o of s?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(o)||new Set;c.add(i),this.sharedDataMarkdocComponents.set(o,c)}}if(s?.routeSlugs&&r.partials?.length)for(const i of s.routeSlugs){const o=this.routesPartials.get(i)||[];for(const c of r.partials)o.includes(c)||o.push(c);this.routesPartials.set(i,o)}return{info:r,ast:a,compoundHash:n}};async loadOpenApiDefinitions(t){return(await t.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(t){return(await t.cache.load(".","asyncapi-docs")).data}setSearchEngine(t){this.searchEngine=t}setSearchFacets=t=>{this.searchFacets=t};setGlobalConfig=t=>{const e=Object.keys(t);for(const n of e)for(const i in this.replacedEnvVars)if(i===n||i.startsWith(`${n}:`)){const o=i.split(":"),{error:c,value:l}=S(t,o);(c||l!==this.replacedEnvVars[i].replaced)&&delete this.replacedEnvVars[i]}const{resolvedObj:s,unsetEnvVars:r,replacedValues:a}=J(t);for(const n of r)this.unsetEnvVars.add(n);Object.assign(this.replacedEnvVars,a),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=t=>this.config[t];getSearchFacets=()=>this.searchFacets;addRedirect=(t,e)=>{if(!y.instance().canAccessFeature("redirects")&&t!=="/")return;this.config.redirects||(this.config.redirects={});const a=f(t).toLowerCase();this.config.redirects[a]=e,a.endsWith("*")&&q(this.config.wildcardRedirectsTree,a)};getRedirect=t=>{const e=f(t).toLowerCase();return x(e,this.config.redirects,this.config.wildcardRedirectsTree)};createSharedData=async(t,e,s)=>{if(s&&this.#t[t]===s)return t;const r=JSON.stringify(e),a=s??k(r);return this.#t[t]===a||(this.#t[t]=a,await B(t,r,this.outdir),this.queueEvent("shared-data-updated",t)),t};addRouteSharedData=(t,e,s)=>{const r=M(t),a=this.routesSharedData.get(r)||{};a[e]=s,this.routesSharedData.set(r,a),p.verbose(`Adding shared data to ${t}, ${e}, ${s}`)};getRouteSharedDataByFsPath=t=>{const e=this.routesByFsPath.get(t);return e?this.routesSharedData.get(e)||{}:{}};getPartialsForRoute=t=>{const e=this.getGlobalConfig(g)||{},s=this.routesPartials.get(t);if(!s||s.length===0)return{};const r=this.getGlobalConfig(W)||{},a=new Set(s),n=Array.from(s);for(let o=0;o<n.length;o++){const c=n[o],l=r[c]?.partials??[];for(const d of l)a.has(d)||(a.add(d),n.push(d))}const i={};for(const o of a)e[o]&&(i[o]=e[o]);return i};addRoute=t=>{const s={...U(t.fsPath,this.config.metadataGlobs),...t.metadata||{}};this.newRoutes.push({...t,metadata:s}),p.verbose("Created route %s",t.slug)};addRouteSharedDataToAllLocales=(t,e,s)=>{const r=[u,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const n=A(t,u,a.code,r);this.addRouteSharedData(n,e,s)}};addApiRoute=t=>{this.apiRoutes.push(t),p.verbose("Created API route %s",t.slug)};addMiddleware=t=>{this.middleware.push(t),p.verbose("Created middleware %s",t.id)};getRouteByFsPath=t=>{const e=this.routesByFsPath.get(t);return e?this.getRouteBySlug(e):void 0};getRouteBySlug=(t,e={})=>{const{followRedirect:s=!0}=e,r=this.getRedirect(t);return s&&r?this.routesBySlug.get(f(r.to)):this.routesBySlug.get(t)};slugHasRouteOrRedirect=t=>{if(this.routesBySlug.has(t))return!0;const e=this.getRedirect(t);if(!e)return!1;if(!L(e.to))return!0;const s=f(e.to);return this.routesBySlug.has(s)};getRoutesByTemplateId=t=>this.newRoutes.filter(e=>e.templateId===t);getAllRoutesForLocale=(t=u)=>{const e=Array.from(this.routesBySlug.values()),s=t.toLowerCase();return e.filter(r=>t===u?!K(r.fsPath):r.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=t=>this.templates.get(t);getRequestHandler=t=>this.apiRoutesRequestHandlers.get(t);createTemplate=(t,e)=>(this.templates.set(t,e),t);addBrowserPlugin=t=>{this.browserPlugins.add(t)};createRequestHandler=(t,e)=>(this.apiRoutesRequestHandlers.set(t,e),t);registerServerPropsGetter=(t,e)=>(this.serverPropsGetters.set(t,e),t);registerPagePropsGetter=(t,e)=>{this.pagePropsGetters.set(t,e)};async writeRouteStaticData(t,e){const s=await this.resolveRouteStaticData(t,e,!1);s&&V(t.slug,s,this.outdir)}async resolveRouteStaticData(t,e,s){if(this.serverMode)return N(t.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:(l,d)=>this.parseMarkdoc(l,d,{routeSlugs:[t.slug]})},a=await t.getStaticData?.(t,r)||{},n=new Set(this.routesDynamicComponents.get(t.slug)),i=this.routesSharedData.get(t.slug)||{};for(const l of Object.values(i)){const d=this.sharedDataMarkdocComponents.get(l);d&&d.forEach(h=>n.add(h));const m=this.sharedDataDeps.get(l);m&&m.forEach(h=>this.addRouteSharedData(t.slug,h,h))}const o=this.getGlobalConfig("seo"),c=a?.frontmatter||{};return{...a,frontmatter:{...c,seo:{...c?.seo,title:c?.seo?.title||await t.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(n),metadata:{...a?.props?.metadata,...t.metadata},seo:{title:C,...o,...a.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!t.fsPath?null:await this.lifecycleContext?.fs.getLastModified(t.fsPath)}}addSsrComponents(t,e){if(!t?.length)return;const s=typeof t[0]=="string"?t.join(""):I(t);s&&(e==="head"?this.ssr.headTags.push(s):e==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const t=[];for(const[s,r]of Object.entries(R))switch(r){case"map":const a=Array.from(this[s].entries());t.push([s,a]);break;case"object":s==="config"&&t.push([s,await this.getConfigWithEnvPlaceholders()]),t.push([s,this[s]]);break;default:throw new Error("Invalid format")}const e=Object.fromEntries(t);return e[v]=F.PLAN_GATES,e}static fromJson(t,e){const s=new E(e);for(const[a,n]of Object.entries(R))switch(n){case"map":s[a]=new Map(t[a]);break;case"object":if(a==="config"){s.setGlobalConfig(t[a]);break}s[a]=t[a];break;default:throw new Error("Invalid format")}s.config[g]=Y(s.config[g]||{});const r=t[v];return r&&_("PLAN_GATES",r),s}async getConfigWithEnvPlaceholders(){const t=JSON.parse(JSON.stringify(this.config));for(const e in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[e],r=e.split(":"),a=r.pop(),{error:n,value:i}=S(t,r);if(n||!O(i)&&!Array.isArray(i)){await w.panicOnBuild(`Failed to replace env var with env name for ${e}`);continue}i[a]=s}return t}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const t=Array.from(this.unsetEnvVars).filter(s=>!z.includes(s));if(t.length===0)return;const e=`Failed to resolve config. The following environment variables are not set: ${t.join(", ")}`;await w.panicOnBuildContentError(e)}}function Y(P){return T(P,t=>b.Ast.fromJSON(JSON.stringify(t)))}export{g as MARKDOC_PARTIALS_DATA_KEY,W as MARKDOC_PARTIALS_DEPS_KEY,E as Store,At as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
@@ -1 +1 @@
1
- import{AsyncApiRealmAPI as t}from"@redocly/realm-asyncapi-sdk";import{envConfig as e}from"../config/env-config.js";import{PACKAGE_NAME as o}from"../../config/product-gates.js";import{OTEL_TRACES_DEV_URL as i,TELEMETRY_ENABLED as s}from"../constants/common.js";class l extends t.Telemetry{constructor(){super(),this.updateCloudEventData(()=>({organization:{id:e.ORGANIZATION_ID||"",slug:e.ORGANIZATION_SLUG||""},project:{id:e.PROJECT_ID||"",slug:""},productType:"server",sourceDetails:{id:"Anonymous",object:"user",uri:""},source:"server"}))}initialize(r=!1){this.init({otel:{serviceName:"realm-server",serviceVersion:`${o}@${e.REDOCLY_PORTAL_VERSION||""}`,collectorTraceUrl:r?i:e.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:e.isProductionEnv,version:"1.0",tracerName:"server-telemetry",delayMillis:100},disabled:r?e.TELEMETRY_DEV_DEBUG!=="true":!s})}}const T=new l;export{T as telemetry};
1
+ import{AsyncApiRealmAPI as o}from"@redocly/realm-asyncapi-sdk";import{envConfig as e}from"../config/env-config.js";import{PACKAGE_NAME as t}from"../../config/product-gates.js";import{OTEL_TRACES_DEV_URL as i,TELEMETRY_ENABLED as s}from"../constants/common.js";class l extends o.Telemetry{constructor(){super(),this.updateCloudEventData(()=>({organizationId:e.ORGANIZATION_ID||"",organizationSlug:e.ORGANIZATION_SLUG||"",projectId:e.PROJECT_ID||"",projectSlug:"",origin:"realmApi",actor:{id:"Anonymous",object:"user",uri:""},source:"server"}))}initialize(r=!1){this.init({otel:{serviceName:"realm-server",serviceVersion:`${t}@${e.REDOCLY_PORTAL_VERSION||""}`,collectorTraceUrl:r?i:e.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:e.isProductionEnv,version:"1.0",tracerName:"server-telemetry",delayMillis:100},disabled:r?e.TELEMETRY_DEV_DEBUG!=="true":!s})}}const A=new l;export{A as telemetry};
@@ -1,4 +1,3 @@
1
- import type { Schema } from '@markdoc/markdoc';
2
1
  import type { PageStaticData, REDOCLY_ROUTE_RBAC, REDOCLY_TEAMS_RBAC, RbacScopeItems } from '@redocly/config';
3
2
  import type { PluginDefaultOptions, PageRouteDetails, LifecycleContext, AfterRoutesCreatedActions } from '../../types';
4
3
  import type { LINK_ORIGINAL_ATTR_NAME } from '../../constants/common';
@@ -32,12 +31,6 @@ export type MdPageStaticData = {
32
31
  fsPath?: string;
33
32
  };
34
33
  } & PageStaticData;
35
- export type CustomMarkdocTag = {
36
- schema: Schema & {
37
- dynamicComponentLib: string;
38
- };
39
- tagName: string;
40
- };
41
34
  export type WithOriginalAttr<T, P = string> = T & {
42
35
  [K in `${typeof LINK_ORIGINAL_ATTR_NAME}:${string}`]?: P | null;
43
36
  };
@@ -1 +1 @@
1
- import{existsSync as c,readdirSync as l,lstatSync as f,mkdirSync as u,copyFileSync as p,lstat as x}from"fs";import{join as s,extname as S,basename as F,dirname as h,resolve as E}from"path";import{withPathPrefix as w}from"@redocly/theme/core/utils";import{PUBLIC_ASSETS_FOLDER as a}from"../constants/common.js";import{reporter as P}from"../tools/notifiers/reporter.js";import{logger as D}from"../tools/notifiers/logger.js";import{shaDirPathShort as b}from"../utils/crypto/sha-dir-path-short.js";import{shaFileHex as N}from"../utils/crypto/sha-file-hex.js";import{slug as $}from"./slugger.js";function I(r){if(!c(r))return[];const e=[];return o(r),e;function o(t){try{l(t).forEach(n=>{let i=s(t,n);f(i).isDirectory()?o(i):e.push(i)})}catch(n){D.error(`Error reading all file names in ${t}: `+n.message)}}}async function T(r,e,o){const t=E(r,e);if(!c(t))throw new v(`File not found at ${t}`,e);c(s(o,a))||u(s(o,a),{recursive:!0});const n=S(t),i=[$(F(t,n)),N(t),b(h(e))].join(".").concat(n),m=s(o,a,i),y=s(a,i);try{if(p(t,m),!c(m))throw new Error(`Cannot copy file ${e}`);return w(y)}catch(d){await P.panicOnBuild(d.message)}}function g(r,e){let o=[];if(c(r)){if(c(e)||u(e,{recursive:!0}),!f(r).isDirectory())throw new Error(`Source path must be a directory, but ${r} provided`);o=l(r),o.forEach(t=>{const n=s(r,t);if(f(n).isDirectory())g(n,s(e,t));else{const i=s(e,t);p(n,i)}})}}function U(r){return u(h(r),{recursive:!0}),r}async function q(r){return new Promise(e=>{x(r,(o,t)=>{e(o==null&&t.isFile())})})}class v extends Error{filePath;constructor(e,o){super(e),this.name="FileNotFoundError",this.filePath=o}}export{v as FileNotFoundError,g as copyFolderRecursiveSync,T as copyStaticFile,U as ensureDir,q as fileExistsAsync,I as readFileNames};
1
+ import{existsSync as c,readdirSync as l,lstatSync as f,mkdirSync as u,copyFileSync as p,lstat as x}from"fs";import{join as s,extname as S,basename as F,dirname as h,resolve as E}from"path";import{withPathPrefix as w}from"@redocly/theme/core/utils";import{PUBLIC_ASSETS_FOLDER as a}from"../constants/common.js";import{reporter as P}from"../tools/notifiers/reporter.js";import{logger as D}from"../tools/notifiers/logger.js";import{shaDirPathShort as b}from"../utils/crypto/sha-dir-path-short.js";import{shaFileHex as N}from"../utils/crypto/sha-file-hex.js";import{slug as $}from"../../utils/slugger.js";function I(r){if(!c(r))return[];const e=[];return o(r),e;function o(t){try{l(t).forEach(n=>{let i=s(t,n);f(i).isDirectory()?o(i):e.push(i)})}catch(n){D.error(`Error reading all file names in ${t}: `+n.message)}}}async function T(r,e,o){const t=E(r,e);if(!c(t))throw new v(`File not found at ${t}`,e);c(s(o,a))||u(s(o,a),{recursive:!0});const n=S(t),i=[$(F(t,n)),N(t),b(h(e))].join(".").concat(n),m=s(o,a,i),y=s(a,i);try{if(p(t,m),!c(m))throw new Error(`Cannot copy file ${e}`);return w(y)}catch(d){await P.panicOnBuild(d.message)}}function g(r,e){let o=[];if(c(r)){if(c(e)||u(e,{recursive:!0}),!f(r).isDirectory())throw new Error(`Source path must be a directory, but ${r} provided`);o=l(r),o.forEach(t=>{const n=s(r,t);if(f(n).isDirectory())g(n,s(e,t));else{const i=s(e,t);p(n,i)}})}}function U(r){return u(h(r),{recursive:!0}),r}async function q(r){return new Promise(e=>{x(r,(o,t)=>{e(o==null&&t.isFile())})})}class v extends Error{filePath;constructor(e,o){super(e),this.name="FileNotFoundError",this.filePath=o}}export{v as FileNotFoundError,g as copyFolderRecursiveSync,T as copyStaticFile,U as ensureDir,q as fileExistsAsync,I as readFileNames};
@@ -1,12 +1,12 @@
1
1
  export * from './fs.js';
2
2
  export * from './paths.js';
3
3
  export * from './rbac.js';
4
- export * from './slugger.js';
4
+ export { slugger, slug, GithubSlugger } from '../../utils/slugger.js';
5
5
  export * from './attribute-parser.js';
6
6
  export * from './resolve-src-set.js';
7
7
  export * from './shared-data.js';
8
8
  export * from './globs.js';
9
9
  export * from './billing.js';
10
10
  export * from './resolve-asset-path.js';
11
- export * from './conflict-resolvers.js';
11
+ export { UniqueKeyResolver } from '../../utils/conflict-resolvers.js';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- export*from"./fs.js";export*from"./paths.js";export*from"./rbac.js";export*from"./slugger.js";export*from"./attribute-parser.js";export*from"./resolve-src-set.js";export*from"./shared-data.js";export*from"./globs.js";export*from"./billing.js";export*from"./resolve-asset-path.js";export*from"./conflict-resolvers.js";
1
+ export*from"./fs.js";export*from"./paths.js";export*from"./rbac.js";import{slugger as m,slug as p,GithubSlugger as x}from"../../utils/slugger.js";export*from"./attribute-parser.js";export*from"./resolve-src-set.js";export*from"./shared-data.js";export*from"./globs.js";export*from"./billing.js";export*from"./resolve-asset-path.js";import{UniqueKeyResolver as n}from"../../utils/conflict-resolvers.js";export{x as GithubSlugger,n as UniqueKeyResolver,p as slug,m as slugger};
@@ -18,6 +18,19 @@ export declare class GithubSlugger {
18
18
  reset(): void;
19
19
  }
20
20
  export declare const slugger: GithubSlugger;
21
+ /**
22
+ * Converts a string to a URL-safe slug (no uniqueness; use `slugger.slug` for unique slugs).
23
+ *
24
+ * @param value - The string to slugify.
25
+ * @param options - Options for case, dots, and slashes.
26
+ * @returns The slugified string, or '_' if empty after slugifying.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * slug('Hello World'); // 'hello-world'
31
+ * slug('v1.0', { replaceDots: true }); // 'v10'
32
+ * ```
33
+ */
21
34
  export declare function slug(value: string, options?: SluggerOptions): string;
22
35
  export {};
23
36
  //# sourceMappingURL=slugger.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/reef",
3
- "version": "0.131.0-next.5",
3
+ "version": "0.131.0-next.7",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,7 +29,7 @@
29
29
  "@opentelemetry/sdk-trace-web": "2.0.1",
30
30
  "@opentelemetry/semantic-conventions": "1.34.0",
31
31
  "@redocly/ajv": "8.17.4",
32
- "@redocly/openapi-core": "2.18.2",
32
+ "@redocly/openapi-core": "2.19.0",
33
33
  "@shikijs/transformers": "3.21.0",
34
34
  "@tanstack/react-query": "5.62.3",
35
35
  "@tanstack/react-table": "8.21.3",
@@ -91,13 +91,13 @@
91
91
  "xpath": "0.0.34",
92
92
  "yaml-ast-parser": "0.0.43",
93
93
  "zod": "^3.25.76",
94
- "@redocly/asyncapi-docs": "1.8.0-next.3",
94
+ "@redocly/asyncapi-docs": "1.8.0-next.4",
95
95
  "@redocly/config": "0.43.0",
96
96
  "@redocly/graphql-docs": "1.8.0-next.3",
97
- "@redocly/openapi-docs": "3.19.0-next.3",
97
+ "@redocly/openapi-docs": "3.19.0-next.4",
98
98
  "@redocly/portal-legacy-ui": "0.14.0-next.0",
99
- "@redocly/portal-plugin-mock-server": "0.16.0-next.3",
100
- "@redocly/realm-asyncapi-sdk": "0.9.0-next.1",
99
+ "@redocly/portal-plugin-mock-server": "0.16.0-next.4",
100
+ "@redocly/realm-asyncapi-sdk": "0.9.0-next.2",
101
101
  "@redocly/theme": "0.63.0-next.3"
102
102
  },
103
103
  "peerDependencies": {
@@ -1,11 +0,0 @@
1
- import l from"styled-components";import*as o from"react";import{RedoclyAsyncAPIDocs as d}from"@redocly/asyncapi-docs";import{withPathPrefix as m}from"@redocly/theme/core/utils";import{usePageSharedData as p}from"../../../../client/app/hooks";import{useCollectMarkdocOptions as f}from"./helpers";function h({pageProps:t}){const a=p("AsyncApiDefinition"),{document:i,apiItems:r,protocol:e,downloadUrls:n}=a,c=m(t?.settings?.baseUrlPath),s=f(t);return o.createElement(u,null,o.createElement(d,{pageProps:t,document:i,apiItems:r,routingBasePath:c,protocol:e,downloadUrls:n,markdocOptions:s}))}const u=l.div`
2
- a[id],
3
- a[data-section-id],
4
- div[data-section-id] {
5
- scroll-margin-top: calc(
6
- var(--navbar-height) + var(--banner-height) + var(--panel-gap-vertical)
7
- );
8
- }
9
-
10
- --sidebar-width: 0px;
11
- `;export{h as default};
@@ -1 +0,0 @@
1
- import{useMemo as t}from"react";import{components as s}from"@redocly-markdoc/components";import{tags as m,components as r}from"@redocly/theme/markdoc/default";import*as n from"../../markdown/markdoc/custom-components/index.js";import*as e from"../../markdown/markdoc/nodes/index.js";import p from"../../markdown/markdoc/tags/index.js";import{parsePartials as a}from"../../openapi-docs/template/helpers.js";function C({markdown:o}){return t(()=>({tags:{...p,...m},nodes:{...e},components:{...n,...r,...s,...globalThis.__LOADER.markdocComponents},...o,partials:a(o?.partials)}),[o])}export{C as useCollectMarkdocOptions};
@@ -1 +0,0 @@
1
- import*as s from"react";import{loadScriptFromReactAsync as l,loadScriptFromReactSync as i}from"../../../../../client/ScriptLoader";function u(n){let r=!1;const{children:c,src:e,async:o,...t}=n;return typeof document<"u"&&(r=!!(e?document.querySelector(`script[src="${e}"]`):null)),s.useEffect(()=>{r||(e?o?l(e,t):i(e,!1,t):c&&i(c.toString(),!0,t))},[e]),null}export{u as HtmlScript};
@@ -1 +0,0 @@
1
- import*as o from"react";import{StoreProvider as v,RequestSamples as y,normalizeOptions as E}from"@redocly/openapi-docs";import{ErrorMessage as O,OpenApiComponentWrap as M}from"../styled.elements";import{useStore as b}from"../../hooks/use-store";import{getOperation as C}from"./get-operation/index";import{getMockServerDocsConfig as k}from"../../../../openapi-docs/template/mock-server-config.js";function P(u){const{descriptionFile:d,operationId:a,pointer:m,exampleKey:s,mimeType:l,language:r,requestBody:f,parameters:g,environment:t,environments:n}=u,{store:e,error:S,baseSlug:c}=b(d),i=o.useMemo(()=>({...e?.options,...(r||null)&&{codeSamples:{languages:[{lang:r??""}]},mockServer:k(e?.options?.mockServer,c||"")}}),[r,e?.options,c]),p=o.useMemo(()=>{if(e)return C(e,{operationId:a,pointer:m},E(i),{exampleKey:s,mimeType:l,environments:n,environment:t})},[s,i,l,a,m,e,n,t]);return e?p?o.createElement(M,{"data-testid":"openapi-code-sample"},o.createElement(v,{options:i,definition:e.definition,withState:{environments:n,environment:t,operation:{pointer:p.pointer,state:{requestValues:{body:f,...g}}}}},o.createElement(y,{operation:p,disableFooter:!0}))):o.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation by operationId or pointer"):o.createElement(O,null,S)}export{P as OpenApiCodeSample};
@@ -1 +0,0 @@
1
- import*as e from"react";import{StoreProvider as S,ResponseSamples as v,normalizeOptions as g}from"@redocly/openapi-docs";import{ErrorMessage as b,OpenApiComponentWrap as E}from"../styled.elements";import{useStore as R}from"../../hooks/use-store";import{getOperation as C}from"./get-operation/index";import{getMockServerDocsConfig as O}from"../../../../openapi-docs/template/mock-server-config.js";function x(a){const{descriptionFile:m,operationId:i,pointer:p,exampleKey:t}=a,{store:o,error:c,baseSlug:s}=R(m),[l,f]=e.useState(),r=e.useMemo(()=>({...o?.options,mockServer:O(o?.options?.mockServer,s||"")}),[o?.options,s]),n=e.useMemo(()=>{if(o)return C(o,{operationId:i,pointer:p},g(r),{exampleKey:t})},[t,r,i,p,o]),d=e.useCallback(u=>{f(u)},[]);return o?n?e.createElement(E,{"data-testid":"openapi-response-sample"},e.createElement(S,{options:r,definition:o.definition,withState:{operation:{pointer:n.pointer,state:{activeExampleName:t}}}},e.createElement(v,{operation:n,activeResponseTab:l,onTabChange:d}))):e.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation by operationId or pointer"):e.createElement(b,null,c)}export{x as OpenApiResponseSample};
@@ -1 +0,0 @@
1
- import o from"react";import{EmbeddedReplay as E,StoreProvider as M}from"@redocly/openapi-docs";import{useLocation as b}from"react-router-dom";import{Admonition as k}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{ErrorMessage as A,OpenApiComponentWrap as I}from"../styled.elements.js";import{useStore as P}from"../../hooks/use-store.js";import{getOperation as x}from"./get-operation/index.js";import{getMockServerDocsConfig as R}from"../../../../openapi-docs/template/mock-server-config.js";const L=y=>{const{descriptionFile:n,operationId:i,pointer:p,exampleKey:d,mimeType:l,requestBody:a,parameters:S,options:m,environment:t,environments:s,hideOtherSecuritySchemes:O}=y,h=b(),{store:e,error:v,baseSlug:u}=P(n),c=o.useMemo(()=>({...e?.options,...m}),[m,e?.options]),f=o.useMemo(()=>{const{mockServer:C,...g}=c;return g},[c]),r=o.useMemo(()=>{if(e)return x(e,{operationId:i,pointer:p},f,{exampleKey:d,mimeType:l,environments:s,environment:t,requestBody:a})},[d,f,l,i,p,e,s,t,a]);return e?r?o.createElement(I,{"data-testid":"replay-openapi"},o.createElement(M,{key:`${h.pathname}-${n}-${i||p}`,options:{...m,disableRouter:!0,routingBasePath:u,mockServer:R(c.mockServer,u)},definition:e.definition,withState:{environments:s,allowedEnvironments:t?[t]:void 0,operation:{pointer:r.pointer,state:{requestValues:{body:a,...S}}}}},o.createElement(E,{activeOperationId:r.operationId||"",fullOpenApi:e.definition,corsProxyUrl:e.options.corsProxyUrl,pointer:r.pointer,hideOtherSecuritySchemes:O}))):o.createElement(k,{type:"danger"},"Cannot find OpenAPI operation by operationId or pointer in ",n):o.createElement(A,null,v)};export{L as ReplayOpenApi};
@@ -1,2 +0,0 @@
1
- import{isPrimitive as n}from"../../../../../utils/guards/is-primitive.js";import{getNodeAttribute as o}from"./get-node-attribute.js";import{getVariable as p}from"./get-variable.js";import{isNode as a}from"./guards/is-node.js";import{isTag as l}from"./guards/is-tag.js";import{isCodeNode as c}from"./guards/is-code-node.js";import{isConditionalNode as d}from"./guards/is-conditional-node.js";import{isExampleNode as u}from"./guards/is-example-node.js";import{isFenceNode as h}from"./guards/is-fence-node.js";import{isTextNode as N}from"./guards/is-text-node.js";import{isFunction as b}from"./guards/is-function.js";import{isVariable as g}from"./guards/is-variable.js";function t(m,r={}){const{isTrim:s=!0}=r,i=[];for(const e of m){if(n(e))i.push(String(e));else if(a(e))if(e.type==="tr"&&i.push(`
2
- `),N(e)||c(e)||h(e))i.push(t([o(e,"content")],r));else if(u(e))i.push(t(e.children.map(f=>o(f,"content")),r));else{if(d(e)&&r.skipConditionals)continue;i.push(t(e.children,r))}else l(e)&&e.name==="code"?i.push(t(e.children,r)):b(e)&&i.push(t(Object.values(e.parameters),r));g(e)&&i.push(t([p(e,r.variables)],r))}return s?i.map(e=>e.trim()).join(" ").trim():i.join(" ")}export{t as getInnerText};
@@ -1 +0,0 @@
1
- import{readEnvVariable as a}from"../../../../utils/envs/read-env-variable.js";import{getValueDeep as i}from"../../../../../utils/object/get-value-deep.js";function u(t,r){if(t?.path?.[0]==="env")return a(t.path[1])??"";const{value:e}=i(r,t.path);return e??""}export{u as getVariable};
@@ -1 +0,0 @@
1
- import{usePageSharedData as t}from"../../../../../client/providers/page-data/hooks";function n(r){const e=t(r||"");return e?{store:e,error:null,baseSlug:e.baseSlug}:{store:void 0,error:"Incorrect OpenAPI file path"}}export{n as useStore};
@@ -1 +0,0 @@
1
- import a from"@markdoc/markdoc";import{isPrimitive as m}from"../../../../../../utils/guards/is-primitive.js";import{isStringNode as s}from"../../helpers/guards/is-string-node.js";import{isTag as u}from"../../helpers/guards/is-tag.js";const g=a.nodes.fence,w={...g,attributes:{...g.attributes,label:{type:String,render:"data-label"},title:{type:String,render:"data-title"},highlight:{type:String,render:"data-highlight"}},transform(r,i){const e=r.transformAttributes(i);let t=r.transformChildren(i);const o=e["data-language"],l=e["data-title"];switch(r.attributes.process===!1&&(t=[r.attributes.content]),o){case"mermaid":return s(t[0])?new a.Tag("Mermaid",{...e,diagramSource:t[0]},t):new a.Tag(r.tag,e,t);default:const c=t.map(n=>m(n)?n.toString():u(n)?n?.attributes?.rawtag:"").join("");return s(t[0])?new a.Tag("CodeBlock",{...e,header:{title:l,controls:{copy:{}}},source:c,lang:o},[]):new a.Tag(r.tag,e,t)}}};export{w as fence};
@@ -1 +0,0 @@
1
- import s from"@markdoc/markdoc";import{getInnerText as l}from"../helpers/get-inner-text.js";import{slugger as a}from"../../../../utils/slugger.js";const d={children:["inline"],attributes:{id:{type:String},level:{type:Number,required:!0,default:1},__idx:{type:Number}},transform(e,r){const t=e.transformAttributes(r),i=e.transformChildren(r),n=typeof t.id=="string"?t.id:a.slug(l(i),{replaceDots:!0,replaceSlashes:!0});return new s.Tag("Heading",{...t,id:n,level:e.attributes.level},i)}};export{d as heading};
@@ -1,3 +0,0 @@
1
- import type { CustomMarkdocTag } from '../../../../types';
2
- export declare const jsonExample: CustomMarkdocTag;
3
- //# sourceMappingURL=json-example.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { CustomMarkdocTag } from '../../../../types';
2
- export declare const jsonSchema: CustomMarkdocTag;
3
- //# sourceMappingURL=json-schema.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { CustomMarkdocTag } from '../../../../types';
2
- export declare const openApiCodeSample: CustomMarkdocTag;
3
- //# sourceMappingURL=openapi-code-sample.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { CustomMarkdocTag } from '../../../../types';
2
- export declare const openApiExample: CustomMarkdocTag;
3
- //# sourceMappingURL=openapi-example.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { CustomMarkdocTag } from '../../../../types';
2
- export declare const openApiResponseSample: CustomMarkdocTag;
3
- //# sourceMappingURL=openapi-response-sample.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { CustomMarkdocTag } from '../../../../types';
2
- export declare const replayOpenApi: CustomMarkdocTag;
3
- //# sourceMappingURL=replay-openapi.d.ts.map
@@ -1,5 +0,0 @@
1
- import{useMemo as u}from"react";import{components as f}from"@redocly-markdoc/components";import{Ast as g}from"@markdoc/markdoc";import{PageNavigation as d}from"@redocly/theme/components/PageNavigation/PageNavigation";import{tags as _,components as h}from"@redocly/theme/markdoc/default";import{Breadcrumbs as y}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{withPathPrefix as c}from"@redocly/theme/core/utils";import{OPENAPI_DOCS_TEMPLATE_ID as P,ServerRoutes as m}from"../../../../constants/common.js";import{isBrowser as w}from"../../../../utils/env/is-browser.js";import*as S from"../../markdown/markdoc/custom-components/index.js";import*as O from"../../markdown/markdoc/nodes/index.js";import v from"../../markdown/markdoc/tags/index.js";import{usePageData as C,useSidebarSiblingsData as x}from"../../../../client/providers/page-data/hooks";import{telemetry as A}from"../../../../client/app/telemetry/index.js";import{getMockServerDocsConfig as E}from"./mock-server-config";function V(o="",r="",t="/"){return o.endsWith(t)&&(o=o.slice(0,-t.length)),r.startsWith(t)&&(r=r.slice(t.length)),!o||!r?o+r:o+t+r}function R(o){if(o)return Object.entries(o).reduce((r,[t,n])=>(r[t]=g.fromJSON(JSON.stringify(n)),r),{})}function Y(o,{markdown:r,baseSlug:t}){return u(()=>{const i=w();if(o.options.oAuth2RedirectURI=i?`${window.location.origin}${c(m.REPLAY_OAUTH2_CALLBACK)}`:null,o.options.routingBasePath=c(t),o.options.mockServer=E(o.options.mockServer,t),!o.options.corsProxyUrl){const e=c(`${m.CORS_PROXY}/`);o.options.corsProxyUrl=i?new URL(e,window.location.origin).toString():e}o.options.scrollYOffset=i?parseInt(getComputedStyle(document.documentElement).getPropertyValue("--navbar-height"),10):0,o.options.markdocOptions={tags:{...v,..._},nodes:{...O},components:{...S,...h,...f,...globalThis.__LOADER.markdocComponents},...r,partials:R(r?.partials)},o.options.unstable_hooks={...o.options.unstable_hooks,MiddlePanelFooter:()=>{const{templateId:e}=C()||{},{nextPage:s,prevPage:a}=x()||{};return e===P?null:d({nextPage:s,prevPage:a})},MiddlePanelHeader:()=>y({})};const l={codeSamplesLanguageSwitch:"samples_language_switch",codeSamplesCopy:"code_samples_copy",panelToggle:"panel_toggle",targetServerSwitch:"target_server_switch",tryItOpen:"try_it_toggle",tryItSent:"try_it_sent"},p={};for(const[e,s]of Object.entries(l)){const a=T(o.options.events?.[e]);p[e]=b(a,s)}return o.options.events=p,o},[o,r,t])}function T(o){if(typeof window>"u")return null;if(typeof o=="function")return o;if(typeof o!="string")return null;try{const r=o.trim();if(!r.match(/^(\([^)]*\)\s*=>\s*.+|[a-zA-Z_$][\w$]*\s*=>\s*.+)$/))throw new Error("Invalid function format. Only arrow functions allowed.");if(["eval","Function","constructor","prototype","__proto__","import","require","process","global","window","document"].some(i=>r.includes(i)))throw new Error("Function contains prohibited keywords");return new Function("event",`
2
- 'use strict';
3
- const userFn = ${r};
4
- return userFn(event);
5
- `)}catch(r){return console.error("Function parsing error:",r),null}}function b(o,r){return t=>{if(o)try{o(t)}catch(n){console.error("User event handler error:",n)}if(r)try{A.sendOpenapiDocsMessage([{object:"openapi_docs",eventType:r,operationHttpVerb:t.operationHttpVerb,operationPath:t.operationPath,lang:"lang"in t?t.lang:void 0,action:t.action,state:"state"in t?t.state:void 0,serverUrl:"serverUrl"in t?t.serverUrl:void 0}])}catch{}}}export{V as joinWithSeparator,b as mergeEvents,R as parsePartials,T as safeParseFunction,Y as usePatchedStore};
File without changes