@intlayer/config 3.5.5 → 3.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/configFile/buildConfigurationFields.cjs +39 -9
- package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
- package/dist/cjs/defaultValues/content.cjs +6 -3
- package/dist/cjs/defaultValues/content.cjs.map +1 -1
- package/dist/cjs/envVariables/extractEnvVariable/next.cjs +4 -2
- package/dist/cjs/envVariables/extractEnvVariable/next.cjs.map +1 -1
- package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs +4 -2
- package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs.map +1 -1
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs +4 -2
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs.map +1 -1
- package/dist/cjs/envVariables/extractEnvVariable/vite.cjs +4 -2
- package/dist/cjs/envVariables/extractEnvVariable/vite.cjs.map +1 -1
- package/dist/cjs/envVariables/getConfiguration.cjs +12 -4
- package/dist/cjs/envVariables/getConfiguration.cjs.map +1 -1
- package/dist/cjs/logger.cjs.map +1 -1
- package/dist/cjs/types/config.cjs.map +1 -1
- package/dist/esm/configFile/buildConfigurationFields.mjs +42 -11
- package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
- package/dist/esm/defaultValues/content.mjs +4 -2
- package/dist/esm/defaultValues/content.mjs.map +1 -1
- package/dist/esm/envVariables/extractEnvVariable/next.mjs +4 -2
- package/dist/esm/envVariables/extractEnvVariable/next.mjs.map +1 -1
- package/dist/esm/envVariables/extractEnvVariable/react_app.mjs +4 -2
- package/dist/esm/envVariables/extractEnvVariable/react_app.mjs.map +1 -1
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs +4 -2
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs.map +1 -1
- package/dist/esm/envVariables/extractEnvVariable/vite.mjs +4 -2
- package/dist/esm/envVariables/extractEnvVariable/vite.mjs.map +1 -1
- package/dist/esm/envVariables/getConfiguration.mjs +12 -4
- package/dist/esm/envVariables/getConfiguration.mjs.map +1 -1
- package/dist/esm/logger.mjs.map +1 -1
- package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
- package/dist/types/defaultValues/content.d.ts +2 -1
- package/dist/types/defaultValues/content.d.ts.map +1 -1
- package/dist/types/envVariables/extractEnvVariable/next.d.ts.map +1 -1
- package/dist/types/envVariables/extractEnvVariable/react_app.d.ts.map +1 -1
- package/dist/types/envVariables/extractEnvVariable/undefined_platform.d.ts.map +1 -1
- package/dist/types/envVariables/extractEnvVariable/vite.d.ts.map +1 -1
- package/dist/types/envVariables/getConfiguration.d.ts.map +1 -1
- package/dist/types/logger.d.ts +1 -1
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/types/config.d.ts +29 -8
- package/dist/types/types/config.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/types/config.ts"],"sourcesContent":["import type { Locales } from './locales';\n\nexport type StrictMode = 'strict' | 'required_only' | 'loose';\n\n/**\n * Configuration for internationalization settings\n */\nexport type InternationalizationConfig = {\n /**\n * Locales available in the application\n *\n * Default: [Locales.ENGLISH]\n *\n * You can define a list of available locales to support in the application.\n */\n 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: StrictMode;\n /**\n * Default locale of the application for fallback\n *\n * Default: Locales.ENGLISH\n *\n * Used to specify a fallback locale in case no other locale is set.\n */\n defaultLocale: Locales;\n};\n\nexport type ServerSetCookieRule = 'always' | 'never';\n\n/**\n * Configuration for middleware behaviors\n */\nexport type MiddlewareConfig = {\n /**\n * Header name to get the locale from the request\n *\n * Default: 'x-intlayer-locale'\n *\n * The HTTP header key used to determine the current locale.\n */\n headerName: string;\n\n /**\n * Cookie name to store the locale information\n *\n * Default: 'INTLAYER_LOCALE'\n *\n * The cookie key where the locale information is stored.\n */\n cookieName: string;\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: boolean;\n\n /**\n * Base path for application URLs\n *\n * Default: ''\n *\n * Defines the base path where the application is accessible from.\n */\n basePath: string;\n\n /**\n * Strategy for setting the locale cookie on the server\n *\n * Default: 'always'\n *\n * This setting controls when the server sets the locale cookie. It can either set the cookie on every request or never set it.\n */\n serverSetCookie: ServerSetCookieRule;\n\n /**\n * Indicates if no prefix should be used in the URL for locale\n *\n * Default: false\n *\n * If true, no locale-based prefix is used in the URL.\n */\n noPrefix: boolean;\n};\n\n/**\n * Configuration for intlayer editor\n */\nexport type EditorConfig = {\n /**\n * URL of the backend\n *\n * Default: 'https://back.intlayer.org'\n *\n * The URL of the backend server.\n */\n backendURL: string;\n\n /**\n * Indicates if the editor is active\n *\n * Default: true;\n *\n * If true, the editor is active and can be accessed.\n * If false, the editor is inactive and cannot be accessed.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV === 'development',\n * }\n * };\n * ```\n *\n */\n enabled: boolean;\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://back.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?: string;\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://back.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?: string;\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: 'locale_first' | 'distant_first';\n};\n\n/**\n * Custom configuration that can be provided to override default settings\n */\nexport type CustomIntlayerConfig = {\n /**\n * Custom internationalization configuration\n */\n internationalization?: Partial<InternationalizationConfig>;\n\n /**\n * Custom middleware configuration\n */\n middleware?: Partial<MiddlewareConfig>;\n\n /**\n * Custom content configuration\n */\n content?: Partial<ContentConfig>;\n\n /**\n * Custom editor configuration\n */\n editor?: Partial<EditorConfig>;\n\n /**\n * Custom middleware configuration\n */\n log?: Partial<LogConfig>;\n};\n\n/**\n * Combined configuration for internationalization, middleware, and content\n */\nexport type IntlayerConfig = {\n /**\n * Internationalization configuration\n */\n internationalization: InternationalizationConfig;\n\n /**\n * Middleware configuration\n */\n middleware: MiddlewareConfig;\n\n /**\n * Content configuration\n */\n content: ContentConfig;\n\n /**\n * Intlayer editor configuration\n */\n editor: EditorConfig;\n\n /**\n * Logger configuration\n */\n log: LogConfig;\n};\n\n/**\n * Base configuration for content handling\n */\nexport type BaseContentConfig = {\n /**\n * File extensions of content to look for\n *\n * Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']\n *\n * List of file extensions to scan for content.\n */\n fileExtensions: string[];\n\n /**\n * Absolute path of the project's base directory\n *\n * Default: process.cwd()\n *\n * The root directory of the project, typically used for resolving other paths.\n */\n baseDir: string;\n\n /**\n * Name of the directory where the content is stored\n *\n * Default: 'src'\n *\n * Specifies the directory where the primary content is stored.\n */\n contentDirName: string;\n\n /**\n * Directories to be excluded from content processing\n *\n * Default: ['node_modules']\n *\n * A list of directories to exclude from content processing.\n */\n excludedPath: string[];\n\n /**\n * Name of the directory where results are stored\n *\n * Default: '.intlayer'\n *\n * The directory for storing intermediate or output results.\n */\n resultDirName: string;\n\n /**\n * Name of the directory for module augmentation\n *\n * Default: 'types'\n *\n * Defines the directory for additional module types.\n */\n moduleAugmentationDirName: string;\n\n /**\n * Name of the directory where dictionaries are stored\n *\n * Default: 'dictionary'\n *\n * The directory for storing localization dictionaries.\n *\n * Note:\n * - Ensure the dictionaries output includes intlayer to build the dictionaries for intlayer\n */\n dictionariesDirName: string;\n\n /**\n * Name of the directory where dictionaries are stored\n *\n * Default: 'i18n_dictionary'\n *\n * The directory for storing localization dictionaries.\n *\n * Note:\n * - Ensure the dictionaries output includes 'i18next' to build the dictionaries for i18next\n */\n i18nDictionariesDirName: string;\n\n /**\n * Name of the directory where dictionary types are stored\n *\n * Default: 'types'\n *\n * The directory for storing dictionary type definitions.\n */\n typeDirName: string;\n\n /**\n * Name of the directory where the main files are stored\n *\n * Default: 'main'\n *\n * Specifies the directory for storing main application files.\n */\n mainDirName: string;\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: boolean;\n};\n\nexport type DictionaryOutput = 'intlayer' | 'i18next';\n\n/**\n * Configuration derived based on the base content configuration\n */\nexport type BaseDerivedConfig = {\n /**\n * Directory where the content is stored, relative to the base directory\n *\n * Default: {{baseDir}} / {{contentDirName}}\n *\n * Derived content directory based on the base configuration.\n */\n contentDir: string;\n\n /**\n * Directory where the results are stored, relative to the base directory\n *\n * Default: {{baseDir}} / {{resultDirName}}\n *\n * Derived results directory based on the base configuration.\n */\n resultDir: string;\n\n /**\n * Directory for module augmentation, relative to the base directory\n *\n * Default: {{baseDir}} / {{moduleAugmentationDirName}}\n *\n * Defines the derived path for module augmentation.\n */\n moduleAugmentationDir: string;\n\n /**\n * Type of dictionary to use as an output\n *\n * Default: ['intlayer']\n *\n * The type of dictionary to use as an output. It can be either 'intlayer' or 'i18next'.\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 */\n dictionaryOutput: DictionaryOutput[];\n};\n\n/**\n * Configuration derived based on the result directory\n */\nexport type ResultDirDerivedConfig = {\n /**\n * Directory where dictionaries are stored, relative to the result directory\n *\n * Default: {{resultDir}} / {{dictionariesDirName}}\n *\n * Specifies the derived path for dictionaries relative to the result directory.\n */\n dictionariesDir: string;\n\n /**\n *\n * Directory where dictionaries are stored, relative to the result directory\n *\n * Default: {{resultDir}} / {{i18nDictionariesDirName}}\n *\n * Specifies the derived path for dictionaries relative to the result directory.\n *\n * Note:\n * - Ensure the i18n dictionaries output includes i18next to build the dictionaries for i18next\n */\n i18nDictionariesDir: string;\n\n /**\n * Directory where dictionary types are stored, relative to the result directory\n *\n * Default: {{resultDir}} / {{typeDirName}}\n *\n * Specifies the derived path for dictionary types relative to the result directory.\n */\n typesDir: string;\n\n /**\n * Directory where the main files are stored, relative to the result directory\n *\n * Default: {{resultDir}} / {{mainDirName}}\n *\n * Specifies the derived path for the main files relative to the result directory.\n */\n mainDir: string;\n};\n\n/**\n * Configuration for content patterns\n */\nexport type PatternsContentConfig = {\n /**\n * Patterns of files to watch for changes\n *\n * Default: ['/**\\/*.content.ts', '/**\\/*.content.js', '/**\\/*.content.json', '/**\\/*.content.cjs', '/**\\/*.content.mjs', '/**\\/*.content.tsx', '/**\\/*.content.jsx']\n *\n * Defines file patterns for content to watch for changes.\n */\n watchedFilesPattern: string[];\n\n /**\n * Patterns of files to watch for changes 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 * Specifies the file patterns for content to watch, including relative paths.\n */\n watchedFilesPatternWithPath: string[];\n\n /**\n * Pattern for output files including the relative path\n *\n * Default: '{{dictionariesDir}}/**\\/*.json'\n *\n * Defines the pattern for output files, including the relative path.\n */\n outputFilesPatternWithPath: string;\n};\n\n// @TODO: Implement exclusion of non configurable fields, to not allow them to be set in the config\n/**\n * General configuration derived from the config file\n */\nexport type ContentConfig = BaseContentConfig &\n BaseDerivedConfig &\n ResultDirDerivedConfig &\n PatternsContentConfig;\n\nexport type LogConfig = {\n /**\n * Indicates if the logger is enabled\n *\n * Default: true\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: 'default' | 'verbose' | 'disabled';\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: string;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/types/config.ts"],"sourcesContent":["import type { Locales } from './locales';\n\nexport type StrictMode = 'strict' | 'required_only' | 'loose';\n\n/**\n * Configuration for internationalization settings\n */\nexport type InternationalizationConfig = {\n /**\n * Locales available in the application\n *\n * Default: [Locales.ENGLISH]\n *\n * You can define a list of available locales to support in the application.\n */\n 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: StrictMode;\n /**\n * Default locale of the application for fallback\n *\n * Default: Locales.ENGLISH\n *\n * Used to specify a fallback locale in case no other locale is set.\n */\n defaultLocale: Locales;\n};\n\nexport type ServerSetCookieRule = 'always' | 'never';\n\n/**\n * Configuration for middleware behaviors\n */\nexport type MiddlewareConfig = {\n /**\n * Header name to get the locale from the request\n *\n * Default: 'x-intlayer-locale'\n *\n * The HTTP header key used to determine the current locale.\n */\n headerName: string;\n\n /**\n * Cookie name to store the locale information\n *\n * Default: 'INTLAYER_LOCALE'\n *\n * The cookie key where the locale information is stored.\n */\n cookieName: string;\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: boolean;\n\n /**\n * Base path for application URLs\n *\n * Default: ''\n *\n * Defines the base path where the application is accessible from.\n */\n basePath: string;\n\n /**\n * Strategy for setting the locale cookie on the server\n *\n * Default: 'always'\n *\n * This setting controls when the server sets the locale cookie. It can either set the cookie on every request or never set it.\n */\n serverSetCookie: ServerSetCookieRule;\n\n /**\n * Indicates if no prefix should be used in the URL for locale\n *\n * Default: false\n *\n * If true, no locale-based prefix is used in the URL.\n */\n noPrefix: boolean;\n};\n\n/**\n * Configuration for intlayer editor\n */\nexport type EditorConfig = {\n /**\n * URL of the backend\n *\n * Default: 'https://back.intlayer.org'\n *\n * The URL of the backend server.\n */\n backendURL: string;\n\n /**\n * Indicates if the editor is active\n *\n * Default: true;\n *\n * If true, the editor is active and can be accessed.\n * If false, the editor is inactive and cannot be accessed.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV === 'development',\n * }\n * };\n * ```\n *\n */\n enabled: boolean;\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?: string;\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?: string;\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: 'locale_first' | 'distant_first';\n};\n\n/**\n * Custom configuration that can be provided to override default settings\n */\nexport type CustomIntlayerConfig = {\n /**\n * Custom internationalization configuration\n */\n internationalization?: Partial<InternationalizationConfig>;\n\n /**\n * Custom middleware configuration\n */\n middleware?: Partial<MiddlewareConfig>;\n\n /**\n * Custom content configuration\n */\n content?: Partial<ContentConfig>;\n\n /**\n * Custom editor configuration\n */\n editor?: Partial<EditorConfig>;\n\n /**\n * Custom middleware configuration\n */\n log?: Partial<LogConfig>;\n};\n\n/**\n * Combined configuration for internationalization, middleware, and content\n */\nexport type IntlayerConfig = {\n /**\n * Internationalization configuration\n */\n internationalization: InternationalizationConfig;\n\n /**\n * Middleware configuration\n */\n middleware: MiddlewareConfig;\n\n /**\n * Content configuration\n */\n content: ContentConfig;\n\n /**\n * Intlayer editor configuration\n */\n editor: EditorConfig;\n\n /**\n * Logger configuration\n */\n log: LogConfig;\n};\n\n/**\n * Base configuration for content handling\n */\nexport type BaseContentConfig = {\n /**\n * File extensions of content to look for\n *\n * Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']\n *\n * List of file extensions to scan for content.\n */\n fileExtensions: string[];\n\n /**\n * Absolute path of the project's base directory\n *\n * Default: process.cwd()\n *\n * The root directory of the project, typically used for resolving other paths.\n */\n baseDir: string;\n\n /**\n * Name of the directory where the content is stored\n *\n * Default: 'src'\n *\n * Specifies the directory where the primary content is stored.\n */\n contentDirName: string;\n\n /**\n * Directories to be excluded from content processing\n *\n * Default: ['node_modules']\n *\n * A list of directories to exclude from content processing.\n */\n excludedPath: string[];\n\n /**\n * Name of the directory where results are stored\n *\n * Default: '.intlayer'\n *\n * The directory for storing intermediate or output results.\n */\n resultDirName: string;\n\n /**\n * Name of the directory for module augmentation\n *\n * Default: 'types'\n *\n * Defines the directory for additional module types.\n */\n moduleAugmentationDirName: string;\n\n /**\n * Name of the directory where dictionaries are stored\n *\n * Default: 'dictionary'\n *\n * The directory for storing localization dictionaries.\n *\n * Note:\n * - Ensure the dictionaries output includes intlayer to build the dictionaries for intlayer\n */\n dictionariesDirName: string;\n\n /**\n * Name of the directory where dictionaries are stored\n *\n * Default: 'i18next_dictionary'\n *\n * The directory for storing localization dictionaries.\n *\n * Note:\n * - Ensure the dictionaries output includes 'i18next' to build the dictionaries for i18next\n */\n i18nextResourcesDirName: string;\n\n /**\n * Name of the directory where dictionaries are stored\n *\n * Default: 'react-intl_dictionary'\n *\n * The directory for storing localization dictionaries.\n *\n * Note:\n * - Ensure the dictionaries output includes 'react-intl' to build the dictionaries for react-intl\n */\n reactIntlMessagesDirName: string;\n\n /**\n * Name of the directory where dictionary types are stored\n *\n * Default: 'types'\n *\n * The directory for storing dictionary type definitions.\n */\n typeDirName: string;\n\n /**\n * Name of the directory where the main files are stored\n *\n * Default: 'main'\n *\n * Specifies the directory for storing main application files.\n */\n mainDirName: string;\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: boolean;\n};\n\nexport type DictionaryOutput = 'intlayer' | 'i18next' | 'react-intl';\n\n/**\n * Configuration derived based on the base content configuration\n */\nexport type BaseDerivedConfig = {\n /**\n * Directory where the content is stored, relative to the base directory\n *\n * Default: {{baseDir}} / {{contentDirName}}\n *\n * Derived content directory based on the base configuration.\n */\n contentDir: string;\n\n /**\n * Directory where the results are stored, relative to the base directory\n *\n * Default: {{baseDir}} / {{resultDirName}}\n *\n * Derived results directory based on the base configuration.\n */\n resultDir: string;\n\n /**\n * Directory for module augmentation, relative to the base directory\n *\n * Default: {{baseDir}} / {{moduleAugmentationDirName}}\n *\n * Defines the derived path for module augmentation.\n */\n moduleAugmentationDir: string;\n\n /**\n * Type of dictionary to use as an output\n *\n * Default: ['intlayer']\n *\n * The type of dictionary to use as an output. It can be either 'intlayer' or 'i18next'.\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 */\n dictionaryOutput: DictionaryOutput[];\n};\n\n/**\n * Configuration derived based on the result directory\n */\nexport type ResultDirDerivedConfig = {\n /**\n * Directory where dictionaries are stored, relative to the result directory\n *\n * Default: {{resultDir}} / {{dictionariesDirName}}\n *\n * Specifies the derived path for dictionaries relative to the result directory.\n */\n dictionariesDir: string;\n\n /**\n * Directory where dictionaries are stored, relative to the result directory\n *\n * Default: {{resultDir}} / {{i18nextResourcesDirName}}\n *\n * Specifies the derived path for dictionaries relative to the result directory.\n *\n * Note:\n * - Ensure the i18n dictionaries output includes i18next to build the dictionaries for i18next\n */\n i18nextResourcesDir: string;\n\n /**\n * Directory where dictionaries are stored, relative to the result directory\n *\n * Default: {{resultDir}} / {{reactIntlMessagesDirName}}\n *\n * Specifies the derived path for dictionaries relative to the result directory.\n *\n * Note:\n * - Ensure the dictionaries output includes 'react-intl' to build the dictionaries for react-intl\n */\n reactIntlMessagesDir: string;\n\n /**\n * Directory where dictionary types are stored, relative to the result directory\n *\n * Default: {{resultDir}} / {{typeDirName}}\n *\n * Specifies the derived path for dictionary types relative to the result directory.\n */\n typesDir: string;\n\n /**\n * Directory where the main files are stored, relative to the result directory\n *\n * Default: {{resultDir}} / {{mainDirName}}\n *\n * Specifies the derived path for the main files relative to the result directory.\n */\n mainDir: string;\n};\n\n/**\n * Configuration for content patterns\n */\nexport type PatternsContentConfig = {\n /**\n * Patterns of files to watch for changes\n *\n * Default: ['/**\\/*.content.ts', '/**\\/*.content.js', '/**\\/*.content.json', '/**\\/*.content.cjs', '/**\\/*.content.mjs', '/**\\/*.content.tsx', '/**\\/*.content.jsx']\n *\n * Defines file patterns for content to watch for changes.\n */\n watchedFilesPattern: string[];\n\n /**\n * Patterns of files to watch for changes 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 * Specifies the file patterns for content to watch, including relative paths.\n */\n watchedFilesPatternWithPath: string[];\n\n /**\n * Pattern for output files including the relative path\n *\n * Default: '{{dictionariesDir}}/**\\/*.json'\n *\n * Defines the pattern for output files, including the relative path.\n */\n outputFilesPatternWithPath: string;\n};\n\n// @TODO: Implement exclusion of non configurable fields, to not allow them to be set in the config\n/**\n * General configuration derived from the config file\n */\nexport type ContentConfig = BaseContentConfig &\n BaseDerivedConfig &\n ResultDirDerivedConfig &\n PatternsContentConfig;\n\nexport type LogConfig = {\n /**\n * Indicates if the logger is enabled\n *\n * Default: true\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: 'default' | 'verbose' | 'disabled';\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: string;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
TYPES_DIR_NAME,
|
|
9
9
|
MAIN_DIR_NAME,
|
|
10
10
|
MODULE_AUGMENTATION_DIR_NAME,
|
|
11
|
-
|
|
11
|
+
I18NEXT_DICTIONARIES_DIR_NAME,
|
|
12
12
|
DICTIONARY_OUTPUT,
|
|
13
|
-
WATCH
|
|
13
|
+
WATCH,
|
|
14
|
+
REACT_INTL_MESSAGES_DIR_NAME
|
|
14
15
|
} from '../defaultValues/content.mjs';
|
|
15
16
|
import {
|
|
16
17
|
BACKEND_URL,
|
|
@@ -22,6 +23,7 @@ import {
|
|
|
22
23
|
LOCALES,
|
|
23
24
|
STRICT_MODE
|
|
24
25
|
} from '../defaultValues/internationalization.mjs';
|
|
26
|
+
import { MODE, PREFIX } from '../defaultValues/log.mjs';
|
|
25
27
|
import {
|
|
26
28
|
BASE_PATH,
|
|
27
29
|
COOKIE_NAME,
|
|
@@ -30,7 +32,6 @@ import {
|
|
|
30
32
|
PREFIX_DEFAULT,
|
|
31
33
|
SERVER_SET_COOKIE
|
|
32
34
|
} from '../defaultValues/middleware.mjs';
|
|
33
|
-
import { MODE, PREFIX } from '../defaultValues/log.mjs';
|
|
34
35
|
let storedConfiguration;
|
|
35
36
|
const buildInternationalizationFields = (customConfiguration) => ({
|
|
36
37
|
/**
|
|
@@ -211,7 +212,21 @@ const buildContentFields = (customConfiguration) => {
|
|
|
211
212
|
* - If this directory is not at the result directory level, update the dictionariesDir field instead
|
|
212
213
|
*
|
|
213
214
|
*/
|
|
214
|
-
|
|
215
|
+
i18nextResourcesDirName: customConfiguration?.i18nextResourcesDirName ?? I18NEXT_DICTIONARIES_DIR_NAME,
|
|
216
|
+
/**
|
|
217
|
+
* Related to the intlayer result directory
|
|
218
|
+
*
|
|
219
|
+
* Directory name where the dictionaries will be stored
|
|
220
|
+
*
|
|
221
|
+
* Default: 'react-intl_dictionary'
|
|
222
|
+
*
|
|
223
|
+
* Example: 'translations'
|
|
224
|
+
*
|
|
225
|
+
* Note:
|
|
226
|
+
* - If this directory is not at the result directory level, update the dictionariesDir field instead
|
|
227
|
+
*
|
|
228
|
+
*/
|
|
229
|
+
reactIntlMessagesDirName: customConfiguration?.reactIntlMessagesDirName ?? REACT_INTL_MESSAGES_DIR_NAME,
|
|
215
230
|
/**
|
|
216
231
|
* Related to the intlayer result directory
|
|
217
232
|
*
|
|
@@ -346,16 +361,32 @@ const buildContentFields = (customConfiguration) => {
|
|
|
346
361
|
*
|
|
347
362
|
* Relative to the result directory
|
|
348
363
|
*
|
|
349
|
-
* Default: {{resultDir}} / {{
|
|
364
|
+
* Default: {{resultDir}} / {{i18nextResourcesDirName}}
|
|
350
365
|
*
|
|
351
366
|
* Example: '/path/to/project/.intlayer/dictionary/i18n'
|
|
352
367
|
*
|
|
353
368
|
* Note:
|
|
354
|
-
* - If the types are not at the result directory level, update the
|
|
369
|
+
* - If the types are not at the result directory level, update the i18nextResourcesDirName field instead
|
|
355
370
|
*/
|
|
356
|
-
|
|
371
|
+
i18nextResourcesDir: join(
|
|
357
372
|
baseDirDerivedConfiguration.resultDir,
|
|
358
|
-
notDerivedContentConfig.
|
|
373
|
+
notDerivedContentConfig.i18nextResourcesDirName
|
|
374
|
+
),
|
|
375
|
+
/**
|
|
376
|
+
* Directory where the dictionaries will be stored
|
|
377
|
+
*
|
|
378
|
+
* Relative to the result directory
|
|
379
|
+
*
|
|
380
|
+
* Default: {{resultDir}} / {{reactIntlMessagesDirName}}
|
|
381
|
+
*
|
|
382
|
+
* Example: '/path/to/project/.intlayer/react-intl_dictionary'
|
|
383
|
+
*
|
|
384
|
+
* Note:
|
|
385
|
+
* - If the types are not at the result directory level, update the dictionariesDirName field instead
|
|
386
|
+
*/
|
|
387
|
+
reactIntlMessagesDir: join(
|
|
388
|
+
baseDirDerivedConfiguration.resultDir,
|
|
389
|
+
notDerivedContentConfig.reactIntlMessagesDirName
|
|
359
390
|
),
|
|
360
391
|
/**
|
|
361
392
|
* Directory where the dictionaries types will be stored
|
|
@@ -364,7 +395,7 @@ const buildContentFields = (customConfiguration) => {
|
|
|
364
395
|
*
|
|
365
396
|
* Default: {{resultDir}} / {{typeDirName}}
|
|
366
397
|
*
|
|
367
|
-
* Example: '/path/to/project
|
|
398
|
+
* Example: '/path/to/project/types'
|
|
368
399
|
*
|
|
369
400
|
* Note:
|
|
370
401
|
* - If the types are not at the result directory level, update the typesDirName field instead
|
|
@@ -451,7 +482,7 @@ const buildEditorFields = (customConfiguration) => ({
|
|
|
451
482
|
/**
|
|
452
483
|
* clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
|
|
453
484
|
* An access token is use to authenticate the user related to the project.
|
|
454
|
-
* To get an access token, go to https://
|
|
485
|
+
* To get an access token, go to https://intlayer.org/dashboard/project and create an account.
|
|
455
486
|
*
|
|
456
487
|
* Default: undefined
|
|
457
488
|
*
|
|
@@ -461,7 +492,7 @@ const buildEditorFields = (customConfiguration) => ({
|
|
|
461
492
|
/**
|
|
462
493
|
* clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
|
|
463
494
|
* An access token is use to authenticate the user related to the project.
|
|
464
|
-
* To get an access token, go to https://
|
|
495
|
+
* To get an access token, go to https://intlayer.org/dashboard/project and create an account.
|
|
465
496
|
*
|
|
466
497
|
* Default: undefined
|
|
467
498
|
*
|
|
@@ -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 I18N_DICTIONARIES_DIR_NAME,\n DICTIONARY_OUTPUT,\n WATCH,\n} from '../defaultValues/content';\nimport {\n BACKEND_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n IS_ENABLED,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport {\n BASE_PATH,\n COOKIE_NAME,\n HEADER_NAME,\n NO_PREFIX,\n PREFIX_DEFAULT,\n SERVER_SET_COOKIE,\n} from '../defaultValues/middleware';\nimport { MODE, PREFIX } from '../defaultValues/log';\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 i18nDictionariesDirName:\n customConfiguration?.i18nDictionariesDirName ??\n I18N_DICTIONARIES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the dictionaries types will be stored\n *\n * Default: 'types'\n *\n * Example: 'intlayer-types'\n *\n * Note:\n * - If this directory is not at the result directory level, update the typesDir field instead\n *\n */\n typeDirName: customConfiguration?.typeDirName ?? TYPES_DIR_NAME,\n\n /**\n * Related to the intlayer result directory\n *\n * Directory name where the main files will be stored\n *\n * Default: 'main'\n *\n * Example: 'intlayer-main'\n *\n * Note:\n * - If this directory is not at the result directory level, update the mainDir field instead\n */\n mainDirName: customConfiguration?.mainDirName ?? MAIN_DIR_NAME,\n\n /**\n * Should exclude some directories from the content search\n *\n * Default: ['node_modules']\n *\n * Not used yet\n * @TODO Implement the exclusion or remove it\n */\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n\n /**\n * 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}} / {{i18nDictionariesDirName}}\n *\n * Example: '/path/to/project/.intlayer/dictionary/i18n'\n *\n * Note:\n * - If the types are not at the result directory level, update the i18nDictionariesDirName field instead\n */\n i18nDictionariesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.i18nDictionariesDirName\n ),\n\n /**\n * Directory where the dictionaries types will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{typeDirName}}\n *\n * Example: '/path/to/project/.intlayer/types'\n *\n * Note:\n * - If the types are not at the result directory level, update the typesDirName field instead\n */\n typesDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.typeDirName\n ),\n\n /**\n * Directory where the main files will be stored\n *\n * Relative to the result directory\n *\n * Default: {{resultDir}} / {{mainDirName}}\n *\n * Example: '/path/to/project/.intlayer/main'\n *\n * Note:\n *\n * - If the main files are not at the result directory level, update the mainDirName field instead\n */\n mainDir: join(\n baseDirDerivedConfiguration.resultDir,\n notDerivedContentConfig.mainDirName\n ),\n };\n\n const patternsConfiguration: PatternsContentConfig = {\n /**\n * Pattern of files to watch\n *\n * Default: ['/**\\/*.content.ts', '/**\\/*.content.js', '/**\\/*.content.json', '/**\\/*.content.cjs', '/**\\/*.content.mjs', '/**\\/*.content.tsx', '/**\\/*.content.jsx']\n */\n watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(\n (ext) => `/**/*${ext}`\n ),\n\n /**\n * Pattern of files to watch including the relative path\n *\n * Default: ['{{contentDir}}/**\\/*.content.ts', '{{contentDir}}/**\\/*.content.js', '{{contentDir}}/**\\/*.content.json', '{{contentDir}}/**\\/*.content.cjs', '{{contentDir}}/**\\/*.content.mjs', '{{contentDir}}/**\\/*.content.tsx', '{{contentDir}}/**\\/*.content.jsx']\n */\n watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.map(\n (ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`\n ),\n\n /**\n * Pattern of dictionary to interpret\n *\n * Default: '{{dictionariesDir}}/**\\/*.json'\n */\n outputFilesPatternWithPath: `${resultDirDerivedConfiguration.dictionariesDir}/**/*.json`,\n };\n\n return {\n ...notDerivedContentConfig,\n ...baseDirDerivedConfiguration,\n ...resultDirDerivedConfiguration,\n ...patternsConfiguration,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * Port of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /**\n * Indicates if the editor is active\n *\n * Default: true;\n *\n * If true, the editor is active and can be accessed.\n * If false, the editor is inactive and cannot be accessed.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV === 'development',\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://back.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://back.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,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,MAAM,cAAc;AAgB7B,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;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;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,SACA,wBACmB;AACnB,QAAM,6BAA6B;AAAA,IACjC,qBAAqB;AAAA,EACvB;AAEA,QAAM,mBAAmB;AAAA,IACvB,qBAAqB;AAAA,EACvB;AAEA,QAAM,gBAAgB,mBAAmB,qBAAqB,OAAO;AAErE,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":[]}
|
|
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 BACKEND_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n IS_ENABLED,\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 * Port of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /**\n * Indicates if the editor is active\n *\n * Default: true;\n *\n * If true, the editor is active and can be accessed.\n * If false, the editor is inactive and cannot be accessed.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV === 'development',\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,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,MAAM,cAAc;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgBP,IAAI;AAIJ,MAAM,kCAAkC,CACtC,yBACgC;AAAA;AA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qB,GAAG;AAEzD,wBAAsB;AAAA,IACpB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -14,7 +14,8 @@ const RESULT_DIR_NAME = ".intlayer";
|
|
|
14
14
|
const MODULE_AUGMENTATION_DIR_NAME = "types";
|
|
15
15
|
const DICTIONARY_OUTPUT = ["intlayer"];
|
|
16
16
|
const DICTIONARIES_DIR_NAME = "dictionary";
|
|
17
|
-
const
|
|
17
|
+
const I18NEXT_DICTIONARIES_DIR_NAME = "i18next_resources";
|
|
18
|
+
const REACT_INTL_MESSAGES_DIR_NAME = "intl_messages";
|
|
18
19
|
const TYPES_DIR_NAME = "types";
|
|
19
20
|
const MAIN_DIR_NAME = "main";
|
|
20
21
|
const WATCH = process.env.NODE_ENV === "development";
|
|
@@ -24,9 +25,10 @@ export {
|
|
|
24
25
|
DICTIONARY_OUTPUT,
|
|
25
26
|
EXCLUDED_PATHS,
|
|
26
27
|
FILE_EXTENSIONS,
|
|
27
|
-
|
|
28
|
+
I18NEXT_DICTIONARIES_DIR_NAME,
|
|
28
29
|
MAIN_DIR_NAME,
|
|
29
30
|
MODULE_AUGMENTATION_DIR_NAME,
|
|
31
|
+
REACT_INTL_MESSAGES_DIR_NAME,
|
|
30
32
|
RESULT_DIR_NAME,
|
|
31
33
|
TYPES_DIR_NAME,
|
|
32
34
|
WATCH
|
|
@@ -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 = 'types';\n\nexport const DICTIONARY_OUTPUT: DictionaryOutput[] = ['intlayer'];\n\nexport const DICTIONARIES_DIR_NAME = 'dictionary';\n\nexport const
|
|
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 = '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,OAAO,aAAa;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,QAAQ,IAAI,aAAa;","names":[]}
|
|
@@ -22,13 +22,15 @@ const extractNextEnvVariable = () => {
|
|
|
22
22
|
resultDirName: process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR_NAME,
|
|
23
23
|
moduleAugmentationDirName: process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,
|
|
24
24
|
dictionariesDirName: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR_NAME,
|
|
25
|
-
|
|
25
|
+
i18nextResourcesDir: process.env.NEXT_PUBLIC_INTLAYER_I18N_RESOURCES_DIR,
|
|
26
|
+
reactIntlMessagesDir: process.env.NEXT_PUBLIC_INTLAYER_REACT_INTL_MESSAGES_DIR,
|
|
26
27
|
typeDirName: process.env.NEXT_PUBLIC_INTLAYER_TYPE_DIR_NAME,
|
|
27
28
|
mainDirName: process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR_NAME,
|
|
28
29
|
resultDir: process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR,
|
|
29
30
|
moduleAugmentationDir: process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR,
|
|
30
31
|
dictionariesDir: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR,
|
|
31
|
-
|
|
32
|
+
i18nextResourcesDirName: process.env.NEXT_PUBLIC_INTLAYER_I18N_RESOURCES_DIR_NAME,
|
|
33
|
+
reactIntlMessagesDirName: process.env.NEXT_PUBLIC_INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,
|
|
32
34
|
typesDir: process.env.NEXT_PUBLIC_INTLAYER_TYPE_DIR,
|
|
33
35
|
mainDir: process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR,
|
|
34
36
|
watchedFilesPattern: process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/next.ts"],"sourcesContent":["import process from 'process';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\n\nexport const extractNextEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.NEXT_PUBLIC_INTLAYER_LOCALES,\n strictMode: process.env.NEXT_PUBLIC_INTLAYER_STRICT_MODE,\n defaultLocale: process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.NEXT_PUBLIC_INTLAYER_HEADER_NAME,\n cookieName: process.env.NEXT_PUBLIC_INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.NEXT_PUBLIC_INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.NEXT_PUBLIC_INTLAYER_BASE_PATH,\n serverSetCookie: process.env.NEXT_PUBLIC_INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.NEXT_PUBLIC_INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.NEXT_PUBLIC_INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.NEXT_PUBLIC_INTLAYER_BASE_DIR,\n contentDirName: process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR,\n excludedPath: process.env.NEXT_PUBLIC_INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR_NAME,\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/next.ts"],"sourcesContent":["import process from 'process';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\n\nexport const extractNextEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.NEXT_PUBLIC_INTLAYER_LOCALES,\n strictMode: process.env.NEXT_PUBLIC_INTLAYER_STRICT_MODE,\n defaultLocale: process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.NEXT_PUBLIC_INTLAYER_HEADER_NAME,\n cookieName: process.env.NEXT_PUBLIC_INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.NEXT_PUBLIC_INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.NEXT_PUBLIC_INTLAYER_BASE_PATH,\n serverSetCookie: process.env.NEXT_PUBLIC_INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.NEXT_PUBLIC_INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.NEXT_PUBLIC_INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.NEXT_PUBLIC_INTLAYER_BASE_DIR,\n contentDirName: process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.NEXT_PUBLIC_INTLAYER_CONTENT_DIR,\n excludedPath: process.env.NEXT_PUBLIC_INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR_NAME,\n i18nextResourcesDir: process.env.NEXT_PUBLIC_INTLAYER_I18N_RESOURCES_DIR,\n reactIntlMessagesDir:\n process.env.NEXT_PUBLIC_INTLAYER_REACT_INTL_MESSAGES_DIR,\n typeDirName: process.env.NEXT_PUBLIC_INTLAYER_TYPE_DIR_NAME,\n mainDirName: process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR_NAME,\n resultDir: process.env.NEXT_PUBLIC_INTLAYER_RESULT_DIR,\n moduleAugmentationDir:\n process.env.NEXT_PUBLIC_INTLAYER_MODULE_AUGMENTATION_DIR,\n dictionariesDir: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARIES_DIR,\n i18nextResourcesDirName:\n process.env.NEXT_PUBLIC_INTLAYER_I18N_RESOURCES_DIR_NAME,\n reactIntlMessagesDirName:\n process.env.NEXT_PUBLIC_INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,\n typesDir: process.env.NEXT_PUBLIC_INTLAYER_TYPE_DIR,\n mainDir: process.env.NEXT_PUBLIC_INTLAYER_MAIN_DIR,\n watchedFilesPattern: process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN,\n watchedFilesPatternWithPath:\n process.env.NEXT_PUBLIC_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n outputFilesPatternWithPath:\n process.env.NEXT_PUBLIC_INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH,\n dictionaryOutput: process.env.NEXT_PUBLIC_INTLAYER_DICTIONARY_OUTPUT,\n watch: process.env.NEXT_PUBLIC_INTLAYER_WATCH,\n };\n\n const editor: ReplaceValue<EditorConfig> = {\n backendURL: process.env.NEXT_PUBLIC_INTLAYER_BACKEND_URL,\n enabled: process.env.NEXT_PUBLIC_INTLAYER_ENABLED,\n clientId: process.env.NEXT_PUBLIC_INTLAYER_CLIENT_ID,\n clientSecret: process.env.NEXT_PUBLIC_INTLAYER_CLIENT_SECRET,\n dictionaryPriorityStrategy:\n process.env.NEXT_PUBLIC_INTLAYER_DICTIONARY_PRIORITY_STRATEGY,\n };\n\n const log: ReplaceValue<LogConfig> = {\n mode: process.env.NEXT_PUBLIC_INTLAYER_LOG_MODE,\n prefix: process.env.NEXT_PUBLIC_INTLAYER_LOG_PREFIX,\n };\n\n return {\n internationalization,\n middleware,\n content,\n editor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,SAAqC;AAAA,IACzC,YAAY,QAAQ,IAAI;AAAA,IACxB,SAAS,QAAQ,IAAI;AAAA,IACrB,UAAU,QAAQ,IAAI;AAAA,IACtB,cAAc,QAAQ,IAAI;AAAA,IAC1B,4BACE,QAAQ,IAAI;AAAA,EAChB;AAEA,QAAM,MAA+B;AAAA,IACnC,MAAM,QAAQ,IAAI;AAAA,IAClB,QAAQ,QAAQ,IAAI;AAAA,EACtB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -22,13 +22,15 @@ const extractReactAppEnvVariable = () => {
|
|
|
22
22
|
resultDirName: process.env.REACT_APP_INTLAYER_RESULT_DIR_NAME,
|
|
23
23
|
moduleAugmentationDirName: process.env.REACT_APP_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,
|
|
24
24
|
dictionariesDirName: process.env.REACT_APP_INTLAYER_DICTIONARIES_DIR_NAME,
|
|
25
|
-
|
|
25
|
+
i18nextResourcesDirName: process.env.REACT_APP_INTLAYER_I18N_RESOURCES_DIR_NAME,
|
|
26
|
+
reactIntlMessagesDirName: process.env.REACT_APP_INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,
|
|
26
27
|
typeDirName: process.env.REACT_APP_INTLAYER_TYPE_DIR_NAME,
|
|
27
28
|
mainDirName: process.env.REACT_APP_INTLAYER_MAIN_DIR_NAME,
|
|
28
29
|
resultDir: process.env.REACT_APP_INTLAYER_RESULT_DIR,
|
|
29
30
|
moduleAugmentationDir: process.env.REACT_APP_INTLAYER_MODULE_AUGMENTATION_DIR,
|
|
30
31
|
dictionariesDir: process.env.REACT_APP_INTLAYER_DICTIONARIES_DIR,
|
|
31
|
-
|
|
32
|
+
i18nextResourcesDir: process.env.REACT_APP_INTLAYER_I18N_DICTIONARIES_DIR,
|
|
33
|
+
reactIntlMessagesDir: process.env.REACT_APP_INTLAYER_REACT_INTL_DICTIONARIES_DIR,
|
|
32
34
|
typesDir: process.env.REACT_APP_INTLAYER_TYPE_DIR,
|
|
33
35
|
mainDir: process.env.REACT_APP_INTLAYER_MAIN_DIR,
|
|
34
36
|
watchedFilesPattern: process.env.REACT_APP_INTLAYER_WATCHED_FILES_PATTERN,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/react_app.ts"],"sourcesContent":["import process from 'process';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\n\nexport const extractReactAppEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.REACT_APP_INTLAYER_LOCALES,\n strictMode: process.env.REACT_APP_INTLAYER_STRICT_MODE,\n defaultLocale: process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.REACT_APP_INTLAYER_HEADER_NAME,\n cookieName: process.env.REACT_APP_INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.REACT_APP_INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.REACT_APP_INTLAYER_BASE_PATH,\n serverSetCookie: process.env.REACT_APP_INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.REACT_APP_INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.REACT_APP_INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.REACT_APP_INTLAYER_BASE_DIR,\n contentDirName: process.env.REACT_APP_INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.REACT_APP_INTLAYER_CONTENT_DIR,\n excludedPath: process.env.REACT_APP_INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.REACT_APP_INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.REACT_APP_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.REACT_APP_INTLAYER_DICTIONARIES_DIR_NAME,\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/react_app.ts"],"sourcesContent":["import process from 'process';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\n\nexport const extractReactAppEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.REACT_APP_INTLAYER_LOCALES,\n strictMode: process.env.REACT_APP_INTLAYER_STRICT_MODE,\n defaultLocale: process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.REACT_APP_INTLAYER_HEADER_NAME,\n cookieName: process.env.REACT_APP_INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.REACT_APP_INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.REACT_APP_INTLAYER_BASE_PATH,\n serverSetCookie: process.env.REACT_APP_INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.REACT_APP_INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.REACT_APP_INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.REACT_APP_INTLAYER_BASE_DIR,\n contentDirName: process.env.REACT_APP_INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.REACT_APP_INTLAYER_CONTENT_DIR,\n excludedPath: process.env.REACT_APP_INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.REACT_APP_INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.REACT_APP_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.REACT_APP_INTLAYER_DICTIONARIES_DIR_NAME,\n i18nextResourcesDirName:\n process.env.REACT_APP_INTLAYER_I18N_RESOURCES_DIR_NAME,\n reactIntlMessagesDirName:\n process.env.REACT_APP_INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,\n typeDirName: process.env.REACT_APP_INTLAYER_TYPE_DIR_NAME,\n mainDirName: process.env.REACT_APP_INTLAYER_MAIN_DIR_NAME,\n resultDir: process.env.REACT_APP_INTLAYER_RESULT_DIR,\n moduleAugmentationDir:\n process.env.REACT_APP_INTLAYER_MODULE_AUGMENTATION_DIR,\n dictionariesDir: process.env.REACT_APP_INTLAYER_DICTIONARIES_DIR,\n i18nextResourcesDir: process.env.REACT_APP_INTLAYER_I18N_DICTIONARIES_DIR,\n reactIntlMessagesDir:\n process.env.REACT_APP_INTLAYER_REACT_INTL_DICTIONARIES_DIR,\n typesDir: process.env.REACT_APP_INTLAYER_TYPE_DIR,\n mainDir: process.env.REACT_APP_INTLAYER_MAIN_DIR,\n watchedFilesPattern: process.env.REACT_APP_INTLAYER_WATCHED_FILES_PATTERN,\n watchedFilesPatternWithPath:\n process.env.REACT_APP_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n outputFilesPatternWithPath:\n process.env.REACT_APP_INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH,\n dictionaryOutput: process.env.REACT_APP_INTLAYER_DICTIONARY_OUTPUT,\n watch: process.env.REACT_APP_INTLAYER_WATCH,\n };\n\n const editor: ReplaceValue<EditorConfig> = {\n backendURL: process.env.REACT_APP_INTLAYER_BACKEND_URL,\n enabled: process.env.REACT_APP_INTLAYER_ENABLED,\n clientId: process.env.REACT_APP_INTLAYER_CLIENT_ID,\n clientSecret: process.env.REACT_APP_INTLAYER_CLIENT_SECRET,\n dictionaryPriorityStrategy:\n process.env.REACT_APP_INTLAYER_DICTIONARY_PRIORITY_STRATEGY,\n };\n\n const log: ReplaceValue<LogConfig> = {\n mode: process.env.REACT_APP_INTLAYER_LOG_MODE,\n prefix: process.env.REACT_APP_INTLAYER_LOG_PREFIX,\n };\n\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IAAI;AAAA,EACrB;AAEA,QAAM,SAAqC;AAAA,IACzC,YAAY,QAAQ,IAAI;AAAA,IACxB,SAAS,QAAQ,IAAI;AAAA,IACrB,UAAU,QAAQ,IAAI;AAAA,IACtB,cAAc,QAAQ,IAAI;AAAA,IAC1B,4BACE,QAAQ,IAAI;AAAA,EAChB;AAEA,QAAM,MAA+B;AAAA,IACnC,MAAM,QAAQ,IAAI;AAAA,IAClB,QAAQ,QAAQ,IAAI;AAAA,EACtB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -22,13 +22,15 @@ const extractEmptyEnvVariable = () => {
|
|
|
22
22
|
resultDirName: process.env.INTLAYER_RESULT_DIR_NAME,
|
|
23
23
|
moduleAugmentationDirName: process.env.INTLAYER_MODULE_AUGMENTATION_DIR_NAME,
|
|
24
24
|
dictionariesDirName: process.env.INTLAYER_DICTIONARIES_DIR_NAME,
|
|
25
|
-
|
|
25
|
+
i18nextResourcesDirName: process.env.INTLAYER_I18N_RESOURCES_DIR_NAME,
|
|
26
|
+
reactIntlMessagesDirName: process.env.INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,
|
|
26
27
|
typeDirName: process.env.INTLAYER_TYPE_DIR_NAME,
|
|
27
28
|
mainDirName: process.env.INTLAYER_MAIN_DIR_NAME,
|
|
28
29
|
resultDir: process.env.INTLAYER_RESULT_DIR,
|
|
29
30
|
moduleAugmentationDir: process.env.INTLAYER_MODULE_AUGMENTATION_DIR,
|
|
30
31
|
dictionariesDir: process.env.INTLAYER_DICTIONARIES_DIR,
|
|
31
|
-
|
|
32
|
+
i18nextResourcesDir: process.env.INTLAYER_I18N_DICTIONARIES_DIR,
|
|
33
|
+
reactIntlMessagesDir: process.env.INTLAYER_REACT_INTL_DICTIONARIES_DIR,
|
|
32
34
|
typesDir: process.env.INTLAYER_TYPE_DIR,
|
|
33
35
|
mainDir: process.env.INTLAYER_MAIN_DIR,
|
|
34
36
|
watchedFilesPattern: process.env.INTLAYER_WATCHED_FILES_PATTERN,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/undefined_platform.ts"],"sourcesContent":["import process from 'process';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { ReplaceValue, IntlayerConfigEnvVariable } from './types';\n\nexport const extractEmptyEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.INTLAYER_LOCALES,\n strictMode: process.env.INTLAYER_STRICT_MODE,\n defaultLocale: process.env.INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.INTLAYER_HEADER_NAME,\n cookieName: process.env.INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.INTLAYER_BASE_PATH,\n serverSetCookie: process.env.INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.INTLAYER_BASE_DIR,\n contentDirName: process.env.INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.INTLAYER_CONTENT_DIR,\n excludedPath: process.env.INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.INTLAYER_DICTIONARIES_DIR_NAME,\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/undefined_platform.ts"],"sourcesContent":["import process from 'process';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { ReplaceValue, IntlayerConfigEnvVariable } from './types';\n\nexport const extractEmptyEnvVariable = (): IntlayerConfigEnvVariable => {\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: process.env.INTLAYER_LOCALES,\n strictMode: process.env.INTLAYER_STRICT_MODE,\n defaultLocale: process.env.INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: process.env.INTLAYER_HEADER_NAME,\n cookieName: process.env.INTLAYER_COOKIE_NAME,\n prefixDefault: process.env.INTLAYER_PREFIX_DEFAULT,\n basePath: process.env.INTLAYER_BASE_PATH,\n serverSetCookie: process.env.INTLAYER_SERVER_SET_COOKIE,\n noPrefix: process.env.INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: process.env.INTLAYER_FILE_EXTENSIONS,\n baseDir: process.env.INTLAYER_BASE_DIR,\n contentDirName: process.env.INTLAYER_CONTENT_DIR_NAME,\n contentDir: process.env.INTLAYER_CONTENT_DIR,\n excludedPath: process.env.INTLAYER_EXCLUDED_PATH,\n resultDirName: process.env.INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName:\n process.env.INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: process.env.INTLAYER_DICTIONARIES_DIR_NAME,\n i18nextResourcesDirName: process.env.INTLAYER_I18N_RESOURCES_DIR_NAME,\n reactIntlMessagesDirName: process.env.INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,\n typeDirName: process.env.INTLAYER_TYPE_DIR_NAME,\n mainDirName: process.env.INTLAYER_MAIN_DIR_NAME,\n resultDir: process.env.INTLAYER_RESULT_DIR,\n moduleAugmentationDir: process.env.INTLAYER_MODULE_AUGMENTATION_DIR,\n dictionariesDir: process.env.INTLAYER_DICTIONARIES_DIR,\n i18nextResourcesDir: process.env.INTLAYER_I18N_DICTIONARIES_DIR,\n reactIntlMessagesDir: process.env.INTLAYER_REACT_INTL_DICTIONARIES_DIR,\n typesDir: process.env.INTLAYER_TYPE_DIR,\n mainDir: process.env.INTLAYER_MAIN_DIR,\n watchedFilesPattern: process.env.INTLAYER_WATCHED_FILES_PATTERN,\n watchedFilesPatternWithPath:\n process.env.INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n outputFilesPatternWithPath:\n process.env.INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH,\n dictionaryOutput: process.env.INTLAYER_DICTIONARY_OUTPUT,\n watch: process.env.INTLAYER_WATCH,\n };\n\n const editor: ReplaceValue<EditorConfig> = {\n backendURL: process.env.INTLAYER_BACKEND_URL,\n enabled: process.env.INTLAYER_ENABLED,\n clientId: process.env.INTLAYER_CLIENT_ID,\n clientSecret: process.env.INTLAYER_CLIENT_SECRET,\n dictionaryPriorityStrategy:\n process.env.INTLAYER_DICTIONARY_PRIORITY_STRATEGY,\n };\n\n const log: ReplaceValue<LogConfig> = {\n mode: process.env.INTLAYER_LOG_MODE,\n prefix: process.env.INTLAYER_LOG_PREFIX,\n };\n\n return {\n internationalization,\n middleware,\n content,\n editor,\n log,\n };\n};\n"],"mappings":"AAAA,OAAO,aAAa;AAUb,MAAM,0BAA0B,MAAiC;AACtE,QAAM,uBAAiE;AAAA,IACrE,SAAS,QAAQ,IAAI;AAAA,IACrB,YAAY,QAAQ,IAAI;AAAA,IACxB,eAAe,QAAQ,IAAI;AAAA,EAC7B;AAEA,QAAM,aAA6C;AAAA,IACjD,YAAY,QAAQ,IAAI;AAAA,IACxB,YAAY,QAAQ,IAAI;AAAA,IACxB,eAAe,QAAQ,IAAI;AAAA,IAC3B,UAAU,QAAQ,IAAI;AAAA,IACtB,iBAAiB,QAAQ,IAAI;AAAA,IAC7B,UAAU,QAAQ,IAAI;AAAA,EACxB;AAEA,QAAM,UAAuC;AAAA,IAC3C,gBAAgB,QAAQ,IAAI;AAAA,IAC5B,SAAS,QAAQ,IAAI;AAAA,IACrB,gBAAgB,QAAQ,IAAI;AAAA,IA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NAME,
|
|
31
31
|
dictionariesDirName: import.meta.env.VITE_INTLAYER_DICTIONARIES_DIR_NAME,
|
|
32
|
-
|
|
32
|
+
i18nextResourcesDirName: import.meta.env.VITE_INTLAYER_I18N_RESOURCES_DIR_NAME,
|
|
33
|
+
reactIntlMessagesDirName: import.meta.env.VITE_INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,
|
|
33
34
|
typeDirName: import.meta.env.VITE_INTLAYER_TYPE_DIR_NAME,
|
|
34
35
|
mainDirName: import.meta.env.VITE_INTLAYER_MAIN_DIR_NAME,
|
|
35
36
|
resultDir: import.meta.env.VITE_INTLAYER_RESULT_DIR,
|
|
36
37
|
moduleAugmentationDir: import.meta.env.VITE_INTLAYER_MODULE_AUGMENTATION_DIR,
|
|
37
38
|
dictionariesDir: import.meta.env.VITE_INTLAYER_DICTIONARIES_DIR,
|
|
38
|
-
|
|
39
|
+
i18nextResourcesDir: import.meta.env.VITE_INTLAYER_I18N_DICTIONARIES_DIR,
|
|
40
|
+
reactIntlMessagesDir: import.meta.env.VITE_INTLAYER_REACT_INTL_DICTIONARIES_DIR,
|
|
39
41
|
typesDir: import.meta.env.VITE_INTLAYER_TYPE_DIR,
|
|
40
42
|
mainDir: import.meta.env.VITE_INTLAYER_MAIN_DIR,
|
|
41
43
|
watchedFilesPattern: import.meta.env.VITE_INTLAYER_WATCHED_FILES_PATTERN,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/vite.ts"],"sourcesContent":["import { logger } from '../../logger';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\nimport { extractEmptyEnvVariable } from './undefined_platform';\n\nexport const extractViteEnvVariable = (): IntlayerConfigEnvVariable => {\n if (!import.meta.env) {\n logger('Vite env variables cannot be loaded on a commonjs environment.', {\n level: 'error',\n });\n return extractEmptyEnvVariable();\n }\n\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: import.meta.env.VITE_INTLAYER_LOCALES,\n strictMode: import.meta.env.VITE_INTLAYER_STRICT_MODE,\n defaultLocale: import.meta.env.VITE_INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: import.meta.env.VITE_INTLAYER_HEADER_NAME,\n cookieName: import.meta.env.VITE_INTLAYER_COOKIE_NAME,\n prefixDefault: import.meta.env.VITE_INTLAYER_PREFIX_DEFAULT,\n basePath: import.meta.env.VITE_INTLAYER_BASE_PATH,\n serverSetCookie: import.meta.env.VITE_INTLAYER_SERVER_SET_COOKIE,\n noPrefix: import.meta.env.VITE_INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: import.meta.env.VITE_INTLAYER_FILE_EXTENSIONS,\n baseDir: import.meta.env.VITE_INTLAYER_BASE_DIR,\n contentDirName: import.meta.env.VITE_INTLAYER_CONTENT_DIR_NAME,\n contentDir: import.meta.env.VITE_INTLAYER_CONTENT_DIR,\n excludedPath: import.meta.env.VITE_INTLAYER_EXCLUDED_PATH,\n resultDirName: import.meta.env.VITE_INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName: import.meta.env\n .VITE_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: import.meta.env.VITE_INTLAYER_DICTIONARIES_DIR_NAME,\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/envVariables/extractEnvVariable/vite.ts"],"sourcesContent":["import { logger } from '../../logger';\nimport type {\n InternationalizationConfig,\n MiddlewareConfig,\n ContentConfig,\n EditorConfig,\n LogConfig,\n} from '../../types/config';\nimport type { IntlayerConfigEnvVariable, ReplaceValue } from './types';\nimport { extractEmptyEnvVariable } from './undefined_platform';\n\nexport const extractViteEnvVariable = (): IntlayerConfigEnvVariable => {\n if (!import.meta.env) {\n logger('Vite env variables cannot be loaded on a commonjs environment.', {\n level: 'error',\n });\n return extractEmptyEnvVariable();\n }\n\n const internationalization: ReplaceValue<InternationalizationConfig> = {\n locales: import.meta.env.VITE_INTLAYER_LOCALES,\n strictMode: import.meta.env.VITE_INTLAYER_STRICT_MODE,\n defaultLocale: import.meta.env.VITE_INTLAYER_DEFAULT_LOCALE,\n };\n\n const middleware: ReplaceValue<MiddlewareConfig> = {\n headerName: import.meta.env.VITE_INTLAYER_HEADER_NAME,\n cookieName: import.meta.env.VITE_INTLAYER_COOKIE_NAME,\n prefixDefault: import.meta.env.VITE_INTLAYER_PREFIX_DEFAULT,\n basePath: import.meta.env.VITE_INTLAYER_BASE_PATH,\n serverSetCookie: import.meta.env.VITE_INTLAYER_SERVER_SET_COOKIE,\n noPrefix: import.meta.env.VITE_INTLAYER_NO_PREFIX,\n };\n\n const content: ReplaceValue<ContentConfig> = {\n fileExtensions: import.meta.env.VITE_INTLAYER_FILE_EXTENSIONS,\n baseDir: import.meta.env.VITE_INTLAYER_BASE_DIR,\n contentDirName: import.meta.env.VITE_INTLAYER_CONTENT_DIR_NAME,\n contentDir: import.meta.env.VITE_INTLAYER_CONTENT_DIR,\n excludedPath: import.meta.env.VITE_INTLAYER_EXCLUDED_PATH,\n resultDirName: import.meta.env.VITE_INTLAYER_RESULT_DIR_NAME,\n moduleAugmentationDirName: import.meta.env\n .VITE_INTLAYER_MODULE_AUGMENTATION_DIR_NAME,\n dictionariesDirName: import.meta.env.VITE_INTLAYER_DICTIONARIES_DIR_NAME,\n i18nextResourcesDirName: import.meta.env\n .VITE_INTLAYER_I18N_RESOURCES_DIR_NAME,\n reactIntlMessagesDirName: import.meta.env\n .VITE_INTLAYER_REACT_INTL_MESSAGES_DIR_NAME,\n typeDirName: import.meta.env.VITE_INTLAYER_TYPE_DIR_NAME,\n mainDirName: import.meta.env.VITE_INTLAYER_MAIN_DIR_NAME,\n resultDir: import.meta.env.VITE_INTLAYER_RESULT_DIR,\n moduleAugmentationDir: import.meta.env\n .VITE_INTLAYER_MODULE_AUGMENTATION_DIR,\n dictionariesDir: import.meta.env.VITE_INTLAYER_DICTIONARIES_DIR,\n i18nextResourcesDir: import.meta.env.VITE_INTLAYER_I18N_DICTIONARIES_DIR,\n reactIntlMessagesDir: import.meta.env\n .VITE_INTLAYER_REACT_INTL_DICTIONARIES_DIR,\n typesDir: import.meta.env.VITE_INTLAYER_TYPE_DIR,\n mainDir: import.meta.env.VITE_INTLAYER_MAIN_DIR,\n watchedFilesPattern: import.meta.env.VITE_INTLAYER_WATCHED_FILES_PATTERN,\n watchedFilesPatternWithPath: import.meta.env\n .VITE_INTLAYER_WATCHED_FILES_PATTERN_WITH_PATH,\n outputFilesPatternWithPath: import.meta.env\n .VITE_INTLAYER_OUTPUT_FILES_PATTERN_WITH_PATH,\n dictionaryOutput: import.meta.env.VITE_INTLAYER_DICTIONARY_OUTPUT,\n watch: import.meta.env.VITE_INTLAYER_WATCH,\n };\n\n const editor: ReplaceValue<EditorConfig> = {\n backendURL: import.meta.env.VITE_INTLAYER_BACKEND_URL,\n enabled: import.meta.env.VITE_INTLAYER_ENABLED,\n clientId: import.meta.env.VITE_INTLAYER_CLIENT_ID,\n clientSecret: import.meta.env.VITE_INTLAYER_CLIENT_SECRET,\n dictionaryPriorityStrategy: import.meta.env\n .VITE_INTLAYER_DICTIONARY_PRIORITY_STRATEGY,\n };\n\n const log: ReplaceValue<LogConfig> = {\n mode: import.meta.env.VITE_INTLAYER_LOG_MODE,\n prefix: import.meta.env.VITE_INTLAYER_LOG_PREFIX,\n };\n\n return {\n internationalization,\n middleware,\n content,\n editor,\n log,\n };\n};\n"],"mappings":"AAAA,SAAS,cAAc;AASvB,SAAS,+BAA+B;AAEjC,MAAM,yBAAyB,MAAiC;AACrE,MAAI,CAAC,YAAY,KAAK;AACpB,WAAO,kEAAkE;AAAA,MACvE,OAAO;AAAA,IACT,CAAC;AACD,WAAO,wBAAwB;AAAA,EACjC;AAEA,QAAM,uBAAiE;AAAA,IACrE,SAAS,YAAY,IAAI;AA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9B,4BAA4B,YAAY,IACrC;AAAA,EACL;AAEA,QAAM,MAA+B;AAAA,IACnC,MAAM,YAAY,IAAI;AAAA,IACtB,QAAQ,YAAY,IAAI;AAAA,EAC1B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -49,12 +49,20 @@ const getConfiguration = () => {
|
|
|
49
49
|
"string"
|
|
50
50
|
),
|
|
51
51
|
dictionariesDir: getEnvValue(env.content.dictionariesDir, "string"),
|
|
52
|
-
|
|
53
|
-
env.content.
|
|
52
|
+
i18nextResourcesDirName: getEnvValue(
|
|
53
|
+
env.content.i18nextResourcesDirName,
|
|
54
54
|
"string"
|
|
55
55
|
),
|
|
56
|
-
|
|
57
|
-
env.content.
|
|
56
|
+
i18nextResourcesDir: getEnvValue(
|
|
57
|
+
env.content.i18nextResourcesDir,
|
|
58
|
+
"string"
|
|
59
|
+
),
|
|
60
|
+
reactIntlMessagesDirName: getEnvValue(
|
|
61
|
+
env.content.reactIntlMessagesDirName,
|
|
62
|
+
"string"
|
|
63
|
+
),
|
|
64
|
+
reactIntlMessagesDir: getEnvValue(
|
|
65
|
+
env.content.reactIntlMessagesDir,
|
|
58
66
|
"string"
|
|
59
67
|
),
|
|
60
68
|
typeDirName: getEnvValue(env.content.typeDirName, "string"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/envVariables/getConfiguration.ts"],"sourcesContent":["import type {\n ContentConfig,\n DictionaryOutput,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n LogConfig,\n ServerSetCookieRule,\n StrictMode,\n} from '../types/config';\nimport type { Locales } from '../types/locales';\nimport { extractEnvVariable } from './extractEnvVariable/index';\nimport { getEnvValue } from './utils';\n\n/**\n * Get all configuration values using environment variables\n * Can be used in the client side as the server side\n * To use it, be sure to have the environment variables set\n */\nexport const getConfiguration = (): IntlayerConfig => {\n const env = extractEnvVariable();\n\n const intlayerIntlConfiguration: InternationalizationConfig = {\n locales: getEnvValue<Locales>(env.internationalization.locales, 'array')!,\n strictMode: getEnvValue<StrictMode>(\n env.internationalization.strictMode,\n 'string'\n )!,\n defaultLocale: getEnvValue<Locales>(\n env?.internationalization.defaultLocale,\n 'string'\n )!,\n };\n\n const intlayerMiddlewareConfiguration: MiddlewareConfig = {\n headerName: getEnvValue(env.middleware.headerName, 'string')!,\n cookieName: getEnvValue(env.middleware.cookieName, 'string')!,\n prefixDefault: getEnvValue(env.middleware.prefixDefault, 'boolean')!,\n basePath: getEnvValue(env.middleware.basePath, 'string')!,\n serverSetCookie: getEnvValue<ServerSetCookieRule>(\n env.middleware.serverSetCookie,\n 'string'\n )!,\n noPrefix: getEnvValue(env.middleware.noPrefix, 'boolean')!,\n };\n\n const intlayerContentConfiguration: ContentConfig = {\n fileExtensions: getEnvValue<string>(env.content.fileExtensions, 'array')!,\n baseDir: getEnvValue(env.content.baseDir, 'string')!,\n contentDirName: getEnvValue(env.content.contentDirName, 'string')!,\n contentDir: getEnvValue(env.content.contentDir, 'string')!,\n excludedPath: getEnvValue<string>(env.content.excludedPath, 'array')!,\n resultDirName: getEnvValue(env.content.resultDirName, 'string')!,\n resultDir: getEnvValue(env.content.resultDir, 'string')!,\n moduleAugmentationDirName: getEnvValue(\n env.content.moduleAugmentationDirName,\n 'string'\n )!,\n moduleAugmentationDir: getEnvValue(\n env.content.moduleAugmentationDir,\n 'string'\n )!,\n dictionaryOutput: getEnvValue<DictionaryOutput>(\n env.content.dictionaryOutput,\n 'array'\n )!,\n dictionariesDirName: getEnvValue(\n env.content.dictionariesDirName,\n 'string'\n )!,\n dictionariesDir: getEnvValue(env.content.dictionariesDir, 'string')!,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/envVariables/getConfiguration.ts"],"sourcesContent":["import type {\n ContentConfig,\n DictionaryOutput,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n LogConfig,\n ServerSetCookieRule,\n StrictMode,\n} from '../types/config';\nimport type { Locales } from '../types/locales';\nimport { extractEnvVariable } from './extractEnvVariable/index';\nimport { getEnvValue } from './utils';\n\n/**\n * Get all configuration values using environment variables\n * Can be used in the client side as the server side\n * To use it, be sure to have the environment variables set\n */\nexport const getConfiguration = (): IntlayerConfig => {\n const env = extractEnvVariable();\n\n const intlayerIntlConfiguration: InternationalizationConfig = {\n locales: getEnvValue<Locales>(env.internationalization.locales, 'array')!,\n strictMode: getEnvValue<StrictMode>(\n env.internationalization.strictMode,\n 'string'\n )!,\n defaultLocale: getEnvValue<Locales>(\n env?.internationalization.defaultLocale,\n 'string'\n )!,\n };\n\n const intlayerMiddlewareConfiguration: MiddlewareConfig = {\n headerName: getEnvValue(env.middleware.headerName, 'string')!,\n cookieName: getEnvValue(env.middleware.cookieName, 'string')!,\n prefixDefault: getEnvValue(env.middleware.prefixDefault, 'boolean')!,\n basePath: getEnvValue(env.middleware.basePath, 'string')!,\n serverSetCookie: getEnvValue<ServerSetCookieRule>(\n env.middleware.serverSetCookie,\n 'string'\n )!,\n noPrefix: getEnvValue(env.middleware.noPrefix, 'boolean')!,\n };\n\n const intlayerContentConfiguration: ContentConfig = {\n fileExtensions: getEnvValue<string>(env.content.fileExtensions, 'array')!,\n baseDir: getEnvValue(env.content.baseDir, 'string')!,\n contentDirName: getEnvValue(env.content.contentDirName, 'string')!,\n contentDir: getEnvValue(env.content.contentDir, 'string')!,\n excludedPath: getEnvValue<string>(env.content.excludedPath, 'array')!,\n resultDirName: getEnvValue(env.content.resultDirName, 'string')!,\n resultDir: getEnvValue(env.content.resultDir, 'string')!,\n moduleAugmentationDirName: getEnvValue(\n env.content.moduleAugmentationDirName,\n 'string'\n )!,\n moduleAugmentationDir: getEnvValue(\n env.content.moduleAugmentationDir,\n 'string'\n )!,\n dictionaryOutput: getEnvValue<DictionaryOutput>(\n env.content.dictionaryOutput,\n 'array'\n )!,\n dictionariesDirName: getEnvValue(\n env.content.dictionariesDirName,\n 'string'\n )!,\n dictionariesDir: getEnvValue(env.content.dictionariesDir, 'string')!,\n i18nextResourcesDirName: getEnvValue(\n env.content.i18nextResourcesDirName,\n 'string'\n )!,\n i18nextResourcesDir: getEnvValue(\n env.content.i18nextResourcesDir,\n 'string'\n )!,\n reactIntlMessagesDirName: getEnvValue(\n env.content.reactIntlMessagesDirName,\n 'string'\n )!,\n reactIntlMessagesDir: getEnvValue(\n env.content.reactIntlMessagesDir,\n 'string'\n )!,\n typeDirName: getEnvValue(env.content.typeDirName, 'string')!,\n typesDir: getEnvValue(env.content.typesDir, 'string')!,\n mainDirName: getEnvValue(env.content.mainDirName, 'string')!,\n mainDir: getEnvValue(env.content.mainDir, 'string')!,\n watchedFilesPattern: getEnvValue<string>(\n env.content.watchedFilesPattern,\n 'array'\n )!,\n watchedFilesPatternWithPath: getEnvValue<string>(\n env.content.watchedFilesPatternWithPath,\n 'array'\n )!,\n outputFilesPatternWithPath: getEnvValue(\n env.content.outputFilesPatternWithPath,\n 'string'\n )!,\n watch: getEnvValue(env.content.watch, 'boolean')!,\n };\n\n const intlayerEditorConfiguration = {\n backendURL: getEnvValue(env.editor.backendURL, 'string')!,\n enabled: getEnvValue(env.editor.enabled, 'boolean')!,\n clientId: getEnvValue(env.editor.clientId, 'string')!,\n clientSecret: getEnvValue(env.editor.clientSecret, 'string')!,\n dictionaryPriorityStrategy: getEnvValue(\n env.editor.dictionaryPriorityStrategy,\n 'string'\n )! as 'locale_first' | 'distant_first',\n };\n\n const logConfiguration: LogConfig = {\n mode: getEnvValue(env.log.mode, 'string')!,\n prefix: getEnvValue(env.log.prefix, 'string')!,\n };\n\n const intlayerConfiguration: IntlayerConfig = {\n internationalization: intlayerIntlConfiguration,\n middleware: intlayerMiddlewareConfiguration,\n content: intlayerContentConfiguration,\n editor: intlayerEditorConfiguration,\n log: logConfiguration,\n };\n\n return intlayerConfiguration;\n};\n"],"mappings":"AAWA,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAOrB,MAAM,mBAAm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