@depup/next-intl 4.13.3-depup.6 → 4.13.4-depup.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/README.md CHANGED
@@ -13,7 +13,7 @@ npm install @depup/next-intl
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [next-intl](https://www.npmjs.com/package/next-intl) @ 4.13.3 |
16
+ | Original | [next-intl](https://www.npmjs.com/package/next-intl) @ 4.13.4 |
17
17
  | Processed | 2026-07-23 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 3 |
package/changes.json CHANGED
@@ -13,6 +13,6 @@
13
13
  "to": "^1.15.46"
14
14
  }
15
15
  },
16
- "timestamp": "2026-07-23T08:55:29.257Z",
16
+ "timestamp": "2026-07-23T16:34:27.980Z",
17
17
  "totalUpdated": 3
18
18
  }
@@ -6,19 +6,25 @@ import { useLocale } from 'use-intl';
6
6
  import syncLocaleCookie from './syncLocaleCookie.js';
7
7
  import { jsx } from 'react/jsx-runtime';
8
8
 
9
- function BaseLink({
10
- href,
9
+ // Somehow the types for `next/link` don't work as expected
10
+ // when `moduleResolution: "nodenext"` is used.
11
+ const Link = NextLink;
12
+
13
+ // Links that change the locale are handled in a separate component,
14
+ // since reading the pathname (necessary for syncing the locale cookie)
15
+ // requires a Suspense boundary when Cache Components are used. Due to
16
+ // this split, regular links are not subject to this requirement.
17
+ function LocaleChangingLink({
18
+ curLocale,
19
+ linkRef,
11
20
  locale,
12
21
  localeCookie,
13
22
  onClick,
14
23
  prefetch,
15
24
  ...rest
16
- }, ref) {
17
- const curLocale = useLocale();
18
- const isChangingLocale = locale != null && locale !== curLocale;
19
-
25
+ }) {
20
26
  // The types aren't entirely correct here. Outside of Next.js
21
- // `useParams` can be called, but the return type is `null`.
27
+ // `usePathname` can be called, but the return type is `null`.
22
28
  const pathname = usePathname();
23
29
  function onLinkClick(event) {
24
30
  // Even though we force a prefix when changing locales,
@@ -27,22 +33,35 @@ function BaseLink({
27
33
  syncLocaleCookie(localeCookie, pathname, curLocale, locale);
28
34
  if (onClick) onClick(event);
29
35
  }
36
+ if (prefetch && "development" !== 'production') {
37
+ console.error('The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`');
38
+ }
39
+ return /*#__PURE__*/jsx(Link, {
40
+ ref: linkRef,
41
+ hrefLang: locale,
42
+ onClick: onLinkClick,
43
+ prefetch: false,
44
+ ...rest
45
+ });
46
+ }
47
+ function BaseLink({
48
+ locale,
49
+ localeCookie,
50
+ ...rest
51
+ }, ref) {
52
+ const curLocale = useLocale();
53
+ const isChangingLocale = locale != null && locale !== curLocale;
30
54
  if (isChangingLocale) {
31
- if (prefetch && "development" !== 'production') {
32
- console.error('The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`');
33
- }
34
- prefetch = false;
55
+ return /*#__PURE__*/jsx(LocaleChangingLink, {
56
+ curLocale: curLocale,
57
+ linkRef: ref,
58
+ locale: locale,
59
+ localeCookie: localeCookie,
60
+ ...rest
61
+ });
35
62
  }
36
-
37
- // Somehow the types for `next/link` don't work as expected
38
- // when `moduleResolution: "nodenext"` is used.
39
- const Link = NextLink;
40
63
  return /*#__PURE__*/jsx(Link, {
41
64
  ref: ref,
42
- href: href,
43
- hrefLang: isChangingLocale ? locale : undefined,
44
- onClick: onLinkClick,
45
- prefetch: prefetch,
46
65
  ...rest
47
66
  });
48
67
  }
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import o from"next/link";import{usePathname as r}from"next/navigation";import{forwardRef as e}from"react";import{useLocale as t}from"use-intl";import i from"./syncLocaleCookie.js";import{jsx as n}from"react/jsx-runtime";function f({href:e,locale:f,localeCookie:c,onClick:m,prefetch:l,...a},p){const s=t(),u=null!=f&&f!==s,h=r();u&&(l=!1);return n(o,{ref:p,href:e,hrefLang:u?f:void 0,onClick:function(o){i(c,h,s,f),m&&m(o)},prefetch:l,...a})}var c=e(f);export{c as default};
2
+ import o from"next/link";import{usePathname as e}from"next/navigation";import{forwardRef as r}from"react";import{useLocale as n}from"use-intl";import t from"./syncLocaleCookie.js";import{jsx as c}from"react/jsx-runtime";const l=o;function i({curLocale:o,linkRef:r,locale:n,localeCookie:i,onClick:a,prefetch:f,...m}){const u=e();return c(l,{ref:r,hrefLang:n,onClick:function(e){t(i,u,o,n),a&&a(e)},prefetch:!1,...m})}function a({locale:o,localeCookie:e,...r},t){const a=n();return null!=o&&o!==a?c(i,{curLocale:a,linkRef:t,locale:o,localeCookie:e,...r}):c(l,{ref:t,...r})}var f=r(a);export{f as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/next-intl",
3
- "version": "4.13.3-depup.6",
3
+ "version": "4.13.4-depup.0",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -134,11 +134,11 @@
134
134
  "@formatjs/intl-localematcher": "^0.8.13",
135
135
  "@parcel/watcher": "^2.6.0",
136
136
  "@swc/core": "^1.15.46",
137
- "icu-minify": "^4.13.3",
137
+ "icu-minify": "^4.13.4",
138
138
  "negotiator": "^1.0.0",
139
- "next-intl-swc-plugin-extractor": "^4.13.3",
139
+ "next-intl-swc-plugin-extractor": "^4.13.4",
140
140
  "po-parser": "^2.1.1",
141
- "use-intl": "^4.13.3"
141
+ "use-intl": "^4.13.4"
142
142
  },
143
143
  "peerDependencies": {
144
144
  "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
@@ -149,7 +149,7 @@
149
149
  "optional": true
150
150
  }
151
151
  },
152
- "gitHead": "89ae78319a4a6da95bdcbb91dc11e9ba56d745ae",
152
+ "gitHead": "7fa175d0303804fea48aad0c8b5de89077948e9c",
153
153
  "depup": {
154
154
  "changes": {
155
155
  "@formatjs/intl-localematcher": {
@@ -167,8 +167,8 @@
167
167
  },
168
168
  "depsUpdated": 3,
169
169
  "originalPackage": "next-intl",
170
- "originalVersion": "4.13.3",
171
- "processedAt": "2026-07-23T08:55:41.963Z",
170
+ "originalVersion": "4.13.4",
171
+ "processedAt": "2026-07-23T16:34:49.563Z",
172
172
  "smokeTest": "passed"
173
173
  }
174
174
  }