@qwik.dev/router 2.0.0-rc.0 → 2.0.0-rc.3

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.
@@ -26,6 +26,8 @@ export declare interface QwikRouterBunMiddleware {
26
26
 
27
27
  /** @public */
28
28
  export declare interface QwikRouterBunOptions extends ServerRenderOptions {
29
+ /** Maximum request body size in bytes. Defaults to 10 MiB. */
30
+ requestBodyLimit?: number;
29
31
  /** Options for serving static files */
30
32
  static?: {
31
33
  /** The root folder for statics files. Defaults to /dist */
@@ -1,3 +1,4 @@
1
+ import { r as limitRequestBody } from "../../chunks/request-body-limit.mjs";
1
2
  import { n as normalizeRequestUrl, r as MIME_TYPES, t as getStaticFilePath } from "../../chunks/static-file.mjs";
2
3
  import { isDev } from "@qwik.dev/core/build";
3
4
  import { setServerPlatform } from "@qwik.dev/core/server";
@@ -23,7 +24,7 @@ function createQwikRouter(opts) {
23
24
  env: { get(key) {
24
25
  return Bun.env[key];
25
26
  } },
26
- request,
27
+ request: limitRequestBody(request, opts.requestBodyLimit),
27
28
  getWritableStream: (status, headers, cookies, resolve) => {
28
29
  const { readable, writable } = new TransformStream();
29
30
  resolve(new Response(readable, {
@@ -30,6 +30,8 @@ export declare type QwikCityCloudflarePagesOptions = QwikRouterCloudflarePagesOp
30
30
 
31
31
  /** @public */
32
32
  export declare interface QwikRouterCloudflarePagesOptions extends ServerRenderOptions {
33
+ /** Maximum request body size in bytes. Defaults to 10 MiB. */
34
+ requestBodyLimit?: number;
33
35
  }
34
36
 
35
37
  export { }
@@ -1,3 +1,4 @@
1
+ import { r as limitRequestBody } from "../../chunks/request-body-limit.mjs";
1
2
  import { isDev } from "@qwik.dev/core/build";
2
3
  import { setServerPlatform } from "@qwik.dev/core/server";
3
4
  import { _TextEncoderStream_polyfill, getErrorHtml, isStaticPath, mergeHeadersCookies, requestHandler } from "@qwik.dev/router/middleware/request-handler";
@@ -20,6 +21,7 @@ function createQwikRouter(opts) {
20
21
  const cachedResponse = await cache.match(cacheKey);
21
22
  if (cachedResponse) return cachedResponse;
22
23
  }
24
+ request = limitRequestBody(request, opts.requestBodyLimit);
23
25
  const handledResponse = await requestHandler({
24
26
  mode: "server",
25
27
  locale: void 0,
@@ -1,5 +1,5 @@
1
- import { n as normalizeRequestUrl, r as MIME_TYPES, t as getStaticFilePath } from "../../chunks/static-file.mjs";
2
1
  import { r as limitRequestBody } from "../../chunks/request-body-limit.mjs";
2
+ import { n as normalizeRequestUrl, r as MIME_TYPES, t as getStaticFilePath } from "../../chunks/static-file.mjs";
3
3
  import { isDev } from "@qwik.dev/core/build";
4
4
  import { setServerPlatform } from "@qwik.dev/core/server";
5
5
  import { isStaticPath, mergeHeadersCookies, requestHandler } from "@qwik.dev/router/middleware/request-handler";
@@ -22,6 +22,8 @@ export declare type QwikCityNetlifyOptions = QwikRouterNetlifyOptions;
22
22
 
23
23
  /** @public */
24
24
  export declare interface QwikRouterNetlifyOptions extends ServerRenderOptions {
25
+ /** Maximum request body size in bytes. Defaults to 10 MiB. */
26
+ requestBodyLimit?: number;
25
27
  }
26
28
 
27
29
  export { }
@@ -1,3 +1,4 @@
1
+ import { r as limitRequestBody } from "../../chunks/request-body-limit.mjs";
1
2
  import { isDev } from "@qwik.dev/core/build";
2
3
  import { setServerPlatform } from "@qwik.dev/core/server";
3
4
  import { getErrorHtml, isStaticPath, mergeHeadersCookies, requestHandler } from "@qwik.dev/router/middleware/request-handler";
@@ -13,7 +14,7 @@ function createQwikRouter(opts) {
13
14
  locale: void 0,
14
15
  url,
15
16
  env: Deno.env,
16
- request,
17
+ request: limitRequestBody(request, opts.requestBodyLimit),
17
18
  getWritableStream: (status, headers, cookies, resolve) => {
18
19
  const { readable, writable } = new TransformStream();
19
20
  resolve(new Response(readable, {
@@ -1,5 +1,5 @@
1
- import { n as normalizeRequestUrl, r as MIME_TYPES, t as getStaticFilePath } from "../../chunks/static-file.mjs";
2
1
  import { i as validateRequestBodyLimit, n as RequestBodyLimitError, t as DEFAULT_REQUEST_BODY_LIMIT } from "../../chunks/request-body-limit.mjs";
2
+ import { n as normalizeRequestUrl, r as MIME_TYPES, t as getStaticFilePath } from "../../chunks/static-file.mjs";
3
3
  import { t as devPreloadedRouteLoaders } from "../../chunks/dev-preloaded-route-loader.mjs";
4
4
  import { isDev } from "@qwik.dev/core";
5
5
  import { setServerPlatform } from "@qwik.dev/core/server";
@@ -1,4 +1,4 @@
1
- import { H as getRouterConfig, d as loadRoute, ot as _asyncRequestStore } from "../../chunks/head.qwik.mjs";
1
+ import { H as getRouterConfig, d as loadRoute, dt as _asyncRequestStore } from "../../chunks/head.qwik.mjs";
2
2
  import { c as resolveValidInternalFullPathname, l as trimInternalPathname, s as recognizeRequest, u as trimRecognizedInternalPathname } from "../../chunks/request-path.mjs";
3
3
  import { i as RedirectMessage, r as AbortMessage, t as ServerError } from "../../chunks/server-error.mjs";
4
4
  import { t as devPreloadedRouteLoaders } from "../../chunks/dev-preloaded-route-loader.mjs";
@@ -21,6 +21,8 @@ export declare type QwikCityVercelEdgeOptions = QwikRouterVercelEdgeOptions;
21
21
 
22
22
  /** @public */
23
23
  export declare interface QwikRouterVercelEdgeOptions extends ServerRenderOptions {
24
+ /** Maximum request body size in bytes. Defaults to 10 MiB. */
25
+ requestBodyLimit?: number;
24
26
  }
25
27
 
26
28
  export { }
@@ -1,3 +1,4 @@
1
+ import { r as limitRequestBody } from "../../chunks/request-body-limit.mjs";
1
2
  import { isDev } from "@qwik.dev/core/build";
2
3
  import { setServerPlatform } from "@qwik.dev/core/server";
3
4
  import { getErrorHtml, isStaticPath, mergeHeadersCookies, requestHandler } from "@qwik.dev/router/middleware/request-handler";
@@ -19,7 +20,7 @@ function createQwikRouter(opts) {
19
20
  mode: "server",
20
21
  locale: void 0,
21
22
  url,
22
- request,
23
+ request: limitRequestBody(request, opts.requestBodyLimit),
23
24
  env: { get(key) {
24
25
  return p.env[key];
25
26
  } },
@@ -155,7 +155,7 @@ function parseRoutePathname(basePathname, pathname) {
155
155
  return {
156
156
  pattern: new RegExp(`^${segments.filter((segment) => segment.length > 0).map((s) => {
157
157
  const segment = decodeURI(s);
158
- const catchAll = /^\[\.\.\.(\w+)?\]$/.exec(segment);
158
+ const catchAll = /^\[\.\.\.([\w-]+)?\]$/.exec(segment);
159
159
  if (catchAll) {
160
160
  paramNames.push(catchAll[1]);
161
161
  return "(?:/(.*))?";
@@ -190,7 +190,7 @@ function parseRoutePathname(basePathname, pathname) {
190
190
  })
191
191
  };
192
192
  }
193
- var PARAM_PATTERN = /^(\.\.\.)?(\w+)?$/;
193
+ var PARAM_PATTERN = /^(\.\.\.)?([\w-]+)?$/;
194
194
  var DYNAMIC_SEGMENT = /\[(.+?)\]/;
195
195
  function resolveLayout(opts, layoutSourceFile) {
196
196
  let extlessName = layoutSourceFile.extlessName;
@@ -283,12 +283,12 @@ function routeSortCompare(a, b) {
283
283
  */
284
284
  function parseDirName(name) {
285
285
  if (name.startsWith("(") && name.endsWith(")")) return { key: null };
286
- const restMatch = /^\[\.\.\.(\w+)\]$/.exec(name);
286
+ const restMatch = /^\[\.\.\.([\w-]+)\]$/.exec(name);
287
287
  if (restMatch) return {
288
288
  key: "_A",
289
289
  paramName: restMatch[1]
290
290
  };
291
- const paramMatch = /^(.*?)\[(\w+)\](.*?)$/.exec(name);
291
+ const paramMatch = /^(.*?)\[([\w-]+)\](.*?)$/.exec(name);
292
292
  if (paramMatch) return {
293
293
  key: "_W",
294
294
  paramName: paramMatch[2],
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-rc.0",
4
+ "version": "2.0.0-rc.3",
5
5
  "bugs": "https://github.com/QwikDev/qwik/issues",
6
6
  "dependencies": {
7
7
  "@azure/functions": "3.5.1",
@@ -41,7 +41,7 @@
41
41
  "typescript": "5.9.3",
42
42
  "uvu": "0.5.6",
43
43
  "vite": "8.2.1",
44
- "@qwik.dev/core": "2.0.0-rc.0"
44
+ "@qwik.dev/core": "2.0.0-rc.3"
45
45
  },
46
46
  "engines": {
47
47
  "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
@@ -166,7 +166,7 @@
166
166
  "main": "./lib/index.qwik.mjs",
167
167
  "peerDependencies": {
168
168
  "vite": ">=8 <9",
169
- "@qwik.dev/core": "2.0.0-rc.0"
169
+ "@qwik.dev/core": "2.0.0-rc.3"
170
170
  },
171
171
  "publishConfig": {
172
172
  "access": "public"