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

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 (329) hide show
  1. package/dist/bundler/build/output-metadata.js +1 -1
  2. package/dist/bundler/build/run.js +1 -1
  3. package/dist/bundler/build/theme-global-style-compiler.js +1 -0
  4. package/dist/bundler/build/theme-global-stylesheets.js +1 -0
  5. package/dist/bundler/build/vite-config.js +2 -2
  6. package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
  7. package/dist/bundler/dev/routes/source-sync-route.js +1 -1
  8. package/dist/bundler/dev/run.js +1 -1
  9. package/dist/bundler/dev/runtime-app.js +1 -1
  10. package/dist/bundler/dev/vite-chunk-url.js +1 -1
  11. package/dist/bundler/node-bundle.js +1 -0
  12. package/dist/bundler/runtime-files.js +1 -1
  13. package/dist/bundler/user-markdoc-schema.js +1 -1
  14. package/dist/bundler/vite-config.base.js +12 -12
  15. package/dist/cli/commands/build.js +1 -1
  16. package/dist/cli/commands/dev.js +1 -1
  17. package/dist/cli/commands/ingest.js +1 -1
  18. package/dist/cli/commands/translate.js +2 -2
  19. package/dist/cli/dev-console/index.js +1 -1
  20. package/dist/cli/log-output/index.js +1 -1
  21. package/dist/cli/validate-react-pages.js +1 -1
  22. package/dist/client/ApiAccess.js +3 -0
  23. package/dist/client/NavigationProgress.js +1 -1
  24. package/dist/client/ProductsProvider.js +1 -1
  25. package/dist/client/RouteErrorBoundary.js +1 -1
  26. package/dist/client/RuntimeLink.js +1 -1
  27. package/dist/client/ThemeGlobalStyle.js +1 -0
  28. package/dist/client/UnversionedVersionButton.js +1 -1
  29. package/dist/client/ai-search/use-ai-search.js +1 -1
  30. package/dist/client/analytics-page-view.js +1 -1
  31. package/dist/client/app.js +3 -3
  32. package/dist/client/client-entry.js +1 -1
  33. package/dist/client/contexts.js +1 -1
  34. package/dist/client/dev-problems/ProblemsBar.js +6 -6
  35. package/dist/client/dev-problems/ProblemsModal.js +15 -15
  36. package/dist/client/feedback.js +1 -1
  37. package/dist/client/l10n/use-l10n-config.js +1 -1
  38. package/dist/client/l10n/use-l10n-href.js +1 -1
  39. package/dist/client/l10n/use-translate.js +1 -1
  40. package/dist/client/products.js +1 -1
  41. package/dist/client/review/ReviewBar.js +61 -61
  42. package/dist/client/review/use-review.js +1 -1
  43. package/dist/client/sidebar/PoweredByRedocly.js +2 -2
  44. package/dist/client/sidebar/SidebarDataProvider.js +1 -1
  45. package/dist/client/sidebar/drilldown.js +1 -1
  46. package/dist/client/ssr.js +1 -1
  47. package/dist/client/telemetry/config.js +1 -1
  48. package/dist/client/telemetry/report-preload-failure.js +1 -0
  49. package/dist/client/templates/dev-login.js +4 -4
  50. package/dist/client/templates/unauthorized.js +5 -5
  51. package/dist/client/theme-global-css.js +1 -0
  52. package/dist/client/use-banner.js +1 -1
  53. package/dist/client/use-entity-revisions.js +1 -1
  54. package/dist/client/use-page-versions.js +1 -1
  55. package/dist/client/use-search.js +1 -1
  56. package/dist/client/webmcp/tools/shared.js +1 -1
  57. package/dist/client/webmcp/tools/site-tools.js +1 -1
  58. package/dist/client/webmcp/use-webmcp-tools.js +1 -1
  59. package/dist/content-layer/allowed-packages.js +1 -1
  60. package/dist/content-layer/config-schema.d.ts +5 -1
  61. package/dist/content-layer/config-schema.js +1 -1
  62. package/dist/content-layer/config.d.ts +6 -2
  63. package/dist/content-layer/config.js +1 -1
  64. package/dist/content-layer/database/adapters/node-sqlite-client.js +1 -1
  65. package/dist/content-layer/database/connection.js +1 -1
  66. package/dist/content-layer/database/entity-store.d.ts +9 -1
  67. package/dist/content-layer/database/entity-store.js +1 -1
  68. package/dist/content-layer/database/invalidation.js +26 -26
  69. package/dist/content-layer/database/origins.d.ts +2 -4
  70. package/dist/content-layer/database/origins.js +1 -1
  71. package/dist/content-layer/ingest/extract-all-phase.js +1 -1
  72. package/dist/content-layer/ingest/finalize-phase.js +1 -1
  73. package/dist/content-layer/ingest/hook-inputs.js +1 -1
  74. package/dist/content-layer/ingest/l10n-warnings.js +1 -1
  75. package/dist/content-layer/ingest/normalize-artifacts.js +1 -1
  76. package/dist/content-layer/ingest/rbac-teams.js +1 -1
  77. package/dist/content-layer/ingest/run.js +1 -1
  78. package/dist/content-layer/ingest/scan.d.ts +1 -1
  79. package/dist/content-layer/ingest/scan.js +1 -1
  80. package/dist/content-layer/ingest/search-sync.js +1 -1
  81. package/dist/content-layer/ingest/slugger/resolve-final-slugs.js +1 -1
  82. package/dist/content-layer/ingest/sync.js +1 -1
  83. package/dist/content-layer/link-checker/load-view.js +1 -1
  84. package/dist/content-layer/link-checker/validate.js +1 -1
  85. package/dist/content-layer/loaders/context.js +1 -1
  86. package/dist/content-layer/markdown/client/OpenapiTagComponents.js +2 -2
  87. package/dist/content-layer/markdown/client/dynamic-components.js +1 -1
  88. package/dist/content-layer/markdown/client/markdoc-components.js +2 -2
  89. package/dist/content-layer/markdown/client/markdown-text.js +1 -1
  90. package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
  91. package/dist/content-layer/markdown/constants/markdown-text-tag-set.js +1 -1
  92. package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
  93. package/dist/content-layer/markdown/nodes/fence.js +1 -1
  94. package/dist/content-layer/markdown/nodes/heading.js +1 -1
  95. package/dist/content-layer/markdown/nodes/table.js +1 -1
  96. package/dist/content-layer/markdown/resolve/ast.js +1 -1
  97. package/dist/content-layer/markdown/resolve/audience-tag.d.ts +1 -1
  98. package/dist/content-layer/markdown/resolve/audience-tag.js +1 -1
  99. package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.js +1 -1
  100. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.d.ts +1 -1
  101. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
  102. package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
  103. package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
  104. package/dist/content-layer/markdown/resolve/references.js +1 -1
  105. package/dist/content-layer/markdown/search/to-markdown.js +2 -2
  106. package/dist/content-layer/markdown/search/to-sections.js +1 -1
  107. package/dist/content-layer/markdown/server/render.js +1 -1
  108. package/dist/content-layer/markdown/service.js +1 -1
  109. package/dist/content-layer/markdown/tags/html.d.ts +4 -1
  110. package/dist/content-layer/markdown/tags/html.js +1 -1
  111. package/dist/content-layer/markdown/tags/partial.d.ts +7 -2
  112. package/dist/content-layer/markdown/tags/partial.js +1 -1
  113. package/dist/content-layer/markdown/tags/variant.js +1 -1
  114. package/dist/content-layer/markdown/types/service.d.ts +4 -0
  115. package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
  116. package/dist/content-layer/markdown/utils/reparse-example-fences.d.ts +4 -1
  117. package/dist/content-layer/markdown/utils/reparse-example-fences.js +1 -1
  118. package/dist/content-layer/markdown/utils/substitute-variables.js +1 -1
  119. package/dist/content-layer/markdown/utils/walk-markdoc-ast.d.ts +2 -2
  120. package/dist/content-layer/markdown/utils/walk-markdoc-ast.js +1 -1
  121. package/dist/content-layer/materialization/entity.js +1 -1
  122. package/dist/content-layer/materialization/materializer.js +1 -0
  123. package/dist/content-layer/materialization/static-files.js +1 -1
  124. package/dist/content-layer/plan-gates.d.ts +3 -2
  125. package/dist/content-layer/plan-gates.js +1 -1
  126. package/dist/content-layer/plugins/index.js +1 -1
  127. package/dist/content-layer/plugins/internal/api-docs/client/template.js +4 -4
  128. package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
  129. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.d.ts +2 -2
  130. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
  131. package/dist/content-layer/plugins/internal/api-docs/server/build-sidebar.js +1 -1
  132. package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.js +13 -13
  133. package/dist/content-layer/plugins/internal/api-docs/server/options.d.ts +4 -2
  134. package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
  135. package/dist/content-layer/plugins/internal/api-docs/server/search-documents.js +1 -1
  136. package/dist/content-layer/plugins/internal/api-docs/server/spec-download.js +1 -1
  137. package/dist/content-layer/plugins/internal/api-functions/index.js +1 -1
  138. package/dist/content-layer/plugins/internal/api-functions/server/access.js +1 -1
  139. package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
  140. package/dist/content-layer/plugins/internal/app-data/banner.js +1 -1
  141. package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
  142. package/dist/content-layer/plugins/internal/app-data/products.d.ts +2 -0
  143. package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
  144. package/dist/content-layer/plugins/internal/catalog-classic/client/use-catalog-classic.js +1 -1
  145. package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
  146. package/dist/content-layer/plugins/internal/index.js +1 -1
  147. package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
  148. package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
  149. package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
  150. package/dist/content-layer/plugins/internal/markdoc/server/shared.d.ts +1 -1
  151. package/dist/content-layer/plugins/internal/mcp/constants.d.ts +6 -0
  152. package/dist/content-layer/plugins/internal/mcp/constants.js +1 -1
  153. package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
  154. package/dist/content-layer/plugins/internal/mcp/ignored-routes.js +1 -1
  155. package/dist/content-layer/plugins/internal/mcp/index.js +1 -1
  156. package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
  157. package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
  158. package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
  159. package/dist/content-layer/plugins/internal/mcp/server/codemode/capabilities.js +3 -3
  160. package/dist/content-layer/plugins/internal/mcp/server/codemode/constants.js +1 -1
  161. package/dist/content-layer/plugins/internal/mcp/server/codemode/discover.js +1 -1
  162. package/dist/content-layer/plugins/internal/mcp/server/codemode/execute-schema.js +1 -1
  163. package/dist/content-layer/plugins/internal/mcp/server/codemode/execution-budget.js +1 -0
  164. package/dist/content-layer/plugins/internal/mcp/server/codemode/index.js +1 -1
  165. package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
  166. package/dist/content-layer/plugins/internal/mcp/server/codemode/read-result.js +1 -0
  167. package/dist/content-layer/plugins/internal/mcp/server/codemode/return-last-expression.js +6 -0
  168. package/dist/content-layer/plugins/internal/mcp/server/codemode/returns-from-top-level.js +1 -0
  169. package/dist/content-layer/plugins/internal/mcp/server/codemode/sandbox.js +1 -1
  170. package/dist/content-layer/plugins/internal/mcp/server/codemode/tool-declarations.js +4 -0
  171. package/dist/content-layer/plugins/internal/mcp/server/codemode/tool-list.js +1 -1
  172. package/dist/content-layer/plugins/internal/mcp/server/codemode/unknown-tool-hint.js +3 -0
  173. package/dist/content-layer/plugins/internal/mcp/server/config-gate.js +1 -1
  174. package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
  175. package/dist/content-layer/plugins/internal/mcp/server/gateway/__tests__/secret-store-fixture.js +1 -0
  176. package/dist/content-layer/plugins/internal/mcp/server/gateway/api-call-operations.js +1 -1
  177. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +1 -1
  178. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/site-branding.js +1 -1
  179. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
  180. package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +7 -7
  181. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-bridge.js +1 -1
  182. package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
  183. package/dist/content-layer/plugins/internal/mcp/server/gateway/secret-store.js +1 -1
  184. package/dist/content-layer/plugins/internal/mcp/server/gateway/subject.js +1 -1
  185. package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
  186. package/dist/content-layer/plugins/internal/mcp/server/gateway/upstream-auth-scheme.js +2 -2
  187. package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
  188. package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
  189. package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
  190. package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
  191. package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
  192. package/dist/content-layer/plugins/internal/mcp/server/rate-limit.js +1 -1
  193. package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
  194. package/dist/content-layer/plugins/internal/mcp/server/server-info.js +1 -1
  195. package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
  196. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql-catalog.js +1 -1
  197. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql-constants.js +1 -0
  198. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql-document.js +1 -1
  199. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql.js +1 -1
  200. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-catalog.js +1 -1
  201. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-document.js +1 -1
  202. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-refs.js +1 -1
  203. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi.js +1 -1
  204. package/dist/content-layer/plugins/internal/mcp/server/tools/pages-constants.js +1 -0
  205. package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
  206. package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +3 -3
  207. package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -0
  208. package/dist/content-layer/plugins/internal/mcp/server/tools/search.js +1 -1
  209. package/dist/content-layer/plugins/internal/mcp/server/tools/submit-feedback.js +1 -1
  210. package/dist/content-layer/plugins/internal/mcp/server/tools/whoami.js +1 -1
  211. package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
  212. package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
  213. package/dist/content-layer/plugins/internal/scorecard-classic/client/Grid.js +11 -11
  214. package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardViews.js +1 -1
  215. package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardWidgets.js +7 -7
  216. package/dist/content-layer/plugins/internal/scorecard-classic/client/template.js +2 -2
  217. package/dist/content-layer/plugins/internal/scorecard-classic/index.js +1 -1
  218. package/dist/content-layer/plugins/internal/sidebar/bundle.d.ts +1 -1
  219. package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
  220. package/dist/content-layer/plugins/internal/sidebar/index.d.ts +1 -1
  221. package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
  222. package/dist/content-layer/plugins/internal/skills/index.js +1 -1
  223. package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
  224. package/dist/content-layer/plugins/project/load.js +2 -2
  225. package/dist/content-layer/plugins/registry.js +1 -1
  226. package/dist/content-layer/plugins/request-context.d.ts +5 -0
  227. package/dist/content-layer/plugins/types/api-entity.d.ts +2 -6
  228. package/dist/content-layer/plugins/types/api-entity.js +1 -1
  229. package/dist/content-layer/plugins/types/plugin.d.ts +8 -0
  230. package/dist/content-layer/plugins/types/search.d.ts +1 -1
  231. package/dist/content-layer/plugins/utils/link-access.js +1 -1
  232. package/dist/content-layer/plugins/utils/route-index.d.ts +1 -1
  233. package/dist/content-layer/plugins/utils/route-index.js +1 -1
  234. package/dist/content-layer/plugins/utils/version-path.js +1 -1
  235. package/dist/content-layer/revisions/config.js +1 -1
  236. package/dist/content-layer/server/context.js +1 -1
  237. package/dist/content-layer/server/materialize.js +1 -1
  238. package/dist/content-layer/static/audience.js +1 -1
  239. package/dist/content-layer/static/registry.js +1 -1
  240. package/dist/content-layer/templates/template-set.js +1 -1
  241. package/dist/content-layer/versions/redirect.d.ts +11 -6
  242. package/dist/content-layer/versions/redirect.js +1 -1
  243. package/dist/content-layer/versions/resolve.js +1 -1
  244. package/dist/plugin-api.d.ts +3 -0
  245. package/dist/plugin-api.js +1 -1
  246. package/dist/server/__tests__/rbac-fixture.js +1 -1
  247. package/dist/server/app.js +3 -3
  248. package/dist/server/ask-ai/feature-gate.js +1 -1
  249. package/dist/server/ask-ai/route.js +1 -1
  250. package/dist/server/auth/gate.js +1 -1
  251. package/dist/server/auth/middleware.js +1 -1
  252. package/dist/server/auth/request.js +1 -1
  253. package/dist/server/auth/routes.js +1 -1
  254. package/dist/server/auth/runtime.js +1 -1
  255. package/dist/server/content-assets/access.js +1 -1
  256. package/dist/server/content.js +12 -12
  257. package/dist/server/cors-proxy/handler.js +1 -1
  258. package/dist/server/feedback/route.js +1 -1
  259. package/dist/server/lambda-entry.js +1 -1
  260. package/dist/server/manifest-assets.js +4 -4
  261. package/dist/server/metrics/request-metrics.js +1 -1
  262. package/dist/server/node-entry.js +1 -1
  263. package/dist/server/plugin-context.js +1 -1
  264. package/dist/server/plugin-routes.js +1 -1
  265. package/dist/server/rbac/content-asset-access.js +1 -1
  266. package/dist/server/replay-oauth2/route.js +1 -1
  267. package/dist/server/review/route.js +1 -1
  268. package/dist/server/runtime-config.js +1 -1
  269. package/dist/server/search/route.js +1 -1
  270. package/dist/server/seo-tags.js +2 -2
  271. package/dist/server/static-files/serve.js +1 -1
  272. package/dist/server/subprocess/runner.js +1 -1
  273. package/dist/server/telemetry/route.js +1 -1
  274. package/dist/server/template-ids.js +1 -1
  275. package/dist/shared/constants/api-spec-kinds.d.ts +6 -0
  276. package/dist/shared/constants/api-spec-kinds.js +1 -0
  277. package/dist/shared/constants/l10n/langs/ar.js +1 -1
  278. package/dist/shared/constants/l10n/langs/de.js +1 -1
  279. package/dist/shared/constants/l10n/langs/en.js +1 -1
  280. package/dist/shared/constants/l10n/langs/es.js +1 -1
  281. package/dist/shared/constants/l10n/langs/fr.js +1 -1
  282. package/dist/shared/constants/l10n/langs/hi.js +1 -1
  283. package/dist/shared/constants/l10n/langs/it.js +1 -1
  284. package/dist/shared/constants/l10n/langs/ja.js +1 -1
  285. package/dist/shared/constants/l10n/langs/ko.js +1 -1
  286. package/dist/shared/constants/l10n/langs/pl.js +1 -1
  287. package/dist/shared/constants/l10n/langs/pt-br.js +1 -1
  288. package/dist/shared/constants/l10n/langs/pt.js +1 -1
  289. package/dist/shared/constants/l10n/langs/ru.js +1 -1
  290. package/dist/shared/constants/l10n/langs/uk.js +1 -1
  291. package/dist/shared/constants/l10n/langs/zh.js +1 -1
  292. package/dist/{server → shared}/constants/system-routes.d.ts +1 -1
  293. package/dist/shared/constants/system-routes.js +1 -0
  294. package/dist/shared/plan-gates.d.ts +6 -1
  295. package/dist/shared/plan-gates.js +1 -1
  296. package/dist/shared/products.js +1 -1
  297. package/dist/{server → shared}/project-env.d.ts +1 -1
  298. package/dist/{server → shared}/rbac/api-docs.d.ts +1 -1
  299. package/dist/{server → shared}/rbac/engine.d.ts +1 -1
  300. package/dist/shared/rbac/engine.js +0 -0
  301. package/dist/shared/rbac/filter.js +1 -0
  302. package/dist/{server → shared}/rbac/l10n-rules.d.ts +1 -1
  303. package/dist/shared/rbac/l10n-rules.js +1 -0
  304. package/dist/shared/rbac/route-scope.js +1 -0
  305. package/dist/{server → shared}/rbac/team-templates.d.ts +6 -2
  306. package/dist/shared/rbac/team-templates.js +1 -0
  307. package/dist/{server → shared}/rbac/teams.d.ts +1 -1
  308. package/dist/shared/rbac/types.js +1 -0
  309. package/dist/shared/types/config.d.ts +2 -0
  310. package/dist/shared/utils/l10n.js +1 -1
  311. package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
  312. package/package.json +8 -10
  313. package/dist/content-layer/server/config.js +0 -1
  314. package/dist/server/constants/system-routes.js +0 -1
  315. package/dist/server/rbac/engine.js +0 -0
  316. package/dist/server/rbac/filter.js +0 -1
  317. package/dist/server/rbac/l10n-rules.js +0 -1
  318. package/dist/server/rbac/route-scope.js +0 -1
  319. package/dist/server/rbac/team-templates.js +0 -1
  320. package/dist/server/rbac/types.js +0 -1
  321. /package/dist/{server → shared}/project-env.js +0 -0
  322. /package/dist/{server → shared}/rbac/api-docs.js +0 -0
  323. /package/dist/{server → shared}/rbac/entity-scope.js +0 -0
  324. /package/dist/{server → shared}/rbac/filter.d.ts +0 -0
  325. /package/dist/{server → shared}/rbac/route-scope.d.ts +0 -0
  326. /package/dist/{server → shared}/rbac/teams.js +0 -0
  327. /package/dist/{server → shared}/rbac/types.d.ts +0 -0
  328. /package/dist/{content-layer/markdown → shared}/utils/packed-ast.d.ts +0 -0
  329. /package/dist/{content-layer/markdown → shared}/utils/packed-ast.js +0 -0
@@ -1 +1 @@
1
- import{loadContentLayerConfig as e}from"../../content-layer/config.js";import{ROUTE_SLUGS_FILENAME as t,RUNTIME_ROUTE_SLUGS_DIRNAME as n,RUNTIME_SSR_DIRNAME as r,serverModuleChunkPath as i}from"../../shared/constants/runtime-layout.js";import{resolveContentLayerContext as a}from"../../content-layer/context.js";import{openContentLayerDatabase as o}from"../../content-layer/database/connection.js";import{createEntityStore as s}from"../../content-layer/database/entity-store.js";import{createRouteIndex as c}from"../../content-layer/plugins/utils/route-index.js";import{createContentPlugins as l}from"../../content-layer/plugins/create-content-plugins.js";import"../../content-layer/plugins/index.js";import{listAssetSourcePaths as u}from"../../content-layer/database/assets.js";import{listProblems as d,summarizeStoredProblems as f}from"../../content-layer/database/problems.js";import{listRoutePagesByFile as p}from"../../content-layer/database/files.js";import"../../content-layer/server/database.js";import{loadContentLayerState as m}from"../../content-layer/context-state.js";import{compileAssetAudienceTable as h}from"../../content-layer/markdown/resolve/audience-tag.js";import{assertValidMcpToolFiles as g}from"../../content-layer/plugins/internal/mcp/build-check.js";import{pathToFileURL as _}from"node:url";import{dirname as v,join as y}from"node:path";import{mkdir as b,writeFile as x}from"node:fs/promises";const S=`build-metadata.json`;async function C(e){let t={},{access:n}=e.context.config;t.access={requiresLogin:n?.requiresLogin===!0,rbacConfigured:n?.rbac!==void 0};let r=await h(n?.rbac,await u(e.database));return r&&(t.contentAssetAudiences={schemaVersion:1,tags:r}),t.problems=await T(e.database),Object.assign(t,await E(e)),t}function w(e){let t=e.filePath===null?void 0:{filePath:e.filePath,...e.range===null?{}:{range:e.range},...e.snippet===null?{}:{snippet:e.snippet}};return{code:e.code,category:e.category,severity:e.severity,message:e.message,...t===void 0?{}:{location:t},data:e.data}}async function T(e,{limit:t=1e4}={}){let n=await f(e),r=await d(e,{limit:t});return{schemaVersion:1,summary:{...n,truncated:n.errors+n.warnings>t},problems:r.map(w)}}async function E(e){let{context:t,database:n}=e,r=await m({context:t,database:n}),i=c(r,t.config),a=s({database:n,state:r}),o={};for(let e of t.pluginRegistry.listBuildMetadataPlugins()){let n=await e.buildMetadata?.({config:t.config,routes:i,entities:a,logger:t.logger.child(`content-layer:build-metadata:${e.id}`)});n!==void 0&&(o[e.id]=n)}return o}async function D(e){let{context:t,database:n,outputDir:a}=e,o=await m({context:t,database:n}),c=s({database:n,state:o}),l=y(a,r);await g({entities:c,loadContentModule:async e=>{let t=y(l,i(e));return await import(_(t).href)},pluginToolNames:t.pluginRegistry.listMcpTools().map(e=>e.declaration.name),...e.logger?{logger:e.logger}:{}})}async function O(e,r){let i=y(r,n,t);await b(v(i),{recursive:!0});let a=await p(e);await x(i,JSON.stringify(Object.fromEntries(a)),`utf8`)}async function k(t){let n=a({contentDir:t.contentDir,context:t.context,logger:t.logger,plugins:l(t.contentDir)});await e({context:n});let r=t.database??await o({contentDir:t.contentDir,databaseUrl:t.databaseUrl,logger:t.logger,runMigrations:!1});try{await D({database:r,context:n,outputDir:t.outputDir,...t.logger?{logger:t.logger}:{}});let e={formatVersion:1,sections:await C({database:r,context:n,logger:t.logger})},i=y(t.outputDir,S);return await x(i,`${JSON.stringify(e,null,2)}\n`,`utf8`),await O(r,t.outputDir),i}finally{t.database||await r.close()}}export{S as BUILD_OUTPUT_METADATA_FILENAME,C as collectBuildOutputMetadataSections,T as collectProblemsSection,k as writeBuildOutputMetadata};
1
+ import{ROUTE_SLUGS_FILENAME as e,RUNTIME_ROUTE_SLUGS_DIRNAME as t,RUNTIME_SSR_DIRNAME as n,serverModuleChunkPath as r}from"../../shared/constants/runtime-layout.js";import{loadContentLayerConfig as i}from"../../content-layer/config.js";import{resolveContentLayerContext as a}from"../../content-layer/context.js";import{openContentLayerDatabase as o}from"../../content-layer/database/connection.js";import{createEntityStore as s}from"../../content-layer/database/entity-store.js";import{createRouteIndex as c}from"../../content-layer/plugins/utils/route-index.js";import{createContentPlugins as l}from"../../content-layer/plugins/create-content-plugins.js";import"../../content-layer/plugins/index.js";import{listAssetSourcePaths as u}from"../../content-layer/database/assets.js";import{listProblems as d,summarizeStoredProblems as f}from"../../content-layer/database/problems.js";import{listRoutePagesByFile as p}from"../../content-layer/database/files.js";import"../../content-layer/server/database.js";import{assertValidMcpToolFiles as m}from"../../content-layer/plugins/internal/mcp/build-check.js";import{compileAssetAudienceTable as h}from"../../content-layer/markdown/resolve/audience-tag.js";import{loadContentLayerState as g}from"../../content-layer/context-state.js";import{pathToFileURL as _}from"node:url";import{dirname as v,join as y}from"node:path";import{mkdir as b,writeFile as x}from"node:fs/promises";const S=`build-metadata.json`;async function C(e){let t={},{access:n}=e.context.config;t.access={requiresLogin:n?.requiresLogin===!0,rbacConfigured:n?.rbac!==void 0};let r=await h(n?.rbac,await u(e.database));return r&&(t.contentAssetAudiences={schemaVersion:1,tags:r}),t.problems=await T(e.database),Object.assign(t,await E(e)),t}function w(e){let t=e.filePath===null?void 0:{filePath:e.filePath,...e.range===null?{}:{range:e.range},...e.snippet===null?{}:{snippet:e.snippet}};return{code:e.code,category:e.category,severity:e.severity,message:e.message,...t===void 0?{}:{location:t},data:e.data}}async function T(e,{limit:t=1e4}={}){let n=await f(e),r=await d(e,{limit:t});return{schemaVersion:1,summary:{...n,truncated:n.errors+n.warnings>t},problems:r.map(w)}}async function E(e){let{context:t,database:n}=e,r=await g({context:t,database:n}),i=c(r,t.config),a=s({database:n,state:r}),o={};for(let e of t.pluginRegistry.listBuildMetadataPlugins()){let n=await e.buildMetadata?.({config:t.config,routes:i,entities:a,logger:t.logger.child(`content-layer:build-metadata:${e.id}`)});n!==void 0&&(o[e.id]=n)}return o}async function D(e){let{context:t,database:i,outputDir:a}=e,o=await g({context:t,database:i}),c=s({database:i,state:o}),l=y(a,n);await m({entities:c,loadContentModule:async e=>{let t=y(l,r(e));return await import(_(t).href)},pluginToolNames:t.pluginRegistry.listMcpTools().map(e=>e.declaration.name),...e.logger?{logger:e.logger}:{}})}async function O(n,r){let i=y(r,t,e);await b(v(i),{recursive:!0});let a=await p(n);await x(i,JSON.stringify(Object.fromEntries(a)),`utf8`)}async function k(e){let t=a({contentDir:e.contentDir,context:e.context,logger:e.logger,plugins:l(e.contentDir)});await i({context:t});let n=e.database??await o({contentDir:e.contentDir,databaseUrl:e.databaseUrl,logger:e.logger,runMigrations:!1});try{await D({database:n,context:t,outputDir:e.outputDir,...e.logger?{logger:e.logger}:{}});let r={formatVersion:1,sections:await C({database:n,context:t,logger:e.logger})},i=y(e.outputDir,S);return await x(i,`${JSON.stringify(r,null,2)}\n`,`utf8`),await O(n,e.outputDir),i}finally{e.database||await n.close()}}export{S as BUILD_OUTPUT_METADATA_FILENAME,C as collectBuildOutputMetadataSections,T as collectProblemsSection,k as writeBuildOutputMetadata};
@@ -1 +1 @@
1
- import{formatCount as e}from"../../shared/log-format.js";import{createLogger as t}from"../../shared/logger.js";import{loadContentLayerConfig as n}from"../../content-layer/config.js";import{resolveContentLayerContext as r}from"../../content-layer/context.js";import{openContentLayerDatabase as i}from"../../content-layer/database/connection.js";import{createRouteIndex as a}from"../../content-layer/plugins/utils/route-index.js";import{MaterializationError as o}from"../../content-layer/problems/problem-error.js";import{createContentPlugins as s}from"../../content-layer/plugins/create-content-plugins.js";import"../../content-layer/plugins/index.js";import{silentReporter as c}from"../../shared/reporter.js";import{loadStaleEntityRecords as l}from"../../content-layer/database/entities.js";import{listStaticFileRecords as u}from"../../content-layer/database/static-files.js";import{loadContentLayerState as d,reloadContentLayerEntities as f}from"../../content-layer/context-state.js";import{garbageCollectOrphanAssetFiles as p}from"../../content-layer/materialization/asset-reconcile.js";import{materializeEntityByKey as m}from"../../content-layer/materialization/entity.js";import{createBuildTimeEntityLoaderContextFactory as h}from"../../content-layer/loaders/context.js";import{runSearchSync as g}from"../../content-layer/ingest/search-sync.js";import{resolveRevisionsConfig as _}from"../../content-layer/revisions/config.js";import{collectStaticProducerKeys as v,materializeStaticProducers as y}from"../../content-layer/materialization/static-files.js";import{promiseMapLimit as b}from"../../shared/utils/promise-map-limit.js";import{createStaticAudienceResolver as x}from"../../content-layer/static/audience.js";var S=class extends Error{name=`BuildOptionsError`};function C(e,t){if(t===`aws-lambda`&&e===`local`)throw new S(`--platform aws-lambda is incompatible with --target local. Lambda has a read-only, ephemeral filesystem; use --target cloud (a Realm DB database).`)}async function w(e){let n=e.platform??`nodejs`;C(e.target,n);let r=(e.logger??t()).child(`runtime:build`),{buildRuntime:i}=await import(`./vite-config.js`),a=await i({contentDir:e.contentDir,target:e.target,platform:n,logger:r,reporter:e.reporter??c,templateSet:e.templateSet,serverModuleSet:e.serverModuleSet,devLogin:e.devLogin??!1});return r.debug(`Built runtime`,{outputDir:a.outputDir,target:e.target,platform:n}),a}async function T(t){let m=r({contentDir:t.contentDir,context:t.context,logger:t.logger,plugins:s(t.contentDir)}),h=m.logger.child(`content-layer:entity`);await n({context:m});let _=t.database===void 0,S=t.database??await i({contentDir:m.contentDir,databaseUrl:t.databaseUrl,logger:h,migrationsDir:t.migrationsDir,runMigrations:t.runMigrations,platform:m.platform});try{let n=await d({context:m,database:S}),r=await l(S),i=await u(S),s=v(i),_=r.filter(e=>e.kind!==`inline`&&e.loaderId!==null&&m.pluginRegistry.getEntityLoaderById(e.loaderId)!==void 0),C=_.filter(e=>!s.has(e.key)),w=_.filter(e=>s.has(e.key)),T=E(m,S),D=t.reporter??c,O=C.length;await D.run(`Preparing content items`,async e=>{let t=0,n=0;await b(C,8,async r=>{let i=Date.now();try{await T(r),h.debug(`materialized ${r.key} (+${Date.now()-i}ms)`)}catch(e){if(!(e instanceof o))throw e;n+=1,h.debug(`Could not materialize ${r.key}; recorded the problem`)}t+=1,e.progress(t,O)});let r=await p(m.pluginIO,{contentDir:m.contentDir,database:S,logger:h});return r.removedRows>0&&h.debug(`post-materialize asset GC removed orphan assets`,{count:r.removedRows,swept:r.sweptFilenames.length}),n},t=>{if(O===0)return`All content items are prepared`;let n=`Prepared ${e(O-t)} content ${O-t===1?`item`:`items`}`;return t>0?`${n} (${e(t)} failed)`:n}),O>0&&await f({state:n,database:S,keys:C.map(e=>e.key)});let k=await D.run(`Indexing search`,e=>g({context:m,database:S,inlineSearchables:t.inlineSearchables,onProgress:(t,n)=>e.progress(t,n)}),t=>`Indexed ${e(t.synced)} content ${t.synced===1?`item`:`items`} for search`);return await D.run(`Writing static files`,()=>y({io:m.pluginIO,contentDir:m.contentDir,database:S,rows:i,staleProducers:w,materializeEntity:T,resolveAudience:x({config:m.config,routes:a(n,m.config)}),logger:h}),t=>`Wrote ${e(t.files.length)} static ${t.files.length===1?`file`:`files`}`),{entityCount:O+w.length,problems:k.problems}}finally{_&&await S.close()}}function E(e,t){let n=_(e.config),r=n?{max:n.max,capture:!0,isTracked:n.isTracked}:void 0,i=h(e,t,{revisions:r});return async n=>{await m({database:t,key:n.key,loaderRegistry:e.pluginRegistry,loaderContextFactory:i,contentDir:e.contentDir,revisions:r,logger:e.logger});let a=e.state?.entitiesByKey.get(n.key);e.state&&a&&e.state.entitiesByKey.set(n.key,{...a,status:`ready`})}}export{S as BuildOptionsError,C as assertRuntimeBuildOptions,w as runBuild,T as runContentEntityBuild};
1
+ import{formatCount as e}from"../../shared/log-format.js";import{createLogger as t}from"../../shared/logger.js";import{loadContentLayerConfig as n}from"../../content-layer/config.js";import{resolveContentLayerContext as r}from"../../content-layer/context.js";import{openContentLayerDatabase as i}from"../../content-layer/database/connection.js";import{createRouteIndex as a}from"../../content-layer/plugins/utils/route-index.js";import{MaterializationError as o}from"../../content-layer/problems/problem-error.js";import{createContentPlugins as s}from"../../content-layer/plugins/create-content-plugins.js";import"../../content-layer/plugins/index.js";import{silentReporter as c}from"../../shared/reporter.js";import{promiseMapLimit as l}from"../../shared/utils/promise-map-limit.js";import{loadStaleEntityRecords as u}from"../../content-layer/database/entities.js";import{listStaticFileRecords as d}from"../../content-layer/database/static-files.js";import{garbageCollectOrphanAssetFiles as f}from"../../content-layer/materialization/asset-reconcile.js";import{collectStaticProducerKeys as p,materializeStaticProducers as m}from"../../content-layer/materialization/static-files.js";import{loadEntityMaterializer as h}from"../../content-layer/materialization/materializer.js";import{runSearchSync as g}from"../../content-layer/ingest/search-sync.js";import{createStaticAudienceResolver as _}from"../../content-layer/static/audience.js";var v=class extends Error{name=`BuildOptionsError`};function y(e,t){if(t===`aws-lambda`&&e===`local`)throw new v(`--platform aws-lambda is incompatible with --target local. Lambda has a read-only, ephemeral filesystem; use --target cloud (a Realm DB database).`)}async function b(e){let n=e.platform??`nodejs`;y(e.target,n);let r=(e.logger??t()).child(`runtime:build`),{buildRuntime:i}=await import(`./vite-config.js`),a=await i({contentDir:e.contentDir,target:e.target,platform:n,logger:r,reporter:e.reporter??c,templateSet:e.templateSet,serverModuleSet:e.serverModuleSet,devLogin:e.devLogin??!1});return r.debug(`Built runtime`,{outputDir:a.outputDir,target:e.target,platform:n}),a}async function x(t){let v=r({contentDir:t.contentDir,context:t.context,logger:t.logger,plugins:s(t.contentDir)}),y=v.logger.child(`content-layer:entity`);await n({context:v});let b=t.database===void 0,x=t.database??await i({contentDir:v.contentDir,databaseUrl:t.databaseUrl,logger:y,migrationsDir:t.migrationsDir,runMigrations:t.runMigrations,platform:v.platform});try{let n=await h({context:v,database:x,captureRevisions:!0}),{state:r}=n,i=await u(x),s=await d(x),b=p(s),S=i.filter(e=>e.kind!==`inline`&&e.loaderId!==null&&v.pluginRegistry.getEntityLoaderById(e.loaderId)!==void 0),C=S.filter(e=>!b.has(e.key)),w=S.filter(e=>b.has(e.key)),T=async e=>{await n.materialize(e.key)},E=t.reporter??c,D=C.length;await E.run(`Preparing content items`,async e=>{let t=0,n=0;await l(C,8,async r=>{let i=Date.now();try{await T(r),y.debug(`materialized ${r.key} (+${Date.now()-i}ms)`)}catch(e){if(!(e instanceof o))throw e;n+=1,y.debug(`Could not materialize ${r.key}; recorded the problem`)}t+=1,e.progress(t,D)});let r=await f(v.pluginIO,{contentDir:v.contentDir,database:x,logger:y});return r.removedRows>0&&y.debug(`post-materialize asset GC removed orphan assets`,{count:r.removedRows,swept:r.sweptFilenames.length}),n},t=>{if(D===0)return`All content items are prepared`;let n=`Prepared ${e(D-t)} content ${D-t===1?`item`:`items`}`;return t>0?`${n} (${e(t)} failed)`:n});let O=await E.run(`Indexing search`,e=>g({context:v,database:x,inlineSearchables:t.inlineSearchables,materializer:n,onProgress:(t,n)=>e.progress(t,n)}),t=>`Indexed ${e(t.synced)} content ${t.synced===1?`item`:`items`} for search`);return await E.run(`Writing static files`,()=>m({io:v.pluginIO,contentDir:v.contentDir,database:x,rows:s,staleProducers:w,materializeEntity:T,resolveAudience:_({config:v.config,routes:a(r,v.config)}),logger:y}),t=>`Wrote ${e(t.files.length)} static ${t.files.length===1?`file`:`files`}`),{entityCount:D+w.length,problems:O.problems}}finally{b&&await x.close()}}export{v as BuildOptionsError,y as assertRuntimeBuildOptions,b as runBuild,x as runContentEntityBuild};
@@ -0,0 +1 @@
1
+ import{createElement as e}from"react";import{ServerStyleSheet as t}from"styled-components";import{renderToStaticMarkup as n}from"react-dom/server";import{GlobalStyle as r}from"@redocly/theme/core/styles";const i=/^<style[^>]*>([\s\S]*)<\/style>$/;function a(a){let o=new t;try{return n(o.collectStyles(e(r,{palette:a}))),i.exec(o.getStyleTags().trim())?.[1]??``}finally{o.seal()}}export{a as compileThemeGlobalStyle};
@@ -0,0 +1 @@
1
+ import{toPosixPath as e}from"../../shared/utils/to-posix-path.js";import{BUILD_ASSETS_DIRNAME as t}from"../../shared/constants/runtime-layout.js";import{createNodePlatformFs as n}from"../../platform/node/fs.js";import{loadRedoclyConfig as r}from"../../content-layer/config.js";import{listConfiguredProducts as i}from"../../content-layer/products.js";import{productConfigPath as a,readProductConfig as o}from"../../content-layer/plugins/internal/app-data/products.js";import{bundleForNode as s}from"../node-bundle.js";import{createHash as c}from"node:crypto";import{fileURLToPath as l}from"node:url";import{extname as u,resolve as d}from"node:path";const f=l(new URL(`./theme-global-style-compiler${u(import.meta.url)}`,import.meta.url)),p=e(l(new URL(`../../client/theme-global-css${u(import.meta.url)}`,import.meta.url)));async function m(n){let{module:r}=await s({...n,input:f}),i=[...await h(n.contentDir)].map(e=>{let n=r.compileThemeGlobalStyle(e),i=c(`sha256`).update(n).digest(`hex`).slice(0,10);return{palette:e??``,href:`/${t}/theme-global-${e??`default`}-${i}.css`,source:n}}),a=!1;return{name:`realm-theme-global-stylesheets`,config:()=>({define:{__REALM_THEME_GLOBAL_STYLESHEETS__:JSON.stringify({"":i[0]?.href,...Object.fromEntries(i.map(({palette:e,href:t})=>[e,t]))})}}),configResolved(e){a=!e.build.ssr},load(t){if(a||e(t)!==p)return null;let n=Object.fromEntries(i.map(({href:e,source:t})=>[e,t]));return`export const themeGlobalCss = ${JSON.stringify(n)};`},generateBundle(){if(a)for(let{href:e,source:t}of i)this.emitFile({type:`asset`,fileName:e.slice(1),source:t})}}}async function h(e){let t=n(),{config:s}=await r(e,t),c=/* @__PURE__ */ new Set([s.palette]);for(let{folder:n}of i(s)){let r=a(n),i=d(e,r);if(!await t.exists(i))continue;let{palette:s}=o(await t.readFile(i),r);s&&c.add(s)}return c}export{m as createThemeGlobalStylesheetsPlugin};
@@ -1,2 +1,2 @@
1
- import{getPathPrefix as e}from"../../shared/path-prefix.js";import{formatBytes as t,formatCount as n}from"../../shared/log-format.js";import{toPosixPath as r}from"../../shared/utils/to-posix-path.js";import{discoverContentDependencyPolicy as i}from"../content-dependency-policy.js";import{getEnvFileDefaults as a}from"../../shared/public-env.js";import{BUILD_ASSETS_DIRNAME as o,CLIENT_TEMPLATE_KEYS_FILENAME as s,RUNTIME_CLIENT_DIRNAME as c,RUNTIME_HOST_CHUNKS_DIRNAME as l,RUNTIME_MANIFEST_FILENAME as u,RUNTIME_SSR_DIRNAME as d,RUNTIME_SSR_ENTRY_FILENAME as f,RUNTIME_SUBPROCESS_CHILD_FILENAME as p,getRuntimeOutputDir as m,serverModuleChunkPath as h}from"../../shared/constants/runtime-layout.js";import{resolveRuntimeEntryFiles as g,resolveRuntimeServerModuleFiles as _,resolveRuntimeTemplateFiles as v}from"../runtime-files.js";import{createResolvedTemplateSetProvider as ee}from"../../content-layer/templates/template-set.js";import{createEmptyServerModuleSet as y}from"../../content-layer/server-modules/module-set.js";import{VITE_LOG_STREAM as b}from"../../shared/constants/log-streams.js";import{DEV_LOGIN_DEFINE as x,ENV_FILE_DEFAULTS_DEFINE as S,PATH_PREFIX_DEFINE as C,REDOCLY_SSR_NO_EXTERNAL as w,TEMPLATE_IDS_DEFINE as T,createBaseViteConfig as E,createDefineValues as D,createThemeSourcePlugin as O,createViteCustomLogger as te}from"../vite-config.base.js";import{PLATFORM_CONFIG as ne}from"./constants/platform.js";import{createDependencyRecorder as re,writeDependencyPack as ie}from"./dependency-pack.js";import{createRequire as ae}from"node:module";import{fileURLToPath as oe}from"node:url";import{existsSync as k}from"node:fs";import{dirname as A,join as j,relative as M,resolve as N}from"node:path";import{mkdir as P,rm as F,writeFile as I}from"node:fs/promises";import{build as L}from"vite";async function R(e){let t=m(e.contentDir),n=j(t,c),r=j(t,d),i=j(r,f),a=j(n,`.vite`,`manifest.json`),o=j(t,u),s=g(e.contentDir),l=ee(e.templateSet),p=v(e.templateSet,e.contentDir);await P(t,{recursive:!0});let h=re();return await e.reporter.run(`Building client bundle`,()=>L(Y({contentDir:e.contentDir,logger:e.logger,entryFiles:s,templateSetProvider:l,variant:`client`,plugins:[h.plugin]})),e=>`Built client bundle ${$(e)}`),await e.reporter.run(`Building SSR bundle`,()=>L(Y({contentDir:e.contentDir,logger:e.logger,entryFiles:s,templateSetProvider:l,serverModuleSet:e.serverModuleSet,variant:`ssr`,plugins:[h.plugin]})),e=>`Built SSR bundle ${$(e)}`),await e.reporter.run(`Writing the dependency pack`,()=>q(e.contentDir,t,h.files,e.logger),e=>e?`Wrote the dependency pack: ${e.packages} packages, ${e.packedFiles} files, ${(e.bytes/1048576).toFixed(1)} MB`:`No dependency pack: the project declares no dependencies`),await z(t),await e.reporter.run(`Building server entry`,()=>L(Q({contentDir:e.contentDir,logger:e.logger,target:e.target,platform:e.platform,templateFiles:p,devLogin:e.devLogin})),e=>`Built server entry ${$(e)}`),await B(t),await I(o,JSON.stringify({target:e.target,platform:e.platform,clientDir:n,serverEntryPath:i,viteManifestPath:a},null,2)),{outputDir:t,clientDir:n,serverEntryPath:i,manifestPath:o,target:e.target,platform:e.platform,viteManifestPath:a}}async function z(e){await F(j(e,l),{recursive:!0,force:!0})}async function B(e){await I(j(e,`package.json`),`${JSON.stringify({type:`module`})}\n`)}const V=`\0realm-server-replay-stub`;function H(){return{name:`realm-server-replay-stub`,enforce:`pre`,resolveId(e){return e===`@redocly/replay`||e.startsWith(`@redocly/replay/`)?V:null},load(e){return e===V?[`const stub = (name) => () => {`,` throw new Error(`,` '@redocly/replay is excluded from server bundles (client-only); <' + name + '> cannot render on the server.',`,` );`,`};`,`export const EmbeddedReplay = stub('EmbeddedReplay');`,`export const ReplayOverlay = stub('ReplayOverlay');`].join(`
2
- `):null}}}function U(e,t){let n=``;return{name:`realm-template-manifest-keys`,configResolved(e){n=e.root},async generateBundle(){let i={};for(let a of v(await e.current(),t)){let e=await this.resolve(a.filePath);e&&(i[a.templateId]=r(M(n,e.id)))}this.emitFile({type:`asset`,fileName:`.vite/${s}`,source:JSON.stringify(i)})}}}const W=ae(import.meta.url),G=r(j(A(W.resolve(`@redocly/theme/package.json`)),`src/`));function K(e){return r(e).startsWith(G)}async function q(e,t,n,r){try{return await ie({contentDir:e,outputDir:t,recorded:n})}catch(e){return r.warn(`Dependency pack not written: ${e instanceof Error?e.message:String(e)}`),null}}const J=(e,t)=>{e.code===`EVAL`&&e.id&&r(e.id).includes(`/node_modules/`)||t(e)};function Y(e){let t=m(e.contentDir),n=e.variant===`client`,a=i(e.contentDir,{viteManagedDependencies:w}),s=E({contentDir:e.contentDir,logger:e.logger,templateSetProvider:e.templateSetProvider,serverModuleSet:e.serverModuleSet,enableLazyStaticData:n,styledComponentsDependencies:[...a.noExternal,...a.external],styledComponentsRoots:a.packageRoots}),l=new Map(_(e.serverModuleSet??y(),e.contentDir).map(e=>[r(e.filePath),h(e.key)]));return{configFile:!1,envDir:!1,...s,define:D({enableLazyStaticData:n,production:!0,themePathPrefixFromGlobal:!0}),plugins:[...s.plugins??[],...e.plugins??[],U(e.templateSetProvider,e.contentDir),...n?[]:[H()]],ssr:n?void 0:{noExternal:!0},experimental:{...s.experimental,renderBuiltUrl:(e,{hostType:t})=>t===`js`?{runtime:`(globalThis.__REALM_PATH_PREFIX__ ?? "") + ${JSON.stringify(`/${e}`)}`}:{relative:!0}},build:{copyPublicDir:!1,emptyOutDir:!0,...n?{assetsDir:o,chunkSizeWarningLimit:5e3,manifest:!0,outDir:j(t,c),rollupOptions:{input:e.entryFiles.clientEntryPath,onwarn:J,output:{assetFileNames:`${o}/[name]-[hash][extname]`,codeSplitting:{groups:[{name:`app`,tags:[`$initial`],priority:2},{name:`theme`,test:e=>K(e)&&!e.includes(`/markdoc/tags/`),minShareCount:2,priority:1}]}},treeshake:{moduleSideEffects:e=>!K(e)&&void 0}}}:{minify:!0,manifest:!0,outDir:j(t,d),rollupOptions:{external:[/^node:/],onwarn:J,output:{entryFileNames:f,chunkFileNames:e=>e.facadeModuleId&&l.get(e.facadeModuleId)||`assets/[name]-[hash].mjs`}},ssr:e.entryFiles.serverEntryPath}}}}const X=`subprocess-child`;function Z(e,t){let n=N(e,`${t}.ts`),r=N(e,`${t}.js`);if(k(n))return n;if(k(r))return r;throw Error(`Host entry source not found for "${t}". Expected one of: ${n}, ${r}.`)}function Q(t){let n=N(A(oe(import.meta.url)),`../../server`),{entryBasename:r,outputFilename:i}=ne[t.platform],o=Z(n,r),s=Z(n,`subprocess/child-entry`);return{configFile:!1,envDir:!1,appType:`custom`,clearScreen:!1,logLevel:t.logger.isDebugEnabled(`runtime:vite`)?`info`:`warn`,customLogger:te(t.logger.child(b)),define:{...D({enableLazyStaticData:!1,production:!0}),[T]:JSON.stringify(t.templateFiles.map(e=>e.templateId)),...e()?{[C]:JSON.stringify(e())}:{},[x]:JSON.stringify(t.devLogin===!0),[S]:JSON.stringify(a())},plugins:[H(),O()],publicDir:!1,root:t.contentDir,ssr:{noExternal:!0},build:{copyPublicDir:!1,emptyOutDir:!1,minify:!0,outDir:m(t.contentDir),rollupOptions:{input:{[r]:o,[X]:s},external:[/^node:/],treeshake:{moduleSideEffects:e=>!K(e)&&void 0},output:{entryFileNames:e=>e.name===X?p:i,chunkFileNames:`assets/[name]-[hash].mjs`}},ssr:!0,target:`node22`}}}function $(e){let r=Array.isArray(e)?e:`output`in e?[e]:[],i=0,a=0;for(let e of r.flatMap(e=>e.output)){i+=1;let t=e.type===`chunk`?e.code:e.source;a+=typeof t==`string`?Buffer.byteLength(t):t.byteLength}return`(${n(i)} ${i===1?`file`:`files`}, ${t(a)})`}export{R as buildRuntime,z as cleanStaleHostOutputs,Y as createBundleBuildConfig,Q as createHttpServerBuildConfig,H as createServerReplayStubPlugin,B as writeRuntimePackageManifest};
1
+ import{toPosixPath as e}from"../../shared/utils/to-posix-path.js";import{discoverContentDependencyPolicy as t}from"../content-dependency-policy.js";import{createResolvedTemplateSetProvider as n}from"../../content-layer/templates/template-set.js";import{getEnvFileDefaults as r}from"../../shared/public-env.js";import{BUILD_ASSETS_DIRNAME as i,CLIENT_TEMPLATE_KEYS_FILENAME as a,RUNTIME_CLIENT_DIRNAME as o,RUNTIME_HOST_CHUNKS_DIRNAME as s,RUNTIME_MANIFEST_FILENAME as c,RUNTIME_SSR_DIRNAME as l,RUNTIME_SSR_ENTRY_FILENAME as u,RUNTIME_SUBPROCESS_CHILD_FILENAME as d,getRuntimeOutputDir as f,serverModuleChunkPath as p}from"../../shared/constants/runtime-layout.js";import{createEmptyServerModuleSet as m}from"../../content-layer/server-modules/module-set.js";import{formatBytes as h,formatCount as g}from"../../shared/log-format.js";import{getPathPrefix as _}from"../../shared/path-prefix.js";import{resolveRuntimeEntryFiles as v,resolveRuntimeServerModuleFiles as y,resolveRuntimeTemplateFiles as b}from"../runtime-files.js";import{VITE_LOG_STREAM as ee}from"../../shared/constants/log-streams.js";import{DEV_LOGIN_DEFINE as te,ENV_FILE_DEFAULTS_DEFINE as x,PATH_PREFIX_DEFINE as S,REDOCLY_SSR_NO_EXTERNAL as C,TEMPLATE_IDS_DEFINE as ne,createBaseViteConfig as re,createDefineValues as w,createThemeSourcePlugin as T,createViteCustomLogger as E}from"../vite-config.base.js";import{PLATFORM_CONFIG as D}from"./constants/platform.js";import{createDependencyRecorder as O,writeDependencyPack as k}from"./dependency-pack.js";import{createThemeGlobalStylesheetsPlugin as ie}from"./theme-global-stylesheets.js";import{createRequire as ae}from"node:module";import{fileURLToPath as oe}from"node:url";import{existsSync as A}from"node:fs";import{dirname as j,join as M,relative as N,resolve as P}from"node:path";import{mkdir as F,rm as I,writeFile as L}from"node:fs/promises";import{build as R}from"vite";async function z(e){let t=f(e.contentDir),r=M(t,o),i=M(t,l),a=M(i,u),s=M(r,`.vite`,`manifest.json`),d=M(t,c),p=v(e.contentDir),m=n(e.templateSet),h=b(e.templateSet,e.contentDir);await F(t,{recursive:!0});let g=O(),_=await e.reporter.run(`Compiling the theme styles`,()=>ie(e),()=>`Compiled the theme styles`);return await e.reporter.run(`Building client bundle`,()=>R(Y({contentDir:e.contentDir,logger:e.logger,entryFiles:p,templateSetProvider:m,variant:`client`,plugins:[g.plugin,_]})),e=>`Built client bundle ${$(e)}`),await e.reporter.run(`Building SSR bundle`,()=>R(Y({contentDir:e.contentDir,logger:e.logger,entryFiles:p,templateSetProvider:m,serverModuleSet:e.serverModuleSet,variant:`ssr`,plugins:[g.plugin,_]})),e=>`Built SSR bundle ${$(e)}`),await e.reporter.run(`Writing the dependency pack`,()=>se(e.contentDir,t,g.files,e.logger),e=>e?`Wrote the dependency pack: ${e.packages} packages, ${e.packedFiles} files, ${(e.bytes/1048576).toFixed(1)} MB`:`No dependency pack: the project declares no dependencies`),await B(t),await e.reporter.run(`Building server entry`,()=>R(Q({contentDir:e.contentDir,logger:e.logger,target:e.target,platform:e.platform,templateFiles:h,devLogin:e.devLogin})),e=>`Built server entry ${$(e)}`),await V(t),await L(d,JSON.stringify({target:e.target,platform:e.platform,clientDir:r,serverEntryPath:a,viteManifestPath:s},null,2)),{outputDir:t,clientDir:r,serverEntryPath:a,manifestPath:d,target:e.target,platform:e.platform,viteManifestPath:s}}async function B(e){await I(M(e,s),{recursive:!0,force:!0})}async function V(e){await L(M(e,`package.json`),`${JSON.stringify({type:`module`})}\n`)}const H=`\0realm-server-replay-stub`;function U(){return{name:`realm-server-replay-stub`,enforce:`pre`,resolveId(e){return e===`@redocly/replay`||e.startsWith(`@redocly/replay/`)?H:null},load(e){return e===H?[`const stub = (name) => () => {`,` throw new Error(`,` '@redocly/replay is excluded from server bundles (client-only); <' + name + '> cannot render on the server.',`,` );`,`};`,`export const EmbeddedReplay = stub('EmbeddedReplay');`,`export const ReplayOverlay = stub('ReplayOverlay');`].join(`
2
+ `):null}}}function W(t,n){let r=``;return{name:`realm-template-manifest-keys`,configResolved(e){r=e.root},async generateBundle(){let i={};for(let a of b(await t.current(),n)){let t=await this.resolve(a.filePath);t&&(i[a.templateId]=e(N(r,t.id)))}this.emitFile({type:`asset`,fileName:`.vite/${a}`,source:JSON.stringify(i)})}}}const G=ae(import.meta.url),K=e(M(j(G.resolve(`@redocly/theme/package.json`)),`src/`));function q(t){return e(t).startsWith(K)}async function se(e,t,n,r){try{return await k({contentDir:e,outputDir:t,recorded:n})}catch(e){return r.warn(`Dependency pack not written: ${e instanceof Error?e.message:String(e)}`),null}}const J=(t,n)=>{t.code===`EVAL`&&t.id&&e(t.id).includes(`/node_modules/`)||n(t)};function Y(n){let r=f(n.contentDir),a=n.variant===`client`,s=t(n.contentDir,{viteManagedDependencies:C}),c=re({contentDir:n.contentDir,logger:n.logger,templateSetProvider:n.templateSetProvider,serverModuleSet:n.serverModuleSet,enableLazyStaticData:a,styledComponentsDependencies:[...s.noExternal,...s.external],styledComponentsRoots:s.packageRoots}),d=new Map(y(n.serverModuleSet??m(),n.contentDir).map(t=>[e(t.filePath),p(t.key)]));return{configFile:!1,envDir:!1,...c,define:w({enableLazyStaticData:a,production:!0,themePathPrefixFromGlobal:!0}),plugins:[...c.plugins??[],...n.plugins??[],W(n.templateSetProvider,n.contentDir),...a?[]:[U()]],ssr:a?void 0:{noExternal:!0},experimental:{...c.experimental,renderBuiltUrl:(e,{hostType:t})=>t===`js`?{runtime:`(globalThis.__REALM_PATH_PREFIX__ ?? "") + ${JSON.stringify(`/${e}`)}`}:{relative:!0}},build:{copyPublicDir:!1,emptyOutDir:!0,...a?{assetsDir:i,chunkSizeWarningLimit:5e3,manifest:!0,outDir:M(r,o),rollupOptions:{input:n.entryFiles.clientEntryPath,onwarn:J,output:{assetFileNames:`${i}/[name]-[hash][extname]`,codeSplitting:{groups:[{name:`app`,tags:[`$initial`],priority:2},{name:`theme`,test:e=>q(e)&&!e.includes(`/markdoc/tags/`),minShareCount:2,priority:1}]}},treeshake:{moduleSideEffects:e=>!q(e)&&void 0}}}:{minify:!0,manifest:!0,outDir:M(r,l),rollupOptions:{external:[/^node:/],onwarn:J,output:{entryFileNames:u,chunkFileNames:e=>e.facadeModuleId&&d.get(e.facadeModuleId)||`assets/[name]-[hash].mjs`}},ssr:n.entryFiles.serverEntryPath}}}}const X=`subprocess-child`;function Z(e,t){let n=P(e,`${t}.ts`),r=P(e,`${t}.js`);if(A(n))return n;if(A(r))return r;throw Error(`Host entry source not found for "${t}". Expected one of: ${n}, ${r}.`)}function Q(e){let t=P(j(oe(import.meta.url)),`../../server`),{entryBasename:n,outputFilename:i}=D[e.platform],a=Z(t,n),o=Z(t,`subprocess/child-entry`);return{configFile:!1,envDir:!1,appType:`custom`,clearScreen:!1,logLevel:e.logger.isDebugEnabled(`runtime:vite`)?`info`:`warn`,customLogger:E(e.logger.child(ee)),define:{...w({enableLazyStaticData:!1,production:!0}),[ne]:JSON.stringify(e.templateFiles.map(e=>e.templateId)),..._()?{[S]:JSON.stringify(_())}:{},[te]:JSON.stringify(e.devLogin===!0),[x]:JSON.stringify(r())},plugins:[U(),T()],publicDir:!1,root:e.contentDir,ssr:{noExternal:!0},build:{copyPublicDir:!1,emptyOutDir:!1,minify:!0,outDir:f(e.contentDir),rollupOptions:{input:{[n]:a,[X]:o},external:[/^node:/],treeshake:{moduleSideEffects:e=>!q(e)&&void 0},output:{entryFileNames:e=>e.name===X?d:i,chunkFileNames:`assets/[name]-[hash].mjs`}},ssr:!0,target:`node22`}}}function $(e){let t=Array.isArray(e)?e:`output`in e?[e]:[],n=0,r=0;for(let e of t.flatMap(e=>e.output)){n+=1;let t=e.type===`chunk`?e.code:e.source;r+=typeof t==`string`?Buffer.byteLength(t):t.byteLength}return`(${g(n)} ${n===1?`file`:`files`}, ${h(r)})`}export{z as buildRuntime,B as cleanStaleHostOutputs,Y as createBundleBuildConfig,Q as createHttpServerBuildConfig,U as createServerReplayStubPlugin,V as writeRuntimePackageManifest};
@@ -1 +1 @@
1
- import{captureSnippet as e,splitSourceLines as t}from"../../../shared/utils/capture-snippet.js";import{listProblems as n,summarizeStoredProblems as r}from"../../../content-layer/database/problems.js";import{DEV_PROBLEMS_PATH as i,DEV_PROBLEMS_SWEEP_PATH as a}from"../../../shared/constants/dev-problems.js";import{contentUpdateState as o}from"./content-update-state-route.js";import{narrowRangeToTarget as s}from"../../../shared/utils/narrow-range-to-target.js";const c=500;async function l(e){let t=await e.status();return{state:t.state,done:t.done,total:t.total,failed:t.failed,pending:Math.max(0,t.total-t.done-t.failed)}}function u(c,u){let d={generation:-1,byPath:/* @__PURE__ */ new Map},f=e=>(d.generation!==e&&(d={generation:e,byPath:/* @__PURE__ */ new Map}),d.byPath);c.get(i,async i=>{let{errors:a,warnings:c}=await r(u.database),d={errors:a,warnings:c,generation:o.generation,...u.sweeper?{sweep:await l(u.sweeper)}:{}};if(i.req.query(`list`)!==`1`)return i.json(d);let p=await n(u.database,{limit:500}),m=f(o.generation),h=async n=>{let r={range:n.range,snippet:n.snippet};if(n.snippet!==null||u.readSourceFile===void 0||n.filePath===null||n.range===null)return r;let i=m.get(n.filePath);if(i===void 0){let e=await u.readSourceFile(n.filePath);i=e===null?null:t(e),m.set(n.filePath,i)}if(i===null)return r;let a=n.data?.raw,o=typeof a==`string`?s(i,n.range,a):n.range;return{range:o,snippet:e(i,o)}},g=[];for(let e of p)g.push({code:e.code,category:e.category,severity:e.severity,message:e.message,filePath:e.filePath,...await h(e)});let _={...d,truncated:a+c>p.length,problems:g};return i.json(_)}),c.post(a,async e=>{let t=u.sweeper;if(!t)return e.json({error:`No materialization sweeper is wired for this dev host.`},404);let n;try{n=await e.req.json()}catch{return e.json({error:`Sweep control body must be JSON.`},400)}let r=n?.action;return r!==`start`&&r!==`pause`?e.json({error:`Sweep control body must be { action: "start" | "pause" }.`},400):(r===`start`?t.start():t.pause(),e.json(await l(t)))})}export{c as MAX_DEV_LIST_PROBLEMS,u as registerDevProblemsRoute};
1
+ import{captureSnippet as e,splitSourceLines as t}from"../../../shared/utils/capture-snippet.js";import{listProblems as n,summarizeStoredProblems as r}from"../../../content-layer/database/problems.js";import{contentUpdateState as i}from"./content-update-state-route.js";import{narrowRangeToTarget as a}from"../../../shared/utils/narrow-range-to-target.js";import{DEV_PROBLEMS_PATH as o,DEV_PROBLEMS_SWEEP_PATH as s}from"../../../shared/constants/dev-problems.js";const c=500;async function l(e){let t=await e.status();return{state:t.state,done:t.done,total:t.total,failed:t.failed,pending:Math.max(0,t.total-t.done-t.failed)}}function u(c,u){let d={generation:-1,byPath:/* @__PURE__ */ new Map},f=e=>(d.generation!==e&&(d={generation:e,byPath:/* @__PURE__ */ new Map}),d.byPath);c.get(o,async o=>{let{errors:s,warnings:c}=await r(u.database),d={errors:s,warnings:c,generation:i.generation,...u.sweeper?{sweep:await l(u.sweeper)}:{}};if(o.req.query(`list`)!==`1`)return o.json(d);let p=await n(u.database,{limit:500}),m=f(i.generation),h=async n=>{let r={range:n.range,snippet:n.snippet};if(n.snippet!==null||u.readSourceFile===void 0||n.filePath===null||n.range===null)return r;let i=m.get(n.filePath);if(i===void 0){let e=await u.readSourceFile(n.filePath);i=e===null?null:t(e),m.set(n.filePath,i)}if(i===null)return r;let o=n.data?.raw,s=typeof o==`string`?a(i,n.range,o):n.range;return{range:s,snippet:e(i,s)}},g=[];for(let e of p)g.push({code:e.code,category:e.category,severity:e.severity,message:e.message,filePath:e.filePath,...await h(e)});let _={...d,truncated:s+c>p.length,problems:g};return o.json(_)}),c.post(s,async e=>{let t=u.sweeper;if(!t)return e.json({error:`No materialization sweeper is wired for this dev host.`},404);let n;try{n=await e.req.json()}catch{return e.json({error:`Sweep control body must be JSON.`},400)}let r=n?.action;return r!==`start`&&r!==`pause`?e.json({error:`Sweep control body must be { action: "start" | "pause" }.`},400):(r===`start`?t.start():t.pause(),e.json(await l(t)))})}export{c as MAX_DEV_LIST_PROBLEMS,u as registerDevProblemsRoute};
@@ -1,4 +1,4 @@
1
- import{isObject as e}from"../../../shared/utils/is-object.js";import{stripPathPrefix as t,withPathPrefix as n}from"../../../shared/path-prefix.js";import"../../../content-layer/plugins/internal/api-docs/server/shared.js";import{normalizeRoutePath as r}from"../../../shared/utils/routes/normalize-route-path.js";import{resolveDefaultVersionAlias as i,resolveVersionlessRedirect as a,toVersionlessSlug as o}from"../../../content-layer/versions/redirect.js";import{createRuntimeEntityStore as s,loadStoredRouteWithDeps as c}from"../../../server/content.js";import{DEV_PAGE_FOR_SOURCE_PATH as l,DEV_SOURCE_FOR_PAGE_PATH as u}from"../../../shared/constants/dev-source-sync.js";import{createApiSourceMap as d}from"../../../content-layer/plugins/internal/api-docs/server/source-map.js";import{sql as f}from"drizzle-orm";function p(i,o){let f=s(o),p=/* @__PURE__ */ new Map,v=async(t,n)=>{let r=await o.readSourceFile(n);if(r===null)return;let i=await f.get(t),a=p.get(t);if(a&&i?.status===`ready`&&i.dataHash===a.dataHash&&a.text===r)return a.page;let s=await f.load(t);if(!e(s)||!Array.isArray(s.items)||typeof s.basePath!=`string`)return;let c={basePath:s.basePath,map:await d(s.items,n,r)},l=(await f.get(t))?.dataHash;return l&&p.set(t,{dataHash:l,text:r,page:c}),c},y=async e=>{let{route:t,dependencies:n}=e;if(t.pluginId!==`internal.api-docs`||t.sourcePath===null)return;let r=n.find(e=>e.key===`apiDocs:render`&&e.dependencyType===`entity`);if(r)try{return await v(r.target,t.sourcePath)}catch(e){o.logger.warn(`Source sync could not map ${t.sourcePath}`,{err:e});return}};i.get(l,async e=>{e.header(`Cache-Control`,`no-store`);let t=e.req.query(`path`);if(!t)return e.json({error:`Missing the "path" query parameter.`},400);let r=await h(o.database,t),i=r===null?null:await c(o.database,r);if(!i)return e.json({url:null});let s=await a(o.database.db,i.route)??i.route.slug,l=Number(e.req.query(`line`)),u=Number.isInteger(l)&&l>0?await y(i):void 0,d=u?.map.linkAtLine(l),f=u&&d&&_(s,u.basePath,d)||s;return e.json({url:n(f)})}),i.get(u,async e=>{e.header(`Cache-Control`,`no-store`);let n=e.req.query(`url`);if(!n)return e.json({error:`Missing the "url" query parameter.`},400);let{pathname:i}=new URL(n,`http://realm.invalid`),a=r(t(i)??i),s=await m(o.database,a),c=s?.loaded.route.sourcePath??null;if(!s||c===null)return e.json({path:null});let l=await y(s.loaded),u=l?.map.positionOfLink(g(s.publicSlug,l.basePath,a));return e.json({path:c,position:u})})}async function m(e,t){let n=await c(e,t);if(n)return{loaded:n,publicSlug:n.route.slug};let r=await i(e.db,t,t=>c(e,t));if(r?.kind!==`serve`)return null;let{route:a}=r.loaded;return{loaded:r.loaded,publicSlug:o(a.slug,r.versionGroup,r.version,r.locale)}}async function h(e,t){let[n]=await e.db.all(f`
1
+ import{isObject as e}from"../../../shared/utils/is-object.js";import{normalizeRoutePath as t}from"../../../shared/utils/routes/normalize-route-path.js";import{stripPathPrefix as n,withPathPrefix as r}from"../../../shared/path-prefix.js";import"../../../content-layer/plugins/internal/api-docs/server/shared.js";import{resolveDefaultVersionAlias as i,resolveVersionlessRedirect as a,toVersionlessSlug as o}from"../../../content-layer/versions/redirect.js";import{createRuntimeEntityStore as s,loadStoredRouteWithDeps as c}from"../../../server/content.js";import{DEV_PAGE_FOR_SOURCE_PATH as l,DEV_SOURCE_FOR_PAGE_PATH as u}from"../../../shared/constants/dev-source-sync.js";import{createApiSourceMap as d}from"../../../content-layer/plugins/internal/api-docs/server/source-map.js";import{sql as f}from"drizzle-orm";function p(i,o){let f=s(o),p=/* @__PURE__ */ new Map,v=async(t,n)=>{let r=await o.readSourceFile(n);if(r===null)return;let i=await f.get(t),a=p.get(t);if(a&&i?.status===`ready`&&i.dataHash===a.dataHash&&a.text===r)return a.page;let s=await f.load(t);if(!e(s)||!Array.isArray(s.items)||typeof s.basePath!=`string`)return;let c={basePath:s.basePath,map:await d(s.items,n,r)},l=(await f.get(t))?.dataHash;return l&&p.set(t,{dataHash:l,text:r,page:c}),c},y=async e=>{let{route:t,dependencies:n}=e;if(t.pluginId!==`internal.api-docs`||t.sourcePath===null)return;let r=n.find(e=>e.key===`apiDocs:render`&&e.dependencyType===`entity`);if(r)try{return await v(r.target,t.sourcePath)}catch(e){o.logger.warn(`Source sync could not map ${t.sourcePath}`,{err:e});return}};i.get(l,async e=>{e.header(`Cache-Control`,`no-store`);let t=e.req.query(`path`);if(!t)return e.json({error:`Missing the "path" query parameter.`},400);let n=await h(o.database,t),i=n===null?null:await c(o.database,n);if(!i)return e.json({url:null});let s=await a(o.database.db,i.route)??i.route.slug,l=Number(e.req.query(`line`)),u=Number.isInteger(l)&&l>0?await y(i):void 0,d=u?.map.linkAtLine(l),f=u&&d&&_(s,u.basePath,d)||s;return e.json({url:r(f)})}),i.get(u,async e=>{e.header(`Cache-Control`,`no-store`);let r=e.req.query(`url`);if(!r)return e.json({error:`Missing the "url" query parameter.`},400);let{pathname:i}=new URL(r,`http://realm.invalid`),a=t(n(i)??i),s=await m(o.database,a),c=s?.loaded.route.sourcePath??null;if(!s||c===null)return e.json({path:null});let l=await y(s.loaded),u=l?.map.positionOfLink(g(s.publicSlug,l.basePath,a));return e.json({path:c,position:u})})}async function m(e,t){let n=await c(e,t);if(n)return{loaded:n,publicSlug:n.route.slug};let r=await i(e.db,t,t=>c(e,t));if(r?.kind!==`serve`)return null;let{route:a}=r.loaded;return{loaded:r.loaded,publicSlug:o(a.slug,r.versionGroup,r.version,r.locale)}}async function h(e,t){let[n]=await e.db.all(f`
2
2
  SELECT routes.slug AS slug
3
3
  FROM routes
4
4
  INNER JOIN files ON files.id = routes.source_id
@@ -1 +1 @@
1
- import{getPathPrefix as e}from"../../shared/path-prefix.js";import{discoverContentDependencyPolicy as t}from"../content-dependency-policy.js";import{createLogger as n}from"../../shared/logger.js";import{openContentLayerDatabase as r}from"../../content-layer/database/connection.js";import{resolveRuntimeEntryFiles as i}from"../runtime-files.js";import{silentReporter as a}from"../../shared/reporter.js";import{createTemplateSetProvider as o}from"../../content-layer/templates/template-set.js";import{BUNDLED_DEV_CLIENT_SCRIPT_TAG as s,REACT_REFRESH_PREAMBLE_PATH as c,REDOCLY_SSR_NO_EXTERNAL as l}from"../vite-config.base.js";import{loadUserMarkdocSchema as u}from"../user-markdoc-schema.js";import{resolveAccessConfig as d}from"../../server/auth/access-config.js";import{createAuthRuntime as f}from"../../server/auth/runtime.js";import{invalidateLinkCheckViewCache as p,materializeRuntimeEntityDataByKey as m}from"../../server/content.js";import{createCorsProxyHandler as h}from"../../server/cors-proxy/handler.js";import{createDevSubprocessHost as ee}from"../../server/subprocess/host.js";import{SWEEP_PROGRESS_HMR_EVENT as te}from"../../shared/constants/dev-problems.js";import{createSsrModuleInvoke as ne,createViteDevServer as re,ensureBundledClientOutput as ie}from"./vite-config.js";import{createCodeAssetSources as ae}from"./code-asset-sources.js";import{startContentDevSession as g}from"./content-session.js";import{countPages as _,listDevProblems as v,loadDevProblems as y,watchPreparedProblems as b}from"./dev-problems.js";import{silentDevReporter as x}from"./dev-reporter.js";import{createMaterializationSweeper as oe,loadSweepProgress as se,loadSweepQueue as S}from"./materialization-sweeper.js";import{serveReactRefreshPreamble as ce}from"./react-refresh-preamble.js";import{createRealmOnIngestComplete as C,createRealmRuntimeApp as w}from"./runtime-app.js";import{toViteChunkUrl as T}from"./vite-chunk-url.js";import E from"node:process";import{readFile as D}from"node:fs/promises";import{createServer as le}from"node:http";import{getRequestListener as O}from"@hono/node-server";import{createServer as k}from"node:net";const A=[`@redocly/redoc-opentelemetry`,`@redocly/realm-asyncapi-sdk`,`@redocly/mock-server`],j=[...l,`react`,`react-dom`,`styled-components`];async function M(l){let k=l.logger??n(),M=l.reporter??a,F=l.devReporter??x,I=k.child(`runtime:dev`),R=e(),V=null,H=!1,U=null,W=null,G=new Promise((e,t)=>{U=e,W=t}),K=async e=>{if(!H){if(H=!0,B(),X?.pause(),Z(),await Promise.allSettled([q?.close(),J?.close(),Y?.close(),N(V)]),e){W?.(e);return}U?.()}},q=null,J=null,Y=null,X=null,Z=()=>{};try{let e=await M.run(`Starting dev server`,async()=>{let e=i(l.contentDir),n=o(),a=(e,t)=>{t.statusCode=503,t.end(`Dev server is starting.`)};V=le((e,t)=>{a(e,t)});let v=t(l.contentDir,{viteManagedDependencies:j});I.debug(`Content dependency SSR policy`,v);let x=ae();Y=await re({contentDir:l.contentDir,externalizeReactForSsr:!0,registerCodeAssetSource:x.register,hmrServer:V,lazyDevCompilation:!1,logger:k,templateSetProvider:n,styledComponentsDependencies:v.noExternal,styledComponentsRoots:v.packageRoots,configOverrides:{ssr:{external:[...A,...v.external],noExternal:v.noExternal}}});let M=Y;await u({contentDir:l.contentDir,logger:k});let N=async()=>{};q=await g({contentDir:l.contentDir,databaseUrl:l.databaseUrl,debounceMs:l.debounceMs,ignoredDirectories:l.ignoredDirectories,logger:k,onError:e=>{K(e)},onCycleStart:()=>{J&&p(J),X?.onIngestCycleStart(),F.changeStart()},onCycleEnd:async e=>{X?.onIngestCycleEnd(),J&&F.changeEnd({...e,pages:await _(J),problems:await y(J)})},onIngestComplete:e=>N(e),templateSetProvider:n});let z=q.context;J=await r({contentDir:l.contentDir,databaseUrl:l.databaseUrl,logger:k.child(`runtime:content`),runMigrations:!1});let B=J;Z=b({database:B,report:e=>F.problems(e),logger:I});let H={database:B,entityLoaderIds:()=>z.pluginRegistry.listEntityLoaders().map(e=>e.definition.id)},U=1,W=0,G=()=>{try{M.environments.client.hot.send({type:`custom`,event:te,data:{}})}catch(e){let t=e instanceof Error?e.message:String(e);I.warn(`Could not send the sweep HMR nudge: ${t}`)}},Q=0,ue=e=>{let t=performance.now();!e&&t-Q<250||(Q=t,X?.status().then(e=>F.sweep(e)).catch(e=>I.warn(`Could not read the sweep status`,{err:e})))};X=oe({loadQueue:()=>S(H),loadProgress:e=>se(H,e),materialize:e=>m({contentDir:l.contentDir,context:z,database:B,logger:k,key:e}),logger:k,onProgress:e=>{if(ue(e.kind===`state`),e.kind===`state`){W=0,X?.status().then(e=>{U=Math.max(1,Math.floor(e.total/50))}).catch(e=>{let t=e instanceof Error?e.message:String(e);I.warn(`Could not refresh the sweep HMR nudge threshold: ${t}`)}).finally(G);return}W+=1,!(W<U)&&(W=0,G())}});let de=X;N=C({contentDir:l.contentDir,database:B,viteServer:M,logger:I,refreshClientOutput:async()=>{await ie(M.environments.client)}});let fe=await f({env:E.env,getAccessConfig:()=>d(z.config),devLogin:!0,allowDevFallbackSeed:!0,allowInsecureCookies:!0,logger:k}),pe=w({contentDir:l.contentDir,context:z,database:B,logger:k,viteServer:M,entryFiles:e,headTags:`<script src="${c}"><\/script>${s}`,auth:fe,corsProxy:h({getConfig:()=>z.config,allowPrivateNetwork:!0}),subprocess:ee({contentDir:l.contentDir,databaseUrl:B.url,viteInvoke:ne(M)}),sweeper:X??void 0,readCodeAssetSource:async e=>{let t=x.pathOf(e);if(!t)return null;try{return new Uint8Array(await D(t))}catch{return null}}}),me=O(pe.fetch);a=(e,t)=>{if(ce(e,t))return;let n=e.url,r=T(n);r!==null&&(e.url=r),M.middlewares(e,t,()=>{e.url=n,me(e,t)})};let $=await P(V,l.host,l.port);return V.on(`error`,e=>{K(e)}),$!==l.port&&k.warn(`Port ${l.port} is already in use. Using port ${$} instead.`),{url:`http://${L(l.host)}:${$}${R}`,database:B,sweeper:de}},e=>`Dev server ready at ${e.url}`);z(()=>{K()}),F.ready({url:e.url,pages:await _(e.database),problems:await y(e.database),sweep:await e.sweeper.status(),controls:{listProblems:()=>v(e.database),startSweep:()=>e.sweeper.start(),pauseSweep:()=>e.sweeper.pause()}}),await G}catch(e){let t=e instanceof Error?e:Error(String(e));throw await K(t),t}}function N(e){return e?new Promise((t,n)=>{e.close(e=>{if(e){n(e);return}t()})}):Promise.resolve()}async function P(e,t,n){let r=L(t),i=Math.max(n,Math.min(n+20,65535));for(let a=n;a<=i;a++)if(r===t||await I(r,a))try{return await F(e,t,a),a}catch(e){if(e.code!==`EADDRINUSE`)throw e}throw Object.assign(/* @__PURE__ */ Error(`Ports ${n}-${i} are already in use.`),{code:`EADDRINUSE`})}function F(e,t,n){return new Promise((r,i)=>{let a=t=>{e.off(`listening`,o),i(t)},o=()=>{e.off(`error`,a),r()};e.once(`error`,a),e.once(`listening`,o),e.listen(n,t)})}function I(e,t){return new Promise(n=>{let r=k();r.once(`error`,e=>n(e.code!==`EADDRINUSE`)),r.listen(t,e,()=>r.close(()=>n(!0)))})}function L(e){return e===void 0||e===`0.0.0.0`||e===`::`?`127.0.0.1`:e}let R=[];function z(e){R=[[`SIGINT`,e],[`SIGTERM`,e]];for(let[e,t]of R)E.once(e,t)}function B(){for(let[e,t]of R)E.off(e,t);R=[]}export{A as NODE_DEV_SSR_EXTERNAL,M as runDev};
1
+ import{discoverContentDependencyPolicy as e}from"../content-dependency-policy.js";import{createTemplateSetProvider as t}from"../../content-layer/templates/template-set.js";import{createLogger as n}from"../../shared/logger.js";import{openContentLayerDatabase as r}from"../../content-layer/database/connection.js";import{getPathPrefix as i}from"../../shared/path-prefix.js";import{resolveRuntimeEntryFiles as a}from"../runtime-files.js";import{BUNDLED_DEV_CLIENT_SCRIPT_TAG as o,REACT_REFRESH_PREAMBLE_PATH as ee,REDOCLY_SSR_NO_EXTERNAL as s}from"../vite-config.base.js";import{silentReporter as c}from"../../shared/reporter.js";import{loadUserMarkdocSchema as l}from"../user-markdoc-schema.js";import{resolveAccessConfig as u}from"../../server/auth/access-config.js";import{resolveAuthKeySeed as d}from"../../server/auth/keys.js";import{createAuthRuntime as f}from"../../server/auth/runtime.js";import{invalidateLinkCheckViewCache as p,materializeRuntimeEntityDataByKey as m}from"../../server/content.js";import{createCorsProxyHandler as h}from"../../server/cors-proxy/handler.js";import{createDevSubprocessHost as g}from"../../server/subprocess/host.js";import{createSsrModuleInvoke as te,createViteDevServer as ne,ensureBundledClientOutput as re}from"./vite-config.js";import{createCodeAssetSources as ie}from"./code-asset-sources.js";import{startContentDevSession as _}from"./content-session.js";import{countPages as v,listDevProblems as y,loadDevProblems as b,watchPreparedProblems as ae}from"./dev-problems.js";import{silentDevReporter as x}from"./dev-reporter.js";import{createMaterializationSweeper as S,loadSweepProgress as C,loadSweepQueue as w}from"./materialization-sweeper.js";import{serveReactRefreshPreamble as T}from"./react-refresh-preamble.js";import{SWEEP_PROGRESS_HMR_EVENT as oe}from"../../shared/constants/dev-problems.js";import{createRealmOnIngestComplete as se,createRealmRuntimeApp as ce}from"./runtime-app.js";import{toViteChunkUrl as le}from"./vite-chunk-url.js";import{readFile as ue}from"node:fs/promises";import E from"node:process";import{createServer as D}from"node:http";import{getRequestListener as O}from"@hono/node-server";import{createServer as k}from"node:net";const A=[`@redocly/redoc-opentelemetry`,`@redocly/realm-asyncapi-sdk`,`@redocly/mock-server`],j=[...s,`react`,`react-dom`,`styled-components`];async function M(s){let k=s.logger??n(),M=s.reporter??c,F=s.devReporter??x,I=k.child(`runtime:dev`),R=i(),V=null,H=!1,U=null,W=null,G=new Promise((e,t)=>{U=e,W=t}),K=async e=>{if(!H){if(H=!0,B(),X?.pause(),Z(),await Promise.allSettled([q?.close(),J?.close(),Y?.close(),N(V)]),e){W?.(e);return}U?.()}},q=null,J=null,Y=null,X=null,Z=()=>{};try{let n=await M.run(`Starting dev server`,async()=>{let n=a(s.contentDir),i=t(),c=(e,t)=>{t.statusCode=503,t.end(`Dev server is starting.`)};V=D((e,t)=>{c(e,t)});let y=e(s.contentDir,{viteManagedDependencies:j});I.debug(`Content dependency SSR policy`,y);let x=ie();Y=await ne({contentDir:s.contentDir,externalizeReactForSsr:!0,registerCodeAssetSource:x.register,hmrServer:V,lazyDevCompilation:!1,logger:k,templateSetProvider:i,styledComponentsDependencies:y.noExternal,styledComponentsRoots:y.packageRoots,configOverrides:{ssr:{external:[...A,...y.external],noExternal:y.noExternal}}});let M=Y;await l({contentDir:s.contentDir,logger:k});let N=async()=>{};q=await _({contentDir:s.contentDir,databaseUrl:s.databaseUrl,debounceMs:s.debounceMs,ignoredDirectories:s.ignoredDirectories,logger:k,onError:e=>{K(e)},onCycleStart:()=>{J&&p(J),X?.onIngestCycleStart(),F.changeStart()},onCycleEnd:async e=>{X?.onIngestCycleEnd(),J&&F.changeEnd({...e,pages:await v(J),problems:await b(J)})},onIngestComplete:e=>N(e),templateSetProvider:i});let z=q.context;J=await r({contentDir:s.contentDir,databaseUrl:s.databaseUrl,logger:k.child(`runtime:content`),runMigrations:!1});let B=J;Z=ae({database:B,report:e=>F.problems(e),logger:I});let H={database:B,entityLoaderIds:()=>z.pluginRegistry.listEntityLoaders().map(e=>e.definition.id)},U=1,W=0,G=()=>{try{M.environments.client.hot.send({type:`custom`,event:oe,data:{}})}catch(e){let t=e instanceof Error?e.message:String(e);I.warn(`Could not send the sweep HMR nudge: ${t}`)}},Q=0,de=e=>{let t=performance.now();!e&&t-Q<250||(Q=t,X?.status().then(e=>F.sweep(e)).catch(e=>I.warn(`Could not read the sweep status`,{err:e})))};X=S({loadQueue:()=>w(H),loadProgress:e=>C(H,e),materialize:e=>m({contentDir:s.contentDir,context:z,database:B,logger:k,key:e}),logger:k,onProgress:e=>{if(de(e.kind===`state`),e.kind===`state`){W=0,X?.status().then(e=>{U=Math.max(1,Math.floor(e.total/50))}).catch(e=>{let t=e instanceof Error?e.message:String(e);I.warn(`Could not refresh the sweep HMR nudge threshold: ${t}`)}).finally(G);return}W+=1,!(W<U)&&(W=0,G())}});let fe=X;N=se({contentDir:s.contentDir,database:B,viteServer:M,logger:I,refreshClientOutput:async()=>{await re(M.environments.client)}});let pe=await f({env:E.env,getAccessConfig:()=>u(z.config),devLogin:!0,allowDevFallbackSeed:!0,allowInsecureCookies:!0,logger:k}),me=ce({contentDir:s.contentDir,context:z,database:B,logger:k,viteServer:M,entryFiles:n,headTags:`<script src="${ee}"><\/script>${o}`,auth:pe,gatewaySecretSeed:d(E.env,{allowDevFallback:!0}),corsProxy:h({getConfig:()=>z.config,allowPrivateNetwork:!0}),subprocess:g({contentDir:s.contentDir,databaseUrl:B.url,viteInvoke:te(M)}),sweeper:X??void 0,readCodeAssetSource:async e=>{let t=x.pathOf(e);if(!t)return null;try{return new Uint8Array(await ue(t))}catch{return null}}}),he=O(me.fetch);c=(e,t)=>{if(T(e,t))return;let n=e.url,r=le(n);r!==null&&(e.url=r),M.middlewares(e,t,()=>{e.url=n,he(e,t)})};let $=await P(V,s.host,s.port);return V.on(`error`,e=>{K(e)}),$!==s.port&&k.warn(`Port ${s.port} is already in use. Using port ${$} instead.`),{url:`http://${L(s.host)}:${$}${R}`,database:B,sweeper:fe}},e=>`Dev server ready at ${e.url}`);z(()=>{K()}),F.ready({url:n.url,pages:await v(n.database),problems:await b(n.database),sweep:await n.sweeper.status(),controls:{listProblems:()=>y(n.database),startSweep:()=>n.sweeper.start(),pauseSweep:()=>n.sweeper.pause()}}),await G}catch(e){let t=e instanceof Error?e:Error(String(e));throw await K(t),t}}function N(e){return e?new Promise((t,n)=>{e.close(e=>{if(e){n(e);return}t()})}):Promise.resolve()}async function P(e,t,n){let r=L(t),i=Math.max(n,Math.min(n+20,65535));for(let a=n;a<=i;a++)if(r===t||await I(r,a))try{return await F(e,t,a),a}catch(e){if(e.code!==`EADDRINUSE`)throw e}throw Object.assign(/* @__PURE__ */ Error(`Ports ${n}-${i} are already in use.`),{code:`EADDRINUSE`})}function F(e,t,n){return new Promise((r,i)=>{let a=t=>{e.off(`listening`,o),i(t)},o=()=>{e.off(`error`,a),r()};e.once(`error`,a),e.once(`listening`,o),e.listen(n,t)})}function I(e,t){return new Promise(n=>{let r=k();r.once(`error`,e=>n(e.code!==`EADDRINUSE`)),r.listen(t,e,()=>r.close(()=>n(!0)))})}function L(e){return e===void 0||e===`0.0.0.0`||e===`::`?`127.0.0.1`:e}let R=[];function z(e){R=[[`SIGINT`,e],[`SIGTERM`,e]];for(let[e,t]of R)E.once(e,t)}function B(){for(let[e,t]of R)E.off(e,t);R=[]}export{A as NODE_DEV_SSR_EXTERNAL,M as runDev};
@@ -1 +1 @@
1
- import{DATA_UPDATE_HMR_EVENT as e}from"../../shared/constants/content-update.js";import{BUILD_ASSETS_URL_PREFIX as t,getContentAssetsOutputDir as n}from"../../shared/constants/runtime-layout.js";import{toViteFsModuleId as r}from"../runtime-files.js";import{MARKDOC_SCHEMA_VIRTUAL_MODULE_ID as i}from"../constants/virtual-modules.js";import{invalidateThemeOverrideIndex as a}from"../vite-config.base.js";import{invalidateAppDataCache as o}from"../../server/content.js";import{registerDevAuthRoutes as s,registerMockDevAuthRoutes as c}from"../../server/auth/routes.js";import{collectManualAuthPaths as l}from"../../server/plugin-routes.js";import{createApp as u}from"../../server/app.js";import{createPageHandlers as d}from"../../server/page-handlers.js";import{registerLocalContentAssetRoute as f}from"../../server/content-assets/serve-local.js";import{registerEntityRevisionsAdminRoute as p}from"../../server/revisions-admin.js";import{invalidateBundledSsrRunnerCache as m,triggerFullClientRebuild as h}from"./vite-config.js";import{renderClientStylesheetTags as g}from"./client-stylesheets.js";import{DEV_PAGE_FOR_SOURCE_PATH as _}from"../../shared/constants/dev-source-sync.js";import{getSsrGraphGate as v}from"./ssr-graph-gate.js";import{contentUpdateState as y,registerContentUpdateStateRoute as b}from"./routes/content-update-state-route.js";import{registerDevProblemsRoute as x}from"./routes/dev-problems-route.js";import{registerSourceSyncRoutes as S}from"./routes/source-sync-route.js";import{join as C,resolve as w,sep as T}from"node:path";import{isRunnableDevEnvironment as E}from"vite";const D=/\.([cm]?[jt]sx?|css)$/,O=/(^|\/)@theme\//,k=/(^|\/)@theme\/markdoc\//,A=/(^|\/)@theme\/styles\.css$/,j=/\.md$/i;function M(e){let t=e.environments.ssr;if(!E(t))throw Error(`Runtime requires the Vite SSR environment to be runnable.`);return t}async function N(e){await M(e).runner.import(i)}function P(e){let{contentDir:i,context:a,database:o,logger:m,viteServer:h,entryFiles:y,headTags:E}=e,D=n(a.contentDir),O=y.serverRouteFiles.map(e=>({method:e.method,path:e.path,plugin:e.plugin,...e.auth?{auth:e.auth}:{},loadHandler:async()=>(await M(h).runner.import(r(e.handler.filePath)))[e.handler.exportName]})),k=async e=>{let t=C(i,e),n=w(i),a=w(t);if(a!==n&&!a.startsWith(n+T))throw Error(`Refusing to load a content module outside the content directory: ${e}`);return M(h).runner.import(r(t))},A=d({contentDir:i,context:a,database:o,logger:m,authInfo:e.auth?.pageAuthInfo,development:!0,headTags:E,loadHeadTags:()=>g(h),beforeLoad:()=>N(h),loadSsr:()=>(e.onBootPhase?.(`site-code-compile`),M(h).runner.import(r(y.serverEntryPath)))}),j=v(h,e=>m.warn(e)),P=async e=>{try{return await a.platform.fs.readFile(C(a.contentDir,e))}catch{return null}};return u({getConfig:()=>a.config,responseHeaders:e.responseHeaders,registerRoutes:t=>{b(t),p(t,{database:o,logger:m}),x(t,{database:o,readSourceFile:P,sweeper:e.sweeper}),S(t,{contentDir:i,context:a,database:o,logger:m,readSourceFile:P}),f(t,{contentAssetsDir:D,fs:a.pluginIO,readSource:e.readCodeAssetSource,logger:m}),e.auth&&e.auth.devLogin&&(e.auth.keys?s(t,e.auth):e.auth.setViewer&&c(t,e.auth))},clientBootstrap:{type:`script-src`,src:`${t}/client-entry.js`},auth:e.auth,corsProxy:e.corsProxy,database:o,contentDir:i,context:a,development:!0,logger:m,pluginRoutes:{contentDir:i,context:a,subprocess:e.subprocess,routes:O,mcpToolEntries:y.mcpToolFiles,loadContentModule:k},manualAuthPaths:[...l(O),_],search:{partial:!0},staticFiles:{contentDir:i,context:a},...A,renderPage:(t,n)=>j.render(()=>(e.onBootPhase?.(`page-data-load`),A.renderPage(t,n)))})}function F(t){return async({changes:n,templateSetChanged:r})=>{o(t.database);let i=t.viteServer.environments.ssr;E(i)&&(r||!n.every(({path:e})=>j.test(e))||[...i.moduleGraph.fileToModulesMap.keys()].some(e=>j.test(e)))&&await v(t.viteServer,e=>t.logger.warn(e)).invalidate(()=>m(i)),n.some(({path:e})=>O.test(e))&&a(t.contentDir);let s=n.some(({event:e,path:t})=>k.test(t)||A.test(t)&&e!==`change`);if(r||s||n.some(({path:e})=>D.test(e))){(r||s)&&(h(t.viteServer.environments.client)||t.logger.warn(`template-set rebuild trigger found no dev engine — client bundle may be stale`));try{await t.refreshClientOutput()}catch(e){let n=e instanceof Error?e.message:String(e);t.logger.warn(`Failed to refresh bundled client output: ${n}`)}}y.generation+=1,y.updatedAt=Date.now(),t.viteServer.environments.client.hot.send({type:`custom`,event:e,data:{changes:n,generation:y.generation}})}}export{F as createRealmOnIngestComplete,P as createRealmRuntimeApp};
1
+ import{BUILD_ASSETS_URL_PREFIX as e,getContentAssetsOutputDir as t}from"../../shared/constants/runtime-layout.js";import{toViteFsModuleId as n}from"../runtime-files.js";import{DATA_UPDATE_HMR_EVENT as r}from"../../shared/constants/content-update.js";import{MARKDOC_SCHEMA_VIRTUAL_MODULE_ID as i}from"../constants/virtual-modules.js";import{invalidateThemeOverrideIndex as a}from"../vite-config.base.js";import{invalidateAppDataCache as o}from"../../server/content.js";import{registerDevAuthRoutes as s,registerMockDevAuthRoutes as c}from"../../server/auth/routes.js";import{collectManualAuthPaths as l}from"../../server/plugin-routes.js";import{createApp as u}from"../../server/app.js";import{createPageHandlers as d}from"../../server/page-handlers.js";import{registerLocalContentAssetRoute as f}from"../../server/content-assets/serve-local.js";import{registerEntityRevisionsAdminRoute as p}from"../../server/revisions-admin.js";import{invalidateBundledSsrRunnerCache as m,triggerFullClientRebuild as h}from"./vite-config.js";import{renderClientStylesheetTags as g}from"./client-stylesheets.js";import{DEV_PAGE_FOR_SOURCE_PATH as _}from"../../shared/constants/dev-source-sync.js";import{getSsrGraphGate as v}from"./ssr-graph-gate.js";import{contentUpdateState as y,registerContentUpdateStateRoute as b}from"./routes/content-update-state-route.js";import{registerDevProblemsRoute as x}from"./routes/dev-problems-route.js";import{registerSourceSyncRoutes as S}from"./routes/source-sync-route.js";import{join as C,resolve as w,sep as T}from"node:path";import{isRunnableDevEnvironment as E}from"vite";const D=/\.([cm]?[jt]sx?|css)$/,O=/(^|\/)@theme\//,k=/(^|\/)@theme\/markdoc\//,A=/(^|\/)@theme\/styles\.css$/,j=/\.md$/i;function M(e){let t=e.environments.ssr;if(!E(t))throw Error(`Runtime requires the Vite SSR environment to be runnable.`);return t}async function N(e){await M(e).runner.import(i)}function P(r){let{contentDir:i,context:a,database:o,logger:m,viteServer:h,entryFiles:y,headTags:E}=r,D=t(a.contentDir),O=y.serverRouteFiles.map(e=>({method:e.method,path:e.path,plugin:e.plugin,...e.auth?{auth:e.auth}:{},loadHandler:async()=>(await M(h).runner.import(n(e.handler.filePath)))[e.handler.exportName]})),k=async e=>{let t=C(i,e),r=w(i),a=w(t);if(a!==r&&!a.startsWith(r+T))throw Error(`Refusing to load a content module outside the content directory: ${e}`);return M(h).runner.import(n(t))},A=d({contentDir:i,context:a,database:o,logger:m,authInfo:r.auth?.pageAuthInfo,development:!0,headTags:E,loadHeadTags:()=>g(h),beforeLoad:()=>N(h),loadSsr:()=>(r.onBootPhase?.(`site-code-compile`),M(h).runner.import(n(y.serverEntryPath)))}),j=v(h,e=>m.warn(e)),P=async e=>{try{return await a.platform.fs.readFile(C(a.contentDir,e))}catch{return null}};return u({getConfig:()=>a.config,responseHeaders:r.responseHeaders,registerRoutes:e=>{b(e),p(e,{database:o,logger:m}),x(e,{database:o,readSourceFile:P,sweeper:r.sweeper}),S(e,{contentDir:i,context:a,database:o,logger:m,readSourceFile:P}),f(e,{contentAssetsDir:D,fs:a.pluginIO,readSource:r.readCodeAssetSource,logger:m}),r.auth&&r.auth.devLogin&&(r.auth.keys?s(e,r.auth):r.auth.setViewer&&c(e,r.auth))},clientBootstrap:{type:`script-src`,src:`${e}/client-entry.js`},auth:r.auth,corsProxy:r.corsProxy,database:o,contentDir:i,context:a,development:!0,logger:m,pluginRoutes:{contentDir:i,context:a,subprocess:r.subprocess,gatewaySecretSeed:r.gatewaySecretSeed,routes:O,mcpToolEntries:y.mcpToolFiles,loadContentModule:k},manualAuthPaths:[...l(O),_],search:{partial:!0},staticFiles:{contentDir:i,context:a},...A,renderPage:(e,t)=>j.render(()=>(r.onBootPhase?.(`page-data-load`),A.renderPage(e,t)))})}function F(e){return async({changes:t,templateSetChanged:n})=>{o(e.database);let i=e.viteServer.environments.ssr;E(i)&&(n||!t.every(({path:e})=>j.test(e))||[...i.moduleGraph.fileToModulesMap.keys()].some(e=>j.test(e)))&&await v(e.viteServer,t=>e.logger.warn(t)).invalidate(()=>m(i)),t.some(({path:e})=>O.test(e))&&a(e.contentDir);let s=t.some(({event:e,path:t})=>k.test(t)||A.test(t)&&e!==`change`);if(n||s||t.some(({path:e})=>D.test(e))){(n||s)&&(h(e.viteServer.environments.client)||e.logger.warn(`template-set rebuild trigger found no dev engine — client bundle may be stale`));try{await e.refreshClientOutput()}catch(t){let n=t instanceof Error?t.message:String(t);e.logger.warn(`Failed to refresh bundled client output: ${n}`)}}y.generation+=1,y.updatedAt=Date.now(),e.viteServer.environments.client.hot.send({type:`custom`,event:r,data:{changes:t,generation:y.generation}})}}export{F as createRealmOnIngestComplete,P as createRealmRuntimeApp};
@@ -1 +1 @@
1
- import{getPathPrefix as e}from"../../shared/path-prefix.js";import{BUILD_ASSETS_URL_PREFIX as t}from"../../shared/constants/runtime-layout.js";function n(n){let r=`${e()}${t}/`;return!n||!n.startsWith(r)?null:`/assets/${n.slice(r.length)}`}export{n as toViteChunkUrl};
1
+ import{BUILD_ASSETS_URL_PREFIX as e}from"../../shared/constants/runtime-layout.js";import{getPathPrefix as t}from"../../shared/path-prefix.js";function n(n){let r=`${t()}${e}/`;return!n||!n.startsWith(r)?null:`/assets/${n.slice(r.length)}`}export{n as toViteChunkUrl};
@@ -0,0 +1 @@
1
+ import{createTemplateSetProvider as e}from"../content-layer/templates/template-set.js";import{createBaseViteConfig as t,createDefineValues as n}from"./vite-config.base.js";import{randomUUID as r}from"node:crypto";import{pathToFileURL as i}from"node:url";import{join as a}from"node:path";import{rm as o,writeFile as s}from"node:fs/promises";import{tmpdir as c}from"node:os";import{build as l}from"vite";async function u(r){let i=t({contentDir:r.contentDir,enableLazyStaticData:!1,logger:r.logger,templateSetProvider:e()}),a=await l({configFile:!1,envDir:!1,...i,define:n({enableLazyStaticData:!1,production:!0,themePathPrefixFromGlobal:!0}),plugins:[...i.plugins??[],...r.plugins??[]],ssr:{noExternal:!0},build:{reportCompressedSize:!1,rollupOptions:{external:[/^node:/],input:r.input,output:{codeSplitting:!1}},ssr:!0,write:!1}}),o=Array.isArray(a)?a[0]:a,s=o!==void 0&&`output`in o?o.output[0]:void 0;if(s===void 0||s.type!==`chunk`)throw Error(`Bundling ${r.input} produced no chunk.`);return{module:await d(s.code),moduleIds:s.moduleIds}}async function d(e){let t=a(c(),`realm-node-bundle-${r()}.mjs`);await s(t,e);try{return await import(i(t).href)}finally{await o(t,{force:!0})}}export{u as bundleForNode};
@@ -1 +1 @@
1
- import{toPosixPath as e}from"../shared/utils/to-posix-path.js";import{createContentLayerContext as t}from"../content-layer/context.js";import{BUILTIN_TEMPLATE_IDS as n,DEV_LOGIN_TEMPLATE_ID as r,ERROR_TEMPLATE_ID as i,FORBIDDEN_TEMPLATE_ID as a,NOT_FOUND_TEMPLATE_ID as o,SOURCE_TEMPLATE_PREFIX as s,UNAUTHORIZED_TEMPLATE_ID as c,UNSUPPORTED_TEMPLATE_ID as l}from"../shared/constants/template-ids.js";import{createContentPlugins as u}from"../content-layer/plugins/create-content-plugins.js";import"../content-layer/plugins/index.js";import{fileURLToPath as d}from"node:url";import{join as f,resolve as p}from"node:path";const m=d(new URL(`../client`,import.meta.url));function h(e){let n=t({contentDir:e,plugins:u(e)});return{appModulePath:x(`app`),clientEntryPath:x(`client-entry`),serverEntryPath:x(`ssr`),serverRouteFiles:n.pluginRegistry.listServerRoutes(),mcpToolFiles:n.pluginRegistry.listMcpTools(),serverFnFiles:n.pluginRegistry.listServerFns().map(e=>{let t=n.pluginRegistry.getById(e.pluginId);if(!t)throw Error(`Server function "${e.definition.id}" references missing plugin "${e.pluginId}".`);return{cacheable:e.definition.cacheable===!0,exportName:e.definition.module.exportName,filePath:e.definition.module.filePath,id:e.definition.id,markdoc:e.definition.markdoc,plugin:{id:t.id,version:t.version}}})}}const g={[o]:`templates/not-found`,[l]:`templates/unsupported`,[c]:`templates/unauthorized`,[a]:`templates/forbidden`,[r]:`templates/dev-login`,[i]:`templates/ErrorPage`};function _(){return n.map(e=>{let t=g[e];if(t===void 0)throw Error(`No runtime file registered for builtin template "${e}".`);return{filePath:x(t),templateId:e}})}function v(e,t){return[..._(),...[...e.pluginTemplates].map(([e,t])=>({filePath:t,templateId:e})),...[...e.sourceTemplates].map(e=>({filePath:f(t,e),templateId:`${s}${e}`}))]}function y(e,t){return[...[...e.contentModules].map(e=>({key:e,filePath:f(t,e)})),...[...e.pluginModules].map(e=>({key:e,filePath:e}))]}function b(t){return`/@fs${e(t)}`}function x(e){return p(m,`${e}.js`)}export{h as resolveRuntimeEntryFiles,y as resolveRuntimeServerModuleFiles,v as resolveRuntimeTemplateFiles,b as toViteFsModuleId};
1
+ import{toPosixPath as e}from"../shared/utils/to-posix-path.js";import{BUILTIN_TEMPLATE_IDS as t,DEV_LOGIN_TEMPLATE_ID as n,ERROR_TEMPLATE_ID as r,FORBIDDEN_TEMPLATE_ID as i,NOT_FOUND_TEMPLATE_ID as a,SOURCE_TEMPLATE_PREFIX as o,UNAUTHORIZED_TEMPLATE_ID as s,UNSUPPORTED_TEMPLATE_ID as c}from"../shared/constants/template-ids.js";import{createContentLayerContext as l}from"../content-layer/context.js";import{createContentPlugins as u}from"../content-layer/plugins/create-content-plugins.js";import"../content-layer/plugins/index.js";import{fileURLToPath as d}from"node:url";import{join as f,resolve as p}from"node:path";const m=d(new URL(`../client`,import.meta.url));function h(e){let t=l({contentDir:e,plugins:u(e)});return{appModulePath:x(`app`),clientEntryPath:x(`client-entry`),serverEntryPath:x(`ssr`),serverRouteFiles:t.pluginRegistry.listServerRoutes(),mcpToolFiles:t.pluginRegistry.listMcpTools(),serverFnFiles:t.pluginRegistry.listServerFns().map(e=>{let n=t.pluginRegistry.getById(e.pluginId);if(!n)throw Error(`Server function "${e.definition.id}" references missing plugin "${e.pluginId}".`);return{cacheable:e.definition.cacheable===!0,exportName:e.definition.module.exportName,filePath:e.definition.module.filePath,id:e.definition.id,markdoc:e.definition.markdoc,plugin:{id:n.id,version:n.version}}})}}const g={[a]:`templates/not-found`,[c]:`templates/unsupported`,[s]:`templates/unauthorized`,[i]:`templates/forbidden`,[n]:`templates/dev-login`,[r]:`templates/ErrorPage`};function _(){return t.map(e=>{let t=g[e];if(t===void 0)throw Error(`No runtime file registered for builtin template "${e}".`);return{filePath:x(t),templateId:e}})}function v(e,t){return[..._(),...[...e.pluginTemplates].map(([e,t])=>({filePath:t,templateId:e})),...[...e.sourceTemplates].map(e=>({filePath:f(t,e),templateId:`${o}${e}`}))]}function y(e,t){return[...[...e.contentModules].map(e=>({key:e,filePath:f(t,e)})),...[...e.pluginModules].map(e=>({key:e,filePath:e}))]}function b(t){return`/@fs${e(t)}`}function x(e){return p(m,`${e}.js`)}export{h as resolveRuntimeEntryFiles,y as resolveRuntimeServerModuleFiles,v as resolveRuntimeTemplateFiles,b as toViteFsModuleId};
@@ -1 +1 @@
1
- import{USER_MARKDOC_SCHEMA_FILE as e,registerUserMarkdocSchema as t,registerUserMarkdocSchemaFailure as n}from"../content-layer/markdown/constants/tag-sets.js";import{toPosixPath as r}from"../shared/utils/to-posix-path.js";import{hashContentBytes as i}from"../shared/utils/content-hash.js";import{silentReporter as a}from"../shared/reporter.js";import{createTemplateSetProvider as o}from"../content-layer/templates/template-set.js";import{MARKDOC_SCHEMA_VIRTUAL_MODULE_ID as s}from"./constants/virtual-modules.js";import{createBaseViteConfig as c,createDefineValues as l,userMarkdocSchemaFile as u}from"./vite-config.base.js";import{createServerReplayStubPlugin as d}from"./build/vite-config.js";import{randomUUID as f}from"node:crypto";import{pathToFileURL as p}from"node:url";import{isAbsolute as m,join as h,relative as g}from"node:path";import{readFile as _,readdir as v,realpath as y,rm as b,writeFile as x}from"node:fs/promises";import{tmpdir as S}from"node:os";import{build as C}from"vite";const w=`@theme/markdoc/`;let T;async function E(n){let{contentDir:r,logger:i}=n;if(u(r)===null){t(void 0,void 0,[e]),T=/* @__PURE__ */ new Set;return}await(n.reporter??a).run(`Loading the Markdoc schema`,()=>D(r,i),e=>e===void 0?`Markdoc schema did not load (see the warning)`:`Loaded the Markdoc schema (${e} ${e===1?`tag`:`tags`})`)}async function D(r,i){let a=await y(r);try{let e=await C(k(r,i)),n=Array.isArray(e)?e[0]:e,o=n!==void 0&&`output`in n?n.output[0]:void 0;if(o===void 0||o.type!==`chunk`)throw Error(`The schema bundle produced no chunk.`);let s=M(o.moduleIds),c=await A(o.code),l=s.map(e=>F(a,e));t({tags:c.userMarkdocTags,nodes:c.userMarkdocNodes,functions:c.userMarkdocFunctions},await j(a,s),l),T=new Set(l);let u=Object.keys(c.userMarkdocTags).length;return i.debug(`Loaded the project Markdoc schema: ${u} tag(s) from ${s.length} file(s)`),u}catch(t){T=/* @__PURE__ */ new Set([...T??[],e,...await N(a)]),n([...T]),i.warn(`The project Markdoc schema did not load; pages are not validated and its tags show their title in page Markdown: ${t instanceof Error?t.message:String(t)}`);return}}async function O(e){let t=T;return t===void 0||!e.changes.some(e=>t.has(e.path)||e.path.startsWith(w))?!1:(await E(e),!0)}function k(e,t){let n=c({contentDir:e,enableLazyStaticData:!1,logger:t,templateSetProvider:o()});return{configFile:!1,envDir:!1,...n,define:l({enableLazyStaticData:!1,production:!0,themePathPrefixFromGlobal:!0}),plugins:[...n.plugins??[],d()],ssr:{noExternal:!0},build:{reportCompressedSize:!1,rollupOptions:{external:[/^node:/],input:s,output:{codeSplitting:!1}},ssr:!0,write:!1}}}async function A(e){let t=h(S(),`realm-markdoc-schema-${f()}.mjs`);await x(t,e);try{return await import(p(t).href)}finally{await b(t,{force:!0})}}async function j(e,t){let n=t.map(t=>({file:t,path:F(e,t)})).sort((e,t)=>e.path<t.path?-1:+(e.path>t.path)),r=await Promise.all(n.map(async({file:e,path:t})=>[t,await i(await _(e))]));return i(new TextEncoder().encode(JSON.stringify(r)))}function M(e){return[...new Set(e.map(e=>P(r(e))).filter(e=>m(e)&&!e.includes(`/node_modules/`)))]}async function N(e){return(await v(h(e,w),{recursive:!0,withFileTypes:!0})).filter(e=>e.isFile()).map(t=>F(e,h(t.parentPath,t.name)))}function P(e){let t=[e.indexOf(`?`),e.indexOf(`#`)].filter(e=>e!==-1);return t.length===0?e:e.slice(0,Math.min(...t))}function F(e,t){return r(g(e,t))}export{E as loadUserMarkdocSchema,O as reloadUserMarkdocSchemaIfChanged};
1
+ import{toPosixPath as e}from"../shared/utils/to-posix-path.js";import{hashContentBytes as t}from"../shared/utils/content-hash.js";import{USER_MARKDOC_SCHEMA_FILE as n,registerUserMarkdocSchema as r,registerUserMarkdocSchemaFailure as i}from"../content-layer/markdown/constants/tag-sets.js";import{MARKDOC_SCHEMA_VIRTUAL_MODULE_ID as a}from"./constants/virtual-modules.js";import{userMarkdocSchemaFile as o}from"./vite-config.base.js";import{bundleForNode as s}from"./node-bundle.js";import{silentReporter as c}from"../shared/reporter.js";import{createServerReplayStubPlugin as l}from"./build/vite-config.js";import{isAbsolute as u,join as d,relative as f}from"node:path";import{readFile as p,readdir as m,realpath as h}from"node:fs/promises";const g=`@theme/markdoc/`;let _;async function v(e){let{contentDir:t,logger:i}=e;if(o(t)===null){r(void 0,void 0,[n]),_=/* @__PURE__ */ new Set;return}await(e.reporter??c).run(`Loading the Markdoc schema`,()=>y(t,i),e=>e===void 0?`Markdoc schema did not load (see the warning)`:`Loaded the Markdoc schema (${e} ${e===1?`tag`:`tags`})`)}async function y(e,t){let o=await h(e);try{let{module:n,moduleIds:i}=await s({contentDir:e,logger:t,input:a,plugins:[l()]}),c=S(i),u=c.map(e=>T(o,e));r({tags:n.userMarkdocTags,nodes:n.userMarkdocNodes,functions:n.userMarkdocFunctions},await x(o,c),u),_=new Set(u);let d=Object.keys(n.userMarkdocTags).length;return t.debug(`Loaded the project Markdoc schema: ${d} tag(s) from ${c.length} file(s)`),d}catch(e){_=/* @__PURE__ */ new Set([..._??[],n,...await C(o)]),i([..._]),t.warn(`The project Markdoc schema did not load; pages are not validated and its tags show their title in page Markdown: ${e instanceof Error?e.message:String(e)}`);return}}async function b(e){let t=_;return t===void 0||!e.changes.some(e=>t.has(e.path)||e.path.startsWith(g))?!1:(await v(e),!0)}async function x(e,n){let r=n.map(t=>({file:t,path:T(e,t)})).sort((e,t)=>e.path<t.path?-1:+(e.path>t.path)),i=await Promise.all(r.map(async({file:e,path:n})=>[n,await t(await p(e))]));return t(new TextEncoder().encode(JSON.stringify(i)))}function S(t){return[...new Set(t.map(t=>w(e(t))).filter(e=>u(e)&&!e.includes(`/node_modules/`)))]}async function C(e){return(await m(d(e,g),{recursive:!0,withFileTypes:!0})).filter(e=>e.isFile()).map(t=>T(e,d(t.parentPath,t.name)))}function w(e){let t=[e.indexOf(`?`),e.indexOf(`#`)].filter(e=>e!==-1);return t.length===0?e:e.slice(0,Math.min(...t))}function T(t,n){return e(f(t,n))}export{v as loadUserMarkdocSchema,b as reloadUserMarkdocSchemaIfChanged};
@@ -1,10 +1,10 @@
1
- import{toPosixPath as e}from"../shared/utils/to-posix-path.js";import{createCodeAssetsPlugin as t}from"./code-assets.js";import{getProcessEnv as n,getPublicEnv as r}from"../shared/public-env.js";import{getContentAssetsOutputDir as i,getRuntimeOutputDir as a}from"../shared/constants/runtime-layout.js";import{resolveRuntimeEntryFiles as o,resolveRuntimeServerModuleFiles as s,resolveRuntimeTemplateFiles as c,toViteFsModuleId as l}from"./runtime-files.js";import{createEmptyServerModuleSet as ee}from"../content-layer/server-modules/module-set.js";import{MARKDOC_COMPONENTS_VIRTUAL_MODULE_ID as te,MARKDOC_SCHEMA_VIRTUAL_MODULE_ID as ne,MCP_TOOLS_VIRTUAL_MODULE_ID as re,RUNTIME_HOOKS_VIRTUAL_MODULE_ID as ie,SERVER_FNS_VIRTUAL_MODULE_ID as ae,SERVER_MODULES_VIRTUAL_MODULE_ID as oe,SERVER_ROUTES_VIRTUAL_MODULE_ID as se,TEMPLATES_VIRTUAL_MODULE_ID as ce,THEME_STYLES_VIRTUAL_MODULE_ID as le}from"./constants/virtual-modules.js";import{VITE_LOG_STREAM as ue}from"../shared/constants/log-streams.js";import{createRequire as de}from"node:module";import{fileURLToPath as u,pathToFileURL as fe}from"node:url";import{existsSync as d,readdirSync as pe}from"node:fs";import{dirname as f,join as p}from"node:path";import me from"@redocly/markdoc";import he from"js-yaml";import{createLogger as ge,transformWithOxc as m}from"vite";import{init as _e,parse as ve}from"es-module-lexer";import ye from"@vitejs/plugin-react";const h=`__REALM_ENABLE_LAZY_STATIC_DATA__`,be=`__REALM_TEMPLATE_IDS__`,xe=`__REALM_BUILD_PATH_PREFIX__`,Se=`__REALM_BUILD_DEV_LOGIN__`,Ce=`__REALM_BUILD_ENV_FILE_DEFAULTS__`,g=`__REALM_VERSION__`,_=`\0${ce}`,v=`\0${ie}`,y=`\0${ae}`,b=`\0${se}`,x=`\0${oe}`,S=`\0${re}`,C=`\0${ne}`,w=`\0${te}`,T=`\0${le}`,E=`@redocly/theme`,we=RegExp(`^${E}(?:/|$)`),D=de(import.meta.url),Te=`window.$RefreshReg$ = () => {};window.$RefreshSig$ = () => (type) => type;window.__getReactRefreshIgnoredExports = ({ id }) => /\\.page\\.[jt]sx?$/.test(id) ? ['frontmatter'] : [];`,Ee=`/__realm_react_refresh__.js`,De=`<script type="module" src="/bundledDevClient.mjs"><\/script>`,Oe=[`@redocly/api-docs`,`@redocly/replay`,`@redocly/theme`];function ke(e){let n=o(e.contentDir);return{appType:`custom`,build:{rollupOptions:{input:n.clientEntryPath,...e.lazyDevCompilation===void 0?{}:{experimental:{devMode:{lazy:e.lazyDevCompilation}}}}},clearScreen:!1,logLevel:e.logger.isDebugEnabled(`runtime:vite`)?`info`:`warn`,customLogger:je(e.logger.child(ue)),define:k({enableLazyStaticData:e.enableLazyStaticData,themePathPrefixFromGlobal:!0}),experimental:{bundledDev:!0},oxc:{plugins:{styledComponents:{ssr:!0}}},resolve:{tsconfigPaths:!0},plugins:[N({externalizeForSsr:e.externalizeReactForSsr===!0}),Pe(),...ye(),Ke(n.clientEntryPath),Ve(e.templateSetProvider,e.contentDir),Ie(),F(e.styledComponentsDependencies,e.styledComponentsRoots),Y(e.contentDir),He(),t({contentDir:e.contentDir,outputDir:i(e.contentDir),registerSource:e.registerCodeAssetSource,logger:e.logger}),Ue(),G(),I(n,e.templateSetProvider,e.contentDir,e.serverModuleSet)],publicDir:!1,root:e.contentDir}}function Ae(){try{return D("../../package.json").version}catch{return`dev`}}function O(e,t){return e?t===`off`?`off`:`on`:t===`on`?`on`:`off`}function k(e){let t={[h]:JSON.stringify(e.enableLazyStaticData),[g]:JSON.stringify(Ae()),"process.env.REDOCLY_FIRST_PARTY":JSON.stringify(`true`),"process.env.REDOCLY_TELEMETRY":JSON.stringify(O(!!e.production,process.env.REDOCLY_TELEMETRY)),"process.env.REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED":JSON.stringify(n().REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED===`true`?`true`:`false`),"process.env.REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED":JSON.stringify(n().REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED===`true`?`true`:`false`)};for(let[e,n]of Object.entries(r()))t[`process.env.${e}`]=JSON.stringify(n);return e.production&&(t[`process.env.NODE_ENV`]=JSON.stringify(`production`)),e.themePathPrefixFromGlobal&&(t[`process.env.REDOCLY_PREFIX_PATHS`]=`globalThis.__REALM_PATH_PREFIX__`),t}function je(e){let t=/* @__PURE__ */ new Set;return ge(`info`,{allowClearScreen:!1,customLogger:{hasWarned:!1,clearScreen(){},hasErrorLogged(e){return t.has(e.message)},info(t){if(t.includes(`│ gzip:`)){e.debug(`\n${t}`);return}let n=t.trim();n!==``&&e.info(n)},warn(t){A(t)||(this.hasWarned=!0,e.warn(t.trimEnd()))},warnOnce(t){A(t)||(this.hasWarned=!0,e.warn(t.trimEnd()))},error(n,r){r?.error&&t.add(r.error.message),e.error(n)}}})}function A(e){return e.includes(`Failed to load source map`)||e.includes(`points to missing source files`)&&/[\\/]node_modules[\\/]/.test(e)}const j=/^(?:react|react-dom|react-router|react-router-dom)(?:\/|$)/,Me=/^react-router(?:-dom)?(?:\/|$)/;function M(e){return j.test(e)}function Ne(e){let t=fe(e).href,n=`export * from ${JSON.stringify(t)}; export { default } from ${JSON.stringify(t)};`;return`data:text/javascript,${encodeURIComponent(n)}`}function N(e){let t=u(import.meta.url);return{enforce:`pre`,name:`react-singleton-alias`,resolveId:{filter:{id:j},handler(n){if(Me.test(n)){let r=n.replace(/^react-router-dom/,`react-router`);return e.externalizeForSsr&&this.environment?.name===`ssr`?{external:!0,id:import.meta.resolve(r)}:this.resolve(r,t,{skipSelf:!0})}let r;try{r=D.resolve(n)}catch{return null}return e.externalizeForSsr&&this.environment?.name===`ssr`?{external:!0,id:Ne(r)}:r}}}}const P=/^@markdoc\/markdoc(?=\/|$)/;function Pe(){let e=import.meta.url.startsWith(`file:`)?u(import.meta.url):void 0;return{enforce:`pre`,name:`markdoc-fork-alias`,async resolveId(t,n,r){if(!P.test(t))return null;let i=t.replace(P,`@redocly/markdoc`),a={...r,skipSelf:!0};return(e?await this.resolve(i,e,a):null)??this.resolve(i,n,a)}}}const Fe=/\.(m?ts|[jt]sx|js)$/;function Ie(){let e=null;return{name:`ssr-transform`,apply:`serve`,buildStart(){e=_e},async transform(t,n){if(this.environment?.name!==`ssr`||!Fe.test(n))return null;let r=await m(t,n,{sourcemap:!0,plugins:{styledComponents:{ssr:!0}}});await e;let[i]=ve(r.code);if(i.length===0)return{code:r.code,map:r.map};let a=r.code;for(let e=i.length-1;e>=0;e--){let t=i[e],r=t.n;if(!r||!(r.startsWith(`.`)||r.startsWith(`virtual:`)||r.startsWith(`@redocly/theme`)||M(r)||r===`styled-components`||r===`file-saver`))continue;let o=await this.resolve(r,n);if(!o||o.external&&!M(r))continue;let s=Ze(o.id);if(s===r)continue;let c=t.d===-1?s:JSON.stringify(s);a=a.slice(0,t.s)+c+a.slice(t.e)}return{code:a,map:r.map}}}}const Le=/\/node_modules\/@redocly\/(?:api-docs|replay)\/.*\.m?js$/,Re=(()=>{let t=[],n;try{n=f(D.resolve(`@redocly/api-docs/package.json`)),t.push(n)}catch{}if(n)try{let e=f(D.resolve(`@redocly/replay`,{paths:[n]}));for(;e!==f(e)&&!d(p(e,`package.json`));)e=f(e);d(p(e,`package.json`))&&t.push(e)}catch{}return t.map(e).filter(e=>!e.includes(`/node_modules/`))})();function ze(t,n,r){if(Le.test(t))return!0;if(!/\.m?js$/.test(t))return!1;let i=e(t);return Re.some(e=>i.startsWith(`${e}/`))||r.some(t=>i.startsWith(`${e(t)}/`))?!0:n.some(e=>i.includes(`/node_modules/${e}/`))}function F(e=[],t=[]){let n=!1;return{name:`redocly-dep-styled-components`,configResolved(e){n=e.command===`serve`},async transform(r,i){if(n&&this.environment?.name===`ssr`)return null;let a=(i.split(`?`,1)[0]??i).replace(/^\/@fs/,``);if(!ze(a,e,t)||!r.includes(`styled`))return null;let{code:o,map:s}=await m(r,a,{sourcemap:n,plugins:{styledComponents:{ssr:!0}}});return{code:o,map:s}}}}function I(e,t,n,r=ee()){return{name:`templates-virtual-module`,resolveId(e){return e===`virtual:realm-templates`?_:e===`virtual:realm-runtime`?v:e===`virtual:realm-server-fns`?y:e===`virtual:realm-server-routes`?b:e===`virtual:realm-server-modules`?x:e===`virtual:realm-mcp-tools`?S:e===`virtual:realm-markdoc-schema`?C:e===`virtual:realm-markdoc-components`?w:e===`virtual:realm-theme-styles`?T:null},async load(i){if(i===v){let t=l(e.appModulePath);return`export { useLoaderData, usePageData, usePageProps, usePageSharedData, useSharedData, prefetchPage, useL10nHref } from ${JSON.stringify(t)};`}if(i===y){let t=e.serverFnFiles.map(e=>` ${JSON.stringify(e.id)}: async () => (await import(${JSON.stringify(l(e.filePath))}))[${JSON.stringify(e.exportName)}],`),n=e.serverFnFiles.map(e=>` ${JSON.stringify(e.id)}: ${JSON.stringify({plugin:e.plugin,cacheable:e.cacheable,markdoc:e.markdoc})},`);return[`const serverFnLoaders = {`,...t,`};`,`const serverFnMetadata = {`,...n,`};`,`globalThis.__REALM_SERVER_FN_LOADERS__ = {`,` ...(globalThis.__REALM_SERVER_FN_LOADERS__ ?? {}),`,` ...serverFnLoaders,`,`};`,`globalThis.__REALM_SERVER_FN_METADATA__ = {`,` ...(globalThis.__REALM_SERVER_FN_METADATA__ ?? {}),`,` ...serverFnMetadata,`,`};`,`export { serverFnLoaders };`].join(`
2
- `)}if(i===b)return L(e.serverRouteFiles);if(i===x)return z(s(r,n));if(i===S)return R(e.mcpToolFiles);if(i===C)return U(B(n));if(i===w)return W(V(n,`components.tsx`));if(i===T)return H(Be(n,`styles.css`));if(i!==_)return null;let a=await t.current();return[`export const templateLoaders = {`,...c(a,n).map(e=>` ${JSON.stringify(e.templateId)}: () => import(${JSON.stringify(e.filePath)}),`),`};`].join(`
3
- `)}}}function L(e){return[`export const serverRoutes = [`,...e.map(e=>` { ${[`plugin: ${JSON.stringify(e.plugin)}`,...e.method===void 0?[]:[`method: ${JSON.stringify(e.method)}`],`path: ${JSON.stringify(e.path)}`,...e.auth===void 0?[]:[`auth: ${JSON.stringify(e.auth)}`],`loadHandler: async () => (await import(${JSON.stringify(l(e.handler.filePath))}))[${JSON.stringify(e.handler.exportName)}]`].join(`, `)} },`),`];`].join(`
4
- `)}function R(e){return`export const mcpTools = ${JSON.stringify(e,null,2)};`}function z(e){return[`export const serverModules = {`,...e.map(e=>` ${JSON.stringify(e.key)}: () => import(${JSON.stringify(l(e.filePath))}),`),`};`].join(`
5
- `)}function B(e){return V(e,`schema.ts`)}function V(e,t){let n=p(e,`@theme`,`markdoc`,t);return d(n)?n:null}function Be(e,t){let n=p(e,`@theme`,t);return d(n)?n:null}function H(e){return e?`import ${JSON.stringify(e)};`:`export {};`}function U(e){return[...e?[`import * as userSchema from ${JSON.stringify(e)};`,`const { tags = {}, nodes = {}, functions = {}, default: _default, ...topLevelTags } = userSchema;`,`const tagNameOf = ([key, schema]) => [schema && typeof schema.tagName === 'string' ? schema.tagName : key, schema];`,`const markdocNodeNames = new Set(${JSON.stringify(Object.keys(me.nodes))});`,`const namedEntries = Object.entries({ ...topLevelTags, ...tags }).map(tagNameOf);`,`export const userMarkdocTags = Object.fromEntries(namedEntries.filter(([name]) => !markdocNodeNames.has(name)));`,`export const userMarkdocNodes = { ...Object.fromEntries(namedEntries.filter(([name]) => markdocNodeNames.has(name))), ...nodes };`,`export const userMarkdocFunctions = { ...functions };`]:[`export const userMarkdocTags = {};`,`export const userMarkdocNodes = {};`,`export const userMarkdocFunctions = {};`],`globalThis.__REALM_MARKDOC_USER_SCHEMA__ = { tags: userMarkdocTags, nodes: userMarkdocNodes, functions: userMarkdocFunctions };`].join(`
6
- `)}function W(e){return e?[`import * as userComponents from ${JSON.stringify(e)};`,`export const userMarkdocComponents = { ...userComponents };`].join(`
7
- `):`export const userMarkdocComponents = {};`}function Ve(e,t){let n=null,r=null,i=(e,t,n)=>{let r=e.get(n);return r===void 0?null:{code:`${t}
1
+ import{toPosixPath as e}from"../shared/utils/to-posix-path.js";import{createCodeAssetsPlugin as t}from"./code-assets.js";import{getProcessEnv as n,getPublicEnv as r}from"../shared/public-env.js";import{getContentAssetsOutputDir as i,getRuntimeOutputDir as a}from"../shared/constants/runtime-layout.js";import{createEmptyServerModuleSet as o}from"../content-layer/server-modules/module-set.js";import{resolveRuntimeEntryFiles as s,resolveRuntimeServerModuleFiles as c,resolveRuntimeTemplateFiles as l,toViteFsModuleId as u}from"./runtime-files.js";import{MARKDOC_COMPONENTS_VIRTUAL_MODULE_ID as ee,MARKDOC_SCHEMA_VIRTUAL_MODULE_ID as te,MCP_TOOLS_VIRTUAL_MODULE_ID as ne,RUNTIME_HOOKS_VIRTUAL_MODULE_ID as re,SERVER_FNS_VIRTUAL_MODULE_ID as ie,SERVER_MODULES_VIRTUAL_MODULE_ID as ae,SERVER_ROUTES_VIRTUAL_MODULE_ID as oe,TEMPLATES_VIRTUAL_MODULE_ID as se,THEME_STYLES_VIRTUAL_MODULE_ID as ce}from"./constants/virtual-modules.js";import{VITE_LOG_STREAM as le}from"../shared/constants/log-streams.js";import{createRequire as ue}from"node:module";import{fileURLToPath as d,pathToFileURL as de}from"node:url";import{existsSync as f,readdirSync as fe}from"node:fs";import{dirname as p,join as m}from"node:path";import{createLogger as pe,transformWithOxc as h}from"vite";import me from"@redocly/markdoc";import{init as he,parse as ge}from"es-module-lexer";import _e from"js-yaml";import ve from"@vitejs/plugin-react";const g=`__REALM_ENABLE_LAZY_STATIC_DATA__`,ye=`__REALM_TEMPLATE_IDS__`,be=`__REALM_BUILD_PATH_PREFIX__`,xe=`__REALM_BUILD_DEV_LOGIN__`,Se=`__REALM_BUILD_ENV_FILE_DEFAULTS__`,_=`__REALM_VERSION__`,v=`\0${se}`,y=`\0${re}`,b=`\0${ie}`,x=`\0${oe}`,S=`\0${ae}`,C=`\0${ne}`,w=`\0${te}`,T=`\0${ee}`,E=`\0${ce}`,D=`@redocly/theme`,Ce=RegExp(`^${D}(?:/|$)`),O=ue(import.meta.url),we=`window.$RefreshReg$ = () => {};window.$RefreshSig$ = () => (type) => type;window.__getReactRefreshIgnoredExports = ({ id }) => /\\.page\\.[jt]sx?$/.test(id) ? ['frontmatter'] : [];`,Te=`/__realm_react_refresh__.js`,Ee=`<script type="module" src="/bundledDevClient.mjs"><\/script>`,De=[`@redocly/api-docs`,`@redocly/replay`,`@redocly/theme`];function Oe(e){let n=s(e.contentDir);return{appType:`custom`,build:{rollupOptions:{input:n.clientEntryPath,...e.lazyDevCompilation===void 0?{}:{experimental:{devMode:{lazy:e.lazyDevCompilation}}}}},clearScreen:!1,logLevel:e.logger.isDebugEnabled(`runtime:vite`)?`info`:`warn`,customLogger:Ae(e.logger.child(le)),define:A({enableLazyStaticData:e.enableLazyStaticData,themePathPrefixFromGlobal:!0}),experimental:{bundledDev:!0},oxc:{plugins:{styledComponents:{ssr:!0}}},resolve:{tsconfigPaths:!0},plugins:[P({externalizeForSsr:e.externalizeReactForSsr===!0}),Ne(),...ve(),Ge(n.clientEntryPath),Be(e.templateSetProvider,e.contentDir),Fe(),I(e.styledComponentsDependencies,e.styledComponentsRoots),Z(e.contentDir),L(),Ve(),t({contentDir:e.contentDir,outputDir:i(e.contentDir),registerSource:e.registerCodeAssetSource,logger:e.logger}),He(),q(),R(n,e.templateSetProvider,e.contentDir,e.serverModuleSet)],publicDir:!1,root:e.contentDir}}function ke(){try{return O("../../package.json").version}catch{return`dev`}}function k(e,t){return e?t===`off`?`off`:`on`:t===`on`?`on`:`off`}function A(e){let t={[g]:JSON.stringify(e.enableLazyStaticData),[_]:JSON.stringify(ke()),"process.env.REDOCLY_FIRST_PARTY":JSON.stringify(`true`),"process.env.REDOCLY_TELEMETRY":JSON.stringify(k(!!e.production,process.env.REDOCLY_TELEMETRY)),"process.env.REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED":JSON.stringify(n().REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED===`true`?`true`:`false`),"process.env.REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED":JSON.stringify(n().REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED===`true`?`true`:`false`)};for(let[e,n]of Object.entries(r()))t[`process.env.${e}`]=JSON.stringify(n);return e.production&&(t[`process.env.NODE_ENV`]=JSON.stringify(`production`)),e.themePathPrefixFromGlobal&&(t[`process.env.REDOCLY_PREFIX_PATHS`]=`globalThis.__REALM_PATH_PREFIX__`),t}function Ae(e){let t=/* @__PURE__ */ new Set;return pe(`info`,{allowClearScreen:!1,customLogger:{hasWarned:!1,clearScreen(){},hasErrorLogged(e){return t.has(e.message)},info(t){if(t.includes(`│ gzip:`)){e.debug(`\n${t}`);return}let n=t.trim();n!==``&&e.info(n)},warn(t){j(t)||(this.hasWarned=!0,e.warn(t.trimEnd()))},warnOnce(t){j(t)||(this.hasWarned=!0,e.warn(t.trimEnd()))},error(n,r){r?.error&&t.add(r.error.message),e.error(n)}}})}function j(e){return e.includes(`Failed to load source map`)||e.includes(`points to missing source files`)&&/[\\/]node_modules[\\/]/.test(e)}const M=/^(?:react|react-dom|react-router|react-router-dom)(?:\/|$)/,je=/^react-router(?:-dom)?(?:\/|$)/;function N(e){return M.test(e)}function Me(e){let t=de(e).href,n=`export * from ${JSON.stringify(t)}; export { default } from ${JSON.stringify(t)};`;return`data:text/javascript,${encodeURIComponent(n)}`}function P(e){let t=d(import.meta.url);return{enforce:`pre`,name:`react-singleton-alias`,resolveId:{filter:{id:M},handler(n){if(je.test(n)){let r=n.replace(/^react-router-dom/,`react-router`);return e.externalizeForSsr&&this.environment?.name===`ssr`?{external:!0,id:import.meta.resolve(r)}:this.resolve(r,t,{skipSelf:!0})}let r;try{r=O.resolve(n)}catch{return null}return e.externalizeForSsr&&this.environment?.name===`ssr`?{external:!0,id:Me(r)}:r}}}}const F=/^@markdoc\/markdoc(?=\/|$)/;function Ne(){let e=import.meta.url.startsWith(`file:`)?d(import.meta.url):void 0;return{enforce:`pre`,name:`markdoc-fork-alias`,async resolveId(t,n,r){if(!F.test(t))return null;let i=t.replace(F,`@redocly/markdoc`),a={...r,skipSelf:!0};return(e?await this.resolve(i,e,a):null)??this.resolve(i,n,a)}}}const Pe=/\.(m?ts|[jt]sx|js)$/;function Fe(){let e=null;return{name:`ssr-transform`,apply:`serve`,buildStart(){e=he},async transform(t,n){if(this.environment?.name!==`ssr`||!Pe.test(n))return null;let r=await h(t,n,{sourcemap:!0,plugins:{styledComponents:{ssr:!0}}});await e;let[i]=ge(r.code);if(i.length===0)return{code:r.code,map:r.map};let a=r.code;for(let e=i.length-1;e>=0;e--){let t=i[e],r=t.n;if(!r||!(r.startsWith(`.`)||r.startsWith(`virtual:`)||r.startsWith(`@redocly/theme`)||N(r)||r===`styled-components`||r===`file-saver`))continue;let o=await this.resolve(r,n);if(!o||o.external&&!N(r))continue;let s=Qe(o.id);if(s===r)continue;let c=t.d===-1?s:JSON.stringify(s);a=a.slice(0,t.s)+c+a.slice(t.e)}return{code:a,map:r.map}}}}const Ie=/\/node_modules\/@redocly\/(?:api-docs|replay)\/.*\.m?js$/,Le=(()=>{let t=[],n;try{n=p(O.resolve(`@redocly/api-docs/package.json`)),t.push(n)}catch{}if(n)try{let e=p(O.resolve(`@redocly/replay`,{paths:[n]}));for(;e!==p(e)&&!f(m(e,`package.json`));)e=p(e);f(m(e,`package.json`))&&t.push(e)}catch{}return t.map(e).filter(e=>!e.includes(`/node_modules/`))})();function Re(t,n,r){if(Ie.test(t))return!0;if(!/\.m?js$/.test(t))return!1;let i=e(t);return Le.some(e=>i.startsWith(`${e}/`))||r.some(t=>i.startsWith(`${e(t)}/`))?!0:n.some(e=>i.includes(`/node_modules/${e}/`))}function I(e=[],t=[]){let n=!1;return{name:`redocly-dep-styled-components`,configResolved(e){n=e.command===`serve`},async transform(r,i){if(n&&this.environment?.name===`ssr`)return null;let a=(i.split(`?`,1)[0]??i).replace(/^\/@fs/,``);if(!Re(a,e,t)||!r.includes(`styled`))return null;let{code:o,map:s}=await h(r,a,{sourcemap:n,plugins:{styledComponents:{ssr:!0}}});return{code:o,map:s}}}}function L(){return{name:`realm-api-docs-global-style-stub`,load(t){return e(t.split(`?`,1)[0]??t).endsWith(`/api-docs/lib/components/GlobalStyle.js`)?`export function GlobalStyle() { return null; }`:null}}}function R(e,t,n,r=o()){return{name:`templates-virtual-module`,resolveId(e){return e===`virtual:realm-templates`?v:e===`virtual:realm-runtime`?y:e===`virtual:realm-server-fns`?b:e===`virtual:realm-server-routes`?x:e===`virtual:realm-server-modules`?S:e===`virtual:realm-mcp-tools`?C:e===`virtual:realm-markdoc-schema`?w:e===`virtual:realm-markdoc-components`?T:e===`virtual:realm-theme-styles`?E:null},async load(i){if(i===y){let t=u(e.appModulePath);return`export { useLoaderData, usePageData, usePageProps, usePageSharedData, useSharedData, prefetchPage, useL10nHref } from ${JSON.stringify(t)};`}if(i===b){let t=e.serverFnFiles.map(e=>` ${JSON.stringify(e.id)}: async () => (await import(${JSON.stringify(u(e.filePath))}))[${JSON.stringify(e.exportName)}],`),n=e.serverFnFiles.map(e=>` ${JSON.stringify(e.id)}: ${JSON.stringify({plugin:e.plugin,cacheable:e.cacheable,markdoc:e.markdoc})},`);return[`const serverFnLoaders = {`,...t,`};`,`const serverFnMetadata = {`,...n,`};`,`globalThis.__REALM_SERVER_FN_LOADERS__ = {`,` ...(globalThis.__REALM_SERVER_FN_LOADERS__ ?? {}),`,` ...serverFnLoaders,`,`};`,`globalThis.__REALM_SERVER_FN_METADATA__ = {`,` ...(globalThis.__REALM_SERVER_FN_METADATA__ ?? {}),`,` ...serverFnMetadata,`,`};`,`export { serverFnLoaders };`].join(`
2
+ `)}if(i===x)return z(e.serverRouteFiles);if(i===S)return V(c(r,n));if(i===C)return B(e.mcpToolFiles);if(i===w)return G(H(n));if(i===T)return K(U(n,`components.tsx`));if(i===E)return W(ze(n,`styles.css`));if(i!==v)return null;let a=await t.current();return[`export const templateLoaders = {`,...l(a,n).map(e=>` ${JSON.stringify(e.templateId)}: () => import(${JSON.stringify(e.filePath)}),`),`};`].join(`
3
+ `)}}}function z(e){return[`export const serverRoutes = [`,...e.map(e=>` { ${[`plugin: ${JSON.stringify(e.plugin)}`,...e.method===void 0?[]:[`method: ${JSON.stringify(e.method)}`],`path: ${JSON.stringify(e.path)}`,...e.auth===void 0?[]:[`auth: ${JSON.stringify(e.auth)}`],`loadHandler: async () => (await import(${JSON.stringify(u(e.handler.filePath))}))[${JSON.stringify(e.handler.exportName)}]`].join(`, `)} },`),`];`].join(`
4
+ `)}function B(e){return`export const mcpTools = ${JSON.stringify(e,null,2)};`}function V(e){return[`export const serverModules = {`,...e.map(e=>` ${JSON.stringify(e.key)}: () => import(${JSON.stringify(u(e.filePath))}),`),`};`].join(`
5
+ `)}function H(e){return U(e,`schema.ts`)}function U(e,t){let n=m(e,`@theme`,`markdoc`,t);return f(n)?n:null}function ze(e,t){let n=m(e,`@theme`,t);return f(n)?n:null}function W(e){return e?`import ${JSON.stringify(e)};`:`export {};`}function G(e){return[...e?[`import * as userSchema from ${JSON.stringify(e)};`,`const { tags = {}, nodes = {}, functions = {}, default: _default, ...topLevelTags } = userSchema;`,`const tagNameOf = ([key, schema]) => [schema && typeof schema.tagName === 'string' ? schema.tagName : key, schema];`,`const markdocNodeNames = new Set(${JSON.stringify(Object.keys(me.nodes))});`,`const namedEntries = Object.entries({ ...topLevelTags, ...tags }).map(tagNameOf);`,`export const userMarkdocTags = Object.fromEntries(namedEntries.filter(([name]) => !markdocNodeNames.has(name)));`,`export const userMarkdocNodes = { ...Object.fromEntries(namedEntries.filter(([name]) => markdocNodeNames.has(name))), ...nodes };`,`export const userMarkdocFunctions = { ...functions };`]:[`export const userMarkdocTags = {};`,`export const userMarkdocNodes = {};`,`export const userMarkdocFunctions = {};`],`globalThis.__REALM_MARKDOC_USER_SCHEMA__ = { tags: userMarkdocTags, nodes: userMarkdocNodes, functions: userMarkdocFunctions };`].join(`
6
+ `)}function K(e){return e?[`import * as userComponents from ${JSON.stringify(e)};`,`export const userMarkdocComponents = { ...userComponents };`].join(`
7
+ `):`export const userMarkdocComponents = {};`}function Be(e,t){let n=null,r=null,i=(e,t,n)=>{let r=e.get(n);return r===void 0?null:{code:`${t}
8
8
 
9
9
  if (import.meta.hot) {
10
10
  import.meta.hot.accept((nextModule) => {
@@ -18,11 +18,11 @@ if (import.meta.hot) {
18
18
  }
19
19
  });
20
20
  }
21
- `,map:null}};return{name:`template-component-registry`,apply:`serve`,transform(a,o){if(this.environment?.name!==`client`)return null;let s=o.split(`?`,1)[0]??o,l=e.current();return r&&n===l?i(r,a,s):(n=l,l.then(e=>{let n=new Map(c(e,t).map(e=>[e.filePath,e.templateId]));return r=n,i(n,a,s)}))}}}function He(){let e=`\0cjs-shim:file-saver`,t=f(D.resolve(`${E}/package.json`)),n=D.resolve(`file-saver`,{paths:[t]}),r=D.resolve(`styled-components/dist/styled-components.esm.js`);return{enforce:`pre`,name:`cjs-shim`,resolveId(t,n){return t===`styled-components`?r:t===`file-saver`&&n!==e?e:null},load(t){return t===e?this.environment?.name===`ssr`?`export const saveAs = () => {};
21
+ `,map:null}};return{name:`template-component-registry`,apply:`serve`,transform(a,o){if(this.environment?.name!==`client`)return null;let s=o.split(`?`,1)[0]??o,c=e.current();return r&&n===c?i(r,a,s):(n=c,c.then(e=>{let n=new Map(l(e,t).map(e=>[e.filePath,e.templateId]));return r=n,i(n,a,s)}))}}}function Ve(){let e=`\0cjs-shim:file-saver`,t=p(O.resolve(`${D}/package.json`)),n=O.resolve(`file-saver`,{paths:[t]}),r=O.resolve(`styled-components/dist/styled-components.esm.js`);return{enforce:`pre`,name:`cjs-shim`,resolveId(t,n){return t===`styled-components`?r:t===`file-saver`&&n!==e?e:null},load(t){return t===e?this.environment?.name===`ssr`?`export const saveAs = () => {};
22
22
  export default { saveAs };
23
- `:`import _m from ${JSON.stringify(l(n))};\nexport const saveAs = _m.saveAs ?? _m;\nexport default _m;\n`:null},transform(e,t){return t!==r||this.environment?.name!==`ssr`?null:{code:`import { createRequire as __scCreateRequire } from "node:module";
23
+ `:`import _m from ${JSON.stringify(u(n))};\nexport const saveAs = _m.saveAs ?? _m;\nexport default _m;\n`:null},transform(e,t){return t!==r||this.environment?.name!==`ssr`?null:{code:`import { createRequire as __scCreateRequire } from "node:module";
24
24
  const require = __scCreateRequire(import.meta.url);
25
- `+e,map:null}}}}function Ue(){let e=`\0browser-stream-shim:stream`;return{enforce:`pre`,name:`browser-stream-shim`,resolveId(t){return t===`stream`&&this.environment?.name===`client`?e:null},load(t){return t===e?[`export class Transform {`,` constructor() {`,` throw new Error("Node.js streams are not available in the browser.");`,` }`,`}`,`export default { Transform };`].join(`
26
- `):null}}}const We=/\.ya?ml(?:$|\?)/,Ge=/[?&](?:worker|sharedworker|raw|url)\b/;function G(){return{name:`realm-yaml`,transform(e,t){if(!We.test(t)||Ge.test(t))return null;try{return{code:`export default ${JSON.stringify(he.load(e))};`,map:null}}catch(e){let n=t.split(`?`,1)[0]??t;return this.error(`Failed to parse YAML ${n}: ${e.message}`)}}}}const K=`virtual:realm-react-refresh-inject`,q=`\0${K}`;function Ke(e){return{name:`dev-entry`,apply:`serve`,resolveId(e){return e===K?q:null},load(e){return e===q?`import { injectIntoGlobalHook } from "/@react-refresh";
25
+ `+e,map:null}}}}function He(){let e=`\0browser-stream-shim:stream`;return{enforce:`pre`,name:`browser-stream-shim`,resolveId(t){return t===`stream`&&this.environment?.name===`client`?e:null},load(t){return t===e?[`export class Transform {`,` constructor() {`,` throw new Error("Node.js streams are not available in the browser.");`,` }`,`}`,`export default { Transform };`].join(`
26
+ `):null}}}const Ue=/\.ya?ml(?:$|\?)/,We=/[?&](?:worker|sharedworker|raw|url)\b/;function q(){return{name:`realm-yaml`,transform(e,t){if(!Ue.test(t)||We.test(t))return null;try{return{code:`export default ${JSON.stringify(_e.load(e))};`,map:null}}catch(e){let n=t.split(`?`,1)[0]??t;return this.error(`Failed to parse YAML ${n}: ${e.message}`)}}}}const J=`virtual:realm-react-refresh-inject`,Y=`\0${J}`;function Ge(e){return{name:`dev-entry`,apply:`serve`,resolveId(e){return e===J?Y:null},load(e){return e===Y?`import { injectIntoGlobalHook } from "/@react-refresh";
27
27
  injectIntoGlobalHook(window);
28
- `:null},transform(t,n){return this.environment?.name!==`client`||n!==e?null:{code:`import ${JSON.stringify(K)};\n`+t,map:null}}}}const J=/* @__PURE__ */ new Map;function qe(e){let t=J.get(e);if(t)return t;let n=/* @__PURE__ */ new Set,r=e=>{let t;try{t=pe(e,{withFileTypes:!0})}catch{return}for(let i of t){if(i.name.startsWith(`.`))continue;let t=p(e,i.name);i.isDirectory()?r(t):n.add(t)}};return r(e),J.set(e,n),n}function Je(e){if(e===void 0){J.clear();return}J.delete(p(e,`@theme`))}function Y(e){return{enforce:`pre`,name:`redocly-theme-source`,resolveId:{filter:{id:we},handler(t,n){return Q(t,{contentDir:e,importer:n})}}}}function X(e){return e===E?`index`:e.startsWith(`${E}/`)?e.slice(`${E}/`.length).replace(/^src\//,``):null}function Z(e,t){let n=X(e);if(n===null||!t.contentDir)return null;let r=p(t.contentDir,`@theme`),i=qe(r),a=Xe(t.importer);for(let e of $(r,n))if(e!==a&&i.has(e))return e;return null}function Q(e,t={}){let n=X(e);if(n===null)return null;let r=Z(e,t);if(r)return r;let i=f(D.resolve(`${E}/package.json`)),a=p(i,`src`);for(let e of $(a,n))if(d(e))return e;return null}const Ye=/\.(?:tsx?|jsx?)$/;function $(e,t){return Ye.test(t)?[p(e,t)]:[p(e,`${t}.ts`),p(e,`${t}.tsx`),p(e,`${t}.js`),p(e,`${t}.jsx`),p(e,t,`index.ts`),p(e,t,`index.tsx`),p(e,t,`index.js`),p(e,t,`index.jsx`)]}function Xe(e){return e?(e.split(`?`,1)[0]??e).replace(/^\/@fs/,``):null}function Ze(e){return e.startsWith(`\0`)?`/@id/${e.replace(`\0`,`__x00__`)}`:e.startsWith(`/`)?l(e):e}export{De as BUNDLED_DEV_CLIENT_SCRIPT_TAG,Se as DEV_LOGIN_DEFINE,h as ENABLE_LAZY_STATIC_DATA_DEFINE,Ce as ENV_FILE_DEFAULTS_DEFINE,xe as PATH_PREFIX_DEFINE,Te as REACT_REFRESH_PREAMBLE,Ee as REACT_REFRESH_PREAMBLE_PATH,Oe as REDOCLY_SSR_NO_EXTERNAL,be as TEMPLATE_IDS_DEFINE,g as VERSION_DEFINE,ke as createBaseViteConfig,k as createDefineValues,F as createDepStyledComponentsTransformPlugin,N as createReactSingletonAliasPlugin,I as createTemplatesVirtualModulePlugin,Y as createThemeSourcePlugin,je as createViteCustomLogger,G as createYamlPlugin,Z as findThemeOverride,a as getRuntimeOutputDir,Je as invalidateThemeOverrideIndex,W as renderMarkdocComponentsModule,U as renderMarkdocSchemaModule,R as renderMcpToolsModule,z as renderServerModulesModule,L as renderServerRoutesModule,H as renderThemeStylesModule,O as resolveClientTelemetryFlag,Q as resolveThemeSourceImport,B as userMarkdocSchemaFile};
28
+ `:null},transform(t,n){return this.environment?.name!==`client`||n!==e?null:{code:`import ${JSON.stringify(J)};\n`+t,map:null}}}}const X=/* @__PURE__ */ new Map;function Ke(e){let t=X.get(e);if(t)return t;let n=/* @__PURE__ */ new Set,r=e=>{let t;try{t=fe(e,{withFileTypes:!0})}catch{return}for(let i of t){if(i.name.startsWith(`.`))continue;let t=m(e,i.name);i.isDirectory()?r(t):n.add(t)}};return r(e),X.set(e,n),n}function qe(e){if(e===void 0){X.clear();return}X.delete(m(e,`@theme`))}function Z(e){return{enforce:`pre`,name:`redocly-theme-source`,resolveId:{filter:{id:Ce},handler(t,n){return Ye(t,{contentDir:e,importer:n})}}}}function Q(e){return e===D?`index`:e.startsWith(`${D}/`)?e.slice(`${D}/`.length).replace(/^src\//,``):null}function Je(e,t){let n=Q(e);if(n===null||!t.contentDir)return null;let r=m(t.contentDir,`@theme`),i=Ke(r),a=Ze(t.importer);for(let e of $(r,n))if(e!==a&&i.has(e))return e;return null}function Ye(e,t={}){let n=Q(e);if(n===null)return null;let r=Je(e,t);if(r)return r;let i=p(O.resolve(`${D}/package.json`)),a=m(i,`src`);for(let e of $(a,n))if(f(e))return e;return null}const Xe=/\.(?:tsx?|jsx?)$/;function $(e,t){return Xe.test(t)?[m(e,t)]:[m(e,`${t}.ts`),m(e,`${t}.tsx`),m(e,`${t}.js`),m(e,`${t}.jsx`),m(e,t,`index.ts`),m(e,t,`index.tsx`),m(e,t,`index.js`),m(e,t,`index.jsx`)]}function Ze(e){return e?(e.split(`?`,1)[0]??e).replace(/^\/@fs/,``):null}function Qe(e){return e.startsWith(`\0`)?`/@id/${e.replace(`\0`,`__x00__`)}`:e.startsWith(`/`)?u(e):e}export{Ee as BUNDLED_DEV_CLIENT_SCRIPT_TAG,xe as DEV_LOGIN_DEFINE,g as ENABLE_LAZY_STATIC_DATA_DEFINE,Se as ENV_FILE_DEFAULTS_DEFINE,be as PATH_PREFIX_DEFINE,we as REACT_REFRESH_PREAMBLE,Te as REACT_REFRESH_PREAMBLE_PATH,De as REDOCLY_SSR_NO_EXTERNAL,ye as TEMPLATE_IDS_DEFINE,_ as VERSION_DEFINE,L as createApiDocsGlobalStyleStubPlugin,Oe as createBaseViteConfig,A as createDefineValues,I as createDepStyledComponentsTransformPlugin,P as createReactSingletonAliasPlugin,R as createTemplatesVirtualModulePlugin,Z as createThemeSourcePlugin,Ae as createViteCustomLogger,q as createYamlPlugin,Je as findThemeOverride,a as getRuntimeOutputDir,qe as invalidateThemeOverrideIndex,K as renderMarkdocComponentsModule,G as renderMarkdocSchemaModule,B as renderMcpToolsModule,V as renderServerModulesModule,z as renderServerRoutesModule,W as renderThemeStylesModule,k as resolveClientTelemetryFlag,Ye as resolveThemeSourceImport,H as userMarkdocSchemaFile};
@@ -1 +1 @@
1
- import{getPathPrefix as e,setGlobalPathPrefix as t}from"../../shared/path-prefix.js";import{formatCommandRows as n,formatCompletion as r,formatContentRow as i,formatFailure as a,formatFileChanges as o,pluralize as s,printBuildHelp as c,shouldUseColors as l}from"../output.js";import{stopwatch as u}from"../../shared/logger.js";import{writeBuildOutputMetadata as d}from"../../bundler/build/output-metadata.js";import{assertRuntimeBuildOptions as f,runBuild as p}from"../../bundler/build/run.js";import{validateReactPages as m}from"../validate-react-pages.js";import{parseArgs as h}from"../parse-args.js";import{COMMON_FLAGS as g,parseBuildTarget as _,parseHintsFlag as v,parseHostPlatform as y,parseOptionalStringFlag as b,reportUsageError as x,resolveCommonArgs as S,setUpLogging as C}from"../args.js";import{createCliOutput as w,shouldWriteLogGroups as T}from"../log-output/index.js";import{formatProblemCounts as E,reportProblems as D}from"../problems-output.js";import{hasInjectedContentSteps as O,openContentSession as k,recordRunFailure as A,runContentIngestWithStaticDataBuild as j}from"./ingest.js";import M from"node:process";async function N(N,P,F){let I=h(N,{alias:g.alias,boolean:[...g.boolean,`dev-login`],string:[...g.string,`hints`,`target`,`platform`,`path-prefix`]});if(I.help)return c(P.stdout),0;let L,R,z,B;try{let e=S(I);L=C(e,w(P,e)),R=_(I.target),z=y(I.platform),B=b(I[`path-prefix`],`--path-prefix`),f(R,z)}catch(e){return x(e,P)}t(B??M.env.REDOCLY_PREFIX_PATHS??``);let{logger:V,reporter:H}=L,U=l();P.stdout(n([i(L.contentDir),[`Prefix`,e()||void 0]],U)),V.debug(`Process startup took ${M.uptime().toFixed(2)}s`);let W=u(),G;try{G=O(F)?void 0:await k(L);let{ingestResult:e,problems:t,staticDataResult:n,ignoreMarkdocErrors:i}=await j(L,F,{hints:v(I.hints),session:G}),c=D(P,t,{ignoreMarkdocErrors:i,groups:T(P)}),l=await(F.runRuntimeBuild??p)({contentDir:L.contentDir,target:R,platform:z,logger:V,reporter:H,templateSet:e.templateSet,serverModuleSet:e.serverModuleSet,devLogin:I[`dev-login`]===!0}),u=await H.run(`Validating React pages`,()=>m({contentDir:L.contentDir,outputDir:l.outputDir,sourceTemplates:e.templateSet.sourceTemplates,databaseUrl:L.databaseUrl,database:G?.database,context:G?.context,logger:V}),({pageCount:e,renderedCount:t,problems:n})=>{if(e===0)return`No React pages`;if(t===0)return`${s(e,`React page`)} unchanged`;let r=t===e?`Checked ${s(e,`React page`)}`:`Checked ${t} of ${s(e,`React page`)}`;return n.length>0?`${r}, ${n.length} failed to render`:r}),f=D(P,u.problems,{ignoreMarkdocErrors:i,groups:T(P)});return await(F.writeBuildOutputMetadata??d)({contentDir:L.contentDir,outputDir:l.outputDir,databaseUrl:L.databaseUrl,database:G?.database,context:G?.context,logger:V}),P.stdout(``),c+f>0?(P.stdout(a(`Build failed`,W(),`${s(c+f,`content error`)} (see Problems above)`,{colors:U,stacks:L.stacks})),1):(P.stdout(r(`Build complete`,W(),[[`Files`,o(e.diff.summary)],[`Prepared`,s(n.staticDataCount,`content item`)],[`Problems`,E(t,{ignoreMarkdocErrors:i})]],U)),0)}catch(e){P.stdout(a(`Build failed`,W(),e,{colors:U,stacks:L.stacks}));let t=G?.database.close();return G=void 0,await t?.catch(()=>void 0),await A(L,F,e),1}finally{await G?.database.close()}}export{N as runBuild};
1
+ import{stopwatch as e}from"../../shared/logger.js";import{getPathPrefix as t,setGlobalPathPrefix as n}from"../../shared/path-prefix.js";import{formatCommandRows as r,formatCompletion as i,formatContentRow as a,formatFailure as o,formatFileChanges as s,pluralize as c,printBuildHelp as l,shouldUseColors as u}from"../output.js";import{writeBuildOutputMetadata as d}from"../../bundler/build/output-metadata.js";import{assertRuntimeBuildOptions as f,runBuild as p}from"../../bundler/build/run.js";import{validateReactPages as m}from"../validate-react-pages.js";import{parseArgs as h}from"../parse-args.js";import{COMMON_FLAGS as g,parseBuildTarget as _,parseHintsFlag as v,parseHostPlatform as y,parseOptionalStringFlag as b,reportUsageError as x,resolveCommonArgs as S,setUpLogging as C}from"../args.js";import{createCliOutput as w,shouldWriteLogGroups as T}from"../log-output/index.js";import{formatProblemCounts as E,reportProblems as D}from"../problems-output.js";import{hasInjectedContentSteps as O,openContentSession as k,recordRunFailure as A,runContentIngestWithStaticDataBuild as j}from"./ingest.js";import M from"node:process";async function N(N,P,F){let I=h(N,{alias:g.alias,boolean:[...g.boolean,`dev-login`],string:[...g.string,`hints`,`target`,`platform`,`path-prefix`]});if(I.help)return l(P.stdout),0;let L,R,z,B;try{let e=S(I);L=C(e,w(P,e)),R=_(I.target),z=y(I.platform),B=b(I[`path-prefix`],`--path-prefix`),f(R,z)}catch(e){return x(e,P)}n(B??M.env.REDOCLY_PREFIX_PATHS??``);let{logger:V,reporter:H}=L,U=u();P.stdout(r([a(L.contentDir),[`Prefix`,t()||void 0]],U)),V.debug(`Process startup took ${M.uptime().toFixed(2)}s`);let W=e(),G;try{G=O(F)?void 0:await k(L);let{ingestResult:e,problems:t,staticDataResult:n,ignoreMarkdocErrors:r}=await j(L,F,{hints:v(I.hints),session:G}),a=D(P,t,{ignoreMarkdocErrors:r,groups:T(P)}),l=await(F.runRuntimeBuild??p)({contentDir:L.contentDir,target:R,platform:z,logger:V,reporter:H,templateSet:e.templateSet,serverModuleSet:e.serverModuleSet,devLogin:I[`dev-login`]===!0}),u=await H.run(`Validating React pages`,()=>m({contentDir:L.contentDir,outputDir:l.outputDir,sourceTemplates:e.templateSet.sourceTemplates,databaseUrl:L.databaseUrl,database:G?.database,context:G?.context,logger:V}),({pageCount:e,renderedCount:t,problems:n})=>{if(e===0)return`No React pages`;if(t===0)return`${c(e,`React page`)} unchanged`;let r=t===e?`Checked ${c(e,`React page`)}`:`Checked ${t} of ${c(e,`React page`)}`;return n.length>0?`${r}, ${n.length} failed to render`:r}),f=D(P,u.problems,{ignoreMarkdocErrors:r,groups:T(P)});return await(F.writeBuildOutputMetadata??d)({contentDir:L.contentDir,outputDir:l.outputDir,databaseUrl:L.databaseUrl,database:G?.database,context:G?.context,logger:V}),P.stdout(``),a+f>0?(P.stdout(o(`Build failed`,W(),`${c(a+f,`content error`)} (see Problems above)`,{colors:U,stacks:L.stacks})),1):(P.stdout(i(`Build complete`,W(),[[`Files`,s(e.diff.summary)],[`Prepared`,c(n.staticDataCount,`content item`)],[`Problems`,E(t,{ignoreMarkdocErrors:r})]],U)),0)}catch(e){P.stdout(o(`Build failed`,W(),e,{colors:U,stacks:L.stacks}));let t=G?.database.close();return G=void 0,await t?.catch(()=>void 0),await A(L,F,e),1}finally{await G?.database.close()}}export{N as runBuild};
@@ -1 +1 @@
1
- import{setGlobalPathPrefix as e}from"../../shared/path-prefix.js";import{printDevHelp as t}from"../output.js";import{formatProjectPluginDiagnostics as n,loadAndRegisterProjectPlugins as r}from"../../content-layer/plugins/project/load.js";import"../../content-layer/plugins/index.js";import{runDev as i}from"../../bundler/dev/run.js";import{parseArgs as a}from"../parse-args.js";import{COMMON_FLAGS as o,parseOptionalStringFlag as s,parsePort as c,reportUsageError as l,resolveCommonArgs as u,setUpLogging as d}from"../args.js";import{resolveDevRealmDir as f}from"../dev-realm-dir.js";import{createDevConsole as p}from"../dev-console/index.js";import{join as m,resolve as h}from"node:path";import g from"node:process";async function _(_,v,y){let b=a(_,{alias:{...o.alias,p:`port`},boolean:o.boolean,string:[...o.string,`host`,`path-prefix`,`log-file`,`plan`]});if(b.help)return t(v.stdout),0;let x,S,C,w,T;try{C=s(b.host,`--host`),w=c(b.port)??4e3,T=s(b[`path-prefix`],`--path-prefix`);let e=s(b[`log-file`],`--log-file`),t=u(b);g.env.REALM_DIR??=f(t.contentDir),S=p(v,{...t,logFile:h(e??m(g.env.REALM_DIR,`logs`,`dev.log`))}),x=d(t,S)}catch(e){return S?.close(),l(e,v)}let{logger:E}=x;e(T??g.env.REDOCLY_PREFIX_PATHS??``),E.debug(`Development data: ${g.env.REALM_DIR}`);let D=await r(x.contentDir,{logger:E});D.diagnostics.length>0&&E.warn(`Some project plugins did not load:\n${n(D.diagnostics)}`);try{return await(y.runRuntimeDev??i)({contentDir:x.contentDir,databaseUrl:x.databaseUrl,host:C,port:w,logger:E,reporter:x.reporter,devReporter:S}),0}catch(e){return E.error(`Dev failed`,{err:e}),1}finally{S?.close()}}export{_ as runDev};
1
+ import{setGlobalPathPrefix as e}from"../../shared/path-prefix.js";import{formatProjectPluginDiagnostics as t,loadAndRegisterProjectPlugins as n}from"../../content-layer/plugins/project/load.js";import"../../content-layer/plugins/index.js";import{printDevHelp as r}from"../output.js";import{runDev as i}from"../../bundler/dev/run.js";import{parseArgs as a}from"../parse-args.js";import{COMMON_FLAGS as o,parseOptionalStringFlag as s,parsePort as c,reportUsageError as l,resolveCommonArgs as u,setUpLogging as d}from"../args.js";import{resolveDevRealmDir as f}from"../dev-realm-dir.js";import{createDevConsole as p}from"../dev-console/index.js";import{join as m,resolve as h}from"node:path";import g from"node:process";async function _(_,v,y){let b=a(_,{alias:{...o.alias,p:`port`},boolean:o.boolean,string:[...o.string,`host`,`path-prefix`,`log-file`,`plan`]});if(b.help)return r(v.stdout),0;let x,S,C,w,T;try{C=s(b.host,`--host`),w=c(b.port)??4e3,T=s(b[`path-prefix`],`--path-prefix`);let e=s(b[`log-file`],`--log-file`),t=u(b);g.env.REALM_DIR??=f(t.contentDir),S=p(v,{...t,logFile:h(e??m(g.env.REALM_DIR,`logs`,`dev.log`))}),x=d(t,S)}catch(e){return S?.close(),l(e,v)}let{logger:E}=x;e(T??g.env.REDOCLY_PREFIX_PATHS??``),E.debug(`Development data: ${g.env.REALM_DIR}`);let D=await n(x.contentDir,{logger:E});D.diagnostics.length>0&&E.warn(`Some project plugins did not load:\n${t(D.diagnostics)}`);try{return await(y.runRuntimeDev??i)({contentDir:x.contentDir,databaseUrl:x.databaseUrl,host:C,port:w,logger:E,reporter:x.reporter,devReporter:S}),0}catch(e){return E.error(`Dev failed`,{err:e}),1}finally{S?.close()}}export{_ as runDev};
@@ -1 +1 @@
1
- import{formatCount as e}from"../../shared/log-format.js";import{describeFileChanges as t,formatCommandHeader as n,formatCompletion as r,formatContentRow as i,formatFailure as a,formatFileChanges as o,pluralize as s,printIngestHelp as c,shouldUseColors as l}from"../output.js";import{createNodePlatform as u}from"../../platform/node/create.js";import{stopwatch as d}from"../../shared/logger.js";import{createContentLayerContext as f}from"../../content-layer/context.js";import{openContentLayerDatabase as p}from"../../content-layer/database/connection.js";import{createContentPlugins as m}from"../../content-layer/plugins/create-content-plugins.js";import{createProjectPluginLoadError as h,loadAndRegisterProjectPlugins as g}from"../../content-layer/plugins/project/load.js";import"../../content-layer/plugins/index.js";import{loadUserMarkdocSchema as _}from"../../bundler/user-markdoc-schema.js";import{listProblems as v,problemRow as y,replaceGlobalProblemsForSourceTx as b}from"../../content-layer/database/problems.js";import{ingestFailedProblem as x}from"../../content-layer/problems/producers.js";import{runContentIngest as S}from"../../content-layer/ingest/run.js";import{runContentEntityBuild as C}from"../../bundler/build/run.js";import{parseArgs as w}from"../parse-args.js";import{COMMON_FLAGS as T,parseHintsFlag as E,reportUsageError as D,resolveCommonArgs as O,setUpLogging as k}from"../args.js";import{createCliOutput as A,shouldWriteLogGroups as j}from"../log-output/index.js";import{formatProblemCounts as M,reportProblems as N}from"../problems-output.js";import{runBuildLinkCheck as P}from"../../content-layer/link-checker/run-build.js";import{resolve as F}from"node:path";async function I(e,t,u){let f=w(e,{alias:T.alias,boolean:T.boolean,string:[...T.string,`hints`]});if(f.help)return c(t.stdout),0;let p;try{let e=O(f);p=k(e,A(t,e))}catch(e){return D(e,t)}let m=E(f.hints),h=l();t.stdout(n(`ingest`,[i(p.contentDir)],h));let g=d();try{let{ingestResult:e,problems:n,staticDataResult:i,ignoreMarkdocErrors:c}=await z(p,u,{hints:m}),l=N(t,n,{ignoreMarkdocErrors:c,groups:j(t)});return t.stdout(``),l>0?(t.stdout(a(`Ingest failed`,g(),`${s(l,`content error`)} (see Problems above)`,{colors:h,stacks:p.stacks})),1):(t.stdout(r(`Ingest complete`,g(),[[`Files`,o(e.diff.summary)],[`Prepared`,s(i.staticDataCount,`content item`)],[`Problems`,M(n,{ignoreMarkdocErrors:c})]],h)),0)}catch(e){return t.stdout(a(`Ingest failed`,g(),e,{colors:h,stacks:p.stacks})),await B(p,u,e),1}}function L(e){return e.runContentIngest!==void 0||e.runContentEntityBuild!==void 0}async function R(e){let t=await g(e.contentDir,{logger:e.logger});if(t.diagnostics.length>0)throw h(t.diagnostics);await _({contentDir:e.contentDir,logger:e.logger,reporter:e.reporter});let n=f({contentDir:e.contentDir,logger:e.logger,plugins:m(e.contentDir)});return{context:n,database:await V(e,n.platform)}}async function z(n,r,i){if(L(r)){let e=await(r.runContentIngest??S)({contentDir:n.contentDir,databaseUrl:n.databaseUrl,logger:n.logger,hints:i?.hints}),t=await(r.runContentEntityBuild??C)({contentDir:n.contentDir,databaseUrl:n.databaseUrl,logger:n.logger});return{ingestResult:e,problems:[...e.problems,...t.problems??[]],staticDataResult:{staticDataCount:t.entityCount},ignoreMarkdocErrors:!1}}let a=i?.session===void 0,{context:o,database:c}=i?.session??await R(n);try{let r=await n.reporter.run(`Ingesting content`,e=>S({contentDir:n.contentDir,context:o,database:c,databaseUrl:n.databaseUrl,logger:n.logger,hints:i?.hints,searchSync:!1,collectProblems:!1,captureRevisions:!0,onProgress:t=>{t.stage===`sync`&&e.progress(t.done,t.total)}}),e=>`Ingested ${s(e.diff.summary.totalCurrent,`file`)} (${t(e.diff.summary)})`);o.state=void 0;let a=await C({contentDir:n.contentDir,context:o,database:c,databaseUrl:n.databaseUrl,logger:n.logger,reporter:n.reporter,inlineSearchables:r.inlineSearchables});return await n.reporter.run(`Checking links`,()=>P({database:c,config:o.config,readSourceFile:async e=>{try{return await o.platform.fs.readFile(F(n.contentDir,e))}catch{return null}},logger:n.logger}),t=>t.ok?t.judged===t.checked?`Checked ${s(t.checked,`link`)} (${e(t.broken)} broken)`:`Re-checked ${e(t.judged)} of ${s(t.checked,`link`)} (${e(t.broken)} broken)`:`Link check failed; stored link problems were left unchanged`),{ingestResult:r,problems:await v(c),staticDataResult:{staticDataCount:a.entityCount},ignoreMarkdocErrors:o.config.platform?.ignoreMarkdocErrors===!0}}finally{a&&await c.close()}}async function B(e,t,n){if(!L(t))try{let t=x(n instanceof Error?n.message:String(n)),r=await V(e,u());try{await r.db.transaction(e=>b(e,`system`,[y(t,{scope:`global`,source:`system`})]))}finally{await r.close()}}catch{}}function V(e,t){return p({contentDir:e.contentDir,databaseUrl:e.databaseUrl,logger:e.logger,platform:t})}export{L as hasInjectedContentSteps,R as openContentSession,B as recordRunFailure,z as runContentIngestWithStaticDataBuild,I as runIngest};
1
+ import{createNodePlatform as e}from"../../platform/node/create.js";import{formatCount as t}from"../../shared/log-format.js";import{stopwatch as n}from"../../shared/logger.js";import{createContentLayerContext as r}from"../../content-layer/context.js";import{openContentLayerDatabase as i}from"../../content-layer/database/connection.js";import{createContentPlugins as a}from"../../content-layer/plugins/create-content-plugins.js";import{createProjectPluginLoadError as o,loadAndRegisterProjectPlugins as s}from"../../content-layer/plugins/project/load.js";import"../../content-layer/plugins/index.js";import{loadUserMarkdocSchema as c}from"../../bundler/user-markdoc-schema.js";import{describeFileChanges as l,formatCommandHeader as u,formatCompletion as d,formatContentRow as f,formatFailure as p,formatFileChanges as m,pluralize as h,printIngestHelp as g,shouldUseColors as _}from"../output.js";import{listProblems as v,problemRow as y,replaceGlobalProblemsForSourceTx as b}from"../../content-layer/database/problems.js";import{ingestFailedProblem as x}from"../../content-layer/problems/producers.js";import{runContentEntityBuild as S}from"../../bundler/build/run.js";import{runContentIngest as C}from"../../content-layer/ingest/run.js";import{parseArgs as w}from"../parse-args.js";import{COMMON_FLAGS as T,parseHintsFlag as E,reportUsageError as D,resolveCommonArgs as O,setUpLogging as k}from"../args.js";import{createCliOutput as A,shouldWriteLogGroups as j}from"../log-output/index.js";import{formatProblemCounts as M,reportProblems as N}from"../problems-output.js";import{runBuildLinkCheck as P}from"../../content-layer/link-checker/run-build.js";import{resolve as F}from"node:path";async function I(e,t,r){let i=w(e,{alias:T.alias,boolean:T.boolean,string:[...T.string,`hints`]});if(i.help)return g(t.stdout),0;let a;try{let e=O(i);a=k(e,A(t,e))}catch(e){return D(e,t)}let o=E(i.hints),s=_();t.stdout(u(`ingest`,[f(a.contentDir)],s));let c=n();try{let{ingestResult:e,problems:n,staticDataResult:i,ignoreMarkdocErrors:l}=await z(a,r,{hints:o}),u=N(t,n,{ignoreMarkdocErrors:l,groups:j(t)});return t.stdout(``),u>0?(t.stdout(p(`Ingest failed`,c(),`${h(u,`content error`)} (see Problems above)`,{colors:s,stacks:a.stacks})),1):(t.stdout(d(`Ingest complete`,c(),[[`Files`,m(e.diff.summary)],[`Prepared`,h(i.staticDataCount,`content item`)],[`Problems`,M(n,{ignoreMarkdocErrors:l})]],s)),0)}catch(e){return t.stdout(p(`Ingest failed`,c(),e,{colors:s,stacks:a.stacks})),await B(a,r,e),1}}function L(e){return e.runContentIngest!==void 0||e.runContentEntityBuild!==void 0}async function R(e){let t=await s(e.contentDir,{logger:e.logger});if(t.diagnostics.length>0)throw o(t.diagnostics);await c({contentDir:e.contentDir,logger:e.logger,reporter:e.reporter});let n=r({contentDir:e.contentDir,logger:e.logger,plugins:a(e.contentDir)});return{context:n,database:await V(e,n.platform)}}async function z(e,n,r){if(L(n)){let t=await(n.runContentIngest??C)({contentDir:e.contentDir,databaseUrl:e.databaseUrl,logger:e.logger,hints:r?.hints}),i=await(n.runContentEntityBuild??S)({contentDir:e.contentDir,databaseUrl:e.databaseUrl,logger:e.logger});return{ingestResult:t,problems:[...t.problems,...i.problems??[]],staticDataResult:{staticDataCount:i.entityCount},ignoreMarkdocErrors:!1}}let i=r?.session===void 0,{context:a,database:o}=r?.session??await R(e);try{let n=await e.reporter.run(`Ingesting content`,t=>C({contentDir:e.contentDir,context:a,database:o,databaseUrl:e.databaseUrl,logger:e.logger,hints:r?.hints,searchSync:!1,collectProblems:!1,captureRevisions:!0,onProgress:e=>{e.stage===`sync`&&t.progress(e.done,e.total)}}),e=>`Ingested ${h(e.diff.summary.totalCurrent,`file`)} (${l(e.diff.summary)})`),i=await S({contentDir:e.contentDir,context:a,database:o,databaseUrl:e.databaseUrl,logger:e.logger,reporter:e.reporter,inlineSearchables:n.inlineSearchables});return await e.reporter.run(`Checking links`,()=>P({database:o,config:a.config,readSourceFile:async t=>{try{return await a.platform.fs.readFile(F(e.contentDir,t))}catch{return null}},logger:e.logger}),e=>e.ok?e.judged===e.checked?`Checked ${h(e.checked,`link`)} (${t(e.broken)} broken)`:`Re-checked ${t(e.judged)} of ${h(e.checked,`link`)} (${t(e.broken)} broken)`:`Link check failed; stored link problems were left unchanged`),{ingestResult:n,problems:await v(o),staticDataResult:{staticDataCount:i.entityCount},ignoreMarkdocErrors:a.config.platform?.ignoreMarkdocErrors===!0}}finally{i&&await o.close()}}async function B(t,n,r){if(!L(n))try{let n=x(r instanceof Error?r.message:String(r)),i=await V(t,e());try{await i.db.transaction(e=>b(e,`system`,[y(n,{scope:`global`,source:`system`})]))}finally{await i.close()}}catch{}}function V(e,t){return i({contentDir:e.contentDir,databaseUrl:e.databaseUrl,logger:e.logger,platform:t})}export{L as hasInjectedContentSteps,R as openContentSession,B as recordRunFailure,z as runContentIngestWithStaticDataBuild,I as runIngest};
@@ -1,2 +1,2 @@
1
- import{DEFAULT_LOCALE_PLACEHOLDER as e,L10N_DIR as t,TRANSLATIONS_FILE_NAMES as n}from"../../shared/constants/l10n/defaults.js";import{compareStrings as r}from"../../shared/utils/compare-strings.js";import{isObject as i}from"../../shared/utils/is-object.js";import{l10nDirOf as a,listL10nDirs as o,normalizeL10nConfig as s}from"../../shared/utils/l10n.js";import{defaultTranslationImports as c}from"../../shared/constants/l10n/default-translations.js";import{ANSI as l,paint as u}from"../../shared/log-format.js";import{formatFailure as d,printTranslateHelp as f,shouldUseColors as p}from"../output.js";import{createNodePlatformFs as m}from"../../platform/node/fs.js";import{stopwatch as h}from"../../shared/logger.js";import{loadRedoclyConfig as g}from"../../content-layer/config.js";import{contentIgnoreMatcherOf as _,scanContentFiles as v}from"../../content-layer/ingest/scan.js";import{SIDEBAR_FILENAME_REGEX as y}from"../../content-layer/plugins/internal/sidebar/index.js";import{CliUsageError as b,parseArgs as x}from"../parse-args.js";import{COMMON_FLAGS as S,reportUsageError as C,resolveCommonArgs as w}from"../args.js";import{join as T,posix as E}from"node:path";import D from"node:process";import O from"js-yaml";import{createInterface as k}from"node:readline/promises";const A=`default`,j=/^[\w-]+$/,M=/^translations\.ya?ml$/i,N=O.FAILSAFE_SCHEMA.extend({implicit:[new O.Type(`tag:yaml.org,2002:null`,{kind:`scalar`,resolve:e=>[`~`,`null`,`Null`,`NULL`].includes(e),construct:()=>null})]});async function P(e,t,n){let r=x(e,{alias:{h:`help`,d:`project-dir`,D:`debug`},boolean:[...S.boolean,`debug`],string:[`project-dir`]});if(r.help)return f(t.stdout),0;let i,a,o=r._.map(String);try{if({contentDir:i,stacks:a}=w(r),o.length===0)throw new b(`Locale is required but was not provided.`);let e=o.find(e=>!j.test(e));if(e!==void 0)throw new b(`Invalid locale "${e}". Use letters, digits, "-" and "_" only.`)}catch(e){return C(e,t)}let s=p(),c=h();try{let e=m(),{config:r}=await g(i,e),a=await F(i,e,r,o),c=await(n.confirm??(e=>W(e,t)))(U(a,s));if(c===void 0)return t.stderr(`The confirmation prompt got no answer. No files changed.`),1;if(!c)return t.stdout(`No files changed.`),0;for(let t of a)await e.writeFile(T(i,t.path),O.dump(t.translations),{recursive:!0});return t.stdout(u(`✓ Translations updated`,l.bold+l.green,s)),0}catch(e){return t.stdout(d(`Translate failed`,c(),e,{colors:s,stacks:a})),1}}async function F(e,i,a,c){let{defaultLocale:l}=s(a.l10n),u=await o(e,i),d=c[0]===`all`?[A,...u]:c,f=await I(e,i,a),p=/* @__PURE__ */ new Map;for(let a of d){let o=a===A||a.toLowerCase()===l.toLowerCase(),s=o?``:E.join(t,u.find(e=>H(e,a))??a),c=await B(e,i,s),d=c??E.join(s,n[0]);if(p.has(d))continue;let m=c?V(await i.readFile(T(e,c)),c):{},h={...await R(o?l:a),...f,...m};p.set(d,{path:d,exists:c!==void 0,translations:Object.fromEntries(Object.entries(h).sort(([e],[t])=>r(e,t)))})}return[...p.values()]}async function I(e,t,n){let r=_(n),i=(await v({fs:t,rootDir:e})).filter(e=>y.test(e.path)&&a(e.path)===void 0&&!r(e.path));return{...L(await Promise.all(i.map(async e=>O.load(await t.readFile(e.absolutePath),{filename:e.path})))),...L(n)}}function L(e){let t={};if(Array.isArray(e)){for(let n of e)Object.assign(t,L(n));return t}if(!i(e))return t;for(let[n,r]of Object.entries(e)){if(!n.endsWith(`TranslationKey`)||typeof r!=`string`){Object.assign(t,L(r));continue}let i=n.slice(0,-14),a=e[i];i.trim()===``||r.trim()===``||a!=null&&typeof a!=`string`||(t[r]=a??``)}return t}async function R(t){let n=t.split(`-`)[0];return{...await c[e](),...await z(n),...H(n,t)?{}:await z(t)}}async function z(e){let t=Object.keys(c).find(t=>H(t,e));return t===void 0?{}:c[t]()}async function B(e,t,n){for(let r of await t.readdir(T(e,n))){if(!M.test(r.name))continue;let i=E.join(n,r.name);if(r.type===`file`||r.type===`symlink`&&(await t.stat(T(e,i)))?.type===`file`)return i}}function V(e,t){let n=O.load(e,{filename:t,schema:N})??{};if(!i(n))throw Error(`${t} must map translation keys to texts. No files changed.`);return n}function H(e,t){return e.toLowerCase()===t.toLowerCase()}function U(e,t){let n=e=>e.map(e=>` - ${u(e.path,l.cyan,t)}`),r=e.filter(e=>!e.exists),i=e.filter(e=>e.exists),a=[`Confirm the following actions:`,``];return r.length>0&&a.push(`Create new files with translations stubs:`,...n(r),``),i.length>0&&a.push(`Update translations files with missing phrases (this doesn't rewrite existing data values):`,...n(i),``),a.push(`Continue? (Y/n) `),a.join(`
2
- `)}async function W(e,t){let n=k({input:t.terminal?.stdin??D.stdin,output:t.terminal?.stdout??D.stdout});n.once(`SIGINT`,()=>n.close());let r=new Promise(e=>n.once(`close`,()=>e(void 0)));try{let t=await Promise.race([n.question(e),r]);if(t===void 0)return;let i=t.trim().toLowerCase();return i===``||i===`y`||i===`yes`}finally{n.close()}}export{P as runTranslate};
1
+ import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{createNodePlatformFs as t}from"../../platform/node/fs.js";import{ANSI as n,paint as r}from"../../shared/log-format.js";import{stopwatch as i}from"../../shared/logger.js";import{DEFAULT_LOCALE_PLACEHOLDER as a,L10N_DIR as o,TRANSLATIONS_FILE_NAMES as s}from"../../shared/constants/l10n/defaults.js";import{isObject as c}from"../../shared/utils/is-object.js";import{l10nDirOf as l,listL10nDirs as u,normalizeL10nConfig as d}from"../../shared/utils/l10n.js";import{loadRedoclyConfig as f}from"../../content-layer/config.js";import{contentIgnoreMatcherOf as p,scanContentFiles as m}from"../../content-layer/ingest/scan.js";import{SIDEBAR_FILENAME_REGEX as h}from"../../content-layer/plugins/internal/sidebar/index.js";import{formatFailure as g,printTranslateHelp as _,shouldUseColors as v}from"../output.js";import{defaultTranslationImports as y}from"../../shared/constants/l10n/default-translations.js";import{CliUsageError as b,parseArgs as x}from"../parse-args.js";import{COMMON_FLAGS as S,reportUsageError as C,resolveCommonArgs as w}from"../args.js";import{join as T,posix as E}from"node:path";import D from"js-yaml";import O from"node:process";import{createInterface as k}from"node:readline/promises";const A=`default`,j=/^[\w-]+$/,M=/^translations\.ya?ml$/i,N=D.FAILSAFE_SCHEMA.extend({implicit:[new D.Type(`tag:yaml.org,2002:null`,{kind:`scalar`,resolve:e=>[`~`,`null`,`Null`,`NULL`].includes(e),construct:()=>null})]});async function P(e,a,o){let s=x(e,{alias:{h:`help`,d:`project-dir`,D:`debug`},boolean:[...S.boolean,`debug`],string:[`project-dir`]});if(s.help)return _(a.stdout),0;let c,l,u=s._.map(String);try{if({contentDir:c,stacks:l}=w(s),u.length===0)throw new b(`Locale is required but was not provided.`);let e=u.find(e=>!j.test(e));if(e!==void 0)throw new b(`Invalid locale "${e}". Use letters, digits, "-" and "_" only.`)}catch(e){return C(e,a)}let d=v(),p=i();try{let e=t(),{config:i}=await f(c,e),s=await F(c,e,i,u),l=await(o.confirm??(e=>W(e,a)))(U(s,d));if(l===void 0)return a.stderr(`The confirmation prompt got no answer. No files changed.`),1;if(!l)return a.stdout(`No files changed.`),0;for(let t of s)await e.writeFile(T(c,t.path),D.dump(t.translations),{recursive:!0});return a.stdout(r(`✓ Translations updated`,n.bold+n.green,d)),0}catch(e){return a.stdout(g(`Translate failed`,p(),e,{colors:d,stacks:l})),1}}async function F(t,n,r,i){let{defaultLocale:a}=d(r.l10n),c=await u(t,n),l=i[0]===`all`?[A,...c]:i,f=await I(t,n,r),p=/* @__PURE__ */ new Map;for(let r of l){let i=r===A||r.toLowerCase()===a.toLowerCase(),l=i?``:E.join(o,c.find(e=>H(e,r))??r),u=await B(t,n,l),d=u??E.join(l,s[0]);if(p.has(d))continue;let m=u?V(await n.readFile(T(t,u)),u):{},h={...await R(i?a:r),...f,...m};p.set(d,{path:d,exists:u!==void 0,translations:Object.fromEntries(Object.entries(h).sort(([t],[n])=>e(t,n)))})}return[...p.values()]}async function I(e,t,n){let r=p(n),i=(await m({fs:t,rootDir:e})).filter(e=>h.test(e.path)&&l(e.path)===void 0&&!r(e.path));return{...L(await Promise.all(i.map(async e=>D.load(await t.readFile(e.absolutePath),{filename:e.path})))),...L(n)}}function L(e){let t={};if(Array.isArray(e)){for(let n of e)Object.assign(t,L(n));return t}if(!c(e))return t;for(let[n,r]of Object.entries(e)){if(!n.endsWith(`TranslationKey`)||typeof r!=`string`){Object.assign(t,L(r));continue}let i=n.slice(0,-14),a=e[i];i.trim()===``||r.trim()===``||a!=null&&typeof a!=`string`||(t[r]=a??``)}return t}async function R(e){let t=e.split(`-`)[0];return{...await y[a](),...await z(t),...H(t,e)?{}:await z(e)}}async function z(e){let t=Object.keys(y).find(t=>H(t,e));return t===void 0?{}:y[t]()}async function B(e,t,n){for(let r of await t.readdir(T(e,n))){if(!M.test(r.name))continue;let i=E.join(n,r.name);if(r.type===`file`||r.type===`symlink`&&(await t.stat(T(e,i)))?.type===`file`)return i}}function V(e,t){let n=D.load(e,{filename:t,schema:N})??{};if(!c(n))throw Error(`${t} must map translation keys to texts. No files changed.`);return n}function H(e,t){return e.toLowerCase()===t.toLowerCase()}function U(e,t){let i=e=>e.map(e=>` - ${r(e.path,n.cyan,t)}`),a=e.filter(e=>!e.exists),o=e.filter(e=>e.exists),s=[`Confirm the following actions:`,``];return a.length>0&&s.push(`Create new files with translations stubs:`,...i(a),``),o.length>0&&s.push(`Update translations files with missing phrases (this doesn't rewrite existing data values):`,...i(o),``),s.push(`Continue? (Y/n) `),s.join(`
2
+ `)}async function W(e,t){let n=k({input:t.terminal?.stdin??O.stdin,output:t.terminal?.stdout??O.stdout});n.once(`SIGINT`,()=>n.close());let r=new Promise(e=>n.once(`close`,()=>e(void 0)));try{let t=await Promise.race([n.question(e),r]);if(t===void 0)return;let i=t.trim().toLowerCase();return i===``||i===`y`||i===`yes`}finally{n.close()}}export{P as runTranslate};
@@ -1 +1 @@
1
- import{formatCommandHeader as e,formatContentRow as t,formatDisplayPath as n,shouldUseColors as r}from"../output.js";import{withMinLevel as i}from"../../shared/logger.js";import{isInteractiveTerminal as a}from"../log-output/index.js";import{createLogFile as o}from"./log-file.js";import{createPlainDevOutput as s}from"./plain.js";import{createTuiDevOutput as c}from"./tui.js";import l from"node:process";function u(u,d){let f=r(),p=o(d.logFile),m=s({stdout:p.write,stacks:!0}),h=u.terminal,g=h&&a(h.stdout)&&h.stdin.isTTY?c({stdout:h.stdout,stdin:h.stdin,colors:f,stacks:d.stacks,expandPhases:d.expandPhases,logFile:n(d.logFile),onQuit:()=>l.kill(l.pid,`SIGINT`)}):s({stdout:u.stdout,colors:f,stacks:d.stacks,time:`clock`}),_=i(g,d.level??`warn`),v=[_,m],y=[t(d.contentDir),[`Log`,n(d.logFile)]];return u.stdout(e(`preview`,y,f)),p.write(e(`preview`,y,!1)),{write(e){_.write(e),e.level!==`debug`&&m.write(e)},phaseStart:e=>v.forEach(t=>t.phaseStart(e)),phaseProgress:(e,t)=>v.forEach(n=>n.phaseProgress(e,t)),phaseEnd:(e,t,n)=>v.forEach(r=>r.phaseEnd(e,t,n)),ready:e=>v.forEach(t=>t.ready(e)),changeStart:()=>v.forEach(e=>e.changeStart()),changeEnd:e=>v.forEach(t=>t.changeEnd(e)),sweep:e=>v.forEach(t=>t.sweep(e)),problems:e=>v.forEach(t=>t.problems(e)),close(){_.close(),p.close()}}}export{u as createDevConsole};
1
+ import{withMinLevel as e}from"../../shared/logger.js";import{formatCommandHeader as t,formatContentRow as n,formatDisplayPath as r,shouldUseColors as i}from"../output.js";import{isInteractiveTerminal as a}from"../log-output/index.js";import{createLogFile as o}from"./log-file.js";import{createPlainDevOutput as s}from"./plain.js";import{createTuiDevOutput as c}from"./tui.js";import l from"node:process";function u(u,d){let f=i(),p=o(d.logFile),m=s({stdout:p.write,stacks:!0}),h=u.terminal,g=h&&a(h.stdout)&&h.stdin.isTTY?c({stdout:h.stdout,stdin:h.stdin,colors:f,stacks:d.stacks,expandPhases:d.expandPhases,logFile:r(d.logFile),onQuit:()=>l.kill(l.pid,`SIGINT`)}):s({stdout:u.stdout,colors:f,stacks:d.stacks,time:`clock`}),_=e(g,d.level??`warn`),v=[_,m],y=[n(d.contentDir),[`Log`,r(d.logFile)]];return u.stdout(t(`preview`,y,f)),p.write(t(`preview`,y,!1)),{write(e){_.write(e),e.level!==`debug`&&m.write(e)},phaseStart:e=>v.forEach(t=>t.phaseStart(e)),phaseProgress:(e,t)=>v.forEach(n=>n.phaseProgress(e,t)),phaseEnd:(e,t,n)=>v.forEach(r=>r.phaseEnd(e,t,n)),ready:e=>v.forEach(t=>t.ready(e)),changeStart:()=>v.forEach(e=>e.changeStart()),changeEnd:e=>v.forEach(t=>t.changeEnd(e)),sweep:e=>v.forEach(t=>t.sweep(e)),problems:e=>v.forEach(t=>t.problems(e)),close(){_.close(),p.close()}}}export{u as createDevConsole};
@@ -1 +1 @@
1
- import{shouldUseColors as e}from"../output.js";import{withMinLevel as t}from"../../shared/logger.js";import{createPlainOutput as n}from"./plain.js";import{createTtyOutput as r}from"./tty.js";function i(i,s){let c=e(),l=o(i)?r({stdout:i.terminal.stdout,colors:c,stacks:s.stacks,expandPhases:s.expandPhases}):n({stdout:i.stdout,colors:c,stacks:s.stacks,groups:a(i)});return t(l,s.level??`info`)}function a(e,t=process.env){return!o(e)&&t.REDOCLY_REUNITE_BUILD===`1`}function o(e){return e.terminal!==void 0&&s(e.terminal.stdout)}function s(e,t=process.env){let n=t.CI?.toLowerCase(),r=n!==void 0&&n!==``&&n!==`0`&&n!==`false`;return e.isTTY===!0&&t.TERM!==`dumb`&&!r}export{i as createCliOutput,s as isInteractiveTerminal,a as shouldWriteLogGroups};
1
+ import{withMinLevel as e}from"../../shared/logger.js";import{shouldUseColors as t}from"../output.js";import{createPlainOutput as n}from"./plain.js";import{createTtyOutput as r}from"./tty.js";function i(i,s){let c=t(),l=o(i)?r({stdout:i.terminal.stdout,colors:c,stacks:s.stacks,expandPhases:s.expandPhases}):n({stdout:i.stdout,colors:c,stacks:s.stacks,groups:a(i)});return e(l,s.level??`info`)}function a(e,t=process.env){return!o(e)&&t.REDOCLY_REUNITE_BUILD===`1`}function o(e){return e.terminal!==void 0&&s(e.terminal.stdout)}function s(e,t=process.env){let n=t.CI?.toLowerCase(),r=n!==void 0&&n!==``&&n!==`0`&&n!==`false`;return e.isTTY===!0&&t.TERM!==`dumb`&&!r}export{i as createCliOutput,s as isInteractiveTerminal,a as shouldWriteLogGroups};