@intlayer/core 9.0.0-canary.11 → 9.0.0-canary.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dictionaryManipulator/index.cjs +3 -3
- package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs +8 -6
- package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs +81 -40
- package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs.map +1 -1
- package/dist/cjs/index.cjs +10 -3
- package/dist/cjs/localization/domainUtils.cjs +82 -0
- package/dist/cjs/localization/domainUtils.cjs.map +1 -0
- package/dist/cjs/localization/getLocalizedUrl.cjs +4 -11
- package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
- package/dist/cjs/localization/getPrefix.cjs +5 -9
- package/dist/cjs/localization/getPrefix.cjs.map +1 -1
- package/dist/cjs/localization/index.cjs +5 -0
- package/dist/cjs/messageFormat/index.cjs +2 -0
- package/dist/cjs/messageFormat/navigatePath.cjs +38 -0
- package/dist/cjs/messageFormat/navigatePath.cjs.map +1 -0
- package/dist/esm/dictionaryManipulator/index.mjs +2 -2
- package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs +9 -7
- package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs +79 -38
- package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs.map +1 -1
- package/dist/esm/index.mjs +4 -2
- package/dist/esm/localization/domainUtils.mjs +77 -0
- package/dist/esm/localization/domainUtils.mjs.map +1 -0
- package/dist/esm/localization/getLocalizedUrl.mjs +4 -11
- package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
- package/dist/esm/localization/getPrefix.mjs +5 -9
- package/dist/esm/localization/getPrefix.mjs.map +1 -1
- package/dist/esm/localization/index.mjs +2 -1
- package/dist/esm/messageFormat/index.mjs +2 -1
- package/dist/esm/messageFormat/navigatePath.mjs +36 -0
- package/dist/esm/messageFormat/navigatePath.mjs.map +1 -0
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +1 -1
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +1 -1
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +1 -1
- package/dist/types/dictionaryManipulator/index.d.ts +2 -2
- package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts +33 -22
- package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/localization/domainUtils.d.ts +70 -0
- package/dist/types/localization/domainUtils.d.ts.map +1 -0
- package/dist/types/localization/getLocalizedUrl.d.ts.map +1 -1
- package/dist/types/localization/getPrefix.d.ts.map +1 -1
- package/dist/types/localization/index.d.ts +2 -1
- package/dist/types/messageFormat/index.d.ts +2 -1
- package/dist/types/messageFormat/navigatePath.d.ts +22 -0
- package/dist/types/messageFormat/navigatePath.d.ts.map +1 -0
- package/package.json +6 -6
package/dist/esm/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { getEditedContent, getEditedDictionary } from "./deepTransformPlugins/ge
|
|
|
2
2
|
import { getCondition } from "./interpreter/getCondition.mjs";
|
|
3
3
|
import { deepTransformNode } from "./interpreter/getContent/deepTransform.mjs";
|
|
4
4
|
import { findMatchingCondition, getEnumeration } from "./interpreter/getEnumeration.mjs";
|
|
5
|
-
import { COMPOSITE_ID_SEPARATOR, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER,
|
|
5
|
+
import { COMPOSITE_ID_SEPARATOR, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant } from "./dictionaryManipulator/qualifiedDictionary.mjs";
|
|
6
6
|
import { getDictionary } from "./interpreter/getDictionary.mjs";
|
|
7
7
|
import { getIntlayer } from "./interpreter/getIntlayer.mjs";
|
|
8
8
|
import { getNesting } from "./interpreter/getNesting.mjs";
|
|
@@ -63,6 +63,7 @@ import { updateNodeChildren } from "./dictionaryManipulator/updateNodeChildren.m
|
|
|
63
63
|
import { checkIsURLAbsolute } from "./utils/checkIsURLAbsolute.mjs";
|
|
64
64
|
import { getPathWithoutLocale } from "./localization/getPathWithoutLocale.mjs";
|
|
65
65
|
import { comparePaths, normalizePath } from "./localization/comparePaths.mjs";
|
|
66
|
+
import { getDomainHostname, getDomainOrigin, getLocaleFromDomain, isLocaleExclusiveOnDomain } from "./localization/domainUtils.mjs";
|
|
66
67
|
import { getPrefix } from "./localization/getPrefix.mjs";
|
|
67
68
|
import { getCanonicalPath, getInternalPath, getLocalizedPath, getRewritePath, getRewriteRules } from "./localization/rewriteUtils.mjs";
|
|
68
69
|
import { getLocalizedUrl } from "./localization/getLocalizedUrl.mjs";
|
|
@@ -87,10 +88,11 @@ import { createRenderer, renderFor } from "./markdown/renderer.mjs";
|
|
|
87
88
|
import { compile, compileWithOptions, createCompiler, parseMarkdown, renderMarkdownAst } from "./markdown/compiler.mjs";
|
|
88
89
|
import { icuToIntlayerFormatter, intlayerToICUFormatter } from "./messageFormat/ICU.mjs";
|
|
89
90
|
import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./messageFormat/i18next.mjs";
|
|
91
|
+
import { navigatePath } from "./messageFormat/navigatePath.mjs";
|
|
90
92
|
import { intlayerToPortableObjectFormatter, portableObjectToIntlayerFormatter } from "./messageFormat/po.mjs";
|
|
91
93
|
import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./messageFormat/vue-i18n.mjs";
|
|
92
94
|
import { interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode } from "./messageFormat/resolveMessage.mjs";
|
|
93
95
|
import { isSameKeyPath } from "./utils/isSameKeyPath.mjs";
|
|
94
96
|
import { stringifyYaml } from "./utils/stringifyYaml.mjs";
|
|
95
97
|
|
|
96
|
-
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, COMPOSITE_ID_SEPARATOR, 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, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, 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, comparePaths, 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,
|
|
98
|
+
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, COMPOSITE_ID_SEPARATOR, 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, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, 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, comparePaths, 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, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getDomainHostname, getDomainOrigin, getEditedContent, getEditedDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTML, getHTMLTextDir, getInsertionValues, getInternalPath, getIntlayer, getLocale, getLocaleFromDomain, 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, getVariantIds, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isLocaleExclusiveOnDomain, 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, reconstructQualifiedEntry, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, resolveMessage, resolveMessageNode, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, sanitizer, serializeVariant, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//#region src/localization/domainUtils.ts
|
|
2
|
+
/**
|
|
3
|
+
* Strips the protocol from a domain string and returns only the hostname.
|
|
4
|
+
*
|
|
5
|
+
* Example:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* getDomainHostname('https://intlayer.cn') // 'intlayer.cn'
|
|
9
|
+
* getDomainHostname('intlayer.cn') // 'intlayer.cn'
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param domain - A domain value from `routing.domains`, with or without protocol.
|
|
13
|
+
* @returns The bare hostname.
|
|
14
|
+
*/
|
|
15
|
+
const getDomainHostname = (domain) => {
|
|
16
|
+
try {
|
|
17
|
+
return /^https?:\/\//.test(domain) ? new URL(domain).hostname : domain;
|
|
18
|
+
} catch {
|
|
19
|
+
return domain;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Returns the absolute origin for a domain value, prepending `https://`
|
|
24
|
+
* when no protocol is present.
|
|
25
|
+
*
|
|
26
|
+
* Example:
|
|
27
|
+
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* getDomainOrigin('intlayer.cn') // 'https://intlayer.cn'
|
|
30
|
+
* getDomainOrigin('http://intlayer.cn') // 'http://intlayer.cn'
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param domain - A domain value from `routing.domains`, with or without protocol.
|
|
34
|
+
* @returns The origin usable as a URL base.
|
|
35
|
+
*/
|
|
36
|
+
const getDomainOrigin = (domain) => /^https?:\/\//.test(domain) ? domain : `https://${domain}`;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the locale exclusively mapped to a given hostname via `routing.domains`,
|
|
39
|
+
* or `undefined` when zero or more than one locale share that hostname.
|
|
40
|
+
*
|
|
41
|
+
* Example: with `domains = { zh: 'intlayer.cn', en: 'intlayer.org', fr: 'intlayer.org' }`
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* getLocaleFromDomain('intlayer.cn', domains) // 'zh'
|
|
45
|
+
* getLocaleFromDomain('intlayer.org', domains) // undefined (en and fr share it)
|
|
46
|
+
* getLocaleFromDomain('example.com', domains) // undefined (not mapped)
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param hostname - The bare hostname of the incoming request.
|
|
50
|
+
* @param domains - The configured locale → domain map.
|
|
51
|
+
* @returns The exclusively mapped locale, or `undefined`.
|
|
52
|
+
*/
|
|
53
|
+
const getLocaleFromDomain = (hostname, domains) => {
|
|
54
|
+
if (!domains) return void 0;
|
|
55
|
+
const matchingLocales = Object.entries(domains).filter(([, domain]) => typeof domain === "string" && getDomainHostname(domain) === hostname);
|
|
56
|
+
return matchingLocales.length === 1 ? matchingLocales[0]?.[0] : void 0;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Checks whether a locale is the only locale mapped to its configured domain.
|
|
60
|
+
* When true, the domain alone identifies the locale and no URL prefix is needed.
|
|
61
|
+
* Hostnames are compared after protocol stripping, so
|
|
62
|
+
* `{ en: 'https://intlayer.org', fr: 'intlayer.org' }` counts as a shared domain.
|
|
63
|
+
*
|
|
64
|
+
* @param locale - The locale to check.
|
|
65
|
+
* @param domains - The configured locale → domain map.
|
|
66
|
+
* @returns `true` when the locale has a domain shared with no other locale.
|
|
67
|
+
*/
|
|
68
|
+
const isLocaleExclusiveOnDomain = (locale, domains) => {
|
|
69
|
+
const localeDomain = domains?.[locale];
|
|
70
|
+
if (!localeDomain) return false;
|
|
71
|
+
const localeHostname = getDomainHostname(localeDomain);
|
|
72
|
+
return Object.values(domains).filter((domain) => typeof domain === "string" && getDomainHostname(domain) === localeHostname).length === 1;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { getDomainHostname, getDomainOrigin, getLocaleFromDomain, isLocaleExclusiveOnDomain };
|
|
77
|
+
//# sourceMappingURL=domainUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domainUtils.mjs","names":[],"sources":["../../../src/localization/domainUtils.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { RoutingConfig } from '@intlayer/types/config';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\n/**\n * The locale → domain map configured under `routing.domains`\n * (e.g. `{ en: 'intlayer.org', zh: 'intlayer.cn' }`).\n */\nexport type LocaleDomainMap = RoutingConfig['domains'];\n\n/**\n * Strips the protocol from a domain string and returns only the hostname.\n *\n * Example:\n *\n * ```ts\n * getDomainHostname('https://intlayer.cn') // 'intlayer.cn'\n * getDomainHostname('intlayer.cn') // 'intlayer.cn'\n * ```\n *\n * @param domain - A domain value from `routing.domains`, with or without protocol.\n * @returns The bare hostname.\n */\nexport const getDomainHostname = (domain: string): string => {\n try {\n return /^https?:\\/\\//.test(domain) ? new URL(domain).hostname : domain;\n } catch {\n return domain;\n }\n};\n\n/**\n * Returns the absolute origin for a domain value, prepending `https://`\n * when no protocol is present.\n *\n * Example:\n *\n * ```ts\n * getDomainOrigin('intlayer.cn') // 'https://intlayer.cn'\n * getDomainOrigin('http://intlayer.cn') // 'http://intlayer.cn'\n * ```\n *\n * @param domain - A domain value from `routing.domains`, with or without protocol.\n * @returns The origin usable as a URL base.\n */\nexport const getDomainOrigin = (domain: string): string =>\n /^https?:\\/\\//.test(domain) ? domain : `https://${domain}`;\n\n/**\n * Returns the locale exclusively mapped to a given hostname via `routing.domains`,\n * or `undefined` when zero or more than one locale share that hostname.\n *\n * Example: with `domains = { zh: 'intlayer.cn', en: 'intlayer.org', fr: 'intlayer.org' }`\n *\n * ```ts\n * getLocaleFromDomain('intlayer.cn', domains) // 'zh'\n * getLocaleFromDomain('intlayer.org', domains) // undefined (en and fr share it)\n * getLocaleFromDomain('example.com', domains) // undefined (not mapped)\n * ```\n *\n * @param hostname - The bare hostname of the incoming request.\n * @param domains - The configured locale → domain map.\n * @returns The exclusively mapped locale, or `undefined`.\n */\nexport const getLocaleFromDomain = (\n hostname: string,\n domains: LocaleDomainMap\n): Locale | undefined => {\n if (!domains) return undefined;\n\n const matchingLocales = Object.entries(domains).filter(\n ([, domain]) =>\n typeof domain === 'string' && getDomainHostname(domain) === hostname\n );\n\n return matchingLocales.length === 1\n ? (matchingLocales[0]?.[0] as Locale)\n : undefined;\n};\n\n/**\n * Checks whether a locale is the only locale mapped to its configured domain.\n * When true, the domain alone identifies the locale and no URL prefix is needed.\n * Hostnames are compared after protocol stripping, so\n * `{ en: 'https://intlayer.org', fr: 'intlayer.org' }` counts as a shared domain.\n *\n * @param locale - The locale to check.\n * @param domains - The configured locale → domain map.\n * @returns `true` when the locale has a domain shared with no other locale.\n */\nexport const isLocaleExclusiveOnDomain = (\n locale: LocalesValues,\n domains: LocaleDomainMap\n): boolean => {\n const localeDomain = domains?.[locale];\n\n if (!localeDomain) return false;\n\n const localeHostname = getDomainHostname(localeDomain);\n\n const localesOnSameDomain = Object.values(domains).filter(\n (domain) =>\n typeof domain === 'string' && getDomainHostname(domain) === localeHostname\n ).length;\n\n return localesOnSameDomain === 1;\n};\n"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAa,qBAAqB,WAA2B;AAC3D,KAAI;AACF,SAAO,eAAe,KAAK,OAAO,GAAG,IAAI,IAAI,OAAO,CAAC,WAAW;SAC1D;AACN,SAAO;;;;;;;;;;;;;;;;;AAkBX,MAAa,mBAAmB,WAC9B,eAAe,KAAK,OAAO,GAAG,SAAS,WAAW;;;;;;;;;;;;;;;;;AAkBpD,MAAa,uBACX,UACA,YACuB;AACvB,KAAI,CAAC,QAAS,QAAO;CAErB,MAAM,kBAAkB,OAAO,QAAQ,QAAQ,CAAC,QAC7C,GAAG,YACF,OAAO,WAAW,YAAY,kBAAkB,OAAO,KAAK,SAC/D;AAED,QAAO,gBAAgB,WAAW,IAC7B,gBAAgB,KAAK,KACtB;;;;;;;;;;;;AAaN,MAAa,6BACX,QACA,YACY;CACZ,MAAM,eAAe,UAAU;AAE/B,KAAI,CAAC,aAAc,QAAO;CAE1B,MAAM,iBAAiB,kBAAkB,aAAa;AAOtD,QAL4B,OAAO,OAAO,QAAQ,CAAC,QAChD,WACC,OAAO,WAAW,YAAY,kBAAkB,OAAO,KAAK,eAC/D,CAAC,WAE6B"}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { checkIsURLAbsolute } from "../utils/checkIsURLAbsolute.mjs";
|
|
2
2
|
import { getPathWithoutLocale } from "./getPathWithoutLocale.mjs";
|
|
3
|
+
import { getDomainHostname, getDomainOrigin } from "./domainUtils.mjs";
|
|
3
4
|
import { getPrefix, resolveRoutingConfig } from "./getPrefix.mjs";
|
|
4
5
|
import { getCanonicalPath, getLocalizedPath, getRewriteRules } from "./rewriteUtils.mjs";
|
|
5
6
|
import { internationalization } from "@intlayer/config/built";
|
|
6
7
|
|
|
7
8
|
//#region src/localization/getLocalizedUrl.ts
|
|
8
|
-
/** Strips the protocol and returns the bare hostname of a domain string. */
|
|
9
|
-
const extractHostname = (domain) => {
|
|
10
|
-
try {
|
|
11
|
-
return /^https?:\/\//.test(domain) ? new URL(domain).hostname : domain;
|
|
12
|
-
} catch {
|
|
13
|
-
return domain;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
9
|
/**
|
|
17
10
|
* Generate URL by prefixing the given URL with the referenced locale or adding search parameters
|
|
18
11
|
* based on the routing mode. Handles both absolute and relative URLs appropriately.
|
|
@@ -65,10 +58,10 @@ const getLocalizedUrl = (url, currentLocale = internationalization?.defaultLocal
|
|
|
65
58
|
const isAbsoluteUrl = checkIsURLAbsolute(urlWithoutLocale);
|
|
66
59
|
const parsedUrl = isAbsoluteUrl ? new URL(urlWithoutLocale) : new URL(urlWithoutLocale, "http://example.com");
|
|
67
60
|
const translatedPathname = getLocalizedPath(getCanonicalPath(parsedUrl.pathname, void 0, rewriteRules), currentLocale, rewriteRules).path;
|
|
68
|
-
const detectedCurrentHostname = process.env.INTLAYER_ROUTING_DOMAINS !== "false" ?
|
|
61
|
+
const detectedCurrentHostname = process.env.INTLAYER_ROUTING_DOMAINS !== "false" ? getDomainHostname(currentDomain ?? (isAbsoluteUrl ? parsedUrl.hostname : void 0) ?? (typeof window !== "undefined" ? window?.location?.hostname : void 0) ?? "") || null : null;
|
|
69
62
|
const localeDomain = process.env.INTLAYER_ROUTING_DOMAINS !== "false" ? domains?.[currentLocale] : void 0;
|
|
70
|
-
const localeDomainHostname = localeDomain ?
|
|
71
|
-
const normalizedDomain = localeDomainHostname !== null && detectedCurrentHostname
|
|
63
|
+
const localeDomainHostname = localeDomain ? getDomainHostname(localeDomain) : null;
|
|
64
|
+
const normalizedDomain = localeDomainHostname !== null && (detectedCurrentHostname === null || localeDomainHostname !== detectedCurrentHostname) && localeDomain ? getDomainOrigin(localeDomain) : null;
|
|
72
65
|
const baseUrl = normalizedDomain ? normalizedDomain : isAbsoluteUrl ? `${parsedUrl.protocol}//${parsedUrl.host}` : "";
|
|
73
66
|
if (!(process.env.INTLAYER_ROUTING_MODE && process.env.INTLAYER_ROUTING_MODE !== "search-params") && mode === "search-params") {
|
|
74
67
|
const searchParams = new URLSearchParams(parsedUrl.search);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocalizedUrl.mjs","names":[],"sources":["../../../src/localization/getLocalizedUrl.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\n\n// ── Tree-shake constants ──────────────────────────────────────────────────────\n// When these env vars are injected at build time, bundlers eliminate the\n// branches guarded by these constants.\n\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type {\n LocalesValues,\n LocalizedUrl,\n ResolvedDefaultLocale,\n} from '@intlayer/types/module_augmentation';\nimport { checkIsURLAbsolute } from '../utils/checkIsURLAbsolute';\nimport { getPathWithoutLocale } from './getPathWithoutLocale';\nimport {\n getPrefix,\n type RoutingOptions,\n resolveRoutingConfig,\n} from './getPrefix';\nimport {\n getCanonicalPath,\n getLocalizedPath,\n getRewriteRules,\n} from './rewriteUtils';\n\nexport type { RoutingOptions };\n\n
|
|
1
|
+
{"version":3,"file":"getLocalizedUrl.mjs","names":[],"sources":["../../../src/localization/getLocalizedUrl.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\n\n// ── Tree-shake constants ──────────────────────────────────────────────────────\n// When these env vars are injected at build time, bundlers eliminate the\n// branches guarded by these constants.\n\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type {\n LocalesValues,\n LocalizedUrl,\n ResolvedDefaultLocale,\n} from '@intlayer/types/module_augmentation';\nimport { checkIsURLAbsolute } from '../utils/checkIsURLAbsolute';\nimport { getDomainHostname, getDomainOrigin } from './domainUtils';\nimport { getPathWithoutLocale } from './getPathWithoutLocale';\nimport {\n getPrefix,\n type RoutingOptions,\n resolveRoutingConfig,\n} from './getPrefix';\nimport {\n getCanonicalPath,\n getLocalizedPath,\n getRewriteRules,\n} from './rewriteUtils';\n\nexport type { RoutingOptions };\n\n/**\n * Generate URL by prefixing the given URL with the referenced locale or adding search parameters\n * based on the routing mode. Handles both absolute and relative URLs appropriately.\n *\n * This function gets the locales, default locale, and routing mode from the configuration if not provided.\n *\n * Example:\n *\n * ```ts\n * // prefix-no-default mode\n * getLocalizedUrl('/about', 'fr', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-no-default' });\n * // Returns '/fr/about' for the French locale\n * // Returns '/about' for the English locale (default)\n *\n * // prefix-all mode\n * getLocalizedUrl('/about', 'en', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-all' });\n * // Returns '/en/about' for the English locale\n * // Returns '/fr/about' for the French locale\n *\n * // search-params mode\n * getLocalizedUrl('/about', 'fr', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'search-params' });\n * // Returns '/about?locale=fr' for the French locale\n *\n * // no-prefix mode\n * getLocalizedUrl('/about', 'fr', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'no-prefix' });\n * // Returns '/about' for any locale\n * ```\n *\n * @param url - The original URL string to be processed.\n * @param currentLocale - The current locale.\n * @param options - Configuration options\n * @param options.locales - Optional array of supported locales. Defaults to configured locales.\n * @param options.defaultLocale - The default locale. Defaults to configured default locale.\n * @param options.mode - URL routing mode for locale handling. Defaults to configured mode.\n * @param options.currentDomain - Hostname of the page being rendered. Used to decide\n * whether to emit a relative URL (same domain) or an absolute URL (cross-domain).\n * Auto-detected from the input URL or `window.location` when omitted.\n * @returns The localized URL for the current locale.\n */\n/**\n * The return type is narrowed to a template-literal type when both `url` and\n * `currentLocale` are string literals and the routing mode / defaultLocale are\n * not overridden via `options`.\n */\nexport const getLocalizedUrl = <\n const T extends string,\n const L extends LocalesValues = ResolvedDefaultLocale,\n>(\n url: T,\n currentLocale: L = internationalization?.defaultLocale as L,\n options: RoutingOptions = {}\n): LocalizedUrl<T, L> => {\n const { defaultLocale, mode, locales, rewrite, domains, currentDomain } =\n resolveRoutingConfig(options);\n\n const urlWithoutLocale = getPathWithoutLocale(url, locales);\n const rewriteRules = getRewriteRules(rewrite, 'url');\n\n if (\n !(\n process.env.INTLAYER_ROUTING_MODE &&\n process.env.INTLAYER_ROUTING_MODE !== 'no-prefix'\n ) &&\n mode === 'no-prefix'\n ) {\n return getLocalizedPath(\n getCanonicalPath(urlWithoutLocale, undefined, rewriteRules),\n currentLocale as Locale,\n rewriteRules\n ).path as LocalizedUrl<T, L>;\n }\n\n const isAbsoluteUrl = checkIsURLAbsolute(urlWithoutLocale);\n const parsedUrl = isAbsoluteUrl\n ? new URL(urlWithoutLocale)\n : new URL(urlWithoutLocale, 'http://example.com');\n\n const translatedPathname = getLocalizedPath(\n getCanonicalPath(parsedUrl.pathname, undefined, rewriteRules),\n currentLocale as Locale,\n rewriteRules\n ).path;\n\n // ── Domain routing ────────────────────────────────────────────────────────\n // Resolve the \"current\" hostname so we can choose between a relative URL\n // (same domain) and an absolute URL (cross-domain).\n //\n // Detection priority:\n // 1. Explicit `currentDomain` option passed by the caller.\n // 2. Hostname extracted from an absolute input URL.\n // 3. `window.location.hostname` in browser environments.\n // When none of these is available we fall back to generating an absolute\n // URL for domain-mapped locales (safe for SSR/static generation): the\n // locale prefix may already be stripped for domain-exclusive locales, so a\n // relative URL would silently point to the wrong locale on the current\n // domain.\n const detectedCurrentHostname =\n process.env.INTLAYER_ROUTING_DOMAINS !== 'false'\n ? getDomainHostname(\n currentDomain ??\n (isAbsoluteUrl ? parsedUrl.hostname : undefined) ??\n (typeof window !== 'undefined'\n ? window?.location?.hostname\n : undefined) ??\n ''\n ) || null\n : null;\n\n const localeDomain =\n process.env.INTLAYER_ROUTING_DOMAINS !== 'false'\n ? domains?.[currentLocale as LocalesValues]\n : undefined;\n\n const localeDomainHostname = localeDomain\n ? getDomainHostname(localeDomain)\n : null;\n\n // Prepend the locale's domain when it differs from the current hostname,\n // or when the current hostname is unknown (SSR without `currentDomain`).\n const isCrossDomain =\n localeDomainHostname !== null &&\n (detectedCurrentHostname === null ||\n localeDomainHostname !== detectedCurrentHostname);\n\n const normalizedDomain =\n isCrossDomain && localeDomain ? getDomainOrigin(localeDomain) : null;\n\n const baseUrl = normalizedDomain\n ? normalizedDomain\n : isAbsoluteUrl\n ? `${parsedUrl.protocol}//${parsedUrl.host}`\n : '';\n // ─────────────────────────────────────────────────────────────────────────\n\n if (\n !(\n process.env.INTLAYER_ROUTING_MODE &&\n process.env.INTLAYER_ROUTING_MODE !== 'search-params'\n ) &&\n mode === 'search-params'\n ) {\n const searchParams = new URLSearchParams(parsedUrl.search);\n\n searchParams.set('locale', currentLocale.toString());\n\n const queryParams = searchParams.toString();\n const path = queryParams\n ? `${translatedPathname}?${queryParams}`\n : translatedPathname;\n\n return `${baseUrl}${path}${parsedUrl.hash}` as LocalizedUrl<T, L>;\n }\n\n const { prefix } = getPrefix(currentLocale, {\n defaultLocale,\n mode,\n locales,\n domains,\n });\n\n let localizedPath = `/${prefix}${translatedPathname}`.replace(/\\/+/g, '/');\n\n if (localizedPath.length > 1 && localizedPath.endsWith('/')) {\n localizedPath = localizedPath.slice(0, -1);\n }\n\n return `${baseUrl}${localizedPath}${parsedUrl.search}${parsedUrl.hash}` as LocalizedUrl<\n T,\n L\n >;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,MAAa,mBAIX,KACA,gBAAmB,sBAAsB,eACzC,UAA0B,EAAE,KACL;CACvB,MAAM,EAAE,eAAe,MAAM,SAAS,SAAS,SAAS,kBACtD,qBAAqB,QAAQ;CAE/B,MAAM,mBAAmB,qBAAqB,KAAK,QAAQ;CAC3D,MAAM,eAAe,gBAAgB,SAAS,MAAM;AAEpD,KACE,EACE,QAAQ,IAAI,yBACZ,QAAQ,IAAI,0BAA0B,gBAExC,SAAS,YAET,QAAO,iBACL,iBAAiB,kBAAkB,QAAW,aAAa,EAC3D,eACA,aACD,CAAC;CAGJ,MAAM,gBAAgB,mBAAmB,iBAAiB;CAC1D,MAAM,YAAY,gBACd,IAAI,IAAI,iBAAiB,GACzB,IAAI,IAAI,kBAAkB,qBAAqB;CAEnD,MAAM,qBAAqB,iBACzB,iBAAiB,UAAU,UAAU,QAAW,aAAa,EAC7D,eACA,aACD,CAAC;CAeF,MAAM,0BACJ,QAAQ,IAAI,6BAA6B,UACrC,kBACE,kBACG,gBAAgB,UAAU,WAAW,YACrC,OAAO,WAAW,cACf,QAAQ,UAAU,WAClB,WACJ,GACH,IAAI,OACL;CAEN,MAAM,eACJ,QAAQ,IAAI,6BAA6B,UACrC,UAAU,iBACV;CAEN,MAAM,uBAAuB,eACzB,kBAAkB,aAAa,GAC/B;CASJ,MAAM,mBAJJ,yBAAyB,SACxB,4BAA4B,QAC3B,yBAAyB,4BAGV,eAAe,gBAAgB,aAAa,GAAG;CAElE,MAAM,UAAU,mBACZ,mBACA,gBACE,GAAG,UAAU,SAAS,IAAI,UAAU,SACpC;AAGN,KACE,EACE,QAAQ,IAAI,yBACZ,QAAQ,IAAI,0BAA0B,oBAExC,SAAS,iBACT;EACA,MAAM,eAAe,IAAI,gBAAgB,UAAU,OAAO;AAE1D,eAAa,IAAI,UAAU,cAAc,UAAU,CAAC;EAEpD,MAAM,cAAc,aAAa,UAAU;AAK3C,SAAO,GAAG,UAJG,cACT,GAAG,mBAAmB,GAAG,gBACzB,qBAEuB,UAAU;;CAGvC,MAAM,EAAE,WAAW,UAAU,eAAe;EAC1C;EACA;EACA;EACA;EACD,CAAC;CAEF,IAAI,gBAAgB,IAAI,SAAS,qBAAqB,QAAQ,QAAQ,IAAI;AAE1E,KAAI,cAAc,SAAS,KAAK,cAAc,SAAS,IAAI,CACzD,iBAAgB,cAAc,MAAM,GAAG,GAAG;AAG5C,QAAO,GAAG,UAAU,gBAAgB,UAAU,SAAS,UAAU"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isLocaleExclusiveOnDomain } from "./domainUtils.mjs";
|
|
1
2
|
import { internationalization, routing } from "@intlayer/config/built";
|
|
2
3
|
import { DEFAULT_LOCALE, LOCALES, ROUTING_MODE } from "@intlayer/config/defaultValues";
|
|
3
4
|
|
|
@@ -53,15 +54,10 @@ const getPrefix = (locale, options = {}) => {
|
|
|
53
54
|
prefix: "",
|
|
54
55
|
localePrefix: void 0
|
|
55
56
|
};
|
|
56
|
-
if (process.env.INTLAYER_ROUTING_DOMAINS !== "false" && domains) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
prefix: "",
|
|
61
|
-
localePrefix: void 0
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
57
|
+
if (process.env.INTLAYER_ROUTING_DOMAINS !== "false" && isLocaleExclusiveOnDomain(locale, domains)) return {
|
|
58
|
+
prefix: "",
|
|
59
|
+
localePrefix: void 0
|
|
60
|
+
};
|
|
65
61
|
if (mode === "prefix-all" || mode === "prefix-no-default" && defaultLocale !== locale) return {
|
|
66
62
|
prefix: `${locale}/`,
|
|
67
63
|
localePrefix: locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPrefix.mjs","names":[],"sources":["../../../src/localization/getPrefix.ts"],"sourcesContent":["import { internationalization, routing } from '@intlayer/config/built';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n ROUTING_MODE,\n} from '@intlayer/config/defaultValues';\n\n// ── Tree-shake constants ──────────────────────────────────────────────────────\n// When these env vars are injected at build time, bundlers eliminate the\n// branches guarded by these constants.\n\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { RoutingConfig } from '@intlayer/types/config';\nimport type {\n DeclaredLocales,\n LocalesValues,\n ResolvedDefaultLocale,\n ResolvedRoutingMode,\n} from '@intlayer/types/module_augmentation';\n\n/**\n * Shared routing options used across all URL localization functions.\n */\nexport type RoutingOptions = {\n locales?: LocalesValues[];\n defaultLocale?: LocalesValues;\n mode?: RoutingConfig['mode'];\n rewrite?: RoutingConfig['rewrite'];\n domains?: RoutingConfig['domains'];\n /**\n * The hostname of the page currently being rendered (e.g. `'intlayer.org'`).\n * When provided, `getLocalizedUrl` returns a relative URL for locales whose\n * configured domain matches `currentDomain`, and an absolute URL only when\n * the target locale lives on a different domain.\n *\n * When omitted the function tries to infer it from:\n * 1. The domain of an absolute input URL.\n * 2. `window.location.hostname` in browser environments.\n * Falls back to always generating absolute URLs when neither is available.\n */\n currentDomain?: string;\n};\n\n/**\n * Resolves routing configuration by merging provided options with configuration defaults.\n * Single source of truth for default routing config resolution across all localization functions.\n */\nexport const resolveRoutingConfig = (\n options: RoutingOptions = {}\n): Omit<RoutingOptions, 'defaultLocale' | 'mode' | 'locales'> & {\n defaultLocale: LocalesValues;\n mode: RoutingConfig['mode'];\n locales: LocalesValues[];\n} => ({\n defaultLocale: internationalization?.defaultLocale ?? DEFAULT_LOCALE,\n mode: routing?.mode ?? ROUTING_MODE,\n locales: internationalization?.locales ?? LOCALES,\n rewrite: routing?.rewrite,\n domains: routing?.domains,\n ...options,\n});\n\nexport type GetPrefixOptions = {\n defaultLocale?: LocalesValues;\n mode?: RoutingConfig['mode'];\n};\n\nexport type GetPrefixResult = {\n /**\n * The locale path segment appended to `/`, with a trailing slash (e.g. `'fr/'`).\n * Empty string when no prefix is needed.\n */\n prefix: string;\n /**\n * The bare locale identifier (e.g. `'fr'`), or `undefined` when no prefix is applied.\n */\n localePrefix: Locale | undefined;\n};\n\n/**\n * Narrowed return type for {@link getPrefix} that carries the locale literal through.\n *\n * Distributes over union locales — calling `getPrefix('fr')` in `prefix-no-default`\n * mode with `defaultLocale = 'en'` resolves to `{ prefix: 'fr/'; localePrefix: 'fr' }`.\n *\n * Note: domain-based routing and \"locale not in locales\" edge cases may return an\n * empty result at runtime regardless of what this type reports.\n */\nexport type GetPrefixResultNarrowed<\n L extends LocalesValues | undefined,\n Mode extends string = ResolvedRoutingMode,\n Default extends LocalesValues = ResolvedDefaultLocale,\n> = L extends string\n ? [string] extends [L] // L is wide (string / LocalesValues) → distribute over declared locales\n ? GetPrefixResultNarrowed<DeclaredLocales, Mode, Default>\n : [string] extends [Mode]\n ? GetPrefixResult // mode is wide → fall back to generic result\n : Mode extends 'prefix-all'\n ? { prefix: `${L}/`; localePrefix: L }\n : Mode extends 'prefix-no-default'\n ? L extends Default\n ? { prefix: ''; localePrefix: undefined }\n : { prefix: `${L}/`; localePrefix: L }\n : { prefix: ''; localePrefix: undefined } // no-prefix / search-params\n : { prefix: ''; localePrefix: undefined }; // locale is undefined\n\n/**\n * Determines the URL prefix for a given locale based on the routing mode configuration.\n *\n * Example:\n *\n * ```ts\n * // prefix-no-default mode with default locale\n * getPrefix('en', { defaultLocale: 'en', mode: 'prefix-no-default' })\n * // Returns { prefix: '', localePrefix: undefined }\n *\n * // prefix-no-default mode with non-default locale\n * getPrefix('fr', { defaultLocale: 'en', mode: 'prefix-no-default' })\n * // Returns { prefix: '/fr', localePrefix: 'fr' }\n *\n * // prefix-all mode\n * getPrefix('en', { defaultLocale: 'en', mode: 'prefix-all' })\n * // Returns { prefix: '/en', localePrefix: locale }\n *\n * // search-params mode\n * getPrefix('en', { defaultLocale: 'en', mode: 'search-params' })\n * // Returns { prefix: '', localePrefix: undefined }\n *\n * // no-prefix mode\n * getPrefix('en', { defaultLocale: 'en', mode: 'no-prefix' })\n * // Returns { prefix: '', localePrefix: undefined }\n * ```\n *\n * @param locale - The locale to check for prefix. If not provided, uses configured default locale.\n * @param options - Configuration options\n * @param options.defaultLocale - The default locale. Defaults to configured default locale.\n * @param options.mode - URL routing mode for locale handling. Defaults to configured mode.\n * @returns An object containing pathPrefix, prefix, and localePrefix for the given locale.\n */\nexport const getPrefix = <const L extends LocalesValues | undefined>(\n locale: L,\n options: RoutingOptions = {}\n): GetPrefixResultNarrowed<L> => {\n const { defaultLocale, mode, locales, domains } =\n resolveRoutingConfig(options);\n\n if (\n (process.env.INTLAYER_ROUTING_MODE &&\n process.env.INTLAYER_ROUTING_MODE !== 'prefix-all' &&\n process.env.INTLAYER_ROUTING_MODE !== 'prefix-no-default') ||\n !locale ||\n !locales.includes(locale)\n ) {\n return {\n prefix: '',\n localePrefix: undefined,\n } as GetPrefixResultNarrowed<L>;\n }\n\n // If this locale is the only one assigned to its domain, no URL prefix is needed\n // (the domain itself identifies the locale). Shared domains use normal prefix logic.\n if (process.env.INTLAYER_ROUTING_DOMAINS !== 'false'
|
|
1
|
+
{"version":3,"file":"getPrefix.mjs","names":[],"sources":["../../../src/localization/getPrefix.ts"],"sourcesContent":["import { internationalization, routing } from '@intlayer/config/built';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n ROUTING_MODE,\n} from '@intlayer/config/defaultValues';\n\n// ── Tree-shake constants ──────────────────────────────────────────────────────\n// When these env vars are injected at build time, bundlers eliminate the\n// branches guarded by these constants.\n\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { RoutingConfig } from '@intlayer/types/config';\nimport type {\n DeclaredLocales,\n LocalesValues,\n ResolvedDefaultLocale,\n ResolvedRoutingMode,\n} from '@intlayer/types/module_augmentation';\nimport { isLocaleExclusiveOnDomain } from './domainUtils';\n\n/**\n * Shared routing options used across all URL localization functions.\n */\nexport type RoutingOptions = {\n locales?: LocalesValues[];\n defaultLocale?: LocalesValues;\n mode?: RoutingConfig['mode'];\n rewrite?: RoutingConfig['rewrite'];\n domains?: RoutingConfig['domains'];\n /**\n * The hostname of the page currently being rendered (e.g. `'intlayer.org'`).\n * When provided, `getLocalizedUrl` returns a relative URL for locales whose\n * configured domain matches `currentDomain`, and an absolute URL only when\n * the target locale lives on a different domain.\n *\n * When omitted the function tries to infer it from:\n * 1. The domain of an absolute input URL.\n * 2. `window.location.hostname` in browser environments.\n * Falls back to always generating absolute URLs when neither is available.\n */\n currentDomain?: string;\n};\n\n/**\n * Resolves routing configuration by merging provided options with configuration defaults.\n * Single source of truth for default routing config resolution across all localization functions.\n */\nexport const resolveRoutingConfig = (\n options: RoutingOptions = {}\n): Omit<RoutingOptions, 'defaultLocale' | 'mode' | 'locales'> & {\n defaultLocale: LocalesValues;\n mode: RoutingConfig['mode'];\n locales: LocalesValues[];\n} => ({\n defaultLocale: internationalization?.defaultLocale ?? DEFAULT_LOCALE,\n mode: routing?.mode ?? ROUTING_MODE,\n locales: internationalization?.locales ?? LOCALES,\n rewrite: routing?.rewrite,\n domains: routing?.domains,\n ...options,\n});\n\nexport type GetPrefixOptions = {\n defaultLocale?: LocalesValues;\n mode?: RoutingConfig['mode'];\n};\n\nexport type GetPrefixResult = {\n /**\n * The locale path segment appended to `/`, with a trailing slash (e.g. `'fr/'`).\n * Empty string when no prefix is needed.\n */\n prefix: string;\n /**\n * The bare locale identifier (e.g. `'fr'`), or `undefined` when no prefix is applied.\n */\n localePrefix: Locale | undefined;\n};\n\n/**\n * Narrowed return type for {@link getPrefix} that carries the locale literal through.\n *\n * Distributes over union locales — calling `getPrefix('fr')` in `prefix-no-default`\n * mode with `defaultLocale = 'en'` resolves to `{ prefix: 'fr/'; localePrefix: 'fr' }`.\n *\n * Note: domain-based routing and \"locale not in locales\" edge cases may return an\n * empty result at runtime regardless of what this type reports.\n */\nexport type GetPrefixResultNarrowed<\n L extends LocalesValues | undefined,\n Mode extends string = ResolvedRoutingMode,\n Default extends LocalesValues = ResolvedDefaultLocale,\n> = L extends string\n ? [string] extends [L] // L is wide (string / LocalesValues) → distribute over declared locales\n ? GetPrefixResultNarrowed<DeclaredLocales, Mode, Default>\n : [string] extends [Mode]\n ? GetPrefixResult // mode is wide → fall back to generic result\n : Mode extends 'prefix-all'\n ? { prefix: `${L}/`; localePrefix: L }\n : Mode extends 'prefix-no-default'\n ? L extends Default\n ? { prefix: ''; localePrefix: undefined }\n : { prefix: `${L}/`; localePrefix: L }\n : { prefix: ''; localePrefix: undefined } // no-prefix / search-params\n : { prefix: ''; localePrefix: undefined }; // locale is undefined\n\n/**\n * Determines the URL prefix for a given locale based on the routing mode configuration.\n *\n * Example:\n *\n * ```ts\n * // prefix-no-default mode with default locale\n * getPrefix('en', { defaultLocale: 'en', mode: 'prefix-no-default' })\n * // Returns { prefix: '', localePrefix: undefined }\n *\n * // prefix-no-default mode with non-default locale\n * getPrefix('fr', { defaultLocale: 'en', mode: 'prefix-no-default' })\n * // Returns { prefix: '/fr', localePrefix: 'fr' }\n *\n * // prefix-all mode\n * getPrefix('en', { defaultLocale: 'en', mode: 'prefix-all' })\n * // Returns { prefix: '/en', localePrefix: locale }\n *\n * // search-params mode\n * getPrefix('en', { defaultLocale: 'en', mode: 'search-params' })\n * // Returns { prefix: '', localePrefix: undefined }\n *\n * // no-prefix mode\n * getPrefix('en', { defaultLocale: 'en', mode: 'no-prefix' })\n * // Returns { prefix: '', localePrefix: undefined }\n * ```\n *\n * @param locale - The locale to check for prefix. If not provided, uses configured default locale.\n * @param options - Configuration options\n * @param options.defaultLocale - The default locale. Defaults to configured default locale.\n * @param options.mode - URL routing mode for locale handling. Defaults to configured mode.\n * @returns An object containing pathPrefix, prefix, and localePrefix for the given locale.\n */\nexport const getPrefix = <const L extends LocalesValues | undefined>(\n locale: L,\n options: RoutingOptions = {}\n): GetPrefixResultNarrowed<L> => {\n const { defaultLocale, mode, locales, domains } =\n resolveRoutingConfig(options);\n\n if (\n (process.env.INTLAYER_ROUTING_MODE &&\n process.env.INTLAYER_ROUTING_MODE !== 'prefix-all' &&\n process.env.INTLAYER_ROUTING_MODE !== 'prefix-no-default') ||\n !locale ||\n !locales.includes(locale)\n ) {\n return {\n prefix: '',\n localePrefix: undefined,\n } as GetPrefixResultNarrowed<L>;\n }\n\n // If this locale is the only one assigned to its domain, no URL prefix is needed\n // (the domain itself identifies the locale). Shared domains use normal prefix logic.\n if (\n process.env.INTLAYER_ROUTING_DOMAINS !== 'false' &&\n isLocaleExclusiveOnDomain(locale as LocalesValues, domains)\n ) {\n return {\n prefix: '',\n localePrefix: undefined,\n } as GetPrefixResultNarrowed<L>;\n }\n\n // Handle prefix-based modes (prefix-all or prefix-no-default)\n const shouldPrefix =\n mode === 'prefix-all' ||\n (mode === 'prefix-no-default' && defaultLocale !== locale);\n\n if (shouldPrefix) {\n return {\n prefix: `${locale}/`,\n localePrefix: locale as Locale,\n } as GetPrefixResultNarrowed<L>;\n }\n\n return {\n prefix: '',\n localePrefix: undefined,\n } as GetPrefixResultNarrowed<L>;\n};\n"],"mappings":";;;;;;;;;AAgDA,MAAa,wBACX,UAA0B,EAAE,MAKxB;CACJ,eAAe,sBAAsB,iBAAiB;CACtD,MAAM,SAAS,QAAQ;CACvB,SAAS,sBAAsB,WAAW;CAC1C,SAAS,SAAS;CAClB,SAAS,SAAS;CAClB,GAAG;CACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+ED,MAAa,aACX,QACA,UAA0B,EAAE,KACG;CAC/B,MAAM,EAAE,eAAe,MAAM,SAAS,YACpC,qBAAqB,QAAQ;AAE/B,KACG,QAAQ,IAAI,yBACX,QAAQ,IAAI,0BAA0B,gBACtC,QAAQ,IAAI,0BAA0B,uBACxC,CAAC,UACD,CAAC,QAAQ,SAAS,OAAO,CAEzB,QAAO;EACL,QAAQ;EACR,cAAc;EACf;AAKH,KACE,QAAQ,IAAI,6BAA6B,WACzC,0BAA0B,QAAyB,QAAQ,CAE3D,QAAO;EACL,QAAQ;EACR,cAAc;EACf;AAQH,KAHE,SAAS,gBACR,SAAS,uBAAuB,kBAAkB,OAGnD,QAAO;EACL,QAAQ,GAAG,OAAO;EAClB,cAAc;EACf;AAGH,QAAO;EACL,QAAQ;EACR,cAAc;EACf"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getPathWithoutLocale } from "./getPathWithoutLocale.mjs";
|
|
2
2
|
import { comparePaths, normalizePath } from "./comparePaths.mjs";
|
|
3
|
+
import { getDomainHostname, getDomainOrigin, getLocaleFromDomain, isLocaleExclusiveOnDomain } from "./domainUtils.mjs";
|
|
3
4
|
import { getPrefix } from "./getPrefix.mjs";
|
|
4
5
|
import { getCanonicalPath, getInternalPath, getLocalizedPath, getRewritePath, getRewriteRules } from "./rewriteUtils.mjs";
|
|
5
6
|
import { getLocalizedUrl } from "./getLocalizedUrl.mjs";
|
|
@@ -16,4 +17,4 @@ import { getLocaleName } from "./getLocaleName.mjs";
|
|
|
16
17
|
import { localeFlatMap, localeMap, localeRecord } from "./localeMapper.mjs";
|
|
17
18
|
import { validatePrefix } from "./validatePrefix.mjs";
|
|
18
19
|
|
|
19
|
-
export { comparePaths, generateSitemap, generateSitemapUrl, getBrowserLocale, getCanonicalPath, getHTMLTextDir, getInternalPath, getLocale, getLocaleFromPath, getLocaleLang, getLocaleName, getLocalizedPath, getLocalizedUrl, getMultilingualUrls, getPathWithoutLocale, getPrefix, getRewritePath, getRewriteRules, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, normalizePath, validatePrefix };
|
|
20
|
+
export { comparePaths, generateSitemap, generateSitemapUrl, getBrowserLocale, getCanonicalPath, getDomainHostname, getDomainOrigin, getHTMLTextDir, getInternalPath, getLocale, getLocaleFromDomain, getLocaleFromPath, getLocaleLang, getLocaleName, getLocalizedPath, getLocalizedUrl, getMultilingualUrls, getPathWithoutLocale, getPrefix, getRewritePath, getRewriteRules, isLocaleExclusiveOnDomain, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, normalizePath, validatePrefix };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { icuToIntlayerFormatter, intlayerToICUFormatter } from "./ICU.mjs";
|
|
2
2
|
import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./i18next.mjs";
|
|
3
|
+
import { navigatePath } from "./navigatePath.mjs";
|
|
3
4
|
import { intlayerToPortableObjectFormatter, portableObjectToIntlayerFormatter } from "./po.mjs";
|
|
4
5
|
import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./vue-i18n.mjs";
|
|
5
6
|
import { interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode } from "./resolveMessage.mjs";
|
|
6
7
|
|
|
7
|
-
export { i18nextToIntlayerFormatter, icuToIntlayerFormatter, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, parseTaggedMessage, portableObjectToIntlayerFormatter, resolveMessage, resolveMessageNode, vueI18nToIntlayerFormatter };
|
|
8
|
+
export { i18nextToIntlayerFormatter, icuToIntlayerFormatter, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, navigatePath, parseTaggedMessage, portableObjectToIntlayerFormatter, resolveMessage, resolveMessageNode, vueI18nToIntlayerFormatter };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/messageFormat/navigatePath.ts
|
|
2
|
+
/**
|
|
3
|
+
* Reads a dotted `path` (e.g. `counter.label`) out of a nested content value.
|
|
4
|
+
*
|
|
5
|
+
* The full path is first tried as a *flat* property, supporting catalogs that
|
|
6
|
+
* use dotted keys as literal field names (i18next flat JSON files, lingui
|
|
7
|
+
* catalogs: `{ "section.title": "value" }`). When that misses, the path is
|
|
8
|
+
* split on `keySeparator` and walked segment by segment.
|
|
9
|
+
*
|
|
10
|
+
* Shared by every compat adapter's translation lookup — do not re-implement
|
|
11
|
+
* it locally.
|
|
12
|
+
*
|
|
13
|
+
* @param contentValue - The object (dictionary content) to read from.
|
|
14
|
+
* @param path - Separator-delimited path. An empty path returns `contentValue`.
|
|
15
|
+
* @param keySeparator - Segment separator; `false` disables nested traversal
|
|
16
|
+
* (flat lookup only), mirroring i18next's `keySeparator: false`.
|
|
17
|
+
* @returns The value found at `path`, or `undefined` when any segment is absent.
|
|
18
|
+
*/
|
|
19
|
+
const navigatePath = (contentValue, path, keySeparator = ".") => {
|
|
20
|
+
if (!path) return contentValue;
|
|
21
|
+
if (contentValue !== null && contentValue !== void 0 && typeof contentValue === "object") {
|
|
22
|
+
const flatValue = contentValue[path];
|
|
23
|
+
if (flatValue !== void 0) return flatValue;
|
|
24
|
+
}
|
|
25
|
+
if (keySeparator === false || !path.includes(keySeparator)) return;
|
|
26
|
+
let current = contentValue;
|
|
27
|
+
for (const part of path.split(keySeparator)) {
|
|
28
|
+
if (current === null || current === void 0 || typeof current !== "object") return;
|
|
29
|
+
current = current[part];
|
|
30
|
+
}
|
|
31
|
+
return current;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { navigatePath };
|
|
36
|
+
//# sourceMappingURL=navigatePath.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigatePath.mjs","names":[],"sources":["../../../src/messageFormat/navigatePath.ts"],"sourcesContent":["/**\n * Reads a dotted `path` (e.g. `counter.label`) out of a nested content value.\n *\n * The full path is first tried as a *flat* property, supporting catalogs that\n * use dotted keys as literal field names (i18next flat JSON files, lingui\n * catalogs: `{ \"section.title\": \"value\" }`). When that misses, the path is\n * split on `keySeparator` and walked segment by segment.\n *\n * Shared by every compat adapter's translation lookup — do not re-implement\n * it locally.\n *\n * @param contentValue - The object (dictionary content) to read from.\n * @param path - Separator-delimited path. An empty path returns `contentValue`.\n * @param keySeparator - Segment separator; `false` disables nested traversal\n * (flat lookup only), mirroring i18next's `keySeparator: false`.\n * @returns The value found at `path`, or `undefined` when any segment is absent.\n */\nexport const navigatePath = (\n contentValue: unknown,\n path: string,\n keySeparator: string | false = '.'\n): unknown => {\n if (!path) return contentValue;\n\n if (\n contentValue !== null &&\n contentValue !== undefined &&\n typeof contentValue === 'object'\n ) {\n const flatValue = (contentValue as Record<string, unknown>)[path];\n if (flatValue !== undefined) return flatValue;\n }\n\n if (keySeparator === false || !path.includes(keySeparator)) {\n return undefined;\n }\n\n let current: unknown = contentValue;\n for (const part of path.split(keySeparator)) {\n if (\n current === null ||\n current === undefined ||\n typeof current !== 'object'\n ) {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,gBACX,cACA,MACA,eAA+B,QACnB;AACZ,KAAI,CAAC,KAAM,QAAO;AAElB,KACE,iBAAiB,QACjB,iBAAiB,UACjB,OAAO,iBAAiB,UACxB;EACA,MAAM,YAAa,aAAyC;AAC5D,MAAI,cAAc,OAAW,QAAO;;AAGtC,KAAI,iBAAiB,SAAS,CAAC,KAAK,SAAS,aAAa,CACxD;CAGF,IAAI,UAAmB;AACvB,MAAK,MAAM,QAAQ,KAAK,MAAM,aAAa,EAAE;AAC3C,MACE,YAAY,QACZ,YAAY,UACZ,OAAO,YAAY,SAEnB;AAEF,YAAW,QAAoC;;AAEjD,QAAO"}
|
|
@@ -37,7 +37,7 @@ declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, l
|
|
|
37
37
|
filePath?: string;
|
|
38
38
|
tags?: string[];
|
|
39
39
|
item?: number;
|
|
40
|
-
variant?:
|
|
40
|
+
variant?: _$_intlayer_types0.DictionaryVariantValue | _$_intlayer_types0.DictionaryVariantValue[];
|
|
41
41
|
locale?: LocalesValues;
|
|
42
42
|
contentAutoTransformation?: _$_intlayer_types0.ContentAutoTransformation;
|
|
43
43
|
fill?: _$_intlayer_types0.Fill;
|
|
@@ -29,7 +29,7 @@ declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, loca
|
|
|
29
29
|
filePath?: string;
|
|
30
30
|
tags?: string[];
|
|
31
31
|
item?: number;
|
|
32
|
-
variant?:
|
|
32
|
+
variant?: _$_intlayer_types0.DictionaryVariantValue | _$_intlayer_types0.DictionaryVariantValue[];
|
|
33
33
|
locale?: LocalesValues;
|
|
34
34
|
contentAutoTransformation?: _$_intlayer_types0.ContentAutoTransformation;
|
|
35
35
|
fill?: _$_intlayer_types0.Fill;
|
|
@@ -21,7 +21,7 @@ declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: Loc
|
|
|
21
21
|
filePath?: string;
|
|
22
22
|
tags?: string[];
|
|
23
23
|
item?: number;
|
|
24
|
-
variant?:
|
|
24
|
+
variant?: _$_intlayer_types0.DictionaryVariantValue | _$_intlayer_types0.DictionaryVariantValue[];
|
|
25
25
|
locale?: LocalesValues;
|
|
26
26
|
contentAutoTransformation?: _$_intlayer_types0.ContentAutoTransformation;
|
|
27
27
|
fill?: _$_intlayer_types0.Fill;
|
|
@@ -8,8 +8,8 @@ import { mergeDictionaries } from "./mergeDictionaries.js";
|
|
|
8
8
|
import { mergeQualifiedDictionaries } from "./mergeQualifiedDictionaries.js";
|
|
9
9
|
import { normalizeDictionaries, normalizeDictionary } from "./normalizeDictionary.js";
|
|
10
10
|
import { orderDictionaries } from "./orderDictionaries.js";
|
|
11
|
-
import { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree,
|
|
11
|
+
import { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant } from "./qualifiedDictionary.js";
|
|
12
12
|
import { removeContentNodeByKeyPath } from "./removeContentNodeByKeyPath.js";
|
|
13
13
|
import { renameContentNodeByKeyPath } from "./renameContentNodeByKeyPath.js";
|
|
14
14
|
import { updateNodeChildren } from "./updateNodeChildren.js";
|
|
15
|
-
export { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, editDictionaryByKeyPath, getContentNodeByKeyPath, getDefaultNode,
|
|
15
|
+
export { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, editDictionaryByKeyPath, getContentNodeByKeyPath, getDefaultNode, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getEmptyNode, getNodeChildren, getNodeType, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, mergeDictionaries, mergeQualifiedDictionaries, normalizeDictionaries, normalizeDictionary, orderDictionaries, parseDictionarySelector, reconstructQualifiedEntry, removeContentNodeByKeyPath, renameContentNodeByKeyPath, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant, updateNodeChildren };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dictionary, DictionaryQualifierType, DictionarySelector, QualifiedDictionaryGroup } from "@intlayer/types/dictionary";
|
|
1
|
+
import { Dictionary, DictionaryQualifierType, DictionarySelector, DictionaryVariantValue, QualifiedDictionaryGroup } from "@intlayer/types/dictionary";
|
|
2
2
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
3
3
|
|
|
4
4
|
//#region src/dictionaryManipulator/qualifiedDictionary.d.ts
|
|
@@ -14,18 +14,32 @@ declare const QUALIFIER_ORDER: readonly ["variant", "item"];
|
|
|
14
14
|
*/
|
|
15
15
|
declare const COMPOSITE_ID_SEPARATOR = "/";
|
|
16
16
|
/**
|
|
17
|
-
* Canonical serialization of a variant value into its identity string —
|
|
18
|
-
* variant segment of a composite id
|
|
17
|
+
* Canonical serialization of a single variant value into its identity string —
|
|
18
|
+
* the variant segment of a composite id, the chunk directory name in dynamic
|
|
19
|
+
* mode, and the runtime matching key.
|
|
19
20
|
*
|
|
20
21
|
* - `undefined` → `'default'` (the implicit fallback variant)
|
|
21
22
|
* - a string → the string itself (a named variant)
|
|
22
23
|
* - an object → its sorted `key=value` pairs joined by `&`
|
|
23
24
|
* (e.g. `{ userId: '123', id: 'abc' }` → `'id=abc&userId=123'`)
|
|
24
25
|
*
|
|
26
|
+
* Characters that are unsafe in file paths or generated code are
|
|
27
|
+
* percent-encoded (fixed-width `%XXXX` runs, injective). Common names —
|
|
28
|
+
* letters, digits, `-` `_` `.` — are left untouched. Both the declaration and
|
|
29
|
+
* the selector go through this function, so encoding never affects matching.
|
|
30
|
+
*
|
|
25
31
|
* Two variants resolve to the same entry iff their serializations are equal, so
|
|
26
32
|
* an object variant in a selector must equal the one declared on the dictionary.
|
|
27
33
|
*/
|
|
28
|
-
declare const serializeVariant: (variant:
|
|
34
|
+
declare const serializeVariant: (variant: DictionaryVariantValue | undefined) => string;
|
|
35
|
+
/**
|
|
36
|
+
* Normalizes the `variant` field of a dictionary into the list of variant ids
|
|
37
|
+
* the declaration registers under. A single value yields one id; an **array**
|
|
38
|
+
* fans out into one id per element (duplicates collapsed). Returns `undefined`
|
|
39
|
+
* when the dictionary does not declare the variant dimension (no `variant`
|
|
40
|
+
* field, or an empty array).
|
|
41
|
+
*/
|
|
42
|
+
declare const getVariantIds: (variant: Dictionary["variant"]) => string[] | undefined;
|
|
29
43
|
/**
|
|
30
44
|
* Returns the qualifier dimensions declared on a dictionary, in canonical
|
|
31
45
|
* order (`variant → item`). Empty when the dictionary is unqualified
|
|
@@ -33,24 +47,21 @@ declare const serializeVariant: (variant: string | Record<string, string | numbe
|
|
|
33
47
|
*/
|
|
34
48
|
declare const getDictionaryQualifierTypes: (dictionary: Dictionary) => DictionaryQualifierType[];
|
|
35
49
|
/**
|
|
36
|
-
* Returns the qualifier
|
|
37
|
-
* dimension —
|
|
50
|
+
* Returns the qualifier identifiers of a dictionary for the given qualifier
|
|
51
|
+
* dimension — the candidate segments of the composite entry ids.
|
|
38
52
|
*
|
|
39
|
-
* - 'variant' → the serialized variant (
|
|
40
|
-
* -
|
|
41
|
-
|
|
42
|
-
declare const getDictionaryQualifierId: (dictionary: Dictionary, qualifierType: DictionaryQualifierType) => string | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Returns the per-dimension id segments of a dictionary for the given ordered
|
|
45
|
-
* dimension set, or `undefined` when the dictionary does not declare every
|
|
46
|
-
* dimension of the set.
|
|
53
|
+
* - 'variant' → the serialized variant id(s); an array variant yields one id
|
|
54
|
+
* per element (declaration-side fan-out)
|
|
55
|
+
* - 'item' → the item index as a single-element list
|
|
47
56
|
*/
|
|
48
|
-
declare const
|
|
57
|
+
declare const getDictionaryQualifierIds: (dictionary: Dictionary, qualifierType: DictionaryQualifierType) => string[] | undefined;
|
|
49
58
|
/**
|
|
50
|
-
* Builds
|
|
51
|
-
* joined in canonical order.
|
|
59
|
+
* Builds every composite entry id of a dictionary — the cartesian product of
|
|
60
|
+
* its per-dimension id lists, joined in canonical order. A dictionary with a
|
|
61
|
+
* plain (non-array) variant yields exactly one id; an array variant fans out
|
|
62
|
+
* into one id per element. `undefined` when a dimension of the set is missing.
|
|
52
63
|
*/
|
|
53
|
-
declare const
|
|
64
|
+
declare const getDictionaryCompositeIds: (dictionary: Dictionary, qualifierTypes: DictionaryQualifierType[]) => string[] | undefined;
|
|
54
65
|
/**
|
|
55
66
|
* Type guard discriminating a `QualifiedDictionaryGroup` (merge output of a
|
|
56
67
|
* qualified key) from a plain `Dictionary`. Both carry a `content` field; only
|
|
@@ -62,11 +73,11 @@ declare const isQualifiedDictionaryGroup: (value: unknown) => value is Qualified
|
|
|
62
73
|
* qualified group: the content node stored under its composite id, plus the
|
|
63
74
|
* qualifier coordinates decoded from that id (`variant`, `item`).
|
|
64
75
|
*
|
|
65
|
-
* This keeps the resolver's
|
|
76
|
+
* This keeps the resolver's transform code unchanged: it still sees a
|
|
66
77
|
* `{ key, content, variant?, item? }` shape, even though the stored format no
|
|
67
78
|
* longer duplicates those fields per entry. The `variant` coordinate stays in
|
|
68
|
-
* its serialized form
|
|
69
|
-
*
|
|
79
|
+
* its serialized (encoded) form, e.g. `'id=abc&userId=123'` — matching happens
|
|
80
|
+
* on the composite id segments, never on this reconstructed field.
|
|
70
81
|
*/
|
|
71
82
|
declare const reconstructQualifiedEntry: (group: QualifiedDictionaryGroup, compositeId: string) => Dictionary;
|
|
72
83
|
/**
|
|
@@ -185,5 +196,5 @@ declare const resolveQualifiedDynamicContentAsync: <Content>(params: {
|
|
|
185
196
|
transform: (dictionary: Dictionary) => Content;
|
|
186
197
|
}) => Promise<Content | Content[] | null>;
|
|
187
198
|
//#endregion
|
|
188
|
-
export { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree,
|
|
199
|
+
export { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant };
|
|
189
200
|
//# sourceMappingURL=qualifiedDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qualifiedDictionary.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/qualifiedDictionary.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"qualifiedDictionary.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/qualifiedDictionary.ts"],"mappings":";;;;;;AAcA;;;cAAa,eAAA;;AASb;;;cAAa,sBAAA;;AAqDb;;;;;AAwBA;;;;;AAgBA;;;;;;;cAxCa,gBAAA,GACX,OAAA,EAAS,sBAAA;;AA4DX;;;;;;cArCa,aAAA,GACX,OAAA,EAAS,UAAA;;;;AAoDX;;cArCa,2BAAA,GACX,UAAA,EAAY,UAAA,KACX,uBAAA;;;;;;;;AAsFH;cAnEa,yBAAA,GACX,UAAA,EAAY,UAAA,EACZ,aAAA,EAAe,uBAAA;;;;;;;cAcJ,yBAAA,GACX,UAAA,EAAY,UAAA,EACZ,cAAA,EAAgB,uBAAA;AAqElB;;;;;AAAA,cApBa,0BAAA,GACX,KAAA,cACC,KAAA,IAAS,wBAAA;;;;;AAqDZ;;;;;;;cAnCa,yBAAA,GACX,KAAA,EAAO,wBAAA,EACP,WAAA,aACC,UAAA;;;;;;;;;;;;AAkEH;;cAlCa,0BAAA,GACX,iBAAA,EAAmB,UAAA,GAAa,wBAAA,EAChC,QAAA,GAAW,kBAAA,KACV,UAAA,GAAa,UAAA;;;;;cA+BH,uBAAA,aAAqC,aAAA,EAChD,gBAAA,GAAmB,CAAA,GAAI,kBAAA;EACpB,MAAA,GAAS,CAAA;EAAG,QAAA,GAAW,kBAAA;AAAA;;;;;cAef,6BAAA,GACX,QAAA,GAAW,kBAAA;;;;;;AADb;cAyBa,2BAAA;;;;KAKD,uBAAA,SAAgC,OAAA,CAAQ,UAAA;;;;;KAMxC,0BAAA;EAAA,CACT,OAAA,WAAkB,0BAAA,GAA6B,uBAAA;AAAA;;;AADlD;;;;;;;;;AAgBA;KAAY,yBAAA;EAAA,CACT,2BAAA,GAA8B,uBAAA;EAAA,CAC9B,MAAA,WAAiB,0BAAA,GAA6B,uBAAA;AAAA;;;;;cAOpC,2BAAA,GACX,KAAA,cACC,KAAA,IAAS,yBAAA;;;;;;;AAFZ;;;;;;;;;AA+GA;;;;;;;;cAAa,8BAAA,YAA2C,MAAA;EACtD,SAAA,EAAW,yBAAA;EACX,GAAA;EACA,MAAA;EACA,QAAA,EAAU,kBAAA;EACV,SAAA,GAAY,QAAA,UAAkB,OAAA,EAAS,OAAA,CAAQ,UAAA,MAAgB,UAAA;EAC/D,SAAA,GAAY,UAAA,EAAY,UAAA,KAAe,OAAA;AAAA,MACrC,OAAA,GAAU,OAAA;;;;;;;;;;;;cAkCD,mCAAA,YAAsD,MAAA;EACjE,SAAA,EAAW,yBAAA;EACX,GAAA;EACA,MAAA;EACA,QAAA,EAAU,kBAAA;EACV,SAAA,GAAY,UAAA,EAAY,UAAA,KAAe,OAAA;AAAA,MACrC,OAAA,CAAQ,OAAA,GAAU,OAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ import { mergeDictionaries } from "./dictionaryManipulator/mergeDictionaries.js"
|
|
|
46
46
|
import { mergeQualifiedDictionaries } from "./dictionaryManipulator/mergeQualifiedDictionaries.js";
|
|
47
47
|
import { normalizeDictionaries, normalizeDictionary } from "./dictionaryManipulator/normalizeDictionary.js";
|
|
48
48
|
import { orderDictionaries } from "./dictionaryManipulator/orderDictionaries.js";
|
|
49
|
-
import { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree,
|
|
49
|
+
import { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant } from "./dictionaryManipulator/qualifiedDictionary.js";
|
|
50
50
|
import { removeContentNodeByKeyPath } from "./dictionaryManipulator/removeContentNodeByKeyPath.js";
|
|
51
51
|
import { renameContentNodeByKeyPath } from "./dictionaryManipulator/renameContentNodeByKeyPath.js";
|
|
52
52
|
import { updateNodeChildren } from "./dictionaryManipulator/updateNodeChildren.js";
|
|
@@ -60,6 +60,7 @@ import { percentage } from "./formatters/percentage.js";
|
|
|
60
60
|
import { relativeTime } from "./formatters/relativeTime.js";
|
|
61
61
|
import { units } from "./formatters/units.js";
|
|
62
62
|
import { comparePaths, normalizePath } from "./localization/comparePaths.js";
|
|
63
|
+
import { LocaleDomainMap, getDomainHostname, getDomainOrigin, getLocaleFromDomain, isLocaleExclusiveOnDomain } from "./localization/domainUtils.js";
|
|
63
64
|
import { GenerateSitemapOptions, SitemapUrlEntry, generateSitemap, generateSitemapUrl } from "./localization/generateSitemap.js";
|
|
64
65
|
import { getBrowserLocale } from "./localization/getBrowserLocale.js";
|
|
65
66
|
import { getHTMLTextDir } from "./localization/getHTMLTextDir.js";
|
|
@@ -84,6 +85,7 @@ import { createRenderer, renderFor } from "./markdown/renderer.js";
|
|
|
84
85
|
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.js";
|
|
85
86
|
import { JsonValue, icuToIntlayerFormatter, intlayerToICUFormatter } from "./messageFormat/ICU.js";
|
|
86
87
|
import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./messageFormat/i18next.js";
|
|
88
|
+
import { navigatePath } from "./messageFormat/navigatePath.js";
|
|
87
89
|
import { PortableObject, intlayerToPortableObjectFormatter, portableObjectToIntlayerFormatter } from "./messageFormat/po.js";
|
|
88
90
|
import { MessageFormatDialect, MessageValues, TaggedMessageToken, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode } from "./messageFormat/resolveMessage.js";
|
|
89
91
|
import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./messageFormat/vue-i18n.js";
|
|
@@ -94,4 +96,4 @@ import { isValidElement } from "./utils/isValidReactElement.js";
|
|
|
94
96
|
import { CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, localeStorageOptions, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer } from "./utils/localeStorage.js";
|
|
95
97
|
import { YamlRecord, YamlValue, parseYaml } from "./utils/parseYaml.js";
|
|
96
98
|
import { stringifyYaml } from "./utils/stringifyYaml.js";
|
|
97
|
-
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, BlockQuoteNode, BoldTextNode, BreakLineNode, BreakThematicNode, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, COMPOSITE_ID_SEPARATOR, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CUSTOM_COMPONENT_R, CachedIntl, CachedIntl as Intl, CodeBlockNode, CodeFencedNode, CodeInlineNode, CompileOptions, ComponentOverrides, ConditionCond, ConditionContent, ConditionContentStates, CookieBuildAttributes, CustomComponentNode, DO_NOT_PROCESS_HTML_ELEMENTS, DURATION_DELAY_TRIGGER, DateTimePreset, DeepTransformContent, DotPath, DynamicDictionaryLoader, ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, EscapedTextNode, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, FileCond, FileContent, FileContentConstructor, FootnoteNode, FootnoteReferenceNode, GFMTaskNode, GFM_TASK_R, Gender, GenderCond, GenderContent, GenderContentStates, GenerateSitemapOptions, GetNestingResult, GetPrefixOptions, GetPrefixResult, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, HTMLCommentNode, HTMLContent, HTMLContentConstructor, HTMLNode, HTMLSelfClosingNode, HTMLTag, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, 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, HeadingNode, HeadingSetextNode, IInterpreterPlugin, IInterpreterPluginState, INLINE_SKIP_R, INTERPOLATION_R, ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, ItalicTextNode, JsonValue, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LIST_LOOKBEHIND_R, LOOKAHEAD, LinkAngleBraceNode, LinkBareURLNode, LinkNode, ListType, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, LocalizedPathResult, MarkdownContent, MarkdownContentConstructor, MarkdownContext, MarkdownOptions, MarkdownRuntime, HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, MarkedTextNode, MessageFormatDialect, MessageValues, NAMED_CODES_TO_UNICODE, NP_TABLE_R, NestedCond, NestedContent, NestedContentState, NestedParser, NewlineNode, NodeProps, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, OrderedListNode, PARAGRAPH_R, ParagraphNode, ParseState, ParsedMarkdown, Parser, ParserResult, Plugins, PluralCategory, PluralCond, PluralContent, PluralContentState, PortableObject, Priority, PriorityValue, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, ReferenceImageNode, ReferenceLinkNode, ReferenceNode, RenderRuleHook, Rule, RuleOutput, RuleType, RuleTypeValue, Rules, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, SitemapUrlEntry, 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_PLAIN_R, TEXT_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, TableNode, TableSeparatorNode, TaggedMessageToken, 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, UnorderedListNode, VOID_HTML_ELEMENTS, ValidDotPathsFor, ValueAtKey, WrappedIntl, YamlRecord, YamlValue, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, comparePaths, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, file, fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary,
|
|
99
|
+
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, BlockQuoteNode, BoldTextNode, BreakLineNode, BreakThematicNode, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, COMPOSITE_ID_SEPARATOR, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CUSTOM_COMPONENT_R, CachedIntl, CachedIntl as Intl, CodeBlockNode, CodeFencedNode, CodeInlineNode, CompileOptions, ComponentOverrides, ConditionCond, ConditionContent, ConditionContentStates, CookieBuildAttributes, CustomComponentNode, DO_NOT_PROCESS_HTML_ELEMENTS, DURATION_DELAY_TRIGGER, DateTimePreset, DeepTransformContent, DotPath, DynamicDictionaryLoader, ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, EscapedTextNode, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, FileCond, FileContent, FileContentConstructor, FootnoteNode, FootnoteReferenceNode, GFMTaskNode, GFM_TASK_R, Gender, GenderCond, GenderContent, GenderContentStates, GenerateSitemapOptions, GetNestingResult, GetPrefixOptions, GetPrefixResult, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, HTMLCommentNode, HTMLContent, HTMLContentConstructor, HTMLNode, HTMLSelfClosingNode, HTMLTag, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, 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, HeadingNode, HeadingSetextNode, IInterpreterPlugin, IInterpreterPluginState, INLINE_SKIP_R, INTERPOLATION_R, ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, ItalicTextNode, JsonValue, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LIST_LOOKBEHIND_R, LOOKAHEAD, LinkAngleBraceNode, LinkBareURLNode, LinkNode, ListType, LocaleDomainMap, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, LocalizedPathResult, MarkdownContent, MarkdownContentConstructor, MarkdownContext, MarkdownOptions, MarkdownRuntime, HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, MarkedTextNode, MessageFormatDialect, MessageValues, NAMED_CODES_TO_UNICODE, NP_TABLE_R, NestedCond, NestedContent, NestedContentState, NestedParser, NewlineNode, NodeProps, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, OrderedListNode, PARAGRAPH_R, ParagraphNode, ParseState, ParsedMarkdown, Parser, ParserResult, Plugins, PluralCategory, PluralCond, PluralContent, PluralContentState, PortableObject, Priority, PriorityValue, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, ReferenceImageNode, ReferenceLinkNode, ReferenceNode, RenderRuleHook, Rule, RuleOutput, RuleType, RuleTypeValue, Rules, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, SitemapUrlEntry, 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_PLAIN_R, TEXT_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, TableNode, TableSeparatorNode, TaggedMessageToken, 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, UnorderedListNode, VOID_HTML_ELEMENTS, ValidDotPathsFor, ValueAtKey, WrappedIntl, YamlRecord, YamlValue, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, comparePaths, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, file, fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getDomainHostname, getDomainOrigin, getEditedContent, getEditedDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTML, getHTMLTextDir, getInsertionValues, getInternalPath, getIntlayer, getLocale, getLocaleFromDomain, 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, getVariantIds, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isLocaleExclusiveOnDomain, 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, reconstructQualifiedEntry, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, resolveMessage, resolveMessageNode, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, sanitizer, serializeVariant, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter };
|