@qwik.dev/router 2.0.0-beta.10 → 2.0.0-beta.11

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.
Files changed (36) hide show
  1. package/lib/adapters/azure-swa/vite/index.cjs +2 -2
  2. package/lib/adapters/azure-swa/vite/index.mjs +73 -69
  3. package/lib/adapters/bun-server/vite/index.cjs +2 -2
  4. package/lib/adapters/bun-server/vite/index.mjs +77 -73
  5. package/lib/adapters/cloud-run/vite/index.cjs +2 -2
  6. package/lib/adapters/cloud-run/vite/index.mjs +104 -100
  7. package/lib/adapters/cloudflare-pages/vite/{index-DwovcBp3.js → index-Bg_9YkM5.js} +1 -1
  8. package/lib/adapters/cloudflare-pages/vite/{index-C455V8_A.cjs → index-C1aDmh1S.cjs} +1 -1
  9. package/lib/adapters/cloudflare-pages/vite/index-CHT9Y93A.js +254 -0
  10. package/lib/adapters/cloudflare-pages/vite/{index-DKcVHRBy.cjs → index-Ck7KvpK1.cjs} +1 -1
  11. package/lib/adapters/cloudflare-pages/vite/{index-D3HITboM.js → index-Cp1cjAds.js} +1 -1
  12. package/lib/adapters/cloudflare-pages/vite/index-D9RL9dvJ.cjs +5 -0
  13. package/lib/adapters/cloudflare-pages/vite/index.cjs +1 -1
  14. package/lib/adapters/cloudflare-pages/vite/index.mjs +1 -1
  15. package/lib/adapters/deno-server/vite/index.cjs +2 -2
  16. package/lib/adapters/deno-server/vite/index.mjs +81 -77
  17. package/lib/adapters/netlify-edge/vite/index.cjs +3 -3
  18. package/lib/adapters/netlify-edge/vite/index.mjs +119 -115
  19. package/lib/adapters/node-server/vite/index.cjs +2 -2
  20. package/lib/adapters/node-server/vite/index.mjs +78 -74
  21. package/lib/adapters/shared/vite/index.cjs +2 -2
  22. package/lib/adapters/shared/vite/index.mjs +108 -104
  23. package/lib/adapters/ssg/vite/index.cjs +2 -2
  24. package/lib/adapters/ssg/vite/index.mjs +100 -96
  25. package/lib/adapters/vercel-edge/vite/index.cjs +2 -2
  26. package/lib/adapters/vercel-edge/vite/index.mjs +114 -110
  27. package/lib/index.qwik.cjs +39 -33
  28. package/lib/index.qwik.mjs +39 -33
  29. package/lib/middleware/request-handler/index.cjs +8 -8
  30. package/lib/middleware/request-handler/index.mjs +598 -587
  31. package/lib/vite/index.cjs +17 -17
  32. package/lib/vite/index.d.ts +3 -3
  33. package/lib/vite/index.mjs +242 -230
  34. package/package.json +4 -4
  35. package/lib/adapters/cloudflare-pages/vite/index-BIeHg2Cj.cjs +0 -5
  36. package/lib/adapters/cloudflare-pages/vite/index-bogwy7wh.js +0 -250
@@ -2,7 +2,7 @@ import E from "node:fs";
2
2
  import { isAbsolute as N, resolve as te, join as L, dirname as re, relative as ne } from "node:path";
3
3
  import { cpus as se } from "node:os";
4
4
  import { Worker as oe, parentPort as A, isMainThread as V, workerData as j } from "node:worker_threads";
5
- import { n as D } from "./index-bogwy7wh.js";
5
+ import { n as D } from "./index-CHT9Y93A.js";
6
6
  import { _serialize as ie } from "@qwik.dev/core/internal";
7
7
  import { RequestEvShareQData as ae, requestHandler as ce, getErrorHtml as le } from "@qwik.dev/router/middleware/request-handler";
8
8
  import { WritableStream as ue } from "node:stream/web";
@@ -0,0 +1,5 @@
1
+ "use strict";const f=require("node:fs"),g=require("node:path"),b=require("@qwik.dev/router/middleware/request-handler");function j(e){return v(g.normalize(e))}function v(e){const n=/^\\\\\?\\/.test(e),t=/[^\u0000-\u0080]+/.test(e);return n||t||(e=e.replace(/\\/g,"/"),e.endsWith("/")&&(e=e.slice(0,e.length-1))),e}async function E(e,n,t,r,h){t&&!t.endsWith("/")&&(t+="/");const w=new Set([t+"/"+(globalThis.__QWIK_BUILD_DIR__||"build")+"/",t+"/"+(globalThis.__QWIK_ASSETS_DIR__||"assets")+"/"]),o=new Set(r.map(_)),p=[],a=async(l,u,c)=>{if(c=_(c),w.has(c))return;const m=g.join(l,u);if(u==="index.html"||u==="q-data.json"){!o.has(c)&&h&&await f.promises.unlink(m);return}if(u==="404.html"){const s=await f.promises.readFile(m,"utf-8");p.push([c,s]);return}const k=await f.promises.stat(m);k.isDirectory()?await y(m,c+u+"/"):k.isFile()&&o.add(c+u)},y=async(l,u)=>{const c=await f.promises.readdir(l);await Promise.all(c.map(m=>a(l,m,u)))};f.existsSync(e)&&await y(e,t);const i=O(t,p),d=D(o);await T(d,i,n)}function _(e){return e.endsWith("/")?e:e+"/"}function O(e,n){if(n.sort((t,r)=>t[0].length>r[0].length?-1:t[0].length<r[0].length?1:t[0]<r[0]?-1:t[0]>r[0]?1:0),!n.some(t=>t[0]===e)){const t=b.getErrorHtml(404,"Resource Not Found");n.push([e,t])}return JSON.stringify(n,null,2).slice(1,-1)}function D(e){return JSON.stringify(Array.from(new Set(e)).sort()).slice(1,-1)}const T=async(e,n,t)=>{const r=new Set,h=async o=>{const p=await f.promises.readFile(o,"utf-8");let a=!1;const y=p.replace(/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,(i,d,l)=>(a=!0,l==="STATIC_PATHS"?e:n));a&&await f.promises.writeFile(o,y)},w=async o=>{const p=await f.promises.readdir(o,{withFileTypes:!0});for(const a of p)if(a.isDirectory())await w(g.join(o,a.name));else if(a.name.endsWith("js")){const y=h(g.join(o,a.name)).finally(()=>{r.delete(y)});r.add(y)}};await w(t),await Promise.all(r)};function A(e){let n=null,t=null,r=null,h=null,w=null,o=!1,p;const a=[];return{name:`vite-plugin-qwik-router-ssg-${e.name}`,enforce:"post",apply:"build",config(i){return typeof e.config=="function"&&(i=e.config(i)),i.define={"process.env.NODE_ENV":JSON.stringify("production"),...i.define},i},configResolved(i){if(o=!!i.build.ssr,p=i.command,o){if(n=i.plugins.find(d=>d.name==="vite-plugin-qwik-router"),!n)throw new Error("Missing vite-plugin-qwik-router");if(t=i.plugins.find(d=>d.name==="vite-plugin-qwik"),!t)throw new Error("Missing vite-plugin-qwik");if(r=i.build.outDir,i.build?.ssr!==!0)throw new Error(`"build.ssr" must be set to "true" in order to use the "${e.name}" adapter.`);if(!i.build?.rollupOptions?.input)throw new Error(`"build.rollupOptions.input" must be set in order to use the "${e.name}" adapter.`)}},buildStart(){if(o&&e.ssg!==null){const{srcDir:i}=t.api.getOptions();p==="build"&&r&&i&&(this.emitFile({id:"@qwik-router-config",type:"chunk",fileName:"@qwik-router-config.js"}),this.emitFile({id:`${i}/entry.ssr`,type:"chunk",fileName:"entry.ssr.js"}))}},generateBundle(i,d){if(o){a.length=0;for(const l in d){const u=d[l];u.type==="chunk"&&u.isEntry&&(a.push(l),u.name==="entry.ssr"?h=g.join(r,l):u.name==="@qwik-router-config"&&(w=g.join(r,l)))}}},closeBundle:{sequential:!0,async handler(){if(o&&r&&n?.api&&t?.api){const i=e.staticPaths||[],d=n.api.getRoutes(),l=n.api.getBasePathname(),u=t.api.getClientOutDir(),c=t.api.getClientPublicOutDir(),m=t.api.getAssetsDir(),k=t.api.getRootDir()??void 0;if(e.ssg!==null&&h&&w&&u&&c){let s=e.ssg?.origin??e.origin;s||(s="https://yoursite.qwik.dev"),s.length>0&&!/:\/\//.test(s)&&(s=`https://${s}`),s.startsWith("//")&&(s=`https:${s}`);try{s=new URL(s).origin}catch{this.warn(`Invalid "origin" option: "${s}". Using default origin: "https://yoursite.qwik.dev"`),s="https://yoursite.qwik.dev"}const q=await Promise.resolve().then(()=>require("./index-C1aDmh1S.cjs")),R={maxWorkers:e.maxWorkers,basePathname:l,outDir:c,rootDir:k,...e.ssg,origin:s,renderModulePath:h,qwikRouterConfigModulePath:w},P=await q.generate(R);if(P.errors>0){const S=new Error(`Error while running SSG from "${e.name}" adapter. At least one path failed to render.`);S.stack=void 0,this.error(S)}i.push(...P.staticPaths)}await E(c,r,m?g.join(l,m):l,i,!!e.cleanStaticGenerated),typeof e.generate=="function"&&await e.generate({outputEntries:a,serverOutDir:r,clientOutDir:u,clientPublicOutDir:c,basePathname:l,routes:d,assetsDir:m,warn:s=>this.warn(s),error:s=>this.error(s)}),this.warn(`
2
+ ==============================================
3
+ Note: Make sure that you are serving the built files with proper cache headers.
4
+ See https://qwik.dev/docs/deployments/#cache-headers for more information.
5
+ ==============================================`),e.ssg!==null&&setTimeout(()=>{console.warn("SSG seems to be hanging after completion, forcing process to exit. Everything is likely fine."),process.exit(0)},5e3).unref(),e.ssg!==null&&setTimeout(()=>{process.exit(0)},5e3).unref()}}}}}function x(e={}){const n=process?.env;return A({name:"cloudflare-pages",origin:n?.CF_PAGES_URL??n?.ORIGIN??"https://your.cloudflare.pages.dev",ssg:e.ssg,staticPaths:e.staticPaths,cleanStaticGenerated:!0,config(){return{resolve:{conditions:["webworker","worker"]},ssr:{target:"webworker",noExternal:!0,external:["node:async_hooks"]},build:{ssr:!0,rollupOptions:{output:{format:"es",hoistTransitiveImports:!1}}},publicDir:!1}},async generate({clientOutDir:t,serverOutDir:r,basePathname:h,assetsDir:w}){const o=g.join(t,"_routes.json");if(!f.existsSync(o)&&e.functionRoutes!==!1){let i=w?g.join(h,w):h;i.endsWith("/")||(i+="/");const d={version:1,include:[h+"*"],exclude:[i+"build/*",i+"assets/*"]};await f.promises.writeFile(o,JSON.stringify(d,void 0,2))}const a=g.join(t,"_worker.js");if(!f.existsSync(a)){const i=g.relative(t,g.join(r,"entry.cloudflare-pages"));await f.promises.writeFile(a,`import { fetch } from "${v(i)}"; export default { fetch };`)}}})}exports.cloudflarePagesAdapter=x;exports.normalizePath=j;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("node:fs");require("node:path");const e=require("./index-BIeHg2Cj.cjs");exports.cloudflarePagesAdapter=e.cloudflarePagesAdapter;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("node:fs");require("node:path");const e=require("./index-D9RL9dvJ.cjs");exports.cloudflarePagesAdapter=e.cloudflarePagesAdapter;
@@ -1,6 +1,6 @@
1
1
  import "node:fs";
2
2
  import "node:path";
3
- import { c as p } from "./index-bogwy7wh.js";
3
+ import { c as p } from "./index-CHT9Y93A.js";
4
4
  export {
5
5
  p as cloudflarePagesAdapter
6
6
  };
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("node:path"),P=require("@qwik.dev/router/middleware/request-handler"),p=require("node:fs");async function D(e,n,t,s,m){t&&!t.endsWith("/")&&(t+="/");const w=new Set([t+"/"+(globalThis.__QWIK_BUILD_DIR__||"build")+"/",t+"/"+(globalThis.__QWIK_ASSETS_DIR__||"assets")+"/"]),o=new Set(s.map(v)),f=[],g=async(a,l,u)=>{if(u=v(u),w.has(u))return;const h=y.join(a,l);if(l==="index.html"||l==="q-data.json"){!o.has(u)&&m&&await p.promises.unlink(h);return}if(l==="404.html"){const k=await p.promises.readFile(h,"utf-8");f.push([u,k]);return}const r=await p.promises.stat(h);r.isDirectory()?await i(h,u+l+"/"):r.isFile()&&o.add(u+l)},i=async(a,l)=>{const u=await p.promises.readdir(a);await Promise.all(u.map(h=>g(a,h,l)))};p.existsSync(e)&&await i(e,t);const d=O(t,f),c=b(o);await R(c,d,n)}function v(e){return e.endsWith("/")?e:e+"/"}function O(e,n){if(n.sort((t,s)=>t[0].length>s[0].length?-1:t[0].length<s[0].length?1:t[0]<s[0]?-1:t[0]>s[0]?1:0),!n.some(t=>t[0]===e)){const t=P.getErrorHtml(404,"Resource Not Found");n.push([e,t])}return JSON.stringify(n,null,2).slice(1,-1)}function b(e){return JSON.stringify(Array.from(new Set(e)).sort()).slice(1,-1)}const R=async(e,n,t)=>{const s=new Set,m=async o=>{const f=await p.promises.readFile(o,"utf-8");let g=!1;const i=f.replace(/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,(d,c,a)=>(g=!0,a==="STATIC_PATHS"?e:n));g&&await p.promises.writeFile(o,i)},w=async o=>{const f=await p.promises.readdir(o,{withFileTypes:!0});for(const g of f)if(g.isDirectory())await w(y.join(o,g.name));else if(g.name.endsWith("js")){const i=m(y.join(o,g.name)).finally(()=>{s.delete(i)});s.add(i)}};await w(t),await Promise.all(s)};function T(e){let n=null,t=null,s=null,m=null,w=null,o=!1;const f=[];return{name:`vite-plugin-qwik-router-ssg-${e.name}`,enforce:"post",apply:"build",config(i){return typeof e.config=="function"&&(i=e.config(i)),i.define={"process.env.NODE_ENV":JSON.stringify("production"),...i.define},i},configResolved(i){if(o=!!i.build.ssr,o){if(n=i.plugins.find(d=>d.name==="vite-plugin-qwik-router"),!n)throw new Error("Missing vite-plugin-qwik-router");if(t=i.plugins.find(d=>d.name==="vite-plugin-qwik"),!t)throw new Error("Missing vite-plugin-qwik");if(s=i.build.outDir,i.build?.ssr!==!0)throw new Error(`"build.ssr" must be set to "true" in order to use the "${e.name}" adapter.`);if(!i.build?.rollupOptions?.input)throw new Error(`"build.rollupOptions.input" must be set in order to use the "${e.name}" adapter.`)}},buildStart(){if(o&&e.ssg!==null){const{srcDir:i}=t.api.getOptions();this.emitFile({id:"@qwik-router-config",type:"chunk",fileName:"@qwik-router-config.js"}),this.emitFile({id:`${i}/entry.ssr`,type:"chunk",fileName:"entry.ssr.js"})}},generateBundle(i,d){if(o){f.length=0;for(const c in d){const a=d[c];a.type==="chunk"&&a.isEntry&&(f.push(c),a.name==="entry.ssr"?m=y.join(s,c):a.name==="@qwik-router-config"&&(w=y.join(s,c)))}}},closeBundle:{sequential:!0,async handler(){if(o&&s&&n?.api&&t?.api){const i=e.staticPaths||[],d=n.api.getRoutes(),c=n.api.getBasePathname(),a=t.api.getClientOutDir(),l=t.api.getClientPublicOutDir(),u=t.api.getAssetsDir(),h=t.api.getRootDir()??void 0;if(e.ssg!==null&&m&&w&&a&&l){let r=e.ssg?.origin??e.origin;r||(r="https://yoursite.qwik.dev"),r.length>0&&!/:\/\//.test(r)&&(r=`https://${r}`),r.startsWith("//")&&(r=`https:${r}`);try{r=new URL(r).origin}catch{this.warn(`Invalid "origin" option: "${r}". Using default origin: "https://yoursite.qwik.dev"`),r="https://yoursite.qwik.dev"}const k=await Promise.resolve().then(()=>require("./index-BqUeglYs.cjs")),q={maxWorkers:e.maxWorkers,basePathname:c,outDir:l,rootDir:h,...e.ssg,origin:r,renderModulePath:m,qwikRouterConfigModulePath:w},S=await k.generate(q);if(S.errors>0){const _=new Error(`Error while running SSG from "${e.name}" adapter. At least one path failed to render.`);_.stack=void 0,this.error(_)}i.push(...S.staticPaths)}await D(l,s,u?y.join(c,u):c,i,!!e.cleanStaticGenerated),typeof e.generate=="function"&&await e.generate({outputEntries:f,serverOutDir:s,clientOutDir:a,clientPublicOutDir:l,basePathname:c,routes:d,assetsDir:u,warn:r=>this.warn(r),error:r=>this.error(r)}),this.warn(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("node:path"),b=require("@qwik.dev/router/middleware/request-handler"),p=require("node:fs");async function D(e,s,t,n,m){t&&!t.endsWith("/")&&(t+="/");const w=new Set([t+"/"+(globalThis.__QWIK_BUILD_DIR__||"build")+"/",t+"/"+(globalThis.__QWIK_ASSETS_DIR__||"assets")+"/"]),o=new Set(n.map(_)),g=[],c=async(a,l,u)=>{if(u=_(u),w.has(u))return;const f=y.join(a,l);if(l==="index.html"||l==="q-data.json"){!o.has(u)&&m&&await p.promises.unlink(f);return}if(l==="404.html"){const r=await p.promises.readFile(f,"utf-8");g.push([u,r]);return}const k=await p.promises.stat(f);k.isDirectory()?await h(f,u+l+"/"):k.isFile()&&o.add(u+l)},h=async(a,l)=>{const u=await p.promises.readdir(a);await Promise.all(u.map(f=>c(a,f,l)))};p.existsSync(e)&&await h(e,t);const i=O(t,g),d=R(o);await T(d,i,s)}function _(e){return e.endsWith("/")?e:e+"/"}function O(e,s){if(s.sort((t,n)=>t[0].length>n[0].length?-1:t[0].length<n[0].length?1:t[0]<n[0]?-1:t[0]>n[0]?1:0),!s.some(t=>t[0]===e)){const t=b.getErrorHtml(404,"Resource Not Found");s.push([e,t])}return JSON.stringify(s,null,2).slice(1,-1)}function R(e){return JSON.stringify(Array.from(new Set(e)).sort()).slice(1,-1)}const T=async(e,s,t)=>{const n=new Set,m=async o=>{const g=await p.promises.readFile(o,"utf-8");let c=!1;const h=g.replace(/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,(i,d,a)=>(c=!0,a==="STATIC_PATHS"?e:s));c&&await p.promises.writeFile(o,h)},w=async o=>{const g=await p.promises.readdir(o,{withFileTypes:!0});for(const c of g)if(c.isDirectory())await w(y.join(o,c.name));else if(c.name.endsWith("js")){const h=m(y.join(o,c.name)).finally(()=>{n.delete(h)});n.add(h)}};await w(t),await Promise.all(n)};function E(e){let s=null,t=null,n=null,m=null,w=null,o=!1,g;const c=[];return{name:`vite-plugin-qwik-router-ssg-${e.name}`,enforce:"post",apply:"build",config(i){return typeof e.config=="function"&&(i=e.config(i)),i.define={"process.env.NODE_ENV":JSON.stringify("production"),...i.define},i},configResolved(i){if(o=!!i.build.ssr,g=i.command,o){if(s=i.plugins.find(d=>d.name==="vite-plugin-qwik-router"),!s)throw new Error("Missing vite-plugin-qwik-router");if(t=i.plugins.find(d=>d.name==="vite-plugin-qwik"),!t)throw new Error("Missing vite-plugin-qwik");if(n=i.build.outDir,i.build?.ssr!==!0)throw new Error(`"build.ssr" must be set to "true" in order to use the "${e.name}" adapter.`);if(!i.build?.rollupOptions?.input)throw new Error(`"build.rollupOptions.input" must be set in order to use the "${e.name}" adapter.`)}},buildStart(){if(o&&e.ssg!==null){const{srcDir:i}=t.api.getOptions();g==="build"&&n&&i&&(this.emitFile({id:"@qwik-router-config",type:"chunk",fileName:"@qwik-router-config.js"}),this.emitFile({id:`${i}/entry.ssr`,type:"chunk",fileName:"entry.ssr.js"}))}},generateBundle(i,d){if(o){c.length=0;for(const a in d){const l=d[a];l.type==="chunk"&&l.isEntry&&(c.push(a),l.name==="entry.ssr"?m=y.join(n,a):l.name==="@qwik-router-config"&&(w=y.join(n,a)))}}},closeBundle:{sequential:!0,async handler(){if(o&&n&&s?.api&&t?.api){const i=e.staticPaths||[],d=s.api.getRoutes(),a=s.api.getBasePathname(),l=t.api.getClientOutDir(),u=t.api.getClientPublicOutDir(),f=t.api.getAssetsDir(),k=t.api.getRootDir()??void 0;if(e.ssg!==null&&m&&w&&l&&u){let r=e.ssg?.origin??e.origin;r||(r="https://yoursite.qwik.dev"),r.length>0&&!/:\/\//.test(r)&&(r=`https://${r}`),r.startsWith("//")&&(r=`https:${r}`);try{r=new URL(r).origin}catch{this.warn(`Invalid "origin" option: "${r}". Using default origin: "https://yoursite.qwik.dev"`),r="https://yoursite.qwik.dev"}const q=await Promise.resolve().then(()=>require("./index-BqUeglYs.cjs")),P={maxWorkers:e.maxWorkers,basePathname:a,outDir:u,rootDir:k,...e.ssg,origin:r,renderModulePath:m,qwikRouterConfigModulePath:w},S=await q.generate(P);if(S.errors>0){const v=new Error(`Error while running SSG from "${e.name}" adapter. At least one path failed to render.`);v.stack=void 0,this.error(v)}i.push(...S.staticPaths)}await D(u,n,f?y.join(a,f):a,i,!!e.cleanStaticGenerated),typeof e.generate=="function"&&await e.generate({outputEntries:c,serverOutDir:n,clientOutDir:l,clientPublicOutDir:u,basePathname:a,routes:d,assetsDir:f,warn:r=>this.warn(r),error:r=>this.error(r)}),this.warn(`
2
2
  ==============================================
3
3
  Note: Make sure that you are serving the built files with proper cache headers.
4
4
  See https://qwik.dev/docs/deployments/#cache-headers for more information.
5
- ==============================================`),e.ssg!==null&&setTimeout(()=>{process.exit(0)},5e3).unref()}}}}}function E(e={}){const n=process?.env;return T({name:e.name||"deno-server",origin:n?.ORIGIN??n?.URL??"https://yoursitename.qwik.dev",ssg:e.ssg,cleanStaticGenerated:!0,config(){return{resolve:{conditions:["webworker","worker"]},ssr:{target:"webworker",noExternal:!0,external:["node:async_hooks"]},build:{ssr:!0,target:"esnext",rollupOptions:{output:{format:"es",hoistTransitiveImports:!1}}},publicDir:!1}}})}exports.denoServerAdapter=E;
5
+ ==============================================`),e.ssg!==null&&setTimeout(()=>{console.warn("SSG seems to be hanging after completion, forcing process to exit. Everything is likely fine."),process.exit(0)},5e3).unref(),e.ssg!==null&&setTimeout(()=>{process.exit(0)},5e3).unref()}}}}}function A(e={}){const s=process?.env;return E({name:e.name||"deno-server",origin:s?.ORIGIN??s?.URL??"https://yoursitename.qwik.dev",ssg:e.ssg,cleanStaticGenerated:!0,config(){return{resolve:{conditions:["webworker","worker"]},ssr:{target:"webworker",noExternal:!0,external:["node:async_hooks"]},build:{ssr:!0,target:"esnext",rollupOptions:{output:{format:"es",hoistTransitiveImports:!1}}},publicDir:!1}}})}exports.denoServerAdapter=A;
@@ -1,73 +1,73 @@
1
1
  import { join as y } from "node:path";
2
- import { getErrorHtml as q } from "@qwik.dev/router/middleware/request-handler";
2
+ import { getErrorHtml as D } from "@qwik.dev/router/middleware/request-handler";
3
3
  import p from "node:fs";
4
- async function D(e, n, t, s, m) {
4
+ async function b(e, s, t, n, m) {
5
5
  t && !t.endsWith("/") && (t += "/");
6
- const g = /* @__PURE__ */ new Set([
6
+ const w = /* @__PURE__ */ new Set([
7
7
  t + "/" + (globalThis.__QWIK_BUILD_DIR__ || "build") + "/",
8
8
  t + "/" + (globalThis.__QWIK_ASSETS_DIR__ || "assets") + "/"
9
- ]), o = new Set(s.map(v)), f = [], w = async (a, l, u) => {
10
- if (u = v(u), g.has(u))
9
+ ]), o = new Set(n.map(v)), g = [], c = async (a, l, u) => {
10
+ if (u = v(u), w.has(u))
11
11
  return;
12
- const h = y(a, l);
12
+ const f = y(a, l);
13
13
  if (l === "index.html" || l === "q-data.json") {
14
- !o.has(u) && m && await p.promises.unlink(h);
14
+ !o.has(u) && m && await p.promises.unlink(f);
15
15
  return;
16
16
  }
17
17
  if (l === "404.html") {
18
- const k = await p.promises.readFile(h, "utf-8");
19
- f.push([u, k]);
18
+ const r = await p.promises.readFile(f, "utf-8");
19
+ g.push([u, r]);
20
20
  return;
21
21
  }
22
- const r = await p.promises.stat(h);
23
- r.isDirectory() ? await i(h, u + l + "/") : r.isFile() && o.add(u + l);
24
- }, i = async (a, l) => {
22
+ const k = await p.promises.stat(f);
23
+ k.isDirectory() ? await h(f, u + l + "/") : k.isFile() && o.add(u + l);
24
+ }, h = async (a, l) => {
25
25
  const u = await p.promises.readdir(a);
26
- await Promise.all(u.map((h) => w(a, h, l)));
26
+ await Promise.all(u.map((f) => c(a, f, l)));
27
27
  };
28
- p.existsSync(e) && await i(e, t);
29
- const d = O(t, f), c = R(o);
30
- await b(c, d, n);
28
+ p.existsSync(e) && await h(e, t);
29
+ const i = O(t, g), d = R(o);
30
+ await T(d, i, s);
31
31
  }
32
32
  function v(e) {
33
33
  return e.endsWith("/") ? e : e + "/";
34
34
  }
35
- function O(e, n) {
36
- if (n.sort((t, s) => t[0].length > s[0].length ? -1 : t[0].length < s[0].length ? 1 : t[0] < s[0] ? -1 : t[0] > s[0] ? 1 : 0), !n.some((t) => t[0] === e)) {
37
- const t = q(404, "Resource Not Found");
38
- n.push([e, t]);
35
+ function O(e, s) {
36
+ if (s.sort((t, n) => t[0].length > n[0].length ? -1 : t[0].length < n[0].length ? 1 : t[0] < n[0] ? -1 : t[0] > n[0] ? 1 : 0), !s.some((t) => t[0] === e)) {
37
+ const t = D(404, "Resource Not Found");
38
+ s.push([e, t]);
39
39
  }
40
- return JSON.stringify(n, null, 2).slice(1, -1);
40
+ return JSON.stringify(s, null, 2).slice(1, -1);
41
41
  }
42
42
  function R(e) {
43
43
  return JSON.stringify(Array.from(new Set(e)).sort()).slice(1, -1);
44
44
  }
45
- const b = async (e, n, t) => {
46
- const s = /* @__PURE__ */ new Set(), m = async (o) => {
47
- const f = await p.promises.readFile(o, "utf-8");
48
- let w = !1;
49
- const i = f.replace(
45
+ const T = async (e, s, t) => {
46
+ const n = /* @__PURE__ */ new Set(), m = async (o) => {
47
+ const g = await p.promises.readFile(o, "utf-8");
48
+ let c = !1;
49
+ const h = g.replace(
50
50
  /(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,
51
- (d, c, a) => (w = !0, a === "STATIC_PATHS" ? e : n)
51
+ (i, d, a) => (c = !0, a === "STATIC_PATHS" ? e : s)
52
52
  );
53
- w && await p.promises.writeFile(o, i);
54
- }, g = async (o) => {
55
- const f = await p.promises.readdir(o, { withFileTypes: !0 });
56
- for (const w of f)
57
- if (w.isDirectory())
58
- await g(y(o, w.name));
59
- else if (w.name.endsWith("js")) {
60
- const i = m(y(o, w.name)).finally(() => {
61
- s.delete(i);
53
+ c && await p.promises.writeFile(o, h);
54
+ }, w = async (o) => {
55
+ const g = await p.promises.readdir(o, { withFileTypes: !0 });
56
+ for (const c of g)
57
+ if (c.isDirectory())
58
+ await w(y(o, c.name));
59
+ else if (c.name.endsWith("js")) {
60
+ const h = m(y(o, c.name)).finally(() => {
61
+ n.delete(h);
62
62
  });
63
- s.add(i);
63
+ n.add(h);
64
64
  }
65
65
  };
66
- await g(t), await Promise.all(s);
66
+ await w(t), await Promise.all(n);
67
67
  };
68
- function T(e) {
69
- let n = null, t = null, s = null, m = null, g = null, o = !1;
70
- const f = [];
68
+ function E(e) {
69
+ let s = null, t = null, n = null, m = null, w = null, o = !1, g;
70
+ const c = [];
71
71
  return {
72
72
  name: `vite-plugin-qwik-router-ssg-${e.name}`,
73
73
  enforce: "post",
@@ -79,16 +79,16 @@ function T(e) {
79
79
  }, i;
80
80
  },
81
81
  configResolved(i) {
82
- if (o = !!i.build.ssr, o) {
83
- if (n = i.plugins.find(
82
+ if (o = !!i.build.ssr, g = i.command, o) {
83
+ if (s = i.plugins.find(
84
84
  (d) => d.name === "vite-plugin-qwik-router"
85
- ), !n)
85
+ ), !s)
86
86
  throw new Error("Missing vite-plugin-qwik-router");
87
87
  if (t = i.plugins.find(
88
88
  (d) => d.name === "vite-plugin-qwik"
89
89
  ), !t)
90
90
  throw new Error("Missing vite-plugin-qwik");
91
- if (s = i.build.outDir, i.build?.ssr !== !0)
91
+ if (n = i.build.outDir, i.build?.ssr !== !0)
92
92
  throw new Error(
93
93
  `"build.ssr" must be set to "true" in order to use the "${e.name}" adapter.`
94
94
  );
@@ -101,7 +101,7 @@ function T(e) {
101
101
  buildStart() {
102
102
  if (o && e.ssg !== null) {
103
103
  const { srcDir: i } = t.api.getOptions();
104
- this.emitFile({
104
+ g === "build" && n && i && (this.emitFile({
105
105
  id: "@qwik-router-config",
106
106
  type: "chunk",
107
107
  fileName: "@qwik-router-config.js"
@@ -109,24 +109,24 @@ function T(e) {
109
109
  id: `${i}/entry.ssr`,
110
110
  type: "chunk",
111
111
  fileName: "entry.ssr.js"
112
- });
112
+ }));
113
113
  }
114
114
  },
115
115
  generateBundle(i, d) {
116
116
  if (o) {
117
- f.length = 0;
118
- for (const c in d) {
119
- const a = d[c];
120
- a.type === "chunk" && a.isEntry && (f.push(c), a.name === "entry.ssr" ? m = y(s, c) : a.name === "@qwik-router-config" && (g = y(s, c)));
117
+ c.length = 0;
118
+ for (const a in d) {
119
+ const l = d[a];
120
+ l.type === "chunk" && l.isEntry && (c.push(a), l.name === "entry.ssr" ? m = y(n, a) : l.name === "@qwik-router-config" && (w = y(n, a)));
121
121
  }
122
122
  }
123
123
  },
124
124
  closeBundle: {
125
125
  sequential: !0,
126
126
  async handler() {
127
- if (o && s && n?.api && t?.api) {
128
- const i = e.staticPaths || [], d = n.api.getRoutes(), c = n.api.getBasePathname(), a = t.api.getClientOutDir(), l = t.api.getClientPublicOutDir(), u = t.api.getAssetsDir(), h = t.api.getRootDir() ?? void 0;
129
- if (e.ssg !== null && m && g && a && l) {
127
+ if (o && n && s?.api && t?.api) {
128
+ const i = e.staticPaths || [], d = s.api.getRoutes(), a = s.api.getBasePathname(), l = t.api.getClientOutDir(), u = t.api.getClientPublicOutDir(), f = t.api.getAssetsDir(), k = t.api.getRootDir() ?? void 0;
129
+ if (e.ssg !== null && m && w && l && u) {
130
130
  let r = e.ssg?.origin ?? e.origin;
131
131
  r || (r = "https://yoursite.qwik.dev"), r.length > 0 && !/:\/\//.test(r) && (r = `https://${r}`), r.startsWith("//") && (r = `https:${r}`);
132
132
  try {
@@ -136,38 +136,38 @@ function T(e) {
136
136
  `Invalid "origin" option: "${r}". Using default origin: "https://yoursite.qwik.dev"`
137
137
  ), r = "https://yoursite.qwik.dev";
138
138
  }
139
- const k = await import("./index-CrwlB95_.js"), P = {
139
+ const P = await import("./index-CrwlB95_.js"), q = {
140
140
  maxWorkers: e.maxWorkers,
141
- basePathname: c,
142
- outDir: l,
143
- rootDir: h,
141
+ basePathname: a,
142
+ outDir: u,
143
+ rootDir: k,
144
144
  ...e.ssg,
145
145
  origin: r,
146
146
  renderModulePath: m,
147
- qwikRouterConfigModulePath: g
148
- }, _ = await k.generate(P);
149
- if (_.errors > 0) {
150
- const S = new Error(
147
+ qwikRouterConfigModulePath: w
148
+ }, S = await P.generate(q);
149
+ if (S.errors > 0) {
150
+ const _ = new Error(
151
151
  `Error while running SSG from "${e.name}" adapter. At least one path failed to render.`
152
152
  );
153
- S.stack = void 0, this.error(S);
153
+ _.stack = void 0, this.error(_);
154
154
  }
155
- i.push(..._.staticPaths);
155
+ i.push(...S.staticPaths);
156
156
  }
157
- await D(
158
- l,
159
- s,
160
- u ? y(c, u) : c,
157
+ await b(
158
+ u,
159
+ n,
160
+ f ? y(a, f) : a,
161
161
  i,
162
162
  !!e.cleanStaticGenerated
163
163
  ), typeof e.generate == "function" && await e.generate({
164
- outputEntries: f,
165
- serverOutDir: s,
166
- clientOutDir: a,
167
- clientPublicOutDir: l,
168
- basePathname: c,
164
+ outputEntries: c,
165
+ serverOutDir: n,
166
+ clientOutDir: l,
167
+ clientPublicOutDir: u,
168
+ basePathname: a,
169
169
  routes: d,
170
- assetsDir: u,
170
+ assetsDir: f,
171
171
  warn: (r) => this.warn(r),
172
172
  error: (r) => this.error(r)
173
173
  }), this.warn(
@@ -177,6 +177,10 @@ Note: Make sure that you are serving the built files with proper cache headers.
177
177
  See https://qwik.dev/docs/deployments/#cache-headers for more information.
178
178
  ==============================================`
179
179
  ), e.ssg !== null && setTimeout(() => {
180
+ console.warn(
181
+ "SSG seems to be hanging after completion, forcing process to exit. Everything is likely fine."
182
+ ), process.exit(0);
183
+ }, 5e3).unref(), e.ssg !== null && setTimeout(() => {
180
184
  process.exit(0);
181
185
  }, 5e3).unref();
182
186
  }
@@ -185,10 +189,10 @@ See https://qwik.dev/docs/deployments/#cache-headers for more information.
185
189
  };
186
190
  }
187
191
  function C(e = {}) {
188
- const n = process?.env;
189
- return T({
192
+ const s = process?.env;
193
+ return E({
190
194
  name: e.name || "deno-server",
191
- origin: n?.ORIGIN ?? n?.URL ?? "https://yoursitename.qwik.dev",
195
+ origin: s?.ORIGIN ?? s?.URL ?? "https://yoursitename.qwik.dev",
192
196
  ssg: e.ssg,
193
197
  cleanStaticGenerated: !0,
194
198
  config() {
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("node:fs"),h=require("node:path"),b=require("@qwik.dev/router/middleware/request-handler");async function j(e,s,t,i,a){t&&!t.endsWith("/")&&(t+="/");const p=new Set([t+"/"+(globalThis.__QWIK_BUILD_DIR__||"build")+"/",t+"/"+(globalThis.__QWIK_ASSETS_DIR__||"assets")+"/"]),o=new Set(i.map(S)),d=[],f=async(l,u,c)=>{if(c=S(c),p.has(c))return;const m=h.join(l,u);if(u==="index.html"||u==="q-data.json"){!o.has(c)&&a&&await y.promises.unlink(m);return}if(u==="404.html"){const P=await y.promises.readFile(m,"utf-8");d.push([c,P]);return}const r=await y.promises.stat(m);r.isDirectory()?await n(m,c+u+"/"):r.isFile()&&o.add(c+u)},n=async(l,u)=>{const c=await y.promises.readdir(l);await Promise.all(c.map(m=>f(l,m,u)))};y.existsSync(e)&&await n(e,t);const w=q(t,d),g=E(o);await D(g,w,s)}function S(e){return e.endsWith("/")?e:e+"/"}function q(e,s){if(s.sort((t,i)=>t[0].length>i[0].length?-1:t[0].length<i[0].length?1:t[0]<i[0]?-1:t[0]>i[0]?1:0),!s.some(t=>t[0]===e)){const t=b.getErrorHtml(404,"Resource Not Found");s.push([e,t])}return JSON.stringify(s,null,2).slice(1,-1)}function E(e){return JSON.stringify(Array.from(new Set(e)).sort()).slice(1,-1)}const D=async(e,s,t)=>{const i=new Set,a=async o=>{const d=await y.promises.readFile(o,"utf-8");let f=!1;const n=d.replace(/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,(w,g,l)=>(f=!0,l==="STATIC_PATHS"?e:s));f&&await y.promises.writeFile(o,n)},p=async o=>{const d=await y.promises.readdir(o,{withFileTypes:!0});for(const f of d)if(f.isDirectory())await p(h.join(o,f.name));else if(f.name.endsWith("js")){const n=a(h.join(o,f.name)).finally(()=>{i.delete(n)});i.add(n)}};await p(t),await Promise.all(i)};function O(e){let s=null,t=null,i=null,a=null,p=null,o=!1;const d=[];return{name:`vite-plugin-qwik-router-ssg-${e.name}`,enforce:"post",apply:"build",config(n){return typeof e.config=="function"&&(n=e.config(n)),n.define={"process.env.NODE_ENV":JSON.stringify("production"),...n.define},n},configResolved(n){if(o=!!n.build.ssr,o){if(s=n.plugins.find(w=>w.name==="vite-plugin-qwik-router"),!s)throw new Error("Missing vite-plugin-qwik-router");if(t=n.plugins.find(w=>w.name==="vite-plugin-qwik"),!t)throw new Error("Missing vite-plugin-qwik");if(i=n.build.outDir,n.build?.ssr!==!0)throw new Error(`"build.ssr" must be set to "true" in order to use the "${e.name}" adapter.`);if(!n.build?.rollupOptions?.input)throw new Error(`"build.rollupOptions.input" must be set in order to use the "${e.name}" adapter.`)}},buildStart(){if(o&&e.ssg!==null){const{srcDir:n}=t.api.getOptions();this.emitFile({id:"@qwik-router-config",type:"chunk",fileName:"@qwik-router-config.js"}),this.emitFile({id:`${n}/entry.ssr`,type:"chunk",fileName:"entry.ssr.js"})}},generateBundle(n,w){if(o){d.length=0;for(const g in w){const l=w[g];l.type==="chunk"&&l.isEntry&&(d.push(g),l.name==="entry.ssr"?a=h.join(i,g):l.name==="@qwik-router-config"&&(p=h.join(i,g)))}}},closeBundle:{sequential:!0,async handler(){if(o&&i&&s?.api&&t?.api){const n=e.staticPaths||[],w=s.api.getRoutes(),g=s.api.getBasePathname(),l=t.api.getClientOutDir(),u=t.api.getClientPublicOutDir(),c=t.api.getAssetsDir(),m=t.api.getRootDir()??void 0;if(e.ssg!==null&&a&&p&&l&&u){let r=e.ssg?.origin??e.origin;r||(r="https://yoursite.qwik.dev"),r.length>0&&!/:\/\//.test(r)&&(r=`https://${r}`),r.startsWith("//")&&(r=`https:${r}`);try{r=new URL(r).origin}catch{this.warn(`Invalid "origin" option: "${r}". Using default origin: "https://yoursite.qwik.dev"`),r="https://yoursite.qwik.dev"}const P=await Promise.resolve().then(()=>require("./index-BqUeglYs.cjs")),v={maxWorkers:e.maxWorkers,basePathname:g,outDir:u,rootDir:m,...e.ssg,origin:r,renderModulePath:a,qwikRouterConfigModulePath:p},k=await P.generate(v);if(k.errors>0){const _=new Error(`Error while running SSG from "${e.name}" adapter. At least one path failed to render.`);_.stack=void 0,this.error(_)}n.push(...k.staticPaths)}await j(u,i,c?h.join(g,c):g,n,!!e.cleanStaticGenerated),typeof e.generate=="function"&&await e.generate({outputEntries:d,serverOutDir:i,clientOutDir:l,clientPublicOutDir:u,basePathname:g,routes:w,assetsDir:c,warn:r=>this.warn(r),error:r=>this.error(r)}),this.warn(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("node:fs"),d=require("node:path"),j=require("@qwik.dev/router/middleware/request-handler");async function q(e,r,t,i,u){t&&!t.endsWith("/")&&(t+="/");const y=new Set([t+"/"+(globalThis.__QWIK_BUILD_DIR__||"build")+"/",t+"/"+(globalThis.__QWIK_ASSETS_DIR__||"assets")+"/"]),o=new Set(i.map(_)),g=[],c=async(a,l,f)=>{if(f=_(f),y.has(f))return;const p=d.join(a,l);if(l==="index.html"||l==="q-data.json"){!o.has(f)&&u&&await w.promises.unlink(p);return}if(l==="404.html"){const s=await w.promises.readFile(p,"utf-8");g.push([f,s]);return}const P=await w.promises.stat(p);P.isDirectory()?await m(p,f+l+"/"):P.isFile()&&o.add(f+l)},m=async(a,l)=>{const f=await w.promises.readdir(a);await Promise.all(f.map(p=>c(a,p,l)))};w.existsSync(e)&&await m(e,t);const n=E(t,g),h=D(o);await x(h,n,r)}function _(e){return e.endsWith("/")?e:e+"/"}function E(e,r){if(r.sort((t,i)=>t[0].length>i[0].length?-1:t[0].length<i[0].length?1:t[0]<i[0]?-1:t[0]>i[0]?1:0),!r.some(t=>t[0]===e)){const t=j.getErrorHtml(404,"Resource Not Found");r.push([e,t])}return JSON.stringify(r,null,2).slice(1,-1)}function D(e){return JSON.stringify(Array.from(new Set(e)).sort()).slice(1,-1)}const x=async(e,r,t)=>{const i=new Set,u=async o=>{const g=await w.promises.readFile(o,"utf-8");let c=!1;const m=g.replace(/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,(n,h,a)=>(c=!0,a==="STATIC_PATHS"?e:r));c&&await w.promises.writeFile(o,m)},y=async o=>{const g=await w.promises.readdir(o,{withFileTypes:!0});for(const c of g)if(c.isDirectory())await y(d.join(o,c.name));else if(c.name.endsWith("js")){const m=u(d.join(o,c.name)).finally(()=>{i.delete(m)});i.add(m)}};await y(t),await Promise.all(i)};function O(e){let r=null,t=null,i=null,u=null,y=null,o=!1,g;const c=[];return{name:`vite-plugin-qwik-router-ssg-${e.name}`,enforce:"post",apply:"build",config(n){return typeof e.config=="function"&&(n=e.config(n)),n.define={"process.env.NODE_ENV":JSON.stringify("production"),...n.define},n},configResolved(n){if(o=!!n.build.ssr,g=n.command,o){if(r=n.plugins.find(h=>h.name==="vite-plugin-qwik-router"),!r)throw new Error("Missing vite-plugin-qwik-router");if(t=n.plugins.find(h=>h.name==="vite-plugin-qwik"),!t)throw new Error("Missing vite-plugin-qwik");if(i=n.build.outDir,n.build?.ssr!==!0)throw new Error(`"build.ssr" must be set to "true" in order to use the "${e.name}" adapter.`);if(!n.build?.rollupOptions?.input)throw new Error(`"build.rollupOptions.input" must be set in order to use the "${e.name}" adapter.`)}},buildStart(){if(o&&e.ssg!==null){const{srcDir:n}=t.api.getOptions();g==="build"&&i&&n&&(this.emitFile({id:"@qwik-router-config",type:"chunk",fileName:"@qwik-router-config.js"}),this.emitFile({id:`${n}/entry.ssr`,type:"chunk",fileName:"entry.ssr.js"}))}},generateBundle(n,h){if(o){c.length=0;for(const a in h){const l=h[a];l.type==="chunk"&&l.isEntry&&(c.push(a),l.name==="entry.ssr"?u=d.join(i,a):l.name==="@qwik-router-config"&&(y=d.join(i,a)))}}},closeBundle:{sequential:!0,async handler(){if(o&&i&&r?.api&&t?.api){const n=e.staticPaths||[],h=r.api.getRoutes(),a=r.api.getBasePathname(),l=t.api.getClientOutDir(),f=t.api.getClientPublicOutDir(),p=t.api.getAssetsDir(),P=t.api.getRootDir()??void 0;if(e.ssg!==null&&u&&y&&l&&f){let s=e.ssg?.origin??e.origin;s||(s="https://yoursite.qwik.dev"),s.length>0&&!/:\/\//.test(s)&&(s=`https://${s}`),s.startsWith("//")&&(s=`https:${s}`);try{s=new URL(s).origin}catch{this.warn(`Invalid "origin" option: "${s}". Using default origin: "https://yoursite.qwik.dev"`),s="https://yoursite.qwik.dev"}const v=await Promise.resolve().then(()=>require("./index-BqUeglYs.cjs")),b={maxWorkers:e.maxWorkers,basePathname:a,outDir:f,rootDir:P,...e.ssg,origin:s,renderModulePath:u,qwikRouterConfigModulePath:y},k=await v.generate(b);if(k.errors>0){const S=new Error(`Error while running SSG from "${e.name}" adapter. At least one path failed to render.`);S.stack=void 0,this.error(S)}n.push(...k.staticPaths)}await q(f,i,p?d.join(a,p):a,n,!!e.cleanStaticGenerated),typeof e.generate=="function"&&await e.generate({outputEntries:c,serverOutDir:i,clientOutDir:l,clientPublicOutDir:f,basePathname:a,routes:h,assetsDir:p,warn:s=>this.warn(s),error:s=>this.error(s)}),this.warn(`
2
2
  ==============================================
3
3
  Note: Make sure that you are serving the built files with proper cache headers.
4
4
  See https://qwik.dev/docs/deployments/#cache-headers for more information.
5
- ==============================================`),e.ssg!==null&&setTimeout(()=>{process.exit(0)},5e3).unref()}}}}}function R(e,s){const t=h.resolve("/");let i=e;for(let a=0;a<20;a++){if(i=h.dirname(i),h.basename(i)===s)return i;if(i===t)break}throw new Error(`Unable to find "${s}" directory from "${e}"`)}function x(e={}){const s=process?.env;return O({name:"netlify-edge",origin:s?.ORIGIN??s?.URL??"https://yoursitename.netlify.app",ssg:e.ssg,staticPaths:e.staticPaths,cleanStaticGenerated:!0,config(t){const i=t.build?.outDir||".netlify/edge-functions/entry.netlify-edge";return{resolve:{conditions:["webworker","worker"]},ssr:{target:"webworker",noExternal:!0,external:["node:async_hooks"]},build:{ssr:!0,outDir:i,rollupOptions:{output:{format:"es",hoistTransitiveImports:!1}}},publicDir:!1}},async generate({serverOutDir:t,basePathname:i}){if(e.functionRoutes!==!1){const a=[];typeof e.excludedPath=="string"?a.push(e.excludedPath):Array.isArray(e.excludedPath)?a.push(...e.excludedPath):a.push("/build/*","/favicon.ico","/robots.txt","/mainifest.json","/~partytown/*","/service-worker.js","/sitemap.xml");const p={functions:[{path:i+"*",function:"entry.netlify-edge",cache:"manual",excludedPath:a}],version:1},o=h.join(t,"entry.netlify-edge.js"),d=h.join(t,"entry.netlify-edge.mjs");y.existsSync(d)&&await y.promises.writeFile(o,["import entry_netlifyEdge from './entry.netlify-edge.mjs';","export default entry_netlifyEdge;"].join(`
6
- `));const f=R(t,"edge-functions");await y.promises.writeFile(h.join(f,"manifest.json"),JSON.stringify(p,null,2))}}})}exports.netlifyEdgeAdapter=x;
5
+ ==============================================`),e.ssg!==null&&setTimeout(()=>{console.warn("SSG seems to be hanging after completion, forcing process to exit. Everything is likely fine."),process.exit(0)},5e3).unref(),e.ssg!==null&&setTimeout(()=>{process.exit(0)},5e3).unref()}}}}}function R(e,r){const t=d.resolve("/");let i=e;for(let u=0;u<20;u++){if(i=d.dirname(i),d.basename(i)===r)return i;if(i===t)break}throw new Error(`Unable to find "${r}" directory from "${e}"`)}function T(e={}){const r=process?.env;return O({name:"netlify-edge",origin:r?.ORIGIN??r?.URL??"https://yoursitename.netlify.app",ssg:e.ssg,staticPaths:e.staticPaths,cleanStaticGenerated:!0,config(t){const i=t.build?.outDir||".netlify/edge-functions/entry.netlify-edge";return{resolve:{conditions:["webworker","worker"]},ssr:{target:"webworker",noExternal:!0,external:["node:async_hooks"]},build:{ssr:!0,outDir:i,rollupOptions:{output:{format:"es",hoistTransitiveImports:!1}}},publicDir:!1}},async generate({serverOutDir:t,basePathname:i}){if(e.functionRoutes!==!1){const u=[];typeof e.excludedPath=="string"?u.push(e.excludedPath):Array.isArray(e.excludedPath)?u.push(...e.excludedPath):u.push("/build/*","/favicon.ico","/robots.txt","/mainifest.json","/~partytown/*","/service-worker.js","/sitemap.xml");const y={functions:[{path:i+"*",function:"entry.netlify-edge",cache:"manual",excludedPath:u}],version:1},o=d.join(t,"entry.netlify-edge.js"),g=d.join(t,"entry.netlify-edge.mjs");w.existsSync(g)&&await w.promises.writeFile(o,["import entry_netlifyEdge from './entry.netlify-edge.mjs';","export default entry_netlifyEdge;"].join(`
6
+ `));const c=R(t,"edge-functions");await w.promises.writeFile(d.join(c,"manifest.json"),JSON.stringify(y,null,2))}}})}exports.netlifyEdgeAdapter=T;