@qwik.dev/router 2.0.0-beta.36 → 2.0.0-beta.38

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 (41) hide show
  1. package/lib/adapters/cloudflare-pages/vite/index.mjs +3 -5
  2. package/lib/adapters/shared/vite/index.d.ts +3 -4
  3. package/lib/adapters/shared/vite/index.mjs +167 -155
  4. package/lib/chunks/dev-preloaded-route-loader.mjs +3 -0
  5. package/lib/chunks/format.mjs +31 -0
  6. package/lib/chunks/fs.mjs +10 -8
  7. package/lib/chunks/head.qwik.mjs +1425 -0
  8. package/lib/chunks/http-error.qwik.mjs +2 -2
  9. package/lib/chunks/pathname.mjs +3 -32
  10. package/lib/chunks/request-body-limit.mjs +37 -0
  11. package/lib/chunks/request-path.mjs +60 -0
  12. package/lib/chunks/routes.mjs +47 -0
  13. package/lib/chunks/server-error.mjs +19 -0
  14. package/lib/chunks/system.mjs +8 -8
  15. package/lib/chunks/use-functions.qwik.mjs +3 -12
  16. package/lib/chunks/user-response.mjs +1875 -0
  17. package/lib/chunks/worker-thread.mjs +317 -0
  18. package/lib/index.d.ts +251 -44
  19. package/lib/index.qwik.mjs +734 -485
  20. package/lib/middleware/aws-lambda/index.mjs +2 -1
  21. package/lib/middleware/azure-swa/index.mjs +13 -9
  22. package/lib/middleware/cloudflare-pages/index.mjs +2 -2
  23. package/lib/middleware/deno/index.d.ts +2 -0
  24. package/lib/middleware/deno/index.mjs +2 -1
  25. package/lib/middleware/netlify-edge/index.mjs +2 -2
  26. package/lib/middleware/node/index.d.ts +9 -1
  27. package/lib/middleware/node/index.mjs +28 -3
  28. package/lib/middleware/request-handler/index.d.ts +65 -26
  29. package/lib/middleware/request-handler/index.mjs +38 -1679
  30. package/lib/middleware/vercel-edge/index.mjs +2 -2
  31. package/lib/ssg/index.d.ts +5 -13
  32. package/lib/ssg/index.mjs +14 -53
  33. package/lib/vite/index.d.ts +23 -0
  34. package/lib/vite/index.mjs +533 -122
  35. package/package.json +4 -3
  36. package/lib/chunks/deepFreeze.qwik.mjs +0 -18
  37. package/lib/chunks/error-handler.mjs +0 -57
  38. package/lib/chunks/not-found-wrapper.qwik.mjs +0 -25
  39. package/lib/chunks/redirect-handler.mjs +0 -6
  40. package/lib/chunks/routing.qwik.mjs +0 -821
  41. package/lib/chunks/worker-thread.qwik.mjs +0 -2585
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-beta.36",
4
+ "version": "2.0.0-beta.38",
5
5
  "bugs": "https://github.com/QwikDev/qwik/issues",
6
6
  "dependencies": {
7
7
  "@azure/functions": "3.5.1",
@@ -15,6 +15,7 @@
15
15
  "kleur": "^4.1.5",
16
16
  "marked": "^12.0.2",
17
17
  "mdast-util-mdx": "^3.0.0",
18
+ "mlly": "^1.8.2",
18
19
  "refractor": "^4.8.1",
19
20
  "rehype-autolink-headings": "^7.1.0",
20
21
  "remark-frontmatter": "^5.0.0",
@@ -40,7 +41,7 @@
40
41
  "tsm": "2.3.0",
41
42
  "typescript": "5.9.3",
42
43
  "uvu": "0.5.6",
43
- "@qwik.dev/core": "2.0.0-beta.36"
44
+ "@qwik.dev/core": "2.0.0-beta.38"
44
45
  },
45
46
  "engines": {
46
47
  "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
@@ -169,7 +170,7 @@
169
170
  "main": "./lib/index.qwik.mjs",
170
171
  "peerDependencies": {
171
172
  "vite": ">=6 <9",
172
- "@qwik.dev/core": "^2.0.0-beta.36"
173
+ "@qwik.dev/core": "^2.0.0-beta.38"
173
174
  },
174
175
  "publishConfig": {
175
176
  "access": "public"
@@ -1,18 +0,0 @@
1
- const deepFreeze = (obj) => {
2
- if (obj == null) {
3
- return obj;
4
- }
5
- Object.getOwnPropertyNames(obj).forEach((prop) => {
6
- const value = obj[prop];
7
- if (value && typeof value === "object" && !Object.isFrozen(value)) {
8
- try {
9
- deepFreeze(value);
10
- } catch {
11
- return obj;
12
- }
13
- }
14
- });
15
- return Object.freeze(obj);
16
- };
17
-
18
- export { deepFreeze as d };
@@ -1,57 +0,0 @@
1
- const ESCAPE_HTML = /[&<>]/g;
2
- const escapeHtml = (s) => {
3
- return s.replace(ESCAPE_HTML, (c) => {
4
- switch (c) {
5
- case "&":
6
- return "&amp;";
7
- case "<":
8
- return "&lt;";
9
- case ">":
10
- return "&gt;";
11
- default:
12
- return "";
13
- }
14
- });
15
- };
16
- const COLOR_400 = "#006ce9";
17
- const COLOR_500 = "#713fc2";
18
- function minimalHtmlResponse(status, message) {
19
- if (typeof status !== "number") {
20
- status = 500;
21
- }
22
- if (typeof message === "string") {
23
- message = escapeHtml(message);
24
- } else {
25
- message = "";
26
- }
27
- const width = typeof message === "string" ? "600px" : "300px";
28
- const color = status >= 500 ? COLOR_500 : COLOR_400;
29
- return `
30
- <head>
31
- <meta charset="utf-8">
32
- <meta http-equiv="Status" content="${status}">
33
- <title>${status} ${message}</title>
34
- <meta name="viewport" content="width=device-width,initial-scale=1">
35
- <style>
36
- body { color: ${color}; background-color: #fafafa; padding: 30px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
37
- p { max-width: ${width}; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px ${color}; overflow: hidden; }
38
- strong { display: inline-block; padding: 15px; background: ${color}; color: white; }
39
- span { display: inline-block; padding: 15px; }
40
- </style>
41
- </head>
42
- <body><p><strong>${status}</strong> <span>${message}</span></p></body>
43
- `;
44
- }
45
- function getErrorHtml(status, e) {
46
- let message = "Server Error";
47
- if (e != null) {
48
- if (typeof e.message === "string") {
49
- message = e.message;
50
- } else {
51
- message = String(e);
52
- }
53
- }
54
- return `<html>` + minimalHtmlResponse(status, message) + `</html>`;
55
- }
56
-
57
- export { getErrorHtml as g, minimalHtmlResponse as m };
@@ -1,25 +0,0 @@
1
- import { k as useHttpStatus } from './use-functions.qwik.mjs';
2
-
3
- function createNotFoundWrapper(notFoundMod, errorMod) {
4
- const NotFound = notFoundMod.default;
5
- const ErrorPage = errorMod.default;
6
- const Component = () => {
7
- const { status } = useHttpStatus();
8
- if (status === 404 && NotFound) {
9
- return NotFound({});
10
- }
11
- if (ErrorPage) {
12
- return ErrorPage({});
13
- }
14
- return null;
15
- };
16
- const notFoundHead = notFoundMod.routeConfig && typeof notFoundMod.routeConfig !== "function" ? notFoundMod.routeConfig.head : notFoundMod.head;
17
- const errorHead = errorMod.routeConfig && typeof errorMod.routeConfig !== "function" ? errorMod.routeConfig.head : errorMod.head;
18
- return {
19
- default: Component,
20
- head: notFoundHead ?? errorHead,
21
- cacheKey: (status) => String(status)
22
- };
23
- }
24
-
25
- export { createNotFoundWrapper };
@@ -1,6 +0,0 @@
1
- class AbortMessage {
2
- }
3
- class RedirectMessage extends AbortMessage {
4
- }
5
-
6
- export { AbortMessage as A, RedirectMessage as R };