@intlayer/core 9.0.0-canary.0 → 9.0.0-canary.10
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 +1 -0
- package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs +1 -5
- package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs +48 -74
- package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs.map +1 -1
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/interpreter/getContent/plugins.cjs +8 -8
- package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
- package/dist/cjs/interpreter/getDictionary.cjs +5 -5
- package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
- package/dist/cjs/interpreter/getIntlayer.cjs +8 -3
- package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
- package/dist/cjs/localization/comparePaths.cjs +75 -0
- package/dist/cjs/localization/comparePaths.cjs.map +1 -0
- package/dist/cjs/localization/getLocalizedUrl.cjs +4 -4
- package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
- package/dist/cjs/localization/getPathWithoutLocale.cjs +2 -2
- package/dist/cjs/localization/getPathWithoutLocale.cjs.map +1 -1
- package/dist/cjs/localization/getPrefix.cjs +2 -2
- package/dist/cjs/localization/getPrefix.cjs.map +1 -1
- package/dist/cjs/localization/index.cjs +3 -0
- package/dist/cjs/localization/rewriteUtils.cjs +1 -1
- package/dist/cjs/localization/rewriteUtils.cjs.map +1 -1
- package/dist/cjs/localization/validatePrefix.cjs +2 -2
- package/dist/cjs/localization/validatePrefix.cjs.map +1 -1
- package/dist/cjs/transpiler/markdown/validateMarkdown.cjs +6 -6
- package/dist/cjs/transpiler/markdown/validateMarkdown.cjs.map +1 -1
- package/dist/cjs/utils/localeStorage.cjs +4 -4
- package/dist/cjs/utils/localeStorage.cjs.map +1 -1
- package/dist/esm/dictionaryManipulator/index.mjs +2 -2
- package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs +1 -5
- package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs +48 -75
- package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs.map +1 -1
- package/dist/esm/index.mjs +3 -2
- package/dist/esm/interpreter/getContent/plugins.mjs +8 -8
- package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
- package/dist/esm/interpreter/getDictionary.mjs +5 -5
- package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
- package/dist/esm/interpreter/getIntlayer.mjs +8 -3
- package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
- package/dist/esm/localization/comparePaths.mjs +73 -0
- package/dist/esm/localization/comparePaths.mjs.map +1 -0
- package/dist/esm/localization/getLocalizedUrl.mjs +4 -4
- package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
- package/dist/esm/localization/getPathWithoutLocale.mjs +2 -2
- package/dist/esm/localization/getPathWithoutLocale.mjs.map +1 -1
- package/dist/esm/localization/getPrefix.mjs +2 -2
- package/dist/esm/localization/getPrefix.mjs.map +1 -1
- package/dist/esm/localization/index.mjs +2 -1
- package/dist/esm/localization/rewriteUtils.mjs +1 -1
- package/dist/esm/localization/rewriteUtils.mjs.map +1 -1
- package/dist/esm/localization/validatePrefix.mjs +2 -2
- package/dist/esm/localization/validatePrefix.mjs.map +1 -1
- package/dist/esm/transpiler/markdown/validateMarkdown.mjs +6 -6
- package/dist/esm/transpiler/markdown/validateMarkdown.mjs.map +1 -1
- package/dist/esm/utils/localeStorage.mjs +4 -4
- package/dist/esm/utils/localeStorage.mjs.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +1 -2
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +1 -2
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +1 -2
- package/dist/types/dictionaryManipulator/index.d.ts +2 -2
- package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts +1 -1
- package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts +33 -20
- package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/interpreter/getDictionary.d.ts +5 -5
- package/dist/types/interpreter/getIntlayer.d.ts +1 -1
- package/dist/types/interpreter/getPlural.d.ts +1 -1
- package/dist/types/localization/comparePaths.d.ts +66 -0
- package/dist/types/localization/comparePaths.d.ts.map +1 -0
- package/dist/types/localization/getPrefix.d.ts +4 -18
- package/dist/types/localization/getPrefix.d.ts.map +1 -1
- package/dist/types/localization/index.d.ts +2 -1
- package/dist/types/transpiler/markdown/validateMarkdown.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/cjs/interpreter/getCollection.cjs +0 -25
- package/dist/cjs/interpreter/getCollection.cjs.map +0 -1
- package/dist/cjs/interpreter/getVariant.cjs +0 -30
- package/dist/cjs/interpreter/getVariant.cjs.map +0 -1
- package/dist/cjs/transpiler/collection/collection.cjs +0 -32
- package/dist/cjs/transpiler/collection/collection.cjs.map +0 -1
- package/dist/cjs/transpiler/collection/index.cjs +0 -4
- package/dist/cjs/transpiler/variant/index.cjs +0 -4
- package/dist/cjs/transpiler/variant/variant.cjs +0 -35
- package/dist/cjs/transpiler/variant/variant.cjs.map +0 -1
- package/dist/esm/interpreter/getCollection.mjs +0 -23
- package/dist/esm/interpreter/getCollection.mjs.map +0 -1
- package/dist/esm/interpreter/getVariant.mjs +0 -28
- package/dist/esm/interpreter/getVariant.mjs.map +0 -1
- package/dist/esm/transpiler/collection/collection.mjs +0 -30
- package/dist/esm/transpiler/collection/collection.mjs.map +0 -1
- package/dist/esm/transpiler/collection/index.mjs +0 -3
- package/dist/esm/transpiler/variant/index.mjs +0 -3
- package/dist/esm/transpiler/variant/variant.mjs +0 -33
- package/dist/esm/transpiler/variant/variant.mjs.map +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/compact.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/currency.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/date.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/list.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/number.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/percentage.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/relativeTime.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/formatters/units.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/getCondition.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/deepTransform.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/getContent.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/plugins.d.ts +0 -4
- package/dist/types/@intlayer/core/dist/types/interpreter/getDictionary.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/getIntlayer.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/interpreter/getNesting.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/getTranslation.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/getVariant.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/intlayer/dist/types/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/generateSitemap.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/getBrowserLocale.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getHTMLTextDir.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getLocale.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleFromPath.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleLang.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleName.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getLocalizedUrl.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getMultilingualUrls.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getPathWithoutLocale.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/getPrefix.d.ts +0 -3
- package/dist/types/@intlayer/core/dist/types/localization/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/localeDetector.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/localization/localeMapper.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/localeResolver.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/localization/rewriteUtils.d.ts +0 -3
- package/dist/types/@intlayer/core/dist/types/localization/validatePrefix.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/markdown/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/collection/collection.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/condition/condition.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/enumeration/enumeration.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/file/file.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/gender/gender.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/html/html.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/insertion/insertion.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/markdown/markdown.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/transpiler/plural/plural.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/transpiler/translation/translation.d.ts +0 -2
- package/dist/types/@intlayer/core/dist/types/transpiler/variant/variant.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/utils/index.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/utils/intl.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/utils/isSameKeyPath.d.ts +0 -1
- package/dist/types/@intlayer/core/dist/types/utils/localeStorage.d.ts +0 -2
- package/dist/types/interpreter/getCollection.d.ts +0 -19
- package/dist/types/interpreter/getCollection.d.ts.map +0 -1
- package/dist/types/interpreter/getVariant.d.ts +0 -26
- package/dist/types/interpreter/getVariant.d.ts.map +0 -1
- package/dist/types/intlayer/dist/types/index.d.ts +0 -4
- package/dist/types/transpiler/collection/collection.d.ts +0 -34
- package/dist/types/transpiler/collection/collection.d.ts.map +0 -1
- package/dist/types/transpiler/collection/index.d.ts +0 -2
- package/dist/types/transpiler/variant/index.d.ts +0 -2
- package/dist/types/transpiler/variant/variant.d.ts +0 -43
- package/dist/types/transpiler/variant/variant.d.ts.map +0 -1
|
@@ -3,19 +3,32 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
|
3
3
|
|
|
4
4
|
//#region src/dictionaryManipulator/qualifiedDictionary.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* Canonical order of qualifier dimensions. A key that declares
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Canonical order of qualifier dimensions. A key that declares both dimensions
|
|
7
|
+
* always nests them in this order, with `item` innermost so it can act as the
|
|
8
|
+
* collection (array) axis.
|
|
9
9
|
*/
|
|
10
|
-
declare const QUALIFIER_ORDER: readonly ["variant", "
|
|
10
|
+
declare const QUALIFIER_ORDER: readonly ["variant", "item"];
|
|
11
11
|
/**
|
|
12
12
|
* Separator joining per-dimension ids into a composite entry id. Also used as
|
|
13
13
|
* the chunk path separator in dynamic mode.
|
|
14
14
|
*/
|
|
15
15
|
declare const COMPOSITE_ID_SEPARATOR = "/";
|
|
16
|
+
/**
|
|
17
|
+
* Canonical serialization of a variant value into its identity string — the
|
|
18
|
+
* variant segment of a composite id and the runtime matching key.
|
|
19
|
+
*
|
|
20
|
+
* - `undefined` → `'default'` (the implicit fallback variant)
|
|
21
|
+
* - a string → the string itself (a named variant)
|
|
22
|
+
* - an object → its sorted `key=value` pairs joined by `&`
|
|
23
|
+
* (e.g. `{ userId: '123', id: 'abc' }` → `'id=abc&userId=123'`)
|
|
24
|
+
*
|
|
25
|
+
* Two variants resolve to the same entry iff their serializations are equal, so
|
|
26
|
+
* an object variant in a selector must equal the one declared on the dictionary.
|
|
27
|
+
*/
|
|
28
|
+
declare const serializeVariant: (variant: string | Record<string, string | number> | undefined) => string;
|
|
16
29
|
/**
|
|
17
30
|
* Returns the qualifier dimensions declared on a dictionary, in canonical
|
|
18
|
-
* order (`variant →
|
|
31
|
+
* order (`variant → item`). Empty when the dictionary is unqualified
|
|
19
32
|
* (plain dictionary or shared base content of a qualified group).
|
|
20
33
|
*/
|
|
21
34
|
declare const getDictionaryQualifierTypes: (dictionary: Dictionary) => DictionaryQualifierType[];
|
|
@@ -23,8 +36,7 @@ declare const getDictionaryQualifierTypes: (dictionary: Dictionary) => Dictionar
|
|
|
23
36
|
* Returns the qualifier identifier of a dictionary for the given qualifier
|
|
24
37
|
* dimension — one segment of the composite entry id.
|
|
25
38
|
*
|
|
26
|
-
* - 'variant' → the variant
|
|
27
|
-
* - 'meta' → the `meta.id` discriminator
|
|
39
|
+
* - 'variant' → the serialized variant (named string or object identity)
|
|
28
40
|
* - 'item' → the item index as string
|
|
29
41
|
*/
|
|
30
42
|
declare const getDictionaryQualifierId: (dictionary: Dictionary, qualifierType: DictionaryQualifierType) => string | undefined;
|
|
@@ -48,12 +60,13 @@ declare const isQualifiedDictionaryGroup: (value: unknown) => value is Qualified
|
|
|
48
60
|
/**
|
|
49
61
|
* Reconstructs a resolvable {@link Dictionary} from a single entry of a
|
|
50
62
|
* qualified group: the content node stored under its composite id, plus the
|
|
51
|
-
* qualifier coordinates decoded from that id (`variant`, `item`)
|
|
52
|
-
* preserved `meta` object for the meta dimension.
|
|
63
|
+
* qualifier coordinates decoded from that id (`variant`, `item`).
|
|
53
64
|
*
|
|
54
65
|
* This keeps the resolver's matching/transform code unchanged: it still sees a
|
|
55
|
-
* `{ key, content, variant?, item
|
|
56
|
-
*
|
|
66
|
+
* `{ key, content, variant?, item? }` shape, even though the stored format no
|
|
67
|
+
* longer duplicates those fields per entry. The `variant` coordinate stays in
|
|
68
|
+
* its serialized form (e.g. `'id=abc&userId=123'`), which round-trips through
|
|
69
|
+
* {@link serializeVariant} during matching.
|
|
57
70
|
*/
|
|
58
71
|
declare const reconstructQualifiedEntry: (group: QualifiedDictionaryGroup, compositeId: string) => Dictionary;
|
|
59
72
|
/**
|
|
@@ -63,8 +76,8 @@ declare const reconstructQualifiedEntry: (group: QualifiedDictionaryGroup, compo
|
|
|
63
76
|
* - Plain dictionary → returned as-is (selector ignored)
|
|
64
77
|
* - `item` declared but not selected → every matching entry ordered by index
|
|
65
78
|
* - `item` selected → the matching entry or null
|
|
66
|
-
* - `variant` defaults to the `default` entry when not selected
|
|
67
|
-
*
|
|
79
|
+
* - `variant` defaults to the `default` entry when not selected; an object
|
|
80
|
+
* variant resolves only when the selector provides an equal object
|
|
68
81
|
*
|
|
69
82
|
* Dimensions compose: e.g. a variant × item key with `{ variant: 'promo' }`
|
|
70
83
|
* returns every promo item as an array; adding `{ item: 2 }` narrows to one.
|
|
@@ -119,7 +132,7 @@ type QualifiedDynamicLoaderMap = {
|
|
|
119
132
|
};
|
|
120
133
|
/**
|
|
121
134
|
* Type guard discriminating a qualified dynamic loader map (collections /
|
|
122
|
-
* variants
|
|
135
|
+
* variants, possibly combined) from a plain dynamic loader map.
|
|
123
136
|
*/
|
|
124
137
|
declare const isQualifiedDynamicLoaderMap: (value: unknown) => value is QualifiedDynamicLoaderMap;
|
|
125
138
|
/**
|
|
@@ -127,11 +140,11 @@ declare const isQualifiedDynamicLoaderMap: (value: unknown) => value is Qualifie
|
|
|
127
140
|
* loading only the chunk(s) the selector actually targets.
|
|
128
141
|
*
|
|
129
142
|
* Walks the nested loader tree one dimension at a time (canonical order
|
|
130
|
-
* `variant →
|
|
131
|
-
*
|
|
132
|
-
* given — expands into every sibling chunk (the collection
|
|
133
|
-
*
|
|
134
|
-
*
|
|
143
|
+
* `variant → item`): `variant` defaults to `default` (or descends by the
|
|
144
|
+
* serialized object identity), and `item` either narrows to the selected index
|
|
145
|
+
* or — when no item is given — expands into every sibling chunk (the collection
|
|
146
|
+
* axis). Semantics mirror {@link resolveQualifiedDictionary} so dynamic and
|
|
147
|
+
* static modes behave alike.
|
|
135
148
|
*
|
|
136
149
|
* The Suspense mechanism is injected through `loadChunk` so the same logic
|
|
137
150
|
* serves both the client (suspender cache) and the server (`react.use`). Every
|
|
@@ -172,5 +185,5 @@ declare const resolveQualifiedDynamicContentAsync: <Content>(params: {
|
|
|
172
185
|
transform: (dictionary: Dictionary) => Content;
|
|
173
186
|
}) => Promise<Content | Content[] | null>;
|
|
174
187
|
//#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 };
|
|
188
|
+
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, serializeVariant };
|
|
176
189
|
//# 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":";;;;;;AAaA;;;cAAa,eAAA;;AASb;;;cAAa,sBAAA;;AAcb;;;;;AAiBA;;;;;;cAjBa,gBAAA,GACX,OAAA,WAAkB,MAAA;;;AAkCpB;;;cAlBa,2BAAA,GACX,UAAA,EAAY,UAAA,KACX,uBAAA;;;;;;;AAiCH;cAjBa,wBAAA,GACX,UAAA,EAAY,UAAA,EACZ,aAAA,EAAe,uBAAA;;;;;;cAeJ,8BAAA,GACX,UAAA,EAAY,UAAA,EACZ,cAAA,EAAgB,uBAAA;;;AAiBlB;;cAAa,wBAAA,GACX,UAAA,EAAY,UAAA,EACZ,cAAA,EAAgB,uBAAA;;;;;;cAmCL,0BAAA,GACX,KAAA,cACC,KAAA,IAAS,wBAAA;;AAFZ;;;;;;;;;AAoBA;cAAa,yBAAA,GACX,KAAA,EAAO,wBAAA,EACP,WAAA,aACC,UAAA;;;;;;;;;AAgCH;;;;;cAAa,0BAAA,GACX,iBAAA,EAAmB,UAAA,GAAa,wBAAA,EAChC,QAAA,GAAW,kBAAA,KACV,UAAA,GAAa,UAAA;;;;;cA6BH,uBAAA,aAAqC,aAAA,EAChD,gBAAA,GAAmB,CAAA,GAAI,kBAAA;EACpB,MAAA,GAAS,CAAA;EAAG,QAAA,GAAW,kBAAA;AAAA;;;;;cAef,6BAAA,GACX,QAAA,GAAW,kBAAA;AAlBb;;;;;;AAAA,cA0Ca,2BAAA;;;;KAKD,uBAAA,SAAgC,OAAA,CAAQ,UAAA;;;;;KAMxC,0BAAA;EAAA,CACT,OAAA,WAAkB,0BAAA,GAA6B,uBAAA;AAAA;;;;AArClD;;;;;AAyBA;;;;KA2BY,yBAAA;EAAA,CACT,2BAAA,GAA8B,uBAAA;EAAA,CAC9B,MAAA,WAAiB,0BAAA,GAA6B,uBAAA;AAAA;;;AAlBjD;;cAyBa,2BAAA,GACX,KAAA,cACC,KAAA,IAAS,yBAAA;;;;;;;AAXZ;;;;;;;;;;;;;;;;AASA;cA+Ga,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;;;;;;;;;;;AAAA,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"}
|
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, getDictionaryCompositeId, getDictionaryQualifierId, getDictionaryQualifierSegments, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync } from "./dictionaryManipulator/qualifiedDictionary.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, 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";
|
|
@@ -59,6 +59,7 @@ import { number } from "./formatters/number.js";
|
|
|
59
59
|
import { percentage } from "./formatters/percentage.js";
|
|
60
60
|
import { relativeTime } from "./formatters/relativeTime.js";
|
|
61
61
|
import { units } from "./formatters/units.js";
|
|
62
|
+
import { comparePaths, normalizePath } from "./localization/comparePaths.js";
|
|
62
63
|
import { GenerateSitemapOptions, SitemapUrlEntry, generateSitemap, generateSitemapUrl } from "./localization/generateSitemap.js";
|
|
63
64
|
import { getBrowserLocale } from "./localization/getBrowserLocale.js";
|
|
64
65
|
import { getHTMLTextDir } from "./localization/getHTMLTextDir.js";
|
|
@@ -93,4 +94,4 @@ import { isValidElement } from "./utils/isValidReactElement.js";
|
|
|
93
94
|
import { CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, localeStorageOptions, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer } from "./utils/localeStorage.js";
|
|
94
95
|
import { YamlRecord, YamlValue, parseYaml } from "./utils/parseYaml.js";
|
|
95
96
|
import { stringifyYaml } from "./utils/stringifyYaml.js";
|
|
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 };
|
|
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, 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, 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 };
|
|
@@ -6,14 +6,14 @@ import { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from "@intlayer
|
|
|
6
6
|
/**
|
|
7
7
|
* Transforms a dictionary in a single pass, applying each plugin as needed.
|
|
8
8
|
*
|
|
9
|
-
* Also accepts a `QualifiedDictionaryGroup` (collections, variants
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Also accepts a `QualifiedDictionaryGroup` (collections, variants) together
|
|
10
|
+
* with a selector as second argument — the group is resolved to a single entry
|
|
11
|
+
* (or an ordered array of entries for collections without an `item` selector)
|
|
12
|
+
* before transformation.
|
|
13
13
|
*
|
|
14
14
|
* @param dictionary The dictionary (or qualified dictionary group) to transform.
|
|
15
15
|
* @param localeOrSelector The locale, or a selector object (`{ item }`,
|
|
16
|
-
* `{ variant }`,
|
|
16
|
+
* `{ variant }`, optionally with `locale`).
|
|
17
17
|
* @param plugins An array of NodeTransformer that define how to transform recognized nodes.
|
|
18
18
|
* If omitted, we’ll use a default set of plugins.
|
|
19
19
|
*/
|
|
@@ -10,7 +10,7 @@ import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, ExtractSelec
|
|
|
10
10
|
* The second argument is either a locale (`'fr'`) or a selector object:
|
|
11
11
|
* - `{ item: 2 }` — collection item (omit `item` to get every item as array)
|
|
12
12
|
* - `{ variant: 'black-friday' }` — named variant (omit for the `default` one)
|
|
13
|
-
* - `{ id: 'prod_abc',
|
|
13
|
+
* - `{ variant: { id: 'prod_abc', userId: '123' } }` — structured variant
|
|
14
14
|
* - `locale` can be combined with any selector: `{ item: 2, locale: 'fr' }`
|
|
15
15
|
*/
|
|
16
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>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PluralContentState } from "../transpiler/plural/plural.js";
|
|
2
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
3
2
|
import { DeclaredLocales } from "@intlayer/types";
|
|
3
|
+
import { LocalesValues } from "intlayer";
|
|
4
4
|
|
|
5
5
|
//#region src/interpreter/getPlural.d.ts
|
|
6
6
|
/**
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
+
|
|
3
|
+
//#region src/localization/comparePaths.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Normalizes a URL or pathname into a canonical, locale-agnostic pathname so
|
|
6
|
+
* that two paths pointing to the same page compare equal — useful for
|
|
7
|
+
* highlighting the active navigation link.
|
|
8
|
+
*
|
|
9
|
+
* The normalization:
|
|
10
|
+
* - strips the locale segment (reusing {@link getPathWithoutLocale})
|
|
11
|
+
* - strips the protocol/host so absolute and relative inputs compare equally
|
|
12
|
+
* - drops the query string and hash
|
|
13
|
+
* - ensures a single leading slash
|
|
14
|
+
* - removes any trailing slash (except for the root path)
|
|
15
|
+
* - falls back to `'/'` for empty values
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* normalizePath('/ru/path') // '/path'
|
|
21
|
+
* normalizePath('/ru/path/') // '/path'
|
|
22
|
+
* normalizePath('ru/path') // '/path'
|
|
23
|
+
* normalizePath('/ru/') // '/'
|
|
24
|
+
* normalizePath('/ru') // '/'
|
|
25
|
+
* normalizePath('') // '/'
|
|
26
|
+
* normalizePath('https://example.com/ru/path') // '/path'
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param inputUrl - The URL string or pathname to normalize.
|
|
30
|
+
* @param locales - Optional array of supported locales. Defaults to the
|
|
31
|
+
* configured locales.
|
|
32
|
+
* @returns The normalized, locale-agnostic pathname.
|
|
33
|
+
*/
|
|
34
|
+
declare const normalizePath: <const L extends LocalesValues = DeclaredLocales>(inputUrl: string, locales?: L[]) => string;
|
|
35
|
+
/**
|
|
36
|
+
* Compares two URLs or pathnames for equality, ignoring locale segment,
|
|
37
|
+
* protocol/host, query string, hash and trailing slashes.
|
|
38
|
+
*
|
|
39
|
+
* Both inputs are normalized through {@link normalizePath} before comparison,
|
|
40
|
+
* making this ideal for matching the current pathname against a navigation
|
|
41
|
+
* link's `href`.
|
|
42
|
+
*
|
|
43
|
+
* Example:
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* comparePaths('/ru/path', '/path') // true
|
|
47
|
+
* comparePaths('/ru/path/', '/path') // true
|
|
48
|
+
* comparePaths('/ru/path', '/path/') // true
|
|
49
|
+
* comparePaths('/ru/', '/') // true
|
|
50
|
+
* comparePaths('/ru', '/') // true
|
|
51
|
+
* comparePaths('ru/path', '/path') // true
|
|
52
|
+
* comparePaths('', '/') // true
|
|
53
|
+
* comparePaths('/ru', '') // true
|
|
54
|
+
* comparePaths('/ru/path', '/other') // false
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @param pathname - The first URL string or pathname to compare.
|
|
58
|
+
* @param href - The second URL string or pathname to compare.
|
|
59
|
+
* @param locales - Optional array of supported locales. Defaults to the
|
|
60
|
+
* configured locales.
|
|
61
|
+
* @returns `true` when both inputs resolve to the same locale-agnostic path.
|
|
62
|
+
*/
|
|
63
|
+
declare const comparePaths: <const L extends LocalesValues = DeclaredLocales>(pathname: string, href: string, locales?: L[]) => boolean;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { comparePaths, normalizePath };
|
|
66
|
+
//# sourceMappingURL=comparePaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparePaths.d.ts","names":[],"sources":["../../../src/localization/comparePaths.ts"],"mappings":";;;;;AAqCA;;;;;;;;;;;;;;;;AAiDA;;;;;;;;;;;;cAjDa,aAAA,mBAAiC,aAAA,GAAgB,eAAA,EAC5D,QAAA,UACA,OAAA,GAAU,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+CC,YAAA,mBAAgC,aAAA,GAAgB,eAAA,EAC3D,QAAA,UACA,IAAA,UACA,OAAA,GAAU,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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,
|
|
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,3 +1,4 @@
|
|
|
1
|
+
import { comparePaths, normalizePath } from "./comparePaths.js";
|
|
1
2
|
import { GenerateSitemapOptions, SitemapUrlEntry, generateSitemap, generateSitemapUrl } from "./generateSitemap.js";
|
|
2
3
|
import { getBrowserLocale } from "./getBrowserLocale.js";
|
|
3
4
|
import { getHTMLTextDir } from "./getHTMLTextDir.js";
|
|
@@ -14,4 +15,4 @@ import { localeFlatMap, localeMap, localeRecord } from "./localeMapper.js";
|
|
|
14
15
|
import { localeResolver } from "./localeResolver.js";
|
|
15
16
|
import { LocalizedPathResult, getCanonicalPath, getInternalPath, getLocalizedPath, getRewritePath, getRewriteRules } from "./rewriteUtils.js";
|
|
16
17
|
import { validatePrefix } from "./validatePrefix.js";
|
|
17
|
-
export { type GenerateSitemapOptions, type GetPrefixOptions, type GetPrefixResult, type LocalizedPathResult, type SitemapUrlEntry, generateSitemap, generateSitemapUrl, getBrowserLocale, getCanonicalPath, getHTMLTextDir, getInternalPath, getLocale, getLocaleFromPath, getLocaleLang, getLocaleName, getLocalizedPath, getLocalizedUrl, getMultilingualUrls, getPathWithoutLocale, getPrefix, getRewritePath, getRewriteRules, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, validatePrefix };
|
|
18
|
+
export { type GenerateSitemapOptions, type GetPrefixOptions, type GetPrefixResult, type LocalizedPathResult, type SitemapUrlEntry, 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 };
|
|
@@ -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;;;;;;;
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "9.0.0-canary.
|
|
3
|
+
"version": "9.0.0-canary.10",
|
|
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": "9.0.0-canary.
|
|
176
|
-
"@intlayer/config": "9.0.0-canary.
|
|
177
|
-
"@intlayer/dictionaries-entry": "9.0.0-canary.
|
|
178
|
-
"@intlayer/types": "9.0.0-canary.
|
|
179
|
-
"@intlayer/unmerged-dictionaries-entry": "9.0.0-canary.
|
|
175
|
+
"@intlayer/api": "9.0.0-canary.10",
|
|
176
|
+
"@intlayer/config": "9.0.0-canary.10",
|
|
177
|
+
"@intlayer/dictionaries-entry": "9.0.0-canary.10",
|
|
178
|
+
"@intlayer/types": "9.0.0-canary.10",
|
|
179
|
+
"@intlayer/unmerged-dictionaries-entry": "9.0.0-canary.10",
|
|
180
180
|
"defu": "6.1.7"
|
|
181
181
|
},
|
|
182
182
|
"devDependencies": {
|
|
183
|
-
"@types/node": "25.9.
|
|
183
|
+
"@types/node": "25.9.4",
|
|
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.
|
|
190
|
+
"vitest": "4.1.9"
|
|
191
191
|
},
|
|
192
192
|
"engines": {
|
|
193
193
|
"node": ">=14.18"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
|
|
3
|
-
//#region src/interpreter/getCollection.ts
|
|
4
|
-
/**
|
|
5
|
-
* Picks a single item from a resolved collection array, or returns the full
|
|
6
|
-
* array when no index is requested.
|
|
7
|
-
*
|
|
8
|
-
* @param items - The already-resolved collection items.
|
|
9
|
-
* @param itemIndex - Optional 0-based index of the item to retrieve.
|
|
10
|
-
* @returns The item at `itemIndex`, or the full array when no index is given.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* const all = getCollection(['a', 'b', 'c']); // ['a', 'b', 'c']
|
|
15
|
-
* const one = getCollection(['a', 'b', 'c'], 1); // 'b'
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
const getCollection = (items, itemIndex) => {
|
|
19
|
-
if (itemIndex === void 0 || itemIndex === null) return items;
|
|
20
|
-
return items[itemIndex];
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
exports.getCollection = getCollection;
|
|
25
|
-
//# sourceMappingURL=getCollection.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCollection.cjs","names":[],"sources":["../../../src/interpreter/getCollection.ts"],"sourcesContent":["/**\n * Picks a single item from a resolved collection array, or returns the full\n * array when no index is requested.\n *\n * @param items - The already-resolved collection items.\n * @param itemIndex - Optional 0-based index of the item to retrieve.\n * @returns The item at `itemIndex`, or the full array when no index is given.\n *\n * @example\n * ```ts\n * const all = getCollection(['a', 'b', 'c']); // ['a', 'b', 'c']\n * const one = getCollection(['a', 'b', 'c'], 1); // 'b'\n * ```\n */\nexport const getCollection = <T>(items: T[], itemIndex?: number): T | T[] => {\n if (itemIndex === undefined || itemIndex === null) {\n return items;\n }\n\n return items[itemIndex] as T;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAa,iBAAoB,OAAY,cAAgC;AAC3E,KAAI,cAAc,UAAa,cAAc,KAC3C,QAAO;AAGT,QAAO,MAAM"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
|
|
3
|
-
//#region src/interpreter/getVariant.ts
|
|
4
|
-
/**
|
|
5
|
-
* Resolves a variant node to its selected alternative.
|
|
6
|
-
*
|
|
7
|
-
* Falls back to `control` when the requested `variantKey` does not exist in
|
|
8
|
-
* the node or when no key is specified.
|
|
9
|
-
*
|
|
10
|
-
* @param variantContent - The map of variant alternatives.
|
|
11
|
-
* @param variantKey - Optional name of the alternative to select.
|
|
12
|
-
* @returns The resolved content for the requested variant.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* const node = { control: 'Welcome', black_friday: 'Up to 50% off' };
|
|
17
|
-
*
|
|
18
|
-
* getVariant(node); // 'Welcome'
|
|
19
|
-
* getVariant(node, 'black_friday'); // 'Up to 50% off'
|
|
20
|
-
* getVariant(node, 'nonexistent'); // 'Welcome' (fallback to control)
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
const getVariant = (variantContent, variantKey) => {
|
|
24
|
-
if (variantKey && variantKey in variantContent) return variantContent[variantKey];
|
|
25
|
-
return variantContent.control;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
exports.getVariant = getVariant;
|
|
30
|
-
//# sourceMappingURL=getVariant.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getVariant.cjs","names":[],"sources":["../../../src/interpreter/getVariant.ts"],"sourcesContent":["import type { VariantContentState } from '../transpiler/variant/variant';\n\n/**\n * Resolves a variant node to its selected alternative.\n *\n * Falls back to `control` when the requested `variantKey` does not exist in\n * the node or when no key is specified.\n *\n * @param variantContent - The map of variant alternatives.\n * @param variantKey - Optional name of the alternative to select.\n * @returns The resolved content for the requested variant.\n *\n * @example\n * ```ts\n * const node = { control: 'Welcome', black_friday: 'Up to 50% off' };\n *\n * getVariant(node); // 'Welcome'\n * getVariant(node, 'black_friday'); // 'Up to 50% off'\n * getVariant(node, 'nonexistent'); // 'Welcome' (fallback to control)\n * ```\n */\nexport const getVariant = <T>(\n variantContent: VariantContentState<T>,\n variantKey?: string\n): T => {\n if (variantKey && variantKey in variantContent) {\n return variantContent[variantKey] as T;\n }\n\n return variantContent.control as T;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,cACX,gBACA,eACM;AACN,KAAI,cAAc,cAAc,eAC9B,QAAO,eAAe;AAGxB,QAAO,eAAe"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
|
|
4
|
-
|
|
5
|
-
//#region src/transpiler/collection/collection.ts
|
|
6
|
-
/**
|
|
7
|
-
* Declares an ordered list of content items inside a dictionary.
|
|
8
|
-
*
|
|
9
|
-
* At runtime, `useIntlayer('my-key')` returns all items as an array.
|
|
10
|
-
* `useIntlayer('my-key', { item: 2 })` returns only the item at index 2.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { t, collection } from 'intlayer';
|
|
15
|
-
*
|
|
16
|
-
* export default {
|
|
17
|
-
* key: 'faq',
|
|
18
|
-
* content: collection([
|
|
19
|
-
* { question: t({ en: 'What is Intlayer?' }), answer: t({ en: '...' }) },
|
|
20
|
-
* { question: t({ en: 'Is it free?' }), answer: t({ en: '...' }) },
|
|
21
|
-
* ]),
|
|
22
|
-
* } satisfies Dictionary;
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
const collection = (items) => ({
|
|
26
|
-
nodeType: _intlayer_types_nodeType.COLLECTION,
|
|
27
|
-
collection: items
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
exports.collection = collection;
|
|
32
|
-
//# sourceMappingURL=collection.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collection.cjs","names":["COLLECTION"],"sources":["../../../../src/transpiler/collection/collection.ts"],"sourcesContent":["import { COLLECTION } from '@intlayer/types/nodeType';\n\n/**\n * Shape of a collection node stored in the dictionary JSON.\n * Items may contain any other node type (translations, conditions, etc.).\n */\nexport type CollectionContent<T = unknown> = {\n nodeType: typeof COLLECTION;\n collection: T[];\n};\n\n/**\n * Declares an ordered list of content items inside a dictionary.\n *\n * At runtime, `useIntlayer('my-key')` returns all items as an array.\n * `useIntlayer('my-key', { item: 2 })` returns only the item at index 2.\n *\n * @example\n * ```ts\n * import { t, collection } from 'intlayer';\n *\n * export default {\n * key: 'faq',\n * content: collection([\n * { question: t({ en: 'What is Intlayer?' }), answer: t({ en: '...' }) },\n * { question: t({ en: 'Is it free?' }), answer: t({ en: '...' }) },\n * ]),\n * } satisfies Dictionary;\n * ```\n */\nexport const collection = <T>(items: T[]): CollectionContent<T> => ({\n nodeType: COLLECTION,\n collection: items,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,cAAiB,WAAsC;CAClE,UAAUA;CACV,YAAY;CACb"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
|
|
4
|
-
|
|
5
|
-
//#region src/transpiler/variant/variant.ts
|
|
6
|
-
/**
|
|
7
|
-
* Declares a set of named content alternatives for A/B testing or feature flags.
|
|
8
|
-
*
|
|
9
|
-
* The `control` key is mandatory and acts as the default when no variant is
|
|
10
|
-
* selected. At runtime, `useIntlayer('my-key')` returns the `control` variant.
|
|
11
|
-
* `useIntlayer('my-key', { variant: 'black_friday' })` returns that variant.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* import { t, variant } from 'intlayer';
|
|
16
|
-
*
|
|
17
|
-
* export default {
|
|
18
|
-
* key: 'hero-banner',
|
|
19
|
-
* content: {
|
|
20
|
-
* headline: variant({
|
|
21
|
-
* control: t({ en: 'Welcome', fr: 'Bienvenue' }),
|
|
22
|
-
* black_friday: t({ en: 'Up to 50% off', fr: 'Jusqu\'à -50 %' }),
|
|
23
|
-
* }),
|
|
24
|
-
* },
|
|
25
|
-
* } satisfies Dictionary;
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
const variant = (variants) => ({
|
|
29
|
-
nodeType: _intlayer_types_nodeType.VARIANT,
|
|
30
|
-
variant: variants
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
exports.variant = variant;
|
|
35
|
-
//# sourceMappingURL=variant.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"variant.cjs","names":["VARIANT"],"sources":["../../../../src/transpiler/variant/variant.ts"],"sourcesContent":["import { VARIANT } from '@intlayer/types/nodeType';\n\n/**\n * Shape of a variant node stored in the dictionary JSON.\n * `control` is the mandatory default/fallback key; all other keys are\n * optional named experiment branches.\n */\nexport type VariantContentState<T = unknown> = { control: T } & Record<\n string,\n T\n>;\n\nexport type VariantContent<T = unknown> = {\n nodeType: typeof VARIANT;\n variant: VariantContentState<T>;\n};\n\n/**\n * Declares a set of named content alternatives for A/B testing or feature flags.\n *\n * The `control` key is mandatory and acts as the default when no variant is\n * selected. At runtime, `useIntlayer('my-key')` returns the `control` variant.\n * `useIntlayer('my-key', { variant: 'black_friday' })` returns that variant.\n *\n * @example\n * ```ts\n * import { t, variant } from 'intlayer';\n *\n * export default {\n * key: 'hero-banner',\n * content: {\n * headline: variant({\n * control: t({ en: 'Welcome', fr: 'Bienvenue' }),\n * black_friday: t({ en: 'Up to 50% off', fr: 'Jusqu\\'à -50 %' }),\n * }),\n * },\n * } satisfies Dictionary;\n * ```\n */\nexport const variant = <T>(\n variants: { control: T } & Partial<Record<string, T>>\n): VariantContent<T> => ({\n nodeType: VARIANT,\n variant: variants as VariantContentState<T>,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAa,WACX,cACuB;CACvB,UAAUA;CACV,SAAS;CACV"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//#region src/interpreter/getCollection.ts
|
|
2
|
-
/**
|
|
3
|
-
* Picks a single item from a resolved collection array, or returns the full
|
|
4
|
-
* array when no index is requested.
|
|
5
|
-
*
|
|
6
|
-
* @param items - The already-resolved collection items.
|
|
7
|
-
* @param itemIndex - Optional 0-based index of the item to retrieve.
|
|
8
|
-
* @returns The item at `itemIndex`, or the full array when no index is given.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const all = getCollection(['a', 'b', 'c']); // ['a', 'b', 'c']
|
|
13
|
-
* const one = getCollection(['a', 'b', 'c'], 1); // 'b'
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
const getCollection = (items, itemIndex) => {
|
|
17
|
-
if (itemIndex === void 0 || itemIndex === null) return items;
|
|
18
|
-
return items[itemIndex];
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { getCollection };
|
|
23
|
-
//# sourceMappingURL=getCollection.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCollection.mjs","names":[],"sources":["../../../src/interpreter/getCollection.ts"],"sourcesContent":["/**\n * Picks a single item from a resolved collection array, or returns the full\n * array when no index is requested.\n *\n * @param items - The already-resolved collection items.\n * @param itemIndex - Optional 0-based index of the item to retrieve.\n * @returns The item at `itemIndex`, or the full array when no index is given.\n *\n * @example\n * ```ts\n * const all = getCollection(['a', 'b', 'c']); // ['a', 'b', 'c']\n * const one = getCollection(['a', 'b', 'c'], 1); // 'b'\n * ```\n */\nexport const getCollection = <T>(items: T[], itemIndex?: number): T | T[] => {\n if (itemIndex === undefined || itemIndex === null) {\n return items;\n }\n\n return items[itemIndex] as T;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,iBAAoB,OAAY,cAAgC;AAC3E,KAAI,cAAc,UAAa,cAAc,KAC3C,QAAO;AAGT,QAAO,MAAM"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//#region src/interpreter/getVariant.ts
|
|
2
|
-
/**
|
|
3
|
-
* Resolves a variant node to its selected alternative.
|
|
4
|
-
*
|
|
5
|
-
* Falls back to `control` when the requested `variantKey` does not exist in
|
|
6
|
-
* the node or when no key is specified.
|
|
7
|
-
*
|
|
8
|
-
* @param variantContent - The map of variant alternatives.
|
|
9
|
-
* @param variantKey - Optional name of the alternative to select.
|
|
10
|
-
* @returns The resolved content for the requested variant.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* const node = { control: 'Welcome', black_friday: 'Up to 50% off' };
|
|
15
|
-
*
|
|
16
|
-
* getVariant(node); // 'Welcome'
|
|
17
|
-
* getVariant(node, 'black_friday'); // 'Up to 50% off'
|
|
18
|
-
* getVariant(node, 'nonexistent'); // 'Welcome' (fallback to control)
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
const getVariant = (variantContent, variantKey) => {
|
|
22
|
-
if (variantKey && variantKey in variantContent) return variantContent[variantKey];
|
|
23
|
-
return variantContent.control;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
export { getVariant };
|
|
28
|
-
//# sourceMappingURL=getVariant.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getVariant.mjs","names":[],"sources":["../../../src/interpreter/getVariant.ts"],"sourcesContent":["import type { VariantContentState } from '../transpiler/variant/variant';\n\n/**\n * Resolves a variant node to its selected alternative.\n *\n * Falls back to `control` when the requested `variantKey` does not exist in\n * the node or when no key is specified.\n *\n * @param variantContent - The map of variant alternatives.\n * @param variantKey - Optional name of the alternative to select.\n * @returns The resolved content for the requested variant.\n *\n * @example\n * ```ts\n * const node = { control: 'Welcome', black_friday: 'Up to 50% off' };\n *\n * getVariant(node); // 'Welcome'\n * getVariant(node, 'black_friday'); // 'Up to 50% off'\n * getVariant(node, 'nonexistent'); // 'Welcome' (fallback to control)\n * ```\n */\nexport const getVariant = <T>(\n variantContent: VariantContentState<T>,\n variantKey?: string\n): T => {\n if (variantKey && variantKey in variantContent) {\n return variantContent[variantKey] as T;\n }\n\n return variantContent.control as T;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,cACX,gBACA,eACM;AACN,KAAI,cAAc,cAAc,eAC9B,QAAO,eAAe;AAGxB,QAAO,eAAe"}
|