@intlayer/chokidar 5.8.1 → 6.0.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/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} +11 -19
- 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 +13 -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 +108 -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/dictionaryStatus.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 +6 -2
- 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/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs +21 -0
- 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 +10 -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 +73 -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 +6 -2
- 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 +4 -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/dictionaryStatus.d.ts +1 -1
- package/dist/types/writeContentDeclaration/dictionaryStatus.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 +17 -15
- 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 +0 -29
- 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
package/dist/esm/log.mjs
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { getConfiguration } from "@intlayer/config";
|
|
2
|
-
import readline from "readline";
|
|
3
|
-
import { sortAlphabetically } from "./utils/sortAlphabetically.mjs";
|
|
4
|
-
const LINE_DETECTOR = "\u200B\u200B\u200B";
|
|
5
|
-
const SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
6
|
-
const RESET = "\x1B[0m";
|
|
7
|
-
const GREEN = "\x1B[32m";
|
|
8
|
-
const RED = "\x1B[31m";
|
|
9
|
-
const BLUE = "\x1B[34m";
|
|
10
|
-
const GREY = "\x1B[90m";
|
|
11
|
-
const GREY_DARK = "\x1B[90m";
|
|
12
|
-
class Logger {
|
|
13
|
-
dictionariesStatuses = [];
|
|
14
|
-
spinnerTimer = null;
|
|
15
|
-
maxDictionaryKeyLength = 0;
|
|
16
|
-
previousLineCount = 0;
|
|
17
|
-
lineDifCounter = 0;
|
|
18
|
-
originalStdoutWrite = null;
|
|
19
|
-
extraLines = 0;
|
|
20
|
-
isUpdating = false;
|
|
21
|
-
config;
|
|
22
|
-
// Singleton instance
|
|
23
|
-
static instance;
|
|
24
|
-
constructor() {
|
|
25
|
-
}
|
|
26
|
-
static getInstance() {
|
|
27
|
-
if (!Logger.instance) {
|
|
28
|
-
Logger.instance = new Logger();
|
|
29
|
-
}
|
|
30
|
-
return Logger.instance;
|
|
31
|
-
}
|
|
32
|
-
init(localDictionariesKeys, distantDictionariesKeys, configuration = getConfiguration()) {
|
|
33
|
-
this.config = configuration;
|
|
34
|
-
const allKeys = Array.from(
|
|
35
|
-
new Set(
|
|
36
|
-
[...localDictionariesKeys, ...distantDictionariesKeys].sort(
|
|
37
|
-
sortAlphabetically
|
|
38
|
-
)
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
this.maxDictionaryKeyLength = allKeys.reduce(
|
|
42
|
-
(max, key) => key.length > max ? key.length : max,
|
|
43
|
-
0
|
|
44
|
-
);
|
|
45
|
-
this.dictionariesStatuses = allKeys.map((dictionaryKey) => {
|
|
46
|
-
const states = [];
|
|
47
|
-
if (localDictionariesKeys.includes(dictionaryKey)) {
|
|
48
|
-
states.push({
|
|
49
|
-
type: "local",
|
|
50
|
-
status: "pending",
|
|
51
|
-
spinnerFrameIndex: 0
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
if (distantDictionariesKeys.includes(dictionaryKey)) {
|
|
55
|
-
states.push({
|
|
56
|
-
type: "distant",
|
|
57
|
-
status: "pending",
|
|
58
|
-
spinnerFrameIndex: 0
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
dictionaryKey,
|
|
63
|
-
state: states
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
this.startSpinner();
|
|
67
|
-
this.updateAllStatusLines();
|
|
68
|
-
}
|
|
69
|
-
// New method to add dictionary keys after initialization
|
|
70
|
-
addDictionaryKeys(type, dictionaryKeys) {
|
|
71
|
-
for (const dictionaryKey of dictionaryKeys) {
|
|
72
|
-
if (dictionaryKey.length > this.maxDictionaryKeyLength) {
|
|
73
|
-
this.maxDictionaryKeyLength = dictionaryKey.length;
|
|
74
|
-
}
|
|
75
|
-
let statusObj = this.dictionariesStatuses.find(
|
|
76
|
-
(ds) => ds.dictionaryKey === dictionaryKey
|
|
77
|
-
);
|
|
78
|
-
if (!statusObj) {
|
|
79
|
-
statusObj = {
|
|
80
|
-
dictionaryKey,
|
|
81
|
-
state: []
|
|
82
|
-
};
|
|
83
|
-
this.dictionariesStatuses.push(statusObj);
|
|
84
|
-
const newState = {
|
|
85
|
-
type,
|
|
86
|
-
status: "pending",
|
|
87
|
-
spinnerFrameIndex: 0
|
|
88
|
-
};
|
|
89
|
-
statusObj.state.push(newState);
|
|
90
|
-
} else {
|
|
91
|
-
const existingState = statusObj.state.find((s) => s.type === type);
|
|
92
|
-
if (!existingState) {
|
|
93
|
-
const newState = {
|
|
94
|
-
type,
|
|
95
|
-
status: "pending",
|
|
96
|
-
spinnerFrameIndex: 0
|
|
97
|
-
};
|
|
98
|
-
statusObj.state.push(newState);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
this.updateAllStatusLines();
|
|
103
|
-
}
|
|
104
|
-
startSpinner() {
|
|
105
|
-
if (!this.spinnerTimer) {
|
|
106
|
-
this.spinnerTimer = setInterval(() => {
|
|
107
|
-
this.updateAllStatusLines();
|
|
108
|
-
}, 100);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
stopSpinner() {
|
|
112
|
-
if (this.spinnerTimer) {
|
|
113
|
-
clearInterval(this.spinnerTimer);
|
|
114
|
-
this.spinnerTimer = null;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// Method to update the terminal output
|
|
118
|
-
updateOutput(content) {
|
|
119
|
-
if (this.config?.log.mode !== "verbose") return;
|
|
120
|
-
if (!this.originalStdoutWrite) {
|
|
121
|
-
this.originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
122
|
-
this.extraLines = 0;
|
|
123
|
-
const write = (chunk, encoding, callback) => {
|
|
124
|
-
const str = typeof chunk === "string" ? chunk : chunk.toString();
|
|
125
|
-
const newLines = (str.match(/\n/g) ?? []).length;
|
|
126
|
-
if (!this.isUpdating) {
|
|
127
|
-
this.extraLines += newLines;
|
|
128
|
-
}
|
|
129
|
-
return this.originalStdoutWrite(chunk, encoding, callback);
|
|
130
|
-
};
|
|
131
|
-
process.stdout.write = write;
|
|
132
|
-
}
|
|
133
|
-
this.isUpdating = true;
|
|
134
|
-
const contentLines = content.split("\n");
|
|
135
|
-
const indexOfLineDetector = contentLines.indexOf(LINE_DETECTOR.trim());
|
|
136
|
-
if (indexOfLineDetector > 0) {
|
|
137
|
-
this.lineDifCounter = indexOfLineDetector;
|
|
138
|
-
} else {
|
|
139
|
-
this.lineDifCounter = 0;
|
|
140
|
-
}
|
|
141
|
-
const totalLinesToMoveUp = this.previousLineCount + this.lineDifCounter + this.extraLines;
|
|
142
|
-
readline.moveCursor(process.stdout, 0, -totalLinesToMoveUp);
|
|
143
|
-
readline.clearScreenDown(process.stdout);
|
|
144
|
-
contentLines.forEach((line) => {
|
|
145
|
-
process.stdout.write(`${line}\x1B[K
|
|
146
|
-
`);
|
|
147
|
-
});
|
|
148
|
-
this.previousLineCount = contentLines.length;
|
|
149
|
-
this.extraLines = 0;
|
|
150
|
-
this.isUpdating = false;
|
|
151
|
-
}
|
|
152
|
-
stop() {
|
|
153
|
-
this.stopSpinner();
|
|
154
|
-
}
|
|
155
|
-
updateStatus(dictionaries) {
|
|
156
|
-
for (const { dictionaryKey, type, status } of dictionaries) {
|
|
157
|
-
const statusObj = this.dictionariesStatuses.find(
|
|
158
|
-
(ds) => ds.dictionaryKey === dictionaryKey
|
|
159
|
-
);
|
|
160
|
-
if (statusObj) {
|
|
161
|
-
const state = statusObj.state.find((s) => s.type === type);
|
|
162
|
-
if (state) {
|
|
163
|
-
Object.assign(state, status);
|
|
164
|
-
} else {
|
|
165
|
-
if (status.status === void 0) {
|
|
166
|
-
status.status = "pending";
|
|
167
|
-
}
|
|
168
|
-
const newState = {
|
|
169
|
-
type,
|
|
170
|
-
status: status.status,
|
|
171
|
-
icon: status.icon ?? "",
|
|
172
|
-
error: status.error,
|
|
173
|
-
errorMessage: status.errorMessage,
|
|
174
|
-
spinnerFrameIndex: status.spinnerFrameIndex ?? 0
|
|
175
|
-
};
|
|
176
|
-
statusObj.state.push(newState);
|
|
177
|
-
}
|
|
178
|
-
} else {
|
|
179
|
-
const newState = {
|
|
180
|
-
type,
|
|
181
|
-
status: status.status ?? "pending",
|
|
182
|
-
icon: status.icon ?? "",
|
|
183
|
-
error: status.error,
|
|
184
|
-
errorMessage: status.errorMessage,
|
|
185
|
-
spinnerFrameIndex: status.spinnerFrameIndex ?? 0
|
|
186
|
-
};
|
|
187
|
-
this.dictionariesStatuses.push({
|
|
188
|
-
dictionaryKey,
|
|
189
|
-
state: [newState]
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
this.updateAllStatusLines();
|
|
194
|
-
}
|
|
195
|
-
getStatusIcon(status) {
|
|
196
|
-
const statusIcons = {
|
|
197
|
-
pending: "\u23F2",
|
|
198
|
-
fetching: "",
|
|
199
|
-
// Spinner handled separately
|
|
200
|
-
built: "\u2714",
|
|
201
|
-
imported: "\u2714",
|
|
202
|
-
error: "\u2716"
|
|
203
|
-
};
|
|
204
|
-
return statusIcons[status] ?? "";
|
|
205
|
-
}
|
|
206
|
-
getStatusLine(statusObj) {
|
|
207
|
-
const keyPadding = this.maxDictionaryKeyLength - statusObj.dictionaryKey.length;
|
|
208
|
-
const paddedKey = `${statusObj.dictionaryKey}${" ".repeat(keyPadding)}`;
|
|
209
|
-
const states = statusObj.state.map((state) => {
|
|
210
|
-
let colorStart = "";
|
|
211
|
-
let colorEnd = "";
|
|
212
|
-
let icon = this.getStatusIcon(state.status);
|
|
213
|
-
if (state.status === "fetching") {
|
|
214
|
-
icon = SPINNER_FRAMES[state.spinnerFrameIndex % SPINNER_FRAMES.length];
|
|
215
|
-
colorStart = BLUE;
|
|
216
|
-
colorEnd = RESET;
|
|
217
|
-
} else if (state.status === "error") {
|
|
218
|
-
colorStart = RED;
|
|
219
|
-
colorEnd = RESET;
|
|
220
|
-
} else if (state.status === "imported" || state.status === "built") {
|
|
221
|
-
colorStart = GREEN;
|
|
222
|
-
colorEnd = RESET;
|
|
223
|
-
} else {
|
|
224
|
-
colorStart = GREY;
|
|
225
|
-
colorEnd = RESET;
|
|
226
|
-
}
|
|
227
|
-
const statusBlock = `${GREY_DARK}[${state.type}: ${colorStart}${icon} ${state.status}${GREY_DARK}]${colorEnd}`;
|
|
228
|
-
return `${colorStart}${statusBlock}${colorEnd}`;
|
|
229
|
-
});
|
|
230
|
-
return `${this.config?.log.prefix}- ${paddedKey} ${states.join(" ")}`;
|
|
231
|
-
}
|
|
232
|
-
// Replace logUpdate calls with your custom methods
|
|
233
|
-
updateAllStatusLines() {
|
|
234
|
-
const terminalHeight = process.stdout.rows;
|
|
235
|
-
const maxVisibleLines = terminalHeight - 1;
|
|
236
|
-
const lines = this.dictionariesStatuses.map((statusObj) => {
|
|
237
|
-
statusObj.state.forEach((state) => {
|
|
238
|
-
if (state.status === "fetching") {
|
|
239
|
-
state.spinnerFrameIndex = (state.spinnerFrameIndex + 1) % SPINNER_FRAMES.length;
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
return this.getStatusLine(statusObj);
|
|
243
|
-
});
|
|
244
|
-
let content;
|
|
245
|
-
if (lines.length > maxVisibleLines) {
|
|
246
|
-
const visibleLines = lines.slice(0, maxVisibleLines - 5);
|
|
247
|
-
const summary = `${this.config?.log.prefix}... and ${lines.length - visibleLines.length} more`;
|
|
248
|
-
content = LINE_DETECTOR + visibleLines.join("\n") + "\n" + summary;
|
|
249
|
-
} else {
|
|
250
|
-
content = lines.join("\n");
|
|
251
|
-
}
|
|
252
|
-
this.updateOutput(content);
|
|
253
|
-
}
|
|
254
|
-
getStatuses() {
|
|
255
|
-
return this.dictionariesStatuses;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
const logger = Logger.getInstance();
|
|
259
|
-
export {
|
|
260
|
-
logger
|
|
261
|
-
};
|
|
262
|
-
//# sourceMappingURL=log.mjs.map
|
package/dist/esm/log.mjs.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,SAA8B,wBAAwB;AACtD,OAAO,cAAc;AACrB,SAAS,0BAA0B;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;AAAA,EACH,uBAA6C,CAAC;AAAA,EAC9C,eAAsC;AAAA,EACtC,yBAAiC;AAAA,EACjC,oBAA4B;AAAA,EAC5B,iBAAyB;AAAA,EACzB,sBAMG;AAAA,EACH,aAAqB;AAAA,EACrB,aAAsB;AAAA,EACtB;AAAA;AAAA,EAGR,OAAe;AAAA,EAEP,cAAc;AAAA,EAAC;AAAA,EAEvB,OAAc,cAAsB;AAClC,QAAI,CAAC,OAAO,UAAU;AACpB,aAAO,WAAW,IAAI,OAAO;AAAA,IAC/B;AACA,WAAO,OAAO;AAAA,EAChB;AAAA,EAEO,KACL,uBACA,yBACA,gBAAgC,iBAAiB,GACjD;AACA,SAAK,SAAS;AAEd,UAAM,UAAU,MAAM;AAAA,MACpB,IAAI;AAAA,QACF,CAAC,GAAG,uBAAuB,GAAG,uBAAuB,EAAE;AAAA,UACrD;AAAA,QACF;AAAA,MACF;AAAA,IACF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AAK,cAAc,SAAS;AAAA,IACrC,CAAC;AAED,QAAI;AAEJ,QAAI,MAAM,SAAS,iBAAiB;AAClC,YAAM,eAAe,MAAM,MAAM,GAAG,kBAAkB,CAAC;AACvD,YAAM,UAAU,GAAG,KAAK,QAAQ,IAAI,MAAM,WAAW,MAAM,SAAS,aAAa,MAAM;AACvF,gBAAU,gBAAgB,aAAa,KAAK,IAAI,IAAI,OAAO;AAAA,IAC7D,OAAO;AACL,gBAAU,MAAM,KAAK,IAAI;AAAA,IAC3B;AAEA,SAAK,aAAa,OAAO;AAAA,EAC3B;AAAA,EAEO,cAAc;AACnB,WAAO,KAAK;AAAA,EACd;AACF;AAEO,MAAM,SAAS,OAAO,YAAY;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkDictionaryChanges.d.ts","sourceRoot":"","sources":["../../src/checkDictionaryChanges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAmBtD,eAAO,MAAM,sBAAsB,sCA8BlC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchDistantDictionaryKeys.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaryKeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,0BAA0B,GACrC,gBAAe,cAAmC,KACjD,OAAO,CAAC,MAAM,EAAE,CAiClB,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { LocalesValues } from '@intlayer/config/client';
|
|
2
|
-
import { ContentNode, type NodeProps } from '@intlayer/core';
|
|
3
|
-
export declare const getFilteredLocalesContent: (node: ContentNode, locale: LocalesValues | LocalesValues[], nodeProps: NodeProps, fallback?: LocalesValues) => any;
|
|
4
|
-
//# sourceMappingURL=getFilteredLocalesContent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getFilteredLocalesContent.d.ts","sourceRoot":"","sources":["../../src/getFilteredLocalesContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACL,WAAW,EAGX,KAAK,SAAS,EAEf,MAAM,gBAAgB,CAAC;AA4CxB,eAAO,MAAM,yBAAyB,GACpC,MAAM,WAAW,EACjB,QAAQ,aAAa,GAAG,aAAa,EAAE,EACvC,WAAW,SAAS,EACpB,WAAW,aAAa,QAWzB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { DictionaryAPI } from '@intlayer/backend';
|
|
2
|
-
type LoadDistantDictionariesOptions = {
|
|
3
|
-
dictionaryKeys: string[];
|
|
4
|
-
newDictionariesPath?: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const loadDistantDictionaries: (options: LoadDistantDictionariesOptions) => Promise<DictionaryAPI[]>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=loadDistantDictionaries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadDistantDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadDistantDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,KAAK,8BAA8B,GAAG;IACpC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AASF,eAAO,MAAM,uBAAuB,GAClC,SAAS,8BAA8B,KACtC,OAAO,CAAC,aAAa,EAAE,CASzB,CAAC"}
|
package/dist/types/log.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { type IntlayerConfig } from '@intlayer/config';
|
|
2
|
-
export type State = {
|
|
3
|
-
type: 'local' | 'distant';
|
|
4
|
-
status: 'pending' | 'fetching' | 'fetched' | 'error' | 'imported' | 'built';
|
|
5
|
-
icon?: string;
|
|
6
|
-
error?: Error;
|
|
7
|
-
errorMessage?: string;
|
|
8
|
-
spinnerFrameIndex?: number;
|
|
9
|
-
};
|
|
10
|
-
export type DictionariesStatus = {
|
|
11
|
-
dictionaryKey: string;
|
|
12
|
-
state: State[];
|
|
13
|
-
};
|
|
14
|
-
declare class Logger {
|
|
15
|
-
private dictionariesStatuses;
|
|
16
|
-
private spinnerTimer;
|
|
17
|
-
private maxDictionaryKeyLength;
|
|
18
|
-
private previousLineCount;
|
|
19
|
-
private lineDifCounter;
|
|
20
|
-
private originalStdoutWrite;
|
|
21
|
-
private extraLines;
|
|
22
|
-
private isUpdating;
|
|
23
|
-
private config?;
|
|
24
|
-
private static instance;
|
|
25
|
-
private constructor();
|
|
26
|
-
static getInstance(): Logger;
|
|
27
|
-
init(localDictionariesKeys: string[], distantDictionariesKeys: string[], configuration?: IntlayerConfig): void;
|
|
28
|
-
addDictionaryKeys(type: 'local' | 'distant', dictionaryKeys: string[]): void;
|
|
29
|
-
private startSpinner;
|
|
30
|
-
private stopSpinner;
|
|
31
|
-
private updateOutput;
|
|
32
|
-
stop(): void;
|
|
33
|
-
updateStatus(dictionaries: {
|
|
34
|
-
dictionaryKey: string;
|
|
35
|
-
type: 'local' | 'distant';
|
|
36
|
-
status: Partial<State>;
|
|
37
|
-
}[]): void;
|
|
38
|
-
private getStatusIcon;
|
|
39
|
-
private getStatusLine;
|
|
40
|
-
private updateAllStatusLines;
|
|
41
|
-
getStatuses(): DictionariesStatus[];
|
|
42
|
-
}
|
|
43
|
-
export declare const logger: Logger;
|
|
44
|
-
export {};
|
|
45
|
-
//# sourceMappingURL=log.d.ts.map
|
package/dist/types/log.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,kBAAkB,CAAC;AAI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