@intlayer/core 8.1.2 → 8.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs +1 -212
- package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs +1 -94
- package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs +1 -45
- package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getLocalizedContent.cjs +1 -33
- package/dist/cjs/deepTransformPlugins/getLocalizedContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getMaskContent.cjs +1 -27
- package/dist/cjs/deepTransformPlugins/getMaskContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs +1 -82
- package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getMultilingualDictionary.cjs +1 -87
- package/dist/cjs/deepTransformPlugins/getMultilingualDictionary.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getReplacedValuesContent.cjs +1 -60
- package/dist/cjs/deepTransformPlugins/getReplacedValuesContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs +1 -122
- package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs.map +1 -1
- package/dist/cjs/deepTransformPlugins/index.cjs +1 -32
- package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs +1 -106
- package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs +1 -64
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +1 -18
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +1 -55
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +1 -26
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +1 -23
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs +1 -36
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/index.cjs +1 -27
- package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +1 -69
- package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs +1 -30
- package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs +1 -48
- package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +1 -31
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +1 -39
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs +1 -38
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs.map +1 -1
- package/dist/cjs/formatters/compact.cjs +1 -25
- package/dist/cjs/formatters/compact.cjs.map +1 -1
- package/dist/cjs/formatters/currency.cjs +1 -29
- package/dist/cjs/formatters/currency.cjs.map +1 -1
- package/dist/cjs/formatters/date.cjs +1 -60
- package/dist/cjs/formatters/date.cjs.map +1 -1
- package/dist/cjs/formatters/index.cjs +1 -18
- package/dist/cjs/formatters/list.cjs +1 -30
- package/dist/cjs/formatters/list.cjs.map +1 -1
- package/dist/cjs/formatters/number.cjs +1 -18
- package/dist/cjs/formatters/number.cjs.map +1 -1
- package/dist/cjs/formatters/percentage.cjs +1 -25
- package/dist/cjs/formatters/percentage.cjs.map +1 -1
- package/dist/cjs/formatters/relativeTime.cjs +1 -33
- package/dist/cjs/formatters/relativeTime.cjs.map +1 -1
- package/dist/cjs/formatters/units.cjs +1 -23
- package/dist/cjs/formatters/units.cjs.map +1 -1
- package/dist/cjs/getStorageAttributes.cjs +1 -134
- package/dist/cjs/getStorageAttributes.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -300
- package/dist/cjs/interpreter/getCondition.cjs +1 -27
- package/dist/cjs/interpreter/getCondition.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/deepTransform.cjs +1 -41
- package/dist/cjs/interpreter/getContent/deepTransform.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/getContent.cjs +1 -34
- package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/index.cjs +1 -14
- package/dist/cjs/interpreter/getContent/plugins.cjs +1 -161
- package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
- package/dist/cjs/interpreter/getDictionary.cjs +1 -24
- package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
- package/dist/cjs/interpreter/getEnumeration.cjs +1 -72
- package/dist/cjs/interpreter/getEnumeration.cjs.map +1 -1
- package/dist/cjs/interpreter/getGender.cjs +1 -38
- package/dist/cjs/interpreter/getGender.cjs.map +1 -1
- package/dist/cjs/interpreter/getHTML.cjs +1 -121
- package/dist/cjs/interpreter/getHTML.cjs.map +1 -1
- package/dist/cjs/interpreter/getInsertion.cjs +1 -22
- package/dist/cjs/interpreter/getInsertion.cjs.map +1 -1
- package/dist/cjs/interpreter/getIntlayer.cjs +1 -40
- package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
- package/dist/cjs/interpreter/getNesting.cjs +1 -36
- package/dist/cjs/interpreter/getNesting.cjs.map +1 -1
- package/dist/cjs/interpreter/getTranslation.cjs +1 -112
- package/dist/cjs/interpreter/getTranslation.cjs.map +1 -1
- package/dist/cjs/interpreter/index.cjs +1 -31
- package/dist/cjs/interpreter/splitAndJoinInsertion.cjs +1 -55
- package/dist/cjs/interpreter/splitAndJoinInsertion.cjs.map +1 -1
- package/dist/cjs/localization/getBrowserLocale.cjs +1 -143
- package/dist/cjs/localization/getBrowserLocale.cjs.map +1 -1
- package/dist/cjs/localization/getHTMLTextDir.cjs +1 -64
- package/dist/cjs/localization/getHTMLTextDir.cjs.map +1 -1
- package/dist/cjs/localization/getLocale.cjs +1 -27
- package/dist/cjs/localization/getLocale.cjs.map +1 -1
- package/dist/cjs/localization/getLocaleFromPath.cjs +1 -45
- package/dist/cjs/localization/getLocaleFromPath.cjs.map +1 -1
- package/dist/cjs/localization/getLocaleLang.cjs +1 -20
- package/dist/cjs/localization/getLocaleLang.cjs.map +1 -1
- package/dist/cjs/localization/getLocaleName.cjs +1 -10
- package/dist/cjs/localization/getLocaleName.cjs.map +1 -1
- package/dist/cjs/localization/getLocalizedUrl.cjs +1 -82
- package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
- package/dist/cjs/localization/getMultilingualUrls.cjs +1 -63
- package/dist/cjs/localization/getMultilingualUrls.cjs.map +1 -1
- package/dist/cjs/localization/getPathWithoutLocale.cjs +1 -55
- package/dist/cjs/localization/getPathWithoutLocale.cjs.map +1 -1
- package/dist/cjs/localization/getPrefix.cjs +1 -63
- package/dist/cjs/localization/getPrefix.cjs.map +1 -1
- package/dist/cjs/localization/index.cjs +1 -39
- package/dist/cjs/localization/localeDetector.cjs +1 -133
- package/dist/cjs/localization/localeDetector.cjs.map +1 -1
- package/dist/cjs/localization/localeMapper.cjs +1 -119
- package/dist/cjs/localization/localeMapper.cjs.map +1 -1
- package/dist/cjs/localization/localeResolver.cjs +1 -28
- package/dist/cjs/localization/localeResolver.cjs.map +1 -1
- package/dist/cjs/localization/rewriteUtils.cjs +1 -110
- package/dist/cjs/localization/rewriteUtils.cjs.map +1 -1
- package/dist/cjs/localization/validatePrefix.cjs +1 -54
- package/dist/cjs/localization/validatePrefix.cjs.map +1 -1
- package/dist/cjs/markdown/compiler.cjs +10 -810
- package/dist/cjs/markdown/compiler.cjs.map +1 -1
- package/dist/cjs/markdown/constants.cjs +1 -328
- package/dist/cjs/markdown/constants.cjs.map +1 -1
- package/dist/cjs/markdown/index.cjs +1 -120
- package/dist/cjs/markdown/parser.cjs +1 -66
- package/dist/cjs/markdown/parser.cjs.map +1 -1
- package/dist/cjs/markdown/renderer.cjs +1 -61
- package/dist/cjs/markdown/renderer.cjs.map +1 -1
- package/dist/cjs/markdown/utils.cjs +6 -391
- package/dist/cjs/markdown/utils.cjs.map +1 -1
- package/dist/cjs/messageFormat/ICU.cjs +1 -319
- package/dist/cjs/messageFormat/ICU.cjs.map +1 -1
- package/dist/cjs/messageFormat/i18next.cjs +1 -330
- package/dist/cjs/messageFormat/i18next.cjs.map +1 -1
- package/dist/cjs/messageFormat/index.cjs +1 -11
- package/dist/cjs/messageFormat/verify-icu-format.cjs +2 -64
- package/dist/cjs/messageFormat/verify-icu-format.cjs.map +1 -1
- package/dist/cjs/messageFormat/vue-i18n.cjs +1 -166
- package/dist/cjs/messageFormat/vue-i18n.cjs.map +1 -1
- package/dist/cjs/transpiler/condition/condition.cjs +1 -26
- package/dist/cjs/transpiler/condition/condition.cjs.map +1 -1
- package/dist/cjs/transpiler/condition/index.cjs +1 -4
- package/dist/cjs/transpiler/enumeration/enumeration.cjs +1 -28
- package/dist/cjs/transpiler/enumeration/enumeration.cjs.map +1 -1
- package/dist/cjs/transpiler/enumeration/index.cjs +1 -4
- package/dist/cjs/transpiler/file/file.cjs +1 -52
- package/dist/cjs/transpiler/file/file.cjs.map +1 -1
- package/dist/cjs/transpiler/file/fileBrowser.cjs +1 -25
- package/dist/cjs/transpiler/file/fileBrowser.cjs.map +1 -1
- package/dist/cjs/transpiler/file/index.cjs +1 -5
- package/dist/cjs/transpiler/gender/gender.cjs +1 -26
- package/dist/cjs/transpiler/gender/gender.cjs.map +1 -1
- package/dist/cjs/transpiler/gender/index.cjs +1 -4
- package/dist/cjs/transpiler/html/getHTMLCustomComponents.cjs +1 -44
- package/dist/cjs/transpiler/html/getHTMLCustomComponents.cjs.map +1 -1
- package/dist/cjs/transpiler/html/html.cjs +1 -37
- package/dist/cjs/transpiler/html/html.cjs.map +1 -1
- package/dist/cjs/transpiler/html/htmlTags.cjs +1 -116
- package/dist/cjs/transpiler/html/htmlTags.cjs.map +1 -1
- package/dist/cjs/transpiler/html/index.cjs +1 -6
- package/dist/cjs/transpiler/index.cjs +1 -24
- package/dist/cjs/transpiler/insertion/getInsertionValues.cjs +1 -11
- package/dist/cjs/transpiler/insertion/getInsertionValues.cjs.map +1 -1
- package/dist/cjs/transpiler/insertion/index.cjs +1 -6
- package/dist/cjs/transpiler/insertion/insertion.cjs +1 -36
- package/dist/cjs/transpiler/insertion/insertion.cjs.map +1 -1
- package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs +2 -23
- package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs.map +1 -1
- package/dist/cjs/transpiler/markdown/index.cjs +1 -6
- package/dist/cjs/transpiler/markdown/markdown.cjs +1 -54
- package/dist/cjs/transpiler/markdown/markdown.cjs.map +1 -1
- package/dist/cjs/transpiler/nesting/index.cjs +1 -4
- package/dist/cjs/transpiler/nesting/nesting.cjs +1 -27
- package/dist/cjs/transpiler/nesting/nesting.cjs.map +1 -1
- package/dist/cjs/transpiler/translation/index.cjs +1 -4
- package/dist/cjs/transpiler/translation/translation.cjs +1 -29
- package/dist/cjs/transpiler/translation/translation.cjs.map +1 -1
- package/dist/cjs/utils/checkIsURLAbsolute.cjs +1 -7
- package/dist/cjs/utils/checkIsURLAbsolute.cjs.map +1 -1
- package/dist/cjs/utils/getCookie.cjs +1 -32
- package/dist/cjs/utils/getCookie.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +1 -0
- package/dist/cjs/utils/intl.cjs +1 -91
- package/dist/cjs/utils/intl.cjs.map +1 -1
- package/dist/cjs/utils/isSameKeyPath.cjs +1 -7
- package/dist/cjs/utils/isSameKeyPath.cjs.map +1 -1
- package/dist/cjs/utils/isValidReactElement.cjs +1 -14
- package/dist/cjs/utils/isValidReactElement.cjs.map +1 -1
- package/dist/cjs/utils/localeStorage.cjs +1 -140
- package/dist/cjs/utils/localeStorage.cjs.map +1 -1
- package/dist/cjs/utils/parseYaml.cjs +16 -322
- package/dist/cjs/utils/parseYaml.cjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getFilterMissingTranslationsContent.mjs +1 -207
- package/dist/esm/deepTransformPlugins/getFilterMissingTranslationsContent.mjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getFilterTranslationsOnlyContent.mjs +1 -89
- package/dist/esm/deepTransformPlugins/getFilterTranslationsOnlyContent.mjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs +1 -42
- package/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getLocalizedContent.mjs +1 -31
- package/dist/esm/deepTransformPlugins/getLocalizedContent.mjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getMaskContent.mjs +1 -25
- package/dist/esm/deepTransformPlugins/getMaskContent.mjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs +1 -77
- package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getMultilingualDictionary.mjs +1 -86
- package/dist/esm/deepTransformPlugins/getMultilingualDictionary.mjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getReplacedValuesContent.mjs +1 -59
- package/dist/esm/deepTransformPlugins/getReplacedValuesContent.mjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getSplittedContent.mjs +1 -119
- package/dist/esm/deepTransformPlugins/getSplittedContent.mjs.map +1 -1
- package/dist/esm/deepTransformPlugins/index.mjs +1 -12
- package/dist/esm/deepTransformPlugins/insertContentInDictionary.mjs +1 -104
- package/dist/esm/deepTransformPlugins/insertContentInDictionary.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +1 -62
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +1 -16
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs +1 -53
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs +1 -24
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs +1 -21
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeType.mjs +1 -34
- package/dist/esm/dictionaryManipulator/getNodeType.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/index.mjs +1 -14
- package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs +1 -66
- package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs +1 -28
- package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/orderDictionaries.mjs +1 -45
- package/dist/esm/dictionaryManipulator/orderDictionaries.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs +1 -29
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +1 -37
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs +1 -36
- package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs.map +1 -1
- package/dist/esm/formatters/compact.mjs +1 -22
- package/dist/esm/formatters/compact.mjs.map +1 -1
- package/dist/esm/formatters/currency.mjs +1 -26
- package/dist/esm/formatters/currency.mjs.map +1 -1
- package/dist/esm/formatters/date.mjs +1 -57
- package/dist/esm/formatters/date.mjs.map +1 -1
- package/dist/esm/formatters/index.mjs +1 -10
- package/dist/esm/formatters/list.mjs +1 -27
- package/dist/esm/formatters/list.mjs.map +1 -1
- package/dist/esm/formatters/number.mjs +1 -15
- package/dist/esm/formatters/number.mjs.map +1 -1
- package/dist/esm/formatters/percentage.mjs +1 -22
- package/dist/esm/formatters/percentage.mjs.map +1 -1
- package/dist/esm/formatters/relativeTime.mjs +1 -30
- package/dist/esm/formatters/relativeTime.mjs.map +1 -1
- package/dist/esm/formatters/units.mjs +1 -20
- package/dist/esm/formatters/units.mjs.map +1 -1
- package/dist/esm/getStorageAttributes.mjs +1 -132
- package/dist/esm/getStorageAttributes.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -82
- package/dist/esm/interpreter/getCondition.mjs +1 -25
- package/dist/esm/interpreter/getCondition.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/deepTransform.mjs +1 -39
- package/dist/esm/interpreter/getContent/deepTransform.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/getContent.mjs +1 -31
- package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/index.mjs +1 -5
- package/dist/esm/interpreter/getContent/plugins.mjs +1 -153
- package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
- package/dist/esm/interpreter/getDictionary.mjs +1 -23
- package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
- package/dist/esm/interpreter/getEnumeration.mjs +1 -69
- package/dist/esm/interpreter/getEnumeration.mjs.map +1 -1
- package/dist/esm/interpreter/getGender.mjs +1 -36
- package/dist/esm/interpreter/getGender.mjs.map +1 -1
- package/dist/esm/interpreter/getHTML.mjs +1 -119
- package/dist/esm/interpreter/getHTML.mjs.map +1 -1
- package/dist/esm/interpreter/getInsertion.mjs +1 -20
- package/dist/esm/interpreter/getInsertion.mjs.map +1 -1
- package/dist/esm/interpreter/getIntlayer.mjs +1 -36
- package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
- package/dist/esm/interpreter/getNesting.mjs +1 -35
- package/dist/esm/interpreter/getNesting.mjs.map +1 -1
- package/dist/esm/interpreter/getTranslation.mjs +1 -110
- package/dist/esm/interpreter/getTranslation.mjs.map +1 -1
- package/dist/esm/interpreter/index.mjs +1 -13
- package/dist/esm/interpreter/splitAndJoinInsertion.mjs +1 -53
- package/dist/esm/interpreter/splitAndJoinInsertion.mjs.map +1 -1
- package/dist/esm/localization/getBrowserLocale.mjs +1 -138
- package/dist/esm/localization/getBrowserLocale.mjs.map +1 -1
- package/dist/esm/localization/getHTMLTextDir.mjs +1 -62
- package/dist/esm/localization/getHTMLTextDir.mjs.map +1 -1
- package/dist/esm/localization/getLocale.mjs +1 -24
- package/dist/esm/localization/getLocale.mjs.map +1 -1
- package/dist/esm/localization/getLocaleFromPath.mjs +1 -42
- package/dist/esm/localization/getLocaleFromPath.mjs.map +1 -1
- package/dist/esm/localization/getLocaleLang.mjs +1 -18
- package/dist/esm/localization/getLocaleLang.mjs.map +1 -1
- package/dist/esm/localization/getLocaleName.mjs +1 -9
- package/dist/esm/localization/getLocaleName.mjs.map +1 -1
- package/dist/esm/localization/getLocalizedUrl.mjs +1 -79
- package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
- package/dist/esm/localization/getMultilingualUrls.mjs +1 -60
- package/dist/esm/localization/getMultilingualUrls.mjs.map +1 -1
- package/dist/esm/localization/getPathWithoutLocale.mjs +1 -52
- package/dist/esm/localization/getPathWithoutLocale.mjs.map +1 -1
- package/dist/esm/localization/getPrefix.mjs +1 -60
- package/dist/esm/localization/getPrefix.mjs.map +1 -1
- package/dist/esm/localization/index.mjs +1 -17
- package/dist/esm/localization/localeDetector.mjs +1 -131
- package/dist/esm/localization/localeDetector.mjs.map +1 -1
- package/dist/esm/localization/localeMapper.mjs +1 -114
- package/dist/esm/localization/localeMapper.mjs.map +1 -1
- package/dist/esm/localization/localeResolver.mjs +1 -25
- package/dist/esm/localization/localeResolver.mjs.map +1 -1
- package/dist/esm/localization/rewriteUtils.mjs +1 -104
- package/dist/esm/localization/rewriteUtils.mjs.map +1 -1
- package/dist/esm/localization/validatePrefix.mjs +1 -51
- package/dist/esm/localization/validatePrefix.mjs.map +1 -1
- package/dist/esm/markdown/compiler.mjs +10 -786
- package/dist/esm/markdown/compiler.mjs.map +1 -1
- package/dist/esm/markdown/constants.mjs +1 -247
- package/dist/esm/markdown/constants.mjs.map +1 -1
- package/dist/esm/markdown/index.mjs +1 -7
- package/dist/esm/markdown/parser.mjs +1 -65
- package/dist/esm/markdown/parser.mjs.map +1 -1
- package/dist/esm/markdown/renderer.mjs +1 -59
- package/dist/esm/markdown/renderer.mjs.map +1 -1
- package/dist/esm/markdown/utils.mjs +6 -361
- package/dist/esm/markdown/utils.mjs.map +1 -1
- package/dist/esm/messageFormat/ICU.mjs +1 -316
- package/dist/esm/messageFormat/ICU.mjs.map +1 -1
- package/dist/esm/messageFormat/i18next.mjs +1 -327
- package/dist/esm/messageFormat/i18next.mjs.map +1 -1
- package/dist/esm/messageFormat/index.mjs +1 -5
- package/dist/esm/messageFormat/verify-icu-format.mjs +2 -64
- package/dist/esm/messageFormat/verify-icu-format.mjs.map +1 -1
- package/dist/esm/messageFormat/vue-i18n.mjs +1 -163
- package/dist/esm/messageFormat/vue-i18n.mjs.map +1 -1
- package/dist/esm/transpiler/condition/condition.mjs +1 -24
- package/dist/esm/transpiler/condition/condition.mjs.map +1 -1
- package/dist/esm/transpiler/condition/index.mjs +1 -3
- package/dist/esm/transpiler/enumeration/enumeration.mjs +1 -26
- package/dist/esm/transpiler/enumeration/enumeration.mjs.map +1 -1
- package/dist/esm/transpiler/enumeration/index.mjs +1 -3
- package/dist/esm/transpiler/file/file.mjs +1 -49
- package/dist/esm/transpiler/file/file.mjs.map +1 -1
- package/dist/esm/transpiler/file/fileBrowser.mjs +1 -24
- package/dist/esm/transpiler/file/fileBrowser.mjs.map +1 -1
- package/dist/esm/transpiler/file/index.mjs +1 -3
- package/dist/esm/transpiler/gender/gender.mjs +1 -24
- package/dist/esm/transpiler/gender/gender.mjs.map +1 -1
- package/dist/esm/transpiler/gender/index.mjs +1 -3
- package/dist/esm/transpiler/html/getHTMLCustomComponents.mjs +1 -43
- package/dist/esm/transpiler/html/getHTMLCustomComponents.mjs.map +1 -1
- package/dist/esm/transpiler/html/html.mjs +1 -35
- package/dist/esm/transpiler/html/html.mjs.map +1 -1
- package/dist/esm/transpiler/html/htmlTags.mjs +1 -114
- package/dist/esm/transpiler/html/htmlTags.mjs.map +1 -1
- package/dist/esm/transpiler/html/index.mjs +1 -4
- package/dist/esm/transpiler/index.mjs +1 -13
- package/dist/esm/transpiler/insertion/getInsertionValues.mjs +1 -9
- package/dist/esm/transpiler/insertion/getInsertionValues.mjs.map +1 -1
- package/dist/esm/transpiler/insertion/index.mjs +1 -4
- package/dist/esm/transpiler/insertion/insertion.mjs +1 -34
- package/dist/esm/transpiler/insertion/insertion.mjs.map +1 -1
- package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs +2 -22
- package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs.map +1 -1
- package/dist/esm/transpiler/markdown/index.mjs +1 -4
- package/dist/esm/transpiler/markdown/markdown.mjs +1 -52
- package/dist/esm/transpiler/markdown/markdown.mjs.map +1 -1
- package/dist/esm/transpiler/nesting/index.mjs +1 -3
- package/dist/esm/transpiler/nesting/nesting.mjs +1 -25
- package/dist/esm/transpiler/nesting/nesting.mjs.map +1 -1
- package/dist/esm/transpiler/translation/index.mjs +1 -3
- package/dist/esm/transpiler/translation/translation.mjs +1 -27
- package/dist/esm/transpiler/translation/translation.mjs.map +1 -1
- package/dist/esm/utils/checkIsURLAbsolute.mjs +1 -5
- package/dist/esm/utils/checkIsURLAbsolute.mjs.map +1 -1
- package/dist/esm/utils/getCookie.mjs +1 -30
- package/dist/esm/utils/getCookie.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +1 -0
- package/dist/esm/utils/intl.mjs +1 -86
- package/dist/esm/utils/intl.mjs.map +1 -1
- package/dist/esm/utils/isSameKeyPath.mjs +1 -5
- package/dist/esm/utils/isSameKeyPath.mjs.map +1 -1
- package/dist/esm/utils/isValidReactElement.mjs +1 -12
- package/dist/esm/utils/isValidReactElement.mjs.map +1 -1
- package/dist/esm/utils/localeStorage.mjs +1 -135
- package/dist/esm/utils/localeStorage.mjs.map +1 -1
- package/dist/esm/utils/parseYaml.mjs +16 -320
- package/dist/esm/utils/parseYaml.mjs.map +1 -1
- package/dist/types/formatters/index.d.ts +2 -1
- package/dist/types/index.d.ts +8 -2
- package/dist/types/interpreter/getContent/plugins.d.ts +4 -4
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/localization/index.d.ts +2 -1
- package/dist/types/markdown/index.d.ts +4 -1
- package/dist/types/markdown/types.d.ts +1 -1
- package/dist/types/markdown/types.d.ts.map +1 -1
- package/dist/types/transpiler/translation/translation.d.ts +1 -1
- package/dist/types/utils/index.d.ts +8 -0
- package/package.json +65 -11
|
@@ -1,70 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_deepTransformPlugins_getMultilingualDictionary = require('../deepTransformPlugins/getMultilingualDictionary.cjs');
|
|
4
|
-
const require_dictionaryManipulator_getNodeType = require('./getNodeType.cjs');
|
|
5
|
-
let _intlayer_config_client = require("@intlayer/config/client");
|
|
6
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
7
|
-
_intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
|
|
8
|
-
|
|
9
|
-
//#region src/dictionaryManipulator/mergeDictionaries.ts
|
|
10
|
-
const checkTypesMatch = (object1, object2, object2LocalId, dictionaryKey, path = []) => {
|
|
11
|
-
const appLogger = (0, _intlayer_config_client.getAppLogger)(_intlayer_config_built.default);
|
|
12
|
-
if (object1 === void 0 || object1 === null || object2 === void 0 || object2 === null) return;
|
|
13
|
-
const type1 = require_dictionaryManipulator_getNodeType.getNodeType(object1);
|
|
14
|
-
const type2 = require_dictionaryManipulator_getNodeType.getNodeType(object2);
|
|
15
|
-
if (type1 === "unknown" || type2 === "unknown") return;
|
|
16
|
-
if (type1 !== type2) {
|
|
17
|
-
appLogger([`Error: Dictionary ${(0, _intlayer_config_client.colorizeKey)(dictionaryKey)} has a multiple content files with type mismatch at path "${path.join(".")}": Cannot merge ${type1} with ${type2} while merging ${object2LocalId}`], { level: "error" });
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const customMerge = (destination, source) => {
|
|
22
|
-
if (destination === void 0 || destination === null) return source;
|
|
23
|
-
if (source === void 0 || source === null) return destination;
|
|
24
|
-
if (typeof destination !== "object" || typeof source !== "object") return destination;
|
|
25
|
-
if (Array.isArray(destination) && Array.isArray(source)) return arrayMerge(destination, source);
|
|
26
|
-
if (typeof destination === "object" && typeof source === "object") {
|
|
27
|
-
const result = {};
|
|
28
|
-
const allKeys = new Set([...Object.keys(destination), ...Object.keys(source)]);
|
|
29
|
-
for (const key of allKeys) result[key] = customMerge(destination[key], source[key]);
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
return destination;
|
|
33
|
-
};
|
|
34
|
-
const arrayMerge = (destinationArray, sourceArray) => {
|
|
35
|
-
const destHasOnlyPrimitives = destinationArray.every((item) => typeof item !== "object" || item === null);
|
|
36
|
-
const sourceHasOnlyPrimitives = sourceArray.every((item) => typeof item !== "object" || item === null);
|
|
37
|
-
if (destHasOnlyPrimitives && sourceHasOnlyPrimitives) return sourceArray;
|
|
38
|
-
const result = [];
|
|
39
|
-
const maxLength = Math.max(destinationArray.length, sourceArray.length);
|
|
40
|
-
for (let i = 0; i < maxLength; i++) {
|
|
41
|
-
const destItem = destinationArray[i];
|
|
42
|
-
const sourceItem = sourceArray[i];
|
|
43
|
-
if (destItem === void 0 && sourceItem === void 0) {} else if (destItem === void 0) result.push(sourceItem);
|
|
44
|
-
else if (sourceItem === void 0) result.push(destItem);
|
|
45
|
-
else if (typeof destItem === "object" && typeof sourceItem === "object" && destItem !== null && sourceItem !== null) if ("key" in destItem && "key" in sourceItem && destItem.key === sourceItem.key) result.push(customMerge(destItem, sourceItem));
|
|
46
|
-
else result.push(customMerge(destItem, sourceItem));
|
|
47
|
-
else result.push(destItem);
|
|
48
|
-
}
|
|
49
|
-
return result;
|
|
50
|
-
};
|
|
51
|
-
const mergeDictionaries = (dictionaries) => {
|
|
52
|
-
const localIds = Array.from(new Set(dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId)));
|
|
53
|
-
const dictionariesKeys = dictionaries.map((dict) => dict.key);
|
|
54
|
-
if (new Set(dictionariesKeys).size !== 1) throw new Error("All dictionaries must have the same key");
|
|
55
|
-
let mergedContent = dictionaries[0].content;
|
|
56
|
-
for (let i = 1; i < dictionaries.length; i++) {
|
|
57
|
-
const currentDictionary = require_deepTransformPlugins_getMultilingualDictionary.getMultilingualDictionary(dictionaries[i]);
|
|
58
|
-
checkTypesMatch(mergedContent, currentDictionary.content, currentDictionary.localId, currentDictionary.key, []);
|
|
59
|
-
mergedContent = customMerge(mergedContent, currentDictionary.content);
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
key: dictionaries[0].key,
|
|
63
|
-
content: mergedContent,
|
|
64
|
-
localIds
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
//#endregion
|
|
69
|
-
exports.mergeDictionaries = mergeDictionaries;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../deepTransformPlugins/getMultilingualDictionary.cjs`),n=require(`./getNodeType.cjs`);let r=require(`@intlayer/config/client`),i=require(`@intlayer/config/built`);i=e.__toESM(i);const a=(e,t,a,o,s=[])=>{let c=(0,r.getAppLogger)(i.default);if(e==null||t==null)return;let l=n.getNodeType(e),u=n.getNodeType(t);if(!(l===`unknown`||u===`unknown`)&&l!==u){c([`Error: Dictionary ${(0,r.colorizeKey)(o)} has a multiple content files with type mismatch at path "${s.join(`.`)}": Cannot merge ${l} with ${u} while merging ${a}`],{level:`error`});return}},o=(e,t)=>{if(e==null)return t;if(t==null||typeof e!=`object`||typeof t!=`object`)return e;if(Array.isArray(e)&&Array.isArray(t))return s(e,t);if(typeof e==`object`&&typeof t==`object`){let n={},r=new Set([...Object.keys(e),...Object.keys(t)]);for(let i of r)n[i]=o(e[i],t[i]);return n}return e},s=(e,t)=>{let n=e.every(e=>typeof e!=`object`||!e),r=t.every(e=>typeof e!=`object`||!e);if(n&&r)return t;let i=[],a=Math.max(e.length,t.length);for(let n=0;n<a;n++){let r=e[n],a=t[n];r===void 0&&a===void 0||(r===void 0?i.push(a):a===void 0?i.push(r):typeof r==`object`&&typeof a==`object`&&r!==null&&a!==null?(`key`in r&&`key`in a&&(r.key,a.key),i.push(o(r,a))):i.push(r))}return i},c=e=>{let n=Array.from(new Set(e.filter(e=>e.localId).map(e=>e.localId))),r=e.map(e=>e.key);if(new Set(r).size!==1)throw Error(`All dictionaries must have the same key`);let i=e[0].content;for(let n=1;n<e.length;n++){let r=t.getMultilingualDictionary(e[n]);a(i,r.content,r.localId,r.key,[]),i=o(i,r.content)}return{key:e[0].key,content:i,localIds:n}};exports.mergeDictionaries=c;
|
|
70
2
|
//# sourceMappingURL=mergeDictionaries.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeDictionaries.cjs","names":["configuration","getNodeType","getMultilingualDictionary"],"sources":["../../../src/dictionaryManipulator/mergeDictionaries.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizeKey, getAppLogger } from '@intlayer/config/client';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types';\nimport { getMultilingualDictionary } from '../deepTransformPlugins';\nimport { getNodeType } from './getNodeType';\n\n// Extended type that includes arrays for internal merge operations\ntype MergeableContent = ContentNode | ContentNode[];\n\nconst checkTypesMatch = (\n object1: ContentNode,\n object2: ContentNode,\n object2LocalId: LocalDictionaryId | undefined,\n dictionaryKey: string,\n path: string[] = []\n): void => {\n const appLogger = getAppLogger(configuration);\n\n // If either side is missing/undefined, allow merge without error\n if (\n object1 === undefined ||\n object1 === null ||\n object2 === undefined ||\n object2 === null\n )\n return;\n\n const type1 = getNodeType(object1);\n const type2 = getNodeType(object2);\n\n // Unknown types are treated as flexible; skip strict mismatch reporting\n if (type1 === 'unknown' || type2 === 'unknown') return;\n\n if (type1 !== type2) {\n appLogger(\n [\n `Error: Dictionary ${colorizeKey(dictionaryKey)} has a multiple content files with type mismatch at path \"${path.join('.')}\": Cannot merge ${type1} with ${type2} while merging ${object2LocalId}`,\n ],\n {\n level: 'error',\n }\n );\n\n return;\n }\n};\n\n// Custom merge function that prefers destination (first dictionary) values\nconst customMerge = (\n destination: ContentNode,\n source: ContentNode\n): MergeableContent => {\n // If destination is undefined/null, use source\n if (destination === undefined || destination === null) {\n return source;\n }\n\n // If source is undefined/null, use destination\n if (source === undefined || source === null) {\n return destination;\n }\n\n // For primitive values, prefer destination (first dictionary)\n if (typeof destination !== 'object' || typeof source !== 'object') {\n return destination;\n }\n\n // For arrays, use our custom array merge\n if (Array.isArray(destination) && Array.isArray(source)) {\n return arrayMerge(\n destination as ContentNode[],\n source as ContentNode[]\n ) as MergeableContent;\n }\n\n // For objects, recursively merge with our custom logic\n if (typeof destination === 'object' && typeof source === 'object') {\n const result: Record<string, MergeableContent> = {};\n const allKeys = new Set([\n ...Object.keys(destination as unknown as Record<string, ContentNode>),\n ...Object.keys(source as unknown as Record<string, ContentNode>),\n ]);\n\n for (const key of allKeys) {\n result[key] = customMerge(\n (destination as unknown as Record<string, ContentNode>)[key],\n (source as unknown as Record<string, ContentNode>)[key]\n );\n }\n\n return result as unknown as MergeableContent;\n }\n\n // Fallback to destination\n return destination;\n};\n\n// Custom array merge strategy that merges arrays by key when present, otherwise by index\nconst arrayMerge = (\n destinationArray: ContentNode[],\n sourceArray: ContentNode[]\n): MergeableContent[] => {\n // Check if both arrays contain only primitives\n const destHasOnlyPrimitives = destinationArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n const sourceHasOnlyPrimitives = sourceArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n\n // If both arrays contain only primitives, use the source array (second dictionary)\n if (destHasOnlyPrimitives && sourceHasOnlyPrimitives) {\n return sourceArray;\n }\n\n // Otherwise, merge by index with object merging logic\n const result: MergeableContent[] = [];\n const maxLength = Math.max(destinationArray.length, sourceArray.length);\n\n for (let i = 0; i < maxLength; i++) {\n const destItem = destinationArray[i];\n const sourceItem = sourceArray[i];\n\n if (destItem === undefined && sourceItem === undefined) {\n } else if (destItem === undefined) {\n // Only source exists, add it\n result.push(sourceItem);\n } else if (sourceItem === undefined) {\n // Only destination exists, add it\n result.push(destItem);\n } else {\n // Both exist, merge them\n if (\n typeof destItem === 'object' &&\n typeof sourceItem === 'object' &&\n destItem !== null &&\n sourceItem !== null\n ) {\n // Check if both objects have a 'key' property for keyed merging\n if (\n 'key' in destItem &&\n 'key' in sourceItem &&\n (destItem as Record<string, string>).key ===\n (sourceItem as Record<string, string>).key\n ) {\n // Merge objects with same key, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n } else {\n // Merge objects by index, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n }\n } else {\n // For primitives or non-objects, use destination value (first dictionary)\n result.push(destItem);\n }\n }\n }\n\n return result;\n};\n\nexport const mergeDictionaries = (dictionaries: Dictionary[]): Dictionary => {\n const localIds = Array.from(\n new Set<LocalDictionaryId>(\n dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId!)\n )\n );\n\n const dictionariesKeys = dictionaries.map((dict) => dict.key);\n\n // Check if all dictionaries have the same key\n if (new Set(dictionariesKeys).size !== 1) {\n throw new Error('All dictionaries must have the same key');\n }\n\n let mergedContent: Dictionary['content'] = dictionaries[0].content;\n\n for (let i = 1; i < dictionaries.length; i++) {\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n const currentDictionary = getMultilingualDictionary(dictionaries[i]);\n\n // Check types before merging\n checkTypesMatch(\n mergedContent,\n currentDictionary.content,\n currentDictionary.localId,\n currentDictionary.key,\n []\n );\n\n mergedContent = customMerge(\n mergedContent,\n currentDictionary.content\n ) as ContentNode;\n }\n\n const mergedDictionary: Dictionary = {\n key: dictionaries[0].key,\n content: mergedContent,\n localIds,\n };\n\n return mergedDictionary;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mergeDictionaries.cjs","names":["configuration","getNodeType","getMultilingualDictionary"],"sources":["../../../src/dictionaryManipulator/mergeDictionaries.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizeKey, getAppLogger } from '@intlayer/config/client';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types';\nimport { getMultilingualDictionary } from '../deepTransformPlugins';\nimport { getNodeType } from './getNodeType';\n\n// Extended type that includes arrays for internal merge operations\ntype MergeableContent = ContentNode | ContentNode[];\n\nconst checkTypesMatch = (\n object1: ContentNode,\n object2: ContentNode,\n object2LocalId: LocalDictionaryId | undefined,\n dictionaryKey: string,\n path: string[] = []\n): void => {\n const appLogger = getAppLogger(configuration);\n\n // If either side is missing/undefined, allow merge without error\n if (\n object1 === undefined ||\n object1 === null ||\n object2 === undefined ||\n object2 === null\n )\n return;\n\n const type1 = getNodeType(object1);\n const type2 = getNodeType(object2);\n\n // Unknown types are treated as flexible; skip strict mismatch reporting\n if (type1 === 'unknown' || type2 === 'unknown') return;\n\n if (type1 !== type2) {\n appLogger(\n [\n `Error: Dictionary ${colorizeKey(dictionaryKey)} has a multiple content files with type mismatch at path \"${path.join('.')}\": Cannot merge ${type1} with ${type2} while merging ${object2LocalId}`,\n ],\n {\n level: 'error',\n }\n );\n\n return;\n }\n};\n\n// Custom merge function that prefers destination (first dictionary) values\nconst customMerge = (\n destination: ContentNode,\n source: ContentNode\n): MergeableContent => {\n // If destination is undefined/null, use source\n if (destination === undefined || destination === null) {\n return source;\n }\n\n // If source is undefined/null, use destination\n if (source === undefined || source === null) {\n return destination;\n }\n\n // For primitive values, prefer destination (first dictionary)\n if (typeof destination !== 'object' || typeof source !== 'object') {\n return destination;\n }\n\n // For arrays, use our custom array merge\n if (Array.isArray(destination) && Array.isArray(source)) {\n return arrayMerge(\n destination as ContentNode[],\n source as ContentNode[]\n ) as MergeableContent;\n }\n\n // For objects, recursively merge with our custom logic\n if (typeof destination === 'object' && typeof source === 'object') {\n const result: Record<string, MergeableContent> = {};\n const allKeys = new Set([\n ...Object.keys(destination as unknown as Record<string, ContentNode>),\n ...Object.keys(source as unknown as Record<string, ContentNode>),\n ]);\n\n for (const key of allKeys) {\n result[key] = customMerge(\n (destination as unknown as Record<string, ContentNode>)[key],\n (source as unknown as Record<string, ContentNode>)[key]\n );\n }\n\n return result as unknown as MergeableContent;\n }\n\n // Fallback to destination\n return destination;\n};\n\n// Custom array merge strategy that merges arrays by key when present, otherwise by index\nconst arrayMerge = (\n destinationArray: ContentNode[],\n sourceArray: ContentNode[]\n): MergeableContent[] => {\n // Check if both arrays contain only primitives\n const destHasOnlyPrimitives = destinationArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n const sourceHasOnlyPrimitives = sourceArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n\n // If both arrays contain only primitives, use the source array (second dictionary)\n if (destHasOnlyPrimitives && sourceHasOnlyPrimitives) {\n return sourceArray;\n }\n\n // Otherwise, merge by index with object merging logic\n const result: MergeableContent[] = [];\n const maxLength = Math.max(destinationArray.length, sourceArray.length);\n\n for (let i = 0; i < maxLength; i++) {\n const destItem = destinationArray[i];\n const sourceItem = sourceArray[i];\n\n if (destItem === undefined && sourceItem === undefined) {\n } else if (destItem === undefined) {\n // Only source exists, add it\n result.push(sourceItem);\n } else if (sourceItem === undefined) {\n // Only destination exists, add it\n result.push(destItem);\n } else {\n // Both exist, merge them\n if (\n typeof destItem === 'object' &&\n typeof sourceItem === 'object' &&\n destItem !== null &&\n sourceItem !== null\n ) {\n // Check if both objects have a 'key' property for keyed merging\n if (\n 'key' in destItem &&\n 'key' in sourceItem &&\n (destItem as Record<string, string>).key ===\n (sourceItem as Record<string, string>).key\n ) {\n // Merge objects with same key, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n } else {\n // Merge objects by index, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n }\n } else {\n // For primitives or non-objects, use destination value (first dictionary)\n result.push(destItem);\n }\n }\n }\n\n return result;\n};\n\nexport const mergeDictionaries = (dictionaries: Dictionary[]): Dictionary => {\n const localIds = Array.from(\n new Set<LocalDictionaryId>(\n dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId!)\n )\n );\n\n const dictionariesKeys = dictionaries.map((dict) => dict.key);\n\n // Check if all dictionaries have the same key\n if (new Set(dictionariesKeys).size !== 1) {\n throw new Error('All dictionaries must have the same key');\n }\n\n let mergedContent: Dictionary['content'] = dictionaries[0].content;\n\n for (let i = 1; i < dictionaries.length; i++) {\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n const currentDictionary = getMultilingualDictionary(dictionaries[i]);\n\n // Check types before merging\n checkTypesMatch(\n mergedContent,\n currentDictionary.content,\n currentDictionary.localId,\n currentDictionary.key,\n []\n );\n\n mergedContent = customMerge(\n mergedContent,\n currentDictionary.content\n ) as ContentNode;\n }\n\n const mergedDictionary: Dictionary = {\n key: dictionaries[0].key,\n content: mergedContent,\n localIds,\n };\n\n return mergedDictionary;\n};\n"],"mappings":"sTAaA,MAAM,GACJ,EACA,EACA,EACA,EACA,EAAiB,EAAE,GACV,CACT,IAAM,GAAA,EAAA,EAAA,cAAyBA,EAAAA,QAAc,CAG7C,GACE,GACY,MACZ,GACY,KAEZ,OAEF,IAAM,EAAQC,EAAAA,YAAY,EAAQ,CAC5B,EAAQA,EAAAA,YAAY,EAAQ,CAG9B,SAAU,WAAa,IAAU,YAEjC,IAAU,EAAO,CACnB,EACE,CACE,sBAAA,EAAA,EAAA,aAAiC,EAAc,CAAC,4DAA4D,EAAK,KAAK,IAAI,CAAC,kBAAkB,EAAM,QAAQ,EAAM,iBAAiB,IACnL,CACD,CACE,MAAO,QACR,CACF,CAED,SAKE,GACJ,EACA,IACqB,CAErB,GAAI,GAA6C,KAC/C,OAAO,EAST,GALI,GAAmC,MAKnC,OAAO,GAAgB,UAAY,OAAO,GAAW,SACvD,OAAO,EAIT,GAAI,MAAM,QAAQ,EAAY,EAAI,MAAM,QAAQ,EAAO,CACrD,OAAO,EACL,EACA,EACD,CAIH,GAAI,OAAO,GAAgB,UAAY,OAAO,GAAW,SAAU,CACjE,IAAM,EAA2C,EAAE,CAC7C,EAAU,IAAI,IAAI,CACtB,GAAG,OAAO,KAAK,EAAsD,CACrE,GAAG,OAAO,KAAK,EAAiD,CACjE,CAAC,CAEF,IAAK,IAAM,KAAO,EAChB,EAAO,GAAO,EACX,EAAuD,GACvD,EAAkD,GACpD,CAGH,OAAO,EAIT,OAAO,GAIH,GACJ,EACA,IACuB,CAEvB,IAAM,EAAwB,EAAiB,MAC5C,GAAS,OAAO,GAAS,WAAY,EACvC,CACK,EAA0B,EAAY,MACzC,GAAS,OAAO,GAAS,WAAY,EACvC,CAGD,GAAI,GAAyB,EAC3B,OAAO,EAIT,IAAM,EAA6B,EAAE,CAC/B,EAAY,KAAK,IAAI,EAAiB,OAAQ,EAAY,OAAO,CAEvE,IAAK,IAAI,EAAI,EAAG,EAAI,EAAW,IAAK,CAClC,IAAM,EAAW,EAAiB,GAC5B,EAAa,EAAY,GAE3B,IAAa,IAAA,IAAa,IAAe,IAAA,KAClC,IAAa,IAAA,GAEtB,EAAO,KAAK,EAAW,CACd,IAAe,IAAA,GAExB,EAAO,KAAK,EAAS,CAInB,OAAO,GAAa,UACpB,OAAO,GAAe,UACtB,IAAa,MACb,IAAe,MAIb,QAAS,GACT,QAAS,IACR,EAAoC,IAClC,EAAsC,KAGzC,EAAO,KAAK,EAAY,EAAU,EAAW,CAAC,EAOhD,EAAO,KAAK,EAAS,EAK3B,OAAO,GAGI,EAAqB,GAA2C,CAC3E,IAAM,EAAW,MAAM,KACrB,IAAI,IACF,EAAa,OAAQ,GAAS,EAAK,QAAQ,CAAC,IAAK,GAAS,EAAK,QAAS,CACzE,CACF,CAEK,EAAmB,EAAa,IAAK,GAAS,EAAK,IAAI,CAG7D,GAAI,IAAI,IAAI,EAAiB,CAAC,OAAS,EACrC,MAAU,MAAM,0CAA0C,CAG5D,IAAI,EAAuC,EAAa,GAAG,QAE3D,IAAK,IAAI,EAAI,EAAG,EAAI,EAAa,OAAQ,IAAK,CAE5C,IAAM,EAAoBC,EAAAA,0BAA0B,EAAa,GAAG,CAGpE,EACE,EACA,EAAkB,QAClB,EAAkB,QAClB,EAAkB,IAClB,EAAE,CACH,CAED,EAAgB,EACd,EACA,EAAkB,QACnB,CASH,MANqC,CACnC,IAAK,EAAa,GAAG,IACrB,QAAS,EACT,WACD"}
|
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_transpiler_translation_translation = require('../transpiler/translation/translation.cjs');
|
|
3
|
-
const require_deepTransformPlugins_getLocalizedContent = require('../deepTransformPlugins/getLocalizedContent.cjs');
|
|
4
|
-
const require_dictionaryManipulator_orderDictionaries = require('./orderDictionaries.cjs');
|
|
5
|
-
|
|
6
|
-
//#region src/dictionaryManipulator/normalizeDictionary.ts
|
|
7
|
-
const normalizeDictionary = (dictionary, configuration) => {
|
|
8
|
-
const { locales } = configuration.internationalization;
|
|
9
|
-
const parsedDictionary = JSON.parse(JSON.stringify(dictionary));
|
|
10
|
-
if (dictionary.locale) return {
|
|
11
|
-
...dictionary,
|
|
12
|
-
locale: void 0,
|
|
13
|
-
content: require_transpiler_translation_translation.t({ [dictionary.locale]: dictionary.content })
|
|
14
|
-
};
|
|
15
|
-
const perLocaleContent = locales.reduce((acc, locale) => {
|
|
16
|
-
acc[locale] = require_deepTransformPlugins_getLocalizedContent.getPerLocaleDictionary(parsedDictionary, locale).content;
|
|
17
|
-
return acc;
|
|
18
|
-
}, {});
|
|
19
|
-
return {
|
|
20
|
-
...dictionary,
|
|
21
|
-
content: require_transpiler_translation_translation.t(perLocaleContent)
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
const normalizeDictionaries = (dictionaries, configuration) => {
|
|
25
|
-
return require_dictionaryManipulator_orderDictionaries.orderDictionaries(dictionaries, configuration).map((dictionary) => normalizeDictionary(dictionary, configuration));
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
exports.normalizeDictionaries = normalizeDictionaries;
|
|
30
|
-
exports.normalizeDictionary = normalizeDictionary;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../transpiler/translation/translation.cjs`),t=require(`../deepTransformPlugins/getLocalizedContent.cjs`),n=require(`./orderDictionaries.cjs`),r=(n,r)=>{let{locales:i}=r.internationalization,a=JSON.parse(JSON.stringify(n));if(n.locale)return{...n,locale:void 0,content:e.t({[n.locale]:n.content})};let o=i.reduce((e,n)=>(e[n]=t.getPerLocaleDictionary(a,n).content,e),{});return{...n,content:e.t(o)}},i=(e,t)=>n.orderDictionaries(e,t).map(e=>r(e,t));exports.normalizeDictionaries=i,exports.normalizeDictionary=r;
|
|
31
2
|
//# sourceMappingURL=normalizeDictionary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeDictionary.cjs","names":["t","getPerLocaleDictionary","orderDictionaries"],"sources":["../../../src/dictionaryManipulator/normalizeDictionary.ts"],"sourcesContent":["import type { Dictionary, IntlayerConfig, Locale } from '@intlayer/types';\nimport { getPerLocaleDictionary } from '../deepTransformPlugins';\nimport { t } from '../transpiler/translation';\nimport { orderDictionaries } from './orderDictionaries';\n\nexport const normalizeDictionary = (\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Dictionary => {\n const { locales } = configuration.internationalization;\n\n const parsedDictionary = JSON.parse(JSON.stringify(dictionary));\n\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n if (dictionary.locale) {\n return {\n ...dictionary,\n locale: undefined,\n content: t({\n [dictionary.locale]: dictionary.content,\n }),\n };\n }\n\n const perLocaleContent = locales.reduce(\n (acc, locale) => {\n const perLocaleDictionary = getPerLocaleDictionary(\n parsedDictionary,\n locale\n );\n\n acc[locale] = perLocaleDictionary.content;\n return acc;\n },\n {} as Record<Locale, Dictionary['content']>\n );\n\n return {\n ...dictionary,\n content: t(perLocaleContent),\n };\n};\n\nexport const normalizeDictionaries = (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Dictionary[] => {\n const orderedDictionaries = orderDictionaries(dictionaries, configuration);\n\n const structuredDictionaries = orderedDictionaries.map((dictionary) =>\n normalizeDictionary(dictionary, configuration)\n );\n\n return structuredDictionaries;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalizeDictionary.cjs","names":["t","getPerLocaleDictionary","orderDictionaries"],"sources":["../../../src/dictionaryManipulator/normalizeDictionary.ts"],"sourcesContent":["import type { Dictionary, IntlayerConfig, Locale } from '@intlayer/types';\nimport { getPerLocaleDictionary } from '../deepTransformPlugins';\nimport { t } from '../transpiler/translation';\nimport { orderDictionaries } from './orderDictionaries';\n\nexport const normalizeDictionary = (\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Dictionary => {\n const { locales } = configuration.internationalization;\n\n const parsedDictionary = JSON.parse(JSON.stringify(dictionary));\n\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n if (dictionary.locale) {\n return {\n ...dictionary,\n locale: undefined,\n content: t({\n [dictionary.locale]: dictionary.content,\n }),\n };\n }\n\n const perLocaleContent = locales.reduce(\n (acc, locale) => {\n const perLocaleDictionary = getPerLocaleDictionary(\n parsedDictionary,\n locale\n );\n\n acc[locale] = perLocaleDictionary.content;\n return acc;\n },\n {} as Record<Locale, Dictionary['content']>\n );\n\n return {\n ...dictionary,\n content: t(perLocaleContent),\n };\n};\n\nexport const normalizeDictionaries = (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Dictionary[] => {\n const orderedDictionaries = orderDictionaries(dictionaries, configuration);\n\n const structuredDictionaries = orderedDictionaries.map((dictionary) =>\n normalizeDictionary(dictionary, configuration)\n );\n\n return structuredDictionaries;\n};\n"],"mappings":"kOAKa,GACX,EACA,IACe,CACf,GAAM,CAAE,WAAY,EAAc,qBAE5B,EAAmB,KAAK,MAAM,KAAK,UAAU,EAAW,CAAC,CAG/D,GAAI,EAAW,OACb,MAAO,CACL,GAAG,EACH,OAAQ,IAAA,GACR,QAASA,EAAAA,EAAE,EACR,EAAW,QAAS,EAAW,QACjC,CAAC,CACH,CAGH,IAAM,EAAmB,EAAQ,QAC9B,EAAK,KAMJ,EAAI,GALwBC,EAAAA,uBAC1B,EACA,EACD,CAEiC,QAC3B,GAET,EAAE,CACH,CAED,MAAO,CACL,GAAG,EACH,QAASD,EAAAA,EAAE,EAAiB,CAC7B,EAGU,GACX,EACA,IAE4BE,EAAAA,kBAAkB,EAAc,EAAc,CAEvB,IAAK,GACtD,EAAoB,EAAY,EAAc,CAC/C"}
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
-
_intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
|
|
5
|
-
|
|
6
|
-
//#region src/dictionaryManipulator/orderDictionaries.ts
|
|
7
|
-
/**
|
|
8
|
-
* Orders dictionaries based on the dictionary priority strategy.
|
|
9
|
-
*
|
|
10
|
-
* @param dictionaries - Array of dictionaries to order
|
|
11
|
-
* @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')
|
|
12
|
-
* @returns Ordered array of dictionaries
|
|
13
|
-
*/
|
|
14
|
-
const orderDictionaries = (dictionaries, configuration = _intlayer_config_built.default) => {
|
|
15
|
-
const { editor } = configuration;
|
|
16
|
-
const { dictionaryPriorityStrategy } = editor;
|
|
17
|
-
if (dictionaries.length <= 1) return dictionaries;
|
|
18
|
-
const withIndex = dictionaries.map((dictionary, index) => ({
|
|
19
|
-
dictionary,
|
|
20
|
-
index
|
|
21
|
-
}));
|
|
22
|
-
const getPriority = (dictionary) => {
|
|
23
|
-
const p = dictionary.priority ?? 0;
|
|
24
|
-
return Number.isFinite(p) ? p : 0;
|
|
25
|
-
};
|
|
26
|
-
const getLocationWeight = (d) => {
|
|
27
|
-
const location = d.location;
|
|
28
|
-
if (location === void 0) return 2;
|
|
29
|
-
if (dictionaryPriorityStrategy === "distant_first") return location === "remote" ? 0 : 1;
|
|
30
|
-
return location === "local" ? 0 : 1;
|
|
31
|
-
};
|
|
32
|
-
withIndex.sort((a, b) => {
|
|
33
|
-
const aAuto = a.dictionary.filled ? 1 : 0;
|
|
34
|
-
const bAuto = b.dictionary.filled ? 1 : 0;
|
|
35
|
-
if (aAuto !== bAuto) return aAuto - bAuto;
|
|
36
|
-
const aP = getPriority(a.dictionary);
|
|
37
|
-
const bP = getPriority(b.dictionary);
|
|
38
|
-
if (aP !== bP) return bP - aP;
|
|
39
|
-
const aLocation = getLocationWeight(a.dictionary);
|
|
40
|
-
const bLocation = getLocationWeight(b.dictionary);
|
|
41
|
-
if (aLocation !== bLocation) return aLocation - bLocation;
|
|
42
|
-
return a.index - b.index;
|
|
43
|
-
});
|
|
44
|
-
return withIndex.map(({ dictionary }) => dictionary);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
exports.orderDictionaries = orderDictionaries;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@intlayer/config/built`);t=e.__toESM(t);const n=(e,n=t.default)=>{let{editor:r}=n,{dictionaryPriorityStrategy:i}=r;if(e.length<=1)return e;let a=e.map((e,t)=>({dictionary:e,index:t})),o=e=>{let t=e.priority??0;return Number.isFinite(t)?t:0},s=e=>{let t=e.location;return t===void 0?2:i===`distant_first`?t===`remote`?0:1:t===`local`?0:1};return a.sort((e,t)=>{let n=e.dictionary.filled?1:0,r=t.dictionary.filled?1:0;if(n!==r)return n-r;let i=o(e.dictionary),a=o(t.dictionary);if(i!==a)return a-i;let c=s(e.dictionary),l=s(t.dictionary);return c===l?e.index-t.index:c-l}),a.map(({dictionary:e})=>e)};exports.orderDictionaries=n;
|
|
49
2
|
//# sourceMappingURL=orderDictionaries.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orderDictionaries.cjs","names":["intlayerConfig"],"sources":["../../../src/dictionaryManipulator/orderDictionaries.ts"],"sourcesContent":["import intlayerConfig from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/types';\n\n/**\n * Orders dictionaries based on the dictionary priority strategy.\n *\n * @param dictionaries - Array of dictionaries to order\n * @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')\n * @returns Ordered array of dictionaries\n */\nexport const orderDictionaries = (\n dictionaries: Dictionary[],\n configuration = intlayerConfig\n): Dictionary[] => {\n const { editor } = configuration;\n const { dictionaryPriorityStrategy } = editor;\n\n if (dictionaries.length <= 1) {\n return dictionaries;\n }\n\n // Stabilize original indices to preserve relative order for complete ties\n const withIndex = dictionaries.map((dictionary, index) => ({\n dictionary,\n index,\n }));\n\n const getPriority = (dictionary: Dictionary): number => {\n const p = dictionary.priority ?? 0;\n\n return Number.isFinite(p) ? p : 0;\n };\n\n const getLocationWeight = (d: Dictionary): number => {\n const location = d.location;\n\n // undefined location should always be last\n if (location === undefined) {\n return 2;\n }\n\n if (dictionaryPriorityStrategy === 'distant_first') {\n // distant should come first\n return location === 'remote' ? 0 : 1;\n }\n // default: local_first\n return location === 'local' ? 0 : 1;\n };\n\n withIndex.sort((a, b) => {\n // 1) Non-autoFilled before autoFilled (autoFilled have lower precedence)\n const aAuto = a.dictionary.filled ? 1 : 0;\n const bAuto = b.dictionary.filled ? 1 : 0;\n if (aAuto !== bAuto) return aAuto - bAuto; // 0 before 1\n\n // 2) Higher priority first (larger number wins)\n const aP = getPriority(a.dictionary);\n const bP = getPriority(b.dictionary);\n if (aP !== bP) return bP - aP; // descending\n\n // 3) Location according to strategy\n const aLocation = getLocationWeight(a.dictionary);\n const bLocation = getLocationWeight(b.dictionary);\n if (aLocation !== bLocation) return aLocation - bLocation;\n\n // 4) Stable fallback by original index\n return a.index - b.index;\n });\n\n return withIndex.map(({ dictionary }) => dictionary);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"orderDictionaries.cjs","names":["intlayerConfig"],"sources":["../../../src/dictionaryManipulator/orderDictionaries.ts"],"sourcesContent":["import intlayerConfig from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/types';\n\n/**\n * Orders dictionaries based on the dictionary priority strategy.\n *\n * @param dictionaries - Array of dictionaries to order\n * @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')\n * @returns Ordered array of dictionaries\n */\nexport const orderDictionaries = (\n dictionaries: Dictionary[],\n configuration = intlayerConfig\n): Dictionary[] => {\n const { editor } = configuration;\n const { dictionaryPriorityStrategy } = editor;\n\n if (dictionaries.length <= 1) {\n return dictionaries;\n }\n\n // Stabilize original indices to preserve relative order for complete ties\n const withIndex = dictionaries.map((dictionary, index) => ({\n dictionary,\n index,\n }));\n\n const getPriority = (dictionary: Dictionary): number => {\n const p = dictionary.priority ?? 0;\n\n return Number.isFinite(p) ? p : 0;\n };\n\n const getLocationWeight = (d: Dictionary): number => {\n const location = d.location;\n\n // undefined location should always be last\n if (location === undefined) {\n return 2;\n }\n\n if (dictionaryPriorityStrategy === 'distant_first') {\n // distant should come first\n return location === 'remote' ? 0 : 1;\n }\n // default: local_first\n return location === 'local' ? 0 : 1;\n };\n\n withIndex.sort((a, b) => {\n // 1) Non-autoFilled before autoFilled (autoFilled have lower precedence)\n const aAuto = a.dictionary.filled ? 1 : 0;\n const bAuto = b.dictionary.filled ? 1 : 0;\n if (aAuto !== bAuto) return aAuto - bAuto; // 0 before 1\n\n // 2) Higher priority first (larger number wins)\n const aP = getPriority(a.dictionary);\n const bP = getPriority(b.dictionary);\n if (aP !== bP) return bP - aP; // descending\n\n // 3) Location according to strategy\n const aLocation = getLocationWeight(a.dictionary);\n const bLocation = getLocationWeight(b.dictionary);\n if (aLocation !== bLocation) return aLocation - bLocation;\n\n // 4) Stable fallback by original index\n return a.index - b.index;\n });\n\n return withIndex.map(({ dictionary }) => dictionary);\n};\n"],"mappings":"+KAUA,MAAa,GACX,EACA,EAAgBA,EAAAA,UACC,CACjB,GAAM,CAAE,UAAW,EACb,CAAE,8BAA+B,EAEvC,GAAI,EAAa,QAAU,EACzB,OAAO,EAIT,IAAM,EAAY,EAAa,KAAK,EAAY,KAAW,CACzD,aACA,QACD,EAAE,CAEG,EAAe,GAAmC,CACtD,IAAM,EAAI,EAAW,UAAY,EAEjC,OAAO,OAAO,SAAS,EAAE,CAAG,EAAI,GAG5B,EAAqB,GAA0B,CACnD,IAAM,EAAW,EAAE,SAYnB,OATI,IAAa,IAAA,GACR,EAGL,IAA+B,gBAE1B,IAAa,SAAW,EAAI,EAG9B,IAAa,QAAU,EAAI,GAuBpC,OApBA,EAAU,MAAM,EAAG,IAAM,CAEvB,IAAM,EAAQ,EAAE,WAAW,OAAS,EAAI,EAClC,EAAQ,EAAE,WAAW,OAAS,EAAI,EACxC,GAAI,IAAU,EAAO,OAAO,EAAQ,EAGpC,IAAM,EAAK,EAAY,EAAE,WAAW,CAC9B,EAAK,EAAY,EAAE,WAAW,CACpC,GAAI,IAAO,EAAI,OAAO,EAAK,EAG3B,IAAM,EAAY,EAAkB,EAAE,WAAW,CAC3C,EAAY,EAAkB,EAAE,WAAW,CAIjD,OAHI,IAAc,EAGX,EAAE,MAAQ,EAAE,MAHiB,EAAY,GAIhD,CAEK,EAAU,KAAK,CAAE,gBAAiB,EAAW"}
|
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _intlayer_types = require("@intlayer/types");
|
|
4
|
-
|
|
5
|
-
//#region src/dictionaryManipulator/removeContentNodeByKeyPath.ts
|
|
6
|
-
const removeContentNodeByKeyPath = (dictionaryContent, keyPath) => {
|
|
7
|
-
let currentValue = dictionaryContent;
|
|
8
|
-
let parentValue = null;
|
|
9
|
-
let lastKey = null;
|
|
10
|
-
for (const keyObj of keyPath) {
|
|
11
|
-
parentValue = currentValue;
|
|
12
|
-
if (keyObj.type === _intlayer_types.NodeType.Object || keyObj.type === _intlayer_types.NodeType.Array) {
|
|
13
|
-
lastKey = keyObj.key;
|
|
14
|
-
currentValue = currentValue[keyObj.key];
|
|
15
|
-
}
|
|
16
|
-
if (keyObj.type === _intlayer_types.NodeType.Translation || keyObj.type === _intlayer_types.NodeType.Enumeration || keyObj.type === _intlayer_types.NodeType.Condition) {
|
|
17
|
-
lastKey = keyObj.type;
|
|
18
|
-
currentValue = currentValue[keyObj.type][keyObj.key];
|
|
19
|
-
}
|
|
20
|
-
if (keyObj.type === _intlayer_types.NodeType.Markdown || keyObj.type === _intlayer_types.NodeType.ReactNode || keyObj.type === _intlayer_types.NodeType.HTML || keyObj.type === _intlayer_types.NodeType.Insertion || keyObj.type === _intlayer_types.NodeType.File) {
|
|
21
|
-
lastKey = keyObj.type;
|
|
22
|
-
currentValue = currentValue[keyObj.type];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (parentValue && lastKey !== null) if (Array.isArray(parentValue)) parentValue.splice(lastKey, 1);
|
|
26
|
-
else delete parentValue[lastKey];
|
|
27
|
-
return dictionaryContent;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
exports.removeContentNodeByKeyPath = removeContentNodeByKeyPath;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/types`);const t=(t,n)=>{let r=t,i=null,a=null;for(let t of n)i=r,(t.type===e.NodeType.Object||t.type===e.NodeType.Array)&&(a=t.key,r=r[t.key]),(t.type===e.NodeType.Translation||t.type===e.NodeType.Enumeration||t.type===e.NodeType.Condition)&&(a=t.type,r=r[t.type][t.key]),(t.type===e.NodeType.Markdown||t.type===e.NodeType.ReactNode||t.type===e.NodeType.HTML||t.type===e.NodeType.Insertion||t.type===e.NodeType.File)&&(a=t.type,r=r[t.type]);return i&&a!==null&&(Array.isArray(i)?i.splice(a,1):delete i[a]),t};exports.removeContentNodeByKeyPath=t;
|
|
32
2
|
//# sourceMappingURL=removeContentNodeByKeyPath.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeContentNodeByKeyPath.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/removeContentNodeByKeyPath.ts"],"sourcesContent":["import { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\n\nexport const removeContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[]\n): ContentNode => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKey: string | number | null = null;\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n lastKey = keyObj.key;\n currentValue = currentValue[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Enumeration ||\n keyObj.type === NodeType.Condition\n ) {\n lastKey = keyObj.type;\n currentValue = currentValue[keyObj.type][keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.ReactNode ||\n keyObj.type === NodeType.HTML ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n lastKey = keyObj.type;\n currentValue = currentValue[keyObj.type];\n }\n }\n\n if (parentValue && lastKey !== null) {\n if (Array.isArray(parentValue)) {\n parentValue.splice(lastKey as unknown as number, 1);\n } else {\n delete parentValue[lastKey];\n }\n }\n\n return dictionaryContent;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"removeContentNodeByKeyPath.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/removeContentNodeByKeyPath.ts"],"sourcesContent":["import { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\n\nexport const removeContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[]\n): ContentNode => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKey: string | number | null = null;\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n lastKey = keyObj.key;\n currentValue = currentValue[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Enumeration ||\n keyObj.type === NodeType.Condition\n ) {\n lastKey = keyObj.type;\n currentValue = currentValue[keyObj.type][keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.ReactNode ||\n keyObj.type === NodeType.HTML ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n lastKey = keyObj.type;\n currentValue = currentValue[keyObj.type];\n }\n }\n\n if (parentValue && lastKey !== null) {\n if (Array.isArray(parentValue)) {\n parentValue.splice(lastKey as unknown as number, 1);\n } else {\n delete parentValue[lastKey];\n }\n }\n\n return dictionaryContent;\n};\n"],"mappings":"iJAEA,MAAa,GACX,EACA,IACgB,CAChB,IAAI,EAAoB,EACpB,EAAmB,KACnB,EAAkC,KAEtC,IAAK,IAAM,KAAU,EACnB,EAAc,GAEV,EAAO,OAASA,EAAAA,SAAS,QAAU,EAAO,OAASA,EAAAA,SAAS,SAC9D,EAAU,EAAO,IACjB,EAAe,EAAa,EAAO,OAInC,EAAO,OAASA,EAAAA,SAAS,aACzB,EAAO,OAASA,EAAAA,SAAS,aACzB,EAAO,OAASA,EAAAA,SAAS,aAEzB,EAAU,EAAO,KACjB,EAAe,EAAa,EAAO,MAAM,EAAO,OAIhD,EAAO,OAASA,EAAAA,SAAS,UACzB,EAAO,OAASA,EAAAA,SAAS,WACzB,EAAO,OAASA,EAAAA,SAAS,MACzB,EAAO,OAASA,EAAAA,SAAS,WACzB,EAAO,OAASA,EAAAA,SAAS,QAEzB,EAAU,EAAO,KACjB,EAAe,EAAa,EAAO,OAYvC,OARI,GAAe,IAAY,OACzB,MAAM,QAAQ,EAAY,CAC5B,EAAY,OAAO,EAA8B,EAAE,CAEnD,OAAO,EAAY,IAIhB"}
|
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _intlayer_types = require("@intlayer/types");
|
|
4
|
-
|
|
5
|
-
//#region src/dictionaryManipulator/renameContentNodeByKeyPath.ts
|
|
6
|
-
const renameContentNodeByKeyPath = (dictionaryContent, newKey, keyPath) => {
|
|
7
|
-
let currentValue = dictionaryContent;
|
|
8
|
-
let parentValue = null;
|
|
9
|
-
let lastKey = null;
|
|
10
|
-
for (const keyObj of keyPath) {
|
|
11
|
-
parentValue = currentValue;
|
|
12
|
-
if (keyObj.type === _intlayer_types.NodeType.Object || keyObj.type === _intlayer_types.NodeType.Array) {
|
|
13
|
-
lastKey = keyObj.key;
|
|
14
|
-
currentValue = currentValue[keyObj.key];
|
|
15
|
-
}
|
|
16
|
-
if (keyObj.type === _intlayer_types.NodeType.Translation || keyObj.type === _intlayer_types.NodeType.Enumeration || keyObj.type === _intlayer_types.NodeType.Condition) {
|
|
17
|
-
lastKey = keyObj.type;
|
|
18
|
-
currentValue = currentValue[keyObj.type][keyObj.key];
|
|
19
|
-
}
|
|
20
|
-
if (keyObj.type === _intlayer_types.NodeType.Markdown || keyObj.type === _intlayer_types.NodeType.ReactNode || keyObj.type === _intlayer_types.NodeType.HTML || keyObj.type === _intlayer_types.NodeType.Insertion || keyObj.type === _intlayer_types.NodeType.File) {
|
|
21
|
-
lastKey = keyObj.type;
|
|
22
|
-
currentValue = currentValue[keyObj.type];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (parentValue && lastKey !== null) if (Array.isArray(parentValue)) parentValue[lastKey] = currentValue;
|
|
26
|
-
else {
|
|
27
|
-
const newParentValue = {};
|
|
28
|
-
for (const key of Object.keys(parentValue)) if (key === lastKey && typeof newKey !== "undefined") newParentValue[newKey] = currentValue;
|
|
29
|
-
else newParentValue[key] = parentValue[key];
|
|
30
|
-
Object.keys(parentValue).forEach((key) => {
|
|
31
|
-
delete parentValue[key];
|
|
32
|
-
});
|
|
33
|
-
Object.assign(parentValue, newParentValue);
|
|
34
|
-
}
|
|
35
|
-
return dictionaryContent;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
exports.renameContentNodeByKeyPath = renameContentNodeByKeyPath;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/types`);const t=(t,n,r)=>{let i=t,a=null,o=null;for(let t of r)a=i,(t.type===e.NodeType.Object||t.type===e.NodeType.Array)&&(o=t.key,i=i[t.key]),(t.type===e.NodeType.Translation||t.type===e.NodeType.Enumeration||t.type===e.NodeType.Condition)&&(o=t.type,i=i[t.type][t.key]),(t.type===e.NodeType.Markdown||t.type===e.NodeType.ReactNode||t.type===e.NodeType.HTML||t.type===e.NodeType.Insertion||t.type===e.NodeType.File)&&(o=t.type,i=i[t.type]);if(a&&o!==null)if(Array.isArray(a))a[o]=i;else{let e={};for(let t of Object.keys(a))t===o&&n!==void 0?e[n]=i:e[t]=a[t];Object.keys(a).forEach(e=>{delete a[e]}),Object.assign(a,e)}return t};exports.renameContentNodeByKeyPath=t;
|
|
40
2
|
//# sourceMappingURL=renameContentNodeByKeyPath.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renameContentNodeByKeyPath.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/renameContentNodeByKeyPath.ts"],"sourcesContent":["import { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\n\nexport const renameContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n newKey: KeyPath['key'],\n keyPath: KeyPath[]\n): ContentNode => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKey: string | number | null = null;\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n lastKey = keyObj.key;\n currentValue = currentValue[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Enumeration ||\n keyObj.type === NodeType.Condition\n ) {\n lastKey = keyObj.type;\n currentValue = currentValue[keyObj.type][keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.ReactNode ||\n keyObj.type === NodeType.HTML ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n lastKey = keyObj.type;\n currentValue = currentValue[keyObj.type];\n }\n }\n\n // Assign the new value to the last key of the parent while preserving the order\n if (parentValue && lastKey !== null) {\n if (Array.isArray(parentValue)) {\n parentValue[lastKey as number] = currentValue;\n } else {\n const newParentValue: any = {};\n for (const key of Object.keys(parentValue)) {\n if (key === lastKey && typeof newKey !== 'undefined') {\n newParentValue[newKey] = currentValue;\n } else {\n newParentValue[key] = parentValue[key];\n }\n }\n // Replace the contents of parentValue with newParentValue\n Object.keys(parentValue).forEach((key) => {\n delete parentValue[key];\n });\n Object.assign(parentValue, newParentValue);\n }\n }\n\n return dictionaryContent;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"renameContentNodeByKeyPath.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/renameContentNodeByKeyPath.ts"],"sourcesContent":["import { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\n\nexport const renameContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n newKey: KeyPath['key'],\n keyPath: KeyPath[]\n): ContentNode => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKey: string | number | null = null;\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n lastKey = keyObj.key;\n currentValue = currentValue[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Enumeration ||\n keyObj.type === NodeType.Condition\n ) {\n lastKey = keyObj.type;\n currentValue = currentValue[keyObj.type][keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.ReactNode ||\n keyObj.type === NodeType.HTML ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n lastKey = keyObj.type;\n currentValue = currentValue[keyObj.type];\n }\n }\n\n // Assign the new value to the last key of the parent while preserving the order\n if (parentValue && lastKey !== null) {\n if (Array.isArray(parentValue)) {\n parentValue[lastKey as number] = currentValue;\n } else {\n const newParentValue: any = {};\n for (const key of Object.keys(parentValue)) {\n if (key === lastKey && typeof newKey !== 'undefined') {\n newParentValue[newKey] = currentValue;\n } else {\n newParentValue[key] = parentValue[key];\n }\n }\n // Replace the contents of parentValue with newParentValue\n Object.keys(parentValue).forEach((key) => {\n delete parentValue[key];\n });\n Object.assign(parentValue, newParentValue);\n }\n }\n\n return dictionaryContent;\n};\n"],"mappings":"iJAEA,MAAa,GACX,EACA,EACA,IACgB,CAChB,IAAI,EAAoB,EACpB,EAAmB,KACnB,EAAkC,KAEtC,IAAK,IAAM,KAAU,EACnB,EAAc,GAEV,EAAO,OAASA,EAAAA,SAAS,QAAU,EAAO,OAASA,EAAAA,SAAS,SAC9D,EAAU,EAAO,IACjB,EAAe,EAAa,EAAO,OAInC,EAAO,OAASA,EAAAA,SAAS,aACzB,EAAO,OAASA,EAAAA,SAAS,aACzB,EAAO,OAASA,EAAAA,SAAS,aAEzB,EAAU,EAAO,KACjB,EAAe,EAAa,EAAO,MAAM,EAAO,OAIhD,EAAO,OAASA,EAAAA,SAAS,UACzB,EAAO,OAASA,EAAAA,SAAS,WACzB,EAAO,OAASA,EAAAA,SAAS,MACzB,EAAO,OAASA,EAAAA,SAAS,WACzB,EAAO,OAASA,EAAAA,SAAS,QAEzB,EAAU,EAAO,KACjB,EAAe,EAAa,EAAO,OAKvC,GAAI,GAAe,IAAY,KAC7B,GAAI,MAAM,QAAQ,EAAY,CAC5B,EAAY,GAAqB,MAC5B,CACL,IAAM,EAAsB,EAAE,CAC9B,IAAK,IAAM,KAAO,OAAO,KAAK,EAAY,CACpC,IAAQ,GAAkB,IAAW,OACvC,EAAe,GAAU,EAEzB,EAAe,GAAO,EAAY,GAItC,OAAO,KAAK,EAAY,CAAC,QAAS,GAAQ,CACxC,OAAO,EAAY,IACnB,CACF,OAAO,OAAO,EAAa,EAAe,CAI9C,OAAO"}
|
|
@@ -1,39 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _intlayer_types = require("@intlayer/types");
|
|
4
|
-
|
|
5
|
-
//#region src/dictionaryManipulator/updateNodeChildren.ts
|
|
6
|
-
const updateNodeChildren = (section, newChildren) => {
|
|
7
|
-
if (typeof section === "string") return newChildren;
|
|
8
|
-
if (typeof section === "number") return newChildren;
|
|
9
|
-
if (typeof section === "boolean") return newChildren;
|
|
10
|
-
if (typeof section?.nodeType === "string") {
|
|
11
|
-
const typedNode = section;
|
|
12
|
-
const content = typedNode[typedNode.nodeType];
|
|
13
|
-
if (typedNode.nodeType === _intlayer_types.NodeType.Translation || typedNode.nodeType === _intlayer_types.NodeType.Enumeration || typedNode.nodeType === _intlayer_types.NodeType.Condition) {
|
|
14
|
-
const newContent = Object.entries(content).reduce((acc, [key]) => {
|
|
15
|
-
acc[key] = newChildren;
|
|
16
|
-
return acc;
|
|
17
|
-
}, {});
|
|
18
|
-
return {
|
|
19
|
-
...typedNode,
|
|
20
|
-
[typedNode.nodeType]: newContent
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
if (typedNode.nodeType === _intlayer_types.NodeType.Nested) return typedNode;
|
|
24
|
-
return {
|
|
25
|
-
...typedNode,
|
|
26
|
-
[typedNode.nodeType]: newChildren
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
if (!section || typeof section !== "object") return newChildren;
|
|
30
|
-
if (Array.isArray(section)) return section.map(() => newChildren);
|
|
31
|
-
return Object.entries(section).reduce((acc, [key]) => ({
|
|
32
|
-
...acc,
|
|
33
|
-
[key]: newChildren
|
|
34
|
-
}), {});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
exports.updateNodeChildren = updateNodeChildren;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/types`);const t=(t,n)=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return n;if(typeof t?.nodeType==`string`){let r=t,i=r[r.nodeType];if(r.nodeType===e.NodeType.Translation||r.nodeType===e.NodeType.Enumeration||r.nodeType===e.NodeType.Condition){let e=Object.entries(i).reduce((e,[t])=>(e[t]=n,e),{});return{...r,[r.nodeType]:e}}return r.nodeType===e.NodeType.Nested?r:{...r,[r.nodeType]:n}}return!t||typeof t!=`object`?n:Array.isArray(t)?t.map(()=>n):Object.entries(t).reduce((e,[t])=>({...e,[t]:n}),{})};exports.updateNodeChildren=t;
|
|
39
2
|
//# sourceMappingURL=updateNodeChildren.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateNodeChildren.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/updateNodeChildren.ts"],"sourcesContent":["import { type ContentNode, NodeType, type TypedNode } from '@intlayer/types';\n\nexport const updateNodeChildren = <\n T extends ContentNode,\n U extends ContentNode,\n>(\n section: T,\n newChildren: U\n): ContentNode => {\n if (typeof section === 'string') {\n return newChildren;\n }\n if (typeof section === 'number') {\n return newChildren;\n }\n if (typeof section === 'boolean') {\n return newChildren;\n }\n if (typeof (section as TypedNode)?.nodeType === 'string') {\n const typedNode = section as TypedNode;\n const content =\n typedNode[typedNode.nodeType as unknown as keyof typeof typedNode];\n\n if (\n typedNode.nodeType === NodeType.Translation ||\n typedNode.nodeType === NodeType.Enumeration ||\n typedNode.nodeType === NodeType.Condition\n ) {\n const newContent = Object.entries(content).reduce(\n (acc, [key]) => {\n acc[key] = newChildren;\n return acc;\n },\n {} as Record<string, ContentNode>\n );\n\n return {\n ...typedNode,\n [typedNode.nodeType]: newContent,\n };\n }\n\n if (typedNode.nodeType === NodeType.Nested) {\n return typedNode;\n }\n\n return {\n ...typedNode,\n [typedNode.nodeType]: newChildren,\n };\n }\n\n if (!section || typeof section !== 'object') {\n return newChildren;\n }\n\n if (Array.isArray(section)) {\n return section.map(() => newChildren) as unknown as ContentNode;\n }\n\n return Object.entries(\n section as unknown as Record<string, ContentNode>\n ).reduce(\n (acc, [key]) => ({\n ...acc,\n [key]: newChildren,\n }),\n {} as Record<string, ContentNode>\n ) as unknown as ContentNode;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateNodeChildren.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/updateNodeChildren.ts"],"sourcesContent":["import { type ContentNode, NodeType, type TypedNode } from '@intlayer/types';\n\nexport const updateNodeChildren = <\n T extends ContentNode,\n U extends ContentNode,\n>(\n section: T,\n newChildren: U\n): ContentNode => {\n if (typeof section === 'string') {\n return newChildren;\n }\n if (typeof section === 'number') {\n return newChildren;\n }\n if (typeof section === 'boolean') {\n return newChildren;\n }\n if (typeof (section as TypedNode)?.nodeType === 'string') {\n const typedNode = section as TypedNode;\n const content =\n typedNode[typedNode.nodeType as unknown as keyof typeof typedNode];\n\n if (\n typedNode.nodeType === NodeType.Translation ||\n typedNode.nodeType === NodeType.Enumeration ||\n typedNode.nodeType === NodeType.Condition\n ) {\n const newContent = Object.entries(content).reduce(\n (acc, [key]) => {\n acc[key] = newChildren;\n return acc;\n },\n {} as Record<string, ContentNode>\n );\n\n return {\n ...typedNode,\n [typedNode.nodeType]: newContent,\n };\n }\n\n if (typedNode.nodeType === NodeType.Nested) {\n return typedNode;\n }\n\n return {\n ...typedNode,\n [typedNode.nodeType]: newChildren,\n };\n }\n\n if (!section || typeof section !== 'object') {\n return newChildren;\n }\n\n if (Array.isArray(section)) {\n return section.map(() => newChildren) as unknown as ContentNode;\n }\n\n return Object.entries(\n section as unknown as Record<string, ContentNode>\n ).reduce(\n (acc, [key]) => ({\n ...acc,\n [key]: newChildren,\n }),\n {} as Record<string, ContentNode>\n ) as unknown as ContentNode;\n};\n"],"mappings":"iJAEA,MAAa,GAIX,EACA,IACgB,CAOhB,GANI,OAAO,GAAY,UAGnB,OAAO,GAAY,UAGnB,OAAO,GAAY,UACrB,OAAO,EAET,GAAI,OAAQ,GAAuB,UAAa,SAAU,CACxD,IAAM,EAAY,EACZ,EACJ,EAAU,EAAU,UAEtB,GACE,EAAU,WAAaA,EAAAA,SAAS,aAChC,EAAU,WAAaA,EAAAA,SAAS,aAChC,EAAU,WAAaA,EAAAA,SAAS,UAChC,CACA,IAAM,EAAa,OAAO,QAAQ,EAAQ,CAAC,QACxC,EAAK,CAAC,MACL,EAAI,GAAO,EACJ,GAET,EAAE,CACH,CAED,MAAO,CACL,GAAG,GACF,EAAU,UAAW,EACvB,CAOH,OAJI,EAAU,WAAaA,EAAAA,SAAS,OAC3B,EAGF,CACL,GAAG,GACF,EAAU,UAAW,EACvB,CAWH,MARI,CAAC,GAAW,OAAO,GAAY,SAC1B,EAGL,MAAM,QAAQ,EAAQ,CACjB,EAAQ,QAAU,EAAY,CAGhC,OAAO,QACZ,EACD,CAAC,QACC,EAAK,CAAC,MAAU,CACf,GAAG,GACF,GAAM,EACR,EACD,EAAE,CACH"}
|
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_utils_intl = require('../utils/intl.cjs');
|
|
4
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
|
-
_intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
|
|
6
|
-
|
|
7
|
-
//#region src/formatters/compact.ts
|
|
8
|
-
/**
|
|
9
|
-
* Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)
|
|
10
|
-
* based on locale and formatting options.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* compact({ value: 1200 }); // "1.2K"
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* compact({ value: "1000000", locale: Locales.FRENCH, compactDisplay: "long" });
|
|
17
|
-
* // "1 million"
|
|
18
|
-
*/
|
|
19
|
-
const compact = (value, options) => new require_utils_intl.CachedIntl.NumberFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, {
|
|
20
|
-
...options,
|
|
21
|
-
notation: "compact"
|
|
22
|
-
}).format(Number(value));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
exports.compact = compact;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../utils/intl.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r=(e,r)=>new t.CachedIntl.NumberFormat(r?.locale??n.default?.internationalization?.defaultLocale,{...r,notation:`compact`}).format(Number(e));exports.compact=r;
|
|
26
2
|
//# sourceMappingURL=compact.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/compact.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)\n * based on locale and formatting options.\n *\n * @example\n * compact({ value: 1200 }); // \"1.2K\"\n *\n * @example\n * compact({ value: \"1000000\", locale: Locales.FRENCH, compactDisplay: \"long\" });\n * // \"1 million\"\n */\nexport const compact = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n ...options,\n notation: 'compact',\n }\n ).format(Number(value));\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"compact.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/compact.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)\n * based on locale and formatting options.\n *\n * @example\n * compact({ value: 1200 }); // \"1.2K\"\n *\n * @example\n * compact({ value: \"1000000\", locale: Locales.FRENCH, compactDisplay: \"long\" });\n * // \"1 million\"\n */\nexport const compact = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n ...options,\n notation: 'compact',\n }\n ).format(Number(value));\n"],"mappings":"8MAeA,MAAa,GACX,EACA,IAEA,IAAIA,EAAAA,WAAW,aACb,GAAS,QAAUC,EAAAA,SAAe,sBAAsB,cACxD,CACE,GAAG,EACH,SAAU,UACX,CACF,CAAC,OAAO,OAAO,EAAM,CAAC"}
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_utils_intl = require('../utils/intl.cjs');
|
|
4
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
|
-
_intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
|
|
6
|
-
|
|
7
|
-
//#region src/formatters/currency.ts
|
|
8
|
-
/**
|
|
9
|
-
* Formats a numeric or string value into a localized currency string using the Intl API.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* currency({ value: 1234.5, currency: 'EUR' });
|
|
13
|
-
* // "€1,234.50"
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* currency({ value: "5000", locale: Locales.FRENCH, currency: "CAD", currencyDisplay: "code" });
|
|
17
|
-
* // "5 000,00 CAD"
|
|
18
|
-
*/
|
|
19
|
-
const currency = (value, options) => new require_utils_intl.CachedIntl.NumberFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, {
|
|
20
|
-
style: "currency",
|
|
21
|
-
currency: options?.currency ?? "USD",
|
|
22
|
-
currencyDisplay: options?.currencyDisplay ?? "symbol",
|
|
23
|
-
minimumFractionDigits: options?.minimumFractionDigits ?? 2,
|
|
24
|
-
maximumFractionDigits: options?.maximumFractionDigits ?? 2,
|
|
25
|
-
...options
|
|
26
|
-
}).format(Number(value));
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
exports.currency = currency;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../utils/intl.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r=(e,r)=>new t.CachedIntl.NumberFormat(r?.locale??n.default?.internationalization?.defaultLocale,{style:`currency`,currency:r?.currency??`USD`,currencyDisplay:r?.currencyDisplay??`symbol`,minimumFractionDigits:r?.minimumFractionDigits??2,maximumFractionDigits:r?.maximumFractionDigits??2,...r}).format(Number(e));exports.currency=r;
|
|
30
2
|
//# sourceMappingURL=currency.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/currency.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric or string value into a localized currency string using the Intl API.\n *\n * @example\n * currency({ value: 1234.5, currency: 'EUR' });\n * // \"€1,234.50\"\n *\n * @example\n * currency({ value: \"5000\", locale: Locales.FRENCH, currency: \"CAD\", currencyDisplay: \"code\" });\n * // \"5 000,00 CAD\"\n */\nexport const currency = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n style: 'currency',\n currency: options?.currency ?? 'USD',\n currencyDisplay: options?.currencyDisplay ?? 'symbol',\n minimumFractionDigits: options?.minimumFractionDigits ?? 2,\n maximumFractionDigits: options?.maximumFractionDigits ?? 2,\n ...options,\n }\n ).format(Number(value));\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"currency.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/currency.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric or string value into a localized currency string using the Intl API.\n *\n * @example\n * currency({ value: 1234.5, currency: 'EUR' });\n * // \"€1,234.50\"\n *\n * @example\n * currency({ value: \"5000\", locale: Locales.FRENCH, currency: \"CAD\", currencyDisplay: \"code\" });\n * // \"5 000,00 CAD\"\n */\nexport const currency = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n {\n style: 'currency',\n currency: options?.currency ?? 'USD',\n currencyDisplay: options?.currencyDisplay ?? 'symbol',\n minimumFractionDigits: options?.minimumFractionDigits ?? 2,\n maximumFractionDigits: options?.maximumFractionDigits ?? 2,\n ...options,\n }\n ).format(Number(value));\n"],"mappings":"8MAeA,MAAa,GACX,EACA,IAEA,IAAIA,EAAAA,WAAW,aACb,GAAS,QAAUC,EAAAA,SAAe,sBAAsB,cACxD,CACE,MAAO,WACP,SAAU,GAAS,UAAY,MAC/B,gBAAiB,GAAS,iBAAmB,SAC7C,sBAAuB,GAAS,uBAAyB,EACzD,sBAAuB,GAAS,uBAAyB,EACzD,GAAG,EACJ,CACF,CAAC,OAAO,OAAO,EAAM,CAAC"}
|
|
@@ -1,61 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_utils_intl = require('../utils/intl.cjs');
|
|
4
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
|
-
_intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
|
|
6
|
-
|
|
7
|
-
//#region src/formatters/date.ts
|
|
8
|
-
const presets = {
|
|
9
|
-
short: {
|
|
10
|
-
year: "2-digit",
|
|
11
|
-
month: "2-digit",
|
|
12
|
-
day: "2-digit",
|
|
13
|
-
hour: "2-digit",
|
|
14
|
-
minute: "2-digit"
|
|
15
|
-
},
|
|
16
|
-
long: {
|
|
17
|
-
year: "numeric",
|
|
18
|
-
month: "long",
|
|
19
|
-
day: "numeric",
|
|
20
|
-
hour: "numeric",
|
|
21
|
-
minute: "numeric"
|
|
22
|
-
},
|
|
23
|
-
full: {
|
|
24
|
-
year: "numeric",
|
|
25
|
-
month: "long",
|
|
26
|
-
day: "numeric",
|
|
27
|
-
hour: "numeric",
|
|
28
|
-
minute: "numeric",
|
|
29
|
-
hour12: false
|
|
30
|
-
},
|
|
31
|
-
dateOnly: {
|
|
32
|
-
year: "numeric",
|
|
33
|
-
month: "short",
|
|
34
|
-
day: "numeric"
|
|
35
|
-
},
|
|
36
|
-
timeOnly: {
|
|
37
|
-
hour: "numeric",
|
|
38
|
-
minute: "numeric",
|
|
39
|
-
second: "numeric"
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Formats a date/time value into a localized string using Intl.DateTimeFormat.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* date({ date: new Date(), options: "short" });
|
|
47
|
-
* // "08/02/25, 14:30"
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* date({ date: "2025-08-02T14:30:00Z", locale: Locales.FRENCH, options: { month: "long", day: "numeric" } });
|
|
51
|
-
* // "2 août"
|
|
52
|
-
*/
|
|
53
|
-
const date = (date, options) => {
|
|
54
|
-
const dateTime = new Date(date);
|
|
55
|
-
const resolvedOptions = typeof options === "string" ? presets[options] ?? {} : options;
|
|
56
|
-
return new require_utils_intl.CachedIntl.DateTimeFormat(options?.locale ?? _intlayer_config_built.default?.internationalization?.defaultLocale, resolvedOptions).format(dateTime);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
//#endregion
|
|
60
|
-
exports.date = date;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../utils/intl.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r={short:{year:`2-digit`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`},long:{year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`numeric`},full:{year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`numeric`,hour12:!1},dateOnly:{year:`numeric`,month:`short`,day:`numeric`},timeOnly:{hour:`numeric`,minute:`numeric`,second:`numeric`}},i=(e,i)=>{let a=new Date(e),o=typeof i==`string`?r[i]??{}:i;return new t.CachedIntl.DateTimeFormat(i?.locale??n.default?.internationalization?.defaultLocale,o).format(a)};exports.date=i;
|
|
61
2
|
//# sourceMappingURL=date.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/date.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype DateTimePreset = 'short' | 'long' | 'dateOnly' | 'timeOnly' | 'full';\n\nconst presets: Record<DateTimePreset, Intl.DateTimeFormatOptions> = {\n short: {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n full: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n },\n dateOnly: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n timeOnly: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n};\n\n/**\n * Formats a date/time value into a localized string using Intl.DateTimeFormat.\n *\n * @example\n * date({ date: new Date(), options: \"short\" });\n * // \"08/02/25, 14:30\"\n *\n * @example\n * date({ date: \"2025-08-02T14:30:00Z\", locale: Locales.FRENCH, options: { month: \"long\", day: \"numeric\" } });\n * // \"2 août\"\n */\nexport const date = (\n date: Date | string | number,\n options?: Intl.DateTimeFormatOptions & { locale?: LocalesValues }\n): string => {\n const dateTime = new Date(date);\n\n const resolvedOptions =\n typeof options === 'string' ? (presets[options] ?? {}) : options;\n\n const formatter = new CachedIntl.DateTimeFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n resolvedOptions\n );\n\n return formatter.format(dateTime);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"date.cjs","names":["CachedIntl","configuration"],"sources":["../../../src/formatters/date.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype DateTimePreset = 'short' | 'long' | 'dateOnly' | 'timeOnly' | 'full';\n\nconst presets: Record<DateTimePreset, Intl.DateTimeFormatOptions> = {\n short: {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n full: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n },\n dateOnly: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n timeOnly: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n};\n\n/**\n * Formats a date/time value into a localized string using Intl.DateTimeFormat.\n *\n * @example\n * date({ date: new Date(), options: \"short\" });\n * // \"08/02/25, 14:30\"\n *\n * @example\n * date({ date: \"2025-08-02T14:30:00Z\", locale: Locales.FRENCH, options: { month: \"long\", day: \"numeric\" } });\n * // \"2 août\"\n */\nexport const date = (\n date: Date | string | number,\n options?: Intl.DateTimeFormatOptions & { locale?: LocalesValues }\n): string => {\n const dateTime = new Date(date);\n\n const resolvedOptions =\n typeof options === 'string' ? (presets[options] ?? {}) : options;\n\n const formatter = new CachedIntl.DateTimeFormat(\n options?.locale ?? configuration?.internationalization?.defaultLocale,\n resolvedOptions\n );\n\n return formatter.format(dateTime);\n};\n"],"mappings":"8MAMA,MAAM,EAA8D,CAClE,MAAO,CACL,KAAM,UACN,MAAO,UACP,IAAK,UACL,KAAM,UACN,OAAQ,UACT,CACD,KAAM,CACJ,KAAM,UACN,MAAO,OACP,IAAK,UACL,KAAM,UACN,OAAQ,UACT,CACD,KAAM,CACJ,KAAM,UACN,MAAO,OACP,IAAK,UACL,KAAM,UACN,OAAQ,UACR,OAAQ,GACT,CACD,SAAU,CACR,KAAM,UACN,MAAO,QACP,IAAK,UACN,CACD,SAAU,CACR,KAAM,UACN,OAAQ,UACR,OAAQ,UACT,CACF,CAaY,GACX,EACA,IACW,CACX,IAAM,EAAW,IAAI,KAAK,EAAK,CAEzB,EACJ,OAAO,GAAY,SAAY,EAAQ,IAAY,EAAE,CAAI,EAO3D,OALkB,IAAIA,EAAAA,WAAW,eAC/B,GAAS,QAAUC,EAAAA,SAAe,sBAAsB,cACxD,EACD,CAEgB,OAAO,EAAS"}
|