@redocly/redoc-reef 0.138.0-next.9 → 0.139.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/CHANGELOG.md +346 -0
  2. package/dist/api-schemas/mcp-fetch-count.d.ts +24 -0
  3. package/dist/api-schemas/mcp-fetch-count.js +1 -0
  4. package/dist/bin.js +0 -0
  5. package/dist/cli/build/analytics/collect-analytics.js +1 -1
  6. package/dist/cli/build/analytics/collectors/get-processed-config-stats-usage.js +1 -1
  7. package/dist/cli/build/index.js +1 -1
  8. package/dist/cli/develop.js +1 -1
  9. package/dist/cli/eject/ejectTheme.js +1 -1
  10. package/dist/cli/translations/collect-config-translations.js +1 -1
  11. package/dist/client/App.js +1 -1
  12. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -1
  13. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
  14. package/dist/client/app/pages/Invite/Invite.js +1 -1
  15. package/dist/client/app/utils/loadAndNavigate.js +1 -1
  16. package/dist/client/polyfills.js +1 -1
  17. package/dist/client/runtime/loader.js +1 -1
  18. package/dist/client/templates/api-docs/template.js +1 -1
  19. package/dist/client/utils/catalog/parse-filter-query.js +1 -1
  20. package/dist/compiled/svgo/svgo-node.js +39 -39
  21. package/dist/constants/api.d.ts +1 -0
  22. package/dist/constants/api.js +1 -1
  23. package/dist/constants/common.d.ts +6 -0
  24. package/dist/constants/common.js +1 -1
  25. package/dist/constants/l10n/langs/ar.js +1 -1
  26. package/dist/constants/l10n/langs/de.js +1 -1
  27. package/dist/constants/l10n/langs/en.js +1 -1
  28. package/dist/constants/l10n/langs/es.js +1 -1
  29. package/dist/constants/l10n/langs/fr.js +1 -1
  30. package/dist/constants/l10n/langs/hi.js +1 -1
  31. package/dist/constants/l10n/langs/it.js +1 -1
  32. package/dist/constants/l10n/langs/ja.js +1 -1
  33. package/dist/constants/l10n/langs/ko.js +1 -1
  34. package/dist/constants/l10n/langs/pl.js +1 -1
  35. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  36. package/dist/constants/l10n/langs/pt.js +1 -1
  37. package/dist/constants/l10n/langs/ru.js +1 -1
  38. package/dist/constants/l10n/langs/uk.js +1 -1
  39. package/dist/constants/l10n/langs/zh.js +1 -1
  40. package/dist/markdoc/helpers/get-inner-text.js +2 -2
  41. package/dist/markdoc/helpers/guards/is-prompt-node.d.ts +13 -0
  42. package/dist/markdoc/helpers/guards/is-prompt-node.js +1 -0
  43. package/dist/server/config/env-config.d.ts +0 -2
  44. package/dist/server/config/env-schema.d.ts +0 -5
  45. package/dist/server/config/env-schemas/feature-flags.d.ts +0 -4
  46. package/dist/server/config/env-schemas/feature-flags.js +1 -1
  47. package/dist/server/constants/entitlements.js +1 -1
  48. package/dist/server/entitlements/entitlements-provider.js +1 -1
  49. package/dist/server/esbuild/esbuild.js +3 -3
  50. package/dist/server/esbuild/plugins/on-rebuild.js +1 -1
  51. package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
  52. package/dist/server/esbuild/plugins/yaml-loader.js +1 -1
  53. package/dist/server/fs/content-fs.js +1 -1
  54. package/dist/server/fs/utils/is-l10n-root-file.d.ts +3 -0
  55. package/dist/server/fs/utils/is-l10n-root-file.js +1 -0
  56. package/dist/server/plugins/analytics/amplitude/index.js +1 -1
  57. package/dist/server/plugins/analytics/heap/browser-hooks.js +1 -1
  58. package/dist/server/plugins/api-docs/index.js +1 -1
  59. package/dist/server/plugins/api-docs/loader.js +3 -3
  60. package/dist/server/plugins/api-docs/search/create-indexer.d.ts +9 -2
  61. package/dist/server/plugins/api-docs/search/create-indexer.js +1 -1
  62. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +68 -68
  63. package/dist/server/plugins/api-docs/search/search-resolver.js +1 -1
  64. package/dist/server/plugins/api-docs/spec-download.api.js +1 -1
  65. package/dist/server/plugins/api-docs/utils/apply-nav-item-to-root.js +1 -1
  66. package/dist/server/plugins/api-docs/utils/decorators.d.ts +11 -0
  67. package/dist/server/plugins/api-docs/utils/decorators.js +1 -1
  68. package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.js +2 -2
  69. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  70. package/dist/server/plugins/catalog-entities/utils/extract-parts-from-channels-message-ref.js +1 -1
  71. package/dist/server/plugins/config-parser/format-custom-tags.js +1 -1
  72. package/dist/server/plugins/config-parser/loaders/content-slugs-loader.js +1 -1
  73. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  74. package/dist/server/plugins/config-parser/loaders/versions-config-loader.js +1 -1
  75. package/dist/server/plugins/config-parser/resolve-mutual-exclusion.js +1 -1
  76. package/dist/server/plugins/config-parser/safe-parse.js +1 -1
  77. package/dist/server/plugins/default-theme/resolve-logo.js +1 -1
  78. package/dist/server/plugins/dev-onboarding/api/adapters/apigee/adapter.js +2 -2
  79. package/dist/server/plugins/dev-onboarding/api/adapters/gravitee/client.js +2 -2
  80. package/dist/server/plugins/dev-onboarding/api/combine.js +1 -1
  81. package/dist/server/plugins/dev-onboarding/template/components/AppOverview.js +1 -1
  82. package/dist/server/plugins/dev-onboarding/template/components/useSortableData.js +1 -1
  83. package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/file-chunk-parser.d.ts +1 -1
  84. package/dist/server/plugins/markdown/attribute-resolvers/index.js +1 -1
  85. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  86. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
  87. package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.d.ts +4 -0
  88. package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.js +2 -0
  89. package/dist/server/plugins/markdown/compiler.js +1 -1
  90. package/dist/server/plugins/markdown/create-source-lines-reader.d.ts +7 -0
  91. package/dist/server/plugins/markdown/create-source-lines-reader.js +1 -0
  92. package/dist/server/plugins/markdown/html/normalize-html-headings.d.ts +9 -0
  93. package/dist/server/plugins/markdown/html/normalize-html-headings.js +1 -0
  94. package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
  95. package/dist/server/plugins/markdown/markdoc/plugins/utils.d.ts +1 -1
  96. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  97. package/dist/server/plugins/markdown/markdown-static-data-loader.js +1 -1
  98. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  99. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  100. package/dist/server/plugins/markdown/search/to-markdown.js +13 -13
  101. package/dist/server/plugins/markdown/search/walk-sections.d.ts +3 -1
  102. package/dist/server/plugins/markdown/search/walk-sections.js +3 -3
  103. package/dist/server/plugins/markdown/utils/sanitize-malformed-md-content.js +2 -2
  104. package/dist/server/plugins/mcp/audit/audit-log.d.ts +1 -1
  105. package/dist/server/plugins/mcp/audit/audit-log.js +1 -1
  106. package/dist/server/plugins/mcp/audit/code-credentials.d.ts +9 -0
  107. package/dist/server/plugins/mcp/audit/code-credentials.js +2 -0
  108. package/dist/server/plugins/mcp/codemode/capabilities/fetch/index.js +5 -5
  109. package/dist/server/plugins/mcp/codemode/capabilities/types.d.ts +3 -1
  110. package/dist/server/plugins/mcp/codemode/capabilities/utils.d.ts +2 -1
  111. package/dist/server/plugins/mcp/codemode/capabilities/utils.js +4 -4
  112. package/dist/server/plugins/mcp/codemode/code-audit.d.ts +4 -3
  113. package/dist/server/plugins/mcp/codemode/code-execution-audit.js +1 -1
  114. package/dist/server/plugins/mcp/codemode/constants.js +1 -1
  115. package/dist/server/plugins/mcp/codemode/prompts.d.ts +2 -1
  116. package/dist/server/plugins/mcp/codemode/prompts.js +8 -8
  117. package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +2 -2
  118. package/dist/server/plugins/mcp/codemode/tools/execute-schema.d.ts +2 -0
  119. package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -1
  120. package/dist/server/plugins/mcp/constants.d.ts +2 -0
  121. package/dist/server/plugins/mcp/constants.js +1 -1
  122. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  123. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -1
  124. package/dist/server/plugins/mcp/docs-mcp/tools/core/submit-feedback.js +2 -2
  125. package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.js +1 -1
  126. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
  127. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.d.ts +12 -3
  128. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.js +1 -1
  129. package/dist/server/plugins/mcp/docs-mcp/utils/resolve-refs.d.ts +2 -2
  130. package/dist/server/plugins/mcp/docs-mcp/utils/resolve-refs.js +1 -1
  131. package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.d.ts +11 -0
  132. package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.js +1 -0
  133. package/dist/server/plugins/mcp/gateway-mcp/api-call-operations.d.ts +32 -0
  134. package/dist/server/plugins/mcp/gateway-mcp/api-call-operations.js +1 -0
  135. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.d.ts +8 -4
  136. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.js +1 -1
  137. package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.d.ts +9 -0
  138. package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.js +1 -0
  139. package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +1 -0
  140. package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +5 -5
  141. package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +8 -4
  142. package/dist/server/plugins/mcp/gateway-mcp/eligibility.js +1 -1
  143. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-audit.d.ts +2 -1
  144. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-audit.js +1 -1
  145. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.d.ts +11 -1
  146. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.js +1 -1
  147. package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.d.ts +11 -0
  148. package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.js +1 -1
  149. package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.js +1 -1
  150. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-client.d.ts +4 -0
  151. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-client.js +1 -0
  152. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-secret.d.ts +4 -0
  153. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-secret.js +1 -0
  154. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count.d.ts +11 -0
  155. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count.js +1 -0
  156. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-counter-repository.d.ts +13 -0
  157. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-counter-repository.js +13 -0
  158. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{limits.d.ts → fetch-limiter/fetch-limits.d.ts} +1 -1
  159. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-limits.js +1 -0
  160. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{apply-edge-rate-limit.d.ts → request-limiter/apply-edge-rate-limit.d.ts} +1 -1
  161. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/apply-edge-rate-limit.js +1 -0
  162. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{edge-limiter.d.ts → request-limiter/edge-limiter.d.ts} +3 -3
  163. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/edge-limiter.js +1 -0
  164. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/rate-limit-telemetry.js +1 -0
  165. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/request-limits.d.ts +6 -0
  166. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/request-limits.js +1 -0
  167. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/utils/ip-key.js +1 -0
  168. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{window-counter.d.ts → utils/window-counter.d.ts} +1 -1
  169. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/utils/window-counter.js +1 -0
  170. package/dist/server/plugins/mcp/gateway-mcp/route-pattern.d.ts +18 -0
  171. package/dist/server/plugins/mcp/gateway-mcp/route-pattern.js +1 -0
  172. package/dist/server/plugins/mcp/gateway-mcp/secret-store.d.ts +9 -3
  173. package/dist/server/plugins/mcp/gateway-mcp/secret-store.js +1 -1
  174. package/dist/server/plugins/mcp/gateway-mcp/subject.js +1 -1
  175. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.d.ts +2 -0
  176. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.js +2 -2
  177. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.d.ts +0 -2
  178. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.js +1 -1
  179. package/dist/server/plugins/mcp/handlers/credentials-page/constants.d.ts +7 -0
  180. package/dist/server/plugins/mcp/handlers/credentials-page/constants.js +1 -0
  181. package/dist/server/plugins/mcp/handlers/credentials-page/form-contract.d.ts +5 -0
  182. package/dist/server/plugins/mcp/handlers/credentials-page/form-contract.js +1 -0
  183. package/dist/server/plugins/mcp/handlers/credentials-page/form-page.d.ts +14 -0
  184. package/dist/server/plugins/mcp/handlers/credentials-page/form-page.js +62 -0
  185. package/dist/server/plugins/mcp/handlers/credentials-page/layout.d.ts +17 -0
  186. package/dist/server/plugins/mcp/handlers/credentials-page/layout.js +11 -0
  187. package/dist/server/plugins/mcp/handlers/credentials-page/outcome-pages.d.ts +10 -0
  188. package/dist/server/plugins/mcp/handlers/credentials-page/outcome-pages.js +11 -0
  189. package/dist/server/plugins/mcp/handlers/credentials-page/site-branding.d.ts +10 -0
  190. package/dist/server/plugins/mcp/handlers/credentials-page/site-branding.js +1 -0
  191. package/dist/server/plugins/mcp/handlers/credentials-page/styles.d.ts +4 -0
  192. package/dist/server/plugins/mcp/handlers/credentials-page/styles.js +186 -0
  193. package/dist/server/plugins/mcp/handlers/credentials-page/types.d.ts +32 -0
  194. package/dist/server/plugins/mcp/handlers/credentials-page/types.js +0 -0
  195. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  196. package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
  197. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.d.ts +0 -1
  198. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +1 -1
  199. package/dist/server/plugins/mcp/index.js +1 -1
  200. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  201. package/dist/server/plugins/mcp/servers/mcp-server.js +2 -2
  202. package/dist/server/plugins/mcp/types.d.ts +16 -1
  203. package/dist/server/plugins/mcp/utils/docs-site-url.d.ts +6 -0
  204. package/dist/server/plugins/mcp/utils/docs-site-url.js +1 -0
  205. package/dist/server/plugins/mcp/utils/mode.d.ts +4 -1
  206. package/dist/server/plugins/mcp/utils/mode.js +1 -1
  207. package/dist/server/plugins/mcp/utils/xmcp-utils.d.ts +3 -5
  208. package/dist/server/plugins/mcp/utils/xmcp-utils.js +1 -1
  209. package/dist/server/plugins/nav-utils.js +1 -1
  210. package/dist/server/plugins/scorecard-classic/loaders/scorecard.js +1 -1
  211. package/dist/server/plugins/scorecard-classic/template/components.js +1 -1
  212. package/dist/server/plugins/scorecard-classic/template/useData.js +1 -1
  213. package/dist/server/plugins/search/engines/flexsearch/index.js +2 -2
  214. package/dist/server/plugins/sidebars/index.js +2 -2
  215. package/dist/server/plugins/sidebars/utils.js +1 -1
  216. package/dist/server/providers/database/client.d.ts +5 -0
  217. package/dist/server/providers/database/client.js +1 -1
  218. package/dist/server/providers/database/copy-migrations.js +1 -1
  219. package/dist/server/providers/database/database-connections-manager.js +1 -1
  220. package/dist/server/providers/database/has-project-database.d.ts +3 -0
  221. package/dist/server/providers/database/has-project-database.js +1 -0
  222. package/dist/server/store.d.ts +2 -0
  223. package/dist/server/store.js +1 -1
  224. package/dist/server/tools/notifiers/formatter.js +1 -1
  225. package/dist/server/tools/notifiers/helpers/privacy/mask-email.js +1 -1
  226. package/dist/server/tools/notifiers/logger.js +1 -1
  227. package/dist/server/types/plugins/markdown.d.ts +2 -0
  228. package/dist/server/types/web-server.d.ts +1 -0
  229. package/dist/server/utils/codeframes/codeframes.js +2 -2
  230. package/dist/server/utils/entitlements/read-entitlement-number.d.ts +3 -0
  231. package/dist/server/utils/entitlements/read-entitlement-number.js +1 -0
  232. package/dist/server/utils/fs.js +1 -1
  233. package/dist/server/utils/is-api-download-link.d.ts +1 -0
  234. package/dist/server/utils/is-api-download-link.js +1 -1
  235. package/dist/server/utils/rbac.js +1 -1
  236. package/dist/server/utils/redact-url.d.ts +3 -2
  237. package/dist/server/utils/redact-url.js +1 -1
  238. package/dist/server/utils/sandbox-context.d.ts +7 -4
  239. package/dist/server/utils/sandbox-context.js +1 -1
  240. package/dist/server/web-server/auth.d.ts +0 -1
  241. package/dist/server/web-server/auth.js +4 -4
  242. package/dist/server/web-server/dev-server.js +1 -1
  243. package/dist/server/web-server/http.d.ts +2 -1
  244. package/dist/server/web-server/http.js +2 -2
  245. package/dist/server/web-server/jwt/token-types.d.ts +1 -0
  246. package/dist/server/web-server/jwt/token-types.js +1 -1
  247. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  248. package/dist/server/web-server/middleware/dynamic-middleware/hono-compose.js +1 -1
  249. package/dist/server/web-server/middleware/responseHeadersMiddleware.js +1 -1
  250. package/dist/server/web-server/routes/auth.d.ts +1 -1
  251. package/dist/server/web-server/routes/auth.js +1 -1
  252. package/dist/server/web-server/routes/catalog/helpers/create-entity-schema.d.ts +1756 -1756
  253. package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.d.ts +295 -295
  254. package/dist/server/web-server/routes/cors-proxy.js +2 -2
  255. package/dist/server/web-server/routes/index.js +1 -1
  256. package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.d.ts +24 -0
  257. package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.js +35 -0
  258. package/dist/server/web-server/routes/mcp-routes/mcp-fetch-count.d.ts +8 -0
  259. package/dist/server/web-server/routes/mcp-routes/mcp-fetch-count.js +1 -0
  260. package/dist/server/web-server/routes/mcp-routes/mcp-oauth-store.d.ts +15 -0
  261. package/dist/server/web-server/routes/mcp-routes/mcp-oauth-store.js +1 -0
  262. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.d.ts +3 -1
  263. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
  264. package/dist/server/web-server/routes/mcp-routes/mcp-routes.js +1 -1
  265. package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
  266. package/dist/server/web-server/routes/resolve-route.js +1 -1
  267. package/dist/server/workers/worker-pool.js +1 -1
  268. package/dist/types/entitlements.d.ts +2 -0
  269. package/dist/utils/time/debounce.js +1 -1
  270. package/package.json +10 -11
  271. package/dist/client/app/utils/withLoadProgress.d.ts +0 -2
  272. package/dist/client/app/utils/withLoadProgress.js +0 -1
  273. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/apply-edge-rate-limit.js +0 -1
  274. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/edge-limiter.js +0 -1
  275. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/ip-key.js +0 -1
  276. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/limits.js +0 -1
  277. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/rate-limit-telemetry.js +0 -1
  278. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/window-counter.js +0 -1
  279. package/dist/server/plugins/mcp/handlers/mcp-credentials-page.d.ts +0 -12
  280. package/dist/server/plugins/mcp/handlers/mcp-credentials-page.js +0 -225
  281. /package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{rate-limit-telemetry.d.ts → request-limiter/rate-limit-telemetry.d.ts} +0 -0
  282. /package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{ip-key.d.ts → utils/ip-key.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ import{PROMPT_TAG as r}from"@redocly/theme/core/constants";import{isNode as t}from"./is-node.js";function p(o){return t(o)&&o.tag===r}export{p as isPromptNode};
@@ -52,7 +52,6 @@ declare function loadEnvConfig(): {
52
52
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
53
53
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
54
54
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
55
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
56
55
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
57
56
  SEARCH_DEV_REINIT?: string | undefined;
58
57
  SEARCH_DEV_DEBUG: boolean;
@@ -134,7 +133,6 @@ export declare const envConfig: {
134
133
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
135
134
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
136
135
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
137
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
138
136
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
139
137
  SEARCH_DEV_REINIT?: string | undefined;
140
138
  SEARCH_DEV_DEBUG: boolean;
@@ -56,7 +56,6 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
56
56
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
57
57
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL: z.ZodOptional<z.ZodString>;
58
58
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
59
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
60
59
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
61
60
  } & {
62
61
  SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
@@ -135,7 +134,6 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
135
134
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
136
135
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
137
136
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
138
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
139
137
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
140
138
  SEARCH_DEV_REINIT?: string | undefined;
141
139
  SEARCH_DEV_DEBUG: boolean;
@@ -207,7 +205,6 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
207
205
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
208
206
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
209
207
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
210
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
211
208
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
212
209
  SEARCH_DEV_REINIT?: string | undefined;
213
210
  SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
@@ -279,7 +276,6 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
279
276
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
280
277
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
281
278
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
282
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
283
279
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
284
280
  SEARCH_DEV_REINIT?: string | undefined;
285
281
  SEARCH_DEV_DEBUG: boolean;
@@ -351,7 +347,6 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
351
347
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
352
348
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
353
349
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
354
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
355
350
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
356
351
  SEARCH_DEV_REINIT?: string | undefined;
357
352
  SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
@@ -15,8 +15,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
15
15
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL: z.ZodOptional<z.ZodString>;
16
16
  /** (Optional) API endpoint for the agent feedback endpoint;**/
17
17
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
18
- /** Escape hatch: disables the Node Permission Model sandbox on API function and MCP tool worker processes (hosted Reunite environments only). */
19
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
20
18
  /** Experimental: enables the GraphQL request body in Try It and embedded Replay. */
21
19
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
22
20
  }, "strip", z.ZodTypeAny, {
@@ -29,7 +27,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
29
27
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
30
28
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
31
29
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
32
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
33
30
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
34
31
  }, {
35
32
  NEW_CATALOG_ENABLED?: "false" | "true" | undefined;
@@ -41,7 +38,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
41
38
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
42
39
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
43
40
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
44
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
45
41
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
46
42
  }>;
47
43
  //# sourceMappingURL=feature-flags.d.ts.map
@@ -1 +1 @@
1
- import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const D=_.object({NEW_CATALOG_ENABLED:E(),NEW_SCORECARDS_ENABLED:E(),ENABLE_COMMENTS:_.string().optional(),REDOCLY_EXP_DISABLE_MD_VALIDATION:E(),ENABLE_SOURCE_MAPS:E(),PLAN_GATES:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED:E(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT:_.string().optional(),REDOCLY_DISABLE_API_FUNCTION_SANDBOX:E(),REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED:E()});export{D as featureFlagsSchema};
1
+ import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const o=_.object({NEW_CATALOG_ENABLED:E(),NEW_SCORECARDS_ENABLED:E(),ENABLE_COMMENTS:_.string().optional(),REDOCLY_EXP_DISABLE_MD_VALIDATION:E(),ENABLE_SOURCE_MAPS:E(),PLAN_GATES:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED:E(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT:_.string().optional(),REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED:E()});export{o as featureFlagsSchema};
@@ -1 +1 @@
1
- import{GATEWAY_FETCH_LIMIT_DEFAULTS as e}from"../../constants/common.js";const a={pro:{rbac:!1,sso:!1,cookieConsent:!1,analytics:!0,removeAttribution:!1,advancedSearch:!1,ssoDirect:!1,aiSearchLimit:0,kvStorageLimit:.5,mcp:!1,mcpGateway:!1,mcpMode:"tools",gatewayFetchRatePerMin:e.ratePerMin,gatewayFetchQuotaPerDay:e.quotaPerDay,gatewayFetchBudgetPerExec:e.budgetPerExec},enterprise:{rbac:!0,sso:!0,cookieConsent:!0,analytics:!0,removeAttribution:!0,advancedSearch:!0,ssoDirect:!1,aiSearchLimit:750,kvStorageLimit:5,mcp:!0,mcpGateway:!0,mcpMode:"code",gatewayFetchRatePerMin:e.ratePerMin,gatewayFetchQuotaPerDay:e.quotaPerDay,gatewayFetchBudgetPerExec:e.budgetPerExec}},r=["@redocly/portal-plugin-async-api/plugin.js","@redocly/portal-plugin-mock-server/plugin.js","@redocly/portal-plugin-soap-api/plugin.js"],o={"code-walkthrough":"codeWalkthrough",step:"codeWalkthrough",toggle:"codeWalkthrough",input:"codeWalkthrough"};export{o as GATED_MARKDOC_TAGS,r as GATED_PLUGINS,a as PLAN_GATES_DEFAULTS};
1
+ import{GATEWAY_FETCH_LIMIT_DEFAULTS as e,MCP_REQUEST_LIMIT_DEFAULTS as t}from"../../constants/common.js";const r={pro:{rbac:!1,sso:!1,cookieConsent:!1,analytics:!0,removeAttribution:!1,advancedSearch:!1,ssoDirect:!1,aiSearchLimit:0,kvStorageLimit:.5,mcp:!1,mcpGateway:!1,mcpMode:"tools",gatewayFetchRatePerMin:e.ratePerMin,gatewayFetchQuotaPerDay:e.quotaPerDay,gatewayFetchBudgetPerExec:e.budgetPerExec,mcpRequestRatePerMin:t.ratePerMin,mcpRequestQuotaPerDay:t.quotaPerDay},enterprise:{rbac:!0,sso:!0,cookieConsent:!0,analytics:!0,removeAttribution:!0,advancedSearch:!0,ssoDirect:!1,aiSearchLimit:750,kvStorageLimit:5,mcp:!0,mcpGateway:!0,mcpMode:"code",gatewayFetchRatePerMin:e.ratePerMin,gatewayFetchQuotaPerDay:e.quotaPerDay,gatewayFetchBudgetPerExec:e.budgetPerExec,mcpRequestRatePerMin:t.ratePerMin,mcpRequestQuotaPerDay:t.quotaPerDay}},o=["@redocly/portal-plugin-async-api/plugin.js","@redocly/portal-plugin-mock-server/plugin.js","@redocly/portal-plugin-soap-api/plugin.js"],c={"code-walkthrough":"codeWalkthrough",step:"codeWalkthrough",toggle:"codeWalkthrough",input:"codeWalkthrough"};export{c as GATED_MARKDOC_TAGS,o as GATED_PLUGINS,r as PLAN_GATES_DEFAULTS};
@@ -1 +1 @@
1
- import{ENTITLEMENTS_JWKS_URL as o}from"../constants/common.js";import{PLAN_GATES_DEFAULTS as c}from"../constants/entitlements.js";import{envConfig as s}from"../config/env-config.js";import{logger as a}from"../tools/notifiers/logger.js";import{reporter as l}from"../tools/notifiers/reporter.js";import{PRODUCT_GATES as m}from"../../config/product-gates.js";import{EJECT_IGNORE_CONFIG as p}from"../../config/eject-ignore.js";import*as i from"../web-server/jwt/jwt.js";import{AlgorithmTypes as f}from"../web-server/jwt/types.js";class r{static#e;#a=null;#t={};constructor(){}static instance(){return r.#e||(r.#e=new r),r.#e}get entitlements(){return this.#a}async init(t={}){this.#t=t;try{await this.#i()}catch(e){a.warn("Failed to process entitlements information: "+e.message),a.verbose(e.message)}}canAccessFeature=t=>t?this.entitlements&&!!this.entitlements[t]:!0;async getPackageEjectIgnore(){let t=[];for(const[e,n]of Object.entries(p))this.canAccessFeature(e)&&(t=[...t,...n]);return t}#n(){return s.PLAN_GATES||""}async#r(){let t;try{t=await fetch(o).then(e=>e.json())}catch(e){return a.warn("Failed to get JWKS information: "+e.message),!1}try{const e=t.keys&&t.keys.length>0?t.keys[0]:null,n=this.#n();return e&&n?await i.verify(n,e,f.RS256,this.#t.ignoreTokenExpiration):!1}catch(e){return a.warn("Failed to verify plan gates token: "+e.message),!1}}async#s(){if(await this.#r()){const{payload:t}=i.decode(this.#n());if(t){if(!s.REDOCLY_ENV&&t.exp){const e=t.exp*1e3,n=new Date(e);a.info(`Entitlements token expires on ${n.toISOString()} (in ${Math.ceil((e-new Date().getTime())/(1440*60*1e3))} days)`)}return t}}await l.panicOnContentError("Plan gates token is not valid or empty.")}async#i(){const t=this.#t.developModePlan&&!this.#n()?c[this.#t.developModePlan]:await this.#s();this.#a={...m,...t}}}export{r as EntitlementsProvider};
1
+ import{ENTITLEMENTS_JWKS_URL as i}from"../constants/common.js";import{PLAN_GATES_DEFAULTS as c}from"../constants/entitlements.js";import{envConfig as r}from"../config/env-config.js";import{logger as a}from"../tools/notifiers/logger.js";import{reporter as l}from"../tools/notifiers/reporter.js";import{PRODUCT_GATES as p}from"../../config/product-gates.js";import{EJECT_IGNORE_CONFIG as m}from"../../config/eject-ignore.js";import*as o from"../web-server/jwt/jwt.js";import{AlgorithmTypes as f}from"../web-server/jwt/types.js";class s{static#e;#a=null;#t={};constructor(){}static instance(){return s.#e||(s.#e=new s),s.#e}get entitlements(){return this.#a}async init(t={}){this.#t=t;try{await this.#o()}catch(e){a.warn("Failed to process entitlements information: "+e.message),a.verbose(e.message)}}canAccessFeature=t=>t?this.entitlements&&!!this.entitlements[t]:!0;async getPackageEjectIgnore(){const t=[];for(const[e,n]of Object.entries(m))this.canAccessFeature(e)&&t.push(...n);return t}#n(){return r.PLAN_GATES||""}async#s(){let t;try{t=await fetch(i).then(e=>e.json())}catch(e){return a.warn("Failed to get JWKS information: "+e.message),!1}try{const e=t.keys&&t.keys.length>0?t.keys[0]:null,n=this.#n();return e&&n?await o.verify(n,e,f.RS256,this.#t.ignoreTokenExpiration):!1}catch(e){return a.warn("Failed to verify plan gates token: "+e.message),!1}}async#r(){if(await this.#s()){const{payload:t}=o.decode(this.#n());if(t){if(!r.REDOCLY_ENV&&t.exp){const e=t.exp*1e3,n=new Date(e);a.info(`Entitlements token expires on ${n.toISOString()} (in ${Math.ceil((e-new Date().getTime())/(1440*60*1e3))} days)`)}return t}}await l.panicOnContentError("Plan gates token is not valid or empty.")}async#o(){const t=this.#t.developModePlan&&!this.#n()?c[this.#t.developModePlan]:await this.#r();this.#a={...p,...t}}}export{s as EntitlementsProvider};
@@ -1,3 +1,3 @@
1
- import{context as m}from"esbuild";import{mkdirSync as j,writeFileSync as Y,existsSync as b}from"node:fs";import*as l from"node:path";import{RUNTIME_RESOURCES_DIR as M,TELEMETRY_ENABLED as k}from"../constants/common.js";import{fromCurrentDir as r}from"../utils/paths.js";import{NodeBrowserPlugin as C}from"./plugins/node-browser.js";import{PortalImport as a}from"./plugins/portal-import.js";import{ThemesResolver as u}from"./plugins/themes-resolver.js";import{AssetsResolver as E}from"./plugins/assets-resolver.js";import{EsbuildErrorCollector as R}from"./plugins/esbuild-compile-resolver.js";import{ServerPropsResolver as _}from"./plugins/server-props-resolver.js";import{StyledComponentsSSR as d}from"./plugins/styled-components-ssr.js";import{DependencyResolver as v}from"./plugins/dependency-resolver.js";import{YamlLoader as f}from"./plugins/yaml-loader.js";import{ApiRequestHandlersResolver as T}from"./plugins/api-request-handlers-resolver.js";import{McpToolHandlersResolver as P}from"./plugins/mcp-tool-handlers-resolver.js";import{MiddlewareResolver as S}from"./plugins/middleware-resolver.js";import{OnRebuild as D}from"./plugins/on-rebuild.js";import{getPublicEnvVariables as V}from"../utils/envs/get-public-env-variables.js";import{PORTAL_VERSION as A}from"../version.js";import{AsyncApiPatch as L}from"./plugins/async-api-patch.js";import{telemetryTraceStep as I}from"../../cli/telemetry/helpers/trace-step.js";import{initServerRebuildTrigger as $}from"./generate.js";const y={bundle:!0,format:"esm",chunkNames:"chunks/[name]-[hash]"};function N(e){const o=l.join(e,"tsconfig.json");return b(o)?o:void 0}const c=new Set;async function ce(){await Promise.all([...c].map(e=>e.dispose())),c.clear()}async function me(e,o,t="production",n){return await I("com.redocly.build.createClientCompiler",async()=>{const p=V(),i={};Object.entries(p).map(([g,h])=>i[`process.env.${g}`]=JSON.stringify(h));const s=[...n?[D(n)]:[],C({path:"path-browserify",fs:"{}",tty:"tty-browserify",os:"os-browserify",http:"stream-http",https:"stream-http",readline:"{}",crypto:"{}",stream:"{}",zlib:"{}","https-proxy-agent":"{}"}),u(e,e.contentDir),E(e,e.contentDir),R(e,e.contentDir),_(e),v(),a(),f(),L(),d()],w=[r(import.meta.url,"../../client/browser-entry.js"),r(import.meta.url,"../../client/user-tags-entry.js")],O=await m({...y,entryPoints:w,outdir:l.join(o,M),sourcemap:t!=="production"&&process.env.ENABLE_SOURCE_MAPS==="true",plugins:s,tsconfig:N(e.contentDir),mainFields:["browser","module","main"],metafile:t!=="production",minify:t==="production",splitting:!0,external:["constants","zlib","stream","https","vm","module","worker_threads","child_process","@swc/core"],inject:[process.env.INSPECT_MODE==="true"?r(import.meta.url,"../../client/inspect-mode-hooks.js"):"",r(import.meta.url,"./web-shim.js")].filter(Boolean),define:{...i,"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_FIRST_PARTY":'"true"',...process.env.REDOCLY_INTERNAL_DEV!==void 0&&{"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`},"process.env.SERVER_EDITOR_APP_URL":`"${process.env.SERVER_EDITOR_APP_URL}"`,"process.env.ENABLE_COMMENTS":`"${process.env.ENABLE_COMMENTS}"`,"process.env.REDOCLY_TELEMETRY":k?'"on"':'"off"',"process.env.REDOCLY_PORTAL_VERSION":`"${A}"`,"process.env":`{"NODE_ENV": "${t}"}`,"process.platform":'"browser"',"process.browser":"true","module.hot":"false",global:"{}",...process.env.REDOCLY_PREFIX_PATHS&&{"process.env.REDOCLY_PREFIX_PATHS":`"${process.env.REDOCLY_PREFIX_PATHS}"`},...process.env.INSPECT_MODE==="true"&&{"process.env.INSPECT_MODE":`${process.env.INSPECT_MODE}`},...process.env.MAIN_API_URL&&{"process.env.MAIN_API_URL":`"${process.env.MAIN_API_URL}"`}},logLevel:"silent"});return c.add(O),O})}async function le(e,o,t="development",n){j(o,{recursive:!0}),$(o),Y(l.join(o,"package.json"),JSON.stringify({name:"@redocly/portal/server-cache",type:"module"}));const p=[...n?[D(n)]:[],u(e,e.contentDir),E(e,e.contentDir),R(e,e.contentDir),_(e),T(e),P(e),S(e),v(),a(),f(),L(),d()],i=[{in:r(import.meta.url,"../../client/server-entry.js"),out:"server-entry"},{in:r(import.meta.url,"../../client/user-tags-entry.js"),out:"user-tags-entry"},{in:r(import.meta.url,"../../client/server-props-entry.js"),out:"server-props-entry"},{in:r(import.meta.url,"../../client/api-request-handlers-entry.js"),out:"api-request-handlers-entry"},{in:r(import.meta.url,"../../client/api-docs-builder-entry.js"),out:"api-docs-builder-entry"},{in:r(import.meta.url,"../workers/mcp-tool-worker.js"),out:"mcp-tool-worker"},{in:r(import.meta.url,"../../client/mcp-tool-handlers-entry.js"),out:"mcp-tool-handlers-entry"},{in:r(import.meta.url,"../../client/middleware-entry.js"),out:"middleware-entry"}],s=await m({...y,entryPoints:i,outdir:o,plugins:p,sourcemap:t!=="production"&&process.env.ENABLE_SOURCE_MAPS==="true",minify:t==="production",tsconfig:N(e.contentDir),mainFields:["module","main"],splitting:!0,external:["react","react-router","@dr.pogodin/react-helmet","@swc/core","pnpapi","canvas"],banner:{js:`import { createRequire as topLevelCreateRequire } from 'module';
2
- const require = topLevelCreateRequire(import.meta.url);`},platform:"node",define:{"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_FIRST_PARTY":'"true"',...process.env.REDOCLY_INTERNAL_DEV!==void 0&&{"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`},"module.hot":"false"},logLevel:"silent"});return c.add(s),s}async function ae(e,o,t="production",n){return await I("com.redocly.build.createServerCompiler",async()=>{const p=[...n?[D(n)]:[],C({"node-fetch":"{}",webpack:"{}",swagger2openapi:"{}"}),u(e,e.contentDir),E(e,e.contentDir),R(e,e.contentDir),_(e),T(e),P(e),S(e),v(),a(),f(),L(),d()],i=[{in:r(import.meta.url,"../node-bundle-entry.js"),out:"index"},{in:r(import.meta.url,"../../client/user-tags-entry.js"),out:"user-tags-entry"},{in:r(import.meta.url,"../../client/api-docs-builder-entry.js"),out:"api-docs-builder-entry"},{in:r(import.meta.url,"../workers/api-routes-worker.js"),out:"api-routes-worker"},{in:r(import.meta.url,"../workers/scorecards-worker.js"),out:"scorecards-worker"},{in:r(import.meta.url,"../workers/mcp-tool-worker.js"),out:"mcp-tool-worker"}],s=await m({...y,entryPoints:i,outExtension:{".js":".mjs"},outdir:o,platform:"node",plugins:p,tsconfig:N(e.contentDir),mainFields:["module","main"],metafile:t!=="production",minify:t==="production",splitting:!1,define:{"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_FIRST_PARTY":'"true"',...process.env.REDOCLY_INTERNAL_DEV!==void 0&&{"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`},"process.env.REDOCLY_EXECUTION_MODE":'"runtime"',"process.env.REDOCLY_PORTAL_VERSION":`"${A}"`,"module.hot":"false",...process.env.REDOCLY_PREFIX_PATHS&&{"process.env.REDOCLY_PREFIX_PATHS":`"${process.env.REDOCLY_PREFIX_PATHS}"`}},banner:{js:`import { createRequire as topLevelCreateRequire } from 'module';
3
- const require = topLevelCreateRequire(import.meta.url);`},logLevel:"silent"});return c.add(s),s})}export{me as createClientCompiler,ae as createNodeBundleCompiler,le as createServerCompiler,ce as stopAllCompilers};
1
+ import{context as m}from"esbuild";import{mkdirSync as j,writeFileSync as Y,existsSync as b}from"node:fs";import*as l from"node:path";import{RUNTIME_RESOURCES_DIR as M,TELEMETRY_ENABLED as k}from"../constants/common.js";import{fromCurrentDir as r}from"../utils/paths.js";import{NodeBrowserPlugin as C}from"./plugins/node-browser.js";import{PortalImport as a}from"./plugins/portal-import.js";import{ThemesResolver as u}from"./plugins/themes-resolver.js";import{AssetsResolver as E}from"./plugins/assets-resolver.js";import{EsbuildErrorCollector as R}from"./plugins/esbuild-compile-resolver.js";import{ServerPropsResolver as _}from"./plugins/server-props-resolver.js";import{StyledComponentsSSR as d}from"./plugins/styled-components-ssr.js";import{DependencyResolver as v}from"./plugins/dependency-resolver.js";import{YamlLoader as f}from"./plugins/yaml-loader.js";import{ApiRequestHandlersResolver as T}from"./plugins/api-request-handlers-resolver.js";import{McpToolHandlersResolver as P}from"./plugins/mcp-tool-handlers-resolver.js";import{MiddlewareResolver as S}from"./plugins/middleware-resolver.js";import{OnRebuild as D}from"./plugins/on-rebuild.js";import{getPublicEnvVariables as V}from"../utils/envs/get-public-env-variables.js";import{PORTAL_VERSION as A}from"../version.js";import{AsyncApiPatch as L}from"./plugins/async-api-patch.js";import{telemetryTraceStep as I}from"../../cli/telemetry/helpers/trace-step.js";import{initServerRebuildTrigger as $}from"./generate.js";const y={bundle:!0,format:"esm",chunkNames:"chunks/[name]-[hash]"};function N(e){const o=l.join(e,"tsconfig.json");return b(o)?o:void 0}const p=new Set;async function pe(){await Promise.all([...p].map(e=>e.dispose())),p.clear()}async function me(e,o,t="production",n){return await I("com.redocly.build.createClientCompiler",async()=>{const c=V(),i={};Object.entries(c).map(([g,h])=>i[`process.env.${g}`]=JSON.stringify(h));const s=[...n?[D(n)]:[],C({path:"path-browserify",fs:"{}",tty:"tty-browserify",os:"os-browserify",http:"stream-http",https:"stream-http",readline:"{}",crypto:"{}",stream:"{}",zlib:"{}","https-proxy-agent":"{}"}),u(e,e.contentDir),E(e,e.contentDir),R(e,e.contentDir),_(e),v(),a(),f(),L(),d()],w=[r(import.meta.url,"../../client/browser-entry.js"),r(import.meta.url,"../../client/user-tags-entry.js")],O=await m({...y,entryPoints:w,outdir:l.join(o,M),sourcemap:t!=="production"&&process.env.ENABLE_SOURCE_MAPS==="true",plugins:s,tsconfig:N(e.contentDir),mainFields:["browser","module","main"],metafile:t!=="production",minify:t==="production",splitting:!0,external:["constants","zlib","stream","https","vm","module","worker_threads","child_process","@swc/core"],inject:[process.env.INSPECT_MODE==="true"?r(import.meta.url,"../../client/inspect-mode-hooks.js"):"",r(import.meta.url,"./web-shim.js")].filter(Boolean),define:{...i,"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_FIRST_PARTY":'"true"',...process.env.REDOCLY_INTERNAL_DEV!==void 0&&{"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`},"process.env.SERVER_EDITOR_APP_URL":`"${process.env.SERVER_EDITOR_APP_URL}"`,"process.env.ENABLE_COMMENTS":`"${process.env.ENABLE_COMMENTS}"`,"process.env.REDOCLY_TELEMETRY":k?'"on"':'"off"',"process.env.REDOCLY_PORTAL_VERSION":`"${A}"`,"process.env":`{"NODE_ENV": "${t}"}`,"process.platform":'"browser"',"process.browser":"true","module.hot":"false",global:"{}",...process.env.REDOCLY_PREFIX_PATHS&&{"process.env.REDOCLY_PREFIX_PATHS":`"${process.env.REDOCLY_PREFIX_PATHS}"`},...process.env.INSPECT_MODE==="true"&&{"process.env.INSPECT_MODE":`${process.env.INSPECT_MODE}`},...process.env.MAIN_API_URL&&{"process.env.MAIN_API_URL":`"${process.env.MAIN_API_URL}"`}},logLevel:"silent"});return p.add(O),O})}async function le(e,o,t="development",n){j(o,{recursive:!0}),$(o),Y(l.join(o,"package.json"),JSON.stringify({name:"@redocly/portal/server-cache",type:"module"}));const c=[...n?[D(n)]:[],u(e,e.contentDir),E(e,e.contentDir),R(e,e.contentDir),_(e),T(e),P(e),S(e),v(),a(),f(),L(),d()],i=[{in:r(import.meta.url,"../../client/server-entry.js"),out:"server-entry"},{in:r(import.meta.url,"../../client/user-tags-entry.js"),out:"user-tags-entry"},{in:r(import.meta.url,"../../client/server-props-entry.js"),out:"server-props-entry"},{in:r(import.meta.url,"../../client/api-request-handlers-entry.js"),out:"api-request-handlers-entry"},{in:r(import.meta.url,"../../client/api-docs-builder-entry.js"),out:"api-docs-builder-entry"},{in:r(import.meta.url,"../workers/mcp-tool-worker.js"),out:"mcp-tool-worker"},{in:r(import.meta.url,"../../client/mcp-tool-handlers-entry.js"),out:"mcp-tool-handlers-entry"},{in:r(import.meta.url,"../../client/middleware-entry.js"),out:"middleware-entry"}],s=await m({...y,entryPoints:i,outdir:o,plugins:c,sourcemap:t!=="production"&&process.env.ENABLE_SOURCE_MAPS==="true",minify:t==="production",tsconfig:N(e.contentDir),mainFields:["module","main"],splitting:!0,external:["react","react-router","@dr.pogodin/react-helmet","@swc/core","pnpapi","canvas"],banner:{js:`import { createRequire as topLevelCreateRequire } from 'module';
2
+ const require = topLevelCreateRequire(import.meta.url);`},platform:"node",define:{"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_FIRST_PARTY":'"true"',...process.env.REDOCLY_INTERNAL_DEV!==void 0&&{"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`},"module.hot":"false"},logLevel:"silent"});return p.add(s),s}async function ae(e,o,t="production",n){return await I("com.redocly.build.createServerCompiler",async()=>{const c=[...n?[D(n)]:[],C({"node-fetch":"{}",webpack:"{}"}),u(e,e.contentDir),E(e,e.contentDir),R(e,e.contentDir),_(e),T(e),P(e),S(e),v(),a(),f(),L(),d()],i=[{in:r(import.meta.url,"../node-bundle-entry.js"),out:"index"},{in:r(import.meta.url,"../../client/user-tags-entry.js"),out:"user-tags-entry"},{in:r(import.meta.url,"../../client/api-docs-builder-entry.js"),out:"api-docs-builder-entry"},{in:r(import.meta.url,"../workers/api-routes-worker.js"),out:"api-routes-worker"},{in:r(import.meta.url,"../workers/scorecards-worker.js"),out:"scorecards-worker"},{in:r(import.meta.url,"../workers/mcp-tool-worker.js"),out:"mcp-tool-worker"}],s=await m({...y,entryPoints:i,outExtension:{".js":".mjs"},outdir:o,platform:"node",plugins:c,tsconfig:N(e.contentDir),mainFields:["module","main"],metafile:t!=="production",minify:t==="production",splitting:!1,define:{"process.env.NODE_ENV":`"${t}"`,"process.env.REDOCLY_FIRST_PARTY":'"true"',...process.env.REDOCLY_INTERNAL_DEV!==void 0&&{"process.env.REDOCLY_INTERNAL_DEV":`"${process.env.REDOCLY_INTERNAL_DEV}"`},"process.env.REDOCLY_EXECUTION_MODE":'"runtime"',"process.env.REDOCLY_PORTAL_VERSION":`"${A}"`,"module.hot":"false",...process.env.REDOCLY_PREFIX_PATHS&&{"process.env.REDOCLY_PREFIX_PATHS":`"${process.env.REDOCLY_PREFIX_PATHS}"`}},banner:{js:`import { createRequire as topLevelCreateRequire } from 'module';
3
+ const require = topLevelCreateRequire(import.meta.url);`},logLevel:"silent"});return p.add(s),s})}export{me as createClientCompiler,ae as createNodeBundleCompiler,le as createServerCompiler,pe as stopAllCompilers};
@@ -1 +1 @@
1
- const r=new Map,n=e=>({name:"esbuild-on-rebuild",setup:u=>{const{label:t}=e;r.set(t,0);function a(){return r.get(t)===0}u.onStart(()=>a()?e.buildStart():e.rebuildStart()),u.onEnd(async()=>{a()?await e.buildEnd():await e.rebuildEnd();const l=r.get(t);r.set(t,(l||0)+1)})}});export{n as OnRebuild};
1
+ const r=new Map,l=e=>({name:"esbuild-on-rebuild",setup:u=>{const{label:t}=e;r.set(t,0);function n(){return r.get(t)===0}u.onStart(()=>n()?e.buildStart():e.rebuildStart()),u.onEnd(async()=>{n()?await e.buildEnd():await e.rebuildEnd();const a=r.get(t);r.set(t,(a||0)+1)})}});export{l as OnRebuild};
@@ -1 +1 @@
1
- import f from"@babel/core";import h from"node:fs";import r from"node:path";import d from"babel-plugin-styled-components";import u from"crypto";import{envConfig as m}from"../../config/env-config.js";import{babelCache as i}from"../babel-cache.js";const A=()=>({name:"styled-components-ssr",setup:c=>{const l=process.cwd();c.onLoad({filter:/\.[tj]sx?$/},async t=>{if(new RegExp(`${r.sep}replay-[A-Za-z0-9_-]+\\.js$`).test(t.path)||t.path.endsWith(`${r.sep}replay.js`)||t.path.includes(`${r.sep}replay-index-`)&&t.path.endsWith(".js")||t.path.includes(`${r.sep}replay-tauri-path-`)&&t.path.endsWith(".js"))return;let e=t.path.split(".").pop();const s=i.get(t.path);if(s&&t.path.includes("/node_modules/"))return{contents:s.contents,loader:e};let p=["importMeta","topLevelAwait","classProperties","classPrivateProperties","classPrivateMethods","jsx"];(e==="tsx"||e==="ts")&&p.push("typescript");let o=await h.promises.readFile(t.path,"utf8");if(o.indexOf("styled-components")===-1)return{contents:o,loader:e};const a=u.createHash("sha1").update(o).digest("base64");if(s&&s.hash===a)return{contents:s.contents,loader:e};try{const n=(await f.transformAsync(o,{babelrc:!1,configFile:!1,ast:!1,root:l,filename:t.path,parserOpts:{allowAwaitOutsideFunction:!0,plugins:p},generatorOpts:{decoratorsBeforeExport:!0},plugins:[d],sourceMaps:!1}))?.code||void 0;return i.set(t.path,{contents:n,hash:a}),{contents:n,loader:e}}catch(n){if(!m.isDevelopMode)throw n;return{contents:o,loader:e}}})}});export{A as StyledComponentsSSR};
1
+ import f from"@babel/core";import h from"node:fs";import r from"node:path";import d from"babel-plugin-styled-components";import u from"crypto";import{envConfig as m}from"../../config/env-config.js";import{babelCache as i}from"../babel-cache.js";const A=()=>({name:"styled-components-ssr",setup:c=>{const l=process.cwd();c.onLoad({filter:/\.[tj]sx?$/},async t=>{if(new RegExp(`${r.sep}replay-[A-Za-z0-9_-]+\\.js$`).test(t.path)||t.path.endsWith(`${r.sep}replay.js`)||t.path.includes(`${r.sep}replay-index-`)&&t.path.endsWith(".js")||t.path.includes(`${r.sep}replay-tauri-path-`)&&t.path.endsWith(".js"))return;const e=t.path.split(".").pop(),s=i.get(t.path);if(s&&t.path.includes("/node_modules/"))return{contents:s.contents,loader:e};const p=["importMeta","topLevelAwait","classProperties","classPrivateProperties","classPrivateMethods","jsx"];(e==="tsx"||e==="ts")&&p.push("typescript");const o=await h.promises.readFile(t.path,"utf8");if(o.indexOf("styled-components")===-1)return{contents:o,loader:e};const a=u.createHash("sha1").update(o).digest("base64");if(s&&s.hash===a)return{contents:s.contents,loader:e};try{const n=(await f.transformAsync(o,{babelrc:!1,configFile:!1,ast:!1,root:l,filename:t.path,parserOpts:{allowAwaitOutsideFunction:!0,plugins:p},generatorOpts:{decoratorsBeforeExport:!0},plugins:[d],sourceMaps:!1}))?.code||void 0;return i.set(t.path,{contents:n,hash:a}),{contents:n,loader:e}}catch(n){if(!m.isDevelopMode)throw n;return{contents:o,loader:e}}})}});export{A as StyledComponentsSSR};
@@ -1 +1 @@
1
- import o from"path";import l from"js-yaml";import*as m from"fs";const i=a=>({name:"yaml",setup(t){t.onResolve({filter:/\.(yml|yaml)$/},e=>{if(e.resolveDir!=="")return{path:o.isAbsolute(e.path)?e.path:o.join(e.resolveDir,e.path),namespace:"yaml"}}),t.onLoad({filter:/.*/,namespace:"yaml"},async e=>{const r=await m.promises.readFile(e.path,"utf8");let n=l.load(r,a?.loadOptions);return{contents:JSON.stringify(n),loader:"json"}})}});export{i as YamlLoader};
1
+ import o from"path";import m from"js-yaml";import*as l from"fs";const i=a=>({name:"yaml",setup(e){e.onResolve({filter:/\.(yml|yaml)$/},t=>{if(t.resolveDir!=="")return{path:o.isAbsolute(t.path)?t.path:o.join(t.resolveDir,t.path),namespace:"yaml"}}),e.onLoad({filter:/.*/,namespace:"yaml"},async t=>{const r=await l.promises.readFile(t.path,"utf8"),n=m.load(r,a?.loadOptions);return{contents:JSON.stringify(n),loader:"json"}})}});export{i as YamlLoader};
@@ -1 +1 @@
1
- import p from"node:path";import{I18N_DIR_NAME as f,L10N_DIR_NAME as d}from"../constants/common.js";import{logger as u}from"../tools/notifiers/logger.js";import{Fs as m}from"./fs.js";import{isL10nPath as n}from"./utils/is-l10n-path.js";import{getLocaleFromRelativePath as c}from"./utils/get-locale-from-relative-path.js";import{removeL10nPrefix as l}from"./utils/remove-l10n-prefix.js";import{LastModifiedTracker as F}from"./last-modified-tracker.js";class R extends m{cwd;ignored;#e=new Map;#s;#t;constructor(e,t=[]){super(e,t),this.cwd=e,this.ignored=t,this.#s=new F(this),this.#r()}get localeFolders(){return Array.from(this.#e.keys())}get localizationFolder(){if(this.#t)return this.#t;let e=!1,t=!1;const s=this.localeFolders;if(!s.length)return;for(const i of s)for(const o of this.#e.get(i)?.values()||[]){const a=o.startsWith(d),h=o.startsWith(f);a&&!e&&(e=!0),h&&!t&&(t=!0)}e&&t?u.warn("Detected both `@l10n` and `@i18n` folders. Using `@l10n` folder for localization because `@i18n` folder is deprecated."):t&&u.warn("`@i18n` folder is deprecated. Please use `@l10n` folder instead.");const r=e?d:f;return this.#t=r,r}getFileInfo(e){if(e=e.replace(/^\.\//g,""),n(e)){if(super.exists(e))return super.getFileInfo(e);const t=l(e),s=super.getFileInfo(t);return s&&{...s,relativePath:e,realRelativePath:t,dirname:p.posix.dirname(e),isVirtual:!0}}return super.getFileInfo(e)}exists(e){return e=e.replace(/^\.\//g,""),n(e)?super.exists(e)||super.exists(l(e)):super.exists(e)}async read(e,t="utf-8"){return n(e)?await super.exists(e)?super.read(e,t):super.read(l(e),t):super.read(e,t)}scan(e){const t=super.scan(e),s={},r=new Set;for(const i of t)if(n(i.relativePath)){const o=c(i.relativePath),a=s[o]||new Set;a.add(l(i.relativePath)),s[o]=a}else r.add(i.relativePath);for(const i of r.values())for(const o of this.#e.keys())if(!s[o]?.has(i)){const a=`${this.localizationFolder}/${o}/${i}`;t.push({realRelativePath:i,relativePath:a,isVirtual:!0,hash:void 0})}return t}getLastModified(e){const t=this.getFileInfo(e);return this.#s.getLastModified(t?.realRelativePath||e)}async#r(){await this.watcher,this.#e=new Map;for(const e of this.filesList.values())if(n(e.relativePath)){const t=c(e.relativePath),s=this.#e.get(t)||new Set;s.add(e.relativePath),this.#e.set(t,s)}super.watch(async e=>{for(const t of e){if(t.event==="code-updated"||!n(t.path))continue;const s=c(t.path),r=this.#e.get(s)||new Set;switch(t.event){case"add":r.add(t.path),this.#e.set(s,r);break;case"unlink":r&&(r.delete(t.path),r.size===0&&this.#e.delete(s));break}}})}}export{R as ContentFs};
1
+ import m from"node:path";import{I18N_DIR_NAME as f,L10N_DIR_NAME as h}from"../constants/common.js";import{logger as c}from"../tools/notifiers/logger.js";import{Fs as F}from"./fs.js";import{isL10nPath as n}from"./utils/is-l10n-path.js";import{getLocaleFromRelativePath as d}from"./utils/get-locale-from-relative-path.js";import{isL10nRootFile as u}from"./utils/is-l10n-root-file.js";import{removeL10nPrefix as l}from"./utils/remove-l10n-prefix.js";import{LastModifiedTracker as g}from"./last-modified-tracker.js";class b extends F{cwd;ignored;#e=new Map;#t=new Set;#i;#s;constructor(e,t=[]){super(e,t),this.cwd=e,this.ignored=t,this.#i=new g(this),this.#r()}get localeFolders(){return Array.from(this.#e.keys())}get localizationFolder(){if(this.#s)return this.#s;let e=!1,t=!1;const s=this.localeFolders;if(!s.length)return;for(const i of s)for(const r of this.#e.get(i)?.values()||[]){const a=r.startsWith(h),p=r.startsWith(f);a&&!e&&(e=!0),p&&!t&&(t=!0)}e&&t?c.warn("Detected both `@l10n` and `@i18n` folders. Using `@l10n` folder for localization because `@i18n` folder is deprecated."):t&&c.warn("`@i18n` folder is deprecated. Please use `@l10n` folder instead.");const o=e?h:f;return this.#s=o,o}getFileInfo(e){if(e=e.replace(/^\.\//g,""),n(e)){if(super.exists(e))return super.getFileInfo(e);const t=l(e),s=super.getFileInfo(t);return s&&{...s,relativePath:e,realRelativePath:t,dirname:m.posix.dirname(e),isVirtual:!0}}return super.getFileInfo(e)}exists(e){return e=e.replace(/^\.\//g,""),n(e)?super.exists(e)||super.exists(l(e)):super.exists(e)}async read(e,t="utf-8"){return n(e)?await super.exists(e)?super.read(e,t):super.read(l(e),t):super.read(e,t)}scan(e){let t=super.scan(e);this.#t.size>0&&(t=t.filter(i=>!this.#t.has(i.relativePath)));const s={},o=new Set;for(const i of t)if(n(i.relativePath)){const r=d(i.relativePath),a=s[r]||new Set;a.add(l(i.relativePath)),s[r]=a}else o.add(i.relativePath);for(const i of o.values())for(const r of this.#e.keys())if(!s[r]?.has(i)){const a=`${this.localizationFolder}/${r}/${i}`;t.push({realRelativePath:i,relativePath:a,isVirtual:!0,hash:void 0})}return t}getLastModified(e){const t=this.getFileInfo(e);return this.#i.getLastModified(t?.realRelativePath||e)}#o(e){this.#t.add(e);const t=e.split("/")[0];c.warn(`The file %rp is placed directly in the ${t} folder root and does not belong to any locale, so it is ignored. Move it into a locale folder, for example ${t}/<locale>/.`,e)}async#r(){await this.watcher,this.#e=new Map,this.#t=new Set;for(const e of this.filesList.values()){if(!n(e.relativePath))continue;if(u(e.relativePath)){this.#o(e.relativePath);continue}const t=d(e.relativePath),s=this.#e.get(t)||new Set;s.add(e.relativePath),this.#e.set(t,s)}super.watch(async e=>{for(const t of e){if(t.event==="code-updated"||!n(t.path))continue;if(u(t.path)){t.event==="add"&&this.#o(t.path),t.event==="unlink"&&this.#t.delete(t.path);continue}const s=d(t.path),o=this.#e.get(s)||new Set;switch(t.event){case"add":o.add(t.path),this.#e.set(s,o);break;case"unlink":o&&(o.delete(t.path),o.size===0&&this.#e.delete(s));break}}})}}export{b as ContentFs};
@@ -0,0 +1,3 @@
1
+ /** True for a file placed directly in `@l10n/` or `@i18n/`, outside any locale folder. Expects a file path: a locale folder path such as `@l10n/fr` also returns true. */
2
+ export declare function isL10nRootFile(relativePath: string): boolean;
3
+ //# sourceMappingURL=is-l10n-root-file.d.ts.map
@@ -0,0 +1 @@
1
+ import{isL10nPath as o}from"./is-l10n-path.js";function i(n){return o(n)&&n.split("/").length===2}export{i as isL10nRootFile};
@@ -1 +1 @@
1
- import{Minimatch as d}from"minimatch";import{envConfig as c}from"../../../config/env-config.js";import{gateSsrComponents as s}from"../../consent/gate-ssr-components.js";import{buildScripts as l}from"./build-scripts.js";import{resolveBrowserHooksPath as u}from"./resolve-browser-hooks.js";async function P(){return{id:"Amplitude Analytics",requiredEntitlements:["analytics"],async processContent(t,{getConfig:r}){const e=await r(),n=e?.analytics?.amplitude;if(!n?.apiKey||!c.isProductionEnv&&!n.includeInDevelopment)return;let o=[];typeof n.exclude<"u"&&n.exclude.map(p=>{const i=new d(p).makeRe();i&&o.push(i)});const{headComponents:m,postBodyComponents:a}=l(n,o);t.addSsrComponents(s(m,"analytics",e.consent),"head"),t.addSsrComponents(s(a,"analytics",e.consent),"postBody"),t.addBrowserPlugin(u())}}}export{P as amplitudeAnalyticsPlugin};
1
+ import{Minimatch as c}from"minimatch";import{envConfig as d}from"../../../config/env-config.js";import{gateSsrComponents as s}from"../../consent/gate-ssr-components.js";import{buildScripts as l}from"./build-scripts.js";import{resolveBrowserHooksPath as u}from"./resolve-browser-hooks.js";async function P(){return{id:"Amplitude Analytics",requiredEntitlements:["analytics"],async processContent(t,{getConfig:r}){const o=await r(),n=o?.analytics?.amplitude;if(!n?.apiKey||!d.isProductionEnv&&!n.includeInDevelopment)return;const e=[];typeof n.exclude<"u"&&n.exclude.map(p=>{const i=new c(p).makeRe();i&&e.push(i)});const{headComponents:m,postBodyComponents:a}=l(n,e);t.addSsrComponents(s(m,"analytics",o.consent),"head"),t.addSsrComponents(s(a,"analytics",o.consent),"postBody"),t.addBrowserPlugin(u())}}}export{P as amplitudeAnalyticsPlugin};
@@ -1 +1 @@
1
- const h=(r,o)=>{const e=o?.analytics?.heap;if(e?.appId&&!r.prevLocation){const n=window.redocly?.consent;if(n&&!n.state.analytics){const t=n.on("change",a=>{a.analytics&&(t(),i(e.appId))});return}i(e.appId)}};function i(r){window.heap=window.heap||[],window.heap.load=function(o,e){window.heap.appid=o,window.heap.config=e=e||{};let n=e.forceSSL||document.location.protocol==="https:",t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=(n?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+o+".js";let a=document.getElementsByTagName("script")[0];a.parentNode?.insertBefore(t,a);for(let s=function(d){return function(...l){window.heap.push([d].concat(Array.prototype.slice.call(l,0)))}},c=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],p=0;p<c.length;p++)window.heap[c[p]]=s(c[p])},window.heap.load(r)}export{h as onRouteChange};
1
+ const h=(c,o)=>{const e=o?.analytics?.heap;if(e?.appId&&!c.prevLocation){const n=window.redocly?.consent;if(n&&!n.state.analytics){const t=n.on("change",a=>{a.analytics&&(t(),i(e.appId))});return}i(e.appId)}};function i(c){window.heap=window.heap||[],window.heap.load=function(o,e){window.heap.appid=o,window.heap.config=e=e||{};const n=e.forceSSL||document.location.protocol==="https:",t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=(n?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+o+".js";const a=document.getElementsByTagName("script")[0];a.parentNode?.insertBefore(t,a);for(let s=function(d){return function(...l){window.heap.push([d].concat(Array.prototype.slice.call(l,0)))}},r=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],p=0;p<r.length;p++)window.heap[r[p]]=s(r[p])},window.heap.load(c)}export{h as onRouteChange};
@@ -1 +1 @@
1
- import{REDOCLY_ROUTE_RBAC as w,REDOCLY_TEAMS_RBAC as v}from"@redocly/config";import{mcpTagSchemas as Z,schemaDefinitionTag as ee,markdocParser as U}from"@redocly/api-docs";import{withPathPrefix as q}from"@redocly/theme/core/utils";import{API_DOCS_TEMPLATE_ID as V,GRAPHQL_SPEC_SLUG as te,PUBLIC_RBAC_SCOPE_ITEM as x}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as oe,PUBLIC_API_DEFINITIONS_FOLDER as re}from"../../constants/common.js";import{API_DOCS_SHARED_DATA_PREFIX as C}from"../../constants/plugins/api-docs.js";import{fromCurrentDir as ae}from"../../utils/paths.js";import{normalizeRouteSlug as se}from"../../../utils/path/normalize-route-slug.js";import{createSlugify as ie}from"../create-slugify.js";import{apiDocLoader as ne,apiDocsLoader as ce}from"./loader.js";import{getTemplatePath as j}from"./get-template-path.js";import{storeDefinitionBundles as pe}from"./store-definition-bundles.js";import{telemetryTraceStep as ue}from"../../../cli/telemetry/helpers/trace-step.js";import{searchResolver as le}from"./search/search-resolver.js";import{getAiDocumentsStore as de}from"./search/get-ai-search-documents.js";import{getApiConfigByPath as me}from"../get-api-config.js";import{getRouteSlugsForPath as fe}from"../utils.js";import{collectItemRoutes as ge}from"./utils/collect-item-routes.js";import{applyNavItemToRoot as he}from"./utils/apply-nav-item-to-root.js";import{buildRoutesMapping as De}from"./utils/build-routes-mapping.js";import{buildItemPositions as Se}from"./utils/build-item-positions.js";import{resolveApiDocTitle as Pe}from"./utils/resolve-api-doc-title.js";import{resolveConfigRbac as ye}from"./utils/resolve-config-rbac.js";import{relativePathToBaseSlug as Ie}from"./utils/relative-path-to-base-slug.js";import{normalizeApiVersion as Ae}from"./utils/normalize-api-version.js";import{importApiDocsBuilder as W}from"./import-api-docs-builder.js";import{envConfig as $}from"../../config/env-config.js";import{logger as ve}from"../../tools/notifiers/logger.js";const T="openapi-spec-download",Re={asyncapi:"AsyncAPI Docs",graphql:"GraphQL Docs",openapi:"OpenAPI Docs"};async function st(){let t=[],r=new Map;const s=new WeakMap;let n=new Set,m={};function k(o,g,A){const P=s.get(o)??new Map;s.set(o,P);const h=g??"";return P.get(h)===A?!1:(P.set(h,A),!0)}return{id:"api-docs",requiredEntitlements:["openapi","asyncapi","graphql"],loaders:{"api-doc":ne,"api-docs":ce},processContent:async(o,g)=>{await ue("com.redocly.build.plugin.apiDocs",async()=>{o.createRequestHandler(T,ae(import.meta.url,"./spec-download.api.js")),o.addApiRoute({slug:re+"/*",requestHandlerId:T,httpMethod:"all",[v]:x,getStaticData:async()=>({props:{}})}),o.addApiRoute({slug:oe+"/*",requestHandlerId:T,httpMethod:"all",[v]:x,getStaticData:async()=>({props:{}})}),o.addApiRoute({slug:te+"/*",requestHandlerId:T,httpMethod:"all",[v]:x,getStaticData:async()=>({props:{}})});const A=o.createTemplate(V,j("../../../client/templates/api-docs/template.js")),P=o.registerServerPropsGetter(V,j("./get-server-props.js")),h=await g.getConfig();r=new Map,m={};const y=await o.loadApiDocuments(g);pe(y,o.outdir);const E=!!h.plugins?.some(e=>typeof e=="string"&&e.startsWith("@redocly/portal-plugin-async-api/"));E&&y.some(e=>e.type==="asyncapi")&&ve.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");const c=E?y.filter(e=>e.type!=="asyncapi"):y;t=c.map(({markdocChunks:e,relativePath:I,isVirtual:p,customOutputRelativeFile:a,realRelativePath:f})=>({chunks:e??[],relativePath:I,realRelativePath:f,isVirtual:a!=null||p}));const{buildItems:i}=await W(o.serverOutDir),D=(await g.cache.load("content-slugs","content-slugs")).data,S=ie(D),O=e=>se(S(e));for(const e of c){const I=e.customOutputRelativeFile||e.relativePath,p=O(I);Ee(e,p);const{items:a,store:f}=await i({type:e.type,document:e.document,options:e.options,basePath:p,markdownParser:U}),R=`${C}${e.relativePath}`,M=$.isDevelopMode?e.relativePath:void 0,u=Ce(e.document),b=u?.["x-metadata"],_=e.isVirtual?void 0:b?.apiId,N={document:e,basePath:p,sourcePath:M,apiId:_};await o.createSharedData(R,Q(N,a,f));const K=ye(e.config),F=!!e.options.excludeFromSearch,Y=e.type==="openapi",d=ge(a,K).map(l=>{const B=l.metadata?.seo,H={...we(l.link,p),fsPath:I,templateId:A,sharedData:[{key:"apiDocsStore",id:R}],serverPropsGetterIds:[P],excludeFromSearch:F,getStaticData:_e(l.label,B),[v]:l[v]};return Y?{...H,...l.httpVerb?{httpVerb:l.httpVerb,metadata:{subType:"openapi-operation"}}:{}}:H});if(!d.length)continue;const G=Pe(u,e.type,a),X=Ae(u?.version),L={type:e.type,title:G,version:X,description:typeof u?.description=="string"?u.description:void 0,summary:typeof u?.summary=="string"?u.summary:void 0,...u?.["x-metadata"]&&typeof u["x-metadata"]=="object"?u["x-metadata"]:{}};d[0]={...d[0],metadata:L,hasClientRoutes:!0,getSidebar:(l,B)=>he(z(a),p,B),getNavText:()=>G??Re[e.type]??"API Docs",getSearchDocuments:le(a,L,o.getSearchFacets,o.setSearchFacets,F,f,e.document),getAiDocumentsStore:de({items:a,metadata:L,store:f,document:e.document,specType:e.type,excludeFromSearch:F,basePath:p,getSearchFacets:o.getSearchFacets,markdocTags:{...Z,schemaDefinition:ee}})};const J=d[0];d[0]=d[d.length-1],d[d.length-1]=J;for(const l of d)o.addRoute(l);if(_){const l=me(e.config?.apis,e.realRelativePath);m[_]={[v]:l.rbac,[w]:{fsPath:I}}}r.set(R,N)}})},afterRoutesCreated:async(o,g)=>{const{buildItems:A,simplifyAstStructure:P}=await W(o.serverOutDir),h=new Set,y=new Set;for(const{chunks:c,relativePath:i,isVirtual:D}of t){const S=`${C}${i}`,O=fe(o.getAllRoutes(),i);for(const{node:e,markdown:I,pointer:p,key:a,relativePath:f}of c){const{ast:R,compoundHash:M}=await o.parseMarkdoc({input:{content:I,relativePath:f,isVirtual:D},resource:p,context:g,deps:{sharedDataIds:[`${C}${f}`],routeSlugs:O}});if(h.add(p),!(a==="graphql-docs"?e?.description?.value!==void 0:!!(a&&e[a]))||!k(e,a,M))continue;y.add(S);const b=P(R);if(a==="graphql-docs"){e.description&&(e.description.value=b);const _=`${C}${f}`;be(r.get(_),b)}else a&&(e[a]=b)}}const E=n.difference(h);for(const c of E)g.cache.delete(c);n=h,Object.entries(m).forEach(([c,i])=>{const D=i[w]?.fsPath;if(!D)return;const S=o.getRouteByFsPath(D)?.baseSlug;m[c]={...i,[w]:{...i[w],slug:S},slug:S}}),o.setGlobalData({apiProducts:m});for(const[c,i]of r){if(!y.has(c))continue;const{items:D,store:S}=await A({type:i.document.type,document:i.document.document,options:i.document.options,basePath:i.basePath,markdownParser:U});await o.createSharedData(c,Q(i,D,S))}}}}function Q({document:t,basePath:r,sourcePath:s,apiId:n},m,k){return{items:m,store:k,options:t.options,baseSlug:r,routesMapping:$.isDevelopMode?De(m,r):{},graphqlPositions:$.isDevelopMode&&t.type==="graphql"?Se(m,r):void 0,sourcePath:s,apiId:n}}function be(t,r){t?.document.type!=="graphql"||!t.document.options||(t.document.options.info={...t.document.options.info||{},description:r})}function _e(t,r){return async function(s){return{props:{settings:{baseUrlPath:q(s.baseSlug)},disableAutoScroll:!0,seo:{title:t,...r}}}}}function Ee(t,r){const s=t.options?.mockServer,n=q(`/_mock${Ie(t.relativePath)}`);s?.url===n&&(t.options={...t.options,mockServer:{...s,url:q(`/_mock${r}`)}})}function we(t,r){if(t===r)return{};const s=r==="/"?"/":`${r}/`;if(t.startsWith(s)){const n=t.slice(s.length);return n?{slugSuffix:n}:{}}return{slug:t}}function Ce(t){if(t&&typeof t=="object"&&"info"in t)return t.info}function z(t){return t.map(({content:r,items:s,...n})=>({...n,...s&&{items:z(s)}}))}export{st as apiDocsPlugin,we as toRouteSlugFields};
1
+ import{REDOCLY_ROUTE_RBAC as E,REDOCLY_TEAMS_RBAC as v}from"@redocly/config";import{mcpTagSchemas as Z,schemaDefinitionTag as ee,markdocParser as U}from"@redocly/api-docs";import{withPathPrefix as q}from"@redocly/theme/core/utils";import{API_DOCS_TEMPLATE_ID as V,GRAPHQL_SPEC_SLUG as te,PUBLIC_RBAC_SCOPE_ITEM as x}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as oe,PUBLIC_API_DEFINITIONS_FOLDER as re}from"../../constants/common.js";import{API_DOCS_SHARED_DATA_PREFIX as w}from"../../constants/plugins/api-docs.js";import{fromCurrentDir as ae}from"../../utils/paths.js";import{normalizeRouteSlug as se}from"../../../utils/path/normalize-route-slug.js";import{createSlugify as ie}from"../create-slugify.js";import{apiDocLoader as ne,apiDocsLoader as ce}from"./loader.js";import{getTemplatePath as j}from"./get-template-path.js";import{storeDefinitionBundles as pe}from"./store-definition-bundles.js";import{telemetryTraceStep as ue}from"../../../cli/telemetry/helpers/trace-step.js";import{searchResolver as de}from"./search/search-resolver.js";import{getAiDocumentsStore as le}from"./search/get-ai-search-documents.js";import{getApiConfigByPath as me}from"../get-api-config.js";import{getRouteSlugsForPath as fe}from"../utils.js";import{collectItemRoutes as he}from"./utils/collect-item-routes.js";import{isChunkCurrent as ge}from"./utils/decorators.js";import{applyNavItemToRoot as De}from"./utils/apply-nav-item-to-root.js";import{buildRoutesMapping as Se}from"./utils/build-routes-mapping.js";import{buildItemPositions as Pe}from"./utils/build-item-positions.js";import{resolveApiDocTitle as ye}from"./utils/resolve-api-doc-title.js";import{resolveConfigRbac as Ie}from"./utils/resolve-config-rbac.js";import{relativePathToBaseSlug as Ae}from"./utils/relative-path-to-base-slug.js";import{normalizeApiVersion as ve}from"./utils/normalize-api-version.js";import{importApiDocsBuilder as W}from"./import-api-docs-builder.js";import{envConfig as $}from"../../config/env-config.js";import{logger as Re}from"../../tools/notifiers/logger.js";const T="openapi-spec-download",be={asyncapi:"AsyncAPI Docs",graphql:"GraphQL Docs",openapi:"OpenAPI Docs"};async function nt(){let t=[],r=new Map;const s=new WeakMap;let n=new Set,m={};function k(o,h,A){const y=s.get(o)??new Map;s.set(o,y);const g=h??"";return y.get(g)===A?!1:(y.set(g,A),!0)}return{id:"api-docs",requiredEntitlements:["openapi","asyncapi","graphql"],loaders:{"api-doc":ne,"api-docs":ce},processContent:async(o,h)=>{await ue("com.redocly.build.plugin.apiDocs",async()=>{o.createRequestHandler(T,ae(import.meta.url,"./spec-download.api.js")),o.addApiRoute({slug:re+"/*",requestHandlerId:T,httpMethod:"all",[v]:x,getStaticData:async()=>({props:{}})}),o.addApiRoute({slug:oe+"/*",requestHandlerId:T,httpMethod:"all",[v]:x,getStaticData:async()=>({props:{}})}),o.addApiRoute({slug:te+"/*",requestHandlerId:T,httpMethod:"all",[v]:x,getStaticData:async()=>({props:{}})});const A=o.createTemplate(V,j("../../../client/templates/api-docs/template.js")),y=o.registerServerPropsGetter(V,j("./get-server-props.js")),g=await h.getConfig();r=new Map,m={};const I=await o.loadApiDocuments(h);pe(I,o.outdir);const C=!!g.plugins?.some(e=>typeof e=="string"&&e.startsWith("@redocly/portal-plugin-async-api/"));C&&I.some(e=>e.type==="asyncapi")&&Re.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");const c=C?I.filter(e=>e.type!=="asyncapi"):I;t=c.map(({markdocChunks:e,relativePath:P,isVirtual:p,customOutputRelativeFile:a,realRelativePath:f})=>({chunks:e??[],relativePath:P,realRelativePath:f,isVirtual:a!=null||p}));const{buildItems:i}=await W(o.serverOutDir),D=(await h.cache.load("content-slugs","content-slugs")).data,S=ie(D),O=e=>se(S(e));for(const e of c){const P=e.customOutputRelativeFile||e.relativePath,p=O(P);Ee(e,p);const{items:a,store:f}=await i({type:e.type,document:e.document,options:e.options,basePath:p,markdownParser:U}),R=`${w}${e.relativePath}`,M=$.isDevelopMode?e.relativePath:void 0,u=Te(e.document),b=u?.["x-metadata"],_=e.isVirtual?void 0:b?.apiId,N={document:e,basePath:p,sourcePath:M,apiId:_};await o.createSharedData(R,Q(N,a,f));const K=Ie(e.config),F=!!e.options.excludeFromSearch,Y=e.type==="openapi",l=he(a,K).map(d=>{const B=d.metadata?.seo,H={...we(d.link,p),fsPath:P,templateId:A,sharedData:[{key:"apiDocsStore",id:R}],serverPropsGetterIds:[y],excludeFromSearch:F,getStaticData:Ce(d.label,B),[v]:d[v]};return Y?{...H,...d.httpVerb?{httpVerb:d.httpVerb,metadata:{subType:"openapi-operation"}}:{}}:H});if(!l.length)continue;const G=ye(u,e.type,a),X=ve(u?.version),L={type:e.type,title:G,version:X,description:typeof u?.description=="string"?u.description:void 0,summary:typeof u?.summary=="string"?u.summary:void 0,...u?.["x-metadata"]&&typeof u["x-metadata"]=="object"?u["x-metadata"]:{}};l[0]={...l[0],metadata:L,hasClientRoutes:!0,getSidebar:(d,B)=>De(z(a),p,B),getNavText:()=>G??be[e.type]??"API Docs",getSearchDocuments:de(a,L,o.getSearchFacets,o.setSearchFacets,F,f,e.document),getAiDocumentsStore:le({items:a,metadata:L,store:f,document:e.document,specType:e.type,excludeFromSearch:F,basePath:p,getSearchFacets:o.getSearchFacets,markdocTags:{...Z,schemaDefinition:ee}})};const J=l[0];l[0]=l[l.length-1],l[l.length-1]=J;for(const d of l)o.addRoute(d);if(_){const d=me(e.config?.apis,e.realRelativePath);m[_]={[v]:d.rbac,[E]:{fsPath:P}}}r.set(R,N)}})},afterRoutesCreated:async(o,h)=>{const{buildItems:A,simplifyAstStructure:y}=await W(o.serverOutDir),g=new Set,I=new Set;for(const{chunks:c,relativePath:i,isVirtual:D}of t){const S=`${w}${i}`,O=fe(o.getAllRoutes(),i);for(const{node:e,markdown:P,pointer:p,key:a,relativePath:f}of c){const{ast:R,compoundHash:M}=await o.parseMarkdoc({input:{content:P,relativePath:f,isVirtual:D},resource:p,context:h,deps:{sharedDataIds:[`${w}${f}`],routeSlugs:O}});if(g.add(p),!(a==="graphql-docs"?e?.description?.value!==void 0:!!a&&ge(e,a,P))||!k(e,a,M))continue;I.add(S);const b=y(R);if(a==="graphql-docs"){e.description&&(e.description.value=b);const _=`${w}${f}`;_e(r.get(_),b)}else a&&(e[a]=b)}}const C=n.difference(g);for(const c of C)h.cache.delete(c);n=g,Object.entries(m).forEach(([c,i])=>{const D=i[E]?.fsPath;if(!D)return;const S=o.getRouteByFsPath(D)?.baseSlug;m[c]={...i,[E]:{...i[E],slug:S},slug:S}}),o.setGlobalData({apiProducts:m});for(const[c,i]of r){if(!I.has(c))continue;const{items:D,store:S}=await A({type:i.document.type,document:i.document.document,options:i.document.options,basePath:i.basePath,markdownParser:U});await o.createSharedData(c,Q(i,D,S))}}}}function Q({document:t,basePath:r,sourcePath:s,apiId:n},m,k){return{items:m,store:k,options:t.options,baseSlug:r,routesMapping:$.isDevelopMode?Se(m,r):{},graphqlPositions:$.isDevelopMode&&t.type==="graphql"?Pe(m,r):void 0,sourcePath:s,apiId:n}}function _e(t,r){t?.document.type!=="graphql"||!t.document.options||(t.document.options.info={...t.document.options.info||{},description:r})}function Ce(t,r){return async function(s){return{props:{settings:{baseUrlPath:q(s.baseSlug)},disableAutoScroll:!0,seo:{title:t,...r}}}}}function Ee(t,r){const s=t.options?.mockServer,n=q(`/_mock${Ae(t.relativePath)}`);s?.url===n&&(t.options={...t.options,mockServer:{...s,url:q(`/_mock${r}`)}})}function we(t,r){if(t===r)return{};const s=r==="/"?"/":`${r}/`;if(t.startsWith(s)){const n=t.slice(s.length);return n?{slugSuffix:n}:{}}return{slug:t}}function Te(t){if(t&&typeof t=="object"&&"info"in t)return t.info}function z(t){return t.map(({content:r,items:s,...n})=>({...n,...s&&{items:z(s)}}))}export{nt as apiDocsPlugin,we as toRouteSlugFields};
@@ -1,3 +1,3 @@
1
- import*as p from"node:path";import{parse as B,visit as x}from"graphql";import{Source as N,bundle as _,createConfig as D,getTotals as M,resolvePlugins as V}from"@redocly/openapi-core";import{convertSwagger2OpenAPI as j}from"@redocly/api-docs/lib/adapters/utils/convertSwagger2OpenAPI.js";import{CONFIG_FILE_NAME as k}from"../../../constants/common.js";import{MAX_BUNDLING_ERRORS_TO_PRINT as S}from"../../constants/plugins/api-docs.js";import{unique as F}from"../../../utils/array/unique.js";import{deepMerge as G}from"../../../utils/object/deep-merge.js";import{pluralize as C}from"../../../utils/string/pluralize.js";import{replaceEnvVariablesDeep as L}from"../../utils/envs/replace-env-variables-deep.js";import{logger as q}from"../../tools/notifiers/logger.js";import{reporter as h}from"../../tools/notifiers/reporter.js";import{ExternalResolver as b}from"../../fs/utils/external-ref-resolver.js";import{injectDecoratorIntoConfig as z,isPlainNonMarkdownText as H}from"./utils/decorators.js";import{getAllApiConfigsByPath as J,getApiConfigByPath as Q}from"../get-api-config.js";import{formatBundleError as U}from"./utils/format-bundle-error.js";import{createOptions as O}from"./options.js";const X=/(\.ya?ml|\.json|\.gql|\.graphql)$/,P=/(\.gql|\.graphql)$/;async function kn(n,r){if(p.posix.basename(n)===k)return[];if(P.test(n)){if(await r.isPathIgnored(n))return[];const u=await tn(n,r);return u?[u]:[]}let o;try{o=(await r.cache.load(n,"yaml")).data}catch{return[]}const t=Y(n,o);if(!t||!o||t==="graphql")return t===null&&q.verbose(`${n} file is not a recognized API spec. Skipping`),[];const{fs:c,getConfig:a,isPathIgnored:s}=r,e=t==="openapi"?await a("."):null,i=c.getFileInfo(n),f=await a(p.posix.dirname(n)),l=J(f?.apis,n,f.configPath),w=await s(n),d=[];for(const u of l){if(!u.output&&w)continue;const y=f.configPath?p.posix.dirname(f.configPath):".",g=u.output?p.posix.join(y,u.output):n;if(!await s(g)){i&&u.output&&!c.exists(g)&&c.addVirtualFile(g,i);try{const m=await on({relativePath:n,outputRelativePath:g,loaded:o,specType:t,rootConfig:e,config:f,apiConfig:u,fileRecord:i,fs:c});m&&d.push(m)}catch(m){await h.panicOnBuildContentError(m)}}}return d}async function qn(n,r){const{fs:o,cache:t}=r,c=[];for(const a of o.scan(X)){let s;try{s=await t.load(a.relativePath,"api-doc")}catch{continue}if(s.data?.length)for(const e of s.data)c.push({...e,isVirtual:a.isVirtual||e.isVirtual,hash:s.compoundHash})}return c}function K(n){const r=[];return x(n,{leave:o=>{!("description"in o)||!o.description?.value||!("name"in o)||H(o.description.value)||r.push({node:o,pointer:`#/types/${o?.name?.value}`,markdown:o.description.value,relativePath:"",key:"graphql-docs"})}}),r}async function W(n){try{const r=B(n);return{document:r,markdocChunks:K(r)}}catch(r){await h.panicOnBuildContentError(r);return}}function Y(n,r){return P.test(n)?"graphql":r?.openapi||r?.swagger?"openapi":r?.asyncapi?"asyncapi":null}function $(n,r){return r?{...n,info:{...n.info,"x-metadata":{...n.info?.["x-metadata"],...r}}}:n}async function Z(n,r,o){if(n==="openapi"){const t=r.swagger!==void 0?await j(r):r;return $(t,o)}return $(r,o)}async function nn(n){const{outputRelativePath:r,rootConfig:o,config:t,apiConfig:c,fs:a}=n,s=G({decorators:o?.decorators},t,{rbac:void 0},c),{resolvedObj:e}=L(s);if(e.decorators&&typeof e.decorators!="object"){await h.panicOnBuildContentError(`'decorators' must be an object at redocly.yaml, got '${typeof e.decorators}'`);return}if(e.plugins&&!Array.isArray(e.plugins)){await h.panicOnBuildContentError(`'plugins' must be an array at redocly.yaml, got '${typeof e.plugins}'`);return}const i=p.resolve(a.cwd,t.realConfigPath||k),f=new b(a),l=await D(z(e,r,a.cwd),{configPath:i,externalRefResolver:f});return o?.plugins&&o.configPath!==t.configPath&&(l.plugins=F([...l.plugins||[],...await V(o.plugins,a.cwd)],w=>w.id)),{coreConfig:l,mergedConfig:e}}async function rn(n,r,o){const t=M(n),c=[t.errors&&`${t.errors} ${C(t.errors,"error","errors")}`,t.warnings&&`${t.warnings} ${C(t.warnings,"warning","warnings")}`,t.ignored&&`${t.ignored} ignored`].filter(Boolean).join(", ");if(t.errors){const a=n.filter(i=>i.severity==="error");let s=`${c} while bundling ${r} definition:
2
- `;const e=Math.min(a.length,S);for(let i=0;i<e;i++){const f=await U(a[i],o);s+=`${f}
3
- `}if(a.length>e){const i=a.length-e;s+=`... and ${i} more ${C(i,"error","errors")}`}return await h.panicOnBuild(s),!0}return t.warnings&&q.warn(`${c} while bundling %rp definition`,r),!1}async function on(n){const{relativePath:r,outputRelativePath:o,loaded:t,specType:c,rootConfig:a,config:s,apiConfig:e,fileRecord:i,fs:f}=n,l=await nn(n);if(!l)return;const{coreConfig:w,mergedConfig:d}=l,u=p.resolve(f.cwd,r),y=new b(f),g={config:w,base:p.dirname(u),doc:{source:new N(u,await f.read(r)),parsed:JSON.parse(JSON.stringify(t))},externalRefResolver:y},{bundle:{parsed:R},problems:m,visitorsData:v}=await _(g);if(await rn(m,o,f.cwd))return;const I=v["markdown/markdown"]?.markdocChunks??[],A=d.metadata,E=await Z(c,R,A),T=O(c,E,{rootConfig:a,config:s,apiConfig:e,mergedConfig:d,relativePath:o});return{type:c,document:E,config:d,relativePath:o,realRelativePath:i?.realRelativePath||o,customOutputRelativeFile:e.output?o:void 0,markdocChunks:I,isVirtual:i?.isVirtual,options:T}}async function tn(n,r){const{fs:o,getConfig:t}=r,c=await o.read(n),a=o.getFileInfo(n),{document:s,markdocChunks:e}=await W(c)||{};if(!s){await h.panicOnBuildContentError(new Error("Failed to build GraphQL document"));return}const i=await t(),f=Q(i.apis,n);i.graphql?.info?.description&&e?.unshift({node:{description:{value:i.graphql?.info?.description}},pointer:"#/info",markdown:i.graphql?.info?.description,relativePath:"",key:"graphql-docs"});const l=O("graphql",s,{rootConfig:null,config:i,apiConfig:f??{},mergedConfig:{graphql:{...i.graphql??{},...f?.graphql??{}}},relativePath:n});return{type:"graphql",document:s,config:{...i,...f},relativePath:n,realRelativePath:a?.realRelativePath||n,markdocChunks:e,isVirtual:a?.isVirtual,options:l}}export{kn as apiDocLoader,qn as apiDocsLoader,K as collectGraphqlMarkdocChunks};
1
+ import*as l from"node:path";import{parse as x,visit as D}from"graphql";import{Source as N,bundle as _,createConfig as M,getTotals as V,resolvePlugins as j}from"@redocly/openapi-core";import{convertSwaggerToOpenApi as S}from"@redocly/api-docs/lib/services/spec-convert/swagger.js";import{normalizeAsyncApiDefinition as F}from"@redocly/api-docs/lib/services/spec-convert/asyncapi.js";import{CONFIG_FILE_NAME as b}from"../../../constants/common.js";import{MAX_BUNDLING_ERRORS_TO_PRINT as G}from"../../constants/plugins/api-docs.js";import{unique as L}from"../../../utils/array/unique.js";import{deepMerge as z}from"../../../utils/object/deep-merge.js";import{pluralize as E}from"../../../utils/string/pluralize.js";import{replaceEnvVariablesDeep as H}from"../../utils/envs/replace-env-variables-deep.js";import{logger as q}from"../../tools/notifiers/logger.js";import{reporter as h}from"../../tools/notifiers/reporter.js";import{ExternalResolver as O}from"../../fs/utils/external-ref-resolver.js";import{collectCopiedDescriptionChunks as J,injectDecoratorIntoConfig as Q,isPlainNonMarkdownText as U}from"./utils/decorators.js";import{getAllApiConfigsByPath as X,getApiConfigByPath as K}from"../get-api-config.js";import{formatBundleError as W}from"./utils/format-bundle-error.js";import{createOptions as P}from"./options.js";const Y=/(\.ya?ml|\.json|\.gql|\.graphql)$/,$=/(\.gql|\.graphql)$/;async function Pn(n,o){if(l.posix.basename(n)===b)return[];if($.test(n)){if(await o.isPathIgnored(n))return[];const u=await sn(n,o);return u?[u]:[]}let r;try{r=(await o.cache.load(n,"yaml")).data}catch{return[]}const t=on(n,r);if(!t||!r||t==="graphql")return t===null&&q.verbose(`${n} file is not a recognized API spec. Skipping`),[];const{fs:s,getConfig:a,isPathIgnored:c}=o,e=t==="openapi"?await a("."):null,i=s.getFileInfo(n),f=await a(l.posix.dirname(n)),p=X(f?.apis,n,f.configPath),w=await c(n),d=[];for(const u of p){if(!u.output&&w)continue;const y=f.configPath?l.posix.dirname(f.configPath):".",g=u.output?l.posix.join(y,u.output):n;if(!await c(g)){i&&u.output&&!s.exists(g)&&s.addVirtualFile(g,i);try{const m=await an({relativePath:n,outputRelativePath:g,loaded:r,specType:t,rootConfig:e,config:f,apiConfig:u,fileRecord:i,fs:s});m&&d.push(m)}catch(m){await h.panicOnBuildContentError(m)}}}return d}async function $n(n,o){const{fs:r,cache:t}=o,s=[];for(const a of r.scan(Y)){let c;try{c=await t.load(a.relativePath,"api-doc")}catch{continue}if(c.data?.length)for(const e of c.data)s.push({...e,isVirtual:a.isVirtual||e.isVirtual,hash:c.compoundHash})}return s}function Z(n){const o=[];return D(n,{leave:r=>{!("description"in r)||!r.description?.value||!("name"in r)||U(r.description.value)||o.push({node:r,pointer:`#/types/${r?.name?.value}`,markdown:r.description.value,relativePath:"",key:"graphql-docs"})}}),o}async function nn(n){try{const o=x(n);return{document:o,markdocChunks:Z(o)}}catch(o){await h.panicOnBuildContentError(o);return}}function on(n,o){return $.test(n)?"graphql":o?.openapi||o?.swagger?"openapi":o?.asyncapi?"asyncapi":null}function v(n,o){return o?{...n,info:{...n.info,"x-metadata":{...n.info?.["x-metadata"],...o}}}:n}async function rn(n,o,r){if(n==="openapi"){const t=o.swagger!==void 0?S(o):o;return v(t,r)}return v(F(o),r)}async function tn(n){const{outputRelativePath:o,rootConfig:r,config:t,apiConfig:s,fs:a}=n,c=z({decorators:r?.decorators},t,{rbac:void 0},s),{resolvedObj:e}=H(c);if(e.decorators&&typeof e.decorators!="object"){await h.panicOnBuildContentError(`'decorators' must be an object at redocly.yaml, got '${typeof e.decorators}'`);return}if(e.plugins&&!Array.isArray(e.plugins)){await h.panicOnBuildContentError(`'plugins' must be an array at redocly.yaml, got '${typeof e.plugins}'`);return}const i=l.resolve(a.cwd,t.realConfigPath||b),f=new O(a),p=await M(Q(e,o,a.cwd),{configPath:i,externalRefResolver:f});return r?.plugins&&r.configPath!==t.configPath&&(p.plugins=L([...p.plugins||[],...await j(r.plugins,a.cwd)],w=>w.id)),{coreConfig:p,mergedConfig:e}}async function en(n,o,r){const t=V(n),s=[t.errors&&`${t.errors} ${E(t.errors,"error","errors")}`,t.warnings&&`${t.warnings} ${E(t.warnings,"warning","warnings")}`,t.ignored&&`${t.ignored} ignored`].filter(Boolean).join(", ");if(t.errors){const a=n.filter(i=>i.severity==="error");let c=`${s} while bundling ${o} definition:
2
+ `;const e=Math.min(a.length,G);for(let i=0;i<e;i++){const f=await W(a[i],r);c+=`${f}
3
+ `}if(a.length>e){const i=a.length-e;c+=`... and ${i} more ${E(i,"error","errors")}`}return await h.panicOnBuild(c),!0}return t.warnings&&q.warn(`${s} while bundling %rp definition`,o),!1}async function an(n){const{relativePath:o,outputRelativePath:r,loaded:t,specType:s,rootConfig:a,config:c,apiConfig:e,fileRecord:i,fs:f}=n,p=await tn(n);if(!p)return;const{coreConfig:w,mergedConfig:d}=p,u=l.resolve(f.cwd,o),y=new O(f),g={config:w,base:l.dirname(u),doc:{source:new N(u,await f.read(o)),parsed:JSON.parse(JSON.stringify(t))},externalRefResolver:y},{bundle:{parsed:C},problems:m,visitorsData:A}=await _(g);if(await en(m,r,f.cwd))return;const R=A["markdown/markdown"]?.markdocChunks??[],I=d.metadata,T=s==="asyncapi"||C.swagger!==void 0,k=await rn(s,C,I);T&&R.push(...J(k,R));const B=P(s,k,{rootConfig:a,config:c,apiConfig:e,mergedConfig:d,relativePath:r});return{type:s,document:k,config:d,relativePath:r,realRelativePath:i?.realRelativePath||r,customOutputRelativeFile:e.output?r:void 0,markdocChunks:R,isVirtual:i?.isVirtual,options:B}}async function sn(n,o){const{fs:r,getConfig:t}=o,s=await r.read(n),a=r.getFileInfo(n),{document:c,markdocChunks:e}=await nn(s)||{};if(!c){await h.panicOnBuildContentError(new Error("Failed to build GraphQL document"));return}const i=await t(),f=K(i.apis,n);i.graphql?.info?.description&&e?.unshift({node:{description:{value:i.graphql?.info?.description}},pointer:"#/info",markdown:i.graphql?.info?.description,relativePath:"",key:"graphql-docs"});const p=P("graphql",c,{rootConfig:null,config:i,apiConfig:f??{},mergedConfig:{graphql:{...i.graphql??{},...f?.graphql??{}}},relativePath:n});return{type:"graphql",document:c,config:{...i,...f},relativePath:n,realRelativePath:a?.realRelativePath||n,markdocChunks:e,isVirtual:a?.isVirtual,options:p}}export{Pn as apiDocLoader,$n as apiDocsLoader,Z as collectGraphqlMarkdocChunks};
@@ -1,5 +1,12 @@
1
1
  import { ApiDocsSearchIndexer } from '@redocly/api-docs';
2
- import type { ExampleEntry, SchemaEntry } from '@redocly/api-docs';
2
+ import type { ExampleEntry, GraphqlStoreMeta, SchemaEntry, SearchIndexerOptions } from '@redocly/api-docs';
3
+ import type { RenderTagFn } from '../../../../types/index.js';
4
+ export type DescriptionFormatter = NonNullable<SearchIndexerOptions['formatDescription']>;
5
+ /**
6
+ * Formats an API description (a string or a Markdoc AST) as Markdown for AI search documents and
7
+ * llms.txt. Tags render through `renderTag` (their `renderForLlms`).
8
+ */
9
+ export declare function createLlmDescriptionFormatter(renderTag?: RenderTagFn): DescriptionFormatter;
3
10
  /** The shared api-docs indexer with Markdown descriptions — AI search documents and llms.txt need Markdown. */
4
- export declare function createApiDocsSearchIndexer(basePath: string, schemaStore?: Record<string, SchemaEntry>, document?: Record<string, unknown>, exampleStore?: Record<string, ExampleEntry>): ApiDocsSearchIndexer;
11
+ export declare function createApiDocsSearchIndexer(basePath: string, formatDescription: DescriptionFormatter, schemaStore?: Record<string, SchemaEntry>, document?: Record<string, unknown>, exampleStore?: Record<string, ExampleEntry>, graphqlMeta?: GraphqlStoreMeta): ApiDocsSearchIndexer;
5
12
  //# sourceMappingURL=create-indexer.d.ts.map
@@ -1 +1 @@
1
- import{ApiDocsSearchIndexer as e}from"@redocly/api-docs";import{toMarkdown as i}from"../../markdown/search/to-markdown.js";function a(r){if(typeof r=="string")return r;const t=Array.isArray(r)?r:[r];return i(t).trim()}function f(r,t,o,n){return new e(r,t,o,{formatDescription:a,exampleStore:n})}export{f as createApiDocsSearchIndexer};
1
+ import{ApiDocsSearchIndexer as a,markdocParser as f,parseMarkdown as p}from"@redocly/api-docs";import{toMarkdown as s}from"../../markdown/search/to-markdown.js";function u(i){const n=new Map;return r=>{if(typeof r=="string"&&!r.includes("{%"))return r;const e=typeof r=="string"?n.get(r):void 0;if(e!==void 0)return e;const t=p(r,{markdownParser:f}),o=!t||typeof t=="string"?t??"":s(Array.isArray(t)?t:[t],{renderTag:i}).trim();return typeof r=="string"&&n.set(r,o),o}}function d(i,n,r,e,t,o){return new a(i,r,e,{formatDescription:n,exampleStore:t,graphqlMeta:o})}export{d as createApiDocsSearchIndexer,u as createLlmDescriptionFormatter};