@qwik.dev/router 2.0.0-beta.3 → 2.0.0-beta.30
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 +39 -44
- package/lib/adapters/bun-server/vite/index.d.ts +2 -2
- package/lib/adapters/bun-server/vite/index.mjs +6 -7
- package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
- package/lib/adapters/cloud-run/vite/index.mjs +6 -7
- package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
- package/lib/adapters/cloudflare-pages/vite/index.mjs +23 -32
- package/lib/adapters/deno-server/vite/index.d.ts +2 -2
- package/lib/adapters/deno-server/vite/index.mjs +13 -9
- package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
- package/lib/adapters/netlify-edge/vite/index.mjs +22 -36
- package/lib/adapters/node-server/vite/index.d.ts +2 -2
- package/lib/adapters/node-server/vite/index.mjs +6 -7
- package/lib/adapters/shared/vite/index.d.ts +7 -19
- package/lib/adapters/shared/vite/index.mjs +244 -233
- package/lib/adapters/ssg/vite/index.d.ts +13 -0
- package/lib/adapters/ssg/vite/index.mjs +17 -0
- package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
- package/lib/adapters/vercel-edge/vite/index.mjs +33 -19
- package/lib/chunks/deepFreeze.qwik.mjs +18 -0
- package/lib/chunks/error-handler.mjs +57 -0
- package/lib/chunks/fs.mjs +144 -0
- package/lib/chunks/http-error.qwik.mjs +35 -0
- package/lib/chunks/mime-types.mjs +52 -0
- package/lib/chunks/not-found-wrapper.qwik.mjs +25 -0
- package/lib/chunks/pathname.mjs +105 -0
- package/lib/chunks/redirect-handler.mjs +6 -0
- package/lib/chunks/routing.qwik.mjs +820 -0
- package/lib/chunks/system.mjs +333 -0
- package/lib/chunks/use-functions.qwik.mjs +35 -0
- package/lib/chunks/worker-thread.qwik.mjs +2572 -0
- package/lib/index.d.ts +358 -141
- package/lib/index.qwik.mjs +865 -1156
- package/lib/middleware/aws-lambda/index.d.ts +3 -2
- package/lib/middleware/aws-lambda/index.mjs +15 -13
- package/lib/middleware/azure-swa/index.mjs +17 -218
- package/lib/middleware/bun/index.d.ts +11 -0
- package/lib/middleware/bun/index.mjs +51 -94
- package/lib/middleware/cloudflare-pages/index.mjs +23 -28
- package/lib/middleware/deno/index.d.ts +11 -0
- package/lib/middleware/deno/index.mjs +50 -94
- package/lib/middleware/firebase/index.mjs +7 -11
- package/lib/middleware/netlify-edge/index.mjs +23 -29
- package/lib/middleware/node/index.mjs +31 -100
- package/lib/middleware/request-handler/index.d.ts +161 -83
- package/lib/middleware/request-handler/index.mjs +1458 -1257
- package/lib/middleware/vercel-edge/index.mjs +28 -33
- package/lib/modules.d.ts +11 -16
- package/lib/service-worker/index.mjs +4 -0
- package/lib/{static → ssg}/index.d.ts +45 -13
- package/lib/ssg/index.mjs +336 -0
- package/lib/vite/index.d.ts +38 -10
- package/lib/vite/index.mjs +2067 -26841
- package/modules.d.ts +11 -16
- package/package.json +62 -67
- 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 -1947
- package/lib/middleware/node/index.cjs +0 -314
- package/lib/middleware/request-handler/index.cjs +0 -1614
- 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 -1124
- package/lib/static/node.mjs +0 -1086
- package/lib/vite/index.cjs +0 -27445
- 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,54 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { viteAdapter } from '../../shared/vite/index.mjs';
|
|
4
|
+
|
|
5
5
|
function azureSwaAdapter(opts = {}) {
|
|
6
|
-
const env = process
|
|
6
|
+
const env = process?.env;
|
|
7
7
|
return viteAdapter({
|
|
8
8
|
name: "azure-swa",
|
|
9
|
-
origin:
|
|
9
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://yoursitename.region.2.azurestaticapps.net",
|
|
10
10
|
ssg: opts.ssg,
|
|
11
11
|
cleanStaticGenerated: true,
|
|
12
12
|
async generate({ outputEntries, serverOutDir, clientPublicOutDir }) {
|
|
13
13
|
const serverPackageJsonPath = join(serverOutDir, "package.json");
|
|
14
14
|
const serverPackageJsonCode = `{"type":"module"}`;
|
|
15
|
-
await fs.promises.mkdir(serverOutDir, {
|
|
15
|
+
await fs.promises.mkdir(serverOutDir, {
|
|
16
|
+
recursive: true
|
|
17
|
+
});
|
|
16
18
|
await fs.promises.writeFile(serverPackageJsonPath, serverPackageJsonCode);
|
|
17
|
-
const azureSwaModulePath = outputEntries.find(
|
|
18
|
-
(entryName) => entryName.indexOf("entry.azure-swa") === 0
|
|
19
|
-
);
|
|
19
|
+
const azureSwaModulePath = outputEntries.find((entryName) => entryName.indexOf("entry.azure-swa") === 0);
|
|
20
20
|
const funcJsonPath = join(serverOutDir, "function.json");
|
|
21
|
-
const funcJson = JSON.stringify(
|
|
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
|
-
null,
|
|
50
|
-
2
|
|
51
|
-
);
|
|
21
|
+
const funcJson = JSON.stringify({
|
|
22
|
+
bindings: [
|
|
23
|
+
{
|
|
24
|
+
authLevel: "anonymous",
|
|
25
|
+
type: "httpTrigger",
|
|
26
|
+
direction: "in",
|
|
27
|
+
name: "req",
|
|
28
|
+
methods: [
|
|
29
|
+
"get",
|
|
30
|
+
"head",
|
|
31
|
+
"post",
|
|
32
|
+
"put",
|
|
33
|
+
"delete",
|
|
34
|
+
"connect",
|
|
35
|
+
"options",
|
|
36
|
+
"trace",
|
|
37
|
+
"patch"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: "http",
|
|
42
|
+
direction: "out",
|
|
43
|
+
name: "$return"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
scriptFile: azureSwaModulePath
|
|
47
|
+
}, null, 2);
|
|
52
48
|
await fs.promises.writeFile(funcJsonPath, funcJson);
|
|
53
49
|
if (!fs.existsSync(join(clientPublicOutDir, "index.html"))) {
|
|
54
50
|
await fs.promises.writeFile(join(clientPublicOutDir, "index.html"), "");
|
|
@@ -56,6 +52,5 @@ function azureSwaAdapter(opts = {}) {
|
|
|
56
52
|
}
|
|
57
53
|
});
|
|
58
54
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
55
|
+
|
|
56
|
+
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,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { viteAdapter } from '../../shared/vite/index.mjs';
|
|
2
|
+
|
|
3
3
|
function bunServerAdapter(opts = {}) {
|
|
4
|
-
const env = process
|
|
4
|
+
const env = process?.env;
|
|
5
5
|
return viteAdapter({
|
|
6
6
|
name: opts.name || "bun-server",
|
|
7
|
-
origin:
|
|
7
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://yoursitename.qwik.dev",
|
|
8
8
|
ssg: opts.ssg,
|
|
9
9
|
cleanStaticGenerated: true,
|
|
10
10
|
config() {
|
|
@@ -20,6 +20,5 @@ function bunServerAdapter(opts = {}) {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
23
|
+
|
|
24
|
+
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,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { viteAdapter } from '../../shared/vite/index.mjs';
|
|
2
|
+
|
|
3
3
|
function cloudRunAdapter(opts = {}) {
|
|
4
|
-
const env = process
|
|
4
|
+
const env = process?.env;
|
|
5
5
|
return viteAdapter({
|
|
6
6
|
name: "cloud-run",
|
|
7
|
-
origin:
|
|
7
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://your-app-name.run.app",
|
|
8
8
|
ssg: opts.ssg,
|
|
9
9
|
cleanStaticGenerated: true,
|
|
10
10
|
config() {
|
|
@@ -17,6 +17,5 @@ function cloudRunAdapter(opts = {}) {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
20
|
+
|
|
21
|
+
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,40 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { join, relative } from 'node:path';
|
|
3
|
+
import { n as normalizePathSlash } from '../../../chunks/fs.mjs';
|
|
4
|
+
import { viteAdapter } from '../../shared/vite/index.mjs';
|
|
4
5
|
|
|
5
|
-
// packages/qwik-router/src/utils/fs.ts
|
|
6
|
-
function normalizePathSlash(path) {
|
|
7
|
-
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
|
|
8
|
-
const hasNonAscii = /[^\u0000-\u0080]+/.test(path);
|
|
9
|
-
if (isExtendedLengthPath || hasNonAscii) {
|
|
10
|
-
return path;
|
|
11
|
-
}
|
|
12
|
-
path = path.replace(/\\/g, "/");
|
|
13
|
-
if (path.endsWith("/")) {
|
|
14
|
-
path = path.slice(0, path.length - 1);
|
|
15
|
-
}
|
|
16
|
-
return path;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// packages/qwik-router/src/adapters/cloudflare-pages/vite/index.ts
|
|
20
|
-
import { viteAdapter } from "../../shared/vite/index.mjs";
|
|
21
6
|
function cloudflarePagesAdapter(opts = {}) {
|
|
22
|
-
const env = process
|
|
7
|
+
const env = process?.env;
|
|
23
8
|
return viteAdapter({
|
|
24
9
|
name: "cloudflare-pages",
|
|
25
|
-
origin:
|
|
10
|
+
origin: env?.CF_PAGES_URL ?? env?.ORIGIN ?? "https://your.cloudflare.pages.dev",
|
|
26
11
|
ssg: opts.ssg,
|
|
27
12
|
staticPaths: opts.staticPaths,
|
|
28
13
|
cleanStaticGenerated: true,
|
|
29
14
|
config() {
|
|
30
15
|
return {
|
|
31
16
|
resolve: {
|
|
32
|
-
conditions: [
|
|
17
|
+
conditions: [
|
|
18
|
+
"webworker",
|
|
19
|
+
"worker"
|
|
20
|
+
]
|
|
33
21
|
},
|
|
34
22
|
ssr: {
|
|
35
23
|
target: "webworker",
|
|
36
24
|
noExternal: true,
|
|
37
|
-
external: [
|
|
25
|
+
external: [
|
|
26
|
+
"node:async_hooks"
|
|
27
|
+
]
|
|
38
28
|
},
|
|
39
29
|
build: {
|
|
40
30
|
ssr: true,
|
|
@@ -58,8 +48,13 @@ function cloudflarePagesAdapter(opts = {}) {
|
|
|
58
48
|
}
|
|
59
49
|
const routesJson = {
|
|
60
50
|
version: 1,
|
|
61
|
-
include: [
|
|
62
|
-
|
|
51
|
+
include: [
|
|
52
|
+
basePathname + "*"
|
|
53
|
+
],
|
|
54
|
+
exclude: [
|
|
55
|
+
pathName + "build/*",
|
|
56
|
+
pathName + "assets/*"
|
|
57
|
+
]
|
|
63
58
|
};
|
|
64
59
|
await fs.promises.writeFile(routesJsonPath, JSON.stringify(routesJson, void 0, 2));
|
|
65
60
|
}
|
|
@@ -67,14 +62,10 @@ function cloudflarePagesAdapter(opts = {}) {
|
|
|
67
62
|
const hasWorkerJs = fs.existsSync(workerJsPath);
|
|
68
63
|
if (!hasWorkerJs) {
|
|
69
64
|
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
|
-
);
|
|
65
|
+
await fs.promises.writeFile(workerJsPath, `import { fetch } from "${normalizePathSlash(importPath)}"; export default { fetch };`);
|
|
74
66
|
}
|
|
75
67
|
}
|
|
76
68
|
});
|
|
77
69
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
70
|
+
|
|
71
|
+
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,21 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { viteAdapter } from '../../shared/vite/index.mjs';
|
|
2
|
+
|
|
3
3
|
function denoServerAdapter(opts = {}) {
|
|
4
|
-
const env = process
|
|
4
|
+
const env = process?.env;
|
|
5
5
|
return viteAdapter({
|
|
6
6
|
name: opts.name || "deno-server",
|
|
7
|
-
origin:
|
|
7
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://yoursitename.qwik.dev",
|
|
8
8
|
ssg: opts.ssg,
|
|
9
9
|
cleanStaticGenerated: true,
|
|
10
10
|
config() {
|
|
11
11
|
return {
|
|
12
12
|
resolve: {
|
|
13
|
-
conditions: [
|
|
13
|
+
conditions: [
|
|
14
|
+
"webworker",
|
|
15
|
+
"worker"
|
|
16
|
+
]
|
|
14
17
|
},
|
|
15
18
|
ssr: {
|
|
16
19
|
target: "webworker",
|
|
17
20
|
noExternal: true,
|
|
18
|
-
external: [
|
|
21
|
+
external: [
|
|
22
|
+
"node:async_hooks"
|
|
23
|
+
]
|
|
19
24
|
},
|
|
20
25
|
build: {
|
|
21
26
|
ssr: true,
|
|
@@ -32,6 +37,5 @@ function denoServerAdapter(opts = {}) {
|
|
|
32
37
|
}
|
|
33
38
|
});
|
|
34
39
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
40
|
+
|
|
41
|
+
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,29 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs, { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { viteAdapter, getParentDir } from '../../shared/vite/index.mjs';
|
|
3
4
|
|
|
4
|
-
// packages/qwik-router/src/adapters/netlify-edge/vite/index.ts
|
|
5
|
-
import fs, { existsSync } from "node:fs";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { getParentDir, viteAdapter } from "../../shared/vite/index.mjs";
|
|
8
5
|
function netlifyEdgeAdapter(opts = {}) {
|
|
9
|
-
const env = process
|
|
6
|
+
const env = process?.env;
|
|
10
7
|
return viteAdapter({
|
|
11
8
|
name: "netlify-edge",
|
|
12
|
-
origin:
|
|
9
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://yoursitename.netlify.app",
|
|
13
10
|
ssg: opts.ssg,
|
|
14
11
|
staticPaths: opts.staticPaths,
|
|
15
12
|
cleanStaticGenerated: true,
|
|
16
13
|
config(config) {
|
|
17
|
-
|
|
18
|
-
const outDir = ((_a = config.build) == null ? void 0 : _a.outDir) || ".netlify/edge-functions/entry.netlify-edge";
|
|
14
|
+
const outDir = config.build?.outDir || ".netlify/edge-functions/entry.netlify-edge";
|
|
19
15
|
return {
|
|
20
16
|
resolve: {
|
|
21
|
-
conditions: [
|
|
17
|
+
conditions: [
|
|
18
|
+
"webworker",
|
|
19
|
+
"worker"
|
|
20
|
+
]
|
|
22
21
|
},
|
|
23
22
|
ssr: {
|
|
24
23
|
target: "webworker",
|
|
25
24
|
noExternal: true,
|
|
26
|
-
external: [
|
|
25
|
+
external: [
|
|
26
|
+
"node:async_hooks"
|
|
27
|
+
]
|
|
27
28
|
},
|
|
28
29
|
build: {
|
|
29
30
|
ssr: true,
|
|
@@ -38,7 +39,7 @@ function netlifyEdgeAdapter(opts = {}) {
|
|
|
38
39
|
publicDir: false
|
|
39
40
|
};
|
|
40
41
|
},
|
|
41
|
-
async generate({ serverOutDir }) {
|
|
42
|
+
async generate({ serverOutDir, basePathname }) {
|
|
42
43
|
if (opts.functionRoutes !== false) {
|
|
43
44
|
const excludedPath = [];
|
|
44
45
|
if (typeof opts.excludedPath === "string") {
|
|
@@ -46,15 +47,7 @@ function netlifyEdgeAdapter(opts = {}) {
|
|
|
46
47
|
} else if (Array.isArray(opts.excludedPath)) {
|
|
47
48
|
excludedPath.push(...opts.excludedPath);
|
|
48
49
|
} else {
|
|
49
|
-
excludedPath.push(
|
|
50
|
-
"/build/*",
|
|
51
|
-
"/favicon.ico",
|
|
52
|
-
"/robots.txt",
|
|
53
|
-
"/mainifest.json",
|
|
54
|
-
"/~partytown/*",
|
|
55
|
-
"/service-worker.js",
|
|
56
|
-
"/sitemap.xml"
|
|
57
|
-
);
|
|
50
|
+
excludedPath.push("/build/*", "/favicon.ico", "/robots.txt", "/mainifest.json", "/~partytown/*", "/service-worker.js", "/sitemap.xml");
|
|
58
51
|
}
|
|
59
52
|
const netlifyEdgeManifest = {
|
|
60
53
|
functions: [
|
|
@@ -70,23 +63,16 @@ function netlifyEdgeAdapter(opts = {}) {
|
|
|
70
63
|
const jsPath = join(serverOutDir, "entry.netlify-edge.js");
|
|
71
64
|
const mjsPath = join(serverOutDir, "entry.netlify-edge.mjs");
|
|
72
65
|
if (existsSync(mjsPath)) {
|
|
73
|
-
await fs.promises.writeFile(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
`export default entry_netlifyEdge;`
|
|
78
|
-
].join("\n")
|
|
79
|
-
);
|
|
66
|
+
await fs.promises.writeFile(jsPath, [
|
|
67
|
+
`import entry_netlifyEdge from './entry.netlify-edge.mjs';`,
|
|
68
|
+
`export default entry_netlifyEdge;`
|
|
69
|
+
].join("\n"));
|
|
80
70
|
}
|
|
81
71
|
const netlifyEdgeFnsDir = getParentDir(serverOutDir, "edge-functions");
|
|
82
|
-
await fs.promises.writeFile(
|
|
83
|
-
join(netlifyEdgeFnsDir, "manifest.json"),
|
|
84
|
-
JSON.stringify(netlifyEdgeManifest, null, 2)
|
|
85
|
-
);
|
|
72
|
+
await fs.promises.writeFile(join(netlifyEdgeFnsDir, "manifest.json"), JSON.stringify(netlifyEdgeManifest, null, 2));
|
|
86
73
|
}
|
|
87
74
|
}
|
|
88
75
|
});
|
|
89
76
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
};
|
|
77
|
+
|
|
78
|
+
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 { }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { viteAdapter } from '../../shared/vite/index.mjs';
|
|
2
|
+
|
|
3
3
|
function nodeServerAdapter(opts = {}) {
|
|
4
|
-
const env = process
|
|
4
|
+
const env = process?.env;
|
|
5
5
|
return viteAdapter({
|
|
6
6
|
name: opts.name || "node-server",
|
|
7
|
-
origin:
|
|
7
|
+
origin: env?.ORIGIN ?? env?.URL ?? "https://yoursitename.qwik.dev",
|
|
8
8
|
ssg: opts.ssg,
|
|
9
9
|
cleanStaticGenerated: true,
|
|
10
10
|
config() {
|
|
@@ -20,6 +20,5 @@ function nodeServerAdapter(opts = {}) {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
23
|
+
|
|
24
|
+
export { nodeServerAdapter };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Plugin as Plugin_2 } from 'vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SsgRenderOptions } from 'packages/qwik-router/src/ssg';
|
|
3
3
|
import type { UserConfig } from 'vite';
|
|
4
4
|
|
|
5
5
|
/** @public */
|
|
6
|
-
export declare interface AdapterSSGOptions extends Omit<
|
|
6
|
+
export declare interface AdapterSSGOptions extends Omit<SsgRenderOptions, 'outDir' | 'origin'> {
|
|
7
7
|
/** Defines routes that should be static generated. Accepts wildcard behavior. */
|
|
8
8
|
include: string[];
|
|
9
9
|
/**
|
|
@@ -26,7 +26,7 @@ export declare interface AdapterSSGOptions extends Omit<StaticGenerateRenderOpti
|
|
|
26
26
|
origin?: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
declare interface
|
|
29
|
+
declare interface BuiltLayout {
|
|
30
30
|
filePath: string;
|
|
31
31
|
dirPath: string;
|
|
32
32
|
id: string;
|
|
@@ -34,7 +34,7 @@ declare interface BuildLayout {
|
|
|
34
34
|
layoutName: string;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
declare interface
|
|
37
|
+
declare interface BuiltRoute extends ParsedPathname {
|
|
38
38
|
/** Unique id built from its relative file system path */
|
|
39
39
|
id: string;
|
|
40
40
|
/** Local file system path */
|
|
@@ -42,15 +42,12 @@ declare interface BuildRoute extends ParsedPathname {
|
|
|
42
42
|
ext: string;
|
|
43
43
|
/** URL Pathname */
|
|
44
44
|
pathname: string;
|
|
45
|
-
layouts:
|
|
45
|
+
layouts: BuiltLayout[];
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/** @public */
|
|
49
49
|
export declare function getParentDir(startDir: string, dirName: string): string;
|
|
50
50
|
|
|
51
|
-
/** @public */
|
|
52
|
-
export declare const NOT_FOUND_PATHS_ID = "@qwik-router-not-found-paths";
|
|
53
|
-
|
|
54
51
|
declare interface ParsedPathname {
|
|
55
52
|
routeName: string;
|
|
56
53
|
pattern: RegExp;
|
|
@@ -66,12 +63,6 @@ declare interface PathnameSegmentPart {
|
|
|
66
63
|
rest: boolean;
|
|
67
64
|
}
|
|
68
65
|
|
|
69
|
-
/** @public */
|
|
70
|
-
export declare const RESOLVED_NOT_FOUND_PATHS_ID = "@qwik-router-not-found-paths.js";
|
|
71
|
-
|
|
72
|
-
/** @public */
|
|
73
|
-
export declare const RESOLVED_STATIC_PATHS_ID = "@qwik-router-static-paths.js";
|
|
74
|
-
|
|
75
66
|
/** @public */
|
|
76
67
|
export declare interface ServerAdapterOptions {
|
|
77
68
|
/**
|
|
@@ -84,10 +75,7 @@ export declare interface ServerAdapterOptions {
|
|
|
84
75
|
}
|
|
85
76
|
|
|
86
77
|
/** @public */
|
|
87
|
-
export declare
|
|
88
|
-
|
|
89
|
-
/** @public */
|
|
90
|
-
export declare function viteAdapter(opts: ViteAdapterPluginOptions): Plugin_2<never>;
|
|
78
|
+
export declare function viteAdapter(opts: ViteAdapterPluginOptions): Plugin_2<any>[];
|
|
91
79
|
|
|
92
80
|
/** @public */
|
|
93
81
|
declare interface ViteAdapterPluginOptions {
|
|
@@ -104,7 +92,7 @@ declare interface ViteAdapterPluginOptions {
|
|
|
104
92
|
clientPublicOutDir: string;
|
|
105
93
|
serverOutDir: string;
|
|
106
94
|
basePathname: string;
|
|
107
|
-
routes:
|
|
95
|
+
routes: BuiltRoute[];
|
|
108
96
|
assetsDir?: string;
|
|
109
97
|
warn: (message: string) => void;
|
|
110
98
|
error: (message: string) => void;
|