@intlayer/config 6.1.6 → 7.0.0-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/dist/cjs/_virtual/rolldown_runtime.cjs +34 -0
  2. package/dist/cjs/alias.cjs +27 -100
  3. package/dist/cjs/alias.cjs.map +1 -1
  4. package/dist/cjs/built.cjs +7 -25
  5. package/dist/cjs/built.cjs.map +1 -1
  6. package/dist/cjs/bundleJSFile.cjs +30 -51
  7. package/dist/cjs/bundleJSFile.cjs.map +1 -1
  8. package/dist/cjs/client.cjs +19 -52
  9. package/dist/cjs/configFile/buildConfigurationFields.cjs +100 -657
  10. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  11. package/dist/cjs/configFile/getConfiguration.cjs +60 -114
  12. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  13. package/dist/cjs/configFile/index.cjs +8 -25
  14. package/dist/cjs/configFile/loadConfigurationFile.cjs +22 -47
  15. package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
  16. package/dist/cjs/configFile/searchConfigurationFile.cjs +49 -55
  17. package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
  18. package/dist/cjs/defaultValues/build.cjs +23 -35
  19. package/dist/cjs/defaultValues/build.cjs.map +1 -1
  20. package/dist/cjs/defaultValues/content.cjs +68 -70
  21. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  22. package/dist/cjs/defaultValues/editor.cjs +29 -41
  23. package/dist/cjs/defaultValues/editor.cjs.map +1 -1
  24. package/dist/cjs/defaultValues/index.cjs +62 -0
  25. package/dist/cjs/defaultValues/index.cjs.map +1 -0
  26. package/dist/cjs/defaultValues/internationalization.cjs +23 -34
  27. package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
  28. package/dist/cjs/defaultValues/log.cjs +17 -29
  29. package/dist/cjs/defaultValues/log.cjs.map +1 -1
  30. package/dist/cjs/defaultValues/routing.cjs +38 -0
  31. package/dist/cjs/defaultValues/routing.cjs.map +1 -0
  32. package/dist/cjs/extractErrorMessage.cjs +95 -0
  33. package/dist/cjs/extractErrorMessage.cjs.map +1 -0
  34. package/dist/cjs/index.cjs +67 -98
  35. package/dist/cjs/loadEnvFile.cjs +30 -51
  36. package/dist/cjs/loadEnvFile.cjs.map +1 -1
  37. package/dist/cjs/loadExternalFile/bundleFile.cjs +74 -0
  38. package/dist/cjs/loadExternalFile/bundleFile.cjs.map +1 -0
  39. package/dist/cjs/loadExternalFile/loadExternalFile.cjs +86 -0
  40. package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -0
  41. package/dist/cjs/loadExternalFile/parseFileContent.cjs +67 -0
  42. package/dist/cjs/loadExternalFile/parseFileContent.cjs.map +1 -0
  43. package/dist/cjs/loadExternalFile/transpileTSToMJS.cjs +60 -0
  44. package/dist/cjs/loadExternalFile/transpileTSToMJS.cjs.map +1 -0
  45. package/dist/cjs/logger.cjs +124 -152
  46. package/dist/cjs/logger.cjs.map +1 -1
  47. package/dist/cjs/package.cjs +12 -0
  48. package/dist/cjs/package.cjs.map +1 -0
  49. package/dist/cjs/retryManager.cjs +42 -49
  50. package/dist/cjs/retryManager.cjs.map +1 -1
  51. package/dist/cjs/utils/ESMxCJSHelpers.cjs +24 -33
  52. package/dist/cjs/utils/ESMxCJSHelpers.cjs.map +1 -1
  53. package/dist/cjs/utils/cache.cjs +426 -0
  54. package/dist/cjs/utils/cache.cjs.map +1 -0
  55. package/dist/cjs/utils/clearModuleCache.cjs +23 -46
  56. package/dist/cjs/utils/clearModuleCache.cjs.map +1 -1
  57. package/dist/cjs/utils/extractErrorMessage.cjs +95 -0
  58. package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -0
  59. package/dist/cjs/utils/getExtension.cjs +12 -35
  60. package/dist/cjs/utils/getExtension.cjs.map +1 -1
  61. package/dist/cjs/utils/getPackageJsonPath.cjs +37 -0
  62. package/dist/cjs/utils/getPackageJsonPath.cjs.map +1 -0
  63. package/dist/cjs/utils/logStack.cjs +16 -0
  64. package/dist/cjs/utils/logStack.cjs.map +1 -0
  65. package/dist/cjs/utils/normalizePath.cjs +15 -27
  66. package/dist/cjs/utils/normalizePath.cjs.map +1 -1
  67. package/dist/esm/_virtual/rolldown_runtime.mjs +17 -0
  68. package/dist/esm/alias.mjs +23 -74
  69. package/dist/esm/alias.mjs.map +1 -1
  70. package/dist/esm/built.mjs +5 -3
  71. package/dist/esm/built.mjs.map +1 -1
  72. package/dist/esm/bundleJSFile.mjs +26 -25
  73. package/dist/esm/bundleJSFile.mjs.map +1 -1
  74. package/dist/esm/client.mjs +4 -31
  75. package/dist/esm/configFile/buildConfigurationFields.mjs +97 -674
  76. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  77. package/dist/esm/configFile/getConfiguration.mjs +52 -75
  78. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  79. package/dist/esm/configFile/index.mjs +5 -3
  80. package/dist/esm/configFile/loadConfigurationFile.mjs +22 -23
  81. package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
  82. package/dist/esm/configFile/searchConfigurationFile.mjs +45 -30
  83. package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
  84. package/dist/esm/defaultValues/build.mjs +16 -11
  85. package/dist/esm/defaultValues/build.mjs.map +1 -1
  86. package/dist/esm/defaultValues/content.mjs +48 -34
  87. package/dist/esm/defaultValues/content.mjs.map +1 -1
  88. package/dist/esm/defaultValues/editor.mjs +17 -11
  89. package/dist/esm/defaultValues/editor.mjs.map +1 -1
  90. package/dist/esm/defaultValues/index.mjs +21 -0
  91. package/dist/esm/defaultValues/index.mjs.map +1 -0
  92. package/dist/esm/defaultValues/internationalization.mjs +13 -7
  93. package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
  94. package/dist/esm/defaultValues/log.mjs +10 -4
  95. package/dist/esm/defaultValues/log.mjs.map +1 -1
  96. package/dist/esm/defaultValues/routing.mjs +25 -0
  97. package/dist/esm/defaultValues/routing.mjs.map +1 -0
  98. package/dist/esm/extractErrorMessage.mjs +94 -0
  99. package/dist/esm/extractErrorMessage.mjs.map +1 -0
  100. package/dist/esm/index.mjs +18 -61
  101. package/dist/esm/loadEnvFile.mjs +27 -17
  102. package/dist/esm/loadEnvFile.mjs.map +1 -1
  103. package/dist/esm/loadExternalFile/bundleFile.mjs +68 -0
  104. package/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -0
  105. package/dist/esm/loadExternalFile/loadExternalFile.mjs +81 -0
  106. package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -0
  107. package/dist/esm/loadExternalFile/parseFileContent.mjs +63 -0
  108. package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -0
  109. package/dist/esm/loadExternalFile/transpileTSToMJS.mjs +55 -0
  110. package/dist/esm/loadExternalFile/transpileTSToMJS.mjs.map +1 -0
  111. package/dist/esm/logger.mjs +110 -115
  112. package/dist/esm/logger.mjs.map +1 -1
  113. package/dist/esm/package.mjs +6 -0
  114. package/dist/esm/package.mjs.map +1 -0
  115. package/dist/esm/retryManager.mjs +40 -23
  116. package/dist/esm/retryManager.mjs.map +1 -1
  117. package/dist/esm/utils/ESMxCJSHelpers.mjs +20 -6
  118. package/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -1
  119. package/dist/esm/utils/cache.mjs +414 -0
  120. package/dist/esm/utils/cache.mjs.map +1 -0
  121. package/dist/esm/utils/clearModuleCache.mjs +22 -21
  122. package/dist/esm/utils/clearModuleCache.mjs.map +1 -1
  123. package/dist/esm/utils/extractErrorMessage.mjs +94 -0
  124. package/dist/esm/utils/extractErrorMessage.mjs.map +1 -0
  125. package/dist/esm/utils/getExtension.mjs +11 -11
  126. package/dist/esm/utils/getExtension.mjs.map +1 -1
  127. package/dist/esm/utils/getPackageJsonPath.mjs +33 -0
  128. package/dist/esm/utils/getPackageJsonPath.mjs.map +1 -0
  129. package/dist/esm/utils/logStack.mjs +16 -0
  130. package/dist/esm/utils/logStack.mjs.map +1 -0
  131. package/dist/esm/utils/normalizePath.mjs +14 -3
  132. package/dist/esm/utils/normalizePath.mjs.map +1 -1
  133. package/dist/types/alias.d.ts +20 -12
  134. package/dist/types/alias.d.ts.map +1 -1
  135. package/dist/types/built.d.ts +7 -6
  136. package/dist/types/built.d.ts.map +1 -1
  137. package/dist/types/bundleJSFile.d.ts +97 -93
  138. package/dist/types/bundleJSFile.d.ts.map +1 -1
  139. package/dist/types/client.d.ts +3 -5
  140. package/dist/types/configFile/buildConfigurationFields.d.ts +7 -2
  141. package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
  142. package/dist/types/configFile/getConfiguration.d.ts +19 -15
  143. package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
  144. package/dist/types/configFile/index.d.ts +4 -3
  145. package/dist/types/configFile/loadConfigurationFile.d.ts +8 -3
  146. package/dist/types/configFile/loadConfigurationFile.d.ts.map +1 -1
  147. package/dist/types/configFile/searchConfigurationFile.d.ts +6 -4
  148. package/dist/types/configFile/searchConfigurationFile.d.ts.map +1 -1
  149. package/dist/types/defaultValues/build.d.ts +10 -4
  150. package/dist/types/defaultValues/build.d.ts.map +1 -1
  151. package/dist/types/defaultValues/content.d.ts +23 -16
  152. package/dist/types/defaultValues/content.d.ts.map +1 -1
  153. package/dist/types/defaultValues/editor.d.ts +14 -9
  154. package/dist/types/defaultValues/editor.d.ts.map +1 -1
  155. package/dist/types/defaultValues/index.d.ts +14 -0
  156. package/dist/types/defaultValues/index.d.ts.map +1 -0
  157. package/dist/types/defaultValues/internationalization.d.ts +12 -6
  158. package/dist/types/defaultValues/internationalization.d.ts.map +1 -1
  159. package/dist/types/defaultValues/log.d.ts +7 -2
  160. package/dist/types/defaultValues/log.d.ts.map +1 -1
  161. package/dist/types/defaultValues/routing.d.ts +14 -0
  162. package/dist/types/defaultValues/routing.d.ts.map +1 -0
  163. package/dist/types/extractErrorMessage.d.ts +5 -0
  164. package/dist/types/extractErrorMessage.d.ts.map +1 -0
  165. package/dist/types/index.d.ts +21 -17
  166. package/dist/types/loadEnvFile.d.ts +8 -5
  167. package/dist/types/loadEnvFile.d.ts.map +1 -1
  168. package/dist/types/loadExternalFile/bundleFile.d.ts +10 -0
  169. package/dist/types/loadExternalFile/bundleFile.d.ts.map +1 -0
  170. package/dist/types/loadExternalFile/loadExternalFile.d.ts +25 -0
  171. package/dist/types/loadExternalFile/loadExternalFile.d.ts.map +1 -0
  172. package/dist/types/loadExternalFile/parseFileContent.d.ts +29 -0
  173. package/dist/types/loadExternalFile/parseFileContent.d.ts.map +1 -0
  174. package/dist/types/loadExternalFile/transpileTSToMJS.d.ts +9 -0
  175. package/dist/types/loadExternalFile/transpileTSToMJS.d.ts.map +1 -0
  176. package/dist/types/logger.d.ts +41 -37
  177. package/dist/types/logger.d.ts.map +1 -1
  178. package/dist/types/retryManager.d.ts +26 -8
  179. package/dist/types/retryManager.d.ts.map +1 -1
  180. package/dist/types/utils/ESMxCJSHelpers.d.ts +16 -2
  181. package/dist/types/utils/ESMxCJSHelpers.d.ts.map +1 -1
  182. package/dist/types/utils/cache.d.ts +50 -0
  183. package/dist/types/utils/cache.d.ts.map +1 -0
  184. package/dist/types/utils/clearModuleCache.d.ts +4 -1
  185. package/dist/types/utils/clearModuleCache.d.ts.map +1 -1
  186. package/dist/types/utils/extractErrorMessage.d.ts +5 -0
  187. package/dist/types/utils/extractErrorMessage.d.ts.map +1 -0
  188. package/dist/types/utils/getExtension.d.ts +6 -2
  189. package/dist/types/utils/getExtension.d.ts.map +1 -1
  190. package/dist/types/utils/getPackageJsonPath.d.ts +10 -0
  191. package/dist/types/utils/getPackageJsonPath.d.ts.map +1 -0
  192. package/dist/types/utils/logStack.d.ts +7 -0
  193. package/dist/types/utils/logStack.d.ts.map +1 -0
  194. package/dist/types/utils/normalizePath.d.ts +4 -1
  195. package/dist/types/utils/normalizePath.d.ts.map +1 -1
  196. package/package.json +40 -35
  197. package/LICENSE +0 -202
  198. package/dist/cjs/client.cjs.map +0 -1
  199. package/dist/cjs/configFile/index.cjs.map +0 -1
  200. package/dist/cjs/defaultValues/middleware.cjs +0 -47
  201. package/dist/cjs/defaultValues/middleware.cjs.map +0 -1
  202. package/dist/cjs/getSandboxContext.cjs +0 -64
  203. package/dist/cjs/getSandboxContext.cjs.map +0 -1
  204. package/dist/cjs/index.cjs.map +0 -1
  205. package/dist/cjs/loadExternalFile.cjs +0 -105
  206. package/dist/cjs/loadExternalFile.cjs.map +0 -1
  207. package/dist/cjs/types/config.cjs +0 -17
  208. package/dist/cjs/types/config.cjs.map +0 -1
  209. package/dist/cjs/types/locales.cjs +0 -310
  210. package/dist/cjs/types/locales.cjs.map +0 -1
  211. package/dist/esm/client.mjs.map +0 -1
  212. package/dist/esm/configFile/index.mjs.map +0 -1
  213. package/dist/esm/defaultValues/middleware.mjs +0 -17
  214. package/dist/esm/defaultValues/middleware.mjs.map +0 -1
  215. package/dist/esm/getSandboxContext.mjs +0 -40
  216. package/dist/esm/getSandboxContext.mjs.map +0 -1
  217. package/dist/esm/index.mjs.map +0 -1
  218. package/dist/esm/loadExternalFile.mjs +0 -81
  219. package/dist/esm/loadExternalFile.mjs.map +0 -1
  220. package/dist/esm/types/config.mjs +0 -1
  221. package/dist/esm/types/config.mjs.map +0 -1
  222. package/dist/esm/types/locales.mjs +0 -286
  223. package/dist/esm/types/locales.mjs.map +0 -1
  224. package/dist/types/client.d.ts.map +0 -1
  225. package/dist/types/configFile/index.d.ts.map +0 -1
  226. package/dist/types/defaultValues/middleware.d.ts +0 -8
  227. package/dist/types/defaultValues/middleware.d.ts.map +0 -1
  228. package/dist/types/getSandboxContext.d.ts +0 -4
  229. package/dist/types/getSandboxContext.d.ts.map +0 -1
  230. package/dist/types/index.d.ts.map +0 -1
  231. package/dist/types/loadExternalFile.d.ts +0 -8
  232. package/dist/types/loadExternalFile.d.ts.map +0 -1
  233. package/dist/types/types/config.d.ts +0 -659
  234. package/dist/types/types/config.d.ts.map +0 -1
  235. package/dist/types/types/locales.d.ts +0 -564
  236. package/dist/types/types/locales.d.ts.map +0 -1
@@ -1,674 +1,117 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var buildConfigurationFields_exports = {};
20
- __export(buildConfigurationFields_exports, {
21
- buildConfigurationFields: () => buildConfigurationFields
22
- });
23
- module.exports = __toCommonJS(buildConfigurationFields_exports);
24
- var import_path = require("path");
25
- var import_build = require('../defaultValues/build.cjs');
26
- var import_content = require('../defaultValues/content.cjs');
27
- var import_editor = require('../defaultValues/editor.cjs');
28
- var import_internationalization = require('../defaultValues/internationalization.cjs');
29
- var import_log = require('../defaultValues/log.cjs');
30
- var import_middleware = require('../defaultValues/middleware.cjs');
31
- var import_normalizePath = require('../utils/normalizePath.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_utils_normalizePath = require('../utils/normalizePath.cjs');
3
+ const require_defaultValues_build = require('../defaultValues/build.cjs');
4
+ const require_defaultValues_content = require('../defaultValues/content.cjs');
5
+ const require_defaultValues_editor = require('../defaultValues/editor.cjs');
6
+ const require_defaultValues_internationalization = require('../defaultValues/internationalization.cjs');
7
+ const require_defaultValues_log = require('../defaultValues/log.cjs');
8
+ const require_defaultValues_routing = require('../defaultValues/routing.cjs');
9
+ const require_utils_ESMxCJSHelpers = require('../utils/ESMxCJSHelpers.cjs');
10
+ let node_path = require("node:path");
11
+ node_path = require_rolldown_runtime.__toESM(node_path);
12
+
13
+ //#region src/configFile/buildConfigurationFields.ts
32
14
  let storedConfiguration;
33
15
  const buildInternationalizationFields = (customConfiguration) => ({
34
- /**
35
- * Locales available in the application
36
- *
37
- * Default: ['en']
38
- *
39
- */
40
- locales: customConfiguration?.locales ?? import_internationalization.LOCALES,
41
- /**
42
- * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.
43
- *
44
- * Default: []
45
- *
46
- * If empty, all locales are required in `strict` mode.
47
- *
48
- * Ensure required locales are also defined in the `locales` field.
49
- */
50
- requiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? import_internationalization.REQUIRED_LOCALES,
51
- /**
52
- * Ensure strong implementations of internationalized content using typescript.
53
- * - 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.
54
- * - 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.
55
- * - If set to "loose", the translation `t` function will accept any existing locale.
56
- *
57
- * Default: "inclusive"
58
- */
59
- strictMode: customConfiguration?.strictMode ?? import_internationalization.STRICT_MODE,
60
- /**
61
- * Default locale of the application for fallback
62
- *
63
- * Default: 'en'
64
- */
65
- defaultLocale: customConfiguration?.defaultLocale ?? import_internationalization.DEFAULT_LOCALE
16
+ locales: customConfiguration?.locales ?? require_defaultValues_internationalization.LOCALES,
17
+ requiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? require_defaultValues_internationalization.REQUIRED_LOCALES,
18
+ strictMode: customConfiguration?.strictMode ?? require_defaultValues_internationalization.STRICT_MODE,
19
+ defaultLocale: customConfiguration?.defaultLocale ?? require_defaultValues_internationalization.DEFAULT_LOCALE
66
20
  });
67
- const buildMiddlewareFields = (customConfiguration) => ({
68
- /**
69
- * Header name to get the locale
70
- *
71
- * Default: 'x-intlayer-locale'
72
- */
73
- headerName: customConfiguration?.headerName ?? import_middleware.HEADER_NAME,
74
- /**
75
- * Cookie name to get the locale
76
- *
77
- * Default: 'intlayer-locale'
78
- */
79
- cookieName: customConfiguration?.cookieName ?? import_middleware.COOKIE_NAME,
80
- /**
81
- * Prefix default prefix the default locale to the path as other locales.
82
- *
83
- * Example with prefixDefault = true and defaultLocale = 'en':
84
- * path = /en/dashboard or /fr/dashboard
85
- *
86
- * Example with prefixDefault = false and defaultLocale = 'en':
87
- * path = /dashboard or /fr/dashboard
88
- *
89
- *
90
- * Default: false
91
- */
92
- prefixDefault: customConfiguration?.prefixDefault ?? import_middleware.PREFIX_DEFAULT,
93
- /**
94
- * Base path of the application URL
95
- *
96
- * Default: ''
97
- *
98
- * Example:
99
- * - If the application is hosted at https://example.com/my-app
100
- * - The base path is '/my-app'
101
- * - The URL will be https://example.com/my-app/en
102
- * - If the base path is not set, the URL will be https://example.com/en
103
- */
104
- basePath: customConfiguration?.basePath ?? import_middleware.BASE_PATH,
105
- /**
106
- * Rule to set the cookie on the server
107
- * - 'always': Set the cookie on every request
108
- * - 'never': Never set the cookie
109
- */
110
- serverSetCookie: customConfiguration?.serverSetCookie ?? import_middleware.SERVER_SET_COOKIE,
111
- /**
112
- * No prefix in the URL
113
- * - true: No prefix in the URL
114
- * - false: Prefix in the URL
115
- *
116
- * Example:
117
- * - If the application is hosted at https://example.com/my-app
118
- * - The base path is '/my-app'
119
- * - The URL will be https://example.com/my-app/en
120
- * - If the base path is not set, the URL will be https://example.com/en
121
- * - If no prefix is set, the URL will be https://example.com/en
122
- * - If the no prefix is set to true, the URL will be https://example.com
123
- *
124
- * Default: false
125
- */
126
- noPrefix: customConfiguration?.noPrefix ?? import_middleware.NO_PREFIX,
127
- /**
128
- * Controls whether locale detection occurs during Next.js prefetch requests
129
- * - true: Detect and apply locale during prefetch
130
- * - false: Use default locale during prefetch (recommended)
131
- *
132
- * This setting affects how Next.js handles locale prefetching:
133
- *
134
- * Example scenario:
135
- * - User's browser language is 'fr'
136
- * - Current page is /fr/about
137
- * - Link prefetches /about
138
- *
139
- * With `detectLocaleOnPrefetchNoPrefix:true`
140
- * - Prefetch detects 'fr' locale from browser
141
- * - Redirects prefetch to /fr/about
142
- *
143
- * With `detectLocaleOnPrefetchNoPrefix:false` (default)
144
- * - Prefetch uses default locale
145
- * - Redirects prefetch to /en/about (assuming 'en' is default)
146
- *
147
- * When to use true:
148
- * - Your app uses non-localized internal links (e.g. <a href="/about">)
149
- * - You want consistent locale detection behavior between regular and prefetch requests
150
- *
151
- * When to use false (default):
152
- * - Your app uses locale-prefixed links (e.g. <a href="/fr/about">)
153
- * - You want to optimize prefetching performance
154
- * - You want to avoid potential redirect loops
155
- *
156
- * Default: false
157
- */
158
- detectLocaleOnPrefetchNoPrefix: customConfiguration?.detectLocaleOnPrefetchNoPrefix ?? import_middleware.DETECT_LOCALE_ON_PREFETCH_NO_PREFIX
21
+ const buildRoutingFields = (customConfiguration) => ({
22
+ mode: customConfiguration?.mode ?? require_defaultValues_routing.ROUTING_MODE,
23
+ storage: customConfiguration?.storage ?? require_defaultValues_routing.STORAGE,
24
+ headerName: customConfiguration?.headerName ?? require_defaultValues_routing.HEADER_NAME,
25
+ basePath: customConfiguration?.basePath ?? require_defaultValues_routing.BASE_PATH,
26
+ detectLocaleOnPrefetchNoPrefix: customConfiguration?.detectLocaleOnPrefetchNoPrefix ?? require_defaultValues_routing.DETECT_LOCALE_ON_PREFETCH_NO_PREFIX
159
27
  });
160
28
  const buildContentFields = (customConfiguration, baseDir) => {
161
- const notDerivedContentConfig = {
162
- /**
163
- * File extensions of content to look for to build the dictionaries
164
- *
165
- * - Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']
166
- *
167
- * - Example: ['.data.ts', '.data.js', '.data.json']
168
- *
169
- * Note:
170
- * - Can exclude unused file extensions to improve performance
171
- * - Avoid using common file extensions like '.ts', '.js', '.json' to avoid conflicts
172
- */
173
- fileExtensions: customConfiguration?.fileExtensions ?? import_content.FILE_EXTENSIONS,
174
- /**
175
- * Absolute path of the directory of the project
176
- * - Default: process.cwd()
177
- * - Example: '
178
- *
179
- * Will be used to resolve all intlayer directories
180
- *
181
- * Note:
182
- * - The base directory should be the root of the project
183
- * - Can be changed to a custom directory to externalize either the content used in the project, or the intlayer application from the project
184
- */
185
- baseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),
186
- /**
187
- * Should exclude some directories from the content search
188
- *
189
- * Default: ['node_modules']
190
- *
191
- * Not used yet
192
- * @TODO Implement the exclusion or remove it
193
- */
194
- excludedPath: customConfiguration?.excludedPath ?? import_content.EXCLUDED_PATHS,
195
- /**
196
- * Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.
197
- *
198
- * Default: process.env.NODE_ENV === 'development'
199
- */
200
- watch: customConfiguration?.watch ?? import_content.WATCH,
201
- /**
202
- * Indicate how the content should be automatically filled using AI.
203
- *
204
- * Default: undefined
205
- */
206
- autoFill: customConfiguration?.autoFill ?? void 0
207
- };
208
- const baseDirDerivedConfiguration = {
209
- /**
210
- * Directory where the content is stored
211
- *
212
- * Relative to the base directory of the project
213
- *
214
- * Default: ./src
215
- *
216
- * Example: 'src'
217
- *
218
- * Note:
219
- * - Can be changed to a custom directory to externalize the content used in the project
220
- * - If the content is not at the base directory level, update the contentDirName field instead
221
- */
222
- contentDir: (customConfiguration?.contentDir ?? import_content.CONTENT_DIR).map(
223
- (contentDir) => (0, import_path.join)(notDerivedContentConfig.baseDir, contentDir)
224
- ),
225
- /**
226
- * Directory where the result will be stored
227
- *
228
- * Relative to the base directory of the project
229
- *
230
- * Default: .intlayer/dictionary
231
- *
232
- * Example: '.intlayer'
233
- *
234
- * Note:
235
- * - Can be changed to a custom directory to externalize the intlayer application from the project
236
- * - If the result is not at the base directory level, update the dictionariesDirName field instead
237
- */
238
- dictionariesDir: (0, import_path.join)(
239
- notDerivedContentConfig.baseDir,
240
- customConfiguration?.dictionariesDir ?? import_content.DICTIONARIES_DIR
241
- ),
242
- /**
243
- * Directory where the module augmentation will be stored
244
- *
245
- * Module augmentation allow better IDE suggestions and type checking
246
- *
247
- * Relative to the base directory of the project
248
- *
249
- * Default: .intlayer/types
250
- *
251
- * Example: 'types'
252
- *
253
- * Note:
254
- * - If this path changed, be sure to include it from the tsconfig.json file
255
- * - If the module augmentation is not at the base directory level, update the moduleAugmentationDirName field instead
256
- *
257
- */
258
- moduleAugmentationDir: (0, import_path.join)(
259
- notDerivedContentConfig.baseDir,
260
- customConfiguration?.moduleAugmentationDir ?? import_content.MODULE_AUGMENTATION_DIR
261
- )
262
- };
263
- const dictionariesDirDerivedConfiguration = {
264
- /**
265
- * Directory where the unmerged dictionaries will be stored
266
- *
267
- * Relative to the result directory
268
- *
269
- * Default: '.intlayer/unmerged_dictionary'
270
- *
271
- */
272
- unmergedDictionariesDir: (0, import_path.join)(
273
- notDerivedContentConfig.baseDir,
274
- customConfiguration?.unmergedDictionariesDir ?? import_content.UNMERGED_DICTIONARIES_DIR
275
- ),
276
- /**
277
- * Directory where the remote dictionaries will be stored
278
- *
279
- * Relative to the result directory
280
- *
281
- * Default: '.intlayer/remote_dictionary'
282
- */
283
- remoteDictionariesDir: (0, import_path.join)(
284
- notDerivedContentConfig.baseDir,
285
- customConfiguration?.remoteDictionariesDir ?? import_content.REMOTE_DICTIONARIES_DIR
286
- ),
287
- /**
288
- * Directory where the final dictionaries will be stored
289
- *
290
- * Relative to the result directory
291
- *
292
- * Default: .intlayer/dictionary
293
- *
294
- * Example: '.intlayer/dictionary'
295
- *
296
- * Note:
297
- * - If the types are not at the result directory level, update the dictionariesDirName field instead
298
- * - The dictionaries are stored in JSON format
299
- * - The dictionaries are used to translate the content
300
- * - The dictionaries are built from the content files
301
- */
302
- dictionariesDir: (0, import_path.join)(
303
- notDerivedContentConfig.baseDir,
304
- customConfiguration?.dictionariesDir ?? import_content.DICTIONARIES_DIR
305
- ),
306
- /**
307
- * Directory where the dynamic dictionaries will be stored
308
- *
309
- * Relative to the result directory
310
- *
311
- * Default: .intlayer/dynamic_dictionary
312
- */
313
- dynamicDictionariesDir: (0, import_path.join)(
314
- notDerivedContentConfig.baseDir,
315
- customConfiguration?.dynamicDictionariesDir ?? import_content.DYNAMIC_DICTIONARIES_DIR
316
- ),
317
- /**
318
- * Directory where the fetch dictionaries will be stored
319
- *
320
- * Relative to the result directory
321
- *
322
- * Default: .intlayer/fetch_dictionary
323
- */
324
- fetchDictionariesDir: (0, import_path.join)(
325
- notDerivedContentConfig.baseDir,
326
- customConfiguration?.fetchDictionariesDir ?? import_content.FETCH_DICTIONARIES_DIR
327
- ),
328
- /**
329
- * Directory where the dictionaries types will be stored
330
- *
331
- * Relative to the result directory
332
- *
333
- * Default: .intlayer/types
334
- *
335
- * Example: 'types'
336
- *
337
- * Note:
338
- * - If the types are not at the result directory level, update the typesDirName field instead
339
- */
340
- typesDir: (0, import_path.join)(
341
- notDerivedContentConfig.baseDir,
342
- customConfiguration?.typesDir ?? import_content.TYPES_DIR
343
- ),
344
- /**
345
- * Directory where the main files will be stored
346
- *
347
- * Relative to the result directory
348
- *
349
- * Default: .intlayer/main
350
- *
351
- * Example: '.intlayer/main'
352
- *
353
- * Note:
354
- *
355
- * - If the main files are not at the result directory level, update the mainDirName field instead
356
- */
357
- mainDir: (0, import_path.join)(
358
- notDerivedContentConfig.baseDir,
359
- customConfiguration?.mainDir ?? import_content.MAIN_DIR
360
- ),
361
- /**
362
- * Directory where the configuration files are stored
363
- *
364
- * Relative to the result directory
365
- *
366
- * Default: .intlayer/config
367
- *
368
- * Example: '.intlayer/config'
369
- *
370
- * Note:
371
- *
372
- * - If the configuration files are not at the result directory level, update the configDirName field instead
373
- */
374
- configDir: (0, import_path.join)(
375
- notDerivedContentConfig.baseDir,
376
- customConfiguration?.configDir ?? import_content.CONFIG_DIR
377
- )
378
- };
379
- const patternsConfiguration = {
380
- /**
381
- * Pattern of files to watch
382
- *
383
- * Default: ['/**\/*.content.ts', '/**\/*.content.js', '/**\/*.content.json', '/**\/*.content.cjs', '/**\/*.content.mjs', '/**\/*.content.tsx', '/**\/*.content.jsx']
384
- */
385
- watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(
386
- (ext) => `/**/*${ext}`
387
- ),
388
- /**
389
- * Pattern of files to watch including the relative path
390
- *
391
- * Default: ['src/**\/*.content.ts', 'src/**\/*.content.js', 'src/**\/*.content.json', 'src/**\/*.content.cjs', 'src/**\/*.content.mjs', 'src/**\/*.content.tsx', 'src/**\/*.content.jsx']
392
- */
393
- watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap(
394
- (ext) => baseDirDerivedConfiguration.contentDir.map(
395
- (contentDir) => `${(0, import_normalizePath.normalizePath)(contentDir)}/**/*${ext}`
396
- )
397
- ),
398
- /**
399
- * Pattern of dictionary to interpret
400
- *
401
- * Default: '.intlayer/dictionary/**\/*.json'
402
- */
403
- outputFilesPatternWithPath: `${(0, import_normalizePath.normalizePath)(
404
- dictionariesDirDerivedConfiguration.dictionariesDir
405
- )}/**/*.json`
406
- };
407
- return {
408
- ...notDerivedContentConfig,
409
- ...baseDirDerivedConfiguration,
410
- ...dictionariesDirDerivedConfiguration,
411
- ...patternsConfiguration
412
- };
29
+ const notDerivedContentConfig = {
30
+ fileExtensions: customConfiguration?.fileExtensions ?? require_defaultValues_content.FILE_EXTENSIONS,
31
+ baseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),
32
+ excludedPath: customConfiguration?.excludedPath ?? require_defaultValues_content.EXCLUDED_PATHS,
33
+ watch: customConfiguration?.watch ?? require_defaultValues_content.WATCH,
34
+ fill: customConfiguration?.fill ?? require_defaultValues_content.FILL
35
+ };
36
+ const baseDirDerivedConfiguration = {
37
+ contentDir: (customConfiguration?.contentDir ?? require_defaultValues_content.CONTENT_DIR).map((contentDir) => (0, node_path.join)(notDerivedContentConfig.baseDir, contentDir)),
38
+ moduleAugmentationDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.moduleAugmentationDir ?? require_defaultValues_content.MODULE_AUGMENTATION_DIR),
39
+ unmergedDictionariesDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.unmergedDictionariesDir ?? require_defaultValues_content.UNMERGED_DICTIONARIES_DIR),
40
+ remoteDictionariesDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.remoteDictionariesDir ?? require_defaultValues_content.REMOTE_DICTIONARIES_DIR),
41
+ dictionariesDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.dictionariesDir ?? require_defaultValues_content.DICTIONARIES_DIR),
42
+ dynamicDictionariesDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.dynamicDictionariesDir ?? require_defaultValues_content.DYNAMIC_DICTIONARIES_DIR),
43
+ fetchDictionariesDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.fetchDictionariesDir ?? require_defaultValues_content.FETCH_DICTIONARIES_DIR),
44
+ typesDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.typesDir ?? require_defaultValues_content.TYPES_DIR),
45
+ mainDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.mainDir ?? require_defaultValues_content.MAIN_DIR),
46
+ configDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.configDir ?? require_defaultValues_content.CONFIG_DIR),
47
+ cacheDir: (0, node_path.join)(notDerivedContentConfig.baseDir, customConfiguration?.cacheDir ?? require_defaultValues_content.CACHE_DIR)
48
+ };
49
+ const patternsConfiguration = {
50
+ watchedFilesPattern: notDerivedContentConfig.fileExtensions.map((ext) => `/**/*${ext}`),
51
+ watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap((ext) => baseDirDerivedConfiguration.contentDir.map((contentDir) => `${require_utils_normalizePath.normalizePath(contentDir)}/**/*${ext}`)),
52
+ outputFilesPatternWithPath: `${require_utils_normalizePath.normalizePath(baseDirDerivedConfiguration.dictionariesDir)}/**/*.json`
53
+ };
54
+ return {
55
+ ...notDerivedContentConfig,
56
+ ...baseDirDerivedConfiguration,
57
+ ...patternsConfiguration
58
+ };
413
59
  };
414
60
  const buildEditorFields = (customConfiguration) => ({
415
- /**
416
- * URL of the application. Used to restrict the origin of the editor for security reasons.
417
- *
418
- * > '*' means that the editor is accessible from any origin
419
- *
420
- * Default: '*'
421
- */
422
- applicationURL: customConfiguration?.applicationURL ?? import_editor.APPLICATION_URL,
423
- /**
424
- * URL of the editor server. Used to restrict the origin of the editor for security reasons.
425
- *
426
- * > '*' means that the editor is accessible from any origin
427
- *
428
- * Default: '*'
429
- */
430
- editorURL: customConfiguration?.editorURL ?? import_editor.EDITOR_URL,
431
- /**
432
- * URL of the CMS server. Used to restrict the origin of the editor for security reasons.
433
- */
434
- cmsURL: customConfiguration?.cmsURL ?? import_editor.CMS_URL,
435
- /**
436
- * URL of the editor server
437
- *
438
- * Default: 'https://back.intlayer.org'
439
- */
440
- backendURL: customConfiguration?.backendURL ?? import_editor.BACKEND_URL,
441
- /** Port of the editor server
442
- *
443
- * Default: 8000
444
- */
445
- port: customConfiguration?.port ?? import_editor.PORT,
446
- /**
447
- * Indicates if the application interact with the visual editor
448
- *
449
- * Default: true;
450
- *
451
- * If true, the editor will be able to interact with the application.
452
- * If false, the editor will not be able to interact with the application.
453
- * In any case, the editor can only be enabled by the visual editor.
454
- * Disabling the editor for specific environments is a way to enforce the security.
455
- *
456
- * Usage:
457
- * ```js
458
- * {
459
- * // Other configurations
460
- * editor: {
461
- * enabled: process.env.NODE_ENV !== 'production',
462
- * }
463
- * };
464
- * ```
465
- */
466
- enabled: customConfiguration?.enabled ?? import_editor.IS_ENABLED,
467
- /**
468
- * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
469
- * An access token is use to authenticate the user related to the project.
470
- * To get an access token, go to https://intlayer.org/dashboard/project and create an account.
471
- *
472
- * Default: undefined
473
- *
474
- * > 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.
475
- */
476
- clientId: customConfiguration?.clientId ?? void 0,
477
- /**
478
- * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
479
- * An access token is use to authenticate the user related to the project.
480
- * To get an access token, go to https://intlayer.org/dashboard/project and create an account.
481
- *
482
- * Default: undefined
483
- *
484
- * > 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.
485
- */
486
- clientSecret: customConfiguration?.clientSecret ?? void 0,
487
- /**
488
- * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.
489
- * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.
490
- *
491
- * Default: 'local_first'
492
- *
493
- * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.
494
- * - 'local_first': The first dictionary found in the locale is used.
495
- * - 'distant_first': The first dictionary found in the distant locales is used.
496
- */
497
- dictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? import_editor.DICTIONARY_PRIORITY_STRATEGY,
498
- /**
499
- * Indicates if the application should hot reload the locale configurations when a change is detected.
500
- * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.
501
- *
502
- * The hot reload is only available for clients of the `enterprise` plan.
503
- *
504
- * Default: false
505
- */
506
- liveSync: customConfiguration?.liveSync ?? import_editor.LIVE_SYNC,
507
- /**
508
- * Port of the live sync server
509
- *
510
- * Default: 4000
511
- */
512
- liveSyncPort: customConfiguration?.liveSyncPort ?? import_editor.LIVE_SYNC_PORT,
513
- /**
514
- * URL of the live sync server in case of remote live sync server
515
- *
516
- * Default: `http://localhost:${LIVE_SYNC_PORT}`
517
- */
518
- liveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? import_editor.LIVE_SYNC_PORT}`
61
+ applicationURL: customConfiguration?.applicationURL ?? require_defaultValues_editor.APPLICATION_URL,
62
+ editorURL: customConfiguration?.editorURL ?? require_defaultValues_editor.EDITOR_URL,
63
+ cmsURL: customConfiguration?.cmsURL ?? require_defaultValues_editor.CMS_URL,
64
+ backendURL: customConfiguration?.backendURL ?? require_defaultValues_editor.BACKEND_URL,
65
+ port: customConfiguration?.port ?? require_defaultValues_editor.PORT,
66
+ enabled: customConfiguration?.enabled ?? require_defaultValues_editor.IS_ENABLED,
67
+ clientId: customConfiguration?.clientId ?? void 0,
68
+ clientSecret: customConfiguration?.clientSecret ?? void 0,
69
+ dictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? require_defaultValues_editor.DICTIONARY_PRIORITY_STRATEGY,
70
+ liveSync: customConfiguration?.liveSync ?? require_defaultValues_editor.LIVE_SYNC,
71
+ liveSyncPort: customConfiguration?.liveSyncPort ?? require_defaultValues_editor.LIVE_SYNC_PORT,
72
+ liveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? require_defaultValues_editor.LIVE_SYNC_PORT}`,
73
+ formatCommand: customConfiguration?.formatCommand
519
74
  });
520
75
  const buildLogFields = (customConfiguration, logFunctions) => ({
521
- /**
522
- * Indicates if the logger is enabled
523
- *
524
- * Default: 'default'
525
- *
526
- * If 'default', the logger is enabled and can be used.
527
- * If 'verbose', the logger will be enabled and can be used, but will log more information.
528
- * If 'disabled', the logger is disabled and cannot be used.
529
- */
530
- mode: customConfiguration?.mode ?? import_log.MODE,
531
- /**
532
- * Prefix of the logger
533
- *
534
- * Default: '[intlayer]'
535
- *
536
- * The prefix of the logger.
537
- */
538
- prefix: customConfiguration?.prefix ?? import_log.PREFIX,
539
- /**
540
- * Functions to log
541
- */
542
- error: logFunctions?.error,
543
- log: logFunctions?.log,
544
- info: logFunctions?.info,
545
- warn: logFunctions?.warn
76
+ mode: customConfiguration?.mode ?? require_defaultValues_log.MODE,
77
+ prefix: customConfiguration?.prefix ?? require_defaultValues_log.PREFIX,
78
+ error: logFunctions?.error,
79
+ log: logFunctions?.log,
80
+ info: logFunctions?.info,
81
+ warn: logFunctions?.warn
546
82
  });
547
83
  const buildAiFields = (customConfiguration) => ({
548
- /**
549
- * AI configuration
550
- */
551
- provider: customConfiguration?.provider,
552
- /**
553
- * API key
554
- */
555
- apiKey: customConfiguration?.apiKey,
556
- /**
557
- * API model
558
- */
559
- model: customConfiguration?.model,
560
- /**
561
- * Temperature
562
- */
563
- temperature: customConfiguration?.temperature,
564
- /**
565
- * Application context
566
- */
567
- applicationContext: customConfiguration?.applicationContext
84
+ provider: customConfiguration?.provider,
85
+ apiKey: customConfiguration?.apiKey,
86
+ model: customConfiguration?.model,
87
+ temperature: customConfiguration?.temperature,
88
+ applicationContext: customConfiguration?.applicationContext
568
89
  });
569
90
  const buildBuildFields = (customConfiguration) => ({
570
- /**
571
- * Indicates if the build should be optimized
572
- *
573
- * Default: process.env.NODE_ENV === 'production'
574
- *
575
- * If true, the build will be optimized.
576
- * If false, the build will not be optimized.
577
- *
578
- * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.
579
- * All imports will stay as static import to avoid async processing when loading the dictionaries.
580
- *
581
- * Note:
582
- * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.
583
- * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.
584
- * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
585
- * - In most cases, "dynamic" will be used for React applications, "async" for Vue.js applications.
586
- * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
587
- */
588
- optimize: customConfiguration?.optimize ?? import_build.OPTIMIZE,
589
- /**
590
- * Indicates the mode of import to use for the dictionaries.
591
- *
592
- * Available modes:
593
- * - "static": The dictionaries are imported statically.
594
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.
595
- * - "dynamic": The dictionaries are imported dynamically in a synchronous component using the suspense API.
596
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
597
- * - "live": The dictionaries are imported dynamically using the live sync API.
598
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
599
- * 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.
600
- *
601
- * Default: "static"
602
- *
603
- * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.
604
- *
605
- * Note:
606
- * - Dynamic imports rely on Suspense and may slightly impact rendering performance.
607
- * - If desabled all locales will be loaded at once, even if they are not used.
608
- * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
609
- * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
610
- * - This option will be ignored if `optimize` is disabled.
611
- * - 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.
612
- * - The "live" allows to sync the dictionaries to the live sync server.
613
- */
614
- importMode: customConfiguration?.importMode ?? import_build.IMPORT_MODE,
615
- /**
616
- * Pattern to traverse the code to optimize.
617
- *
618
- * Allows to avoid to traverse the code that is not relevant to the optimization.
619
- * Improve build performance.
620
- *
621
- * Default: ['**\/*.{js,ts,mjs,cjs,jsx,tsx,mjx,cjx}', '!**\/node_modules/**']
622
- *
623
- * Example: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}']`
624
- *
625
- * Note:
626
- * - This option will be ignored if `optimize` is disabled.
627
- * - Use glob pattern.
628
- */
629
- traversePattern: customConfiguration?.traversePattern ?? import_build.TRAVERSE_PATTERN,
630
- /**
631
- * Output format of the dictionaries
632
- *
633
- * Can be set on large projects to improve build performance.
634
- *
635
- * Default: ['cjs', 'esm']
636
- *
637
- * The output format of the dictionaries. It can be either 'cjs' or 'esm'.
638
- * - 'cjs': The dictionaries are outputted as CommonJS modules.
639
- * - 'esm': The dictionaries are outputted as ES modules.
640
- */
641
- outputFormat: customConfiguration?.outputFormat ?? import_build.OUTPUT_FORMAT
91
+ optimize: customConfiguration?.optimize ?? require_defaultValues_build.OPTIMIZE,
92
+ importMode: customConfiguration?.importMode ?? require_defaultValues_build.IMPORT_MODE,
93
+ traversePattern: customConfiguration?.traversePattern ?? require_defaultValues_build.TRAVERSE_PATTERN,
94
+ outputFormat: customConfiguration?.outputFormat ?? require_defaultValues_build.OUTPUT_FORMAT,
95
+ cache: customConfiguration?.cache ?? require_defaultValues_build.CACHE,
96
+ require: customConfiguration?.require ?? require_utils_ESMxCJSHelpers.ESMxCJSRequire
642
97
  });
98
+ /**
99
+ * Build the configuration fields by merging the default values with the custom configuration
100
+ */
643
101
  const buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {
644
- const internationalizationConfig = buildInternationalizationFields(
645
- customConfiguration?.internationalization
646
- );
647
- const middlewareConfig = buildMiddlewareFields(
648
- customConfiguration?.middleware
649
- );
650
- const contentConfig = buildContentFields(
651
- customConfiguration?.content,
652
- baseDir
653
- );
654
- const editorConfig = buildEditorFields(customConfiguration?.editor);
655
- const logConfig = buildLogFields(customConfiguration?.log, logFunctions);
656
- const aiConfig = buildAiFields(customConfiguration?.ai);
657
- const buildConfig = buildBuildFields(customConfiguration?.build);
658
- storedConfiguration = {
659
- internationalization: internationalizationConfig,
660
- middleware: middlewareConfig,
661
- content: contentConfig,
662
- editor: editorConfig,
663
- log: logConfig,
664
- ai: aiConfig,
665
- build: buildConfig,
666
- plugins: customConfiguration?.plugins
667
- };
668
- return storedConfiguration;
102
+ storedConfiguration = {
103
+ internationalization: buildInternationalizationFields(customConfiguration?.internationalization),
104
+ routing: buildRoutingFields(customConfiguration?.routing),
105
+ content: buildContentFields(customConfiguration?.content, baseDir),
106
+ editor: buildEditorFields(customConfiguration?.editor),
107
+ log: buildLogFields(customConfiguration?.log, logFunctions),
108
+ ai: buildAiFields(customConfiguration?.ai),
109
+ build: buildBuildFields(customConfiguration?.build),
110
+ plugins: customConfiguration?.plugins
111
+ };
112
+ return storedConfiguration;
669
113
  };
670
- // Annotate the CommonJS export names for ESM import in node:
671
- 0 && (module.exports = {
672
- buildConfigurationFields
673
- });
114
+
115
+ //#endregion
116
+ exports.buildConfigurationFields = buildConfigurationFields;
674
117
  //# sourceMappingURL=buildConfigurationFields.cjs.map