@intlayer/config 4.1.6 → 4.1.8

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 (81) hide show
  1. package/dist/cjs/appLoggerServer.cjs +2 -2
  2. package/dist/cjs/appLoggerServer.cjs.map +1 -1
  3. package/dist/cjs/configFile/buildConfigurationFields.cjs +5 -1
  4. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  5. package/dist/cjs/configFile/getConfiguration.cjs +13 -13
  6. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  7. package/dist/cjs/configFile/loadConfigurationFile.cjs +42 -39
  8. package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
  9. package/dist/cjs/defaultValues/content.cjs +1 -12
  10. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  11. package/dist/cjs/defaultValues/editor.cjs +3 -0
  12. package/dist/cjs/defaultValues/editor.cjs.map +1 -1
  13. package/dist/cjs/envVariables/detectPlatform.cjs +5 -14
  14. package/dist/cjs/envVariables/detectPlatform.cjs.map +1 -1
  15. package/dist/cjs/envVariables/extractEnvVariable/index.cjs.map +1 -1
  16. package/dist/cjs/envVariables/extractEnvVariable/next.cjs +44 -54
  17. package/dist/cjs/envVariables/extractEnvVariable/next.cjs.map +1 -1
  18. package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs +44 -54
  19. package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs.map +1 -1
  20. package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs +44 -54
  21. package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs.map +1 -1
  22. package/dist/cjs/envVariables/extractEnvVariable/vite.cjs +1 -0
  23. package/dist/cjs/envVariables/extractEnvVariable/vite.cjs.map +1 -1
  24. package/dist/cjs/envVariables/getConfiguration.cjs +1 -0
  25. package/dist/cjs/envVariables/getConfiguration.cjs.map +1 -1
  26. package/dist/cjs/envVariables/loadEnvFile.cjs +11 -3
  27. package/dist/cjs/envVariables/loadEnvFile.cjs.map +1 -1
  28. package/dist/cjs/index.cjs.map +1 -1
  29. package/dist/cjs/types/config.cjs.map +1 -1
  30. package/dist/esm/appLoggerServer.mjs +1 -1
  31. package/dist/esm/appLoggerServer.mjs.map +1 -1
  32. package/dist/esm/configFile/buildConfigurationFields.mjs +6 -1
  33. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  34. package/dist/esm/configFile/getConfiguration.mjs +13 -13
  35. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  36. package/dist/esm/configFile/loadConfigurationFile.mjs +45 -40
  37. package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
  38. package/dist/esm/defaultValues/content.mjs +0 -1
  39. package/dist/esm/defaultValues/content.mjs.map +1 -1
  40. package/dist/esm/defaultValues/editor.mjs +2 -0
  41. package/dist/esm/defaultValues/editor.mjs.map +1 -1
  42. package/dist/esm/envVariables/detectPlatform.mjs +3 -2
  43. package/dist/esm/envVariables/detectPlatform.mjs.map +1 -1
  44. package/dist/esm/envVariables/extractEnvVariable/index.mjs.map +1 -1
  45. package/dist/esm/envVariables/extractEnvVariable/next.mjs +1 -1
  46. package/dist/esm/envVariables/extractEnvVariable/next.mjs.map +1 -1
  47. package/dist/esm/envVariables/extractEnvVariable/react_app.mjs +1 -1
  48. package/dist/esm/envVariables/extractEnvVariable/react_app.mjs.map +1 -1
  49. package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs +1 -1
  50. package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs.map +1 -1
  51. package/dist/esm/envVariables/extractEnvVariable/vite.mjs +1 -0
  52. package/dist/esm/envVariables/extractEnvVariable/vite.mjs.map +1 -1
  53. package/dist/esm/envVariables/getConfiguration.mjs +1 -0
  54. package/dist/esm/envVariables/getConfiguration.mjs.map +1 -1
  55. package/dist/esm/envVariables/loadEnvFile.mjs +11 -3
  56. package/dist/esm/envVariables/loadEnvFile.mjs.map +1 -1
  57. package/dist/esm/index.mjs +3 -1
  58. package/dist/esm/index.mjs.map +1 -1
  59. package/dist/types/configFile/buildConfigurationFields.d.ts +1 -2
  60. package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
  61. package/dist/types/configFile/getConfiguration.d.ts +5 -4
  62. package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
  63. package/dist/types/configFile/loadConfigurationFile.d.ts +2 -1
  64. package/dist/types/configFile/loadConfigurationFile.d.ts.map +1 -1
  65. package/dist/types/defaultValues/content.d.ts.map +1 -1
  66. package/dist/types/defaultValues/editor.d.ts +1 -0
  67. package/dist/types/defaultValues/editor.d.ts.map +1 -1
  68. package/dist/types/envVariables/detectPlatform.d.ts +1 -1
  69. package/dist/types/envVariables/detectPlatform.d.ts.map +1 -1
  70. package/dist/types/envVariables/extractEnvVariable/next.d.ts.map +1 -1
  71. package/dist/types/envVariables/extractEnvVariable/react_app.d.ts.map +1 -1
  72. package/dist/types/envVariables/extractEnvVariable/undefined_platform.d.ts.map +1 -1
  73. package/dist/types/envVariables/extractEnvVariable/vite.d.ts.map +1 -1
  74. package/dist/types/envVariables/getConfiguration.d.ts.map +1 -1
  75. package/dist/types/envVariables/loadEnvFile.d.ts +5 -2
  76. package/dist/types/envVariables/loadEnvFile.d.ts.map +1 -1
  77. package/dist/types/index.d.ts +1 -1
  78. package/dist/types/index.d.ts.map +1 -1
  79. package/dist/types/types/config.d.ts +7 -1
  80. package/dist/types/types/config.d.ts.map +1 -1
  81. package/package.json +6 -5
@@ -21,11 +21,11 @@ __export(appLoggerServer_exports, {
21
21
  appLogger: () => appLogger
22
22
  });
23
23
  module.exports = __toCommonJS(appLoggerServer_exports);
24
- var import_index = require('./index.cjs');
24
+ var import_getConfiguration = require('./configFile/getConfiguration.cjs');
25
25
  var import_logger = require('./logger.cjs');
26
26
  const appLogger = (content, details) => (0, import_logger.logger)(content, {
27
27
  ...details ?? {},
28
- config: { ...(0, import_index.getConfiguration)().log, ...details?.config ?? {} }
28
+ config: { ...(0, import_getConfiguration.getConfiguration)().log, ...details?.config ?? {} }
29
29
  });
30
30
  // Annotate the CommonJS export names for ESM import in node:
31
31
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/appLoggerServer.ts"],"sourcesContent":["import { getConfiguration } from './index';\nimport { 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,mBAAiC;AACjC,oBAA+B;AAExB,MAAM,YAAoB,CAAC,SAAS,gBACzC,sBAAO,SAAS;AAAA,EACd,GAAI,WAAW,CAAC;AAAA,EAChB,QAAQ,EAAE,OAAG,+BAAiB,EAAE,KAAK,GAAI,SAAS,UAAU,CAAC,EAAG;AAClE,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/appLoggerServer.ts"],"sourcesContent":["import { getConfiguration } from './configFile/getConfiguration';\nimport { 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,oBAA+B;AAExB,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":[]}
@@ -465,6 +465,10 @@ const buildEditorFields = (customConfiguration) => ({
465
465
  * Default: '*'
466
466
  */
467
467
  editorURL: customConfiguration?.editorURL ?? import_editor.EDITOR_URL,
468
+ /**
469
+ * URL of the CMS server. Used to restrict the origin of the editor for security reasons.
470
+ */
471
+ cmsURL: customConfiguration?.cmsURL ?? import_editor.CMS_URL,
468
472
  /**
469
473
  * URL of the editor server
470
474
  *
@@ -549,7 +553,7 @@ const buildLogFields = (customConfiguration) => ({
549
553
  */
550
554
  prefix: customConfiguration?.prefix ?? import_log.PREFIX
551
555
  });
552
- const buildConfigurationFields = (options, customConfiguration) => {
556
+ const buildConfigurationFields = (customConfiguration) => {
553
557
  const internationalizationConfig = buildInternationalizationFields(
554
558
  customConfiguration?.internationalization
555
559
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { join } from 'path';\nimport {\n CONTENT_DIR_NAME,\n DICTIONARIES_DIR_NAME,\n FILE_EXTENSIONS,\n RESULT_DIR_NAME,\n EXCLUDED_PATHS,\n TYPES_DIR_NAME,\n MAIN_DIR_NAME,\n MODULE_AUGMENTATION_DIR_NAME,\n I18NEXT_DICTIONARIES_DIR_NAME,\n DICTIONARY_OUTPUT,\n WATCH,\n REACT_INTL_MESSAGES_DIR_NAME,\n} from '../defaultValues/content';\nimport {\n APPLICATION_URL,\n EDITOR_URL,\n BACKEND_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n IS_ENABLED,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport {\n BASE_PATH,\n COOKIE_NAME,\n HEADER_NAME,\n NO_PREFIX,\n PREFIX_DEFAULT,\n SERVER_SET_COOKIE,\n} from '../defaultValues/middleware';\nimport type {\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n PatternsContentConfig,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n BaseContentConfig,\n ResultDirDerivedConfig,\n EditorConfig,\n LogConfig,\n} from '../types/config';\nimport type { GetConfigurationOptions } from './getConfiguration';\n\nlet storedConfiguration: IntlayerConfig;\n\n// @TODO - Add possibility of directories configurations to be arrays to allow multiple packages management\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"required_only\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"required_only\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildMiddlewareFields = (\n customConfiguration?: Partial<MiddlewareConfig>\n): MiddlewareConfig => ({\n /**\n * Header name to get the locale\n *\n * Default: 'x-intlayer-locale'\n */\n headerName: customConfiguration?.headerName ?? HEADER_NAME,\n\n /**\n * Cookie name to get the locale\n *\n * Default: 'intlayer-locale'\n */\n cookieName: customConfiguration?.cookieName ?? COOKIE_NAME,\n\n /**\n * Prefix default prefix the default locale to the path as other locales.\n *\n * Example with prefixDefault = true and defaultLocale = 'en':\n * path = /en/dashboard or /fr/dashboard\n *\n * Example with prefixDefault = false and defaultLocale = 'en':\n * path = /dashboard or /fr/dashboard\n *\n *\n * Default: false\n */\n prefixDefault: customConfiguration?.prefixDefault ?? PREFIX_DEFAULT,\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Rule to set the cookie on the server\n * - 'always': Set the cookie on every request\n * - 'never': Never set the cookie\n */\n serverSetCookie: customConfiguration?.serverSetCookie ?? SERVER_SET_COOKIE,\n\n /**\n * No prefix in the URL\n * - true: No prefix in the URL\n * - false: Prefix in the URL\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n * - If no prefix is set, the URL will be https://example.com/en\n * - If the no prefix is set to true, the URL will be https://example.com\n *\n * Default: false\n */\n noPrefix: customConfiguration?.noPrefix ?? NO_PREFIX,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>\n): ContentConfig => {\n const notDerivedContentConfig: BaseContentConfig = {\n /**\n * File extensions of content to look for to build the dictionaries\n *\n * - Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']\n *\n * - Example: ['.data.ts', '.data.js', '.data.json']\n *\n * Note:\n * - Can exclude unused file extensions to improve performance\n * - Avoid using common file extensions like '.ts', '.js', '.json' to avoid conflicts\n */\n fileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\n /**\n * Absolute path of the directory of the project\n * - Default: process.cwd()\n * - Example: '/path/to/project'\n *\n * Will be used to resolve all intlayer directories\n *\n * Note:\n * - The base directory should be the root of the project\n * - Can be changed to a custom directory to externalize either the content used in the project, or the intlayer application from the project\n */\n baseDir: customConfiguration?.baseDir ?? process.cwd(),\n\n /**\n * Directory name where the content is stored\n *\n * Default: 'src'\n *\n * Example:\n * - 'data' -> '/path/to/project/data'\n * - 'content' -> '/path/to/project/content'\n * - 'locales' -> '/path/to/project/locales'\n *\n * Note: If this directory is not at the base directory level, update the contentDir field instead\n */\n contentDirName: customConfiguration?.contentDirName ?? CONTENT_DIR_NAME,\n\n /**\n * Directory name where the result will be stored\n *\n * Default: '.intlayer'\n *\n * Example:\n * - '.next'\n * - 'outputOFIntlayer'\n *\n * Note: If this directory is not at the base directory level, update the resultDir field instead\n */\n resultDirName: customConfiguration?.resultDirName ?? RESULT_DIR_NAME,\n\n /**\n *\n * Directory name where the module augmentation will be stored\n *\n * Module augmentation allow better IDE suggestions and type checking\n *\n * Default: 'types'\n *\n * Example: 'intlayer-types'\n *\n * Note:\n * - If this path changed, be sure to include it from the tsconfig.json file\n * - If this directory is not at the base directory level, update the moduleAugmentationDir field instead\n */\n moduleAugmentationDirName:\n customConfiguration?.moduleAugmentationDirName ??\n MODULE_AUGMENTATION_DIR_NAME,\n // @TODO: Make Module Augmentation optional by adding a flag in the configuration\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries will be stored\n *\n * Default: 'dictionary'\n *\n * Example: 'translations'\n *\n * Note:\n * - If this directory is not at the result directory level, update the dictionariesDir field instead\n *\n */\n dictionariesDirName:\n customConfiguration?.dictionariesDirName ?? DICTIONARIES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries will be stored\n *\n * Default: 'dictionary'\n *\n * Example: 'translations'\n *\n * Note:\n * - If this directory is not at the result directory level, update the dictionariesDir field instead\n *\n */\n i18nextResourcesDirName:\n customConfiguration?.i18nextResourcesDirName ??\n I18NEXT_DICTIONARIES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries will be stored\n *\n * Default: 'react-intl_dictionary'\n *\n * Example: 'translations'\n *\n * Note:\n * - If this directory is not at the result directory level, update the dictionariesDir field instead\n *\n */\n reactIntlMessagesDirName:\n customConfiguration?.reactIntlMessagesDirName ??\n REACT_INTL_MESSAGES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries types will be stored\n *\n * Default: 'types'\n *\n * Example: 'intlayer-types'\n *\n * Note:\n * - If this directory is not at the result directory level, update the typesDir field instead\n *\n */\n typeDirName: customConfiguration?.typeDirName ?? TYPES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the main files will be stored\n *\n * Default: 'main'\n *\n * Example: 'intlayer-main'\n *\n * Note:\n * - If this directory is not at the result directory level, update the mainDir field instead\n */\n mainDirName: customConfiguration?.mainDirName ?? MAIN_DIR_NAME,\n\n /**\n * Should exclude some directories from the content search\n *\n * Default: ['node_modules']\n *\n * Not used yet\n * @TODO Implement the exclusion or remove it\n */\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n\n /**\n * Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.\n *\n * Default: process.env.NODE_ENV === 'development'\n */\n watch: customConfiguration?.watch ?? WATCH,\n };\n\n const baseDirDerivedConfiguration: BaseDerivedConfig = {\n /**\n * Directory where the content is stored\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{contentDirName}}\n *\n * Example: '/path/to/project/src'\n *\n * Note:\n * - Can be changed to a custom directory to externalize the content used in the project\n * - If the content is not at the base directory level, update the contentDirName field instead\n */\n contentDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.contentDirName\n ),\n\n /**\n * Directory where the result will be stored\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{resultDirName}}\n *\n * Example: '/path/to/project/.intlayer'\n *\n * Note:\n * - Can be changed to a custom directory to externalize the intlayer application from the project\n * - If the result is not at the base directory level, update the resultDirName field instead\n */\n resultDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.resultDirName\n ),\n\n /**\n * Directory where the module augmentation will be stored\n *\n * Module augmentation allow better IDE suggestions and type checking\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{moduleAugmentationDirName}}\n *\n * Example: '/path/to/project/types'\n *\n * Note:\n * - If this path changed, be sure to include it from the tsconfig.json file\n * - If the module augmentation is not at the base directory level, update the moduleAugmentationDirName field instead\n *\n */\n moduleAugmentationDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.moduleAugmentationDirName\n ),\n\n /**\n * Output format of the dictionary\n *\n * Default: ['intlayer']\n *\n * Note:\n * - 'i18next' is not yet ensure a 1:1 mapping with the i18next library.\n * - Removing 'intlayer' will break the compatibility with react-intlayer or next-intlayer\n */\n dictionaryOutput:\n customConfiguration?.dictionaryOutput ?? DICTIONARY_OUTPUT,\n };\n\n const resultDirDerivedConfiguration: ResultDirDerivedConfig = {\n /**\n * Directory where the dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{dictionariesDirName}}\n *\n * Example: '/path/to/project/.intlayer/dictionary'\n *\n * Note:\n * - If the types are not at the result directory level, update the dictionariesDirName field instead\n * - The dictionaries are stored in JSON format\n * - The dictionaries are used to translate the content\n * - The dictionaries are built from the content files\n */\n dictionariesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.dictionariesDirName\n ),\n\n /**\n * Directory where the 18n dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{i18nextResourcesDirName}}\n *\n * Example: '/path/to/project/.intlayer/dictionary/i18n'\n *\n * Note:\n * - If the types are not at the result directory level, update the i18nextResourcesDirName field instead\n */\n i18nextResourcesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.i18nextResourcesDirName\n ),\n\n /**\n * Directory where the dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{reactIntlMessagesDirName}}\n *\n * Example: '/path/to/project/.intlayer/react-intl_dictionary'\n *\n * Note:\n * - If the types are not at the result directory level, update the dictionariesDirName field instead\n */\n reactIntlMessagesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.reactIntlMessagesDirName\n ),\n\n /**\n * Directory where the dictionaries types will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{typeDirName}}\n *\n * Example: '/path/to/project/types'\n *\n * Note:\n * - If the types are not at the result directory level, update the typesDirName field instead\n */\n typesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.typeDirName\n ),\n\n /**\n * Directory where the main files will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{mainDirName}}\n *\n * Example: '/path/to/project/.intlayer/main'\n *\n * Note:\n *\n * - If the main files are not at the result directory level, update the mainDirName field instead\n */\n mainDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.mainDirName\n ),\n };\n\n const patternsConfiguration: PatternsContentConfig = {\n /**\n * Pattern of files to watch\n *\n * Default: ['/**\\/*.content.ts', '/**\\/*.content.js', '/**\\/*.content.json', '/**\\/*.content.cjs', '/**\\/*.content.mjs', '/**\\/*.content.tsx', '/**\\/*.content.jsx']\n */\n watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(\n (ext) => `/**/*${ext}`\n ),\n\n /**\n * Pattern of files to watch including the relative path\n *\n * Default: ['{{contentDir}}/**\\/*.content.ts', '{{contentDir}}/**\\/*.content.js', '{{contentDir}}/**\\/*.content.json', '{{contentDir}}/**\\/*.content.cjs', '{{contentDir}}/**\\/*.content.mjs', '{{contentDir}}/**\\/*.content.tsx', '{{contentDir}}/**\\/*.content.jsx']\n */\n watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.map(\n (ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`\n ),\n\n /**\n * Pattern of dictionary to interpret\n *\n * Default: '{{dictionariesDir}}/**\\/*.json'\n */\n outputFilesPatternWithPath: `${resultDirDerivedConfiguration.dictionariesDir}/**/*.json`,\n };\n\n return {\n ...notDerivedContentConfig,\n ...baseDirDerivedConfiguration,\n ...resultDirDerivedConfiguration,\n ...patternsConfiguration,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: true;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://intlayer.org/dashboard/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? undefined,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://intlayer.org/dashboard/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret: customConfiguration?.clientSecret ?? undefined,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'locale_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'locale_first' or 'distant_first'.\n * - 'locale_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n});\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n options: GetConfigurationOptions,\n customConfiguration?: CustomIntlayerConfig\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const middlewareConfig = buildMiddlewareFields(\n customConfiguration?.middleware\n );\n\n const contentConfig = buildContentFields(customConfiguration?.content);\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log);\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n middleware: middlewareConfig,\n content: contentConfig,\n editor: editorConfig,\n log: logConfig,\n };\n\n return storedConfiguration;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AACrB,qBAaO;AACP,oBAOO;AACP,kCAIO;AACP,iBAA6B;AAC7B,wBAOO;AAgBP,IAAI;AAIJ,MAAM,kCAAkC,CACtC,yBACgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOhC,SAAS,qBAAqB,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUzC,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,eAAe,qBAAqB,iBAAiB;AACvD;AAEA,MAAM,wBAAwB,CAC5B,yBACsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;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KAAK;AAAA,EACP;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { join } from 'path';\nimport {\n CONTENT_DIR_NAME,\n DICTIONARIES_DIR_NAME,\n FILE_EXTENSIONS,\n RESULT_DIR_NAME,\n EXCLUDED_PATHS,\n TYPES_DIR_NAME,\n MAIN_DIR_NAME,\n MODULE_AUGMENTATION_DIR_NAME,\n I18NEXT_DICTIONARIES_DIR_NAME,\n DICTIONARY_OUTPUT,\n WATCH,\n REACT_INTL_MESSAGES_DIR_NAME,\n} from '../defaultValues/content';\nimport {\n APPLICATION_URL,\n EDITOR_URL,\n CMS_URL,\n BACKEND_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n IS_ENABLED,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport {\n BASE_PATH,\n COOKIE_NAME,\n HEADER_NAME,\n NO_PREFIX,\n PREFIX_DEFAULT,\n SERVER_SET_COOKIE,\n} from '../defaultValues/middleware';\nimport type {\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n PatternsContentConfig,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n BaseContentConfig,\n ResultDirDerivedConfig,\n EditorConfig,\n LogConfig,\n} from '../types/config';\n\nlet storedConfiguration: IntlayerConfig;\n\n// @TODO - Add possibility of directories configurations to be arrays to allow multiple packages management\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"required_only\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"required_only\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildMiddlewareFields = (\n customConfiguration?: Partial<MiddlewareConfig>\n): MiddlewareConfig => ({\n /**\n * Header name to get the locale\n *\n * Default: 'x-intlayer-locale'\n */\n headerName: customConfiguration?.headerName ?? HEADER_NAME,\n\n /**\n * Cookie name to get the locale\n *\n * Default: 'intlayer-locale'\n */\n cookieName: customConfiguration?.cookieName ?? COOKIE_NAME,\n\n /**\n * Prefix default prefix the default locale to the path as other locales.\n *\n * Example with prefixDefault = true and defaultLocale = 'en':\n * path = /en/dashboard or /fr/dashboard\n *\n * Example with prefixDefault = false and defaultLocale = 'en':\n * path = /dashboard or /fr/dashboard\n *\n *\n * Default: false\n */\n prefixDefault: customConfiguration?.prefixDefault ?? PREFIX_DEFAULT,\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Rule to set the cookie on the server\n * - 'always': Set the cookie on every request\n * - 'never': Never set the cookie\n */\n serverSetCookie: customConfiguration?.serverSetCookie ?? SERVER_SET_COOKIE,\n\n /**\n * No prefix in the URL\n * - true: No prefix in the URL\n * - false: Prefix in the URL\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n * - If no prefix is set, the URL will be https://example.com/en\n * - If the no prefix is set to true, the URL will be https://example.com\n *\n * Default: false\n */\n noPrefix: customConfiguration?.noPrefix ?? NO_PREFIX,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>\n): ContentConfig => {\n const notDerivedContentConfig: BaseContentConfig = {\n /**\n * File extensions of content to look for to build the dictionaries\n *\n * - Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']\n *\n * - Example: ['.data.ts', '.data.js', '.data.json']\n *\n * Note:\n * - Can exclude unused file extensions to improve performance\n * - Avoid using common file extensions like '.ts', '.js', '.json' to avoid conflicts\n */\n fileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\n /**\n * Absolute path of the directory of the project\n * - Default: process.cwd()\n * - Example: '/path/to/project'\n *\n * Will be used to resolve all intlayer directories\n *\n * Note:\n * - The base directory should be the root of the project\n * - Can be changed to a custom directory to externalize either the content used in the project, or the intlayer application from the project\n */\n baseDir: customConfiguration?.baseDir ?? process.cwd(),\n\n /**\n * Directory name where the content is stored\n *\n * Default: 'src'\n *\n * Example:\n * - 'data' -> '/path/to/project/data'\n * - 'content' -> '/path/to/project/content'\n * - 'locales' -> '/path/to/project/locales'\n *\n * Note: If this directory is not at the base directory level, update the contentDir field instead\n */\n contentDirName: customConfiguration?.contentDirName ?? CONTENT_DIR_NAME,\n\n /**\n * Directory name where the result will be stored\n *\n * Default: '.intlayer'\n *\n * Example:\n * - '.next'\n * - 'outputOFIntlayer'\n *\n * Note: If this directory is not at the base directory level, update the resultDir field instead\n */\n resultDirName: customConfiguration?.resultDirName ?? RESULT_DIR_NAME,\n\n /**\n *\n * Directory name where the module augmentation will be stored\n *\n * Module augmentation allow better IDE suggestions and type checking\n *\n * Default: 'types'\n *\n * Example: 'intlayer-types'\n *\n * Note:\n * - If this path changed, be sure to include it from the tsconfig.json file\n * - If this directory is not at the base directory level, update the moduleAugmentationDir field instead\n */\n moduleAugmentationDirName:\n customConfiguration?.moduleAugmentationDirName ??\n MODULE_AUGMENTATION_DIR_NAME,\n // @TODO: Make Module Augmentation optional by adding a flag in the configuration\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries will be stored\n *\n * Default: 'dictionary'\n *\n * Example: 'translations'\n *\n * Note:\n * - If this directory is not at the result directory level, update the dictionariesDir field instead\n *\n */\n dictionariesDirName:\n customConfiguration?.dictionariesDirName ?? DICTIONARIES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries will be stored\n *\n * Default: 'dictionary'\n *\n * Example: 'translations'\n *\n * Note:\n * - If this directory is not at the result directory level, update the dictionariesDir field instead\n *\n */\n i18nextResourcesDirName:\n customConfiguration?.i18nextResourcesDirName ??\n I18NEXT_DICTIONARIES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries will be stored\n *\n * Default: 'react-intl_dictionary'\n *\n * Example: 'translations'\n *\n * Note:\n * - If this directory is not at the result directory level, update the dictionariesDir field instead\n *\n */\n reactIntlMessagesDirName:\n customConfiguration?.reactIntlMessagesDirName ??\n REACT_INTL_MESSAGES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries types will be stored\n *\n * Default: 'types'\n *\n * Example: 'intlayer-types'\n *\n * Note:\n * - If this directory is not at the result directory level, update the typesDir field instead\n *\n */\n typeDirName: customConfiguration?.typeDirName ?? TYPES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the main files will be stored\n *\n * Default: 'main'\n *\n * Example: 'intlayer-main'\n *\n * Note:\n * - If this directory is not at the result directory level, update the mainDir field instead\n */\n mainDirName: customConfiguration?.mainDirName ?? MAIN_DIR_NAME,\n\n /**\n * Should exclude some directories from the content search\n *\n * Default: ['node_modules']\n *\n * Not used yet\n * @TODO Implement the exclusion or remove it\n */\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n\n /**\n * Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.\n *\n * Default: process.env.NODE_ENV === 'development'\n */\n watch: customConfiguration?.watch ?? WATCH,\n };\n\n const baseDirDerivedConfiguration: BaseDerivedConfig = {\n /**\n * Directory where the content is stored\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{contentDirName}}\n *\n * Example: '/path/to/project/src'\n *\n * Note:\n * - Can be changed to a custom directory to externalize the content used in the project\n * - If the content is not at the base directory level, update the contentDirName field instead\n */\n contentDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.contentDirName\n ),\n\n /**\n * Directory where the result will be stored\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{resultDirName}}\n *\n * Example: '/path/to/project/.intlayer'\n *\n * Note:\n * - Can be changed to a custom directory to externalize the intlayer application from the project\n * - If the result is not at the base directory level, update the resultDirName field instead\n */\n resultDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.resultDirName\n ),\n\n /**\n * Directory where the module augmentation will be stored\n *\n * Module augmentation allow better IDE suggestions and type checking\n *\n * Relative to the base directory of the project\n *\n * Default: {{baseDir}} / {{moduleAugmentationDirName}}\n *\n * Example: '/path/to/project/types'\n *\n * Note:\n * - If this path changed, be sure to include it from the tsconfig.json file\n * - If the module augmentation is not at the base directory level, update the moduleAugmentationDirName field instead\n *\n */\n moduleAugmentationDir: join(\n notDerivedContentConfig.baseDir,\n notDerivedContentConfig.moduleAugmentationDirName\n ),\n\n /**\n * Output format of the dictionary\n *\n * Default: ['intlayer']\n *\n * Note:\n * - 'i18next' is not yet ensure a 1:1 mapping with the i18next library.\n * - Removing 'intlayer' will break the compatibility with react-intlayer or next-intlayer\n */\n dictionaryOutput:\n customConfiguration?.dictionaryOutput ?? DICTIONARY_OUTPUT,\n };\n\n const resultDirDerivedConfiguration: ResultDirDerivedConfig = {\n /**\n * Directory where the dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{dictionariesDirName}}\n *\n * Example: '/path/to/project/.intlayer/dictionary'\n *\n * Note:\n * - If the types are not at the result directory level, update the dictionariesDirName field instead\n * - The dictionaries are stored in JSON format\n * - The dictionaries are used to translate the content\n * - The dictionaries are built from the content files\n */\n dictionariesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.dictionariesDirName\n ),\n\n /**\n * Directory where the 18n dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{i18nextResourcesDirName}}\n *\n * Example: '/path/to/project/.intlayer/dictionary/i18n'\n *\n * Note:\n * - If the types are not at the result directory level, update the i18nextResourcesDirName field instead\n */\n i18nextResourcesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.i18nextResourcesDirName\n ),\n\n /**\n * Directory where the dictionaries will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{reactIntlMessagesDirName}}\n *\n * Example: '/path/to/project/.intlayer/react-intl_dictionary'\n *\n * Note:\n * - If the types are not at the result directory level, update the dictionariesDirName field instead\n */\n reactIntlMessagesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.reactIntlMessagesDirName\n ),\n\n /**\n * Directory where the dictionaries types will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{typeDirName}}\n *\n * Example: '/path/to/project/types'\n *\n * Note:\n * - If the types are not at the result directory level, update the typesDirName field instead\n */\n typesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.typeDirName\n ),\n\n /**\n * Directory where the main files will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{mainDirName}}\n *\n * Example: '/path/to/project/.intlayer/main'\n *\n * Note:\n *\n * - If the main files are not at the result directory level, update the mainDirName field instead\n */\n mainDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.mainDirName\n ),\n };\n\n const patternsConfiguration: PatternsContentConfig = {\n /**\n * Pattern of files to watch\n *\n * Default: ['/**\\/*.content.ts', '/**\\/*.content.js', '/**\\/*.content.json', '/**\\/*.content.cjs', '/**\\/*.content.mjs', '/**\\/*.content.tsx', '/**\\/*.content.jsx']\n */\n watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(\n (ext) => `/**/*${ext}`\n ),\n\n /**\n * Pattern of files to watch including the relative path\n *\n * Default: ['{{contentDir}}/**\\/*.content.ts', '{{contentDir}}/**\\/*.content.js', '{{contentDir}}/**\\/*.content.json', '{{contentDir}}/**\\/*.content.cjs', '{{contentDir}}/**\\/*.content.mjs', '{{contentDir}}/**\\/*.content.tsx', '{{contentDir}}/**\\/*.content.jsx']\n */\n watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.map(\n (ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`\n ),\n\n /**\n * Pattern of dictionary to interpret\n *\n * Default: '{{dictionariesDir}}/**\\/*.json'\n */\n outputFilesPatternWithPath: `${resultDirDerivedConfiguration.dictionariesDir}/**/*.json`,\n };\n\n return {\n ...notDerivedContentConfig,\n ...baseDirDerivedConfiguration,\n ...resultDirDerivedConfiguration,\n ...patternsConfiguration,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: true;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://intlayer.org/dashboard/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? undefined,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://intlayer.org/dashboard/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret: customConfiguration?.clientSecret ?? undefined,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'locale_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'locale_first' or 'distant_first'.\n * - 'locale_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n});\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const middlewareConfig = buildMiddlewareFields(\n customConfiguration?.middleware\n );\n\n const contentConfig = buildContentFields(customConfiguration?.content);\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log);\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n middleware: middlewareConfig,\n content: contentConfig,\n editor: editorConfig,\n log: logConfig,\n };\n\n return storedConfiguration;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AACrB,qBAaO;AACP,oBAQO;AACP,kCAIO;AACP,iBAA6B;AAC7B,wBAOO;AAeP,IAAI;AAIJ,MAAM,kCAAkC,CACtC,yBACgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOhC,SAAS,qBAAqB,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUzC,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,eAAe,qBAAqB,iBAAiB;AACvD;AAEA,MAAM,wBAAwB,CAC5B,yBACsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc/C,eAAe,qBAAqB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/C,MAAM,qBAAqB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBnC,SAAS,qBAAqB,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWzC,UAAU,qBAAqB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW3C,cAAc,qBAAqB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYnD,4BACE,qBAAqB,8BACrB;AACJ;AAEA,MAAM,iBAAiB,CACrB,yBACe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUf,MAAM,qBAAqB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnC,QAAQ,qBAAqB,UAAU;AACzC;AAKO,MAAM,2BAA2B,CACtC,wBACmB;AACnB,QAAM,6BAA6B;AAAA,IACjC,qBAAqB;AAAA,EACvB;AAEA,QAAM,mBAAmB;AAAA,IACvB,qBAAqB;AAAA,EACvB;AAEA,QAAM,gBAAgB,mBAAmB,qBAAqB,OAAO;AAErE,QAAM,eAAe,kBAAkB,qBAAqB,MAAM;AAElE,QAAM,YAAY,eAAe,qBAAqB,GAAG;AAEzD,wBAAsB;AAAA,IACpB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAEA,SAAO;AACT;","names":[]}
@@ -30,31 +30,31 @@ let storedConfiguration;
30
30
  let storedConfigurationFilePath;
31
31
  let storedNumCustomConfiguration;
32
32
  const BASE_DIR_PATH = process.cwd();
33
- const defaultOptions = {
34
- baseDir: BASE_DIR_PATH,
35
- verbose: false
36
- };
37
33
  const getConfiguration = (options) => {
38
- const mergedOptions = { ...defaultOptions, ...options };
39
- const { baseDir, verbose } = mergedOptions;
40
- if (!storedConfiguration) {
34
+ const mergedOptions = {
35
+ baseDir: BASE_DIR_PATH,
36
+ ...options
37
+ };
38
+ const { baseDir, verbose, env, envFile } = mergedOptions;
39
+ if (!storedConfiguration || typeof options !== "undefined") {
41
40
  const { configurationFilePath, numCustomConfiguration } = (0, import_searchConfigurationFile.searchConfigurationFile)(baseDir);
42
41
  let customConfiguration;
43
42
  if (configurationFilePath) {
44
- customConfiguration = (0, import_loadConfigurationFile.loadConfigurationFile)(configurationFilePath);
43
+ customConfiguration = (0, import_loadConfigurationFile.loadConfigurationFile)(configurationFilePath, {
44
+ env,
45
+ envFile
46
+ });
45
47
  }
46
- storedConfiguration = (0, import_buildConfigurationFields.buildConfigurationFields)(
47
- mergedOptions,
48
- customConfiguration
49
- );
48
+ storedConfiguration = (0, import_buildConfigurationFields.buildConfigurationFields)(customConfiguration);
50
49
  storedConfigurationFilePath = configurationFilePath;
51
50
  storedNumCustomConfiguration = numCustomConfiguration;
52
51
  }
53
- if (verbose)
52
+ if (verbose) {
54
53
  logConfigFileResult(
55
54
  storedNumCustomConfiguration,
56
55
  storedConfigurationFilePath
57
56
  );
57
+ }
58
58
  return storedConfiguration;
59
59
  };
60
60
  const logConfigFileResult = (numCustomConfiguration, configurationFilePath) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'path';\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};\n\nconst BASE_DIR_PATH = process.cwd();\nconst defaultOptions: GetConfigurationOptions = {\n baseDir: BASE_DIR_PATH,\n verbose: false,\n};\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?: Partial<GetConfigurationOptions>\n): IntlayerConfig => {\n const mergedOptions = { ...defaultOptions, ...options };\n const { baseDir, verbose } = mergedOptions;\n\n if (!storedConfiguration) {\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n // Load the custom configuration\n let customConfiguration: CustomIntlayerConfig | undefined;\n\n if (configurationFilePath) {\n customConfiguration = loadConfigurationFile(configurationFilePath);\n }\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n mergedOptions,\n customConfiguration\n );\n\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (verbose)\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n\n return storedConfiguration;\n};\n\nconst logConfigFileResult = (\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n 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;AACzB,oBAAuB;AAEvB,sCAAyC;AACzC,mCAAsC;AACtC,qCAAwC;AAExC,IAAI;AACJ,IAAI;AACJ,IAAI;AAOJ,MAAM,gBAAgB,QAAQ,IAAI;AAClC,MAAM,iBAA0C;AAAA,EAC9C,SAAS;AAAA,EACT,SAAS;AACX;AAKO,MAAM,mBAAmB,CAC9B,YACmB;AACnB,QAAM,gBAAgB,EAAE,GAAG,gBAAgB,GAAG,QAAQ;AACtD,QAAM,EAAE,SAAS,QAAQ,IAAI;AAE7B,MAAI,CAAC,qBAAqB;AAExB,UAAM,EAAE,uBAAuB,uBAAuB,QACpD,wDAAwB,OAAO;AAGjC,QAAI;AAEJ,QAAI,uBAAuB;AACzB,gCAAsB,oDAAsB,qBAAqB;AAAA,IACnE;AAGA,8BAAsB;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AAEA,kCAA8B;AAC9B,mCAA+B;AAAA,EACjC;AAGA,MAAI;AACF;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAEF,SAAO;AACT;AAEA,MAAM,sBAAsB,CAC1B,wBACA,0BACG;AACH,MAAI,2BAA2B,GAAG;AAChC,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 { 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(customConfiguration);\n\n storedConfigurationFilePath = configurationFilePath;\n storedNumCustomConfiguration = numCustomConfiguration;\n }\n\n // Log warning if multiple configuration files are found\n if (verbose) {\n logConfigFileResult(\n storedNumCustomConfiguration,\n storedConfigurationFilePath\n );\n }\n\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,0DAAyB,mBAAmB;AAElE,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":[]}
@@ -34,60 +34,63 @@ module.exports = __toCommonJS(loadConfigurationFile_exports);
34
34
  var import_vm = require("vm");
35
35
  var import_esbuild = require("esbuild");
36
36
  var import_react = __toESM(require("react"));
37
- var import_detectPlatform = require('../envVariables/detectPlatform.cjs');
38
37
  var import_loadEnvFile = require('../envVariables/loadEnvFile.cjs');
39
- var import_ESMxCJSRequire = require('../utils/ESMxCJSRequire.cjs');
40
38
  var import_logger = require('../logger.cjs');
41
- if ((0, import_detectPlatform.getPlatform)() === "unknown") {
42
- (0, import_loadEnvFile.loadEnvFile)();
43
- }
44
- const sandboxContext = {
45
- exports: {
46
- default: {}
47
- },
48
- module: {
49
- exports: {}
50
- },
51
- React: import_react.default,
52
- process,
53
- console,
54
- require: import_ESMxCJSRequire.ESMxCJSRequire
39
+ var import_ESMxCJSRequire = require('../utils/ESMxCJSRequire.cjs');
40
+ const getSandBoxContext = (envVarOptions) => {
41
+ const sandboxContext = {
42
+ exports: {
43
+ default: {}
44
+ },
45
+ module: {
46
+ exports: {}
47
+ },
48
+ React: import_react.default,
49
+ process: { ...process, env: (0, import_loadEnvFile.loadEnvFile)(envVarOptions) },
50
+ console,
51
+ require: import_ESMxCJSRequire.ESMxCJSRequire
52
+ };
53
+ return sandboxContext;
55
54
  };
56
- const define = {};
57
- for (const k in process.env) {
58
- define[`process.env.${k}`] = JSON.stringify(process.env[k]);
59
- }
60
- const transformationOption = {
61
- loader: {
62
- ".js": "js",
63
- ".jsx": "jsx",
64
- ".mjs": "js",
65
- ".ts": "ts",
66
- ".tsx": "tsx",
67
- ".cjs": "js",
68
- ".json": "json"
69
- },
70
- format: "cjs",
71
- // Output format as commonjs
72
- target: "es2017",
73
- packages: "external",
74
- write: false,
75
- bundle: true,
76
- define
55
+ const getTransformationOptions = () => {
56
+ const define = {};
57
+ for (const k in process.env) {
58
+ define[`process.env.${k}`] = JSON.stringify(process.env[k]);
59
+ }
60
+ const transformationOption = {
61
+ loader: {
62
+ ".js": "js",
63
+ ".jsx": "jsx",
64
+ ".mjs": "js",
65
+ ".ts": "ts",
66
+ ".tsx": "tsx",
67
+ ".cjs": "js",
68
+ ".json": "json"
69
+ },
70
+ format: "cjs",
71
+ // Output format as commonjs
72
+ target: "es2017",
73
+ packages: "external",
74
+ write: false,
75
+ bundle: true,
76
+ define
77
+ };
78
+ return transformationOption;
77
79
  };
78
80
  const filterValidConfiguration = (configuration) => {
79
81
  return configuration;
80
82
  };
81
- const loadConfigurationFile = (configFilePath) => {
83
+ const loadConfigurationFile = (configFilePath, envVarOptions) => {
82
84
  let customConfiguration = void 0;
83
85
  const configFileExtension = configFilePath.split(".").pop() ?? "";
84
86
  try {
85
87
  if (configFileExtension === "json") {
86
88
  return (0, import_ESMxCJSRequire.ESMxCJSRequire)(configFilePath);
87
89
  }
90
+ const sandboxContext = getSandBoxContext(envVarOptions);
88
91
  const moduleResult = (0, import_esbuild.buildSync)({
89
92
  entryPoints: [configFilePath],
90
- ...transformationOption
93
+ ...getTransformationOptions()
91
94
  });
92
95
  const moduleResultString = moduleResult.outputFiles?.[0].text;
93
96
  if (!moduleResultString) {
@@ -1 +1 @@
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';\nimport { logger } from '../logger';\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 logger('Configuration file could not be loaded.', { level: 'error' });\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 logger('Configuration file could not be loaded.');\n return undefined;\n }\n\n return filterValidConfiguration(customConfiguration);\n } catch (error) {\n logger(`Error: ${error}`, { level: 'error' });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA8C;AAC9C,qBAA+D;AAC/D,mBAAkB;AA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AElD,QACE,eAAe,QAAQ,WACvB,OAAO,KAAK,eAAe,QAAQ,OAAO,EAAE,SAAS,GACrD;AAEA,4BAAsB,eAAe,QAAQ;AAAA,IAC/C,WACE,eAAe,OAAO,QAAQ,YAC9B,OAAO,KAAK,eAAe,OAAO,QAAQ,QAAQ,EAAE,SAAS,GAC7D;AAEA,4BAAsB,eAAe,OAAO,QAAQ;AAAA,IACtD,WACE,eAAe,OAAO,QAAQ,WAC9B,OAAO,KAAK,eAAe,OAAO,QAAQ,OAAO,EAAE,SAAS,GAC5D;AAEA,4BAAsB,eAAe,OAAO,QAAQ;AAAA,IACtD,WACE,eAAe,OAAO,WACtB,OAAO,KAAK,eAAe,OAAO,OAAO,EAAE,SAAS,GACpD;AAEA,4BAAsB,eAAe,OAAO;AAAA,IAC9C;AAEA,QAAI,OAAO,wBAAwB,aAAa;AAC9C,gCAAO,yCAAyC;AAChD,aAAO;AAAA,IACT;AAEA,WAAO,yBAAyB,mBAAmB;AAAA,EACrD,SAAS,OAAO;AACd,8BAAO,UAAU,KAAK,IAAI,EAAE,OAAO,QAAQ,CAAC;AAAA,EAC9C;AACF;","names":["React"]}
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 {\n loadEnvFile,\n type LoadEnvFileOptions,\n} from '../envVariables/loadEnvFile';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig } from '../types/config';\nimport { ESMxCJSRequire } from '../utils/ESMxCJSRequire';\n\nconst getSandBoxContext = (envVarOptions?: LoadEnvFileOptions): Context => {\n const sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n React,\n process: { ...process, env: loadEnvFile(envVarOptions) },\n console,\n require: ESMxCJSRequire,\n };\n\n return sandboxContext;\n};\n\nconst getTransformationOptions = (): BuildOptions => {\n const define: Record<string, string> = {};\n\n for (const k in process.env) {\n define[`process.env.${k}`] = JSON.stringify(process.env[k]);\n }\n\n const 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\n return transformationOption;\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 envVarOptions?: LoadEnvFileOptions\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 const sandboxContext = getSandBoxContext(envVarOptions);\n\n // Rest is JS, MJS or TS\n\n const moduleResult: BuildResult = buildSync({\n entryPoints: [configFilePath],\n ...getTransformationOptions(),\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n if (!moduleResultString) {\n logger('Configuration file could not be loaded.', { level: 'error' });\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 logger('Configuration file could not be loaded.');\n return undefined;\n }\n\n return filterValidConfiguration(customConfiguration);\n } catch (error) {\n logger(`Error: ${error}`, { level: 'error' });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA8C;AAC9C,qBAA+D;AAC/D,mBAAkB;AAClB,yBAGO;AACP,oBAAuB;AAEvB,4BAA+B;AAE/B,MAAM,oBAAoB,CAAC,kBAAgD;AACzE,QAAM,iBAA0B;AAAA,IAC9B,SAAS;AAAA,MACP,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,QAAQ;AAAA,MACN,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,oBAAAA;AAAA,IACA,SAAS,EAAE,GAAG,SAAS,SAAK,gCAAY,aAAa,EAAE;AAAA,IACvD;AAAA,IACA,SAAS;AAAA,EACX;AAEA,SAAO;AACT;AAEA,MAAM,2BAA2B,MAAoB;AACnD,QAAM,SAAiC,CAAC;AAExC,aAAW,KAAK,QAAQ,KAAK;AAC3B,WAAO,eAAe,CAAC,EAAE,IAAI,KAAK,UAAU,QAAQ,IAAI,CAAC,CAAC;AAAA,EAC5D;AAEA,QAAM,uBAAqC;AAAA,IACzC,QAAQ;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,SAAS;AAAA,IACX;AAAA,IACA,QAAQ;AAAA;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,2BAA2B,CAC/B,kBACyB;AAEzB,SAAO;AACT;AAQO,MAAM,wBAAwB,CACnC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- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
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
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var content_exports = {};
30
20
  __export(content_exports, {
@@ -42,7 +32,6 @@ __export(content_exports, {
42
32
  WATCH: () => WATCH
43
33
  });
44
34
  module.exports = __toCommonJS(content_exports);
45
- var import_process = __toESM(require("process"));
46
35
  const FILE_EXTENSIONS = [
47
36
  ".content.ts",
48
37
  ".content.js",
@@ -62,7 +51,7 @@ const I18NEXT_DICTIONARIES_DIR_NAME = "i18next_resources";
62
51
  const REACT_INTL_MESSAGES_DIR_NAME = "intl_messages";
63
52
  const TYPES_DIR_NAME = "types";
64
53
  const MAIN_DIR_NAME = "main";
65
- const WATCH = import_process.default.env.NODE_ENV === "development";
54
+ const WATCH = process.env.NODE_ENV === "development";
66
55
  // Annotate the CommonJS export names for ESM import in node:
67
56
  0 && (module.exports = {
68
57
  CONTENT_DIR_NAME,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["import process from 'process';\nimport type { DictionaryOutput } from '../types/config';\n\nexport const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.mjs',\n '.content.json',\n '.content.tsx',\n '.content.jsx',\n];\nexport const EXCLUDED_PATHS = ['node_modules'];\n\nexport const CONTENT_DIR_NAME = 'src';\n\nexport const RESULT_DIR_NAME = '.intlayer';\n\nexport const MODULE_AUGMENTATION_DIR_NAME = '.intlayer/types';\n\nexport const DICTIONARY_OUTPUT: DictionaryOutput[] = ['intlayer'];\n\nexport const DICTIONARIES_DIR_NAME = 'dictionary';\n\nexport const I18NEXT_DICTIONARIES_DIR_NAME = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR_NAME = 'intl_messages';\n\nexport const TYPES_DIR_NAME = 'types';\n\nexport const MAIN_DIR_NAME = 'main';\n\nexport const WATCH = process.env.NODE_ENV === 'development';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AAGb,MAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,iBAAiB,CAAC,cAAc;AAEtC,MAAM,mBAAmB;AAEzB,MAAM,kBAAkB;AAExB,MAAM,+BAA+B;AAErC,MAAM,oBAAwC,CAAC,UAAU;AAEzD,MAAM,wBAAwB;AAE9B,MAAM,gCAAgC;AAEtC,MAAM,+BAA+B;AAErC,MAAM,iBAAiB;AAEvB,MAAM,gBAAgB;AAEtB,MAAM,QAAQ,eAAAA,QAAQ,IAAI,aAAa;","names":["process"]}
1
+ {"version":3,"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["import type { DictionaryOutput } from '../types/config';\n\nexport const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.mjs',\n '.content.json',\n '.content.tsx',\n '.content.jsx',\n];\nexport const EXCLUDED_PATHS = ['node_modules'];\n\nexport const CONTENT_DIR_NAME = 'src';\n\nexport const RESULT_DIR_NAME = '.intlayer';\n\nexport const MODULE_AUGMENTATION_DIR_NAME = '.intlayer/types';\n\nexport const DICTIONARY_OUTPUT: DictionaryOutput[] = ['intlayer'];\n\nexport const DICTIONARIES_DIR_NAME = 'dictionary';\n\nexport const I18NEXT_DICTIONARIES_DIR_NAME = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR_NAME = 'intl_messages';\n\nexport const TYPES_DIR_NAME = 'types';\n\nexport const MAIN_DIR_NAME = 'main';\n\nexport const WATCH = process.env.NODE_ENV === 'development';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,iBAAiB,CAAC,cAAc;AAEtC,MAAM,mBAAmB;AAEzB,MAAM,kBAAkB;AAExB,MAAM,+BAA+B;AAErC,MAAM,oBAAwC,CAAC,UAAU;AAEzD,MAAM,wBAAwB;AAE9B,MAAM,gCAAgC;AAEtC,MAAM,+BAA+B;AAErC,MAAM,iBAAiB;AAEvB,MAAM,gBAAgB;AAEtB,MAAM,QAAQ,QAAQ,IAAI,aAAa;","names":[]}
@@ -20,6 +20,7 @@ var editor_exports = {};
20
20
  __export(editor_exports, {
21
21
  APPLICATION_URL: () => APPLICATION_URL,
22
22
  BACKEND_URL: () => BACKEND_URL,
23
+ CMS_URL: () => CMS_URL,
23
24
  DICTIONARY_PRIORITY_STRATEGY: () => DICTIONARY_PRIORITY_STRATEGY,
24
25
  EDITOR_URL: () => EDITOR_URL,
25
26
  IS_ENABLED: () => IS_ENABLED,
@@ -28,6 +29,7 @@ __export(editor_exports, {
28
29
  module.exports = __toCommonJS(editor_exports);
29
30
  const APPLICATION_URL = "";
30
31
  const EDITOR_URL = "http://localhost:8000";
32
+ const CMS_URL = "https://intlayer.org";
31
33
  const PORT = 8e3;
32
34
  const BACKEND_URL = "https://back.intlayer.org";
33
35
  const IS_ENABLED = true;
@@ -36,6 +38,7 @@ const DICTIONARY_PRIORITY_STRATEGY = "locale_first";
36
38
  0 && (module.exports = {
37
39
  APPLICATION_URL,
38
40
  BACKEND_URL,
41
+ CMS_URL,
39
42
  DICTIONARY_PRIORITY_STRATEGY,
40
43
  EDITOR_URL,
41
44
  IS_ENABLED,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = '';\nexport const EDITOR_URL = 'http://localhost:8000';\nexport const PORT = 8000;\nexport const BACKEND_URL = 'https://back.intlayer.org';\nexport const IS_ENABLED = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'locale_first';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,kBAAkB;AACxB,MAAM,aAAa;AACnB,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,+BAA+B;","names":[]}
1
+ {"version":3,"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = '';\nexport const EDITOR_URL = 'http://localhost:8000';\nexport const CMS_URL = 'https://intlayer.org';\nexport const PORT = 8000;\nexport const BACKEND_URL = 'https://back.intlayer.org';\nexport const IS_ENABLED = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'locale_first';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,kBAAkB;AACxB,MAAM,aAAa;AACnB,MAAM,UAAU;AAChB,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,+BAA+B;","names":[]}
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
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
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var detectPlatform_exports = {};
30
20
  __export(detectPlatform_exports, {
@@ -32,17 +22,18 @@ __export(detectPlatform_exports, {
32
22
  getPrefix: () => getPrefix
33
23
  });
34
24
  module.exports = __toCommonJS(detectPlatform_exports);
35
- var import_process = __toESM(require("process"));
36
25
  const import_meta = {};
37
26
  const getPlatform = () => {
38
27
  if (typeof import_meta !== "undefined" && typeof import_meta.env !== "undefined" && typeof import_meta.env.VITE_INTLAYER_DEFAULT_LOCALE !== "undefined") {
39
28
  return "vite";
40
- } else if (typeof import_process.default.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE !== "undefined") {
29
+ } else if (typeof process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE !== "undefined") {
41
30
  return "next";
42
- } else if (typeof import_process.default.env.REACT_APP_INTLAYER_DEFAULT_LOCALE !== "undefined") {
31
+ } else if (typeof process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE !== "undefined") {
43
32
  return "react_app";
33
+ } else if (typeof process.env.INTLAYER_DEFAULT_LOCALE !== "undefined") {
34
+ return "node";
44
35
  }
45
- return "unknown";
36
+ return void 0;
46
37
  };
47
38
  const getPrefix = (platform) => {
48
39
  switch (platform) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/envVariables/detectPlatform.ts"],"sourcesContent":["import process from 'process';\n\nexport type Platform = 'next' | 'vite' | 'react_app' | 'unknown';\n\nexport const getPlatform = (): Platform => {\n if (\n typeof import.meta !== 'undefined' &&\n typeof import.meta.env !== 'undefined' &&\n typeof import.meta.env.VITE_INTLAYER_DEFAULT_LOCALE !== 'undefined'\n ) {\n // Likely Vite\n return 'vite';\n } else if (\n typeof process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE !== 'undefined'\n ) {\n // Likely Next.js\n return 'next';\n } else if (\n typeof process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE !== 'undefined'\n ) {\n // Likely Create React App\n return 'react_app';\n }\n\n return 'unknown';\n};\n\n/**\n * Get the prefix for the environment variables to be used in the platform\n */\nexport const getPrefix = (platform: Platform): string => {\n switch (platform) {\n case 'next':\n return 'NEXT_PUBLIC_INTLAYER_';\n case 'vite':\n return 'VITE_INTLAYER_';\n case 'react_app':\n return 'REACT_APP_INTLAYER_';\n default:\n return 'INTLAYER_';\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AAApB;AAIO,MAAM,cAAc,MAAgB;AACzC,MACE,OAAO,gBAAgB,eACvB,OAAO,YAAY,QAAQ,eAC3B,OAAO,YAAY,IAAI,iCAAiC,aACxD;AAEA,WAAO;AAAA,EACT,WACE,OAAO,eAAAA,QAAQ,IAAI,wCAAwC,aAC3D;AAEA,WAAO;AAAA,EACT,WACE,OAAO,eAAAA,QAAQ,IAAI,sCAAsC,aACzD;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAKO,MAAM,YAAY,CAAC,aAA+B;AACvD,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":["process"]}
1
+ {"version":3,"sources":["../../../src/envVariables/detectPlatform.ts"],"sourcesContent":["export type Platform = 'next' | 'vite' | 'react_app' | 'node' | undefined;\n\nexport const getPlatform = (): Platform => {\n if (\n typeof import.meta !== 'undefined' &&\n typeof import.meta.env !== 'undefined' &&\n typeof import.meta.env.VITE_INTLAYER_DEFAULT_LOCALE !== 'undefined'\n ) {\n // Likely Vite\n return 'vite';\n } else if (\n typeof process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE !== 'undefined'\n ) {\n // Likely Next.js\n return 'next';\n } else if (\n typeof process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE !== 'undefined'\n ) {\n // Likely Create React App\n return 'react_app';\n } else if (typeof process.env.INTLAYER_DEFAULT_LOCALE !== 'undefined') {\n return 'node';\n }\n\n return undefined;\n};\n\n/**\n * Get the prefix for the environment variables to be used in the platform\n */\nexport const getPrefix = (platform: Platform): string => {\n switch (platform) {\n case 'next':\n return 'NEXT_PUBLIC_INTLAYER_';\n case 'vite':\n return 'VITE_INTLAYER_';\n case 'react_app':\n return 'REACT_APP_INTLAYER_';\n default:\n return 'INTLAYER_';\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,cAAc,MAAgB;AACzC,MACE,OAAO,gBAAgB,eACvB,OAAO,YAAY,QAAQ,eAC3B,OAAO,YAAY,IAAI,iCAAiC,aACxD;AAEA,WAAO;AAAA,EACT,WACE,OAAO,QAAQ,IAAI,wCAAwC,aAC3D;AAEA,WAAO;AAAA,EACT,WACE,OAAO,QAAQ,IAAI,sCAAsC,aACzD;AAEA,WAAO;AAAA,EACT,WAAW,OAAO,QAAQ,IAAI,4BAA4B,aAAa;AACrE,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAKO,MAAM,YAAY,CAAC,aAA+B;AACvD,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/index.ts"],"sourcesContent":["import { type Platform, getPlatform } from '../detectPlatform';\nimport { extractNextEnvVariable } from './next';\nimport { extractReactAppEnvVariable } from './react_app';\nimport type { IntlayerConfigEnvVariable } from './types';\nimport { extractEmptyEnvVariable } from './undefined_platform';\nimport { extractViteEnvVariable } from './vite';\n\nexport type ExtractEnvVariableOptions = {\n platform?: Platform;\n};\n\nexport const extractEnvVariable = (\n options?: ExtractEnvVariableOptions\n): IntlayerConfigEnvVariable => {\n const platform: Platform = options?.platform ?? getPlatform();\n\n if (platform === 'vite') {\n return extractViteEnvVariable();\n } else if (platform === 'next') {\n return extractNextEnvVariable();\n } else if (platform === 'react_app') {\n return extractReactAppEnvVariable();\n }\n\n return extractEmptyEnvVariable();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2C;AAC3C,kBAAuC;AACvC,uBAA2C;AAE3C,gCAAwC;AACxC,kBAAuC;AAMhC,MAAM,qBAAqB,CAChC,YAC8B;AAC9B,QAAM,WAAqB,SAAS,gBAAY,mCAAY;AAE5D,MAAI,aAAa,QAAQ;AACvB,eAAO,oCAAuB;AAAA,EAChC,WAAW,aAAa,QAAQ;AAC9B,eAAO,oCAAuB;AAAA,EAChC,WAAW,aAAa,aAAa;AACnC,eAAO,6CAA2B;AAAA,EACpC;AAEA,aAAO,mDAAwB;AACjC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/index.ts"],"sourcesContent":["import { type Platform, getPlatform } from '../detectPlatform';\nimport { extractNextEnvVariable } from './next';\nimport { extractReactAppEnvVariable } from './react_app';\nimport type { IntlayerConfigEnvVariable } from './types';\nimport { extractEmptyEnvVariable } from './undefined_platform';\nimport { extractViteEnvVariable } from './vite';\n\nexport type ExtractEnvVariableOptions = {\n platform?: Platform;\n};\n\nexport const extractEnvVariable = (\n options?: ExtractEnvVariableOptions\n): IntlayerConfigEnvVariable => {\n const platform = options?.platform ?? getPlatform();\n\n if (platform === 'vite') {\n return extractViteEnvVariable();\n } else if (platform === 'next') {\n return extractNextEnvVariable();\n } else if (platform === 'react_app') {\n return extractReactAppEnvVariable();\n }\n\n return extractEmptyEnvVariable();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2C;AAC3C,kBAAuC;AACvC,uBAA2C;AAE3C,gCAAwC;AACxC,kBAAuC;AAMhC,MAAM,qBAAqB,CAChC,YAC8B;AAC9B,QAAM,WAAW,SAAS,gBAAY,mCAAY;AAElD,MAAI,aAAa,QAAQ;AACvB,eAAO,oCAAuB;AAAA,EAChC,WAAW,aAAa,QAAQ;AAC9B,eAAO,oCAAuB;AAAA,EAChC,WAAW,aAAa,aAAa;AACnC,eAAO,6CAA2B;AAAA,EACpC;AAEA,aAAO,mDAAwB;AACjC;","names":[]}