@redocly/redoc 0.140.0-next.1 → 0.140.0-next.10
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 +409 -201
- package/dist/api-schemas/mcp-fetch-count.d.ts +2 -18
- package/dist/api-schemas/otel-traces.d.ts +7 -1345
- package/dist/api-schemas/otel-traces.js +1 -1
- package/dist/api-schemas/search-facets.d.ts +3 -31
- package/dist/api-schemas/search.d.ts +6 -52
- package/dist/cli/build/index.js +1 -1
- package/dist/cli/eject/resolveEjectParams.js +1 -1
- package/dist/cli/generate/get-schema-template.js +1 -1
- package/dist/client/app/hooks/markdown/useMarkdocRenderer.js +1 -1
- package/dist/client/app/hooks/markdown/useMarkdownText.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.d.ts +2 -0
- package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/use-markdown-adapter.d.ts +1 -33
- package/dist/client/app/useGlobalData.d.ts +1 -1
- package/dist/client/providers/post-message/use-post-message.d.ts +1 -1
- package/dist/compiled/@redocly/pii/index.mjs +1 -0
- package/dist/compiled/@redocly/pii/package.json +1 -0
- package/dist/compiled/svgo/svgo-node.js +1 -1
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/markdoc/attributes/definition-path.d.ts +1 -1
- package/dist/markdoc/attributes/json-example-ref.d.ts +1 -1
- package/dist/markdoc/attributes/json-schema-ref.d.ts +1 -1
- package/dist/markdoc/attributes/parsed-yaml.d.ts +1 -1
- package/dist/markdoc/attributes/raw-content.d.ts +1 -1
- package/dist/markdoc/attributes/sample-from-json-schema.d.ts +1 -1
- package/dist/markdoc/helpers/extract-rbac-from-condition-node.d.ts +1 -1
- package/dist/markdoc/helpers/get-inner-text.d.ts +1 -1
- package/dist/markdoc/helpers/get-node-attribute.d.ts +1 -1
- package/dist/markdoc/helpers/get-variable.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-conditional-node.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-function.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-node.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-prompt-node.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-tag.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-variable.d.ts +1 -1
- package/dist/markdoc/helpers/parse-partials.d.ts +1 -1
- package/dist/markdoc/helpers/parse-partials.js +1 -1
- package/dist/markdoc/helpers/remove-markdoc-tags.js +1 -1
- package/dist/markdoc/helpers/set-node-attribute-value.d.ts +1 -1
- package/dist/markdoc/nodes/fence/index.d.ts +1 -1
- package/dist/markdoc/nodes/fence/index.js +1 -1
- package/dist/markdoc/nodes/gfm-list-item.d.ts +1 -1
- package/dist/markdoc/nodes/gfm-list-item.js +1 -1
- package/dist/markdoc/nodes/heading.d.ts +1 -1
- package/dist/markdoc/nodes/heading.js +1 -1
- package/dist/markdoc/nodes/index.d.ts +6 -165
- package/dist/markdoc/nodes/index.js +1 -1
- package/dist/markdoc/nodes/table.d.ts +1 -1
- package/dist/markdoc/nodes/table.js +1 -1
- package/dist/markdoc/nodes/text.d.ts +1 -1
- package/dist/markdoc/tags/json-example.js +1 -1
- package/dist/markdoc/tags/openapi-code-sample.js +1 -1
- package/dist/server/api-routes/execute-api-route.js +1 -1
- package/dist/server/api-routes/run-api-routes-worker.js +1 -1
- package/dist/server/config/env-config.d.ts +26 -24
- package/dist/server/config/env-schema.d.ts +87 -326
- package/dist/server/config/env-schemas/api-urls.d.ts +2 -14
- package/dist/server/config/env-schemas/auth.d.ts +10 -32
- package/dist/server/config/env-schemas/catalog.d.ts +6 -9
- package/dist/server/config/env-schemas/database.d.ts +2 -8
- package/dist/server/config/env-schemas/environment-detection.d.ts +20 -18
- package/dist/server/config/env-schemas/feature-flags.d.ts +29 -33
- package/dist/server/config/env-schemas/feature-flags.js +1 -1
- package/dist/server/config/env-schemas/organization-project.d.ts +3 -21
- package/dist/server/config/env-schemas/scorecards.d.ts +2 -6
- package/dist/server/config/env-schemas/search.d.ts +9 -15
- package/dist/server/config/env-schemas/server-config.d.ts +6 -31
- package/dist/server/config/env-schemas/site.d.ts +1 -5
- package/dist/server/config/env-schemas/ssr.d.ts +7 -12
- package/dist/server/config/env-schemas/telemetry.d.ts +1 -7
- package/dist/server/constants/common.d.ts +3 -0
- package/dist/server/constants/common.js +1 -1
- package/dist/server/esbuild/plugins/dependency-resolver.js +1 -1
- package/dist/server/esbuild/plugins/themes-resolver.js +3 -3
- package/dist/server/external-plugins/resolve-external-plugins.js +1 -1
- package/dist/server/node-bundle-entry.js +1 -1
- package/dist/server/plugins/api-docs/definition-access.d.ts +22 -0
- package/dist/server/plugins/api-docs/definition-access.js +1 -0
- package/dist/server/plugins/api-docs/index.js +1 -1
- package/dist/server/plugins/api-docs/loader.d.ts +1 -1
- package/dist/server/plugins/api-docs/options.js +1 -1
- package/dist/server/plugins/api-docs/spec-download.api.js +1 -1
- package/dist/server/plugins/config-parser/index.js +1 -1
- package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/index.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-diagram-from-file.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-gallery.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.js +2 -2
- package/dist/server/plugins/markdown/attribute-resolvers/utils.d.ts +1 -1
- package/dist/server/plugins/markdown/compiler.d.ts +1 -1
- package/dist/server/plugins/markdown/compiler.js +1 -1
- package/dist/server/plugins/markdown/errors.d.ts +1 -1
- package/dist/server/plugins/markdown/get-server-props.js +1 -1
- package/dist/server/plugins/markdown/html/normalize-html-headings.d.ts +1 -1
- package/dist/server/plugins/markdown/html/normalize-html-headings.js +1 -1
- package/dist/server/plugins/markdown/markdoc/functions/concat.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/markdoc-options.d.ts +5 -165
- package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
- package/dist/server/plugins/markdown/markdoc/partials.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/headings.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/utils.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/reparse-example-fences.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/reparse-example-fences.js +1 -1
- package/dist/server/plugins/markdown/runtime-transform.d.ts +2 -2
- package/dist/server/plugins/markdown/runtime-transform.js +1 -1
- package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
- package/dist/server/plugins/markdown/search/nodes/section-node.d.ts +1 -1
- package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
- package/dist/server/plugins/markdown/search/to-markdown.d.ts +1 -1
- package/dist/server/plugins/markdown/search/walk-sections.d.ts +1 -1
- package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
- package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +1 -3
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/list-graphql-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +4 -4
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.d.ts +2 -2
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/handlers/errors.d.ts +0 -5
- package/dist/server/plugins/mcp/handlers/errors.js +1 -1
- package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
- package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/servers/mcp-server.js +2 -2
- package/dist/server/plugins/mcp/types.d.ts +10 -0
- package/dist/server/plugins/mcp/utils/available-tools.d.ts +5 -0
- package/dist/server/plugins/mcp/utils/available-tools.js +1 -0
- package/dist/server/plugins/mcp/workers/worker-context.d.ts +4 -0
- package/dist/server/plugins/mcp/workers/worker-context.js +1 -0
- package/dist/server/plugins/scorecard-classic/compute-scorecard.d.ts +2 -2
- package/dist/server/plugins/scorecard-classic/compute-scorecard.js +1 -1
- package/dist/server/plugins/scorecard-classic/index.js +1 -1
- package/dist/server/plugins/scorecard-classic/shared-utils.js +1 -1
- package/dist/server/plugins/scorecard-classic/template/Grid/GridHeader.js +3 -3
- package/dist/server/plugins/scorecard-classic/template/views.js +1 -1
- package/dist/server/plugins/search/engines/typesense/index.js +1 -1
- package/dist/server/store-config.d.ts +33 -0
- package/dist/server/store-config.js +1 -0
- package/dist/server/store.d.ts +11 -16
- package/dist/server/store.js +1 -1
- package/dist/server/tools/notifiers/formatter.js +3 -3
- package/dist/server/tools/notifiers/helpers/colors.d.ts +1 -1
- package/dist/server/types/plugins/api-routes.d.ts +4 -1
- package/dist/server/types/plugins/common.d.ts +1 -1
- package/dist/server/utils/codeframes/codeframes.d.ts +1 -1
- package/dist/server/utils/codeframes/yaml-ast.d.ts +1 -1
- package/dist/server/utils/decode-request-path.d.ts +2 -0
- package/dist/server/utils/decode-request-path.js +1 -0
- package/dist/server/utils/envs/env-boolean-string.d.ts +9 -3
- package/dist/server/utils/envs/get-api-route-allowed-env-variables.d.ts +2 -0
- package/dist/server/utils/envs/get-api-route-allowed-env-variables.js +1 -1
- package/dist/server/utils/envs/interpolate-env-variables.d.ts +5 -1
- package/dist/server/utils/envs/interpolate-env-variables.js +1 -1
- package/dist/server/utils/envs/load-env-variables.js +1 -1
- package/dist/server/utils/envs/replace-env-variables-deep.d.ts +17 -9
- package/dist/server/utils/envs/replace-env-variables-deep.js +1 -1
- package/dist/server/utils/errors.d.ts +3 -0
- package/dist/server/utils/errors.js +1 -1
- package/dist/server/utils/llmstxt/resolve-llms-txt-md.js +1 -1
- package/dist/server/utils/rbac-expand.js +1 -1
- package/dist/server/utils/rbac.d.ts +5 -1
- package/dist/server/utils/rbac.js +1 -1
- package/dist/server/utils/report-all-errors.js +1 -1
- package/dist/server/web-server/auth.d.ts +2 -0
- package/dist/server/web-server/auth.js +2 -2
- package/dist/server/web-server/middleware/jsonValidatorMiddleware.d.ts +5 -325
- package/dist/server/web-server/routes/auth.js +1 -1
- 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/helpers/process-redirects.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.d.ts +2 -2
- package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.js +18 -18
- package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/utils/ssrf-safe-lookup.d.ts +2 -1
- package/dist/server/web-server/utils/ssrf-safe-lookup.js +1 -1
- package/dist/server/workers/mcp-tool-worker-methods.d.ts +7 -0
- package/dist/server/workers/mcp-tool-worker-methods.js +1 -0
- package/dist/server/workers/mcp-tool-worker-pool.d.ts +0 -1
- package/dist/server/workers/mcp-tool-worker-pool.js +1 -1
- package/dist/server/workers/mcp-tool-worker.js +1 -1
- package/dist/server/workers/types.d.ts +4 -8
- package/dist/server/workers/worker-config.d.ts +33 -0
- package/dist/server/workers/worker-config.js +1 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/markdoc.d.ts +1 -1
- package/package.json +11 -11
- package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.d.ts +0 -6
- package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.js +0 -1
- package/dist/server/plugins/markdown/html/process-html-tokens.d.ts +0 -2
- package/dist/server/plugins/markdown/html/process-html-tokens.js +0 -1
- package/dist/server/plugins/markdown/source.d.ts +0 -4
- package/dist/server/plugins/markdown/source.js +0 -1
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.d.ts +0 -4
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.js +0 -1
- package/dist/server/tools/notifiers/helpers/privacy/mask-email.d.ts +0 -25
- package/dist/server/tools/notifiers/helpers/privacy/mask-email.js +0 -1
- package/dist/server/tools/notifiers/helpers/privacy/mask-subject.d.ts +0 -13
- package/dist/server/tools/notifiers/helpers/privacy/mask-subject.js +0 -1
- package/dist/server/tools/notifiers/helpers/privacy/remove-pii-from-url.d.ts +0 -25
- package/dist/server/tools/notifiers/helpers/privacy/remove-pii-from-url.js +0 -1
- package/dist/server/tools/notifiers/helpers/privacy/remove-pii.d.ts +0 -36
- package/dist/server/tools/notifiers/helpers/privacy/remove-pii.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as
|
|
1
|
+
import{REDOCLY_ROUTE_RBAC as T,REDOCLY_TEAMS_RBAC as v}from"@redocly/config";import{mcpTagSchemas as rt,schemaDefinitionTag as at,markdocParser as U}from"@redocly/api-docs";import{withPathPrefix as $}from"@redocly/theme/core/utils";import{API_DOCS_TEMPLATE_ID as j,GRAPHQL_SPEC_SLUG as st,PUBLIC_RBAC_SCOPE_ITEM as N}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as it,PUBLIC_API_DEFINITIONS_FOLDER as nt}from"../../constants/common.js";import{API_DOCS_SHARED_DATA_PREFIX as O}from"../../constants/plugins/api-docs.js";import{fromCurrentDir as ct}from"../../utils/paths.js";import{normalizeRouteSlug as pt}from"../../../utils/path/normalize-route-slug.js";import{removeTrailingSlash as ut}from"../../../utils/url/remove-trailing-slash.js";import{isTranslationFallback as lt}from"../../fs/utils/is-translation-fallback.js";import{createSlugify as dt}from"../create-slugify.js";import{apiDocLoader as mt,apiDocsLoader as ft}from"./loader.js";import{getTemplatePath as V}from"./get-template-path.js";import{storeDefinitionBundles as gt}from"./store-definition-bundles.js";import{definitionAccessKey as ht,describeDefinitionAccess as Dt}from"./definition-access.js";import{telemetryTraceStep as St}from"../../../cli/telemetry/helpers/trace-step.js";import{searchResolver as Pt}from"./search/search-resolver.js";import{getAiDocumentsStore as yt}from"./search/get-ai-search-documents.js";import{getApiConfigByPath as At}from"../get-api-config.js";import{getRouteSlugsForPath as It}from"../utils.js";import{collectItemRoutes as vt}from"./utils/collect-item-routes.js";import{isChunkCurrent as bt}from"./utils/decorators.js";import{applyNavItemToRoot as Rt}from"./utils/apply-nav-item-to-root.js";import{buildRoutesMapping as _t}from"./utils/build-routes-mapping.js";import{buildItemPositions as Ct}from"./utils/build-item-positions.js";import{resolveApiDocTitle as Tt}from"./utils/resolve-api-doc-title.js";import{resolveConfigRbac as K}from"./utils/resolve-config-rbac.js";import{relativePathToBaseSlug as wt}from"./utils/relative-path-to-base-slug.js";import{normalizeApiVersion as Et}from"./utils/normalize-api-version.js";import{importApiDocsBuilder as W}from"./import-api-docs-builder.js";import{envConfig as G}from"../../config/env-config.js";import{logger as kt}from"../../tools/notifiers/logger.js";const F="openapi-spec-download",Ot={asyncapi:"AsyncAPI Docs",graphql:"GraphQL Docs",openapi:"OpenAPI Docs"};async function he(){let e=[],r=new Map;const s=new WeakMap;let n=new Set,f={},A={};function Y(o,S,b){const I=s.get(o)??new Map;s.set(o,I);const P=S??"";return I.get(P)===b?!1:(I.set(P,b),!0)}return{id:"api-docs",requiredEntitlements:["openapi","asyncapi","graphql"],loaders:{"api-doc":mt,"api-docs":ft},processContent:async(o,S)=>{await St("com.redocly.build.plugin.apiDocs",async()=>{o.createRequestHandler(F,ct(import.meta.url,"./spec-download.api.js")),o.addApiRoute({slug:nt+"/*",requestHandlerId:F,httpMethod:"all",[v]:N,getStaticData:async()=>({props:{definitionAccess:A}})}),o.addApiRoute({slug:it+"/*",requestHandlerId:F,httpMethod:"all",[v]:N,getStaticData:async()=>({props:{definitionAccess:A}})}),o.addApiRoute({slug:st+"/*",requestHandlerId:F,httpMethod:"all",[v]:N,getStaticData:async()=>({props:{definitionAccess:A}})});const b=o.createTemplate(j,V("../../../client/templates/api-docs/template.js")),I=o.registerServerPropsGetter(j,V("./get-server-props.js")),P=await S.getConfig();r=new Map,f={};const y=await o.loadApiDocuments(S);gt(y,o.outdir),A={};const w=!!P.plugins?.some(t=>typeof t=="string"&&t.startsWith("@redocly/portal-plugin-async-api/"));w&&y.some(t=>t.type==="asyncapi")&&kt.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");const p=w?y.filter(t=>t.type!=="asyncapi"):y;e=p.map(({markdocChunks:t,relativePath:u,isVirtual:c,customOutputRelativeFile:a,realRelativePath:D})=>({chunks:t??[],relativePath:u,realRelativePath:D,isVirtual:a!=null||c}));const{buildItems:i}=await W(o.serverOutDir),g=(await S.cache.load("content-slugs","content-slugs")).data,h=dt(g),E=t=>pt(h(t));for(const t of y){const u=ht(t);if(u===void 0)continue;const c=E(t.customOutputRelativeFile||t.relativePath);A[u]=Dt(t,c)}for(const t of p){const u=t.customOutputRelativeFile||t.relativePath,c=E(u);Lt(t,c);const{items:a,store:D}=await i({type:t.type,document:t.document,options:t.options,basePath:c,markdownParser:U}),R=`${O}${t.relativePath}`,M=G.isDevelopMode?t.relativePath:void 0,l=qt(t.document),_=l?.["x-metadata"],C=t.isVirtual?void 0:_?.apiId,L={document:t,basePath:c,sourcePath:M,apiId:C,build:{items:a,store:D}};await o.createSharedData(R,Q(L,a,D));const X=K(t.config),B=!!t.options.excludeFromSearch,J=t.type==="openapi",Z=vt(a,X),tt=lt(t),m=Z.map(d=>{const x=d.metadata?.seo,k={fsPath:u,templateId:b,sharedData:[{key:"apiDocsStore",id:R}],serverPropsGetterIds:[I],excludeFromSearch:B,getStaticData:Mt(d.label,x,tt),[v]:d[v]};return Object.assign(k,Bt(d.link,c)),J&&d.httpVerb&&(k.httpVerb=d.httpVerb,k.metadata={subType:"openapi-operation"}),k});if(!m.length)continue;const H=Tt(l,t.type,a),et=Et(l?.version),q={type:t.type,title:H,version:et,description:typeof l?.description=="string"?l.description:void 0,summary:typeof l?.summary=="string"?l.summary:void 0,...l?.["x-metadata"]&&typeof l["x-metadata"]=="object"?l["x-metadata"]:{}};m[0]={...m[0],metadata:q,hasClientRoutes:!0,getSidebar:(d,x)=>Rt(z(a),c,x),getNavText:()=>H??Ot[t.type]??"API Docs",getSearchDocuments:Pt(a,q,o.getSearchFacets,o.setSearchFacets,B,D,t.document),getAiDocumentsStore:yt({getBuild:()=>L.build,metadata:q,document:t.document,specType:t.type,excludeFromSearch:B,basePath:c,getSearchFacets:o.getSearchFacets,markdocTags:{...rt,schemaDefinition:at}})};const ot=m[0];m[0]=m[m.length-1],m[m.length-1]=ot;for(const d of m)o.addRoute(d);if(C){const d=At(t.config?.apis,t.realRelativePath);f[C]={[v]:d.rbac,[T]:{fsPath:u}}}r.set(R,L)}})},afterRoutesCreated:async(o,S)=>{const{buildItems:b,simplifyAstStructure:I}=await W(o.serverOutDir),P=new Set,y=new Set;for(const{chunks:p,relativePath:i,isVirtual:g}of e){const h=`${O}${i}`,E=It(o.getAllRoutes(),i);for(const{node:t,markdown:u,pointer:c,key:a,relativePath:D}of p){const{ast:R,compoundHash:M}=await o.parseMarkdoc({input:{content:u,relativePath:D,isVirtual:g},resource:c,context:S,deps:{sharedDataIds:[`${O}${D}`],routeSlugs:E}});if(P.add(c),!(a==="graphql-docs"?t?.description?.value!==void 0:!!a&&bt(t,a,u))||!Y(t,a,M))continue;y.add(h);const _=I(R);if(a==="graphql-docs"){t.description&&(t.description.value=_);const C=`${O}${D}`;Ft(r.get(C),_)}else a&&(t[a]=_)}}const w=n.difference(P);for(const p of w)S.cache.delete(p);n=P,Object.entries(f).forEach(([p,i])=>{const g=i[T]?.fsPath;if(!g)return;const h=o.getRouteByFsPath(g)?.baseSlug;f[p]={...i,[T]:{...i[T],slug:h},slug:h}}),o.setGlobalData({apiProducts:f});for(const[p,i]of r){if(!y.has(p))continue;const{items:g,store:h}=await b({type:i.document.type,document:i.document.document,options:i.document.options,basePath:i.basePath,markdownParser:U});i.build={items:g,store:h},await o.createSharedData(p,Q(i,g,h))}}}}function Q({document:e,basePath:r,sourcePath:s,apiId:n},f,A){return{[v]:K(e.config),[T]:{slug:ut(r),fsPath:e.customOutputRelativeFile||e.relativePath},items:f,store:A,options:e.options,baseSlug:r,routesMapping:G.isDevelopMode?_t(f,r):{},graphqlPositions:G.isDevelopMode&&e.type==="graphql"?Ct(f,r):void 0,sourcePath:s,apiId:n}}function Ft(e,r){e?.document.type!=="graphql"||!e.document.options||(e.document.options.info={...e.document.options.info||{},description:r})}function Mt(e,r,s){return async function(n){return{...s?{isTranslationFallback:!0}:{},props:{settings:{baseUrlPath:$(n.baseSlug)},disableAutoScroll:!0,seo:{title:e,...r}}}}}function Lt(e,r){const s=e.options?.mockServer,n=$(`/_mock${wt(e.relativePath)}`);s?.url===n&&(e.options={...e.options,mockServer:{...s,url:$(`/_mock${r}`)}})}function Bt(e,r){if(e===r)return{};const s=r==="/"?"/":`${r}/`;if(e.startsWith(s)){const n=e.slice(s.length);return n?{slugSuffix:n}:{}}return{slug:e}}function qt(e){if(e&&typeof e=="object"&&"info"in e)return e.info}function z(e){return e.map(({content:r,items:s,...n})=>({...n,...s&&{items:z(s)}}))}export{he as apiDocsPlugin,Bt as toRouteSlugFields};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ASTNode, type DocumentNode } from 'graphql';
|
|
2
2
|
import type { OpenAPIDefinition, AsyncApiDefinition, ApiSpecType, RawApiDocsOptions } from '@redocly/api-docs';
|
|
3
|
-
import type { Node as MarkdocNode } from '@
|
|
3
|
+
import type { Node as MarkdocNode } from '@redocly/markdoc';
|
|
4
4
|
import type { LifecycleContext } from '../../types';
|
|
5
5
|
import type { RedoclyConfig } from '@redocly/config';
|
|
6
6
|
export type MarkdocChunk = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as O from"node:path";import{findFirstBinding as A,markdocParser as F}from"@redocly/api-docs";import{combineUrls as i}from"@redocly/theme/core/openapi";import{withPathPrefix as k}from"@redocly/theme/core/utils";import{GRAPHQL_SPEC_SLUG as L}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as f}from"../../constants/common.js";import{envConfig as E}from"../../config/env-config.js";import{deepMerge as w}from"../../../utils/object/deep-merge.js";import{normalizeFeedbackOptions as B}from"./utils/normalize-feedback-options.js";import{replaceFileExtension as p}from"./utils/replace-file-extension.js";import{relativePathToBaseSlug as M}from"./utils/relative-path-to-base-slug.js";const R={tags:{},nodes:{},components:{}};function D(o,r){if(!(o?.off!==!0))return o;const a=M(r);return{url:k(`/_mock${a}`),position:"first",description:"Mock server",...o}}function I(o,r){return(r==="graphql"?[i(L,`${p(o,O.posix.extname(o))}?download`)]:[i(f,`${p(o,".json")}?download`),i(f,`${p(o,".yaml")}?download`)]).map(a=>({url:k(a)}))}function X(o,r,m){const{rootConfig:a,config:s,apiConfig:c,mergedConfig:e,relativePath:l}=m,n=w(a?.[o]||{},s[o]||{},c[o]||c.theme?.[o]||{}),S=r["x-feedback"]||n.feedback||s.feedback,b=!!e[o]?.excludeFromSearch||!!e.theme?.[o]?.excludeFromSearch||!!a?.[o]?.excludeFromSearch||!!a?.theme?.[o]?.excludeFromSearch,_=e.rbac||c.rbac,g=B(S),u=s.metadata,x={...g&&{feedback:g},mockServer:D(e?.mockServer||a?.mockServer,l),disableRouter:!0,downloadUrls:n.downloadUrls||I(l,o),excludeFromSearch:b,rbac:_,markdownParser:F,replayFeatures:{graphql:E.REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED??!1,asyncapi:E.REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED??!1}};let d;if(o==="graphql"){const t=n;d={title:t.info?.title,...u,...t.metadata??{}}}else{const t=r.info,P=t?.["x-metadata"];d={title:t?.title,description:t?.description,...o==="openapi"&&{summary:t?.summary},...u,...P}}o==="openapi"&&n.showSchemaCatalogLinks&&(r["x-schema-catalog-link"]=i(f,l));const C=n.markdocOptions??R,h={...n,...x,specType:o,markdocOptions:C,metadata:d};return o==="asyncapi"&&(h.protocol=A(r)??void 0),h}export{I as buildDownloadUrls,X as createOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"node:path";import{existsSync as u}from"node:fs";import{readFile as I}from"node:fs/promises";import L from"js-yaml";import{withoutPathPrefix as j}from"@redocly/theme/core/utils";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as g,PUBLIC_API_DEFINITIONS_FOLDER as w}from"../../constants/common.js";import{GRAPHQL_SPEC_SLUG as T}from"../../../constants/common.js";import{requestDefinitionAccessKey as C}from"./definition-access.js";import{canDownloadApiDefinition as U,filterDataByAccessDeep as B}from"../../utils/rbac.js";import{API_DOWNLOAD_PREFIXES as G}from"../../utils/is-api-download-link.js";import{decodeRequestPath as W}from"../../utils/decode-request-path.js";import{replaceFileExtension as X}from"./utils/replace-file-extension.js";const v=[".json",".yaml",".yml"],H=[".graphql",".gql"];function F(r,o){const t=e.parse(r);return e.join(t.dir,t.name+o)}const J=async(r,o,t)=>{const{isAuthenticated:a,teams:m,claims:{email:d}}=o.user,S=new URL(r.url),n=W(j(S.pathname));if(n===void 0||n.endsWith("/"))return new Response("Bad Request",{status:400});const c=G.find(i=>n.startsWith(`${i}/`));if(c===void 0)return new Response("Not found",{status:404});const p=c===T,s=n.slice(c.length),l=e.extname(s);if(!(p?H:v).includes(l))return new Response("Not found",{status:404});const{rbac:h={},requiresLogin:P=!1}=o.config.access||{},y=(t.props?.definitionAccess??{})[C(p,X(s.slice(1),""))];if(!U(n,h,P,{isAuthenticated:a,email:d,teams:m},y))return new Response("Unauthorized",{status:a?403:401});const f=t.props?.outdir||"";if(p){const i=e.join(f,w,s);if(!u(i))return new Response("Not found",{status:404});const q=await I(i,"utf-8");return new Response(q,{headers:{"Content-Type":"application/graphql"}})}const E=e.join(f,w,F(s,".json")),R=e.join(f,g,F(s,".json")),A=u(E),D=u(R);if(!A&&!D)return new Response("Not found",{status:404});const _=await I(A?E:R,"utf-8"),x=JSON.parse(_),N=B(x,{isAuthenticated:a,email:d,teams:m},h,P),O=l===".yaml"?L.dump(N):JSON.stringify(N,null,2);return new Response(O,{headers:{"Content-Type":l===".yaml"?"application/yaml":"application/json"}})};var ie=J;export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import S from"path";import{REDOCLY_ROUTE_RBAC as
|
|
1
|
+
import S from"path";import{REDOCLY_ROUTE_RBAC as b,REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{deepMerge as w}from"../../../utils/object/deep-merge.js";import{parsePathVersions as D}from"../../../utils/path/parse-path-versions.js";import{buildWildcardRedirectsTree as T}from"../../utils/redirects/build-wildcard-redirects-tree.js";import{shaHexShort as O}from"../../utils/crypto/sha-hex-short.js";import{isDefined as E}from"../../../utils/guards/is-defined.js";import{logger as L}from"../../tools/notifiers/logger.js";import{formatCustomScripts as h,formatCustomLinks as k}from"./format-custom-tags.js";import{applyL10nToRbacConfig as G,resolveDirectoryHashes as j}from"../../utils/rbac.js";import{isConsentEnabled as B}from"../consent/is-consent-enabled.js";import{copySeoAssets as F}from"./copy-seo-assets.js";import{normalizeRedirectSources as _}from"./normalize-redirect-sources.js";import{applyL10nToRedirects as x}from"./apply-l10n-to-redirects.js";import{DEFAULT_LOADERS as M}from"./loaders/index.js";import{resolveSearchFacets as z}from"./resolve-search-facets.js";import{telemetryTraceStep as I}from"../../../cli/telemetry/helpers/trace-step.js";import{transformMdAst as V}from"../markdown/runtime-transform.js";import{EntitlementsProvider as q}from"../../entitlements/entitlements-provider.js";async function lr(){return{id:"Config Parser",loaders:M,async processContent(e,{getConfig:a,fs:n}){await I("com.redocly.build.plugin.configParser",async t=>{const{contentDir:l,setGlobalConfig:o,setGlobalData:s}=e,r=await a(),i=r.access||{},m=G(n,i.rbac||{}),f={outdir:e.outdir,contentDir:l,consentEnabled:B(r.consent)},C=await h(r.scripts?.head,f),P=await k(r.links,f),R=await h(r.scripts?.body,f),d=w(r,{headScriptTags:C,linkTags:P,postBodyScriptTags:R});t?.setAttribute("config",JSON.stringify(d));const p=r.redirects?_(r.redirects):{},v=Object.keys(p),A=d.banner?.map(c=>typeof c=="object"&&c!==null&&c.rbac?{...c,[y]:c.rbac}:c);o({...d,banner:A,access:{...i,requiresLogin:!!i.requiresLogin,rbac:m},directoryPaths:await j(n,i.rbac),seo:r.seo&&await F(r.seo,f.contentDir,f.outdir),redirects:x(p,r.l10n),wildcardRedirectsTree:T(p),originalRedirectSources:v}),z(r.search?.filters?.facets||[],e.getSearchFacets,e.setSearchFacets);const g=q.instance(),u=!!g.canAccessFeature("removeAttribution");s({removeAttribution:g.pricingTier?u:!0,removeConsoleAttribution:u&&r.removeAttribution===!0})})},async afterRoutesCreated(e,a){H(e);const n=e.getGlobalConfig("banner");if(Array.isArray(n)){const t=await Promise.all(n.map(async(l,o)=>{const{content:s,...r}=l;if(!s){L.warn(`redocly.yaml: banner[${o}] has no content and is not shown.`);return}const{ast:i}=await e.parseMarkdoc({input:{content:s,relativePath:"redocly.yaml"},context:a,resource:`redocly.yaml#banner${o}`}),{renderableAst:m}=await V(i,{variables:{},partials:{}},e.serverOutDir);return Object.assign(r,{ast:m,hash:O(s)})}));e.setGlobalConfig({banner:t.filter(E)})}}}}function H(e){const a=e.getGlobalConfig("access")?.rbac,n=e.getGlobalConfig("directoryPaths");if(!(!a||Object.keys(a).length===0))for(const t of e.getAllRoutes()){if(t.versions&&n){const l=D(t.fsPath)?.filePathInVersion||"index.md";for(const o of t.versions){const s=n[o.folderId],i=s==="."||s==="/"?"":s;o[b]={slug:o.link,fsPath:S.posix.join(i,"@"+o.version,l)}}}t[b]||t[y]||(t[b]={slug:t.slug,fsPath:t.fsPath})}}export{lr as configParserPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import R from"path";import{lintConfig as O,loadConfig as j,createConfigTypes as E}from"@redocly/openapi-core";import{rbacConfigSchema as q,rootRedoclyConfigSchema as S,withPlatformSection as x}from"@redocly/config";import{deepMerge as B}from"../../../../../utils/object/deep-merge.js";import{isPlainObject as y}from"../../../../../utils/guards/is-plain-object.js";import{logger as p}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as k}from"../../../../../constants/common.js";import{sanitizeBranchName as I}from"../../../../utils/envs/sanitize-branch-name.js";import{envConfig as C}from"../../../../config/env-config.js";import{ajv as M,safeParsePartial as N}from"../../safe-parse.js";import{formatConfigProblem as _}from"../../format-error.js";import{ExternalResolver as D}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as F}from"../../resolve-mutual-exclusion.js";function v(e,t,s,r){t in e&&e[t]&&typeof e[t]=="string"&&(/^https?:\/\/.*/.test(e[t])||r(new Error(`Invalid ${s} URL: "${e[t]}". ${s} must start with "http://" or "https://".`)))}function G(e,t){if("access"in e&&e.access&&typeof e.access=="object"){const s=e.access;v(s,"logoutReturnUrl","access.logoutReturnUrl",t),v(s,"residency","access.residency",t);const r=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const o of r)o in s&&s[o]!==void 0&&o in e&&e[o]!==void 0&&t(new Error(`Property '${o}' is defined both at root level and in 'access' object. Please use 'access.${o}' to define this configuration.`))}}function z(e){return M.compile(S.properties.graphql.properties.servers.items.properties.url)(e)}function T(e,t,s){if(y(e)&&Array.isArray(e.servers))for(const r of e.servers){const o=y(r)?r.url:void 0;if(typeof o=="string"&&!z(o)){const a=e.servers.indexOf(r),c=`${t}.servers[${a}].url`;s(new Error(`Invalid ${c}: "${o}". It must be an absolute http:// or https:// URL.`))}}}function V(e,t){if(T(e.graphql,"graphql",t),!!y(e.apis))for(const[s,r]of Object.entries(e.apis))y(r)&&T(r.graphql,`apis.${s}.graphql`,t)}async function ue(e,t,s,r){const a=t.getFileInfo(e)?.realRelativePath||e;async function c(){const f=new D(t),m=R.join(t.cwd,a),d=await j({configPath:m,externalRefResolver:f}),h=await r(d.resolvedConfig);if(h===void 0)return d.resolvedConfig;const g=d.document?.source,P=[...g?await O({config:d,externalConfigTypes:E(h,d)}):[],...g?F(d.resolvedConfig,g):[]];if(P.length>0)for(const L of P)s(new Error(_(L,t.cwd)));return d.resolvedConfig}const n=t.exists(e)?await c():{},l=X(n),w=await r(n);v(n,"residency","Residency",s),v(n,"logoutReturnUrl","Logout return URL",s),G(n,s),V(n,s);let u=w?N(w,n):n;u=H(u),u=W(u,s);const{env:b}=u;if(b){const f=C.REDOCLY_ENV,m=b[f]||{},d=C.PUBLIC_REDOCLY_BRANCH_NAME||"",h=d?I(d):"",g=h&&b[`${k}${h}`]||{};u=B(u,g,m)}const i=J(u,l);if(i.imports&&i.imports.length>0){p.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const f=new Set([...i.plugins||[],...i.imports.map(m=>R.posix.join(m,"plugin.js"))]);i.plugins=Array.from(f),delete i.imports}if(i.catalog&&(p.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),i.catalogClassic={...i.catalog},delete i.catalog),i.scorecard&&(p.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),i.scorecardClassic=i.scorecard,delete i.scorecard),i.search?.ai){p.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const f={...i.search?.ai,...i.aiAssistant,suggestions:i.aiAssistant?.suggestions?.length?i.aiAssistant.suggestions:i.search?.ai.suggestions||[]};i.aiAssistant=f,delete i.search.ai}return Y(i)}function Y(e){const t={...e},r={..."access"in e&&e.access&&typeof e.access=="object"?e.access:{}},o=["requiresLogin","logoutReturnUrl","residency","sso","idps","rbac"],a=[];for(const c of o){const n=t[c];n!==void 0&&(a.push(c),c==="requiresLogin"&&r.requiresLogin===void 0&&(r.requiresLogin=n),c==="logoutReturnUrl"&&r.logoutReturnUrl===void 0&&(r.logoutReturnUrl=n),c==="residency"&&r.residency===void 0&&(r.residency=n),c==="sso"&&r.sso===void 0&&(r.sso=n),c==="idps"&&r.idps===void 0&&(r.idps=n),c==="rbac"&&r.rbac===void 0&&(r.rbac=n),delete t[c])}return a.length>0&&p.warn(`The following properties at root level are deprecated: ${a.join(", ")}. Please move them to the 'access' object.`),Object.keys(r).length>0&&(t.access=r),t}function H(e){const t=Object.entries(e.env??{});[e,...t.map(([,o])=>o)].some(o=>o?.mcp?.docs)&&p.warn("The 'mcp.docs' property is deprecated. Please use the 'mcp' properties instead.");const s=e.mcp?{...e,mcp:A(e.mcp)}:e;if(!e.env)return s;const r=t.map(([o,a])=>[o,a?.mcp?{...a,mcp:A(a.mcp)}:a]);return{...s,env:Object.fromEntries(r)}}function A(e){const t=e.docs??{},s={};(e.hide??t.hide)!==void 0&&(s.hide=e.hide===!0||t.hide===!0);const r=e.name??t.name;r!==void 0&&(s.name=r);const o=e.ignore??t.ignore;o!==void 0&&(s.ignore=o);const a=e.publicEndpoint??t.publicEndpoint;return a!==void 0&&(s.publicEndpoint=a),{...e,...s,docs:{...t,...s}}}function K(e){if(!y(e)||e.platform===void 0)return!1;const t=Object.keys(e).filter(s=>s!=="platform");return t.length>0&&t.every(s=>!Object.hasOwn(q.properties,s))}function W(e,t){const s=Object.entries(e.env??{}),r=new Set;let o=!1;for(const n of[e,...s.map(([,l])=>l)])n?.reunite!==void 0&&r.add("The 'reunite' property is deprecated. Please use 'platform' property instead."),n?.reunite!==void 0&&n?.platform!==void 0&&r.add("Both 'platform' and 'reunite' are set. 'reunite' is ignored, so remove it."),[n?.rbac,n?.access?.rbac].some(l=>l?.reunite!==void 0)&&r.add("The 'access.rbac.reunite' property is deprecated. Please use 'access.rbac.platform' property instead."),[n?.rbac,n?.access?.rbac].some(K)&&(o=!0);for(const n of r)p.warn(n);o&&t(new Error("You are using an incorrect format of 'rbac:' configuration. See: https://redocly.com/docs/realm/access"));const a=U(e);if(!e.env)return a;const c=s.map(([n,l])=>[n,l&&U(l)]);return{...a,env:Object.fromEntries(c)}}function U(e){const t=x(e),s=e.rbac?{...t,rbac:$(e.rbac)}:t;return e.access?.rbac?{...s,access:{...e.access,rbac:$(e.access.rbac)}}:s}function $(e){const{reunite:t,...s}=e;return t===void 0?s:{...s,platform:e.platform??t}}function X(e){if(!e.theme)return[];p.warn("The 'theme' property in redocly.yaml is deprecated. Please move all of the properties from 'theme' to the root of the config.");const t=[];for(const s of Object.keys(e.theme))e[s]==null?t.push(s):p.warn(`Detected both '${s}' and 'theme.${s}' properties in redocly.yaml. The 'theme.${s}' property will be ignored and needs to be removed or merged into the '${s}'.`);return t}function J(e,t){if(!e.theme||t.length===0)return e;const s={...e};for(const r of t)s[r]=e.theme[r];return delete s.theme,s}export{Y as ensureAccessBackwardsCompatibility,ue as readAndValidateConfig};
|
package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../../types';
|
|
3
3
|
export declare function resolveCodeWalkthroughFilesets(node: Node, attributeName: string, pageRelativePath: string, markdocResolveContext: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=filesets-resolver.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
2
|
-
import type { Node } from '@
|
|
2
|
+
import type { Node } from '@redocly/markdoc';
|
|
3
3
|
type ResolverFunction = (node: WithOriginalAttr<Node>, attrName: string, relativePath: string, context: MarkdocResolveContext) => Promise<{
|
|
4
4
|
sharedDataId?: string;
|
|
5
5
|
} | undefined | void>;
|
package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveCodeSnippetFromFile(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-code-snippet-from-file.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveDiagramFromFile(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-diagram-from-file.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Resolves HTML href attributes (e.g., `<a href="...">`) using the existing `resolveLink` logic
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveHtmlSourceAttribute(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir, outdir, getRouteBySlug }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-html-source-attribute.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveImageGallery(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir, outdir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-image-gallery.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveImageSrcSet(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir, outdir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-image-src-set.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveImageSrc(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir, outdir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-image-src.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveJsonExampleRef(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-json-example-ref.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveJsonSchemaRef(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<{
|
|
4
4
|
sharedDataId?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveLink(node: WithOriginalAttr<Node>, attributeName: string, fromPage: string, { actions, context }: MarkdocResolveContext): Promise<{
|
|
4
4
|
sharedDataId?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Resolves native Markdown links/images (e.g., `[]()` or `![]()`) using `resolveLink` and then applies the global
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
2
|
-
import type { Node } from '@
|
|
2
|
+
import type { Node } from '@redocly/markdoc';
|
|
3
3
|
export declare function resolveNavLinks(node: WithOriginalAttr<Node, any>, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-nav-links.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveOpenApiRef(node: WithOriginalAttr<Node>, attrName: string, relativePath: string, { context }: MarkdocResolveContext): Promise<{
|
|
4
4
|
sharedDataId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveOpenapiCodeSamples(node: Node, attrName: string, _relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-openapi-code-samples.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildCodeSamples as
|
|
1
|
+
import{buildCodeSamples as v,getRequestBodySamples as d,normalizeOptions as f,resolveOperationSampleContext as S}from"@redocly/api-docs";import{setNodeAttributeValue as O}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{loadOpenapiBundle as b}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as t}from"./utils.js";const h={curl:"shell",JavaScript:"javascript","Node.js":"javascript",Python:"python",Java:"java","Java8+Apache":"java","C#":"csharp","C#+Newtonsoft":"csharp",PHP:"php",Go:"go",Ruby:"ruby",R:"r"};async function N(e,u,x,{context:g}){const o=await b(e,g);if(!o)return;const i=t(e,"language"),l=t(e,"options"),n={exampleKey:t(e,"exampleKey"),mimeType:t(e,"mimeType"),parameters:t(e,"parameters"),requestBody:t(e,"requestBody"),environments:t(e,"environments"),environment:t(e,"environment")},y={...o.rawOptions,...l,...o.rawOptions.mockServer&&{mockServer:{...o.rawOptions.mockServer,position:"off"}},codeSamples:{...o.rawOptions.codeSamples,...l?.codeSamples,...i&&{languages:[{lang:i}]}}},m=f(y),r=S(o.definition,m,{operationId:t(e,"operationId"),pointer:t(e,"pointer")});if(!r)return;const s=v(r,n).map(a=>({lang:h[a.lang]??a.lang.toLowerCase(),title:a.label??a.lang,source:a.source})),c=m.codeSamples?.languages??[],p=c.findIndex(({lang:a})=>a==="Payload");if(p!==-1){const a=d(r,{exampleKey:n.exampleKey,mimeType:n.mimeType,titlePrefix:c[p].label});s.splice(p,0,...a)}s.length&&O(e,u,s)}export{N as resolveOpenapiCodeSamples};
|
package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveOpenapiResponseSamples(node: Node, attrName: string, _relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-openapi-response-samples.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveParsedYaml(node: Node, attrName: string, relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-parsed-yaml.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveRawContent(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-raw-content.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveRelativeOrCdnIcon(node: WithOriginalAttr<Node>, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-relative-or-cdn-icon.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveRelativePath(node: WithOriginalAttr<Node>, attrName: string, relativePath: string, context: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-relative-path.d.ts.map
|
package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveSampleFromJsonSchema(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-sample-from-json-schema.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveSvgContent(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-svg-content.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveTagRawContent(node: Node, attrName: string, _relativePath: string, { readSourceLines }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-tag-raw-content.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`).replace(/^(?:[ \t]*\n)+/,"").trimEnd();
|
|
1
|
+
import s from"@redocly/markdoc";import{setNodeAttributeValue as c}from"../../../../markdoc/helpers/set-node-attribute-value.js";async function k(t,i,e,{readSourceLines:n}){if(t.children.length===0&&typeof t.attributes[i]=="string")return;if(t.inline){c(t,i,p(t)),t.children=[];return}if(n===void 0)return;const r=t.location?.start.line,f=t.location?.end.line;if(r===void 0||f===void 0)return;const l=n(),o=g(l.slice(r,f),t.tag);if(o===void 0)return;const u=x(l[r]??""),d=l.slice(r+o.start,r+o.end).map(h=>w(h,u)),a=y(d).join(`
|
|
2
|
+
`).replace(/^(?:[ \t]*\n)+/,"").trimEnd();c(t,i,a),t.children=[]}function g(t,i){const e=m(t);if(e===void 0||i===void 0)return;const n=new RegExp(`\\{%\\s*/${i}(?![\\w-])`);let r=t.length-1;for(;r>e&&!n.test(t[r]??"");)r-=1;return r>e?{start:e+1,end:r}:void 0}function m(t){let i=!1;for(let e=0;e<t.length;e+=1){const n=t[e]??"";for(let r=e===0?n.indexOf("{%")+2:0;r<n.length;r+=1)if(i)n[r]==="\\"?r+=1:n[r]==='"'&&(i=!1);else if(n[r]==='"')i=!0;else if(n[r]==="%"&&n[r+1]==="}")return e}}function p(t){return s.format(new s.Ast.Node("inline",{},t.children)).trim()}function x(t){return t.slice(0,Math.max(t.indexOf("{%"),0)).split(">").length-1}function w(t,i){let e=t;for(let n=0;n<i;n+=1){const r=e.match(/^ {0,3}> ?/);if(!r)break;e=e.slice(r[0].length)}return e}function y(t){const i=t.filter(n=>n.trim()!=="").map(n=>n.match(/^[ \t]*/)?.[0]??""),e=i.reduce(E,i[0]??"");return t.map(n=>n.startsWith(e)?n.slice(e.length):n.trimStart())}function E(t,i){let e=0;for(;e<t.length&&e<i.length&&t[e]===i[e];)e+=1;return t.slice(0,e)}export{k as resolveTagRawContent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node, Tag } from '@
|
|
1
|
+
import type { Node, Tag } from '@redocly/markdoc';
|
|
2
2
|
export declare function getLinkOriginalAttrName(attributeName: string): `redocly:::linkOriginal:${string}`;
|
|
3
3
|
export declare function getOptionalAttribute<T>(node: Node | Tag, attrName: string): T | undefined;
|
|
4
4
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, Node, ValidationType } from '@
|
|
1
|
+
import type { Config, Node, ValidationType } from '@redocly/markdoc';
|
|
2
2
|
import type { Store } from '../../store.js';
|
|
3
3
|
import type { LifecycleContext, MarkdownParseInput, MarkdocResolveContext } from '../../types';
|
|
4
4
|
import type { MarkdocError } from '../../../types/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import N from"@redocly/markdoc";import{htmlTags as B}from"@redocly/markdoc/html";import*as M from"path";import{convertGithubAlertToAdmonition as H}from"@redocly/theme/markdoc/tags/admonition";import{GATED_MARKDOC_TAGS as F}from"../../constants/entitlements.js";import{logger as G}from"../../tools/notifiers/logger.js";import{reporter as K}from"../../tools/notifiers/reporter.js";import{sha1 as V}from"../../utils/crypto/sha1.js";import{formatMarkdocError as U}from"./errors.js";import{extractFirstHeading as q,SKIP as j,visit as $}from"./markdoc/plugins/utils.js";import{isPromptNode as z}from"../../../markdoc/helpers/guards/is-prompt-node.js";import{attributeResolvers as E}from"./attribute-resolvers/index.js";import{MdResolveError as J}from"./attribute-resolvers/md-resolve-error.js";import{normalizeHtmlHeadings as Q}from"./html/normalize-html-headings.js";import{resolveRawPartials as X}from"./markdoc/resolve-raw-partials.js";import{exampleContentTrees as Z,reparseExampleFences as tt}from"./markdoc/reparse-example-fences.js";import{EntitlementsProvider as at}from"../../entitlements/entitlements-provider.js";import{MARKDOC_PARTIALS_DEPS_KEY as rt}from"../../constants/common.js";import{getLinkOriginalAttrName as et}from"./attribute-resolvers/utils.js";import{createSourceLinesReader as ot}from"./create-source-lines-reader.js";const it="EMPTY";async function st(a,r,e){const f=at.instance(),{actions:n}=e,{relativePath:c,resolveErrors:S}=a,w={...e,readSourceLines:ot(a.rawContent)},g=new Set,u=new Set,l=new Set,b=new Set,s={},D=new Set,L={},_={};function P(t,o){const k=o||it;t[k]=(t[k]||0)+1}const T=[];a.resolveErrors.length=0;const A=Z(a.ast),I=t=>{H(t);const o=k();T.push(o.then(y=>{y?.sharedDataIds&&y.sharedDataIds.forEach(d=>g.add(d))}).catch(Y(t)));async function k(){const y=[];switch(t.type){case"fence":P(L,t.attributes.language);break;case"link":case"image":await E.nativeMdLink(t,t.type==="link"?"href":"src",c,w);break;case"tag":{if(!t.tag)break;const d=r?.tags?.[t.tag];if(!d){F[t.tag]&&!f.canAccessFeature(F[t.tag])&&(t.addError({level:"warning",id:"invalid-tag",message:`Undefined tag: ${t.tag}`}),t.tag="",t.type="error",t.attributes={});break}const v=t.tag==="html"?t.attributes.name:t.tag;if((t.tag==="html"?D:b).add(v),s[v]=(s[v]||0)+1,v==="code-snippet"&&P(L,t.attributes.language),d.attributes?.__idx&&(t.attributes.__idx=s[t.tag]),d.dynamicComponentLib&&u.add(d.dynamicComponentLib),!d.attributes)break;if(v==="partial"&&t.attributes?.file){const i=et("file"),m=t[i]||t.attributes.file,h=m.startsWith("/")?m.slice(1):M.posix.normalize(M.posix.join(M.posix.dirname(c),m));l.add(h);const p=(n.getGlobalConfig(rt)||{})[h];if(p?.dynamicComponents)for(const R of p.dynamicComponents)u.add(R);if(p?.sharedDataDeps)for(const R of p.sharedDataDeps)g.add(R)}for(const[i,m]of Object.entries(d.attributes)){const h=m.type;if(h&&(h.resolver||m.resolver)){const x=E[h.resolver||m.resolver],p=await x?.(t,i,c,w);p?.sharedDataId&&y.push(p.sharedDataId)}}if(v==="code-walkthrough")for(const i of t.attributes.resolvedFilesets||[])for(const m of i.files||[])P(_,m.language);const O=t.attributes?.attrs;if(O&&t.tag==="html")for(const i of Object.keys(O))i==="src"||i==="srcSet"?await E.htmlSourceAttribute(t,i,c,w):i==="href"&&await E.htmlHref(t,i,c,w);break}}return{sharedDataIds:y}}};function Y(t){return async o=>{if(!(o instanceof J)){await K.panicOnBuild(o.message);return}S.push(U({type:"resolve_link",meta:{...o.meta,link:o.meta.link??o.meta.rawLink},lines:t.location?[t.location.start.line,t.location.end.line]:[],location:t.location,error:{id:"",level:"error",message:o.message,location:t.location}},a.relativePath,a.rawContent))}}$(a.ast,t=>(I(t),z(t)?j:void 0));for(const t of A)$(t,o=>(H(o),o.type==="tag"&&I(o),z(o)?j:void 0));return await Promise.all(T),a.sharedDataDeps=g,a.dynamicMarkdocComponents=u,a.validatedAtRevision<n.buildRevision&&(a.markdocErrors=[a.ast,...A].flatMap(t=>N.validate(t,r)).map(t=>U(t,c,a.rawContent)),a.validatedAtRevision=n.buildRevision),{sharedDataDeps:a.sharedDataDeps,dynamicMarkdocComponents:Array.from(a.dynamicMarkdocComponents?.values()??[]),partials:Array.from(l),tagList:Array.from(b),htmlTagsList:Array.from(D),tagOccurrence:s,codeSnippetLanguages:L,codeWalkthroughLanguages:_}}const C="unclosed-html",nt={html:B({errorTag:C}),allowIndentation:!0,allowComments:!0};function W(a,r){const e=N.parse(a,{...nt,...r});return ct(e),Q(e),e}function ct(a){for(const r of a.walk())r.type!=="tag"||r.tag!==C||(r.type="error",r.errors.push({id:"parse-error",level:"critical",message:String(r.attributes.message),location:r.location}))}function lt(a,r){const e=W(r,{file:a,slots:!0});return tt(e,n=>W(n,{file:a})),{ast:e,rawContent:r,resolveErrors:[],markdocErrors:[],relativePath:a,sharedDataDeps:void 0,validatedAtRevision:-1}}async function Tt(a,r){const{data:e}=await r.cache.load(a,"markdown-ast");return q(e.ast)}async function At(a,r){K.clearMarkdocProblems();const e=a.getAllRoutes();let f=0;const n=G.isInteractive();for(const c of e)await a.resolveRouteStaticData(c,r,!0),f++,n&&f%100===0&&G.logInFooter("validate",` \u{1F50D} Status: validating markdoc (${f}/${e.length})`)}async function It(a,r,e,f){const n=a.content?V(a.content):"";return await e.context.cache.load(f||a.relativePath,{loader:S,name:"markdown-inline-parser"},[n,String(e.actions.buildRevision)]);async function S(w,g,u){let l;if(a.content){const s=await g.getConfig(),D=await X(a.content,a.relativePath,s.markdown?.partialsFolders,g);l=lt(a.relativePath,D)}else l=(await g.cache.load(a.relativePath,"markdown-ast")).data;let b={};if(e.actions.buildRevision!==0&&(b=await st(l,r,e)),!a.isVirtual){for(const s of l.markdocErrors)u(s);for(const s of l.resolveErrors)u(s)}return{ast:l.ast,info:b}}}export{Tt as extractMdFirstHeading,lt as getAst,It as parseAndResolveMarkdoc,st as resolveAndValidateMarkdoc,At as validateAllMarkdowns};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NormalizedProblem } from '@redocly/openapi-core';
|
|
2
|
-
import type { ValidateError, LocationEdge } from '@
|
|
2
|
+
import type { ValidateError, LocationEdge } from '@redocly/markdoc';
|
|
3
3
|
import type { MarkdocError, BrokenLinkType } from '../../../types/index.js';
|
|
4
4
|
export type ValidateErrorWithMeta = ValidateError & {
|
|
5
5
|
meta?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@
|
|
1
|
+
import e from"@redocly/markdoc";import{getPublicEnvVariables as u}from"../../utils/envs/get-public-env-variables.js";import{transformMdAst as i}from"./runtime-transform";const v=async(A,o,t,s)=>{const{ast:l,frontmatter:r,props:n,editPage:f,lastModified:m,isTranslationFallback:b}=o,{headings:d,renderableAst:p}=await i(e.Ast.fromJSON(l),{partials:t.partials,variables:{frontmatter:r,...t.variables,env:u()}},s.serverOutDir);return Array.isArray(r.banner)&&(r.banner=await Promise.all(r.banner.map(async a=>{if(a.ast){const{renderableAst:c}=await i(e.Ast.fromJSON(a.ast),{partials:{},variables:{}},s.serverOutDir);return{...a,ast:c}}return a}))),{...n,ast:p,headings:d,frontmatter:r,editPage:f,lastModified:m,...b?{isTranslationFallback:!0}:{}}};var k=v;export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
/**
|
|
3
3
|
* Rewrites block-level raw HTML `<h1>`…`<h6>` elements into Markdoc `heading` nodes,
|
|
4
4
|
* so they get an anchor id, a TOC entry and a search section like Markdown headings.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import l from"@redocly/markdoc";const s=/^h([1-6])$/;function u(t){r(t,!1)}function r(t,i){const n=i||t.type==="inline";t.children=t.children.map(e=>{const o=(n?void 0:a(e))??e;return r(o,n),o});for(const e of Object.values(t.slots))r(e,n)}function a(t){if(t.type!=="tag"||t.tag!=="html")return;const i=s.exec(t.attributes.name)?.[1];if(!i)return;const n=t.attributes.attrs?.id,e=new l.Ast.Node("heading",{level:Number(i),...typeof n=="string"&&{id:n}},[new l.Ast.Node("inline",{},t.children)]);return e.location=t.location,e}export{u as normalizeHtmlHeadings};
|