@qwik.dev/router 2.0.0-beta.9 → 2.0.0-rc.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 (83) hide show
  1. package/lib/adapters/azure-swa/vite/index.d.ts +2 -2
  2. package/lib/adapters/azure-swa/vite/index.mjs +44 -57
  3. package/lib/adapters/bun-server/vite/index.d.ts +2 -2
  4. package/lib/adapters/bun-server/vite/index.mjs +16 -22
  5. package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
  6. package/lib/adapters/cloud-run/vite/index.mjs +15 -19
  7. package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
  8. package/lib/adapters/cloudflare-pages/vite/index.mjs +45 -76
  9. package/lib/adapters/deno-server/vite/index.d.ts +2 -2
  10. package/lib/adapters/deno-server/vite/index.mjs +25 -34
  11. package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
  12. package/lib/adapters/netlify-edge/vite/index.mjs +49 -89
  13. package/lib/adapters/node-server/vite/index.d.ts +2 -2
  14. package/lib/adapters/node-server/vite/index.mjs +16 -22
  15. package/lib/adapters/shared/vite/index.d.ts +9 -16
  16. package/lib/adapters/shared/vite/index.mjs +280 -293
  17. package/lib/adapters/ssg/vite/index.d.ts +1 -1
  18. package/lib/adapters/ssg/vite/index.mjs +13 -299
  19. package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
  20. package/lib/adapters/vercel-edge/vite/index.mjs +75 -79
  21. package/lib/chunks/dev-preloaded-route-loader.mjs +2 -0
  22. package/lib/chunks/format.mjs +24 -0
  23. package/lib/chunks/fs.mjs +143 -0
  24. package/lib/chunks/head.qwik.mjs +1570 -0
  25. package/lib/chunks/http-error.qwik.mjs +28 -0
  26. package/lib/chunks/pathname.mjs +58 -0
  27. package/lib/chunks/request-body-limit.mjs +27 -0
  28. package/lib/chunks/request-path.mjs +53 -0
  29. package/lib/chunks/route-trie-key.mjs +10 -0
  30. package/lib/chunks/routes.mjs +26 -0
  31. package/lib/chunks/server-error.mjs +38 -0
  32. package/lib/chunks/static-file.mjs +70 -0
  33. package/lib/chunks/system.mjs +271 -0
  34. package/lib/chunks/user-response.mjs +1878 -0
  35. package/lib/chunks/worker-thread.mjs +274 -0
  36. package/lib/index.d.ts +550 -182
  37. package/lib/index.qwik.mjs +1746 -2057
  38. package/lib/middleware/aws-lambda/index.d.ts +15 -17
  39. package/lib/middleware/aws-lambda/index.mjs +46 -50
  40. package/lib/middleware/azure-swa/index.mjs +85 -294
  41. package/lib/middleware/bun/index.d.ts +22 -5
  42. package/lib/middleware/bun/index.mjs +118 -201
  43. package/lib/middleware/cloudflare-pages/index.d.ts +2 -0
  44. package/lib/middleware/cloudflare-pages/index.mjs +103 -101
  45. package/lib/middleware/deno/index.d.ts +22 -5
  46. package/lib/middleware/deno/index.mjs +103 -191
  47. package/lib/middleware/firebase/index.mjs +22 -31
  48. package/lib/middleware/netlify-edge/index.d.ts +2 -0
  49. package/lib/middleware/netlify-edge/index.mjs +64 -80
  50. package/lib/middleware/node/index.d.ts +17 -5
  51. package/lib/middleware/node/index.mjs +298 -269
  52. package/lib/middleware/request-handler/index.d.ts +259 -58
  53. package/lib/middleware/request-handler/index.mjs +108 -1730
  54. package/lib/middleware/vercel-edge/index.d.ts +2 -0
  55. package/lib/middleware/vercel-edge/index.mjs +77 -100
  56. package/lib/modules.d.ts +7 -4
  57. package/lib/service-worker/index.mjs +14 -0
  58. package/lib/ssg/index.d.ts +50 -26
  59. package/lib/ssg/index.mjs +257 -43
  60. package/lib/vite/index.d.ts +59 -11
  61. package/lib/vite/index.mjs +2534 -27536
  62. package/modules.d.ts +7 -4
  63. package/package.json +53 -70
  64. package/lib/adapters/azure-swa/vite/index.cjs +0 -96
  65. package/lib/adapters/bun-server/vite/index.cjs +0 -50
  66. package/lib/adapters/cloud-run/vite/index.cjs +0 -47
  67. package/lib/adapters/cloudflare-pages/vite/index.cjs +0 -115
  68. package/lib/adapters/deno-server/vite/index.cjs +0 -62
  69. package/lib/adapters/netlify-edge/vite/index.cjs +0 -130
  70. package/lib/adapters/node-server/vite/index.cjs +0 -50
  71. package/lib/adapters/shared/vite/index.cjs +0 -338
  72. package/lib/adapters/ssg/vite/index.cjs +0 -339
  73. package/lib/adapters/vercel-edge/vite/index.cjs +0 -118
  74. package/lib/index.qwik.cjs +0 -2112
  75. package/lib/middleware/node/index.cjs +0 -310
  76. package/lib/middleware/request-handler/index.cjs +0 -1766
  77. package/lib/service-worker.cjs +0 -17
  78. package/lib/service-worker.mjs +0 -15
  79. package/lib/ssg/deno.mjs +0 -8
  80. package/lib/ssg/index.cjs +0 -67
  81. package/lib/ssg/node.cjs +0 -1128
  82. package/lib/ssg/node.mjs +0 -1090
  83. package/lib/vite/index.cjs +0 -27607
@@ -1,4 +1,4 @@
1
- import type { BuiltinsWithOptionalParams } from 'svgo/plugins/plugins-types';
1
+ import type { BuiltinsWithOptionalParams } from 'svgo';
2
2
  import type { CompileOptions } from '@mdx-js/mdx';
3
3
  import type { Config } from 'svgo';
4
4
  import { ConfigEnv } from 'vite';
@@ -7,13 +7,13 @@ import type { PluginOption } from 'vite';
7
7
  import type { SerializationStrategy } from '@qwik.dev/core/internal';
8
8
  import { UserConfigExport } from 'vite';
9
9
 
10
- declare interface BuildEntry extends ParsedPathname {
10
+ declare interface BuiltEntry extends ParsedPathname {
11
11
  id: string;
12
12
  chunkFileName: string;
13
13
  filePath: string;
14
14
  }
15
15
 
16
- declare interface BuildLayout {
16
+ declare interface BuiltLayout {
17
17
  filePath: string;
18
18
  dirPath: string;
19
19
  id: string;
@@ -21,7 +21,7 @@ declare interface BuildLayout {
21
21
  layoutName: string;
22
22
  }
23
23
 
24
- declare interface BuildRoute extends ParsedPathname {
24
+ declare interface BuiltRoute extends ParsedPathname {
25
25
  /** Unique id built from its relative file system path */
26
26
  id: string;
27
27
  /** Local file system path */
@@ -29,7 +29,7 @@ declare interface BuildRoute extends ParsedPathname {
29
29
  ext: string;
30
30
  /** URL Pathname */
31
31
  pathname: string;
32
- layouts: BuildLayout[];
32
+ layouts: BuiltLayout[];
33
33
  }
34
34
 
35
35
  /** @public */
@@ -81,13 +81,13 @@ declare interface PathnameSegmentPart {
81
81
 
82
82
  /** @public */
83
83
  declare interface PluginOptions {
84
- /** Directory of the `routes`. Defaults to `src/routes`. */
84
+ /** Directory of the `routes`. Defaults to `"src/routes"`. */
85
85
  routesDir?: string;
86
- /** Directory of the `server plugins`. Defaults to `src/server-plugins`. */
86
+ /** Directory of the `server plugins`. Defaults to `routesDir`. */
87
87
  serverPluginsDir?: string;
88
88
  /**
89
89
  * The base pathname is used to create absolute URL paths up to the `hostname`, and must always
90
- * start and end with a `/`. Defaults to `/`.
90
+ * start and end with a `/`. Defaults to `"/""`.
91
91
  */
92
92
  basePathname?: string;
93
93
  /**
@@ -99,12 +99,33 @@ declare interface PluginOptions {
99
99
  mdxPlugins?: MdxPlugins;
100
100
  /** MDX Options https://mdxjs.com/ */
101
101
  mdx?: any;
102
- /** The platform object which can be used to mock the Cloudflare bindings. */
102
+ /**
103
+ * Extend the `platform` object in RequestEvent, which can be used to e.g. mock Cloudflare
104
+ * bindings.
105
+ *
106
+ * This only works in **dev mode** and only when using the in-process Vite dev server middleware
107
+ * (the default).
108
+ */
103
109
  platform?: Record<string, unknown>;
104
110
  /** Configuration to rewrite url paths */
105
111
  rewriteRoutes?: RewriteRouteOption[];
106
112
  /** The serialization strategy for route loaders. Defaults to `never`. */
107
113
  defaultLoadersSerializationStrategy?: SerializationStrategy;
114
+ /**
115
+ * Enable strict mode for route loaders and actions by default.
116
+ *
117
+ * When true:
118
+ *
119
+ * - Loaders without an explicit `search` option act as if `search: []` — they only re-fetch when
120
+ * the route path changes and ignore all URL search params.
121
+ * - Actions without an explicit `invalidate` option act as if `invalidate: []` — they don't re-run
122
+ * any loaders after completion.
123
+ *
124
+ * Individual loaders/actions can override this by specifying `search` or `invalidate` explicitly.
125
+ *
126
+ * Defaults to `true`.
127
+ */
128
+ strictLoaders?: boolean;
108
129
  }
109
130
 
110
131
  /**
@@ -136,8 +157,15 @@ export declare interface QwikRouterPlugin extends P<QwikRouterPluginApi> {
136
157
  /** @public */
137
158
  declare interface QwikRouterPluginApi {
138
159
  getBasePathname: () => string;
139
- getRoutes: () => BuildRoute[];
140
- getServiceWorkers: () => BuildEntry[];
160
+ getRoutes: () => BuiltRoute[];
161
+ getServiceWorkers: () => BuiltEntry[];
162
+ /**
163
+ * Hand the adapter's SSG include/exclude patterns to the router so the production server route
164
+ * plan can drop fully-prerendered, server-free routes. Called by the SSG adapter.
165
+ *
166
+ * @internal
167
+ */
168
+ _setSsgRoutes?: (include: string[] | undefined, exclude: string[] | undefined) => void;
141
169
  }
142
170
 
143
171
  /** @public */
@@ -146,12 +174,32 @@ export declare interface QwikRouterVitePluginOptions extends Omit<PluginOptions,
146
174
  mdx?: MdxOptions;
147
175
  platform?: Record<string, unknown>;
148
176
  imageOptimization?: ImageOptimizationOptions;
177
+ /** Whether to use static imports for route modules (layout and index files). Defaults to `false`. */
178
+ staticImportRoutes?: boolean;
179
+ /**
180
+ * Qwik is an SSR first framework. This means that Qwik requires either SSR or SSG. In Vite dev
181
+ * mode the dev SSR server is responsible for rendering and pausing the application on the
182
+ * server.
183
+ *
184
+ * Under normal circumstances this should be on, unless you have your own dev SSR server setup and
185
+ * wish to disable this one.
186
+ *
187
+ * Default: true
188
+ */
189
+ devSsrServer?: boolean;
190
+ /**
191
+ * Maximum number of SSR-rendered pages to keep in the in-memory cache. Set to 0 to disable.
192
+ *
193
+ * Default: 50
194
+ */
195
+ ssrCacheSize?: number;
149
196
  }
150
197
 
151
198
  /** @public */
152
199
  declare interface RewriteRouteOption {
153
200
  prefix?: string;
154
201
  paths: Record<string, string>;
202
+ exclude?: string[];
155
203
  }
156
204
 
157
205
  export { }