@intlayer/core 9.4.3 → 9.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs.map +1 -1
- package/dist/cjs/formatters/list.cjs.map +1 -1
- package/dist/cjs/index.cjs +5 -8
- package/dist/cjs/interpreter/getPlural.cjs.map +1 -1
- package/dist/cjs/markdown/compiler.cjs +437 -209
- package/dist/cjs/markdown/compiler.cjs.map +1 -1
- package/dist/cjs/markdown/constants.cjs +32 -50
- package/dist/cjs/markdown/constants.cjs.map +1 -1
- package/dist/cjs/markdown/elementScanner.cjs +191 -0
- package/dist/cjs/markdown/elementScanner.cjs.map +1 -0
- package/dist/cjs/markdown/index.cjs +5 -8
- package/dist/cjs/markdown/parser.cjs +90 -48
- package/dist/cjs/markdown/parser.cjs.map +1 -1
- package/dist/cjs/markdown/renderer.cjs +14 -11
- package/dist/cjs/markdown/renderer.cjs.map +1 -1
- package/dist/cjs/markdown/utils.cjs +123 -34
- package/dist/cjs/markdown/utils.cjs.map +1 -1
- package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs.map +1 -1
- package/dist/esm/formatters/list.mjs.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/interpreter/getPlural.mjs.map +1 -1
- package/dist/esm/markdown/compiler.mjs +438 -211
- package/dist/esm/markdown/compiler.mjs.map +1 -1
- package/dist/esm/markdown/constants.mjs +29 -43
- package/dist/esm/markdown/constants.mjs.map +1 -1
- package/dist/esm/markdown/elementScanner.mjs +183 -0
- package/dist/esm/markdown/elementScanner.mjs.map +1 -0
- package/dist/esm/markdown/index.mjs +3 -3
- package/dist/esm/markdown/parser.mjs +90 -48
- package/dist/esm/markdown/parser.mjs.map +1 -1
- package/dist/esm/markdown/renderer.mjs +14 -11
- package/dist/esm/markdown/renderer.mjs.map +1 -1
- package/dist/esm/markdown/utils.mjs +124 -35
- package/dist/esm/markdown/utils.mjs.map +1 -1
- package/dist/types/deepTransformPlugins/getEditedContent.d.ts +2 -3
- package/dist/types/deepTransformPlugins/getEditedContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +3 -4
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +3 -4
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +2 -3
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getLocalizedContent.d.ts +2 -3
- package/dist/types/deepTransformPlugins/getLocalizedContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getMaskContent.d.ts +2 -3
- package/dist/types/deepTransformPlugins/getMaskContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts +3 -4
- package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getMultilingualDictionary.d.ts +1 -2
- package/dist/types/deepTransformPlugins/getMultilingualDictionary.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getReplacedValuesContent.d.ts +1 -2
- package/dist/types/deepTransformPlugins/getReplacedValuesContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getSplittedContent.d.ts +2 -3
- package/dist/types/deepTransformPlugins/getSplittedContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/insertContentInDictionary.d.ts +1 -2
- package/dist/types/deepTransformPlugins/insertContentInDictionary.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts +1 -2
- package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts +1 -2
- package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getDefaultNode.d.ts +1 -2
- package/dist/types/dictionaryManipulator/getDefaultNode.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getEmptyNode.d.ts +1 -2
- package/dist/types/dictionaryManipulator/getEmptyNode.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getNestedDictionaryReferences.d.ts +4 -5
- package/dist/types/dictionaryManipulator/getNestedDictionaryReferences.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getNodeChildren.d.ts +1 -2
- package/dist/types/dictionaryManipulator/getNodeChildren.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getNodeType.d.ts +1 -2
- package/dist/types/dictionaryManipulator/getNodeType.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/mergeDictionaries.d.ts +1 -2
- package/dist/types/dictionaryManipulator/mergeDictionaries.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts +1 -2
- package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/normalizeDictionary.d.ts +2 -3
- package/dist/types/dictionaryManipulator/normalizeDictionary.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +1 -2
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/plainDynamicLoader.d.ts +4 -5
- package/dist/types/dictionaryManipulator/plainDynamicLoader.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/preloadedDynamicLoader.d.ts +4 -4
- package/dist/types/dictionaryManipulator/preloadedDynamicLoader.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts +14 -15
- package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/qualifiedDictionaryDeclaration.d.ts +5 -6
- package/dist/types/dictionaryManipulator/qualifiedDictionaryDeclaration.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +7 -7
- package/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts +1 -2
- package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts +1 -2
- package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/updateNodeChildren.d.ts +1 -2
- package/dist/types/dictionaryManipulator/updateNodeChildren.d.ts.map +1 -1
- package/dist/types/formatters/compact.d.ts +1 -2
- package/dist/types/formatters/compact.d.ts.map +1 -1
- package/dist/types/formatters/currency.d.ts +1 -2
- package/dist/types/formatters/currency.d.ts.map +1 -1
- package/dist/types/formatters/date.d.ts +3 -4
- package/dist/types/formatters/date.d.ts.map +1 -1
- package/dist/types/formatters/index.d.ts +2 -2
- package/dist/types/formatters/list.d.ts +2 -3
- package/dist/types/formatters/list.d.ts.map +1 -1
- package/dist/types/formatters/number.d.ts +1 -2
- package/dist/types/formatters/number.d.ts.map +1 -1
- package/dist/types/formatters/percentage.d.ts +1 -2
- package/dist/types/formatters/percentage.d.ts.map +1 -1
- package/dist/types/formatters/relativeTime.d.ts +1 -2
- package/dist/types/formatters/relativeTime.d.ts.map +1 -1
- package/dist/types/formatters/units.d.ts +1 -2
- package/dist/types/formatters/units.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -5
- package/dist/types/interpreter/dictionaryTransformCache.d.ts +4 -5
- package/dist/types/interpreter/dictionaryTransformCache.d.ts.map +1 -1
- package/dist/types/interpreter/getCondition.d.ts +1 -2
- package/dist/types/interpreter/getCondition.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/deepTransform.d.ts +1 -2
- package/dist/types/interpreter/getContent/deepTransform.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/getContent.d.ts +2 -3
- package/dist/types/interpreter/getContent/getContent.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/plugins.d.ts +28 -29
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/interpreter/getDictionary.d.ts +1 -2
- package/dist/types/interpreter/getDictionary.d.ts.map +1 -1
- package/dist/types/interpreter/getDictionaryAsync.d.ts +1 -2
- package/dist/types/interpreter/getDictionaryAsync.d.ts.map +1 -1
- package/dist/types/interpreter/getEnumeration.d.ts +2 -3
- package/dist/types/interpreter/getEnumeration.d.ts.map +1 -1
- package/dist/types/interpreter/getGender.d.ts +1 -2
- package/dist/types/interpreter/getGender.d.ts.map +1 -1
- package/dist/types/interpreter/getHTML.d.ts +1 -2
- package/dist/types/interpreter/getHTML.d.ts.map +1 -1
- package/dist/types/interpreter/getInsertion.d.ts +1 -2
- package/dist/types/interpreter/getInsertion.d.ts.map +1 -1
- package/dist/types/interpreter/getIntlayer.d.ts +1 -2
- package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
- package/dist/types/interpreter/getIntlayerAsync.d.ts +1 -2
- package/dist/types/interpreter/getIntlayerAsync.d.ts.map +1 -1
- package/dist/types/interpreter/getNesting.d.ts +2 -3
- package/dist/types/interpreter/getNesting.d.ts.map +1 -1
- package/dist/types/interpreter/getNesting.optimized.d.ts +1 -2
- package/dist/types/interpreter/getNesting.optimized.d.ts.map +1 -1
- package/dist/types/interpreter/getPlural.d.ts +3 -4
- package/dist/types/interpreter/getPlural.d.ts.map +1 -1
- package/dist/types/interpreter/getSelect.d.ts +1 -2
- package/dist/types/interpreter/getSelect.d.ts.map +1 -1
- package/dist/types/interpreter/getTranslation.d.ts +1 -2
- package/dist/types/interpreter/getTranslation.d.ts.map +1 -1
- package/dist/types/interpreter/interpolableNode.d.ts +5 -6
- package/dist/types/interpreter/interpolableNode.d.ts.map +1 -1
- package/dist/types/interpreter/splitAndJoinInsertion.d.ts +1 -2
- package/dist/types/interpreter/splitAndJoinInsertion.d.ts.map +1 -1
- package/dist/types/localization/comparePaths.d.ts +2 -3
- package/dist/types/localization/comparePaths.d.ts.map +1 -1
- package/dist/types/localization/domainUtils.d.ts +5 -6
- package/dist/types/localization/domainUtils.d.ts.map +1 -1
- package/dist/types/localization/generateSitemap.d.ts +4 -5
- package/dist/types/localization/generateSitemap.d.ts.map +1 -1
- package/dist/types/localization/getBrowserLocale.d.ts +2 -3
- package/dist/types/localization/getBrowserLocale.d.ts.map +1 -1
- package/dist/types/localization/getCanonicalPath.d.ts +1 -2
- package/dist/types/localization/getCanonicalPath.d.ts.map +1 -1
- package/dist/types/localization/getHTMLTextDir.d.ts +1 -2
- package/dist/types/localization/getHTMLTextDir.d.ts.map +1 -1
- package/dist/types/localization/getLocale.d.ts +2 -3
- package/dist/types/localization/getLocale.d.ts.map +1 -1
- package/dist/types/localization/getLocaleFromPath.d.ts +1 -2
- package/dist/types/localization/getLocaleFromPath.d.ts.map +1 -1
- package/dist/types/localization/getLocaleLang.d.ts +1 -2
- package/dist/types/localization/getLocaleLang.d.ts.map +1 -1
- package/dist/types/localization/getLocaleName.d.ts +1 -2
- package/dist/types/localization/getLocaleName.d.ts.map +1 -1
- package/dist/types/localization/getLocalizedPath.d.ts +1 -2
- package/dist/types/localization/getLocalizedPath.d.ts.map +1 -1
- package/dist/types/localization/getLocalizedUrl.d.ts +1 -2
- package/dist/types/localization/getLocalizedUrl.d.ts.map +1 -1
- package/dist/types/localization/getMultilingualUrls.d.ts +1 -2
- package/dist/types/localization/getMultilingualUrls.d.ts.map +1 -1
- package/dist/types/localization/getPathWithoutLocale.d.ts +1 -2
- package/dist/types/localization/getPathWithoutLocale.d.ts.map +1 -1
- package/dist/types/localization/getPrefix.d.ts +7 -8
- package/dist/types/localization/getPrefix.d.ts.map +1 -1
- package/dist/types/localization/localeDetector.d.ts +2 -3
- package/dist/types/localization/localeDetector.d.ts.map +1 -1
- package/dist/types/localization/localeMapper.d.ts +4 -5
- package/dist/types/localization/localeMapper.d.ts.map +1 -1
- package/dist/types/localization/localeResolver.d.ts +1 -2
- package/dist/types/localization/localeResolver.d.ts.map +1 -1
- package/dist/types/localization/proxyMode.d.ts +4 -5
- package/dist/types/localization/proxyMode.d.ts.map +1 -1
- package/dist/types/localization/resolveBrowserLocale.d.ts +2 -3
- package/dist/types/localization/resolveBrowserLocale.d.ts.map +1 -1
- package/dist/types/localization/rewriteMatch.d.ts +3 -4
- package/dist/types/localization/rewriteMatch.d.ts.map +1 -1
- package/dist/types/localization/rewriteUtils.d.ts +5 -6
- package/dist/types/localization/rewriteUtils.d.ts.map +1 -1
- package/dist/types/localization/validatePrefix.d.ts +2 -3
- package/dist/types/localization/validatePrefix.d.ts.map +1 -1
- package/dist/types/markdown/compiler.d.ts +50 -8
- package/dist/types/markdown/compiler.d.ts.map +1 -1
- package/dist/types/markdown/constants.d.ts +101 -93
- package/dist/types/markdown/constants.d.ts.map +1 -1
- package/dist/types/markdown/elementScanner.d.ts +14 -0
- package/dist/types/markdown/elementScanner.d.ts.map +1 -0
- package/dist/types/markdown/index.d.ts +4 -4
- package/dist/types/markdown/parser.d.ts +1 -7
- package/dist/types/markdown/parser.d.ts.map +1 -1
- package/dist/types/markdown/renderer.d.ts +2 -7
- package/dist/types/markdown/renderer.d.ts.map +1 -1
- package/dist/types/markdown/types.d.ts +62 -50
- package/dist/types/markdown/types.d.ts.map +1 -1
- package/dist/types/markdown/utils.d.ts +35 -31
- package/dist/types/markdown/utils.d.ts.map +1 -1
- package/dist/types/messageFormat/ICU.d.ts +3 -4
- package/dist/types/messageFormat/ICU.d.ts.map +1 -1
- package/dist/types/messageFormat/i18next.d.ts +2 -3
- package/dist/types/messageFormat/i18next.d.ts.map +1 -1
- package/dist/types/messageFormat/navigatePath.d.ts +1 -2
- package/dist/types/messageFormat/navigatePath.d.ts.map +1 -1
- package/dist/types/messageFormat/po.d.ts +3 -4
- package/dist/types/messageFormat/po.d.ts.map +1 -1
- package/dist/types/messageFormat/resolveMessage.d.ts +7 -8
- package/dist/types/messageFormat/resolveMessage.d.ts.map +1 -1
- package/dist/types/messageFormat/vue-i18n.d.ts +2 -3
- package/dist/types/messageFormat/vue-i18n.d.ts.map +1 -1
- package/dist/types/transpiler/condition/condition.d.ts +3 -3
- package/dist/types/transpiler/condition/condition.d.ts.map +1 -1
- package/dist/types/transpiler/enumeration/enumeration.d.ts +4 -4
- package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
- package/dist/types/transpiler/file/file.d.ts +4 -5
- package/dist/types/transpiler/file/file.d.ts.map +1 -1
- package/dist/types/transpiler/file/fileBrowser.d.ts +1 -2
- package/dist/types/transpiler/file/fileBrowser.d.ts.map +1 -1
- package/dist/types/transpiler/gender/gender.d.ts +4 -4
- package/dist/types/transpiler/gender/gender.d.ts.map +1 -1
- package/dist/types/transpiler/html/getHTMLCustomComponents.d.ts +1 -2
- package/dist/types/transpiler/html/getHTMLCustomComponents.d.ts.map +1 -1
- package/dist/types/transpiler/html/html.d.ts +3 -4
- package/dist/types/transpiler/html/html.d.ts.map +1 -1
- package/dist/types/transpiler/html/htmlTags.d.ts +2 -3
- package/dist/types/transpiler/html/htmlTags.d.ts.map +1 -1
- package/dist/types/transpiler/html/validateHTML.d.ts +4 -5
- package/dist/types/transpiler/html/validateHTML.d.ts.map +1 -1
- package/dist/types/transpiler/insertion/getInsertionValues.d.ts +1 -2
- package/dist/types/transpiler/insertion/getInsertionValues.d.ts.map +1 -1
- package/dist/types/transpiler/insertion/insertion.d.ts +3 -3
- package/dist/types/transpiler/insertion/insertion.d.ts.map +1 -1
- package/dist/types/transpiler/markdown/getMarkdownMetadata.d.ts +1 -2
- package/dist/types/transpiler/markdown/getMarkdownMetadata.d.ts.map +1 -1
- package/dist/types/transpiler/markdown/markdown.d.ts +3 -3
- package/dist/types/transpiler/markdown/markdown.d.ts.map +1 -1
- package/dist/types/transpiler/markdown/validateMarkdown.d.ts +3 -3
- package/dist/types/transpiler/markdown/validateMarkdown.d.ts.map +1 -1
- package/dist/types/transpiler/nesting/nesting.d.ts +5 -5
- package/dist/types/transpiler/nesting/nesting.d.ts.map +1 -1
- package/dist/types/transpiler/plural/plural.d.ts +4 -4
- package/dist/types/transpiler/plural/plural.d.ts.map +1 -1
- package/dist/types/transpiler/select/select.d.ts +3 -3
- package/dist/types/transpiler/select/select.d.ts.map +1 -1
- package/dist/types/transpiler/translation/translation.d.ts +2 -2
- package/dist/types/transpiler/translation/translation.d.ts.map +1 -1
- package/dist/types/utils/checkIsURLAbsolute.d.ts +1 -2
- package/dist/types/utils/checkIsURLAbsolute.d.ts.map +1 -1
- package/dist/types/utils/cookieExpiry.d.ts +2 -3
- package/dist/types/utils/cookieExpiry.d.ts.map +1 -1
- package/dist/types/utils/getCookie.d.ts +1 -2
- package/dist/types/utils/getCookie.d.ts.map +1 -1
- package/dist/types/utils/intl.d.ts +7 -7
- package/dist/types/utils/intl.d.ts.map +1 -1
- package/dist/types/utils/isSameKeyPath.d.ts +1 -2
- package/dist/types/utils/isSameKeyPath.d.ts.map +1 -1
- package/dist/types/utils/isValidReactElement.d.ts +1 -2
- package/dist/types/utils/isValidReactElement.d.ts.map +1 -1
- package/dist/types/utils/localeStorage.d.ts +14 -15
- package/dist/types/utils/localeStorage.d.ts.map +1 -1
- package/dist/types/utils/parseYaml.d.ts +3 -4
- package/dist/types/utils/parseYaml.d.ts.map +1 -1
- package/dist/types/utils/stringifyYaml.d.ts +1 -2
- package/dist/types/utils/stringifyYaml.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getDictionaryAsync.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getGender.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getInsertion.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getSelect.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +0 -7
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/interpolableNode.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getDictionaryAsync.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getGender.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getInsertion.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getSelect.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +0 -7
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/interpolableNode.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/intlayer/dist/types/index.d.ts +0 -6
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getDictionaryAsync.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getGender.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getInsertion.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getSelect.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +0 -7
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/interpolableNode.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/intlayer/dist/types/index.d.ts +0 -6
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getDictionaryAsync.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getGender.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getInsertion.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getSelect.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +0 -7
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/interpolableNode.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/intlayer/dist/types/index.d.ts +0 -6
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getDictionaryAsync.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getGender.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getInsertion.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/getSelect.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +0 -7
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/interpreter/interpolableNode.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/intlayer/dist/types/index.d.ts +0 -6
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/dictionaryManipulator/plainDynamicLoader.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/formatters/compact.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/currency.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/date.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/index.d.ts +0 -9
- package/dist/types/@intlayer/core/dist/types/formatters/list.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/number.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/percentage.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/relativeTime.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/units.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/dictionaryTransformCache.d.ts +0 -4
- package/dist/types/@intlayer/core/dist/types/interpreter/getCondition.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/deepTransform.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/getContent.d.ts +0 -3
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/index.d.ts +0 -3
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/plugins.d.ts +0 -7
- package/dist/types/@intlayer/core/dist/types/interpreter/getDictionary.d.ts +0 -4
- package/dist/types/@intlayer/core/dist/types/interpreter/getDictionaryAsync.d.ts +0 -6
- package/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/interpreter/getGender.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/interpreter/getInsertion.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/interpreter/getIntlayer.d.ts +0 -4
- package/dist/types/@intlayer/core/dist/types/interpreter/getIntlayerAsync.d.ts +0 -4
- package/dist/types/@intlayer/core/dist/types/interpreter/getNesting.d.ts +0 -6
- package/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +0 -3
- package/dist/types/@intlayer/core/dist/types/interpreter/getSelect.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/interpreter/getTranslation.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +0 -18
- package/dist/types/@intlayer/core/dist/types/interpreter/interpolableNode.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/intlayer/dist/types/index.d.ts +0 -6
- package/dist/types/@intlayer/core/dist/types/localization/comparePaths.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/domainUtils.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/generateSitemap.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/getBrowserLocale.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getCanonicalPath.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/getHTMLTextDir.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getLocale.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleFromPath.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleLang.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleName.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getLocalizedPath.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/getLocalizedUrl.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/getMultilingualUrls.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/getPathWithoutLocale.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getPrefix.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/index.d.ts +0 -22
- package/dist/types/@intlayer/core/dist/types/localization/localeDetector.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/localeMapper.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/localeResolver.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/resolveBrowserLocale.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/rewriteMatch.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/rewriteUtils.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/validatePrefix.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/markdown/index.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/transpiler/condition/condition.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/condition/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/enumeration/enumeration.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/enumeration/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/file/file.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/file/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/gender/gender.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/gender/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/html/html.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/html/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +0 -22
- package/dist/types/@intlayer/core/dist/types/transpiler/insertion/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/insertion/insertion.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/markdown/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/markdown/markdown.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/nesting/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +0 -4
- package/dist/types/@intlayer/core/dist/types/transpiler/plural/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/plural/plural.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/select/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/select/select.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/translation/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/translation/translation.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/utils/index.d.ts +0 -3
- package/dist/types/@intlayer/core/dist/types/utils/intl.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/utils/isSameKeyPath.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/utils/localeStorage.d.ts +0 -2
- package/dist/types/intlayer/dist/types/index.d.ts +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ATTRIBUTES_TO_SANITIZE, CAPTURE_LETTER_AFTER_HYPHEN, FENCE_DELIMITER_R, HTML_CUSTOM_ATTR_R, INTERPOLATION_R,
|
|
1
|
+
import { ATTRIBUTES_TO_SANITIZE, CAPTURE_LETTER_AFTER_HYPHEN, CR_NEWLINE_R, FENCE_DELIMITER_R, FORMFEED_R, HTML_CUSTOM_ATTR_R, INTERPOLATION_R, TABLE_CENTER_ALIGN, TABLE_LEFT_ALIGN, TABLE_RIGHT_ALIGN, TABLE_TRIM_PIPES, TAB_R, UNESCAPE_R } from "./constants.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/markdown/utils.ts
|
|
4
4
|
/**
|
|
@@ -6,8 +6,8 @@ import { ATTRIBUTES_TO_SANITIZE, CAPTURE_LETTER_AFTER_HYPHEN, FENCE_DELIMITER_R,
|
|
|
6
6
|
*/
|
|
7
7
|
const trimEnd = (str) => {
|
|
8
8
|
let end = str.length;
|
|
9
|
-
while (end > 0 && str
|
|
10
|
-
return str.slice(0, end);
|
|
9
|
+
while (end > 0 && str.charCodeAt(end - 1) <= 32) end--;
|
|
10
|
+
return end === str.length ? str : str.slice(0, end);
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* Check if string starts with prefix.
|
|
@@ -26,7 +26,7 @@ const unquote = (str) => {
|
|
|
26
26
|
/**
|
|
27
27
|
* Unescape backslash-escaped characters.
|
|
28
28
|
*/
|
|
29
|
-
const unescapeString = (rawString) => rawString ? rawString.replace(UNESCAPE_R, "$1") : rawString;
|
|
29
|
+
const unescapeString = (rawString) => rawString && rawString.indexOf("\\") !== -1 ? rawString.replace(UNESCAPE_R, "$1") : rawString;
|
|
30
30
|
/**
|
|
31
31
|
* Join class names, filtering out falsy values.
|
|
32
32
|
*/
|
|
@@ -35,6 +35,7 @@ const cx = (...args) => args.filter(Boolean).join(" ");
|
|
|
35
35
|
* Get a nested property from an object using dot notation.
|
|
36
36
|
*/
|
|
37
37
|
const get = (src, path, fb) => {
|
|
38
|
+
if (path.indexOf(".") === -1) return src?.[path] ?? fb;
|
|
38
39
|
let ptr = src;
|
|
39
40
|
const frags = path.split(".");
|
|
40
41
|
while (frags.length) {
|
|
@@ -57,16 +58,18 @@ const SLUGIFY_REPLACEMENTS = [
|
|
|
57
58
|
[/[Ññ]/g, "n"],
|
|
58
59
|
[/[øØœŒÕõÔôÓóÒò]/g, "o"],
|
|
59
60
|
[/[ÜüÛûÚúÙù]/g, "u"],
|
|
60
|
-
[/[ŸÿÝý]/g, "y"]
|
|
61
|
-
[/[^a-z0-9- ]/gi, ""],
|
|
62
|
-
[/ /gi, "-"]
|
|
61
|
+
[/[ŸÿÝý]/g, "y"]
|
|
63
62
|
];
|
|
63
|
+
const NON_ASCII_R = /[\u0080-\uffff]/;
|
|
64
|
+
const SLUGIFY_STRIP_R = /[^a-z0-9- ]/gi;
|
|
65
|
+
const SLUGIFY_SPACE_R = / /g;
|
|
64
66
|
const slugify = (str) => {
|
|
65
67
|
let result = str;
|
|
66
|
-
for (let i = 0; i < SLUGIFY_REPLACEMENTS.length; i++) {
|
|
68
|
+
if (NON_ASCII_R.test(result)) for (let i = 0; i < SLUGIFY_REPLACEMENTS.length; i++) {
|
|
67
69
|
const [pattern, replacement] = SLUGIFY_REPLACEMENTS[i];
|
|
68
70
|
result = result.replace(pattern, replacement);
|
|
69
71
|
}
|
|
72
|
+
result = result.replace(SLUGIFY_STRIP_R, "").replace(SLUGIFY_SPACE_R, "-");
|
|
70
73
|
return result.toLowerCase();
|
|
71
74
|
};
|
|
72
75
|
const SANITIZE_R = /(javascript|vbscript|data(?!:image)):/i;
|
|
@@ -92,11 +95,13 @@ const sanitizer = (input) => {
|
|
|
92
95
|
/**
|
|
93
96
|
* Normalize whitespace in source string.
|
|
94
97
|
*/
|
|
95
|
-
const normalizeWhitespace = (source) =>
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
const normalizeWhitespace = (source) => {
|
|
99
|
+
let normalized = source;
|
|
100
|
+
if (normalized.indexOf(" ") !== -1) normalized = normalized.replace(TAB_R, " ");
|
|
101
|
+
if (normalized.indexOf("\r") !== -1) normalized = normalized.replace(CR_NEWLINE_R, "\n");
|
|
102
|
+
if (normalized.indexOf("\f") !== -1) normalized = normalized.replace(FORMFEED_R, "");
|
|
103
|
+
return normalized;
|
|
104
|
+
};
|
|
100
105
|
/**
|
|
101
106
|
* Safely remove a uniform leading indentation from lines, but do NOT touch
|
|
102
107
|
* the content inside fenced code blocks (``` or ~~~).
|
|
@@ -203,6 +208,7 @@ const attributeValueToNodePropValue = (tag, key, value, sanitizeUrlFn) => {
|
|
|
203
208
|
* Parse table alignment from a separator row.
|
|
204
209
|
*/
|
|
205
210
|
const parseTableAlignCapture = (alignCapture) => {
|
|
211
|
+
if (alignCapture.indexOf(":") === -1) return "left";
|
|
206
212
|
if (TABLE_RIGHT_ALIGN.test(alignCapture)) return "right";
|
|
207
213
|
else if (TABLE_CENTER_ALIGN.test(alignCapture)) return "center";
|
|
208
214
|
else if (TABLE_LEFT_ALIGN.test(alignCapture)) return "left";
|
|
@@ -220,25 +226,88 @@ const parseTableAlign = (source) => {
|
|
|
220
226
|
const parseTableRow = (source, parse, state, tableOutput) => {
|
|
221
227
|
const prevInTable = state.inTable;
|
|
222
228
|
state.inTable = true;
|
|
223
|
-
|
|
224
|
-
let
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
let rStart = 0;
|
|
230
|
+
let rEnd = source.length;
|
|
231
|
+
while (rStart < rEnd) {
|
|
232
|
+
const c = source.charCodeAt(rStart);
|
|
233
|
+
if (c === 32 || c === 9) rStart++;
|
|
234
|
+
else break;
|
|
235
|
+
}
|
|
236
|
+
while (rEnd > rStart) {
|
|
237
|
+
const c = source.charCodeAt(rEnd - 1);
|
|
238
|
+
if (c === 32 || c === 9) rEnd--;
|
|
239
|
+
else break;
|
|
240
|
+
}
|
|
241
|
+
if (rStart < rEnd && source.charCodeAt(rStart) === 124) rStart++;
|
|
242
|
+
if (rEnd > rStart && source.charCodeAt(rEnd - 1) === 124 && (rEnd - 2 < rStart || source.charCodeAt(rEnd - 2) !== 92)) rEnd--;
|
|
243
|
+
if (!tableOutput) {
|
|
244
|
+
const cell = parse(source.slice(rStart, rEnd), state);
|
|
245
|
+
state.inTable = prevInTable;
|
|
246
|
+
return [cell];
|
|
247
|
+
}
|
|
248
|
+
const cells = [];
|
|
249
|
+
const len = source.length;
|
|
250
|
+
let cellStart = rStart;
|
|
251
|
+
let i = rStart;
|
|
252
|
+
/**
|
|
253
|
+
* Parse one cell, dropping the padding an aligned table pads it with.
|
|
254
|
+
*
|
|
255
|
+
* GFM strips a cell's surrounding whitespace, so trimming is both the correct
|
|
256
|
+
* output and the cheap one: the padding of a column-aligned table is a large
|
|
257
|
+
* share of its bytes, and every space handed to `parse` costs a rule dispatch,
|
|
258
|
+
* a capture and a lookbehind update. `trim` is a native scan, and walking the
|
|
259
|
+
* padding back from the delimiter in JavaScript instead costs half as much
|
|
260
|
+
* again as the whole row scan.
|
|
261
|
+
*/
|
|
262
|
+
const parseCell = (from, to) => {
|
|
263
|
+
const cell = source.slice(from, to).trim();
|
|
264
|
+
return cell === "" ? [] : parse(cell, state);
|
|
230
265
|
};
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
266
|
+
let pipeAt = -1;
|
|
267
|
+
let escapeAt = -1;
|
|
268
|
+
let backtickAt = -1;
|
|
269
|
+
while (i < rEnd) {
|
|
270
|
+
if (pipeAt < i) {
|
|
271
|
+
const at = source.indexOf("|", i);
|
|
272
|
+
pipeAt = at === -1 ? len : at;
|
|
273
|
+
}
|
|
274
|
+
if (escapeAt < i) {
|
|
275
|
+
const at = source.indexOf("\\", i);
|
|
276
|
+
escapeAt = at === -1 ? len : at;
|
|
277
|
+
}
|
|
278
|
+
if (backtickAt < i) {
|
|
279
|
+
const at = source.indexOf("`", i);
|
|
280
|
+
backtickAt = at === -1 ? len : at;
|
|
281
|
+
}
|
|
282
|
+
i = Math.min(pipeAt, escapeAt, backtickAt);
|
|
283
|
+
if (i >= rEnd) break;
|
|
284
|
+
if (i === escapeAt) {
|
|
285
|
+
i += i + 1 < rEnd ? 2 : 1;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (i === backtickAt) {
|
|
289
|
+
let backticks = 0;
|
|
290
|
+
while (i < rEnd && source.charCodeAt(i) === 96) {
|
|
291
|
+
backticks++;
|
|
292
|
+
i++;
|
|
293
|
+
}
|
|
294
|
+
let found = false;
|
|
295
|
+
while (i < rEnd && !found) {
|
|
296
|
+
let closeBackticks = 0;
|
|
297
|
+
while (i < rEnd && source.charCodeAt(i) === 96) {
|
|
298
|
+
closeBackticks++;
|
|
299
|
+
i++;
|
|
300
|
+
}
|
|
301
|
+
if (closeBackticks === backticks) found = true;
|
|
302
|
+
else if (closeBackticks === 0) i++;
|
|
237
303
|
}
|
|
304
|
+
continue;
|
|
238
305
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
306
|
+
cells.push(parseCell(cellStart, i));
|
|
307
|
+
i++;
|
|
308
|
+
cellStart = i;
|
|
309
|
+
}
|
|
310
|
+
cells.push(parseCell(cellStart, rEnd));
|
|
242
311
|
state.inTable = prevInTable;
|
|
243
312
|
return cells;
|
|
244
313
|
};
|
|
@@ -246,7 +315,27 @@ const parseTableRow = (source, parse, state, tableOutput) => {
|
|
|
246
315
|
* Parse table cells (multiple rows).
|
|
247
316
|
*/
|
|
248
317
|
const parseTableCells = (source, parse, state) => {
|
|
249
|
-
|
|
318
|
+
if (!source) return [];
|
|
319
|
+
const result = [];
|
|
320
|
+
let start = 0;
|
|
321
|
+
const len = source.length;
|
|
322
|
+
while (start < len) {
|
|
323
|
+
let nextNewline = source.indexOf("\n", start);
|
|
324
|
+
if (nextNewline === -1) nextNewline = len;
|
|
325
|
+
const rowText = source.slice(start, nextNewline);
|
|
326
|
+
start = nextNewline + 1;
|
|
327
|
+
let hasContent = false;
|
|
328
|
+
for (let j = 0; j < rowText.length; j++) {
|
|
329
|
+
const c = rowText.charCodeAt(j);
|
|
330
|
+
if (c !== 32 && c !== 9 && c !== 13) {
|
|
331
|
+
hasContent = true;
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (!hasContent) continue;
|
|
336
|
+
result.push(parseTableRow(rowText, parse, state, true));
|
|
337
|
+
}
|
|
338
|
+
return result;
|
|
250
339
|
};
|
|
251
340
|
/**
|
|
252
341
|
* Check if a rule qualifies for the current source and state.
|
|
@@ -344,11 +433,11 @@ const captureNothing = () => ({});
|
|
|
344
433
|
* Helper that renders nothing (null).
|
|
345
434
|
*/
|
|
346
435
|
const renderNothing = () => null;
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
436
|
+
const some = (probes, input) => {
|
|
437
|
+
for (let i = 0; i < probes.length; i++) {
|
|
438
|
+
const probe = probes[i];
|
|
439
|
+
if (typeof probe === "function" ? probe(input) : probe.test(input)) return true;
|
|
440
|
+
}
|
|
352
441
|
return false;
|
|
353
442
|
};
|
|
354
443
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/markdown/utils.ts"],"sourcesContent":["import {\n ATTRIBUTES_TO_SANITIZE,\n CAPTURE_LETTER_AFTER_HYPHEN,\n FENCE_DELIMITER_R,\n HTML_CUSTOM_ATTR_R,\n INTERPOLATION_R,\n NORMALIZE_WHITESPACE_R,\n TABLE_CENTER_ALIGN,\n TABLE_LEFT_ALIGN,\n TABLE_RIGHT_ALIGN,\n TABLE_TRIM_PIPES,\n UNESCAPE_R,\n} from './constants';\nimport type { NestedParser, ParserResult, ParseState, Rule } from './types';\n\n// ============================================================================\n// STRING UTILITIES\n// ============================================================================\n\n/**\n * Trim trailing whitespace from a string.\n */\nexport const trimEnd = (str: string): string => {\n let end = str.length;\n\n while (end > 0 && str[end - 1]! <= ' ') end--;\n\n return str.slice(0, end);\n};\n\n/**\n * Check if string starts with prefix.\n */\nexport const startsWith = (str: string, prefix: string): boolean => {\n return str.startsWith(prefix);\n};\n\n/**\n * Remove symmetrical leading and trailing quotes.\n */\nexport const unquote = (str: string): string => {\n const first = str[0];\n\n if (\n (first === '\"' || first === \"'\") &&\n str.length >= 2 &&\n str[str.length - 1] === first\n ) {\n return str.slice(1, -1);\n }\n\n return str;\n};\n\n/**\n * Unescape backslash-escaped characters.\n */\nexport const unescapeString = (rawString: string): string =>\n rawString ? rawString.replace(UNESCAPE_R, '$1') : rawString;\n\n/**\n * Join class names, filtering out falsy values.\n */\nexport const cx = (...args: any[]): string => args.filter(Boolean).join(' ');\n\n/**\n * Get a nested property from an object using dot notation.\n */\nexport const get = (src: any, path: string, fb?: any): any => {\n let ptr = src;\n const frags = path.split('.');\n\n while (frags.length) {\n ptr = ptr[frags[0]!];\n\n if (ptr === undefined) break;\n else frags.shift();\n }\n\n return ptr ?? fb;\n};\n\n// ============================================================================\n// SLUGIFY\n// ============================================================================\n\n/**\n * Convert a string to a URL-safe slug.\n * Based on https://stackoverflow.com/a/18123682/1141611\n */\nconst SLUGIFY_REPLACEMENTS: [pattern: RegExp, replacement: string][] = [\n [/[ÀÁÂÃÄÅàáâãä忯]/g, 'a'],\n [/[çÇ]/g, 'c'],\n [/[ðÐ]/g, 'd'],\n [/[ÈÉÊËéèêë]/g, 'e'],\n [/[ÏïÎîÍíÌì]/g, 'i'],\n [/[Ññ]/g, 'n'],\n [/[øØœŒÕõÔôÓóÒò]/g, 'o'],\n [/[ÜüÛûÚúÙù]/g, 'u'],\n [/[ŸÿÝý]/g, 'y'],\n [/[^a-z0-9- ]/gi, ''],\n [/ /gi, '-'],\n];\n\nexport const slugify = (str: string): string => {\n let result = str;\n\n for (let i = 0; i < SLUGIFY_REPLACEMENTS.length; i++) {\n const [pattern, replacement] = SLUGIFY_REPLACEMENTS[i]!;\n result = result.replace(pattern, replacement);\n }\n\n return result.toLowerCase();\n};\n\n// ============================================================================\n// SANITIZER\n// ============================================================================\n\nconst SANITIZE_R = /(javascript|vbscript|data(?!:image)):/i;\nconst SANITIZE_STRIP_R = /[^A-Za-z0-9/:]/g;\n\n/**\n * Sanitize URLs to prevent XSS attacks.\n * Returns null if the URL is unsafe.\n */\nexport const sanitizer = (input: string): string | null => {\n // `SANITIZE_R` only ever matches on a colon, and decoding can introduce one\n // solely through a percent escape — so a value with neither is safe as-is,\n // and skipping the decode avoids the bulk of the work on ordinary links.\n if (input.indexOf(':') === -1 && input.indexOf('%') === -1) return input;\n\n try {\n const decoded = decodeURIComponent(input).replace(SANITIZE_STRIP_R, '');\n\n if (SANITIZE_R.test(decoded)) {\n console.warn(\n 'Input contains an unsafe JavaScript/VBScript/data expression, it will not be rendered.',\n decoded\n );\n\n return null;\n }\n } catch (_e) {\n console.warn(\n 'Input could not be decoded due to malformed syntax or characters, it will not be rendered.',\n input\n );\n\n // decodeURIComponent sometimes throws a URIError\n return null;\n }\n\n return input;\n};\n\n// ============================================================================\n// WHITESPACE NORMALIZATION\n// ============================================================================\n\n/**\n * Normalize whitespace in source string.\n */\nexport const normalizeWhitespace = (source: string): string =>\n // `\\r`, `\\f` and `\\t` are disjoint, so one pass over the source replaces\n // what used to take three full scans.\n source.replace(NORMALIZE_WHITESPACE_R, (match) => {\n if (match === '\\t') return ' ';\n if (match === '\\f') return '';\n\n return '\\n';\n });\n\n/**\n * Safely remove a uniform leading indentation from lines, but do NOT touch\n * the content inside fenced code blocks (``` or ~~~).\n *\n * Inside a fenced block the structural indentation is irrelevant: what matters\n * is the indentation of the opening fence itself, which is the only amount\n * CommonMark strips from the code lines. A block nested in an indented HTML\n * element but written with its fence at column 0 therefore keeps its code\n * verbatim, instead of losing the first level of indentation.\n */\nexport const trimLeadingWhitespaceOutsideFences = (\n text: string,\n whitespace: string\n): string => {\n if (!whitespace) return text;\n\n const lines = text.split('\\n');\n\n /** Indentation and marker of the fence currently open, if any. */\n let openFence: { indentation: string; marker: string } | null = null;\n\n const removePrefix = (line: string, prefix: string): string =>\n prefix && line.startsWith(prefix) ? line.slice(prefix.length) : line;\n\n // Outside fences, strip the base structural indentation from every line.\n // Lines that don't start with the whitespace prefix are left as-is.\n const result = lines\n .map((line) => {\n const fenceMatch = line.match(FENCE_DELIMITER_R);\n\n if (!openFence) {\n if (fenceMatch)\n openFence = { indentation: fenceMatch[1]!, marker: fenceMatch[2]! };\n return removePrefix(line, whitespace);\n }\n\n const isClosingFence = fenceMatch?.[2]?.startsWith(openFence.marker);\n const { indentation } = openFence;\n\n if (isClosingFence) openFence = null;\n\n return removePrefix(line, indentation);\n })\n .join('\\n');\n\n return result;\n};\n\n/**\n * Normalize HTML attribute key to JSX prop name.\n */\nexport const normalizeAttributeKey = (key: string): string => {\n const hyphenIndex = key.indexOf('-');\n\n if (hyphenIndex !== -1 && key.match(HTML_CUSTOM_ATTR_R) === null) {\n key = key.replace(CAPTURE_LETTER_AFTER_HYPHEN, (_, letter) => {\n return letter.toUpperCase();\n });\n }\n\n return key;\n};\n\ntype StyleTuple = [key: string, value: string];\n\n/**\n * Parse a CSS style string into an array of [key, value] tuples.\n */\nexport const parseStyleAttribute = (styleString: string): StyleTuple[] => {\n const styles: StyleTuple[] = [];\n let buffer = '';\n let inUrl = false;\n let inQuotes = false;\n let quoteChar: '\"' | \"'\" | '' = '';\n\n if (!styleString) return styles;\n\n for (let i = 0; i < styleString.length; i++) {\n const char = styleString[i];\n\n if ((char === '\"' || char === \"'\") && !inUrl) {\n if (!inQuotes) {\n inQuotes = true;\n quoteChar = char;\n } else if (char === quoteChar) {\n inQuotes = false;\n quoteChar = '';\n }\n }\n\n if (char === '(' && buffer.endsWith('url')) {\n inUrl = true;\n } else if (char === ')' && inUrl) {\n inUrl = false;\n }\n\n if (char === ';' && !inQuotes && !inUrl) {\n const declaration = buffer.trim();\n\n if (declaration) {\n const colonIndex = declaration.indexOf(':');\n\n if (colonIndex > 0) {\n const key = declaration.slice(0, colonIndex).trim();\n const value = declaration.slice(colonIndex + 1).trim();\n styles.push([key, value]);\n }\n }\n buffer = '';\n } else {\n buffer += char;\n }\n }\n\n const declaration = buffer.trim();\n\n if (declaration) {\n const colonIndex = declaration.indexOf(':');\n if (colonIndex > 0) {\n const key = declaration.slice(0, colonIndex).trim();\n const value = declaration.slice(colonIndex + 1).trim();\n styles.push([key, value]);\n }\n }\n\n return styles;\n};\n\n/**\n * Convert an attribute value to a Node prop value.\n */\nexport const attributeValueToNodePropValue = (\n tag: string,\n key: string,\n value: string,\n sanitizeUrlFn: (\n value: string,\n tag: string,\n attribute: string\n ) => string | null\n): any => {\n if (key === 'style') {\n return parseStyleAttribute(value).reduce(\n (styles, [styleKey, styleValue]) => {\n const camelCasedKey = styleKey.replace(/(-[a-z])/g, (substr) =>\n substr[1]!.toUpperCase()\n );\n\n (styles as Record<string, any>)[camelCasedKey] = sanitizeUrlFn(\n styleValue,\n tag,\n styleKey\n );\n\n return styles;\n },\n {} as Record<string, any>\n );\n } else if (ATTRIBUTES_TO_SANITIZE.indexOf(key) !== -1) {\n return sanitizeUrlFn(unescapeString(value), tag, key);\n } else if (value.match(INTERPOLATION_R)) {\n value = unescapeString(value.slice(1, value.length - 1));\n }\n\n if (value === 'true') {\n return true;\n } else if (value === 'false') {\n return false;\n }\n\n return value;\n};\n\n// ============================================================================\n// TABLE PARSING\n// ============================================================================\n\n/**\n * Parse table alignment from a separator row.\n */\nexport const parseTableAlignCapture = (\n alignCapture: string\n): 'left' | 'right' | 'center' => {\n if (TABLE_RIGHT_ALIGN.test(alignCapture)) {\n return 'right';\n } else if (TABLE_CENTER_ALIGN.test(alignCapture)) {\n return 'center';\n } else if (TABLE_LEFT_ALIGN.test(alignCapture)) {\n return 'left';\n }\n\n return 'left';\n};\n\n/**\n * Parse table alignment row.\n */\nexport const parseTableAlign = (\n source: string\n): ('left' | 'right' | 'center')[] => {\n const alignText = source.replace(TABLE_TRIM_PIPES, '').split('|');\n return alignText.map(parseTableAlignCapture);\n};\n\n/**\n * Parse a single table row.\n */\nexport const parseTableRow = (\n source: string,\n parse: NestedParser,\n state: ParseState,\n tableOutput: boolean\n): ParserResult[][] => {\n const prevInTable = state.inTable;\n\n state.inTable = true;\n\n const cells: ParserResult[][] = [[]];\n let acc = '';\n\n const flush = (): void => {\n if (!acc) return;\n\n const cell = cells[cells.length - 1]!;\n cell.push.apply(cell, parse(acc, state));\n acc = '';\n };\n\n source\n .trim()\n .split(/(`[^`]*`|\\\\\\||\\|)/)\n .filter(Boolean)\n .forEach((fragment, i, arr) => {\n if (fragment.trim() === '|') {\n flush();\n\n if (tableOutput) {\n if (i !== 0 && i !== arr.length - 1) {\n cells.push([]);\n }\n\n return;\n }\n }\n\n acc += fragment;\n });\n\n flush();\n\n state.inTable = prevInTable;\n\n return cells;\n};\n\n/**\n * Parse table cells (multiple rows).\n */\nexport const parseTableCells = (\n source: string,\n parse: NestedParser,\n state: ParseState\n): ParserResult[][][] => {\n const rowsText = source.trim().split('\\n');\n\n const result = rowsText.map((rowText) =>\n parseTableRow(rowText, parse, state, true)\n );\n\n return result;\n};\n\n// ============================================================================\n// PARSING HELPERS\n// ============================================================================\n\n/**\n * Check if a rule qualifies for the current source and state.\n */\nexport const qualifies = (\n source: string,\n state: ParseState,\n qualify: NonNullable<Rule<any>['_qualify']>\n): boolean => {\n if (Array.isArray(qualify)) {\n for (let i = 0; i < qualify.length; i++) {\n if (startsWith(source, qualify[i]!)) return true;\n }\n\n return false;\n }\n\n return (qualify as (source: string, state: ParseState) => boolean)(\n source,\n state\n );\n};\n\n/**\n * Marks a matcher function as eligible for being run inside an inline context.\n */\nexport const allowInline = <T extends (...args: any[]) => any>(\n fn: T\n): T & { inline: 1 } => {\n (fn as any).inline = 1;\n return fn as T & { inline: 1 };\n};\n\n/**\n * Creates a match function for an inline scoped element from a regex.\n */\nexport const inlineRegex = (regex: RegExp) =>\n allowInline((source: string, state: ParseState): RegExpMatchArray | null => {\n if (state.inline) {\n return regex.exec(source);\n } else {\n return null;\n }\n });\n\n/**\n * Creates a match function for inline elements except links.\n */\nexport const simpleInlineRegex = (regex: RegExp) =>\n allowInline((source: string, state: ParseState): RegExpMatchArray | null => {\n if (state.inline || state.simple) {\n return regex.exec(source);\n } else {\n return null;\n }\n });\n\n/**\n * Creates a match function for a block scoped element from a regex.\n */\nexport const blockRegex =\n (regex: RegExp) =>\n (source: string, state: ParseState): RegExpMatchArray | null => {\n if (state.inline || state.simple) {\n return null;\n } else {\n return regex.exec(source);\n }\n };\n\n/**\n * Creates a match function from a regex, ignoring block/inline scope.\n */\nexport const anyScopeRegex = (\n fn: RegExp | ((source: string, state: ParseState) => RegExpMatchArray | null)\n) =>\n allowInline((source: string, state: ParseState): RegExpMatchArray | null => {\n if (typeof fn === 'function') {\n return fn(source, state);\n }\n return fn.exec(source);\n });\n\n/**\n * Parse inline content (including links).\n */\nexport const parseInline = (\n parse: NestedParser,\n children: string,\n state: ParseState\n): ParserResult[] => {\n const isCurrentlyInline = state.inline ?? false;\n const isCurrentlySimple = state.simple ?? false;\n state.inline = true;\n state.simple = true;\n const result = parse(children, state);\n state.inline = isCurrentlyInline;\n state.simple = isCurrentlySimple;\n\n return result;\n};\n\n/**\n * Parse simple inline content (no links).\n */\nexport const parseSimpleInline = (\n parse: NestedParser,\n children: string,\n state: ParseState\n): ParserResult[] => {\n const isCurrentlyInline = state.inline ?? false;\n const isCurrentlySimple = state.simple ?? false;\n\n state.inline = false;\n state.simple = true;\n const result = parse(children, state);\n state.inline = isCurrentlyInline;\n state.simple = isCurrentlySimple;\n\n return result;\n};\n\n/**\n * Parse block content.\n */\nexport const parseBlock = (\n parse: NestedParser,\n children: string,\n state: ParseState = {}\n): ParserResult[] => {\n const isCurrentlyInline = state.inline || false;\n state.inline = false;\n const normalizedChildren = trimEnd(children);\n const needsTerminator = /\\n\\n$/.test(normalizedChildren) === false;\n const blockInput = needsTerminator\n ? normalizedChildren.endsWith('\\n')\n ? `${normalizedChildren}\\n`\n : `${normalizedChildren}\\n\\n`\n : normalizedChildren;\n\n const result = parse(blockInput, state);\n state.inline = isCurrentlyInline;\n\n return result;\n};\n\n/**\n * Helper to parse capture group 2 as inline content.\n */\nexport const parseCaptureInline = (\n capture: RegExpMatchArray,\n parse: NestedParser,\n state: ParseState\n): { children: ParserResult[] } => {\n return {\n children: parseInline(parse, capture[2] ?? '', state),\n };\n};\n\n/**\n * Helper that captures nothing (empty object).\n */\nexport const captureNothing = (): Record<string, never> => ({});\n\n/**\n * Helper that renders nothing (null).\n */\nexport const renderNothing = (): null => null;\n\n/**\n * Check if any regex in a list matches the input.\n */\nexport const some = (regexes: RegExp[], input: string): boolean => {\n for (let i = 0; i < regexes.length; i++) {\n if (regexes[i]!.test(input)) {\n return true;\n }\n }\n return false;\n};\n"],"mappings":";;;;;;AAsBA,MAAa,WAAW,QAAwB;CAC9C,IAAI,MAAM,IAAI;CAEd,OAAO,MAAM,KAAK,IAAI,MAAM,MAAO,KAAK;CAExC,OAAO,IAAI,MAAM,GAAG,GAAG;AACzB;;;;AAKA,MAAa,cAAc,KAAa,WAA4B;CAClE,OAAO,IAAI,WAAW,MAAM;AAC9B;;;;AAKA,MAAa,WAAW,QAAwB;CAC9C,MAAM,QAAQ,IAAI;CAElB,KACG,UAAU,QAAO,UAAU,QAC5B,IAAI,UAAU,KACd,IAAI,IAAI,SAAS,OAAO,OAExB,OAAO,IAAI,MAAM,GAAG,EAAE;CAGxB,OAAO;AACT;;;;AAKA,MAAa,kBAA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AAS;CACf,MAAM,SAAS;CACf,MAAM,SAAS,MAAM,UAAU,KAAK;CACpC,MAAM,SAAS;CACf,MAAM,SAAS;CAEf,OAAO;AACT;;;;AAKA,MAAa,cACX,OACA,UACA,QAAoB,CAAC,MACF;CACnB,MAAM,oBAAoB,MAAM,UAAU;CAC1C,MAAM,SAAS;CACf,MAAM,qBAAqB,QAAQ,QAAQ;CAQ3C,MAAM,SAAS,MAPS,QAAQ,KAAK,kBAAkB,MAAM,QAEzD,mBAAmB,SAAS,IAAI,IAC9B,GAAG,mBAAmB,MACtB,GAAG,mBAAmB,QACxB,oBAE6B,KAAK;CACtC,MAAM,SAAS;CAEf,OAAO;AACT;;;;AAKA,MAAa,sBACX,SACA,OACA,UACiC;CACjC,OAAO,EACL,UAAU,YAAY,OAAO,QAAQ,MAAM,IAAI,KAAK,EACtD;AACF;;;;AAKA,MAAa,wBAA+C,CAAC;;;;AAK7D,MAAa,sBAA4B;;;;AAKzC,MAAa,QAAQ,SAAmB,UAA2B;CACjE,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAClC,IAAI,QAAQ,EAAE,CAAE,KAAK,KAAK,GACxB,OAAO;CAGX,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/markdown/utils.ts"],"sourcesContent":["import {\n ATTRIBUTES_TO_SANITIZE,\n CAPTURE_LETTER_AFTER_HYPHEN,\n CR_NEWLINE_R,\n FENCE_DELIMITER_R,\n FORMFEED_R,\n HTML_CUSTOM_ATTR_R,\n INTERPOLATION_R,\n TAB_R,\n TABLE_CENTER_ALIGN,\n TABLE_LEFT_ALIGN,\n TABLE_RIGHT_ALIGN,\n TABLE_TRIM_PIPES,\n UNESCAPE_R,\n} from './constants';\nimport type { NestedParser, ParserResult, ParseState, Rule } from './types';\n\n// ============================================================================\n// STRING UTILITIES\n// ============================================================================\n\n/**\n * Trim trailing whitespace from a string.\n */\nexport const trimEnd = (str: string): string => {\n let end = str.length;\n\n while (end > 0 && str.charCodeAt(end - 1) <= 32) end--;\n\n return end === str.length ? str : str.slice(0, end);\n};\n\n/**\n * Check if string starts with prefix.\n */\nexport const startsWith = (str: string, prefix: string): boolean => {\n return str.startsWith(prefix);\n};\n\n/**\n * Remove symmetrical leading and trailing quotes.\n */\nexport const unquote = (str: string): string => {\n const first = str[0];\n\n if (\n (first === '\"' || first === \"'\") &&\n str.length >= 2 &&\n str[str.length - 1] === first\n ) {\n return str.slice(1, -1);\n }\n\n return str;\n};\n\n/**\n * Unescape backslash-escaped characters.\n */\nexport const unescapeString = <T extends string | undefined>(rawString: T): T =>\n (rawString && rawString.indexOf('\\\\') !== -1\n ? rawString.replace(UNESCAPE_R, '$1')\n : rawString) as T;\n\n/**\n * Join class names, filtering out falsy values.\n */\nexport const cx = (...args: any[]): string => args.filter(Boolean).join(' ');\n\n/**\n * Get a nested property from an object using dot notation.\n */\nexport const get = (src: any, path: string, fb?: any): any => {\n // The overwhelming majority of paths are a single segment (a tag name), and\n // splitting those allocated two arrays per lookup.\n if (path.indexOf('.') === -1) return src?.[path] ?? fb;\n\n let ptr = src;\n const frags = path.split('.');\n\n while (frags.length) {\n ptr = ptr[frags[0]!];\n\n if (ptr === undefined) break;\n else frags.shift();\n }\n\n return ptr ?? fb;\n};\n\n// ============================================================================\n// SLUGIFY\n// ============================================================================\n\n/**\n * Convert a string to a URL-safe slug.\n * Based on https://stackoverflow.com/a/18123682/1141611\n */\nconst SLUGIFY_REPLACEMENTS: [pattern: RegExp, replacement: string][] = [\n [/[ÀÁÂÃÄÅàáâãä忯]/g, 'a'],\n [/[çÇ]/g, 'c'],\n [/[ðÐ]/g, 'd'],\n [/[ÈÉÊËéèêë]/g, 'e'],\n [/[ÏïÎîÍíÌì]/g, 'i'],\n [/[Ññ]/g, 'n'],\n [/[øØœŒÕõÔôÓóÒò]/g, 'o'],\n [/[ÜüÛûÚúÙù]/g, 'u'],\n [/[ŸÿÝý]/g, 'y'],\n];\nconst NON_ASCII_R = /[\\u0080-\\uffff]/;\nconst SLUGIFY_STRIP_R = /[^a-z0-9- ]/gi;\nconst SLUGIFY_SPACE_R = / /g;\n\nexport const slugify = (str: string): string => {\n let result = str;\n\n // Every transliteration matches non-ASCII only, so an ASCII heading — the\n // overwhelmingly common case — skips nine full passes over the string.\n if (NON_ASCII_R.test(result)) {\n for (let i = 0; i < SLUGIFY_REPLACEMENTS.length; i++) {\n const [pattern, replacement] = SLUGIFY_REPLACEMENTS[i]!;\n result = result.replace(pattern, replacement);\n }\n }\n\n result = result.replace(SLUGIFY_STRIP_R, '').replace(SLUGIFY_SPACE_R, '-');\n\n return result.toLowerCase();\n};\n\n// ============================================================================\n// SANITIZER\n// ============================================================================\n\nconst SANITIZE_R = /(javascript|vbscript|data(?!:image)):/i;\nconst SANITIZE_STRIP_R = /[^A-Za-z0-9/:]/g;\n\n/**\n * Sanitize URLs to prevent XSS attacks.\n * Returns null if the URL is unsafe.\n */\nexport const sanitizer = (input: string): string | null => {\n // `SANITIZE_R` only ever matches on a colon, and decoding can introduce one\n // solely through a percent escape — so a value with neither is safe as-is,\n // and skipping the decode avoids the bulk of the work on ordinary links.\n if (input.indexOf(':') === -1 && input.indexOf('%') === -1) return input;\n\n try {\n const decoded = decodeURIComponent(input).replace(SANITIZE_STRIP_R, '');\n\n if (SANITIZE_R.test(decoded)) {\n console.warn(\n 'Input contains an unsafe JavaScript/VBScript/data expression, it will not be rendered.',\n decoded\n );\n\n return null;\n }\n } catch (_e) {\n console.warn(\n 'Input could not be decoded due to malformed syntax or characters, it will not be rendered.',\n input\n );\n\n // decodeURIComponent sometimes throws a URIError\n return null;\n }\n\n return input;\n};\n\n// ============================================================================\n// WHITESPACE NORMALIZATION\n// ============================================================================\n\n/**\n * Normalize whitespace in source string.\n */\nexport const normalizeWhitespace = (source: string): string => {\n // Three `indexOf` probes beat one character-class regex here by a wide margin:\n // each is a native memchr over the source, and none of them normally match.\n // Each probe guards its own replacement too, so a source carrying only tabs —\n // the usual case — never rewrites for the other two, and every replacement is\n // a constant string instead of a callback the engine has to re-enter.\n let normalized = source;\n\n if (normalized.indexOf('\\t') !== -1) {\n normalized = normalized.replace(TAB_R, ' ');\n }\n if (normalized.indexOf('\\r') !== -1) {\n normalized = normalized.replace(CR_NEWLINE_R, '\\n');\n }\n if (normalized.indexOf('\\f') !== -1) {\n normalized = normalized.replace(FORMFEED_R, '');\n }\n\n return normalized;\n};\n\n/**\n * Safely remove a uniform leading indentation from lines, but do NOT touch\n * the content inside fenced code blocks (``` or ~~~).\n *\n * Inside a fenced block the structural indentation is irrelevant: what matters\n * is the indentation of the opening fence itself, which is the only amount\n * CommonMark strips from the code lines. A block nested in an indented HTML\n * element but written with its fence at column 0 therefore keeps its code\n * verbatim, instead of losing the first level of indentation.\n */\nexport const trimLeadingWhitespaceOutsideFences = (\n text: string,\n whitespace: string\n): string => {\n if (!whitespace) return text;\n\n const lines = text.split('\\n');\n\n /** Indentation and marker of the fence currently open, if any. */\n let openFence: { indentation: string; marker: string } | null = null;\n\n const removePrefix = (line: string, prefix: string): string =>\n prefix && line.startsWith(prefix) ? line.slice(prefix.length) : line;\n\n // Outside fences, strip the base structural indentation from every line.\n // Lines that don't start with the whitespace prefix are left as-is.\n const result = lines\n .map((line) => {\n const fenceMatch = line.match(FENCE_DELIMITER_R);\n\n if (!openFence) {\n if (fenceMatch)\n openFence = { indentation: fenceMatch[1]!, marker: fenceMatch[2]! };\n return removePrefix(line, whitespace);\n }\n\n const isClosingFence = fenceMatch?.[2]?.startsWith(openFence.marker);\n const { indentation } = openFence;\n\n if (isClosingFence) openFence = null;\n\n return removePrefix(line, indentation);\n })\n .join('\\n');\n\n return result;\n};\n\n/**\n * Normalize HTML attribute key to JSX prop name.\n */\nexport const normalizeAttributeKey = (key: string): string => {\n const hyphenIndex = key.indexOf('-');\n\n if (hyphenIndex !== -1 && key.match(HTML_CUSTOM_ATTR_R) === null) {\n key = key.replace(CAPTURE_LETTER_AFTER_HYPHEN, (_, letter) => {\n return letter.toUpperCase();\n });\n }\n\n return key;\n};\n\ntype StyleTuple = [key: string, value: string];\n\n/**\n * Parse a CSS style string into an array of [key, value] tuples.\n */\nexport const parseStyleAttribute = (styleString: string): StyleTuple[] => {\n const styles: StyleTuple[] = [];\n let buffer = '';\n let inUrl = false;\n let inQuotes = false;\n let quoteChar: '\"' | \"'\" | '' = '';\n\n if (!styleString) return styles;\n\n for (let i = 0; i < styleString.length; i++) {\n const char = styleString[i];\n\n if ((char === '\"' || char === \"'\") && !inUrl) {\n if (!inQuotes) {\n inQuotes = true;\n quoteChar = char;\n } else if (char === quoteChar) {\n inQuotes = false;\n quoteChar = '';\n }\n }\n\n if (char === '(' && buffer.endsWith('url')) {\n inUrl = true;\n } else if (char === ')' && inUrl) {\n inUrl = false;\n }\n\n if (char === ';' && !inQuotes && !inUrl) {\n const declaration = buffer.trim();\n\n if (declaration) {\n const colonIndex = declaration.indexOf(':');\n\n if (colonIndex > 0) {\n const key = declaration.slice(0, colonIndex).trim();\n const value = declaration.slice(colonIndex + 1).trim();\n styles.push([key, value]);\n }\n }\n buffer = '';\n } else {\n buffer += char;\n }\n }\n\n const declaration = buffer.trim();\n\n if (declaration) {\n const colonIndex = declaration.indexOf(':');\n if (colonIndex > 0) {\n const key = declaration.slice(0, colonIndex).trim();\n const value = declaration.slice(colonIndex + 1).trim();\n styles.push([key, value]);\n }\n }\n\n return styles;\n};\n\n/**\n * Convert an attribute value to a Node prop value.\n */\nexport const attributeValueToNodePropValue = (\n tag: string,\n key: string,\n value: string,\n sanitizeUrlFn: (\n value: string,\n tag: string,\n attribute: string\n ) => string | null\n): any => {\n if (key === 'style') {\n return parseStyleAttribute(value).reduce(\n (styles, [styleKey, styleValue]) => {\n const camelCasedKey = styleKey.replace(/(-[a-z])/g, (substr) =>\n substr[1]!.toUpperCase()\n );\n\n (styles as Record<string, any>)[camelCasedKey] = sanitizeUrlFn(\n styleValue,\n tag,\n styleKey\n );\n\n return styles;\n },\n {} as Record<string, any>\n );\n } else if (ATTRIBUTES_TO_SANITIZE.indexOf(key) !== -1) {\n return sanitizeUrlFn(unescapeString(value), tag, key);\n } else if (value.match(INTERPOLATION_R)) {\n value = unescapeString(value.slice(1, value.length - 1));\n }\n\n if (value === 'true') {\n return true;\n } else if (value === 'false') {\n return false;\n }\n\n return value;\n};\n\n// ============================================================================\n// TABLE PARSING\n// ============================================================================\n\n/**\n * Parse table alignment from a separator row.\n */\nexport const parseTableAlignCapture = (\n alignCapture: string\n): 'left' | 'right' | 'center' => {\n // All three patterns need a colon, and the right-align one backtracks across\n // the whole cell before failing — so reject colon-free cells up front.\n if (alignCapture.indexOf(':') === -1) return 'left';\n\n if (TABLE_RIGHT_ALIGN.test(alignCapture)) {\n return 'right';\n } else if (TABLE_CENTER_ALIGN.test(alignCapture)) {\n return 'center';\n } else if (TABLE_LEFT_ALIGN.test(alignCapture)) {\n return 'left';\n }\n\n return 'left';\n};\n\n/**\n * Parse table alignment row.\n */\nexport const parseTableAlign = (\n source: string\n): ('left' | 'right' | 'center')[] => {\n const alignText = source.replace(TABLE_TRIM_PIPES, '').split('|');\n return alignText.map(parseTableAlignCapture);\n};\n\n/**\n * Parse a single table row.\n */\nexport const parseTableRow = (\n source: string,\n parse: NestedParser,\n state: ParseState,\n tableOutput: boolean\n): ParserResult[][] => {\n const prevInTable = state.inTable;\n state.inTable = true;\n\n let rStart = 0;\n let rEnd = source.length;\n\n while (rStart < rEnd) {\n const c = source.charCodeAt(rStart);\n if (c === 32 || c === 9) rStart++;\n else break;\n }\n while (rEnd > rStart) {\n const c = source.charCodeAt(rEnd - 1);\n if (c === 32 || c === 9) rEnd--;\n else break;\n }\n\n // Trim leading pipe if present\n if (rStart < rEnd && source.charCodeAt(rStart) === 124 /* | */) {\n rStart++;\n }\n // Trim trailing pipe if present (and not escaped)\n if (\n rEnd > rStart &&\n source.charCodeAt(rEnd - 1) === 124 /* | */ &&\n (rEnd - 2 < rStart || source.charCodeAt(rEnd - 2) !== 92) /* \\ */\n ) {\n rEnd--;\n }\n\n if (!tableOutput) {\n const cell = parse(source.slice(rStart, rEnd), state);\n state.inTable = prevInTable;\n return [cell];\n }\n\n const cells: ParserResult[][] = [];\n const len = source.length;\n let cellStart = rStart;\n let i = rStart;\n\n /**\n * Parse one cell, dropping the padding an aligned table pads it with.\n *\n * GFM strips a cell's surrounding whitespace, so trimming is both the correct\n * output and the cheap one: the padding of a column-aligned table is a large\n * share of its bytes, and every space handed to `parse` costs a rule dispatch,\n * a capture and a lookbehind update. `trim` is a native scan, and walking the\n * padding back from the delimiter in JavaScript instead costs half as much\n * again as the whole row scan.\n */\n const parseCell = (from: number, to: number): ParserResult[] => {\n const cell = source.slice(from, to).trim();\n return cell === '' ? [] : parse(cell, state);\n };\n\n // Cursors on the only three characters that can end a run of ordinary cell\n // text. Each moves forward only, so the row is swept three times in total by\n // `indexOf` — cheaper than re-entering the regex engine once per character\n // found, which is what an anchored run scanner costs on a wide row.\n let pipeAt = -1;\n let escapeAt = -1;\n let backtickAt = -1;\n\n while (i < rEnd) {\n if (pipeAt < i) {\n const at = source.indexOf('|', i);\n pipeAt = at === -1 ? len : at;\n }\n if (escapeAt < i) {\n const at = source.indexOf('\\\\', i);\n escapeAt = at === -1 ? len : at;\n }\n if (backtickAt < i) {\n const at = source.indexOf('`', i);\n backtickAt = at === -1 ? len : at;\n }\n\n i = Math.min(pipeAt, escapeAt, backtickAt);\n if (i >= rEnd) break;\n\n // Escape: \\|\n if (i === escapeAt) {\n i += i + 1 < rEnd ? 2 : 1;\n continue;\n }\n // Code span: `...`\n if (i === backtickAt) {\n let backticks = 0;\n while (i < rEnd && source.charCodeAt(i) === 96) {\n backticks++;\n i++;\n }\n let found = false;\n while (i < rEnd && !found) {\n let closeBackticks = 0;\n while (i < rEnd && source.charCodeAt(i) === 96) {\n closeBackticks++;\n i++;\n }\n if (closeBackticks === backticks) {\n found = true;\n } else if (closeBackticks === 0) {\n i++;\n }\n }\n continue;\n }\n // Cell delimiter: |\n cells.push(parseCell(cellStart, i));\n i++;\n cellStart = i;\n }\n\n cells.push(parseCell(cellStart, rEnd));\n\n state.inTable = prevInTable;\n return cells;\n};\n\n/**\n * Parse table cells (multiple rows).\n */\nexport const parseTableCells = (\n source: string,\n parse: NestedParser,\n state: ParseState\n): ParserResult[][][] => {\n if (!source) return [];\n\n const result: ParserResult[][][] = [];\n let start = 0;\n const len = source.length;\n\n while (start < len) {\n let nextNewline = source.indexOf('\\n', start);\n if (nextNewline === -1) nextNewline = len;\n const rowText = source.slice(start, nextNewline);\n start = nextNewline + 1;\n\n // Check if row has non-whitespace content\n let hasContent = false;\n for (let j = 0; j < rowText.length; j++) {\n const c = rowText.charCodeAt(j);\n if (c !== 32 && c !== 9 && c !== 13) {\n hasContent = true;\n break;\n }\n }\n if (!hasContent) continue;\n\n result.push(parseTableRow(rowText, parse, state, true));\n }\n\n return result;\n};\n\n// ============================================================================\n// PARSING HELPERS\n// ============================================================================\n\n/**\n * Check if a rule qualifies for the current source and state.\n */\nexport const qualifies = (\n source: string,\n state: ParseState,\n qualify: NonNullable<Rule<any>['_qualify']>\n): boolean => {\n if (Array.isArray(qualify)) {\n for (let i = 0; i < qualify.length; i++) {\n if (startsWith(source, qualify[i]!)) return true;\n }\n\n return false;\n }\n\n return (qualify as (source: string, state: ParseState) => boolean)(\n source,\n state\n );\n};\n\n/**\n * Marks a matcher function as eligible for being run inside an inline context.\n */\nexport const allowInline = <T extends (...args: any[]) => any>(\n fn: T\n): T & { inline: 1 } => {\n (fn as any).inline = 1;\n return fn as T & { inline: 1 };\n};\n\n/**\n * Creates a match function for an inline scoped element from a regex.\n */\nexport const inlineRegex = (regex: RegExp) =>\n allowInline((source: string, state: ParseState): RegExpMatchArray | null => {\n if (state.inline) {\n return regex.exec(source);\n } else {\n return null;\n }\n });\n\n/**\n * Creates a match function for inline elements except links.\n */\nexport const simpleInlineRegex = (regex: RegExp) =>\n allowInline((source: string, state: ParseState): RegExpMatchArray | null => {\n if (state.inline || state.simple) {\n return regex.exec(source);\n } else {\n return null;\n }\n });\n\n/**\n * Creates a match function for a block scoped element from a regex.\n */\nexport const blockRegex =\n (regex: RegExp) =>\n (source: string, state: ParseState): RegExpMatchArray | null => {\n if (state.inline || state.simple) {\n return null;\n } else {\n return regex.exec(source);\n }\n };\n\n/**\n * Creates a match function from a regex, ignoring block/inline scope.\n */\nexport const anyScopeRegex = (\n fn: RegExp | ((source: string, state: ParseState) => RegExpMatchArray | null)\n) =>\n allowInline((source: string, state: ParseState): RegExpMatchArray | null => {\n if (typeof fn === 'function') {\n return fn(source, state);\n }\n return fn.exec(source);\n });\n\n/**\n * Parse inline content (including links).\n */\nexport const parseInline = (\n parse: NestedParser,\n children: string,\n state: ParseState\n): ParserResult[] => {\n const isCurrentlyInline = state.inline ?? false;\n const isCurrentlySimple = state.simple ?? false;\n state.inline = true;\n state.simple = true;\n const result = parse(children, state);\n state.inline = isCurrentlyInline;\n state.simple = isCurrentlySimple;\n\n return result;\n};\n\n/**\n * Parse simple inline content (no links).\n */\nexport const parseSimpleInline = (\n parse: NestedParser,\n children: string,\n state: ParseState\n): ParserResult[] => {\n const isCurrentlyInline = state.inline ?? false;\n const isCurrentlySimple = state.simple ?? false;\n\n state.inline = false;\n state.simple = true;\n const result = parse(children, state);\n state.inline = isCurrentlyInline;\n state.simple = isCurrentlySimple;\n\n return result;\n};\n\n/**\n * Parse block content.\n */\nexport const parseBlock = (\n parse: NestedParser,\n children: string,\n state: ParseState = {}\n): ParserResult[] => {\n const isCurrentlyInline = state.inline || false;\n state.inline = false;\n const normalizedChildren = trimEnd(children);\n const needsTerminator = /\\n\\n$/.test(normalizedChildren) === false;\n const blockInput = needsTerminator\n ? normalizedChildren.endsWith('\\n')\n ? `${normalizedChildren}\\n`\n : `${normalizedChildren}\\n\\n`\n : normalizedChildren;\n\n const result = parse(blockInput, state);\n state.inline = isCurrentlyInline;\n\n return result;\n};\n\n/**\n * Helper to parse capture group 2 as inline content.\n */\nexport const parseCaptureInline = (\n capture: RegExpMatchArray,\n parse: NestedParser,\n state: ParseState\n): { children: ParserResult[] } => {\n return {\n children: parseInline(parse, capture[2] ?? '', state),\n };\n};\n\n/**\n * Helper that captures nothing (empty object).\n */\nexport const captureNothing = (): Record<string, never> => ({});\n\n/**\n * Helper that renders nothing (null).\n */\nexport const renderNothing = (): null => null;\n\n/**\n * Check if any regex in a list matches the input.\n */\n/**\n * A block-syntax probe: either a regex to test, or a predicate for the rules\n * whose regex was replaced by a linear scanner.\n */\nexport type BlockSyntaxProbe = RegExp | ((input: string) => boolean);\n\nexport const some = (probes: BlockSyntaxProbe[], input: string): boolean => {\n for (let i = 0; i < probes.length; i++) {\n const probe = probes[i]!;\n if (typeof probe === 'function' ? probe(input) : probe.test(input)) {\n return true;\n }\n }\n return false;\n};\n"],"mappings":";;;;;;AAwBA,MAAa,WAAW,QAAwB;CAC9C,IAAI,MAAM,IAAI;CAEd,OAAO,MAAM,KAAK,IAAI,WAAW,MAAM,CAAC,KAAK,IAAI;CAEjD,OAAO,QAAQ,IAAI,SAAS,MAAM,IAAI,MAAM,GAAG,GAAG;AACpD;;;;AAKA,MAAa,cAAc,KAAa,WAA4B;CAClE,OAAO,IAAI,WAAW,MAAM;AAC9B;;;;AAKA,MAAa,WAAW,QAAwB;CAC9C,MAAM,QAAQ,IAAI;CAElB,KACG,UAAU,QAAO,UAAU,QAC5B,IAAI,UAAU,KACd,IAAI,IAAI,SAAS,OAAO,OAExB,OAAO,IAAI,MAAM,GAAG,EAAE;CAGxB,OAAO;AACT;;;;AAKA,MAAa,kBAAgD,cAC1D,aAAa,UAAU,QAAQ,IAAI,MAAM,KACtC,UAAU,QAAQ,YAAY,IAAI,IAClC;;;;AAKN,MAAa,MAAM,GAAG,SAAwB,KAAK,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;;;;AAK3E,MAAa,OAAO,KAAU,MAAc,OAAkB;CAG5D,IAAI,KAAK,QAAQ,GAAG,MAAM,IAAI,OAAO,MAAM,SAAS;CAEpD,IAAI,MAAM;C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QAA4B,UAA2B;CAC1E,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;EACtC,MAAM,QAAQ,OAAO;EACrB,IAAI,OAAO,UAAU,aAAa,MAAM,KAAK,IAAI,MAAM,KAAK,KAAK,GAC/D,OAAO;CAEX;CACA,OAAO;AACT"}
|
|
@@ -17,7 +17,7 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
|
17
17
|
* 'en'
|
|
18
18
|
* ); // → { title: { nodeType: 'translation', translation: { en: 'New' } } }
|
|
19
19
|
*/
|
|
20
|
-
declare const getEditedContent: (previousContent: ContentNode | undefined, newContent: ContentNode, defaultLocale: LocalesValues) => ContentNode;
|
|
20
|
+
export declare const getEditedContent: (previousContent: ContentNode | undefined, newContent: ContentNode, defaultLocale: LocalesValues) => ContentNode;
|
|
21
21
|
/**
|
|
22
22
|
* Dictionary-level wrapper around {@link getEditedContent}. Returns a partial
|
|
23
23
|
* dictionary (same `key`) whose `content` holds only the changed source nodes.
|
|
@@ -26,7 +26,6 @@ declare const getEditedContent: (previousContent: ContentNode | undefined, newCo
|
|
|
26
26
|
* @param newDictionary - Dictionary state after the edit.
|
|
27
27
|
* @param defaultLocale - The source locale to diff against.
|
|
28
28
|
*/
|
|
29
|
-
declare const getEditedDictionary: (previousDictionary: Dictionary | undefined, newDictionary: Dictionary, defaultLocale: LocalesValues) => Dictionary;
|
|
29
|
+
export declare const getEditedDictionary: (previousDictionary: Dictionary | undefined, newDictionary: Dictionary, defaultLocale: LocalesValues) => Dictionary;
|
|
30
30
|
//#endregion
|
|
31
|
-
export { getEditedContent, getEditedDictionary };
|
|
32
31
|
//# sourceMappingURL=getEditedContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEditedContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getEditedContent.ts"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getEditedContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getEditedContent.ts"],"mappings":";;;;;;;;;;;;;;;;;;;qBA2Ka,mBAAgB,iBACV,yBAAuB,YAC5B,aAAW,eACR,kBACd;;;;;;;;;qBAeU,sBAAmB,oBACV,wBAAsB,eAC3B,YAAU,eACV,kBACd"}
|
|
@@ -4,7 +4,7 @@ import { ContentNode, Dictionary } from "@intlayer/types/dictionary";
|
|
|
4
4
|
import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
5
5
|
//#region src/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts
|
|
6
6
|
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
7
|
-
declare const filterMissingTranslationsOnlyPlugin: (localeToCheck: LocalesValues) => Plugins;
|
|
7
|
+
export declare const filterMissingTranslationsOnlyPlugin: (localeToCheck: LocalesValues) => Plugins;
|
|
8
8
|
/**
|
|
9
9
|
* For each translation node, it compare is both localeToCheck and baseLocale are present.
|
|
10
10
|
*
|
|
@@ -19,8 +19,8 @@ declare const filterMissingTranslationsOnlyPlugin: (localeToCheck: LocalesValues
|
|
|
19
19
|
* { test2: t({ ar: 'Hello', en: 'Hello' }) } -> { test2: t({ ar: 'Hello', en: 'Hello' }) }
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
-
declare const getFilterMissingTranslationsContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, localeToCheck: L, nodeProps: NodeProps) => any;
|
|
23
|
-
declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, localeToCheck: LocalesValues) => {
|
|
22
|
+
export declare const getFilterMissingTranslationsContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, localeToCheck: L, nodeProps: NodeProps) => any;
|
|
23
|
+
export declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, localeToCheck: LocalesValues) => {
|
|
24
24
|
$schema?: "https://intlayer.org/schema.json";
|
|
25
25
|
id?: import("@intlayer/types").DictionaryId;
|
|
26
26
|
projectIds?: string[];
|
|
@@ -48,5 +48,4 @@ declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, l
|
|
|
48
48
|
content: any;
|
|
49
49
|
};
|
|
50
50
|
//#endregion
|
|
51
|
-
export { filterMissingTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary };
|
|
52
51
|
//# sourceMappingURL=getFilterMissingTranslationsContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilterMissingTranslationsContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterMissingTranslationsContent.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"getFilterMissingTranslationsContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterMissingTranslationsContent.ts"],"mappings":";;;;;;qBAoMa,sCAAmC,eAC/B,kBACd;;;;;;;;;;;;;;;qBA6LU,sCACX,UAAU,aACV,UAAU,gBAAgB,iBAAe,MAEnC,GAAC,eACQ,GAAC,WACL;qBAoBA,yCAAsC,YACrC,YAAU,eACP"}
|
|
@@ -4,15 +4,15 @@ import { ContentNode, Dictionary } from "@intlayer/types/dictionary";
|
|
|
4
4
|
import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
5
5
|
//#region src/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts
|
|
6
6
|
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
7
|
-
declare const filterTranslationsOnlyPlugin: (locale: LocalesValues, fallback?: LocalesValues) => Plugins;
|
|
7
|
+
export declare const filterTranslationsOnlyPlugin: (locale: LocalesValues, fallback?: LocalesValues) => Plugins;
|
|
8
8
|
/**
|
|
9
9
|
* Return the content of a node with only the translation plugin.
|
|
10
10
|
*
|
|
11
11
|
* @param node The node to transform.
|
|
12
12
|
* @param locale The locale to use if your transformers need it (e.g. for translations).
|
|
13
13
|
*/
|
|
14
|
-
declare const getFilterTranslationsOnlyContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, locale: L, nodeProps: NodeProps, fallback?: LocalesValues) => DeepTransformContent<T>;
|
|
15
|
-
declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, locale?: LocalesValues, fallback?: LocalesValues) => {
|
|
14
|
+
export declare const getFilterTranslationsOnlyContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, locale: L, nodeProps: NodeProps, fallback?: LocalesValues) => DeepTransformContent<T>;
|
|
15
|
+
export declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, locale?: LocalesValues, fallback?: LocalesValues) => {
|
|
16
16
|
$schema?: "https://intlayer.org/schema.json";
|
|
17
17
|
id?: import("@intlayer/types").DictionaryId;
|
|
18
18
|
projectIds?: string[];
|
|
@@ -40,5 +40,4 @@ declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, loca
|
|
|
40
40
|
content: any;
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
43
|
-
export { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary };
|
|
44
43
|
//# sourceMappingURL=getFilterTranslationsOnlyContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilterTranslationsOnlyContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"getFilterTranslationsOnlyContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts"],"mappings":";;;;;;qBAqCa,+BAA4B,QAC/B,eAAa,WACV,kBACV;;;;;;;qBAoFU,mCACX,UAAU,aACV,UAAU,gBAAgB,iBAAe,MAEnC,GAAC,QACC,GAAC,WAEE,WAAS,WACT,kBAUL,qBAAqB;qBAGhB,sCAAmC,YAClC,YAAU,SACd,eAAa,WAEV"}
|
|
@@ -3,8 +3,8 @@ import "../interpreter/index.js";
|
|
|
3
3
|
import { ContentNode, Dictionary } from "@intlayer/types/dictionary";
|
|
4
4
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
5
5
|
//#region src/deepTransformPlugins/getFilteredLocalesContent.d.ts
|
|
6
|
-
declare const getFilteredLocalesContent: (node: ContentNode, locales: LocalesValues | LocalesValues[], nodeProps: NodeProps) => any;
|
|
7
|
-
declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: LocalesValues | LocalesValues[]) => {
|
|
6
|
+
export declare const getFilteredLocalesContent: (node: ContentNode, locales: LocalesValues | LocalesValues[], nodeProps: NodeProps) => any;
|
|
7
|
+
export declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: LocalesValues | LocalesValues[]) => {
|
|
8
8
|
$schema?: "https://intlayer.org/schema.json";
|
|
9
9
|
id?: import("@intlayer/types").DictionaryId;
|
|
10
10
|
projectIds?: string[];
|
|
@@ -32,5 +32,4 @@ declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: Loc
|
|
|
32
32
|
content: any;
|
|
33
33
|
};
|
|
34
34
|
//#endregion
|
|
35
|
-
export { getFilteredLocalesContent, getFilteredLocalesDictionary };
|
|
36
35
|
//# sourceMappingURL=getFilteredLocalesContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilteredLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilteredLocalesContent.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"getFilteredLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilteredLocalesContent.ts"],"mappings":";;;;;qBAuCa,4BAAyB,MAC9B,aAAW,SACR,gBAAgB,iBAAe,WAC7B;qBAwBA,+BAA4B,YAC3B,YAAU,QACd,gBAAgB"}
|
|
@@ -11,8 +11,7 @@ import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentat
|
|
|
11
11
|
* @param node The node to transform.
|
|
12
12
|
* @param locale The locale to use if your transformers need it (e.g. for translations).
|
|
13
13
|
*/
|
|
14
|
-
declare const getLocalizedContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, locale: L, nodeProps: NodeProps, fallback?: LocalesValues) => DeepTransformContent<T>;
|
|
15
|
-
declare const getPerLocaleDictionary: <T extends Dictionary, L extends LocalesValues>(dictionary: T, locale: L, fallback?: LocalesValues) => Dictionary;
|
|
14
|
+
export declare const getLocalizedContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, locale: L, nodeProps: NodeProps, fallback?: LocalesValues) => DeepTransformContent<T>;
|
|
15
|
+
export declare const getPerLocaleDictionary: <T extends Dictionary, L extends LocalesValues>(dictionary: T, locale: L, fallback?: LocalesValues) => Dictionary;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { getLocalizedContent, getPerLocaleDictionary };
|
|
18
17
|
//# sourceMappingURL=getLocalizedContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocalizedContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getLocalizedContent.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getLocalizedContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getLocalizedContent.ts"],"mappings":";;;;;;;;;;;;;qBAqBa,sBACX,UAAU,aACV,UAAU,gBAAgB,iBAAe,MAEnC,GAAC,QACC,GAAC,WACE,WAAS,WACT,kBAUL,qBAAqB;qBAGhB,yBACX,UAAU,YACV,UAAU,eAAa,YAEX,GAAC,QACL,GAAC,WACE,kBACV"}
|
|
@@ -3,8 +3,7 @@ import "../interpreter/index.js";
|
|
|
3
3
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
4
|
//#region src/deepTransformPlugins/getMaskContent.d.ts
|
|
5
5
|
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
6
|
-
declare const buildMaskPlugin: Plugins;
|
|
7
|
-
declare const getMaskContent: (source: Dictionary) => any;
|
|
6
|
+
export declare const buildMaskPlugin: Plugins;
|
|
7
|
+
export declare const getMaskContent: (source: Dictionary) => any;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { buildMaskPlugin, getMaskContent };
|
|
10
9
|
//# sourceMappingURL=getMaskContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMaskContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getMaskContent.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"getMaskContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getMaskContent.ts"],"mappings":";;;;;qBAYa,iBAAiB;qBAMjB,iBAAc,QAAY"}
|
|
@@ -5,15 +5,14 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
|
5
5
|
import { Locale } from "@intlayer/types/allLocales";
|
|
6
6
|
//#region src/deepTransformPlugins/getMissingLocalesContent.d.ts
|
|
7
7
|
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
8
|
-
declare const checkMissingLocalesPlugin: (locales: Locale[], onMissingLocale: (locale: Locale) => void) => Plugins;
|
|
8
|
+
export declare const checkMissingLocalesPlugin: (locales: Locale[], onMissingLocale: (locale: Locale) => void) => Plugins;
|
|
9
9
|
/**
|
|
10
10
|
* Return the content of a node with only the translation plugin.
|
|
11
11
|
*
|
|
12
12
|
* @param node The node to transform.
|
|
13
13
|
* @param locales The locales to check for missing translations.
|
|
14
14
|
*/
|
|
15
|
-
declare const getMissingLocalesContent: <T extends ContentNode>(node: T, locales: LocalesValues[], nodeProps: NodeProps) => Locale[];
|
|
16
|
-
declare const getMissingLocalesContentFromDictionary: (dictionary: Dictionary, locales?: LocalesValues[]) => Locale[];
|
|
15
|
+
export declare const getMissingLocalesContent: <T extends ContentNode>(node: T, locales: LocalesValues[], nodeProps: NodeProps) => Locale[];
|
|
16
|
+
export declare const getMissingLocalesContentFromDictionary: (dictionary: Dictionary, locales?: LocalesValues[]) => Locale[];
|
|
17
17
|
//#endregion
|
|
18
|
-
export { checkMissingLocalesPlugin, getMissingLocalesContent, getMissingLocalesContentFromDictionary };
|
|
19
18
|
//# sourceMappingURL=getMissingLocalesContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMissingLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getMissingLocalesContent.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"getMissingLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getMissingLocalesContent.ts"],"mappings":";;;;;;;qBAiGa,4BAAyB,SAC3B,UAAQ,kBACC,QAAQ,oBACzB;;;;;;;qBAuGU,2BAA4B,UAAU,aAAW,MACtD,GAAC,SACE,iBAAe,WAEb,cACV;qBAuBU,yCAAsC,YACrC,YAAU,UACb,oBAAe"}
|
|
@@ -25,7 +25,6 @@ import { Dictionary } from "@intlayer/types/dictionary";
|
|
|
25
25
|
* }
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
declare const getMultilingualDictionary: (dictionary: Dictionary) => Dictionary;
|
|
28
|
+
export declare const getMultilingualDictionary: (dictionary: Dictionary) => Dictionary;
|
|
29
29
|
//#endregion
|
|
30
|
-
export { getMultilingualDictionary };
|
|
31
30
|
//# sourceMappingURL=getMultilingualDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMultilingualDictionary.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getMultilingualDictionary.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getMultilingualDictionary.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getMultilingualDictionary.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmCa,4BAAyB,YACxB,eACX"}
|
|
@@ -2,7 +2,6 @@ import { NodeProps } from "../interpreter/getContent/plugins.js";
|
|
|
2
2
|
import "../interpreter/index.js";
|
|
3
3
|
import { ContentNode } from "@intlayer/types/dictionary";
|
|
4
4
|
//#region src/deepTransformPlugins/getReplacedValuesContent.d.ts
|
|
5
|
-
declare const getReplacedValuesContent: (node: ContentNode, value: string | number | boolean, nodeProps: NodeProps) => any;
|
|
5
|
+
export declare const getReplacedValuesContent: (node: ContentNode, value: string | number | boolean, nodeProps: NodeProps) => any;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { getReplacedValuesContent };
|
|
8
7
|
//# sourceMappingURL=getReplacedValuesContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getReplacedValuesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getReplacedValuesContent.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"getReplacedValuesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getReplacedValuesContent.ts"],"mappings":";;;;qBA8Da,2BAAwB,MAC7B,aAAW,kCACe,WACrB"}
|
|
@@ -4,7 +4,7 @@ import { DeclaredLocales } from "@intlayer/types/module_augmentation";
|
|
|
4
4
|
type SplittedContentOutput<T = ContentNode> = Record<DeclaredLocales, T> & {
|
|
5
5
|
common: T;
|
|
6
6
|
};
|
|
7
|
-
declare const getSplittedContent: (content: ContentNode) => SplittedContentOutput;
|
|
7
|
+
export declare const getSplittedContent: (content: ContentNode) => SplittedContentOutput;
|
|
8
8
|
/**
|
|
9
9
|
* Splits the `content` field of a Dictionary into "common" and per-locale buckets.
|
|
10
10
|
*
|
|
@@ -36,7 +36,6 @@ declare const getSplittedContent: (content: ContentNode) => SplittedContentOutpu
|
|
|
36
36
|
* @param dictionary - The input dictionary object with possible multilingual or common content.
|
|
37
37
|
* @returns An object mapping "common" and each locale to their corresponding content subtrees.
|
|
38
38
|
*/
|
|
39
|
-
declare const getSplittedDictionaryContent: (dictionary: Dictionary) => SplittedContentOutput<Dictionary['content']>;
|
|
39
|
+
export declare const getSplittedDictionaryContent: (dictionary: Dictionary) => SplittedContentOutput<Dictionary['content']>;
|
|
40
40
|
//#endregion
|
|
41
|
-
export { getSplittedContent, getSplittedDictionaryContent };
|
|
42
41
|
//# sourceMappingURL=getSplittedContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSplittedContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getSplittedContent.ts"],"mappings":";;;KAIK,sBAAsB,IAAI,eAAe,OAAO,iBAAiB;EACpE,QAAQ;;
|
|
1
|
+
{"version":3,"file":"getSplittedContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getSplittedContent.ts"],"mappings":";;;KAIK,sBAAsB,IAAI,eAAe,OAAO,iBAAiB;EACpE,QAAQ;;qBAsKG,qBAAkB,SACpB,gBACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAkDU,+BAA4B,YAC3B,eACX,sBAAsB"}
|
|
@@ -18,7 +18,6 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
|
18
18
|
* // With locale - insert content for specific locale
|
|
19
19
|
* insertContentInDictionary(dictionary, { title: 'このページ' }, 'ja')
|
|
20
20
|
*/
|
|
21
|
-
declare const insertContentInDictionary: (dictionary: Dictionary, content: Dictionary['content'], locale?: LocalesValues) => Dictionary;
|
|
21
|
+
export declare const insertContentInDictionary: (dictionary: Dictionary, content: Dictionary['content'], locale?: LocalesValues) => Dictionary;
|
|
22
22
|
//#endregion
|
|
23
|
-
export { insertContentInDictionary };
|
|
24
23
|
//# sourceMappingURL=insertContentInDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertContentInDictionary.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/insertContentInDictionary.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"insertContentInDictionary.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/insertContentInDictionary.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;qBAkQa,4BAAyB,YACxB,YAAU,SACb,uBAAqB,SACrB,kBACR"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ContentNode } from "@intlayer/types/dictionary";
|
|
2
2
|
import { KeyPath } from "@intlayer/types/keyPath";
|
|
3
3
|
//#region src/dictionaryManipulator/editDictionaryByKeyPath.d.ts
|
|
4
|
-
declare const editDictionaryByKeyPath: (dictionaryContent: ContentNode, keyPath: KeyPath[], newValue: ContentNode) => ContentNode;
|
|
4
|
+
export declare const editDictionaryByKeyPath: (dictionaryContent: ContentNode, keyPath: KeyPath[], newValue: ContentNode) => ContentNode;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { editDictionaryByKeyPath };
|
|
7
6
|
//# sourceMappingURL=editDictionaryByKeyPath.d.ts.map
|