intlayer-editor 7.1.2 → 7.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,14 +2,13 @@ const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_ru
2
2
  const require_getFormatFromExtension = require('../utils/getFormatFromExtension.cjs');
3
3
  const require_writeJSFile = require('./writeJSFile.cjs');
4
4
  const require_processContentDeclarationContent = require('./processContentDeclarationContent.cjs');
5
- const require_index = require('../../../../../../node_modules/.bun/deep-equal@2.2.3/node_modules/deep-equal/index.cjs');
6
5
  let node_fs_promises = require("node:fs/promises");
7
6
  let node_path = require("node:path");
8
7
  let __intlayer_core = require("@intlayer/core");
9
8
  let __intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
9
+ let node_util = require("node:util");
10
10
 
11
11
  //#region ../@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs
12
- var import_deep_equal = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_index.default, 1);
13
12
  const formatContentDeclaration = async (dictionary, configuration, localeList) => {
14
13
  /**
15
14
  * Clean Markdown, Insertion, File, etc. node metadata
@@ -68,7 +67,7 @@ const writeContentDeclaration = async (dictionary, configuration, options) => {
68
67
  const existingDictionary = (0, __intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(configuration)[dictionary.key]?.find((el) => el.localId === dictionary.localId);
69
68
  const formattedContentDeclaration = await formatContentDeclaration(dictionary, configuration, localeList);
70
69
  if (existingDictionary?.filePath) {
71
- const isSameContent = (0, import_deep_equal.default)(existingDictionary, dictionary);
70
+ const isSameContent = (0, node_util.isDeepStrictEqual)(existingDictionary, dictionary);
72
71
  const filePath = (0, node_path.resolve)(configuration.content.baseDir, existingDictionary.filePath);
73
72
  if (isSameContent) return {
74
73
  status: "up-to-date",
@@ -1 +1 @@
1
- {"version":3,"file":"writeContentDeclaration.cjs","names":["processContentDeclarationContent","getFormatFromExtension","writeJSFile"],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs"],"sourcesContent":["import { getFormatFromExtension } from \"../utils/getFormatFromExtension.mjs\";\nimport { processContentDeclarationContent } from \"./processContentDeclarationContent.mjs\";\nimport { writeJSFile } from \"./writeJSFile.mjs\";\nimport { mkdir, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, extname, join, resolve } from \"node:path\";\nimport { getFilteredLocalesDictionary, getPerLocaleDictionary } from \"@intlayer/core\";\nimport { getUnmergedDictionaries } from \"@intlayer/unmerged-dictionaries-entry\";\nimport deepEqual from \"deep-equal\";\n\n//#region src/writeContentDeclaration/writeContentDeclaration.ts\nconst formatContentDeclaration = async (dictionary, configuration, localeList) => {\n\t/**\n\t* Clean Markdown, Insertion, File, etc. node metadata\n\t*/\n\tconst processedDictionary = await processContentDeclarationContent(dictionary);\n\tlet content = processedDictionary.content;\n\t/**\n\t* Filter locales content\n\t*/\n\tif (dictionary.locale) content = getPerLocaleDictionary(processedDictionary, dictionary.locale).content;\n\telse if (localeList) content = getFilteredLocalesDictionary(processedDictionary, localeList).content;\n\tlet pluginFormatResult = {\n\t\t...dictionary,\n\t\tcontent\n\t};\n\t/**\n\t* Format the dictionary with the plugins\n\t*/\n\tfor await (const plugin of configuration.plugins ?? []) if (plugin.formatOutput) {\n\t\tconst formattedResult = await plugin.formatOutput?.({\n\t\t\tdictionary: pluginFormatResult,\n\t\t\tconfiguration\n\t\t});\n\t\tif (formattedResult) pluginFormatResult = formattedResult;\n\t}\n\tif (!(pluginFormatResult.content && pluginFormatResult.key)) return pluginFormatResult;\n\tlet result = {\n\t\tkey: dictionary.key,\n\t\tid: dictionary.id,\n\t\ttitle: dictionary.title,\n\t\tdescription: dictionary.description,\n\t\ttags: dictionary.tags,\n\t\tlocale: dictionary.locale,\n\t\tfill: dictionary.fill,\n\t\tfilled: dictionary.filled,\n\t\tpriority: dictionary.priority,\n\t\tlive: dictionary.live,\n\t\tversion: dictionary.version,\n\t\tcontent\n\t};\n\tif (getFormatFromExtension(dictionary.filePath ? extname(dictionary.filePath) : \".json\") === \"json\" && pluginFormatResult.content && pluginFormatResult.key) result = {\n\t\t$schema: \"https://intlayer.org/schema.json\",\n\t\t...result\n\t};\n\treturn result;\n};\nconst defaultOptions = { newDictionariesPath: \"intlayer-dictionaries\" };\nconst writeContentDeclaration = async (dictionary, configuration, options) => {\n\tconst { content } = configuration;\n\tconst { baseDir } = content;\n\tconst { newDictionariesPath, localeList } = {\n\t\t...defaultOptions,\n\t\t...options\n\t};\n\tconst newDictionaryLocationPath = join(baseDir, newDictionariesPath);\n\tconst existingDictionary = getUnmergedDictionaries(configuration)[dictionary.key]?.find((el) => el.localId === dictionary.localId);\n\tconst formattedContentDeclaration = await formatContentDeclaration(dictionary, configuration, localeList);\n\tif (existingDictionary?.filePath) {\n\t\tconst isSameContent = deepEqual(existingDictionary, dictionary);\n\t\tconst filePath = resolve(configuration.content.baseDir, existingDictionary.filePath);\n\t\tif (isSameContent) return {\n\t\t\tstatus: \"up-to-date\",\n\t\t\tpath: filePath\n\t\t};\n\t\tawait writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);\n\t\treturn {\n\t\t\tstatus: \"updated\",\n\t\t\tpath: filePath\n\t\t};\n\t}\n\tif (dictionary.filePath) {\n\t\tconst filePath = resolve(configuration.content.baseDir, dictionary.filePath);\n\t\tawait writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);\n\t\treturn {\n\t\t\tstatus: \"created\",\n\t\t\tpath: filePath\n\t\t};\n\t}\n\tconst contentDeclarationPath = join(newDictionaryLocationPath, `${dictionary.key}.content.json`);\n\tawait writeFileWithDirectories(contentDeclarationPath, formattedContentDeclaration, configuration);\n\treturn {\n\t\tstatus: \"imported\",\n\t\tpath: contentDeclarationPath\n\t};\n};\nconst writeFileWithDirectories = async (absoluteFilePath, dictionary, configuration) => {\n\tawait mkdir(dirname(absoluteFilePath), { recursive: true });\n\tconst extension = extname(absoluteFilePath);\n\tif (!configuration.content.fileExtensions.map((extension$1) => extname(extension$1)).includes(extension)) throw new Error(`Invalid file extension: ${extension}, file: ${absoluteFilePath}`);\n\tif (extension === \".json\") {\n\t\tawait writeFile(absoluteFilePath, `${JSON.stringify(dictionary, null, 2)}\\n`);\n\t\treturn;\n\t}\n\tawait writeJSFile(absoluteFilePath, dictionary, configuration);\n\ttry {\n\t\tawait rm(join(configuration.content.cacheDir, \"intlayer-prepared.lock\"), { recursive: true });\n\t} catch (error) {\n\t\tif (error && typeof error === \"object\" && \"code\" in error && error.code !== \"ENOENT\") throw error;\n\t}\n};\n\n//#endregion\nexport { writeContentDeclaration };\n//# sourceMappingURL=writeContentDeclaration.mjs.map"],"mappings":";;;;;;;;;;;;AAUA,MAAM,2BAA2B,OAAO,YAAY,eAAe,eAAe;;;;CAIjF,MAAM,sBAAsB,MAAMA,0EAAiC,WAAW;CAC9E,IAAI,UAAU,oBAAoB;;;;AAIlC,KAAI,WAAW,OAAQ,uDAAiC,qBAAqB,WAAW,OAAO,CAAC;UACvF,WAAY,6DAAuC,qBAAqB,WAAW,CAAC;CAC7F,IAAI,qBAAqB;EACxB,GAAG;EACH;EACA;;;;AAID,YAAW,MAAM,UAAU,cAAc,WAAW,EAAE,CAAE,KAAI,OAAO,cAAc;EAChF,MAAM,kBAAkB,MAAM,OAAO,eAAe;GACnD,YAAY;GACZ;GACA,CAAC;AACF,MAAI,gBAAiB,sBAAqB;;AAE3C,KAAI,EAAE,mBAAmB,WAAW,mBAAmB,KAAM,QAAO;CACpE,IAAI,SAAS;EACZ,KAAK,WAAW;EAChB,IAAI,WAAW;EACf,OAAO,WAAW;EAClB,aAAa,WAAW;EACxB,MAAM,WAAW;EACjB,QAAQ,WAAW;EACnB,MAAM,WAAW;EACjB,QAAQ,WAAW;EACnB,UAAU,WAAW;EACrB,MAAM,WAAW;EACjB,SAAS,WAAW;EACpB;EACA;AACD,KAAIC,sDAAuB,WAAW,kCAAmB,WAAW,SAAS,GAAG,QAAQ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,MAAM,2BAA2B,UAAU,UAAU,mBAAmB;AAC5L,KAAI,cAAc,SAAS;AAC1B,wCAAgB,kBAAkB,GAAG,KAAK,UAAU,YAAY,MAAM,EAAE,CAAC,IAAI;AAC7E;;AAED,OAAMC,gCAAY,kBAAkB,YAAY,cAAc;AAC9D,KAAI;AACH,qDAAc,cAAc,QAAQ,UAAU,yBAAyB,EAAE,EAAE,WAAW,MAAM,CAAC;UACrF,OAAO;AACf,MAAI,SAAS,OAAO,UAAU,YAAY,UAAU,SAAS,MAAM,SAAS,SAAU,OAAM"}
1
+ {"version":3,"file":"writeContentDeclaration.cjs","names":["processContentDeclarationContent","getFormatFromExtension","writeJSFile"],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs"],"sourcesContent":["import { getFormatFromExtension } from \"../utils/getFormatFromExtension.mjs\";\nimport { processContentDeclarationContent } from \"./processContentDeclarationContent.mjs\";\nimport { writeJSFile } from \"./writeJSFile.mjs\";\nimport { mkdir, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, extname, join, resolve } from \"node:path\";\nimport { getFilteredLocalesDictionary, getPerLocaleDictionary } from \"@intlayer/core\";\nimport { getUnmergedDictionaries } from \"@intlayer/unmerged-dictionaries-entry\";\nimport { isDeepStrictEqual } from \"node:util\";\n\n//#region src/writeContentDeclaration/writeContentDeclaration.ts\nconst formatContentDeclaration = async (dictionary, configuration, localeList) => {\n\t/**\n\t* Clean Markdown, Insertion, File, etc. node metadata\n\t*/\n\tconst processedDictionary = await processContentDeclarationContent(dictionary);\n\tlet content = processedDictionary.content;\n\t/**\n\t* Filter locales content\n\t*/\n\tif (dictionary.locale) content = getPerLocaleDictionary(processedDictionary, dictionary.locale).content;\n\telse if (localeList) content = getFilteredLocalesDictionary(processedDictionary, localeList).content;\n\tlet pluginFormatResult = {\n\t\t...dictionary,\n\t\tcontent\n\t};\n\t/**\n\t* Format the dictionary with the plugins\n\t*/\n\tfor await (const plugin of configuration.plugins ?? []) if (plugin.formatOutput) {\n\t\tconst formattedResult = await plugin.formatOutput?.({\n\t\t\tdictionary: pluginFormatResult,\n\t\t\tconfiguration\n\t\t});\n\t\tif (formattedResult) pluginFormatResult = formattedResult;\n\t}\n\tif (!(pluginFormatResult.content && pluginFormatResult.key)) return pluginFormatResult;\n\tlet result = {\n\t\tkey: dictionary.key,\n\t\tid: dictionary.id,\n\t\ttitle: dictionary.title,\n\t\tdescription: dictionary.description,\n\t\ttags: dictionary.tags,\n\t\tlocale: dictionary.locale,\n\t\tfill: dictionary.fill,\n\t\tfilled: dictionary.filled,\n\t\tpriority: dictionary.priority,\n\t\tlive: dictionary.live,\n\t\tversion: dictionary.version,\n\t\tcontent\n\t};\n\tif (getFormatFromExtension(dictionary.filePath ? extname(dictionary.filePath) : \".json\") === \"json\" && pluginFormatResult.content && pluginFormatResult.key) result = {\n\t\t$schema: \"https://intlayer.org/schema.json\",\n\t\t...result\n\t};\n\treturn result;\n};\nconst defaultOptions = { newDictionariesPath: \"intlayer-dictionaries\" };\nconst writeContentDeclaration = async (dictionary, configuration, options) => {\n\tconst { content } = configuration;\n\tconst { baseDir } = content;\n\tconst { newDictionariesPath, localeList } = {\n\t\t...defaultOptions,\n\t\t...options\n\t};\n\tconst newDictionaryLocationPath = join(baseDir, newDictionariesPath);\n\tconst existingDictionary = getUnmergedDictionaries(configuration)[dictionary.key]?.find((el) => el.localId === dictionary.localId);\n\tconst formattedContentDeclaration = await formatContentDeclaration(dictionary, configuration, localeList);\n\tif (existingDictionary?.filePath) {\n\t\tconst isSameContent = isDeepStrictEqual(existingDictionary, dictionary);\n\t\tconst filePath = resolve(configuration.content.baseDir, existingDictionary.filePath);\n\t\tif (isSameContent) return {\n\t\t\tstatus: \"up-to-date\",\n\t\t\tpath: filePath\n\t\t};\n\t\tawait writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);\n\t\treturn {\n\t\t\tstatus: \"updated\",\n\t\t\tpath: filePath\n\t\t};\n\t}\n\tif (dictionary.filePath) {\n\t\tconst filePath = resolve(configuration.content.baseDir, dictionary.filePath);\n\t\tawait writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);\n\t\treturn {\n\t\t\tstatus: \"created\",\n\t\t\tpath: filePath\n\t\t};\n\t}\n\tconst contentDeclarationPath = join(newDictionaryLocationPath, `${dictionary.key}.content.json`);\n\tawait writeFileWithDirectories(contentDeclarationPath, formattedContentDeclaration, configuration);\n\treturn {\n\t\tstatus: \"imported\",\n\t\tpath: contentDeclarationPath\n\t};\n};\nconst writeFileWithDirectories = async (absoluteFilePath, dictionary, configuration) => {\n\tawait mkdir(dirname(absoluteFilePath), { recursive: true });\n\tconst extension = extname(absoluteFilePath);\n\tif (!configuration.content.fileExtensions.map((extension$1) => extname(extension$1)).includes(extension)) throw new Error(`Invalid file extension: ${extension}, file: ${absoluteFilePath}`);\n\tif (extension === \".json\") {\n\t\tawait writeFile(absoluteFilePath, `${JSON.stringify(dictionary, null, 2)}\\n`);\n\t\treturn;\n\t}\n\tawait writeJSFile(absoluteFilePath, dictionary, configuration);\n\ttry {\n\t\tawait rm(join(configuration.content.cacheDir, \"intlayer-prepared.lock\"), { recursive: true });\n\t} catch (error) {\n\t\tif (error && typeof error === \"object\" && \"code\" in error && error.code !== \"ENOENT\") throw error;\n\t}\n};\n\n//#endregion\nexport { writeContentDeclaration };\n//# sourceMappingURL=writeContentDeclaration.mjs.map"],"mappings":";;;;;;;;;;;AAUA,MAAM,2BAA2B,OAAO,YAAY,eAAe,eAAe;;;;CAIjF,MAAM,sBAAsB,MAAMA,0EAAiC,WAAW;CAC9E,IAAI,UAAU,oBAAoB;;;;AAIlC,KAAI,WAAW,OAAQ,uDAAiC,qBAAqB,WAAW,OAAO,CAAC;UACvF,WAAY,6DAAuC,qBAAqB,WAAW,CAAC;CAC7F,IAAI,qBAAqB;EACxB,GAAG;EACH;EACA;;;;AAID,YAAW,MAAM,UAAU,cAAc,WAAW,EAAE,CAAE,KAAI,OAAO,cAAc;EAChF,M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AAU,6BAA6B,cAAc;AACpF,SAAO;GACN,QAAQ;GACR,MAAM;GACN;;CAEF,MAAM,6CAA8B,2BAA2B,GAAG,WAAW,IAAI,eAAe;AAChG,OAAM,yBAAyB,wBAAwB,6BAA6B,cAAc;AAClG,QAAO;EACN,QAAQ;EACR,MAAM;EACN;;AAEF,MAAM,2BAA2B,OAAO,kBAAkB,YAAY,kBAAkB;AACvF,0DAAoB,iBAAiB,EAAE,EAAE,WAAW,MAAM,CAAC;CAC3D,MAAM,mCAAoB,iBAAiB;AAC3C,KAAI,CAAC,cAAc,QAAQ,eAAe,KAAK,uCAAwB,YAAY,CAAC,CAAC,SAAS,UAAU,CAAE,OAAM,IAAI,MAAM,2BAA2B,UAAU,UAAU,mBAAmB;AAC5L,KAAI,cAAc,SAAS;AAC1B,wCAAgB,kBAAkB,GAAG,KAAK,UAAU,YAAY,MAAM,EAAE,CAAC,IAAI;AAC7E;;AAED,OAAMC,gCAAY,kBAAkB,YAAY,cAAc;AAC9D,KAAI;AACH,qDAAc,cAAc,QAAQ,UAAU,yBAAyB,EAAE,EAAE,WAAW,MAAM,CAAC;UACrF,OAAO;AACf,MAAI,SAAS,OAAO,UAAU,YAAY,UAAU,SAAS,MAAM,SAAS,SAAU,OAAM"}
@@ -1,15 +1,13 @@
1
- import { __toESM } from "../../../../../../_virtual/rolldown_runtime.mjs";
2
1
  import { getFormatFromExtension } from "../utils/getFormatFromExtension.mjs";
3
2
  import { writeJSFile } from "./writeJSFile.mjs";
4
3
  import { processContentDeclarationContent } from "./processContentDeclarationContent.mjs";
5
- import { require_deep_equal } from "../../../../../../node_modules/.bun/deep-equal@2.2.3/node_modules/deep-equal/index.mjs";
6
4
  import { mkdir, rm, writeFile } from "node:fs/promises";
7
5
  import { dirname, extname, join, resolve } from "node:path";
8
6
  import { getFilteredLocalesDictionary, getPerLocaleDictionary } from "@intlayer/core";
9
7
  import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
8
+ import { isDeepStrictEqual } from "node:util";
10
9
 
11
10
  //#region ../@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs
12
- var import_deep_equal = /* @__PURE__ */ __toESM(require_deep_equal(), 1);
13
11
  const formatContentDeclaration = async (dictionary, configuration, localeList) => {
14
12
  /**
15
13
  * Clean Markdown, Insertion, File, etc. node metadata
@@ -68,7 +66,7 @@ const writeContentDeclaration = async (dictionary, configuration, options) => {
68
66
  const existingDictionary = getUnmergedDictionaries(configuration)[dictionary.key]?.find((el) => el.localId === dictionary.localId);
69
67
  const formattedContentDeclaration = await formatContentDeclaration(dictionary, configuration, localeList);
70
68
  if (existingDictionary?.filePath) {
71
- const isSameContent = (0, import_deep_equal.default)(existingDictionary, dictionary);
69
+ const isSameContent = isDeepStrictEqual(existingDictionary, dictionary);
72
70
  const filePath = resolve(configuration.content.baseDir, existingDictionary.filePath);
73
71
  if (isSameContent) return {
74
72
  status: "up-to-date",
@@ -1 +1 @@
1
- {"version":3,"file":"writeContentDeclaration.mjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs"],"sourcesContent":["import { getFormatFromExtension } from \"../utils/getFormatFromExtension.mjs\";\nimport { processContentDeclarationContent } from \"./processContentDeclarationContent.mjs\";\nimport { writeJSFile } from \"./writeJSFile.mjs\";\nimport { mkdir, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, extname, join, resolve } from \"node:path\";\nimport { getFilteredLocalesDictionary, getPerLocaleDictionary } from \"@intlayer/core\";\nimport { getUnmergedDictionaries } from \"@intlayer/unmerged-dictionaries-entry\";\nimport deepEqual from \"deep-equal\";\n\n//#region src/writeContentDeclaration/writeContentDeclaration.ts\nconst formatContentDeclaration = async (dictionary, configuration, localeList) => {\n\t/**\n\t* Clean Markdown, Insertion, File, etc. node metadata\n\t*/\n\tconst processedDictionary = await processContentDeclarationContent(dictionary);\n\tlet content = processedDictionary.content;\n\t/**\n\t* Filter locales content\n\t*/\n\tif (dictionary.locale) content = getPerLocaleDictionary(processedDictionary, dictionary.locale).content;\n\telse if (localeList) content = getFilteredLocalesDictionary(processedDictionary, localeList).content;\n\tlet pluginFormatResult = {\n\t\t...dictionary,\n\t\tcontent\n\t};\n\t/**\n\t* Format the dictionary with the plugins\n\t*/\n\tfor await (const plugin of configuration.plugins ?? []) if (plugin.formatOutput) {\n\t\tconst formattedResult = await plugin.formatOutput?.({\n\t\t\tdictionary: pluginFormatResult,\n\t\t\tconfiguration\n\t\t});\n\t\tif (formattedResult) pluginFormatResult = formattedResult;\n\t}\n\tif (!(pluginFormatResult.content && pluginFormatResult.key)) return pluginFormatResult;\n\tlet result = {\n\t\tkey: dictionary.key,\n\t\tid: dictionary.id,\n\t\ttitle: dictionary.title,\n\t\tdescription: dictionary.description,\n\t\ttags: dictionary.tags,\n\t\tlocale: dictionary.locale,\n\t\tfill: dictionary.fill,\n\t\tfilled: dictionary.filled,\n\t\tpriority: dictionary.priority,\n\t\tlive: dictionary.live,\n\t\tversion: dictionary.version,\n\t\tcontent\n\t};\n\tif (getFormatFromExtension(dictionary.filePath ? extname(dictionary.filePath) : \".json\") === \"json\" && pluginFormatResult.content && pluginFormatResult.key) result = {\n\t\t$schema: \"https://intlayer.org/schema.json\",\n\t\t...result\n\t};\n\treturn result;\n};\nconst defaultOptions = { newDictionariesPath: \"intlayer-dictionaries\" };\nconst writeContentDeclaration = async (dictionary, configuration, options) => {\n\tconst { content } = configuration;\n\tconst { baseDir } = content;\n\tconst { newDictionariesPath, localeList } = {\n\t\t...defaultOptions,\n\t\t...options\n\t};\n\tconst newDictionaryLocationPath = join(baseDir, newDictionariesPath);\n\tconst existingDictionary = getUnmergedDictionaries(configuration)[dictionary.key]?.find((el) => el.localId === dictionary.localId);\n\tconst formattedContentDeclaration = await formatContentDeclaration(dictionary, configuration, localeList);\n\tif (existingDictionary?.filePath) {\n\t\tconst isSameContent = deepEqual(existingDictionary, dictionary);\n\t\tconst filePath = resolve(configuration.content.baseDir, existingDictionary.filePath);\n\t\tif (isSameContent) return {\n\t\t\tstatus: \"up-to-date\",\n\t\t\tpath: filePath\n\t\t};\n\t\tawait writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);\n\t\treturn {\n\t\t\tstatus: \"updated\",\n\t\t\tpath: filePath\n\t\t};\n\t}\n\tif (dictionary.filePath) {\n\t\tconst filePath = resolve(configuration.content.baseDir, dictionary.filePath);\n\t\tawait writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);\n\t\treturn {\n\t\t\tstatus: \"created\",\n\t\t\tpath: filePath\n\t\t};\n\t}\n\tconst contentDeclarationPath = join(newDictionaryLocationPath, `${dictionary.key}.content.json`);\n\tawait writeFileWithDirectories(contentDeclarationPath, formattedContentDeclaration, configuration);\n\treturn {\n\t\tstatus: \"imported\",\n\t\tpath: contentDeclarationPath\n\t};\n};\nconst writeFileWithDirectories = async (absoluteFilePath, dictionary, configuration) => {\n\tawait mkdir(dirname(absoluteFilePath), { recursive: true });\n\tconst extension = extname(absoluteFilePath);\n\tif (!configuration.content.fileExtensions.map((extension$1) => extname(extension$1)).includes(extension)) throw new Error(`Invalid file extension: ${extension}, file: ${absoluteFilePath}`);\n\tif (extension === \".json\") {\n\t\tawait writeFile(absoluteFilePath, `${JSON.stringify(dictionary, null, 2)}\\n`);\n\t\treturn;\n\t}\n\tawait writeJSFile(absoluteFilePath, dictionary, configuration);\n\ttry {\n\t\tawait rm(join(configuration.content.cacheDir, \"intlayer-prepared.lock\"), { recursive: true });\n\t} catch (error) {\n\t\tif (error && typeof error === \"object\" && \"code\" in error && error.code !== \"ENOENT\") throw error;\n\t}\n};\n\n//#endregion\nexport { writeContentDeclaration };\n//# sourceMappingURL=writeContentDeclaration.mjs.map"],"mappings":";;;;;;;;;;;;AAUA,MAAM,2BAA2B,OAAO,YAAY,eAAe,eAAe;;;;CAIjF,MAAM,sBAAsB,MAAM,iCAAiC,WAAW;CAC9E,IAAI,UAAU,oBAAoB;;;;AAIlC,KAAI,WAAW,OAAQ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;AACpF,MAAI,cAAe,QAAO;GACzB,QAAQ;GACR,MAAM;GACN;AACD,QAAM,yBAAyB,UAAU,6BAA6B,cAAc;AACpF,SAAO;GACN,QAAQ;GACR,MAAM;GACN;;AAEF,KAAI,WAAW,UAAU;EACxB,MAAM,WAAW,QAAQ,cAAc,QAAQ,SAAS,WAAW,SAAS;AAC5E,QAAM,yBAAyB,UAAU,6BAA6B,cAAc;AACpF,SAAO;GACN,QAAQ;GACR,MAAM;GACN;;CAEF,MAAM,yBAAyB,KAAK,2BAA2B,GAAG,WAAW,IAAI,eAAe;AAChG,OAAM,yBAAyB,wBAAwB,6BAA6B,cAAc;AAClG,QAAO;EACN,QAAQ;EACR,MAAM;EACN;;AAEF,MAAM,2BAA2B,OAAO,kBAAkB,YAAY,kBAAkB;AACvF,OAAM,MAAM,QAAQ,iBAAiB,EAAE,EAAE,WAAW,MAAM,CAAC;CAC3D,MAAM,YAAY,QAAQ,iBAAiB;AAC3C,KAAI,CAAC,cAAc,QAAQ,eAAe,KAAK,gBAAgB,QAAQ,YAAY,CAAC,CAAC,SAAS,UAAU,CAAE,OAAM,IAAI,MAAM,2BAA2B,UAAU,UAAU,mBAAmB;AAC5L,KAAI,cAAc,SAAS;AAC1B,QAAM,UAAU,kBAAkB,GAAG,KAAK,UAAU,YAAY,MAAM,EAAE,CAAC,IAAI;AAC7E;;AAED,OAAM,YAAY,kBAAkB,YAAY,cAAc;AAC9D,KAAI;AACH,QAAM,GAAG,KAAK,cAAc,QAAQ,UAAU,yBAAyB,EAAE,EAAE,WAAW,MAAM,CAAC;UACrF,OAAO;AACf,MAAI,SAAS,OAAO,UAAU,YAAY,UAAU,SAAS,MAAM,SAAS,SAAU,OAAM"}
1
+ {"version":3,"file":"writeContentDeclaration.mjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs"],"sourcesContent":["import { getFormatFromExtension } from \"../utils/getFormatFromExtension.mjs\";\nimport { processContentDeclarationContent } from \"./processContentDeclarationContent.mjs\";\nimport { writeJSFile } from \"./writeJSFile.mjs\";\nimport { mkdir, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, extname, join, resolve } from \"node:path\";\nimport { getFilteredLocalesDictionary, getPerLocaleDictionary } from \"@intlayer/core\";\nimport { getUnmergedDictionaries } from \"@intlayer/unmerged-dictionaries-entry\";\nimport { isDeepStrictEqual } from \"node:util\";\n\n//#region src/writeContentDeclaration/writeContentDeclaration.ts\nconst formatContentDeclaration = async (dictionary, configuration, localeList) => {\n\t/**\n\t* Clean Markdown, Insertion, File, etc. node metadata\n\t*/\n\tconst processedDictionary = await processContentDeclarationContent(dictionary);\n\tlet content = processedDictionary.content;\n\t/**\n\t* Filter locales content\n\t*/\n\tif (dictionary.locale) content = getPerLocaleDictionary(processedDictionary, dictionary.locale).content;\n\telse if (localeList) content = getFilteredLocalesDictionary(processedDictionary, localeList).content;\n\tlet pluginFormatResult = {\n\t\t...dictionary,\n\t\tcontent\n\t};\n\t/**\n\t* Format the dictionary with the plugins\n\t*/\n\tfor await (const plugin of configuration.plugins ?? []) if (plugin.formatOutput) {\n\t\tconst formattedResult = await plugin.formatOutput?.({\n\t\t\tdictionary: pluginFormatResult,\n\t\t\tconfiguration\n\t\t});\n\t\tif (formattedResult) pluginFormatResult = formattedResult;\n\t}\n\tif (!(pluginFormatResult.content && pluginFormatResult.key)) return pluginFormatResult;\n\tlet result = {\n\t\tkey: dictionary.key,\n\t\tid: dictionary.id,\n\t\ttitle: dictionary.title,\n\t\tdescription: dictionary.description,\n\t\ttags: dictionary.tags,\n\t\tlocale: dictionary.locale,\n\t\tfill: dictionary.fill,\n\t\tfilled: dictionary.filled,\n\t\tpriority: dictionary.priority,\n\t\tlive: dictionary.live,\n\t\tversion: dictionary.version,\n\t\tcontent\n\t};\n\tif (getFormatFromExtension(dictionary.filePath ? extname(dictionary.filePath) : \".json\") === \"json\" && pluginFormatResult.content && pluginFormatResult.key) result = {\n\t\t$schema: \"https://intlayer.org/schema.json\",\n\t\t...result\n\t};\n\treturn result;\n};\nconst defaultOptions = { newDictionariesPath: \"intlayer-dictionaries\" };\nconst writeContentDeclaration = async (dictionary, configuration, options) => {\n\tconst { content } = configuration;\n\tconst { baseDir } = content;\n\tconst { newDictionariesPath, localeList } = {\n\t\t...defaultOptions,\n\t\t...options\n\t};\n\tconst newDictionaryLocationPath = join(baseDir, newDictionariesPath);\n\tconst existingDictionary = getUnmergedDictionaries(configuration)[dictionary.key]?.find((el) => el.localId === dictionary.localId);\n\tconst formattedContentDeclaration = await formatContentDeclaration(dictionary, configuration, localeList);\n\tif (existingDictionary?.filePath) {\n\t\tconst isSameContent = isDeepStrictEqual(existingDictionary, dictionary);\n\t\tconst filePath = resolve(configuration.content.baseDir, existingDictionary.filePath);\n\t\tif (isSameContent) return {\n\t\t\tstatus: \"up-to-date\",\n\t\t\tpath: filePath\n\t\t};\n\t\tawait writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);\n\t\treturn {\n\t\t\tstatus: \"updated\",\n\t\t\tpath: filePath\n\t\t};\n\t}\n\tif (dictionary.filePath) {\n\t\tconst filePath = resolve(configuration.content.baseDir, dictionary.filePath);\n\t\tawait writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);\n\t\treturn {\n\t\t\tstatus: \"created\",\n\t\t\tpath: filePath\n\t\t};\n\t}\n\tconst contentDeclarationPath = join(newDictionaryLocationPath, `${dictionary.key}.content.json`);\n\tawait writeFileWithDirectories(contentDeclarationPath, formattedContentDeclaration, configuration);\n\treturn {\n\t\tstatus: \"imported\",\n\t\tpath: contentDeclarationPath\n\t};\n};\nconst writeFileWithDirectories = async (absoluteFilePath, dictionary, configuration) => {\n\tawait mkdir(dirname(absoluteFilePath), { recursive: true });\n\tconst extension = extname(absoluteFilePath);\n\tif (!configuration.content.fileExtensions.map((extension$1) => extname(extension$1)).includes(extension)) throw new Error(`Invalid file extension: ${extension}, file: ${absoluteFilePath}`);\n\tif (extension === \".json\") {\n\t\tawait writeFile(absoluteFilePath, `${JSON.stringify(dictionary, null, 2)}\\n`);\n\t\treturn;\n\t}\n\tawait writeJSFile(absoluteFilePath, dictionary, configuration);\n\ttry {\n\t\tawait rm(join(configuration.content.cacheDir, \"intlayer-prepared.lock\"), { recursive: true });\n\t} catch (error) {\n\t\tif (error && typeof error === \"object\" && \"code\" in error && error.code !== \"ENOENT\") throw error;\n\t}\n};\n\n//#endregion\nexport { writeContentDeclaration };\n//# sourceMappingURL=writeContentDeclaration.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,2BAA2B,OAAO,YAAY,eAAe,eAAe;;;;CAIjF,MAAM,sBAAsB,MAAM,iCAAiC,WAAW;CAC9E,IAAI,UAAU,oBAAoB;;;;AAIlC,KAAI,WAAW,OAAQ,WAAU,uBAAuB,qBAAqB,WAAW,OAAO,CAAC;UACvF,WAAY,WAAU,6BAA6B,qBAAqB,WAAW,CAAC;CAC7F,IAAI,qBAAqB;EACxB,GAAG;EACH;EACA;;;;AAID,YAAW,MAAM,UAAU,cAAc,WAAW,EAAE,CAAE,KAAI,OAAO,cAAc;EAChF,MAAM,kBAAkB,MAAM,OAAO,eAAe;GACnD,YAAY;GACZ;GACA,CAAC;AACF,MAAI,gBAAiB,sBAAqB;;AAE3C,KAAI,EAAE,mBAAmB,WAAW,mBAAmB,KAAM,QAAO;CACpE,IAAI,SAAS;EACZ,KAAK,WAAW;EAChB,IAAI,WAAW;EACf,OAAO,WAAW;EAClB,aAAa,WAAW;EACxB,MAAM,WAAW;EACjB,QAAQ,WAAW;EACnB,MAAM,WAAW;EACjB,QAAQ,WAAW;EACnB,UAAU,WAAW;EACrB,MAAM,WAAW;EACjB,SAAS,WAAW;EACpB;EACA;AACD,KAAI,uBAAuB,WAAW,WAAW,QAAQ,WAAW,SAAS,GAAG,QAAQ,KAAK,UAAU,mBAAmB,WAAW,mBAAmB,IAAK,UAAS;EACrK,SAAS;EACT,GAAG;EACH;AACD,QAAO;;AAER,MAAM,iBAAiB,EAAE,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