@intlayer/chokidar 6.0.1 → 6.0.2-canary.0

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 (54) hide show
  1. package/dist/cjs/index.cjs +6 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
  4. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  5. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +0 -1
  6. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  7. package/dist/cjs/loadDictionaries/log.cjs +14 -9
  8. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  9. package/dist/cjs/prepareIntlayer.cjs +29 -9
  10. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  11. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +20 -9
  12. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
  13. package/dist/cjs/transpiler/dictionary_to_main/generateDictionaryListContent.cjs +19 -7
  14. package/dist/cjs/transpiler/dictionary_to_main/generateDictionaryListContent.cjs.map +1 -1
  15. package/dist/cjs/utils/extractErrorMessage.cjs +126 -0
  16. package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -0
  17. package/dist/cjs/utils/getExtention.cjs +37 -0
  18. package/dist/cjs/utils/getExtention.cjs.map +1 -0
  19. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +5 -5
  20. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  21. package/dist/esm/index.mjs +4 -0
  22. package/dist/esm/index.mjs.map +1 -1
  23. package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
  24. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  25. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +0 -1
  26. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
  27. package/dist/esm/loadDictionaries/log.mjs +14 -9
  28. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  29. package/dist/esm/prepareIntlayer.mjs +19 -9
  30. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  31. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +20 -9
  32. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
  33. package/dist/esm/transpiler/dictionary_to_main/generateDictionaryListContent.mjs +19 -7
  34. package/dist/esm/transpiler/dictionary_to_main/generateDictionaryListContent.mjs.map +1 -1
  35. package/dist/esm/utils/extractErrorMessage.mjs +102 -0
  36. package/dist/esm/utils/extractErrorMessage.mjs.map +1 -0
  37. package/dist/esm/utils/getExtention.mjs +13 -0
  38. package/dist/esm/utils/getExtention.mjs.map +1 -0
  39. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +5 -5
  40. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  41. package/dist/types/index.d.ts +2 -0
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
  44. package/dist/types/loadDictionaries/log.d.ts +1 -1
  45. package/dist/types/loadDictionaries/log.d.ts.map +1 -1
  46. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  47. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +1 -1
  48. package/dist/types/transpiler/dictionary_to_main/generateDictionaryListContent.d.ts +1 -1
  49. package/dist/types/transpiler/dictionary_to_main/generateDictionaryListContent.d.ts.map +1 -1
  50. package/dist/types/utils/extractErrorMessage.d.ts +2 -0
  51. package/dist/types/utils/extractErrorMessage.d.ts.map +1 -0
  52. package/dist/types/utils/getExtention.d.ts +3 -0
  53. package/dist/types/utils/getExtention.d.ts.map +1 -0
  54. package/package.json +16 -16
@@ -15,8 +15,13 @@ const filterDictionaries = (paths, keys) => {
15
15
  (path) => keys.some((key) => path.endsWith(`${key}.json`))
16
16
  );
17
17
  };
18
- const writeDictionaryFiles = async (paths, fileName, format, configuration = getConfiguration()) => {
19
- const content = generateDictionaryListContent(paths, format, configuration);
18
+ const writeDictionaryFiles = async (paths, fileName, functionName, format, configuration = getConfiguration()) => {
19
+ const content = generateDictionaryListContent(
20
+ paths,
21
+ functionName,
22
+ format,
23
+ configuration
24
+ );
20
25
  const extension = format === "cjs" ? "cjs" : "mjs";
21
26
  const { mainDir } = configuration.content;
22
27
  await writeFileIfChanged(
@@ -24,7 +29,8 @@ const writeDictionaryFiles = async (paths, fileName, format, configuration = get
24
29
  content
25
30
  );
26
31
  };
27
- const createDictionaryEntryPoint = async (configuration = getConfiguration(), dictionariesKeys, formats = ["cjs", "esm"]) => {
32
+ const createDictionaryEntryPoint = async (configuration = getConfiguration(), dictionariesKeys, formats) => {
33
+ const outputFormats = formats ?? configuration.build.outputFormat;
28
34
  const { mainDir } = configuration.content;
29
35
  await mkdir(mainDir, { recursive: true });
30
36
  const remoteDictionariesPath = getBuiltRemoteDictionariesPath(configuration);
@@ -34,35 +40,40 @@ const createDictionaryEntryPoint = async (configuration = getConfiguration(), di
34
40
  );
35
41
  const unmergedDictionariesPath = getBuiltUnmergedDictionariesPath(configuration);
36
42
  const writeOperations = [
37
- ...formats.map((format) => ({
43
+ ...outputFormats.map((format) => ({
38
44
  paths: remoteDictionariesPath,
45
+ functionName: "getRemoteDictionaries",
39
46
  fileName: "remote_dictionaries",
40
47
  format
41
48
  })),
42
- ...formats.map((format) => ({
49
+ ...outputFormats.map((format) => ({
43
50
  paths: dictionariesPath,
51
+ functionName: "getDictionaries",
44
52
  fileName: "dictionaries",
45
53
  format
46
54
  })),
47
- ...formats.map((format) => ({
55
+ ...outputFormats.map((format) => ({
48
56
  paths: unmergedDictionariesPath,
57
+ functionName: "getUnmergedDictionaries",
49
58
  fileName: "unmerged_dictionaries",
50
59
  format
51
60
  })),
52
- ...formats.map((format) => ({
61
+ ...outputFormats.map((format) => ({
53
62
  paths: getBuiltDynamicDictionariesPath(configuration, format),
63
+ functionName: "getDynamicDictionaries",
54
64
  fileName: "dynamic_dictionaries",
55
65
  format
56
66
  })),
57
- ...formats.map((format) => ({
67
+ ...outputFormats.map((format) => ({
58
68
  paths: getBuiltFetchDictionariesPath(configuration, format),
69
+ functionName: "getFetchDictionaries",
59
70
  fileName: "fetch_dictionaries",
60
71
  format
61
72
  }))
62
73
  ];
63
74
  await parallelize(
64
75
  writeOperations,
65
- async ({ paths, fileName, format }) => writeDictionaryFiles(paths, fileName, format, configuration)
76
+ async ({ paths, fileName, format, functionName }) => writeDictionaryFiles(paths, fileName, functionName, format, configuration)
66
77
  );
67
78
  };
68
79
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { mkdir } from 'fs/promises';\nimport { resolve } from 'path';\nimport { getBuiltDictionariesPath } from '../../getBuiltDictionariesPath';\nimport { getBuiltDynamicDictionariesPath } from '../../getBuiltDynamicDictionariesPath';\nimport { getBuiltFetchDictionariesPath } from '../../getBuiltFetchDictionariesPath';\nimport { getBuiltRemoteDictionariesPath } from '../../getBuiltRemoteDictionariesPath';\nimport { getBuiltUnmergedDictionariesPath } from '../../getBuiltUnmergedDictionariesPath';\nimport { parallelize } from '../../utils/parallelize';\nimport { writeFileIfChanged } from '../../writeFileIfChanged';\nimport { generateDictionaryListContent } from './generateDictionaryListContent';\n\nconst filterDictionaries = (paths: string[], keys?: string[]) => {\n if (!keys) return paths;\n return paths.filter((path) =>\n keys.some((key) => path.endsWith(`${key}.json`))\n );\n};\n\nconst writeDictionaryFiles = async (\n paths: string[],\n fileName: string,\n format: 'cjs' | 'esm',\n configuration = getConfiguration()\n) => {\n const content = generateDictionaryListContent(paths, format, configuration);\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const { mainDir } = configuration.content;\n\n await writeFileIfChanged(\n resolve(mainDir, `${fileName}.${extension}`),\n content\n );\n};\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const createDictionaryEntryPoint = async (\n configuration = getConfiguration(),\n dictionariesKeys?: string[],\n formats: ('cjs' | 'esm')[] = ['cjs', 'esm']\n) => {\n const { mainDir } = configuration.content;\n\n await mkdir(mainDir, { recursive: true });\n\n const remoteDictionariesPath = getBuiltRemoteDictionariesPath(configuration);\n const dictionariesPath = filterDictionaries(\n getBuiltDictionariesPath(configuration),\n dictionariesKeys\n );\n const unmergedDictionariesPath =\n getBuiltUnmergedDictionariesPath(configuration);\n\n const writeOperations = [\n ...formats.map((format) => ({\n paths: remoteDictionariesPath,\n fileName: 'remote_dictionaries' as const,\n format,\n })),\n ...formats.map((format) => ({\n paths: dictionariesPath,\n fileName: 'dictionaries' as const,\n format,\n })),\n ...formats.map((format) => ({\n paths: unmergedDictionariesPath,\n fileName: 'unmerged_dictionaries' as const,\n format,\n })),\n ...formats.map((format) => ({\n paths: getBuiltDynamicDictionariesPath(configuration, format),\n fileName: 'dynamic_dictionaries' as const,\n format,\n })),\n ...formats.map((format) => ({\n paths: getBuiltFetchDictionariesPath(configuration, format),\n fileName: 'fetch_dictionaries' as const,\n format,\n })),\n ];\n\n await parallelize(writeOperations, async ({ paths, fileName, format }) =>\n writeDictionaryFiles(paths, fileName, format, configuration)\n );\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,gCAAgC;AACzC,SAAS,uCAAuC;AAChD,SAAS,qCAAqC;AAC9C,SAAS,sCAAsC;AAC/C,SAAS,wCAAwC;AACjD,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,qCAAqC;AAE9C,MAAM,qBAAqB,CAAC,OAAiB,SAAoB;AAC/D,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,MAAM;AAAA,IAAO,CAAC,SACnB,KAAK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,UAAU;AAAA,MACV;AAAA,IACF,EAAE;AAAA,EACJ;AAEA,QAAM;AAAA,IAAY;AAAA,IAAiB,OAAO,EAAE,OAAO,UAAU,OAAO,MAClE,qBAAqB,OAAO,UAAU,QAAQ,aAAa;AAAA,EAC7D;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { mkdir } from 'fs/promises';\nimport { resolve } from 'path';\nimport { getBuiltDictionariesPath } from '../../getBuiltDictionariesPath';\nimport { getBuiltDynamicDictionariesPath } from '../../getBuiltDynamicDictionariesPath';\nimport { getBuiltFetchDictionariesPath } from '../../getBuiltFetchDictionariesPath';\nimport { getBuiltRemoteDictionariesPath } from '../../getBuiltRemoteDictionariesPath';\nimport { getBuiltUnmergedDictionariesPath } from '../../getBuiltUnmergedDictionariesPath';\nimport { parallelize } from '../../utils/parallelize';\nimport { writeFileIfChanged } from '../../writeFileIfChanged';\nimport { generateDictionaryListContent } from './generateDictionaryListContent';\n\nconst filterDictionaries = (paths: string[], keys?: string[]) => {\n if (!keys) return paths;\n return paths.filter((path) =>\n keys.some((key) => path.endsWith(`${key}.json`))\n );\n};\n\nconst writeDictionaryFiles = async (\n paths: string[],\n fileName: string,\n functionName: string,\n format: 'cjs' | 'esm',\n configuration = getConfiguration()\n) => {\n const content = generateDictionaryListContent(\n paths,\n functionName,\n format,\n configuration\n );\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const { mainDir } = configuration.content;\n\n await writeFileIfChanged(\n resolve(mainDir, `${fileName}.${extension}`),\n content\n );\n};\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const createDictionaryEntryPoint = async (\n configuration = getConfiguration(),\n dictionariesKeys?: string[],\n formats?: ('cjs' | 'esm')[]\n) => {\n const outputFormats = formats ?? configuration.build.outputFormat;\n const { mainDir } = configuration.content;\n\n await mkdir(mainDir, { recursive: true });\n\n const remoteDictionariesPath = getBuiltRemoteDictionariesPath(configuration);\n const dictionariesPath = filterDictionaries(\n getBuiltDictionariesPath(configuration),\n dictionariesKeys\n );\n const unmergedDictionariesPath =\n getBuiltUnmergedDictionariesPath(configuration);\n\n const writeOperations = [\n ...outputFormats.map((format) => ({\n paths: remoteDictionariesPath,\n functionName: 'getRemoteDictionaries',\n fileName: 'remote_dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: dictionariesPath,\n functionName: 'getDictionaries',\n fileName: 'dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: unmergedDictionariesPath,\n functionName: 'getUnmergedDictionaries',\n fileName: 'unmerged_dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: getBuiltDynamicDictionariesPath(configuration, format),\n functionName: 'getDynamicDictionaries',\n fileName: 'dynamic_dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: getBuiltFetchDictionariesPath(configuration, format),\n functionName: 'getFetchDictionaries',\n fileName: 'fetch_dictionaries' as const,\n format,\n })),\n ];\n\n await parallelize(\n writeOperations,\n async ({ paths, fileName, format, functionName }) =>\n writeDictionaryFiles(paths, fileName, functionName, format, configuration)\n );\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,gCAAgC;AACzC,SAAS,uCAAuC;AAChD,SAAS,qCAAqC;AAC9C,SAAS,sCAAsC;AAC/C,SAAS,wCAAwC;AACjD,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,qCAAqC;AAE9C,MAAM,qBAAqB,CAAC,OAAiB,SAAoB;AAC/D,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,MAAM;AAAA,IAAO,CAAC,SACnB,KAAK,KAAK,CAAC,QAAQ,KAAK,SAAS,GAAG,GAAG,OAAO,CAAC;AAAA,EACjD;AACF;AAEA,MAAM,uBAAuB,OAC3B,OACA,UACA,cACA,QACA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;AAAA,MACV;AAAA,IACF,EAAE;AAAA,EACJ;AAEA,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,OAAO,UAAU,QAAQ,aAAa,MAC7C,qBAAqB,OAAO,UAAU,cAAc,QAAQ,aAAa;AAAA,EAC7E;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import { getConfiguration, normalizePath } from "@intlayer/config";
2
2
  import { basename, extname, relative } from "path";
3
3
  import { getFileHash } from "../../utils/getFileHash.mjs";
4
- const generateDictionaryListContent = (dictionaries, format = "esm", configuration = getConfiguration()) => {
4
+ const generateDictionaryListContent = (dictionaries, functionName, format = "esm", configuration = getConfiguration()) => {
5
5
  const { mainDir } = configuration.content;
6
6
  let content = "";
7
7
  const dictionariesRef = dictionaries.map((dictionaryPath) => ({
@@ -21,16 +21,28 @@ const generateDictionaryListContent = (dictionaries, format = "esm", configurati
21
21
  });
22
22
  content += "\n";
23
23
  const formattedDictionaryMap = dictionariesRef.map((dictionary) => ` "${dictionary.id}": ${dictionary.hash}`).join(",\n");
24
- if (format === "esm")
25
- content += `export default {
24
+ content += `const dictionaries = {
26
25
  ${formattedDictionaryMap}
27
26
  };
28
27
  `;
29
- if (format === "cjs")
30
- content += `module.exports = {
31
- ${formattedDictionaryMap}
32
- };
28
+ content += `const ${functionName} = () => dictionaries;
29
+ `;
30
+ if (format === "esm") {
31
+ content += `
32
+ `;
33
+ content += `export { ${functionName} };
34
+ `;
35
+ content += `export default dictionaries;
36
+ `;
37
+ }
38
+ if (format === "cjs") {
39
+ content += `
40
+ `;
41
+ content += `module.exports.${functionName} = ${functionName};
42
+ `;
43
+ content += `module.exports = dictionaries;
33
44
  `;
45
+ }
34
46
  return content;
35
47
  };
36
48
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/transpiler/dictionary_to_main/generateDictionaryListContent.ts"],"sourcesContent":["import { getConfiguration, normalizePath } from '@intlayer/config';\nimport { basename, extname, relative } from 'path';\nimport { getFileHash } from '../../utils/getFileHash';\n\n/**\n * This function generates the content of the dictionary list file\n */\nexport const generateDictionaryListContent = (\n dictionaries: string[],\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { mainDir } = configuration.content;\n\n let content = '';\n\n const dictionariesRef = dictionaries.map((dictionaryPath) => ({\n relativePath: normalizePath(relative(mainDir, dictionaryPath)),\n id: basename(dictionaryPath, extname(dictionaryPath)), // Get the base name as the dictionary id\n hash: `_${getFileHash(dictionaryPath)}`, // Get the hash of the dictionary to avoid conflicts\n }));\n\n // Import all dictionaries\n dictionariesRef.forEach((dictionary) => {\n if (format === 'esm')\n content += `import ${dictionary.hash} from '${dictionary.relativePath}' with { type: 'json' };\\n`;\n if (format === 'cjs')\n content += `const ${dictionary.hash} = require('${dictionary.relativePath}');\\n`;\n });\n\n content += '\\n';\n\n // Format Dictionary Map\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": ${dictionary.hash}`)\n .join(',\\n');\n\n if (format === 'esm')\n content += `export default {\\n${formattedDictionaryMap}\\n};\\n`;\n if (format === 'cjs')\n content += `module.exports = {\\n${formattedDictionaryMap}\\n};\\n`;\n\n return content;\n};\n"],"mappings":"AAAA,SAAS,kBAAkB,qBAAqB;AAChD,SAAS,UAAU,SAAS,gBAAgB;AAC5C,SAAS,mBAAmB;AAKrB,MAAM,gCAAgC,CAC3C,cACA,SAAwB,OACxB,gBAAgB,iBAAiB,MACtB;AACX,QAAM,EAAE,QAAQ,IAAI,cAAc;AAElC,MAAI,UAAU;AAEd,QAAM,kBAAkB,aAAa,IAAI,CAAC,oBAAoB;AAAA,IAC5D,cAAc,cAAc,SAAS,SAAS,cAAc,CAAC;AAAA,IAC7D,IAAI,SAAS,gBAAgB,QAAQ,cAAc,CAAC;AAAA;AAAA,IACpD,MAAM,IAAI,YAAY,cAAc,CAAC;AAAA;AAAA,EACvC,EAAE;AAGF,kBAAgB,QAAQ,CAAC,eAAe;AACtC,QAAI,WAAW;AACb,iBAAW,UAAU,WAAW,IAAI,UAAU,WAAW,YAAY;AAAA;AACvE,QAAI,WAAW;AACb,iBAAW,SAAS,WAAW,IAAI,eAAe,WAAW,YAAY;AAAA;AAAA,EAC7E,CAAC;AAED,aAAW;AAGX,QAAM,yBAAiC,gBACpC,IAAI,CAAC,eAAe,MAAM,WAAW,EAAE,MAAM,WAAW,IAAI,EAAE,EAC9D,KAAK,KAAK;AAEb,MAAI,WAAW;AACb,eAAW;AAAA,EAAqB,sBAAsB;AAAA;AAAA;AACxD,MAAI,WAAW;AACb,eAAW;AAAA,EAAuB,sBAAsB;AAAA;AAAA;AAE1D,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/transpiler/dictionary_to_main/generateDictionaryListContent.ts"],"sourcesContent":["import { getConfiguration, normalizePath } from '@intlayer/config';\nimport { basename, extname, relative } from 'path';\nimport { getFileHash } from '../../utils/getFileHash';\n\n/**\n * This function generates the content of the dictionary list file\n */\nexport const generateDictionaryListContent = (\n dictionaries: string[],\n functionName: string,\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { mainDir } = configuration.content;\n\n let content = '';\n\n const dictionariesRef = dictionaries.map((dictionaryPath) => ({\n relativePath: normalizePath(relative(mainDir, dictionaryPath)),\n id: basename(dictionaryPath, extname(dictionaryPath)), // Get the base name as the dictionary id\n hash: `_${getFileHash(dictionaryPath)}`, // Get the hash of the dictionary to avoid conflicts\n }));\n\n // Import all dictionaries\n dictionariesRef.forEach((dictionary) => {\n if (format === 'esm')\n content += `import ${dictionary.hash} from '${dictionary.relativePath}' with { type: 'json' };\\n`;\n if (format === 'cjs')\n content += `const ${dictionary.hash} = require('${dictionary.relativePath}');\\n`;\n });\n\n content += '\\n';\n\n // Format Dictionary Map\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": ${dictionary.hash}`)\n .join(',\\n');\n\n content += `const dictionaries = {\\n${formattedDictionaryMap}\\n};\\n`;\n content += `const ${functionName} = () => dictionaries;\\n`;\n\n if (format === 'esm') {\n content += `\\n`;\n content += `export { ${functionName} };\\n`;\n content += `export default dictionaries;\\n`;\n }\n\n if (format === 'cjs') {\n content += `\\n`;\n content += `module.exports.${functionName} = ${functionName};\\n`;\n content += `module.exports = dictionaries;\\n`;\n }\n\n return content;\n};\n"],"mappings":"AAAA,SAAS,kBAAkB,qBAAqB;AAChD,SAAS,UAAU,SAAS,gBAAgB;AAC5C,SAAS,mBAAmB;AAKrB,MAAM,gCAAgC,CAC3C,cACA,cACA,SAAwB,OACxB,gBAAgB,iBAAiB,MACtB;AACX,QAAM,EAAE,QAAQ,IAAI,cAAc;AAElC,MAAI,UAAU;AAEd,QAAM,kBAAkB,aAAa,IAAI,CAAC,oBAAoB;AAAA,IAC5D,cAAc,cAAc,SAAS,SAAS,cAAc,CAAC;AAAA,IAC7D,IAAI,SAAS,gBAAgB,QAAQ,cAAc,CAAC;AAAA;AAAA,IACpD,MAAM,IAAI,YAAY,cAAc,CAAC;AAAA;AAAA,EACvC,EAAE;AAGF,kBAAgB,QAAQ,CAAC,eAAe;AACtC,QAAI,WAAW;AACb,iBAAW,UAAU,WAAW,IAAI,UAAU,WAAW,YAAY;AAAA;AACvE,QAAI,WAAW;AACb,iBAAW,SAAS,WAAW,IAAI,eAAe,WAAW,YAAY;AAAA;AAAA,EAC7E,CAAC;AAED,aAAW;AAGX,QAAM,yBAAiC,gBACpC,IAAI,CAAC,eAAe,MAAM,WAAW,EAAE,MAAM,WAAW,IAAI,EAAE,EAC9D,KAAK,KAAK;AAEb,aAAW;AAAA,EAA2B,sBAAsB;AAAA;AAAA;AAC5D,aAAW,SAAS,YAAY;AAAA;AAEhC,MAAI,WAAW,OAAO;AACpB,eAAW;AAAA;AACX,eAAW,YAAY,YAAY;AAAA;AACnC,eAAW;AAAA;AAAA,EACb;AAEA,MAAI,WAAW,OAAO;AACpB,eAAW;AAAA;AACX,eAAW,kBAAkB,YAAY,MAAM,YAAY;AAAA;AAC3D,eAAW;AAAA;AAAA,EACb;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,102 @@
1
+ const extractErrorMessage = (error) => {
2
+ const trimToSingleLine = (text) => text.split(/\r?\n/).map((s) => s.trim()).filter(Boolean)[0] ?? text.trim();
3
+ const looksLikeJson = (value) => {
4
+ const s = value.trim();
5
+ if (!s) return false;
6
+ const first = s[0];
7
+ return first === "{" || first === "[" || first === '"';
8
+ };
9
+ const sanitizeUnexpectedTokenMessage = (text) => {
10
+ const t = text.trim();
11
+ if (/Unexpected token/i.test(t) && /not valid JSON/i.test(t)) {
12
+ const quoted = t.match(/"([^"]+)"/);
13
+ if (quoted && quoted[1]) return quoted[1];
14
+ const afterColon = t.split(":").slice(1).join(":").trim();
15
+ if (afterColon) return afterColon;
16
+ }
17
+ return t;
18
+ };
19
+ const pickFieldsFromObject = (value, seen) => {
20
+ if (!value || typeof value !== "object") return void 0;
21
+ if (seen.has(value)) return void 0;
22
+ seen.add(value);
23
+ const obj = value;
24
+ const stringCandidates = [
25
+ typeof obj.message === "string" ? obj.message : void 0,
26
+ typeof obj.error_description === "string" ? obj.error_description : void 0,
27
+ typeof obj.error === "string" ? obj.error : void 0,
28
+ typeof obj.title === "string" ? obj.title : void 0,
29
+ typeof obj.code === "string" ? obj.code : void 0,
30
+ typeof obj.statusText === "string" ? obj.statusText : void 0
31
+ ];
32
+ for (const candidate of stringCandidates) {
33
+ if (candidate && candidate.trim()) return candidate;
34
+ }
35
+ const response = obj.response;
36
+ if (response && typeof response === "object") {
37
+ const data2 = response.data;
38
+ const fromData2 = pickFieldsFromObject(data2, seen);
39
+ if (fromData2) return fromData2;
40
+ }
41
+ const data = obj.data;
42
+ const fromData = pickFieldsFromObject(data, seen);
43
+ if (fromData) return fromData;
44
+ const cause = obj.cause;
45
+ const fromCause = pickFieldsFromObject(cause, seen) ?? (typeof cause?.message === "string" ? cause.message : void 0);
46
+ if (fromCause) return fromCause;
47
+ const errors = obj.errors;
48
+ if (Array.isArray(errors)) {
49
+ for (const item of errors) {
50
+ const fromItem = pickFieldsFromObject(item, seen);
51
+ if (fromItem) return fromItem;
52
+ if (typeof item?.message === "string")
53
+ return item.message;
54
+ }
55
+ }
56
+ return void 0;
57
+ };
58
+ const tryParseJsonString = (maybeJson) => {
59
+ if (!looksLikeJson(maybeJson)) return void 0;
60
+ try {
61
+ const parsed = JSON.parse(maybeJson);
62
+ const picked = pickFieldsFromObject(parsed, /* @__PURE__ */ new Set());
63
+ if (picked) return picked;
64
+ if (typeof parsed === "string") return parsed;
65
+ return void 0;
66
+ } catch {
67
+ return void 0;
68
+ }
69
+ };
70
+ if (typeof error === "string") {
71
+ const cleaned = sanitizeUnexpectedTokenMessage(error);
72
+ return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);
73
+ }
74
+ if (error && typeof error === "object") {
75
+ if (error instanceof Error) {
76
+ const cleaned = sanitizeUnexpectedTokenMessage(error.message);
77
+ const fromMessage = tryParseJsonString(cleaned);
78
+ if (fromMessage) return trimToSingleLine(fromMessage);
79
+ const fromCause = extractErrorMessage(error.cause);
80
+ if (fromCause && fromCause !== "An unknown error occurred")
81
+ return trimToSingleLine(fromCause);
82
+ return trimToSingleLine(cleaned);
83
+ }
84
+ const seen = /* @__PURE__ */ new Set();
85
+ const fromObject = pickFieldsFromObject(error, seen);
86
+ if (fromObject) {
87
+ const cleaned = sanitizeUnexpectedTokenMessage(fromObject);
88
+ return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);
89
+ }
90
+ try {
91
+ const serialized = JSON.stringify(error);
92
+ return trimToSingleLine(serialized);
93
+ } catch {
94
+ return trimToSingleLine(String(error));
95
+ }
96
+ }
97
+ return "An unknown error occurred";
98
+ };
99
+ export {
100
+ extractErrorMessage
101
+ };
102
+ //# sourceMappingURL=extractErrorMessage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/extractErrorMessage.ts"],"sourcesContent":["export const extractErrorMessage = (error: unknown): string => {\n const trimToSingleLine = (text: string): string =>\n text\n .split(/\\r?\\n/)\n .map((s) => s.trim())\n .filter(Boolean)[0] ?? text.trim();\n\n const looksLikeJson = (value: string): boolean => {\n const s = value.trim();\n if (!s) return false;\n const first = s[0];\n return first === '{' || first === '[' || first === '\"';\n };\n\n const sanitizeUnexpectedTokenMessage = (text: string): string => {\n // If the text mentions an invalid JSON parse, try to extract the meaningful part\n const t = text.trim();\n if (/Unexpected token/i.test(t) && /not valid JSON/i.test(t)) {\n const quoted = t.match(/\"([^\"]+)\"/);\n if (quoted && quoted[1]) return quoted[1];\n // Fallback: drop the leading parser error description\n const afterColon = t.split(':').slice(1).join(':').trim();\n if (afterColon) return afterColon;\n }\n return t;\n };\n\n const pickFieldsFromObject = (\n value: unknown,\n seen: Set<unknown>\n ): string | undefined => {\n if (!value || typeof value !== 'object') return undefined;\n if (seen.has(value)) return undefined;\n seen.add(value);\n\n const obj = value as Record<string, unknown>;\n\n const stringCandidates: Array<string | undefined> = [\n typeof obj.message === 'string' ? obj.message : undefined,\n typeof obj.error_description === 'string'\n ? obj.error_description\n : undefined,\n typeof obj.error === 'string' ? obj.error : undefined,\n typeof obj.title === 'string' ? obj.title : undefined,\n typeof obj.code === 'string' ? obj.code : undefined,\n typeof obj.statusText === 'string' ? obj.statusText : undefined,\n ];\n\n for (const candidate of stringCandidates) {\n if (candidate && candidate.trim()) return candidate;\n }\n\n // Common nested structures (Axios/Fetch-like)\n const response = obj.response as Record<string, unknown> | undefined;\n if (response && typeof response === 'object') {\n const data = response.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n }\n\n const data = obj.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n\n // Nested cause chain\n const cause = (obj as { cause?: unknown }).cause;\n const fromCause =\n pickFieldsFromObject(cause, seen) ??\n (typeof (cause as any)?.message === 'string'\n ? (cause as any).message\n : undefined);\n if (fromCause) return fromCause;\n\n // Arrays of errors\n const errors = obj.errors as unknown;\n if (Array.isArray(errors)) {\n for (const item of errors) {\n const fromItem = pickFieldsFromObject(item, seen);\n if (fromItem) return fromItem;\n if (typeof (item as any)?.message === 'string')\n return (item as any).message;\n }\n }\n\n return undefined;\n };\n\n const tryParseJsonString = (maybeJson: string): string | undefined => {\n if (!looksLikeJson(maybeJson)) return undefined;\n try {\n const parsed = JSON.parse(maybeJson);\n const picked = pickFieldsFromObject(parsed, new Set());\n if (picked) return picked;\n if (typeof parsed === 'string') return parsed;\n return undefined;\n } catch {\n return undefined;\n }\n };\n\n if (typeof error === 'string') {\n const cleaned = sanitizeUnexpectedTokenMessage(error);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n if (error && typeof error === 'object') {\n // Native Error instance\n if (error instanceof Error) {\n const cleaned = sanitizeUnexpectedTokenMessage(error.message);\n const fromMessage = tryParseJsonString(cleaned);\n if (fromMessage) return trimToSingleLine(fromMessage);\n // Dive into cause when present\n const fromCause = extractErrorMessage(error.cause as unknown);\n if (fromCause && fromCause !== 'An unknown error occurred')\n return trimToSingleLine(fromCause);\n return trimToSingleLine(cleaned);\n }\n\n // Generic object\n const seen = new Set<unknown>();\n const fromObject = pickFieldsFromObject(error, seen);\n if (fromObject) {\n const cleaned = sanitizeUnexpectedTokenMessage(fromObject);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n try {\n const serialized = JSON.stringify(error);\n return trimToSingleLine(serialized);\n } catch {\n return trimToSingleLine(String(error));\n }\n }\n\n return 'An unknown error occurred';\n};\n"],"mappings":"AAAO,MAAM,sBAAsB,CAAC,UAA2B;AAC7D,QAAM,mBAAmB,CAAC,SACxB,KACG,MAAM,OAAO,EACb,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,OAAO,EAAE,CAAC,KAAK,KAAK,KAAK;AAErC,QAAM,gBAAgB,CAAC,UAA2B;AAChD,UAAM,IAAI,MAAM,KAAK;AACrB,QAAI,CAAC,EAAG,QAAO;AACf,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AAI;AACnD,QAAI,YAAY;AACd,YAAM,UAAU,+BAA+B,UAAU;AACzD,aAAO,mBAAmB,OAAO,KAAK,iBAAiB,OAAO;AAAA,IAChE;AAEA,QAAI;AACF,YAAM,aAAa,KAAK,UAAU,KAAK;AACvC,aAAO,iBAAiB,UAAU;AAAA,IACpC,QAAQ;AACN,aAAO,iBAAiB,OAAO,KAAK,CAAC;AAAA,IACvC;AAAA,EACF;AAEA,SAAO;AACT;","names":["data","fromData"]}
@@ -0,0 +1,13 @@
1
+ import { getConfiguration } from "@intlayer/config";
2
+ const getExtension = (configuration = getConfiguration(), format) => {
3
+ const outputFormats = configuration.build.outputFormat;
4
+ if (format === "esm") return "mjs";
5
+ if (format === "cjs") return "cjs";
6
+ if (outputFormats.includes("esm")) return "mjs";
7
+ if (outputFormats.includes("cjs")) return "cjs";
8
+ return "mjs";
9
+ };
10
+ export {
11
+ getExtension
12
+ };
13
+ //# sourceMappingURL=getExtention.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/getExtention.ts"],"sourcesContent":["import { type IntlayerConfig, getConfiguration } from '@intlayer/config';\n\nexport const getExtension = (\n configuration: IntlayerConfig = getConfiguration(),\n format?: 'esm' | 'cjs' | undefined\n) => {\n const outputFormats = configuration.build.outputFormat;\n\n if (format === 'esm') return 'mjs';\n if (format === 'cjs') return 'cjs';\n\n if (outputFormats.includes('esm')) return 'mjs';\n if (outputFormats.includes('cjs')) return 'cjs';\n\n return 'mjs';\n};\n"],"mappings":"AAAA,SAA8B,wBAAwB;AAE/C,MAAM,eAAe,CAC1B,gBAAgC,iBAAiB,GACjD,WACG;AACH,QAAM,gBAAgB,cAAc,MAAM;AAE1C,MAAI,WAAW,MAAO,QAAO;AAC7B,MAAI,WAAW,MAAO,QAAO;AAE7B,MAAI,cAAc,SAAS,KAAK,EAAG,QAAO;AAC1C,MAAI,cAAc,SAAS,KAAK,EAAG,QAAO;AAE1C,SAAO;AACT;","names":[]}
@@ -63,16 +63,16 @@ const writeFileWithDirectories = async (filePath, data) => {
63
63
  try {
64
64
  const dir = dirname(filePath);
65
65
  await mkdir(dir, { recursive: true });
66
- const extention = extname(filePath);
66
+ const extension = extname(filePath);
67
67
  const acceptedExtensions = configuration.content.fileExtensions.map(
68
- (extention2) => extname(extention2)
68
+ (extension2) => extname(extension2)
69
69
  );
70
- if (!acceptedExtensions.includes(extention)) {
70
+ if (!acceptedExtensions.includes(extension)) {
71
71
  throw new Error(
72
- `Invalid file extension: ${extention}, file: ${filePath}`
72
+ `Invalid file extension: ${extension}, file: ${filePath}`
73
73
  );
74
74
  }
75
- if (extention === ".json") {
75
+ if (extension === ".json") {
76
76
  const jsonDictionary = JSON.stringify(data, null, 2);
77
77
  await writeFile(filePath, jsonDictionary);
78
78
  } else {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizePath, x, type IntlayerConfig } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { dirname, extname } from 'path';\nimport { prepareContentDeclaration } from '../prepareContentDeclaration';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { writeJSFile } from './writeJSFile';\n\nconst DEFAULT_NEW_DICTIONARY_PATH = 'intlayer-dictionaries';\n\nconst formatContentDeclaration = async (dictionary: Dictionary) => {\n // Clean Markdown, Insertion, File, etc. node metadata\n const preparedContentDeclaration =\n await prepareContentDeclaration(dictionary);\n\n // Remove the filePath from the dictionary and set $schema\n const { filePath, $schema, ...dictionaryWithoutPath } =\n preparedContentDeclaration;\n\n const formattedContentDeclaration = {\n $schema: 'https://intlayer.org/schema.json',\n ...dictionaryWithoutPath,\n };\n\n return formattedContentDeclaration;\n};\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 unmergedDictionariesRecord = getUnmergedDictionaries(config);\n const existingDictionary = (\n unmergedDictionariesRecord[dictionary.key] as Dictionary[]\n ).filter((el) => el.filePath === dictionary.filePath);\n\n const filePath = dictionary.filePath;\n const formattedContentDeclaration =\n await formatContentDeclaration(dictionary);\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 await writeFileWithDirectories(filePath, formattedContentDeclaration);\n\n return { status: 'updated', path: filePath };\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: 'new content file',\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 // Create the directory recursively\n await mkdir(dir, { recursive: true });\n\n const extention = extname(filePath);\n const acceptedExtensions = configuration.content.fileExtensions.map(\n (extention) => extname(extention)\n );\n\n if (!acceptedExtensions.includes(extention)) {\n throw new Error(\n `Invalid file extension: ${extention}, file: ${filePath}`\n );\n }\n\n if (extention === '.json') {\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await writeFile(filePath, jsonDictionary);\n } else {\n await writeJSFile(filePath, data as unknown as Dictionary);\n }\n } catch (error) {\n console.error(data);\n\n throw new Error(\n `${x} Error writing file to ${colorizePath(filePath)}: ${error}`\n );\n }\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAC1B,SAAS,cAAc,SAA8B;AAErD,SAAS,+BAA+B;AACxC,OAAO,eAAe;AACtB,SAAS,OAAO,iBAAiB;AACjC,SAAS,SAAS,eAAe;AACjC,SAAS,iCAAiC;AAE1C,SAAS,mBAAmB;AAE5B,MAAM,8BAA8B;AAEpC,MAAM,2BAA2B,OAAO,eAA2B;AAEjE,QAAM,6BACJ,MAAM,0BAA0B,UAAU;AAG5C,QAAM,EAAE,UAAU,SAAS,GAAG,sBAAsB,IAClD;AAEF,QAAM,8BAA8B;AAAA,IAClC,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,SAAO;AACT;AAEO,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,6BAA6B,wBAAwB,MAAM;AACjE,QAAM,qBACJ,2BAA2B,WAAW,GAAG,EACzC,OAAO,CAAC,OAAO,GAAG,aAAa,WAAW,QAAQ;AAEpD,QAAM,WAAW,WAAW;AAC5B,QAAM,8BACJ,MAAM,yBAAyB,UAAU;AAE3C,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,yBAAyB,UAAU,2BAA2B;AAEpE,eAAO,EAAE,QAAQ,WAAW,MAAM,SAAS;AAAA,MAC7C,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,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AAEpC,UAAM,YAAY,QAAQ,QAAQ;AAClC,UAAM,qBAAqB,cAAc,QAAQ,eAAe;AAAA,MAC9D,CAACA,eAAc,QAAQA,UAAS;AAAA,IAClC;AAEA,QAAI,CAAC,mBAAmB,SAAS,SAAS,GAAG;AAC3C,YAAM,IAAI;AAAA,QACR,2BAA2B,SAAS,WAAW,QAAQ;AAAA,MACzD;AAAA,IACF;AAEA,QAAI,cAAc,SAAS;AACzB,YAAM,iBAAiB,KAAK,UAAU,MAAM,MAAM,CAAC;AAGnD,YAAM,UAAU,UAAU,cAAc;AAAA,IAC1C,OAAO;AACL,YAAM,YAAY,UAAU,IAA6B;AAAA,IAC3D;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,IAAI;AAElB,UAAM,IAAI;AAAA,MACR,GAAG,CAAC,0BAA0B,aAAa,QAAQ,CAAC,KAAK,KAAK;AAAA,IAChE;AAAA,EACF;AACF;","names":["extention"]}
1
+ {"version":3,"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizePath, x, type IntlayerConfig } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { dirname, extname } from 'path';\nimport { prepareContentDeclaration } from '../prepareContentDeclaration';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { writeJSFile } from './writeJSFile';\n\nconst DEFAULT_NEW_DICTIONARY_PATH = 'intlayer-dictionaries';\n\nconst formatContentDeclaration = async (dictionary: Dictionary) => {\n // Clean Markdown, Insertion, File, etc. node metadata\n const preparedContentDeclaration =\n await prepareContentDeclaration(dictionary);\n\n // Remove the filePath from the dictionary and set $schema\n const { filePath, $schema, ...dictionaryWithoutPath } =\n preparedContentDeclaration;\n\n const formattedContentDeclaration = {\n $schema: 'https://intlayer.org/schema.json',\n ...dictionaryWithoutPath,\n };\n\n return formattedContentDeclaration;\n};\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 unmergedDictionariesRecord = getUnmergedDictionaries(config);\n const existingDictionary = (\n unmergedDictionariesRecord[dictionary.key] as Dictionary[]\n ).filter((el) => el.filePath === dictionary.filePath);\n\n const filePath = dictionary.filePath;\n const formattedContentDeclaration =\n await formatContentDeclaration(dictionary);\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 await writeFileWithDirectories(filePath, formattedContentDeclaration);\n\n return { status: 'updated', path: filePath };\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: 'new content file',\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 // Create the directory recursively\n await mkdir(dir, { recursive: true });\n\n const extension = extname(filePath);\n const acceptedExtensions = configuration.content.fileExtensions.map(\n (extension) => extname(extension)\n );\n\n if (!acceptedExtensions.includes(extension)) {\n throw new Error(\n `Invalid file extension: ${extension}, file: ${filePath}`\n );\n }\n\n if (extension === '.json') {\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await writeFile(filePath, jsonDictionary);\n } else {\n await writeJSFile(filePath, data as unknown as Dictionary);\n }\n } catch (error) {\n console.error(data);\n\n throw new Error(\n `${x} Error writing file to ${colorizePath(filePath)}: ${error}`\n );\n }\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAC1B,SAAS,cAAc,SAA8B;AAErD,SAAS,+BAA+B;AACxC,OAAO,eAAe;AACtB,SAAS,OAAO,iBAAiB;AACjC,SAAS,SAAS,eAAe;AACjC,SAAS,iCAAiC;AAE1C,SAAS,mBAAmB;AAE5B,MAAM,8BAA8B;AAEpC,MAAM,2BAA2B,OAAO,eAA2B;AAEjE,QAAM,6BACJ,MAAM,0BAA0B,UAAU;AAG5C,QAAM,EAAE,UAAU,SAAS,GAAG,sBAAsB,IAClD;AAEF,QAAM,8BAA8B;AAAA,IAClC,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,SAAO;AACT;AAEO,MAAM,0BAA0B,OACrC,Y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AAEA,QAAI,CAAC,mBAAmB,SAAS,SAAS,GAAG;AAC3C,YAAM,IAAI;AAAA,QACR,2BAA2B,SAAS,WAAW,QAAQ;AAAA,MACzD;AAAA,IACF;AAEA,QAAI,cAAc,SAAS;AACzB,YAAM,iBAAiB,KAAK,UAAU,MAAM,MAAM,CAAC;AAGnD,YAAM,UAAU,UAAU,cAAc;AAAA,IAC1C,OAAO;AACL,YAAM,YAAY,UAAU,IAA6B;AAAA,IAC3D;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,IAAI;AAElB,UAAM,IAAI;AAAA,MACR,GAAG,CAAC,0BAA0B,aAAa,QAAQ,CAAC,KAAK,KAAK;AAAA,IAChE;AAAA,EACF;AACF;","names":["extension"]}
@@ -14,7 +14,9 @@ export { reduceDictionaryContent } from './reduceDictionaryContent/reduceDiction
14
14
  export { createDictionaryEntryPoint, generateDictionaryListContent, } from './transpiler/dictionary_to_main';
15
15
  export { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';
16
16
  export { buildDictionary } from './transpiler/intlayer_dictionary/buildIntlayerDictionary';
17
+ export { extractErrorMessage } from './utils/extractErrorMessage';
17
18
  export { formatLocale, formatPath } from './utils/formatter';
19
+ export { getExtension } from './utils/getExtention';
18
20
  export { getFileHash } from './utils/getFileHash';
19
21
  export { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';
20
22
  export { parallelize } from './utils/parallelize';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sCAAsC,EACtC,kCAAkC,EAClC,KAAK,GACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,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AAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadRemoteDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,eAAO,MAAM,yBAAyB,GACpC,cAAc,aAAa,EAAE,KAC5B,UAAU,EAKR,CAAC;AAEN,eAAO,MAAM,sBAAsB,GACjC,yDAAkC,EAClC,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,IAAI,EACvD,UAAU;IACR,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC,KACA,OAAO,CAAC,aAAa,EAAE,CAsHzB,CAAC"}
1
+ {"version":3,"file":"loadRemoteDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,eAAO,MAAM,yBAAyB,GACpC,cAAc,aAAa,EAAE,KAC5B,UAAU,EAKR,CAAC;AAEN,eAAO,MAAM,sBAAsB,GACjC,yDAAkC,EAClC,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,IAAI,EACvD,UAAU;IACR,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC,KACA,OAAO,CAAC,aAAa,EAAE,CAqHzB,CAAC"}
@@ -19,7 +19,7 @@ export declare class DictionariesLogger {
19
19
  finish(): void;
20
20
  private startSpinner;
21
21
  private stopSpinner;
22
- setRemoteError: (_error?: Error) => void;
22
+ setRemoteError: (error?: Error) => void;
23
23
  private render;
24
24
  private computeProgress;
25
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/log.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAAc;IACvC,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAS;;IAO5B,eAAe,CAAC,MAAM,EAAE,OAAO;IAI/B,gBAAgB;IAOhB,eAAe;IAIf,MAAM,CAAC,WAAW,EAAE,kBAAkB,EAAE;IAyBxC,MAAM;IAON,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,WAAW;IAMZ,cAAc,GAAI,SAAS,KAAK,UAGrC;IAEF,OAAO,CAAC,MAAM;IAuEd,OAAO,CAAC,eAAe;CAyCxB"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/log.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAAc;IACvC,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAqB;;IAOxC,eAAe,CAAC,MAAM,EAAE,OAAO;IAI/B,gBAAgB;IAOhB,eAAe;IAIf,MAAM,CAAC,WAAW,EAAE,kBAAkB,EAAE;IAyBxC,MAAM;IAON,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,WAAW;IAMZ,cAAc,GAAI,QAAQ,KAAK,UAMpC;IAEF,OAAO,CAAC,MAAM;IA0Ed,OAAO,CAAC,eAAe;CAyCxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAIpB,MAAM,kBAAkB,CAAC;AAa1B,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,EAClD,+BAA+B,EAC/B,eAAa,kBAkGd,CAAC"}
1
+ {"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAIpB,MAAM,kBAAkB,CAAC;AAc1B,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,EAClD,+BAA+B,EAC/B,eAAa,kBA4Gd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createDictionaryEntryPoint.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"names":[],"mappings":"AAoCA;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACrC,yDAAkC,EAClC,mBAAmB,MAAM,EAAE,EAC3B,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,kBA6C5C,CAAC"}
1
+ {"version":3,"file":"createDictionaryEntryPoint.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"names":[],"mappings":"AA0CA;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACrC,yDAAkC,EAClC,mBAAmB,MAAM,EAAE,EAC3B,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE,kBAqD5B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * This function generates the content of the dictionary list file
3
3
  */
4
- export declare const generateDictionaryListContent: (dictionaries: string[], format?: "cjs" | "esm", configuration?: import("@intlayer/config").IntlayerConfig) => string;
4
+ export declare const generateDictionaryListContent: (dictionaries: string[], functionName: string, format?: "cjs" | "esm", configuration?: import("@intlayer/config").IntlayerConfig) => string;
5
5
  //# sourceMappingURL=generateDictionaryListContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateDictionaryListContent.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_main/generateDictionaryListContent.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,6BAA6B,GACxC,cAAc,MAAM,EAAE,EACtB,SAAQ,KAAK,GAAG,KAAa,EAC7B,yDAAkC,KACjC,MAgCF,CAAC"}
1
+ {"version":3,"file":"generateDictionaryListContent.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_main/generateDictionaryListContent.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,6BAA6B,GACxC,cAAc,MAAM,EAAE,EACtB,cAAc,MAAM,EACpB,SAAQ,KAAK,GAAG,KAAa,EAC7B,yDAAkC,KACjC,MA0CF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const extractErrorMessage: (error: unknown) => string;
2
+ //# sourceMappingURL=extractErrorMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/utils/extractErrorMessage.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,MAuIpD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type IntlayerConfig } from '@intlayer/config';
2
+ export declare const getExtension: (configuration?: IntlayerConfig, format?: "esm" | "cjs" | undefined) => "cjs" | "mjs";
3
+ //# sourceMappingURL=getExtention.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getExtention.d.ts","sourceRoot":"","sources":["../../../src/utils/getExtention.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,YAAY,GACvB,gBAAe,cAAmC,EAClD,SAAS,KAAK,GAAG,KAAK,GAAG,SAAS,kBAWnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/chokidar",
3
- "version": "6.0.1",
3
+ "version": "6.0.2-canary.0",
4
4
  "private": false,
5
5
  "description": "Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.",
6
6
  "keywords": [
@@ -68,12 +68,12 @@
68
68
  "fast-glob": "^3.3.3",
69
69
  "p-limit": "^3.1.0",
70
70
  "simple-git": "^3.27.0",
71
- "@intlayer/api": "6.0.1",
72
- "@intlayer/config": "6.0.1",
73
- "@intlayer/core": "6.0.1",
74
- "@intlayer/dictionaries-entry": "6.0.1",
75
- "@intlayer/remote-dictionaries-entry": "6.0.1",
76
- "@intlayer/unmerged-dictionaries-entry": "6.0.1"
71
+ "@intlayer/config": "6.0.2-canary.0",
72
+ "@intlayer/core": "6.0.2-canary.0",
73
+ "@intlayer/remote-dictionaries-entry": "6.0.2-canary.0",
74
+ "@intlayer/unmerged-dictionaries-entry": "6.0.2-canary.0",
75
+ "@intlayer/dictionaries-entry": "6.0.2-canary.0",
76
+ "@intlayer/api": "6.0.2-canary.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@changesets/cli": "2.29.5",
@@ -93,19 +93,19 @@
93
93
  "vitest": "^3.2.4",
94
94
  "@utils/eslint-config": "1.0.4",
95
95
  "@utils/ts-config": "1.0.4",
96
- "@utils/ts-config-types": "1.0.4",
97
- "@utils/tsup-config": "1.0.4"
96
+ "@utils/tsup-config": "1.0.4",
97
+ "@utils/ts-config-types": "1.0.4"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "fast-glob": "^3.3.3",
101
101
  "react": ">=16.0.0",
102
- "@intlayer/api": "6.0.1",
103
- "@intlayer/core": "6.0.1",
104
- "@intlayer/config": "6.0.1",
105
- "@intlayer/remote-dictionaries-entry": "6.0.1",
106
- "@intlayer/dictionaries-entry": "6.0.1",
107
- "@intlayer/unmerged-dictionaries-entry": "6.0.1",
108
- "intlayer": "6.0.1"
102
+ "@intlayer/config": "6.0.2-canary.0",
103
+ "@intlayer/core": "6.0.2-canary.0",
104
+ "@intlayer/api": "6.0.2-canary.0",
105
+ "@intlayer/remote-dictionaries-entry": "6.0.2-canary.0",
106
+ "@intlayer/dictionaries-entry": "6.0.2-canary.0",
107
+ "intlayer": "6.0.2-canary.0",
108
+ "@intlayer/unmerged-dictionaries-entry": "6.0.2-canary.0"
109
109
  },
110
110
  "engines": {
111
111
  "node": ">=14.18"