@intlayer/config 3.5.4 → 3.5.6
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/appLoggerClient.cjs +34 -0
- package/dist/cjs/appLoggerClient.cjs.map +1 -0
- package/dist/cjs/appLoggerServer.cjs +34 -0
- package/dist/cjs/appLoggerServer.cjs.map +1 -0
- package/dist/cjs/client.cjs +8 -2
- package/dist/cjs/client.cjs.map +1 -1
- package/dist/cjs/configFile/buildConfigurationFields.cjs +62 -9
- package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
- package/dist/cjs/configFile/getConfiguration.cjs +12 -6
- package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
- package/dist/cjs/configFile/loadConfigurationFile.cjs +4 -3
- package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
- package/dist/cjs/configFile/searchConfigurationFile.cjs +2 -1
- package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
- package/dist/cjs/defaultValues/content.cjs +6 -3
- package/dist/cjs/defaultValues/content.cjs.map +1 -1
- package/dist/cjs/defaultValues/log.cjs +34 -0
- package/dist/cjs/defaultValues/log.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/next.cjs +10 -3
- package/dist/cjs/envVariables/extractEnvVariable/next.cjs.map +1 -1
- package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs +10 -3
- package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs.map +1 -1
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs +10 -3
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs.map +1 -1
- package/dist/cjs/envVariables/extractEnvVariable/vite.cjs +14 -6
- package/dist/cjs/envVariables/extractEnvVariable/vite.cjs.map +1 -1
- package/dist/cjs/envVariables/getConfiguration.cjs +18 -5
- package/dist/cjs/envVariables/getConfiguration.cjs.map +1 -1
- package/dist/cjs/envVariables/utils.cjs +4 -2
- package/dist/cjs/envVariables/utils.cjs.map +1 -1
- package/dist/cjs/index.cjs +8 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/logger.cjs +50 -0
- package/dist/cjs/logger.cjs.map +1 -0
- package/dist/cjs/types/config.cjs.map +1 -1
- package/dist/esm/appLoggerClient.mjs +10 -0
- package/dist/esm/appLoggerClient.mjs.map +1 -0
- package/dist/esm/appLoggerServer.mjs +10 -0
- package/dist/esm/appLoggerServer.mjs.map +1 -0
- package/dist/esm/client.mjs +5 -1
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/configFile/buildConfigurationFields.mjs +65 -11
- package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
- package/dist/esm/configFile/getConfiguration.mjs +12 -6
- package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
- package/dist/esm/configFile/loadConfigurationFile.mjs +4 -3
- package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
- package/dist/esm/configFile/searchConfigurationFile.mjs +2 -1
- package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
- package/dist/esm/defaultValues/content.mjs +4 -2
- package/dist/esm/defaultValues/content.mjs.map +1 -1
- package/dist/esm/defaultValues/log.mjs +9 -0
- package/dist/esm/defaultValues/log.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/next.mjs +10 -3
- package/dist/esm/envVariables/extractEnvVariable/next.mjs.map +1 -1
- package/dist/esm/envVariables/extractEnvVariable/react_app.mjs +10 -3
- package/dist/esm/envVariables/extractEnvVariable/react_app.mjs.map +1 -1
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs +10 -3
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs.map +1 -1
- package/dist/esm/envVariables/extractEnvVariable/vite.mjs +14 -6
- package/dist/esm/envVariables/extractEnvVariable/vite.mjs.map +1 -1
- package/dist/esm/envVariables/getConfiguration.mjs +18 -5
- package/dist/esm/envVariables/getConfiguration.mjs.map +1 -1
- package/dist/esm/envVariables/utils.mjs +4 -2
- package/dist/esm/envVariables/utils.mjs.map +1 -1
- package/dist/esm/index.mjs +5 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/logger.mjs +26 -0
- package/dist/esm/logger.mjs.map +1 -0
- package/dist/types/appLoggerClient.d.ts +3 -0
- package/dist/types/appLoggerClient.d.ts.map +1 -0
- package/dist/types/appLoggerServer.d.ts +3 -0
- package/dist/types/appLoggerServer.d.ts.map +1 -0
- package/dist/types/client.d.ts +2 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
- package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
- package/dist/types/configFile/loadConfigurationFile.d.ts.map +1 -1
- package/dist/types/configFile/searchConfigurationFile.d.ts.map +1 -1
- package/dist/types/defaultValues/content.d.ts +2 -1
- package/dist/types/defaultValues/content.d.ts.map +1 -1
- package/dist/types/defaultValues/log.d.ts +3 -0
- package/dist/types/defaultValues/log.d.ts.map +1 -0
- package/dist/types/envVariables/extractEnvVariable/next.d.ts.map +1 -1
- package/dist/types/envVariables/extractEnvVariable/react_app.d.ts.map +1 -1
- package/dist/types/envVariables/extractEnvVariable/undefined_platform.d.ts.map +1 -1
- package/dist/types/envVariables/extractEnvVariable/vite.d.ts.map +1 -1
- package/dist/types/envVariables/getConfiguration.d.ts.map +1 -1
- package/dist/types/envVariables/utils.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logger.d.ts +9 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/types/config.d.ts +57 -8
- package/dist/types/types/config.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -22,13 +22,15 @@ const extractEmptyEnvVariable = () => {
|
|
|
22
22
|
resultDirName: process.env.INTLAYER_RESULT_DIR_NAME,
|
|
23
23
|
moduleAugmentationDirName: process.env.INTLAYER_MODULE_AUGMENTATION_DIR_NAME,
|
|
24
24
|
dictionariesDirName: process.env.INTLAYER_DICTIONARIES_DIR_NAME,
|
|
25
|
-
|
|
25
|
+
i18nextResourcesDirName: process.env.INTLAYER_I18N_RESOURCES_DIR_NAME,
|
|
26
|
+
reactIntlMessagesDirName: process.env.INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,
|
|
26
27
|
typeDirName: process.env.INTLAYER_TYPE_DIR_NAME,
|
|
27
28
|
mainDirName: process.env.INTLAYER_MAIN_DIR_NAME,
|
|
28
29
|
resultDir: process.env.INTLAYER_RESULT_DIR,
|
|
29
30
|
moduleAugmentationDir: process.env.INTLAYER_MODULE_AUGMENTATION_DIR,
|
|
30
31
|
dictionariesDir: process.env.INTLAYER_DICTIONARIES_DIR,
|
|
31
|
-
|
|
32
|
+
i18nextResourcesDir: process.env.INTLAYER_I18N_DICTIONARIES_DIR,
|
|
33
|
+
reactIntlMessagesDir: process.env.INTLAYER_REACT_INTL_DICTIONARIES_DIR,
|
|
32
34
|
typesDir: process.env.INTLAYER_TYPE_DIR,
|
|
33
35
|
mainDir: process.env.INTLAYER_MAIN_DIR,
|
|
34
36
|
watchedFilesPattern: process.env.INTLAYER_WATCHED_FILES_PATTERN,
|
|
@@ -44,11 +46,16 @@ const extractEmptyEnvVariable = () => {
|
|
|
44
46
|
clientSecret: process.env.INTLAYER_CLIENT_SECRET,
|
|
45
47
|
dictionaryPriorityStrategy: process.env.INTLAYER_DICTIONARY_PRIORITY_STRATEGY
|
|
46
48
|
};
|
|
49
|
+
const log = {
|
|
50
|
+
mode: process.env.INTLAYER_LOG_MODE,
|
|
51
|
+
prefix: process.env.INTLAYER_LOG_PREFIX
|
|
52
|
+
};
|
|
47
53
|
return {
|
|
48
54
|
internationalization,
|
|
49
55
|
middleware,
|
|
50
56
|
content,
|
|
51
|
-
editor
|
|
57
|
+
editor,
|
|
58
|
+
log
|
|
52
59
|
};
|
|
53
60
|
};
|
|
54
61
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/undefined_platform.ts"],"sourcesContent":["import process from 'process';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n} from '../../types/config';\nimport type { ReplaceValue, IntlayerConfigEnvVariable } from './types';\n\nexport const extractEmptyEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.INTLAYER_LOCALES,\n strictMode: process.env.INTLAYER_STRICT_MODE,\n defaultLocale: process.env.INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.INTLAYER_HEADER_NAME,\n cookieName: process.env.INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.INTLAYER_BASE_PATH,\n serverSetCookie: process.env.INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.INTLAYER_BASE_DIR,\n contentDirName: process.env.INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.INTLAYER_CONTENT_DIR,\n excludedPath: process.env.INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.INTLAYER_DICTIONARIES_DIR_NAME,\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/undefined_platform.ts"],"sourcesContent":["import process from 'process';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { ReplaceValue, IntlayerConfigEnvVariable } from './types';\n\nexport const extractEmptyEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.INTLAYER_LOCALES,\n strictMode: process.env.INTLAYER_STRICT_MODE,\n defaultLocale: process.env.INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.INTLAYER_HEADER_NAME,\n cookieName: process.env.INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.INTLAYER_BASE_PATH,\n serverSetCookie: process.env.INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.INTLAYER_BASE_DIR,\n contentDirName: process.env.INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.INTLAYER_CONTENT_DIR,\n excludedPath: process.env.INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.INTLAYER_DICTIONARIES_DIR_NAME,\n i18nextResourcesDirName: process.env.INTLAYER_I18N_RESOURCES_DIR_NAME,\n reactIntlMessagesDirName: process.env.INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,\n typeDirName: process.env.INTLAYER_TYPE_DIR_NAME,\n mainDirName: process.env.INTLAYER_MAIN_DIR_NAME,\n resultDir: process.env.INTLAYER_RESULT_DIR,\n moduleAugmentationDir: process.env.INTLAYER_MODULE_AUGMENTATION_DIR,\n dictionariesDir: process.env.INTLAYER_DICTIONARIES_DIR,\n i18nextResourcesDir: process.env.INTLAYER_I18N_DICTIONARIES_DIR,\n reactIntlMessagesDir: process.env.INTLAYER_REACT_INTL_DICTIONARIES_DIR,\n typesDir: process.env.INTLAYER_TYPE_DIR,\n mainDir: process.env.INTLAYER_MAIN_DIR,\n watchedFilesPattern: process.env.INTLAYER_WATCHED_FILES_PATTERN,\n watchedFilesPatternWithPath:\n process.env.INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n outputFilesPatternWithPath:\n process.env.INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH,\n dictionaryOutput: process.env.INTLAYER_DICTIONARY_OUTPUT,\n watch: process.env.INTLAYER_WATCH,\n };\n\n const editor: ReplaceValue<EditorConfig> = {\n backendURL: process.env.INTLAYER_BACKEND_URL,\n enabled: process.env.INTLAYER_ENABLED,\n clientId: process.env.INTLAYER_CLIENT_ID,\n clientSecret: process.env.INTLAYER_CLIENT_SECRET,\n dictionaryPriorityStrategy:\n process.env.INTLAYER_DICTIONARY_PRIORITY_STRATEGY,\n };\n\n const log: ReplaceValue<LogConfig> = {\n mode: process.env.INTLAYER_LOG_MODE,\n prefix: process.env.INTLAYER_LOG_PREFIX,\n };\n\n return {\n internationalization,\n middleware,\n content,\n editor,\n log,\n };\n};\n"],"mappings":"AAAA,OAAO,aAAa;AAUb,MAAM,0BAA0B,MAAiC;AACtE,QAAM,uBAAiE;AAAA,IACrE,SAAS,QAAQ,IAAI;AAAA,IACrB,YAAY,QAAQ,IAAI;AAAA,IACxB,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,yBAAyB,QAAQ,IAAI;AAAA,IACrC,0BAA0B,QAAQ,IAAI;AAAA,IACtC,aAAa,QAAQ,IAAI;AAAA,IACzB,aAAa,QAAQ,IAAI;AAAA,IACzB,WAAW,QAAQ,IAAI;AAAA,IACvB,uBAAuB,QAAQ,IAAI;AAAA,IACnC,iBAAiB,QAAQ,IAAI;AAAA,IAC7B,qBAAqB,QAAQ,IAAI;AAAA,IACjC,sBAAsB,QAAQ,IAAI;AAAA,IAClC,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,IAC9B,OAAO,QAAQ,IAAI;AAAA,EACrB;AAEA,QAAM,SAAqC;AAAA,IACzC,YAAY,QAAQ,IAAI;AAAA,IACxB,SAAS,QAAQ,IAAI;AAAA,IACrB,UAAU,QAAQ,IAAI;AAAA,IACtB,cAAc,QAAQ,IAAI;AAAA,IAC1B,4BACE,QAAQ,IAAI;AAAA,EAChB;AAEA,QAAM,MAA+B;AAAA,IACnC,MAAM,QAAQ,IAAI;AAAA,IAClB,QAAQ,QAAQ,IAAI;AAAA,EACtB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { logger } from '../../logger.mjs';
|
|
1
2
|
import { extractEmptyEnvVariable } from './undefined_platform.mjs';
|
|
2
3
|
const extractViteEnvVariable = () => {
|
|
3
4
|
if (!import.meta.env) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
);
|
|
5
|
+
logger("Vite env variables cannot be loaded on a commonjs environment.", {
|
|
6
|
+
level: "error"
|
|
7
|
+
});
|
|
7
8
|
return extractEmptyEnvVariable();
|
|
8
9
|
}
|
|
9
10
|
const internationalization = {
|
|
@@ -28,13 +29,15 @@ const extractViteEnvVariable = () => {
|
|
|
28
29
|
resultDirName: import.meta.env.VITE_INTLAYER_RESULT_DIR_NAME,
|
|
29
30
|
moduleAugmentationDirName: import.meta.env.VITE_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,
|
|
30
31
|
dictionariesDirName: import.meta.env.VITE_INTLAYER_DICTIONARIES_DIR_NAME,
|
|
31
|
-
|
|
32
|
+
i18nextResourcesDirName: import.meta.env.VITE_INTLAYER_I18N_RESOURCES_DIR_NAME,
|
|
33
|
+
reactIntlMessagesDirName: import.meta.env.VITE_INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,
|
|
32
34
|
typeDirName: import.meta.env.VITE_INTLAYER_TYPE_DIR_NAME,
|
|
33
35
|
mainDirName: import.meta.env.VITE_INTLAYER_MAIN_DIR_NAME,
|
|
34
36
|
resultDir: import.meta.env.VITE_INTLAYER_RESULT_DIR,
|
|
35
37
|
moduleAugmentationDir: import.meta.env.VITE_INTLAYER_MODULE_AUGMENTATION_DIR,
|
|
36
38
|
dictionariesDir: import.meta.env.VITE_INTLAYER_DICTIONARIES_DIR,
|
|
37
|
-
|
|
39
|
+
i18nextResourcesDir: import.meta.env.VITE_INTLAYER_I18N_DICTIONARIES_DIR,
|
|
40
|
+
reactIntlMessagesDir: import.meta.env.VITE_INTLAYER_REACT_INTL_DICTIONARIES_DIR,
|
|
38
41
|
typesDir: import.meta.env.VITE_INTLAYER_TYPE_DIR,
|
|
39
42
|
mainDir: import.meta.env.VITE_INTLAYER_MAIN_DIR,
|
|
40
43
|
watchedFilesPattern: import.meta.env.VITE_INTLAYER_WATCHED_FILES_PATTERN,
|
|
@@ -50,11 +53,16 @@ const extractViteEnvVariable = () => {
|
|
|
50
53
|
clientSecret: import.meta.env.VITE_INTLAYER_CLIENT_SECRET,
|
|
51
54
|
dictionaryPriorityStrategy: import.meta.env.VITE_INTLAYER_DICTIONARY_PRIORITY_STRATEGY
|
|
52
55
|
};
|
|
56
|
+
const log = {
|
|
57
|
+
mode: import.meta.env.VITE_INTLAYER_LOG_MODE,
|
|
58
|
+
prefix: import.meta.env.VITE_INTLAYER_LOG_PREFIX
|
|
59
|
+
};
|
|
53
60
|
return {
|
|
54
61
|
internationalization,
|
|
55
62
|
middleware,
|
|
56
63
|
content,
|
|
57
|
-
editor
|
|
64
|
+
editor,
|
|
65
|
+
log
|
|
58
66
|
};
|
|
59
67
|
};
|
|
60
68
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/vite.ts"],"sourcesContent":["import type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\nimport { extractEmptyEnvVariable } from './undefined_platform';\n\nexport const extractViteEnvVariable = (): IntlayerConfigEnvVariable => {\n if (!import.meta.env) {\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/vite.ts"],"sourcesContent":["import { logger } from '../../logger';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\nimport { extractEmptyEnvVariable } from './undefined_platform';\n\nexport const extractViteEnvVariable = (): IntlayerConfigEnvVariable => {\n if (!import.meta.env) {\n logger('Vite env variables cannot be loaded on a commonjs environment.', {\n level: 'error',\n });\n return extractEmptyEnvVariable();\n }\n\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: import.meta.env.VITE_INTLAYER_LOCALES,\n strictMode: import.meta.env.VITE_INTLAYER_STRICT_MODE,\n defaultLocale: import.meta.env.VITE_INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: import.meta.env.VITE_INTLAYER_HEADER_NAME,\n cookieName: import.meta.env.VITE_INTLAYER_COOKIE_NAME,\n prefixDefault: import.meta.env.VITE_INTLAYER_PREFIX_DEFAULT,\n basePath: import.meta.env.VITE_INTLAYER_BASE_PATH,\n serverSetCookie: import.meta.env.VITE_INTLAYER_SERVER_SET_COOKIE,\n noPrefix: import.meta.env.VITE_INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: import.meta.env.VITE_INTLAYER_FILE_EXTENSIONS,\n baseDir: import.meta.env.VITE_INTLAYER_BASE_DIR,\n contentDirName: import.meta.env.VITE_INTLAYER_CONTENT_DIR_NAME,\n contentDir: import.meta.env.VITE_INTLAYER_CONTENT_DIR,\n excludedPath: import.meta.env.VITE_INTLAYER_EXCLUDED_PATH,\n resultDirName: import.meta.env.VITE_INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName: import.meta.env\n .VITE_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: import.meta.env.VITE_INTLAYER_DICTIONARIES_DIR_NAME,\n i18nextResourcesDirName: import.meta.env\n .VITE_INTLAYER_I18N_RESOURCES_DIR_NAME,\n reactIntlMessagesDirName: import.meta.env\n .VITE_INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,\n typeDirName: import.meta.env.VITE_INTLAYER_TYPE_DIR_NAME,\n mainDirName: import.meta.env.VITE_INTLAYER_MAIN_DIR_NAME,\n resultDir: import.meta.env.VITE_INTLAYER_RESULT_DIR,\n moduleAugmentationDir: import.meta.env\n .VITE_INTLAYER_MODULE_AUGMENTATION_DIR,\n dictionariesDir: import.meta.env.VITE_INTLAYER_DICTIONARIES_DIR,\n i18nextResourcesDir: import.meta.env.VITE_INTLAYER_I18N_DICTIONARIES_DIR,\n reactIntlMessagesDir: import.meta.env\n .VITE_INTLAYER_REACT_INTL_DICTIONARIES_DIR,\n typesDir: import.meta.env.VITE_INTLAYER_TYPE_DIR,\n mainDir: import.meta.env.VITE_INTLAYER_MAIN_DIR,\n watchedFilesPattern: import.meta.env.VITE_INTLAYER_WATCHED_FILES_PATTERN,\n watchedFilesPatternWithPath: import.meta.env\n .VITE_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n outputFilesPatternWithPath: import.meta.env\n .VITE_INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH,\n dictionaryOutput: import.meta.env.VITE_INTLAYER_DICTIONARY_OUTPUT,\n watch: import.meta.env.VITE_INTLAYER_WATCH,\n };\n\n const editor: ReplaceValue<EditorConfig> = {\n backendURL: import.meta.env.VITE_INTLAYER_BACKEND_URL,\n enabled: import.meta.env.VITE_INTLAYER_ENABLED,\n clientId: import.meta.env.VITE_INTLAYER_CLIENT_ID,\n clientSecret: import.meta.env.VITE_INTLAYER_CLIENT_SECRET,\n dictionaryPriorityStrategy: import.meta.env\n .VITE_INTLAYER_DICTIONARY_PRIORITY_STRATEGY,\n };\n\n const log: ReplaceValue<LogConfig> = {\n mode: import.meta.env.VITE_INTLAYER_LOG_MODE,\n prefix: import.meta.env.VITE_INTLAYER_LOG_PREFIX,\n };\n\n return {\n internationalization,\n middleware,\n content,\n editor,\n log,\n };\n};\n"],"mappings":"AAAA,SAAS,cAAc;AASvB,SAAS,+BAA+B;AAEjC,MAAM,yBAAyB,MAAiC;AACrE,MAAI,CAAC,YAAY,KAAK;AACpB,WAAO,kEAAkE;AAAA,MACvE,OAAO;AAAA,IACT,CAAC;AACD,WAAO,wBAAwB;AAAA,EACjC;AAEA,QAAM,uBAAiE;AAAA,IACrE,SAAS,YAAY,IAAI;AAAA,IACzB,YAAY,YAAY,IAAI;AAAA,IAC5B,eAAe,YAAY,IAAI;AAAA,EACjC;AAEA,QAAM,aAA6C;AAAA,IACjD,YAAY,YAAY,IAAI;AAAA,IAC5B,YAAY,YAAY,IAAI;AAAA,IAC5B,eAAe,YAAY,IAAI;AAAA,IAC/B,UAAU,YAAY,IAAI;AAAA,IAC1B,iBAAiB,YAAY,IAAI;AAAA,IACjC,UAAU,YAAY,IAAI;AAA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50
50
|
),
|
|
51
51
|
dictionariesDir: getEnvValue(env.content.dictionariesDir, "string"),
|
|
52
|
-
|
|
53
|
-
env.content.
|
|
52
|
+
i18nextResourcesDirName: getEnvValue(
|
|
53
|
+
env.content.i18nextResourcesDirName,
|
|
54
54
|
"string"
|
|
55
55
|
),
|
|
56
|
-
|
|
57
|
-
env.content.
|
|
56
|
+
i18nextResourcesDir: getEnvValue(
|
|
57
|
+
env.content.i18nextResourcesDir,
|
|
58
|
+
"string"
|
|
59
|
+
),
|
|
60
|
+
reactIntlMessagesDirName: getEnvValue(
|
|
61
|
+
env.content.reactIntlMessagesDirName,
|
|
62
|
+
"string"
|
|
63
|
+
),
|
|
64
|
+
reactIntlMessagesDir: getEnvValue(
|
|
65
|
+
env.content.reactIntlMessagesDir,
|
|
58
66
|
"string"
|
|
59
67
|
),
|
|
60
68
|
typeDirName: getEnvValue(env.content.typeDirName, "string"),
|
|
@@ -85,11 +93,16 @@ const getConfiguration = () => {
|
|
|
85
93
|
"string"
|
|
86
94
|
)
|
|
87
95
|
};
|
|
96
|
+
const logConfiguration = {
|
|
97
|
+
mode: getEnvValue(env.log.mode, "string"),
|
|
98
|
+
prefix: getEnvValue(env.log.prefix, "string")
|
|
99
|
+
};
|
|
88
100
|
const intlayerConfiguration = {
|
|
89
101
|
internationalization: intlayerIntlConfiguration,
|
|
90
102
|
middleware: intlayerMiddlewareConfiguration,
|
|
91
103
|
content: intlayerContentConfiguration,
|
|
92
|
-
editor: intlayerEditorConfiguration
|
|
104
|
+
editor: intlayerEditorConfiguration,
|
|
105
|
+
log: logConfiguration
|
|
93
106
|
};
|
|
94
107
|
return intlayerConfiguration;
|
|
95
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/envVariables/getConfiguration.ts"],"sourcesContent":["import type {\n ContentConfig,\n DictionaryOutput,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n ServerSetCookieRule,\n StrictMode,\n} from '../types/config';\nimport type { Locales } from '../types/locales';\nimport { extractEnvVariable } from './extractEnvVariable/index';\nimport { getEnvValue } from './utils';\n\n/**\n * Get all configuration values using environment variables\n * Can be used in the client side as the server side\n * To use it, be sure to have the environment variables set\n */\nexport const getConfiguration = (): IntlayerConfig => {\n const env = extractEnvVariable();\n\n const intlayerIntlConfiguration: InternationalizationConfig = {\n locales: getEnvValue<Locales>(env.internationalization.locales, 'array')!,\n strictMode: getEnvValue<StrictMode>(\n env.internationalization.strictMode,\n 'string'\n )!,\n defaultLocale: getEnvValue<Locales>(\n env?.internationalization.defaultLocale,\n 'string'\n )!,\n };\n\n const intlayerMiddlewareConfiguration: MiddlewareConfig = {\n headerName: getEnvValue(env.middleware.headerName, 'string')!,\n cookieName: getEnvValue(env.middleware.cookieName, 'string')!,\n prefixDefault: getEnvValue(env.middleware.prefixDefault, 'boolean')!,\n basePath: getEnvValue(env.middleware.basePath, 'string')!,\n serverSetCookie: getEnvValue<ServerSetCookieRule>(\n env.middleware.serverSetCookie,\n 'string'\n )!,\n noPrefix: getEnvValue(env.middleware.noPrefix, 'boolean')!,\n };\n\n const intlayerContentConfiguration: ContentConfig = {\n fileExtensions: getEnvValue<string>(env.content.fileExtensions, 'array')!,\n baseDir: getEnvValue(env.content.baseDir, 'string')!,\n contentDirName: getEnvValue(env.content.contentDirName, 'string')!,\n contentDir: getEnvValue(env.content.contentDir, 'string')!,\n excludedPath: getEnvValue<string>(env.content.excludedPath, 'array')!,\n resultDirName: getEnvValue(env.content.resultDirName, 'string')!,\n resultDir: getEnvValue(env.content.resultDir, 'string')!,\n moduleAugmentationDirName: getEnvValue(\n env.content.moduleAugmentationDirName,\n 'string'\n )!,\n moduleAugmentationDir: getEnvValue(\n env.content.moduleAugmentationDir,\n 'string'\n )!,\n dictionaryOutput: getEnvValue<DictionaryOutput>(\n env.content.dictionaryOutput,\n 'array'\n )!,\n dictionariesDirName: getEnvValue(\n env.content.dictionariesDirName,\n 'string'\n )!,\n dictionariesDir: getEnvValue(env.content.dictionariesDir, 'string')!,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/envVariables/getConfiguration.ts"],"sourcesContent":["import type {\n ContentConfig,\n DictionaryOutput,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n LogConfig,\n ServerSetCookieRule,\n StrictMode,\n} from '../types/config';\nimport type { Locales } from '../types/locales';\nimport { extractEnvVariable } from './extractEnvVariable/index';\nimport { getEnvValue } from './utils';\n\n/**\n * Get all configuration values using environment variables\n * Can be used in the client side as the server side\n * To use it, be sure to have the environment variables set\n */\nexport const getConfiguration = (): IntlayerConfig => {\n const env = extractEnvVariable();\n\n const intlayerIntlConfiguration: InternationalizationConfig = {\n locales: getEnvValue<Locales>(env.internationalization.locales, 'array')!,\n strictMode: getEnvValue<StrictMode>(\n env.internationalization.strictMode,\n 'string'\n )!,\n defaultLocale: getEnvValue<Locales>(\n env?.internationalization.defaultLocale,\n 'string'\n )!,\n };\n\n const intlayerMiddlewareConfiguration: MiddlewareConfig = {\n headerName: getEnvValue(env.middleware.headerName, 'string')!,\n cookieName: getEnvValue(env.middleware.cookieName, 'string')!,\n prefixDefault: getEnvValue(env.middleware.prefixDefault, 'boolean')!,\n basePath: getEnvValue(env.middleware.basePath, 'string')!,\n serverSetCookie: getEnvValue<ServerSetCookieRule>(\n env.middleware.serverSetCookie,\n 'string'\n )!,\n noPrefix: getEnvValue(env.middleware.noPrefix, 'boolean')!,\n };\n\n const intlayerContentConfiguration: ContentConfig = {\n fileExtensions: getEnvValue<string>(env.content.fileExtensions, 'array')!,\n baseDir: getEnvValue(env.content.baseDir, 'string')!,\n contentDirName: getEnvValue(env.content.contentDirName, 'string')!,\n contentDir: getEnvValue(env.content.contentDir, 'string')!,\n excludedPath: getEnvValue<string>(env.content.excludedPath, 'array')!,\n resultDirName: getEnvValue(env.content.resultDirName, 'string')!,\n resultDir: getEnvValue(env.content.resultDir, 'string')!,\n moduleAugmentationDirName: getEnvValue(\n env.content.moduleAugmentationDirName,\n 'string'\n )!,\n moduleAugmentationDir: getEnvValue(\n env.content.moduleAugmentationDir,\n 'string'\n )!,\n dictionaryOutput: getEnvValue<DictionaryOutput>(\n env.content.dictionaryOutput,\n 'array'\n )!,\n dictionariesDirName: getEnvValue(\n env.content.dictionariesDirName,\n 'string'\n )!,\n dictionariesDir: getEnvValue(env.content.dictionariesDir, 'string')!,\n i18nextResourcesDirName: getEnvValue(\n env.content.i18nextResourcesDirName,\n 'string'\n )!,\n i18nextResourcesDir: getEnvValue(\n env.content.i18nextResourcesDir,\n 'string'\n )!,\n reactIntlMessagesDirName: getEnvValue(\n env.content.reactIntlMessagesDirName,\n 'string'\n )!,\n reactIntlMessagesDir: getEnvValue(\n env.content.reactIntlMessagesDir,\n 'string'\n )!,\n typeDirName: getEnvValue(env.content.typeDirName, 'string')!,\n typesDir: getEnvValue(env.content.typesDir, 'string')!,\n mainDirName: getEnvValue(env.content.mainDirName, 'string')!,\n mainDir: getEnvValue(env.content.mainDir, 'string')!,\n watchedFilesPattern: getEnvValue<string>(\n env.content.watchedFilesPattern,\n 'array'\n )!,\n watchedFilesPatternWithPath: getEnvValue<string>(\n env.content.watchedFilesPatternWithPath,\n 'array'\n )!,\n outputFilesPatternWithPath: getEnvValue(\n env.content.outputFilesPatternWithPath,\n 'string'\n )!,\n watch: getEnvValue(env.content.watch, 'boolean')!,\n };\n\n const intlayerEditorConfiguration = {\n backendURL: getEnvValue(env.editor.backendURL, 'string')!,\n enabled: getEnvValue(env.editor.enabled, 'boolean')!,\n clientId: getEnvValue(env.editor.clientId, 'string')!,\n clientSecret: getEnvValue(env.editor.clientSecret, 'string')!,\n dictionaryPriorityStrategy: getEnvValue(\n env.editor.dictionaryPriorityStrategy,\n 'string'\n )! as 'locale_first' | 'distant_first',\n };\n\n const logConfiguration: LogConfig = {\n mode: getEnvValue(env.log.mode, 'string')!,\n prefix: getEnvValue(env.log.prefix, 'string')!,\n };\n\n const intlayerConfiguration: IntlayerConfig = {\n internationalization: intlayerIntlConfiguration,\n middleware: intlayerMiddlewareConfiguration,\n content: intlayerContentConfiguration,\n editor: intlayerEditorConfiguration,\n log: logConfiguration,\n };\n\n return intlayerConfiguration;\n};\n"],"mappings":"AAWA,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAOrB,MAAM,mBAAmB,MAAsB;AACpD,QAAM,MAAM,mBAAmB;AAE/B,QAAM,4BAAwD;AAAA,IAC5D,SAAS,YAAqB,IAAI,qBAAqB,SAAS,OAAO;AAAA,IACvE,YAAY;AAAA,MACV,IAAI,qBAAqB;AAAA,MACzB;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb,KAAK,qBAAqB;AAAA,MAC1B;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kCAAoD;AAAA,IACxD,YAAY,YAAY,IAAI,WAAW,YAAY,QAAQ;AAAA,IAC3D,YAAY,YAAY,IAAI,WAAW,YAAY,QAAQ;AAAA,IAC3D,eAAe,YAAY,IAAI,WAAW,eAAe,SAAS;AAAA,IAClE,UAAU,YAAY,IAAI,WAAW,UAAU,QAAQ;AAAA,IACvD,iBAAiB;AAAA,MACf,IAAI,WAAW;AAAA,MACf;AAAA,IACF;AAAA,IACA,UAAU,YAAY,IAAI,WAAW,UAAU,SAAS;AAAA,EAC1D;AAEA,QAAM,+BAA8C;AAAA,IAClD,gBAAgB,YAAoB,IAAI,QAAQ,gBAAgB,OAAO;AAAA,IACvE,SAAS,YAAY,IAAI,QAAQ,SAAS,QAAQ;AAAA,IAClD,gBAAgB,YAAY,IAAI,QAAQ,gBAAgB,QAAQ;AAAA,IAChE,YAAY,YAAY,IAAI,QAAQ,YAAY,QAAQ;AAAA,IACxD,cAAc,YAAoB,IAAI,QAAQ,cAAc,OAAO;AAAA,IACnE,eAAe,YAAY,IAAI,QAAQ,eAAe,QAAQ;AAAA,IAC9D,WAAW,YAAY,IAAI,QAAQ,WAAW,QAAQ;AAAA,IACtD,2BAA2B;AAAA,MACzB,IAAI,QAAQ;AAAA,MACZ;AAAA,I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AA4B;AAAA,MAC1B,IAAI,OAAO;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAEA,QAAM,mBAA8B;AAAA,IAClC,MAAM,YAAY,IAAI,IAAI,MAAM,QAAQ;AAAA,IACxC,QAAQ,YAAY,IAAI,IAAI,QAAQ,QAAQ;AAAA,EAC9C;AAEA,QAAM,wBAAwC;AAAA,IAC5C,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logger } from '../logger.mjs';
|
|
1
2
|
function getEnvValue(value, type, verbose = false) {
|
|
2
3
|
try {
|
|
3
4
|
switch (type) {
|
|
@@ -15,8 +16,9 @@ function getEnvValue(value, type, verbose = false) {
|
|
|
15
16
|
}
|
|
16
17
|
} catch (error) {
|
|
17
18
|
if (verbose) {
|
|
18
|
-
|
|
19
|
-
`Error parsing environment variable, parsing : ${(value ?? "").toString()}
|
|
19
|
+
logger(
|
|
20
|
+
`Error parsing environment variable, parsing : ${(value ?? "").toString()}`,
|
|
21
|
+
{ level: "error" }
|
|
20
22
|
);
|
|
21
23
|
}
|
|
22
24
|
return void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/envVariables/utils.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/envVariables/utils.ts"],"sourcesContent":["import { logger } from '../logger';\n\nfunction getEnvValue(\n value: unknown,\n type: 'boolean',\n verbose?: boolean\n): boolean | undefined;\nfunction getEnvValue(\n value: unknown,\n type: 'number',\n verbose?: boolean\n): number | undefined;\nfunction getEnvValue<T extends string>(\n value: unknown,\n type: 'string',\n verbose?: boolean\n): T | undefined;\nfunction getEnvValue<T>(\n value: unknown,\n type: 'object',\n verbose?: boolean\n): T | undefined;\nfunction getEnvValue<T>(\n value: unknown,\n type: 'array',\n verbose?: boolean\n): T[] | undefined;\nfunction getEnvValue(\n value: unknown,\n type: 'string' | 'boolean' | 'number' | 'object' | 'array',\n verbose = false\n) {\n try {\n switch (type) {\n case 'boolean':\n // Convert string to boolean explicitly\n return value === 'true' || value === '1';\n\n case 'number':\n // Convert string to number, return undefined if conversion fails\n return Number(value);\n\n case 'string':\n // Return the string directly\n return value ?? '';\n\n case 'object':\n case 'array':\n // Attempt to parse the value as JSON\n return JSON.parse(value as string);\n\n default:\n return undefined;\n }\n } catch (error) {\n // Log error and return undefined if any error occurs during parsing\n if (verbose) {\n logger(\n `Error parsing environment variable, parsing : ${((value ?? '') as string).toString()}`,\n { level: 'error' }\n );\n }\n return undefined;\n }\n}\n\nexport { getEnvValue };\n"],"mappings":"AAAA,SAAS,cAAc;AA2BvB,SAAS,YACP,OACA,MACA,UAAU,OACV;AACA,MAAI;AACF,YAAQ,MAAM;AAAA,MACZ,KAAK;AAEH,eAAO,UAAU,UAAU,UAAU;AAAA,MAEvC,KAAK;AAEH,eAAO,OAAO,KAAK;AAAA,MAErB,KAAK;AAEH,eAAO,SAAS;AAAA,MAElB,KAAK;AAAA,MACL,KAAK;AAEH,eAAO,KAAK,MAAM,KAAe;AAAA,MAEnC;AACE,eAAO;AAAA,IACX;AAAA,EACF,SAAS,OAAO;AAEd,QAAI,SAAS;AACX;AAAA,QACE,kDAAmD,SAAS,IAAe,SAAS,CAAC;AAAA,QACrF,EAAE,OAAO,QAAQ;AAAA,MACnB;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -7,13 +7,17 @@ import {
|
|
|
7
7
|
getPlatform
|
|
8
8
|
} from './envVariables/index.mjs';
|
|
9
9
|
import { ESMxCJSRequire } from './utils/ESMxCJSRequire.mjs';
|
|
10
|
+
import { logger } from './logger.mjs';
|
|
11
|
+
import { appLogger } from './appLoggerServer.mjs';
|
|
10
12
|
export {
|
|
11
13
|
ESMxCJSRequire,
|
|
12
14
|
Locales,
|
|
15
|
+
appLogger,
|
|
13
16
|
formatEnvVariable,
|
|
14
17
|
getConfiguration2 as getClientConfiguration,
|
|
15
18
|
getConfiguration,
|
|
16
19
|
getPlatform,
|
|
17
|
-
loadEnvFile
|
|
20
|
+
loadEnvFile,
|
|
21
|
+
logger
|
|
18
22
|
};
|
|
19
23
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getConfiguration } from './configFile/getConfiguration';\n\nexport type {\n InternationalizationConfig,\n ServerSetCookieRule,\n MiddlewareConfig,\n CustomIntlayerConfig,\n BaseContentConfig,\n BaseDerivedConfig,\n ResultDirDerivedConfig,\n PatternsContentConfig,\n ContentConfig,\n StrictMode,\n IntlayerConfig,\n} from './types/config';\nexport type { LocalesValues } from './types/locales';\nexport { Locales } from './types/locales';\nexport {\n formatEnvVariable,\n getConfiguration as getClientConfiguration,\n loadEnvFile,\n getPlatform,\n} from './envVariables/index';\nexport { ESMxCJSRequire } from './utils/ESMxCJSRequire';\n"],"mappings":"AAAA,SAAS,wBAAwB;
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getConfiguration } from './configFile/getConfiguration';\n\nexport type {\n InternationalizationConfig,\n ServerSetCookieRule,\n MiddlewareConfig,\n CustomIntlayerConfig,\n BaseContentConfig,\n BaseDerivedConfig,\n ResultDirDerivedConfig,\n PatternsContentConfig,\n ContentConfig,\n LogConfig,\n StrictMode,\n IntlayerConfig,\n} from './types/config';\nexport type { LocalesValues } from './types/locales';\nexport { Locales } from './types/locales';\nexport {\n formatEnvVariable,\n getConfiguration as getClientConfiguration,\n loadEnvFile,\n getPlatform,\n} from './envVariables/index';\nexport { ESMxCJSRequire } from './utils/ESMxCJSRequire';\nexport { logger } from './logger';\nexport { appLogger } from './appLoggerServer';\n"],"mappings":"AAAA,SAAS,wBAAwB;AAiBjC,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACoB,oBAApBA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,iBAAiB;","names":["getConfiguration"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const logger = (content, details = {
|
|
2
|
+
isVerbose: false,
|
|
3
|
+
level: void 0,
|
|
4
|
+
config: { mode: "default", prefix: "" }
|
|
5
|
+
}) => {
|
|
6
|
+
const { mode, prefix } = details.config ?? {};
|
|
7
|
+
if (mode === "disabled") return;
|
|
8
|
+
if (details.isVerbose && mode !== "verbose") return;
|
|
9
|
+
if (details.level === "debug") {
|
|
10
|
+
return console.debug(`${prefix}${content}`);
|
|
11
|
+
}
|
|
12
|
+
if (details.level === "info") {
|
|
13
|
+
return console.info(`${prefix}${content}`);
|
|
14
|
+
}
|
|
15
|
+
if (details.level === "warn") {
|
|
16
|
+
return console.warn(`${prefix}${content}`);
|
|
17
|
+
}
|
|
18
|
+
if (details.level === "error") {
|
|
19
|
+
return console.error(`${prefix}${content}`);
|
|
20
|
+
}
|
|
21
|
+
console.log(`${prefix}${content}`);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
logger
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=logger.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/logger.ts"],"sourcesContent":["import { IntlayerConfig } from './types/config';\n\nexport type Details = {\n isVerbose?: boolean;\n level?: 'info' | 'warn' | 'error' | 'debug';\n config?: Partial<IntlayerConfig['log']>;\n};\n\n// @ts-ignore expected any, but it's not possible to type it correctly\nexport type Logger = (content: any, details?: Details) => void;\n\nexport const logger: Logger = (\n content,\n details = {\n isVerbose: false,\n level: undefined,\n config: { mode: 'default', prefix: '' },\n }\n) => {\n const { mode, prefix } = details.config ?? {};\n\n if (mode === 'disabled') return;\n\n if (details.isVerbose && mode !== 'verbose') return;\n\n if (details.level === 'debug') {\n return console.debug(`${prefix}${content}`);\n }\n\n if (details.level === 'info') {\n return console.info(`${prefix}${content}`);\n }\n\n if (details.level === 'warn') {\n return console.warn(`${prefix}${content}`);\n }\n\n if (details.level === 'error') {\n return console.error(`${prefix}${content}`);\n }\n\n console.log(`${prefix}${content}`);\n};\n"],"mappings":"AAWO,MAAM,SAAiB,CAC5B,SACA,UAAU;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,QAAQ,EAAE,MAAM,WAAW,QAAQ,GAAG;AACxC,MACG;AACH,QAAM,EAAE,MAAM,OAAO,IAAI,QAAQ,UAAU,CAAC;AAE5C,MAAI,SAAS,WAAY;AAEzB,MAAI,QAAQ,aAAa,SAAS,UAAW;AAE7C,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE;AAAA,EAC5C;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,GAAG,MAAM,GAAG,OAAO,EAAE;AAAA,EAC3C;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,GAAG,MAAM,GAAG,OAAO,EAAE;AAAA,EAC3C;AAEA,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE;AAAA,EAC5C;AAEA,UAAQ,IAAI,GAAG,MAAM,GAAG,OAAO,EAAE;AACnC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appLoggerClient.d.ts","sourceRoot":"","sources":["../../src/appLoggerClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAU,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,SAAS,EAAE,MAIpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appLoggerServer.d.ts","sourceRoot":"","sources":["../../src/appLoggerServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAU,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,SAAS,EAAE,MAIpB,CAAC"}
|
package/dist/types/client.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export type { CustomIntlayerConfig, PatternsContentConfig, IntlayerConfig, BaseC
|
|
|
2
2
|
export type { LocalesValues } from './types/locales';
|
|
3
3
|
export { Locales } from './types/locales';
|
|
4
4
|
export { getConfiguration } from './envVariables/getConfiguration';
|
|
5
|
+
export { logger } from './logger';
|
|
6
|
+
export { appLogger } from './appLoggerClient';
|
|
5
7
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildConfigurationFields.d.ts","sourceRoot":"","sources":["../../../src/configFile/buildConfigurationFields.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildConfigurationFields.d.ts","sourceRoot":"","sources":["../../../src/configFile/buildConfigurationFields.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAGV,oBAAoB,EAGpB,cAAc,EAMf,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAqjBlE;;GAEG;AACH,eAAO,MAAM,wBAAwB,YAC1B,uBAAuB,wBACV,oBAAoB,KACzC,cAwBF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfiguration.d.ts","sourceRoot":"","sources":["../../../src/configFile/getConfiguration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"getConfiguration.d.ts","sourceRoot":"","sources":["../../../src/configFile/getConfiguration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAU5E,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAQF;;GAEG;AACH,eAAO,MAAM,gBAAgB,aACjB,OAAO,CAAC,uBAAuB,CAAC,KACzC,cAkCF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfigurationFile.d.ts","sourceRoot":"","sources":["../../../src/configFile/loadConfigurationFile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"loadConfigurationFile.d.ts","sourceRoot":"","sources":["../../../src/configFile/loadConfigurationFile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAqD5D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,mBAChB,MAAM,KACrB,oBAAoB,GAAG,SAgEzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchConfigurationFile.d.ts","sourceRoot":"","sources":["../../../src/configFile/searchConfigurationFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"searchConfigurationFile.d.ts","sourceRoot":"","sources":["../../../src/configFile/searchConfigurationFile.ts"],"names":[],"mappings":"AAcA,KAAK,6BAA6B,GAAG;IACnC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,mBAClB,MAAM,KACrB,6BA2BF,CAAC"}
|
|
@@ -6,7 +6,8 @@ export declare const RESULT_DIR_NAME = ".intlayer";
|
|
|
6
6
|
export declare const MODULE_AUGMENTATION_DIR_NAME = "types";
|
|
7
7
|
export declare const DICTIONARY_OUTPUT: DictionaryOutput[];
|
|
8
8
|
export declare const DICTIONARIES_DIR_NAME = "dictionary";
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const I18NEXT_DICTIONARIES_DIR_NAME = "i18next_resources";
|
|
10
|
+
export declare const REACT_INTL_MESSAGES_DIR_NAME = "intl_messages";
|
|
10
11
|
export declare const TYPES_DIR_NAME = "types";
|
|
11
12
|
export declare const MAIN_DIR_NAME = "main";
|
|
12
13
|
export declare const WATCH: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/defaultValues/content.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,eAAO,MAAM,eAAe,UAQ3B,CAAC;AACF,eAAO,MAAM,cAAc,UAAmB,CAAC;AAE/C,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C,eAAO,MAAM,4BAA4B,UAAU,CAAC;AAEpD,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,EAAiB,CAAC;AAElE,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/defaultValues/content.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,eAAO,MAAM,eAAe,UAQ3B,CAAC;AACF,eAAO,MAAM,cAAc,UAAmB,CAAC;AAE/C,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C,eAAO,MAAM,4BAA4B,UAAU,CAAC;AAEpD,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,EAAiB,CAAC;AAElE,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AAEjE,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC,eAAO,MAAM,KAAK,SAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/defaultValues/log.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,YAAY,CAAC;AAM9B,eAAO,MAAM,MAAM,mCAA+B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../../../src/envVariables/extractEnvVariable/next.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../../../src/envVariables/extractEnvVariable/next.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,yBAAyB,EAAgB,MAAM,SAAS,CAAC;AAEvE,eAAO,MAAM,sBAAsB,QAAO,yBAuEzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react_app.d.ts","sourceRoot":"","sources":["../../../../src/envVariables/extractEnvVariable/react_app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react_app.d.ts","sourceRoot":"","sources":["../../../../src/envVariables/extractEnvVariable/react_app.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,yBAAyB,EAAgB,MAAM,SAAS,CAAC;AAEvE,eAAO,MAAM,0BAA0B,QAAO,yBAuE7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undefined_platform.d.ts","sourceRoot":"","sources":["../../../../src/envVariables/extractEnvVariable/undefined_platform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"undefined_platform.d.ts","sourceRoot":"","sources":["../../../../src/envVariables/extractEnvVariable/undefined_platform.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAgB,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEvE,eAAO,MAAM,uBAAuB,QAAO,yBAmE1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../../../src/envVariables/extractEnvVariable/vite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../../../src/envVariables/extractEnvVariable/vite.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,yBAAyB,EAAgB,MAAM,SAAS,CAAC;AAGvE,eAAO,MAAM,sBAAsB,QAAO,yBA8EzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfiguration.d.ts","sourceRoot":"","sources":["../../../src/envVariables/getConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,
|
|
1
|
+
{"version":3,"file":"getConfiguration.d.ts","sourceRoot":"","sources":["../../../src/envVariables/getConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EAKf,MAAM,iBAAiB,CAAC;AAKzB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAO,cAgHnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/envVariables/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/envVariables/utils.ts"],"names":[],"mappings":"AAEA,iBAAS,WAAW,CAClB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,SAAS,EACf,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,GAAG,SAAS,CAAC;AACvB,iBAAS,WAAW,CAClB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,QAAQ,EACd,OAAO,CAAC,EAAE,OAAO,GAChB,MAAM,GAAG,SAAS,CAAC;AACtB,iBAAS,WAAW,CAAC,CAAC,SAAS,MAAM,EACnC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,QAAQ,EACd,OAAO,CAAC,EAAE,OAAO,GAChB,CAAC,GAAG,SAAS,CAAC;AACjB,iBAAS,WAAW,CAAC,CAAC,EACpB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,QAAQ,EACd,OAAO,CAAC,EAAE,OAAO,GAChB,CAAC,GAAG,SAAS,CAAC;AACjB,iBAAS,WAAW,CAAC,CAAC,EACpB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,OAAO,GAChB,CAAC,EAAE,GAAG,SAAS,CAAC;AAwCnB,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { getConfiguration } from './configFile/getConfiguration';
|
|
2
|
-
export type { InternationalizationConfig, ServerSetCookieRule, MiddlewareConfig, CustomIntlayerConfig, BaseContentConfig, BaseDerivedConfig, ResultDirDerivedConfig, PatternsContentConfig, ContentConfig, StrictMode, IntlayerConfig, } from './types/config';
|
|
2
|
+
export type { InternationalizationConfig, ServerSetCookieRule, MiddlewareConfig, CustomIntlayerConfig, BaseContentConfig, BaseDerivedConfig, ResultDirDerivedConfig, PatternsContentConfig, ContentConfig, LogConfig, StrictMode, IntlayerConfig, } from './types/config';
|
|
3
3
|
export type { LocalesValues } from './types/locales';
|
|
4
4
|
export { Locales } from './types/locales';
|
|
5
5
|
export { formatEnvVariable, getConfiguration as getClientConfiguration, loadEnvFile, getPlatform, } from './envVariables/index';
|
|
6
6
|
export { ESMxCJSRequire } from './utils/ESMxCJSRequire';
|
|
7
|
+
export { logger } from './logger';
|
|
8
|
+
export { appLogger } from './appLoggerServer';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,IAAI,sBAAsB,EAC1C,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,SAAS,EACT,UAAU,EACV,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,IAAI,sBAAsB,EAC1C,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IntlayerConfig } from './types/config';
|
|
2
|
+
export type Details = {
|
|
3
|
+
isVerbose?: boolean;
|
|
4
|
+
level?: 'info' | 'warn' | 'error' | 'debug';
|
|
5
|
+
config?: Partial<IntlayerConfig['log']>;
|
|
6
|
+
};
|
|
7
|
+
export type Logger = (content: any, details?: Details) => void;
|
|
8
|
+
export declare const logger: Logger;
|
|
9
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;CACzC,CAAC;AAGF,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AAE/D,eAAO,MAAM,MAAM,EAAE,MA+BpB,CAAC"}
|
|
@@ -124,7 +124,7 @@ export type EditorConfig = {
|
|
|
124
124
|
/**
|
|
125
125
|
* clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
|
|
126
126
|
* An access token is use to authenticate the user related to the project.
|
|
127
|
-
* To get an access token, go to https://
|
|
127
|
+
* To get an access token, go to https://intlayer.org/dashboard/project and create an account.
|
|
128
128
|
*
|
|
129
129
|
* Default: undefined
|
|
130
130
|
*
|
|
@@ -134,7 +134,7 @@ export type EditorConfig = {
|
|
|
134
134
|
/**
|
|
135
135
|
* clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
|
|
136
136
|
* An access token is use to authenticate the user related to the project.
|
|
137
|
-
* To get an access token, go to https://
|
|
137
|
+
* To get an access token, go to https://intlayer.org/dashboard/project and create an account.
|
|
138
138
|
*
|
|
139
139
|
* Default: undefined
|
|
140
140
|
*
|
|
@@ -173,6 +173,10 @@ export type CustomIntlayerConfig = {
|
|
|
173
173
|
* Custom editor configuration
|
|
174
174
|
*/
|
|
175
175
|
editor?: Partial<EditorConfig>;
|
|
176
|
+
/**
|
|
177
|
+
* Custom middleware configuration
|
|
178
|
+
*/
|
|
179
|
+
log?: Partial<LogConfig>;
|
|
176
180
|
};
|
|
177
181
|
/**
|
|
178
182
|
* Combined configuration for internationalization, middleware, and content
|
|
@@ -194,6 +198,10 @@ export type IntlayerConfig = {
|
|
|
194
198
|
* Intlayer editor configuration
|
|
195
199
|
*/
|
|
196
200
|
editor: EditorConfig;
|
|
201
|
+
/**
|
|
202
|
+
* Logger configuration
|
|
203
|
+
*/
|
|
204
|
+
log: LogConfig;
|
|
197
205
|
};
|
|
198
206
|
/**
|
|
199
207
|
* Base configuration for content handling
|
|
@@ -261,14 +269,25 @@ export type BaseContentConfig = {
|
|
|
261
269
|
/**
|
|
262
270
|
* Name of the directory where dictionaries are stored
|
|
263
271
|
*
|
|
264
|
-
* Default: '
|
|
272
|
+
* Default: 'i18next_dictionary'
|
|
265
273
|
*
|
|
266
274
|
* The directory for storing localization dictionaries.
|
|
267
275
|
*
|
|
268
276
|
* Note:
|
|
269
277
|
* - Ensure the dictionaries output includes 'i18next' to build the dictionaries for i18next
|
|
270
278
|
*/
|
|
271
|
-
|
|
279
|
+
i18nextResourcesDirName: string;
|
|
280
|
+
/**
|
|
281
|
+
* Name of the directory where dictionaries are stored
|
|
282
|
+
*
|
|
283
|
+
* Default: 'react-intl_dictionary'
|
|
284
|
+
*
|
|
285
|
+
* The directory for storing localization dictionaries.
|
|
286
|
+
*
|
|
287
|
+
* Note:
|
|
288
|
+
* - Ensure the dictionaries output includes 'react-intl' to build the dictionaries for react-intl
|
|
289
|
+
*/
|
|
290
|
+
reactIntlMessagesDirName: string;
|
|
272
291
|
/**
|
|
273
292
|
* Name of the directory where dictionary types are stored
|
|
274
293
|
*
|
|
@@ -292,7 +311,7 @@ export type BaseContentConfig = {
|
|
|
292
311
|
*/
|
|
293
312
|
watch: boolean;
|
|
294
313
|
};
|
|
295
|
-
export type DictionaryOutput = 'intlayer' | 'i18next';
|
|
314
|
+
export type DictionaryOutput = 'intlayer' | 'i18next' | 'react-intl';
|
|
296
315
|
/**
|
|
297
316
|
* Configuration derived based on the base content configuration
|
|
298
317
|
*/
|
|
@@ -348,17 +367,27 @@ export type ResultDirDerivedConfig = {
|
|
|
348
367
|
*/
|
|
349
368
|
dictionariesDir: string;
|
|
350
369
|
/**
|
|
351
|
-
*
|
|
352
370
|
* Directory where dictionaries are stored, relative to the result directory
|
|
353
371
|
*
|
|
354
|
-
* Default: {{resultDir}} / {{
|
|
372
|
+
* Default: {{resultDir}} / {{i18nextResourcesDirName}}
|
|
355
373
|
*
|
|
356
374
|
* Specifies the derived path for dictionaries relative to the result directory.
|
|
357
375
|
*
|
|
358
376
|
* Note:
|
|
359
377
|
* - Ensure the i18n dictionaries output includes i18next to build the dictionaries for i18next
|
|
360
378
|
*/
|
|
361
|
-
|
|
379
|
+
i18nextResourcesDir: string;
|
|
380
|
+
/**
|
|
381
|
+
* Directory where dictionaries are stored, relative to the result directory
|
|
382
|
+
*
|
|
383
|
+
* Default: {{resultDir}} / {{reactIntlMessagesDirName}}
|
|
384
|
+
*
|
|
385
|
+
* Specifies the derived path for dictionaries relative to the result directory.
|
|
386
|
+
*
|
|
387
|
+
* Note:
|
|
388
|
+
* - Ensure the dictionaries output includes 'react-intl' to build the dictionaries for react-intl
|
|
389
|
+
*/
|
|
390
|
+
reactIntlMessagesDir: string;
|
|
362
391
|
/**
|
|
363
392
|
* Directory where dictionary types are stored, relative to the result directory
|
|
364
393
|
*
|
|
@@ -409,4 +438,24 @@ export type PatternsContentConfig = {
|
|
|
409
438
|
* General configuration derived from the config file
|
|
410
439
|
*/
|
|
411
440
|
export type ContentConfig = BaseContentConfig & BaseDerivedConfig & ResultDirDerivedConfig & PatternsContentConfig;
|
|
441
|
+
export type LogConfig = {
|
|
442
|
+
/**
|
|
443
|
+
* Indicates if the logger is enabled
|
|
444
|
+
*
|
|
445
|
+
* Default: true
|
|
446
|
+
*
|
|
447
|
+
* If 'default', the logger is enabled and can be used.
|
|
448
|
+
* If 'verbose', the logger will be enabled and can be used, but will log more information.
|
|
449
|
+
* If 'disabled', the logger is disabled and cannot be used.
|
|
450
|
+
*/
|
|
451
|
+
mode: 'default' | 'verbose' | 'disabled';
|
|
452
|
+
/**
|
|
453
|
+
* Prefix of the logger
|
|
454
|
+
*
|
|
455
|
+
* Default: '[intlayer]'
|
|
456
|
+
*
|
|
457
|
+
* The prefix of the logger.
|
|
458
|
+
*/
|
|
459
|
+
prefix: string;
|
|
460
|
+
};
|
|
412
461
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,eAAe,GAAG,OAAO,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;;OAMG;IACH,OAAO,EAAE,OAAO,EAAE,CAAC;IAEnB;;;;;;;OAOG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;;;;;OAMG;IACH,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,eAAe,EAAE,mBAAmB,CAAC;IAErC;;;;;;OAMG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;OASG;IACH,0BAA0B,EAAE,cAAc,GAAG,eAAe,CAAC;CAC9D,CAAC;AAE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