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