veryfront 0.1.992 → 0.1.994
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/esm/deno.js +3 -3
- package/esm/src/build/production-build/templates.d.ts.map +1 -1
- package/esm/src/build/production-build/templates.js +1 -1
- package/esm/src/html/html-injection.d.ts +7 -0
- package/esm/src/html/html-injection.d.ts.map +1 -1
- package/esm/src/html/html-injection.js +7 -1
- package/esm/src/html/hydration-script-builder/templates/renderer.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/renderer.js +6 -2
- package/esm/src/html/hydration-script-builder/templates/router.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/router.js +49 -8
- package/esm/src/react/runtime/core.d.ts +57 -5
- package/esm/src/react/runtime/core.d.ts.map +1 -1
- package/esm/src/react/runtime/core.js +168 -6
- package/esm/src/rendering/layouts/layout-applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/layout-applicator.js +2 -5
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +1 -0
- package/esm/src/rendering/page-rendering.d.ts.map +1 -1
- package/esm/src/rendering/page-rendering.js +2 -5
- package/esm/src/rendering/rsc/client-boot.ts +5 -1
- package/esm/src/rendering/rsc/client-module-strategy.d.ts +14 -0
- package/esm/src/rendering/rsc/client-module-strategy.d.ts.map +1 -1
- package/esm/src/rendering/rsc/client-module-strategy.js +11 -0
- package/esm/src/rendering/rsc/hydrate-client.ts +9 -2
- package/esm/src/rendering/script-page-handling.d.ts.map +1 -1
- package/esm/src/rendering/script-page-handling.js +2 -5
- package/esm/src/routing/api/context-builder.d.ts +4 -0
- package/esm/src/routing/api/context-builder.d.ts.map +1 -1
- package/esm/src/routing/api/context-builder.js +6 -5
- package/esm/src/routing/flatten-route-params.d.ts +11 -0
- package/esm/src/routing/flatten-route-params.d.ts.map +1 -0
- package/esm/src/routing/flatten-route-params.js +20 -0
- package/esm/src/routing/index.d.ts +1 -0
- package/esm/src/routing/index.d.ts.map +1 -1
- package/esm/src/routing/index.js +1 -0
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Do not edit manually — run `deno task generate` to regenerate.
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
|
-
export const CLIENT_BOOT_BUNDLE = 'var ot=Object.defineProperty;var nt=(t,e,o)=>e in t?ot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var p=(t,e,o)=>nt(t,typeof e!="symbol"?e+"":e,o);var st="3.2.3";function it(t,e,o,n){let s=[];if(n?.external?.length&&s.push(`external=${n.external.join(",")}`),s.push(`target=${n?.target??"es2022"}`),n?.deps){let d=Object.entries(n.deps).map(([l,m])=>`${l}@${m}`).join(",");s.push(`deps=${d}`)}let u=e?`@${e}`:"",a=o??"",i=s.length?`?${s.join("&")}`:"";return`https://esm.sh/${t}${u}${a}${i}`}function f(t,e,o,n=!1){return it(t,e,o,{external:n?["react"]:void 0,deps:{csstype:st}})}var ct="19.2.4",E=ct;function w(t=E){return{react:f("react",t),"react-dom":f("react-dom",t,void 0,!0),"react-dom/client":f("react-dom",t,"/client",!0),"react-dom/server":f("react-dom",t,"/server",!0),"react/jsx-runtime":f("react",t,"/jsx-runtime",!0),"react/jsx-dev-runtime":f("react",t,"/jsx-dev-runtime",!0)}}function V(t=E){return w(t).react}function H(t=E){return w(t)["react-dom/client"]}function lt(t){return t.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function D(t){return lt(btoa(t))}var Tr=Object.freeze({react:"","react-dom":"","react-dom/client":"","react-dom/server":"","react/jsx-runtime":"","react/jsx-dev-runtime":""});function v(t,e){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t))return!0;for(let o of Object.keys(e))if(o.endsWith("/")&&t.startsWith(o))return!0;return!1}function ut(t){try{return JSON.parse(t)?.imports??{}}catch{return{}}}function F(t=document){let e=t.querySelector(\'script[type="importmap"]\');return e?.textContent?ut(e.textContent):{}}var c="/_veryfront",b={RSC:`${c}/rsc/`,FS:`${c}/fs/`,MODULES:`${c}/modules/`,PAGES:`${c}/pages/`,DATA:`${c}/data/`,LIB:`${c}/lib/`,CHUNKS:`${c}/chunks/`,CLIENT:`${c}/client/`},$={HMR_RUNTIME:`${c}/hmr-runtime.js`,HMR:`${c}/hmr.js`,ERROR_OVERLAY:`${c}/error-overlay.js`,DEV_LOADER:`${c}/dev-loader.js`,CLIENT_LOG:`${c}/log`,CLIENT_JS:`${c}/client.js`,ROUTER_JS:`${c}/router.js`,PREFETCH_JS:`${c}/prefetch.js`,MANIFEST_JSON:`${c}/manifest.json`,APP_JS:`${c}/app.js`,RSC_CLIENT:`${c}/rsc/client.js`,RSC_MANIFEST:`${c}/rsc/manifest`,RSC_STREAM:`${c}/rsc/stream`,RSC_PAYLOAD:`${c}/rsc/payload`,RSC_RENDER:`${c}/rsc/render`,RSC_PAGE:`${c}/rsc/page`,RSC_MODULE:`${c}/rsc/module`,RSC_DOM:`${c}/rsc/dom.js`,LIB_CHAT_REACT:`${c}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${c}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${c}/lib/chat/primitives.js`};var dt={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},Dr=dt.CACHE;var vr={HMR_RUNTIME:$.HMR_RUNTIME,ERROR_OVERLAY:$.ERROR_OVERLAY};var y=b.RSC,G=b.FS,k="veryfront-hydration-data",_="rsc-root";function I(t=document){try{let e=t.getElementById(k);return e?JSON.parse(e.textContent||"{}"):null}catch(e){return console.debug?.("[RSC] hydration data parse failed",e),null}}function T(t){return t?.clientModuleStrategy?t.clientModuleStrategy:t?.dev?"fs":"rsc-module"}function pt(t){return`${G}${D(t)}.js`}function mt(t,e){let o=e?`&v=${encodeURIComponent(e)}`:"";return`${y}module?rel=${encodeURIComponent(t)}${o}`}function C(t){if(t.strategy==="fs"){let e=t.absPath??t.rel;return e?pt(e):null}return mt(t.rel,t.version)}function O(t=document,e=E){let o=F(t);return{react:v("react",o)?"react":V(e),reactDomClient:v("react-dom/client",o)?"react-dom/client":H(e)}}function r(t){return{...t,create(e){return new M(e?.message||e?.detail||t.title,{slug:t.slug,category:t.category,status:e?.status??t.status,title:t.title,suggestion:t.suggestion,detail:e?.detail,cause:e?.cause,instance:e?.instance,context:e?.context})}}}var M=class extends Error{constructor(o,n){super(o);p(this,"slug");p(this,"category");p(this,"status");p(this,"title");p(this,"suggestion");p(this,"detail");p(this,"cause");p(this,"instance");p(this,"context");this.name="VeryfrontError",this.slug=n.slug,this.category=n.category,this.status=n.status,this.title=n.title,this.suggestion=n.suggestion,this.detail=n.detail,this.cause=n.cause,this.instance=n.instance,this.context=n.context}toRFC9457(){return{type:`https://veryfront.com/docs/errors/${this.slug}`,title:this.title,status:this.status,detail:this.detail,instance:this.instance,category:this.category,suggestion:this.suggestion,cause:typeof this.cause=="string"?this.cause:void 0}}getDocsUrl(){return`https://veryfront.com/docs/errors/${this.slug}`}};var ft=r({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),Rt=r({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),Et=r({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),yt=r({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),_t=r({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),ht=r({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),St=r({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),xt=r({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),Y={"config-not-found":ft,"config-invalid":Rt,"config-parse-error":Et,"config-validation-error":yt,"config-type-error":_t,"import-map-invalid":ht,"cors-config-invalid":St,"config-validation-failed":xt};var It=r({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),Tt=r({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),Ct=r({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),Ot=r({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),At=r({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),Nt=r({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),Dt=r({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),vt=r({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),B={"build-failed":It,"bundle-error":Tt,"typescript-error":Ct,"mdx-compile-error":Ot,"asset-optimization-error":At,"ssg-generation-error":Nt,"sourcemap-error":Dt,"compilation-error":vt};var bt=r({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),Mt=r({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),Lt=r({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),Ut=r({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),Pt=r({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),wt=r({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),Vt=r({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),j={"hydration-mismatch":bt,"render-error":Mt,"component-error":Lt,"layout-not-found":Ut,"page-not-found":Pt,"api-error":wt,"middleware-error":Vt};var Ht=r({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),Ft=r({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),$t=r({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),Gt=r({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),kt=r({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),Yt=r({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),W={"route-conflict":Ht,"invalid-route-file":Ft,"route-handler-invalid":$t,"dynamic-route-error":Gt,"route-params-error":kt,"api-route-error":Yt};var Bt=r({slug:"module-not-found",category:"MODULE",status:404,title:"Module could not be resolved",suggestion:"Check the import path and ensure the module is installed"}),jt=r({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),Wt=r({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),qt=r({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),zt=r({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Xt=r({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),q={"module-not-found":Bt,"import-resolution-error":jt,"circular-dependency":Wt,"invalid-import":qt,"dependency-missing":zt,"version-mismatch":Xt};var Jt=r({slug:"port-in-use",category:"SERVER",status:409,title:"Server port already in use",suggestion:"Use a different port or stop the process using this port"}),Kt=r({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),Zt=r({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),Qt=r({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),te=r({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),ee=r({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),re=r({slug:"semaphore-timeout",category:"SERVER",status:503,title:"Semaphore acquire timeout",suggestion:"Reduce concurrency or increase the semaphore acquire timeout"}),oe=r({slug:"circuit-breaker-open",category:"SERVER",status:503,title:"Circuit breaker is open",suggestion:"Wait for the breaker reset timeout before retrying"}),ne=r({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),se=r({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),ie=r({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),ae=r({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),ce=r({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),le=r({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),ue=r({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),z={"port-in-use":Jt,"server-start-error":Kt,"cache-error":Zt,"file-watch-error":Qt,"request-error":te,"service-overloaded":ee,"semaphore-timeout":re,"circuit-breaker-open":oe,"cache-path-mismatch":ne,"network-error":se,"api-client-error":ie,"token-storage-error":ae,"cache-invariant-violation":ce,"release-not-found":le,"fallback-exhausted":ue};var ge=r({slug:"client-boundary-violation",category:"BOUNDARY",status:400,title:"Client boundary rule violation",suggestion:"Add \'use client\' directive or move code to a client component"}),de=r({slug:"server-only-in-client",category:"BOUNDARY",status:400,title:"Server-only code in client component",suggestion:"Move server-only code to a server component"}),pe=r({slug:"client-only-in-server",category:"BOUNDARY",status:400,title:"Client-only code in server component",suggestion:"Move client-only code to a client component"}),me=r({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),fe=r({slug:"invalid-use-server",category:"BOUNDARY",status:400,title:"Invalid \'use server\' directive",suggestion:"Place \'use server\' at the top of the file or function"}),Re=r({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),X={"client-boundary-violation":ge,"server-only-in-client":de,"client-only-in-server":pe,"invalid-use-client":me,"invalid-use-server":fe,"rsc-payload-error":Re};var Ee=r({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),ye=r({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),_e=r({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),he=r({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),Se=r({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),J={"hmr-error":Ee,"dev-server-error":ye,"fast-refresh-error":_e,"error-overlay-error":he,"source-map-error":Se};var xe=r({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),Ie=r({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),Te=r({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),Ce=r({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),K={"deployment-error":xe,"platform-error":Ie,"env-var-missing":Te,"production-build-required":Ce};var Oe=r({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),Ae=r({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),Ne=r({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),De=r({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),ve=r({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),be=r({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),Me=r({slug:"tool-id-conflict",category:"AGENT",status:409,title:"Tool ID conflict",suggestion:"Use a unique tool ID or rename one of the conflicting tools"}),Z={"agent-error":Oe,"agent-not-found":Ae,"agent-timeout":Ne,"agent-intent-error":De,"orchestration-error":ve,"cost-limit-exceeded":be,"tool-id-conflict":Me};var Le=r({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),Ue=r({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),Pe=r({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),we=r({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),Ve=r({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),He=r({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),Fe=r({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),$e=r({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),L=r({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),Ge=r({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"}),Q={"unknown-error":Le,"permission-denied":Ue,"file-not-found":Pe,"resource-not-found":we,"invalid-argument":Ve,"timeout-error":He,"initialization-error":Fe,"not-supported":$e,"security-violation":L,"input-validation-failed":Ge};var No={...Y,...B,...j,...W,...q,...z,...X,...J,...K,...Z,...Q};var ke=[{source:String.raw`<script[^>]*>[\\s\\S]*?<\\/script>`,flags:"gi",name:"inline script"},{source:String.raw`javascript:`,flags:"gi",name:"javascript: URL"},{source:String.raw`\\bon\\w+\\s*=`,flags:"gi",name:"event handler attribute"},{source:String.raw`data:\\s*text\\/html`,flags:"gi",name:"data: HTML URL"}];function Ye(){return ke.map(({source:t,flags:e,name:o})=>({pattern:new RegExp(t,e),name:o}))}function Be(){let t=globalThis;return t.__VERYFRONT_DEV__===!0||t.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function h(t,e={}){let{allowInlineScripts:o=!1,strict:n=!1,warn:s=!0}=e;for(let{pattern:u,name:a}of Ye())if(!(o&&a==="inline script")&&(u.lastIndex=0,!!u.test(t)&&(s&&console.warn(`[Security] Suspicious ${a} detected in server HTML`),n||!Be())))throw L.create({detail:`Potentially unsafe HTML: ${a} detected`});return t}var R=class{constructor(e,o){p(this,"prefix",e);p(this,"level",o)}log(e,o,n,...s){this.level>e||o?.(n,...s)}debug(e,...o){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${e}`,...o)}info(e,...o){this.log(1,console.log,`[${this.prefix}] ${e}`,...o)}warn(e,...o){this.log(2,console.warn,`[${this.prefix}] WARN: ${e}`,...o)}error(e,...o){this.log(3,console.error,`[${this.prefix}] ERROR: ${e}`,...o)}};function je(){if(typeof window>"u")return 2;let t=globalThis;return t.__VERYFRONT_DEV__||t.__RSC_DEV__?t.__VERYFRONT_DEBUG__||t.__RSC_DEBUG__?0:1:2}var A=je(),g=new R("RSC",A),jo=new R("PREFETCH",A),Wo=new R("HYDRATE",A),qo=new R("VERYFRONT",A);function S(t,e){let o=e==="root"?_:`rsc-slot-${e}`,n=t.getElementById(o);if(n)return n;let s=t.createElement("div");return s.id=o,t.body.appendChild(s),s}function We(t,e){if(e.type!=="slot")return;let o=S(t,e.id);o.innerHTML=h(String(e.html??""))}function tt(t,e){let o=e.split(`\n`),n=o.pop()??"";for(let s of o){let u=s.trim();if(!u)continue;let a;try{a=JSON.parse(u)}catch(d){g.debug("[client-dom] malformed NDJSON line",{line:u,error:d instanceof Error?d.message:String(d)});continue}if(!a||typeof a!="object")continue;let i=a;if(i.type==="slot"){We(t,i);try{Xe(t,i.id||"root")}catch(d){g.debug("[client-dom] hydration optional failed",d)}}}return n}function qe(t){return new Promise((e,o)=>{let n=()=>o(new DOMException("aborted","AbortError"));if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0})})}async function et(t,e=document,o){let n="body"in t?t:null,s=n?.body??t;if(!s)return;let u=s.getReader(),a=new TextDecoder,i="",d=!1;try{for(;;){if(o?.aborted)throw new DOMException("aborted","AbortError");let l=u.read(),{done:m,value:x}=o?await Promise.race([l,qe(o)]):await l;if(m){d=!0;break}i+=a.decode(x,{stream:!0}),i=tt(e,i)}i&&tt(e,`${i}\n`)}catch(l){throw l instanceof Error&&l.name==="AbortError"||g.debug("[client-dom] consumeNdjsonStream error",l),l}finally{try{await u.cancel()}catch(l){d||g.debug("[client-dom] reader.cancel failed",l)}try{u.releaseLock()}catch(l){g.debug("[client-dom] reader.releaseLock failed",l)}if(typeof s.cancel=="function")try{await s.cancel()}catch(l){g.debug("[client-dom] stream.cancel failed",l)}if(typeof n?.body?.cancel=="function")try{await n.body.cancel()}catch(l){g.debug("[client-dom] response.body.cancel failed",l)}}}function ze(t,e){let o=S(t,e),n=[],s=u=>{let a=u;a.dataset?.clientRef&&n.push(a);for(let i of u.children)s(i)};return s(o),n}function Xe(t,e){let o=ze(t,e);for(let n of o){let s=n.dataset?.clientRef;s&&(n.dataset.hydrated="true",g.debug("[client-dom] marked for hydration",s))}}var Je=100;function Ke(t,e){if(globalThis.__VF_CLIENT_MOD_CACHE??(globalThis.__VF_CLIENT_MOD_CACHE=new Map),globalThis.__VF_CLIENT_MOD_CACHE.size>=Je){let o=globalThis.__VF_CLIENT_MOD_CACHE.keys().next().value;o&&globalThis.__VF_CLIENT_MOD_CACHE.delete(o)}globalThis.__VF_CLIENT_MOD_CACHE.set(t,e)}function Ze(t){let e=t.match(/^\\/app\\/(.+)#([A-Za-z0-9_]+)$/);return e?{rel:`/${e[1]||""}`,exportName:e[2]||"default"}:null}async function Qe(){try{let t=await fetch("/_veryfront/rsc/manifest");return t.ok?await t.json():null}catch{return null}}async function tr(t,e,o){let n=t.graphIds?.client.find(a=>a.rel===e)?.path,s=`${e}#${t.hash??""}`;try{let a=globalThis.__VF_CLIENT_MOD_CACHE?.get(s);if(a)return a}catch(a){g.debug("hydrate: cache get failed",a)}let u=C({strategy:o,rel:e,absPath:n,version:t.hash});if(!u)return null;try{let a=await import(u);try{Ke(s,a)}catch(i){g.debug("hydrate: cache set failed",i)}return a}catch(a){return g.debug("hydrate: failed to import module",{moduleUrl:u,error:a}),null}}async function rt(t=document){let e=null;try{e=await Qe()}catch(i){g.debug("hydrate: fetch manifest failed",i)}if(!e){g.debug("hydrate: no manifest");return}let o=Array.from(t.querySelectorAll("[data-client-ref]"));try{let i=globalThis.__VF_MANIFEST_HASH;if(!o.some(l=>l.dataset?.hydrated!=="true")&&i&&e.hash&&i===e.hash)return}catch(i){g.debug("hydrate: hmr hash read failed",i)}if(o.length===0){try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(i){g.debug("hydrate: set hash failed",i)}return}let n=T(I(t));try{if(globalThis.__VF_TEST_MODE__){globalThis.__VF_HYDRATE_CALLED=!0,globalThis.__VF_MANIFEST_HASH=e.hash??"";return}}catch(i){g.debug("hydrate: test mode flags failed",i)}let s=O(t),[{default:u},{createRoot:a}]=await Promise.all([import(s.react),import(s.reactDomClient)]);for(let i of o){let d=i.dataset?.clientRef??"";if(!d||i.dataset?.hydrated==="true")continue;let l=Ze(d);if(!l)continue;let m=await tr(e,l.rel,n);if(!m)continue;let x=m[l.exportName]??m.default;if(typeof x=="function")try{a(i).render(u.createElement(x,{})),i.dataset.hydrated="true"}catch(P){g.warn("hydrate: render failed",P)}}try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(i){g.debug("hydrate: set hash failed (post)",i)}}async function er(){let t=O(document),[e,o]=await Promise.all([import(t.react),import(t.reactDomClient)]);return{React:e,ReactDOM:o}}var rr=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function U(t){let e=t.getAttribute("style")??"";return t.hasAttribute("data-veryfront-head")||t.hasAttribute("hidden")||/(?:^|;)\\s*display\\s*:\\s*none(?:\\s*;|$)/i.test(e)||rr.has(t.tagName.toUpperCase())}function or(t,e){return t.find(o=>o.tagName.toUpperCase()==="DIV"&&!!o.getAttribute("class")?.trim()&&!U(o))??e}function nr(t,e){return t===e}function sr(t,e){let o=document.createElement("div");o.setAttribute("data-veryfront-hydration-root","page");let n=t.find(s=>!U(s));n?.parentNode===e?e.insertBefore(o,n):e.appendChild(o);for(let s of t)!U(s)&&s.parentNode===e&&o.appendChild(s);return o}function ir(t,e,o=document){return!!e?.pagePath&&typeof t?.__veryfrontRenderPage=="function"&&!!o.getElementById("root")}function ar(t,e){return e?.pagePath?!1:!!t.getElementById(_)}function cr(t=import.meta.url){try{return new URL(t,"http://veryfront.local").searchParams.get("hydrate")==="1"}catch{return!1}}function lr(t){return t==="rsc-module"}async function ur(t){try{let e=await fetch(y+"stream"+t);if(!e.ok||!e.body)return!1;let o=new AbortController;return addEventListener("pagehide",()=>o.abort(),{once:!0}),await et(e,document,o.signal),!0}catch(e){return console.debug?.("[RSC] tryStream failed",e),!1}}async function N(){try{await rt(document)}catch(t){console.debug?.("[RSC] hydration failed",t)}}async function gr(t,e){try{let{React:o,ReactDOM:n}=await er(),s=C({strategy:e,rel:t});if(!s)return!1;console.debug?.("[RSC] Loading component from:",s);let a=(await import(s)).default;if(typeof a!="function")return console.debug?.("[RSC] Page component is not a function"),!1;let i=Array.from(document.body.children),d=or(i,document.body),l=nr(d,document.body)?sr(i,document.body):d,m=o.createElement(a,{});return lr(e)?n.createRoot(l).render(m):n.hydrateRoot(l,m,{identifierPrefix:"vf",onRecoverableError:()=>{}}),console.debug?.("[RSC] Page component hydrated successfully"),!0}catch(o){return console.error("[RSC] Page hydration failed",o),!1}}async function dr(t){try{let e=await fetch(y+"payload"+t);if(!e.ok)return!1;let o=await e.json();if(o?.slots){for(let[n,s]of Object.entries(o.slots))S(document,n).innerHTML=h(String(s||""));return!0}return S(document,_).innerHTML=h(String(o?.html||"")),!0}catch(e){return console.debug?.("[RSC] payload fetch failed",e),!1}}async function pr(){try{let t=globalThis.window?.location.search??"",e=I(document);if(cr()){await N();return}let o=e?.pagePath,n=T(e);if(o){if(ir(globalThis.window,e,document)){console.debug?.("[RSC] Page renderer owns hydration");return}console.debug?.("[RSC] Found page component in hydration data:",o),await gr(o,n)&&console.debug?.("[RSC] Client component hydrated successfully");return}if(!ar(document,e))return;if(await ur(t)){await N();return}if(await dr(t)){await N();return}await N()}catch(t){console.error("[RSC] boot failed",t)}}if(typeof document<"u"){let t=()=>{pr()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}export{pr as boot,or as selectHydrationRoot,ar as shouldAttemptRSCTransport,cr as shouldHydrateOnly,lr as shouldRenderPageComponent,ir as shouldUsePageRendererHydration,nr as shouldWrapPageHydrationRoot};\n';
|
|
8
|
+
export const CLIENT_BOOT_BUNDLE = 'var at=Object.defineProperty;var ct=(t,e,r)=>e in t?at(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>ct(t,typeof e!="symbol"?e+"":e,r);var lt="3.2.3";function ut(t,e,r,n){let s=[];if(n?.external?.length&&s.push(`external=${n.external.join(",")}`),s.push(`target=${n?.target??"es2022"}`),n?.deps){let a=Object.entries(n.deps).map(([u,m])=>`${u}@${m}`).join(",");s.push(`deps=${a}`)}let l=e?`@${e}`:"",i=r??"",g=s.length?`?${s.join("&")}`:"";return`https://esm.sh/${t}${l}${i}${g}`}function f(t,e,r,n=!1){return ut(t,e,r,{external:n?["react"]:void 0,deps:{csstype:lt}})}var dt="19.2.4",y=dt;function F(t=y){return{react:f("react",t),"react-dom":f("react-dom",t,void 0,!0),"react-dom/client":f("react-dom",t,"/client",!0),"react-dom/server":f("react-dom",t,"/server",!0),"react/jsx-runtime":f("react",t,"/jsx-runtime",!0),"react/jsx-dev-runtime":f("react",t,"/jsx-dev-runtime",!0)}}function $(t=y){return F(t).react}function k(t=y){return F(t)["react-dom/client"]}function pt(t){return t.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function M(t){return pt(btoa(t))}var Dr=Object.freeze({react:"","react-dom":"","react-dom/client":"","react-dom/server":"","react/jsx-runtime":"","react/jsx-dev-runtime":""});function I(t,e){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t))return!0;for(let r of Object.keys(e))if(r.endsWith("/")&&t.startsWith(r))return!0;return!1}function mt(t){try{return JSON.parse(t)?.imports??{}}catch{return{}}}function L(t=document){let e=t.querySelector(\'script[type="importmap"]\');return e?.textContent?mt(e.textContent):{}}var c="/_veryfront",U={RSC:`${c}/rsc/`,FS:`${c}/fs/`,MODULES:`${c}/modules/`,PAGES:`${c}/pages/`,DATA:`${c}/data/`,LIB:`${c}/lib/`,CHUNKS:`${c}/chunks/`,CLIENT:`${c}/client/`},G={HMR_RUNTIME:`${c}/hmr-runtime.js`,HMR:`${c}/hmr.js`,ERROR_OVERLAY:`${c}/error-overlay.js`,DEV_LOADER:`${c}/dev-loader.js`,CLIENT_LOG:`${c}/log`,CLIENT_JS:`${c}/client.js`,ROUTER_JS:`${c}/router.js`,PREFETCH_JS:`${c}/prefetch.js`,MANIFEST_JSON:`${c}/manifest.json`,APP_JS:`${c}/app.js`,RSC_CLIENT:`${c}/rsc/client.js`,RSC_MANIFEST:`${c}/rsc/manifest`,RSC_STREAM:`${c}/rsc/stream`,RSC_PAYLOAD:`${c}/rsc/payload`,RSC_RENDER:`${c}/rsc/render`,RSC_PAGE:`${c}/rsc/page`,RSC_MODULE:`${c}/rsc/module`,RSC_DOM:`${c}/rsc/dom.js`,LIB_CHAT_REACT:`${c}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${c}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${c}/lib/chat/primitives.js`};var Rt={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},Ur=Rt.CACHE;var Pr={HMR_RUNTIME:G.HMR_RUNTIME,ERROR_OVERLAY:G.ERROR_OVERLAY};var _=U.RSC,Y=U.FS,B="veryfront-hydration-data",h="rsc-root";function S(t=document){try{let e=t.getElementById(B);return e?JSON.parse(e.textContent||"{}"):null}catch(e){return console.debug?.("[RSC] hydration data parse failed",e),null}}function C(t){return t?.clientModuleStrategy?t.clientModuleStrategy:t?.dev?"fs":"rsc-module"}function Et(t){return`${Y}${M(t)}.js`}function yt(t,e){let r=e?`&v=${encodeURIComponent(e)}`:"";return`${_}module?rel=${encodeURIComponent(t)}${r}`}function O(t){if(t.strategy==="fs"){let e=t.absPath??t.rel;return e?Et(e):null}return yt(t.rel,t.version)}function A(t=document,e=y){let r=L(t);return{react:I("react",r)?"react":$(e),reactDomClient:I("react-dom/client",r)?"react-dom/client":k(e)}}function j(t=document){let e=L(t);return I("veryfront/router",e)?"veryfront/router":null}function o(t){return{...t,create(e){return new P(e?.message||e?.detail||t.title,{slug:t.slug,category:t.category,status:e?.status??t.status,title:t.title,suggestion:t.suggestion,detail:e?.detail,cause:e?.cause,instance:e?.instance,context:e?.context})}}}var P=class extends Error{constructor(r,n){super(r);p(this,"slug");p(this,"category");p(this,"status");p(this,"title");p(this,"suggestion");p(this,"detail");p(this,"cause");p(this,"instance");p(this,"context");this.name="VeryfrontError",this.slug=n.slug,this.category=n.category,this.status=n.status,this.title=n.title,this.suggestion=n.suggestion,this.detail=n.detail,this.cause=n.cause,this.instance=n.instance,this.context=n.context}toRFC9457(){return{type:`https://veryfront.com/docs/errors/${this.slug}`,title:this.title,status:this.status,detail:this.detail,instance:this.instance,category:this.category,suggestion:this.suggestion,cause:typeof this.cause=="string"?this.cause:void 0}}getDocsUrl(){return`https://veryfront.com/docs/errors/${this.slug}`}};var _t=o({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),ht=o({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),St=o({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),xt=o({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),Tt=o({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),It=o({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),Ct=o({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),Ot=o({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),W={"config-not-found":_t,"config-invalid":ht,"config-parse-error":St,"config-validation-error":xt,"config-type-error":Tt,"import-map-invalid":It,"cors-config-invalid":Ct,"config-validation-failed":Ot};var At=o({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),Nt=o({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),Dt=o({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),vt=o({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),bt=o({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),Mt=o({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),Lt=o({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),Ut=o({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),q={"build-failed":At,"bundle-error":Nt,"typescript-error":Dt,"mdx-compile-error":vt,"asset-optimization-error":bt,"ssg-generation-error":Mt,"sourcemap-error":Lt,"compilation-error":Ut};var Pt=o({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),wt=o({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),Ht=o({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),Vt=o({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),Ft=o({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),$t=o({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),kt=o({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),z={"hydration-mismatch":Pt,"render-error":wt,"component-error":Ht,"layout-not-found":Vt,"page-not-found":Ft,"api-error":$t,"middleware-error":kt};var Gt=o({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),Yt=o({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),Bt=o({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),jt=o({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),Wt=o({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),qt=o({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),X={"route-conflict":Gt,"invalid-route-file":Yt,"route-handler-invalid":Bt,"dynamic-route-error":jt,"route-params-error":Wt,"api-route-error":qt};var zt=o({slug:"module-not-found",category:"MODULE",status:404,title:"Module could not be resolved",suggestion:"Check the import path and ensure the module is installed"}),Xt=o({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),Jt=o({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),Kt=o({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),Zt=o({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Qt=o({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),J={"module-not-found":zt,"import-resolution-error":Xt,"circular-dependency":Jt,"invalid-import":Kt,"dependency-missing":Zt,"version-mismatch":Qt};var te=o({slug:"port-in-use",category:"SERVER",status:409,title:"Server port already in use",suggestion:"Use a different port or stop the process using this port"}),ee=o({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),re=o({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),oe=o({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),ne=o({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),se=o({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),ie=o({slug:"semaphore-timeout",category:"SERVER",status:503,title:"Semaphore acquire timeout",suggestion:"Reduce concurrency or increase the semaphore acquire timeout"}),ae=o({slug:"circuit-breaker-open",category:"SERVER",status:503,title:"Circuit breaker is open",suggestion:"Wait for the breaker reset timeout before retrying"}),ce=o({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),le=o({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),ue=o({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),ge=o({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),de=o({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),pe=o({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),me=o({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),K={"port-in-use":te,"server-start-error":ee,"cache-error":re,"file-watch-error":oe,"request-error":ne,"service-overloaded":se,"semaphore-timeout":ie,"circuit-breaker-open":ae,"cache-path-mismatch":ce,"network-error":le,"api-client-error":ue,"token-storage-error":ge,"cache-invariant-violation":de,"release-not-found":pe,"fallback-exhausted":me};var fe=o({slug:"client-boundary-violation",category:"BOUNDARY",status:400,title:"Client boundary rule violation",suggestion:"Add \'use client\' directive or move code to a client component"}),Re=o({slug:"server-only-in-client",category:"BOUNDARY",status:400,title:"Server-only code in client component",suggestion:"Move server-only code to a server component"}),Ee=o({slug:"client-only-in-server",category:"BOUNDARY",status:400,title:"Client-only code in server component",suggestion:"Move client-only code to a client component"}),ye=o({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),_e=o({slug:"invalid-use-server",category:"BOUNDARY",status:400,title:"Invalid \'use server\' directive",suggestion:"Place \'use server\' at the top of the file or function"}),he=o({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),Z={"client-boundary-violation":fe,"server-only-in-client":Re,"client-only-in-server":Ee,"invalid-use-client":ye,"invalid-use-server":_e,"rsc-payload-error":he};var Se=o({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),xe=o({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),Te=o({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),Ie=o({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),Ce=o({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),Q={"hmr-error":Se,"dev-server-error":xe,"fast-refresh-error":Te,"error-overlay-error":Ie,"source-map-error":Ce};var Oe=o({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),Ae=o({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),Ne=o({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),De=o({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),tt={"deployment-error":Oe,"platform-error":Ae,"env-var-missing":Ne,"production-build-required":De};var ve=o({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),be=o({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),Me=o({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),Le=o({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),Ue=o({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),Pe=o({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),we=o({slug:"tool-id-conflict",category:"AGENT",status:409,title:"Tool ID conflict",suggestion:"Use a unique tool ID or rename one of the conflicting tools"}),et={"agent-error":ve,"agent-not-found":be,"agent-timeout":Me,"agent-intent-error":Le,"orchestration-error":Ue,"cost-limit-exceeded":Pe,"tool-id-conflict":we};var He=o({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),Ve=o({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),Fe=o({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),$e=o({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),ke=o({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),Ge=o({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),Ye=o({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),Be=o({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),w=o({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),je=o({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"}),rt={"unknown-error":He,"permission-denied":Ve,"file-not-found":Fe,"resource-not-found":$e,"invalid-argument":ke,"timeout-error":Ge,"initialization-error":Ye,"not-supported":Be,"security-violation":w,"input-validation-failed":je};var Lo={...W,...q,...z,...X,...J,...K,...Z,...Q,...tt,...et,...rt};var We=[{source:String.raw`<script[^>]*>[\\s\\S]*?<\\/script>`,flags:"gi",name:"inline script"},{source:String.raw`javascript:`,flags:"gi",name:"javascript: URL"},{source:String.raw`\\bon\\w+\\s*=`,flags:"gi",name:"event handler attribute"},{source:String.raw`data:\\s*text\\/html`,flags:"gi",name:"data: HTML URL"}];function qe(){return We.map(({source:t,flags:e,name:r})=>({pattern:new RegExp(t,e),name:r}))}function ze(){let t=globalThis;return t.__VERYFRONT_DEV__===!0||t.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function x(t,e={}){let{allowInlineScripts:r=!1,strict:n=!1,warn:s=!0}=e;for(let{pattern:l,name:i}of qe())if(!(r&&i==="inline script")&&(l.lastIndex=0,!!l.test(t)&&(s&&console.warn(`[Security] Suspicious ${i} detected in server HTML`),n||!ze())))throw w.create({detail:`Potentially unsafe HTML: ${i} detected`});return t}var R=class{constructor(e,r){p(this,"prefix",e);p(this,"level",r)}log(e,r,n,...s){this.level>e||r?.(n,...s)}debug(e,...r){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${e}`,...r)}info(e,...r){this.log(1,console.log,`[${this.prefix}] ${e}`,...r)}warn(e,...r){this.log(2,console.warn,`[${this.prefix}] WARN: ${e}`,...r)}error(e,...r){this.log(3,console.error,`[${this.prefix}] ERROR: ${e}`,...r)}};function Xe(){if(typeof window>"u")return 2;let t=globalThis;return t.__VERYFRONT_DEV__||t.__RSC_DEV__?t.__VERYFRONT_DEBUG__||t.__RSC_DEBUG__?0:1:2}var N=Xe(),d=new R("RSC",N),Jo=new R("PREFETCH",N),Ko=new R("HYDRATE",N),Zo=new R("VERYFRONT",N);function T(t,e){let r=e==="root"?h:`rsc-slot-${e}`,n=t.getElementById(r);if(n)return n;let s=t.createElement("div");return s.id=r,t.body.appendChild(s),s}function Je(t,e){if(e.type!=="slot")return;let r=T(t,e.id);r.innerHTML=x(String(e.html??""))}function ot(t,e){let r=e.split(`\n`),n=r.pop()??"";for(let s of r){let l=s.trim();if(!l)continue;let i;try{i=JSON.parse(l)}catch(a){d.debug("[client-dom] malformed NDJSON line",{line:l,error:a instanceof Error?a.message:String(a)});continue}if(!i||typeof i!="object")continue;let g=i;if(g.type==="slot"){Je(t,g);try{Qe(t,g.id||"root")}catch(a){d.debug("[client-dom] hydration optional failed",a)}}}return n}function Ke(t){return new Promise((e,r)=>{let n=()=>r(new DOMException("aborted","AbortError"));if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0})})}async function nt(t,e=document,r){let n="body"in t?t:null,s=n?.body??t;if(!s)return;let l=s.getReader(),i=new TextDecoder,g="",a=!1;try{for(;;){if(r?.aborted)throw new DOMException("aborted","AbortError");let u=l.read(),{done:m,value:E}=r?await Promise.race([u,Ke(r)]):await u;if(m){a=!0;break}g+=i.decode(E,{stream:!0}),g=ot(e,g)}g&&ot(e,`${g}\n`)}catch(u){throw u instanceof Error&&u.name==="AbortError"||d.debug("[client-dom] consumeNdjsonStream error",u),u}finally{try{await l.cancel()}catch(u){a||d.debug("[client-dom] reader.cancel failed",u)}try{l.releaseLock()}catch(u){d.debug("[client-dom] reader.releaseLock failed",u)}if(typeof s.cancel=="function")try{await s.cancel()}catch(u){d.debug("[client-dom] stream.cancel failed",u)}if(typeof n?.body?.cancel=="function")try{await n.body.cancel()}catch(u){d.debug("[client-dom] response.body.cancel failed",u)}}}function Ze(t,e){let r=T(t,e),n=[],s=l=>{let i=l;i.dataset?.clientRef&&n.push(i);for(let g of l.children)s(g)};return s(r),n}function Qe(t,e){let r=Ze(t,e);for(let n of r){let s=n.dataset?.clientRef;s&&(n.dataset.hydrated="true",d.debug("[client-dom] marked for hydration",s))}}function tr(t){if(!t)return{};let e={};for(let[r,n]of Object.entries(t))e[r]=Array.isArray(n)?n.join("/"):n;return e}async function D(t,e,r=document){try{let n=j(r);if(!n)return t;let l=(await import(n)).wrapForHydration;return typeof l!="function"?t:l(t,{params:tr(e?.params),frontmatter:e?.frontmatter??{}})}catch(n){return console.debug?.("[RSC] router provider wrap failed",n),t}}var er=100;function rr(t,e){if(globalThis.__VF_CLIENT_MOD_CACHE??(globalThis.__VF_CLIENT_MOD_CACHE=new Map),globalThis.__VF_CLIENT_MOD_CACHE.size>=er){let r=globalThis.__VF_CLIENT_MOD_CACHE.keys().next().value;r&&globalThis.__VF_CLIENT_MOD_CACHE.delete(r)}globalThis.__VF_CLIENT_MOD_CACHE.set(t,e)}function or(t){let e=t.match(/^\\/app\\/(.+)#([A-Za-z0-9_]+)$/);return e?{rel:`/${e[1]||""}`,exportName:e[2]||"default"}:null}async function nr(){try{let t=await fetch("/_veryfront/rsc/manifest");return t.ok?await t.json():null}catch{return null}}async function sr(t,e,r){let n=t.graphIds?.client.find(i=>i.rel===e)?.path,s=`${e}#${t.hash??""}`;try{let i=globalThis.__VF_CLIENT_MOD_CACHE?.get(s);if(i)return i}catch(i){d.debug("hydrate: cache get failed",i)}let l=O({strategy:r,rel:e,absPath:n,version:t.hash});if(!l)return null;try{let i=await import(l);try{rr(s,i)}catch(g){d.debug("hydrate: cache set failed",g)}return i}catch(i){return d.debug("hydrate: failed to import module",{moduleUrl:l,error:i}),null}}async function st(t=document){let e=null;try{e=await nr()}catch(a){d.debug("hydrate: fetch manifest failed",a)}if(!e){d.debug("hydrate: no manifest");return}let r=Array.from(t.querySelectorAll("[data-client-ref]"));try{let a=globalThis.__VF_MANIFEST_HASH;if(!r.some(m=>m.dataset?.hydrated!=="true")&&a&&e.hash&&a===e.hash)return}catch(a){d.debug("hydrate: hmr hash read failed",a)}if(r.length===0){try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(a){d.debug("hydrate: set hash failed",a)}return}let n=S(t),s=C(n);try{if(globalThis.__VF_TEST_MODE__){globalThis.__VF_HYDRATE_CALLED=!0,globalThis.__VF_MANIFEST_HASH=e.hash??"";return}}catch(a){d.debug("hydrate: test mode flags failed",a)}let l=A(t),[{default:i},{createRoot:g}]=await Promise.all([import(l.react),import(l.reactDomClient)]);for(let a of r){let u=a.dataset?.clientRef??"";if(!u||a.dataset?.hydrated==="true")continue;let m=or(u);if(!m)continue;let E=await sr(e,m.rel,s);if(!E)continue;let V=E[m.exportName]??E.default;if(typeof V=="function")try{let b=g(a),it=await D(i.createElement(V,{}),n,t);b.render(it),a.dataset.hydrated="true"}catch(b){d.warn("hydrate: render failed",b)}}try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(a){d.debug("hydrate: set hash failed (post)",a)}}async function ir(){let t=A(document),[e,r]=await Promise.all([import(t.react),import(t.reactDomClient)]);return{React:e,ReactDOM:r}}var ar=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function H(t){let e=t.getAttribute("style")??"";return t.hasAttribute("data-veryfront-head")||t.hasAttribute("hidden")||/(?:^|;)\\s*display\\s*:\\s*none(?:\\s*;|$)/i.test(e)||ar.has(t.tagName.toUpperCase())}function cr(t,e){return t.find(r=>r.tagName.toUpperCase()==="DIV"&&!!r.getAttribute("class")?.trim()&&!H(r))??e}function lr(t,e){return t===e}function ur(t,e){let r=document.createElement("div");r.setAttribute("data-veryfront-hydration-root","page");let n=t.find(s=>!H(s));n?.parentNode===e?e.insertBefore(r,n):e.appendChild(r);for(let s of t)!H(s)&&s.parentNode===e&&r.appendChild(s);return r}function gr(t,e,r=document){return!!e?.pagePath&&typeof t?.__veryfrontRenderPage=="function"&&!!r.getElementById("root")}function dr(t,e){return e?.pagePath?!1:!!t.getElementById(h)}function pr(t=import.meta.url){try{return new URL(t,"http://veryfront.local").searchParams.get("hydrate")==="1"}catch{return!1}}function mr(t){return t==="rsc-module"}async function fr(t){try{let e=await fetch(_+"stream"+t);if(!e.ok||!e.body)return!1;let r=new AbortController;return addEventListener("pagehide",()=>r.abort(),{once:!0}),await nt(e,document,r.signal),!0}catch(e){return console.debug?.("[RSC] tryStream failed",e),!1}}async function v(){try{await st(document)}catch(t){console.debug?.("[RSC] hydration failed",t)}}async function Rr(t,e){try{let{React:r,ReactDOM:n}=await ir(),s=O({strategy:e,rel:t});if(!s)return!1;console.debug?.("[RSC] Loading component from:",s);let i=(await import(s)).default;if(typeof i!="function")return console.debug?.("[RSC] Page component is not a function"),!1;let g=Array.from(document.body.children),a=cr(g,document.body),u=lr(a,document.body)?ur(g,document.body):a,m=await D(r.createElement(i,{}),S(document));return mr(e)?n.createRoot(u).render(m):n.hydrateRoot(u,m,{identifierPrefix:"vf",onRecoverableError:()=>{}}),console.debug?.("[RSC] Page component hydrated successfully"),!0}catch(r){return console.error("[RSC] Page hydration failed",r),!1}}async function Er(t){try{let e=await fetch(_+"payload"+t);if(!e.ok)return!1;let r=await e.json();if(r?.slots){for(let[n,s]of Object.entries(r.slots))T(document,n).innerHTML=x(String(s||""));return!0}return T(document,h).innerHTML=x(String(r?.html||"")),!0}catch(e){return console.debug?.("[RSC] payload fetch failed",e),!1}}async function yr(){try{let t=globalThis.window?.location.search??"",e=S(document);if(pr()){await v();return}let r=e?.pagePath,n=C(e);if(r){if(gr(globalThis.window,e,document)){console.debug?.("[RSC] Page renderer owns hydration");return}console.debug?.("[RSC] Found page component in hydration data:",r),await Rr(r,n)&&console.debug?.("[RSC] Client component hydrated successfully");return}if(!dr(document,e))return;if(await fr(t)){await v();return}if(await Er(t)){await v();return}await v()}catch(t){console.error("[RSC] boot failed",t)}}if(typeof document<"u"){let t=()=>{yr()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}export{yr as boot,cr as selectHydrationRoot,dr as shouldAttemptRSCTransport,pr as shouldHydrateOnly,mr as shouldRenderPageComponent,gr as shouldUsePageRendererHydration,lr as shouldWrapPageHydrationRoot};\n';
|
|
9
9
|
export const CLIENT_DOM_BUNDLE = 'var G=Object.defineProperty;var w=(r,t,o)=>t in r?G(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var l=(r,t,o)=>w(r,typeof t!="symbol"?t+"":t,o);function e(r){return{...r,create(t){return new f(t?.message||t?.detail||r.title,{slug:r.slug,category:r.category,status:t?.status??r.status,title:r.title,suggestion:r.suggestion,detail:t?.detail,cause:t?.cause,instance:t?.instance,context:t?.context})}}}var f=class extends Error{constructor(o,n){super(o);l(this,"slug");l(this,"category");l(this,"status");l(this,"title");l(this,"suggestion");l(this,"detail");l(this,"cause");l(this,"instance");l(this,"context");this.name="VeryfrontError",this.slug=n.slug,this.category=n.category,this.status=n.status,this.title=n.title,this.suggestion=n.suggestion,this.detail=n.detail,this.cause=n.cause,this.instance=n.instance,this.context=n.context}toRFC9457(){return{type:`https://veryfront.com/docs/errors/${this.slug}`,title:this.title,status:this.status,detail:this.detail,instance:this.instance,category:this.category,suggestion:this.suggestion,cause:typeof this.cause=="string"?this.cause:void 0}}getDocsUrl(){return`https://veryfront.com/docs/errors/${this.slug}`}};var F=e({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),k=e({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),Y=e({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),H=e({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),B=e({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),$=e({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),j=e({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),q=e({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),y={"config-not-found":F,"config-invalid":k,"config-parse-error":Y,"config-validation-error":H,"config-type-error":B,"import-map-invalid":$,"cors-config-invalid":j,"config-validation-failed":q};var z=e({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),W=e({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),J=e({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),X=e({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),K=e({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),Z=e({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),Q=e({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),ee=e({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),O={"build-failed":z,"bundle-error":W,"typescript-error":J,"mdx-compile-error":X,"asset-optimization-error":K,"ssg-generation-error":Z,"sourcemap-error":Q,"compilation-error":ee};var te=e({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),re=e({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),oe=e({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),ne=e({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),se=e({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),ie=e({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),ae=e({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),I={"hydration-mismatch":te,"render-error":re,"component-error":oe,"layout-not-found":ne,"page-not-found":se,"api-error":ie,"middleware-error":ae};var ce=e({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),ue=e({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),le=e({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),ge=e({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),pe=e({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),Ee=e({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),T={"route-conflict":ce,"invalid-route-file":ue,"route-handler-invalid":le,"dynamic-route-error":ge,"route-params-error":pe,"api-route-error":Ee};var de=e({slug:"module-not-found",category:"MODULE",status:404,title:"Module could not be resolved",suggestion:"Check the import path and ensure the module is installed"}),Re=e({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),fe=e({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),me=e({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),_e=e({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),ye=e({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),x={"module-not-found":de,"import-resolution-error":Re,"circular-dependency":fe,"invalid-import":me,"dependency-missing":_e,"version-mismatch":ye};var Oe=e({slug:"port-in-use",category:"SERVER",status:409,title:"Server port already in use",suggestion:"Use a different port or stop the process using this port"}),Ie=e({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),Te=e({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),xe=e({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),Se=e({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),he=e({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),Ne=e({slug:"semaphore-timeout",category:"SERVER",status:503,title:"Semaphore acquire timeout",suggestion:"Reduce concurrency or increase the semaphore acquire timeout"}),Ae=e({slug:"circuit-breaker-open",category:"SERVER",status:503,title:"Circuit breaker is open",suggestion:"Wait for the breaker reset timeout before retrying"}),ve=e({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),Ce=e({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),De=e({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Le=e({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),Ue=e({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),be=e({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),Me=e({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),S={"port-in-use":Oe,"server-start-error":Ie,"cache-error":Te,"file-watch-error":xe,"request-error":Se,"service-overloaded":he,"semaphore-timeout":Ne,"circuit-breaker-open":Ae,"cache-path-mismatch":ve,"network-error":Ce,"api-client-error":De,"token-storage-error":Le,"cache-invariant-violation":Ue,"release-not-found":be,"fallback-exhausted":Me};var Pe=e({slug:"client-boundary-violation",category:"BOUNDARY",status:400,title:"Client boundary rule violation",suggestion:"Add \'use client\' directive or move code to a client component"}),Ve=e({slug:"server-only-in-client",category:"BOUNDARY",status:400,title:"Server-only code in client component",suggestion:"Move server-only code to a server component"}),Ge=e({slug:"client-only-in-server",category:"BOUNDARY",status:400,title:"Client-only code in server component",suggestion:"Move client-only code to a client component"}),we=e({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),Fe=e({slug:"invalid-use-server",category:"BOUNDARY",status:400,title:"Invalid \'use server\' directive",suggestion:"Place \'use server\' at the top of the file or function"}),ke=e({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),h={"client-boundary-violation":Pe,"server-only-in-client":Ve,"client-only-in-server":Ge,"invalid-use-client":we,"invalid-use-server":Fe,"rsc-payload-error":ke};var Ye=e({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),He=e({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),Be=e({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),$e=e({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),je=e({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),N={"hmr-error":Ye,"dev-server-error":He,"fast-refresh-error":Be,"error-overlay-error":$e,"source-map-error":je};var qe=e({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),ze=e({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),We=e({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),Je=e({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),A={"deployment-error":qe,"platform-error":ze,"env-var-missing":We,"production-build-required":Je};var Xe=e({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),Ke=e({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),Ze=e({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),Qe=e({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),et=e({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),tt=e({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),rt=e({slug:"tool-id-conflict",category:"AGENT",status:409,title:"Tool ID conflict",suggestion:"Use a unique tool ID or rename one of the conflicting tools"}),v={"agent-error":Xe,"agent-not-found":Ke,"agent-timeout":Ze,"agent-intent-error":Qe,"orchestration-error":et,"cost-limit-exceeded":tt,"tool-id-conflict":rt};var ot=e({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),nt=e({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),st=e({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),it=e({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),at=e({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),ct=e({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),ut=e({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),lt=e({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),m=e({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),gt=e({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"}),C={"unknown-error":ot,"permission-denied":nt,"file-not-found":st,"resource-not-found":it,"invalid-argument":at,"timeout-error":ct,"initialization-error":ut,"not-supported":lt,"security-violation":m,"input-validation-failed":gt};var lr={...y,...O,...I,...T,...x,...S,...h,...N,...A,...v,...C};var pt=[{source:String.raw`<script[^>]*>[\\s\\S]*?<\\/script>`,flags:"gi",name:"inline script"},{source:String.raw`javascript:`,flags:"gi",name:"javascript: URL"},{source:String.raw`\\bon\\w+\\s*=`,flags:"gi",name:"event handler attribute"},{source:String.raw`data:\\s*text\\/html`,flags:"gi",name:"data: HTML URL"}];function Et(){return pt.map(({source:r,flags:t,name:o})=>({pattern:new RegExp(r,t),name:o}))}function dt(){let r=globalThis;return r.__VERYFRONT_DEV__===!0||r.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function D(r,t={}){let{allowInlineScripts:o=!1,strict:n=!1,warn:i=!0}=t;for(let{pattern:c,name:u}of Et())if(!(o&&u==="inline script")&&(c.lastIndex=0,!!c.test(r)&&(i&&console.warn(`[Security] Suspicious ${u} detected in server HTML`),n||!dt())))throw m.create({detail:`Potentially unsafe HTML: ${u} detected`});return r}var d=class{constructor(t,o){l(this,"prefix",t);l(this,"level",o)}log(t,o,n,...i){this.level>t||o?.(n,...i)}debug(t,...o){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${t}`,...o)}info(t,...o){this.log(1,console.log,`[${this.prefix}] ${t}`,...o)}warn(t,...o){this.log(2,console.warn,`[${this.prefix}] WARN: ${t}`,...o)}error(t,...o){this.log(3,console.error,`[${this.prefix}] ERROR: ${t}`,...o)}};function Rt(){if(typeof window>"u")return 2;let r=globalThis;return r.__VERYFRONT_DEV__||r.__RSC_DEV__?r.__VERYFRONT_DEBUG__||r.__RSC_DEBUG__?0:1:2}var R=Rt(),p=new d("RSC",R),Ar=new d("PREFETCH",R),vr=new d("HYDRATE",R),Cr=new d("VERYFRONT",R);var s="/_veryfront",_={RSC:`${s}/rsc/`,FS:`${s}/fs/`,MODULES:`${s}/modules/`,PAGES:`${s}/pages/`,DATA:`${s}/data/`,LIB:`${s}/lib/`,CHUNKS:`${s}/chunks/`,CLIENT:`${s}/client/`},L={HMR_RUNTIME:`${s}/hmr-runtime.js`,HMR:`${s}/hmr.js`,ERROR_OVERLAY:`${s}/error-overlay.js`,DEV_LOADER:`${s}/dev-loader.js`,CLIENT_LOG:`${s}/log`,CLIENT_JS:`${s}/client.js`,ROUTER_JS:`${s}/router.js`,PREFETCH_JS:`${s}/prefetch.js`,MANIFEST_JSON:`${s}/manifest.json`,APP_JS:`${s}/app.js`,RSC_CLIENT:`${s}/rsc/client.js`,RSC_MANIFEST:`${s}/rsc/manifest`,RSC_STREAM:`${s}/rsc/stream`,RSC_PAYLOAD:`${s}/rsc/payload`,RSC_RENDER:`${s}/rsc/render`,RSC_PAGE:`${s}/rsc/page`,RSC_MODULE:`${s}/rsc/module`,RSC_DOM:`${s}/rsc/dom.js`,LIB_CHAT_REACT:`${s}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${s}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${s}/lib/chat/primitives.js`};var mt={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},Pr=mt.CACHE;var Vr={HMR_RUNTIME:L.HMR_RUNTIME,ERROR_OVERLAY:L.ERROR_OVERLAY};var kr=_.RSC,Yr=_.FS;var U="rsc-root";function M(r,t){let o=t==="root"?U:`rsc-slot-${t}`,n=r.getElementById(o);if(n)return n;let i=r.createElement("div");return i.id=o,r.body.appendChild(i),i}function _t(r,t){if(t.type!=="slot")return;let o=M(r,t.id);o.innerHTML=D(String(t.html??""))}function b(r,t){let o=t.split(`\n`),n=o.pop()??"";for(let i of o){let c=i.trim();if(!c)continue;let u;try{u=JSON.parse(c)}catch(E){p.debug("[client-dom] malformed NDJSON line",{line:c,error:E instanceof Error?E.message:String(E)});continue}if(!u||typeof u!="object")continue;let g=u;if(g.type==="slot"){_t(r,g);try{It(r,g.id||"root")}catch(E){p.debug("[client-dom] hydration optional failed",E)}}}return n}function yt(r){return new Promise((t,o)=>{let n=()=>o(new DOMException("aborted","AbortError"));if(r.aborted){n();return}r.addEventListener("abort",n,{once:!0})})}async function qr(r,t=document,o){let n="body"in r?r:null,i=n?.body??r;if(!i)return;let c=i.getReader(),u=new TextDecoder,g="",E=!1;try{for(;;){if(o?.aborted)throw new DOMException("aborted","AbortError");let a=c.read(),{done:P,value:V}=o?await Promise.race([a,yt(o)]):await a;if(P){E=!0;break}g+=u.decode(V,{stream:!0}),g=b(t,g)}g&&b(t,`${g}\n`)}catch(a){throw a instanceof Error&&a.name==="AbortError"||p.debug("[client-dom] consumeNdjsonStream error",a),a}finally{try{await c.cancel()}catch(a){E||p.debug("[client-dom] reader.cancel failed",a)}try{c.releaseLock()}catch(a){p.debug("[client-dom] reader.releaseLock failed",a)}if(typeof i.cancel=="function")try{await i.cancel()}catch(a){p.debug("[client-dom] stream.cancel failed",a)}if(typeof n?.body?.cancel=="function")try{await n.body.cancel()}catch(a){p.debug("[client-dom] response.body.cancel failed",a)}}}function Ot(r,t){let o=M(r,t),n=[],i=c=>{let u=c;u.dataset?.clientRef&&n.push(u);for(let g of c.children)i(g)};return i(o),n}function It(r,t){let o=Ot(r,t);for(let n of o){let i=n.dataset?.clientRef;i&&(n.dataset.hydrated="true",p.debug("[client-dom] marked for hydration",i))}}export{qr as consumeNdjsonStream,M as getContainer};\n';
|