@redocly/revel-reef 0.124.0-next.11 → 0.124.0-next.12

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.
@@ -1,3 +1,3 @@
1
- import*as c from"path";import{convertSwagger2OpenAPI as Q}from"@redocly/openapi-docs/lib/utils/convertSwagger2OpenAPI.js";import{bundle as W,createConfig as Y,getTotals as Z,resolvePlugins as oo}from"@redocly/openapi-core";import{normalizeOptions as no,OpenAPIParser as ro,buildContentItems as eo}from"@redocly/openapi-docs";import{combineUrls as B}from"@redocly/theme/core/utils";import{CONFIG_FILE_NAME as F}from"../../../constants/index.js";import{PUBLIC_API_DEFINITIONS_FOLDER as N}from"../../constants/common.js";import{logger as j,reporter as w}from"../../utils/index.js";import{pluralize as x}from"../../../shared/utils.js";import{injectDecoratorIntoConfig as to}from"./decorators.js";import{getAllApiConfigsByPath as io}from"../get-api-config.js";import{deepMerge as L}from"../../../shared/jsUtils.js";import{normalizeFeedbackOptions as ao}from"./utils.js";import{replaceFileExtension as M}from"./store-definition-bundles.js";import{ExternalResolver as so}from"../../fs/utils/external-ref-resolver.js";import{MAX_BUNDLING_ERRORS_TO_PRINT as co}from"./constants.js";async function xo(o,{fs:r,cache:b,getConfig:u,isPathIgnored:h}){if(c.posix.basename(o)===F)return[];let l;try{l=(await b.load(o,"yaml")).data}catch{return[]}if(!l?.openapi&&!l?.swagger)return j.verbose(`${o} file is not definition. Skipping`),[];const d=await u("."),m=await r.getFileInfo(o),n=await u(c.posix.dirname(o)),g=io(n?.apis,o,n.configPath),P=[],T=await h(o);for(const a of g){if(!a.output&&T)continue;const i=L({decorators:d.decorators},n,{rbac:void 0},a);if(i.decorators&&typeof i.decorators!="object"){w.panicOnBuildContentError(`'decorators' must be an object at redocly.yaml, got '${typeof i.decorators}'`);continue}if(i.plugins&&!Array.isArray(i.plugins)){w.panicOnBuildContentError(`'plugins' must be an array at redocly.yaml, got '${typeof i.plugins}'`);continue}const U=n.configPath?c.posix.dirname(n.configPath):".",e=a.output?c.posix.join(U,a.output):o;m&&a.output&&!await r.exists(e)&&r.addVirtualFile(e,m);const z=c.resolve(r.cwd,n.realConfigPath||F),E=new so(r),p=await Y(to(i,e),{configPath:z,externalRefResolver:E});p.plugins&&(p.plugins=[...p.plugins||[],...await oo(p.plugins,r.cwd)]);const v=c.resolve(r.cwd,o),V={config:p,base:c.dirname(v),doc:{source:{absoluteRef:v},parsed:JSON.parse(JSON.stringify(l))},externalRefResolver:E},{bundle:{parsed:O},problems:S,visitorsData:G}=await W(V),J=G["markdown/markdown"]?.markdocChunks,t=Z(S);let D=[t.errors&&`${t.errors} ${x(t.errors,"error","errors")}`,t.warnings&&`${t.warnings} ${x(t.warnings,"warning","warnings")}`,t.ignored&&`${t.ignored} ignored`].filter(Boolean).join(", ");if(t.errors){const f=S.filter(s=>s.severity==="error");let k=`${D} while bundling ${e} definition:
2
- `;const R=Math.min(f.length,co);for(let s=0;s<R;s++){const A=f[s];k+=`${A.message} at ${A.location?.[0]?.pointer??""}
3
- `}if(f.length>R){const s=f.length-R;k+=`... and ${s} more ${x(s,"error","errors")}`}w.panicOnBuild(k)}t.warnings&&j.warn(`${D} while bundling %rp definition`,e);const y=lo(O.swagger!==void 0?await Q(O):O,n.metadata),$=L(d.openapi||{},n.openapi||{},a.openapi||a?.theme?.openapi||{}),H=y["x-feedback"]||$.feedback||n.feedback,_={...$,feedback:ao(H),hideSidebar:!0,disableRouter:!0,mockServer:i?.mockServer||d?.mockServer,downloadUrls:$.downloadUrls||[{url:B(N,`${M(e,".json")}?download`)},{url:B(N,`${M(e,".yaml")}?download`)}]},C=no(_);let I;try{I=new ro(y,void 0,C)}catch(f){w.panicOnBuild(f);continue}const{contentItems:X,flatItems:q}=eo(I,C),K={definition:y,config:i,relativePath:e,realRelativePath:m?.realRelativePath||e,customOutputRelativeFile:a.output&&e,markdocChunks:J,contentItems:X,flatItems:q,options:C,rawOptions:_,parser:I};P.push(K)}return P}async function Po(o,r){const{fs:b,cache:u,getConfig:h}=r,l=[];for(const d of await b.scan(/(\.ya?ml|\.json)$/)){if(!await h(c.posix.dirname(d.relativePath)))continue;const n=await u.load(d.relativePath,"load-oas");n.data&&n.data.length&&l.push(...n.data.map(g=>({...g,isVirtual:d.isVirtual||g.isVirtual,hash:n.compoundHash})))}return l}function lo(o,r){return r?{...o,info:{...o.info,"x-metadata":{...o.info["x-metadata"],...r}}}:o}export{xo as definitionLoader,Po as definitionsLoader};
1
+ import*as l from"path";import{convertSwagger2OpenAPI as Q}from"@redocly/openapi-docs/lib/utils/convertSwagger2OpenAPI.js";import{bundle as W,createConfig as Y,getTotals as Z,resolvePlugins as oo}from"@redocly/openapi-core";import{normalizeOptions as no,OpenAPIParser as ro,buildContentItems as eo}from"@redocly/openapi-docs";import{combineUrls as B}from"@redocly/theme/core/utils";import{CONFIG_FILE_NAME as F}from"../../../constants/index.js";import{PUBLIC_API_DEFINITIONS_FOLDER as N}from"../../constants/common.js";import{logger as j,reporter as g}from"../../utils/index.js";import{pluralize as x}from"../../../shared/utils.js";import{injectDecoratorIntoConfig as to}from"./decorators.js";import{getAllApiConfigsByPath as io}from"../get-api-config.js";import{deepMerge as L}from"../../../shared/jsUtils.js";import{normalizeFeedbackOptions as ao}from"./utils.js";import{replaceFileExtension as M}from"./store-definition-bundles.js";import{ExternalResolver as so}from"../../fs/utils/external-ref-resolver.js";import{MAX_BUNDLING_ERRORS_TO_PRINT as co}from"./constants.js";async function xo(o,{fs:r,cache:w,getConfig:p,isPathIgnored:b}){if(l.posix.basename(o)===F)return[];let d;try{d=(await w.load(o,"yaml")).data}catch{return[]}if(!d?.openapi&&!d?.swagger)return j.verbose(`${o} file is not definition. Skipping`),[];const i=await p("."),u=await r.getFileInfo(o),n=await p(l.posix.dirname(o)),m=io(n?.apis,o,n.configPath),P=[],T=await b(o);for(const s of m){if(!s.output&&T)continue;const a=L({decorators:i.decorators},n,{rbac:void 0},s);if(a.decorators&&typeof a.decorators!="object"){g.panicOnBuildContentError(`'decorators' must be an object at redocly.yaml, got '${typeof a.decorators}'`);continue}if(a.plugins&&!Array.isArray(a.plugins)){g.panicOnBuildContentError(`'plugins' must be an array at redocly.yaml, got '${typeof a.plugins}'`);continue}const U=n.configPath?l.posix.dirname(n.configPath):".",e=s.output?l.posix.join(U,s.output):o;u&&s.output&&!await r.exists(e)&&r.addVirtualFile(e,u);const z=l.resolve(r.cwd,n.realConfigPath||F),E=new so(r),h=await Y(to(a,e),{configPath:z,externalRefResolver:E});i.plugins&&(h.plugins=[...h.plugins||[],...await oo(i.plugins,r.cwd)]);const v=l.resolve(r.cwd,o),V={config:h,base:l.dirname(v),doc:{source:{absoluteRef:v},parsed:JSON.parse(JSON.stringify(d))},externalRefResolver:E},{bundle:{parsed:O},problems:S,visitorsData:G}=await W(V),J=G["markdown/markdown"]?.markdocChunks,t=Z(S);let D=[t.errors&&`${t.errors} ${x(t.errors,"error","errors")}`,t.warnings&&`${t.warnings} ${x(t.warnings,"warning","warnings")}`,t.ignored&&`${t.ignored} ignored`].filter(Boolean).join(", ");if(t.errors){const f=S.filter(c=>c.severity==="error");let k=`${D} while bundling ${e} definition:
2
+ `;const R=Math.min(f.length,co);for(let c=0;c<R;c++){const A=f[c];k+=`${A.message} at ${A.location?.[0]?.pointer??""}
3
+ `}if(f.length>R){const c=f.length-R;k+=`... and ${c} more ${x(c,"error","errors")}`}g.panicOnBuild(k)}t.warnings&&j.warn(`${D} while bundling %rp definition`,e);const y=lo(O.swagger!==void 0?await Q(O):O,n.metadata),$=L(i.openapi||{},n.openapi||{},s.openapi||s?.theme?.openapi||{}),H=y["x-feedback"]||$.feedback||n.feedback,_={...$,feedback:ao(H),hideSidebar:!0,disableRouter:!0,mockServer:a?.mockServer||i?.mockServer,downloadUrls:$.downloadUrls||[{url:B(N,`${M(e,".json")}?download`)},{url:B(N,`${M(e,".yaml")}?download`)}]},C=no(_);let I;try{I=new ro(y,void 0,C)}catch(f){g.panicOnBuild(f);continue}const{contentItems:X,flatItems:q}=eo(I,C),K={definition:y,config:a,relativePath:e,realRelativePath:u?.realRelativePath||e,customOutputRelativeFile:s.output&&e,markdocChunks:J,contentItems:X,flatItems:q,options:C,rawOptions:_,parser:I};P.push(K)}return P}async function Po(o,r){const{fs:w,cache:p,getConfig:b}=r,d=[];for(const i of await w.scan(/(\.ya?ml|\.json)$/)){if(!await b(l.posix.dirname(i.relativePath)))continue;const n=await p.load(i.relativePath,"load-oas");n.data&&n.data.length&&d.push(...n.data.map(m=>({...m,isVirtual:i.isVirtual||m.isVirtual,hash:n.compoundHash})))}return d}function lo(o,r){return r?{...o,info:{...o.info,"x-metadata":{...o.info["x-metadata"],...r}}}:o}export{xo as definitionLoader,Po as definitionsLoader};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/revel-reef",
3
- "version": "0.124.0-next.11",
3
+ "version": "0.124.0-next.12",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {