@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.
- package/lib/adapters/azure-swa/vite/index.cjs +2 -2
- package/lib/adapters/azure-swa/vite/index.mjs +73 -69
- package/lib/adapters/bun-server/vite/index.cjs +2 -2
- package/lib/adapters/bun-server/vite/index.mjs +77 -73
- package/lib/adapters/cloud-run/vite/index.cjs +2 -2
- package/lib/adapters/cloud-run/vite/index.mjs +104 -100
- package/lib/adapters/cloudflare-pages/vite/{index-DwovcBp3.js → index-Bg_9YkM5.js} +1 -1
- package/lib/adapters/cloudflare-pages/vite/{index-C455V8_A.cjs → index-C1aDmh1S.cjs} +1 -1
- package/lib/adapters/cloudflare-pages/vite/index-CHT9Y93A.js +254 -0
- package/lib/adapters/cloudflare-pages/vite/{index-DKcVHRBy.cjs → index-Ck7KvpK1.cjs} +1 -1
- package/lib/adapters/cloudflare-pages/vite/{index-D3HITboM.js → index-Cp1cjAds.js} +1 -1
- package/lib/adapters/cloudflare-pages/vite/index-D9RL9dvJ.cjs +5 -0
- package/lib/adapters/cloudflare-pages/vite/index.cjs +1 -1
- package/lib/adapters/cloudflare-pages/vite/index.mjs +1 -1
- package/lib/adapters/deno-server/vite/index.cjs +2 -2
- package/lib/adapters/deno-server/vite/index.mjs +81 -77
- package/lib/adapters/netlify-edge/vite/index.cjs +3 -3
- package/lib/adapters/netlify-edge/vite/index.mjs +119 -115
- package/lib/adapters/node-server/vite/index.cjs +2 -2
- package/lib/adapters/node-server/vite/index.mjs +78 -74
- package/lib/adapters/shared/vite/index.cjs +2 -2
- package/lib/adapters/shared/vite/index.mjs +108 -104
- package/lib/adapters/ssg/vite/index.cjs +2 -2
- package/lib/adapters/ssg/vite/index.mjs +100 -96
- package/lib/adapters/vercel-edge/vite/index.cjs +2 -2
- package/lib/adapters/vercel-edge/vite/index.mjs +114 -110
- package/lib/index.qwik.cjs +39 -33
- package/lib/index.qwik.mjs +39 -33
- package/lib/middleware/request-handler/index.cjs +8 -8
- package/lib/middleware/request-handler/index.mjs +598 -587
- package/lib/vite/index.cjs +17 -17
- package/lib/vite/index.d.ts +3 -3
- package/lib/vite/index.mjs +242 -230
- package/package.json +4 -4
- package/lib/adapters/cloudflare-pages/vite/index-BIeHg2Cj.cjs +0 -5
- package/lib/adapters/cloudflare-pages/vite/index-bogwy7wh.js +0 -250
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwik.dev/router",
|
|
3
3
|
"description": "The router for Qwik.",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.11",
|
|
5
5
|
"bugs": "https://github.com/QwikDev/qwik/issues",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@azure/functions": "3.5.1",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"unist-util-visit": "^5.0.0",
|
|
28
28
|
"valibot": ">=0.36.0 <2",
|
|
29
29
|
"vfile": "6.0.3",
|
|
30
|
-
"vite-imagetools": "^
|
|
30
|
+
"vite-imagetools": "^8.0.0",
|
|
31
31
|
"yaml": "^2.8.1",
|
|
32
32
|
"zod": "^3.25.40"
|
|
33
33
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@types/set-cookie-parser": "2.4.10",
|
|
40
40
|
"tsm": "2.3.0",
|
|
41
41
|
"uvu": "0.5.6",
|
|
42
|
-
"@qwik.dev/core": "2.0.0-beta.
|
|
42
|
+
"@qwik.dev/core": "2.0.0-beta.11"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"main": "./lib/index.qwik.mjs",
|
|
187
187
|
"peerDependencies": {
|
|
188
188
|
"vite": ">=5 <8",
|
|
189
|
-
"@qwik.dev/core": "^2.0.0-beta.
|
|
189
|
+
"@qwik.dev/core": "^2.0.0-beta.11"
|
|
190
190
|
},
|
|
191
191
|
"publishConfig": {
|
|
192
192
|
"access": "public"
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";const g=require("node:fs"),h=require("node:path"),R=require("@qwik.dev/router/middleware/request-handler");function j(e){return v(h.normalize(e))}function v(e){const s=/^\\\\\?\\/.test(e),t=/[^\u0000-\u0080]+/.test(e);return s||t||(e=e.replace(/\\/g,"/"),e.endsWith("/")&&(e=e.slice(0,e.length-1))),e}async function O(e,s,t,n,w){t&&!t.endsWith("/")&&(t+="/");const p=new Set([t+"/"+(globalThis.__QWIK_BUILD_DIR__||"build")+"/",t+"/"+(globalThis.__QWIK_ASSETS_DIR__||"assets")+"/"]),o=new Set(n.map(S)),m=[],c=async(u,d,f)=>{if(f=S(f),p.has(f))return;const y=h.join(u,d);if(d==="index.html"||d==="q-data.json"){!o.has(f)&&w&&await g.promises.unlink(y);return}if(d==="404.html"){const k=await g.promises.readFile(y,"utf-8");m.push([f,k]);return}const r=await g.promises.stat(y);r.isDirectory()?await i(y,f+d+"/"):r.isFile()&&o.add(f+d)},i=async(u,d)=>{const f=await g.promises.readdir(u);await Promise.all(f.map(y=>c(u,y,d)))};g.existsSync(e)&&await i(e,t);const a=D(t,m),l=E(o);await b(l,a,s)}function S(e){return e.endsWith("/")?e:e+"/"}function D(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=R.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 b=async(e,s,t)=>{const n=new Set,w=async o=>{const m=await g.promises.readFile(o,"utf-8");let c=!1;const i=m.replace(/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,(a,l,u)=>(c=!0,u==="STATIC_PATHS"?e:s));c&&await g.promises.writeFile(o,i)},p=async o=>{const m=await g.promises.readdir(o,{withFileTypes:!0});for(const c of m)if(c.isDirectory())await p(h.join(o,c.name));else if(c.name.endsWith("js")){const i=w(h.join(o,c.name)).finally(()=>{n.delete(i)});n.add(i)}};await p(t),await Promise.all(n)};function A(e){let s=null,t=null,n=null,w=null,p=null,o=!1;const m=[];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(s=i.plugins.find(a=>a.name==="vite-plugin-qwik-router"),!s)throw new Error("Missing vite-plugin-qwik-router");if(t=i.plugins.find(a=>a.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();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,a){if(o){m.length=0;for(const l in a){const u=a[l];u.type==="chunk"&&u.isEntry&&(m.push(l),u.name==="entry.ssr"?w=h.join(n,l):u.name==="@qwik-router-config"&&(p=h.join(n,l)))}}},closeBundle:{sequential:!0,async handler(){if(o&&n&&s?.api&&t?.api){const i=e.staticPaths||[],a=s.api.getRoutes(),l=s.api.getBasePathname(),u=t.api.getClientOutDir(),d=t.api.getClientPublicOutDir(),f=t.api.getAssetsDir(),y=t.api.getRootDir()??void 0;if(e.ssg!==null&&w&&p&&u&&d){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-C455V8_A.cjs")),q={maxWorkers:e.maxWorkers,basePathname:l,outDir:d,rootDir:y,...e.ssg,origin:r,renderModulePath:w,qwikRouterConfigModulePath:p},P=await k.generate(q);if(P.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(...P.staticPaths)}await O(d,n,f?h.join(l,f):l,i,!!e.cleanStaticGenerated),typeof e.generate=="function"&&await e.generate({outputEntries:m,serverOutDir:n,clientOutDir:u,clientPublicOutDir:d,basePathname:l,routes:a,assetsDir:f,warn:r=>this.warn(r),error:r=>this.error(r)}),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(()=>{process.exit(0)},5e3).unref()}}}}}function T(e={}){const s=process?.env;return A({name:"cloudflare-pages",origin:s?.CF_PAGES_URL??s?.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:n,basePathname:w,assetsDir:p}){const o=h.join(t,"_routes.json");if(!g.existsSync(o)&&e.functionRoutes!==!1){let a=p?h.join(w,p):w;a.endsWith("/")||(a+="/");const l={version:1,include:[w+"*"],exclude:[a+"build/*",a+"assets/*"]};await g.promises.writeFile(o,JSON.stringify(l,void 0,2))}const c=h.join(t,"_worker.js");if(!g.existsSync(c)){const a=h.relative(t,h.join(n,"entry.cloudflare-pages"));await g.promises.writeFile(c,`import { fetch } from "${v(a)}"; export default { fetch };`)}}})}exports.cloudflarePagesAdapter=T;exports.normalizePath=j;
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import g from "node:fs";
|
|
2
|
-
import { normalize as q, join as m, relative as O } from "node:path";
|
|
3
|
-
import { getErrorHtml as D } from "@qwik.dev/router/middleware/request-handler";
|
|
4
|
-
function C(e) {
|
|
5
|
-
return v(q(e));
|
|
6
|
-
}
|
|
7
|
-
function v(e) {
|
|
8
|
-
const s = /^\\\\\?\\/.test(e), t = /[^\u0000-\u0080]+/.test(e);
|
|
9
|
-
return s || t || (e = e.replace(/\\/g, "/"), e.endsWith("/") && (e = e.slice(0, e.length - 1))), e;
|
|
10
|
-
}
|
|
11
|
-
async function E(e, s, t, n, h) {
|
|
12
|
-
t && !t.endsWith("/") && (t += "/");
|
|
13
|
-
const w = /* @__PURE__ */ new Set([
|
|
14
|
-
t + "/" + (globalThis.__QWIK_BUILD_DIR__ || "build") + "/",
|
|
15
|
-
t + "/" + (globalThis.__QWIK_ASSETS_DIR__ || "assets") + "/"
|
|
16
|
-
]), o = new Set(n.map(P)), p = [], c = async (u, f, d) => {
|
|
17
|
-
if (d = P(d), w.has(d))
|
|
18
|
-
return;
|
|
19
|
-
const y = m(u, f);
|
|
20
|
-
if (f === "index.html" || f === "q-data.json") {
|
|
21
|
-
!o.has(d) && h && await g.promises.unlink(y);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (f === "404.html") {
|
|
25
|
-
const k = await g.promises.readFile(y, "utf-8");
|
|
26
|
-
p.push([d, k]);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const r = await g.promises.stat(y);
|
|
30
|
-
r.isDirectory() ? await i(y, d + f + "/") : r.isFile() && o.add(d + f);
|
|
31
|
-
}, i = async (u, f) => {
|
|
32
|
-
const d = await g.promises.readdir(u);
|
|
33
|
-
await Promise.all(d.map((y) => c(u, y, f)));
|
|
34
|
-
};
|
|
35
|
-
g.existsSync(e) && await i(e, t);
|
|
36
|
-
const a = b(t, p), l = T(o);
|
|
37
|
-
await A(l, a, s);
|
|
38
|
-
}
|
|
39
|
-
function P(e) {
|
|
40
|
-
return e.endsWith("/") ? e : e + "/";
|
|
41
|
-
}
|
|
42
|
-
function b(e, s) {
|
|
43
|
-
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)) {
|
|
44
|
-
const t = D(404, "Resource Not Found");
|
|
45
|
-
s.push([e, t]);
|
|
46
|
-
}
|
|
47
|
-
return JSON.stringify(s, null, 2).slice(1, -1);
|
|
48
|
-
}
|
|
49
|
-
function T(e) {
|
|
50
|
-
return JSON.stringify(Array.from(new Set(e)).sort()).slice(1, -1);
|
|
51
|
-
}
|
|
52
|
-
const A = async (e, s, t) => {
|
|
53
|
-
const n = /* @__PURE__ */ new Set(), h = async (o) => {
|
|
54
|
-
const p = await g.promises.readFile(o, "utf-8");
|
|
55
|
-
let c = !1;
|
|
56
|
-
const i = p.replace(
|
|
57
|
-
/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,
|
|
58
|
-
(a, l, u) => (c = !0, u === "STATIC_PATHS" ? e : s)
|
|
59
|
-
);
|
|
60
|
-
c && await g.promises.writeFile(o, i);
|
|
61
|
-
}, w = async (o) => {
|
|
62
|
-
const p = await g.promises.readdir(o, { withFileTypes: !0 });
|
|
63
|
-
for (const c of p)
|
|
64
|
-
if (c.isDirectory())
|
|
65
|
-
await w(m(o, c.name));
|
|
66
|
-
else if (c.name.endsWith("js")) {
|
|
67
|
-
const i = h(m(o, c.name)).finally(() => {
|
|
68
|
-
n.delete(i);
|
|
69
|
-
});
|
|
70
|
-
n.add(i);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
await w(t), await Promise.all(n);
|
|
74
|
-
};
|
|
75
|
-
function x(e) {
|
|
76
|
-
let s = null, t = null, n = null, h = null, w = null, o = !1;
|
|
77
|
-
const p = [];
|
|
78
|
-
return {
|
|
79
|
-
name: `vite-plugin-qwik-router-ssg-${e.name}`,
|
|
80
|
-
enforce: "post",
|
|
81
|
-
apply: "build",
|
|
82
|
-
config(i) {
|
|
83
|
-
return typeof e.config == "function" && (i = e.config(i)), i.define = {
|
|
84
|
-
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
85
|
-
...i.define
|
|
86
|
-
}, i;
|
|
87
|
-
},
|
|
88
|
-
configResolved(i) {
|
|
89
|
-
if (o = !!i.build.ssr, o) {
|
|
90
|
-
if (s = i.plugins.find(
|
|
91
|
-
(a) => a.name === "vite-plugin-qwik-router"
|
|
92
|
-
), !s)
|
|
93
|
-
throw new Error("Missing vite-plugin-qwik-router");
|
|
94
|
-
if (t = i.plugins.find(
|
|
95
|
-
(a) => a.name === "vite-plugin-qwik"
|
|
96
|
-
), !t)
|
|
97
|
-
throw new Error("Missing vite-plugin-qwik");
|
|
98
|
-
if (n = i.build.outDir, i.build?.ssr !== !0)
|
|
99
|
-
throw new Error(
|
|
100
|
-
`"build.ssr" must be set to "true" in order to use the "${e.name}" adapter.`
|
|
101
|
-
);
|
|
102
|
-
if (!i.build?.rollupOptions?.input)
|
|
103
|
-
throw new Error(
|
|
104
|
-
`"build.rollupOptions.input" must be set in order to use the "${e.name}" adapter.`
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
buildStart() {
|
|
109
|
-
if (o && e.ssg !== null) {
|
|
110
|
-
const { srcDir: i } = t.api.getOptions();
|
|
111
|
-
this.emitFile({
|
|
112
|
-
id: "@qwik-router-config",
|
|
113
|
-
type: "chunk",
|
|
114
|
-
fileName: "@qwik-router-config.js"
|
|
115
|
-
}), this.emitFile({
|
|
116
|
-
id: `${i}/entry.ssr`,
|
|
117
|
-
type: "chunk",
|
|
118
|
-
fileName: "entry.ssr.js"
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
generateBundle(i, a) {
|
|
123
|
-
if (o) {
|
|
124
|
-
p.length = 0;
|
|
125
|
-
for (const l in a) {
|
|
126
|
-
const u = a[l];
|
|
127
|
-
u.type === "chunk" && u.isEntry && (p.push(l), u.name === "entry.ssr" ? h = m(n, l) : u.name === "@qwik-router-config" && (w = m(n, l)));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
closeBundle: {
|
|
132
|
-
sequential: !0,
|
|
133
|
-
async handler() {
|
|
134
|
-
if (o && n && s?.api && t?.api) {
|
|
135
|
-
const i = e.staticPaths || [], a = s.api.getRoutes(), l = s.api.getBasePathname(), u = t.api.getClientOutDir(), f = t.api.getClientPublicOutDir(), d = t.api.getAssetsDir(), y = t.api.getRootDir() ?? void 0;
|
|
136
|
-
if (e.ssg !== null && h && w && u && f) {
|
|
137
|
-
let r = e.ssg?.origin ?? e.origin;
|
|
138
|
-
r || (r = "https://yoursite.qwik.dev"), r.length > 0 && !/:\/\//.test(r) && (r = `https://${r}`), r.startsWith("//") && (r = `https:${r}`);
|
|
139
|
-
try {
|
|
140
|
-
r = new URL(r).origin;
|
|
141
|
-
} catch {
|
|
142
|
-
this.warn(
|
|
143
|
-
`Invalid "origin" option: "${r}". Using default origin: "https://yoursite.qwik.dev"`
|
|
144
|
-
), r = "https://yoursite.qwik.dev";
|
|
145
|
-
}
|
|
146
|
-
const k = await import("./index-DwovcBp3.js"), R = {
|
|
147
|
-
maxWorkers: e.maxWorkers,
|
|
148
|
-
basePathname: l,
|
|
149
|
-
outDir: f,
|
|
150
|
-
rootDir: y,
|
|
151
|
-
...e.ssg,
|
|
152
|
-
origin: r,
|
|
153
|
-
renderModulePath: h,
|
|
154
|
-
qwikRouterConfigModulePath: w
|
|
155
|
-
}, _ = await k.generate(R);
|
|
156
|
-
if (_.errors > 0) {
|
|
157
|
-
const S = new Error(
|
|
158
|
-
`Error while running SSG from "${e.name}" adapter. At least one path failed to render.`
|
|
159
|
-
);
|
|
160
|
-
S.stack = void 0, this.error(S);
|
|
161
|
-
}
|
|
162
|
-
i.push(..._.staticPaths);
|
|
163
|
-
}
|
|
164
|
-
await E(
|
|
165
|
-
f,
|
|
166
|
-
n,
|
|
167
|
-
d ? m(l, d) : l,
|
|
168
|
-
i,
|
|
169
|
-
!!e.cleanStaticGenerated
|
|
170
|
-
), typeof e.generate == "function" && await e.generate({
|
|
171
|
-
outputEntries: p,
|
|
172
|
-
serverOutDir: n,
|
|
173
|
-
clientOutDir: u,
|
|
174
|
-
clientPublicOutDir: f,
|
|
175
|
-
basePathname: l,
|
|
176
|
-
routes: a,
|
|
177
|
-
assetsDir: d,
|
|
178
|
-
warn: (r) => this.warn(r),
|
|
179
|
-
error: (r) => this.error(r)
|
|
180
|
-
}), this.warn(
|
|
181
|
-
`
|
|
182
|
-
==============================================
|
|
183
|
-
Note: Make sure that you are serving the built files with proper cache headers.
|
|
184
|
-
See https://qwik.dev/docs/deployments/#cache-headers for more information.
|
|
185
|
-
==============================================`
|
|
186
|
-
), e.ssg !== null && setTimeout(() => {
|
|
187
|
-
process.exit(0);
|
|
188
|
-
}, 5e3).unref();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function J(e = {}) {
|
|
195
|
-
const s = process?.env;
|
|
196
|
-
return x({
|
|
197
|
-
name: "cloudflare-pages",
|
|
198
|
-
origin: s?.CF_PAGES_URL ?? s?.ORIGIN ?? "https://your.cloudflare.pages.dev",
|
|
199
|
-
ssg: e.ssg,
|
|
200
|
-
staticPaths: e.staticPaths,
|
|
201
|
-
cleanStaticGenerated: !0,
|
|
202
|
-
config() {
|
|
203
|
-
return {
|
|
204
|
-
resolve: {
|
|
205
|
-
conditions: ["webworker", "worker"]
|
|
206
|
-
},
|
|
207
|
-
ssr: {
|
|
208
|
-
target: "webworker",
|
|
209
|
-
noExternal: !0,
|
|
210
|
-
external: ["node:async_hooks"]
|
|
211
|
-
},
|
|
212
|
-
build: {
|
|
213
|
-
ssr: !0,
|
|
214
|
-
rollupOptions: {
|
|
215
|
-
output: {
|
|
216
|
-
format: "es",
|
|
217
|
-
hoistTransitiveImports: !1
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
publicDir: !1
|
|
222
|
-
};
|
|
223
|
-
},
|
|
224
|
-
async generate({ clientOutDir: t, serverOutDir: n, basePathname: h, assetsDir: w }) {
|
|
225
|
-
const o = m(t, "_routes.json");
|
|
226
|
-
if (!g.existsSync(o) && e.functionRoutes !== !1) {
|
|
227
|
-
let a = w ? m(h, w) : h;
|
|
228
|
-
a.endsWith("/") || (a += "/");
|
|
229
|
-
const l = {
|
|
230
|
-
version: 1,
|
|
231
|
-
include: [h + "*"],
|
|
232
|
-
exclude: [a + "build/*", a + "assets/*"]
|
|
233
|
-
};
|
|
234
|
-
await g.promises.writeFile(o, JSON.stringify(l, void 0, 2));
|
|
235
|
-
}
|
|
236
|
-
const c = m(t, "_worker.js");
|
|
237
|
-
if (!g.existsSync(c)) {
|
|
238
|
-
const a = O(t, m(n, "entry.cloudflare-pages"));
|
|
239
|
-
await g.promises.writeFile(
|
|
240
|
-
c,
|
|
241
|
-
`import { fetch } from "${v(a)}"; export default { fetch };`
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
export {
|
|
248
|
-
J as c,
|
|
249
|
-
C as n
|
|
250
|
-
};
|