@inlang/paraglide-js 1.11.2 → 2.0.0-prerelease.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (608) hide show
  1. package/README.md +5 -5
  2. package/bin/run.js +2 -2
  3. package/default/index.d.ts +1 -1
  4. package/default/index.js +1 -1
  5. package/default/why.txt +1 -2
  6. package/dist/adapter-utils/index.d.ts +6 -5
  7. package/dist/adapter-utils/index.d.ts.map +1 -0
  8. package/dist/adapter-utils/index.js +5 -422
  9. package/dist/adapter-utils/negotiation/language.d.ts +1 -0
  10. package/dist/adapter-utils/negotiation/language.d.ts.map +1 -0
  11. package/dist/adapter-utils/negotiation/language.js +137 -0
  12. package/dist/adapter-utils/negotiation/language.test.d.ts +1 -0
  13. package/dist/adapter-utils/negotiation/language.test.d.ts.map +1 -0
  14. package/dist/adapter-utils/negotiation/language.test.js +24 -0
  15. package/dist/adapter-utils/routing/detectLanguage.d.ts +1 -0
  16. package/dist/adapter-utils/routing/detectLanguage.d.ts.map +1 -0
  17. package/dist/adapter-utils/routing/detectLanguage.js +32 -0
  18. package/dist/adapter-utils/routing/detectLanguage.test.d.ts +1 -0
  19. package/dist/adapter-utils/routing/detectLanguage.test.d.ts.map +1 -0
  20. package/dist/adapter-utils/routing/detectLanguage.test.js +37 -0
  21. package/dist/adapter-utils/routing/resolveUserPathDefinition.test.d.ts +1 -0
  22. package/dist/adapter-utils/routing/resolveUserPathDefinition.test.d.ts.map +1 -0
  23. package/dist/adapter-utils/routing/resolveUserPathDefinition.test.js +35 -0
  24. package/dist/adapter-utils/routing/resolveUserPathDefinitions.d.ts +3 -3
  25. package/dist/adapter-utils/routing/resolveUserPathDefinitions.d.ts.map +1 -0
  26. package/dist/adapter-utils/routing/resolveUserPathDefinitions.js +22 -0
  27. package/dist/adapter-utils/routing/routeDefinitions.d.ts +1 -0
  28. package/dist/adapter-utils/routing/routeDefinitions.d.ts.map +1 -0
  29. package/dist/adapter-utils/routing/routeDefinitions.js +224 -0
  30. package/dist/adapter-utils/routing/routeDefinitions.test.d.ts +1 -0
  31. package/dist/adapter-utils/routing/routeDefinitions.test.d.ts.map +1 -0
  32. package/dist/adapter-utils/routing/routeDefinitions.test.js +234 -0
  33. package/dist/adapter-utils/routing/sortRoutes.d.ts +1 -0
  34. package/dist/adapter-utils/routing/sortRoutes.d.ts.map +1 -0
  35. package/dist/adapter-utils/routing/sortRoutes.js +135 -0
  36. package/dist/adapter-utils/routing/validatePathTranslations.d.ts +2 -2
  37. package/dist/adapter-utils/routing/validatePathTranslations.d.ts.map +1 -0
  38. package/dist/adapter-utils/routing/validatePathTranslations.js +98 -0
  39. package/dist/adapter-utils/routing/validatePathTranslations.test.d.ts +1 -0
  40. package/dist/adapter-utils/routing/validatePathTranslations.test.d.ts.map +1 -0
  41. package/dist/adapter-utils/routing/validatePathTranslations.test.js +121 -0
  42. package/dist/cli/commands/compile/command.d.ts +2 -2
  43. package/dist/cli/commands/compile/command.d.ts.map +1 -0
  44. package/dist/cli/commands/compile/command.js +38 -0
  45. package/dist/cli/commands/init/command.d.ts +8 -8
  46. package/dist/cli/commands/init/command.d.ts.map +1 -0
  47. package/dist/cli/commands/init/command.js +122 -0
  48. package/dist/cli/defaults.d.ts +4 -3
  49. package/dist/cli/defaults.d.ts.map +1 -0
  50. package/dist/cli/defaults.js +29 -0
  51. package/dist/cli/index.d.ts +11 -5
  52. package/dist/cli/index.d.ts.map +1 -0
  53. package/dist/cli/index.js +16 -34838
  54. package/dist/cli/steps/check-for-uncomitted-changes.d.ts +3 -3
  55. package/dist/cli/steps/check-for-uncomitted-changes.d.ts.map +1 -0
  56. package/dist/cli/steps/check-for-uncomitted-changes.js +36 -0
  57. package/dist/cli/steps/initialize-inlang-project.d.ts +16 -12
  58. package/dist/cli/steps/initialize-inlang-project.d.ts.map +1 -0
  59. package/dist/cli/steps/initialize-inlang-project.js +190 -0
  60. package/dist/cli/steps/maybe-add-sherlock.d.ts +6 -6
  61. package/dist/cli/steps/maybe-add-sherlock.d.ts.map +1 -0
  62. package/dist/cli/steps/maybe-add-sherlock.js +35 -0
  63. package/dist/cli/steps/prompt-for-outdir.d.ts +3 -3
  64. package/dist/cli/steps/prompt-for-outdir.d.ts.map +1 -0
  65. package/dist/cli/steps/prompt-for-outdir.js +18 -0
  66. package/dist/cli/steps/run-compiler.d.ts +5 -5
  67. package/dist/cli/steps/run-compiler.d.ts.map +1 -0
  68. package/dist/cli/steps/run-compiler.js +13 -0
  69. package/dist/cli/steps/update-package-json.d.ts +5 -5
  70. package/dist/cli/steps/update-package-json.d.ts.map +1 -0
  71. package/dist/cli/steps/update-package-json.js +33 -0
  72. package/dist/cli/steps/update-ts-config.d.ts +7 -7
  73. package/dist/cli/steps/update-ts-config.d.ts.map +1 -0
  74. package/dist/cli/steps/update-ts-config.js +132 -0
  75. package/dist/cli/utils.d.ts +2 -2
  76. package/dist/cli/utils.d.ts.map +1 -0
  77. package/dist/cli/utils.js +19 -0
  78. package/dist/compiler/compile.d.ts +17 -22
  79. package/dist/compiler/compile.d.ts.map +1 -0
  80. package/dist/compiler/compile.js +31 -0
  81. package/dist/compiler/compile.test.d.ts +1 -0
  82. package/dist/compiler/compile.test.d.ts.map +1 -0
  83. package/dist/compiler/compile.test.js +29 -0
  84. package/dist/compiler/compileBundle.d.ts +20 -0
  85. package/dist/compiler/compileBundle.d.ts.map +1 -0
  86. package/dist/compiler/compileBundle.js +55 -0
  87. package/dist/compiler/compileExpression.d.ts +5 -0
  88. package/dist/compiler/compileExpression.d.ts.map +1 -0
  89. package/dist/compiler/compileExpression.js +41 -0
  90. package/dist/compiler/compileMessage.d.ts +7 -33
  91. package/dist/compiler/compileMessage.d.ts.map +1 -0
  92. package/dist/compiler/compileMessage.js +64 -0
  93. package/dist/compiler/compileMessage.test.d.ts +1 -0
  94. package/dist/compiler/compileMessage.test.d.ts.map +1 -0
  95. package/dist/compiler/compileMessage.test.js +74 -0
  96. package/dist/compiler/compilePattern.d.ts +6 -7
  97. package/dist/compiler/compilePattern.d.ts.map +1 -0
  98. package/dist/compiler/compilePattern.js +28 -0
  99. package/dist/compiler/compilePattern.test.d.ts +1 -0
  100. package/dist/compiler/compilePattern.test.d.ts.map +1 -0
  101. package/dist/compiler/compilePattern.test.js +67 -0
  102. package/dist/compiler/compileProject.d.ts +43 -0
  103. package/dist/compiler/compileProject.d.ts.map +1 -0
  104. package/dist/compiler/compileProject.js +204 -0
  105. package/dist/compiler/compileProject.test.d.ts +2 -0
  106. package/dist/compiler/compileProject.test.d.ts.map +1 -0
  107. package/dist/compiler/compileProject.test.js +638 -0
  108. package/dist/compiler/emit-dts.d.ts +6 -0
  109. package/dist/compiler/emit-dts.d.ts.map +1 -0
  110. package/dist/compiler/emit-dts.js +50 -0
  111. package/dist/compiler/emit-dts.test.d.ts +2 -0
  112. package/dist/compiler/emit-dts.test.d.ts.map +1 -0
  113. package/dist/compiler/emit-dts.test.js +40 -0
  114. package/dist/compiler/index.d.ts +7 -0
  115. package/dist/compiler/index.d.ts.map +1 -0
  116. package/dist/compiler/index.js +6 -0
  117. package/dist/compiler/jsDocComment.d.ts +9 -0
  118. package/dist/compiler/jsDocComment.d.ts.map +1 -0
  119. package/dist/compiler/jsDocComment.js +29 -0
  120. package/dist/compiler/registry.d.ts +14 -0
  121. package/dist/compiler/registry.d.ts.map +1 -0
  122. package/dist/compiler/registry.js +55 -0
  123. package/dist/compiler/runtime.d.ts +3 -3
  124. package/dist/compiler/runtime.d.ts.map +1 -0
  125. package/dist/compiler/runtime.js +199 -0
  126. package/dist/compiler/types.d.ts +11 -0
  127. package/dist/compiler/types.d.ts.map +1 -0
  128. package/dist/compiler/types.js +28 -0
  129. package/dist/index.d.ts +5 -4
  130. package/dist/index.d.ts.map +1 -0
  131. package/dist/index.js +4 -11381
  132. package/dist/services/codegen/escape.d.ts +1 -0
  133. package/dist/services/codegen/escape.d.ts.map +1 -0
  134. package/dist/services/codegen/escape.js +18 -0
  135. package/dist/services/codegen/identifier.d.ts +2 -3
  136. package/dist/services/codegen/identifier.d.ts.map +1 -0
  137. package/dist/services/codegen/identifier.js +11 -0
  138. package/dist/services/codegen/indentifier.test.d.ts +1 -0
  139. package/dist/services/codegen/indentifier.test.d.ts.map +1 -0
  140. package/dist/services/codegen/indentifier.test.js +8 -0
  141. package/dist/services/codegen/quotes.d.ts +3 -1
  142. package/dist/services/codegen/quotes.d.ts.map +1 -0
  143. package/dist/services/codegen/quotes.js +4 -0
  144. package/dist/services/env-variables/index.d.ts +6 -0
  145. package/dist/services/env-variables/index.d.ts.map +1 -0
  146. package/dist/services/env-variables/index.js +5 -0
  147. package/dist/services/environment/package.d.ts +3 -4
  148. package/dist/services/environment/package.d.ts.map +1 -0
  149. package/dist/services/environment/package.js +30 -0
  150. package/dist/services/environment/package.test.d.ts +1 -0
  151. package/dist/services/environment/package.test.d.ts.map +1 -0
  152. package/dist/services/environment/package.test.js +20 -0
  153. package/dist/services/error-handling.d.ts +4 -4
  154. package/dist/services/error-handling.d.ts.map +1 -0
  155. package/dist/services/error-handling.js +19 -0
  156. package/dist/services/error-handling.test.d.ts +1 -0
  157. package/dist/services/error-handling.test.d.ts.map +1 -0
  158. package/dist/services/error-handling.test.js +9 -0
  159. package/dist/services/file-handling/exists.d.ts +2 -3
  160. package/dist/services/file-handling/exists.d.ts.map +1 -0
  161. package/dist/services/file-handling/exists.js +23 -0
  162. package/dist/services/file-handling/exists.test.d.ts +1 -0
  163. package/dist/services/file-handling/exists.test.d.ts.map +1 -0
  164. package/dist/services/file-handling/exists.test.js +26 -0
  165. package/dist/services/file-handling/types.d.ts +5 -0
  166. package/dist/services/file-handling/types.d.ts.map +1 -0
  167. package/dist/services/file-handling/write-output.d.ts +3 -3
  168. package/dist/services/file-handling/write-output.d.ts.map +1 -0
  169. package/dist/services/file-handling/write-output.js +37 -0
  170. package/dist/services/file-handling/write-output.test.d.ts +1 -0
  171. package/dist/services/file-handling/write-output.test.d.ts.map +1 -0
  172. package/dist/services/file-handling/write-output.test.js +57 -0
  173. package/dist/services/logger/index.d.ts +1 -0
  174. package/dist/services/logger/index.d.ts.map +1 -0
  175. package/dist/services/logger/index.js +60 -0
  176. package/dist/services/lookup.d.ts +15 -0
  177. package/dist/services/lookup.d.ts.map +1 -0
  178. package/dist/services/lookup.js +23 -0
  179. package/dist/services/telemetry/capture.d.ts +16 -0
  180. package/dist/services/telemetry/capture.d.ts.map +1 -0
  181. package/dist/services/telemetry/capture.js +71 -0
  182. package/dist/services/telemetry/capture.test.d.ts +2 -0
  183. package/dist/services/telemetry/capture.test.d.ts.map +1 -0
  184. package/dist/services/telemetry/capture.test.js +40 -0
  185. package/dist/services/telemetry/events.d.ts +2 -1
  186. package/dist/services/telemetry/events.d.ts.map +1 -0
  187. package/dist/services/telemetry/stack-detection.d.ts +1 -0
  188. package/dist/services/telemetry/stack-detection.d.ts.map +1 -0
  189. package/dist/services/telemetry/stack-detection.js +82 -0
  190. package/dist/services/telemetry/stack-detection.test.d.ts +1 -0
  191. package/dist/services/telemetry/stack-detection.test.d.ts.map +1 -0
  192. package/dist/services/telemetry/stack-detection.test.js +39 -0
  193. package/dist/services/valid-js-identifier/index.d.ts +1 -0
  194. package/dist/services/valid-js-identifier/index.d.ts.map +1 -0
  195. package/dist/services/valid-js-identifier/index.js +24 -0
  196. package/dist/services/valid-js-identifier/index.test.d.ts +1 -0
  197. package/dist/services/valid-js-identifier/index.test.d.ts.map +1 -0
  198. package/dist/services/valid-js-identifier/index.test.js +30 -0
  199. package/dist/services/valid-js-identifier/reservedWords.d.ts +1 -0
  200. package/dist/services/valid-js-identifier/reservedWords.d.ts.map +1 -0
  201. package/dist/services/valid-js-identifier/reservedWords.js +50 -0
  202. package/dist/utilities/detect-json-formatting.d.ts +11 -0
  203. package/dist/utilities/detect-json-formatting.d.ts.map +1 -0
  204. package/dist/utilities/detect-json-formatting.js +79 -0
  205. package/node_modules/@inlang/sdk/LICENSE +201 -0
  206. package/node_modules/@inlang/sdk/README.md +16 -0
  207. package/node_modules/@inlang/sdk/dist/database/initDb.d.ts +7 -0
  208. package/node_modules/@inlang/sdk/dist/database/initDb.d.ts.map +1 -0
  209. package/node_modules/@inlang/sdk/dist/database/initDb.js +36 -0
  210. package/node_modules/@inlang/sdk/dist/database/initDb.js.map +1 -0
  211. package/node_modules/@inlang/sdk/dist/database/initDbAndSchema.test.d.ts +2 -0
  212. package/node_modules/@inlang/sdk/dist/database/initDbAndSchema.test.d.ts.map +1 -0
  213. package/node_modules/@inlang/sdk/dist/database/initDbAndSchema.test.js +110 -0
  214. package/node_modules/@inlang/sdk/dist/database/initDbAndSchema.test.js.map +1 -0
  215. package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.d.ts +20 -0
  216. package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.d.ts.map +1 -0
  217. package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.js +183 -0
  218. package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.js.map +1 -0
  219. package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.test.d.ts +2 -0
  220. package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.test.d.ts.map +1 -0
  221. package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.test.js +119 -0
  222. package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.test.js.map +1 -0
  223. package/node_modules/@inlang/sdk/dist/database/schema.d.ts +74 -0
  224. package/node_modules/@inlang/sdk/dist/database/schema.d.ts.map +1 -0
  225. package/node_modules/@inlang/sdk/dist/database/schema.js +45 -0
  226. package/node_modules/@inlang/sdk/dist/database/schema.js.map +1 -0
  227. package/node_modules/@inlang/sdk/dist/helper.d.ts +71 -0
  228. package/node_modules/@inlang/sdk/dist/helper.d.ts.map +1 -0
  229. package/node_modules/@inlang/sdk/dist/helper.js +91 -0
  230. package/node_modules/@inlang/sdk/dist/helper.js.map +1 -0
  231. package/node_modules/@inlang/sdk/dist/human-id/human-id.d.ts +3 -0
  232. package/node_modules/@inlang/sdk/dist/human-id/human-id.d.ts.map +1 -0
  233. package/node_modules/@inlang/sdk/dist/human-id/human-id.js +12 -0
  234. package/node_modules/@inlang/sdk/dist/human-id/human-id.js.map +1 -0
  235. package/node_modules/@inlang/sdk/dist/human-id/words.d.ts +5 -0
  236. package/node_modules/@inlang/sdk/dist/human-id/words.d.ts.map +1 -0
  237. package/node_modules/@inlang/sdk/dist/human-id/words.js +1036 -0
  238. package/node_modules/@inlang/sdk/dist/human-id/words.js.map +1 -0
  239. package/node_modules/@inlang/sdk/dist/human-id/words.test.d.ts +2 -0
  240. package/node_modules/@inlang/sdk/dist/human-id/words.test.d.ts.map +1 -0
  241. package/node_modules/@inlang/sdk/dist/human-id/words.test.js +29 -0
  242. package/node_modules/@inlang/sdk/dist/human-id/words.test.js.map +1 -0
  243. package/node_modules/@inlang/sdk/dist/import-export/exportFiles.d.ts +11 -0
  244. package/node_modules/@inlang/sdk/dist/import-export/exportFiles.d.ts.map +1 -0
  245. package/node_modules/@inlang/sdk/dist/import-export/exportFiles.js +26 -0
  246. package/node_modules/@inlang/sdk/dist/import-export/exportFiles.js.map +1 -0
  247. package/node_modules/@inlang/sdk/dist/import-export/importFiles.d.ts +13 -0
  248. package/node_modules/@inlang/sdk/dist/import-export/importFiles.d.ts.map +1 -0
  249. package/node_modules/@inlang/sdk/dist/import-export/importFiles.js +124 -0
  250. package/node_modules/@inlang/sdk/dist/import-export/importFiles.js.map +1 -0
  251. package/node_modules/@inlang/sdk/dist/import-export/importFiles.test.d.ts +2 -0
  252. package/node_modules/@inlang/sdk/dist/import-export/importFiles.test.d.ts.map +1 -0
  253. package/node_modules/@inlang/sdk/dist/import-export/importFiles.test.js +179 -0
  254. package/node_modules/@inlang/sdk/dist/import-export/importFiles.test.js.map +1 -0
  255. package/node_modules/@inlang/sdk/dist/import-export/roundtrip.test.d.ts +2 -0
  256. package/node_modules/@inlang/sdk/dist/import-export/roundtrip.test.d.ts.map +1 -0
  257. package/node_modules/@inlang/sdk/dist/import-export/roundtrip.test.js +273 -0
  258. package/node_modules/@inlang/sdk/dist/import-export/roundtrip.test.js.map +1 -0
  259. package/node_modules/@inlang/sdk/dist/import-export/upsertBundleNestedMatchByProperties.d.ts +4 -0
  260. package/node_modules/@inlang/sdk/dist/import-export/upsertBundleNestedMatchByProperties.d.ts.map +1 -0
  261. package/node_modules/@inlang/sdk/dist/import-export/upsertBundleNestedMatchByProperties.js +58 -0
  262. package/node_modules/@inlang/sdk/dist/import-export/upsertBundleNestedMatchByProperties.js.map +1 -0
  263. package/node_modules/@inlang/sdk/dist/index.d.ts +24 -0
  264. package/node_modules/@inlang/sdk/dist/index.d.ts.map +1 -0
  265. package/node_modules/@inlang/sdk/dist/index.js +22 -0
  266. package/node_modules/@inlang/sdk/dist/index.js.map +1 -0
  267. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.d.ts +9 -0
  268. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.d.ts.map +1 -0
  269. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.js +84 -0
  270. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.js.map +1 -0
  271. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts +2 -0
  272. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts.map +1 -0
  273. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.test.js +85 -0
  274. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.test.js.map +1 -0
  275. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/schemaV1.d.ts +86 -0
  276. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/schemaV1.d.ts.map +1 -0
  277. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/schemaV1.js +35 -0
  278. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/schemaV1.js.map +1 -0
  279. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.d.ts +9 -0
  280. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.d.ts.map +1 -0
  281. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.js +67 -0
  282. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.js.map +1 -0
  283. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.test.d.ts +2 -0
  284. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.test.d.ts.map +1 -0
  285. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.test.js +85 -0
  286. package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.test.js.map +1 -0
  287. package/node_modules/@inlang/sdk/dist/json-schema/pattern.d.ts +190 -0
  288. package/node_modules/@inlang/sdk/dist/json-schema/pattern.d.ts.map +1 -0
  289. package/node_modules/@inlang/sdk/dist/json-schema/pattern.js +43 -0
  290. package/node_modules/@inlang/sdk/dist/json-schema/pattern.js.map +1 -0
  291. package/node_modules/@inlang/sdk/dist/json-schema/settings.d.ts +31 -0
  292. package/node_modules/@inlang/sdk/dist/json-schema/settings.d.ts.map +1 -0
  293. package/node_modules/@inlang/sdk/dist/json-schema/settings.js +96 -0
  294. package/node_modules/@inlang/sdk/dist/json-schema/settings.js.map +1 -0
  295. package/node_modules/@inlang/sdk/dist/json-schema/settings.test-d.d.ts +2 -0
  296. package/node_modules/@inlang/sdk/dist/json-schema/settings.test-d.d.ts.map +1 -0
  297. package/node_modules/@inlang/sdk/dist/json-schema/settings.test-d.js +20 -0
  298. package/node_modules/@inlang/sdk/dist/json-schema/settings.test-d.js.map +1 -0
  299. package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.d.ts +3 -0
  300. package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.d.ts.map +1 -0
  301. package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.js +127 -0
  302. package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.js.map +1 -0
  303. package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.test.d.ts +2 -0
  304. package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.test.d.ts.map +1 -0
  305. package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.test.js +135 -0
  306. package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.test.js.map +1 -0
  307. package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.d.ts +3 -0
  308. package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.d.ts.map +1 -0
  309. package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.js +47 -0
  310. package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.js.map +1 -0
  311. package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.test.d.ts +2 -0
  312. package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.test.d.ts.map +1 -0
  313. package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.test.js +251 -0
  314. package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.test.js.map +1 -0
  315. package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.d.ts +8 -0
  316. package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.d.ts.map +1 -0
  317. package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.js +109 -0
  318. package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.js.map +1 -0
  319. package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.test.d.ts +2 -0
  320. package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.test.d.ts.map +1 -0
  321. package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.test.js +418 -0
  322. package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.test.js.map +1 -0
  323. package/node_modules/@inlang/sdk/dist/lix-plugin/merge.test.d.ts +2 -0
  324. package/node_modules/@inlang/sdk/dist/lix-plugin/merge.test.d.ts.map +1 -0
  325. package/node_modules/@inlang/sdk/dist/lix-plugin/merge.test.js +120 -0
  326. package/node_modules/@inlang/sdk/dist/lix-plugin/merge.test.js.map +1 -0
  327. package/node_modules/@inlang/sdk/dist/lix-plugin/resolveConflictBySelecting.test.d.ts +2 -0
  328. package/node_modules/@inlang/sdk/dist/lix-plugin/resolveConflictBySelecting.test.d.ts.map +1 -0
  329. package/node_modules/@inlang/sdk/dist/lix-plugin/resolveConflictBySelecting.test.js +176 -0
  330. package/node_modules/@inlang/sdk/dist/lix-plugin/resolveConflictBySelecting.test.js.map +1 -0
  331. package/node_modules/@inlang/sdk/dist/migrations/v2/createMessageV1.d.ts +28 -0
  332. package/node_modules/@inlang/sdk/dist/migrations/v2/createMessageV1.d.ts.map +1 -0
  333. package/node_modules/@inlang/sdk/dist/migrations/v2/createMessageV1.js +31 -0
  334. package/node_modules/@inlang/sdk/dist/migrations/v2/createMessageV1.js.map +1 -0
  335. package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts +9 -0
  336. package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts.map +1 -0
  337. package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.js +31 -0
  338. package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.js.map +1 -0
  339. package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts +2 -0
  340. package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts.map +1 -0
  341. package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js +45 -0
  342. package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js.map +1 -0
  343. package/node_modules/@inlang/sdk/dist/plugin/cache.d.ts +6 -0
  344. package/node_modules/@inlang/sdk/dist/plugin/cache.d.ts.map +1 -0
  345. package/node_modules/@inlang/sdk/dist/plugin/cache.js +59 -0
  346. package/node_modules/@inlang/sdk/dist/plugin/cache.js.map +1 -0
  347. package/node_modules/@inlang/sdk/dist/plugin/cache.test.d.ts +2 -0
  348. package/node_modules/@inlang/sdk/dist/plugin/cache.test.d.ts.map +1 -0
  349. package/node_modules/@inlang/sdk/dist/plugin/cache.test.js +61 -0
  350. package/node_modules/@inlang/sdk/dist/plugin/cache.test.js.map +1 -0
  351. package/node_modules/@inlang/sdk/dist/plugin/errors.d.ts +41 -0
  352. package/node_modules/@inlang/sdk/dist/plugin/errors.d.ts.map +1 -0
  353. package/node_modules/@inlang/sdk/dist/plugin/errors.js +48 -0
  354. package/node_modules/@inlang/sdk/dist/plugin/errors.js.map +1 -0
  355. package/node_modules/@inlang/sdk/dist/plugin/importPlugins.d.ts +19 -0
  356. package/node_modules/@inlang/sdk/dist/plugin/importPlugins.d.ts.map +1 -0
  357. package/node_modules/@inlang/sdk/dist/plugin/importPlugins.js +43 -0
  358. package/node_modules/@inlang/sdk/dist/plugin/importPlugins.js.map +1 -0
  359. package/node_modules/@inlang/sdk/dist/plugin/importPlugins.test.d.ts +2 -0
  360. package/node_modules/@inlang/sdk/dist/plugin/importPlugins.test.d.ts.map +1 -0
  361. package/node_modules/@inlang/sdk/dist/plugin/importPlugins.test.js +95 -0
  362. package/node_modules/@inlang/sdk/dist/plugin/importPlugins.test.js.map +1 -0
  363. package/node_modules/@inlang/sdk/dist/plugin/meta/ideExtension.d.ts +54 -0
  364. package/node_modules/@inlang/sdk/dist/plugin/meta/ideExtension.d.ts.map +1 -0
  365. package/node_modules/@inlang/sdk/dist/plugin/meta/ideExtension.js +5 -0
  366. package/node_modules/@inlang/sdk/dist/plugin/meta/ideExtension.js.map +1 -0
  367. package/node_modules/@inlang/sdk/dist/plugin/schema.d.ts +152 -0
  368. package/node_modules/@inlang/sdk/dist/plugin/schema.d.ts.map +1 -0
  369. package/node_modules/@inlang/sdk/dist/plugin/schema.js +5 -0
  370. package/node_modules/@inlang/sdk/dist/plugin/schema.js.map +1 -0
  371. package/node_modules/@inlang/sdk/dist/project/api.d.ts +78 -0
  372. package/node_modules/@inlang/sdk/dist/project/api.d.ts.map +1 -0
  373. package/node_modules/@inlang/sdk/dist/project/api.js +5 -0
  374. package/node_modules/@inlang/sdk/dist/project/api.js.map +1 -0
  375. package/node_modules/@inlang/sdk/dist/project/initHandleSaveToLixOnChange.d.ts +14 -0
  376. package/node_modules/@inlang/sdk/dist/project/initHandleSaveToLixOnChange.d.ts.map +1 -0
  377. package/node_modules/@inlang/sdk/dist/project/initHandleSaveToLixOnChange.js +81 -0
  378. package/node_modules/@inlang/sdk/dist/project/initHandleSaveToLixOnChange.js.map +1 -0
  379. package/node_modules/@inlang/sdk/dist/project/loadProject.d.ts +43 -0
  380. package/node_modules/@inlang/sdk/dist/project/loadProject.d.ts.map +1 -0
  381. package/node_modules/@inlang/sdk/dist/project/loadProject.js +105 -0
  382. package/node_modules/@inlang/sdk/dist/project/loadProject.js.map +1 -0
  383. package/node_modules/@inlang/sdk/dist/project/loadProject.test.d.ts +2 -0
  384. package/node_modules/@inlang/sdk/dist/project/loadProject.test.d.ts.map +1 -0
  385. package/node_modules/@inlang/sdk/dist/project/loadProject.test.js +123 -0
  386. package/node_modules/@inlang/sdk/dist/project/loadProject.test.js.map +1 -0
  387. package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.d.ts +87 -0
  388. package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.d.ts.map +1 -0
  389. package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.js +593 -0
  390. package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.js.map +1 -0
  391. package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.test.d.ts +2 -0
  392. package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.test.d.ts.map +1 -0
  393. package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.test.js +642 -0
  394. package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.test.js.map +1 -0
  395. package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.d.ts +8 -0
  396. package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.d.ts.map +1 -0
  397. package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.js +31 -0
  398. package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.js.map +1 -0
  399. package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.test.d.ts +2 -0
  400. package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.test.d.ts.map +1 -0
  401. package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.test.js +27 -0
  402. package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.test.js.map +1 -0
  403. package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.d.ts +9 -0
  404. package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.d.ts.map +1 -0
  405. package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.js +46 -0
  406. package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.js.map +1 -0
  407. package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.test.d.ts +2 -0
  408. package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.test.d.ts.map +1 -0
  409. package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.test.js +60 -0
  410. package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.test.js.map +1 -0
  411. package/node_modules/@inlang/sdk/dist/project/newProject.d.ts +17 -0
  412. package/node_modules/@inlang/sdk/dist/project/newProject.d.ts.map +1 -0
  413. package/node_modules/@inlang/sdk/dist/project/newProject.js +70 -0
  414. package/node_modules/@inlang/sdk/dist/project/newProject.js.map +1 -0
  415. package/node_modules/@inlang/sdk/dist/project/newProject.test.d.ts +2 -0
  416. package/node_modules/@inlang/sdk/dist/project/newProject.test.d.ts.map +1 -0
  417. package/node_modules/@inlang/sdk/dist/project/newProject.test.js +37 -0
  418. package/node_modules/@inlang/sdk/dist/project/newProject.test.js.map +1 -0
  419. package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.d.ts +8 -0
  420. package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.d.ts.map +1 -0
  421. package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.js +86 -0
  422. package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.js.map +1 -0
  423. package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.test.d.ts +2 -0
  424. package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.test.d.ts.map +1 -0
  425. package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.test.js +245 -0
  426. package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.test.js.map +1 -0
  427. package/node_modules/@inlang/sdk/dist/project/state/id$.d.ts +6 -0
  428. package/node_modules/@inlang/sdk/dist/project/state/id$.d.ts.map +1 -0
  429. package/node_modules/@inlang/sdk/dist/project/state/id$.js +19 -0
  430. package/node_modules/@inlang/sdk/dist/project/state/id$.js.map +1 -0
  431. package/node_modules/@inlang/sdk/dist/project/state/id$.test.d.ts +2 -0
  432. package/node_modules/@inlang/sdk/dist/project/state/id$.test.d.ts.map +1 -0
  433. package/node_modules/@inlang/sdk/dist/project/state/id$.test.js +36 -0
  434. package/node_modules/@inlang/sdk/dist/project/state/id$.test.js.map +1 -0
  435. package/node_modules/@inlang/sdk/dist/project/state/setSettings.d.ts +7 -0
  436. package/node_modules/@inlang/sdk/dist/project/state/setSettings.d.ts.map +1 -0
  437. package/node_modules/@inlang/sdk/dist/project/state/setSettings.js +16 -0
  438. package/node_modules/@inlang/sdk/dist/project/state/setSettings.js.map +1 -0
  439. package/node_modules/@inlang/sdk/dist/project/state/setSettings.test.d.ts +2 -0
  440. package/node_modules/@inlang/sdk/dist/project/state/setSettings.test.d.ts.map +1 -0
  441. package/node_modules/@inlang/sdk/dist/project/state/setSettings.test.js +58 -0
  442. package/node_modules/@inlang/sdk/dist/project/state/setSettings.test.js.map +1 -0
  443. package/node_modules/@inlang/sdk/dist/project/state/settings$.d.ts +7 -0
  444. package/node_modules/@inlang/sdk/dist/project/state/settings$.d.ts.map +1 -0
  445. package/node_modules/@inlang/sdk/dist/project/state/settings$.js +21 -0
  446. package/node_modules/@inlang/sdk/dist/project/state/settings$.js.map +1 -0
  447. package/node_modules/@inlang/sdk/dist/project/state/settings$.test.d.ts +2 -0
  448. package/node_modules/@inlang/sdk/dist/project/state/settings$.test.d.ts.map +1 -0
  449. package/node_modules/@inlang/sdk/dist/project/state/settings$.test.js +51 -0
  450. package/node_modules/@inlang/sdk/dist/project/state/settings$.test.js.map +1 -0
  451. package/node_modules/@inlang/sdk/dist/project/state/state.d.ts +58 -0
  452. package/node_modules/@inlang/sdk/dist/project/state/state.d.ts.map +1 -0
  453. package/node_modules/@inlang/sdk/dist/project/state/state.js +67 -0
  454. package/node_modules/@inlang/sdk/dist/project/state/state.js.map +1 -0
  455. package/node_modules/@inlang/sdk/dist/project/state/state.test.d.ts +2 -0
  456. package/node_modules/@inlang/sdk/dist/project/state/state.test.d.ts.map +1 -0
  457. package/node_modules/@inlang/sdk/dist/project/state/state.test.js +103 -0
  458. package/node_modules/@inlang/sdk/dist/project/state/state.test.js.map +1 -0
  459. package/node_modules/@inlang/sdk/dist/query-utilities/index.d.ts +6 -0
  460. package/node_modules/@inlang/sdk/dist/query-utilities/index.d.ts.map +1 -0
  461. package/node_modules/@inlang/sdk/dist/query-utilities/index.js +9 -0
  462. package/node_modules/@inlang/sdk/dist/query-utilities/index.js.map +1 -0
  463. package/node_modules/@inlang/sdk/dist/query-utilities/insertBundleNested.d.ts +4 -0
  464. package/node_modules/@inlang/sdk/dist/query-utilities/insertBundleNested.d.ts.map +1 -0
  465. package/node_modules/@inlang/sdk/dist/query-utilities/insertBundleNested.js +39 -0
  466. package/node_modules/@inlang/sdk/dist/query-utilities/insertBundleNested.js.map +1 -0
  467. package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.d.ts +14 -0
  468. package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.d.ts.map +1 -0
  469. package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.js +22 -0
  470. package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.js.map +1 -0
  471. package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.test.d.ts +2 -0
  472. package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.test.d.ts.map +1 -0
  473. package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.test.js +67 -0
  474. package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.test.js.map +1 -0
  475. package/node_modules/@inlang/sdk/dist/query-utilities/selectBundleNested.d.ts +107 -0
  476. package/node_modules/@inlang/sdk/dist/query-utilities/selectBundleNested.d.ts.map +1 -0
  477. package/node_modules/@inlang/sdk/dist/query-utilities/selectBundleNested.js +43 -0
  478. package/node_modules/@inlang/sdk/dist/query-utilities/selectBundleNested.js.map +1 -0
  479. package/node_modules/@inlang/sdk/dist/query-utilities/updateBundleNested.d.ts +12 -0
  480. package/node_modules/@inlang/sdk/dist/query-utilities/updateBundleNested.d.ts.map +1 -0
  481. package/node_modules/@inlang/sdk/dist/query-utilities/updateBundleNested.js +25 -0
  482. package/node_modules/@inlang/sdk/dist/query-utilities/updateBundleNested.js.map +1 -0
  483. package/node_modules/@inlang/sdk/dist/query-utilities/upsertBundleNested.d.ts +4 -0
  484. package/node_modules/@inlang/sdk/dist/query-utilities/upsertBundleNested.d.ts.map +1 -0
  485. package/node_modules/@inlang/sdk/dist/query-utilities/upsertBundleNested.js +50 -0
  486. package/node_modules/@inlang/sdk/dist/query-utilities/upsertBundleNested.js.map +1 -0
  487. package/node_modules/@inlang/sdk/dist/services/env-variables/index.d.ts +6 -0
  488. package/node_modules/@inlang/sdk/dist/services/env-variables/index.d.ts.map +1 -0
  489. package/node_modules/@inlang/sdk/dist/services/env-variables/index.js +9 -0
  490. package/node_modules/@inlang/sdk/dist/services/env-variables/index.js.map +1 -0
  491. package/node_modules/@inlang/sdk/dist/services/error-reporting/index.d.ts +15 -0
  492. package/node_modules/@inlang/sdk/dist/services/error-reporting/index.d.ts.map +1 -0
  493. package/node_modules/@inlang/sdk/dist/services/error-reporting/index.js +30 -0
  494. package/node_modules/@inlang/sdk/dist/services/error-reporting/index.js.map +1 -0
  495. package/node_modules/@inlang/sdk/dist/services/telemetry/capture.d.ts +23 -0
  496. package/node_modules/@inlang/sdk/dist/services/telemetry/capture.d.ts.map +1 -0
  497. package/node_modules/@inlang/sdk/dist/services/telemetry/capture.js +77 -0
  498. package/node_modules/@inlang/sdk/dist/services/telemetry/capture.js.map +1 -0
  499. package/node_modules/@inlang/sdk/dist/services/telemetry/capture.test.d.ts +2 -0
  500. package/node_modules/@inlang/sdk/dist/services/telemetry/capture.test.d.ts.map +1 -0
  501. package/node_modules/@inlang/sdk/dist/services/telemetry/capture.test.js +44 -0
  502. package/node_modules/@inlang/sdk/dist/services/telemetry/capture.test.js.map +1 -0
  503. package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.d.ts +11 -0
  504. package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.d.ts.map +1 -0
  505. package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.js +83 -0
  506. package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.js.map +1 -0
  507. package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.test.d.ts +2 -0
  508. package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.test.d.ts.map +1 -0
  509. package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.test.js +33 -0
  510. package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.test.js.map +1 -0
  511. package/node_modules/@inlang/sdk/package.json +64 -0
  512. package/node_modules/@inlang/sdk/src/database/initDb.ts +34 -0
  513. package/node_modules/@inlang/sdk/src/database/initDbAndSchema.test.ts +125 -0
  514. package/node_modules/@inlang/sdk/src/database/jsonbPlugin.test.ts +154 -0
  515. package/node_modules/@inlang/sdk/src/database/jsonbPlugin.ts +215 -0
  516. package/node_modules/@inlang/sdk/src/database/schema.ts +127 -0
  517. package/node_modules/@inlang/sdk/src/helper.ts +113 -0
  518. package/node_modules/@inlang/sdk/src/human-id/human-id.ts +14 -0
  519. package/node_modules/@inlang/sdk/src/human-id/words.test.ts +27 -0
  520. package/node_modules/@inlang/sdk/src/human-id/words.ts +1035 -0
  521. package/node_modules/@inlang/sdk/src/import-export/exportFiles.ts +36 -0
  522. package/node_modules/@inlang/sdk/src/import-export/importFiles.test.ts +211 -0
  523. package/node_modules/@inlang/sdk/src/import-export/importFiles.ts +142 -0
  524. package/node_modules/@inlang/sdk/src/import-export/roundtrip.test.ts +313 -0
  525. package/node_modules/@inlang/sdk/src/import-export/upsertBundleNestedMatchByProperties.ts +74 -0
  526. package/node_modules/@inlang/sdk/src/index.ts +32 -0
  527. package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/README.md +1 -0
  528. package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/fromMessageV1.test.ts +87 -0
  529. package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/fromMessageV1.ts +99 -0
  530. package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/schemaV1.ts +66 -0
  531. package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/toMessageV1.test.ts +87 -0
  532. package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/toMessageV1.ts +79 -0
  533. package/node_modules/@inlang/sdk/src/json-schema/pattern.ts +59 -0
  534. package/node_modules/@inlang/sdk/src/json-schema/settings.test-d.ts +21 -0
  535. package/node_modules/@inlang/sdk/src/json-schema/settings.ts +138 -0
  536. package/node_modules/@inlang/sdk/src/lix-plugin/applyChanges.test.ts +150 -0
  537. package/node_modules/@inlang/sdk/src/lix-plugin/applyChanges.ts +171 -0
  538. package/node_modules/@inlang/sdk/src/lix-plugin/detectConflicts.test.ts +286 -0
  539. package/node_modules/@inlang/sdk/src/lix-plugin/detectConflicts.ts +62 -0
  540. package/node_modules/@inlang/sdk/src/lix-plugin/inlangLixPluginV1.test.ts +439 -0
  541. package/node_modules/@inlang/sdk/src/lix-plugin/inlangLixPluginV1.ts +132 -0
  542. package/node_modules/@inlang/sdk/src/lix-plugin/merge.test.ts +133 -0
  543. package/node_modules/@inlang/sdk/src/lix-plugin/resolveConflictBySelecting.test.ts +188 -0
  544. package/node_modules/@inlang/sdk/src/migrations/v2/createMessageV1.ts +37 -0
  545. package/node_modules/@inlang/sdk/src/migrations/v2/withLanguageTagToLocaleMigration.test.ts +51 -0
  546. package/node_modules/@inlang/sdk/src/migrations/v2/withLanguageTagToLocaleMigration.ts +31 -0
  547. package/node_modules/@inlang/sdk/src/plugin/cache.test.ts +83 -0
  548. package/node_modules/@inlang/sdk/src/plugin/cache.ts +79 -0
  549. package/node_modules/@inlang/sdk/src/plugin/errors.ts +67 -0
  550. package/node_modules/@inlang/sdk/src/plugin/importPlugins.test.ts +107 -0
  551. package/node_modules/@inlang/sdk/src/plugin/importPlugins.ts +60 -0
  552. package/node_modules/@inlang/sdk/src/plugin/meta/ideExtension.ts +56 -0
  553. package/node_modules/@inlang/sdk/src/plugin/schema.ts +165 -0
  554. package/node_modules/@inlang/sdk/src/project/api.ts +81 -0
  555. package/node_modules/@inlang/sdk/src/project/initHandleSaveToLixOnChange.ts +88 -0
  556. package/node_modules/@inlang/sdk/src/project/loadProject.test.ts +148 -0
  557. package/node_modules/@inlang/sdk/src/project/loadProject.ts +153 -0
  558. package/node_modules/@inlang/sdk/src/project/loadProjectFromDirectory.test.ts +819 -0
  559. package/node_modules/@inlang/sdk/src/project/loadProjectFromDirectory.ts +767 -0
  560. package/node_modules/@inlang/sdk/src/project/loadProjectInMemory.test.ts +29 -0
  561. package/node_modules/@inlang/sdk/src/project/loadProjectInMemory.ts +35 -0
  562. package/node_modules/@inlang/sdk/src/project/maybeCaptureTelemetry.test.ts +65 -0
  563. package/node_modules/@inlang/sdk/src/project/maybeCaptureTelemetry.ts +51 -0
  564. package/node_modules/@inlang/sdk/src/project/newProject.test.ts +36 -0
  565. package/node_modules/@inlang/sdk/src/project/newProject.ts +77 -0
  566. package/node_modules/@inlang/sdk/src/project/saveProjectToDirectory.test.ts +310 -0
  567. package/node_modules/@inlang/sdk/src/project/saveProjectToDirectory.ts +100 -0
  568. package/node_modules/@inlang/sdk/src/project/state/README.md +22 -0
  569. package/node_modules/@inlang/sdk/src/project/state/id$.test.ts +40 -0
  570. package/node_modules/@inlang/sdk/src/project/state/id$.ts +21 -0
  571. package/node_modules/@inlang/sdk/src/project/state/setSettings.test.ts +73 -0
  572. package/node_modules/@inlang/sdk/src/project/state/setSettings.ts +19 -0
  573. package/node_modules/@inlang/sdk/src/project/state/settings$.test.ts +63 -0
  574. package/node_modules/@inlang/sdk/src/project/state/settings$.ts +26 -0
  575. package/node_modules/@inlang/sdk/src/project/state/state.test.ts +128 -0
  576. package/node_modules/@inlang/sdk/src/project/state/state.ts +94 -0
  577. package/node_modules/@inlang/sdk/src/query-utilities/index.ts +5 -0
  578. package/node_modules/@inlang/sdk/src/query-utilities/insertBundleNested.ts +46 -0
  579. package/node_modules/@inlang/sdk/src/query-utilities/pollQuery.test.ts +88 -0
  580. package/node_modules/@inlang/sdk/src/query-utilities/pollQuery.ts +26 -0
  581. package/node_modules/@inlang/sdk/src/query-utilities/selectBundleNested.ts +46 -0
  582. package/node_modules/@inlang/sdk/src/query-utilities/updateBundleNested.ts +35 -0
  583. package/node_modules/@inlang/sdk/src/query-utilities/upsertBundleNested.ts +61 -0
  584. package/node_modules/@inlang/sdk/src/services/env-variables/createIndexFile.js +40 -0
  585. package/node_modules/@inlang/sdk/src/services/env-variables/index.d.ts +16 -0
  586. package/node_modules/@inlang/sdk/src/services/env-variables/index.ts +6 -0
  587. package/node_modules/@inlang/sdk/src/services/error-reporting/index.ts +28 -0
  588. package/node_modules/@inlang/sdk/src/services/telemetry/capture.test.ts +48 -0
  589. package/node_modules/@inlang/sdk/src/services/telemetry/capture.ts +98 -0
  590. package/node_modules/@inlang/sdk/src/utilities/detectJsonFormatting.test.ts +38 -0
  591. package/node_modules/@inlang/sdk/src/utilities/detectJsonFormatting.ts +109 -0
  592. package/package.json +41 -41
  593. package/dist/cli/steps/initialize-inlang-project.test.d.ts +0 -1
  594. package/dist/cli/steps/maybe-add-ninja.d.ts +0 -10
  595. package/dist/cli/steps.d.ts +0 -8
  596. package/dist/compiler/aliases.d.ts +0 -9
  597. package/dist/compiler/messageIndex.d.ts +0 -8
  598. package/dist/compiler/optionsType.d.ts +0 -3
  599. package/dist/compiler/optionsType.test.d.ts +0 -1
  600. package/dist/compiler/paramsType.d.ts +0 -11
  601. package/dist/compiler/paramsType.test.d.ts +0 -1
  602. package/dist/index-9cf8cd4d.js +0 -431
  603. package/dist/packfile-8529df01.js +0 -92
  604. package/dist/services/codegen/string-union.d.ts +0 -1
  605. package/dist/services/telemetry/implementation.d.ts +0 -24
  606. package/dist/services/telemetry/index.d.ts +0 -1
  607. /package/dist/{cli/commands/compile/command.test.d.ts → services/file-handling/types.js} +0 -0
  608. /package/dist/{cli/commands/init/command.test.d.ts → services/telemetry/events.js} +0 -0
package/README.md CHANGED
@@ -42,15 +42,15 @@ If you are using a Bundler use one of the [Bundler Plugins](usage#usage-with-a-b
42
42
  After running the compiler import the messages with `import * as m from "./paraglide/messages"`. By convention, a wildcard import is used.
43
43
 
44
44
  ```js
45
- import * as m from "./paraglide/messages.js"
45
+ import * as m from "./paraglide/messages.js";
46
46
 
47
- m.hello() // Hello world!
48
- m.loginHeader({ name: "Samuel" }) // Hello Samuel, please login to continue.
47
+ m.hello(); // Hello world!
48
+ m.loginHeader({ name: "Samuel" }); // Hello Samuel, please login to continue.
49
49
  ```
50
50
 
51
51
  # Playground
52
52
 
53
- Find examples of how to use Paraglide on CodeSandbox or in [our GitHub repository](https://github.com/opral/monorepo/tree/main/inlang/source-code/paraglide).
53
+ Find examples of how to use Paraglide on CodeSandbox or in [our GitHub repository](https://github.com/opral/monorepo/tree/main/inlang/packages/paraglide).
54
54
 
55
55
  <doc-links>
56
56
  <doc-link title="NextJS + Paraglide JS" icon="lucide:codesandbox" href="https://stackblitz.com/~/LorisSigrist/paraglide-next-app-router-example" description="Play around with NextJS and Paraglide JS"></doc-link>
@@ -66,7 +66,7 @@ Of course, we're not done yet! We plan on adding the following features to Parag
66
66
  - [ ] Formatting of numbers and dates ([Join the Discussion](https://github.com/opral/monorepo/discussions/992))
67
67
  - [ ] Markup Placeholders ([Join the Discussion](https://github.com/opral/monorepo/discussions/913))
68
68
  - [ ] Component Interpolation
69
- - [ ] Per-Language Splitting without Lazy-Loading
69
+ - [ ] Per-Language Splitting without Lazy-Loading
70
70
  - [ ] Even Smaller Output
71
71
 
72
72
  # Talks
package/bin/run.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { cli } from "../dist/cli/index.js"
2
+ import { cli } from "../dist/cli/index.js";
3
3
 
4
- cli.parse()
4
+ cli.parse();
@@ -1 +1 @@
1
- export {}
1
+ export {};
package/default/index.js CHANGED
@@ -1 +1 @@
1
- export {}
1
+ export {};
package/default/why.txt CHANGED
@@ -1,4 +1,3 @@
1
1
  Paraglide is a CLI at it's heart & therefore doesn't have a real JS entry point. This
2
2
  means that NPM doesn't show the TS icon on the package, which may lead people to believe
3
- it's not typesafe. To sidestep this we added an empty export. We don't think this is dishonest,
4
- because both paraglide's source code and it's output are fully typed.
3
+ it's not typesafe. To sidestep this we added an empty export.
@@ -1,5 +1,6 @@
1
- export { negotiateLanguagePreferences } from './negotiation/language.js';
2
- export { detectLanguageFromPath } from './routing/detectLanguage.js';
3
- export { bestMatch, resolveRoute, parseRouteDefinition, type PathDefinitionTranslations, type ParamMatcher, type RouteParam, } from './routing/routeDefinitions.js';
4
- export { validatePathTranslations, prettyPrintPathDefinitionIssues, } from './routing/validatePathTranslations.js';
5
- export { resolveUserPathDefinitions, type UserPathDefinitionTranslations, } from './routing/resolveUserPathDefinitions.js';
1
+ export { negotiateLanguagePreferences } from "./negotiation/language.js";
2
+ export { detectLanguageFromPath } from "./routing/detectLanguage.js";
3
+ export { bestMatch, resolveRoute, parseRouteDefinition, type PathDefinitionTranslations, type ParamMatcher, type RouteParam, } from "./routing/routeDefinitions.js";
4
+ export { validatePathTranslations, prettyPrintPathDefinitionIssues, } from "./routing/validatePathTranslations.js";
5
+ export { resolveUserPathDefinitions, type UserPathDefinitionTranslations, } from "./routing/resolveUserPathDefinitions.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,UAAU,GACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,wBAAwB,EACxB,+BAA+B,GAC/B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,0BAA0B,EAC1B,KAAK,8BAA8B,GACnC,MAAM,yCAAyC,CAAC"}
@@ -1,422 +1,5 @@
1
- function negotiateLanguagePreferences(accept, availableLanguageTags) {
2
- accept ||= "*";
3
- const acceptLanguageSpecs = parseAcceptLanguageHeader(accept);
4
- const priorities = availableLanguageTags.map(
5
- (languageTag, index) => getHighestLanguagePriority(languageTag, acceptLanguageSpecs, index)
6
- );
7
- return priorities.filter((prio) => prio.quality > 0).sort(bySpecificity).sort(byQuality).map((priority) => priority.languageTag);
8
- }
9
- function parseAcceptLanguageHeader(acceptLanguage) {
10
- return acceptLanguage.split(",").map((dfn) => dfn.trim()).map((dfn, index) => parseLanguage(dfn, index)).filter((maybeSpec) => Boolean(maybeSpec));
11
- }
12
- function parseLanguage(languageTag, index) {
13
- const LANGUAGE_REGEXP = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;
14
- const match = LANGUAGE_REGEXP.exec(languageTag);
15
- if (!match)
16
- return void 0;
17
- const [, prefix, suffix, qualityMatch] = match;
18
- if (!prefix)
19
- throw new Error(`Invalid language tag: ${languageTag}`);
20
- const full = suffix ? `${prefix}-${suffix}` : prefix;
21
- const quality = parseQuality(qualityMatch ?? "") ?? 1;
22
- return {
23
- prefix,
24
- suffix,
25
- quality,
26
- index,
27
- full
28
- };
29
- }
30
- function parseQuality(qualityMatch) {
31
- return qualityMatch.split(";").map((param) => param.split("=")).filter((p) => p[0] == "q" && !!p[1]).map(([, value]) => parseFloat(value))[0];
32
- }
33
- function getHighestLanguagePriority(languageTag, acceptableLanguages, index) {
34
- const priorities = acceptableLanguages.map((spec) => calculatePriority(languageTag, spec, index)).filter((prio) => Boolean(prio));
35
- const highestPriority = priorities.sort(bySpecificity)[0] || {
36
- languageTag,
37
- index: 0,
38
- order: -1,
39
- quality: 0,
40
- specificity: 0
41
- };
42
- return highestPriority;
43
- }
44
- function calculatePriority(languageTag, spec, index) {
45
- const parsed = parseLanguage(languageTag, 0);
46
- if (!parsed)
47
- return void 0;
48
- let specificity = 0;
49
- if (spec.full.toLowerCase() === parsed.full.toLowerCase()) {
50
- specificity = 4;
51
- } else if (spec.prefix.toLowerCase() === parsed.full.toLowerCase()) {
52
- specificity = 2;
53
- } else if (spec.full.toLowerCase() === parsed.prefix.toLowerCase()) {
54
- specificity = 1;
55
- }
56
- if (specificity === 0 && spec.full !== "*")
57
- return void 0;
58
- return {
59
- languageTag,
60
- index,
61
- order: spec.index,
62
- quality: spec.quality,
63
- specificity
64
- };
65
- }
66
- const byQuality = (a, b) => b.quality - a.quality;
67
- const bySpecificity = (a, b) => b.specificity - a.specificity || a.order - b.order || a.index - b.index;
68
- function detectLanguageFromPath({
69
- path,
70
- availableLanguageTags,
71
- base
72
- }) {
73
- base ??= "";
74
- if (base === "/")
75
- base = "";
76
- if (!path.startsWith(base))
77
- return void 0;
78
- const pathWithoutBase = path.replace(base, "");
79
- const maybeLang = pathWithoutBase.split("/")[1];
80
- if (!maybeLang)
81
- return void 0;
82
- return availableLanguageTags.map(lower).includes(lower(maybeLang)) ? maybeLang : void 0;
83
- }
84
- const lower = (s) => s.toLowerCase();
85
- const STATIC = 0;
86
- const OPTIONAL = 1;
87
- const REST = 2;
88
- const REQUIRED = 4;
89
- const PART_TYPE = 0;
90
- const PART_CONTENT = 1;
91
- const PART_MATCHED = 2;
92
- function sort_routes(routes) {
93
- const get_parts = cached(split);
94
- return routes.sort((route_a, route_b) => {
95
- var _a, _b, _c, _d, _e, _f;
96
- const segments_a = split_route_id(route_a).map(get_parts);
97
- const segments_b = split_route_id(route_b).map(get_parts);
98
- for (let i = 0; i < Math.max(segments_a.length, segments_b.length); i += 1) {
99
- const segment_a = segments_a[i];
100
- const segment_b = segments_b[i];
101
- if (!segment_a)
102
- return -1;
103
- if (!segment_b)
104
- return 1;
105
- for (let j = 0; j < Math.max(segment_a.length, segment_b.length); j += 1) {
106
- const a = segment_a[j];
107
- const b = segment_b[j];
108
- const dynamic = (a == null ? void 0 : a[PART_TYPE]) || (b == null ? void 0 : b[PART_TYPE]);
109
- if (dynamic) {
110
- if (!a)
111
- return -1;
112
- if (!b)
113
- return 1;
114
- const next_a = ((_a = segment_a[j + 1]) == null ? void 0 : _a[PART_CONTENT]) || ((_c = (_b = segments_a[i + 1]) == null ? void 0 : _b[0]) == null ? void 0 : _c[PART_CONTENT]);
115
- const next_b = ((_d = segment_b[j + 1]) == null ? void 0 : _d[PART_CONTENT]) || ((_f = (_e = segments_b[i + 1]) == null ? void 0 : _e[0]) == null ? void 0 : _f[PART_CONTENT]);
116
- const both_have_next = next_a && next_b;
117
- const only_a_has_next = next_a && !next_b;
118
- const only_b_has_next = !next_a && next_b;
119
- if ((a[PART_TYPE] && b[PART_TYPE]) === REST) {
120
- if (both_have_next)
121
- continue;
122
- if (only_a_has_next)
123
- return -1;
124
- if (only_b_has_next)
125
- return 1;
126
- }
127
- if (a[PART_TYPE] === REST)
128
- return only_a_has_next ? -1 : 1;
129
- if (b[PART_TYPE] === REST)
130
- return only_b_has_next ? 1 : -1;
131
- if (a[PART_MATCHED] !== b[PART_MATCHED])
132
- return (-1) ** +a[PART_MATCHED];
133
- if (a[PART_TYPE] !== b[PART_TYPE]) {
134
- return (-1) ** +(a[PART_TYPE] > b[PART_TYPE]);
135
- }
136
- } else if ((a == null ? void 0 : a[PART_CONTENT]) !== (b == null ? void 0 : b[PART_CONTENT])) {
137
- return sort_static(a[PART_CONTENT], b[PART_CONTENT]);
138
- }
139
- }
140
- }
141
- return route_a < route_b ? 1 : -1;
142
- });
143
- }
144
- function cached(fn) {
145
- const cache = /* @__PURE__ */ new Map();
146
- return (arg) => {
147
- if (!cache.has(arg))
148
- cache.set(arg, fn(arg));
149
- return cache.get(arg);
150
- };
151
- }
152
- function split(id) {
153
- const parts = [];
154
- let i = 0;
155
- while (i <= id.length) {
156
- const start = id.indexOf("[", i);
157
- const entirelyStatic = start === -1;
158
- parts.push([STATIC, id.slice(i, entirelyStatic ? void 0 : start), false]);
159
- if (entirelyStatic)
160
- break;
161
- const type = id[start + 1] === "[" ? OPTIONAL : id[start + 1] === "." ? REST : REQUIRED;
162
- const endBrackets = type === OPTIONAL ? "]]" : "]";
163
- const endBracketIdx = id.indexOf(endBrackets, start);
164
- if (endBracketIdx === -1)
165
- throw new Error(`Invalid route definition ${id}`);
166
- const content = id.slice(start, i = endBracketIdx + endBrackets.length);
167
- parts.push([type, content, content.includes("=")]);
168
- }
169
- return parts;
170
- }
171
- const split_route_id = (id) => id.replace(/\[\[[^\]]+\]\](?!$)/g, "").split("/").filter(Boolean);
172
- function sort_static(a, b) {
173
- if (a === b)
174
- return 0;
175
- let idx = 0;
176
- while (a[idx] === b[idx])
177
- idx++;
178
- return !a[idx] ? 1 : !b[idx] ? -1 : a[idx] < b[idx] ? -1 : 1;
179
- }
180
- const param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
181
- function parseRouteDefinition(id) {
182
- const params = [];
183
- const pattern = id === "/" ? /^\/$/ : new RegExp(
184
- `^${get_route_segments(id).map((segment) => {
185
- const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
186
- if (rest_match) {
187
- params.push({
188
- name: rest_match[1],
189
- matcher: rest_match[2],
190
- optional: false,
191
- rest: true,
192
- chained: true
193
- });
194
- return "(?:/(.*))?";
195
- }
196
- const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
197
- if (optional_match) {
198
- params.push({
199
- name: optional_match[1],
200
- matcher: optional_match[2],
201
- optional: true,
202
- rest: false,
203
- chained: true
204
- });
205
- return "(?:/([^/]+))?";
206
- }
207
- if (!segment) {
208
- return;
209
- }
210
- const parts = segment.split(/\[(.+?)\](?!\])/);
211
- const result = parts.map((content, i) => {
212
- if (i % 2) {
213
- if (content.startsWith("x+")) {
214
- return escape(String.fromCharCode(parseInt(content.slice(2), 16)));
215
- }
216
- if (content.startsWith("u+")) {
217
- return escape(
218
- String.fromCharCode(
219
- ...content.slice(2).split("-").map((code) => parseInt(code, 16))
220
- )
221
- );
222
- }
223
- const match = (
224
- /** @type {RegExpExecArray} */
225
- param_pattern.exec(content)
226
- );
227
- if (!match) {
228
- throw new Error(`Invalid param: ${content}`);
229
- }
230
- const [, is_optional, is_rest, name, matcher] = match;
231
- params.push({
232
- name,
233
- matcher,
234
- optional: !!is_optional,
235
- rest: !!is_rest,
236
- chained: is_rest ? i === 1 && parts[0] === "" : false
237
- });
238
- return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
239
- }
240
- return escape(content);
241
- }).join("");
242
- return "/" + result;
243
- }).join("")}/?$`
244
- );
245
- return { pattern, params };
246
- }
247
- function exec(match, params, matchers) {
248
- const result = {};
249
- const values = match.slice(1);
250
- const values_needing_match = values.filter((v) => v !== void 0);
251
- let buffered = 0;
252
- for (const [i, param] of params.entries()) {
253
- let value = values[i - buffered];
254
- if (param.chained && param.rest && buffered) {
255
- value = values.slice(i - buffered, i + 1).filter((s) => s).join("/");
256
- buffered = 0;
257
- }
258
- if (value === void 0) {
259
- if (param.rest)
260
- result[param.name] = "";
261
- continue;
262
- }
263
- if (param.matcher && !matchers[param.matcher])
264
- return void 0;
265
- const matcher = matchers[param.matcher] ?? (() => true);
266
- if (matcher(value)) {
267
- result[param.name] = value;
268
- const next_param = params[i + 1];
269
- const next_value = values[i + 1];
270
- if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) {
271
- buffered = 0;
272
- }
273
- if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) {
274
- buffered = 0;
275
- }
276
- continue;
277
- }
278
- if (param.optional && param.chained) {
279
- buffered++;
280
- continue;
281
- }
282
- return;
283
- }
284
- if (buffered)
285
- return;
286
- return result;
287
- }
288
- function escape(str) {
289
- return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
290
- }
291
- const basic_param_pattern = /\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;
292
- function resolveRoute(id, params) {
293
- return "/" + get_route_segments(id).map(
294
- (segment) => segment.replace(basic_param_pattern, (_, optional, rest, name) => {
295
- const param_value = params[name];
296
- if (!param_value) {
297
- if (optional || rest && param_value !== void 0)
298
- return "";
299
- else
300
- throw new Error(`Missing parameter '${name}' in route ${id}`);
301
- }
302
- if (param_value[0] == "/" || param_value.endsWith("/"))
303
- throw new Error(`Parameter '${name}' in route ${id} cannot start or end with a slash`);
304
- return param_value;
305
- })
306
- ).filter(Boolean).join("/");
307
- }
308
- function bestMatch(canonicalPath, pathDefinitions, matchers) {
309
- const sorted = sort_routes(pathDefinitions);
310
- for (const pathDefinition of sorted) {
311
- const route = parseRouteDefinition(pathDefinition);
312
- const match = route.pattern.exec(removeTrailingSlash(canonicalPath));
313
- if (!match)
314
- continue;
315
- const params = exec(match, route.params, matchers);
316
- if (params)
317
- return { params, id: pathDefinition };
318
- }
319
- return void 0;
320
- }
321
- const removeTrailingSlash = (path) => path.endsWith("/") ? path.slice(0, -1) : path;
322
- const get_route_segments = (route) => route.slice(1).split("/");
323
- function validatePathTranslations(pathTranslations, availableLanguageTags, matchers) {
324
- const issues = [];
325
- const expectedLanguages = new Set(availableLanguageTags);
326
- const availableMatchers = new Set(Object.keys(matchers));
327
- for (const path in pathTranslations) {
328
- if (!isValidPath(path)) {
329
- issues.push({
330
- path,
331
- message: "Path must start with a slash."
332
- });
333
- continue;
334
- }
335
- const { params: expectedParams } = parseRouteDefinition(path);
336
- const expectedMatchers = expectedParams.map((param) => param.matcher).filter(Boolean);
337
- for (const matcher of expectedMatchers) {
338
- if (!availableMatchers.has(matcher)) {
339
- issues.push({
340
- path,
341
- message: `Matcher ${matcher} is used but not available. Did you forget to pass it to createI18n?`
342
- });
343
- }
344
- }
345
- const translations = pathTranslations[path];
346
- if (!translations)
347
- continue;
348
- for (const [lang, translatedPath] of Object.entries(translations)) {
349
- if (!isValidPath(translatedPath)) {
350
- issues.push({
351
- path,
352
- message: `The translation for language ${lang} must start with a slash.`
353
- });
354
- }
355
- const { params: actualParams } = parseRouteDefinition(translatedPath);
356
- let paramsDontMatch = false;
357
- for (const param of expectedParams) {
358
- if (!actualParams.some((actualParam) => paramsAreEqual(param, actualParam))) {
359
- paramsDontMatch = true;
360
- }
361
- }
362
- if (expectedParams.length !== actualParams.length) {
363
- paramsDontMatch = true;
364
- }
365
- if (paramsDontMatch) {
366
- issues.push({
367
- path,
368
- message: `The translation for language ${lang} must have the same parameters as the canonical path.`
369
- });
370
- }
371
- }
372
- const translatedLanguages = new Set(Object.keys(translations));
373
- if (!isSubset(expectedLanguages, translatedLanguages)) {
374
- const missingLanguages = new Set(expectedLanguages);
375
- for (const lang of translatedLanguages) {
376
- missingLanguages.delete(lang);
377
- }
378
- issues.push({
379
- path,
380
- message: `The following languages are missing translations: ${[...missingLanguages].join(
381
- ", "
382
- )}`
383
- });
384
- }
385
- }
386
- return issues;
387
- }
388
- function paramsAreEqual(param1, param2) {
389
- return param1.chained == param2.chained && param1.matcher == param2.matcher && param1.name == param2.name && param1.optional == param2.optional && param1.rest == param2.rest;
390
- }
391
- function isValidPath(maybePath) {
392
- return maybePath.startsWith("/");
393
- }
394
- function isSubset(a, b) {
395
- for (const value of a) {
396
- if (!b.has(value))
397
- return false;
398
- }
399
- return true;
400
- }
401
- function prettyPrintPathDefinitionIssues(issues) {
402
- return issues.map((issue) => `${issue.path}: ${issue.message}`).join("\n");
403
- }
404
- const resolveUserPathDefinitions = (userTranslations, availableLanguageTags) => Object.fromEntries(
405
- Object.entries(userTranslations).map(([path, translation]) => [
406
- path,
407
- typeof translation === "object" ? translation : fromMessage(translation, availableLanguageTags)
408
- ])
409
- );
410
- const fromMessage = (message, availableLanguageTags) => Object.fromEntries(
411
- availableLanguageTags.map((languageTag) => [languageTag, message({}, { languageTag })])
412
- );
413
- export {
414
- bestMatch,
415
- detectLanguageFromPath,
416
- negotiateLanguagePreferences,
417
- parseRouteDefinition,
418
- prettyPrintPathDefinitionIssues,
419
- resolveRoute,
420
- resolveUserPathDefinitions,
421
- validatePathTranslations
422
- };
1
+ export { negotiateLanguagePreferences } from "./negotiation/language.js";
2
+ export { detectLanguageFromPath } from "./routing/detectLanguage.js";
3
+ export { bestMatch, resolveRoute, parseRouteDefinition, } from "./routing/routeDefinitions.js";
4
+ export { validatePathTranslations, prettyPrintPathDefinitionIssues, } from "./routing/validatePathTranslations.js";
5
+ export { resolveUserPathDefinitions, } from "./routing/resolveUserPathDefinitions.js";
@@ -7,3 +7,4 @@
7
7
  * @returns The acceptable available language tags in descending order of preference
8
8
  */
9
9
  export declare function negotiateLanguagePreferences<T extends string = string>(accept: string | undefined | null, availableLanguageTags: readonly T[]): T[];
10
+ //# sourceMappingURL=language.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../../src/adapter-utils/negotiation/language.ts"],"names":[],"mappings":"AA+EA;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACrE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACjC,qBAAqB,EAAE,SAAS,CAAC,EAAE,GACjC,CAAC,EAAE,CAkBL"}
@@ -0,0 +1,137 @@
1
+ // Vendored in from https://github.com/jshttp/negotiator
2
+ // Rewritten in Typescript & annotated by Loris Sigrist
3
+ /**
4
+ * Negotiates which of the provided language tags is preferred from an Accept-Language header
5
+ *
6
+ * @param accept The value of the Accept-Language header. If it's missing, it defaults to "*" as per RFC 2616 sec 14.4
7
+ * @param availableLanguageTags The BCP 47 language tags that are available
8
+ *
9
+ * @returns The acceptable available language tags in descending order of preference
10
+ */
11
+ export function negotiateLanguagePreferences(accept, availableLanguageTags) {
12
+ // No accept-language header -> default to * as per RFC 2616 sec 14.4
13
+ accept ||= "*";
14
+ const acceptLanguageSpecs = parseAcceptLanguageHeader(accept);
15
+ // compare each avaibale language to each language in the Accept-Language header
16
+ // and find the one with the highest priority
17
+ const priorities = availableLanguageTags.map((languageTag, index) => getHighestLanguagePriority(languageTag, acceptLanguageSpecs, index));
18
+ // sorted list of accepted languages
19
+ return priorities
20
+ .filter((prio) => prio.quality > 0) //filter out all languages that didn't match any of the headers whatsoever
21
+ .sort(bySpecificity)
22
+ .sort(byQuality)
23
+ .map((priority) => priority.languageTag);
24
+ }
25
+ function parseAcceptLanguageHeader(acceptLanguage) {
26
+ return acceptLanguage
27
+ .split(",")
28
+ .map((dfn) => dfn.trim())
29
+ .map((dfn, index) => parseLanguage(dfn, index))
30
+ .filter((maybeSpec) => Boolean(maybeSpec)); //filter out malformed entries
31
+ }
32
+ /**
33
+ * Parse a single language from the Accept-Language header.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * parseLanguage("en-GB;q=0.8", 6) //{ prefix: "en", suffix: "GB", full: "en-GB", quality: 0.8, index: 6 }
38
+ * ```
39
+ *
40
+ * @param languageTag The string to parse
41
+ * @param index The index of the language in the Accept-Language header
42
+ */
43
+ function parseLanguage(languageTag, index) {
44
+ const LANGUAGE_REGEXP = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;
45
+ const match = LANGUAGE_REGEXP.exec(languageTag);
46
+ //Bail if the string is malformed
47
+ if (!match)
48
+ return undefined;
49
+ const [, prefix, suffix, qualityMatch] = match;
50
+ //shoud never happen given that the regex forces it to be there
51
+ if (!prefix)
52
+ throw new Error(`Invalid language tag: ${languageTag}`);
53
+ const full = suffix ? `${prefix}-${suffix}` : prefix;
54
+ /**
55
+ * If the language specifies a quality, parse it, otherwise default to 1
56
+ * as per RFC 2616
57
+ */
58
+ const quality = parseQuality(qualityMatch ?? "") ?? 1;
59
+ return {
60
+ prefix,
61
+ suffix,
62
+ quality,
63
+ index,
64
+ full,
65
+ };
66
+ }
67
+ function parseQuality(qualityMatch) {
68
+ return qualityMatch
69
+ .split(";")
70
+ .map((param) => param.split("="))
71
+ .filter((p) => p[0] == "q" && !!p[1]) //filter out everything that's malformed or not a quality
72
+ .map(([, value]) => parseFloat(value))[0]; //parse the quality value & return the first one
73
+ }
74
+ /**
75
+ * Calculates the LanguagePriority of the availableLanguageTag
76
+ * relative to all acceptableLanguages and returns the greatest one
77
+ */
78
+ function getHighestLanguagePriority(
79
+ /**
80
+ * A language tag that's available in the project
81
+ */
82
+ languageTag,
83
+ /**
84
+ * The langauges from the Accept-Language header
85
+ */
86
+ acceptableLanguages,
87
+ /**
88
+ * The index of the available language among the available languages
89
+ */
90
+ index) {
91
+ const priorities = acceptableLanguages
92
+ .map((spec) => calculatePriority(languageTag, spec, index))
93
+ .filter((prio) => Boolean(prio));
94
+ const highestPriority = priorities.sort(bySpecificity)[0] || {
95
+ languageTag,
96
+ index: 0,
97
+ order: -1,
98
+ quality: 0,
99
+ specificity: 0,
100
+ };
101
+ return highestPriority;
102
+ }
103
+ /**
104
+ * Calculates the priority of an available language relative to an acceptable language
105
+ * @param languageTag A language that is available in the project
106
+ * @param spec A parsed language from the Accept-Language header
107
+ * @param index The index of the available language
108
+ * @returns The priority of the language
109
+ */
110
+ function calculatePriority(languageTag, spec, index) {
111
+ const parsed = parseLanguage(languageTag, 0);
112
+ if (!parsed)
113
+ return undefined;
114
+ let specificity = 0b000;
115
+ if (spec.full.toLowerCase() === parsed.full.toLowerCase()) {
116
+ specificity = 0b100;
117
+ }
118
+ else if (spec.prefix.toLowerCase() === parsed.full.toLowerCase()) {
119
+ specificity = 0b010;
120
+ }
121
+ else if (spec.full.toLowerCase() === parsed.prefix.toLowerCase()) {
122
+ specificity = 0b001;
123
+ }
124
+ // if there is no specificity at all _and_ we're not considering a wildcard
125
+ // then we bail
126
+ if (specificity === 0 && spec.full !== "*")
127
+ return undefined;
128
+ return {
129
+ languageTag,
130
+ index,
131
+ order: spec.index,
132
+ quality: spec.quality,
133
+ specificity,
134
+ };
135
+ }
136
+ const byQuality = (a, b) => b.quality - a.quality;
137
+ const bySpecificity = (a, b) => b.specificity - a.specificity || a.order - b.order || a.index - b.index;
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=language.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language.test.d.ts","sourceRoot":"","sources":["../../../src/adapter-utils/negotiation/language.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { negotiateLanguagePreferences } from "./language.js";
3
+ describe("preferredLanguages", () => {
4
+ it("should return the acceptable languages", () => {
5
+ expect(negotiateLanguagePreferences("de-CH", ["de", "de-CH"])).toEqual([
6
+ "de-CH",
7
+ "de",
8
+ ]);
9
+ });
10
+ it("should return an empty array if there are no acceptable languages", () => {
11
+ expect(negotiateLanguagePreferences("de-CH", [])).toEqual([]);
12
+ });
13
+ it("should sort the matches by quality", () => {
14
+ const headerValue = "fr-CH, fr;q=0.6, en;q=0.8, de;q=0.7, *;q=0.5";
15
+ expect(negotiateLanguagePreferences(headerValue, ["fr-CH", "fr", "en", "de"])).toEqual(["fr-CH", "en", "de", "fr"]);
16
+ });
17
+ it("should return the available languages if the accept header is missing", () => {
18
+ expect(negotiateLanguagePreferences(undefined, ["en-US", "en-GB", "de"])).toEqual(["en-US", "en-GB", "de"]);
19
+ });
20
+ it("should use the index of the language as a tie-breaker if the quality is the same", () => {
21
+ const headerValue = "fr-CH, fr;q=0.8, en;q=0.8, de;q=0.7, *;q=0.5";
22
+ expect(negotiateLanguagePreferences(headerValue, ["fr-CH", "fr", "en", "de"])).toEqual(["fr-CH", "fr", "en", "de"]);
23
+ });
24
+ });