UNPKG

@intlayer/core

Version:

Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.

91 lines (90 loc) 13.8 kB
import { getCondition } from "./interpreter/getCondition.mjs"; import { deepTransformNode } from "./interpreter/getContent/deepTransform.mjs"; import { findMatchingCondition, getEnumeration } from "./interpreter/getEnumeration.mjs"; import { getDictionary } from "./interpreter/getDictionary.mjs"; import { getIntlayer } from "./interpreter/getIntlayer.mjs"; import { getNesting } from "./interpreter/getNesting.mjs"; import { CachedIntl, bindIntl, getCachedIntl } from "./utils/intl.mjs"; import { compact } from "./formatters/compact.mjs"; import { currency } from "./formatters/currency.mjs"; import { date, presets } from "./formatters/date.mjs"; import { list } from "./formatters/list.mjs"; import { number } from "./formatters/number.mjs"; import { percentage } from "./formatters/percentage.mjs"; import { relativeTime } from "./formatters/relativeTime.mjs"; import { units } from "./formatters/units.mjs"; import { getPlural } from "./interpreter/getPlural.mjs"; import { getTranslation } from "./interpreter/getTranslation.mjs"; import { conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, translationPlugin } from "./interpreter/getContent/plugins.mjs"; import { getBasePlugins, getContent } from "./interpreter/getContent/getContent.mjs"; import { getHTML } from "./interpreter/getHTML.mjs"; import { splitInsertionTemplate } from "./interpreter/splitAndJoinInsertion.mjs"; import { getFilteredLocalesContent, getFilteredLocalesDictionary } from "./deepTransformPlugins/getFilteredLocalesContent.mjs"; import { cond as condition } from "./transpiler/condition/condition.mjs"; import { enu as enumeration } from "./transpiler/enumeration/enumeration.mjs"; import { gender } from "./transpiler/gender/gender.mjs"; import { VOID_HTML_ELEMENTS, validateHTML } from "./transpiler/html/validateHTML.mjs"; import { html } from "./transpiler/html/html.mjs"; import { HTML_TAGS } from "./transpiler/html/htmlTags.mjs"; import { getInsertionValues } from "./transpiler/insertion/getInsertionValues.mjs"; import { insert as insertion } from "./transpiler/insertion/insertion.mjs"; import { parseYaml } from "./utils/parseYaml.mjs"; import { getMarkdownMetadata } from "./transpiler/markdown/getMarkdownMetadata.mjs"; import { validateMarkdown } from "./transpiler/markdown/validateMarkdown.mjs"; import { md as markdown } from "./transpiler/markdown/markdown.mjs"; import { nest as nesting } from "./transpiler/nesting/nesting.mjs"; import { plural } from "./transpiler/plural/plural.mjs"; import { t as translation } from "./transpiler/translation/translation.mjs"; import { filterMissingTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary } from "./deepTransformPlugins/getFilterMissingTranslationsContent.mjs"; import { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary } from "./deepTransformPlugins/getFilterTranslationsOnlyContent.mjs"; import { getLocalizedContent, getPerLocaleDictionary } from "./deepTransformPlugins/getLocalizedContent.mjs"; import { buildMaskPlugin, getMaskContent } from "./deepTransformPlugins/getMaskContent.mjs"; import { checkMissingLocalesPlugin, getMissingLocalesContent, getMissingLocalesContentFromDictionary } from "./deepTransformPlugins/getMissingLocalesContent.mjs"; import { getMultilingualDictionary } from "./deepTransformPlugins/getMultilingualDictionary.mjs"; import { getReplacedValuesContent } from "./deepTransformPlugins/getReplacedValuesContent.mjs"; import { getSplittedContent, getSplittedDictionaryContent } from "./deepTransformPlugins/getSplittedContent.mjs"; import { insertContentInDictionary } from "./deepTransformPlugins/insertContentInDictionary.mjs"; import { editDictionaryByKeyPath } from "./dictionaryManipulator/editDictionaryByKeyPath.mjs"; import { getContentNodeByKeyPath } from "./dictionaryManipulator/getContentNodeByKeyPath.mjs"; import { getDefaultNode } from "./dictionaryManipulator/getDefaultNode.mjs"; import { getEmptyNode } from "./dictionaryManipulator/getEmptyNode.mjs"; import { getNodeChildren } from "./dictionaryManipulator/getNodeChildren.mjs"; import { isValidElement } from "./utils/isValidReactElement.mjs"; import { getNodeType } from "./dictionaryManipulator/getNodeType.mjs"; import { mergeDictionaries } from "./dictionaryManipulator/mergeDictionaries.mjs"; import { orderDictionaries } from "./dictionaryManipulator/orderDictionaries.mjs"; import { normalizeDictionaries, normalizeDictionary } from "./dictionaryManipulator/normalizeDictionary.mjs"; import { removeContentNodeByKeyPath } from "./dictionaryManipulator/removeContentNodeByKeyPath.mjs"; import { renameContentNodeByKeyPath } from "./dictionaryManipulator/renameContentNodeByKeyPath.mjs"; import { updateNodeChildren } from "./dictionaryManipulator/updateNodeChildren.mjs"; import { checkIsURLAbsolute } from "./utils/checkIsURLAbsolute.mjs"; import { getPathWithoutLocale } from "./localization/getPathWithoutLocale.mjs"; import { getPrefix } from "./localization/getPrefix.mjs"; import { getCanonicalPath, getInternalPath, getLocalizedPath, getRewritePath, getRewriteRules } from "./localization/rewriteUtils.mjs"; import { getLocalizedUrl } from "./localization/getLocalizedUrl.mjs"; import { getMultilingualUrls } from "./localization/getMultilingualUrls.mjs"; import { generateSitemap, generateSitemapUrl } from "./localization/generateSitemap.mjs"; import { getCookie } from "./utils/getCookie.mjs"; import { LocaleStorage, LocaleStorageClient, LocaleStorageServer, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, localeStorageOptions, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer } from "./utils/localeStorage.mjs"; import { localeResolver } from "./localization/localeResolver.mjs"; import { localeDetector } from "./localization/localeDetector.mjs"; import { getBrowserLocale } from "./localization/getBrowserLocale.mjs"; import { getHTMLTextDir } from "./localization/getHTMLTextDir.mjs"; import { getLocale } from "./localization/getLocale.mjs"; import { getLocaleFromPath } from "./localization/getLocaleFromPath.mjs"; import { getLocaleLang } from "./localization/getLocaleLang.mjs"; import { getLocaleName } from "./localization/getLocaleName.mjs"; import { localeFlatMap, localeMap, localeRecord } from "./localization/localeMapper.mjs"; import { validatePrefix } from "./localization/validatePrefix.mjs"; import { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_TO_NODE_PROP_MAP, ATTR_EXTRACTOR_R, BLOCKQUOTE_ALERT_R, BLOCKQUOTE_R, BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, BLOCK_END_R, BREAK_LINE_R, BREAK_THEMATIC_R, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CUSTOM_COMPONENT_R, DO_NOT_PROCESS_HTML_ELEMENTS, DURATION_DELAY_TRIGGER, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, GFM_TASK_R, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, HTML_BLOCK_ELEMENT_R, HTML_CHAR_CODE_R, HTML_COMMENT_R, HTML_CUSTOM_ATTR_R, HTML_LEFT_TRIM_AMOUNT_R, HTML_SELF_CLOSING_ELEMENT_R, INLINE_SKIP_R, INTERPOLATION_R, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LIST_LOOKBEHIND_R, LOOKAHEAD, NAMED_CODES_TO_UNICODE, NP_TABLE_R, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, PARAGRAPH_R, Priority, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, RuleType, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, TABLE_CENTER_ALIGN, TABLE_LEFT_ALIGN, TABLE_RIGHT_ALIGN, TABLE_TRIM_PIPES, TAB_R, TEXT_BOLD_R, TEXT_EMPHASIZED_R, TEXT_ESCAPED_R, TEXT_MARKED_R, TEXT_PLAIN_R, TEXT_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, UNESCAPE_R, UNORDERED, UNORDERED_LIST_BULLET, UNORDERED_LIST_ITEM_PREFIX, UNORDERED_LIST_ITEM_PREFIX_R, UNORDERED_LIST_ITEM_R, UNORDERED_LIST_R, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex } from "./markdown/constants.mjs"; import { allowInline, anyScopeRegex, attributeValueToNodePropValue, blockRegex, captureNothing, cx, get, inlineRegex, normalizeAttributeKey, normalizeWhitespace, parseBlock, parseCaptureInline, parseInline, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, qualifies, renderNothing, sanitizer, simpleInlineRegex, slugify, some, startsWith, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, unquote } from "./markdown/utils.mjs"; import { parserFor } from "./markdown/parser.mjs"; import { createRenderer, renderFor } from "./markdown/renderer.mjs"; import { compile, compileWithOptions, createCompiler, parseMarkdown, renderMarkdownAst } from "./markdown/compiler.mjs"; import { icuToIntlayerFormatter, intlayerToICUFormatter } from "./messageFormat/ICU.mjs"; import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./messageFormat/i18next.mjs"; import { intlayerToPortableObjectFormatter, portableObjectToIntlayerFormatter } from "./messageFormat/po.mjs"; import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./messageFormat/vue-i18n.mjs"; import { isSameKeyPath } from "./utils/isSameKeyPath.mjs"; import { stringifyYaml } from "./utils/stringifyYaml.mjs"; export { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_TO_NODE_PROP_MAP, ATTR_EXTRACTOR_R, BLOCKQUOTE_ALERT_R, BLOCKQUOTE_R, BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, BLOCK_END_R, BREAK_LINE_R, BREAK_THEMATIC_R, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CUSTOM_COMPONENT_R, CachedIntl, CachedIntl as Intl, DO_NOT_PROCESS_HTML_ELEMENTS, DURATION_DELAY_TRIGGER, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, GFM_TASK_R, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, HTML_BLOCK_ELEMENT_R, HTML_CHAR_CODE_R, HTML_COMMENT_R, HTML_CUSTOM_ATTR_R, HTML_LEFT_TRIM_AMOUNT_R, HTML_SELF_CLOSING_ELEMENT_R, HTML_TAGS, INLINE_SKIP_R, INTERPOLATION_R, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LIST_LOOKBEHIND_R, LOOKAHEAD, LocaleStorage, LocaleStorageClient, LocaleStorageServer, NAMED_CODES_TO_UNICODE, NP_TABLE_R, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, PARAGRAPH_R, Priority, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, RuleType, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, TABLE_CENTER_ALIGN, TABLE_LEFT_ALIGN, TABLE_RIGHT_ALIGN, TABLE_TRIM_PIPES, TAB_R, TEXT_BOLD_R, TEXT_EMPHASIZED_R, TEXT_ESCAPED_R, TEXT_MARKED_R, TEXT_PLAIN_R, TEXT_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, UNESCAPE_R, UNORDERED, UNORDERED_LIST_BULLET, UNORDERED_LIST_ITEM_PREFIX, UNORDERED_LIST_ITEM_PREFIX_R, UNORDERED_LIST_ITEM_R, UNORDERED_LIST_R, VOID_HTML_ELEMENTS, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTML, getHTMLTextDir, getInsertionValues, getInternalPath, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPlural, getPrefix, getReplacedValuesContent, getRewritePath, getRewriteRules, getSplittedContent, getSplittedDictionaryContent, getTranslation, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseInline, parseMarkdown, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, parseYaml, parserFor, percentage, plural, pluralPlugin, portableObjectToIntlayerFormatter, presets, qualifies, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, sanitizer, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter };