@intlayer/chokidar 5.3.2 → 5.3.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.
Files changed (66) hide show
  1. package/dist/cjs/chokidar/watcher.cjs +46 -15
  2. package/dist/cjs/chokidar/watcher.cjs.map +1 -1
  3. package/dist/cjs/{getDictionariesPath.cjs → getBuiltDictionariesPath.cjs} +7 -7
  4. package/dist/cjs/getBuiltDictionariesPath.cjs.map +1 -0
  5. package/dist/cjs/index.cjs +11 -2
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs/listDictionariesPath.cjs +61 -0
  8. package/dist/cjs/listDictionariesPath.cjs.map +1 -0
  9. package/dist/cjs/prepareContentDeclaration.cjs +90 -0
  10. package/dist/cjs/prepareContentDeclaration.cjs.map +1 -0
  11. package/dist/cjs/prepareIntlayer.cjs +2 -29
  12. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  13. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.cjs +2 -4
  14. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.cjs.map +1 -1
  15. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +2 -2
  16. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
  17. package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs +17 -0
  18. package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs.map +1 -0
  19. package/dist/cjs/writeContentDeclaration/index.cjs +25 -0
  20. package/dist/cjs/writeContentDeclaration/index.cjs.map +1 -0
  21. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +125 -0
  22. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -0
  23. package/dist/esm/chokidar/watcher.mjs +46 -16
  24. package/dist/esm/chokidar/watcher.mjs.map +1 -1
  25. package/dist/esm/{getDictionariesPath.mjs → getBuiltDictionariesPath.mjs} +3 -3
  26. package/dist/esm/getBuiltDictionariesPath.mjs.map +1 -0
  27. package/dist/esm/index.mjs +9 -1
  28. package/dist/esm/index.mjs.map +1 -1
  29. package/dist/esm/listDictionariesPath.mjs +27 -0
  30. package/dist/esm/listDictionariesPath.mjs.map +1 -0
  31. package/dist/esm/prepareContentDeclaration.mjs +69 -0
  32. package/dist/esm/prepareContentDeclaration.mjs.map +1 -0
  33. package/dist/esm/prepareIntlayer.mjs +2 -19
  34. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  35. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.mjs +2 -4
  36. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.mjs.map +1 -1
  37. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +2 -2
  38. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
  39. package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs +1 -0
  40. package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs.map +1 -0
  41. package/dist/esm/writeContentDeclaration/index.mjs +3 -0
  42. package/dist/esm/writeContentDeclaration/index.mjs.map +1 -0
  43. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +91 -0
  44. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -0
  45. package/dist/types/chokidar/watcher.d.ts +1 -0
  46. package/dist/types/chokidar/watcher.d.ts.map +1 -1
  47. package/dist/types/getBuiltDictionariesPath.d.ts +5 -0
  48. package/dist/types/getBuiltDictionariesPath.d.ts.map +1 -0
  49. package/dist/types/index.d.ts +3 -0
  50. package/dist/types/index.d.ts.map +1 -1
  51. package/dist/types/listDictionariesPath.d.ts +3 -0
  52. package/dist/types/listDictionariesPath.d.ts.map +1 -0
  53. package/dist/types/prepareContentDeclaration.d.ts +3 -0
  54. package/dist/types/prepareContentDeclaration.d.ts.map +1 -0
  55. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  56. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +2 -0
  57. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -0
  58. package/dist/types/writeContentDeclaration/index.d.ts +3 -0
  59. package/dist/types/writeContentDeclaration/index.d.ts.map +1 -0
  60. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +8 -0
  61. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -0
  62. package/package.json +17 -13
  63. package/dist/cjs/getDictionariesPath.cjs.map +0 -1
  64. package/dist/esm/getDictionariesPath.mjs.map +0 -1
  65. package/dist/types/getDictionariesPath.d.ts +0 -5
  66. package/dist/types/getDictionariesPath.d.ts.map +0 -1
@@ -0,0 +1,91 @@
1
+ import { existsSync } from "fs";
2
+ import * as fsPromises from "fs/promises";
3
+ import { basename, dirname, extname } from "path";
4
+ import { prepareContentDeclaration } from "@intlayer/chokidar";
5
+ import configuration from "@intlayer/config/built";
6
+ import dictionariesRecord from "@intlayer/dictionaries-entry";
7
+ import deepEqual from "deep-equal";
8
+ const DEFAULT_NEW_DICTIONARY_PATH = "intlayer-dictionaries";
9
+ const writeContentDeclaration = async (dictionary, config = configuration, newDictionariesPath) => {
10
+ const { content } = config;
11
+ const { baseDir } = content;
12
+ const newDictionaryRelativeLocationPath = newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;
13
+ const newDictionaryLocationPath = `${baseDir}/${newDictionaryRelativeLocationPath}`;
14
+ const existingDictionary = dictionariesRecord[dictionary.key];
15
+ const preparedContentDeclaration = await prepareContentDeclaration(dictionary);
16
+ const { filePath, $schema, ...dictionaryWithoutPath } = preparedContentDeclaration;
17
+ const formattedContentDeclaration = {
18
+ $schema: "https://intlayer.org/schema.json",
19
+ ...dictionaryWithoutPath
20
+ };
21
+ if (existingDictionary) {
22
+ if (deepEqual(existingDictionary, dictionary)) {
23
+ return {
24
+ status: "up-to-date",
25
+ path: filePath
26
+ };
27
+ } else {
28
+ if (filePath) {
29
+ const isDictionaryJSON = filePath.endsWith(".json");
30
+ if (isDictionaryJSON) {
31
+ const contentDeclarationPath = `${baseDir}/${filePath}`;
32
+ await writeFileWithDirectories(
33
+ contentDeclarationPath,
34
+ formattedContentDeclaration
35
+ );
36
+ return { status: "updated", path: contentDeclarationPath };
37
+ } else {
38
+ await fsPromises.rm(filePath);
39
+ const dictionariesDirPath = dirname(filePath);
40
+ const dictionariesFileName = basename(filePath, extname(filePath));
41
+ const newFilePath = `${dictionariesDirPath}/${dictionariesFileName}.json`;
42
+ await writeFileWithDirectories(
43
+ newFilePath,
44
+ formattedContentDeclaration
45
+ );
46
+ return {
47
+ status: "replaced",
48
+ path: newFilePath
49
+ };
50
+ }
51
+ } else {
52
+ const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;
53
+ await writeFileWithDirectories(
54
+ contentDeclarationPath,
55
+ formattedContentDeclaration
56
+ );
57
+ return {
58
+ status: "reimported in new location",
59
+ path: contentDeclarationPath
60
+ };
61
+ }
62
+ }
63
+ } else {
64
+ const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;
65
+ await writeFileWithDirectories(
66
+ contentDeclarationPath,
67
+ formattedContentDeclaration
68
+ );
69
+ return {
70
+ status: "imported",
71
+ path: contentDeclarationPath
72
+ };
73
+ }
74
+ };
75
+ const writeFileWithDirectories = async (filePath, data) => {
76
+ try {
77
+ const dir = dirname(filePath);
78
+ const directoryExists = existsSync(dir);
79
+ if (!directoryExists) {
80
+ await fsPromises.mkdir(dir, { recursive: true });
81
+ }
82
+ const jsonDictionary = JSON.stringify(data, null, 2);
83
+ await fsPromises.writeFile(filePath, jsonDictionary);
84
+ } catch (error) {
85
+ throw new Error(`Error writing file to ${filePath}: ${error}`);
86
+ }
87
+ };
88
+ export {
89
+ writeContentDeclaration
90
+ };
91
+ //# sourceMappingURL=writeContentDeclaration.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport * as fsPromises from 'fs/promises';\nimport { basename, dirname, extname } from 'path';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { prepareContentDeclaration } from '@intlayer/chokidar';\nimport configuration from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/core';\nimport dictionariesRecord from '@intlayer/dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport type { DictionaryStatus } from './dictionaryStatus';\n\nconst DEFAULT_NEW_DICTIONARY_PATH = 'intlayer-dictionaries';\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n config: IntlayerConfig = configuration,\n newDictionariesPath?: string\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { content } = config;\n const { baseDir } = content;\n\n const newDictionaryRelativeLocationPath =\n newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;\n const newDictionaryLocationPath = `${baseDir}/${newDictionaryRelativeLocationPath}`;\n\n const existingDictionary = dictionariesRecord[dictionary.key];\n\n const preparedContentDeclaration =\n await prepareContentDeclaration(dictionary);\n\n const { filePath, $schema, ...dictionaryWithoutPath } =\n preparedContentDeclaration;\n const formattedContentDeclaration = {\n $schema: 'https://intlayer.org/schema.json',\n ...dictionaryWithoutPath,\n };\n\n if (existingDictionary) {\n // Compare existing dictionary with distant dictionary\n if (deepEqual(existingDictionary, dictionary)) {\n // Up to date, nothing to do\n return {\n status: 'up-to-date',\n path: filePath!,\n };\n } else {\n if (filePath) {\n const isDictionaryJSON = filePath.endsWith('.json');\n\n if (isDictionaryJSON) {\n const contentDeclarationPath = `${baseDir}/${filePath}`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n return { status: 'updated', path: contentDeclarationPath };\n } else {\n // Remove the existing dictionary file\n await fsPromises.rm(filePath);\n\n // Write the dictionary to the intlayer-dictionaries directory\n const dictionariesDirPath = dirname(filePath);\n const dictionariesFileName = basename(filePath, extname(filePath));\n\n const newFilePath = `${dictionariesDirPath}/${dictionariesFileName}.json`;\n\n await writeFileWithDirectories(\n newFilePath,\n formattedContentDeclaration\n );\n\n return {\n status: 'replaced',\n path: newFilePath,\n };\n }\n } else {\n // Write the dictionary to the intlayer-dictionaries directory\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'reimported in new location',\n path: contentDeclarationPath,\n };\n }\n }\n } else {\n // No existing dictionary, write to new location\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n }\n};\n\nconst writeFileWithDirectories = async (\n filePath: string,\n data: string | Buffer\n): Promise<void> => {\n try {\n // Extract the directory from the file path\n const dir = dirname(filePath);\n\n // Check if the directory exists\n const directoryExists = existsSync(dir);\n\n if (!directoryExists) {\n // Create the directory recursively\n await fsPromises.mkdir(dir, { recursive: true });\n }\n\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await fsPromises.writeFile(filePath, jsonDictionary);\n } catch (error) {\n throw new Error(`Error writing file to ${filePath}: ${error}`);\n }\n};\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,YAAY,gBAAgB;AAC5B,SAAS,UAAU,SAAS,eAAe;AAE3C,SAAS,iCAAiC;AAC1C,OAAO,mBAAmB;AAE1B,OAAO,wBAAwB;AAC/B,OAAO,eAAe;AAGtB,MAAM,8BAA8B;AAE7B,MAAM,0BAA0B,OACrC,YACA,SAAyB,eACzB,wBACwD;AACxD,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,QAAQ,IAAI;AAEpB,QAAM,oCACJ,uBAAuB;AACzB,QAAM,4BAA4B,GAAG,OAAO,IAAI,iCAAiC;AAEjF,QAAM,qBAAqB,mBAAmB,WAAW,GAAG;AAE5D,QAAM,6BACJ,MAAM,0BAA0B,UAAU;AAE5C,QAAM,EAAE,UAAU,SAAS,GAAG,sBAAsB,IAClD;AACF,QAAM,8BAA8B;AAAA,IAClC,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,MAAI,oBAAoB;AAEtB,QAAI,UAAU,oBAAoB,UAAU,GAAG;AAE7C,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,IACF,OAAO;AACL,UAAI,UAAU;AACZ,cAAM,mBAAmB,SAAS,SAAS,OAAO;AAElD,YAAI,kBAAkB;AACpB,gBAAM,yBAAyB,GAAG,OAAO,IAAI,QAAQ;AAErD,gBAAM;AAAA,YACJ;AAAA,YACA;AAAA,UACF;AACA,iBAAO,EAAE,QAAQ,WAAW,MAAM,uBAAuB;AAAA,QAC3D,OAAO;AAEL,gBAAM,WAAW,GAAG,QAAQ;AAG5B,gBAAM,sBAAsB,QAAQ,QAAQ;AAC5C,gBAAM,uBAAuB,SAAS,UAAU,QAAQ,QAAQ,CAAC;AAEjE,gBAAM,cAAc,GAAG,mBAAmB,IAAI,oBAAoB;AAElE,gBAAM;AAAA,YACJ;AAAA,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,QAAQ;AAAA,YACR,MAAM;AAAA,UACR;AAAA,QACF;AAAA,MACF,OAAO;AAEL,cAAM,yBAAyB,GAAG,yBAAyB,IAAI,WAAW,GAAG;AAE7E,cAAM;AAAA,UACJ;AAAA,UACA;AAAA,QACF;AAEA,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF,OAAO;AAEL,UAAM,yBAAyB,GAAG,yBAAyB,IAAI,WAAW,GAAG;AAE7E,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,IACF;AAEA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEA,MAAM,2BAA2B,OAC/B,UACA,SACkB;AAClB,MAAI;AAEF,UAAM,MAAM,QAAQ,QAAQ;AAG5B,UAAM,kBAAkB,WAAW,GAAG;AAEtC,QAAI,CAAC,iBAAiB;AAEpB,YAAM,WAAW,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,IACjD;AAEA,UAAM,iBAAiB,KAAK,UAAU,MAAM,MAAM,CAAC;AAGnD,UAAM,WAAW,UAAU,UAAU,cAAc;AAAA,EACrD,SAAS,OAAO;AACd,UAAM,IAAI,MAAM,yBAAyB,QAAQ,KAAK,KAAK,EAAE;AAAA,EAC/D;AACF;","names":[]}
@@ -2,6 +2,7 @@ import { type IntlayerConfig } from '@intlayer/config';
2
2
  /** @ts-ignore remove error Module '"chokidar"' has no exported member 'ChokidarOptions' */
3
3
  import { type ChokidarOptions } from '../chokidar';
4
4
  export declare const handleAdditionalContentDeclarationFile: (filePath: string, configuration?: IntlayerConfig) => Promise<void>;
5
+ export declare const handleUnlikedContentDeclarationFile: (filePath: string, configuration?: IntlayerConfig) => Promise<void>;
5
6
  export declare const handleContentDeclarationFileChange: (filePath: string, configuration?: IntlayerConfig) => Promise<void>;
6
7
  type WatchOptions = ChokidarOptions & {
7
8
  configuration?: IntlayerConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../src/chokidar/watcher.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAC1B,2FAA2F;AAC3F,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,UAAU,CAAC;AAWxE,eAAO,MAAM,sCAAsC,GACjD,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAiC/B,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAuC/B,CAAC;AAEF,KAAK,YAAY,GAAG,eAAe,GAAG;IACpC,aAAa,CAAC,EAAE,cAAc,CAAC;CAChC,CAAC;AAGF,eAAO,MAAM,KAAK,GAAI,UAAU,YAAY,QA+B3C,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAU,UAAU,YAAY,kBASjE,CAAC"}
1
+ {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../src/chokidar/watcher.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAC1B,2FAA2F;AAC3F,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,UAAU,CAAC;AAcxE,eAAO,MAAM,sCAAsC,GACjD,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAiC/B,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAgC/B,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAmC/B,CAAC;AAEF,KAAK,YAAY,GAAG,eAAe,GAAG;IACpC,aAAa,CAAC,EAAE,cAAc,CAAC;CAChC,CAAC;AAGF,eAAO,MAAM,KAAK,GAAI,UAAU,YAAY,QAkD3C,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAU,UAAU,YAAY,kBASjE,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This function generates a list of dictionaries in the main directory
3
+ */
4
+ export declare const getBuiltDictionariesPath: () => string[];
5
+ //# sourceMappingURL=getBuiltDictionariesPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBuiltDictionariesPath.d.ts","sourceRoot":"","sources":["../../src/getBuiltDictionariesPath.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,eAAO,MAAM,wBAAwB,gBASpC,CAAC"}
@@ -6,4 +6,7 @@ export { createModuleAugmentation } from './transpiler/dictionary_to_type/create
6
6
  export { fetchDistantDictionaries } from './fetchDistantDictionaries';
7
7
  export { loadDistantDictionaries, loadDictionaries, loadLocalDictionaries, } from './loadDictionaries/index';
8
8
  export { checkDictionaryChanges } from './checkDictionaryChanges';
9
+ export { listDictionaries } from './listDictionariesPath';
10
+ export { prepareContentDeclaration } from './prepareContentDeclaration';
11
+ export { writeContentDeclaration, type DictionaryStatus, } from './writeContentDeclaration';
9
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,sCAAsC,EACtC,kCAAkC,EAClC,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,4DAA4D,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,sCAAsC,EACtC,kCAAkC,EAClC,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,4DAA4D,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type IntlayerConfig } from '@intlayer/config';
2
+ export declare const listDictionaries: (configuration?: IntlayerConfig) => string[];
3
+ //# sourceMappingURL=listDictionariesPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listDictionariesPath.d.ts","sourceRoot":"","sources":["../../src/listDictionariesPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,kBAAkB,CAAC;AAGzE,eAAO,MAAM,gBAAgB,GAC3B,gBAAe,cAAmC,aAsBnD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Dictionary } from '@intlayer/core';
2
+ export declare const prepareContentDeclaration: (dictionary: Dictionary) => Promise<any>;
3
+ //# sourceMappingURL=prepareContentDeclaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareContentDeclaration.d.ts","sourceRoot":"","sources":["../../src/prepareContentDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,UAAU,EAQhB,MAAM,gBAAgB,CAAC;AAyFxB,eAAO,MAAM,yBAAyB,GAAU,YAAY,UAAU,iBAKlE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAY1B,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,kBAiDnD,CAAC"}
1
+ {"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAY1B,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,kBAgCnD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type DictionaryStatus = 'pending' | 'fetching' | 'up-to-date' | 'replaced' | 'updated' | 'fetched' | 'unknown' | 'error' | 'imported' | 'reimported in JSON' | 'reimported in new location';
2
+ //# sourceMappingURL=dictionaryStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionaryStatus.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/dictionaryStatus.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,UAAU,GACV,YAAY,GACZ,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,UAAU,GACV,oBAAoB,GACpB,4BAA4B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './writeContentDeclaration';
2
+ export * from './dictionaryStatus';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { IntlayerConfig } from '@intlayer/config/client';
2
+ import type { Dictionary } from '@intlayer/core';
3
+ import type { DictionaryStatus } from './dictionaryStatus';
4
+ export declare const writeContentDeclaration: (dictionary: Dictionary, config?: IntlayerConfig, newDictionariesPath?: string) => Promise<{
5
+ status: DictionaryStatus;
6
+ path: string;
7
+ }>;
8
+ //# sourceMappingURL=writeContentDeclaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writeContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,eAAO,MAAM,uBAAuB,GAClC,YAAY,UAAU,EACtB,SAAQ,cAA8B,EACtC,sBAAsB,MAAM,KAC3B,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAyFpD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/chokidar",
3
- "version": "5.3.2",
3
+ "version": "5.3.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": [
@@ -59,17 +59,20 @@
59
59
  "dependencies": {
60
60
  "chokidar": "^3.6.0",
61
61
  "crypto-js": "^4.2.0",
62
+ "deep-equal": "^2.2.3",
62
63
  "deepmerge": "^4.3.1",
63
64
  "fast-glob": "^3.3.3",
64
65
  "p-limit": "^3.1.0",
65
- "@intlayer/config": "5.3.2",
66
- "@intlayer/api": "5.3.2",
67
- "@intlayer/core": "5.3.2",
68
- "intlayer": "5.3.2"
66
+ "@intlayer/api": "5.3.4",
67
+ "@intlayer/core": "5.3.4",
68
+ "@intlayer/dictionaries-entry": "5.3.4",
69
+ "intlayer": "5.3.4",
70
+ "@intlayer/config": "5.3.4"
69
71
  },
70
72
  "devDependencies": {
71
73
  "@changesets/cli": "2.27.12",
72
74
  "@types/crypto-js": "^4.2.2",
75
+ "@types/deep-equal": "^1.0.4",
73
76
  "@types/node": "^22.10.6",
74
77
  "@typescript-eslint/parser": "^8.24.0",
75
78
  "concurrently": "^9.1.2",
@@ -79,19 +82,19 @@
79
82
  "tsc-alias": "^1.8.10",
80
83
  "tsup": "^8.3.5",
81
84
  "typescript": "^5.7.3",
82
- "@intlayer/backend": "5.3.2",
83
- "@utils/eslint-config": "1.0.4",
85
+ "@intlayer/backend": "5.3.3",
84
86
  "@utils/ts-config": "1.0.4",
85
87
  "@utils/ts-config-types": "1.0.4",
86
- "@utils/tsup-config": "1.0.4"
88
+ "@utils/tsup-config": "1.0.4",
89
+ "@utils/eslint-config": "1.0.4"
87
90
  },
88
91
  "peerDependencies": {
89
92
  "fast-glob": "^3.3.3",
90
93
  "react": ">=16.0.0",
91
- "@intlayer/api": "5.3.2",
92
- "@intlayer/config": "5.3.2",
93
- "intlayer": "5.3.2",
94
- "@intlayer/core": "5.3.2"
94
+ "@intlayer/api": "5.3.4",
95
+ "@intlayer/core": "5.3.4",
96
+ "@intlayer/config": "5.3.4",
97
+ "intlayer": "5.3.4"
95
98
  },
96
99
  "engines": {
97
100
  "node": ">=14.18"
@@ -109,6 +112,7 @@
109
112
  "lint:fix": "eslint . --cache --fix",
110
113
  "prettier": "prettier . --check",
111
114
  "prettier:fix": "prettier --write src/**/*",
112
- "reset": "pnpm clean & pnpm build"
115
+ "reset": "pnpm clean & pnpm build",
116
+ "test": ""
113
117
  }
114
118
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/getDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'fs';\nimport { getConfiguration } from '@intlayer/config';\nimport fg from 'fast-glob';\n\nconst { content } = getConfiguration();\nconst { dictionariesDir, mainDir } = content;\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getDictionariesPath = () => {\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(`${dictionariesDir}/**/*.json`);\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAsC;AACtC,oBAAiC;AACjC,uBAAe;AAEf,MAAM,EAAE,QAAQ,QAAI,gCAAiB;AACrC,MAAM,EAAE,iBAAiB,QAAQ,IAAI;AAK9B,MAAM,sBAAsB,MAAM;AAEvC,MAAI,KAAC,sBAAW,OAAO,GAAG;AACxB,6BAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,iBAAAA,QAAG,KAAK,GAAG,eAAe,YAAY;AAEzE,SAAO;AACT;","names":["fg"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/getDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'fs';\nimport { getConfiguration } from '@intlayer/config';\nimport fg from 'fast-glob';\n\nconst { content } = getConfiguration();\nconst { dictionariesDir, mainDir } = content;\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getDictionariesPath = () => {\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(`${dictionariesDir}/**/*.json`);\n\n return dictionariesPath;\n};\n"],"mappings":"AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAS,wBAAwB;AACjC,OAAO,QAAQ;AAEf,MAAM,EAAE,QAAQ,IAAI,iBAAiB;AACrC,MAAM,EAAE,iBAAiB,QAAQ,IAAI;AAK9B,MAAM,sBAAsB,MAAM;AAEvC,MAAI,CAAC,WAAW,OAAO,GAAG;AACxB,cAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,GAAG,KAAK,GAAG,eAAe,YAAY;AAEzE,SAAO;AACT;","names":[]}
@@ -1,5 +0,0 @@
1
- /**
2
- * This function generates a list of dictionaries in the main directory
3
- */
4
- export declare const getDictionariesPath: () => string[];
5
- //# sourceMappingURL=getDictionariesPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDictionariesPath.d.ts","sourceRoot":"","sources":["../../src/getDictionariesPath.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,eAAO,MAAM,mBAAmB,gBAS/B,CAAC"}