@replohq/sdk 1.9.2 → 1.9.3
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/lib/buildMetadata.js +3 -3
- package/package.json +4 -4
- package/routing/evaluate.js +21 -6
- package/routing/locale.d.ts +1 -1
- package/routing/locale.js +5 -1
package/lib/buildMetadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const BUILD_METADATA = {
|
|
2
2
|
"packageName": "@replohq/sdk",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.3",
|
|
4
4
|
"branch": "HEAD",
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-09-
|
|
5
|
+
"commit": "c32fdfc2a6a7ee4c9353574f7c61b940fe0bbb19",
|
|
6
|
+
"builtAt": "2026-09-18T15:00:53.352Z"
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replohq/sdk",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.3",
|
|
4
4
|
"reploBuild": {
|
|
5
5
|
"packageName": "@replohq/sdk",
|
|
6
|
-
"version": "1.9.
|
|
6
|
+
"version": "1.9.3",
|
|
7
7
|
"branch": "HEAD",
|
|
8
|
-
"commit": "
|
|
9
|
-
"builtAt": "2026-09-
|
|
8
|
+
"commit": "c32fdfc2a6a7ee4c9353574f7c61b940fe0bbb19",
|
|
9
|
+
"builtAt": "2026-09-18T15:00:53.352Z"
|
|
10
10
|
},
|
|
11
11
|
"description": "Replo SDK — cart, analytics, and data loaders for agent-built Next.js sites.",
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE",
|
package/routing/evaluate.js
CHANGED
|
@@ -123,7 +123,7 @@ function evaluateLocalePhase({
|
|
|
123
123
|
if (isLocaleExemptPath(pathname)) {
|
|
124
124
|
return NextResponse.next();
|
|
125
125
|
}
|
|
126
|
-
const { urlMode, pathLocale, negotiated, scope } = localeContext;
|
|
126
|
+
const { urlMode, pathLocale, negotiated, scope, config } = localeContext;
|
|
127
127
|
if (urlMode === "prefixed") {
|
|
128
128
|
if (!pathLocale) {
|
|
129
129
|
const url2 = request.nextUrl.clone();
|
|
@@ -133,12 +133,13 @@ function evaluateLocalePhase({
|
|
|
133
133
|
});
|
|
134
134
|
return NextResponse.redirect(url2, 307);
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
const canonicalPath = canonicalPrefixedPathname({
|
|
137
|
+
pathLocale,
|
|
138
|
+
locales: config.locales
|
|
139
|
+
});
|
|
140
|
+
if (canonicalPath !== pathname) {
|
|
137
141
|
const url2 = request.nextUrl.clone();
|
|
138
|
-
url2.pathname =
|
|
139
|
-
locale: pathLocale.locale,
|
|
140
|
-
path: pathLocale.logicalPath
|
|
141
|
-
});
|
|
142
|
+
url2.pathname = canonicalPath;
|
|
142
143
|
return NextResponse.redirect(url2, 308);
|
|
143
144
|
}
|
|
144
145
|
const response = NextResponse.next();
|
|
@@ -163,6 +164,20 @@ function evaluateLocalePhase({
|
|
|
163
164
|
});
|
|
164
165
|
return NextResponse.rewrite(url);
|
|
165
166
|
}
|
|
167
|
+
function canonicalPrefixedPathname({
|
|
168
|
+
pathLocale,
|
|
169
|
+
locales
|
|
170
|
+
}) {
|
|
171
|
+
const nestedLocale = getLocaleFromPath({
|
|
172
|
+
pathname: pathLocale.logicalPath,
|
|
173
|
+
locales
|
|
174
|
+
});
|
|
175
|
+
const chosen = nestedLocale ?? pathLocale;
|
|
176
|
+
return withLocalePrefix({
|
|
177
|
+
locale: chosen.locale,
|
|
178
|
+
path: chosen.logicalPath
|
|
179
|
+
});
|
|
180
|
+
}
|
|
166
181
|
function isLocaleExemptPath(pathname) {
|
|
167
182
|
if (pathname === "/api" || pathname.startsWith("/api/")) {
|
|
168
183
|
return true;
|
package/routing/locale.d.ts
CHANGED
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export type { LocaleDetection, LocaleRoutingConfig, LocaleRoutingConfigInput, LocaleUrlMode, } from "../_vendor/schemas/routing/locale";
|
|
12
12
|
export { REPLO_COUNTRY_OVERRIDE_COOKIE, REPLO_LOCALE_COOKIE, reploLocaleRouting, } from "../_vendor/schemas/routing/locale";
|
|
13
|
-
export { localeUrl } from "../_vendor/schemas/routing/localeNegotiation";
|
|
13
|
+
export { getLocaleFromPath, localeUrl, } from "../_vendor/schemas/routing/localeNegotiation";
|
package/routing/locale.js
CHANGED
|
@@ -3,10 +3,14 @@ import {
|
|
|
3
3
|
REPLO_LOCALE_COOKIE,
|
|
4
4
|
reploLocaleRouting
|
|
5
5
|
} from "../_vendor/schemas/routing/locale.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
getLocaleFromPath,
|
|
8
|
+
localeUrl
|
|
9
|
+
} from "../_vendor/schemas/routing/localeNegotiation.mjs";
|
|
7
10
|
export {
|
|
8
11
|
REPLO_COUNTRY_OVERRIDE_COOKIE,
|
|
9
12
|
REPLO_LOCALE_COOKIE,
|
|
13
|
+
getLocaleFromPath,
|
|
10
14
|
localeUrl,
|
|
11
15
|
reploLocaleRouting
|
|
12
16
|
};
|