@intlayer/chokidar 5.5.10 → 5.6.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/README.md +1 -1
- package/dist/cjs/cleanOutputDir.cjs +4 -0
- package/dist/cjs/cleanOutputDir.cjs.map +1 -1
- package/dist/cjs/fetchDistantDictionaries.cjs +5 -1
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/fetchDistantDictionaryKeys.cjs +5 -1
- package/dist/cjs/fetchDistantDictionaryKeys.cjs.map +1 -1
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/listGitFiles.cjs +69 -2
- package/dist/cjs/listGitFiles.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +4 -2
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.cjs +4 -31
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.cjs.map +1 -1
- package/dist/cjs/utils/resolveObjectPromises.cjs +51 -0
- package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -0
- package/dist/cjs/utils/resolveObjectPromises.test.cjs +107 -0
- package/dist/cjs/utils/resolveObjectPromises.test.cjs.map +1 -0
- package/dist/esm/cleanOutputDir.mjs +4 -0
- package/dist/esm/cleanOutputDir.mjs.map +1 -1
- package/dist/esm/fetchDistantDictionaries.mjs +5 -1
- package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/fetchDistantDictionaryKeys.mjs +5 -1
- package/dist/esm/fetchDistantDictionaryKeys.mjs.map +1 -1
- package/dist/esm/index.mjs +3 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/listGitFiles.mjs +67 -1
- package/dist/esm/listGitFiles.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +4 -2
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.mjs +3 -29
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.mjs.map +1 -1
- package/dist/esm/utils/resolveObjectPromises.mjs +27 -0
- package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -0
- package/dist/esm/utils/resolveObjectPromises.test.mjs +106 -0
- package/dist/esm/utils/resolveObjectPromises.test.mjs.map +1 -0
- package/dist/types/cleanOutputDir.d.ts.map +1 -1
- package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/fetchDistantDictionaryKeys.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/listGitFiles.d.ts +6 -0
- package/dist/types/listGitFiles.d.ts.map +1 -1
- package/dist/types/prepareIntlayer.d.ts +1 -1
- package/dist/types/prepareIntlayer.d.ts.map +1 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.d.ts +0 -5
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.d.ts.map +1 -1
- package/dist/types/utils/resolveObjectPromises.d.ts +6 -0
- package/dist/types/utils/resolveObjectPromises.d.ts.map +1 -0
- package/dist/types/utils/resolveObjectPromises.test.d.ts +2 -0
- package/dist/types/utils/resolveObjectPromises.test.d.ts.map +1 -0
- package/package.json +17 -15
|
@@ -11,7 +11,11 @@ const fetchDistantDictionaryKeys = async (configuration = getConfiguration()) =>
|
|
|
11
11
|
const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();
|
|
12
12
|
const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
|
|
13
13
|
const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesKeys({
|
|
14
|
-
|
|
14
|
+
...oAuth2AccessToken && {
|
|
15
|
+
headers: {
|
|
16
|
+
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
17
|
+
}
|
|
18
|
+
}
|
|
15
19
|
});
|
|
16
20
|
if (!getDictionariesKeysResult.data) {
|
|
17
21
|
throw new Error("No distant dictionaries found");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fetchDistantDictionaryKeys.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeys = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<string[]> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, configuration);\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesKeys({\n headers: {
|
|
1
|
+
{"version":3,"sources":["../../src/fetchDistantDictionaryKeys.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeys = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<string[]> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, configuration);\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesKeys({\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n });\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesKeys: string[] = getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesKeys;\n};\n"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B,SAAS,wBAA6C;AAE/C,MAAM,6BAA6B,OACxC,gBAAgC,iBAAiB,MAC3B;AACtB,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,eAAe,QAAW,aAAa;AAE3D,QAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,QAAM,oBAAoB,kBAAkB,MAAM;AAGlD,QAAM,4BACJ,MAAM,YAAY,WAAW,oBAAoB;AAAA,IAC/C,GAAI,qBAAqB;AAAA,MACvB,SAAS;AAAA,QACP,eAAe,UAAU,iBAAiB;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AAEH,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,0BAAoC,0BAA0B;AAGpE,SAAO;AACT;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -13,7 +13,8 @@ import { getBuiltUnmergedDictionariesPath } from "./getBuiltUnmergedDictionaries
|
|
|
13
13
|
import { getFilteredLocalesContent } from "./getFilteredLocalesContent.mjs";
|
|
14
14
|
import { listDictionaries } from "./listDictionariesPath.mjs";
|
|
15
15
|
import {
|
|
16
|
-
listGitFiles
|
|
16
|
+
listGitFiles,
|
|
17
|
+
listGitLines
|
|
17
18
|
} from "./listGitFiles.mjs";
|
|
18
19
|
import {
|
|
19
20
|
loadDictionaries,
|
|
@@ -53,6 +54,7 @@ export {
|
|
|
53
54
|
handleContentDeclarationFileChange,
|
|
54
55
|
listDictionaries,
|
|
55
56
|
listGitFiles,
|
|
57
|
+
listGitLines,
|
|
56
58
|
loadDictionaries,
|
|
57
59
|
loadDistantDictionaries,
|
|
58
60
|
loadLocalDictionaries,
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { checkDictionaryChanges } from './checkDictionaryChanges';\nexport {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeys } from './fetchDistantDictionaryKeys';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\nexport { getFilteredLocalesContent } from './getFilteredLocalesContent';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n type DiffMode,\n type ListGitFilesOptions,\n} from './listGitFiles';\nexport {\n loadDictionaries,\n loadDistantDictionaries,\n loadLocalDictionaries,\n} from './loadDictionaries/index';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n} from './transpiler/dictionary_to_main';\nexport { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';\nexport { getFileHash } from './utils';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":"AAAA,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,SAAS,kCAAkC;AAC3C,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,iCAAiC;AAC1C,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { checkDictionaryChanges } from './checkDictionaryChanges';\nexport {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeys } from './fetchDistantDictionaryKeys';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\nexport { getFilteredLocalesContent } from './getFilteredLocalesContent';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n listGitLines,\n type DiffMode,\n type ListGitFilesOptions,\n type ListGitLinesOptions,\n} from './listGitFiles';\nexport {\n loadDictionaries,\n loadDistantDictionaries,\n loadLocalDictionaries,\n} from './loadDictionaries/index';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n} from './transpiler/dictionary_to_main';\nexport { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';\nexport { getFileHash } from './utils';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":"AAAA,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,SAAS,kCAAkC;AAC3C,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,iCAAiC;AAC1C,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAC1C,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,OAEK;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getAppLogger } from "@intlayer/config";
|
|
2
2
|
import configuration from "@intlayer/config/built";
|
|
3
|
+
import { readFileSync } from "fs";
|
|
3
4
|
import { join } from "path";
|
|
4
5
|
import simpleGit from "simple-git";
|
|
5
6
|
const getGitRootDir = async () => {
|
|
@@ -60,7 +61,72 @@ const listGitFiles = async ({
|
|
|
60
61
|
console.warn("Failed to get changes list:", error);
|
|
61
62
|
}
|
|
62
63
|
};
|
|
64
|
+
const listGitLines = async (filePath, {
|
|
65
|
+
mode,
|
|
66
|
+
baseRef = "origin/main",
|
|
67
|
+
currentRef = "HEAD"
|
|
68
|
+
// HEAD points to the current branch's latest commit
|
|
69
|
+
}) => {
|
|
70
|
+
const git = simpleGit();
|
|
71
|
+
const changedLines = /* @__PURE__ */ new Set();
|
|
72
|
+
const collectLinesFromDiff = (diffOutput) => {
|
|
73
|
+
const hunkRegex = /@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/g;
|
|
74
|
+
let match;
|
|
75
|
+
while ((match = hunkRegex.exec(diffOutput)) !== null) {
|
|
76
|
+
const oldCount = match[2] ? Number(match[2]) : 1;
|
|
77
|
+
const newStart = Number(match[3]);
|
|
78
|
+
const newCount = match[4] ? Number(match[4]) : 1;
|
|
79
|
+
if (newCount > 0) {
|
|
80
|
+
for (let i = 0; i < newCount; i++) {
|
|
81
|
+
changedLines.add(newStart + i);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (oldCount > 0 && newCount === 0) {
|
|
85
|
+
if (newStart > 1) {
|
|
86
|
+
changedLines.add(newStart - 1);
|
|
87
|
+
}
|
|
88
|
+
changedLines.add(newStart);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
if (mode.includes("untracked")) {
|
|
93
|
+
const status = await git.status();
|
|
94
|
+
const isUntracked = status.not_added.includes(filePath);
|
|
95
|
+
if (isUntracked) {
|
|
96
|
+
try {
|
|
97
|
+
const content = readFileSync(filePath, "utf-8");
|
|
98
|
+
content.split("\n").forEach((_, idx) => changedLines.add(idx + 1));
|
|
99
|
+
} catch {
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (mode.includes("uncommitted")) {
|
|
104
|
+
const diffOutput = await git.diff(["--unified=0", "HEAD", "--", filePath]);
|
|
105
|
+
collectLinesFromDiff(diffOutput);
|
|
106
|
+
}
|
|
107
|
+
if (mode.includes("unpushed")) {
|
|
108
|
+
const diffOutput = await git.diff([
|
|
109
|
+
"--unified=0",
|
|
110
|
+
"@{push}...HEAD",
|
|
111
|
+
"--",
|
|
112
|
+
filePath
|
|
113
|
+
]);
|
|
114
|
+
collectLinesFromDiff(diffOutput);
|
|
115
|
+
}
|
|
116
|
+
if (mode.includes("gitDiff")) {
|
|
117
|
+
await git.fetch(baseRef);
|
|
118
|
+
const diffOutput = await git.diff([
|
|
119
|
+
"--unified=0",
|
|
120
|
+
`${baseRef}...${currentRef}`,
|
|
121
|
+
"--",
|
|
122
|
+
filePath
|
|
123
|
+
]);
|
|
124
|
+
collectLinesFromDiff(diffOutput);
|
|
125
|
+
}
|
|
126
|
+
return Array.from(changedLines).sort((a, b) => a - b);
|
|
127
|
+
};
|
|
63
128
|
export {
|
|
64
|
-
listGitFiles
|
|
129
|
+
listGitFiles,
|
|
130
|
+
listGitLines
|
|
65
131
|
};
|
|
66
132
|
//# sourceMappingURL=listGitFiles.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/listGitFiles.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { join } from 'path';\nimport simpleGit from 'simple-git';\n\nexport type DiffMode = 'gitDiff' | 'uncommitted' | 'unpushed' | 'untracked';\n\nconst getGitRootDir = async (): Promise<string | null> => {\n try {\n const git = simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (error) {\n const appLogger = getAppLogger(configuration);\n appLogger('Error getting git root directory:' + error, {\n level: 'error',\n });\n return null;\n }\n};\n\nexport type ListGitFilesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n absolute?: boolean;\n};\n\nexport const listGitFiles = async ({\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n absolute = true,\n}: ListGitFilesOptions) => {\n try {\n const git = simpleGit();\n const diff: Set<string> = new Set();\n\n if (mode.includes('untracked')) {\n const status = await git.status();\n status.not_added.forEach((f) => diff.add(f));\n }\n\n if (mode.includes('uncommitted')) {\n // Get uncommitted changes\n const uncommittedDiff = await git.diff(['--name-only', 'HEAD']);\n\n const uncommittedFiles = uncommittedDiff.split('\\n').filter(Boolean);\n\n uncommittedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('unpushed')) {\n // Get unpushed commits\n const unpushedDiff = await git.diff(['--name-only', '@{push}...HEAD']);\n\n const unpushedFiles = unpushedDiff.split('\\n').filter(Boolean);\n\n unpushedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('gitDiff')) {\n // Get the base branch (usually main/master) from CI environment\n\n await git.fetch(baseRef);\n\n const diffBranch = await git.diff([\n '--name-only',\n `${baseRef}...${currentRef}`,\n ]);\n\n const gitDiffFiles = diffBranch.split('\\n').filter(Boolean);\n\n gitDiffFiles.forEach((file) => diff.add(file));\n }\n\n if (absolute) {\n const gitRootDir = await getGitRootDir();\n if (!gitRootDir) {\n return [];\n }\n return Array.from(diff).map((file) => join(gitRootDir, file));\n }\n\n return Array.from(diff);\n } catch (error) {\n console.warn('Failed to get changes list:', error);\n }\n};\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,OAAO,mBAAmB;AAC1B,SAAS,YAAY;AACrB,OAAO,eAAe;AAItB,MAAM,gBAAgB,YAAoC;AACxD,MAAI;AACF,UAAM,MAAM,UAAU;AACtB,UAAM,UAAU,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC;AACtD,WAAO,QAAQ,KAAK;AAAA,EACtB,SAAS,OAAO;AACd,UAAM,YAAY,aAAa,aAAa;AAC5C,cAAU,sCAAsC,OAAO;AAAA,MACrD,OAAO;AAAA,IACT,CAAC;AACD,WAAO;AAAA,EACT;AACF;AASO,MAAM,eAAe,OAAO;AAAA,EACjC;AAAA,EACA,UAAU;AAAA,EACV,aAAa;AAAA;AAAA,EACb,WAAW;AACb,MAA2B;AACzB,MAAI;AACF,UAAM,MAAM,UAAU;AACtB,UAAM,OAAoB,oBAAI,IAAI;AAElC,QAAI,KAAK,SAAS,WAAW,GAAG;AAC9B,YAAM,SAAS,MAAM,IAAI,OAAO;AAChC,aAAO,UAAU,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AAAA,IAC7C;AAEA,QAAI,KAAK,SAAS,aAAa,GAAG;AAEhC,YAAM,kBAAkB,MAAM,IAAI,KAAK,CAAC,eAAe,MAAM,CAAC;AAE9D,YAAM,mBAAmB,gBAAgB,MAAM,IAAI,EAAE,OAAO,OAAO;AAEnE,uBAAiB,QAAQ,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC;AAAA,IACnD;AAEA,QAAI,KAAK,SAAS,UAAU,GAAG;AAE7B,YAAM,eAAe,MAAM,IAAI,KAAK,CAAC,eAAe,gBAAgB,CAAC;AAErE,YAAM,gBAAgB,aAAa,MAAM,IAAI,EAAE,OAAO,OAAO;AAE7D,oBAAc,QAAQ,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC;AAAA,IAChD;AAEA,QAAI,KAAK,SAAS,SAAS,GAAG;AAG5B,YAAM,IAAI,MAAM,OAAO;AAEvB,YAAM,aAAa,MAAM,IAAI,KAAK;AAAA,QAChC;AAAA,QACA,GAAG,OAAO,MAAM,UAAU;AAAA,MAC5B,CAAC;AAED,YAAM,eAAe,WAAW,MAAM,IAAI,EAAE,OAAO,OAAO;AAE1D,mBAAa,QAAQ,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC;AAAA,IAC/C;AAEA,QAAI,UAAU;AACZ,YAAM,aAAa,MAAM,cAAc;AACvC,UAAI,CAAC,YAAY;AACf,eAAO,CAAC;AAAA,MACV;AACA,aAAO,MAAM,KAAK,IAAI,EAAE,IAAI,CAAC,SAAS,KAAK,YAAY,IAAI,CAAC;AAAA,IAC9D;AAEA,WAAO,MAAM,KAAK,IAAI;AAAA,EACxB,SAAS,OAAO;AACd,YAAQ,KAAK,+BAA+B,KAAK;AAAA,EACnD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/listGitFiles.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\nimport simpleGit from 'simple-git';\n\nexport type DiffMode = 'gitDiff' | 'uncommitted' | 'unpushed' | 'untracked';\n\nconst getGitRootDir = async (): Promise<string | null> => {\n try {\n const git = simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (error) {\n const appLogger = getAppLogger(configuration);\n appLogger('Error getting git root directory:' + error, {\n level: 'error',\n });\n return null;\n }\n};\n\nexport type ListGitFilesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n absolute?: boolean;\n};\n\nexport const listGitFiles = async ({\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n absolute = true,\n}: ListGitFilesOptions) => {\n try {\n const git = simpleGit();\n const diff: Set<string> = new Set();\n\n if (mode.includes('untracked')) {\n const status = await git.status();\n status.not_added.forEach((f) => diff.add(f));\n }\n\n if (mode.includes('uncommitted')) {\n // Get uncommitted changes\n const uncommittedDiff = await git.diff(['--name-only', 'HEAD']);\n\n const uncommittedFiles = uncommittedDiff.split('\\n').filter(Boolean);\n\n uncommittedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('unpushed')) {\n // Get unpushed commits\n const unpushedDiff = await git.diff(['--name-only', '@{push}...HEAD']);\n\n const unpushedFiles = unpushedDiff.split('\\n').filter(Boolean);\n\n unpushedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('gitDiff')) {\n // Get the base branch (usually main/master) from CI environment\n\n await git.fetch(baseRef);\n\n const diffBranch = await git.diff([\n '--name-only',\n `${baseRef}...${currentRef}`,\n ]);\n\n const gitDiffFiles = diffBranch.split('\\n').filter(Boolean);\n\n gitDiffFiles.forEach((file) => diff.add(file));\n }\n\n if (absolute) {\n const gitRootDir = await getGitRootDir();\n if (!gitRootDir) {\n return [];\n }\n return Array.from(diff).map((file) => join(gitRootDir, file));\n }\n\n return Array.from(diff);\n } catch (error) {\n console.warn('Failed to get changes list:', error);\n }\n};\n\nexport type ListGitLinesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n};\n\nexport const listGitLines = async (\n filePath: string,\n {\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n }: ListGitLinesOptions\n): Promise<number[]> => {\n const git = simpleGit();\n // We collect **line numbers** (1-based) that were modified/added by the diff.\n // Using a Set ensures uniqueness when the same line is reported by several modes.\n const changedLines: Set<number> = new Set();\n\n /**\n * Extracts line numbers from a diff generated with `--unified=0`.\n * Each hunk header looks like: @@ -<oldStart>,<oldCount> +<newStart>,<newCount> @@\n * We consider both the \"+\" (new) side for additions and the \"-\" (old) side for deletions.\n * For deletions, we add the line before and after the deletion point in the current file.\n */\n const collectLinesFromDiff = (diffOutput: string) => {\n const hunkRegex = /@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/g;\n let match: RegExpExecArray | null;\n\n while ((match = hunkRegex.exec(diffOutput)) !== null) {\n const oldCount = match[2] ? Number(match[2]) : 1;\n const newStart = Number(match[3]);\n const newCount = match[4] ? Number(match[4]) : 1;\n\n // Handle additions/modifications (+ side)\n if (newCount > 0) {\n for (let i = 0; i < newCount; i++) {\n changedLines.add(newStart + i);\n }\n }\n\n // Handle deletions (- side)\n if (oldCount > 0 && newCount === 0) {\n // For deletions, add the line before and after the deletion point\n // The deletion point in the new file is at newStart\n if (newStart > 1) {\n changedLines.add(newStart - 1); // Line before deletion\n }\n changedLines.add(newStart); // Line after deletion (if it exists)\n }\n }\n };\n\n // 1. Handle untracked files – when a file is untracked its entire content is new.\n if (mode.includes('untracked')) {\n const status = await git.status();\n const isUntracked = status.not_added.includes(filePath);\n if (isUntracked) {\n try {\n const content = readFileSync(filePath, 'utf-8');\n content.split('\\n').forEach((_, idx) => changedLines.add(idx + 1));\n } catch {\n // ignore read errors – file may have been deleted, etc.\n }\n }\n }\n\n // 2. Uncommitted changes (working tree vs HEAD)\n if (mode.includes('uncommitted')) {\n const diffOutput = await git.diff(['--unified=0', 'HEAD', '--', filePath]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 3. Unpushed commits – compare local branch to its upstream\n if (mode.includes('unpushed')) {\n const diffOutput = await git.diff([\n '--unified=0',\n '@{push}...HEAD',\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 4. Regular git diff between baseRef and currentRef (e.g., CI pull-request diff)\n if (mode.includes('gitDiff')) {\n await git.fetch(baseRef);\n const diffOutput = await git.diff([\n '--unified=0',\n `${baseRef}...${currentRef}`,\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // Return the list sorted for convenience\n return Array.from(changedLines).sort((a, b) => a - b);\n};\n"],"mappings":"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","names":[]}
|
|
@@ -13,9 +13,11 @@ import {
|
|
|
13
13
|
createTypes
|
|
14
14
|
} from "./transpiler/dictionary_to_type/index.mjs";
|
|
15
15
|
import { writeConfiguration } from "./writeConfiguration/index.mjs";
|
|
16
|
-
const prepareIntlayer = async (configuration = getConfiguration(), projectRequire = ESMxCJSRequire) => {
|
|
16
|
+
const prepareIntlayer = async (configuration = getConfiguration(), projectRequire = ESMxCJSRequire, clean = false) => {
|
|
17
17
|
const appLogger = getAppLogger(configuration);
|
|
18
|
-
|
|
18
|
+
if (clean) {
|
|
19
|
+
cleanOutputDir(configuration);
|
|
20
|
+
}
|
|
19
21
|
const files = listDictionaries(configuration);
|
|
20
22
|
const dictionaries = await loadDictionaries(
|
|
21
23
|
files,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n type IntlayerConfig,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nimport { createDictionaryEntryPoint } from './transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from './transpiler/dictionary_to_type/index';\nimport { writeConfiguration } from './writeConfiguration';\n\nexport const prepareIntlayer = async (\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire\n) => {\n const appLogger = getAppLogger(configuration);\n\n cleanOutputDir(configuration);\n\n const files: string[] = listDictionaries(configuration);\n\n const dictionaries = await loadDictionaries(\n files,\n configuration,\n projectRequire\n );\n\n // Build locale dictionaries\n const dictionariesOutput = await buildDictionary(dictionaries, configuration);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n createTypes(dictionariesPaths);\n\n createDictionaryEntryPoint(configuration);\n\n appLogger('Dictionaries built');\n\n createModuleAugmentation(configuration);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n writeConfiguration(configuration);\n\n appLogger('Configuration written', {\n isVerbose: true,\n });\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AAE5B,MAAM,kBAAkB,OAC7B,gBAAgC,iBAAiB,GACjD,iBAAiB,
|
|
1
|
+
{"version":3,"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n type IntlayerConfig,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nimport { createDictionaryEntryPoint } from './transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from './transpiler/dictionary_to_type/index';\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\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 // Build locale dictionaries\n const dictionariesOutput = await buildDictionary(dictionaries, configuration);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n createTypes(dictionariesPaths);\n\n createDictionaryEntryPoint(configuration);\n\n appLogger('Dictionaries built');\n\n createModuleAugmentation(configuration);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n writeConfiguration(configuration);\n\n appLogger('Configuration written', {\n isVerbose: true,\n });\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AAE5B,MAAM,kBAAkB,OAC7B,gBAAgC,iBAAiB,GACjD,iBAAiB,gBACjB,QAAQ,UACL;AACH,QAAM,YAAY,aAAa,aAAa;AAE5C,MAAI,OAAO;AACT,mBAAe,aAAa;AAAA,EAC9B;AAEA,QAAM,QAAkB,iBAAiB,aAAa;AAEtD,QAAM,eAAe,MAAM;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGA,QAAM,qBAAqB,MAAM,gBAAgB,cAAc,aAAa;AAE5E,QAAM,oBAAoB,OAAO;AAAA,IAC/B,oBAAoB,sBAAsB,CAAC;AAAA,EAC7C,EAAE,IAAI,CAAC,eAAe,WAAW,cAAc;AAE/C,cAAY,iBAAiB;AAE7B,6BAA2B,aAAa;AAExC,YAAU,oBAAoB;AAE9B,2BAAyB,aAAa;AAEtC,YAAU,6BAA6B;AAAA,IACrC,WAAW;AAAA,EACb,CAAC;AAED,qBAAmB,aAAa;AAEhC,YAAU,yBAAyB;AAAA,IACjC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -1,33 +1,8 @@
|
|
|
1
1
|
import { logger } from "@intlayer/config/client";
|
|
2
|
-
|
|
3
|
-
if (entry && typeof entry.then === "function") {
|
|
4
|
-
const awaited = await entry;
|
|
5
|
-
return resolveContentPromises(awaited);
|
|
6
|
-
}
|
|
7
|
-
if (typeof entry === "function") {
|
|
8
|
-
const result = entry();
|
|
9
|
-
return resolveContentPromises(result);
|
|
10
|
-
}
|
|
11
|
-
if (Array.isArray(entry)) {
|
|
12
|
-
return Promise.all(
|
|
13
|
-
entry.map(async (item) => resolveContentPromises(item))
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
if (entry && typeof entry === "object") {
|
|
17
|
-
const result = {};
|
|
18
|
-
const keys = Object.keys(entry);
|
|
19
|
-
await Promise.all(
|
|
20
|
-
keys.map(async (key) => {
|
|
21
|
-
result[key] = await resolveContentPromises(entry[key]);
|
|
22
|
-
})
|
|
23
|
-
);
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
return entry;
|
|
27
|
-
};
|
|
2
|
+
import { resolveObjectPromises } from "../../../utils/resolveObjectPromises.mjs";
|
|
28
3
|
const processContentDeclaration = async (contentDeclaration) => {
|
|
29
4
|
try {
|
|
30
|
-
const content = await
|
|
5
|
+
const content = await resolveObjectPromises(
|
|
31
6
|
contentDeclaration.content
|
|
32
7
|
);
|
|
33
8
|
return {
|
|
@@ -41,7 +16,6 @@ const processContentDeclaration = async (contentDeclaration) => {
|
|
|
41
16
|
}
|
|
42
17
|
};
|
|
43
18
|
export {
|
|
44
|
-
processContentDeclaration
|
|
45
|
-
resolveContentPromises
|
|
19
|
+
processContentDeclaration
|
|
46
20
|
};
|
|
47
21
|
//# sourceMappingURL=processContentDeclaration.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { resolveObjectPromises } from '../../../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary\n): Promise<Dictionary | undefined> => {\n try {\n const content = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n return {\n ...contentDeclaration,\n content,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":"AAAA,SAAS,cAAc;AAEvB,SAAS,6BAA6B;AAK/B,MAAM,4BAA4B,OACvC,uBACoC;AACpC,MAAI;AACF,UAAM,UAAW,MAAM;AAAA,MACrB,mBAAmB;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,WAAO,OAAO;AAAA,MACZ,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const resolveObjectPromises = async (entry) => {
|
|
2
|
+
if (entry && typeof entry.then === "function") {
|
|
3
|
+
const awaited = await entry;
|
|
4
|
+
return resolveObjectPromises(awaited);
|
|
5
|
+
}
|
|
6
|
+
if (typeof entry === "function") {
|
|
7
|
+
const result = entry();
|
|
8
|
+
return resolveObjectPromises(result);
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(entry)) {
|
|
11
|
+
return Promise.all(
|
|
12
|
+
entry.map(async (item) => resolveObjectPromises(item))
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
if (entry && typeof entry === "object") {
|
|
16
|
+
const result = {};
|
|
17
|
+
for (const key of Object.keys(entry)) {
|
|
18
|
+
result[key] = await resolveObjectPromises(entry[key]);
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
return entry;
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
resolveObjectPromises
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=resolveObjectPromises.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/resolveObjectPromises.ts"],"sourcesContent":["/**\n * A more \"unified\" approach where each type (function, array, object, primitive)\n * is handled inside the main recursive body.\n */\nexport const resolveObjectPromises = async <T = unknown>(\n entry: any\n): Promise<T> => {\n // Check if entry is a Promise (Thenable)\n if (entry && typeof entry.then === 'function') {\n const awaited = await entry;\n return resolveObjectPromises(awaited);\n }\n\n // If entry is a function, invoke it and process the result\n if (typeof entry === 'function') {\n const result = entry();\n return resolveObjectPromises(result);\n }\n\n if (Array.isArray(entry)) {\n return Promise.all(\n entry.map(async (item) => resolveObjectPromises(item))\n ) as unknown as T;\n }\n\n // Handle plain objects (but not arrays)\n if (entry && typeof entry === 'object') {\n // Arrays are handled in the `Array.isArray` branch above, so we know `entry` is a plain object here.\n\n const result: Record<string, any> = {};\n\n // Iterate over keys **sequentially** to make sure the insertion order of the\n // resulting object matches the original key order. Using `Promise.all` here\n // could lead to out-of-order insertions when asynchronous resolutions\n // finish at different times.\n for (const key of Object.keys(entry)) {\n result[key] = await resolveObjectPromises(entry[key]);\n }\n\n return result as T;\n }\n\n return entry as T;\n};\n"],"mappings":"AAIO,MAAM,wBAAwB,OACnC,UACe;AAEf,MAAI,SAAS,OAAO,MAAM,SAAS,YAAY;AAC7C,UAAM,UAAU,MAAM;AACtB,WAAO,sBAAsB,OAAO;AAAA,EACtC;AAGA,MAAI,OAAO,UAAU,YAAY;AAC/B,UAAM,SAAS,MAAM;AACrB,WAAO,sBAAsB,MAAM;AAAA,EACrC;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,QAAQ;AAAA,MACb,MAAM,IAAI,OAAO,SAAS,sBAAsB,IAAI,CAAC;AAAA,IACvD;AAAA,EACF;AAGA,MAAI,SAAS,OAAO,UAAU,UAAU;AAGtC,UAAM,SAA8B,CAAC;AAMrC,eAAW,OAAO,OAAO,KAAK,KAAK,GAAG;AACpC,aAAO,GAAG,IAAI,MAAM,sBAAsB,MAAM,GAAG,CAAC;AAAA,IACtD;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { resolveObjectPromises } from "./resolveObjectPromises.mjs";
|
|
3
|
+
const getKeysInOrder = (obj) => {
|
|
4
|
+
return Object.keys(obj);
|
|
5
|
+
};
|
|
6
|
+
const delay = async (ms) => {
|
|
7
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
8
|
+
};
|
|
9
|
+
const testCase = {
|
|
10
|
+
test1: 1,
|
|
11
|
+
test2: () => 2,
|
|
12
|
+
test3: async () => 3,
|
|
13
|
+
test4: [
|
|
14
|
+
41,
|
|
15
|
+
() => 42,
|
|
16
|
+
async () => {
|
|
17
|
+
await delay(100);
|
|
18
|
+
return 43;
|
|
19
|
+
},
|
|
20
|
+
[
|
|
21
|
+
Promise.resolve(44),
|
|
22
|
+
async () => {
|
|
23
|
+
await delay(100);
|
|
24
|
+
return 45;
|
|
25
|
+
},
|
|
26
|
+
46
|
|
27
|
+
]
|
|
28
|
+
],
|
|
29
|
+
test5: {
|
|
30
|
+
test51: () => 51,
|
|
31
|
+
test52: () => 52,
|
|
32
|
+
test53: () => 53
|
|
33
|
+
},
|
|
34
|
+
test6: {
|
|
35
|
+
test61: {
|
|
36
|
+
test611: 611,
|
|
37
|
+
test612: 612,
|
|
38
|
+
test613: 613
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
test7: {
|
|
42
|
+
test71: async () => {
|
|
43
|
+
await delay(100);
|
|
44
|
+
return {
|
|
45
|
+
test711: async () => 711,
|
|
46
|
+
test712: async () => {
|
|
47
|
+
await delay(100);
|
|
48
|
+
return 712;
|
|
49
|
+
},
|
|
50
|
+
test713: async () => {
|
|
51
|
+
await delay(100);
|
|
52
|
+
return [
|
|
53
|
+
7131,
|
|
54
|
+
async () => {
|
|
55
|
+
await delay(100);
|
|
56
|
+
return 7132;
|
|
57
|
+
},
|
|
58
|
+
async () => {
|
|
59
|
+
await delay(100);
|
|
60
|
+
return 7133;
|
|
61
|
+
},
|
|
62
|
+
7134
|
|
63
|
+
];
|
|
64
|
+
},
|
|
65
|
+
test714: 714
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
test8: 8
|
|
70
|
+
};
|
|
71
|
+
const testCaseResolved = {
|
|
72
|
+
test1: 1,
|
|
73
|
+
test2: 2,
|
|
74
|
+
test3: 3,
|
|
75
|
+
test4: [41, 42, 43, [44, 45, 46]],
|
|
76
|
+
test5: {
|
|
77
|
+
test51: 51,
|
|
78
|
+
test52: 52,
|
|
79
|
+
test53: 53
|
|
80
|
+
},
|
|
81
|
+
test6: {
|
|
82
|
+
test61: {
|
|
83
|
+
test611: 611,
|
|
84
|
+
test612: 612,
|
|
85
|
+
test613: 613
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
test7: {
|
|
89
|
+
test71: {
|
|
90
|
+
test711: 711,
|
|
91
|
+
test712: 712,
|
|
92
|
+
test713: [7131, 7132, 7133, 7134],
|
|
93
|
+
test714: 714
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
test8: 8
|
|
97
|
+
};
|
|
98
|
+
describe("resolveObjectPromises", () => {
|
|
99
|
+
it("should the result be in the same order as the original object", async () => {
|
|
100
|
+
const resolved = await resolveObjectPromises(testCase);
|
|
101
|
+
expect(JSON.stringify(resolved)).toStrictEqual(
|
|
102
|
+
JSON.stringify(testCaseResolved)
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=resolveObjectPromises.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/resolveObjectPromises.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { resolveObjectPromises } from './resolveObjectPromises';\n\n// Helper to extract keys order of an object\nconst getKeysInOrder = (obj: Record<string, unknown>): string[] => {\n return Object.keys(obj);\n};\n\nconst delay = async (ms: number) => {\n await new Promise((resolve) => setTimeout(resolve, ms));\n};\n\nconst testCase = {\n test1: 1,\n test2: () => 2,\n test3: async () => 3,\n test4: [\n 41,\n () => 42,\n async () => {\n await delay(100);\n return 43;\n },\n [\n Promise.resolve(44),\n async () => {\n await delay(100);\n return 45;\n },\n 46,\n ],\n ],\n test5: {\n test51: () => 51,\n test52: () => 52,\n test53: () => 53,\n },\n test6: {\n test61: {\n test611: 611,\n test612: 612,\n test613: 613,\n },\n },\n test7: {\n test71: async () => {\n await delay(100);\n return {\n test711: async () => 711,\n test712: async () => {\n await delay(100);\n return 712;\n },\n test713: async () => {\n await delay(100);\n return [\n 7131,\n async () => {\n await delay(100);\n return 7132;\n },\n async () => {\n await delay(100);\n return 7133;\n },\n 7134,\n ];\n },\n test714: 714,\n };\n },\n },\n test8: 8,\n};\n\nconst testCaseResolved = {\n test1: 1,\n test2: 2,\n test3: 3,\n test4: [41, 42, 43, [44, 45, 46]],\n test5: {\n test51: 51,\n test52: 52,\n test53: 53,\n },\n test6: {\n test61: {\n test611: 611,\n test612: 612,\n test613: 613,\n },\n },\n test7: {\n test71: {\n test711: 711,\n test712: 712,\n test713: [7131, 7132, 7133, 7134],\n test714: 714,\n },\n },\n test8: 8,\n};\n\ndescribe('resolveObjectPromises', () => {\n it('should the result be in the same order as the original object', async () => {\n const resolved = await resolveObjectPromises<typeof testCase>(testCase);\n\n // Stringify the objects to ensure the order of the keys is the same\n expect(JSON.stringify(resolved)).toStrictEqual(\n JSON.stringify(testCaseResolved)\n );\n });\n});\n"],"mappings":"AAAA,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,6BAA6B;AAGtC,MAAM,iBAAiB,CAAC,QAA2C;AACjE,SAAO,OAAO,KAAK,GAAG;AACxB;AAEA,MAAM,QAAQ,OAAO,OAAe;AAClC,QAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AACxD;AAEA,MAAM,WAAW;AAAA,EACf,OAAO;AAAA,EACP,OAAO,MAAM;AAAA,EACb,OAAO,YAAY;AAAA,EACnB,OAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,YAAY;AACV,YAAM,MAAM,GAAG;AACf,aAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,QAAQ,QAAQ,EAAE;AAAA,MAClB,YAAY;AACV,cAAM,MAAM,GAAG;AACf,eAAO;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,QAAQ,YAAY;AAClB,YAAM,MAAM,GAAG;AACf,aAAO;AAAA,QACL,SAAS,YAAY;AAAA,QACrB,SAAS,YAAY;AACnB,gBAAM,MAAM,GAAG;AACf,iBAAO;AAAA,QACT;AAAA,QACA,SAAS,YAAY;AACnB,gBAAM,MAAM,GAAG;AACf,iBAAO;AAAA,YACL;AAAA,YACA,YAAY;AACV,oBAAM,MAAM,GAAG;AACf,qBAAO;AAAA,YACT;AAAA,YACA,YAAY;AACV,oBAAM,MAAM,GAAG;AACf,qBAAO;AAAA,YACT;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,MAAM,mBAAmB;AAAA,EACvB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;AAAA,EAChC,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS,CAAC,MAAM,MAAM,MAAM,IAAI;AAAA,MAChC,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,SAAS,yBAAyB,MAAM;AACtC,KAAG,iEAAiE,YAAY;AAC9E,UAAM,WAAW,MAAM,sBAAuC,QAAQ;AAGtE,WAAO,KAAK,UAAU,QAAQ,CAAC,EAAE;AAAA,MAC/B,KAAK,UAAU,gBAAgB;AAAA,IACjC;AAAA,EACF,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanOutputDir.d.ts","sourceRoot":"","sources":["../../src/cleanOutputDir.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,GAAI,yDAAkC,
|
|
1
|
+
{"version":3,"file":"cleanOutputDir.d.ts","sourceRoot":"","sources":["../../src/cleanOutputDir.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,GAAI,yDAAkC,SA6ChE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKvD,KAAK,+BAA+B,GAAG;IACrC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B,KACvC,OAAO,CAAC,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKvD,KAAK,+BAA+B,GAAG;IACrC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B,KACvC,OAAO,CAAC,aAAa,EAAE,CAoGzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchDistantDictionaryKeys.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaryKeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,0BAA0B,GACrC,gBAAe,cAAmC,KACjD,OAAO,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"fetchDistantDictionaryKeys.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaryKeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,0BAA0B,GACrC,gBAAe,cAAmC,KACjD,OAAO,CAAC,MAAM,EAAE,CAiClB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { getBuiltDictionariesPath } from './getBuiltDictionariesPath';
|
|
|
7
7
|
export { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';
|
|
8
8
|
export { getFilteredLocalesContent } from './getFilteredLocalesContent';
|
|
9
9
|
export { listDictionaries } from './listDictionariesPath';
|
|
10
|
-
export { listGitFiles, type DiffMode, type ListGitFilesOptions, } from './listGitFiles';
|
|
10
|
+
export { listGitFiles, listGitLines, type DiffMode, type ListGitFilesOptions, type ListGitLinesOptions, } from './listGitFiles';
|
|
11
11
|
export { loadDictionaries, loadDistantDictionaries, loadLocalDictionaries, } from './loadDictionaries/index';
|
|
12
12
|
export { mergeDictionaries } from './mergeDictionaries';
|
|
13
13
|
export { prepareContentDeclaration } from './prepareContentDeclaration';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,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,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AACpF,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,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,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,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,EACL,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AACpF,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC"}
|
|
@@ -6,4 +6,10 @@ export type ListGitFilesOptions = {
|
|
|
6
6
|
absolute?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare const listGitFiles: ({ mode, baseRef, currentRef, absolute, }: ListGitFilesOptions) => Promise<string[]>;
|
|
9
|
+
export type ListGitLinesOptions = {
|
|
10
|
+
mode: DiffMode[];
|
|
11
|
+
baseRef?: string;
|
|
12
|
+
currentRef?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const listGitLines: (filePath: string, { mode, baseRef, currentRef, }: ListGitLinesOptions) => Promise<number[]>;
|
|
9
15
|
//# sourceMappingURL=listGitFiles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listGitFiles.d.ts","sourceRoot":"","sources":["../../src/listGitFiles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"listGitFiles.d.ts","sourceRoot":"","sources":["../../src/listGitFiles.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,WAAW,CAAC;AAgB5E,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,0CAKhC,mBAAmB,sBAuDrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,UAAU,MAAM,EAChB,gCAIG,mBAAmB,KACrB,OAAO,CAAC,MAAM,EAAE,CAqFlB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type IntlayerConfig } from '@intlayer/config';
|
|
2
|
-
export declare const prepareIntlayer: (configuration?: IntlayerConfig, projectRequire?: NodeJS.Require) => Promise<void>;
|
|
2
|
+
export declare const prepareIntlayer: (configuration?: IntlayerConfig, projectRequire?: NodeJS.Require, clean?: boolean) => Promise<void>;
|
|
3
3
|
//# sourceMappingURL=prepareIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAY1B,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,EAClD,+BAA+B,
|
|
1
|
+
{"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAY1B,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,EAClD,+BAA+B,EAC/B,eAAa,kBAwCd,CAAC"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import type { Dictionary } from '@intlayer/core';
|
|
2
|
-
/**
|
|
3
|
-
* A more "unified" approach where each type (function, array, object, primitive)
|
|
4
|
-
* is handled inside the main recursive body.
|
|
5
|
-
*/
|
|
6
|
-
export declare const resolveContentPromises: <T = unknown>(entry: any) => Promise<T>;
|
|
7
2
|
/**
|
|
8
3
|
* Function to load, process the module and return the Intlayer Dictionary from the module file
|
|
9
4
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processContentDeclaration.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"processContentDeclaration.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,yBAAyB,GACpC,oBAAoB,UAAU,KAC7B,OAAO,CAAC,UAAU,GAAG,SAAS,CAehC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A more "unified" approach where each type (function, array, object, primitive)
|
|
3
|
+
* is handled inside the main recursive body.
|
|
4
|
+
*/
|
|
5
|
+
export declare const resolveObjectPromises: <T = unknown>(entry: any) => Promise<T>;
|
|
6
|
+
//# sourceMappingURL=resolveObjectPromises.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveObjectPromises.d.ts","sourceRoot":"","sources":["../../../src/utils/resolveObjectPromises.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAU,CAAC,GAAG,OAAO,EACrD,OAAO,GAAG,KACT,OAAO,CAAC,CAAC,CAqCX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveObjectPromises.test.d.ts","sourceRoot":"","sources":["../../../src/utils/resolveObjectPromises.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/chokidar",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.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": "5.
|
|
72
|
-
"@intlayer/
|
|
73
|
-
"@intlayer/dictionaries-entry": "5.
|
|
74
|
-
"intlayer": "5.
|
|
75
|
-
"@intlayer/
|
|
76
|
-
"
|
|
71
|
+
"@intlayer/api": "5.6.0",
|
|
72
|
+
"@intlayer/core": "5.6.0",
|
|
73
|
+
"@intlayer/unmerged-dictionaries-entry": "5.6.0",
|
|
74
|
+
"@intlayer/dictionaries-entry": "5.6.0",
|
|
75
|
+
"@intlayer/config": "5.6.0",
|
|
76
|
+
"intlayer": "5.6.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@changesets/cli": "2.29.4",
|
|
@@ -90,19 +90,20 @@
|
|
|
90
90
|
"tsc-alias": "^1.8.16",
|
|
91
91
|
"tsup": "^8.5.0",
|
|
92
92
|
"typescript": "^5.8.3",
|
|
93
|
-
"
|
|
93
|
+
"vitest": "^3.2.2",
|
|
94
|
+
"@intlayer/backend": "5.6.0",
|
|
94
95
|
"@utils/eslint-config": "1.0.4",
|
|
95
96
|
"@utils/ts-config": "1.0.4",
|
|
96
|
-
"@utils/
|
|
97
|
-
"@utils/
|
|
97
|
+
"@utils/ts-config-types": "1.0.4",
|
|
98
|
+
"@utils/tsup-config": "1.0.4"
|
|
98
99
|
},
|
|
99
100
|
"peerDependencies": {
|
|
100
101
|
"fast-glob": "^3.3.3",
|
|
101
102
|
"react": ">=16.0.0",
|
|
102
|
-
"@intlayer/
|
|
103
|
-
"@intlayer/core": "5.
|
|
104
|
-
"@intlayer/
|
|
105
|
-
"intlayer": "5.
|
|
103
|
+
"@intlayer/config": "5.6.0",
|
|
104
|
+
"@intlayer/core": "5.6.0",
|
|
105
|
+
"@intlayer/api": "5.6.0",
|
|
106
|
+
"intlayer": "5.6.0"
|
|
106
107
|
},
|
|
107
108
|
"engines": {
|
|
108
109
|
"node": ">=14.18"
|
|
@@ -121,6 +122,7 @@
|
|
|
121
122
|
"prettier": "prettier . --check",
|
|
122
123
|
"prettier:fix": "prettier --write src/**/*",
|
|
123
124
|
"reset": "pnpm clean & pnpm build",
|
|
124
|
-
"test": ""
|
|
125
|
+
"test": "vitest run",
|
|
126
|
+
"test:watch": "vitest"
|
|
125
127
|
}
|
|
126
128
|
}
|