@intlayer/cli 6.1.6 → 7.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/IntlayerEventListener.cjs +187 -239
- package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
- package/dist/cjs/_virtual/_utils_asset.cjs +104 -0
- package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/build.cjs +23 -42
- package/dist/cjs/build.cjs.map +1 -1
- package/dist/cjs/cli.cjs +370 -431
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/config.cjs +10 -35
- package/dist/cjs/config.cjs.map +1 -1
- package/dist/cjs/editor.cjs +51 -66
- package/dist/cjs/editor.cjs.map +1 -1
- package/dist/cjs/fill/fill.cjs +73 -301
- package/dist/cjs/fill/fill.cjs.map +1 -1
- package/dist/cjs/fill/formatAutoFillData.cjs +48 -106
- package/dist/cjs/fill/formatAutoFillData.cjs.map +1 -1
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs +27 -43
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
- package/dist/cjs/fill/formatFillData.cjs +50 -0
- package/dist/cjs/fill/formatFillData.cjs.map +1 -0
- package/dist/cjs/fill/groupLimiter.cjs +42 -0
- package/dist/cjs/fill/groupLimiter.cjs.map +1 -0
- package/dist/cjs/fill/index.cjs +5 -25
- package/dist/cjs/fill/listTranslationsTasks.cjs +77 -0
- package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -0
- package/dist/cjs/fill/test-original-case.cjs +10 -0
- package/dist/cjs/fill/test-original-case.cjs.map +1 -0
- package/dist/cjs/fill/translateDictionary.cjs +148 -0
- package/dist/cjs/fill/translateDictionary.cjs.map +1 -0
- package/dist/cjs/fill/writeAutoFill.cjs +48 -0
- package/dist/cjs/fill/writeAutoFill.cjs.map +1 -0
- package/dist/cjs/fill/writeFill.cjs +50 -0
- package/dist/cjs/fill/writeFill.cjs.map +1 -0
- package/dist/cjs/getTargetDictionary.cjs +36 -76
- package/dist/cjs/getTargetDictionary.cjs.map +1 -1
- package/dist/cjs/index.cjs +31 -45
- package/dist/cjs/listContentDeclaration.cjs +36 -64
- package/dist/cjs/listContentDeclaration.cjs.map +1 -1
- package/dist/cjs/liveSync.cjs +146 -221
- package/dist/cjs/liveSync.cjs.map +1 -1
- package/dist/cjs/pull.cjs +132 -195
- package/dist/cjs/pull.cjs.map +1 -1
- package/dist/cjs/push/pullLog.cjs +101 -144
- package/dist/cjs/push/pullLog.cjs.map +1 -1
- package/dist/cjs/push/push.cjs +159 -249
- package/dist/cjs/push/push.cjs.map +1 -1
- package/dist/cjs/pushConfig.cjs +18 -45
- package/dist/cjs/pushConfig.cjs.map +1 -1
- package/dist/cjs/pushLog.cjs +87 -128
- package/dist/cjs/pushLog.cjs.map +1 -1
- package/dist/cjs/reviewDoc.cjs +183 -291
- package/dist/cjs/reviewDoc.cjs.map +1 -1
- package/dist/cjs/test/index.cjs +52 -91
- package/dist/cjs/test/index.cjs.map +1 -1
- package/dist/cjs/test/listMissingTranslations.cjs +35 -62
- package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
- package/dist/cjs/translateDoc.cjs +127 -221
- package/dist/cjs/translateDoc.cjs.map +1 -1
- package/dist/cjs/utils/calculateChunks.cjs +85 -115
- package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
- package/dist/cjs/utils/checkAccess.cjs +33 -72
- package/dist/cjs/utils/checkAccess.cjs.map +1 -1
- package/dist/cjs/utils/checkFileModifiedRange.cjs +75 -91
- package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
- package/dist/cjs/utils/checkLastUpdateTime.cjs +17 -30
- package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
- package/dist/cjs/utils/chunkInference.cjs +28 -47
- package/dist/cjs/utils/chunkInference.cjs.map +1 -1
- package/dist/cjs/utils/fixChunkStartEndChars.cjs +23 -42
- package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
- package/dist/cjs/utils/formatTimeDiff.cjs +17 -43
- package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +13 -32
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
- package/dist/cjs/utils/getOutputFilePath.cjs +71 -86
- package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
- package/dist/cjs/utils/getParentPackageJSON.cjs +19 -44
- package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
- package/dist/cjs/utils/listSpecialChars.cjs +49 -73
- package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
- package/dist/cjs/utils/mapChunksBetweenFiles.cjs +90 -132
- package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
- package/dist/cjs/utils/reorderParagraphs.cjs +86 -118
- package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
- package/dist/cjs/watch.cjs +21 -39
- package/dist/cjs/watch.cjs.map +1 -1
- package/dist/esm/IntlayerEventListener.mjs +178 -201
- package/dist/esm/IntlayerEventListener.mjs.map +1 -1
- package/dist/esm/_virtual/_utils_asset.mjs +100 -0
- package/dist/esm/_virtual/rolldown_runtime.mjs +8 -0
- package/dist/esm/build.mjs +20 -23
- package/dist/esm/build.mjs.map +1 -1
- package/dist/esm/cli.mjs +349 -380
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/config.mjs +8 -14
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/editor.mjs +47 -41
- package/dist/esm/editor.mjs.map +1 -1
- package/dist/esm/fill/fill.mjs +68 -300
- package/dist/esm/fill/fill.mjs.map +1 -1
- package/dist/esm/fill/formatAutoFillData.mjs +47 -81
- package/dist/esm/fill/formatAutoFillData.mjs.map +1 -1
- package/dist/esm/fill/formatAutoFilledFilePath.mjs +25 -19
- package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
- package/dist/esm/fill/formatFillData.mjs +50 -0
- package/dist/esm/fill/formatFillData.mjs.map +1 -0
- package/dist/esm/fill/groupLimiter.mjs +40 -0
- package/dist/esm/fill/groupLimiter.mjs.map +1 -0
- package/dist/esm/fill/index.mjs +4 -3
- package/dist/esm/fill/listTranslationsTasks.mjs +70 -0
- package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -0
- package/dist/esm/fill/test-original-case.mjs +10 -0
- package/dist/esm/fill/test-original-case.mjs.map +1 -0
- package/dist/esm/fill/translateDictionary.mjs +141 -0
- package/dist/esm/fill/translateDictionary.mjs.map +1 -0
- package/dist/esm/fill/writeAutoFill.mjs +44 -0
- package/dist/esm/fill/writeAutoFill.mjs.map +1 -0
- package/dist/esm/fill/writeFill.mjs +45 -0
- package/dist/esm/fill/writeFill.mjs.map +1 -0
- package/dist/esm/getTargetDictionary.mjs +27 -48
- package/dist/esm/getTargetDictionary.mjs.map +1 -1
- package/dist/esm/index.mjs +15 -13
- package/dist/esm/listContentDeclaration.mjs +28 -43
- package/dist/esm/listContentDeclaration.mjs.map +1 -1
- package/dist/esm/liveSync.mjs +135 -187
- package/dist/esm/liveSync.mjs.map +1 -1
- package/dist/esm/pull.mjs +125 -178
- package/dist/esm/pull.mjs.map +1 -1
- package/dist/esm/push/pullLog.mjs +99 -125
- package/dist/esm/push/pullLog.mjs.map +1 -1
- package/dist/esm/push/push.mjs +149 -221
- package/dist/esm/push/push.mjs.map +1 -1
- package/dist/esm/pushConfig.mjs +14 -23
- package/dist/esm/pushConfig.mjs.map +1 -1
- package/dist/esm/pushLog.mjs +85 -109
- package/dist/esm/pushLog.mjs.map +1 -1
- package/dist/esm/reviewDoc.mjs +167 -264
- package/dist/esm/reviewDoc.mjs.map +1 -1
- package/dist/esm/test/index.mjs +47 -73
- package/dist/esm/test/index.mjs.map +1 -1
- package/dist/esm/test/listMissingTranslations.mjs +30 -41
- package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
- package/dist/esm/translateDoc.mjs +114 -193
- package/dist/esm/translateDoc.mjs.map +1 -1
- package/dist/esm/utils/calculateChunks.mjs +83 -91
- package/dist/esm/utils/calculateChunks.mjs.map +1 -1
- package/dist/esm/utils/checkAccess.mjs +28 -46
- package/dist/esm/utils/checkAccess.mjs.map +1 -1
- package/dist/esm/utils/checkFileModifiedRange.mjs +73 -65
- package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
- package/dist/esm/utils/checkLastUpdateTime.mjs +15 -6
- package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
- package/dist/esm/utils/chunkInference.mjs +24 -24
- package/dist/esm/utils/chunkInference.mjs.map +1 -1
- package/dist/esm/utils/fixChunkStartEndChars.mjs +22 -18
- package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
- package/dist/esm/utils/formatTimeDiff.mjs +16 -19
- package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs +11 -8
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
- package/dist/esm/utils/getOutputFilePath.mjs +70 -62
- package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
- package/dist/esm/utils/getParentPackageJSON.mjs +16 -20
- package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
- package/dist/esm/utils/listSpecialChars.mjs +48 -49
- package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
- package/dist/esm/utils/mapChunksBetweenFiles.mjs +87 -107
- package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
- package/dist/esm/utils/reorderParagraphs.mjs +85 -93
- package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
- package/dist/esm/watch.mjs +17 -17
- package/dist/esm/watch.mjs.map +1 -1
- package/dist/types/IntlayerEventListener.d.ts +63 -59
- package/dist/types/IntlayerEventListener.d.ts.map +1 -1
- package/dist/types/build.d.ts +10 -7
- package/dist/types/build.d.ts.map +1 -1
- package/dist/types/cli.d.ts +13 -10
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +7 -4
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/editor.d.ts +6 -4
- package/dist/types/editor.d.ts.map +1 -1
- package/dist/types/fill/fill.d.ts +20 -14
- package/dist/types/fill/fill.d.ts.map +1 -1
- package/dist/types/fill/formatAutoFillData.d.ts +10 -7
- package/dist/types/fill/formatAutoFillData.d.ts.map +1 -1
- package/dist/types/fill/formatAutoFilledFilePath.d.ts +6 -2
- package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -1
- package/dist/types/fill/formatFillData.d.ts +12 -0
- package/dist/types/fill/formatFillData.d.ts.map +1 -0
- package/dist/types/fill/groupLimiter.d.ts +15 -0
- package/dist/types/fill/groupLimiter.d.ts.map +1 -0
- package/dist/types/fill/index.d.ts +3 -3
- package/dist/types/fill/listTranslationsTasks.d.ts +15 -0
- package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -0
- package/dist/types/fill/test-original-case.d.ts +1 -0
- package/dist/types/fill/translateDictionary.d.ts +19 -0
- package/dist/types/fill/translateDictionary.d.ts.map +1 -0
- package/dist/types/fill/writeAutoFill.d.ts +7 -0
- package/dist/types/fill/writeAutoFill.d.ts.map +1 -0
- package/dist/types/fill/writeFill.d.ts +7 -0
- package/dist/types/fill/writeFill.d.ts.map +1 -0
- package/dist/types/getTargetDictionary.d.ts +17 -13
- package/dist/types/getTargetDictionary.d.ts.map +1 -1
- package/dist/types/index.d.ts +15 -14
- package/dist/types/listContentDeclaration.d.ts +10 -7
- package/dist/types/listContentDeclaration.d.ts.map +1 -1
- package/dist/types/liveSync.d.ts +8 -3
- package/dist/types/liveSync.d.ts.map +1 -1
- package/dist/types/pull.d.ts +9 -6
- package/dist/types/pull.d.ts.map +1 -1
- package/dist/types/push/pullLog.d.ts +25 -21
- package/dist/types/push/pullLog.d.ts.map +1 -1
- package/dist/types/push/push.d.ts +13 -9
- package/dist/types/push/push.d.ts.map +1 -1
- package/dist/types/pushConfig.d.ts +7 -4
- package/dist/types/pushConfig.d.ts.map +1 -1
- package/dist/types/pushLog.d.ts +23 -20
- package/dist/types/pushLog.d.ts.map +1 -1
- package/dist/types/reviewDoc.d.ts +34 -17
- package/dist/types/reviewDoc.d.ts.map +1 -1
- package/dist/types/test/index.d.ts +9 -5
- package/dist/types/test/index.d.ts.map +1 -1
- package/dist/types/test/listMissingTranslations.d.ts +14 -10
- package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
- package/dist/types/translateDoc.d.ts +34 -17
- package/dist/types/translateDoc.d.ts.map +1 -1
- package/dist/types/utils/calculateChunks.d.ts +10 -7
- package/dist/types/utils/calculateChunks.d.ts.map +1 -1
- package/dist/types/utils/checkAccess.d.ts +8 -4
- package/dist/types/utils/checkAccess.d.ts.map +1 -1
- package/dist/types/utils/checkFileModifiedRange.d.ts +8 -6
- package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
- package/dist/types/utils/checkLastUpdateTime.d.ts +4 -1
- package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
- package/dist/types/utils/chunkInference.d.ts +9 -6
- package/dist/types/utils/chunkInference.d.ts.map +1 -1
- package/dist/types/utils/fixChunkStartEndChars.d.ts +4 -1
- package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
- package/dist/types/utils/formatTimeDiff.d.ts +4 -1
- package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
- package/dist/types/utils/getIsFileUpdatedRecently.d.ts +4 -1
- package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
- package/dist/types/utils/getOutputFilePath.d.ts +7 -2
- package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
- package/dist/types/utils/getParentPackageJSON.d.ts +30 -28
- package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
- package/dist/types/utils/listSpecialChars.d.ts +9 -7
- package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
- package/dist/types/utils/mapChunksBetweenFiles.d.ts +10 -6
- package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
- package/dist/types/utils/reorderParagraphs.d.ts +4 -1
- package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
- package/dist/types/watch.d.ts +9 -6
- package/dist/types/watch.d.ts.map +1 -1
- package/package.json +42 -47
- package/LICENSE +0 -202
- package/dist/cjs/fill/autoFill.cjs +0 -105
- package/dist/cjs/fill/autoFill.cjs.map +0 -1
- package/dist/cjs/fill/index.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/utils/getChunk.cjs +0 -77
- package/dist/cjs/utils/getChunk.cjs.map +0 -1
- package/dist/cjs/utils/splitTextByLine.cjs +0 -35
- package/dist/cjs/utils/splitTextByLine.cjs.map +0 -1
- package/dist/esm/fill/autoFill.mjs +0 -92
- package/dist/esm/fill/autoFill.mjs.map +0 -1
- package/dist/esm/fill/index.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/prompts/REVIEW_PROMPT.md +0 -37
- package/dist/esm/prompts/TRANSLATE_PROMPT.md +0 -38
- package/dist/esm/utils/calculrateChunkTest.md +0 -9
- package/dist/esm/utils/getChunk.mjs +0 -53
- package/dist/esm/utils/getChunk.mjs.map +0 -1
- package/dist/esm/utils/splitTextByLine.mjs +0 -11
- package/dist/esm/utils/splitTextByLine.mjs.map +0 -1
- package/dist/types/fill/autoFill.d.ts +0 -4
- package/dist/types/fill/autoFill.d.ts.map +0 -1
- package/dist/types/fill/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/utils/getChunk.d.ts +0 -9
- package/dist/types/utils/getChunk.d.ts.map +0 -1
- package/dist/types/utils/splitTextByLine.d.ts +0 -2
- package/dist/types/utils/splitTextByLine.d.ts.map +0 -1
- /package/dist/{cjs → assets}/prompts/REVIEW_PROMPT.md +0 -0
- /package/dist/{cjs → assets}/prompts/TRANSLATE_PROMPT.md +0 -0
- /package/dist/{cjs/utils/calculrateChunkTest.md → assets/utils/_calculateChunkTest.md} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_fill_formatFillData = require('./formatFillData.cjs');
|
|
3
|
+
let __intlayer_chokidar = require("@intlayer/chokidar");
|
|
4
|
+
__intlayer_chokidar = require_rolldown_runtime.__toESM(__intlayer_chokidar);
|
|
5
|
+
let __intlayer_config = require("@intlayer/config");
|
|
6
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
9
|
+
let __intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
|
|
10
|
+
__intlayer_dictionaries_entry = require_rolldown_runtime.__toESM(__intlayer_dictionaries_entry);
|
|
11
|
+
|
|
12
|
+
//#region src/fill/writeFill.ts
|
|
13
|
+
const writeFill = async (contentDeclarationFile, outputLocales, parentLocales, configuration) => {
|
|
14
|
+
const appLogger = (0, __intlayer_config.getAppLogger)(configuration);
|
|
15
|
+
const fullDictionary = (0, __intlayer_dictionaries_entry.getDictionaries)(configuration)[contentDeclarationFile.key];
|
|
16
|
+
const { filePath } = contentDeclarationFile;
|
|
17
|
+
if (!filePath) {
|
|
18
|
+
appLogger("No file path found for dictionary", { level: "error" });
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const autoFillOptions = contentDeclarationFile.fill ?? configuration.content.fill;
|
|
22
|
+
if (typeof autoFillOptions === "boolean" && autoFillOptions === false) {
|
|
23
|
+
appLogger(`Auto fill is disabled for '${(0, __intlayer_config.colorizeKey)(fullDictionary.key)}'`, { level: "info" });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const autoFillData = require_fill_formatFillData.formatFillData(autoFillOptions, (outputLocales ?? configuration.internationalization.locales).filter((locale) => !parentLocales?.includes(locale)), filePath, fullDictionary.key, configuration);
|
|
27
|
+
for await (const output of autoFillData) {
|
|
28
|
+
if (!output.filePath) {
|
|
29
|
+
appLogger(`No file path found for auto filled content declaration for '${(0, __intlayer_config.colorizeKey)(fullDictionary.key)}'`, { level: "error" });
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const { fill,...rest } = contentDeclarationFile;
|
|
33
|
+
const relativeFilePath = (0, node_path.relative)(configuration.content.baseDir, output.filePath);
|
|
34
|
+
await (0, __intlayer_chokidar.writeContentDeclaration)({
|
|
35
|
+
...rest,
|
|
36
|
+
filled: true,
|
|
37
|
+
locale: output.isPerLocale ? output.localeList[0] : void 0,
|
|
38
|
+
localId: `${contentDeclarationFile.key}::local::${relativeFilePath}`,
|
|
39
|
+
filePath: relativeFilePath
|
|
40
|
+
}, configuration, { localeList: output.localeList });
|
|
41
|
+
if (output.isPerLocale) {
|
|
42
|
+
const sourceLocale = output.localeList[0];
|
|
43
|
+
appLogger(`Auto filled per-locale content declaration for '${(0, __intlayer_config.colorizeKey)(fullDictionary.key)}' written to ${(0, __intlayer_chokidar.formatPath)(output.filePath)} for locale ${(0, __intlayer_chokidar.formatLocale)(sourceLocale)}`, { level: "info" });
|
|
44
|
+
} else appLogger(`Auto filled content declaration for '${(0, __intlayer_config.colorizeKey)(fullDictionary.key)}' written to ${(0, __intlayer_chokidar.formatPath)(output.filePath)}`, { level: "info" });
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.writeFill = writeFill;
|
|
50
|
+
//# sourceMappingURL=writeFill.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeFill.cjs","names":["autoFillData: FillData[]","formatFillData"],"sources":["../../../src/fill/writeFill.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport {\n formatLocale,\n formatPath,\n writeContentDeclaration,\n} from '@intlayer/chokidar';\nimport { colorizeKey, getAppLogger } from '@intlayer/config';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary, Fill, IntlayerConfig, Locale } from '@intlayer/types';\nimport { type FillData, formatFillData } from './formatFillData';\n\nexport const writeFill = async (\n contentDeclarationFile: Dictionary,\n outputLocales: Locale[],\n parentLocales: Locale[],\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n const dictionaries = getDictionaries(configuration);\n\n const fullDictionary = dictionaries[contentDeclarationFile.key];\n\n const { filePath } = contentDeclarationFile;\n\n if (!filePath) {\n appLogger('No file path found for dictionary', {\n level: 'error',\n });\n return;\n }\n\n const autoFillOptions =\n contentDeclarationFile.fill ?? configuration.content.fill;\n\n if (\n typeof autoFillOptions === 'boolean' &&\n (autoFillOptions as boolean) === false\n ) {\n appLogger(\n `Auto fill is disabled for '${colorizeKey(fullDictionary.key)}'`,\n {\n level: 'info',\n }\n );\n return;\n }\n\n const localeList: Locale[] = (\n outputLocales ?? configuration.internationalization.locales\n ).filter((locale) => !parentLocales?.includes(locale));\n\n const autoFillData: FillData[] = formatFillData(\n autoFillOptions as Fill,\n localeList,\n filePath,\n fullDictionary.key,\n configuration\n );\n\n for await (const output of autoFillData) {\n if (!output.filePath) {\n appLogger(\n `No file path found for auto filled content declaration for '${colorizeKey(fullDictionary.key)}'`,\n {\n level: 'error',\n }\n );\n continue;\n }\n\n // biome-ignore lint/correctness/noUnusedVariables: Just filtering out the fill property\n const { fill, ...rest } = contentDeclarationFile;\n\n const relativeFilePath = relative(\n configuration.content.baseDir,\n output.filePath\n );\n\n // write file\n await writeContentDeclaration(\n {\n ...rest,\n filled: true,\n locale: output.isPerLocale ? output.localeList[0] : undefined,\n localId: `${contentDeclarationFile.key}::local::${relativeFilePath}`,\n filePath: relativeFilePath,\n },\n configuration,\n {\n localeList: output.localeList,\n }\n );\n\n if (output.isPerLocale) {\n const sourceLocale = output.localeList[0];\n\n appLogger(\n `Auto filled per-locale content declaration for '${colorizeKey(fullDictionary.key)}' written to ${formatPath(output.filePath)} for locale ${formatLocale(sourceLocale)}`,\n {\n level: 'info',\n }\n );\n } else {\n appLogger(\n `Auto filled content declaration for '${colorizeKey(fullDictionary.key)}' written to ${formatPath(output.filePath)}`,\n {\n level: 'info',\n }\n );\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,YAAY,OACvB,wBACA,eACA,eACA,kBACG;CACH,MAAM,gDAAyB,cAAc;CAG7C,MAAM,oEAF+B,cAAc,CAEf,uBAAuB;CAE3D,MAAM,EAAE,aAAa;AAErB,KAAI,CAAC,UAAU;AACb,YAAU,qCAAqC,EAC7C,OAAO,SACR,CAAC;AACF;;CAGF,MAAM,kBACJ,uBAAuB,QAAQ,cAAc,QAAQ;AAEvD,KACE,OAAO,oBAAoB,aAC1B,oBAAgC,OACjC;AACA,YACE,iEAA0C,eAAe,IAAI,CAAC,IAC9D,EACE,OAAO,QACR,CACF;AACD;;CAOF,MAAMA,eAA2BC,2CAC/B,kBAJA,iBAAiB,cAAc,qBAAqB,SACpD,QAAQ,WAAW,CAAC,eAAe,SAAS,OAAO,CAAC,EAKpD,UACA,eAAe,KACf,cACD;AAED,YAAW,MAAM,UAAU,cAAc;AACvC,MAAI,CAAC,OAAO,UAAU;AACpB,aACE,kGAA2E,eAAe,IAAI,CAAC,IAC/F,EACE,OAAO,SACR,CACF;AACD;;EAIF,MAAM,EAAE,KAAM,GAAG,SAAS;EAE1B,MAAM,2CACJ,cAAc,QAAQ,SACtB,OAAO,SACR;AAGD,yDACE;GACE,GAAG;GACH,QAAQ;GACR,QAAQ,OAAO,cAAc,OAAO,WAAW,KAAK;GACpD,SAAS,GAAG,uBAAuB,IAAI,WAAW;GAClD,UAAU;GACX,EACD,eACA,EACE,YAAY,OAAO,YACpB,CACF;AAED,MAAI,OAAO,aAAa;GACtB,MAAM,eAAe,OAAO,WAAW;AAEvC,aACE,sFAA+D,eAAe,IAAI,CAAC,mDAA0B,OAAO,SAAS,CAAC,oDAA2B,aAAa,IACtK,EACE,OAAO,QACR,CACF;QAED,WACE,2EAAoD,eAAe,IAAI,CAAC,mDAA0B,OAAO,SAAS,IAClH,EACE,OAAO,QACR,CACF"}
|
|
@@ -1,80 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getTargetDictionary_exports = {};
|
|
20
|
-
__export(getTargetDictionary_exports, {
|
|
21
|
-
ensureArray: () => ensureArray,
|
|
22
|
-
getTargetUnmergedDictionaries: () => getTargetUnmergedDictionaries
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(getTargetDictionary_exports);
|
|
25
|
-
var import_chokidar = require("@intlayer/chokidar");
|
|
26
|
-
var import_config = require("@intlayer/config");
|
|
27
|
-
var import_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
|
|
28
|
-
var import_path = require("path");
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __intlayer_chokidar = require("@intlayer/chokidar");
|
|
3
|
+
__intlayer_chokidar = require_rolldown_runtime.__toESM(__intlayer_chokidar);
|
|
4
|
+
let __intlayer_config = require("@intlayer/config");
|
|
5
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
8
|
+
let __intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
|
|
9
|
+
__intlayer_unmerged_dictionaries_entry = require_rolldown_runtime.__toESM(__intlayer_unmerged_dictionaries_entry);
|
|
10
|
+
|
|
11
|
+
//#region src/getTargetDictionary.ts
|
|
29
12
|
const ensureArray = (value) => [value].flat();
|
|
30
13
|
const getTargetUnmergedDictionaries = async (options) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(dict) => !ensureArray(options.excludedKeys)?.includes(dict.key)
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
if (typeof options.pathFilter !== "undefined") {
|
|
56
|
-
result = result.filter(
|
|
57
|
-
(dict) => ensureArray(options.pathFilter)?.includes(dict.filePath ?? "")
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
if (typeof options.filter !== "undefined") {
|
|
61
|
-
result = result.filter(options.filter);
|
|
62
|
-
}
|
|
63
|
-
const gitOptions = options.gitOptions;
|
|
64
|
-
if (gitOptions) {
|
|
65
|
-
const gitChangedFiles = await (0, import_chokidar.listGitFiles)(gitOptions);
|
|
66
|
-
if (gitChangedFiles) {
|
|
67
|
-
result = result.filter((dict) => {
|
|
68
|
-
if (!dict.filePath) return false;
|
|
69
|
-
return gitChangedFiles.some((gitFile) => dict.filePath === gitFile);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return result.filter((dict) => !dict.autoFilled);
|
|
14
|
+
const configuration = (0, __intlayer_config.getConfiguration)(options?.configOptions);
|
|
15
|
+
const { baseDir } = configuration.content;
|
|
16
|
+
const unmergedDictionariesRecord = (0, __intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(configuration);
|
|
17
|
+
let result = Object.values(unmergedDictionariesRecord).flat();
|
|
18
|
+
if (typeof options?.file !== "undefined") {
|
|
19
|
+
const relativeFilePaths = ensureArray(options?.file).map((file) => file.startsWith("/") ? (0, node_path.relative)(baseDir, file) : (0, node_path.join)("./", file));
|
|
20
|
+
result = result.filter((dict) => dict.filePath && relativeFilePaths.includes(dict.filePath));
|
|
21
|
+
}
|
|
22
|
+
if (typeof options?.keys !== "undefined") result = result.filter((dict) => ensureArray(options?.keys)?.includes(dict.key));
|
|
23
|
+
if (typeof options?.excludedKeys !== "undefined") result = result.filter((dict) => !ensureArray(options?.excludedKeys)?.includes(dict.key));
|
|
24
|
+
if (typeof options?.pathFilter !== "undefined") result = result.filter((dict) => ensureArray(options?.pathFilter)?.includes(dict.filePath ?? ""));
|
|
25
|
+
if (typeof options?.filter !== "undefined") result = result.filter(options?.filter);
|
|
26
|
+
const gitOptions = options?.gitOptions;
|
|
27
|
+
if (gitOptions) {
|
|
28
|
+
const gitChangedFiles = await (0, __intlayer_chokidar.listGitFiles)(gitOptions);
|
|
29
|
+
if (gitChangedFiles) result = result.filter((dict) => {
|
|
30
|
+
if (!dict.filePath) return false;
|
|
31
|
+
return gitChangedFiles.some((gitFile) => dict.filePath === gitFile);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return result.filter((dict) => !dict.filled);
|
|
74
35
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.ensureArray = ensureArray;
|
|
39
|
+
exports.getTargetUnmergedDictionaries = getTargetUnmergedDictionaries;
|
|
80
40
|
//# sourceMappingURL=getTargetDictionary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getTargetDictionary.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"getTargetDictionary.cjs","names":[],"sources":["../../src/getTargetDictionary.ts"],"sourcesContent":["import { join, relative } from 'node:path';\nimport { type ListGitFilesOptions, listGitFiles } from '@intlayer/chokidar';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\nexport const ensureArray = <T>(value: T | T[]): T[] => [value].flat() as T[];\n\n// Arguments for the fill function\nexport type GetTargetDictionaryOptions = {\n file?: string | string[];\n keys?: string | string[];\n excludedKeys?: string | string[];\n filter?: (entry: Dictionary) => boolean; // DictionaryEntry needs to be defined\n pathFilter?: string | string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n};\n\nexport const getTargetUnmergedDictionaries = async (\n options?: GetTargetDictionaryOptions\n): Promise<Dictionary[]> => {\n const configuration = getConfiguration(options?.configOptions);\n\n const { baseDir } = configuration.content;\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n let result = Object.values(unmergedDictionariesRecord).flat();\n\n // 1. if filePath not defined, list all content declaration files based on unmerged dictionaries list\n if (typeof options?.file !== 'undefined') {\n const fileArray = ensureArray(options?.file);\n const relativeFilePaths = fileArray.map((file) =>\n file.startsWith('/') ? relative(baseDir, file) : join('./', file)\n );\n\n result = result.filter(\n (dict) =>\n dict.filePath &&\n // Check for absolute path\n relativeFilePaths.includes(dict.filePath)\n );\n }\n\n if (typeof options?.keys !== 'undefined') {\n result = result.filter((dict) =>\n ensureArray(options?.keys)?.includes(dict.key)\n );\n }\n\n if (typeof options?.excludedKeys !== 'undefined') {\n result = result.filter(\n (dict) => !ensureArray(options?.excludedKeys)?.includes(dict.key)\n );\n }\n\n if (typeof options?.pathFilter !== 'undefined') {\n result = result.filter((dict) =>\n ensureArray(options?.pathFilter)?.includes(dict.filePath ?? '')\n );\n }\n\n if (typeof options?.filter !== 'undefined') {\n result = result.filter(options?.filter);\n }\n\n const gitOptions = options?.gitOptions;\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n\n if (gitChangedFiles) {\n // Convert dictionary file paths to be relative to git root for comparison\n\n // Filter dictionaries based on git changed files\n result = result.filter((dict) => {\n if (!dict.filePath) return false;\n\n return gitChangedFiles.some((gitFile) => dict.filePath === gitFile);\n });\n }\n }\n\n return result.filter((dict) => !dict.filled);\n};\n"],"mappings":";;;;;;;;;;;AASA,MAAa,eAAkB,UAAwB,CAAC,MAAM,CAAC,MAAM;AAarE,MAAa,gCAAgC,OAC3C,YAC0B;CAC1B,MAAM,wDAAiC,SAAS,cAAc;CAE9D,MAAM,EAAE,YAAY,cAAc;CAElC,MAAM,iGAAqD,cAAc;CACzE,IAAI,SAAS,OAAO,OAAO,2BAA2B,CAAC,MAAM;AAG7D,KAAI,OAAO,SAAS,SAAS,aAAa;EAExC,MAAM,oBADY,YAAY,SAAS,KAAK,CACR,KAAK,SACvC,KAAK,WAAW,IAAI,2BAAY,SAAS,KAAK,uBAAQ,MAAM,KAAK,CAClE;AAED,WAAS,OAAO,QACb,SACC,KAAK,YAEL,kBAAkB,SAAS,KAAK,SAAS,CAC5C;;AAGH,KAAI,OAAO,SAAS,SAAS,YAC3B,UAAS,OAAO,QAAQ,SACtB,YAAY,SAAS,KAAK,EAAE,SAAS,KAAK,IAAI,CAC/C;AAGH,KAAI,OAAO,SAAS,iBAAiB,YACnC,UAAS,OAAO,QACb,SAAS,CAAC,YAAY,SAAS,aAAa,EAAE,SAAS,KAAK,IAAI,CAClE;AAGH,KAAI,OAAO,SAAS,eAAe,YACjC,UAAS,OAAO,QAAQ,SACtB,YAAY,SAAS,WAAW,EAAE,SAAS,KAAK,YAAY,GAAG,CAChE;AAGH,KAAI,OAAO,SAAS,WAAW,YAC7B,UAAS,OAAO,OAAO,SAAS,OAAO;CAGzC,MAAM,aAAa,SAAS;AAC5B,KAAI,YAAY;EACd,MAAM,kBAAkB,4CAAmB,WAAW;AAEtD,MAAI,gBAIF,UAAS,OAAO,QAAQ,SAAS;AAC/B,OAAI,CAAC,KAAK,SAAU,QAAO;AAE3B,UAAO,gBAAgB,MAAM,YAAY,KAAK,aAAa,QAAQ;IACnE;;AAIN,QAAO,OAAO,QAAQ,SAAS,CAAC,KAAK,OAAO"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,45 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...require('./build.cjs'),
|
|
33
|
-
...require('./cli.cjs'),
|
|
34
|
-
...require('./editor.cjs'),
|
|
35
|
-
...require('./fill/fill.cjs'),
|
|
36
|
-
...require('./listContentDeclaration.cjs'),
|
|
37
|
-
...require('./liveSync.cjs'),
|
|
38
|
-
...require('./pull.cjs'),
|
|
39
|
-
...require('./push/push.cjs'),
|
|
40
|
-
...require('./pushConfig.cjs'),
|
|
41
|
-
...require('./reviewDoc.cjs'),
|
|
42
|
-
...require('./test/index.cjs'),
|
|
43
|
-
...require('./translateDoc.cjs')
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
const require_build = require('./build.cjs');
|
|
2
|
+
const require_editor = require('./editor.cjs');
|
|
3
|
+
const require_fill_fill = require('./fill/fill.cjs');
|
|
4
|
+
const require_listContentDeclaration = require('./listContentDeclaration.cjs');
|
|
5
|
+
const require_liveSync = require('./liveSync.cjs');
|
|
6
|
+
const require_pull = require('./pull.cjs');
|
|
7
|
+
const require_push_push = require('./push/push.cjs');
|
|
8
|
+
const require_pushConfig = require('./pushConfig.cjs');
|
|
9
|
+
const require_reviewDoc = require('./reviewDoc.cjs');
|
|
10
|
+
const require_test_listMissingTranslations = require('./test/listMissingTranslations.cjs');
|
|
11
|
+
const require_test_index = require('./test/index.cjs');
|
|
12
|
+
const require_translateDoc = require('./translateDoc.cjs');
|
|
13
|
+
const require_cli = require('./cli.cjs');
|
|
14
|
+
|
|
15
|
+
exports.build = require_build.build;
|
|
16
|
+
exports.dirname = require_cli.dirname;
|
|
17
|
+
exports.fill = require_fill_fill.fill;
|
|
18
|
+
exports.listContentDeclaration = require_listContentDeclaration.listContentDeclaration;
|
|
19
|
+
exports.listContentDeclarationRows = require_listContentDeclaration.listContentDeclarationRows;
|
|
20
|
+
exports.listMissingTranslations = require_test_listMissingTranslations.listMissingTranslations;
|
|
21
|
+
exports.liveSync = require_liveSync.liveSync;
|
|
22
|
+
exports.pull = require_pull.pull;
|
|
23
|
+
exports.push = require_push_push.push;
|
|
24
|
+
exports.pushConfig = require_pushConfig.pushConfig;
|
|
25
|
+
exports.reviewDoc = require_reviewDoc.reviewDoc;
|
|
26
|
+
exports.reviewFile = require_reviewDoc.reviewFile;
|
|
27
|
+
exports.setAPI = require_cli.setAPI;
|
|
28
|
+
exports.startEditor = require_editor.startEditor;
|
|
29
|
+
exports.testMissingTranslations = require_test_index.testMissingTranslations;
|
|
30
|
+
exports.translateDoc = require_translateDoc.translateDoc;
|
|
31
|
+
exports.translateFile = require_translateDoc.translateFile;
|
|
@@ -1,69 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var listContentDeclaration_exports = {};
|
|
20
|
-
__export(listContentDeclaration_exports, {
|
|
21
|
-
listContentDeclaration: () => listContentDeclaration,
|
|
22
|
-
listContentDeclarationRows: () => listContentDeclarationRows
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(listContentDeclaration_exports);
|
|
25
|
-
var import_chokidar = require("@intlayer/chokidar");
|
|
26
|
-
var import_config = require("@intlayer/config");
|
|
27
|
-
var import_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
|
|
28
|
-
var import_path = require("path");
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __intlayer_chokidar = require("@intlayer/chokidar");
|
|
3
|
+
__intlayer_chokidar = require_rolldown_runtime.__toESM(__intlayer_chokidar);
|
|
4
|
+
let __intlayer_config = require("@intlayer/config");
|
|
5
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
8
|
+
let __intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
|
|
9
|
+
__intlayer_unmerged_dictionaries_entry = require_rolldown_runtime.__toESM(__intlayer_unmerged_dictionaries_entry);
|
|
10
|
+
|
|
11
|
+
//#region src/listContentDeclaration.ts
|
|
29
12
|
const listContentDeclarationRows = (options) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return rows;
|
|
13
|
+
const config = (0, __intlayer_config.getConfiguration)(options?.configOptions);
|
|
14
|
+
const unmergedDictionariesRecord = (0, __intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(config);
|
|
15
|
+
return Object.values(unmergedDictionariesRecord).flat().map((dictionary) => ({
|
|
16
|
+
key: dictionary.key ?? "",
|
|
17
|
+
path: (0, node_path.relative)(config.content.baseDir, dictionary.filePath ?? "Remote")
|
|
18
|
+
}));
|
|
37
19
|
};
|
|
38
20
|
const listContentDeclaration = (options) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
].join("")
|
|
55
|
-
);
|
|
56
|
-
appLogger(`Content declaration files:`);
|
|
57
|
-
lines.forEach((l) => {
|
|
58
|
-
appLogger(l, {
|
|
59
|
-
level: "info"
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
appLogger(`Total content declaration files: ${(0, import_config.colorizeNumber)(rows.length)}`);
|
|
21
|
+
const appLogger = (0, __intlayer_config.getAppLogger)((0, __intlayer_config.getConfiguration)(options?.configOptions), { config: { prefix: "" } });
|
|
22
|
+
const rows = listContentDeclarationRows(options);
|
|
23
|
+
const lines = rows.map((r) => [
|
|
24
|
+
(0, __intlayer_config.colon)(` - ${(0, __intlayer_config.colorizeKey)(r.key)}`, {
|
|
25
|
+
colSize: rows.map((r$1) => r$1.key.length),
|
|
26
|
+
maxSize: 60
|
|
27
|
+
}),
|
|
28
|
+
" - ",
|
|
29
|
+
(0, __intlayer_chokidar.formatPath)(r.path)
|
|
30
|
+
].join(""));
|
|
31
|
+
appLogger(`Content declaration files:`);
|
|
32
|
+
lines.forEach((l) => {
|
|
33
|
+
appLogger(l, { level: "info" });
|
|
34
|
+
});
|
|
35
|
+
appLogger(`Total content declaration files: ${(0, __intlayer_config.colorizeNumber)(rows.length)}`);
|
|
63
36
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.listContentDeclaration = listContentDeclaration;
|
|
40
|
+
exports.listContentDeclarationRows = listContentDeclarationRows;
|
|
69
41
|
//# sourceMappingURL=listContentDeclaration.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { formatPath } from '@intlayer/chokidar';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n
|
|
1
|
+
{"version":3,"file":"listContentDeclaration.cjs","names":["r"],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { formatPath } from '@intlayer/chokidar';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\ntype ListContentDeclarationOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const listContentDeclarationRows = (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n const rows = Object.values(unmergedDictionariesRecord)\n .flat()\n .map((dictionary) => ({\n key: dictionary.key ?? '',\n path: relative(config.content.baseDir, dictionary.filePath ?? 'Remote'),\n }));\n return rows;\n};\n\nexport const listContentDeclaration = (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n const rows = listContentDeclarationRows(options);\n\n const lines = rows.map((r) =>\n [\n colon(` - ${colorizeKey(r.key)}`, {\n colSize: rows.map((r) => r.key.length),\n maxSize: 60,\n }),\n ' - ',\n formatPath(r.path),\n ].join('')\n );\n\n appLogger(`Content declaration files:`);\n\n lines.forEach((l) => {\n appLogger(l, {\n level: 'info',\n });\n });\n\n appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,8BACX,YACG;CACH,MAAM,iDAA0B,SAAS,cAAc;CAEvD,MAAM,iGAAqD,OAAO;AAQlE,QANa,OAAO,OAAO,2BAA2B,CACnD,MAAM,CACN,KAAK,gBAAgB;EACpB,KAAK,WAAW,OAAO;EACvB,8BAAe,OAAO,QAAQ,SAAS,WAAW,YAAY,SAAS;EACxE,EAAE;;AAIP,MAAa,0BACX,YACG;CAEH,MAAM,wFAD0B,SAAS,cAAc,EAChB,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;CAEF,MAAM,OAAO,2BAA2B,QAAQ;CAEhD,MAAM,QAAQ,KAAK,KAAK,MACtB;+BACQ,yCAAkB,EAAE,IAAI,IAAI;GAChC,SAAS,KAAK,KAAK,QAAMA,IAAE,IAAI,OAAO;GACtC,SAAS;GACV,CAAC;EACF;sCACW,EAAE,KAAK;EACnB,CAAC,KAAK,GAAG,CACX;AAED,WAAU,6BAA6B;AAEvC,OAAM,SAAS,MAAM;AACnB,YAAU,GAAG,EACX,OAAO,QACR,CAAC;GACF;AAEF,WAAU,0EAAmD,KAAK,OAAO,GAAG"}
|