@intlayer/config 3.0.3 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/configFile/loadConfigurationFile.cjs +1 -1
- package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
- package/dist/cjs/envVariables/getConfiguration.cjs +4 -5
- package/dist/cjs/envVariables/getConfiguration.cjs.map +1 -1
- package/dist/esm/configFile/loadConfigurationFile.mjs +1 -1
- package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
- package/dist/esm/envVariables/getConfiguration.mjs +4 -5
- package/dist/esm/envVariables/getConfiguration.mjs.map +1 -1
- package/dist/types/configFile/loadConfigurationFile.d.ts.map +1 -1
- package/dist/types/envVariables/getConfiguration.d.ts.map +1 -1
- package/package.json +16 -15
- package/dist/cjs/utils/removeUndefinedValueObject.cjs +0 -38
- package/dist/cjs/utils/removeUndefinedValueObject.cjs.map +0 -1
- package/dist/esm/utils/removeUndefinedValueObject.mjs +0 -14
- package/dist/esm/utils/removeUndefinedValueObject.mjs.map +0 -1
- package/dist/types/utils/removeUndefinedValueObject.d.ts +0 -2
- package/dist/types/utils/removeUndefinedValueObject.d.ts.map +0 -1
|
@@ -82,7 +82,7 @@ const loadConfigurationFile = (configFilePath) => {
|
|
|
82
82
|
const configFileExtension = configFilePath.split(".").pop() ?? "";
|
|
83
83
|
try {
|
|
84
84
|
if (configFileExtension === "json") {
|
|
85
|
-
return
|
|
85
|
+
return (0, import_ESMxCJSRequire.ESMxCJSRequire)(configFilePath);
|
|
86
86
|
}
|
|
87
87
|
const moduleResult = (0, import_esbuild.buildSync)({
|
|
88
88
|
entryPoints: [configFilePath],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import { type Context, runInNewContext } from 'vm';\nimport { type BuildOptions, buildSync, type BuildResult } from 'esbuild';\nimport React from 'react';\nimport { getPlatform } from '../envVariables/detectPlatform';\nimport { loadEnvFile } from '../envVariables/loadEnvFile';\nimport type { CustomIntlayerConfig } from '../types/config';\nimport { ESMxCJSRequire } from '../utils/ESMxCJSRequire';\n\n// If platform defined, the env file is already loaded by Rollup Webpack or Turbopack.\nif (getPlatform() === 'unknown') {\n loadEnvFile();\n}\n\nconst sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n React,\n process,\n console,\n require: ESMxCJSRequire,\n};\n\nconst define: Record<string, string> = {};\n\nfor (const k in process.env) {\n define[`process.env.${k}`] = JSON.stringify(process.env[k]);\n}\n\nconst transformationOption: BuildOptions = {\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n },\n format: 'cjs', // Output format as commonjs\n target: 'es2017',\n packages: 'external',\n write: false,\n bundle: true,\n define,\n};\n\nconst filterValidConfiguration = (\n configuration: CustomIntlayerConfig\n): CustomIntlayerConfig => {\n // @TODO Implement filtering of valid configuration\n return configuration;\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string\n): CustomIntlayerConfig | undefined => {\n let customConfiguration: CustomIntlayerConfig | undefined = undefined;\n\n const configFileExtension = configFilePath.split('.').pop() ?? '';\n\n try {\n if (configFileExtension === 'json') {\n // Assume JSON\n\n return ESMxCJSRequire(configFilePath);\n }\n\n // Rest is JS, MJS or TS\n\n const moduleResult: BuildResult = buildSync({\n entryPoints: [configFilePath],\n\n ...transformationOption,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n if (!moduleResultString) {\n console.error('Configuration file could not be loaded.');\n return undefined;\n }\n\n runInNewContext(moduleResultString, sandboxContext);\n\n if (\n sandboxContext.exports.default &&\n Object.keys(sandboxContext.exports.default).length > 0\n ) {\n // ES Module\n customConfiguration = sandboxContext.exports.default;\n } else if (\n sandboxContext.module.exports.defaults &&\n Object.keys(sandboxContext.module.exports.defaults).length > 0\n ) {\n // CommonJS\n customConfiguration = sandboxContext.module.exports.default;\n } else if (\n sandboxContext.module.exports.default &&\n Object.keys(sandboxContext.module.exports.default).length > 0\n ) {\n // ES Module\n customConfiguration = sandboxContext.module.exports.default;\n } else if (\n sandboxContext.module.exports &&\n Object.keys(sandboxContext.module.exports).length > 0\n ) {\n // Other\n customConfiguration = sandboxContext.module.exports;\n }\n\n if (typeof customConfiguration === 'undefined') {\n console.error('Configuration file could not be loaded.');\n return undefined;\n }\n\n return filterValidConfiguration(customConfiguration);\n } catch (error) {\n console.error('Error:', error);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA8C;AAC9C,qBAA+D;AAC/D,mBAAkB;AAClB,4BAA4B;AAC5B,yBAA4B;AAE5B,4BAA+B;AAG/B,QAAI,mCAAY,MAAM,WAAW;AAC/B,sCAAY;AACd;AAEA,MAAM,iBAA0B;AAAA,EAC9B,SAAS;AAAA,IACP,SAAS,CAAC;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,IACN,SAAS,CAAC;AAAA,EACZ;AAAA,EACA,oBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AACX;AAEA,MAAM,SAAiC,CAAC;AAExC,WAAW,KAAK,QAAQ,KAAK;AAC3B,SAAO,eAAe,CAAC,EAAE,IAAI,KAAK,UAAU,QAAQ,IAAI,CAAC,CAAC;AAC5D;AAEA,MAAM,uBAAqC;AAAA,EACzC,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,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d,YAAQ,MAAM,UAAU,KAAK;AAAA,EAC/B;AACF;","names":["React"]}
|
|
@@ -23,7 +23,6 @@ __export(getConfiguration_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(getConfiguration_exports);
|
|
24
24
|
var import_extractEnvVariable = require('./extractEnvVariable/index.cjs');
|
|
25
25
|
var import_utils = require('./utils.cjs');
|
|
26
|
-
var import_removeUndefinedValueObject = require('../utils/removeUndefinedValueObject.cjs');
|
|
27
26
|
const getConfiguration = () => {
|
|
28
27
|
const env = (0, import_extractEnvVariable.extractEnvVariable)();
|
|
29
28
|
const intlayerIntlConfiguration = {
|
|
@@ -109,10 +108,10 @@ const getConfiguration = () => {
|
|
|
109
108
|
)
|
|
110
109
|
};
|
|
111
110
|
const intlayerConfiguration = {
|
|
112
|
-
internationalization:
|
|
113
|
-
middleware:
|
|
114
|
-
content:
|
|
115
|
-
editor:
|
|
111
|
+
internationalization: intlayerIntlConfiguration,
|
|
112
|
+
middleware: intlayerMiddlewareConfiguration,
|
|
113
|
+
content: intlayerContentConfiguration,
|
|
114
|
+
editor: intlayerEditorConfiguration
|
|
116
115
|
};
|
|
117
116
|
return intlayerConfiguration;
|
|
118
117
|
};
|
|
@@ -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';\
|
|
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 i18nDictionariesDirName: getEnvValue(\n env.content.i18nDictionariesDirName,\n 'string'\n )!,\n i18nDictionariesDir: getEnvValue(\n env.content.i18nDictionariesDir,\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 };\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 intlayerConfiguration: IntlayerConfig = {\n internationalization: intlayerIntlConfiguration,\n middleware: intlayerMiddlewareConfiguration,\n content: intlayerContentConfiguration,\n editor: intlayerEditorConfiguration,\n };\n\n return intlayerConfiguration;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,gCAAmC;AACnC,mBAA4B;AAOrB,MAAM,mBAAmB,MAAsB;AACpD,QAAM,UAAM,8CAAmB;AAE/B,QAAM,4BAAwD;AAAA,IAC5D,aAAS,0BAAqB,IAAI,qBAAqB,SAAS,OAAO;AAAA,IACvE,gBAAY;AAAA,MACV,IAAI,qBAAqB;AAAA,MACzB;AAAA,IACF;AAAA,IACA,mBAAe;AAAA,MACb,KAAK,qBAAqB;AAAA,MAC1B;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kCAAoD;AAAA,IACxD,gBAA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,IAC1D,cAAU,0BAAY,IAAI,QAAQ,UAAU,QAAQ;AAAA,IACpD,iBAAa,0BAAY,IAAI,QAAQ,aAAa,QAAQ;AAAA,IAC1D,aAAS,0BAAY,IAAI,QAAQ,SAAS,QAAQ;AAAA,IAClD,yBAAqB;AAAA,MACnB,IAAI,QAAQ;AAAA,MACZ;AAAA,IACF;AAAA,IACA,iCAA6B;AAAA,MAC3B,IAAI,QAAQ;AAAA,MACZ;AAAA,IACF;AAAA,IACA,gCAA4B;AAAA,MAC1B,IAAI,QAAQ;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,QAAM,8BAA8B;AAAA,IAClC,gBAAY,0BAAY,IAAI,OAAO,YAAY,QAAQ;AAAA,IACvD,aAAS,0BAAY,IAAI,OAAO,SAAS,SAAS;AAAA,IAClD,cAAU,0BAAY,IAAI,OAAO,UAAU,QAAQ;AAAA,IACnD,kBAAc,0BAAY,IAAI,OAAO,cAAc,QAAQ;AAAA,IAC3D,gCAA4B;AAAA,MAC1B,IAAI,OAAO;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAEA,QAAM,wBAAwC;AAAA,IAC5C,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,EACV;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -49,7 +49,7 @@ const loadConfigurationFile = (configFilePath) => {
|
|
|
49
49
|
const configFileExtension = configFilePath.split(".").pop() ?? "";
|
|
50
50
|
try {
|
|
51
51
|
if (configFileExtension === "json") {
|
|
52
|
-
return
|
|
52
|
+
return ESMxCJSRequire(configFilePath);
|
|
53
53
|
}
|
|
54
54
|
const moduleResult = buildSync({
|
|
55
55
|
entryPoints: [configFilePath],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import { type Context, runInNewContext } from 'vm';\nimport { type BuildOptions, buildSync, type BuildResult } from 'esbuild';\nimport React from 'react';\nimport { getPlatform } from '../envVariables/detectPlatform';\nimport { loadEnvFile } from '../envVariables/loadEnvFile';\nimport type { CustomIntlayerConfig } from '../types/config';\nimport { ESMxCJSRequire } from '../utils/ESMxCJSRequire';\n\n// If platform defined, the env file is already loaded by Rollup Webpack or Turbopack.\nif (getPlatform() === 'unknown') {\n loadEnvFile();\n}\n\nconst sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n React,\n process,\n console,\n require: ESMxCJSRequire,\n};\n\nconst define: Record<string, string> = {};\n\nfor (const k in process.env) {\n define[`process.env.${k}`] = JSON.stringify(process.env[k]);\n}\n\nconst transformationOption: BuildOptions = {\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n },\n format: 'cjs', // Output format as commonjs\n target: 'es2017',\n packages: 'external',\n write: false,\n bundle: true,\n define,\n};\n\nconst filterValidConfiguration = (\n configuration: CustomIntlayerConfig\n): CustomIntlayerConfig => {\n // @TODO Implement filtering of valid configuration\n return configuration;\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string\n): CustomIntlayerConfig | undefined => {\n let customConfiguration: CustomIntlayerConfig | undefined = undefined;\n\n const configFileExtension = configFilePath.split('.').pop() ?? '';\n\n try {\n if (configFileExtension === 'json') {\n // Assume JSON\n\n return ESMxCJSRequire(configFilePath);\n }\n\n // Rest is JS, MJS or TS\n\n const moduleResult: BuildResult = buildSync({\n entryPoints: [configFilePath],\n\n ...transformationOption,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n if (!moduleResultString) {\n console.error('Configuration file could not be loaded.');\n return undefined;\n }\n\n runInNewContext(moduleResultString, sandboxContext);\n\n if (\n sandboxContext.exports.default &&\n Object.keys(sandboxContext.exports.default).length > 0\n ) {\n // ES Module\n customConfiguration = sandboxContext.exports.default;\n } else if (\n sandboxContext.module.exports.defaults &&\n Object.keys(sandboxContext.module.exports.defaults).length > 0\n ) {\n // CommonJS\n customConfiguration = sandboxContext.module.exports.default;\n } else if (\n sandboxContext.module.exports.default &&\n Object.keys(sandboxContext.module.exports.default).length > 0\n ) {\n // ES Module\n customConfiguration = sandboxContext.module.exports.default;\n } else if (\n sandboxContext.module.exports &&\n Object.keys(sandboxContext.module.exports).length > 0\n ) {\n // Other\n customConfiguration = sandboxContext.module.exports;\n }\n\n if (typeof customConfiguration === 'undefined') {\n console.error('Configuration file could not be loaded.');\n return undefined;\n }\n\n return filterValidConfiguration(customConfiguration);\n } catch (error) {\n console.error('Error:', error);\n }\n};\n"],"mappings":"AAAA,SAAuB,uBAAuB;AAC9C,SAA4B,iBAAmC;AAC/D,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAE5B,SAAS,sBAAsB;AAG/B,IAAI,YAAY,MAAM,WAAW;AAC/B,cAAY;AACd;AAEA,MAAM,iBAA0B;AAAA,EAC9B,SAAS;AAAA,IACP,SAAS,CAAC;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,IACN,SAAS,CAAC;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AACX;AAEA,MAAM,SAAiC,CAAC;AAExC,WAAW,KAAK,QAAQ,KAAK;AAC3B,SAAO,eAAe,CAAC,EAAE,IAAI,KAAK,UAAU,QAAQ,IAAI,CAAC,CAAC;AAC5D;AAEA,MAAM,uBAAqC;AAAA,EACzC,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,QAAQ;AAAA;AAAA,EAC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A,EAC/B;AACF;","names":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { extractEnvVariable } from './extractEnvVariable/index.mjs';
|
|
2
2
|
import { getEnvValue } from './utils.mjs';
|
|
3
|
-
import { removeUndefinedValueObject } from '../utils/removeUndefinedValueObject.mjs';
|
|
4
3
|
const getConfiguration = () => {
|
|
5
4
|
const env = extractEnvVariable();
|
|
6
5
|
const intlayerIntlConfiguration = {
|
|
@@ -86,10 +85,10 @@ const getConfiguration = () => {
|
|
|
86
85
|
)
|
|
87
86
|
};
|
|
88
87
|
const intlayerConfiguration = {
|
|
89
|
-
internationalization:
|
|
90
|
-
middleware:
|
|
91
|
-
content:
|
|
92
|
-
editor:
|
|
88
|
+
internationalization: intlayerIntlConfiguration,
|
|
89
|
+
middleware: intlayerMiddlewareConfiguration,
|
|
90
|
+
content: intlayerContentConfiguration,
|
|
91
|
+
editor: intlayerEditorConfiguration
|
|
93
92
|
};
|
|
94
93
|
return intlayerConfiguration;
|
|
95
94
|
};
|
|
@@ -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';\
|
|
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 i18nDictionariesDirName: getEnvValue(\n env.content.i18nDictionariesDirName,\n 'string'\n )!,\n i18nDictionariesDir: getEnvValue(\n env.content.i18nDictionariesDir,\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 };\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 intlayerConfiguration: IntlayerConfig = {\n internationalization: intlayerIntlConfiguration,\n middleware: intlayerMiddlewareConfiguration,\n content: intlayerContentConfiguration,\n editor: intlayerEditorConfiguration,\n };\n\n return intlayerConfiguration;\n};\n"],"mappings":"AAUA,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,YAA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B,IAAI,QAAQ;AAAA,MACZ;AAAA,IACF;AAAA,IACA,6BAA6B;AAAA,MAC3B,IAAI,QAAQ;AAAA,MACZ;AAAA,IACF;AAAA,IACA,4BAA4B;AAAA,MAC1B,IAAI,QAAQ;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,QAAM,8BAA8B;AAAA,IAClC,YAAY,YAAY,IAAI,OAAO,YAAY,QAAQ;AAAA,IACvD,SAAS,YAAY,IAAI,OAAO,SAAS,SAAS;AAAA,IAClD,UAAU,YAAY,IAAI,OAAO,UAAU,QAAQ;AAAA,IACnD,cAAc,YAAY,IAAI,OAAO,cAAc,QAAQ;AAAA,IAC3D,4BAA4B;AAAA,MAC1B,IAAI,OAAO;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAEA,QAAM,wBAAwC;AAAA,IAC5C,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,EACV;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfigurationFile.d.ts","sourceRoot":"","sources":["../../../src/configFile/loadConfigurationFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadConfigurationFile.d.ts","sourceRoot":"","sources":["../../../src/configFile/loadConfigurationFile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAoD5D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,mBAChB,MAAM,KACrB,oBAAoB,GAAG,SAgEzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfiguration.d.ts","sourceRoot":"","sources":["../../../src/envVariables/getConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EAIf,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"getConfiguration.d.ts","sourceRoot":"","sources":["../../../src/envVariables/getConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EAIf,MAAM,iBAAiB,CAAC;AAKzB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAO,cAiGnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/config",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared configuration package for IntLayer - Layer of abstraction between the business logic and the data access layer. Manage internationalization in a simple way, through TypeScript, JavaScript or JSON declaration file.",
|
|
6
6
|
"keywords": [
|
|
@@ -63,30 +63,31 @@
|
|
|
63
63
|
"./package.json"
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@swc-node/register": "^1.9
|
|
67
|
-
"@swc/cli": "^0.
|
|
66
|
+
"@swc-node/register": "^1.10.9",
|
|
67
|
+
"@swc/cli": "^0.5.0",
|
|
68
68
|
"dotenv": "^16.4.5",
|
|
69
|
-
"esbuild": "^0.
|
|
69
|
+
"esbuild": "^0.24.0",
|
|
70
70
|
"swc-loader": "^0.2.6",
|
|
71
|
-
"intlayer": "^3.0
|
|
71
|
+
"intlayer": "^3.2.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@types/node": "^
|
|
75
|
-
"@types/react": "^18.3.
|
|
76
|
-
"concurrently": "^
|
|
77
|
-
"eslint": "^9.
|
|
78
|
-
"prettier": "3.3.3",
|
|
79
|
-
"rimraf": "
|
|
74
|
+
"@types/node": "^22.9.0",
|
|
75
|
+
"@types/react": "^18.3.12",
|
|
76
|
+
"concurrently": "^9.1.0",
|
|
77
|
+
"eslint": "^9.14.0",
|
|
78
|
+
"prettier": "^3.3.3",
|
|
79
|
+
"rimraf": "^6.0.1",
|
|
80
80
|
"tsc-alias": "^1.8.10",
|
|
81
|
-
"tsup": "^8.3.
|
|
82
|
-
"typescript": "^5.
|
|
81
|
+
"tsup": "^8.3.5",
|
|
82
|
+
"typescript": "^5.6.3",
|
|
83
83
|
"@utils/eslint-config": "^1.0.4",
|
|
84
|
-
"@utils/ts-config": "^1.0.4",
|
|
85
84
|
"@utils/ts-config-types": "^1.0.4",
|
|
85
|
+
"@utils/ts-config": "^1.0.4",
|
|
86
86
|
"@utils/tsup-config": "^1.0.4"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"react": "
|
|
89
|
+
"react": ">=16.0.0 <19.0.0",
|
|
90
|
+
"intlayer": "^3.2.0"
|
|
90
91
|
},
|
|
91
92
|
"engines": {
|
|
92
93
|
"node": ">=14.18"
|
|
@@ -1,38 +0,0 @@
|
|
|
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 removeUndefinedValueObject_exports = {};
|
|
20
|
-
__export(removeUndefinedValueObject_exports, {
|
|
21
|
-
removeUndefinedValueObject: () => removeUndefinedValueObject
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(removeUndefinedValueObject_exports);
|
|
24
|
-
const removeUndefinedValueObject = (obj) => {
|
|
25
|
-
const newObj = {};
|
|
26
|
-
for (const key in obj) {
|
|
27
|
-
if (obj[key] !== void 0) {
|
|
28
|
-
newObj[key] = obj[key];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
Object.freeze(newObj);
|
|
32
|
-
return newObj;
|
|
33
|
-
};
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
removeUndefinedValueObject
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=removeUndefinedValueObject.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/removeUndefinedValueObject.ts"],"sourcesContent":["export const removeUndefinedValueObject = <T extends Record<string, unknown>>(\n obj: T\n): T => {\n const newObj: T = {} as T;\n\n for (const key in obj) {\n if (obj[key] !== undefined) {\n newObj[key] = obj[key];\n }\n }\n\n Object.freeze(newObj);\n\n return newObj;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,6BAA6B,CACxC,QACM;AACN,QAAM,SAAY,CAAC;AAEnB,aAAW,OAAO,KAAK;AACrB,QAAI,IAAI,GAAG,MAAM,QAAW;AAC1B,aAAO,GAAG,IAAI,IAAI,GAAG;AAAA,IACvB;AAAA,EACF;AAEA,SAAO,OAAO,MAAM;AAEpB,SAAO;AACT;","names":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const removeUndefinedValueObject = (obj) => {
|
|
2
|
-
const newObj = {};
|
|
3
|
-
for (const key in obj) {
|
|
4
|
-
if (obj[key] !== void 0) {
|
|
5
|
-
newObj[key] = obj[key];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
Object.freeze(newObj);
|
|
9
|
-
return newObj;
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
removeUndefinedValueObject
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=removeUndefinedValueObject.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/removeUndefinedValueObject.ts"],"sourcesContent":["export const removeUndefinedValueObject = <T extends Record<string, unknown>>(\n obj: T\n): T => {\n const newObj: T = {} as T;\n\n for (const key in obj) {\n if (obj[key] !== undefined) {\n newObj[key] = obj[key];\n }\n }\n\n Object.freeze(newObj);\n\n return newObj;\n};\n"],"mappings":"AAAO,MAAM,6BAA6B,CACxC,QACM;AACN,QAAM,SAAY,CAAC;AAEnB,aAAW,OAAO,KAAK;AACrB,QAAI,IAAI,GAAG,MAAM,QAAW;AAC1B,aAAO,GAAG,IAAI,IAAI,GAAG;AAAA,IACvB;AAAA,EACF;AAEA,SAAO,OAAO,MAAM;AAEpB,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"removeUndefinedValueObject.d.ts","sourceRoot":"","sources":["../../../src/utils/removeUndefinedValueObject.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OACrE,CAAC,KACL,CAYF,CAAC"}
|