next-intl 4.0.0-beta-c40c5c9 → 4.0.0-beta-40d535a
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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 (
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 (
|
|
29
|
+
if (env === 'development') {
|
|
31
30
|
startWatching(messagesPath);
|
|
32
31
|
}
|
|
33
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"fs";import
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "4.0.0-beta-
|
|
3
|
+
"version": "4.0.0-beta-40d535a",
|
|
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-
|
|
115
|
+
"use-intl": "4.0.0-beta-40d535a"
|
|
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": "
|
|
127
|
+
"gitHead": "036819e56a60031af2e0ef875916954dd6cc944d"
|
|
128
128
|
}
|