@qwik.dev/router 2.0.0-beta.3 → 2.0.0-beta.31

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 (84) hide show
  1. package/adapters/static/vite.d.ts +1 -1
  2. package/lib/adapters/azure-swa/vite/index.d.ts +2 -2
  3. package/lib/adapters/azure-swa/vite/index.mjs +39 -44
  4. package/lib/adapters/bun-server/vite/index.d.ts +2 -2
  5. package/lib/adapters/bun-server/vite/index.mjs +6 -7
  6. package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
  7. package/lib/adapters/cloud-run/vite/index.mjs +6 -7
  8. package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
  9. package/lib/adapters/cloudflare-pages/vite/index.mjs +23 -32
  10. package/lib/adapters/deno-server/vite/index.d.ts +2 -2
  11. package/lib/adapters/deno-server/vite/index.mjs +13 -9
  12. package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
  13. package/lib/adapters/netlify-edge/vite/index.mjs +22 -36
  14. package/lib/adapters/node-server/vite/index.d.ts +2 -2
  15. package/lib/adapters/node-server/vite/index.mjs +6 -7
  16. package/lib/adapters/shared/vite/index.d.ts +7 -19
  17. package/lib/adapters/shared/vite/index.mjs +244 -233
  18. package/lib/adapters/ssg/vite/index.d.ts +13 -0
  19. package/lib/adapters/ssg/vite/index.mjs +17 -0
  20. package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
  21. package/lib/adapters/vercel-edge/vite/index.mjs +33 -19
  22. package/lib/chunks/deepFreeze.qwik.mjs +18 -0
  23. package/lib/chunks/error-handler.mjs +57 -0
  24. package/lib/chunks/fs.mjs +144 -0
  25. package/lib/chunks/http-error.qwik.mjs +35 -0
  26. package/lib/chunks/not-found-wrapper.qwik.mjs +25 -0
  27. package/lib/chunks/pathname.mjs +105 -0
  28. package/lib/chunks/redirect-handler.mjs +6 -0
  29. package/lib/chunks/routing.qwik.mjs +821 -0
  30. package/lib/chunks/system.mjs +333 -0
  31. package/lib/chunks/url.mjs +61 -0
  32. package/lib/chunks/use-functions.qwik.mjs +35 -0
  33. package/lib/chunks/worker-thread.qwik.mjs +2573 -0
  34. package/lib/index.d.ts +362 -142
  35. package/lib/index.qwik.mjs +949 -1244
  36. package/lib/middleware/aws-lambda/index.d.ts +0 -5
  37. package/lib/middleware/aws-lambda/index.mjs +14 -17
  38. package/lib/middleware/azure-swa/index.mjs +16 -221
  39. package/lib/middleware/bun/index.d.ts +11 -0
  40. package/lib/middleware/bun/index.mjs +50 -97
  41. package/lib/middleware/cloudflare-pages/index.mjs +22 -31
  42. package/lib/middleware/deno/index.d.ts +11 -0
  43. package/lib/middleware/deno/index.mjs +49 -97
  44. package/lib/middleware/firebase/index.mjs +6 -15
  45. package/lib/middleware/netlify-edge/index.mjs +22 -32
  46. package/lib/middleware/node/index.mjs +31 -105
  47. package/lib/middleware/request-handler/index.d.ts +163 -88
  48. package/lib/middleware/request-handler/index.mjs +1458 -1260
  49. package/lib/middleware/vercel-edge/index.mjs +27 -36
  50. package/lib/modules.d.ts +11 -16
  51. package/lib/service-worker/index.mjs +4 -0
  52. package/lib/{static → ssg}/index.d.ts +45 -13
  53. package/lib/ssg/index.mjs +336 -0
  54. package/lib/vite/index.d.ts +38 -10
  55. package/lib/vite/index.mjs +2067 -26841
  56. package/modules.d.ts +11 -16
  57. package/package.json +62 -67
  58. package/ssg.d.ts +2 -0
  59. package/static.d.ts +1 -1
  60. package/lib/adapters/azure-swa/vite/index.cjs +0 -96
  61. package/lib/adapters/bun-server/vite/index.cjs +0 -50
  62. package/lib/adapters/cloud-run/vite/index.cjs +0 -47
  63. package/lib/adapters/cloudflare-pages/vite/index.cjs +0 -115
  64. package/lib/adapters/deno-server/vite/index.cjs +0 -62
  65. package/lib/adapters/netlify-edge/vite/index.cjs +0 -129
  66. package/lib/adapters/node-server/vite/index.cjs +0 -50
  67. package/lib/adapters/shared/vite/index.cjs +0 -378
  68. package/lib/adapters/static/vite/index.cjs +0 -368
  69. package/lib/adapters/static/vite/index.d.ts +0 -10
  70. package/lib/adapters/static/vite/index.mjs +0 -331
  71. package/lib/adapters/vercel-edge/vite/index.cjs +0 -118
  72. package/lib/index.qwik.cjs +0 -1947
  73. package/lib/middleware/node/index.cjs +0 -314
  74. package/lib/middleware/request-handler/index.cjs +0 -1614
  75. package/lib/service-worker.cjs +0 -17
  76. package/lib/service-worker.mjs +0 -15
  77. package/lib/static/deno.mjs +0 -8
  78. package/lib/static/index.cjs +0 -67
  79. package/lib/static/index.mjs +0 -48
  80. package/lib/static/node.cjs +0 -1124
  81. package/lib/static/node.mjs +0 -1086
  82. package/lib/vite/index.cjs +0 -27445
  83. package/middleware/request-handler/generated/not-found-paths.ts +0 -7
  84. package/middleware/request-handler/generated/static-paths.ts +0 -35
@@ -1,21 +1,32 @@
1
- // packages/qwik-router/src/adapters/vercel-edge/vite/index.ts
2
- import fs from "node:fs";
3
- import { dirname, join } from "node:path";
4
- import { getParentDir, viteAdapter } from "../../shared/vite/index.mjs";
1
+ import fs from 'node:fs';
2
+ import { join, dirname } from 'node:path';
3
+ import { viteAdapter, getParentDir } from '../../shared/vite/index.mjs';
4
+
5
5
  function vercelEdgeAdapter(opts = {}) {
6
- var _a;
7
6
  return viteAdapter({
8
7
  name: "vercel-edge",
9
- origin: ((_a = process == null ? void 0 : process.env) == null ? void 0 : _a.VERCEL_URL) || "https://yoursitename.vercel.app",
8
+ origin: process?.env?.VERCEL_URL || "https://yoursitename.vercel.app",
10
9
  ssg: opts.ssg,
11
10
  staticPaths: opts.staticPaths,
12
11
  cleanStaticGenerated: true,
13
12
  config(config) {
14
- var _a2;
15
- const outDir = ((_a2 = config.build) == null ? void 0 : _a2.outDir) || join(".vercel", "output", "functions", "_qwik-router.func");
13
+ const outDir = config.build?.outDir || join(".vercel", "output", "functions", "_qwik-router.func");
16
14
  return {
17
15
  resolve: {
18
- conditions: opts.target === "node" ? ["node", "import", "module", "browser", "default"] : ["edge-light", "webworker", "worker", "browser", "module", "main"]
16
+ conditions: opts.target === "node" ? [
17
+ "node",
18
+ "import",
19
+ "module",
20
+ "browser",
21
+ "default"
22
+ ] : [
23
+ "edge-light",
24
+ "webworker",
25
+ "worker",
26
+ "browser",
27
+ "module",
28
+ "main"
29
+ ]
19
30
  },
20
31
  ssr: {
21
32
  target: opts.target === "node" ? "node" : "webworker",
@@ -39,7 +50,9 @@ function vercelEdgeAdapter(opts = {}) {
39
50
  if (opts.outputConfig !== false) {
40
51
  const vercelOutputConfig = {
41
52
  routes: [
42
- { handle: "filesystem" },
53
+ {
54
+ handle: "filesystem"
55
+ },
43
56
  {
44
57
  src: basePathname + ".*",
45
58
  dest: "/_qwik-router"
@@ -47,10 +60,7 @@ function vercelEdgeAdapter(opts = {}) {
47
60
  ],
48
61
  version: 3
49
62
  };
50
- await fs.promises.writeFile(
51
- join(vercelOutputDir, "config.json"),
52
- JSON.stringify(vercelOutputConfig, null, 2)
53
- );
63
+ await fs.promises.writeFile(join(vercelOutputDir, "config.json"), JSON.stringify(vercelOutputConfig, null, 2));
54
64
  }
55
65
  let entrypoint = opts.vcConfigEntryPoint;
56
66
  if (!entrypoint) {
@@ -72,12 +82,16 @@ function vercelEdgeAdapter(opts = {}) {
72
82
  if (basePathnameParts.length > 0) {
73
83
  vercelStaticDir = join(vercelStaticDir, ...basePathnameParts);
74
84
  }
75
- await fs.promises.rm(vercelStaticDir, { recursive: true, force: true });
76
- await fs.promises.mkdir(dirname(vercelStaticDir), { recursive: true });
85
+ await fs.promises.rm(vercelStaticDir, {
86
+ recursive: true,
87
+ force: true
88
+ });
89
+ await fs.promises.mkdir(dirname(vercelStaticDir), {
90
+ recursive: true
91
+ });
77
92
  await fs.promises.rename(clientPublicOutDir, vercelStaticDir);
78
93
  }
79
94
  });
80
95
  }
81
- export {
82
- vercelEdgeAdapter
83
- };
96
+
97
+ export { vercelEdgeAdapter };
@@ -0,0 +1,18 @@
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 };
@@ -0,0 +1,57 @@
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 };
@@ -0,0 +1,144 @@
1
+ import { normalize, basename, dirname, relative } from 'node:path';
2
+ import { t as toTitleCase, n as normalizePathname } from './pathname.mjs';
3
+
4
+ function parseRouteIndexName(extlessName) {
5
+ let layoutName = "";
6
+ const layoutStop = extlessName.endsWith("!");
7
+ if (layoutStop) {
8
+ extlessName = extlessName.slice(0, extlessName.length - 1);
9
+ }
10
+ const namedLayoutParts = extlessName.split("@");
11
+ if (namedLayoutParts.length > 1) {
12
+ namedLayoutParts.shift();
13
+ layoutName = namedLayoutParts.join("@");
14
+ }
15
+ return {
16
+ layoutName,
17
+ layoutStop
18
+ };
19
+ }
20
+ function getExtension(fileName) {
21
+ if (typeof fileName === "string") {
22
+ const parts = fileName.trim().toLowerCase().split(".");
23
+ if (parts.length > 1) {
24
+ const ext = parts.pop().split("?")[0].split("#")[0];
25
+ if (ext === "ts" && parts.pop() === "d") {
26
+ return ".d.ts";
27
+ }
28
+ return "." + ext;
29
+ }
30
+ }
31
+ return "";
32
+ }
33
+ function removeExtension(fileName) {
34
+ if (typeof fileName === "string") {
35
+ fileName = fileName.trim();
36
+ const ext = getExtension(fileName);
37
+ return fileName.slice(0, fileName.length - ext.length);
38
+ }
39
+ return "";
40
+ }
41
+ function normalizePathSlash(path) {
42
+ const isExtendedLengthPath = path.startsWith("\\\\?\\");
43
+ const hasNonAscii = /[^\u0000-\u0080]+/.test(path);
44
+ if (isExtendedLengthPath || hasNonAscii) {
45
+ return path;
46
+ }
47
+ path = path.replace(/\\/g, "/");
48
+ if (path.endsWith("/")) {
49
+ path = path.slice(0, path.length - 1);
50
+ }
51
+ return path;
52
+ }
53
+ function normalizePath(path) {
54
+ return normalizePathSlash(normalize(path));
55
+ }
56
+ function getMenuPathname(opts, filePath) {
57
+ let pathname = normalizePath(relative(opts.routesDir, filePath));
58
+ pathname = `/` + normalizePath(dirname(pathname));
59
+ let result = normalizePathname(pathname, opts.basePathname);
60
+ if (!result.endsWith("/")) {
61
+ result += "/";
62
+ }
63
+ return result;
64
+ }
65
+ function createFileId(routesDir, fsPath, explicitFileType) {
66
+ const ids = [];
67
+ for (let i = 0; i < 25; i++) {
68
+ let baseName = removeExtension(basename(fsPath));
69
+ baseName = baseName.replace(/[\W_]+/g, "");
70
+ if (baseName === "") {
71
+ baseName = "Q" + i;
72
+ } else if (!isNaN(baseName.charAt(0))) {
73
+ baseName = "Q" + baseName;
74
+ }
75
+ ids.push(toTitleCase(baseName));
76
+ fsPath = normalizePath(dirname(fsPath));
77
+ if (fsPath === routesDir) {
78
+ break;
79
+ }
80
+ }
81
+ if (ids.length > 1 && ids[0] === "Index") {
82
+ ids.shift();
83
+ }
84
+ return ids.reverse().join("").concat(explicitFileType || "");
85
+ }
86
+ const PAGE_MODULE_EXTS = {
87
+ ".tsx": true,
88
+ ".jsx": true
89
+ };
90
+ const MODULE_EXTS = {
91
+ ".ts": true,
92
+ ".js": true
93
+ };
94
+ const MARKDOWN_EXTS = {
95
+ ".md": true,
96
+ ".mdx": true
97
+ };
98
+ function isIndexModule(extlessName) {
99
+ return /^index(|!|@.+)$/.test(extlessName);
100
+ }
101
+ function isPluginModule(extlessName) {
102
+ return /^plugin(|@.+)$/.test(extlessName) && !/\.(test|unit|spec)(\.[jt]s)?$/.test(extlessName);
103
+ }
104
+ function isLayoutModule(extlessName) {
105
+ return /^layout(|!|-.+)$/.test(extlessName);
106
+ }
107
+ function isPageModuleExt(ext) {
108
+ return ext in PAGE_MODULE_EXTS;
109
+ }
110
+ function isModuleExt(ext) {
111
+ return ext in MODULE_EXTS;
112
+ }
113
+ function isMarkdownExt(ext) {
114
+ return ext in MARKDOWN_EXTS;
115
+ }
116
+ function isPageExt(ext) {
117
+ return ext in PAGE_MODULE_EXTS || ext in MARKDOWN_EXTS;
118
+ }
119
+ function isMenuFileName(fileName) {
120
+ return fileName === "menu.md";
121
+ }
122
+ function isServiceWorkerName(extlessName) {
123
+ return extlessName === "service-worker";
124
+ }
125
+ function isEntryName(extlessName) {
126
+ return extlessName === "entry";
127
+ }
128
+ function isErrorName(extlessName) {
129
+ return extlessName === "error" || extlessName === "404";
130
+ }
131
+ function isGroupedLayoutName(dirName, warn = true) {
132
+ return dirName.startsWith("(") && dirName.endsWith(")");
133
+ }
134
+ function getPathnameFromDirPath(opts, dirPath) {
135
+ const relFilePath = relative(opts.routesDir, dirPath);
136
+ let pathname = normalizePath(relFilePath);
137
+ pathname = normalizePathname(pathname, opts.basePathname).split("/").filter((segment) => !isGroupedLayoutName(segment)).join("/");
138
+ if (pathname === "") {
139
+ return "/";
140
+ }
141
+ return pathname;
142
+ }
143
+
144
+ export { isErrorName as a, isLayoutModule as b, isEntryName as c, isMenuFileName as d, isServiceWorkerName as e, isPageModuleExt as f, getExtension as g, isModuleExt as h, isIndexModule as i, isMarkdownExt as j, normalizePath as k, getPathnameFromDirPath as l, getMenuPathname as m, normalizePathSlash as n, createFileId as o, parseRouteIndexName as p, isPluginModule as q, removeExtension as r, isPageExt as s };
@@ -0,0 +1,35 @@
1
+ import { componentQrl, inlinedQrl, _jsxSorted, _fnSignal } from '@qwik.dev/core';
2
+ import { k as useHttpStatus } from './use-functions.qwik.mjs';
3
+
4
+ const _hf0 = (p0) => p0.status || 500;
5
+ const _hf0_str = "p0.status||500";
6
+ const _hf1 = (p0) => p0.message || "";
7
+ const _hf1_str = 'p0.message||""';
8
+ const cacheKey = (status) => String(status);
9
+ const COLOR_400 = "#006ce9";
10
+ const COLOR_500 = "#713fc2";
11
+ const DisplayHttpStatus = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(() => {
12
+ const httpstatus = useHttpStatus();
13
+ const width = httpstatus.message ? "600px" : "300px";
14
+ const color = httpstatus.status < 500 ? COLOR_400 : COLOR_500;
15
+ const style = `
16
+ body { color: ${color}; background-color: #fafafa; padding: 30px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
17
+ p { max-width: ${width}; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px ${color}; overflow: hidden; }
18
+ strong { display: inline-block; padding: 15px; background: ${color}; color: white; }
19
+ span { display: inline-block; padding: 15px; }
20
+ `;
21
+ return /* @__PURE__ */ _jsxSorted("p", null, null, [
22
+ /* @__PURE__ */ _jsxSorted("style", {
23
+ dangerouslySetInnerHTML: style
24
+ }, null, null, 3, null),
25
+ /* @__PURE__ */ _jsxSorted("strong", null, null, _fnSignal(_hf0, [
26
+ httpstatus
27
+ ], _hf0_str), 3, null),
28
+ " ",
29
+ /* @__PURE__ */ _jsxSorted("span", null, null, _fnSignal(_hf1, [
30
+ httpstatus
31
+ ], _hf1_str), 3, null)
32
+ ], 1, "vY_0");
33
+ }, "DisplayHttpStatus_component_PJf4K4PL7Oc"));
34
+
35
+ export { cacheKey, DisplayHttpStatus as default };
@@ -0,0 +1,25 @@
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 };
@@ -0,0 +1,105 @@
1
+ function toTitleCase(str) {
2
+ return str.replace(/\w\S*/g, (txt) => {
3
+ return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase();
4
+ });
5
+ }
6
+ function addError(ctx, e) {
7
+ ctx.diagnostics.push({
8
+ type: "error",
9
+ message: e ? String(e.stack || e) : "Error"
10
+ });
11
+ }
12
+ function addWarning(ctx, message) {
13
+ ctx.diagnostics.push({
14
+ type: "warn",
15
+ message: String(message)
16
+ });
17
+ }
18
+ function msToString(ms) {
19
+ if (ms < 1) {
20
+ return ms.toFixed(2) + " ms";
21
+ }
22
+ if (ms < 1e3) {
23
+ return ms.toFixed(1) + " ms";
24
+ }
25
+ if (ms < 6e4) {
26
+ return (ms / 1e3).toFixed(1) + " s";
27
+ }
28
+ return (ms / 6e4).toFixed(1) + " m";
29
+ }
30
+
31
+ function normalizePathname(pathname, basePathname) {
32
+ if (typeof pathname === "string") {
33
+ pathname = pathname.trim();
34
+ if (pathname !== "") {
35
+ try {
36
+ pathname = pathname.replace(/\/+/g, "/");
37
+ if (pathname.startsWith("/")) {
38
+ pathname = pathname.slice(1);
39
+ }
40
+ pathname = new URL(basePathname + pathname, `https://qwik.dev`).pathname;
41
+ if (pathname !== basePathname) {
42
+ if (!globalThis.__NO_TRAILING_SLASH__) {
43
+ if (!pathname.endsWith("/")) {
44
+ const segments = pathname.split("/");
45
+ const lastSegment = segments[segments.length - 1];
46
+ if (!lastSegment.includes(".")) {
47
+ pathname += "/";
48
+ }
49
+ }
50
+ } else {
51
+ if (pathname.endsWith("/")) {
52
+ pathname = pathname.slice(0, pathname.length - 1);
53
+ }
54
+ }
55
+ }
56
+ return pathname;
57
+ } catch (e) {
58
+ console.error(e);
59
+ }
60
+ }
61
+ }
62
+ return null;
63
+ }
64
+ function getPathnameForDynamicRoute(originalPathname, paramNames, params) {
65
+ let pathname = originalPathname;
66
+ if (paramNames && params) {
67
+ for (const paramName of paramNames) {
68
+ const paramKey = `[${paramName}]`;
69
+ const restParamKey = `[...${paramName}]`;
70
+ const paramValue = params[paramName];
71
+ pathname = pathname.replace(restParamKey, paramValue);
72
+ pathname = pathname.replace(paramKey, paramValue);
73
+ }
74
+ }
75
+ return pathname;
76
+ }
77
+ const PROTOCOLS = {
78
+ https: true,
79
+ http: true,
80
+ about: true,
81
+ javascript: true,
82
+ file: true
83
+ };
84
+ function isSameOriginUrl(url) {
85
+ if (typeof url === "string") {
86
+ url = url.trim();
87
+ if (url !== "") {
88
+ const firstChar = url.charAt(0);
89
+ if (firstChar !== "/" && firstChar !== ".") {
90
+ if (firstChar === "#") {
91
+ return false;
92
+ }
93
+ const i = url.indexOf(":");
94
+ if (i > -1) {
95
+ const protocol = url.slice(0, i).toLowerCase();
96
+ return !PROTOCOLS[protocol];
97
+ }
98
+ }
99
+ return true;
100
+ }
101
+ }
102
+ return false;
103
+ }
104
+
105
+ export { addError as a, addWarning as b, getPathnameForDynamicRoute as g, isSameOriginUrl as i, msToString as m, normalizePathname as n, toTitleCase as t };
@@ -0,0 +1,6 @@
1
+ class AbortMessage {
2
+ }
3
+ class RedirectMessage extends AbortMessage {
4
+ }
5
+
6
+ export { AbortMessage as A, RedirectMessage as R };