@intlayer/core 9.8.0 → 9.8.2

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.
Files changed (34) hide show
  1. package/dist/cjs/dictionaryManipulator/index.cjs +1 -0
  2. package/dist/cjs/dictionaryManipulator/qualifiedDynamicLoader.cjs +15 -1
  3. package/dist/cjs/dictionaryManipulator/qualifiedDynamicLoader.cjs.map +1 -1
  4. package/dist/cjs/index.cjs +3 -0
  5. package/dist/cjs/interpreter/dictionaryTransformCache.cjs +40 -0
  6. package/dist/cjs/interpreter/dictionaryTransformCache.cjs.map +1 -1
  7. package/dist/cjs/interpreter/index.cjs +2 -0
  8. package/dist/cjs/messageFormat/ICU.cjs +50 -25
  9. package/dist/cjs/messageFormat/ICU.cjs.map +1 -1
  10. package/dist/cjs/messageFormat/resolveMessage.cjs +43 -21
  11. package/dist/cjs/messageFormat/resolveMessage.cjs.map +1 -1
  12. package/dist/esm/dictionaryManipulator/index.mjs +2 -2
  13. package/dist/esm/dictionaryManipulator/qualifiedDynamicLoader.mjs +15 -2
  14. package/dist/esm/dictionaryManipulator/qualifiedDynamicLoader.mjs.map +1 -1
  15. package/dist/esm/index.mjs +3 -3
  16. package/dist/esm/interpreter/dictionaryTransformCache.mjs +39 -1
  17. package/dist/esm/interpreter/dictionaryTransformCache.mjs.map +1 -1
  18. package/dist/esm/interpreter/index.mjs +2 -2
  19. package/dist/esm/messageFormat/ICU.mjs +51 -26
  20. package/dist/esm/messageFormat/ICU.mjs.map +1 -1
  21. package/dist/esm/messageFormat/resolveMessage.mjs +44 -22
  22. package/dist/esm/messageFormat/resolveMessage.mjs.map +1 -1
  23. package/dist/types/dictionaryManipulator/index.d.ts +2 -2
  24. package/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +12 -0
  25. package/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts.map +1 -1
  26. package/dist/types/index.d.ts +4 -4
  27. package/dist/types/interpreter/dictionaryTransformCache.d.ts +23 -0
  28. package/dist/types/interpreter/dictionaryTransformCache.d.ts.map +1 -1
  29. package/dist/types/interpreter/index.d.ts +2 -2
  30. package/dist/types/messageFormat/ICU.d.ts.map +1 -1
  31. package/dist/types/messageFormat/index.d.ts +2 -2
  32. package/dist/types/messageFormat/resolveMessage.d.ts +18 -4
  33. package/dist/types/messageFormat/resolveMessage.d.ts.map +1 -1
  34. package/package.json +6 -6
@@ -20,11 +20,11 @@ import { GetNestingResult, getNesting } from "./interpreter/getNesting.js";
20
20
  import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TranslationCond, UnionKeys, ValueAtKey, bindInsertedValues, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, resolveInsertedSelector, selectPlugin, translationPlugin } from "./interpreter/getContent/plugins.js";
21
21
  import { deepTransformNode } from "./interpreter/getContent/deepTransform.js";
22
22
  import { getBasePlugins, getContent } from "./interpreter/getContent/getContent.js";
23
- import { getDictionaryTransformCacheKey, getPluginsCacheKey, readTransformCache, writeTransformCache } from "./interpreter/dictionaryTransformCache.js";
23
+ import { TransformCacheWrite, collectTransformCacheWrites, deleteTransformCacheWrites, getDictionaryTransformCacheKey, getPluginsCacheKey, readTransformCache, writeTransformCache } from "./interpreter/dictionaryTransformCache.js";
24
24
  import { getCondition } from "./interpreter/getCondition.js";
25
25
  import { getDictionary } from "./interpreter/getDictionary.js";
26
26
  import { PlainDynamicLoaderMap, ResolvedDynamicLoader, findPlainDynamicLoader, resolvePlainDynamicLoader } from "./dictionaryManipulator/plainDynamicLoader.js";
27
- import { DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, isQualifiedDynamicLoaderMap, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync } from "./dictionaryManipulator/qualifiedDynamicLoader.js";
27
+ import { CollectedChunk, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getQualifiedDynamicChunks, isQualifiedDynamicLoaderMap, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync } from "./dictionaryManipulator/qualifiedDynamicLoader.js";
28
28
  import { getDictionaryAsync } from "./interpreter/getDictionaryAsync.js";
29
29
  import { findMatchingCondition, getEnumeration } from "./interpreter/getEnumeration.js";
30
30
  import { getGender } from "./interpreter/getGender.js";
@@ -114,7 +114,7 @@ import { JsonValue, icuToIntlayerFormatter, intlayerToICUFormatter } from "./mes
114
114
  import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./messageFormat/i18next.js";
115
115
  import { navigatePath } from "./messageFormat/navigatePath.js";
116
116
  import { PortableObject, intlayerToPortableObjectFormatter, portableObjectToIntlayerFormatter } from "./messageFormat/po.js";
117
- import { MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, TaggedMessageToken, createMessageResolver, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode, resolveMessageNodeToString } from "./messageFormat/resolveMessage.js";
117
+ import { MessageArgumentFormatter, MessageArgumentFormatterContext, MessageArgumentFormatters, MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, TaggedMessageToken, createMessageResolver, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode, resolveMessageNodeToString } from "./messageFormat/resolveMessage.js";
118
118
  import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./messageFormat/vue-i18n.js";
119
119
  import "./transpiler/index.js";
120
120
  import { checkIsURLAbsolute } from "./utils/checkIsURLAbsolute.js";
@@ -126,4 +126,4 @@ import { CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorag
126
126
  import { YamlRecord, YamlValue, parseYaml } from "./utils/parseYaml.js";
127
127
  import { stringifyYaml } from "./utils/stringifyYaml.js";
128
128
  import "./utils/index.js";
129
- export { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_NAME_START_R, ATTRIBUTE_TO_NODE_PROP_MAP, ATTR_EXTRACTOR_R, AmbientLocaleResolver, AsyncAmbientLocaleResolver, BLOCKQUOTE_ALERT_R, BLOCKQUOTE_R, BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, BLOCK_END_R, BREAK_LINE_R, BREAK_THEMATIC_R, type BlockQuoteNode, BlockSyntaxProbe, type BoldTextNode, type BreakLineNode, type BreakThematicNode, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, COMPOSITE_ID_SEPARATOR, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CachedIntl, CachedIntl as Intl, type CodeBlockNode, type CodeFencedNode, type CodeInlineNode, type CompileOptions, type ComponentOverrides, ConditionCond, ConditionContent, ConditionContentStates, CookieBuildAttributes, type CustomComponentNode, DEFAULT_PLURAL_VARIABLE, DEFAULT_VARIANT_ID, DO_NOT_PROCESS_HTML_ELEMENTS, DateTimePreset, DeepTransformContent, DotPath, DynamicDictionaryLoader, type ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, type EscapedTextNode, FENCE_DELIMITER_R, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, FileCond, type FileContent, type FileContentConstructor, type FootnoteNode, type FootnoteReferenceNode, type GFMTaskNode, GFM_TASK_R, Gender, GenderCond, GenderContent, GenderContentStates, type GenerateSitemapOptions, GetNestingResult, type GetPrefixOptions, type GetPrefixResult, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, type HTMLCommentNode, HTMLContent, HTMLContentConstructor, type HTMLNode, type HTMLSelfClosingNode, type HTMLTag, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_CHAR_CODE_R, HTML_COMMENT_R, HTML_CUSTOM_ATTR_R, HTML_LEFT_TRIM_AMOUNT_R, HTML_TAGS, type HeadingNode, type HeadingSetextNode, IInterpreterPlugin, IInterpreterPluginState, INLINE_SKIP_R, INTERPOLATION_R, type ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, InterpolableNode, IntlConstructorName, IsAny, type ItalicTextNode, JsonValue, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LOOKAHEAD, type LinkAngleBraceNode, type LinkBareURLNode, type LinkNode, ListFormatOptions, ListType, type LocaleDomainMap, type LocaleRequest, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, type LocalizedPathResult, MarkdownContent, MarkdownContentConstructor, type MarkdownContext, type MarkdownOptions, MarkdownReferences, type MarkdownRuntime, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, type MarkedTextNode, MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, NAMED_CODES_TO_UNICODE, NP_TABLE_R, NestedCond, NestedContent, NestedContentState, NestedFieldReferences, type NestedParser, type NewlineNode, NodeProps, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, type OrderedListNode, PARAGRAPH_R, PRELOADED_DYNAMIC_KEY, type ParagraphNode, type ParseState, ParsedMarkdown, type Parser, type ParserResult, PlainDynamicLoaderMap, Plugins, PluralCategory, PluralCond, PluralContent, PluralContentState, PluralOptions, PortableObject, PreloadableDynamicLoaderMap, PreloadedDynamicEntry, Priority, PriorityValue, type ProxyMode, type ProxyStorageSuppressionPurpose, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, type ReferenceImageNode, type ReferenceLinkNode, type ReferenceNode, type RenderRuleHook, ResolvedDynamicLoader, type Rule, type RuleOutput, RuleScope, RuleScopeValue, RuleType, RuleTypeValue, type Rules, SCOPE_BLOCK, SCOPE_BOTH, SCOPE_INLINE, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, SelectCond, SelectContent, SelectContentStates, SelectSelector, type SitemapUrlEntry, type StrikethroughTextNode, 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_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, type TableNode, type TableSeparatorNode, TaggedMessageToken, type TextNode, TranslationCond, TranslationContent, UNESCAPE_R, UNORDERED, UNORDERED_LIST_BULLET, UNORDERED_LIST_ITEM_PREFIX, UNORDERED_LIST_ITEM_PREFIX_R, UNORDERED_LIST_ITEM_R, UNORDERED_LIST_R, UnionKeys, type UnorderedListNode, VOID_HTML_ELEMENTS, ValidDotPathsFor, ValueAtKey, WrappedIntl, YamlRecord, YamlValue, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindInsertedValues, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, comparePaths, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createMessageResolver, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, type file, type fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, findPlainDynamicLoader, formatProxyEnabledMessage, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCachedLocaleFromStorageClient, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getDictionaryAsync, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getDictionaryTransformCacheKey, getDomainHostname, getDomainOrigin, getEditedContent, getEditedDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getGender, getHTML, getHTMLTextDir, getInsertion, getInsertionValues, getInternalPath, getInterpolableContent, getIntlayer, getIntlayerAsync, getIntlayerNodePrototype, getLocale, getLocaleFromDomain, getLocaleFromPath, getLocaleFromRequest, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNestedDictionaryGraph, getNestedDictionaryKeys, getNestedDictionaryReferences, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPluginsCacheKey, getPlural, getPrefix, getPreloadLocale, getPreloadedDictionary, getReplacedValuesContent, getRewritePath, getRewriteRules, getRuleSet, getSelect, getSplittedContent, getSplittedDictionaryContent, getTranslation, getVariantIds, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isDeclaredLocale, isInterpolableWrapperNode, isLocaleExclusiveOnDomain, isProxyStorageLocaleEnabled, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, mergeQualifiedDictionaries, navigatePath, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizePath, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseDictionarySelector, parseInline, parseMarkdown, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, parseTaggedMessage, parseYaml, parserFor, percentage, plural, pluralPlugin, portableObjectToIntlayerFormatter, presets, qualifies, readTransformCache, rebuildInterpolableContent, reconstructQualifiedEntry, registerAmbientLocaleResolver, registerAsyncAmbientLocaleResolver, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, resolveBrowserLocale, resolveDictionaryArgument, resolveEffectiveVariantId, resolveInsertedSelector, resolveInterpreterLocale, resolveInterpreterLocaleAsync, resolveLocalizedPath, resolveMessage, resolveMessageNode, resolveMessageNodeToString, resolvePlainDynamicLoader, resolveProviderVariant, resolveProxyMode, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, sanitizer, select, selectPlugin, serializeVariant, serializeVariantChain, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, transformInterpolableNode, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter, writeTransformCache };
129
+ export { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_NAME_START_R, ATTRIBUTE_TO_NODE_PROP_MAP, ATTR_EXTRACTOR_R, AmbientLocaleResolver, AsyncAmbientLocaleResolver, BLOCKQUOTE_ALERT_R, BLOCKQUOTE_R, BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, BLOCK_END_R, BREAK_LINE_R, BREAK_THEMATIC_R, type BlockQuoteNode, BlockSyntaxProbe, type BoldTextNode, type BreakLineNode, type BreakThematicNode, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, COMPOSITE_ID_SEPARATOR, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CachedIntl, CachedIntl as Intl, type CodeBlockNode, type CodeFencedNode, type CodeInlineNode, CollectedChunk, type CompileOptions, type ComponentOverrides, ConditionCond, ConditionContent, ConditionContentStates, CookieBuildAttributes, type CustomComponentNode, DEFAULT_PLURAL_VARIABLE, DEFAULT_VARIANT_ID, DO_NOT_PROCESS_HTML_ELEMENTS, DateTimePreset, DeepTransformContent, DotPath, DynamicDictionaryLoader, type ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, type EscapedTextNode, FENCE_DELIMITER_R, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, FileCond, type FileContent, type FileContentConstructor, type FootnoteNode, type FootnoteReferenceNode, type GFMTaskNode, GFM_TASK_R, Gender, GenderCond, GenderContent, GenderContentStates, type GenerateSitemapOptions, GetNestingResult, type GetPrefixOptions, type GetPrefixResult, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, type HTMLCommentNode, HTMLContent, HTMLContentConstructor, type HTMLNode, type HTMLSelfClosingNode, type HTMLTag, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_CHAR_CODE_R, HTML_COMMENT_R, HTML_CUSTOM_ATTR_R, HTML_LEFT_TRIM_AMOUNT_R, HTML_TAGS, type HeadingNode, type HeadingSetextNode, IInterpreterPlugin, IInterpreterPluginState, INLINE_SKIP_R, INTERPOLATION_R, type ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, InterpolableNode, IntlConstructorName, IsAny, type ItalicTextNode, JsonValue, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LOOKAHEAD, type LinkAngleBraceNode, type LinkBareURLNode, type LinkNode, ListFormatOptions, ListType, type LocaleDomainMap, type LocaleRequest, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, type LocalizedPathResult, MarkdownContent, MarkdownContentConstructor, type MarkdownContext, type MarkdownOptions, MarkdownReferences, type MarkdownRuntime, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, type MarkedTextNode, MessageArgumentFormatter, MessageArgumentFormatterContext, MessageArgumentFormatters, MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, NAMED_CODES_TO_UNICODE, NP_TABLE_R, NestedCond, NestedContent, NestedContentState, NestedFieldReferences, type NestedParser, type NewlineNode, NodeProps, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, type OrderedListNode, PARAGRAPH_R, PRELOADED_DYNAMIC_KEY, type ParagraphNode, type ParseState, ParsedMarkdown, type Parser, type ParserResult, PlainDynamicLoaderMap, Plugins, PluralCategory, PluralCond, PluralContent, PluralContentState, PluralOptions, PortableObject, PreloadableDynamicLoaderMap, PreloadedDynamicEntry, Priority, PriorityValue, type ProxyMode, type ProxyStorageSuppressionPurpose, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, type ReferenceImageNode, type ReferenceLinkNode, type ReferenceNode, type RenderRuleHook, ResolvedDynamicLoader, type Rule, type RuleOutput, RuleScope, RuleScopeValue, RuleType, RuleTypeValue, type Rules, SCOPE_BLOCK, SCOPE_BOTH, SCOPE_INLINE, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, SelectCond, SelectContent, SelectContentStates, SelectSelector, type SitemapUrlEntry, type StrikethroughTextNode, 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_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, type TableNode, type TableSeparatorNode, TaggedMessageToken, type TextNode, TransformCacheWrite, TranslationCond, TranslationContent, UNESCAPE_R, UNORDERED, UNORDERED_LIST_BULLET, UNORDERED_LIST_ITEM_PREFIX, UNORDERED_LIST_ITEM_PREFIX_R, UNORDERED_LIST_ITEM_R, UNORDERED_LIST_R, UnionKeys, type UnorderedListNode, VOID_HTML_ELEMENTS, ValidDotPathsFor, ValueAtKey, WrappedIntl, YamlRecord, YamlValue, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindInsertedValues, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, collectTransformCacheWrites, compact, comparePaths, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createMessageResolver, createRenderer, currency, cx, date, deepTransformNode, deleteTransformCacheWrites, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, type file, type fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, findPlainDynamicLoader, formatProxyEnabledMessage, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCachedLocaleFromStorageClient, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getDictionaryAsync, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getDictionaryTransformCacheKey, getDomainHostname, getDomainOrigin, getEditedContent, getEditedDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getGender, getHTML, getHTMLTextDir, getInsertion, getInsertionValues, getInternalPath, getInterpolableContent, getIntlayer, getIntlayerAsync, getIntlayerNodePrototype, getLocale, getLocaleFromDomain, getLocaleFromPath, getLocaleFromRequest, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNestedDictionaryGraph, getNestedDictionaryKeys, getNestedDictionaryReferences, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPluginsCacheKey, getPlural, getPrefix, getPreloadLocale, getPreloadedDictionary, getQualifiedDynamicChunks, getReplacedValuesContent, getRewritePath, getRewriteRules, getRuleSet, getSelect, getSplittedContent, getSplittedDictionaryContent, getTranslation, getVariantIds, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isDeclaredLocale, isInterpolableWrapperNode, isLocaleExclusiveOnDomain, isProxyStorageLocaleEnabled, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, mergeQualifiedDictionaries, navigatePath, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizePath, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseDictionarySelector, parseInline, parseMarkdown, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, parseTaggedMessage, parseYaml, parserFor, percentage, plural, pluralPlugin, portableObjectToIntlayerFormatter, presets, qualifies, readTransformCache, rebuildInterpolableContent, reconstructQualifiedEntry, registerAmbientLocaleResolver, registerAsyncAmbientLocaleResolver, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, resolveBrowserLocale, resolveDictionaryArgument, resolveEffectiveVariantId, resolveInsertedSelector, resolveInterpreterLocale, resolveInterpreterLocaleAsync, resolveLocalizedPath, resolveMessage, resolveMessageNode, resolveMessageNodeToString, resolvePlainDynamicLoader, resolveProviderVariant, resolveProxyMode, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, sanitizer, select, selectPlugin, serializeVariant, serializeVariantChain, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, transformInterpolableNode, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter, writeTransformCache };
@@ -36,4 +36,27 @@ export declare const readTransformCache: <Content>(dictionary: Dictionary | obje
36
36
  * @returns The stored content, so callers can `return writeTransformCache(...)`.
37
37
  */
38
38
  export declare const writeTransformCache: <Content>(dictionary: Dictionary | object, cacheKey: string, content: Content) => Content;
39
+ /** One entry stored by {@link writeTransformCache}. */
40
+ export type TransformCacheWrite = {
41
+ dictionary: object;
42
+ cacheKey: string;
43
+ content: unknown;
44
+ };
45
+ /**
46
+ * Runs `run` and reports every transform-cache entry it wrote, nested
47
+ * dictionaries included.
48
+ *
49
+ * Frameworks whose transformed content holds owned, disposable elements
50
+ * (Solid) use it to forget those entries once the scope that built the
51
+ * elements is disposed — see {@link deleteTransformCacheWrites}.
52
+ */
53
+ export declare const collectTransformCacheWrites: <Result>(run: () => Result) => {
54
+ result: Result;
55
+ writes: TransformCacheWrite[];
56
+ };
57
+ /**
58
+ * Removes entries reported by {@link collectTransformCacheWrites}. An entry
59
+ * rewritten since then holds other content and is kept.
60
+ */
61
+ export declare const deleteTransformCacheWrites: (writes: readonly TransformCacheWrite[]) => void;
39
62
  //# sourceMappingURL=dictionaryTransformCache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionaryTransformCache.d.ts","names":[],"sources":["../../../src/interpreter/dictionaryTransformCache.ts"],"mappings":";;;;;;;;;;qBA2Ba,qBAAkB,UAAc;;;;;;;;qBAwDhC,iCAA8B,QACjC,eAAa,0BACG,UACd;;;;;;;;qBAUC,qBAAsB,SAAO,YAC5B,qBAAmB;EAE5B;EAAW,SAAS;;EAAc;;;;;;;qBAe1B,sBAAuB,SAAO,YAC7B,qBAAmB,kBACf,SACP,YACR"}
1
+ {"version":3,"file":"dictionaryTransformCache.d.ts","names":[],"sources":["../../../src/interpreter/dictionaryTransformCache.ts"],"mappings":";;;;;;;;;;qBA2Ba,qBAAkB,UAAc;;;;;;;;qBAwDhC,iCAA8B,QACjC,eAAa,0BACG,UACd;;;;;;;;qBAUC,qBAAsB,SAAO,YAC5B,qBAAmB;EAE5B;EAAW,SAAS;;EAAc;;;;;;;qBAe1B,sBAAuB,SAAO,YAC7B,qBAAmB,kBACf,SACP,YACR;;YAmBS;EACV;EACA;EACA;;;;;;;;;;qBAcW,8BAA+B,QAAM,WACrC;EACR,QAAQ;EAAQ,QAAQ;;;;;;qBAiBhB,6BAA0B,iBACpB"}
@@ -1,4 +1,4 @@
1
- import { getDictionaryTransformCacheKey, getPluginsCacheKey, readTransformCache, writeTransformCache } from "./dictionaryTransformCache.js";
1
+ import { TransformCacheWrite, collectTransformCacheWrites, deleteTransformCacheWrites, getDictionaryTransformCacheKey, getPluginsCacheKey, readTransformCache, writeTransformCache } from "./dictionaryTransformCache.js";
2
2
  import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TranslationCond, UnionKeys, ValueAtKey, bindInsertedValues, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, resolveInsertedSelector, selectPlugin, translationPlugin } from "./getContent/plugins.js";
3
3
  import { deepTransformNode } from "./getContent/deepTransform.js";
4
4
  import { getBasePlugins, getContent } from "./getContent/getContent.js";
@@ -19,4 +19,4 @@ import { getTranslation } from "./getTranslation.js";
19
19
  import { InterpolableNode, getInterpolableContent, isInterpolableWrapperNode, rebuildInterpolableContent, transformInterpolableNode } from "./interpolableNode.js";
20
20
  import { AmbientLocaleResolver, AsyncAmbientLocaleResolver, registerAmbientLocaleResolver, registerAsyncAmbientLocaleResolver, resolveInterpreterLocale, resolveInterpreterLocaleAsync } from "./resolveInterpreterLocale.js";
21
21
  import { splitInsertionTemplate } from "./splitAndJoinInsertion.js";
22
- export { AmbientLocaleResolver, AsyncAmbientLocaleResolver, ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InterpolableNode, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TranslationCond, UnionKeys, ValueAtKey, bindInsertedValues, conditionPlugin, deepTransformNode, enumerationPlugin, fallbackPlugin, filePlugin, findMatchingCondition, genderPlugin, getBasePlugins, getCondition, getContent, getDictionary, getDictionaryAsync, getDictionaryTransformCacheKey, getEnumeration, getGender, getHTML, getInsertion, getInterpolableContent, getIntlayer, getIntlayerAsync, getNesting, getPluginsCacheKey, getPlural, getSelect, getTranslation, insertionPlugin, isInterpolableWrapperNode, nestedPlugin, pluralPlugin, readTransformCache, rebuildInterpolableContent, registerAmbientLocaleResolver, registerAsyncAmbientLocaleResolver, resolveInsertedSelector, resolveInterpreterLocale, resolveInterpreterLocaleAsync, selectPlugin, splitInsertionTemplate, transformInterpolableNode, translationPlugin, writeTransformCache };
22
+ export { AmbientLocaleResolver, AsyncAmbientLocaleResolver, ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InterpolableNode, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TransformCacheWrite, TranslationCond, UnionKeys, ValueAtKey, bindInsertedValues, collectTransformCacheWrites, conditionPlugin, deepTransformNode, deleteTransformCacheWrites, enumerationPlugin, fallbackPlugin, filePlugin, findMatchingCondition, genderPlugin, getBasePlugins, getCondition, getContent, getDictionary, getDictionaryAsync, getDictionaryTransformCacheKey, getEnumeration, getGender, getHTML, getInsertion, getInterpolableContent, getIntlayer, getIntlayerAsync, getNesting, getPluginsCacheKey, getPlural, getSelect, getTranslation, insertionPlugin, isInterpolableWrapperNode, nestedPlugin, pluralPlugin, readTransformCache, rebuildInterpolableContent, registerAmbientLocaleResolver, registerAsyncAmbientLocaleResolver, resolveInsertedSelector, resolveInterpreterLocale, resolveInterpreterLocaleAsync, selectPlugin, splitInsertionTemplate, transformInterpolableNode, translationPlugin, writeTransformCache };
@@ -1 +1 @@
1
- {"version":3,"file":"ICU.d.ts","names":[],"sources":["../../../src/messageFormat/ICU.ts"],"mappings":";YAkDY,+CAKR;GACG,cAAc;;qBAmnBR,yBAAsB,SACxB,0BACR;qBAQU,yBAAsB,SACxB,0BACR"}
1
+ {"version":3,"file":"ICU.d.ts","names":[],"sources":["../../../src/messageFormat/ICU.ts"],"mappings":";YAoDY,+CAKR;GACG,cAAc;;qBAsqBR,yBAAsB,SACxB,0BACR;qBAQU,yBAAsB,SACxB,0BACR"}
@@ -2,6 +2,6 @@ import { JsonValue, icuToIntlayerFormatter, intlayerToICUFormatter } from "./ICU
2
2
  import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./i18next.js";
3
3
  import { navigatePath } from "./navigatePath.js";
4
4
  import { PortableObject, intlayerToPortableObjectFormatter, portableObjectToIntlayerFormatter } from "./po.js";
5
- import { MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, TaggedMessageToken, createMessageResolver, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode, resolveMessageNodeToString } from "./resolveMessage.js";
5
+ import { MessageArgumentFormatter, MessageArgumentFormatterContext, MessageArgumentFormatters, MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, TaggedMessageToken, createMessageResolver, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode, resolveMessageNodeToString } from "./resolveMessage.js";
6
6
  import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./vue-i18n.js";
7
- export { JsonValue, MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, PortableObject, TaggedMessageToken, createMessageResolver, i18nextToIntlayerFormatter, icuToIntlayerFormatter, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, navigatePath, parseTaggedMessage, portableObjectToIntlayerFormatter, resolveMessage, resolveMessageNode, resolveMessageNodeToString, vueI18nToIntlayerFormatter };
7
+ export { JsonValue, MessageArgumentFormatter, MessageArgumentFormatterContext, MessageArgumentFormatters, MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, PortableObject, TaggedMessageToken, createMessageResolver, i18nextToIntlayerFormatter, icuToIntlayerFormatter, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, navigatePath, parseTaggedMessage, portableObjectToIntlayerFormatter, resolveMessage, resolveMessageNode, resolveMessageNodeToString, vueI18nToIntlayerFormatter };
@@ -15,6 +15,20 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
15
15
  export type MessageFormatDialect = 'icu' | 'i18next' | 'vue-i18n';
16
16
  /** Interpolation values passed alongside a translation lookup. */
17
17
  export type MessageValues = Record<string, unknown>;
18
+ /** Context handed to a {@link MessageArgumentFormatter}. */
19
+ export type MessageArgumentFormatterContext = {
20
+ /** Active locale. */
21
+ locale: LocalesValues;
22
+ /** Third segment of the argument (`EUR` in `{price, currency, EUR}`). */
23
+ style?: string;
24
+ };
25
+ /**
26
+ * Formats an argument whose type is not built in, e.g. `currency` in
27
+ * `{price, currency, EUR}`.
28
+ */
29
+ export type MessageArgumentFormatter = (value: unknown, context: MessageArgumentFormatterContext) => unknown;
30
+ /** Custom argument formatters, keyed by argument type. */
31
+ export type MessageArgumentFormatters = Record<string, MessageArgumentFormatter>;
18
32
  /**
19
33
  * Interpolates a message template with values.
20
34
  *
@@ -24,7 +38,7 @@ export type MessageValues = Record<string, unknown>;
24
38
  * 2. ICU formatted arguments `{value, number}` / `{ts, date, long}`
25
39
  * 3. Bare single-brace arguments `{name}` (ICU / vue-i18n simple args)
26
40
  */
27
- export declare const interpolateMessage: (template: string, values?: MessageValues, locale?: LocalesValues) => string;
41
+ export declare const interpolateMessage: (template: string, values?: MessageValues, locale?: LocalesValues, formatters?: MessageArgumentFormatters) => string;
28
42
  /**
29
43
  * Resolves an intlayer message node tree (as produced by the
30
44
  * `*ToIntlayerFormatter` converters, or already present in a built
@@ -33,7 +47,7 @@ export declare const interpolateMessage: (template: string, values?: MessageValu
33
47
  * Function nodes (produced by the interpreter plugins for `insertion`,
34
48
  * `enumeration` and `plural` content) are invoked with the values.
35
49
  */
36
- export declare const resolveMessageNode: (node: unknown, values?: MessageValues, locale?: LocalesValues) => unknown;
50
+ export declare const resolveMessageNode: (node: unknown, values?: MessageValues, locale?: LocalesValues, formatters?: MessageArgumentFormatters) => unknown;
37
51
  /**
38
52
  * {@link resolveMessageNode} coerced to a string.
39
53
  *
@@ -43,14 +57,14 @@ export declare const resolveMessageNode: (node: unknown, values?: MessageValues,
43
57
  * callables, so no message parser is involved. Plain strings still get
44
58
  * `{{name}}` / `{name}` / `{value, number}` interpolation.
45
59
  */
46
- export declare const resolveMessageNodeToString: (node: unknown, values?: MessageValues, locale?: LocalesValues) => string;
60
+ export declare const resolveMessageNodeToString: (node: unknown, values?: MessageValues, locale?: LocalesValues, formatters?: MessageArgumentFormatters) => string;
47
61
  /** Converts a raw message string of one dialect into an intlayer node tree. */
48
62
  export type MessageFormatter = (message: string) => unknown;
49
63
  /**
50
64
  * Resolves a raw message — string, or an intlayer node tree — into a final
51
65
  * string using interpolation values and locale.
52
66
  */
53
- export type MessageResolver = (message: unknown, values?: MessageValues, locale?: LocalesValues) => string;
67
+ export type MessageResolver = (message: unknown, values?: MessageValues, locale?: LocalesValues, formatters?: MessageArgumentFormatters) => string;
54
68
  /**
55
69
  * Binds {@link resolveMessageNode} to one dialect converter.
56
70
  *
@@ -1 +1 @@
1
- {"version":3,"file":"resolveMessage.d.ts","names":[],"sources":["../../../src/messageFormat/resolveMessage.ts"],"mappings":";;;;;;;;;;;;;;YAyBY;;YAGA,gBAAgB;;;;;;;;;;qBAuFf,qBAAkB,kBACb,SACR,eAAa,SACb;;;;;;;;;qBAwCG,qBAAkB,eAChB,SACL,eAAa,SACb;;;;;;;;;;qBAyIG,6BAA0B,eACxB,SACL,eAAa,SACb;;YAQE,oBAAoB;;;;;YAMpB,mBACV,kBACA,SAAS,eACT,SAAS;;;;;;;;;;;;;;qBAgBE,wBAAqB,WACpB,qBAAmB;;;;;;;;;;;;;;;;;;;;;;qBAmCpB,iBAAc,kBACT,SACR,eAAa,SACb,eAAa,UACZ;;YAKC;EAEN;EAAa,UAAU;;;;;;;;;qBAShB,qBAAkB,oBAAsB"}
1
+ {"version":3,"file":"resolveMessage.d.ts","names":[],"sources":["../../../src/messageFormat/resolveMessage.ts"],"mappings":";;;;;;;;;;;;;;YA+BY;;YAGA,gBAAgB;;YA8BhB;;EAEV,QAAQ;;EAER;;;;;;YAOU,4BACV,gBACA,SAAS;;YAIC,4BAA4B,eAEtC;;;;;;;;;;qBAkFW,qBAAkB,kBACb,SACR,eAAa,SACb,eAAa,aACR;;;;;;;;;qBAwCF,qBAAkB,eAChB,SACL,eAAa,SACb,eAAa,aACR;;;;;;;;;;qBAiKF,6BAA0B,eACxB,SACL,eAAa,SACb,eAAa,aACR;;YAQH,oBAAoB;;;;;YAMpB,mBACV,kBACA,SAAS,eACT,SAAS,eACT,aAAa;;;;;;;;;;;;;;qBAgBF,wBAAqB,WACpB,qBAAmB;;;;;;;;;;;;;;;;;;;;;;qBAoCpB,iBAAc,kBACT,SACR,eAAa,SACb,eAAa,UACZ;;YAKC;EAEN;EAAa,UAAU;;;;;;;;;qBAShB,qBAAkB,oBAAsB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "9.8.0",
3
+ "version": "9.8.2",
4
4
  "private": false,
5
5
  "description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
6
6
  "keywords": [
@@ -176,10 +176,10 @@
176
176
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
177
177
  },
178
178
  "dependencies": {
179
- "@intlayer/api": "9.8.0",
180
- "@intlayer/config": "9.8.0",
181
- "@intlayer/dictionaries-entry": "9.8.0",
182
- "@intlayer/types": "9.8.0",
179
+ "@intlayer/api": "9.8.2",
180
+ "@intlayer/config": "9.8.2",
181
+ "@intlayer/dictionaries-entry": "9.8.2",
182
+ "@intlayer/types": "9.8.2",
183
183
  "defu": "6.1.7"
184
184
  },
185
185
  "devDependencies": {
@@ -190,7 +190,7 @@
190
190
  "rimraf": "6.1.4",
191
191
  "tsdown": "0.23.7",
192
192
  "typescript": "7.0.2",
193
- "vitest": "5.1.0"
193
+ "vitest": "5.1.1"
194
194
  },
195
195
  "engines": {
196
196
  "node": ">=14.18"