@redocly/revel 0.138.0-next.7 → 0.138.0

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 (275) hide show
  1. package/CHANGELOG.md +288 -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/ReviewComments/ReviewComments.js +2 -2
  13. package/dist/client/app/l10n/hooks/useTranslationKeys.js +1 -1
  14. package/dist/client/app/markdoc/custom-components/openapi/openapi-example.js +1 -1
  15. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -1
  16. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
  17. package/dist/client/app/markdoc/hooks/use-store.d.ts +2 -3
  18. package/dist/client/app/pages/Invite/Invite.js +1 -1
  19. package/dist/client/app/search/useSearch.js +1 -1
  20. package/dist/client/app/utils/loadAndNavigate.js +1 -1
  21. package/dist/client/polyfills.js +1 -1
  22. package/dist/client/runtime/loader.js +1 -1
  23. package/dist/client/utils/catalog/parse-filter-query.js +1 -1
  24. package/dist/compiled/svgo/svgo-node.js +39 -39
  25. package/dist/constants/api.d.ts +1 -0
  26. package/dist/constants/api.js +1 -1
  27. package/dist/constants/common.d.ts +6 -0
  28. package/dist/constants/common.js +1 -1
  29. package/dist/constants/l10n/langs/ar.js +1 -1
  30. package/dist/constants/l10n/langs/de.js +1 -1
  31. package/dist/constants/l10n/langs/en.js +1 -1
  32. package/dist/constants/l10n/langs/es.js +1 -1
  33. package/dist/constants/l10n/langs/fr.js +1 -1
  34. package/dist/constants/l10n/langs/hi.js +1 -1
  35. package/dist/constants/l10n/langs/it.js +1 -1
  36. package/dist/constants/l10n/langs/ja.js +1 -1
  37. package/dist/constants/l10n/langs/ko.js +1 -1
  38. package/dist/constants/l10n/langs/pl.js +1 -1
  39. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  40. package/dist/constants/l10n/langs/pt.js +1 -1
  41. package/dist/constants/l10n/langs/ru.js +1 -1
  42. package/dist/constants/l10n/langs/uk.js +1 -1
  43. package/dist/constants/l10n/langs/zh.js +1 -1
  44. package/dist/markdoc/helpers/get-inner-text.js +2 -2
  45. package/dist/markdoc/helpers/guards/is-prompt-node.d.ts +13 -0
  46. package/dist/markdoc/helpers/guards/is-prompt-node.js +1 -0
  47. package/dist/server/config/env-config.d.ts +0 -4
  48. package/dist/server/config/env-schema.d.ts +0 -10
  49. package/dist/server/config/env-schemas/feature-flags.d.ts +0 -8
  50. package/dist/server/config/env-schemas/feature-flags.js +1 -1
  51. package/dist/server/constants/entitlements.js +1 -1
  52. package/dist/server/entitlements/entitlements-provider.js +1 -1
  53. package/dist/server/esbuild/esbuild.js +3 -3
  54. package/dist/server/esbuild/plugins/on-rebuild.js +1 -1
  55. package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
  56. package/dist/server/esbuild/plugins/yaml-loader.js +1 -1
  57. package/dist/server/fs/content-fs.js +1 -1
  58. package/dist/server/fs/utils/is-l10n-root-file.d.ts +3 -0
  59. package/dist/server/fs/utils/is-l10n-root-file.js +1 -0
  60. package/dist/server/plugins/analytics/amplitude/index.js +1 -1
  61. package/dist/server/plugins/analytics/heap/browser-hooks.js +1 -1
  62. package/dist/server/plugins/api-docs/index.js +1 -1
  63. package/dist/server/plugins/api-docs/loader.js +3 -3
  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/versions-config-loader.js +1 -1
  74. package/dist/server/plugins/config-parser/resolve-mutual-exclusion.js +1 -1
  75. package/dist/server/plugins/config-parser/safe-parse.js +1 -1
  76. package/dist/server/plugins/default-theme/resolve-logo.js +1 -1
  77. package/dist/server/plugins/dev-onboarding/api/adapters/apigee/adapter.js +2 -2
  78. package/dist/server/plugins/dev-onboarding/api/adapters/gravitee/client.js +2 -2
  79. package/dist/server/plugins/dev-onboarding/api/combine.js +1 -1
  80. package/dist/server/plugins/dev-onboarding/template/components/ApiKeyOverview.js +3 -3
  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 +2 -2
  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 +3 -3
  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/custom-tools/scan-custom-tools.js +1 -1
  115. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  116. package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.js +1 -1
  117. package/dist/server/plugins/mcp/docs-mcp/tools/core/whoami.js +1 -1
  118. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
  119. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.d.ts +12 -3
  120. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.js +1 -1
  121. package/dist/server/plugins/mcp/docs-mcp/utils/resolve-refs.d.ts +2 -2
  122. package/dist/server/plugins/mcp/docs-mcp/utils/resolve-refs.js +1 -1
  123. package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.d.ts +11 -0
  124. package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.js +1 -0
  125. package/dist/server/plugins/mcp/gateway-mcp/api-call-operations.d.ts +32 -0
  126. package/dist/server/plugins/mcp/gateway-mcp/api-call-operations.js +1 -0
  127. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.d.ts +7 -4
  128. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.js +1 -1
  129. package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.d.ts +9 -0
  130. package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.js +1 -0
  131. package/dist/server/plugins/mcp/gateway-mcp/credential-validation.js +1 -1
  132. package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +1 -0
  133. package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +5 -5
  134. package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +8 -4
  135. package/dist/server/plugins/mcp/gateway-mcp/eligibility.js +1 -1
  136. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-audit.d.ts +2 -1
  137. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-audit.js +1 -1
  138. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.d.ts +11 -1
  139. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.js +1 -1
  140. package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.d.ts +11 -0
  141. package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.js +1 -1
  142. package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.js +1 -1
  143. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-client.d.ts +4 -0
  144. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-client.js +1 -0
  145. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-secret.d.ts +4 -0
  146. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-secret.js +1 -0
  147. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count.d.ts +11 -0
  148. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count.js +1 -0
  149. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-counter-repository.d.ts +13 -0
  150. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-counter-repository.js +13 -0
  151. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{limits.d.ts → fetch-limiter/fetch-limits.d.ts} +1 -1
  152. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-limits.js +1 -0
  153. 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
  154. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/apply-edge-rate-limit.js +1 -0
  155. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{edge-limiter.d.ts → request-limiter/edge-limiter.d.ts} +3 -3
  156. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/edge-limiter.js +1 -0
  157. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/rate-limit-telemetry.js +1 -0
  158. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/request-limits.d.ts +6 -0
  159. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/request-limits.js +1 -0
  160. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/utils/ip-key.js +1 -0
  161. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{window-counter.d.ts → utils/window-counter.d.ts} +1 -1
  162. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/utils/window-counter.js +1 -0
  163. package/dist/server/plugins/mcp/gateway-mcp/route-pattern.d.ts +18 -0
  164. package/dist/server/plugins/mcp/gateway-mcp/route-pattern.js +1 -0
  165. package/dist/server/plugins/mcp/gateway-mcp/secret-store.d.ts +9 -3
  166. package/dist/server/plugins/mcp/gateway-mcp/secret-store.js +1 -1
  167. package/dist/server/plugins/mcp/gateway-mcp/subject.js +1 -1
  168. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.d.ts +2 -0
  169. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.js +2 -2
  170. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.d.ts +0 -2
  171. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.js +1 -1
  172. package/dist/server/plugins/mcp/handlers/credentials-page/constants.d.ts +7 -0
  173. package/dist/server/plugins/mcp/handlers/credentials-page/constants.js +1 -0
  174. package/dist/server/plugins/mcp/handlers/credentials-page/form-contract.d.ts +5 -0
  175. package/dist/server/plugins/mcp/handlers/credentials-page/form-contract.js +1 -0
  176. package/dist/server/plugins/mcp/handlers/credentials-page/form-page.d.ts +14 -0
  177. package/dist/server/plugins/mcp/handlers/credentials-page/form-page.js +62 -0
  178. package/dist/server/plugins/mcp/handlers/credentials-page/layout.d.ts +17 -0
  179. package/dist/server/plugins/mcp/handlers/credentials-page/layout.js +11 -0
  180. package/dist/server/plugins/mcp/handlers/credentials-page/outcome-pages.d.ts +10 -0
  181. package/dist/server/plugins/mcp/handlers/credentials-page/outcome-pages.js +11 -0
  182. package/dist/server/plugins/mcp/handlers/credentials-page/site-branding.d.ts +10 -0
  183. package/dist/server/plugins/mcp/handlers/credentials-page/site-branding.js +1 -0
  184. package/dist/server/plugins/mcp/handlers/credentials-page/styles.d.ts +4 -0
  185. package/dist/server/plugins/mcp/handlers/credentials-page/styles.js +186 -0
  186. package/dist/server/plugins/mcp/handlers/credentials-page/types.d.ts +32 -0
  187. package/dist/server/plugins/mcp/handlers/credentials-page/types.js +0 -0
  188. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  189. package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
  190. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.d.ts +0 -1
  191. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +1 -1
  192. package/dist/server/plugins/mcp/index.js +1 -1
  193. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  194. package/dist/server/plugins/mcp/servers/mcp-server.js +2 -2
  195. package/dist/server/plugins/mcp/types.d.ts +16 -1
  196. package/dist/server/plugins/mcp/utils/mode.d.ts +4 -1
  197. package/dist/server/plugins/mcp/utils/mode.js +1 -1
  198. package/dist/server/plugins/mcp/utils/xmcp-utils.d.ts +3 -5
  199. package/dist/server/plugins/mcp/utils/xmcp-utils.js +1 -1
  200. package/dist/server/plugins/nav-utils.js +1 -1
  201. package/dist/server/plugins/scorecard-classic/loaders/scorecard.js +1 -1
  202. package/dist/server/plugins/scorecard-classic/template/components.js +1 -1
  203. package/dist/server/plugins/scorecard-classic/template/useData.js +1 -1
  204. package/dist/server/plugins/scorecard-classic/template/views.js +1 -1
  205. package/dist/server/plugins/search/engines/flexsearch/index.js +2 -2
  206. package/dist/server/plugins/sidebars/index.js +2 -2
  207. package/dist/server/plugins/sidebars/tabs.js +1 -1
  208. package/dist/server/plugins/sidebars/utils.js +1 -1
  209. package/dist/server/providers/database/client.d.ts +5 -0
  210. package/dist/server/providers/database/client.js +1 -1
  211. package/dist/server/providers/database/copy-migrations.js +1 -1
  212. package/dist/server/providers/database/database-connections-manager.js +1 -1
  213. package/dist/server/providers/database/has-project-database.d.ts +3 -0
  214. package/dist/server/providers/database/has-project-database.js +1 -0
  215. package/dist/server/store.d.ts +2 -0
  216. package/dist/server/store.js +1 -1
  217. package/dist/server/tools/notifiers/formatter.js +1 -1
  218. package/dist/server/tools/notifiers/helpers/privacy/mask-email.js +1 -1
  219. package/dist/server/tools/notifiers/logger.js +1 -1
  220. package/dist/server/types/plugins/markdown.d.ts +2 -0
  221. package/dist/server/types/web-server.d.ts +1 -0
  222. package/dist/server/utils/codeframes/codeframes.js +2 -2
  223. package/dist/server/utils/entitlements/read-entitlement-number.d.ts +3 -0
  224. package/dist/server/utils/entitlements/read-entitlement-number.js +1 -0
  225. package/dist/server/utils/fs.js +1 -1
  226. package/dist/server/utils/is-api-download-link.d.ts +1 -0
  227. package/dist/server/utils/is-api-download-link.js +1 -1
  228. package/dist/server/utils/rbac.js +1 -1
  229. package/dist/server/utils/redact-url.d.ts +3 -2
  230. package/dist/server/utils/redact-url.js +1 -1
  231. package/dist/server/utils/sandbox-context.d.ts +7 -4
  232. package/dist/server/utils/sandbox-context.js +1 -1
  233. package/dist/server/web-server/auth.d.ts +0 -1
  234. package/dist/server/web-server/auth.js +4 -4
  235. package/dist/server/web-server/dev-server.js +1 -1
  236. package/dist/server/web-server/http.d.ts +2 -1
  237. package/dist/server/web-server/http.js +2 -2
  238. package/dist/server/web-server/jwt/token-types.d.ts +1 -0
  239. package/dist/server/web-server/jwt/token-types.js +1 -1
  240. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  241. package/dist/server/web-server/middleware/dynamic-middleware/hono-compose.js +1 -1
  242. package/dist/server/web-server/middleware/responseHeadersMiddleware.js +1 -1
  243. package/dist/server/web-server/routes/auth.d.ts +1 -1
  244. package/dist/server/web-server/routes/auth.js +1 -1
  245. package/dist/server/web-server/routes/catalog/helpers/create-entity-schema.d.ts +1756 -1756
  246. package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.d.ts +295 -295
  247. package/dist/server/web-server/routes/cors-proxy.js +2 -2
  248. package/dist/server/web-server/routes/index.js +1 -1
  249. package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.d.ts +24 -0
  250. package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.js +35 -0
  251. package/dist/server/web-server/routes/mcp-routes/mcp-fetch-count.d.ts +8 -0
  252. package/dist/server/web-server/routes/mcp-routes/mcp-fetch-count.js +1 -0
  253. package/dist/server/web-server/routes/mcp-routes/mcp-oauth-store.d.ts +15 -0
  254. package/dist/server/web-server/routes/mcp-routes/mcp-oauth-store.js +1 -0
  255. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.d.ts +3 -1
  256. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
  257. package/dist/server/web-server/routes/mcp-routes/mcp-routes.js +1 -1
  258. package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
  259. package/dist/server/web-server/routes/resolve-route.js +1 -1
  260. package/dist/server/workers/worker-pool.js +1 -1
  261. package/dist/types/entitlements.d.ts +2 -0
  262. package/dist/utils/time/debounce.js +1 -1
  263. package/package.json +10 -11
  264. package/dist/client/app/utils/withLoadProgress.d.ts +0 -2
  265. package/dist/client/app/utils/withLoadProgress.js +0 -1
  266. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/apply-edge-rate-limit.js +0 -1
  267. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/edge-limiter.js +0 -1
  268. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/ip-key.js +0 -1
  269. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/limits.js +0 -1
  270. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/rate-limit-telemetry.js +0 -1
  271. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/window-counter.js +0 -1
  272. package/dist/server/plugins/mcp/handlers/mcp-credentials-page.d.ts +0 -12
  273. package/dist/server/plugins/mcp/handlers/mcp-credentials-page.js +0 -225
  274. /package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{rate-limit-telemetry.d.ts → request-limiter/rate-limit-telemetry.d.ts} +0 -0
  275. /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,8 +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
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
57
55
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
58
56
  SEARCH_DEV_REINIT?: string | undefined;
59
57
  SEARCH_DEV_DEBUG: boolean;
@@ -135,8 +133,6 @@ export declare const envConfig: {
135
133
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
136
134
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
137
135
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
138
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
139
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
140
136
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
141
137
  SEARCH_DEV_REINIT?: string | undefined;
142
138
  SEARCH_DEV_DEBUG: boolean;
@@ -56,8 +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
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
61
59
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
62
60
  } & {
63
61
  SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
@@ -136,8 +134,6 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
136
134
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
137
135
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
138
136
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
139
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
140
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
141
137
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
142
138
  SEARCH_DEV_REINIT?: string | undefined;
143
139
  SEARCH_DEV_DEBUG: boolean;
@@ -209,8 +205,6 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
209
205
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
210
206
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
211
207
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
212
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
213
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
214
208
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
215
209
  SEARCH_DEV_REINIT?: string | undefined;
216
210
  SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
@@ -282,8 +276,6 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
282
276
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
283
277
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
284
278
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
285
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
286
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
287
279
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
288
280
  SEARCH_DEV_REINIT?: string | undefined;
289
281
  SEARCH_DEV_DEBUG: boolean;
@@ -355,8 +347,6 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
355
347
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
356
348
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
357
349
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
358
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
359
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
360
350
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
361
351
  SEARCH_DEV_REINIT?: string | undefined;
362
352
  SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
@@ -15,10 +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
- /** Experimental: register custom MCP tools from `@mcp` folders. */
21
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
22
18
  /** Experimental: enables the GraphQL request body in Try It and embedded Replay. */
23
19
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
24
20
  }, "strip", z.ZodTypeAny, {
@@ -31,8 +27,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
31
27
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
32
28
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
33
29
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
34
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
35
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
36
30
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
37
31
  }, {
38
32
  NEW_CATALOG_ENABLED?: "false" | "true" | undefined;
@@ -44,8 +38,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
44
38
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
45
39
  REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
46
40
  REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
47
- REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
48
- REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
49
41
  REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
50
42
  }>;
51
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_MCP_CUSTOM_TOOLS_ENABLED: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 +1 @@
1
- import e from"node:path";import{existsSync as c}from"node:fs";import{readFile as F}from"node:fs/promises";import C from"js-yaml";import{withoutPathPrefix as U}from"@redocly/theme/core/utils";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as I,PUBLIC_API_DEFINITIONS_FOLDER as p}from"../../constants/common.js";import{GRAPHQL_SPEC_SLUG as y}from"../../../constants/common.js";import{canDownloadApiDefinition as O,filterDataByAccessDeep as q}from"../../utils/rbac.js";function A(a,t){const n=e.parse(a);return e.join(n.dir,n.name+t)}const T=async(a,t,n)=>{const{isAuthenticated:i,teams:l,claims:{email:f}}=t.user,S=new URL(a.url),o=U(S.pathname),m=o.startsWith(y),s=decodeURIComponent(m?o.replace(y,""):o.replace(p,"").replace(I,"")),{rbac:u={},requiresLogin:d=!1}=t.config.access||{};if(!O(o,u,d,{isAuthenticated:i,email:f,teams:l}))return new Response("Unauthorized",{status:i?403:401});const r=n.props?.outdir||"";if(m){const E=e.join(r,p,s);if(!c(E))return new Response("Not found",{status:404});const x=await F(E,"utf-8");return new Response(x,{headers:{"Content-Type":"application/graphql"}})}const h=e.join(r,p,A(s,".json")),P=e.join(r,I,A(s,".json")),R=c(h),_=c(P);if(!R&&!_)return new Response("Not found",{status:404});const L=await F(R?h:P,"utf-8"),N=JSON.parse(L),w=q(N,{isAuthenticated:i,email:f,teams:l},u,d),D=e.extname(s),j=D===".yaml"?C.dump(w):JSON.stringify(w,null,2);return new Response(j,{headers:{"Content-Type":D===".yaml"?"application/yaml":"application/json"}})};var k=T;export{k as default};
1
+ import n from"node:path";import{existsSync as u}from"node:fs";import{readFile as S}from"node:fs/promises";import q from"js-yaml";import{withoutPathPrefix as j}from"@redocly/theme/core/utils";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as x,PUBLIC_API_DEFINITIONS_FOLDER as w}from"../../constants/common.js";import{GRAPHQL_SPEC_SLUG as g}from"../../../constants/common.js";import{canDownloadApiDefinition as C,filterDataByAccessDeep as T}from"../../utils/rbac.js";import{API_DOWNLOAD_PREFIXES as U}from"../../utils/is-api-download-link.js";const v=[".json",".yaml",".yml"],B=[".graphql",".gql"];function A(s,e){const o=n.parse(s);return n.join(o.dir,o.name+e)}function G(s){let e;try{e=decodeURIComponent(s)}catch{return}return e.includes("\\")||e.split("/").slice(1).some(t=>t===""||t==="."||t==="..")?void 0:e}const X=async(s,e,o)=>{const{isAuthenticated:t,teams:d,claims:{email:f}}=e.user,y=new URL(s.url),a=G(j(y.pathname));if(a===void 0)return new Response("Bad Request",{status:400});const c=U.find(r=>a.startsWith(`${r}/`));if(c===void 0)return new Response("Not found",{status:404});const m=c===g,i=a.slice(c.length),p=n.extname(i);if(!(m?B:v).includes(p))return new Response("Not found",{status:404});const{rbac:h={},requiresLogin:P=!1}=e.config.access||{};if(!C(a,h,P,{isAuthenticated:t,email:f,teams:d}))return new Response("Unauthorized",{status:t?403:401});const l=o.props?.outdir||"";if(m){const r=n.join(l,w,i);if(!u(r))return new Response("Not found",{status:404});const L=await S(r,"utf-8");return new Response(L,{headers:{"Content-Type":"application/graphql"}})}const R=n.join(l,w,A(i,".json")),E=n.join(l,x,A(i,".json")),I=u(R),D=u(E);if(!I&&!D)return new Response("Not found",{status:404});const _=await S(I?R:E,"utf-8"),F=JSON.parse(_),N=T(F,{isAuthenticated:t,email:f,teams:d},h,P),O=p===".yaml"?q.dump(N):JSON.stringify(N,null,2);return new Response(O,{headers:{"Content-Type":p===".yaml"?"application/yaml":"application/json"}})};var Y=X;export{Y as default};
@@ -1 +1 @@
1
- const u=[({label:n,labelTranslationKey:o})=>n?{label:n,labelTranslationKey:o}:void 0,({icon:n,srcSet:o})=>{const t=typeof n=="string"?n:void 0;return t||o?{icon:t,srcSet:o}:void 0},({badges:n})=>n?{badges:n}:void 0];function c(n,o,t){if(!t)return n;const r=d(t);return n.map(e=>i(e,o)?{...e,...r}:e)}function d(n){return u.reduce((o,t)=>({...o,...t(n)}),{})}function i(n,o){return n.link===o}export{c as applyNavItemToRoot};
1
+ const u=[({label:n,labelTranslationKey:o})=>n?{label:n,labelTranslationKey:o}:void 0,({icon:n,srcSet:o})=>{const t=typeof n=="string"?n:void 0;return t||o?{icon:t,srcSet:o}:void 0},({badges:n})=>n?{badges:n}:void 0];function c(n,o,t){if(!t)return n;const r=f(t);return n.map(e=>i(e,o)?{...e,...r}:e)}function f(n){const o={};for(const t of u)Object.assign(o,t(n));return o}function i(n,o){return n.link===o}export{c as applyNavItemToRoot};
@@ -1,5 +1,16 @@
1
1
  import type { RawUniversalConfig } from '@redocly/openapi-core';
2
+ import type { MarkdocChunk } from '../loader.js';
2
3
  export declare function isPlainNonMarkdownText(markdown: string): boolean;
4
+ /**
5
+ * False once `node[key]` holds a string other than the chunk's markdown: the value was replaced
6
+ * after bundling (e.g. by an AsyncAPI 2.x trait), so writing the chunk back would restore it.
7
+ */
8
+ export declare function isChunkCurrent(node: Record<string, unknown>, key: string, markdown: string): boolean;
9
+ /**
10
+ * Chunks for `description` strings that were copied onto other objects after bundling (AsyncAPI
11
+ * traits), each taking the parse source of the chunk whose markdown it copies.
12
+ */
13
+ export declare function collectCopiedDescriptionChunks(document: unknown, chunks: MarkdocChunk[]): MarkdocChunk[];
3
14
  export declare const MarkdownParserDecorator: ({ outputRelativePath, cwd, }: {
4
15
  outputRelativePath: string;
5
16
  cwd: string;
@@ -1 +1 @@
1
- import b from"node:path";import{REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{slash as k}from"../../../../utils/path/slash.js";function f(t,r,a){if(!r)throw new Error("Visitor required");if(t){t.description&&r(t,"description",a.location.absolutePointer+"/description",a);for(const o in t["x-enumDescriptions"])r(t["x-enumDescriptions"],o,a.location.absolutePointer+"/x-enumDescriptions/"+o,a)}}const x=/^[a-zA-Z0-9\s\-,.!?:;'"()/]+$/,d=/^[^\S\r\n\u2028\u2029]*(?:[-+*]\s|\d+[.)]\s)/m;function g(t){return x.test(t)&&!d.test(t)}const s=({outputRelativePath:t,cwd:r})=>{const a=function(e,u,l,m){const{node:n}=m.resolve(e[u]);if(!n||typeof n!="string"||g(n))return;const i=m.getVisitorData();i.markdocChunks=i.markdocChunks||[],i.markdocChunks.push({node:e,pointer:k(b.relative(r,l)),markdown:n,relativePath:t,key:u})};return{any:{leave(o,e){f(o,a,e)}},ref:{leave(o,e){f(o,a,e)}}}},c=()=>{const t={};return{Tag:{enter(r){r?.["x-rbac"]&&(t[String(r.name)]=r["x-rbac"])}},any:{leave(r,a){if((a.type.name==="Operation"||a.type.name==="Webhook")&&"tags"in r&&Array.isArray(r.tags))for(const o of r.tags)t[o]&&(r["x-rbac"]=r["x-rbac"]||t[o]);r?.["x-rbac"]&&(r[p]=r["x-rbac"],delete r["x-rbac"])}},ref:{leave(r){r?.["x-rbac"]&&(r[p]=r["x-rbac"],delete r["x-rbac"])}}}};function D(t,r,a){const o={id:"markdown",decorators:{oas2:{markdown:s,rbac:c},oas3:{markdown:s,rbac:c},async3:{markdown:s,rbac:c}}};return{...t,decorators:{"markdown/rbac":"on","markdown/markdown":{outputRelativePath:r,cwd:a},...t.decorators||{}},plugins:[...t.plugins||[],o]}}export{s as MarkdownParserDecorator,c as RbacDecorator,D as injectDecoratorIntoConfig,g as isPlainNonMarkdownText};
1
+ import k from"node:path";import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{slash as w}from"../../../../utils/path/slash.js";function d(t,r,n){if(!r)throw new Error("Visitor required");if(t){t.description&&r(t,"description",n.location.absolutePointer+"/description",n);for(const o in t["x-enumDescriptions"])r(t["x-enumDescriptions"],o,n.location.absolutePointer+"/x-enumDescriptions/"+o,n)}}const b=/^[a-zA-Z0-9\s\-,.!?:;'"()/]+$/,l=/^[^\S\r\n\u2028\u2029]*(?:[-+*]\s|\d+[.)]\s)/m;function g(t){return b.test(t)&&!l.test(t)}function C(t,r,n){const o=t[r];return!!o&&(typeof o!="string"||o===n)}function M(t,r){const n=new Map,o=new Map;for(const e of r)e.key==="description"&&(n.has(e.markdown)||n.set(e.markdown,e),o.set(e.node,e.markdown));const a=[],c=new Set,f=e=>{if(typeof e!="object"||e===null||c.has(e))return;c.add(e);const{description:s}=e;if(typeof s=="string"&&o.get(e)!==s){const i=n.get(s);i&&a.push({...i,node:e})}for(const i of Object.values(e))f(i)};return f(t),a}const p=({outputRelativePath:t,cwd:r})=>{const n=function(a,c,f,e){const{node:s}=e.resolve(a[c]);if(!s||typeof s!="string"||g(s))return;const i=e.getVisitorData();i.markdocChunks=i.markdocChunks||[],i.markdocChunks.push({node:a,pointer:w(k.relative(r,f)),markdown:s,relativePath:t,key:c})};return{any:{leave(o,a){d(o,n,a)}},ref:{leave(o,a){d(o,n,a)}}}},u=()=>{const t={};return{Tag:{enter(r){r?.["x-rbac"]&&(t[String(r.name)]=r["x-rbac"])}},any:{leave(r,n){if((n.type.name==="Operation"||n.type.name==="Webhook")&&"tags"in r&&Array.isArray(r.tags))for(const o of r.tags)t[o]&&(r["x-rbac"]=r["x-rbac"]||t[o]);r?.["x-rbac"]&&(r[m]=r["x-rbac"],delete r["x-rbac"])}},ref:{leave(r){r?.["x-rbac"]&&(r[m]=r["x-rbac"],delete r["x-rbac"])}}}};function D(t,r,n){const o={id:"markdown",decorators:{oas2:{markdown:p,rbac:u},oas3:{markdown:p,rbac:u},async2:{markdown:p,rbac:u},async3:{markdown:p,rbac:u}}};return{...t,decorators:{"markdown/rbac":"on","markdown/markdown":{outputRelativePath:r,cwd:n},...t.decorators||{}},plugins:[...t.plugins||[],o]}}export{p as MarkdownParserDecorator,u as RbacDecorator,M as collectCopiedDescriptionChunks,D as injectDecoratorIntoConfig,C as isChunkCurrent,g as isPlainNonMarkdownText};
@@ -1,5 +1,5 @@
1
- import s from"node:path";import{bundle as R,createConfig as I,getTotals as B}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as J}from"../../../constants/common.js";import{deepMerge as L}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as M}from"../get-api-config.js";import{injectDecoratorIntoConfig as W}from"../api-docs/utils/decorators.js";import{ExternalResolver as _}from"../../fs/utils/external-ref-resolver.js";async function Y(o,{fs:n,logger:d,cache:u,getConfig:l,isPathIgnored:f}){let i;try{i=(await u.load(o,"yaml")).data}catch{return[]}if(!i?.arazzo)return d.verbose(`${o} file is not Arazzo document. Skipping`),[];const p=[],r=n.getFileInfo(o),t=await l(s.posix.dirname(o)),x=M(t?.apis,o,t.configPath),D=await f(o);for(const c of x){if(!c.output&&D)continue;const k=t.configPath?s.posix.dirname(t.configPath):".",a=c.output?s.posix.join(k,c.output):o;r&&c.output&&!await n.exists(a)&&n.addVirtualFile(a,r);const m=L(t,{rbac:void 0},c),v=s.resolve(n.cwd,t.realConfigPath||J),w=new _(n),O=await I(W(m,a,n.cwd),{configPath:v,externalRefResolver:w}),h=s.resolve(n.cwd,o),g={config:O,base:s.dirname(h),doc:{source:{absoluteRef:h},parsed:JSON.parse(JSON.stringify(i))}},{bundle:{parsed:N},problems:z,visitorsData:P}=await R({...g,dereference:!0,externalRefResolver:w}),{bundle:{parsed:S}}=await R({...g,doc:{...g.doc,parsed:JSON.parse(JSON.stringify(i))}}),V=P["markdown/markdown"]?.markdocChunks??[],e=B(z);let b=[e.errors&&`${e.errors} ${$(e.errors,"error","errors")}`,e.warnings&&`${e.warnings} ${$(e.warnings,"warning","warnings")}`,e.ignored&&`${e.ignored} ignored`].filter(Boolean).join(", ");if(e.errors){const C=z.find(F=>F.severity==="error");throw new Error(`${b} while bundling ${a} definition.
1
+ import s from"node:path";import{bundle as R,createConfig as I,getTotals as B}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as J}from"../../../constants/common.js";import{deepMerge as L}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as M}from"../get-api-config.js";import{injectDecoratorIntoConfig as W}from"../api-docs/utils/decorators.js";import{ExternalResolver as _}from"../../fs/utils/external-ref-resolver.js";async function Y(o,{fs:n,logger:d,cache:u,getConfig:l,isPathIgnored:f}){let i;try{i=(await u.load(o,"yaml")).data}catch{return[]}if(!i?.arazzo)return d.verbose(`${o} file is not Arazzo document. Skipping`),[];const p=[],e=n.getFileInfo(o),t=await l(s.posix.dirname(o)),x=M(t?.apis,o,t.configPath),D=await f(o);for(const c of x){if(!c.output&&D)continue;const k=t.configPath?s.posix.dirname(t.configPath):".",a=c.output?s.posix.join(k,c.output):o;e&&c.output&&!await n.exists(a)&&n.addVirtualFile(a,e);const m=L(t,{rbac:void 0},c),v=s.resolve(n.cwd,t.realConfigPath||J),w=new _(n),O=await I(W(m,a,n.cwd),{configPath:v,externalRefResolver:w}),h=s.resolve(n.cwd,o),g={config:O,base:s.dirname(h),doc:{source:{absoluteRef:h},parsed:JSON.parse(JSON.stringify(i))}},{bundle:{parsed:N},problems:z,visitorsData:P}=await R({...g,dereference:!0,externalRefResolver:w}),{bundle:{parsed:S}}=await R({...g,doc:{...g.doc,parsed:JSON.parse(JSON.stringify(i))}}),V=P["markdown/markdown"]?.markdocChunks??[],r=B(z),b=[r.errors&&`${r.errors} ${$(r.errors,"error","errors")}`,r.warnings&&`${r.warnings} ${$(r.warnings,"warning","warnings")}`,r.ignored&&`${r.ignored} ignored`].filter(Boolean).join(", ");if(r.errors){const C=z.find(F=>F.severity==="error");throw new Error(`${b} while bundling ${a} definition.
2
2
 
3
3
  ${C?.message} at ${C?.location?.[0]?.pointer}
4
4
 
5
- `)}e.warnings&&d.warn(`${b} while bundling %rp definition`,a);const j=y(N,t.metadata),A=y(S,t.metadata),E={document:j,documentWithReferences:A,config:m,relativePath:a,realRelativePath:r?.realRelativePath||a,customOutputRelativeFile:c.output&&a,markdocChunks:V,isVirtual:r?.isVirtual??!1};p.push(E)}return p}async function Z(o,n){const{fs:d,cache:u,getConfig:l}=n,f=[];for(const i of await d.scan(/(\.ya?ml|\.json)$/)){if(!await l(s.posix.dirname(i.relativePath)))continue;let r;try{r=await u.load(i.relativePath,"arazzo-doc")}catch{continue}r.data?.length&&f.push(...r.data.map(t=>({...t,isVirtual:i.isVirtual||t.isVirtual,hash:r.compoundHash})))}return f}function y(o,n){return n?{...o,info:{...o.info,...n}}:o}export{Y as arazzoDocLoader,Z as arazzoDocsLoader};
5
+ `)}r.warnings&&d.warn(`${b} while bundling %rp definition`,a);const j=y(N,t.metadata),A=y(S,t.metadata),E={document:j,documentWithReferences:A,config:m,relativePath:a,realRelativePath:e?.realRelativePath||a,customOutputRelativeFile:c.output&&a,markdocChunks:V,isVirtual:e?.isVirtual??!1};p.push(E)}return p}async function Z(o,n){const{fs:d,cache:u,getConfig:l}=n,f=[];for(const i of await d.scan(/(\.ya?ml|\.json)$/)){if(!await l(s.posix.dirname(i.relativePath)))continue;let e;try{e=await u.load(i.relativePath,"arazzo-doc")}catch{continue}e.data?.length&&f.push(...e.data.map(t=>({...t,isVirtual:i.isVirtual||t.isVirtual,hash:e.compoundHash})))}return f}function y(o,n){return n?{...o,info:{...o.info,...n}}:o}export{Y as arazzoDocLoader,Z as arazzoDocsLoader};
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as $}from"@redocly/config";import{removeLeadingSlash as T}from"@redocly/theme/core/utils";import{toKebabCase as y}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as x}from"../../../../../utils/async/promise-map-limit-with-status.js";import{extractTeamsFromScopeItems as R}from"../../../../../utils/rbac.js";import{removeMarkdocTags as w}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as b}from"./base.js";import{OpenapiSchemaResolver as S}from"../../../utils/openapi-schema-resolver.js";import{extractPartsFromComponentsRef as A}from"../../../utils/extract-parts-from-components-ref.js";import{isValidTagName as v}from"../../../utils/is-valid-tag-name.js";const N=["get","post","put","delete","patch"],d=15,O=15;class V extends b{#e;constructor(e){super("openapi",e),this.#e=e.context.logger}async loadApiDescriptions(){return(await this.actions.loadApiDocuments(this.context)).filter(o=>o.type==="openapi").map(o=>({...o,isVirtual:o.isVirtual??!1}))}mapApiDescriptionToEntity(e,o){const s=T(e.realRelativePath),r=e.document.info.title,t=this.resolveEntityKey({realRelativePath:e.realRelativePath,customKey:e.document["x-redocly-catalog-key"]});return{type:this.type,key:t,title:r,summary:w(typeof e.document.info.description=="string"?e.document.info.description:void 0),tags:e.document.tags?.filter(a=>a.name&&v(a.name)).map(a=>a.name),metadata:{specType:this.specType,descriptionFile:s},version:o}}async processApiDescription(e,o,s,r){if(S.clearSchemaCache(),!e?.document)throw new Error("OpenAPI definition is missing a bundled document");const t=this.getRbacTeamsForDefinition(e.relativePath),a=this.mapApiDescriptionToEntity(e,s);await this.catalogEntitiesService.createEntity({entity:a,sourceFile:e.realRelativePath,fileHash:e.hash,source:"file",isRootEntity:!0,rbacTeams:t,revision:o}),r.delete(`${a.key}:${s}`),await this.#r(e,a.key,a.version,s,o,r,t);const n=this.#s(e.document.paths);if(n.length!==0){const i=(await x(n,d,async({operation:m,path:h,method:f})=>{if(!m.operationId)return;const l=await this.#n(m,h,f,e,a.key,a.version,o,t);r.delete(`${l}:${s}`)},this.#e)).count.failed;i>0&&this.#e.warn(`Extraction completed with ${i} failures out of ${n.length} operations for ${a.key}`)}}#s(e){return Object.entries(e??{}).flatMap(([o,s])=>N.filter(r=>s[r]).map(r=>{const t=s[r];if(!t)throw new Error(`Operation not found for method ${r} on path ${o}`);return{operation:t,path:o,method:r.toUpperCase()}}))}async#r(e,o,s,r,t,a,n){const c=e.document.components?.schemas;if(!c)return;const i=Object.entries(c);i.length!==0&&await E(i,O,async([m,h])=>{const f=`${o}-${y(m)}`,l=await this.#o({schemaName:m,schema:h,description:e,parentKey:o,parentVersion:s,parentRevision:t,rbacTeams:n});a.delete(`${f}:${r}`),l&&await this.catalogEntitiesService.createEntityRelation({sourceKey:o,sourceVersion:s,sourceRevision:t,type:"uses",targetKey:l.key,targetVersion:s,targetRevision:t,sourceFile:e.realRelativePath,fileHash:e.hash})})}async#o({schemaName:e,schema:o,description:s,parentKey:r,parentVersion:t,parentRevision:a,rbacTeams:n}){const c=S.resolveSchemaRefs(o,s.document),i=JSON.stringify(c),m=c[$]?R(c[$]):n,h=R(c["x-rbac"]),f={type:"data-schema",key:`${r}-${y(e)}`,title:e,summary:(typeof c.description=="string"?c.description:c.title)??null,tags:[],metadata:{specType:this.specType,schema:i},version:t};try{return await this.catalogEntitiesService.createEntity({entity:f,sourceFile:s.realRelativePath,fileHash:s.hash,rbacTeams:h.length?h:m,source:"file",revision:a})}catch(l){return this.#e.error(`Failed to create data schema entity for ${e}: ${l instanceof Error?l.message:"Unknown error"}`),null}}async#n(e,o,s,r,t,a,n,c){const i=`${t}-${y(`${e.operationId}`)}`,m=await Promise.all([this.#m(e.requestBody??null,r),this.#h(e.responses??{},r)]),h=m[0].schemaNames,f=m[1].schemaNames;m[0].errors.length>0&&this.#e.warn(`Schema extraction errors for operation ${e.operationId}: ${m[0].errors.join(", ")}`),m[1].errors.length>0&&this.#e.warn(`Response schema extraction errors for operation ${e.operationId}: ${m[1].errors.join(", ")}`);const l=h.map(p=>`${t}-${y(p)}`),u=f.map(p=>`${t}-${y(p)}`),g=await this.#f({path:o,method:s,operation:e,requestBodySchemasKeys:l,responseSchemasKeys:u,description:r,parentKey:t,parentVersion:a,parentRevision:n,rbacTeams:c});return g&&await Promise.all([this.#c(h,e.operationId??"",r.realRelativePath,r.hash,t,a,n),this.#i(f,e.operationId??"",r.realRelativePath,r.hash,t,a,n),this.#p({apiOperationKey:g.key,operationRelations:e["x-catalogRelations"],descriptionUniqueKey:t,description:r,parentVersion:a,parentRevision:n})]),i}async#c(e,o,s,r,t,a,n){return e.length===0||!o?[]:await this.#a(e,o,s,r,t,a,n)}async#i(e,o,s,r,t,a,n){return e.length===0||!o?[]:await this.#a(e,o,s,r,t,a,n)}#m(e,o){const s=[],r=[];try{if(e&&"content"in e&&e.content)for(const t of Object.values(e.content)){if(!t.schema?.$ref)continue;const a=this.#t(t.schema.$ref);a?.componentType==="schemas"&&a.componentName&&s.push(a.componentName)}if(e&&e.$ref){const t=this.#t(e.$ref);if(t?.componentType==="requestBodies"&&t.componentName){const a=o.document.components?.requestBodies?.[t.componentName];if(a&&"content"in a)for(const n of Object.values(a.content??{})){if(!n.schema?.$ref)continue;const c=this.#t(n.schema.$ref);c?.componentType==="schemas"&&c.componentName&&s.push(c.componentName)}}}}catch(t){r.push(`Failed to extract request body schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(s)],errors:r}}#h(e,o){const s=[],r=[];try{for(const t of Object.values(e)){if(t&&"content"in t&&t.content)for(const a of Object.values(t.content)){if(!a.schema?.$ref)continue;const n=this.#t(a.schema.$ref);n?.componentType==="schemas"&&n.componentName&&s.push(n.componentName)}if(t&&t.$ref){const a=this.#t(t.$ref);if(a?.componentType==="responses"&&a.componentName){const n=o.document.components?.responses?.[a.componentName];if(n&&"content"in n)for(const c of Object.values(n.content??{})){if(!c.schema?.$ref)continue;const i=this.#t(c.schema.$ref);i?.componentType==="schemas"&&i.componentName&&s.push(i.componentName)}}}}}catch(t){r.push(`Failed to extract response schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(s)],errors:r}}#t(e){try{return A(e)}catch{return{componentType:"",componentName:null}}}async#a(e,o,s,r,t,a,n){return e.length===0?[]:await E(e,O,async c=>await this.#l({operationId:o,schemaName:c,descriptionSourceFile:s,descriptionHash:r,parentKey:t,parentVersion:a,parentRevision:n}))}async#l({operationId:e,schemaName:o,descriptionSourceFile:s,descriptionHash:r,parentKey:t,parentVersion:a,parentRevision:n}){const c=`${t}-${y(o)}`;try{return await this.catalogEntitiesService.createEntityRelation({sourceKey:`${t}-${y(e)}`,type:"uses",targetKey:c,sourceFile:s,fileHash:r,sourceVersion:a,targetVersion:a,sourceRevision:n,targetRevision:n}),c}catch(i){throw this.#e.error(`Failed to create relation between operation ${e} and schema ${o}: ${i instanceof Error?i.message:"Unknown error"}`),i}}async#f({path:e,method:o,operation:s,requestBodySchemasKeys:r,responseSchemasKeys:t,description:a,parentKey:n,parentVersion:c,parentRevision:i,rbacTeams:m}){const h=`${s.operationId}`,f=`${n}-${y(h)}`,l=s[$]?R(s[$]):m,u=R(s["x-rbac"]),g={type:"api-operation",key:f,title:h,summary:w(s.summary),tags:s.tags?.filter(p=>v(p)),metadata:{path:e,method:o,payload:r,responses:t},version:c};try{return await this.catalogEntitiesService.createEntity({entity:g,sourceFile:a.realRelativePath,fileHash:a.hash,rbacTeams:u.length>0?u:l,source:"file",revision:i})}catch(p){return this.#e.error(`Failed to create API operation entity for ${h}: ${p instanceof Error?p.message:"Unknown error"}`),null}}async#p({apiOperationKey:e,operationRelations:o,descriptionUniqueKey:s,description:r,parentVersion:t,parentRevision:a}){try{await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:"partOf",targetKey:s,sourceFile:r.realRelativePath,fileHash:r.hash,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),await this.#y(e,r,o,t,a)}catch(n){this.#e.error(`Failed to create API operation relations for ${e}: ${n instanceof Error?n.message:"Unknown error"}`)}}async#y(e,o,s,r,t){s?.length&&await E(s,d,async a=>{try{this.validateEntityRelationFileSchema(a),await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:a.type,targetKey:a.key,sourceFile:o.realRelativePath,fileHash:o.hash,sourceVersion:r,targetVersion:"",sourceRevision:t,targetRevision:""})}catch(n){this.context.logger.warn(`Error creating entity relation for operation ${e} based on custom property: ${n instanceof Error?n.message:"Unknown error"}`)}})}}export{V as OpenApiEntitiesExtractor};
1
+ import{REDOCLY_TEAMS_RBAC as R}from"@redocly/config";import{removeLeadingSlash as O}from"@redocly/theme/core/utils";import{toKebabCase as y}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as x}from"../../../../../utils/async/promise-map-limit-with-status.js";import{extractTeamsFromScopeItems as $}from"../../../../../utils/rbac.js";import{removeMarkdocTags as S}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as b}from"./base.js";import{OpenapiSchemaResolver as w}from"../../../utils/openapi-schema-resolver.js";import{extractPartsFromComponentsRef as N}from"../../../utils/extract-parts-from-components-ref.js";import{isValidTagName as d}from"../../../utils/is-valid-tag-name.js";const A=["get","post","put","delete","patch"],T=15,v=15;class V extends b{#e;constructor(e){super("openapi",e),this.#e=e.context.logger}async loadApiDescriptions(){return(await this.actions.loadApiDocuments(this.context)).filter(o=>o.type==="openapi").map(o=>({...o,isVirtual:o.isVirtual??!1}))}mapApiDescriptionToEntity(e,o){const n=O(e.realRelativePath),s=e.document.info.title,t=this.resolveEntityKey({realRelativePath:e.realRelativePath,customKey:e.document["x-redocly-catalog-key"]});return{type:this.type,key:t,title:s,summary:S(typeof e.document.info.description=="string"?e.document.info.description:void 0),tags:e.document.tags?.filter(a=>a.name&&d(a.name)).map(a=>a.name),metadata:{specType:this.specType,descriptionFile:n},version:o}}async processApiDescription(e,o,n,s){if(w.clearSchemaCache(),!e?.document)throw new Error("OpenAPI definition is missing a bundled document");const t=this.getRbacTeamsForDefinition(e.relativePath),a=this.mapApiDescriptionToEntity(e,n);await this.catalogEntitiesService.createEntity({entity:a,sourceFile:e.realRelativePath,fileHash:e.hash,source:"file",isRootEntity:!0,rbacTeams:t,revision:o}),s.delete(`${a.key}:${n}`),await this.#o(e,a.key,a.version,n,o,s,t);const r=this.#n(e.document.paths);if(r.length!==0){const i=(await x(r,T,async({operation:m,path:h,method:f})=>{if(!m.operationId)return;const l=await this.#c(m,h,f,e,a.key,a.version,o,t);s.delete(`${l}:${n}`)},this.#e)).count.failed;i>0&&this.#e.warn(`Extraction completed with ${i} failures out of ${r.length} operations for ${a.key}`)}}#n(e){return Object.entries(e??{}).flatMap(([o,n])=>A.filter(s=>n[s]).map(s=>{const t=n[s];if(!t)throw new Error(`Operation not found for method ${s} on path ${o}`);return{operation:t,path:o,method:s.toUpperCase()}}))}async#o(e,o,n,s,t,a,r){const c=e.document.components?.schemas;if(!c)return;const i=Object.entries(c);i.length!==0&&await E(i,v,async([m,h])=>{const f=`${o}-${y(m)}`,l=await this.#r({schemaName:m,schema:h,description:e,parentKey:o,parentVersion:n,parentRevision:t,rbacTeams:r});a.delete(`${f}:${s}`),l&&await this.catalogEntitiesService.createEntityRelation({sourceKey:o,sourceVersion:n,sourceRevision:t,type:"uses",targetKey:l.key,targetVersion:n,targetRevision:t,sourceFile:e.realRelativePath,fileHash:e.hash})})}async#r({schemaName:e,schema:o,description:n,parentKey:s,parentVersion:t,parentRevision:a,rbacTeams:r}){const c=w.resolveSchemaRefs(o,n.document),i=JSON.stringify(c),m=c[R]?$(c[R]):r,h=$(c["x-rbac"]),f={type:"data-schema",key:`${s}-${y(e)}`,title:e,summary:(typeof c.description=="string"?c.description:c.title)??null,tags:[],metadata:{specType:this.specType,schema:i},version:t};try{return await this.catalogEntitiesService.createEntity({entity:f,sourceFile:n.realRelativePath,fileHash:n.hash,rbacTeams:h.length?h:m,source:"file",revision:a})}catch(l){return this.#e.error(`Failed to create data schema entity for ${e}: ${l instanceof Error?l.message:"Unknown error"}`),null}}async#c(e,o,n,s,t,a,r,c){const i=`${t}-${y(`${e.operationId}`)}`,m=await Promise.all([this.#h(e.requestBody??null,s),this.#l(e.responses??{},s)]),h=m[0].schemaNames,f=m[1].schemaNames;m[0].errors.length>0&&this.#e.warn(`Schema extraction errors for operation ${e.operationId}: ${m[0].errors.join(", ")}`),m[1].errors.length>0&&this.#e.warn(`Response schema extraction errors for operation ${e.operationId}: ${m[1].errors.join(", ")}`);const l=h.map(p=>`${t}-${y(p)}`),u=f.map(p=>`${t}-${y(p)}`),g=await this.#p({path:o,method:n,operation:e,requestBodySchemasKeys:l,responseSchemasKeys:u,description:s,parentKey:t,parentVersion:a,parentRevision:r,rbacTeams:c});return g&&await Promise.all([this.#i(h,e.operationId??"",s.realRelativePath,s.hash,t,a,r),this.#m(f,e.operationId??"",s.realRelativePath,s.hash,t,a,r),this.#y({apiOperationKey:g.key,operationRelations:e["x-catalogRelations"],descriptionUniqueKey:t,description:s,parentVersion:a,parentRevision:r})]),i}async#i(e,o,n,s,t,a,r){return e.length===0||!o?[]:await this.#s(e,o,n,s,t,a,r)}async#m(e,o,n,s,t,a,r){return e.length===0||!o?[]:await this.#s(e,o,n,s,t,a,r)}#h(e,o){const n=[],s=[];try{if(e&&"content"in e&&e.content)for(const t of Object.values(e.content)){const a=this.#a(t,o);if(!a)continue;const r=this.#t(a);r?.componentType==="schemas"&&r.componentName&&n.push(r.componentName)}if(e&&e.$ref){const t=this.#t(e.$ref);if(t?.componentType==="requestBodies"&&t.componentName){const a=o.document.components?.requestBodies?.[t.componentName];if(a&&"content"in a)for(const r of Object.values(a.content??{})){const c=this.#a(r,o);if(!c)continue;const i=this.#t(c);i?.componentType==="schemas"&&i.componentName&&n.push(i.componentName)}}}}catch(t){s.push(`Failed to extract request body schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(n)],errors:s}}#l(e,o){const n=[],s=[];try{for(const t of Object.values(e)){if(t&&"content"in t&&t.content)for(const a of Object.values(t.content)){const r=this.#a(a,o);if(!r)continue;const c=this.#t(r);c?.componentType==="schemas"&&c.componentName&&n.push(c.componentName)}if(t&&t.$ref){const a=this.#t(t.$ref);if(a?.componentType==="responses"&&a.componentName){const r=o.document.components?.responses?.[a.componentName];if(r&&"content"in r)for(const c of Object.values(r.content??{})){const i=this.#a(c,o);if(!i)continue;const m=this.#t(i);m?.componentType==="schemas"&&m.componentName&&n.push(m.componentName)}}}}}catch(t){s.push(`Failed to extract response schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(n)],errors:s}}#a(e,o){const n=new Set;let s=e;for(;s&&"$ref"in s;){const t=this.#t(s.$ref),a=t?.componentName;if(t?.componentType!=="mediaTypes"||!a||n.has(a))return;n.add(a),s=o.document.components?.mediaTypes?.[a]}return s?.schema?.$ref}#t(e){try{return N(e)}catch{return{componentType:"",componentName:null}}}async#s(e,o,n,s,t,a,r){return e.length===0?[]:await E(e,v,async c=>await this.#f({operationId:o,schemaName:c,descriptionSourceFile:n,descriptionHash:s,parentKey:t,parentVersion:a,parentRevision:r}))}async#f({operationId:e,schemaName:o,descriptionSourceFile:n,descriptionHash:s,parentKey:t,parentVersion:a,parentRevision:r}){const c=`${t}-${y(o)}`;try{return await this.catalogEntitiesService.createEntityRelation({sourceKey:`${t}-${y(e)}`,type:"uses",targetKey:c,sourceFile:n,fileHash:s,sourceVersion:a,targetVersion:a,sourceRevision:r,targetRevision:r}),c}catch(i){throw this.#e.error(`Failed to create relation between operation ${e} and schema ${o}: ${i instanceof Error?i.message:"Unknown error"}`),i}}async#p({path:e,method:o,operation:n,requestBodySchemasKeys:s,responseSchemasKeys:t,description:a,parentKey:r,parentVersion:c,parentRevision:i,rbacTeams:m}){const h=`${n.operationId}`,f=`${r}-${y(h)}`,l=n[R]?$(n[R]):m,u=$(n["x-rbac"]),g={type:"api-operation",key:f,title:h,summary:S(n.summary),tags:n.tags?.filter(p=>d(p)),metadata:{path:e,method:o,payload:s,responses:t},version:c};try{return await this.catalogEntitiesService.createEntity({entity:g,sourceFile:a.realRelativePath,fileHash:a.hash,rbacTeams:u.length>0?u:l,source:"file",revision:i})}catch(p){return this.#e.error(`Failed to create API operation entity for ${h}: ${p instanceof Error?p.message:"Unknown error"}`),null}}async#y({apiOperationKey:e,operationRelations:o,descriptionUniqueKey:n,description:s,parentVersion:t,parentRevision:a}){try{await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:"partOf",targetKey:n,sourceFile:s.realRelativePath,fileHash:s.hash,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),await this.#u(e,s,o,t,a)}catch(r){this.#e.error(`Failed to create API operation relations for ${e}: ${r instanceof Error?r.message:"Unknown error"}`)}}async#u(e,o,n,s,t){n?.length&&await E(n,T,async a=>{try{this.validateEntityRelationFileSchema(a),await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:a.type,targetKey:a.key,sourceFile:o.realRelativePath,fileHash:o.hash,sourceVersion:s,targetVersion:"",sourceRevision:t,targetRevision:""})}catch(r){this.context.logger.warn(`Error creating entity relation for operation ${e} based on custom property: ${r instanceof Error?r.message:"Unknown error"}`)}})}}export{V as OpenApiEntitiesExtractor};
@@ -1 +1 @@
1
- function s(a){const n=/^#\/channels\/(?<channelName>.+)\/messages\/(?<messageName>.+)$/,e=a.match(n);return!e||!e.groups?null:{channelName:e?.groups?.channelName??null,messageName:e?.groups?.messageName??null}}export{s as extractPartsFromChannelsMessageRef};
1
+ import{unescapePointerFragment as a}from"@redocly/openapi-core";function m(n){const s=/^#\/channels\/(?<channelName>.+)\/messages\/(?<messageName>.+)$/,e=n.match(s);return!e||!e.groups?null:{channelName:a(e.groups.channelName),messageName:a(e.groups.messageName)}}export{m as extractPartsFromChannelsMessageRef};
@@ -1 +1 @@
1
- import{readFileSync as g}from"fs";import{join as j}from"path";import{isLocalLink as p}from"../../../utils/path/is-local-link.js";import{copyStaticFile as x}from"../../utils/fs.js";async function T(n,t){return m(n,"src",(e,o)=>`<script ${e}>${o}</script>`,t)}async function b(n,t){return m(n,"href",e=>`<link ${e} />`,{...t,defaultAttrs:{rel:"stylesheet"}})}async function m(n=[],t,e,{contentDir:o,outdir:y,defaultAttrs:h={},consentEnabled:d=!1}){if(!Array.isArray(n)||!n.length)return"";const c=[];for(const i of n){const C=typeof i=="string"?{[t]:i}:{...i},{src:$,href:k,inline:a,consent:l,...s}=C;l&&d&&t==="src"&&(s["data-consent"]=l,s.type&&(s["data-consent-type"]=s.type),s.type="text/plain");let r=t==="href"?k:$,u="";if(p(r)&&!a){const f=await x(o,r,y);if(!f)continue;r=f}else p(r)&&a&&(u=g(j(o,r),"utf-8"),r=!1);const S=F({...h,...s,[t]:r});c.push(e(S,u))}return c.join("")}function F(n){const t=[];for(let e in n){const o=n[e];o!==!1&&(o===!0?t.push(e):t.push(`${e}="${o}"`))}return t.join(" ")}export{b as formatCustomLinks,T as formatCustomScripts};
1
+ import{readFileSync as g}from"fs";import{join as j}from"path";import{isLocalLink as p}from"../../../utils/path/is-local-link.js";import{copyStaticFile as x}from"../../utils/fs.js";async function T(n,t){return m(n,"src",(e,o)=>`<script ${e}>${o}</script>`,t)}async function b(n,t){return m(n,"href",e=>`<link ${e} />`,{...t,defaultAttrs:{rel:"stylesheet"}})}async function m(n=[],t,e,{contentDir:o,outdir:y,defaultAttrs:h={},consentEnabled:d=!1}){if(!Array.isArray(n)||!n.length)return"";const c=[];for(const i of n){const C=typeof i=="string"?{[t]:i}:{...i},{src:$,href:k,inline:a,consent:l,...s}=C;l&&d&&t==="src"&&(s["data-consent"]=l,s.type&&(s["data-consent-type"]=s.type),s.type="text/plain");let r=t==="href"?k:$,u="";if(p(r)&&!a){const f=await x(o,r,y);if(!f)continue;r=f}else p(r)&&a&&(u=g(j(o,r),"utf-8"),r=!1);const S=F({...h,...s,[t]:r});c.push(e(S,u))}return c.join("")}function F(n){const t=[];for(const e in n){const o=n[e];o!==!1&&(o===!0?t.push(e):t.push(`${e}="${o}"`))}return t.join(" ")}export{b as formatCustomLinks,T as formatCustomScripts};
@@ -1 +1 @@
1
- import f from"path";import{combineUrls as S}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as b}from"../../../constants/common.js";import{removeTrailingSlash as v}from"../../../../utils/url/remove-trailing-slash.js";import{slash as E}from"../../../../utils/path/slash.js";import{logger as m}from"../../../tools/notifiers/logger.js";import{getDefaultVersionByPath as I}from"./versions-config-loader.js";import{GithubSlugger as N,slug as h}from"../../../utils/index.js";import{isPartial as z}from"../../markdown/is-partial.js";import{parseBaseName as T}from"../../utils.js";const j=new Set([".jpg",".jpeg",".png",".gif",".webp",".svg",".ico",".avif",".mp3",".wav",".ogg",".m4a",".mp4",".avi",".mov",".webm",".pdf",".doc",".docx",".zip",".rar",".gz",".ttf",".woff",".woff2"]),U=async(i,{fs:s,cache:r,getConfig:l})=>{const t=m.startTiming(),g=(await r.load("versions-config","versions-config")).data,{markdown:u}=await l(),o=u?.partialsFolders??[],e=new Map,n=new Map,c=new Set,d={pageVsPage:0,dirVsDir:0},D=new N;n.set(".","/"),n.set("/","/");const w=s.scan().sort((a,p)=>p.relativePath.localeCompare(a.relativePath));for(const{relativePath:a}of w){if(j.has(f.posix.extname(a)))continue;const{data:p}=await r.load(a,"is-ignored");if(p||f.posix.extname(a)===".md"&&z(a,o))continue;const F=E(a).replace(new RegExp("^(@i18n|@l10n)\\/"),""),V=I(a,g);y(F,{defaultVersion:V,fileSlugs:e,dirSlugs:n,allFileSlugsList:c,githubSlugger:D,collisions:d})}return m.verboseTime(t,"Calculated slugs. Number of file paths processed: "+w.length),{fileSlugs:e,dirSlugs:n,collisions:d}};function y(i,s){const r=s.fileSlugs.get(i);if(r)return r;let l=f.posix.dirname(i);const t=L(l,s)||"",{baseName:g,isIndexFile:u}=T(i),o=s.dirSlugs.has(f.posix.join(l,g));let e;if(!u&&o){const n=h(S(t,g));s.allFileSlugsList.has(n)||(e=n)}if(!e){const n=u?s.dirSlugs.get(l):void 0;if(n)e=n;else{const c=S(t,g),d=h(c);e=s.githubSlugger.slug(c),e!==d&&(s.collisions.pageVsPage++,m.verbose("File slug collision: %s wanted %s, assigned %s",i,d,e))}}e=v(e),s.fileSlugs.set(i,e),s.allFileSlugsList.add(e)}function L(i,s){if(s.dirSlugs.has(i))return s.dirSlugs.get(i);const r=v(f.posix.normalize(i)).split("/");let l="/",t="";for(const g of r){t=f.posix.join(t,g);const u=P(g,s.defaultVersion);let o=s.dirSlugs.get(t);if(!o){const e=S("/",l,u),n=h(e);o=s.githubSlugger.slug(e),o!==n&&(s.collisions.dirVsDir++,m.verbose("Directory slug collision: %s wanted %s, assigned %s",t,n,o))}o.endsWith("/")||(o=o+"/"),s.dirSlugs.set(t,o),l=o}return s.dirSlugs.get(i)}function P(i,s){if(!i.startsWith(b))return i;const r=i.substring(b.length);return r===s?"":r}export{j as IGNORED_EXTS,U as contentSlugsLoader};
1
+ import f from"path";import{combineUrls as S}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as b}from"../../../constants/common.js";import{removeTrailingSlash as v}from"../../../../utils/url/remove-trailing-slash.js";import{slash as E}from"../../../../utils/path/slash.js";import{logger as m}from"../../../tools/notifiers/logger.js";import{getDefaultVersionByPath as I}from"./versions-config-loader.js";import{GithubSlugger as N,slug as h}from"../../../utils/index.js";import{isPartial as z}from"../../markdown/is-partial.js";import{parseBaseName as T}from"../../utils.js";const j=new Set([".jpg",".jpeg",".png",".gif",".webp",".svg",".ico",".avif",".mp3",".wav",".ogg",".m4a",".mp4",".avi",".mov",".webm",".pdf",".doc",".docx",".zip",".rar",".gz",".ttf",".woff",".woff2"]),U=async(i,{fs:s,cache:r,getConfig:l})=>{const t=m.startTiming(),g=(await r.load("versions-config","versions-config")).data,{markdown:u}=await l(),o=u?.partialsFolders??[],e=new Map,n=new Map,c=new Set,d={pageVsPage:0,dirVsDir:0},D=new N;n.set(".","/"),n.set("/","/");const w=s.scan().sort((a,p)=>p.relativePath.localeCompare(a.relativePath));for(const{relativePath:a}of w){if(j.has(f.posix.extname(a)))continue;const{data:p}=await r.load(a,"is-ignored");if(p||f.posix.extname(a)===".md"&&z(a,o))continue;const F=E(a).replace(new RegExp("^(@i18n|@l10n)\\/"),""),V=I(a,g);y(F,{defaultVersion:V,fileSlugs:e,dirSlugs:n,allFileSlugsList:c,githubSlugger:D,collisions:d})}return m.verboseTime(t,"Calculated slugs. Number of file paths processed: "+w.length),{fileSlugs:e,dirSlugs:n,collisions:d}};function y(i,s){const r=s.fileSlugs.get(i);if(r)return r;const l=f.posix.dirname(i),t=L(l,s)||"",{baseName:g,isIndexFile:u}=T(i),o=s.dirSlugs.has(f.posix.join(l,g));let e;if(!u&&o){const n=h(S(t,g));s.allFileSlugsList.has(n)||(e=n)}if(!e){const n=u?s.dirSlugs.get(l):void 0;if(n)e=n;else{const c=S(t,g),d=h(c);e=s.githubSlugger.slug(c),e!==d&&(s.collisions.pageVsPage++,m.verbose("File slug collision: %s wanted %s, assigned %s",i,d,e))}}e=v(e),s.fileSlugs.set(i,e),s.allFileSlugsList.add(e)}function L(i,s){if(s.dirSlugs.has(i))return s.dirSlugs.get(i);const r=v(f.posix.normalize(i)).split("/");let l="/",t="";for(const g of r){t=f.posix.join(t,g);const u=P(g,s.defaultVersion);let o=s.dirSlugs.get(t);if(!o){const e=S("/",l,u),n=h(e);o=s.githubSlugger.slug(e),o!==n&&(s.collisions.dirVsDir++,m.verbose("Directory slug collision: %s wanted %s, assigned %s",t,n,o))}o.endsWith("/")||(o=o+"/"),s.dirSlugs.set(t,o),l=o}return s.dirSlugs.get(i)}function P(i,s){if(!i.startsWith(b))return i;const r=i.substring(b.length);return r===s?"":r}export{j as IGNORED_EXTS,U as contentSlugsLoader};
@@ -1 +1 @@
1
- import v from"path";import{I18N_DIR_NAME as c,L10N_DIR_NAME as p,RESERVED_DIR_NAMES as u,VERSION_SEPARATOR as V,VERSIONED_FOLDER_REGEXP_MATCH as P}from"../../../constants/common.js";import{parsePathVersions as l}from"../../../../utils/path/parse-path-versions.js";import{compareVersions as g}from"../../../../utils/version/compare-versions.js";import{reporter as h}from"../../../tools/notifiers/reporter.js";import{logger as y}from"../../../tools/notifiers/logger.js";const A=async(i,{cache:r,fs:s})=>{const e=new Map,a=await s.scan();await E(a);for(const{relativePath:n}of a){if(v.posix.basename(n)==="versions.yaml"){await F(n,e,r);continue}const o=l(n);if(o==null||u.includes(V+o.versionName))continue;const t=e.get(o.versionFolderPath)||{versionedFiles:new Map,versions:[]},f=t.versionedFiles.get(o.filePathInVersion)||new Set,d={version:o.versionName};f.add(d.version),!t.hasVersionsConfig&&t.versions.findIndex(m=>m.version===o.versionName)===-1&&t.versions.push(d),t.versionedFiles.set(o.filePathInVersion,f),e.set(o.versionFolderPath,t)}return w(e)};async function F(i,r,s){let e=v.posix.dirname(i);e==="."?e="/":e=e.endsWith("/")?e:e+"/",e.startsWith(c+"/")&&(e=e.slice(c.length+1)),e.startsWith(p+"/")&&(e=e.slice(p.length+1));const n=(await s.load(i,"yaml")).data;n.versions&&!Array.isArray(n.versions)?(await h.panicOnBuild(`Property 'versions' must be an array at %rp. Got '${typeof n.versions}'.`,i),n.versions=[]):(!n.versions||n.versions.length===0)&&y.warn("Property 'versions' is empty at %rp. This is likely a mistake.",i);const o=r.get(e)||{versionedFiles:new Map,versions:[]};o.hasVersionsConfig=!0,o.versions=n.versions||[],n.default&&(o.defaultVersion=n.default),r.set(e,o)}async function E(i){const r=new Set;for(const{relativePath:s}of i){const e=l(s);if(!(e?.versionFolderPath&&u.includes(e?.versionFolderPath))){if(e?.versionFolderPath==null){(s.match(P)?.length||0)>1&&await h.panicOnBuild(`Nested versions are not supported. Detected nested versions in path: "${s}".`);continue}r.has(e.versionFolderPath)||r.add(e.versionFolderPath)}}}function w(i){for(let[r,s]of i){const e=s.hasVersionsConfig?s.versions:s.versions.sort((o,t)=>g(t.version,o.version)),a=s.hasVersionsConfig?e[e.length-1]:e[0],n=s.defaultVersion||a?.version;i.set(r,{...s,versions:e,defaultVersion:n})}return i}function S(i,r){const s=l(i);return s==null?null:r.get(s.versionFolderPath)?.defaultVersion}export{S as getDefaultVersionByPath,A as versionsConfigLoader};
1
+ import v from"path";import{I18N_DIR_NAME as c,L10N_DIR_NAME as p,RESERVED_DIR_NAMES as u,VERSION_SEPARATOR as V,VERSIONED_FOLDER_REGEXP_MATCH as P}from"../../../constants/common.js";import{parsePathVersions as l}from"../../../../utils/path/parse-path-versions.js";import{compareVersions as g}from"../../../../utils/version/compare-versions.js";import{reporter as h}from"../../../tools/notifiers/reporter.js";import{logger as y}from"../../../tools/notifiers/logger.js";const A=async(i,{cache:r,fs:s})=>{const e=new Map,a=await s.scan();await E(a);for(const{relativePath:n}of a){if(v.posix.basename(n)==="versions.yaml"){await F(n,e,r);continue}const o=l(n);if(o==null||u.includes(V+o.versionName))continue;const t=e.get(o.versionFolderPath)||{versionedFiles:new Map,versions:[]},f=t.versionedFiles.get(o.filePathInVersion)||new Set,d={version:o.versionName};f.add(d.version),!t.hasVersionsConfig&&t.versions.findIndex(m=>m.version===o.versionName)===-1&&t.versions.push(d),t.versionedFiles.set(o.filePathInVersion,f),e.set(o.versionFolderPath,t)}return w(e)};async function F(i,r,s){let e=v.posix.dirname(i);e==="."?e="/":e=e.endsWith("/")?e:e+"/",e.startsWith(c+"/")&&(e=e.slice(c.length+1)),e.startsWith(p+"/")&&(e=e.slice(p.length+1));const n=(await s.load(i,"yaml")).data;n.versions&&!Array.isArray(n.versions)?(await h.panicOnBuild(`Property 'versions' must be an array at %rp. Got '${typeof n.versions}'.`,i),n.versions=[]):(!n.versions||n.versions.length===0)&&y.warn("Property 'versions' is empty at %rp. This is likely a mistake.",i);const o=r.get(e)||{versionedFiles:new Map,versions:[]};o.hasVersionsConfig=!0,o.versions=n.versions||[],n.default&&(o.defaultVersion=n.default),r.set(e,o)}async function E(i){const r=new Set;for(const{relativePath:s}of i){const e=l(s);if(!(e?.versionFolderPath&&u.includes(e?.versionFolderPath))){if(e?.versionFolderPath==null){(s.match(P)?.length||0)>1&&await h.panicOnBuild(`Nested versions are not supported. Detected nested versions in path: "${s}".`);continue}r.has(e.versionFolderPath)||r.add(e.versionFolderPath)}}}function w(i){for(const[r,s]of i){const e=s.hasVersionsConfig?s.versions:s.versions.sort((o,t)=>g(t.version,o.version)),a=s.hasVersionsConfig?e[e.length-1]:e[0],n=s.defaultVersion||a?.version;i.set(r,{...s,versions:e,defaultVersion:n})}return i}function S(i,r){const s=l(i);return s==null?null:r.get(s.versionFolderPath)?.defaultVersion}export{S as getDefaultVersionByPath,A as versionsConfigLoader};
@@ -1 +1 @@
1
- function u(s,r){const n=[["requiresLogin","rbac"]];let e=[];for(const t of n)if(t.filter(i=>o(s,i)).length>1){const i={ruleId:"configuration struct",severity:"error",message:`Properties '${t.join(", ")}' are mutually exclusive and can't be used together.`,location:[{source:r,pointer:`#/${t[0]}`}],suggest:[]};e.push(i)}return e}function o(s,r){return{rbac:e=>e&&Object.keys(e).length>=0,requiresLogin:e=>!!e}[r]?.(s[r])??s[r]!==void 0}export{u as resolveMutuallyExclusiveProps};
1
+ function u(s,r){const n=[["requiresLogin","rbac"]],e=[];for(const t of n)if(t.filter(i=>o(s,i)).length>1){const i={ruleId:"configuration struct",severity:"error",message:`Properties '${t.join(", ")}' are mutually exclusive and can't be used together.`,location:[{source:r,pointer:`#/${t[0]}`}],suggest:[]};e.push(i)}return e}function o(s,r){return{rbac:e=>e&&Object.keys(e).length>=0,requiresLogin:e=>!!e}[r]?.(s[r])??s[r]!==void 0}export{u as resolveMutuallyExclusiveProps};
@@ -1 +1 @@
1
- import s from"@redocly/ajv";import l from"ajv-formats";import{removeDeepProperty as c}from"../../../utils/object/remove-deep-property.js";function F(t,e){const i=JSON.parse(JSON.stringify(e)),a=d(t);return a(i||{})||(a.errors?.map(o=>o.instancePath.slice(1))?.forEach(o=>{const n=o.split("/");c(i,n)}),a(i||{})),i||{}}function d(t){if(!t.$id)return r.compile(t);const e=r.getSchema(t.$id);return e||(r.addSchema(t),r.compile(t))}const r=new s({strictSchema:!1,allowUnionTypes:!0,useDefaults:!0,allErrors:!0,discriminator:!0,strictTypes:!1,verbose:!0});l(r);export{r as ajv,F as safeParsePartial};
1
+ import s from"@redocly/ajv";import c from"ajv-formats";import{removeDeepProperty as d}from"../../../utils/object/remove-deep-property.js";function v(t,e){const i=JSON.parse(JSON.stringify(e)),a=l(t);if(!a(i||{})){for(const o of a.errors||[]){const n=o.instancePath.slice(1).split("/");o.keyword==="additionalProperties"&&o.instancePath!==""&&n.push(o.params.additionalProperty),d(i,n)}a(i||{})}return i||{}}function l(t){if(!t.$id)return r.compile(t);const e=r.getSchema(t.$id);return e||(r.addSchema(t),r.compile(t))}const r=new s({strictSchema:!1,allowUnionTypes:!0,useDefaults:!0,allErrors:!0,discriminator:!0,strictTypes:!1,verbose:!0});c(r);export{r as ajv,v as safeParsePartial};
@@ -1 +1 @@
1
- import{CONFIG_FILE_NAME as s}from"../../../constants/common.js";import{slash as l}from"../../../utils/path/slash.js";import{reporter as r}from"../../tools/notifiers/reporter.js";import{copyStaticFile as m,FileNotFoundError as c}from"../../utils/fs.js";import{resolveSrcSet as v}from"../../utils/resolve-src-set.js";import{resolveAssetPath as f}from"../../utils/resolve-asset-path.js";const p=["png","svg","ico"];async function u(e={},o,n,a){const t={...e};if(e.image)try{t.image=await f(e.image,a,{fromFileRelativePath:o,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.image": %rp',e.image):await r.panicOnBuild(`Cannot resolve "logo.image": %rp: ${i.message}`,e.image)}if(e.srcSet)try{t.srcSet=await v(e.srcSet,a,{fromFileRelativePath:s,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError(`Cannot resolve "logo.srcSet" "${e.srcSet}"`):await r.panicOnBuild(`Cannot resolve "logo.srcSet" "${e.srcSet}": ${i.message}`)}if(e.favicon)try{t.favicon=await f(e.favicon,a,{fromFileRelativePath:s,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.favicon": %rp',e.favicon):await r.panicOnBuild(`Cannot resolve "logo.favicon": %rp: ${i.message}`,e.favicon)}return t.favicon||(t.favicon=await w(n,a)),t}async function w(e,o){for(let n of p){const a=`favicon.${n}`,t=l(a);if(await o.exists(t))return m(o.cwd,a,e)}}export{u as resolveLogoConfig};
1
+ import{CONFIG_FILE_NAME as s}from"../../../constants/common.js";import{slash as m}from"../../../utils/path/slash.js";import{reporter as r}from"../../tools/notifiers/reporter.js";import{copyStaticFile as v,FileNotFoundError as c}from"../../utils/fs.js";import{resolveSrcSet as l}from"../../utils/resolve-src-set.js";import{resolveAssetPath as f}from"../../utils/resolve-asset-path.js";const p=["png","svg","ico"];async function u(e={},o,n,a){const t={...e};if(e.image)try{t.image=await f(e.image,a,{fromFileRelativePath:o,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.image": %rp',e.image):await r.panicOnBuild(`Cannot resolve "logo.image": %rp: ${i.message}`,e.image)}if(e.srcSet)try{t.srcSet=await l(e.srcSet,a,{fromFileRelativePath:s,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError(`Cannot resolve "logo.srcSet" "${e.srcSet}"`):await r.panicOnBuild(`Cannot resolve "logo.srcSet" "${e.srcSet}": ${i.message}`)}if(e.favicon)try{t.favicon=await f(e.favicon,a,{fromFileRelativePath:s,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.favicon": %rp',e.favicon):await r.panicOnBuild(`Cannot resolve "logo.favicon": %rp: ${i.message}`,e.favicon)}return t.favicon||(t.favicon=await w(n,a)),t}async function w(e,o){for(const n of p){const a=`favicon.${n}`,t=m(a);if(await o.exists(t))return v(o.cwd,a,e)}}export{u as resolveLogoConfig};