@intlayer/config 5.8.1-canary.0 → 6.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/cjs/alias.cjs +101 -0
  2. package/dist/cjs/alias.cjs.map +1 -0
  3. package/dist/cjs/client.cjs +24 -2
  4. package/dist/cjs/client.cjs.map +1 -1
  5. package/dist/cjs/configFile/buildConfigurationFields.cjs +46 -4
  6. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  7. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  8. package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
  9. package/dist/cjs/defaultValues/content.cjs +9 -0
  10. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  11. package/dist/cjs/defaultValues/editor.cjs +6 -3
  12. package/dist/cjs/defaultValues/editor.cjs.map +1 -1
  13. package/dist/cjs/defaultValues/log.cjs +2 -3
  14. package/dist/cjs/defaultValues/log.cjs.map +1 -1
  15. package/dist/cjs/getSandboxContext.cjs +1 -1
  16. package/dist/cjs/getSandboxContext.cjs.map +1 -1
  17. package/dist/cjs/index.cjs +30 -11
  18. package/dist/cjs/index.cjs.map +1 -1
  19. package/dist/cjs/loadEnvFile.cjs.map +1 -0
  20. package/dist/cjs/loadExternalFile.cjs.map +1 -1
  21. package/dist/cjs/logger.cjs +107 -4
  22. package/dist/cjs/logger.cjs.map +1 -1
  23. package/dist/cjs/types/config.cjs.map +1 -1
  24. package/dist/esm/alias.mjs +77 -0
  25. package/dist/esm/alias.mjs.map +1 -0
  26. package/dist/esm/client.mjs +26 -2
  27. package/dist/esm/client.mjs.map +1 -1
  28. package/dist/esm/configFile/buildConfigurationFields.mjs +50 -5
  29. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  30. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  31. package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
  32. package/dist/esm/defaultValues/content.mjs +6 -0
  33. package/dist/esm/defaultValues/content.mjs.map +1 -1
  34. package/dist/esm/defaultValues/editor.mjs +4 -2
  35. package/dist/esm/defaultValues/editor.mjs.map +1 -1
  36. package/dist/esm/defaultValues/log.mjs +2 -3
  37. package/dist/esm/defaultValues/log.mjs.map +1 -1
  38. package/dist/esm/getSandboxContext.mjs +1 -3
  39. package/dist/esm/getSandboxContext.mjs.map +1 -1
  40. package/dist/esm/index.mjs +30 -12
  41. package/dist/esm/index.mjs.map +1 -1
  42. package/dist/esm/loadEnvFile.mjs.map +1 -0
  43. package/dist/esm/loadExternalFile.mjs.map +1 -1
  44. package/dist/esm/logger.mjs +95 -3
  45. package/dist/esm/logger.mjs.map +1 -1
  46. package/dist/types/alias.d.ts +15 -0
  47. package/dist/types/alias.d.ts.map +1 -0
  48. package/dist/types/client.d.ts +1 -1
  49. package/dist/types/client.d.ts.map +1 -1
  50. package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
  51. package/dist/types/configFile/getConfiguration.d.ts +3 -2
  52. package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
  53. package/dist/types/configFile/loadConfigurationFile.d.ts +1 -1
  54. package/dist/types/configFile/loadConfigurationFile.d.ts.map +1 -1
  55. package/dist/types/defaultValues/content.d.ts +3 -0
  56. package/dist/types/defaultValues/content.d.ts.map +1 -1
  57. package/dist/types/defaultValues/editor.d.ts +2 -1
  58. package/dist/types/defaultValues/editor.d.ts.map +1 -1
  59. package/dist/types/defaultValues/log.d.ts +1 -1
  60. package/dist/types/defaultValues/log.d.ts.map +1 -1
  61. package/dist/types/getSandboxContext.d.ts +1 -1
  62. package/dist/types/getSandboxContext.d.ts.map +1 -1
  63. package/dist/types/index.d.ts +3 -2
  64. package/dist/types/index.d.ts.map +1 -1
  65. package/dist/types/loadEnvFile.d.ts.map +1 -0
  66. package/dist/types/loadExternalFile.d.ts +1 -1
  67. package/dist/types/loadExternalFile.d.ts.map +1 -1
  68. package/dist/types/logger.d.ts +43 -1
  69. package/dist/types/logger.d.ts.map +1 -1
  70. package/dist/types/types/config.d.ts +43 -7
  71. package/dist/types/types/config.d.ts.map +1 -1
  72. package/package.json +7 -6
  73. package/dist/cjs/envVariables/detectPlatform.cjs +0 -55
  74. package/dist/cjs/envVariables/detectPlatform.cjs.map +0 -1
  75. package/dist/cjs/envVariables/extractEnvVariable/index.cjs +0 -44
  76. package/dist/cjs/envVariables/extractEnvVariable/index.cjs.map +0 -1
  77. package/dist/cjs/envVariables/extractEnvVariable/next.cjs +0 -102
  78. package/dist/cjs/envVariables/extractEnvVariable/next.cjs.map +0 -1
  79. package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs +0 -102
  80. package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs.map +0 -1
  81. package/dist/cjs/envVariables/extractEnvVariable/types.cjs +0 -17
  82. package/dist/cjs/envVariables/extractEnvVariable/types.cjs.map +0 -1
  83. package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs +0 -102
  84. package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs.map +0 -1
  85. package/dist/cjs/envVariables/extractEnvVariable/vite.cjs +0 -111
  86. package/dist/cjs/envVariables/extractEnvVariable/vite.cjs.map +0 -1
  87. package/dist/cjs/envVariables/extractEnvVariable/vite_env.d.cjs +0 -18
  88. package/dist/cjs/envVariables/extractEnvVariable/vite_env.d.cjs.map +0 -1
  89. package/dist/cjs/envVariables/formatEnvVariable.cjs +0 -50
  90. package/dist/cjs/envVariables/formatEnvVariable.cjs.map +0 -1
  91. package/dist/cjs/envVariables/getConfiguration.cjs +0 -150
  92. package/dist/cjs/envVariables/getConfiguration.cjs.map +0 -1
  93. package/dist/cjs/envVariables/index.cjs +0 -40
  94. package/dist/cjs/envVariables/index.cjs.map +0 -1
  95. package/dist/cjs/envVariables/loadEnvFile.cjs.map +0 -1
  96. package/dist/cjs/envVariables/removeUndefinedValueObject.cjs +0 -38
  97. package/dist/cjs/envVariables/removeUndefinedValueObject.cjs.map +0 -1
  98. package/dist/cjs/envVariables/utils.cjs +0 -54
  99. package/dist/cjs/envVariables/utils.cjs.map +0 -1
  100. package/dist/esm/envVariables/detectPlatform.mjs +0 -29
  101. package/dist/esm/envVariables/detectPlatform.mjs.map +0 -1
  102. package/dist/esm/envVariables/extractEnvVariable/index.mjs +0 -20
  103. package/dist/esm/envVariables/extractEnvVariable/index.mjs.map +0 -1
  104. package/dist/esm/envVariables/extractEnvVariable/next.mjs +0 -78
  105. package/dist/esm/envVariables/extractEnvVariable/next.mjs.map +0 -1
  106. package/dist/esm/envVariables/extractEnvVariable/react_app.mjs +0 -78
  107. package/dist/esm/envVariables/extractEnvVariable/react_app.mjs.map +0 -1
  108. package/dist/esm/envVariables/extractEnvVariable/types.mjs +0 -1
  109. package/dist/esm/envVariables/extractEnvVariable/types.mjs.map +0 -1
  110. package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs +0 -78
  111. package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs.map +0 -1
  112. package/dist/esm/envVariables/extractEnvVariable/vite.mjs +0 -86
  113. package/dist/esm/envVariables/extractEnvVariable/vite.mjs.map +0 -1
  114. package/dist/esm/envVariables/extractEnvVariable/vite_env.d.mjs +0 -2
  115. package/dist/esm/envVariables/extractEnvVariable/vite_env.d.mjs.map +0 -1
  116. package/dist/esm/envVariables/formatEnvVariable.mjs +0 -26
  117. package/dist/esm/envVariables/formatEnvVariable.mjs.map +0 -1
  118. package/dist/esm/envVariables/getConfiguration.mjs +0 -128
  119. package/dist/esm/envVariables/getConfiguration.mjs.map +0 -1
  120. package/dist/esm/envVariables/index.mjs +0 -12
  121. package/dist/esm/envVariables/index.mjs.map +0 -1
  122. package/dist/esm/envVariables/loadEnvFile.mjs.map +0 -1
  123. package/dist/esm/envVariables/removeUndefinedValueObject.mjs +0 -14
  124. package/dist/esm/envVariables/removeUndefinedValueObject.mjs.map +0 -1
  125. package/dist/esm/envVariables/utils.mjs +0 -30
  126. package/dist/esm/envVariables/utils.mjs.map +0 -1
  127. package/dist/types/envVariables/detectPlatform.d.ts +0 -7
  128. package/dist/types/envVariables/detectPlatform.d.ts.map +0 -1
  129. package/dist/types/envVariables/extractEnvVariable/index.d.ts +0 -7
  130. package/dist/types/envVariables/extractEnvVariable/index.d.ts.map +0 -1
  131. package/dist/types/envVariables/extractEnvVariable/next.d.ts +0 -3
  132. package/dist/types/envVariables/extractEnvVariable/next.d.ts.map +0 -1
  133. package/dist/types/envVariables/extractEnvVariable/react_app.d.ts +0 -3
  134. package/dist/types/envVariables/extractEnvVariable/react_app.d.ts.map +0 -1
  135. package/dist/types/envVariables/extractEnvVariable/types.d.ts +0 -8
  136. package/dist/types/envVariables/extractEnvVariable/types.d.ts.map +0 -1
  137. package/dist/types/envVariables/extractEnvVariable/undefined_platform.d.ts +0 -3
  138. package/dist/types/envVariables/extractEnvVariable/undefined_platform.d.ts.map +0 -1
  139. package/dist/types/envVariables/extractEnvVariable/vite.d.ts +0 -3
  140. package/dist/types/envVariables/extractEnvVariable/vite.d.ts.map +0 -1
  141. package/dist/types/envVariables/formatEnvVariable.d.ts +0 -6
  142. package/dist/types/envVariables/formatEnvVariable.d.ts.map +0 -1
  143. package/dist/types/envVariables/getConfiguration.d.ts +0 -9
  144. package/dist/types/envVariables/getConfiguration.d.ts.map +0 -1
  145. package/dist/types/envVariables/index.d.ts +0 -5
  146. package/dist/types/envVariables/index.d.ts.map +0 -1
  147. package/dist/types/envVariables/loadEnvFile.d.ts.map +0 -1
  148. package/dist/types/envVariables/removeUndefinedValueObject.d.ts +0 -2
  149. package/dist/types/envVariables/removeUndefinedValueObject.d.ts.map +0 -1
  150. package/dist/types/envVariables/utils.d.ts +0 -7
  151. package/dist/types/envVariables/utils.d.ts.map +0 -1
  152. /package/dist/cjs/{envVariables/loadEnvFile.cjs → loadEnvFile.cjs} +0 -0
  153. /package/dist/esm/{envVariables/loadEnvFile.mjs → loadEnvFile.mjs} +0 -0
  154. /package/dist/types/{envVariables/loadEnvFile.d.ts → loadEnvFile.d.ts} +0 -0
@@ -0,0 +1,101 @@
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 alias_exports = {};
20
+ __export(alias_exports, {
21
+ getAlias: () => getAlias
22
+ });
23
+ module.exports = __toCommonJS(alias_exports);
24
+ var import_path = require("path");
25
+ var import_getConfiguration = require('./configFile/getConfiguration.cjs');
26
+ var import_normalizePath = require('./utils/normalizePath.cjs');
27
+ const getAlias = ({
28
+ configuration = (0, import_getConfiguration.getConfiguration)(),
29
+ format = "esm",
30
+ formatter = (value) => value
31
+ } = {}) => {
32
+ const extension = format === "cjs" ? "cjs" : "mjs";
33
+ const { mainDir, configDir, baseDir } = configuration.content;
34
+ const dictionariesPath = (0, import_path.join)(mainDir, `dictionaries.${extension}`);
35
+ const relativeDictionariesPath = (0, import_path.relative)(baseDir, dictionariesPath);
36
+ const normalizedDictionariesPath = formatter(
37
+ (0, import_normalizePath.normalizePath)(relativeDictionariesPath)
38
+ );
39
+ const unmergedDictionariesPath = (0, import_path.join)(
40
+ mainDir,
41
+ `unmerged_dictionaries.${extension}`
42
+ );
43
+ const relativeUnmergedDictionariesPath = (0, import_path.relative)(
44
+ baseDir,
45
+ unmergedDictionariesPath
46
+ );
47
+ const normalizedUnmergedDictionariesPath = formatter(
48
+ (0, import_normalizePath.normalizePath)(relativeUnmergedDictionariesPath)
49
+ );
50
+ const remoteDictionariesPath = (0, import_path.join)(
51
+ mainDir,
52
+ `remote_dictionaries.${extension}`
53
+ );
54
+ const relativeRemoteDictionariesPath = (0, import_path.relative)(
55
+ baseDir,
56
+ remoteDictionariesPath
57
+ );
58
+ const normalizedRemoteDictionariesPath = formatter(
59
+ (0, import_normalizePath.normalizePath)(relativeRemoteDictionariesPath)
60
+ );
61
+ const dynamicDictionariesPath = (0, import_path.join)(
62
+ mainDir,
63
+ `dynamic_dictionaries.${extension}`
64
+ );
65
+ const relativeDynamicDictionariesPath = (0, import_path.relative)(
66
+ baseDir,
67
+ dynamicDictionariesPath
68
+ );
69
+ const normalizedDynamicDictionariesPath = formatter(
70
+ (0, import_normalizePath.normalizePath)(relativeDynamicDictionariesPath)
71
+ );
72
+ const fetchDictionariesPath = (0, import_path.join)(
73
+ mainDir,
74
+ `fetch_dictionaries.${extension}`
75
+ );
76
+ const relativeFetchDictionariesPath = (0, import_path.relative)(
77
+ baseDir,
78
+ fetchDictionariesPath
79
+ );
80
+ const normalizedFetchDictionariesPath = formatter(
81
+ (0, import_normalizePath.normalizePath)(relativeFetchDictionariesPath)
82
+ );
83
+ const configurationPath = (0, import_path.join)(configDir, `configuration.json`);
84
+ const relativeConfigurationPath = (0, import_path.relative)(baseDir, configurationPath);
85
+ const normalizedConfigurationPath = formatter(
86
+ (0, import_normalizePath.normalizePath)(relativeConfigurationPath)
87
+ );
88
+ return {
89
+ "@intlayer/dictionaries-entry": normalizedDictionariesPath,
90
+ "@intlayer/unmerged-dictionaries-entry": normalizedUnmergedDictionariesPath,
91
+ "@intlayer/remote-dictionaries-entry": normalizedRemoteDictionariesPath,
92
+ "@intlayer/dynamic-dictionaries-entry": normalizedDynamicDictionariesPath,
93
+ "@intlayer/fetch-dictionaries-entry": normalizedFetchDictionariesPath,
94
+ "@intlayer/config/built": normalizedConfigurationPath
95
+ };
96
+ };
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ getAlias
100
+ });
101
+ //# sourceMappingURL=alias.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/alias.ts"],"sourcesContent":["import { join, relative } from 'path';\nimport { getConfiguration } from './configFile/getConfiguration';\nimport { IntlayerConfig } from './types/config';\nimport { normalizePath } from './utils/normalizePath';\n\nexport type GetAliasOptions = {\n configuration?: IntlayerConfig;\n format?: 'esm' | 'cjs';\n formatter?: (value: string) => string;\n};\n\nexport const getAlias = ({\n configuration = getConfiguration(),\n format = 'esm',\n formatter = (value: string) => value,\n}: GetAliasOptions = {}) => {\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n const { mainDir, configDir, baseDir } = configuration.content;\n\n /**\n * Dictionaries\n */\n const dictionariesPath = join(mainDir, `dictionaries.${extension}`);\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n const normalizedDictionariesPath = formatter(\n normalizePath(relativeDictionariesPath)\n );\n\n /**\n * Unmerged dictionaries\n */\n const unmergedDictionariesPath = join(\n mainDir,\n `unmerged_dictionaries.${extension}`\n );\n const relativeUnmergedDictionariesPath = relative(\n baseDir,\n unmergedDictionariesPath\n );\n const normalizedUnmergedDictionariesPath = formatter(\n normalizePath(relativeUnmergedDictionariesPath)\n );\n\n /**\n * Remote dictionaries\n */\n const remoteDictionariesPath = join(\n mainDir,\n `remote_dictionaries.${extension}`\n );\n const relativeRemoteDictionariesPath = relative(\n baseDir,\n remoteDictionariesPath\n );\n const normalizedRemoteDictionariesPath = formatter(\n normalizePath(relativeRemoteDictionariesPath)\n );\n\n /**\n * Dynamic dictionaries\n */\n const dynamicDictionariesPath = join(\n mainDir,\n `dynamic_dictionaries.${extension}`\n );\n const relativeDynamicDictionariesPath = relative(\n baseDir,\n dynamicDictionariesPath\n );\n const normalizedDynamicDictionariesPath = formatter(\n normalizePath(relativeDynamicDictionariesPath)\n );\n\n /**\n * Fetch dictionaries\n */\n const fetchDictionariesPath = join(\n mainDir,\n `fetch_dictionaries.${extension}`\n );\n const relativeFetchDictionariesPath = relative(\n baseDir,\n fetchDictionariesPath\n );\n const normalizedFetchDictionariesPath = formatter(\n normalizePath(relativeFetchDictionariesPath)\n );\n\n /**\n * Configuration\n */\n const configurationPath = join(configDir, `configuration.json`);\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n const normalizedConfigurationPath = formatter(\n normalizePath(relativeConfigurationPath)\n );\n\n return {\n '@intlayer/dictionaries-entry': normalizedDictionariesPath,\n '@intlayer/unmerged-dictionaries-entry': normalizedUnmergedDictionariesPath,\n '@intlayer/remote-dictionaries-entry': normalizedRemoteDictionariesPath,\n '@intlayer/dynamic-dictionaries-entry': normalizedDynamicDictionariesPath,\n '@intlayer/fetch-dictionaries-entry': normalizedFetchDictionariesPath,\n '@intlayer/config/built': normalizedConfigurationPath,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA+B;AAC/B,8BAAiC;AAEjC,2BAA8B;AAQvB,MAAM,WAAW,CAAC;AAAA,EACvB,oBAAgB,0CAAiB;AAAA,EACjC,SAAS;AAAA,EACT,YAAY,CAAC,UAAkB;AACjC,IAAqB,CAAC,MAAM;AAC1B,QAAM,YAAY,WAAW,QAAQ,QAAQ;AAC7C,QAAM,EAAE,SAAS,WAAW,QAAQ,IAAI,cAAc;AAKtD,QAAM,uBAAmB,kBAAK,SAAS,gBAAgB,SAAS,EAAE;AAClE,QAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AACnE,QAAM,6BAA6B;AAAA,QACjC,oCAAc,wBAAwB;AAAA,EACxC;AAKA,QAAM,+BAA2B;AAAA,IAC/B;AAAA,IACA,yBAAyB,SAAS;AAAA,EACpC;AACA,QAAM,uCAAmC;AAAA,IACvC;AAAA,IACA;AAAA,EACF;AACA,QAAM,qCAAqC;AAAA,QACzC,oCAAc,gCAAgC;AAAA,EAChD;AAKA,QAAM,6BAAyB;AAAA,IAC7B;AAAA,IACA,uBAAuB,SAAS;AAAA,EAClC;AACA,QAAM,qCAAiC;AAAA,IACrC;AAAA,IACA;AAAA,EACF;AACA,QAAM,mCAAmC;AAAA,QACvC,oCAAc,8BAA8B;AAAA,EAC9C;AAKA,QAAM,8BAA0B;AAAA,IAC9B;AAAA,IACA,wBAAwB,SAAS;AAAA,EACnC;AACA,QAAM,sCAAkC;AAAA,IACtC;AAAA,IACA;AAAA,EACF;AACA,QAAM,oCAAoC;AAAA,QACxC,oCAAc,+BAA+B;AAAA,EAC/C;AAKA,QAAM,4BAAwB;AAAA,IAC5B;AAAA,IACA,sBAAsB,SAAS;AAAA,EACjC;AACA,QAAM,oCAAgC;AAAA,IACpC;AAAA,IACA;AAAA,EACF;AACA,QAAM,kCAAkC;AAAA,QACtC,oCAAc,6BAA6B;AAAA,EAC7C;AAKA,QAAM,wBAAoB,kBAAK,WAAW,oBAAoB;AAC9D,QAAM,gCAA4B,sBAAS,SAAS,iBAAiB;AACrE,QAAM,8BAA8B;AAAA,QAClC,oCAAc,yBAAyB;AAAA,EACzC;AAEA,SAAO;AAAA,IACL,gCAAgC;AAAA,IAChC,yCAAyC;AAAA,IACzC,uCAAuC;AAAA,IACvC,wCAAwC;AAAA,IACxC,sCAAsC;AAAA,IACtC,0BAA0B;AAAA,EAC5B;AACF;","names":[]}
@@ -18,15 +18,37 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var client_exports = {};
20
20
  __export(client_exports, {
21
+ ANSIColors: () => import_logger.ANSIColors,
21
22
  Locales: () => import_locales.Locales,
22
- logger: () => import_logger.logger
23
+ clock: () => import_logger.clock,
24
+ colon: () => import_logger.colon,
25
+ colorizeKey: () => import_logger.colorizeKey,
26
+ colorizeLocales: () => import_logger.colorizeLocales,
27
+ colorizeNumber: () => import_logger.colorizeNumber,
28
+ colorizePath: () => import_logger.colorizePath,
29
+ getAppLogger: () => import_logger.getAppLogger,
30
+ logger: () => import_logger.logger,
31
+ spinnerFrames: () => import_logger.spinnerFrames,
32
+ v: () => import_logger.v,
33
+ x: () => import_logger.x
23
34
  });
24
35
  module.exports = __toCommonJS(client_exports);
25
36
  var import_logger = require('./logger.cjs');
26
37
  var import_locales = require('./types/locales.cjs');
27
38
  // Annotate the CommonJS export names for ESM import in node:
28
39
  0 && (module.exports = {
40
+ ANSIColors,
29
41
  Locales,
30
- logger
42
+ clock,
43
+ colon,
44
+ colorizeKey,
45
+ colorizeLocales,
46
+ colorizeNumber,
47
+ colorizePath,
48
+ getAppLogger,
49
+ logger,
50
+ spinnerFrames,
51
+ v,
52
+ x
31
53
  });
32
54
  //# sourceMappingURL=client.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export { logger } from './logger';\nexport type {\n BaseContentConfig,\n BaseDerivedConfig,\n CustomIntlayerConfig,\n IntlayerConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n} from './types/config';\nexport { Locales } from './types/locales';\nexport type { LocalesValues } from './types/locales';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AASvB,qBAAwB;","names":[]}
1
+ {"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export {\n ANSIColors,\n clock,\n colon,\n colorizeKey,\n colorizeLocales,\n colorizeNumber,\n colorizePath,\n getAppLogger,\n logger,\n spinnerFrames,\n v,\n x,\n} from './logger';\nexport type {\n BaseContentConfig,\n BaseDerivedConfig,\n CustomIntlayerConfig,\n IntlayerConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n} from './types/config';\nexport { Locales } from './types/locales';\nexport type { LocalesValues } from './types/locales';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAaO;AASP,qBAAwB;","names":[]}
@@ -197,7 +197,13 @@ const buildContentFields = (customConfiguration, baseDir) => {
197
197
  *
198
198
  * Default: process.env.NODE_ENV === 'development'
199
199
  */
200
- watch: customConfiguration?.watch ?? import_content.WATCH
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
201
207
  };
202
208
  const baseDirDerivedConfiguration = {
203
209
  /**
@@ -277,6 +283,17 @@ const buildContentFields = (customConfiguration, baseDir) => {
277
283
  notDerivedContentConfig.baseDir,
278
284
  customConfiguration?.unmergedDictionariesDir ?? import_content.UNMERGED_DICTIONARIES_DIR
279
285
  ),
286
+ /**
287
+ * Directory where the remote dictionaries will be stored
288
+ *
289
+ * Relative to the result directory
290
+ *
291
+ * Default: '.intlayer/remote_dictionary'
292
+ */
293
+ remoteDictionariesDir: (0, import_path.join)(
294
+ notDerivedContentConfig.baseDir,
295
+ customConfiguration?.remoteDictionariesDir ?? import_content.REMOTE_DICTIONARIES_DIR
296
+ ),
280
297
  /**
281
298
  * Directory where the final dictionaries will be stored
282
299
  *
@@ -307,6 +324,17 @@ const buildContentFields = (customConfiguration, baseDir) => {
307
324
  notDerivedContentConfig.baseDir,
308
325
  customConfiguration?.dynamicDictionariesDir ?? import_content.DYNAMIC_DICTIONARIES_DIR
309
326
  ),
327
+ /**
328
+ * Directory where the fetch dictionaries will be stored
329
+ *
330
+ * Relative to the result directory
331
+ *
332
+ * Default: .intlayer/fetch_dictionary
333
+ */
334
+ fetchDictionariesDir: (0, import_path.join)(
335
+ notDerivedContentConfig.baseDir,
336
+ customConfiguration?.fetchDictionariesDir ?? import_content.FETCH_DICTIONARIES_DIR
337
+ ),
310
338
  /**
311
339
  * Directory where the 18n dictionaries will be stored
312
340
  *
@@ -517,7 +545,19 @@ const buildEditorFields = (customConfiguration) => ({
517
545
  *
518
546
  * Default: false
519
547
  */
520
- hotReload: customConfiguration?.hotReload ?? import_editor.HOT_RELOAD
548
+ liveSync: customConfiguration?.liveSync ?? import_editor.LIVE_SYNC,
549
+ /**
550
+ * Port of the live sync server
551
+ *
552
+ * Default: 4000
553
+ */
554
+ liveSyncPort: customConfiguration?.liveSyncPort ?? import_editor.LIVE_SYNC_PORT,
555
+ /**
556
+ * URL of the live sync server in case of remote live sync server
557
+ *
558
+ * Default: `http://localhost:${LIVE_SYNC_PORT}`
559
+ */
560
+ liveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? import_editor.LIVE_SYNC_PORT}`
521
561
  });
522
562
  const buildLogFields = (customConfiguration) => ({
523
563
  /**
@@ -589,8 +629,9 @@ const buildBuildFields = (customConfiguration) => ({
589
629
  * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.
590
630
  * - "dynamic": The dictionaries are imported dynamically in a synchronous component using the suspense API.
591
631
  * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
592
- * - "async": The dictionaries are imported dynamically in an asynchronous component.
593
- * In that case, Intlayer will replace all calls to `useIntlayer` with `await useDictionaryAsync`.
632
+ * - "live": The dictionaries are imported dynamically using the live sync API.
633
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
634
+ * 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.
594
635
  *
595
636
  * Default: "static"
596
637
  *
@@ -603,6 +644,7 @@ const buildBuildFields = (customConfiguration) => ({
603
644
  * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
604
645
  * - This option will be ignored if `optimize` is disabled.
605
646
  * - 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.
647
+ * - The "live" allows to sync the dictionaries to the live sync server.
606
648
  */
607
649
  importMode: customConfiguration?.importMode ?? import_build.IMPORT_MODE,
608
650
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { join } from 'path';\nimport {\n IMPORT_MODE,\n OPTIMIZE,\n TRAVERSE_PATTERN,\n} from '../defaultValues/build';\nimport {\n CONFIG_DIR,\n CONTENT_DIR,\n DICTIONARIES_DIR,\n DICTIONARY_OUTPUT,\n DYNAMIC_DICTIONARIES_DIR,\n EXCLUDED_PATHS,\n FILE_EXTENSIONS,\n I18NEXT_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REACT_INTL_MESSAGES_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n WATCH,\n} from '../defaultValues/content';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n HOT_RELOAD,\n IS_ENABLED,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport {\n BASE_PATH,\n COOKIE_NAME,\n DETECT_LOCALE_ON_PREFETCH_NO_PREFIX,\n HEADER_NAME,\n NO_PREFIX,\n PREFIX_DEFAULT,\n SERVER_SET_COOKIE,\n} from '../defaultValues/middleware';\nimport type {\n AiConfig,\n BaseContentConfig,\n BaseDerivedConfig,\n BuildConfig,\n ContentConfig,\n CustomIntlayerConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n MiddlewareConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n} from '../types/config';\nimport { normalizePath } from '../utils/normalizePath';\n\nlet storedConfiguration: IntlayerConfig;\n\n// @TODO - Add possibility of directories configurations to be arrays to allow multiple packages management\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"inclusive\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"inclusive\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildMiddlewareFields = (\n customConfiguration?: Partial<MiddlewareConfig>\n): MiddlewareConfig => ({\n /**\n * Header name to get the locale\n *\n * Default: 'x-intlayer-locale'\n */\n headerName: customConfiguration?.headerName ?? HEADER_NAME,\n\n /**\n * Cookie name to get the locale\n *\n * Default: 'intlayer-locale'\n */\n cookieName: customConfiguration?.cookieName ?? COOKIE_NAME,\n\n /**\n * Prefix default prefix the default locale to the path as other locales.\n *\n * Example with prefixDefault = true and defaultLocale = 'en':\n * path = /en/dashboard or /fr/dashboard\n *\n * Example with prefixDefault = false and defaultLocale = 'en':\n * path = /dashboard or /fr/dashboard\n *\n *\n * Default: false\n */\n prefixDefault: customConfiguration?.prefixDefault ?? PREFIX_DEFAULT,\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Rule to set the cookie on the server\n * - 'always': Set the cookie on every request\n * - 'never': Never set the cookie\n */\n serverSetCookie: customConfiguration?.serverSetCookie ?? SERVER_SET_COOKIE,\n\n /**\n * No prefix in the URL\n * - true: No prefix in the URL\n * - false: Prefix in the URL\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n * - If no prefix is set, the URL will be https://example.com/en\n * - If the no prefix is set to true, the URL will be https://example.com\n *\n * Default: false\n */\n noPrefix: customConfiguration?.noPrefix ?? NO_PREFIX,\n\n /**\n * Controls whether locale detection occurs during Next.js prefetch requests\n * - true: Detect and apply locale during prefetch\n * - false: Use default locale during prefetch (recommended)\n *\n * This setting affects how Next.js handles locale prefetching:\n *\n * Example scenario:\n * - User's browser language is 'fr'\n * - Current page is /fr/about\n * - Link prefetches /about\n *\n * With `detectLocaleOnPrefetchNoPrefix:true`\n * - Prefetch detects 'fr' locale from browser\n * - Redirects prefetch to /fr/about\n *\n * With `detectLocaleOnPrefetchNoPrefix:false` (default)\n * - Prefetch uses default locale\n * - Redirects prefetch to /en/about (assuming 'en' is default)\n *\n * When to use true:\n * - Your app uses non-localized internal links (e.g. <a href=\"/about\">)\n * - You want consistent locale detection behavior between regular and prefetch requests\n *\n * When to use false (default):\n * - Your app uses locale-prefixed links (e.g. <a href=\"/fr/about\">)\n * - You want to optimize prefetching performance\n * - You want to avoid potential redirect loops\n *\n * Default: false\n */\n detectLocaleOnPrefetchNoPrefix:\n customConfiguration?.detectLocaleOnPrefetchNoPrefix ??\n DETECT_LOCALE_ON_PREFETCH_NO_PREFIX,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string\n): ContentConfig => {\n const notDerivedContentConfig: BaseContentConfig = {\n /**\n * File extensions of content to look for to build the dictionaries\n *\n * - Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']\n *\n * - Example: ['.data.ts', '.data.js', '.data.json']\n *\n * Note:\n * - Can exclude unused file extensions to improve performance\n * - Avoid using common file extensions like '.ts', '.js', '.json' to avoid conflicts\n */\n fileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\n /**\n * Absolute path of the directory of the project\n * - Default: process.cwd()\n * - Example: '\n *\n * Will be used to resolve all intlayer directories\n *\n * Note:\n * - The base directory should be the root of the project\n * - Can be changed to a custom directory to externalize either the content used in the project, or the intlayer application from the project\n */\n baseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),\n\n /**\n * Should exclude some directories from the content search\n *\n * Default: ['node_modules']\n *\n * Not used yet\n * @TODO Implement the exclusion or remove it\n */\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n\n /**\n * Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.\n *\n * Default: process.env.NODE_ENV === 'development'\n */\n watch: customConfiguration?.watch ?? WATCH,\n };\n\n const baseDirDerivedConfiguration: BaseDerivedConfig = {\n /**\n * Directory where the content is stored\n *\n * Relative to the base directory of the project\n *\n * Default: ./src\n *\n * Example: 'src'\n *\n * Note:\n * - Can be changed to a custom directory to externalize the content used in the project\n * - If the content is not at the base directory level, update the contentDirName field instead\n */\n contentDir: (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n (contentDir) => join(notDerivedContentConfig.baseDir, contentDir)\n ),\n\n /**\n * Directory where the result will be stored\n *\n * Relative to the base directory of the project\n *\n * Default: .intlayer/dictionary\n *\n * Example: '.intlayer'\n *\n * Note:\n * - Can be changed to a custom directory to externalize the intlayer application from the project\n * - If the result is not at the base directory level, update the dictionariesDirName field instead\n */\n dictionariesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the module augmentation will be stored\n *\n * Module augmentation allow better IDE suggestions and type checking\n *\n * Relative to the base directory of the project\n *\n * Default: .intlayer/types\n *\n * Example: 'types'\n *\n * Note:\n * - If this path changed, be sure to include it from the tsconfig.json file\n * - If the module augmentation is not at the base directory level, update the moduleAugmentationDirName field instead\n *\n */\n moduleAugmentationDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n\n /**\n * Output format of the dictionary\n *\n * Default: ['intlayer']\n *\n * Note:\n * - 'i18next' is not yet ensure a 1:1 mapping with the i18next library.\n * - Removing 'intlayer' will break the compatibility with react-intlayer or next-intlayer\n */\n dictionaryOutput:\n customConfiguration?.dictionaryOutput ?? DICTIONARY_OUTPUT,\n };\n\n const dictionariesDirDerivedConfiguration: ResultDirDerivedConfig = {\n /**\n * Directory where the unmerged dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: '.intlayer/unmerged_dictionary'\n *\n */\n unmergedDictionariesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the final dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/dictionary\n *\n * Example: '.intlayer/dictionary'\n *\n * Note:\n * - If the types are not at the result directory level, update the dictionariesDirName field instead\n * - The dictionaries are stored in JSON format\n * - The dictionaries are used to translate the content\n * - The dictionaries are built from the content files\n */\n dictionariesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the dynamic dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/dynamic_dictionary\n */\n dynamicDictionariesDir: join(\n notDerivedContentConfig.baseDir,\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the 18n dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: i18next_resources\n *\n * Example: '.intlayer/dictionary/i18n'\n *\n * Note:\n * - If the types are not at the result directory level, update the i18nextResourcesDirName field instead\n */\n i18nextResourcesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.i18nextResourcesDir ?? I18NEXT_DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: intl_messages\n *\n * Example: '.intlayer/react-intl_dictionary'\n *\n * Note:\n * - If the types are not at the result directory level, update the dictionariesDirName field instead\n */\n reactIntlMessagesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.reactIntlMessagesDir ?? REACT_INTL_MESSAGES_DIR\n ),\n\n /**\n * Directory where the dictionaries types will be stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/types\n *\n * Example: 'types'\n *\n * Note:\n * - If the types are not at the result directory level, update the typesDirName field instead\n */\n typesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.typesDir ?? TYPES_DIR\n ),\n\n /**\n * Directory where the main files will be stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/main\n *\n * Example: '.intlayer/main'\n *\n * Note:\n *\n * - If the main files are not at the result directory level, update the mainDirName field instead\n */\n mainDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.mainDir ?? MAIN_DIR\n ),\n\n /**\n * Directory where the configuration files are stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/config\n *\n * Example: '.intlayer/config'\n *\n * Note:\n *\n * - If the configuration files are not at the result directory level, update the configDirName field instead\n */\n configDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n };\n\n const patternsConfiguration: PatternsContentConfig = {\n /**\n * Pattern of files to watch\n *\n * Default: ['/**\\/*.content.ts', '/**\\/*.content.js', '/**\\/*.content.json', '/**\\/*.content.cjs', '/**\\/*.content.mjs', '/**\\/*.content.tsx', '/**\\/*.content.jsx']\n */\n watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(\n (ext) => `/**/*${ext}`\n ),\n\n /**\n * Pattern of files to watch including the relative path\n *\n * Default: ['src/**\\/*.content.ts', 'src/**\\/*.content.js', 'src/**\\/*.content.json', 'src/**\\/*.content.cjs', 'src/**\\/*.content.mjs', 'src/**\\/*.content.tsx', 'src/**\\/*.content.jsx']\n */\n watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap(\n (ext) =>\n baseDirDerivedConfiguration.contentDir.map(\n (contentDir) => `${normalizePath(contentDir)}/**/*${ext}`\n )\n ),\n\n /**\n * Pattern of dictionary to interpret\n *\n * Default: '.intlayer/dictionary/**\\/*.json'\n */\n outputFilesPatternWithPath: `${normalizePath(\n dictionariesDirDerivedConfiguration.dictionariesDir\n )}/**/*.json`,\n };\n\n return {\n ...notDerivedContentConfig,\n ...baseDirDerivedConfiguration,\n ...dictionariesDirDerivedConfiguration,\n ...patternsConfiguration,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: true;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://intlayer.org/dashboard/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? undefined,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://intlayer.org/dashboard/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret: customConfiguration?.clientSecret ?? undefined,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n\n /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n hotReload: customConfiguration?.hotReload ?? HOT_RELOAD,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n});\n\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n */\n applicationContext: customConfiguration?.applicationContext,\n});\n\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize ?? OPTIMIZE,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"async\": The dictionaries are imported dynamically in an asynchronous component.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `await useDictionaryAsync`.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If desabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx,mjx,cjx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n});\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const middlewareConfig = buildMiddlewareFields(\n customConfiguration?.middleware\n );\n\n const contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n middleware: middlewareConfig,\n content: contentConfig,\n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qB;AAAA,EACvB;AAEA,QAAM,mBAAmB;AAAA,IACvB,qBAAqB;AAAA,EACvB;AAEA,QAAM,gBAAgB;AAAA,IACpB,qBAAqB;AAAA,IACrB;AAAA,EACF;AAEA,QAAM,eAAe,kBAAkB,qBAAqB,MAAM;AAElE,QAAM,YAAY,eAAe,qBAAqB,GAAG;AAEzD,QAAM,WAAW,cAAc,qBAAqB,EAAE;AAEtD,QAAM,cAAc,iBAAiB,qBAAqB,KAAK;AAE/D,wBAAsB;AAAA,IACpB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { join } from 'path';\nimport {\n IMPORT_MODE,\n OPTIMIZE,\n TRAVERSE_PATTERN,\n} from '../defaultValues/build';\nimport {\n CONFIG_DIR,\n CONTENT_DIR,\n DICTIONARIES_DIR,\n DICTIONARY_OUTPUT,\n DYNAMIC_DICTIONARIES_DIR,\n EXCLUDED_PATHS,\n FETCH_DICTIONARIES_DIR,\n FILE_EXTENSIONS,\n I18NEXT_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REACT_INTL_MESSAGES_DIR,\n REMOTE_DICTIONARIES_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n WATCH,\n} from '../defaultValues/content';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n IS_ENABLED,\n LIVE_SYNC,\n LIVE_SYNC_PORT,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport {\n BASE_PATH,\n COOKIE_NAME,\n DETECT_LOCALE_ON_PREFETCH_NO_PREFIX,\n HEADER_NAME,\n NO_PREFIX,\n PREFIX_DEFAULT,\n SERVER_SET_COOKIE,\n} from '../defaultValues/middleware';\nimport type {\n AiConfig,\n BaseContentConfig,\n BaseDerivedConfig,\n BuildConfig,\n ContentConfig,\n CustomIntlayerConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n MiddlewareConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n} from '../types/config';\nimport { normalizePath } from '../utils/normalizePath';\n\nlet storedConfiguration: IntlayerConfig;\n\n// @TODO - Add possibility of directories configurations to be arrays to allow multiple packages management\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"inclusive\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"inclusive\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildMiddlewareFields = (\n customConfiguration?: Partial<MiddlewareConfig>\n): MiddlewareConfig => ({\n /**\n * Header name to get the locale\n *\n * Default: 'x-intlayer-locale'\n */\n headerName: customConfiguration?.headerName ?? HEADER_NAME,\n\n /**\n * Cookie name to get the locale\n *\n * Default: 'intlayer-locale'\n */\n cookieName: customConfiguration?.cookieName ?? COOKIE_NAME,\n\n /**\n * Prefix default prefix the default locale to the path as other locales.\n *\n * Example with prefixDefault = true and defaultLocale = 'en':\n * path = /en/dashboard or /fr/dashboard\n *\n * Example with prefixDefault = false and defaultLocale = 'en':\n * path = /dashboard or /fr/dashboard\n *\n *\n * Default: false\n */\n prefixDefault: customConfiguration?.prefixDefault ?? PREFIX_DEFAULT,\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Rule to set the cookie on the server\n * - 'always': Set the cookie on every request\n * - 'never': Never set the cookie\n */\n serverSetCookie: customConfiguration?.serverSetCookie ?? SERVER_SET_COOKIE,\n\n /**\n * No prefix in the URL\n * - true: No prefix in the URL\n * - false: Prefix in the URL\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n * - If no prefix is set, the URL will be https://example.com/en\n * - If the no prefix is set to true, the URL will be https://example.com\n *\n * Default: false\n */\n noPrefix: customConfiguration?.noPrefix ?? NO_PREFIX,\n\n /**\n * Controls whether locale detection occurs during Next.js prefetch requests\n * - true: Detect and apply locale during prefetch\n * - false: Use default locale during prefetch (recommended)\n *\n * This setting affects how Next.js handles locale prefetching:\n *\n * Example scenario:\n * - User's browser language is 'fr'\n * - Current page is /fr/about\n * - Link prefetches /about\n *\n * With `detectLocaleOnPrefetchNoPrefix:true`\n * - Prefetch detects 'fr' locale from browser\n * - Redirects prefetch to /fr/about\n *\n * With `detectLocaleOnPrefetchNoPrefix:false` (default)\n * - Prefetch uses default locale\n * - Redirects prefetch to /en/about (assuming 'en' is default)\n *\n * When to use true:\n * - Your app uses non-localized internal links (e.g. <a href=\"/about\">)\n * - You want consistent locale detection behavior between regular and prefetch requests\n *\n * When to use false (default):\n * - Your app uses locale-prefixed links (e.g. <a href=\"/fr/about\">)\n * - You want to optimize prefetching performance\n * - You want to avoid potential redirect loops\n *\n * Default: false\n */\n detectLocaleOnPrefetchNoPrefix:\n customConfiguration?.detectLocaleOnPrefetchNoPrefix ??\n DETECT_LOCALE_ON_PREFETCH_NO_PREFIX,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string\n): ContentConfig => {\n const notDerivedContentConfig: BaseContentConfig = {\n /**\n * File extensions of content to look for to build the dictionaries\n *\n * - Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']\n *\n * - Example: ['.data.ts', '.data.js', '.data.json']\n *\n * Note:\n * - Can exclude unused file extensions to improve performance\n * - Avoid using common file extensions like '.ts', '.js', '.json' to avoid conflicts\n */\n fileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\n /**\n * Absolute path of the directory of the project\n * - Default: process.cwd()\n * - Example: '\n *\n * Will be used to resolve all intlayer directories\n *\n * Note:\n * - The base directory should be the root of the project\n * - Can be changed to a custom directory to externalize either the content used in the project, or the intlayer application from the project\n */\n baseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),\n\n /**\n * Should exclude some directories from the content search\n *\n * Default: ['node_modules']\n *\n * Not used yet\n * @TODO Implement the exclusion or remove it\n */\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n\n /**\n * Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.\n *\n * Default: process.env.NODE_ENV === 'development'\n */\n watch: customConfiguration?.watch ?? WATCH,\n\n /**\n * Indicate how the content should be automatically filled using AI.\n *\n * Default: undefined\n */\n autoFill: customConfiguration?.autoFill ?? undefined,\n };\n\n const baseDirDerivedConfiguration: BaseDerivedConfig = {\n /**\n * Directory where the content is stored\n *\n * Relative to the base directory of the project\n *\n * Default: ./src\n *\n * Example: 'src'\n *\n * Note:\n * - Can be changed to a custom directory to externalize the content used in the project\n * - If the content is not at the base directory level, update the contentDirName field instead\n */\n contentDir: (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n (contentDir) => join(notDerivedContentConfig.baseDir, contentDir)\n ),\n\n /**\n * Directory where the result will be stored\n *\n * Relative to the base directory of the project\n *\n * Default: .intlayer/dictionary\n *\n * Example: '.intlayer'\n *\n * Note:\n * - Can be changed to a custom directory to externalize the intlayer application from the project\n * - If the result is not at the base directory level, update the dictionariesDirName field instead\n */\n dictionariesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the module augmentation will be stored\n *\n * Module augmentation allow better IDE suggestions and type checking\n *\n * Relative to the base directory of the project\n *\n * Default: .intlayer/types\n *\n * Example: 'types'\n *\n * Note:\n * - If this path changed, be sure to include it from the tsconfig.json file\n * - If the module augmentation is not at the base directory level, update the moduleAugmentationDirName field instead\n *\n */\n moduleAugmentationDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n\n /**\n * Output format of the dictionary\n *\n * Default: ['intlayer']\n *\n * Note:\n * - 'i18next' is not yet ensure a 1:1 mapping with the i18next library.\n * - Removing 'intlayer' will break the compatibility with react-intlayer or next-intlayer\n */\n dictionaryOutput:\n customConfiguration?.dictionaryOutput ?? DICTIONARY_OUTPUT,\n };\n\n const dictionariesDirDerivedConfiguration: ResultDirDerivedConfig = {\n /**\n * Directory where the unmerged dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: '.intlayer/unmerged_dictionary'\n *\n */\n unmergedDictionariesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the remote dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: '.intlayer/remote_dictionary'\n */\n remoteDictionariesDir: join(\n notDerivedContentConfig.baseDir,\n customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the final dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/dictionary\n *\n * Example: '.intlayer/dictionary'\n *\n * Note:\n * - If the types are not at the result directory level, update the dictionariesDirName field instead\n * - The dictionaries are stored in JSON format\n * - The dictionaries are used to translate the content\n * - The dictionaries are built from the content files\n */\n dictionariesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the dynamic dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/dynamic_dictionary\n */\n dynamicDictionariesDir: join(\n notDerivedContentConfig.baseDir,\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the fetch dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/fetch_dictionary\n */\n fetchDictionariesDir: join(\n notDerivedContentConfig.baseDir,\n customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the 18n dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: i18next_resources\n *\n * Example: '.intlayer/dictionary/i18n'\n *\n * Note:\n * - If the types are not at the result directory level, update the i18nextResourcesDirName field instead\n */\n i18nextResourcesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.i18nextResourcesDir ?? I18NEXT_DICTIONARIES_DIR\n ),\n\n /**\n * Directory where the dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: intl_messages\n *\n * Example: '.intlayer/react-intl_dictionary'\n *\n * Note:\n * - If the types are not at the result directory level, update the dictionariesDirName field instead\n */\n reactIntlMessagesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.reactIntlMessagesDir ?? REACT_INTL_MESSAGES_DIR\n ),\n\n /**\n * Directory where the dictionaries types will be stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/types\n *\n * Example: 'types'\n *\n * Note:\n * - If the types are not at the result directory level, update the typesDirName field instead\n */\n typesDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.typesDir ?? TYPES_DIR\n ),\n\n /**\n * Directory where the main files will be stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/main\n *\n * Example: '.intlayer/main'\n *\n * Note:\n *\n * - If the main files are not at the result directory level, update the mainDirName field instead\n */\n mainDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.mainDir ?? MAIN_DIR\n ),\n\n /**\n * Directory where the configuration files are stored\n *\n * Relative to the result directory\n *\n * Default: .intlayer/config\n *\n * Example: '.intlayer/config'\n *\n * Note:\n *\n * - If the configuration files are not at the result directory level, update the configDirName field instead\n */\n configDir: join(\n notDerivedContentConfig.baseDir,\n\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n };\n\n const patternsConfiguration: PatternsContentConfig = {\n /**\n * Pattern of files to watch\n *\n * Default: ['/**\\/*.content.ts', '/**\\/*.content.js', '/**\\/*.content.json', '/**\\/*.content.cjs', '/**\\/*.content.mjs', '/**\\/*.content.tsx', '/**\\/*.content.jsx']\n */\n watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(\n (ext) => `/**/*${ext}`\n ),\n\n /**\n * Pattern of files to watch including the relative path\n *\n * Default: ['src/**\\/*.content.ts', 'src/**\\/*.content.js', 'src/**\\/*.content.json', 'src/**\\/*.content.cjs', 'src/**\\/*.content.mjs', 'src/**\\/*.content.tsx', 'src/**\\/*.content.jsx']\n */\n watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap(\n (ext) =>\n baseDirDerivedConfiguration.contentDir.map(\n (contentDir) => `${normalizePath(contentDir)}/**/*${ext}`\n )\n ),\n\n /**\n * Pattern of dictionary to interpret\n *\n * Default: '.intlayer/dictionary/**\\/*.json'\n */\n outputFilesPatternWithPath: `${normalizePath(\n dictionariesDirDerivedConfiguration.dictionariesDir\n )}/**/*.json`,\n };\n\n return {\n ...notDerivedContentConfig,\n ...baseDirDerivedConfiguration,\n ...dictionariesDirDerivedConfiguration,\n ...patternsConfiguration,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: true;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://intlayer.org/dashboard/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? undefined,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://intlayer.org/dashboard/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret: customConfiguration?.clientSecret ?? undefined,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n\n /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\n /**\n * Port of the live sync server\n *\n * Default: 4000\n */\n liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\n /**\n * URL of the live sync server in case of remote live sync server\n *\n * Default: `http://localhost:${LIVE_SYNC_PORT}`\n */\n liveSyncURL:\n customConfiguration?.liveSyncURL ??\n `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n});\n\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n */\n applicationContext: customConfiguration?.applicationContext,\n});\n\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize ?? OPTIMIZE,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * Live mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as \"dynamic\" mode.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If desabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n * - The \"live\" allows to sync the dictionaries to the live sync server.\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx,mjx,cjx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n});\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const middlewareConfig = buildMiddlewareFields(\n customConfiguration?.middleware\n );\n\n const contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n middleware: middlewareConfig,\n content: contentCon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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBjB,UAAU,qBAAqB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA2B3C,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgB/C,iBAAiB,qBAAqB,mBAAmB;AAC3D;AAKO,MAAM,2BAA2B,CACtC,qBACA,YACmB;AACnB,QAAM,6BAA6B;AAAA,IACjC,qBAAqB;AAAA,EACvB;AAEA,QAAM,mBAAmB;AAAA,IACvB,qBAAqB;AAAA,EACvB;AAEA,QAAM,gBAAgB;AAAA,IACpB,qBAAqB;AAAA,IACrB;AAAA,EACF;AAEA,QAAM,eAAe,kBAAkB,qBAAqB,MAAM;AAElE,QAAM,YAAY,eAAe,qBAAqB,GAAG;AAEzD,QAAM,WAAW,cAAc,qBAAqB,EAAE;AAEtD,QAAM,cAAc,iBAAiB,qBAAqB,KAAK;AAE/D,wBAAsB;AAAA,IACpB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import merge from 'deepmerge';\nimport { relative } from 'path';\nimport type { LoadEnvFileOptions } from '../envVariables/loadEnvFile';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig, IntlayerConfig } from '../types/config';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nlet storedConfiguration: IntlayerConfig | undefined;\nlet storedConfigurationFilePath: string | undefined;\nlet storedNumCustomConfiguration: number | undefined;\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n} & LoadEnvFileOptions;\n\nconst BASE_DIR_PATH = process.cwd();\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => {\n const mergedOptions = {\n baseDir: BASE_DIR_PATH,\n ...options,\n };\n\n const { baseDir, env, envFile } = mergedOptions;\n\n if (!storedConfiguration || typeof options !== 'undefined') {\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n // Load the custom configuration\n let customConfiguration: CustomIntlayerConfig | undefined;\n\n if (configurationFilePath) {\n customConfiguration = loadConfigurationFile(configurationFilePath, {\n env,\n envFile,\n });\n }\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n baseDir\n );\n\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (options?.override?.log?.mode === 'verbose') {\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n }\n\n return merge(storedConfiguration, options?.override ?? {}) as IntlayerConfig;\n};\n\nconst logConfigFileResult = (\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(BASE_DIR_PATH, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":";;;;;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F;","names":["merge"]}
1
+ {"version":3,"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import merge from 'deepmerge';\nimport { relative } from 'path';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig, IntlayerConfig } from '../types/config';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nlet storedConfiguration: IntlayerConfig | undefined;\nlet storedConfigurationFilePath: string | undefined;\nlet storedNumCustomConfiguration: number | undefined;\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n env?: string;\n envFile?: string;\n};\n\nconst BASE_DIR_PATH = process.cwd();\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => {\n const mergedOptions = {\n baseDir: BASE_DIR_PATH,\n ...options,\n };\n\n const { baseDir, env, envFile } = mergedOptions;\n\n if (!storedConfiguration || typeof options !== 'undefined') {\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n // Load the custom configuration\n let customConfiguration: CustomIntlayerConfig | undefined;\n\n if (configurationFilePath) {\n customConfiguration = loadConfigurationFile(configurationFilePath, {\n env,\n envFile,\n });\n }\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n baseDir\n );\n\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (options?.override?.log?.mode === 'verbose') {\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n }\n\n return merge(storedConfiguration, options?.override ?? {}) as IntlayerConfig;\n};\n\nconst logConfigFileResult = (\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(BASE_DIR_PATH, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkB;AAClB,kBAAyB;AACzB,oBAAuB;AAEvB,sCAAyC;AACzC,mCAAsC;AACtC,qCAAwC;AAExC,IAAI;AACJ,IAAI;AACJ,IAAI;AASJ,MAAM,gBAAgB,QAAQ,IAAI;AAK3B,MAAM,mBAAmB,CAC9B,YACmB;AACnB,QAAM,gBAAgB;AAAA,IACpB,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,QAAM,EAAE,SAAS,KAAK,QAAQ,IAAI;AAElC,MAAI,CAAC,uBAAuB,OAAO,YAAY,aAAa;AAE1D,UAAM,EAAE,uBAAuB,uBAAuB,QACpD,wDAAwB,OAAO;AAGjC,QAAI;AAEJ,QAAI,uBAAuB;AACzB,gCAAsB,oDAAsB,uBAAuB;AAAA,QACjE;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAGA,8BAAsB;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AAEA,kCAA8B;AAC9B,mCAA+B;AAAA,EACjC;AAGA,MAAI,SAAS,UAAU,KAAK,SAAS,WAAW;AAC9C;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,aAAO,iBAAAA,SAAM,qBAAqB,SAAS,YAAY,CAAC,CAAC;AAC3D;AAEA,MAAM,sBAAsB,CAC1B,wBACA,0BACG;AACH,MAAI,2BAA2B,GAAG;AAChC,8BAAO,8DAA8D;AAAA,MACnE,WAAW;AAAA,IACb,CAAC;AAAA,EACH,OAAO;AACL,UAAM,yBAAqB,sBAAS,eAAe,qBAAsB;AAEzE,QAAI,2BAA2B,GAAG;AAChC,gCAAO,6BAA6B,kBAAkB,KAAK;AAAA,QACzD,WAAW;AAAA,MACb,CAAC;AAAA,IACH,OAAO;AACL;AAAA,QACE,6CAA6C,kBAAkB;AAAA,QAC/D;AAAA,UACE,WAAW;AAAA,QACb;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["merge"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import { type LoadEnvFileOptions } from '../envVariables/loadEnvFile';\nimport { loadExternalFile } from '../loadExternalFile';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig } from '../types/config';\n\nconst filterValidConfiguration = (\n configuration: CustomIntlayerConfig\n): CustomIntlayerConfig => {\n // @TODO Implement filtering of valid configuration\n return configuration;\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string,\n envVarOptions?: LoadEnvFileOptions\n): CustomIntlayerConfig | undefined => {\n try {\n const fileContent = loadExternalFile(configFilePath, envVarOptions);\n\n return filterValidConfiguration(fileContent);\n } catch (error) {\n logger(\n `Error: ${error} ${JSON.stringify((error as Error).stack, null, 2)}`,\n {\n level: 'error',\n }\n );\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAAiC;AACjC,oBAAuB;AAGvB,MAAM,2BAA2B,CAC/B,kBACyB;AAEzB,SAAO;AACT;AAQO,MAAM,wBAAwB,CACnC,gBACA,kBACqC;AACrC,MAAI;AACF,UAAM,kBAAc,0CAAiB,gBAAgB,aAAa;AAElE,WAAO,yBAAyB,WAAW;AAAA,EAC7C,SAAS,OAAO;AACd;AAAA,MACE,UAAU,KAAK,IAAI,KAAK,UAAW,MAAgB,OAAO,MAAM,CAAC,CAAC;AAAA,MAClE;AAAA,QACE,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import { type LoadEnvFileOptions } from '../loadEnvFile';\nimport { loadExternalFile } from '../loadExternalFile';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig } from '../types/config';\n\nconst filterValidConfiguration = (\n configuration: CustomIntlayerConfig\n): CustomIntlayerConfig => {\n // @TODO Implement filtering of valid configuration\n return configuration;\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string,\n envVarOptions?: LoadEnvFileOptions\n): CustomIntlayerConfig | undefined => {\n try {\n const fileContent = loadExternalFile(configFilePath, envVarOptions);\n\n return filterValidConfiguration(fileContent);\n } catch (error) {\n logger(\n `Error: ${error} ${JSON.stringify((error as Error).stack, null, 2)}`,\n {\n level: 'error',\n }\n );\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAAiC;AACjC,oBAAuB;AAGvB,MAAM,2BAA2B,CAC/B,kBACyB;AAEzB,SAAO;AACT;AAQO,MAAM,wBAAwB,CACnC,gBACA,kBACqC;AACrC,MAAI;AACF,UAAM,kBAAc,0CAAiB,gBAAgB,aAAa;AAElE,WAAO,yBAAyB,WAAW;AAAA,EAC7C,SAAS,OAAO;AACd;AAAA,MACE,UAAU,KAAK,IAAI,KAAK,UAAW,MAAgB,OAAO,MAAM,CAAC,CAAC;AAAA,MAClE;AAAA,QACE,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -24,11 +24,14 @@ __export(content_exports, {
24
24
  DICTIONARY_OUTPUT: () => DICTIONARY_OUTPUT,
25
25
  DYNAMIC_DICTIONARIES_DIR: () => DYNAMIC_DICTIONARIES_DIR,
26
26
  EXCLUDED_PATHS: () => EXCLUDED_PATHS,
27
+ FETCH_DICTIONARIES_DIR: () => FETCH_DICTIONARIES_DIR,
27
28
  FILE_EXTENSIONS: () => FILE_EXTENSIONS,
28
29
  I18NEXT_DICTIONARIES_DIR: () => I18NEXT_DICTIONARIES_DIR,
29
30
  MAIN_DIR: () => MAIN_DIR,
31
+ MASKS_DIR: () => MASKS_DIR,
30
32
  MODULE_AUGMENTATION_DIR: () => MODULE_AUGMENTATION_DIR,
31
33
  REACT_INTL_MESSAGES_DIR: () => REACT_INTL_MESSAGES_DIR,
34
+ REMOTE_DICTIONARIES_DIR: () => REMOTE_DICTIONARIES_DIR,
32
35
  TYPES_DIR: () => TYPES_DIR,
33
36
  UNMERGED_DICTIONARIES_DIR: () => UNMERGED_DICTIONARIES_DIR,
34
37
  WATCH: () => WATCH
@@ -56,8 +59,11 @@ const EXCLUDED_PATHS = [
56
59
  const CONTENT_DIR = ["."];
57
60
  const MAIN_DIR = ".intlayer/main";
58
61
  const DICTIONARIES_DIR = ".intlayer/dictionary";
62
+ const MASKS_DIR = ".intlayer/mask";
63
+ const REMOTE_DICTIONARIES_DIR = ".intlayer/remote_dictionary";
59
64
  const UNMERGED_DICTIONARIES_DIR = ".intlayer/unmerged_dictionary";
60
65
  const DYNAMIC_DICTIONARIES_DIR = ".intlayer/dynamic_dictionary";
66
+ const FETCH_DICTIONARIES_DIR = ".intlayer/fetch_dictionary";
61
67
  const TYPES_DIR = ".intlayer/types";
62
68
  const MODULE_AUGMENTATION_DIR = ".intlayer/types";
63
69
  const DICTIONARY_OUTPUT = ["intlayer"];
@@ -73,11 +79,14 @@ const WATCH = process.env.NODE_ENV === "development";
73
79
  DICTIONARY_OUTPUT,
74
80
  DYNAMIC_DICTIONARIES_DIR,
75
81
  EXCLUDED_PATHS,
82
+ FETCH_DICTIONARIES_DIR,
76
83
  FILE_EXTENSIONS,
77
84
  I18NEXT_DICTIONARIES_DIR,
78
85
  MAIN_DIR,
86
+ MASKS_DIR,
79
87
  MODULE_AUGMENTATION_DIR,
80
88
  REACT_INTL_MESSAGES_DIR,
89
+ REMOTE_DICTIONARIES_DIR,
81
90
  TYPES_DIR,
82
91
  UNMERGED_DICTIONARIES_DIR,
83
92
  WATCH
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["import type { DictionaryOutput } from '../types/config';\n\nexport const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.cjx',\n '.content.mjs',\n '.content.mjx',\n '.content.json',\n '.content.tsx',\n '.content.jsx',\n];\nexport const EXCLUDED_PATHS = [\n 'node_modules',\n '.intlayer',\n '.next',\n '.nuxt',\n '.expo',\n 'dist',\n];\n\nexport const CONTENT_DIR = ['.'];\n\nexport const MAIN_DIR = '.intlayer/main';\n\nexport const DICTIONARIES_DIR = '.intlayer/dictionary';\n\nexport const UNMERGED_DICTIONARIES_DIR = '.intlayer/unmerged_dictionary';\n\nexport const DYNAMIC_DICTIONARIES_DIR = '.intlayer/dynamic_dictionary';\n\nexport const TYPES_DIR = '.intlayer/types';\n\nexport const MODULE_AUGMENTATION_DIR = '.intlayer/types';\n\nexport const DICTIONARY_OUTPUT: DictionaryOutput[] = ['intlayer'];\n\nexport const I18NEXT_DICTIONARIES_DIR = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR = 'intl_messages';\n\nexport const CONFIG_DIR = '.intlayer/config';\n\nexport const WATCH = process.env.NODE_ENV === 'development';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,cAAc,CAAC,GAAG;AAExB,MAAM,WAAW;AAEjB,MAAM,mBAAmB;AAEzB,MAAM,4BAA4B;AAElC,MAAM,2BAA2B;AAEjC,MAAM,YAAY;AAElB,MAAM,0BAA0B;AAEhC,MAAM,oBAAwC,CAAC,UAAU;AAEzD,MAAM,2BAA2B;AAEjC,MAAM,0BAA0B;AAEhC,MAAM,aAAa;AAEnB,MAAM,QAAQ,QAAQ,IAAI,aAAa;","names":[]}
1
+ {"version":3,"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["import type { DictionaryOutput } from '../types/config';\n\nexport const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.cjx',\n '.content.mjs',\n '.content.mjx',\n '.content.json',\n '.content.tsx',\n '.content.jsx',\n];\nexport const EXCLUDED_PATHS = [\n 'node_modules',\n '.intlayer',\n '.next',\n '.nuxt',\n '.expo',\n 'dist',\n];\n\nexport const CONTENT_DIR = ['.'];\n\nexport const MAIN_DIR = '.intlayer/main';\n\nexport const DICTIONARIES_DIR = '.intlayer/dictionary';\n\nexport const MASKS_DIR = '.intlayer/mask';\n\nexport const REMOTE_DICTIONARIES_DIR = '.intlayer/remote_dictionary';\n\nexport const UNMERGED_DICTIONARIES_DIR = '.intlayer/unmerged_dictionary';\n\nexport const DYNAMIC_DICTIONARIES_DIR = '.intlayer/dynamic_dictionary';\n\nexport const FETCH_DICTIONARIES_DIR = '.intlayer/fetch_dictionary';\n\nexport const TYPES_DIR = '.intlayer/types';\n\nexport const MODULE_AUGMENTATION_DIR = '.intlayer/types';\n\nexport const DICTIONARY_OUTPUT: DictionaryOutput[] = ['intlayer'];\n\nexport const I18NEXT_DICTIONARIES_DIR = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR = 'intl_messages';\n\nexport const CONFIG_DIR = '.intlayer/config';\n\nexport const WATCH = process.env.NODE_ENV === 'development';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,cAAc,CAAC,GAAG;AAExB,MAAM,WAAW;AAEjB,MAAM,mBAAmB;AAEzB,MAAM,YAAY;AAElB,MAAM,0BAA0B;AAEhC,MAAM,4BAA4B;AAElC,MAAM,2BAA2B;AAEjC,MAAM,yBAAyB;AAE/B,MAAM,YAAY;AAElB,MAAM,0BAA0B;AAEhC,MAAM,oBAAwC,CAAC,UAAU;AAEzD,MAAM,2BAA2B;AAEjC,MAAM,0BAA0B;AAEhC,MAAM,aAAa;AAEnB,MAAM,QAAQ,QAAQ,IAAI,aAAa;","names":[]}
@@ -23,8 +23,9 @@ __export(editor_exports, {
23
23
  CMS_URL: () => CMS_URL,
24
24
  DICTIONARY_PRIORITY_STRATEGY: () => DICTIONARY_PRIORITY_STRATEGY,
25
25
  EDITOR_URL: () => EDITOR_URL,
26
- HOT_RELOAD: () => HOT_RELOAD,
27
26
  IS_ENABLED: () => IS_ENABLED,
27
+ LIVE_SYNC: () => LIVE_SYNC,
28
+ LIVE_SYNC_PORT: () => LIVE_SYNC_PORT,
28
29
  PORT: () => PORT
29
30
  });
30
31
  module.exports = __toCommonJS(editor_exports);
@@ -34,8 +35,9 @@ const CMS_URL = "https://intlayer.org";
34
35
  const PORT = 8e3;
35
36
  const BACKEND_URL = "https://back.intlayer.org";
36
37
  const IS_ENABLED = true;
37
- const HOT_RELOAD = false;
38
+ const LIVE_SYNC = true;
38
39
  const DICTIONARY_PRIORITY_STRATEGY = "local_first";
40
+ const LIVE_SYNC_PORT = 4e3;
39
41
  // Annotate the CommonJS export names for ESM import in node:
40
42
  0 && (module.exports = {
41
43
  APPLICATION_URL,
@@ -43,8 +45,9 @@ const DICTIONARY_PRIORITY_STRATEGY = "local_first";
43
45
  CMS_URL,
44
46
  DICTIONARY_PRIORITY_STRATEGY,
45
47
  EDITOR_URL,
46
- HOT_RELOAD,
47
48
  IS_ENABLED,
49
+ LIVE_SYNC,
50
+ LIVE_SYNC_PORT,
48
51
  PORT
49
52
  });
50
53
  //# sourceMappingURL=editor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = '';\nexport const EDITOR_URL = 'http://localhost:8000';\nexport const CMS_URL = 'https://intlayer.org';\nexport const PORT = 8000;\nexport const BACKEND_URL = 'https://back.intlayer.org';\nexport const IS_ENABLED = true;\nexport const HOT_RELOAD = false;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,kBAAkB;AACxB,MAAM,aAAa;AACnB,MAAM,UAAU;AAChB,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,+BAA+B;","names":[]}
1
+ {"version":3,"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = '';\nexport const EDITOR_URL = 'http://localhost:8000';\nexport const CMS_URL = 'https://intlayer.org';\nexport const PORT = 8000;\nexport const BACKEND_URL = 'https://back.intlayer.org';\nexport const IS_ENABLED = true;\nexport const LIVE_SYNC = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\nexport const LIVE_SYNC_PORT = 4000;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,kBAAkB;AACxB,MAAM,aAAa;AACnB,MAAM,UAAU;AAChB,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,YAAY;AAClB,MAAM,+BAA+B;AACrC,MAAM,iBAAiB;","names":[]}
@@ -22,10 +22,9 @@ __export(log_exports, {
22
22
  PREFIX: () => PREFIX
23
23
  });
24
24
  module.exports = __toCommonJS(log_exports);
25
+ var import_logger = require('../logger.cjs');
25
26
  const MODE = "default";
26
- const RESET = "\x1B[0m";
27
- const GREY = "\x1B[90m";
28
- const PREFIX = `${GREY}[intlayer] ${RESET}`;
27
+ const PREFIX = `${import_logger.ANSIColors.GREY_DARK}[intlayer] ${import_logger.ANSIColors.RESET}`;
29
28
  // Annotate the CommonJS export names for ESM import in node:
30
29
  0 && (module.exports = {
31
30
  MODE,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/defaultValues/log.ts"],"sourcesContent":["export const MODE = 'default';\n\n// ANSI color codes\nconst RESET = '\\x1b[0m';\nconst GREY = '\\x1b[90m';\n\nexport const PREFIX = `${GREY}[intlayer] ${RESET}`;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,OAAO;AAGpB,MAAM,QAAQ;AACd,MAAM,OAAO;AAEN,MAAM,SAAS,GAAG,IAAI,cAAc,KAAK;","names":[]}
1
+ {"version":3,"sources":["../../../src/defaultValues/log.ts"],"sourcesContent":["import { ANSIColors } from '../logger';\n\nexport const MODE = 'default';\n\nexport const PREFIX = `${ANSIColors.GREY_DARK}[intlayer] ${ANSIColors.RESET}`;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2B;AAEpB,MAAM,OAAO;AAEb,MAAM,SAAS,GAAG,yBAAW,SAAS,cAAc,yBAAW,KAAK;","names":[]}
@@ -21,7 +21,7 @@ __export(getSandboxContext_exports, {
21
21
  getSandBoxContext: () => getSandBoxContext
22
22
  });
23
23
  module.exports = __toCommonJS(getSandboxContext_exports);
24
- var import_loadEnvFile = require('./envVariables/loadEnvFile.cjs');
24
+ var import_loadEnvFile = require('./loadEnvFile.cjs');
25
25
  var import_ESMxCJSHelpers = require('./utils/ESMxCJSHelpers.cjs');
26
26
  const getSandBoxContext = (envVarOptions, projectRequire = import_ESMxCJSHelpers.ESMxCJSRequire) => {
27
27
  let additionalGlobalVar = {};
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getSandboxContext.ts"],"sourcesContent":["import type { Context } from 'vm';\nimport {\n type LoadEnvFileOptions,\n loadEnvFile,\n} from './envVariables/loadEnvFile';\nimport { ESMxCJSRequire } from './utils/ESMxCJSHelpers';\n\nexport const getSandBoxContext = (\n envVarOptions?: LoadEnvFileOptions,\n projectRequire = ESMxCJSRequire\n): Context => {\n let additionalGlobalVar = {};\n\n try {\n // Dynamically try to require React if it's installed in the project\n additionalGlobalVar = {\n React: projectRequire('react'),\n };\n } catch (err) {\n // React is not installed, so we don't inject it\n }\n\n const sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n process: {\n ...process,\n env: {\n ...process.env,\n ...loadEnvFile(envVarOptions),\n },\n },\n console,\n require: projectRequire,\n ...additionalGlobalVar,\n };\n\n // Dynamically inject all global variables\n Object.getOwnPropertyNames(globalThis).forEach((key) => {\n if (!(key in sandboxContext)) {\n sandboxContext[key] = globalThis[key as keyof typeof globalThis];\n }\n });\n\n return sandboxContext;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAGO;AACP,4BAA+B;AAExB,MAAM,oBAAoB,CAC/B,eACA,iBAAiB,yCACL;AACZ,MAAI,sBAAsB,CAAC;AAE3B,MAAI;AAEF,0BAAsB;AAAA,MACpB,OAAO,eAAe,OAAO;AAAA,IAC/B;AAAA,EACF,SAAS,KAAK;AAAA,EAEd;AAEA,QAAM,iBAA0B;AAAA,IAC9B,SAAS;AAAA,MACP,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,QAAQ;AAAA,MACN,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,MACP,GAAG;AAAA,MACH,KAAK;AAAA,QACH,GAAG,QAAQ;AAAA,QACX,OAAG,gCAAY,aAAa;AAAA,MAC9B;AAAA,IACF;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAGA,SAAO,oBAAoB,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACtD,QAAI,EAAE,OAAO,iBAAiB;AAC5B,qBAAe,GAAG,IAAI,WAAW,GAA8B;AAAA,IACjE;AAAA,EACF,CAAC;AAED,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/getSandboxContext.ts"],"sourcesContent":["import type { Context } from 'vm';\nimport { type LoadEnvFileOptions, loadEnvFile } from './loadEnvFile';\nimport { ESMxCJSRequire } from './utils/ESMxCJSHelpers';\n\nexport const getSandBoxContext = (\n envVarOptions?: LoadEnvFileOptions,\n projectRequire = ESMxCJSRequire\n): Context => {\n let additionalGlobalVar = {};\n\n try {\n // Dynamically try to require React if it's installed in the project\n additionalGlobalVar = {\n React: projectRequire('react'),\n };\n } catch (err) {\n // React is not installed, so we don't inject it\n }\n\n const sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n process: {\n ...process,\n env: {\n ...process.env,\n ...loadEnvFile(envVarOptions),\n },\n },\n console,\n require: projectRequire,\n ...additionalGlobalVar,\n };\n\n // Dynamically inject all global variables\n Object.getOwnPropertyNames(globalThis).forEach((key) => {\n if (!(key in sandboxContext)) {\n sandboxContext[key] = globalThis[key as keyof typeof globalThis];\n }\n });\n\n return sandboxContext;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAAqD;AACrD,4BAA+B;AAExB,MAAM,oBAAoB,CAC/B,eACA,iBAAiB,yCACL;AACZ,MAAI,sBAAsB,CAAC;AAE3B,MAAI;AAEF,0BAAsB;AAAA,MACpB,OAAO,eAAe,OAAO;AAAA,IAC/B;AAAA,EACF,SAAS,KAAK;AAAA,EAEd;AAEA,QAAM,iBAA0B;AAAA,IAC9B,SAAS;AAAA,MACP,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,QAAQ;AAAA,MACN,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,MACP,GAAG;AAAA,MACH,KAAK;AAAA,QACH,GAAG,QAAQ;AAAA,QACX,OAAG,gCAAY,aAAa;AAAA,MAC9B;AAAA,IACF;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAGA,SAAO,oBAAoB,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACtD,QAAI,EAAE,OAAO,iBAAiB;AAC5B,qBAAe,GAAG,IAAI,WAAW,GAA8B;AAAA,IACjE;AAAA,EACF,CAAC;AAED,SAAO;AACT;","names":[]}