@b9g/router 0.2.0 → 0.2.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b9g/router",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Universal request router built on web standards with generator-based middleware.",
5
5
  "keywords": [
6
6
  "router",
@@ -12,9 +12,14 @@
12
12
  "generator",
13
13
  "shovel"
14
14
  ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/bikeshaving/shovel.git",
18
+ "directory": "packages/router"
19
+ },
15
20
  "dependencies": {
16
- "@b9g/http-errors": "^0.2.0",
17
- "@b9g/match-pattern": "^0.2.0"
21
+ "@b9g/http-errors": "^0.2.1",
22
+ "@b9g/match-pattern": "^0.2.1"
18
23
  },
19
24
  "devDependencies": {
20
25
  "@b9g/libuild": "^0.1.18"
package/src/index.js CHANGED
@@ -135,7 +135,8 @@ var RadixTreeExecutor = class {
135
135
  */
136
136
  #matchTree(pathname, method) {
137
137
  const result = this.#matchTreeByPath(pathname);
138
- if (!result) return null;
138
+ if (!result)
139
+ return null;
139
140
  const { node, params } = result;
140
141
  let entry = node.routes.get(method);
141
142
  if (!entry && method === "HEAD") {
@@ -617,7 +618,8 @@ var Router = class {
617
618
  context,
618
619
  runningGenerators
619
620
  );
620
- if (currentResponse) break;
621
+ if (currentResponse)
622
+ break;
621
623
  }
622
624
  if (!currentResponse) {
623
625
  for (const middleware of routeMiddlewares) {
@@ -627,7 +629,8 @@ var Router = class {
627
629
  context,
628
630
  runningGenerators
629
631
  );
630
- if (currentResponse) break;
632
+ if (currentResponse)
633
+ break;
631
634
  }
632
635
  }
633
636
  if (!currentResponse) {
package/src/middleware.js CHANGED
@@ -4,7 +4,8 @@ function trailingSlash(mode) {
4
4
  return (req) => {
5
5
  const url = new URL(req.url);
6
6
  const pathname = url.pathname;
7
- if (pathname === "/") return;
7
+ if (pathname === "/")
8
+ return;
8
9
  let newPathname = null;
9
10
  if (mode === "strip" && pathname.endsWith("/")) {
10
11
  newPathname = pathname.slice(0, -1);