@intlayer/chokidar 5.5.2 → 5.5.4
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 +12 -3
- package/dist/cjs/chokidar/watcher.cjs.map +1 -1
- package/dist/cjs/cleanOutputDir.cjs +20 -3
- package/dist/cjs/cleanOutputDir.cjs.map +1 -1
- package/dist/cjs/getBuiltDynamicDictionariesPath.cjs +52 -0
- package/dist/cjs/getBuiltDynamicDictionariesPath.cjs.map +1 -0
- package/dist/cjs/{filterDictionaryLocales.cjs → getFilteredLocalesContent.cjs} +24 -12
- package/dist/cjs/getFilteredLocalesContent.cjs.map +1 -0
- package/dist/cjs/index.cjs +9 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +5 -5
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs +19 -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/formatDictionaryText.cjs +30 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs +107 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs +59 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs +65 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +44 -35
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
- package/dist/cjs/transpiler/dictionary_to_main/generateDictionaryListContent.cjs +1 -1
- package/dist/cjs/transpiler/dictionary_to_main/generateDictionaryListContent.cjs.map +1 -1
- package/dist/esm/chokidar/watcher.mjs +12 -3
- package/dist/esm/chokidar/watcher.mjs.map +1 -1
- package/dist/esm/cleanOutputDir.mjs +21 -4
- package/dist/esm/cleanOutputDir.mjs.map +1 -1
- package/dist/esm/getBuiltDynamicDictionariesPath.mjs +18 -0
- package/dist/esm/getBuiltDynamicDictionariesPath.mjs.map +1 -0
- package/dist/esm/getFilteredLocalesContent.mjs +49 -0
- package/dist/esm/getFilteredLocalesContent.mjs.map +1 -0
- package/dist/esm/index.mjs +6 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +5 -5
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs +19 -8
- 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/formatDictionaryText.mjs +6 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs +82 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs +35 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs +41 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +44 -35
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
- package/dist/esm/transpiler/dictionary_to_main/generateDictionaryListContent.mjs +1 -1
- package/dist/esm/transpiler/dictionary_to_main/generateDictionaryListContent.mjs.map +1 -1
- package/dist/types/chokidar/watcher.d.ts.map +1 -1
- package/dist/types/cleanOutputDir.d.ts.map +1 -1
- package/dist/types/getBuiltDynamicDictionariesPath.d.ts +5 -0
- package/dist/types/getBuiltDynamicDictionariesPath.d.ts.map +1 -0
- package/dist/types/getFilteredLocalesContent.d.ts +4 -0
- package/dist/types/getFilteredLocalesContent.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts +5 -1
- 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 +5 -1
- 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/formatDictionaryText.d.ts +2 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts +31 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts +25 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.d.ts +28 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +1 -0
- 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/package.json +14 -14
- package/dist/cjs/filterDictionaryLocales.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.cjs +0 -95
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.cjs.map +0 -1
- package/dist/esm/filterDictionaryLocales.mjs +0 -37
- package/dist/esm/filterDictionaryLocales.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.mjs +0 -69
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.mjs.map +0 -1
- package/dist/types/filterDictionaryLocales.d.ts +0 -4
- package/dist/types/filterDictionaryLocales.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.d.ts +0 -41
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This function generates a list of dictionaries in the main directory
|
|
3
3
|
*/
|
|
4
|
-
export declare const createDictionaryEntryPoint: (configuration?: import("@intlayer/config").IntlayerConfig, dictionariesKeys?: string[]) => void;
|
|
4
|
+
export declare const createDictionaryEntryPoint: (configuration?: import("@intlayer/config").IntlayerConfig, dictionariesKeys?: string[], formats?: ("cjs" | "esm")[]) => void;
|
|
5
5
|
//# sourceMappingURL=createDictionaryEntryPoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDictionaryEntryPoint.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createDictionaryEntryPoint.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"names":[],"mappings":"AA6BA;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACrC,yDAAkC,EAClC,mBAAmB,MAAM,EAAE,EAC3B,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,SAgD5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/chokidar",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.",
|
|
6
6
|
"keywords": [
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"fast-glob": "^3.3.3",
|
|
69
69
|
"p-limit": "^3.1.0",
|
|
70
70
|
"simple-git": "^3.27.0",
|
|
71
|
-
"@intlayer/config": "5.5.
|
|
72
|
-
"@intlayer/
|
|
73
|
-
"@intlayer/
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"intlayer": "5.5.
|
|
76
|
-
"
|
|
71
|
+
"@intlayer/config": "5.5.4",
|
|
72
|
+
"@intlayer/core": "5.5.4",
|
|
73
|
+
"@intlayer/dictionaries-entry": "5.5.4",
|
|
74
|
+
"@intlayer/api": "5.5.4",
|
|
75
|
+
"@intlayer/unmerged-dictionaries-entry": "5.5.4",
|
|
76
|
+
"intlayer": "5.5.4"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@changesets/cli": "2.28.1",
|
|
@@ -90,19 +90,19 @@
|
|
|
90
90
|
"tsc-alias": "^1.8.11",
|
|
91
91
|
"tsup": "^8.4.0",
|
|
92
92
|
"typescript": "^5.8.2",
|
|
93
|
+
"@intlayer/backend": "5.5.4",
|
|
93
94
|
"@utils/eslint-config": "1.0.4",
|
|
94
|
-
"@utils/ts-config": "1.0.4",
|
|
95
|
-
"@utils/tsup-config": "1.0.4",
|
|
96
95
|
"@utils/ts-config-types": "1.0.4",
|
|
97
|
-
"@
|
|
96
|
+
"@utils/tsup-config": "1.0.4",
|
|
97
|
+
"@utils/ts-config": "1.0.4"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"fast-glob": "^3.3.3",
|
|
101
101
|
"react": ">=16.0.0",
|
|
102
|
-
"@intlayer/api": "5.5.
|
|
103
|
-
"@intlayer/config": "5.5.
|
|
104
|
-
"
|
|
105
|
-
"intlayer": "5.5.
|
|
102
|
+
"@intlayer/api": "5.5.4",
|
|
103
|
+
"@intlayer/config": "5.5.4",
|
|
104
|
+
"intlayer": "5.5.4",
|
|
105
|
+
"@intlayer/core": "5.5.4"
|
|
106
106
|
},
|
|
107
107
|
"engines": {
|
|
108
108
|
"node": ">=14.18"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/filterDictionaryLocales.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n deepTransformNode,\n Dictionary,\n NodeType,\n Plugins,\n} from '@intlayer/core';\n\nconst filterTranlationsPlugin = (locales: Locales[]): Plugins => ({\n id: 'filter-translations-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node, props, deepTransformNode) => {\n const translationMap = node.translation as Record<Locales, string>;\n\n const filteredTranslationMap = Object.fromEntries(\n Object.entries(translationMap).filter(([key]) =>\n locales.includes(key as Locales)\n )\n );\n\n return {\n ...node,\n translation: deepTransformNode(filteredTranslationMap, {\n ...props,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Object, key: NodeType.Translation },\n ],\n }),\n };\n },\n});\n\nexport const filterDictionaryLocales = (\n dictionary: Dictionary,\n locales: Locales[]\n) => {\n return deepTransformNode(dictionary, {\n plugins: [filterTranlationsPlugin(locales)],\n dictionaryKey: dictionary.key,\n keyPath: [],\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAKO;AAEP,MAAM,0BAA0B,CAAC,aAAiC;AAAA,EAChE,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,qBAAS;AAAA,EAC1D,WAAW,CAAC,MAAM,OAAOA,uBAAsB;AAC7C,UAAM,iBAAiB,KAAK;AAE5B,UAAM,yBAAyB,OAAO;AAAA,MACpC,OAAO,QAAQ,cAAc,EAAE;AAAA,QAAO,CAAC,CAAC,GAAG,MACzC,QAAQ,SAAS,GAAc;AAAA,MACjC;AAAA,IACF;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,aAAaA,mBAAkB,wBAAwB;AAAA,QACrD,GAAG;AAAA,QACH,SAAS;AAAA,UACP,GAAG,MAAM;AAAA,UACT,EAAE,MAAM,qBAAS,QAAQ,KAAK,qBAAS,YAAY;AAAA,QACrD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,0BAA0B,CACrC,YACA,YACG;AACH,aAAO,+BAAkB,YAAY;AAAA,IACnC,SAAS,CAAC,wBAAwB,OAAO,CAAC;AAAA,IAC1C,eAAe,WAAW;AAAA,IAC1B,SAAS,CAAC;AAAA,EACZ,CAAC;AACH;","names":["deepTransformNode"]}
|
package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.cjs
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var writeDictionary_exports = {};
|
|
20
|
-
__export(writeDictionary_exports, {
|
|
21
|
-
writeDictionary: () => writeDictionary,
|
|
22
|
-
writeFinalDictionaries: () => writeFinalDictionaries,
|
|
23
|
-
writeUnmergedDictionaries: () => writeUnmergedDictionaries
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(writeDictionary_exports);
|
|
26
|
-
var import_config = require("@intlayer/config");
|
|
27
|
-
var import_promises = require("fs/promises");
|
|
28
|
-
var import_path = require("path");
|
|
29
|
-
var import_mergeDictionaries = require('../../../mergeDictionaries.cjs');
|
|
30
|
-
var import_processPerLocaleDictionary = require('../../../processPerLocaleDictionary.cjs');
|
|
31
|
-
const groupDictionariesByKey = (dictionaries) => {
|
|
32
|
-
return dictionaries.reduce(
|
|
33
|
-
(acc, dictionary) => {
|
|
34
|
-
const key = dictionary.key;
|
|
35
|
-
if (!acc[key]) {
|
|
36
|
-
acc[key] = [];
|
|
37
|
-
}
|
|
38
|
-
acc[key].push(dictionary);
|
|
39
|
-
return acc;
|
|
40
|
-
},
|
|
41
|
-
{}
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
const writeUnmergedDictionaries = async (dictionaries, configuration = (0, import_config.getConfiguration)()) => {
|
|
45
|
-
const { unmergedDictionariesDir } = configuration.content;
|
|
46
|
-
await (0, import_promises.mkdir)(unmergedDictionariesDir, { recursive: true });
|
|
47
|
-
const groupedDictionaries = groupDictionariesByKey(dictionaries);
|
|
48
|
-
for (const [key, dictionaries2] of Object.entries(groupedDictionaries)) {
|
|
49
|
-
const isDevelopment = process.env.NODE_ENV === "development";
|
|
50
|
-
const contentString = isDevelopment ? JSON.stringify(dictionaries2, null, 2) : JSON.stringify(dictionaries2);
|
|
51
|
-
const outputFileName = `${key}.json`;
|
|
52
|
-
const unmergedFilePath = (0, import_path.resolve)(unmergedDictionariesDir, outputFileName);
|
|
53
|
-
await (0, import_promises.writeFile)(unmergedFilePath, contentString, "utf8").catch((err) => {
|
|
54
|
-
console.error(`Error creating unmerged ${outputFileName}:`, err);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return groupedDictionaries;
|
|
58
|
-
};
|
|
59
|
-
const writeFinalDictionaries = async (groupedDictionaries, configuration = (0, import_config.getConfiguration)()) => {
|
|
60
|
-
const { dictionariesDir } = configuration.content;
|
|
61
|
-
const resultDictionariesPaths = [];
|
|
62
|
-
for (const [key, dictionaries] of Object.entries(groupedDictionaries)) {
|
|
63
|
-
const multiLocaleDictionaries = dictionaries.map(
|
|
64
|
-
(dictionary) => (0, import_processPerLocaleDictionary.processPerLocaleDictionary)(dictionary)
|
|
65
|
-
);
|
|
66
|
-
const mergedDictionary = (0, import_mergeDictionaries.mergeDictionaries)(multiLocaleDictionaries);
|
|
67
|
-
const isDevelopment = process.env.NODE_ENV === "development";
|
|
68
|
-
const contentString = isDevelopment ? JSON.stringify(mergedDictionary, null, 2) : JSON.stringify(mergedDictionary);
|
|
69
|
-
const outputFileName = `${key}.json`;
|
|
70
|
-
const resultFilePath = (0, import_path.resolve)(dictionariesDir, outputFileName);
|
|
71
|
-
await (0, import_promises.writeFile)(resultFilePath, contentString, "utf8").catch((err) => {
|
|
72
|
-
console.error(`Error creating merged ${outputFileName}:`, err);
|
|
73
|
-
});
|
|
74
|
-
resultDictionariesPaths.push(resultFilePath);
|
|
75
|
-
}
|
|
76
|
-
return resultDictionariesPaths;
|
|
77
|
-
};
|
|
78
|
-
const writeDictionary = async (dictionaries, configuration = (0, import_config.getConfiguration)()) => {
|
|
79
|
-
const unmergedDictionaries = await writeUnmergedDictionaries(
|
|
80
|
-
dictionaries,
|
|
81
|
-
configuration
|
|
82
|
-
);
|
|
83
|
-
const finalDictionaries = await writeFinalDictionaries(
|
|
84
|
-
unmergedDictionaries,
|
|
85
|
-
configuration
|
|
86
|
-
);
|
|
87
|
-
return finalDictionaries;
|
|
88
|
-
};
|
|
89
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
-
0 && (module.exports = {
|
|
91
|
-
writeDictionary,
|
|
92
|
-
writeFinalDictionaries,
|
|
93
|
-
writeUnmergedDictionaries
|
|
94
|
-
});
|
|
95
|
-
//# sourceMappingURL=writeDictionary.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { mergeDictionaries } from '../../../mergeDictionaries';\nimport { processPerLocaleDictionary } from '../../../processPerLocaleDictionary';\n\nconst groupDictionariesByKey = (\n dictionaries: Dictionary[]\n): Record<string, Dictionary[]> => {\n return dictionaries.reduce(\n (acc, dictionary) => {\n const key = dictionary.key;\n if (!acc[key]) {\n acc[key] = [];\n }\n acc[key].push(dictionary);\n return acc;\n },\n {} as Record<string, Dictionary[]>\n );\n};\n\n/**\n * Write the unmerged dictionaries to the unmergedDictionariesDir\n * @param dictionaries - The dictionaries to write\n * @param configuration - The configuration\n * @returns The grouped dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * console.log(unmergedDictionaries);\n *\n * // .intlayer/unmerged_dictionaries/home.json\n * // {\n * // [\n * // { key: 'home', content: { ... } },\n * // { key: 'home', content: { ... } },\n * // ],\n * // }\n * ```\n */\nexport const writeUnmergedDictionaries = async (\n dictionaries: Dictionary[],\n configuration = getConfiguration()\n): Promise<Record<string, Dictionary[]>> => {\n const { unmergedDictionariesDir } = configuration.content;\n\n // Create the merged dictionaries directory\n await mkdir(unmergedDictionariesDir, { recursive: true });\n\n // Group dictionaries by key and write to unmergedDictionariesDir\n const groupedDictionaries = groupDictionariesByKey(dictionaries);\n\n for (const [key, dictionaries] of Object.entries(groupedDictionaries)) {\n const isDevelopment = process.env.NODE_ENV === 'development';\n const contentString = isDevelopment\n ? JSON.stringify(dictionaries, null, 2)\n : JSON.stringify(dictionaries);\n\n const outputFileName = `${key}.json`;\n const unmergedFilePath = resolve(unmergedDictionariesDir, outputFileName);\n\n // Write the grouped dictionaries\n await writeFile(unmergedFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating unmerged ${outputFileName}:`, err);\n });\n }\n\n return groupedDictionaries;\n};\n\n/**\n * Write the final dictionaries to the dictionariesDir\n * @param groupedDictionaries - The grouped dictionaries\n * @param configuration - The configuration\n * @returns The final dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/dictionaries/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeFinalDictionaries = async (\n groupedDictionaries: Record<string, Dictionary[]>,\n configuration = getConfiguration()\n) => {\n const { dictionariesDir } = configuration.content;\n const resultDictionariesPaths: string[] = [];\n\n // Merge dictionaries with the same key and write to dictionariesDir\n for (const [key, dictionaries] of Object.entries(groupedDictionaries)) {\n const multiLocaleDictionaries = dictionaries.map((dictionary) =>\n processPerLocaleDictionary(dictionary)\n );\n const mergedDictionary = mergeDictionaries(multiLocaleDictionaries);\n\n const isDevelopment = process.env.NODE_ENV === 'development';\n const contentString = isDevelopment\n ? JSON.stringify(mergedDictionary, null, 2)\n : JSON.stringify(mergedDictionary);\n\n const outputFileName = `${key}.json`;\n const resultFilePath = resolve(dictionariesDir, outputFileName);\n\n // Write the merged dictionary\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating merged ${outputFileName}:`, err);\n });\n\n resultDictionariesPaths.push(resultFilePath);\n }\n\n return resultDictionariesPaths;\n};\n\nexport const writeDictionary = async (\n dictionaries: Dictionary[],\n configuration = getConfiguration()\n) => {\n const unmergedDictionaries = await writeUnmergedDictionaries(\n dictionaries,\n configuration\n );\n\n const finalDictionaries = await writeFinalDictionaries(\n unmergedDictionaries,\n configuration\n );\n\n return finalDictionaries;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AAEjC,sBAAiC;AACjC,kBAAwB;AACxB,+BAAkC;AAClC,wCAA2C;AAE3C,MAAM,yBAAyB,CAC7B,iBACiC;AACjC,SAAO,aAAa;AAAA,IAClB,CAAC,KAAK,eAAe;AACnB,YAAM,MAAM,WAAW;AACvB,UAAI,CAAC,IAAI,GAAG,GAAG;AACb,YAAI,GAAG,IAAI,CAAC;AAAA,MACd;AACA,UAAI,GAAG,EAAE,KAAK,UAAU;AACxB,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;AAsBO,MAAM,4BAA4B,OACvC,cACA,oBAAgB,gCAAiB,MACS;AAC1C,QAAM,EAAE,wBAAwB,IAAI,cAAc;AAGlD,YAAM,uBAAM,yBAAyB,EAAE,WAAW,KAAK,CAAC;AAGxD,QAAM,sBAAsB,uBAAuB,YAAY;AAE/D,aAAW,CAAC,KAAKA,aAAY,KAAK,OAAO,QAAQ,mBAAmB,GAAG;AACrE,UAAM,gBAAgB,QAAQ,IAAI,aAAa;AAC/C,UAAM,gBAAgB,gBAClB,KAAK,UAAUA,eAAc,MAAM,CAAC,IACpC,KAAK,UAAUA,aAAY;AAE/B,UAAM,iBAAiB,GAAG,GAAG;AAC7B,UAAM,uBAAmB,qBAAQ,yBAAyB,cAAc;AAGxE,cAAM,2BAAU,kBAAkB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACtE,cAAQ,MAAM,2BAA2B,cAAc,KAAK,GAAG;AAAA,IACjE,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAkBO,MAAM,yBAAyB,OACpC,qBACA,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,gBAAgB,IAAI,cAAc;AAC1C,QAAM,0BAAoC,CAAC;AAG3C,aAAW,CAAC,KAAK,YAAY,KAAK,OAAO,QAAQ,mBAAmB,GAAG;AACrE,UAAM,0BAA0B,aAAa;AAAA,MAAI,CAAC,mBAChD,8DAA2B,UAAU;AAAA,IACvC;AACA,UAAM,uBAAmB,4CAAkB,uBAAuB;AAElE,UAAM,gBAAgB,QAAQ,IAAI,aAAa;AAC/C,UAAM,gBAAgB,gBAClB,KAAK,UAAU,kBAAkB,MAAM,CAAC,IACxC,KAAK,UAAU,gBAAgB;AAEnC,UAAM,iBAAiB,GAAG,GAAG;AAC7B,UAAM,qBAAiB,qBAAQ,iBAAiB,cAAc;AAG9D,cAAM,2BAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,cAAQ,MAAM,yBAAyB,cAAc,KAAK,GAAG;AAAA,IAC/D,CAAC;AAED,4BAAwB,KAAK,cAAc;AAAA,EAC7C;AAEA,SAAO;AACT;AAEO,MAAM,kBAAkB,OAC7B,cACA,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,uBAAuB,MAAM;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,oBAAoB,MAAM;AAAA,IAC9B;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;","names":["dictionaries"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
deepTransformNode,
|
|
3
|
-
NodeType
|
|
4
|
-
} from "@intlayer/core";
|
|
5
|
-
const filterTranlationsPlugin = (locales) => ({
|
|
6
|
-
id: "filter-translations-plugin",
|
|
7
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Translation,
|
|
8
|
-
transform: (node, props, deepTransformNode2) => {
|
|
9
|
-
const translationMap = node.translation;
|
|
10
|
-
const filteredTranslationMap = Object.fromEntries(
|
|
11
|
-
Object.entries(translationMap).filter(
|
|
12
|
-
([key]) => locales.includes(key)
|
|
13
|
-
)
|
|
14
|
-
);
|
|
15
|
-
return {
|
|
16
|
-
...node,
|
|
17
|
-
translation: deepTransformNode2(filteredTranslationMap, {
|
|
18
|
-
...props,
|
|
19
|
-
keyPath: [
|
|
20
|
-
...props.keyPath,
|
|
21
|
-
{ type: NodeType.Object, key: NodeType.Translation }
|
|
22
|
-
]
|
|
23
|
-
})
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const filterDictionaryLocales = (dictionary, locales) => {
|
|
28
|
-
return deepTransformNode(dictionary, {
|
|
29
|
-
plugins: [filterTranlationsPlugin(locales)],
|
|
30
|
-
dictionaryKey: dictionary.key,
|
|
31
|
-
keyPath: []
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
export {
|
|
35
|
-
filterDictionaryLocales
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=filterDictionaryLocales.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/filterDictionaryLocales.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n deepTransformNode,\n Dictionary,\n NodeType,\n Plugins,\n} from '@intlayer/core';\n\nconst filterTranlationsPlugin = (locales: Locales[]): Plugins => ({\n id: 'filter-translations-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node, props, deepTransformNode) => {\n const translationMap = node.translation as Record<Locales, string>;\n\n const filteredTranslationMap = Object.fromEntries(\n Object.entries(translationMap).filter(([key]) =>\n locales.includes(key as Locales)\n )\n );\n\n return {\n ...node,\n translation: deepTransformNode(filteredTranslationMap, {\n ...props,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Object, key: NodeType.Translation },\n ],\n }),\n };\n },\n});\n\nexport const filterDictionaryLocales = (\n dictionary: Dictionary,\n locales: Locales[]\n) => {\n return deepTransformNode(dictionary, {\n plugins: [filterTranlationsPlugin(locales)],\n dictionaryKey: dictionary.key,\n keyPath: [],\n });\n};\n"],"mappings":"AACA;AAAA,EACE;AAAA,EAEA;AAAA,OAEK;AAEP,MAAM,0BAA0B,CAAC,aAAiC;AAAA,EAChE,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;AAAA,EAC1D,WAAW,CAAC,MAAM,OAAOA,uBAAsB;AAC7C,UAAM,iBAAiB,KAAK;AAE5B,UAAM,yBAAyB,OAAO;AAAA,MACpC,OAAO,QAAQ,cAAc,EAAE;AAAA,QAAO,CAAC,CAAC,GAAG,MACzC,QAAQ,SAAS,GAAc;AAAA,MACjC;AAAA,IACF;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,aAAaA,mBAAkB,wBAAwB;AAAA,QACrD,GAAG;AAAA,QACH,SAAS;AAAA,UACP,GAAG,MAAM;AAAA,UACT,EAAE,MAAM,SAAS,QAAQ,KAAK,SAAS,YAAY;AAAA,QACrD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,0BAA0B,CACrC,YACA,YACG;AACH,SAAO,kBAAkB,YAAY;AAAA,IACnC,SAAS,CAAC,wBAAwB,OAAO,CAAC;AAAA,IAC1C,eAAe,WAAW;AAAA,IAC1B,SAAS,CAAC;AAAA,EACZ,CAAC;AACH;","names":["deepTransformNode"]}
|
package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.mjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { getConfiguration } from "@intlayer/config";
|
|
2
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
3
|
-
import { resolve } from "path";
|
|
4
|
-
import { mergeDictionaries } from "../../../mergeDictionaries.mjs";
|
|
5
|
-
import { processPerLocaleDictionary } from "../../../processPerLocaleDictionary.mjs";
|
|
6
|
-
const groupDictionariesByKey = (dictionaries) => {
|
|
7
|
-
return dictionaries.reduce(
|
|
8
|
-
(acc, dictionary) => {
|
|
9
|
-
const key = dictionary.key;
|
|
10
|
-
if (!acc[key]) {
|
|
11
|
-
acc[key] = [];
|
|
12
|
-
}
|
|
13
|
-
acc[key].push(dictionary);
|
|
14
|
-
return acc;
|
|
15
|
-
},
|
|
16
|
-
{}
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
const writeUnmergedDictionaries = async (dictionaries, configuration = getConfiguration()) => {
|
|
20
|
-
const { unmergedDictionariesDir } = configuration.content;
|
|
21
|
-
await mkdir(unmergedDictionariesDir, { recursive: true });
|
|
22
|
-
const groupedDictionaries = groupDictionariesByKey(dictionaries);
|
|
23
|
-
for (const [key, dictionaries2] of Object.entries(groupedDictionaries)) {
|
|
24
|
-
const isDevelopment = process.env.NODE_ENV === "development";
|
|
25
|
-
const contentString = isDevelopment ? JSON.stringify(dictionaries2, null, 2) : JSON.stringify(dictionaries2);
|
|
26
|
-
const outputFileName = `${key}.json`;
|
|
27
|
-
const unmergedFilePath = resolve(unmergedDictionariesDir, outputFileName);
|
|
28
|
-
await writeFile(unmergedFilePath, contentString, "utf8").catch((err) => {
|
|
29
|
-
console.error(`Error creating unmerged ${outputFileName}:`, err);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return groupedDictionaries;
|
|
33
|
-
};
|
|
34
|
-
const writeFinalDictionaries = async (groupedDictionaries, configuration = getConfiguration()) => {
|
|
35
|
-
const { dictionariesDir } = configuration.content;
|
|
36
|
-
const resultDictionariesPaths = [];
|
|
37
|
-
for (const [key, dictionaries] of Object.entries(groupedDictionaries)) {
|
|
38
|
-
const multiLocaleDictionaries = dictionaries.map(
|
|
39
|
-
(dictionary) => processPerLocaleDictionary(dictionary)
|
|
40
|
-
);
|
|
41
|
-
const mergedDictionary = mergeDictionaries(multiLocaleDictionaries);
|
|
42
|
-
const isDevelopment = process.env.NODE_ENV === "development";
|
|
43
|
-
const contentString = isDevelopment ? JSON.stringify(mergedDictionary, null, 2) : JSON.stringify(mergedDictionary);
|
|
44
|
-
const outputFileName = `${key}.json`;
|
|
45
|
-
const resultFilePath = resolve(dictionariesDir, outputFileName);
|
|
46
|
-
await writeFile(resultFilePath, contentString, "utf8").catch((err) => {
|
|
47
|
-
console.error(`Error creating merged ${outputFileName}:`, err);
|
|
48
|
-
});
|
|
49
|
-
resultDictionariesPaths.push(resultFilePath);
|
|
50
|
-
}
|
|
51
|
-
return resultDictionariesPaths;
|
|
52
|
-
};
|
|
53
|
-
const writeDictionary = async (dictionaries, configuration = getConfiguration()) => {
|
|
54
|
-
const unmergedDictionaries = await writeUnmergedDictionaries(
|
|
55
|
-
dictionaries,
|
|
56
|
-
configuration
|
|
57
|
-
);
|
|
58
|
-
const finalDictionaries = await writeFinalDictionaries(
|
|
59
|
-
unmergedDictionaries,
|
|
60
|
-
configuration
|
|
61
|
-
);
|
|
62
|
-
return finalDictionaries;
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
writeDictionary,
|
|
66
|
-
writeFinalDictionaries,
|
|
67
|
-
writeUnmergedDictionaries
|
|
68
|
-
};
|
|
69
|
-
//# sourceMappingURL=writeDictionary.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { mergeDictionaries } from '../../../mergeDictionaries';\nimport { processPerLocaleDictionary } from '../../../processPerLocaleDictionary';\n\nconst groupDictionariesByKey = (\n dictionaries: Dictionary[]\n): Record<string, Dictionary[]> => {\n return dictionaries.reduce(\n (acc, dictionary) => {\n const key = dictionary.key;\n if (!acc[key]) {\n acc[key] = [];\n }\n acc[key].push(dictionary);\n return acc;\n },\n {} as Record<string, Dictionary[]>\n );\n};\n\n/**\n * Write the unmerged dictionaries to the unmergedDictionariesDir\n * @param dictionaries - The dictionaries to write\n * @param configuration - The configuration\n * @returns The grouped dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * console.log(unmergedDictionaries);\n *\n * // .intlayer/unmerged_dictionaries/home.json\n * // {\n * // [\n * // { key: 'home', content: { ... } },\n * // { key: 'home', content: { ... } },\n * // ],\n * // }\n * ```\n */\nexport const writeUnmergedDictionaries = async (\n dictionaries: Dictionary[],\n configuration = getConfiguration()\n): Promise<Record<string, Dictionary[]>> => {\n const { unmergedDictionariesDir } = configuration.content;\n\n // Create the merged dictionaries directory\n await mkdir(unmergedDictionariesDir, { recursive: true });\n\n // Group dictionaries by key and write to unmergedDictionariesDir\n const groupedDictionaries = groupDictionariesByKey(dictionaries);\n\n for (const [key, dictionaries] of Object.entries(groupedDictionaries)) {\n const isDevelopment = process.env.NODE_ENV === 'development';\n const contentString = isDevelopment\n ? JSON.stringify(dictionaries, null, 2)\n : JSON.stringify(dictionaries);\n\n const outputFileName = `${key}.json`;\n const unmergedFilePath = resolve(unmergedDictionariesDir, outputFileName);\n\n // Write the grouped dictionaries\n await writeFile(unmergedFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating unmerged ${outputFileName}:`, err);\n });\n }\n\n return groupedDictionaries;\n};\n\n/**\n * Write the final dictionaries to the dictionariesDir\n * @param groupedDictionaries - The grouped dictionaries\n * @param configuration - The configuration\n * @returns The final dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/dictionaries/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeFinalDictionaries = async (\n groupedDictionaries: Record<string, Dictionary[]>,\n configuration = getConfiguration()\n) => {\n const { dictionariesDir } = configuration.content;\n const resultDictionariesPaths: string[] = [];\n\n // Merge dictionaries with the same key and write to dictionariesDir\n for (const [key, dictionaries] of Object.entries(groupedDictionaries)) {\n const multiLocaleDictionaries = dictionaries.map((dictionary) =>\n processPerLocaleDictionary(dictionary)\n );\n const mergedDictionary = mergeDictionaries(multiLocaleDictionaries);\n\n const isDevelopment = process.env.NODE_ENV === 'development';\n const contentString = isDevelopment\n ? JSON.stringify(mergedDictionary, null, 2)\n : JSON.stringify(mergedDictionary);\n\n const outputFileName = `${key}.json`;\n const resultFilePath = resolve(dictionariesDir, outputFileName);\n\n // Write the merged dictionary\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating merged ${outputFileName}:`, err);\n });\n\n resultDictionariesPaths.push(resultFilePath);\n }\n\n return resultDictionariesPaths;\n};\n\nexport const writeDictionary = async (\n dictionaries: Dictionary[],\n configuration = getConfiguration()\n) => {\n const unmergedDictionaries = await writeUnmergedDictionaries(\n dictionaries,\n configuration\n );\n\n const finalDictionaries = await writeFinalDictionaries(\n unmergedDictionaries,\n configuration\n );\n\n return finalDictionaries;\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AAEjC,SAAS,OAAO,iBAAiB;AACjC,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAE3C,MAAM,yBAAyB,CAC7B,iBACiC;AACjC,SAAO,aAAa;AAAA,IAClB,CAAC,KAAK,eAAe;AACnB,YAAM,MAAM,WAAW;AACvB,UAAI,CAAC,IAAI,GAAG,GAAG;AACb,YAAI,GAAG,IAAI,CAAC;AAAA,MACd;AACA,UAAI,GAAG,EAAE,KAAK,UAAU;AACxB,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;AAsBO,MAAM,4BAA4B,OACvC,cACA,gBAAgB,iBAAiB,MACS;AAC1C,QAAM,EAAE,wBAAwB,IAAI,cAAc;AAGlD,QAAM,MAAM,yBAAyB,EAAE,WAAW,KAAK,CAAC;AAGxD,QAAM,sBAAsB,uBAAuB,YAAY;AAE/D,aAAW,CAAC,KAAKA,aAAY,KAAK,OAAO,QAAQ,mBAAmB,GAAG;AACrE,UAAM,gBAAgB,QAAQ,IAAI,aAAa;AAC/C,UAAM,gBAAgB,gBAClB,KAAK,UAAUA,eAAc,MAAM,CAAC,IACpC,KAAK,UAAUA,aAAY;AAE/B,UAAM,iBAAiB,GAAG,GAAG;AAC7B,UAAM,mBAAmB,QAAQ,yBAAyB,cAAc;AAGxE,UAAM,UAAU,kBAAkB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACtE,cAAQ,MAAM,2BAA2B,cAAc,KAAK,GAAG;AAAA,IACjE,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAkBO,MAAM,yBAAyB,OACpC,qBACA,gBAAgB,iBAAiB,MAC9B;AACH,QAAM,EAAE,gBAAgB,IAAI,cAAc;AAC1C,QAAM,0BAAoC,CAAC;AAG3C,aAAW,CAAC,KAAK,YAAY,KAAK,OAAO,QAAQ,mBAAmB,GAAG;AACrE,UAAM,0BAA0B,aAAa;AAAA,MAAI,CAAC,eAChD,2BAA2B,UAAU;AAAA,IACvC;AACA,UAAM,mBAAmB,kBAAkB,uBAAuB;AAElE,UAAM,gBAAgB,QAAQ,IAAI,aAAa;AAC/C,UAAM,gBAAgB,gBAClB,KAAK,UAAU,kBAAkB,MAAM,CAAC,IACxC,KAAK,UAAU,gBAAgB;AAEnC,UAAM,iBAAiB,GAAG,GAAG;AAC7B,UAAM,iBAAiB,QAAQ,iBAAiB,cAAc;AAG9D,UAAM,UAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,cAAQ,MAAM,yBAAyB,cAAc,KAAK,GAAG;AAAA,IAC/D,CAAC;AAED,4BAAwB,KAAK,cAAc;AAAA,EAC7C;AAEA,SAAO;AACT;AAEO,MAAM,kBAAkB,OAC7B,cACA,gBAAgB,iBAAiB,MAC9B;AACH,QAAM,uBAAuB,MAAM;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,oBAAoB,MAAM;AAAA,IAC9B;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;","names":["dictionaries"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filterDictionaryLocales.d.ts","sourceRoot":"","sources":["../../src/filterDictionaryLocales.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAEL,UAAU,EAGX,MAAM,gBAAgB,CAAC;AA4BxB,eAAO,MAAM,uBAAuB,GAClC,YAAY,UAAU,EACtB,SAAS,OAAO,EAAE,QAOnB,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Dictionary } from '@intlayer/core';
|
|
2
|
-
/**
|
|
3
|
-
* Write the unmerged dictionaries to the unmergedDictionariesDir
|
|
4
|
-
* @param dictionaries - The dictionaries to write
|
|
5
|
-
* @param configuration - The configuration
|
|
6
|
-
* @returns The grouped dictionaries
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);
|
|
11
|
-
* console.log(unmergedDictionaries);
|
|
12
|
-
*
|
|
13
|
-
* // .intlayer/unmerged_dictionaries/home.json
|
|
14
|
-
* // {
|
|
15
|
-
* // [
|
|
16
|
-
* // { key: 'home', content: { ... } },
|
|
17
|
-
* // { key: 'home', content: { ... } },
|
|
18
|
-
* // ],
|
|
19
|
-
* // }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare const writeUnmergedDictionaries: (dictionaries: Dictionary[], configuration?: import("@intlayer/config").IntlayerConfig) => Promise<Record<string, Dictionary[]>>;
|
|
23
|
-
/**
|
|
24
|
-
* Write the final dictionaries to the dictionariesDir
|
|
25
|
-
* @param groupedDictionaries - The grouped dictionaries
|
|
26
|
-
* @param configuration - The configuration
|
|
27
|
-
* @returns The final dictionaries
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);
|
|
32
|
-
* const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);
|
|
33
|
-
* console.log(finalDictionaries);
|
|
34
|
-
*
|
|
35
|
-
* // .intlayer/dictionaries/home.json
|
|
36
|
-
* // { key: 'home', content: { ... } },
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare const writeFinalDictionaries: (groupedDictionaries: Record<string, Dictionary[]>, configuration?: import("@intlayer/config").IntlayerConfig) => Promise<string[]>;
|
|
40
|
-
export declare const writeDictionary: (dictionaries: Dictionary[], configuration?: import("@intlayer/config").IntlayerConfig) => Promise<string[]>;
|
|
41
|
-
//# sourceMappingURL=writeDictionary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAsBjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,GACpC,cAAc,UAAU,EAAE,EAC1B,yDAAkC,KACjC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAyBtC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GACjC,qBAAqB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,EACjD,yDAAkC,sBA6BnC,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,cAAc,UAAU,EAAE,EAC1B,yDAAkC,sBAanC,CAAC"}
|