@redocly/redoc 0.130.1 → 0.131.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +1 -1
- package/dist/cli/develop.js +1 -1
- package/dist/cli/prepare/copy-env-files.js +1 -1
- package/dist/cli/prepare/index.js +1 -1
- package/dist/cli/telemetry/index.js +1 -1
- package/dist/client/App.js +1 -1
- package/dist/client/ErrorBoundary.js +1 -1
- package/dist/client/app/Sidebar/helpers/filter-out-versioned-items.js +1 -1
- package/dist/client/app/hooks/useRouteChangeTracker.js +1 -1
- package/dist/client/app/search/useAiSearch.js +1 -1
- package/dist/client/browser-entry.js +5 -5
- package/dist/client/providers/hooks.js +1 -1
- package/dist/client/runtime/loader.js +1 -1
- package/dist/config/env-config.d.ts +17 -0
- package/dist/config/env-config.js +1 -0
- package/dist/config/env-schema.d.ts +242 -0
- package/dist/config/env-schema.js +3 -0
- package/dist/config/env-schemas/api-urls.d.ts +24 -0
- package/dist/config/env-schemas/api-urls.js +1 -0
- package/dist/config/env-schemas/auth.d.ts +42 -0
- package/dist/config/env-schemas/auth.js +1 -0
- package/dist/config/env-schemas/catalog.d.ts +12 -0
- package/dist/config/env-schemas/catalog.js +1 -0
- package/dist/config/env-schemas/database.d.ts +15 -0
- package/dist/config/env-schemas/database.js +1 -0
- package/dist/config/env-schemas/environment-detection.d.ts +24 -0
- package/dist/config/env-schemas/environment-detection.js +1 -0
- package/dist/config/env-schemas/feature-flags.d.ts +24 -0
- package/dist/config/env-schemas/feature-flags.js +1 -0
- package/dist/config/env-schemas/organization-project.d.ts +27 -0
- package/dist/config/env-schemas/organization-project.js +1 -0
- package/dist/config/env-schemas/scorecards.d.ts +12 -0
- package/dist/config/env-schemas/scorecards.js +1 -0
- package/dist/config/env-schemas/search.d.ts +21 -0
- package/dist/config/env-schemas/search.js +1 -0
- package/dist/config/env-schemas/server-config.d.ts +51 -0
- package/dist/config/env-schemas/server-config.js +1 -0
- package/dist/config/env-schemas/site.d.ts +12 -0
- package/dist/config/env-schemas/site.js +1 -0
- package/dist/config/env-schemas/ssr.d.ts +18 -0
- package/dist/config/env-schemas/ssr.js +1 -0
- package/dist/config/env-schemas/telemetry.d.ts +15 -0
- package/dist/config/env-schemas/telemetry.js +1 -0
- package/dist/config/env-schemas/test.d.ts +22 -0
- package/dist/config/env-schemas/test.js +1 -0
- package/dist/constants/common.d.ts +1 -1
- package/dist/constants/common.js +1 -1
- package/dist/server/api-routes/import-api-routes-handlers.js +1 -1
- package/dist/server/api-routes/run-api-routes-worker.js +1 -1
- package/dist/server/constants/common.js +1 -1
- package/dist/server/entitlements/entitlements-provider.js +1 -1
- package/dist/server/esbuild/esbuild-logger.js +2 -2
- package/dist/server/esbuild/esbuild.js +2 -2
- package/dist/server/esbuild/plugins/assets-resolver.js +1 -1
- package/dist/server/esbuild/plugins/esbuild-compile-resolver.js +1 -1
- package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
- package/dist/server/fs/last-modified-tracker.js +1 -1
- package/dist/server/fs/utils/is-loader-cache-enabled.js +1 -1
- package/dist/server/node-bundle-entry.js +1 -1
- package/dist/server/plugins/analytics/adobe/index.js +1 -1
- package/dist/server/plugins/analytics/amplitude/index.js +1 -1
- package/dist/server/plugins/analytics/fullstory/index.js +1 -1
- package/dist/server/plugins/analytics/ga/index.js +1 -1
- package/dist/server/plugins/analytics/gtm/browser-hooks.js +1 -1
- package/dist/server/plugins/analytics/gtm/index.js +1 -1
- package/dist/server/plugins/analytics/heap/index.js +1 -1
- package/dist/server/plugins/analytics/rudderstack/index.js +1 -1
- package/dist/server/plugins/analytics/segment/index.js +1 -1
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.d.ts +4 -52
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.d.ts +1 -0
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-read-model.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/{create-entity-relation.d.ts → create-entity-relation-read-model.d.ts} +2 -2
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation-read-model.js +1 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.js +3 -3
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +5 -31
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/remote/catalog-entities-remote-repository.d.ts +3 -4
- package/dist/server/plugins/catalog-entities/database/repositories/remote/catalog-entities-remote-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.d.ts +2 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/plugin.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/read-model-schemas.d.ts +25 -164
- package/dist/server/plugins/catalog-entities/schemas/read-model-schemas.js +0 -1
- package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
- package/dist/server/plugins/default-theme/index.js +1 -1
- package/dist/server/plugins/entitlements/index.js +1 -1
- package/dist/server/plugins/lifecycle.js +2 -2
- package/dist/server/plugins/markdown/markdoc/import-user-tags.js +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/render-mermaid.js +1 -1
- package/dist/server/plugins/mcp/auth/auth-handlers.js +1 -1
- package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
- package/dist/server/plugins/nav-utils.js +1 -1
- package/dist/server/plugins/openapi-docs/index.js +1 -1
- package/dist/server/plugins/scorecard-classic/index.js +1 -1
- package/dist/server/plugins/scorecards/plugin.js +1 -1
- package/dist/server/plugins/scorecards/workers/run-scorecards-worker.js +1 -1
- package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.js +1 -1
- package/dist/server/plugins/search/documents/search-documents.js +1 -1
- package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
- package/dist/server/plugins/search/engines/typesense/index.js +1 -1
- package/dist/server/plugins/search/index.js +1 -1
- package/dist/server/plugins/search/llmstxt/index.js +5 -5
- package/dist/server/plugins/search/utils.js +1 -1
- package/dist/server/plugins/sidebars/index.js +2 -2
- package/dist/server/plugins/sso/index.js +1 -1
- package/dist/server/providers/database/base-repository.js +1 -1
- package/dist/server/providers/database/database-connection-factory.js +1 -1
- package/dist/server/providers/database/database-preconnect-service.js +1 -1
- package/dist/server/providers/database/databases/sqld-sqlite/drizzle.config.js +1 -1
- package/dist/server/ssr/render.js +1 -1
- package/dist/server/ssr/server-side-props/get-server-props-from-user-handler.js +1 -1
- package/dist/server/ssr/utils.js +8 -8
- package/dist/server/store.d.ts +4 -4
- package/dist/server/store.js +1 -1
- package/dist/server/telemetry/index.js +1 -1
- package/dist/server/tools/notifiers/formatter.js +3 -3
- package/dist/server/tools/notifiers/helpers/colors.js +1 -1
- package/dist/server/tools/notifiers/logger.js +2 -2
- package/dist/server/tools/notifiers/reporter.js +6 -6
- package/dist/server/tools/notifiers/terminal-manager.js +4 -4
- package/dist/server/utils/envs/load-env-variables.js +1 -1
- package/dist/server/utils/is-catalog-entities-enabled.js +1 -1
- package/dist/server/utils/is-scorecards-enabled.js +1 -1
- package/dist/server/utils/lifecycle-hooks.js +1 -1
- package/dist/server/utils/report-all-errors.js +1 -1
- package/dist/server/utils/set-execution-mode.d.ts +5 -0
- package/dist/server/utils/set-execution-mode.js +1 -0
- package/dist/server/version.js +1 -1
- package/dist/server/web-server/handle-api-route-request.js +1 -1
- package/dist/server/web-server/http.js +2 -2
- package/dist/server/web-server/middleware/apiKeyMiddleware.js +1 -1
- package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
- package/dist/server/web-server/middleware/corsMiddleware.js +1 -1
- package/dist/server/web-server/middleware/dynamic-middleware/dynamic-middleware.js +1 -1
- package/dist/server/web-server/middleware/idleTimeoutMiddleware.js +1 -1
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/catalog/catalog-relations.js +1 -1
- package/dist/server/web-server/routes/catalog/catalog.js +1 -1
- package/dist/server/web-server/routes/catalog/dto/read-entity-dto.d.ts +3 -0
- package/dist/server/web-server/routes/catalog/dto/read-entity-dto.js +0 -0
- package/dist/server/web-server/routes/catalog/helpers/create-entity-relation-update-schema.d.ts +43 -0
- package/dist/server/web-server/routes/catalog/helpers/create-entity-relation-update-schema.js +1 -0
- package/dist/server/web-server/routes/catalog/helpers/create-entity-schema.d.ts +6823 -0
- package/dist/server/web-server/routes/catalog/helpers/create-entity-schema.js +1 -0
- package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.d.ts +1102 -0
- package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.js +1 -0
- package/dist/server/web-server/routes/catalog/mappers/map-entity-read-model-schema-to-entity-read-dto.d.ts +4 -0
- package/dist/server/web-server/routes/catalog/mappers/map-entity-read-model-schema-to-entity-read-dto.js +1 -0
- package/dist/server/web-server/routes/catalog/parsers/entities/parse-entities.d.ts +4 -0
- package/dist/server/web-server/routes/catalog/parsers/entities/parse-entities.js +1 -0
- package/dist/server/web-server/routes/catalog/parsers/entities/parse-entity-update-data.d.ts +4 -0
- package/dist/server/web-server/routes/catalog/parsers/entities/parse-entity-update-data.js +1 -0
- package/dist/server/web-server/routes/catalog/parsers/entities/parse-entity.d.ts +4 -0
- package/dist/server/web-server/routes/catalog/parsers/entities/parse-entity.js +1 -0
- package/dist/server/web-server/routes/catalog/parsers/relations/parse-entities-relations.d.ts +13 -0
- package/dist/server/web-server/routes/catalog/parsers/relations/parse-entities-relations.js +1 -0
- package/dist/server/web-server/routes/catalog/parsers/relations/parse-entity-relation-update-data.d.ts +13 -0
- package/dist/server/web-server/routes/catalog/parsers/relations/parse-entity-relation-update-data.js +1 -0
- package/dist/server/web-server/routes/catalog/parsers/relations/parse-entity-relation.d.ts +13 -0
- package/dist/server/web-server/routes/catalog/parsers/relations/parse-entity-relation.js +1 -0
- package/dist/server/web-server/routes/dynamic-route.js +1 -1
- package/dist/server/web-server/routes/error.js +1 -1
- package/dist/server/web-server/routes/index.js +1 -1
- package/dist/server/web-server/routes/info.js +1 -1
- package/dist/server/web-server/routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/routes/otel/otel.js +1 -1
- package/dist/server/web-server/routes/page-data.js +1 -1
- package/dist/server/web-server/routes/path-prefix-redirect.js +1 -1
- package/dist/server/workers/worker-pool.js +1 -1
- package/package.json +11 -10
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation.js +0 -1
- package/dist/server/plugins/catalog-entities/entities/validate-entity.d.ts +0 -8
- package/dist/server/plugins/catalog-entities/entities/validate-entity.js +0 -1
- package/dist/server/utils/envs/is-build-mode.d.ts +0 -2
- package/dist/server/utils/envs/is-build-mode.js +0 -1
- package/dist/server/utils/envs/is-develop-mode.d.ts +0 -7
- package/dist/server/utils/envs/is-develop-mode.js +0 -1
- package/dist/server/utils/envs/is-production-mode.d.ts +0 -10
- package/dist/server/utils/envs/is-production-mode.js +0 -1
- package/dist/utils/env/is-local-development.d.ts +0 -13
- package/dist/utils/env/is-local-development.js +0 -1
- package/dist/utils/env/is-production.d.ts +0 -13
- package/dist/utils/env/is-production.js +0 -1
- package/dist/utils/env/is-web-view.d.ts +0 -14
- package/dist/utils/env/is-web-view.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as T,REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{existsSync as
|
|
1
|
+
import{REDOCLY_ROUTE_RBAC as T,REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{existsSync as M}from"fs";import{rm as O}from"node:fs/promises";import{DEFAULT_LOCALE_PLACEHOLDER as $}from"../../../../constants/common.js";import{SEARCH_DATA_EXPORT_FOLDER as S}from"../../../constants/plugins/search.js";import{envConfig as A}from"../../../../config/env-config.js";import{logger as n}from"../../../tools/notifiers/logger.js";import{extractTeamsFromScopeItems as y,getRbacTeamsListForResource as P}from"../../../utils/index.js";import{getSearchDocumentGroup as B}from"../utils.js";import{telemetry as I}from"../../../../cli/telemetry/index.js";import{telemetryTraceStep as R}from"../../../../cli/telemetry/helpers/trace-step.js";async function J(_,t,l){await R("build.plugin.search.prepare_search_documents",async()=>{n.info("Preparing search documents and create indexes..."),A.isBuildMode&&M(`${t.outdir}/${S}`)&&await O(`${t.outdir}/${S}`,{recursive:!0});const b=n.startTiming(),v=t.getConfig().rbac,F=[$,..._.localeFolders.map(a=>a.toLowerCase())];for(const a of F)await R("build.plugin.search.prepare_search_documents.locale",async c=>{const C=t.getAllRoutesForLocale(a);let g=0,D=0;for(const r of C){if(g++,r.excludeFromSearch)continue;const d=new Map,{product:m}=r,L=await r.getStaticData?.(r,{...t,contentDir:t.contentDir,parseMarkdoc:(s,e,u)=>t.parseMarkdoc(s,e,u)})||{},i=await r.getSearchDocuments?.(r,{...L,[p]:r[p],[T]:r[T]},t),o=r.versions?.find(s=>s.active),w=P(r,v??{});if(i){if(i&&i.length){D+=i.length;for(const s in i){let e=i[s];const u=y(e?.[p]),h=u?.length?u:w,x=e.tags||[];e={...e,...o&&{version:o.version,isDefaultVersion:o.default,versionFolderId:o.folderId},...m&&{product:m},rbacTeams:h,tags:[...x,...h,...o?o.default?["v:default"]:[`v:${o.folderId}:${o.version}`]:["v:default"],...m?[`p:${m.name}`]:[]],url:e.url&&(e.path&&e.path.length>1?e.url:e.url.split("#")[0])};const f=B(e.facets);if(f){const E=d.get(f)??[];d.set(f,[...E,e])}}}for(const[s,e]of d)await l.addDocuments(e,{locale:a,group:s,outDir:t.outdir})}}c?.setAttribute("locale",a),c?.setAttribute("totalDocuments",g),c?.setAttribute("totalSearchDocuments",D)});if(l.cleanupFacetValues(t),n.infoTime(b,"Search indexes created"),A.isBuildMode){n.info("Writing out search data...");const a=n.startTiming();await l.export(t.outdir);const c=n.infoTime(a,"Search data written");c&&I.sendTimingPerformedMessage(c)}})}export{J as prepareSearchDocuments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as R,readdir as y,appendFile as E}from"node:fs/promises";import m from"node:path";import{existsSync as w}from"node:fs";import{SEARCH_GROUP_FACET_FIELD as F,SEARCH_PRODUCT_FIELD as C,SEARCH_VERSION_FIELD as $}from"../../../../../constants/common.js";import{SEARCH_INDEX_FIELDS as A,SEARCH_DATA_EXPORT_FOLDER as _,SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT as O}from"../../../../constants/plugins/search.js";import{telemetryTraceStep as v}from"../../../../telemetry/helpers/trace-step.js";import{
|
|
1
|
+
import{readFile as R,readdir as y,appendFile as E}from"node:fs/promises";import m from"node:path";import{existsSync as w}from"node:fs";import{SEARCH_GROUP_FACET_FIELD as F,SEARCH_PRODUCT_FIELD as C,SEARCH_VERSION_FIELD as $}from"../../../../../constants/common.js";import{SEARCH_INDEX_FIELDS as A,SEARCH_DATA_EXPORT_FOLDER as _,SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT as O}from"../../../../constants/plugins/search.js";import{telemetryTraceStep as v}from"../../../../telemetry/helpers/trace-step.js";import{envConfig as N}from"../../../../../config/env-config.js";import{ensureDir as h}from"../../../../utils/index.js";import{FlexSearchIndex as j}from"./search-index.js";class J{#e=new Map;#s;#t=0;async initIndexSchema(t){this.#s={document:{id:"id",tag:"tags",index:A},worker:!1,tokenize:"forward",context:{depth:2,resolution:9}}}#o(t,o){const e=this.#e.get(t);if(e)return e.find(n=>n.id===o)}#n(t,o){let e=this.#o(t,o);return e||(e=new j(o,this.#s),this.#e.set(t,[...this.#e.get(t)??[],e])),e}async addDocuments(t,o){if(t.length){const{group:e,locale:n,outDir:c}=o,i=this.#n(n,e);for(const a of t)i.add(a),N.isBuildMode&&(this.#t++,this.#t>=O&&await this.exportDocuments(c))}}getIndexesSize(){return this.#e.size}async search(t,o){return await v("search",async e=>{const{query:n,locale:c,filter:i,loadMore:a,auth:f}=t,l=this.#e.get(c)??[];let r=[],d="",x=["v:default"];if(e?.setAttribute("locale",c),i)for(const s of i)s.field===F?r=[...r,...s.values]:s.field===C?d=`p:${s.values[0]}`:s.field===$&&s.values.length&&s.values.length===2&&(x=[...x,`v:${s.values[0]}:${s.values[1]}`]);const g={auth:f,query:n,offset:0,SEARCH_GROUP_FACET_FIELD:F,product:d,versions:x},p=[];let u={facets:{},documents:{}};if(a){const s=this.#o(c,a.groupKey);s&&p.push(s.search({...g,offset:a.offset}))}else for(const s of l)r&&r.length?r.includes(s.id)&&p.push(s.search(g)):p.push(s.search(g));const I=await Promise.all(p);for(const s of I){u.documents={...u.documents,...s.documents};for(const[D,S]of Object.entries(s.facets))u.facets[D]?u.facets[D]=[...u.facets[D],...S]:u.facets[D]=S}return u})}async exportDocuments(t){const o='{"documents":[',e=h(m.join(t,_));for(const[n,c]of this.#e){const i=h(m.join(e,n));for(const a of c){const f=Array.from(a.documents);if(f.length===0)continue;const l=h(m.join(i,`${a.id}.json`)),r=!w(l),d=JSON.stringify(f).substring(1).slice(0,-1),x=r?o+d:","+d;await E(l,x,{encoding:"utf8"}),a.clearDocuments()}}this.#t=0}async exportIndexes(t){const o=h(m.join(t,_));for(const[e,n]of this.#e){const c=h(m.join(o,e));for(const i of n){const a=h(m.join(c,`${i.id}.json`)),f={};await i.export((r,d)=>{f[r]=d});const l=`],"index":${JSON.stringify(f)}}`;await E(a,l,{encoding:"utf8"})}}this.#e.clear()}async import(t){const o=`${t}/${_}`,e=await y(o);for(const n of e){const c=await y(`${o}/${n}`);for(const i of c){const a=`${o}/${n}/${i}`,f=JSON.parse(await R(a,"utf-8")),l=m.parse(i).name;await this.#n(n,l).import(f)}}}countFacets(t,o){const e={};for(const[n,c]of o)e[n]=c.values.map(i=>({value:i,count:0,isCounterVisible:!1}));return e}cleanupFacetValues(t){}}export{J as FlexSearch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{appendFile as A}from"node:fs/promises";import{existsSync as
|
|
1
|
+
import{appendFile as A}from"node:fs/promises";import{existsSync as v}from"node:fs";import m from"node:path";import{Client as R}from"typesense";import{SEARCH_GROUP_FACET_FIELD as D,SEARCH_PRODUCT_FIELD as b,SEARCH_RBAC_FIELD as g,SEARCH_VERSION_FIELD as h}from"../../../../../constants/common.js";import{BASE_SEARCH_DOCUMENT as $,DEFAULT_ORGANIZATION_ID as O,DEFAULT_PROJECT_ID as P,DEFAULT_TYPESENSE_API_KEY as N,DEFAULT_TYPESENSE_API_URL as L,DISABLE_DEEP_LINK_IF_FIELDS_EXIST as C,HIGHLIGHTED_TEXT_MAX_LENGTH as I,SEARCH_DATA_EXPORT_FOLDER as F,SEARCH_DOCUMENT_METADATA_KEY as M,SEARCH_GROUP_LIMIT as w,SEARCH_MAX_FACET_VALUES as S,SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT as k}from"../../../../constants/plugins/search.js";import{telemetryTraceStep as T}from"../../../../telemetry/helpers/trace-step.js";import{envConfig as u}from"../../../../../config/env-config.js";import{logger as j}from"../../../../tools/notifiers/logger.js";import{ensureDir as d}from"../../../../utils/index.js";class Q{#e=null;#r="";#t=[{name:"title",type:"string",facet:!1,optional:!0},{name:"text",type:"string",facet:!1,optional:!0},{name:"path",type:"string[]",facet:!1,optional:!0},{name:"isAdditionalOperation",type:"bool",facet:!1,optional:!0},{name:"parameters",type:"object[]",facet:!1,optional:!0},{name:b,type:"string",facet:!0,optional:!0},{name:h,type:"object",facet:!0,optional:!0},{name:g,type:"string[]",facet:!0},{name:"metadata_curated",type:"auto",facet:!1,optional:!0},{name:"metadata_keywords_excludes",type:"auto",facet:!1,optional:!0},{name:"metadata_keywords_includes",type:"auto",facet:!1,optional:!0}];#s=new Map;#o={ORGANIZATION_ID:u.ORGANIZATION_ID||(u.isDevelopMode?O:""),PROJECT_ID:u.PROJECT_ID||(u.isDevelopMode?P:""),TYPESENSE_API_URL:u.TYPESENSE_API_URL||(u.isDevelopMode?L:""),TYPESENSE_API_KEY:u.TYPESENSE_API_KEY||(u.isDevelopMode?N:"")};constructor(){if(!u.isBuildMode){for(const[e,t]of Object.entries(this.#o))if(!t)throw new Error(`Cannot initialize search index. ${e} is not set`);this.#r=`${this.#o.ORGANIZATION_ID}_${this.#o.PROJECT_ID}_`,this.#e=new R({nodes:[{url:this.#o.TYPESENSE_API_URL}],apiKey:this.#o.TYPESENSE_API_KEY,connectionTimeoutSeconds:5})}}async initIndexSchema(e){this.#d(e),u.isDevelopMode&&await this.#m()}async addDocuments(e,t){e.push($);const{locale:i,outDir:r}=t,o=e.map(n=>{const s={...n},a=n[M];return a&&(a.curated&&(s.metadata_curated=a.curated),a.excludes&&(s.metadata_keywords_excludes=a.excludes),a.includes&&(s.metadata_keywords_includes=a.includes)),s});if(u.isDevelopMode){if(o.length){await this.#p(i);try{const n=o.map(s=>({url:s.url,title:s.title,text:s.text,path:s.path,httpMethod:s.httpMethod,isAdditionalOperation:s.isAdditionalOperation,httpPath:s.httpPath,parameters:s.parameters,[b]:s.product?s.product.name:"",[g]:s.rbacTeams??[],[h]:s.version?{isDefault:s.isDefaultVersion,version:s.version,folderId:s.versionFolderId}:{isDefault:!0},...s.facets}));await this.#e?.collections(i).documents().import(n)}catch(n){if(n.importResults)for(const s of n.importResults)s.success===!1&&j.error(`Error adding document to collection: ${i}: ${s.error}`)}}}else{const n=this.#s.get(i)??[];this.#s.set(i,n.concat(o)),n.length+e.length>=k&&await this.exportDocuments(r)}}async search(e){return await T("search",async t=>{const{query:i,locale:r,filter:o,loadMore:n,auth:s}=e,a=u.isDevelopMode?r:this.#c(r),l={collection:a,q:i||"*",query_by:this.#l(),max_facet_values:S};if(t?.setAttribute("collectionName",a),t?.setAttribute("locale",r),this.#e)if(n){const{groupKey:c,offset:f}=n,p={offset:f,filter_by:this.#i(s,o),facet_by:"*"};return t?.setAttribute("isLoadMore",!0),t?.setAttribute("filter",p.filter_by),this.#u(await this.#e.collections(a).documents().search({...l,...p}),c)}else{const c={group_by:this.#_(),group_limit:w,filter_by:this.#i(s,o)};t?.setAttribute("groups",c.group_by),t?.setAttribute("filter",c.filter_by);const f=[c,...this.#E(s,o)];return this.#f(await this.#e?.multiSearch.perform({searches:f},l),o)}else return{facets:{},documents:{}}})}#u(e,t){const i={facets:{},documents:{[t]:[]}};if(e.hits&&e.hits.length)for(const r of e.hits)i.documents[t].push({document:this.#a(r),highlight:this.#n(r)});return i}#f(e,t){const i={facets:{},documents:{}};for(const r of this.#y(t))i.documents[r]=[];if("results"in e)for(const r of e.results){if(r.facet_counts&&r.facet_counts.length)for(const o of r.facet_counts)i.facets[o.field_name]=o.counts.map(n=>({value:n.value,count:n.count}));if(r.grouped_hits&&r.grouped_hits.length)for(const o of r.grouped_hits){const n=o.group_key[0],s=[];for(const a of o.hits)s.push({document:this.#a(a),highlight:this.#n(a)});i.documents[n]=s}}return i}#a(e){return this.#h(e)}#n(e){const t={},i=[];for(const[r,o]of Object.entries(e.highlight??{}))if(Array.isArray(o)){if(r==="path"){const n=o,s=[];for(const a of n)s.push(a.snippet);t.path=s}else if(r==="parameters"){const n=o;for(const s of n){let a=!1;for(const[l,c]of Object.entries(s))if(l!=="deepLink")if(Array.isArray(c))for(const f of c)f.matched_tokens?.length&&(a=!0);else c.matched_tokens?.length&&(a=!0);if(a){const l={name:s.name?.snippet||"",description:s.description?.snippet||"",place:s.place?.snippet||"",path:s.path?.map(c=>c?.snippet)||[]};t.parameters=[l];break}}}}else t[r]=o.snippet,i.push(r);for(const[r,o]of Object.entries(e.document))!i.includes(r)&&typeof o=="string"&&(t[r]=o.length>I?`${o.substring(0,I)}...`:o);return t.parameters||(t.parameters=[]),t}#h(e){let t;const i=Object.keys(e.highlight);for(const o of C)if(i.some(n=>n===o))return e.document;const r=e.highlight.parameters;if(r){for(const o of r)for(const[n,s]of Object.entries(o))if(n!=="deepLink"){if(Array.isArray(s)){for(const a of s)if(a.matched_tokens?.length){t=o.deepLink.snippet;break}}else if(s.matched_tokens?.length){t=o.deepLink.snippet;break}}}if(t){const o=t.split("#")[1];return{...e.document,url:`${e.document.url}#${o}`}}return e.document}async exportDocuments(e){const t='{"documents":[',i=d(m.join(e,F));for(const[r,o]of this.#s){if(o.length===0)continue;const n=d(m.join(i,`${r}.json`)),s=!v(n),a=JSON.stringify(o).substring(1).slice(0,-1),l=s?t+a:","+a;await A(n,l,{encoding:"utf8"}),this.#s.set(r,[])}}async exportIndexes(e){const t=d(m.join(e,F));for(const i of this.#s.keys()){const r=d(m.join(t,`${i}.json`)),o=`],"schemaFields":${JSON.stringify(this.#t)}}`;await A(r,o,{encoding:"utf8"})}}async import(e){}async countFacets(e,t){return await T("search.facets",async i=>{const{locale:r,query:o,facetQuery:n,filter:s,field:a,auth:l}=e,c=u.isDevelopMode?r:this.#c(r),f={q:o||"*",query_by:this.#l(),facet_by:"*",facet_query:this.#g(n,a),filter_by:this.#i(l,s,a),max_facet_values:S};if(i?.setAttribute("collectionName",c),i?.setAttribute("query",f.q),i?.setAttribute("facetQuery",f.facet_query),i?.setAttribute("filter",f.filter_by),this.#e){const p={},_=await this.#e.collections(c).documents().search(f);if(_.facet_counts&&_.facet_counts.length)for(const y of _.facet_counts)p[y.field_name]=y.counts.map(E=>({value:E.value,count:E.count,isCounterVisible:!!o||(s?.length||0)>0}));return p}else return{}})}#c(e){return`${this.#r}${e}`}async#p(e){const t=await this.#e?.collections().retrieve();t&&t.length&&t.find(i=>i.name===e)||await this.#e?.collections().create({name:e,fields:this.#t,enable_nested_fields:!0})}async#m(){const e=await this.#e?.collections().retrieve();for(const t of e??[])await this.#e?.collections(t.name).delete()}#d(e){for(const[t]of e)this.#t.find(i=>i.name===t)||this.#t.push({name:t,type:"string",facet:!0,optional:!0})}#l(){return this.#t.filter(e=>!e.facet&&!e.name.startsWith("metadata_")&&e.name!=="isAdditionalOperation").map(e=>e.name).join(",")}#_(){return this.#t.filter(e=>e.facet&&e.name===D).map(e=>e.name).join(",")}#i(e,t,i){const r=`${g}:[${e.teams.map(n=>`'${n}'`).join(", ")}]`;let o=`${h}.isDefault:true`;if(t&&t.length){const n=t.filter(a=>a.field!==i&&a.field!==h).map(a=>{const l=a.values.map(c=>`'${c}'`);return l.length?`${a.field}:[${l.join(", ")}]`:""}).join(" && "),s=t.find(a=>a.field===h);if(s&&s.values.length&&s.values.length===2){const a=s.values[0],l=s.values[1],c=`(${h}.folderId:! ${a} && ${h}.isDefault:true)`,f=`(${h}.folderId:${a} && ${h}.version:${l})`;o=`(${c} || ${f})`}return n?`${r} && ${n} && ${o}`:`${r} && ${o}`}else return`${r} && ${o}`}#g(e,t){return e&&t?`${t}:${e}`:""}#y(e){const t=[];if(e&&e.length)for(const i of e)i.field===D&&t.push(...i.values);return t}#E(e,t){const i=[],r=this.#t.filter(o=>o.facet);for(const o of r){const n={facet_by:o.name,filter_by:this.#i(e,t,o.name)};i.push(n)}return i}cleanupFacetValues(e){const t=e.getSearchFacets();t.forEach(i=>{i.values=[]}),e.setSearchFacets(t)}}export{Q as Typesense};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{DEFAULT_SEARCH_ENGINE as c}from"../../constants/plugins/search.js";import{envConfig as o}from"../../../config/env-config.js";import{logger as g}from"../../tools/notifiers/logger.js";import{reporter as E}from"../../tools/notifiers/reporter.js";import{prepareSearchDocuments as d}from"./documents/search-documents.js";import{SearchEngine as S}from"./engines/search-engine.js";import{prepareAiSearchDocuments as u}from"./ai-indexer/prepare-ai-search-documents.js";import{isAiSearchEnabled as b}from"./utils.js";import{telemetryTraceStep as D}from"../../../cli/telemetry/helpers/trace-step.js";async function v(){let e=!0;return{async afterRoutesCreated(a,i){(o.SEARCH_DEV_REINIT||e)&&await y(a,i),e=!1},id:"search"}}async function y(e,a){await D("build.plugin.search",async i=>{const r=e.getConfig();if(i?.setAttribute("config",JSON.stringify(r.search||{})),r.search?.hide){g.info("Search is disabled in the config, skipping");return}const s=r.search?.engine||c,f=o.isDevelopMode?o.SEARCH_DEV_DEBUG?s:c:s,{l10n:m}=e.getGlobalData(),h=b(r),n=r.rbac?.features?.aiSearch;let t;try{t=new S(f,m)}catch(l){await E.panic(l);return}await t.initIndexSchema(e.getSearchFacets()),e.setSearchEngine(t),e.setGlobalData({searchFeatures:{advanced:{enabled:f!==c&&!r.search?.filters?.hide},ai:{enabled:h,[p]:n&&Object.keys(n).length?n:void 0}}}),await d(a.fs,e,t),await u(e,a,{aiSearchEnabled:h,llmstxtEnabled:r.seo?.llmstxt?.hide!==!0})})}export{v as searchPlugin};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import a from"picomatch";import{dirname as $,resolve as x}from"node:path";import{access as P,readFile as E,constants as F}from"fs/promises";import{removeTrailingSlash as w}from"../../../../utils/url/remove-trailing-slash.js";import{logger as
|
|
1
|
+
import a from"picomatch";import{dirname as $,resolve as x}from"node:path";import{access as P,readFile as E,constants as F}from"fs/promises";import{removeTrailingSlash as w}from"../../../../utils/url/remove-trailing-slash.js";import{logger as g}from"../../../tools/notifiers/logger.js";import{withPathPrefix as I}from"@redocly/theme/core/utils";import{envConfig as y}from"../../../../config/env-config.js";const l="llms.txt",u="Table of contents";async function M(t,e,n={title:l,description:void 0},o){if(!e)return{title:n.title||l,description:n.description,details:void 0,sections:[{title:u,description:void 0,llmstxts:t}]};const s=e.title||n.title||l,r=e.description||n.description,i=await v(e,o),c=e.sections?.map(d=>{const{title:f,description:h,excludeFiles:m,includeFiles:L}=d,T=p(t,{excludeFiles:m,includeFiles:L});return{title:f,description:h,llmstxts:T}});return{title:s,description:r,details:i,sections:c||[{title:u,description:void 0,llmstxts:p(t,{includeFiles:["**/*"],excludeFiles:[]})}]}}async function v(t,e){const n=await e.getConfig();if(t?.details?.path&&n.configPath)try{const o=e.fs.getFileInfo(n.configPath);if(!o)throw new Error(`Config file ${n.configPath} not found`);const s=x(e.fs.cwd,$(o.relativePath),t.details.path);return await P(s,F.R_OK),E(s,"utf-8")}catch{throw new Error(`${t.details.path} is not accessible`)}if(t?.details?.content)return t.details.content}function p(t,e){const{excludeFiles:n,includeFiles:o}=e,s=n?.map(i=>a(i)),r=o?.map(i=>a(i));return t.filter(i=>s?.some(d=>d(i.fsPath))?!1:r?.some(d=>d(i.fsPath)))}async function j(t,e,n={title:l,description:void 0},o){const s=await M(t,e,n,o),r=[`# ${s.title}
|
|
2
2
|
|
|
3
3
|
`];return s.description&&r.push(`> ${s.description}
|
|
4
4
|
|
|
5
5
|
`),s.details&&r.push(`${s.details}
|
|
6
6
|
|
|
7
|
-
`),s.sections.forEach(i=>{if(!i.llmstxts.length){
|
|
7
|
+
`),s.sections.forEach(i=>{if(!i.llmstxts.length){g.warn(`llms.txt: No links found for section "${i.title}". Please check the includeFiles/excludeFiles patterns.`);return}r.push(`## ${i.title}
|
|
8
8
|
`),i.description?r.push(`${i.description.replace(/\n+$/,"")}
|
|
9
9
|
|
|
10
10
|
`):r.push(`
|
|
11
|
-
`),i.llmstxts.forEach(c=>{r.push(` - ${
|
|
12
|
-
`)}),r.join("")}function
|
|
13
|
-
`}function
|
|
11
|
+
`),i.llmstxts.forEach(c=>{r.push(` - ${_({title:c.title,description:c.description,slug:D(c.slug)})}`)}),r.push(`
|
|
12
|
+
`)}),r.join("")}function _({title:t,description:e,slug:n}){return`[${t}](${w(y.REDOCLY_PUBLIC_URL||"")}${encodeURI(I(n))})${e?`: ${e}`:""}
|
|
13
|
+
`}function B(t){if(t?.details?.path&&t?.details?.content)throw new Error('"details.path" and "details.content" are mutually exclusive. Please use only one of them.')}function D(t){return`${t}${t==="/"?"index.html.md":".md"}`}export{j as generateLLMsTxt,D as getLLMsTxtMdSlug,_ as llmsTxtLink,B as validateLLMsTxtConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SEARCH_GROUP_FACET_FIELD as
|
|
1
|
+
import{SEARCH_GROUP_FACET_FIELD as o}from"../../../constants/common.js";import{DEFAULT_AI_SEARCH_ENABLED as n}from"../../constants/plugins/search.js";import{isPrimitive as f}from"../../../utils/guards/is-primitive.js";import{envConfig as t}from"../../../config/env-config.js";import{EntitlementsProvider as s}from"../../entitlements/entitlements-provider.js";function A(r){if(t.isDevelopMode)return t.SEARCH_DEV_DEBUG==="true";if(!s.instance().canAccessFeature("aiSearchLimit"))return!1;const i=r.aiAssistant;return typeof i?.hide=="boolean"?!i?.hide:n}function S(r){let e;return r&&Object.keys(r).forEach(i=>{i===o&&(e=r[i])}),e}function h(r){return Object.entries(r||{}).map(([e,i])=>` - ${e}: ${f(i)?i:JSON.stringify(i)}`).join(`
|
|
2
2
|
`)}export{h as formatDocumentMetadata,S as getSearchDocumentGroup,A as isAiSearchEnabled};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{writeFileSync as tt}from"node:fs";import*as u from"path";import et from"@markdoc/markdoc";import{withoutHash as ot}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as
|
|
1
|
+
import{writeFileSync as tt}from"node:fs";import*as u from"path";import et from"@markdoc/markdoc";import{withoutHash as ot}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as v,SIDEBAR_PREFIX as at,CONFIG_FILE_NAME as V}from"../../../constants/common.js";import{CATALOG_OUTPUT_FILE_NAME as rt}from"../../constants/common.js";import{findDeepFirst as M}from"../../../utils/tree/find-deep-first.js";import{isDefined as X}from"../../../utils/guards/is-defined.js";import{partition as it}from"../../../utils/array/partition.js";import{collectPropValueDeep as N}from"../../../utils/tree/collect-prop-value-deep.js";import{envConfig as nt}from"../../../config/env-config.js";import{isLocalLink as st}from"../../../utils/path/is-local-link.js";import{normalizeRouteSlug as Y}from"../../../utils/path/normalize-route-slug.js";import{slash as lt}from"../../../utils/path/slash.js";import{parsePathVersions as ct}from"../../../utils/path/parse-path-versions.js";import{reporter as A}from"../../tools/notifiers/reporter.js";import{logger as x}from"../../tools/notifiers/logger.js";import{sha1 as ft}from"../../utils/crypto/sha1.js";import{collectItemsLinkedToSidebars as dt,resolveItems as Z}from"../nav-utils.js";import{getInnerText as ut}from"../markdown/markdoc/helpers/get-inner-text.js";import{getExcludedFromLinkCheckerPatterns as mt,getSidebarReferences as gt,hasCircularDependency as pt}from"./utils.js";import{getLocaleFromRelativePath as ht}from"../../fs/utils/get-locale-from-relative-path.js";import{isSystemRouteSlug as St}from"../../utils/system-routes.js";import{ENTITIES_MAP_GLOBAL_DATA_KEY as yt}from"../../constants/plugins/catalog-entities.js";import{telemetryTraceStep as bt}from"../../../cli/telemetry/helpers/trace-step.js";const Ft=180,It=170,Ct=10;async function Jt({contentDir:l}){return{id:"sidebars",async afterRoutesCreated(o,i){await bt("build.plugin.sidebars",async()=>{const{cache:d,fs:c}=i,I=o.getConfig(),C=new Map,D=new Set,B=[v,...c.localeFolders],j=o.getGlobalData()[yt]||{},G=new Map;let L=c.scan(/sidebars.yaml$/).map(({relativePath:t})=>t).filter(t=>!wt(I.ignore??[],t)&&t);const $=await gt(i,l,L),q=it(L.filter(t=>!$.has(t)),t=>ct(t)?.versionFolderPath||t),_=mt(I),Q=await dt(I?.navbar,o,i,{navFile:V,excludedFromLinkCheckerPatterns:_});let P;const T=pt($);T&&Array.isArray(T)&&await A.panicOnBuildContentError(`Sidebar references have circular dependency. Please check your sidebar files.
|
|
2
2
|
Circular dependency chain: ${T.reverse().join(" -> ")}
|
|
3
|
-
`);for(const t of q){const m=(await Promise.all(t.map(async n=>{const e=(await d.load(n,"yaml")).data;if(!Array.isArray(e)){await A.panicOnBuildContentErrorForRealFile('Invalid sidebar contents at %rp, items should be an array, got "%s"',n,c,n,typeof e);return}return{items:e,sidebarRelativePath:n,locale:ht(n)}}))).filter(X),r=(await k(m))?.firstLink;
|
|
3
|
+
`);for(const t of q){const m=(await Promise.all(t.map(async n=>{const e=(await d.load(n,"yaml")).data;if(!Array.isArray(e)){await A.panicOnBuildContentErrorForRealFile('Invalid sidebar contents at %rp, items should be an array, got "%s"',n,c,n,typeof e);return}return{items:e,sidebarRelativePath:n,locale:ht(n)}}))).filter(X),r=(await k(m))?.firstLink;P||(P=r)}const z=Object.entries(I?.catalogClassic??{});for(const t of B){for(const[e,s]of z)await W(e,s,t);const m={},r=new Set,n=o.getAllRoutesForLocale(t);for(const e of n)if(U(e)&&e.fsPath&&!r.has(e.fsPath)){r.add(e.fsPath);let f=u.posix.dirname(e.fsPath);const h=u.parse(f).root;do m[f]=(m[f]||0)+1,f=u.dirname(f);while(f&&f!="."&&h!=f)}for(const e of n){if(C.has(e.slug))continue;const s=U(e),f=u.dirname(e.fsPath),h=m[f]===1,g=vt(e.baseSlug||e.slug);s&&h?await k([{items:[{directory:f}],sidebarRelativePath:"sidebar.yaml_"+g,locale:t}]):e.getSidebar!==void 0&&await k([{items:[{page:e.fsPath}],sidebarRelativePath:"sidebar.yaml_"+g,locale:t}])}for(const[e,s]of z)await W(e,s,t,!0)}if(L.length===0)for(const t of B){x.verbose("Creating default sidebar");const m=t===v,r=`sidebars.yaml${m?"":"_"+t}`,n=m?"":`${c.localizationFolder}/${t}`,e=(await k([{items:[{directory:`./${n}`}],sidebarRelativePath:r,locale:t,ignoredRoutes:D}]))?.firstLink;P||(P=e)}if(!o.getRouteBySlug("/")&&!o.getConfig().redirects?.["/"]){const m=o.getAllRoutes().find(n=>!St(n.slug)),r=P?P.link:m?.baseSlug??null;if(r){const n=ot(r);o.addRedirect("/",{to:n,type:302}),x.info("Creating default redirect for index page => %s",n)}}const H=nt.REDOCLY_METADATA_OUTPUT_FOLDER;H&&(x.info("Writing catalog data..."),tt(u.join(H,rt),JSON.stringify(Object.fromEntries(G.entries()))));function U(t){return D.has(t.slug)||j[t.fsPath]}async function k(t){if(t.length===0)return;const r=(await Promise.all(t.map(async({items:g,locale:F,sidebarRelativePath:p,ignoredRoutes:R})=>{const a=await Z(g,u.dirname(u.join(l,p)),o,i,{locale:F,ignoredRoutes:R,navFile:p,excludedFromLinkCheckerPatterns:_});if(!a){await A.panicOnBuild("Failed to resolve sidebar configuration. Make sure %rp is valid",p);return}return a}))).flat().filter(X),n=N(r,"routeSlug"),e=t[0].sidebarRelativePath,s=J(e),f=new Set;for(const g of n){const F=o.getRouteBySlug(g)?.fsPath??"",p=j[F];p&&(Array.from(f).find(a=>a.key===p.key&&a.version===p.version)||f.add(p)),o.addRouteSharedData(g,"sidebar",s),C.set(Y(g),r)}const h=f.size===1?Array.from(f)[0]:void 0;return await o.createSharedData(s,{relatedNavbarItem:Q?.get(e),items:r,catalogEntity:h?{key:h.key,version:h.version}:void 0}),{firstLink:M(r,g=>!!g.link),resolved:r}}async function W(t,m,r,n=!1){const e=structuredClone(m);r&&r!==v&&e.items.forEach(a=>{a.directory=u.posix.join(c.localizationFolder||"",r,a.directory||"")});let s=await Z(e.items,l,o,i,{groupCustomSidebars:!0,locale:r,navFile:V,excludedFromLinkCheckerPatterns:_});if(s&&(s=Pt(s)),!s){await A.panicOnBuild(`Failed to resolve catalog configuration. Make sure catalog ${t} has valid config`);return}const f=r===v?"":"/"+r.toLowerCase(),h=r===v?"":`-${r}`,g=Y(u.posix.join(f,e.slug));if(n)for(const a of s){const S=M(a.items||[],b=>!!b.routeSlug);if(!S?.routeSlug)continue;const y=C.get(S.routeSlug);if(!y)continue;const O=N(y,"routeSlug"),E="current-catalog-info-"+a.routeSlug+h,w={catalog:{label:e.title,titleTranslationKey:e.titleTranslationKey,link:g,icon:e?.icon},item:{label:a.metadata?.title,link:a.link,icon:a.icon}};await o.createSharedData(E,w);for(const b of O)o.addRouteSharedData(b,"current-catalog-info",E),D.add(b);const K=M(y,b=>!!b.link&&!b.external&&st(b.link)&&(!a.version||b.version===a.version));K&&(a.sidebar=[{...K,items:void 0}])}const F={},p=new Set;for(const a of s){if(!(a.routeSlug||a.sidebar?.[0]?.routeSlug)||!a.fsPath||p.has(a.fsPath))continue;p.add(a.fsPath);const y=u.dirname(a.fsPath);F[y]=(F[y]||0)+1}if(n){const a=await o.createSharedData("catalog-"+t+h,s.flatMap(S=>{const y=u.dirname(S.fsPath??""),O=F[y]===1,E=w=>({...w,fsPath:O?y:w.fsPath??""});return S.type==="group"&&S.items?.every(w=>w.type==="group")?(S.items||[]).map(E):E(S)}));o.addRouteSharedData(g,"catalog",a),Dt(r,s,G,F)}const R=N(s,"routeSlug");for(const a of R)D.add(a)}})}}}function Dt(l,o,i,d){if(l===v)for(const c of o){const I=c.routeSlug||c.sidebar?.[0]?.routeSlug;if(!I||!c.fsPath)continue;const C=u.dirname(c.fsPath),D=d[C]===1;i.set(I,{rootFileFsPath:c.fsPath,fsPath:D?C:c.fsPath,metadata:c.metadata||{},title:c.metadata?.title||c.label||"Untitled",version:c.version||"latest"})}}function Pt(l){const o=i=>{if(!i)return i;const d=et.parse(i);return ut([d])};return l.map(i=>{const d={...i};return d.metadata?.description&&(d.metadata={...d.metadata,description:o(d.metadata.description)}),d})}function J(l){return at+lt(l)}async function qt(l,o,i){const d=u.posix.join(u.dirname(l),o);return await i.exists(d)?J(d):(await A.panicOnBuildContentErrorForRealFile("File %rp: Failed to create relative path for sidebars.yaml using %s",l,i,l,o),null)}function wt(l,o){const i=/\/?([a-zA-Z0-9-_]+\/)*sidebars?(-[a-zA-Z0-9-_]+)?\.yaml/;return l.filter(c=>i.test(c)).includes(o)}function vt(l){const o=l.replaceAll("/","_");if(o.length>Ft){const i=o.slice(0,It),d=ft(l).slice(0,Ct).replaceAll("/","_");return i+d}else return o}export{wt as isSidebarIgnored,Pt as removeMarkdownTags,qt as resolveSidebarId,Jt as sidebarsPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_SSO_IDP_TITLE as
|
|
1
|
+
import{DEFAULT_SSO_IDP_TITLE as f}from"../../../constants/common.js";import{envConfig as c}from"../../../config/env-config.js";import{telemetryTraceStep as u}from"../../../cli/telemetry/helpers/trace-step.js";const g="https://auth.cloud.redocly.com/oidc/.well-known/openid-configuration",y="https://auth.cloud.redocly.com/api/sso/oidc/introspect";async function m(C){return{id:"sso",async processContent(e){await u("build.plugin.sso",async a=>{const o=e.getConfig();if(a?.setAttribute("config",`{"ssoDirect": ${JSON.stringify(o.ssoDirect||{})}}, {"sso": ${JSON.stringify(o.sso||{})}}`),o.ssoDirect&&typeof o.ssoDirect=="object"&&Object.keys(o.ssoDirect).length!==0||o.sso&&Array.isArray(o.sso)&&!o.sso.length)return;const l=!!(o.rbac&&typeof o.rbac=="object"&&Object.keys(o.rbac).length!==0),p=o.requiresLogin;if(!l&&!p)return;let i=g,n=c.REDOCLY_OAUTH_USE_INTROSPECT?y:"";const s=o.residency;if(s){const r=s.endsWith("/")?s.slice(0,-1):s;i=`${r.replace("app.","auth.")}/oidc/.well-known/openid-configuration`,n=c.REDOCLY_OAUTH_USE_INTROSPECT?`${r}/api/sso/oidc/introspect`:""}let t="AUTO";o.sso&&(Array.isArray(o.sso)?t=o.sso.join(","):t=o.sso);const d={oidc:{title:f,type:"OIDC",configurationUrl:i,clientId:"{{ process.env.OAUTH_CLIENT_ID }}",clientSecret:"{{ process.env.OAUTH_CLIENT_SECRET }}",teamsClaimName:"https://redocly.com/sso/teams",scopes:["openid"],authorizationRequestCustomParams:{login_hint:"{{ process.env.ORGANIZATION_ID }}",login_type:t,prompt:"login"},audience:"{{ process.env.ORGANIZATION_ID }}",introspectEndpoint:n}};e.setGlobalConfig({ssoDirect:d})})},async afterRoutesCreated(e){}}}export{m as ssoPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{envConfig as i}from"../../../config/env-config.js";import{SQLD_REMOTE_DATABASE_URL_NO_DEPLOYMENT_YET_VAR as r}from"../../constants/plugins/catalog-entities.js";class n{static#t="ORGANIZATION_ID";static#e="PROJECT_ID";organizationId;projectId;databaseClient;path;constructor(e){const t=this.isNonRemoteDatabaseMode();this.organizationId=this.#i(t),this.projectId=this.#n(t),this.databaseClient=e.client,this.path=e.path}async close(){await this.databaseClient.close()}async sync(){await this.databaseClient.sync()}#i=e=>{const t=i.ORGANIZATION_ID;if(t)return t;if(e)return n.#t;throw new Error("ORGANIZATION_ID environment variable is required. Ensure it is set in your environment configuration.")};#n=e=>{const t=i.PROJECT_ID;if(t)return t;if(e)return n.#e;throw new Error("PROJECT_ID environment variable is required. Ensure it is set in your environment configuration.")};isNonRemoteDatabaseMode=()=>i.SQLD_REMOTE_DATABASE_URL===r||!i.SQLD_REMOTE_DATABASE_AUTH_TOKEN}export{n as BaseRepository};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as
|
|
1
|
+
import{logger as i}from"../../tools/notifiers/logger.js";import{envConfig as e}from"../../../config/env-config.js";import{CATALOG_LOCAL_DATABASE_FOLDER as A,CATALOG_LOCAL_DATABASE_MIGRATIONS_FOLDER as s,CATALOG_LOCAL_DATABASE_NAME as _,MAIN_LOCAL_DATABASE_FOLDER as l,MAIN_LOCAL_DATABASE_MIGRATIONS_FOLDER as c,MAIN_LOCAL_DATABASE_NAME as E,SQLD_REMOTE_DATABASE_FOLDER as D,SQLD_REMOTE_DATABASE_MIGRATIONS_FOLDER as T,SQLD_REMOTE_DATABASE_NAME as L}from"./constants.js";import{LocalDatabaseInitializationStrategy as o,RemoteDatabaseInitializationStrategy as d}from"./database-initialization-strategy.js";import{DatabaseConnectionsManager as m}from"./database-connections-manager.js";import{SQLD_REMOTE_DATABASE_URL_NO_DEPLOYMENT_YET_VAR as O}from"../../constants/plugins/catalog-entities.js";class N{static async create(a,t){switch(a){case"main-local":return await this.#a(t);case"catalog-local":return await this.#t(t);case"sqld-remote":return await this.#e(t);default:return null}}static async#a(a){return await new o().initialize({...a,databaseName:E,additionalFolder:l,migrationsFolder:c})}static async#t(a){return await new o().initialize({...a,databaseName:_,additionalFolder:A,migrationsFolder:s})}static async#e(a){try{const t=e.SQLD_REMOTE_DATABASE_URL||a.sqldRemoteDatabaseUrl,n=t===O?void 0:t,r=e.SQLD_REMOTE_DATABASE_AUTH_TOKEN||a.sqldRemoteDatabaseAuthToken;return(!n||!r)&&!e.isDevelopMode?(i.warn("Your remote database is not initialized yet, please wait for production deployment."),null):await m.getConnection({config:{...a,databaseName:L,additionalFolder:D,migrationsFolder:T,syncUrl:n,authToken:e.SQLD_REMOTE_DATABASE_AUTH_TOKEN||a.sqldRemoteDatabaseAuthToken},strategy:new d})}catch(t){return i.error("Remote database connection initialization failed",t),null}}}export{N as DatabaseConnectionFactory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as
|
|
1
|
+
import{logger as o}from"../../tools/notifiers/logger.js";import{envConfig as n}from"../../../config/env-config.js";import{DatabaseConnectionFactory as i}from"./database-connection-factory.js";class t{static#t=!1;static async init(e){if(!(n.REDOCLY_INTERNAL_DEV==="true"||n.CI==="true")&&!t.#t)try{await t.#e(e)==="PRECONNECTED"&&(t.#t=!0)}catch(r){o.error("Failed to preconnect to sqld remote database",r)}}static#e=async e=>await i.create("sqld-remote",{baseDbDir:e})?(o.info("Sqld remote database preconnected"),"PRECONNECTED"):(o.warn("Sqld remote database preconnect failed"),"NOT_PRECONNECTED")}export{t as DatabasePreconnectService};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DatabasePathGenerator as
|
|
1
|
+
import{DatabasePathGenerator as s}from"../../database-path-generator.js";import{SQLD_REMOTE_DATABASE_FOLDER as t,SQLD_REMOTE_DATABASE_NAME as A}from"../../constants.js";import{SCHEMAS_PATH as o}from"../catalog-sqlite/drizzle.config.js";import{envConfig as r}from"../../../../../config/env-config.js";const E="./dist/server/esbuild/cache/server",_="./src/server/providers/database/databases/sqld-sqlite/schemas/*",i="./src/server/providers/database/databases/sqld-sqlite/migrations",d=()=>{const e=r.SQLD_REMOTE_DATABASE_URL,a=r.SQLD_REMOTE_DATABASE_AUTH_TOKEN;return e&&a?{url:e,authToken:a}:{url:s.generateDatabasePath({baseDir:E,databaseName:A,additionalFolder:t})}};var c={schema:[_,o],out:i,dialect:"turso",dbCredentials:d()};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pathToFileURL as
|
|
1
|
+
import{pathToFileURL as I}from"url";import{HelmetProvider as z}from"@dr.pogodin/react-helmet";import{renderToString as m}from"react-dom/server";import{StaticRouterProvider as G,createStaticHandler as J,createStaticRouter as K}from"react-router-dom/server.js";import r from"react";import{readFile as Q}from"fs/promises";import{join as V}from"path";import{withPathPrefix as l,getLocaleFromPathname as W,withoutPathPrefix as X,removeTrailingSlash as Y}from"@redocly/theme/core/utils";import{RUNTIME_RESOURCES_DIR as T}from"../constants/common.js";import{slash as Z}from"../../utils/path/slash.js";import{reporter as tt}from"../tools/notifiers/reporter.js";import{envConfig as p}from"../../config/env-config.js";import{slug as et}from"../utils/slugger.js";import{htmlTemplate as rt}from"./template.js";import{detectColorSchemaScript as ot,generatePreloadPageData as st}from"./utils.js";import"./hijack-console.js";import{getSitemapLinkTag as nt}from"./get-sitemap-link-tag.js";let g="";async function at(t){return p.isRuntimeMode?await import("../../client/server-entry.js"):await import(I(`${Z(t)}/server-entry.js`)+"?"+new Date)}async function vt(t){if(!p.isRuntimeMode){const e=tt.getCompilationProblems();if(e.length>0){const{renderCompilationError:n}=await import("./render-compilation-error.js");return n(e)}}const{Loader:u,App:R,routes:E,ServerStyleSheet:w,StyleSheetManager:C,ErrorDetails:y,initL10n:P}=await at(t.serverOutDir),{page:h,store:{globalData:S,hasSitemap:D},sharedData:v,ssrHref:b}=t,f=S?.l10n,i=W(X(h.slug),f?.defaultLocale,f?.locales),d=t.page.request?.url||"http://localhost/";await u.prepare({...h,slug:Y(new URL(d).pathname)},v,S,i),await P(i);const c=new w,{query:M,dataRoutes:x}=J([{Component:R,path:l("*"),children:E}]),s=await M(new Request(d));if(s instanceof Response)throw s;const B=K(x,s);try{globalThis.SSR_HOSTNAME=b,globalThis.SSR_USER_AGENT=t.userAgent,globalThis.SSR_OMIT_SUSPENSE=t.omitSuspense;const e={},n=m(r.createElement(z,{context:e},r.createElement(C,{sheet:c.instance},r.createElement(G,{router:B,context:s})))),L=D?nt():"",a=e.helmet,k=a?.title.toString()||"",_=t.store.globalData?.logo?.favicon,o=t.store.config,j=`<link rel="preload" as="fetch" crossorigin="anonymous" href="${l("/app-data.json")}" />`,H=st(t.page.slug),U=ot(o),A=t.page.product?.name?`product-${et(t.page.product.name)}`:"",$=t.store.ssr.headTags.join(""),F=t.store.ssr.postBodyTags.join(""),N=t.store.ssr.preBodyTags.join(""),O=`<link rel="stylesheet" href="${l(T)}/browser-entry.css" />`;!p.isDevelopMode&&!g&&(g=`<style>${await Q(V(t.outdir,T,"browser-entry.css"),"utf-8")}</style>`);const q={bodyHtml:n,linkTags:o.linkTags+c.getStyleTags()+(a?.link.toString()||""),title:k,favicon:_,headScriptTags:L+U+o.headScriptTags+$+(a?.script.toString()||"")+(a?.meta.toString()||""),preload:[j,H],postBodyScriptTags:o.postBodyScriptTags+F,preBodyScriptTags:o.preBodyScriptTags||""+N,lang:i,productClass:A,runtimeCss:g||O};return{html:rt(q),statusCode:200}}catch(e){return t.telemetry.sendSsrErrorCaughtMessage({message:e.message}),{html:m(r.createElement(y,{error:e})),statusCode:500,error:e}}finally{c.seal(),u.clear()}}function bt(t){return m(r.createElement(r.Fragment,null,...t))}export{vt as render,bt as renderComponents};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as
|
|
1
|
+
import{logger as m}from"../../tools/notifiers/logger.js";import{reporter as f}from"../../tools/notifiers/reporter.js";import{enhanceContext as l}from"../../api-routes/helpers/enhance-context.js";import{KvService as u}from"../../persistence/kv/services/kv-service.js";import{envConfig as n}from"../../../config/env-config.js";import{enhanceRequest as P}from"../../api-routes/helpers/enhance-request.js";async function _({route:r,ctx:t,staticData:p,serverPropsGetters:a,serverPropsUser:i,actions:s}){try{if(!a[r.fsPath]||!t)return;const e=a[r.fsPath];e||await f.panicOnBuild(`Invalid page props getter id: "${r.fsPath}" for route "${r.slug}"`);const o=async()=>u.getInstance({baseDbDir:s.serverOutDir,sqldRemoteDatabaseUrl:n.SQLD_REMOTE_DATABASE_URL,sqldRemoteDatabaseAuthToken:n.SQLD_REMOTE_DATABASE_AUTH_TOKEN}),g=l({honoCtx:t,ctx:{user:i,config:s.getConfig()},getKv:o}),c=await P(t);return await(await e()).default(p,c,g)}catch(e){const o=r.fsPath.replace(/\.(page\.tsx?|md)$/,".props.ts");return m.error(`Page prop getter error: ${e.message}`),{pagePropGetterError:{message:`${e.message||"An unknown error occurred"} in ${o}`,name:"ServerPropsGetterError",stack:e.stack}}}}export{_ as getServerPropsFromUserHandler};
|
package/dist/server/ssr/utils.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{pathToFileURL as d}from"url";import{removeTrailingSlash as u}from"../../utils/url/remove-trailing-slash.js";import{slash as p}from"../../utils/path/slash.js";import{getClientPageDataUrl as f}from"../../utils/url/get-client-page-data-url.js";import{DEFAULT_COLOR_MODES as
|
|
1
|
+
import{pathToFileURL as d}from"url";import{removeTrailingSlash as u}from"../../utils/url/remove-trailing-slash.js";import{slash as p}from"../../utils/path/slash.js";import{getClientPageDataUrl as f}from"../../utils/url/get-client-page-data-url.js";import{DEFAULT_COLOR_MODES as m}from"@redocly/theme/core/constants";import{envConfig as h}from"../../config/env-config.js";function C(t){const o=t?.colorMode,{modes:e=[m.LIGHT,m.DARK],hide:r,ignoreDetection:n}=o||{},a=e&&`'${e[0]}'`,s=e?.[0],l=e?.some(c=>c===s)?`'${s}'`:void 0;return r||!a?"":`
|
|
2
2
|
<script>
|
|
3
3
|
if(window&&document.documentElement)
|
|
4
4
|
{
|
|
5
5
|
const q=new URLSearchParams(window.location.search).get("colorSchema");
|
|
6
6
|
const e=q || window.localStorage.getItem("colorSchema");
|
|
7
7
|
if(e) {
|
|
8
|
-
const modeToSet = [${e.map(
|
|
9
|
-
${
|
|
8
|
+
const modeToSet = [${e.map(c=>`'${c}'`)}].some((mode) => mode === e) ? e : 'light';
|
|
9
|
+
${i("modeToSet",e)}
|
|
10
10
|
} else {
|
|
11
11
|
if (window.matchMedia) {
|
|
12
|
-
${
|
|
12
|
+
${g(n,l,a,e)}
|
|
13
13
|
} else {
|
|
14
|
-
${
|
|
14
|
+
${i(a,e)}
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
</script>`}function
|
|
18
|
+
</script>`}function g(t,o,e,r=["light","dark"]){return t?o?i(o,r):e?i(e,r):"return":$(o,r)}function i(t=`'${m.LIGHT}'`,o=["light","dark"]){return`(function() {
|
|
19
19
|
var root = document.documentElement;
|
|
20
20
|
var modes = [${o.map(r=>`'${r}'`).join(", ")}];
|
|
21
21
|
var value = ${t};
|
|
@@ -23,7 +23,7 @@ import{pathToFileURL as d}from"url";import{removeTrailingSlash as u}from"../../u
|
|
|
23
23
|
root.classList.remove(className);
|
|
24
24
|
});
|
|
25
25
|
root.classList.add(value);
|
|
26
|
-
})();`}function
|
|
26
|
+
})();`}function $(t,o=["light","dark"]){const e=o.map(n=>`'${n}'`).join(", "),r=t?`root.classList.add(${t});`:"";return`(function() {
|
|
27
27
|
var root = document.documentElement;
|
|
28
28
|
var modes = [${e}];
|
|
29
29
|
modes.forEach(function(className) {
|
|
@@ -36,4 +36,4 @@ import{pathToFileURL as d}from"url";import{removeTrailingSlash as u}from"../../u
|
|
|
36
36
|
}${r?` else {
|
|
37
37
|
${r}
|
|
38
38
|
}`:""}
|
|
39
|
-
})();`}async function
|
|
39
|
+
})();`}async function E(t){try{return h.isRuntimeMode?await import("@portal/server-props"):await import(d(`${p(t)}/server-props-entry.js`)+"?"+new Date)}catch{return{}}}function T(t){const o=t.split("/").map(encodeURIComponent).join("/"),e=o==="/"?o:u(o);return`<link rel="preload" as="fetch" crossorigin="anonymous" href="${f(e)}" />`}const k=(t,o)=>{if(!o)return{params:[],queries:{}};const e=t.slug||"",n=o.req.path.split(e.endsWith("/")?e:`${e}/`)[1]||"",a=o.req.query(),s=n.replace("data.json","");return!s||s==="/"?{params:[],queries:a}:{params:s.split("/").filter(Boolean),queries:a}};export{C as detectColorSchemaScript,T as generatePreloadPageData,k as getPathParams,E as importServerProps};
|
package/dist/server/store.d.ts
CHANGED
|
@@ -106,15 +106,15 @@ export declare class Store {
|
|
|
106
106
|
baseUrl?: string | undefined;
|
|
107
107
|
} | undefined;
|
|
108
108
|
} | undefined;
|
|
109
|
-
tags?: any;
|
|
110
|
-
nodes?: any;
|
|
111
|
-
variables?: Record<string, any> | undefined;
|
|
112
|
-
functions?: Record<string, import("@markdoc/markdoc").ConfigFunction> | undefined;
|
|
113
109
|
validation?: {
|
|
114
110
|
parents?: Node[];
|
|
115
111
|
validateFunctions?: boolean;
|
|
116
112
|
environment?: string;
|
|
117
113
|
};
|
|
114
|
+
tags?: any;
|
|
115
|
+
nodes?: any;
|
|
116
|
+
variables?: Record<string, any> | undefined;
|
|
117
|
+
functions?: Record<string, import("@markdoc/markdoc").ConfigFunction> | undefined;
|
|
118
118
|
};
|
|
119
119
|
setGlobalData: (data: GlobalData) => void;
|
|
120
120
|
getGlobalData: () => GlobalData;
|
package/dist/server/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import b from"@markdoc/markdoc";import{getPathnameForLocale as A}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as u}from"../constants/common.js";import{DEFAULT_TITLE as C}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{isObject as O}from"../utils/guards/is-object.js";import{mapObject as T}from"../utils/object/map-object.js";import{getValueDeep as S}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as M}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as f}from"../utils/path/normalize-route-slug.js";import{isLocalLink as L}from"../utils/path/is-local-link.js";import{reporter as w}from"./tools/notifiers/reporter.js";import{logger as p}from"./tools/notifiers/logger.js";import{sha1 as k}from"./utils/crypto/sha1.js";import{writeEnvVariable as _}from"./utils/envs/write-env-variable.js";import{readEnvVariable as F}from"./utils/envs/read-env-variable.js";import{KvService as G}from"./persistence/kv/services/kv-service.js";import{writeSharedData as B}from"./utils/index.js";import{renderComponents as I}from"./ssr/render.js";import{readStaticData as N,writeStaticData as V}from"./utils/static-data.js";import{parseAndResolveMarkdoc as j}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as H}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as y}from"./entitlements/entitlements-provider.js";import{isL10nPath as K}from"./fs/utils/is-l10n-path.js";import{resolveMetadataGlobs as U}from"./utils/globs.js";import{replaceEnvVariablesDeep as J}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{addWildcardRedirectToTree as q}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as $}from"../cli/telemetry/helpers/trace-step.js";const R={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map"},g="markdown/partials",bt="markdown/partials-deps",v="PLAN_GATES",W=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],At="userDefinedApiFunctions";class E{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#t={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},rbac:{},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#e=new Map;constructor({outdir:t,contentDir:e,serverMode:s=!1,serverOutDir:r}){this.#r=e,this.outdir=t,this.serverMode=s,this.serverOutDir=r,this.userCodeReady=new Promise(a=>{this.#a=a})}on(t,e){const s=this.listeners.get(t);s?s.add(e):this.listeners.set(t,new Set([e]))}queueEvent=(t,e,...s)=>{this.#e.set(t+String(e),[t,e,...s])};runListeners=(t,e,...s)=>{for(const r of this.listeners.get(t)||new Set)e?r(e,...s):r(...s)};startPluginsRun(){this.clear(),this.#o=new Promise(t=>{this.#i=t})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const t of this.#e.values())this.runListeners(...t);this.#e.clear()}startEsbuildRun(){this.#n=new Promise(t=>{this.#c=t})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await $("build.reload_markdoc_options",async()=>{const t=y.instance(),e=await H(this.serverOutDir),s=Object.fromEntries(Object.entries(e.tags).filter(([r])=>D[r]!=null?t.canAccessFeature(D[r]):!0));this.#s={...e,tags:s}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(g),themeConfig:this.config.markdown}}setGlobalData=t=>{const e=this.globalData,s={...this.globalData,...t};this.globalData=s,JSON.stringify(s)!==JSON.stringify(e)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;getKv=async()=>G.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async(t,e,s)=>{const{data:{info:r,ast:a},compoundHash:c}=await j(t,this.markdocOptions,{actions:this,context:e});for(const o of r.sharedDataDeps||[]){for(const i of s?.routeSlugs||[])this.addRouteSharedData(i,o,o);for(const i of s?.sharedDataIds||[]){const n=this.sharedDataDeps.get(i)||new Set;n.add(o),this.sharedDataDeps.set(i,n)}}for(const o of r.dynamicMarkdocComponents||[]){for(const i of s?.routeSlugs||[]){const n=this.routesDynamicComponents.get(i)||new Set;n.add(o),this.routesDynamicComponents.set(i,n)}for(const i of s?.sharedDataIds||[]){const n=this.sharedDataMarkdocComponents.get(i)||new Set;n.add(o),this.sharedDataMarkdocComponents.set(i,n)}}if(s?.routeSlugs&&r.partials?.length)for(const o of s.routeSlugs){const i=this.routesPartials.get(o)||[];for(const n of r.partials)i.includes(n)||i.push(n);this.routesPartials.set(o,i)}return{info:r,ast:a,compoundHash:c}};async loadOpenApiDefinitions(t){return(await t.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(t){return(await t.cache.load(".","asyncapi-docs")).data}setSearchEngine(t){this.searchEngine=t}setSearchFacets=t=>{this.searchFacets=t};setGlobalConfig=t=>{const e=Object.keys(t);for(const c of e)for(const o in this.replacedEnvVars)if(o===c||o.startsWith(`${c}:`)){const i=o.split(":"),{error:n,value:l}=S(t,i);(n||l!==this.replacedEnvVars[o].replaced)&&delete this.replacedEnvVars[o]}const{resolvedObj:s,unsetEnvVars:r,replacedValues:a}=J(t);for(const c of r)this.unsetEnvVars.add(c);Object.assign(this.replacedEnvVars,a),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=t=>this.config[t];getSearchFacets=()=>this.searchFacets;addRedirect=(t,e)=>{if(!y.instance().canAccessFeature("redirects")&&t!=="/")return;this.config.redirects||(this.config.redirects={});const a=f(t).toLowerCase();this.config.redirects[a]=e,a.endsWith("*")&&q(this.config.wildcardRedirectsTree,a)};getRedirect=t=>{const e=f(t).toLowerCase();return x(e,this.config.redirects,this.config.wildcardRedirectsTree)};createSharedData=async(t,e,s)=>{if(s&&this.#t[t]===s)return t;const r=JSON.stringify(e),a=s??k(r);return this.#t[t]===a||(this.#t[t]=a,await B(t,r,this.outdir),this.queueEvent("shared-data-updated",t)),t};addRouteSharedData=(t,e,s)=>{const r=M(t),a=this.routesSharedData.get(r)||{};a[e]=s,this.routesSharedData.set(r,a),p.verbose(`Adding shared data to ${t}, ${e}, ${s}`)};getRouteSharedDataByFsPath=t=>{const e=this.routesByFsPath.get(t);return e?this.routesSharedData.get(e)||{}:{}};getPartialsForRoute=t=>{const e=this.getGlobalConfig(g)||{},s=this.routesPartials.get(t);if(!s||s.length===0)return{};const r={};for(const a of s)e[a]&&(r[a]=e[a]);return r};addRoute=t=>{const s={...U(t.fsPath,this.config.metadataGlobs),...t.metadata||{}};this.newRoutes.push({...t,metadata:s}),p.verbose("Created route %s",t.slug)};addRouteSharedDataToAllLocales=(t,e,s)=>{const r=[u,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const c=A(t,u,a.code,r);this.addRouteSharedData(c,e,s)}};addApiRoute=t=>{this.apiRoutes.push(t),p.verbose("Created API route %s",t.slug)};addMiddleware=t=>{this.middleware.push(t),p.verbose("Created middleware %s",t.id)};getRouteByFsPath=t=>{const e=this.routesByFsPath.get(t);return e?this.getRouteBySlug(e):void 0};getRouteBySlug=(t,e={})=>{const{followRedirect:s=!0}=e,r=this.getRedirect(t);return s&&r?this.routesBySlug.get(f(r.to)):this.routesBySlug.get(t)};slugHasRouteOrRedirect=t=>{if(this.routesBySlug.has(t))return!0;const e=this.getRedirect(t);if(!e)return!1;if(!L(e.to))return!0;const s=f(e.to);return this.routesBySlug.has(s)};getRoutesByTemplateId=t=>this.newRoutes.filter(e=>e.templateId===t);getAllRoutesForLocale=(t=u)=>{const e=Array.from(this.routesBySlug.values()),s=t.toLowerCase();return e.filter(r=>t===u?!K(r.fsPath):r.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=t=>this.templates.get(t);getRequestHandler=t=>this.apiRoutesRequestHandlers.get(t);createTemplate=(t,e)=>(this.templates.set(t,e),t);addBrowserPlugin=t=>{this.browserPlugins.add(t)};createRequestHandler=(t,e)=>(this.apiRoutesRequestHandlers.set(t,e),t);registerServerPropsGetter=(t,e)=>(this.serverPropsGetters.set(t,e),t);registerPagePropsGetter=(t,e)=>{this.pagePropsGetters.set(t,e)};async writeRouteStaticData(t,e){const s=await this.resolveRouteStaticData(t,e,!1);s&&V(t.slug,s,this.outdir)}async resolveRouteStaticData(t,e,s){if(this.serverMode)return N(t.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:(l,d)=>this.parseMarkdoc(l,d,{routeSlugs:[t.slug]})},a=await t.getStaticData?.(t,r)||{},c=new Set(this.routesDynamicComponents.get(t.slug)),o=this.routesSharedData.get(t.slug)||{};for(const l of Object.values(o)){const d=this.sharedDataMarkdocComponents.get(l);d&&d.forEach(h=>c.add(h));const m=this.sharedDataDeps.get(l);m&&m.forEach(h=>this.addRouteSharedData(t.slug,h,h))}const i=this.getGlobalConfig("seo"),n=a?.frontmatter||{};return{...a,frontmatter:{...n,seo:{...n?.seo,title:n?.seo?.title||await t.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(c),metadata:{...a?.props?.metadata,...t.metadata},seo:{title:C,...i,...a.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!t.fsPath?null:await this.lifecycleContext?.fs.getLastModified(t.fsPath)}}addSsrComponents(t,e){if(!t?.length)return;const s=typeof t[0]=="string"?t.join(""):I(t);s&&(e==="head"?this.ssr.headTags.push(s):e==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const t=[];for(const[s,r]of Object.entries(R))switch(r){case"map":const a=Array.from(this[s].entries());t.push([s,a]);break;case"object":s==="config"&&t.push([s,await this.getConfigWithEnvPlaceholders()]),t.push([s,this[s]]);break;default:throw new Error("Invalid format")}const e=Object.fromEntries(t);return e[v]=F("PLAN_GATES"),e}static fromJson(t,e){const s=new E(e);for(const[a,c]of Object.entries(R))switch(c){case"map":s[a]=new Map(t[a]);break;case"object":if(a==="config"){s.setGlobalConfig(t[a]);break}s[a]=t[a];break;default:throw new Error("Invalid format")}s.config[g]=z(s.config[g]||{});const r=t[v];return r&&_("PLAN_GATES",r),s}async getConfigWithEnvPlaceholders(){const t=JSON.parse(JSON.stringify(this.config));for(const e in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[e],r=e.split(":"),a=r.pop(),{error:c,value:o}=S(t,r);if(c||!O(o)&&!Array.isArray(o)){await w.panicOnBuild(`Failed to replace env var with env name for ${e}`);continue}o[a]=s}return t}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const t=Array.from(this.unsetEnvVars).filter(s=>!W.includes(s));if(t.length===0)return;const e=`Failed to resolve config. The following environment variables are not set: ${t.join(", ")}`;await w.panicOnBuildContentError(e)}}function z(P){return T(P,t=>b.Ast.fromJSON(JSON.stringify(t)))}export{g as MARKDOC_PARTIALS_DATA_KEY,bt as MARKDOC_PARTIALS_DEPS_KEY,E as Store,At as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
|
|
1
|
+
import b from"@markdoc/markdoc";import{getPathnameForLocale as A}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as u}from"../constants/common.js";import{DEFAULT_TITLE as C}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{isObject as O}from"../utils/guards/is-object.js";import{mapObject as T}from"../utils/object/map-object.js";import{getValueDeep as S}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as M}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as f}from"../utils/path/normalize-route-slug.js";import{isLocalLink as L}from"../utils/path/is-local-link.js";import{reporter as w}from"./tools/notifiers/reporter.js";import{logger as p}from"./tools/notifiers/logger.js";import{sha1 as k}from"./utils/crypto/sha1.js";import{writeEnvVariable as _}from"./utils/envs/write-env-variable.js";import{envConfig as F}from"../config/env-config.js";import{KvService as G}from"./persistence/kv/services/kv-service.js";import{writeSharedData as B}from"./utils/index.js";import{renderComponents as I}from"./ssr/render.js";import{readStaticData as N,writeStaticData as V}from"./utils/static-data.js";import{parseAndResolveMarkdoc as j}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as H}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as y}from"./entitlements/entitlements-provider.js";import{isL10nPath as K}from"./fs/utils/is-l10n-path.js";import{resolveMetadataGlobs as U}from"./utils/globs.js";import{replaceEnvVariablesDeep as J}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{addWildcardRedirectToTree as q}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as $}from"../cli/telemetry/helpers/trace-step.js";const R={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map"},g="markdown/partials",bt="markdown/partials-deps",v="PLAN_GATES",W=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],At="userDefinedApiFunctions";class E{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#t={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},rbac:{},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#e=new Map;constructor({outdir:t,contentDir:e,serverMode:s=!1,serverOutDir:r}){this.#r=e,this.outdir=t,this.serverMode=s,this.serverOutDir=r,this.userCodeReady=new Promise(a=>{this.#a=a})}on(t,e){const s=this.listeners.get(t);s?s.add(e):this.listeners.set(t,new Set([e]))}queueEvent=(t,e,...s)=>{this.#e.set(t+String(e),[t,e,...s])};runListeners=(t,e,...s)=>{for(const r of this.listeners.get(t)||new Set)e?r(e,...s):r(...s)};startPluginsRun(){this.clear(),this.#o=new Promise(t=>{this.#i=t})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const t of this.#e.values())this.runListeners(...t);this.#e.clear()}startEsbuildRun(){this.#n=new Promise(t=>{this.#c=t})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await $("build.reload_markdoc_options",async()=>{const t=y.instance(),e=await H(this.serverOutDir),s=Object.fromEntries(Object.entries(e.tags).filter(([r])=>D[r]!=null?t.canAccessFeature(D[r]):!0));this.#s={...e,tags:s}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(g),themeConfig:this.config.markdown}}setGlobalData=t=>{const e=this.globalData,s={...this.globalData,...t};this.globalData=s,JSON.stringify(s)!==JSON.stringify(e)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;getKv=async()=>G.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async(t,e,s)=>{const{data:{info:r,ast:a},compoundHash:c}=await j(t,this.markdocOptions,{actions:this,context:e});for(const o of r.sharedDataDeps||[]){for(const i of s?.routeSlugs||[])this.addRouteSharedData(i,o,o);for(const i of s?.sharedDataIds||[]){const n=this.sharedDataDeps.get(i)||new Set;n.add(o),this.sharedDataDeps.set(i,n)}}for(const o of r.dynamicMarkdocComponents||[]){for(const i of s?.routeSlugs||[]){const n=this.routesDynamicComponents.get(i)||new Set;n.add(o),this.routesDynamicComponents.set(i,n)}for(const i of s?.sharedDataIds||[]){const n=this.sharedDataMarkdocComponents.get(i)||new Set;n.add(o),this.sharedDataMarkdocComponents.set(i,n)}}if(s?.routeSlugs&&r.partials?.length)for(const o of s.routeSlugs){const i=this.routesPartials.get(o)||[];for(const n of r.partials)i.includes(n)||i.push(n);this.routesPartials.set(o,i)}return{info:r,ast:a,compoundHash:c}};async loadOpenApiDefinitions(t){return(await t.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(t){return(await t.cache.load(".","asyncapi-docs")).data}setSearchEngine(t){this.searchEngine=t}setSearchFacets=t=>{this.searchFacets=t};setGlobalConfig=t=>{const e=Object.keys(t);for(const c of e)for(const o in this.replacedEnvVars)if(o===c||o.startsWith(`${c}:`)){const i=o.split(":"),{error:n,value:l}=S(t,i);(n||l!==this.replacedEnvVars[o].replaced)&&delete this.replacedEnvVars[o]}const{resolvedObj:s,unsetEnvVars:r,replacedValues:a}=J(t);for(const c of r)this.unsetEnvVars.add(c);Object.assign(this.replacedEnvVars,a),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=t=>this.config[t];getSearchFacets=()=>this.searchFacets;addRedirect=(t,e)=>{if(!y.instance().canAccessFeature("redirects")&&t!=="/")return;this.config.redirects||(this.config.redirects={});const a=f(t).toLowerCase();this.config.redirects[a]=e,a.endsWith("*")&&q(this.config.wildcardRedirectsTree,a)};getRedirect=t=>{const e=f(t).toLowerCase();return x(e,this.config.redirects,this.config.wildcardRedirectsTree)};createSharedData=async(t,e,s)=>{if(s&&this.#t[t]===s)return t;const r=JSON.stringify(e),a=s??k(r);return this.#t[t]===a||(this.#t[t]=a,await B(t,r,this.outdir),this.queueEvent("shared-data-updated",t)),t};addRouteSharedData=(t,e,s)=>{const r=M(t),a=this.routesSharedData.get(r)||{};a[e]=s,this.routesSharedData.set(r,a),p.verbose(`Adding shared data to ${t}, ${e}, ${s}`)};getRouteSharedDataByFsPath=t=>{const e=this.routesByFsPath.get(t);return e?this.routesSharedData.get(e)||{}:{}};getPartialsForRoute=t=>{const e=this.getGlobalConfig(g)||{},s=this.routesPartials.get(t);if(!s||s.length===0)return{};const r={};for(const a of s)e[a]&&(r[a]=e[a]);return r};addRoute=t=>{const s={...U(t.fsPath,this.config.metadataGlobs),...t.metadata||{}};this.newRoutes.push({...t,metadata:s}),p.verbose("Created route %s",t.slug)};addRouteSharedDataToAllLocales=(t,e,s)=>{const r=[u,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const c=A(t,u,a.code,r);this.addRouteSharedData(c,e,s)}};addApiRoute=t=>{this.apiRoutes.push(t),p.verbose("Created API route %s",t.slug)};addMiddleware=t=>{this.middleware.push(t),p.verbose("Created middleware %s",t.id)};getRouteByFsPath=t=>{const e=this.routesByFsPath.get(t);return e?this.getRouteBySlug(e):void 0};getRouteBySlug=(t,e={})=>{const{followRedirect:s=!0}=e,r=this.getRedirect(t);return s&&r?this.routesBySlug.get(f(r.to)):this.routesBySlug.get(t)};slugHasRouteOrRedirect=t=>{if(this.routesBySlug.has(t))return!0;const e=this.getRedirect(t);if(!e)return!1;if(!L(e.to))return!0;const s=f(e.to);return this.routesBySlug.has(s)};getRoutesByTemplateId=t=>this.newRoutes.filter(e=>e.templateId===t);getAllRoutesForLocale=(t=u)=>{const e=Array.from(this.routesBySlug.values()),s=t.toLowerCase();return e.filter(r=>t===u?!K(r.fsPath):r.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=t=>this.templates.get(t);getRequestHandler=t=>this.apiRoutesRequestHandlers.get(t);createTemplate=(t,e)=>(this.templates.set(t,e),t);addBrowserPlugin=t=>{this.browserPlugins.add(t)};createRequestHandler=(t,e)=>(this.apiRoutesRequestHandlers.set(t,e),t);registerServerPropsGetter=(t,e)=>(this.serverPropsGetters.set(t,e),t);registerPagePropsGetter=(t,e)=>{this.pagePropsGetters.set(t,e)};async writeRouteStaticData(t,e){const s=await this.resolveRouteStaticData(t,e,!1);s&&V(t.slug,s,this.outdir)}async resolveRouteStaticData(t,e,s){if(this.serverMode)return N(t.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:(l,d)=>this.parseMarkdoc(l,d,{routeSlugs:[t.slug]})},a=await t.getStaticData?.(t,r)||{},c=new Set(this.routesDynamicComponents.get(t.slug)),o=this.routesSharedData.get(t.slug)||{};for(const l of Object.values(o)){const d=this.sharedDataMarkdocComponents.get(l);d&&d.forEach(h=>c.add(h));const m=this.sharedDataDeps.get(l);m&&m.forEach(h=>this.addRouteSharedData(t.slug,h,h))}const i=this.getGlobalConfig("seo"),n=a?.frontmatter||{};return{...a,frontmatter:{...n,seo:{...n?.seo,title:n?.seo?.title||await t.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(c),metadata:{...a?.props?.metadata,...t.metadata},seo:{title:C,...i,...a.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!t.fsPath?null:await this.lifecycleContext?.fs.getLastModified(t.fsPath)}}addSsrComponents(t,e){if(!t?.length)return;const s=typeof t[0]=="string"?t.join(""):I(t);s&&(e==="head"?this.ssr.headTags.push(s):e==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const t=[];for(const[s,r]of Object.entries(R))switch(r){case"map":const a=Array.from(this[s].entries());t.push([s,a]);break;case"object":s==="config"&&t.push([s,await this.getConfigWithEnvPlaceholders()]),t.push([s,this[s]]);break;default:throw new Error("Invalid format")}const e=Object.fromEntries(t);return e[v]=F.PLAN_GATES,e}static fromJson(t,e){const s=new E(e);for(const[a,c]of Object.entries(R))switch(c){case"map":s[a]=new Map(t[a]);break;case"object":if(a==="config"){s.setGlobalConfig(t[a]);break}s[a]=t[a];break;default:throw new Error("Invalid format")}s.config[g]=z(s.config[g]||{});const r=t[v];return r&&_("PLAN_GATES",r),s}async getConfigWithEnvPlaceholders(){const t=JSON.parse(JSON.stringify(this.config));for(const e in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[e],r=e.split(":"),a=r.pop(),{error:c,value:o}=S(t,r);if(c||!O(o)&&!Array.isArray(o)){await w.panicOnBuild(`Failed to replace env var with env name for ${e}`);continue}o[a]=s}return t}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const t=Array.from(this.unsetEnvVars).filter(s=>!W.includes(s));if(t.length===0)return;const e=`Failed to resolve config. The following environment variables are not set: ${t.join(", ")}`;await w.panicOnBuildContentError(e)}}function z(P){return T(P,t=>b.Ast.fromJSON(JSON.stringify(t)))}export{g as MARKDOC_PARTIALS_DATA_KEY,bt as MARKDOC_PARTIALS_DEPS_KEY,E as Store,At as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AsyncApiRealmAPI as
|
|
1
|
+
import{AsyncApiRealmAPI as t}from"@redocly/realm-asyncapi-sdk";import{envConfig as e}from"../../config/env-config.js";import{PACKAGE_NAME as o}from"../../config/product-gates.js";import{OTEL_TRACES_DEV_URL as s,TELEMETRY_ENABLED as i}from"../constants/common.js";class l extends t.Telemetry{constructor(){super(),this.updateCloudEventData(()=>({organization:{id:e.ORGANIZATION_ID||"",slug:e.ORGANIZATION_SLUG||""},project:{id:e.PROJECT_ID||"",slug:""},productType:"server",sourceDetails:{user:"Anonymous",object:"user",uri:""},request:{source:"server"}}))}initialize(r=!1){this.init({otel:{serviceName:"realm-server",serviceVersion:`${o}@${e.REDOCLY_PORTAL_VERSION||""}`,collectorTraceUrl:r?s:e.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:e.isProductionEnv,version:"1.0",tracerName:"server-telemetry",delayMillis:100},disabled:r?e.TELEMETRY_DEV_DEBUG!=="true":!i})}}const u=new l;export{u as telemetry};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import*as
|
|
2
|
-
`},
|
|
3
|
-
`},
|
|
1
|
+
import*as g from"node:path";import{envConfig as R}from"../../../config/env-config.js";import{maskEmail as T}from"./helpers/privacy/mask-email.js";import{maskSubject as E}from"./helpers/privacy/mask-subject.js";import{removePii as A}from"./helpers/privacy/remove-pii.js";import{removePiiFromUrl as C}from"./helpers/privacy/remove-pii-from-url.js";import{red as $,green as x,bold as j,blue as p,gray as i,yellow as P,cyan as w}from"./helpers/colors.js";var n;(function(e){e.INFO="INFO",e.WARN="WARN",e.ERROR="ERROR",e.SUCCESS="SUCCESS",e.VERBOSE="VERBOSE",e.HTTP="HTTP"})(n||(n={}));const b={[n.VERBOSE]:0,[n.HTTP]:1,[n.INFO]:2,[n.SUCCESS]:2,[n.WARN]:3,[n.ERROR]:4};function W(e,s){return b[e]>=b[s]}function L(e){if(!e)return;const s=e.toUpperCase();if(s in n)return s}const F={[n.INFO]:p,[n.SUCCESS]:x,[n.WARN]:P,[n.ERROR]:$,[n.HTTP]:w,[n.VERBOSE]:i},I={"%ap":e=>p(g.resolve(e)),"%rp":e=>p(g.relative(process.cwd(),e)),"%s":e=>e?.toString(),"%c":e=>p(e)},v={format(e){switch(R.PORTAL_LOG_FORMAT){case"JSON":return M(e);default:return H(e)}},interpolate(e,...s){const a=Object.keys(I).map(t=>`(${t})`).join("|"),m=new RegExp(a,"g");let o,u=e;for(;(o=m.exec(e))!==null;){o.index===m.lastIndex&&m.lastIndex++;const t=s.shift();if(t===void 0)break;const r=o[0];u=u.replace(r,I[r](t))}return u}};var z=v;const H=e=>{const{level:s,message:a,duration:m,context:o}=e,u=R.isRuntimeMode,t=[F[s](j(`[${s.toLowerCase()}]`))];if(u&&t.push(i(`time="${N()}"`)),o){const{email:r,ipAddress:f,subject:l,method:d,pathname:c,statusCode:S,teams:h,apiFunction:O}=o;O&&t.push(p(`fn="${O}"`)),S&&t.push(U(S)),e.level===n.HTTP&&(d&&t.push(i(`method="${d}"`)),c&&t.push(i(`path="${C(c)}"`))),f&&t.push(i(`ip="${f}"`)),r&&t.push(i(`email="${T(r)}"`)),l&&t.push(i(`sub="${E(l)}"`)),h?.length&&t.push(i(`teams="${h.join(", ")}"`))}if(a){const r=u?`msg="${String(A(a)).replaceAll?.('"','\\"')}"`:String(a);t.push(r)}return e.level===n.HTTP&&o?.userAgent&&t.push(i(`agent="${o.userAgent}"`)),m&&t.push(y(m)),t.join(" ")+`
|
|
2
|
+
`},M=({context:e,message:s,...a})=>{const{method:m,pathname:o,statusCode:u,userAgent:t,subject:r,email:f,teams:l,apiFunction:d}=e||{},c={...a,email:f&&T(f),subject:r&&E(r),teams:l,apiFunction:d,...a.level===n.HTTP?{method:m,pathname:String(C(o)),statusCode:u,userAgent:t}:{message:String(A(s))}};return R.isRuntimeMode&&(c.time=N()),JSON.stringify(c,["time","level","scope","message","duration","method","pathname","statusCode","userAgent","subject","ipAddress","email","apiFunction"])+`
|
|
3
|
+
`},U=e=>(e%500<100?$:e%400<100?P:x)(`status="${e}"`),N=()=>{let e=new Date().getTimezoneOffset()*6e4;return new Date(Date.now()-e).toISOString().slice(0,-1)},y=e=>i(`dur="${Math.round(e)}ms"`);export{n as LogLevel,z as default,L as parseLogLevel,W as shouldLog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createColors as e}from"colorette";import{
|
|
1
|
+
import{createColors as e}from"colorette";import{envConfig as l}from"../../../../config/env-config.js";const r=l.PORTAL_LOG_FORMAT!=="JSON",{red:s,green:t,bold:c,blue:n,gray:a,yellow:g,cyan:d}=e({useColor:r}),f=o=>typeof o=="string"?o.replace(/\x1B[[(?);]{0,2}(;?\d)*./g,""):o;export{n as blue,c as bold,r as colorsAreEnabled,d as cyan,a as gray,t as green,s as red,f as stripColors,g as yellow};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{telemetry as
|
|
2
|
-
`;this.isInteractive()||this.#i.isFooterChanged(t,o)&&this.#t({level:r.INFO,message:e,args:i}),this.#i.updateFooter(t,o)}successTime(t,e,...i){return this.#s(r.SUCCESS,e,t,...i)}warn(t,...e){this.#t({level:r.WARN,message:t,args:e})}warnProd(t,...e){this.#l?this.warn(t,...e):this.verbose(t,...e)}error(t,...e){this.#t({level:r.ERROR,message:t,args:e})}contentError(t,...e){this.#t({level:r.ERROR,message:t,scope:"content",args:e})}verbose(t,...e){this.#t({level:r.VERBOSE,message:t,args:e})}verboseTime(t,e,...i){return this.#s(r.VERBOSE,e,t,...i)}httpTime(t){return this.#s(r.HTTP,"",t)}startTiming(t){const e=t||Symbol();this.#r.set(e,performance.now());const i=setTimeout(()=>{this.#r.delete(e),this.#o.delete(e)},500*1e3);return this.#o.set(e,i),e}updateContext(t){this.#e={...this.#e,...t}}clearAllTimeouts(){for(const t of this.#o.values())clearTimeout(t);this.#o.clear()}isInteractive(){return this.#i.isInteractive()}warnForRealFile(t,e,i,...o){f(e,i)||this.warn(t,e,...o)}#s(t,e,i,...o){const n=this.#r.get(i);if(!n)return;const s=Math.round(performance.now()-n);return this.#r.delete(i),this.#t({level:t,message:e,duration:s,args:o}),{message:e,timeMs:s}}#t({level:t,message:e,duration:i,scope:o,args:n}){if(!
|
|
1
|
+
import{telemetry as c}from"../../telemetry/index.js";import{envConfig as l}from"../../../config/env-config.js";import h,{LogLevel as r,shouldLog as m,parseLogLevel as u}from"./formatter.js";import{isVirtualFile as f}from"../../fs/utils/isVirtualFile.js";import{TerminalManager as g}from"./terminal-manager.js";class p{#e;#l;#i;#n;#r=new Map;#o=new Map;constructor({context:t,forceNonInteractive:e,minLogLevel:i}={}){this.#e=t,this.#l=l.isProductionEnv,this.#i=new g(e),this.#n=i??u(l.REDOCLY_LOG_LEVEL)??(l.isDevelopMode?r.INFO:r.HTTP)}shouldLog(t){return m(t,this.#n)}info(t,...e){this.#t({level:r.INFO,message:t,args:e})}infoTime(t,e,...i){return this.#s(r.INFO,e,t,...i)}success(t,...e){this.#t({level:r.SUCCESS,message:t,args:e})}logInFooter(t,e,...i){const o=h.interpolate(e,...i)+`
|
|
2
|
+
`;this.isInteractive()||this.#i.isFooterChanged(t,o)&&this.#t({level:r.INFO,message:e,args:i}),this.#i.updateFooter(t,o)}successTime(t,e,...i){return this.#s(r.SUCCESS,e,t,...i)}warn(t,...e){this.#t({level:r.WARN,message:t,args:e})}warnProd(t,...e){this.#l?this.warn(t,...e):this.verbose(t,...e)}error(t,...e){this.#t({level:r.ERROR,message:t,args:e})}contentError(t,...e){this.#t({level:r.ERROR,message:t,scope:"content",args:e})}verbose(t,...e){this.#t({level:r.VERBOSE,message:t,args:e})}verboseTime(t,e,...i){return this.#s(r.VERBOSE,e,t,...i)}httpTime(t){return this.#s(r.HTTP,"",t)}startTiming(t){const e=t||Symbol();this.#r.set(e,performance.now());const i=setTimeout(()=>{this.#r.delete(e),this.#o.delete(e)},500*1e3);return this.#o.set(e,i),e}updateContext(t){this.#e={...this.#e,...t}}clearAllTimeouts(){for(const t of this.#o.values())clearTimeout(t);this.#o.clear()}isInteractive(){return this.#i.isInteractive()}warnForRealFile(t,e,i,...o){f(e,i)||this.warn(t,e,...o)}#s(t,e,i,...o){const n=this.#r.get(i);if(!n)return;const s=Math.round(performance.now()-n);return this.#r.delete(i),this.#t({level:t,message:e,duration:s,args:o}),{message:e,timeMs:s}}#t({level:t,message:e,duration:i,scope:o,args:n}){if(!m(t,this.#n))return;let s=e&&h.interpolate(e,...n);s&&i!=null&&t!==r.VERBOSE&&c.sendTimingPerformedMessage([{object:"timing",timeMs:i,message:s}]);const a={level:t,message:s,duration:i,scope:o,context:this.#e};process.stderr.write(h.format(a))}}const R=new p;export{p as Logger,R as logger};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`+r.stack),h
|
|
3
|
-
`+r.stack),h
|
|
1
|
+
import{envConfig as h}from"../../../config/env-config.js";import{logger as e}from"../../tools/notifiers/logger.js";import P from"./formatter.js";import{blue as g,gray as p,red as c}from"./helpers/colors.js";import{isVirtualFile as b}from"../../fs/utils/isVirtualFile.js";import{telemetry as u}from"../../telemetry/index.js";import{shutdowner as f}from"../shutdowner.js";const a=30;class C{#r=[];#o=[];#e=new Map;#t=[];pushError(r,t,...o){const i=P.interpolate(r,...o);this.#r.push({severity:t,message:i,type:"ERROR"})}reportBrokenLink(r){this.#r.push(r)}reportCompilationError(r){const t=`${r.message}::${r.sourceFileRelativePath}::${r?.sourceFileLocation?.line}`;this.#e.has(t)||this.#e.set(t,r)}reportPageRenderError(r){this.#t.push(r)}async panicOnBuild(r,...t){r instanceof Error&&(r=r.message+`
|
|
2
|
+
`+r.stack),h.isBuildMode?await this.panic(r,...t):this.pushError(r,"PANIC",...t)}async panicOnBuildContentErrorForRealFile(r,t,o,...i){b(t,o)||await this.panicOnBuildContentError(r,...i)}async panicOnBuildContentError(r,...t){r instanceof Error&&(r=r.message+`
|
|
3
|
+
`+r.stack),h.isBuildMode?await this.panicOnContentError(r,...t):this.pushError(r,"PANIC",...t)}async panic(r,...t){let o;r instanceof Error?(o=r,r=r.message+`
|
|
4
4
|
`+r.stack):o=new Error(r),e.error(r,...t),u.sendCliErrorCaughtMessage([{object:"cli",message:r}]),await f.exitWithCode(1,o)}async panicOnContentError(r,...t){let o;r instanceof Error?(o=r,r=r.message+`
|
|
5
5
|
`+r.stack):o=new Error(r),e.contentError(r,...t),u.sendCliErrorCaughtMessage([{object:"cli",message:r,scope:"content"}]),await f.exitWithCode(1,o)}reportMarkdocProblem(r){this.#o.push(r)}clearErrors(){this.#r=[]}clearMarkdocProblems(){this.#o=[]}clearEsbuildProblems(){this.#e.clear()}clearPageRenderProblems(){this.#t=[]}getCompilationProblem(r){return this.#e.get(r)}getCompilationProblems(){return[...this.#e.values()]}getPageRenderProblems(){return this.#t}getPageRenderProblem(r){return this.#t.find(t=>t.sourceFileRelativePath===r)}getProblems(){return[...this.#r,...this.getCompilationProblems(),...this.#o,...this.#t]}summary(r,t=0){const o=this.getProblems(),i=this.#o.filter(l=>l.type==="BROKEN_LINK").length,s=this.#r.filter(l=>l.type==="BROKEN_LINK").length,m=this.#o.length-i,E=this.#r.length-s+this.getCompilationProblems().length+this.#t.length;return e.logInFooter("validate",o.length?c(" \u274C Status: %s markdoc errors, %s broken links, %s other errors"):" \u2705 Status: No errors found",m,i+s,E),t!==0&&e.logInFooter("pages",` \u{1F4C4} Total pages: ${t}`),e.logInFooter("timing",r),e.logInFooter("validate-sep",""),e.isInteractive()&&(o.length?e.logInFooter("actions","Press (e) to print all errors, (q) to quit"):e.logInFooter("actions",p("Press (q) to quit"))),o}printErrors(r=[]){const t=this.#r.length,o=r.length?r:this.getProblems();let i=0;for(const s of o.slice(0,a))i>=t?e.contentError(c(`[${++i}] `)+d(s)):e.error(c(`[${++i}] `)+d(s));o.length>a&&e.error(`... and ${o.length-a} more errors`)}listenStdin(){if(!e.isInteractive())return;process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding("utf8");const r=this.printErrors.bind(this);process.stdin.on("data",function(t){if(t===""&&process.exit(),t==="\x7F"){process.stdout.write("\b \b");return}if(t==="\r"){process.stdout.write(`
|
|
6
|
-
`);return}if(t==="e"){r();return}t==="q"&&process.exit(0)})}}const
|
|
6
|
+
`);return}if(t==="e"){r();return}t==="q"&&process.exit(0)})}}const $=new C;function d(n){const r=n.sourceFileLocation,t=r?`:${r.line}:${r.character??1}`:"";return n.message+(n.codeframe?`
|
|
7
7
|
|
|
8
8
|
`+n.codeframe+`
|
|
9
9
|
|
|
10
10
|
`:`
|
|
11
|
-
`)+(n.sourceFileRelativePath?p(`at ${
|
|
12
|
-
`:"")}export{C as Reporter
|
|
11
|
+
`)+(n.sourceFileRelativePath?p(`at ${g("./"+n.sourceFileRelativePath)}${t}`)+`
|
|
12
|
+
`:"")}export{C as Reporter,$ as reporter};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{envConfig as h}from"../../../config/env-config.js";import{gray as p}from"./helpers/colors.js";const t="\x1B[",i=`${t}s`,o=`${t}u`,d=`${t}J`,a=c=>`${t}1;${c}r`,f=`${t}r`,w=`${t}?25h`,R=`${t}?25l`,l=()=>`${p("\u2500".repeat(process.stderr.columns||80))}
|
|
2
2
|
|
|
3
|
-
`,u=3;class I{#
|
|
4
|
-
`.repeat(n)),process.stderr.write(o)),process.stderr.write(i),process.stderr.write(d),
|
|
5
|
-
`.repeat(e)),process.stderr.write(a(
|
|
3
|
+
`,u=3;class I{#r=new Map;#s=process.stderr.rows;#e=0;#t=!1;#i=!1;constructor(r=!1){this.#i=r}isInteractive(){return!!(!this.#i&&process.stderr&&process.stderr.isTTY&&h.TERM!=="dumb"&&!("CI"in process.env)&&h.isDevelopMode)}isFooterChanged(r,s){return this.#r.get(r)!==s}updateFooter(r,s){const e=!this.#r.has(r);this.#r.set(r,s),this.isInteractive()&&(e?this.#n():this.#c())}get#o(){if(this.#r.size===0)return 0;let r=u;for(const s of this.#r.values())r+=(s.match(/\n/g)||[]).length;return r}#c(){if(!this.isInteractive()||this.#r.size===0)return;this.#h();const r=this.#o,s=process.stderr.rows;if(!(r>s)){process.stderr.write(i),process.stderr.cursorTo(0,s-r+1),process.stderr.write(l());for(const e of this.#r.values())process.stderr.write(e);process.stderr.write(o)}}#n(r=0){if(!this.isInteractive())return;const s=process.stderr.rows;let e=this.#o;e>s&&(e=0);const n=e-this.#e;this.#e=e,n>0&&(process.stderr.write(i),process.stderr.write(`
|
|
4
|
+
`.repeat(n)),process.stderr.write(o)),process.stderr.write(i),process.stderr.write(d),r<0&&process.stderr.write(`
|
|
5
|
+
`.repeat(e)),process.stderr.write(a(s-e)),process.stderr.write(o),this.#c()}#h(){this.#t||(this.#t=!0,process.stderr.write(R),process.on("exit",this.#p),process.stderr.on("resize",this.#d))}#p=()=>{this.isInteractive()&&(process.stderr.write(f),process.stderr.write(`${t}${process.stderr.rows};1H`),process.stderr.write(w))};#d=()=>{const r=process.stderr.rows-this.#s;this.#s=process.stderr.rows,this.#n(r)}}export{I as TerminalManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as n from"dotenv";import*as a from"path";import{simpleGit as s}from"simple-git";import{envConfig as o}from"../../../config/env-config.js";import{sanitizeBranchName as v}from"../../utils/envs/sanitize-branch-name.js";async function p(e){try{return(await s(e??process.cwd()).revparse(["--abbrev-ref","HEAD"])).trim()}catch{return""}}async function h(e){n.config({path:a.resolve(e??"",".env")});const t=o.PUBLIC_REDOCLY_BRANCH_NAME||await p(e);if(t){const c=v(t);n.config({path:a.resolve(e??"",`.env.branch.${c}`),override:!0})}const i=o.redoclyEnv;let r;switch(i){case"production":r=".env.production";break;case"preview":r=".env.preview";break;case"development":default:r=".env.development";break}n.config({path:a.resolve(e??"",r),override:!0})}export{h as loadEnvVariables};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(){return
|
|
1
|
+
import{envConfig as t}from"../../config/env-config.js";function e(){return t.NEW_CATALOG_ENABLED==="true"}export{e as isCatalogEntitiesEnabled};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{envConfig as e}from"../../config/env-config.js";import{isCatalogEntitiesEnabled as o}from"./is-catalog-entities-enabled.js";function s(r){return o()&&e.NEW_SCORECARDS_ENABLED==="true"&&Array.isArray(r.scorecards)&&r.scorecards.length>0}export{s as isScorecardsEnabled};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as i from"path";import{cliCommandNames as r}from"../../constants/common.js";import{PUBLIC_STATIC_FOLDER as t}from"../constants/common.js";import{logger as n}from"../tools/notifiers/logger.js";import{blue as
|
|
1
|
+
import*as i from"path";import{cliCommandNames as r}from"../../constants/common.js";import{PUBLIC_STATIC_FOLDER as t}from"../constants/common.js";import{logger as n}from"../tools/notifiers/logger.js";import{blue as a,gray as c}from"../tools/notifiers/helpers/colors.js";import{loadEnvVariables as f}from"./envs/load-env-variables.js";import{copyFolderRecursiveSync as l}from"./fs.js";import{validateInstalledVersion as s}from"./validate-installed-version.js";import{PACKAGE_NAME as E}from"../../config/product-gates.js";import{PORTAL_VERSION as P}from"../version.js";function u(e){return e?"true":"false"}function v(e){e["log-level"]&&(process.env.REDOCLY_LOG_LEVEL=String(e["log-level"])),process.env.INSPECT_MODE="inspect"in e?u(e.inspect):"false",e.pathPrefix&&(process.env.REDOCLY_PREFIX_PATHS=e.pathPrefix)}function L({contentDir:e,outdir:o}){l(i.join(e,t),i.join(o,t))}async function h(e,o,m){await f(o["project-dir"]);const p=e===r.DEVELOP?" Previewing with":"Building with";switch(n.logInFooter("product",`${p} ${a(`${E}@${P}`)}`),n.logInFooter("server",` \u{1F310} Preview URL: ${c("server starting...")}`),e){case r.DEVELOP:case r.BUILD:case r.PREPARE:v(o);break;default:break}await s(),L(m)}export{h as beforeCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{envConfig as p}from"../../config/env-config.js";import{reporter as r}from"../tools/notifiers/reporter.js";import{isMarkdocError as d}from"../plugins/markdown/errors.js";import{telemetryTraceStep as m}from"../../cli/telemetry/helpers/trace-step.js";async function k(i){await m("build.validation_errors",async n=>{let e=0;for(const[a,c]of i.cache.errors.entries()){const f=a.split(":")[1];for(const o of c)d(o)?(r.reportMarkdocProblem(o),o.type!=="BROKEN_LINK"&&e++):await r.panicOnBuild(o.message,f)}const s=await i.getConfig();if(!p.isBuildMode)return;const t=r.getPageRenderProblems().length;n?.setAttribute("markdocErrors",e.toString()),n?.setAttribute("pageRenderErrors",t.toString()),e>0&&!s?.reunite?.ignoreMarkdocErrors?(r.printErrors(),await r.panic(`Need to fix ${e} Markdoc issue(s) or set the \`ignoreMarkdocErrors\` option to \`true\` in the \`reunite\` section of your \`redocly.yaml\``)):t>0&&(r.printErrors(),await r.panic(`Need to fix ${t} runtime error(s) in React pages`))})}export{k as reportAllErrors};
|