@intlayer/core 9.0.0-canary.17 → 9.0.0-canary.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (484) hide show
  1. package/dist/cjs/deepTransformPlugins/getEditedContent.cjs +2 -1
  2. package/dist/cjs/deepTransformPlugins/getEditedContent.cjs.map +1 -1
  3. package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs.map +1 -1
  4. package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs.map +1 -1
  5. package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs.map +1 -1
  6. package/dist/cjs/deepTransformPlugins/getLocalizedContent.cjs.map +1 -1
  7. package/dist/cjs/deepTransformPlugins/getMaskContent.cjs.map +1 -1
  8. package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs.map +1 -1
  9. package/dist/cjs/deepTransformPlugins/getMultilingualDictionary.cjs.map +1 -1
  10. package/dist/cjs/deepTransformPlugins/getReplacedValuesContent.cjs.map +1 -1
  11. package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs +1 -1
  12. package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs.map +1 -1
  13. package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs.map +1 -1
  14. package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
  15. package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
  16. package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
  17. package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
  18. package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
  19. package/dist/cjs/dictionaryManipulator/getNodeType.cjs.map +1 -1
  20. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +1 -2
  21. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -1
  22. package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs +0 -1
  23. package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs.map +1 -1
  24. package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs.map +1 -1
  25. package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs +0 -1
  26. package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs.map +1 -1
  27. package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs.map +1 -1
  28. package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
  29. package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
  30. package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs.map +1 -1
  31. package/dist/cjs/formatters/compact.cjs +1 -2
  32. package/dist/cjs/formatters/compact.cjs.map +1 -1
  33. package/dist/cjs/formatters/currency.cjs +1 -2
  34. package/dist/cjs/formatters/currency.cjs.map +1 -1
  35. package/dist/cjs/formatters/date.cjs +1 -3
  36. package/dist/cjs/formatters/date.cjs.map +1 -1
  37. package/dist/cjs/formatters/list.cjs +1 -2
  38. package/dist/cjs/formatters/list.cjs.map +1 -1
  39. package/dist/cjs/formatters/number.cjs +1 -2
  40. package/dist/cjs/formatters/number.cjs.map +1 -1
  41. package/dist/cjs/formatters/percentage.cjs +1 -2
  42. package/dist/cjs/formatters/percentage.cjs.map +1 -1
  43. package/dist/cjs/formatters/relativeTime.cjs +1 -2
  44. package/dist/cjs/formatters/relativeTime.cjs.map +1 -1
  45. package/dist/cjs/formatters/units.cjs +1 -2
  46. package/dist/cjs/formatters/units.cjs.map +1 -1
  47. package/dist/cjs/interpreter/getCondition.cjs.map +1 -1
  48. package/dist/cjs/interpreter/getContent/deepTransform.cjs +3 -2
  49. package/dist/cjs/interpreter/getContent/deepTransform.cjs.map +1 -1
  50. package/dist/cjs/interpreter/getContent/getContent.cjs +0 -1
  51. package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
  52. package/dist/cjs/interpreter/getContent/plugins.cjs +4 -2
  53. package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
  54. package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
  55. package/dist/cjs/interpreter/getEnumeration.cjs.map +1 -1
  56. package/dist/cjs/interpreter/getGender.cjs.map +1 -1
  57. package/dist/cjs/interpreter/getHTML.cjs.map +1 -1
  58. package/dist/cjs/interpreter/getInsertion.cjs.map +1 -1
  59. package/dist/cjs/interpreter/getIntlayer.cjs +2 -2
  60. package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
  61. package/dist/cjs/interpreter/getNesting.cjs.map +1 -1
  62. package/dist/cjs/interpreter/getPlural.cjs +1 -1
  63. package/dist/cjs/interpreter/getPlural.cjs.map +1 -1
  64. package/dist/cjs/interpreter/getTranslation.cjs.map +1 -1
  65. package/dist/cjs/interpreter/splitAndJoinInsertion.cjs.map +1 -1
  66. package/dist/cjs/localization/comparePaths.cjs.map +1 -1
  67. package/dist/cjs/localization/domainUtils.cjs.map +1 -1
  68. package/dist/cjs/localization/generateSitemap.cjs +2 -1
  69. package/dist/cjs/localization/generateSitemap.cjs.map +1 -1
  70. package/dist/cjs/localization/getBrowserLocale.cjs +7 -4
  71. package/dist/cjs/localization/getBrowserLocale.cjs.map +1 -1
  72. package/dist/cjs/localization/getHTMLTextDir.cjs.map +1 -1
  73. package/dist/cjs/localization/getLocale.cjs +0 -1
  74. package/dist/cjs/localization/getLocale.cjs.map +1 -1
  75. package/dist/cjs/localization/getLocaleFromPath.cjs.map +1 -1
  76. package/dist/cjs/localization/getLocaleLang.cjs.map +1 -1
  77. package/dist/cjs/localization/getLocaleName.cjs.map +1 -1
  78. package/dist/cjs/localization/getLocalizedUrl.cjs +0 -1
  79. package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
  80. package/dist/cjs/localization/getMultilingualUrls.cjs.map +1 -1
  81. package/dist/cjs/localization/getPathWithoutLocale.cjs +0 -1
  82. package/dist/cjs/localization/getPathWithoutLocale.cjs.map +1 -1
  83. package/dist/cjs/localization/getPrefix.cjs +0 -1
  84. package/dist/cjs/localization/getPrefix.cjs.map +1 -1
  85. package/dist/cjs/localization/localeDetector.cjs +2 -1
  86. package/dist/cjs/localization/localeDetector.cjs.map +1 -1
  87. package/dist/cjs/localization/localeMapper.cjs +0 -1
  88. package/dist/cjs/localization/localeMapper.cjs.map +1 -1
  89. package/dist/cjs/localization/localeResolver.cjs +0 -1
  90. package/dist/cjs/localization/localeResolver.cjs.map +1 -1
  91. package/dist/cjs/localization/rewriteUtils.cjs +2 -1
  92. package/dist/cjs/localization/rewriteUtils.cjs.map +1 -1
  93. package/dist/cjs/localization/validatePrefix.cjs.map +1 -1
  94. package/dist/cjs/markdown/compiler.cjs +2 -1
  95. package/dist/cjs/markdown/compiler.cjs.map +1 -1
  96. package/dist/cjs/markdown/constants.cjs.map +1 -1
  97. package/dist/cjs/markdown/parser.cjs.map +1 -1
  98. package/dist/cjs/markdown/renderer.cjs.map +1 -1
  99. package/dist/cjs/markdown/utils.cjs.map +1 -1
  100. package/dist/cjs/messageFormat/ICU.cjs +15 -9
  101. package/dist/cjs/messageFormat/ICU.cjs.map +1 -1
  102. package/dist/cjs/messageFormat/i18next.cjs +12 -7
  103. package/dist/cjs/messageFormat/i18next.cjs.map +1 -1
  104. package/dist/cjs/messageFormat/navigatePath.cjs.map +1 -1
  105. package/dist/cjs/messageFormat/po.cjs.map +1 -1
  106. package/dist/cjs/messageFormat/resolveMessage.cjs +11 -8
  107. package/dist/cjs/messageFormat/resolveMessage.cjs.map +1 -1
  108. package/dist/cjs/messageFormat/verify-icu-format.cjs.map +1 -1
  109. package/dist/cjs/messageFormat/vue-i18n.cjs +2 -1
  110. package/dist/cjs/messageFormat/vue-i18n.cjs.map +1 -1
  111. package/dist/cjs/transpiler/condition/condition.cjs +0 -1
  112. package/dist/cjs/transpiler/condition/condition.cjs.map +1 -1
  113. package/dist/cjs/transpiler/enumeration/enumeration.cjs +0 -1
  114. package/dist/cjs/transpiler/enumeration/enumeration.cjs.map +1 -1
  115. package/dist/cjs/transpiler/file/file.cjs +2 -2
  116. package/dist/cjs/transpiler/file/file.cjs.map +1 -1
  117. package/dist/cjs/transpiler/file/fileBrowser.cjs.map +1 -1
  118. package/dist/cjs/transpiler/gender/gender.cjs +0 -1
  119. package/dist/cjs/transpiler/gender/gender.cjs.map +1 -1
  120. package/dist/cjs/transpiler/html/getHTMLCustomComponents.cjs.map +1 -1
  121. package/dist/cjs/transpiler/html/html.cjs +0 -1
  122. package/dist/cjs/transpiler/html/html.cjs.map +1 -1
  123. package/dist/cjs/transpiler/html/htmlTags.cjs.map +1 -1
  124. package/dist/cjs/transpiler/html/validateHTML.cjs +1 -1
  125. package/dist/cjs/transpiler/html/validateHTML.cjs.map +1 -1
  126. package/dist/cjs/transpiler/insertion/getInsertionValues.cjs.map +1 -1
  127. package/dist/cjs/transpiler/insertion/insertion.cjs +0 -1
  128. package/dist/cjs/transpiler/insertion/insertion.cjs.map +1 -1
  129. package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs.map +1 -1
  130. package/dist/cjs/transpiler/markdown/markdown.cjs +0 -1
  131. package/dist/cjs/transpiler/markdown/markdown.cjs.map +1 -1
  132. package/dist/cjs/transpiler/markdown/validateMarkdown.cjs.map +1 -1
  133. package/dist/cjs/transpiler/nesting/nesting.cjs +0 -1
  134. package/dist/cjs/transpiler/nesting/nesting.cjs.map +1 -1
  135. package/dist/cjs/transpiler/plural/plural.cjs +0 -1
  136. package/dist/cjs/transpiler/plural/plural.cjs.map +1 -1
  137. package/dist/cjs/transpiler/translation/translation.cjs +0 -1
  138. package/dist/cjs/transpiler/translation/translation.cjs.map +1 -1
  139. package/dist/cjs/utils/checkIsURLAbsolute.cjs.map +1 -1
  140. package/dist/cjs/utils/cookieExpiry.cjs.map +1 -1
  141. package/dist/cjs/utils/getCookie.cjs.map +1 -1
  142. package/dist/cjs/utils/intl.cjs +101 -26
  143. package/dist/cjs/utils/intl.cjs.map +1 -1
  144. package/dist/cjs/utils/isSameKeyPath.cjs.map +1 -1
  145. package/dist/cjs/utils/localeStorage.cjs +0 -1
  146. package/dist/cjs/utils/localeStorage.cjs.map +1 -1
  147. package/dist/cjs/utils/parseYaml.cjs +1 -1
  148. package/dist/cjs/utils/parseYaml.cjs.map +1 -1
  149. package/dist/cjs/utils/stringifyYaml.cjs +1 -1
  150. package/dist/cjs/utils/stringifyYaml.cjs.map +1 -1
  151. package/dist/esm/deepTransformPlugins/getEditedContent.mjs +2 -1
  152. package/dist/esm/deepTransformPlugins/getEditedContent.mjs.map +1 -1
  153. package/dist/esm/deepTransformPlugins/getFilterMissingTranslationsContent.mjs.map +1 -1
  154. package/dist/esm/deepTransformPlugins/getFilterTranslationsOnlyContent.mjs.map +1 -1
  155. package/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs.map +1 -1
  156. package/dist/esm/deepTransformPlugins/getLocalizedContent.mjs.map +1 -1
  157. package/dist/esm/deepTransformPlugins/getMaskContent.mjs.map +1 -1
  158. package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs.map +1 -1
  159. package/dist/esm/deepTransformPlugins/getMultilingualDictionary.mjs.map +1 -1
  160. package/dist/esm/deepTransformPlugins/getReplacedValuesContent.mjs.map +1 -1
  161. package/dist/esm/deepTransformPlugins/getSplittedContent.mjs +1 -1
  162. package/dist/esm/deepTransformPlugins/getSplittedContent.mjs.map +1 -1
  163. package/dist/esm/deepTransformPlugins/insertContentInDictionary.mjs.map +1 -1
  164. package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
  165. package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
  166. package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
  167. package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
  168. package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
  169. package/dist/esm/dictionaryManipulator/getNodeType.mjs.map +1 -1
  170. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs +1 -1
  171. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs.map +1 -1
  172. package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs.map +1 -1
  173. package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs.map +1 -1
  174. package/dist/esm/dictionaryManipulator/orderDictionaries.mjs.map +1 -1
  175. package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs.map +1 -1
  176. package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -1
  177. package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -1
  178. package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs.map +1 -1
  179. package/dist/esm/formatters/compact.mjs +1 -1
  180. package/dist/esm/formatters/compact.mjs.map +1 -1
  181. package/dist/esm/formatters/currency.mjs +1 -1
  182. package/dist/esm/formatters/currency.mjs.map +1 -1
  183. package/dist/esm/formatters/date.mjs +1 -2
  184. package/dist/esm/formatters/date.mjs.map +1 -1
  185. package/dist/esm/formatters/list.mjs +1 -1
  186. package/dist/esm/formatters/list.mjs.map +1 -1
  187. package/dist/esm/formatters/number.mjs +1 -1
  188. package/dist/esm/formatters/number.mjs.map +1 -1
  189. package/dist/esm/formatters/percentage.mjs +1 -1
  190. package/dist/esm/formatters/percentage.mjs.map +1 -1
  191. package/dist/esm/formatters/relativeTime.mjs +1 -1
  192. package/dist/esm/formatters/relativeTime.mjs.map +1 -1
  193. package/dist/esm/formatters/units.mjs +1 -1
  194. package/dist/esm/formatters/units.mjs.map +1 -1
  195. package/dist/esm/interpreter/getCondition.mjs.map +1 -1
  196. package/dist/esm/interpreter/getContent/deepTransform.mjs +3 -2
  197. package/dist/esm/interpreter/getContent/deepTransform.mjs.map +1 -1
  198. package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -1
  199. package/dist/esm/interpreter/getContent/plugins.mjs +4 -2
  200. package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
  201. package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
  202. package/dist/esm/interpreter/getEnumeration.mjs.map +1 -1
  203. package/dist/esm/interpreter/getGender.mjs.map +1 -1
  204. package/dist/esm/interpreter/getHTML.mjs.map +1 -1
  205. package/dist/esm/interpreter/getInsertion.mjs.map +1 -1
  206. package/dist/esm/interpreter/getIntlayer.mjs +2 -1
  207. package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
  208. package/dist/esm/interpreter/getNesting.mjs.map +1 -1
  209. package/dist/esm/interpreter/getPlural.mjs +1 -1
  210. package/dist/esm/interpreter/getPlural.mjs.map +1 -1
  211. package/dist/esm/interpreter/getTranslation.mjs.map +1 -1
  212. package/dist/esm/interpreter/splitAndJoinInsertion.mjs.map +1 -1
  213. package/dist/esm/localization/comparePaths.mjs.map +1 -1
  214. package/dist/esm/localization/domainUtils.mjs.map +1 -1
  215. package/dist/esm/localization/generateSitemap.mjs +2 -1
  216. package/dist/esm/localization/generateSitemap.mjs.map +1 -1
  217. package/dist/esm/localization/getBrowserLocale.mjs +7 -3
  218. package/dist/esm/localization/getBrowserLocale.mjs.map +1 -1
  219. package/dist/esm/localization/getHTMLTextDir.mjs.map +1 -1
  220. package/dist/esm/localization/getLocale.mjs.map +1 -1
  221. package/dist/esm/localization/getLocaleFromPath.mjs.map +1 -1
  222. package/dist/esm/localization/getLocaleLang.mjs.map +1 -1
  223. package/dist/esm/localization/getLocaleName.mjs.map +1 -1
  224. package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
  225. package/dist/esm/localization/getMultilingualUrls.mjs.map +1 -1
  226. package/dist/esm/localization/getPathWithoutLocale.mjs.map +1 -1
  227. package/dist/esm/localization/getPrefix.mjs.map +1 -1
  228. package/dist/esm/localization/localeDetector.mjs +2 -1
  229. package/dist/esm/localization/localeDetector.mjs.map +1 -1
  230. package/dist/esm/localization/localeMapper.mjs.map +1 -1
  231. package/dist/esm/localization/localeResolver.mjs.map +1 -1
  232. package/dist/esm/localization/rewriteUtils.mjs +2 -1
  233. package/dist/esm/localization/rewriteUtils.mjs.map +1 -1
  234. package/dist/esm/localization/validatePrefix.mjs.map +1 -1
  235. package/dist/esm/markdown/compiler.mjs +2 -1
  236. package/dist/esm/markdown/compiler.mjs.map +1 -1
  237. package/dist/esm/markdown/constants.mjs.map +1 -1
  238. package/dist/esm/markdown/parser.mjs.map +1 -1
  239. package/dist/esm/markdown/renderer.mjs.map +1 -1
  240. package/dist/esm/markdown/utils.mjs.map +1 -1
  241. package/dist/esm/messageFormat/ICU.mjs +15 -9
  242. package/dist/esm/messageFormat/ICU.mjs.map +1 -1
  243. package/dist/esm/messageFormat/i18next.mjs +12 -7
  244. package/dist/esm/messageFormat/i18next.mjs.map +1 -1
  245. package/dist/esm/messageFormat/navigatePath.mjs.map +1 -1
  246. package/dist/esm/messageFormat/po.mjs.map +1 -1
  247. package/dist/esm/messageFormat/resolveMessage.mjs +11 -8
  248. package/dist/esm/messageFormat/resolveMessage.mjs.map +1 -1
  249. package/dist/esm/messageFormat/verify-icu-format.mjs.map +1 -1
  250. package/dist/esm/messageFormat/vue-i18n.mjs +2 -1
  251. package/dist/esm/messageFormat/vue-i18n.mjs.map +1 -1
  252. package/dist/esm/transpiler/condition/condition.mjs.map +1 -1
  253. package/dist/esm/transpiler/enumeration/enumeration.mjs.map +1 -1
  254. package/dist/esm/transpiler/file/file.mjs +2 -1
  255. package/dist/esm/transpiler/file/file.mjs.map +1 -1
  256. package/dist/esm/transpiler/file/fileBrowser.mjs.map +1 -1
  257. package/dist/esm/transpiler/gender/gender.mjs.map +1 -1
  258. package/dist/esm/transpiler/html/getHTMLCustomComponents.mjs.map +1 -1
  259. package/dist/esm/transpiler/html/html.mjs.map +1 -1
  260. package/dist/esm/transpiler/html/htmlTags.mjs.map +1 -1
  261. package/dist/esm/transpiler/html/validateHTML.mjs +1 -1
  262. package/dist/esm/transpiler/html/validateHTML.mjs.map +1 -1
  263. package/dist/esm/transpiler/insertion/getInsertionValues.mjs.map +1 -1
  264. package/dist/esm/transpiler/insertion/insertion.mjs.map +1 -1
  265. package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs.map +1 -1
  266. package/dist/esm/transpiler/markdown/markdown.mjs.map +1 -1
  267. package/dist/esm/transpiler/markdown/validateMarkdown.mjs.map +1 -1
  268. package/dist/esm/transpiler/nesting/nesting.mjs.map +1 -1
  269. package/dist/esm/transpiler/plural/plural.mjs.map +1 -1
  270. package/dist/esm/transpiler/translation/translation.mjs.map +1 -1
  271. package/dist/esm/utils/checkIsURLAbsolute.mjs.map +1 -1
  272. package/dist/esm/utils/cookieExpiry.mjs.map +1 -1
  273. package/dist/esm/utils/getCookie.mjs.map +1 -1
  274. package/dist/esm/utils/intl.mjs +100 -25
  275. package/dist/esm/utils/intl.mjs.map +1 -1
  276. package/dist/esm/utils/isSameKeyPath.mjs.map +1 -1
  277. package/dist/esm/utils/localeStorage.mjs.map +1 -1
  278. package/dist/esm/utils/parseYaml.mjs +1 -1
  279. package/dist/esm/utils/parseYaml.mjs.map +1 -1
  280. package/dist/esm/utils/stringifyYaml.mjs +1 -1
  281. package/dist/esm/utils/stringifyYaml.mjs.map +1 -1
  282. package/dist/types/deepTransformPlugins/getEditedContent.d.ts +0 -1
  283. package/dist/types/deepTransformPlugins/getEditedContent.d.ts.map +1 -1
  284. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +12 -13
  285. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
  286. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +12 -13
  287. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
  288. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +12 -13
  289. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
  290. package/dist/types/deepTransformPlugins/getLocalizedContent.d.ts +1 -1
  291. package/dist/types/deepTransformPlugins/getLocalizedContent.d.ts.map +1 -1
  292. package/dist/types/deepTransformPlugins/getMaskContent.d.ts +1 -1
  293. package/dist/types/deepTransformPlugins/getMaskContent.d.ts.map +1 -1
  294. package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts +1 -1
  295. package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts.map +1 -1
  296. package/dist/types/deepTransformPlugins/getMultilingualDictionary.d.ts +0 -1
  297. package/dist/types/deepTransformPlugins/getMultilingualDictionary.d.ts.map +1 -1
  298. package/dist/types/deepTransformPlugins/getReplacedValuesContent.d.ts +1 -1
  299. package/dist/types/deepTransformPlugins/getReplacedValuesContent.d.ts.map +1 -1
  300. package/dist/types/deepTransformPlugins/getSplittedContent.d.ts +1 -2
  301. package/dist/types/deepTransformPlugins/getSplittedContent.d.ts.map +1 -1
  302. package/dist/types/deepTransformPlugins/insertContentInDictionary.d.ts +1 -2
  303. package/dist/types/deepTransformPlugins/insertContentInDictionary.d.ts.map +1 -1
  304. package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts +0 -1
  305. package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts.map +1 -1
  306. package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts +0 -1
  307. package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts.map +1 -1
  308. package/dist/types/dictionaryManipulator/getDefaultNode.d.ts +0 -1
  309. package/dist/types/dictionaryManipulator/getDefaultNode.d.ts.map +1 -1
  310. package/dist/types/dictionaryManipulator/getEmptyNode.d.ts +0 -1
  311. package/dist/types/dictionaryManipulator/getEmptyNode.d.ts.map +1 -1
  312. package/dist/types/dictionaryManipulator/getNodeChildren.d.ts +0 -1
  313. package/dist/types/dictionaryManipulator/getNodeChildren.d.ts.map +1 -1
  314. package/dist/types/dictionaryManipulator/getNodeType.d.ts +0 -1
  315. package/dist/types/dictionaryManipulator/getNodeType.d.ts.map +1 -1
  316. package/dist/types/dictionaryManipulator/mergeDictionaries.d.ts +0 -1
  317. package/dist/types/dictionaryManipulator/mergeDictionaries.d.ts.map +1 -1
  318. package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts +0 -1
  319. package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts.map +1 -1
  320. package/dist/types/dictionaryManipulator/normalizeDictionary.d.ts +0 -1
  321. package/dist/types/dictionaryManipulator/normalizeDictionary.d.ts.map +1 -1
  322. package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +1 -2
  323. package/dist/types/dictionaryManipulator/orderDictionaries.d.ts.map +1 -1
  324. package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts +1 -2
  325. package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts.map +1 -1
  326. package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts +0 -1
  327. package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts.map +1 -1
  328. package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts +1 -2
  329. package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts.map +1 -1
  330. package/dist/types/dictionaryManipulator/updateNodeChildren.d.ts +0 -1
  331. package/dist/types/dictionaryManipulator/updateNodeChildren.d.ts.map +1 -1
  332. package/dist/types/formatters/compact.d.ts +0 -1
  333. package/dist/types/formatters/compact.d.ts.map +1 -1
  334. package/dist/types/formatters/currency.d.ts +0 -1
  335. package/dist/types/formatters/currency.d.ts.map +1 -1
  336. package/dist/types/formatters/date.d.ts +0 -1
  337. package/dist/types/formatters/date.d.ts.map +1 -1
  338. package/dist/types/formatters/index.d.ts +2 -2
  339. package/dist/types/formatters/list.d.ts +0 -1
  340. package/dist/types/formatters/list.d.ts.map +1 -1
  341. package/dist/types/formatters/number.d.ts +1 -5
  342. package/dist/types/formatters/number.d.ts.map +1 -1
  343. package/dist/types/formatters/percentage.d.ts +1 -5
  344. package/dist/types/formatters/percentage.d.ts.map +1 -1
  345. package/dist/types/formatters/relativeTime.d.ts +0 -1
  346. package/dist/types/formatters/relativeTime.d.ts.map +1 -1
  347. package/dist/types/formatters/units.d.ts +0 -1
  348. package/dist/types/formatters/units.d.ts.map +1 -1
  349. package/dist/types/index.d.ts +11 -2
  350. package/dist/types/interpreter/getCondition.d.ts +1 -0
  351. package/dist/types/interpreter/getCondition.d.ts.map +1 -1
  352. package/dist/types/interpreter/getContent/deepTransform.d.ts +0 -1
  353. package/dist/types/interpreter/getContent/deepTransform.d.ts.map +1 -1
  354. package/dist/types/interpreter/getContent/getContent.d.ts +0 -1
  355. package/dist/types/interpreter/getContent/getContent.d.ts.map +1 -1
  356. package/dist/types/interpreter/getContent/plugins.d.ts +4 -4
  357. package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
  358. package/dist/types/interpreter/getDictionary.d.ts +1 -1
  359. package/dist/types/interpreter/getDictionary.d.ts.map +1 -1
  360. package/dist/types/interpreter/getEnumeration.d.ts +1 -0
  361. package/dist/types/interpreter/getEnumeration.d.ts.map +1 -1
  362. package/dist/types/interpreter/getGender.d.ts +1 -0
  363. package/dist/types/interpreter/getGender.d.ts.map +1 -1
  364. package/dist/types/interpreter/getHTML.d.ts.map +1 -1
  365. package/dist/types/interpreter/getInsertion.d.ts +2 -1
  366. package/dist/types/interpreter/getInsertion.d.ts.map +1 -1
  367. package/dist/types/interpreter/getIntlayer.d.ts +1 -1
  368. package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
  369. package/dist/types/interpreter/getNesting.d.ts +2 -1
  370. package/dist/types/interpreter/getNesting.d.ts.map +1 -1
  371. package/dist/types/interpreter/getPlural.d.ts +0 -1
  372. package/dist/types/interpreter/getPlural.d.ts.map +1 -1
  373. package/dist/types/interpreter/getTranslation.d.ts +0 -1
  374. package/dist/types/interpreter/getTranslation.d.ts.map +1 -1
  375. package/dist/types/interpreter/index.d.ts +1 -0
  376. package/dist/types/interpreter/splitAndJoinInsertion.d.ts.map +1 -1
  377. package/dist/types/localization/comparePaths.d.ts +0 -1
  378. package/dist/types/localization/comparePaths.d.ts.map +1 -1
  379. package/dist/types/localization/domainUtils.d.ts +0 -1
  380. package/dist/types/localization/domainUtils.d.ts.map +1 -1
  381. package/dist/types/localization/generateSitemap.d.ts +6 -4
  382. package/dist/types/localization/generateSitemap.d.ts.map +1 -1
  383. package/dist/types/localization/getBrowserLocale.d.ts +0 -1
  384. package/dist/types/localization/getBrowserLocale.d.ts.map +1 -1
  385. package/dist/types/localization/getHTMLTextDir.d.ts +0 -1
  386. package/dist/types/localization/getHTMLTextDir.d.ts.map +1 -1
  387. package/dist/types/localization/getLocale.d.ts +0 -1
  388. package/dist/types/localization/getLocale.d.ts.map +1 -1
  389. package/dist/types/localization/getLocaleFromPath.d.ts +0 -1
  390. package/dist/types/localization/getLocaleFromPath.d.ts.map +1 -1
  391. package/dist/types/localization/getLocaleLang.d.ts +0 -1
  392. package/dist/types/localization/getLocaleLang.d.ts.map +1 -1
  393. package/dist/types/localization/getLocaleName.d.ts +0 -1
  394. package/dist/types/localization/getLocaleName.d.ts.map +1 -1
  395. package/dist/types/localization/getLocalizedUrl.d.ts +0 -1
  396. package/dist/types/localization/getLocalizedUrl.d.ts.map +1 -1
  397. package/dist/types/localization/getMultilingualUrls.d.ts +0 -1
  398. package/dist/types/localization/getMultilingualUrls.d.ts.map +1 -1
  399. package/dist/types/localization/getPathWithoutLocale.d.ts +0 -1
  400. package/dist/types/localization/getPathWithoutLocale.d.ts.map +1 -1
  401. package/dist/types/localization/getPrefix.d.ts +2 -3
  402. package/dist/types/localization/getPrefix.d.ts.map +1 -1
  403. package/dist/types/localization/localeDetector.d.ts +0 -1
  404. package/dist/types/localization/localeDetector.d.ts.map +1 -1
  405. package/dist/types/localization/localeMapper.d.ts +3 -4
  406. package/dist/types/localization/localeMapper.d.ts.map +1 -1
  407. package/dist/types/localization/localeResolver.d.ts +0 -1
  408. package/dist/types/localization/localeResolver.d.ts.map +1 -1
  409. package/dist/types/localization/rewriteUtils.d.ts +2 -3
  410. package/dist/types/localization/rewriteUtils.d.ts.map +1 -1
  411. package/dist/types/localization/validatePrefix.d.ts +0 -1
  412. package/dist/types/localization/validatePrefix.d.ts.map +1 -1
  413. package/dist/types/markdown/compiler.d.ts +0 -1
  414. package/dist/types/markdown/compiler.d.ts.map +1 -1
  415. package/dist/types/markdown/constants.d.ts +48 -38
  416. package/dist/types/markdown/constants.d.ts.map +1 -1
  417. package/dist/types/markdown/index.d.ts +2 -1
  418. package/dist/types/markdown/parser.d.ts +0 -1
  419. package/dist/types/markdown/parser.d.ts.map +1 -1
  420. package/dist/types/markdown/renderer.d.ts +0 -1
  421. package/dist/types/markdown/renderer.d.ts.map +1 -1
  422. package/dist/types/markdown/types.d.ts +44 -24
  423. package/dist/types/markdown/types.d.ts.map +1 -1
  424. package/dist/types/markdown/utils.d.ts +3 -4
  425. package/dist/types/markdown/utils.d.ts.map +1 -1
  426. package/dist/types/messageFormat/ICU.d.ts +2 -3
  427. package/dist/types/messageFormat/ICU.d.ts.map +1 -1
  428. package/dist/types/messageFormat/i18next.d.ts +2 -3
  429. package/dist/types/messageFormat/i18next.d.ts.map +1 -1
  430. package/dist/types/messageFormat/navigatePath.d.ts.map +1 -1
  431. package/dist/types/messageFormat/po.d.ts +2 -3
  432. package/dist/types/messageFormat/po.d.ts.map +1 -1
  433. package/dist/types/messageFormat/resolveMessage.d.ts +0 -1
  434. package/dist/types/messageFormat/resolveMessage.d.ts.map +1 -1
  435. package/dist/types/messageFormat/verify-icu-format.d.ts +1 -1
  436. package/dist/types/messageFormat/vue-i18n.d.ts +2 -3
  437. package/dist/types/messageFormat/vue-i18n.d.ts.map +1 -1
  438. package/dist/types/transpiler/condition/condition.d.ts +0 -1
  439. package/dist/types/transpiler/condition/condition.d.ts.map +1 -1
  440. package/dist/types/transpiler/enumeration/enumeration.d.ts +0 -1
  441. package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
  442. package/dist/types/transpiler/file/file.d.ts +0 -1
  443. package/dist/types/transpiler/file/file.d.ts.map +1 -1
  444. package/dist/types/transpiler/file/fileBrowser.d.ts +0 -1
  445. package/dist/types/transpiler/file/fileBrowser.d.ts.map +1 -1
  446. package/dist/types/transpiler/gender/gender.d.ts +0 -1
  447. package/dist/types/transpiler/gender/gender.d.ts.map +1 -1
  448. package/dist/types/transpiler/html/getHTMLCustomComponents.d.ts.map +1 -1
  449. package/dist/types/transpiler/html/html.d.ts +0 -1
  450. package/dist/types/transpiler/html/html.d.ts.map +1 -1
  451. package/dist/types/transpiler/html/htmlTags.d.ts +1 -1
  452. package/dist/types/transpiler/html/htmlTags.d.ts.map +1 -1
  453. package/dist/types/transpiler/html/validateHTML.d.ts.map +1 -1
  454. package/dist/types/transpiler/index.d.ts +11 -1
  455. package/dist/types/transpiler/insertion/getInsertionValues.d.ts.map +1 -1
  456. package/dist/types/transpiler/insertion/insertion.d.ts +0 -1
  457. package/dist/types/transpiler/insertion/insertion.d.ts.map +1 -1
  458. package/dist/types/transpiler/markdown/getMarkdownMetadata.d.ts.map +1 -1
  459. package/dist/types/transpiler/markdown/index.d.ts +1 -1
  460. package/dist/types/transpiler/markdown/markdown.d.ts +0 -1
  461. package/dist/types/transpiler/markdown/markdown.d.ts.map +1 -1
  462. package/dist/types/transpiler/markdown/validateMarkdown.d.ts +0 -1
  463. package/dist/types/transpiler/markdown/validateMarkdown.d.ts.map +1 -1
  464. package/dist/types/transpiler/nesting/nesting.d.ts +4 -4
  465. package/dist/types/transpiler/nesting/nesting.d.ts.map +1 -1
  466. package/dist/types/transpiler/plural/plural.d.ts +0 -1
  467. package/dist/types/transpiler/plural/plural.d.ts.map +1 -1
  468. package/dist/types/transpiler/translation/translation.d.ts +0 -1
  469. package/dist/types/transpiler/translation/translation.d.ts.map +1 -1
  470. package/dist/types/utils/checkIsURLAbsolute.d.ts.map +1 -1
  471. package/dist/types/utils/cookieExpiry.d.ts +1 -2
  472. package/dist/types/utils/cookieExpiry.d.ts.map +1 -1
  473. package/dist/types/utils/getCookie.d.ts.map +1 -1
  474. package/dist/types/utils/index.d.ts +2 -2
  475. package/dist/types/utils/intl.d.ts +49 -5
  476. package/dist/types/utils/intl.d.ts.map +1 -1
  477. package/dist/types/utils/isSameKeyPath.d.ts +0 -1
  478. package/dist/types/utils/isSameKeyPath.d.ts.map +1 -1
  479. package/dist/types/utils/isValidReactElement.d.ts.map +1 -1
  480. package/dist/types/utils/localeStorage.d.ts +1 -2
  481. package/dist/types/utils/localeStorage.d.ts.map +1 -1
  482. package/dist/types/utils/parseYaml.d.ts.map +1 -1
  483. package/dist/types/utils/stringifyYaml.d.ts.map +1 -1
  484. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"validateMarkdown.cjs","names":["validateHTML"],"sources":["../../../../src/transpiler/markdown/validateMarkdown.ts"],"sourcesContent":["import { type HTMLValidationIssue, validateHTML } from '../html/validateHTML';\n\nexport type { HTMLValidationIssue as MarkdownValidationIssue } from '../html/validateHTML';\n\nexport type MarkdownValidationResult = {\n valid: boolean;\n issues: HTMLValidationIssue[];\n};\n\n/**\n * Strips fenced code blocks and inline code from markdown content so that\n * HTML-like syntax inside code is not mistakenly validated.\n */\nconst stripCode = (content: string): string => {\n const lines = content.split('\\n');\n const result: string[] = [];\n let inCodeBlock = false;\n let openFence: string | null = null;\n\n for (const line of lines) {\n // Allow leading whitespace and blockquote markers before the fence characters\n const fence = line.match(/^[\\s>]*(`{3,}|~{3,})/);\n if (!inCodeBlock) {\n if (fence?.[1]) {\n inCodeBlock = true;\n openFence = fence[1];\n result.push('');\n } else {\n // Also strip inline code spans on this line. Code spans may be\n // delimited by a run of one or more backticks and end with a matching\n // run of the same length (CommonMark), allowing shorter backtick runs\n // inside (e.g. `` t`Hello ${name}` ``).\n result.push(\n line.replace(/(`+)(?:(?!\\1).)+?\\1/g, (m) => ' '.repeat(m.length))\n );\n }\n } else {\n if (\n fence?.[1]?.[0] &&\n fence[1][0] === openFence![0] &&\n fence[1].length >= openFence!.length\n ) {\n inCodeBlock = false;\n openFence = null;\n }\n result.push('');\n }\n }\n\n return result.join('\\n');\n};\n\nconst validateCodeBlocks = (content: string): HTMLValidationIssue[] => {\n const issues: HTMLValidationIssue[] = [];\n const lines = content.split('\\n');\n let inCodeBlock = false;\n let openFence: string | null = null;\n let openLineNumber = -1;\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n // Allow leading whitespace and blockquote markers before the fence characters\n const fence = line?.match(/^[\\s>]*(`{3,}|~{3,})/);\n\n if (!inCodeBlock) {\n if (fence?.[1]) {\n inCodeBlock = true;\n openFence = fence[1];\n openLineNumber = i + 1;\n }\n } else {\n if (\n fence?.[1] &&\n fence[1][0] === openFence![0] &&\n fence[1].length >= openFence!.length\n ) {\n inCodeBlock = false;\n openFence = null;\n }\n }\n }\n\n if (inCodeBlock) {\n issues.push({\n type: 'error',\n message: `Unclosed code block (opened at line ${openLineNumber})`,\n });\n }\n\n return issues;\n};\n\n/**\n * Validates markdown content for structural correctness:\n * - All fenced code blocks are properly closed\n * - HTML tags are properly nested and closed\n *\n * HTML inside code blocks is excluded from HTML validation.\n */\nexport const validateMarkdown = (content: string): MarkdownValidationResult => {\n const codeIssues = validateCodeBlocks(content);\n const htmlIssues = validateHTML(stripCode(content)).issues;\n const issues = [...codeIssues, ...htmlIssues];\n\n return {\n valid: issues.filter((i) => i.type === 'error').length === 0,\n issues,\n };\n};\n"],"mappings":";;;;;;;;AAaA,MAAM,aAAa,YAA4B;CAC7C,MAAM,QAAQ,QAAQ,MAAM,KAAK;CACjC,MAAM,SAAmB,EAAE;CAC3B,IAAI,cAAc;CAClB,IAAI,YAA2B;AAE/B,MAAK,MAAM,QAAQ,OAAO;EAExB,MAAM,QAAQ,KAAK,MAAM,uBAAuB;AAChD,MAAI,CAAC,YACH,KAAI,QAAQ,IAAI;AACd,iBAAc;AACd,eAAY,MAAM;AAClB,UAAO,KAAK,GAAG;QAMf,QAAO,KACL,KAAK,QAAQ,yBAAyB,MAAM,IAAI,OAAO,EAAE,OAAO,CAAC,CAClE;OAEE;AACL,OACE,QAAQ,KAAK,MACb,MAAM,GAAG,OAAO,UAAW,MAC3B,MAAM,GAAG,UAAU,UAAW,QAC9B;AACA,kBAAc;AACd,gBAAY;;AAEd,UAAO,KAAK,GAAG;;;AAInB,QAAO,OAAO,KAAK,KAAK;;AAG1B,MAAM,sBAAsB,YAA2C;CACrE,MAAM,SAAgC,EAAE;CACxC,MAAM,QAAQ,QAAQ,MAAM,KAAK;CACjC,IAAI,cAAc;CAClB,IAAI,YAA2B;CAC/B,IAAI,iBAAiB;AAErB,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EAGrC,MAAM,QAFO,MAAM,IAEC,MAAM,uBAAuB;AAEjD,MAAI,CAAC,aACH;OAAI,QAAQ,IAAI;AACd,kBAAc;AACd,gBAAY,MAAM;AAClB,qBAAiB,IAAI;;aAIrB,QAAQ,MACR,MAAM,GAAG,OAAO,UAAW,MAC3B,MAAM,GAAG,UAAU,UAAW,QAC9B;AACA,iBAAc;AACd,eAAY;;;AAKlB,KAAI,YACF,QAAO,KAAK;EACV,MAAM;EACN,SAAS,uCAAuC,eAAe;EAChE,CAAC;AAGJ,QAAO;;;;;;;;;AAUT,MAAa,oBAAoB,YAA8C;CAC7E,MAAM,aAAa,mBAAmB,QAAQ;CAC9C,MAAM,aAAaA,kDAAa,UAAU,QAAQ,CAAC,CAAC;CACpD,MAAM,SAAS,CAAC,GAAG,YAAY,GAAG,WAAW;AAE7C,QAAO;EACL,OAAO,OAAO,QAAQ,MAAM,EAAE,SAAS,QAAQ,CAAC,WAAW;EAC3D;EACD"}
1
+ {"version":3,"file":"validateMarkdown.cjs","names":["validateHTML"],"sources":["../../../../src/transpiler/markdown/validateMarkdown.ts"],"sourcesContent":["import { type HTMLValidationIssue, validateHTML } from '../html/validateHTML';\n\nexport type { HTMLValidationIssue as MarkdownValidationIssue } from '../html/validateHTML';\n\nexport type MarkdownValidationResult = {\n valid: boolean;\n issues: HTMLValidationIssue[];\n};\n\n/**\n * Strips fenced code blocks and inline code from markdown content so that\n * HTML-like syntax inside code is not mistakenly validated.\n */\nconst stripCode = (content: string): string => {\n const lines = content.split('\\n');\n const result: string[] = [];\n let inCodeBlock = false;\n let openFence: string | null = null;\n\n for (const line of lines) {\n // Allow leading whitespace and blockquote markers before the fence characters\n const fence = line.match(/^[\\s>]*(`{3,}|~{3,})/);\n if (!inCodeBlock) {\n if (fence?.[1]) {\n inCodeBlock = true;\n openFence = fence[1];\n result.push('');\n } else {\n // Also strip inline code spans on this line. Code spans may be\n // delimited by a run of one or more backticks and end with a matching\n // run of the same length (CommonMark), allowing shorter backtick runs\n // inside (e.g. `` t`Hello ${name}` ``).\n result.push(\n line.replace(/(`+)(?:(?!\\1).)+?\\1/g, (m) => ' '.repeat(m.length))\n );\n }\n } else {\n if (\n fence?.[1]?.[0] &&\n fence[1][0] === openFence![0] &&\n fence[1].length >= openFence!.length\n ) {\n inCodeBlock = false;\n openFence = null;\n }\n result.push('');\n }\n }\n\n return result.join('\\n');\n};\n\nconst validateCodeBlocks = (content: string): HTMLValidationIssue[] => {\n const issues: HTMLValidationIssue[] = [];\n const lines = content.split('\\n');\n let inCodeBlock = false;\n let openFence: string | null = null;\n let openLineNumber = -1;\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n // Allow leading whitespace and blockquote markers before the fence characters\n const fence = line?.match(/^[\\s>]*(`{3,}|~{3,})/);\n\n if (!inCodeBlock) {\n if (fence?.[1]) {\n inCodeBlock = true;\n openFence = fence[1];\n openLineNumber = i + 1;\n }\n } else {\n if (\n fence?.[1] &&\n fence[1][0] === openFence![0] &&\n fence[1].length >= openFence!.length\n ) {\n inCodeBlock = false;\n openFence = null;\n }\n }\n }\n\n if (inCodeBlock) {\n issues.push({\n type: 'error',\n message: `Unclosed code block (opened at line ${openLineNumber})`,\n });\n }\n\n return issues;\n};\n\n/**\n * Validates markdown content for structural correctness:\n * - All fenced code blocks are properly closed\n * - HTML tags are properly nested and closed\n *\n * HTML inside code blocks is excluded from HTML validation.\n */\nexport const validateMarkdown = (content: string): MarkdownValidationResult => {\n const codeIssues = validateCodeBlocks(content);\n const htmlIssues = validateHTML(stripCode(content)).issues;\n const issues = [...codeIssues, ...htmlIssues];\n\n return {\n valid: issues.filter((i) => i.type === 'error').length === 0,\n issues,\n };\n};\n"],"mappings":";;;;;;;;AAaA,MAAM,aAAa,YAA4B;CAC7C,MAAM,QAAQ,QAAQ,MAAM,IAAI;CAChC,MAAM,SAAmB,CAAC;CAC1B,IAAI,cAAc;CAClB,IAAI,YAA2B;CAE/B,KAAK,MAAM,QAAQ,OAAO;EAExB,MAAM,QAAQ,KAAK,MAAM,sBAAsB;EAC/C,IAAI,CAAC,aACH,IAAI,QAAQ,IAAI;GACd,cAAc;GACd,YAAY,MAAM;GAClB,OAAO,KAAK,EAAE;EAChB,OAKE,OAAO,KACL,KAAK,QAAQ,yBAAyB,MAAM,IAAI,OAAO,EAAE,MAAM,CAAC,CAClE;OAEG;GACL,IACE,QAAQ,EAAE,GAAG,MACb,MAAM,EAAE,CAAC,OAAO,UAAW,MAC3B,MAAM,EAAE,CAAC,UAAU,UAAW,QAC9B;IACA,cAAc;IACd,YAAY;GACd;GACA,OAAO,KAAK,EAAE;EAChB;CACF;CAEA,OAAO,OAAO,KAAK,IAAI;AACzB;AAEA,MAAM,sBAAsB,YAA2C;CACrE,MAAM,SAAgC,CAAC;CACvC,MAAM,QAAQ,QAAQ,MAAM,IAAI;CAChC,IAAI,cAAc;CAClB,IAAI,YAA2B;CAC/B,IAAI,iBAAiB;CAErB,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EAGrC,MAAM,QAFO,MAAM,EAED,EAAE,MAAM,sBAAsB;EAEhD,IAAI,CAAC,aACH;OAAI,QAAQ,IAAI;IACd,cAAc;IACd,YAAY,MAAM;IAClB,iBAAiB,IAAI;GACvB;SAEA,IACE,QAAQ,MACR,MAAM,EAAE,CAAC,OAAO,UAAW,MAC3B,MAAM,EAAE,CAAC,UAAU,UAAW,QAC9B;GACA,cAAc;GACd,YAAY;EACd;CAEJ;CAEA,IAAI,aACF,OAAO,KAAK;EACV,MAAM;EACN,SAAS,uCAAuC,eAAe;CACjE,CAAC;CAGH,OAAO;AACT;;;;;;;;AASA,MAAa,oBAAoB,YAA8C;CAC7E,MAAM,aAAa,mBAAmB,OAAO;CAC7C,MAAM,aAAaA,kDAAa,UAAU,OAAO,CAAC,CAAC,CAAC;CACpD,MAAM,SAAS,CAAC,GAAG,YAAY,GAAG,UAAU;CAE5C,OAAO;EACL,OAAO,OAAO,QAAQ,MAAM,EAAE,SAAS,OAAO,CAAC,CAAC,WAAW;EAC3D;CACF;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
 
5
4
  //#region src/transpiler/nesting/nesting.ts
@@ -1 +1 @@
1
- {"version":3,"file":"nesting.cjs","names":["NESTED"],"sources":["../../../../src/transpiler/nesting/nesting.ts"],"sourcesContent":["import type {\n DictionaryKeys,\n DictionaryRegistryContent,\n} from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, NESTED } from '@intlayer/types/nodeType';\n\nimport type { DeepTransformContent } from '../../interpreter';\n\n/**\n * Recursively builds dot-notation strings for all valid paths in T.\n * Example:\n * type X = { a: { b: { c: string }}, d: number };\n * DotPath<X> = \"a\" | \"a.b\" | \"a.b.c\" | \"d\"\n */\nexport type DotPath<T> = T extends object\n ? {\n [K in keyof T & (string | number)]: T[K] extends object\n ? // Either just K, or K + '.' + deeper path\n `${K}` | `${K}.${DotPath<T[K]>}`\n : `${K}`;\n }[keyof T & (string | number)]\n : never;\n\ntype DeepReplace<T, From, To> = T extends From\n ? To\n : T extends object\n ? { [K in keyof T]: DeepReplace<T[K], From, To> }\n : T;\n\n/** Build all valid dot-notation strings for a dictionary entry. */\nexport type ValidDotPathsFor<K extends DictionaryKeys> = DotPath<\n DeepReplace<\n DeepTransformContent<DictionaryRegistryContent<K>>,\n // Replace ReactElement type with string\n {\n type: any;\n props: any;\n key: any;\n },\n string\n >\n>;\n\nexport type NestedContentState<K extends DictionaryKeys> = {\n dictionaryKey: K;\n\n /**\n * Path must match existing keys in DictionaryRegistryContent<K>.\n * Can be either:\n * - \"dot.dot.dot\" format\n */\n path?: ValidDotPathsFor<K>;\n};\n\nexport type NestedContent<K extends DictionaryKeys = never> = TypedNodeModel<\n typeof NESTED,\n NestedContentState<K>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to extract the content of another dictionary and nest it in the current dictionary.\n *\n * Usage:\n *\n * ```ts\n * nest(\"dictionaryKey\");\n * nest(\"dictionaryKey\", \"path.to.content\");\n * ```\n *\n * The order of the keys will define the priority of the content.\n *\n */\nconst nesting = <K extends DictionaryKeys>(\n dictionaryKey: K,\n path?: ValidDotPathsFor<K>\n): NestedContent<K> =>\n formatNodeType(NESTED, {\n dictionaryKey,\n path,\n });\n\nexport { nesting as nest };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2EA,MAAM,WACJ,eACA,sDAEeA,iCAAQ;CACrB;CACA;CACD,CAAC"}
1
+ {"version":3,"file":"nesting.cjs","names":["NESTED"],"sources":["../../../../src/transpiler/nesting/nesting.ts"],"sourcesContent":["import type {\n DictionaryKeys,\n DictionaryRegistryContent,\n} from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, NESTED } from '@intlayer/types/nodeType';\n\nimport type { DeepTransformContent } from '../../interpreter';\n\n/**\n * Recursively builds dot-notation strings for all valid paths in T.\n * Example:\n * type X = { a: { b: { c: string }}, d: number };\n * DotPath<X> = \"a\" | \"a.b\" | \"a.b.c\" | \"d\"\n */\nexport type DotPath<T> = T extends object\n ? {\n [K in keyof T & (string | number)]: T[K] extends object\n ? // Either just K, or K + '.' + deeper path\n `${K}` | `${K}.${DotPath<T[K]>}`\n : `${K}`;\n }[keyof T & (string | number)]\n : never;\n\ntype DeepReplace<T, From, To> = T extends From\n ? To\n : T extends object\n ? { [K in keyof T]: DeepReplace<T[K], From, To> }\n : T;\n\n/** Build all valid dot-notation strings for a dictionary entry. */\nexport type ValidDotPathsFor<K extends DictionaryKeys> = DotPath<\n DeepReplace<\n DeepTransformContent<DictionaryRegistryContent<K>>,\n // Replace ReactElement type with string\n {\n type: any;\n props: any;\n key: any;\n },\n string\n >\n>;\n\nexport type NestedContentState<K extends DictionaryKeys> = {\n dictionaryKey: K;\n\n /**\n * Path must match existing keys in DictionaryRegistryContent<K>.\n * Can be either:\n * - \"dot.dot.dot\" format\n */\n path?: ValidDotPathsFor<K>;\n};\n\nexport type NestedContent<K extends DictionaryKeys = never> = TypedNodeModel<\n typeof NESTED,\n NestedContentState<K>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to extract the content of another dictionary and nest it in the current dictionary.\n *\n * Usage:\n *\n * ```ts\n * nest(\"dictionaryKey\");\n * nest(\"dictionaryKey\", \"path.to.content\");\n * ```\n *\n * The order of the keys will define the priority of the content.\n *\n */\nconst nesting = <K extends DictionaryKeys>(\n dictionaryKey: K,\n path?: ValidDotPathsFor<K>\n): NestedContent<K> =>\n formatNodeType(NESTED, {\n dictionaryKey,\n path,\n });\n\nexport { nesting as nest };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2EA,MAAM,WACJ,eACA,sDAEeA,iCAAQ;CACrB;CACA;AACF,CAAC"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
 
5
4
  //#region src/transpiler/plural/plural.ts
@@ -1 +1 @@
1
- {"version":3,"file":"plural.cjs","names":["PLURAL"],"sources":["../../../../src/transpiler/plural/plural.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, PLURAL } from '@intlayer/types/nodeType';\n\nexport type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';\n\nexport type PluralContentState<Content> = Partial<\n Record<PluralCategory, Content>\n> & {\n other: Content;\n};\n\nexport type PluralContent<Content = unknown> = TypedNodeModel<\n typeof PLURAL,\n PluralContentState<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 using CLDR pluralization rules\n * (`Intl.PluralRules`). The selected category depends on the active locale.\n *\n * Supported categories: `zero`, `one`, `two`, `few`, `many`, `other`.\n * `other` is required as the fallback.\n *\n * The string content can include a `{{count}}` placeholder, which is\n * automatically replaced with the provided count.\n *\n * Usage:\n *\n * ```ts\n * plural({\n * one: '{{count}} вакансия',\n * few: '{{count}} вакансии',\n * many: '{{count}} вакансий',\n * other: '{{count}} вакансий',\n * });\n * ```\n */\nconst plural = <Content = unknown>(\n content: PluralContentState<Content>\n): PluralContent<Content> => formatNodeType(PLURAL, content);\n\nexport { plural };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,UACJ,yDAC0CA,iCAAQ,QAAQ"}
1
+ {"version":3,"file":"plural.cjs","names":["PLURAL"],"sources":["../../../../src/transpiler/plural/plural.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, PLURAL } from '@intlayer/types/nodeType';\n\nexport type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';\n\nexport type PluralContentState<Content> = Partial<\n Record<PluralCategory, Content>\n> & {\n other: Content;\n};\n\nexport type PluralContent<Content = unknown> = TypedNodeModel<\n typeof PLURAL,\n PluralContentState<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 using CLDR pluralization rules\n * (`Intl.PluralRules`). The selected category depends on the active locale.\n *\n * Supported categories: `zero`, `one`, `two`, `few`, `many`, `other`.\n * `other` is required as the fallback.\n *\n * The string content can include a `{{count}}` placeholder, which is\n * automatically replaced with the provided count.\n *\n * Usage:\n *\n * ```ts\n * plural({\n * one: '{{count}} вакансия',\n * few: '{{count}} вакансии',\n * many: '{{count}} вакансий',\n * other: '{{count}} вакансий',\n * });\n * ```\n */\nconst plural = <Content = unknown>(\n content: PluralContentState<Content>\n): PluralContent<Content> => formatNodeType(PLURAL, content);\n\nexport { plural };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,UACJ,yDAC0CA,iCAAQ,OAAO"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
 
5
4
  //#region src/transpiler/translation/translation.ts
@@ -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): 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
+ {"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,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkIsURLAbsolute.cjs","names":[],"sources":["../../../src/utils/checkIsURLAbsolute.ts"],"sourcesContent":["export const checkIsURLAbsolute = (url: string): boolean =>\n /^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(url);\n"],"mappings":";;;AAAA,MAAa,sBAAsB,QACjC,4BAA4B,KAAK,IAAI"}
1
+ {"version":3,"file":"checkIsURLAbsolute.cjs","names":[],"sources":["../../../src/utils/checkIsURLAbsolute.ts"],"sourcesContent":["export const checkIsURLAbsolute = (url: string): boolean =>\n /^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(url);\n"],"mappings":";;;AAAA,MAAa,sBAAsB,QACjC,4BAA4B,KAAK,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"cookieExpiry.cjs","names":[],"sources":["../../../src/utils/cookieExpiry.ts"],"sourcesContent":["import type { ProcessedCookieAttributes } from '@intlayer/types/config';\n\n/**\n * Resolves a normalized cookie `expires` value to an absolute timestamp\n * (epoch ms). The value is produced by the config-build merge step, so it is\n * already unambiguous:\n *\n * - `number` → seconds from now (relative lifetime);\n * - `string` → an absolute ISO date.\n *\n * Returns `undefined` when no usable expiry is provided so callers fall back\n * to a session cookie.\n *\n * @param expires - The normalized `expires` value from the built config.\n * @returns The absolute expiry in epoch milliseconds, or `undefined`.\n */\nexport const resolveExpiresToTimestamp = (\n expires: ProcessedCookieAttributes['expires']\n): number | undefined => {\n if (typeof expires === 'number') return Date.now() + expires * 1000;\n if (typeof expires === 'string') {\n const time = Date.parse(expires);\n return Number.isNaN(time) ? undefined : time;\n }\n return undefined;\n};\n\n/**\n * Serializes a cookie into a `document.cookie` string. Expiry is emitted as an\n * absolute `Expires=` attribute resolved from the normalized `expires` value.\n *\n * @param name - The cookie name.\n * @param value - The cookie value (URL-encoded by this helper).\n * @param attributes - The normalized cookie attributes.\n * @returns The serialized cookie string.\n */\nexport const buildCookieString = (\n name: string,\n value: string,\n attributes: ProcessedCookieAttributes\n): string => {\n const parts: string[] = [`${name}=${encodeURIComponent(value)}`];\n\n if (attributes.path) parts.push(`Path=${attributes.path}`);\n if (attributes.domain) parts.push(`Domain=${attributes.domain}`);\n const expiresTimestamp = resolveExpiresToTimestamp(attributes.expires);\n if (expiresTimestamp !== undefined)\n parts.push(`Expires=${new Date(expiresTimestamp).toUTCString()}`);\n if (attributes.secure) parts.push('Secure');\n if (attributes.sameSite) parts.push(`SameSite=${attributes.sameSite}`);\n return parts.join('; ');\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAa,6BACX,YACuB;AACvB,KAAI,OAAO,YAAY,SAAU,QAAO,KAAK,KAAK,GAAG,UAAU;AAC/D,KAAI,OAAO,YAAY,UAAU;EAC/B,MAAM,OAAO,KAAK,MAAM,QAAQ;AAChC,SAAO,OAAO,MAAM,KAAK,GAAG,SAAY;;;;;;;;;;;;AAc5C,MAAa,qBACX,MACA,OACA,eACW;CACX,MAAM,QAAkB,CAAC,GAAG,KAAK,GAAG,mBAAmB,MAAM,GAAG;AAEhE,KAAI,WAAW,KAAM,OAAM,KAAK,QAAQ,WAAW,OAAO;AAC1D,KAAI,WAAW,OAAQ,OAAM,KAAK,UAAU,WAAW,SAAS;CAChE,MAAM,mBAAmB,0BAA0B,WAAW,QAAQ;AACtE,KAAI,qBAAqB,OACvB,OAAM,KAAK,WAAW,IAAI,KAAK,iBAAiB,CAAC,aAAa,GAAG;AACnE,KAAI,WAAW,OAAQ,OAAM,KAAK,SAAS;AAC3C,KAAI,WAAW,SAAU,OAAM,KAAK,YAAY,WAAW,WAAW;AACtE,QAAO,MAAM,KAAK,KAAK"}
1
+ {"version":3,"file":"cookieExpiry.cjs","names":[],"sources":["../../../src/utils/cookieExpiry.ts"],"sourcesContent":["import type { ProcessedCookieAttributes } from '@intlayer/types/config';\n\n/**\n * Resolves a normalized cookie `expires` value to an absolute timestamp\n * (epoch ms). The value is produced by the config-build merge step, so it is\n * already unambiguous:\n *\n * - `number` → seconds from now (relative lifetime);\n * - `string` → an absolute ISO date.\n *\n * Returns `undefined` when no usable expiry is provided so callers fall back\n * to a session cookie.\n *\n * @param expires - The normalized `expires` value from the built config.\n * @returns The absolute expiry in epoch milliseconds, or `undefined`.\n */\nexport const resolveExpiresToTimestamp = (\n expires: ProcessedCookieAttributes['expires']\n): number | undefined => {\n if (typeof expires === 'number') return Date.now() + expires * 1000;\n if (typeof expires === 'string') {\n const time = Date.parse(expires);\n return Number.isNaN(time) ? undefined : time;\n }\n return undefined;\n};\n\n/**\n * Serializes a cookie into a `document.cookie` string. Expiry is emitted as an\n * absolute `Expires=` attribute resolved from the normalized `expires` value.\n *\n * @param name - The cookie name.\n * @param value - The cookie value (URL-encoded by this helper).\n * @param attributes - The normalized cookie attributes.\n * @returns The serialized cookie string.\n */\nexport const buildCookieString = (\n name: string,\n value: string,\n attributes: ProcessedCookieAttributes\n): string => {\n const parts: string[] = [`${name}=${encodeURIComponent(value)}`];\n\n if (attributes.path) parts.push(`Path=${attributes.path}`);\n if (attributes.domain) parts.push(`Domain=${attributes.domain}`);\n const expiresTimestamp = resolveExpiresToTimestamp(attributes.expires);\n if (expiresTimestamp !== undefined)\n parts.push(`Expires=${new Date(expiresTimestamp).toUTCString()}`);\n if (attributes.secure) parts.push('Secure');\n if (attributes.sameSite) parts.push(`SameSite=${attributes.sameSite}`);\n return parts.join('; ');\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAa,6BACX,YACuB;CACvB,IAAI,OAAO,YAAY,UAAU,OAAO,KAAK,IAAI,IAAI,UAAU;CAC/D,IAAI,OAAO,YAAY,UAAU;EAC/B,MAAM,OAAO,KAAK,MAAM,OAAO;EAC/B,OAAO,OAAO,MAAM,IAAI,IAAI,SAAY;CAC1C;AAEF;;;;;;;;;;AAWA,MAAa,qBACX,MACA,OACA,eACW;CACX,MAAM,QAAkB,CAAC,GAAG,KAAK,GAAG,mBAAmB,KAAK,GAAG;CAE/D,IAAI,WAAW,MAAM,MAAM,KAAK,QAAQ,WAAW,MAAM;CACzD,IAAI,WAAW,QAAQ,MAAM,KAAK,UAAU,WAAW,QAAQ;CAC/D,MAAM,mBAAmB,0BAA0B,WAAW,OAAO;CACrE,IAAI,qBAAqB,QACvB,MAAM,KAAK,WAAW,IAAI,KAAK,gBAAgB,CAAC,CAAC,YAAY,GAAG;CAClE,IAAI,WAAW,QAAQ,MAAM,KAAK,QAAQ;CAC1C,IAAI,WAAW,UAAU,MAAM,KAAK,YAAY,WAAW,UAAU;CACrE,OAAO,MAAM,KAAK,IAAI;AACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"getCookie.cjs","names":[],"sources":["../../../src/utils/getCookie.ts"],"sourcesContent":["/**\n * Retrieves a cookie by name from a cookie string or document.cookie\n * @param name - The name of the cookie to retrieve\n * @param cookieString - Optional cookie string to parse (defaults to document.cookie in browser)\n * @returns The cookie value or undefined if not found\n */\nexport const getCookie = (\n name: string,\n cookieString?: string\n): string | undefined => {\n try {\n const str =\n cookieString ?? (typeof document !== 'undefined' ? document.cookie : '');\n\n if (!str) return undefined;\n\n const pairs = str.split(';');\n\n for (let i = 0; i < pairs.length; i++) {\n const part = pairs[i].trim();\n\n if (!part) continue;\n\n const equalIndex = part.indexOf('=');\n const key = equalIndex >= 0 ? part.substring(0, equalIndex) : part;\n\n if (key === name) {\n const rawValue = equalIndex >= 0 ? part.substring(equalIndex + 1) : '';\n\n try {\n return decodeURIComponent(rawValue);\n } catch {\n return rawValue;\n }\n }\n }\n } catch {}\n return undefined;\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,aACX,MACA,iBACuB;AACvB,KAAI;EACF,MAAM,MACJ,iBAAiB,OAAO,aAAa,cAAc,SAAS,SAAS;AAEvE,MAAI,CAAC,IAAK,QAAO;EAEjB,MAAM,QAAQ,IAAI,MAAM,IAAI;AAE5B,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;GACrC,MAAM,OAAO,MAAM,GAAG,MAAM;AAE5B,OAAI,CAAC,KAAM;GAEX,MAAM,aAAa,KAAK,QAAQ,IAAI;AAGpC,QAFY,cAAc,IAAI,KAAK,UAAU,GAAG,WAAW,GAAG,UAElD,MAAM;IAChB,MAAM,WAAW,cAAc,IAAI,KAAK,UAAU,aAAa,EAAE,GAAG;AAEpE,QAAI;AACF,YAAO,mBAAmB,SAAS;YAC7B;AACN,YAAO;;;;SAIP"}
1
+ {"version":3,"file":"getCookie.cjs","names":[],"sources":["../../../src/utils/getCookie.ts"],"sourcesContent":["/**\n * Retrieves a cookie by name from a cookie string or document.cookie\n * @param name - The name of the cookie to retrieve\n * @param cookieString - Optional cookie string to parse (defaults to document.cookie in browser)\n * @returns The cookie value or undefined if not found\n */\nexport const getCookie = (\n name: string,\n cookieString?: string\n): string | undefined => {\n try {\n const str =\n cookieString ?? (typeof document !== 'undefined' ? document.cookie : '');\n\n if (!str) return undefined;\n\n const pairs = str.split(';');\n\n for (let i = 0; i < pairs.length; i++) {\n const part = pairs[i].trim();\n\n if (!part) continue;\n\n const equalIndex = part.indexOf('=');\n const key = equalIndex >= 0 ? part.substring(0, equalIndex) : part;\n\n if (key === name) {\n const rawValue = equalIndex >= 0 ? part.substring(equalIndex + 1) : '';\n\n try {\n return decodeURIComponent(rawValue);\n } catch {\n return rawValue;\n }\n }\n }\n } catch {}\n return undefined;\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,aACX,MACA,iBACuB;CACvB,IAAI;EACF,MAAM,MACJ,iBAAiB,OAAO,aAAa,cAAc,SAAS,SAAS;EAEvE,IAAI,CAAC,KAAK,OAAO;EAEjB,MAAM,QAAQ,IAAI,MAAM,GAAG;EAE3B,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;GACrC,MAAM,OAAO,MAAM,EAAE,CAAC,KAAK;GAE3B,IAAI,CAAC,MAAM;GAEX,MAAM,aAAa,KAAK,QAAQ,GAAG;GAGnC,KAFY,cAAc,IAAI,KAAK,UAAU,GAAG,UAAU,IAAI,UAElD,MAAM;IAChB,MAAM,WAAW,cAAc,IAAI,KAAK,UAAU,aAAa,CAAC,IAAI;IAEpE,IAAI;KACF,OAAO,mBAAmB,QAAQ;IACpC,QAAQ;KACN,OAAO;IACT;GACF;EACF;CACF,QAAQ,CAAC;AAEX"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_config_built = require("@intlayer/config/built");
4
3
 
5
4
  //#region src/utils/intl.ts
@@ -30,72 +29,148 @@ let _intlayer_config_built = require("@intlayer/config/built");
30
29
  */
31
30
  const MAX_CACHE_SIZE = 50;
32
31
  const cache = /* @__PURE__ */ new Map();
32
+ const alreadyWarnedConstructors = /* @__PURE__ */ new Set();
33
33
  /**
34
- * Generic caching instantiator for Intl constructors.
34
+ * Warns once per missing `Intl` constructor, in development only.
35
35
  */
36
- const getCachedIntl = (Ctor, locale, options) => {
36
+ const warnMissingIntlConstructor = (constructorName) => {
37
+ if (process.env.NODE_ENV === "production") return;
38
+ if (alreadyWarnedConstructors.has(constructorName)) return;
39
+ alreadyWarnedConstructors.add(constructorName);
40
+ console.warn(`[intlayer] \`Intl.${constructorName}\` is not available in this JavaScript engine. A degraded fallback is used instead. On React Native, load a polyfill (e.g. \`@formatjs/intl-${constructorName.toLowerCase()}/polyfill\`) before rendering your app.`);
41
+ };
42
+ /**
43
+ * Minimal stand-ins used when the engine ships without the matching `Intl`
44
+ * constructor. Hermes — the default React Native engine — omits
45
+ * `DisplayNames`, `ListFormat` and `Segmenter` in release builds unless the
46
+ * app opts into the full ICU build or loads a polyfill. Without these shims,
47
+ * `new Intl.DisplayNames(...)` throws
48
+ * `TypeError: undefined cannot be used as a constructor` and takes the whole
49
+ * app down at render time.
50
+ *
51
+ * Each shim mirrors only the surface Intlayer relies on, and returns the
52
+ * un-localized input so rendering degrades rather than crashing.
53
+ */
54
+ const intlConstructorFallbacks = {
55
+ DisplayNames: class DisplayNamesFallback {
56
+ /** Returns the requested code unchanged, since no CLDR data is available. */
57
+ of(code) {
58
+ return code;
59
+ }
60
+ },
61
+ ListFormat: class ListFormatFallback {
62
+ /** Joins the list with a comma, the most neutral separator available. */
63
+ format(list) {
64
+ return Array.from(list).join(", ");
65
+ }
66
+ /** Mirrors `Intl.ListFormat.prototype.formatToParts` shape. */
67
+ formatToParts(list) {
68
+ return Array.from(list).flatMap((value, index) => index === 0 ? [{
69
+ type: "element",
70
+ value
71
+ }] : [{
72
+ type: "literal",
73
+ value: ", "
74
+ }, {
75
+ type: "element",
76
+ value
77
+ }]);
78
+ }
79
+ },
80
+ Segmenter: class SegmenterFallback {
81
+ /** Segments by code point, the closest approximation without ICU data. */
82
+ segment(input) {
83
+ let index = 0;
84
+ return Array.from(input).map((segment) => {
85
+ const segmentStart = index;
86
+ index += segment.length;
87
+ return {
88
+ segment,
89
+ index: segmentStart
90
+ };
91
+ });
92
+ }
93
+ }
94
+ };
95
+ /**
96
+ * Resolves an `Intl` constructor by name at call time, falling back to a
97
+ * degraded shim when the engine does not provide it.
98
+ *
99
+ * Resolution is deliberately lazy: React Native apps install their polyfills
100
+ * at startup, which may run after this module is first imported.
101
+ */
102
+ const resolveIntlConstructor = (constructorName) => {
103
+ const nativeConstructor = Intl[constructorName];
104
+ if (typeof nativeConstructor === "function") return nativeConstructor;
105
+ warnMissingIntlConstructor(constructorName);
106
+ return intlConstructorFallbacks[constructorName];
107
+ };
108
+ function getCachedIntl(intlConstructor, locale, options) {
37
109
  const resLoc = locale ?? _intlayer_config_built.internationalization?.defaultLocale;
38
110
  const key = `${resLoc}|${options ? JSON.stringify(options) : ""}`;
39
- let ctorCache = cache.get(Ctor);
111
+ const cacheKey = intlConstructor;
112
+ let ctorCache = cache.get(cacheKey);
40
113
  if (!ctorCache) {
41
114
  ctorCache = /* @__PURE__ */ new Map();
42
- cache.set(Ctor, ctorCache);
115
+ cache.set(cacheKey, ctorCache);
43
116
  }
44
117
  let instance = ctorCache.get(key);
45
118
  if (!instance) {
119
+ const ResolvedConstructor = typeof intlConstructor === "string" ? resolveIntlConstructor(intlConstructor) : intlConstructor;
120
+ if (typeof ResolvedConstructor !== "function") throw new Error(`[intlayer] \`Intl.${String(intlConstructor)}\` is not available in this JavaScript engine and has no fallback. Load the matching polyfill before formatting.`);
46
121
  if (ctorCache.size > MAX_CACHE_SIZE) ctorCache.clear();
47
- instance = new Ctor(resLoc, options);
122
+ instance = new ResolvedConstructor(resLoc, options);
48
123
  ctorCache.set(key, instance);
49
124
  }
50
125
  return instance;
51
- };
126
+ }
52
127
  /**
53
128
  * Optional: Keep bindIntl if your library exports it publicly.
54
129
  * It now uses the much smaller getCachedIntl under the hood.
55
130
  */
56
131
  const bindIntl = (boundLocale) => {
57
- const bindWrap = (Ctor) => function intlConstructor(locales, options) {
132
+ const bindWrap = (constructorName) => function intlConstructor(locales, options) {
58
133
  const isOptsFirst = locales !== null && typeof locales === "object" && !Array.isArray(locales);
59
134
  const resOpts = isOptsFirst ? locales : options;
60
- return getCachedIntl(Ctor, isOptsFirst ? resOpts.locale || boundLocale : locales || boundLocale, resOpts);
135
+ return getCachedIntl(constructorName, isOptsFirst ? resOpts.locale || boundLocale : locales || boundLocale, resOpts);
61
136
  };
62
137
  return {
63
138
  ...Intl,
64
- Collator: bindWrap(Intl.Collator),
65
- DateTimeFormat: bindWrap(Intl.DateTimeFormat),
66
- DisplayNames: bindWrap(Intl.DisplayNames),
67
- ListFormat: bindWrap(Intl.ListFormat),
68
- NumberFormat: bindWrap(Intl.NumberFormat),
69
- PluralRules: bindWrap(Intl.PluralRules),
70
- RelativeTimeFormat: bindWrap(Intl.RelativeTimeFormat),
71
- Locale: bindWrap(Intl.Locale),
72
- Segmenter: bindWrap(Intl.Segmenter)
139
+ Collator: bindWrap("Collator"),
140
+ DateTimeFormat: bindWrap("DateTimeFormat"),
141
+ DisplayNames: bindWrap("DisplayNames"),
142
+ ListFormat: bindWrap("ListFormat"),
143
+ NumberFormat: bindWrap("NumberFormat"),
144
+ PluralRules: bindWrap("PluralRules"),
145
+ RelativeTimeFormat: bindWrap("RelativeTimeFormat"),
146
+ Locale: bindWrap("Locale"),
147
+ Segmenter: bindWrap("Segmenter")
73
148
  };
74
149
  };
75
150
  const CachedIntl = {
76
151
  Collator: function Collator(locales, options) {
77
- return getCachedIntl(Intl.Collator, locales, options);
152
+ return getCachedIntl("Collator", locales, options);
78
153
  },
79
154
  DateTimeFormat: function DateTimeFormat(locales, options) {
80
- return getCachedIntl(Intl.DateTimeFormat, locales, options);
155
+ return getCachedIntl("DateTimeFormat", locales, options);
81
156
  },
82
157
  DisplayNames: function DisplayNames(locales, options) {
83
- return getCachedIntl(Intl.DisplayNames, locales, options);
158
+ return getCachedIntl("DisplayNames", locales, options);
84
159
  },
85
160
  ListFormat: function ListFormat(locales, options) {
86
- return getCachedIntl(Intl.ListFormat, locales, options);
161
+ return getCachedIntl("ListFormat", locales, options);
87
162
  },
88
163
  NumberFormat: function NumberFormat(locales, options) {
89
- return getCachedIntl(Intl.NumberFormat, locales, options);
164
+ return getCachedIntl("NumberFormat", locales, options);
90
165
  },
91
166
  PluralRules: function PluralRules(locales, options) {
92
- return getCachedIntl(Intl.PluralRules, locales, options);
167
+ return getCachedIntl("PluralRules", locales, options);
93
168
  },
94
169
  RelativeTimeFormat: function RelativeTimeFormat(locales, options) {
95
- return getCachedIntl(Intl.RelativeTimeFormat, locales, options);
170
+ return getCachedIntl("RelativeTimeFormat", locales, options);
96
171
  },
97
172
  Segmenter: function Segmenter(locales, options) {
98
- return getCachedIntl(Intl.Segmenter, locales, options);
173
+ return getCachedIntl("Segmenter", locales, options);
99
174
  }
100
175
  };
101
176
 
@@ -1 +1 @@
1
- {"version":3,"file":"intl.cjs","names":["internationalization"],"sources":["../../../src/utils/intl.ts"],"sourcesContent":["/**\n * Cached Intl helper – drop‑in replacement for the global `Intl` object.\n * ‑‑‑\n * • Uses a `Proxy` to lazily wrap every *constructor* hanging off `Intl` (NumberFormat, DateTimeFormat, …).\n * • Each wrapped constructor keeps an in‑memory cache keyed by `[locales, options]` so that identical requests\n * reuse the same heavy instance instead of reparsing CLDR data every time.\n * • A polyfill warning for `Intl.DisplayNames` is emitted only once and only in dev.\n * • The public API is fully type‑safe and mirrors the native `Intl` surface exactly –\n * you can treat `CachedIntl` just like the built‑in `Intl`.\n *\n * Usage @example:\n * ---------------\n * ```ts\n * import { CachedIntl } from \"./cached-intl\";\n *\n * const nf = CachedIntl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n * console.log(nf.format(1234));\n *\n * const dn = CachedIntl.DisplayNames([\"fr\"], { type: \"language\" });\n * console.log(dn.of(\"en\")); * → \"anglais\"\n *\n * You can also spin up an isolated instance with its own caches (handy in test suites):\n * const TestIntl = createCachedIntl();\n * ```\n */\n\nimport { internationalization } from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nconst MAX_CACHE_SIZE = 50;\nconst cache = new Map<any, Map<string, any>>();\n\ntype IntlConstructors = {\n [K in keyof typeof Intl as (typeof Intl)[K] extends new (\n ...args: any\n ) => any\n ? K\n : never]: (typeof Intl)[K];\n};\n\ntype ReplaceLocaleWithLocalesValues<T> = T extends new (\n locales: any,\n options?: infer Options\n) => infer Instance\n ? {\n new (locales?: LocalesValues, options?: Options): Instance;\n new (options?: Options & { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues, options?: Options): Instance;\n (options?: Options & { locale?: LocalesValues }): Instance;\n }\n : T extends new (\n locales: any\n ) => infer Instance\n ? {\n new (locales?: LocalesValues): Instance;\n new (options?: { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues): Instance;\n (options?: { locale?: LocalesValues }): Instance;\n }\n : T;\n\nexport type WrappedIntl = {\n [K in keyof typeof Intl]: K extends keyof IntlConstructors\n ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]>\n : (typeof Intl)[K];\n};\n\n/**\n * Generic caching instantiator for Intl constructors.\n */\nexport const getCachedIntl = <T extends new (...args: any[]) => any>(\n Ctor: T,\n locale?: LocalesValues | string,\n options?: any\n): InstanceType<T> => {\n const resLoc = locale ?? internationalization?.defaultLocale;\n\n const optKey = options ? JSON.stringify(options) : '';\n const key = `${resLoc}|${optKey}`;\n\n let ctorCache = cache.get(Ctor);\n\n if (!ctorCache) {\n ctorCache = new Map();\n cache.set(Ctor, ctorCache);\n }\n\n let instance = ctorCache.get(key);\n\n if (!instance) {\n if (ctorCache.size > MAX_CACHE_SIZE) ctorCache.clear();\n instance = new Ctor(resLoc, options);\n ctorCache.set(key, instance);\n }\n return instance;\n};\n\n/**\n * Optional: Keep bindIntl if your library exports it publicly.\n * It now uses the much smaller getCachedIntl under the hood.\n */\nexport const bindIntl = (boundLocale: LocalesValues): WrappedIntl => {\n const bindWrap = (Ctor: any) =>\n // function is used as a constructor, do not change in arrow function\n function intlConstructor(locales?: any, options?: any) {\n const isOptsFirst =\n locales !== null &&\n typeof locales === 'object' &&\n !Array.isArray(locales);\n const resOpts = isOptsFirst ? locales : options;\n const resLoc = isOptsFirst\n ? (resOpts as any).locale || boundLocale\n : locales || boundLocale;\n\n return getCachedIntl(Ctor, resLoc, resOpts);\n };\n\n return {\n ...Intl,\n Collator: bindWrap(Intl.Collator),\n DateTimeFormat: bindWrap(Intl.DateTimeFormat),\n DisplayNames: bindWrap(Intl.DisplayNames),\n ListFormat: bindWrap(Intl.ListFormat),\n NumberFormat: bindWrap(Intl.NumberFormat),\n PluralRules: bindWrap(Intl.PluralRules),\n RelativeTimeFormat: bindWrap(Intl.RelativeTimeFormat),\n Locale: bindWrap(Intl.Locale),\n Segmenter: bindWrap((Intl as any).Segmenter),\n } as unknown as WrappedIntl;\n};\n\n// Add this to the bottom of utils/intl.ts ONLY if required for public API compatibility.\nexport const CachedIntl = {\n // function is used as a constructor, do not change in arrow function\n Collator: function Collator(locales?: any, options?: any) {\n return getCachedIntl(Intl.Collator, locales, options);\n },\n DateTimeFormat: function DateTimeFormat(locales?: any, options?: any) {\n return getCachedIntl(Intl.DateTimeFormat, locales, options);\n },\n DisplayNames: function DisplayNames(locales?: any, options?: any) {\n return getCachedIntl(Intl.DisplayNames, locales, options);\n },\n ListFormat: function ListFormat(locales?: any, options?: any) {\n return getCachedIntl(Intl.ListFormat as any, locales, options);\n },\n NumberFormat: function NumberFormat(locales?: any, options?: any) {\n return getCachedIntl(Intl.NumberFormat, locales, options);\n },\n PluralRules: function PluralRules(locales?: any, options?: any) {\n return getCachedIntl(Intl.PluralRules, locales, options);\n },\n RelativeTimeFormat: function RelativeTimeFormat(\n locales?: any,\n options?: any\n ) {\n return getCachedIntl(Intl.RelativeTimeFormat, locales, options);\n },\n Segmenter: function Segmenter(locales?: any, options?: any) {\n return getCachedIntl((Intl as any).Segmenter, locales, options);\n },\n} as any; // Cast to 'any' internally to avoid TS readonly errors\n\nexport { CachedIntl as Intl };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,iBAAiB;AACvB,MAAM,wBAAQ,IAAI,KAA4B;;;;AAwC9C,MAAa,iBACX,MACA,QACA,YACoB;CACpB,MAAM,SAAS,UAAUA,6CAAsB;CAG/C,MAAM,MAAM,GAAG,OAAO,GADP,UAAU,KAAK,UAAU,QAAQ,GAAG;CAGnD,IAAI,YAAY,MAAM,IAAI,KAAK;AAE/B,KAAI,CAAC,WAAW;AACd,8BAAY,IAAI,KAAK;AACrB,QAAM,IAAI,MAAM,UAAU;;CAG5B,IAAI,WAAW,UAAU,IAAI,IAAI;AAEjC,KAAI,CAAC,UAAU;AACb,MAAI,UAAU,OAAO,eAAgB,WAAU,OAAO;AACtD,aAAW,IAAI,KAAK,QAAQ,QAAQ;AACpC,YAAU,IAAI,KAAK,SAAS;;AAE9B,QAAO;;;;;;AAOT,MAAa,YAAY,gBAA4C;CACnE,MAAM,YAAY,SAEhB,SAAS,gBAAgB,SAAe,SAAe;EACrD,MAAM,cACJ,YAAY,QACZ,OAAO,YAAY,YACnB,CAAC,MAAM,QAAQ,QAAQ;EACzB,MAAM,UAAU,cAAc,UAAU;AAKxC,SAAO,cAAc,MAJN,cACV,QAAgB,UAAU,cAC3B,WAAW,aAEoB,QAAQ;;AAG/C,QAAO;EACL,GAAG;EACH,UAAU,SAAS,KAAK,SAAS;EACjC,gBAAgB,SAAS,KAAK,eAAe;EAC7C,cAAc,SAAS,KAAK,aAAa;EACzC,YAAY,SAAS,KAAK,WAAW;EACrC,cAAc,SAAS,KAAK,aAAa;EACzC,aAAa,SAAS,KAAK,YAAY;EACvC,oBAAoB,SAAS,KAAK,mBAAmB;EACrD,QAAQ,SAAS,KAAK,OAAO;EAC7B,WAAW,SAAU,KAAa,UAAU;EAC7C;;AAIH,MAAa,aAAa;CAExB,UAAU,SAAS,SAAS,SAAe,SAAe;AACxD,SAAO,cAAc,KAAK,UAAU,SAAS,QAAQ;;CAEvD,gBAAgB,SAAS,eAAe,SAAe,SAAe;AACpE,SAAO,cAAc,KAAK,gBAAgB,SAAS,QAAQ;;CAE7D,cAAc,SAAS,aAAa,SAAe,SAAe;AAChE,SAAO,cAAc,KAAK,cAAc,SAAS,QAAQ;;CAE3D,YAAY,SAAS,WAAW,SAAe,SAAe;AAC5D,SAAO,cAAc,KAAK,YAAmB,SAAS,QAAQ;;CAEhE,cAAc,SAAS,aAAa,SAAe,SAAe;AAChE,SAAO,cAAc,KAAK,cAAc,SAAS,QAAQ;;CAE3D,aAAa,SAAS,YAAY,SAAe,SAAe;AAC9D,SAAO,cAAc,KAAK,aAAa,SAAS,QAAQ;;CAE1D,oBAAoB,SAAS,mBAC3B,SACA,SACA;AACA,SAAO,cAAc,KAAK,oBAAoB,SAAS,QAAQ;;CAEjE,WAAW,SAAS,UAAU,SAAe,SAAe;AAC1D,SAAO,cAAe,KAAa,WAAW,SAAS,QAAQ;;CAElE"}
1
+ {"version":3,"file":"intl.cjs","names":["internationalization"],"sources":["../../../src/utils/intl.ts"],"sourcesContent":["/**\n * Cached Intl helper – drop‑in replacement for the global `Intl` object.\n * ‑‑‑\n * • Uses a `Proxy` to lazily wrap every *constructor* hanging off `Intl` (NumberFormat, DateTimeFormat, …).\n * • Each wrapped constructor keeps an in‑memory cache keyed by `[locales, options]` so that identical requests\n * reuse the same heavy instance instead of reparsing CLDR data every time.\n * • A polyfill warning for `Intl.DisplayNames` is emitted only once and only in dev.\n * • The public API is fully type‑safe and mirrors the native `Intl` surface exactly –\n * you can treat `CachedIntl` just like the built‑in `Intl`.\n *\n * Usage @example:\n * ---------------\n * ```ts\n * import { CachedIntl } from \"./cached-intl\";\n *\n * const nf = CachedIntl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n * console.log(nf.format(1234));\n *\n * const dn = CachedIntl.DisplayNames([\"fr\"], { type: \"language\" });\n * console.log(dn.of(\"en\")); * → \"anglais\"\n *\n * You can also spin up an isolated instance with its own caches (handy in test suites):\n * const TestIntl = createCachedIntl();\n * ```\n */\n\nimport { internationalization } from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nconst MAX_CACHE_SIZE = 50;\nconst cache = new Map<any, Map<string, any>>();\n\n/**\n * Minimal `Intl.ListFormat` surface, declared locally so consumers do not need\n * the `ES2021.Intl` lib in their tsconfig.\n */\ntype ListFormatInstance = {\n format(list: Iterable<string>): string;\n formatToParts(\n list: Iterable<string>\n ): { type: 'element' | 'literal'; value: string }[];\n};\n\n/**\n * Minimal `Intl.Segmenter` surface, declared locally so consumers do not need\n * the `ES2022.Intl` lib in their tsconfig.\n */\ntype SegmenterInstance = {\n segment(input: string): Iterable<{ segment: string; index: number }>;\n};\n\n/**\n * Instance type produced by each `Intl` constructor this module can build.\n */\ntype IntlInstanceByName = {\n Collator: Intl.Collator;\n DateTimeFormat: Intl.DateTimeFormat;\n DisplayNames: Intl.DisplayNames;\n ListFormat: ListFormatInstance;\n Locale: Intl.Locale;\n NumberFormat: Intl.NumberFormat;\n PluralRules: Intl.PluralRules;\n RelativeTimeFormat: Intl.RelativeTimeFormat;\n Segmenter: SegmenterInstance;\n};\n\n/**\n * Names of the `Intl` constructors this module knows how to instantiate.\n */\nexport type IntlConstructorName = keyof IntlInstanceByName;\n\nconst alreadyWarnedConstructors = new Set<string>();\n\n/**\n * Warns once per missing `Intl` constructor, in development only.\n */\nconst warnMissingIntlConstructor = (constructorName: string): void => {\n if (process.env.NODE_ENV === 'production') return;\n if (alreadyWarnedConstructors.has(constructorName)) return;\n\n alreadyWarnedConstructors.add(constructorName);\n\n console.warn(\n `[intlayer] \\`Intl.${constructorName}\\` is not available in this JavaScript engine. ` +\n `A degraded fallback is used instead. ` +\n `On React Native, load a polyfill (e.g. \\`@formatjs/intl-${constructorName.toLowerCase()}/polyfill\\`) before rendering your app.`\n );\n};\n\n/**\n * Minimal stand-ins used when the engine ships without the matching `Intl`\n * constructor. Hermes — the default React Native engine — omits\n * `DisplayNames`, `ListFormat` and `Segmenter` in release builds unless the\n * app opts into the full ICU build or loads a polyfill. Without these shims,\n * `new Intl.DisplayNames(...)` throws\n * `TypeError: undefined cannot be used as a constructor` and takes the whole\n * app down at render time.\n *\n * Each shim mirrors only the surface Intlayer relies on, and returns the\n * un-localized input so rendering degrades rather than crashing.\n */\nconst intlConstructorFallbacks: Partial<\n Record<IntlConstructorName, new (locale?: any, options?: any) => any>\n> = {\n DisplayNames: class DisplayNamesFallback {\n /** Returns the requested code unchanged, since no CLDR data is available. */\n public of(code: string): string {\n return code;\n }\n },\n ListFormat: class ListFormatFallback {\n /** Joins the list with a comma, the most neutral separator available. */\n public format(list: Iterable<string>): string {\n return Array.from(list).join(', ');\n }\n\n /** Mirrors `Intl.ListFormat.prototype.formatToParts` shape. */\n public formatToParts(\n list: Iterable<string>\n ): { type: 'element' | 'literal'; value: string }[] {\n return Array.from(list).flatMap((value, index) =>\n index === 0\n ? [{ type: 'element' as const, value }]\n : [\n { type: 'literal' as const, value: ', ' },\n { type: 'element' as const, value },\n ]\n );\n }\n },\n Segmenter: class SegmenterFallback {\n /** Segments by code point, the closest approximation without ICU data. */\n public segment(input: string): { segment: string; index: number }[] {\n let index = 0;\n\n return Array.from(input).map((segment) => {\n const segmentStart = index;\n index += segment.length;\n\n return { segment, index: segmentStart };\n });\n }\n },\n};\n\n/**\n * Resolves an `Intl` constructor by name at call time, falling back to a\n * degraded shim when the engine does not provide it.\n *\n * Resolution is deliberately lazy: React Native apps install their polyfills\n * at startup, which may run after this module is first imported.\n */\nconst resolveIntlConstructor = (\n constructorName: IntlConstructorName\n): (new (locale?: any, options?: any) => any) | undefined => {\n const nativeConstructor = (\n Intl as unknown as Record<string, new (...args: any[]) => any>\n )[constructorName];\n\n if (typeof nativeConstructor === 'function') return nativeConstructor;\n\n warnMissingIntlConstructor(constructorName);\n\n return intlConstructorFallbacks[constructorName];\n};\n\ntype IntlConstructors = {\n [K in keyof typeof Intl as (typeof Intl)[K] extends new (\n ...args: any\n ) => any\n ? K\n : never]: (typeof Intl)[K];\n};\n\ntype ReplaceLocaleWithLocalesValues<T> = T extends new (\n locales: any,\n options?: infer Options\n) => infer Instance\n ? {\n new (locales?: LocalesValues, options?: Options): Instance;\n new (options?: Options & { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues, options?: Options): Instance;\n (options?: Options & { locale?: LocalesValues }): Instance;\n }\n : T extends new (\n locales: any\n ) => infer Instance\n ? {\n new (locales?: LocalesValues): Instance;\n new (options?: { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues): Instance;\n (options?: { locale?: LocalesValues }): Instance;\n }\n : T;\n\nexport type WrappedIntl = {\n [K in keyof typeof Intl]: K extends keyof IntlConstructors\n ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]>\n : (typeof Intl)[K];\n};\n\n/**\n * Generic caching instantiator for Intl constructors.\n *\n * Prefer passing the constructor *name* (e.g. `'DisplayNames'`) rather than the\n * constructor itself: the name is resolved lazily against the global `Intl`, so\n * late-installed polyfills are picked up and missing constructors degrade to a\n * fallback instead of throwing.\n */\nexport function getCachedIntl<Name extends IntlConstructorName>(\n constructorName: Name,\n locale?: LocalesValues | string,\n options?: any\n): IntlInstanceByName[Name];\nexport function getCachedIntl<T extends new (...args: any[]) => any>(\n Ctor: T,\n locale?: LocalesValues | string,\n options?: any\n): InstanceType<T>;\nexport function getCachedIntl(\n intlConstructor: IntlConstructorName | (new (...args: any[]) => any),\n locale?: LocalesValues | string,\n options?: any\n): any {\n const resLoc = locale ?? internationalization?.defaultLocale;\n\n const optKey = options ? JSON.stringify(options) : '';\n const key = `${resLoc}|${optKey}`;\n\n // Cache per name when available, so two constructors that are both missing\n // from the engine do not collide on a single `undefined` cache bucket.\n const cacheKey = intlConstructor;\n\n let ctorCache = cache.get(cacheKey);\n\n if (!ctorCache) {\n ctorCache = new Map();\n cache.set(cacheKey, ctorCache);\n }\n\n let instance = ctorCache.get(key);\n\n if (!instance) {\n const ResolvedConstructor =\n typeof intlConstructor === 'string'\n ? resolveIntlConstructor(intlConstructor)\n : intlConstructor;\n\n if (typeof ResolvedConstructor !== 'function') {\n throw new Error(\n `[intlayer] \\`Intl.${String(intlConstructor)}\\` is not available in this JavaScript engine and has no fallback. ` +\n `Load the matching polyfill before formatting.`\n );\n }\n\n if (ctorCache.size > MAX_CACHE_SIZE) ctorCache.clear();\n instance = new ResolvedConstructor(resLoc, options);\n ctorCache.set(key, instance);\n }\n return instance;\n}\n\n/**\n * Optional: Keep bindIntl if your library exports it publicly.\n * It now uses the much smaller getCachedIntl under the hood.\n */\nexport const bindIntl = (boundLocale: LocalesValues): WrappedIntl => {\n const bindWrap = (constructorName: IntlConstructorName) =>\n // function is used as a constructor, do not change in arrow function\n function intlConstructor(locales?: any, options?: any) {\n const isOptsFirst =\n locales !== null &&\n typeof locales === 'object' &&\n !Array.isArray(locales);\n const resOpts = isOptsFirst ? locales : options;\n const resLoc = isOptsFirst\n ? (resOpts as any).locale || boundLocale\n : locales || boundLocale;\n\n return getCachedIntl(constructorName, resLoc, resOpts);\n };\n\n return {\n ...Intl,\n Collator: bindWrap('Collator'),\n DateTimeFormat: bindWrap('DateTimeFormat'),\n DisplayNames: bindWrap('DisplayNames'),\n ListFormat: bindWrap('ListFormat'),\n NumberFormat: bindWrap('NumberFormat'),\n PluralRules: bindWrap('PluralRules'),\n RelativeTimeFormat: bindWrap('RelativeTimeFormat'),\n Locale: bindWrap('Locale'),\n Segmenter: bindWrap('Segmenter'),\n } as unknown as WrappedIntl;\n};\n\n// Add this to the bottom of utils/intl.ts ONLY if required for public API compatibility.\nexport const CachedIntl = {\n // function is used as a constructor, do not change in arrow function\n Collator: function Collator(locales?: any, options?: any) {\n return getCachedIntl('Collator', locales, options);\n },\n DateTimeFormat: function DateTimeFormat(locales?: any, options?: any) {\n return getCachedIntl('DateTimeFormat', locales, options);\n },\n DisplayNames: function DisplayNames(locales?: any, options?: any) {\n return getCachedIntl('DisplayNames', locales, options);\n },\n ListFormat: function ListFormat(locales?: any, options?: any) {\n return getCachedIntl('ListFormat', locales, options);\n },\n NumberFormat: function NumberFormat(locales?: any, options?: any) {\n return getCachedIntl('NumberFormat', locales, options);\n },\n PluralRules: function PluralRules(locales?: any, options?: any) {\n return getCachedIntl('PluralRules', locales, options);\n },\n RelativeTimeFormat: function RelativeTimeFormat(\n locales?: any,\n options?: any\n ) {\n return getCachedIntl('RelativeTimeFormat', locales, options);\n },\n Segmenter: function Segmenter(locales?: any, options?: any) {\n return getCachedIntl('Segmenter', locales, options);\n },\n} as any; // Cast to 'any' internally to avoid TS readonly errors\n\nexport { CachedIntl as Intl };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,iBAAiB;AACvB,MAAM,wBAAQ,IAAI,IAA2B;AAyC7C,MAAM,4CAA4B,IAAI,IAAY;;;;AAKlD,MAAM,8BAA8B,oBAAkC;CACpE,IAAI,QAAQ,IAAI,aAAa,cAAc;CAC3C,IAAI,0BAA0B,IAAI,eAAe,GAAG;CAEpD,0BAA0B,IAAI,eAAe;CAE7C,QAAQ,KACN,qBAAqB,gBAAgB,8IAEwB,gBAAgB,YAAY,EAAE,wCAC7F;AACF;;;;;;;;;;;;;AAcA,MAAM,2BAEF;CACF,cAAc,MAAM,qBAAqB;;EAEvC,AAAO,GAAG,MAAsB;GAC9B,OAAO;EACT;CACF;CACA,YAAY,MAAM,mBAAmB;;EAEnC,AAAO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AS,OAAO;CACpD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"isSameKeyPath.cjs","names":[],"sources":["../../../src/utils/isSameKeyPath.ts"],"sourcesContent":["import type { KeyPath } from '@intlayer/types/keyPath';\n\ntype KeyPathWithKey = KeyPath & { key: string };\n\nexport const isSameKeyPath = (keyPath1: KeyPath[], keyPath2: KeyPath[]) =>\n keyPath1.every(\n (element, index) =>\n keyPath2[index] &&\n (keyPath2[index] as KeyPathWithKey).key ===\n (element as KeyPathWithKey).key &&\n keyPath2[index].type === element.type\n );\n"],"mappings":";;;AAIA,MAAa,iBAAiB,UAAqB,aACjD,SAAS,OACN,SAAS,UACR,SAAS,UACR,SAAS,OAA0B,QACjC,QAA2B,OAC9B,SAAS,OAAO,SAAS,QAAQ,KACpC"}
1
+ {"version":3,"file":"isSameKeyPath.cjs","names":[],"sources":["../../../src/utils/isSameKeyPath.ts"],"sourcesContent":["import type { KeyPath } from '@intlayer/types/keyPath';\n\ntype KeyPathWithKey = KeyPath & { key: string };\n\nexport const isSameKeyPath = (keyPath1: KeyPath[], keyPath2: KeyPath[]) =>\n keyPath1.every(\n (element, index) =>\n keyPath2[index] &&\n (keyPath2[index] as KeyPathWithKey).key ===\n (element as KeyPathWithKey).key &&\n keyPath2[index].type === element.type\n );\n"],"mappings":";;;AAIA,MAAa,iBAAiB,UAAqB,aACjD,SAAS,OACN,SAAS,UACR,SAAS,UACR,SAAS,MAAM,CAAoB,QACjC,QAA2B,OAC9B,SAAS,MAAM,CAAC,SAAS,QAAQ,IACrC"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_utils_cookieExpiry = require('./cookieExpiry.cjs');
4
3
  const require_utils_getCookie = require('./getCookie.cjs');
5
4
  let _intlayer_config_built = require("@intlayer/config/built");
@@ -1 +1 @@
1
- {"version":3,"file":"localeStorage.cjs","names":["internationalization","routing","resolveExpiresToTimestamp","buildCookieString","getCookie"],"sources":["../../../src/utils/localeStorage.ts"],"sourcesContent":["import { internationalization, routing } from '@intlayer/config/built';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { buildCookieString, resolveExpiresToTimestamp } from './cookieExpiry';\nimport { getCookie } from './getCookie';\n\n// ── Tree-shake constants ──────────────────────────────────────────────────────\n// When these env vars are injected at build time, bundlers eliminate the\n// branches guarded by these constants.\n\n/**\n * True when cookie storage is explicitly disabled at build time.\n */\nconst TREE_SHAKE_STORAGE_COOKIES =\n process.env.INTLAYER_ROUTING_STORAGE_COOKIES === 'false';\n\n/**\n * True when localStorage is explicitly disabled at build time.\n */\nconst TREE_SHAKE_STORAGE_LOCAL_STORAGE =\n process.env.INTLAYER_ROUTING_STORAGE_LOCALSTORAGE === 'false';\n\n/**\n * True when sessionStorage is explicitly disabled at build time.\n */\nconst TREE_SHAKE_STORAGE_SESSION_STORAGE =\n process.env.INTLAYER_ROUTING_STORAGE_SESSIONSTORAGE === 'false';\n\n/**\n * True when header storage is explicitly disabled at build time.\n */\nconst TREE_SHAKE_STORAGE_HEADERS =\n process.env.INTLAYER_ROUTING_STORAGE_HEADERS === 'false';\n\n// ============================================================================\n// Shared types\n// ============================================================================\n\nexport type CookieBuildAttributes = {\n domain?: string;\n path?: string;\n secure?: boolean;\n httpOnly?: boolean;\n sameSite?: 'strict' | 'lax' | 'none';\n /**\n * Absolute expiry as milliseconds since epoch, ready for `cookieStore.set()`.\n * Already resolved from the normalized `expires` by\n * `resolveExpiresToTimestamp`.\n */\n expires?: number | undefined;\n};\n\n// ============================================================================\n// Client-specific types and functions\n// (cookies via browser APIs, localStorage, sessionStorage — no headers)\n// ============================================================================\n\nexport type LocaleStorageClientOptions = {\n overwrite?: boolean;\n isCookieEnabled?: boolean;\n setCookieStore?: (\n name: string,\n value: string,\n cookie: CookieBuildAttributes\n ) => void;\n setCookieString?: (name: string, cookie: string) => void;\n getCookie?: (name: string) => string | undefined | null;\n setSessionStorage?: (name: string, value: string) => void;\n getSessionStorage?: (name: string) => string | undefined | null;\n setLocaleStorage?: (name: string, value: string) => void;\n getLocaleStorage?: (name: string) => string | undefined | null;\n};\n\n// cookieStore is part of the experimental Cookie Store API\ndeclare const cookieStore: any;\n\nexport const localeStorageOptions: LocaleStorageClientOptions = {\n getCookie: (name: string) =>\n document.cookie\n .split(';')\n .find((c) => c.trim().startsWith(`${name}=`))\n ?.split('=')[1],\n getLocaleStorage: (name: string) => localStorage.getItem(name),\n getSessionStorage: (name: string) => sessionStorage.getItem(name),\n isCookieEnabled: true,\n setCookieStore: (name, value, attributes) =>\n cookieStore.set({\n name,\n value,\n path: attributes.path,\n domain: attributes.domain,\n expires: attributes.expires,\n sameSite: attributes.sameSite,\n }),\n setCookieString: (_name, cookie) => {\n // biome-ignore lint/suspicious/noDocumentCookie: set cookie fallback\n document.cookie = cookie;\n },\n setSessionStorage: (name, value) => sessionStorage.setItem(name, value),\n setLocaleStorage: (name, value) => localStorage.setItem(name, value),\n};\n\n/**\n * Retrieves the locale from browser storage mechanisms\n * (cookies, localStorage, sessionStorage).\n * Does not read from headers — use `getLocaleFromStorageServer` for that.\n */\nexport const getLocaleFromStorageClient = (\n options: LocaleStorageClientOptions = localeStorageOptions\n): Locale | undefined => {\n const { locales } = internationalization;\n\n if (options?.isCookieEnabled === false) return undefined;\n\n const isValidLocale = (value: string | null | undefined): value is Locale =>\n !!value && locales.includes(value as Locale);\n\n if (!TREE_SHAKE_STORAGE_COOKIES) {\n for (let i = 0; i < (routing.storage.cookies ?? []).length; i++) {\n try {\n const value = options?.getCookie?.(routing.storage.cookies![i].name);\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_LOCAL_STORAGE) {\n for (let i = 0; i < (routing.storage.localStorage ?? []).length; i++) {\n try {\n const value = options?.getLocaleStorage?.(\n routing.storage.localStorage![i].name\n );\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_SESSION_STORAGE && routing.storage.sessionStorage) {\n for (let i = 0; i < routing.storage.sessionStorage.length; i++) {\n try {\n const value = options?.getSessionStorage?.(\n routing.storage.sessionStorage[i].name\n );\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n};\n\n/**\n * Stores the locale in browser storage mechanisms\n * (cookies, localStorage, sessionStorage).\n * Does not write to headers — use `setLocaleInStorageServer` for that.\n */\nexport const setLocaleInStorageClient = (\n locale: LocalesValues,\n options?: LocaleStorageClientOptions\n): void => {\n if (options?.isCookieEnabled === false) return;\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n const { name, attributes } = routing.storage.cookies[i];\n try {\n if (options?.setCookieStore) {\n options.setCookieStore(name, locale, {\n ...attributes,\n expires: resolveExpiresToTimestamp(attributes.expires),\n });\n }\n } catch {\n try {\n if (options?.setCookieString) {\n options.setCookieString(\n name,\n buildCookieString(name, locale, attributes)\n );\n }\n } catch {}\n }\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_LOCAL_STORAGE &&\n routing.storage.localStorage &&\n options?.setLocaleStorage\n ) {\n for (let i = 0; i < routing.storage.localStorage.length; i++) {\n const { name } = routing.storage.localStorage[i];\n try {\n if (!(options?.overwrite ?? true) && options?.getLocaleStorage) {\n if (options.getLocaleStorage(name)) continue;\n }\n options.setLocaleStorage(name, locale);\n } catch {}\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_SESSION_STORAGE &&\n routing.storage.sessionStorage &&\n options?.setSessionStorage\n ) {\n for (let i = 0; i < routing.storage.sessionStorage.length; i++) {\n const { name } = routing.storage.sessionStorage[i];\n try {\n if (!(options?.overwrite ?? true) && options?.getSessionStorage) {\n if (options.getSessionStorage(name)) continue;\n }\n options.setSessionStorage(name, locale);\n } catch {}\n }\n }\n};\n\n/**\n * Client-side locale storage utility.\n * Handles cookies (browser), localStorage and sessionStorage.\n * Does not access headers.\n *\n * @example\n * ```ts\n * const storage = LocaleStorageClient(localeStorageOptions);\n * const locale = storage.getLocale();\n * storage.setLocale('fr');\n * ```\n */\nexport const LocaleStorageClient = (options: LocaleStorageClientOptions) => ({\n getLocale: () => getLocaleFromStorageClient(options),\n setLocale: (locale: LocalesValues) =>\n setLocaleInStorageClient(locale, options),\n});\n\n// ============================================================================\n// Server-specific types and functions\n// (cookies via injected getter/setter, headers — no localStorage/sessionStorage)\n// ============================================================================\n\nexport type LocaleStorageServerOptions = {\n overwrite?: boolean;\n isCookieEnabled?: boolean;\n setCookieStore?: (\n name: string,\n value: string,\n cookie: CookieBuildAttributes\n ) => void;\n setCookieString?: (name: string, cookie: string) => void;\n getCookie?: (name: string) => string | undefined | null;\n getHeader?: (name: string) => string | undefined | null;\n setHeader?: (name: string, value: string) => void;\n};\n\n/**\n * Retrieves the locale from server-side storage mechanisms (cookies, headers).\n * Does not access localStorage or sessionStorage.\n * No browser cookie fallback — the caller must provide `getCookie`.\n */\nexport const getLocaleFromStorageServer = (\n options: LocaleStorageServerOptions\n): Locale | undefined => {\n const { locales } = internationalization;\n\n if (options?.isCookieEnabled === false) return undefined;\n\n const isValidLocale = (value: string | null | undefined): value is Locale =>\n !!value && locales.includes(value as Locale);\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n try {\n const value = options?.getCookie?.(routing.storage.cookies[i].name);\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_HEADERS && routing.storage.headers) {\n for (let i = 0; i < routing.storage.headers.length; i++) {\n try {\n const value = options?.getHeader?.(routing.storage.headers[i].name);\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n};\n\n/**\n * Stores the locale in server-side storage mechanisms (cookies, headers).\n * Does not write to localStorage or sessionStorage.\n */\nexport const setLocaleInStorageServer = (\n locale: LocalesValues,\n options?: LocaleStorageServerOptions\n): void => {\n if (options?.isCookieEnabled === false) return;\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n const { name, attributes } = routing.storage.cookies[i];\n\n try {\n if (options?.setCookieStore) {\n options.setCookieStore(name, locale, {\n ...attributes,\n expires: resolveExpiresToTimestamp(attributes.expires),\n });\n }\n } catch {\n try {\n if (options?.setCookieString) {\n options.setCookieString(\n name,\n buildCookieString(name, locale, attributes)\n );\n }\n } catch {}\n }\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_HEADERS &&\n routing.storage.headers &&\n options?.setHeader\n ) {\n for (let i = 0; i < routing.storage.headers.length; i++) {\n try {\n options.setHeader(routing.storage.headers[i].name, locale);\n } catch {}\n }\n }\n};\n\n/**\n * Server-side locale storage utility.\n * Handles cookies (via injected getter/setter) and headers.\n * Does not access localStorage or sessionStorage.\n *\n * @example\n * ```ts\n * const storage = LocaleStorageServer({\n * getCookie: (name) => req.cookies[name],\n * setCookieStore: (name, value, attrs) => res.cookie(name, value, attrs),\n * getHeader: (name) => req.headers[name],\n * setHeader: (name, value) => res.setHeader(name, value),\n * });\n * const locale = storage.getLocale();\n * storage.setLocale('fr');\n * ```\n */\nexport const LocaleStorageServer = (options: LocaleStorageServerOptions) => ({\n getLocale: () => getLocaleFromStorageServer(options),\n setLocale: (locale: LocalesValues) =>\n setLocaleInStorageServer(locale, options),\n});\n\n// ============================================================================\n// Deprecated: combined LocaleStorage\n// Use LocaleStorageClient or LocaleStorageServer instead\n// ============================================================================\n\n/**\n * @deprecated Use {@link LocaleStorageClientOptions} or {@link LocaleStorageServerOptions} instead.\n */\nexport type LocaleStorageOptions = LocaleStorageClientOptions &\n LocaleStorageServerOptions;\n\n/**\n * Retrieves the locale from all storage mechanisms\n * (cookies, localStorage, sessionStorage, headers).\n *\n * @deprecated Use {@link getLocaleFromStorageClient} (browser) or\n * {@link getLocaleFromStorageServer} (server) instead.\n */\nexport const getLocaleFromStorage = (\n options: Pick<\n LocaleStorageOptions,\n | 'getCookie'\n | 'getSessionStorage'\n | 'getLocaleStorage'\n | 'getHeader'\n | 'isCookieEnabled'\n >\n): Locale | undefined => {\n const { locales } = internationalization;\n\n if (options?.isCookieEnabled === false) return undefined;\n\n const isValidLocale = (value: string | null | undefined): value is Locale =>\n !!value && locales.includes(value as Locale);\n\n const readCookie = (name: string): string | undefined => {\n try {\n const fromOption = options?.getCookie?.(name);\n if (fromOption !== null && fromOption !== undefined) return fromOption;\n } catch {}\n // Browser fallback kept for backward compatibility\n return getCookie(name);\n };\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n const value = readCookie(routing.storage.cookies[i].name);\n if (isValidLocale(value)) return value;\n }\n }\n\n if (!TREE_SHAKE_STORAGE_LOCAL_STORAGE && routing.storage.localStorage) {\n for (let i = 0; i < routing.storage.localStorage.length; i++) {\n try {\n const value = options?.getLocaleStorage?.(\n routing.storage.localStorage[i].name\n );\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_SESSION_STORAGE && routing.storage.sessionStorage) {\n for (let i = 0; i < routing.storage.sessionStorage.length; i++) {\n try {\n const value = options?.getSessionStorage?.(\n routing.storage.sessionStorage[i].name\n );\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_HEADERS && routing.storage.headers) {\n for (let i = 0; i < routing.storage.headers.length; i++) {\n try {\n const value = options?.getHeader?.(routing.storage.headers[i].name);\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n};\n\n/**\n * Stores the locale in all configured storage mechanisms\n * (cookies, localStorage, sessionStorage, headers).\n *\n * @deprecated Use {@link setLocaleInStorageClient} (browser) or\n * {@link setLocaleInStorageServer} (server) instead.\n */\nexport const setLocaleInStorage = (\n locale: LocalesValues,\n options?: LocaleStorageOptions\n): void => {\n if (options?.isCookieEnabled === false) return;\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n const { name, attributes } = routing.storage.cookies[i];\n try {\n if (options?.setCookieStore) {\n options.setCookieStore(name, locale, {\n ...attributes,\n expires: resolveExpiresToTimestamp(attributes.expires),\n });\n }\n } catch {\n try {\n if (options?.setCookieString) {\n options.setCookieString(\n name,\n buildCookieString(name, locale, attributes)\n );\n }\n } catch {}\n }\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_LOCAL_STORAGE &&\n routing.storage.localStorage &&\n options?.setLocaleStorage\n ) {\n for (let i = 0; i < routing.storage.localStorage.length; i++) {\n const { name } = routing.storage.localStorage[i];\n try {\n if (!(options?.overwrite ?? true) && options?.getLocaleStorage) {\n if (options.getLocaleStorage(name)) continue;\n }\n options.setLocaleStorage(name, locale);\n } catch {}\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_SESSION_STORAGE &&\n routing.storage.sessionStorage &&\n options?.setSessionStorage\n ) {\n for (let i = 0; i < routing.storage.sessionStorage.length; i++) {\n const { name } = routing.storage.sessionStorage[i];\n try {\n if (!(options?.overwrite ?? true) && options?.getSessionStorage) {\n if (options.getSessionStorage(name)) continue;\n }\n options.setSessionStorage(name, locale);\n } catch {}\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_HEADERS &&\n routing.storage.headers &&\n options?.setHeader\n ) {\n for (let i = 0; i < routing.storage.headers.length; i++) {\n try {\n options.setHeader(routing.storage.headers[i].name, locale);\n } catch {}\n }\n }\n};\n\n/**\n * Utility object to get and set the locale in storage based on configuration.\n *\n * @deprecated Use {@link LocaleStorageClient} (browser) or\n * {@link LocaleStorageServer} (server) instead.\n */\nexport const LocaleStorage = (options: LocaleStorageOptions) => ({\n getLocale: () => getLocaleFromStorage(options),\n setLocale: (locale: LocalesValues) => setLocaleInStorage(locale, options),\n});\n"],"mappings":";;;;;;;;;;AAaA,MAAM,6BACJ,QAAQ,IAAI,qCAAqC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BAAQ,QAAQ,kBAChB,SAAS,kBAET,MAAK,IAAI,IAAI,GAAG,IAAIA,+BAAQ,QAAQ,eAAe,QAAQ,KAAK;EAC9D,MAAM,EAAE,SAASA,+BAAQ,QAAQ,eAAe;AAChD,MAAI;AACF,OAAI,EAAE,SAAS,aAAa,SAAS,SAAS,mBAC5C;QAAI,QAAQ,kBAAkB,KAAK,CAAE;;AAEvC,WAAQ,kBAAkB,MAAM,OAAO;UACjC;;AAIZ,KACE,CAAC,8BACDA,+BAAQ,QAAQ,WAChB,SAAS,UAET,MAAK,IAAI,IAAI,GAAG,IAAIA,+BAAQ,QAAQ,QAAQ,QAAQ,IAClD,KAAI;AACF,UAAQ,UAAUA,+BAAQ,QAAQ,QAAQ,GAAG,MAAM,OAAO;SACpD;;;;;;;;AAWd,MAAa,iBAAiB,aAAmC;CAC/D,iBAAiB,qBAAqB,QAAQ;CAC9C,YAAY,WAA0B,mBAAmB,QAAQ,QAAQ;CAC1E"}
1
+ {"version":3,"file":"localeStorage.cjs","names":["internationalization","routing","resolveExpiresToTimestamp","buildCookieString","getCookie"],"sources":["../../../src/utils/localeStorage.ts"],"sourcesContent":["import { internationalization, routing } from '@intlayer/config/built';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { buildCookieString, resolveExpiresToTimestamp } from './cookieExpiry';\nimport { getCookie } from './getCookie';\n\n// ── Tree-shake constants ──────────────────────────────────────────────────────\n// When these env vars are injected at build time, bundlers eliminate the\n// branches guarded by these constants.\n\n/**\n * True when cookie storage is explicitly disabled at build time.\n */\nconst TREE_SHAKE_STORAGE_COOKIES =\n process.env.INTLAYER_ROUTING_STORAGE_COOKIES === 'false';\n\n/**\n * True when localStorage is explicitly disabled at build time.\n */\nconst TREE_SHAKE_STORAGE_LOCAL_STORAGE =\n process.env.INTLAYER_ROUTING_STORAGE_LOCALSTORAGE === 'false';\n\n/**\n * True when sessionStorage is explicitly disabled at build time.\n */\nconst TREE_SHAKE_STORAGE_SESSION_STORAGE =\n process.env.INTLAYER_ROUTING_STORAGE_SESSIONSTORAGE === 'false';\n\n/**\n * True when header storage is explicitly disabled at build time.\n */\nconst TREE_SHAKE_STORAGE_HEADERS =\n process.env.INTLAYER_ROUTING_STORAGE_HEADERS === 'false';\n\n// ============================================================================\n// Shared types\n// ============================================================================\n\nexport type CookieBuildAttributes = {\n domain?: string;\n path?: string;\n secure?: boolean;\n httpOnly?: boolean;\n sameSite?: 'strict' | 'lax' | 'none';\n /**\n * Absolute expiry as milliseconds since epoch, ready for `cookieStore.set()`.\n * Already resolved from the normalized `expires` by\n * `resolveExpiresToTimestamp`.\n */\n expires?: number | undefined;\n};\n\n// ============================================================================\n// Client-specific types and functions\n// (cookies via browser APIs, localStorage, sessionStorage — no headers)\n// ============================================================================\n\nexport type LocaleStorageClientOptions = {\n overwrite?: boolean;\n isCookieEnabled?: boolean;\n setCookieStore?: (\n name: string,\n value: string,\n cookie: CookieBuildAttributes\n ) => void;\n setCookieString?: (name: string, cookie: string) => void;\n getCookie?: (name: string) => string | undefined | null;\n setSessionStorage?: (name: string, value: string) => void;\n getSessionStorage?: (name: string) => string | undefined | null;\n setLocaleStorage?: (name: string, value: string) => void;\n getLocaleStorage?: (name: string) => string | undefined | null;\n};\n\n// cookieStore is part of the experimental Cookie Store API\ndeclare const cookieStore: any;\n\nexport const localeStorageOptions: LocaleStorageClientOptions = {\n getCookie: (name: string) =>\n document.cookie\n .split(';')\n .find((c) => c.trim().startsWith(`${name}=`))\n ?.split('=')[1],\n getLocaleStorage: (name: string) => localStorage.getItem(name),\n getSessionStorage: (name: string) => sessionStorage.getItem(name),\n isCookieEnabled: true,\n setCookieStore: (name, value, attributes) =>\n cookieStore.set({\n name,\n value,\n path: attributes.path,\n domain: attributes.domain,\n expires: attributes.expires,\n sameSite: attributes.sameSite,\n }),\n setCookieString: (_name, cookie) => {\n // biome-ignore lint/suspicious/noDocumentCookie: set cookie fallback\n document.cookie = cookie;\n },\n setSessionStorage: (name, value) => sessionStorage.setItem(name, value),\n setLocaleStorage: (name, value) => localStorage.setItem(name, value),\n};\n\n/**\n * Retrieves the locale from browser storage mechanisms\n * (cookies, localStorage, sessionStorage).\n * Does not read from headers — use `getLocaleFromStorageServer` for that.\n */\nexport const getLocaleFromStorageClient = (\n options: LocaleStorageClientOptions = localeStorageOptions\n): Locale | undefined => {\n const { locales } = internationalization;\n\n if (options?.isCookieEnabled === false) return undefined;\n\n const isValidLocale = (value: string | null | undefined): value is Locale =>\n !!value && locales.includes(value as Locale);\n\n if (!TREE_SHAKE_STORAGE_COOKIES) {\n for (let i = 0; i < (routing.storage.cookies ?? []).length; i++) {\n try {\n const value = options?.getCookie?.(routing.storage.cookies![i].name);\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_LOCAL_STORAGE) {\n for (let i = 0; i < (routing.storage.localStorage ?? []).length; i++) {\n try {\n const value = options?.getLocaleStorage?.(\n routing.storage.localStorage![i].name\n );\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_SESSION_STORAGE && routing.storage.sessionStorage) {\n for (let i = 0; i < routing.storage.sessionStorage.length; i++) {\n try {\n const value = options?.getSessionStorage?.(\n routing.storage.sessionStorage[i].name\n );\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n};\n\n/**\n * Stores the locale in browser storage mechanisms\n * (cookies, localStorage, sessionStorage).\n * Does not write to headers — use `setLocaleInStorageServer` for that.\n */\nexport const setLocaleInStorageClient = (\n locale: LocalesValues,\n options?: LocaleStorageClientOptions\n): void => {\n if (options?.isCookieEnabled === false) return;\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n const { name, attributes } = routing.storage.cookies[i];\n try {\n if (options?.setCookieStore) {\n options.setCookieStore(name, locale, {\n ...attributes,\n expires: resolveExpiresToTimestamp(attributes.expires),\n });\n }\n } catch {\n try {\n if (options?.setCookieString) {\n options.setCookieString(\n name,\n buildCookieString(name, locale, attributes)\n );\n }\n } catch {}\n }\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_LOCAL_STORAGE &&\n routing.storage.localStorage &&\n options?.setLocaleStorage\n ) {\n for (let i = 0; i < routing.storage.localStorage.length; i++) {\n const { name } = routing.storage.localStorage[i];\n try {\n if (!(options?.overwrite ?? true) && options?.getLocaleStorage) {\n if (options.getLocaleStorage(name)) continue;\n }\n options.setLocaleStorage(name, locale);\n } catch {}\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_SESSION_STORAGE &&\n routing.storage.sessionStorage &&\n options?.setSessionStorage\n ) {\n for (let i = 0; i < routing.storage.sessionStorage.length; i++) {\n const { name } = routing.storage.sessionStorage[i];\n try {\n if (!(options?.overwrite ?? true) && options?.getSessionStorage) {\n if (options.getSessionStorage(name)) continue;\n }\n options.setSessionStorage(name, locale);\n } catch {}\n }\n }\n};\n\n/**\n * Client-side locale storage utility.\n * Handles cookies (browser), localStorage and sessionStorage.\n * Does not access headers.\n *\n * @example\n * ```ts\n * const storage = LocaleStorageClient(localeStorageOptions);\n * const locale = storage.getLocale();\n * storage.setLocale('fr');\n * ```\n */\nexport const LocaleStorageClient = (options: LocaleStorageClientOptions) => ({\n getLocale: () => getLocaleFromStorageClient(options),\n setLocale: (locale: LocalesValues) =>\n setLocaleInStorageClient(locale, options),\n});\n\n// ============================================================================\n// Server-specific types and functions\n// (cookies via injected getter/setter, headers — no localStorage/sessionStorage)\n// ============================================================================\n\nexport type LocaleStorageServerOptions = {\n overwrite?: boolean;\n isCookieEnabled?: boolean;\n setCookieStore?: (\n name: string,\n value: string,\n cookie: CookieBuildAttributes\n ) => void;\n setCookieString?: (name: string, cookie: string) => void;\n getCookie?: (name: string) => string | undefined | null;\n getHeader?: (name: string) => string | undefined | null;\n setHeader?: (name: string, value: string) => void;\n};\n\n/**\n * Retrieves the locale from server-side storage mechanisms (cookies, headers).\n * Does not access localStorage or sessionStorage.\n * No browser cookie fallback — the caller must provide `getCookie`.\n */\nexport const getLocaleFromStorageServer = (\n options: LocaleStorageServerOptions\n): Locale | undefined => {\n const { locales } = internationalization;\n\n if (options?.isCookieEnabled === false) return undefined;\n\n const isValidLocale = (value: string | null | undefined): value is Locale =>\n !!value && locales.includes(value as Locale);\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n try {\n const value = options?.getCookie?.(routing.storage.cookies[i].name);\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_HEADERS && routing.storage.headers) {\n for (let i = 0; i < routing.storage.headers.length; i++) {\n try {\n const value = options?.getHeader?.(routing.storage.headers[i].name);\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n};\n\n/**\n * Stores the locale in server-side storage mechanisms (cookies, headers).\n * Does not write to localStorage or sessionStorage.\n */\nexport const setLocaleInStorageServer = (\n locale: LocalesValues,\n options?: LocaleStorageServerOptions\n): void => {\n if (options?.isCookieEnabled === false) return;\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n const { name, attributes } = routing.storage.cookies[i];\n\n try {\n if (options?.setCookieStore) {\n options.setCookieStore(name, locale, {\n ...attributes,\n expires: resolveExpiresToTimestamp(attributes.expires),\n });\n }\n } catch {\n try {\n if (options?.setCookieString) {\n options.setCookieString(\n name,\n buildCookieString(name, locale, attributes)\n );\n }\n } catch {}\n }\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_HEADERS &&\n routing.storage.headers &&\n options?.setHeader\n ) {\n for (let i = 0; i < routing.storage.headers.length; i++) {\n try {\n options.setHeader(routing.storage.headers[i].name, locale);\n } catch {}\n }\n }\n};\n\n/**\n * Server-side locale storage utility.\n * Handles cookies (via injected getter/setter) and headers.\n * Does not access localStorage or sessionStorage.\n *\n * @example\n * ```ts\n * const storage = LocaleStorageServer({\n * getCookie: (name) => req.cookies[name],\n * setCookieStore: (name, value, attrs) => res.cookie(name, value, attrs),\n * getHeader: (name) => req.headers[name],\n * setHeader: (name, value) => res.setHeader(name, value),\n * });\n * const locale = storage.getLocale();\n * storage.setLocale('fr');\n * ```\n */\nexport const LocaleStorageServer = (options: LocaleStorageServerOptions) => ({\n getLocale: () => getLocaleFromStorageServer(options),\n setLocale: (locale: LocalesValues) =>\n setLocaleInStorageServer(locale, options),\n});\n\n// ============================================================================\n// Deprecated: combined LocaleStorage\n// Use LocaleStorageClient or LocaleStorageServer instead\n// ============================================================================\n\n/**\n * @deprecated Use {@link LocaleStorageClientOptions} or {@link LocaleStorageServerOptions} instead.\n */\nexport type LocaleStorageOptions = LocaleStorageClientOptions &\n LocaleStorageServerOptions;\n\n/**\n * Retrieves the locale from all storage mechanisms\n * (cookies, localStorage, sessionStorage, headers).\n *\n * @deprecated Use {@link getLocaleFromStorageClient} (browser) or\n * {@link getLocaleFromStorageServer} (server) instead.\n */\nexport const getLocaleFromStorage = (\n options: Pick<\n LocaleStorageOptions,\n | 'getCookie'\n | 'getSessionStorage'\n | 'getLocaleStorage'\n | 'getHeader'\n | 'isCookieEnabled'\n >\n): Locale | undefined => {\n const { locales } = internationalization;\n\n if (options?.isCookieEnabled === false) return undefined;\n\n const isValidLocale = (value: string | null | undefined): value is Locale =>\n !!value && locales.includes(value as Locale);\n\n const readCookie = (name: string): string | undefined => {\n try {\n const fromOption = options?.getCookie?.(name);\n if (fromOption !== null && fromOption !== undefined) return fromOption;\n } catch {}\n // Browser fallback kept for backward compatibility\n return getCookie(name);\n };\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n const value = readCookie(routing.storage.cookies[i].name);\n if (isValidLocale(value)) return value;\n }\n }\n\n if (!TREE_SHAKE_STORAGE_LOCAL_STORAGE && routing.storage.localStorage) {\n for (let i = 0; i < routing.storage.localStorage.length; i++) {\n try {\n const value = options?.getLocaleStorage?.(\n routing.storage.localStorage[i].name\n );\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_SESSION_STORAGE && routing.storage.sessionStorage) {\n for (let i = 0; i < routing.storage.sessionStorage.length; i++) {\n try {\n const value = options?.getSessionStorage?.(\n routing.storage.sessionStorage[i].name\n );\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n\n if (!TREE_SHAKE_STORAGE_HEADERS && routing.storage.headers) {\n for (let i = 0; i < routing.storage.headers.length; i++) {\n try {\n const value = options?.getHeader?.(routing.storage.headers[i].name);\n if (isValidLocale(value)) return value;\n } catch {}\n }\n }\n};\n\n/**\n * Stores the locale in all configured storage mechanisms\n * (cookies, localStorage, sessionStorage, headers).\n *\n * @deprecated Use {@link setLocaleInStorageClient} (browser) or\n * {@link setLocaleInStorageServer} (server) instead.\n */\nexport const setLocaleInStorage = (\n locale: LocalesValues,\n options?: LocaleStorageOptions\n): void => {\n if (options?.isCookieEnabled === false) return;\n\n if (!TREE_SHAKE_STORAGE_COOKIES && routing.storage.cookies) {\n for (let i = 0; i < routing.storage.cookies.length; i++) {\n const { name, attributes } = routing.storage.cookies[i];\n try {\n if (options?.setCookieStore) {\n options.setCookieStore(name, locale, {\n ...attributes,\n expires: resolveExpiresToTimestamp(attributes.expires),\n });\n }\n } catch {\n try {\n if (options?.setCookieString) {\n options.setCookieString(\n name,\n buildCookieString(name, locale, attributes)\n );\n }\n } catch {}\n }\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_LOCAL_STORAGE &&\n routing.storage.localStorage &&\n options?.setLocaleStorage\n ) {\n for (let i = 0; i < routing.storage.localStorage.length; i++) {\n const { name } = routing.storage.localStorage[i];\n try {\n if (!(options?.overwrite ?? true) && options?.getLocaleStorage) {\n if (options.getLocaleStorage(name)) continue;\n }\n options.setLocaleStorage(name, locale);\n } catch {}\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_SESSION_STORAGE &&\n routing.storage.sessionStorage &&\n options?.setSessionStorage\n ) {\n for (let i = 0; i < routing.storage.sessionStorage.length; i++) {\n const { name } = routing.storage.sessionStorage[i];\n try {\n if (!(options?.overwrite ?? true) && options?.getSessionStorage) {\n if (options.getSessionStorage(name)) continue;\n }\n options.setSessionStorage(name, locale);\n } catch {}\n }\n }\n\n if (\n !TREE_SHAKE_STORAGE_HEADERS &&\n routing.storage.headers &&\n options?.setHeader\n ) {\n for (let i = 0; i < routing.storage.headers.length; i++) {\n try {\n options.setHeader(routing.storage.headers[i].name, locale);\n } catch {}\n }\n }\n};\n\n/**\n * Utility object to get and set the locale in storage based on configuration.\n *\n * @deprecated Use {@link LocaleStorageClient} (browser) or\n * {@link LocaleStorageServer} (server) instead.\n */\nexport const LocaleStorage = (options: LocaleStorageOptions) => ({\n getLocale: () => getLocaleFromStorage(options),\n setLocale: (locale: LocalesValues) => setLocaleInStorage(locale, options),\n});\n"],"mappings":";;;;;;;;;AAaA,MAAM,6BACJ,QAAQ,IAAI,qCAAqC;;;;AAKnD,MAAM,mCACJ,QAAQ,IAAI,0CAA0C;;;;AAKxD,MAAM,qCACJ,QAAQ,IAAI,4CAA4C;;;;AAK1D,MAAM,6BACJ,QAAQ,IAAI,qCAAqC;AA4CnD,MAAa,uBAAmD;CAC9D,YAAY,SACV,SAAS,OACN,MAAM,GAAG,CAAC,CACV,MAAM,MAAM,EAAE,KAAK,CAAC,CAAC,WAAW,GAAG,KAAK,EAAE,CAAC,CAAC,EAC3C,MAAM,GAAG,CAAC,CAAC;CACjB,mBAAmB,SAAiB,aAAa,QAAQ,IAAI;CAC7D,oBAAoB,SAAiB,eAAe,QAAQ,IAAI;CAChE,iBAAiB;CACjB,iBAAiB,MAAM,OAAO,eAC5B,YAAY,IAAI;EACd;EACA;EACA,MAAM,WAAW;EACjB,QAAQ,WAAW;EACnB,SAAS,WAAW;EACpB,UAAU,WAAW;CACvB,CAAC;CACH,kBAAkB,OAAO,WAAW;EAElC,S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S,SAAS,mBAC5C;QAAI,QAAQ,kBAAkB,IAAI,GAAG;GAAQ;GAE/C,QAAQ,kBAAkB,MAAM,MAAM;EACxC,QAAQ,CAAC;CACX;CAGF,IACE,CAAC,8BACDA,+BAAQ,QAAQ,WAChB,SAAS,WAET,KAAK,IAAI,IAAI,GAAG,IAAIA,+BAAQ,QAAQ,QAAQ,QAAQ,KAClD,IAAI;EACF,QAAQ,UAAUA,+BAAQ,QAAQ,QAAQ,EAAE,CAAC,MAAM,MAAM;CAC3D,QAAQ,CAAC;AAGf;;;;;;;AAQA,MAAa,iBAAiB,aAAmC;CAC/D,iBAAiB,qBAAqB,OAAO;CAC7C,YAAY,WAA0B,mBAAmB,QAAQ,OAAO;AAC1E"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  //#region src/utils/parseYaml.ts
4
- const PRESERVED_LITERALS = new Set([
4
+ const PRESERVED_LITERALS = /* @__PURE__ */ new Set([
5
5
  "true",
6
6
  "false",
7
7
  "null",
@@ -1 +1 @@
1
- {"version":3,"file":"parseYaml.cjs","names":[],"sources":["../../../src/utils/parseYaml.ts"],"sourcesContent":["const PRESERVED_LITERALS = new Set([\n 'true',\n 'false',\n 'null',\n 'undefined',\n 'yes',\n 'no',\n 'on',\n 'off',\n 'NaN',\n 'Infinity',\n '-Infinity',\n]);\n\nexport interface YamlRecord {\n [key: string]: YamlValue;\n}\nexport type YamlValue = string | number | YamlValue[] | YamlRecord;\n\n/**\n * Parses a YAML/JSON-like string into a typed value.\n * Supports scalars, quoted strings, inline arrays/objects, and indented YAML syntax.\n * Boolean/null literals (true, false, null, yes, no, etc.) are preserved as strings,\n * not coerced to their native JS equivalents.\n */\nexport const parseYaml = <T = YamlValue>(input: string): T | null => {\n const text = input.trim();\n\n if (!text) return null;\n\n let index = 0;\n\n const peek = () => text[index] as string;\n const next = () => text[index++] as string;\n const eof = () => index >= text.length;\n\n const skipWhitespace = () => {\n while (!eof() && ' \\n\\t\\r'.includes(peek())) index++;\n };\n\n const parseQuotedString = (quote: '\"' | \"'\"): string => {\n next();\n let result = '';\n while (!eof()) {\n const ch = next();\n\n if (ch === quote) return result;\n\n if (ch === '\\\\' && !eof()) result += next();\n else result += ch;\n }\n throw new SyntaxError('Unterminated string');\n };\n\n const parseUnquotedToken = (stops: string): string => {\n const start = index;\n while (!eof() && !stops.includes(peek())) index++;\n return text.slice(start, index).trim();\n };\n\n const toTypedValue = (raw: string): string | number => {\n if (\n PRESERVED_LITERALS.has(raw) ||\n /^0x[0-9a-fA-F]+$/.test(raw) ||\n /^#/.test(raw)\n ) {\n return raw;\n }\n\n if (/^-?\\d+(?:\\.\\d+)?(?:e[+-]?\\d+)?$/i.test(raw)) {\n // 3.14159265359 is the common 11-digit truncation of PI; map it to the\n // full-precision constant so downstream consumers get exact equality.\n if (raw === '3.14159265359') return Math.PI;\n return Number(raw);\n }\n return raw;\n };\n\n const parseValue = (stops: string): YamlValue => {\n skipWhitespace();\n\n if (eof()) throw new SyntaxError('Unexpected end of input');\n const ch = peek();\n\n if (ch === '[') return parseArray();\n\n if (ch === '{') return parseObject();\n\n if (ch === '\"' || ch === \"'\") return parseQuotedString(ch as '\"' | \"'\");\n\n const token = parseUnquotedToken(stops);\n\n if (!token) throw new SyntaxError('Empty token');\n return toTypedValue(token);\n };\n\n const parseArray = (): YamlValue[] => {\n next();\n const arr: YamlValue[] = [];\n skipWhitespace();\n\n if (peek() === ']') {\n next();\n return arr;\n }\n while (true) {\n skipWhitespace();\n arr.push(parseValue(',]'));\n skipWhitespace();\n\n const ch = next();\n\n if (ch === ']') break;\n\n if (ch !== ',')\n throw new SyntaxError(\"Expected ',' or ']' after array element\");\n\n skipWhitespace();\n\n if (peek() === ']') throw new SyntaxError('Trailing comma in array');\n }\n return arr;\n };\n\n const parseYamlListItem = (): YamlValue => {\n const listIndent = getCurrentIndent();\n next();\n skipWhitespace();\n\n const ch = peek();\n\n if (ch === '{') return parseObject();\n\n if (ch === '\"' || ch === \"'\") return parseQuotedString(ch as '\"' | \"'\");\n\n const lineEnd = text.indexOf('\\n', index);\n const line = text.slice(index, lineEnd === -1 ? text.length : lineEnd);\n\n if (/:/.test(line)) {\n return parseIndentedObject(listIndent);\n }\n\n return toTypedValue(parseUnquotedToken('\\n'));\n };\n\n const getCurrentIndent = (): number => {\n const lineStart = text.lastIndexOf('\\n', index - 1) + 1;\n let indent = 0;\n for (let i = lineStart; i < index && text[i] === ' '; i++) indent++;\n return indent;\n };\n\n const parseIndentedObject = (baseIndent = getCurrentIndent()): YamlRecord => {\n const obj: YamlRecord = {};\n\n while (!eof()) {\n const lineStart = index;\n const startedNewLine = lineStart === 0 || text[lineStart - 1] === '\\n';\n skipWhitespace();\n\n const currentIndent = getCurrentIndent();\n\n if (startedNewLine && currentIndent <= baseIndent) {\n index = lineStart;\n break;\n }\n\n if (peek() === '-' || eof()) {\n index = lineStart;\n break;\n }\n\n const char = peek();\n const key =\n char === '\"' || char === \"'\"\n ? parseQuotedString(char as '\"' | \"'\")\n : parseUnquotedToken(':');\n\n if (eof() || next() !== ':') break;\n skipWhitespace();\n\n if (peek() === '\\n') {\n next();\n const afterNewlinePos = index;\n skipWhitespace();\n\n const childIndent = getCurrentIndent();\n\n if (peek() === '-') {\n obj[key] = parseYamlList();\n continue;\n } else if (childIndent > currentIndent) {\n const lineEnd = text.indexOf('\\n', index);\n const line = text.slice(\n index,\n lineEnd === -1 ? text.length : lineEnd\n );\n if (/:/.test(line)) {\n obj[key] = parseIndentedObject(currentIndent);\n continue;\n }\n }\n\n index = afterNewlinePos;\n obj[key] = '';\n continue;\n }\n\n obj[key] = toTypedValue(parseUnquotedToken('\\n'));\n\n if (peek() === '\\n') next();\n }\n return obj;\n };\n\n const parseYamlList = (): YamlValue[] => {\n const arr: YamlValue[] = [];\n const baseIndent = getCurrentIndent();\n\n while (!eof()) {\n while (!eof() && ' \\n\\t\\r'.includes(peek()) && peek() !== '-') next();\n\n if (eof() || getCurrentIndent() < baseIndent || peek() !== '-') break;\n arr.push(parseYamlListItem());\n }\n return arr;\n };\n\n const parseObjectBody = (stops: string): YamlRecord => {\n const obj: YamlRecord = {};\n skipWhitespace();\n\n while (!eof() && !stops.includes(peek())) {\n const char = peek();\n const key =\n char === '\"' || char === \"'\"\n ? parseQuotedString(char as '\"' | \"'\")\n : parseUnquotedToken(`:\\n${stops}`);\n\n if (!key) return obj;\n\n if (eof() || next() !== ':')\n throw new SyntaxError(\"Expected ':' after key\");\n\n if (peek() === ' ') next();\n while (!eof() && ' \\t'.includes(peek())) next();\n\n if (eof()) {\n obj[key] = '';\n return obj;\n }\n\n if (peek() === '\\n') {\n next();\n const afterNewlinePos = index;\n skipWhitespace();\n\n const childIndent = getCurrentIndent();\n\n if (peek() === '-') {\n obj[key] = parseYamlList();\n skipWhitespace();\n continue;\n } else if (stops === '' && childIndent > 0) {\n const lineEnd = text.indexOf('\\n', index);\n const line = text.slice(\n index,\n lineEnd === -1 ? text.length : lineEnd\n );\n if (/:/.test(line)) {\n obj[key] = parseIndentedObject(0);\n skipWhitespace();\n continue;\n }\n }\n\n index = afterNewlinePos;\n skipWhitespace();\n const nextChar = peek();\n obj[key] = '';\n if (nextChar && !stops.includes(nextChar) && nextChar !== '-') continue;\n return obj;\n }\n\n obj[key] = parseValue(stops.includes('}') ? `,\\n${stops}` : `\\n${stops}`);\n\n if (eof()) return obj;\n\n const sep = peek();\n\n if (sep === ',' || sep === '\\n') {\n next();\n skipWhitespace();\n continue;\n }\n\n if (' \\t'.includes(sep)) {\n while (!eof() && ' \\t'.includes(peek())) next();\n\n if (peek() === '\\n') {\n next();\n skipWhitespace();\n continue;\n }\n\n if (eof() || stops.includes(peek())) return obj;\n continue;\n }\n\n if (stops.includes(sep)) return obj;\n }\n return obj;\n };\n\n const parseObject = (): YamlRecord => {\n next();\n skipWhitespace();\n\n if (peek() === '}') {\n next();\n return {};\n }\n const obj = parseObjectBody('}');\n\n if (peek() !== '}') throw new SyntaxError(\"Expected '}' at end of object\");\n next();\n return obj;\n };\n\n const hasTopLevelKeyColonSpace = (s: string): boolean => {\n let depth = 0;\n let inQuote: '\"' | \"'\" | null = null;\n\n for (let i = 0; i < s.length; i++) {\n const char = s[i];\n\n if (inQuote) {\n if (char === '\\\\') i++;\n else if (char === inQuote) inQuote = null;\n } else {\n if (char === '\"' || char === \"'\") inQuote = char as '\"' | \"'\";\n else if (char === '[' || char === '{') depth++;\n else if (char === ']' || char === '}') depth = Math.max(0, depth - 1);\n else if (depth === 0 && char === ':') {\n const nextCh = s[i + 1];\n\n if (!nextCh || ' \\n'.includes(nextCh)) return true;\n }\n }\n }\n return false;\n };\n\n if (text.startsWith(']') || text.startsWith('}')) {\n throw new SyntaxError('Unexpected closing bracket');\n }\n\n const value: YamlValue = text.startsWith('[')\n ? parseArray()\n : text.startsWith('{')\n ? parseObject()\n : hasTopLevelKeyColonSpace(text)\n ? parseObjectBody('')\n : parseValue('');\n\n skipWhitespace();\n\n if (!eof()) throw new SyntaxError('Unexpected trailing characters');\n\n return value as T;\n};\n"],"mappings":";;;AAAA,MAAM,qBAAqB,IAAI,IAAI;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;;AAaF,MAAa,aAA4B,UAA4B;CACnE,MAAM,OAAO,MAAM,MAAM;AAEzB,KAAI,CAAC,KAAM,QAAO;CAElB,IAAI,QAAQ;CAEZ,MAAM,aAAa,KAAK;CACxB,MAAM,aAAa,KAAK;CACxB,MAAM,YAAY,SAAS,KAAK;CAEhC,MAAM,uBAAuB;AAC3B,SAAO,CAAC,KAAK,IAAI,SAAU,SAAS,MAAM,CAAC,CAAE;;CAG/C,MAAM,qBAAqB,UAA6B;AACtD,QAAM;EACN,IAAI,SAAS;AACb,SAAO,CAAC,KAAK,EAAE;GACb,MAAM,KAAK,MAAM;AAEjB,OAAI,OAAO,MAAO,QAAO;AAEzB,OAAI,OAAO,QAAQ,CAAC,KAAK,CAAE,WAAU,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B;AAEhC,OAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;GACjC,MAAM,OAAO,EAAE;AAEf,OAAI,SACF;QAAI,SAAS,KAAM;aACV,SAAS,QAAS,WAAU;cAEjC,SAAS,QAAO,SAAS,IAAK,WAAU;YACnC,SAAS,OAAO,SAAS,IAAK;YAC9B,SAAS,OAAO,SAAS,IAAK,SAAQ,KAAK,IAAI,GAAG,QAAQ,EAAE;YAC5D,UAAU,KAAK,SAAS,KAAK;IACpC,MAAM,SAAS,EAAE,IAAI;AAErB,QAAI,CAAC,UAAU,MAAM,SAAS,OAAO,CAAE,QAAO;;;AAIpD,SAAO;;AAGT,KAAI,KAAK,WAAW,IAAI,IAAI,KAAK,WAAW,IAAI,CAC9C,OAAM,IAAI,YAAY,6BAA6B;CAGrD,MAAM,QAAmB,KAAK,WAAW,IAAI,GACzC,YAAY,GACZ,KAAK,WAAW,IAAI,GAClB,aAAa,GACb,yBAAyB,KAAK,GAC5B,gBAAgB,GAAG,GACnB,WAAW,GAAG;AAEtB,iBAAgB;AAEhB,KAAI,CAAC,KAAK,CAAE,OAAM,IAAI,YAAY,iCAAiC;AAEnE,QAAO"}
1
+ {"version":3,"file":"parseYaml.cjs","names":[],"sources":["../../../src/utils/parseYaml.ts"],"sourcesContent":["const PRESERVED_LITERALS = new Set([\n 'true',\n 'false',\n 'null',\n 'undefined',\n 'yes',\n 'no',\n 'on',\n 'off',\n 'NaN',\n 'Infinity',\n '-Infinity',\n]);\n\nexport interface YamlRecord {\n [key: string]: YamlValue;\n}\nexport type YamlValue = string | number | YamlValue[] | YamlRecord;\n\n/**\n * Parses a YAML/JSON-like string into a typed value.\n * Supports scalars, quoted strings, inline arrays/objects, and indented YAML syntax.\n * Boolean/null literals (true, false, null, yes, no, etc.) are preserved as strings,\n * not coerced to their native JS equivalents.\n */\nexport const parseYaml = <T = YamlValue>(input: string): T | null => {\n const text = input.trim();\n\n if (!text) return null;\n\n let index = 0;\n\n const peek = () => text[index] as string;\n const next = () => text[index++] as string;\n const eof = () => index >= text.length;\n\n const skipWhitespace = () => {\n while (!eof() && ' \\n\\t\\r'.includes(peek())) index++;\n };\n\n const parseQuotedString = (quote: '\"' | \"'\"): string => {\n next();\n let result = '';\n while (!eof()) {\n const ch = next();\n\n if (ch === quote) return result;\n\n if (ch === '\\\\' && !eof()) result += next();\n else result += ch;\n }\n throw new SyntaxError('Unterminated string');\n };\n\n const parseUnquotedToken = (stops: string): string => {\n const start = index;\n while (!eof() && !stops.includes(peek())) index++;\n return text.slice(start, index).trim();\n };\n\n const toTypedValue = (raw: string): string | number => {\n if (\n PRESERVED_LITERALS.has(raw) ||\n /^0x[0-9a-fA-F]+$/.test(raw) ||\n /^#/.test(raw)\n ) {\n return raw;\n }\n\n if (/^-?\\d+(?:\\.\\d+)?(?:e[+-]?\\d+)?$/i.test(raw)) {\n // 3.14159265359 is the common 11-digit truncation of PI; map it to the\n // full-precision constant so downstream consumers get exact equality.\n if (raw === '3.14159265359') return Math.PI;\n return Number(raw);\n }\n return raw;\n };\n\n const parseValue = (stops: string): YamlValue => {\n skipWhitespace();\n\n if (eof()) throw new SyntaxError('Unexpected end of input');\n const ch = peek();\n\n if (ch === '[') return parseArray();\n\n if (ch === '{') return parseObject();\n\n if (ch === '\"' || ch === \"'\") return parseQuotedString(ch as '\"' | \"'\");\n\n const token = parseUnquotedToken(stops);\n\n if (!token) throw new SyntaxError('Empty token');\n return toTypedValue(token);\n };\n\n const parseArray = (): YamlValue[] => {\n next();\n const arr: YamlValue[] = [];\n skipWhitespace();\n\n if (peek() === ']') {\n next();\n return arr;\n }\n while (true) {\n skipWhitespace();\n arr.push(parseValue(',]'));\n skipWhitespace();\n\n const ch = next();\n\n if (ch === ']') break;\n\n if (ch !== ',')\n throw new SyntaxError(\"Expected ',' or ']' after array element\");\n\n skipWhitespace();\n\n if (peek() === ']') throw new SyntaxError('Trailing comma in array');\n }\n return arr;\n };\n\n const parseYamlListItem = (): YamlValue => {\n const listIndent = getCurrentIndent();\n next();\n skipWhitespace();\n\n const ch = peek();\n\n if (ch === '{') return parseObject();\n\n if (ch === '\"' || ch === \"'\") return parseQuotedString(ch as '\"' | \"'\");\n\n const lineEnd = text.indexOf('\\n', index);\n const line = text.slice(index, lineEnd === -1 ? text.length : lineEnd);\n\n if (/:/.test(line)) {\n return parseIndentedObject(listIndent);\n }\n\n return toTypedValue(parseUnquotedToken('\\n'));\n };\n\n const getCurrentIndent = (): number => {\n const lineStart = text.lastIndexOf('\\n', index - 1) + 1;\n let indent = 0;\n for (let i = lineStart; i < index && text[i] === ' '; i++) indent++;\n return indent;\n };\n\n const parseIndentedObject = (baseIndent = getCurrentIndent()): YamlRecord => {\n const obj: YamlRecord = {};\n\n while (!eof()) {\n const lineStart = index;\n const startedNewLine = lineStart === 0 || text[lineStart - 1] === '\\n';\n skipWhitespace();\n\n const currentIndent = getCurrentIndent();\n\n if (startedNewLine && currentIndent <= baseIndent) {\n index = lineStart;\n break;\n }\n\n if (peek() === '-' || eof()) {\n index = lineStart;\n break;\n }\n\n const char = peek();\n const key =\n char === '\"' || char === \"'\"\n ? parseQuotedString(char as '\"' | \"'\")\n : parseUnquotedToken(':');\n\n if (eof() || next() !== ':') break;\n skipWhitespace();\n\n if (peek() === '\\n') {\n next();\n const afterNewlinePos = index;\n skipWhitespace();\n\n const childIndent = getCurrentIndent();\n\n if (peek() === '-') {\n obj[key] = parseYamlList();\n continue;\n } else if (childIndent > currentIndent) {\n const lineEnd = text.indexOf('\\n', index);\n const line = text.slice(\n index,\n lineEnd === -1 ? text.length : lineEnd\n );\n if (/:/.test(line)) {\n obj[key] = parseIndentedObject(currentIndent);\n continue;\n }\n }\n\n index = afterNewlinePos;\n obj[key] = '';\n continue;\n }\n\n obj[key] = toTypedValue(parseUnquotedToken('\\n'));\n\n if (peek() === '\\n') next();\n }\n return obj;\n };\n\n const parseYamlList = (): YamlValue[] => {\n const arr: YamlValue[] = [];\n const baseIndent = getCurrentIndent();\n\n while (!eof()) {\n while (!eof() && ' \\n\\t\\r'.includes(peek()) && peek() !== '-') next();\n\n if (eof() || getCurrentIndent() < baseIndent || peek() !== '-') break;\n arr.push(parseYamlListItem());\n }\n return arr;\n };\n\n const parseObjectBody = (stops: string): YamlRecord => {\n const obj: YamlRecord = {};\n skipWhitespace();\n\n while (!eof() && !stops.includes(peek())) {\n const char = peek();\n const key =\n char === '\"' || char === \"'\"\n ? parseQuotedString(char as '\"' | \"'\")\n : parseUnquotedToken(`:\\n${stops}`);\n\n if (!key) return obj;\n\n if (eof() || next() !== ':')\n throw new SyntaxError(\"Expected ':' after key\");\n\n if (peek() === ' ') next();\n while (!eof() && ' \\t'.includes(peek())) next();\n\n if (eof()) {\n obj[key] = '';\n return obj;\n }\n\n if (peek() === '\\n') {\n next();\n const afterNewlinePos = index;\n skipWhitespace();\n\n const childIndent = getCurrentIndent();\n\n if (peek() === '-') {\n obj[key] = parseYamlList();\n skipWhitespace();\n continue;\n } else if (stops === '' && childIndent > 0) {\n const lineEnd = text.indexOf('\\n', index);\n const line = text.slice(\n index,\n lineEnd === -1 ? text.length : lineEnd\n );\n if (/:/.test(line)) {\n obj[key] = parseIndentedObject(0);\n skipWhitespace();\n continue;\n }\n }\n\n index = afterNewlinePos;\n skipWhitespace();\n const nextChar = peek();\n obj[key] = '';\n if (nextChar && !stops.includes(nextChar) && nextChar !== '-') continue;\n return obj;\n }\n\n obj[key] = parseValue(stops.includes('}') ? `,\\n${stops}` : `\\n${stops}`);\n\n if (eof()) return obj;\n\n const sep = peek();\n\n if (sep === ',' || sep === '\\n') {\n next();\n skipWhitespace();\n continue;\n }\n\n if (' \\t'.includes(sep)) {\n while (!eof() && ' \\t'.includes(peek())) next();\n\n if (peek() === '\\n') {\n next();\n skipWhitespace();\n continue;\n }\n\n if (eof() || stops.includes(peek())) return obj;\n continue;\n }\n\n if (stops.includes(sep)) return obj;\n }\n return obj;\n };\n\n const parseObject = (): YamlRecord => {\n next();\n skipWhitespace();\n\n if (peek() === '}') {\n next();\n return {};\n }\n const obj = parseObjectBody('}');\n\n if (peek() !== '}') throw new SyntaxError(\"Expected '}' at end of object\");\n next();\n return obj;\n };\n\n const hasTopLevelKeyColonSpace = (s: string): boolean => {\n let depth = 0;\n let inQuote: '\"' | \"'\" | null = null;\n\n for (let i = 0; i < s.length; i++) {\n const char = s[i];\n\n if (inQuote) {\n if (char === '\\\\') i++;\n else if (char === inQuote) inQuote = null;\n } else {\n if (char === '\"' || char === \"'\") inQuote = char as '\"' | \"'\";\n else if (char === '[' || char === '{') depth++;\n else if (char === ']' || char === '}') depth = Math.max(0, depth - 1);\n else if (depth === 0 && char === ':') {\n const nextCh = s[i + 1];\n\n if (!nextCh || ' \\n'.includes(nextCh)) return true;\n }\n }\n }\n return false;\n };\n\n if (text.startsWith(']') || text.startsWith('}')) {\n throw new SyntaxError('Unexpected closing bracket');\n }\n\n const value: YamlValue = text.startsWith('[')\n ? parseArray()\n : text.startsWith('{')\n ? parseObject()\n : hasTopLevelKeyColonSpace(text)\n ? parseObjectBody('')\n : parseValue('');\n\n skipWhitespace();\n\n if (!eof()) throw new SyntaxError('Unexpected trailing characters');\n\n return value as T;\n};\n"],"mappings":";;;AAAA,MAAM,qCAAqB,IAAI,IAAI;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;AAaD,MAAa,aAA4B,UAA4B;CACnE,MAAM,OAAO,MAAM,KAAK;CAExB,IAAI,CAAC,MAAM,OAAO;CAElB,IAAI,QAAQ;CAEZ,MAAM,aAAa,KAAK;CACxB,MAAM,aAAa,KAAK;CACxB,MAAM,YAAY,SAAS,KAAK;CAEhC,MAAM,uBAAuB;EAC3B,OAAO,CAAC,IAAI,KAAK,SAAU,SAAS,KAAK,CAAC,GAAG;CAC/C;CAEA,MAAM,qBAAqB,UAA6B;EACtD,KAAK;EACL,IAAI,SAAS;EACb,OAAO,CAAC,IAAI,GAAG;GACb,MAAM,KAAK,KAAK;GAEhB,IAAI,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AK,MAAM,KAAK,MAAM,IAAI,YAAY,+BAA+B;EACzE,KAAK;EACL,OAAO;CACT;CAEA,MAAM,4BAA4B,MAAuB;EACvD,IAAI,QAAQ;EACZ,IAAI,UAA4B;EAEhC,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;GACjC,MAAM,OAAO,EAAE;GAEf,IAAI,SACF;QAAI,SAAS,MAAM;SACd,IAAI,SAAS,SAAS,UAAU;GAAI,OAEzC,IAAI,SAAS,QAAO,SAAS,KAAK,UAAU;QACvC,IAAI,SAAS,OAAO,SAAS,KAAK;QAClC,IAAI,SAAS,OAAO,SAAS,KAAK,QAAQ,KAAK,IAAI,GAAG,QAAQ,CAAC;QAC/D,IAAI,UAAU,KAAK,SAAS,KAAK;IACpC,MAAM,SAAS,EAAE,IAAI;IAErB,IAAI,CAAC,UAAU,MAAM,SAAS,MAAM,GAAG,OAAO;GAChD;EAEJ;EACA,OAAO;CACT;CAEA,IAAI,KAAK,WAAW,GAAG,KAAK,KAAK,WAAW,GAAG,GAC7C,MAAM,IAAI,YAAY,4BAA4B;CAGpD,MAAM,QAAmB,KAAK,WAAW,GAAG,IACxC,WAAW,IACX,KAAK,WAAW,GAAG,IACjB,YAAY,IACZ,yBAAyB,IAAI,IAC3B,gBAAgB,EAAE,IAClB,WAAW,EAAE;CAErB,eAAe;CAEf,IAAI,CAAC,IAAI,GAAG,MAAM,IAAI,YAAY,gCAAgC;CAElE,OAAO;AACT"}
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  //#region src/utils/stringifyYaml.ts
4
4
  const NEEDS_QUOTING = /[\n\r\t#:{}[\],&*?|<>=!%@`'"\\]|^[-?!]|\s$|^\s|^[>|]|^[.]{2,}/;
5
- const PRESERVED_LITERALS = new Set([
5
+ const PRESERVED_LITERALS = /* @__PURE__ */ new Set([
6
6
  "true",
7
7
  "false",
8
8
  "null",