Skip to content

Commit ca68f02

Browse files
committed
fix: Merge remote-tracking branch 'origin/main' into v4
2 parents 15c826b + a881e62 commit ca68f02

File tree

14 files changed

+50
-20
lines changed

14 files changed

+50
-20
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## 3.26.4 (2025-02-18)
7+
8+
### Bug Fixes
9+
10+
* Add workaround for OpenTelemetry/Zone.js ([#1719](https://github.com/amannn/next-intl/issues/1719)) ([1cac9a6](https://github.com/amannn/next-intl/commit/1cac9a65d2aefe20ff7fcf734e70f1fe85cac19d)), closes [#1711](https://github.com/amannn/next-intl/issues/1711) – by @amannn
11+
612
## 3.26.3 (2024-12-20)
713

814
### Bug Fixes

docs/src/pages/blog/next-intl-4-0.mdx

+3-2
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@ I'm particularly excited about the announcement of `rootParams`, as it seems lik
233233
2. Require locale to be returned from `getRequestConfig` (see [PR #1486](https://github.com/amannn/next-intl/pull/1486))
234234
3. Disallow passing `null`, `undefined` or `boolean` as an ICU argument (see [PR #1561](https://github.com/amannn/next-intl/pull/1561))
235235
4. Bump minimum required TypeScript version to 5 for projects using TypeScript (see [PR #1481](https://github.com/amannn/next-intl/pull/1481))
236-
5. Remove deprecated APIs (see [PR #1479](https://github.com/amannn/next-intl/pull/1479))
237-
6. Remove deprecated APIs pt. 2 (see [PR #1482](https://github.com/amannn/next-intl/pull/1482))
236+
5. Return `x-default` alternate link also for sub pages when using `localePrefix: 'always'` and update middleware matcher suggestion in docs (see [PR #1720](https://github.com/amannn/next-intl/pull/1720))
237+
6. Remove deprecated APIs (see [PR #1479](https://github.com/amannn/next-intl/pull/1479))
238+
7. Remove deprecated APIs pt. 2 (see [PR #1482](https://github.com/amannn/next-intl/pull/1482))
238239

239240
## Upgrade now
240241

lerna.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json",
3-
"version": "3.26.3",
4-
"packages": ["packages/*"],
3+
"version": "3.26.4",
4+
"packages": [
5+
"packages/*"
6+
],
57
"npmClient": "pnpm",
68
"changelogPreset": "conventional-changelog-conventionalcommits",
79
"command": {

packages/next-intl/.size-limit.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const config: SizeLimitConfig = [
1515
{
1616
name: "import * from 'next-intl' (react-server)",
1717
path: 'dist/esm/production/index.react-server.js',
18-
limit: '14.035 KB'
18+
limit: '14.055 KB'
1919
},
2020
{
2121
name: "import {createNavigation} from 'next-intl/navigation' (react-client)",
@@ -27,7 +27,7 @@ const config: SizeLimitConfig = [
2727
name: "import {createNavigation} from 'next-intl/navigation' (react-server)",
2828
path: 'dist/esm/production/navigation.react-server.js',
2929
import: '{createNavigation}',
30-
limit: '3.25 KB'
30+
limit: '3.255 KB'
3131
},
3232
{
3333
name: "import * from 'next-intl/server' (react-client)",
@@ -37,7 +37,7 @@ const config: SizeLimitConfig = [
3737
{
3838
name: "import * from 'next-intl/server' (react-server)",
3939
path: 'dist/esm/production/server.react-server.js',
40-
limit: '13.335 KB'
40+
limit: '13.375 KB'
4141
},
4242
{
4343
name: "import * from 'next-intl/middleware'",

packages/next-intl/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## 3.26.4 (2025-02-18)
7+
8+
### Bug Fixes
9+
10+
* Add workaround for OpenTelemetry/Zone.js ([#1719](https://github.com/amannn/next-intl/issues/1719)) ([1cac9a6](https://github.com/amannn/next-intl/commit/1cac9a65d2aefe20ff7fcf734e70f1fe85cac19d)), closes [#1711](https://github.com/amannn/next-intl/issues/1711) – by @amannn
11+
612
## 3.26.3 (2024-12-20)
713

814
### Bug Fixes

packages/next-intl/__mocks__/react.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import {isPromise} from '../src/shared/utils';
2+
13
// @ts-expect-error -- React uses CJS
24
export * from 'react';
35

46
export {default} from 'react';
57

68
export function use(promise: Promise<unknown> & {value?: unknown}) {
7-
if (!(promise instanceof Promise)) {
9+
if (!isPromise(promise)) {
810
throw new Error('Expected a promise, got ' + typeof promise);
911
}
1012

packages/next-intl/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next-intl",
3-
"version": "3.26.3",
3+
"version": "3.26.4",
44
"sideEffects": false,
55
"author": "Jan Amann <jan@amann.work>",
66
"funding": [

packages/next-intl/src/navigation/shared/createSharedNavigationFns.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {
1818
} from '../../routing/types.js';
1919
import type {ParametersExceptFirst, Prettify} from '../../shared/types.js';
2020
import use from '../../shared/use.js';
21-
import {isLocalizableHref} from '../../shared/utils.js';
21+
import {isLocalizableHref, isPromise} from '../../shared/utils.js';
2222
import BaseLink from './BaseLink.js';
2323
import {
2424
type HrefOrHrefWithParams,
@@ -107,10 +107,9 @@ export default function createSharedNavigationFns<
107107
const isLocalizable = isLocalizableHref(href);
108108

109109
const localePromiseOrValue = getLocale();
110-
const curLocale =
111-
localePromiseOrValue instanceof Promise
112-
? use(localePromiseOrValue)
113-
: localePromiseOrValue;
110+
const curLocale = isPromise(localePromiseOrValue)
111+
? use(localePromiseOrValue)
112+
: localePromiseOrValue;
114113

115114
const finalPathname = isLocalizable
116115
? getPathname(

packages/next-intl/src/react-server/index.test.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {describe, expect, it, vi} from 'vitest';
22
import {getTranslations} from '../server.react-server.js';
3+
import {isPromise} from '../shared/utils.js';
34
import {renderToStream} from './testUtils.js';
45
import {
56
_createCache,
@@ -72,7 +73,7 @@ describe('performance', () => {
7273
try {
7374
useTranslations('Component');
7475
} catch (promiseOrError) {
75-
if (promiseOrError instanceof Promise) {
76+
if (isPromise(promiseOrError)) {
7677
await promiseOrError;
7778
useTranslations('Component');
7879
} else {

packages/next-intl/src/server/react-server/RequestLocale.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ import {headers} from 'next/headers.js';
22
import {cache} from 'react';
33
import type {Locale} from 'use-intl';
44
import {HEADER_LOCALE_NAME} from '../../shared/constants.js';
5+
import {isPromise} from '../../shared/utils.js';
56
import {getCachedRequestLocale} from './RequestLocaleCache.js';
67

78
async function getHeadersImpl(): Promise<Headers> {
89
const promiseOrValue = headers();
910

1011
// Compatibility with Next.js <15
11-
return promiseOrValue instanceof Promise
12-
? await promiseOrValue
13-
: promiseOrValue;
12+
return isPromise(promiseOrValue) ? await promiseOrValue : promiseOrValue;
1413
}
1514
const getHeaders = cache(getHeadersImpl);
1615

packages/next-intl/src/server/react-server/getConfig.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
_createIntlFormatters,
77
initializeConfig
88
} from 'use-intl/core';
9+
import {isPromise} from '../../shared/utils.js';
910
import {getRequestLocale} from './RequestLocale.js';
1011
import createRequestConfig from './createRequestConfig.js';
1112
import type {GetRequestConfigParams} from './getRequestConfig.js';
@@ -52,7 +53,7 @@ See also: https://next-intl.dev/docs/usage/configuration#i18n-request
5253
};
5354

5455
let result = getConfig(params);
55-
if (result instanceof Promise) {
56+
if (isPromise(result)) {
5657
result = await result;
5758
}
5859

packages/next-intl/src/shared/utils.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,10 @@ function comparePathnamePairs(a: string, b: string): number {
176176
export function getSortedPathnames(pathnames: Array<string>) {
177177
return pathnames.sort(comparePathnamePairs);
178178
}
179+
180+
export function isPromise<Value>(
181+
value: Value | Promise<Value>
182+
): value is Promise<Value> {
183+
// https://github.com/amannn/next-intl/issues/1711
184+
return typeof (value as any).then === 'function';
185+
}

packages/use-intl/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## 3.26.4 (2025-02-18)
7+
8+
### Bug Fixes
9+
10+
* Add workaround for OpenTelemetry/Zone.js ([#1719](https://github.com/amannn/next-intl/issues/1719)) ([1cac9a6](https://github.com/amannn/next-intl/commit/1cac9a65d2aefe20ff7fcf734e70f1fe85cac19d)), closes [#1711](https://github.com/amannn/next-intl/issues/1711) – by @amannn
11+
612
## 3.26.3 (2024-12-20)
713

814
### Bug Fixes

packages/use-intl/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "use-intl",
3-
"version": "3.26.3",
3+
"version": "3.26.4",
44
"sideEffects": false,
55
"author": "Jan Amann <jan@amann.work>",
66
"description": "Internationalization (i18n) for React",

0 commit comments

Comments
 (0)