intor 2.3.11 → 2.3.13
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.
|
@@ -22,6 +22,7 @@ import { readLocaleMessages } from './read-locale-messages/read-locale-messages.
|
|
|
22
22
|
* File traversal, parsing, and validation are delegated to lower-level utilities.
|
|
23
23
|
*/
|
|
24
24
|
const loadLocalMessages = async ({ id, locale, fallbackLocales, namespaces, rootDir = "messages", concurrency = 10, readOptions, pool = getGlobalMessagesPool(), allowCacheWrite = false, loggerOptions, }) => {
|
|
25
|
+
const isProd = process.env.NODE_ENV === "production";
|
|
25
26
|
const baseLogger = getLogger(loggerOptions);
|
|
26
27
|
const logger = baseLogger.child({ scope: "load-local-messages" });
|
|
27
28
|
const start = performance.now();
|
|
@@ -89,7 +90,7 @@ const loadLocalMessages = async ({ id, locale, fallbackLocales, namespaces, root
|
|
|
89
90
|
// ---------------------------------------------------------------------------
|
|
90
91
|
// Cache write (explicitly permitted)
|
|
91
92
|
// ---------------------------------------------------------------------------
|
|
92
|
-
if (allowCacheWrite) {
|
|
93
|
+
if (allowCacheWrite && isProd) {
|
|
93
94
|
if (cacheKey && messages) {
|
|
94
95
|
await pool?.set(cacheKey, messages);
|
|
95
96
|
}
|
|
@@ -22,6 +22,7 @@ import { readLocaleMessages } from './read-locale-messages/read-locale-messages.
|
|
|
22
22
|
* File traversal, parsing, and validation are delegated to lower-level utilities.
|
|
23
23
|
*/
|
|
24
24
|
const loadLocalMessages = async ({ id, locale, fallbackLocales, namespaces, rootDir = "messages", concurrency = 10, readOptions, pool = getGlobalMessagesPool(), allowCacheWrite = false, loggerOptions, }) => {
|
|
25
|
+
const isProd = process.env.NODE_ENV === "production";
|
|
25
26
|
const baseLogger = getLogger(loggerOptions);
|
|
26
27
|
const logger = baseLogger.child({ scope: "load-local-messages" });
|
|
27
28
|
const start = performance.now();
|
|
@@ -89,7 +90,7 @@ const loadLocalMessages = async ({ id, locale, fallbackLocales, namespaces, root
|
|
|
89
90
|
// ---------------------------------------------------------------------------
|
|
90
91
|
// Cache write (explicitly permitted)
|
|
91
92
|
// ---------------------------------------------------------------------------
|
|
92
|
-
if (allowCacheWrite) {
|
|
93
|
+
if (allowCacheWrite && isProd) {
|
|
93
94
|
if (cacheKey && messages) {
|
|
94
95
|
await pool?.set(cacheKey, messages);
|
|
95
96
|
}
|
|
@@ -22,6 +22,7 @@ import { readLocaleMessages } from './read-locale-messages/read-locale-messages.
|
|
|
22
22
|
* File traversal, parsing, and validation are delegated to lower-level utilities.
|
|
23
23
|
*/
|
|
24
24
|
const loadLocalMessages = async ({ id, locale, fallbackLocales, namespaces, rootDir = "messages", concurrency = 10, readOptions, pool = getGlobalMessagesPool(), allowCacheWrite = false, loggerOptions, }) => {
|
|
25
|
+
const isProd = process.env.NODE_ENV === "production";
|
|
25
26
|
const baseLogger = getLogger(loggerOptions);
|
|
26
27
|
const logger = baseLogger.child({ scope: "load-local-messages" });
|
|
27
28
|
const start = performance.now();
|
|
@@ -89,7 +90,7 @@ const loadLocalMessages = async ({ id, locale, fallbackLocales, namespaces, root
|
|
|
89
90
|
// ---------------------------------------------------------------------------
|
|
90
91
|
// Cache write (explicitly permitted)
|
|
91
92
|
// ---------------------------------------------------------------------------
|
|
92
|
-
if (allowCacheWrite) {
|
|
93
|
+
if (allowCacheWrite && isProd) {
|
|
93
94
|
if (cacheKey && messages) {
|
|
94
95
|
await pool?.set(cacheKey, messages);
|
|
95
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intor",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.13",
|
|
4
4
|
"description": "A modular and extensible i18n core designed for TypeScript and JavaScript projects. Intor enables custom translation logic with support for both frontend and backend environments, featuring runtime configuration, caching, adapters, and message loaders.",
|
|
5
5
|
"author": "Yiming Liao",
|
|
6
6
|
"homepage": "https://github.com/yiming-liao/intor#readme",
|
|
@@ -32,11 +32,15 @@
|
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
34
34
|
"import": "./dist/core/export/index.js",
|
|
35
|
-
"types": "./dist/types/export/index.d.ts"
|
|
35
|
+
"types": "./dist/types/export/index.d.ts",
|
|
36
|
+
"require": "./dist/core/export/index.js",
|
|
37
|
+
"default": "./dist/core/export/index.js"
|
|
36
38
|
},
|
|
37
39
|
"./server": {
|
|
38
40
|
"import": "./dist/core/export/server/index.js",
|
|
39
|
-
"types": "./dist/types/export/server/index.d.ts"
|
|
41
|
+
"types": "./dist/types/export/server/index.d.ts",
|
|
42
|
+
"require": "./dist/core/export/server/index.js",
|
|
43
|
+
"default": "./dist/core/export/server/index.js"
|
|
40
44
|
},
|
|
41
45
|
"./internal": {
|
|
42
46
|
"types": "./dist/types/export/internal/index.d.ts"
|
|
@@ -67,7 +71,9 @@
|
|
|
67
71
|
},
|
|
68
72
|
"./express": {
|
|
69
73
|
"import": "./dist/express/export/express/index.js",
|
|
70
|
-
"types": "./dist/types/export/express/index.d.ts"
|
|
74
|
+
"types": "./dist/types/export/express/index.d.ts",
|
|
75
|
+
"require": "./dist/express/export/express/index.js",
|
|
76
|
+
"default": "./dist/express/export/express/index.js"
|
|
71
77
|
}
|
|
72
78
|
},
|
|
73
79
|
"main": "./dist/core/export/index.js",
|