@qwik.dev/router 2.0.0-alpha.9 → 2.0.0-beta.2

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 (49) hide show
  1. package/README.md +1 -1
  2. package/lib/adapters/azure-swa/vite/index.cjs +3 -3
  3. package/lib/adapters/azure-swa/vite/index.d.ts +13 -13
  4. package/lib/adapters/bun-server/vite/index.cjs +3 -3
  5. package/lib/adapters/bun-server/vite/index.d.ts +14 -14
  6. package/lib/adapters/cloud-run/vite/index.cjs +3 -3
  7. package/lib/adapters/cloud-run/vite/index.d.ts +13 -13
  8. package/lib/adapters/cloudflare-pages/vite/index.cjs +3 -3
  9. package/lib/adapters/cloudflare-pages/vite/index.d.ts +27 -27
  10. package/lib/adapters/deno-server/vite/index.cjs +3 -3
  11. package/lib/adapters/deno-server/vite/index.d.ts +14 -14
  12. package/lib/adapters/netlify-edge/vite/index.cjs +3 -3
  13. package/lib/adapters/netlify-edge/vite/index.d.ts +44 -44
  14. package/lib/adapters/node-server/vite/index.cjs +3 -3
  15. package/lib/adapters/node-server/vite/index.d.ts +14 -14
  16. package/lib/adapters/shared/vite/index.cjs +10 -3
  17. package/lib/adapters/shared/vite/index.d.ts +114 -114
  18. package/lib/adapters/shared/vite/index.mjs +7 -0
  19. package/lib/adapters/static/vite/index.cjs +10 -3
  20. package/lib/adapters/static/vite/index.d.ts +10 -10
  21. package/lib/adapters/static/vite/index.mjs +7 -0
  22. package/lib/adapters/vercel-edge/vite/index.cjs +3 -3
  23. package/lib/adapters/vercel-edge/vite/index.d.ts +45 -45
  24. package/lib/index.d.ts +878 -810
  25. package/lib/index.qwik.cjs +110 -48
  26. package/lib/index.qwik.mjs +112 -50
  27. package/lib/middleware/aws-lambda/index.d.ts +48 -48
  28. package/lib/middleware/azure-swa/index.d.ts +28 -28
  29. package/lib/middleware/bun/index.d.ts +35 -35
  30. package/lib/middleware/cloudflare-pages/index.d.ts +35 -35
  31. package/lib/middleware/deno/index.d.ts +47 -47
  32. package/lib/middleware/firebase/index.d.ts +26 -26
  33. package/lib/middleware/netlify-edge/index.d.ts +27 -27
  34. package/lib/middleware/node/index.cjs +3 -3
  35. package/lib/middleware/node/index.d.ts +64 -64
  36. package/lib/middleware/request-handler/index.cjs +142 -73
  37. package/lib/middleware/request-handler/index.d.ts +710 -676
  38. package/lib/middleware/request-handler/index.mjs +138 -70
  39. package/lib/middleware/vercel-edge/index.d.ts +26 -26
  40. package/lib/service-worker.cjs +13 -263
  41. package/lib/service-worker.d.ts +15 -4
  42. package/lib/service-worker.mjs +13 -263
  43. package/lib/static/index.cjs +3 -3
  44. package/lib/static/index.d.ts +96 -96
  45. package/lib/static/node.cjs +3 -3
  46. package/lib/vite/index.cjs +209 -261
  47. package/lib/vite/index.d.ts +154 -154
  48. package/lib/vite/index.mjs +207 -259
  49. package/package.json +7 -7
@@ -1,114 +1,114 @@
1
- import type { Plugin as Plugin_2 } from 'vite';
2
- import type { StaticGenerateRenderOptions } from '@qwik.dev/router/static';
3
- import type { UserConfig } from 'vite';
4
-
5
- /** @public */
6
- export declare interface AdapterSSGOptions extends Omit<StaticGenerateRenderOptions, 'outDir' | 'origin'> {
7
- /** Defines routes that should be static generated. Accepts wildcard behavior. */
8
- include: string[];
9
- /**
10
- * Defines routes that should not be static generated. Accepts wildcard behavior. `exclude` always
11
- * take priority over `include`.
12
- */
13
- exclude?: string[];
14
- /**
15
- * The URL `origin`, which is a combination of the scheme (protocol) and hostname (domain). For
16
- * example, `https://qwik.dev` has the protocol `https://` and domain `qwik.dev`. However, the
17
- * `origin` does not include a `pathname`.
18
- *
19
- * The `origin` is used to provide a full URL during Static Site Generation (SSG), and to simulate
20
- * a complete URL rather than just the `pathname`. For example, in order to render a correct
21
- * canonical tag URL or URLs within the `sitemap.xml`, the `origin` must be provided too.
22
- *
23
- * If the site also starts with a pathname other than `/`, please use the `basePathname` option in
24
- * the Qwik Router config options.
25
- */
26
- origin?: string;
27
- }
28
-
29
- declare interface BuildLayout {
30
- filePath: string;
31
- dirPath: string;
32
- id: string;
33
- layoutType: 'top' | 'nested';
34
- layoutName: string;
35
- }
36
-
37
- declare interface BuildRoute extends ParsedPathname {
38
- /** Unique id built from its relative file system path */
39
- id: string;
40
- /** Local file system path */
41
- filePath: string;
42
- ext: string;
43
- /** URL Pathname */
44
- pathname: string;
45
- layouts: BuildLayout[];
46
- }
47
-
48
- /** @public */
49
- export declare function getParentDir(startDir: string, dirName: string): string;
50
-
51
- /** @public */
52
- export declare const NOT_FOUND_PATHS_ID = "@qwik-router-not-found-paths";
53
-
54
- declare interface ParsedPathname {
55
- routeName: string;
56
- pattern: RegExp;
57
- paramNames: string[];
58
- segments: PathnameSegment[];
59
- }
60
-
61
- declare type PathnameSegment = PathnameSegmentPart[];
62
-
63
- declare interface PathnameSegmentPart {
64
- content: string;
65
- dynamic: boolean;
66
- rest: boolean;
67
- }
68
-
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
- /** @public */
76
- export declare interface ServerAdapterOptions {
77
- /**
78
- * Options the adapter should use when running Static Site Generation (SSG). Defaults the `filter`
79
- * to "auto" which will attempt to automatically decides if a page can be statically generated and
80
- * does not have dynamic data, or if it the page should instead be rendered on the server (SSR).
81
- * Setting to `null` will prevent any pages from being statically generated.
82
- */
83
- ssg?: AdapterSSGOptions | null;
84
- }
85
-
86
- /** @public */
87
- export declare const STATIC_PATHS_ID = "@qwik-router-static-paths";
88
-
89
- /** @public */
90
- export declare function viteAdapter(opts: ViteAdapterPluginOptions): Plugin_2<never>;
91
-
92
- /** @public */
93
- declare interface ViteAdapterPluginOptions {
94
- name: string;
95
- origin: string;
96
- staticPaths?: string[];
97
- ssg?: AdapterSSGOptions | null;
98
- cleanStaticGenerated?: boolean;
99
- maxWorkers?: number;
100
- config?: (config: UserConfig) => UserConfig;
101
- generate?: (generateOpts: {
102
- outputEntries: string[];
103
- clientOutDir: string;
104
- clientPublicOutDir: string;
105
- serverOutDir: string;
106
- basePathname: string;
107
- routes: BuildRoute[];
108
- assetsDir?: string;
109
- warn: (message: string) => void;
110
- error: (message: string) => void;
111
- }) => Promise<void>;
112
- }
113
-
114
- export { }
1
+ import type { Plugin as Plugin_2 } from 'vite';
2
+ import type { StaticGenerateRenderOptions } from '@qwik.dev/router/static';
3
+ import type { UserConfig } from 'vite';
4
+
5
+ /** @public */
6
+ export declare interface AdapterSSGOptions extends Omit<StaticGenerateRenderOptions, 'outDir' | 'origin'> {
7
+ /** Defines routes that should be static generated. Accepts wildcard behavior. */
8
+ include: string[];
9
+ /**
10
+ * Defines routes that should not be static generated. Accepts wildcard behavior. `exclude` always
11
+ * take priority over `include`.
12
+ */
13
+ exclude?: string[];
14
+ /**
15
+ * The URL `origin`, which is a combination of the scheme (protocol) and hostname (domain). For
16
+ * example, `https://qwik.dev` has the protocol `https://` and domain `qwik.dev`. However, the
17
+ * `origin` does not include a `pathname`.
18
+ *
19
+ * The `origin` is used to provide a full URL during Static Site Generation (SSG), and to simulate
20
+ * a complete URL rather than just the `pathname`. For example, in order to render a correct
21
+ * canonical tag URL or URLs within the `sitemap.xml`, the `origin` must be provided too.
22
+ *
23
+ * If the site also starts with a pathname other than `/`, please use the `basePathname` option in
24
+ * the Qwik Router config options.
25
+ */
26
+ origin?: string;
27
+ }
28
+
29
+ declare interface BuildLayout {
30
+ filePath: string;
31
+ dirPath: string;
32
+ id: string;
33
+ layoutType: 'top' | 'nested';
34
+ layoutName: string;
35
+ }
36
+
37
+ declare interface BuildRoute extends ParsedPathname {
38
+ /** Unique id built from its relative file system path */
39
+ id: string;
40
+ /** Local file system path */
41
+ filePath: string;
42
+ ext: string;
43
+ /** URL Pathname */
44
+ pathname: string;
45
+ layouts: BuildLayout[];
46
+ }
47
+
48
+ /** @public */
49
+ export declare function getParentDir(startDir: string, dirName: string): string;
50
+
51
+ /** @public */
52
+ export declare const NOT_FOUND_PATHS_ID = "@qwik-router-not-found-paths";
53
+
54
+ declare interface ParsedPathname {
55
+ routeName: string;
56
+ pattern: RegExp;
57
+ paramNames: string[];
58
+ segments: PathnameSegment[];
59
+ }
60
+
61
+ declare type PathnameSegment = PathnameSegmentPart[];
62
+
63
+ declare interface PathnameSegmentPart {
64
+ content: string;
65
+ dynamic: boolean;
66
+ rest: boolean;
67
+ }
68
+
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
+ /** @public */
76
+ export declare interface ServerAdapterOptions {
77
+ /**
78
+ * Options the adapter should use when running Static Site Generation (SSG). Defaults the `filter`
79
+ * to "auto" which will attempt to automatically decides if a page can be statically generated and
80
+ * does not have dynamic data, or if it the page should instead be rendered on the server (SSR).
81
+ * Setting to `null` will prevent any pages from being statically generated.
82
+ */
83
+ ssg?: AdapterSSGOptions | null;
84
+ }
85
+
86
+ /** @public */
87
+ export declare const STATIC_PATHS_ID = "@qwik-router-static-paths";
88
+
89
+ /** @public */
90
+ export declare function viteAdapter(opts: ViteAdapterPluginOptions): Plugin_2<never>;
91
+
92
+ /** @public */
93
+ declare interface ViteAdapterPluginOptions {
94
+ name: string;
95
+ origin: string;
96
+ staticPaths?: string[];
97
+ ssg?: AdapterSSGOptions | null;
98
+ cleanStaticGenerated?: boolean;
99
+ maxWorkers?: number;
100
+ config?: (config: UserConfig) => UserConfig;
101
+ generate?: (generateOpts: {
102
+ outputEntries: string[];
103
+ clientOutDir: string;
104
+ clientPublicOutDir: string;
105
+ serverOutDir: string;
106
+ basePathname: string;
107
+ routes: BuildRoute[];
108
+ assetsDir?: string;
109
+ warn: (message: string) => void;
110
+ error: (message: string) => void;
111
+ }) => Promise<void>;
112
+ }
113
+
114
+ export { }
@@ -296,6 +296,13 @@ function viteAdapter(opts) {
296
296
  error: (message) => this.error(message)
297
297
  });
298
298
  }
299
+ this.warn(
300
+ `
301
+ ==============================================
302
+ Note: Make sure that you are serving the built files with proper cache headers.
303
+ See https://qwik.dev/docs/deployments/#cache-headers for more information.
304
+ ==============================================`
305
+ );
299
306
  }
300
307
  }
301
308
  }
@@ -28,11 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // packages/qwik-router/src/adapters/static/vite/index.ts
31
- var vite_exports = {};
32
- __export(vite_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  staticAdapter: () => staticAdapter
34
34
  });
35
- module.exports = __toCommonJS(vite_exports);
35
+ module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // packages/qwik-router/src/adapters/shared/vite/index.ts
38
38
  var import_node_fs2 = __toESM(require("node:fs"), 1);
@@ -332,6 +332,13 @@ function viteAdapter(opts) {
332
332
  error: (message) => this.error(message)
333
333
  });
334
334
  }
335
+ this.warn(
336
+ `
337
+ ==============================================
338
+ Note: Make sure that you are serving the built files with proper cache headers.
339
+ See https://qwik.dev/docs/deployments/#cache-headers for more information.
340
+ ==============================================`
341
+ );
335
342
  }
336
343
  }
337
344
  }
@@ -1,10 +1,10 @@
1
- import type { StaticGenerateRenderOptions } from '../../../static';
2
-
3
- /** @public */
4
- export declare function staticAdapter(opts: StaticGenerateAdapterOptions): any;
5
-
6
- /** @public */
7
- export declare interface StaticGenerateAdapterOptions extends Omit<StaticGenerateRenderOptions, 'outDir'> {
8
- }
9
-
10
- export { }
1
+ import type { StaticGenerateRenderOptions } from '../../../static';
2
+
3
+ /** @public */
4
+ export declare function staticAdapter(opts: StaticGenerateAdapterOptions): any;
5
+
6
+ /** @public */
7
+ export declare interface StaticGenerateAdapterOptions extends Omit<StaticGenerateRenderOptions, 'outDir'> {
8
+ }
9
+
10
+ export { }
@@ -296,6 +296,13 @@ function viteAdapter(opts) {
296
296
  error: (message) => this.error(message)
297
297
  });
298
298
  }
299
+ this.warn(
300
+ `
301
+ ==============================================
302
+ Note: Make sure that you are serving the built files with proper cache headers.
303
+ See https://qwik.dev/docs/deployments/#cache-headers for more information.
304
+ ==============================================`
305
+ );
299
306
  }
300
307
  }
301
308
  }
@@ -28,11 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // packages/qwik-router/src/adapters/vercel-edge/vite/index.ts
31
- var vite_exports = {};
32
- __export(vite_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  vercelEdgeAdapter: () => vercelEdgeAdapter
34
34
  });
35
- module.exports = __toCommonJS(vite_exports);
35
+ module.exports = __toCommonJS(index_exports);
36
36
  var import_node_fs = __toESM(require("node:fs"), 1);
37
37
  var import_node_path = require("node:path");
38
38
  var import_vite = require("../../shared/vite/index.cjs");
@@ -1,45 +1,45 @@
1
- import { ServerAdapterOptions } from '../../shared/vite';
2
- import type { StaticGenerateRenderOptions } from '@qwik.dev/router/static';
3
-
4
- export { StaticGenerateRenderOptions }
5
-
6
- /** @public */
7
- export declare function vercelEdgeAdapter(opts?: VercelEdgeAdapterOptions): any;
8
-
9
- /** @public */
10
- export declare interface VercelEdgeAdapterOptions extends ServerAdapterOptions {
11
- /**
12
- * Determines if the build should auto-generate the `.vercel/output/config.json` config.
13
- *
14
- * Defaults to `true`.
15
- */
16
- outputConfig?: boolean;
17
- /**
18
- * The `entrypoint` property in the `.vc-config.json` file. Indicates the initial file where code
19
- * will be executed for the Edge Function.
20
- *
21
- * Defaults to `entry.vercel-edge.js`.
22
- */
23
- vcConfigEntryPoint?: string;
24
- /**
25
- * The `envVarsInUse` property in the `.vc-config.json` file. List of environment variable names
26
- * that will be available for the Edge Function to utilize.
27
- *
28
- * Defaults to `undefined`.
29
- */
30
- vcConfigEnvVarsInUse?: string[];
31
- /**
32
- * Manually add pathnames that should be treated as static paths and not SSR. For example, when
33
- * these pathnames are requested, their response should come from a static file, rather than a
34
- * server-side rendered response.
35
- */
36
- staticPaths?: string[];
37
- /**
38
- * Define the `target` property in the `ssr` object in the `vite.config.mts` file.
39
- *
40
- * Defaults to `webworker`.
41
- */
42
- target?: 'webworker' | 'node';
43
- }
44
-
45
- export { }
1
+ import { ServerAdapterOptions } from '../../shared/vite';
2
+ import type { StaticGenerateRenderOptions } from '@qwik.dev/router/static';
3
+
4
+ export { StaticGenerateRenderOptions }
5
+
6
+ /** @public */
7
+ export declare function vercelEdgeAdapter(opts?: VercelEdgeAdapterOptions): any;
8
+
9
+ /** @public */
10
+ export declare interface VercelEdgeAdapterOptions extends ServerAdapterOptions {
11
+ /**
12
+ * Determines if the build should auto-generate the `.vercel/output/config.json` config.
13
+ *
14
+ * Defaults to `true`.
15
+ */
16
+ outputConfig?: boolean;
17
+ /**
18
+ * The `entrypoint` property in the `.vc-config.json` file. Indicates the initial file where code
19
+ * will be executed for the Edge Function.
20
+ *
21
+ * Defaults to `entry.vercel-edge.js`.
22
+ */
23
+ vcConfigEntryPoint?: string;
24
+ /**
25
+ * The `envVarsInUse` property in the `.vc-config.json` file. List of environment variable names
26
+ * that will be available for the Edge Function to utilize.
27
+ *
28
+ * Defaults to `undefined`.
29
+ */
30
+ vcConfigEnvVarsInUse?: string[];
31
+ /**
32
+ * Manually add pathnames that should be treated as static paths and not SSR. For example, when
33
+ * these pathnames are requested, their response should come from a static file, rather than a
34
+ * server-side rendered response.
35
+ */
36
+ staticPaths?: string[];
37
+ /**
38
+ * Define the `target` property in the `ssr` object in the `vite.config.mts` file.
39
+ *
40
+ * Defaults to `webworker`.
41
+ */
42
+ target?: 'webworker' | 'node';
43
+ }
44
+
45
+ export { }