@intlayer/core 7.1.4 → 7.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/deepTransformPlugins/getMultilingualDictionary.cjs +1 -1
- package/dist/cjs/deepTransformPlugins/getMultilingualDictionary.cjs.map +1 -1
- package/dist/cjs/getStorageAttributes.cjs +4 -4
- package/dist/cjs/getStorageAttributes.cjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getMultilingualDictionary.mjs +1 -1
- package/dist/esm/deepTransformPlugins/getMultilingualDictionary.mjs.map +1 -1
- package/dist/esm/getStorageAttributes.mjs +4 -4
- package/dist/esm/getStorageAttributes.mjs.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +7 -7
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +7 -7
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +2 -2
- package/dist/types/transpiler/translation/translation.d.ts +1 -1
- package/dist/types/transpiler/translation/translation.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs +0 -20
- package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/built.cjs +0 -8
- package/dist/cjs/config/dist/esm/built.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs +0 -119
- package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs +0 -69
- package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs +0 -26
- package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs +0 -51
- package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/defaultValues/build.cjs +0 -24
- package/dist/cjs/config/dist/esm/defaultValues/build.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/defaultValues/content.cjs +0 -78
- package/dist/cjs/config/dist/esm/defaultValues/content.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs +0 -7
- package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/defaultValues/editor.cjs +0 -36
- package/dist/cjs/config/dist/esm/defaultValues/editor.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/defaultValues/index.cjs +0 -21
- package/dist/cjs/config/dist/esm/defaultValues/index.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs +0 -22
- package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/defaultValues/log.cjs +0 -16
- package/dist/cjs/config/dist/esm/defaultValues/log.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/defaultValues/routing.cjs +0 -26
- package/dist/cjs/config/dist/esm/defaultValues/routing.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/loadEnvFile.cjs +0 -26
- package/dist/cjs/config/dist/esm/loadEnvFile.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs +0 -23
- package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs +0 -47
- package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs +0 -65
- package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs +0 -45
- package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/logger.cjs +0 -65
- package/dist/cjs/config/dist/esm/logger.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs +0 -15
- package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs +0 -1128
- package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs +0 -27
- package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/utils/cache.cjs +0 -261
- package/dist/cjs/config/dist/esm/utils/cache.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/utils/clearModuleCache.cjs +0 -26
- package/dist/cjs/config/dist/esm/utils/clearModuleCache.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs +0 -34
- package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs.map +0 -1
- package/dist/cjs/config/dist/esm/utils/normalizePath.cjs +0 -17
- package/dist/cjs/config/dist/esm/utils/normalizePath.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/_virtual/rolldown_runtime.cjs +0 -10
- package/dist/cjs/dictionaries-entry/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/_virtual/rolldown_runtime.cjs +0 -11
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/built.cjs +0 -8
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/built.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/buildConfigurationFields.cjs +0 -119
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/buildConfigurationFields.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/getConfiguration.cjs +0 -69
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/getConfiguration.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/loadConfigurationFile.cjs +0 -26
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/loadConfigurationFile.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/searchConfigurationFile.cjs +0 -51
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/searchConfigurationFile.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/build.cjs +0 -15
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/build.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/content.cjs +0 -54
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/content.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/dictionary.cjs +0 -7
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/dictionary.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/editor.cjs +0 -23
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/editor.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/internationalization.cjs +0 -14
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/internationalization.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/log.cjs +0 -10
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/log.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/routing.cjs +0 -11
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/routing.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadEnvFile.cjs +0 -26
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadEnvFile.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/bundleFile.cjs +0 -23
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/bundleFile.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.cjs +0 -47
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.cjs +0 -65
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs +0 -45
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/logger.cjs +0 -47
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/logger.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs +0 -15
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/locales.cjs +0 -1128
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/locales.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.cjs +0 -27
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/cache.cjs +0 -261
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/cache.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/getPackageJsonPath.cjs +0 -34
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/getPackageJsonPath.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/normalizePath.cjs +0 -17
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/normalizePath.cjs.map +0 -1
- package/dist/cjs/dictionaries-entry/dist/esm/index.cjs +0 -27
- package/dist/cjs/dictionaries-entry/dist/esm/index.cjs.map +0 -1
- package/dist/cjs/types/dist/esm/_virtual/rolldown_runtime.cjs +0 -15
- package/dist/cjs/types/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
- package/dist/cjs/types/dist/esm/locales.cjs +0 -1128
- package/dist/cjs/types/dist/esm/locales.cjs.map +0 -1
- package/dist/cjs/types/dist/esm/nodeType.cjs +0 -31
- package/dist/cjs/types/dist/esm/nodeType.cjs.map +0 -1
- package/dist/esm/_virtual/rolldown_runtime.mjs +0 -8
- package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs +0 -20
- package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
- package/dist/esm/config/dist/esm/built.mjs +0 -8
- package/dist/esm/config/dist/esm/built.mjs.map +0 -1
- package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs +0 -118
- package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs.map +0 -1
- package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs +0 -67
- package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs.map +0 -1
- package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs +0 -26
- package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs.map +0 -1
- package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs +0 -50
- package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs.map +0 -1
- package/dist/esm/config/dist/esm/defaultValues/build.mjs +0 -19
- package/dist/esm/config/dist/esm/defaultValues/build.mjs.map +0 -1
- package/dist/esm/config/dist/esm/defaultValues/content.mjs +0 -64
- package/dist/esm/config/dist/esm/defaultValues/content.mjs.map +0 -1
- package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs +0 -6
- package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs.map +0 -1
- package/dist/esm/config/dist/esm/defaultValues/editor.mjs +0 -27
- package/dist/esm/config/dist/esm/defaultValues/editor.mjs.map +0 -1
- package/dist/esm/config/dist/esm/defaultValues/index.mjs +0 -21
- package/dist/esm/config/dist/esm/defaultValues/index.mjs.map +0 -1
- package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs +0 -18
- package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs.map +0 -1
- package/dist/esm/config/dist/esm/defaultValues/log.mjs +0 -14
- package/dist/esm/config/dist/esm/defaultValues/log.mjs.map +0 -1
- package/dist/esm/config/dist/esm/defaultValues/routing.mjs +0 -23
- package/dist/esm/config/dist/esm/defaultValues/routing.mjs.map +0 -1
- package/dist/esm/config/dist/esm/loadEnvFile.mjs +0 -24
- package/dist/esm/config/dist/esm/loadEnvFile.mjs.map +0 -1
- package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs +0 -23
- package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs.map +0 -1
- package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs +0 -47
- package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs.map +0 -1
- package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs +0 -63
- package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs.map +0 -1
- package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs +0 -44
- package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs.map +0 -1
- package/dist/esm/config/dist/esm/logger.mjs +0 -59
- package/dist/esm/config/dist/esm/logger.mjs.map +0 -1
- package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs +0 -14
- package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
- package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs +0 -1128
- package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs.map +0 -1
- package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs +0 -25
- package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs.map +0 -1
- package/dist/esm/config/dist/esm/utils/cache.mjs +0 -263
- package/dist/esm/config/dist/esm/utils/cache.mjs.map +0 -1
- package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs +0 -33
- package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs.map +0 -1
- package/dist/esm/config/dist/esm/utils/normalizePath.mjs +0 -16
- package/dist/esm/config/dist/esm/utils/normalizePath.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/_virtual/rolldown_runtime.mjs +0 -11
- package/dist/esm/dictionaries-entry/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs +0 -11
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/built.mjs +0 -8
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/built.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs +0 -118
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/getConfiguration.mjs +0 -67
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/getConfiguration.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs +0 -26
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs +0 -50
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/build.mjs +0 -10
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/build.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/content.mjs +0 -40
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/content.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/dictionary.mjs +0 -6
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/dictionary.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/editor.mjs +0 -14
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/editor.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/internationalization.mjs +0 -11
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/internationalization.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/log.mjs +0 -9
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/log.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/routing.mjs +0 -8
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/routing.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadEnvFile.mjs +0 -24
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadEnvFile.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs +0 -23
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs +0 -47
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs +0 -63
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs +0 -44
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/logger.mjs +0 -45
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/logger.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs +0 -14
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/locales.mjs +0 -1128
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/locales.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs +0 -25
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/cache.mjs +0 -263
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/cache.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs +0 -33
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/normalizePath.mjs +0 -16
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/normalizePath.mjs.map +0 -1
- package/dist/esm/dictionaries-entry/dist/esm/index.mjs +0 -25
- package/dist/esm/dictionaries-entry/dist/esm/index.mjs.map +0 -1
- package/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs +0 -14
- package/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
- package/dist/esm/types/dist/esm/locales.mjs +0 -1128
- package/dist/esm/types/dist/esm/locales.mjs.map +0 -1
- package/dist/esm/types/dist/esm/nodeType.mjs +0 -29
- package/dist/esm/types/dist/esm/nodeType.mjs.map +0 -1
- package/dist/index.d.mts +0 -1323
- package/dist/index.mjs +0 -3348
|
@@ -75,7 +75,7 @@ const getMultilingualDictionary = (dictionary) => {
|
|
|
75
75
|
transform: (node) => require_transpiler_translation_translation.t({ [locale]: node })
|
|
76
76
|
}]
|
|
77
77
|
});
|
|
78
|
-
const { locale: _omitLocale
|
|
78
|
+
const { locale: _omitLocale, ...rest } = dictionary;
|
|
79
79
|
return {
|
|
80
80
|
...rest,
|
|
81
81
|
content: transformedContent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMultilingualDictionary.cjs","names":["deepTransformNode","childProps: NodeProps","t"],"sources":["../../../src/deepTransformPlugins/getMultilingualDictionary.ts"],"sourcesContent":["import type { Dictionary, KeyPath, NodeType, TypedNode } from '@intlayer/types';\nimport {\n deepTransformNode,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\nimport { t } from '../transpiler';\n\n/**\n * Transform a per-locale dictionary into a multilingual dictionary.\n *\n * Example:\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"locale\": \"en\",\n * \"content\": {\n * \"myContent\": \"English content\"\n * }\n * }\n * ```\n *\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"content\": {\n * \"myContent\": t({\n * \"en\": \"English content\",\n * })\n * }\n * }\n * ```\n */\nexport const getMultilingualDictionary = (\n dictionary: Dictionary\n): Dictionary => {\n if (!dictionary.locale) {\n return dictionary;\n }\n\n const locale = dictionary.locale;\n\n const wrapPrimitiveInTranslationPlugin: Plugins = {\n id: 'wrap-primitive-in-translation',\n canHandle: (node) =>\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean',\n transform: (node) => t({ [locale]: node } as Record<string, unknown>),\n };\n\n const traverseTypedNodePlugin: Plugins = {\n id: 'traverse-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof (node as any)?.nodeType === 'string',\n transform: (node: TypedNode, props, transformFn) => {\n const nodeType = (node as any).nodeType as NodeType;\n const inner = structuredClone(\n (node as any)[nodeType as unknown as keyof TypedNode] as any\n );\n\n if (typeof inner !== 'object' || inner === null) {\n const transformed = transformFn(inner, {\n ...props,\n children: inner,\n keyPath: [\n ...props.keyPath,\n { type: nodeType, key: nodeType } as KeyPath,\n ],\n });\n return {\n ...node,\n [nodeType as unknown as keyof TypedNode]: transformed,\n };\n }\n\n for (const key in inner) {\n const childProps: NodeProps = {\n ...props,\n children: inner[key as unknown as keyof typeof inner],\n keyPath: [...props.keyPath, { type: nodeType, key } as KeyPath],\n };\n inner[key as unknown as keyof typeof inner] = transformFn(\n inner[key as unknown as keyof typeof inner],\n childProps\n );\n }\n\n return { ...node, [nodeType as unknown as keyof TypedNode]: inner };\n },\n };\n\n const transformedContent = deepTransformNode(\n JSON.parse(JSON.stringify(dictionary.content)),\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [traverseTypedNodePlugin, wrapPrimitiveInTranslationPlugin],\n }\n );\n\n const { locale: _omitLocale, ...rest } = dictionary as any;\n return {\n ...rest,\n content: transformedContent,\n } as Dictionary;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,6BACX,eACe;AACf,KAAI,CAAC,WAAW,OACd,QAAO;CAGT,MAAM,SAAS,WAAW;CAoD1B,MAAM,qBAAqBA,+DACzB,KAAK,MAAM,KAAK,UAAU,WAAW,QAAQ,CAAC,EAC9C;EACE,eAAe,WAAW;EAC1B,SAAS,EAAE;EACX,SAAS,CA9C4B;GACvC,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAAY,OAAQ,MAAc,aAAa;GACjE,YAAY,MAAiB,OAAO,gBAAgB;IAClD,MAAM,WAAY,KAAa;IAC/B,MAAM,QAAQ,gBACX,KAAa,UACf;AAED,QAAI,OAAO,UAAU,YAAY,UAAU,MAAM;KAC/C,MAAM,cAAc,YAAY,OAAO;MACrC,GAAG;MACH,UAAU;MACV,SAAS,CACP,GAAG,MAAM,SACT;OAAE,MAAM;OAAU,KAAK;OAAU,CAClC;MACF,CAAC;AACF,YAAO;MACL,GAAG;OACF,WAAyC;MAC3C;;AAGH,SAAK,MAAM,OAAO,OAAO;KACvB,MAAMC,aAAwB;MAC5B,GAAG;MACH,UAAU,MAAM;MAChB,SAAS,CAAC,GAAG,MAAM,SAAS;OAAE,MAAM;OAAU;OAAK,CAAY;MAChE;AACD,WAAM,OAAwC,YAC5C,MAAM,MACN,WACD;;AAGH,WAAO;KAAE,GAAG;MAAO,WAAyC;KAAO;;GAEtE,EAhDiD;GAChD,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;GAClB,YAAY,SAASC,6CAAE,GAAG,SAAS,MAAM,CAA4B;GACtE,CAgDuE;EACrE,CACF;CAED,MAAM,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"getMultilingualDictionary.cjs","names":["deepTransformNode","childProps: NodeProps","t"],"sources":["../../../src/deepTransformPlugins/getMultilingualDictionary.ts"],"sourcesContent":["import type { Dictionary, KeyPath, NodeType, TypedNode } from '@intlayer/types';\nimport {\n deepTransformNode,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\nimport { t } from '../transpiler';\n\n/**\n * Transform a per-locale dictionary into a multilingual dictionary.\n *\n * Example:\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"locale\": \"en\",\n * \"content\": {\n * \"myContent\": \"English content\"\n * }\n * }\n * ```\n *\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"content\": {\n * \"myContent\": t({\n * \"en\": \"English content\",\n * })\n * }\n * }\n * ```\n */\nexport const getMultilingualDictionary = (\n dictionary: Dictionary\n): Dictionary => {\n if (!dictionary.locale) {\n return dictionary;\n }\n\n const locale = dictionary.locale;\n\n const wrapPrimitiveInTranslationPlugin: Plugins = {\n id: 'wrap-primitive-in-translation',\n canHandle: (node) =>\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean',\n transform: (node) => t({ [locale]: node } as Record<string, unknown>),\n };\n\n const traverseTypedNodePlugin: Plugins = {\n id: 'traverse-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof (node as any)?.nodeType === 'string',\n transform: (node: TypedNode, props, transformFn) => {\n const nodeType = (node as any).nodeType as NodeType;\n const inner = structuredClone(\n (node as any)[nodeType as unknown as keyof TypedNode] as any\n );\n\n if (typeof inner !== 'object' || inner === null) {\n const transformed = transformFn(inner, {\n ...props,\n children: inner,\n keyPath: [\n ...props.keyPath,\n { type: nodeType, key: nodeType } as KeyPath,\n ],\n });\n return {\n ...node,\n [nodeType as unknown as keyof TypedNode]: transformed,\n };\n }\n\n for (const key in inner) {\n const childProps: NodeProps = {\n ...props,\n children: inner[key as unknown as keyof typeof inner],\n keyPath: [...props.keyPath, { type: nodeType, key } as KeyPath],\n };\n inner[key as unknown as keyof typeof inner] = transformFn(\n inner[key as unknown as keyof typeof inner],\n childProps\n );\n }\n\n return { ...node, [nodeType as unknown as keyof TypedNode]: inner };\n },\n };\n\n const transformedContent = deepTransformNode(\n JSON.parse(JSON.stringify(dictionary.content)),\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [traverseTypedNodePlugin, wrapPrimitiveInTranslationPlugin],\n }\n );\n\n const { locale: _omitLocale, ...rest } = dictionary as any;\n return {\n ...rest,\n content: transformedContent,\n } as Dictionary;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,6BACX,eACe;AACf,KAAI,CAAC,WAAW,OACd,QAAO;CAGT,MAAM,SAAS,WAAW;CAoD1B,MAAM,qBAAqBA,+DACzB,KAAK,MAAM,KAAK,UAAU,WAAW,QAAQ,CAAC,EAC9C;EACE,eAAe,WAAW;EAC1B,SAAS,EAAE;EACX,SAAS,CA9C4B;GACvC,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAAY,OAAQ,MAAc,aAAa;GACjE,YAAY,MAAiB,OAAO,gBAAgB;IAClD,MAAM,WAAY,KAAa;IAC/B,MAAM,QAAQ,gBACX,KAAa,UACf;AAED,QAAI,OAAO,UAAU,YAAY,UAAU,MAAM;KAC/C,MAAM,cAAc,YAAY,OAAO;MACrC,GAAG;MACH,UAAU;MACV,SAAS,CACP,GAAG,MAAM,SACT;OAAE,MAAM;OAAU,KAAK;OAAU,CAClC;MACF,CAAC;AACF,YAAO;MACL,GAAG;OACF,WAAyC;MAC3C;;AAGH,SAAK,MAAM,OAAO,OAAO;KACvB,MAAMC,aAAwB;MAC5B,GAAG;MACH,UAAU,MAAM;MAChB,SAAS,CAAC,GAAG,MAAM,SAAS;OAAE,MAAM;OAAU;OAAK,CAAY;MAChE;AACD,WAAM,OAAwC,YAC5C,MAAM,MACN,WACD;;AAGH,WAAO;KAAE,GAAG;MAAO,WAAyC;KAAO;;GAEtE,EAhDiD;GAChD,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;GAClB,YAAY,SAASC,6CAAE,GAAG,SAAS,MAAM,CAA4B;GACtE,CAgDuE;EACrE,CACF;CAED,MAAM,EAAE,QAAQ,aAAa,GAAG,SAAS;AACzC,QAAO;EACL,GAAG;EACH,SAAS;EACV"}
|
|
@@ -65,27 +65,27 @@ const processStorageEntry = (entry) => {
|
|
|
65
65
|
const typedEntry = entry;
|
|
66
66
|
if (isCookieEntry(typedEntry)) return { cookies: [createCookieEntry(typedEntry)] };
|
|
67
67
|
if ("type" in typedEntry && typedEntry.type === "localStorage") {
|
|
68
|
-
const { name: name$1
|
|
68
|
+
const { name: name$1, ...rest$1 } = typedEntry;
|
|
69
69
|
return { localStorage: [createWebStorageEntry({
|
|
70
70
|
name: name$1,
|
|
71
71
|
...rest$1
|
|
72
72
|
})] };
|
|
73
73
|
}
|
|
74
74
|
if ("type" in typedEntry && typedEntry.type === "sessionStorage") {
|
|
75
|
-
const { name: name$1
|
|
75
|
+
const { name: name$1, ...rest$1 } = typedEntry;
|
|
76
76
|
return { sessionStorage: [createWebStorageEntry({
|
|
77
77
|
name: name$1,
|
|
78
78
|
...rest$1
|
|
79
79
|
})] };
|
|
80
80
|
}
|
|
81
81
|
if ("type" in typedEntry && typedEntry.type === "header") {
|
|
82
|
-
const { name: name$1
|
|
82
|
+
const { name: name$1, ...rest$1 } = typedEntry;
|
|
83
83
|
return { headers: [createHeaderEntry({
|
|
84
84
|
name: name$1,
|
|
85
85
|
...rest$1
|
|
86
86
|
})] };
|
|
87
87
|
}
|
|
88
|
-
const { name
|
|
88
|
+
const { name, ...rest } = typedEntry;
|
|
89
89
|
return { localStorage: [createWebStorageEntry({
|
|
90
90
|
name,
|
|
91
91
|
...rest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStorageAttributes.cjs","names":["DefaultValues","rest","emptyResult: ProcessedStorageAttributes"],"sources":["../../src/getStorageAttributes.ts"],"sourcesContent":["import { DefaultValues } from '@intlayer/config/client';\nimport type {\n CookiesAttributes,\n IntlayerConfig,\n StorageAttributes,\n} from '@intlayer/types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype CookieEntry = {\n name: string;\n attributes: Omit<CookiesAttributes, 'type' | 'name'>;\n};\n\ntype WebStorageEntry = {\n name: string;\n};\n\ntype HeaderEntry = {\n name: string;\n};\n\nexport type ProcessedStorageAttributes = {\n cookies: CookieEntry[];\n localStorage: WebStorageEntry[];\n sessionStorage: WebStorageEntry[];\n headers: HeaderEntry[];\n};\n\ntype StorageEntry =\n | 'cookie'\n | 'localStorage'\n | 'sessionStorage'\n | 'header'\n | CookiesAttributes\n | StorageAttributes;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Creates a cookie entry with default values for missing attributes\n */\nconst createCookieEntry = (\n options?: Partial<CookiesAttributes>\n): CookieEntry => {\n const { name, path, expires, domain, secure, sameSite, httpOnly } =\n options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.COOKIE_NAME,\n attributes: {\n path,\n expires,\n domain,\n secure,\n sameSite,\n httpOnly,\n },\n };\n};\n\n/**\n * Creates a web storage entry (localStorage or sessionStorage) with default name\n */\nconst createWebStorageEntry = (\n options?: Partial<StorageAttributes>\n): WebStorageEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME,\n };\n};\n\n/**\n * Creates a header entry with default name\n */\nconst createHeaderEntry = (\n options?: Partial<StorageAttributes>\n): HeaderEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.HEADER_NAME,\n };\n};\n\n/**\n * Determines if a storage entry is a cookie based on its properties\n */\nconst isCookieEntry = (entry: any): boolean => {\n return (\n entry.type === 'cookie' ||\n 'sameSite' in entry ||\n 'httpOnly' in entry ||\n 'secure' in entry\n );\n};\n\n/**\n * Determines the storage type from a string literal\n */\nconst isStorageType = (\n value: string\n): value is 'cookie' | 'localStorage' | 'sessionStorage' | 'header' => {\n return (\n value === 'cookie' ||\n value === 'localStorage' ||\n value === 'sessionStorage' ||\n value === 'header'\n );\n};\n\n// ============================================================================\n// Main Function\n// ============================================================================\n\n/**\n * Processes a single storage entry and returns the appropriate storage attributes\n */\nconst processStorageEntry = (\n entry: StorageEntry\n): Partial<ProcessedStorageAttributes> => {\n // Handle string literals\n if (typeof entry === 'string') {\n if (!isStorageType(entry)) {\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n }\n\n if (entry === 'cookie') {\n return { cookies: [createCookieEntry()] };\n }\n\n if (entry === 'localStorage') {\n return { localStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'sessionStorage') {\n return { sessionStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'header') {\n return { headers: [createHeaderEntry()] };\n }\n }\n\n // Handle object entries\n if (typeof entry === 'object' && entry !== null) {\n const typedEntry = entry as CookiesAttributes | StorageAttributes;\n\n if (isCookieEntry(typedEntry)) {\n return { cookies: [createCookieEntry(typedEntry as CookiesAttributes)] };\n }\n\n // Handle localStorage\n if ('type' in typedEntry && typedEntry.type === 'localStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle sessionStorage\n if ('type' in typedEntry && typedEntry.type === 'sessionStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { sessionStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle header\n if ('type' in typedEntry && typedEntry.type === 'header') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { headers: [createHeaderEntry({ name, ...rest })] };\n }\n\n // Default to localStorage for ambiguous objects\n const { name, ...rest } = typedEntry as Omit<StorageAttributes, 'type'>;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n};\n\n/**\n * Merges multiple partial storage attributes into a single result\n */\nconst mergeStorageAttributes = (\n accumulated: ProcessedStorageAttributes,\n partial: Partial<ProcessedStorageAttributes>\n): ProcessedStorageAttributes => {\n return {\n cookies: [...accumulated.cookies, ...(partial.cookies ?? [])],\n localStorage: [\n ...accumulated.localStorage,\n ...(partial.localStorage ?? []),\n ],\n sessionStorage: [\n ...accumulated.sessionStorage,\n ...(partial.sessionStorage ?? []),\n ],\n headers: [...accumulated.headers, ...(partial.headers ?? [])],\n };\n};\n\n/**\n * Extracts and normalizes storage configuration into separate arrays for each storage type\n *\n * @param options - The storage configuration from IntlayerConfig\n * @returns An object containing arrays for cookies, localStorage, and sessionStorage\n */\nexport const getStorageAttributes = (\n options: IntlayerConfig['routing']['storage']\n): ProcessedStorageAttributes => {\n const emptyResult: ProcessedStorageAttributes = {\n cookies: [],\n localStorage: [],\n sessionStorage: [],\n headers: [],\n };\n\n // Storage is disabled\n if (options === false || options === undefined) {\n return emptyResult;\n }\n\n // Handle array of storage entries\n if (Array.isArray(options)) {\n return options.reduce<ProcessedStorageAttributes>((acc, entry) => {\n const partial = processStorageEntry(entry);\n return mergeStorageAttributes(acc, partial);\n }, emptyResult);\n }\n\n // Handle single storage entry\n const partial = processStorageEntry(options);\n\n return mergeStorageAttributes(emptyResult, partial);\n};\n"],"mappings":";;;;;;;AA8CA,MAAM,qBACJ,YACgB;CAChB,MAAM,EAAE,MAAM,MAAM,SAAS,QAAQ,QAAQ,UAAU,aACrD,WAAW,EAAE;AAEf,QAAO;EACL,MAAM,QAAQA,uCAAc,QAAQ;EACpC,YAAY;GACV;GACA;GACA;GACA;GACA;GACA;GACD;EACF;;;;;AAMH,MAAM,yBACJ,YACoB;CACpB,MAAM,EAAE,SAAS,WAAW,EAAE;AAE9B,QAAO,EACL,MAAM,QAAQA,uCAAc,QAAQ,qBACrC;;;;;AAMH,MAAM,qBACJ,YACgB;CAChB,MAAM,EAAE,SAAS,WAAW,EAAE;AAE9B,QAAO,EACL,MAAM,QAAQA,uCAAc,QAAQ,aACrC;;;;;AAMH,MAAM,iBAAiB,UAAwB;AAC7C,QACE,MAAM,SAAS,YACf,cAAc,SACd,cAAc,SACd,YAAY;;;;;AAOhB,MAAM,iBACJ,UACqE;AACrE,QACE,UAAU,YACV,UAAU,kBACV,UAAU,oBACV,UAAU;;;;;AAWd,MAAM,uBACJ,UACwC;AAExC,KAAI,OAAO,UAAU,UAAU;AAC7B,MAAI,CAAC,cAAc,MAAM,CACvB,QAAO;GAAE,SAAS,EAAE;GAAE,cAAc,EAAE;GAAE,gBAAgB,EAAE;GAAE,SAAS,EAAE;GAAE;AAG3E,MAAI,UAAU,SACZ,QAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;AAG3C,MAAI,UAAU,eACZ,QAAO,EAAE,cAAc,CAAC,uBAAuB,CAAC,EAAE;AAGpD,MAAI,UAAU,iBACZ,QAAO,EAAE,gBAAgB,CAAC,uBAAuB,CAAC,EAAE;AAGtD,MAAI,UAAU,SACZ,QAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;;AAK7C,KAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EAC/C,MAAM,aAAa;AAEnB,MAAI,cAAc,WAAW,CAC3B,QAAO,EAAE,SAAS,CAAC,kBAAkB,WAAgC,CAAC,EAAE;AAI1E,MAAI,UAAU,cAAc,WAAW,SAAS,gBAAgB;GAC9D,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"getStorageAttributes.cjs","names":["DefaultValues","rest","emptyResult: ProcessedStorageAttributes"],"sources":["../../src/getStorageAttributes.ts"],"sourcesContent":["import { DefaultValues } from '@intlayer/config/client';\nimport type {\n CookiesAttributes,\n IntlayerConfig,\n StorageAttributes,\n} from '@intlayer/types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype CookieEntry = {\n name: string;\n attributes: Omit<CookiesAttributes, 'type' | 'name'>;\n};\n\ntype WebStorageEntry = {\n name: string;\n};\n\ntype HeaderEntry = {\n name: string;\n};\n\nexport type ProcessedStorageAttributes = {\n cookies: CookieEntry[];\n localStorage: WebStorageEntry[];\n sessionStorage: WebStorageEntry[];\n headers: HeaderEntry[];\n};\n\ntype StorageEntry =\n | 'cookie'\n | 'localStorage'\n | 'sessionStorage'\n | 'header'\n | CookiesAttributes\n | StorageAttributes;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Creates a cookie entry with default values for missing attributes\n */\nconst createCookieEntry = (\n options?: Partial<CookiesAttributes>\n): CookieEntry => {\n const { name, path, expires, domain, secure, sameSite, httpOnly } =\n options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.COOKIE_NAME,\n attributes: {\n path,\n expires,\n domain,\n secure,\n sameSite,\n httpOnly,\n },\n };\n};\n\n/**\n * Creates a web storage entry (localStorage or sessionStorage) with default name\n */\nconst createWebStorageEntry = (\n options?: Partial<StorageAttributes>\n): WebStorageEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME,\n };\n};\n\n/**\n * Creates a header entry with default name\n */\nconst createHeaderEntry = (\n options?: Partial<StorageAttributes>\n): HeaderEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.HEADER_NAME,\n };\n};\n\n/**\n * Determines if a storage entry is a cookie based on its properties\n */\nconst isCookieEntry = (entry: any): boolean => {\n return (\n entry.type === 'cookie' ||\n 'sameSite' in entry ||\n 'httpOnly' in entry ||\n 'secure' in entry\n );\n};\n\n/**\n * Determines the storage type from a string literal\n */\nconst isStorageType = (\n value: string\n): value is 'cookie' | 'localStorage' | 'sessionStorage' | 'header' => {\n return (\n value === 'cookie' ||\n value === 'localStorage' ||\n value === 'sessionStorage' ||\n value === 'header'\n );\n};\n\n// ============================================================================\n// Main Function\n// ============================================================================\n\n/**\n * Processes a single storage entry and returns the appropriate storage attributes\n */\nconst processStorageEntry = (\n entry: StorageEntry\n): Partial<ProcessedStorageAttributes> => {\n // Handle string literals\n if (typeof entry === 'string') {\n if (!isStorageType(entry)) {\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n }\n\n if (entry === 'cookie') {\n return { cookies: [createCookieEntry()] };\n }\n\n if (entry === 'localStorage') {\n return { localStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'sessionStorage') {\n return { sessionStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'header') {\n return { headers: [createHeaderEntry()] };\n }\n }\n\n // Handle object entries\n if (typeof entry === 'object' && entry !== null) {\n const typedEntry = entry as CookiesAttributes | StorageAttributes;\n\n if (isCookieEntry(typedEntry)) {\n return { cookies: [createCookieEntry(typedEntry as CookiesAttributes)] };\n }\n\n // Handle localStorage\n if ('type' in typedEntry && typedEntry.type === 'localStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle sessionStorage\n if ('type' in typedEntry && typedEntry.type === 'sessionStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { sessionStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle header\n if ('type' in typedEntry && typedEntry.type === 'header') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { headers: [createHeaderEntry({ name, ...rest })] };\n }\n\n // Default to localStorage for ambiguous objects\n const { name, ...rest } = typedEntry as Omit<StorageAttributes, 'type'>;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n};\n\n/**\n * Merges multiple partial storage attributes into a single result\n */\nconst mergeStorageAttributes = (\n accumulated: ProcessedStorageAttributes,\n partial: Partial<ProcessedStorageAttributes>\n): ProcessedStorageAttributes => {\n return {\n cookies: [...accumulated.cookies, ...(partial.cookies ?? [])],\n localStorage: [\n ...accumulated.localStorage,\n ...(partial.localStorage ?? []),\n ],\n sessionStorage: [\n ...accumulated.sessionStorage,\n ...(partial.sessionStorage ?? []),\n ],\n headers: [...accumulated.headers, ...(partial.headers ?? [])],\n };\n};\n\n/**\n * Extracts and normalizes storage configuration into separate arrays for each storage type\n *\n * @param options - The storage configuration from IntlayerConfig\n * @returns An object containing arrays for cookies, localStorage, and sessionStorage\n */\nexport const getStorageAttributes = (\n options: IntlayerConfig['routing']['storage']\n): ProcessedStorageAttributes => {\n const emptyResult: ProcessedStorageAttributes = {\n cookies: [],\n localStorage: [],\n sessionStorage: [],\n headers: [],\n };\n\n // Storage is disabled\n if (options === false || options === undefined) {\n return emptyResult;\n }\n\n // Handle array of storage entries\n if (Array.isArray(options)) {\n return options.reduce<ProcessedStorageAttributes>((acc, entry) => {\n const partial = processStorageEntry(entry);\n return mergeStorageAttributes(acc, partial);\n }, emptyResult);\n }\n\n // Handle single storage entry\n const partial = processStorageEntry(options);\n\n return mergeStorageAttributes(emptyResult, partial);\n};\n"],"mappings":"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"}
|
|
@@ -75,7 +75,7 @@ const getMultilingualDictionary = (dictionary) => {
|
|
|
75
75
|
transform: (node) => translation({ [locale]: node })
|
|
76
76
|
}]
|
|
77
77
|
});
|
|
78
|
-
const { locale: _omitLocale
|
|
78
|
+
const { locale: _omitLocale, ...rest } = dictionary;
|
|
79
79
|
return {
|
|
80
80
|
...rest,
|
|
81
81
|
content: transformedContent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMultilingualDictionary.mjs","names":["childProps: NodeProps","t"],"sources":["../../../src/deepTransformPlugins/getMultilingualDictionary.ts"],"sourcesContent":["import type { Dictionary, KeyPath, NodeType, TypedNode } from '@intlayer/types';\nimport {\n deepTransformNode,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\nimport { t } from '../transpiler';\n\n/**\n * Transform a per-locale dictionary into a multilingual dictionary.\n *\n * Example:\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"locale\": \"en\",\n * \"content\": {\n * \"myContent\": \"English content\"\n * }\n * }\n * ```\n *\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"content\": {\n * \"myContent\": t({\n * \"en\": \"English content\",\n * })\n * }\n * }\n * ```\n */\nexport const getMultilingualDictionary = (\n dictionary: Dictionary\n): Dictionary => {\n if (!dictionary.locale) {\n return dictionary;\n }\n\n const locale = dictionary.locale;\n\n const wrapPrimitiveInTranslationPlugin: Plugins = {\n id: 'wrap-primitive-in-translation',\n canHandle: (node) =>\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean',\n transform: (node) => t({ [locale]: node } as Record<string, unknown>),\n };\n\n const traverseTypedNodePlugin: Plugins = {\n id: 'traverse-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof (node as any)?.nodeType === 'string',\n transform: (node: TypedNode, props, transformFn) => {\n const nodeType = (node as any).nodeType as NodeType;\n const inner = structuredClone(\n (node as any)[nodeType as unknown as keyof TypedNode] as any\n );\n\n if (typeof inner !== 'object' || inner === null) {\n const transformed = transformFn(inner, {\n ...props,\n children: inner,\n keyPath: [\n ...props.keyPath,\n { type: nodeType, key: nodeType } as KeyPath,\n ],\n });\n return {\n ...node,\n [nodeType as unknown as keyof TypedNode]: transformed,\n };\n }\n\n for (const key in inner) {\n const childProps: NodeProps = {\n ...props,\n children: inner[key as unknown as keyof typeof inner],\n keyPath: [...props.keyPath, { type: nodeType, key } as KeyPath],\n };\n inner[key as unknown as keyof typeof inner] = transformFn(\n inner[key as unknown as keyof typeof inner],\n childProps\n );\n }\n\n return { ...node, [nodeType as unknown as keyof TypedNode]: inner };\n },\n };\n\n const transformedContent = deepTransformNode(\n JSON.parse(JSON.stringify(dictionary.content)),\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [traverseTypedNodePlugin, wrapPrimitiveInTranslationPlugin],\n }\n );\n\n const { locale: _omitLocale, ...rest } = dictionary as any;\n return {\n ...rest,\n content: transformedContent,\n } as Dictionary;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,6BACX,eACe;AACf,KAAI,CAAC,WAAW,OACd,QAAO;CAGT,MAAM,SAAS,WAAW;CAoD1B,MAAM,qBAAqB,kBACzB,KAAK,MAAM,KAAK,UAAU,WAAW,QAAQ,CAAC,EAC9C;EACE,eAAe,WAAW;EAC1B,SAAS,EAAE;EACX,SAAS,CA9C4B;GACvC,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAAY,OAAQ,MAAc,aAAa;GACjE,YAAY,MAAiB,OAAO,gBAAgB;IAClD,MAAM,WAAY,KAAa;IAC/B,MAAM,QAAQ,gBACX,KAAa,UACf;AAED,QAAI,OAAO,UAAU,YAAY,UAAU,MAAM;KAC/C,MAAM,cAAc,YAAY,OAAO;MACrC,GAAG;MACH,UAAU;MACV,SAAS,CACP,GAAG,MAAM,SACT;OAAE,MAAM;OAAU,KAAK;OAAU,CAClC;MACF,CAAC;AACF,YAAO;MACL,GAAG;OACF,WAAyC;MAC3C;;AAGH,SAAK,MAAM,OAAO,OAAO;KACvB,MAAMA,aAAwB;MAC5B,GAAG;MACH,UAAU,MAAM;MAChB,SAAS,CAAC,GAAG,MAAM,SAAS;OAAE,MAAM;OAAU;OAAK,CAAY;MAChE;AACD,WAAM,OAAwC,YAC5C,MAAM,MACN,WACD;;AAGH,WAAO;KAAE,GAAG;MAAO,WAAyC;KAAO;;GAEtE,EAhDiD;GAChD,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;GAClB,YAAY,SAASC,YAAE,GAAG,SAAS,MAAM,CAA4B;GACtE,CAgDuE;EACrE,CACF;CAED,MAAM,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"getMultilingualDictionary.mjs","names":["childProps: NodeProps","t"],"sources":["../../../src/deepTransformPlugins/getMultilingualDictionary.ts"],"sourcesContent":["import type { Dictionary, KeyPath, NodeType, TypedNode } from '@intlayer/types';\nimport {\n deepTransformNode,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\nimport { t } from '../transpiler';\n\n/**\n * Transform a per-locale dictionary into a multilingual dictionary.\n *\n * Example:\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"locale\": \"en\",\n * \"content\": {\n * \"myContent\": \"English content\"\n * }\n * }\n * ```\n *\n * ```json\n * {\n * \"key\": \"about-page\",\n * \"content\": {\n * \"myContent\": t({\n * \"en\": \"English content\",\n * })\n * }\n * }\n * ```\n */\nexport const getMultilingualDictionary = (\n dictionary: Dictionary\n): Dictionary => {\n if (!dictionary.locale) {\n return dictionary;\n }\n\n const locale = dictionary.locale;\n\n const wrapPrimitiveInTranslationPlugin: Plugins = {\n id: 'wrap-primitive-in-translation',\n canHandle: (node) =>\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean',\n transform: (node) => t({ [locale]: node } as Record<string, unknown>),\n };\n\n const traverseTypedNodePlugin: Plugins = {\n id: 'traverse-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof (node as any)?.nodeType === 'string',\n transform: (node: TypedNode, props, transformFn) => {\n const nodeType = (node as any).nodeType as NodeType;\n const inner = structuredClone(\n (node as any)[nodeType as unknown as keyof TypedNode] as any\n );\n\n if (typeof inner !== 'object' || inner === null) {\n const transformed = transformFn(inner, {\n ...props,\n children: inner,\n keyPath: [\n ...props.keyPath,\n { type: nodeType, key: nodeType } as KeyPath,\n ],\n });\n return {\n ...node,\n [nodeType as unknown as keyof TypedNode]: transformed,\n };\n }\n\n for (const key in inner) {\n const childProps: NodeProps = {\n ...props,\n children: inner[key as unknown as keyof typeof inner],\n keyPath: [...props.keyPath, { type: nodeType, key } as KeyPath],\n };\n inner[key as unknown as keyof typeof inner] = transformFn(\n inner[key as unknown as keyof typeof inner],\n childProps\n );\n }\n\n return { ...node, [nodeType as unknown as keyof TypedNode]: inner };\n },\n };\n\n const transformedContent = deepTransformNode(\n JSON.parse(JSON.stringify(dictionary.content)),\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [traverseTypedNodePlugin, wrapPrimitiveInTranslationPlugin],\n }\n );\n\n const { locale: _omitLocale, ...rest } = dictionary as any;\n return {\n ...rest,\n content: transformedContent,\n } as Dictionary;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,6BACX,eACe;AACf,KAAI,CAAC,WAAW,OACd,QAAO;CAGT,MAAM,SAAS,WAAW;CAoD1B,MAAM,qBAAqB,kBACzB,KAAK,MAAM,KAAK,UAAU,WAAW,QAAQ,CAAC,EAC9C;EACE,eAAe,WAAW;EAC1B,SAAS,EAAE;EACX,SAAS,CA9C4B;GACvC,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAAY,OAAQ,MAAc,aAAa;GACjE,YAAY,MAAiB,OAAO,gBAAgB;IAClD,MAAM,WAAY,KAAa;IAC/B,MAAM,QAAQ,gBACX,KAAa,UACf;AAED,QAAI,OAAO,UAAU,YAAY,UAAU,MAAM;KAC/C,MAAM,cAAc,YAAY,OAAO;MACrC,GAAG;MACH,UAAU;MACV,SAAS,CACP,GAAG,MAAM,SACT;OAAE,MAAM;OAAU,KAAK;OAAU,CAClC;MACF,CAAC;AACF,YAAO;MACL,GAAG;OACF,WAAyC;MAC3C;;AAGH,SAAK,MAAM,OAAO,OAAO;KACvB,MAAMA,aAAwB;MAC5B,GAAG;MACH,UAAU,MAAM;MAChB,SAAS,CAAC,GAAG,MAAM,SAAS;OAAE,MAAM;OAAU;OAAK,CAAY;MAChE;AACD,WAAM,OAAwC,YAC5C,MAAM,MACN,WACD;;AAGH,WAAO;KAAE,GAAG;MAAO,WAAyC;KAAO;;GAEtE,EAhDiD;GAChD,IAAI;GACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;GAClB,YAAY,SAASC,YAAE,GAAG,SAAS,MAAM,CAA4B;GACtE,CAgDuE;EACrE,CACF;CAED,MAAM,EAAE,QAAQ,aAAa,GAAG,SAAS;AACzC,QAAO;EACL,GAAG;EACH,SAAS;EACV"}
|
|
@@ -64,27 +64,27 @@ const processStorageEntry = (entry) => {
|
|
|
64
64
|
const typedEntry = entry;
|
|
65
65
|
if (isCookieEntry(typedEntry)) return { cookies: [createCookieEntry(typedEntry)] };
|
|
66
66
|
if ("type" in typedEntry && typedEntry.type === "localStorage") {
|
|
67
|
-
const { name: name$1
|
|
67
|
+
const { name: name$1, ...rest$1 } = typedEntry;
|
|
68
68
|
return { localStorage: [createWebStorageEntry({
|
|
69
69
|
name: name$1,
|
|
70
70
|
...rest$1
|
|
71
71
|
})] };
|
|
72
72
|
}
|
|
73
73
|
if ("type" in typedEntry && typedEntry.type === "sessionStorage") {
|
|
74
|
-
const { name: name$1
|
|
74
|
+
const { name: name$1, ...rest$1 } = typedEntry;
|
|
75
75
|
return { sessionStorage: [createWebStorageEntry({
|
|
76
76
|
name: name$1,
|
|
77
77
|
...rest$1
|
|
78
78
|
})] };
|
|
79
79
|
}
|
|
80
80
|
if ("type" in typedEntry && typedEntry.type === "header") {
|
|
81
|
-
const { name: name$1
|
|
81
|
+
const { name: name$1, ...rest$1 } = typedEntry;
|
|
82
82
|
return { headers: [createHeaderEntry({
|
|
83
83
|
name: name$1,
|
|
84
84
|
...rest$1
|
|
85
85
|
})] };
|
|
86
86
|
}
|
|
87
|
-
const { name
|
|
87
|
+
const { name, ...rest } = typedEntry;
|
|
88
88
|
return { localStorage: [createWebStorageEntry({
|
|
89
89
|
name,
|
|
90
90
|
...rest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStorageAttributes.mjs","names":["rest","emptyResult: ProcessedStorageAttributes"],"sources":["../../src/getStorageAttributes.ts"],"sourcesContent":["import { DefaultValues } from '@intlayer/config/client';\nimport type {\n CookiesAttributes,\n IntlayerConfig,\n StorageAttributes,\n} from '@intlayer/types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype CookieEntry = {\n name: string;\n attributes: Omit<CookiesAttributes, 'type' | 'name'>;\n};\n\ntype WebStorageEntry = {\n name: string;\n};\n\ntype HeaderEntry = {\n name: string;\n};\n\nexport type ProcessedStorageAttributes = {\n cookies: CookieEntry[];\n localStorage: WebStorageEntry[];\n sessionStorage: WebStorageEntry[];\n headers: HeaderEntry[];\n};\n\ntype StorageEntry =\n | 'cookie'\n | 'localStorage'\n | 'sessionStorage'\n | 'header'\n | CookiesAttributes\n | StorageAttributes;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Creates a cookie entry with default values for missing attributes\n */\nconst createCookieEntry = (\n options?: Partial<CookiesAttributes>\n): CookieEntry => {\n const { name, path, expires, domain, secure, sameSite, httpOnly } =\n options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.COOKIE_NAME,\n attributes: {\n path,\n expires,\n domain,\n secure,\n sameSite,\n httpOnly,\n },\n };\n};\n\n/**\n * Creates a web storage entry (localStorage or sessionStorage) with default name\n */\nconst createWebStorageEntry = (\n options?: Partial<StorageAttributes>\n): WebStorageEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME,\n };\n};\n\n/**\n * Creates a header entry with default name\n */\nconst createHeaderEntry = (\n options?: Partial<StorageAttributes>\n): HeaderEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.HEADER_NAME,\n };\n};\n\n/**\n * Determines if a storage entry is a cookie based on its properties\n */\nconst isCookieEntry = (entry: any): boolean => {\n return (\n entry.type === 'cookie' ||\n 'sameSite' in entry ||\n 'httpOnly' in entry ||\n 'secure' in entry\n );\n};\n\n/**\n * Determines the storage type from a string literal\n */\nconst isStorageType = (\n value: string\n): value is 'cookie' | 'localStorage' | 'sessionStorage' | 'header' => {\n return (\n value === 'cookie' ||\n value === 'localStorage' ||\n value === 'sessionStorage' ||\n value === 'header'\n );\n};\n\n// ============================================================================\n// Main Function\n// ============================================================================\n\n/**\n * Processes a single storage entry and returns the appropriate storage attributes\n */\nconst processStorageEntry = (\n entry: StorageEntry\n): Partial<ProcessedStorageAttributes> => {\n // Handle string literals\n if (typeof entry === 'string') {\n if (!isStorageType(entry)) {\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n }\n\n if (entry === 'cookie') {\n return { cookies: [createCookieEntry()] };\n }\n\n if (entry === 'localStorage') {\n return { localStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'sessionStorage') {\n return { sessionStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'header') {\n return { headers: [createHeaderEntry()] };\n }\n }\n\n // Handle object entries\n if (typeof entry === 'object' && entry !== null) {\n const typedEntry = entry as CookiesAttributes | StorageAttributes;\n\n if (isCookieEntry(typedEntry)) {\n return { cookies: [createCookieEntry(typedEntry as CookiesAttributes)] };\n }\n\n // Handle localStorage\n if ('type' in typedEntry && typedEntry.type === 'localStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle sessionStorage\n if ('type' in typedEntry && typedEntry.type === 'sessionStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { sessionStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle header\n if ('type' in typedEntry && typedEntry.type === 'header') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { headers: [createHeaderEntry({ name, ...rest })] };\n }\n\n // Default to localStorage for ambiguous objects\n const { name, ...rest } = typedEntry as Omit<StorageAttributes, 'type'>;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n};\n\n/**\n * Merges multiple partial storage attributes into a single result\n */\nconst mergeStorageAttributes = (\n accumulated: ProcessedStorageAttributes,\n partial: Partial<ProcessedStorageAttributes>\n): ProcessedStorageAttributes => {\n return {\n cookies: [...accumulated.cookies, ...(partial.cookies ?? [])],\n localStorage: [\n ...accumulated.localStorage,\n ...(partial.localStorage ?? []),\n ],\n sessionStorage: [\n ...accumulated.sessionStorage,\n ...(partial.sessionStorage ?? []),\n ],\n headers: [...accumulated.headers, ...(partial.headers ?? [])],\n };\n};\n\n/**\n * Extracts and normalizes storage configuration into separate arrays for each storage type\n *\n * @param options - The storage configuration from IntlayerConfig\n * @returns An object containing arrays for cookies, localStorage, and sessionStorage\n */\nexport const getStorageAttributes = (\n options: IntlayerConfig['routing']['storage']\n): ProcessedStorageAttributes => {\n const emptyResult: ProcessedStorageAttributes = {\n cookies: [],\n localStorage: [],\n sessionStorage: [],\n headers: [],\n };\n\n // Storage is disabled\n if (options === false || options === undefined) {\n return emptyResult;\n }\n\n // Handle array of storage entries\n if (Array.isArray(options)) {\n return options.reduce<ProcessedStorageAttributes>((acc, entry) => {\n const partial = processStorageEntry(entry);\n return mergeStorageAttributes(acc, partial);\n }, emptyResult);\n }\n\n // Handle single storage entry\n const partial = processStorageEntry(options);\n\n return mergeStorageAttributes(emptyResult, partial);\n};\n"],"mappings":";;;;;;AA8CA,MAAM,qBACJ,YACgB;CAChB,MAAM,EAAE,MAAM,MAAM,SAAS,QAAQ,QAAQ,UAAU,aACrD,WAAW,EAAE;AAEf,QAAO;EACL,MAAM,QAAQ,cAAc,QAAQ;EACpC,YAAY;GACV;GACA;GACA;GACA;GACA;GACA;GACD;EACF;;;;;AAMH,MAAM,yBACJ,YACoB;CACpB,MAAM,EAAE,SAAS,WAAW,EAAE;AAE9B,QAAO,EACL,MAAM,QAAQ,cAAc,QAAQ,qBACrC;;;;;AAMH,MAAM,qBACJ,YACgB;CAChB,MAAM,EAAE,SAAS,WAAW,EAAE;AAE9B,QAAO,EACL,MAAM,QAAQ,cAAc,QAAQ,aACrC;;;;;AAMH,MAAM,iBAAiB,UAAwB;AAC7C,QACE,MAAM,SAAS,YACf,cAAc,SACd,cAAc,SACd,YAAY;;;;;AAOhB,MAAM,iBACJ,UACqE;AACrE,QACE,UAAU,YACV,UAAU,kBACV,UAAU,oBACV,UAAU;;;;;AAWd,MAAM,uBACJ,UACwC;AAExC,KAAI,OAAO,UAAU,UAAU;AAC7B,MAAI,CAAC,cAAc,MAAM,CACvB,QAAO;GAAE,SAAS,EAAE;GAAE,cAAc,EAAE;GAAE,gBAAgB,EAAE;GAAE,SAAS,EAAE;GAAE;AAG3E,MAAI,UAAU,SACZ,QAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;AAG3C,MAAI,UAAU,eACZ,QAAO,EAAE,cAAc,CAAC,uBAAuB,CAAC,EAAE;AAGpD,MAAI,UAAU,iBACZ,QAAO,EAAE,gBAAgB,CAAC,uBAAuB,CAAC,EAAE;AAGtD,MAAI,UAAU,SACZ,QAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;;AAK7C,KAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EAC/C,MAAM,aAAa;AAEnB,MAAI,cAAc,WAAW,CAC3B,QAAO,EAAE,SAAS,CAAC,kBAAkB,WAAgC,CAAC,EAAE;AAI1E,MAAI,UAAU,cAAc,WAAW,SAAS,gBAAgB;GAC9D,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"getStorageAttributes.mjs","names":["rest","emptyResult: ProcessedStorageAttributes"],"sources":["../../src/getStorageAttributes.ts"],"sourcesContent":["import { DefaultValues } from '@intlayer/config/client';\nimport type {\n CookiesAttributes,\n IntlayerConfig,\n StorageAttributes,\n} from '@intlayer/types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype CookieEntry = {\n name: string;\n attributes: Omit<CookiesAttributes, 'type' | 'name'>;\n};\n\ntype WebStorageEntry = {\n name: string;\n};\n\ntype HeaderEntry = {\n name: string;\n};\n\nexport type ProcessedStorageAttributes = {\n cookies: CookieEntry[];\n localStorage: WebStorageEntry[];\n sessionStorage: WebStorageEntry[];\n headers: HeaderEntry[];\n};\n\ntype StorageEntry =\n | 'cookie'\n | 'localStorage'\n | 'sessionStorage'\n | 'header'\n | CookiesAttributes\n | StorageAttributes;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Creates a cookie entry with default values for missing attributes\n */\nconst createCookieEntry = (\n options?: Partial<CookiesAttributes>\n): CookieEntry => {\n const { name, path, expires, domain, secure, sameSite, httpOnly } =\n options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.COOKIE_NAME,\n attributes: {\n path,\n expires,\n domain,\n secure,\n sameSite,\n httpOnly,\n },\n };\n};\n\n/**\n * Creates a web storage entry (localStorage or sessionStorage) with default name\n */\nconst createWebStorageEntry = (\n options?: Partial<StorageAttributes>\n): WebStorageEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME,\n };\n};\n\n/**\n * Creates a header entry with default name\n */\nconst createHeaderEntry = (\n options?: Partial<StorageAttributes>\n): HeaderEntry => {\n const { name } = options ?? {};\n\n return {\n name: name ?? DefaultValues.Routing.HEADER_NAME,\n };\n};\n\n/**\n * Determines if a storage entry is a cookie based on its properties\n */\nconst isCookieEntry = (entry: any): boolean => {\n return (\n entry.type === 'cookie' ||\n 'sameSite' in entry ||\n 'httpOnly' in entry ||\n 'secure' in entry\n );\n};\n\n/**\n * Determines the storage type from a string literal\n */\nconst isStorageType = (\n value: string\n): value is 'cookie' | 'localStorage' | 'sessionStorage' | 'header' => {\n return (\n value === 'cookie' ||\n value === 'localStorage' ||\n value === 'sessionStorage' ||\n value === 'header'\n );\n};\n\n// ============================================================================\n// Main Function\n// ============================================================================\n\n/**\n * Processes a single storage entry and returns the appropriate storage attributes\n */\nconst processStorageEntry = (\n entry: StorageEntry\n): Partial<ProcessedStorageAttributes> => {\n // Handle string literals\n if (typeof entry === 'string') {\n if (!isStorageType(entry)) {\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n }\n\n if (entry === 'cookie') {\n return { cookies: [createCookieEntry()] };\n }\n\n if (entry === 'localStorage') {\n return { localStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'sessionStorage') {\n return { sessionStorage: [createWebStorageEntry()] };\n }\n\n if (entry === 'header') {\n return { headers: [createHeaderEntry()] };\n }\n }\n\n // Handle object entries\n if (typeof entry === 'object' && entry !== null) {\n const typedEntry = entry as CookiesAttributes | StorageAttributes;\n\n if (isCookieEntry(typedEntry)) {\n return { cookies: [createCookieEntry(typedEntry as CookiesAttributes)] };\n }\n\n // Handle localStorage\n if ('type' in typedEntry && typedEntry.type === 'localStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle sessionStorage\n if ('type' in typedEntry && typedEntry.type === 'sessionStorage') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { sessionStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n // Handle header\n if ('type' in typedEntry && typedEntry.type === 'header') {\n const { name, ...rest } = typedEntry as StorageAttributes;\n return { headers: [createHeaderEntry({ name, ...rest })] };\n }\n\n // Default to localStorage for ambiguous objects\n const { name, ...rest } = typedEntry as Omit<StorageAttributes, 'type'>;\n return { localStorage: [createWebStorageEntry({ name, ...rest })] };\n }\n\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n};\n\n/**\n * Merges multiple partial storage attributes into a single result\n */\nconst mergeStorageAttributes = (\n accumulated: ProcessedStorageAttributes,\n partial: Partial<ProcessedStorageAttributes>\n): ProcessedStorageAttributes => {\n return {\n cookies: [...accumulated.cookies, ...(partial.cookies ?? [])],\n localStorage: [\n ...accumulated.localStorage,\n ...(partial.localStorage ?? []),\n ],\n sessionStorage: [\n ...accumulated.sessionStorage,\n ...(partial.sessionStorage ?? []),\n ],\n headers: [...accumulated.headers, ...(partial.headers ?? [])],\n };\n};\n\n/**\n * Extracts and normalizes storage configuration into separate arrays for each storage type\n *\n * @param options - The storage configuration from IntlayerConfig\n * @returns An object containing arrays for cookies, localStorage, and sessionStorage\n */\nexport const getStorageAttributes = (\n options: IntlayerConfig['routing']['storage']\n): ProcessedStorageAttributes => {\n const emptyResult: ProcessedStorageAttributes = {\n cookies: [],\n localStorage: [],\n sessionStorage: [],\n headers: [],\n };\n\n // Storage is disabled\n if (options === false || options === undefined) {\n return emptyResult;\n }\n\n // Handle array of storage entries\n if (Array.isArray(options)) {\n return options.reduce<ProcessedStorageAttributes>((acc, entry) => {\n const partial = processStorageEntry(entry);\n return mergeStorageAttributes(acc, partial);\n }, emptyResult);\n }\n\n // Handle single storage entry\n const partial = processStorageEntry(options);\n\n return mergeStorageAttributes(emptyResult, partial);\n};\n"],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
|
|
2
2
|
import "../interpreter/index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _intlayer_types5 from "@intlayer/types";
|
|
4
4
|
import { ContentNode, DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts
|
|
@@ -24,11 +24,11 @@ declare const getFilterMissingTranslationsContent: <T extends ContentNode, L ext
|
|
|
24
24
|
declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, localeToCheck: LocalesValues) => {
|
|
25
25
|
content: any;
|
|
26
26
|
$schema?: string;
|
|
27
|
-
id?:
|
|
27
|
+
id?: _intlayer_types5.DictionaryId;
|
|
28
28
|
projectIds?: string[];
|
|
29
|
-
localId?:
|
|
30
|
-
localIds?:
|
|
31
|
-
key:
|
|
29
|
+
localId?: _intlayer_types5.LocalDictionaryId;
|
|
30
|
+
localIds?: _intlayer_types5.LocalDictionaryId[];
|
|
31
|
+
key: _intlayer_types5.DictionaryKey;
|
|
32
32
|
title?: string;
|
|
33
33
|
description?: string;
|
|
34
34
|
versions?: string[];
|
|
@@ -36,11 +36,11 @@ declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, l
|
|
|
36
36
|
filePath?: string;
|
|
37
37
|
tags?: string[];
|
|
38
38
|
locale?: LocalesValues;
|
|
39
|
-
fill?:
|
|
39
|
+
fill?: _intlayer_types5.Fill;
|
|
40
40
|
filled?: true;
|
|
41
41
|
priority?: number;
|
|
42
42
|
live?: boolean;
|
|
43
|
-
location?:
|
|
43
|
+
location?: _intlayer_types5.DictionaryLocation;
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
46
46
|
export { filterMissingTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilterMissingTranslationsContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterMissingTranslationsContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAmMa,qDACI,kBACd;;AAFH;AA8LA;;;;;;;;AA0BA;;;;cA1Ba,gDACD,uBACA,gBAAgB,uBAEpB,kBACS,cACJ;cAoBA,qDACC,2BACG;;;OAAa,
|
|
1
|
+
{"version":3,"file":"getFilterMissingTranslationsContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterMissingTranslationsContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAmMa,qDACI,kBACd;;AAFH;AA8LA;;;;;;;;AA0BA;;;;cA1Ba,gDACD,uBACA,gBAAgB,uBAEpB,kBACS,cACJ;cAoBA,qDACC,2BACG;;;OAAa,gBAAA,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeProps } from "../interpreter/getContent/plugins.js";
|
|
2
2
|
import "../interpreter/index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _intlayer_types11 from "@intlayer/types";
|
|
4
4
|
import { ContentNode, Dictionary, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/deepTransformPlugins/getFilteredLocalesContent.d.ts
|
|
@@ -8,11 +8,11 @@ declare const getFilteredLocalesContent: (node: ContentNode, locales: LocalesVal
|
|
|
8
8
|
declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: LocalesValues | LocalesValues[]) => {
|
|
9
9
|
content: any;
|
|
10
10
|
$schema?: string;
|
|
11
|
-
id?:
|
|
11
|
+
id?: _intlayer_types11.DictionaryId;
|
|
12
12
|
projectIds?: string[];
|
|
13
|
-
localId?:
|
|
14
|
-
localIds?:
|
|
15
|
-
key:
|
|
13
|
+
localId?: _intlayer_types11.LocalDictionaryId;
|
|
14
|
+
localIds?: _intlayer_types11.LocalDictionaryId[];
|
|
15
|
+
key: _intlayer_types11.DictionaryKey;
|
|
16
16
|
title?: string;
|
|
17
17
|
description?: string;
|
|
18
18
|
versions?: string[];
|
|
@@ -20,11 +20,11 @@ declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: Loc
|
|
|
20
20
|
filePath?: string;
|
|
21
21
|
tags?: string[];
|
|
22
22
|
locale?: LocalesValues;
|
|
23
|
-
fill?:
|
|
23
|
+
fill?: _intlayer_types11.Fill;
|
|
24
24
|
filled?: true;
|
|
25
25
|
priority?: number;
|
|
26
26
|
live?: boolean;
|
|
27
|
-
location?:
|
|
27
|
+
location?: _intlayer_types11.DictionaryLocation;
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
30
30
|
export { getFilteredLocalesContent, getFilteredLocalesDictionary };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilteredLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilteredLocalesContent.ts"],"sourcesContent":[],"mappings":";;;;;;cAsCa,kCACL,sBACG,gBAAgB,4BACd;cAwBA,2CACC,oBACJ,gBAAgB;;;EA7Bb,EAAA,CAAA,EA6B0B,
|
|
1
|
+
{"version":3,"file":"getFilteredLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilteredLocalesContent.ts"],"sourcesContent":[],"mappings":";;;;;;cAsCa,kCACL,sBACG,gBAAgB,4BACd;cAwBA,2CACC,oBACJ,gBAAgB;;;EA7Bb,EAAA,CAAA,EA6B0B,iBAAA,CAAA,YAbtC;EAfO,UAAA,CAAA,EAAA,MAAA,EAAA;EACG,OAAA,CAAA,qCAAA;EAAgB,QAAA,CAAA,uCAAA;EACd,GAAA,iCAAA;EAAS,KAAA,CAAA,EAAA,MAAA;EAwBT,WAAA,CAAA,EAAA,MAAA;EACC,QAAA,CAAA,EAAA,MAAA,EAAA;EACJ,OAAA,CAAA,EAAA,MAAA;EAAgB,QAAA,CAAA,EAAA,MAAA;EAAa,IAAA,CAAA,EAAA,MAAA,EAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types17 from "@intlayer/types";
|
|
2
2
|
import { Dictionary } from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/dictionaryManipulator/orderDictionaries.d.ts
|
|
@@ -10,7 +10,7 @@ import { Dictionary } from "@intlayer/types";
|
|
|
10
10
|
* @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')
|
|
11
11
|
* @returns Ordered array of dictionaries
|
|
12
12
|
*/
|
|
13
|
-
declare const orderDictionaries: (dictionaries: Dictionary[], configuration?:
|
|
13
|
+
declare const orderDictionaries: (dictionaries: Dictionary[], configuration?: _intlayer_types17.IntlayerConfig) => Dictionary[];
|
|
14
14
|
//#endregion
|
|
15
15
|
export { orderDictionaries };
|
|
16
16
|
//# sourceMappingURL=orderDictionaries.d.ts.map
|
|
@@ -23,7 +23,7 @@ type TranslationContent<Content = unknown, RecordContent extends StrictModeLocal
|
|
|
23
23
|
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
24
24
|
*/
|
|
25
25
|
declare const translation: <Content = unknown, ContentRecord extends StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>>(content: ContentRecord) => TypedNodeModel<NodeType.Translation, ContentRecord, {
|
|
26
|
-
nodeType: NodeType.Translation
|
|
26
|
+
nodeType: "translation" | NodeType.Translation;
|
|
27
27
|
} & {
|
|
28
28
|
translation: ContentRecord;
|
|
29
29
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.d.ts","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":[],"mappings":";;;KAOY,4DAGR,oBAAoB,WAAW,oBAAoB,YACnD,eAAe,QAAA,CAAS,aAAa;;AAJzC;;;;;;;;;AAIwD;;;;;;;;;;cAsBlD,WAKkB,EAAA,CAAA,UAAA,OAAA,EAAA,sBAFpB,mBAEoB,CAFA,OAEA,CAAA,GAFW,mBAEX,CAF+B,OAE/B,CAAA,CAAA,CAAA,OAAA,EAAb,aAAa,EAAA,GAAA,cAAA,CAAA,QAAA,CAAA,WAAA,EAAA,aAAA,EAAA;EAAA,QAAA,
|
|
1
|
+
{"version":3,"file":"translation.d.ts","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":[],"mappings":";;;KAOY,4DAGR,oBAAoB,WAAW,oBAAoB,YACnD,eAAe,QAAA,CAAS,aAAa;;AAJzC;;;;;;;;;AAIwD;;;;;;;;;;cAsBlD,WAKkB,EAAA,CAAA,UAAA,OAAA,EAAA,sBAFpB,mBAEoB,CAFA,OAEA,CAAA,GAFW,mBAEX,CAF+B,OAE/B,CAAA,CAAA,CAAA,OAAA,EAAb,aAAa,EAAA,GAAA,cAAA,CAAA,QAAA,CAAA,WAAA,EAAA,aAAA,EAAA;EAAA,QAAA,EAAA,aAAA,uBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -101,11 +101,11 @@
|
|
|
101
101
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@intlayer/api": "7.1.
|
|
105
|
-
"@intlayer/config": "7.1.
|
|
106
|
-
"@intlayer/dictionaries-entry": "7.1.
|
|
107
|
-
"@intlayer/types": "7.1.
|
|
108
|
-
"@intlayer/unmerged-dictionaries-entry": "7.1.
|
|
104
|
+
"@intlayer/api": "7.1.6",
|
|
105
|
+
"@intlayer/config": "7.1.6",
|
|
106
|
+
"@intlayer/dictionaries-entry": "7.1.6",
|
|
107
|
+
"@intlayer/types": "7.1.6",
|
|
108
|
+
"@intlayer/unmerged-dictionaries-entry": "7.1.6",
|
|
109
109
|
"deepmerge": "4.3.1"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region ../config/dist/esm/_virtual/rolldown_runtime.mjs
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __export = (all) => {
|
|
5
|
-
let target = {};
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
return target;
|
|
11
|
-
};
|
|
12
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
13
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
|
-
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
exports.__export = __export;
|
|
19
|
-
exports.__require = __require;
|
|
20
|
-
//# sourceMappingURL=rolldown_runtime.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown_runtime.cjs","names":[],"sources":["../../../../../../../config/dist/esm/_virtual/rolldown_runtime.mjs"],"sourcesContent":["//#region rolldown:runtime\nvar __defProp = Object.defineProperty;\nvar __export = (all) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\treturn target;\n};\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, { get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b] }) : x)(function(x) {\n\tif (typeof require !== \"undefined\") return require.apply(this, arguments);\n\tthrow Error(\"Calling `require` for \\\"\" + x + \"\\\" in an environment that doesn't expose the `require` function.\");\n});\n\n//#endregion\nexport { __export, __require };"],"mappings":";;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,YAAY,QAAQ;CACvB,IAAI,SAAS,EAAE;AACf,MAAK,IAAI,QAAQ,IAAK,WAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;EACZ,CAAC;AACF,QAAO;;AAER,IAAI,YAA4B,kBAAE,MAAM,OAAO,YAAY,cAAc,UAAU,OAAO,UAAU,cAAc,IAAI,MAAM,GAAG,EAAE,MAAM,GAAG,OAAO,OAAO,YAAY,cAAc,UAAU,GAAG,IAAI,CAAC,GAAG,GAAG,SAAS,GAAG;AACrN,KAAI,OAAO,YAAY,YAAa,QAAO,QAAQ,MAAM,MAAM,UAAU;AACzE,OAAM,MAAM,6BAA6B,IAAI,mEAAmE;EAC/G"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const require_getConfiguration = require('./configFile/getConfiguration.cjs');
|
|
2
|
-
|
|
3
|
-
//#region ../config/dist/esm/built.mjs
|
|
4
|
-
var built_default = require_getConfiguration.getConfiguration();
|
|
5
|
-
|
|
6
|
-
//#endregion
|
|
7
|
-
exports.built_default = built_default;
|
|
8
|
-
//# sourceMappingURL=built.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"built.cjs","names":["getConfiguration"],"sources":["../../../../../../config/dist/esm/built.mjs"],"sourcesContent":["import { getConfiguration } from \"./configFile/getConfiguration.mjs\";\n\n//#region src/built.ts\nconst configuration = getConfiguration();\nvar built_default = configuration;\n\n//#endregion\nexport { built_default as default };\n//# sourceMappingURL=built.mjs.map"],"mappings":";;;AAIA,IAAI,gBADkBA,2CAAkB"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_build = require('../defaultValues/build.cjs');
|
|
3
|
-
const require_content = require('../defaultValues/content.cjs');
|
|
4
|
-
const require_editor = require('../defaultValues/editor.cjs');
|
|
5
|
-
const require_internationalization = require('../defaultValues/internationalization.cjs');
|
|
6
|
-
const require_log = require('../defaultValues/log.cjs');
|
|
7
|
-
const require_routing = require('../defaultValues/routing.cjs');
|
|
8
|
-
const require_normalizePath = require('../utils/normalizePath.cjs');
|
|
9
|
-
const require_dictionary = require('../defaultValues/dictionary.cjs');
|
|
10
|
-
let node_path = require("node:path");
|
|
11
|
-
|
|
12
|
-
//#region ../config/dist/esm/configFile/buildConfigurationFields.mjs
|
|
13
|
-
let storedConfiguration;
|
|
14
|
-
const buildInternationalizationFields = (customConfiguration) => ({
|
|
15
|
-
locales: customConfiguration?.locales ?? require_internationalization.LOCALES,
|
|
16
|
-
requiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? require_internationalization.REQUIRED_LOCALES,
|
|
17
|
-
strictMode: customConfiguration?.strictMode ?? require_internationalization.STRICT_MODE,
|
|
18
|
-
defaultLocale: customConfiguration?.defaultLocale ?? require_internationalization.DEFAULT_LOCALE
|
|
19
|
-
});
|
|
20
|
-
const buildRoutingFields = (customConfiguration) => ({
|
|
21
|
-
mode: customConfiguration?.mode ?? require_routing.ROUTING_MODE,
|
|
22
|
-
storage: customConfiguration?.storage ?? require_routing.STORAGE,
|
|
23
|
-
basePath: customConfiguration?.basePath ?? require_routing.BASE_PATH
|
|
24
|
-
});
|
|
25
|
-
const buildContentFields = (customConfiguration, baseDir) => {
|
|
26
|
-
const notDerivedContentConfig = {
|
|
27
|
-
fileExtensions: customConfiguration?.fileExtensions ?? require_content.FILE_EXTENSIONS,
|
|
28
|
-
baseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),
|
|
29
|
-
excludedPath: customConfiguration?.excludedPath ?? require_content.EXCLUDED_PATHS,
|
|
30
|
-
watch: customConfiguration?.watch ?? require_content.WATCH,
|
|
31
|
-
formatCommand: customConfiguration?.formatCommand
|
|
32
|
-
};
|
|
33
|
-
const optionalJoinBaseDir = (path) => {
|
|
34
|
-
if ((0, node_path.isAbsolute)(path)) return path;
|
|
35
|
-
return (0, node_path.join)(notDerivedContentConfig.baseDir, path);
|
|
36
|
-
};
|
|
37
|
-
const baseDirDerivedConfiguration = {
|
|
38
|
-
contentDir: (customConfiguration?.contentDir ?? require_content.CONTENT_DIR).map(optionalJoinBaseDir),
|
|
39
|
-
moduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? require_content.MODULE_AUGMENTATION_DIR),
|
|
40
|
-
unmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? require_content.UNMERGED_DICTIONARIES_DIR),
|
|
41
|
-
remoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? require_content.REMOTE_DICTIONARIES_DIR),
|
|
42
|
-
dictionariesDir: optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? require_content.DICTIONARIES_DIR),
|
|
43
|
-
dynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? require_content.DYNAMIC_DICTIONARIES_DIR),
|
|
44
|
-
fetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? require_content.FETCH_DICTIONARIES_DIR),
|
|
45
|
-
typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? require_content.TYPES_DIR),
|
|
46
|
-
mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? require_content.MAIN_DIR),
|
|
47
|
-
configDir: optionalJoinBaseDir(customConfiguration?.configDir ?? require_content.CONFIG_DIR),
|
|
48
|
-
cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? require_content.CACHE_DIR)
|
|
49
|
-
};
|
|
50
|
-
const patternsConfiguration = {
|
|
51
|
-
watchedFilesPattern: notDerivedContentConfig.fileExtensions.map((ext) => `/**/*${ext}`),
|
|
52
|
-
watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap((ext) => baseDirDerivedConfiguration.contentDir.map((contentDir) => `${require_normalizePath.normalizePath(contentDir)}/**/*${ext}`)),
|
|
53
|
-
outputFilesPatternWithPath: `${require_normalizePath.normalizePath(baseDirDerivedConfiguration.dictionariesDir)}/**/*.json`
|
|
54
|
-
};
|
|
55
|
-
return {
|
|
56
|
-
...notDerivedContentConfig,
|
|
57
|
-
...baseDirDerivedConfiguration,
|
|
58
|
-
...patternsConfiguration
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
const buildEditorFields = (customConfiguration) => ({
|
|
62
|
-
applicationURL: customConfiguration?.applicationURL ?? require_editor.APPLICATION_URL,
|
|
63
|
-
editorURL: customConfiguration?.editorURL ?? require_editor.EDITOR_URL,
|
|
64
|
-
cmsURL: customConfiguration?.cmsURL ?? require_editor.CMS_URL,
|
|
65
|
-
backendURL: customConfiguration?.backendURL ?? require_editor.BACKEND_URL,
|
|
66
|
-
port: customConfiguration?.port ?? require_editor.PORT,
|
|
67
|
-
enabled: customConfiguration?.enabled ?? require_editor.IS_ENABLED,
|
|
68
|
-
clientId: customConfiguration?.clientId ?? void 0,
|
|
69
|
-
clientSecret: customConfiguration?.clientSecret ?? void 0,
|
|
70
|
-
dictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? require_editor.DICTIONARY_PRIORITY_STRATEGY,
|
|
71
|
-
liveSync: customConfiguration?.liveSync ?? require_editor.LIVE_SYNC,
|
|
72
|
-
liveSyncPort: customConfiguration?.liveSyncPort ?? require_editor.LIVE_SYNC_PORT,
|
|
73
|
-
liveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? require_editor.LIVE_SYNC_PORT}`
|
|
74
|
-
});
|
|
75
|
-
const buildLogFields = (customConfiguration, logFunctions) => ({
|
|
76
|
-
mode: customConfiguration?.mode ?? require_log.MODE,
|
|
77
|
-
prefix: customConfiguration?.prefix ?? require_log.PREFIX,
|
|
78
|
-
error: logFunctions?.error,
|
|
79
|
-
log: logFunctions?.log,
|
|
80
|
-
info: logFunctions?.info,
|
|
81
|
-
warn: logFunctions?.warn
|
|
82
|
-
});
|
|
83
|
-
const buildAiFields = (customConfiguration) => ({
|
|
84
|
-
provider: customConfiguration?.provider,
|
|
85
|
-
apiKey: customConfiguration?.apiKey,
|
|
86
|
-
model: customConfiguration?.model,
|
|
87
|
-
temperature: customConfiguration?.temperature,
|
|
88
|
-
applicationContext: customConfiguration?.applicationContext
|
|
89
|
-
});
|
|
90
|
-
const buildBuildFields = (customConfiguration) => ({
|
|
91
|
-
optimize: customConfiguration?.optimize ?? require_build.OPTIMIZE,
|
|
92
|
-
importMode: customConfiguration?.importMode ?? require_build.IMPORT_MODE,
|
|
93
|
-
traversePattern: customConfiguration?.traversePattern ?? require_build.TRAVERSE_PATTERN,
|
|
94
|
-
outputFormat: customConfiguration?.outputFormat ?? require_build.OUTPUT_FORMAT,
|
|
95
|
-
cache: customConfiguration?.cache ?? require_build.CACHE,
|
|
96
|
-
require: customConfiguration?.require
|
|
97
|
-
});
|
|
98
|
-
const buildDictionaryFields = (customConfiguration) => ({ fill: customConfiguration?.fill ?? require_dictionary.FILL });
|
|
99
|
-
/**
|
|
100
|
-
* Build the configuration fields by merging the default values with the custom configuration
|
|
101
|
-
*/
|
|
102
|
-
const buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {
|
|
103
|
-
storedConfiguration = {
|
|
104
|
-
internationalization: buildInternationalizationFields(customConfiguration?.internationalization),
|
|
105
|
-
routing: buildRoutingFields(customConfiguration?.routing),
|
|
106
|
-
content: buildContentFields(customConfiguration?.content, baseDir),
|
|
107
|
-
editor: buildEditorFields(customConfiguration?.editor),
|
|
108
|
-
log: buildLogFields(customConfiguration?.log, logFunctions),
|
|
109
|
-
ai: buildAiFields(customConfiguration?.ai),
|
|
110
|
-
build: buildBuildFields(customConfiguration?.build),
|
|
111
|
-
dictionary: buildDictionaryFields(customConfiguration?.dictionary),
|
|
112
|
-
plugins: customConfiguration?.plugins
|
|
113
|
-
};
|
|
114
|
-
return storedConfiguration;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
//#endregion
|
|
118
|
-
exports.buildConfigurationFields = buildConfigurationFields;
|
|
119
|
-
//# sourceMappingURL=buildConfigurationFields.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildConfigurationFields.cjs","names":["LOCALES","REQUIRED_LOCALES","STRICT_MODE","DEFAULT_LOCALE","ROUTING_MODE","STORAGE","BASE_PATH","FILE_EXTENSIONS","EXCLUDED_PATHS","WATCH","CONTENT_DIR","MODULE_AUGMENTATION_DIR","UNMERGED_DICTIONARIES_DIR","REMOTE_DICTIONARIES_DIR","DICTIONARIES_DIR","DYNAMIC_DICTIONARIES_DIR","FETCH_DICTIONARIES_DIR","TYPES_DIR","MAIN_DIR","CONFIG_DIR","CACHE_DIR","normalizePath","APPLICATION_URL","EDITOR_URL","CMS_URL","BACKEND_URL","PORT","IS_ENABLED","DICTIONARY_PRIORITY_STRATEGY","LIVE_SYNC","LIVE_SYNC_PORT","MODE","PREFIX","OPTIMIZE","IMPORT_MODE","TRAVERSE_PATTERN","OUTPUT_FORMAT","CACHE","FILL"],"sources":["../../../../../../../config/dist/esm/configFile/buildConfigurationFields.mjs"],"sourcesContent":["import { normalizePath } from \"../utils/normalizePath.mjs\";\nimport { CACHE, IMPORT_MODE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN } from \"../defaultValues/build.mjs\";\nimport { CACHE_DIR, CONFIG_DIR, CONTENT_DIR, DICTIONARIES_DIR, DYNAMIC_DICTIONARIES_DIR, EXCLUDED_PATHS, FETCH_DICTIONARIES_DIR, FILE_EXTENSIONS, MAIN_DIR, MODULE_AUGMENTATION_DIR, REMOTE_DICTIONARIES_DIR, TYPES_DIR, UNMERGED_DICTIONARIES_DIR, WATCH } from \"../defaultValues/content.mjs\";\nimport { FILL } from \"../defaultValues/dictionary.mjs\";\nimport { APPLICATION_URL, BACKEND_URL, CMS_URL, DICTIONARY_PRIORITY_STRATEGY, EDITOR_URL, IS_ENABLED, LIVE_SYNC, LIVE_SYNC_PORT, PORT } from \"../defaultValues/editor.mjs\";\nimport { DEFAULT_LOCALE, LOCALES, REQUIRED_LOCALES, STRICT_MODE } from \"../defaultValues/internationalization.mjs\";\nimport { MODE, PREFIX } from \"../defaultValues/log.mjs\";\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from \"../defaultValues/routing.mjs\";\nimport { isAbsolute, join } from \"node:path\";\n\n//#region src/configFile/buildConfigurationFields.ts\nlet storedConfiguration;\nconst buildInternationalizationFields = (customConfiguration) => ({\n\tlocales: customConfiguration?.locales ?? LOCALES,\n\trequiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? REQUIRED_LOCALES,\n\tstrictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\tdefaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE\n});\nconst buildRoutingFields = (customConfiguration) => ({\n\tmode: customConfiguration?.mode ?? ROUTING_MODE,\n\tstorage: customConfiguration?.storage ?? STORAGE,\n\tbasePath: customConfiguration?.basePath ?? BASE_PATH\n});\nconst buildContentFields = (customConfiguration, baseDir) => {\n\tconst notDerivedContentConfig = {\n\t\tfileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\t\tbaseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),\n\t\texcludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n\t\twatch: customConfiguration?.watch ?? WATCH,\n\t\tformatCommand: customConfiguration?.formatCommand\n\t};\n\tconst optionalJoinBaseDir = (path) => {\n\t\tif (isAbsolute(path)) return path;\n\t\treturn join(notDerivedContentConfig.baseDir, path);\n\t};\n\tconst baseDirDerivedConfiguration = {\n\t\tcontentDir: (customConfiguration?.contentDir ?? CONTENT_DIR).map(optionalJoinBaseDir),\n\t\tmoduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR),\n\t\tunmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR),\n\t\tremoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR),\n\t\tdictionariesDir: optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR),\n\t\tdynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR),\n\t\tfetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR),\n\t\ttypesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n\t\tmainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n\t\tconfigDir: optionalJoinBaseDir(customConfiguration?.configDir ?? CONFIG_DIR),\n\t\tcacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR)\n\t};\n\tconst patternsConfiguration = {\n\t\twatchedFilesPattern: notDerivedContentConfig.fileExtensions.map((ext) => `/**/*${ext}`),\n\t\twatchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap((ext) => baseDirDerivedConfiguration.contentDir.map((contentDir) => `${normalizePath(contentDir)}/**/*${ext}`)),\n\t\toutputFilesPatternWithPath: `${normalizePath(baseDirDerivedConfiguration.dictionariesDir)}/**/*.json`\n\t};\n\treturn {\n\t\t...notDerivedContentConfig,\n\t\t...baseDirDerivedConfiguration,\n\t\t...patternsConfiguration\n\t};\n};\nconst buildEditorFields = (customConfiguration) => ({\n\tapplicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\teditorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\tcmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\tbackendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\tport: customConfiguration?.port ?? PORT,\n\tenabled: customConfiguration?.enabled ?? IS_ENABLED,\n\tclientId: customConfiguration?.clientId ?? void 0,\n\tclientSecret: customConfiguration?.clientSecret ?? void 0,\n\tdictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? DICTIONARY_PRIORITY_STRATEGY,\n\tliveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\tliveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\tliveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`\n});\nconst buildLogFields = (customConfiguration, logFunctions) => ({\n\tmode: customConfiguration?.mode ?? MODE,\n\tprefix: customConfiguration?.prefix ?? PREFIX,\n\terror: logFunctions?.error,\n\tlog: logFunctions?.log,\n\tinfo: logFunctions?.info,\n\twarn: logFunctions?.warn\n});\nconst buildAiFields = (customConfiguration) => ({\n\tprovider: customConfiguration?.provider,\n\tapiKey: customConfiguration?.apiKey,\n\tmodel: customConfiguration?.model,\n\ttemperature: customConfiguration?.temperature,\n\tapplicationContext: customConfiguration?.applicationContext\n});\nconst buildBuildFields = (customConfiguration) => ({\n\toptimize: customConfiguration?.optimize ?? OPTIMIZE,\n\timportMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\ttraversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\toutputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\tcache: customConfiguration?.cache ?? CACHE,\n\trequire: customConfiguration?.require\n});\nconst buildDictionaryFields = (customConfiguration) => ({ fill: customConfiguration?.fill ?? FILL });\n/**\n* Build the configuration fields by merging the default values with the custom configuration\n*/\nconst buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {\n\tstoredConfiguration = {\n\t\tinternationalization: buildInternationalizationFields(customConfiguration?.internationalization),\n\t\trouting: buildRoutingFields(customConfiguration?.routing),\n\t\tcontent: buildContentFields(customConfiguration?.content, baseDir),\n\t\teditor: buildEditorFields(customConfiguration?.editor),\n\t\tlog: buildLogFields(customConfiguration?.log, logFunctions),\n\t\tai: buildAiFields(customConfiguration?.ai),\n\t\tbuild: buildBuildFields(customConfiguration?.build),\n\t\tdictionary: buildDictionaryFields(customConfiguration?.dictionary),\n\t\tplugins: customConfiguration?.plugins\n\t};\n\treturn storedConfiguration;\n};\n\n//#endregion\nexport { buildConfigurationFields };\n//# sourceMappingURL=buildConfigurationFields.mjs.map"],"mappings":"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"}
|