@intlayer/config 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.cjs +2 -10
- package/dist/cjs/client.cjs.map +1 -1
- package/dist/cjs/client.d.ts +1 -1
- package/dist/cjs/configFile/buildConfigurationFields.cjs +45 -4
- package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
- package/dist/cjs/defaultValues/server.cjs +15 -1
- package/dist/cjs/defaultValues/server.cjs.map +1 -1
- package/dist/cjs/defaultValues/server.d.ts +6 -1
- package/dist/cjs/envVariables/detectPlatform.cjs +7 -4
- package/dist/cjs/envVariables/detectPlatform.cjs.map +1 -1
- package/dist/cjs/envVariables/detectPlatform.d.ts +1 -4
- package/dist/cjs/envVariables/extractEnvVariable/index.cjs +44 -0
- package/dist/cjs/envVariables/extractEnvVariable/index.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/index.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/next.cjs +70 -0
- package/dist/cjs/envVariables/extractEnvVariable/next.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/next.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs +70 -0
- package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/react_app.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/types.cjs +17 -0
- package/dist/cjs/envVariables/extractEnvVariable/types.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/types.d.ts +11 -0
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs +70 -0
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite.cjs +78 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite_env.d.cjs +2 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite_env.d.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite_env.d.d.ts +2 -0
- package/dist/cjs/envVariables/getConfiguration.cjs +79 -115
- package/dist/cjs/envVariables/getConfiguration.cjs.map +1 -1
- package/dist/cjs/envVariables/getConfiguration.d.ts +2 -6
- package/dist/cjs/envVariables/index.cjs +2 -10
- package/dist/cjs/envVariables/index.cjs.map +1 -1
- package/dist/cjs/envVariables/index.d.ts +1 -1
- package/dist/cjs/index.cjs +2 -10
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/types/config.cjs.map +1 -1
- package/dist/cjs/types/config.d.ts +44 -4
- package/dist/esm/client.d.mts +1 -1
- package/dist/esm/client.mjs +2 -12
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/configFile/buildConfigurationFields.mjs +48 -5
- package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
- package/dist/esm/defaultValues/server.d.mts +6 -1
- package/dist/esm/defaultValues/server.mjs +13 -1
- package/dist/esm/defaultValues/server.mjs.map +1 -1
- package/dist/esm/envVariables/detectPlatform.d.mts +1 -4
- package/dist/esm/envVariables/detectPlatform.mjs +7 -4
- package/dist/esm/envVariables/detectPlatform.mjs.map +1 -1
- package/dist/esm/envVariables/extractEnvVariable/index.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/index.mjs +20 -0
- package/dist/esm/envVariables/extractEnvVariable/index.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/next.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/next.mjs +46 -0
- package/dist/esm/envVariables/extractEnvVariable/next.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/react_app.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/react_app.mjs +46 -0
- package/dist/esm/envVariables/extractEnvVariable/react_app.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/types.d.mts +11 -0
- package/dist/esm/envVariables/extractEnvVariable/types.mjs +1 -0
- package/dist/esm/envVariables/extractEnvVariable/types.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs +46 -0
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/vite.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/vite.mjs +53 -0
- package/dist/esm/envVariables/extractEnvVariable/vite.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/vite_env.d.d.mts +2 -0
- package/dist/esm/envVariables/extractEnvVariable/vite_env.d.mjs +1 -0
- package/dist/esm/envVariables/extractEnvVariable/vite_env.d.mjs.map +1 -0
- package/dist/esm/envVariables/getConfiguration.d.mts +2 -6
- package/dist/esm/envVariables/getConfiguration.mjs +78 -110
- package/dist/esm/envVariables/getConfiguration.mjs.map +1 -1
- package/dist/esm/envVariables/index.d.mts +1 -1
- package/dist/esm/envVariables/index.mjs +2 -12
- package/dist/esm/envVariables/index.mjs.map +1 -1
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +1 -9
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/types/config.d.mts +44 -4
- package/package.json +2 -2
- package/src/client.ts +1 -7
- package/src/configFile/buildConfigurationFields.ts +52 -3
- package/src/defaultValues/server.ts +15 -1
- package/src/envVariables/detectPlatform.ts +12 -8
- package/src/envVariables/extractEnvVariable/index.ts +20 -0
- package/src/envVariables/extractEnvVariable/next.ts +57 -0
- package/src/envVariables/extractEnvVariable/react_app.ts +57 -0
- package/src/envVariables/extractEnvVariable/types.ts +10 -0
- package/src/envVariables/extractEnvVariable/undefined_platform.ts +52 -0
- package/src/envVariables/extractEnvVariable/vite.ts +65 -0
- package/src/envVariables/extractEnvVariable/vite_env.d.ts +9 -0
- package/src/envVariables/getConfiguration.ts +84 -111
- package/src/envVariables/index.ts +1 -7
- package/src/index.ts +0 -4
- package/src/types/config.ts +47 -3
- package/dist/cjs/envVariables/extractEnvVariable.cjs +0 -211
- package/dist/cjs/envVariables/extractEnvVariable.cjs.map +0 -1
- package/dist/cjs/envVariables/extractEnvVariable.d.ts +0 -13
- package/dist/esm/envVariables/extractEnvVariable.d.mts +0 -13
- package/dist/esm/envVariables/extractEnvVariable.mjs +0 -186
- package/dist/esm/envVariables/extractEnvVariable.mjs.map +0 -1
- package/src/envVariables/extractEnvVariable.ts +0 -224
package/dist/cjs/client.cjs
CHANGED
|
@@ -19,11 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var client_exports = {};
|
|
20
20
|
__export(client_exports, {
|
|
21
21
|
Locales: () => import_locales.Locales,
|
|
22
|
-
getConfiguration: () => import_getConfiguration.getConfiguration
|
|
23
|
-
intlayerConfiguration: () => import_getConfiguration.intlayerConfiguration,
|
|
24
|
-
intlayerContentConfiguration: () => import_getConfiguration.intlayerContentConfiguration,
|
|
25
|
-
intlayerIntlConfiguration: () => import_getConfiguration.intlayerIntlConfiguration,
|
|
26
|
-
intlayerMiddlewareConfiguration: () => import_getConfiguration.intlayerMiddlewareConfiguration
|
|
22
|
+
getConfiguration: () => import_getConfiguration.getConfiguration
|
|
27
23
|
});
|
|
28
24
|
module.exports = __toCommonJS(client_exports);
|
|
29
25
|
var import_locales = require('./types/locales.cjs');
|
|
@@ -31,10 +27,6 @@ var import_getConfiguration = require('./envVariables/getConfiguration.cjs');
|
|
|
31
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
28
|
0 && (module.exports = {
|
|
33
29
|
Locales,
|
|
34
|
-
getConfiguration
|
|
35
|
-
intlayerConfiguration,
|
|
36
|
-
intlayerContentConfiguration,
|
|
37
|
-
intlayerIntlConfiguration,
|
|
38
|
-
intlayerMiddlewareConfiguration
|
|
30
|
+
getConfiguration
|
|
39
31
|
});
|
|
40
32
|
//# sourceMappingURL=client.cjs.map
|
package/dist/cjs/client.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export type {\n CustomIntlayerConfig,\n PatternsContentConfig as FixedIntlayerConfig,\n IntlayerConfig,\n BaseContentConfig as NotDerivedConfiguration,\n BaseDerivedConfig as BaseDirDerivedConfiguration,\n ResultDirDerivedConfig as ResultDirDerivedConfiguration,\n} from './types/config';\nexport type { LocalesValues } from './types/locales';\nexport { Locales } from './types/locales';\nexport {
|
|
1
|
+
{"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export type {\n CustomIntlayerConfig,\n PatternsContentConfig as FixedIntlayerConfig,\n IntlayerConfig,\n BaseContentConfig as NotDerivedConfiguration,\n BaseDerivedConfig as BaseDirDerivedConfiguration,\n ResultDirDerivedConfig as ResultDirDerivedConfiguration,\n} from './types/config';\nexport type { LocalesValues } from './types/locales';\nexport { Locales } from './types/locales';\nexport { getConfiguration } from './envVariables/getConfiguration';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,qBAAwB;AACxB,8BAAiC;","names":[]}
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { BaseDerivedConfig as BaseDirDerivedConfiguration, CustomIntlayerConfig, PatternsContentConfig as FixedIntlayerConfig, IntlayerConfig, BaseContentConfig as NotDerivedConfiguration, ResultDirDerivedConfig as ResultDirDerivedConfiguration } from './types/config.js';
|
|
2
2
|
export { Locales, LocalesValues } from './types/locales.js';
|
|
3
|
-
export { getConfiguration
|
|
3
|
+
export { getConfiguration } from './envVariables/getConfiguration.js';
|
|
@@ -31,6 +31,7 @@ const buildInternationalizationFields = (customConfiguration) => ({
|
|
|
31
31
|
* Locales available in the application
|
|
32
32
|
*
|
|
33
33
|
* Default: ['en']
|
|
34
|
+
*
|
|
34
35
|
*/
|
|
35
36
|
locales: customConfiguration?.locales ?? import_internationalization.LOCALES,
|
|
36
37
|
/**
|
|
@@ -99,7 +100,7 @@ const buildContentFields = (customConfiguration) => {
|
|
|
99
100
|
/**
|
|
100
101
|
* File extensions of content to look for to build the dictionaries
|
|
101
102
|
*
|
|
102
|
-
* - Default: ['.content.ts', '.content.js', '.content.json']
|
|
103
|
+
* - Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']
|
|
103
104
|
*
|
|
104
105
|
* - Example: ['.data.ts', '.data.js', '.data.json']
|
|
105
106
|
*
|
|
@@ -175,6 +176,20 @@ const buildContentFields = (customConfiguration) => {
|
|
|
175
176
|
*
|
|
176
177
|
*/
|
|
177
178
|
dictionariesDirName: customConfiguration?.dictionariesDirName ?? import_server.DICTIONARIES_DIR_NAME,
|
|
179
|
+
/**
|
|
180
|
+
* Related to the intlayer result directory
|
|
181
|
+
*
|
|
182
|
+
* Directory name where the dictionaries will be stored
|
|
183
|
+
*
|
|
184
|
+
* Default: 'dictionary'
|
|
185
|
+
*
|
|
186
|
+
* Example: 'translations'
|
|
187
|
+
*
|
|
188
|
+
* Note:
|
|
189
|
+
* - If this directory is not at the result directory level, update the dictionariesDir field instead
|
|
190
|
+
*
|
|
191
|
+
*/
|
|
192
|
+
i18nDictionariesDirName: customConfiguration?.i18nDictionariesDirName ?? import_server.I18N_DICTIONARIES_DIR_NAME,
|
|
178
193
|
/**
|
|
179
194
|
* Related to the intlayer result directory
|
|
180
195
|
*
|
|
@@ -266,7 +281,17 @@ const buildContentFields = (customConfiguration) => {
|
|
|
266
281
|
moduleAugmentationDir: (0, import_path.join)(
|
|
267
282
|
notDerivedContentConfig.baseDir,
|
|
268
283
|
notDerivedContentConfig.moduleAugmentationDirName
|
|
269
|
-
)
|
|
284
|
+
),
|
|
285
|
+
/**
|
|
286
|
+
* Output format of the dictionary
|
|
287
|
+
*
|
|
288
|
+
* Default: ['intlayer']
|
|
289
|
+
*
|
|
290
|
+
* Note:
|
|
291
|
+
* - 'i18next' is not yet ensure a 1:1 mapping with the i18next library.
|
|
292
|
+
* - Removing 'intlayer' will break the compatibility with react-intlayer or next-intlayer
|
|
293
|
+
*/
|
|
294
|
+
dictionaryOutput: customConfiguration?.dictionaryOutput ?? import_server.DICTIONARY_OUTPUT
|
|
270
295
|
};
|
|
271
296
|
const resultDirDerivedConfiguration = {
|
|
272
297
|
/**
|
|
@@ -288,6 +313,22 @@ const buildContentFields = (customConfiguration) => {
|
|
|
288
313
|
baseDirDerivedConfiguration.resultDir,
|
|
289
314
|
notDerivedContentConfig.dictionariesDirName
|
|
290
315
|
),
|
|
316
|
+
/**
|
|
317
|
+
* Directory where the 18n dictionaries will be stored
|
|
318
|
+
*
|
|
319
|
+
* Relative to the result directory
|
|
320
|
+
*
|
|
321
|
+
* Default: {{resultDir}} / {{i18nDictionariesDirName}}
|
|
322
|
+
*
|
|
323
|
+
* Example: '/path/to/project/.intlayer/dictionary/i18n'
|
|
324
|
+
*
|
|
325
|
+
* Note:
|
|
326
|
+
* - If the types are not at the result directory level, update the i18nDictionariesDirName field instead
|
|
327
|
+
*/
|
|
328
|
+
i18nDictionariesDir: (0, import_path.join)(
|
|
329
|
+
baseDirDerivedConfiguration.resultDir,
|
|
330
|
+
notDerivedContentConfig.i18nDictionariesDirName
|
|
331
|
+
),
|
|
291
332
|
/**
|
|
292
333
|
* Directory where the dictionaries types will be stored
|
|
293
334
|
*
|
|
@@ -326,7 +367,7 @@ const buildContentFields = (customConfiguration) => {
|
|
|
326
367
|
/**
|
|
327
368
|
* Pattern of files to watch
|
|
328
369
|
*
|
|
329
|
-
* Default: ['/**\/*.content.ts', '/**\/*.content.js', '/**\/*.content.json']
|
|
370
|
+
* Default: ['/**\/*.content.ts', '/**\/*.content.js', '/**\/*.content.json', '/**\/*.content.cjs', '/**\/*.content.mjs', '/**\/*.content.tsx', '/**\/*.content.jsx']
|
|
330
371
|
*/
|
|
331
372
|
watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(
|
|
332
373
|
(ext) => `/**/*${ext}`
|
|
@@ -334,7 +375,7 @@ const buildContentFields = (customConfiguration) => {
|
|
|
334
375
|
/**
|
|
335
376
|
* Pattern of files to watch including the relative path
|
|
336
377
|
*
|
|
337
|
-
* Default: ['{{contentDir}}/**\/*.content.ts', '{{contentDir}}/**\/*.content.js', '{{contentDir}}/**\/*.content.json']
|
|
378
|
+
* Default: ['{{contentDir}}/**\/*.content.ts', '{{contentDir}}/**\/*.content.js', '{{contentDir}}/**\/*.content.json', '{{contentDir}}/**\/*.content.cjs', '{{contentDir}}/**\/*.content.mjs', '{{contentDir}}/**\/*.content.tsx', '{{contentDir}}/**\/*.content.jsx']
|
|
338
379
|
*/
|
|
339
380
|
watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.map(
|
|
340
381
|
(ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`
|
|
@@ -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 CONTENT_DIR_NAME,\n DICTIONARIES_DIR_NAME,\n FILE_EXTENSIONS,\n RESULT_DIR_NAME,\n EXCLUDED_PATHS,\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\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 locales: customConfiguration?.locales ?? LOCALES,\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 the default locale in the URL\n *\n * Default: true\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\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>\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.json']\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: '/path/to/project'\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 ?? process.cwd(),\n\n /**\n * Directory name where the content is stored\n *\n * Default: 'src'\n *\n * Example:\n * - 'data' -> '/path/to/project/data'\n * - 'content' -> '/path/to/project/content'\n * - 'locales' -> '/path/to/project/locales'\n *\n * Note: If this directory is not at the base directory level, update the contentDir field instead\n */\n contentDirName: customConfiguration?.contentDirName ?? CONTENT_DIR_NAME,\n\n /**\n * Directory name where the result will be stored\n *\n * Default: '.intlayer'\n *\n * Example:\n * - '.next'\n * - 'outputOFIntlayer'\n *\n * Note: If this directory is not at the base directory level, update the resultDir field instead\n */\n resultDirName: customConfiguration?.resultDirName ?? RESULT_DIR_NAME,\n\n /**\n *\n * Directory name where the module augmentation will be stored\n *\n * Module augmentation allow better IDE suggestions and type checking\n *\n * Default: 'types'\n *\n * Example: 'intlayer-types'\n *\n * Note:\n * - If this path changed, be sure to include it from the tsconfig.json file\n * - If this directory is not at the base directory level, update the moduleAugmentationDir field instead\n */\n moduleAugmentationDirName:\n customConfiguration?.moduleAugmentationDirName ??\n MODULE_AUGMENTATION_DIR_NAME,\n // @TODO: Make Module Augmentation optional by adding a flag in the configuration\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries will be stored\n *\n * Default: 'dictionary'\n *\n * Example: 'translations'\n *\n * Note:\n * - If this directory is not at the result directory level, update the dictionariesDir field instead\n *\n */\n dictionariesDirName:\n customConfiguration?.dictionariesDirName ?? DICTIONARIES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries types will be stored\n *\n * Default: 'types'\n *\n * Example: 'intlayer-types'\n *\n * Note:\n * - If this directory is not at the result directory level, update the typesDir field instead\n *\n */\n typeDirName: customConfiguration?.typeDirName ?? TYPES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the main files will be stored\n *\n * Default: 'main'\n *\n * Example: 'intlayer-main'\n *\n * Note:\n * - If this directory is not at the result directory level, update the mainDir field instead\n */\n mainDirName: customConfiguration?.mainDirName ?? MAIN_DIR_NAME,\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 const baseDirDerivedConfiguration: BaseDerivedConfig = {\n /**\n * Directory where the content is stored\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{contentDirName}}\n *\n * Example: '/path/to/project/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: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.contentDirName\n ),\n\n /**\n * Directory where the result will be stored\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{resultDirName}}\n *\n * Example: '/path/to/project/.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 resultDirName field instead\n */\n resultDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.resultDirName\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: {{baseDir}} / {{moduleAugmentationDirName}}\n *\n * Example: '/path/to/project/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 notDerivedContentConfig.moduleAugmentationDirName\n ),\n };\n\n const resultDirDerivedConfiguration: ResultDirDerivedConfig = {\n /**\n * Directory where the dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{dictionariesDirName}}\n *\n * Example: '/path/to/project/.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 baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.dictionariesDirName\n ),\n\n /**\n * Directory where the dictionaries types will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{typeDirName}}\n *\n * Example: '/path/to/project/.intlayer/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 baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.typeDirName\n ),\n\n /**\n * Directory where the main files will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{mainDirName}}\n *\n * Example: '/path/to/project/.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 baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.mainDirName\n ),\n };\n\n const patternsConfiguration: PatternsContentConfig = {\n /**\n * Pattern of files to watch\n *\n * Default: ['/**\\/*.content.ts', '/**\\/*.content.js', '/**\\/*.content.json']\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: ['{{contentDir}}/**\\/*.content.ts', '{{contentDir}}/**\\/*.content.js', '{{contentDir}}/**\\/*.content.json']\n */\n watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.map(\n (ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`\n ),\n\n /**\n * Pattern of dictionary to interpret\n *\n * Default: '{{dictionariesDir}}/**\\/*.json'\n */\n outputFilesPatternWithPath: `${resultDirDerivedConfiguration.dictionariesDir}/**/*.json`,\n };\n\n return {\n ...notDerivedContentConfig,\n ...baseDirDerivedConfiguration,\n ...resultDirDerivedConfiguration,\n ...patternsConfiguration,\n };\n};\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\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;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AACrB,kCAAwC;AACxC,wBAOO;AACP,oBASO;AAcP,IAAI;AAIJ,MAAM,kCAAkC,CACtC,yBACgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhC,SAAS,qBAAqB,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzC,eAAe,qBAAqB,iBAAiB;AACvD;AAEA,MAAM,wBAAwB,CAC5B,yBACsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,eAAe,qBAAq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,GAAG;AAAA,IACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,6BAA6B,wBAAwB,eAAe;AAAA,MAClE,CAAC,QAAQ,GAAG,4BAA4B,UAAU,QAAQ,GAAG;AAAA,IAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,4BAA4B,GAAG,8BAA8B,eAAe;AAAA,EAC9E;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAKO,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 CONTENT_DIR_NAME,\n DICTIONARIES_DIR_NAME,\n FILE_EXTENSIONS,\n RESULT_DIR_NAME,\n EXCLUDED_PATHS,\n TYPES_DIR_NAME,\n MAIN_DIR_NAME,\n MODULE_AUGMENTATION_DIR_NAME,\n I18N_DICTIONARIES_DIR_NAME,\n DICTIONARY_OUTPUT,\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\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 * 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 the default locale in the URL\n *\n * Default: true\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\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>\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: '/path/to/project'\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 ?? process.cwd(),\n\n /**\n * Directory name where the content is stored\n *\n * Default: 'src'\n *\n * Example:\n * - 'data' -> '/path/to/project/data'\n * - 'content' -> '/path/to/project/content'\n * - 'locales' -> '/path/to/project/locales'\n *\n * Note: If this directory is not at the base directory level, update the contentDir field instead\n */\n contentDirName: customConfiguration?.contentDirName ?? CONTENT_DIR_NAME,\n\n /**\n * Directory name where the result will be stored\n *\n * Default: '.intlayer'\n *\n * Example:\n * - '.next'\n * - 'outputOFIntlayer'\n *\n * Note: If this directory is not at the base directory level, update the resultDir field instead\n */\n resultDirName: customConfiguration?.resultDirName ?? RESULT_DIR_NAME,\n\n /**\n *\n * Directory name where the module augmentation will be stored\n *\n * Module augmentation allow better IDE suggestions and type checking\n *\n * Default: 'types'\n *\n * Example: 'intlayer-types'\n *\n * Note:\n * - If this path changed, be sure to include it from the tsconfig.json file\n * - If this directory is not at the base directory level, update the moduleAugmentationDir field instead\n */\n moduleAugmentationDirName:\n customConfiguration?.moduleAugmentationDirName ??\n MODULE_AUGMENTATION_DIR_NAME,\n // @TODO: Make Module Augmentation optional by adding a flag in the configuration\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries will be stored\n *\n * Default: 'dictionary'\n *\n * Example: 'translations'\n *\n * Note:\n * - If this directory is not at the result directory level, update the dictionariesDir field instead\n *\n */\n dictionariesDirName:\n customConfiguration?.dictionariesDirName ?? DICTIONARIES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries will be stored\n *\n * Default: 'dictionary'\n *\n * Example: 'translations'\n *\n * Note:\n * - If this directory is not at the result directory level, update the dictionariesDir field instead\n *\n */\n i18nDictionariesDirName:\n customConfiguration?.i18nDictionariesDirName ??\n I18N_DICTIONARIES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries types will be stored\n *\n * Default: 'types'\n *\n * Example: 'intlayer-types'\n *\n * Note:\n * - If this directory is not at the result directory level, update the typesDir field instead\n *\n */\n typeDirName: customConfiguration?.typeDirName ?? TYPES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the main files will be stored\n *\n * Default: 'main'\n *\n * Example: 'intlayer-main'\n *\n * Note:\n * - If this directory is not at the result directory level, update the mainDir field instead\n */\n mainDirName: customConfiguration?.mainDirName ?? MAIN_DIR_NAME,\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 const baseDirDerivedConfiguration: BaseDerivedConfig = {\n /**\n * Directory where the content is stored\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{contentDirName}}\n *\n * Example: '/path/to/project/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: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.contentDirName\n ),\n\n /**\n * Directory where the result will be stored\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{resultDirName}}\n *\n * Example: '/path/to/project/.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 resultDirName field instead\n */\n resultDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.resultDirName\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: {{baseDir}} / {{moduleAugmentationDirName}}\n *\n * Example: '/path/to/project/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 notDerivedContentConfig.moduleAugmentationDirName\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 resultDirDerivedConfiguration: ResultDirDerivedConfig = {\n /**\n * Directory where the dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{dictionariesDirName}}\n *\n * Example: '/path/to/project/.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 baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.dictionariesDirName\n ),\n\n /**\n * Directory where the 18n dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{i18nDictionariesDirName}}\n *\n * Example: '/path/to/project/.intlayer/dictionary/i18n'\n *\n * Note:\n * - If the types are not at the result directory level, update the i18nDictionariesDirName field instead\n */\n i18nDictionariesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.i18nDictionariesDirName\n ),\n\n /**\n * Directory where the dictionaries types will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{typeDirName}}\n *\n * Example: '/path/to/project/.intlayer/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 baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.typeDirName\n ),\n\n /**\n * Directory where the main files will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{mainDirName}}\n *\n * Example: '/path/to/project/.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 baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.mainDirName\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: ['{{contentDir}}/**\\/*.content.ts', '{{contentDir}}/**\\/*.content.js', '{{contentDir}}/**\\/*.content.json', '{{contentDir}}/**\\/*.content.cjs', '{{contentDir}}/**\\/*.content.mjs', '{{contentDir}}/**\\/*.content.tsx', '{{contentDir}}/**\\/*.content.jsx']\n */\n watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.map(\n (ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`\n ),\n\n /**\n * Pattern of dictionary to interpret\n *\n * Default: '{{dictionariesDir}}/**\\/*.json'\n */\n outputFilesPatternWithPath: `${resultDirDerivedConfiguration.dictionariesDir}/**/*.json`,\n };\n\n return {\n ...notDerivedContentConfig,\n ...baseDirDerivedConfiguration,\n ...resultDirDerivedConfiguration,\n ...patternsConfiguration,\n };\n};\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\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;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AACrB,kCAAwC;AACxC,wBAOO;AACP,oBAWO;AAcP,IAAI;AAIJ,MAAM,kCAAkC,CACtC,yBACgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOhC,SAAS,qBAAqB,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzC,eAAe,qBAAqB,iBAAiB;AACvD;AAEA,MAAM,wBAAwB,CAC5B,yBACsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,eAAe,qBAAqB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAarD,UAAU,qBAAqB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO3C,iBAAiB,qBAAqB,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBzD,UAAU,qBAAqB,YAAY;AAC7C;AAEA,MAAM,qBAAqB,CACzB,wBACkB;AAClB,QAAM,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G;AAAA,IACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,6BAA6B,wBAAwB,eAAe;AAAA,MAClE,CAAC,QAAQ,GAAG,4BAA4B,UAAU,QAAQ,GAAG;AAAA,IAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,4BAA4B,GAAG,8BAA8B,eAAe;AAAA,EAC9E;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAKO,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":[]}
|
|
@@ -20,28 +20,42 @@ var server_exports = {};
|
|
|
20
20
|
__export(server_exports, {
|
|
21
21
|
CONTENT_DIR_NAME: () => CONTENT_DIR_NAME,
|
|
22
22
|
DICTIONARIES_DIR_NAME: () => DICTIONARIES_DIR_NAME,
|
|
23
|
+
DICTIONARY_OUTPUT: () => DICTIONARY_OUTPUT,
|
|
23
24
|
EXCLUDED_PATHS: () => EXCLUDED_PATHS,
|
|
24
25
|
FILE_EXTENSIONS: () => FILE_EXTENSIONS,
|
|
26
|
+
I18N_DICTIONARIES_DIR_NAME: () => I18N_DICTIONARIES_DIR_NAME,
|
|
25
27
|
MAIN_DIR_NAME: () => MAIN_DIR_NAME,
|
|
26
28
|
MODULE_AUGMENTATION_DIR_NAME: () => MODULE_AUGMENTATION_DIR_NAME,
|
|
27
29
|
RESULT_DIR_NAME: () => RESULT_DIR_NAME,
|
|
28
30
|
TYPES_DIR_NAME: () => TYPES_DIR_NAME
|
|
29
31
|
});
|
|
30
32
|
module.exports = __toCommonJS(server_exports);
|
|
31
|
-
const FILE_EXTENSIONS = [
|
|
33
|
+
const FILE_EXTENSIONS = [
|
|
34
|
+
".content.ts",
|
|
35
|
+
".content.js",
|
|
36
|
+
".content.cjs",
|
|
37
|
+
".content.mjs",
|
|
38
|
+
".content.json",
|
|
39
|
+
".content.tsx",
|
|
40
|
+
".content.jsx"
|
|
41
|
+
];
|
|
32
42
|
const EXCLUDED_PATHS = ["node_modules"];
|
|
33
43
|
const CONTENT_DIR_NAME = "src";
|
|
34
44
|
const RESULT_DIR_NAME = ".intlayer";
|
|
35
45
|
const MODULE_AUGMENTATION_DIR_NAME = "types";
|
|
46
|
+
const DICTIONARY_OUTPUT = ["intlayer"];
|
|
36
47
|
const DICTIONARIES_DIR_NAME = "dictionary";
|
|
48
|
+
const I18N_DICTIONARIES_DIR_NAME = "i18n_dictionary";
|
|
37
49
|
const TYPES_DIR_NAME = "types";
|
|
38
50
|
const MAIN_DIR_NAME = "main";
|
|
39
51
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
52
|
0 && (module.exports = {
|
|
41
53
|
CONTENT_DIR_NAME,
|
|
42
54
|
DICTIONARIES_DIR_NAME,
|
|
55
|
+
DICTIONARY_OUTPUT,
|
|
43
56
|
EXCLUDED_PATHS,
|
|
44
57
|
FILE_EXTENSIONS,
|
|
58
|
+
I18N_DICTIONARIES_DIR_NAME,
|
|
45
59
|
MAIN_DIR_NAME,
|
|
46
60
|
MODULE_AUGMENTATION_DIR_NAME,
|
|
47
61
|
RESULT_DIR_NAME,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/defaultValues/server.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/defaultValues/server.ts"],"sourcesContent":["import type { DictionaryOutput } from '../types/config';\n\nexport const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.mjs',\n '.content.json',\n '.content.tsx',\n '.content.jsx',\n];\nexport const EXCLUDED_PATHS = ['node_modules'];\n\nexport const CONTENT_DIR_NAME = 'src';\n\nexport const RESULT_DIR_NAME = '.intlayer';\n\nexport const MODULE_AUGMENTATION_DIR_NAME = 'types';\n\nexport const DICTIONARY_OUTPUT: DictionaryOutput[] = ['intlayer'];\n\nexport const DICTIONARIES_DIR_NAME = 'dictionary';\n\nexport const I18N_DICTIONARIES_DIR_NAME = 'i18n_dictionary';\n\nexport const TYPES_DIR_NAME = 'types';\n\nexport const MAIN_DIR_NAME = 'main';\n"],"mappings":";;;;;;;;;;;;;;;;;;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;AACF;AACO,MAAM,iBAAiB,CAAC,cAAc;AAEtC,MAAM,mBAAmB;AAEzB,MAAM,kBAAkB;AAExB,MAAM,+BAA+B;AAErC,MAAM,oBAAwC,CAAC,UAAU;AAEzD,MAAM,wBAAwB;AAE9B,MAAM,6BAA6B;AAEnC,MAAM,iBAAiB;AAEvB,MAAM,gBAAgB;","names":[]}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import { DictionaryOutput } from '../types/config.js';
|
|
2
|
+
import '../types/locales.js';
|
|
3
|
+
|
|
1
4
|
declare const FILE_EXTENSIONS: string[];
|
|
2
5
|
declare const EXCLUDED_PATHS: string[];
|
|
3
6
|
declare const CONTENT_DIR_NAME = "src";
|
|
4
7
|
declare const RESULT_DIR_NAME = ".intlayer";
|
|
5
8
|
declare const MODULE_AUGMENTATION_DIR_NAME = "types";
|
|
9
|
+
declare const DICTIONARY_OUTPUT: DictionaryOutput[];
|
|
6
10
|
declare const DICTIONARIES_DIR_NAME = "dictionary";
|
|
11
|
+
declare const I18N_DICTIONARIES_DIR_NAME = "i18n_dictionary";
|
|
7
12
|
declare const TYPES_DIR_NAME = "types";
|
|
8
13
|
declare const MAIN_DIR_NAME = "main";
|
|
9
14
|
|
|
10
|
-
export { CONTENT_DIR_NAME, DICTIONARIES_DIR_NAME, EXCLUDED_PATHS, FILE_EXTENSIONS, MAIN_DIR_NAME, MODULE_AUGMENTATION_DIR_NAME, RESULT_DIR_NAME, TYPES_DIR_NAME };
|
|
15
|
+
export { CONTENT_DIR_NAME, DICTIONARIES_DIR_NAME, DICTIONARY_OUTPUT, EXCLUDED_PATHS, FILE_EXTENSIONS, I18N_DICTIONARIES_DIR_NAME, MAIN_DIR_NAME, MODULE_AUGMENTATION_DIR_NAME, RESULT_DIR_NAME, TYPES_DIR_NAME };
|
|
@@ -24,12 +24,15 @@ __export(detectPlatform_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(detectPlatform_exports);
|
|
25
25
|
const import_meta = {};
|
|
26
26
|
const getPlatform = () => {
|
|
27
|
-
if (
|
|
27
|
+
if (
|
|
28
|
+
// eslint-disable-next-line
|
|
29
|
+
typeof import_meta !== "undefined" && typeof import_meta.env !== "undefined" && typeof import_meta.env.VITE_INTLAYER_DEFAULT_LOCALE !== "undefined"
|
|
30
|
+
) {
|
|
31
|
+
return "vite";
|
|
32
|
+
} else if (typeof process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE !== "undefined") {
|
|
28
33
|
return "next";
|
|
29
|
-
} else if (typeof process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE
|
|
34
|
+
} else if (typeof process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE !== "undefined") {
|
|
30
35
|
return "react_app";
|
|
31
|
-
} else if (import_meta?.env?.VITE_INTLAYER_DEFAULT_LOCALE) {
|
|
32
|
-
return "vite";
|
|
33
36
|
}
|
|
34
37
|
return "unknown";
|
|
35
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/envVariables/detectPlatform.ts"],"sourcesContent":["export type Platform = 'next' | 'vite' | 'react_app' | 'unknown';\
|
|
1
|
+
{"version":3,"sources":["../../../src/envVariables/detectPlatform.ts"],"sourcesContent":["export type Platform = 'next' | 'vite' | 'react_app' | 'unknown';\n\nexport const getPlatform = (): Platform => {\n if (\n // eslint-disable-next-line\n typeof import.meta !== 'undefined' &&\n typeof import.meta.env !== 'undefined' &&\n typeof import.meta.env.VITE_INTLAYER_DEFAULT_LOCALE !== 'undefined'\n ) {\n // Likely Vite\n return 'vite';\n } else if (\n typeof process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE !== 'undefined'\n ) {\n // Likely Next.js\n return 'next';\n } else if (\n typeof process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE !== 'undefined'\n ) {\n // Likely Create React App\n return 'react_app';\n }\n\n return 'unknown';\n};\n\n/**\n * Get the prefix for the environment variables to be used in the platform\n */\nexport const getPrefix = (platform: Platform): string => {\n switch (platform) {\n case 'next':\n return 'NEXT_PUBLIC_INTLAYER_';\n case 'vite':\n return 'VITE_INTLAYER_';\n case 'react_app':\n return 'REACT_APP_INTLAYER_';\n default:\n return '';\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,cAAc,MAAgB;AACzC;AAAA;AAAA,IAEE,OAAO,gBAAgB,eACvB,OAAO,YAAY,QAAQ,eAC3B,OAAO,YAAY,IAAI,iCAAiC;AAAA,IACxD;AAEA,WAAO;AAAA,EACT,WACE,OAAO,QAAQ,IAAI,wCAAwC,aAC3D;AAEA,WAAO;AAAA,EACT,WACE,OAAO,QAAQ,IAAI,sCAAsC,aACzD;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAKO,MAAM,YAAY,CAAC,aAA+B;AACvD,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
type Platform = 'next' | 'vite' | 'react_app' | 'unknown';
|
|
2
|
-
type ViteEnvVar = {
|
|
3
|
-
env: Record<string, string>;
|
|
4
|
-
};
|
|
5
2
|
declare const getPlatform: () => Platform;
|
|
6
3
|
/**
|
|
7
4
|
* Get the prefix for the environment variables to be used in the platform
|
|
8
5
|
*/
|
|
9
6
|
declare const getPrefix: (platform: Platform) => string;
|
|
10
7
|
|
|
11
|
-
export { type Platform,
|
|
8
|
+
export { type Platform, getPlatform, getPrefix };
|
|
@@ -0,0 +1,44 @@
|
|
|
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 extractEnvVariable_exports = {};
|
|
20
|
+
__export(extractEnvVariable_exports, {
|
|
21
|
+
extractEnvVariable: () => extractEnvVariable
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(extractEnvVariable_exports);
|
|
24
|
+
var import_detectPlatform = require('../detectPlatform.cjs');
|
|
25
|
+
var import_next = require('./next.cjs');
|
|
26
|
+
var import_react_app = require('./react_app.cjs');
|
|
27
|
+
var import_undefined_platform = require('./undefined_platform.cjs');
|
|
28
|
+
var import_vite = require('./vite.cjs');
|
|
29
|
+
const extractEnvVariable = () => {
|
|
30
|
+
const platform = (0, import_detectPlatform.getPlatform)();
|
|
31
|
+
if (platform === "vite") {
|
|
32
|
+
return (0, import_vite.extractViteEnvVariable)();
|
|
33
|
+
} else if (platform === "next") {
|
|
34
|
+
return (0, import_next.extractNextEnvVariable)();
|
|
35
|
+
} else if (platform === "react_app") {
|
|
36
|
+
return (0, import_react_app.extractReactAppEnvVariable)();
|
|
37
|
+
}
|
|
38
|
+
return (0, import_undefined_platform.extractEmptyEnvVariable)();
|
|
39
|
+
};
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
extractEnvVariable
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/index.ts"],"sourcesContent":["import { type Platform, getPlatform } from '../detectPlatform';\nimport { extractNextEnvVariable } from './next';\nimport { extractReactAppEnvVariable } from './react_app';\nimport type { IntlayerConfigEnvVariable } from './types';\nimport { extractEmptyEnvVariable } from './undefined_platform';\nimport { extractViteEnvVariable } from './vite';\n\nexport const extractEnvVariable = (): IntlayerConfigEnvVariable => {\n const platform: Platform = getPlatform();\n\n if (platform === 'vite') {\n return extractViteEnvVariable();\n } else if (platform === 'next') {\n return extractNextEnvVariable();\n } else if (platform === 'react_app') {\n return extractReactAppEnvVariable();\n }\n\n return extractEmptyEnvVariable();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2C;AAC3C,kBAAuC;AACvC,uBAA2C;AAE3C,gCAAwC;AACxC,kBAAuC;AAEhC,MAAM,qBAAqB,MAAiC;AACjE,QAAM,eAAqB,mCAAY;AAEvC,MAAI,aAAa,QAAQ;AACvB,eAAO,oCAAuB;AAAA,EAChC,WAAW,aAAa,QAAQ;AAC9B,eAAO,oCAAuB;AAAA,EAChC,WAAW,aAAa,aAAa;AACnC,eAAO,6CAA2B;AAAA,EACpC;AAEA,aAAO,mDAAwB;AACjC;","names":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 next_exports = {};
|
|
20
|
+
__export(next_exports, {
|
|
21
|
+
extractNextEnvVariable: () => extractNextEnvVariable
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(next_exports);
|
|
24
|
+
const extractNextEnvVariable = () => {
|
|
25
|
+
const internationalization = {
|
|
26
|
+
locales: process.env.NEXT_PUBLIC_INTLAYER_LOCALES,
|
|
27
|
+
defaultLocale: process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE
|
|
28
|
+
};
|
|
29
|
+
const middleware = {
|
|
30
|
+
headerName: process.env.NEXT_PUBLIC_INTLAYER_HEADER_NAME,
|
|
31
|
+
cookieName: process.env.NEXT_PUBLIC_INTLAYER_COOKIE_NAME,
|
|
32
|
+
prefixDefault: process.env.NEXT_PUBLIC_INTLAYER_PREFIX_DEFAULT,
|
|
33
|
+
basePath: process.env.NEXT_PUBLIC_INTLAYER_BASE_PATH,
|
|
34
|
+
serverSetCookie: process.env.NEXT_PUBLIC_INTLAYER_SERVER_SET_COOKIE,
|
|
35
|
+
noPrefix: process.env.NEXT_PUBLIC_INTLAYER_NO_PREFIX
|
|
36
|
+
};
|
|
37
|
+
const content = {
|
|
38
|
+
fileExtensions: process.env.NEXT_PUBLIC_INTLAYER_FILE_EXTENSIONS,
|
|
39
|
+
baseDir: process.env.NEXT_PUBLIC_INTLAYER_BASE_DIR,
|
|
40
|
+
contentDirName: process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR_NAME,
|
|
41
|
+
contentDir: process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR,
|
|
42
|
+
excludedPath: process.env.NEXT_PUBLIC_INTLAYER_EXCLUDED_PATH,
|
|
43
|
+
resultDirName: process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR_NAME,
|
|
44
|
+
moduleAugmentationDirName: process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,
|
|
45
|
+
dictionariesDirName: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR_NAME,
|
|
46
|
+
i18nDictionariesDir: process.env.NEXT_PUBLIC_INTLAYER_I18N_DICTIONARIES_DIR,
|
|
47
|
+
typeDirName: process.env.NEXT_PUBLIC_INTLAYER_TYPE_DIR_NAME,
|
|
48
|
+
mainDirName: process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR_NAME,
|
|
49
|
+
resultDir: process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR,
|
|
50
|
+
moduleAugmentationDir: process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR,
|
|
51
|
+
dictionariesDir: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR,
|
|
52
|
+
i18nDictionariesDirName: process.env.NEXT_PUBLIC_INTLAYER_I18N_DICTIONARIES_DIR_NAME,
|
|
53
|
+
typesDir: process.env.NEXT_PUBLIC_INTLAYER_TYPE_DIR,
|
|
54
|
+
mainDir: process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR,
|
|
55
|
+
watchedFilesPattern: process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN,
|
|
56
|
+
watchedFilesPatternWithPath: process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,
|
|
57
|
+
outputFilesPatternWithPath: process.env.NEXT_PUBLIC_INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH,
|
|
58
|
+
dictionaryOutput: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARY_OUTPUT
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
internationalization,
|
|
62
|
+
middleware,
|
|
63
|
+
content
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
extractNextEnvVariable
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=next.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/next.ts"],"sourcesContent":["import type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\n\nexport const extractNextEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.NEXT_PUBLIC_INTLAYER_LOCALES,\n defaultLocale: process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.NEXT_PUBLIC_INTLAYER_HEADER_NAME,\n cookieName: process.env.NEXT_PUBLIC_INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.NEXT_PUBLIC_INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.NEXT_PUBLIC_INTLAYER_BASE_PATH,\n serverSetCookie: process.env.NEXT_PUBLIC_INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.NEXT_PUBLIC_INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.NEXT_PUBLIC_INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.NEXT_PUBLIC_INTLAYER_BASE_DIR,\n contentDirName: process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR,\n excludedPath: process.env.NEXT_PUBLIC_INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR_NAME,\n i18nDictionariesDir: process.env.NEXT_PUBLIC_INTLAYER_I18N_DICTIONARIES_DIR,\n typeDirName: process.env.NEXT_PUBLIC_INTLAYER_TYPE_DIR_NAME,\n mainDirName: process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR_NAME,\n resultDir: process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR,\n moduleAugmentationDir:\n process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR,\n dictionariesDir: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR,\n i18nDictionariesDirName:\n process.env.NEXT_PUBLIC_INTLAYER_I18N_DICTIONARIES_DIR_NAME,\n typesDir: process.env.NEXT_PUBLIC_INTLAYER_TYPE_DIR,\n mainDir: process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR,\n watchedFilesPattern: process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN,\n watchedFilesPatternWithPath:\n process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n outputFilesPatternWithPath:\n process.env.NEXT_PUBLIC_INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH,\n dictionaryOutput: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARY_OUTPUT,\n };\n\n return {\n internationalization,\n middleware,\n content,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,yBAAyB,MAAiC;AACrE,QAAM,uBAAiE;AAAA,IACrE,SAAS,QAAQ,IAAI;AAAA,IACrB,eAAe,QAAQ,IAAI;AAAA,EAC7B;AAEA,QAAM,aAA6C;AAAA,IACjD,YAAY,QAAQ,IAAI;AAAA,IACxB,YAAY,QAAQ,IAAI;AAAA,IACxB,eAAe,QAAQ,IAAI;AAAA,IAC3B,UAAU,QAAQ,IAAI;AAAA,IACtB,iBAAiB,QAAQ,IAAI;AAAA,IAC7B,UAAU,QAAQ,IAAI;AAAA,EACxB;AAEA,QAAM,UAAuC;AAAA,IAC3C,gBAAgB,QAAQ,IAAI;AAAA,IAC5B,SAAS,QAAQ,IAAI;AAAA,IACrB,gBAAgB,QAAQ,IAAI;AAAA,IAC5B,YAAY,QAAQ,IAAI;AAAA,IACxB,cAAc,QAAQ,IAAI;AAAA,IAC1B,eAAe,QAAQ,IAAI;AAAA,IAC3B,2BACE,QAAQ,IAAI;AAAA,IACd,qBAAqB,QAAQ,IAAI;AAAA,IACjC,qBAAqB,QAAQ,IAAI;AAAA,IACjC,aAAa,QAAQ,IAAI;AAAA,IACzB,aAAa,QAAQ,IAAI;AAAA,IACzB,WAAW,QAAQ,IAAI;AAAA,IACvB,uBACE,QAAQ,IAAI;AAAA,IACd,iBAAiB,QAAQ,IAAI;AAAA,IAC7B,yBACE,QAAQ,IAAI;AAAA,IACd,UAAU,QAAQ,IAAI;AAAA,IACtB,SAAS,QAAQ,IAAI;AAAA,IACrB,qBAAqB,QAAQ,IAAI;AAAA,IACjC,6BACE,QAAQ,IAAI;AAAA,IACd,4BACE,QAAQ,IAAI;AAAA,IACd,kBAAkB,QAAQ,IAAI;AAAA,EAChC;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 react_app_exports = {};
|
|
20
|
+
__export(react_app_exports, {
|
|
21
|
+
extractReactAppEnvVariable: () => extractReactAppEnvVariable
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(react_app_exports);
|
|
24
|
+
const extractReactAppEnvVariable = () => {
|
|
25
|
+
const internationalization = {
|
|
26
|
+
locales: process.env.REACT_APP_INTLAYER_LOCALES,
|
|
27
|
+
defaultLocale: process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE
|
|
28
|
+
};
|
|
29
|
+
const middleware = {
|
|
30
|
+
headerName: process.env.REACT_APP_INTLAYER_HEADER_NAME,
|
|
31
|
+
cookieName: process.env.REACT_APP_INTLAYER_COOKIE_NAME,
|
|
32
|
+
prefixDefault: process.env.REACT_APP_INTLAYER_PREFIX_DEFAULT,
|
|
33
|
+
basePath: process.env.REACT_APP_INTLAYER_BASE_PATH,
|
|
34
|
+
serverSetCookie: process.env.REACT_APP_INTLAYER_SERVER_SET_COOKIE,
|
|
35
|
+
noPrefix: process.env.REACT_APP_INTLAYER_NO_PREFIX
|
|
36
|
+
};
|
|
37
|
+
const content = {
|
|
38
|
+
fileExtensions: process.env.REACT_APP_INTLAYER_FILE_EXTENSIONS,
|
|
39
|
+
baseDir: process.env.REACT_APP_INTLAYER_BASE_DIR,
|
|
40
|
+
contentDirName: process.env.REACT_APP_INTLAYER_CONTENT_DIR_NAME,
|
|
41
|
+
contentDir: process.env.REACT_APP_INTLAYER_CONTENT_DIR,
|
|
42
|
+
excludedPath: process.env.REACT_APP_INTLAYER_EXCLUDED_PATH,
|
|
43
|
+
resultDirName: process.env.REACT_APP_INTLAYER_RESULT_DIR_NAME,
|
|
44
|
+
moduleAugmentationDirName: process.env.REACT_APP_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,
|
|
45
|
+
dictionariesDirName: process.env.REACT_APP_INTLAYER_DICTIONARIES_DIR_NAME,
|
|
46
|
+
i18nDictionariesDirName: process.env.REACT_APP_INTLAYER_I18N_DICTIONARIES_DIR_NAME,
|
|
47
|
+
typeDirName: process.env.REACT_APP_INTLAYER_TYPE_DIR_NAME,
|
|
48
|
+
mainDirName: process.env.REACT_APP_INTLAYER_MAIN_DIR_NAME,
|
|
49
|
+
resultDir: process.env.REACT_APP_INTLAYER_RESULT_DIR,
|
|
50
|
+
moduleAugmentationDir: process.env.REACT_APP_INTLAYER_MODULE_AUGMENTATION_DIR,
|
|
51
|
+
dictionariesDir: process.env.REACT_APP_INTLAYER_DICTIONARIES_DIR,
|
|
52
|
+
i18nDictionariesDir: process.env.REACT_APP_INTLAYER_I18N_DICTIONARIES_DIR,
|
|
53
|
+
typesDir: process.env.REACT_APP_INTLAYER_TYPE_DIR,
|
|
54
|
+
mainDir: process.env.REACT_APP_INTLAYER_MAIN_DIR,
|
|
55
|
+
watchedFilesPattern: process.env.REACT_APP_INTLAYER_WATCHED_FILES_PATTERN,
|
|
56
|
+
watchedFilesPatternWithPath: process.env.REACT_APP_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,
|
|
57
|
+
outputFilesPatternWithPath: process.env.REACT_APP_INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH,
|
|
58
|
+
dictionaryOutput: process.env.REACT_APP_INTLAYER_DICTIONARY_OUTPUT
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
internationalization,
|
|
62
|
+
middleware,
|
|
63
|
+
content
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
extractReactAppEnvVariable
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=react_app.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/react_app.ts"],"sourcesContent":["import type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\n\nexport const extractReactAppEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.REACT_APP_INTLAYER_LOCALES,\n defaultLocale: process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.REACT_APP_INTLAYER_HEADER_NAME,\n cookieName: process.env.REACT_APP_INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.REACT_APP_INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.REACT_APP_INTLAYER_BASE_PATH,\n serverSetCookie: process.env.REACT_APP_INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.REACT_APP_INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.REACT_APP_INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.REACT_APP_INTLAYER_BASE_DIR,\n contentDirName: process.env.REACT_APP_INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.REACT_APP_INTLAYER_CONTENT_DIR,\n excludedPath: process.env.REACT_APP_INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.REACT_APP_INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.REACT_APP_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.REACT_APP_INTLAYER_DICTIONARIES_DIR_NAME,\n i18nDictionariesDirName:\n process.env.REACT_APP_INTLAYER_I18N_DICTIONARIES_DIR_NAME,\n typeDirName: process.env.REACT_APP_INTLAYER_TYPE_DIR_NAME,\n mainDirName: process.env.REACT_APP_INTLAYER_MAIN_DIR_NAME,\n resultDir: process.env.REACT_APP_INTLAYER_RESULT_DIR,\n moduleAugmentationDir:\n process.env.REACT_APP_INTLAYER_MODULE_AUGMENTATION_DIR,\n dictionariesDir: process.env.REACT_APP_INTLAYER_DICTIONARIES_DIR,\n i18nDictionariesDir: process.env.REACT_APP_INTLAYER_I18N_DICTIONARIES_DIR,\n typesDir: process.env.REACT_APP_INTLAYER_TYPE_DIR,\n mainDir: process.env.REACT_APP_INTLAYER_MAIN_DIR,\n watchedFilesPattern: process.env.REACT_APP_INTLAYER_WATCHED_FILES_PATTERN,\n watchedFilesPatternWithPath:\n process.env.REACT_APP_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n outputFilesPatternWithPath:\n process.env.REACT_APP_INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH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AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/types.ts"],"sourcesContent":["import type { IntlayerConfig } from '../../client';\n\n// Utility type that replaces all values of a given type with another type\nexport type ReplaceValue<T> = {\n [K in keyof T]: string | undefined;\n};\n\nexport type IntlayerConfigEnvVariable = {\n [K in keyof IntlayerConfig]: ReplaceValue<IntlayerConfig[K]>;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IntlayerConfig } from '../../types/config.js';
|
|
2
|
+
import '../../types/locales.js';
|
|
3
|
+
|
|
4
|
+
type ReplaceValue<T> = {
|
|
5
|
+
[K in keyof T]: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
type IntlayerConfigEnvVariable = {
|
|
8
|
+
[K in keyof IntlayerConfig]: ReplaceValue<IntlayerConfig[K]>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type { IntlayerConfigEnvVariable, ReplaceValue };
|