@intlayer/chokidar 5.5.7 → 5.5.8
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/README.md +2 -2
- package/dist/cjs/getBuiltUnmergedDictionariesPath.cjs +1 -1
- package/dist/cjs/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs +8 -5
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs.map +1 -1
- package/dist/esm/getBuiltUnmergedDictionariesPath.mjs +2 -2
- package/dist/esm/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs +12 -5
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs.map +1 -1
- package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts.map +1 -1
- package/package.json +26 -26
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ yarn add @intlayer/chokidar
|
|
|
51
51
|
## Read about Intlayer
|
|
52
52
|
|
|
53
53
|
- [Intlayer Website](https://intlayer.org)
|
|
54
|
-
- [Intlayer Documentation](https://intlayer.org/
|
|
54
|
+
- [Intlayer Documentation](https://intlayer.org/doc)
|
|
55
55
|
- [Intlayer GitHub](https://github.com/aymericzip/intlayer)
|
|
56
56
|
|
|
57
|
-
- [Ask your questions to our smart documentation](https://intlayer.org/
|
|
57
|
+
- [Ask your questions to our smart documentation](https://intlayer.org/docchat)
|
|
@@ -40,7 +40,7 @@ const getBuiltUnmergedDictionariesPath = (configuration = (0, import_config.getC
|
|
|
40
40
|
(0, import_fs.mkdirSync)(mainDir, { recursive: true });
|
|
41
41
|
}
|
|
42
42
|
const dictionariesPath = import_fast_glob.default.sync(
|
|
43
|
-
`${unmergedDictionariesDir}/**/*.json`
|
|
43
|
+
`${(0, import_config.normalizePathForGlob)(unmergedDictionariesDir)}/**/*.json`
|
|
44
44
|
);
|
|
45
45
|
return dictionariesPath;
|
|
46
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getBuiltUnmergedDictionariesPath.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync } from 'fs';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltUnmergedDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { unmergedDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${unmergedDictionariesDir}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/getBuiltUnmergedDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePathForGlob } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync } from 'fs';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltUnmergedDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { unmergedDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePathForGlob(unmergedDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuD;AACvD,uBAAe;AACf,gBAAsC;AAK/B,MAAM,mCAAmC,CAC9C,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,yBAAyB,QAAQ,IAAI,cAAc;AAG3D,MAAI,KAAC,sBAAW,OAAO,GAAG;AACxB,6BAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,iBAAAA,QAAG;AAAA,IACpC,OAAG,oCAAqB,uBAAuB,CAAC;AAAA,EAClD;AAEA,SAAO;AACT;","names":["fg"]}
|
|
@@ -32,10 +32,10 @@ __export(createModuleAugmentation_exports, {
|
|
|
32
32
|
getTypeName: () => getTypeName
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(createModuleAugmentation_exports);
|
|
35
|
-
var import_fs = require("fs");
|
|
36
|
-
var import_path = require("path");
|
|
37
35
|
var import_config = require("@intlayer/config");
|
|
38
36
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
37
|
+
var import_fs = require("fs");
|
|
38
|
+
var import_path = require("path");
|
|
39
39
|
var import_utils = require('../../utils.cjs');
|
|
40
40
|
const getTypeName = (key) => `${(0, import_utils.kebabCaseToCamelCase)(key)}Content`;
|
|
41
41
|
const formatLocales = (locales) => locales.map((locale) => {
|
|
@@ -94,9 +94,12 @@ const createModuleAugmentation = (configuration = (0, import_config.getConfigura
|
|
|
94
94
|
if (!(0, import_fs.existsSync)(moduleAugmentationDir)) {
|
|
95
95
|
(0, import_fs.mkdirSync)(moduleAugmentationDir, { recursive: true });
|
|
96
96
|
}
|
|
97
|
-
const dictionariesTypesDefinitions = import_fast_glob.default.sync(
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
const dictionariesTypesDefinitions = import_fast_glob.default.sync(
|
|
98
|
+
(0, import_config.normalizePathForGlob)(`${typesDir}/*.ts`),
|
|
99
|
+
{
|
|
100
|
+
ignore: ["**/*.d.ts"]
|
|
101
|
+
}
|
|
102
|
+
);
|
|
100
103
|
const tsContent = generateTypeIndexContent(dictionariesTypesDefinitions);
|
|
101
104
|
(0, import_fs.writeFileSync)((0, import_path.join)(moduleAugmentationDir, "intlayer.d.ts"), tsContent);
|
|
102
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createModuleAugmentation.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { basename, extname, join, relative } from 'path';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createModuleAugmentation.ts"],"sourcesContent":["import {\n Locales,\n getConfiguration,\n normalizePathForGlob,\n} from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { basename, extname, join, relative } from 'path';\nimport { getFileHash, kebabCaseToCamelCase } from '../../utils';\n\nexport const getTypeName = (key: string): string =>\n `${kebabCaseToCamelCase(key)}Content`;\n\nconst formatLocales = (locales: Locales[]): string =>\n locales\n .map((locale) => {\n for (const key in Locales) {\n if (Locales[key as keyof typeof Locales] === locale) {\n return `Locales.${key}`;\n }\n }\n })\n .join(' | ');\n\n/**\n * This function generates the content of the module augmentation file\n */\nconst generateTypeIndexContent = (\n typeFiles: string[],\n configuration = getConfiguration()\n): string => {\n const { content, internationalization } = configuration;\n const { moduleAugmentationDir } = content;\n const { locales, requiredLocales, strictMode } = internationalization;\n\n let fileContent =\n \"/* eslint-disable */\\nimport { Locales } from 'intlayer';\\n\";\n\n const dictionariesRef = typeFiles.map((dictionaryPath) => ({\n relativePath: `./${relative(moduleAugmentationDir, dictionaryPath)}`,\n id: basename(dictionaryPath, extname(dictionaryPath)), // Get the base name as the dictionary id (without the extension)\n hash: `_${getFileHash(dictionaryPath)}`, // Get the hash of the dictionary to avoid conflicts\n }));\n\n // Import all dictionaries\n dictionariesRef.forEach((dictionary) => {\n fileContent += `import ${dictionary.hash} from '${dictionary.relativePath}';\\n`;\n });\n\n fileContent += '\\n';\n\n // Format Dictionary Map\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": typeof ${dictionary.hash};`)\n .join('\\n');\n\n const requiredLocalesValues =\n requiredLocales.length > 0\n ? requiredLocales.filter((locale) =>\n locales.map((locale) => String(locale)).includes(String(locale))\n )\n : locales;\n\n const formattedLocales = formatLocales(locales);\n const formattedRequiredLocales = formatLocales(requiredLocalesValues);\n\n const strictModeRecord =\n strictMode === 'strict'\n ? `interface IConfigLocales<Content> extends Record<DeclaredLocales, Content> {}`\n : strictMode === 'inclusive'\n ? `interface IConfigLocales<Content> extends Record<ExtractedLocales, Content>, Partial<Record<ExcludedLocales, Content>> {}`\n : `interface IConfigLocales<Content> extends Partial<Record<Locales, Content>> {}`;\n\n /**\n * Write the module augmentation to extend the intlayer module with the dictionaries types\n * Will suggest the type resulting of the dictionaries\n *\n * declare module 'intlayer' {\n * interface IntlayerDictionaryTypesConnector = {\n * dictionaries: {\n * id: DictionaryType;\n * }\n * }\n *\n * type ConfigLocales = Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH;\n * type ExtractedLocales = Extract<Locales, ConfigLocales>;\n *\n * interface IConfigLocales<Content> extends Record<ExtractedLocales, Content>, Partial<Record<ExcludedLocales, Content>> {}\n *\n *\n * }\n * See https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation\n */\n fileContent += `declare module 'intlayer' {\\n`;\n fileContent += ` interface IntlayerDictionaryTypesConnector {\\n${formattedDictionaryMap}\\n }\\n\\n`;\n fileContent += ` type DeclaredLocales = ${formattedLocales};\\n`;\n fileContent += ` type RequiredLocales = ${formattedRequiredLocales};\\n`;\n fileContent += ` type ExtractedLocales = Extract<Locales, RequiredLocales>;\\n`;\n fileContent += ` type ExcludedLocales = Exclude<Locales, RequiredLocales>;\\n`;\n fileContent += ` ${strictModeRecord}\\n`;\n fileContent += `}`;\n\n return fileContent;\n};\n\n/**\n * This function generates a index file merging all the types\n */\nexport const createModuleAugmentation = (\n configuration = getConfiguration()\n) => {\n const { moduleAugmentationDir, typesDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(moduleAugmentationDir)) {\n mkdirSync(moduleAugmentationDir, { recursive: true });\n }\n\n const dictionariesTypesDefinitions: string[] = fg.sync(\n normalizePathForGlob(`${typesDir}/*.ts`),\n {\n ignore: ['**/*.d.ts'],\n }\n );\n // Create the dictionary list file\n\n const tsContent = generateTypeIndexContent(dictionariesTypesDefinitions);\n writeFileSync(join(moduleAugmentationDir, 'intlayer.d.ts'), tsContent);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAIO;AACP,uBAAe;AACf,gBAAqD;AACrD,kBAAkD;AAClD,mBAAkD;AAE3C,MAAM,cAAc,CAAC,QAC1B,OAAG,mCAAqB,GAAG,CAAC;AAE9B,MAAM,gBAAgB,CAAC,YACrB,QACG,IAAI,CAAC,WAAW;AACf,aAAW,OAAO,uBAAS;AACzB,QAAI,sBAAQ,GAA2B,MAAM,QAAQ;AACnD,aAAO,WAAW,GAAG;AAAA,IACvB;AAAA,EACF;AACF,CAAC,EACA,KAAK,KAAK;AAKf,MAAM,2BAA2B,CAC/B,WACA,oBAAgB,gCAAiB,MACtB;AACX,QAAM,EAAE,SAAS,qBAAqB,IAAI;AAC1C,QAAM,EAAE,sBAAsB,IAAI;AAClC,QAAM,EAAE,SAAS,iBAAiB,WAAW,IAAI;AAEjD,MAAI,cACF;AAEF,QAAM,kBAAkB,UAAU,IAAI,CAAC,oBAAoB;AAAA,IACzD,cAAc,SAAK,sBAAS,uBAAuB,cAAc,CAAC;AAAA,IAClE,QAAI,sBAAS,oBAAgB,qBAAQ,cAAc,CAAC;AAAA;AAAA,IACpD,MAAM,QAAI,0BAAY,cAAc,CAAC;AAAA;AAAA,EACvC,EAAE;AAGF,kBAAgB,QAAQ,CAAC,eAAe;AACtC,mBAAe,UAAU,WAAW,IAAI,UAAU,WAAW,YAAY;AAAA;AAAA,EAC3E,CAAC;AAED,iBAAe;AAGf,QAAM,yBAAiC,gBACpC,IAAI,CAAC,eAAe,QAAQ,WAAW,EAAE,aAAa,WAAW,IAAI,GAAG,EACxE,KAAK,IAAI;AAEZ,QAAM,wBACJ,gBAAgB,SAAS,IACrB,gBAAgB;AAAA,IAAO,CAAC,WACtB,QAAQ,IAAI,CAACA,YAAW,OAAOA,OAAM,CAAC,EAAE,SAAS,OAAO,MAAM,CAAC;AAAA,EACjE,IACA;AAEN,QAAM,mBAAmB,cAAc,OAAO;AAC9C,QAAM,2BAA2B,cAAc,qBAAqB;AAEpE,QAAM,mBACJ,eAAe,WACX,kFACA,eAAe,cACb,8HACA;AAsBR,iBAAe;AAAA;AACf,iBAAe;AAAA,EAAmD,sBAAsB;AAAA;AAAA;AAAA;AACxF,iBAAe,4BAA4B,gBAAgB;AAAA;AAC3D,iBAAe,4BAA4B,wBAAwB;AAAA;AACnE,iBAAe;AAAA;AACf,iBAAe;AAAA;AACf,iBAAe,KAAK,gBAAgB;AAAA;AACpC,iBAAe;AAEf,SAAO;AACT;AAKO,MAAM,2BAA2B,CACtC,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,uBAAuB,SAAS,IAAI,cAAc;AAG1D,MAAI,KAAC,sBAAW,qBAAqB,GAAG;AACtC,6BAAU,uBAAuB,EAAE,WAAW,KAAK,CAAC;AAAA,EACtD;AAEA,QAAM,+BAAyC,iBAAAC,QAAG;AAAA,QAChD,oCAAqB,GAAG,QAAQ,OAAO;AAAA,IACvC;AAAA,MACE,QAAQ,CAAC,WAAW;AAAA,IACtB;AAAA,EACF;AAGA,QAAM,YAAY,yBAAyB,4BAA4B;AACvE,mCAAc,kBAAK,uBAAuB,eAAe,GAAG,SAAS;AACvE;","names":["locale","fg"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getConfiguration } from "@intlayer/config";
|
|
1
|
+
import { getConfiguration, normalizePathForGlob } from "@intlayer/config";
|
|
2
2
|
import fg from "fast-glob";
|
|
3
3
|
import { existsSync, mkdirSync } from "fs";
|
|
4
4
|
const getBuiltUnmergedDictionariesPath = (configuration = getConfiguration()) => {
|
|
@@ -7,7 +7,7 @@ const getBuiltUnmergedDictionariesPath = (configuration = getConfiguration()) =>
|
|
|
7
7
|
mkdirSync(mainDir, { recursive: true });
|
|
8
8
|
}
|
|
9
9
|
const dictionariesPath = fg.sync(
|
|
10
|
-
`${unmergedDictionariesDir}/**/*.json`
|
|
10
|
+
`${normalizePathForGlob(unmergedDictionariesDir)}/**/*.json`
|
|
11
11
|
);
|
|
12
12
|
return dictionariesPath;
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getBuiltUnmergedDictionariesPath.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync } from 'fs';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltUnmergedDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { unmergedDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${unmergedDictionariesDir}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":"AAAA,SAAS,
|
|
1
|
+
{"version":3,"sources":["../../src/getBuiltUnmergedDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePathForGlob } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync } from 'fs';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltUnmergedDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { unmergedDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePathForGlob(unmergedDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":"AAAA,SAAS,kBAAkB,4BAA4B;AACvD,OAAO,QAAQ;AACf,SAAS,YAAY,iBAAiB;AAK/B,MAAM,mCAAmC,CAC9C,gBAAgB,iBAAiB,MAC9B;AACH,QAAM,EAAE,yBAAyB,QAAQ,IAAI,cAAc;AAG3D,MAAI,CAAC,WAAW,OAAO,GAAG;AACxB,cAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,GAAG;AAAA,IACpC,GAAG,qBAAqB,uBAAuB,CAAC;AAAA,EAClD;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Locales,
|
|
3
|
+
getConfiguration,
|
|
4
|
+
normalizePathForGlob
|
|
5
|
+
} from "@intlayer/config";
|
|
6
|
+
import fg from "fast-glob";
|
|
1
7
|
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
2
8
|
import { basename, extname, join, relative } from "path";
|
|
3
|
-
import { Locales, getConfiguration } from "@intlayer/config";
|
|
4
|
-
import fg from "fast-glob";
|
|
5
9
|
import { getFileHash, kebabCaseToCamelCase } from "../../utils.mjs";
|
|
6
10
|
const getTypeName = (key) => `${kebabCaseToCamelCase(key)}Content`;
|
|
7
11
|
const formatLocales = (locales) => locales.map((locale) => {
|
|
@@ -60,9 +64,12 @@ const createModuleAugmentation = (configuration = getConfiguration()) => {
|
|
|
60
64
|
if (!existsSync(moduleAugmentationDir)) {
|
|
61
65
|
mkdirSync(moduleAugmentationDir, { recursive: true });
|
|
62
66
|
}
|
|
63
|
-
const dictionariesTypesDefinitions = fg.sync(
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
const dictionariesTypesDefinitions = fg.sync(
|
|
68
|
+
normalizePathForGlob(`${typesDir}/*.ts`),
|
|
69
|
+
{
|
|
70
|
+
ignore: ["**/*.d.ts"]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
66
73
|
const tsContent = generateTypeIndexContent(dictionariesTypesDefinitions);
|
|
67
74
|
writeFileSync(join(moduleAugmentationDir, "intlayer.d.ts"), tsContent);
|
|
68
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createModuleAugmentation.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { basename, extname, join, relative } from 'path';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createModuleAugmentation.ts"],"sourcesContent":["import {\n Locales,\n getConfiguration,\n normalizePathForGlob,\n} from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { basename, extname, join, relative } from 'path';\nimport { getFileHash, kebabCaseToCamelCase } from '../../utils';\n\nexport const getTypeName = (key: string): string =>\n `${kebabCaseToCamelCase(key)}Content`;\n\nconst formatLocales = (locales: Locales[]): string =>\n locales\n .map((locale) => {\n for (const key in Locales) {\n if (Locales[key as keyof typeof Locales] === locale) {\n return `Locales.${key}`;\n }\n }\n })\n .join(' | ');\n\n/**\n * This function generates the content of the module augmentation file\n */\nconst generateTypeIndexContent = (\n typeFiles: string[],\n configuration = getConfiguration()\n): string => {\n const { content, internationalization } = configuration;\n const { moduleAugmentationDir } = content;\n const { locales, requiredLocales, strictMode } = internationalization;\n\n let fileContent =\n \"/* eslint-disable */\\nimport { Locales } from 'intlayer';\\n\";\n\n const dictionariesRef = typeFiles.map((dictionaryPath) => ({\n relativePath: `./${relative(moduleAugmentationDir, dictionaryPath)}`,\n id: basename(dictionaryPath, extname(dictionaryPath)), // Get the base name as the dictionary id (without the extension)\n hash: `_${getFileHash(dictionaryPath)}`, // Get the hash of the dictionary to avoid conflicts\n }));\n\n // Import all dictionaries\n dictionariesRef.forEach((dictionary) => {\n fileContent += `import ${dictionary.hash} from '${dictionary.relativePath}';\\n`;\n });\n\n fileContent += '\\n';\n\n // Format Dictionary Map\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": typeof ${dictionary.hash};`)\n .join('\\n');\n\n const requiredLocalesValues =\n requiredLocales.length > 0\n ? requiredLocales.filter((locale) =>\n locales.map((locale) => String(locale)).includes(String(locale))\n )\n : locales;\n\n const formattedLocales = formatLocales(locales);\n const formattedRequiredLocales = formatLocales(requiredLocalesValues);\n\n const strictModeRecord =\n strictMode === 'strict'\n ? `interface IConfigLocales<Content> extends Record<DeclaredLocales, Content> {}`\n : strictMode === 'inclusive'\n ? `interface IConfigLocales<Content> extends Record<ExtractedLocales, Content>, Partial<Record<ExcludedLocales, Content>> {}`\n : `interface IConfigLocales<Content> extends Partial<Record<Locales, Content>> {}`;\n\n /**\n * Write the module augmentation to extend the intlayer module with the dictionaries types\n * Will suggest the type resulting of the dictionaries\n *\n * declare module 'intlayer' {\n * interface IntlayerDictionaryTypesConnector = {\n * dictionaries: {\n * id: DictionaryType;\n * }\n * }\n *\n * type ConfigLocales = Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH;\n * type ExtractedLocales = Extract<Locales, ConfigLocales>;\n *\n * interface IConfigLocales<Content> extends Record<ExtractedLocales, Content>, Partial<Record<ExcludedLocales, Content>> {}\n *\n *\n * }\n * See https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation\n */\n fileContent += `declare module 'intlayer' {\\n`;\n fileContent += ` interface IntlayerDictionaryTypesConnector {\\n${formattedDictionaryMap}\\n }\\n\\n`;\n fileContent += ` type DeclaredLocales = ${formattedLocales};\\n`;\n fileContent += ` type RequiredLocales = ${formattedRequiredLocales};\\n`;\n fileContent += ` type ExtractedLocales = Extract<Locales, RequiredLocales>;\\n`;\n fileContent += ` type ExcludedLocales = Exclude<Locales, RequiredLocales>;\\n`;\n fileContent += ` ${strictModeRecord}\\n`;\n fileContent += `}`;\n\n return fileContent;\n};\n\n/**\n * This function generates a index file merging all the types\n */\nexport const createModuleAugmentation = (\n configuration = getConfiguration()\n) => {\n const { moduleAugmentationDir, typesDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(moduleAugmentationDir)) {\n mkdirSync(moduleAugmentationDir, { recursive: true });\n }\n\n const dictionariesTypesDefinitions: string[] = fg.sync(\n normalizePathForGlob(`${typesDir}/*.ts`),\n {\n ignore: ['**/*.d.ts'],\n }\n );\n // Create the dictionary list file\n\n const tsContent = generateTypeIndexContent(dictionariesTypesDefinitions);\n writeFileSync(join(moduleAugmentationDir, 'intlayer.d.ts'), tsContent);\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,QAAQ;AACf,SAAS,YAAY,WAAW,qBAAqB;AACrD,SAAS,UAAU,SAAS,MAAM,gBAAgB;AAClD,SAAS,aAAa,4BAA4B;AAE3C,MAAM,cAAc,CAAC,QAC1B,GAAG,qBAAqB,GAAG,CAAC;AAE9B,MAAM,gBAAgB,CAAC,YACrB,QACG,IAAI,CAAC,WAAW;AACf,aAAW,OAAO,SAAS;AACzB,QAAI,QAAQ,GAA2B,MAAM,QAAQ;AACnD,aAAO,WAAW,GAAG;AAAA,IACvB;AAAA,EACF;AACF,CAAC,EACA,KAAK,KAAK;AAKf,MAAM,2BAA2B,CAC/B,WACA,gBAAgB,iBAAiB,MACtB;AACX,QAAM,EAAE,SAAS,qBAAqB,IAAI;AAC1C,QAAM,EAAE,sBAAsB,IAAI;AAClC,QAAM,EAAE,SAAS,iBAAiB,WAAW,IAAI;AAEjD,MAAI,cACF;AAEF,QAAM,kBAAkB,UAAU,IAAI,CAAC,oBAAoB;AAAA,IACzD,cAAc,KAAK,SAAS,uBAAuB,cAAc,CAAC;AAAA,IAClE,IAAI,SAAS,gBAAgB,QAAQ,cAAc,CAAC;AAAA;AAAA,IACpD,MAAM,IAAI,YAAY,cAAc,CAAC;AAAA;AAAA,EACvC,EAAE;AAGF,kBAAgB,QAAQ,CAAC,eAAe;AACtC,mBAAe,UAAU,WAAW,IAAI,UAAU,WAAW,YAAY;AAAA;AAAA,EAC3E,CAAC;AAED,iBAAe;AAGf,QAAM,yBAAiC,gBACpC,IAAI,CAAC,eAAe,QAAQ,WAAW,EAAE,aAAa,WAAW,IAAI,GAAG,EACxE,KAAK,IAAI;AAEZ,QAAM,wBACJ,gBAAgB,SAAS,IACrB,gBAAgB;AAAA,IAAO,CAAC,WACtB,QAAQ,IAAI,CAACA,YAAW,OAAOA,OAAM,CAAC,EAAE,SAAS,OAAO,MAAM,CAAC;AAAA,EACjE,IACA;AAEN,QAAM,mBAAmB,cAAc,OAAO;AAC9C,QAAM,2BAA2B,cAAc,qBAAqB;AAEpE,QAAM,mBACJ,eAAe,WACX,kFACA,eAAe,cACb,8HACA;AAsBR,iBAAe;AAAA;AACf,iBAAe;AAAA,EAAmD,sBAAsB;AAAA;AAAA;AAAA;AACxF,iBAAe,4BAA4B,gBAAgB;AAAA;AAC3D,iBAAe,4BAA4B,wBAAwB;AAAA;AACnE,iBAAe;AAAA;AACf,iBAAe;AAAA;AACf,iBAAe,KAAK,gBAAgB;AAAA;AACpC,iBAAe;AAEf,SAAO;AACT;AAKO,MAAM,2BAA2B,CACtC,gBAAgB,iBAAiB,MAC9B;AACH,QAAM,EAAE,uBAAuB,SAAS,IAAI,cAAc;AAG1D,MAAI,CAAC,WAAW,qBAAqB,GAAG;AACtC,cAAU,uBAAuB,EAAE,WAAW,KAAK,CAAC;AAAA,EACtD;AAEA,QAAM,+BAAyC,GAAG;AAAA,IAChD,qBAAqB,GAAG,QAAQ,OAAO;AAAA,IACvC;AAAA,MACE,QAAQ,CAAC,WAAW;AAAA,IACtB;AAAA,EACF;AAGA,QAAM,YAAY,yBAAyB,4BAA4B;AACvE,gBAAc,KAAK,uBAAuB,eAAe,GAAG,SAAS;AACvE;","names":["locale"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createModuleAugmentation.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_type/createModuleAugmentation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createModuleAugmentation.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_type/createModuleAugmentation.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,MACH,CAAC;AA8FxC;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,yDAAkC,SAmBnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/chokidar",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.8",
|
|
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": [
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"./package.json"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@babel/generator": "^7.27.
|
|
61
|
-
"@babel/parser": "^7.27.
|
|
62
|
-
"@babel/traverse": "^7.27.
|
|
63
|
-
"@babel/types": "^7.27.
|
|
60
|
+
"@babel/generator": "^7.27.5",
|
|
61
|
+
"@babel/parser": "^7.27.5",
|
|
62
|
+
"@babel/traverse": "^7.27.4",
|
|
63
|
+
"@babel/types": "^7.27.6",
|
|
64
64
|
"chokidar": "^3.6.0",
|
|
65
65
|
"crypto-js": "^4.2.0",
|
|
66
66
|
"deep-equal": "^2.2.3",
|
|
@@ -68,41 +68,41 @@
|
|
|
68
68
|
"fast-glob": "^3.3.3",
|
|
69
69
|
"p-limit": "^3.1.0",
|
|
70
70
|
"simple-git": "^3.27.0",
|
|
71
|
-
"@intlayer/
|
|
72
|
-
"@intlayer/
|
|
73
|
-
"@intlayer/
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"@intlayer/unmerged-dictionaries-entry": "5.5.
|
|
76
|
-
"intlayer": "5.5.
|
|
71
|
+
"@intlayer/api": "5.5.8",
|
|
72
|
+
"@intlayer/config": "5.5.8",
|
|
73
|
+
"@intlayer/dictionaries-entry": "5.5.8",
|
|
74
|
+
"@intlayer/core": "5.5.8",
|
|
75
|
+
"@intlayer/unmerged-dictionaries-entry": "5.5.8",
|
|
76
|
+
"intlayer": "5.5.8"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@changesets/cli": "2.
|
|
79
|
+
"@changesets/cli": "2.29.4",
|
|
80
80
|
"@types/babel__generator": "^7.27.0",
|
|
81
81
|
"@types/babel__traverse": "^7.20.7",
|
|
82
82
|
"@types/crypto-js": "^4.2.2",
|
|
83
83
|
"@types/deep-equal": "^1.0.4",
|
|
84
|
-
"@types/node": "^22.
|
|
85
|
-
"@typescript-eslint/parser": "^8.
|
|
84
|
+
"@types/node": "^22.15.30",
|
|
85
|
+
"@typescript-eslint/parser": "^8.33.1",
|
|
86
86
|
"concurrently": "^9.1.2",
|
|
87
|
-
"eslint": "^9.
|
|
87
|
+
"eslint": "^9.28.0",
|
|
88
88
|
"prettier": "^3.5.3",
|
|
89
89
|
"rimraf": "^6.0.1",
|
|
90
|
-
"tsc-alias": "^1.8.
|
|
91
|
-
"tsup": "^8.
|
|
92
|
-
"typescript": "^5.8.
|
|
93
|
-
"@intlayer/backend": "5.5.
|
|
94
|
-
"@utils/
|
|
95
|
-
"@utils/tsup-config": "1.0.4",
|
|
90
|
+
"tsc-alias": "^1.8.16",
|
|
91
|
+
"tsup": "^8.5.0",
|
|
92
|
+
"typescript": "^5.8.3",
|
|
93
|
+
"@intlayer/backend": "5.5.8",
|
|
94
|
+
"@utils/eslint-config": "1.0.4",
|
|
96
95
|
"@utils/ts-config-types": "1.0.4",
|
|
97
|
-
"@utils/
|
|
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/
|
|
103
|
-
"@intlayer/core": "5.5.
|
|
104
|
-
"intlayer": "5.5.
|
|
105
|
-
"@intlayer/
|
|
102
|
+
"@intlayer/config": "5.5.8",
|
|
103
|
+
"@intlayer/core": "5.5.8",
|
|
104
|
+
"intlayer": "5.5.8",
|
|
105
|
+
"@intlayer/api": "5.5.8"
|
|
106
106
|
},
|
|
107
107
|
"engines": {
|
|
108
108
|
"node": ">=14.18"
|