@qwik.dev/router 2.0.0-beta.4 → 2.0.0-beta.41
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/adapters/static/vite.d.ts +1 -1
- package/lib/adapters/azure-swa/vite/index.d.ts +2 -2
- package/lib/adapters/azure-swa/vite/index.mjs +44 -58
- package/lib/adapters/bun-server/vite/index.d.ts +2 -2
- package/lib/adapters/bun-server/vite/index.mjs +16 -23
- package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
- package/lib/adapters/cloud-run/vite/index.mjs +15 -20
- package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
- package/lib/adapters/cloudflare-pages/vite/index.mjs +45 -77
- package/lib/adapters/deno-server/vite/index.d.ts +2 -2
- package/lib/adapters/deno-server/vite/index.mjs +25 -35
- package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
- package/lib/adapters/netlify-edge/vite/index.mjs +49 -89
- package/lib/adapters/node-server/vite/index.d.ts +2 -2
- package/lib/adapters/node-server/vite/index.mjs +16 -23
- package/lib/adapters/shared/vite/index.d.ts +9 -22
- package/lib/adapters/shared/vite/index.mjs +280 -333
- package/lib/adapters/ssg/vite/index.d.ts +13 -0
- package/lib/adapters/ssg/vite/index.mjs +13 -0
- package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
- package/lib/adapters/vercel-edge/vite/index.mjs +73 -80
- package/lib/chunks/dev-preloaded-route-loader.mjs +2 -0
- package/lib/chunks/format.mjs +24 -0
- package/lib/chunks/fs.mjs +140 -0
- package/lib/chunks/head.qwik.mjs +1202 -0
- package/lib/chunks/http-error.qwik.mjs +27 -0
- package/lib/chunks/pathname.mjs +57 -0
- package/lib/chunks/request-body-limit.mjs +27 -0
- package/lib/chunks/request-path.mjs +49 -0
- package/lib/chunks/routes.mjs +26 -0
- package/lib/chunks/server-error.mjs +16 -0
- package/lib/chunks/system.mjs +265 -0
- package/lib/chunks/url.mjs +59 -0
- package/lib/chunks/user-response.mjs +1730 -0
- package/lib/chunks/worker-thread.mjs +264 -0
- package/lib/index.d.ts +631 -174
- package/lib/index.qwik.mjs +1656 -1964
- package/lib/middleware/aws-lambda/index.d.ts +15 -16
- package/lib/middleware/aws-lambda/index.mjs +45 -54
- package/lib/middleware/azure-swa/index.mjs +85 -295
- package/lib/middleware/bun/index.d.ts +20 -5
- package/lib/middleware/bun/index.mjs +119 -205
- package/lib/middleware/cloudflare-pages/index.mjs +88 -105
- package/lib/middleware/deno/index.d.ts +22 -5
- package/lib/middleware/deno/index.mjs +105 -192
- package/lib/middleware/firebase/index.mjs +22 -35
- package/lib/middleware/netlify-edge/index.mjs +63 -81
- package/lib/middleware/node/index.d.ts +17 -5
- package/lib/middleware/node/index.mjs +299 -273
- package/lib/middleware/request-handler/index.d.ts +206 -99
- package/lib/middleware/request-handler/index.mjs +105 -1648
- package/lib/middleware/vercel-edge/index.mjs +76 -101
- package/lib/modules.d.ts +11 -16
- package/lib/service-worker/index.mjs +13 -0
- package/lib/{static → ssg}/index.d.ts +46 -22
- package/lib/ssg/index.mjs +257 -0
- package/lib/vite/index.d.ts +58 -10
- package/lib/vite/index.mjs +2471 -27446
- package/modules.d.ts +11 -16
- package/package.json +62 -70
- package/ssg.d.ts +2 -0
- package/static.d.ts +1 -1
- package/lib/adapters/azure-swa/vite/index.cjs +0 -96
- package/lib/adapters/bun-server/vite/index.cjs +0 -50
- package/lib/adapters/cloud-run/vite/index.cjs +0 -47
- package/lib/adapters/cloudflare-pages/vite/index.cjs +0 -115
- package/lib/adapters/deno-server/vite/index.cjs +0 -62
- package/lib/adapters/netlify-edge/vite/index.cjs +0 -129
- package/lib/adapters/node-server/vite/index.cjs +0 -50
- package/lib/adapters/shared/vite/index.cjs +0 -378
- package/lib/adapters/static/vite/index.cjs +0 -368
- package/lib/adapters/static/vite/index.d.ts +0 -10
- package/lib/adapters/static/vite/index.mjs +0 -331
- package/lib/adapters/vercel-edge/vite/index.cjs +0 -118
- package/lib/index.qwik.cjs +0 -2022
- package/lib/middleware/node/index.cjs +0 -314
- package/lib/middleware/request-handler/index.cjs +0 -1691
- package/lib/service-worker.cjs +0 -17
- package/lib/service-worker.mjs +0 -15
- package/lib/static/deno.mjs +0 -8
- package/lib/static/index.cjs +0 -67
- package/lib/static/index.mjs +0 -48
- package/lib/static/node.cjs +0 -1126
- package/lib/static/node.mjs +0 -1088
- package/lib/vite/index.cjs +0 -27525
- package/middleware/request-handler/generated/not-found-paths.ts +0 -7
- package/middleware/request-handler/generated/static-paths.ts +0 -35
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// re-export for typescript in old resolution mode
|
|
2
|
-
export * from '../../lib/adapters/
|
|
2
|
+
export * from '../../lib/adapters/ssg/vite';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServerAdapterOptions } from '../../shared/vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SsgRenderOptions } from 'packages/qwik-router/src/ssg';
|
|
3
3
|
|
|
4
4
|
/** @public */
|
|
5
5
|
export declare function azureSwaAdapter(opts?: AzureSwaAdapterOptions): any;
|
|
@@ -8,6 +8,6 @@ export declare function azureSwaAdapter(opts?: AzureSwaAdapterOptions): any;
|
|
|
8
8
|
export declare interface AzureSwaAdapterOptions extends ServerAdapterOptions {
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export {
|
|
11
|
+
export { SsgRenderOptions }
|
|
12
12
|
|
|
13
13
|
export { }
|
|
@@ -1,61 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import { viteAdapter } from "../../shared/vite/index.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
],
|
|
47
|
-
scriptFile: azureSwaModulePath
|
|
48
|
-
},
|
|
49
|
-
null,
|
|
50
|
-
2
|
|
51
|
-
);
|
|
52
|
-
await fs.promises.writeFile(funcJsonPath, funcJson);
|
|
53
|
-
if (!fs.existsSync(join(clientPublicOutDir, "index.html"))) {
|
|
54
|
-
await fs.promises.writeFile(join(clientPublicOutDir, "index.html"), "");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
4
|
+
/** @public */ function azureSwaAdapter(opts = {}) {
|
|
5
|
+
const env = process?.env;
|
|
6
|
+
return viteAdapter({
|
|
7
|
+
name: "azure-swa",
|
|
8
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://yoursitename.region.2.azurestaticapps.net",
|
|
9
|
+
ssg: opts.ssg,
|
|
10
|
+
cleanStaticGenerated: true,
|
|
11
|
+
async generate({ outputEntries, serverOutDir, clientPublicOutDir }) {
|
|
12
|
+
const serverPackageJsonPath = join(serverOutDir, "package.json");
|
|
13
|
+
const serverPackageJsonCode = `{"type":"module"}`;
|
|
14
|
+
await fs.promises.mkdir(serverOutDir, { recursive: true });
|
|
15
|
+
await fs.promises.writeFile(serverPackageJsonPath, serverPackageJsonCode);
|
|
16
|
+
const azureSwaModulePath = outputEntries.find((entryName) => entryName.indexOf("entry.azure-swa") === 0);
|
|
17
|
+
const funcJsonPath = join(serverOutDir, "function.json");
|
|
18
|
+
const funcJson = JSON.stringify({
|
|
19
|
+
bindings: [{
|
|
20
|
+
authLevel: "anonymous",
|
|
21
|
+
type: "httpTrigger",
|
|
22
|
+
direction: "in",
|
|
23
|
+
name: "req",
|
|
24
|
+
methods: [
|
|
25
|
+
"get",
|
|
26
|
+
"head",
|
|
27
|
+
"post",
|
|
28
|
+
"put",
|
|
29
|
+
"delete",
|
|
30
|
+
"connect",
|
|
31
|
+
"options",
|
|
32
|
+
"trace",
|
|
33
|
+
"patch"
|
|
34
|
+
]
|
|
35
|
+
}, {
|
|
36
|
+
type: "http",
|
|
37
|
+
direction: "out",
|
|
38
|
+
name: "$return"
|
|
39
|
+
}],
|
|
40
|
+
scriptFile: azureSwaModulePath
|
|
41
|
+
}, null, 2);
|
|
42
|
+
await fs.promises.writeFile(funcJsonPath, funcJson);
|
|
43
|
+
if (!fs.existsSync(join(clientPublicOutDir, "index.html"))) await fs.promises.writeFile(join(clientPublicOutDir, "index.html"), "");
|
|
44
|
+
}
|
|
45
|
+
});
|
|
58
46
|
}
|
|
59
|
-
export {
|
|
60
|
-
azureSwaAdapter
|
|
61
|
-
};
|
|
47
|
+
export { azureSwaAdapter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServerAdapterOptions } from '../../shared/vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SsgRenderOptions } from 'packages/qwik-router/src/ssg';
|
|
3
3
|
|
|
4
4
|
/** @beta */
|
|
5
5
|
export declare function bunServerAdapter(opts?: bunServerAdapterOptions): any;
|
|
@@ -9,6 +9,6 @@ export declare interface bunServerAdapterOptions extends ServerAdapterOptions {
|
|
|
9
9
|
name?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { SsgRenderOptions }
|
|
13
13
|
|
|
14
14
|
export { }
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
// packages/qwik-router/src/adapters/bun-server/vite/index.ts
|
|
2
1
|
import { viteAdapter } from "../../shared/vite/index.mjs";
|
|
3
|
-
function bunServerAdapter(opts = {}) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
publicDir: false
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
});
|
|
2
|
+
/** @beta */ function bunServerAdapter(opts = {}) {
|
|
3
|
+
const env = process?.env;
|
|
4
|
+
return viteAdapter({
|
|
5
|
+
name: opts.name || "bun-server",
|
|
6
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://yoursitename.qwik.dev",
|
|
7
|
+
ssg: opts.ssg,
|
|
8
|
+
cleanStaticGenerated: true,
|
|
9
|
+
config() {
|
|
10
|
+
return {
|
|
11
|
+
ssr: { target: "node" },
|
|
12
|
+
build: { ssr: true },
|
|
13
|
+
publicDir: false
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
22
17
|
}
|
|
23
|
-
export {
|
|
24
|
-
bunServerAdapter
|
|
25
|
-
};
|
|
18
|
+
export { bunServerAdapter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServerAdapterOptions } from '../../shared/vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SsgRenderOptions } from 'packages/qwik-router/src/ssg';
|
|
3
3
|
|
|
4
4
|
/** @public */
|
|
5
5
|
export declare function cloudRunAdapter(opts?: CloudRunAdapterOptions): any;
|
|
@@ -8,6 +8,6 @@ export declare function cloudRunAdapter(opts?: CloudRunAdapterOptions): any;
|
|
|
8
8
|
export declare interface CloudRunAdapterOptions extends ServerAdapterOptions {
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export {
|
|
11
|
+
export { SsgRenderOptions }
|
|
12
12
|
|
|
13
13
|
export { }
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
// packages/qwik-router/src/adapters/cloud-run/vite/index.ts
|
|
2
1
|
import { viteAdapter } from "../../shared/vite/index.mjs";
|
|
3
|
-
function cloudRunAdapter(opts = {}) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
});
|
|
2
|
+
/** @public */ function cloudRunAdapter(opts = {}) {
|
|
3
|
+
const env = process?.env;
|
|
4
|
+
return viteAdapter({
|
|
5
|
+
name: "cloud-run",
|
|
6
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://your-app-name.run.app",
|
|
7
|
+
ssg: opts.ssg,
|
|
8
|
+
cleanStaticGenerated: true,
|
|
9
|
+
config() {
|
|
10
|
+
return {
|
|
11
|
+
build: { ssr: true },
|
|
12
|
+
publicDir: false
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
});
|
|
19
16
|
}
|
|
20
|
-
export {
|
|
21
|
-
cloudRunAdapter
|
|
22
|
-
};
|
|
17
|
+
export { cloudRunAdapter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServerAdapterOptions } from '../../shared/vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SsgRenderOptions } from 'packages/qwik-router/src/ssg';
|
|
3
3
|
|
|
4
4
|
/** @public */
|
|
5
5
|
export declare function cloudflarePagesAdapter(opts?: CloudflarePagesAdapterOptions): any;
|
|
@@ -22,6 +22,6 @@ export declare interface CloudflarePagesAdapterOptions extends ServerAdapterOpti
|
|
|
22
22
|
staticPaths?: string[];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export {
|
|
25
|
+
export { SsgRenderOptions }
|
|
26
26
|
|
|
27
27
|
export { }
|
|
@@ -1,80 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as ensureSlash } from "../../../chunks/pathname.mjs";
|
|
2
|
+
import { viteAdapter } from "../../shared/vite/index.mjs";
|
|
3
|
+
import { y as normalizePathSlash } from "../../../chunks/fs.mjs";
|
|
2
4
|
import fs from "node:fs";
|
|
3
5
|
import { join, relative } from "node:path";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
publicDir: false
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
async generate({ clientOutDir, serverOutDir, basePathname, assetsDir }) {
|
|
52
|
-
const routesJsonPath = join(clientOutDir, "_routes.json");
|
|
53
|
-
const hasRoutesJson = fs.existsSync(routesJsonPath);
|
|
54
|
-
if (!hasRoutesJson && opts.functionRoutes !== false) {
|
|
55
|
-
let pathName = assetsDir ? join(basePathname, assetsDir) : basePathname;
|
|
56
|
-
if (!pathName.endsWith("/")) {
|
|
57
|
-
pathName += "/";
|
|
58
|
-
}
|
|
59
|
-
const routesJson = {
|
|
60
|
-
version: 1,
|
|
61
|
-
include: [basePathname + "*"],
|
|
62
|
-
exclude: [pathName + "build/*", pathName + "assets/*"]
|
|
63
|
-
};
|
|
64
|
-
await fs.promises.writeFile(routesJsonPath, JSON.stringify(routesJson, void 0, 2));
|
|
65
|
-
}
|
|
66
|
-
const workerJsPath = join(clientOutDir, "_worker.js");
|
|
67
|
-
const hasWorkerJs = fs.existsSync(workerJsPath);
|
|
68
|
-
if (!hasWorkerJs) {
|
|
69
|
-
const importPath = relative(clientOutDir, join(serverOutDir, "entry.cloudflare-pages"));
|
|
70
|
-
await fs.promises.writeFile(
|
|
71
|
-
workerJsPath,
|
|
72
|
-
`import { fetch } from "${normalizePathSlash(importPath)}"; export default { fetch };`
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
6
|
+
/** @public */ function cloudflarePagesAdapter(opts = {}) {
|
|
7
|
+
const env = process?.env;
|
|
8
|
+
return viteAdapter({
|
|
9
|
+
name: "cloudflare-pages",
|
|
10
|
+
origin: env?.CF_PAGES_URL ?? env?.ORIGIN ?? "https://your.cloudflare.pages.dev",
|
|
11
|
+
ssg: opts.ssg,
|
|
12
|
+
staticPaths: opts.staticPaths,
|
|
13
|
+
cleanStaticGenerated: true,
|
|
14
|
+
config() {
|
|
15
|
+
return {
|
|
16
|
+
resolve: { conditions: ["webworker", "worker"] },
|
|
17
|
+
ssr: {
|
|
18
|
+
target: "webworker",
|
|
19
|
+
noExternal: true,
|
|
20
|
+
external: ["node:async_hooks"]
|
|
21
|
+
},
|
|
22
|
+
build: {
|
|
23
|
+
ssr: true,
|
|
24
|
+
rolldownOptions: { output: { format: "es" } }
|
|
25
|
+
},
|
|
26
|
+
publicDir: false
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
async generate({ clientOutDir, serverOutDir, basePathname }) {
|
|
30
|
+
const routesJsonPath = join(clientOutDir, "_routes.json");
|
|
31
|
+
if (!fs.existsSync(routesJsonPath) && opts.functionRoutes !== false) {
|
|
32
|
+
const pathName = ensureSlash(basePathname);
|
|
33
|
+
const routesJson = {
|
|
34
|
+
version: 1,
|
|
35
|
+
include: [basePathname + "*"],
|
|
36
|
+
exclude: [pathName + "build/*", pathName + "assets/*"]
|
|
37
|
+
};
|
|
38
|
+
await fs.promises.writeFile(routesJsonPath, JSON.stringify(routesJson, void 0, 2));
|
|
39
|
+
}
|
|
40
|
+
const workerJsPath = join(clientOutDir, "_worker.js");
|
|
41
|
+
if (!fs.existsSync(workerJsPath)) {
|
|
42
|
+
const importPath = relative(clientOutDir, join(serverOutDir, "entry.cloudflare-pages"));
|
|
43
|
+
await fs.promises.writeFile(workerJsPath, `import { fetch } from "${normalizePathSlash(importPath)}"; export default { fetch };`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
77
47
|
}
|
|
78
|
-
export {
|
|
79
|
-
cloudflarePagesAdapter
|
|
80
|
-
};
|
|
48
|
+
export { cloudflarePagesAdapter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServerAdapterOptions } from '../../shared/vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SsgRenderOptions } from 'packages/qwik-router/src/ssg';
|
|
3
3
|
|
|
4
4
|
/** @beta */
|
|
5
5
|
export declare function denoServerAdapter(opts?: DenoServerAdapterOptions): any;
|
|
@@ -9,6 +9,6 @@ export declare interface DenoServerAdapterOptions extends ServerAdapterOptions {
|
|
|
9
9
|
name?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { SsgRenderOptions }
|
|
13
13
|
|
|
14
14
|
export { }
|
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
// packages/qwik-router/src/adapters/deno-server/vite/index.ts
|
|
2
1
|
import { viteAdapter } from "../../shared/vite/index.mjs";
|
|
3
|
-
function denoServerAdapter(opts = {}) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
publicDir: false
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
});
|
|
2
|
+
/** @beta */ function denoServerAdapter(opts = {}) {
|
|
3
|
+
const env = process?.env;
|
|
4
|
+
return viteAdapter({
|
|
5
|
+
name: opts.name || "deno-server",
|
|
6
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://yoursitename.qwik.dev",
|
|
7
|
+
ssg: opts.ssg,
|
|
8
|
+
cleanStaticGenerated: true,
|
|
9
|
+
config() {
|
|
10
|
+
return {
|
|
11
|
+
resolve: { conditions: ["webworker", "worker"] },
|
|
12
|
+
ssr: {
|
|
13
|
+
target: "webworker",
|
|
14
|
+
noExternal: true,
|
|
15
|
+
external: ["node:async_hooks"]
|
|
16
|
+
},
|
|
17
|
+
build: {
|
|
18
|
+
ssr: true,
|
|
19
|
+
target: "esnext",
|
|
20
|
+
rolldownOptions: { output: { format: "es" } }
|
|
21
|
+
},
|
|
22
|
+
publicDir: false
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
});
|
|
34
26
|
}
|
|
35
|
-
export {
|
|
36
|
-
denoServerAdapter
|
|
37
|
-
};
|
|
27
|
+
export { denoServerAdapter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServerAdapterOptions } from '../../shared/vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SsgRenderOptions } from 'packages/qwik-router/src/ssg';
|
|
3
3
|
|
|
4
4
|
/** @public */
|
|
5
5
|
export declare function netlifyEdgeAdapter(opts?: NetlifyEdgeAdapterOptions): any;
|
|
@@ -39,6 +39,6 @@ export declare interface NetlifyEdgeAdapterOptions extends ServerAdapterOptions
|
|
|
39
39
|
excludedPath?: string | string[];
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export {
|
|
42
|
+
export { SsgRenderOptions }
|
|
43
43
|
|
|
44
44
|
export { }
|
|
@@ -1,92 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
var basePathname = "/";
|
|
3
|
-
|
|
4
|
-
// packages/qwik-router/src/adapters/netlify-edge/vite/index.ts
|
|
1
|
+
import { getParentDir, viteAdapter } from "../../shared/vite/index.mjs";
|
|
5
2
|
import fs, { existsSync } from "node:fs";
|
|
6
3
|
import { join } from "node:path";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"/~partytown/*",
|
|
55
|
-
"/service-worker.js",
|
|
56
|
-
"/sitemap.xml"
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
const netlifyEdgeManifest = {
|
|
60
|
-
functions: [
|
|
61
|
-
{
|
|
62
|
-
path: basePathname + "*",
|
|
63
|
-
function: "entry.netlify-edge",
|
|
64
|
-
cache: "manual",
|
|
65
|
-
excludedPath
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
version: 1
|
|
69
|
-
};
|
|
70
|
-
const jsPath = join(serverOutDir, "entry.netlify-edge.js");
|
|
71
|
-
const mjsPath = join(serverOutDir, "entry.netlify-edge.mjs");
|
|
72
|
-
if (existsSync(mjsPath)) {
|
|
73
|
-
await fs.promises.writeFile(
|
|
74
|
-
jsPath,
|
|
75
|
-
[
|
|
76
|
-
`import entry_netlifyEdge from './entry.netlify-edge.mjs';`,
|
|
77
|
-
`export default entry_netlifyEdge;`
|
|
78
|
-
].join("\n")
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
const netlifyEdgeFnsDir = getParentDir(serverOutDir, "edge-functions");
|
|
82
|
-
await fs.promises.writeFile(
|
|
83
|
-
join(netlifyEdgeFnsDir, "manifest.json"),
|
|
84
|
-
JSON.stringify(netlifyEdgeManifest, null, 2)
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
4
|
+
/** @public */ function netlifyEdgeAdapter(opts = {}) {
|
|
5
|
+
const env = process?.env;
|
|
6
|
+
return viteAdapter({
|
|
7
|
+
name: "netlify-edge",
|
|
8
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://yoursitename.netlify.app",
|
|
9
|
+
ssg: opts.ssg,
|
|
10
|
+
staticPaths: opts.staticPaths,
|
|
11
|
+
cleanStaticGenerated: true,
|
|
12
|
+
config(config) {
|
|
13
|
+
return {
|
|
14
|
+
resolve: { conditions: ["webworker", "worker"] },
|
|
15
|
+
ssr: {
|
|
16
|
+
target: "webworker",
|
|
17
|
+
noExternal: true,
|
|
18
|
+
external: ["node:async_hooks"]
|
|
19
|
+
},
|
|
20
|
+
build: {
|
|
21
|
+
ssr: true,
|
|
22
|
+
outDir: config.build?.outDir || ".netlify/edge-functions/entry.netlify-edge",
|
|
23
|
+
rolldownOptions: { output: { format: "es" } }
|
|
24
|
+
},
|
|
25
|
+
publicDir: false
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
async generate({ serverOutDir, basePathname }) {
|
|
29
|
+
if (opts.functionRoutes !== false) {
|
|
30
|
+
const excludedPath = [];
|
|
31
|
+
if (typeof opts.excludedPath === "string") excludedPath.push(opts.excludedPath);
|
|
32
|
+
else if (Array.isArray(opts.excludedPath)) excludedPath.push(...opts.excludedPath);
|
|
33
|
+
else excludedPath.push("/build/*", "/favicon.ico", "/robots.txt", "/mainifest.json", "/~partytown/*", "/service-worker.js", "/sitemap.xml");
|
|
34
|
+
const netlifyEdgeManifest = {
|
|
35
|
+
functions: [{
|
|
36
|
+
path: basePathname + "*",
|
|
37
|
+
function: "entry.netlify-edge",
|
|
38
|
+
cache: "manual",
|
|
39
|
+
excludedPath
|
|
40
|
+
}],
|
|
41
|
+
version: 1
|
|
42
|
+
};
|
|
43
|
+
const jsPath = join(serverOutDir, "entry.netlify-edge.js");
|
|
44
|
+
const mjsPath = join(serverOutDir, "entry.netlify-edge.mjs");
|
|
45
|
+
if (existsSync(mjsPath)) await fs.promises.writeFile(jsPath, [`import entry_netlifyEdge from './entry.netlify-edge.mjs';`, `export default entry_netlifyEdge;`].join("\n"));
|
|
46
|
+
const netlifyEdgeFnsDir = getParentDir(serverOutDir, "edge-functions");
|
|
47
|
+
await fs.promises.writeFile(join(netlifyEdgeFnsDir, "manifest.json"), JSON.stringify(netlifyEdgeManifest, null, 2));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
89
51
|
}
|
|
90
|
-
export {
|
|
91
|
-
netlifyEdgeAdapter
|
|
92
|
-
};
|
|
52
|
+
export { netlifyEdgeAdapter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServerAdapterOptions } from '../../shared/vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SsgRenderOptions } from 'packages/qwik-router/src/ssg';
|
|
3
3
|
|
|
4
4
|
/** @beta */
|
|
5
5
|
export declare function nodeServerAdapter(opts?: NodeServerAdapterOptions): any;
|
|
@@ -9,6 +9,6 @@ export declare interface NodeServerAdapterOptions extends ServerAdapterOptions {
|
|
|
9
9
|
name?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { SsgRenderOptions }
|
|
13
13
|
|
|
14
14
|
export { }
|