@intlayer/config 1.0.0 → 1.0.2

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 (100) hide show
  1. package/dist/cjs/client.cjs +17 -25
  2. package/dist/cjs/client.cjs.map +1 -1
  3. package/dist/cjs/client.d.ts +3 -16
  4. package/dist/cjs/configFile/buildConfigurationFields.cjs +30 -52
  5. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  6. package/dist/cjs/configFile/buildConfigurationFields.d.ts +4 -7
  7. package/dist/cjs/configFile/getConfiguration.cjs +16 -29
  8. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  9. package/dist/cjs/configFile/getConfiguration.d.ts +5 -7
  10. package/dist/cjs/configFile/index.cjs +9 -21
  11. package/dist/cjs/configFile/index.d.ts +3 -6
  12. package/dist/cjs/configFile/loadConfigurationFile.cjs +18 -37
  13. package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
  14. package/dist/cjs/configFile/loadConfigurationFile.d.ts +3 -5
  15. package/dist/cjs/configFile/searchConfigurationFile.cjs +8 -13
  16. package/dist/cjs/configFile/searchConfigurationFile.d.ts +3 -5
  17. package/dist/cjs/defaultValues/internationalization.cjs +11 -16
  18. package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
  19. package/dist/cjs/defaultValues/internationalization.d.ts +1 -1
  20. package/dist/cjs/defaultValues/middleware.cjs +13 -18
  21. package/dist/cjs/defaultValues/middleware.d.ts +1 -8
  22. package/dist/cjs/defaultValues/server.cjs +17 -22
  23. package/dist/cjs/defaultValues/server.d.ts +1 -12
  24. package/dist/cjs/envVariables/formatEnvVariable.cjs +11 -17
  25. package/dist/cjs/envVariables/getConfiguration.cjs +23 -49
  26. package/dist/cjs/envVariables/getConfiguration.cjs.map +1 -1
  27. package/dist/cjs/envVariables/getConfiguration.d.ts +3 -14
  28. package/dist/cjs/envVariables/index.cjs +17 -25
  29. package/dist/cjs/envVariables/index.d.ts +4 -10
  30. package/dist/cjs/envVariables/utils.cjs +8 -13
  31. package/dist/cjs/envVariables/utils.d.ts +5 -14
  32. package/dist/cjs/index.cjs +20 -28
  33. package/dist/cjs/index.cjs.map +1 -1
  34. package/dist/cjs/index.d.ts +5 -22
  35. package/dist/cjs/types/config.cjs +17 -0
  36. package/dist/cjs/types/config.cjs.map +1 -0
  37. package/dist/cjs/types/config.d.ts +75 -0
  38. package/dist/cjs/{defaultValues → types}/locales.cjs +8 -13
  39. package/dist/cjs/types/locales.cjs.map +1 -0
  40. package/dist/cjs/types/locales.d.ts +236 -0
  41. package/dist/esm/client.d.mts +3 -16
  42. package/dist/esm/client.mjs +5 -5
  43. package/dist/esm/client.mjs.map +1 -1
  44. package/dist/esm/configFile/buildConfigurationFields.d.mts +4 -7
  45. package/dist/esm/configFile/buildConfigurationFields.mjs +20 -25
  46. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  47. package/dist/esm/configFile/getConfiguration.d.mts +5 -7
  48. package/dist/esm/configFile/getConfiguration.mjs +9 -8
  49. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  50. package/dist/esm/configFile/index.d.mts +3 -6
  51. package/dist/esm/configFile/index.mjs +2 -2
  52. package/dist/esm/configFile/loadConfigurationFile.d.mts +3 -5
  53. package/dist/esm/configFile/loadConfigurationFile.mjs +14 -24
  54. package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
  55. package/dist/esm/configFile/searchConfigurationFile.d.mts +3 -5
  56. package/dist/esm/configFile/searchConfigurationFile.mjs +4 -2
  57. package/dist/esm/defaultValues/internationalization.d.mts +1 -1
  58. package/dist/esm/defaultValues/internationalization.mjs +11 -4
  59. package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
  60. package/dist/esm/defaultValues/middleware.d.mts +1 -8
  61. package/dist/esm/defaultValues/middleware.mjs +2 -2
  62. package/dist/esm/defaultValues/server.d.mts +1 -12
  63. package/dist/esm/defaultValues/server.mjs +2 -2
  64. package/dist/esm/envVariables/formatEnvVariable.mjs +7 -6
  65. package/dist/esm/envVariables/getConfiguration.d.mts +3 -14
  66. package/dist/esm/envVariables/getConfiguration.mjs +15 -9
  67. package/dist/esm/envVariables/getConfiguration.mjs.map +1 -1
  68. package/dist/esm/envVariables/index.d.mts +4 -10
  69. package/dist/esm/envVariables/index.mjs +5 -5
  70. package/dist/esm/envVariables/utils.d.mts +5 -14
  71. package/dist/esm/envVariables/utils.mjs +4 -2
  72. package/dist/esm/index.d.mts +5 -22
  73. package/dist/esm/index.mjs +6 -6
  74. package/dist/esm/index.mjs.map +1 -1
  75. package/dist/esm/types/config.d.mts +75 -0
  76. package/dist/esm/types/config.mjs +1 -0
  77. package/dist/esm/types/locales.d.mts +236 -0
  78. package/dist/esm/{defaultValues → types}/locales.mjs +4 -2
  79. package/dist/esm/types/locales.mjs.map +1 -0
  80. package/package.json +5 -8
  81. package/src/client.ts +3 -2
  82. package/src/configFile/buildConfigurationFields.ts +1 -1
  83. package/src/configFile/getConfiguration.ts +1 -1
  84. package/src/configFile/loadConfigurationFile.ts +1 -1
  85. package/src/defaultValues/internationalization.ts +3 -7
  86. package/src/envVariables/getConfiguration.ts +11 -5
  87. package/src/envVariables/utils.ts +8 -7
  88. package/src/index.ts +3 -2
  89. package/src/types/{index.ts → config.ts} +1 -1
  90. package/src/{defaultValues → types}/locales.ts +6 -0
  91. package/dist/cjs/defaultValues/locales.cjs.map +0 -1
  92. package/dist/cjs/defaultValues/locales.d.ts +0 -234
  93. package/dist/cjs/types/index.cjs +0 -21
  94. package/dist/cjs/types/index.cjs.map +0 -1
  95. package/dist/cjs/types/index.d.ts +0 -89
  96. package/dist/esm/defaultValues/locales.d.mts +0 -234
  97. package/dist/esm/defaultValues/locales.mjs.map +0 -1
  98. package/dist/esm/types/index.d.mts +0 -89
  99. package/dist/esm/types/index.mjs +0 -1
  100. /package/dist/esm/types/{index.mjs.map → config.mjs.map} +0 -0
@@ -1,16 +1,13 @@
1
1
  import { join } from "path";
2
- import {
3
- DEFAULT_LOCALE,
4
- LOCALES,
5
- } from "../defaultValues/internationalization.mjs";
2
+ import { DEFAULT_LOCALE, LOCALES } from '../defaultValues/internationalization.mjs';
6
3
  import {
7
4
  BASE_PATH,
8
5
  COOKIE_NAME,
9
6
  HEADER_NAME,
10
7
  NO_PREFIX,
11
8
  PREFIX_DEFAULT,
12
- SERVER_SET_COOKIE,
13
- } from "../defaultValues/middleware.mjs";
9
+ SERVER_SET_COOKIE
10
+ } from '../defaultValues/middleware.mjs';
14
11
  import {
15
12
  BUNDLE_DIR_NAME,
16
13
  CONTENT_DIR_NAME,
@@ -21,8 +18,8 @@ import {
21
18
  BUNDLE_FILE_EXTENSION,
22
19
  TYPES_DIR_NAME,
23
20
  MAIN_DIR_NAME,
24
- MODULE_AUGMENTATION_DIR_NAME,
25
- } from "../defaultValues/server.mjs";
21
+ MODULE_AUGMENTATION_DIR_NAME
22
+ } from '../defaultValues/server.mjs';
26
23
  let storedConfiguration;
27
24
  const buildInternationalizationFields = (customConfiguration) => ({
28
25
  /**
@@ -31,7 +28,7 @@ const buildInternationalizationFields = (customConfiguration) => ({
31
28
  // Locales available in the application
32
29
  locales: customConfiguration?.locales ?? LOCALES,
33
30
  // Default locale of the application for fallback
34
- defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,
31
+ defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE
35
32
  });
36
33
  const buildMiddlewareFields = (customConfiguration) => ({
37
34
  /**
@@ -48,7 +45,7 @@ const buildMiddlewareFields = (customConfiguration) => ({
48
45
  // Set cookie on server
49
46
  serverSetCookie: customConfiguration?.serverSetCookie ?? SERVER_SET_COOKIE,
50
47
  // No prefix
51
- noPrefix: customConfiguration?.noPrefix ?? NO_PREFIX,
48
+ noPrefix: customConfiguration?.noPrefix ?? NO_PREFIX
52
49
  });
53
50
  const buildContentFields = (customConfiguration) => {
54
51
  const notDerivedContentConfig = {
@@ -64,23 +61,19 @@ const buildContentFields = (customConfiguration) => {
64
61
  // Result directory name
65
62
  resultDirName: customConfiguration?.resultDirName ?? RESULT_DIR_NAME,
66
63
  // Module augmentation directory name
67
- moduleAugmentationDirName:
68
- customConfiguration?.moduleAugmentationDirName ??
69
- MODULE_AUGMENTATION_DIR_NAME,
64
+ moduleAugmentationDirName: customConfiguration?.moduleAugmentationDirName ?? MODULE_AUGMENTATION_DIR_NAME,
70
65
  // Bundle directory name
71
66
  bundleDirName: customConfiguration?.bundleDirName ?? BUNDLE_DIR_NAME,
72
67
  // Bundle file extension
73
- bundleFileExtension:
74
- customConfiguration?.bundleFileExtension ?? BUNDLE_FILE_EXTENSION,
68
+ bundleFileExtension: customConfiguration?.bundleFileExtension ?? BUNDLE_FILE_EXTENSION,
75
69
  // Dictionary directory name
76
- dictionariesDirName:
77
- customConfiguration?.dictionariesDirName ?? DICTIONARIES_DIR_NAME,
70
+ dictionariesDirName: customConfiguration?.dictionariesDirName ?? DICTIONARIES_DIR_NAME,
78
71
  // Types directory name
79
72
  typeDirName: customConfiguration?.typeDirName ?? TYPES_DIR_NAME,
80
73
  // Main directory name
81
74
  mainDirName: customConfiguration?.mainDirName ?? MAIN_DIR_NAME,
82
75
  // Directories to exclude
83
- excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,
76
+ excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS
84
77
  };
85
78
  const baseDirDerivedConfiguration = {
86
79
  // Directory where the content is stored
@@ -97,7 +90,7 @@ const buildContentFields = (customConfiguration) => {
97
90
  moduleAugmentationDir: join(
98
91
  notDerivedContentConfig.baseDir,
99
92
  notDerivedContentConfig.moduleAugmentationDirName
100
- ),
93
+ )
101
94
  };
102
95
  const resultDirDerivedConfiguration = {
103
96
  // Directory where the bundle will be stored
@@ -119,7 +112,7 @@ const buildContentFields = (customConfiguration) => {
119
112
  mainDir: join(
120
113
  baseDirDerivedConfiguration.resultDir,
121
114
  notDerivedContentConfig.mainDirName
122
- ),
115
+ )
123
116
  };
124
117
  const patternsConfiguration = {
125
118
  // Pattern of files to watch
@@ -131,13 +124,13 @@ const buildContentFields = (customConfiguration) => {
131
124
  (ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`
132
125
  ),
133
126
  // Pattern of files to output
134
- outputFilesPatternWithPath: `${resultDirDerivedConfiguration.dictionariesDir}/**/*.json`,
127
+ outputFilesPatternWithPath: `${resultDirDerivedConfiguration.dictionariesDir}/**/*.json`
135
128
  };
136
129
  return {
137
130
  ...notDerivedContentConfig,
138
131
  ...baseDirDerivedConfiguration,
139
132
  ...resultDirDerivedConfiguration,
140
- ...patternsConfiguration,
133
+ ...patternsConfiguration
141
134
  };
142
135
  };
143
136
  const buildConfigurationFields = (options, customConfiguration) => {
@@ -151,9 +144,11 @@ const buildConfigurationFields = (options, customConfiguration) => {
151
144
  storedConfiguration = {
152
145
  internationalization: internationalizationConfig,
153
146
  middleware: middlewareConfig,
154
- content: contentConfig,
147
+ content: contentConfig
155
148
  };
156
149
  return storedConfiguration;
157
150
  };
158
- export { buildConfigurationFields };
159
- //# sourceMappingURL=buildConfigurationFields.mjs.map
151
+ export {
152
+ buildConfigurationFields
153
+ };
154
+ //# sourceMappingURL=buildConfigurationFields.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { join } from 'path';\nimport { DEFAULT_LOCALE, LOCALES } from '../defaultValues/internationalization';\nimport {\n BASE_PATH,\n COOKIE_NAME,\n HEADER_NAME,\n NO_PREFIX,\n PREFIX_DEFAULT,\n SERVER_SET_COOKIE,\n} from '../defaultValues/middleware';\nimport {\n BUNDLE_DIR_NAME,\n CONTENT_DIR_NAME,\n DICTIONARIES_DIR_NAME,\n FILE_EXTENSIONS,\n RESULT_DIR_NAME,\n EXCLUDED_PATHS,\n BUNDLE_FILE_EXTENSION,\n TYPES_DIR_NAME,\n MAIN_DIR_NAME,\n MODULE_AUGMENTATION_DIR_NAME,\n} from '../defaultValues/server';\nimport type {\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n PatternsContentConfig,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n BaseContentConfig,\n ResultDirDerivedConfig,\n} from '../types';\nimport type { GetConfigurationOptions } from './getConfiguration';\n\nlet storedConfiguration: IntlayerConfig;\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Internationalization configuration\n */\n\n // Locales available in the application\n locales: customConfiguration?.locales ?? LOCALES,\n\n // Default locale of the application for fallback\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildMiddlewareFields = (\n customConfiguration?: Partial<MiddlewareConfig>\n): MiddlewareConfig => ({\n /**\n * Middleware configuration\n */\n\n // Header name to get the locale\n headerName: customConfiguration?.headerName ?? HEADER_NAME,\n\n // Cookie name to get the locale\n cookieName: customConfiguration?.cookieName ?? COOKIE_NAME,\n\n // Prefix the default locale in the URL\n prefixDefault: customConfiguration?.prefixDefault ?? PREFIX_DEFAULT,\n\n // Base path\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n // Set cookie on server\n serverSetCookie: customConfiguration?.serverSetCookie ?? SERVER_SET_COOKIE,\n\n // No prefix\n noPrefix: customConfiguration?.noPrefix ?? NO_PREFIX,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>\n): ContentConfig => {\n const notDerivedContentConfig: BaseContentConfig = {\n /**\n * Content configurations\n */\n\n // File extensions of content to look for\n fileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\n // Directory name of the project\n baseDir: customConfiguration?.baseDir ?? process.cwd(),\n\n // Directory name where the content is stored\n contentDirName: customConfiguration?.contentDirName ?? CONTENT_DIR_NAME,\n\n // Result directory name\n resultDirName: customConfiguration?.resultDirName ?? RESULT_DIR_NAME,\n\n // Module augmentation directory name\n moduleAugmentationDirName:\n customConfiguration?.moduleAugmentationDirName ??\n MODULE_AUGMENTATION_DIR_NAME,\n\n // Bundle directory name\n bundleDirName: customConfiguration?.bundleDirName ?? BUNDLE_DIR_NAME,\n\n // Bundle file extension\n bundleFileExtension:\n customConfiguration?.bundleFileExtension ?? BUNDLE_FILE_EXTENSION,\n\n // Dictionary directory name\n dictionariesDirName:\n customConfiguration?.dictionariesDirName ?? DICTIONARIES_DIR_NAME,\n\n // Types directory name\n typeDirName: customConfiguration?.typeDirName ?? TYPES_DIR_NAME,\n\n // Main directory name\n mainDirName: customConfiguration?.mainDirName ?? MAIN_DIR_NAME,\n\n // Directories to exclude\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n };\n\n const baseDirDerivedConfiguration: BaseDerivedConfig = {\n // Directory where the content is stored\n contentDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.contentDirName\n ),\n\n // Directory where the result will be stored\n resultDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.resultDirName\n ),\n\n // Directory where the module augmentation will be stored\n moduleAugmentationDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.moduleAugmentationDirName\n ),\n };\n\n const resultDirDerivedConfiguration: ResultDirDerivedConfig = {\n // Directory where the bundle will be stored\n bundleDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.bundleDirName\n ),\n\n // Directory where the dictionaries will be stored\n dictionariesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.dictionariesDirName\n ),\n\n // Directory where the types will be stored\n typesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.typeDirName\n ),\n\n // Directory where the main files will be stored\n mainDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.mainDirName\n ),\n };\n\n const patternsConfiguration: PatternsContentConfig = {\n // Pattern of files to watch\n watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(\n (ext) => `/**/*${ext}`\n ),\n\n // Pattern of files to watch including the relative path\n watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.map(\n (ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`\n ),\n\n // Pattern of files to output\n outputFilesPatternWithPath: `${resultDirDerivedConfiguration.dictionariesDir}/**/*.json`,\n };\n\n return {\n ...notDerivedContentConfig,\n ...baseDirDerivedConfiguration,\n ...resultDirDerivedConfiguration,\n ...patternsConfiguration,\n };\n};\n\nexport const buildConfigurationFields = (\n options: GetConfigurationOptions,\n customConfiguration?: CustomIntlayerConfig\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const middlewareConfig = buildMiddlewareFields(\n customConfiguration?.middleware\n );\n\n const contentConfig = buildContentFields(customConfiguration?.content);\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n middleware: middlewareConfig,\n content: contentConfig,\n };\n\n return storedConfiguration;\n};\n"],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,gBAAgB,eAAe;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAcP,IAAI;AAEJ,MAAM,kCAAkC,CACtC,yBACgC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhC,SAAS,qBAAqB,WAAW;AAAA;AAAA,EAGzC,eAAe,qBAAqB,iBAAiB;AACvD;AAEA,MAAM,wBAAwB,CAC5B,yBACsB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,YAAY,qBAAqB,cAAc;AAAA;AAAA,EAG/C,YAAY,qBAAqB,cAAc;AAAA;AAAA,EAG/C,eAAe,qBAAqB,iBAAiB;AAAA;AAAA,EAGrD,UAAU,qBAAqB,YAAY;AAAA;AAAA,EAG3C,iBAAiB,qBAAqB,mBAAmB;AAAA;AAAA,EAGzD,U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nD,qBAAqB,wBAAwB,eAAe;AAAA,MAC1D,CAAC,QAAQ,QAAQ,GAAG;AAAA,IACtB;AAAA;AAAA,IAGA,6BAA6B,wBAAwB,eAAe;AAAA,MAClE,CAAC,QAAQ,GAAG,4BAA4B,UAAU,QAAQ,GAAG;AAAA,IAC/D;AAAA;AAAA,IAGA,4BAA4B,GAAG,8BAA8B,eAAe;AAAA,EAC9E;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAEO,MAAM,2BAA2B,CACtC,SACA,wBACmB;AACnB,QAAM,6BAA6B;AAAA,IACjC,qBAAqB;AAAA,EACvB;AAEA,QAAM,mBAAmB;AAAA,IACvB,qBAAqB;AAAA,EACvB;AAEA,QAAM,gBAAgB,mBAAmB,qBAAqB,OAAO;AAErE,wBAAsB;AAAA,IACpB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { join } from 'path';\nimport { DEFAULT_LOCALE, LOCALES } from '../defaultValues/internationalization';\nimport {\n BASE_PATH,\n COOKIE_NAME,\n HEADER_NAME,\n NO_PREFIX,\n PREFIX_DEFAULT,\n SERVER_SET_COOKIE,\n} from '../defaultValues/middleware';\nimport {\n BUNDLE_DIR_NAME,\n CONTENT_DIR_NAME,\n DICTIONARIES_DIR_NAME,\n FILE_EXTENSIONS,\n RESULT_DIR_NAME,\n EXCLUDED_PATHS,\n BUNDLE_FILE_EXTENSION,\n TYPES_DIR_NAME,\n MAIN_DIR_NAME,\n MODULE_AUGMENTATION_DIR_NAME,\n} from '../defaultValues/server';\nimport type {\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n PatternsContentConfig,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n BaseContentConfig,\n ResultDirDerivedConfig,\n} from '../types/config';\nimport type { GetConfigurationOptions } from './getConfiguration';\n\nlet storedConfiguration: IntlayerConfig;\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Internationalization configuration\n */\n\n // Locales available in the application\n locales: customConfiguration?.locales ?? LOCALES,\n\n // Default locale of the application for fallback\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildMiddlewareFields = (\n customConfiguration?: Partial<MiddlewareConfig>\n): MiddlewareConfig => ({\n /**\n * Middleware configuration\n */\n\n // Header name to get the locale\n headerName: customConfiguration?.headerName ?? HEADER_NAME,\n\n // Cookie name to get the locale\n cookieName: customConfiguration?.cookieName ?? COOKIE_NAME,\n\n // Prefix the default locale in the URL\n prefixDefault: customConfiguration?.prefixDefault ?? PREFIX_DEFAULT,\n\n // Base path\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n // Set cookie on server\n serverSetCookie: customConfiguration?.serverSetCookie ?? SERVER_SET_COOKIE,\n\n // No prefix\n noPrefix: customConfiguration?.noPrefix ?? NO_PREFIX,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>\n): ContentConfig => {\n const notDerivedContentConfig: BaseContentConfig = {\n /**\n * Content configurations\n */\n\n // File extensions of content to look for\n fileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\n // Directory name of the project\n baseDir: customConfiguration?.baseDir ?? process.cwd(),\n\n // Directory name where the content is stored\n contentDirName: customConfiguration?.contentDirName ?? CONTENT_DIR_NAME,\n\n // Result directory name\n resultDirName: customConfiguration?.resultDirName ?? RESULT_DIR_NAME,\n\n // Module augmentation directory name\n moduleAugmentationDirName:\n customConfiguration?.moduleAugmentationDirName ??\n MODULE_AUGMENTATION_DIR_NAME,\n\n // Bundle directory name\n bundleDirName: customConfiguration?.bundleDirName ?? BUNDLE_DIR_NAME,\n\n // Bundle file extension\n bundleFileExtension:\n customConfiguration?.bundleFileExtension ?? BUNDLE_FILE_EXTENSION,\n\n // Dictionary directory name\n dictionariesDirName:\n customConfiguration?.dictionariesDirName ?? DICTIONARIES_DIR_NAME,\n\n // Types directory name\n typeDirName: customConfiguration?.typeDirName ?? TYPES_DIR_NAME,\n\n // Main directory name\n mainDirName: customConfiguration?.mainDirName ?? MAIN_DIR_NAME,\n\n // Directories to exclude\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n };\n\n const baseDirDerivedConfiguration: BaseDerivedConfig = {\n // Directory where the content is stored\n contentDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.contentDirName\n ),\n\n // Directory where the result will be stored\n resultDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.resultDirName\n ),\n\n // Directory where the module augmentation will be stored\n moduleAugmentationDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.moduleAugmentationDirName\n ),\n };\n\n const resultDirDerivedConfiguration: ResultDirDerivedConfig = {\n // Directory where the bundle will be stored\n bundleDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.bundleDirName\n ),\n\n // Directory where the dictionaries will be stored\n dictionariesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.dictionariesDirName\n ),\n\n // Directory where the types will be stored\n typesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.typeDirName\n ),\n\n // Directory where the main files will be stored\n mainDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.mainDirName\n ),\n };\n\n const patternsConfiguration: PatternsContentConfig = {\n // Pattern of files to watch\n watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(\n (ext) => `/**/*${ext}`\n ),\n\n // Pattern of files to watch including the relative path\n watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.map(\n (ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`\n ),\n\n // Pattern of files to output\n outputFilesPatternWithPath: `${resultDirDerivedConfiguration.dictionariesDir}/**/*.json`,\n };\n\n return {\n ...notDerivedContentConfig,\n ...baseDirDerivedConfiguration,\n ...resultDirDerivedConfiguration,\n ...patternsConfiguration,\n };\n};\n\nexport const buildConfigurationFields = (\n options: GetConfigurationOptions,\n customConfiguration?: CustomIntlayerConfig\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const middlewareConfig = buildMiddlewareFields(\n customConfiguration?.middleware\n );\n\n const contentConfig = buildContentFields(customConfiguration?.content);\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n middleware: middlewareConfig,\n content: contentConfig,\n };\n\n return storedConfiguration;\n};\n"],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,gBAAgB,eAAe;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAcP,IAAI;AAEJ,MAAM,kCAAkC,CACtC,yBACgC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhC,SAAS,qBAAqB,WAAW;AAAA;AAAA,EAGzC,eAAe,qBAAqB,iBAAiB;AACvD;AAEA,MAAM,wBAAwB,CAC5B,yBACsB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,YAAY,qBAAqB,cAAc;AAAA;AAAA,EAG/C,YAAY,qBAAqB,cAAc;AAAA;AAAA,EAG/C,eAAe,qBAAqB,iBAAiB;AAAA;AAAA,EAGrD,UAAU,qBAAqB,YAAY;AAAA;AAAA,EAG3C,iBAAiB,qBAAqB,mBAAmB;AAAA;AAAA,EAGzD,UAAU,qBAAqB,YAAY;AAC7C;AAEA,MAAM,qBAAqB,CACzB,wBACkB;AAClB,QAAM,0BAA6C;AAAA;AAAA;AAAA;AAAA;AAAA,IAMjD,gBAAgB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MAClE,CAAC,QAAQ,GAAG,4BAA4B,UAAU,QAAQ,GAAG;AAAA,IAC/D;AAAA;AAAA,IAGA,4BAA4B,GAAG,8BAA8B,eAAe;AAAA,EAC9E;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAEO,MAAM,2BAA2B,CACtC,SACA,wBACmB;AACnB,QAAM,6BAA6B;AAAA,IACjC,qBAAqB;AAAA,EACvB;AAEA,QAAM,mBAAmB;AAAA,IACvB,qBAAqB;AAAA,EACvB;AAEA,QAAM,gBAAgB,mBAAmB,qBAAqB,OAAO;AAErE,wBAAsB;AAAA,IACpB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AAEA,SAAO;AACT;","names":[]}
@@ -1,12 +1,10 @@
1
- import { IntlayerConfig } from "../types/index.mjs";
2
- import "../defaultValues/locales.mjs";
1
+ import { IntlayerConfig } from '../types/config.mjs';
2
+ import '../types/locales.mjs';
3
3
 
4
4
  type GetConfigurationOptions = {
5
- baseDir: string;
6
- verbose: boolean;
5
+ baseDir: string;
6
+ verbose: boolean;
7
7
  };
8
- declare const getConfiguration: (
9
- options?: Partial<GetConfigurationOptions>
10
- ) => IntlayerConfig;
8
+ declare const getConfiguration: (options?: Partial<GetConfigurationOptions>) => IntlayerConfig;
11
9
 
12
10
  export { type GetConfigurationOptions, getConfiguration };
@@ -1,21 +1,20 @@
1
1
  import { relative } from "path";
2
- import { buildConfigurationFields } from "./buildConfigurationFields.mjs";
3
- import { loadConfigurationFile } from "./loadConfigurationFile.mjs";
4
- import { searchConfigurationFile } from "./searchConfigurationFile.mjs";
2
+ import { buildConfigurationFields } from './buildConfigurationFields.mjs';
3
+ import { loadConfigurationFile } from './loadConfigurationFile.mjs';
4
+ import { searchConfigurationFile } from './searchConfigurationFile.mjs';
5
5
  let storedConfiguration;
6
6
  let storedConfigurationFilePath;
7
7
  let storedNumCustomConfiguration;
8
8
  const BASE_DIR_PATH = process.env.INTLAYER_BASE_DIR_PATH ?? process.cwd();
9
9
  const defaultOptions = {
10
10
  baseDir: BASE_DIR_PATH,
11
- verbose: false,
11
+ verbose: false
12
12
  };
13
13
  const getConfiguration = (options) => {
14
14
  const mergedOptions = { ...defaultOptions, ...options };
15
15
  const { baseDir, verbose } = mergedOptions;
16
16
  if (!storedConfiguration) {
17
- const { configurationFilePath, numCustomConfiguration } =
18
- searchConfigurationFile(baseDir);
17
+ const { configurationFilePath, numCustomConfiguration } = searchConfigurationFile(baseDir);
19
18
  let customConfiguration;
20
19
  if (configurationFilePath) {
21
20
  customConfiguration = loadConfigurationFile(configurationFilePath);
@@ -48,5 +47,7 @@ const logConfigFileResult = (numCustomConfiguration, configurationFilePath) => {
48
47
  }
49
48
  }
50
49
  };
51
- export { getConfiguration };
52
- //# sourceMappingURL=getConfiguration.mjs.map
50
+ export {
51
+ getConfiguration
52
+ };
53
+ //# sourceMappingURL=getConfiguration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'path';\nimport type { CustomIntlayerConfig, IntlayerConfig } from '../types';\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 verbose: boolean;\n};\n\nconst BASE_DIR_PATH = process.env.INTLAYER_BASE_DIR_PATH ?? process.cwd();\nconst defaultOptions: GetConfigurationOptions = {\n baseDir: BASE_DIR_PATH,\n verbose: false,\n};\n\nexport const getConfiguration = (\n options?: Partial<GetConfigurationOptions>\n): IntlayerConfig => {\n const mergedOptions = { ...defaultOptions, ...options };\n const { baseDir, verbose } = mergedOptions;\n\n if (!storedConfiguration) {\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n // Load the custom configuration\n let customConfiguration: CustomIntlayerConfig | undefined;\n if (configurationFilePath) {\n customConfiguration = loadConfigurationFile(configurationFilePath);\n }\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n mergedOptions,\n customConfiguration\n );\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (verbose)\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n\n return storedConfiguration;\n};\n\nconst logConfigFileResult = (\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n console.info('Configuration file not found, using default configuration.');\n } else {\n const relativeOutputPath = relative(BASE_DIR_PATH, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n console.info(`Configuration file found: ${relativeOutputPath}.`);\n } else {\n console.warn(\n `Multiple configuration files found, using ${relativeOutputPath}.`\n );\n }\n }\n};\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,SAAS,gCAAgC;AACzC,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AAExC,IAAI;AACJ,IAAI;AACJ,IAAI;AAOJ,MAAM,gBAAgB,QAAQ,IAAI,0BAA0B,QAAQ,IAAI;AACxE,MAAM,iBAA0C;AAAA,EAC9C,SAAS;AAAA,EACT,SAAS;AACX;AAEO,MAAM,mBAAmB,CAC9B,YACmB;AACnB,QAAM,gBAAgB,EAAE,GAAG,gBAAgB,GAAG,QAAQ;AACtD,QAAM,EAAE,SAAS,QAAQ,IAAI;AAE7B,MAAI,CAAC,qBAAqB;AAExB,UAAM,EAAE,uBAAuB,uBAAuB,IACpD,wBAAwB,OAAO;AAGjC,QAAI;AACJ,QAAI,uBAAuB;AACzB,4BAAsB,sBAAsB,qBAAqB;AAAA,IACnE;AAGA,0BAAsB;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AACA,kCAA8B;AAC9B,mCAA+B;AAAA,EACjC;AAGA,MAAI;AACF;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAEF,SAAO;AACT;AAEA,MAAM,sBAAsB,CAC1B,wBACA,0BACG;AACH,MAAI,2BAA2B,GAAG;AAChC,YAAQ,KAAK,4DAA4D;AAAA,EAC3E,OAAO;AACL,UAAM,qBAAqB,SAAS,eAAe,qBAAsB;AAEzE,QAAI,2BAA2B,GAAG;AAChC,cAAQ,KAAK,6BAA6B,kBAAkB,GAAG;AAAA,IACjE,OAAO;AACL,cAAQ;AAAA,QACN,6CAA6C,kBAAkB;AAAA,MACjE;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'path';\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 verbose: boolean;\n};\n\nconst BASE_DIR_PATH = process.env.INTLAYER_BASE_DIR_PATH ?? process.cwd();\nconst defaultOptions: GetConfigurationOptions = {\n baseDir: BASE_DIR_PATH,\n verbose: false,\n};\n\nexport const getConfiguration = (\n options?: Partial<GetConfigurationOptions>\n): IntlayerConfig => {\n const mergedOptions = { ...defaultOptions, ...options };\n const { baseDir, verbose } = mergedOptions;\n\n if (!storedConfiguration) {\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n // Load the custom configuration\n let customConfiguration: CustomIntlayerConfig | undefined;\n if (configurationFilePath) {\n customConfiguration = loadConfigurationFile(configurationFilePath);\n }\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n mergedOptions,\n customConfiguration\n );\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (verbose)\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n\n return storedConfiguration;\n};\n\nconst logConfigFileResult = (\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n console.info('Configuration file not found, using default configuration.');\n } else {\n const relativeOutputPath = relative(BASE_DIR_PATH, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n console.info(`Configuration file found: ${relativeOutputPath}.`);\n } else {\n console.warn(\n `Multiple configuration files found, using ${relativeOutputPath}.`\n );\n }\n }\n};\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,SAAS,gCAAgC;AACzC,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AAExC,IAAI;AACJ,IAAI;AACJ,IAAI;AAOJ,MAAM,gBAAgB,QAAQ,IAAI,0BAA0B,QAAQ,IAAI;AACxE,MAAM,iBAA0C;AAAA,EAC9C,SAAS;AAAA,EACT,SAAS;AACX;AAEO,MAAM,mBAAmB,CAC9B,YACmB;AACnB,QAAM,gBAAgB,EAAE,GAAG,gBAAgB,GAAG,QAAQ;AACtD,QAAM,EAAE,SAAS,QAAQ,IAAI;AAE7B,MAAI,CAAC,qBAAqB;AAExB,UAAM,EAAE,uBAAuB,uBAAuB,IACpD,wBAAwB,OAAO;AAGjC,QAAI;AACJ,QAAI,uBAAuB;AACzB,4BAAsB,sBAAsB,qBAAqB;AAAA,IACnE;AAGA,0BAAsB;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AACA,kCAA8B;AAC9B,mCAA+B;AAAA,EACjC;AAGA,MAAI;AACF;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAEF,SAAO;AACT;AAEA,MAAM,sBAAsB,CAC1B,wBACA,0BACG;AACH,MAAI,2BAA2B,GAAG;AAChC,YAAQ,KAAK,4DAA4D;AAAA,EAC3E,OAAO;AACL,UAAM,qBAAqB,SAAS,eAAe,qBAAsB;AAEzE,QAAI,2BAA2B,GAAG;AAChC,cAAQ,KAAK,6BAA6B,kBAAkB,GAAG;AAAA,IACjE,OAAO;AACL,cAAQ;AAAA,QACN,6CAA6C,kBAAkB;AAAA,MACjE;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,6 +1,3 @@
1
- export {
2
- GetConfigurationOptions,
3
- getConfiguration,
4
- } from "./getConfiguration.mjs";
5
- import "../types/index.mjs";
6
- import "../defaultValues/locales.mjs";
1
+ export { GetConfigurationOptions, getConfiguration } from './getConfiguration.mjs';
2
+ import '../types/config.mjs';
3
+ import '../types/locales.mjs';
@@ -1,2 +1,2 @@
1
- export * from "./getConfiguration.mjs";
2
- //# sourceMappingURL=index.mjs.map
1
+ export * from './getConfiguration.mjs';
2
+ //# sourceMappingURL=index.mjs.map
@@ -1,8 +1,6 @@
1
- import { CustomIntlayerConfig } from "../types/index.mjs";
2
- import "../defaultValues/locales.mjs";
1
+ import { CustomIntlayerConfig } from '../types/config.mjs';
2
+ import '../types/locales.mjs';
3
3
 
4
- declare const loadConfigurationFile: (
5
- configFilePath: string
6
- ) => CustomIntlayerConfig | undefined;
4
+ declare const loadConfigurationFile: (configFilePath: string) => CustomIntlayerConfig | undefined;
7
5
 
8
6
  export { loadConfigurationFile };
@@ -4,13 +4,13 @@ import { buildSync } from "esbuild";
4
4
  const isESModule = typeof import.meta.url === "string";
5
5
  const sandboxContext = {
6
6
  exports: {
7
- default: {},
7
+ default: {}
8
8
  },
9
9
  module: {
10
- exports: {},
10
+ exports: {}
11
11
  },
12
12
  console,
13
- require: isESModule ? createRequire(import.meta.url) : require,
13
+ require: isESModule ? createRequire(import.meta.url) : require
14
14
  };
15
15
  const transformationOption = {
16
16
  loader: {
@@ -20,14 +20,14 @@ const transformationOption = {
20
20
  ".ts": "ts",
21
21
  ".tsx": "tsx",
22
22
  ".cjs": "js",
23
- ".json": "json",
23
+ ".json": "json"
24
24
  },
25
25
  format: "cjs",
26
26
  // Output format as commonjs
27
27
  target: "es2017",
28
28
  packages: "external",
29
29
  write: false,
30
- bundle: true,
30
+ bundle: true
31
31
  };
32
32
  const loadConfigurationFile = (configFilePath) => {
33
33
  let customConfiguration = void 0;
@@ -38,7 +38,7 @@ const loadConfigurationFile = (configFilePath) => {
38
38
  }
39
39
  const moduleResult = buildSync({
40
40
  entryPoints: [configFilePath],
41
- ...transformationOption,
41
+ ...transformationOption
42
42
  });
43
43
  const moduleResultString = moduleResult.outputFiles?.[0].text;
44
44
  if (!moduleResultString) {
@@ -46,25 +46,13 @@ const loadConfigurationFile = (configFilePath) => {
46
46
  return void 0;
47
47
  }
48
48
  runInNewContext(moduleResultString, sandboxContext);
49
- if (
50
- sandboxContext.exports.default &&
51
- Object.keys(sandboxContext.exports.default).length > 0
52
- ) {
49
+ if (sandboxContext.exports.default && Object.keys(sandboxContext.exports.default).length > 0) {
53
50
  customConfiguration = sandboxContext.exports.default;
54
- } else if (
55
- sandboxContext.module.exports.defaults &&
56
- Object.keys(sandboxContext.module.exports.defaults).length > 0
57
- ) {
51
+ } else if (sandboxContext.module.exports.defaults && Object.keys(sandboxContext.module.exports.defaults).length > 0) {
58
52
  customConfiguration = sandboxContext.module.exports.default;
59
- } else if (
60
- sandboxContext.module.exports.default &&
61
- Object.keys(sandboxContext.module.exports.default).length > 0
62
- ) {
53
+ } else if (sandboxContext.module.exports.default && Object.keys(sandboxContext.module.exports.default).length > 0) {
63
54
  customConfiguration = sandboxContext.module.exports.default;
64
- } else if (
65
- sandboxContext.module.exports &&
66
- Object.keys(sandboxContext.module.exports).length > 0
67
- ) {
55
+ } else if (sandboxContext.module.exports && Object.keys(sandboxContext.module.exports).length > 0) {
68
56
  customConfiguration = sandboxContext.module.exports;
69
57
  }
70
58
  return customConfiguration;
@@ -72,5 +60,7 @@ const loadConfigurationFile = (configFilePath) => {
72
60
  console.error("Error:", error);
73
61
  }
74
62
  };
75
- export { loadConfigurationFile };
76
- //# sourceMappingURL=loadConfigurationFile.mjs.map
63
+ export {
64
+ loadConfigurationFile
65
+ };
66
+ //# sourceMappingURL=loadConfigurationFile.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\nimport { createRequire } from 'module';\nimport { type Context, runInNewContext } from 'vm';\nimport { type BuildOptions, buildSync, type BuildResult } from 'esbuild';\nimport type { CustomIntlayerConfig } from '../types';\n\nconst isESModule = typeof import.meta.url === 'string';\n\nconst sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n console,\n require: isESModule ? createRequire(import.meta.url) : require,\n};\n\nconst transformationOption: BuildOptions = {\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n },\n format: 'cjs', // Output format as commonjs\n target: 'es2017',\n packages: 'external',\n write: false,\n bundle: true,\n};\n\nexport const loadConfigurationFile = (\n configFilePath: string\n): CustomIntlayerConfig | undefined => {\n let customConfiguration: CustomIntlayerConfig | undefined = undefined;\n\n const configFileExtension = configFilePath.split('.').pop() ?? '';\n\n try {\n if (configFileExtension === 'json') {\n // Assume JSON\n return require(configFilePath);\n }\n\n // Rest is JS, MJS or TS\n\n const moduleResult: BuildResult = buildSync({\n entryPoints: [configFilePath],\n\n ...transformationOption,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n if (!moduleResultString) {\n console.error('Configuration file could not be loaded.');\n return undefined;\n }\n\n runInNewContext(moduleResultString, sandboxContext);\n\n if (\n sandboxContext.exports.default &&\n Object.keys(sandboxContext.exports.default).length > 0\n ) {\n // ES Module\n customConfiguration = sandboxContext.exports.default;\n } else if (\n sandboxContext.module.exports.defaults &&\n Object.keys(sandboxContext.module.exports.defaults).length > 0\n ) {\n // CommonJS\n customConfiguration = sandboxContext.module.exports.default;\n } else if (\n sandboxContext.module.exports.default &&\n Object.keys(sandboxContext.module.exports.default).length > 0\n ) {\n // ES Module\n customConfiguration = sandboxContext.module.exports.default;\n } else if (\n sandboxContext.module.exports &&\n Object.keys(sandboxContext.module.exports).length > 0\n ) {\n // Other\n customConfiguration = sandboxContext.module.exports;\n }\n\n return customConfiguration;\n } catch (error) {\n console.error('Error:', error);\n }\n};\n"],"mappings":"AACA,SAAS,qBAAqB;AAC9B,SAAuB,uBAAuB;AAC9C,SAA4B,iBAAmC;AAG/D,MAAM,aAAa,OAAO,YAAY,QAAQ;AAE9C,MAAM,iBAA0B;AAAA,EAC9B,SAAS;AAAA,IACP,SAAS,CAAC;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,IACN,SAAS,CAAC;AAAA,EACZ;AAAA,EACA;AAAA,EACA,SAAS,aAAa,cAAc,YAAY,GAAG,IAAI;AACzD;AAEA,MAAM,uBAAqC;AAAA,EACzC,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,QAAQ;AAAA;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AACV;AAEO,MAAM,wBAAwB,CACnC,mBACqC;AACrC,MAAI,sBAAwD;AAE5D,QAAM,sBAAsB,eAAe,MAAM,GAAG,EAAE,IAAI,KAAK;AAE/D,MAAI;AACF,QAAI,wBAAwB,QAAQ;AAElC,aAAO,QAAQ,cAAc;AAAA,IAC/B;AAIA,UAAM,eAA4B,UAAU;AAAA,MAC1C,aAAa,CAAC,cAAc;AAAA,MAE5B,GAAG;AAAA,IACL,CAAC;AAED,UAAM,qBAAqB,aAAa,cAAc,CAAC,EAAE;AAEzD,QAAI,CAAC,oBAAoB;AACvB,cAAQ,MAAM,yCAAyC;AACvD,aAAO;AAAA,IACT;AAEA,oBAAgB,oBAAoB,cAAc;AAElD,QACE,eAAe,QAAQ,WACvB,OAAO,KAAK,eAAe,QAAQ,OAAO,EAAE,SAAS,GACrD;AAEA,4BAAsB,eAAe,QAAQ;AAAA,IAC/C,WACE,eAAe,OAAO,QAAQ,YAC9B,OAAO,KAAK,eAAe,OAAO,QAAQ,QAAQ,EAAE,SAAS,GAC7D;AAEA,4BAAsB,eAAe,OAAO,QAAQ;AAAA,IACtD,WACE,eAAe,OAAO,QAAQ,WAC9B,OAAO,KAAK,eAAe,OAAO,QAAQ,OAAO,EAAE,SAAS,GAC5D;AAEA,4BAAsB,eAAe,OAAO,QAAQ;AAAA,IACtD,WACE,eAAe,OAAO,WACtB,OAAO,KAAK,eAAe,OAAO,OAAO,EAAE,SAAS,GACpD;AAEA,4BAAsB,eAAe,OAAO;AAAA,IAC9C;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,UAAU,KAAK;AAAA,EAC/B;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\nimport { createRequire } from 'module';\nimport { type Context, runInNewContext } from 'vm';\nimport { type BuildOptions, buildSync, type BuildResult } from 'esbuild';\nimport type { CustomIntlayerConfig } from '../types/config';\n\nconst isESModule = typeof import.meta.url === 'string';\n\nconst sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n console,\n require: isESModule ? createRequire(import.meta.url) : require,\n};\n\nconst transformationOption: BuildOptions = {\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n },\n format: 'cjs', // Output format as commonjs\n target: 'es2017',\n packages: 'external',\n write: false,\n bundle: true,\n};\n\nexport const loadConfigurationFile = (\n configFilePath: string\n): CustomIntlayerConfig | undefined => {\n let customConfiguration: CustomIntlayerConfig | undefined = undefined;\n\n const configFileExtension = configFilePath.split('.').pop() ?? '';\n\n try {\n if (configFileExtension === 'json') {\n // Assume JSON\n return require(configFilePath);\n }\n\n // Rest is JS, MJS or TS\n\n const moduleResult: BuildResult = buildSync({\n entryPoints: [configFilePath],\n\n ...transformationOption,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n if (!moduleResultString) {\n console.error('Configuration file could not be loaded.');\n return undefined;\n }\n\n runInNewContext(moduleResultString, sandboxContext);\n\n if (\n sandboxContext.exports.default &&\n Object.keys(sandboxContext.exports.default).length > 0\n ) {\n // ES Module\n customConfiguration = sandboxContext.exports.default;\n } else if (\n sandboxContext.module.exports.defaults &&\n Object.keys(sandboxContext.module.exports.defaults).length > 0\n ) {\n // CommonJS\n customConfiguration = sandboxContext.module.exports.default;\n } else if (\n sandboxContext.module.exports.default &&\n Object.keys(sandboxContext.module.exports.default).length > 0\n ) {\n // ES Module\n customConfiguration = sandboxContext.module.exports.default;\n } else if (\n sandboxContext.module.exports &&\n Object.keys(sandboxContext.module.exports).length > 0\n ) {\n // Other\n customConfiguration = sandboxContext.module.exports;\n }\n\n return customConfiguration;\n } catch (error) {\n console.error('Error:', error);\n }\n};\n"],"mappings":"AACA,SAAS,qBAAqB;AAC9B,SAAuB,uBAAuB;AAC9C,SAA4B,iBAAmC;AAG/D,MAAM,aAAa,OAAO,YAAY,QAAQ;AAE9C,MAAM,iBAA0B;AAAA,EAC9B,SAAS;AAAA,IACP,SAAS,CAAC;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,IACN,SAAS,CAAC;AAAA,EACZ;AAAA,EACA;AAAA,EACA,SAAS,aAAa,cAAc,YAAY,GAAG,IAAI;AACzD;AAEA,MAAM,uBAAqC;AAAA,EACzC,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA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configurationFilePath?: string;
3
+ numCustomConfiguration: number;
4
4
  };
5
- declare const searchConfigurationFile: (
6
- configFilePath: string
7
- ) => SearchConfigurationFileResult;
5
+ declare const searchConfigurationFile: (configFilePath: string) => SearchConfigurationFileResult;
8
6
 
9
7
  export { searchConfigurationFile };
@@ -28,5 +28,7 @@ const searchConfigurationFile = (configFilePath) => {
28
28
  }
29
29
  return { configurationFilePath, numCustomConfiguration };
30
30
  };
31
- export { searchConfigurationFile };
32
- //# sourceMappingURL=searchConfigurationFile.mjs.map
31
+ export {
32
+ searchConfigurationFile
33
+ };
34
+ //# sourceMappingURL=searchConfigurationFile.mjs.map
@@ -1,4 +1,4 @@
1
- import { Locales } from "./locales.mjs";
1
+ import { Locales } from '../types/locales.mjs';
2
2
 
3
3
  declare const LOCALES: Locales[];
4
4
  declare const DEFAULT_LOCALE = Locales.ENGLISH;
@@ -1,5 +1,12 @@
1
- import { Locales } from "./locales.mjs";
2
- const LOCALES = [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH];
1
+ import { Locales } from '../types/locales.mjs';
2
+ const LOCALES = [
3
+ Locales.ENGLISH,
4
+ Locales.FRENCH,
5
+ Locales.SPANISH
6
+ ];
3
7
  const DEFAULT_LOCALE = Locales.ENGLISH;
4
- export { DEFAULT_LOCALE, LOCALES };
5
- //# sourceMappingURL=internationalization.mjs.map
8
+ export {
9
+ DEFAULT_LOCALE,
10
+ LOCALES
11
+ };
12
+ //# sourceMappingURL=internationalization.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/defaultValues/internationalization.ts"],"sourcesContent":["import { Locales } from './locales';\n\nexport const LOCALES: Locales[] = [\n Locales.ENGLISH,\n Locales.FRENCH,\n Locales.SPANISH,\n];\n\nexport const DEFAULT_LOCALE = Locales.ENGLISH;\n"],"mappings":"AAAA,SAAS,eAAe;AAEjB,MAAM,UAAqB;AAAA,EAChC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACV;AAEO,MAAM,iBAAiB,QAAQ;","names":[]}
1
+ {"version":3,"sources":["../../../src/defaultValues/internationalization.ts"],"sourcesContent":["import { Locales } from '../types/locales';\n\nexport const LOCALES: Locales[] = [\n Locales.ENGLISH,\n Locales.FRENCH,\n Locales.SPANISH,\n];\n\nexport const DEFAULT_LOCALE = Locales.ENGLISH;\n"],"mappings":"AAAA,SAAS,eAAe;AAEjB,MAAM,UAAqB;AAAA,EAChC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACV;AAEO,MAAM,iBAAiB,QAAQ;","names":[]}
@@ -5,11 +5,4 @@ declare const BASE_PATH = "";
5
5
  declare const SERVER_SET_COOKIE = "always";
6
6
  declare const NO_PREFIX = false;
7
7
 
8
- export {
9
- BASE_PATH,
10
- COOKIE_NAME,
11
- HEADER_NAME,
12
- NO_PREFIX,
13
- PREFIX_DEFAULT,
14
- SERVER_SET_COOKIE,
15
- };
8
+ export { BASE_PATH, COOKIE_NAME, HEADER_NAME, NO_PREFIX, PREFIX_DEFAULT, SERVER_SET_COOKIE };
@@ -10,6 +10,6 @@ export {
10
10
  HEADER_NAME,
11
11
  NO_PREFIX,
12
12
  PREFIX_DEFAULT,
13
- SERVER_SET_COOKIE,
13
+ SERVER_SET_COOKIE
14
14
  };
15
- //# sourceMappingURL=middleware.mjs.map
15
+ //# sourceMappingURL=middleware.mjs.map
@@ -9,15 +9,4 @@ declare const DICTIONARIES_DIR_NAME = "dictionary";
9
9
  declare const TYPES_DIR_NAME = "types";
10
10
  declare const MAIN_DIR_NAME = "main";
11
11
 
12
- export {
13
- BUNDLE_DIR_NAME,
14
- BUNDLE_FILE_EXTENSION,
15
- CONTENT_DIR_NAME,
16
- DICTIONARIES_DIR_NAME,
17
- EXCLUDED_PATHS,
18
- FILE_EXTENSIONS,
19
- MAIN_DIR_NAME,
20
- MODULE_AUGMENTATION_DIR_NAME,
21
- RESULT_DIR_NAME,
22
- TYPES_DIR_NAME,
23
- };
12
+ export { BUNDLE_DIR_NAME, BUNDLE_FILE_EXTENSION, CONTENT_DIR_NAME, DICTIONARIES_DIR_NAME, EXCLUDED_PATHS, FILE_EXTENSIONS, MAIN_DIR_NAME, MODULE_AUGMENTATION_DIR_NAME, RESULT_DIR_NAME, TYPES_DIR_NAME };
@@ -18,6 +18,6 @@ export {
18
18
  MAIN_DIR_NAME,
19
19
  MODULE_AUGMENTATION_DIR_NAME,
20
20
  RESULT_DIR_NAME,
21
- TYPES_DIR_NAME,
21
+ TYPES_DIR_NAME
22
22
  };
23
- //# sourceMappingURL=server.mjs.map
23
+ //# sourceMappingURL=server.mjs.map
@@ -1,13 +1,12 @@
1
- import { getConfiguration } from "../configFile/getConfiguration.mjs";
1
+ import { getConfiguration } from '../configFile/getConfiguration.mjs';
2
2
  const formatEnvVariable = (prefix = "NEXT_PUBLIC_INTLAYER_") => {
3
3
  const intlayerConfig = getConfiguration();
4
- const formatEnvName = (key) =>
5
- prefix + key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
4
+ const formatEnvName = (key) => prefix + key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
6
5
  const env = {};
7
6
  for (const [key, value] of Object.entries({
8
7
  ...intlayerConfig.content,
9
8
  ...intlayerConfig.internationalization,
10
- ...intlayerConfig.middleware,
9
+ ...intlayerConfig.middleware
11
10
  })) {
12
11
  if (typeof value === "string") {
13
12
  env[formatEnvName(key)] = value;
@@ -17,5 +16,7 @@ const formatEnvVariable = (prefix = "NEXT_PUBLIC_INTLAYER_") => {
17
16
  }
18
17
  return env;
19
18
  };
20
- export { formatEnvVariable };
21
- //# sourceMappingURL=formatEnvVariable.mjs.map
19
+ export {
20
+ formatEnvVariable
21
+ };
22
+ //# sourceMappingURL=formatEnvVariable.mjs.map
@@ -1,10 +1,5 @@
1
- import {
2
- InternationalizationConfig,
3
- MiddlewareConfig,
4
- ContentConfig,
5
- IntlayerConfig,
6
- } from "../types/index.mjs";
7
- import "../defaultValues/locales.mjs";
1
+ import { InternationalizationConfig, MiddlewareConfig, ContentConfig, IntlayerConfig } from '../types/config.mjs';
2
+ import '../types/locales.mjs';
8
3
 
9
4
  declare const intlayerIntlConfiguration: InternationalizationConfig;
10
5
  declare const intlayerMiddlewareConfiguration: MiddlewareConfig;
@@ -12,10 +7,4 @@ declare const intlayerContentConfiguration: ContentConfig;
12
7
  declare const intlayerConfiguration: IntlayerConfig;
13
8
  declare const getConfiguration: () => IntlayerConfig;
14
9
 
15
- export {
16
- getConfiguration,
17
- intlayerConfiguration,
18
- intlayerContentConfiguration,
19
- intlayerIntlConfiguration,
20
- intlayerMiddlewareConfiguration,
21
- };
10
+ export { getConfiguration, intlayerConfiguration, intlayerContentConfiguration, intlayerIntlConfiguration, intlayerMiddlewareConfiguration };
@@ -1,10 +1,13 @@
1
- import { getEnvValue } from "./utils.mjs";
1
+ import { getEnvValue } from './utils.mjs';
2
2
  const intlayerIntlConfiguration = {
3
- locales: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_LOCALES, "array"),
3
+ locales: getEnvValue(
4
+ process.env.NEXT_PUBLIC_INTLAYER_LOCALES,
5
+ "array"
6
+ ),
4
7
  defaultLocale: getEnvValue(
5
8
  process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE,
6
9
  "string"
7
- ),
10
+ )
8
11
  };
9
12
  const intlayerMiddlewareConfiguration = {
10
13
  headerName: getEnvValue(
@@ -24,7 +27,7 @@ const intlayerMiddlewareConfiguration = {
24
27
  process.env.NEXT_PUBLIC_INTLAYER_SERVER_SET_COOKIE,
25
28
  "string"
26
29
  ),
27
- noPrefix: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_NO_PREFIX, "boolean"),
30
+ noPrefix: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_NO_PREFIX, "boolean")
28
31
  };
29
32
  const intlayerContentConfiguration = {
30
33
  fileExtensions: getEnvValue(
@@ -58,7 +61,10 @@ const intlayerContentConfiguration = {
58
61
  process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_DIR_NAME,
59
62
  "string"
60
63
  ),
61
- bundleDir: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_DIR, "string"),
64
+ bundleDir: getEnvValue(
65
+ process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_DIR,
66
+ "string"
67
+ ),
62
68
  bundleFileExtension: getEnvValue(
63
69
  process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_FILE_EXTENSION,
64
70
  "string"
@@ -92,12 +98,12 @@ const intlayerContentConfiguration = {
92
98
  outputFilesPatternWithPath: getEnvValue(
93
99
  process.env.NEXT_PUBLIC_INTLAYER_OUTPUT_FILES_PATTERN,
94
100
  "string"
95
- ),
101
+ )
96
102
  };
97
103
  const intlayerConfiguration = {
98
104
  internationalization: intlayerIntlConfiguration,
99
105
  middleware: intlayerMiddlewareConfiguration,
100
- content: intlayerContentConfiguration,
106
+ content: intlayerContentConfiguration
101
107
  };
102
108
  const getConfiguration = () => intlayerConfiguration;
103
109
  export {
@@ -105,6 +111,6 @@ export {
105
111
  intlayerConfiguration,
106
112
  intlayerContentConfiguration,
107
113
  intlayerIntlConfiguration,
108
- intlayerMiddlewareConfiguration,
114
+ intlayerMiddlewareConfiguration
109
115
  };
110
- //# sourceMappingURL=getConfiguration.mjs.map
116
+ //# sourceMappingURL=getConfiguration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/envVariables/getConfiguration.ts"],"sourcesContent":["import type { Locales } from '../defaultValues/locales';\nimport type {\n ContentConfig,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n ServerSetCookieRule,\n} from '../types';\nimport { getEnvValue } from './utils';\n\nexport const intlayerIntlConfiguration: InternationalizationConfig = {\n locales: getEnvValue<Locales>(\n process.env.NEXT_PUBLIC_INTLAYER_LOCALES,\n 'array'\n )!,\n defaultLocale: getEnvValue<Locales>(\n process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE,\n 'string'\n )!,\n};\n\nexport const intlayerMiddlewareConfiguration: MiddlewareConfig = {\n headerName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_HEADER_NAME,\n 'string'\n )!,\n cookieName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_COOKIE_NAME,\n 'string'\n )!,\n prefixDefault: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_PREFIX_DEFAULT,\n 'boolean'\n )!,\n basePath: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_BASE_PATH, 'string')!,\n serverSetCookie: getEnvValue<ServerSetCookieRule>(\n process.env.NEXT_PUBLIC_INTLAYER_SERVER_SET_COOKIE,\n 'string'\n )!,\n noPrefix: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_NO_PREFIX, 'boolean')!,\n};\n\nexport const intlayerContentConfiguration: ContentConfig = {\n fileExtensions: getEnvValue<string>(\n process.env.NEXT_PUBLIC_INTLAYER_FILE_EXTENSIONS,\n 'array'\n )!,\n baseDir: getEnvValue('NEXT_PUBLIC_INTLAYER_BASE_DIR', 'string')!,\n contentDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR_NAME,\n 'string'\n )!,\n contentDir: getEnvValue('NEXT_PUBLIC_INTLAYER_CONTENT_DIR', 'string')!,\n excludedPath: getEnvValue<string>(\n process.env.NEXT_PUBLIC_INTLAYER_EXCLUDED_PATH,\n 'array'\n )!,\n resultDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR_NAME,\n 'string'\n )!,\n resultDir: getEnvValue('NEXT_PUBLIC_INTLAYER_RESULT_DIR', 'string')!,\n moduleAugmentationDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n 'string'\n )!,\n moduleAugmentationDir: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR,\n 'string'\n )!,\n bundleDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_DIR_NAME,\n 'string'\n )!,\n bundleDir: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_DIR,\n 'string'\n )!,\n bundleFileExtension: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_FILE_EXTENSION,\n 'string'\n )!,\n dictionariesDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR_NAME,\n 'string'\n )!,\n dictionariesDir: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR,\n 'string'\n )!,\n typeDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_TYPES_DIR_NAME,\n 'string'\n )!,\n typesDir: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_TYPES_DIR, 'string')!,\n mainDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR_NAME,\n 'string'\n )!,\n mainDir: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR, 'string')!,\n watchedFilesPattern: getEnvValue<string>(\n process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN,\n 'array'\n )!,\n watchedFilesPatternWithPath: getEnvValue<string>(\n process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n 'array'\n )!,\n outputFilesPatternWithPath: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_OUTPUT_FILES_PATTERN,\n 'string'\n )!,\n};\n\nexport const intlayerConfiguration: IntlayerConfig = {\n internationalization: intlayerIntlConfiguration,\n middleware: intlayerMiddlewareConfiguration,\n content: intlayerContentConfiguration,\n};\n\nexport const getConfiguration = (): IntlayerConfig => intlayerConfiguration;\n"],"mappings":"AAQA,SAAS,mBAAmB;AAErB,MAAM,4BAAwD;AAAA,EACnE,SAAS;AAAA,IACP,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,QAAQ,IAAI;AAA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iB;AAAA,IACf,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAAA,EACA,UAAU,YAAY,QAAQ,IAAI,gCAAgC,QAAQ;AAAA,EAC1E,aAAa;AAAA,IACX,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAAA,EACA,SAAS,YAAY,QAAQ,IAAI,+BAA+B,QAAQ;AAAA,EACxE,qBAAqB;AAAA,IACnB,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAAA,EACA,6BAA6B;AAAA,IAC3B,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAAA,EACA,4BAA4B;AAAA,IAC1B,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AACF;AAEO,MAAM,wBAAwC;AAAA,EACnD,sBAAsB;AAAA,EACtB,YAAY;AAAA,EACZ,SAAS;AACX;AAEO,MAAM,mBAAmB,MAAsB;","names":[]}
1
+ {"version":3,"sources":["../../../src/envVariables/getConfiguration.ts"],"sourcesContent":["import type {\n ContentConfig,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n ServerSetCookieRule,\n} from '../types/config';\nimport type { Locales } from '../types/locales';\nimport { getEnvValue } from './utils';\n\nexport const intlayerIntlConfiguration: InternationalizationConfig = {\n locales: getEnvValue<Locales>(\n process.env.NEXT_PUBLIC_INTLAYER_LOCALES,\n 'array'\n )!,\n defaultLocale: getEnvValue<Locales>(\n process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE,\n 'string'\n )!,\n};\n\nexport const intlayerMiddlewareConfiguration: MiddlewareConfig = {\n headerName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_HEADER_NAME,\n 'string'\n )!,\n cookieName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_COOKIE_NAME,\n 'string'\n )!,\n prefixDefault: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_PREFIX_DEFAULT,\n 'boolean'\n )!,\n basePath: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_BASE_PATH, 'string')!,\n serverSetCookie: getEnvValue<ServerSetCookieRule>(\n process.env.NEXT_PUBLIC_INTLAYER_SERVER_SET_COOKIE,\n 'string'\n )!,\n noPrefix: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_NO_PREFIX, 'boolean')!,\n};\n\nexport const intlayerContentConfiguration: ContentConfig = {\n fileExtensions: getEnvValue<string>(\n process.env.NEXT_PUBLIC_INTLAYER_FILE_EXTENSIONS,\n 'array'\n )!,\n baseDir: getEnvValue('NEXT_PUBLIC_INTLAYER_BASE_DIR', 'string')!,\n contentDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR_NAME,\n 'string'\n )!,\n contentDir: getEnvValue('NEXT_PUBLIC_INTLAYER_CONTENT_DIR', 'string')!,\n excludedPath: getEnvValue<string>(\n process.env.NEXT_PUBLIC_INTLAYER_EXCLUDED_PATH,\n 'array'\n )!,\n resultDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR_NAME,\n 'string'\n )!,\n resultDir: getEnvValue('NEXT_PUBLIC_INTLAYER_RESULT_DIR', 'string')!,\n moduleAugmentationDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n 'string'\n )!,\n moduleAugmentationDir: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR,\n 'string'\n )!,\n bundleDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_DIR_NAME,\n 'string'\n )!,\n bundleDir: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_DIR,\n 'string'\n )!,\n bundleFileExtension: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_BUNDLE_FILE_EXTENSION,\n 'string'\n )!,\n dictionariesDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR_NAME,\n 'string'\n )!,\n dictionariesDir: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR,\n 'string'\n )!,\n typeDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_TYPES_DIR_NAME,\n 'string'\n )!,\n typesDir: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_TYPES_DIR, 'string')!,\n mainDirName: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR_NAME,\n 'string'\n )!,\n mainDir: getEnvValue(process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR, 'string')!,\n watchedFilesPattern: getEnvValue<string>(\n process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN,\n 'array'\n )!,\n watchedFilesPatternWithPath: getEnvValue<string>(\n process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n 'array'\n )!,\n outputFilesPatternWithPath: getEnvValue(\n process.env.NEXT_PUBLIC_INTLAYER_OUTPUT_FILES_PATTERN,\n 'string'\n )!,\n};\n\nexport const intlayerConfiguration: IntlayerConfig = {\n internationalization: intlayerIntlConfiguration,\n middleware: intlayerMiddlewareConfiguration,\n content: intlayerContentConfiguration,\n};\n\nexport const getConfiguration = (): IntlayerConfig => intlayerConfiguration;\n"],"mappings":"AAQA,SAAS,mBAAmB;AAErB,MAAM,4BAAwD;AAAA,EACnE,SAAS;AAAA,IACP,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AACF;AAEO,MAAM,kCAAoD;AAAA,EAC/D,YAAY;AAAA,IACV,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,QAAQ,IAAI;AAAA,IACZ;AA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