@koine/next 1.1.16 → 1.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/config/index.js CHANGED
@@ -126,6 +126,12 @@ function getRoutesMap(map, routes, pathnameBuffer, templateBuffer) {
126
126
  }
127
127
  return map;
128
128
  }
129
+ /**
130
+ * Removes `/index` from a template/url path
131
+ */
132
+ function getWithoutIndex(template) {
133
+ return template.replace(/\/index$/, "");
134
+ }
129
135
  /**
130
136
  * Get path rewrite
131
137
  */
@@ -136,7 +142,7 @@ function getPathRewrite(route) {
136
142
  // console.log(`rewrite pathname "${source}" to template "${destination}"`);
137
143
  return {
138
144
  source: source,
139
- destination: destination.replace(/\/index$/, ""),
145
+ destination: getWithoutIndex(destination),
140
146
  };
141
147
  }
142
148
  exports.getPathRewrite = getPathRewrite;
@@ -150,7 +156,7 @@ function getPathRedirect(locale, route, permanent) {
150
156
  var destination = "/".concat(normaliseUrlPathname(pathname));
151
157
  // console.log(`redirect template "${source}" to pathname "${destination}"`);
152
158
  return {
153
- source: source.replace(/\/index$/, ""),
159
+ source: getWithoutIndex(source),
154
160
  destination: destination,
155
161
  permanent: Boolean(permanent),
156
162
  locale: false,
@@ -167,8 +173,11 @@ function getRedirects(defaultLocale, routes, permanent, debug) {
167
173
  routesMap = getRoutesMap({}, routes);
168
174
  Object.keys(routesMap).forEach(function (template) {
169
175
  var route = routesMap[template];
170
- if (route.pathname !== template) {
171
- redirects.push(getPathRedirect(defaultLocale, route, permanent));
176
+ // TODO: add option hideDefaultLocaleInUrl
177
+ // if (hideDefaultLocaleInUrl) {
178
+ redirects.push(getPathRedirect(defaultLocale, route, permanent));
179
+ // }
180
+ if (route.pathname !== getWithoutIndex(template)) {
172
181
  redirects.push(getPathRedirect("", route, permanent));
173
182
  }
174
183
  });
@@ -189,7 +198,7 @@ function getRewrites(routes, debug) {
189
198
  routesMap = getRoutesMap({}, routes);
190
199
  Object.keys(routesMap).forEach(function (template) {
191
200
  var route = routesMap[template];
192
- if (route.pathname !== template) {
201
+ if (route.pathname !== getWithoutIndex(template)) {
193
202
  rewrites.push(getPathRewrite(route));
194
203
  }
195
204
  });
package/config/index.mjs CHANGED
@@ -120,6 +120,12 @@ function getRoutesMap(map, routes, pathnameBuffer, templateBuffer) {
120
120
  }
121
121
  return map;
122
122
  }
123
+ /**
124
+ * Removes `/index` from a template/url path
125
+ */
126
+ function getWithoutIndex(template) {
127
+ return template.replace(/\/index$/, "");
128
+ }
123
129
  /**
124
130
  * Get path rewrite
125
131
  */
@@ -130,7 +136,7 @@ export function getPathRewrite(route) {
130
136
  // console.log(`rewrite pathname "${source}" to template "${destination}"`);
131
137
  return {
132
138
  source: source,
133
- destination: destination.replace(/\/index$/, ""),
139
+ destination: getWithoutIndex(destination),
134
140
  };
135
141
  }
136
142
  /**
@@ -143,7 +149,7 @@ export function getPathRedirect(locale, route, permanent) {
143
149
  var destination = "/".concat(normaliseUrlPathname(pathname));
144
150
  // console.log(`redirect template "${source}" to pathname "${destination}"`);
145
151
  return {
146
- source: source.replace(/\/index$/, ""),
152
+ source: getWithoutIndex(source),
147
153
  destination: destination,
148
154
  permanent: Boolean(permanent),
149
155
  locale: false,
@@ -159,8 +165,11 @@ export function getRedirects(defaultLocale, routes, permanent, debug) {
159
165
  routesMap = getRoutesMap({}, routes);
160
166
  Object.keys(routesMap).forEach(function (template) {
161
167
  var route = routesMap[template];
162
- if (route.pathname !== template) {
163
- redirects.push(getPathRedirect(defaultLocale, route, permanent));
168
+ // TODO: add option hideDefaultLocaleInUrl
169
+ // if (hideDefaultLocaleInUrl) {
170
+ redirects.push(getPathRedirect(defaultLocale, route, permanent));
171
+ // }
172
+ if (route.pathname !== getWithoutIndex(template)) {
164
173
  redirects.push(getPathRedirect("", route, permanent));
165
174
  }
166
175
  });
@@ -180,7 +189,7 @@ export function getRewrites(routes, debug) {
180
189
  routesMap = getRoutesMap({}, routes);
181
190
  Object.keys(routesMap).forEach(function (template) {
182
191
  var route = routesMap[template];
183
- if (route.pathname !== template) {
192
+ if (route.pathname !== getWithoutIndex(template)) {
184
193
  rewrites.push(getPathRewrite(route));
185
194
  }
186
195
  });
package/package.json CHANGED
@@ -74,34 +74,37 @@
74
74
  "@hookform/resolvers": "^2.9.11",
75
75
  "@kuus/yup": "1.0.0-beta.7",
76
76
  "@mui/base": "5.0.0-alpha.118",
77
- "@mui/material": "^5.11.9",
77
+ "@mui/material": "^5.11.10",
78
78
  "@mui/utils": "5.11.9",
79
- "@tiptap/react": "2.0.0-beta.217",
80
- "@tiptap/starter-kit": "2.0.0-beta.217",
79
+ "@tiptap/react": "2.0.0-beta.218",
80
+ "@tiptap/starter-kit": "2.0.0-beta.218",
81
81
  "clsx": "1.2.1",
82
82
  "date-fns": "^2.29.3",
83
- "framer-motion": "^9.0.4",
84
- "next": "^13.1.6",
83
+ "date-fns-tz": "^2.0.0",
84
+ "framer-motion": "^10.0.0",
85
+ "next": "^13.2.1",
85
86
  "next-auth": "^4.19.2",
86
87
  "next-seo": "^5.15.0",
87
- "next-translate": "^1.6.0",
88
+ "next-translate": "^2.0.2",
88
89
  "react": "^18.2.0",
89
90
  "react-dom": "^18.2.0",
90
- "react-hook-form": "^7.43.1",
91
+ "react-hook-form": "^7.43.2",
91
92
  "react-icons": "^4.7.1",
92
93
  "react-is": "^18.2.0",
93
94
  "react-swipeable": "^7.0.0",
94
95
  "styled-components": "^5.3.6",
95
96
  "ts-debounce": "^4.0.0",
96
97
  "tslib": "^2.5.0",
97
- "type-fest": "^3.5.7"
98
+ "type-fest": "^3.6.0"
98
99
  },
99
100
  "peerDependencies": {
100
- "@koine/react": "1.1.16",
101
- "@koine/utils": "1.1.16"
101
+ "@koine/browser": "1.2.1",
102
+ "@koine/dom": "1.2.1",
103
+ "@koine/react": "1.2.1",
104
+ "@koine/utils": "1.2.1"
102
105
  },
103
106
  "main": "./index.js",
104
107
  "types": "./index.d.ts",
105
- "version": "1.1.16",
108
+ "version": "1.2.1",
106
109
  "module": "./index.mjs"
107
110
  }