next-intl 4.0.0-beta-c40c5c9 → 4.0.0-beta-77949ef

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.
@@ -28,17 +28,16 @@ function createMessagesDeclaration(messagesPath) {
28
28
  if (!fullPath.endsWith('.json')) {
29
29
  throwError(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${fullPath}`);
30
30
  }
31
- const isDev = process.argv.includes('dev');
32
- const isBuild = process.argv.includes('build');
33
- if (!isDev && !isBuild) {
34
- return;
35
- }
31
+
32
+ // Keep this as a runtime check and don't replace
33
+ // this with a constant during the build process
34
+ const env = process.env['NODE_ENV'.trim()];
36
35
 
37
36
  // Next.js can call the Next.js config multiple
38
37
  // times - ensure we only run once.
39
38
  runOnce(() => {
40
39
  compileDeclaration(messagesPath);
41
- if (isDev) {
40
+ if (env === 'development') {
42
41
  startWatching(messagesPath);
43
42
  }
44
43
  });
@@ -17,17 +17,16 @@ function createMessagesDeclaration(messagesPath) {
17
17
  if (!fullPath.endsWith('.json')) {
18
18
  throwError(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${fullPath}`);
19
19
  }
20
- const isDev = process.argv.includes('dev');
21
- const isBuild = process.argv.includes('build');
22
- if (!isDev && !isBuild) {
23
- return;
24
- }
20
+
21
+ // Keep this as a runtime check and don't replace
22
+ // this with a constant during the build process
23
+ const env = process.env['NODE_ENV'.trim()];
25
24
 
26
25
  // Next.js can call the Next.js config multiple
27
26
  // times - ensure we only run once.
28
27
  runOnce(() => {
29
28
  compileDeclaration(messagesPath);
30
- if (isDev) {
29
+ if (env === 'development') {
31
30
  startWatching(messagesPath);
32
31
  }
33
32
  });
@@ -1 +1 @@
1
- import e from"fs";import s from"path";import{throwError as t}from"./utils.js";function n(n){const i=s.resolve(n);e.existsSync(i)||t(`\`createMessagesDeclaration\` points to a non-existent file: ${i}`),i.endsWith(".json")||t(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${i}`);const r=process.argv.includes("dev"),c=process.argv.includes("build");var a;(r||c)&&(a=()=>{o(n),r&&function(s){const t=e.watch(s,(e=>{"change"===e&&o(s,!0)}));process.on("exit",(()=>{t.close()}))}(n)},"1"!==process.env._NEXT_INTL_COMPILE_MESSAGES&&(process.env._NEXT_INTL_COMPILE_MESSAGES="1",a()))}function o(s,t=!1){const n=s.replace(/\.json$/,".d.json.ts");function o(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(n,o(s))));const i=e.readFileSync(s,"utf-8");e.writeFileSync(n,o(i))}export{n as default};
1
+ import e from"fs";import t from"path";import{throwError as s}from"./utils.js";function n(n){const i=t.resolve(n);e.existsSync(i)||s(`\`createMessagesDeclaration\` points to a non-existent file: ${i}`),i.endsWith(".json")||s(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${i}`);const r=process.env["NODE_ENV".trim()];var c;c=()=>{o(n),"development"===r&&function(t){const s=e.watch(t,(e=>{"change"===e&&o(t,!0)}));process.on("exit",(()=>{s.close()}))}(n)},"1"!==process.env._NEXT_INTL_COMPILE_MESSAGES&&(process.env._NEXT_INTL_COMPILE_MESSAGES="1",c())}function o(t,s=!1){const n=t.replace(/\.json$/,".d.json.ts");function o(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(n,o(t))));const i=e.readFileSync(t,"utf-8");e.writeFileSync(n,o(i))}export{n as default};
@@ -1,10 +1,22 @@
1
1
  import { createFormatter } from 'use-intl/core';
2
2
  declare function getFormatterCachedImpl(config: Parameters<typeof createFormatter>[0]): {
3
- dateTime: (value: Date | number, formatOrOptions?: string | import("use-intl/core").DateTimeFormatOptions) => string;
4
- number: (value: number | bigint, formatOrOptions?: string | import("use-intl/core").NumberFormatOptions) => string;
3
+ dateTime: {
4
+ (value: Date | number, options?: import("use-intl/core").DateTimeFormatOptions): string;
5
+ (value: Date | number, format?: string, options?: import("use-intl/core").DateTimeFormatOptions): string;
6
+ };
7
+ number: {
8
+ (value: number | bigint, options?: import("use-intl/core").NumberFormatOptions): string;
9
+ (value: number | bigint, format?: string, options?: import("use-intl/core").NumberFormatOptions): string;
10
+ };
5
11
  relativeTime: (date: number | Date, nowOrOptions?: import("use-intl/core").RelativeTimeFormatOptions["now"] | import("use-intl/core").RelativeTimeFormatOptions) => string;
6
- list: <Value extends string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, formatOrOptions?: string | Intl.ListFormatOptions) => Value extends string ? string : Iterable<import("react").ReactElement>;
7
- dateTimeRange: (start: Date | number, end: Date | number, formatOrOptions?: string | import("use-intl/core").DateTimeFormatOptions) => string;
12
+ list: {
13
+ <Value extends string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, options?: Intl.ListFormatOptions): Value extends string ? string : Iterable<import("react").ReactElement>;
14
+ <Value extends string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, format?: string, options?: Intl.ListFormatOptions): Value extends string ? string : Iterable<import("react").ReactElement>;
15
+ };
16
+ dateTimeRange: {
17
+ (start: Date | number, end: Date | number, options?: import("use-intl/core").DateTimeFormatOptions): string;
18
+ (start: Date | number, end: Date | number, format?: string, options?: import("use-intl/core").DateTimeFormatOptions): string;
19
+ };
8
20
  };
9
21
  declare const getFormatterCached: typeof getFormatterCachedImpl;
10
22
  export default getFormatterCached;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "4.0.0-beta-c40c5c9",
3
+ "version": "4.0.0-beta-77949ef",
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.0.0-beta-c40c5c9"
115
+ "use-intl": "4.0.0-beta-77949ef"
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": "2d8a449b1dbc4f02e75aa616f9943daeb60228c1"
127
+ "gitHead": "1c5f6e1ccef3db9cff75f14da2a590329faf03cf"
128
128
  }