@intlayer/chokidar 6.0.0-canary.0 → 6.0.0-canary.1
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/fetchDistantDictionaryKeysAndUpdateTimestamp.cjs +2 -10
- package/dist/cjs/fetchDistantDictionaryKeysAndUpdateTimestamp.cjs.map +1 -1
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +14 -7
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
- package/dist/cjs/utils/runOnce.cjs +1 -1
- package/dist/cjs/utils/runOnce.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs +3 -11
- package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs.map +1 -1
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +14 -7
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
- package/dist/esm/utils/runOnce.mjs +1 -1
- package/dist/esm/utils/runOnce.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +1 -1
- package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -1
- package/package.json +16 -16
|
@@ -30,16 +30,8 @@ const fetchDistantDictionaryKeysAndUpdateTimestamp = async (configuration = (0,
|
|
|
30
30
|
"Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project."
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
const intlayerAPI = (0, import_api.
|
|
34
|
-
const
|
|
35
|
-
const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
|
|
36
|
-
const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesUpdateTimestamp({
|
|
37
|
-
...oAuth2AccessToken && {
|
|
38
|
-
headers: {
|
|
39
|
-
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
33
|
+
const intlayerAPI = (0, import_api.getIntlayerAPIProxy)(void 0, configuration);
|
|
34
|
+
const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();
|
|
43
35
|
if (!getDictionariesKeysResult.data) {
|
|
44
36
|
throw new Error("No distant dictionaries found");
|
|
45
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeysAndUpdateTimestamp = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<Record<string, number>> => {\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 = getIntlayerAPIProxy(undefined, configuration);\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesUpdateTimeStamp: Record<string, number> =\n getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesUpdateTimeStamp;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,oBAAsD;AAE/C,MAAM,+CAA+C,OAC1D,oBAAgC,gCAAiB,MACb;AACpC,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kBAAc,gCAAoB,QAAW,aAAa;AAGhE,QAAM,4BACJ,MAAM,YAAY,WAAW,+BAA+B;AAE9D,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,qCACJ,0BAA0B;AAG5B,SAAO;AACT;","names":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
loadLocalDictionaries: () => import_loadDictionaries.loadLocalDictionaries,
|
|
42
42
|
loadRemoteDictionaries: () => import_loadDictionaries.loadRemoteDictionaries,
|
|
43
43
|
mergeDictionaries: () => import_mergeDictionaries.mergeDictionaries,
|
|
44
|
+
parallelize: () => import_parallelize.parallelize,
|
|
44
45
|
prepareContentDeclaration: () => import_prepareContentDeclaration.prepareContentDeclaration,
|
|
45
46
|
prepareIntlayer: () => import_prepareIntlayer.prepareIntlayer,
|
|
46
47
|
processPerLocaleDictionary: () => import_processPerLocaleDictionary.processPerLocaleDictionary,
|
|
@@ -72,6 +73,7 @@ var import_createModuleAugmentation = require('./transpiler/dictionary_to_type/c
|
|
|
72
73
|
var import_formatter = require('./utils/formatter.cjs');
|
|
73
74
|
var import_getFileHash = require('./utils/getFileHash.cjs');
|
|
74
75
|
var import_kebabCaseToCamelCase = require('./utils/kebabCaseToCamelCase.cjs');
|
|
76
|
+
var import_parallelize = require('./utils/parallelize.cjs');
|
|
75
77
|
var import_resolveObjectPromises = require('./utils/resolveObjectPromises.cjs');
|
|
76
78
|
var import_runOnce = require('./utils/runOnce.cjs');
|
|
77
79
|
var import_sortAlphabetically = require('./utils/sortAlphabetically.cjs');
|
|
@@ -101,6 +103,7 @@ var import_writeContentDeclaration = require('./writeContentDeclaration/index.cj
|
|
|
101
103
|
loadLocalDictionaries,
|
|
102
104
|
loadRemoteDictionaries,
|
|
103
105
|
mergeDictionaries,
|
|
106
|
+
parallelize,
|
|
104
107
|
prepareContentDeclaration,
|
|
105
108
|
prepareIntlayer,
|
|
106
109
|
processPerLocaleDictionary,
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeysAndUpdateTimestamp } from './fetchDistantDictionaryKeysAndUpdateTimestamp';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\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 loadLocalDictionaries,\n loadRemoteDictionaries,\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 { formatLocale, formatPath } from './utils/formatter';\nexport { getFileHash } from './utils/getFileHash';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAKO;AACP,4BAA+B;AAC/B,sCAAyC;AACzC,0DAA6D;AAC7D,sCAAyC;AACzC,8CAAiD;AACjD,kCAAiC;AACjC,0BAMO;AACP,8BAIO;AACP,+BAAkC;AAClC,uCAA0C;AAC1C,6BAAgC;AAChC,wCAA2C;AAC3C,qCAAwC;AACxC,4CAAgC;AAChC,gCAGO;AACP,sCAAyC;AACzC,uBAAyC;AACzC,yBAA4B;AAC5B,kCAAqC;AACrC,mCAAsC;AACtC,qBAAwB;AACxB,gCAAmC;AACnC,qCAGO;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeysAndUpdateTimestamp } from './fetchDistantDictionaryKeysAndUpdateTimestamp';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\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 loadLocalDictionaries,\n loadRemoteDictionaries,\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 { formatLocale, formatPath } from './utils/formatter';\nexport { getFileHash } from './utils/getFileHash';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { parallelize } from './utils/parallelize';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAKO;AACP,4BAA+B;AAC/B,sCAAyC;AACzC,0DAA6D;AAC7D,sCAAyC;AACzC,8CAAiD;AACjD,kCAAiC;AACjC,0BAMO;AACP,8BAIO;AACP,+BAAkC;AAClC,uCAA0C;AAC1C,6BAAgC;AAChC,wCAA2C;AAC3C,qCAAwC;AACxC,4CAAgC;AAChC,gCAGO;AACP,sCAAyC;AACzC,uBAAyC;AACzC,yBAA4B;AAC5B,kCAAqC;AACrC,yBAA4B;AAC5B,mCAAsC;AACtC,qBAAwB;AACxB,gCAAmC;AACnC,qCAGO;","names":[]}
|
|
@@ -51,14 +51,21 @@ const loadRemoteDictionaries = async (configuration = (0, import_config.getConfi
|
|
|
51
51
|
const distantDictionaryUpdateTimeStamp = await (0, import_fetchDistantDictionaryKeysAndUpdateTimestamp.fetchDistantDictionaryKeysAndUpdateTimestamp)(configuration);
|
|
52
52
|
const dictionariesKeysToFetch = Object.entries(
|
|
53
53
|
distantDictionaryUpdateTimeStamp
|
|
54
|
-
).filter(([dictionaryKey,
|
|
55
|
-
if (!
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
).filter(([dictionaryKey, remoteUpdatedAt]) => {
|
|
55
|
+
if (!remoteUpdatedAt) return true;
|
|
56
|
+
const local = import_remote_dictionaries_entry.default[dictionaryKey];
|
|
57
|
+
if (!local) return true;
|
|
58
|
+
const localUpdatedAtRaw = local?.updatedAt;
|
|
59
|
+
const localUpdatedAt = typeof localUpdatedAtRaw === "number" ? localUpdatedAtRaw : localUpdatedAtRaw ? new Date(localUpdatedAtRaw).getTime() : void 0;
|
|
60
|
+
if (typeof localUpdatedAt !== "number") return true;
|
|
61
|
+
return remoteUpdatedAt > localUpdatedAt;
|
|
58
62
|
}).map(([dictionaryKey]) => dictionaryKey);
|
|
59
|
-
const cachedDictionaries = Object.
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
const cachedDictionaries = Object.entries(import_remote_dictionaries_entry.default).filter(([key, dictionary]) => {
|
|
64
|
+
const remoteUpdatedAt = distantDictionaryUpdateTimeStamp[key];
|
|
65
|
+
const localUpdatedAtRaw = dictionary?.updatedAt;
|
|
66
|
+
const localUpdatedAt = typeof localUpdatedAtRaw === "number" ? localUpdatedAtRaw : localUpdatedAtRaw ? new Date(localUpdatedAtRaw).getTime() : void 0;
|
|
67
|
+
return typeof localUpdatedAt === "number" && typeof remoteUpdatedAt === "number" && localUpdatedAt >= remoteUpdatedAt;
|
|
68
|
+
}).map(([, dictionary]) => dictionary);
|
|
62
69
|
if (cachedDictionaries.length > 0) {
|
|
63
70
|
onStatusUpdate?.(
|
|
64
71
|
cachedDictionaries.map((d) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration, x } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport remoteDictionariesRecord from '@intlayer/remote-dictionaries-entry';\nimport { fetchDistantDictionaries } from '../fetchDistantDictionaries';\nimport { fetchDistantDictionaryKeysAndUpdateTimestamp } from '../fetchDistantDictionaryKeysAndUpdateTimestamp';\nimport { DictionariesStatus } from '../loadDictionaries/loadDictionaries';\nimport { sortAlphabetically } from '../utils/sortAlphabetically';\n\nexport const formatDistantDictionaries = (\n dictionaries: DictionaryAPI[]\n): Dictionary[] =>\n dictionaries.map((dict) => ({\n ...dict,\n localId: `${dict.key}::remote::${dict.id}`,\n location: 'distant' as const,\n }));\n\nexport const loadRemoteDictionaries = async (\n configuration = getConfiguration(),\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const appLogger = getAppLogger(configuration);\n const { editor } = configuration;\n\n const hasRemoteDictionaries = Boolean(editor.clientId && editor.clientSecret);\n\n if (!hasRemoteDictionaries) return [];\n\n try {\n const distantDictionaryUpdateTimeStamp: Record<string, number> =\n await fetchDistantDictionaryKeysAndUpdateTimestamp(configuration);\n\n const dictionariesKeysToFetch = Object.entries(\n distantDictionaryUpdateTimeStamp\n )\n .filter(([dictionaryKey,
|
|
1
|
+
{"version":3,"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration, x } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport remoteDictionariesRecord from '@intlayer/remote-dictionaries-entry';\nimport { fetchDistantDictionaries } from '../fetchDistantDictionaries';\nimport { fetchDistantDictionaryKeysAndUpdateTimestamp } from '../fetchDistantDictionaryKeysAndUpdateTimestamp';\nimport { DictionariesStatus } from '../loadDictionaries/loadDictionaries';\nimport { sortAlphabetically } from '../utils/sortAlphabetically';\n\nexport const formatDistantDictionaries = (\n dictionaries: DictionaryAPI[]\n): Dictionary[] =>\n dictionaries.map((dict) => ({\n ...dict,\n localId: `${dict.key}::remote::${dict.id}`,\n location: 'distant' as const,\n }));\n\nexport const loadRemoteDictionaries = async (\n configuration = getConfiguration(),\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const appLogger = getAppLogger(configuration);\n const { editor } = configuration;\n\n const hasRemoteDictionaries = Boolean(editor.clientId && editor.clientSecret);\n\n if (!hasRemoteDictionaries) return [];\n\n try {\n const distantDictionaryUpdateTimeStamp: Record<string, number> =\n await fetchDistantDictionaryKeysAndUpdateTimestamp(configuration);\n\n const dictionariesKeysToFetch = Object.entries(\n distantDictionaryUpdateTimeStamp\n )\n .filter(([dictionaryKey, remoteUpdatedAt]) => {\n // If remote doesn't provide updatedAt, fetch to be safe\n if (!remoteUpdatedAt) return true;\n\n // If no local cache exists, fetch\n const local = (remoteDictionariesRecord as any)[dictionaryKey];\n if (!local) return true;\n\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n\n // If local timestamp missing or older than remote, fetch\n if (typeof localUpdatedAt !== 'number') return true;\n return remoteUpdatedAt > localUpdatedAt;\n })\n .map(([dictionaryKey]) => dictionaryKey);\n\n const cachedDictionaries = Object.entries(remoteDictionariesRecord)\n .filter(([key, dictionary]) => {\n const remoteUpdatedAt = distantDictionaryUpdateTimeStamp[key];\n const localUpdatedAtRaw = (dictionary as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n // Consider as cached/imported when local exists and is up-to-date or newer\n return (\n typeof localUpdatedAt === 'number' &&\n typeof remoteUpdatedAt === 'number' &&\n localUpdatedAt >= remoteUpdatedAt\n );\n })\n .map(([, dictionary]) => dictionary as any);\n\n // Report cached as already imported\n if (cachedDictionaries.length > 0) {\n onStatusUpdate?.(\n cachedDictionaries.map((d) => ({\n dictionaryKey: d.key,\n type: 'remote',\n status: 'imported',\n }))\n );\n }\n\n const orderedDistantDictionaryKeys =\n dictionariesKeysToFetch.sort(sortAlphabetically);\n\n // Report pending for keys to be fetched so totals are visible immediately\n if (orderedDistantDictionaryKeys.length > 0) {\n onStatusUpdate?.(\n orderedDistantDictionaryKeys.map((key) => ({\n dictionaryKey: key,\n type: 'remote',\n status: 'pending',\n }))\n );\n }\n\n const distantDictionariesData = await fetchDistantDictionaries(\n {\n dictionaryKeys: orderedDistantDictionaryKeys,\n },\n onStatusUpdate\n );\n\n const distantDictionaries: DictionaryAPI[] = formatDistantDictionaries(\n distantDictionariesData\n );\n\n return [...cachedDictionaries, ...distantDictionaries];\n } catch (error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;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ACpC;AAER,aACE,OAAO,mBAAmB,YAC1B,OAAO,oBAAoB,YAC3B,kBAAkB;AAAA,IAEtB,CAAC,EACA,IAAI,CAAC,CAAC,EAAE,UAAU,MAAM,UAAiB;AAG5C,QAAI,mBAAmB,SAAS,GAAG;AACjC;AAAA,QACE,mBAAmB,IAAI,CAAC,OAAO;AAAA,UAC7B,eAAe,EAAE;AAAA,UACjB,MAAM;AAAA,UACN,QAAQ;AAAA,QACV,EAAE;AAAA,MACJ;AAAA,IACF;AAEA,UAAM,+BACJ,wBAAwB,KAAK,4CAAkB;AAGjD,QAAI,6BAA6B,SAAS,GAAG;AAC3C;AAAA,QACE,6BAA6B,IAAI,CAAC,SAAS;AAAA,UACzC,eAAe;AAAA,UACf,MAAM;AAAA,UACN,QAAQ;AAAA,QACV,EAAE;AAAA,MACJ;AAAA,IACF;AAEA,UAAM,0BAA0B,UAAM;AAAA,MACpC;AAAA,QACE,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,IACF;AAEA,UAAM,sBAAuC;AAAA,MAC3C;AAAA,IACF;AAEA,WAAO,CAAC,GAAG,oBAAoB,GAAG,mBAAmB;AAAA,EACvD,SAAS,OAAO;AACd,cAAU,GAAG,eAAC,yCAAyC,EAAE,OAAO,QAAQ,CAAC;AACzE,WAAO,CAAC;AAAA,EACV;AACF;","names":["remoteDictionariesRecord"]}
|
|
@@ -32,7 +32,7 @@ const runOnce = async (sentinelFilePath, callback, onIsCached, cacheTimeoutMs =
|
|
|
32
32
|
if (sentinelAge > timeoutDuration) {
|
|
33
33
|
await (0, import_promises.unlink)(sentinelFilePath);
|
|
34
34
|
} else {
|
|
35
|
-
await onIsCached();
|
|
35
|
+
await onIsCached?.();
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
} catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/runOnce.ts"],"sourcesContent":["import { mkdir, stat, unlink, writeFile } from 'fs/promises';\nimport { dirname } from 'path';\n\n/**\n * Ensures a callback function runs only once within a specified time window across multiple processes.\n * Uses a sentinel file to coordinate execution and prevent duplicate work.\n *\n * @param sentinelFilePath - Path to the sentinel file used for coordination\n * @param callback - The function to execute (should be async)\n * @param cacheTimeoutMs - Time window in milliseconds during which the sentinel is considered valid (default: 60000ms = 1 minute)\n *\n * @example\n * ```typescript\n * await runPrepareIntlayerOnce(\n * '/tmp/intlayer-sentinel',\n * async () => {\n * // Your initialization logic here\n * await prepareIntlayer();\n * },\n * 30 * 1000 // 30 seconds cache\n * );\n * ```\n *\n * @throws {Error} When there are unexpected filesystem errors\n */\nexport const runOnce = async (\n sentinelFilePath: string,\n callback: () => void | Promise<void>,\n onIsCached?: () => void | Promise<void>,\n cacheTimeoutMs: number = 60 * 1000 // 1 minute in milliseconds\n) => {\n const currentTimestamp = Date.now();\n const timeoutDuration = cacheTimeoutMs;\n\n try {\n // Check if sentinel file exists and get its stats\n const sentinelStats = await stat(sentinelFilePath);\n const sentinelAge = currentTimestamp - sentinelStats.mtime.getTime();\n\n // If sentinel is older than the timeout, delete it and rebuild\n if (sentinelAge > timeoutDuration) {\n await unlink(sentinelFilePath);\n // Fall through to create new sentinel and rebuild\n } else {\n await onIsCached();\n // Sentinel is recent, no need to rebuild\n return;\n }\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n // File doesn't exist, continue to create it\n } else {\n throw err; // unexpected FS error\n }\n }\n\n try {\n // Ensure the directory exists before writing the file\n await mkdir(dirname(sentinelFilePath), { recursive: true });\n\n // O_EXCL ensures only the *first* process can create the file\n await writeFile(sentinelFilePath, String(currentTimestamp), { flag: 'wx' });\n } catch (err: any) {\n if (err.code === 'EEXIST') {\n // Another process already created it → we're done\n return;\n }\n throw err; // unexpected FS error\n }\n\n await callback();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA+C;AAC/C,kBAAwB;AAwBjB,MAAM,UAAU,OACrB,kBACA,UACA,YACA,iBAAyB,KAAK,QAC3B;AACH,QAAM,mBAAmB,KAAK,IAAI;AAClC,QAAM,kBAAkB;AAExB,MAAI;AAEF,UAAM,gBAAgB,UAAM,sBAAK,gBAAgB;AACjD,UAAM,cAAc,mBAAmB,cAAc,MAAM,QAAQ;AAGnE,QAAI,cAAc,iBAAiB;AACjC,gBAAM,wBAAO,gBAAgB;AAAA,IAE/B,OAAO;AACL,YAAM,
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/runOnce.ts"],"sourcesContent":["import { mkdir, stat, unlink, writeFile } from 'fs/promises';\nimport { dirname } from 'path';\n\n/**\n * Ensures a callback function runs only once within a specified time window across multiple processes.\n * Uses a sentinel file to coordinate execution and prevent duplicate work.\n *\n * @param sentinelFilePath - Path to the sentinel file used for coordination\n * @param callback - The function to execute (should be async)\n * @param cacheTimeoutMs - Time window in milliseconds during which the sentinel is considered valid (default: 60000ms = 1 minute)\n *\n * @example\n * ```typescript\n * await runPrepareIntlayerOnce(\n * '/tmp/intlayer-sentinel',\n * async () => {\n * // Your initialization logic here\n * await prepareIntlayer();\n * },\n * 30 * 1000 // 30 seconds cache\n * );\n * ```\n *\n * @throws {Error} When there are unexpected filesystem errors\n */\nexport const runOnce = async (\n sentinelFilePath: string,\n callback: () => void | Promise<void>,\n onIsCached?: () => void | Promise<void>,\n cacheTimeoutMs: number = 60 * 1000 // 1 minute in milliseconds\n) => {\n const currentTimestamp = Date.now();\n const timeoutDuration = cacheTimeoutMs;\n\n try {\n // Check if sentinel file exists and get its stats\n const sentinelStats = await stat(sentinelFilePath);\n const sentinelAge = currentTimestamp - sentinelStats.mtime.getTime();\n\n // If sentinel is older than the timeout, delete it and rebuild\n if (sentinelAge > timeoutDuration) {\n await unlink(sentinelFilePath);\n // Fall through to create new sentinel and rebuild\n } else {\n await onIsCached?.();\n // Sentinel is recent, no need to rebuild\n return;\n }\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n // File doesn't exist, continue to create it\n } else {\n throw err; // unexpected FS error\n }\n }\n\n try {\n // Ensure the directory exists before writing the file\n await mkdir(dirname(sentinelFilePath), { recursive: true });\n\n // O_EXCL ensures only the *first* process can create the file\n await writeFile(sentinelFilePath, String(currentTimestamp), { flag: 'wx' });\n } catch (err: any) {\n if (err.code === 'EEXIST') {\n // Another process already created it → we're done\n return;\n }\n throw err; // unexpected FS error\n }\n\n await callback();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA+C;AAC/C,kBAAwB;AAwBjB,MAAM,UAAU,OACrB,kBACA,UACA,YACA,iBAAyB,KAAK,QAC3B;AACH,QAAM,mBAAmB,KAAK,IAAI;AAClC,QAAM,kBAAkB;AAExB,MAAI;AAEF,UAAM,gBAAgB,UAAM,sBAAK,gBAAgB;AACjD,UAAM,cAAc,mBAAmB,cAAc,MAAM,QAAQ;AAGnE,QAAI,cAAc,iBAAiB;AACjC,gBAAM,wBAAO,gBAAgB;AAAA,IAE/B,OAAO;AACL,YAAM,aAAa;AAEnB;AAAA,IACF;AAAA,EACF,SAAS,KAAU;AACjB,QAAI,IAAI,SAAS,UAAU;AAAA,IAE3B,OAAO;AACL,YAAM;AAAA,IACR;AAAA,EACF;AAEA,MAAI;AAEF,cAAM,2BAAM,qBAAQ,gBAAgB,GAAG,EAAE,WAAW,KAAK,CAAC;AAG1D,cAAM,2BAAU,kBAAkB,OAAO,gBAAgB,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,EAC5E,SAAS,KAAU;AACjB,QAAI,IAAI,SAAS,UAAU;AAEzB;AAAA,IACF;AACA,UAAM;AAAA,EACR;AAEA,QAAM,SAAS;AACjB;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/writeContentDeclaration/dictionaryStatus.ts"],"sourcesContent":["export type DictionaryStatus =\n | 'pending'\n | 'fetching'\n | 'up-to-date'\n | 'replaced'\n | 'updated'\n | 'fetched'\n | 'unknown'\n | 'error'\n | 'imported'\n | 'reimported in JSON'\n | '
|
|
1
|
+
{"version":3,"sources":["../../../src/writeContentDeclaration/dictionaryStatus.ts"],"sourcesContent":["export type DictionaryStatus =\n | 'pending'\n | 'fetching'\n | 'up-to-date'\n | 'replaced'\n | 'updated'\n | 'fetched'\n | 'unknown'\n | 'error'\n | 'imported'\n | 'reimported in JSON'\n | 'new content file';\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -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 dictionariesRecord from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { existsSync } from 'fs';\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 existingDictionary = (\n dictionariesRecord[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: '
|
|
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 dictionariesRecord from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { existsSync } from 'fs';\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 existingDictionary = (\n dictionariesRecord[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 // Check if the directory exists\n const directoryExists = existsSync(dir);\n\n if (!directoryExists) {\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n }\n\n const extention = extname(filePath);\n const acceptedExtensions = configuration.content.fileExtensions.map(\n (extention) => extname(extention)\n );\n\n if (!acceptedExtensions.includes(extention)) {\n throw new Error(\n `Invalid file extension: ${extention}, file: ${filePath}`\n );\n }\n\n if (extention === '.json') {\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await writeFile(filePath, jsonDictionary);\n } else {\n await writeJSFile(filePath, data as unknown as Dictionary);\n }\n } catch (error) {\n console.error(data);\n\n throw new Error(\n `${x} Error writing file to ${colorizePath(filePath)}: ${error}`\n );\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAC1B,oBAAqD;AAErD,yCAA+B;AAC/B,wBAAsB;AACtB,gBAA2B;AAC3B,sBAAiC;AACjC,kBAAiC;AACjC,uCAA0C;AAE1C,yBAA4B;AAE5B,MAAM,8BAA8B;AAEpC,MAAM,2BAA2B,OAAO,eAA2B;AAEjE,QAAM,6BACJ,UAAM,4DAA0B,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,aAAAA,SACzB,wBACwD;AACxD,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,QAAQ,IAAI;AAEpB,QAAM,oCACJ,uBAAuB;AACzB,QAAM,4BAA4B,GAAG,OAAO,IAAI,iCAAiC;AAEjF,QAAM,qBACJ,mCAAAC,QAAmB,WAAW,GAAG,EACjC,OAAO,CAAC,OAAO,GAAG,aAAa,WAAW,QAAQ;AAEpD,QAAM,WAAW,WAAW;AAC5B,QAAM,8BACJ,MAAM,yBAAyB,UAAU;AAE3C,MAAI,oBAAoB;AAEtB,YAAI,kBAAAC,SAAU,oBAAoB,UAAU,GAAG;AAE7C,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,IACF,OAAO;AACL,UAAI,UAAU;AACZ,cAAM,yBAAyB,UAAU,2BAA2B;AAEpE,eA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","dictionariesRecord","deepEqual","extention"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getIntlayerAPIProxy } from "@intlayer/api";
|
|
2
2
|
import { getConfiguration } from "@intlayer/config";
|
|
3
3
|
const fetchDistantDictionaryKeysAndUpdateTimestamp = async (configuration = getConfiguration()) => {
|
|
4
4
|
const { clientId, clientSecret } = configuration.editor;
|
|
@@ -7,16 +7,8 @@ const fetchDistantDictionaryKeysAndUpdateTimestamp = async (configuration = getC
|
|
|
7
7
|
"Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project."
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
|
-
const intlayerAPI =
|
|
11
|
-
const
|
|
12
|
-
const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
|
|
13
|
-
const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesUpdateTimestamp({
|
|
14
|
-
...oAuth2AccessToken && {
|
|
15
|
-
headers: {
|
|
16
|
-
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
10
|
+
const intlayerAPI = getIntlayerAPIProxy(void 0, configuration);
|
|
11
|
+
const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();
|
|
20
12
|
if (!getDictionariesKeysResult.data) {
|
|
21
13
|
throw new Error("No distant dictionaries found");
|
|
22
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeysAndUpdateTimestamp = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<Record<string, number>> => {\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 = getIntlayerAPIProxy(undefined, configuration);\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesUpdateTimeStamp: Record<string, number> =\n getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesUpdateTimeStamp;\n};\n"],"mappings":"AAAA,SAAS,2BAA2B;AACpC,SAAS,wBAA6C;AAE/C,MAAM,+CAA+C,OAC1D,gBAAgC,iBAAiB,MACb;AACpC,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,oBAAoB,QAAW,aAAa;AAGhE,QAAM,4BACJ,MAAM,YAAY,WAAW,+BAA+B;AAE9D,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,qCACJ,0BAA0B;AAG5B,SAAO;AACT;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -33,6 +33,7 @@ import { createModuleAugmentation } from "./transpiler/dictionary_to_type/create
|
|
|
33
33
|
import { formatLocale, formatPath } from "./utils/formatter.mjs";
|
|
34
34
|
import { getFileHash } from "./utils/getFileHash.mjs";
|
|
35
35
|
import { kebabCaseToCamelCase } from "./utils/kebabCaseToCamelCase.mjs";
|
|
36
|
+
import { parallelize } from "./utils/parallelize.mjs";
|
|
36
37
|
import { resolveObjectPromises } from "./utils/resolveObjectPromises.mjs";
|
|
37
38
|
import { runOnce } from "./utils/runOnce.mjs";
|
|
38
39
|
import { sortAlphabetically } from "./utils/sortAlphabetically.mjs";
|
|
@@ -63,6 +64,7 @@ export {
|
|
|
63
64
|
loadLocalDictionaries,
|
|
64
65
|
loadRemoteDictionaries,
|
|
65
66
|
mergeDictionaries,
|
|
67
|
+
parallelize,
|
|
66
68
|
prepareContentDeclaration,
|
|
67
69
|
prepareIntlayer,
|
|
68
70
|
processPerLocaleDictionary,
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeysAndUpdateTimestamp } from './fetchDistantDictionaryKeysAndUpdateTimestamp';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\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 loadLocalDictionaries,\n loadRemoteDictionaries,\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 { formatLocale, formatPath } from './utils/formatter';\nexport { getFileHash } from './utils/getFileHash';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,SAAS,oDAAoD;AAC7D,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,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,cAAc,kBAAkB;AACzC,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,OAEK;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeysAndUpdateTimestamp } from './fetchDistantDictionaryKeysAndUpdateTimestamp';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\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 loadLocalDictionaries,\n loadRemoteDictionaries,\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 { formatLocale, formatPath } from './utils/formatter';\nexport { getFileHash } from './utils/getFileHash';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { parallelize } from './utils/parallelize';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,SAAS,oDAAoD;AAC7D,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,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,cAAc,kBAAkB;AACzC,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,OAEK;","names":[]}
|
|
@@ -17,14 +17,21 @@ const loadRemoteDictionaries = async (configuration = getConfiguration(), onStat
|
|
|
17
17
|
const distantDictionaryUpdateTimeStamp = await fetchDistantDictionaryKeysAndUpdateTimestamp(configuration);
|
|
18
18
|
const dictionariesKeysToFetch = Object.entries(
|
|
19
19
|
distantDictionaryUpdateTimeStamp
|
|
20
|
-
).filter(([dictionaryKey,
|
|
21
|
-
if (!
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
).filter(([dictionaryKey, remoteUpdatedAt]) => {
|
|
21
|
+
if (!remoteUpdatedAt) return true;
|
|
22
|
+
const local = remoteDictionariesRecord[dictionaryKey];
|
|
23
|
+
if (!local) return true;
|
|
24
|
+
const localUpdatedAtRaw = local?.updatedAt;
|
|
25
|
+
const localUpdatedAt = typeof localUpdatedAtRaw === "number" ? localUpdatedAtRaw : localUpdatedAtRaw ? new Date(localUpdatedAtRaw).getTime() : void 0;
|
|
26
|
+
if (typeof localUpdatedAt !== "number") return true;
|
|
27
|
+
return remoteUpdatedAt > localUpdatedAt;
|
|
24
28
|
}).map(([dictionaryKey]) => dictionaryKey);
|
|
25
|
-
const cachedDictionaries = Object.
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const cachedDictionaries = Object.entries(remoteDictionariesRecord).filter(([key, dictionary]) => {
|
|
30
|
+
const remoteUpdatedAt = distantDictionaryUpdateTimeStamp[key];
|
|
31
|
+
const localUpdatedAtRaw = dictionary?.updatedAt;
|
|
32
|
+
const localUpdatedAt = typeof localUpdatedAtRaw === "number" ? localUpdatedAtRaw : localUpdatedAtRaw ? new Date(localUpdatedAtRaw).getTime() : void 0;
|
|
33
|
+
return typeof localUpdatedAt === "number" && typeof remoteUpdatedAt === "number" && localUpdatedAt >= remoteUpdatedAt;
|
|
34
|
+
}).map(([, dictionary]) => dictionary);
|
|
28
35
|
if (cachedDictionaries.length > 0) {
|
|
29
36
|
onStatusUpdate?.(
|
|
30
37
|
cachedDictionaries.map((d) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration, x } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport remoteDictionariesRecord from '@intlayer/remote-dictionaries-entry';\nimport { fetchDistantDictionaries } from '../fetchDistantDictionaries';\nimport { fetchDistantDictionaryKeysAndUpdateTimestamp } from '../fetchDistantDictionaryKeysAndUpdateTimestamp';\nimport { DictionariesStatus } from '../loadDictionaries/loadDictionaries';\nimport { sortAlphabetically } from '../utils/sortAlphabetically';\n\nexport const formatDistantDictionaries = (\n dictionaries: DictionaryAPI[]\n): Dictionary[] =>\n dictionaries.map((dict) => ({\n ...dict,\n localId: `${dict.key}::remote::${dict.id}`,\n location: 'distant' as const,\n }));\n\nexport const loadRemoteDictionaries = async (\n configuration = getConfiguration(),\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const appLogger = getAppLogger(configuration);\n const { editor } = configuration;\n\n const hasRemoteDictionaries = Boolean(editor.clientId && editor.clientSecret);\n\n if (!hasRemoteDictionaries) return [];\n\n try {\n const distantDictionaryUpdateTimeStamp: Record<string, number> =\n await fetchDistantDictionaryKeysAndUpdateTimestamp(configuration);\n\n const dictionariesKeysToFetch = Object.entries(\n distantDictionaryUpdateTimeStamp\n )\n .filter(([dictionaryKey,
|
|
1
|
+
{"version":3,"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration, x } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport remoteDictionariesRecord from '@intlayer/remote-dictionaries-entry';\nimport { fetchDistantDictionaries } from '../fetchDistantDictionaries';\nimport { fetchDistantDictionaryKeysAndUpdateTimestamp } from '../fetchDistantDictionaryKeysAndUpdateTimestamp';\nimport { DictionariesStatus } from '../loadDictionaries/loadDictionaries';\nimport { sortAlphabetically } from '../utils/sortAlphabetically';\n\nexport const formatDistantDictionaries = (\n dictionaries: DictionaryAPI[]\n): Dictionary[] =>\n dictionaries.map((dict) => ({\n ...dict,\n localId: `${dict.key}::remote::${dict.id}`,\n location: 'distant' as const,\n }));\n\nexport const loadRemoteDictionaries = async (\n configuration = getConfiguration(),\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const appLogger = getAppLogger(configuration);\n const { editor } = configuration;\n\n const hasRemoteDictionaries = Boolean(editor.clientId && editor.clientSecret);\n\n if (!hasRemoteDictionaries) return [];\n\n try {\n const distantDictionaryUpdateTimeStamp: Record<string, number> =\n await fetchDistantDictionaryKeysAndUpdateTimestamp(configuration);\n\n const dictionariesKeysToFetch = Object.entries(\n distantDictionaryUpdateTimeStamp\n )\n .filter(([dictionaryKey, remoteUpdatedAt]) => {\n // If remote doesn't provide updatedAt, fetch to be safe\n if (!remoteUpdatedAt) return true;\n\n // If no local cache exists, fetch\n const local = (remoteDictionariesRecord as any)[dictionaryKey];\n if (!local) return true;\n\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n\n // If local timestamp missing or older than remote, fetch\n if (typeof localUpdatedAt !== 'number') return true;\n return remoteUpdatedAt > localUpdatedAt;\n })\n .map(([dictionaryKey]) => dictionaryKey);\n\n const cachedDictionaries = Object.entries(remoteDictionariesRecord)\n .filter(([key, dictionary]) => {\n const remoteUpdatedAt = distantDictionaryUpdateTimeStamp[key];\n const localUpdatedAtRaw = (dictionary as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n // Consider as cached/imported when local exists and is up-to-date or newer\n return (\n typeof localUpdatedAt === 'number' &&\n typeof remoteUpdatedAt === 'number' &&\n localUpdatedAt >= remoteUpdatedAt\n );\n })\n .map(([, dictionary]) => dictionary as any);\n\n // Report cached as already imported\n if (cachedDictionaries.length > 0) {\n onStatusUpdate?.(\n cachedDictionaries.map((d) => ({\n dictionaryKey: d.key,\n type: 'remote',\n status: 'imported',\n }))\n );\n }\n\n const orderedDistantDictionaryKeys =\n dictionariesKeysToFetch.sort(sortAlphabetically);\n\n // Report pending for keys to be fetched so totals are visible immediately\n if (orderedDistantDictionaryKeys.length > 0) {\n onStatusUpdate?.(\n orderedDistantDictionaryKeys.map((key) => ({\n dictionaryKey: key,\n type: 'remote',\n status: 'pending',\n }))\n );\n }\n\n const distantDictionariesData = await fetchDistantDictionaries(\n {\n dictionaryKeys: orderedDistantDictionaryKeys,\n },\n onStatusUpdate\n );\n\n const distantDictionaries: DictionaryAPI[] = formatDistantDictionaries(\n distantDictionariesData\n );\n\n return [...cachedDictionaries, ...distantDictionaries];\n } catch (error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":"AAEA,SAAS,cAAc,kBAAkB,SAAS;AAElD,OAAO,8BAA8B;AACrC,SAAS,gCAAgC;AACzC,SAAS,oDAAoD;AAE7D,SAAS,0BAA0B;AAE5B,MAAM,4BAA4B,CACvC,iBAEA,aAAa,IAAI,CAAC,UAAU;AAAA,EAC1B,GAAG;AAAA,EACH,SAAS,GAAG,KAAK,GAAG,aAAa,KAAK,EAAE;AAAA,EACxC,UAAU;AACZ,EAAE;AAEG,MAAM,yBA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EA,UAAM,+BACJ,wBAAwB,KAAK,kBAAkB;AAGjD,QAAI,6BAA6B,SAAS,GAAG;AAC3C;AAAA,QACE,6BAA6B,IAAI,CAAC,SAAS;AAAA,UACzC,eAAe;AAAA,UACf,MAAM;AAAA,UACN,QAAQ;AAAA,QACV,EAAE;AAAA,MACJ;AAAA,IACF;AAEA,UAAM,0BAA0B,MAAM;AAAA,MACpC;AAAA,QACE,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,IACF;AAEA,UAAM,sBAAuC;AAAA,MAC3C;AAAA,IACF;AAEA,WAAO,CAAC,GAAG,oBAAoB,GAAG,mBAAmB;AAAA,EACvD,SAAS,OAAO;AACd,cAAU,GAAG,CAAC,yCAAyC,EAAE,OAAO,QAAQ,CAAC;AACzE,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/runOnce.ts"],"sourcesContent":["import { mkdir, stat, unlink, writeFile } from 'fs/promises';\nimport { dirname } from 'path';\n\n/**\n * Ensures a callback function runs only once within a specified time window across multiple processes.\n * Uses a sentinel file to coordinate execution and prevent duplicate work.\n *\n * @param sentinelFilePath - Path to the sentinel file used for coordination\n * @param callback - The function to execute (should be async)\n * @param cacheTimeoutMs - Time window in milliseconds during which the sentinel is considered valid (default: 60000ms = 1 minute)\n *\n * @example\n * ```typescript\n * await runPrepareIntlayerOnce(\n * '/tmp/intlayer-sentinel',\n * async () => {\n * // Your initialization logic here\n * await prepareIntlayer();\n * },\n * 30 * 1000 // 30 seconds cache\n * );\n * ```\n *\n * @throws {Error} When there are unexpected filesystem errors\n */\nexport const runOnce = async (\n sentinelFilePath: string,\n callback: () => void | Promise<void>,\n onIsCached?: () => void | Promise<void>,\n cacheTimeoutMs: number = 60 * 1000 // 1 minute in milliseconds\n) => {\n const currentTimestamp = Date.now();\n const timeoutDuration = cacheTimeoutMs;\n\n try {\n // Check if sentinel file exists and get its stats\n const sentinelStats = await stat(sentinelFilePath);\n const sentinelAge = currentTimestamp - sentinelStats.mtime.getTime();\n\n // If sentinel is older than the timeout, delete it and rebuild\n if (sentinelAge > timeoutDuration) {\n await unlink(sentinelFilePath);\n // Fall through to create new sentinel and rebuild\n } else {\n await onIsCached();\n // Sentinel is recent, no need to rebuild\n return;\n }\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n // File doesn't exist, continue to create it\n } else {\n throw err; // unexpected FS error\n }\n }\n\n try {\n // Ensure the directory exists before writing the file\n await mkdir(dirname(sentinelFilePath), { recursive: true });\n\n // O_EXCL ensures only the *first* process can create the file\n await writeFile(sentinelFilePath, String(currentTimestamp), { flag: 'wx' });\n } catch (err: any) {\n if (err.code === 'EEXIST') {\n // Another process already created it → we're done\n return;\n }\n throw err; // unexpected FS error\n }\n\n await callback();\n};\n"],"mappings":"AAAA,SAAS,OAAO,MAAM,QAAQ,iBAAiB;AAC/C,SAAS,eAAe;AAwBjB,MAAM,UAAU,OACrB,kBACA,UACA,YACA,iBAAyB,KAAK,QAC3B;AACH,QAAM,mBAAmB,KAAK,IAAI;AAClC,QAAM,kBAAkB;AAExB,MAAI;AAEF,UAAM,gBAAgB,MAAM,KAAK,gBAAgB;AACjD,UAAM,cAAc,mBAAmB,cAAc,MAAM,QAAQ;AAGnE,QAAI,cAAc,iBAAiB;AACjC,YAAM,OAAO,gBAAgB;AAAA,IAE/B,OAAO;AACL,YAAM,
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/runOnce.ts"],"sourcesContent":["import { mkdir, stat, unlink, writeFile } from 'fs/promises';\nimport { dirname } from 'path';\n\n/**\n * Ensures a callback function runs only once within a specified time window across multiple processes.\n * Uses a sentinel file to coordinate execution and prevent duplicate work.\n *\n * @param sentinelFilePath - Path to the sentinel file used for coordination\n * @param callback - The function to execute (should be async)\n * @param cacheTimeoutMs - Time window in milliseconds during which the sentinel is considered valid (default: 60000ms = 1 minute)\n *\n * @example\n * ```typescript\n * await runPrepareIntlayerOnce(\n * '/tmp/intlayer-sentinel',\n * async () => {\n * // Your initialization logic here\n * await prepareIntlayer();\n * },\n * 30 * 1000 // 30 seconds cache\n * );\n * ```\n *\n * @throws {Error} When there are unexpected filesystem errors\n */\nexport const runOnce = async (\n sentinelFilePath: string,\n callback: () => void | Promise<void>,\n onIsCached?: () => void | Promise<void>,\n cacheTimeoutMs: number = 60 * 1000 // 1 minute in milliseconds\n) => {\n const currentTimestamp = Date.now();\n const timeoutDuration = cacheTimeoutMs;\n\n try {\n // Check if sentinel file exists and get its stats\n const sentinelStats = await stat(sentinelFilePath);\n const sentinelAge = currentTimestamp - sentinelStats.mtime.getTime();\n\n // If sentinel is older than the timeout, delete it and rebuild\n if (sentinelAge > timeoutDuration) {\n await unlink(sentinelFilePath);\n // Fall through to create new sentinel and rebuild\n } else {\n await onIsCached?.();\n // Sentinel is recent, no need to rebuild\n return;\n }\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n // File doesn't exist, continue to create it\n } else {\n throw err; // unexpected FS error\n }\n }\n\n try {\n // Ensure the directory exists before writing the file\n await mkdir(dirname(sentinelFilePath), { recursive: true });\n\n // O_EXCL ensures only the *first* process can create the file\n await writeFile(sentinelFilePath, String(currentTimestamp), { flag: 'wx' });\n } catch (err: any) {\n if (err.code === 'EEXIST') {\n // Another process already created it → we're done\n return;\n }\n throw err; // unexpected FS error\n }\n\n await callback();\n};\n"],"mappings":"AAAA,SAAS,OAAO,MAAM,QAAQ,iBAAiB;AAC/C,SAAS,eAAe;AAwBjB,MAAM,UAAU,OACrB,kBACA,UACA,YACA,iBAAyB,KAAK,QAC3B;AACH,QAAM,mBAAmB,KAAK,IAAI;AAClC,QAAM,kBAAkB;AAExB,MAAI;AAEF,UAAM,gBAAgB,MAAM,KAAK,gBAAgB;AACjD,UAAM,cAAc,mBAAmB,cAAc,MAAM,QAAQ;AAGnE,QAAI,cAAc,iBAAiB;AACjC,YAAM,OAAO,gBAAgB;AAAA,IAE/B,OAAO;AACL,YAAM,aAAa;AAEnB;AAAA,IACF;AAAA,EACF,SAAS,KAAU;AACjB,QAAI,IAAI,SAAS,UAAU;AAAA,IAE3B,OAAO;AACL,YAAM;AAAA,IACR;AAAA,EACF;AAEA,MAAI;AAEF,UAAM,MAAM,QAAQ,gBAAgB,GAAG,EAAE,WAAW,KAAK,CAAC;AAG1D,UAAM,UAAU,kBAAkB,OAAO,gBAAgB,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,EAC5E,SAAS,KAAU;AACjB,QAAI,IAAI,SAAS,UAAU;AAEzB;AAAA,IACF;AACA,UAAM;AAAA,EACR;AAEA,QAAM,SAAS;AACjB;","names":[]}
|
|
@@ -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 dictionariesRecord from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { existsSync } from 'fs';\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 existingDictionary = (\n dictionariesRecord[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: '
|
|
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 dictionariesRecord from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { existsSync } from 'fs';\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 existingDictionary = (\n dictionariesRecord[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 // Check if the directory exists\n const directoryExists = existsSync(dir);\n\n if (!directoryExists) {\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n }\n\n const extention = extname(filePath);\n const acceptedExtensions = configuration.content.fileExtensions.map(\n (extention) => extname(extention)\n );\n\n if (!acceptedExtensions.includes(extention)) {\n throw new Error(\n `Invalid file extension: ${extention}, file: ${filePath}`\n );\n }\n\n if (extention === '.json') {\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await writeFile(filePath, jsonDictionary);\n } else {\n await writeJSFile(filePath, data as unknown as Dictionary);\n }\n } catch (error) {\n console.error(data);\n\n throw new Error(\n `${x} Error writing file to ${colorizePath(filePath)}: ${error}`\n );\n }\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAC1B,SAAS,cAAc,SAA8B;AAErD,OAAO,wBAAwB;AAC/B,OAAO,eAAe;AACtB,SAAS,kBAAkB;AAC3B,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,qBACJ,mBAAmB,WAAW,GAAG,EACjC,OAAO,CAAC,OAAO,GAAG,aAAa,WAAW,QAAQ;AAEpD,QAAM,WAAW,WAAW;AAC5B,QAAM,8BACJ,MAAM,yBAAyB,UAAU;AAE3C,MAAI,oBAAoB;AAEtB,QAAI,UAAU,oBAAoB,UAAU,GAAG;AAE7C,aAAO;AAAA,QACL,QAAQ;AAAA,QACR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AA0B,aAAa,QAAQ,CAAC,KAAK,KAAK;AAAA,IAChE;AAAA,EACF;AACF;","names":["extention"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,4CAA4C,GACvD,gBAAe,cAAmC,KACjD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,4CAA4C,GACvD,gBAAe,cAAmC,KACjD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAwBhC,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { createModuleAugmentation } from './transpiler/dictionary_to_type/create
|
|
|
18
18
|
export { formatLocale, formatPath } from './utils/formatter';
|
|
19
19
|
export { getFileHash } from './utils/getFileHash';
|
|
20
20
|
export { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';
|
|
21
|
+
export { parallelize } from './utils/parallelize';
|
|
21
22
|
export { resolveObjectPromises } from './utils/resolveObjectPromises';
|
|
22
23
|
export { runOnce } from './utils/runOnce';
|
|
23
24
|
export { sortAlphabetically } from './utils/sortAlphabetically';
|
|
@@ -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,GAC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,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadRemoteDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD,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,KACtD,OAAO,CAAC,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"loadRemoteDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD,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,KACtD,OAAO,CAAC,aAAa,EAAE,CAuGzB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type DictionaryStatus = 'pending' | 'fetching' | 'up-to-date' | 'replaced' | 'updated' | 'fetched' | 'unknown' | 'error' | 'imported' | 'reimported in JSON' | '
|
|
1
|
+
export type DictionaryStatus = 'pending' | 'fetching' | 'up-to-date' | 'replaced' | 'updated' | 'fetched' | 'unknown' | 'error' | 'imported' | 'reimported in JSON' | 'new content file';
|
|
2
2
|
//# sourceMappingURL=dictionaryStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionaryStatus.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/dictionaryStatus.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,UAAU,GACV,YAAY,GACZ,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,UAAU,GACV,oBAAoB,GACpB,
|
|
1
|
+
{"version":3,"file":"dictionaryStatus.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/dictionaryStatus.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,UAAU,GACV,YAAY,GACZ,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,UAAU,GACV,oBAAoB,GACpB,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/chokidar",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.1",
|
|
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/config": "6.0.0-canary.
|
|
73
|
-
"@intlayer/
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"@intlayer/core": "6.0.0-canary.
|
|
76
|
-
"@intlayer/
|
|
71
|
+
"@intlayer/api": "6.0.0-canary.1",
|
|
72
|
+
"@intlayer/config": "6.0.0-canary.1",
|
|
73
|
+
"@intlayer/dictionaries-entry": "6.0.0-canary.1",
|
|
74
|
+
"@intlayer/unmerged-dictionaries-entry": "6.0.0-canary.1",
|
|
75
|
+
"@intlayer/core": "6.0.0-canary.1",
|
|
76
|
+
"@intlayer/remote-dictionaries-entry": "6.0.0-canary.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@changesets/cli": "2.29.5",
|
|
@@ -93,19 +93,19 @@
|
|
|
93
93
|
"vitest": "^3.2.4",
|
|
94
94
|
"@utils/eslint-config": "1.0.4",
|
|
95
95
|
"@utils/ts-config": "1.0.4",
|
|
96
|
-
"@utils/
|
|
97
|
-
"@utils/
|
|
96
|
+
"@utils/tsup-config": "1.0.4",
|
|
97
|
+
"@utils/ts-config-types": "1.0.4"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"fast-glob": "^3.3.3",
|
|
101
101
|
"react": ">=16.0.0",
|
|
102
|
-
"@intlayer/api": "6.0.0-canary.
|
|
103
|
-
"@intlayer/core": "6.0.0-canary.
|
|
104
|
-
"
|
|
105
|
-
"@intlayer/
|
|
106
|
-
"@intlayer/dictionaries-entry": "6.0.0-canary.
|
|
107
|
-
"@intlayer/unmerged-dictionaries-entry": "6.0.0-canary.
|
|
108
|
-
"intlayer": "6.0.0-canary.
|
|
102
|
+
"@intlayer/api": "6.0.0-canary.1",
|
|
103
|
+
"@intlayer/core": "6.0.0-canary.1",
|
|
104
|
+
"intlayer": "6.0.0-canary.1",
|
|
105
|
+
"@intlayer/config": "6.0.0-canary.1",
|
|
106
|
+
"@intlayer/dictionaries-entry": "6.0.0-canary.1",
|
|
107
|
+
"@intlayer/unmerged-dictionaries-entry": "6.0.0-canary.1",
|
|
108
|
+
"@intlayer/remote-dictionaries-entry": "6.0.0-canary.1"
|
|
109
109
|
},
|
|
110
110
|
"engines": {
|
|
111
111
|
"node": ">=14.18"
|