@intlayer/chokidar 6.0.0 → 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.
- package/dist/cjs/index.cjs +6 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/listDictionariesPath.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +4 -15
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/log.cjs +14 -9
- package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +29 -9
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +20 -9
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
- package/dist/cjs/transpiler/dictionary_to_main/generateDictionaryListContent.cjs +19 -7
- package/dist/cjs/transpiler/dictionary_to_main/generateDictionaryListContent.cjs.map +1 -1
- package/dist/cjs/utils/extractErrorMessage.cjs +126 -0
- package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -0
- package/dist/cjs/utils/getExtention.cjs +37 -0
- package/dist/cjs/utils/getExtention.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +8 -7
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/listDictionariesPath.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +3 -4
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/log.mjs +14 -9
- package/dist/esm/loadDictionaries/log.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +19 -9
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +20 -9
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
- package/dist/esm/transpiler/dictionary_to_main/generateDictionaryListContent.mjs +19 -7
- package/dist/esm/transpiler/dictionary_to_main/generateDictionaryListContent.mjs.map +1 -1
- package/dist/esm/utils/extractErrorMessage.mjs +102 -0
- package/dist/esm/utils/extractErrorMessage.mjs.map +1 -0
- package/dist/esm/utils/getExtention.mjs +13 -0
- package/dist/esm/utils/getExtention.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +8 -7
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/listDictionariesPath.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/log.d.ts +1 -1
- package/dist/types/loadDictionaries/log.d.ts.map +1 -1
- package/dist/types/prepareIntlayer.d.ts.map +1 -1
- package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +1 -1
- package/dist/types/transpiler/dictionary_to_main/generateDictionaryListContent.d.ts +1 -1
- package/dist/types/transpiler/dictionary_to_main/generateDictionaryListContent.d.ts.map +1 -1
- package/dist/types/utils/extractErrorMessage.d.ts +2 -0
- package/dist/types/utils/extractErrorMessage.d.ts.map +1 -0
- package/dist/types/utils/getExtention.d.ts +3 -0
- package/dist/types/utils/getExtention.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
- package/package.json +16 -16
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
getAppLogger,
|
|
6
6
|
getConfiguration
|
|
7
7
|
} from "@intlayer/config";
|
|
8
|
+
import packageJson from "@intlayer/config/package.json" with { type: "json" };
|
|
8
9
|
import { cleanOutputDir } from "./cleanOutputDir.mjs";
|
|
9
10
|
import { listDictionaries } from "./listDictionariesPath.mjs";
|
|
10
11
|
import { loadDictionaries } from "./loadDictionaries/loadDictionaries.mjs";
|
|
@@ -19,6 +20,10 @@ import { writeConfiguration } from "./writeConfiguration/index.mjs";
|
|
|
19
20
|
const prepareIntlayer = async (configuration = getConfiguration(), projectRequire = ESMxCJSRequire, clean = false) => {
|
|
20
21
|
const appLogger = getAppLogger(configuration);
|
|
21
22
|
const preparationStartMs = Date.now();
|
|
23
|
+
appLogger([
|
|
24
|
+
"Preparing Intlayer",
|
|
25
|
+
colorize(`(v${packageJson.version})`, ANSIColors.GREY_DARK)
|
|
26
|
+
]);
|
|
22
27
|
if (clean) {
|
|
23
28
|
cleanOutputDir(configuration);
|
|
24
29
|
}
|
|
@@ -29,15 +34,20 @@ const prepareIntlayer = async (configuration = getConfiguration(), projectRequir
|
|
|
29
34
|
projectRequire
|
|
30
35
|
);
|
|
31
36
|
const dictionariesLoadedTime = Date.now();
|
|
32
|
-
appLogger(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
appLogger(
|
|
38
|
+
[
|
|
39
|
+
"Content loaded",
|
|
40
|
+
colorize(
|
|
41
|
+
[
|
|
42
|
+
dictionaries.remoteDictionaries.length > 0 ? ` (Total: ${dictionariesLoadedTime - preparationStartMs}ms - Local: ${dictionaries.time.localDictionaries}ms - Remote: ${dictionaries.time.remoteDictionaries}ms)` : `(${dictionariesLoadedTime - preparationStartMs}ms)`
|
|
43
|
+
].join(""),
|
|
44
|
+
ANSIColors.GREY_DARK
|
|
45
|
+
)
|
|
46
|
+
],
|
|
47
|
+
{
|
|
48
|
+
isVerbose: true
|
|
49
|
+
}
|
|
50
|
+
);
|
|
41
51
|
const dictionariesOutput = await buildDictionary(
|
|
42
52
|
[...dictionaries.localDictionaries, ...dictionaries.remoteDictionaries],
|
|
43
53
|
configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import {\n ANSIColors,\n ESMxCJSRequire,\n type IntlayerConfig,\n colorize,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { createDictionaryEntryPoint } from './transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from './transpiler/dictionary_to_type/index';\nimport { buildDictionary } from './transpiler/intlayer_dictionary/buildIntlayerDictionary';\nimport { writeRemoteDictionary } from './transpiler/intlayer_dictionary/writeRemoteDictionary';\nimport { writeConfiguration } from './writeConfiguration';\n\nexport const prepareIntlayer = async (\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire,\n clean = false\n) => {\n const appLogger = getAppLogger(configuration);\n const preparationStartMs = Date.now();\n\n if (clean) {\n cleanOutputDir(configuration);\n }\n\n const files: string[] = listDictionaries(configuration);\n\n const dictionaries = await loadDictionaries(\n files,\n configuration,\n projectRequire\n );\n\n const dictionariesLoadedTime = Date.now();\n\n appLogger([\n
|
|
1
|
+
{"version":3,"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import {\n ANSIColors,\n ESMxCJSRequire,\n type IntlayerConfig,\n colorize,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport packageJson from '@intlayer/config/package.json' with { type: 'json' };\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { createDictionaryEntryPoint } from './transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from './transpiler/dictionary_to_type/index';\nimport { buildDictionary } from './transpiler/intlayer_dictionary/buildIntlayerDictionary';\nimport { writeRemoteDictionary } from './transpiler/intlayer_dictionary/writeRemoteDictionary';\nimport { writeConfiguration } from './writeConfiguration';\n\nexport const prepareIntlayer = async (\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire,\n clean = false\n) => {\n const appLogger = getAppLogger(configuration);\n const preparationStartMs = Date.now();\n\n appLogger([\n 'Preparing Intlayer',\n colorize(`(v${packageJson.version})`, ANSIColors.GREY_DARK),\n ]);\n\n if (clean) {\n cleanOutputDir(configuration);\n }\n\n const files: string[] = listDictionaries(configuration);\n\n const dictionaries = await loadDictionaries(\n files,\n configuration,\n projectRequire\n );\n\n const dictionariesLoadedTime = Date.now();\n\n appLogger(\n [\n 'Content loaded',\n colorize(\n [\n dictionaries.remoteDictionaries.length > 0\n ? ` (Total: ${dictionariesLoadedTime - preparationStartMs}ms - Local: ${dictionaries.time.localDictionaries}ms - Remote: ${dictionaries.time.remoteDictionaries}ms)`\n : `(${dictionariesLoadedTime - preparationStartMs}ms)`,\n ].join(''),\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n // Build local dictionaries\n const dictionariesOutput = await buildDictionary(\n [...dictionaries.localDictionaries, ...dictionaries.remoteDictionaries],\n configuration\n );\n\n // Write remote dictionaries\n // Used as cache for next fetch\n await writeRemoteDictionary(dictionaries.remoteDictionaries, configuration);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await createDictionaryEntryPoint(configuration);\n\n const dictionariesBuiltTime = Date.now();\n\n appLogger([\n 'Dictionaries built',\n colorize(\n `(${dictionariesBuiltTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ]);\n\n await createModuleAugmentation(configuration);\n\n const moduleAugmentationBuiltTime = Date.now();\n\n appLogger(\n [\n 'Module augmentation built',\n colorize(\n `(${moduleAugmentationBuiltTime - dictionariesBuiltTime}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n await writeConfiguration(configuration);\n\n const configurationWrittenTime = Date.now();\n\n appLogger(\n [\n 'Configuration written',\n colorize(\n `(${configurationWrittenTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n const preparationElapsedMs = Date.now() - preparationStartMs;\n appLogger([`Done`, colorize(`${preparationElapsedMs}ms`, ANSIColors.GREEN)], {\n level: 'info',\n isVerbose: true,\n });\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,iBAAiB,gCAAgC,KAAK,EAAE,MAAM,OAAO;AAC5E,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AAE5B,MAAM,kBAAkB,OAC7B,gBAAgC,iBAAiB,GACjD,iBAAiB,gBACjB,QAAQ,UACL;AACH,QAAM,YAAY,aAAa,aAAa;AAC5C,QAAM,qBAAqB,KAAK,IAAI;AAEpC,YAAU;AAAA,IACR;AAAA,IACA,SAAS,KAAK,YAAY,OAAO,KAAK,WAAW,SAAS;AAAA,EAC5D,CAAC;AAED,MAAI,OAAO;AACT,mBAAe,aAAa;AAAA,EAC9B;AAEA,QAAM,QAAkB,iBAAiB,aAAa;AAEtD,QAAM,eAAe,MAAM;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,yBAAyB,KAAK,IAAI;AAExC;AAA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uB,KAAK,IAAI,IAAI;AAC1C,YAAU,CAAC,QAAQ,SAAS,GAAG,oBAAoB,MAAM,WAAW,KAAK,CAAC,GAAG;AAAA,IAC3E,OAAO;AAAA,IACP,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -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(
|
|
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
|
|
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
|
-
...
|
|
43
|
+
...outputFormats.map((format) => ({
|
|
38
44
|
paths: remoteDictionariesPath,
|
|
45
|
+
functionName: "getRemoteDictionaries",
|
|
39
46
|
fileName: "remote_dictionaries",
|
|
40
47
|
format
|
|
41
48
|
})),
|
|
42
|
-
...
|
|
49
|
+
...outputFormats.map((format) => ({
|
|
43
50
|
paths: dictionariesPath,
|
|
51
|
+
functionName: "getDictionaries",
|
|
44
52
|
fileName: "dictionaries",
|
|
45
53
|
format
|
|
46
54
|
})),
|
|
47
|
-
...
|
|
55
|
+
...outputFormats.map((format) => ({
|
|
48
56
|
paths: unmergedDictionariesPath,
|
|
57
|
+
functionName: "getUnmergedDictionaries",
|
|
49
58
|
fileName: "unmerged_dictionaries",
|
|
50
59
|
format
|
|
51
60
|
})),
|
|
52
|
-
...
|
|
61
|
+
...outputFormats.map((format) => ({
|
|
53
62
|
paths: getBuiltDynamicDictionariesPath(configuration, format),
|
|
63
|
+
functionName: "getDynamicDictionaries",
|
|
54
64
|
fileName: "dynamic_dictionaries",
|
|
55
65
|
format
|
|
56
66
|
})),
|
|
57
|
-
...
|
|
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
|
|
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;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AAG,cAAc,IAAI,CAAC,YAAY;AAAA,MAChC,OAAO;AAAA,MACP,cAAc;AAAA,MACd,UAAU;AAAA,MACV;AAAA,IACF,EAAE;AAAA,IACF,GAAG,cAAc,IAAI,CAAC,YAAY;AAAA,MAChC,OAAO,gCAAgC,eAAe,MAAM;AAAA,MAC5D,cAAc;AAAA,MACd,UAAU;AAAA,MACV;AAAA,IACF,EAAE;AAAA,IACF,GAAG,cAAc,IAAI,CAAC,YAAY;AAAA,MAChC,OAAO,8BAA8B,eAAe,MAAM;AAAA,MAC1D,cAAc;AAAA,MACd,UAAU;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
|
-
|
|
25
|
-
content += `export default {
|
|
24
|
+
content += `const dictionaries = {
|
|
26
25
|
${formattedDictionaryMap}
|
|
27
26
|
};
|
|
28
27
|
`;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
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,UAAM,QAAQ,EAAE,CAAC;AACjB,WAAO,UAAU,OAAO,UAAU,OAAO,UAAU;AAAA,EACrD;AAEA,QAAM,iCAAiC,CAAC,SAAyB;AAE/D,UAAM,IAAI,KAAK,KAAK;AACpB,QAAI,oBAAoB,KAAK,CAAC,KAAK,kBAAkB,KAAK,CAAC,GAAG;AAC5D,YAAM,SAAS,EAAE,MAAM,WAAW;AAClC,UAAI,UAAU,OAAO,CAAC,EAAG,QAAO,OAAO,CAAC;AAExC,YAAM,aAAa,EAAE,MAAM,GAAG,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,EAAE,KAAK;AACxD,UAAI,WAAY,QAAO;AAAA,IACzB;AACA,WAAO;AAAA,EACT;AAEA,QAAM,uBAAuB,CAC3B,OACA,SACuB;AACvB,QAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;AAChD,QAAI,KAAK,IAAI,KAAK,EAAG,QAAO;AAC5B,SAAK,IAAI,KAAK;AAEd,UAAM,MAAM;AAEZ,UAAM,mBAA8C;AAAA,MAClD,OAAO,IAAI,YAAY,WAAW,IAAI,UAAU;AAAA,MAChD,OAAO,IAAI,sBAAsB,WAC7B,IAAI,oBACJ;AAAA,MACJ,OAAO,IAAI,UAAU,WAAW,IAAI,QAAQ;AAAA,MAC5C,OAAO,IAAI,UAAU,WAAW,IAAI,QAAQ;AAA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AO;AAAA,EAChE;AAEA,MAAI,SAAS,OAAO,UAAU,UAAU;AAEtC,QAAI,iBAAiB,OAAO;AAC1B,YAAM,UAAU,+BAA+B,MAAM,OAAO;AAC5D,YAAM,cAAc,mBAAmB,OAAO;AAC9C,UAAI,YAAa,QAAO,iBAAiB,WAAW;AAEpD,YAAM,YAAY,oBAAoB,MAAM,KAAgB;AAC5D,UAAI,aAAa,cAAc;AAC7B,eAAO,iBAAiB,SAAS;AACnC,aAAO,iBAAiB,OAAO;AAAA,IACjC;AAGA,UAAM,OAAO,oBAAI,IAAa;AAC9B,UAAM,aAAa,qBAAqB,OAAO,IAAI;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":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import configuration from "@intlayer/config/built";
|
|
2
2
|
import { colorizePath, x } from "@intlayer/config/client";
|
|
3
|
-
import
|
|
3
|
+
import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
|
|
4
4
|
import deepEqual from "deep-equal";
|
|
5
5
|
import { mkdir, writeFile } from "fs/promises";
|
|
6
6
|
import { dirname, extname } from "path";
|
|
@@ -21,7 +21,8 @@ const writeContentDeclaration = async (dictionary, config = configuration, newDi
|
|
|
21
21
|
const { baseDir } = content;
|
|
22
22
|
const newDictionaryRelativeLocationPath = newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;
|
|
23
23
|
const newDictionaryLocationPath = `${baseDir}/${newDictionaryRelativeLocationPath}`;
|
|
24
|
-
const
|
|
24
|
+
const unmergedDictionariesRecord = getUnmergedDictionaries(config);
|
|
25
|
+
const existingDictionary = unmergedDictionariesRecord[dictionary.key].filter((el) => el.filePath === dictionary.filePath);
|
|
25
26
|
const filePath = dictionary.filePath;
|
|
26
27
|
const formattedContentDeclaration = await formatContentDeclaration(dictionary);
|
|
27
28
|
if (existingDictionary) {
|
|
@@ -62,16 +63,16 @@ const writeFileWithDirectories = async (filePath, data) => {
|
|
|
62
63
|
try {
|
|
63
64
|
const dir = dirname(filePath);
|
|
64
65
|
await mkdir(dir, { recursive: true });
|
|
65
|
-
const
|
|
66
|
+
const extension = extname(filePath);
|
|
66
67
|
const acceptedExtensions = configuration.content.fileExtensions.map(
|
|
67
|
-
(
|
|
68
|
+
(extension2) => extname(extension2)
|
|
68
69
|
);
|
|
69
|
-
if (!acceptedExtensions.includes(
|
|
70
|
+
if (!acceptedExtensions.includes(extension)) {
|
|
70
71
|
throw new Error(
|
|
71
|
-
`Invalid file extension: ${
|
|
72
|
+
`Invalid file extension: ${extension}, file: ${filePath}`
|
|
72
73
|
);
|
|
73
74
|
}
|
|
74
|
-
if (
|
|
75
|
+
if (extension === ".json") {
|
|
75
76
|
const jsonDictionary = JSON.stringify(data, null, 2);
|
|
76
77
|
await writeFile(filePath, jsonDictionary);
|
|
77
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
|
|
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,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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Q,MAAM,IAAI;AAElB,UAAM,IAAI;AAAA,MACR,GAAG,CAAC,0BAA0B,aAAa,QAAQ,CAAC,KAAK,KAAK;AAAA,IAChE;AAAA,EACF;AACF;","names":["extension"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,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AAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC"}
|
|
@@ -1 +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,
|
|
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,KACjD,MAAM,EAqBR,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,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/log.ts"],"names":[],"mappings":"
|
|
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;
|
|
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":"
|
|
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,
|
|
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 @@
|
|
|
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 @@
|
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAsB3D,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,
|
|
1
|
+
{"version":3,"file":"writeContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAsB3D,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,CA2DpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/chokidar",
|
|
3
|
-
"version": "6.0.0",
|
|
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/
|
|
72
|
-
"@intlayer/
|
|
73
|
-
"@intlayer/
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"@intlayer/
|
|
76
|
-
"@intlayer/
|
|
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",
|
|
@@ -91,21 +91,21 @@
|
|
|
91
91
|
"tsup": "^8.5.0",
|
|
92
92
|
"typescript": "^5.9.2",
|
|
93
93
|
"vitest": "^3.2.4",
|
|
94
|
-
"@utils/ts-config-types": "1.0.4",
|
|
95
94
|
"@utils/eslint-config": "1.0.4",
|
|
95
|
+
"@utils/ts-config": "1.0.4",
|
|
96
96
|
"@utils/tsup-config": "1.0.4",
|
|
97
|
-
"@utils/ts-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/
|
|
103
|
-
"@intlayer/
|
|
104
|
-
"@intlayer/
|
|
105
|
-
"@intlayer/remote-dictionaries-entry": "6.0.0",
|
|
106
|
-
"@intlayer/
|
|
107
|
-
"
|
|
108
|
-
"intlayer": "6.0.0"
|
|
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"
|