intlayer-editor 9.5.3 → 9.5.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.
Files changed (144) hide show
  1. package/client/dist/assets/{CodeBlockShiki-D7zTJXzX.js → CodeBlockShiki-DZWJNoDB.js} +2 -2
  2. package/client/dist/assets/MarkDownRender-DX6LxYNy.js +1 -0
  3. package/client/dist/assets/{MarkDownRender-13fWMurT.js → MarkDownRender-DfDAGi54.js} +9 -9
  4. package/client/dist/assets/{MarkdownEditor-DeEk15uV.js → MarkdownEditor-phFFpt9U.js} +5 -5
  5. package/client/dist/assets/dynamic-B58ESQZ7.js +41 -0
  6. package/client/dist/assets/index-BTUTm4rD.js +59 -0
  7. package/client/dist/assets/{shikiBundle-CnnFdFOD.js → shikiBundle-CilRy02_.js} +1 -1
  8. package/client/dist/index.html +2 -2
  9. package/package.json +17 -16
  10. package/server/dist/controllers/dictionary.controller.cjs +3 -3
  11. package/server/dist/controllers/dictionary.controller.cjs.map +1 -1
  12. package/server/dist/controllers/dictionary.controller.d.ts +1 -1
  13. package/server/dist/controllers/dictionary.controller.mjs +2 -2
  14. package/server/dist/controllers/dictionary.controller.mjs.map +1 -1
  15. package/server/dist/index.cjs +3 -3
  16. package/server/dist/index.mjs +3 -3
  17. package/client/dist/assets/MarkDownRender-D3kXJ_Ol.js +0 -1
  18. package/client/dist/assets/dynamic-D0kyHp6d.js +0 -41
  19. package/client/dist/assets/index-Dl8Djuia.js +0 -113
  20. package/server/dist/@intlayer/chokidar/dist/types/build.d.ts +0 -1
  21. package/server/dist/@intlayer/chokidar/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +0 -2
  22. package/server/dist/@intlayer/chokidar/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +0 -2
  23. package/server/dist/@intlayer/chokidar/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +0 -2
  24. package/server/dist/@intlayer/chokidar/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +0 -2
  25. package/server/dist/@intlayer/chokidar/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +0 -2
  26. package/server/dist/@intlayer/chokidar/dist/types/cleanOutputDir.d.ts +0 -1
  27. package/server/dist/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +0 -1
  28. package/server/dist/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +0 -1
  29. package/server/dist/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +0 -1
  30. package/server/dist/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +0 -1
  31. package/server/dist/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +0 -1
  32. package/server/dist/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +0 -1
  33. package/server/dist/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +0 -1
  34. package/server/dist/@intlayer/chokidar/dist/types/createType/createModuleAugmentation.d.ts +0 -1
  35. package/server/dist/@intlayer/chokidar/dist/types/createType/createType.d.ts +0 -2
  36. package/server/dist/@intlayer/chokidar/dist/types/formatDictionary.d.ts +0 -1
  37. package/server/dist/@intlayer/chokidar/dist/types/intlayer/dist/types/index.d.ts +0 -1
  38. package/server/dist/@intlayer/chokidar/dist/types/loadDictionaries/loadContentDeclaration.d.ts +0 -2
  39. package/server/dist/@intlayer/chokidar/dist/types/loadDictionaries/loadDictionaries.d.ts +0 -2
  40. package/server/dist/@intlayer/chokidar/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +0 -2
  41. package/server/dist/@intlayer/chokidar/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +0 -1
  42. package/server/dist/@intlayer/chokidar/dist/types/prepareIntlayer.d.ts +0 -1
  43. package/server/dist/@intlayer/chokidar/dist/types/writeConfiguration/index.d.ts +0 -1
  44. package/server/dist/@intlayer/chokidar/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +0 -6
  45. package/server/dist/@intlayer/chokidar/dist/types/writeContentDeclaration/transformJSFile.d.ts +0 -1
  46. package/server/dist/@intlayer/chokidar/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +0 -2
  47. package/server/dist/@intlayer/chokidar/dist/types/writeContentDeclaration/writeJSFile.d.ts +0 -2
  48. package/server/dist/@intlayer/core/dist/types/messageFormat/ICU.d.ts +0 -1
  49. package/server/dist/@intlayer/core/dist/types/messageFormat/i18next.d.ts +0 -1
  50. package/server/dist/@intlayer/core/dist/types/messageFormat/index.d.ts +0 -1
  51. package/server/dist/@intlayer/core/dist/types/messageFormat/po.d.ts +0 -1
  52. package/server/dist/@intlayer/core/dist/types/messageFormat/vue-i18n.d.ts +0 -1
  53. package/server/dist/packages/@intlayer/chokidar/dist/esm/detectFormatCommand.cjs +0 -32
  54. package/server/dist/packages/@intlayer/chokidar/dist/esm/detectFormatCommand.cjs.map +0 -1
  55. package/server/dist/packages/@intlayer/chokidar/dist/esm/detectFormatCommand.mjs +0 -31
  56. package/server/dist/packages/@intlayer/chokidar/dist/esm/detectFormatCommand.mjs.map +0 -1
  57. package/server/dist/packages/@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +0 -82
  58. package/server/dist/packages/@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +0 -1
  59. package/server/dist/packages/@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +0 -81
  60. package/server/dist/packages/@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +0 -1
  61. package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.cjs +0 -26
  62. package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.cjs.map +0 -1
  63. package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.mjs +0 -25
  64. package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.mjs.map +0 -1
  65. package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/readDictionariesFromDisk.cjs +0 -24
  66. package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/readDictionariesFromDisk.cjs.map +0 -1
  67. package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/readDictionariesFromDisk.mjs +0 -23
  68. package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/readDictionariesFromDisk.mjs.map +0 -1
  69. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.cjs +0 -94
  70. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.cjs.map +0 -1
  71. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +0 -92
  72. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +0 -1
  73. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.cjs +0 -416
  74. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.cjs.map +0 -1
  75. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.mjs +0 -412
  76. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +0 -1
  77. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSONFile.cjs +0 -127
  78. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSONFile.cjs.map +0 -1
  79. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSONFile.mjs +0 -125
  80. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +0 -1
  81. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.cjs +0 -164
  82. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.cjs.map +0 -1
  83. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +0 -163
  84. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +0 -1
  85. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeJSFile.cjs +0 -92
  86. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeJSFile.cjs.map +0 -1
  87. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeJSFile.mjs +0 -91
  88. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +0 -1
  89. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeMarkdownFile.cjs +0 -65
  90. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeMarkdownFile.cjs.map +0 -1
  91. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs +0 -64
  92. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs.map +0 -1
  93. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeYamlFile.cjs +0 -43
  94. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeYamlFile.cjs.map +0 -1
  95. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeYamlFile.mjs +0 -42
  96. package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeYamlFile.mjs.map +0 -1
  97. package/server/dist/packages/@intlayer/core/dist/esm/deepTransformPlugins/getFilteredLocalesContent.cjs +0 -45
  98. package/server/dist/packages/@intlayer/core/dist/esm/deepTransformPlugins/getFilteredLocalesContent.cjs.map +0 -1
  99. package/server/dist/packages/@intlayer/core/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs +0 -43
  100. package/server/dist/packages/@intlayer/core/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs.map +0 -1
  101. package/server/dist/packages/@intlayer/core/dist/esm/deepTransformPlugins/getLocalizedContent.cjs +0 -32
  102. package/server/dist/packages/@intlayer/core/dist/esm/deepTransformPlugins/getLocalizedContent.cjs.map +0 -1
  103. package/server/dist/packages/@intlayer/core/dist/esm/deepTransformPlugins/getLocalizedContent.mjs +0 -32
  104. package/server/dist/packages/@intlayer/core/dist/esm/deepTransformPlugins/getLocalizedContent.mjs.map +0 -1
  105. package/server/dist/packages/@intlayer/core/dist/esm/dictionaryManipulator/getNodeType.cjs +0 -56
  106. package/server/dist/packages/@intlayer/core/dist/esm/dictionaryManipulator/getNodeType.cjs.map +0 -1
  107. package/server/dist/packages/@intlayer/core/dist/esm/dictionaryManipulator/getNodeType.mjs +0 -54
  108. package/server/dist/packages/@intlayer/core/dist/esm/dictionaryManipulator/getNodeType.mjs.map +0 -1
  109. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getCondition.cjs +0 -27
  110. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getCondition.cjs.map +0 -1
  111. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getCondition.mjs +0 -26
  112. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getCondition.mjs.map +0 -1
  113. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getContent/deepTransform.cjs +0 -58
  114. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getContent/deepTransform.cjs.map +0 -1
  115. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getContent/deepTransform.mjs +0 -56
  116. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getContent/deepTransform.mjs.map +0 -1
  117. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getContent/plugins.cjs +0 -160
  118. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getContent/plugins.cjs.map +0 -1
  119. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getContent/plugins.mjs +0 -158
  120. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getContent/plugins.mjs.map +0 -1
  121. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getEnumeration.cjs +0 -71
  122. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getEnumeration.cjs.map +0 -1
  123. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getEnumeration.mjs +0 -70
  124. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getEnumeration.mjs.map +0 -1
  125. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getGender.cjs +0 -38
  126. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getGender.cjs.map +0 -1
  127. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getGender.mjs +0 -37
  128. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getGender.mjs.map +0 -1
  129. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getInsertion.cjs +0 -22
  130. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getInsertion.cjs.map +0 -1
  131. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getInsertion.mjs +0 -21
  132. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getInsertion.mjs.map +0 -1
  133. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getTranslation.cjs +0 -87
  134. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getTranslation.cjs.map +0 -1
  135. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getTranslation.mjs +0 -86
  136. package/server/dist/packages/@intlayer/core/dist/esm/interpreter/getTranslation.mjs.map +0 -1
  137. package/server/dist/packages/@intlayer/core/dist/esm/utils/isValidReactElement.cjs +0 -14
  138. package/server/dist/packages/@intlayer/core/dist/esm/utils/isValidReactElement.cjs.map +0 -1
  139. package/server/dist/packages/@intlayer/core/dist/esm/utils/isValidReactElement.mjs +0 -13
  140. package/server/dist/packages/@intlayer/core/dist/esm/utils/isValidReactElement.mjs.map +0 -1
  141. package/server/dist/packages/@intlayer/core/dist/esm/utils/stringifyYaml.cjs +0 -58
  142. package/server/dist/packages/@intlayer/core/dist/esm/utils/stringifyYaml.cjs.map +0 -1
  143. package/server/dist/packages/@intlayer/core/dist/esm/utils/stringifyYaml.mjs +0 -57
  144. package/server/dist/packages/@intlayer/core/dist/esm/utils/stringifyYaml.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"processContentDeclarationContent.cjs","names":["NodeTypes","x","deepTransformNode"],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs"],"sourcesContent":["import { dirname, join } from \"node:path\";\nimport { colorizePath, x } from \"@intlayer/config/logger\";\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { deepTransformNode } from \"@intlayer/core/interpreter\";\nimport * as NodeTypes from \"@intlayer/types/nodeType\";\n\n//#region src/writeContentDeclaration/processContentDeclarationContent.ts\n/**\n* Write file plugin\n*/\nconst writeFilePlugin = {\n\tid: \"write-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeTypes.FILE,\n\ttransform: (node) => {\n\t\tconst fileContent = node.content;\n\t\tconst filePath = node.fixedPath;\n\t\tif (typeof fileContent !== \"string\") throw new Error(\"File content must be a string\");\n\t\tif (typeof filePath !== \"string\") throw new Error(\"File path must be a string\");\n\t\ttry {\n\t\t\tconst absoluteFilePath = join(process.cwd(), filePath);\n\t\t\tconst fileDirectory = dirname(absoluteFilePath);\n\t\t\tif (!existsSync(fileDirectory)) mkdirSync(fileDirectory, { recursive: true });\n\t\t\twriteFileSync(absoluteFilePath, fileContent);\n\t\t} catch (error) {\n\t\t\tthrow new Error(`${x} Error writing file to ${colorizePath(filePath)}: ${error}`);\n\t\t}\n\t\treturn {\n\t\t\tnodeType: NodeTypes.FILE,\n\t\t\t[NodeTypes.FILE]: node[NodeTypes.FILE]\n\t\t};\n\t}\n};\n/**\n* Markdown file plugin\n*/\nconst markdownFilePlugin = {\n\tid: \"markdown-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeTypes.MARKDOWN,\n\ttransform: (node, props, deepTransformNode) => {\n\t\treturn {\n\t\t\tnodeType: NodeTypes.MARKDOWN,\n\t\t\t[NodeTypes.MARKDOWN]: deepTransformNode(node[NodeTypes.MARKDOWN], props)\n\t\t};\n\t}\n};\n/**\n* Insertion file plugin\n*/\nconst insertionFilePlugin = {\n\tid: \"insertion-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeTypes.INSERTION,\n\ttransform: (node, props, deepTransformNode) => {\n\t\treturn {\n\t\t\tnodeType: NodeTypes.INSERTION,\n\t\t\t[NodeTypes.INSERTION]: deepTransformNode(node[NodeTypes.INSERTION], props)\n\t\t};\n\t}\n};\n/**\n* HTML file plugin\n*/\nconst htmlFilePlugin = {\n\tid: \"html-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeTypes.HTML,\n\ttransform: (node, props, deepTransformNode) => {\n\t\treturn {\n\t\t\tnodeType: NodeTypes.HTML,\n\t\t\t[NodeTypes.HTML]: deepTransformNode(node[NodeTypes.HTML], props)\n\t\t};\n\t}\n};\n/**\n* Process content declaration content\n*\n* It filter node that are autogenerated by intlayer to do not rewrite them in the content declaration file.\n*\n* And write external sources as file content if necessary.\n*/\nconst processContentDeclarationContent = async (dictionary) => deepTransformNode(dictionary, {\n\tdictionaryKey: dictionary.key,\n\tkeyPath: [],\n\tplugins: [\n\t\twriteFilePlugin,\n\t\tmarkdownFilePlugin,\n\t\tinsertionFilePlugin,\n\t\thtmlFilePlugin\n\t]\n});\n\n//#endregion\nexport { processContentDeclarationContent };\n//# sourceMappingURL=processContentD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BAAsB;AAC9C,SAAO;GACN,UAAUA,yBAAU;IACnBA,yBAAU,OAAO,kBAAkB,KAAKA,yBAAU,OAAO,MAAM;GAChE;;CAEF;;;;;;;;AAQD,MAAM,mCAAmC,OAAO,eAAeE,wCAAkB,YAAY;CAC5F,eAAe,WAAW;CAC1B,SAAS,EAAE;CACX,SAAS;EACR;EACA;EACA;EACA;EACA;CACD,CAAC"}
@@ -1,92 +0,0 @@
1
- import { deepTransformNode } from "../../../../core/dist/esm/interpreter/getContent/deepTransform.mjs";
2
- import { dirname, join } from "node:path";
3
- import { existsSync, mkdirSync, writeFileSync } from "node:fs";
4
- import { colorizePath, x } from "@intlayer/config/logger";
5
- import * as NodeTypes from "@intlayer/types/nodeType";
6
-
7
- //#region ../../@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs
8
- /**
9
- * Write file plugin
10
- */
11
- const writeFilePlugin = {
12
- id: "write-file-plugin",
13
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeTypes.FILE,
14
- transform: (node) => {
15
- const fileContent = node.content;
16
- const filePath = node.fixedPath;
17
- if (typeof fileContent !== "string") throw new Error("File content must be a string");
18
- if (typeof filePath !== "string") throw new Error("File path must be a string");
19
- try {
20
- const absoluteFilePath = join(process.cwd(), filePath);
21
- const fileDirectory = dirname(absoluteFilePath);
22
- if (!existsSync(fileDirectory)) mkdirSync(fileDirectory, { recursive: true });
23
- writeFileSync(absoluteFilePath, fileContent);
24
- } catch (error) {
25
- throw new Error(`${x} Error writing file to ${colorizePath(filePath)}: ${error}`);
26
- }
27
- return {
28
- nodeType: NodeTypes.FILE,
29
- [NodeTypes.FILE]: node[NodeTypes.FILE]
30
- };
31
- }
32
- };
33
- /**
34
- * Markdown file plugin
35
- */
36
- const markdownFilePlugin = {
37
- id: "markdown-file-plugin",
38
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeTypes.MARKDOWN,
39
- transform: (node, props, deepTransformNode) => {
40
- return {
41
- nodeType: NodeTypes.MARKDOWN,
42
- [NodeTypes.MARKDOWN]: deepTransformNode(node[NodeTypes.MARKDOWN], props)
43
- };
44
- }
45
- };
46
- /**
47
- * Insertion file plugin
48
- */
49
- const insertionFilePlugin = {
50
- id: "insertion-file-plugin",
51
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeTypes.INSERTION,
52
- transform: (node, props, deepTransformNode) => {
53
- return {
54
- nodeType: NodeTypes.INSERTION,
55
- [NodeTypes.INSERTION]: deepTransformNode(node[NodeTypes.INSERTION], props)
56
- };
57
- }
58
- };
59
- /**
60
- * HTML file plugin
61
- */
62
- const htmlFilePlugin = {
63
- id: "html-file-plugin",
64
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeTypes.HTML,
65
- transform: (node, props, deepTransformNode) => {
66
- return {
67
- nodeType: NodeTypes.HTML,
68
- [NodeTypes.HTML]: deepTransformNode(node[NodeTypes.HTML], props)
69
- };
70
- }
71
- };
72
- /**
73
- * Process content declaration content
74
- *
75
- * It filter node that are autogenerated by intlayer to do not rewrite them in the content declaration file.
76
- *
77
- * And write external sources as file content if necessary.
78
- */
79
- const processContentDeclarationContent = async (dictionary) => deepTransformNode(dictionary, {
80
- dictionaryKey: dictionary.key,
81
- keyPath: [],
82
- plugins: [
83
- writeFilePlugin,
84
- markdownFilePlugin,
85
- insertionFilePlugin,
86
- htmlFilePlugin
87
- ]
88
- });
89
-
90
- //#endregion
91
- export { processContentDeclarationContent };
92
- //# sourceMappingURL=processContentDeclarationContent.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processContentDeclarationContent.mjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs"],"sourcesContent":["import { dirname, join } from \"node:path\";\nimport { colorizePath, x } from \"@intlayer/config/logger\";\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { deepTransformNode } from \"@intlayer/core/interpreter\";\nimport * as NodeTypes from \"@intlayer/types/nodeType\";\n\n//#region src/writeContentDeclaration/processContentDeclarationContent.ts\n/**\n* Write file plugin\n*/\nconst writeFilePlugin = {\n\tid: \"write-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeTypes.FILE,\n\ttransform: (node) => {\n\t\tconst fileContent = node.content;\n\t\tconst filePath = node.fixedPath;\n\t\tif (typeof fileContent !== \"string\") throw new Error(\"File content must be a string\");\n\t\tif (typeof filePath !== \"string\") throw new Error(\"File path must be a string\");\n\t\ttry {\n\t\t\tconst absoluteFilePath = join(process.cwd(), filePath);\n\t\t\tconst fileDirectory = dirname(absoluteFilePath);\n\t\t\tif (!existsSync(fileDirectory)) mkdirSync(fileDirectory, { recursive: true });\n\t\t\twriteFileSync(absoluteFilePath, fileContent);\n\t\t} catch (error) {\n\t\t\tthrow new Error(`${x} Error writing file to ${colorizePath(filePath)}: ${error}`);\n\t\t}\n\t\treturn {\n\t\t\tnodeType: NodeTypes.FILE,\n\t\t\t[NodeTypes.FILE]: node[NodeTypes.FILE]\n\t\t};\n\t}\n};\n/**\n* Markdown file plugin\n*/\nconst markdownFilePlugin = {\n\tid: \"markdown-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeTypes.MARKDOWN,\n\ttransform: (node, props, deepTransformNode) => {\n\t\treturn {\n\t\t\tnodeType: NodeTypes.MARKDOWN,\n\t\t\t[NodeTypes.MARKDOWN]: deepTransformNode(node[NodeTypes.MARKDOWN], props)\n\t\t};\n\t}\n};\n/**\n* Insertion file plugin\n*/\nconst insertionFilePlugin = {\n\tid: \"insertion-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeTypes.INSERTION,\n\ttransform: (node, props, deepTransformNode) => {\n\t\treturn {\n\t\t\tnodeType: NodeTypes.INSERTION,\n\t\t\t[NodeTypes.INSERTION]: deepTransformNode(node[NodeTypes.INSERTION], props)\n\t\t};\n\t}\n};\n/**\n* HTML file plugin\n*/\nconst htmlFilePlugin = {\n\tid: \"html-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeTypes.HTML,\n\ttransform: (node, props, deepTransformNode) => {\n\t\treturn {\n\t\t\tnodeType: NodeTypes.HTML,\n\t\t\t[NodeTypes.HTML]: deepTransformNode(node[NodeTypes.HTML], props)\n\t\t};\n\t}\n};\n/**\n* Process content declaration content\n*\n* It filter node that are autogenerated by intlayer to do not rewrite them in the content declaration file.\n*\n* And write external sources as file content if necessary.\n*/\nconst processContentDeclarationContent = async (dictionary) => deepTransformNode(dictionary, {\n\tdictionaryKey: dictionary.key,\n\tkeyPath: [],\n\tplugins: [\n\t\twriteFilePlugin,\n\t\tmarkdownFilePlugin,\n\t\tinsertionFilePlugin,\n\t\thtmlFilePlugin\n\t]\n});\n\n//#endregion\nexport { processContentDeclarationContent };\n//# sourceMappingURL=processContentDeclarationContent.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,kBAAkB;CACvB,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS,YAAY,MAAM,aAAa,UAAU;CAC9E,YAAY,SAAS;EACpB,MAAM,cAAc,KAAK;EACzB,MAAM,WAAW,KAAK;AACtB,MAAI,OAAO,gBAAgB,SAAU,OAAM,IAAI,MAAM,gCAAgC;AACrF,MAAI,OAAO,aAAa,SAAU,OAAM,IAAI,MAAM,6BAA6B;AAC/E,MAAI;GACH,MAAM,mBAAmB,KAAK,QAAQ,KAAK,EAAE,SAAS;GACtD,MAAM,gBAAgB,QAAQ,iBAAiB;AAC/C,OAAI,CAAC,WAAW,cAAc,CAAE,WAAU,eAAe,EAAE,WAAW,MAAM,CAAC;AAC7E,iBAAc,kBAAkB,YAAY;WACpC,OAAO;AACf,SAAM,IAAI,MAAM,GAAG,EAAE,yBAAyB,aAAa,SAAS,CAAC,IAAI,QAAQ;;AAElF,SAAO;GACN,UAAU,UAAU;IACnB,UAAU,OAAO,KAAK,UAAU;GACjC;;CAEF;;;;AAID,MAAM,qBAAqB;CAC1B,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS,YAAY,MAAM,aAAa,UAAU;CAC9E,YAAY,MAAM,OAAO,sBAAsB;AAC9C,SAAO;GACN,UAAU,UAAU;IACnB,UAAU,WAAW,kBAAkB,KAAK,UAAU,WAAW,MAAM;GACxE;;CAEF;;;;AAID,MAAM,sBAAsB;CAC3B,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS,YAAY,MAAM,aAAa,UAAU;CAC9E,YAAY,MAAM,OAAO,sBAAsB;AAC9C,SAAO;GACN,UAAU,UAAU;IACnB,UAAU,YAAY,kBAAkB,KAAK,UAAU,YAAY,MAAM;GAC1E;;CAEF;;;;AAID,MAAM,iBAAiB;CACtB,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS,YAAY,MAAM,aAAa,UAAU;CAC9E,YAAY,MAAM,OAAO,sBAAsB;AAC9C,SAAO;GACN,UAAU,UAAU;IACnB,UAAU,OAAO,kBAAkB,KAAK,UAAU,OAAO,MAAM;GAChE;;CAEF;;;;;;;;AAQD,MAAM,mCAAmC,OAAO,eAAe,kBAAkB,YAAY;CAC5F,eAAe,WAAW;CAC1B,SAAS,EAAE;CACX,SAAS;EACR;EACA;EACA;EACA;EACA;CACD,CAAC"}
@@ -1,416 +0,0 @@
1
- const require_runtime = require('../../../../../../_virtual/_rolldown/runtime.cjs');
2
- const require_getNodeType = require('../../../../core/dist/esm/dictionaryManipulator/getNodeType.cjs');
3
- let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
- _intlayer_types_nodeType = require_runtime.__toESM(_intlayer_types_nodeType, 1);
5
- let _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js = require("/Users/aymericpineau/Documents/intlayer_/node_modules/.bun/recast@0.23.11/node_modules/recast/main.js");
6
- _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js = require_runtime.__toESM(_Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js, 1);
7
- let _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_parsers_babel_ts_js = require("/Users/aymericpineau/Documents/intlayer_/node_modules/.bun/recast@0.23.11/node_modules/recast/parsers/babel-ts.js");
8
- _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_parsers_babel_ts_js = require_runtime.__toESM(_Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_parsers_babel_ts_js, 1);
9
-
10
- //#region ../../@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.mjs
11
- const b = _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.types.builders;
12
- const n = _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.types.namedTypes;
13
- /**
14
- * Unwraps TypeScript/Babel expression wrappers (satisfies, as, !, <Type>).
15
- * Uses string fallbacks to bypass outdated ast-types definitions.
16
- */
17
- const unwrap = (node) => {
18
- while (node && (n.TSSatisfiesExpression?.check(node) || n.TSAsExpression?.check(node) || n.TSTypeAssertion?.check(node) || n.TSNonNullExpression?.check(node) || [
19
- "TSSatisfiesExpression",
20
- "TSAsExpression",
21
- "TSTypeAssertion",
22
- "TSNonNullExpression"
23
- ].includes(node.type))) node = node.expression;
24
- return node;
25
- };
26
- /**
27
- * Robustly finds a property in a recast ObjectExpression.
28
- * Handles quoted ("key") or unquoted (key) properties.
29
- */
30
- const getMatchingProperty = (node, key) => {
31
- return node.properties.find((prop) => {
32
- if (n.Property.check(prop) || n.ObjectProperty.check(prop)) {
33
- if (n.Identifier.check(prop.key) && prop.key.name === key) return true;
34
- if (n.StringLiteral.check(prop.key) && prop.key.value === key) return true;
35
- if (n.Literal.check(prop.key) && prop.key.value === key) return true;
36
- }
37
- return false;
38
- });
39
- };
40
- /**
41
- * Synchronizes numeric suffixes across locales.
42
- * E.g. "Hello 1" -> "Hello 3" updates "Bonjour 1" to "Bonjour 3".
43
- */
44
- const syncNumericSuffixAcrossLocales = (existingNode, fallbackLocaleCode, newFallbackValue) => {
45
- const trailingNumberMatch = newFallbackValue.match(/\d+(?!.*\d)/);
46
- if (!trailingNumberMatch) return;
47
- const newTrailingNumber = trailingNumberMatch[0];
48
- if (n.ObjectExpression.check(existingNode)) {
49
- for (const prop of existingNode.properties) if (n.Property.check(prop) || n.ObjectProperty.check(prop)) {
50
- let propName = "";
51
- if (n.Identifier.check(prop.key)) propName = prop.key.name;
52
- else if (n.Literal.check(prop.key) && typeof prop.key.value === "string") propName = prop.key.value;
53
- else if (n.StringLiteral.check(prop.key)) propName = prop.key.value;
54
- if (propName && propName !== fallbackLocaleCode) {
55
- if (n.Literal.check(prop.value) && typeof prop.value.value === "string") {
56
- const currentValue = prop.value.value;
57
- if (currentValue.match(/\d+(?!.*\d)/)) prop.value = b.literal(currentValue.replace(/(\d+)(?!.*\d)/, newTrailingNumber));
58
- } else if (n.StringLiteral.check(prop.value)) {
59
- const currentValue = prop.value.value;
60
- if (currentValue.match(/\d+(?!.*\d)/)) prop.value = b.stringLiteral(currentValue.replace(/(\d+)(?!.*\d)/, newTrailingNumber));
61
- }
62
- }
63
- }
64
- }
65
- };
66
- /**
67
- * Checks if a value represents a multilingual Intlayer node.
68
- * A node is multilingual if it is a Translation node, or if it is a specialized node
69
- * (Markdown, HTML, etc.) that contains a Translation node.
70
- */
71
- const isMultilingualNode = (val) => {
72
- if (typeof val !== "object" || val === null || Array.isArray(val)) return false;
73
- const nodeType = require_getNodeType.getNodeType(val);
74
- if (nodeType === _intlayer_types_nodeType.TRANSLATION) return true;
75
- if (nodeType === _intlayer_types_nodeType.MARKDOWN || nodeType === _intlayer_types_nodeType.HTML || nodeType === _intlayer_types_nodeType.INSERTION) return isMultilingualNode(val[nodeType]);
76
- if (nodeType === _intlayer_types_nodeType.ENUMERATION || nodeType === _intlayer_types_nodeType.PLURAL || nodeType === _intlayer_types_nodeType.CONDITION || nodeType === _intlayer_types_nodeType.GENDER) {
77
- const data = val[nodeType];
78
- if (data && typeof data === "object") return Object.values(data).some((v) => isMultilingualNode(v));
79
- }
80
- return false;
81
- };
82
- /**
83
- * Recursively builds or updates an AST node for a given dictionary value.
84
- */
85
- const buildNodeForValue = (val, existingNode, fallbackLocale, requiredImports) => {
86
- const unwrappedExisting = unwrap(existingNode);
87
- if (unwrappedExisting) {
88
- if (!(n.Literal.check(unwrappedExisting) || n.StringLiteral.check(unwrappedExisting) || n.NumericLiteral.check(unwrappedExisting) || n.BooleanLiteral.check(unwrappedExisting) || n.TemplateLiteral.check(unwrappedExisting) || n.ObjectExpression.check(unwrappedExisting) || n.ArrayExpression.check(unwrappedExisting) || n.CallExpression.check(unwrappedExisting) && n.Identifier.check(unwrappedExisting.callee) && [
89
- "t",
90
- "enu",
91
- "plural",
92
- "cond",
93
- "gender",
94
- "insert",
95
- "md",
96
- "html",
97
- "file",
98
- "nest"
99
- ].includes(unwrappedExisting.callee.name))) return existingNode;
100
- }
101
- if (fallbackLocale && !existingNode && !isMultilingualNode(val)) {
102
- if (val === null) return b.literal(null);
103
- if (typeof val === "string" || typeof val === "number" || typeof val === "boolean") {
104
- if (typeof val === "string" && val.includes("\n")) return b.templateLiteral([b.templateElement({
105
- raw: val,
106
- cooked: val
107
- }, true)], []);
108
- return b.literal(val);
109
- }
110
- }
111
- if (fallbackLocale && existingNode && !isMultilingualNode(val)) {
112
- if (n.CallExpression.check(existingNode) && n.Identifier.check(existingNode.callee) && existingNode.callee.name === "t") {
113
- const arg = unwrap(existingNode.arguments[0]);
114
- if (n.ObjectExpression.check(arg)) {
115
- if (typeof val === "string") syncNumericSuffixAcrossLocales(arg, fallbackLocale, val);
116
- updateObjectLiteral(arg, { [fallbackLocale]: val }, fallbackLocale, requiredImports);
117
- if (!fallbackLocale) requiredImports.add("t");
118
- return existingNode;
119
- }
120
- }
121
- if ((!val || typeof val !== "object") && n.CallExpression.check(existingNode) && n.Identifier.check(existingNode.callee) && existingNode.callee.name === "md") {
122
- const innerArg = existingNode.arguments[0];
123
- if (n.CallExpression.check(innerArg) && n.Identifier.check(innerArg.callee) && innerArg.callee.name === "t") {
124
- const tArg = unwrap(innerArg.arguments[0]);
125
- if (n.ObjectExpression.check(tArg)) {
126
- if (typeof val === "string") syncNumericSuffixAcrossLocales(tArg, fallbackLocale, val);
127
- updateObjectLiteral(tArg, { [fallbackLocale]: val }, fallbackLocale, requiredImports);
128
- requiredImports.add("md");
129
- requiredImports.add("t");
130
- return existingNode;
131
- }
132
- }
133
- }
134
- }
135
- if (val === null) return b.literal(null);
136
- if (typeof val === "string" || typeof val === "number" || typeof val === "boolean") {
137
- if (unwrappedExisting) {
138
- if (n.TemplateLiteral.check(unwrappedExisting) && unwrappedExisting.expressions.length === 0) {
139
- unwrappedExisting.quasis[0].value.raw = String(val);
140
- unwrappedExisting.quasis[0].value.cooked = String(val);
141
- return existingNode;
142
- }
143
- if (n.Literal.check(unwrappedExisting) || n.StringLiteral.check(unwrappedExisting)) {
144
- unwrappedExisting.value = val;
145
- return existingNode;
146
- }
147
- }
148
- if (typeof val === "string" && val.includes("\n")) return b.templateLiteral([b.templateElement({
149
- raw: val,
150
- cooked: val
151
- }, true)], []);
152
- return b.literal(val);
153
- }
154
- if (Array.isArray(val)) if (unwrappedExisting && n.ArrayExpression.check(unwrappedExisting)) {
155
- const elements = [...unwrappedExisting.elements];
156
- val.forEach((item, i) => {
157
- elements[i] = buildNodeForValue(item, elements[i], fallbackLocale, requiredImports);
158
- });
159
- if (elements.length > val.length) elements.length = val.length;
160
- unwrappedExisting.elements = elements;
161
- return existingNode;
162
- } else return b.arrayExpression(val.map((item) => buildNodeForValue(item, null, fallbackLocale, requiredImports)));
163
- const nodeType = val && typeof val === "object" && !Array.isArray(val) ? require_getNodeType.getNodeType(val) : null;
164
- if (nodeType && [
165
- _intlayer_types_nodeType.TRANSLATION,
166
- _intlayer_types_nodeType.ENUMERATION,
167
- _intlayer_types_nodeType.PLURAL,
168
- _intlayer_types_nodeType.CONDITION,
169
- _intlayer_types_nodeType.GENDER,
170
- _intlayer_types_nodeType.INSERTION,
171
- _intlayer_types_nodeType.MARKDOWN,
172
- _intlayer_types_nodeType.HTML,
173
- _intlayer_types_nodeType.FILE,
174
- _intlayer_types_nodeType.NESTED,
175
- _intlayer_types_nodeType.ARRAY,
176
- _intlayer_types_nodeType.OBJECT,
177
- _intlayer_types_nodeType.REACT_NODE,
178
- _intlayer_types_nodeType.NUMBER,
179
- _intlayer_types_nodeType.BOOLEAN,
180
- _intlayer_types_nodeType.NULL,
181
- _intlayer_types_nodeType.UNKNOWN
182
- ].includes(nodeType) && nodeType !== _intlayer_types_nodeType.TEXT) {
183
- const nodeData = val[nodeType];
184
- let calleeName = "";
185
- if (nodeType === _intlayer_types_nodeType.TRANSLATION) calleeName = "t";
186
- else if (nodeType === _intlayer_types_nodeType.ENUMERATION) calleeName = "enu";
187
- else if (nodeType === _intlayer_types_nodeType.PLURAL) calleeName = "plural";
188
- else if (nodeType === _intlayer_types_nodeType.CONDITION) calleeName = "cond";
189
- else if (nodeType === _intlayer_types_nodeType.GENDER) calleeName = "gender";
190
- else if (nodeType === _intlayer_types_nodeType.INSERTION) calleeName = "insert";
191
- else if (nodeType === _intlayer_types_nodeType.MARKDOWN) calleeName = "md";
192
- else if (nodeType === _intlayer_types_nodeType.HTML) calleeName = "html";
193
- else if (nodeType === _intlayer_types_nodeType.FILE) calleeName = "file";
194
- else if (nodeType === _intlayer_types_nodeType.NESTED) calleeName = "nest";
195
- if (calleeName) requiredImports.add(calleeName);
196
- const isMatchingCall = existingNode && n.CallExpression.check(existingNode) && n.Identifier.check(existingNode.callee) && existingNode.callee.name === calleeName;
197
- if ([
198
- "t",
199
- "enu",
200
- "plural",
201
- "cond",
202
- "gender"
203
- ].includes(calleeName)) {
204
- let objArg = null;
205
- if (isMatchingCall && existingNode.arguments.length > 0 && n.ObjectExpression.check(existingNode.arguments[0])) objArg = existingNode.arguments[0];
206
- else objArg = b.objectExpression([]);
207
- updateObjectLiteral(objArg, nodeData, fallbackLocale, requiredImports);
208
- return isMatchingCall ? existingNode : b.callExpression(b.identifier(calleeName), [objArg]);
209
- }
210
- if ([
211
- "md",
212
- "html",
213
- "insert",
214
- "file"
215
- ].includes(calleeName)) {
216
- const argNode = buildNodeForValue(nodeData, isMatchingCall && existingNode.arguments.length > 0 ? existingNode.arguments[0] : null, fallbackLocale, requiredImports);
217
- if (isMatchingCall) {
218
- existingNode.arguments[0] = argNode;
219
- return existingNode;
220
- }
221
- return b.callExpression(b.identifier(calleeName), [argNode]);
222
- }
223
- if (calleeName === "nest") {
224
- const args = [b.literal(nodeData.dictionaryKey)];
225
- if (nodeData.path) args.push(b.literal(nodeData.path));
226
- if (isMatchingCall) {
227
- existingNode.arguments = args;
228
- return existingNode;
229
- }
230
- return b.callExpression(b.identifier("nest"), args);
231
- }
232
- }
233
- const objNode = unwrappedExisting && n.ObjectExpression.check(unwrappedExisting) ? unwrappedExisting : b.objectExpression([]);
234
- updateObjectLiteral(objNode, val, fallbackLocale, requiredImports);
235
- return existingNode && unwrappedExisting === existingNode ? objNode : existingNode || objNode;
236
- };
237
- /**
238
- * Recursively updates the AST object literal properties.
239
- */
240
- const updateObjectLiteral = (node, data, fallbackLocale, requiredImports) => {
241
- for (const [key, val] of Object.entries(data)) {
242
- if (val === void 0) continue;
243
- const existingProp = getMatchingProperty(node, key);
244
- if (existingProp) existingProp.value = buildNodeForValue(val, existingProp.value, fallbackLocale, requiredImports);
245
- else {
246
- const keyNode = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? b.identifier(key) : b.literal(key);
247
- const valueNode = buildNodeForValue(val, null, fallbackLocale, requiredImports);
248
- node.properties.push(b.property("init", keyNode, valueNode));
249
- }
250
- }
251
- };
252
- /**
253
- * Modifies the AST's top-level imports to inject dynamically needed helper utilities seamlessly.
254
- */
255
- const addImports = (ast, requiredImports, isESM) => {
256
- if (requiredImports.size === 0) return;
257
- const existingCoreImports = /* @__PURE__ */ new Set();
258
- let coreImportPath = null;
259
- _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.visit(ast, {
260
- visitImportDeclaration(path) {
261
- if (path.node.source.value === "intlayer") {
262
- coreImportPath = path;
263
- path.node.specifiers?.forEach((spec) => {
264
- if (n.ImportSpecifier.check(spec) && typeof spec.imported.name === "string") existingCoreImports.add(spec.imported.name);
265
- });
266
- }
267
- return false;
268
- },
269
- visitVariableDeclaration(path) {
270
- path.node.declarations.forEach((decl) => {
271
- if (n.VariableDeclarator.check(decl) && n.CallExpression.check(decl.init) && n.Identifier.check(decl.init.callee) && decl.init.callee.name === "require") {
272
- const arg = decl.init.arguments[0];
273
- if (n.Literal.check(arg)) {
274
- if (arg.value === "intlayer") {
275
- if (n.ObjectPattern.check(decl.id)) decl.id.properties.forEach((prop) => {
276
- if (n.Property.check(prop) && (n.Identifier.check(prop.key) || n.Identifier.check(prop.value))) {
277
- const name = n.Identifier.check(prop.key) ? prop.key.name : prop.value.name;
278
- existingCoreImports.add(name);
279
- }
280
- });
281
- else if (n.Identifier.check(decl.id)) existingCoreImports.add(decl.id.name);
282
- }
283
- }
284
- }
285
- });
286
- return false;
287
- }
288
- });
289
- const missingCore = Array.from(requiredImports).filter((imp) => !existingCoreImports.has(imp));
290
- if (missingCore.length === 0) return;
291
- if (isESM) if (coreImportPath) {
292
- missingCore.forEach((imp) => {
293
- coreImportPath.node.specifiers.push(b.importSpecifier(b.identifier(imp)));
294
- });
295
- coreImportPath.node.specifiers.sort((a, b) => a.imported.name.localeCompare(b.imported.name));
296
- } else {
297
- const specifiers = missingCore.sort().map((imp) => b.importSpecifier(b.identifier(imp)));
298
- const newImport = b.importDeclaration(specifiers, b.literal("intlayer"));
299
- ast.program.body.unshift(newImport);
300
- }
301
- else {
302
- let insertIndex = 0;
303
- if (ast.program.body.length > 0 && n.ExpressionStatement.check(ast.program.body[0]) && n.Literal.check(ast.program.body[0].expression)) insertIndex = 1;
304
- const cjsLines = [];
305
- const properties = missingCore.sort().map((imp) => {
306
- const prop = b.property("init", b.identifier(imp), b.identifier(imp));
307
- prop.shorthand = true;
308
- return prop;
309
- });
310
- cjsLines.push(b.variableDeclaration("const", [b.variableDeclarator(b.objectPattern(properties), b.callExpression(b.identifier("require"), [b.literal("intlayer")]))]));
311
- ast.program.body.splice(insertIndex, 0, ...cjsLines);
312
- }
313
- };
314
- /**
315
- * Updates a JS/TS file seamlessly to map new localization keys, arrays, complex nodes and nested dictionaries gracefully using AST updates via Recast parser.
316
- */
317
- const transformJSFile = async (fileContent, dictionary, fallbackLocale, noMetadata) => {
318
- if (!dictionary || typeof dictionary !== "object") return fileContent;
319
- let ast;
320
- try {
321
- ast = _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.parse(fileContent, { parser: _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_parsers_babel_ts_js });
322
- } catch (error) {
323
- console.error({ error });
324
- return fileContent;
325
- }
326
- let rootObject = null;
327
- let isESM = false;
328
- _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.visit(ast, {
329
- visitExportDefaultDeclaration() {
330
- isESM = true;
331
- return false;
332
- },
333
- visitImportDeclaration() {
334
- isESM = true;
335
- return false;
336
- }
337
- });
338
- _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.visit(ast, {
339
- visitExportDefaultDeclaration(path) {
340
- const decl = path.node.declaration;
341
- const unwrappedDecl = unwrap(decl);
342
- if (n.ObjectExpression.check(unwrappedDecl)) rootObject = unwrappedDecl;
343
- else if (n.Identifier.check(unwrappedDecl)) {
344
- const varName = unwrappedDecl.name;
345
- _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.visit(ast, { visitVariableDeclarator(vp) {
346
- const unwrappedInit = unwrap(vp.node.init);
347
- if (n.Identifier.check(vp.node.id) && vp.node.id.name === varName && n.ObjectExpression.check(unwrappedInit)) rootObject = unwrappedInit;
348
- return false;
349
- } });
350
- }
351
- return false;
352
- },
353
- visitAssignmentExpression(path) {
354
- const left = path.node.left;
355
- if (n.MemberExpression.check(left)) {
356
- if (n.Identifier.check(left.object) && left.object.name === "module" && n.Identifier.check(left.property) && left.property.name === "exports") {
357
- const unwrappedRight = unwrap(path.node.right);
358
- if (n.ObjectExpression.check(unwrappedRight)) rootObject = unwrappedRight;
359
- }
360
- if (n.Identifier.check(left.object) && left.object.name === "exports" && n.Identifier.check(left.property) && left.property.name === "default") {
361
- const unwrappedRight = unwrap(path.node.right);
362
- if (n.ObjectExpression.check(unwrappedRight)) rootObject = unwrappedRight;
363
- }
364
- }
365
- this.traverse(path);
366
- }
367
- });
368
- if (!rootObject) _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.visit(ast, { visitVariableDeclarator(path) {
369
- const unwrappedInit = unwrap(path.node.init);
370
- if (!rootObject && n.ObjectExpression.check(unwrappedInit)) rootObject = unwrappedInit;
371
- return false;
372
- } });
373
- if (!rootObject) return fileContent;
374
- const requiredImports = /* @__PURE__ */ new Set();
375
- const effectiveFallbackLocale = fallbackLocale ?? "en";
376
- const metadataProperties = [
377
- "id",
378
- "locale",
379
- "filled",
380
- "fill",
381
- "title",
382
- "description",
383
- "tags",
384
- "version",
385
- "priority",
386
- "contentAutoTransformation"
387
- ];
388
- if (noMetadata) {
389
- rootObject.properties = rootObject.properties.filter((prop) => {
390
- if (n.Property.check(prop) || n.ObjectProperty.check(prop)) {
391
- let propName = "";
392
- if (n.Identifier.check(prop.key)) propName = prop.key.name;
393
- else if (n.StringLiteral.check(prop.key)) propName = prop.key.value;
394
- else if (n.Literal.check(prop.key)) propName = String(prop.key.value);
395
- return ![
396
- "key",
397
- "content",
398
- ...metadataProperties
399
- ].includes(propName);
400
- }
401
- return true;
402
- });
403
- _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.visit(ast, { visitNode(path) {
404
- const node = path.node;
405
- if ((n.TSSatisfiesExpression?.check(node) || node.type === "TSSatisfiesExpression") && node.typeAnnotation && n.TSTypeReference.check(node.typeAnnotation) && n.Identifier.check(node.typeAnnotation.typeName) && node.typeAnnotation.typeName.name === "Dictionary") node.typeAnnotation = b.tsIndexedAccessType(b.tsTypeReference(b.identifier("Dictionary")), b.tsLiteralType(b.stringLiteral("content")));
406
- this.traverse(path);
407
- } });
408
- } else for (const prop of metadataProperties) if (dictionary[prop] !== void 0) updateObjectLiteral(rootObject, { [prop]: dictionary[prop] }, void 0, requiredImports);
409
- if (dictionary.content !== void 0) updateObjectLiteral(rootObject, noMetadata ? dictionary.content : { content: dictionary.content }, effectiveFallbackLocale, requiredImports);
410
- addImports(ast, requiredImports, isESM);
411
- return _Users_aymericpineau_Documents_intlayer__node_modules__bun_recast_0_23_11_node_modules_recast_main_js.print(ast).code;
412
- };
413
-
414
- //#endregion
415
- exports.transformJSFile = transformJSFile;
416
- //# sourceMappingURL=transformJSFile.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformJSFile.cjs","names":["recast","getNodeType","NodeTypes","babelTsParser"],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.mjs"],"sourcesContent":["import { getNodeType } from \"@intlayer/core/dictionaryManipulator\";\nimport * as NodeTypes from \"@intlayer/types/nodeType\";\nimport * as recast from \"recast\";\nimport * as babelTsParser from \"recast/parsers/babel-ts.js\";\n\n//#region src/writeContentDeclaration/transformJSFile.ts\nconst b = recast.types.builders;\nconst n = recast.types.namedTypes;\n/**\n* Unwraps TypeScript/Babel expression wrappers (satisfies, as, !, <Type>).\n* Uses string fallbacks to bypass outdated ast-types definitions.\n*/\nconst unwrap = (node) => {\n\twhile (node && (n.TSSatisfiesExpression?.check(node) || n.TSAsExpression?.check(node) || n.TSTypeAssertion?.check(node) || n.TSNonNullExpression?.check(node) || [\n\t\t\"TSSatisfiesExpression\",\n\t\t\"TSAsExpression\",\n\t\t\"TSTypeAssertion\",\n\t\t\"TSNonNullExpression\"\n\t].includes(node.type))) node = node.expression;\n\treturn node;\n};\n/**\n* Robustly finds a property in a recast ObjectExpression.\n* Handles quoted (\"key\") or unquoted (key) properties.\n*/\nconst getMatchingProperty = (node, key) => {\n\treturn node.properties.find((prop) => {\n\t\tif (n.Property.check(prop) || n.ObjectProperty.check(prop)) {\n\t\t\tif (n.Identifier.check(prop.key) && prop.key.name === key) return true;\n\t\t\tif (n.StringLiteral.check(prop.key) && prop.key.value === key) return true;\n\t\t\tif (n.Literal.check(prop.key) && prop.key.value === key) return true;\n\t\t}\n\t\treturn false;\n\t});\n};\n/**\n* Synchronizes numeric suffixes across locales.\n* E.g. \"Hello 1\" -> \"Hello 3\" updates \"Bonjour 1\" to \"Bonjour 3\".\n*/\nconst syncNumericSuffixAcrossLocales = (existingNode, fallbackLocaleCode, newFallbackValue) => {\n\tconst trailingNumberMatch = newFallbackValue.match(/\\d+(?!.*\\d)/);\n\tif (!trailingNumberMatch) return;\n\tconst newTrailingNumber = trailingNumberMatch[0];\n\tif (n.ObjectExpression.check(existingNode)) {\n\t\tfor (const prop of existingNode.properties) if (n.Property.check(prop) || n.ObjectProperty.check(prop)) {\n\t\t\tlet propName = \"\";\n\t\t\tif (n.Identifier.check(prop.key)) propName = prop.key.name;\n\t\t\telse if (n.Literal.check(prop.key) && typeof prop.key.value === \"string\") propName = prop.key.value;\n\t\t\telse if (n.StringLiteral.check(prop.key)) propName = prop.key.value;\n\t\t\tif (propName && propName !== fallbackLocaleCode) {\n\t\t\t\tif (n.Literal.check(prop.value) && typeof prop.value.value === \"string\") {\n\t\t\t\t\tconst currentValue = prop.value.value;\n\t\t\t\t\tif (currentValue.match(/\\d+(?!.*\\d)/)) prop.value = b.literal(currentValue.replace(/(\\d+)(?!.*\\d)/, newTrailingNumber));\n\t\t\t\t} else if (n.StringLiteral.check(prop.value)) {\n\t\t\t\t\tconst currentValue = prop.value.value;\n\t\t\t\t\tif (currentValue.match(/\\d+(?!.*\\d)/)) prop.value = b.stringLiteral(currentValue.replace(/(\\d+)(?!.*\\d)/, newTrailingNumber));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n/**\n* Checks if a value represents a multilingual Intlayer node.\n* A node is multilingual if it is a Translation node, or if it is a specialized node\n* (Markdown, HTML, etc.) that contains a Translation node.\n*/\nconst isMultilingualNode = (val) => {\n\tif (typeof val !== \"object\" || val === null || Array.isArray(val)) return false;\n\tconst nodeType = getNodeType(val);\n\tif (nodeType === NodeTypes.TRANSLATION) return true;\n\tif (nodeType === NodeTypes.MARKDOWN || nodeType === NodeTypes.HTML || nodeType === NodeTypes.INSERTION) return isMultilingualNode(val[nodeType]);\n\tif (nodeType === NodeTypes.ENUMERATION || nodeType === NodeTypes.PLURAL || nodeType === NodeTypes.CONDITION || nodeType === NodeTypes.GENDER) {\n\t\tconst data = val[nodeType];\n\t\tif (data && typeof data === \"object\") return Object.values(data).some((v) => isMultilingualNode(v));\n\t}\n\treturn false;\n};\n/**\n* Recursively builds or updates an AST node for a given dictionary value.\n*/\nconst buildNodeForValue = (val, existingNode, fallbackLocale, requiredImports) => {\n\tconst unwrappedExisting = unwrap(existingNode);\n\tif (unwrappedExisting) {\n\t\tif (!(n.Literal.check(unwrappedExisting) || n.StringLiteral.check(unwrappedExisting) || n.NumericLiteral.check(unwrappedExisting) || n.BooleanLiteral.check(unwrappedExisting) || n.TemplateLiteral.check(unwrappedExisting) || n.ObjectExpression.check(unwrappedExisting) || n.ArrayExpression.check(unwrappedExisting) || n.CallExpression.check(unwrappedExisting) && n.Identifier.check(unwrappedExisting.callee) && [\n\t\t\t\"t\",\n\t\t\t\"enu\",\n\t\t\t\"plural\",\n\t\t\t\"cond\",\n\t\t\t\"gender\",\n\t\t\t\"insert\",\n\t\t\t\"md\",\n\t\t\t\"html\",\n\t\t\t\"file\",\n\t\t\t\"nest\"\n\t\t].includes(unwrappedExisting.callee.name))) return existingNode;\n\t}\n\tif (fallbackLocale && !existingNode && !isMultilingualNode(val)) {\n\t\tif (val === null) return b.literal(null);\n\t\tif (typeof val === \"string\" || typeof val === \"number\" || typeof val === \"boolean\") {\n\t\t\tif (typeof val === \"string\" && val.includes(\"\\n\")) return b.templateLiteral([b.templateElement({\n\t\t\t\traw: val,\n\t\t\t\tcooked: val\n\t\t\t}, true)], []);\n\t\t\treturn b.literal(val);\n\t\t}\n\t}\n\tif (fallbackLocale && existingNode && !isMultilingualNode(val)) {\n\t\tif (n.CallExpression.check(existingNode) && n.Identifier.check(existingNode.callee) && existingNode.callee.name === \"t\") {\n\t\t\tconst arg = unwrap(existingNode.arguments[0]);\n\t\t\tif (n.ObjectExpression.check(arg)) {\n\t\t\t\tif (typeof val === \"string\") syncNumericSuffixAcrossLocales(arg, fallbackLocale, val);\n\t\t\t\tupdateObjectLiteral(arg, { [fallbackLocale]: val }, fallbackLocale, requiredImports);\n\t\t\t\tif (!fallbackLocale) requiredImports.add(\"t\");\n\t\t\t\treturn existingNode;\n\t\t\t}\n\t\t}\n\t\tif ((!val || typeof val !== \"object\") && n.CallExpression.check(existingNode) && n.Identifier.check(existingNode.callee) && existingNode.callee.name === \"md\") {\n\t\t\tconst innerArg = existingNode.arguments[0];\n\t\t\tif (n.CallExpression.check(innerArg) && n.Identifier.check(innerArg.callee) && innerArg.callee.name === \"t\") {\n\t\t\t\tconst tArg = unwrap(innerArg.arguments[0]);\n\t\t\t\tif (n.ObjectExpression.check(tArg)) {\n\t\t\t\t\tif (typeof val === \"string\") syncNumericSuffixAcrossLocales(tArg, fallbackLocale, val);\n\t\t\t\t\tupdateObjectLiteral(tArg, { [fallbackLocale]: val }, fallbackLocale, requiredImports);\n\t\t\t\t\trequiredImports.add(\"md\");\n\t\t\t\t\trequiredImports.add(\"t\");\n\t\t\t\t\treturn existingNode;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (val === null) return b.literal(null);\n\tif (typeof val === \"string\" || typeof val === \"number\" || typeof val === \"boolean\") {\n\t\tif (unwrappedExisting) {\n\t\t\tif (n.TemplateLiteral.check(unwrappedExisting) && unwrappedExisting.expressions.length === 0) {\n\t\t\t\tunwrappedExisting.quasis[0].value.raw = String(val);\n\t\t\t\tunwrappedExisting.quasis[0].value.cooked = String(val);\n\t\t\t\treturn existingNode;\n\t\t\t}\n\t\t\tif (n.Literal.check(unwrappedExisting) || n.StringLiteral.check(unwrappedExisting)) {\n\t\t\t\tunwrappedExisting.value = val;\n\t\t\t\treturn existingNode;\n\t\t\t}\n\t\t}\n\t\tif (typeof val === \"string\" && val.includes(\"\\n\")) return b.templateLiteral([b.templateElement({\n\t\t\traw: val,\n\t\t\tcooked: val\n\t\t}, true)], []);\n\t\treturn b.literal(val);\n\t}\n\tif (Array.isArray(val)) if (unwrappedExisting && n.ArrayExpression.check(unwrappedExisting)) {\n\t\tconst elements = [...unwrappedExisting.elements];\n\t\tval.forEach((item, i) => {\n\t\t\telements[i] = buildNodeForValue(item, elements[i], fallbackLocale, requiredImports);\n\t\t});\n\t\tif (elements.length > val.length) elements.length = val.length;\n\t\tunwrappedExisting.elements = elements;\n\t\treturn existingNode;\n\t} else return b.arrayExpression(val.map((item) => buildNodeForValue(item, null, fallbackLocale, requiredImports)));\n\tconst nodeType = val && typeof val === \"object\" && !Array.isArray(val) ? getNodeType(val) : null;\n\tif (nodeType && [\n\t\tNodeTypes.TRANSLATION,\n\t\tNodeTypes.ENUMERATION,\n\t\tNodeTypes.PLURAL,\n\t\tNodeTypes.CONDITION,\n\t\tNodeTypes.GENDER,\n\t\tNodeTypes.INSERTION,\n\t\tNodeTypes.MARKDOWN,\n\t\tNodeTypes.HTML,\n\t\tNodeTypes.FILE,\n\t\tNodeTypes.NESTED,\n\t\tNodeTypes.ARRAY,\n\t\tNodeTypes.OBJECT,\n\t\tNodeTypes.REACT_NODE,\n\t\tNodeTypes.NUMBER,\n\t\tNodeTypes.BOOLEAN,\n\t\tNodeTypes.NULL,\n\t\tNodeTypes.UNKNOWN\n\t].includes(nodeType) && nodeType !== NodeTypes.TEXT) {\n\t\tconst nodeData = val[nodeType];\n\t\tlet calleeName = \"\";\n\t\tif (nodeType === NodeTypes.TRANSLATION) calleeName = \"t\";\n\t\telse if (nodeType === NodeTypes.ENUMERATION) calleeName = \"enu\";\n\t\telse if (nodeType === NodeTypes.PLURAL) calleeName = \"plural\";\n\t\telse if (nodeType === NodeTypes.CONDITION) calleeName = \"cond\";\n\t\telse if (nodeType === NodeTypes.GENDER) calleeName = \"gender\";\n\t\telse if (nodeType === NodeTypes.INSERTION) calleeName = \"insert\";\n\t\telse if (nodeType === NodeTypes.MARKDOWN) calleeName = \"md\";\n\t\telse if (nodeType === NodeTypes.HTML) calleeName = \"html\";\n\t\telse if (nodeType === NodeTypes.FILE) calleeName = \"file\";\n\t\telse if (nodeType === NodeTypes.NESTED) calleeName = \"nest\";\n\t\tif (calleeName) requiredImports.add(calleeName);\n\t\tconst isMatchingCall = existingNode && n.CallExpression.check(existingNode) && n.Identifier.check(existingNode.callee) && existingNode.callee.name === calleeName;\n\t\tif ([\n\t\t\t\"t\",\n\t\t\t\"enu\",\n\t\t\t\"plural\",\n\t\t\t\"cond\",\n\t\t\t\"gender\"\n\t\t].includes(calleeName)) {\n\t\t\tlet objArg = null;\n\t\t\tif (isMatchingCall && existingNode.arguments.length > 0 && n.ObjectExpression.check(existingNode.arguments[0])) objArg = existingNode.arguments[0];\n\t\t\telse objArg = b.objectExpression([]);\n\t\t\tupdateObjectLiteral(objArg, nodeData, fallbackLocale, requiredImports);\n\t\t\treturn isMatchingCall ? existingNode : b.callExpression(b.identifier(calleeName), [objArg]);\n\t\t}\n\t\tif ([\n\t\t\t\"md\",\n\t\t\t\"html\",\n\t\t\t\"insert\",\n\t\t\t\"file\"\n\t\t].includes(calleeName)) {\n\t\t\tconst argNode = buildNodeForValue(nodeData, isMatchingCall && existingNode.arguments.length > 0 ? existingNode.arguments[0] : null, fallbackLocale, requiredImports);\n\t\t\tif (isMatchingCall) {\n\t\t\t\texistingNode.arguments[0] = argNode;\n\t\t\t\treturn existingNode;\n\t\t\t}\n\t\t\treturn b.callExpression(b.identifier(calleeName), [argNode]);\n\t\t}\n\t\tif (calleeName === \"nest\") {\n\t\t\tconst args = [b.literal(nodeData.dictionaryKey)];\n\t\t\tif (nodeData.path) args.push(b.literal(nodeData.path));\n\t\t\tif (isMatchingCall) {\n\t\t\t\texistingNode.arguments = args;\n\t\t\t\treturn existingNode;\n\t\t\t}\n\t\t\treturn b.callExpression(b.identifier(\"nest\"), args);\n\t\t}\n\t}\n\tconst objNode = unwrappedExisting && n.ObjectExpression.check(unwrappedExisting) ? unwrappedExisting : b.objectExpression([]);\n\tupdateObjectLiteral(objNode, val, fallbackLocale, requiredImports);\n\treturn existingNode && unwrappedExisting === existingNode ? objNode : existingNode || objNode;\n};\n/**\n* Recursively updates the AST object literal properties.\n*/\nconst updateObjectLiteral = (node, data, fallbackLocale, requiredImports) => {\n\tfor (const [key, val] of Object.entries(data)) {\n\t\tif (val === void 0) continue;\n\t\tconst existingProp = getMatchingProperty(node, key);\n\t\tif (existingProp) existingProp.value = buildNodeForValue(val, existingProp.value, fallbackLocale, requiredImports);\n\t\telse {\n\t\t\tconst keyNode = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? b.identifier(key) : b.literal(key);\n\t\t\tconst valueNode = buildNodeForValue(val, null, fallbackLocale, requiredImports);\n\t\t\tnode.properties.push(b.property(\"init\", keyNode, valueNode));\n\t\t}\n\t}\n};\n/**\n* Modifies the AST's top-level imports to inject dynamically needed helper utilities seamlessly.\n*/\nconst addImports = (ast, requiredImports, isESM) => {\n\tif (requiredImports.size === 0) return;\n\tconst existingCoreImports = /* @__PURE__ */ new Set();\n\tlet coreImportPath = null;\n\trecast.visit(ast, {\n\t\tvisitImportDeclaration(path) {\n\t\t\tif (path.node.source.value === \"intlayer\") {\n\t\t\t\tcoreImportPath = path;\n\t\t\t\tpath.node.specifiers?.forEach((spec) => {\n\t\t\t\t\tif (n.ImportSpecifier.check(spec) && typeof spec.imported.name === \"string\") existingCoreImports.add(spec.imported.name);\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tvisitVariableDeclaration(path) {\n\t\t\tpath.node.declarations.forEach((decl) => {\n\t\t\t\tif (n.VariableDeclarator.check(decl) && n.CallExpression.check(decl.init) && n.Identifier.check(decl.init.callee) && decl.init.callee.name === \"require\") {\n\t\t\t\t\tconst arg = decl.init.arguments[0];\n\t\t\t\t\tif (n.Literal.check(arg)) {\n\t\t\t\t\t\tif (arg.value === \"intlayer\") {\n\t\t\t\t\t\t\tif (n.ObjectPattern.check(decl.id)) decl.id.properties.forEach((prop) => {\n\t\t\t\t\t\t\t\tif (n.Property.check(prop) && (n.Identifier.check(prop.key) || n.Identifier.check(prop.value))) {\n\t\t\t\t\t\t\t\t\tconst name = n.Identifier.check(prop.key) ? prop.key.name : prop.value.name;\n\t\t\t\t\t\t\t\t\texistingCoreImports.add(name);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\telse if (n.Identifier.check(decl.id)) existingCoreImports.add(decl.id.name);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\t});\n\tconst missingCore = Array.from(requiredImports).filter((imp) => !existingCoreImports.has(imp));\n\tif (missingCore.length === 0) return;\n\tif (isESM) if (coreImportPath) {\n\t\tmissingCore.forEach((imp) => {\n\t\t\tcoreImportPath.node.specifiers.push(b.importSpecifier(b.identifier(imp)));\n\t\t});\n\t\tcoreImportPath.node.specifiers.sort((a, b) => a.imported.name.localeCompare(b.imported.name));\n\t} else {\n\t\tconst specifiers = missingCore.sort().map((imp) => b.importSpecifier(b.identifier(imp)));\n\t\tconst newImport = b.importDeclaration(specifiers, b.literal(\"intlayer\"));\n\t\tast.program.body.unshift(newImport);\n\t}\n\telse {\n\t\tlet insertIndex = 0;\n\t\tif (ast.program.body.length > 0 && n.ExpressionStatement.check(ast.program.body[0]) && n.Literal.check(ast.program.body[0].expression)) insertIndex = 1;\n\t\tconst cjsLines = [];\n\t\tconst properties = missingCore.sort().map((imp) => {\n\t\t\tconst prop = b.property(\"init\", b.identifier(imp), b.identifier(imp));\n\t\t\tprop.shorthand = true;\n\t\t\treturn prop;\n\t\t});\n\t\tcjsLines.push(b.variableDeclaration(\"const\", [b.variableDeclarator(b.objectPattern(properties), b.callExpression(b.identifier(\"require\"), [b.literal(\"intlayer\")]))]));\n\t\tast.program.body.splice(insertIndex, 0, ...cjsLines);\n\t}\n};\n/**\n* Updates a JS/TS file seamlessly to map new localization keys, arrays, complex nodes and nested dictionaries gracefully using AST updates via Recast parser.\n*/\nconst transformJSFile = async (fileContent, dictionary, fallbackLocale, noMetadata) => {\n\tif (!dictionary || typeof dictionary !== \"object\") return fileContent;\n\tlet ast;\n\ttry {\n\t\tast = recast.parse(fileContent, { parser: babelTsParser });\n\t} catch (error) {\n\t\tconsole.error({ error });\n\t\treturn fileContent;\n\t}\n\tlet rootObject = null;\n\tlet isESM = false;\n\trecast.visit(ast, {\n\t\tvisitExportDefaultDeclaration() {\n\t\t\tisESM = true;\n\t\t\treturn false;\n\t\t},\n\t\tvisitImportDeclaration() {\n\t\t\tisESM = true;\n\t\t\treturn false;\n\t\t}\n\t});\n\trecast.visit(ast, {\n\t\tvisitExportDefaultDeclaration(path) {\n\t\t\tconst decl = path.node.declaration;\n\t\t\tconst unwrappedDecl = unwrap(decl);\n\t\t\tif (n.ObjectExpression.check(unwrappedDecl)) rootObject = unwrappedDecl;\n\t\t\telse if (n.Identifier.check(unwrappedDecl)) {\n\t\t\t\tconst varName = unwrappedDecl.name;\n\t\t\t\trecast.visit(ast, { visitVariableDeclarator(vp) {\n\t\t\t\t\tconst unwrappedInit = unwrap(vp.node.init);\n\t\t\t\t\tif (n.Identifier.check(vp.node.id) && vp.node.id.name === varName && n.ObjectExpression.check(unwrappedInit)) rootObject = unwrappedInit;\n\t\t\t\t\treturn false;\n\t\t\t\t} });\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tvisitAssignmentExpression(path) {\n\t\t\tconst left = path.node.left;\n\t\t\tif (n.MemberExpression.check(left)) {\n\t\t\t\tif (n.Identifier.check(left.object) && left.object.name === \"module\" && n.Identifier.check(left.property) && left.property.name === \"exports\") {\n\t\t\t\t\tconst unwrappedRight = unwrap(path.node.right);\n\t\t\t\t\tif (n.ObjectExpression.check(unwrappedRight)) rootObject = unwrappedRight;\n\t\t\t\t}\n\t\t\t\tif (n.Identifier.check(left.object) && left.object.name === \"exports\" && n.Identifier.check(left.property) && left.property.name === \"default\") {\n\t\t\t\t\tconst unwrappedRight = unwrap(path.node.right);\n\t\t\t\t\tif (n.ObjectExpression.check(unwrappedRight)) rootObject = unwrappedRight;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.traverse(path);\n\t\t}\n\t});\n\tif (!rootObject) recast.visit(ast, { visitVariableDeclarator(path) {\n\t\tconst unwrappedInit = unwrap(path.node.init);\n\t\tif (!rootObject && n.ObjectExpression.check(unwrappedInit)) rootObject = unwrappedInit;\n\t\treturn false;\n\t} });\n\tif (!rootObject) return fileContent;\n\tconst requiredImports = /* @__PURE__ */ new Set();\n\tconst effectiveFallbackLocale = fallbackLocale ?? \"en\";\n\tconst metadataProperties = [\n\t\t\"id\",\n\t\t\"locale\",\n\t\t\"filled\",\n\t\t\"fill\",\n\t\t\"title\",\n\t\t\"description\",\n\t\t\"tags\",\n\t\t\"version\",\n\t\t\"priority\",\n\t\t\"contentAutoTransformation\"\n\t];\n\tif (noMetadata) {\n\t\trootObject.properties = rootObject.properties.filter((prop) => {\n\t\t\tif (n.Property.check(prop) || n.ObjectProperty.check(prop)) {\n\t\t\t\tlet propName = \"\";\n\t\t\t\tif (n.Identifier.check(prop.key)) propName = prop.key.name;\n\t\t\t\telse if (n.StringLiteral.check(prop.key)) propName = prop.key.value;\n\t\t\t\telse if (n.Literal.check(prop.key)) propName = String(prop.key.value);\n\t\t\t\treturn ![\n\t\t\t\t\t\"key\",\n\t\t\t\t\t\"content\",\n\t\t\t\t\t...metadataProperties\n\t\t\t\t].includes(propName);\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\trecast.visit(ast, { visitNode(path) {\n\t\t\tconst node = path.node;\n\t\t\tif ((n.TSSatisfiesExpression?.check(node) || node.type === \"TSSatisfiesExpression\") && node.typeAnnotation && n.TSTypeReference.check(node.typeAnnotation) && n.Identifier.check(node.typeAnnotation.typeName) && node.typeAnnotation.typeName.name === \"Dictionary\") node.typeAnnotation = b.tsIndexedAccessType(b.tsTypeReference(b.identifier(\"Dictionary\")), b.tsLiteralType(b.stringLiteral(\"content\")));\n\t\t\tthis.traverse(path);\n\t\t} });\n\t} else for (const prop of metadataProperties) if (dictionary[prop] !== void 0) updateObjectLiteral(rootObject, { [prop]: dictionary[prop] }, void 0, requiredImports);\n\tif (dictionary.content !== void 0) updateObjectLiteral(rootObject, noMetadata ? dictionary.content : { content: dictionary.content }, effectiveFallbackLocale, requiredImports);\n\taddImports(ast, requiredImports, isESM);\n\treturn recast.print(ast).code;\n};\n\n//#endregion\nexport { transformJSFile };\n//# sourceMappingURL=transformJSFile.mjs.map"],"mappings":";;;;;;;;;;AAMA,MAAM,IAAIA,sGAAO,MAAM;AACvB,MAAM,IAAIA,sGAAO,MAAM;;;;;AAKvB,MAAM,UAAU,SAAS;AACxB,QAAO,SAAS,EAAE,uBAAuB,MAAM,KAAK,IAAI,EAAE,gBAAgB,MAAM,KAAK,IAAI,EAAE,iBAAiB,MAAM,KAAK,IAAI,EAAE,qBAAqB,MAAM,KAAK,IAAI;EAChK;EACA;EACA;EACA;EACA,CAAC,SAAS,KAAK,KAAK,EAAG,QAAO,KAAK;AACpC,QAAO;;;;;;AAMR,MAAM,uBAAuB,MAAM,QAAQ;AAC1C,QAAO,KAAK,WAAW,MAAM,SAAS;AACrC,MAAI,EAAE,SAAS,MAAM,KAAK,IAAI,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