@koine/next 1.0.69 → 1.0.70

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/config/index.d.ts CHANGED
@@ -101,7 +101,7 @@ declare type KoineNextConfig = {
101
101
  * {
102
102
  * "category": {
103
103
  * "[slug]": {
104
- * "[id]": "/categories/{{ slug }}/{{ id* }}"
104
+ * "[id]": "/categories/{{ slug }}/{{ id }}*"
105
105
  * }
106
106
  * }
107
107
  * }
package/config/index.js CHANGED
@@ -56,8 +56,8 @@ export function encodePathname(pathname) {
56
56
  *
57
57
  * Here we add the wildcard flag maybe found in the pathname to the template
58
58
  * name too, this is because we do not want to have the wildcard in the JSON
59
- * keys as those are also used to construct the links through `useTo` hook and
60
- * handling asterisks there might become cumbersome.
59
+ * keys as those are also used to throught the `useT` hook and having asterisks
60
+ * there is a bit cumbersome.
61
61
  *
62
62
  * @see https://nextjs.org/docs/messages/invalid-multi-match
63
63
  */
@@ -69,13 +69,14 @@ function transformRoute(route) {
69
69
  var pathname = pathnameParts
70
70
  .map(function (part) {
71
71
  var _a, _b;
72
+ var hasWildcard = part.endsWith("*");
73
+ part = part.replace("*", "");
72
74
  var isDynamic = part.startsWith("{{") && part.endsWith("}}");
73
75
  var asValue = isDynamic
74
76
  ? (_b = (_a = part.match(/{{(.+)}}/)) === null || _a === void 0 ? void 0 : _a[1].trim()) !== null && _b !== void 0 ? _b : ""
75
77
  : part.trim();
76
- var hasWildcard = part.includes("*");
77
- var asPath = encodeURIComponent(asValue.replace("*", "")) + (hasWildcard ? "*" : "");
78
- mapPartsByIdx[asValue.replace("*", "")] = {
78
+ var asPath = encodeURIComponent(asValue) + (hasWildcard ? "*" : "");
79
+ mapPartsByIdx[asValue] = {
79
80
  isDynamic: isDynamic,
80
81
  hasWildcard: hasWildcard,
81
82
  };
@@ -90,7 +91,7 @@ function transformRoute(route) {
90
91
  ? (_b = (_a = part.match(/\[(.+)\]/)) === null || _a === void 0 ? void 0 : _a[1].trim()) !== null && _b !== void 0 ? _b : ""
91
92
  : part.trim();
92
93
  var hasWildcard = (_c = mapPartsByIdx[asValue]) === null || _c === void 0 ? void 0 : _c.hasWildcard;
93
- var asPath = encodeURIComponent(asValue.replace("*", "")) + (hasWildcard ? "*" : "");
94
+ var asPath = encodeURIComponent(asValue) + (hasWildcard ? "*" : "");
94
95
  return isDynamic ? ":".concat(asPath) : asPath;
95
96
  })
96
97
  .join("/");
@@ -62,8 +62,8 @@ exports.encodePathname = encodePathname;
62
62
  *
63
63
  * Here we add the wildcard flag maybe found in the pathname to the template
64
64
  * name too, this is because we do not want to have the wildcard in the JSON
65
- * keys as those are also used to construct the links through `useTo` hook and
66
- * handling asterisks there might become cumbersome.
65
+ * keys as those are also used to throught the `useT` hook and having asterisks
66
+ * there is a bit cumbersome.
67
67
  *
68
68
  * @see https://nextjs.org/docs/messages/invalid-multi-match
69
69
  */
@@ -75,13 +75,14 @@ function transformRoute(route) {
75
75
  var pathname = pathnameParts
76
76
  .map(function (part) {
77
77
  var _a, _b;
78
+ var hasWildcard = part.endsWith("*");
79
+ part = part.replace("*", "");
78
80
  var isDynamic = part.startsWith("{{") && part.endsWith("}}");
79
81
  var asValue = isDynamic
80
82
  ? (_b = (_a = part.match(/{{(.+)}}/)) === null || _a === void 0 ? void 0 : _a[1].trim()) !== null && _b !== void 0 ? _b : ""
81
83
  : part.trim();
82
- var hasWildcard = part.includes("*");
83
- var asPath = encodeURIComponent(asValue.replace("*", "")) + (hasWildcard ? "*" : "");
84
- mapPartsByIdx[asValue.replace("*", "")] = {
84
+ var asPath = encodeURIComponent(asValue) + (hasWildcard ? "*" : "");
85
+ mapPartsByIdx[asValue] = {
85
86
  isDynamic: isDynamic,
86
87
  hasWildcard: hasWildcard,
87
88
  };
@@ -96,7 +97,7 @@ function transformRoute(route) {
96
97
  ? (_b = (_a = part.match(/\[(.+)\]/)) === null || _a === void 0 ? void 0 : _a[1].trim()) !== null && _b !== void 0 ? _b : ""
97
98
  : part.trim();
98
99
  var hasWildcard = (_c = mapPartsByIdx[asValue]) === null || _c === void 0 ? void 0 : _c.hasWildcard;
99
- var asPath = encodeURIComponent(asValue.replace("*", "")) + (hasWildcard ? "*" : "");
100
+ var asPath = encodeURIComponent(asValue) + (hasWildcard ? "*" : "");
100
101
  return isDynamic ? ":".concat(asPath) : asPath;
101
102
  })
102
103
  .join("/");
package/node/to.js CHANGED
@@ -17,7 +17,7 @@ function to() {
17
17
  var t = args[0];
18
18
  if (args.length === 3) {
19
19
  if (args[2]) {
20
- relative = t(args[1], args[2]);
20
+ relative = t(args[1], args[2]).replace("*", "");
21
21
  }
22
22
  }
23
23
  else if (args.length === 2) {
package/package.json CHANGED
@@ -18,9 +18,9 @@
18
18
  "peerDependencies": {
19
19
  "react": "^16.8 || ^17 || ^18",
20
20
  "next": "^12.2.3",
21
- "@koine/utils": "1.0.69",
21
+ "@koine/utils": "1.0.70",
22
22
  "framer-motion": "^6.5.1",
23
- "@koine/react": "1.0.69",
23
+ "@koine/react": "1.0.70",
24
24
  "styled-components": "^5.3.5",
25
25
  "@mui/base": "^5.0.0-alpha.90",
26
26
  "react-icons": "^4.4.0",
@@ -41,7 +41,7 @@
41
41
  "next-seo": "^5.5.0",
42
42
  "@hookform/resolvers": "^2.9.6"
43
43
  },
44
- "version": "1.0.69",
44
+ "version": "1.0.70",
45
45
  "module": "./index.js",
46
46
  "types": "./index.d.ts"
47
47
  }
package/to.js CHANGED
@@ -14,7 +14,7 @@ export function to() {
14
14
  var t = args[0];
15
15
  if (args.length === 3) {
16
16
  if (args[2]) {
17
- relative = t(args[1], args[2]);
17
+ relative = t(args[1], args[2]).replace("*", "");
18
18
  }
19
19
  }
20
20
  else if (args.length === 2) {