@intlayer/config 5.5.0-canary.0 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/cjs/client.cjs +1 -4
  2. package/dist/cjs/client.cjs.map +1 -1
  3. package/dist/cjs/configFile/getConfiguration.cjs +14 -3
  4. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  5. package/dist/cjs/configFile/searchConfigurationFile.cjs +1 -1
  6. package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
  7. package/dist/cjs/index.cjs +2 -3
  8. package/dist/cjs/index.cjs.map +1 -1
  9. package/dist/cjs/logger.cjs +13 -7
  10. package/dist/cjs/logger.cjs.map +1 -1
  11. package/dist/esm/client.mjs +1 -3
  12. package/dist/esm/client.mjs.map +1 -1
  13. package/dist/esm/configFile/getConfiguration.mjs +4 -3
  14. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  15. package/dist/esm/configFile/searchConfigurationFile.mjs +1 -1
  16. package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
  17. package/dist/esm/index.mjs +2 -3
  18. package/dist/esm/index.mjs.map +1 -1
  19. package/dist/esm/logger.mjs +12 -7
  20. package/dist/esm/logger.mjs.map +1 -1
  21. package/dist/types/client.d.ts +3 -4
  22. package/dist/types/client.d.ts.map +1 -1
  23. package/dist/types/configFile/getConfiguration.d.ts +2 -2
  24. package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
  25. package/dist/types/configFile/searchConfigurationFile.d.ts +1 -1
  26. package/dist/types/configFile/searchConfigurationFile.d.ts.map +1 -1
  27. package/dist/types/index.d.ts +1 -2
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/types/logger.d.ts +8 -2
  30. package/dist/types/logger.d.ts.map +1 -1
  31. package/package.json +6 -5
  32. package/dist/cjs/appLoggerClient.cjs +0 -33
  33. package/dist/cjs/appLoggerClient.cjs.map +0 -1
  34. package/dist/cjs/appLoggerServer.cjs +0 -34
  35. package/dist/cjs/appLoggerServer.cjs.map +0 -1
  36. package/dist/esm/appLoggerClient.mjs +0 -9
  37. package/dist/esm/appLoggerClient.mjs.map +0 -1
  38. package/dist/esm/appLoggerServer.mjs +0 -10
  39. package/dist/esm/appLoggerServer.mjs.map +0 -1
  40. package/dist/types/appLoggerClient.d.ts +0 -3
  41. package/dist/types/appLoggerClient.d.ts.map +0 -1
  42. package/dist/types/appLoggerServer.d.ts +0 -3
  43. package/dist/types/appLoggerServer.d.ts.map +0 -1
@@ -19,17 +19,14 @@ 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
- appLogger: () => import_appLoggerClient.appLogger,
23
22
  logger: () => import_logger.logger
24
23
  });
25
24
  module.exports = __toCommonJS(client_exports);
26
- var import_locales = require('./types/locales.cjs');
27
25
  var import_logger = require('./logger.cjs');
28
- var import_appLoggerClient = require('./appLoggerClient.cjs');
26
+ var import_locales = require('./types/locales.cjs');
29
27
  // Annotate the CommonJS export names for ESM import in node:
30
28
  0 && (module.exports = {
31
29
  Locales,
32
- appLogger,
33
30
  logger
34
31
  });
35
32
  //# sourceMappingURL=client.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export type {\n CustomIntlayerConfig,\n PatternsContentConfig,\n IntlayerConfig,\n BaseContentConfig,\n BaseDerivedConfig,\n ResultDirDerivedConfig,\n} from './types/config';\nexport type { LocalesValues } from './types/locales';\nexport { Locales } from './types/locales';\nexport { logger } from './logger';\nexport { appLogger } from './appLoggerClient';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,qBAAwB;AACxB,oBAAuB;AACvB,6BAA0B;","names":[]}
1
+ {"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export { logger } from './logger';\nexport type {\n BaseContentConfig,\n BaseDerivedConfig,\n CustomIntlayerConfig,\n IntlayerConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n} from './types/config';\nexport { Locales } from './types/locales';\nexport type { LocalesValues } from './types/locales';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AASvB,qBAAwB;","names":[]}
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,12 +17,21 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var getConfiguration_exports = {};
20
30
  __export(getConfiguration_exports, {
21
31
  getConfiguration: () => getConfiguration
22
32
  });
23
33
  module.exports = __toCommonJS(getConfiguration_exports);
34
+ var import_deepmerge = __toESM(require("deepmerge"));
24
35
  var import_path = require("path");
25
36
  var import_logger = require('../logger.cjs');
26
37
  var import_buildConfigurationFields = require('./buildConfigurationFields.cjs');
@@ -35,7 +46,7 @@ const getConfiguration = (options) => {
35
46
  baseDir: BASE_DIR_PATH,
36
47
  ...options
37
48
  };
38
- const { baseDir, verbose, env, envFile } = mergedOptions;
49
+ const { baseDir, env, envFile } = mergedOptions;
39
50
  if (!storedConfiguration || typeof options !== "undefined") {
40
51
  const { configurationFilePath, numCustomConfiguration } = (0, import_searchConfigurationFile.searchConfigurationFile)(baseDir);
41
52
  let customConfiguration;
@@ -52,13 +63,13 @@ const getConfiguration = (options) => {
52
63
  storedConfigurationFilePath = configurationFilePath;
53
64
  storedNumCustomConfiguration = numCustomConfiguration;
54
65
  }
55
- if (verbose) {
66
+ if (options?.override?.log?.mode === "verbose") {
56
67
  logConfigFileResult(
57
68
  storedNumCustomConfiguration,
58
69
  storedConfigurationFilePath
59
70
  );
60
71
  }
61
- return storedConfiguration;
72
+ return (0, import_deepmerge.default)(storedConfiguration, options?.override ?? {});
62
73
  };
63
74
  const logConfigFileResult = (numCustomConfiguration, configurationFilePath) => {
64
75
  if (numCustomConfiguration === 0) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'path';\nimport type { LoadEnvFileOptions } from '../envVariables/loadEnvFile';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig, IntlayerConfig } from '../types/config';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nlet storedConfiguration: IntlayerConfig | undefined;\nlet storedConfigurationFilePath: string | undefined;\nlet storedNumCustomConfiguration: number | undefined;\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n verbose?: boolean;\n} & LoadEnvFileOptions;\n\n//\n\nconst BASE_DIR_PATH = process.cwd();\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => {\n const mergedOptions = {\n baseDir: BASE_DIR_PATH,\n ...options,\n };\n\n const { baseDir, verbose, env, envFile } = mergedOptions;\n\n if (!storedConfiguration || typeof options !== 'undefined') {\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n // Load the custom configuration\n let customConfiguration: CustomIntlayerConfig | undefined;\n\n if (configurationFilePath) {\n customConfiguration = loadConfigurationFile(configurationFilePath, {\n env,\n envFile,\n });\n }\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n baseDir\n );\n\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (verbose) {\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n }\n\n return storedConfiguration;\n};\n\nconst logConfigFileResult = (\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(BASE_DIR_PATH, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAyB;AAEzB,oBAAuB;AAEvB,sCAAyC;AACzC,mCAAsC;AACtC,qCAAwC;AAExC,IAAI;AACJ,IAAI;AACJ,IAAI;AASJ,MAAM,gBAAgB,QAAQ,IAAI;AAK3B,MAAM,mBAAmB,CAC9B,YACmB;AACnB,QAAM,gBAAgB;AAAA,IACpB,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,QAAM,EAAE,SAAS,SAAS,KAAK,QAAQ,IAAI;AAE3C,MAAI,CAAC,uBAAuB,OAAO,YAAY,aAAa;AAE1D,UAAM,EAAE,uBAAuB,uBAAuB,QACpD,wDAAwB,OAAO;AAGjC,QAAI;AAEJ,QAAI,uBAAuB;AACzB,gCAAsB,oDAAsB,uBAAuB;AAAA,QACjE;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAGA,8BAAsB;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AAEA,kCAA8B;AAC9B,mCAA+B;AAAA,EACjC;AAGA,MAAI,SAAS;AACX;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,sBAAsB,CAC1B,wBACA,0BACG;AACH,MAAI,2BAA2B,GAAG;AAChC,8BAAO,8DAA8D;AAAA,MACnE,WAAW;AAAA,IACb,CAAC;AAAA,EACH,OAAO;AACL,UAAM,yBAAqB,sBAAS,eAAe,qBAAsB;AAEzE,QAAI,2BAA2B,GAAG;AAChC,gCAAO,6BAA6B,kBAAkB,KAAK;AAAA,QACzD,WAAW;AAAA,MACb,CAAC;AAAA,IACH,OAAO;AACL;AAAA,QACE,6CAA6C,kBAAkB;AAAA,QAC/D;AAAA,UACE,WAAW;AAAA,QACb;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import merge from 'deepmerge';\nimport { relative } from 'path';\nimport type { LoadEnvFileOptions } from '../envVariables/loadEnvFile';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig, IntlayerConfig } from '../types/config';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nlet storedConfiguration: IntlayerConfig | undefined;\nlet storedConfigurationFilePath: string | undefined;\nlet storedNumCustomConfiguration: number | undefined;\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n} & LoadEnvFileOptions;\n\nconst BASE_DIR_PATH = process.cwd();\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => {\n const mergedOptions = {\n baseDir: BASE_DIR_PATH,\n ...options,\n };\n\n const { baseDir, env, envFile } = mergedOptions;\n\n if (!storedConfiguration || typeof options !== 'undefined') {\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n // Load the custom configuration\n let customConfiguration: CustomIntlayerConfig | undefined;\n\n if (configurationFilePath) {\n customConfiguration = loadConfigurationFile(configurationFilePath, {\n env,\n envFile,\n });\n }\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n baseDir\n );\n\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (options?.override?.log?.mode === 'verbose') {\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n }\n\n return merge(storedConfiguration, options?.override ?? {}) as IntlayerConfig;\n};\n\nconst logConfigFileResult = (\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(BASE_DIR_PATH, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkB;AAClB,kBAAyB;AAEzB,oBAAuB;AAEvB,sCAAyC;AACzC,mCAAsC;AACtC,qCAAwC;AAExC,IAAI;AACJ,IAAI;AACJ,IAAI;AAOJ,MAAM,gBAAgB,QAAQ,IAAI;AAK3B,MAAM,mBAAmB,CAC9B,YACmB;AACnB,QAAM,gBAAgB;AAAA,IACpB,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,QAAM,EAAE,SAAS,KAAK,QAAQ,IAAI;AAElC,MAAI,CAAC,uBAAuB,OAAO,YAAY,aAAa;AAE1D,UAAM,EAAE,uBAAuB,uBAAuB,QACpD,wDAAwB,OAAO;AAGjC,QAAI;AAEJ,QAAI,uBAAuB;AACzB,gCAAsB,oDAAsB,uBAAuB;AAAA,QACjE;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAGA,8BAAsB;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AAEA,kCAA8B;AAC9B,mCAA+B;AAAA,EACjC;AAGA,MAAI,SAAS,UAAU,KAAK,SAAS,WAAW;AAC9C;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,aAAO,iBAAAA,SAAM,qBAAqB,SAAS,YAAY,CAAC,CAAC;AAC3D;AAEA,MAAM,sBAAsB,CAC1B,wBACA,0BACG;AACH,MAAI,2BAA2B,GAAG;AAChC,8BAAO,8DAA8D;AAAA,MACnE,WAAW;AAAA,IACb,CAAC;AAAA,EACH,OAAO;AACL,UAAM,yBAAqB,sBAAS,eAAe,qBAAsB;AAEzE,QAAI,2BAA2B,GAAG;AAChC,gCAAO,6BAA6B,kBAAkB,KAAK;AAAA,QACzD,WAAW;AAAA,MACb,CAAC;AAAA,IACH,OAAO;AACL;AAAA,QACE,6CAA6C,kBAAkB;AAAA,QAC/D;AAAA,UACE,WAAW;AAAA,QACb;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["merge"]}
@@ -31,7 +31,7 @@ const intLayerConfigFiles = EXTENSION.filter(
31
31
  (extension) => extension !== ""
32
32
  ).map((ext) => `${CONFIGURATION_FILE_NAME_1}.${ext}`);
33
33
  const configurationFiles = [...intLayerConfigFiles, CONFIGURATION_FILE_NAME_2];
34
- const searchConfigurationFile = (configFilePath) => {
34
+ const searchConfigurationFile = (configFilePath = process.cwd()) => {
35
35
  let configurationFilePath = void 0;
36
36
  let numCustomConfiguration = 0;
37
37
  for (const fileName of configurationFiles) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { resolve } from 'path';\nimport { logger } from '../logger';\n\nconst EXTENSION = ['ts', 'js', 'json', 'cjs', 'mjs', ''];\nconst CONFIGURATION_FILE_NAME_1 = 'intlayer.config';\nconst CONFIGURATION_FILE_NAME_2 = '.intlayerrc';\n\nconst intLayerConfigFiles = EXTENSION.filter(\n (extension) => extension !== ''\n).map((ext) => `${CONFIGURATION_FILE_NAME_1}.${ext}`);\n\nconst configurationFiles = [...intLayerConfigFiles, CONFIGURATION_FILE_NAME_2];\n\ntype SearchConfigurationFileResult = {\n configurationFilePath?: string;\n numCustomConfiguration: number;\n};\n\n/**\n * Search for the configuration file in the given path\n *\n * List of detected configuration files:\n * - intlayer.config.ts\n * - intlayer.config.js\n * - intlayer.config.json\n * - intlayer.config.cjs\n * - intlayer.config.mjs\n * - .intlayerrc\n */\nexport const searchConfigurationFile = (\n configFilePath: string\n): SearchConfigurationFileResult => {\n let configurationFilePath: string | undefined = undefined;\n let numCustomConfiguration = 0;\n\n for (const fileName of configurationFiles) {\n try {\n const filePath = resolve(configFilePath, fileName);\n\n // Check if the file exists\n if (!existsSync(filePath)) {\n continue;\n } else {\n numCustomConfiguration += 1;\n\n if (!configurationFilePath) {\n configurationFilePath = filePath;\n }\n }\n } catch (error) {\n // Return \"Cannot use import statement outside a module\"\n logger(`${fileName}: ${error as string}`, { level: 'error' });\n\n continue;\n }\n }\n\n return { configurationFilePath, numCustomConfiguration };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,kBAAwB;AACxB,oBAAuB;AAEvB,MAAM,YAAY,CAAC,MAAM,MAAM,QAAQ,OAAO,OAAO,EAAE;AACvD,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAElC,MAAM,sBAAsB,UAAU;AAAA,EACpC,CAAC,cAAc,cAAc;AAC/B,EAAE,IAAI,CAAC,QAAQ,GAAG,yBAAyB,IAAI,GAAG,EAAE;AAEpD,MAAM,qBAAqB,CAAC,GAAG,qBAAqB,yBAAyB;AAkBtE,MAAM,0BAA0B,CACrC,mBACkC;AAClC,MAAI,wBAA4C;AAChD,MAAI,yBAAyB;AAE7B,aAAW,YAAY,oBAAoB;AACzC,QAAI;AACF,YAAM,eAAW,qBAAQ,gBAAgB,QAAQ;AAGjD,UAAI,KAAC,sBAAW,QAAQ,GAAG;AACzB;AAAA,MACF,OAAO;AACL,kCAA0B;AAE1B,YAAI,CAAC,uBAAuB;AAC1B,kCAAwB;AAAA,QAC1B;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AAEd,gCAAO,GAAG,QAAQ,KAAK,KAAe,IAAI,EAAE,OAAO,QAAQ,CAAC;AAE5D;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,uBAAuB,uBAAuB;AACzD;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { resolve } from 'path';\nimport { logger } from '../logger';\n\nconst EXTENSION = ['ts', 'js', 'json', 'cjs', 'mjs', ''];\nconst CONFIGURATION_FILE_NAME_1 = 'intlayer.config';\nconst CONFIGURATION_FILE_NAME_2 = '.intlayerrc';\n\nconst intLayerConfigFiles = EXTENSION.filter(\n (extension) => extension !== ''\n).map((ext) => `${CONFIGURATION_FILE_NAME_1}.${ext}`);\n\nconst configurationFiles = [...intLayerConfigFiles, CONFIGURATION_FILE_NAME_2];\n\ntype SearchConfigurationFileResult = {\n configurationFilePath?: string;\n numCustomConfiguration: number;\n};\n\n/**\n * Search for the configuration file in the given path\n *\n * List of detected configuration files:\n * - intlayer.config.ts\n * - intlayer.config.js\n * - intlayer.config.json\n * - intlayer.config.cjs\n * - intlayer.config.mjs\n * - .intlayerrc\n */\nexport const searchConfigurationFile = (\n configFilePath: string = process.cwd()\n): SearchConfigurationFileResult => {\n let configurationFilePath: string | undefined = undefined;\n let numCustomConfiguration = 0;\n\n for (const fileName of configurationFiles) {\n try {\n const filePath = resolve(configFilePath, fileName);\n\n // Check if the file exists\n if (!existsSync(filePath)) {\n continue;\n } else {\n numCustomConfiguration += 1;\n\n if (!configurationFilePath) {\n configurationFilePath = filePath;\n }\n }\n } catch (error) {\n // Return \"Cannot use import statement outside a module\"\n logger(`${fileName}: ${error as string}`, { level: 'error' });\n\n continue;\n }\n }\n\n return { configurationFilePath, numCustomConfiguration };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,kBAAwB;AACxB,oBAAuB;AAEvB,MAAM,YAAY,CAAC,MAAM,MAAM,QAAQ,OAAO,OAAO,EAAE;AACvD,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAElC,MAAM,sBAAsB,UAAU;AAAA,EACpC,CAAC,cAAc,cAAc;AAC/B,EAAE,IAAI,CAAC,QAAQ,GAAG,yBAAyB,IAAI,GAAG,EAAE;AAEpD,MAAM,qBAAqB,CAAC,GAAG,qBAAqB,yBAAyB;AAkBtE,MAAM,0BAA0B,CACrC,iBAAyB,QAAQ,IAAI,MACH;AAClC,MAAI,wBAA4C;AAChD,MAAI,yBAAyB;AAE7B,aAAW,YAAY,oBAAoB;AACzC,QAAI;AACF,YAAM,eAAW,qBAAQ,gBAAgB,QAAQ;AAGjD,UAAI,KAAC,sBAAW,QAAQ,GAAG;AACzB;AAAA,MACF,OAAO;AACL,kCAA0B;AAE1B,YAAI,CAAC,uBAAuB;AAC1B,kCAAwB;AAAA,QAC1B;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AAEd,gCAAO,GAAG,QAAQ,KAAK,KAAe,IAAI,EAAE,OAAO,QAAQ,CAAC;AAE5D;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,uBAAuB,uBAAuB;AACzD;","names":[]}
@@ -20,8 +20,8 @@ var index_exports = {};
20
20
  __export(index_exports, {
21
21
  ESMxCJSRequire: () => import_ESMxCJSRequire.ESMxCJSRequire,
22
22
  Locales: () => import_locales.Locales,
23
- appLogger: () => import_appLoggerServer.appLogger,
24
23
  formatEnvVariable: () => import_envVariables.formatEnvVariable,
24
+ getAppLogger: () => import_logger.getAppLogger,
25
25
  getClientConfiguration: () => import_envVariables.getConfiguration,
26
26
  getConfiguration: () => import_getConfiguration.getConfiguration,
27
27
  getEnvFilePath: () => import_envVariables.getEnvFilePath,
@@ -33,7 +33,6 @@ __export(index_exports, {
33
33
  retryManager: () => import_retryManager.retryManager
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
- var import_appLoggerServer = require('./appLoggerServer.cjs');
37
36
  var import_getConfiguration = require('./configFile/getConfiguration.cjs');
38
37
  var import_envVariables = require('./envVariables/index.cjs');
39
38
  var import_getSandboxContext = require('./getSandboxContext.cjs');
@@ -46,8 +45,8 @@ var import_ESMxCJSRequire = require('./utils/ESMxCJSRequire.cjs');
46
45
  0 && (module.exports = {
47
46
  ESMxCJSRequire,
48
47
  Locales,
49
- appLogger,
50
48
  formatEnvVariable,
49
+ getAppLogger,
51
50
  getClientConfiguration,
52
51
  getConfiguration,
53
52
  getEnvFilePath,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { appLogger } from './appLoggerServer';\nexport {\n getConfiguration,\n type GetConfigurationOptions,\n} from './configFile/getConfiguration';\nexport {\n formatEnvVariable,\n getConfiguration as getClientConfiguration,\n getEnvFilePath,\n getPlatform,\n loadEnvFile,\n} from './envVariables/index';\nexport { getSandBoxContext } from './getSandboxContext';\nexport { loadExternalFile } from './loadExternalFile';\nexport { logger } from './logger';\nexport { retryManager } from './retryManager';\nexport type {\n BaseContentConfig,\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n MiddlewareConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n ServerSetCookieRule,\n StrictMode,\n} from './types/config';\nexport { Locales } from './types/locales';\nexport type { LocalesValues } from './types/locales';\nexport { ESMxCJSRequire } from './utils/ESMxCJSRequire';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA0B;AAC1B,8BAGO;AACP,0BAMO;AACP,+BAAkC;AAClC,8BAAiC;AACjC,oBAAuB;AACvB,0BAA6B;AAe7B,qBAAwB;AAExB,4BAA+B;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n getConfiguration,\n type GetConfigurationOptions,\n} from './configFile/getConfiguration';\nexport {\n formatEnvVariable,\n getConfiguration as getClientConfiguration,\n getEnvFilePath,\n getPlatform,\n loadEnvFile,\n} from './envVariables/index';\nexport { getSandBoxContext } from './getSandboxContext';\nexport { loadExternalFile } from './loadExternalFile';\nexport { getAppLogger, logger, type Logger } from './logger';\nexport { retryManager } from './retryManager';\nexport type {\n BaseContentConfig,\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n MiddlewareConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n ServerSetCookieRule,\n StrictMode,\n} from './types/config';\nexport { Locales } from './types/locales';\nexport type { LocalesValues } from './types/locales';\nexport { ESMxCJSRequire } from './utils/ESMxCJSRequire';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAGO;AACP,0BAMO;AACP,+BAAkC;AAClC,8BAAiC;AACjC,oBAAkD;AAClD,0BAA6B;AAe7B,qBAAwB;AAExB,4BAA+B;","names":[]}
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var logger_exports = {};
20
20
  __export(logger_exports, {
21
+ getAppLogger: () => getAppLogger,
21
22
  logger: () => logger
22
23
  });
23
24
  module.exports = __toCommonJS(logger_exports);
@@ -27,26 +28,31 @@ const logger = (content, details = {
27
28
  config: { mode: "default", prefix: "" }
28
29
  }) => {
29
30
  const mode = details.config?.mode ?? "default";
30
- const prefix = details.config?.prefix ?? "";
31
+ const prefix = Boolean(details.config?.prefix) ? details.config?.prefix : void 0;
31
32
  if (mode === "disabled") return;
32
33
  if (details.isVerbose && mode !== "verbose") return;
33
- const flatContent = [content].flat();
34
+ const flatContent = prefix ? [prefix, ...[content].flat()] : [content].flat();
34
35
  if (details.level === "debug") {
35
- return console.debug(prefix, ...flatContent);
36
+ return console.debug(...flatContent);
36
37
  }
37
38
  if (details.level === "info") {
38
- return console.info(prefix, ...flatContent);
39
+ return console.info(...flatContent);
39
40
  }
40
41
  if (details.level === "warn") {
41
- return console.warn(prefix, ...flatContent);
42
+ return console.warn(...flatContent);
42
43
  }
43
44
  if (details.level === "error") {
44
- return console.error(prefix, ...flatContent);
45
+ return console.error(...flatContent);
45
46
  }
46
- console.log(prefix, ...flatContent);
47
+ console.log(...flatContent);
47
48
  };
49
+ const getAppLogger = (configuration) => (content, details) => logger(content, {
50
+ ...details ?? {},
51
+ config: { ...configuration?.log, ...details?.config ?? {} }
52
+ });
48
53
  // Annotate the CommonJS export names for ESM import in node:
49
54
  0 && (module.exports = {
55
+ getAppLogger,
50
56
  logger
51
57
  });
52
58
  //# sourceMappingURL=logger.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/logger.ts"],"sourcesContent":["import type { IntlayerConfig } from './types/config';\n\nexport type Details = {\n isVerbose?: boolean;\n level?: 'info' | 'warn' | 'error' | 'debug';\n config?: Partial<IntlayerConfig['log']>;\n};\n\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 = details.config?.mode ?? 'default';\n const prefix = details.config?.prefix ?? '';\n\n if (mode === 'disabled') return;\n\n if (details.isVerbose && mode !== 'verbose') return;\n\n const flatContent = [content].flat();\n\n if (details.level === 'debug') {\n return console.debug(prefix, ...flatContent);\n }\n\n if (details.level === 'info') {\n return console.info(prefix, ...flatContent);\n }\n\n if (details.level === 'warn') {\n return console.warn(prefix, ...flatContent);\n }\n\n if (details.level === 'error') {\n return console.error(prefix, ...flatContent);\n }\n\n console.log(prefix, ...flatContent);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,SAAiB,CAC5B,SACA,UAAU;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,QAAQ,EAAE,MAAM,WAAW,QAAQ,GAAG;AACxC,MACG;AACH,QAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,QAAM,SAAS,QAAQ,QAAQ,UAAU;AAEzC,MAAI,SAAS,WAAY;AAEzB,MAAI,QAAQ,aAAa,SAAS,UAAW;AAE7C,QAAM,cAAc,CAAC,OAAO,EAAE,KAAK;AAEnC,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,QAAQ,GAAG,WAAW;AAAA,EAC7C;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,QAAQ,GAAG,WAAW;AAAA,EAC5C;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,QAAQ,GAAG,WAAW;AAAA,EAC5C;AAEA,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,QAAQ,GAAG,WAAW;AAAA,EAC7C;AAEA,UAAQ,IAAI,QAAQ,GAAG,WAAW;AACpC;","names":[]}
1
+ {"version":3,"sources":["../../src/logger.ts"],"sourcesContent":["import type { CustomIntlayerConfig } from './types/config';\n\nexport type Details = {\n isVerbose?: boolean;\n level?: 'info' | 'warn' | 'error' | 'debug';\n config?: CustomIntlayerConfig['log'];\n};\n\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 = details.config?.mode ?? 'default';\n const prefix = Boolean(details.config?.prefix)\n ? details.config?.prefix\n : undefined;\n\n if (mode === 'disabled') return;\n\n if (details.isVerbose && mode !== 'verbose') return;\n\n const flatContent = prefix ? [prefix, ...[content].flat()] : [content].flat();\n\n if (details.level === 'debug') {\n return console.debug(...flatContent);\n }\n\n if (details.level === 'info') {\n return console.info(...flatContent);\n }\n\n if (details.level === 'warn') {\n return console.warn(...flatContent);\n }\n\n if (details.level === 'error') {\n return console.error(...flatContent);\n }\n\n console.log(...flatContent);\n};\n\n/**\n * The appLogger function takes the logger and merges it with the configuration from the intlayer config file.\n * It allows overriding the default configuration by passing a config object in the details parameter.\n * The configuration is merged with the default configuration from the intlayer config file.\n */\nexport const getAppLogger =\n (configuration?: CustomIntlayerConfig) => (content: any, details?: Details) =>\n logger(content, {\n ...(details ?? {}),\n config: { ...configuration?.log, ...(details?.config ?? {}) },\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,SAAiB,CAC5B,SACA,UAAU;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,QAAQ,EAAE,MAAM,WAAW,QAAQ,GAAG;AACxC,MACG;AACH,QAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,QAAM,SAAS,QAAQ,QAAQ,QAAQ,MAAM,IACzC,QAAQ,QAAQ,SAChB;AAEJ,MAAI,SAAS,WAAY;AAEzB,MAAI,QAAQ,aAAa,SAAS,UAAW;AAE7C,QAAM,cAAc,SAAS,CAAC,QAAQ,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK;AAE5E,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,GAAG,WAAW;AAAA,EACrC;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,GAAG,WAAW;AAAA,EACpC;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,GAAG,WAAW;AAAA,EACpC;AAEA,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,GAAG,WAAW;AAAA,EACrC;AAEA,UAAQ,IAAI,GAAG,WAAW;AAC5B;AAOO,MAAM,eACX,CAAC,kBAAyC,CAAC,SAAc,YACvD,OAAO,SAAS;AAAA,EACd,GAAI,WAAW,CAAC;AAAA,EAChB,QAAQ,EAAE,GAAG,eAAe,KAAK,GAAI,SAAS,UAAU,CAAC,EAAG;AAC9D,CAAC;","names":[]}
@@ -1,9 +1,7 @@
1
- import { Locales } from "./types/locales.mjs";
2
1
  import { logger } from "./logger.mjs";
3
- import { appLogger } from "./appLoggerClient.mjs";
2
+ import { Locales } from "./types/locales.mjs";
4
3
  export {
5
4
  Locales,
6
- appLogger,
7
5
  logger
8
6
  };
9
7
  //# sourceMappingURL=client.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export type {\n CustomIntlayerConfig,\n PatternsContentConfig,\n IntlayerConfig,\n BaseContentConfig,\n BaseDerivedConfig,\n ResultDirDerivedConfig,\n} from './types/config';\nexport type { LocalesValues } from './types/locales';\nexport { Locales } from './types/locales';\nexport { logger } from './logger';\nexport { appLogger } from './appLoggerClient';\n"],"mappings":"AASA,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,iBAAiB;","names":[]}
1
+ {"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export { logger } from './logger';\nexport type {\n BaseContentConfig,\n BaseDerivedConfig,\n CustomIntlayerConfig,\n IntlayerConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n} from './types/config';\nexport { Locales } from './types/locales';\nexport type { LocalesValues } from './types/locales';\n"],"mappings":"AAAA,SAAS,cAAc;AASvB,SAAS,eAAe;","names":[]}
@@ -1,3 +1,4 @@
1
+ import merge from "deepmerge";
1
2
  import { relative } from "path";
2
3
  import { logger } from "../logger.mjs";
3
4
  import { buildConfigurationFields } from "./buildConfigurationFields.mjs";
@@ -12,7 +13,7 @@ const getConfiguration = (options) => {
12
13
  baseDir: BASE_DIR_PATH,
13
14
  ...options
14
15
  };
15
- const { baseDir, verbose, env, envFile } = mergedOptions;
16
+ const { baseDir, env, envFile } = mergedOptions;
16
17
  if (!storedConfiguration || typeof options !== "undefined") {
17
18
  const { configurationFilePath, numCustomConfiguration } = searchConfigurationFile(baseDir);
18
19
  let customConfiguration;
@@ -29,13 +30,13 @@ const getConfiguration = (options) => {
29
30
  storedConfigurationFilePath = configurationFilePath;
30
31
  storedNumCustomConfiguration = numCustomConfiguration;
31
32
  }
32
- if (verbose) {
33
+ if (options?.override?.log?.mode === "verbose") {
33
34
  logConfigFileResult(
34
35
  storedNumCustomConfiguration,
35
36
  storedConfigurationFilePath
36
37
  );
37
38
  }
38
- return storedConfiguration;
39
+ return merge(storedConfiguration, options?.override ?? {});
39
40
  };
40
41
  const logConfigFileResult = (numCustomConfiguration, configurationFilePath) => {
41
42
  if (numCustomConfiguration === 0) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'path';\nimport type { LoadEnvFileOptions } from '../envVariables/loadEnvFile';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig, IntlayerConfig } from '../types/config';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nlet storedConfiguration: IntlayerConfig | undefined;\nlet storedConfigurationFilePath: string | undefined;\nlet storedNumCustomConfiguration: number | undefined;\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n verbose?: boolean;\n} & LoadEnvFileOptions;\n\n//\n\nconst BASE_DIR_PATH = process.cwd();\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => {\n const mergedOptions = {\n baseDir: BASE_DIR_PATH,\n ...options,\n };\n\n const { baseDir, verbose, env, envFile } = mergedOptions;\n\n if (!storedConfiguration || typeof options !== 'undefined') {\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n // Load the custom configuration\n let customConfiguration: CustomIntlayerConfig | undefined;\n\n if (configurationFilePath) {\n customConfiguration = loadConfigurationFile(configurationFilePath, {\n env,\n envFile,\n });\n }\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n baseDir\n );\n\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (verbose) {\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n }\n\n return storedConfiguration;\n};\n\nconst logConfigFileResult = (\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(BASE_DIR_PATH, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,SAAS,cAAc;AAEvB,SAAS,gCAAgC;AACzC,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AAExC,IAAI;AACJ,IAAI;AACJ,IAAI;AASJ,MAAM,gBAAgB,QAAQ,IAAI;AAK3B,MAAM,mBAAmB,CAC9B,YACmB;AACnB,QAAM,gBAAgB;AAAA,IACpB,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,QAAM,EAAE,SAAS,SAAS,KAAK,QAAQ,IAAI;AAE3C,MAAI,CAAC,uBAAuB,OAAO,YAAY,aAAa;AAE1D,UAAM,EAAE,uBAAuB,uBAAuB,IACpD,wBAAwB,OAAO;AAGjC,QAAI;AAEJ,QAAI,uBAAuB;AACzB,4BAAsB,sBAAsB,uBAAuB;AAAA,QACjE;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAGA,0BAAsB;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AAEA,kCAA8B;AAC9B,mCAA+B;AAAA,EACjC;AAGA,MAAI,SAAS;AACX;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,sBAAsB,CAC1B,wBACA,0BACG;AACH,MAAI,2BAA2B,GAAG;AAChC,WAAO,8DAA8D;AAAA,MACnE,WAAW;AAAA,IACb,CAAC;AAAA,EACH,OAAO;AACL,UAAM,qBAAqB,SAAS,eAAe,qBAAsB;AAEzE,QAAI,2BAA2B,GAAG;AAChC,aAAO,6BAA6B,kBAAkB,KAAK;AAAA,QACzD,WAAW;AAAA,MACb,CAAC;AAAA,IACH,OAAO;AACL;AAAA,QACE,6CAA6C,kBAAkB;AAAA,QAC/D;AAAA,UACE,WAAW;AAAA,QACb;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import merge from 'deepmerge';\nimport { relative } from 'path';\nimport type { LoadEnvFileOptions } from '../envVariables/loadEnvFile';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig, IntlayerConfig } from '../types/config';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nlet storedConfiguration: IntlayerConfig | undefined;\nlet storedConfigurationFilePath: string | undefined;\nlet storedNumCustomConfiguration: number | undefined;\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n} & LoadEnvFileOptions;\n\nconst BASE_DIR_PATH = process.cwd();\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => {\n const mergedOptions = {\n baseDir: BASE_DIR_PATH,\n ...options,\n };\n\n const { baseDir, env, envFile } = mergedOptions;\n\n if (!storedConfiguration || typeof options !== 'undefined') {\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n // Load the custom configuration\n let customConfiguration: CustomIntlayerConfig | undefined;\n\n if (configurationFilePath) {\n customConfiguration = loadConfigurationFile(configurationFilePath, {\n env,\n envFile,\n });\n }\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n baseDir\n );\n\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (options?.override?.log?.mode === 'verbose') {\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n }\n\n return merge(storedConfiguration, options?.override ?? {}) as IntlayerConfig;\n};\n\nconst logConfigFileResult = (\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(BASE_DIR_PATH, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,gBAAgB;AAEzB,SAAS,cAAc;AAEvB,SAAS,gCAAgC;AACzC,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AAExC,IAAI;AACJ,IAAI;AACJ,IAAI;AAOJ,MAAM,gBAAgB,QAAQ,IAAI;AAK3B,MAAM,mBAAmB,CAC9B,YACmB;AACnB,QAAM,gBAAgB;AAAA,IACpB,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,QAAM,EAAE,SAAS,KAAK,QAAQ,IAAI;AAElC,MAAI,CAAC,uBAAuB,OAAO,YAAY,aAAa;AAE1D,UAAM,EAAE,uBAAuB,uBAAuB,IACpD,wBAAwB,OAAO;AAGjC,QAAI;AAEJ,QAAI,uBAAuB;AACzB,4BAAsB,sBAAsB,uBAAuB;AAAA,QACjE;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAGA,0BAAsB;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AAEA,kCAA8B;AAC9B,mCAA+B;AAAA,EACjC;AAGA,MAAI,SAAS,UAAU,KAAK,SAAS,WAAW;AAC9C;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,MAAM,qBAAqB,SAAS,YAAY,CAAC,CAAC;AAC3D;AAEA,MAAM,sBAAsB,CAC1B,wBACA,0BACG;AACH,MAAI,2BAA2B,GAAG;AAChC,WAAO,8DAA8D;AAAA,MACnE,WAAW;AAAA,IACb,CAAC;AAAA,EACH,OAAO;AACL,UAAM,qBAAqB,SAAS,eAAe,qBAAsB;AAEzE,QAAI,2BAA2B,GAAG;AAChC,aAAO,6BAA6B,kBAAkB,KAAK;AAAA,QACzD,WAAW;AAAA,MACb,CAAC;AAAA,IACH,OAAO;AACL;AAAA,QACE,6CAA6C,kBAAkB;AAAA,QAC/D;AAAA,UACE,WAAW;AAAA,QACb;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -8,7 +8,7 @@ const intLayerConfigFiles = EXTENSION.filter(
8
8
  (extension) => extension !== ""
9
9
  ).map((ext) => `${CONFIGURATION_FILE_NAME_1}.${ext}`);
10
10
  const configurationFiles = [...intLayerConfigFiles, CONFIGURATION_FILE_NAME_2];
11
- const searchConfigurationFile = (configFilePath) => {
11
+ const searchConfigurationFile = (configFilePath = process.cwd()) => {
12
12
  let configurationFilePath = void 0;
13
13
  let numCustomConfiguration = 0;
14
14
  for (const fileName of configurationFiles) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { resolve } from 'path';\nimport { logger } from '../logger';\n\nconst EXTENSION = ['ts', 'js', 'json', 'cjs', 'mjs', ''];\nconst CONFIGURATION_FILE_NAME_1 = 'intlayer.config';\nconst CONFIGURATION_FILE_NAME_2 = '.intlayerrc';\n\nconst intLayerConfigFiles = EXTENSION.filter(\n (extension) => extension !== ''\n).map((ext) => `${CONFIGURATION_FILE_NAME_1}.${ext}`);\n\nconst configurationFiles = [...intLayerConfigFiles, CONFIGURATION_FILE_NAME_2];\n\ntype SearchConfigurationFileResult = {\n configurationFilePath?: string;\n numCustomConfiguration: number;\n};\n\n/**\n * Search for the configuration file in the given path\n *\n * List of detected configuration files:\n * - intlayer.config.ts\n * - intlayer.config.js\n * - intlayer.config.json\n * - intlayer.config.cjs\n * - intlayer.config.mjs\n * - .intlayerrc\n */\nexport const searchConfigurationFile = (\n configFilePath: string\n): SearchConfigurationFileResult => {\n let configurationFilePath: string | undefined = undefined;\n let numCustomConfiguration = 0;\n\n for (const fileName of configurationFiles) {\n try {\n const filePath = resolve(configFilePath, fileName);\n\n // Check if the file exists\n if (!existsSync(filePath)) {\n continue;\n } else {\n numCustomConfiguration += 1;\n\n if (!configurationFilePath) {\n configurationFilePath = filePath;\n }\n }\n } catch (error) {\n // Return \"Cannot use import statement outside a module\"\n logger(`${fileName}: ${error as string}`, { level: 'error' });\n\n continue;\n }\n }\n\n return { configurationFilePath, numCustomConfiguration };\n};\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,cAAc;AAEvB,MAAM,YAAY,CAAC,MAAM,MAAM,QAAQ,OAAO,OAAO,EAAE;AACvD,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAElC,MAAM,sBAAsB,UAAU;AAAA,EACpC,CAAC,cAAc,cAAc;AAC/B,EAAE,IAAI,CAAC,QAAQ,GAAG,yBAAyB,IAAI,GAAG,EAAE;AAEpD,MAAM,qBAAqB,CAAC,GAAG,qBAAqB,yBAAyB;AAkBtE,MAAM,0BAA0B,CACrC,mBACkC;AAClC,MAAI,wBAA4C;AAChD,MAAI,yBAAyB;AAE7B,aAAW,YAAY,oBAAoB;AACzC,QAAI;AACF,YAAM,WAAW,QAAQ,gBAAgB,QAAQ;AAGjD,UAAI,CAAC,WAAW,QAAQ,GAAG;AACzB;AAAA,MACF,OAAO;AACL,kCAA0B;AAE1B,YAAI,CAAC,uBAAuB;AAC1B,kCAAwB;AAAA,QAC1B;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AAEd,aAAO,GAAG,QAAQ,KAAK,KAAe,IAAI,EAAE,OAAO,QAAQ,CAAC;AAE5D;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,uBAAuB,uBAAuB;AACzD;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { resolve } from 'path';\nimport { logger } from '../logger';\n\nconst EXTENSION = ['ts', 'js', 'json', 'cjs', 'mjs', ''];\nconst CONFIGURATION_FILE_NAME_1 = 'intlayer.config';\nconst CONFIGURATION_FILE_NAME_2 = '.intlayerrc';\n\nconst intLayerConfigFiles = EXTENSION.filter(\n (extension) => extension !== ''\n).map((ext) => `${CONFIGURATION_FILE_NAME_1}.${ext}`);\n\nconst configurationFiles = [...intLayerConfigFiles, CONFIGURATION_FILE_NAME_2];\n\ntype SearchConfigurationFileResult = {\n configurationFilePath?: string;\n numCustomConfiguration: number;\n};\n\n/**\n * Search for the configuration file in the given path\n *\n * List of detected configuration files:\n * - intlayer.config.ts\n * - intlayer.config.js\n * - intlayer.config.json\n * - intlayer.config.cjs\n * - intlayer.config.mjs\n * - .intlayerrc\n */\nexport const searchConfigurationFile = (\n configFilePath: string = process.cwd()\n): SearchConfigurationFileResult => {\n let configurationFilePath: string | undefined = undefined;\n let numCustomConfiguration = 0;\n\n for (const fileName of configurationFiles) {\n try {\n const filePath = resolve(configFilePath, fileName);\n\n // Check if the file exists\n if (!existsSync(filePath)) {\n continue;\n } else {\n numCustomConfiguration += 1;\n\n if (!configurationFilePath) {\n configurationFilePath = filePath;\n }\n }\n } catch (error) {\n // Return \"Cannot use import statement outside a module\"\n logger(`${fileName}: ${error as string}`, { level: 'error' });\n\n continue;\n }\n }\n\n return { configurationFilePath, numCustomConfiguration };\n};\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,cAAc;AAEvB,MAAM,YAAY,CAAC,MAAM,MAAM,QAAQ,OAAO,OAAO,EAAE;AACvD,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAElC,MAAM,sBAAsB,UAAU;AAAA,EACpC,CAAC,cAAc,cAAc;AAC/B,EAAE,IAAI,CAAC,QAAQ,GAAG,yBAAyB,IAAI,GAAG,EAAE;AAEpD,MAAM,qBAAqB,CAAC,GAAG,qBAAqB,yBAAyB;AAkBtE,MAAM,0BAA0B,CACrC,iBAAyB,QAAQ,IAAI,MACH;AAClC,MAAI,wBAA4C;AAChD,MAAI,yBAAyB;AAE7B,aAAW,YAAY,oBAAoB;AACzC,QAAI;AACF,YAAM,WAAW,QAAQ,gBAAgB,QAAQ;AAGjD,UAAI,CAAC,WAAW,QAAQ,GAAG;AACzB;AAAA,MACF,OAAO;AACL,kCAA0B;AAE1B,YAAI,CAAC,uBAAuB;AAC1B,kCAAwB;AAAA,QAC1B;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AAEd,aAAO,GAAG,QAAQ,KAAK,KAAe,IAAI,EAAE,OAAO,QAAQ,CAAC;AAE5D;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,uBAAuB,uBAAuB;AACzD;","names":[]}
@@ -1,4 +1,3 @@
1
- import { appLogger } from "./appLoggerServer.mjs";
2
1
  import {
3
2
  getConfiguration
4
3
  } from "./configFile/getConfiguration.mjs";
@@ -11,15 +10,15 @@ import {
11
10
  } from "./envVariables/index.mjs";
12
11
  import { getSandBoxContext } from "./getSandboxContext.mjs";
13
12
  import { loadExternalFile } from "./loadExternalFile.mjs";
14
- import { logger } from "./logger.mjs";
13
+ import { getAppLogger, logger } from "./logger.mjs";
15
14
  import { retryManager } from "./retryManager.mjs";
16
15
  import { Locales } from "./types/locales.mjs";
17
16
  import { ESMxCJSRequire } from "./utils/ESMxCJSRequire.mjs";
18
17
  export {
19
18
  ESMxCJSRequire,
20
19
  Locales,
21
- appLogger,
22
20
  formatEnvVariable,
21
+ getAppLogger,
23
22
  getConfiguration2 as getClientConfiguration,
24
23
  getConfiguration,
25
24
  getEnvFilePath,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { appLogger } from './appLoggerServer';\nexport {\n getConfiguration,\n type GetConfigurationOptions,\n} from './configFile/getConfiguration';\nexport {\n formatEnvVariable,\n getConfiguration as getClientConfiguration,\n getEnvFilePath,\n getPlatform,\n loadEnvFile,\n} from './envVariables/index';\nexport { getSandBoxContext } from './getSandboxContext';\nexport { loadExternalFile } from './loadExternalFile';\nexport { logger } from './logger';\nexport { retryManager } from './retryManager';\nexport type {\n BaseContentConfig,\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n MiddlewareConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n ServerSetCookieRule,\n StrictMode,\n} from './types/config';\nexport { Locales } from './types/locales';\nexport type { LocalesValues } from './types/locales';\nexport { ESMxCJSRequire } from './utils/ESMxCJSRequire';\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACoB,oBAApBA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAe7B,SAAS,eAAe;AAExB,SAAS,sBAAsB;","names":["getConfiguration"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n getConfiguration,\n type GetConfigurationOptions,\n} from './configFile/getConfiguration';\nexport {\n formatEnvVariable,\n getConfiguration as getClientConfiguration,\n getEnvFilePath,\n getPlatform,\n loadEnvFile,\n} from './envVariables/index';\nexport { getSandBoxContext } from './getSandboxContext';\nexport { loadExternalFile } from './loadExternalFile';\nexport { getAppLogger, logger, type Logger } from './logger';\nexport { retryManager } from './retryManager';\nexport type {\n BaseContentConfig,\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n MiddlewareConfig,\n PatternsContentConfig,\n ResultDirDerivedConfig,\n ServerSetCookieRule,\n StrictMode,\n} from './types/config';\nexport { Locales } from './types/locales';\nexport type { LocalesValues } from './types/locales';\nexport { ESMxCJSRequire } from './utils/ESMxCJSRequire';\n"],"mappings":"AAAA;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACoB,oBAApBA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,cAAc,cAA2B;AAClD,SAAS,oBAAoB;AAe7B,SAAS,eAAe;AAExB,SAAS,sBAAsB;","names":["getConfiguration"]}
@@ -4,25 +4,30 @@ const logger = (content, details = {
4
4
  config: { mode: "default", prefix: "" }
5
5
  }) => {
6
6
  const mode = details.config?.mode ?? "default";
7
- const prefix = details.config?.prefix ?? "";
7
+ const prefix = Boolean(details.config?.prefix) ? details.config?.prefix : void 0;
8
8
  if (mode === "disabled") return;
9
9
  if (details.isVerbose && mode !== "verbose") return;
10
- const flatContent = [content].flat();
10
+ const flatContent = prefix ? [prefix, ...[content].flat()] : [content].flat();
11
11
  if (details.level === "debug") {
12
- return console.debug(prefix, ...flatContent);
12
+ return console.debug(...flatContent);
13
13
  }
14
14
  if (details.level === "info") {
15
- return console.info(prefix, ...flatContent);
15
+ return console.info(...flatContent);
16
16
  }
17
17
  if (details.level === "warn") {
18
- return console.warn(prefix, ...flatContent);
18
+ return console.warn(...flatContent);
19
19
  }
20
20
  if (details.level === "error") {
21
- return console.error(prefix, ...flatContent);
21
+ return console.error(...flatContent);
22
22
  }
23
- console.log(prefix, ...flatContent);
23
+ console.log(...flatContent);
24
24
  };
25
+ const getAppLogger = (configuration) => (content, details) => logger(content, {
26
+ ...details ?? {},
27
+ config: { ...configuration?.log, ...details?.config ?? {} }
28
+ });
25
29
  export {
30
+ getAppLogger,
26
31
  logger
27
32
  };
28
33
  //# sourceMappingURL=logger.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/logger.ts"],"sourcesContent":["import type { IntlayerConfig } from './types/config';\n\nexport type Details = {\n isVerbose?: boolean;\n level?: 'info' | 'warn' | 'error' | 'debug';\n config?: Partial<IntlayerConfig['log']>;\n};\n\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 = details.config?.mode ?? 'default';\n const prefix = details.config?.prefix ?? '';\n\n if (mode === 'disabled') return;\n\n if (details.isVerbose && mode !== 'verbose') return;\n\n const flatContent = [content].flat();\n\n if (details.level === 'debug') {\n return console.debug(prefix, ...flatContent);\n }\n\n if (details.level === 'info') {\n return console.info(prefix, ...flatContent);\n }\n\n if (details.level === 'warn') {\n return console.warn(prefix, ...flatContent);\n }\n\n if (details.level === 'error') {\n return console.error(prefix, ...flatContent);\n }\n\n console.log(prefix, ...flatContent);\n};\n"],"mappings":"AAUO,MAAM,SAAiB,CAC5B,SACA,UAAU;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,QAAQ,EAAE,MAAM,WAAW,QAAQ,GAAG;AACxC,MACG;AACH,QAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,QAAM,SAAS,QAAQ,QAAQ,UAAU;AAEzC,MAAI,SAAS,WAAY;AAEzB,MAAI,QAAQ,aAAa,SAAS,UAAW;AAE7C,QAAM,cAAc,CAAC,OAAO,EAAE,KAAK;AAEnC,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,QAAQ,GAAG,WAAW;AAAA,EAC7C;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,QAAQ,GAAG,WAAW;AAAA,EAC5C;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,QAAQ,GAAG,WAAW;AAAA,EAC5C;AAEA,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,QAAQ,GAAG,WAAW;AAAA,EAC7C;AAEA,UAAQ,IAAI,QAAQ,GAAG,WAAW;AACpC;","names":[]}
1
+ {"version":3,"sources":["../../src/logger.ts"],"sourcesContent":["import type { CustomIntlayerConfig } from './types/config';\n\nexport type Details = {\n isVerbose?: boolean;\n level?: 'info' | 'warn' | 'error' | 'debug';\n config?: CustomIntlayerConfig['log'];\n};\n\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 = details.config?.mode ?? 'default';\n const prefix = Boolean(details.config?.prefix)\n ? details.config?.prefix\n : undefined;\n\n if (mode === 'disabled') return;\n\n if (details.isVerbose && mode !== 'verbose') return;\n\n const flatContent = prefix ? [prefix, ...[content].flat()] : [content].flat();\n\n if (details.level === 'debug') {\n return console.debug(...flatContent);\n }\n\n if (details.level === 'info') {\n return console.info(...flatContent);\n }\n\n if (details.level === 'warn') {\n return console.warn(...flatContent);\n }\n\n if (details.level === 'error') {\n return console.error(...flatContent);\n }\n\n console.log(...flatContent);\n};\n\n/**\n * The appLogger function takes the logger and merges it with the configuration from the intlayer config file.\n * It allows overriding the default configuration by passing a config object in the details parameter.\n * The configuration is merged with the default configuration from the intlayer config file.\n */\nexport const getAppLogger =\n (configuration?: CustomIntlayerConfig) => (content: any, details?: Details) =>\n logger(content, {\n ...(details ?? {}),\n config: { ...configuration?.log, ...(details?.config ?? {}) },\n });\n"],"mappings":"AAUO,MAAM,SAAiB,CAC5B,SACA,UAAU;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,QAAQ,EAAE,MAAM,WAAW,QAAQ,GAAG;AACxC,MACG;AACH,QAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,QAAM,SAAS,QAAQ,QAAQ,QAAQ,MAAM,IACzC,QAAQ,QAAQ,SAChB;AAEJ,MAAI,SAAS,WAAY;AAEzB,MAAI,QAAQ,aAAa,SAAS,UAAW;AAE7C,QAAM,cAAc,SAAS,CAAC,QAAQ,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK;AAE5E,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,GAAG,WAAW;AAAA,EACrC;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,GAAG,WAAW;AAAA,EACpC;AAEA,MAAI,QAAQ,UAAU,QAAQ;AAC5B,WAAO,QAAQ,KAAK,GAAG,WAAW;AAAA,EACpC;AAEA,MAAI,QAAQ,UAAU,SAAS;AAC7B,WAAO,QAAQ,MAAM,GAAG,WAAW;AAAA,EACrC;AAEA,UAAQ,IAAI,GAAG,WAAW;AAC5B;AAOO,MAAM,eACX,CAAC,kBAAyC,CAAC,SAAc,YACvD,OAAO,SAAS;AAAA,EACd,GAAI,WAAW,CAAC;AAAA,EAChB,QAAQ,EAAE,GAAG,eAAe,KAAK,GAAI,SAAS,UAAU,CAAC,EAAG;AAC9D,CAAC;","names":[]}
@@ -1,6 +1,5 @@
1
- export type { CustomIntlayerConfig, PatternsContentConfig, IntlayerConfig, BaseContentConfig, BaseDerivedConfig, ResultDirDerivedConfig, } from './types/config';
2
- export type { LocalesValues } from './types/locales';
3
- export { Locales } from './types/locales';
4
1
  export { logger } from './logger';
5
- export { appLogger } from './appLoggerClient';
2
+ export type { BaseContentConfig, BaseDerivedConfig, CustomIntlayerConfig, IntlayerConfig, PatternsContentConfig, ResultDirDerivedConfig, } from './types/config';
3
+ export { Locales } from './types/locales';
4
+ export type { LocalesValues } from './types/locales';
6
5
  //# 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,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { LoadEnvFileOptions } from '../envVariables/loadEnvFile';
2
- import type { IntlayerConfig } from '../types/config';
2
+ import type { CustomIntlayerConfig, IntlayerConfig } from '../types/config';
3
3
  export type GetConfigurationOptions = {
4
4
  baseDir?: string;
5
- verbose?: boolean;
5
+ override?: CustomIntlayerConfig;
6
6
  } & LoadEnvFileOptions;
7
7
  /**
8
8
  * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
@@ -1 +1 @@
1
- {"version":3,"file":"getConfiguration.d.ts","sourceRoot":"","sources":["../../../src/configFile/getConfiguration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAS5E,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,kBAAkB,CAAC;AAMvB;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,uBAAuB,KAChC,cA0CF,CAAC"}
1
+ {"version":3,"file":"getConfiguration.d.ts","sourceRoot":"","sources":["../../../src/configFile/getConfiguration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAS5E,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,GAAG,kBAAkB,CAAC;AAIvB;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,uBAAuB,KAChC,cA0CF,CAAC"}
@@ -13,6 +13,6 @@ type SearchConfigurationFileResult = {
13
13
  * - intlayer.config.mjs
14
14
  * - .intlayerrc
15
15
  */
16
- export declare const searchConfigurationFile: (configFilePath: string) => SearchConfigurationFileResult;
16
+ export declare const searchConfigurationFile: (configFilePath?: string) => SearchConfigurationFileResult;
17
17
  export {};
18
18
  //# sourceMappingURL=searchConfigurationFile.d.ts.map
@@ -1 +1 @@
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,GAClC,gBAAgB,MAAM,KACrB,6BA2BF,CAAC"}
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,GAClC,iBAAgB,MAAsB,KACrC,6BA2BF,CAAC"}
@@ -1,9 +1,8 @@
1
- export { appLogger } from './appLoggerServer';
2
1
  export { getConfiguration, type GetConfigurationOptions, } from './configFile/getConfiguration';
3
2
  export { formatEnvVariable, getConfiguration as getClientConfiguration, getEnvFilePath, getPlatform, loadEnvFile, } from './envVariables/index';
4
3
  export { getSandBoxContext } from './getSandboxContext';
5
4
  export { loadExternalFile } from './loadExternalFile';
6
- export { logger } from './logger';
5
+ export { getAppLogger, logger, type Logger } from './logger';
7
6
  export { retryManager } from './retryManager';
8
7
  export type { BaseContentConfig, BaseDerivedConfig, ContentConfig, CustomIntlayerConfig, InternationalizationConfig, IntlayerConfig, LogConfig, MiddlewareConfig, PatternsContentConfig, ResultDirDerivedConfig, ServerSetCookieRule, StrictMode, } from './types/config';
9
8
  export { Locales } from './types/locales';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,GAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,IAAI,sBAAsB,EAC1C,cAAc,EACd,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,0BAA0B,EAC1B,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,GAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,IAAI,sBAAsB,EAC1C,cAAc,EACd,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,0BAA0B,EAC1B,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1,9 +1,15 @@
1
- import type { IntlayerConfig } from './types/config';
1
+ import type { CustomIntlayerConfig } from './types/config';
2
2
  export type Details = {
3
3
  isVerbose?: boolean;
4
4
  level?: 'info' | 'warn' | 'error' | 'debug';
5
- config?: Partial<IntlayerConfig['log']>;
5
+ config?: CustomIntlayerConfig['log'];
6
6
  };
7
7
  export type Logger = (content: any, details?: Details) => void;
8
8
  export declare const logger: Logger;
9
+ /**
10
+ * The appLogger function takes the logger and merges it with the configuration from the intlayer config file.
11
+ * It allows overriding the default configuration by passing a config object in the details parameter.
12
+ * The configuration is merged with the default configuration from the intlayer config file.
13
+ */
14
+ export declare const getAppLogger: (configuration?: CustomIntlayerConfig) => (content: any, details?: Details) => void;
9
15
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,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;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AAE/D,eAAO,MAAM,MAAM,EAAE,MAkCpB,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,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,oBAAoB,CAAC,KAAK,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AAE/D,eAAO,MAAM,MAAM,EAAE,MAoCpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GACtB,gBAAgB,oBAAoB,MAAM,SAAS,GAAG,EAAE,UAAU,OAAO,SAItE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/config",
3
- "version": "5.5.0-canary.0",
3
+ "version": "5.5.0",
4
4
  "private": false,
5
5
  "description": "Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.",
6
6
  "keywords": [
@@ -69,6 +69,7 @@
69
69
  "./package.json"
70
70
  ],
71
71
  "dependencies": {
72
+ "deepmerge": "^4.3.1",
72
73
  "dotenv": "^16.4.7",
73
74
  "esbuild": "^0.25.2"
74
75
  },
@@ -82,13 +83,13 @@
82
83
  "tsc-alias": "^1.8.11",
83
84
  "tsup": "^8.4.0",
84
85
  "typescript": "^5.8.2",
85
- "@utils/ts-config-types": "1.0.4",
86
- "@utils/tsup-config": "1.0.4",
87
86
  "@utils/eslint-config": "1.0.4",
88
- "@utils/ts-config": "1.0.4"
87
+ "@utils/ts-config-types": "1.0.4",
88
+ "@utils/ts-config": "1.0.4",
89
+ "@utils/tsup-config": "1.0.4"
89
90
  },
90
91
  "peerDependencies": {
91
- "intlayer": "5.5.0-canary.0"
92
+ "intlayer": "5.5.0"
92
93
  },
93
94
  "engines": {
94
95
  "node": ">=14.18"
@@ -1,33 +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 appLoggerClient_exports = {};
20
- __export(appLoggerClient_exports, {
21
- appLogger: () => appLogger
22
- });
23
- module.exports = __toCommonJS(appLoggerClient_exports);
24
- var import_logger = require('./logger.cjs');
25
- const appLogger = (content, details) => (0, import_logger.logger)(content, {
26
- ...details ?? {},
27
- config: { ...details?.config ?? {} }
28
- });
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- appLogger
32
- });
33
- //# sourceMappingURL=appLoggerClient.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/appLoggerClient.ts"],"sourcesContent":["import { type Logger, logger } from './logger';\n\nexport const appLogger: Logger = (content, details) =>\n logger(content, {\n ...(details ?? {}),\n config: { ...(details?.config ?? {}) },\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoC;AAE7B,MAAM,YAAoB,CAAC,SAAS,gBACzC,sBAAO,SAAS;AAAA,EACd,GAAI,WAAW,CAAC;AAAA,EAChB,QAAQ,EAAE,GAAI,SAAS,UAAU,CAAC,EAAG;AACvC,CAAC;","names":[]}
@@ -1,34 +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 appLoggerServer_exports = {};
20
- __export(appLoggerServer_exports, {
21
- appLogger: () => appLogger
22
- });
23
- module.exports = __toCommonJS(appLoggerServer_exports);
24
- var import_getConfiguration = require('./configFile/getConfiguration.cjs');
25
- var import_logger = require('./logger.cjs');
26
- const appLogger = (content, details) => (0, import_logger.logger)(content, {
27
- ...details ?? {},
28
- config: { ...(0, import_getConfiguration.getConfiguration)().log, ...details?.config ?? {} }
29
- });
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- appLogger
33
- });
34
- //# sourceMappingURL=appLoggerServer.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/appLoggerServer.ts"],"sourcesContent":["import { getConfiguration } from './configFile/getConfiguration';\nimport { type Logger, logger } from './logger';\n\nexport const appLogger: Logger = (content, details) =>\n logger(content, {\n ...(details ?? {}),\n config: { ...getConfiguration().log, ...(details?.config ?? {}) },\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AACjC,oBAAoC;AAE7B,MAAM,YAAoB,CAAC,SAAS,gBACzC,sBAAO,SAAS;AAAA,EACd,GAAI,WAAW,CAAC;AAAA,EAChB,QAAQ,EAAE,OAAG,0CAAiB,EAAE,KAAK,GAAI,SAAS,UAAU,CAAC,EAAG;AAClE,CAAC;","names":[]}
@@ -1,9 +0,0 @@
1
- import { logger } from "./logger.mjs";
2
- const appLogger = (content, details) => logger(content, {
3
- ...details ?? {},
4
- config: { ...details?.config ?? {} }
5
- });
6
- export {
7
- appLogger
8
- };
9
- //# sourceMappingURL=appLoggerClient.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/appLoggerClient.ts"],"sourcesContent":["import { type Logger, logger } from './logger';\n\nexport const appLogger: Logger = (content, details) =>\n logger(content, {\n ...(details ?? {}),\n config: { ...(details?.config ?? {}) },\n });\n"],"mappings":"AAAA,SAAsB,cAAc;AAE7B,MAAM,YAAoB,CAAC,SAAS,YACzC,OAAO,SAAS;AAAA,EACd,GAAI,WAAW,CAAC;AAAA,EAChB,QAAQ,EAAE,GAAI,SAAS,UAAU,CAAC,EAAG;AACvC,CAAC;","names":[]}
@@ -1,10 +0,0 @@
1
- import { getConfiguration } from "./configFile/getConfiguration.mjs";
2
- import { logger } from "./logger.mjs";
3
- const appLogger = (content, details) => logger(content, {
4
- ...details ?? {},
5
- config: { ...getConfiguration().log, ...details?.config ?? {} }
6
- });
7
- export {
8
- appLogger
9
- };
10
- //# sourceMappingURL=appLoggerServer.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/appLoggerServer.ts"],"sourcesContent":["import { getConfiguration } from './configFile/getConfiguration';\nimport { type Logger, logger } from './logger';\n\nexport const appLogger: Logger = (content, details) =>\n logger(content, {\n ...(details ?? {}),\n config: { ...getConfiguration().log, ...(details?.config ?? {}) },\n });\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAsB,cAAc;AAE7B,MAAM,YAAoB,CAAC,SAAS,YACzC,OAAO,SAAS;AAAA,EACd,GAAI,WAAW,CAAC;AAAA,EAChB,QAAQ,EAAE,GAAG,iBAAiB,EAAE,KAAK,GAAI,SAAS,UAAU,CAAC,EAAG;AAClE,CAAC;","names":[]}
@@ -1,3 +0,0 @@
1
- import { type Logger } from './logger';
2
- export declare const appLogger: Logger;
3
- //# sourceMappingURL=appLoggerClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appLoggerClient.d.ts","sourceRoot":"","sources":["../../src/appLoggerClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,SAAS,EAAE,MAIpB,CAAC"}
@@ -1,3 +0,0 @@
1
- import { type Logger } from './logger';
2
- export declare const appLogger: Logger;
3
- //# sourceMappingURL=appLoggerServer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appLoggerServer.d.ts","sourceRoot":"","sources":["../../src/appLoggerServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,SAAS,EAAE,MAIpB,CAAC"}