@intlayer/core 8.12.5-canary.0 → 9.0.0-canary.1

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 (97) hide show
  1. package/dist/cjs/deepTransformPlugins/getEditedContent.cjs +96 -0
  2. package/dist/cjs/deepTransformPlugins/getEditedContent.cjs.map +1 -0
  3. package/dist/cjs/deepTransformPlugins/index.cjs +3 -0
  4. package/dist/cjs/dictionaryManipulator/index.cjs +18 -0
  5. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +4 -1
  6. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -1
  7. package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs +70 -0
  8. package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs.map +1 -0
  9. package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs +302 -0
  10. package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs.map +1 -0
  11. package/dist/cjs/index.cjs +26 -0
  12. package/dist/cjs/interpreter/getDictionary.cjs +26 -11
  13. package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
  14. package/dist/cjs/interpreter/getIntlayer.cjs +16 -3
  15. package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
  16. package/dist/cjs/localization/getBrowserLocale.cjs +1 -1
  17. package/dist/cjs/localization/getBrowserLocale.cjs.map +1 -1
  18. package/dist/cjs/localization/getPrefix.cjs.map +1 -1
  19. package/dist/cjs/messageFormat/ICU.cjs +32 -2
  20. package/dist/cjs/messageFormat/ICU.cjs.map +1 -1
  21. package/dist/cjs/messageFormat/i18next.cjs +1 -1
  22. package/dist/cjs/messageFormat/i18next.cjs.map +1 -1
  23. package/dist/cjs/messageFormat/index.cjs +5 -0
  24. package/dist/cjs/messageFormat/resolveMessage.cjs +183 -0
  25. package/dist/cjs/messageFormat/resolveMessage.cjs.map +1 -0
  26. package/dist/cjs/messageFormat/vue-i18n.cjs +8 -9
  27. package/dist/cjs/messageFormat/vue-i18n.cjs.map +1 -1
  28. package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs +2 -3
  29. package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs.map +1 -1
  30. package/dist/cjs/transpiler/markdown/validateMarkdown.cjs +6 -6
  31. package/dist/cjs/transpiler/markdown/validateMarkdown.cjs.map +1 -1
  32. package/dist/cjs/utils/parseYaml.cjs +37 -17
  33. package/dist/cjs/utils/parseYaml.cjs.map +1 -1
  34. package/dist/esm/deepTransformPlugins/getEditedContent.mjs +92 -0
  35. package/dist/esm/deepTransformPlugins/getEditedContent.mjs.map +1 -0
  36. package/dist/esm/deepTransformPlugins/index.mjs +2 -1
  37. package/dist/esm/dictionaryManipulator/index.mjs +3 -1
  38. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs +4 -1
  39. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs.map +1 -1
  40. package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs +68 -0
  41. package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs.map +1 -0
  42. package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs +286 -0
  43. package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs.map +1 -0
  44. package/dist/esm/index.mjs +5 -1
  45. package/dist/esm/interpreter/getDictionary.mjs +26 -11
  46. package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
  47. package/dist/esm/interpreter/getIntlayer.mjs +16 -3
  48. package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
  49. package/dist/esm/localization/getBrowserLocale.mjs +1 -1
  50. package/dist/esm/localization/getBrowserLocale.mjs.map +1 -1
  51. package/dist/esm/localization/getPrefix.mjs.map +1 -1
  52. package/dist/esm/messageFormat/ICU.mjs +32 -2
  53. package/dist/esm/messageFormat/ICU.mjs.map +1 -1
  54. package/dist/esm/messageFormat/i18next.mjs +1 -1
  55. package/dist/esm/messageFormat/i18next.mjs.map +1 -1
  56. package/dist/esm/messageFormat/index.mjs +2 -1
  57. package/dist/esm/messageFormat/resolveMessage.mjs +177 -0
  58. package/dist/esm/messageFormat/resolveMessage.mjs.map +1 -0
  59. package/dist/esm/messageFormat/vue-i18n.mjs +8 -9
  60. package/dist/esm/messageFormat/vue-i18n.mjs.map +1 -1
  61. package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs +2 -3
  62. package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs.map +1 -1
  63. package/dist/esm/transpiler/markdown/validateMarkdown.mjs +6 -6
  64. package/dist/esm/transpiler/markdown/validateMarkdown.mjs.map +1 -1
  65. package/dist/esm/utils/parseYaml.mjs +37 -17
  66. package/dist/esm/utils/parseYaml.mjs.map +1 -1
  67. package/dist/types/deepTransformPlugins/getEditedContent.d.ts +33 -0
  68. package/dist/types/deepTransformPlugins/getEditedContent.d.ts.map +1 -0
  69. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +6 -3
  70. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
  71. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +6 -3
  72. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
  73. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +4 -1
  74. package/dist/types/deepTransformPlugins/index.d.ts +2 -1
  75. package/dist/types/dictionaryManipulator/index.d.ts +3 -1
  76. package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts +22 -0
  77. package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts.map +1 -0
  78. package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts +176 -0
  79. package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts.map +1 -0
  80. package/dist/types/index.d.ts +6 -2
  81. package/dist/types/interpreter/getDictionary.d.ts +13 -7
  82. package/dist/types/interpreter/getDictionary.d.ts.map +1 -1
  83. package/dist/types/interpreter/getIntlayer.d.ts +13 -2
  84. package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
  85. package/dist/types/localization/getPrefix.d.ts +4 -18
  86. package/dist/types/localization/getPrefix.d.ts.map +1 -1
  87. package/dist/types/messageFormat/ICU.d.ts.map +1 -1
  88. package/dist/types/messageFormat/i18next.d.ts.map +1 -1
  89. package/dist/types/messageFormat/index.d.ts +2 -1
  90. package/dist/types/messageFormat/resolveMessage.d.ts +72 -0
  91. package/dist/types/messageFormat/resolveMessage.d.ts.map +1 -0
  92. package/dist/types/messageFormat/vue-i18n.d.ts.map +1 -1
  93. package/dist/types/transpiler/markdown/validateMarkdown.d.ts.map +1 -1
  94. package/dist/types/utils/index.d.ts +2 -2
  95. package/dist/types/utils/parseYaml.d.ts +12 -2
  96. package/dist/types/utils/parseYaml.d.ts.map +1 -1
  97. package/package.json +8 -8
@@ -0,0 +1,22 @@
1
+ import { Dictionary, QualifiedDictionaryGroup } from "@intlayer/types/dictionary";
2
+
3
+ //#region src/dictionaryManipulator/mergeQualifiedDictionaries.d.ts
4
+ /**
5
+ * Merges sibling dictionaries sharing the same key, honouring qualifiers.
6
+ *
7
+ * - No dictionary declares a qualifier → behaves exactly like
8
+ * `mergeDictionaries` (single merged dictionary).
9
+ * - At least one dictionary declares a qualifier → the group's dimension set is
10
+ * the union of every declared dimension (in canonical order
11
+ * `variant → meta → item`). Dictionaries are grouped by their composite id
12
+ * (one segment per dimension), merged within each group (locale completion /
13
+ * priority overrides preserved), and a `QualifiedDictionaryGroup` is returned.
14
+ * Unqualified siblings act as shared base content merged into every entry.
15
+ *
16
+ * Every qualified entry must declare ALL dimensions of the group; an entry that
17
+ * declares only a subset is ambiguous and is rejected with an error log.
18
+ */
19
+ declare const mergeQualifiedDictionaries: (dictionaries: Dictionary[]) => Dictionary | QualifiedDictionaryGroup;
20
+ //#endregion
21
+ export { mergeQualifiedDictionaries };
22
+ //# sourceMappingURL=mergeQualifiedDictionaries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeQualifiedDictionaries.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/mergeQualifiedDictionaries.ts"],"mappings":";;;;;AA8BA;;;;;;;;;;;;;cAAa,0BAAA,GACX,YAAA,EAAc,UAAA,OACb,UAAA,GAAa,wBAAA"}
@@ -0,0 +1,176 @@
1
+ import { Dictionary, DictionaryQualifierType, DictionarySelector, QualifiedDictionaryGroup } from "@intlayer/types/dictionary";
2
+ import { LocalesValues } from "@intlayer/types/module_augmentation";
3
+
4
+ //#region src/dictionaryManipulator/qualifiedDictionary.d.ts
5
+ /**
6
+ * Canonical order of qualifier dimensions. A key that declares several
7
+ * dimensions always nests them in this order, with `item` innermost so it can
8
+ * act as the collection (array) axis.
9
+ */
10
+ declare const QUALIFIER_ORDER: readonly ["variant", "meta", "item"];
11
+ /**
12
+ * Separator joining per-dimension ids into a composite entry id. Also used as
13
+ * the chunk path separator in dynamic mode.
14
+ */
15
+ declare const COMPOSITE_ID_SEPARATOR = "/";
16
+ /**
17
+ * Returns the qualifier dimensions declared on a dictionary, in canonical
18
+ * order (`variant → meta → item`). Empty when the dictionary is unqualified
19
+ * (plain dictionary or shared base content of a qualified group).
20
+ */
21
+ declare const getDictionaryQualifierTypes: (dictionary: Dictionary) => DictionaryQualifierType[];
22
+ /**
23
+ * Returns the qualifier identifier of a dictionary for the given qualifier
24
+ * dimension — one segment of the composite entry id.
25
+ *
26
+ * - 'variant' → the variant name
27
+ * - 'meta' → the `meta.id` discriminator
28
+ * - 'item' → the item index as string
29
+ */
30
+ declare const getDictionaryQualifierId: (dictionary: Dictionary, qualifierType: DictionaryQualifierType) => string | undefined;
31
+ /**
32
+ * Returns the per-dimension id segments of a dictionary for the given ordered
33
+ * dimension set, or `undefined` when the dictionary does not declare every
34
+ * dimension of the set.
35
+ */
36
+ declare const getDictionaryQualifierSegments: (dictionary: Dictionary, qualifierTypes: DictionaryQualifierType[]) => string[] | undefined;
37
+ /**
38
+ * Builds the composite entry id of a dictionary — its per-dimension id segments
39
+ * joined in canonical order. `undefined` when a dimension is missing.
40
+ */
41
+ declare const getDictionaryCompositeId: (dictionary: Dictionary, qualifierTypes: DictionaryQualifierType[]) => string | undefined;
42
+ /**
43
+ * Type guard discriminating a `QualifiedDictionaryGroup` (merge output of a
44
+ * qualified key) from a plain `Dictionary`. Both carry a `content` field; only
45
+ * the group declares `qualifierTypes`, which is therefore the discriminator.
46
+ */
47
+ declare const isQualifiedDictionaryGroup: (value: unknown) => value is QualifiedDictionaryGroup;
48
+ /**
49
+ * Reconstructs a resolvable {@link Dictionary} from a single entry of a
50
+ * qualified group: the content node stored under its composite id, plus the
51
+ * qualifier coordinates decoded from that id (`variant`, `item`) and the
52
+ * preserved `meta` object for the meta dimension.
53
+ *
54
+ * This keeps the resolver's matching/transform code unchanged: it still sees a
55
+ * `{ key, content, variant?, item?, meta? }` shape, even though the stored
56
+ * format no longer duplicates those fields per entry.
57
+ */
58
+ declare const reconstructQualifiedEntry: (group: QualifiedDictionaryGroup, compositeId: string) => Dictionary;
59
+ /**
60
+ * Resolves a dictionary (or qualified dictionary group) against a selector,
61
+ * across every declared dimension.
62
+ *
63
+ * - Plain dictionary → returned as-is (selector ignored)
64
+ * - `item` declared but not selected → every matching entry ordered by index
65
+ * - `item` selected → the matching entry or null
66
+ * - `variant` defaults to the `default` entry when not selected
67
+ * - `meta` requires `{ id }` and every declared meta field to match
68
+ *
69
+ * Dimensions compose: e.g. a variant × item key with `{ variant: 'promo' }`
70
+ * returns every promo item as an array; adding `{ item: 2 }` narrows to one.
71
+ */
72
+ declare const resolveQualifiedDictionary: (dictionaryOrGroup: Dictionary | QualifiedDictionaryGroup, selector?: DictionarySelector) => Dictionary | Dictionary[] | null;
73
+ /**
74
+ * Splits the second argument of `getIntlayer` / `getDictionary` into the
75
+ * effective locale and the selector object (if any).
76
+ */
77
+ declare const parseDictionarySelector: <L extends LocalesValues>(localeOrSelector?: L | DictionarySelector) => {
78
+ locale?: L;
79
+ selector?: DictionarySelector;
80
+ };
81
+ /**
82
+ * Builds a stable string identity of a selector (excluding `locale`), suitable
83
+ * for cache keys and memoization dependencies.
84
+ */
85
+ declare const getDictionarySelectorCacheKey: (selector?: DictionarySelector) => string;
86
+ /**
87
+ * Marker property carrying the ordered qualifier dimensions on a dynamic loader
88
+ * map. Its presence distinguishes a qualified group loader map (a nested tree
89
+ * of chunks) from a plain dynamic loader map (one chunk per `locale`). Prefixed
90
+ * and unlikely to collide with a real locale code.
91
+ */
92
+ declare const QUALIFIER_DYNAMIC_TYPES_KEY = "__intlayerQualifierTypes";
93
+ /**
94
+ * A lazily-imported per-locale dictionary chunk loader.
95
+ */
96
+ type DynamicDictionaryLoader = () => Promise<Dictionary>;
97
+ /**
98
+ * Nested tree of chunk loaders: one nesting level per declared dimension (in
99
+ * canonical order), leaves are loaders.
100
+ */
101
+ type QualifiedDynamicLoaderTree = {
102
+ [segment: string]: QualifiedDynamicLoaderTree | DynamicDictionaryLoader;
103
+ };
104
+ /**
105
+ * Default export shape of a generated dynamic entry point for a qualified key.
106
+ * One nesting level per dimension under each locale, plus the dimension marker.
107
+ *
108
+ * ```ts
109
+ * {
110
+ * __intlayerQualifierTypes: ['variant', 'item'],
111
+ * en: { promo: { '1': () => import('./json/x/promo/1/en.json'), … }, … },
112
+ * fr: { … },
113
+ * }
114
+ * ```
115
+ */
116
+ type QualifiedDynamicLoaderMap = {
117
+ [QUALIFIER_DYNAMIC_TYPES_KEY]: DictionaryQualifierType[];
118
+ [locale: string]: QualifiedDynamicLoaderTree | DictionaryQualifierType[];
119
+ };
120
+ /**
121
+ * Type guard discriminating a qualified dynamic loader map (collections /
122
+ * variants / meta records, possibly combined) from a plain dynamic loader map.
123
+ */
124
+ declare const isQualifiedDynamicLoaderMap: (value: unknown) => value is QualifiedDynamicLoaderMap;
125
+ /**
126
+ * Resolves the content of a qualified dynamic loader map against a selector,
127
+ * loading only the chunk(s) the selector actually targets.
128
+ *
129
+ * Walks the nested loader tree one dimension at a time (canonical order
130
+ * `variant → meta → item`): `variant` defaults to `default`, `meta` descends by
131
+ * `id`, and `item` either narrows to the selected index or — when no item is
132
+ * given — expands into every sibling chunk (the collection axis). Meta-equality
133
+ * is verified on the loaded chunk. Semantics mirror
134
+ * {@link resolveQualifiedDictionary} so dynamic and static modes behave alike.
135
+ *
136
+ * The Suspense mechanism is injected through `loadChunk` so the same logic
137
+ * serves both the client (suspender cache) and the server (`react.use`). Every
138
+ * targeted loader is started before the first chunk is read, so sibling chunks
139
+ * load in parallel rather than waterfalling.
140
+ *
141
+ * @param loaderMap - The qualified dynamic loader map (entry point default export).
142
+ * @param key - The dictionary key (used to build stable chunk cache keys).
143
+ * @param locale - The resolved locale to load chunks for.
144
+ * @param selector - The selector splitting the qualifier dimensions.
145
+ * @param loadChunk - Reads a started chunk promise, suspending until it resolves.
146
+ * @param transform - Turns a resolved chunk dictionary into final content.
147
+ */
148
+ declare const resolveQualifiedDynamicContent: <Content>(params: {
149
+ loaderMap: QualifiedDynamicLoaderMap;
150
+ key: string;
151
+ locale: string;
152
+ selector: DictionarySelector | undefined;
153
+ loadChunk: (cacheKey: string, promise: Promise<Dictionary>) => Dictionary;
154
+ transform: (dictionary: Dictionary) => Content;
155
+ }) => Content | Content[] | null;
156
+ /**
157
+ * Async counterpart of {@link resolveQualifiedDynamicContent} for frameworks
158
+ * that load dictionaries with `await` instead of Suspense (Vue, Svelte, Lit,
159
+ * vanilla). Awaits every targeted chunk in parallel, then resolves identically.
160
+ *
161
+ * @param loaderMap - The qualified dynamic loader map.
162
+ * @param key - The dictionary key (used to build stable chunk cache keys).
163
+ * @param locale - The resolved locale to load chunks for.
164
+ * @param selector - The selector splitting the qualifier dimensions.
165
+ * @param transform - Turns a resolved chunk dictionary into final content.
166
+ */
167
+ declare const resolveQualifiedDynamicContentAsync: <Content>(params: {
168
+ loaderMap: QualifiedDynamicLoaderMap;
169
+ key: string;
170
+ locale: string;
171
+ selector: DictionarySelector | undefined;
172
+ transform: (dictionary: Dictionary) => Content;
173
+ }) => Promise<Content | Content[] | null>;
174
+ //#endregion
175
+ export { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeId, getDictionaryQualifierId, getDictionaryQualifierSegments, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync };
176
+ //# sourceMappingURL=qualifiedDictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qualifiedDictionary.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/qualifiedDictionary.ts"],"mappings":";;;;;;AAmBA;;;cAAa,eAAA;;AAUb;;;cAAa,sBAAA;;AAOb;;;;cAAa,2BAAA,GACX,UAAA,EAAY,UAAA,KACX,uBAAA;;;;;AAmBH;;;;cAAa,wBAAA,GACX,UAAA,EAAY,UAAA,EACZ,aAAA,EAAe,uBAAA;;;;;;cAeJ,8BAAA,GACX,UAAA,EAAY,UAAA,EACZ,cAAA,EAAgB,uBAAA;;;;;cAiBL,wBAAA,GACX,UAAA,EAAY,UAAA,EACZ,cAAA,EAAgB,uBAAA;;;;;AAFlB;cAgEa,0BAAA,GACX,KAAA,cACC,KAAA,IAAS,wBAAA;;;;;;;;;AAFZ;;cAmBa,yBAAA,GACX,KAAA,EAAO,wBAAA,EACP,WAAA,aACC,UAAA;;;;;;;AAHH;;;;;;;cAwCa,0BAAA,GACX,iBAAA,EAAmB,UAAA,GAAa,wBAAA,EAChC,QAAA,GAAW,kBAAA,KACV,UAAA,GAAa,UAAA;;;AAHhB;;cAqCa,uBAAA,aAAqC,aAAA,EAChD,gBAAA,GAAmB,CAAA,GAAI,kBAAA;EACpB,MAAA,GAAS,CAAA;EAAG,QAAA,GAAW,kBAAA;AAAA;;;;;cAef,6BAAA,GACX,QAAA,GAAW,kBAAA;;;;;;;cAiBA,2BAAA;;AAnCb;;KAwCY,uBAAA,SAAgC,OAAA,CAAQ,UAAA;;;;;KAMxC,0BAAA;EAAA,CACT,OAAA,WAAkB,0BAAA,GAA6B,uBAAA;AAAA;;;;;;;;;;;;AA9BlD;KA6CY,yBAAA;EAAA,CACT,2BAAA,GAA8B,uBAAA;EAAA,CAC9B,MAAA,WAAiB,0BAAA,GAA6B,uBAAA;AAAA;AA7BjD;;;;AAAA,cAoCa,2BAAA,GACX,KAAA,cACC,KAAA,IAAS,yBAAA;AAjCZ;;;;;AAMA;;;;;;;;;AAgBA;;;;;;;;;AAtBA,cAuLa,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;;;;;;;;;AAPd;;;cAyCa,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"}
@@ -1,3 +1,4 @@
1
+ import { getEditedContent, getEditedDictionary } from "./deepTransformPlugins/getEditedContent.js";
1
2
  import { ConditionContent, ConditionContentStates, cond as condition } from "./transpiler/condition/condition.js";
2
3
  import { EnterFormat, EnumerationContent, EnumerationContentState, enu as enumeration } from "./transpiler/enumeration/enumeration.js";
3
4
  import { FileContent, FileContentConstructor, file, fileContent } from "./transpiler/file/file.js";
@@ -42,8 +43,10 @@ import { getEmptyNode } from "./dictionaryManipulator/getEmptyNode.js";
42
43
  import { getNodeChildren } from "./dictionaryManipulator/getNodeChildren.js";
43
44
  import { getNodeType } from "./dictionaryManipulator/getNodeType.js";
44
45
  import { mergeDictionaries } from "./dictionaryManipulator/mergeDictionaries.js";
46
+ import { mergeQualifiedDictionaries } from "./dictionaryManipulator/mergeQualifiedDictionaries.js";
45
47
  import { normalizeDictionaries, normalizeDictionary } from "./dictionaryManipulator/normalizeDictionary.js";
46
48
  import { orderDictionaries } from "./dictionaryManipulator/orderDictionaries.js";
49
+ import { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeId, getDictionaryQualifierId, getDictionaryQualifierSegments, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync } from "./dictionaryManipulator/qualifiedDictionary.js";
47
50
  import { removeContentNodeByKeyPath } from "./dictionaryManipulator/removeContentNodeByKeyPath.js";
48
51
  import { renameContentNodeByKeyPath } from "./dictionaryManipulator/renameContentNodeByKeyPath.js";
49
52
  import { updateNodeChildren } from "./dictionaryManipulator/updateNodeChildren.js";
@@ -81,12 +84,13 @@ import { allowInline, anyScopeRegex, attributeValueToNodePropValue, blockRegex,
81
84
  import { JsonValue, icuToIntlayerFormatter, intlayerToICUFormatter } from "./messageFormat/ICU.js";
82
85
  import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./messageFormat/i18next.js";
83
86
  import { PortableObject, intlayerToPortableObjectFormatter, portableObjectToIntlayerFormatter } from "./messageFormat/po.js";
87
+ import { MessageFormatDialect, MessageValues, TaggedMessageToken, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode } from "./messageFormat/resolveMessage.js";
84
88
  import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./messageFormat/vue-i18n.js";
85
89
  import { checkIsURLAbsolute } from "./utils/checkIsURLAbsolute.js";
86
90
  import { getCookie } from "./utils/getCookie.js";
87
91
  import { isSameKeyPath } from "./utils/isSameKeyPath.js";
88
92
  import { isValidElement } from "./utils/isValidReactElement.js";
89
93
  import { CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, localeStorageOptions, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer } from "./utils/localeStorage.js";
90
- import { parseYaml } from "./utils/parseYaml.js";
94
+ import { YamlRecord, YamlValue, parseYaml } from "./utils/parseYaml.js";
91
95
  import { stringifyYaml } from "./utils/stringifyYaml.js";
92
- 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, 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, 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, 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, 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, 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, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, 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, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTML, getHTMLTextDir, getInsertionValues, getInternalPath, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPlural, getPrefix, getReplacedValuesContent, getRewritePath, getRewriteRules, getSplittedContent, getSplittedDictionaryContent, getTranslation, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseInline, parseMarkdown, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, parseYaml, parserFor, percentage, plural, pluralPlugin, portableObjectToIntlayerFormatter, presets, qualifies, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, sanitizer, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter };
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, 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, 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, getDictionaryCompositeId, getDictionaryQualifierId, getDictionaryQualifierSegments, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getEditedContent, getEditedDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTML, getHTMLTextDir, getInsertionValues, getInternalPath, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPlural, getPrefix, getReplacedValuesContent, getRewritePath, getRewriteRules, getSplittedContent, getSplittedDictionaryContent, getTranslation, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, mergeQualifiedDictionaries, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, 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, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter };
@@ -1,17 +1,23 @@
1
1
  import { DeepTransformContent, IInterpreterPluginState, Plugins } from "./getContent/plugins.js";
2
- import { Dictionary } from "@intlayer/types/dictionary";
3
- import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
2
+ import { Dictionary, DictionarySelector, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from "@intlayer/types/dictionary";
3
+ import { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from "@intlayer/types/module_augmentation";
4
4
 
5
5
  //#region src/interpreter/getDictionary.d.ts
6
6
  /**
7
7
  * Transforms a dictionary in a single pass, applying each plugin as needed.
8
8
  *
9
- * @param dictionary The dictionary to transform.
10
- * @param locale The locale to use if your transformers need it (e.g. for translations).
11
- * @param additionalPlugins An array of NodeTransformer that define how to transform recognized nodes.
12
- * If omitted, we’ll use a default set of plugins.
9
+ * Also accepts a `QualifiedDictionaryGroup` (collections, variants, meta
10
+ * records) together with a selector as second argument the group is resolved
11
+ * to a single entry (or an ordered array of entries for collections without an
12
+ * `item` selector) before transformation.
13
+ *
14
+ * @param dictionary The dictionary (or qualified dictionary group) to transform.
15
+ * @param localeOrSelector The locale, or a selector object (`{ item }`,
16
+ * `{ variant }`, `{ id, ...meta }`, optionally with `locale`).
17
+ * @param plugins An array of NodeTransformer that define how to transform recognized nodes.
18
+ * If omitted, we’ll use a default set of plugins.
13
19
  */
14
- declare const getDictionary: <const T extends Dictionary, const L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L, plugins?: Plugins[]) => DeepTransformContent<T["content"], IInterpreterPluginState, L>;
20
+ declare const getDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelector = DeclaredLocales>(dictionary: T, localeOrSelector?: A, plugins?: Plugins[]) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, IInterpreterPluginState, ExtractSelectorLocale<A>>;
15
21
  //#endregion
16
22
  export { getDictionary };
17
23
  //# sourceMappingURL=getDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../../src/interpreter/getDictionary.ts"],"mappings":";;;;;;;;AAqBA;;;;;cAAa,aAAA,mBACK,UAAA,kBACA,aAAA,GAAgB,eAAA,EAEhC,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,EACT,OAAA,GAAS,OAAA,OACR,oBAAA,CAAqB,CAAA,aAAc,uBAAA,EAAyB,CAAA"}
1
+ {"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../../src/interpreter/getDictionary.ts"],"mappings":";;;;;;;;AAqCA;;;;;;;;;;;cAAa,aAAA,mBACK,UAAA,GAAa,wBAAA,kBACb,aAAA,GAAgB,kBAAA,GAAqB,eAAA,EAErD,UAAA,EAAY,CAAA,EACZ,gBAAA,GAAmB,CAAA,EACnB,OAAA,GAAU,OAAA,OACT,oBAAA,CACD,iCAAA,CAAkC,CAAA,EAAG,CAAA,GACrC,uBAAA,EACA,qBAAA,CAAsB,CAAA"}
@@ -1,8 +1,19 @@
1
1
  import { DeepTransformContent, IInterpreterPluginState, Plugins } from "./getContent/plugins.js";
2
- import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types/module_augmentation";
2
+ import { DictionarySelector } from "@intlayer/types/dictionary";
3
+ import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, ExtractSelectorLocale, LocalesValues } from "@intlayer/types/module_augmentation";
3
4
 
4
5
  //#region src/interpreter/getIntlayer.d.ts
5
- declare const getIntlayer: <const T extends DictionaryKeys, const L extends LocalesValues = DeclaredLocales>(key: T, locale?: L, plugins?: Plugins[]) => DeepTransformContent<DictionaryRegistryContent<T>, IInterpreterPluginState, L>;
6
+ /**
7
+ * Picks one dictionary by its key and returns its content for the given
8
+ * locale or selector.
9
+ *
10
+ * The second argument is either a locale (`'fr'`) or a selector object:
11
+ * - `{ item: 2 }` — collection item (omit `item` to get every item as array)
12
+ * - `{ variant: 'black-friday' }` — named variant (omit for the `default` one)
13
+ * - `{ id: 'prod_abc', ...metaFields }` — meta record
14
+ * - `locale` can be combined with any selector: `{ item: 2, locale: 'fr' }`
15
+ */
16
+ declare const getIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelector = DeclaredLocales>(key: T, localeOrSelector?: A, plugins?: Plugins[]) => DeepTransformContent<DictionaryRegistryResult<T, A>, IInterpreterPluginState, ExtractSelectorLocale<A>>;
6
17
  //#endregion
7
18
  export { getIntlayer };
8
19
  //# sourceMappingURL=getIntlayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"mappings":";;;;cAmDa,WAAA,mBACK,cAAA,kBACA,aAAA,GAAgB,eAAA,EAEhC,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,EACT,OAAA,GAAU,OAAA,OACT,oBAAA,CACD,yBAAA,CAA0B,CAAA,GAC1B,uBAAA,EACA,CAAA"}
1
+ {"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"mappings":";;;;;;;;AAkEA;;;;;;;cAAa,WAAA,mBACK,cAAA,kBACA,aAAA,GAAgB,kBAAA,GAAqB,eAAA,EAErD,GAAA,EAAK,CAAA,EACL,gBAAA,GAAmB,CAAA,EACnB,OAAA,GAAU,OAAA,OACT,oBAAA,CACD,wBAAA,CAAyB,CAAA,EAAG,CAAA,GAC5B,uBAAA,EACA,qBAAA,CAAsB,CAAA"}
@@ -29,24 +29,10 @@ type RoutingOptions = {
29
29
  * Resolves routing configuration by merging provided options with configuration defaults.
30
30
  * Single source of truth for default routing config resolution across all localization functions.
31
31
  */
32
- declare const resolveRoutingConfig: (options?: RoutingOptions) => {
33
- locales: any;
34
- defaultLocale: any;
35
- mode: any;
36
- rewrite: any;
37
- domains: any;
38
- /**
39
- * The hostname of the page currently being rendered (e.g. `'intlayer.org'`).
40
- * When provided, `getLocalizedUrl` returns a relative URL for locales whose
41
- * configured domain matches `currentDomain`, and an absolute URL only when
42
- * the target locale lives on a different domain.
43
- *
44
- * When omitted the function tries to infer it from:
45
- * 1. The domain of an absolute input URL.
46
- * 2. `window.location.hostname` in browser environments.
47
- * Falls back to always generating absolute URLs when neither is available.
48
- */
49
- currentDomain?: string;
32
+ declare const resolveRoutingConfig: (options?: RoutingOptions) => Omit<RoutingOptions, "defaultLocale" | "mode" | "locales"> & {
33
+ defaultLocale: LocalesValues;
34
+ mode: RoutingConfig["mode"];
35
+ locales: LocalesValues[];
50
36
  };
51
37
  type GetPrefixOptions = {
52
38
  defaultLocale?: LocalesValues;
@@ -1 +1 @@
1
- {"version":3,"file":"getPrefix.d.ts","names":[],"sources":["../../../src/localization/getPrefix.ts"],"mappings":";;;;;;;AAuBA;KAAY,cAAA;EACV,OAAA,GAAU,aAAA;EACV,aAAA,GAAgB,aAAA;EAChB,IAAA,GAAO,aAAA;EACP,OAAA,GAAU,aAAA;EACV,OAAA,GAAU,aAAA;EAAA;;;;;;;;;;;EAYV,aAAA;AAAA;;;;AAOF;cAAa,oBAAA,GAAwB,OAAA,GAAS,cAAA;;;;;;;;;;;;;AAS9C;;;;;;KAAY,gBAAA;EACV,aAAA,GAAgB,aAAA;EAChB,IAAA,GAAO,aAAA;AAAA;AAAA,KAGG,eAAA;EAAe;;;;EAKzB,MAAA;EAIc;;;EAAd,YAAA,EAAc,MAAA;AAAA;;;;;;;;;;KAYJ,uBAAA,WACA,aAAA,oCACY,mBAAA,kBACN,aAAA,GAAgB,qBAAA,IAC9B,CAAA,oCACkB,CAAA,IAChB,uBAAA,CAAwB,eAAA,EAAiB,IAAA,EAAM,OAAA,sBAC7B,IAAA,IAChB,eAAA,GACA,IAAA;EACI,MAAA,KAAW,CAAA;EAAM,YAAA,EAAc,CAAA;AAAA,IACjC,IAAA,+BACE,CAAA,SAAU,OAAA;EACN,MAAA;EAAY,YAAA;AAAA;EACZ,MAAA,KAAW,CAAA;EAAM,YAAA,EAAc,CAAA;AAAA;EACjC,MAAA;EAAY,YAAA;AAAA;EACpB,MAAA;EAAY,YAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmCL,SAAA,mBAA6B,aAAA,cACxC,MAAA,EAAQ,CAAA,EACR,OAAA,GAAS,cAAA,KACR,uBAAA,CAAwB,CAAA"}
1
+ {"version":3,"file":"getPrefix.d.ts","names":[],"sources":["../../../src/localization/getPrefix.ts"],"mappings":";;;;;;;AAuBA;KAAY,cAAA;EACV,OAAA,GAAU,aAAA;EACV,aAAA,GAAgB,aAAA;EAChB,IAAA,GAAO,aAAA;EACP,OAAA,GAAU,aAAA;EACV,OAAA,GAAU,aAAA;EAAA;;;;;;;;;;;EAYV,aAAA;AAAA;;;;AAOF;cAAa,oBAAA,GACX,OAAA,GAAS,cAAA,KACR,IAAA,CAAK,cAAA;EACN,aAAA,EAAe,aAAA;EACf,IAAA,EAAM,aAAA;EACN,OAAA,EAAS,aAAA;AAAA;AAAA,KAUC,gBAAA;EACV,aAAA,GAAgB,aAAA;EAChB,IAAA,GAAO,aAAA;AAAA;AAAA,KAGG,eAAA;EAnBD;;;;EAwBT,MAAA;EAtBe;;;EA0Bf,YAAA,EAAc,MAAA;AAAA;;;AAdhB;;;;;;;KA0BY,uBAAA,WACA,aAAA,oCACY,mBAAA,kBACN,aAAA,GAAgB,qBAAA,IAC9B,CAAA,oCACkB,CAAA,IAChB,uBAAA,CAAwB,eAAA,EAAiB,IAAA,EAAM,OAAA,sBAC7B,IAAA,IAChB,eAAA,GACA,IAAA;EACI,MAAA,KAAW,CAAA;EAAM,YAAA,EAAc,CAAA;AAAA,IACjC,IAAA,+BACE,CAAA,SAAU,OAAA;EACN,MAAA;EAAY,YAAA;AAAA;EACZ,MAAA,KAAW,CAAA;EAAM,YAAA,EAAc,CAAA;AAAA;EACjC,MAAA;EAAY,YAAA;AAAA;EACpB,MAAA;EAAY,YAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmCL,SAAA,mBAA6B,aAAA,cACxC,MAAA,EAAQ,CAAA,EACR,OAAA,GAAS,cAAA,KACR,uBAAA,CAAwB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ICU.d.ts","names":[],"sources":["../../../src/messageFormat/ICU.ts"],"mappings":";;;KA6CY,SAAA,sCAKR,SAAA;EAAA,CACG,GAAA,WAAc,SAAA;AAAA;AAAA,cAkiBR,sBAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,sBAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA"}
1
+ {"version":3,"file":"ICU.d.ts","names":[],"sources":["../../../src/messageFormat/ICU.ts"],"mappings":";;;KAkDY,SAAA,sCAKR,SAAA;EAAA,CACG,GAAA,WAAc,SAAA;AAAA;AAAA,cAwlBR,sBAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,sBAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"i18next.d.ts","names":[],"sources":["../../../src/messageFormat/i18next.ts"],"mappings":";;;;cAqjBa,0BAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,0BAAA,GACX,OAAA,EAAS,SAAA,KACR,UAAA"}
1
+ {"version":3,"file":"i18next.d.ts","names":[],"sources":["../../../src/messageFormat/i18next.ts"],"mappings":";;;;cAsjBa,0BAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,0BAAA,GACX,OAAA,EAAS,SAAA,KACR,UAAA"}
@@ -1,5 +1,6 @@
1
1
  import { JsonValue, icuToIntlayerFormatter, intlayerToICUFormatter } from "./ICU.js";
2
2
  import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./i18next.js";
3
3
  import { PortableObject, intlayerToPortableObjectFormatter, portableObjectToIntlayerFormatter } from "./po.js";
4
+ import { MessageFormatDialect, MessageValues, TaggedMessageToken, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode } from "./resolveMessage.js";
4
5
  import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./vue-i18n.js";
5
- export { JsonValue, PortableObject, i18nextToIntlayerFormatter, icuToIntlayerFormatter, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, portableObjectToIntlayerFormatter, vueI18nToIntlayerFormatter };
6
+ export { JsonValue, MessageFormatDialect, MessageValues, PortableObject, TaggedMessageToken, i18nextToIntlayerFormatter, icuToIntlayerFormatter, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, parseTaggedMessage, portableObjectToIntlayerFormatter, resolveMessage, resolveMessageNode, vueI18nToIntlayerFormatter };
@@ -0,0 +1,72 @@
1
+ import { LocalesValues } from "@intlayer/types/module_augmentation";
2
+
3
+ //#region src/messageFormat/resolveMessage.d.ts
4
+ /**
5
+ * Runtime counterpart of the `messageFormat` converters.
6
+ *
7
+ * The converters (`icuToIntlayerFormatter`, `i18nextToIntlayerFormatter`,
8
+ * `vueI18nToIntlayerFormatter`) turn library-specific message syntax into
9
+ * intlayer nodes (`insert`, `plural`, `enu`, `gender`, `html`). This module
10
+ * resolves those nodes — or raw message strings — into a final string using
11
+ * the provided interpolation values and locale.
12
+ *
13
+ * It is the mutualized resolution engine used by the compat adapter packages
14
+ * (`@intlayer/i18next`, `@intlayer/next-intl`, `@intlayer/vue-i18n`, …).
15
+ */
16
+ /** Message syntax dialect of the source i18n library. */
17
+ type MessageFormatDialect = 'icu' | 'i18next' | 'vue-i18n';
18
+ /** Interpolation values passed alongside a translation lookup. */
19
+ type MessageValues = Record<string, unknown>;
20
+ /**
21
+ * Interpolates a message template with values.
22
+ *
23
+ * Handles, in order:
24
+ * 1. Intlayer insertions `{{name}}` (whitespace-tolerant, dotted paths)
25
+ * 2. ICU formatted arguments `{value, number}` / `{ts, date, long}`
26
+ * 3. Bare single-brace arguments `{name}` (ICU / vue-i18n simple args)
27
+ */
28
+ declare const interpolateMessage: (template: string, values?: MessageValues, locale?: LocalesValues) => string;
29
+ /**
30
+ * Resolves an intlayer message node tree (as produced by the
31
+ * `*ToIntlayerFormatter` converters, or already present in a built
32
+ * dictionary) into its final value using interpolation values and locale.
33
+ *
34
+ * Function nodes (produced by the interpreter plugins for `insertion`,
35
+ * `enumeration` and `plural` content) are invoked with the values.
36
+ */
37
+ declare const resolveMessageNode: (node: unknown, values?: MessageValues, locale?: LocalesValues) => unknown;
38
+ /**
39
+ * Resolves a raw message — string in a library dialect, or an intlayer node
40
+ * tree — into a final string using interpolation values and locale.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * resolveMessage('Hello {name}', { name: 'John' }, 'en', 'icu');
45
+ * // 'Hello John'
46
+ *
47
+ * resolveMessage(
48
+ * '{count, plural, one {# item} other {# items}}',
49
+ * { count: 3 },
50
+ * 'en',
51
+ * 'icu'
52
+ * );
53
+ * // '3 items'
54
+ * ```
55
+ */
56
+ declare const resolveMessage: (message: unknown, values?: MessageValues, locale?: LocalesValues, dialect?: MessageFormatDialect) => string;
57
+ /** A parsed token of a tagged message: plain text or a tag with children. */
58
+ type TaggedMessageToken = string | {
59
+ tag: string;
60
+ children: TaggedMessageToken[];
61
+ };
62
+ /**
63
+ * Tokenizes a message containing XML-like tags (`'Visit <link>the docs</link>'`,
64
+ * `'hello <1>{{name}}</1>'`, `'line<br/>break'`) into a token tree.
65
+ *
66
+ * Used by rich-text renderers (`t.rich`, `<Trans components>`,
67
+ * `<i18n-t>` slots) to map tags to framework elements.
68
+ */
69
+ declare const parseTaggedMessage: (message: string) => TaggedMessageToken[];
70
+ //#endregion
71
+ export { MessageFormatDialect, MessageValues, TaggedMessageToken, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode };
72
+ //# sourceMappingURL=resolveMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveMessage.d.ts","names":[],"sources":["../../../src/messageFormat/resolveMessage.ts"],"mappings":";;;;;AAwBA;;;;;AAGA;;;;;AAsFA;AAAA,KAzFY,oBAAA;;KAGA,aAAA,GAAgB,MAAA;;;;;;;;AA2H5B;cArCa,kBAAA,GACX,QAAA,UACA,MAAA,GAAQ,aAAA,EACR,MAAA,GAAQ,aAAA;;;;;;;;;cAkCG,kBAAA,GACX,IAAA,WACA,MAAA,GAAQ,aAAA,EACR,MAAA,GAAQ,aAAA;AA6IV;;;;;;;;;;;;;;;;;AAiBA;AAjBA,cAAa,cAAA,GACX,OAAA,WACA,MAAA,GAAQ,aAAA,EACR,MAAA,GAAQ,aAAA,EACR,OAAA,GAAS,oBAAA;;KAaC,kBAAA;EAEN,GAAA;EAAa,QAAA,EAAU,kBAAA;AAAA;;;AAS7B;;;;;cAAa,kBAAA,GAAsB,OAAA,aAAkB,kBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"vue-i18n.d.ts","names":[],"sources":["../../../src/messageFormat/vue-i18n.ts"],"mappings":";;;;cA2Ta,0BAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,0BAAA,GACX,OAAA,EAAS,SAAA,KACR,UAAA"}
1
+ {"version":3,"file":"vue-i18n.d.ts","names":[],"sources":["../../../src/messageFormat/vue-i18n.ts"],"mappings":";;;;cAoUa,0BAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,0BAAA,GACX,OAAA,EAAS,SAAA,KACR,UAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateMarkdown.d.ts","names":[],"sources":["../../../../src/transpiler/markdown/validateMarkdown.ts"],"mappings":";;;KAIY,wBAAA;EACV,KAAA;EACA,MAAA,EAAQ,mBAAA;AAAA;;;;;;;AAwFV;cAAa,gBAAA,GAAoB,OAAA,aAAkB,wBAAA"}
1
+ {"version":3,"file":"validateMarkdown.d.ts","names":[],"sources":["../../../../src/transpiler/markdown/validateMarkdown.ts"],"mappings":";;;KAIY,wBAAA;EACV,KAAA;EACA,MAAA,EAAQ,mBAAA;AAAA;;;;;;;AA6FV;cAAa,gBAAA,GAAoB,OAAA,aAAkB,wBAAA"}
@@ -4,6 +4,6 @@ import { getCookie } from "./getCookie.js";
4
4
  import { isSameKeyPath } from "./isSameKeyPath.js";
5
5
  import { isValidElement } from "./isValidReactElement.js";
6
6
  import { CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, localeStorageOptions, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer } from "./localeStorage.js";
7
- import { parseYaml } from "./parseYaml.js";
7
+ import { YamlRecord, YamlValue, parseYaml } from "./parseYaml.js";
8
8
  import { stringifyYaml } from "./stringifyYaml.js";
9
- export { CachedIntl, CachedIntl as Intl, CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, WrappedIntl, bindIntl, checkIsURLAbsolute, getCachedIntl, getCookie, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, isSameKeyPath, isValidElement, localeStorageOptions, parseYaml, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, stringifyYaml };
9
+ export { CachedIntl, CachedIntl as Intl, CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, WrappedIntl, YamlRecord, YamlValue, bindIntl, checkIsURLAbsolute, getCachedIntl, getCookie, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, isSameKeyPath, isValidElement, localeStorageOptions, parseYaml, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, stringifyYaml };
@@ -1,5 +1,15 @@
1
1
  //#region src/utils/parseYaml.d.ts
2
- declare const parseYaml: <T = any>(input: string) => T | null;
2
+ interface YamlRecord {
3
+ [key: string]: YamlValue;
4
+ }
5
+ type YamlValue = string | number | YamlValue[] | YamlRecord;
6
+ /**
7
+ * Parses a YAML/JSON-like string into a typed value.
8
+ * Supports scalars, quoted strings, inline arrays/objects, and indented YAML syntax.
9
+ * Boolean/null literals (true, false, null, yes, no, etc.) are preserved as strings,
10
+ * not coerced to their native JS equivalents.
11
+ */
12
+ declare const parseYaml: <T = YamlValue>(input: string) => T | null;
3
13
  //#endregion
4
- export { parseYaml };
14
+ export { YamlRecord, YamlValue, parseYaml };
5
15
  //# sourceMappingURL=parseYaml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseYaml.d.ts","names":[],"sources":["../../../src/utils/parseYaml.ts"],"mappings":";cAca,SAAA,YAAsB,KAAA,aAAgB,CAAA"}
1
+ {"version":3,"file":"parseYaml.d.ts","names":[],"sources":["../../../src/utils/parseYaml.ts"],"mappings":";UAciB,UAAA;EAAA,CACd,GAAA,WAAc,SAAA;AAAA;AAAA,KAEL,SAAA,qBAA8B,SAAA,KAAc,UAAA;;;AAAxD;;;;cAQa,SAAA,OAAiB,SAAA,EAAW,KAAA,aAAgB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "8.12.5-canary.0",
3
+ "version": "9.0.0-canary.1",
4
4
  "private": false,
5
5
  "description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
6
6
  "keywords": [
@@ -172,22 +172,22 @@
172
172
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
173
173
  },
174
174
  "dependencies": {
175
- "@intlayer/api": "8.12.5-canary.0",
176
- "@intlayer/config": "8.12.5-canary.0",
177
- "@intlayer/dictionaries-entry": "8.12.5-canary.0",
178
- "@intlayer/types": "8.12.5-canary.0",
179
- "@intlayer/unmerged-dictionaries-entry": "8.12.5-canary.0",
175
+ "@intlayer/api": "9.0.0-canary.1",
176
+ "@intlayer/config": "9.0.0-canary.1",
177
+ "@intlayer/dictionaries-entry": "9.0.0-canary.1",
178
+ "@intlayer/types": "9.0.0-canary.1",
179
+ "@intlayer/unmerged-dictionaries-entry": "9.0.0-canary.1",
180
180
  "defu": "6.1.7"
181
181
  },
182
182
  "devDependencies": {
183
- "@types/node": "25.9.2",
183
+ "@types/node": "25.9.3",
184
184
  "@utils/ts-config": "1.0.4",
185
185
  "@utils/ts-config-types": "1.0.4",
186
186
  "@utils/tsdown-config": "1.0.4",
187
187
  "rimraf": "6.1.3",
188
188
  "tsdown": "0.21.10",
189
189
  "typescript": "6.0.3",
190
- "vitest": "4.1.8"
190
+ "vitest": "4.1.9"
191
191
  },
192
192
  "engines": {
193
193
  "node": ">=14.18"