@intlayer/config 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.cjs +2 -10
- package/dist/cjs/client.cjs.map +1 -1
- package/dist/cjs/client.d.ts +2 -2
- package/dist/cjs/configFile/buildConfigurationFields.cjs +65 -5
- package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
- package/dist/cjs/defaultValues/editor.cjs +29 -0
- package/dist/cjs/defaultValues/editor.cjs.map +1 -0
- package/dist/cjs/defaultValues/editor.d.ts +3 -0
- package/dist/cjs/defaultValues/internationalization.cjs +5 -2
- package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
- package/dist/cjs/defaultValues/internationalization.d.ts +3 -1
- package/dist/cjs/defaultValues/server.cjs +15 -1
- package/dist/cjs/defaultValues/server.cjs.map +1 -1
- package/dist/cjs/defaultValues/server.d.ts +6 -1
- package/dist/cjs/envVariables/detectPlatform.cjs +7 -4
- package/dist/cjs/envVariables/detectPlatform.cjs.map +1 -1
- package/dist/cjs/envVariables/detectPlatform.d.ts +1 -4
- package/dist/cjs/envVariables/extractEnvVariable/index.cjs +44 -0
- package/dist/cjs/envVariables/extractEnvVariable/index.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/index.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/next.cjs +75 -0
- package/dist/cjs/envVariables/extractEnvVariable/next.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/next.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs +75 -0
- package/dist/cjs/envVariables/extractEnvVariable/react_app.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/react_app.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/types.cjs +17 -0
- package/dist/cjs/envVariables/extractEnvVariable/types.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/types.d.ts +11 -0
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs +75 -0
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/undefined_platform.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite.cjs +83 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite.d.ts +7 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite_env.d.cjs +2 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite_env.d.cjs.map +1 -0
- package/dist/cjs/envVariables/extractEnvVariable/vite_env.d.d.ts +2 -0
- package/dist/cjs/envVariables/formatEnvVariable.cjs +2 -1
- package/dist/cjs/envVariables/formatEnvVariable.cjs.map +1 -1
- package/dist/cjs/envVariables/getConfiguration.cjs +87 -115
- package/dist/cjs/envVariables/getConfiguration.cjs.map +1 -1
- package/dist/cjs/envVariables/getConfiguration.d.ts +2 -6
- package/dist/cjs/envVariables/index.cjs +2 -10
- package/dist/cjs/envVariables/index.cjs.map +1 -1
- package/dist/cjs/envVariables/index.d.ts +1 -1
- package/dist/cjs/index.cjs +2 -10
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/types/config.cjs.map +1 -1
- package/dist/cjs/types/config.d.ts +75 -4
- package/dist/esm/client.d.mts +2 -2
- package/dist/esm/client.mjs +2 -12
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/configFile/buildConfigurationFields.mjs +73 -7
- package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
- package/dist/esm/defaultValues/editor.d.mts +3 -0
- package/dist/esm/defaultValues/editor.mjs +5 -0
- package/dist/esm/defaultValues/editor.mjs.map +1 -0
- package/dist/esm/defaultValues/internationalization.d.mts +3 -1
- package/dist/esm/defaultValues/internationalization.mjs +3 -1
- package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
- package/dist/esm/defaultValues/server.d.mts +6 -1
- package/dist/esm/defaultValues/server.mjs +13 -1
- package/dist/esm/defaultValues/server.mjs.map +1 -1
- package/dist/esm/envVariables/detectPlatform.d.mts +1 -4
- package/dist/esm/envVariables/detectPlatform.mjs +7 -4
- package/dist/esm/envVariables/detectPlatform.mjs.map +1 -1
- package/dist/esm/envVariables/extractEnvVariable/index.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/index.mjs +20 -0
- package/dist/esm/envVariables/extractEnvVariable/index.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/next.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/next.mjs +51 -0
- package/dist/esm/envVariables/extractEnvVariable/next.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/react_app.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/react_app.mjs +51 -0
- package/dist/esm/envVariables/extractEnvVariable/react_app.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/types.d.mts +11 -0
- package/dist/esm/envVariables/extractEnvVariable/types.mjs +1 -0
- package/dist/esm/envVariables/extractEnvVariable/types.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs +51 -0
- package/dist/esm/envVariables/extractEnvVariable/undefined_platform.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/vite.d.mts +7 -0
- package/dist/esm/envVariables/extractEnvVariable/vite.mjs +58 -0
- package/dist/esm/envVariables/extractEnvVariable/vite.mjs.map +1 -0
- package/dist/esm/envVariables/extractEnvVariable/vite_env.d.d.mts +2 -0
- package/dist/esm/envVariables/extractEnvVariable/vite_env.d.mjs +1 -0
- package/dist/esm/envVariables/extractEnvVariable/vite_env.d.mjs.map +1 -0
- package/dist/esm/envVariables/formatEnvVariable.mjs +2 -1
- package/dist/esm/envVariables/formatEnvVariable.mjs.map +1 -1
- package/dist/esm/envVariables/getConfiguration.d.mts +2 -6
- package/dist/esm/envVariables/getConfiguration.mjs +86 -110
- package/dist/esm/envVariables/getConfiguration.mjs.map +1 -1
- package/dist/esm/envVariables/index.d.mts +1 -1
- package/dist/esm/envVariables/index.mjs +2 -12
- package/dist/esm/envVariables/index.mjs.map +1 -1
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -9
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/types/config.d.mts +75 -4
- package/package.json +2 -2
- package/src/client.ts +5 -11
- package/src/configFile/buildConfigurationFields.ts +82 -4
- package/src/defaultValues/editor.ts +1 -0
- package/src/defaultValues/internationalization.ts +3 -0
- package/src/defaultValues/server.ts +15 -1
- package/src/envVariables/detectPlatform.ts +12 -8
- package/src/envVariables/extractEnvVariable/index.ts +20 -0
- package/src/envVariables/extractEnvVariable/next.ts +64 -0
- package/src/envVariables/extractEnvVariable/react_app.ts +64 -0
- package/src/envVariables/extractEnvVariable/types.ts +10 -0
- package/src/envVariables/extractEnvVariable/undefined_platform.ts +59 -0
- package/src/envVariables/extractEnvVariable/vite.ts +72 -0
- package/src/envVariables/extractEnvVariable/vite_env.d.ts +9 -0
- package/src/envVariables/formatEnvVariable.ts +1 -0
- package/src/envVariables/getConfiguration.ts +94 -111
- package/src/envVariables/index.ts +1 -7
- package/src/index.ts +1 -4
- package/src/types/config.ts +82 -3
- package/dist/cjs/envVariables/extractEnvVariable.cjs +0 -211
- package/dist/cjs/envVariables/extractEnvVariable.cjs.map +0 -1
- package/dist/cjs/envVariables/extractEnvVariable.d.ts +0 -13
- package/dist/esm/envVariables/extractEnvVariable.d.mts +0 -13
- package/dist/esm/envVariables/extractEnvVariable.mjs +0 -186
- package/dist/esm/envVariables/extractEnvVariable.mjs.map +0 -1
- package/src/envVariables/extractEnvVariable.ts +0 -224
|
@@ -19,11 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var envVariables_exports = {};
|
|
20
20
|
__export(envVariables_exports, {
|
|
21
21
|
formatEnvVariable: () => import_formatEnvVariable.formatEnvVariable,
|
|
22
|
-
getConfiguration: () => import_getConfiguration.getConfiguration
|
|
23
|
-
intlayerConfiguration: () => import_getConfiguration.intlayerConfiguration,
|
|
24
|
-
intlayerContentConfiguration: () => import_getConfiguration.intlayerContentConfiguration,
|
|
25
|
-
intlayerIntlConfiguration: () => import_getConfiguration.intlayerIntlConfiguration,
|
|
26
|
-
intlayerMiddlewareConfiguration: () => import_getConfiguration.intlayerMiddlewareConfiguration
|
|
22
|
+
getConfiguration: () => import_getConfiguration.getConfiguration
|
|
27
23
|
});
|
|
28
24
|
module.exports = __toCommonJS(envVariables_exports);
|
|
29
25
|
var import_getConfiguration = require('./getConfiguration.cjs');
|
|
@@ -31,10 +27,6 @@ var import_formatEnvVariable = require('./formatEnvVariable.cjs');
|
|
|
31
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
28
|
0 && (module.exports = {
|
|
33
29
|
formatEnvVariable,
|
|
34
|
-
getConfiguration
|
|
35
|
-
intlayerConfiguration,
|
|
36
|
-
intlayerContentConfiguration,
|
|
37
|
-
intlayerIntlConfiguration,
|
|
38
|
-
intlayerMiddlewareConfiguration
|
|
30
|
+
getConfiguration
|
|
39
31
|
});
|
|
40
32
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/envVariables/index.ts"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"sources":["../../../src/envVariables/index.ts"],"sourcesContent":["export { getConfiguration } from './getConfiguration';\nexport { formatEnvVariable } from './formatEnvVariable';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AACjC,+BAAkC;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getConfiguration
|
|
1
|
+
export { getConfiguration } from './getConfiguration.js';
|
|
2
2
|
export { formatEnvVariable } from './formatEnvVariable.js';
|
|
3
3
|
import '../types/config.js';
|
|
4
4
|
import '../types/locales.js';
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -21,11 +21,7 @@ __export(src_exports, {
|
|
|
21
21
|
Locales: () => import_locales.Locales,
|
|
22
22
|
formatEnvVariable: () => import_envVariables.formatEnvVariable,
|
|
23
23
|
getClientConfiguration: () => import_envVariables.getConfiguration,
|
|
24
|
-
getConfiguration: () => import_getConfiguration.getConfiguration
|
|
25
|
-
intlayerConfiguration: () => import_envVariables.intlayerConfiguration,
|
|
26
|
-
intlayerContentConfiguration: () => import_envVariables.intlayerContentConfiguration,
|
|
27
|
-
intlayerIntlConfiguration: () => import_envVariables.intlayerIntlConfiguration,
|
|
28
|
-
intlayerMiddlewareConfiguration: () => import_envVariables.intlayerMiddlewareConfiguration
|
|
24
|
+
getConfiguration: () => import_getConfiguration.getConfiguration
|
|
29
25
|
});
|
|
30
26
|
module.exports = __toCommonJS(src_exports);
|
|
31
27
|
var import_getConfiguration = require('./configFile/getConfiguration.cjs');
|
|
@@ -36,10 +32,6 @@ var import_envVariables = require('./envVariables/index.cjs');
|
|
|
36
32
|
Locales,
|
|
37
33
|
formatEnvVariable,
|
|
38
34
|
getClientConfiguration,
|
|
39
|
-
getConfiguration
|
|
40
|
-
intlayerConfiguration,
|
|
41
|
-
intlayerContentConfiguration,
|
|
42
|
-
intlayerIntlConfiguration,
|
|
43
|
-
intlayerMiddlewareConfiguration
|
|
35
|
+
getConfiguration
|
|
44
36
|
});
|
|
45
37
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getConfiguration } from './configFile/getConfiguration';\n\nexport type {\n InternationalizationConfig,\n ServerSetCookieRule,\n MiddlewareConfig,\n CustomIntlayerConfig,\n BaseContentConfig,\n BaseDerivedConfig,\n ResultDirDerivedConfig,\n PatternsContentConfig,\n ContentConfig,\n IntlayerConfig,\n} from './types/config';\nexport type { LocalesValues } from './types/locales';\nexport { Locales } from './types/locales';\nexport {\n formatEnvVariable,\n
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getConfiguration } from './configFile/getConfiguration';\n\nexport type {\n InternationalizationConfig,\n ServerSetCookieRule,\n MiddlewareConfig,\n CustomIntlayerConfig,\n BaseContentConfig,\n BaseDerivedConfig,\n ResultDirDerivedConfig,\n PatternsContentConfig,\n ContentConfig,\n StrictMode,\n IntlayerConfig,\n} from './types/config';\nexport type { LocalesValues } from './types/locales';\nexport { Locales } from './types/locales';\nexport {\n formatEnvVariable,\n getConfiguration as getClientConfiguration,\n} from './envVariables/index';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AAgBjC,qBAAwB;AACxB,0BAGO;","names":[]}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getConfiguration } from './configFile/getConfiguration.js';
|
|
2
|
-
export { BaseContentConfig, BaseDerivedConfig, ContentConfig, CustomIntlayerConfig, InternationalizationConfig, IntlayerConfig, MiddlewareConfig, PatternsContentConfig, ResultDirDerivedConfig, ServerSetCookieRule } from './types/config.js';
|
|
2
|
+
export { BaseContentConfig, BaseDerivedConfig, ContentConfig, CustomIntlayerConfig, InternationalizationConfig, IntlayerConfig, MiddlewareConfig, PatternsContentConfig, ResultDirDerivedConfig, ServerSetCookieRule, StrictMode } from './types/config.js';
|
|
3
3
|
export { Locales, LocalesValues } from './types/locales.js';
|
|
4
|
-
export { getConfiguration as getClientConfiguration
|
|
4
|
+
export { getConfiguration as getClientConfiguration } from './envVariables/getConfiguration.js';
|
|
5
5
|
export { formatEnvVariable } from './envVariables/formatEnvVariable.js';
|
|
6
6
|
import './envVariables/detectPlatform.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/types/config.ts"],"sourcesContent":["import type { Locales } from './locales';\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 * 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: 'NEXT_LOCALE'\n *\n * The cookie key where the locale information is stored.\n */\n cookieName: string;\n\n /**\n * Whether to prefix the default locale in the URL\n *\n * Default: false\n *\n * When set to true, the default locale is prefixed in the URL for localization purposes.\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 * 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/**\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/**\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.json']\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 dictionariesDirName: 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/**\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/**\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 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']\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']\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"],"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: 'NEXT_LOCALE'\n *\n * The cookie key where the locale information is stored.\n */\n cookieName: string;\n\n /**\n * Whether to prefix the default locale in the URL\n *\n * Default: false\n *\n * When set to true, the default locale is prefixed in the URL for localization purposes.\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 * Port number for the editor server\n *\n * Default: 4000\n *\n * The port number where the editor server runs.\n */\n port: number;\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/**\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/**\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\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"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Locales } from './locales.js';
|
|
2
2
|
|
|
3
|
+
type StrictMode = 'strict' | 'required_only' | 'loose';
|
|
3
4
|
/**
|
|
4
5
|
* Configuration for internationalization settings
|
|
5
6
|
*/
|
|
@@ -12,6 +13,15 @@ type InternationalizationConfig = {
|
|
|
12
13
|
* You can define a list of available locales to support in the application.
|
|
13
14
|
*/
|
|
14
15
|
locales: Locales[];
|
|
16
|
+
/**
|
|
17
|
+
* Ensure strong implementations of internationalized content using typescript.
|
|
18
|
+
* - 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.
|
|
19
|
+
* - 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.
|
|
20
|
+
* - If set to "loose", the translation `t` function will accept any existing locale.
|
|
21
|
+
*
|
|
22
|
+
* Default: "required_only"
|
|
23
|
+
*/
|
|
24
|
+
strictMode: StrictMode;
|
|
15
25
|
/**
|
|
16
26
|
* Default locale of the application for fallback
|
|
17
27
|
*
|
|
@@ -75,6 +85,19 @@ type MiddlewareConfig = {
|
|
|
75
85
|
*/
|
|
76
86
|
noPrefix: boolean;
|
|
77
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Configuration for intlayer editor
|
|
90
|
+
*/
|
|
91
|
+
type EditorConfig = {
|
|
92
|
+
/**
|
|
93
|
+
* Port number for the editor server
|
|
94
|
+
*
|
|
95
|
+
* Default: 4000
|
|
96
|
+
*
|
|
97
|
+
* The port number where the editor server runs.
|
|
98
|
+
*/
|
|
99
|
+
port: number;
|
|
100
|
+
};
|
|
78
101
|
/**
|
|
79
102
|
* Custom configuration that can be provided to override default settings
|
|
80
103
|
*/
|
|
@@ -91,6 +114,10 @@ type CustomIntlayerConfig = {
|
|
|
91
114
|
* Custom content configuration
|
|
92
115
|
*/
|
|
93
116
|
content?: Partial<ContentConfig>;
|
|
117
|
+
/**
|
|
118
|
+
* Custom editor configuration
|
|
119
|
+
*/
|
|
120
|
+
editor?: Partial<EditorConfig>;
|
|
94
121
|
};
|
|
95
122
|
/**
|
|
96
123
|
* Combined configuration for internationalization, middleware, and content
|
|
@@ -108,6 +135,10 @@ type IntlayerConfig = {
|
|
|
108
135
|
* Content configuration
|
|
109
136
|
*/
|
|
110
137
|
content: ContentConfig;
|
|
138
|
+
/**
|
|
139
|
+
* Intlayer editor configuration
|
|
140
|
+
*/
|
|
141
|
+
editor: EditorConfig;
|
|
111
142
|
};
|
|
112
143
|
/**
|
|
113
144
|
* Base configuration for content handling
|
|
@@ -116,7 +147,7 @@ type BaseContentConfig = {
|
|
|
116
147
|
/**
|
|
117
148
|
* File extensions of content to look for
|
|
118
149
|
*
|
|
119
|
-
* Default: ['.content.ts', '.content.js', '.content.json']
|
|
150
|
+
* Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']
|
|
120
151
|
*
|
|
121
152
|
* List of file extensions to scan for content.
|
|
122
153
|
*/
|
|
@@ -167,8 +198,22 @@ type BaseContentConfig = {
|
|
|
167
198
|
* Default: 'dictionary'
|
|
168
199
|
*
|
|
169
200
|
* The directory for storing localization dictionaries.
|
|
201
|
+
*
|
|
202
|
+
* Note:
|
|
203
|
+
* - Ensure the dictionaries output includes intlayer to build the dictionaries for intlayer
|
|
170
204
|
*/
|
|
171
205
|
dictionariesDirName: string;
|
|
206
|
+
/**
|
|
207
|
+
* Name of the directory where dictionaries are stored
|
|
208
|
+
*
|
|
209
|
+
* Default: 'i18n_dictionary'
|
|
210
|
+
*
|
|
211
|
+
* The directory for storing localization dictionaries.
|
|
212
|
+
*
|
|
213
|
+
* Note:
|
|
214
|
+
* - Ensure the dictionaries output includes 'i18next' to build the dictionaries for i18next
|
|
215
|
+
*/
|
|
216
|
+
i18nDictionariesDirName: string;
|
|
172
217
|
/**
|
|
173
218
|
* Name of the directory where dictionary types are stored
|
|
174
219
|
*
|
|
@@ -186,6 +231,7 @@ type BaseContentConfig = {
|
|
|
186
231
|
*/
|
|
187
232
|
mainDirName: string;
|
|
188
233
|
};
|
|
234
|
+
type DictionaryOutput = 'intlayer' | 'i18next';
|
|
189
235
|
/**
|
|
190
236
|
* Configuration derived based on the base content configuration
|
|
191
237
|
*/
|
|
@@ -214,6 +260,19 @@ type BaseDerivedConfig = {
|
|
|
214
260
|
* Defines the derived path for module augmentation.
|
|
215
261
|
*/
|
|
216
262
|
moduleAugmentationDir: string;
|
|
263
|
+
/**
|
|
264
|
+
* Type of dictionary to use as an output
|
|
265
|
+
*
|
|
266
|
+
* Default: ['intlayer']
|
|
267
|
+
*
|
|
268
|
+
* The type of dictionary to use as an output. It can be either 'intlayer' or 'i18next'.
|
|
269
|
+
*
|
|
270
|
+
* Note:
|
|
271
|
+
* - 'i18next' is not yet ensure a 1:1 mapping with the i18next library.
|
|
272
|
+
* - Removing 'intlayer' will break the compatibility with react-intlayer or next-intlayer
|
|
273
|
+
*
|
|
274
|
+
*/
|
|
275
|
+
dictionaryOutput: DictionaryOutput[];
|
|
217
276
|
};
|
|
218
277
|
/**
|
|
219
278
|
* Configuration derived based on the result directory
|
|
@@ -227,6 +286,18 @@ type ResultDirDerivedConfig = {
|
|
|
227
286
|
* Specifies the derived path for dictionaries relative to the result directory.
|
|
228
287
|
*/
|
|
229
288
|
dictionariesDir: string;
|
|
289
|
+
/**
|
|
290
|
+
*
|
|
291
|
+
* Directory where dictionaries are stored, relative to the result directory
|
|
292
|
+
*
|
|
293
|
+
* Default: {{resultDir}} / {{i18nDictionariesDirName}}
|
|
294
|
+
*
|
|
295
|
+
* Specifies the derived path for dictionaries relative to the result directory.
|
|
296
|
+
*
|
|
297
|
+
* Note:
|
|
298
|
+
* - Ensure the i18n dictionaries output includes i18next to build the dictionaries for i18next
|
|
299
|
+
*/
|
|
300
|
+
i18nDictionariesDir: string;
|
|
230
301
|
/**
|
|
231
302
|
* Directory where dictionary types are stored, relative to the result directory
|
|
232
303
|
*
|
|
@@ -251,7 +322,7 @@ type PatternsContentConfig = {
|
|
|
251
322
|
/**
|
|
252
323
|
* Patterns of files to watch for changes
|
|
253
324
|
*
|
|
254
|
-
* Default: ['/**\/*.content.ts', '/**\/*.content.js', '/**\/*.content.json']
|
|
325
|
+
* Default: ['/**\/*.content.ts', '/**\/*.content.js', '/**\/*.content.json', '/**\/*.content.cjs', '/**\/*.content.mjs', '/**\/*.content.tsx', '/**\/*.content.jsx']
|
|
255
326
|
*
|
|
256
327
|
* Defines file patterns for content to watch for changes.
|
|
257
328
|
*/
|
|
@@ -259,7 +330,7 @@ type PatternsContentConfig = {
|
|
|
259
330
|
/**
|
|
260
331
|
* Patterns of files to watch for changes including the relative path
|
|
261
332
|
*
|
|
262
|
-
* Default: ['{{contentDir}}/**\/*.content.ts', '{{contentDir}}/**\/*.content.js', '{{contentDir}}/**\/*.content.json']
|
|
333
|
+
* Default: ['{{contentDir}}/**\/*.content.ts', '{{contentDir}}/**\/*.content.js', '{{contentDir}}/**\/*.content.json', '{{contentDir}}/**\/*.content.cjs', '{{contentDir}}/**\/*.content.mjs', '{{contentDir}}/**\/*.content.tsx', '{{contentDir}}/**\/*.content.jsx']
|
|
263
334
|
*
|
|
264
335
|
* Specifies the file patterns for content to watch, including relative paths.
|
|
265
336
|
*/
|
|
@@ -278,4 +349,4 @@ type PatternsContentConfig = {
|
|
|
278
349
|
*/
|
|
279
350
|
type ContentConfig = BaseContentConfig & BaseDerivedConfig & ResultDirDerivedConfig & PatternsContentConfig;
|
|
280
351
|
|
|
281
|
-
export type { BaseContentConfig, BaseDerivedConfig, ContentConfig, CustomIntlayerConfig, InternationalizationConfig, IntlayerConfig, MiddlewareConfig, PatternsContentConfig, ResultDirDerivedConfig, ServerSetCookieRule };
|
|
352
|
+
export type { BaseContentConfig, BaseDerivedConfig, ContentConfig, CustomIntlayerConfig, DictionaryOutput, EditorConfig, InternationalizationConfig, IntlayerConfig, MiddlewareConfig, PatternsContentConfig, ResultDirDerivedConfig, ServerSetCookieRule, StrictMode };
|
package/dist/esm/client.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { BaseDerivedConfig
|
|
1
|
+
export { BaseContentConfig, BaseDerivedConfig, CustomIntlayerConfig, IntlayerConfig, PatternsContentConfig, ResultDirDerivedConfig } from './types/config.mjs';
|
|
2
2
|
export { Locales, LocalesValues } from './types/locales.mjs';
|
|
3
|
-
export { getConfiguration
|
|
3
|
+
export { getConfiguration } from './envVariables/getConfiguration.mjs';
|
package/dist/esm/client.mjs
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { Locales } from './types/locales.mjs';
|
|
2
|
-
import {
|
|
3
|
-
getConfiguration,
|
|
4
|
-
intlayerConfiguration,
|
|
5
|
-
intlayerContentConfiguration,
|
|
6
|
-
intlayerIntlConfiguration,
|
|
7
|
-
intlayerMiddlewareConfiguration
|
|
8
|
-
} from './envVariables/getConfiguration.mjs';
|
|
2
|
+
import { getConfiguration } from './envVariables/getConfiguration.mjs';
|
|
9
3
|
export {
|
|
10
4
|
Locales,
|
|
11
|
-
getConfiguration
|
|
12
|
-
intlayerConfiguration,
|
|
13
|
-
intlayerContentConfiguration,
|
|
14
|
-
intlayerIntlConfiguration,
|
|
15
|
-
intlayerMiddlewareConfiguration
|
|
5
|
+
getConfiguration
|
|
16
6
|
};
|
|
17
7
|
//# sourceMappingURL=client.mjs.map
|
package/dist/esm/client.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export type {\n CustomIntlayerConfig,\n PatternsContentConfig
|
|
1
|
+
{"version":3,"sources":["../../src/client.ts"],"sourcesContent":["export type {\n CustomIntlayerConfig,\n PatternsContentConfig,\n IntlayerConfig,\n BaseContentConfig,\n BaseDerivedConfig,\n ResultDirDerivedConfig,\n} from './types/config';\nexport type { LocalesValues } from './types/locales';\nexport { Locales } from './types/locales';\nexport { getConfiguration } from './envVariables/getConfiguration';\n"],"mappings":"AASA,SAAS,eAAe;AACxB,SAAS,wBAAwB;","names":[]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { join } from "path";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_LOCALE,
|
|
4
|
+
LOCALES,
|
|
5
|
+
STRICT_MODE
|
|
6
|
+
} from '../defaultValues/internationalization.mjs';
|
|
3
7
|
import {
|
|
4
8
|
BASE_PATH,
|
|
5
9
|
COOKIE_NAME,
|
|
@@ -16,7 +20,9 @@ import {
|
|
|
16
20
|
EXCLUDED_PATHS,
|
|
17
21
|
TYPES_DIR_NAME,
|
|
18
22
|
MAIN_DIR_NAME,
|
|
19
|
-
MODULE_AUGMENTATION_DIR_NAME
|
|
23
|
+
MODULE_AUGMENTATION_DIR_NAME,
|
|
24
|
+
I18N_DICTIONARIES_DIR_NAME,
|
|
25
|
+
DICTIONARY_OUTPUT
|
|
20
26
|
} from '../defaultValues/server.mjs';
|
|
21
27
|
let storedConfiguration;
|
|
22
28
|
const buildInternationalizationFields = (customConfiguration) => ({
|
|
@@ -24,8 +30,18 @@ const buildInternationalizationFields = (customConfiguration) => ({
|
|
|
24
30
|
* Locales available in the application
|
|
25
31
|
*
|
|
26
32
|
* Default: ['en']
|
|
33
|
+
*
|
|
27
34
|
*/
|
|
28
35
|
locales: customConfiguration?.locales ?? LOCALES,
|
|
36
|
+
/**
|
|
37
|
+
* Ensure strong implementations of internationalized content using typescript.
|
|
38
|
+
* - 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.
|
|
39
|
+
* - 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.
|
|
40
|
+
* - If set to "loose", the translation `t` function will accept any existing locale.
|
|
41
|
+
*
|
|
42
|
+
* Default: "required_only"
|
|
43
|
+
*/
|
|
44
|
+
strictMode: customConfiguration?.strictMode ?? STRICT_MODE,
|
|
29
45
|
/**
|
|
30
46
|
* Default locale of the application for fallback
|
|
31
47
|
*
|
|
@@ -92,7 +108,7 @@ const buildContentFields = (customConfiguration) => {
|
|
|
92
108
|
/**
|
|
93
109
|
* File extensions of content to look for to build the dictionaries
|
|
94
110
|
*
|
|
95
|
-
* - Default: ['.content.ts', '.content.js', '.content.json']
|
|
111
|
+
* - Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']
|
|
96
112
|
*
|
|
97
113
|
* - Example: ['.data.ts', '.data.js', '.data.json']
|
|
98
114
|
*
|
|
@@ -168,6 +184,20 @@ const buildContentFields = (customConfiguration) => {
|
|
|
168
184
|
*
|
|
169
185
|
*/
|
|
170
186
|
dictionariesDirName: customConfiguration?.dictionariesDirName ?? DICTIONARIES_DIR_NAME,
|
|
187
|
+
/**
|
|
188
|
+
* Related to the intlayer result directory
|
|
189
|
+
*
|
|
190
|
+
* Directory name where the dictionaries will be stored
|
|
191
|
+
*
|
|
192
|
+
* Default: 'dictionary'
|
|
193
|
+
*
|
|
194
|
+
* Example: 'translations'
|
|
195
|
+
*
|
|
196
|
+
* Note:
|
|
197
|
+
* - If this directory is not at the result directory level, update the dictionariesDir field instead
|
|
198
|
+
*
|
|
199
|
+
*/
|
|
200
|
+
i18nDictionariesDirName: customConfiguration?.i18nDictionariesDirName ?? I18N_DICTIONARIES_DIR_NAME,
|
|
171
201
|
/**
|
|
172
202
|
* Related to the intlayer result directory
|
|
173
203
|
*
|
|
@@ -259,7 +289,17 @@ const buildContentFields = (customConfiguration) => {
|
|
|
259
289
|
moduleAugmentationDir: join(
|
|
260
290
|
notDerivedContentConfig.baseDir,
|
|
261
291
|
notDerivedContentConfig.moduleAugmentationDirName
|
|
262
|
-
)
|
|
292
|
+
),
|
|
293
|
+
/**
|
|
294
|
+
* Output format of the dictionary
|
|
295
|
+
*
|
|
296
|
+
* Default: ['intlayer']
|
|
297
|
+
*
|
|
298
|
+
* Note:
|
|
299
|
+
* - 'i18next' is not yet ensure a 1:1 mapping with the i18next library.
|
|
300
|
+
* - Removing 'intlayer' will break the compatibility with react-intlayer or next-intlayer
|
|
301
|
+
*/
|
|
302
|
+
dictionaryOutput: customConfiguration?.dictionaryOutput ?? DICTIONARY_OUTPUT
|
|
263
303
|
};
|
|
264
304
|
const resultDirDerivedConfiguration = {
|
|
265
305
|
/**
|
|
@@ -281,6 +321,22 @@ const buildContentFields = (customConfiguration) => {
|
|
|
281
321
|
baseDirDerivedConfiguration.resultDir,
|
|
282
322
|
notDerivedContentConfig.dictionariesDirName
|
|
283
323
|
),
|
|
324
|
+
/**
|
|
325
|
+
* Directory where the 18n dictionaries will be stored
|
|
326
|
+
*
|
|
327
|
+
* Relative to the result directory
|
|
328
|
+
*
|
|
329
|
+
* Default: {{resultDir}} / {{i18nDictionariesDirName}}
|
|
330
|
+
*
|
|
331
|
+
* Example: '/path/to/project/.intlayer/dictionary/i18n'
|
|
332
|
+
*
|
|
333
|
+
* Note:
|
|
334
|
+
* - If the types are not at the result directory level, update the i18nDictionariesDirName field instead
|
|
335
|
+
*/
|
|
336
|
+
i18nDictionariesDir: join(
|
|
337
|
+
baseDirDerivedConfiguration.resultDir,
|
|
338
|
+
notDerivedContentConfig.i18nDictionariesDirName
|
|
339
|
+
),
|
|
284
340
|
/**
|
|
285
341
|
* Directory where the dictionaries types will be stored
|
|
286
342
|
*
|
|
@@ -319,7 +375,7 @@ const buildContentFields = (customConfiguration) => {
|
|
|
319
375
|
/**
|
|
320
376
|
* Pattern of files to watch
|
|
321
377
|
*
|
|
322
|
-
* Default: ['/**\/*.content.ts', '/**\/*.content.js', '/**\/*.content.json']
|
|
378
|
+
* Default: ['/**\/*.content.ts', '/**\/*.content.js', '/**\/*.content.json', '/**\/*.content.cjs', '/**\/*.content.mjs', '/**\/*.content.tsx', '/**\/*.content.jsx']
|
|
323
379
|
*/
|
|
324
380
|
watchedFilesPattern: notDerivedContentConfig.fileExtensions.map(
|
|
325
381
|
(ext) => `/**/*${ext}`
|
|
@@ -327,7 +383,7 @@ const buildContentFields = (customConfiguration) => {
|
|
|
327
383
|
/**
|
|
328
384
|
* Pattern of files to watch including the relative path
|
|
329
385
|
*
|
|
330
|
-
* Default: ['{{contentDir}}/**\/*.content.ts', '{{contentDir}}/**\/*.content.js', '{{contentDir}}/**\/*.content.json']
|
|
386
|
+
* Default: ['{{contentDir}}/**\/*.content.ts', '{{contentDir}}/**\/*.content.js', '{{contentDir}}/**\/*.content.json', '{{contentDir}}/**\/*.content.cjs', '{{contentDir}}/**\/*.content.mjs', '{{contentDir}}/**\/*.content.tsx', '{{contentDir}}/**\/*.content.jsx']
|
|
331
387
|
*/
|
|
332
388
|
watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.map(
|
|
333
389
|
(ext) => `${baseDirDerivedConfiguration.contentDir}/**/*${ext}`
|
|
@@ -346,6 +402,14 @@ const buildContentFields = (customConfiguration) => {
|
|
|
346
402
|
...patternsConfiguration
|
|
347
403
|
};
|
|
348
404
|
};
|
|
405
|
+
const buildEditorFields = (customConfiguration) => ({
|
|
406
|
+
/**
|
|
407
|
+
* Port of the editor server
|
|
408
|
+
*
|
|
409
|
+
* Default: 4000
|
|
410
|
+
*/
|
|
411
|
+
port: customConfiguration?.port ?? 4e3
|
|
412
|
+
});
|
|
349
413
|
const buildConfigurationFields = (options, customConfiguration) => {
|
|
350
414
|
const internationalizationConfig = buildInternationalizationFields(
|
|
351
415
|
customConfiguration?.internationalization
|
|
@@ -354,10 +418,12 @@ const buildConfigurationFields = (options, customConfiguration) => {
|
|
|
354
418
|
customConfiguration?.middleware
|
|
355
419
|
);
|
|
356
420
|
const contentConfig = buildContentFields(customConfiguration?.content);
|
|
421
|
+
const editorConfig = buildEditorFields(customConfiguration?.editor);
|
|
357
422
|
storedConfiguration = {
|
|
358
423
|
internationalization: internationalizationConfig,
|
|
359
424
|
middleware: middlewareConfig,
|
|
360
|
-
content: contentConfig
|
|
425
|
+
content: contentConfig,
|
|
426
|
+
editor: editorConfig
|
|
361
427
|
};
|
|
362
428
|
return storedConfiguration;
|
|
363
429
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { join } from 'path';\nimport { DEFAULT_LOCALE, LOCALES } 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 {\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} from '../defaultValues/server';\nimport type {\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n PatternsContentConfig,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n BaseContentConfig,\n ResultDirDerivedConfig,\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 locales: customConfiguration?.locales ?? LOCALES,\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 the default locale in the URL\n *\n * Default: true\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.json']\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 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 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 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 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']\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']\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\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 storedConfiguration = {\n internationalization: internationalizationConfig,\n middleware: middlewareConfig,\n content: contentConfig,\n };\n\n return storedConfiguration;\n};\n"],"mappings":"AAAA,SA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AAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { join } from 'path';\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 {\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} from '../defaultValues/server';\nimport type {\n BaseDerivedConfig,\n ContentConfig,\n CustomIntlayerConfig,\n PatternsContentConfig,\n InternationalizationConfig,\n IntlayerConfig,\n MiddlewareConfig,\n BaseContentConfig,\n ResultDirDerivedConfig,\n EditorConfig,\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 the default locale in the URL\n *\n * Default: true\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 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: 4000\n */\n port: customConfiguration?.port ?? 4000,\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 storedConfiguration = {\n internationalization: internationalizationConfig,\n middleware: middlewareConfig,\n content: contentConfig,\n editor: editorConfig,\n };\n\n return storedConfiguration;\n};\n"],"mappings":"AAAA,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAeP,IAAI;AAIJ,MAAM,kCAAkC,CACtC,yBACgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOhC,SAAS,qBAAqB,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUzC,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,eAAe,qBAAqB,iBAAiB;AACvD;AAEA,MAAM,wBAAwB,CAC5B,yBACsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,YAAY,qBAAqB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,eAAe,qBAAqB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAarD,UAAU,qBAAqB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO3C,iBAAiB,qBAAqB,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AEA,QAAM,wBAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMnD,qBAAqB,wBAAwB,eAAe;AAAA,MAC1D,CAAC,QAAQ,QAAQ,GAAG;AAAA,IACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,6BAA6B,wBAAwB,eAAe;AAAA,MAClE,CAAC,QAAQ,GAAG,4BAA4B,UAAU,QAAQ,GAAG;AAAA,IAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,4BAA4B,GAAG,8BAA8B,eAAe;AAAA,EAC9E;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAEA,MAAM,oBAAoB,CACxB,yBACkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,MAAM,qBAAqB,QAAQ;AACrC;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,wBAAsB;AAAA,IACpB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,EACV;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const PORT = 4000;\n"],"mappings":"AAAO,MAAM,OAAO;","names":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { StrictMode } from '../types/config.mjs';
|
|
1
2
|
import { Locales } from '../types/locales.mjs';
|
|
2
3
|
|
|
3
4
|
declare const LOCALES: Locales[];
|
|
4
5
|
declare const DEFAULT_LOCALE: Locales;
|
|
6
|
+
declare const STRICT_MODE: StrictMode;
|
|
5
7
|
|
|
6
|
-
export { DEFAULT_LOCALE, LOCALES };
|
|
8
|
+
export { DEFAULT_LOCALE, LOCALES, STRICT_MODE };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Locales } from '../types/locales.mjs';
|
|
2
2
|
const LOCALES = [Locales.ENGLISH];
|
|
3
3
|
const DEFAULT_LOCALE = Locales.ENGLISH;
|
|
4
|
+
const STRICT_MODE = "required_only";
|
|
4
5
|
export {
|
|
5
6
|
DEFAULT_LOCALE,
|
|
6
|
-
LOCALES
|
|
7
|
+
LOCALES,
|
|
8
|
+
STRICT_MODE
|
|
7
9
|
};
|
|
8
10
|
//# sourceMappingURL=internationalization.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/defaultValues/internationalization.ts"],"sourcesContent":["import { Locales } from '../types/locales';\n\nexport const LOCALES: Locales[] = [Locales.ENGLISH];\n\nexport const DEFAULT_LOCALE: Locales = Locales.ENGLISH;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/defaultValues/internationalization.ts"],"sourcesContent":["import type { StrictMode } from '../types/config';\nimport { Locales } from '../types/locales';\n\nexport const LOCALES: Locales[] = [Locales.ENGLISH];\n\nexport const DEFAULT_LOCALE: Locales = Locales.ENGLISH;\n\nexport const STRICT_MODE: StrictMode = 'required_only';\n"],"mappings":"AACA,SAAS,eAAe;AAEjB,MAAM,UAAqB,CAAC,QAAQ,OAAO;AAE3C,MAAM,iBAA0B,QAAQ;AAExC,MAAM,cAA0B;","names":[]}
|