next-intl 4.3.4 → 4.3.6

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.
@@ -40,6 +40,25 @@ function runOnce(fn) {
40
40
  fn();
41
41
  }
42
42
  function createMessagesDeclaration(messagesPaths) {
43
+ // Instead of running _only_ in certain cases, it's
44
+ // safer to _avoid_ running for certain known cases.
45
+ // https://github.com/amannn/next-intl/issues/2006
46
+ const shouldBailOut = ['info', 'start'
47
+
48
+ // Note: These commands don't consult the
49
+ // Next.js config, so we can't detect them here.
50
+ // - telemetry
51
+ // - lint
52
+ //
53
+ // What remains are:
54
+ // - dev
55
+ // - build
56
+ // - typegen
57
+ ].some(arg => process.argv.includes(arg));
58
+ if (shouldBailOut) {
59
+ return;
60
+ }
61
+
43
62
  // Next.js can call the Next.js config multiple
44
63
  // times - ensure we only run once.
45
64
  runOnce(() => {
@@ -11,6 +11,25 @@ function runOnce(fn) {
11
11
  fn();
12
12
  }
13
13
  function createMessagesDeclaration(messagesPaths) {
14
+ // Instead of running _only_ in certain cases, it's
15
+ // safer to _avoid_ running for certain known cases.
16
+ // https://github.com/amannn/next-intl/issues/2006
17
+ const shouldBailOut = ['info', 'start'
18
+
19
+ // Note: These commands don't consult the
20
+ // Next.js config, so we can't detect them here.
21
+ // - telemetry
22
+ // - lint
23
+ //
24
+ // What remains are:
25
+ // - dev
26
+ // - build
27
+ // - typegen
28
+ ].some(arg => process.argv.includes(arg));
29
+ if (shouldBailOut) {
30
+ return;
31
+ }
32
+
14
33
  // Next.js can call the Next.js config multiple
15
34
  // times - ensure we only run once.
16
35
  runOnce(() => {
@@ -18,7 +18,7 @@ function validateUniqueLocalesPerDomain(domains) {
18
18
  }
19
19
  const duplicateLocaleMessages = Array.from(domainsByLocale.entries()).filter(([, localeDomains]) => localeDomains.size > 1).map(([locale, localeDomains]) => `- "${locale}" is used by: ${Array.from(localeDomains).join(', ')}`);
20
20
  if (duplicateLocaleMessages.length > 0) {
21
- console.warn('Locales are expected to be unique per domain, but found overlap:\n' + duplicateLocaleMessages.join('\n') + '\nPlease see https://next-intl.dev/docs/routing#domains');
21
+ console.warn('Locales are expected to be unique per domain, but found overlap:\n' + duplicateLocaleMessages.join('\n') + '\nPlease see https://next-intl.dev/docs/routing/configuration#domains');
22
22
  }
23
23
  }
24
24
 
@@ -17,7 +17,7 @@ async function getLocaleFromHeaderImpl() {
17
17
  locale = (await getHeaders()).get(HEADER_LOCALE_NAME) || undefined;
18
18
  } catch (error) {
19
19
  if (error instanceof Error && error.digest === 'DYNAMIC_SERVER_USAGE') {
20
- const wrappedError = new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering', {
20
+ const wrappedError = new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/routing/setup#static-rendering', {
21
21
  cause: error
22
22
  });
23
23
  wrappedError.digest = error.digest;
@@ -1 +1 @@
1
- import e from"fs";import t from"path";import{throwError as s}from"./utils.js";import o from"./watchFile.js";function n(o){var n;n=()=>{for(const n of o){const o=t.resolve(n);e.existsSync(o)||s(`\`createMessagesDeclaration\` points to a non-existent file: ${o}`),o.endsWith(".json")||s(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${o}`);const c=process.env["NODE_ENV".trim()];r(n),"development"===c&&i(n)}},"1"!==process.env._NEXT_INTL_COMPILE_MESSAGES&&(process.env._NEXT_INTL_COMPILE_MESSAGES="1",n())}function i(e){const t=o(e,(()=>{r(e,!0)}));process.on("exit",(()=>{t.close()}))}function r(t,s=!1){const o=t.replace(/\.json$/,".d.json.ts");function n(e){return`// This file is auto-generated by next-intl, do not edit directly.\n// See: https://next-intl.dev/docs/workflows/typescript#messages-arguments\n\ndeclare const messages: ${e.trim()};\nexport default messages;`}if(s)return e.promises.readFile(t,"utf-8").then((t=>e.promises.writeFile(o,n(t))));const i=e.readFileSync(t,"utf-8");e.writeFileSync(o,n(i))}export{n as default};
1
+ import e from"fs";import s from"path";import{throwError as t}from"./utils.js";import o from"./watchFile.js";function n(o){var n;["info","start"].some((e=>process.argv.includes(e)))||(n=()=>{for(const n of o){const o=s.resolve(n);e.existsSync(o)||t(`\`createMessagesDeclaration\` points to a non-existent file: ${o}`),o.endsWith(".json")||t(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${o}`);const c=process.env["NODE_ENV".trim()];i(n),"development"===c&&r(n)}},"1"!==process.env._NEXT_INTL_COMPILE_MESSAGES&&(process.env._NEXT_INTL_COMPILE_MESSAGES="1",n()))}function r(e){const s=o(e,(()=>{i(e,!0)}));process.on("exit",(()=>{s.close()}))}function i(s,t=!1){const o=s.replace(/\.json$/,".d.json.ts");function n(e){return`// This file is auto-generated by next-intl, do not edit directly.\n// See: https://next-intl.dev/docs/workflows/typescript#messages-arguments\n\ndeclare const messages: ${e.trim()};\nexport default messages;`}if(t)return e.promises.readFile(s,"utf-8").then((s=>e.promises.writeFile(o,n(s))));const r=e.readFileSync(s,"utf-8");e.writeFileSync(o,n(r))}export{n as default};
@@ -1 +1 @@
1
- import{headers as t}from"next/headers";import{cache as e}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";import{isPromise as r}from"../../shared/utils.js";import{getCachedRequestLocale as o}from"./RequestLocaleCache.js";const s=e((async function(){const e=t();return r(e)?await e:e}));const i=e((async function(){let t;try{t=(await s()).get(n)||void 0}catch(t){if(t instanceof Error&&"DYNAMIC_SERVER_USAGE"===t.digest){const e=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:t});throw e.digest=t.digest,e}throw t}return t}));async function a(){return o()||await i()}export{a as getRequestLocale};
1
+ import{headers as t}from"next/headers";import{cache as e}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";import{isPromise as r}from"../../shared/utils.js";import{getCachedRequestLocale as o}from"./RequestLocaleCache.js";const s=e((async function(){const e=t();return r(e)?await e:e}));const i=e((async function(){let t;try{t=(await s()).get(n)||void 0}catch(t){if(t instanceof Error&&"DYNAMIC_SERVER_USAGE"===t.digest){const e=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/routing/setup#static-rendering",{cause:t});throw e.digest=t.digest,e}throw t}return t}));async function a(){return o()||await i()}export{a as getRequestLocale};
@@ -17,7 +17,7 @@ export default function createNavigation<const AppLocales extends Locales, const
17
17
  scroll?: boolean | undefined;
18
18
  shallow?: boolean | undefined;
19
19
  passHref?: boolean | undefined;
20
- prefetch?: boolean | null | undefined;
20
+ prefetch?: boolean | "auto" | null | "unstable_forceStale" | undefined;
21
21
  legacyBehavior?: boolean | undefined;
22
22
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
23
23
  onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
@@ -18,7 +18,7 @@ export default function createNavigation<const AppLocales extends Locales, const
18
18
  scroll?: boolean | undefined;
19
19
  shallow?: boolean | undefined;
20
20
  passHref?: boolean | undefined;
21
- prefetch?: boolean | null | undefined;
21
+ prefetch?: boolean | "auto" | null | "unstable_forceStale" | undefined;
22
22
  legacyBehavior?: boolean | undefined;
23
23
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
24
24
  onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
@@ -36,7 +36,7 @@ export default function createSharedNavigationFns<const AppLocales extends Local
36
36
  scroll?: boolean | undefined;
37
37
  shallow?: boolean | undefined;
38
38
  passHref?: boolean | undefined;
39
- prefetch?: boolean | null | undefined;
39
+ prefetch?: boolean | "auto" | null | "unstable_forceStale" | undefined;
40
40
  legacyBehavior?: boolean | undefined;
41
41
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
42
42
  onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
@@ -14,12 +14,12 @@ export type RoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extend
14
14
  defaultLocale: AppLocales[number];
15
15
  /**
16
16
  * Configures whether and which prefix is shown for a given locale.
17
- * @see https://next-intl.dev/docs/routing#locale-prefix
17
+ * @see https://next-intl.dev/docs/routing/configuration#locale-prefix
18
18
  **/
19
19
  localePrefix?: LocalePrefix<AppLocales, AppLocalePrefixMode>;
20
20
  /**
21
21
  * Can be used to change the locale handling per domain.
22
- * @see https://next-intl.dev/docs/routing#domains
22
+ * @see https://next-intl.dev/docs/routing/configuration#domains
23
23
  **/
24
24
  domains?: AppDomains;
25
25
  /**
@@ -40,7 +40,7 @@ export type RoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extend
40
40
  } & ([AppPathnames] extends [never] ? {} : {
41
41
  /**
42
42
  * A map of localized pathnames per locale.
43
- * @see https://next-intl.dev/docs/routing#pathnames
43
+ * @see https://next-intl.dev/docs/routing/configuration#pathnames
44
44
  **/
45
45
  pathnames: AppPathnames;
46
46
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "4.3.4",
3
+ "version": "4.3.6",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -112,7 +112,7 @@
112
112
  "dependencies": {
113
113
  "@formatjs/intl-localematcher": "^0.5.4",
114
114
  "negotiator": "^1.0.0",
115
- "use-intl": "^4.3.4"
115
+ "use-intl": "^4.3.6"
116
116
  },
117
117
  "peerDependencies": {
118
118
  "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
@@ -124,5 +124,5 @@
124
124
  "optional": true
125
125
  }
126
126
  },
127
- "gitHead": "44f07b236ad9b1a9d6e99e55507e7a67939efe5a"
127
+ "gitHead": "081d952624d81d7b470f2c6676fbe9d7466af12f"
128
128
  }