@redocly/reef 0.131.0-next.2 → 0.131.0-next.3

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @redocly/reef
2
2
 
3
+ ## 0.131.0-next.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 807547ecbd: Improved build memory usage during build for large projects.
8
+
3
9
  ## 0.131.0-next.2
4
10
 
5
11
  ### Minor Changes
@@ -1 +1 @@
1
- import{AsyncApiRealmCLI as c}from"@redocly/realm-asyncapi-sdk";import{TELEMETRY_ENABLED as i}from"../../server/constants/common.js";import{shutdowner as a}from"../../server/tools/shutdowner.js";import{envConfig as o}from"../../config/env-config.js";import{PACKAGE_NAME as l}from"../../config/product-gates.js";class n extends c.Telemetry{#e=new Map;constructor(){super(),this.updateCloudEventData(()=>({organization:{id:o.ORGANIZATION_ID||"",slug:o.ORGANIZATION_SLUG||""},project:{id:o.PROJECT_ID||"",slug:""},productType:"cli",sourceDetails:{user:"Anonymous",object:"user",uri:""},request:{source:"cli"}}))}initialize(e,r,t){const s=r!==void 0?!(r&&i):!i;this.init({otel:{serviceName:"realm-cli",serviceVersion:`${l}@${e}`,collectorTraceUrl:o.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:o.isProductionEnv,version:"1.0",tracerName:"cli-telemetry"},disabled:s,verbose:t}),a.registerShutdownCallback(this.#r.bind(this))}addTraceStepCallbacks(e,{error:r,end:t}){this.#e.set(e,{error:r,end:t})}removeTraceStepCallbacks(e){this.#e.delete(e)}async#r(e){for(const[,{error:r,end:t}]of this.#e)e&&r(e),t();this.#e.clear(),await this.forceFlush(),await this.shutdown()}}const d=new n,f=d.tracer;export{d as telemetry,f as telemetryTracer};
1
+ import{AsyncApiRealmCLI as c}from"@redocly/realm-asyncapi-sdk";import{TELEMETRY_ENABLED as i}from"../../server/constants/common.js";import{shutdowner as a}from"../../server/tools/shutdowner.js";import{envConfig as o}from"../../config/env-config.js";import{PACKAGE_NAME as l}from"../../config/product-gates.js";class n extends c.Telemetry{#e=new Map;constructor(){super(),this.updateCloudEventData(()=>({organization:{id:o.ORGANIZATION_ID||"",slug:o.ORGANIZATION_SLUG||""},project:{id:o.PROJECT_ID||"",slug:""},productType:"cli",sourceDetails:{id:"Anonymous",object:"user",uri:""},source:"cli"}))}initialize(e,t,r){const s=t!==void 0?!(t&&i):!i;this.init({otel:{serviceName:"realm-cli",serviceVersion:`${l}@${e}`,collectorTraceUrl:o.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:o.isProductionEnv,version:"1.0",tracerName:"cli-telemetry"},disabled:s,verbose:r}),a.registerShutdownCallback(this.#t.bind(this))}addTraceStepCallbacks(e,{error:t,end:r}){this.#e.set(e,{error:t,end:r})}removeTraceStepCallbacks(e){this.#e.delete(e)}async#t(e){for(const[,{error:t,end:r}]of this.#e)e&&t(e),r();this.#e.clear(),await this.forceFlush(),await this.shutdown()}}const d=new n,f=d.tracer;export{d as telemetry,f as telemetryTracer};
@@ -1 +1 @@
1
- import{sha1 as M}from"../utils/crypto/sha1.js";import{NestedMap as F}from"./utils/nested-map.js";import{trackAccessStore as m}from"./utils/async-storage.js";import{isLoaderCacheEnabled as L}from"./utils/is-loader-cache-enabled.js";import{LoadError as w}from"./load-error.js";import{createLifecycleContext as S}from"../plugins/lifecycle.js";function f(y,t){return y+":"+t}class q{fs;errors=new Map;#t=new F;#i=new Map;#e=new Map;#s=new Map;#a=new F;#h;#o={};#n=new Map;constructor(t){this.fs=t,this.#h=S(t,this),this.#c()}async load(t,s,i){let e,r;typeof s=="string"?(e=s,r=this.#o[s]):(e=s.name,r=s.loader);const a=f(e,t);if(this.#n.has(a))return this.#n.get(a);const n=i?.join(""),h=n!==void 0?n.length>30?M(n):n:void 0,d=m.getStore()??[],I=!this.#r(t,e,h),p=this.#t.get(e,t);if(I&&p)return d.push({type:"load",loaderId:e,resource:t,hash:p.compoundHash}),p;const c=Promise.withResolvers();this.#n.set(a,c.promise),h!==void 0&&this.#e.set(a,h);const{status:P,value:l}=await this.#l(t,e,async()=>{let g;const C=m.getStore()||[],u=[],E=o=>u.push(o);try{g=await r(t,this.#h,E),u.length>0?this.errors.set(a,u):this.errors.delete(a)}catch(o){const R=this.#t.get(e,t)?.data,H=e==="redocly-config"||e==="nearest-redocly-config"?!1:(await this.load(t,"is-ignored")).data;if(!(o instanceof w)&&!H&&this.errors.set(a,[o]),!R)return{status:"error",value:o instanceof w?o:new w(o.message,{cause:o,loaderId:e})};g=R}const v=M(t+(h??"")+C.map(o=>o.hash).join(""));return d.push({type:"load",loaderId:e,resource:t,hash:v}),{status:"success",value:{data:g,compoundHash:v}}});return P==="error"?c.reject(l):(this.#d(t),L(e)&&this.#t.set(e,t,l),this.#i.set(a,l.compoundHash),c.resolve(l)),this.#n.delete(a),c.promise}setLoaders(t){this.#o={...this.#o,...t}}delete(t,s){if(s){const i=f(s,t);this.#t.delete(s,t),this.errors.delete(i),this.#i.delete(i),this.#e.delete(i);const e=this.#s.get(t);if(e){for(const r of e)this.delete(r,s);this.#s.delete(t)}this.#a.delete(s,t)}else for(const i of this.#t.keys())this.delete(t,i)}#d(t){const[s,i]=t.split("#");if(!i)return;const e=this.#s.get(s);e?e.add(t):this.#s.set(s,new Set([t]))}#c(){this.fs.watch(async t=>{for(const s of t)s.event==="unlink"&&this.delete(s.path)})}#r(t,s,i){const e=f(s,t);return i!==void 0&&this.#e.get(e)!==i?!0:(this.#a.get(s,t)??[]).some(n=>{switch(n.type){case"load":const h=f(n.loaderId,n.resource);return this.#i.get(h)!==n.hash||this.#r(n.resource,n.loaderId,this.#e.get(h));case"read":return n.hash!==this.fs.getFileInfo(n.path)?.hash;case"exists":const d=this.fs.getFileInfo(n.path);return n.hash!==(d&&!d.isVirtual?"t":"f");case"scan":return n.hash!==this.fs.getPatternScanHash(n.pattern)}})}#l(t,s,i){const e=[];return this.#a.set(s,t,e),m.run(e,i)}}export{q as Cache};
1
+ import{LRUCache as H}from"lru-cache";import{sha1 as M}from"../utils/crypto/sha1.js";import{envConfig as S}from"../../config/env-config.js";import{NestedMap as x}from"./utils/nested-map.js";import{trackAccessStore as w}from"./utils/async-storage.js";import{isLoaderCacheEnabled as k}from"./utils/is-loader-cache-enabled.js";import{LoadError as v}from"./load-error.js";import{createLifecycleContext as D}from"../plugins/lifecycle.js";function f(y,t){return y+":"+t}class J{fs;errors=new Map;#t=new Map;#i=new Map;#e=new Map;#s=new Map;#a=new x;#r;#o={};#n=new Map;constructor(t){this.fs=t,this.#r=D(t,this),this.#f()}#c(t){let e=this.#t.get(t);return e||(e=new H({max:S.isBuildMode?1e3:1e6}),this.#t.set(t,e)),e}async load(t,e,i){let s,h;typeof e=="string"?(s=e,h=this.#o[e]):(s=e.name,h=e.loader);const a=f(s,t);if(this.#n.has(a))return this.#n.get(a);const n=i?.join(""),r=n!==void 0?n.length>30?M(n):n:void 0,c=w.getStore()??[],F=!this.#h(t,s,r),p=this.#c(s),g=p.get(t);if(F&&g)return c.push({type:"load",loaderId:s,resource:t,hash:g.compoundHash}),g;const d=Promise.withResolvers();this.#n.set(a,d.promise),r!==void 0&&this.#e.set(a,r);const{status:L,value:l}=await this.#p(t,s,async()=>{let m;const I=w.getStore()||[],u=[],P=o=>u.push(o);try{m=await h(t,this.#r,P),u.length>0?this.errors.set(a,u):this.errors.delete(a)}catch(o){const R=p.get(t)?.data,E=s==="redocly-config"||s==="nearest-redocly-config"?!1:(await this.load(t,"is-ignored")).data;if(!(o instanceof v)&&!E&&this.errors.set(a,[o]),!R)return{status:"error",value:o instanceof v?o:new v(o.message,{cause:o,loaderId:s})};m=R}const C=M(t+(r??"")+I.map(o=>o.hash).join(""));return c.push({type:"load",loaderId:s,resource:t,hash:C}),{status:"success",value:{data:m,compoundHash:C}}});return L==="error"?d.reject(l):(this.#l(t),k(s)&&p.set(t,l),this.#i.set(a,l.compoundHash),d.resolve(l)),this.#n.delete(a),d.promise}setLoaders(t){this.#o={...this.#o,...t}}delete(t,e){if(e){const i=f(e,t);this.#d(t,e),this.errors.delete(i),this.#i.delete(i),this.#e.delete(i);const s=this.#s.get(t);if(s){for(const h of s)this.delete(h,e);this.#s.delete(t)}this.#a.delete(e,t)}else for(const i of this.#t.keys())this.delete(t,i)}#d(t,e){const i=this.#t.get(e);i&&i.delete(t)}#l(t){const[e,i]=t.split("#");if(!i)return;const s=this.#s.get(e);s?s.add(t):this.#s.set(e,new Set([t]))}#f(){this.fs.watch(async t=>{for(const e of t)e.event==="unlink"&&this.delete(e.path)})}#h(t,e,i){const s=f(e,t);return i!==void 0&&this.#e.get(s)!==i?!0:(this.#a.get(e,t)??[]).some(n=>{switch(n.type){case"load":const r=f(n.loaderId,n.resource);return this.#i.get(r)!==n.hash||this.#h(n.resource,n.loaderId,this.#e.get(r));case"read":return n.hash!==this.fs.getFileInfo(n.path)?.hash;case"exists":const c=this.fs.getFileInfo(n.path);return n.hash!==(c&&!c.isVirtual?"t":"f");case"scan":return n.hash!==this.fs.getPatternScanHash(n.pattern)}})}#p(t,e,i){const s=[];return this.#a.set(e,t,s),w.run(s,i)}}export{J as Cache};
@@ -1 +1 @@
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
+ 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 i,TELEMETRY_ENABLED as s}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:{id:"Anonymous",object:"user",uri:""},source:"server"}))}initialize(r=!1){this.init({otel:{serviceName:"realm-server",serviceVersion:`${o}@${e.REDOCLY_PORTAL_VERSION||""}`,collectorTraceUrl:r?i: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":!s})}}const T=new l;export{T as telemetry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/reef",
3
- "version": "0.131.0-next.2",
3
+ "version": "0.131.0-next.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {