@intlayer/chokidar 5.8.1-canary.0 → 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
|
@@ -35,24 +35,21 @@ var import_prepareIntlayer = require('../prepareIntlayer.cjs');
|
|
|
35
35
|
var import_declaration_file_to_dictionary = require('../transpiler/declaration_file_to_dictionary/index.cjs');
|
|
36
36
|
var import_createDictionaryEntryPoint = require('../transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs');
|
|
37
37
|
var import_dictionary_to_type = require('../transpiler/dictionary_to_type/index.cjs');
|
|
38
|
+
var import_formatter = require('../utils/formatter.cjs');
|
|
38
39
|
const recentlyAddedFiles = /* @__PURE__ */ new Set();
|
|
39
40
|
const handleAdditionalContentDeclarationFile = async (filePath, configuration) => {
|
|
40
41
|
const config = configuration ?? (0, import_config.getConfiguration)();
|
|
41
42
|
const appLogger = (0, import_config.getAppLogger)(config);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
isVerbose: true
|
|
47
|
-
}
|
|
48
|
-
);
|
|
43
|
+
appLogger(`Additional file detected: ${(0, import_formatter.formatPath)(filePath)}`, {
|
|
44
|
+
isVerbose: true
|
|
45
|
+
});
|
|
49
46
|
const localeDictionaries = await (0, import_loadLocalDictionaries.loadLocalDictionaries)(filePath);
|
|
50
|
-
const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries);
|
|
47
|
+
const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries, config);
|
|
51
48
|
const dictionariesPaths = Object.values(
|
|
52
49
|
dictionariesOutput?.mergedDictionaries ?? {}
|
|
53
50
|
).map((dictionary) => dictionary.dictionaryPath);
|
|
54
|
-
(0, import_dictionary_to_type.createTypes)(dictionariesPaths);
|
|
55
|
-
(0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
|
|
51
|
+
await (0, import_dictionary_to_type.createTypes)(dictionariesPaths);
|
|
52
|
+
await (0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
|
|
56
53
|
appLogger("Dictionaries built", {
|
|
57
54
|
isVerbose: true
|
|
58
55
|
});
|
|
@@ -64,22 +61,21 @@ const handleAdditionalContentDeclarationFile = async (filePath, configuration) =
|
|
|
64
61
|
const handleUnlikedContentDeclarationFile = async (filePath, configuration) => {
|
|
65
62
|
const config = configuration ?? (0, import_config.getConfiguration)();
|
|
66
63
|
const appLogger = (0, import_config.getAppLogger)(config);
|
|
67
|
-
|
|
68
|
-
appLogger(`Unlinked detected: ${(0, import_path.relative)(content.baseDir, filePath)}`, {
|
|
64
|
+
appLogger(`Unlinked detected: ${(0, import_formatter.formatPath)(filePath)}`, {
|
|
69
65
|
isVerbose: true
|
|
70
66
|
});
|
|
71
67
|
const files = (0, import_listDictionariesPath.listDictionaries)(configuration);
|
|
72
68
|
const localeDictionaries = await (0, import_loadLocalDictionaries.loadLocalDictionaries)(files);
|
|
73
|
-
const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries);
|
|
69
|
+
const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries, config);
|
|
74
70
|
const dictionariesPaths = Object.values(
|
|
75
71
|
dictionariesOutput?.mergedDictionaries ?? {}
|
|
76
72
|
).map((dictionary) => dictionary.dictionaryPath);
|
|
77
|
-
(0, import_dictionary_to_type.createTypes)(dictionariesPaths);
|
|
78
|
-
(0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
|
|
73
|
+
await (0, import_dictionary_to_type.createTypes)(dictionariesPaths);
|
|
74
|
+
await (0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
|
|
79
75
|
appLogger("Dictionaries rebuilt", {
|
|
80
76
|
isVerbose: true
|
|
81
77
|
});
|
|
82
|
-
(0, import_dictionary_to_type.createModuleAugmentation)();
|
|
78
|
+
await (0, import_dictionary_to_type.createModuleAugmentation)();
|
|
83
79
|
appLogger("Module augmentation built", {
|
|
84
80
|
isVerbose: true
|
|
85
81
|
});
|
|
@@ -87,12 +83,11 @@ const handleUnlikedContentDeclarationFile = async (filePath, configuration) => {
|
|
|
87
83
|
const handleContentDeclarationFileChange = async (filePath, configuration) => {
|
|
88
84
|
const config = configuration ?? (0, import_config.getConfiguration)();
|
|
89
85
|
const appLogger = (0, import_config.getAppLogger)(config);
|
|
90
|
-
|
|
91
|
-
appLogger(`Change detected: ${(0, import_path.relative)(content.baseDir, filePath)}`, {
|
|
86
|
+
appLogger(`Change detected: ${(0, import_formatter.formatPath)(filePath)}`, {
|
|
92
87
|
isVerbose: true
|
|
93
88
|
});
|
|
94
89
|
const localeDictionaries = await (0, import_loadLocalDictionaries.loadLocalDictionaries)(filePath);
|
|
95
|
-
const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries);
|
|
90
|
+
const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries, config);
|
|
96
91
|
const updatedDictionariesPaths = Object.values(
|
|
97
92
|
dictionariesOutput?.mergedDictionaries ?? {}
|
|
98
93
|
).map((dictionary) => dictionary.dictionaryPath);
|
|
@@ -104,7 +99,7 @@ const handleContentDeclarationFileChange = async (filePath, configuration) => {
|
|
|
104
99
|
if (updatedDictionariesPaths.some(
|
|
105
100
|
(updatedDictionaryPath) => !allDictionariesPaths.includes(updatedDictionaryPath)
|
|
106
101
|
)) {
|
|
107
|
-
(0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
|
|
102
|
+
await (0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
|
|
108
103
|
appLogger("Dictionary list built", {
|
|
109
104
|
isVerbose: true
|
|
110
105
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/chokidar/watcher.ts"],"sourcesContent":["import {\n GetConfigurationOptions,\n type IntlayerConfig,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { basename
|
|
1
|
+
{"version":3,"sources":["../../../src/chokidar/watcher.ts"],"sourcesContent":["import {\n GetConfigurationOptions,\n type IntlayerConfig,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { basename } from 'path';\n/** @ts-ignore remove error Module '\"chokidar\"' has no exported member 'ChokidarOptions' */\nimport { type ChokidarOptions, watch as chokidarWatch } from 'chokidar';\nimport { getBuiltDictionariesPath } from '../getBuiltDictionariesPath';\nimport { listDictionaries } from '../listDictionariesPath';\nimport { loadLocalDictionaries } from '../loadDictionaries/loadLocalDictionaries';\nimport { prepareIntlayer } from '../prepareIntlayer';\nimport { buildDictionary } from '../transpiler/declaration_file_to_dictionary/index';\nimport { createDictionaryEntryPoint } from '../transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from '../transpiler/dictionary_to_type/index';\nimport { formatPath } from '../utils/formatter';\n\nconst recentlyAddedFiles = new Set<string>();\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n configuration?: IntlayerConfig\n) => {\n const config = configuration ?? getConfiguration();\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await createDictionaryEntryPoint();\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation();\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n};\n\nexport const handleUnlikedContentDeclarationFile = async (\n filePath: string,\n configuration?: IntlayerConfig\n) => {\n const config = configuration ?? getConfiguration();\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = listDictionaries(configuration);\n\n const localeDictionaries = await loadLocalDictionaries(files);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await createDictionaryEntryPoint();\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation();\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n};\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n configuration?: IntlayerConfig\n) => {\n const config = configuration ?? getConfiguration();\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n const allDictionariesPaths: string[] = getBuiltDictionariesPath();\n\n createTypes(updatedDictionariesPaths);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (\n updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n )\n ) {\n await createDictionaryEntryPoint();\n\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n};\n\ntype WatchOptions = ChokidarOptions & {\n configuration?: IntlayerConfig;\n configOptions?: GetConfigurationOptions;\n};\n\n// Initialize chokidar watcher (non-persistent)\nexport const watch = (options?: WatchOptions) => {\n const configuration = options?.configuration ?? getConfiguration();\n const appLogger = getAppLogger(configuration);\n\n const { watch: isWatchMode, watchedFilesPatternWithPath } =\n configuration.content;\n\n /** @ts-ignore remove error Expected 0-1 arguments, but got 2. */\n return chokidarWatch(watchedFilesPatternWithPath, {\n persistent: isWatchMode, // Make the watcher persistent\n ignoreInitial: true, // Process existing files\n ...options,\n })\n .on('add', async (filePath) => {\n const fileName = basename(filePath);\n recentlyAddedFiles.add(fileName);\n\n await handleAdditionalContentDeclarationFile(filePath, configuration);\n\n setTimeout(() => recentlyAddedFiles.delete(fileName), 1000); // Allow time for unlink to trigger if it's a move\n })\n .on(\n 'change',\n async (filePath) =>\n await handleContentDeclarationFileChange(filePath, configuration)\n )\n .on('unlink', async (filePath) => {\n setTimeout(async () => {\n const fileName = basename(filePath);\n\n if (recentlyAddedFiles.has(fileName)) {\n // The file was moved, so ignore unlink\n return;\n }\n\n await handleUnlikedContentDeclarationFile(filePath, configuration);\n }, 300); // Allow time for unlink to trigger if it's a move\n })\n .on('error', async (error) => {\n appLogger('Watcher error: ' + error, {\n level: 'error',\n });\n\n appLogger('Restarting watcher');\n\n await prepareIntlayer(configuration);\n });\n};\n\nexport const buildAndWatchIntlayer = async (options?: WatchOptions) => {\n const configuration =\n options?.configuration ?? getConfiguration(options?.configOptions);\n\n await prepareIntlayer(configuration);\n\n if (configuration.content.watch || options.persistent) {\n // Start watching (assuming watch is also async)\n watch({ ...options, configuration });\n }\n};\n"],"mappings":"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","names":["chokidarWatch"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
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
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var fetchDistantDictionaries_exports = {};
|
|
30
20
|
__export(fetchDistantDictionaries_exports, {
|
|
@@ -33,9 +23,8 @@ __export(fetchDistantDictionaries_exports, {
|
|
|
33
23
|
module.exports = __toCommonJS(fetchDistantDictionaries_exports);
|
|
34
24
|
var import_api = require("@intlayer/api");
|
|
35
25
|
var import_config = require("@intlayer/config");
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
const fetchDistantDictionaries = async (options) => {
|
|
26
|
+
var import_parallelize = require('./utils/parallelize.cjs');
|
|
27
|
+
const fetchDistantDictionaries = async (options, onStatusUpdate) => {
|
|
39
28
|
const config = (0, import_config.getConfiguration)();
|
|
40
29
|
const appLogger = (0, import_config.getAppLogger)(config);
|
|
41
30
|
try {
|
|
@@ -50,13 +39,12 @@ const fetchDistantDictionaries = async (options) => {
|
|
|
50
39
|
const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();
|
|
51
40
|
const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
|
|
52
41
|
const distantDictionariesKeys = options.dictionaryKeys;
|
|
53
|
-
const limit = (0, import_p_limit.default)(5);
|
|
54
42
|
const processDictionary = async (dictionaryKey) => {
|
|
55
|
-
|
|
43
|
+
onStatusUpdate?.([
|
|
56
44
|
{
|
|
57
45
|
dictionaryKey,
|
|
58
|
-
type: "
|
|
59
|
-
status:
|
|
46
|
+
type: "remote",
|
|
47
|
+
status: "fetching"
|
|
60
48
|
}
|
|
61
49
|
]);
|
|
62
50
|
try {
|
|
@@ -75,42 +63,35 @@ const fetchDistantDictionaries = async (options) => {
|
|
|
75
63
|
if (!distantDictionary) {
|
|
76
64
|
throw new Error(`Dictionary ${dictionaryKey} not found on remote`);
|
|
77
65
|
}
|
|
78
|
-
|
|
79
|
-
{ dictionaryKey, type: "
|
|
66
|
+
onStatusUpdate?.([
|
|
67
|
+
{ dictionaryKey, type: "remote", status: "fetched" }
|
|
80
68
|
]);
|
|
81
69
|
return distantDictionary;
|
|
82
70
|
} catch (error) {
|
|
83
|
-
|
|
71
|
+
onStatusUpdate?.([
|
|
84
72
|
{
|
|
85
73
|
dictionaryKey,
|
|
86
|
-
type: "
|
|
87
|
-
status:
|
|
88
|
-
|
|
89
|
-
error,
|
|
90
|
-
errorMessage: `${options?.logPrefix ?? ""}Error fetching dictionary ${dictionaryKey}: ${error}`
|
|
91
|
-
}
|
|
74
|
+
type: "remote",
|
|
75
|
+
status: "error",
|
|
76
|
+
error: `Error fetching dictionary ${dictionaryKey}: ${error}`
|
|
92
77
|
}
|
|
93
78
|
]);
|
|
94
79
|
return void 0;
|
|
95
80
|
}
|
|
96
81
|
};
|
|
97
|
-
const
|
|
98
|
-
|
|
82
|
+
const result = await (0, import_parallelize.parallelize)(
|
|
83
|
+
distantDictionariesKeys,
|
|
84
|
+
async (dictionaryKey) => await processDictionary(dictionaryKey)
|
|
99
85
|
);
|
|
100
|
-
const result = await Promise.all(fetchPromises);
|
|
101
|
-
const statuses = import_log.logger.getStatuses();
|
|
102
|
-
for (const statusObj of statuses) {
|
|
103
|
-
const currentState = statusObj.state.find((s) => s.type === "distant");
|
|
104
|
-
if (currentState && currentState.errorMessage) {
|
|
105
|
-
appLogger(currentState.errorMessage, { level: "error" });
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
86
|
const filteredResult = result.filter(
|
|
109
87
|
(dict) => dict !== void 0
|
|
110
88
|
);
|
|
111
89
|
return filteredResult;
|
|
112
90
|
} catch (error) {
|
|
113
|
-
appLogger(
|
|
91
|
+
appLogger(
|
|
92
|
+
`${(0, import_config.colorize)("\u2717", import_config.ANSIColors.RED)} Failed to fetch distant dictionaries`,
|
|
93
|
+
{ level: "error" }
|
|
94
|
+
);
|
|
114
95
|
return [];
|
|
115
96
|
}
|
|
116
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getDictionaryAPI, getOAuthAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getDictionaryAPI, getOAuthAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport {\n ANSIColors,\n colorize,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const { clientId, clientSecret } = config.editor;\n const authAPI = getOAuthAPI(config);\n const dictionaryAPI = getDictionaryAPI(undefined, config);\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 oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n const distantDictionariesKeys = options.dictionaryKeys;\n\n // Process dictionaries in parallel with a concurrency limit\n\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (error) {\n appLogger(\n `${colorize('✗', ANSIColors.RED)} Failed to fetch distant dictionaries`,\n { level: 'error' }\n );\n return [];\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA8C;AAG9C,oBAKO;AAEP,yBAA4B;AAWrB,MAAM,2BAA2B,OACtC,SACA,mBAC6B;AAC7B,QAAM,aAAS,gCAAiB;AAChC,QAAM,gBAAY,4BAAa,MAAM;AACrC,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,cAAU,wBAAY,MAAM;AAClC,UAAM,oBAAgB,6BAAiB,QAAW,MAAM;AAExD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAElD,UAAM,0BAA0B,QAAQ;AAIxC,UAAM,oBAAoB,OACxB,kBACuC;AACvC,uBAAiB;AAAA,QACf;AAAA,UACE;AAAA,UACA,MAAM;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAED,UAAI;AAEF,cAAM,sBAAsB,MAAM,cAAc;AAAA,UAC9C;AAAA,UACA;AAAA,UACA;AAAA,YACE,GAAI,qBAAqB;AAAA,cACvB,SAAS;AAAA,gBACP,eAAe,UAAU,iBAAiB;AAAA,cAC5C;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAEA,cAAM,oBAAoB,oBAAoB;AAE9C,YAAI,CAAC,mBAAmB;AACtB,gBAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,QACnE;AAEA,yBAAiB;AAAA,UACf,EAAE,eAAe,MAAM,UAAU,QAAQ,UAAU;AAAA,QACrD,CAAC;AAED,eAAO;AAAA,MACT,SAAS,OAAO;AACd,yBAAiB;AAAA,UACf;AAAA,YACE;AAAA,YACA,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,OAAO,6BAA6B,aAAa,KAAK,KAAK;AAAA,UAC7D;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,SAAS,UAAM;AAAA,MACnB;AAAA,MACA,OAAO,kBAAkB,MAAM,kBAAkB,aAAa;AAAA,IAChE;AAGA,UAAM,iBAAiB,OAAO;AAAA,MAC5B,CAAC,SACC,SAAS;AAAA,IACb;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd;AAAA,MACE,OAAG,wBAAS,UAAK,yBAAW,GAAG,CAAC;AAAA,MAChC,EAAE,OAAO,QAAQ;AAAA,IACnB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
|
package/dist/cjs/{fetchDistantDictionaryKeys.cjs → fetchDistantDictionaryKeysAndUpdateTimestamp.cjs}
RENAMED
|
@@ -16,14 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var fetchDistantDictionaryKeysAndUpdateTimestamp_exports = {};
|
|
20
|
+
__export(fetchDistantDictionaryKeysAndUpdateTimestamp_exports, {
|
|
21
|
+
fetchDistantDictionaryKeysAndUpdateTimestamp: () => fetchDistantDictionaryKeysAndUpdateTimestamp
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(fetchDistantDictionaryKeysAndUpdateTimestamp_exports);
|
|
24
24
|
var import_api = require("@intlayer/api");
|
|
25
25
|
var import_config = require("@intlayer/config");
|
|
26
|
-
const
|
|
26
|
+
const fetchDistantDictionaryKeysAndUpdateTimestamp = async (configuration = (0, import_config.getConfiguration)()) => {
|
|
27
27
|
const { clientId, clientSecret } = configuration.editor;
|
|
28
28
|
if (!clientId || !clientSecret) {
|
|
29
29
|
throw new Error(
|
|
@@ -33,7 +33,7 @@ const fetchDistantDictionaryKeys = async (configuration = (0, import_config.getC
|
|
|
33
33
|
const intlayerAPI = (0, import_api.getIntlayerAPI)(void 0, configuration);
|
|
34
34
|
const oAuth2TokenResult = await intlayerAPI.oAuth.getOAuth2AccessToken();
|
|
35
35
|
const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
|
|
36
|
-
const getDictionariesKeysResult = await intlayerAPI.dictionary.
|
|
36
|
+
const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesUpdateTimestamp({
|
|
37
37
|
...oAuth2AccessToken && {
|
|
38
38
|
headers: {
|
|
39
39
|
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
@@ -43,11 +43,11 @@ const fetchDistantDictionaryKeys = async (configuration = (0, import_config.getC
|
|
|
43
43
|
if (!getDictionariesKeysResult.data) {
|
|
44
44
|
throw new Error("No distant dictionaries found");
|
|
45
45
|
}
|
|
46
|
-
const
|
|
47
|
-
return
|
|
46
|
+
const distantDictionariesUpdateTimeStamp = getDictionariesKeysResult.data;
|
|
47
|
+
return distantDictionariesUpdateTimeStamp;
|
|
48
48
|
};
|
|
49
49
|
// Annotate the CommonJS export names for ESM import in node:
|
|
50
50
|
0 && (module.exports = {
|
|
51
|
-
|
|
51
|
+
fetchDistantDictionaryKeysAndUpdateTimestamp
|
|
52
52
|
});
|
|
53
|
-
//# sourceMappingURL=
|
|
53
|
+
//# sourceMappingURL=fetchDistantDictionaryKeysAndUpdateTimestamp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeysAndUpdateTimestamp = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<Record<string, number>> => {\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.getDictionariesUpdateTimestamp({\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 distantDictionariesUpdateTimeStamp: Record<string, number> =\n getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesUpdateTimeStamp;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA+B;AAC/B,oBAAsD;AAE/C,MAAM,+CAA+C,OAC1D,oBAAgC,gCAAiB,MACb;AACpC,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,+BAA+B;AAAA,IAC1D,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,qCACJ,0BAA0B;AAG5B,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 filterInvalidDictionaries_exports = {};
|
|
30
|
+
__export(filterInvalidDictionaries_exports, {
|
|
31
|
+
filterInvalidDictionaries: () => filterInvalidDictionaries
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(filterInvalidDictionaries_exports);
|
|
34
|
+
var import_built = __toESM(require("@intlayer/config/built"));
|
|
35
|
+
var import_client = require("@intlayer/config/client");
|
|
36
|
+
var import_formatter = require('./utils/formatter.cjs');
|
|
37
|
+
const filterInvalidDictionaries = (dictionaries) => {
|
|
38
|
+
const appLogger = (0, import_client.getAppLogger)(import_built.default);
|
|
39
|
+
return (dictionaries ?? [])?.filter((dictionary) => {
|
|
40
|
+
if (!dictionary) return false;
|
|
41
|
+
const isLocal = Boolean(dictionary.location === "locale");
|
|
42
|
+
const location = isLocal ? "Local" : "Remote";
|
|
43
|
+
const hasKey = Boolean(dictionary.key);
|
|
44
|
+
const hasContent = Boolean(dictionary.content);
|
|
45
|
+
if (!hasKey) {
|
|
46
|
+
appLogger(`${location} dictionary has no key`, {
|
|
47
|
+
level: "error"
|
|
48
|
+
});
|
|
49
|
+
appLogger(JSON.stringify(dictionary, null, 2), {
|
|
50
|
+
level: "error"
|
|
51
|
+
});
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (!hasContent) {
|
|
55
|
+
appLogger(
|
|
56
|
+
`${location} dictionary ${(0, import_client.colorizeKey)(dictionary.key)} has no content - ${dictionary.filePath ? (0, import_formatter.formatPath)(dictionary.filePath) : (0, import_client.colorizePath)("Remote")}`,
|
|
57
|
+
{
|
|
58
|
+
level: "error"
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
filterInvalidDictionaries
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=filterInvalidDictionaries.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n colorizeKey,\n colorizePath,\n getAppLogger,\n} from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { formatPath } from './utils/formatter';\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined\n): Dictionary[] => {\n const appLogger = getAppLogger(configuration);\n\n return (dictionaries ?? [])?.filter((dictionary) => {\n if (!dictionary) return false;\n\n const isLocal = Boolean(dictionary.location === 'locale');\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n appLogger(JSON.stringify(dictionary, null, 2), {\n level: 'error',\n });\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n return true;\n }) as Dictionary[];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAC1B,oBAIO;AAEP,uBAA2B;AAEpB,MAAM,4BAA4B,CACvC,iBACiB;AACjB,QAAM,gBAAY,4BAAa,aAAAA,OAAa;AAE5C,UAAQ,gBAAgB,CAAC,IAAI,OAAO,CAAC,eAAe;AAClD,QAAI,CAAC,WAAY,QAAO;AAExB,UAAM,UAAU,QAAQ,WAAW,aAAa,QAAQ;AACxD,UAAM,WAAW,UAAU,UAAU;AACrC,UAAM,SAAS,QAAQ,WAAW,GAAG;AACrC,UAAM,aAAa,QAAQ,WAAW,OAAO;AAE7C,QAAI,CAAC,QAAQ;AACX,gBAAU,GAAG,QAAQ,0BAA0B;AAAA,QAC7C,OAAO;AAAA,MACT,CAAC;AACD,gBAAU,KAAK,UAAU,YAAY,MAAM,CAAC,GAAG;AAAA,QAC7C,OAAO;AAAA,MACT,CAAC;AACD,aAAO;AAAA,IACT;AAEA,QAAI,CAAC,YAAY;AACf;AAAA,QACE,GAAG,QAAQ,mBAAe,2BAAY,WAAW,GAAG,CAAC,qBAAqB,WAAW,eAAW,6BAAW,WAAW,QAAQ,QAAI,4BAAa,QAAQ,CAAC;AAAA,QACxJ;AAAA,UACE,OAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AACH;","names":["configuration"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 getBuiltFetchDictionariesPath_exports = {};
|
|
30
|
+
__export(getBuiltFetchDictionariesPath_exports, {
|
|
31
|
+
getBuiltFetchDictionariesPath: () => getBuiltFetchDictionariesPath
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getBuiltFetchDictionariesPath_exports);
|
|
34
|
+
var import_config = require("@intlayer/config");
|
|
35
|
+
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
|
+
var import_fs = require("fs");
|
|
37
|
+
const getBuiltFetchDictionariesPath = (configuration = (0, import_config.getConfiguration)(), format = "esm") => {
|
|
38
|
+
const { fetchDictionariesDir, mainDir } = configuration.content;
|
|
39
|
+
if (!(0, import_fs.existsSync)(mainDir)) {
|
|
40
|
+
(0, import_fs.mkdirSync)(mainDir, { recursive: true });
|
|
41
|
+
}
|
|
42
|
+
const extension = format === "cjs" ? "cjs" : "mjs";
|
|
43
|
+
const dictionariesPath = import_fast_glob.default.sync(
|
|
44
|
+
`${(0, import_config.normalizePath)(fetchDictionariesDir)}/**/*.${extension}`
|
|
45
|
+
);
|
|
46
|
+
return dictionariesPath;
|
|
47
|
+
};
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
getBuiltFetchDictionariesPath
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=getBuiltFetchDictionariesPath.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/getBuiltFetchDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync } from 'fs';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltFetchDictionariesPath = (\n configuration = getConfiguration(),\n format: 'cjs' | 'esm' = 'esm'\n) => {\n const { fetchDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(fetchDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,uBAAe;AACf,gBAAsC;AAK/B,MAAM,gCAAgC,CAC3C,oBAAgB,gCAAiB,GACjC,SAAwB,UACrB;AACH,QAAM,EAAE,sBAAsB,QAAQ,IAAI,cAAc;AAGxD,MAAI,KAAC,sBAAW,OAAO,GAAG;AACxB,6BAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,YAAY,WAAW,QAAQ,QAAQ;AAE7C,QAAM,mBAA6B,iBAAAA,QAAG;AAAA,IACpC,OAAG,6BAAc,oBAAoB,CAAC,SAAS,SAAS;AAAA,EAC1D;AAEA,SAAO;AACT;","names":["fg"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 getBuiltRemoteDictionariesPath_exports = {};
|
|
30
|
+
__export(getBuiltRemoteDictionariesPath_exports, {
|
|
31
|
+
getBuiltRemoteDictionariesPath: () => getBuiltRemoteDictionariesPath
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getBuiltRemoteDictionariesPath_exports);
|
|
34
|
+
var import_config = require("@intlayer/config");
|
|
35
|
+
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
|
+
var import_fs = require("fs");
|
|
37
|
+
const getBuiltRemoteDictionariesPath = (configuration = (0, import_config.getConfiguration)()) => {
|
|
38
|
+
const { remoteDictionariesDir, mainDir } = configuration.content;
|
|
39
|
+
if (!(0, import_fs.existsSync)(mainDir)) {
|
|
40
|
+
(0, import_fs.mkdirSync)(mainDir, { recursive: true });
|
|
41
|
+
}
|
|
42
|
+
const dictionariesPath = import_fast_glob.default.sync(
|
|
43
|
+
`${(0, import_config.normalizePath)(remoteDictionariesDir)}/**/*.json`
|
|
44
|
+
);
|
|
45
|
+
return dictionariesPath;
|
|
46
|
+
};
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
getBuiltRemoteDictionariesPath
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=getBuiltRemoteDictionariesPath.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/getBuiltRemoteDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync } from 'fs';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltRemoteDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { remoteDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(remoteDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,uBAAe;AACf,gBAAsC;AAK/B,MAAM,iCAAiC,CAC5C,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,uBAAuB,QAAQ,IAAI,cAAc;AAGzD,MAAI,KAAC,sBAAW,OAAO,GAAG;AACxB,6BAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,iBAAAA,QAAG;AAAA,IACpC,OAAG,6BAAc,qBAAqB,CAAC;AAAA,EACzC;AAEA,SAAO;AACT;","names":["fg"]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -20,17 +20,17 @@ var index_exports = {};
|
|
|
20
20
|
__export(index_exports, {
|
|
21
21
|
buildAndWatchIntlayer: () => import_watcher.buildAndWatchIntlayer,
|
|
22
22
|
buildDictionary: () => import_declaration_file_to_dictionary.buildDictionary,
|
|
23
|
-
checkDictionaryChanges: () => import_checkDictionaryChanges.checkDictionaryChanges,
|
|
24
23
|
cleanOutputDir: () => import_cleanOutputDir.cleanOutputDir,
|
|
25
24
|
createDictionaryEntryPoint: () => import_dictionary_to_main.createDictionaryEntryPoint,
|
|
26
25
|
createModuleAugmentation: () => import_createModuleAugmentation.createModuleAugmentation,
|
|
27
26
|
fetchDistantDictionaries: () => import_fetchDistantDictionaries.fetchDistantDictionaries,
|
|
28
|
-
|
|
27
|
+
fetchDistantDictionaryKeysAndUpdateTimestamp: () => import_fetchDistantDictionaryKeysAndUpdateTimestamp.fetchDistantDictionaryKeysAndUpdateTimestamp,
|
|
28
|
+
formatLocale: () => import_formatter.formatLocale,
|
|
29
|
+
formatPath: () => import_formatter.formatPath,
|
|
29
30
|
generateDictionaryListContent: () => import_dictionary_to_main.generateDictionaryListContent,
|
|
30
31
|
getBuiltDictionariesPath: () => import_getBuiltDictionariesPath.getBuiltDictionariesPath,
|
|
31
32
|
getBuiltUnmergedDictionariesPath: () => import_getBuiltUnmergedDictionariesPath.getBuiltUnmergedDictionariesPath,
|
|
32
33
|
getFileHash: () => import_getFileHash.getFileHash,
|
|
33
|
-
getFilteredLocalesContent: () => import_getFilteredLocalesContent.getFilteredLocalesContent,
|
|
34
34
|
handleAdditionalContentDeclarationFile: () => import_watcher.handleAdditionalContentDeclarationFile,
|
|
35
35
|
handleContentDeclarationFileChange: () => import_watcher.handleContentDeclarationFileChange,
|
|
36
36
|
kebabCaseToCamelCase: () => import_kebabCaseToCamelCase.kebabCaseToCamelCase,
|
|
@@ -38,8 +38,8 @@ __export(index_exports, {
|
|
|
38
38
|
listGitFiles: () => import_listGitFiles.listGitFiles,
|
|
39
39
|
listGitLines: () => import_listGitFiles.listGitLines,
|
|
40
40
|
loadDictionaries: () => import_loadDictionaries.loadDictionaries,
|
|
41
|
-
loadDistantDictionaries: () => import_loadDictionaries.loadDistantDictionaries,
|
|
42
41
|
loadLocalDictionaries: () => import_loadDictionaries.loadLocalDictionaries,
|
|
42
|
+
loadRemoteDictionaries: () => import_loadDictionaries.loadRemoteDictionaries,
|
|
43
43
|
mergeDictionaries: () => import_mergeDictionaries.mergeDictionaries,
|
|
44
44
|
prepareContentDeclaration: () => import_prepareContentDeclaration.prepareContentDeclaration,
|
|
45
45
|
prepareIntlayer: () => import_prepareIntlayer.prepareIntlayer,
|
|
@@ -52,14 +52,12 @@ __export(index_exports, {
|
|
|
52
52
|
writeContentDeclaration: () => import_writeContentDeclaration.writeContentDeclaration
|
|
53
53
|
});
|
|
54
54
|
module.exports = __toCommonJS(index_exports);
|
|
55
|
-
var import_checkDictionaryChanges = require('./checkDictionaryChanges.cjs');
|
|
56
55
|
var import_watcher = require('./chokidar/watcher.cjs');
|
|
57
56
|
var import_cleanOutputDir = require('./cleanOutputDir.cjs');
|
|
58
57
|
var import_fetchDistantDictionaries = require('./fetchDistantDictionaries.cjs');
|
|
59
|
-
var
|
|
58
|
+
var import_fetchDistantDictionaryKeysAndUpdateTimestamp = require('./fetchDistantDictionaryKeysAndUpdateTimestamp.cjs');
|
|
60
59
|
var import_getBuiltDictionariesPath = require('./getBuiltDictionariesPath.cjs');
|
|
61
60
|
var import_getBuiltUnmergedDictionariesPath = require('./getBuiltUnmergedDictionariesPath.cjs');
|
|
62
|
-
var import_getFilteredLocalesContent = require('./getFilteredLocalesContent.cjs');
|
|
63
61
|
var import_listDictionariesPath = require('./listDictionariesPath.cjs');
|
|
64
62
|
var import_listGitFiles = require('./listGitFiles.cjs');
|
|
65
63
|
var import_loadDictionaries = require('./loadDictionaries/index.cjs');
|
|
@@ -71,6 +69,7 @@ var import_reduceDictionaryContent = require('./reduceDictionaryContent/reduceDi
|
|
|
71
69
|
var import_declaration_file_to_dictionary = require('./transpiler/declaration_file_to_dictionary/index.cjs');
|
|
72
70
|
var import_dictionary_to_main = require('./transpiler/dictionary_to_main/index.cjs');
|
|
73
71
|
var import_createModuleAugmentation = require('./transpiler/dictionary_to_type/createModuleAugmentation.cjs');
|
|
72
|
+
var import_formatter = require('./utils/formatter.cjs');
|
|
74
73
|
var import_getFileHash = require('./utils/getFileHash.cjs');
|
|
75
74
|
var import_kebabCaseToCamelCase = require('./utils/kebabCaseToCamelCase.cjs');
|
|
76
75
|
var import_resolveObjectPromises = require('./utils/resolveObjectPromises.cjs');
|
|
@@ -81,17 +80,17 @@ var import_writeContentDeclaration = require('./writeContentDeclaration/index.cj
|
|
|
81
80
|
0 && (module.exports = {
|
|
82
81
|
buildAndWatchIntlayer,
|
|
83
82
|
buildDictionary,
|
|
84
|
-
checkDictionaryChanges,
|
|
85
83
|
cleanOutputDir,
|
|
86
84
|
createDictionaryEntryPoint,
|
|
87
85
|
createModuleAugmentation,
|
|
88
86
|
fetchDistantDictionaries,
|
|
89
|
-
|
|
87
|
+
fetchDistantDictionaryKeysAndUpdateTimestamp,
|
|
88
|
+
formatLocale,
|
|
89
|
+
formatPath,
|
|
90
90
|
generateDictionaryListContent,
|
|
91
91
|
getBuiltDictionariesPath,
|
|
92
92
|
getBuiltUnmergedDictionariesPath,
|
|
93
93
|
getFileHash,
|
|
94
|
-
getFilteredLocalesContent,
|
|
95
94
|
handleAdditionalContentDeclarationFile,
|
|
96
95
|
handleContentDeclarationFileChange,
|
|
97
96
|
kebabCaseToCamelCase,
|
|
@@ -99,8 +98,8 @@ var import_writeContentDeclaration = require('./writeContentDeclaration/index.cj
|
|
|
99
98
|
listGitFiles,
|
|
100
99
|
listGitLines,
|
|
101
100
|
loadDictionaries,
|
|
102
|
-
loadDistantDictionaries,
|
|
103
101
|
loadLocalDictionaries,
|
|
102
|
+
loadRemoteDictionaries,
|
|
104
103
|
mergeDictionaries,
|
|
105
104
|
prepareContentDeclaration,
|
|
106
105
|
prepareIntlayer,
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeysAndUpdateTimestamp } from './fetchDistantDictionaryKeysAndUpdateTimestamp';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n listGitLines,\n type DiffMode,\n type ListGitFilesOptions,\n type ListGitLinesOptions,\n} from './listGitFiles';\nexport {\n loadDictionaries,\n loadLocalDictionaries,\n loadRemoteDictionaries,\n} from './loadDictionaries/index';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n} from './transpiler/dictionary_to_main';\nexport { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';\nexport { formatLocale, formatPath } from './utils/formatter';\nexport { getFileHash } from './utils/getFileHash';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAKO;AACP,4BAA+B;AAC/B,sCAAyC;AACzC,0DAA6D;AAC7D,sCAAyC;AACzC,8CAAiD;AACjD,kCAAiC;AACjC,0BAMO;AACP,8BAIO;AACP,+BAAkC;AAClC,uCAA0C;AAC1C,6BAAgC;AAChC,wCAA2C;AAC3C,qCAAwC;AACxC,4CAAgC;AAChC,gCAGO;AACP,sCAAyC;AACzC,uBAAyC;AACzC,yBAA4B;AAC5B,kCAAqC;AACrC,mCAAsC;AACtC,qBAAwB;AACxB,gCAAmC;AACnC,qCAGO;","names":[]}
|