@uxf/router 11.80.4 → 11.80.5

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": "@uxf/router",
3
- "version": "11.80.4",
3
+ "version": "11.80.5",
4
4
  "description": "UXF Router",
5
5
  "author": "UXFans <dev@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/router#readme",
@@ -31,16 +31,19 @@ function routesCheck(routes, options) {
31
31
  if (fileExists((0, path_1.join)(options.pagesDir, ...pathParts, "index.ts"))) {
32
32
  return;
33
33
  }
34
+ const pagesPathParts = [...pathParts]; // clone
34
35
  // TODO @vejvis - proč tu je tahle podmínka?
35
- const lastPart = pathParts.splice(-1);
36
- const pagePath = pathParts.length > 0
37
- ? (0, path_1.join)(options.pagesDir, ...pathParts, `${lastPart[0] || "index"}.ts`)
36
+ const lastPart = pagesPathParts.splice(-1);
37
+ const pagePath = pagesPathParts.length > 0
38
+ ? (0, path_1.join)(options.pagesDir, ...pagesPathParts, `${lastPart[0] || "index"}.ts`)
38
39
  : (0, path_1.join)(options.pagesDir, `${lastPart[0] || "index"}.tsx`);
39
40
  if (fileExists(pagePath)) {
40
41
  return;
41
42
  }
42
- if (fileExists((0, path_1.join)(options.appDir, ...pathname.substr(1).split("/"), "page.ts"))) {
43
- // app directory
43
+ if (fileExists((0, path_1.join)(options.appDir, ...pathParts, "page.ts"))) {
44
+ return;
45
+ }
46
+ if (fileExists((0, path_1.join)(options.appDir, ...pathParts, "route.ts"))) {
44
47
  return;
45
48
  }
46
49
  throw new Error("Invalid");
@@ -12,6 +12,7 @@ describe("routesCheck", () => {
12
12
  route5: { path: "/product-2/[id]" }, // path parameter, index file
13
13
  app1: { path: "/app-directory" },
14
14
  app2: { path: "/app-directory/[param]" },
15
+ app3: { path: "/api" },
15
16
  }, {
16
17
  shouldProcessExit: false,
17
18
  appDir: (0, path_1.join)(__dirname, "__test__", "app"),