@intlayer/config 8.1.2 → 8.1.3-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -43
  2. package/dist/cjs/built.cjs +1 -7
  3. package/dist/cjs/built.cjs.map +1 -1
  4. package/dist/cjs/client.cjs +1 -40
  5. package/dist/cjs/configFile/buildConfigurationFields.cjs +1 -188
  6. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  7. package/dist/cjs/configFile/getConfiguration.cjs +1 -70
  8. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  9. package/dist/cjs/configFile/index.cjs +1 -10
  10. package/dist/cjs/configFile/loadConfigurationFile.cjs +1 -33
  11. package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
  12. package/dist/cjs/configFile/searchConfigurationFile.cjs +1 -51
  13. package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
  14. package/dist/cjs/defaultValues/build.cjs +1 -29
  15. package/dist/cjs/defaultValues/build.cjs.map +1 -1
  16. package/dist/cjs/defaultValues/compiler.cjs +1 -24
  17. package/dist/cjs/defaultValues/compiler.cjs.map +1 -1
  18. package/dist/cjs/defaultValues/content.cjs +1 -56
  19. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  20. package/dist/cjs/defaultValues/dictionary.cjs +1 -26
  21. package/dist/cjs/defaultValues/dictionary.cjs.map +1 -1
  22. package/dist/cjs/defaultValues/editor.cjs +1 -41
  23. package/dist/cjs/defaultValues/editor.cjs.map +1 -1
  24. package/dist/cjs/defaultValues/index.cjs +1 -78
  25. package/dist/cjs/defaultValues/internationalization.cjs +1 -27
  26. package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
  27. package/dist/cjs/defaultValues/log.cjs +1 -21
  28. package/dist/cjs/defaultValues/log.cjs.map +1 -1
  29. package/dist/cjs/defaultValues/routing.cjs +1 -35
  30. package/dist/cjs/defaultValues/routing.cjs.map +1 -1
  31. package/dist/cjs/defaultValues/system.cjs +1 -47
  32. package/dist/cjs/defaultValues/system.cjs.map +1 -1
  33. package/dist/cjs/index.cjs +1 -81
  34. package/dist/cjs/loadEnvFile.cjs +1 -36
  35. package/dist/cjs/loadEnvFile.cjs.map +1 -1
  36. package/dist/cjs/loadExternalFile/bundleFile.cjs +1 -71
  37. package/dist/cjs/loadExternalFile/bundleFile.cjs.map +1 -1
  38. package/dist/cjs/loadExternalFile/bundleJSFile.cjs +2 -0
  39. package/dist/cjs/loadExternalFile/bundleJSFile.cjs.map +1 -0
  40. package/dist/cjs/loadExternalFile/index.cjs +1 -0
  41. package/dist/cjs/loadExternalFile/loadExternalFile.cjs +1 -79
  42. package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -1
  43. package/dist/cjs/loadExternalFile/parseFileContent.cjs +1 -77
  44. package/dist/cjs/loadExternalFile/parseFileContent.cjs.map +1 -1
  45. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs +1 -63
  46. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs.map +1 -1
  47. package/dist/cjs/logger.cjs +1 -150
  48. package/dist/cjs/logger.cjs.map +1 -1
  49. package/dist/cjs/node.cjs +1 -0
  50. package/dist/cjs/utils/ESMxCJSHelpers.cjs +1 -27
  51. package/dist/cjs/utils/ESMxCJSHelpers.cjs.map +1 -1
  52. package/dist/cjs/utils/alias.cjs +2 -0
  53. package/dist/cjs/utils/alias.cjs.map +1 -0
  54. package/dist/cjs/utils/cacheDisk.cjs +1 -162
  55. package/dist/cjs/utils/cacheDisk.cjs.map +1 -1
  56. package/dist/cjs/utils/cacheMemory.cjs +1 -269
  57. package/dist/cjs/utils/cacheMemory.cjs.map +1 -1
  58. package/dist/cjs/utils/clearModuleCache.cjs +1 -26
  59. package/dist/cjs/utils/clearModuleCache.cjs.map +1 -1
  60. package/dist/cjs/utils/compareVersions.cjs +1 -38
  61. package/dist/cjs/utils/compareVersions.cjs.map +1 -1
  62. package/dist/cjs/utils/extractErrorMessage.cjs +1 -95
  63. package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
  64. package/dist/cjs/utils/getExtension.cjs +1 -14
  65. package/dist/cjs/utils/getExtension.cjs.map +1 -1
  66. package/dist/cjs/utils/getPackageJsonPath.cjs +1 -35
  67. package/dist/cjs/utils/getPackageJsonPath.cjs.map +1 -1
  68. package/dist/cjs/utils/index.cjs +1 -0
  69. package/dist/cjs/utils/logStack.cjs +1 -16
  70. package/dist/cjs/utils/logStack.cjs.map +1 -1
  71. package/dist/cjs/utils/normalizePath.cjs +1 -17
  72. package/dist/cjs/utils/normalizePath.cjs.map +1 -1
  73. package/dist/cjs/utils/retryManager.cjs +2 -0
  74. package/dist/cjs/utils/retryManager.cjs.map +1 -0
  75. package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs +1 -13
  76. package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs.map +1 -1
  77. package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs +1 -16
  78. package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs.map +1 -1
  79. package/dist/cjs/utils/stringFormatter/index.cjs +1 -10
  80. package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs +1 -14
  81. package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs.map +1 -1
  82. package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs +1 -19
  83. package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs.map +1 -1
  84. package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -22
  85. package/dist/esm/built.mjs +1 -7
  86. package/dist/esm/built.mjs.map +1 -1
  87. package/dist/esm/client.mjs +1 -11
  88. package/dist/esm/configFile/buildConfigurationFields.mjs +1 -186
  89. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  90. package/dist/esm/configFile/getConfiguration.mjs +1 -67
  91. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  92. package/dist/esm/configFile/index.mjs +1 -5
  93. package/dist/esm/configFile/loadConfigurationFile.mjs +1 -32
  94. package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
  95. package/dist/esm/configFile/searchConfigurationFile.mjs +1 -48
  96. package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
  97. package/dist/esm/defaultValues/build.mjs +1 -18
  98. package/dist/esm/defaultValues/build.mjs.map +1 -1
  99. package/dist/esm/defaultValues/compiler.mjs +1 -19
  100. package/dist/esm/defaultValues/compiler.mjs.map +1 -1
  101. package/dist/esm/defaultValues/content.mjs +1 -43
  102. package/dist/esm/defaultValues/content.mjs.map +1 -1
  103. package/dist/esm/defaultValues/dictionary.mjs +1 -16
  104. package/dist/esm/defaultValues/dictionary.mjs.map +1 -1
  105. package/dist/esm/defaultValues/editor.mjs +1 -26
  106. package/dist/esm/defaultValues/editor.mjs.map +1 -1
  107. package/dist/esm/defaultValues/index.mjs +1 -24
  108. package/dist/esm/defaultValues/internationalization.mjs +1 -17
  109. package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
  110. package/dist/esm/defaultValues/log.mjs +1 -13
  111. package/dist/esm/defaultValues/log.mjs.map +1 -1
  112. package/dist/esm/defaultValues/routing.mjs +1 -22
  113. package/dist/esm/defaultValues/routing.mjs.map +1 -1
  114. package/dist/esm/defaultValues/system.mjs +1 -30
  115. package/dist/esm/defaultValues/system.mjs.map +1 -1
  116. package/dist/esm/index.mjs +1 -28
  117. package/dist/esm/loadEnvFile.mjs +1 -32
  118. package/dist/esm/loadEnvFile.mjs.map +1 -1
  119. package/dist/esm/loadExternalFile/bundleFile.mjs +1 -67
  120. package/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -1
  121. package/dist/esm/loadExternalFile/bundleJSFile.mjs +2 -0
  122. package/dist/esm/loadExternalFile/bundleJSFile.mjs.map +1 -0
  123. package/dist/esm/loadExternalFile/index.mjs +1 -0
  124. package/dist/esm/loadExternalFile/loadExternalFile.mjs +1 -75
  125. package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -1
  126. package/dist/esm/loadExternalFile/parseFileContent.mjs +1 -73
  127. package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -1
  128. package/dist/esm/loadExternalFile/transpileTSToCJS.mjs +1 -60
  129. package/dist/esm/loadExternalFile/transpileTSToCJS.mjs.map +1 -1
  130. package/dist/esm/logger.mjs +1 -133
  131. package/dist/esm/logger.mjs.map +1 -1
  132. package/dist/esm/node.mjs +1 -0
  133. package/dist/esm/utils/ESMxCJSHelpers.mjs +1 -24
  134. package/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -1
  135. package/dist/esm/utils/alias.mjs +2 -0
  136. package/dist/esm/utils/alias.mjs.map +1 -0
  137. package/dist/esm/utils/cacheDisk.mjs +1 -159
  138. package/dist/esm/utils/cacheDisk.mjs.map +1 -1
  139. package/dist/esm/utils/cacheMemory.mjs +1 -261
  140. package/dist/esm/utils/cacheMemory.mjs.map +1 -1
  141. package/dist/esm/utils/clearModuleCache.mjs +1 -25
  142. package/dist/esm/utils/clearModuleCache.mjs.map +1 -1
  143. package/dist/esm/utils/compareVersions.mjs +1 -36
  144. package/dist/esm/utils/compareVersions.mjs.map +1 -1
  145. package/dist/esm/utils/extractErrorMessage.mjs +1 -93
  146. package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
  147. package/dist/esm/utils/getExtension.mjs +1 -12
  148. package/dist/esm/utils/getExtension.mjs.map +1 -1
  149. package/dist/esm/utils/getPackageJsonPath.mjs +1 -32
  150. package/dist/esm/utils/getPackageJsonPath.mjs.map +1 -1
  151. package/dist/esm/utils/index.mjs +1 -0
  152. package/dist/esm/utils/logStack.mjs +1 -15
  153. package/dist/esm/utils/logStack.mjs.map +1 -1
  154. package/dist/esm/utils/normalizePath.mjs +1 -15
  155. package/dist/esm/utils/normalizePath.mjs.map +1 -1
  156. package/dist/esm/utils/retryManager.mjs +2 -0
  157. package/dist/esm/utils/retryManager.mjs.map +1 -0
  158. package/dist/esm/utils/stringFormatter/camelCaseToKebabCase.mjs +1 -11
  159. package/dist/esm/utils/stringFormatter/camelCaseToKebabCase.mjs.map +1 -1
  160. package/dist/esm/utils/stringFormatter/camelCaseToSentence.mjs +1 -14
  161. package/dist/esm/utils/stringFormatter/camelCaseToSentence.mjs.map +1 -1
  162. package/dist/esm/utils/stringFormatter/index.mjs +1 -6
  163. package/dist/esm/utils/stringFormatter/kebabCaseToCamelCase.mjs +1 -12
  164. package/dist/esm/utils/stringFormatter/kebabCaseToCamelCase.mjs.map +1 -1
  165. package/dist/esm/utils/stringFormatter/toLowerCamelCase.mjs +1 -17
  166. package/dist/esm/utils/stringFormatter/toLowerCamelCase.mjs.map +1 -1
  167. package/dist/types/index.d.ts +15 -9
  168. package/dist/types/{bundleJSFile.d.ts → loadExternalFile/bundleJSFile.d.ts} +1 -1
  169. package/dist/types/loadExternalFile/bundleJSFile.d.ts.map +1 -0
  170. package/dist/types/loadExternalFile/index.d.ts +6 -0
  171. package/dist/types/loadExternalFile/loadExternalFile.d.ts +2 -3
  172. package/dist/types/loadExternalFile/loadExternalFile.d.ts.map +1 -1
  173. package/dist/types/loadExternalFile/transpileTSToCJS.d.ts +2 -3
  174. package/dist/types/loadExternalFile/transpileTSToCJS.d.ts.map +1 -1
  175. package/dist/types/node.d.ts +5 -0
  176. package/dist/types/{alias.d.ts → utils/alias.d.ts} +1 -1
  177. package/dist/types/utils/alias.d.ts.map +1 -0
  178. package/dist/types/utils/getPackageJsonPath.d.ts +1 -2
  179. package/dist/types/utils/getPackageJsonPath.d.ts.map +1 -1
  180. package/dist/types/utils/index.d.ts +17 -0
  181. package/dist/types/{retryManager.d.ts → utils/retryManager.d.ts} +1 -1
  182. package/dist/types/utils/retryManager.d.ts.map +1 -0
  183. package/package.json +42 -10
  184. package/dist/cjs/alias.cjs +0 -30
  185. package/dist/cjs/alias.cjs.map +0 -1
  186. package/dist/cjs/bundleJSFile.cjs +0 -34
  187. package/dist/cjs/bundleJSFile.cjs.map +0 -1
  188. package/dist/cjs/retryManager.cjs +0 -46
  189. package/dist/cjs/retryManager.cjs.map +0 -1
  190. package/dist/esm/alias.mjs +0 -28
  191. package/dist/esm/alias.mjs.map +0 -1
  192. package/dist/esm/bundleJSFile.mjs +0 -32
  193. package/dist/esm/bundleJSFile.mjs.map +0 -1
  194. package/dist/esm/retryManager.mjs +0 -45
  195. package/dist/esm/retryManager.mjs.map +0 -1
  196. package/dist/types/alias.d.ts.map +0 -1
  197. package/dist/types/bundleJSFile.d.ts.map +0 -1
  198. package/dist/types/retryManager.d.ts.map +0 -1
@@ -1,43 +1 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) {
11
- __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- }
16
- if (!no_symbols) {
17
- __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- }
19
- return target;
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
24
- key = keys[i];
25
- if (!__hasOwnProp.call(to, key) && key !== except) {
26
- __defProp(to, key, {
27
- get: ((k) => from[k]).bind(null, key),
28
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
- });
30
- }
31
- }
32
- }
33
- return to;
34
- };
35
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
36
- value: mod,
37
- enumerable: true
38
- }) : target, mod));
39
-
40
- //#endregion
41
-
42
- exports.__exportAll = __exportAll;
43
- exports.__toESM = __toESM;
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__exportAll=o,exports.__toESM=c;
@@ -1,8 +1,2 @@
1
- const require_configFile_getConfiguration = require('./configFile/getConfiguration.cjs');
2
-
3
- //#region src/built.ts
4
- const configuration = require_configFile_getConfiguration.getConfiguration();
5
-
6
- //#endregion
7
- module.exports = configuration;
1
+ const e=require(`./configFile/getConfiguration.cjs`).getConfiguration();module.exports=e;
8
2
  //# sourceMappingURL=built.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"built.cjs","names":["getConfiguration"],"sources":["../../src/built.ts"],"sourcesContent":["/**\n * @intlayer/config/built is a package that only returns the configuration file as a JSON object.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n */\n\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { getConfiguration } from './configFile/getConfiguration';\n\nconst configuration: IntlayerConfig = getConfiguration();\n\nexport default configuration;\n"],"mappings":";;;AAQA,MAAM,gBAAgCA,sDAAkB"}
1
+ {"version":3,"file":"built.cjs","names":["getConfiguration"],"sources":["../../src/built.ts"],"sourcesContent":["/**\n * @intlayer/config/built is a package that only returns the configuration file as a JSON object.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n */\n\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { getConfiguration } from './configFile/getConfiguration';\n\nconst configuration: IntlayerConfig = getConfiguration();\n\nexport default configuration;\n"],"mappings":"AAQA,MAAM,+CAAgCA,kBAAkB"}
@@ -1,40 +1 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_utils_normalizePath = require('./utils/normalizePath.cjs');
3
- const require_logger = require('./logger.cjs');
4
- const require_defaultValues_index = require('./defaultValues/index.cjs');
5
- const require_utils_extractErrorMessage = require('./utils/extractErrorMessage.cjs');
6
- const require_utils_logStack = require('./utils/logStack.cjs');
7
- const require_utils_stringFormatter_camelCaseToKebabCase = require('./utils/stringFormatter/camelCaseToKebabCase.cjs');
8
- const require_utils_stringFormatter_camelCaseToSentence = require('./utils/stringFormatter/camelCaseToSentence.cjs');
9
- const require_utils_stringFormatter_kebabCaseToCamelCase = require('./utils/stringFormatter/kebabCaseToCamelCase.cjs');
10
- const require_utils_stringFormatter_toLowerCamelCase = require('./utils/stringFormatter/toLowerCamelCase.cjs');
11
-
12
- exports.ANSIColors = require_logger.ANSIColors;
13
- Object.defineProperty(exports, 'DefaultValues', {
14
- enumerable: true,
15
- get: function () {
16
- return require_defaultValues_index.defaultValues_exports;
17
- }
18
- });
19
- exports.camelCaseToKebabCase = require_utils_stringFormatter_camelCaseToKebabCase.camelCaseToKebabCase;
20
- exports.camelCaseToSentence = require_utils_stringFormatter_camelCaseToSentence.camelCaseToSentence;
21
- exports.clock = require_logger.clock;
22
- exports.colon = require_logger.colon;
23
- exports.colorize = require_logger.colorize;
24
- exports.colorizeKey = require_logger.colorizeKey;
25
- exports.colorizeLocales = require_logger.colorizeLocales;
26
- exports.colorizeNumber = require_logger.colorizeNumber;
27
- exports.colorizePath = require_logger.colorizePath;
28
- exports.extractErrorMessage = require_utils_extractErrorMessage.extractErrorMessage;
29
- exports.getAppLogger = require_logger.getAppLogger;
30
- exports.getPrefix = require_logger.getPrefix;
31
- exports.kebabCaseToCamelCase = require_utils_stringFormatter_kebabCaseToCamelCase.kebabCaseToCamelCase;
32
- exports.logStack = require_utils_logStack.logStack;
33
- exports.logger = require_logger.logger;
34
- exports.normalizePath = require_utils_normalizePath.normalizePath;
35
- exports.removeColor = require_logger.removeColor;
36
- exports.setPrefix = require_logger.setPrefix;
37
- exports.spinnerFrames = require_logger.spinnerFrames;
38
- exports.toLowerCamelCase = require_utils_stringFormatter_toLowerCamelCase.toLowerCamelCase;
39
- exports.v = require_logger.v;
40
- exports.x = require_logger.x;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./logger.cjs`),t=require(`./utils/normalizePath.cjs`),n=require(`./defaultValues/index.cjs`),r=require(`./utils/extractErrorMessage.cjs`),i=require(`./utils/logStack.cjs`),a=require(`./utils/stringFormatter/camelCaseToKebabCase.cjs`),o=require(`./utils/stringFormatter/camelCaseToSentence.cjs`),s=require(`./utils/stringFormatter/kebabCaseToCamelCase.cjs`),c=require(`./utils/stringFormatter/toLowerCamelCase.cjs`);exports.ANSIColors=e.ANSIColors,Object.defineProperty(exports,`DefaultValues`,{enumerable:!0,get:function(){return n.defaultValues_exports}}),exports.camelCaseToKebabCase=a.camelCaseToKebabCase,exports.camelCaseToSentence=o.camelCaseToSentence,exports.clock=e.clock,exports.colon=e.colon,exports.colorize=e.colorize,exports.colorizeKey=e.colorizeKey,exports.colorizeLocales=e.colorizeLocales,exports.colorizeNumber=e.colorizeNumber,exports.colorizePath=e.colorizePath,exports.extractErrorMessage=r.extractErrorMessage,exports.getAppLogger=e.getAppLogger,exports.getPrefix=e.getPrefix,exports.kebabCaseToCamelCase=s.kebabCaseToCamelCase,exports.logStack=i.logStack,exports.logger=e.logger,exports.normalizePath=t.normalizePath,exports.removeColor=e.removeColor,exports.setPrefix=e.setPrefix,exports.spinnerFrames=e.spinnerFrames,exports.toLowerCamelCase=c.toLowerCamelCase,exports.v=e.v,exports.x=e.x;
@@ -1,189 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_utils_normalizePath = require('../utils/normalizePath.cjs');
4
- const require_defaultValues_build = require('../defaultValues/build.cjs');
5
- const require_defaultValues_compiler = require('../defaultValues/compiler.cjs');
6
- const require_defaultValues_content = require('../defaultValues/content.cjs');
7
- const require_defaultValues_dictionary = require('../defaultValues/dictionary.cjs');
8
- const require_defaultValues_editor = require('../defaultValues/editor.cjs');
9
- const require_defaultValues_internationalization = require('../defaultValues/internationalization.cjs');
10
- const require_defaultValues_log = require('../defaultValues/log.cjs');
11
- const require_defaultValues_routing = require('../defaultValues/routing.cjs');
12
- const require_defaultValues_system = require('../defaultValues/system.cjs');
13
- let node_path = require("node:path");
14
- let node_fs = require("node:fs");
15
- let _intlayer_types_package_json = require("@intlayer/types/package.json");
16
- _intlayer_types_package_json = require_runtime.__toESM(_intlayer_types_package_json);
17
-
18
- //#region src/configFile/buildConfigurationFields.ts
19
- let storedConfiguration;
20
- const buildInternationalizationFields = (customConfiguration) => ({
21
- locales: customConfiguration?.locales ?? require_defaultValues_internationalization.LOCALES,
22
- requiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? require_defaultValues_internationalization.REQUIRED_LOCALES,
23
- strictMode: customConfiguration?.strictMode ?? require_defaultValues_internationalization.STRICT_MODE,
24
- defaultLocale: customConfiguration?.defaultLocale ?? require_defaultValues_internationalization.DEFAULT_LOCALE
25
- });
26
- const buildRoutingFields = (customConfiguration) => ({
27
- mode: customConfiguration?.mode ?? require_defaultValues_routing.ROUTING_MODE,
28
- storage: customConfiguration?.storage ?? require_defaultValues_routing.STORAGE,
29
- basePath: customConfiguration?.basePath ?? require_defaultValues_routing.BASE_PATH,
30
- rewrite: customConfiguration?.rewrite
31
- });
32
- const buildContentFields = (customConfiguration, baseDir, logFunctions) => {
33
- const fileExtensions = customConfiguration?.fileExtensions ?? require_defaultValues_content.FILE_EXTENSIONS;
34
- const projectBaseDir = customConfiguration?.baseDir ?? baseDir ?? process.cwd();
35
- const optionalJoinBaseDir = (pathInput) => {
36
- let absolutePath;
37
- try {
38
- absolutePath = require.resolve(pathInput, { paths: [projectBaseDir] });
39
- } catch {
40
- absolutePath = (0, node_path.isAbsolute)(pathInput) ? pathInput : (0, node_path.join)(projectBaseDir, pathInput);
41
- }
42
- try {
43
- if ((0, node_fs.statSync)(absolutePath).isFile()) return (0, node_path.dirname)(absolutePath);
44
- } catch {
45
- if (/\.[a-z0-9]+$/i.test(absolutePath)) return (0, node_path.dirname)(absolutePath);
46
- }
47
- return absolutePath;
48
- };
49
- const contentDir = (customConfiguration?.contentDir ?? require_defaultValues_content.CONTENT_DIR).map(optionalJoinBaseDir);
50
- return {
51
- fileExtensions,
52
- baseDir: projectBaseDir,
53
- contentDir,
54
- codeDir: (customConfiguration?.codeDir ?? require_defaultValues_content.CODE_DIR).map(optionalJoinBaseDir),
55
- excludedPath: customConfiguration?.excludedPath ?? require_defaultValues_content.EXCLUDED_PATHS,
56
- watch: customConfiguration?.watch ?? require_defaultValues_content.WATCH,
57
- formatCommand: customConfiguration?.formatCommand,
58
- watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),
59
- watchedFilesPatternWithPath: fileExtensions.flatMap((ext) => contentDir.map((dir) => `${require_utils_normalizePath.normalizePath(dir)}/**/*${ext}`))
60
- };
61
- };
62
- const buildSystemFields = (customConfiguration, contentConfig) => {
63
- const projectBaseDir = contentConfig?.baseDir ?? process.cwd();
64
- const optionalJoinBaseDir = (pathInput) => {
65
- let absolutePath;
66
- try {
67
- absolutePath = require.resolve(pathInput, { paths: [projectBaseDir] });
68
- } catch {
69
- absolutePath = (0, node_path.isAbsolute)(pathInput) ? pathInput : (0, node_path.join)(projectBaseDir, pathInput);
70
- }
71
- try {
72
- if ((0, node_fs.statSync)(absolutePath).isFile()) return (0, node_path.dirname)(absolutePath);
73
- } catch {
74
- if (/\.[a-z0-9]+$/i.test(absolutePath)) return (0, node_path.dirname)(absolutePath);
75
- }
76
- return absolutePath;
77
- };
78
- const dictionariesDir = optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? require_defaultValues_system.DICTIONARIES_DIR);
79
- return {
80
- moduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? require_defaultValues_system.MODULE_AUGMENTATION_DIR),
81
- unmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? require_defaultValues_system.UNMERGED_DICTIONARIES_DIR),
82
- remoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? require_defaultValues_system.REMOTE_DICTIONARIES_DIR),
83
- dictionariesDir,
84
- dynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? require_defaultValues_system.DYNAMIC_DICTIONARIES_DIR),
85
- fetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? require_defaultValues_system.FETCH_DICTIONARIES_DIR),
86
- typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? require_defaultValues_system.TYPES_DIR),
87
- mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? require_defaultValues_system.MAIN_DIR),
88
- configDir: optionalJoinBaseDir(customConfiguration?.configDir ?? require_defaultValues_system.CONFIG_DIR),
89
- cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? require_defaultValues_system.CACHE_DIR),
90
- outputFilesPatternWithPath: `${require_utils_normalizePath.normalizePath(dictionariesDir)}/**/*.json`
91
- };
92
- };
93
- const buildEditorFields = (customConfiguration) => ({
94
- applicationURL: customConfiguration?.applicationURL ?? require_defaultValues_editor.APPLICATION_URL,
95
- editorURL: customConfiguration?.editorURL ?? require_defaultValues_editor.EDITOR_URL,
96
- cmsURL: customConfiguration?.cmsURL ?? require_defaultValues_editor.CMS_URL,
97
- backendURL: customConfiguration?.backendURL ?? require_defaultValues_editor.BACKEND_URL,
98
- port: customConfiguration?.port ?? require_defaultValues_editor.PORT,
99
- enabled: customConfiguration?.enabled ?? require_defaultValues_editor.IS_ENABLED,
100
- clientId: customConfiguration?.clientId ?? void 0,
101
- clientSecret: customConfiguration?.clientSecret ?? void 0,
102
- dictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? require_defaultValues_editor.DICTIONARY_PRIORITY_STRATEGY,
103
- liveSync: customConfiguration?.liveSync ?? require_defaultValues_editor.LIVE_SYNC,
104
- liveSyncPort: customConfiguration?.liveSyncPort ?? require_defaultValues_editor.LIVE_SYNC_PORT,
105
- liveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? require_defaultValues_editor.LIVE_SYNC_PORT}`
106
- });
107
- const buildLogFields = (customConfiguration, logFunctions) => ({
108
- mode: customConfiguration?.mode ?? require_defaultValues_log.MODE,
109
- prefix: customConfiguration?.prefix ?? require_defaultValues_log.PREFIX,
110
- error: logFunctions?.error,
111
- log: logFunctions?.log,
112
- info: logFunctions?.info,
113
- warn: logFunctions?.warn
114
- });
115
- const buildAiFields = (customConfiguration) => ({
116
- provider: customConfiguration?.provider,
117
- apiKey: customConfiguration?.apiKey,
118
- model: customConfiguration?.model,
119
- temperature: customConfiguration?.temperature,
120
- applicationContext: customConfiguration?.applicationContext,
121
- baseURL: customConfiguration?.baseURL,
122
- dataSerialization: customConfiguration?.dataSerialization
123
- });
124
- const buildBuildFields = (customConfiguration) => ({
125
- mode: customConfiguration?.mode ?? require_defaultValues_build.BUILD_MODE,
126
- optimize: customConfiguration?.optimize,
127
- importMode: customConfiguration?.importMode,
128
- traversePattern: customConfiguration?.traversePattern ?? require_defaultValues_build.TRAVERSE_PATTERN,
129
- outputFormat: customConfiguration?.outputFormat ?? require_defaultValues_build.OUTPUT_FORMAT,
130
- cache: customConfiguration?.cache ?? require_defaultValues_build.CACHE,
131
- require: customConfiguration?.require
132
- });
133
- const buildCompilerFields = (customConfiguration) => ({
134
- enabled: customConfiguration?.enabled ?? require_defaultValues_compiler.COMPILER_ENABLED,
135
- transformPattern: customConfiguration?.transformPattern ?? require_defaultValues_compiler.COMPILER_TRANSFORM_PATTERN,
136
- excludePattern: customConfiguration?.excludePattern ?? require_defaultValues_compiler.COMPILER_EXCLUDE_PATTERN,
137
- outputDir: customConfiguration?.outputDir ?? require_defaultValues_compiler.COMPILER_OUTPUT_DIR
138
- });
139
- const buildDictionaryFields = (customConfiguration) => {
140
- const contentAutoTransformation = customConfiguration?.contentAutoTransformation ?? require_defaultValues_dictionary.CONTENT_AUTO_TRANSFORMATION;
141
- return {
142
- fill: customConfiguration?.fill ?? require_defaultValues_dictionary.FILL,
143
- contentAutoTransformation: typeof contentAutoTransformation === "object" ? {
144
- markdown: contentAutoTransformation.markdown ?? false,
145
- html: contentAutoTransformation.html ?? false,
146
- insertion: contentAutoTransformation.insertion ?? false
147
- } : contentAutoTransformation,
148
- location: customConfiguration?.location ?? require_defaultValues_dictionary.LOCATION,
149
- locale: customConfiguration?.locale,
150
- title: customConfiguration?.title,
151
- description: customConfiguration?.description,
152
- tags: customConfiguration?.tags,
153
- priority: customConfiguration?.priority,
154
- importMode: customConfiguration?.importMode ?? require_defaultValues_dictionary.IMPORT_MODE,
155
- version: customConfiguration?.version
156
- };
157
- };
158
- /**
159
- * Build the configuration fields by merging the default values with the custom configuration
160
- */
161
- const buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {
162
- const internationalizationConfig = buildInternationalizationFields(customConfiguration?.internationalization);
163
- const routingConfig = buildRoutingFields(customConfiguration?.routing);
164
- const contentConfig = buildContentFields(customConfiguration?.content, baseDir, logFunctions);
165
- storedConfiguration = {
166
- internationalization: internationalizationConfig,
167
- routing: routingConfig,
168
- content: contentConfig,
169
- system: buildSystemFields(customConfiguration?.system, contentConfig),
170
- editor: buildEditorFields(customConfiguration?.editor),
171
- log: buildLogFields(customConfiguration?.log, logFunctions),
172
- ai: buildAiFields(customConfiguration?.ai),
173
- build: buildBuildFields(customConfiguration?.build),
174
- compiler: buildCompilerFields(customConfiguration?.compiler),
175
- dictionary: buildDictionaryFields(customConfiguration?.dictionary),
176
- plugins: customConfiguration?.plugins,
177
- schemas: customConfiguration?.schemas,
178
- metadata: {
179
- name: "Intlayer",
180
- version: _intlayer_types_package_json.default.version,
181
- doc: `https://intlayer.org/docs`
182
- }
183
- };
184
- return storedConfiguration;
185
- };
186
-
187
- //#endregion
188
- exports.buildConfigurationFields = buildConfigurationFields;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../defaultValues/build.cjs`),n=require(`../defaultValues/compiler.cjs`),r=require(`../defaultValues/content.cjs`),i=require(`../defaultValues/dictionary.cjs`),a=require(`../defaultValues/editor.cjs`),o=require(`../defaultValues/internationalization.cjs`),s=require(`../defaultValues/log.cjs`),c=require(`../defaultValues/routing.cjs`),l=require(`../defaultValues/system.cjs`),u=require(`../utils/normalizePath.cjs`);let d=require(`node:path`),f=require(`node:fs`),p=require(`@intlayer/types/package.json`);p=e.__toESM(p);let m;const h=e=>({locales:e?.locales??o.LOCALES,requiredLocales:e?.requiredLocales??e?.locales??o.REQUIRED_LOCALES,strictMode:e?.strictMode??o.STRICT_MODE,defaultLocale:e?.defaultLocale??o.DEFAULT_LOCALE}),g=e=>({mode:e?.mode??c.ROUTING_MODE,storage:e?.storage??c.STORAGE,basePath:e?.basePath??c.BASE_PATH,rewrite:e?.rewrite}),_=(e,t,n)=>{let i=e?.fileExtensions??r.FILE_EXTENSIONS,a=e?.baseDir??t??process.cwd(),o=e=>{let t;try{t=require.resolve(e,{paths:[a]})}catch{t=(0,d.isAbsolute)(e)?e:(0,d.join)(a,e)}try{if((0,f.statSync)(t).isFile())return(0,d.dirname)(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return(0,d.dirname)(t)}return t},s=(e?.contentDir??r.CONTENT_DIR).map(o);return{fileExtensions:i,baseDir:a,contentDir:s,codeDir:(e?.codeDir??r.CODE_DIR).map(o),excludedPath:e?.excludedPath??r.EXCLUDED_PATHS,watch:e?.watch??r.WATCH,formatCommand:e?.formatCommand,watchedFilesPattern:i.map(e=>`/**/*${e}`),watchedFilesPatternWithPath:i.flatMap(e=>s.map(t=>`${u.normalizePath(t)}/**/*${e}`))}},v=(e,t)=>{let n=t?.baseDir??process.cwd(),r=e=>{let t;try{t=require.resolve(e,{paths:[n]})}catch{t=(0,d.isAbsolute)(e)?e:(0,d.join)(n,e)}try{if((0,f.statSync)(t).isFile())return(0,d.dirname)(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return(0,d.dirname)(t)}return t},i=r(e?.dictionariesDir??l.DICTIONARIES_DIR);return{moduleAugmentationDir:r(e?.moduleAugmentationDir??l.MODULE_AUGMENTATION_DIR),unmergedDictionariesDir:r(e?.unmergedDictionariesDir??l.UNMERGED_DICTIONARIES_DIR),remoteDictionariesDir:r(e?.remoteDictionariesDir??l.REMOTE_DICTIONARIES_DIR),dictionariesDir:i,dynamicDictionariesDir:r(e?.dynamicDictionariesDir??l.DYNAMIC_DICTIONARIES_DIR),fetchDictionariesDir:r(e?.fetchDictionariesDir??l.FETCH_DICTIONARIES_DIR),typesDir:r(e?.typesDir??l.TYPES_DIR),mainDir:r(e?.mainDir??l.MAIN_DIR),configDir:r(e?.configDir??l.CONFIG_DIR),cacheDir:r(e?.cacheDir??l.CACHE_DIR),outputFilesPatternWithPath:`${u.normalizePath(i)}/**/*.json`}},y=e=>({applicationURL:e?.applicationURL??a.APPLICATION_URL,editorURL:e?.editorURL??a.EDITOR_URL,cmsURL:e?.cmsURL??a.CMS_URL,backendURL:e?.backendURL??a.BACKEND_URL,port:e?.port??a.PORT,enabled:e?.enabled??a.IS_ENABLED,clientId:e?.clientId??void 0,clientSecret:e?.clientSecret??void 0,dictionaryPriorityStrategy:e?.dictionaryPriorityStrategy??a.DICTIONARY_PRIORITY_STRATEGY,liveSync:e?.liveSync??a.LIVE_SYNC,liveSyncPort:e?.liveSyncPort??a.LIVE_SYNC_PORT,liveSyncURL:e?.liveSyncURL??`http://localhost:${e?.liveSyncPort??a.LIVE_SYNC_PORT}`}),b=(e,t)=>({mode:e?.mode??s.MODE,prefix:e?.prefix??s.PREFIX,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),x=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),S=e=>({mode:e?.mode??t.BUILD_MODE,optimize:e?.optimize,importMode:e?.importMode,traversePattern:e?.traversePattern??t.TRAVERSE_PATTERN,outputFormat:e?.outputFormat??t.OUTPUT_FORMAT,cache:e?.cache??t.CACHE,require:e?.require}),C=e=>({enabled:e?.enabled??n.COMPILER_ENABLED,transformPattern:e?.transformPattern??n.COMPILER_TRANSFORM_PATTERN,excludePattern:e?.excludePattern??n.COMPILER_EXCLUDE_PATTERN,outputDir:e?.outputDir??n.COMPILER_OUTPUT_DIR}),w=e=>{let t=e?.contentAutoTransformation??i.CONTENT_AUTO_TRANSFORMATION;return{fill:e?.fill??i.FILL,contentAutoTransformation:typeof t==`object`?{markdown:t.markdown??!1,html:t.html??!1,insertion:t.insertion??!1}:t,location:e?.location??i.LOCATION,locale:e?.locale,title:e?.title,description:e?.description,tags:e?.tags,priority:e?.priority,importMode:e?.importMode??i.IMPORT_MODE,version:e?.version}},T=(e,t,n)=>{let r=h(e?.internationalization),i=g(e?.routing),a=_(e?.content,t,n);return m={internationalization:r,routing:i,content:a,system:v(e?.system,a),editor:y(e?.editor),log:b(e?.log,n),ai:x(e?.ai),build:S(e?.build),compiler:C(e?.compiler),dictionary:w(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:p.default.version,doc:`https://intlayer.org/docs`}},m};exports.buildConfigurationFields=T;
189
2
  //# sourceMappingURL=buildConfigurationFields.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildConfigurationFields.cjs","names":["LOCALES","REQUIRED_LOCALES","STRICT_MODE","DEFAULT_LOCALE","ROUTING_MODE","STORAGE","BASE_PATH","FILE_EXTENSIONS","CONTENT_DIR","CODE_DIR","EXCLUDED_PATHS","WATCH","normalizePath","DICTIONARIES_DIR","MODULE_AUGMENTATION_DIR","UNMERGED_DICTIONARIES_DIR","REMOTE_DICTIONARIES_DIR","DYNAMIC_DICTIONARIES_DIR","FETCH_DICTIONARIES_DIR","TYPES_DIR","MAIN_DIR","CONFIG_DIR","CACHE_DIR","APPLICATION_URL","EDITOR_URL","CMS_URL","BACKEND_URL","PORT","IS_ENABLED","DICTIONARY_PRIORITY_STRATEGY","LIVE_SYNC","LIVE_SYNC_PORT","MODE","PREFIX","BUILD_MODE","TRAVERSE_PATTERN","OUTPUT_FORMAT","CACHE","COMPILER_ENABLED","COMPILER_TRANSFORM_PATTERN","COMPILER_EXCLUDE_PATTERN","COMPILER_OUTPUT_DIR","CONTENT_AUTO_TRANSFORMATION","FILL","LOCATION","IMPORT_MODE","packageJson"],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { statSync } from 'node:fs';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport type {\n AiConfig,\n BuildConfig,\n CompilerConfig,\n ContentConfig,\n CustomIntlayerConfig,\n DictionaryConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n SystemConfig,\n} from '@intlayer/types';\nimport packageJson from '@intlayer/types/package.json' with { type: 'json' };\nimport {\n BUILD_MODE,\n CACHE,\n OUTPUT_FORMAT,\n TRAVERSE_PATTERN,\n} from '../defaultValues/build';\nimport {\n COMPILER_ENABLED,\n COMPILER_EXCLUDE_PATTERN,\n COMPILER_OUTPUT_DIR,\n COMPILER_TRANSFORM_PATTERN,\n} from '../defaultValues/compiler';\nimport {\n CODE_DIR,\n CONTENT_DIR,\n EXCLUDED_PATHS,\n FILE_EXTENSIONS,\n WATCH,\n} from '../defaultValues/content';\nimport {\n CONTENT_AUTO_TRANSFORMATION,\n FILL,\n IMPORT_MODE,\n LOCATION,\n} from '../defaultValues/dictionary';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n IS_ENABLED,\n LIVE_SYNC,\n LIVE_SYNC_PORT,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from '../defaultValues/routing';\nimport {\n CACHE_DIR,\n CONFIG_DIR,\n DICTIONARIES_DIR,\n DYNAMIC_DICTIONARIES_DIR,\n FETCH_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REMOTE_DICTIONARIES_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n} from '../defaultValues/system';\nimport { normalizePath } from '../utils/normalizePath';\n\nlet storedConfiguration: IntlayerConfig;\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"inclusive\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"inclusive\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildRoutingFields = (\n customConfiguration?: Partial<RoutingConfig>\n): RoutingConfig => ({\n /**\n * URL routing mode for locale handling\n *\n * Controls how locales are represented in application URLs:\n * - 'prefix-no-default': Prefix all locales except the default locale (default)\n * - en → /dashboard\n * - fr → /fr/dashboard\n *\n * - 'prefix-all': Prefix all locales including the default locale\n * - en → /en/dashboard\n * - fr → /fr/dashboard\n *\n * - 'search-params': Use search parameters for locale handling\n * - en → /dashboard?locale=en\n * - fr → /fr/dashboard?locale=fr\n *\n * - 'no-prefix': No locale prefixing in URLs\n * - en → /dashboard\n * - fr → /dashboard\n *\n * Default: 'prefix-no-default'\n */\n mode: customConfiguration?.mode ?? ROUTING_MODE,\n\n /**\n * Configuration for storing the locale in the client (localStorage or sessionStorage)\n *\n * If false, the locale will not be stored by the middleware.\n * If true, the locale storage will consider all default values. (cookie and header)\n *\n * Default: ['cookie', 'header']\n *\n */\n storage: customConfiguration?.storage ?? STORAGE,\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Custom URL rewriting rules that override the default routing mode for specific paths.\n * Allows you to define locale-specific paths that differ from the standard routing behavior.\n * Supports dynamic route parameters using `[param]` syntax.\n *\n * Default: undefined\n *\n * Example:\n * ```typescript\n * rewrite: {\n * \"/about\": {\n * en: \"/about\",\n * fr: \"/a-propos\",\n * },\n * \"/product/[slug]\": {\n * en: \"/product/[slug]\",\n * fr: \"/produit/[slug]\",\n * },\n * }\n * ```\n *\n * Note:\n * - The rewrite rules take precedence over the default `mode` behavior.\n * - If a path matches a rewrite rule, the localized path from the rewrite configuration will be used.\n * - Dynamic route parameters are supported using bracket notation (e.g., `[slug]`, `[id]`).\n * - Works with both Next.js and Vite applications.\n */\n rewrite: customConfiguration?.rewrite,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string,\n logFunctions?: LogFunctions\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n const projectBaseDir =\n customConfiguration?.baseDir ?? baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n // Try resolving as a Node module first (e.g. '@intlayer/design-system')\n // Passing { paths: [...] } ensures we look starting from your project baseDir\n absolutePath = require.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n // If resolution fails (it's not a module or it's a relative path like './src'),\n // fall back to standard path joining.\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n // Smart Detection: File vs Directory\n const stats = statSync(absolutePath);\n\n // If it resolved to a file (like package.json \"main\" or index.js),\n // we want the FOLDER containing that file.\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n // Safety Fallback:\n // If statSync fails but it looks like a file (has an extension), strip it.\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n // Return the calculated path (usually a directory)\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n\n const codeDirInput = customConfiguration?.codeDir;\n\n const codeDir = (codeDirInput ?? CODE_DIR).map(optionalJoinBaseDir);\n\n return {\n fileExtensions,\n baseDir: projectBaseDir,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),\n watchedFilesPatternWithPath: fileExtensions.flatMap((ext) =>\n contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`)\n ),\n };\n};\n\nconst buildSystemFields = (\n customConfiguration?: Partial<SystemConfig>,\n contentConfig?: ContentConfig\n): SystemConfig => {\n const projectBaseDir = contentConfig?.baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n absolutePath = require.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const dictionariesDir = optionalJoinBaseDir(\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n );\n\n return {\n moduleAugmentationDir: optionalJoinBaseDir(\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n unmergedDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n remoteDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR\n ),\n dictionariesDir,\n dynamicDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n fetchDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR\n ),\n typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n configDir: optionalJoinBaseDir(\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR),\n outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: true;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? undefined,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret: customConfiguration?.clientSecret ?? undefined,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n\n /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\n /**\n * Port of the live sync server\n *\n * Default: 4000\n */\n liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\n /**\n * URL of the live sync server in case of remote live sync server\n *\n * Default: `http://localhost:${LIVE_SYNC_PORT}`\n */\n liveSyncURL:\n customConfiguration?.liveSyncURL ??\n `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>,\n logFunctions?: LogFunctions\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'prefix-no-default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n\n /**\n * Functions to log\n */\n error: logFunctions?.error,\n log: logFunctions?.log,\n info: logFunctions?.info,\n warn: logFunctions?.warn,\n});\n\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n *\n * Default: undefined\n *\n * The application context.\n *\n * Example: `'My application context'`\n *\n * Note: Can be used to provide additional context about the application to the AI model. You can add more rules (e.g. \"You should not transform urls\").\n */\n applicationContext: customConfiguration?.applicationContext,\n\n /**\n * Base URL for the AI API\n *\n * Default: undefined\n *\n * The base URL for the AI API.\n *\n * Example: `'http://localhost:5000'`\n *\n * Note: Can be used to point to a local, or custom AI API endpoint.\n */\n baseURL: customConfiguration?.baseURL,\n\n /**\n * Data serialization\n *\n * Options:\n * - \"json\": The industry standard. Highly reliable and structured, but consumes more tokens.\n * - \"toon\": An optimized format designed to reduce token consumption (cost-effective). However, it may slightly increase the risk of output inconsistency compared to standard JSON\n *\n * Default: \"json\"\n */\n dataSerialization: customConfiguration?.dataSerialization,\n});\n\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates the mode of the build\n *\n * Default: 'auto'\n *\n * If 'auto', the build will be enabled automatically when the application is built.\n * If 'manual', the build will be set only when the build command is executed.\n *\n * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.\n */\n mode: customConfiguration?.mode ?? BUILD_MODE,\n\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * Live mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as \"dynamic\" mode.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If disabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n * - The \"live\" allows to sync the dictionaries to the live sync server.\n *\n * @deprecated Use `dictionary.importMode` instead.\n */\n importMode: customConfiguration?.importMode,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\n /**\n * Output format of the dictionaries\n *\n * Can be set on large projects to improve build performance.\n *\n * Default: ['cjs', 'esm']\n *\n * The output format of the dictionaries. It can be either 'cjs' or 'esm'.\n * - 'cjs': The dictionaries are outputted as CommonJS modules.\n * - 'esm': The dictionaries are outputted as ES modules.\n */\n outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\n /**\n * Cache\n */\n cache: customConfiguration?.cache ?? CACHE,\n\n /**\n * Require function\n */\n require: customConfiguration?.require,\n});\n\nconst buildCompilerFields = (\n customConfiguration?: Partial<CompilerConfig>\n): CompilerConfig => ({\n /**\n * Indicates if the compiler should be enabled\n */\n enabled: customConfiguration?.enabled ?? COMPILER_ENABLED,\n\n /**\n * Pattern to traverse the code to optimize.\n */\n transformPattern:\n customConfiguration?.transformPattern ?? COMPILER_TRANSFORM_PATTERN,\n\n /**\n * Pattern to exclude from the optimization.\n */\n excludePattern:\n customConfiguration?.excludePattern ?? COMPILER_EXCLUDE_PATTERN,\n\n /**\n * Output directory for the optimized dictionaries.\n */\n outputDir: customConfiguration?.outputDir ?? COMPILER_OUTPUT_DIR,\n});\n\nconst buildDictionaryFields = (\n customConfiguration?: Partial<DictionaryConfig>\n): DictionaryConfig => {\n const contentAutoTransformation =\n customConfiguration?.contentAutoTransformation ??\n CONTENT_AUTO_TRANSFORMATION;\n\n return {\n /**\n * Indicate how the dictionary should be filled using AI.\n *\n * Default: true\n */\n fill: customConfiguration?.fill ?? FILL,\n\n /**\n * Indicates if the content of the dictionary should be automatically transformed.\n *\n * Default: false\n */\n contentAutoTransformation:\n typeof contentAutoTransformation === 'object'\n ? {\n markdown: contentAutoTransformation.markdown ?? false,\n html: contentAutoTransformation.html ?? false,\n insertion: contentAutoTransformation.insertion ?? false,\n }\n : contentAutoTransformation,\n\n /**\n * The location of the dictionary.\n *\n * Default: 'local'\n */\n location: customConfiguration?.location ?? LOCATION,\n\n /**\n * Transform the dictionary in a per-locale dictionary.\n * Each field declared in a per-locale dictionary will be transformed in a translation node.\n * If missing, the dictionary will be treated as a multilingual dictionary.\n */\n locale: customConfiguration?.locale,\n\n /**\n * The title of the dictionary.\n */\n title: customConfiguration?.title,\n\n /**\n * The description of the dictionary.\n */\n description: customConfiguration?.description,\n\n /**\n * Tags to categorize the dictionaries.\n */\n tags: customConfiguration?.tags,\n\n /**\n * The priority of the dictionary.\n */\n priority: customConfiguration?.priority,\n\n /**\n * Indicates the mode of import to use for the dictionary.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n *\n * Default: 'static'\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\n /**\n * The version of the dictionary.\n */\n version: customConfiguration?.version,\n };\n};\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const routingConfig = buildRoutingFields(customConfiguration?.routing);\n\n const contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir,\n logFunctions\n );\n\n const systemConfig = buildSystemFields(\n customConfiguration?.system,\n contentConfig\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n const compilerConfig = buildCompilerFields(customConfiguration?.compiler);\n\n const dictionaryConfig = buildDictionaryFields(\n customConfiguration?.dictionary\n );\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n routing: routingConfig,\n content: contentConfig,\n system: systemConfig,\n editor: editorConfig,\n log: logConfig,\n ai: aiConfig,\n build: buildConfig,\n compiler: compilerConfig,\n dictionary: dictionaryConfig,\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n metadata: {\n name: 'Intlayer',\n version: packageJson.version,\n doc: `https://intlayer.org/docs`,\n },\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":"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"}
1
+ {"version":3,"file":"buildConfigurationFields.cjs","names":["LOCALES","REQUIRED_LOCALES","STRICT_MODE","DEFAULT_LOCALE","ROUTING_MODE","STORAGE","BASE_PATH","FILE_EXTENSIONS","CONTENT_DIR","CODE_DIR","EXCLUDED_PATHS","WATCH","normalizePath","DICTIONARIES_DIR","MODULE_AUGMENTATION_DIR","UNMERGED_DICTIONARIES_DIR","REMOTE_DICTIONARIES_DIR","DYNAMIC_DICTIONARIES_DIR","FETCH_DICTIONARIES_DIR","TYPES_DIR","MAIN_DIR","CONFIG_DIR","CACHE_DIR","APPLICATION_URL","EDITOR_URL","CMS_URL","BACKEND_URL","PORT","IS_ENABLED","DICTIONARY_PRIORITY_STRATEGY","LIVE_SYNC","LIVE_SYNC_PORT","MODE","PREFIX","BUILD_MODE","TRAVERSE_PATTERN","OUTPUT_FORMAT","CACHE","COMPILER_ENABLED","COMPILER_TRANSFORM_PATTERN","COMPILER_EXCLUDE_PATTERN","COMPILER_OUTPUT_DIR","CONTENT_AUTO_TRANSFORMATION","FILL","LOCATION","IMPORT_MODE","packageJson"],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { statSync } from 'node:fs';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport type {\n AiConfig,\n BuildConfig,\n CompilerConfig,\n ContentConfig,\n CustomIntlayerConfig,\n DictionaryConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n SystemConfig,\n} from '@intlayer/types';\nimport packageJson from '@intlayer/types/package.json' with { type: 'json' };\nimport {\n BUILD_MODE,\n CACHE,\n OUTPUT_FORMAT,\n TRAVERSE_PATTERN,\n} from '../defaultValues/build';\nimport {\n COMPILER_ENABLED,\n COMPILER_EXCLUDE_PATTERN,\n COMPILER_OUTPUT_DIR,\n COMPILER_TRANSFORM_PATTERN,\n} from '../defaultValues/compiler';\nimport {\n CODE_DIR,\n CONTENT_DIR,\n EXCLUDED_PATHS,\n FILE_EXTENSIONS,\n WATCH,\n} from '../defaultValues/content';\nimport {\n CONTENT_AUTO_TRANSFORMATION,\n FILL,\n IMPORT_MODE,\n LOCATION,\n} from '../defaultValues/dictionary';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n IS_ENABLED,\n LIVE_SYNC,\n LIVE_SYNC_PORT,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from '../defaultValues/routing';\nimport {\n CACHE_DIR,\n CONFIG_DIR,\n DICTIONARIES_DIR,\n DYNAMIC_DICTIONARIES_DIR,\n FETCH_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REMOTE_DICTIONARIES_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n} from '../defaultValues/system';\nimport { normalizePath } from '../utils/normalizePath';\n\nlet storedConfiguration: IntlayerConfig;\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"inclusive\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"inclusive\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildRoutingFields = (\n customConfiguration?: Partial<RoutingConfig>\n): RoutingConfig => ({\n /**\n * URL routing mode for locale handling\n *\n * Controls how locales are represented in application URLs:\n * - 'prefix-no-default': Prefix all locales except the default locale (default)\n * - en → /dashboard\n * - fr → /fr/dashboard\n *\n * - 'prefix-all': Prefix all locales including the default locale\n * - en → /en/dashboard\n * - fr → /fr/dashboard\n *\n * - 'search-params': Use search parameters for locale handling\n * - en → /dashboard?locale=en\n * - fr → /fr/dashboard?locale=fr\n *\n * - 'no-prefix': No locale prefixing in URLs\n * - en → /dashboard\n * - fr → /dashboard\n *\n * Default: 'prefix-no-default'\n */\n mode: customConfiguration?.mode ?? ROUTING_MODE,\n\n /**\n * Configuration for storing the locale in the client (localStorage or sessionStorage)\n *\n * If false, the locale will not be stored by the middleware.\n * If true, the locale storage will consider all default values. (cookie and header)\n *\n * Default: ['cookie', 'header']\n *\n */\n storage: customConfiguration?.storage ?? STORAGE,\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Custom URL rewriting rules that override the default routing mode for specific paths.\n * Allows you to define locale-specific paths that differ from the standard routing behavior.\n * Supports dynamic route parameters using `[param]` syntax.\n *\n * Default: undefined\n *\n * Example:\n * ```typescript\n * rewrite: {\n * \"/about\": {\n * en: \"/about\",\n * fr: \"/a-propos\",\n * },\n * \"/product/[slug]\": {\n * en: \"/product/[slug]\",\n * fr: \"/produit/[slug]\",\n * },\n * }\n * ```\n *\n * Note:\n * - The rewrite rules take precedence over the default `mode` behavior.\n * - If a path matches a rewrite rule, the localized path from the rewrite configuration will be used.\n * - Dynamic route parameters are supported using bracket notation (e.g., `[slug]`, `[id]`).\n * - Works with both Next.js and Vite applications.\n */\n rewrite: customConfiguration?.rewrite,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string,\n logFunctions?: LogFunctions\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n const projectBaseDir =\n customConfiguration?.baseDir ?? baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n // Try resolving as a Node module first (e.g. '@intlayer/design-system')\n // Passing { paths: [...] } ensures we look starting from your project baseDir\n absolutePath = require.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n // If resolution fails (it's not a module or it's a relative path like './src'),\n // fall back to standard path joining.\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n // Smart Detection: File vs Directory\n const stats = statSync(absolutePath);\n\n // If it resolved to a file (like package.json \"main\" or index.js),\n // we want the FOLDER containing that file.\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n // Safety Fallback:\n // If statSync fails but it looks like a file (has an extension), strip it.\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n // Return the calculated path (usually a directory)\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n\n const codeDirInput = customConfiguration?.codeDir;\n\n const codeDir = (codeDirInput ?? CODE_DIR).map(optionalJoinBaseDir);\n\n return {\n fileExtensions,\n baseDir: projectBaseDir,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),\n watchedFilesPatternWithPath: fileExtensions.flatMap((ext) =>\n contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`)\n ),\n };\n};\n\nconst buildSystemFields = (\n customConfiguration?: Partial<SystemConfig>,\n contentConfig?: ContentConfig\n): SystemConfig => {\n const projectBaseDir = contentConfig?.baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n absolutePath = require.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const dictionariesDir = optionalJoinBaseDir(\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n );\n\n return {\n moduleAugmentationDir: optionalJoinBaseDir(\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n unmergedDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n remoteDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR\n ),\n dictionariesDir,\n dynamicDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n fetchDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR\n ),\n typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n configDir: optionalJoinBaseDir(\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR),\n outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: true;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? undefined,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret: customConfiguration?.clientSecret ?? undefined,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n\n /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\n /**\n * Port of the live sync server\n *\n * Default: 4000\n */\n liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\n /**\n * URL of the live sync server in case of remote live sync server\n *\n * Default: `http://localhost:${LIVE_SYNC_PORT}`\n */\n liveSyncURL:\n customConfiguration?.liveSyncURL ??\n `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>,\n logFunctions?: LogFunctions\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'prefix-no-default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n\n /**\n * Functions to log\n */\n error: logFunctions?.error,\n log: logFunctions?.log,\n info: logFunctions?.info,\n warn: logFunctions?.warn,\n});\n\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n *\n * Default: undefined\n *\n * The application context.\n *\n * Example: `'My application context'`\n *\n * Note: Can be used to provide additional context about the application to the AI model. You can add more rules (e.g. \"You should not transform urls\").\n */\n applicationContext: customConfiguration?.applicationContext,\n\n /**\n * Base URL for the AI API\n *\n * Default: undefined\n *\n * The base URL for the AI API.\n *\n * Example: `'http://localhost:5000'`\n *\n * Note: Can be used to point to a local, or custom AI API endpoint.\n */\n baseURL: customConfiguration?.baseURL,\n\n /**\n * Data serialization\n *\n * Options:\n * - \"json\": The industry standard. Highly reliable and structured, but consumes more tokens.\n * - \"toon\": An optimized format designed to reduce token consumption (cost-effective). However, it may slightly increase the risk of output inconsistency compared to standard JSON\n *\n * Default: \"json\"\n */\n dataSerialization: customConfiguration?.dataSerialization,\n});\n\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates the mode of the build\n *\n * Default: 'auto'\n *\n * If 'auto', the build will be enabled automatically when the application is built.\n * If 'manual', the build will be set only when the build command is executed.\n *\n * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.\n */\n mode: customConfiguration?.mode ?? BUILD_MODE,\n\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * Live mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as \"dynamic\" mode.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If disabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n * - The \"live\" allows to sync the dictionaries to the live sync server.\n *\n * @deprecated Use `dictionary.importMode` instead.\n */\n importMode: customConfiguration?.importMode,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\n /**\n * Output format of the dictionaries\n *\n * Can be set on large projects to improve build performance.\n *\n * Default: ['cjs', 'esm']\n *\n * The output format of the dictionaries. It can be either 'cjs' or 'esm'.\n * - 'cjs': The dictionaries are outputted as CommonJS modules.\n * - 'esm': The dictionaries are outputted as ES modules.\n */\n outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\n /**\n * Cache\n */\n cache: customConfiguration?.cache ?? CACHE,\n\n /**\n * Require function\n */\n require: customConfiguration?.require,\n});\n\nconst buildCompilerFields = (\n customConfiguration?: Partial<CompilerConfig>\n): CompilerConfig => ({\n /**\n * Indicates if the compiler should be enabled\n */\n enabled: customConfiguration?.enabled ?? COMPILER_ENABLED,\n\n /**\n * Pattern to traverse the code to optimize.\n */\n transformPattern:\n customConfiguration?.transformPattern ?? COMPILER_TRANSFORM_PATTERN,\n\n /**\n * Pattern to exclude from the optimization.\n */\n excludePattern:\n customConfiguration?.excludePattern ?? COMPILER_EXCLUDE_PATTERN,\n\n /**\n * Output directory for the optimized dictionaries.\n */\n outputDir: customConfiguration?.outputDir ?? COMPILER_OUTPUT_DIR,\n});\n\nconst buildDictionaryFields = (\n customConfiguration?: Partial<DictionaryConfig>\n): DictionaryConfig => {\n const contentAutoTransformation =\n customConfiguration?.contentAutoTransformation ??\n CONTENT_AUTO_TRANSFORMATION;\n\n return {\n /**\n * Indicate how the dictionary should be filled using AI.\n *\n * Default: true\n */\n fill: customConfiguration?.fill ?? FILL,\n\n /**\n * Indicates if the content of the dictionary should be automatically transformed.\n *\n * Default: false\n */\n contentAutoTransformation:\n typeof contentAutoTransformation === 'object'\n ? {\n markdown: contentAutoTransformation.markdown ?? false,\n html: contentAutoTransformation.html ?? false,\n insertion: contentAutoTransformation.insertion ?? false,\n }\n : contentAutoTransformation,\n\n /**\n * The location of the dictionary.\n *\n * Default: 'local'\n */\n location: customConfiguration?.location ?? LOCATION,\n\n /**\n * Transform the dictionary in a per-locale dictionary.\n * Each field declared in a per-locale dictionary will be transformed in a translation node.\n * If missing, the dictionary will be treated as a multilingual dictionary.\n */\n locale: customConfiguration?.locale,\n\n /**\n * The title of the dictionary.\n */\n title: customConfiguration?.title,\n\n /**\n * The description of the dictionary.\n */\n description: customConfiguration?.description,\n\n /**\n * Tags to categorize the dictionaries.\n */\n tags: customConfiguration?.tags,\n\n /**\n * The priority of the dictionary.\n */\n priority: customConfiguration?.priority,\n\n /**\n * Indicates the mode of import to use for the dictionary.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n *\n * Default: 'static'\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\n /**\n * The version of the dictionary.\n */\n version: customConfiguration?.version,\n };\n};\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const routingConfig = buildRoutingFields(customConfiguration?.routing);\n\n const contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir,\n logFunctions\n );\n\n const systemConfig = buildSystemFields(\n customConfiguration?.system,\n contentConfig\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n const compilerConfig = buildCompilerFields(customConfiguration?.compiler);\n\n const dictionaryConfig = buildDictionaryFields(\n customConfiguration?.dictionary\n );\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n routing: routingConfig,\n content: contentConfig,\n system: systemConfig,\n editor: editorConfig,\n log: logConfig,\n ai: aiConfig,\n build: buildConfig,\n compiler: compilerConfig,\n dictionary: dictionaryConfig,\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n metadata: {\n name: 'Intlayer',\n version: packageJson.version,\n doc: `https://intlayer.org/docs`,\n },\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":"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"}
@@ -1,71 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_logger = require('../logger.cjs');
4
- const require_utils_cacheMemory = require('../utils/cacheMemory.cjs');
5
- const require_utils_getPackageJsonPath = require('../utils/getPackageJsonPath.cjs');
6
- const require_configFile_buildConfigurationFields = require('./buildConfigurationFields.cjs');
7
- const require_configFile_searchConfigurationFile = require('./searchConfigurationFile.cjs');
8
- const require_configFile_loadConfigurationFile = require('./loadConfigurationFile.cjs');
9
- let node_path = require("node:path");
10
- let defu = require("defu");
11
-
12
- //#region src/configFile/getConfiguration.ts
13
- /**
14
- * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
15
- */
16
- const getConfigurationAndFilePath = (options) => {
17
- let baseDir;
18
- try {
19
- baseDir = options?.baseDir ?? require_utils_getPackageJsonPath.getPackageJsonPath().baseDir;
20
- } catch (_err) {
21
- return {
22
- configuration: require_configFile_buildConfigurationFields.buildConfigurationFields({}, options?.baseDir, options?.logFunctions),
23
- configurationFilePath: void 0
24
- };
25
- }
26
- const cachedConfiguration = require_utils_cacheMemory.cacheMemory.get(options);
27
- if (cachedConfiguration) return cachedConfiguration;
28
- const { configurationFilePath, numCustomConfiguration } = require_configFile_searchConfigurationFile.searchConfigurationFile(baseDir);
29
- if (options?.override?.log?.mode === "verbose") logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);
30
- let storedConfiguration;
31
- if (configurationFilePath) storedConfiguration = require_configFile_buildConfigurationFields.buildConfigurationFields(require_configFile_loadConfigurationFile.loadConfigurationFile(configurationFilePath, {
32
- projectRequire: options?.require,
33
- envVarOptions: {
34
- env: options?.env,
35
- envFile: options?.envFile
36
- },
37
- additionalEnvVars: options?.additionalEnvVars,
38
- aliases: options?.aliases
39
- }), options?.baseDir, options?.logFunctions);
40
- else storedConfiguration = require_configFile_buildConfigurationFields.buildConfigurationFields({}, options?.baseDir, options?.logFunctions);
41
- const configWithProjectRequire = (0, defu.defu)(options?.require ? { build: {
42
- require: options?.require,
43
- cache: options?.cache
44
- } } : {}, storedConfiguration);
45
- const configuration = (0, defu.defu)(options?.override ?? {}, configWithProjectRequire);
46
- require_utils_cacheMemory.cacheMemory.set(options, {
47
- configuration,
48
- configurationFilePath
49
- });
50
- return {
51
- configuration,
52
- configurationFilePath
53
- };
54
- };
55
- /**
56
- * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
57
- */
58
- const getConfiguration = (options) => getConfigurationAndFilePath(options).configuration;
59
- const logConfigFileResult = (baseDir, numCustomConfiguration, configurationFilePath) => {
60
- if (numCustomConfiguration === 0) require_logger.logger("Configuration file not found, using default configuration.", { isVerbose: true });
61
- else {
62
- const relativeOutputPath = (0, node_path.relative)(baseDir, configurationFilePath);
63
- if (numCustomConfiguration === 1) require_logger.logger(`Configuration file found: ${relativeOutputPath}.`, { isVerbose: true });
64
- else require_logger.logger(`Multiple configuration files found, using ${relativeOutputPath}.`, { isVerbose: true });
65
- }
66
- };
67
-
68
- //#endregion
69
- exports.getConfiguration = getConfiguration;
70
- exports.getConfigurationAndFilePath = getConfigurationAndFilePath;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../logger.cjs`),t=require(`../utils/cacheMemory.cjs`),n=require(`../utils/getPackageJsonPath.cjs`),r=require(`./buildConfigurationFields.cjs`),i=require(`./loadConfigurationFile.cjs`),a=require(`./searchConfigurationFile.cjs`);let o=require(`node:path`),s=require(`defu`);const c=e=>{let o;try{o=e?.baseDir??n.getPackageJsonPath().baseDir}catch{return{configuration:r.buildConfigurationFields({},e?.baseDir,e?.logFunctions),configurationFilePath:void 0}}let c=t.cacheMemory.get(e);if(c)return c;let{configurationFilePath:l,numCustomConfiguration:d}=a.searchConfigurationFile(o);e?.override?.log?.mode===`verbose`&&u(o,d,l);let f;f=l?r.buildConfigurationFields(i.loadConfigurationFile(l,{projectRequire:e?.require,envVarOptions:{env:e?.env,envFile:e?.envFile},additionalEnvVars:e?.additionalEnvVars,aliases:e?.aliases}),e?.baseDir,e?.logFunctions):r.buildConfigurationFields({},e?.baseDir,e?.logFunctions);let p=(0,s.defu)(e?.require?{build:{require:e?.require,cache:e?.cache}}:{},f),m=(0,s.defu)(e?.override??{},p);return t.cacheMemory.set(e,{configuration:m,configurationFilePath:l}),{configuration:m,configurationFilePath:l}},l=e=>c(e).configuration,u=(t,n,r)=>{if(n===0)e.logger(`Configuration file not found, using default configuration.`,{isVerbose:!0});else{let i=(0,o.relative)(t,r);n===1?e.logger(`Configuration file found: ${i}.`,{isVerbose:!0}):e.logger(`Multiple configuration files found, using ${i}.`,{isVerbose:!0})}};exports.getConfiguration=l,exports.getConfigurationAndFilePath=c;
71
2
  //# sourceMappingURL=getConfiguration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getConfiguration.cjs","names":["getPackageJsonPath","buildConfigurationFields","cacheMemory","searchConfigurationFile","loadConfigurationFile"],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types';\nimport { defu } from 'defu';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { logger } from '../logger';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n if (options?.override?.log?.mode === 'verbose') {\n logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);\n }\n\n let storedConfiguration: IntlayerConfig;\n\n if (configurationFilePath) {\n // Load the custom configuration\n const customConfiguration: CustomIntlayerConfig | undefined =\n loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n configurationFilePath,\n });\n\n return {\n configuration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n\nconst logConfigFileResult = (\n baseDir: string,\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;AAqCA,MAAa,+BACX,YACsC;CACtC,IAAI;AAEJ,KAAI;AAEF,YAAU,SAAS,WAAWA,qDAAoB,CAAC;UAC5C,MAAM;AAEb,SAAO;GACL,eAAeC,qEACb,EAAE,EACF,SAAS,SACT,SAAS,aACV;GACD,uBAAuB;GACxB;;CAGH,MAAM,sBACJC,sCAAY,IAAuC,QAAQ;AAE7D,KAAI,oBAAqB,QAAO;CAGhC,MAAM,EAAE,uBAAuB,2BAC7BC,mEAAwB,QAAQ;AAElC,KAAI,SAAS,UAAU,KAAK,SAAS,UACnC,qBAAoB,SAAS,wBAAwB,sBAAsB;CAG7E,IAAI;AAEJ,KAAI,sBAgBF,uBAAsBF,qEAbpBG,+DAAsB,uBAAuB;EAC3C,gBAAgB,SAAS;EAEzB,eAAe;GACb,KAAK,SAAS;GACd,SAAS,SAAS;GACnB;EAED,mBAAmB,SAAS;EAC5B,SAAS,SAAS;EACnB,CAAC,EAKF,SAAS,SACT,SAAS,aACV;KAGD,uBAAsBH,qEACpB,EAAE,EACF,SAAS,SACT,SAAS,aACV;CAcH,MAAM,0CAT6C,SAAS,UACxD,EACE,OAAO;EACL,SAAS,SAAS;EAClB,OAAO,SAAS;EACjB,EACF,GACD,EAAE,EAIJ,oBACD;CAED,MAAM,+BACJ,SAAS,YAAY,EAAE,EACvB,yBACD;AAED,uCAAY,IAAI,SAAS;EACvB;EACA;EACD,CAAC;AAEF,QAAO;EACL;EACA;EACD;;;;;AAMH,MAAa,oBACX,YACmB,4BAA4B,QAAQ,CAAC;AAE1D,MAAM,uBACJ,SACA,wBACA,0BACG;AACH,KAAI,2BAA2B,EAC7B,uBAAO,8DAA8D,EACnE,WAAW,MACZ,CAAC;MACG;EACL,MAAM,6CAA8B,SAAS,sBAAuB;AAEpE,MAAI,2BAA2B,EAC7B,uBAAO,6BAA6B,mBAAmB,IAAI,EACzD,WAAW,MACZ,CAAC;MAEF,uBACE,6CAA6C,mBAAmB,IAChE,EACE,WAAW,MACZ,CACF"}
1
+ {"version":3,"file":"getConfiguration.cjs","names":["getPackageJsonPath","buildConfigurationFields","cacheMemory","searchConfigurationFile","loadConfigurationFile"],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types';\nimport { defu } from 'defu';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { logger } from '../logger';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n if (options?.override?.log?.mode === 'verbose') {\n logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);\n }\n\n let storedConfiguration: IntlayerConfig;\n\n if (configurationFilePath) {\n // Load the custom configuration\n const customConfiguration: CustomIntlayerConfig | undefined =\n loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n configurationFilePath,\n });\n\n return {\n configuration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n\nconst logConfigFileResult = (\n baseDir: string,\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":"iZAqCA,MAAa,EACX,GACsC,CACtC,IAAI,EAEJ,GAAI,CAEF,EAAU,GAAS,SAAWA,EAAAA,oBAAoB,CAAC,aACtC,CAEb,MAAO,CACL,cAAeC,EAAAA,yBACb,EAAE,CACF,GAAS,QACT,GAAS,aACV,CACD,sBAAuB,IAAA,GACxB,CAGH,IAAM,EACJC,EAAAA,YAAY,IAAuC,EAAQ,CAE7D,GAAI,EAAqB,OAAO,EAGhC,GAAM,CAAE,wBAAuB,0BAC7BC,EAAAA,wBAAwB,EAAQ,CAE9B,GAAS,UAAU,KAAK,OAAS,WACnC,EAAoB,EAAS,EAAwB,EAAsB,CAG7E,IAAI,EAEJ,AAuBE,EAvBE,EAgBoBF,EAAAA,yBAbpBG,EAAAA,sBAAsB,EAAuB,CAC3C,eAAgB,GAAS,QAEzB,cAAe,CACb,IAAK,GAAS,IACd,QAAS,GAAS,QACnB,CAED,kBAAmB,GAAS,kBAC5B,QAAS,GAAS,QACnB,CAAC,CAKF,GAAS,QACT,GAAS,aACV,CAGqBH,EAAAA,yBACpB,EAAE,CACF,GAAS,QACT,GAAS,aACV,CAcH,IAAM,GAAA,EAAA,EAAA,MAT6C,GAAS,QACxD,CACE,MAAO,CACL,QAAS,GAAS,QAClB,MAAO,GAAS,MACjB,CACF,CACD,EAAE,CAIJ,EACD,CAEK,GAAA,EAAA,EAAA,MACJ,GAAS,UAAY,EAAE,CACvB,EACD,CAOD,OALA,EAAA,YAAY,IAAI,EAAS,CACvB,gBACA,wBACD,CAAC,CAEK,CACL,gBACA,wBACD,EAMU,EACX,GACmB,EAA4B,EAAQ,CAAC,cAEpD,GACJ,EACA,EACA,IACG,CACH,GAAI,IAA2B,EAC7B,EAAA,OAAO,6DAA8D,CACnE,UAAW,GACZ,CAAC,KACG,CACL,IAAM,GAAA,EAAA,EAAA,UAA8B,EAAS,EAAuB,CAEhE,IAA2B,EAC7B,EAAA,OAAO,6BAA6B,EAAmB,GAAI,CACzD,UAAW,GACZ,CAAC,CAEF,EAAA,OACE,6CAA6C,EAAmB,GAChE,CACE,UAAW,GACZ,CACF"}
@@ -1,10 +1 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_configFile_buildConfigurationFields = require('./buildConfigurationFields.cjs');
3
- const require_configFile_searchConfigurationFile = require('./searchConfigurationFile.cjs');
4
- const require_configFile_getConfiguration = require('./getConfiguration.cjs');
5
-
6
- exports.buildConfigurationFields = require_configFile_buildConfigurationFields.buildConfigurationFields;
7
- exports.configurationFilesCandidates = require_configFile_searchConfigurationFile.configurationFilesCandidates;
8
- exports.getConfiguration = require_configFile_getConfiguration.getConfiguration;
9
- exports.getConfigurationAndFilePath = require_configFile_getConfiguration.getConfigurationAndFilePath;
10
- exports.searchConfigurationFile = require_configFile_searchConfigurationFile.searchConfigurationFile;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./buildConfigurationFields.cjs`),t=require(`./searchConfigurationFile.cjs`),n=require(`./getConfiguration.cjs`);exports.buildConfigurationFields=e.buildConfigurationFields,exports.configurationFilesCandidates=t.configurationFilesCandidates,exports.getConfiguration=n.getConfiguration,exports.getConfigurationAndFilePath=n.getConfigurationAndFilePath,exports.searchConfigurationFile=t.searchConfigurationFile;