next-intl 3.22.0-canary.0 → 3.22.0
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/development/middleware/getAlternateLinksHeaderValue.js +1 -1
- package/dist/development/middleware/middleware.js +17 -20
- package/dist/development/middleware/resolveLocale.js +21 -30
- package/dist/development/middleware/syncCookie.js +7 -7
- package/dist/development/middleware/utils.js +4 -1
- package/dist/development/navigation/react-client/createLocalizedPathnamesNavigation.js +4 -2
- package/dist/development/navigation/react-client/createNavigation.js +1 -1
- package/dist/development/navigation/react-client/createSharedPathnamesNavigation.js +4 -2
- package/dist/development/navigation/react-client/useBaseRouter.js +3 -3
- package/dist/development/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -0
- package/dist/development/navigation/react-server/createSharedPathnamesNavigation.js +2 -0
- package/dist/development/navigation/shared/BaseLink.js +2 -1
- package/dist/development/navigation/shared/LegacyBaseLink.js +3 -1
- package/dist/development/navigation/shared/createSharedNavigationFns.js +2 -1
- package/dist/development/navigation/shared/syncLocaleCookie.js +26 -5
- package/dist/development/plugin.js +16 -6
- package/dist/development/react-client/index.js +3 -1
- package/dist/development/routing/config.js +18 -1
- package/dist/development/server/react-client/index.js +2 -0
- package/dist/development/server/react-server/RequestLocale.js +1 -1
- package/dist/development/server/react-server/RequestLocaleLegacy.js +1 -1
- package/dist/development/server/react-server/createRequestConfig.js +1 -1
- package/dist/development/server.react-client.js +1 -0
- package/dist/development/server.react-server.js +1 -0
- package/dist/development/shared/constants.js +0 -9
- package/dist/development/shared/utils.js +2 -2
- package/dist/esm/middleware/getAlternateLinksHeaderValue.js +1 -1
- package/dist/esm/middleware/middleware.js +1 -1
- package/dist/esm/middleware/resolveLocale.js +1 -1
- package/dist/esm/middleware/syncCookie.js +1 -1
- package/dist/esm/middleware/utils.js +1 -1
- package/dist/esm/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/react-client/createNavigation.js +1 -1
- package/dist/esm/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/react-client/useBaseRouter.js +1 -1
- package/dist/esm/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/shared/BaseLink.js +1 -1
- package/dist/esm/navigation/shared/LegacyBaseLink.js +1 -1
- package/dist/esm/navigation/shared/createSharedNavigationFns.js +1 -1
- package/dist/esm/navigation/shared/syncLocaleCookie.js +1 -1
- package/dist/esm/plugin.js +1 -1
- package/dist/esm/routing/config.js +1 -1
- package/dist/esm/server/react-client/index.js +1 -1
- package/dist/esm/server/react-server/RequestLocale.js +1 -1
- package/dist/esm/server/react-server/RequestLocaleLegacy.js +1 -1
- package/dist/esm/server.react-client.js +1 -1
- package/dist/esm/server.react-server.js +1 -1
- package/dist/esm/shared/constants.js +1 -1
- package/dist/production/middleware/getAlternateLinksHeaderValue.js +1 -1
- package/dist/production/middleware/middleware.js +1 -1
- package/dist/production/middleware/resolveLocale.js +1 -1
- package/dist/production/middleware/syncCookie.js +1 -1
- package/dist/production/middleware/utils.js +1 -1
- package/dist/production/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-client/createNavigation.js +1 -1
- package/dist/production/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-client/useBaseRouter.js +1 -1
- package/dist/production/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/shared/BaseLink.js +1 -1
- package/dist/production/navigation/shared/LegacyBaseLink.js +1 -1
- package/dist/production/navigation/shared/createSharedNavigationFns.js +1 -1
- package/dist/production/navigation/shared/syncLocaleCookie.js +1 -1
- package/dist/production/plugin.js +1 -1
- package/dist/production/routing/config.js +1 -1
- package/dist/production/server/react-client/index.js +1 -1
- package/dist/production/server/react-server/RequestLocale.js +1 -1
- package/dist/production/server/react-server/RequestLocaleLegacy.js +1 -1
- package/dist/production/server.react-client.js +1 -1
- package/dist/production/server.react-server.js +1 -1
- package/dist/production/shared/constants.js +1 -1
- package/dist/types/src/middleware/middleware.d.ts +10 -2
- package/dist/types/src/middleware/resolveLocale.d.ts +2 -3
- package/dist/types/src/middleware/syncCookie.d.ts +2 -2
- package/dist/types/src/middleware/utils.d.ts +1 -1
- package/dist/types/src/navigation/react-client/ClientLink.d.ts +1 -1
- package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +5 -4
- package/dist/types/src/navigation/react-client/createNavigation.d.ts +14 -13
- package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +5 -4
- package/dist/types/src/navigation/react-client/index.d.ts +1 -1
- package/dist/types/src/navigation/react-client/useBasePathname.d.ts +1 -1
- package/dist/types/src/navigation/react-client/useBaseRouter.d.ts +3 -2
- package/dist/types/src/navigation/react-server/ServerLink.d.ts +1 -1
- package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +4 -3
- package/dist/types/src/navigation/react-server/createNavigation.d.ts +14 -13
- package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +1 -1
- package/dist/types/src/navigation/shared/BaseLink.d.ts +2 -0
- package/dist/types/src/navigation/shared/LegacyBaseLink.d.ts +2 -0
- package/dist/types/src/navigation/shared/createSharedNavigationFns.d.ts +18 -14
- package/dist/types/src/navigation/shared/redirects.d.ts +1 -1
- package/dist/types/src/navigation/shared/syncLocaleCookie.d.ts +2 -1
- package/dist/types/src/react-client/index.d.ts +1 -1
- package/dist/types/src/react-server/getTranslator.d.ts +1 -1
- package/dist/types/src/routing/config.d.ts +30 -3
- package/dist/types/src/server/react-client/index.d.ts +2 -1
- package/dist/types/src/server/react-server/getRequestConfig.d.ts +1 -1
- package/dist/types/src/server/react-server/getTranslations.d.ts +1 -1
- package/dist/types/src/server/react-server/index.d.ts +4 -1
- package/dist/types/src/shared/constants.d.ts +0 -3
- package/dist/types/src/shared/utils.d.ts +4 -4
- package/package.json +5 -4
- package/dist/types/src/middleware/config.d.ts +0 -21
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement, ReactNodeArray } from 'react';
|
|
2
|
-
import { Formats,
|
|
2
|
+
import { Formats, MarkupTranslationValues, MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf, RichTranslationValues, TranslationValues } from 'use-intl/core';
|
|
3
3
|
declare function getTranslations<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>(namespace?: NestedKey): Promise<{
|
|
4
4
|
<TargetKey extends MessageKeys<NestedValueOf<{
|
|
5
5
|
'!': IntlMessages;
|
|
@@ -8,4 +8,7 @@ export { default as getTimeZone } from './getTimeZone';
|
|
|
8
8
|
export { default as getTranslations } from './getTranslations';
|
|
9
9
|
export { default as getMessages } from './getMessages';
|
|
10
10
|
export { default as getLocale } from './getLocale';
|
|
11
|
-
export { setCachedRequestLocale as
|
|
11
|
+
export { setCachedRequestLocale as setRequestLocale } from './RequestLocaleCache';
|
|
12
|
+
export {
|
|
13
|
+
/** @deprecated Deprecated in favor of `setRequestLocale`. */
|
|
14
|
+
setCachedRequestLocale as unstable_setRequestLocale } from './RequestLocaleCache';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export declare const COOKIE_LOCALE_NAME = "NEXT_LOCALE";
|
|
2
|
-
export declare const COOKIE_MAX_AGE = 31536000;
|
|
3
|
-
export declare const COOKIE_SAME_SITE = "lax";
|
|
4
1
|
export declare const COOKIE_BASE_PATH_NAME = "NEXT_INTL_BASE_PATH";
|
|
5
2
|
export declare const HEADER_LOCALE_NAME = "X-NEXT-INTL-LOCALE";
|
|
6
3
|
export declare const LOCALE_SEGMENT_NAME = "locale";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { UrlObject } from 'url';
|
|
2
2
|
import NextLink from 'next/link';
|
|
3
3
|
import { ComponentProps } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../routing/types';
|
|
5
5
|
type Href = ComponentProps<typeof NextLink>['href'];
|
|
6
6
|
export declare function isLocalizableHref(href: Href): boolean;
|
|
7
|
-
export declare function localizeHref(href: string, locale: string, curLocale: string, curPathname: string, prefix
|
|
8
|
-
export declare function localizeHref(href: UrlObject | string, locale: string, curLocale: string, curPathname: string, prefix
|
|
7
|
+
export declare function localizeHref(href: string, locale: string, curLocale: string, curPathname: string, prefix?: string): string;
|
|
8
|
+
export declare function localizeHref(href: UrlObject | string, locale: string, curLocale: string, curPathname: string, prefix?: string): UrlObject | string;
|
|
9
9
|
export declare function prefixHref(href: string, prefix: string): string;
|
|
10
10
|
export declare function prefixHref(href: UrlObject | string, prefix: string): UrlObject | string;
|
|
11
11
|
export declare function unprefixPathname(pathname: string, prefix: string): string;
|
|
12
12
|
export declare function prefixPathname(prefix: string, pathname: string): string;
|
|
13
|
-
export declare function hasPathnamePrefixed(prefix: string, pathname: string): boolean;
|
|
13
|
+
export declare function hasPathnamePrefixed(prefix: string | undefined, pathname: string): boolean;
|
|
14
14
|
export declare function normalizeTrailingSlash(pathname: string): string;
|
|
15
15
|
export declare function matchesPathname(
|
|
16
16
|
/** E.g. `/users/[userId]-[userName]` */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "3.22.0
|
|
3
|
+
"version": "3.22.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"funding": [
|
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
"build": "rm -rf dist && rollup -c",
|
|
21
21
|
"test": "TZ=Europe/Berlin vitest",
|
|
22
22
|
"lint": "pnpm run lint:source && pnpm run lint:package",
|
|
23
|
-
"lint:source": "eslint src test && tsc --noEmit",
|
|
23
|
+
"lint:source": "eslint src test && tsc --noEmit && pnpm run lint:prettier",
|
|
24
24
|
"lint:package": "publint && attw --pack",
|
|
25
|
+
"lint:prettier": "prettier src --check",
|
|
25
26
|
"prepublishOnly": "turbo build && cp ../../README.md .",
|
|
26
27
|
"postpublish": "git checkout . && rm ./README.md",
|
|
27
28
|
"size": "size-limit"
|
|
@@ -87,11 +88,11 @@
|
|
|
87
88
|
"dependencies": {
|
|
88
89
|
"@formatjs/intl-localematcher": "^0.5.4",
|
|
89
90
|
"negotiator": "^0.6.3",
|
|
90
|
-
"use-intl": "^3.22.0
|
|
91
|
+
"use-intl": "^3.22.0"
|
|
91
92
|
},
|
|
92
93
|
"peerDependencies": {
|
|
93
94
|
"next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
94
95
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
95
96
|
},
|
|
96
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "02bc1190dc993b202e50e52de75ee36d0172e3db"
|
|
97
98
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
type ResponseCookieOptions = Pick<NonNullable<Parameters<typeof NextResponse.prototype.cookies.set>['2']>, 'maxAge' | 'domain' | 'expires' | 'partitioned' | 'path' | 'priority' | 'sameSite' | 'secure'>;
|
|
3
|
-
export type MiddlewareOptions = {
|
|
4
|
-
/**
|
|
5
|
-
* Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http
|
|
6
|
-
* @see https://next-intl-docs.vercel.app/docs/routing/middleware#alternate-links
|
|
7
|
-
**/
|
|
8
|
-
alternateLinks?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Can be used to disable the locale cookie or to customize it.
|
|
11
|
-
* @see https://next-intl-docs.vercel.app/docs/routing/middleware#locale-cookie
|
|
12
|
-
*/
|
|
13
|
-
localeCookie?: boolean | ResponseCookieOptions;
|
|
14
|
-
/**
|
|
15
|
-
* By setting this to `false`, the cookie as well as the `accept-language` header will no longer be used for locale detection.
|
|
16
|
-
* @see https://next-intl-docs.vercel.app/docs/routing/middleware#locale-detection
|
|
17
|
-
**/
|
|
18
|
-
localeDetection?: boolean;
|
|
19
|
-
};
|
|
20
|
-
export type ResolvedMiddlewareOptions = Required<MiddlewareOptions>;
|
|
21
|
-
export {};
|