@intlayer/config 8.1.2 → 8.1.3
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/_virtual/_rolldown/runtime.cjs +1 -43
- package/dist/cjs/built.cjs +1 -7
- package/dist/cjs/built.cjs.map +1 -1
- package/dist/cjs/client.cjs +1 -40
- package/dist/cjs/configFile/buildConfigurationFields.cjs +1 -188
- package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
- package/dist/cjs/configFile/getConfiguration.cjs +1 -70
- package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
- package/dist/cjs/configFile/index.cjs +1 -10
- package/dist/cjs/configFile/loadConfigurationFile.cjs +1 -33
- package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
- package/dist/cjs/configFile/searchConfigurationFile.cjs +1 -51
- package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
- package/dist/cjs/defaultValues/build.cjs +1 -29
- package/dist/cjs/defaultValues/build.cjs.map +1 -1
- package/dist/cjs/defaultValues/compiler.cjs +1 -24
- package/dist/cjs/defaultValues/compiler.cjs.map +1 -1
- package/dist/cjs/defaultValues/content.cjs +1 -56
- package/dist/cjs/defaultValues/content.cjs.map +1 -1
- package/dist/cjs/defaultValues/dictionary.cjs +1 -26
- package/dist/cjs/defaultValues/dictionary.cjs.map +1 -1
- package/dist/cjs/defaultValues/editor.cjs +1 -41
- package/dist/cjs/defaultValues/editor.cjs.map +1 -1
- package/dist/cjs/defaultValues/index.cjs +1 -78
- package/dist/cjs/defaultValues/internationalization.cjs +1 -27
- package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
- package/dist/cjs/defaultValues/log.cjs +1 -21
- package/dist/cjs/defaultValues/log.cjs.map +1 -1
- package/dist/cjs/defaultValues/routing.cjs +1 -35
- package/dist/cjs/defaultValues/routing.cjs.map +1 -1
- package/dist/cjs/defaultValues/system.cjs +1 -47
- package/dist/cjs/defaultValues/system.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -81
- package/dist/cjs/loadEnvFile.cjs +1 -36
- package/dist/cjs/loadEnvFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/bundleFile.cjs +1 -71
- package/dist/cjs/loadExternalFile/bundleFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/bundleJSFile.cjs +2 -0
- package/dist/cjs/loadExternalFile/bundleJSFile.cjs.map +1 -0
- package/dist/cjs/loadExternalFile/index.cjs +1 -0
- package/dist/cjs/loadExternalFile/loadExternalFile.cjs +1 -79
- package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/parseFileContent.cjs +1 -77
- package/dist/cjs/loadExternalFile/parseFileContent.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs +1 -63
- package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs.map +1 -1
- package/dist/cjs/logger.cjs +1 -150
- package/dist/cjs/logger.cjs.map +1 -1
- package/dist/cjs/node.cjs +1 -0
- package/dist/cjs/utils/ESMxCJSHelpers.cjs +1 -27
- package/dist/cjs/utils/ESMxCJSHelpers.cjs.map +1 -1
- package/dist/cjs/utils/alias.cjs +2 -0
- package/dist/cjs/utils/alias.cjs.map +1 -0
- package/dist/cjs/utils/cacheDisk.cjs +1 -162
- package/dist/cjs/utils/cacheDisk.cjs.map +1 -1
- package/dist/cjs/utils/cacheMemory.cjs +1 -269
- package/dist/cjs/utils/cacheMemory.cjs.map +1 -1
- package/dist/cjs/utils/clearModuleCache.cjs +1 -26
- package/dist/cjs/utils/clearModuleCache.cjs.map +1 -1
- package/dist/cjs/utils/compareVersions.cjs +1 -38
- package/dist/cjs/utils/compareVersions.cjs.map +1 -1
- package/dist/cjs/utils/extractErrorMessage.cjs +1 -95
- package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
- package/dist/cjs/utils/getExtension.cjs +1 -14
- package/dist/cjs/utils/getExtension.cjs.map +1 -1
- package/dist/cjs/utils/getPackageJsonPath.cjs +1 -35
- package/dist/cjs/utils/getPackageJsonPath.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +1 -0
- package/dist/cjs/utils/logStack.cjs +1 -16
- package/dist/cjs/utils/logStack.cjs.map +1 -1
- package/dist/cjs/utils/normalizePath.cjs +1 -17
- package/dist/cjs/utils/normalizePath.cjs.map +1 -1
- package/dist/cjs/utils/retryManager.cjs +2 -0
- package/dist/cjs/utils/retryManager.cjs.map +1 -0
- package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs +1 -13
- package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs +1 -16
- package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/index.cjs +1 -10
- package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs +1 -14
- package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs +1 -19
- package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -22
- package/dist/esm/built.mjs +1 -7
- package/dist/esm/built.mjs.map +1 -1
- package/dist/esm/client.mjs +1 -11
- package/dist/esm/configFile/buildConfigurationFields.mjs +1 -186
- package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
- package/dist/esm/configFile/getConfiguration.mjs +1 -67
- package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
- package/dist/esm/configFile/index.mjs +1 -5
- package/dist/esm/configFile/loadConfigurationFile.mjs +1 -32
- package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
- package/dist/esm/configFile/searchConfigurationFile.mjs +1 -48
- package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
- package/dist/esm/defaultValues/build.mjs +1 -18
- package/dist/esm/defaultValues/build.mjs.map +1 -1
- package/dist/esm/defaultValues/compiler.mjs +1 -19
- package/dist/esm/defaultValues/compiler.mjs.map +1 -1
- package/dist/esm/defaultValues/content.mjs +1 -43
- package/dist/esm/defaultValues/content.mjs.map +1 -1
- package/dist/esm/defaultValues/dictionary.mjs +1 -16
- package/dist/esm/defaultValues/dictionary.mjs.map +1 -1
- package/dist/esm/defaultValues/editor.mjs +1 -26
- package/dist/esm/defaultValues/editor.mjs.map +1 -1
- package/dist/esm/defaultValues/index.mjs +1 -24
- package/dist/esm/defaultValues/internationalization.mjs +1 -17
- package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
- package/dist/esm/defaultValues/log.mjs +1 -13
- package/dist/esm/defaultValues/log.mjs.map +1 -1
- package/dist/esm/defaultValues/routing.mjs +1 -22
- package/dist/esm/defaultValues/routing.mjs.map +1 -1
- package/dist/esm/defaultValues/system.mjs +1 -30
- package/dist/esm/defaultValues/system.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -28
- package/dist/esm/loadEnvFile.mjs +1 -32
- package/dist/esm/loadEnvFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/bundleFile.mjs +1 -67
- package/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/bundleJSFile.mjs +2 -0
- package/dist/esm/loadExternalFile/bundleJSFile.mjs.map +1 -0
- package/dist/esm/loadExternalFile/index.mjs +1 -0
- package/dist/esm/loadExternalFile/loadExternalFile.mjs +1 -75
- package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/parseFileContent.mjs +1 -73
- package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -1
- package/dist/esm/loadExternalFile/transpileTSToCJS.mjs +1 -60
- package/dist/esm/loadExternalFile/transpileTSToCJS.mjs.map +1 -1
- package/dist/esm/logger.mjs +1 -133
- package/dist/esm/logger.mjs.map +1 -1
- package/dist/esm/node.mjs +1 -0
- package/dist/esm/utils/ESMxCJSHelpers.mjs +1 -24
- package/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -1
- package/dist/esm/utils/alias.mjs +2 -0
- package/dist/esm/utils/alias.mjs.map +1 -0
- package/dist/esm/utils/cacheDisk.mjs +1 -159
- package/dist/esm/utils/cacheDisk.mjs.map +1 -1
- package/dist/esm/utils/cacheMemory.mjs +1 -261
- package/dist/esm/utils/cacheMemory.mjs.map +1 -1
- package/dist/esm/utils/clearModuleCache.mjs +1 -25
- package/dist/esm/utils/clearModuleCache.mjs.map +1 -1
- package/dist/esm/utils/compareVersions.mjs +1 -36
- package/dist/esm/utils/compareVersions.mjs.map +1 -1
- package/dist/esm/utils/extractErrorMessage.mjs +1 -93
- package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
- package/dist/esm/utils/getExtension.mjs +1 -12
- package/dist/esm/utils/getExtension.mjs.map +1 -1
- package/dist/esm/utils/getPackageJsonPath.mjs +1 -32
- package/dist/esm/utils/getPackageJsonPath.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +1 -0
- package/dist/esm/utils/logStack.mjs +1 -15
- package/dist/esm/utils/logStack.mjs.map +1 -1
- package/dist/esm/utils/normalizePath.mjs +1 -15
- package/dist/esm/utils/normalizePath.mjs.map +1 -1
- package/dist/esm/utils/retryManager.mjs +2 -0
- package/dist/esm/utils/retryManager.mjs.map +1 -0
- package/dist/esm/utils/stringFormatter/camelCaseToKebabCase.mjs +1 -11
- package/dist/esm/utils/stringFormatter/camelCaseToKebabCase.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/camelCaseToSentence.mjs +1 -14
- package/dist/esm/utils/stringFormatter/camelCaseToSentence.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/index.mjs +1 -6
- package/dist/esm/utils/stringFormatter/kebabCaseToCamelCase.mjs +1 -12
- package/dist/esm/utils/stringFormatter/kebabCaseToCamelCase.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/toLowerCamelCase.mjs +1 -17
- package/dist/esm/utils/stringFormatter/toLowerCamelCase.mjs.map +1 -1
- package/dist/types/index.d.ts +15 -9
- package/dist/types/{bundleJSFile.d.ts → loadExternalFile/bundleJSFile.d.ts} +1 -1
- package/dist/types/loadExternalFile/bundleJSFile.d.ts.map +1 -0
- package/dist/types/loadExternalFile/index.d.ts +6 -0
- package/dist/types/loadExternalFile/loadExternalFile.d.ts +2 -3
- package/dist/types/loadExternalFile/loadExternalFile.d.ts.map +1 -1
- package/dist/types/loadExternalFile/transpileTSToCJS.d.ts +2 -3
- package/dist/types/loadExternalFile/transpileTSToCJS.d.ts.map +1 -1
- package/dist/types/node.d.ts +5 -0
- package/dist/types/{alias.d.ts → utils/alias.d.ts} +1 -1
- package/dist/types/utils/alias.d.ts.map +1 -0
- package/dist/types/utils/getPackageJsonPath.d.ts +1 -2
- package/dist/types/utils/getPackageJsonPath.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +17 -0
- package/dist/types/{retryManager.d.ts → utils/retryManager.d.ts} +1 -1
- package/dist/types/utils/retryManager.d.ts.map +1 -0
- package/package.json +42 -10
- package/dist/cjs/alias.cjs +0 -30
- package/dist/cjs/alias.cjs.map +0 -1
- package/dist/cjs/bundleJSFile.cjs +0 -34
- package/dist/cjs/bundleJSFile.cjs.map +0 -1
- package/dist/cjs/retryManager.cjs +0 -46
- package/dist/cjs/retryManager.cjs.map +0 -1
- package/dist/esm/alias.mjs +0 -28
- package/dist/esm/alias.mjs.map +0 -1
- package/dist/esm/bundleJSFile.mjs +0 -32
- package/dist/esm/bundleJSFile.mjs.map +0 -1
- package/dist/esm/retryManager.mjs +0 -45
- package/dist/esm/retryManager.mjs.map +0 -1
- package/dist/types/alias.d.ts.map +0 -1
- package/dist/types/bundleJSFile.d.ts.map +0 -1
- package/dist/types/retryManager.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildConfigurationFields.mjs","names":[],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { statSync } from 'node:fs';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport type {\n AiConfig,\n BuildConfig,\n CompilerConfig,\n ContentConfig,\n CustomIntlayerConfig,\n DictionaryConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n SystemConfig,\n} from '@intlayer/types';\nimport packageJson from '@intlayer/types/package.json' with { type: 'json' };\nimport {\n BUILD_MODE,\n CACHE,\n OUTPUT_FORMAT,\n TRAVERSE_PATTERN,\n} from '../defaultValues/build';\nimport {\n COMPILER_ENABLED,\n COMPILER_EXCLUDE_PATTERN,\n COMPILER_OUTPUT_DIR,\n COMPILER_TRANSFORM_PATTERN,\n} from '../defaultValues/compiler';\nimport {\n CODE_DIR,\n CONTENT_DIR,\n EXCLUDED_PATHS,\n FILE_EXTENSIONS,\n WATCH,\n} from '../defaultValues/content';\nimport {\n CONTENT_AUTO_TRANSFORMATION,\n FILL,\n IMPORT_MODE,\n LOCATION,\n} from '../defaultValues/dictionary';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n IS_ENABLED,\n LIVE_SYNC,\n LIVE_SYNC_PORT,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from '../defaultValues/routing';\nimport {\n CACHE_DIR,\n CONFIG_DIR,\n DICTIONARIES_DIR,\n DYNAMIC_DICTIONARIES_DIR,\n FETCH_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REMOTE_DICTIONARIES_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n} from '../defaultValues/system';\nimport { normalizePath } from '../utils/normalizePath';\n\nlet storedConfiguration: IntlayerConfig;\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 * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_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 \"inclusive\", 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: \"inclusive\"\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 buildRoutingFields = (\n customConfiguration?: Partial<RoutingConfig>\n): RoutingConfig => ({\n /**\n * URL routing mode for locale handling\n *\n * Controls how locales are represented in application URLs:\n * - 'prefix-no-default': Prefix all locales except the default locale (default)\n * - en → /dashboard\n * - fr → /fr/dashboard\n *\n * - 'prefix-all': Prefix all locales including the default locale\n * - en → /en/dashboard\n * - fr → /fr/dashboard\n *\n * - 'search-params': Use search parameters for locale handling\n * - en → /dashboard?locale=en\n * - fr → /fr/dashboard?locale=fr\n *\n * - 'no-prefix': No locale prefixing in URLs\n * - en → /dashboard\n * - fr → /dashboard\n *\n * Default: 'prefix-no-default'\n */\n mode: customConfiguration?.mode ?? ROUTING_MODE,\n\n /**\n * Configuration for storing the locale in the client (localStorage or sessionStorage)\n *\n * If false, the locale will not be stored by the middleware.\n * If true, the locale storage will consider all default values. (cookie and header)\n *\n * Default: ['cookie', 'header']\n *\n */\n storage: customConfiguration?.storage ?? STORAGE,\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 * Custom URL rewriting rules that override the default routing mode for specific paths.\n * Allows you to define locale-specific paths that differ from the standard routing behavior.\n * Supports dynamic route parameters using `[param]` syntax.\n *\n * Default: undefined\n *\n * Example:\n * ```typescript\n * rewrite: {\n * \"/about\": {\n * en: \"/about\",\n * fr: \"/a-propos\",\n * },\n * \"/product/[slug]\": {\n * en: \"/product/[slug]\",\n * fr: \"/produit/[slug]\",\n * },\n * }\n * ```\n *\n * Note:\n * - The rewrite rules take precedence over the default `mode` behavior.\n * - If a path matches a rewrite rule, the localized path from the rewrite configuration will be used.\n * - Dynamic route parameters are supported using bracket notation (e.g., `[slug]`, `[id]`).\n * - Works with both Next.js and Vite applications.\n */\n rewrite: customConfiguration?.rewrite,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string,\n logFunctions?: LogFunctions\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n const projectBaseDir =\n customConfiguration?.baseDir ?? baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n // Try resolving as a Node module first (e.g. '@intlayer/design-system')\n // Passing { paths: [...] } ensures we look starting from your project baseDir\n absolutePath = require.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n // If resolution fails (it's not a module or it's a relative path like './src'),\n // fall back to standard path joining.\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n // Smart Detection: File vs Directory\n const stats = statSync(absolutePath);\n\n // If it resolved to a file (like package.json \"main\" or index.js),\n // we want the FOLDER containing that file.\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n // Safety Fallback:\n // If statSync fails but it looks like a file (has an extension), strip it.\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n // Return the calculated path (usually a directory)\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n\n const codeDirInput = customConfiguration?.codeDir;\n\n const codeDir = (codeDirInput ?? CODE_DIR).map(optionalJoinBaseDir);\n\n return {\n fileExtensions,\n baseDir: projectBaseDir,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),\n watchedFilesPatternWithPath: fileExtensions.flatMap((ext) =>\n contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`)\n ),\n };\n};\n\nconst buildSystemFields = (\n customConfiguration?: Partial<SystemConfig>,\n contentConfig?: ContentConfig\n): SystemConfig => {\n const projectBaseDir = contentConfig?.baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n absolutePath = require.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const dictionariesDir = optionalJoinBaseDir(\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n );\n\n return {\n moduleAugmentationDir: optionalJoinBaseDir(\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n unmergedDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n remoteDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR\n ),\n dictionariesDir,\n dynamicDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n fetchDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR\n ),\n typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n configDir: optionalJoinBaseDir(\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR),\n outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: true;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/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://app.intlayer.org/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: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_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 /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\n /**\n * Port of the live sync server\n *\n * Default: 4000\n */\n liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\n /**\n * URL of the live sync server in case of remote live sync server\n *\n * Default: `http://localhost:${LIVE_SYNC_PORT}`\n */\n liveSyncURL:\n customConfiguration?.liveSyncURL ??\n `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>,\n logFunctions?: LogFunctions\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'prefix-no-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 * Functions to log\n */\n error: logFunctions?.error,\n log: logFunctions?.log,\n info: logFunctions?.info,\n warn: logFunctions?.warn,\n});\n\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n *\n * Default: undefined\n *\n * The application context.\n *\n * Example: `'My application context'`\n *\n * Note: Can be used to provide additional context about the application to the AI model. You can add more rules (e.g. \"You should not transform urls\").\n */\n applicationContext: customConfiguration?.applicationContext,\n\n /**\n * Base URL for the AI API\n *\n * Default: undefined\n *\n * The base URL for the AI API.\n *\n * Example: `'http://localhost:5000'`\n *\n * Note: Can be used to point to a local, or custom AI API endpoint.\n */\n baseURL: customConfiguration?.baseURL,\n\n /**\n * Data serialization\n *\n * Options:\n * - \"json\": The industry standard. Highly reliable and structured, but consumes more tokens.\n * - \"toon\": An optimized format designed to reduce token consumption (cost-effective). However, it may slightly increase the risk of output inconsistency compared to standard JSON\n *\n * Default: \"json\"\n */\n dataSerialization: customConfiguration?.dataSerialization,\n});\n\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates the mode of the build\n *\n * Default: 'auto'\n *\n * If 'auto', the build will be enabled automatically when the application is built.\n * If 'manual', the build will be set only when the build command is executed.\n *\n * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.\n */\n mode: customConfiguration?.mode ?? BUILD_MODE,\n\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * Live mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as \"dynamic\" mode.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If disabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n * - The \"live\" allows to sync the dictionaries to the live sync server.\n *\n * @deprecated Use `dictionary.importMode` instead.\n */\n importMode: customConfiguration?.importMode,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\n /**\n * Output format of the dictionaries\n *\n * Can be set on large projects to improve build performance.\n *\n * Default: ['cjs', 'esm']\n *\n * The output format of the dictionaries. It can be either 'cjs' or 'esm'.\n * - 'cjs': The dictionaries are outputted as CommonJS modules.\n * - 'esm': The dictionaries are outputted as ES modules.\n */\n outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\n /**\n * Cache\n */\n cache: customConfiguration?.cache ?? CACHE,\n\n /**\n * Require function\n */\n require: customConfiguration?.require,\n});\n\nconst buildCompilerFields = (\n customConfiguration?: Partial<CompilerConfig>\n): CompilerConfig => ({\n /**\n * Indicates if the compiler should be enabled\n */\n enabled: customConfiguration?.enabled ?? COMPILER_ENABLED,\n\n /**\n * Pattern to traverse the code to optimize.\n */\n transformPattern:\n customConfiguration?.transformPattern ?? COMPILER_TRANSFORM_PATTERN,\n\n /**\n * Pattern to exclude from the optimization.\n */\n excludePattern:\n customConfiguration?.excludePattern ?? COMPILER_EXCLUDE_PATTERN,\n\n /**\n * Output directory for the optimized dictionaries.\n */\n outputDir: customConfiguration?.outputDir ?? COMPILER_OUTPUT_DIR,\n});\n\nconst buildDictionaryFields = (\n customConfiguration?: Partial<DictionaryConfig>\n): DictionaryConfig => {\n const contentAutoTransformation =\n customConfiguration?.contentAutoTransformation ??\n CONTENT_AUTO_TRANSFORMATION;\n\n return {\n /**\n * Indicate how the dictionary should be filled using AI.\n *\n * Default: true\n */\n fill: customConfiguration?.fill ?? FILL,\n\n /**\n * Indicates if the content of the dictionary should be automatically transformed.\n *\n * Default: false\n */\n contentAutoTransformation:\n typeof contentAutoTransformation === 'object'\n ? {\n markdown: contentAutoTransformation.markdown ?? false,\n html: contentAutoTransformation.html ?? false,\n insertion: contentAutoTransformation.insertion ?? false,\n }\n : contentAutoTransformation,\n\n /**\n * The location of the dictionary.\n *\n * Default: 'local'\n */\n location: customConfiguration?.location ?? LOCATION,\n\n /**\n * Transform the dictionary in a per-locale dictionary.\n * Each field declared in a per-locale dictionary will be transformed in a translation node.\n * If missing, the dictionary will be treated as a multilingual dictionary.\n */\n locale: customConfiguration?.locale,\n\n /**\n * The title of the dictionary.\n */\n title: customConfiguration?.title,\n\n /**\n * The description of the dictionary.\n */\n description: customConfiguration?.description,\n\n /**\n * Tags to categorize the dictionaries.\n */\n tags: customConfiguration?.tags,\n\n /**\n * The priority of the dictionary.\n */\n priority: customConfiguration?.priority,\n\n /**\n * Indicates the mode of import to use for the dictionary.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n *\n * Default: 'static'\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\n /**\n * The version of the dictionary.\n */\n version: customConfiguration?.version,\n };\n};\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const routingConfig = buildRoutingFields(customConfiguration?.routing);\n\n const contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir,\n logFunctions\n );\n\n const systemConfig = buildSystemFields(\n customConfiguration?.system,\n contentConfig\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n const compilerConfig = buildCompilerFields(customConfiguration?.compiler);\n\n const dictionaryConfig = buildDictionaryFields(\n customConfiguration?.dictionary\n );\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n routing: routingConfig,\n content: contentConfig,\n system: systemConfig,\n editor: editorConfig,\n log: logConfig,\n ai: aiConfig,\n build: buildConfig,\n compiler: compilerConfig,\n dictionary: dictionaryConfig,\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n metadata: {\n name: 'Intlayer',\n version: packageJson.version,\n doc: `https://intlayer.org/docs`,\n },\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA4EA,IAAI;AAEJ,MAAM,mCACJ,yBACgC;CAOhC,SAAS,qBAAqB,WAAW;CAWzC,iBACE,qBAAqB,mBACrB,qBAAqB,WACrB;CAUF,YAAY,qBAAqB,cAAc;CAO/C,eAAe,qBAAqB,iBAAiB;CACtD;AAED,MAAM,sBACJ,yBACmB;CAuBnB,MAAM,qBAAqB,QAAQ;CAWnC,SAAS,qBAAqB,WAAW;CAazC,UAAU,qBAAqB,YAAY;CA6B3C,SAAS,qBAAqB;CAC/B;AAED,MAAM,sBACJ,qBACA,SACA,iBACkB;CAClB,MAAM,iBAAiB,qBAAqB,kBAAkB;CAC9D,MAAM,iBACJ,qBAAqB,WAAW,WAAW,Q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B;EAC9B,UAAU;GACR,MAAM;GACN,SAAS,YAAY;GACrB,KAAK;GACN;EACF;AAED,QAAO"}
|
|
1
|
+
{"version":3,"file":"buildConfigurationFields.mjs","names":[],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { statSync } from 'node:fs';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport type {\n AiConfig,\n BuildConfig,\n CompilerConfig,\n ContentConfig,\n CustomIntlayerConfig,\n DictionaryConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n SystemConfig,\n} from '@intlayer/types';\nimport packageJson from '@intlayer/types/package.json' with { type: 'json' };\nimport {\n BUILD_MODE,\n CACHE,\n OUTPUT_FORMAT,\n TRAVERSE_PATTERN,\n} from '../defaultValues/build';\nimport {\n COMPILER_ENABLED,\n COMPILER_EXCLUDE_PATTERN,\n COMPILER_OUTPUT_DIR,\n COMPILER_TRANSFORM_PATTERN,\n} from '../defaultValues/compiler';\nimport {\n CODE_DIR,\n CONTENT_DIR,\n EXCLUDED_PATHS,\n FILE_EXTENSIONS,\n WATCH,\n} from '../defaultValues/content';\nimport {\n CONTENT_AUTO_TRANSFORMATION,\n FILL,\n IMPORT_MODE,\n LOCATION,\n} from '../defaultValues/dictionary';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n IS_ENABLED,\n LIVE_SYNC,\n LIVE_SYNC_PORT,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from '../defaultValues/routing';\nimport {\n CACHE_DIR,\n CONFIG_DIR,\n DICTIONARIES_DIR,\n DYNAMIC_DICTIONARIES_DIR,\n FETCH_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REMOTE_DICTIONARIES_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n} from '../defaultValues/system';\nimport { normalizePath } from '../utils/normalizePath';\n\nlet storedConfiguration: IntlayerConfig;\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 * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_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 \"inclusive\", 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: \"inclusive\"\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 buildRoutingFields = (\n customConfiguration?: Partial<RoutingConfig>\n): RoutingConfig => ({\n /**\n * URL routing mode for locale handling\n *\n * Controls how locales are represented in application URLs:\n * - 'prefix-no-default': Prefix all locales except the default locale (default)\n * - en → /dashboard\n * - fr → /fr/dashboard\n *\n * - 'prefix-all': Prefix all locales including the default locale\n * - en → /en/dashboard\n * - fr → /fr/dashboard\n *\n * - 'search-params': Use search parameters for locale handling\n * - en → /dashboard?locale=en\n * - fr → /fr/dashboard?locale=fr\n *\n * - 'no-prefix': No locale prefixing in URLs\n * - en → /dashboard\n * - fr → /dashboard\n *\n * Default: 'prefix-no-default'\n */\n mode: customConfiguration?.mode ?? ROUTING_MODE,\n\n /**\n * Configuration for storing the locale in the client (localStorage or sessionStorage)\n *\n * If false, the locale will not be stored by the middleware.\n * If true, the locale storage will consider all default values. (cookie and header)\n *\n * Default: ['cookie', 'header']\n *\n */\n storage: customConfiguration?.storage ?? STORAGE,\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 * Custom URL rewriting rules that override the default routing mode for specific paths.\n * Allows you to define locale-specific paths that differ from the standard routing behavior.\n * Supports dynamic route parameters using `[param]` syntax.\n *\n * Default: undefined\n *\n * Example:\n * ```typescript\n * rewrite: {\n * \"/about\": {\n * en: \"/about\",\n * fr: \"/a-propos\",\n * },\n * \"/product/[slug]\": {\n * en: \"/product/[slug]\",\n * fr: \"/produit/[slug]\",\n * },\n * }\n * ```\n *\n * Note:\n * - The rewrite rules take precedence over the default `mode` behavior.\n * - If a path matches a rewrite rule, the localized path from the rewrite configuration will be used.\n * - Dynamic route parameters are supported using bracket notation (e.g., `[slug]`, `[id]`).\n * - Works with both Next.js and Vite applications.\n */\n rewrite: customConfiguration?.rewrite,\n});\n\nconst buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string,\n logFunctions?: LogFunctions\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n const projectBaseDir =\n customConfiguration?.baseDir ?? baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n // Try resolving as a Node module first (e.g. '@intlayer/design-system')\n // Passing { paths: [...] } ensures we look starting from your project baseDir\n absolutePath = require.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n // If resolution fails (it's not a module or it's a relative path like './src'),\n // fall back to standard path joining.\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n // Smart Detection: File vs Directory\n const stats = statSync(absolutePath);\n\n // If it resolved to a file (like package.json \"main\" or index.js),\n // we want the FOLDER containing that file.\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n // Safety Fallback:\n // If statSync fails but it looks like a file (has an extension), strip it.\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n // Return the calculated path (usually a directory)\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n\n const codeDirInput = customConfiguration?.codeDir;\n\n const codeDir = (codeDirInput ?? CODE_DIR).map(optionalJoinBaseDir);\n\n return {\n fileExtensions,\n baseDir: projectBaseDir,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),\n watchedFilesPatternWithPath: fileExtensions.flatMap((ext) =>\n contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`)\n ),\n };\n};\n\nconst buildSystemFields = (\n customConfiguration?: Partial<SystemConfig>,\n contentConfig?: ContentConfig\n): SystemConfig => {\n const projectBaseDir = contentConfig?.baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n absolutePath = require.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const dictionariesDir = optionalJoinBaseDir(\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n );\n\n return {\n moduleAugmentationDir: optionalJoinBaseDir(\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n unmergedDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n remoteDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR\n ),\n dictionariesDir,\n dynamicDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n fetchDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR\n ),\n typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n configDir: optionalJoinBaseDir(\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR),\n outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: true;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/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://app.intlayer.org/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: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_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 /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\n /**\n * Port of the live sync server\n *\n * Default: 4000\n */\n liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\n /**\n * URL of the live sync server in case of remote live sync server\n *\n * Default: `http://localhost:${LIVE_SYNC_PORT}`\n */\n liveSyncURL:\n customConfiguration?.liveSyncURL ??\n `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>,\n logFunctions?: LogFunctions\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'prefix-no-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 * Functions to log\n */\n error: logFunctions?.error,\n log: logFunctions?.log,\n info: logFunctions?.info,\n warn: logFunctions?.warn,\n});\n\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n *\n * Default: undefined\n *\n * The application context.\n *\n * Example: `'My application context'`\n *\n * Note: Can be used to provide additional context about the application to the AI model. You can add more rules (e.g. \"You should not transform urls\").\n */\n applicationContext: customConfiguration?.applicationContext,\n\n /**\n * Base URL for the AI API\n *\n * Default: undefined\n *\n * The base URL for the AI API.\n *\n * Example: `'http://localhost:5000'`\n *\n * Note: Can be used to point to a local, or custom AI API endpoint.\n */\n baseURL: customConfiguration?.baseURL,\n\n /**\n * Data serialization\n *\n * Options:\n * - \"json\": The industry standard. Highly reliable and structured, but consumes more tokens.\n * - \"toon\": An optimized format designed to reduce token consumption (cost-effective). However, it may slightly increase the risk of output inconsistency compared to standard JSON\n *\n * Default: \"json\"\n */\n dataSerialization: customConfiguration?.dataSerialization,\n});\n\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates the mode of the build\n *\n * Default: 'auto'\n *\n * If 'auto', the build will be enabled automatically when the application is built.\n * If 'manual', the build will be set only when the build command is executed.\n *\n * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.\n */\n mode: customConfiguration?.mode ?? BUILD_MODE,\n\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * Live mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as \"dynamic\" mode.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If disabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n * - The \"live\" allows to sync the dictionaries to the live sync server.\n *\n * @deprecated Use `dictionary.importMode` instead.\n */\n importMode: customConfiguration?.importMode,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\n /**\n * Output format of the dictionaries\n *\n * Can be set on large projects to improve build performance.\n *\n * Default: ['cjs', 'esm']\n *\n * The output format of the dictionaries. It can be either 'cjs' or 'esm'.\n * - 'cjs': The dictionaries are outputted as CommonJS modules.\n * - 'esm': The dictionaries are outputted as ES modules.\n */\n outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\n /**\n * Cache\n */\n cache: customConfiguration?.cache ?? CACHE,\n\n /**\n * Require function\n */\n require: customConfiguration?.require,\n});\n\nconst buildCompilerFields = (\n customConfiguration?: Partial<CompilerConfig>\n): CompilerConfig => ({\n /**\n * Indicates if the compiler should be enabled\n */\n enabled: customConfiguration?.enabled ?? COMPILER_ENABLED,\n\n /**\n * Pattern to traverse the code to optimize.\n */\n transformPattern:\n customConfiguration?.transformPattern ?? COMPILER_TRANSFORM_PATTERN,\n\n /**\n * Pattern to exclude from the optimization.\n */\n excludePattern:\n customConfiguration?.excludePattern ?? COMPILER_EXCLUDE_PATTERN,\n\n /**\n * Output directory for the optimized dictionaries.\n */\n outputDir: customConfiguration?.outputDir ?? COMPILER_OUTPUT_DIR,\n});\n\nconst buildDictionaryFields = (\n customConfiguration?: Partial<DictionaryConfig>\n): DictionaryConfig => {\n const contentAutoTransformation =\n customConfiguration?.contentAutoTransformation ??\n CONTENT_AUTO_TRANSFORMATION;\n\n return {\n /**\n * Indicate how the dictionary should be filled using AI.\n *\n * Default: true\n */\n fill: customConfiguration?.fill ?? FILL,\n\n /**\n * Indicates if the content of the dictionary should be automatically transformed.\n *\n * Default: false\n */\n contentAutoTransformation:\n typeof contentAutoTransformation === 'object'\n ? {\n markdown: contentAutoTransformation.markdown ?? false,\n html: contentAutoTransformation.html ?? false,\n insertion: contentAutoTransformation.insertion ?? false,\n }\n : contentAutoTransformation,\n\n /**\n * The location of the dictionary.\n *\n * Default: 'local'\n */\n location: customConfiguration?.location ?? LOCATION,\n\n /**\n * Transform the dictionary in a per-locale dictionary.\n * Each field declared in a per-locale dictionary will be transformed in a translation node.\n * If missing, the dictionary will be treated as a multilingual dictionary.\n */\n locale: customConfiguration?.locale,\n\n /**\n * The title of the dictionary.\n */\n title: customConfiguration?.title,\n\n /**\n * The description of the dictionary.\n */\n description: customConfiguration?.description,\n\n /**\n * Tags to categorize the dictionaries.\n */\n tags: customConfiguration?.tags,\n\n /**\n * The priority of the dictionary.\n */\n priority: customConfiguration?.priority,\n\n /**\n * Indicates the mode of import to use for the dictionary.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n *\n * Default: 'static'\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\n /**\n * The version of the dictionary.\n */\n version: customConfiguration?.version,\n };\n};\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const routingConfig = buildRoutingFields(customConfiguration?.routing);\n\n const contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir,\n logFunctions\n );\n\n const systemConfig = buildSystemFields(\n customConfiguration?.system,\n contentConfig\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n const compilerConfig = buildCompilerFields(customConfiguration?.compiler);\n\n const dictionaryConfig = buildDictionaryFields(\n customConfiguration?.dictionary\n );\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n routing: routingConfig,\n content: contentConfig,\n system: systemConfig,\n editor: editorConfig,\n log: logConfig,\n ai: aiConfig,\n build: buildConfig,\n compiler: compilerConfig,\n dictionary: dictionaryConfig,\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n metadata: {\n name: 'Intlayer',\n version: packageJson.version,\n doc: `https://intlayer.org/docs`,\n },\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":"6/CA4EA,IAAI,EAEJ,MAAM,EACJ,IACgC,CAOhC,QAAS,GAAqB,SAAW,EAWzC,gBACE,GAAqB,iBACrB,GAAqB,SACrB,EAUF,WAAY,GAAqB,YAAc,EAO/C,cAAe,GAAqB,eAAiB,EACtD,EAEK,EACJ,IACmB,CAuBnB,KAAM,GAAqB,MAAQ,EAWnC,QAAS,GAAqB,SAAW,EAazC,SAAU,GAAqB,UAAY,EA6B3C,Q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
|
|
2
|
-
import { cacheMemory } from "../utils/cacheMemory.mjs";
|
|
3
|
-
import { getPackageJsonPath } from "../utils/getPackageJsonPath.mjs";
|
|
4
|
-
import { buildConfigurationFields } from "./buildConfigurationFields.mjs";
|
|
5
|
-
import { searchConfigurationFile } from "./searchConfigurationFile.mjs";
|
|
6
|
-
import { loadConfigurationFile } from "./loadConfigurationFile.mjs";
|
|
7
|
-
import { relative } from "node:path";
|
|
8
|
-
import { defu } from "defu";
|
|
9
|
-
|
|
10
|
-
//#region src/configFile/getConfiguration.ts
|
|
11
|
-
/**
|
|
12
|
-
* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
|
|
13
|
-
*/
|
|
14
|
-
const getConfigurationAndFilePath = (options) => {
|
|
15
|
-
let baseDir;
|
|
16
|
-
try {
|
|
17
|
-
baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;
|
|
18
|
-
} catch (_err) {
|
|
19
|
-
return {
|
|
20
|
-
configuration: buildConfigurationFields({}, options?.baseDir, options?.logFunctions),
|
|
21
|
-
configurationFilePath: void 0
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const cachedConfiguration = cacheMemory.get(options);
|
|
25
|
-
if (cachedConfiguration) return cachedConfiguration;
|
|
26
|
-
const { configurationFilePath, numCustomConfiguration } = searchConfigurationFile(baseDir);
|
|
27
|
-
if (options?.override?.log?.mode === "verbose") logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);
|
|
28
|
-
let storedConfiguration;
|
|
29
|
-
if (configurationFilePath) storedConfiguration = buildConfigurationFields(loadConfigurationFile(configurationFilePath, {
|
|
30
|
-
projectRequire: options?.require,
|
|
31
|
-
envVarOptions: {
|
|
32
|
-
env: options?.env,
|
|
33
|
-
envFile: options?.envFile
|
|
34
|
-
},
|
|
35
|
-
additionalEnvVars: options?.additionalEnvVars,
|
|
36
|
-
aliases: options?.aliases
|
|
37
|
-
}), options?.baseDir, options?.logFunctions);
|
|
38
|
-
else storedConfiguration = buildConfigurationFields({}, options?.baseDir, options?.logFunctions);
|
|
39
|
-
const configWithProjectRequire = defu(options?.require ? { build: {
|
|
40
|
-
require: options?.require,
|
|
41
|
-
cache: options?.cache
|
|
42
|
-
} } : {}, storedConfiguration);
|
|
43
|
-
const configuration = defu(options?.override ?? {}, configWithProjectRequire);
|
|
44
|
-
cacheMemory.set(options, {
|
|
45
|
-
configuration,
|
|
46
|
-
configurationFilePath
|
|
47
|
-
});
|
|
48
|
-
return {
|
|
49
|
-
configuration,
|
|
50
|
-
configurationFilePath
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
|
|
55
|
-
*/
|
|
56
|
-
const getConfiguration = (options) => getConfigurationAndFilePath(options).configuration;
|
|
57
|
-
const logConfigFileResult = (baseDir, numCustomConfiguration, configurationFilePath) => {
|
|
58
|
-
if (numCustomConfiguration === 0) logger("Configuration file not found, using default configuration.", { isVerbose: true });
|
|
59
|
-
else {
|
|
60
|
-
const relativeOutputPath = relative(baseDir, configurationFilePath);
|
|
61
|
-
if (numCustomConfiguration === 1) logger(`Configuration file found: ${relativeOutputPath}.`, { isVerbose: true });
|
|
62
|
-
else logger(`Multiple configuration files found, using ${relativeOutputPath}.`, { isVerbose: true });
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
|
-
export { getConfiguration, getConfigurationAndFilePath };
|
|
1
|
+
import{logger as e}from"../logger.mjs";import{cacheMemory as t}from"../utils/cacheMemory.mjs";import{getPackageJsonPath as n}from"../utils/getPackageJsonPath.mjs";import{buildConfigurationFields as r}from"./buildConfigurationFields.mjs";import{loadConfigurationFile as i}from"./loadConfigurationFile.mjs";import{searchConfigurationFile as a}from"./searchConfigurationFile.mjs";import{relative as o}from"node:path";import{defu as s}from"defu";const c=e=>{let o;try{o=e?.baseDir??n().baseDir}catch{return{configuration:r({},e?.baseDir,e?.logFunctions),configurationFilePath:void 0}}let c=t.get(e);if(c)return c;let{configurationFilePath:l,numCustomConfiguration:d}=a(o);e?.override?.log?.mode===`verbose`&&u(o,d,l);let f;f=r(l?i(l,{projectRequire:e?.require,envVarOptions:{env:e?.env,envFile:e?.envFile},additionalEnvVars:e?.additionalEnvVars,aliases:e?.aliases}):{},e?.baseDir,e?.logFunctions);let p=s(e?.require?{build:{require:e?.require,cache:e?.cache}}:{},f),m=s(e?.override??{},p);return t.set(e,{configuration:m,configurationFilePath:l}),{configuration:m,configurationFilePath:l}},l=e=>c(e).configuration,u=(t,n,r)=>{if(n===0)e(`Configuration file not found, using default configuration.`,{isVerbose:!0});else{let i=o(t,r);e(n===1?`Configuration file found: ${i}.`:`Multiple configuration files found, using ${i}.`,{isVerbose:!0})}};export{l as getConfiguration,c as getConfigurationAndFilePath};
|
|
68
2
|
//# sourceMappingURL=getConfiguration.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfiguration.mjs","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types';\nimport { defu } from 'defu';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { logger } from '../logger';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n if (options?.override?.log?.mode === 'verbose') {\n logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);\n }\n\n let storedConfiguration: IntlayerConfig;\n\n if (configurationFilePath) {\n // Load the custom configuration\n const customConfiguration: CustomIntlayerConfig | undefined =\n loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n configurationFilePath,\n });\n\n return {\n configuration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n\nconst logConfigFileResult = (\n baseDir: string,\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getConfiguration.mjs","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types';\nimport { defu } from 'defu';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { logger } from '../logger';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n if (options?.override?.log?.mode === 'verbose') {\n logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);\n }\n\n let storedConfiguration: IntlayerConfig;\n\n if (configurationFilePath) {\n // Load the custom configuration\n const customConfiguration: CustomIntlayerConfig | undefined =\n loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n configurationFilePath,\n });\n\n return {\n configuration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n\nconst logConfigFileResult = (\n baseDir: string,\n numCustomConfiguration?: number,\n configurationFilePath?: string\n) => {\n if (numCustomConfiguration === 0) {\n logger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n logger(`Configuration file found: ${relativeOutputPath}.`, {\n isVerbose: true,\n });\n } else {\n logger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n};\n"],"mappings":"0bAqCA,MAAa,EACX,GACsC,CACtC,IAAI,EAEJ,GAAI,CAEF,EAAU,GAAS,SAAW,GAAoB,CAAC,aACtC,CAEb,MAAO,CACL,cAAe,EACb,EAAE,CACF,GAAS,QACT,GAAS,aACV,CACD,sBAAuB,IAAA,GACxB,CAGH,IAAM,EACJ,EAAY,IAAuC,EAAQ,CAE7D,GAAI,EAAqB,OAAO,EAGhC,GAAM,CAAE,wBAAuB,0BAC7B,EAAwB,EAAQ,CAE9B,GAAS,UAAU,KAAK,OAAS,WACnC,EAAoB,EAAS,EAAwB,EAAsB,CAG7E,IAAI,EAEJ,AAuBE,EAPsB,EAhBpB,EAGA,EAAsB,EAAuB,CAC3C,eAAgB,GAAS,QAEzB,cAAe,CACb,IAAK,GAAS,IACd,QAAS,GAAS,QACnB,CAED,kBAAmB,GAAS,kBAC5B,QAAS,GAAS,QACnB,CAAC,CAWF,EAAE,CANF,GAAS,QACT,GAAS,aAQV,CAcH,IAAM,EAA2B,EATkB,GAAS,QACxD,CACE,MAAO,CACL,QAAS,GAAS,QAClB,MAAO,GAAS,MACjB,CACF,CACD,EAAE,CAIJ,EACD,CAEK,EAAgB,EACpB,GAAS,UAAY,EAAE,CACvB,EACD,CAOD,OALA,EAAY,IAAI,EAAS,CACvB,gBACA,wBACD,CAAC,CAEK,CACL,gBACA,wBACD,EAMU,EACX,GACmB,EAA4B,EAAQ,CAAC,cAEpD,GACJ,EACA,EACA,IACG,CACH,GAAI,IAA2B,EAC7B,EAAO,6DAA8D,CACnE,UAAW,GACZ,CAAC,KACG,CACL,IAAM,EAAqB,EAAS,EAAS,EAAuB,CAGlE,EADE,IAA2B,EACtB,6BAA6B,EAAmB,GAKrD,6CAA6C,EAAmB,GALP,CACzD,UAAW,GACZ,CAOA"}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { configurationFilesCandidates, searchConfigurationFile } from "./searchConfigurationFile.mjs";
|
|
3
|
-
import { getConfiguration, getConfigurationAndFilePath } from "./getConfiguration.mjs";
|
|
4
|
-
|
|
5
|
-
export { buildConfigurationFields, configurationFilesCandidates, getConfiguration, getConfigurationAndFilePath, searchConfigurationFile };
|
|
1
|
+
import{buildConfigurationFields as e}from"./buildConfigurationFields.mjs";import{configurationFilesCandidates as t,searchConfigurationFile as n}from"./searchConfigurationFile.mjs";import{getConfiguration as r,getConfigurationAndFilePath as i}from"./getConfiguration.mjs";export{e as buildConfigurationFields,t as configurationFilesCandidates,r as getConfiguration,i as getConfigurationAndFilePath,n as searchConfigurationFile};
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { loadExternalFileSync } from "../loadExternalFile/loadExternalFile.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/configFile/loadConfigurationFile.ts
|
|
5
|
-
const filterValidConfiguration = (configuration) => {
|
|
6
|
-
return configuration;
|
|
7
|
-
};
|
|
8
|
-
const getAliases = (options) => {
|
|
9
|
-
try {
|
|
10
|
-
return {
|
|
11
|
-
...options?.aliases,
|
|
12
|
-
intlayer: configESMxCJSRequire.resolve("@intlayer/types")
|
|
13
|
-
};
|
|
14
|
-
} catch {
|
|
15
|
-
return options?.aliases;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Load the configuration file from the given path
|
|
20
|
-
* Example of configuration file: intlayer.config.js
|
|
21
|
-
*
|
|
22
|
-
* Accepts JSON, JS, MJS and TS files as configuration
|
|
23
|
-
*/
|
|
24
|
-
const loadConfigurationFile = (configFilePath, options) => {
|
|
25
|
-
return filterValidConfiguration(loadExternalFileSync(configFilePath, {
|
|
26
|
-
...options,
|
|
27
|
-
aliases: getAliases(options)
|
|
28
|
-
}));
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { loadConfigurationFile };
|
|
1
|
+
import{configESMxCJSRequire as e}from"../utils/ESMxCJSHelpers.mjs";import{loadExternalFileSync as t}from"../loadExternalFile/loadExternalFile.mjs";const n=e=>e,r=t=>{try{return{...t?.aliases,intlayer:e.resolve(`@intlayer/types`)}}catch{return t?.aliases}},i=(e,i)=>n(t(e,{...i,aliases:r(i)}));export{i as loadConfigurationFile};
|
|
33
2
|
//# sourceMappingURL=loadConfigurationFile.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import type { CustomIntlayerConfig } from '@intlayer/types';\nimport {\n type LoadExternalFileOptions,\n loadExternalFileSync,\n} from '../loadExternalFile/loadExternalFile';\nimport { configESMxCJSRequire } from '../utils/ESMxCJSHelpers';\n\nconst filterValidConfiguration = (\n configuration: CustomIntlayerConfig\n): CustomIntlayerConfig => {\n // @TODO Implement filtering of valid configuration\n return configuration;\n};\n\nconst getAliases = (\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n) => {\n // Can fail if CJS hot removed from the module (e.g. in Tanstack Start + Nitro)\n try {\n return {\n ...options?.aliases,\n // Replace intlayer with @intlayer/types to avoid circular dependency intlayer -> @intlayer/config -> intlayer\n intlayer: configESMxCJSRequire.resolve('@intlayer/types'),\n };\n } catch {\n return options?.aliases;\n }\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string,\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n): CustomIntlayerConfig | undefined => {\n const fileContent = loadExternalFileSync(configFilePath, {\n ...options,\n aliases: getAliases(options),\n });\n\n return filterValidConfiguration(fileContent);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import type { CustomIntlayerConfig } from '@intlayer/types';\nimport {\n type LoadExternalFileOptions,\n loadExternalFileSync,\n} from '../loadExternalFile/loadExternalFile';\nimport { configESMxCJSRequire } from '../utils/ESMxCJSHelpers';\n\nconst filterValidConfiguration = (\n configuration: CustomIntlayerConfig\n): CustomIntlayerConfig => {\n // @TODO Implement filtering of valid configuration\n return configuration;\n};\n\nconst getAliases = (\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n) => {\n // Can fail if CJS hot removed from the module (e.g. in Tanstack Start + Nitro)\n try {\n return {\n ...options?.aliases,\n // Replace intlayer with @intlayer/types to avoid circular dependency intlayer -> @intlayer/config -> intlayer\n intlayer: configESMxCJSRequire.resolve('@intlayer/types'),\n };\n } catch {\n return options?.aliases;\n }\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string,\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n): CustomIntlayerConfig | undefined => {\n const fileContent = loadExternalFileSync(configFilePath, {\n ...options,\n aliases: getAliases(options),\n });\n\n return filterValidConfiguration(fileContent);\n};\n"],"mappings":"mJAOA,MAAM,EACJ,GAGO,EAGH,EACJ,GACG,CAEH,GAAI,CACF,MAAO,CACL,GAAG,GAAS,QAEZ,SAAU,EAAqB,QAAQ,kBAAkB,CAC1D,MACK,CACN,OAAO,GAAS,UAUP,GACX,EACA,IAOO,EALa,EAAqB,EAAgB,CACvD,GAAG,EACH,QAAS,EAAW,EAAQ,CAC7B,CAAC,CAE0C"}
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getPackageJsonPath } from "../utils/getPackageJsonPath.mjs";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
import { existsSync } from "node:fs";
|
|
5
|
-
|
|
6
|
-
//#region src/configFile/searchConfigurationFile.ts
|
|
7
|
-
const configurationFilesCandidates = [
|
|
8
|
-
"intlayer.config.ts",
|
|
9
|
-
"intlayer.config.js",
|
|
10
|
-
"intlayer.config.json",
|
|
11
|
-
"intlayer.config.json5",
|
|
12
|
-
"intlayer.config.jsonc",
|
|
13
|
-
"intlayer.config.cjs",
|
|
14
|
-
"intlayer.config.mjs",
|
|
15
|
-
".intlayerrc"
|
|
16
|
-
];
|
|
17
|
-
/**
|
|
18
|
-
* Search for the configuration file in the given path
|
|
19
|
-
*
|
|
20
|
-
* List of detected configuration files:
|
|
21
|
-
* - intlayer.config.ts
|
|
22
|
-
* - intlayer.config.js
|
|
23
|
-
* - intlayer.config.json
|
|
24
|
-
* - intlayer.config.cjs
|
|
25
|
-
* - intlayer.config.mjs
|
|
26
|
-
* - .intlayerrc
|
|
27
|
-
*/
|
|
28
|
-
const searchConfigurationFile = (startDir) => {
|
|
29
|
-
let configurationFilePath;
|
|
30
|
-
let numCustomConfiguration = 0;
|
|
31
|
-
const { baseDir } = getPackageJsonPath(startDir);
|
|
32
|
-
for (const fileName of configurationFilesCandidates) try {
|
|
33
|
-
const filePath = resolve(baseDir, fileName);
|
|
34
|
-
if (!existsSync(filePath)) {} else {
|
|
35
|
-
numCustomConfiguration += 1;
|
|
36
|
-
if (!configurationFilePath) configurationFilePath = filePath;
|
|
37
|
-
}
|
|
38
|
-
} catch (error) {
|
|
39
|
-
logger(`${fileName}: ${error}`, { level: "error" });
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
configurationFilePath,
|
|
43
|
-
numCustomConfiguration
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
export { configurationFilesCandidates, searchConfigurationFile };
|
|
1
|
+
import{logger as e}from"../logger.mjs";import{getPackageJsonPath as t}from"../utils/getPackageJsonPath.mjs";import{resolve as n}from"node:path";import{existsSync as r}from"node:fs";const i=[`intlayer.config.ts`,`intlayer.config.js`,`intlayer.config.json`,`intlayer.config.json5`,`intlayer.config.jsonc`,`intlayer.config.cjs`,`intlayer.config.mjs`,`.intlayerrc`],a=a=>{let o,s=0,{baseDir:c}=t(a);for(let t of i)try{let e=n(c,t);r(e)&&(s+=1,o||=e)}catch(n){e(`${t}: ${n}`,{level:`error`})}return{configurationFilePath:o,numCustomConfiguration:s}};export{i as configurationFilesCandidates,a as searchConfigurationFile};
|
|
49
2
|
//# sourceMappingURL=searchConfigurationFile.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { logger } from '../logger';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\n\nexport const configurationFilesCandidates = [\n 'intlayer.config.ts',\n 'intlayer.config.js',\n 'intlayer.config.json',\n 'intlayer.config.json5',\n 'intlayer.config.jsonc',\n 'intlayer.config.cjs',\n 'intlayer.config.mjs',\n '.intlayerrc',\n] as const;\n\ntype SearchConfigurationFileResult = {\n configurationFilePath?: string;\n numCustomConfiguration: number;\n};\n\n/**\n * Search for the configuration file in the given path\n *\n * List of detected configuration files:\n * - intlayer.config.ts\n * - intlayer.config.js\n * - intlayer.config.json\n * - intlayer.config.cjs\n * - intlayer.config.mjs\n * - .intlayerrc\n */\nexport const searchConfigurationFile = (\n startDir: string\n): SearchConfigurationFileResult => {\n let configurationFilePath: string | undefined;\n let numCustomConfiguration = 0;\n\n const { baseDir } = getPackageJsonPath(startDir);\n\n for (const fileName of configurationFilesCandidates) {\n try {\n const filePath = resolve(baseDir, fileName);\n\n // Check if the file exists\n if (!existsSync(filePath)) {\n } else {\n numCustomConfiguration += 1;\n\n if (!configurationFilePath) {\n configurationFilePath = filePath;\n }\n }\n } catch (error) {\n // Return \"Cannot use import statement outside a module\"\n logger(`${fileName}: ${error as string}`, { level: 'error' });\n }\n }\n\n return { configurationFilePath, numCustomConfiguration };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"searchConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { logger } from '../logger';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\n\nexport const configurationFilesCandidates = [\n 'intlayer.config.ts',\n 'intlayer.config.js',\n 'intlayer.config.json',\n 'intlayer.config.json5',\n 'intlayer.config.jsonc',\n 'intlayer.config.cjs',\n 'intlayer.config.mjs',\n '.intlayerrc',\n] as const;\n\ntype SearchConfigurationFileResult = {\n configurationFilePath?: string;\n numCustomConfiguration: number;\n};\n\n/**\n * Search for the configuration file in the given path\n *\n * List of detected configuration files:\n * - intlayer.config.ts\n * - intlayer.config.js\n * - intlayer.config.json\n * - intlayer.config.cjs\n * - intlayer.config.mjs\n * - .intlayerrc\n */\nexport const searchConfigurationFile = (\n startDir: string\n): SearchConfigurationFileResult => {\n let configurationFilePath: string | undefined;\n let numCustomConfiguration = 0;\n\n const { baseDir } = getPackageJsonPath(startDir);\n\n for (const fileName of configurationFilesCandidates) {\n try {\n const filePath = resolve(baseDir, fileName);\n\n // Check if the file exists\n if (!existsSync(filePath)) {\n } else {\n numCustomConfiguration += 1;\n\n if (!configurationFilePath) {\n configurationFilePath = filePath;\n }\n }\n } catch (error) {\n // Return \"Cannot use import statement outside a module\"\n logger(`${fileName}: ${error as string}`, { level: 'error' });\n }\n }\n\n return { configurationFilePath, numCustomConfiguration };\n};\n"],"mappings":"qLAKA,MAAa,EAA+B,CAC1C,qBACA,qBACA,uBACA,wBACA,wBACA,sBACA,sBACA,cACD,CAkBY,EACX,GACkC,CAClC,IAAI,EACA,EAAyB,EAEvB,CAAE,WAAY,EAAmB,EAAS,CAEhD,IAAK,IAAM,KAAY,EACrB,GAAI,CACF,IAAM,EAAW,EAAQ,EAAS,EAAS,CAGtC,EAAW,EAAS,GAEvB,GAA0B,EAE1B,AACE,IAAwB,SAGrB,EAAO,CAEd,EAAO,GAAG,EAAS,IAAI,IAAmB,CAAE,MAAO,QAAS,CAAC,CAIjE,MAAO,CAAE,wBAAuB,yBAAwB"}
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/defaultValues/build.ts
|
|
4
|
-
var build_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
-
BUILD_MODE: () => BUILD_MODE,
|
|
6
|
-
CACHE: () => CACHE,
|
|
7
|
-
OPTIMIZE: () => OPTIMIZE,
|
|
8
|
-
OUTPUT_FORMAT: () => OUTPUT_FORMAT,
|
|
9
|
-
TRAVERSE_PATTERN: () => TRAVERSE_PATTERN
|
|
10
|
-
});
|
|
11
|
-
const BUILD_MODE = "auto";
|
|
12
|
-
const OPTIMIZE = void 0;
|
|
13
|
-
const TRAVERSE_PATTERN = ["**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}", "!**/node_modules/**"];
|
|
14
|
-
const OUTPUT_FORMAT = ["esm", "cjs"];
|
|
15
|
-
const CACHE = true;
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { BUILD_MODE, CACHE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN, build_exports };
|
|
1
|
+
import{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";var t=e({BUILD_MODE:()=>n,CACHE:()=>o,OPTIMIZE:()=>r,OUTPUT_FORMAT:()=>a,TRAVERSE_PATTERN:()=>i});const n=`auto`,r=void 0,i=[`**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}`,`!**/node_modules/**`],a=[`esm`,`cjs`],o=!0;export{n as BUILD_MODE,o as CACHE,r as OPTIMIZE,a as OUTPUT_FORMAT,i as TRAVERSE_PATTERN,t as build_exports};
|
|
19
2
|
//# sourceMappingURL=build.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.mjs","names":[],"sources":["../../../src/defaultValues/build.ts"],"sourcesContent":["export const BUILD_MODE = 'auto';\n\nexport const OPTIMIZE = undefined;\n\nexport const TRAVERSE_PATTERN = [\n '**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}',\n '!**/node_modules/**',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.mjs","names":[],"sources":["../../../src/defaultValues/build.ts"],"sourcesContent":["export const BUILD_MODE = 'auto';\n\nexport const OPTIMIZE = undefined;\n\nexport const TRAVERSE_PATTERN = [\n '**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}',\n '!**/node_modules/**',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n"],"mappings":"kKAAA,MAAa,EAAa,OAEb,EAAW,IAAA,GAEX,EAAmB,CAC9B,+CACA,sBACD,CAEY,EAAmC,CAAC,MAAO,MAAM,CAEjD,EAAQ"}
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const COMPILER_ENABLED = true;
|
|
3
|
-
const COMPILER_TRANSFORM_PATTERN = ["**/*.{ts,tsx,jsx,js,cjs,mjs,svelte,vue}"];
|
|
4
|
-
const COMPILER_EXCLUDE_PATTERN = [
|
|
5
|
-
"**/node_modules/**",
|
|
6
|
-
"**/dist/**",
|
|
7
|
-
"**/.next/**",
|
|
8
|
-
"**/.nuxt/**",
|
|
9
|
-
"**/.expo/**",
|
|
10
|
-
"**/.vercel/**",
|
|
11
|
-
"**/.turbo/**",
|
|
12
|
-
"**/.tanstack/**",
|
|
13
|
-
"**/*.stories.ts",
|
|
14
|
-
"**/*.test.ts"
|
|
15
|
-
];
|
|
16
|
-
const COMPILER_OUTPUT_DIR = "./compiler";
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { COMPILER_ENABLED, COMPILER_EXCLUDE_PATTERN, COMPILER_OUTPUT_DIR, COMPILER_TRANSFORM_PATTERN };
|
|
1
|
+
const e=!0,t=[`**/*.{ts,tsx,jsx,js,cjs,mjs,svelte,vue}`],n=[`**/node_modules/**`,`**/dist/**`,`**/.next/**`,`**/.nuxt/**`,`**/.expo/**`,`**/.vercel/**`,`**/.turbo/**`,`**/.tanstack/**`,`**/*.stories.ts`,`**/*.test.ts`],r=`./compiler`;export{e as COMPILER_ENABLED,n as COMPILER_EXCLUDE_PATTERN,r as COMPILER_OUTPUT_DIR,t as COMPILER_TRANSFORM_PATTERN};
|
|
20
2
|
//# sourceMappingURL=compiler.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.mjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED = true;\nexport const COMPILER_TRANSFORM_PATTERN = [\n '**/*.{ts,tsx,jsx,js,cjs,mjs,svelte,vue}',\n];\nexport const COMPILER_EXCLUDE_PATTERN = [\n '**/node_modules/**',\n '**/dist/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.expo/**',\n '**/.vercel/**',\n '**/.turbo/**',\n '**/.tanstack/**',\n '**/*.stories.ts',\n '**/*.test.ts',\n];\nexport const COMPILER_OUTPUT_DIR = './compiler';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"compiler.mjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED = true;\nexport const COMPILER_TRANSFORM_PATTERN = [\n '**/*.{ts,tsx,jsx,js,cjs,mjs,svelte,vue}',\n];\nexport const COMPILER_EXCLUDE_PATTERN = [\n '**/node_modules/**',\n '**/dist/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.expo/**',\n '**/.vercel/**',\n '**/.turbo/**',\n '**/.tanstack/**',\n '**/*.stories.ts',\n '**/*.test.ts',\n];\nexport const COMPILER_OUTPUT_DIR = './compiler';\n"],"mappings":"AAAA,MAAa,EAAmB,GACnB,EAA6B,CACxC,0CACD,CACY,EAA2B,CACtC,qBACA,aACA,cACA,cACA,cACA,gBACA,eACA,kBACA,kBACA,eACD,CACY,EAAsB"}
|
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/defaultValues/content.ts
|
|
4
|
-
var content_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
-
CODE_DIR: () => CODE_DIR,
|
|
6
|
-
CONTENT_DIR: () => CONTENT_DIR,
|
|
7
|
-
EXCLUDED_PATHS: () => EXCLUDED_PATHS,
|
|
8
|
-
FILE_EXTENSIONS: () => FILE_EXTENSIONS,
|
|
9
|
-
I18NEXT_DICTIONARIES_DIR: () => I18NEXT_DICTIONARIES_DIR,
|
|
10
|
-
REACT_INTL_MESSAGES_DIR: () => REACT_INTL_MESSAGES_DIR,
|
|
11
|
-
WATCH: () => WATCH
|
|
12
|
-
});
|
|
13
|
-
const FILE_EXTENSIONS = [
|
|
14
|
-
".content.ts",
|
|
15
|
-
".content.js",
|
|
16
|
-
".content.cjs",
|
|
17
|
-
".content.mjs",
|
|
18
|
-
".content.json",
|
|
19
|
-
".content.json5",
|
|
20
|
-
".content.jsonc",
|
|
21
|
-
".content.tsx",
|
|
22
|
-
".content.jsx"
|
|
23
|
-
];
|
|
24
|
-
const EXCLUDED_PATHS = [
|
|
25
|
-
"**/node_modules/**",
|
|
26
|
-
"**/dist/**",
|
|
27
|
-
"**/build/**",
|
|
28
|
-
"**/.intlayer/**",
|
|
29
|
-
"**/.next/**",
|
|
30
|
-
"**/.nuxt/**",
|
|
31
|
-
"**/.expo/**",
|
|
32
|
-
"**/.vercel/**",
|
|
33
|
-
"**/.turbo/**",
|
|
34
|
-
"**/.tanstack/**"
|
|
35
|
-
];
|
|
36
|
-
const CONTENT_DIR = ["."];
|
|
37
|
-
const CODE_DIR = ["."];
|
|
38
|
-
const I18NEXT_DICTIONARIES_DIR = "i18next_resources";
|
|
39
|
-
const REACT_INTL_MESSAGES_DIR = "intl_messages";
|
|
40
|
-
const WATCH = true;
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
export { CODE_DIR, CONTENT_DIR, EXCLUDED_PATHS, FILE_EXTENSIONS, I18NEXT_DICTIONARIES_DIR, REACT_INTL_MESSAGES_DIR, WATCH, content_exports };
|
|
1
|
+
import{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";var t=e({CODE_DIR:()=>a,CONTENT_DIR:()=>i,EXCLUDED_PATHS:()=>r,FILE_EXTENSIONS:()=>n,I18NEXT_DICTIONARIES_DIR:()=>o,REACT_INTL_MESSAGES_DIR:()=>s,WATCH:()=>c});const n=[`.content.ts`,`.content.js`,`.content.cjs`,`.content.mjs`,`.content.json`,`.content.json5`,`.content.jsonc`,`.content.tsx`,`.content.jsx`],r=[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.intlayer/**`,`**/.next/**`,`**/.nuxt/**`,`**/.expo/**`,`**/.vercel/**`,`**/.turbo/**`,`**/.tanstack/**`],i=[`.`],a=[`.`],o=`i18next_resources`,s=`intl_messages`,c=!1;export{a as CODE_DIR,i as CONTENT_DIR,r as EXCLUDED_PATHS,n as FILE_EXTENSIONS,o as I18NEXT_DICTIONARIES_DIR,s as REACT_INTL_MESSAGES_DIR,c as WATCH,t as content_exports};
|
|
44
2
|
//# sourceMappingURL=content.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.mjs","names":[],"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["export const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.mjs',\n '.content.json',\n '.content.json5',\n '.content.jsonc',\n '.content.tsx',\n '.content.jsx',\n];\nexport const EXCLUDED_PATHS = [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.intlayer/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.expo/**',\n '**/.vercel/**',\n '**/.turbo/**',\n '**/.tanstack/**',\n];\n\nexport const CONTENT_DIR = ['.'];\n\nexport const CODE_DIR = ['.'];\n\nexport const I18NEXT_DICTIONARIES_DIR = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR = 'intl_messages';\n\nexport const WATCH = process.env.NODE_ENV === 'development';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"content.mjs","names":[],"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["export const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.mjs',\n '.content.json',\n '.content.json5',\n '.content.jsonc',\n '.content.tsx',\n '.content.jsx',\n];\nexport const EXCLUDED_PATHS = [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.intlayer/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.expo/**',\n '**/.vercel/**',\n '**/.turbo/**',\n '**/.tanstack/**',\n];\n\nexport const CONTENT_DIR = ['.'];\n\nexport const CODE_DIR = ['.'];\n\nexport const I18NEXT_DICTIONARIES_DIR = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR = 'intl_messages';\n\nexport const WATCH = process.env.NODE_ENV === 'development';\n"],"mappings":"gOAAA,MAAa,EAAkB,CAC7B,cACA,cACA,eACA,eACA,gBACA,iBACA,iBACA,eACA,eACD,CACY,EAAiB,CAC5B,qBACA,aACA,cACA,kBACA,cACA,cACA,cACA,gBACA,eACA,kBACD,CAEY,EAAc,CAAC,IAAI,CAEnB,EAAW,CAAC,IAAI,CAEhB,EAA2B,oBAE3B,EAA0B,gBAE1B,EAAQ"}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/defaultValues/dictionary.ts
|
|
4
|
-
var dictionary_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
-
CONTENT_AUTO_TRANSFORMATION: () => CONTENT_AUTO_TRANSFORMATION,
|
|
6
|
-
FILL: () => FILL,
|
|
7
|
-
IMPORT_MODE: () => IMPORT_MODE,
|
|
8
|
-
LOCATION: () => LOCATION
|
|
9
|
-
});
|
|
10
|
-
const FILL = true;
|
|
11
|
-
const LOCATION = "local";
|
|
12
|
-
const CONTENT_AUTO_TRANSFORMATION = false;
|
|
13
|
-
const IMPORT_MODE = "static";
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { CONTENT_AUTO_TRANSFORMATION, FILL, IMPORT_MODE, LOCATION, dictionary_exports };
|
|
1
|
+
import{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";var t=e({CONTENT_AUTO_TRANSFORMATION:()=>i,FILL:()=>n,IMPORT_MODE:()=>a,LOCATION:()=>r});const n=!0,r=`local`,i=!1,a=`static`;export{i as CONTENT_AUTO_TRANSFORMATION,n as FILL,a as IMPORT_MODE,r as LOCATION,t as dictionary_exports};
|
|
17
2
|
//# sourceMappingURL=dictionary.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/defaultValues/dictionary.ts"],"sourcesContent":["import type { DictionaryLocation } from '@intlayer/types';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/defaultValues/dictionary.ts"],"sourcesContent":["import type { DictionaryLocation } from '@intlayer/types';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":"yJAEA,MAAa,EAAO,GACP,EAA+B,QAC/B,EAA8B,GAC9B,EAAc"}
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/defaultValues/editor.ts
|
|
4
|
-
var editor_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
-
APPLICATION_URL: () => APPLICATION_URL,
|
|
6
|
-
BACKEND_URL: () => BACKEND_URL,
|
|
7
|
-
CMS_URL: () => CMS_URL,
|
|
8
|
-
DICTIONARY_PRIORITY_STRATEGY: () => DICTIONARY_PRIORITY_STRATEGY,
|
|
9
|
-
EDITOR_URL: () => EDITOR_URL,
|
|
10
|
-
IS_ENABLED: () => IS_ENABLED,
|
|
11
|
-
LIVE_SYNC: () => LIVE_SYNC,
|
|
12
|
-
LIVE_SYNC_PORT: () => LIVE_SYNC_PORT,
|
|
13
|
-
PORT: () => PORT
|
|
14
|
-
});
|
|
15
|
-
const APPLICATION_URL = "";
|
|
16
|
-
const EDITOR_URL = "http://localhost:8000";
|
|
17
|
-
const CMS_URL = "https://app.intlayer.org";
|
|
18
|
-
const BACKEND_URL = "https://back.intlayer.org";
|
|
19
|
-
const PORT = 8e3;
|
|
20
|
-
const IS_ENABLED = true;
|
|
21
|
-
const LIVE_SYNC = true;
|
|
22
|
-
const DICTIONARY_PRIORITY_STRATEGY = "local_first";
|
|
23
|
-
const LIVE_SYNC_PORT = 4e3;
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
export { APPLICATION_URL, BACKEND_URL, CMS_URL, DICTIONARY_PRIORITY_STRATEGY, EDITOR_URL, IS_ENABLED, LIVE_SYNC, LIVE_SYNC_PORT, PORT, editor_exports };
|
|
1
|
+
import{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";var t=e({APPLICATION_URL:()=>n,BACKEND_URL:()=>a,CMS_URL:()=>i,DICTIONARY_PRIORITY_STRATEGY:()=>l,EDITOR_URL:()=>r,IS_ENABLED:()=>s,LIVE_SYNC:()=>c,LIVE_SYNC_PORT:()=>u,PORT:()=>o});const n=``,r=`http://localhost:8000`,i=`https://app.intlayer.org`,a=`https://back.intlayer.org`,o=8e3,s=!0,c=!0,l=`local_first`,u=4e3;export{n as APPLICATION_URL,a as BACKEND_URL,i as CMS_URL,l as DICTIONARY_PRIORITY_STRATEGY,r as EDITOR_URL,s as IS_ENABLED,c as LIVE_SYNC,u as LIVE_SYNC_PORT,o as PORT,t as editor_exports};
|
|
27
2
|
//# sourceMappingURL=editor.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = '';\nexport const EDITOR_URL = 'http://localhost:8000';\nexport const CMS_URL = 'https://app.intlayer.org';\nexport const BACKEND_URL = 'https://back.intlayer.org';\nexport const PORT = 8000;\nexport const IS_ENABLED = true;\nexport const LIVE_SYNC = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\nexport const LIVE_SYNC_PORT = 4000;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = '';\nexport const EDITOR_URL = 'http://localhost:8000';\nexport const CMS_URL = 'https://app.intlayer.org';\nexport const BACKEND_URL = 'https://back.intlayer.org';\nexport const PORT = 8000;\nexport const IS_ENABLED = true;\nexport const LIVE_SYNC = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\nexport const LIVE_SYNC_PORT = 4000;\n"],"mappings":"sPAAA,MAAa,EAAkB,GAClB,EAAa,wBACb,EAAU,2BACV,EAAc,4BACd,EAAO,IACP,EAAa,GACb,EAAY,GACZ,EAA+B,cAC/B,EAAiB"}
|
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { build_exports } from "./build.mjs";
|
|
3
|
-
import { content_exports } from "./content.mjs";
|
|
4
|
-
import { dictionary_exports } from "./dictionary.mjs";
|
|
5
|
-
import { editor_exports } from "./editor.mjs";
|
|
6
|
-
import { internationalization_exports } from "./internationalization.mjs";
|
|
7
|
-
import { log_exports } from "./log.mjs";
|
|
8
|
-
import { routing_exports } from "./routing.mjs";
|
|
9
|
-
import { system_exports } from "./system.mjs";
|
|
10
|
-
|
|
11
|
-
//#region src/defaultValues/index.ts
|
|
12
|
-
var defaultValues_exports = /* @__PURE__ */ __exportAll({
|
|
13
|
-
Build: () => build_exports,
|
|
14
|
-
Content: () => content_exports,
|
|
15
|
-
Dictionary: () => dictionary_exports,
|
|
16
|
-
Editor: () => editor_exports,
|
|
17
|
-
Internationalization: () => internationalization_exports,
|
|
18
|
-
Log: () => log_exports,
|
|
19
|
-
Routing: () => routing_exports,
|
|
20
|
-
System: () => system_exports
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { build_exports as Build, content_exports as Content, dictionary_exports as Dictionary, editor_exports as Editor, internationalization_exports as Internationalization, log_exports as Log, routing_exports as Routing, system_exports as System, defaultValues_exports };
|
|
1
|
+
import{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";import{build_exports as t}from"./build.mjs";import{content_exports as n}from"./content.mjs";import{dictionary_exports as r}from"./dictionary.mjs";import{editor_exports as i}from"./editor.mjs";import{internationalization_exports as a}from"./internationalization.mjs";import{log_exports as o}from"./log.mjs";import{routing_exports as s}from"./routing.mjs";import{system_exports as c}from"./system.mjs";var l=e({Build:()=>t,Content:()=>n,Dictionary:()=>r,Editor:()=>i,Internationalization:()=>a,Log:()=>o,Routing:()=>s,System:()=>c});export{t as Build,n as Content,r as Dictionary,i as Editor,a as Internationalization,o as Log,s as Routing,c as System,l as defaultValues_exports};
|
|
25
2
|
//# sourceMappingURL=index.mjs.map
|