@intlayer/chokidar 7.4.0 → 7.5.0-canary.1
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/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +14 -9
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +2 -2
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
- package/dist/cjs/formatDictionary.cjs +49 -0
- package/dist/cjs/formatDictionary.cjs.map +1 -0
- package/dist/cjs/index.cjs +5 -0
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +12 -12
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
- package/dist/cjs/utils/getComponentTransformPattern.cjs +5 -5
- package/dist/cjs/utils/getComponentTransformPattern.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/index.cjs +1 -1
- package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +14 -9
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +2 -2
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
- package/dist/esm/formatDictionary.mjs +45 -0
- package/dist/esm/formatDictionary.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +4 -4
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +12 -12
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
- package/dist/esm/utils/formatter.mjs +1 -1
- package/dist/esm/utils/formatter.mjs.map +1 -1
- package/dist/esm/utils/getComponentTransformPattern.mjs +3 -3
- package/dist/esm/utils/getComponentTransformPattern.mjs.map +1 -1
- package/dist/esm/utils/runParallel/index.mjs +1 -1
- package/dist/esm/utils/runParallel/index.mjs.map +1 -1
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +2 -2
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +3 -3
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +3 -3
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +2 -2
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +2 -2
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +2 -2
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +2 -2
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
- package/dist/types/formatDictionary.d.ts +54 -0
- package/dist/types/formatDictionary.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/listDictionariesPath.d.ts +2 -2
- package/dist/types/listDictionariesPath.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +2 -2
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
- package/dist/types/utils/chunkJSON.d.ts.map +1 -1
- package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -1
- package/package.json +13 -13
package/dist/esm/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { parallelize } from "./utils/parallelize.mjs";
|
|
|
4
4
|
import { fetchDistantDictionaries } from "./fetchDistantDictionaries.mjs";
|
|
5
5
|
import { formatLocale, formatPath } from "./utils/formatter.mjs";
|
|
6
6
|
import { isInvalidDictionary } from "./filterInvalidDictionaries.mjs";
|
|
7
|
+
import { formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput } from "./formatDictionary.mjs";
|
|
7
8
|
import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
|
|
8
9
|
import { getFileHash } from "./utils/getFileHash.mjs";
|
|
9
10
|
import { generateDictionaryListContent } from "./createDictionaryEntryPoint/generateDictionaryListContent.mjs";
|
|
@@ -49,4 +50,4 @@ import { runParallel } from "./utils/runParallel/index.mjs";
|
|
|
49
50
|
import { verifyIdenticObjectFormat } from "./utils/verifyIdenticObjectFormat.mjs";
|
|
50
51
|
import { buildAndWatchIntlayer, watch } from "./watcher.mjs";
|
|
51
52
|
|
|
52
|
-
export { ATTRIBUTES_TO_EXTRACT, assembleJSON, buildAndWatchIntlayer, buildDictionary, buildFilesList, chunkJSON, cleanOutputDir, createDictionaryEntryPoint, createModuleAugmentation, createTypes, detectExportedComponentName, detectFormatCommand, extractDictionaryKey, extractIntlayer, fetchDistantDictionaries, formatLocale, formatPath, generateDictionaryListContent, generateKey, getBuiltDictionariesPath, getBuiltDynamicDictionariesPath, getBuiltFetchDictionariesPath, getBuiltRemoteDictionariesPath, getBuiltUnmergedDictionariesPath, getChunk, getComponentTransformPattern, getComponentTransformPatternSync, getContentDeclarationFileTemplate, getExtensionFromFormat, getFileHash, getFormatFromExtension, getGlobalLimiter, getTaskLimiter, handleAdditionalContentDeclarationFile, handleContentDeclarationFileChange, handleUnlinkedContentDeclarationFile, isInvalidDictionary, listDictionaries, listDictionariesWithStats, listGitFiles, listGitLines, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, pLimit, parallelize, parallelizeGlobal, prepareIntlayer, reconstructFromSingleChunk, reduceDictionaryContent, reduceObjectFormat, resolveObjectPromises, runOnce, runParallel, shouldExtract, sortAlphabetically, splitTextByLines, transformFiles, transformJSFile, verifyIdenticObjectFormat, watch, writeContentDeclaration, writeJSFile };
|
|
53
|
+
export { ATTRIBUTES_TO_EXTRACT, assembleJSON, buildAndWatchIntlayer, buildDictionary, buildFilesList, chunkJSON, cleanOutputDir, createDictionaryEntryPoint, createModuleAugmentation, createTypes, detectExportedComponentName, detectFormatCommand, extractDictionaryKey, extractIntlayer, fetchDistantDictionaries, formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput, formatLocale, formatPath, generateDictionaryListContent, generateKey, getBuiltDictionariesPath, getBuiltDynamicDictionariesPath, getBuiltFetchDictionariesPath, getBuiltRemoteDictionariesPath, getBuiltUnmergedDictionariesPath, getChunk, getComponentTransformPattern, getComponentTransformPatternSync, getContentDeclarationFileTemplate, getExtensionFromFormat, getFileHash, getFormatFromExtension, getGlobalLimiter, getTaskLimiter, handleAdditionalContentDeclarationFile, handleContentDeclarationFileChange, handleUnlinkedContentDeclarationFile, isInvalidDictionary, listDictionaries, listDictionariesWithStats, listGitFiles, listGitLines, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, pLimit, parallelize, parallelizeGlobal, prepareIntlayer, reconstructFromSingleChunk, reduceDictionaryContent, reduceObjectFormat, resolveObjectPromises, runOnce, runParallel, shouldExtract, sortAlphabetically, splitTextByLines, transformFiles, transformJSFile, verifyIdenticObjectFormat, watch, writeContentDeclaration, writeJSFile };
|
|
@@ -22,12 +22,12 @@ const loadContentDeclarations = async (contentDeclarationFilePath, configuration
|
|
|
22
22
|
await set("ok");
|
|
23
23
|
}
|
|
24
24
|
try {
|
|
25
|
-
const dictionariesPromises = contentDeclarationFilePath.map(async (path) => {
|
|
25
|
+
const dictionariesPromises = contentDeclarationFilePath.map(async (path$1) => {
|
|
26
26
|
return {
|
|
27
|
-
relativePath: relative(configuration.content.baseDir, path),
|
|
28
|
-
dictionary: await loadExternalFile(path, {
|
|
27
|
+
relativePath: relative(configuration.content.baseDir, path$1),
|
|
28
|
+
dictionary: await loadExternalFile(path$1, {
|
|
29
29
|
projectRequire: build.require ?? getProjectRequire(),
|
|
30
|
-
buildOptions: { banner: { js: [`globalThis.INTLAYER_FILE_PATH = '${path}';`, `globalThis.INTLAYER_BASE_DIR = '${configuration.content.baseDir}';`].join("\n") } },
|
|
30
|
+
buildOptions: { banner: { js: [`globalThis.INTLAYER_FILE_PATH = '${path$1}';`, `globalThis.INTLAYER_BASE_DIR = '${configuration.content.baseDir}';`].join("\n") } },
|
|
31
31
|
aliases: { intlayer: filePath }
|
|
32
32
|
})
|
|
33
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadContentDeclaration.mjs","names":["contentDeclarations: Dictionary[]"],"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport {\n cacheDisk,\n getProjectRequire,\n loadExternalFile,\n} from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { processContentDeclaration } from '../buildIntlayerDictionary/processContentDeclaration';\nimport {\n filterInvalidDictionaries,\n isInvalidDictionary,\n} from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { getIntlayerBundle } from './getIntlayerBundle';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport const formatLocalDictionaries = (\n dictionariesRecord: Record<string, Dictionary>,\n configuration: IntlayerConfig\n): Dictionary[] =>\n Object.entries(dictionariesRecord)\n .filter(([_relativePath, dict]) => isInvalidDictionary(dict, configuration))\n .map(([relativePath, dict]) => ({\n ...dict,\n localId: `${dict.key}::local::${relativePath}`,\n location: 'local' as const,\n filePath: relativePath,\n }));\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n configuration: IntlayerConfig,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<Dictionary[]> => {\n const { build, content } = configuration;\n\n const { set, isValid } = cacheDisk(configuration, ['intlayer-bundle'], {\n ttlMs: 1000 * 60 * 60 * 24 * 5, // 5 days\n });\n\n const filePath = join(content.cacheDir, 'intlayer-bundle.cjs');\n const hasIntlayerBundle = await isValid();\n\n // If cache is invalid, write the intlayer bundle to the cache\n if (!hasIntlayerBundle) {\n const intlayerBundle = await getIntlayerBundle(configuration);\n await writeFile(filePath, intlayerBundle);\n await set('ok');\n }\n\n try {\n const dictionariesPromises = contentDeclarationFilePath.map(\n async (path) => {\n const relativePath = relative(configuration.content.baseDir, path);\n\n const dictionary = await loadExternalFile(path, {\n projectRequire: build.require ?? getProjectRequire(),\n buildOptions: {\n banner: {\n js: [\n `globalThis.INTLAYER_FILE_PATH = '${path}';`,\n `globalThis.INTLAYER_BASE_DIR = '${configuration.content.baseDir}';`,\n ].join('\\n'),\n },\n },\n aliases: {\n intlayer: filePath,\n },\n });\n\n return { relativePath, dictionary };\n }\n );\n\n const dictionariesArray = await Promise.all(dictionariesPromises);\n const dictionariesRecord = dictionariesArray.reduce(\n (acc, { relativePath, dictionary }) => {\n acc[relativePath] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n );\n\n const contentDeclarations: Dictionary[] = formatLocalDictionaries(\n dictionariesRecord,\n configuration\n );\n\n const listFoundDictionaries = contentDeclarations.map((declaration) => ({\n dictionaryKey: declaration.key,\n type: 'local' as const,\n status: 'found' as const,\n }));\n\n onStatusUpdate?.(listFoundDictionaries);\n\n const processedDictionaries = await parallelize(\n contentDeclarations,\n async (contentDeclaration): Promise<Dictionary | undefined> => {\n if (!contentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: contentDeclaration.key,\n type: 'local',\n status: 'building',\n },\n ]);\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary\n );\n\n if (!processedContentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: processedContentDeclaration.key,\n type: 'local',\n status: 'built',\n },\n ]);\n\n return processedContentDeclaration;\n }\n );\n\n return filterInvalidDictionaries(processedDictionaries, configuration);\n } finally {\n // await rm(tempFilePath, { recursive: true });\n }\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAa,2BACX,oBACA,kBAEA,OAAO,QAAQ,mBAAmB,CAC/B,QAAQ,CAAC,eAAe,UAAU,oBAAoB,MAAM,cAAc,CAAC,CAC3E,KAAK,CAAC,cAAc,WAAW;CAC9B,GAAG;CACH,SAAS,GAAG,KAAK,IAAI,WAAW;CAChC,UAAU;CACV,UAAU;CACX,EAAE;AAEP,MAAa,0BAA0B,OACrC,4BACA,eACA,mBAC0B;CAC1B,MAAM,EAAE,OAAO,YAAY;CAE3B,MAAM,EAAE,KAAK,YAAY,UAAU,eAAe,CAAC,kBAAkB,EAAE,EACrE,OAAO,MAAO,KAAK,KAAK,KAAK,GAC9B,CAAC;CAEF,MAAM,WAAW,KAAK,QAAQ,UAAU,sBAAsB;AAI9D,KAAI,CAHsB,MAAM,SAAS,EAGjB;AAEtB,QAAM,UAAU,UADO,MAAM,kBAAkB,cAAc,CACpB;AACzC,QAAM,IAAI,KAAK;;AAGjB,KAAI;EACF,MAAM,uBAAuB,2BAA2B,IACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"loadContentDeclaration.mjs","names":["path","contentDeclarations: Dictionary[]"],"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport {\n cacheDisk,\n getProjectRequire,\n loadExternalFile,\n} from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { processContentDeclaration } from '../buildIntlayerDictionary/processContentDeclaration';\nimport {\n filterInvalidDictionaries,\n isInvalidDictionary,\n} from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { getIntlayerBundle } from './getIntlayerBundle';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport const formatLocalDictionaries = (\n dictionariesRecord: Record<string, Dictionary>,\n configuration: IntlayerConfig\n): Dictionary[] =>\n Object.entries(dictionariesRecord)\n .filter(([_relativePath, dict]) => isInvalidDictionary(dict, configuration))\n .map(([relativePath, dict]) => ({\n ...dict,\n localId: `${dict.key}::local::${relativePath}`,\n location: 'local' as const,\n filePath: relativePath,\n }));\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n configuration: IntlayerConfig,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<Dictionary[]> => {\n const { build, content } = configuration;\n\n const { set, isValid } = cacheDisk(configuration, ['intlayer-bundle'], {\n ttlMs: 1000 * 60 * 60 * 24 * 5, // 5 days\n });\n\n const filePath = join(content.cacheDir, 'intlayer-bundle.cjs');\n const hasIntlayerBundle = await isValid();\n\n // If cache is invalid, write the intlayer bundle to the cache\n if (!hasIntlayerBundle) {\n const intlayerBundle = await getIntlayerBundle(configuration);\n await writeFile(filePath, intlayerBundle);\n await set('ok');\n }\n\n try {\n const dictionariesPromises = contentDeclarationFilePath.map(\n async (path) => {\n const relativePath = relative(configuration.content.baseDir, path);\n\n const dictionary = await loadExternalFile(path, {\n projectRequire: build.require ?? getProjectRequire(),\n buildOptions: {\n banner: {\n js: [\n `globalThis.INTLAYER_FILE_PATH = '${path}';`,\n `globalThis.INTLAYER_BASE_DIR = '${configuration.content.baseDir}';`,\n ].join('\\n'),\n },\n },\n aliases: {\n intlayer: filePath,\n },\n });\n\n return { relativePath, dictionary };\n }\n );\n\n const dictionariesArray = await Promise.all(dictionariesPromises);\n const dictionariesRecord = dictionariesArray.reduce(\n (acc, { relativePath, dictionary }) => {\n acc[relativePath] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n );\n\n const contentDeclarations: Dictionary[] = formatLocalDictionaries(\n dictionariesRecord,\n configuration\n );\n\n const listFoundDictionaries = contentDeclarations.map((declaration) => ({\n dictionaryKey: declaration.key,\n type: 'local' as const,\n status: 'found' as const,\n }));\n\n onStatusUpdate?.(listFoundDictionaries);\n\n const processedDictionaries = await parallelize(\n contentDeclarations,\n async (contentDeclaration): Promise<Dictionary | undefined> => {\n if (!contentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: contentDeclaration.key,\n type: 'local',\n status: 'building',\n },\n ]);\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary\n );\n\n if (!processedContentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: processedContentDeclaration.key,\n type: 'local',\n status: 'built',\n },\n ]);\n\n return processedContentDeclaration;\n }\n );\n\n return filterInvalidDictionaries(processedDictionaries, configuration);\n } finally {\n // await rm(tempFilePath, { recursive: true });\n }\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAa,2BACX,oBACA,kBAEA,OAAO,QAAQ,mBAAmB,CAC/B,QAAQ,CAAC,eAAe,UAAU,oBAAoB,MAAM,cAAc,CAAC,CAC3E,KAAK,CAAC,cAAc,WAAW;CAC9B,GAAG;CACH,SAAS,GAAG,KAAK,IAAI,WAAW;CAChC,UAAU;CACV,UAAU;CACX,EAAE;AAEP,MAAa,0BAA0B,OACrC,4BACA,eACA,mBAC0B;CAC1B,MAAM,EAAE,OAAO,YAAY;CAE3B,MAAM,EAAE,KAAK,YAAY,UAAU,eAAe,CAAC,kBAAkB,EAAE,EACrE,OAAO,MAAO,KAAK,KAAK,KAAK,GAC9B,CAAC;CAEF,MAAM,WAAW,KAAK,QAAQ,UAAU,sBAAsB;AAI9D,KAAI,CAHsB,MAAM,SAAS,EAGjB;AAEtB,QAAM,UAAU,UADO,MAAM,kBAAkB,cAAc,CACpB;AACzC,QAAM,IAAI,KAAK;;AAGjB,KAAI;EACF,MAAM,uBAAuB,2BAA2B,IACtD,OAAO,WAAS;AAkBd,UAAO;IAAE,cAjBY,SAAS,cAAc,QAAQ,SAASA,OAAK;IAiB3C,YAfJ,MAAM,iBAAiBA,QAAM;KAC9C,gBAAgB,MAAM,WAAW,mBAAmB;KACpD,cAAc,EACZ,QAAQ,EACN,IAAI,CACF,oCAAoCA,OAAK,KACzC,mCAAmC,cAAc,QAAQ,QAAQ,IAClE,CAAC,KAAK,KAAK,EACb,EACF;KACD,SAAS,EACP,UAAU,UACX;KACF,CAAC;IAEiC;IAEtC;EAWD,MAAMC,sBAAoC,yBAThB,MAAM,QAAQ,IAAI,qBAAqB,EACpB,QAC1C,KAAK,EAAE,cAAc,iBAAiB;AACrC,OAAI,gBAAgB;AACpB,UAAO;KAET,EAAE,CACH,EAIC,cACD;EAED,MAAM,wBAAwB,oBAAoB,KAAK,iBAAiB;GACtE,eAAe,YAAY;GAC3B,MAAM;GACN,QAAQ;GACT,EAAE;AAEH,mBAAiB,sBAAsB;AAqCvC,SAAO,0BAnCuB,MAAM,YAClC,qBACA,OAAO,uBAAwD;AAC7D,OAAI,CAAC,mBACH;AAGF,oBAAiB,CACf;IACE,eAAe,mBAAmB;IAClC,MAAM;IACN,QAAQ;IACT,CACF,CAAC;GAEF,MAAM,8BAA8B,MAAM,0BACxC,mBACD;AAED,OAAI,CAAC,4BACH;AAGF,oBAAiB,CACf;IACE,eAAe,4BAA4B;IAC3C,MAAM;IACN,QAAQ;IACT,CACF,CAAC;AAEF,UAAO;IAEV,EAEuD,cAAc;WAC9D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { filterInvalidDictionaries } from "../filterInvalidDictionaries.mjs";
|
|
2
|
+
import { formatDictionaries } from "../formatDictionary.mjs";
|
|
2
3
|
import { loadContentDeclarations } from "./loadContentDeclaration.mjs";
|
|
3
4
|
import { loadRemoteDictionaries } from "./loadRemoteDictionaries.mjs";
|
|
4
5
|
import { DictionariesLogger } from "./log.mjs";
|
|
@@ -40,11 +41,11 @@ const printSummary = (configuration) => {
|
|
|
40
41
|
if (configuration.log.mode !== "verbose") return;
|
|
41
42
|
const appLogger = getAppLogger(configuration);
|
|
42
43
|
const byKey = /* @__PURE__ */ new Map();
|
|
43
|
-
for (const
|
|
44
|
-
const rec = byKey.get(
|
|
45
|
-
if (
|
|
46
|
-
if (
|
|
47
|
-
byKey.set(
|
|
44
|
+
for (const status of loadDictionariesStatus) {
|
|
45
|
+
const rec = byKey.get(status.dictionaryKey) ?? {};
|
|
46
|
+
if (status.type === "local") rec.local = status.status;
|
|
47
|
+
if (status.type === "remote") rec.remote = status.status;
|
|
48
|
+
byKey.set(status.dictionaryKey, rec);
|
|
48
49
|
}
|
|
49
50
|
const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));
|
|
50
51
|
let maxLocalLabelLen = 0;
|
|
@@ -95,12 +96,11 @@ const loadDictionaries = async (contentDeclarationsPaths, configuration) => {
|
|
|
95
96
|
return [];
|
|
96
97
|
}
|
|
97
98
|
});
|
|
98
|
-
const pluginDictionaries =
|
|
99
|
-
const localDictionaries = await loadContentDeclarations(Array.isArray(contentDeclarationsPaths) ? contentDeclarationsPaths : [contentDeclarationsPaths], configuration, setLoadDictionariesStatus);
|
|
99
|
+
const pluginDictionaries = await Promise.all(loadPluginDictionariesPromise).then((dictionaries) => dictionaries.flat()).then((dictionaries) => filterInvalidDictionaries(dictionaries, configuration)).then((dictionaries) => formatDictionaries(dictionaries));
|
|
100
|
+
const localDictionaries = await loadContentDeclarations(Array.isArray(contentDeclarationsPaths) ? contentDeclarationsPaths : [contentDeclarationsPaths], configuration, setLoadDictionariesStatus).then((dictionaries) => filterInvalidDictionaries(dictionaries, configuration)).then((dictionaries) => formatDictionaries(dictionaries));
|
|
100
101
|
const localDictionariesTime = Date.now();
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
dictionaryKey: dict.key,
|
|
102
|
+
setLoadDictionariesStatus(localDictionaries.map((dictionary) => ({
|
|
103
|
+
dictionaryKey: dictionary.key,
|
|
104
104
|
type: "local",
|
|
105
105
|
status: "built"
|
|
106
106
|
})));
|
|
@@ -111,13 +111,13 @@ const loadDictionaries = async (contentDeclarationsPaths, configuration) => {
|
|
|
111
111
|
onStartRemoteCheck: () => logger$1.startRemoteCheck(),
|
|
112
112
|
onStopRemoteCheck: () => logger$1.stopRemoteCheck(),
|
|
113
113
|
onError: (e) => logger$1.setRemoteError(e)
|
|
114
|
-
});
|
|
114
|
+
}).then((dictionaries) => filterInvalidDictionaries(dictionaries, configuration)).then((dictionaries) => formatDictionaries(dictionaries));
|
|
115
115
|
const remoteDictionariesTime = Date.now();
|
|
116
116
|
const pluginDictionariesTime = Date.now();
|
|
117
117
|
logger$1.finish();
|
|
118
118
|
printSummary(configuration);
|
|
119
119
|
return {
|
|
120
|
-
localDictionaries
|
|
120
|
+
localDictionaries,
|
|
121
121
|
remoteDictionaries,
|
|
122
122
|
pluginDictionaries,
|
|
123
123
|
time: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadDictionaries.mjs","names":["loadDictionariesStatus: DictionariesStatus[]","logger","updated: DictionariesStatus[]","labels: string[]","pluginDictionaries: Dictionary[]","localDictionaries: Dictionary[]","remoteDictionaries: Dictionary[]"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/client';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const s of loadDictionariesStatus) {\n const rec = byKey.get(s.dictionaryKey) ?? {};\n if (s.type === 'local') rec.local = s.status;\n if (s.type === 'remote') rec.remote = s.status;\n byKey.set(s.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const pluginsWithLoadDictionaries = (plugins ?? []).filter(\n (plugin) => plugin.loadDictionaries\n );\n\n logger.setPluginTotal(pluginsWithLoadDictionaries.length);\n\n const completedPluginIndices = new Set<number>();\n const updatePluginProgress = () => {\n logger.setPluginDone(completedPluginIndices.size);\n };\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin, index) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n completedPluginIndices.add(index);\n updatePluginProgress();\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n completedPluginIndices.add(index);\n updatePluginProgress();\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = (\n await Promise.all(loadPluginDictionariesPromise)\n ).flat();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n );\n\n const localDictionariesTime = Date.now();\n\n const filteredLocalDictionaries = filterInvalidDictionaries(\n localDictionaries,\n configuration\n );\n\n const localDictionariesStatus = filteredLocalDictionaries.map(\n (dict) =>\n ({\n dictionaryKey: dict.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n );\n }\n\n const remoteDictionariesTime = Date.now();\n\n const pluginDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries: filteredLocalDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - loadDictionariesStartTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - remoteDictionariesTime,\n },\n };\n};\n"],"mappings":";;;;;;;AA4BA,IAAIA,yBAA+C,EAA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":"loadDictionaries.mjs","names":["loadDictionariesStatus: DictionariesStatus[]","logger","updated: DictionariesStatus[]","labels: string[]","pluginDictionaries: Dictionary[]","localDictionaries: Dictionary[]","remoteDictionaries: Dictionary[]"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/client';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { formatDictionaries } from '../formatDictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const status of loadDictionariesStatus) {\n const rec = byKey.get(status.dictionaryKey) ?? {};\n if (status.type === 'local') rec.local = status.status;\n if (status.type === 'remote') rec.remote = status.status;\n byKey.set(status.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const pluginsWithLoadDictionaries = (plugins ?? []).filter(\n (plugin) => plugin.loadDictionaries\n );\n\n logger.setPluginTotal(pluginsWithLoadDictionaries.length);\n\n const completedPluginIndices = new Set<number>();\n const updatePluginProgress = () => {\n logger.setPluginDone(completedPluginIndices.size);\n };\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin, index) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n completedPluginIndices.add(index);\n updatePluginProgress();\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n completedPluginIndices.add(index);\n updatePluginProgress();\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = await Promise.all(\n loadPluginDictionariesPromise as Promise<Dictionary[]>[]\n )\n .then((dictionaries) => dictionaries.flat())\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const localDictionariesTime = Date.now();\n\n const localDictionariesStatus = localDictionaries.map(\n (dictionary) =>\n ({\n dictionaryKey: dictionary.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n }\n\n const remoteDictionariesTime = Date.now();\n\n const pluginDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - loadDictionariesStartTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - remoteDictionariesTime,\n },\n };\n};\n"],"mappings":";;;;;;;;AA6BA,IAAIA,yBAA+C,EAAE;AACrD,MAAMC,WAAS,IAAI,oBAAoB;AAEvC,MAAM,6BAA6B,aAAmC;CACpE,MAAMC,UAAgC,CAAC,GAAG,uBAAuB;AAEjE,MAAK,MAAM,YAAY,UAAU;EAC/B,MAAM,QAAQ,QAAQ,WACnB,MACC,EAAE,kBAAkB,SAAS,iBAAiB,EAAE,SAAS,SAAS,KACrE;AACD,MAAI,SAAS,EACX,SAAQ,SAAS;MAEjB,SAAQ,KAAK,SAAS;;AAI1B,0BAAyB;AACzB,UA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
7
7
|
//#region src/utils/formatter.ts
|
|
8
|
-
const formatPath = (path, color) => [path].flat().map((path$
|
|
8
|
+
const formatPath = (path$1, color) => [path$1].flat().map((path$2) => path$2.startsWith("/") ? relative(configuration.content.baseDir, path$2) : path$2).map((relativePath) => color === false ? relativePath : colorizePath(relativePath, color)).join(`, `);
|
|
9
9
|
const formatLocale = (locale, color = ANSIColors.GREEN) => [locale].flat().map((locale$1) => `${getLocaleName(locale$1, Locales.ENGLISH)} (${locale$1})`).map((text) => color === false ? text : colorize(text, color)).join(`, `);
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.mjs","names":["path","locale"],"sources":["../../../src/utils/formatter.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { ANSIColors, colorize, colorizePath } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { getLocaleName } from '@intlayer/core';\nimport { Locales, type LocalesValues } from '@intlayer/types';\n\nexport const formatPath = (\n path: string | string[],\n color?: ANSIColors | false\n) =>\n [path]\n .flat()\n .map((path) =>\n path.startsWith('/')\n ? relative(configuration.content.baseDir, path)\n : path\n )\n .map((relativePath) =>\n color === false ? relativePath : colorizePath(relativePath, color)\n )\n .join(`, `);\n\nexport const formatLocale = (\n locale: LocalesValues | LocalesValues[],\n color: ANSIColors | false = ANSIColors.GREEN\n) =>\n [locale]\n .flat()\n .map((locale) => `${getLocaleName(locale, Locales.ENGLISH)} (${locale})`)\n .map((text) => (color === false ? text : colorize(text, color)))\n .join(`, `);\n"],"mappings":";;;;;;;AAMA,MAAa,cACX,
|
|
1
|
+
{"version":3,"file":"formatter.mjs","names":["path","locale"],"sources":["../../../src/utils/formatter.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { ANSIColors, colorize, colorizePath } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { getLocaleName } from '@intlayer/core';\nimport { Locales, type LocalesValues } from '@intlayer/types';\n\nexport const formatPath = (\n path: string | string[],\n color?: ANSIColors | false\n) =>\n [path]\n .flat()\n .map((path) =>\n path.startsWith('/')\n ? relative(configuration.content.baseDir, path)\n : path\n )\n .map((relativePath) =>\n color === false ? relativePath : colorizePath(relativePath, color)\n )\n .join(`, `);\n\nexport const formatLocale = (\n locale: LocalesValues | LocalesValues[],\n color: ANSIColors | false = ANSIColors.GREEN\n) =>\n [locale]\n .flat()\n .map((locale) => `${getLocaleName(locale, Locales.ENGLISH)} (${locale})`)\n .map((text) => (color === false ? text : colorize(text, color)))\n .join(`, `);\n"],"mappings":";;;;;;;AAMA,MAAa,cACX,QACA,UAEA,CAACA,OAAK,CACH,MAAM,CACN,KAAK,WACJA,OAAK,WAAW,IAAI,GAChB,SAAS,cAAc,QAAQ,SAASA,OAAK,GAC7CA,OACL,CACA,KAAK,iBACJ,UAAU,QAAQ,eAAe,aAAa,cAAc,MAAM,CACnE,CACA,KAAK,KAAK;AAEf,MAAa,gBACX,QACA,QAA4B,WAAW,UAEvC,CAAC,OAAO,CACL,MAAM,CACN,KAAK,aAAW,GAAG,cAAcC,UAAQ,QAAQ,QAAQ,CAAC,IAAIA,SAAO,GAAG,CACxE,KAAK,SAAU,UAAU,QAAQ,OAAO,SAAS,MAAM,MAAM,CAAE,CAC/D,KAAK,KAAK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import path from "node:path";
|
|
1
2
|
import fg from "fast-glob";
|
|
2
|
-
import path from "path";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/getComponentTransformPattern.ts
|
|
5
5
|
/**
|
|
@@ -12,8 +12,8 @@ const getDistinctRootDirs = (dirs) => {
|
|
|
12
12
|
uniqueDirs.sort((a, b) => a.length - b.length);
|
|
13
13
|
return uniqueDirs.reduce((acc, dir) => {
|
|
14
14
|
if (!acc.some((parent) => {
|
|
15
|
-
const relative = path.relative(parent, dir);
|
|
16
|
-
return !relative.startsWith("..") && !path.isAbsolute(relative) && relative !== "";
|
|
15
|
+
const relative$1 = path.relative(parent, dir);
|
|
16
|
+
return !relative$1.startsWith("..") && !path.isAbsolute(relative$1) && relative$1 !== "";
|
|
17
17
|
})) acc.push(dir);
|
|
18
18
|
return acc;
|
|
19
19
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getComponentTransformPattern.mjs","names":[],"sources":["../../../src/utils/getComponentTransformPattern.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\
|
|
1
|
+
{"version":3,"file":"getComponentTransformPattern.mjs","names":["relative"],"sources":["../../../src/utils/getComponentTransformPattern.ts"],"sourcesContent":["import path from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * Helper to remove directories that are subdirectories of others in the list.\n * Example: ['/root', '/root/src'] -> ['/root']\n * This prevents scanning the same files twice.\n */\nconst getDistinctRootDirs = (dirs: string[]): string[] => {\n // 1. Resolve to absolute paths and remove exact duplicates\n const uniqueDirs = Array.from(new Set(dirs.map((d) => path.resolve(d))));\n\n // 2. Sort by length (shortest paths first) so parents appear before children\n uniqueDirs.sort((a, b) => a.length - b.length);\n\n // 3. Filter out any directory that is inside a parent already in the accepted list\n return uniqueDirs.reduce((acc: string[], dir) => {\n const isNested = acc.some((parent) => {\n const relative = path.relative(parent, dir);\n return (\n !relative.startsWith('..') && // It is inside the parent\n !path.isAbsolute(relative) && // It is not a different drive/root\n relative !== '' // It is not the parent itself (already handled by Set, but good for safety)\n );\n });\n\n if (!isNested) {\n acc.push(dir);\n }\n return acc;\n }, []);\n};\n\nexport const getComponentTransformPattern = async (\n intlayerConfig: IntlayerConfig\n): Promise<string[]> => {\n const { baseDir, contentDir } = intlayerConfig.content;\n const { traversePattern } = intlayerConfig.build;\n\n // Optimize: Filter out contentDir paths if they are already covered by baseDir\n const distinctRoots = getDistinctRootDirs([baseDir, ...contentDir]);\n\n const filesListPatternPromises = distinctRoots.map((cwd) =>\n fg(traversePattern, {\n cwd,\n absolute: true,\n })\n );\n\n const filesList = (await Promise.all(filesListPatternPromises)).flat();\n\n // Deduplicate files just in case of overlapping patterns or symlinks\n return Array.from(new Set(filesList));\n};\n\nexport const getComponentTransformPatternSync = (\n intlayerConfig: IntlayerConfig\n): string[] => {\n const { baseDir, contentDir } = intlayerConfig.content;\n const { traversePattern } = intlayerConfig.build;\n\n // Optimize: Filter out contentDir paths if they are already covered by baseDir\n const distinctRoots = getDistinctRootDirs([baseDir, ...contentDir]);\n\n const filesList = distinctRoots.flatMap((cwd) =>\n fg.sync(traversePattern, {\n cwd,\n absolute: true,\n })\n );\n\n return Array.from(new Set(filesList));\n};\n"],"mappings":";;;;;;;;;AASA,MAAM,uBAAuB,SAA6B;CAExD,MAAM,aAAa,MAAM,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC;AAGxE,YAAW,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,OAAO;AAG9C,QAAO,WAAW,QAAQ,KAAe,QAAQ;AAU/C,MAAI,CATa,IAAI,MAAM,WAAW;GACpC,MAAMA,aAAW,KAAK,SAAS,QAAQ,IAAI;AAC3C,UACE,CAACA,WAAS,WAAW,KAAK,IAC1B,CAAC,KAAK,WAAWA,WAAS,IAC1BA,eAAa;IAEf,CAGA,KAAI,KAAK,IAAI;AAEf,SAAO;IACN,EAAE,CAAC;;AAGR,MAAa,+BAA+B,OAC1C,mBACsB;CACtB,MAAM,EAAE,SAAS,eAAe,eAAe;CAC/C,MAAM,EAAE,oBAAoB,eAAe;CAK3C,MAAM,2BAFgB,oBAAoB,CAAC,SAAS,GAAG,WAAW,CAAC,CAEpB,KAAK,QAClD,GAAG,iBAAiB;EAClB;EACA,UAAU;EACX,CAAC,CACH;CAED,MAAM,aAAa,MAAM,QAAQ,IAAI,yBAAyB,EAAE,MAAM;AAGtE,QAAO,MAAM,KAAK,IAAI,IAAI,UAAU,CAAC;;AAGvC,MAAa,oCACX,mBACa;CACb,MAAM,EAAE,SAAS,eAAe,eAAe;CAC/C,MAAM,EAAE,oBAAoB,eAAe;CAK3C,MAAM,YAFgB,oBAAoB,CAAC,SAAS,GAAG,WAAW,CAAC,CAEnC,SAAS,QACvC,GAAG,KAAK,iBAAiB;EACvB;EACA,UAAU;EACX,CAAC,CACH;AAED,QAAO,MAAM,KAAK,IAAI,IAAI,UAAU,CAAC"}
|
|
@@ -26,7 +26,7 @@ const runParallel = (proc) => {
|
|
|
26
26
|
cwd: process.cwd(),
|
|
27
27
|
stdio: "inherit",
|
|
28
28
|
env: childEnv,
|
|
29
|
-
shell:
|
|
29
|
+
shell: isWin
|
|
30
30
|
};
|
|
31
31
|
const child = isArray ? args.length === 0 && /\s/.test(command) ? isWin ? spawnFunc(process.env.ComSpec ?? "cmd.exe", [
|
|
32
32
|
"/d",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["signalHandlers: { event: string; handler: (...args: any[]) => void }[]"],"sources":["../../../../src/utils/runParallel/index.ts"],"sourcesContent":["import { delimiter, join } from 'node:path';\nimport { spawnPosix } from './spawnPosix';\nimport { spawnWin32 } from './spawnWin32';\n\nexport type ParallelHandle = {\n kill: () => void;\n result: Promise<any>;\n commandText: string;\n};\n\n/**\n * Start a cross-platform parallel process using npm-run-all approach.\n * Accepts either a single string (e.g., 'next start') or an array of tokens (e.g., ['next', 'start']).\n */\nexport const runParallel = (proc?: string | string[]): ParallelHandle => {\n if (!proc || (Array.isArray(proc) && proc.length === 0))\n throw new Error('Invalid command');\n\n const commandText = Array.isArray(proc) ? proc.join(' ') : proc;\n\n const isArray = Array.isArray(proc);\n const command = isArray ? (proc as string[])[0] : commandText;\n const args = isArray ? (proc as string[]).slice(1) : [];\n\n // Ensure local binaries (node_modules/.bin) are resolvable\n const cwdBin = join(process.cwd(), 'node_modules', '.bin');\n const PATH_KEY =\n Object.keys(process.env).find((key) => key.toLowerCase() === 'path') ??\n 'PATH';\n\n const extendedPath = [cwdBin, process.env[PATH_KEY] ?? '']\n .filter(Boolean)\n .join(delimiter);\n\n const childEnv = {\n ...process.env,\n [PATH_KEY]: extendedPath,\n } as NodeJS.ProcessEnv;\n\n const isWin = process.platform === 'win32';\n const spawnFunc = isWin ? spawnWin32 : spawnPosix;\n\n // Spawn options\n const spawnOptions = {\n cwd: process.cwd(),\n stdio: 'inherit' as const,\n env: childEnv,\n shell:
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["signalHandlers: { event: string; handler: (...args: any[]) => void }[]"],"sources":["../../../../src/utils/runParallel/index.ts"],"sourcesContent":["import { delimiter, join } from 'node:path';\nimport { spawnPosix } from './spawnPosix';\nimport { spawnWin32 } from './spawnWin32';\n\nexport type ParallelHandle = {\n kill: () => void;\n result: Promise<any>;\n commandText: string;\n};\n\n/**\n * Start a cross-platform parallel process using npm-run-all approach.\n * Accepts either a single string (e.g., 'next start') or an array of tokens (e.g., ['next', 'start']).\n */\nexport const runParallel = (proc?: string | string[]): ParallelHandle => {\n if (!proc || (Array.isArray(proc) && proc.length === 0))\n throw new Error('Invalid command');\n\n const commandText = Array.isArray(proc) ? proc.join(' ') : proc;\n\n const isArray = Array.isArray(proc);\n const command = isArray ? (proc as string[])[0] : commandText;\n const args = isArray ? (proc as string[]).slice(1) : [];\n\n // Ensure local binaries (node_modules/.bin) are resolvable\n const cwdBin = join(process.cwd(), 'node_modules', '.bin');\n const PATH_KEY =\n Object.keys(process.env).find((key) => key.toLowerCase() === 'path') ??\n 'PATH';\n\n const extendedPath = [cwdBin, process.env[PATH_KEY] ?? '']\n .filter(Boolean)\n .join(delimiter);\n\n const childEnv = {\n ...process.env,\n [PATH_KEY]: extendedPath,\n } as NodeJS.ProcessEnv;\n\n const isWin = process.platform === 'win32';\n const spawnFunc = isWin ? spawnWin32 : spawnPosix;\n\n // Spawn options\n const spawnOptions = {\n cwd: process.cwd(),\n stdio: 'inherit' as const,\n env: childEnv,\n shell: isWin,\n };\n\n // Spawn the child process\n const child = isArray\n ? // If provided as a single string element that includes spaces, treat it like a shell command\n args.length === 0 && /\\s/.test(command)\n ? isWin\n ? spawnFunc(\n process.env.ComSpec ?? 'cmd.exe',\n ['/d', '/s', '/c', command],\n spawnOptions\n )\n : spawnFunc(\n process.env.SHELL ?? '/bin/sh',\n ['-c', command],\n spawnOptions\n )\n : spawnFunc(command, args, spawnOptions)\n : isWin\n ? spawnFunc(\n process.env.ComSpec ?? 'cmd.exe',\n ['/d', '/s', '/c', commandText],\n spawnOptions\n )\n : spawnFunc(\n process.env.SHELL ?? '/bin/sh',\n ['-c', commandText],\n spawnOptions\n );\n\n const result = new Promise<void>((resolve, reject) => {\n child.on('error', (err) => {\n try {\n console.error(\n `[runParallel] Failed to start: ${err?.message ?? String(err)}`\n );\n } catch {}\n cleanupHandlers();\n reject(err);\n });\n\n child.on('exit', (code, signal) => {\n cleanupHandlers();\n\n // Treat common termination signals as graceful exits, not failures\n const gracefulSignals = ['SIGINT', 'SIGTERM', 'SIGQUIT', 'SIGHUP'];\n if (code === 0 || (signal && gracefulSignals.includes(signal))) {\n resolve();\n } else {\n reject(\n Object.assign(new Error('Parallel process failed'), { code, signal })\n );\n }\n });\n });\n\n const cleanup = () => {\n try {\n child.kill('SIGTERM');\n } catch {\n // Best effort\n }\n };\n\n const signalHandlers: { event: string; handler: (...args: any[]) => void }[] =\n [\n { event: 'SIGINT', handler: cleanup },\n { event: 'SIGTERM', handler: cleanup },\n { event: 'SIGQUIT', handler: cleanup },\n { event: 'SIGHUP', handler: cleanup },\n ];\n\n // Register signal handlers\n signalHandlers.forEach(({ event, handler }) => {\n process.on(event as any, handler as any);\n });\n\n const cleanupHandlers = () => {\n signalHandlers.forEach(({ event, handler }) => {\n process.off(event as any, handler as any);\n });\n };\n\n const kill = () => {\n try {\n child.kill('SIGTERM');\n } catch {\n // Best effort\n }\n };\n\n return { kill, result, commandText };\n};\n"],"mappings":";;;;;;;;;AAcA,MAAa,eAAe,SAA6C;AACvE,KAAI,CAAC,QAAS,MAAM,QAAQ,K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ACR,oBAAiB;AACjB,UAAO,IAAI;IACX;AAEF,QAAM,GAAG,SAAS,MAAM,WAAW;AACjC,oBAAiB;AAIjB,OAAI,SAAS,KAAM,UADK;IAAC;IAAU;IAAW;IAAW;IAAS,CACrB,SAAS,OAAO,CAC3D,YAAS;OAET,QACE,OAAO,uBAAO,IAAI,MAAM,0BAA0B,EAAE;IAAE;IAAM;IAAQ,CAAC,CACtE;IAEH;GACF;CAEF,MAAM,gBAAgB;AACpB,MAAI;AACF,SAAM,KAAK,UAAU;UACf;;CAKV,MAAMA,iBACJ;EACE;GAAE,OAAO;GAAU,SAAS;GAAS;EACrC;GAAE,OAAO;GAAW,SAAS;GAAS;EACtC;GAAE,OAAO;GAAW,SAAS;GAAS;EACtC;GAAE,OAAO;GAAU,SAAS;GAAS;EACtC;AAGH,gBAAe,SAAS,EAAE,OAAO,cAAc;AAC7C,UAAQ,GAAG,OAAc,QAAe;GACxC;CAEF,MAAM,wBAAwB;AAC5B,iBAAe,SAAS,EAAE,OAAO,cAAc;AAC7C,WAAQ,IAAI,OAAc,QAAe;IACzC;;CAGJ,MAAM,aAAa;AACjB,MAAI;AACF,SAAM,KAAK,UAAU;UACf;;AAKV,QAAO;EAAE;EAAM;EAAQ;EAAa"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { UnmergedDictionaryOutput } from "./writeUnmergedDictionary.js";
|
|
2
2
|
import { MergedDictionaryOutput } from "./writeMergedDictionary.js";
|
|
3
3
|
import { LocalizedDictionaryOutput } from "./writeDynamicDictionary.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _intlayer_types20 from "@intlayer/types";
|
|
5
5
|
import { Dictionary } from "@intlayer/types";
|
|
6
6
|
|
|
7
7
|
//#region src/buildIntlayerDictionary/buildIntlayerDictionary.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* This function transpile the bundled code to to make dictionaries as JSON files
|
|
10
10
|
*/
|
|
11
|
-
declare const buildDictionary: (localDictionariesEntries: Dictionary[], configuration?:
|
|
11
|
+
declare const buildDictionary: (localDictionariesEntries: Dictionary[], configuration?: _intlayer_types20.IntlayerConfig, formats?: ("cjs" | "esm")[], importOtherDictionaries?: boolean) => Promise<{
|
|
12
12
|
unmergedDictionaries: UnmergedDictionaryOutput;
|
|
13
13
|
mergedDictionaries: MergedDictionaryOutput;
|
|
14
14
|
dynamicDictionaries: LocalizedDictionaryOutput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildIntlayerDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/buildIntlayerDictionary.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAca,4CACe,8BAAU,
|
|
1
|
+
{"version":3,"file":"buildIntlayerDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/buildIntlayerDictionary.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAca,4CACe,8BAAU,iBAAA,CACpC,mFAE8B;wBAFI;EAFvB,kBAsEZ,wBAAA;EArE2B,mBAAA,2BAAA;EAAU,iBACpC,2BAAA;CAAkC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MergedDictionaryOutput } from "./writeMergedDictionary.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_types16 from "@intlayer/types";
|
|
3
3
|
import { Dictionary, Locale } from "@intlayer/types";
|
|
4
4
|
|
|
5
5
|
//#region src/buildIntlayerDictionary/writeDynamicDictionary.d.ts
|
|
@@ -12,7 +12,7 @@ type LocalizedDictionaryOutput = Record<string, LocalizedDictionaryResult>;
|
|
|
12
12
|
/**
|
|
13
13
|
* This function generates the content of the dictionary list file
|
|
14
14
|
*/
|
|
15
|
-
declare const generateDictionaryEntryPoint: (localizedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?:
|
|
15
|
+
declare const generateDictionaryEntryPoint: (localizedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?: _intlayer_types16.IntlayerConfig) => string;
|
|
16
16
|
/**
|
|
17
17
|
* Write the localized dictionaries to the dictionariesDir
|
|
18
18
|
* @param mergedDictionaries - The merged dictionaries
|
|
@@ -29,7 +29,7 @@ declare const generateDictionaryEntryPoint: (localizedDictionariesPathsRecord: L
|
|
|
29
29
|
* // { key: 'home', content: { ... } },
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
declare const writeDynamicDictionary: (mergedDictionaries: MergedDictionaryOutput, configuration?:
|
|
32
|
+
declare const writeDynamicDictionary: (mergedDictionaries: MergedDictionaryOutput, configuration?: _intlayer_types16.IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<LocalizedDictionaryOutput>;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { DictionaryResult, LocalizedDictionaryOutput, LocalizedDictionaryResult, generateDictionaryEntryPoint, writeDynamicDictionary };
|
|
35
35
|
//# sourceMappingURL=writeDynamicDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeDynamicDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeDynamicDictionary.ts"],"sourcesContent":[],"mappings":";;;;;KAcY,gBAAA;;cAEE;AAFd,CAAA;AAKY,KAAA,yBAAA,GAA4B,OAAH,CACnC,MADmC,CAC5B,MAD4B,EACpB,gBADoB,CAAA,CAAA;AAC5B,KAGG,yBAAA,GAA4B,MAH/B,CAAA,MAAA,EAKP,yBALO,CAAA;;;;AADsC,cAYlC,4BAZkC,EAAA,CAAA,gCAAA,EAaX,yBAbW,EAAA,MAAA,CAAA,EAAA,KAAA,GAAA,KAAA,EAAA,aAAA,CAAA,EAac,
|
|
1
|
+
{"version":3,"file":"writeDynamicDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeDynamicDictionary.ts"],"sourcesContent":[],"mappings":";;;;;KAcY,gBAAA;;cAEE;AAFd,CAAA;AAKY,KAAA,yBAAA,GAA4B,OAAH,CACnC,MADmC,CAC5B,MAD4B,EACpB,gBADoB,CAAA,CAAA;AAC5B,KAGG,yBAAA,GAA4B,MAH/B,CAAA,MAAA,EAKP,yBALO,CAAA;;;;AADsC,cAYlC,4BAZkC,EAAA,CAAA,gCAAA,EAaX,yBAbW,EAAA,MAAA,CAAA,EAAA,KAAA,GAAA,KAAA,EAAA,aAAA,CAAA,EAac,iBAAA,CAE3D,cAf6C,EAAA,GAAA,MAAA;AAI/C;AAQA;AAsDA;;;;;;;;;;;;;;cAAa,6CACS,wCAAsB,iBAAA,CAC1C,gDAEC,QAAQ"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { LocalizedDictionaryOutput, LocalizedDictionaryResult } from "./writeDynamicDictionary.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_types21 from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/buildIntlayerDictionary/writeFetchDictionary.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* This function generates the content of the dictionary list file
|
|
7
7
|
*/
|
|
8
|
-
declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?:
|
|
8
|
+
declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?: _intlayer_types21.IntlayerConfig) => string;
|
|
9
9
|
/**
|
|
10
10
|
* Write the localized dictionaries to the dictionariesDir
|
|
11
11
|
* @param mergedDictionaries - The merged dictionaries
|
|
@@ -22,7 +22,7 @@ declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: Loc
|
|
|
22
22
|
* // { key: 'home', content: { ... } },
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
declare const writeFetchDictionary: (dynamicDictionaries: LocalizedDictionaryOutput, configuration?:
|
|
25
|
+
declare const writeFetchDictionary: (dynamicDictionaries: LocalizedDictionaryOutput, configuration?: _intlayer_types21.IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<LocalizedDictionaryOutput>;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { generateDictionaryEntryPoint, writeFetchDictionary };
|
|
28
28
|
//# sourceMappingURL=writeFetchDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeFetchDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeFetchDictionary.ts"],"sourcesContent":[],"mappings":";;;;;;;AAiBa,cAAA,4BACqB,EAAA,CAAA,8BAAyB,EAAzB,yBAEE,EAAA,MAAA,CAAA,EAAA,KAAA,GAAA,KAAA,EAAA,aAAA,CAAA,EAFuB,
|
|
1
|
+
{"version":3,"file":"writeFetchDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeFetchDictionary.ts"],"sourcesContent":[],"mappings":";;;;;;;AAiBa,cAAA,4BACqB,EAAA,CAAA,8BAAyB,EAAzB,yBAEE,EAAA,MAAA,CAAA,EAAA,KAAA,GAAA,KAAA,EAAA,aAAA,CAAA,EAFuB,iBAAA,CAEzD,cAAkC,EAAA,GAAA,MAAA;AA+CpC;;;;;;;;;;;;;;;;cAAa,4CACU,2CAAyB,iBAAA,CAC9C,gDAEC,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnmergedDictionaryOutput } from "./writeUnmergedDictionary.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_types19 from "@intlayer/types";
|
|
3
3
|
import { Dictionary } from "@intlayer/types";
|
|
4
4
|
|
|
5
5
|
//#region src/buildIntlayerDictionary/writeMergedDictionary.d.ts
|
|
@@ -24,7 +24,7 @@ type MergedDictionaryOutput = Record<string, MergedDictionaryResult>;
|
|
|
24
24
|
* // { key: 'home', content: { ... } },
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
declare const writeMergedDictionaries: (groupedDictionaries: UnmergedDictionaryOutput, configuration?:
|
|
27
|
+
declare const writeMergedDictionaries: (groupedDictionaries: UnmergedDictionaryOutput, configuration?: _intlayer_types19.IntlayerConfig) => Promise<MergedDictionaryOutput>;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { MergedDictionaryOutput, MergedDictionaryResult, writeMergedDictionaries };
|
|
30
30
|
//# sourceMappingURL=writeMergedDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeMergedDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeMergedDictionary.ts"],"sourcesContent":[],"mappings":";;;;;KASY,sBAAA;;cAEE;AAFd,CAAA;AAKY,KAAA,sBAAA,GAAyB,MAAe,CAAA,MAAA,EAAA,sBAAT,CAAA;AAkB3C;;;;;;;;;;;;;;;;cAAa,+CACU,0CAAwB,
|
|
1
|
+
{"version":3,"file":"writeMergedDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeMergedDictionary.ts"],"sourcesContent":[],"mappings":";;;;;KASY,sBAAA;;cAEE;AAFd,CAAA;AAKY,KAAA,sBAAA,GAAyB,MAAe,CAAA,MAAA,EAAA,sBAAT,CAAA;AAkB3C;;;;;;;;;;;;;;;;cAAa,+CACU,0CAAwB,iBAAA,CAC7C,mBACC,QAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types18 from "@intlayer/types";
|
|
2
2
|
import { Dictionary } from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/buildIntlayerDictionary/writeRemoteDictionary.d.ts
|
|
@@ -23,7 +23,7 @@ type RemoteDictionaryOutput = Record<string, RemoteDictionaryResult>;
|
|
|
23
23
|
* // { key: 'home', content: { ... } },
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
declare const writeRemoteDictionary: (remoteDictionaries: Dictionary[], configuration?:
|
|
26
|
+
declare const writeRemoteDictionary: (remoteDictionaries: Dictionary[], configuration?: _intlayer_types18.IntlayerConfig) => Promise<RemoteDictionaryOutput>;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { RemoteDictionaryOutput, RemoteDictionaryResult, writeRemoteDictionary };
|
|
29
29
|
//# sourceMappingURL=writeRemoteDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeRemoteDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeRemoteDictionary.ts"],"sourcesContent":[],"mappings":";;;;KAcY,sBAAA;;gBAEI;AAFhB,CAAA;AAKY,KAAA,sBAAA,GAAyB,MAAe,CAAA,MAAA,EAAA,sBAAT,CAAA;AAkB3C;;;;;;;;;;;;;;;;cAAa,4CACS,8BAAU,
|
|
1
|
+
{"version":3,"file":"writeRemoteDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeRemoteDictionary.ts"],"sourcesContent":[],"mappings":";;;;KAcY,sBAAA;;gBAEI;AAFhB,CAAA;AAKY,KAAA,sBAAA,GAAyB,MAAe,CAAA,MAAA,EAAA,sBAAT,CAAA;AAkB3C;;;;;;;;;;;;;;;;cAAa,4CACS,8BAAU,iBAAA,CAC9B,mBACC,QAAQ"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types14 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* This function generates a list of dictionaries in the main directory
|
|
6
6
|
*/
|
|
7
|
-
declare const createDictionaryEntryPoint: (configuration?:
|
|
7
|
+
declare const createDictionaryEntryPoint: (configuration?: _intlayer_types14.IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<void>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { createDictionaryEntryPoint };
|
|
10
10
|
//# sourceMappingURL=createDictionaryEntryPoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDictionaryEntryPoint.d.ts","names":[],"sources":["../../../src/createDictionaryEntryPoint/createDictionaryEntryPoint.ts"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"createDictionaryEntryPoint.d.ts","names":[],"sources":["../../../src/createDictionaryEntryPoint/createDictionaryEntryPoint.ts"],"sourcesContent":[],"mappings":";;;;;;AAwCa,cAAA,0BA0EZ,EAAA,CAAA,aAxE4B,CAD3B,EAyED,iBAAA,CAzEC,cAC2B,EAAA,OAAA,CAAA,EAAA,CAAA,KAAA,GAAA,KAAA,CAAA,EAAA,EAAA,GAAA,OAAA,CAAA,IAAA,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types13 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/createDictionaryEntryPoint/generateDictionaryListContent.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* This function generates the content of the dictionary list file
|
|
6
6
|
*/
|
|
7
|
-
declare const generateDictionaryListContent: (dictionaries: string[], functionName: string, format?: "cjs" | "esm", configuration?:
|
|
7
|
+
declare const generateDictionaryListContent: (dictionaries: string[], functionName: string, importType: "json" | "javascript", format?: "cjs" | "esm", configuration?: _intlayer_types13.IntlayerConfig) => string;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { generateDictionaryListContent };
|
|
10
10
|
//# sourceMappingURL=generateDictionaryListContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateDictionaryListContent.d.ts","names":[],"sources":["../../../src/createDictionaryEntryPoint/generateDictionaryListContent.ts"],"sourcesContent":[],"mappings":";;;;;;AAOa,cAAA,
|
|
1
|
+
{"version":3,"file":"generateDictionaryListContent.d.ts","names":[],"sources":["../../../src/createDictionaryEntryPoint/generateDictionaryListContent.ts"],"sourcesContent":[],"mappings":";;;;;;AAOa,cAAA,6BAgDZ,EAAA,CAAA,YAAA,EA3CC,MAAA,EAAA,EAAA,YAAkC,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,GAAA,YAAA,EAAA,MAAA,CAAA,EAAA,KAAA,GAAA,KAAA,EAAA,aAAA,CAAA,EA2CnC,iBAAA,CA3CC,cAAkC,EAAA,GAAA,MAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as _intlayer_types0 from "@intlayer/types";
|
|
2
|
+
import { Dictionary } from "@intlayer/types";
|
|
3
|
+
import * as _intlayer_core_messageFormat0 from "@intlayer/core/messageFormat";
|
|
4
|
+
|
|
5
|
+
//#region src/formatDictionary.d.ts
|
|
6
|
+
declare const formatDictionary: (dictionary: Dictionary) => Dictionary;
|
|
7
|
+
declare const formatDictionaries: (dictionaries: Dictionary[]) => Dictionary[];
|
|
8
|
+
declare const formatDictionaryOutput: (dictionary: Dictionary) => Dictionary | {
|
|
9
|
+
format: string;
|
|
10
|
+
content: _intlayer_core_messageFormat0.JsonValue;
|
|
11
|
+
$schema?: string;
|
|
12
|
+
id?: _intlayer_types0.DictionaryId;
|
|
13
|
+
projectIds?: string[];
|
|
14
|
+
localId?: _intlayer_types0.LocalDictionaryId;
|
|
15
|
+
localIds?: _intlayer_types0.LocalDictionaryId[];
|
|
16
|
+
key: _intlayer_types0.DictionaryKey;
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
versions?: string[];
|
|
20
|
+
version?: string;
|
|
21
|
+
filePath?: string;
|
|
22
|
+
tags?: string[];
|
|
23
|
+
locale?: _intlayer_types0.LocalesValues;
|
|
24
|
+
fill?: _intlayer_types0.Fill;
|
|
25
|
+
filled?: true;
|
|
26
|
+
priority?: number;
|
|
27
|
+
live?: boolean;
|
|
28
|
+
location?: _intlayer_types0.DictionaryLocation;
|
|
29
|
+
};
|
|
30
|
+
declare const formatDictionariesOutput: (dictionaries: Dictionary[]) => (Dictionary | {
|
|
31
|
+
format: string;
|
|
32
|
+
content: _intlayer_core_messageFormat0.JsonValue;
|
|
33
|
+
$schema?: string;
|
|
34
|
+
id?: _intlayer_types0.DictionaryId;
|
|
35
|
+
projectIds?: string[];
|
|
36
|
+
localId?: _intlayer_types0.LocalDictionaryId;
|
|
37
|
+
localIds?: _intlayer_types0.LocalDictionaryId[];
|
|
38
|
+
key: _intlayer_types0.DictionaryKey;
|
|
39
|
+
title?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
versions?: string[];
|
|
42
|
+
version?: string;
|
|
43
|
+
filePath?: string;
|
|
44
|
+
tags?: string[];
|
|
45
|
+
locale?: _intlayer_types0.LocalesValues;
|
|
46
|
+
fill?: _intlayer_types0.Fill;
|
|
47
|
+
filled?: true;
|
|
48
|
+
priority?: number;
|
|
49
|
+
live?: boolean;
|
|
50
|
+
location?: _intlayer_types0.DictionaryLocation;
|
|
51
|
+
})[];
|
|
52
|
+
//#endregion
|
|
53
|
+
export { formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput };
|
|
54
|
+
//# sourceMappingURL=formatDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatDictionary.d.ts","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":[],"mappings":";;;;;cAUa,+BAAgC,eAAa;cA4B7C,mCAAoC,iBAAe;cAGnD,qCAAsC,eAAU;;EA/BhD,OAAA,EA+BgD,6BAAA,CAAA,SAL5D;EAEY,OAAA,CAAA,EAAA,MAAA;EAGA,EAAA,CAAA,+BA0BZ;EA1BkD,UAAA,CAAA,EAAA,MAAA,EAAA;EAAU,OAAA,CAAA,oCAAA;EAAA,QAAA,CAAA,sCAAA;;;;;;;;;EA4BhD,IAAA,CAAA,uBAC6B;EADa,MAAA,CAAA,EAAA,IAAA;EAAY,QAAA,CAAA,EAAA,MAAA;EAAA,IAAA,CAAA,EAAA,OAAA;;;cAAtD,yCAA0C,kBAAY;;WAAA,6BAAA,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { loadRemoteDictionaries } from "./loadDictionaries/loadRemoteDictionarie
|
|
|
18
18
|
import "./loadDictionaries/index.js";
|
|
19
19
|
import { fetchDistantDictionaries } from "./fetchDistantDictionaries.js";
|
|
20
20
|
import { isInvalidDictionary } from "./filterInvalidDictionaries.js";
|
|
21
|
+
import { formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput } from "./formatDictionary.js";
|
|
21
22
|
import { Extension, Format, getExtensionFromFormat, getFormatFromExtension } from "./utils/getFormatFromExtension.js";
|
|
22
23
|
import { getContentDeclarationFileTemplate } from "./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.js";
|
|
23
24
|
import { handleAdditionalContentDeclarationFile } from "./handleAdditionalContentDeclarationFile.js";
|
|
@@ -54,4 +55,4 @@ import { writeContentDeclaration } from "./writeContentDeclaration/writeContentD
|
|
|
54
55
|
import { writeJSFile } from "./writeContentDeclaration/writeJSFile.js";
|
|
55
56
|
import "./writeContentDeclaration/index.js";
|
|
56
57
|
import { detectFormatCommand } from "./writeContentDeclaration/detectFormatCommand.js";
|
|
57
|
-
export { ATTRIBUTES_TO_EXTRACT, type BuildFilesListOptions, type DictionaryStatus, type DiffMode, type Extension, type Format, type JSONObject, type JsonChunk, type ListGitFilesOptions, type ListGitLinesOptions, type PackageName, type ParallelHandle, assembleJSON, buildAndWatchIntlayer, buildDictionary, buildFilesList, chunkJSON, cleanOutputDir, createDictionaryEntryPoint, createModuleAugmentation, createTypes, detectExportedComponentName, detectFormatCommand, extractDictionaryKey, extractIntlayer, fetchDistantDictionaries, formatLocale, formatPath, generateDictionaryListContent, generateKey, getBuiltDictionariesPath, getBuiltDynamicDictionariesPath, getBuiltFetchDictionariesPath, getBuiltRemoteDictionariesPath, getBuiltUnmergedDictionariesPath, getChunk, getComponentTransformPattern, getComponentTransformPatternSync, getContentDeclarationFileTemplate, getExtensionFromFormat, getFileHash, getFormatFromExtension, getGlobalLimiter, getTaskLimiter, handleAdditionalContentDeclarationFile, handleContentDeclarationFileChange, handleUnlinkedContentDeclarationFile, isInvalidDictionary, listDictionaries, listDictionariesWithStats, listGitFiles, listGitLines, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, pLimit, parallelize, parallelizeGlobal, prepareIntlayer, reconstructFromSingleChunk, reduceDictionaryContent, reduceObjectFormat, resolveObjectPromises, runOnce, runParallel, shouldExtract, sortAlphabetically, splitTextByLines, transformFiles, transformJSFile, verifyIdenticObjectFormat, watch, writeContentDeclaration, writeJSFile };
|
|
58
|
+
export { ATTRIBUTES_TO_EXTRACT, type BuildFilesListOptions, type DictionaryStatus, type DiffMode, type Extension, type Format, type JSONObject, type JsonChunk, type ListGitFilesOptions, type ListGitLinesOptions, type PackageName, type ParallelHandle, assembleJSON, buildAndWatchIntlayer, buildDictionary, buildFilesList, chunkJSON, cleanOutputDir, createDictionaryEntryPoint, createModuleAugmentation, createTypes, detectExportedComponentName, detectFormatCommand, extractDictionaryKey, extractIntlayer, fetchDistantDictionaries, formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput, formatLocale, formatPath, generateDictionaryListContent, generateKey, getBuiltDictionariesPath, getBuiltDynamicDictionariesPath, getBuiltFetchDictionariesPath, getBuiltRemoteDictionariesPath, getBuiltUnmergedDictionariesPath, getChunk, getComponentTransformPattern, getComponentTransformPatternSync, getContentDeclarationFileTemplate, getExtensionFromFormat, getFileHash, getFormatFromExtension, getGlobalLimiter, getTaskLimiter, handleAdditionalContentDeclarationFile, handleContentDeclarationFileChange, handleUnlinkedContentDeclarationFile, isInvalidDictionary, listDictionaries, listDictionariesWithStats, listGitFiles, listGitLines, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, pLimit, parallelize, parallelizeGlobal, prepareIntlayer, reconstructFromSingleChunk, reduceDictionaryContent, reduceObjectFormat, resolveObjectPromises, runOnce, runParallel, shouldExtract, sortAlphabetically, splitTextByLines, transformFiles, transformJSFile, verifyIdenticObjectFormat, watch, writeContentDeclaration, writeJSFile };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntlayerConfig } from "@intlayer/types";
|
|
2
|
-
import * as
|
|
2
|
+
import * as node_fs0 from "node:fs";
|
|
3
3
|
|
|
4
4
|
//#region src/listDictionariesPath.d.ts
|
|
5
5
|
|
|
@@ -11,7 +11,7 @@ import * as fs0 from "fs";
|
|
|
11
11
|
declare const listDictionaries: (configuration: IntlayerConfig) => Promise<string[]>;
|
|
12
12
|
declare const listDictionariesWithStats: (configuration: IntlayerConfig) => Promise<{
|
|
13
13
|
path: string;
|
|
14
|
-
stats:
|
|
14
|
+
stats: node_fs0.Stats;
|
|
15
15
|
}[]>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { listDictionaries, listDictionariesWithStats };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listDictionariesPath.d.ts","names":[],"sources":["../../src/listDictionariesPath.ts"],"sourcesContent":[],"mappings":";;;;;;;;AASA;AAaA;AACiB,cAdJ,gBAcI,EAAA,CAAA,aAAA,EAbA,cAaA,EAAA,GAZd,OAYc,CAAA,MAAA,EAAA,CAAA;AAAc,cADlB,yBACkB,EAAA,CAAA,aAAA,EAAd,cAAc,EAAA,GAAA,OAAA,CAAA;EAAA,IAAA,EAAA,MAAA;EAAA,KAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"listDictionariesPath.d.ts","names":[],"sources":["../../src/listDictionariesPath.ts"],"sourcesContent":[],"mappings":";;;;;;;;AASA;AAaA;AACiB,cAdJ,gBAcI,EAAA,CAAA,aAAA,EAbA,cAaA,EAAA,GAZd,OAYc,CAAA,MAAA,EAAA,CAAA;AAAc,cADlB,yBACkB,EAAA,CAAA,aAAA,EAAd,cAAc,EAAA,GAAA,OAAA,CAAA;EAAA,IAAA,EAAA,MAAA;EAAA,KAAA,EAAA,QAAA,CAAA,KAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadDictionaries.d.ts","names":[],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"loadDictionaries.d.ts","names":[],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":[],"mappings":";;;KAcY,kBAAA;;EAAA,IAAA,EAAA,OAAA,GAAA,QAAkB;EA6IjB,MAAA,EAAA,SAAA,GAmIZ,UAAA,GAAA,SAAA,GAAA,OAAA,GAAA,UAAA,GAAA,OAAA,GAAA,UAAA,GAAA,OAAA;EAjIgB,KAAA,CAAA,EAAA,MAAA;CAEI;AACC,cALT,gBAKS,EAAA,CAAA,wBAAA,EAAA,MAAA,EAAA,GAAA,MAAA,EAAA,aAAA,EAHL,cAGK,EAAA,GAFnB,OAEmB,CAAA;EACA,iBAAA,EAFD,UAEC,EAAA;EAHnB,kBAAA,EAEmB,UAFnB,EAAA;EAAO,kBAAA,EAGY,UAHZ,EAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DictionariesStatus } from "./loadDictionaries.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_types15 from "@intlayer/types";
|
|
3
3
|
import { Dictionary } from "@intlayer/types";
|
|
4
4
|
import { DictionaryAPI } from "@intlayer/backend";
|
|
5
5
|
|
|
6
6
|
//#region src/loadDictionaries/loadRemoteDictionaries.d.ts
|
|
7
7
|
declare const formatDistantDictionaries: (dictionaries: (DictionaryAPI | Dictionary)[]) => Dictionary[];
|
|
8
|
-
declare const loadRemoteDictionaries: (configuration?:
|
|
8
|
+
declare const loadRemoteDictionaries: (configuration?: _intlayer_types15.IntlayerConfig, onStatusUpdate?: (status: DictionariesStatus[]) => void, options?: {
|
|
9
9
|
onStartRemoteCheck?: () => void;
|
|
10
10
|
onStopRemoteCheck?: () => void;
|
|
11
11
|
onError?: (error: Error) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadRemoteDictionaries.d.ts","names":[],"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"sourcesContent":[],"mappings":";;;;;;cAUa,2CACI,gBAAgB,kBAC9B;cAOU,yCAsIZ,
|
|
1
|
+
{"version":3,"file":"loadRemoteDictionaries.d.ts","names":[],"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"sourcesContent":[],"mappings":";;;;;;cAUa,2CACI,gBAAgB,kBAC9B;cAOU,yCAsIZ,iBAAA,CArIC,0CAC0B,sCAVK;;EADpB,iBAAA,CAAA,EAAA,GAAA,GAAA,IAOR;EANY,OAAA,CAAA,EAAA,CAAA,KAAA,EAcK,KAdL,EAAA,GAAA,IAAA;CAAgB,EAAA,GAgB9B,OAhB8B,CAgBtB,UAhBsB,EAAA,CAAA"}
|