intor 2.3.18 → 2.3.20
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/dist/core/src/server/messages/load-local-messages/read-locale-messages/collect-file-entries/collect-file-entries.js +14 -13
- package/dist/express/src/server/messages/load-local-messages/read-locale-messages/collect-file-entries/collect-file-entries.js +14 -13
- package/dist/next/src/server/messages/load-local-messages/read-locale-messages/collect-file-entries/collect-file-entries.js +14 -13
- package/dist/types/export/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ import { getLogger } from '../../../../../core/logger/get-logger.js';
|
|
|
20
20
|
* }, ... ];
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
async function collectFileEntries({ readdir = fs.readdir, namespaces, rootDir, limit, exts = [
|
|
23
|
+
async function collectFileEntries({ readdir = fs.readdir, namespaces, rootDir, limit, exts = [], loggerOptions, }) {
|
|
24
24
|
const baseLogger = getLogger(loggerOptions);
|
|
25
25
|
const logger = baseLogger.child({ scope: "collect-file-entries" });
|
|
26
26
|
const supportedExts = new Set(["json", ...exts]);
|
|
@@ -41,22 +41,23 @@ async function collectFileEntries({ readdir = fs.readdir, namespaces, rootDir, l
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
// -------------------------------------------------------------------------
|
|
44
|
-
//
|
|
44
|
+
// 1. Recurse into sub-directories (control flow, no limit)
|
|
45
45
|
// -------------------------------------------------------------------------
|
|
46
|
-
const
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
if (!entry.isDirectory())
|
|
48
|
+
continue;
|
|
49
|
+
await walk(path.join(currentDir, entry.name));
|
|
50
|
+
}
|
|
51
|
+
// -------------------------------------------------------------------------
|
|
52
|
+
// 2. Process files (IO-bound, concurrency-limited)
|
|
53
|
+
// -------------------------------------------------------------------------
|
|
54
|
+
const tasks = entries
|
|
55
|
+
.filter((entry) => entry.isFile())
|
|
56
|
+
.map((entry) => limit(async () => {
|
|
47
57
|
const fullPath = path.join(currentDir, entry.name);
|
|
48
|
-
|
|
49
|
-
if (entry.isDirectory()) {
|
|
50
|
-
await walk(fullPath);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
// Skip unsupported file extensions
|
|
54
|
-
const ext = path.extname(entry.name).slice(1); // "json", "yaml"
|
|
58
|
+
const ext = path.extname(entry.name).slice(1);
|
|
55
59
|
if (!ext || !supportedExts.has(ext))
|
|
56
60
|
return;
|
|
57
|
-
// ---------------------------------------------------------------------
|
|
58
|
-
// Resolve file entry
|
|
59
|
-
// ---------------------------------------------------------------------
|
|
60
61
|
const relativePath = path.relative(rootDir, fullPath);
|
|
61
62
|
const withoutExt = relativePath.slice(0, relativePath.length - (ext.length + 1));
|
|
62
63
|
const segments = withoutExt.split(path.sep).filter(Boolean);
|
|
@@ -20,7 +20,7 @@ import { getLogger } from '../../../../../core/logger/get-logger.js';
|
|
|
20
20
|
* }, ... ];
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
async function collectFileEntries({ readdir = fs.readdir, namespaces, rootDir, limit, exts = [
|
|
23
|
+
async function collectFileEntries({ readdir = fs.readdir, namespaces, rootDir, limit, exts = [], loggerOptions, }) {
|
|
24
24
|
const baseLogger = getLogger(loggerOptions);
|
|
25
25
|
const logger = baseLogger.child({ scope: "collect-file-entries" });
|
|
26
26
|
const supportedExts = new Set(["json", ...exts]);
|
|
@@ -41,22 +41,23 @@ async function collectFileEntries({ readdir = fs.readdir, namespaces, rootDir, l
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
// -------------------------------------------------------------------------
|
|
44
|
-
//
|
|
44
|
+
// 1. Recurse into sub-directories (control flow, no limit)
|
|
45
45
|
// -------------------------------------------------------------------------
|
|
46
|
-
const
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
if (!entry.isDirectory())
|
|
48
|
+
continue;
|
|
49
|
+
await walk(path.join(currentDir, entry.name));
|
|
50
|
+
}
|
|
51
|
+
// -------------------------------------------------------------------------
|
|
52
|
+
// 2. Process files (IO-bound, concurrency-limited)
|
|
53
|
+
// -------------------------------------------------------------------------
|
|
54
|
+
const tasks = entries
|
|
55
|
+
.filter((entry) => entry.isFile())
|
|
56
|
+
.map((entry) => limit(async () => {
|
|
47
57
|
const fullPath = path.join(currentDir, entry.name);
|
|
48
|
-
|
|
49
|
-
if (entry.isDirectory()) {
|
|
50
|
-
await walk(fullPath);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
// Skip unsupported file extensions
|
|
54
|
-
const ext = path.extname(entry.name).slice(1); // "json", "yaml"
|
|
58
|
+
const ext = path.extname(entry.name).slice(1);
|
|
55
59
|
if (!ext || !supportedExts.has(ext))
|
|
56
60
|
return;
|
|
57
|
-
// ---------------------------------------------------------------------
|
|
58
|
-
// Resolve file entry
|
|
59
|
-
// ---------------------------------------------------------------------
|
|
60
61
|
const relativePath = path.relative(rootDir, fullPath);
|
|
61
62
|
const withoutExt = relativePath.slice(0, relativePath.length - (ext.length + 1));
|
|
62
63
|
const segments = withoutExt.split(path.sep).filter(Boolean);
|
|
@@ -20,7 +20,7 @@ import { getLogger } from '../../../../../core/logger/get-logger.js';
|
|
|
20
20
|
* }, ... ];
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
async function collectFileEntries({ readdir = fs.readdir, namespaces, rootDir, limit, exts = [
|
|
23
|
+
async function collectFileEntries({ readdir = fs.readdir, namespaces, rootDir, limit, exts = [], loggerOptions, }) {
|
|
24
24
|
const baseLogger = getLogger(loggerOptions);
|
|
25
25
|
const logger = baseLogger.child({ scope: "collect-file-entries" });
|
|
26
26
|
const supportedExts = new Set(["json", ...exts]);
|
|
@@ -41,22 +41,23 @@ async function collectFileEntries({ readdir = fs.readdir, namespaces, rootDir, l
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
// -------------------------------------------------------------------------
|
|
44
|
-
//
|
|
44
|
+
// 1. Recurse into sub-directories (control flow, no limit)
|
|
45
45
|
// -------------------------------------------------------------------------
|
|
46
|
-
const
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
if (!entry.isDirectory())
|
|
48
|
+
continue;
|
|
49
|
+
await walk(path.join(currentDir, entry.name));
|
|
50
|
+
}
|
|
51
|
+
// -------------------------------------------------------------------------
|
|
52
|
+
// 2. Process files (IO-bound, concurrency-limited)
|
|
53
|
+
// -------------------------------------------------------------------------
|
|
54
|
+
const tasks = entries
|
|
55
|
+
.filter((entry) => entry.isFile())
|
|
56
|
+
.map((entry) => limit(async () => {
|
|
47
57
|
const fullPath = path.join(currentDir, entry.name);
|
|
48
|
-
|
|
49
|
-
if (entry.isDirectory()) {
|
|
50
|
-
await walk(fullPath);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
// Skip unsupported file extensions
|
|
54
|
-
const ext = path.extname(entry.name).slice(1); // "json", "yaml"
|
|
58
|
+
const ext = path.extname(entry.name).slice(1);
|
|
55
59
|
if (!ext || !supportedExts.has(ext))
|
|
56
60
|
return;
|
|
57
|
-
// ---------------------------------------------------------------------
|
|
58
|
-
// Resolve file entry
|
|
59
|
-
// ---------------------------------------------------------------------
|
|
60
61
|
const relativePath = path.relative(rootDir, fullPath);
|
|
61
62
|
const withoutExt = relativePath.slice(0, relativePath.length - (ext.length + 1));
|
|
62
63
|
const segments = withoutExt.split(path.sep).filter(Boolean);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { PREFIX_PLACEHOLDER, IntorError, IntorErrorCode, deepMerge, resolveLoaderOptions, clearLoggerPool, clearMessagesPool, mergeMessages, isValidMessages, type MessagesReader, type MessagesReaders, } from "../src/core";
|
|
1
|
+
export { PREFIX_PLACEHOLDER, IntorError, IntorErrorCode, deepMerge, type DeepMergeOverrideEvent, resolveLoaderOptions, clearLoggerPool, clearMessagesPool, mergeMessages, isValidMessages, type MessagesReader, type MessagesReaders, } from "../src/core";
|
|
2
2
|
export { defineIntorConfig, type IntorRawConfig, type IntorResolvedConfig, } from "../src/config";
|
|
3
3
|
export { localizePathname } from "../src/routing";
|
|
4
4
|
export { Translator, type TranslatorPlugin, type TranslateContext, type TranslateHook, type TranslateHandlers, type HandlerContext, type FormatHandler, type LoadingHandler, type MissingHandler, type LocaleMessages, type MessageObject, type MessageValue, tokenize, type Token, } from "intor-translator";
|