@intlayer/chokidar 5.8.1 → 6.0.0-canary.0
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/chokidar/watcher.cjs +15 -20
- package/dist/cjs/chokidar/watcher.cjs.map +1 -1
- package/dist/cjs/fetchDistantDictionaries.cjs +18 -37
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/{fetchDistantDictionaryKeys.cjs → fetchDistantDictionaryKeysAndUpdateTimestamp.cjs} +10 -10
- package/dist/cjs/fetchDistantDictionaryKeysAndUpdateTimestamp.cjs.map +1 -0
- package/dist/cjs/filterInvalidDictionaries.cjs +70 -0
- package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -0
- package/dist/cjs/getBuiltFetchDictionariesPath.cjs +52 -0
- package/dist/cjs/getBuiltFetchDictionariesPath.cjs.map +1 -0
- package/dist/cjs/getBuiltRemoteDictionariesPath.cjs +51 -0
- package/dist/cjs/getBuiltRemoteDictionariesPath.cjs.map +1 -0
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/index.cjs +4 -4
- package/dist/cjs/loadDictionaries/index.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +57 -17
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +128 -53
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +101 -0
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/log.cjs +144 -0
- package/dist/cjs/loadDictionaries/log.cjs.map +1 -0
- package/dist/cjs/mergeDictionaries.cjs +18 -22
- package/dist/cjs/mergeDictionaries.cjs.map +1 -1
- package/dist/cjs/orderDictionaries.cjs +71 -0
- package/dist/cjs/orderDictionaries.cjs.map +1 -0
- package/dist/cjs/prepareContentDeclaration.cjs +4 -1
- package/dist/cjs/prepareContentDeclaration.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +9 -4
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/processPerLocaleDictionary.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs +22 -8
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs +44 -42
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.cjs +83 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs +29 -21
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.cjs +52 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs +44 -29
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs.map +1 -1
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +39 -34
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs +4 -6
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs.map +1 -1
- package/dist/cjs/transpiler/dictionary_to_type/createType.cjs +17 -16
- package/dist/cjs/transpiler/dictionary_to_type/createType.cjs.map +1 -1
- package/dist/cjs/utils/formatter.cjs +50 -0
- package/dist/cjs/utils/formatter.cjs.map +1 -0
- package/dist/cjs/utils/parallelize.cjs +43 -0
- package/dist/cjs/utils/parallelize.cjs.map +1 -0
- package/dist/cjs/utils/runOnce.cjs +2 -1
- package/dist/cjs/utils/runOnce.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/formatCode.cjs +7 -4
- package/dist/cjs/writeContentDeclaration/formatCode.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +5 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +43 -25
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
- package/dist/esm/chokidar/watcher.mjs +16 -21
- package/dist/esm/chokidar/watcher.mjs.map +1 -1
- package/dist/esm/fetchDistantDictionaries.mjs +24 -28
- package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/{fetchDistantDictionaryKeys.mjs → fetchDistantDictionaryKeysAndUpdateTimestamp.mjs} +6 -6
- package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs.map +1 -0
- package/dist/esm/filterInvalidDictionaries.mjs +40 -0
- package/dist/esm/filterInvalidDictionaries.mjs.map +1 -0
- package/dist/esm/getBuiltFetchDictionariesPath.mjs +18 -0
- package/dist/esm/getBuiltFetchDictionariesPath.mjs.map +1 -0
- package/dist/esm/getBuiltRemoteDictionariesPath.mjs +17 -0
- package/dist/esm/getBuiltRemoteDictionariesPath.mjs.map +1 -0
- package/dist/esm/index.mjs +8 -9
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/loadDictionaries/index.mjs +2 -2
- package/dist/esm/loadDictionaries/index.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +61 -18
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +132 -53
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +66 -0
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -0
- package/dist/esm/loadDictionaries/log.mjs +125 -0
- package/dist/esm/loadDictionaries/log.mjs.map +1 -0
- package/dist/esm/mergeDictionaries.mjs +19 -23
- package/dist/esm/mergeDictionaries.mjs.map +1 -1
- package/dist/esm/orderDictionaries.mjs +37 -0
- package/dist/esm/orderDictionaries.mjs.map +1 -0
- package/dist/esm/prepareContentDeclaration.mjs +4 -1
- package/dist/esm/prepareContentDeclaration.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +9 -4
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/processPerLocaleDictionary.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs +25 -9
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs +45 -43
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.mjs +58 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs +29 -21
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.mjs +28 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs +45 -30
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs.map +1 -1
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +39 -34
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs +4 -6
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs.map +1 -1
- package/dist/esm/transpiler/dictionary_to_type/createType.mjs +17 -16
- package/dist/esm/transpiler/dictionary_to_type/createType.mjs.map +1 -1
- package/dist/esm/utils/formatter.mjs +15 -0
- package/dist/esm/utils/formatter.mjs.map +1 -0
- package/dist/esm/utils/parallelize.mjs +9 -0
- package/dist/esm/utils/parallelize.mjs.map +1 -0
- package/dist/esm/utils/runOnce.mjs +2 -1
- package/dist/esm/utils/runOnce.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/formatCode.mjs +8 -5
- package/dist/esm/writeContentDeclaration/formatCode.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +5 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +40 -22
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
- package/dist/types/chokidar/watcher.d.ts.map +1 -1
- package/dist/types/fetchDistantDictionaries.d.ts +2 -1
- package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts +3 -0
- package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts.map +1 -0
- package/dist/types/filterInvalidDictionaries.d.ts +3 -0
- package/dist/types/filterInvalidDictionaries.d.ts.map +1 -0
- package/dist/types/getBuiltFetchDictionariesPath.d.ts +5 -0
- package/dist/types/getBuiltFetchDictionariesPath.d.ts.map +1 -0
- package/dist/types/getBuiltRemoteDictionariesPath.d.ts +5 -0
- package/dist/types/getBuiltRemoteDictionariesPath.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/loadDictionaries/index.d.ts +2 -2
- package/dist/types/loadDictionaries/index.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +4 -1
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadDictionaries.d.ts +11 -1
- package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +6 -0
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -0
- package/dist/types/loadDictionaries/log.d.ts +19 -0
- package/dist/types/loadDictionaries/log.d.ts.map +1 -0
- package/dist/types/mergeDictionaries.d.ts +1 -1
- package/dist/types/mergeDictionaries.d.ts.map +1 -1
- package/dist/types/orderDictionaries.d.ts +10 -0
- package/dist/types/orderDictionaries.d.ts.map +1 -0
- package/dist/types/prepareContentDeclaration.d.ts.map +1 -1
- package/dist/types/prepareIntlayer.d.ts.map +1 -1
- package/dist/types/processPerLocaleDictionary.d.ts +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts.map +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts +4 -3
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts.map +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.d.ts +23 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts.map +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.d.ts +19 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +1 -1
- package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts +1 -1
- package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +1 -1
- package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts +1 -1
- package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts.map +1 -1
- package/dist/types/transpiler/dictionary_to_type/createType.d.ts +1 -1
- package/dist/types/transpiler/dictionary_to_type/createType.d.ts.map +1 -1
- package/dist/types/utils/formatter.d.ts +4 -0
- package/dist/types/utils/formatter.d.ts.map +1 -0
- package/dist/types/utils/parallelize.d.ts +2 -0
- package/dist/types/utils/parallelize.d.ts.map +1 -0
- package/dist/types/utils/runOnce.d.ts +1 -1
- package/dist/types/utils/runOnce.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/formatCode.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +1 -1
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts +1 -1
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
- package/package.json +19 -17
- package/dist/cjs/checkDictionaryChanges.cjs +0 -58
- package/dist/cjs/checkDictionaryChanges.cjs.map +0 -1
- package/dist/cjs/fetchDistantDictionaryKeys.cjs.map +0 -1
- package/dist/cjs/getFilteredLocalesContent.cjs +0 -70
- package/dist/cjs/getFilteredLocalesContent.cjs.map +0 -1
- package/dist/cjs/loadDictionaries/loadDistantDictionaries.cjs +0 -44
- package/dist/cjs/loadDictionaries/loadDistantDictionaries.cjs.map +0 -1
- package/dist/cjs/log.cjs +0 -296
- package/dist/cjs/log.cjs.map +0 -1
- package/dist/esm/checkDictionaryChanges.mjs +0 -37
- package/dist/esm/checkDictionaryChanges.mjs.map +0 -1
- package/dist/esm/fetchDistantDictionaryKeys.mjs.map +0 -1
- package/dist/esm/getFilteredLocalesContent.mjs +0 -49
- package/dist/esm/getFilteredLocalesContent.mjs.map +0 -1
- package/dist/esm/loadDictionaries/loadDistantDictionaries.mjs +0 -20
- package/dist/esm/loadDictionaries/loadDistantDictionaries.mjs.map +0 -1
- package/dist/esm/log.mjs +0 -262
- package/dist/esm/log.mjs.map +0 -1
- package/dist/types/checkDictionaryChanges.d.ts +0 -3
- package/dist/types/checkDictionaryChanges.d.ts.map +0 -1
- package/dist/types/fetchDistantDictionaryKeys.d.ts +0 -3
- package/dist/types/fetchDistantDictionaryKeys.d.ts.map +0 -1
- package/dist/types/getFilteredLocalesContent.d.ts +0 -4
- package/dist/types/getFilteredLocalesContent.d.ts.map +0 -1
- package/dist/types/loadDictionaries/loadDistantDictionaries.d.ts +0 -8
- package/dist/types/loadDictionaries/loadDistantDictionaries.d.ts.map +0 -1
- package/dist/types/log.d.ts +0 -45
- package/dist/types/log.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IntlayerConfig } from '@intlayer/config/client';
|
|
2
2
|
import type { Dictionary } from '@intlayer/core';
|
|
3
3
|
import type { DictionaryStatus } from './dictionaryStatus';
|
|
4
4
|
export declare const writeContentDeclaration: (dictionary: Dictionary, config?: IntlayerConfig, newDictionariesPath?: string) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"writeContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAsB3D,eAAO,MAAM,uBAAuB,GAClC,YAAY,UAAU,EACtB,SAAQ,cAA8B,EACtC,sBAAsB,MAAM,KAC3B,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA0DpD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dictionary } from '@intlayer/core';
|
|
2
2
|
/**
|
|
3
|
-
* Updates a JavaScript
|
|
3
|
+
* Updates a JavaScriptå/TypeScript file based on the provided JSON instructions.
|
|
4
4
|
* It targets a specific dictionary object within the file (identified by its 'key' property)
|
|
5
5
|
* and updates its 'content' entries. Currently, it focuses on modifying arguments
|
|
6
6
|
* of 't' (translation) function calls.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeJSFile.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/writeJSFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeJSFile.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/writeJSFile.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,UAAU,EAIX,MAAM,gBAAgB,CAAC;AAOxB;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,MAAM,EAChB,YAAY,UAAU,KACrB,OAAO,CAAC,IAAI,CAwdd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/chokidar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.",
|
|
6
6
|
"keywords": [
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"fast-glob": "^3.3.3",
|
|
69
69
|
"p-limit": "^3.1.0",
|
|
70
70
|
"simple-git": "^3.27.0",
|
|
71
|
-
"@intlayer/
|
|
72
|
-
"@intlayer/
|
|
73
|
-
"@intlayer/api": "
|
|
74
|
-
"@intlayer/dictionaries-entry": "
|
|
75
|
-
"intlayer": "
|
|
76
|
-
"@intlayer/unmerged-dictionaries-entry": "
|
|
71
|
+
"@intlayer/dictionaries-entry": "6.0.0-canary.0",
|
|
72
|
+
"@intlayer/config": "6.0.0-canary.0",
|
|
73
|
+
"@intlayer/api": "6.0.0-canary.0",
|
|
74
|
+
"@intlayer/remote-dictionaries-entry": "6.0.0-canary.0",
|
|
75
|
+
"@intlayer/core": "6.0.0-canary.0",
|
|
76
|
+
"@intlayer/unmerged-dictionaries-entry": "6.0.0-canary.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@changesets/cli": "2.29.5",
|
|
@@ -84,26 +84,28 @@
|
|
|
84
84
|
"@types/node": "^24.2.1",
|
|
85
85
|
"@typescript-eslint/parser": "^8.33.1",
|
|
86
86
|
"concurrently": "^9.1.2",
|
|
87
|
-
"eslint": "^9.
|
|
88
|
-
"prettier": "^3.
|
|
87
|
+
"eslint": "^9.34.0",
|
|
88
|
+
"prettier": "^3.6.2",
|
|
89
89
|
"rimraf": "^6.0.1",
|
|
90
90
|
"tsc-alias": "^1.8.16",
|
|
91
91
|
"tsup": "^8.5.0",
|
|
92
92
|
"typescript": "^5.9.2",
|
|
93
|
-
"vitest": "^3.2.
|
|
94
|
-
"@intlayer/backend": "5.8.1",
|
|
93
|
+
"vitest": "^3.2.4",
|
|
95
94
|
"@utils/eslint-config": "1.0.4",
|
|
96
95
|
"@utils/ts-config": "1.0.4",
|
|
97
|
-
"@utils/
|
|
98
|
-
"@utils/
|
|
96
|
+
"@utils/ts-config-types": "1.0.4",
|
|
97
|
+
"@utils/tsup-config": "1.0.4"
|
|
99
98
|
},
|
|
100
99
|
"peerDependencies": {
|
|
101
100
|
"fast-glob": "^3.3.3",
|
|
102
101
|
"react": ">=16.0.0",
|
|
103
|
-
"@intlayer/api": "
|
|
104
|
-
"@intlayer/core": "
|
|
105
|
-
"intlayer": "
|
|
106
|
-
"@intlayer/
|
|
102
|
+
"@intlayer/api": "6.0.0-canary.0",
|
|
103
|
+
"@intlayer/core": "6.0.0-canary.0",
|
|
104
|
+
"@intlayer/config": "6.0.0-canary.0",
|
|
105
|
+
"@intlayer/remote-dictionaries-entry": "6.0.0-canary.0",
|
|
106
|
+
"@intlayer/dictionaries-entry": "6.0.0-canary.0",
|
|
107
|
+
"@intlayer/unmerged-dictionaries-entry": "6.0.0-canary.0",
|
|
108
|
+
"intlayer": "6.0.0-canary.0"
|
|
107
109
|
},
|
|
108
110
|
"engines": {
|
|
109
111
|
"node": ">=14.18"
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var checkDictionaryChanges_exports = {};
|
|
20
|
-
__export(checkDictionaryChanges_exports, {
|
|
21
|
-
checkDictionaryChanges: () => checkDictionaryChanges
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(checkDictionaryChanges_exports);
|
|
24
|
-
var import_api = require("@intlayer/api");
|
|
25
|
-
var import_config = require("@intlayer/config");
|
|
26
|
-
var import_buildIntlayerDictionary = require('./transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs');
|
|
27
|
-
const writeDictionary = async (dictionary, configuration) => {
|
|
28
|
-
const appLogger = (0, import_config.getAppLogger)(configuration);
|
|
29
|
-
appLogger(`Writing dictionary ${dictionary.key}`);
|
|
30
|
-
await (0, import_buildIntlayerDictionary.buildIntlayerDictionary)([dictionary]);
|
|
31
|
-
};
|
|
32
|
-
const checkDictionaryChanges = async () => {
|
|
33
|
-
const configuration = (0, import_config.getConfiguration)();
|
|
34
|
-
const appLogger = (0, import_config.getAppLogger)(configuration);
|
|
35
|
-
const { editor } = configuration;
|
|
36
|
-
if (!editor.hotReload) return;
|
|
37
|
-
if (!editor.clientId) return;
|
|
38
|
-
if (!editor.clientSecret) return;
|
|
39
|
-
const eventSource = new import_api.IntlayerEventListener(configuration);
|
|
40
|
-
try {
|
|
41
|
-
await eventSource.initialize().then(() => {
|
|
42
|
-
appLogger("Connected to Intlayer. Hot reload enabled");
|
|
43
|
-
});
|
|
44
|
-
} catch (error) {
|
|
45
|
-
appLogger("Error initializing IntlayerEventListener:", {
|
|
46
|
-
level: "error"
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
eventSource.onDictionaryAdded = (dictionary) => writeDictionary(dictionary, configuration);
|
|
50
|
-
eventSource.onDictionaryChange = (dictionary) => writeDictionary(dictionary, configuration);
|
|
51
|
-
eventSource.onDictionaryDeleted = (dictionary) => writeDictionary(dictionary, configuration);
|
|
52
|
-
return eventSource;
|
|
53
|
-
};
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
checkDictionaryChanges
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=checkDictionaryChanges.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/checkDictionaryChanges.ts"],"sourcesContent":["import { IntlayerEventListener } from '@intlayer/api';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport {\n getAppLogger,\n getConfiguration,\n IntlayerConfig,\n} from '@intlayer/config';\nimport { buildIntlayerDictionary } from './transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary';\n\nconst writeDictionary = async (\n dictionary: DictionaryAPI,\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n appLogger(`Writing dictionary ${dictionary.key}`);\n await buildIntlayerDictionary([dictionary]);\n};\n\nexport const checkDictionaryChanges = async () => {\n const configuration = getConfiguration();\n const appLogger = getAppLogger(configuration);\n\n const { editor } = configuration;\n\n if (!editor.hotReload) return;\n if (!editor.clientId) return;\n if (!editor.clientSecret) return;\n\n const eventSource = new IntlayerEventListener(configuration);\n\n try {\n await eventSource.initialize().then(() => {\n appLogger('Connected to Intlayer. Hot reload enabled');\n });\n } catch (error) {\n appLogger('Error initializing IntlayerEventListener:', {\n level: 'error',\n });\n }\n\n eventSource.onDictionaryAdded = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventSource.onDictionaryChange = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventSource.onDictionaryDeleted = (dictionary) =>\n writeDictionary(dictionary, configuration);\n\n return eventSource;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAsC;AAGtC,oBAIO;AACP,qCAAwC;AAExC,MAAM,kBAAkB,OACtB,YACA,kBACG;AACH,QAAM,gBAAY,4BAAa,aAAa;AAC5C,YAAU,sBAAsB,WAAW,GAAG,EAAE;AAChD,YAAM,wDAAwB,CAAC,UAAU,CAAC;AAC5C;AAEO,MAAM,yBAAyB,YAAY;AAChD,QAAM,oBAAgB,gCAAiB;AACvC,QAAM,gBAAY,4BAAa,aAAa;AAE5C,QAAM,EAAE,OAAO,IAAI;AAEnB,MAAI,CAAC,OAAO,UAAW;AACvB,MAAI,CAAC,OAAO,SAAU;AACtB,MAAI,CAAC,OAAO,aAAc;AAE1B,QAAM,cAAc,IAAI,iCAAsB,aAAa;AAE3D,MAAI;AACF,UAAM,YAAY,WAAW,EAAE,KAAK,MAAM;AACxC,gBAAU,2CAA2C;AAAA,IACvD,CAAC;AAAA,EACH,SAAS,OAAO;AACd,cAAU,6CAA6C;AAAA,MACrD,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,cAAY,oBAAoB,CAAC,eAC/B,gBAAgB,YAAY,aAAa;AAC3C,cAAY,qBAAqB,CAAC,eAChC,gBAAgB,YAAY,aAAa;AAC3C,cAAY,sBAAsB,CAAC,eACjC,gBAAgB,YAAY,aAAa;AAE3C,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fetchDistantDictionaryKeys.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeys = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<string[]> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, configuration);\n\n const oAuth2TokenResult = await intlayerAPI.oAuth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesKeys({\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n });\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesKeys: string[] = getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesKeys;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA+B;AAC/B,oBAAsD;AAE/C,MAAM,6BAA6B,OACxC,oBAAgC,gCAAiB,MAC3B;AACtB,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kBAAc,2BAAe,QAAW,aAAa;AAE3D,QAAM,oBAAoB,MAAM,YAAY,MAAM,qBAAqB;AAEvE,QAAM,oBAAoB,kBAAkB,MAAM;AAGlD,QAAM,4BACJ,MAAM,YAAY,WAAW,oBAAoB;AAAA,IAC/C,GAAI,qBAAqB;AAAA,MACvB,SAAS;AAAA,QACP,eAAe,UAAU,iBAAiB;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AAEH,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,0BAAoC,0BAA0B;AAGpE,SAAO;AACT;","names":[]}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getFilteredLocalesContent_exports = {};
|
|
20
|
-
__export(getFilteredLocalesContent_exports, {
|
|
21
|
-
getFilteredLocalesContent: () => getFilteredLocalesContent
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getFilteredLocalesContent_exports);
|
|
24
|
-
var import_core = require("@intlayer/core");
|
|
25
|
-
const filterTranlationsPlugin = (locales, fallback = void 0) => ({
|
|
26
|
-
id: "filter-translations-plugin",
|
|
27
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType === import_core.NodeType.Translation,
|
|
28
|
-
transform: (node, props, deepTransformNode2) => {
|
|
29
|
-
const translationMap = node.translation;
|
|
30
|
-
const localesArray = Array.isArray(locales) ? locales : [locales];
|
|
31
|
-
const isSingleLocale = localesArray.length === 1;
|
|
32
|
-
if (isSingleLocale) {
|
|
33
|
-
let content = translationMap[localesArray[0]];
|
|
34
|
-
if (typeof content === "undefined" && fallback) {
|
|
35
|
-
content = translationMap[fallback];
|
|
36
|
-
}
|
|
37
|
-
return deepTransformNode2(content, props);
|
|
38
|
-
}
|
|
39
|
-
const filteredTranslationMap = Object.fromEntries(
|
|
40
|
-
Object.entries(translationMap).filter(
|
|
41
|
-
([key]) => locales.includes(key)
|
|
42
|
-
)
|
|
43
|
-
);
|
|
44
|
-
return {
|
|
45
|
-
...node,
|
|
46
|
-
translation: deepTransformNode2(filteredTranslationMap, {
|
|
47
|
-
...props,
|
|
48
|
-
keyPath: [
|
|
49
|
-
...props.keyPath,
|
|
50
|
-
{ type: import_core.NodeType.Object, key: import_core.NodeType.Translation }
|
|
51
|
-
]
|
|
52
|
-
})
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
const getFilteredLocalesContent = (node, locale, nodeProps, fallback) => {
|
|
57
|
-
const plugins = [
|
|
58
|
-
filterTranlationsPlugin(locale, fallback),
|
|
59
|
-
...nodeProps.plugins ?? []
|
|
60
|
-
];
|
|
61
|
-
return (0, import_core.deepTransformNode)(node, {
|
|
62
|
-
...nodeProps,
|
|
63
|
-
plugins
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
-
0 && (module.exports = {
|
|
68
|
-
getFilteredLocalesContent
|
|
69
|
-
});
|
|
70
|
-
//# sourceMappingURL=getFilteredLocalesContent.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getFilteredLocalesContent.ts"],"sourcesContent":["import type { Locales, LocalesValues } from '@intlayer/config/client';\nimport {\n ContentNode,\n deepTransformNode,\n NodeType,\n type NodeProps,\n type Plugins,\n} from '@intlayer/core';\n\nconst filterTranlationsPlugin = (\n locales: LocalesValues[] | LocalesValues,\n fallback: LocalesValues | undefined = undefined // fallback mean that if field is not translated, it will use the default locale,\n): Plugins => ({\n id: 'filter-translations-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node, props, deepTransformNode) => {\n const translationMap = node.translation as Record<Locales, string>;\n\n const localesArray = Array.isArray(locales) ? locales : [locales];\n const isSingleLocale = localesArray.length === 1;\n\n if (isSingleLocale) {\n let content = translationMap[localesArray[0] as Locales];\n\n if (typeof content === 'undefined' && fallback) {\n content = translationMap[fallback as Locales];\n }\n\n return deepTransformNode(content, props);\n }\n\n const filteredTranslationMap = Object.fromEntries(\n Object.entries(translationMap).filter(([key]) =>\n locales.includes(key as Locales)\n )\n );\n\n return {\n ...node,\n translation: deepTransformNode(filteredTranslationMap, {\n ...props,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Object, key: NodeType.Translation },\n ],\n }),\n };\n },\n});\n\nexport const getFilteredLocalesContent = (\n node: ContentNode,\n locale: LocalesValues | LocalesValues[],\n nodeProps: NodeProps,\n fallback?: LocalesValues // fallback mean that if field is not translated, it will use the default locale,\n) => {\n const plugins: Plugins[] = [\n filterTranlationsPlugin(locale, fallback),\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAMO;AAEP,MAAM,0BAA0B,CAC9B,SACA,WAAsC,YACzB;AAAA,EACb,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,qBAAS;AAAA,EAC1D,WAAW,CAAC,MAAM,OAAOA,uBAAsB;AAC7C,UAAM,iBAAiB,KAAK;AAE5B,UAAM,eAAe,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO;AAChE,UAAM,iBAAiB,aAAa,WAAW;AAE/C,QAAI,gBAAgB;AAClB,UAAI,UAAU,eAAe,aAAa,CAAC,CAAY;AAEvD,UAAI,OAAO,YAAY,eAAe,UAAU;AAC9C,kBAAU,eAAe,QAAmB;AAAA,MAC9C;AAEA,aAAOA,mBAAkB,SAAS,KAAK;AAAA,IACzC;AAEA,UAAM,yBAAyB,OAAO;AAAA,MACpC,OAAO,QAAQ,cAAc,EAAE;AAAA,QAAO,CAAC,CAAC,GAAG,MACzC,QAAQ,SAAS,GAAc;AAAA,MACjC;AAAA,IACF;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,aAAaA,mBAAkB,wBAAwB;AAAA,QACrD,GAAG;AAAA,QACH,SAAS;AAAA,UACP,GAAG,MAAM;AAAA,UACT,EAAE,MAAM,qBAAS,QAAQ,KAAK,qBAAS,YAAY;AAAA,QACrD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,4BAA4B,CACvC,MACA,QACA,WACA,aACG;AACH,QAAM,UAAqB;AAAA,IACzB,wBAAwB,QAAQ,QAAQ;AAAA,IACxC,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,aAAO,+BAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":["deepTransformNode"]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var loadDistantDictionaries_exports = {};
|
|
20
|
-
__export(loadDistantDictionaries_exports, {
|
|
21
|
-
loadDistantDictionaries: () => loadDistantDictionaries
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(loadDistantDictionaries_exports);
|
|
24
|
-
var import_fetchDistantDictionaries = require('../fetchDistantDictionaries.cjs');
|
|
25
|
-
const formatDistantDictionaries = (dictionaries) => {
|
|
26
|
-
return dictionaries.map((dict) => ({
|
|
27
|
-
...dict,
|
|
28
|
-
location: "distant"
|
|
29
|
-
}));
|
|
30
|
-
};
|
|
31
|
-
const loadDistantDictionaries = async (options) => {
|
|
32
|
-
try {
|
|
33
|
-
const distantDictionaries = await (0, import_fetchDistantDictionaries.fetchDistantDictionaries)(options);
|
|
34
|
-
return formatDistantDictionaries(distantDictionaries);
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error(error);
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
loadDistantDictionaries
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=loadDistantDictionaries.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/loadDictionaries/loadDistantDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { fetchDistantDictionaries } from '../fetchDistantDictionaries';\n\ntype LoadDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n};\n\nconst formatDistantDictionaries = (dictionaries: DictionaryAPI[]) => {\n return dictionaries.map((dict) => ({\n ...dict,\n location: 'distant' as const,\n }));\n};\n\nexport const loadDistantDictionaries = async (\n options: LoadDistantDictionariesOptions\n): Promise<DictionaryAPI[]> => {\n try {\n const distantDictionaries = await fetchDistantDictionaries(options);\n\n return formatDistantDictionaries(distantDictionaries);\n } catch (error) {\n console.error(error);\n return [];\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sCAAyC;AAOzC,MAAM,4BAA4B,CAAC,iBAAkC;AACnE,SAAO,aAAa,IAAI,CAAC,UAAU;AAAA,IACjC,GAAG;AAAA,IACH,UAAU;AAAA,EACZ,EAAE;AACJ;AAEO,MAAM,0BAA0B,OACrC,YAC6B;AAC7B,MAAI;AACF,UAAM,sBAAsB,UAAM,0DAAyB,OAAO;AAElE,WAAO,0BAA0B,mBAAmB;AAAA,EACtD,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AACnB,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
|
package/dist/cjs/log.cjs
DELETED
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var log_exports = {};
|
|
30
|
-
__export(log_exports, {
|
|
31
|
-
logger: () => logger
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(log_exports);
|
|
34
|
-
var import_config = require("@intlayer/config");
|
|
35
|
-
var import_readline = __toESM(require("readline"));
|
|
36
|
-
var import_sortAlphabetically = require('./utils/sortAlphabetically.cjs');
|
|
37
|
-
const LINE_DETECTOR = "\u200B\u200B\u200B";
|
|
38
|
-
const SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
39
|
-
const RESET = "\x1B[0m";
|
|
40
|
-
const GREEN = "\x1B[32m";
|
|
41
|
-
const RED = "\x1B[31m";
|
|
42
|
-
const BLUE = "\x1B[34m";
|
|
43
|
-
const GREY = "\x1B[90m";
|
|
44
|
-
const GREY_DARK = "\x1B[90m";
|
|
45
|
-
class Logger {
|
|
46
|
-
dictionariesStatuses = [];
|
|
47
|
-
spinnerTimer = null;
|
|
48
|
-
maxDictionaryKeyLength = 0;
|
|
49
|
-
previousLineCount = 0;
|
|
50
|
-
lineDifCounter = 0;
|
|
51
|
-
originalStdoutWrite = null;
|
|
52
|
-
extraLines = 0;
|
|
53
|
-
isUpdating = false;
|
|
54
|
-
config;
|
|
55
|
-
// Singleton instance
|
|
56
|
-
static instance;
|
|
57
|
-
constructor() {
|
|
58
|
-
}
|
|
59
|
-
static getInstance() {
|
|
60
|
-
if (!Logger.instance) {
|
|
61
|
-
Logger.instance = new Logger();
|
|
62
|
-
}
|
|
63
|
-
return Logger.instance;
|
|
64
|
-
}
|
|
65
|
-
init(localDictionariesKeys, distantDictionariesKeys, configuration = (0, import_config.getConfiguration)()) {
|
|
66
|
-
this.config = configuration;
|
|
67
|
-
const allKeys = Array.from(
|
|
68
|
-
new Set(
|
|
69
|
-
[...localDictionariesKeys, ...distantDictionariesKeys].sort(
|
|
70
|
-
import_sortAlphabetically.sortAlphabetically
|
|
71
|
-
)
|
|
72
|
-
)
|
|
73
|
-
);
|
|
74
|
-
this.maxDictionaryKeyLength = allKeys.reduce(
|
|
75
|
-
(max, key) => key.length > max ? key.length : max,
|
|
76
|
-
0
|
|
77
|
-
);
|
|
78
|
-
this.dictionariesStatuses = allKeys.map((dictionaryKey) => {
|
|
79
|
-
const states = [];
|
|
80
|
-
if (localDictionariesKeys.includes(dictionaryKey)) {
|
|
81
|
-
states.push({
|
|
82
|
-
type: "local",
|
|
83
|
-
status: "pending",
|
|
84
|
-
spinnerFrameIndex: 0
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
if (distantDictionariesKeys.includes(dictionaryKey)) {
|
|
88
|
-
states.push({
|
|
89
|
-
type: "distant",
|
|
90
|
-
status: "pending",
|
|
91
|
-
spinnerFrameIndex: 0
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
dictionaryKey,
|
|
96
|
-
state: states
|
|
97
|
-
};
|
|
98
|
-
});
|
|
99
|
-
this.startSpinner();
|
|
100
|
-
this.updateAllStatusLines();
|
|
101
|
-
}
|
|
102
|
-
// New method to add dictionary keys after initialization
|
|
103
|
-
addDictionaryKeys(type, dictionaryKeys) {
|
|
104
|
-
for (const dictionaryKey of dictionaryKeys) {
|
|
105
|
-
if (dictionaryKey.length > this.maxDictionaryKeyLength) {
|
|
106
|
-
this.maxDictionaryKeyLength = dictionaryKey.length;
|
|
107
|
-
}
|
|
108
|
-
let statusObj = this.dictionariesStatuses.find(
|
|
109
|
-
(ds) => ds.dictionaryKey === dictionaryKey
|
|
110
|
-
);
|
|
111
|
-
if (!statusObj) {
|
|
112
|
-
statusObj = {
|
|
113
|
-
dictionaryKey,
|
|
114
|
-
state: []
|
|
115
|
-
};
|
|
116
|
-
this.dictionariesStatuses.push(statusObj);
|
|
117
|
-
const newState = {
|
|
118
|
-
type,
|
|
119
|
-
status: "pending",
|
|
120
|
-
spinnerFrameIndex: 0
|
|
121
|
-
};
|
|
122
|
-
statusObj.state.push(newState);
|
|
123
|
-
} else {
|
|
124
|
-
const existingState = statusObj.state.find((s) => s.type === type);
|
|
125
|
-
if (!existingState) {
|
|
126
|
-
const newState = {
|
|
127
|
-
type,
|
|
128
|
-
status: "pending",
|
|
129
|
-
spinnerFrameIndex: 0
|
|
130
|
-
};
|
|
131
|
-
statusObj.state.push(newState);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
this.updateAllStatusLines();
|
|
136
|
-
}
|
|
137
|
-
startSpinner() {
|
|
138
|
-
if (!this.spinnerTimer) {
|
|
139
|
-
this.spinnerTimer = setInterval(() => {
|
|
140
|
-
this.updateAllStatusLines();
|
|
141
|
-
}, 100);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
stopSpinner() {
|
|
145
|
-
if (this.spinnerTimer) {
|
|
146
|
-
clearInterval(this.spinnerTimer);
|
|
147
|
-
this.spinnerTimer = null;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// Method to update the terminal output
|
|
151
|
-
updateOutput(content) {
|
|
152
|
-
if (this.config?.log.mode !== "verbose") return;
|
|
153
|
-
if (!this.originalStdoutWrite) {
|
|
154
|
-
this.originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
155
|
-
this.extraLines = 0;
|
|
156
|
-
const write = (chunk, encoding, callback) => {
|
|
157
|
-
const str = typeof chunk === "string" ? chunk : chunk.toString();
|
|
158
|
-
const newLines = (str.match(/\n/g) ?? []).length;
|
|
159
|
-
if (!this.isUpdating) {
|
|
160
|
-
this.extraLines += newLines;
|
|
161
|
-
}
|
|
162
|
-
return this.originalStdoutWrite(chunk, encoding, callback);
|
|
163
|
-
};
|
|
164
|
-
process.stdout.write = write;
|
|
165
|
-
}
|
|
166
|
-
this.isUpdating = true;
|
|
167
|
-
const contentLines = content.split("\n");
|
|
168
|
-
const indexOfLineDetector = contentLines.indexOf(LINE_DETECTOR.trim());
|
|
169
|
-
if (indexOfLineDetector > 0) {
|
|
170
|
-
this.lineDifCounter = indexOfLineDetector;
|
|
171
|
-
} else {
|
|
172
|
-
this.lineDifCounter = 0;
|
|
173
|
-
}
|
|
174
|
-
const totalLinesToMoveUp = this.previousLineCount + this.lineDifCounter + this.extraLines;
|
|
175
|
-
import_readline.default.moveCursor(process.stdout, 0, -totalLinesToMoveUp);
|
|
176
|
-
import_readline.default.clearScreenDown(process.stdout);
|
|
177
|
-
contentLines.forEach((line) => {
|
|
178
|
-
process.stdout.write(`${line}\x1B[K
|
|
179
|
-
`);
|
|
180
|
-
});
|
|
181
|
-
this.previousLineCount = contentLines.length;
|
|
182
|
-
this.extraLines = 0;
|
|
183
|
-
this.isUpdating = false;
|
|
184
|
-
}
|
|
185
|
-
stop() {
|
|
186
|
-
this.stopSpinner();
|
|
187
|
-
}
|
|
188
|
-
updateStatus(dictionaries) {
|
|
189
|
-
for (const { dictionaryKey, type, status } of dictionaries) {
|
|
190
|
-
const statusObj = this.dictionariesStatuses.find(
|
|
191
|
-
(ds) => ds.dictionaryKey === dictionaryKey
|
|
192
|
-
);
|
|
193
|
-
if (statusObj) {
|
|
194
|
-
const state = statusObj.state.find((s) => s.type === type);
|
|
195
|
-
if (state) {
|
|
196
|
-
Object.assign(state, status);
|
|
197
|
-
} else {
|
|
198
|
-
if (status.status === void 0) {
|
|
199
|
-
status.status = "pending";
|
|
200
|
-
}
|
|
201
|
-
const newState = {
|
|
202
|
-
type,
|
|
203
|
-
status: status.status,
|
|
204
|
-
icon: status.icon ?? "",
|
|
205
|
-
error: status.error,
|
|
206
|
-
errorMessage: status.errorMessage,
|
|
207
|
-
spinnerFrameIndex: status.spinnerFrameIndex ?? 0
|
|
208
|
-
};
|
|
209
|
-
statusObj.state.push(newState);
|
|
210
|
-
}
|
|
211
|
-
} else {
|
|
212
|
-
const newState = {
|
|
213
|
-
type,
|
|
214
|
-
status: status.status ?? "pending",
|
|
215
|
-
icon: status.icon ?? "",
|
|
216
|
-
error: status.error,
|
|
217
|
-
errorMessage: status.errorMessage,
|
|
218
|
-
spinnerFrameIndex: status.spinnerFrameIndex ?? 0
|
|
219
|
-
};
|
|
220
|
-
this.dictionariesStatuses.push({
|
|
221
|
-
dictionaryKey,
|
|
222
|
-
state: [newState]
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
this.updateAllStatusLines();
|
|
227
|
-
}
|
|
228
|
-
getStatusIcon(status) {
|
|
229
|
-
const statusIcons = {
|
|
230
|
-
pending: "\u23F2",
|
|
231
|
-
fetching: "",
|
|
232
|
-
// Spinner handled separately
|
|
233
|
-
built: "\u2714",
|
|
234
|
-
imported: "\u2714",
|
|
235
|
-
error: "\u2716"
|
|
236
|
-
};
|
|
237
|
-
return statusIcons[status] ?? "";
|
|
238
|
-
}
|
|
239
|
-
getStatusLine(statusObj) {
|
|
240
|
-
const keyPadding = this.maxDictionaryKeyLength - statusObj.dictionaryKey.length;
|
|
241
|
-
const paddedKey = `${statusObj.dictionaryKey}${" ".repeat(keyPadding)}`;
|
|
242
|
-
const states = statusObj.state.map((state) => {
|
|
243
|
-
let colorStart = "";
|
|
244
|
-
let colorEnd = "";
|
|
245
|
-
let icon = this.getStatusIcon(state.status);
|
|
246
|
-
if (state.status === "fetching") {
|
|
247
|
-
icon = SPINNER_FRAMES[state.spinnerFrameIndex % SPINNER_FRAMES.length];
|
|
248
|
-
colorStart = BLUE;
|
|
249
|
-
colorEnd = RESET;
|
|
250
|
-
} else if (state.status === "error") {
|
|
251
|
-
colorStart = RED;
|
|
252
|
-
colorEnd = RESET;
|
|
253
|
-
} else if (state.status === "imported" || state.status === "built") {
|
|
254
|
-
colorStart = GREEN;
|
|
255
|
-
colorEnd = RESET;
|
|
256
|
-
} else {
|
|
257
|
-
colorStart = GREY;
|
|
258
|
-
colorEnd = RESET;
|
|
259
|
-
}
|
|
260
|
-
const statusBlock = `${GREY_DARK}[${state.type}: ${colorStart}${icon} ${state.status}${GREY_DARK}]${colorEnd}`;
|
|
261
|
-
return `${colorStart}${statusBlock}${colorEnd}`;
|
|
262
|
-
});
|
|
263
|
-
return `${this.config?.log.prefix}- ${paddedKey} ${states.join(" ")}`;
|
|
264
|
-
}
|
|
265
|
-
// Replace logUpdate calls with your custom methods
|
|
266
|
-
updateAllStatusLines() {
|
|
267
|
-
const terminalHeight = process.stdout.rows;
|
|
268
|
-
const maxVisibleLines = terminalHeight - 1;
|
|
269
|
-
const lines = this.dictionariesStatuses.map((statusObj) => {
|
|
270
|
-
statusObj.state.forEach((state) => {
|
|
271
|
-
if (state.status === "fetching") {
|
|
272
|
-
state.spinnerFrameIndex = (state.spinnerFrameIndex + 1) % SPINNER_FRAMES.length;
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
return this.getStatusLine(statusObj);
|
|
276
|
-
});
|
|
277
|
-
let content;
|
|
278
|
-
if (lines.length > maxVisibleLines) {
|
|
279
|
-
const visibleLines = lines.slice(0, maxVisibleLines - 5);
|
|
280
|
-
const summary = `${this.config?.log.prefix}... and ${lines.length - visibleLines.length} more`;
|
|
281
|
-
content = LINE_DETECTOR + visibleLines.join("\n") + "\n" + summary;
|
|
282
|
-
} else {
|
|
283
|
-
content = lines.join("\n");
|
|
284
|
-
}
|
|
285
|
-
this.updateOutput(content);
|
|
286
|
-
}
|
|
287
|
-
getStatuses() {
|
|
288
|
-
return this.dictionariesStatuses;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
const logger = Logger.getInstance();
|
|
292
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
293
|
-
0 && (module.exports = {
|
|
294
|
-
logger
|
|
295
|
-
});
|
|
296
|
-
//# sourceMappingURL=log.cjs.map
|
package/dist/cjs/log.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/log.ts"],"sourcesContent":["import { type IntlayerConfig, getConfiguration } from '@intlayer/config';\nimport readline from 'readline';\nimport { sortAlphabetically } from './utils/sortAlphabetically';\n\nexport type State = {\n type: 'local' | 'distant';\n status: 'pending' | 'fetching' | 'fetched' | 'error' | 'imported' | 'built';\n icon?: string;\n error?: Error;\n errorMessage?: string;\n spinnerFrameIndex?: number;\n};\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n state: State[];\n};\n\nconst LINE_DETECTOR = '\\u200B\\u200B\\u200B'; // Three zero-width spaces\nconst SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\n// ANSI color codes\nconst RESET = '\\x1b[0m';\nconst GREEN = '\\x1b[32m';\nconst RED = '\\x1b[31m';\nconst BLUE = '\\x1b[34m';\nconst GREY = '\\x1b[90m';\nconst GREY_DARK = '\\x1b[90m';\n\nclass Logger {\n private dictionariesStatuses: DictionariesStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private maxDictionaryKeyLength: number = 0;\n private previousLineCount: number = 0;\n private lineDifCounter: number = 0;\n private originalStdoutWrite:\n | ((\n chunk: string | Uint8Array, // `chunk` can be either a string or a Uint8Array\n encoding?: BufferEncoding, // `encoding` is optional and should be a BufferEncoding\n callback?: (err?: Error | null) => void // `callback` is optional and a function\n ) => boolean)\n | null = null;\n private extraLines: number = 0;\n private isUpdating: boolean = false;\n private config?: IntlayerConfig;\n\n // Singleton instance\n private static instance: Logger;\n\n private constructor() {}\n\n public static getInstance(): Logger {\n if (!Logger.instance) {\n Logger.instance = new Logger();\n }\n return Logger.instance;\n }\n\n public init(\n localDictionariesKeys: string[],\n distantDictionariesKeys: string[],\n configuration: IntlayerConfig = getConfiguration()\n ) {\n this.config = configuration;\n\n const allKeys = Array.from(\n new Set(\n [...localDictionariesKeys, ...distantDictionariesKeys].sort(\n sortAlphabetically\n )\n )\n );\n\n this.maxDictionaryKeyLength = allKeys.reduce(\n (max, key) => (key.length > max ? key.length : max),\n 0\n );\n\n this.dictionariesStatuses = allKeys.map((dictionaryKey) => {\n const states: State[] = [];\n\n if (localDictionariesKeys.includes(dictionaryKey)) {\n states.push({\n type: 'local',\n status: 'pending',\n spinnerFrameIndex: 0,\n });\n }\n if (distantDictionariesKeys.includes(dictionaryKey)) {\n states.push({\n type: 'distant',\n status: 'pending',\n spinnerFrameIndex: 0,\n });\n }\n\n return {\n dictionaryKey,\n state: states,\n };\n });\n\n // Start spinner timer\n this.startSpinner();\n\n // Update all status lines (this will output the initial statuses)\n this.updateAllStatusLines();\n }\n\n // New method to add dictionary keys after initialization\n public addDictionaryKeys(\n type: 'local' | 'distant',\n dictionaryKeys: string[]\n ) {\n for (const dictionaryKey of dictionaryKeys) {\n // Update maxDictionaryKeyLength if the new key is longer\n if (dictionaryKey.length > this.maxDictionaryKeyLength) {\n this.maxDictionaryKeyLength = dictionaryKey.length;\n }\n\n let statusObj = this.dictionariesStatuses.find(\n (ds) => ds.dictionaryKey === dictionaryKey\n );\n\n if (!statusObj) {\n // If the dictionaryKey doesn't exist yet, create a new DictionariesStatus\n\n statusObj = {\n dictionaryKey,\n state: [],\n };\n this.dictionariesStatuses.push(statusObj);\n\n const newState: State = {\n type,\n status: 'pending',\n spinnerFrameIndex: 0,\n };\n statusObj.state.push(newState);\n } else {\n const existingState = statusObj.state.find((s) => s.type === type);\n if (!existingState) {\n // Add new state for the type\n\n const newState: State = {\n type,\n status: 'pending',\n spinnerFrameIndex: 0,\n };\n statusObj.state.push(newState);\n }\n }\n }\n\n // Call updateAllStatusLines() to refresh the output\n this.updateAllStatusLines();\n }\n\n private startSpinner() {\n if (!this.spinnerTimer) {\n this.spinnerTimer = setInterval(() => {\n this.updateAllStatusLines();\n }, 100); // Update every 100ms\n }\n }\n\n private stopSpinner() {\n if (this.spinnerTimer) {\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n }\n\n // Method to update the terminal output\n private updateOutput(content: string) {\n if (this.config?.log.mode !== 'verbose') return;\n\n // Monkey-patch process.stdout.write to keep track of extra lines\n if (!this.originalStdoutWrite) {\n this.originalStdoutWrite = process.stdout.write.bind(process.stdout);\n this.extraLines = 0;\n\n const write = (\n chunk: string | Uint8Array, // `chunk` can be either a string or a Uint8Array\n encoding?: BufferEncoding, // `encoding` is optional and should be a BufferEncoding\n callback?: (err?: Error | null) => void // `callback` is optional and a function\n ) => {\n const str = typeof chunk === 'string' ? chunk : chunk.toString();\n const newLines = (str.match(/\\n/g) ?? []).length;\n\n // If the write is not initiated by Logger's updateOutput method\n if (!this.isUpdating) {\n this.extraLines += newLines;\n }\n\n return this.originalStdoutWrite!(chunk, encoding, callback);\n };\n\n process.stdout.write = write as typeof process.stdout.write;\n }\n\n // Set a flag to indicate that updateOutput is running\n this.isUpdating = true;\n\n // Adjust lineDifCounter if LINE_DETECTOR is not the first line\n const contentLines = content.split('\\n');\n const indexOfLineDetector = contentLines.indexOf(LINE_DETECTOR.trim());\n\n if (indexOfLineDetector > 0) {\n // LINE_DETECTOR is not at the first line\n this.lineDifCounter = indexOfLineDetector;\n } else {\n this.lineDifCounter = 0;\n }\n\n // Calculate total lines to move up\n const totalLinesToMoveUp =\n this.previousLineCount + this.lineDifCounter + this.extraLines;\n\n // Move cursor up by totalLinesToMoveUp\n readline.moveCursor(process.stdout, 0, -totalLinesToMoveUp);\n\n // Clear all lines downwards\n readline.clearScreenDown(process.stdout);\n\n // Write the updated content\n contentLines.forEach((line) => {\n process.stdout.write(`${line}\\x1b[K\\n`);\n });\n\n // Update previousLineCount\n this.previousLineCount = contentLines.length;\n\n // Reset extraLines counter and updating flag\n this.extraLines = 0;\n this.isUpdating = false;\n }\n\n public stop() {\n this.stopSpinner();\n }\n\n public updateStatus(\n dictionaries: {\n dictionaryKey: string;\n type: 'local' | 'distant';\n status: Partial<State>;\n }[]\n ) {\n for (const { dictionaryKey, type, status } of dictionaries) {\n const statusObj = this.dictionariesStatuses.find(\n (ds) => ds.dictionaryKey === dictionaryKey\n );\n if (statusObj) {\n const state = statusObj.state.find((s) => s.type === type);\n if (state) {\n // Update existing state\n Object.assign(state, status);\n } else {\n // If the state for this type doesn't exist yet, add it\n if (status.status === undefined) {\n status.status = 'pending'; // Provide default status\n }\n const newState: State = {\n type,\n status: status.status,\n icon: status.icon ?? '',\n error: status.error,\n errorMessage: status.errorMessage,\n spinnerFrameIndex: status.spinnerFrameIndex ?? 0,\n };\n statusObj.state.push(newState);\n }\n } else {\n // If the status object doesn't exist, create it\n const newState: State = {\n type,\n status: status.status ?? 'pending',\n icon: status.icon ?? '',\n error: status.error,\n errorMessage: status.errorMessage,\n spinnerFrameIndex: status.spinnerFrameIndex ?? 0,\n };\n this.dictionariesStatuses.push({\n dictionaryKey,\n state: [newState],\n });\n }\n }\n\n // Update the display after status change\n this.updateAllStatusLines();\n }\n\n private getStatusIcon(status: string): string {\n const statusIcons: Record<string, string> = {\n pending: '⏲',\n fetching: '', // Spinner handled separately\n built: '✔',\n imported: '✔',\n error: '✖',\n };\n return statusIcons[status] ?? '';\n }\n\n private getStatusLine(statusObj: DictionariesStatus): string {\n const keyPadding =\n this.maxDictionaryKeyLength - statusObj.dictionaryKey.length;\n const paddedKey = `${statusObj.dictionaryKey}${' '.repeat(keyPadding)}`;\n\n const states = statusObj.state.map((state) => {\n let colorStart = '';\n let colorEnd = '';\n let icon = this.getStatusIcon(state.status);\n if (state.status === 'fetching') {\n // Use spinner frame\n icon = SPINNER_FRAMES[state.spinnerFrameIndex! % SPINNER_FRAMES.length];\n colorStart = BLUE;\n colorEnd = RESET;\n } else if (state.status === 'error') {\n colorStart = RED;\n colorEnd = RESET;\n } else if (state.status === 'imported' || state.status === 'built') {\n colorStart = GREEN;\n colorEnd = RESET;\n } else {\n colorStart = GREY;\n colorEnd = RESET;\n }\n\n // Format the status block\n const statusBlock = `${GREY_DARK}[${state.type}: ${colorStart}${icon} ${state.status}${GREY_DARK}]${colorEnd}`;\n\n return `${colorStart}${statusBlock}${colorEnd}`;\n });\n\n return `${this.config?.log.prefix}- ${paddedKey} ${states.join(' ')}`;\n }\n\n // Replace logUpdate calls with your custom methods\n private updateAllStatusLines() {\n const terminalHeight = process.stdout.rows;\n const maxVisibleLines = terminalHeight - 1;\n\n const lines = this.dictionariesStatuses.map((statusObj) => {\n statusObj.state.forEach((state) => {\n if (state.status === 'fetching') {\n // Update spinner frame\n state.spinnerFrameIndex =\n (state.spinnerFrameIndex! + 1) % SPINNER_FRAMES.length;\n }\n });\n return this.getStatusLine(statusObj);\n });\n\n let content;\n\n if (lines.length > maxVisibleLines) {\n const visibleLines = lines.slice(0, maxVisibleLines - 5);\n const summary = `${this.config?.log.prefix}... and ${lines.length - visibleLines.length} more`;\n content = LINE_DETECTOR + visibleLines.join('\\n') + '\\n' + summary;\n } else {\n content = lines.join('\\n');\n }\n\n this.updateOutput(content);\n }\n\n public getStatuses() {\n return this.dictionariesStatuses;\n }\n}\n\nexport const logger = Logger.getInstance();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAsD;AACtD,sBAAqB;AACrB,gCAAmC;AAgBnC,MAAM,gBAAgB;AACtB,MAAM,iBAAiB,CAAC,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,QAAG;AAGxE,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,YAAY;AAElB,MAAM,OAAO;A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