next-intl 2.14.0-beta.1 → 2.14.0-beta.2
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/dist/client/next-intl.esm.js +2 -2
- package/dist/client/next-intl.esm3.js +4 -20
- package/dist/client/next-intl.esm3.js.map +1 -1
- package/dist/client/next-intl.esm4.js +20 -4
- package/dist/client/next-intl.esm4.js.map +1 -1
- package/package.json +1 -1
- package/plugin.d.ts +1 -1
- package/plugin.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extends as _extends } from '../_virtual/next-intl.esm.js';
|
|
2
2
|
import localizePathname from '../shared/next-intl.esm3.js';
|
|
3
|
-
import getCookieLocale from './next-intl.
|
|
4
|
-
import hasPathnamePrefixed from './next-intl.
|
|
3
|
+
import getCookieLocale from './next-intl.esm4.js';
|
|
4
|
+
import hasPathnamePrefixed from './next-intl.esm3.js';
|
|
5
5
|
|
|
6
6
|
function localizeHref(href, locale, pathname) {
|
|
7
7
|
var cookieLocale = getCookieLocale();
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// https://stackoverflow.com/a/15724300/343045
|
|
5
|
-
var value = "; " + document.cookie;
|
|
6
|
-
var parts = value.split("; " + name + "=");
|
|
7
|
-
|
|
8
|
-
if (parts.length === 2) {
|
|
9
|
-
var _parts$pop;
|
|
10
|
-
|
|
11
|
-
var part = (_parts$pop = parts.pop()) == null ? void 0 : _parts$pop.split(';').shift();
|
|
12
|
-
if (part) return part;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
throw new Error("Unable to find next-intl cookie, have you configured the middleware?");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function getCookieLocale() {
|
|
19
|
-
return getCookieValueByName(COOKIE_LOCALE_NAME);
|
|
1
|
+
function hasPathnamePrefixed(locale, pathname) {
|
|
2
|
+
var prefix = "/" + locale;
|
|
3
|
+
return pathname === prefix || pathname.startsWith(prefix + "/") && pathname.length > prefix.length;
|
|
20
4
|
}
|
|
21
5
|
|
|
22
|
-
export {
|
|
6
|
+
export { hasPathnamePrefixed as default };
|
|
23
7
|
//# sourceMappingURL=next-intl.esm3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-intl.esm3.js","sources":["../../src/client/
|
|
1
|
+
{"version":3,"file":"next-intl.esm3.js","sources":["../../src/client/hasPathnamePrefixed.tsx"],"sourcesContent":["export default function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return (\n pathname === prefix ||\n (pathname.startsWith(`${prefix}/`) && pathname.length > prefix.length)\n );\n}\n"],"names":["hasPathnamePrefixed","locale","pathname","prefix","startsWith","length"],"mappings":"AAAc,SAAUA,mBAAV,CAA8BC,MAA9B,EAA8CC,QAA9C,EAA8D;AAC1E,EAAMC,IAAAA,MAAM,SAAOF,MAAnB,CAAA;AACA,EAAA,OACEC,QAAQ,KAAKC,MAAb,IACCD,QAAQ,CAACE,UAAT,CAAuBD,MAAvB,GAAA,GAAA,CAAA,IAAqCD,QAAQ,CAACG,MAAT,GAAkBF,MAAM,CAACE,MAFjE,CAAA;AAID;;;;"}
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { COOKIE_LOCALE_NAME } from '../shared/next-intl.esm4.js';
|
|
2
|
+
|
|
3
|
+
function getCookieValueByName(name) {
|
|
4
|
+
// https://stackoverflow.com/a/15724300/343045
|
|
5
|
+
var value = "; " + document.cookie;
|
|
6
|
+
var parts = value.split("; " + name + "=");
|
|
7
|
+
|
|
8
|
+
if (parts.length === 2) {
|
|
9
|
+
var _parts$pop;
|
|
10
|
+
|
|
11
|
+
var part = (_parts$pop = parts.pop()) == null ? void 0 : _parts$pop.split(';').shift();
|
|
12
|
+
if (part) return part;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
throw new Error("Unable to find next-intl cookie, have you configured the middleware?");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getCookieLocale() {
|
|
19
|
+
return getCookieValueByName(COOKIE_LOCALE_NAME);
|
|
4
20
|
}
|
|
5
21
|
|
|
6
|
-
export {
|
|
22
|
+
export { getCookieLocale as default };
|
|
7
23
|
//# sourceMappingURL=next-intl.esm4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-intl.esm4.js","sources":["../../src/client/
|
|
1
|
+
{"version":3,"file":"next-intl.esm4.js","sources":["../../src/client/getCookieLocale.tsx"],"sourcesContent":["import {COOKIE_LOCALE_NAME} from '../shared/constants';\n\nfunction getCookieValueByName(name: string) {\n // https://stackoverflow.com/a/15724300/343045\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n const part = parts.pop()?.split(';').shift();\n if (part) return part;\n }\n\n throw new Error(\n `Unable to find next-intl cookie, have you configured the middleware?`\n );\n}\n\nexport default function getCookieLocale() {\n return getCookieValueByName(COOKIE_LOCALE_NAME);\n}\n"],"names":["getCookieValueByName","name","value","document","cookie","parts","split","length","part","pop","shift","Error","getCookieLocale","COOKIE_LOCALE_NAME"],"mappings":";;AAEA,SAASA,oBAAT,CAA8BC,IAA9B,EAA0C;AACxC;AACA,EAAA,IAAMC,KAAK,GAAA,IAAA,GAAQC,QAAQ,CAACC,MAA5B,CAAA;AACA,EAAA,IAAMC,KAAK,GAAGH,KAAK,CAACI,KAAN,CAAA,IAAA,GAAiBL,IAAjB,GAAd,GAAA,CAAA,CAAA;;AACA,EAAA,IAAII,KAAK,CAACE,MAAN,KAAiB,CAArB,EAAwB;AAAA,IAAA,IAAA,UAAA,CAAA;;AACtB,IAAA,IAAMC,IAAI,GAAA,CAAA,UAAA,GAAGH,KAAK,CAACI,GAAN,EAAH,KAAG,IAAA,GAAA,KAAA,CAAA,GAAA,UAAA,CAAaH,KAAb,CAAmB,GAAnB,CAAA,CAAwBI,KAAxB,EAAb,CAAA;AACA,IAAIF,IAAAA,IAAJ,EAAU,OAAOA,IAAP,CAAA;AACX,GAAA;;AAED,EAAM,MAAA,IAAIG,KAAJ,CAAN,sEAAA,CAAA,CAAA;AAGD,CAAA;;AAEa,SAAUC,eAAV,GAAyB;AACrC,EAAOZ,OAAAA,oBAAoB,CAACa,kBAAD,CAA3B,CAAA;AACD;;;;"}
|
package/package.json
CHANGED
package/plugin.d.ts
CHANGED
package/plugin.js
CHANGED
|
@@ -39,7 +39,7 @@ module.exports = withNextIntl({
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
if (
|
|
42
|
+
if (nextConfig.i18n != null) {
|
|
43
43
|
console.warn(
|
|
44
44
|
"\nnext-intl has found an `i18n` config in your next.config.js. This likely causes conflicts and should therefore be removed if you use the React Server Components integration.\n\nIf you're in progress of migrating from the `pages` folder, you can refer to this example: https://github.com/amannn/next-intl/tree/feat/next-13-rsc/packages/example-next-13-with-pages\n"
|
|
45
45
|
);
|