@intlayer/chokidar 3.5.4 → 3.5.6
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 +34 -13
- package/dist/cjs/chokidar/watcher.cjs.map +1 -1
- package/dist/cjs/fetchDistantDictionaries.cjs +2 -2
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +4 -3
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
- package/dist/cjs/log.cjs +6 -2
- package/dist/cjs/log.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/{i18n_dictionary/buildI18nDictionary.cjs → i18next_dictionary/buildI18nextDictionary.cjs} +5 -5
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/{i18n_dictionary → i18next_dictionary}/convertContentDeclarationInto18nDictionaries.cjs +17 -3
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/{i18n_dictionary → i18next_dictionary}/convertPluralsValues.cjs +7 -20
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/{i18n_dictionary → i18next_dictionary}/index.cjs +4 -4
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/{i18n_dictionary → i18next_dictionary}/writeDictionary.cjs +2 -2
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs +2 -2
- package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.cjs +2 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.cjs +52 -0
- package/dist/cjs/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.cjs.map +1 -0
- package/dist/esm/chokidar/watcher.mjs +35 -14
- package/dist/esm/chokidar/watcher.mjs.map +1 -1
- package/dist/esm/fetchDistantDictionaries.mjs +3 -3
- package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +5 -4
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
- package/dist/esm/log.mjs +6 -2
- package/dist/esm/log.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/{i18n_dictionary/buildI18nDictionary.mjs → i18next_dictionary/buildI18nextDictionary.mjs} +3 -3
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/{i18n_dictionary → i18next_dictionary}/convertContentDeclarationInto18nDictionaries.mjs +16 -2
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.mjs +13 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.mjs +2 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/{i18n_dictionary → i18next_dictionary}/writeDictionary.mjs +2 -2
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.mjs +2 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.mjs +28 -0
- package/dist/esm/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.mjs.map +1 -0
- package/dist/types/chokidar/watcher.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
- package/dist/types/log.d.ts +1 -0
- package/dist/types/log.d.ts.map +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/{i18n_dictionary/buildI18nDictionary.d.ts → i18next_dictionary/buildI18nextDictionary.d.ts} +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/{i18n_dictionary → i18next_dictionary}/convertContentDeclarationInto18nDictionaries.d.ts +2 -2
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.d.ts +2 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.d.ts +2 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.d.ts +7 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.d.ts.map +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.d.ts +7 -0
- package/dist/types/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.d.ts.map +1 -0
- package/package.json +12 -12
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18n_dictionary/buildI18nDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertContentDeclarationInto18nDictionaries.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertPluralsValues.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18n_dictionary/index.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.cjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18n_dictionary/buildI18nDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertContentDeclarationInto18nDictionaries.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertPluralsValues.mjs +0 -26
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertPluralsValues.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18n_dictionary/index.mjs +0 -2
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18n_dictionary/index.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.mjs.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18n_dictionary/buildI18nDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertContentDeclarationInto18nDictionaries.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertPluralsValues.d.ts +0 -2
- package/dist/types/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertPluralsValues.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18n_dictionary/index.d.ts +0 -2
- package/dist/types/transpiler/declaration_file_to_dictionary/i18n_dictionary/index.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.d.ts +0 -7
- package/dist/types/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.d.ts.map +0 -1
package/dist/esm/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.mjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
2
|
+
import { resolve } from "path";
|
|
3
|
+
import { getConfiguration } from "@intlayer/config";
|
|
4
|
+
const { content } = getConfiguration();
|
|
5
|
+
const { reactIntlMessagesDir } = content;
|
|
6
|
+
const writeDictionary = async (dictionariesDeclaration) => {
|
|
7
|
+
const resultDictionariesPaths = [];
|
|
8
|
+
for (const [nameSpace, localContent] of Object.entries(
|
|
9
|
+
dictionariesDeclaration
|
|
10
|
+
)) {
|
|
11
|
+
for await (const [locale, content2] of Object.entries(localContent)) {
|
|
12
|
+
const contentString = JSON.stringify(content2);
|
|
13
|
+
const outputFileName = `${nameSpace}.json`;
|
|
14
|
+
const resultDirPath = resolve(reactIntlMessagesDir, locale);
|
|
15
|
+
const resultFilePath = resolve(resultDirPath, outputFileName);
|
|
16
|
+
await mkdir(resultDirPath, { recursive: true });
|
|
17
|
+
await writeFile(resultFilePath, contentString, "utf8").catch((err) => {
|
|
18
|
+
console.error(`Error creating ${outputFileName}:`, err);
|
|
19
|
+
});
|
|
20
|
+
resultDictionariesPaths.push(resultFilePath);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return resultDictionariesPaths;
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
writeDictionary
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=writeDictionary.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.ts"],"sourcesContent":["import { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { getConfiguration } from '@intlayer/config';\nimport { I18nextDictionariesOutput } from '../i18next_dictionary/convertContentDeclarationInto18nDictionaries';\n\nconst { content } = getConfiguration();\nconst { reactIntlMessagesDir } = content;\n\nexport type DictionariesDeclaration = Record<string, I18nextDictionariesOutput>;\n\n/**\n * This function writes the dictionaries to the file system\n */\nexport const writeDictionary = async (\n dictionariesDeclaration: DictionariesDeclaration\n) => {\n const resultDictionariesPaths: string[] = [];\n\n for (const [nameSpace, localContent] of Object.entries(\n dictionariesDeclaration\n )) {\n for await (const [locale, content] of Object.entries(localContent)) {\n const contentString = JSON.stringify(content);\n\n const outputFileName = `${nameSpace}.json`;\n const resultDirPath = resolve(reactIntlMessagesDir, locale);\n const resultFilePath = resolve(resultDirPath, outputFileName);\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resultDirPath, { recursive: true });\n\n // Create the json file\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating ${outputFileName}:`, err);\n });\n\n resultDictionariesPaths.push(resultFilePath);\n }\n }\n\n return resultDictionariesPaths;\n};\n"],"mappings":"AAAA,SAAS,OAAO,iBAAiB;AACjC,SAAS,eAAe;AACxB,SAAS,wBAAwB;AAGjC,MAAM,EAAE,QAAQ,IAAI,iBAAiB;AACrC,MAAM,EAAE,qBAAqB,IAAI;AAO1B,MAAM,kBAAkB,OAC7B,4BACG;AACH,QAAM,0BAAoC,CAAC;AAE3C,aAAW,CAAC,WAAW,YAAY,KAAK,OAAO;AAAA,IAC7C;AAAA,EACF,GAAG;AACD,qBAAiB,CAAC,QAAQA,QAAO,KAAK,OAAO,QAAQ,YAAY,GAAG;AAClE,YAAM,gBAAgB,KAAK,UAAUA,QAAO;AAE5C,YAAM,iBAAiB,GAAG,SAAS;AACnC,YAAM,gBAAgB,QAAQ,sBAAsB,MAAM;AAC1D,YAAM,iBAAiB,QAAQ,eAAe,cAAc;AAG5D,YAAM,MAAM,eAAe,EAAE,WAAW,KAAK,CAAC;AAG9C,YAAM,UAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,gBAAQ,MAAM,kBAAkB,cAAc,KAAK,GAAG;AAAA,MACxD,CAAC;AAED,8BAAwB,KAAK,cAAc;AAAA,IAC7C;AAAA,EACF;AAEA,SAAO;AACT;","names":["content"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../src/chokidar/watcher.ts"],"names":[],"mappings":"AAEA,2FAA2F;AAC3F,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../src/chokidar/watcher.ts"],"names":[],"mappings":"AAEA,2FAA2F;AAC3F,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,UAAU,CAAC;AAcxE,eAAO,MAAM,KAAK,aAAc,eAAe,QAsG9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"loadDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAS5C,eAAO,MAAM,gBAAgB,6BACD,MAAM,EAAE,GAAG,MAAM,KAC1C,OAAO,CAAC,UAAU,EAAE,CAwEtB,CAAC"}
|
package/dist/types/log.d.ts
CHANGED
package/dist/types/log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,KAAK,EAAE,CAAC;CAChB,CAAC;AAaF,cAAM,MAAM;IACV,OAAO,CAAC,oBAAoB,CAA4B;IACxD,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,sBAAsB,CAAa;IAC3C,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,mBAAmB,CAMX;IAChB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,MAAM,CAAiB;IAG/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAEhC,OAAO;WAIO,WAAW,IAAI,MAAM;IAO5B,IAAI,CACT,qBAAqB,EAAE,MAAM,EAAE,EAC/B,uBAAuB,EAAE,MAAM,EAAE;IA+C5B,iBAAiB,CACtB,IAAI,EAAE,OAAO,GAAG,SAAS,EACzB,cAAc,EAAE,MAAM,EAAE;IA8C1B,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,YAAY;IAgEb,IAAI;IAIJ,YAAY,CACjB,YAAY,EAAE;QACZ,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;QAC1B,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;KACxB,EAAE;IA+CL,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,aAAa;IAmCrB,OAAO,CAAC,oBAAoB;IA4BrB,WAAW;CAGnB;AAED,eAAO,MAAM,MAAM,QAAuB,CAAC"}
|
|
@@ -3,4 +3,4 @@ import type { Dictionary } from '@intlayer/core';
|
|
|
3
3
|
* This function transpile content declaration to i18n dictionaries
|
|
4
4
|
*/
|
|
5
5
|
export declare const buildI18nDictionary: (contentDeclarations: Dictionary[]) => Promise<string[]>;
|
|
6
|
-
//# sourceMappingURL=
|
|
6
|
+
//# sourceMappingURL=buildI18nextDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildI18nextDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD;;GAEG;AACH,eAAO,MAAM,mBAAmB,wBACT,UAAU,EAAE,sBAoBlC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Locales } from '@intlayer/config';
|
|
2
2
|
import { DictionaryValue } from '@intlayer/core';
|
|
3
3
|
type Dictionary = Record<string, unknown>;
|
|
4
|
-
export type
|
|
5
|
-
export declare const
|
|
4
|
+
export type I18nextDictionariesOutput = Partial<Record<Locales, Dictionary>>;
|
|
5
|
+
export declare const createI18nextDictionaries: (content: DictionaryValue) => I18nextDictionariesOutput;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=convertContentDeclarationInto18nDictionaries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertContentDeclarationInto18nDictionaries.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAKL,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1C,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AA0F7E,eAAO,MAAM,yBAAyB,YAC3B,eAAe,KACvB,yBAWF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertPluralsValues.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,WAAY,MAAM,GAAG,MAAM,KAAG,MAS9D,CAAC"}
|
package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { I18nextDictionariesOutput } from './convertContentDeclarationInto18nDictionaries';
|
|
2
|
+
export type DictionariesDeclaration = Record<string, I18nextDictionariesOutput>;
|
|
3
|
+
/**
|
|
4
|
+
* This function writes the dictionaries to the file system
|
|
5
|
+
*/
|
|
6
|
+
export declare const writeDictionary: (dictionariesDeclaration: DictionariesDeclaration) => Promise<string[]>;
|
|
7
|
+
//# sourceMappingURL=writeDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAK3F,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,eAAe,4BACD,uBAAuB,sBA2BjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processContentDeclaration.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processContentDeclaration.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,UAAU,EAGX,MAAM,gBAAgB,CAAC;AA+CxB;;GAEG;AACH,eAAO,MAAM,yBAAyB,uBAChB,kBAAkB,KACrC,OAAO,CAAC,UAAU,GAAG,SAAS,CAahC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { I18nextDictionariesOutput } from '../i18next_dictionary/convertContentDeclarationInto18nDictionaries';
|
|
2
|
+
export type DictionariesDeclaration = Record<string, I18nextDictionariesOutput>;
|
|
3
|
+
/**
|
|
4
|
+
* This function writes the dictionaries to the file system
|
|
5
|
+
*/
|
|
6
|
+
export declare const writeDictionary: (dictionariesDeclaration: DictionariesDeclaration) => Promise<string[]>;
|
|
7
|
+
//# sourceMappingURL=writeDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oEAAoE,CAAC;AAK/G,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,eAAe,4BACD,uBAAuB,sBA2BjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/chokidar",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Chokidar application for IntLayer - Transpile IntLayer declaration files into dictionaries.",
|
|
6
6
|
"keywords": [
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"quicktype-core": "^23.0.170",
|
|
68
68
|
"react": "^18.3.1",
|
|
69
69
|
"rimraf": "^6.0.1",
|
|
70
|
-
"@intlayer/
|
|
71
|
-
"@intlayer/design-system": "^3.5.
|
|
72
|
-
"intlayer": "^3.5.
|
|
73
|
-
"@intlayer/config": "^3.5.
|
|
74
|
-
"@intlayer/
|
|
70
|
+
"@intlayer/core": "^3.5.6",
|
|
71
|
+
"@intlayer/design-system": "^3.5.6",
|
|
72
|
+
"intlayer": "^3.5.6",
|
|
73
|
+
"@intlayer/config": "^3.5.6",
|
|
74
|
+
"@intlayer/backend": "^3.5.6"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@changesets/cli": "2.27.10",
|
|
@@ -86,17 +86,17 @@
|
|
|
86
86
|
"typescript": "^5.7.2",
|
|
87
87
|
"webpack-watch-files-plugin": "^1.2.1",
|
|
88
88
|
"@utils/eslint-config": "^1.0.4",
|
|
89
|
-
"@utils/tsup-config": "^1.0.4",
|
|
90
89
|
"@utils/ts-config-types": "^1.0.4",
|
|
90
|
+
"@utils/tsup-config": "^1.0.4",
|
|
91
91
|
"@utils/ts-config": "^1.0.4"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"fast-glob": "^3.3.2",
|
|
95
|
-
"@intlayer/
|
|
96
|
-
"@intlayer/
|
|
97
|
-
"@intlayer/
|
|
98
|
-
"
|
|
99
|
-
"intlayer": "^3.5.
|
|
95
|
+
"@intlayer/backend": "^3.5.6",
|
|
96
|
+
"@intlayer/core": "^3.5.6",
|
|
97
|
+
"@intlayer/design-system": "^3.5.6",
|
|
98
|
+
"intlayer": "^3.5.6",
|
|
99
|
+
"@intlayer/config": "^3.5.6"
|
|
100
100
|
},
|
|
101
101
|
"engines": {
|
|
102
102
|
"node": ">=14.18"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/buildI18nDictionary.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/core';\nimport { createI18nDictionaries } from './convertContentDeclarationInto18nDictionaries';\nimport {\n writeDictionary,\n type DictionariesDeclaration,\n} from './writeDictionary';\n\n/**\n * This function transpile content declaration to i18n dictionaries\n */\nexport const buildI18nDictionary = async (\n contentDeclarations: Dictionary[]\n) => {\n // Create dictionaries for each nested content and format them\n const dictionariesDeclaration: DictionariesDeclaration =\n contentDeclarations.reduce((acc, dictionary) => {\n const { key, content } = dictionary;\n const i18Content = createI18nDictionaries(content);\n\n return {\n ...acc,\n [key]: i18Content,\n };\n }, {});\n\n // Write the dictionaries to the file system\n const dictionariesPaths: string[] = await writeDictionary(\n dictionariesDeclaration\n );\n\n return dictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0DAAuC;AACvC,6BAGO;AAKA,MAAM,sBAAsB,OACjC,wBACG;AAEH,QAAM,0BACJ,oBAAoB,OAAO,CAAC,KAAK,eAAe;AAC9C,UAAM,EAAE,KAAK,QAAQ,IAAI;AACzB,UAAM,iBAAa,4EAAuB,OAAO;AAEjD,WAAO;AAAA,MACL,GAAG;AAAA,MACH,CAAC,GAAG,GAAG;AAAA,IACT;AAAA,EACF,GAAG,CAAC,CAAC;AAGP,QAAM,oBAA8B,UAAM;AAAA,IACxC;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertContentDeclarationInto18nDictionaries.ts"],"sourcesContent":["import { getConfiguration, type Locales } from '@intlayer/config';\nimport {\n NodeType,\n type TranslationContent,\n type TypedNode,\n type EnumerationContent,\n DictionaryValue,\n} from '@intlayer/core';\nimport { convertPluralsValues } from './convertPluralsValues';\n\ntype Dictionary = Record<string, unknown>;\nexport type I18nDictionariesOutput = Partial<Record<Locales, Dictionary>>;\n\nconst {\n internationalization: { locales },\n} = getConfiguration();\n\nconst isReactNode = (node: Record<string, unknown>): boolean =>\n typeof node?.key !== 'undefined' &&\n typeof node?.props !== 'undefined' &&\n typeof node?.type !== 'undefined';\n\n// Build dictionary for a specific locale\nconst buildDictionary = (\n content: DictionaryValue,\n locale: Locales\n): unknown => {\n if (\n // Translation node\n content &&\n (content as TypedNode).nodeType === NodeType.Translation\n ) {\n const result = (content as TranslationContent<unknown>)[\n NodeType.Translation\n ][locale];\n\n return buildDictionary(result as DictionaryValue, locale);\n } else if (\n // Translation node\n content &&\n (content as TypedNode).nodeType === NodeType.Enumeration\n ) {\n const plurals: Record<string, unknown> = {};\n\n Object.keys(\n (content as EnumerationContent<unknown>)[NodeType.Enumeration]\n ).forEach((quantity) => {\n const letterNumber = convertPluralsValues(quantity);\n\n const value = (content as EnumerationContent<unknown>)[\n quantity as keyof EnumerationContent<unknown>\n ];\n\n plurals[`${letterNumber}_${letterNumber}`] = buildDictionary(\n value as DictionaryValue,\n locale\n );\n });\n\n return plurals;\n } else if (\n // React element node\n isReactNode(content as Record<string, unknown>)\n ) {\n return JSON.stringify(content);\n } else if (\n // Nested object\n typeof content === 'object'\n ) {\n const result: Record<string, unknown> = {};\n\n Object.keys(content).forEach((dictionaryValue) => {\n result[dictionaryValue] = buildDictionary(\n content[dictionaryValue as keyof typeof content] as DictionaryValue,\n locale\n );\n });\n\n return result;\n }\n\n return content;\n};\n\nexport const createI18nDictionaries = (\n content: DictionaryValue\n): I18nDictionariesOutput => {\n // Map dictionaries for each locale\n const result: I18nDictionariesOutput = locales.reduce(\n (acc, locale) => ({\n ...acc,\n [locale]: buildDictionary(content, locale),\n }),\n {}\n );\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAC/C,kBAMO;AACP,kCAAqC;AAKrC,MAAM;AAAA,EACJ,sBAAsB,EAAE,QAAQ;AAClC,QAAI,gCAAiB;AAErB,MAAM,cAAc,CAAC,SACnB,OAAO,MAAM,QAAQ,eACrB,OAAO,MAAM,UAAU,eACvB,OAAO,MAAM,SAAS;AAGxB,MAAM,kBAAkB,CACtB,SACA,WACY;AACZ;AAAA;AAAA,IAEE,WACC,QAAsB,aAAa,qBAAS;AAAA,IAC7C;AACA,UAAM,SAAU,QACd,qBAAS,WACX,EAAE,MAAM;AAER,WAAO,gBAAgB,QAA2B,MAAM;AAAA,EAC1D;AAAA;AAAA,IAEE,WACC,QAAsB,aAAa,qBAAS;AAAA,IAC7C;AACA,UAAM,UAAmC,CAAC;AAE1C,WAAO;AAAA,MACJ,QAAwC,qBAAS,WAAW;AAAA,IAC/D,EAAE,QAAQ,CAAC,aAAa;AACtB,YAAM,mBAAe,kDAAqB,QAAQ;AAElD,YAAM,QAAS,QACb,QACF;AAEA,cAAQ,GAAG,YAAY,IAAI,YAAY,EAAE,IAAI;AAAA,QAC3C;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAAA;AAAA,IAEE,YAAY,OAAkC;AAAA,IAC9C;AACA,WAAO,KAAK,UAAU,OAAO;AAAA,EAC/B;AAAA;AAAA,IAEE,OAAO,YAAY;AAAA,IACnB;AACA,UAAM,SAAkC,CAAC;AAEzC,WAAO,KAAK,OAAO,EAAE,QAAQ,CAAC,oBAAoB;AAChD,aAAO,eAAe,IAAI;AAAA,QACxB,QAAQ,eAAuC;AAAA,QAC/C;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,MAAM,yBAAyB,CACpC,YAC2B;AAE3B,QAAM,SAAiC,QAAQ;AAAA,IAC7C,CAAC,KAAK,YAAY;AAAA,MAChB,GAAG;AAAA,MACH,CAAC,MAAM,GAAG,gBAAgB,SAAS,MAAM;AAAA,IAC3C;AAAA,IACA,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertPluralsValues.ts"],"sourcesContent":["export const convertPluralsValues = (number: string): string => {\n switch (number) {\n case '1':\n return 'one';\n case '2':\n return 'two';\n case '3':\n return 'three';\n case '4':\n return 'four';\n case '5':\n return 'five';\n case '6':\n return 'six';\n case '7':\n return 'seven';\n case '8':\n return 'eight';\n default:\n return number.toString();\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,uBAAuB,CAAC,WAA2B;AAC9D,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO,OAAO,SAAS;AAAA,EAC3B;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/index.ts"],"sourcesContent":["export * from './buildI18nDictionary';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,oCAAc,kCAAd;","names":[]}
|
package/dist/cjs/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.ts"],"sourcesContent":["import { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { getConfiguration } from '@intlayer/config';\nimport { I18nDictionariesOutput } from './convertContentDeclarationInto18nDictionaries';\n\nconst { content } = getConfiguration();\nconst { i18nDictionariesDir } = content;\n\nexport type DictionariesDeclaration = Record<string, I18nDictionariesOutput>;\n\n/**\n * This function writes the dictionaries to the file system\n */\nexport const writeDictionary = async (\n dictionariesDeclaration: DictionariesDeclaration\n) => {\n const resultDictionariesPaths: string[] = [];\n\n for (const [nameSpace, localContent] of Object.entries(\n dictionariesDeclaration\n )) {\n for await (const [locale, content] of Object.entries(localContent)) {\n const contentString = JSON.stringify(content);\n\n const outputFileName = `${nameSpace}.json`;\n const resultDirPath = resolve(i18nDictionariesDir, locale);\n const resultFilePath = resolve(resultDirPath, outputFileName);\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resultDirPath, { recursive: true });\n\n // Create the json file\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating ${outputFileName}:`, err);\n });\n\n resultDictionariesPaths.push(resultFilePath);\n }\n }\n\n return resultDictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAiC;AACjC,kBAAwB;AACxB,oBAAiC;AAGjC,MAAM,EAAE,QAAQ,QAAI,gCAAiB;AACrC,MAAM,EAAE,oBAAoB,IAAI;AAOzB,MAAM,kBAAkB,OAC7B,4BACG;AACH,QAAM,0BAAoC,CAAC;AAE3C,aAAW,CAAC,WAAW,YAAY,KAAK,OAAO;AAAA,IAC7C;AAAA,EACF,GAAG;AACD,qBAAiB,CAAC,QAAQA,QAAO,KAAK,OAAO,QAAQ,YAAY,GAAG;AAClE,YAAM,gBAAgB,KAAK,UAAUA,QAAO;AAE5C,YAAM,iBAAiB,GAAG,SAAS;AACnC,YAAM,oBAAgB,qBAAQ,qBAAqB,MAAM;AACzD,YAAM,qBAAiB,qBAAQ,eAAe,cAAc;AAG5D,gBAAM,uBAAM,eAAe,EAAE,WAAW,KAAK,CAAC;AAG9C,gBAAM,2BAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,gBAAQ,MAAM,kBAAkB,cAAc,KAAK,GAAG;AAAA,MACxD,CAAC;AAED,8BAAwB,KAAK,cAAc;AAAA,IAC7C;AAAA,EACF;AAEA,SAAO;AACT;","names":["content"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/buildI18nDictionary.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/core';\nimport { createI18nDictionaries } from './convertContentDeclarationInto18nDictionaries';\nimport {\n writeDictionary,\n type DictionariesDeclaration,\n} from './writeDictionary';\n\n/**\n * This function transpile content declaration to i18n dictionaries\n */\nexport const buildI18nDictionary = async (\n contentDeclarations: Dictionary[]\n) => {\n // Create dictionaries for each nested content and format them\n const dictionariesDeclaration: DictionariesDeclaration =\n contentDeclarations.reduce((acc, dictionary) => {\n const { key, content } = dictionary;\n const i18Content = createI18nDictionaries(content);\n\n return {\n ...acc,\n [key]: i18Content,\n };\n }, {});\n\n // Write the dictionaries to the file system\n const dictionariesPaths: string[] = await writeDictionary(\n dictionariesDeclaration\n );\n\n return dictionariesPaths;\n};\n"],"mappings":"AACA,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,OAEK;AAKA,MAAM,sBAAsB,OACjC,wBACG;AAEH,QAAM,0BACJ,oBAAoB,OAAO,CAAC,KAAK,eAAe;AAC9C,UAAM,EAAE,KAAK,QAAQ,IAAI;AACzB,UAAM,aAAa,uBAAuB,OAAO;AAEjD,WAAO;AAAA,MACL,GAAG;AAAA,MACH,CAAC,GAAG,GAAG;AAAA,IACT;AAAA,EACF,GAAG,CAAC,CAAC;AAGP,QAAM,oBAA8B,MAAM;AAAA,IACxC;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertContentDeclarationInto18nDictionaries.ts"],"sourcesContent":["import { getConfiguration, type Locales } from '@intlayer/config';\nimport {\n NodeType,\n type TranslationContent,\n type TypedNode,\n type EnumerationContent,\n DictionaryValue,\n} from '@intlayer/core';\nimport { convertPluralsValues } from './convertPluralsValues';\n\ntype Dictionary = Record<string, unknown>;\nexport type I18nDictionariesOutput = Partial<Record<Locales, Dictionary>>;\n\nconst {\n internationalization: { locales },\n} = getConfiguration();\n\nconst isReactNode = (node: Record<string, unknown>): boolean =>\n typeof node?.key !== 'undefined' &&\n typeof node?.props !== 'undefined' &&\n typeof node?.type !== 'undefined';\n\n// Build dictionary for a specific locale\nconst buildDictionary = (\n content: DictionaryValue,\n locale: Locales\n): unknown => {\n if (\n // Translation node\n content &&\n (content as TypedNode).nodeType === NodeType.Translation\n ) {\n const result = (content as TranslationContent<unknown>)[\n NodeType.Translation\n ][locale];\n\n return buildDictionary(result as DictionaryValue, locale);\n } else if (\n // Translation node\n content &&\n (content as TypedNode).nodeType === NodeType.Enumeration\n ) {\n const plurals: Record<string, unknown> = {};\n\n Object.keys(\n (content as EnumerationContent<unknown>)[NodeType.Enumeration]\n ).forEach((quantity) => {\n const letterNumber = convertPluralsValues(quantity);\n\n const value = (content as EnumerationContent<unknown>)[\n quantity as keyof EnumerationContent<unknown>\n ];\n\n plurals[`${letterNumber}_${letterNumber}`] = buildDictionary(\n value as DictionaryValue,\n locale\n );\n });\n\n return plurals;\n } else if (\n // React element node\n isReactNode(content as Record<string, unknown>)\n ) {\n return JSON.stringify(content);\n } else if (\n // Nested object\n typeof content === 'object'\n ) {\n const result: Record<string, unknown> = {};\n\n Object.keys(content).forEach((dictionaryValue) => {\n result[dictionaryValue] = buildDictionary(\n content[dictionaryValue as keyof typeof content] as DictionaryValue,\n locale\n );\n });\n\n return result;\n }\n\n return content;\n};\n\nexport const createI18nDictionaries = (\n content: DictionaryValue\n): I18nDictionariesOutput => {\n // Map dictionaries for each locale\n const result: I18nDictionariesOutput = locales.reduce(\n (acc, locale) => ({\n ...acc,\n [locale]: buildDictionary(content, locale),\n }),\n {}\n );\n\n return result;\n};\n"],"mappings":"AAAA,SAAS,wBAAsC;AAC/C;AAAA,EACE;AAAA,OAKK;AACP,SAAS,4BAA4B;AAKrC,MAAM;AAAA,EACJ,sBAAsB,EAAE,QAAQ;AAClC,IAAI,iBAAiB;AAErB,MAAM,cAAc,CAAC,SACnB,OAAO,MAAM,QAAQ,eACrB,OAAO,MAAM,UAAU,eACvB,OAAO,MAAM,SAAS;AAGxB,MAAM,kBAAkB,CACtB,SACA,WACY;AACZ;AAAA;AAAA,IAEE,WACC,QAAsB,aAAa,SAAS;AAAA,IAC7C;AACA,UAAM,SAAU,QACd,SAAS,WACX,EAAE,MAAM;AAER,WAAO,gBAAgB,QAA2B,MAAM;AAAA,EAC1D;AAAA;AAAA,IAEE,WACC,QAAsB,aAAa,SAAS;AAAA,IAC7C;AACA,UAAM,UAAmC,CAAC;AAE1C,WAAO;AAAA,MACJ,QAAwC,SAAS,WAAW;AAAA,IAC/D,EAAE,QAAQ,CAAC,aAAa;AACtB,YAAM,eAAe,qBAAqB,QAAQ;AAElD,YAAM,QAAS,QACb,QACF;AAEA,cAAQ,GAAG,YAAY,IAAI,YAAY,EAAE,IAAI;AAAA,QAC3C;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAAA;AAAA,IAEE,YAAY,OAAkC;AAAA,IAC9C;AACA,WAAO,KAAK,UAAU,OAAO;AAAA,EAC/B;AAAA;AAAA,IAEE,OAAO,YAAY;AAAA,IACnB;AACA,UAAM,SAAkC,CAAC;AAEzC,WAAO,KAAK,OAAO,EAAE,QAAQ,CAAC,oBAAoB;AAChD,aAAO,eAAe,IAAI;AAAA,QACxB,QAAQ,eAAuC;AAAA,QAC/C;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,MAAM,yBAAyB,CACpC,YAC2B;AAE3B,QAAM,SAAiC,QAAQ;AAAA,IAC7C,CAAC,KAAK,YAAY;AAAA,MAChB,GAAG;AAAA,MACH,CAAC,MAAM,GAAG,gBAAgB,SAAS,MAAM;AAAA,IAC3C;AAAA,IACA,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
|
package/dist/esm/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertPluralsValues.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const convertPluralsValues = (number) => {
|
|
2
|
-
switch (number) {
|
|
3
|
-
case "1":
|
|
4
|
-
return "one";
|
|
5
|
-
case "2":
|
|
6
|
-
return "two";
|
|
7
|
-
case "3":
|
|
8
|
-
return "three";
|
|
9
|
-
case "4":
|
|
10
|
-
return "four";
|
|
11
|
-
case "5":
|
|
12
|
-
return "five";
|
|
13
|
-
case "6":
|
|
14
|
-
return "six";
|
|
15
|
-
case "7":
|
|
16
|
-
return "seven";
|
|
17
|
-
case "8":
|
|
18
|
-
return "eight";
|
|
19
|
-
default:
|
|
20
|
-
return number.toString();
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
convertPluralsValues
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=convertPluralsValues.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertPluralsValues.ts"],"sourcesContent":["export const convertPluralsValues = (number: string): string => {\n switch (number) {\n case '1':\n return 'one';\n case '2':\n return 'two';\n case '3':\n return 'three';\n case '4':\n return 'four';\n case '5':\n return 'five';\n case '6':\n return 'six';\n case '7':\n return 'seven';\n case '8':\n return 'eight';\n default:\n return number.toString();\n }\n};\n"],"mappings":"AAAO,MAAM,uBAAuB,CAAC,WAA2B;AAC9D,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO,OAAO,SAAS;AAAA,EAC3B;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/index.ts"],"sourcesContent":["export * from './buildI18nDictionary';\n"],"mappings":"AAAA,cAAc;","names":[]}
|
package/dist/esm/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.ts"],"sourcesContent":["import { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { getConfiguration } from '@intlayer/config';\nimport { I18nDictionariesOutput } from './convertContentDeclarationInto18nDictionaries';\n\nconst { content } = getConfiguration();\nconst { i18nDictionariesDir } = content;\n\nexport type DictionariesDeclaration = Record<string, I18nDictionariesOutput>;\n\n/**\n * This function writes the dictionaries to the file system\n */\nexport const writeDictionary = async (\n dictionariesDeclaration: DictionariesDeclaration\n) => {\n const resultDictionariesPaths: string[] = [];\n\n for (const [nameSpace, localContent] of Object.entries(\n dictionariesDeclaration\n )) {\n for await (const [locale, content] of Object.entries(localContent)) {\n const contentString = JSON.stringify(content);\n\n const outputFileName = `${nameSpace}.json`;\n const resultDirPath = resolve(i18nDictionariesDir, locale);\n const resultFilePath = resolve(resultDirPath, outputFileName);\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resultDirPath, { recursive: true });\n\n // Create the json file\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating ${outputFileName}:`, err);\n });\n\n resultDictionariesPaths.push(resultFilePath);\n }\n }\n\n return resultDictionariesPaths;\n};\n"],"mappings":"AAAA,SAAS,OAAO,iBAAiB;AACjC,SAAS,eAAe;AACxB,SAAS,wBAAwB;AAGjC,MAAM,EAAE,QAAQ,IAAI,iBAAiB;AACrC,MAAM,EAAE,oBAAoB,IAAI;AAOzB,MAAM,kBAAkB,OAC7B,4BACG;AACH,QAAM,0BAAoC,CAAC;AAE3C,aAAW,CAAC,WAAW,YAAY,KAAK,OAAO;AAAA,IAC7C;AAAA,EACF,GAAG;AACD,qBAAiB,CAAC,QAAQA,QAAO,KAAK,OAAO,QAAQ,YAAY,GAAG;AAClE,YAAM,gBAAgB,KAAK,UAAUA,QAAO;AAE5C,YAAM,iBAAiB,GAAG,SAAS;AACnC,YAAM,gBAAgB,QAAQ,qBAAqB,MAAM;AACzD,YAAM,iBAAiB,QAAQ,eAAe,cAAc;AAG5D,YAAM,MAAM,eAAe,EAAE,WAAW,KAAK,CAAC;AAG9C,YAAM,UAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,gBAAQ,MAAM,kBAAkB,cAAc,KAAK,GAAG;AAAA,MACxD,CAAC;AAED,8BAAwB,KAAK,cAAc;AAAA,IAC7C;AAAA,EACF;AAEA,SAAO;AACT;","names":["content"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildI18nDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/buildI18nDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD;;GAEG;AACH,eAAO,MAAM,mBAAmB,wBACT,UAAU,EAAE,sBAoBlC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertContentDeclarationInto18nDictionaries.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertContentDeclarationInto18nDictionaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAKL,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1C,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AAyE1E,eAAO,MAAM,sBAAsB,YACxB,eAAe,KACvB,sBAWF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertPluralsValues.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/convertPluralsValues.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,WAAY,MAAM,KAAG,MAqBrD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/dist/types/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { I18nDictionariesOutput } from './convertContentDeclarationInto18nDictionaries';
|
|
2
|
-
export type DictionariesDeclaration = Record<string, I18nDictionariesOutput>;
|
|
3
|
-
/**
|
|
4
|
-
* This function writes the dictionaries to the file system
|
|
5
|
-
*/
|
|
6
|
-
export declare const writeDictionary: (dictionariesDeclaration: DictionariesDeclaration) => Promise<string[]>;
|
|
7
|
-
//# sourceMappingURL=writeDictionary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18n_dictionary/writeDictionary.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAKxF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,eAAe,4BACD,uBAAuB,sBA2BjD,CAAC"}
|