@intlayer/core 8.4.9 → 8.5.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"condition.cjs","names":["CONDITION"],"sources":["../../../../src/transpiler/condition/condition.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { CONDITION, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type ConditionContentStates<Content> = Record<`${boolean}`, Content> & {\n fallback?: Content;\n};\n\nexport type ConditionContent<Content = unknown> = TypedNodeModel<\n typeof CONDITION,\n ConditionContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a condition.\n *\n * Usage:\n *\n * ```ts\n * cond({\n * 'true': 'The condition is validated',\n * 'false': 'The condition is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst condition = <Content>(content?: ConditionContentStates<Content>) =>\n formatNodeType(CONDITION, content);\n\nexport { condition as cond };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,aAAsB,yDACXA,oCAAW,QAAQ"}
1
+ {"version":3,"file":"condition.cjs","names":["CONDITION"],"sources":["../../../../src/transpiler/condition/condition.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { CONDITION, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type ConditionContentStates<Content> = Record<`${boolean}`, Content> & {\n fallback?: Content;\n};\n\nexport type ConditionContent<Content = unknown> = TypedNodeModel<\n typeof CONDITION,\n ConditionContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a condition.\n *\n * Usage:\n *\n * ```ts\n * cond({\n * 'true': 'The condition is validated',\n * 'false': 'The condition is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst condition = <Content>(\n content?: ConditionContentStates<Content>\n): ConditionContent<Content> => formatNodeType(CONDITION, content);\n\nexport { condition as cond };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,aACJ,yDAC6CA,oCAAW,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"enumeration.cjs","names":["ENUMERATION"],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { ENUMERATION, formatNodeType } from '@intlayer/types/nodeType';\n\ntype Positive = number | `${number}`;\ntype Negative = `-${number}`;\ntype Numbers = Positive | Negative;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\nexport type EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type EnumerationContentState<Content> = Partial<\n Record<EnterFormat, Content>\n> & {\n fallback?: Content;\n};\n\nexport type EnumerationContent<Content = unknown> = TypedNodeModel<\n typeof ENUMERATION,\n EnumerationContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * enu({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * });\n * ```\n *\n * > The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content = unknown>(\n content?: EnumerationContentState<Content>\n) => formatNodeType(ENUMERATION, content);\n\nexport { enumeration as enu };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,eACJ,yDACkBA,sCAAa,QAAQ"}
1
+ {"version":3,"file":"enumeration.cjs","names":["ENUMERATION"],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { ENUMERATION, formatNodeType } from '@intlayer/types/nodeType';\n\ntype Positive = number | `${number}`;\ntype Negative = `-${number}`;\ntype Numbers = Positive | Negative;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\nexport type EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type EnumerationContentState<Content> = Partial<\n Record<EnterFormat, Content>\n> & {\n fallback?: Content;\n};\n\nexport type EnumerationContent<Content = unknown> = TypedNodeModel<\n typeof ENUMERATION,\n EnumerationContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * enu({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * });\n * ```\n *\n * > The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content = unknown>(\n content?: EnumerationContentState<Content>\n): EnumerationContent<Content> => formatNodeType(ENUMERATION, content);\n\nexport { enumeration as enu };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,eACJ,yDAC+CA,sCAAa,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"gender.cjs","names":["GENDER"],"sources":["../../../../src/transpiler/gender/gender.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, GENDER } from '@intlayer/types/nodeType';\n\nexport type Gender = 'male' | 'female' | 'fallback';\n\nexport type GenderContentStates<Content> = Record<`${Gender}`, Content> & {\n fallback?: Content;\n};\n\nexport type GenderContent<Content = unknown> = TypedNodeModel<\n typeof GENDER,\n GenderContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * gender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst gender = <Content>(content?: GenderContentStates<Content>) =>\n formatNodeType(GENDER, content);\n\nexport { gender };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,UAAmB,yDACRA,iCAAQ,QAAQ"}
1
+ {"version":3,"file":"gender.cjs","names":["GENDER"],"sources":["../../../../src/transpiler/gender/gender.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, GENDER } from '@intlayer/types/nodeType';\n\nexport type Gender = 'male' | 'female' | 'fallback';\n\nexport type GenderContentStates<Content> = Record<`${Gender}`, Content> & {\n fallback?: Content;\n};\n\nexport type GenderContent<Content = unknown> = TypedNodeModel<\n typeof GENDER,\n GenderContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * gender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst gender = <Content>(\n content?: GenderContentStates<Content>\n): GenderContent<Content> => formatNodeType(GENDER, content);\n\nexport { gender };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,UACJ,yDAC0CA,iCAAQ,QAAQ"}
@@ -14,7 +14,7 @@ const getMarkdownMetadata = (markdown) => {
14
14
  }
15
15
  if (metadataEndIndex === -1) return {};
16
16
  return require_utils_parseYaml.parseYaml(lines.slice(1, metadataEndIndex).join("\n")) ?? {};
17
- } catch (_e) {
17
+ } catch {
18
18
  return {};
19
19
  }
20
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getMarkdownMetadata.cjs","names":["parseYaml"],"sources":["../../../../src/transpiler/markdown/getMarkdownMetadata.ts"],"sourcesContent":["import { parseYaml } from '../../utils/parseYaml';\n\nexport const getMarkdownMetadata = <T extends Record<string, any>>(\n markdown: string\n): T => {\n try {\n const lines = markdown.split(/\\r?\\n/);\n\n // Check if the very first non-empty line is the metadata start delimiter.\n const firstNonEmptyLine = lines.find((line) => line.trim() !== '');\n\n if (!firstNonEmptyLine || firstNonEmptyLine.trim() !== '---') {\n const result: T = {} as T;\n return result;\n }\n\n // Find the end of the metadata block\n let metadataEndIndex = -1;\n for (let i = 1; i < lines.length; i++) {\n if (lines[i].trim() === '---') {\n metadataEndIndex = i;\n break;\n }\n }\n\n if (metadataEndIndex === -1) {\n // No closing delimiter found\n const result: T = {} as T;\n return result;\n }\n\n // Extract the metadata content between the delimiters\n const metadataLines = lines.slice(1, metadataEndIndex);\n const metadataContent = metadataLines.join('\\n');\n\n // Use the improved parseYaml function to parse the entire metadata block\n const metadata = parseYaml<T>(metadataContent);\n\n return metadata ?? ({} as T);\n } catch (_e) {\n const result: T = {} as T;\n return result;\n }\n};\n"],"mappings":";;;;AAEA,MAAa,uBACX,aACM;AACN,KAAI;EACF,MAAM,QAAQ,SAAS,MAAM,QAAQ;EAGrC,MAAM,oBAAoB,MAAM,MAAM,SAAS,KAAK,MAAM,KAAK,GAAG;AAElE,MAAI,CAAC,qBAAqB,kBAAkB,MAAM,KAAK,MAErD,QADkB,EAAE;EAKtB,IAAI,mBAAmB;AACvB,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,IAChC,KAAI,MAAM,GAAG,MAAM,KAAK,OAAO;AAC7B,sBAAmB;AACnB;;AAIJ,MAAI,qBAAqB,GAGvB,QADkB,EAAE;AAWtB,SAFiBA,kCAJK,MAAM,MAAM,GAAG,iBAAiB,CAChB,KAAK,KAAK,CAGF,IAE1B,EAAE;UACf,IAAI;AAEX,SADkB,EAAE"}
1
+ {"version":3,"file":"getMarkdownMetadata.cjs","names":["parseYaml"],"sources":["../../../../src/transpiler/markdown/getMarkdownMetadata.ts"],"sourcesContent":["import { parseYaml } from '../../utils/parseYaml';\n\nexport const getMarkdownMetadata = <T extends Record<string, any>>(\n markdown: string\n): T => {\n try {\n const lines = markdown.split(/\\r?\\n/);\n\n // Check if the very first non-empty line is the metadata start delimiter.\n const firstNonEmptyLine = lines.find((line) => line.trim() !== '');\n\n if (!firstNonEmptyLine || firstNonEmptyLine.trim() !== '---') {\n const result: T = {} as T;\n return result;\n }\n\n // Find the end of the metadata block\n let metadataEndIndex = -1;\n for (let i = 1; i < lines.length; i++) {\n if (lines[i].trim() === '---') {\n metadataEndIndex = i;\n break;\n }\n }\n\n if (metadataEndIndex === -1) {\n // No closing delimiter found\n const result: T = {} as T;\n return result;\n }\n\n // Extract the metadata content between the delimiters\n const metadataLines = lines.slice(1, metadataEndIndex);\n const metadataContent = metadataLines.join('\\n');\n\n // Use the improved parseYaml function to parse the entire metadata block\n const metadata = parseYaml<T>(metadataContent);\n\n return metadata ?? ({} as T);\n } catch {\n const result: T = {} as T;\n return result;\n }\n};\n"],"mappings":";;;;AAEA,MAAa,uBACX,aACM;AACN,KAAI;EACF,MAAM,QAAQ,SAAS,MAAM,QAAQ;EAGrC,MAAM,oBAAoB,MAAM,MAAM,SAAS,KAAK,MAAM,KAAK,GAAG;AAElE,MAAI,CAAC,qBAAqB,kBAAkB,MAAM,KAAK,MAErD,QADkB,EAAE;EAKtB,IAAI,mBAAmB;AACvB,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,IAChC,KAAI,MAAM,GAAG,MAAM,KAAK,OAAO;AAC7B,sBAAmB;AACnB;;AAIJ,MAAI,qBAAqB,GAGvB,QADkB,EAAE;AAWtB,SAFiBA,kCAJK,MAAM,MAAM,GAAG,iBAAiB,CAChB,KAAK,KAAK,CAGF,IAE1B,EAAE;SAChB;AAEN,SADkB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"translation.cjs","names":["TRANSLATION"],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":["import type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, TRANSLATION } from '@intlayer/types/nodeType';\n\nexport type TranslationContent<\n Content = unknown,\n RecordContent extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n> = TypedNodeModel<typeof TRANSLATION, RecordContent>;\n\n/**\n *\n * Function intended to be used to build intlayer dictionaries.\n *\n * Get the content of a translation based on the locale.\n *\n * Usage:\n *\n * ```ts\n * translation<string>({\n * \"en\": \"Hello\",\n * \"fr\": \"Bonjour\",\n * // ... any other available locale\n * })\n * ```\n *\n * Using TypeScript:\n * - this function require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nconst translation = <\n Content = unknown,\n ContentRecord extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n>(\n content: ContentRecord\n) =>\n formatNodeType(TRANSLATION, content) satisfies TranslationContent<\n Content,\n ContentRecord\n >;\n\nexport { translation as t };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,eAKJ,yDAEeA,sCAAa,QAAQ"}
1
+ {"version":3,"file":"translation.cjs","names":["TRANSLATION"],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":["import type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, TRANSLATION } from '@intlayer/types/nodeType';\n\nexport type TranslationContent<\n Content = unknown,\n RecordContent extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n> = TypedNodeModel<typeof TRANSLATION, RecordContent>;\n\n/**\n *\n * Function intended to be used to build intlayer dictionaries.\n *\n * Get the content of a translation based on the locale.\n *\n * Usage:\n *\n * ```ts\n * translation<string>({\n * \"en\": \"Hello\",\n * \"fr\": \"Bonjour\",\n * // ... any other available locale\n * })\n * ```\n *\n * Using TypeScript:\n * - this function require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nconst translation = <\n Content = unknown,\n ContentRecord extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n>(\n content: ContentRecord\n): TranslationContent<Content, ContentRecord> =>\n formatNodeType(TRANSLATION, content) satisfies TranslationContent<\n Content,\n ContentRecord\n >;\n\nexport { translation as t };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,eAKJ,yDAEeA,sCAAa,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"condition.mjs","names":[],"sources":["../../../../src/transpiler/condition/condition.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { CONDITION, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type ConditionContentStates<Content> = Record<`${boolean}`, Content> & {\n fallback?: Content;\n};\n\nexport type ConditionContent<Content = unknown> = TypedNodeModel<\n typeof CONDITION,\n ConditionContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a condition.\n *\n * Usage:\n *\n * ```ts\n * cond({\n * 'true': 'The condition is validated',\n * 'false': 'The condition is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst condition = <Content>(content?: ConditionContentStates<Content>) =>\n formatNodeType(CONDITION, content);\n\nexport { condition as cond };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,aAAsB,YAC1B,eAAe,WAAW,QAAQ"}
1
+ {"version":3,"file":"condition.mjs","names":[],"sources":["../../../../src/transpiler/condition/condition.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { CONDITION, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type ConditionContentStates<Content> = Record<`${boolean}`, Content> & {\n fallback?: Content;\n};\n\nexport type ConditionContent<Content = unknown> = TypedNodeModel<\n typeof CONDITION,\n ConditionContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a condition.\n *\n * Usage:\n *\n * ```ts\n * cond({\n * 'true': 'The condition is validated',\n * 'false': 'The condition is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst condition = <Content>(\n content?: ConditionContentStates<Content>\n): ConditionContent<Content> => formatNodeType(CONDITION, content);\n\nexport { condition as cond };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,aACJ,YAC8B,eAAe,WAAW,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"enumeration.mjs","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { ENUMERATION, formatNodeType } from '@intlayer/types/nodeType';\n\ntype Positive = number | `${number}`;\ntype Negative = `-${number}`;\ntype Numbers = Positive | Negative;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\nexport type EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type EnumerationContentState<Content> = Partial<\n Record<EnterFormat, Content>\n> & {\n fallback?: Content;\n};\n\nexport type EnumerationContent<Content = unknown> = TypedNodeModel<\n typeof ENUMERATION,\n EnumerationContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * enu({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * });\n * ```\n *\n * > The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content = unknown>(\n content?: EnumerationContentState<Content>\n) => formatNodeType(ENUMERATION, content);\n\nexport { enumeration as enu };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,eACJ,YACG,eAAe,aAAa,QAAQ"}
1
+ {"version":3,"file":"enumeration.mjs","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { ENUMERATION, formatNodeType } from '@intlayer/types/nodeType';\n\ntype Positive = number | `${number}`;\ntype Negative = `-${number}`;\ntype Numbers = Positive | Negative;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\nexport type EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type EnumerationContentState<Content> = Partial<\n Record<EnterFormat, Content>\n> & {\n fallback?: Content;\n};\n\nexport type EnumerationContent<Content = unknown> = TypedNodeModel<\n typeof ENUMERATION,\n EnumerationContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * enu({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * });\n * ```\n *\n * > The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content = unknown>(\n content?: EnumerationContentState<Content>\n): EnumerationContent<Content> => formatNodeType(ENUMERATION, content);\n\nexport { enumeration as enu };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,eACJ,YACgC,eAAe,aAAa,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"gender.mjs","names":[],"sources":["../../../../src/transpiler/gender/gender.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, GENDER } from '@intlayer/types/nodeType';\n\nexport type Gender = 'male' | 'female' | 'fallback';\n\nexport type GenderContentStates<Content> = Record<`${Gender}`, Content> & {\n fallback?: Content;\n};\n\nexport type GenderContent<Content = unknown> = TypedNodeModel<\n typeof GENDER,\n GenderContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * gender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst gender = <Content>(content?: GenderContentStates<Content>) =>\n formatNodeType(GENDER, content);\n\nexport { gender };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,UAAmB,YACvB,eAAe,QAAQ,QAAQ"}
1
+ {"version":3,"file":"gender.mjs","names":[],"sources":["../../../../src/transpiler/gender/gender.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, GENDER } from '@intlayer/types/nodeType';\n\nexport type Gender = 'male' | 'female' | 'fallback';\n\nexport type GenderContentStates<Content> = Record<`${Gender}`, Content> & {\n fallback?: Content;\n};\n\nexport type GenderContent<Content = unknown> = TypedNodeModel<\n typeof GENDER,\n GenderContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * gender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst gender = <Content>(\n content?: GenderContentStates<Content>\n): GenderContent<Content> => formatNodeType(GENDER, content);\n\nexport { gender };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,UACJ,YAC2B,eAAe,QAAQ,QAAQ"}
@@ -13,7 +13,7 @@ const getMarkdownMetadata = (markdown) => {
13
13
  }
14
14
  if (metadataEndIndex === -1) return {};
15
15
  return parseYaml(lines.slice(1, metadataEndIndex).join("\n")) ?? {};
16
- } catch (_e) {
16
+ } catch {
17
17
  return {};
18
18
  }
19
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getMarkdownMetadata.mjs","names":[],"sources":["../../../../src/transpiler/markdown/getMarkdownMetadata.ts"],"sourcesContent":["import { parseYaml } from '../../utils/parseYaml';\n\nexport const getMarkdownMetadata = <T extends Record<string, any>>(\n markdown: string\n): T => {\n try {\n const lines = markdown.split(/\\r?\\n/);\n\n // Check if the very first non-empty line is the metadata start delimiter.\n const firstNonEmptyLine = lines.find((line) => line.trim() !== '');\n\n if (!firstNonEmptyLine || firstNonEmptyLine.trim() !== '---') {\n const result: T = {} as T;\n return result;\n }\n\n // Find the end of the metadata block\n let metadataEndIndex = -1;\n for (let i = 1; i < lines.length; i++) {\n if (lines[i].trim() === '---') {\n metadataEndIndex = i;\n break;\n }\n }\n\n if (metadataEndIndex === -1) {\n // No closing delimiter found\n const result: T = {} as T;\n return result;\n }\n\n // Extract the metadata content between the delimiters\n const metadataLines = lines.slice(1, metadataEndIndex);\n const metadataContent = metadataLines.join('\\n');\n\n // Use the improved parseYaml function to parse the entire metadata block\n const metadata = parseYaml<T>(metadataContent);\n\n return metadata ?? ({} as T);\n } catch (_e) {\n const result: T = {} as T;\n return result;\n }\n};\n"],"mappings":";;;AAEA,MAAa,uBACX,aACM;AACN,KAAI;EACF,MAAM,QAAQ,SAAS,MAAM,QAAQ;EAGrC,MAAM,oBAAoB,MAAM,MAAM,SAAS,KAAK,MAAM,KAAK,GAAG;AAElE,MAAI,CAAC,qBAAqB,kBAAkB,MAAM,KAAK,MAErD,QADkB,EAAE;EAKtB,IAAI,mBAAmB;AACvB,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,IAChC,KAAI,MAAM,GAAG,MAAM,KAAK,OAAO;AAC7B,sBAAmB;AACnB;;AAIJ,MAAI,qBAAqB,GAGvB,QADkB,EAAE;AAWtB,SAFiB,UAJK,MAAM,MAAM,GAAG,iBAAiB,CAChB,KAAK,KAAK,CAGF,IAE1B,EAAE;UACf,IAAI;AAEX,SADkB,EAAE"}
1
+ {"version":3,"file":"getMarkdownMetadata.mjs","names":[],"sources":["../../../../src/transpiler/markdown/getMarkdownMetadata.ts"],"sourcesContent":["import { parseYaml } from '../../utils/parseYaml';\n\nexport const getMarkdownMetadata = <T extends Record<string, any>>(\n markdown: string\n): T => {\n try {\n const lines = markdown.split(/\\r?\\n/);\n\n // Check if the very first non-empty line is the metadata start delimiter.\n const firstNonEmptyLine = lines.find((line) => line.trim() !== '');\n\n if (!firstNonEmptyLine || firstNonEmptyLine.trim() !== '---') {\n const result: T = {} as T;\n return result;\n }\n\n // Find the end of the metadata block\n let metadataEndIndex = -1;\n for (let i = 1; i < lines.length; i++) {\n if (lines[i].trim() === '---') {\n metadataEndIndex = i;\n break;\n }\n }\n\n if (metadataEndIndex === -1) {\n // No closing delimiter found\n const result: T = {} as T;\n return result;\n }\n\n // Extract the metadata content between the delimiters\n const metadataLines = lines.slice(1, metadataEndIndex);\n const metadataContent = metadataLines.join('\\n');\n\n // Use the improved parseYaml function to parse the entire metadata block\n const metadata = parseYaml<T>(metadataContent);\n\n return metadata ?? ({} as T);\n } catch {\n const result: T = {} as T;\n return result;\n }\n};\n"],"mappings":";;;AAEA,MAAa,uBACX,aACM;AACN,KAAI;EACF,MAAM,QAAQ,SAAS,MAAM,QAAQ;EAGrC,MAAM,oBAAoB,MAAM,MAAM,SAAS,KAAK,MAAM,KAAK,GAAG;AAElE,MAAI,CAAC,qBAAqB,kBAAkB,MAAM,KAAK,MAErD,QADkB,EAAE;EAKtB,IAAI,mBAAmB;AACvB,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,IAChC,KAAI,MAAM,GAAG,MAAM,KAAK,OAAO;AAC7B,sBAAmB;AACnB;;AAIJ,MAAI,qBAAqB,GAGvB,QADkB,EAAE;AAWtB,SAFiB,UAJK,MAAM,MAAM,GAAG,iBAAiB,CAChB,KAAK,KAAK,CAGF,IAE1B,EAAE;SAChB;AAEN,SADkB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"translation.mjs","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":["import type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, TRANSLATION } from '@intlayer/types/nodeType';\n\nexport type TranslationContent<\n Content = unknown,\n RecordContent extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n> = TypedNodeModel<typeof TRANSLATION, RecordContent>;\n\n/**\n *\n * Function intended to be used to build intlayer dictionaries.\n *\n * Get the content of a translation based on the locale.\n *\n * Usage:\n *\n * ```ts\n * translation<string>({\n * \"en\": \"Hello\",\n * \"fr\": \"Bonjour\",\n * // ... any other available locale\n * })\n * ```\n *\n * Using TypeScript:\n * - this function require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nconst translation = <\n Content = unknown,\n ContentRecord extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n>(\n content: ContentRecord\n) =>\n formatNodeType(TRANSLATION, content) satisfies TranslationContent<\n Content,\n ContentRecord\n >;\n\nexport { translation as t };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,eAKJ,YAEA,eAAe,aAAa,QAAQ"}
1
+ {"version":3,"file":"translation.mjs","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":["import type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, TRANSLATION } from '@intlayer/types/nodeType';\n\nexport type TranslationContent<\n Content = unknown,\n RecordContent extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n> = TypedNodeModel<typeof TRANSLATION, RecordContent>;\n\n/**\n *\n * Function intended to be used to build intlayer dictionaries.\n *\n * Get the content of a translation based on the locale.\n *\n * Usage:\n *\n * ```ts\n * translation<string>({\n * \"en\": \"Hello\",\n * \"fr\": \"Bonjour\",\n * // ... any other available locale\n * })\n * ```\n *\n * Using TypeScript:\n * - this function require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nconst translation = <\n Content = unknown,\n ContentRecord extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n>(\n content: ContentRecord\n): TranslationContent<Content, ContentRecord> =>\n formatNodeType(TRANSLATION, content) satisfies TranslationContent<\n Content,\n ContentRecord\n >;\n\nexport { translation as t };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,eAKJ,YAEA,eAAe,aAAa,QAAQ"}
@@ -22,7 +22,7 @@ type ConditionContent<Content = unknown> = TypedNodeModel<typeof CONDITION, Cond
22
22
  * The last key provided will be used as the fallback value.
23
23
  *
24
24
  */
25
- declare const condition: <Content>(content?: ConditionContentStates<Content>) => TypedNodeModel<"condition", ConditionContentStates<Content>, {}>;
25
+ declare const condition: <Content>(content?: ConditionContentStates<Content>) => ConditionContent<Content>;
26
26
  //#endregion
27
27
  export { ConditionContent, ConditionContentStates, condition as cond };
28
28
  //# sourceMappingURL=condition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition.d.ts","names":[],"sources":["../../../../src/transpiler/condition/condition.ts"],"mappings":";;;KAGY,sBAAA,YAAkC,MAAA,eAAqB,OAAA;EACjE,QAAA,GAAW,OAAA;AAAA;AAAA,KAGD,gBAAA,sBAAsC,cAAA,QACzC,SAAA,EACP,sBAAA,CAAuB,OAAA;;;;;;;;;;;;;AAFzB;;;;;cAsBM,SAAA,YAAsB,OAAA,GAAU,sBAAA,CAAuB,OAAA,MAAQ,cAAA,cAAA,sBAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"condition.d.ts","names":[],"sources":["../../../../src/transpiler/condition/condition.ts"],"mappings":";;;KAGY,sBAAA,YAAkC,MAAA,eAAqB,OAAA;EACjE,QAAA,GAAW,OAAA;AAAA;AAAA,KAGD,gBAAA,sBAAsC,cAAA,QACzC,SAAA,EACP,sBAAA,CAAuB,OAAA;;;;;;;;;;;;;AAFzB;;;;;cAsBM,SAAA,YACJ,OAAA,GAAU,sBAAA,CAAuB,OAAA,MAChC,gBAAA,CAAiB,OAAA"}
@@ -34,7 +34,7 @@ type EnumerationContent<Content = unknown> = TypedNodeModel<typeof ENUMERATION,
34
34
  * > The order of the keys will define the priority of the content.
35
35
  *
36
36
  */
37
- declare const enumeration: <Content = unknown>(content?: EnumerationContentState<Content>) => TypedNodeModel<"enumeration", EnumerationContentState<Content>, {}>;
37
+ declare const enumeration: <Content = unknown>(content?: EnumerationContentState<Content>) => EnumerationContent<Content>;
38
38
  //#endregion
39
39
  export { EnterFormat, EnumerationContent, EnumerationContentState, enumeration as enu };
40
40
  //# sourceMappingURL=enumeration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enumeration.d.ts","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"mappings":";;;KAGK,QAAA;AAAA,KACA,QAAA;AAAA,KACA,OAAA,GAAU,QAAA,GAAW,QAAA;AAAA,KAErB,KAAA,GAAQ,OAAA;AAAA,KACR,WAAA,OAAkB,OAAA;AAAA,KAClB,QAAA,OAAe,OAAA;AAAA,KACf,eAAA,QAAuB,OAAA;AAAA,KACvB,QAAA,OAAe,OAAA;AAAA,KACf,eAAA,QAAuB,OAAA;AAAA,KAEhB,WAAA,GACR,KAAA,GACA,WAAA,GACA,QAAA,GACA,eAAA,GACA,QAAA,GACA,eAAA;AAAA,KAEQ,uBAAA,YAAmC,OAAA,CAC7C,MAAA,CAAO,WAAA,EAAa,OAAA;EAEpB,QAAA,GAAW,OAAA;AAAA;AAAA,KAGD,kBAAA,sBAAwC,cAAA,QAC3C,WAAA,EACP,uBAAA,CAAwB,OAAA;;;AAzBQ;;;;;AAEd;;;;;AACU;;;;;AACH;;cA2CrB,WAAA,sBACJ,OAAA,GAAU,uBAAA,CAAwB,OAAA,MAAQ,cAAA,gBAAA,uBAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"enumeration.d.ts","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"mappings":";;;KAGK,QAAA;AAAA,KACA,QAAA;AAAA,KACA,OAAA,GAAU,QAAA,GAAW,QAAA;AAAA,KAErB,KAAA,GAAQ,OAAA;AAAA,KACR,WAAA,OAAkB,OAAA;AAAA,KAClB,QAAA,OAAe,OAAA;AAAA,KACf,eAAA,QAAuB,OAAA;AAAA,KACvB,QAAA,OAAe,OAAA;AAAA,KACf,eAAA,QAAuB,OAAA;AAAA,KAEhB,WAAA,GACR,KAAA,GACA,WAAA,GACA,QAAA,GACA,eAAA,GACA,QAAA,GACA,eAAA;AAAA,KAEQ,uBAAA,YAAmC,OAAA,CAC7C,MAAA,CAAO,WAAA,EAAa,OAAA;EAEpB,QAAA,GAAW,OAAA;AAAA;AAAA,KAGD,kBAAA,sBAAwC,cAAA,QAC3C,WAAA,EACP,uBAAA,CAAwB,OAAA;;;AAzBQ;;;;;AAEd;;;;;AACU;;;;;AACH;;cA2CrB,WAAA,sBACJ,OAAA,GAAU,uBAAA,CAAwB,OAAA,MACjC,kBAAA,CAAmB,OAAA"}
@@ -23,7 +23,7 @@ type GenderContent<Content = unknown> = TypedNodeModel<typeof GENDER, GenderCont
23
23
  * The last key provided will be used as the fallback value.
24
24
  *
25
25
  */
26
- declare const gender: <Content>(content?: GenderContentStates<Content>) => TypedNodeModel<"gender", GenderContentStates<Content>, {}>;
26
+ declare const gender: <Content>(content?: GenderContentStates<Content>) => GenderContent<Content>;
27
27
  //#endregion
28
28
  export { Gender, GenderContent, GenderContentStates, gender };
29
29
  //# sourceMappingURL=gender.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gender.d.ts","names":[],"sources":["../../../../src/transpiler/gender/gender.ts"],"mappings":";;;KAGY,MAAA;AAAA,KAEA,mBAAA,YAA+B,MAAA,IAAU,MAAA,IAAU,OAAA;EAC7D,QAAA,GAAW,OAAA;AAAA;AAAA,KAGD,aAAA,sBAAmC,cAAA,QACtC,MAAA,EACP,mBAAA,CAAoB,OAAA;;AANtB;;;;;;;;;;;;;;;;cA0BM,MAAA,YAAmB,OAAA,GAAU,mBAAA,CAAoB,OAAA,MAAQ,cAAA,WAAA,mBAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"gender.d.ts","names":[],"sources":["../../../../src/transpiler/gender/gender.ts"],"mappings":";;;KAGY,MAAA;AAAA,KAEA,mBAAA,YAA+B,MAAA,IAAU,MAAA,IAAU,OAAA;EAC7D,QAAA,GAAW,OAAA;AAAA;AAAA,KAGD,aAAA,sBAAmC,cAAA,QACtC,MAAA,EACP,mBAAA,CAAoB,OAAA;;AANtB;;;;;;;;;;;;;;;;cA0BM,MAAA,YACJ,OAAA,GAAU,mBAAA,CAAoB,OAAA,MAC7B,aAAA,CAAc,OAAA"}
@@ -23,11 +23,7 @@ type TranslationContent<Content = unknown, RecordContent extends StrictModeLocal
23
23
  * - this function require each locale to be defined if defined in the project configuration.
24
24
  * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
25
25
  */
26
- declare const translation: <Content = unknown, ContentRecord extends StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>>(content: ContentRecord) => TypedNodeModel<"translation", ContentRecord, {
27
- nodeType: "translation";
28
- } & {
29
- translation: ContentRecord;
30
- }>;
26
+ declare const translation: <Content = unknown, ContentRecord extends StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>>(content: ContentRecord) => TranslationContent<Content, ContentRecord>;
31
27
  //#endregion
32
28
  export { TranslationContent, translation as t };
33
29
  //# sourceMappingURL=translation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"translation.d.ts","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"mappings":";;;;KAIY,kBAAA,0CAGR,mBAAA,CAAoB,OAAA,IAAW,mBAAA,CAAoB,OAAA,KACnD,cAAA,QAAsB,WAAA,EAAa,aAAA;AAJvC;;;;;;;;;;;;;;;;;;;;AAAA,cA0BM,WAAA,4CAGF,mBAAA,CAAoB,OAAA,IAAW,mBAAA,CAAoB,OAAA,GAErD,OAAA,EAAS,aAAA,KAAa,cAAA,gBAAA,aAAA"}
1
+ {"version":3,"file":"translation.d.ts","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"mappings":";;;;KAIY,kBAAA,0CAGR,mBAAA,CAAoB,OAAA,IAAW,mBAAA,CAAoB,OAAA,KACnD,cAAA,QAAsB,WAAA,EAAa,aAAA;AAJvC;;;;;;;;;;;;;;;;;;;;AAAA,cA0BM,WAAA,4CAGF,mBAAA,CAAoB,OAAA,IAAW,mBAAA,CAAoB,OAAA,GAErD,OAAA,EAAS,aAAA,KACR,kBAAA,CAAmB,OAAA,EAAS,aAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "8.4.9",
3
+ "version": "8.5.0",
4
4
  "private": false,
5
5
  "description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
6
6
  "keywords": [
@@ -168,11 +168,11 @@
168
168
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
169
169
  },
170
170
  "dependencies": {
171
- "@intlayer/api": "8.4.9",
172
- "@intlayer/config": "8.4.9",
173
- "@intlayer/dictionaries-entry": "8.4.9",
174
- "@intlayer/types": "8.4.9",
175
- "@intlayer/unmerged-dictionaries-entry": "8.4.9",
171
+ "@intlayer/api": "8.5.0",
172
+ "@intlayer/config": "8.5.0",
173
+ "@intlayer/dictionaries-entry": "8.5.0",
174
+ "@intlayer/types": "8.5.0",
175
+ "@intlayer/unmerged-dictionaries-entry": "8.5.0",
176
176
  "defu": "6.1.4"
177
177
  },
178
178
  "devDependencies": {
@@ -182,8 +182,8 @@
182
182
  "@utils/tsdown-config": "1.0.4",
183
183
  "rimraf": "6.1.3",
184
184
  "tsdown": "0.21.4",
185
- "typescript": "5.9.3",
186
- "vitest": "4.1.0"
185
+ "typescript": "6.0.2",
186
+ "vitest": "4.1.1"
187
187
  },
188
188
  "engines": {
189
189
  "node": ">=14.18"