@inlang/sdk 0.36.4 → 2.0.0-beta.2

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 (727) hide show
  1. package/README.md +1 -1
  2. package/dist/database/initDb.d.ts +7 -0
  3. package/dist/database/initDb.d.ts.map +1 -0
  4. package/dist/database/initDb.js +36 -0
  5. package/dist/database/initDb.js.map +1 -0
  6. package/dist/database/initDbAndSchema.test.d.ts +2 -0
  7. package/dist/database/initDbAndSchema.test.d.ts.map +1 -0
  8. package/dist/database/initDbAndSchema.test.js +110 -0
  9. package/dist/database/initDbAndSchema.test.js.map +1 -0
  10. package/dist/database/jsonbPlugin.d.ts +20 -0
  11. package/dist/database/jsonbPlugin.d.ts.map +1 -0
  12. package/dist/database/jsonbPlugin.js +183 -0
  13. package/dist/database/jsonbPlugin.js.map +1 -0
  14. package/dist/database/jsonbPlugin.test.d.ts +2 -0
  15. package/dist/database/jsonbPlugin.test.d.ts.map +1 -0
  16. package/dist/database/jsonbPlugin.test.js +119 -0
  17. package/dist/database/jsonbPlugin.test.js.map +1 -0
  18. package/dist/database/schema.d.ts +74 -0
  19. package/dist/database/schema.d.ts.map +1 -0
  20. package/dist/database/schema.js +45 -0
  21. package/dist/database/schema.js.map +1 -0
  22. package/dist/helper.d.ts +71 -0
  23. package/dist/helper.d.ts.map +1 -0
  24. package/dist/helper.js +91 -0
  25. package/dist/helper.js.map +1 -0
  26. package/dist/human-id/human-id.d.ts +3 -0
  27. package/dist/human-id/human-id.d.ts.map +1 -0
  28. package/dist/human-id/human-id.js +12 -0
  29. package/dist/human-id/human-id.js.map +1 -0
  30. package/dist/human-id/words.d.ts.map +1 -0
  31. package/dist/{storage/human-id → human-id}/words.js +4 -0
  32. package/dist/human-id/words.js.map +1 -0
  33. package/dist/human-id/words.test.d.ts.map +1 -0
  34. package/dist/{storage/human-id → human-id}/words.test.js +4 -0
  35. package/dist/human-id/words.test.js.map +1 -0
  36. package/dist/import-export/exportFiles.d.ts +11 -0
  37. package/dist/import-export/exportFiles.d.ts.map +1 -0
  38. package/dist/import-export/exportFiles.js +26 -0
  39. package/dist/import-export/exportFiles.js.map +1 -0
  40. package/dist/import-export/importFiles.d.ts +13 -0
  41. package/dist/import-export/importFiles.d.ts.map +1 -0
  42. package/dist/import-export/importFiles.js +124 -0
  43. package/dist/import-export/importFiles.js.map +1 -0
  44. package/dist/import-export/importFiles.test.d.ts +2 -0
  45. package/dist/import-export/importFiles.test.d.ts.map +1 -0
  46. package/dist/import-export/importFiles.test.js +179 -0
  47. package/dist/import-export/importFiles.test.js.map +1 -0
  48. package/dist/import-export/roundtrip.test.d.ts +2 -0
  49. package/dist/import-export/roundtrip.test.d.ts.map +1 -0
  50. package/dist/import-export/roundtrip.test.js +273 -0
  51. package/dist/import-export/roundtrip.test.js.map +1 -0
  52. package/dist/import-export/upsertBundleNestedMatchByProperties.d.ts +4 -0
  53. package/dist/import-export/upsertBundleNestedMatchByProperties.d.ts.map +1 -0
  54. package/dist/import-export/upsertBundleNestedMatchByProperties.js +58 -0
  55. package/dist/import-export/upsertBundleNestedMatchByProperties.js.map +1 -0
  56. package/dist/index.d.ts +21 -18
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +20 -17
  59. package/dist/index.js.map +1 -0
  60. package/dist/json-schema/old-v1-message/fromMessageV1.d.ts +9 -0
  61. package/dist/json-schema/old-v1-message/fromMessageV1.d.ts.map +1 -0
  62. package/dist/json-schema/old-v1-message/fromMessageV1.js +84 -0
  63. package/dist/json-schema/old-v1-message/fromMessageV1.js.map +1 -0
  64. package/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts +2 -0
  65. package/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts.map +1 -0
  66. package/dist/json-schema/old-v1-message/fromMessageV1.test.js +85 -0
  67. package/dist/json-schema/old-v1-message/fromMessageV1.test.js.map +1 -0
  68. package/dist/json-schema/old-v1-message/schemaV1.d.ts +86 -0
  69. package/dist/json-schema/old-v1-message/schemaV1.d.ts.map +1 -0
  70. package/dist/json-schema/old-v1-message/schemaV1.js +35 -0
  71. package/dist/json-schema/old-v1-message/schemaV1.js.map +1 -0
  72. package/dist/json-schema/old-v1-message/toMessageV1.d.ts +9 -0
  73. package/dist/json-schema/old-v1-message/toMessageV1.d.ts.map +1 -0
  74. package/dist/json-schema/old-v1-message/toMessageV1.js +67 -0
  75. package/dist/json-schema/old-v1-message/toMessageV1.js.map +1 -0
  76. package/dist/json-schema/old-v1-message/toMessageV1.test.d.ts +2 -0
  77. package/dist/json-schema/old-v1-message/toMessageV1.test.d.ts.map +1 -0
  78. package/dist/json-schema/old-v1-message/toMessageV1.test.js +85 -0
  79. package/dist/json-schema/old-v1-message/toMessageV1.test.js.map +1 -0
  80. package/dist/json-schema/pattern.d.ts +190 -0
  81. package/dist/json-schema/pattern.d.ts.map +1 -0
  82. package/dist/json-schema/pattern.js +43 -0
  83. package/dist/json-schema/pattern.js.map +1 -0
  84. package/dist/json-schema/settings.d.ts +31 -0
  85. package/dist/json-schema/settings.d.ts.map +1 -0
  86. package/dist/json-schema/settings.js +96 -0
  87. package/dist/json-schema/settings.js.map +1 -0
  88. package/dist/json-schema/settings.test-d.d.ts +2 -0
  89. package/dist/json-schema/settings.test-d.d.ts.map +1 -0
  90. package/dist/json-schema/settings.test-d.js +20 -0
  91. package/dist/json-schema/settings.test-d.js.map +1 -0
  92. package/dist/lix-plugin/applyChanges.d.ts +3 -0
  93. package/dist/lix-plugin/applyChanges.d.ts.map +1 -0
  94. package/dist/lix-plugin/applyChanges.js +127 -0
  95. package/dist/lix-plugin/applyChanges.js.map +1 -0
  96. package/dist/lix-plugin/applyChanges.test.d.ts +2 -0
  97. package/dist/lix-plugin/applyChanges.test.d.ts.map +1 -0
  98. package/dist/lix-plugin/applyChanges.test.js +135 -0
  99. package/dist/lix-plugin/applyChanges.test.js.map +1 -0
  100. package/dist/lix-plugin/detectConflicts.d.ts +3 -0
  101. package/dist/lix-plugin/detectConflicts.d.ts.map +1 -0
  102. package/dist/lix-plugin/detectConflicts.js +47 -0
  103. package/dist/lix-plugin/detectConflicts.js.map +1 -0
  104. package/dist/lix-plugin/detectConflicts.test.d.ts +2 -0
  105. package/dist/lix-plugin/detectConflicts.test.d.ts.map +1 -0
  106. package/dist/lix-plugin/detectConflicts.test.js +251 -0
  107. package/dist/lix-plugin/detectConflicts.test.js.map +1 -0
  108. package/dist/lix-plugin/inlangLixPluginV1.d.ts +8 -0
  109. package/dist/lix-plugin/inlangLixPluginV1.d.ts.map +1 -0
  110. package/dist/lix-plugin/inlangLixPluginV1.js +109 -0
  111. package/dist/lix-plugin/inlangLixPluginV1.js.map +1 -0
  112. package/dist/lix-plugin/inlangLixPluginV1.test.d.ts +2 -0
  113. package/dist/lix-plugin/inlangLixPluginV1.test.d.ts.map +1 -0
  114. package/dist/lix-plugin/inlangLixPluginV1.test.js +418 -0
  115. package/dist/lix-plugin/inlangLixPluginV1.test.js.map +1 -0
  116. package/dist/lix-plugin/merge.test.d.ts +2 -0
  117. package/dist/lix-plugin/merge.test.d.ts.map +1 -0
  118. package/dist/lix-plugin/merge.test.js +120 -0
  119. package/dist/lix-plugin/merge.test.js.map +1 -0
  120. package/dist/lix-plugin/resolveConflictBySelecting.test.d.ts +2 -0
  121. package/dist/lix-plugin/resolveConflictBySelecting.test.d.ts.map +1 -0
  122. package/dist/lix-plugin/resolveConflictBySelecting.test.js +176 -0
  123. package/dist/lix-plugin/resolveConflictBySelecting.test.js.map +1 -0
  124. package/dist/migrations/v2/createMessageV1.d.ts +28 -0
  125. package/dist/migrations/v2/createMessageV1.d.ts.map +1 -0
  126. package/dist/migrations/v2/createMessageV1.js +31 -0
  127. package/dist/migrations/v2/createMessageV1.js.map +1 -0
  128. package/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts +9 -0
  129. package/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts.map +1 -0
  130. package/dist/migrations/v2/withLanguageTagToLocaleMigration.js +31 -0
  131. package/dist/migrations/v2/withLanguageTagToLocaleMigration.js.map +1 -0
  132. package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts +2 -0
  133. package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts.map +1 -0
  134. package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js +45 -0
  135. package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js.map +1 -0
  136. package/dist/plugin/cache.d.ts +6 -0
  137. package/dist/plugin/cache.d.ts.map +1 -0
  138. package/dist/plugin/cache.js +59 -0
  139. package/dist/plugin/cache.js.map +1 -0
  140. package/dist/plugin/cache.test.d.ts +2 -0
  141. package/dist/plugin/cache.test.d.ts.map +1 -0
  142. package/dist/plugin/cache.test.js +61 -0
  143. package/dist/plugin/cache.test.js.map +1 -0
  144. package/dist/plugin/errors.d.ts +41 -0
  145. package/dist/plugin/errors.d.ts.map +1 -0
  146. package/dist/plugin/errors.js +48 -0
  147. package/dist/plugin/errors.js.map +1 -0
  148. package/dist/plugin/importPlugins.d.ts +19 -0
  149. package/dist/plugin/importPlugins.d.ts.map +1 -0
  150. package/dist/plugin/importPlugins.js +43 -0
  151. package/dist/plugin/importPlugins.js.map +1 -0
  152. package/dist/plugin/importPlugins.test.d.ts +2 -0
  153. package/dist/plugin/importPlugins.test.d.ts.map +1 -0
  154. package/dist/plugin/importPlugins.test.js +95 -0
  155. package/dist/plugin/importPlugins.test.js.map +1 -0
  156. package/dist/plugin/meta/ideExtension.d.ts +54 -0
  157. package/dist/plugin/meta/ideExtension.d.ts.map +1 -0
  158. package/dist/plugin/meta/ideExtension.js +5 -0
  159. package/dist/plugin/meta/ideExtension.js.map +1 -0
  160. package/dist/plugin/schema.d.ts +152 -0
  161. package/dist/plugin/schema.d.ts.map +1 -0
  162. package/dist/plugin/schema.js +5 -0
  163. package/dist/plugin/schema.js.map +1 -0
  164. package/dist/project/api.d.ts +74 -0
  165. package/dist/project/api.d.ts.map +1 -0
  166. package/dist/project/api.js +5 -0
  167. package/dist/project/api.js.map +1 -0
  168. package/dist/project/initHandleSaveToLixOnChange.d.ts +14 -0
  169. package/dist/project/initHandleSaveToLixOnChange.d.ts.map +1 -0
  170. package/dist/project/initHandleSaveToLixOnChange.js +87 -0
  171. package/dist/project/initHandleSaveToLixOnChange.js.map +1 -0
  172. package/dist/project/loadProject.d.ts +53 -0
  173. package/dist/project/loadProject.d.ts.map +1 -0
  174. package/dist/project/loadProject.js +168 -0
  175. package/dist/project/loadProject.js.map +1 -0
  176. package/dist/project/loadProject.test.d.ts.map +1 -0
  177. package/dist/project/loadProject.test.js +146 -0
  178. package/dist/project/loadProject.test.js.map +1 -0
  179. package/dist/project/loadProjectFromDirectory.d.ts +77 -0
  180. package/dist/project/loadProjectFromDirectory.d.ts.map +1 -0
  181. package/dist/project/loadProjectFromDirectory.js +584 -0
  182. package/dist/project/loadProjectFromDirectory.js.map +1 -0
  183. package/dist/project/loadProjectFromDirectory.test.d.ts +2 -0
  184. package/dist/project/loadProjectFromDirectory.test.d.ts.map +1 -0
  185. package/dist/project/loadProjectFromDirectory.test.js +663 -0
  186. package/dist/project/loadProjectFromDirectory.test.js.map +1 -0
  187. package/dist/project/loadProjectInMemory.d.ts +8 -0
  188. package/dist/project/loadProjectInMemory.d.ts.map +1 -0
  189. package/dist/project/loadProjectInMemory.js +32 -0
  190. package/dist/project/loadProjectInMemory.js.map +1 -0
  191. package/dist/project/loadProjectInMemory.test.d.ts +2 -0
  192. package/dist/project/loadProjectInMemory.test.d.ts.map +1 -0
  193. package/dist/project/loadProjectInMemory.test.js +27 -0
  194. package/dist/project/loadProjectInMemory.test.js.map +1 -0
  195. package/dist/project/maybeCaptureTelemetry.d.ts +15 -0
  196. package/dist/project/maybeCaptureTelemetry.d.ts.map +1 -0
  197. package/dist/project/maybeCaptureTelemetry.js +58 -0
  198. package/dist/project/maybeCaptureTelemetry.js.map +1 -0
  199. package/dist/project/maybeCaptureTelemetry.test.d.ts +2 -0
  200. package/dist/project/maybeCaptureTelemetry.test.d.ts.map +1 -0
  201. package/dist/project/maybeCaptureTelemetry.test.js +71 -0
  202. package/dist/project/maybeCaptureTelemetry.test.js.map +1 -0
  203. package/dist/project/newProject.d.ts +17 -0
  204. package/dist/project/newProject.d.ts.map +1 -0
  205. package/dist/project/newProject.js +71 -0
  206. package/dist/project/newProject.js.map +1 -0
  207. package/dist/project/newProject.test.d.ts +2 -0
  208. package/dist/project/newProject.test.d.ts.map +1 -0
  209. package/dist/project/newProject.test.js +37 -0
  210. package/dist/project/newProject.test.js.map +1 -0
  211. package/dist/project/saveProjectToDirectory.d.ts +8 -0
  212. package/dist/project/saveProjectToDirectory.d.ts.map +1 -0
  213. package/dist/project/saveProjectToDirectory.js +86 -0
  214. package/dist/project/saveProjectToDirectory.js.map +1 -0
  215. package/dist/project/saveProjectToDirectory.test.d.ts +2 -0
  216. package/dist/project/saveProjectToDirectory.test.d.ts.map +1 -0
  217. package/dist/project/saveProjectToDirectory.test.js +245 -0
  218. package/dist/project/saveProjectToDirectory.test.js.map +1 -0
  219. package/dist/project/state/id$.d.ts +6 -0
  220. package/dist/project/state/id$.d.ts.map +1 -0
  221. package/dist/project/state/id$.js +19 -0
  222. package/dist/project/state/id$.js.map +1 -0
  223. package/dist/project/state/id$.test.d.ts +2 -0
  224. package/dist/project/state/id$.test.d.ts.map +1 -0
  225. package/dist/project/state/id$.test.js +36 -0
  226. package/dist/project/state/id$.test.js.map +1 -0
  227. package/dist/project/state/setSettings.d.ts +7 -0
  228. package/dist/project/state/setSettings.d.ts.map +1 -0
  229. package/dist/project/state/setSettings.js +16 -0
  230. package/dist/project/state/setSettings.js.map +1 -0
  231. package/dist/project/state/setSettings.test.d.ts +2 -0
  232. package/dist/project/state/setSettings.test.d.ts.map +1 -0
  233. package/dist/project/state/setSettings.test.js +58 -0
  234. package/dist/project/state/setSettings.test.js.map +1 -0
  235. package/dist/project/state/settings$.d.ts +7 -0
  236. package/dist/project/state/settings$.d.ts.map +1 -0
  237. package/dist/project/state/settings$.js +21 -0
  238. package/dist/project/state/settings$.js.map +1 -0
  239. package/dist/project/state/settings$.test.d.ts +2 -0
  240. package/dist/project/state/settings$.test.d.ts.map +1 -0
  241. package/dist/project/state/settings$.test.js +51 -0
  242. package/dist/project/state/settings$.test.js.map +1 -0
  243. package/dist/project/state/state.d.ts +58 -0
  244. package/dist/project/state/state.d.ts.map +1 -0
  245. package/dist/project/state/state.js +67 -0
  246. package/dist/project/state/state.js.map +1 -0
  247. package/dist/project/state/state.test.d.ts +2 -0
  248. package/dist/project/state/state.test.d.ts.map +1 -0
  249. package/dist/project/state/state.test.js +103 -0
  250. package/dist/project/state/state.test.js.map +1 -0
  251. package/dist/query-utilities/index.d.ts +5 -0
  252. package/dist/query-utilities/index.d.ts.map +1 -0
  253. package/dist/query-utilities/index.js +8 -0
  254. package/dist/query-utilities/index.js.map +1 -0
  255. package/dist/query-utilities/insertBundleNested.d.ts +4 -0
  256. package/dist/query-utilities/insertBundleNested.d.ts.map +1 -0
  257. package/dist/query-utilities/insertBundleNested.js +39 -0
  258. package/dist/query-utilities/insertBundleNested.js.map +1 -0
  259. package/dist/query-utilities/pollQuery.d.ts +14 -0
  260. package/dist/query-utilities/pollQuery.d.ts.map +1 -0
  261. package/dist/query-utilities/pollQuery.js +22 -0
  262. package/dist/query-utilities/pollQuery.js.map +1 -0
  263. package/dist/query-utilities/pollQuery.test.d.ts +2 -0
  264. package/dist/query-utilities/pollQuery.test.d.ts.map +1 -0
  265. package/dist/query-utilities/pollQuery.test.js +67 -0
  266. package/dist/query-utilities/pollQuery.test.js.map +1 -0
  267. package/dist/query-utilities/selectBundleNested.d.ts +107 -0
  268. package/dist/query-utilities/selectBundleNested.d.ts.map +1 -0
  269. package/dist/query-utilities/selectBundleNested.js +43 -0
  270. package/dist/query-utilities/selectBundleNested.js.map +1 -0
  271. package/dist/query-utilities/updateBundleNested.d.ts +12 -0
  272. package/dist/query-utilities/updateBundleNested.d.ts.map +1 -0
  273. package/dist/query-utilities/updateBundleNested.js +25 -0
  274. package/dist/query-utilities/updateBundleNested.js.map +1 -0
  275. package/dist/query-utilities/upsertBundleNested.d.ts +4 -0
  276. package/dist/query-utilities/upsertBundleNested.d.ts.map +1 -0
  277. package/dist/query-utilities/upsertBundleNested.js +50 -0
  278. package/dist/query-utilities/upsertBundleNested.js.map +1 -0
  279. package/dist/services/env-variables/index.d.ts +6 -0
  280. package/dist/services/env-variables/index.d.ts.map +1 -0
  281. package/dist/services/env-variables/index.js +9 -0
  282. package/dist/services/env-variables/index.js.map +1 -0
  283. package/dist/services/error-reporting/index.d.ts +15 -0
  284. package/dist/services/error-reporting/index.d.ts.map +1 -0
  285. package/dist/services/error-reporting/index.js +30 -0
  286. package/dist/services/error-reporting/index.js.map +1 -0
  287. package/dist/{telemetry → services/telemetry}/capture.d.ts +5 -2
  288. package/dist/services/telemetry/capture.d.ts.map +1 -0
  289. package/dist/services/telemetry/capture.js +76 -0
  290. package/dist/services/telemetry/capture.js.map +1 -0
  291. package/dist/services/telemetry/capture.test.d.ts +2 -0
  292. package/dist/services/telemetry/capture.test.d.ts.map +1 -0
  293. package/dist/services/telemetry/capture.test.js +46 -0
  294. package/dist/services/telemetry/capture.test.js.map +1 -0
  295. package/dist/utilities/detectJsonFormatting.d.ts +11 -0
  296. package/dist/utilities/detectJsonFormatting.d.ts.map +1 -0
  297. package/dist/utilities/detectJsonFormatting.js +83 -0
  298. package/dist/utilities/detectJsonFormatting.js.map +1 -0
  299. package/dist/utilities/detectJsonFormatting.test.d.ts +2 -0
  300. package/dist/utilities/detectJsonFormatting.test.d.ts.map +1 -0
  301. package/dist/utilities/detectJsonFormatting.test.js +33 -0
  302. package/dist/utilities/detectJsonFormatting.test.js.map +1 -0
  303. package/package.json +32 -40
  304. package/src/database/initDb.ts +34 -0
  305. package/src/database/initDbAndSchema.test.ts +125 -0
  306. package/src/database/jsonbPlugin.test.ts +154 -0
  307. package/src/database/jsonbPlugin.ts +215 -0
  308. package/src/database/schema.ts +127 -0
  309. package/src/helper.ts +113 -0
  310. package/src/human-id/human-id.ts +14 -0
  311. package/src/{storage/human-id → human-id}/words.test.ts +14 -14
  312. package/src/{storage/human-id → human-id}/words.ts +4 -4
  313. package/src/import-export/exportFiles.ts +36 -0
  314. package/src/import-export/importFiles.test.ts +211 -0
  315. package/src/import-export/importFiles.ts +142 -0
  316. package/src/import-export/roundtrip.test.ts +313 -0
  317. package/src/import-export/upsertBundleNestedMatchByProperties.ts +74 -0
  318. package/src/index.ts +29 -37
  319. package/src/json-schema/old-v1-message/README.md +1 -0
  320. package/src/json-schema/old-v1-message/fromMessageV1.test.ts +87 -0
  321. package/src/json-schema/old-v1-message/fromMessageV1.ts +99 -0
  322. package/src/json-schema/old-v1-message/schemaV1.ts +66 -0
  323. package/src/json-schema/old-v1-message/toMessageV1.test.ts +87 -0
  324. package/src/json-schema/old-v1-message/toMessageV1.ts +79 -0
  325. package/src/json-schema/pattern.ts +59 -0
  326. package/src/json-schema/settings.test-d.ts +21 -0
  327. package/src/json-schema/settings.ts +138 -0
  328. package/src/lix-plugin/applyChanges.test.ts +150 -0
  329. package/src/lix-plugin/applyChanges.ts +171 -0
  330. package/src/lix-plugin/detectConflicts.test.ts +286 -0
  331. package/src/lix-plugin/detectConflicts.ts +62 -0
  332. package/src/lix-plugin/inlangLixPluginV1.test.ts +439 -0
  333. package/src/lix-plugin/inlangLixPluginV1.ts +132 -0
  334. package/src/lix-plugin/merge.test.ts +133 -0
  335. package/src/lix-plugin/resolveConflictBySelecting.test.ts +188 -0
  336. package/src/migrations/v2/createMessageV1.ts +37 -0
  337. package/src/migrations/v2/withLanguageTagToLocaleMigration.test.ts +51 -0
  338. package/src/migrations/v2/withLanguageTagToLocaleMigration.ts +31 -0
  339. package/src/plugin/cache.test.ts +83 -0
  340. package/src/plugin/cache.ts +79 -0
  341. package/src/plugin/errors.ts +67 -0
  342. package/src/plugin/importPlugins.test.ts +107 -0
  343. package/src/plugin/importPlugins.ts +60 -0
  344. package/src/plugin/meta/ideExtension.ts +56 -0
  345. package/src/plugin/schema.ts +165 -0
  346. package/src/project/api.ts +77 -0
  347. package/src/project/initHandleSaveToLixOnChange.ts +93 -0
  348. package/src/project/loadProject.test.ts +176 -0
  349. package/src/project/loadProject.ts +246 -0
  350. package/src/project/loadProjectFromDirectory.test.ts +854 -0
  351. package/src/project/loadProjectFromDirectory.ts +752 -0
  352. package/src/project/loadProjectInMemory.test.ts +29 -0
  353. package/src/project/loadProjectInMemory.ts +36 -0
  354. package/src/project/maybeCaptureTelemetry.test.ts +79 -0
  355. package/src/project/maybeCaptureTelemetry.ts +69 -0
  356. package/src/project/newProject.test.ts +36 -0
  357. package/src/project/newProject.ts +78 -0
  358. package/src/project/saveProjectToDirectory.test.ts +310 -0
  359. package/src/project/saveProjectToDirectory.ts +100 -0
  360. package/src/query-utilities/index.ts +4 -0
  361. package/src/query-utilities/insertBundleNested.ts +46 -0
  362. package/src/query-utilities/selectBundleNested.ts +46 -0
  363. package/src/query-utilities/updateBundleNested.ts +35 -0
  364. package/src/query-utilities/upsertBundleNested.ts +61 -0
  365. package/src/services/env-variables/createIndexFile.js +40 -0
  366. package/src/{env-variables → services/env-variables}/index.d.ts +8 -5
  367. package/src/services/error-reporting/index.ts +28 -0
  368. package/src/services/telemetry/capture.test.ts +50 -0
  369. package/src/services/telemetry/capture.ts +99 -0
  370. package/src/utilities/detectJsonFormatting.test.ts +38 -0
  371. package/src/utilities/detectJsonFormatting.ts +109 -0
  372. package/dist/adapter/solidAdapter.d.ts +0 -33
  373. package/dist/adapter/solidAdapter.d.ts.map +0 -1
  374. package/dist/adapter/solidAdapter.js +0 -40
  375. package/dist/adapter/solidAdapter.test.d.ts +0 -2
  376. package/dist/adapter/solidAdapter.test.d.ts.map +0 -1
  377. package/dist/adapter/solidAdapter.test.js +0 -356
  378. package/dist/api.d.ts +0 -113
  379. package/dist/api.d.ts.map +0 -1
  380. package/dist/api.js +0 -1
  381. package/dist/api.test-d.d.ts +0 -2
  382. package/dist/api.test-d.d.ts.map +0 -1
  383. package/dist/api.test-d.js +0 -4
  384. package/dist/createMessageLintReportsQuery.d.ts +0 -12
  385. package/dist/createMessageLintReportsQuery.d.ts.map +0 -1
  386. package/dist/createMessageLintReportsQuery.js +0 -176
  387. package/dist/createMessagesQuery.d.ts +0 -19
  388. package/dist/createMessagesQuery.d.ts.map +0 -1
  389. package/dist/createMessagesQuery.js +0 -451
  390. package/dist/createMessagesQuery.test.d.ts +0 -2
  391. package/dist/createMessagesQuery.test.d.ts.map +0 -1
  392. package/dist/createMessagesQuery.test.js +0 -402
  393. package/dist/createNewProject.d.ts +0 -12
  394. package/dist/createNewProject.d.ts.map +0 -1
  395. package/dist/createNewProject.js +0 -38
  396. package/dist/createNewProject.test.d.ts +0 -2
  397. package/dist/createNewProject.test.d.ts.map +0 -1
  398. package/dist/createNewProject.test.js +0 -91
  399. package/dist/createNodeishFsWithAbsolutePaths.d.ts +0 -12
  400. package/dist/createNodeishFsWithAbsolutePaths.d.ts.map +0 -1
  401. package/dist/createNodeishFsWithAbsolutePaths.js +0 -38
  402. package/dist/createNodeishFsWithAbsolutePaths.test.d.ts +0 -2
  403. package/dist/createNodeishFsWithAbsolutePaths.test.d.ts.map +0 -1
  404. package/dist/createNodeishFsWithAbsolutePaths.test.js +0 -44
  405. package/dist/createNodeishFsWithWatcher.d.ts +0 -14
  406. package/dist/createNodeishFsWithWatcher.d.ts.map +0 -1
  407. package/dist/createNodeishFsWithWatcher.js +0 -75
  408. package/dist/createNodeishFsWithWatcher.test.d.ts +0 -2
  409. package/dist/createNodeishFsWithWatcher.test.d.ts.map +0 -1
  410. package/dist/createNodeishFsWithWatcher.test.js +0 -38
  411. package/dist/defaultProjectSettings.d.ts +0 -14
  412. package/dist/defaultProjectSettings.d.ts.map +0 -1
  413. package/dist/defaultProjectSettings.js +0 -22
  414. package/dist/env-variables/index.d.ts +0 -4
  415. package/dist/env-variables/index.d.ts.map +0 -1
  416. package/dist/env-variables/index.js +0 -3
  417. package/dist/errors.d.ts +0 -48
  418. package/dist/errors.d.ts.map +0 -1
  419. package/dist/errors.js +0 -62
  420. package/dist/lint/index.d.ts +0 -3
  421. package/dist/lint/index.d.ts.map +0 -1
  422. package/dist/lint/index.js +0 -2
  423. package/dist/lint/message/errors.d.ts +0 -7
  424. package/dist/lint/message/errors.d.ts.map +0 -1
  425. package/dist/lint/message/errors.js +0 -9
  426. package/dist/lint/message/lintMessages.d.ts +0 -13
  427. package/dist/lint/message/lintMessages.d.ts.map +0 -1
  428. package/dist/lint/message/lintMessages.js +0 -12
  429. package/dist/lint/message/lintMessages.test.d.ts +0 -2
  430. package/dist/lint/message/lintMessages.test.d.ts.map +0 -1
  431. package/dist/lint/message/lintMessages.test.js +0 -107
  432. package/dist/lint/message/lintSingleMessage.d.ts +0 -19
  433. package/dist/lint/message/lintSingleMessage.d.ts.map +0 -1
  434. package/dist/lint/message/lintSingleMessage.js +0 -38
  435. package/dist/lint/message/lintSingleMessage.test.d.ts +0 -2
  436. package/dist/lint/message/lintSingleMessage.test.d.ts.map +0 -1
  437. package/dist/lint/message/lintSingleMessage.test.js +0 -161
  438. package/dist/listProjects.d.ts +0 -5
  439. package/dist/listProjects.d.ts.map +0 -1
  440. package/dist/listProjects.js +0 -38
  441. package/dist/listProjects.test.d.ts +0 -2
  442. package/dist/listProjects.test.d.ts.map +0 -1
  443. package/dist/listProjects.test.js +0 -72
  444. package/dist/loadProject.d.ts +0 -19
  445. package/dist/loadProject.d.ts.map +0 -1
  446. package/dist/loadProject.js +0 -343
  447. package/dist/loadProject.test.d.ts.map +0 -1
  448. package/dist/loadProject.test.js +0 -975
  449. package/dist/messages/errors.d.ts +0 -13
  450. package/dist/messages/errors.d.ts.map +0 -1
  451. package/dist/messages/errors.js +0 -18
  452. package/dist/messages/index.d.ts +0 -3
  453. package/dist/messages/index.d.ts.map +0 -1
  454. package/dist/messages/index.js +0 -2
  455. package/dist/messages/variant.d.ts +0 -46
  456. package/dist/messages/variant.d.ts.map +0 -1
  457. package/dist/messages/variant.js +0 -176
  458. package/dist/messages/variant.test.d.ts +0 -2
  459. package/dist/messages/variant.test.d.ts.map +0 -1
  460. package/dist/messages/variant.test.js +0 -439
  461. package/dist/migrations/maybeAddModuleCache.d.ts +0 -6
  462. package/dist/migrations/maybeAddModuleCache.d.ts.map +0 -1
  463. package/dist/migrations/maybeAddModuleCache.js +0 -62
  464. package/dist/migrations/maybeCreateFirstProjectId.d.ts +0 -16
  465. package/dist/migrations/maybeCreateFirstProjectId.d.ts.map +0 -1
  466. package/dist/migrations/maybeCreateFirstProjectId.js +0 -46
  467. package/dist/migrations/maybeCreateFirstProjectId.test.d.ts +0 -2
  468. package/dist/migrations/maybeCreateFirstProjectId.test.d.ts.map +0 -1
  469. package/dist/migrations/maybeCreateFirstProjectId.test.js +0 -24
  470. package/dist/migrations/migrateToDirectory.d.ts +0 -10
  471. package/dist/migrations/migrateToDirectory.d.ts.map +0 -1
  472. package/dist/migrations/migrateToDirectory.js +0 -48
  473. package/dist/migrations/migrateToDirectory.test.d.ts +0 -2
  474. package/dist/migrations/migrateToDirectory.test.d.ts.map +0 -1
  475. package/dist/migrations/migrateToDirectory.test.js +0 -48
  476. package/dist/parseConfig.d.ts +0 -8
  477. package/dist/parseConfig.d.ts.map +0 -1
  478. package/dist/parseConfig.js +0 -26
  479. package/dist/persistence/batchedIO.d.ts +0 -11
  480. package/dist/persistence/batchedIO.d.ts.map +0 -1
  481. package/dist/persistence/batchedIO.js +0 -49
  482. package/dist/persistence/batchedIO.test.d.ts +0 -2
  483. package/dist/persistence/batchedIO.test.d.ts.map +0 -1
  484. package/dist/persistence/batchedIO.test.js +0 -56
  485. package/dist/persistence/filelock/acquireFileLock.d.ts +0 -3
  486. package/dist/persistence/filelock/acquireFileLock.d.ts.map +0 -1
  487. package/dist/persistence/filelock/acquireFileLock.js +0 -111
  488. package/dist/persistence/filelock/releaseLock.d.ts +0 -3
  489. package/dist/persistence/filelock/releaseLock.d.ts.map +0 -1
  490. package/dist/persistence/filelock/releaseLock.js +0 -24
  491. package/dist/persistence/store.d.ts +0 -107
  492. package/dist/persistence/store.d.ts.map +0 -1
  493. package/dist/persistence/store.js +0 -99
  494. package/dist/persistence/store.test.d.ts +0 -2
  495. package/dist/persistence/store.test.d.ts.map +0 -1
  496. package/dist/persistence/store.test.js +0 -79
  497. package/dist/persistence/storeApi.d.ts +0 -22
  498. package/dist/persistence/storeApi.d.ts.map +0 -1
  499. package/dist/persistence/storeApi.js +0 -1
  500. package/dist/reactivity/map.d.ts +0 -67
  501. package/dist/reactivity/map.d.ts.map +0 -1
  502. package/dist/reactivity/map.js +0 -143
  503. package/dist/reactivity/solid.d.ts +0 -14
  504. package/dist/reactivity/solid.d.ts.map +0 -1
  505. package/dist/reactivity/solid.js +0 -15
  506. package/dist/reactivity/solid.test.d.ts +0 -2
  507. package/dist/reactivity/solid.test.d.ts.map +0 -1
  508. package/dist/reactivity/solid.test.js +0 -189
  509. package/dist/reactivity/trigger.d.ts +0 -11
  510. package/dist/reactivity/trigger.d.ts.map +0 -1
  511. package/dist/reactivity/trigger.js +0 -46
  512. package/dist/resolve-modules/cache.d.ts +0 -6
  513. package/dist/resolve-modules/cache.d.ts.map +0 -1
  514. package/dist/resolve-modules/cache.js +0 -58
  515. package/dist/resolve-modules/errors.d.ts +0 -41
  516. package/dist/resolve-modules/errors.d.ts.map +0 -1
  517. package/dist/resolve-modules/errors.js +0 -45
  518. package/dist/resolve-modules/import.d.ts +0 -19
  519. package/dist/resolve-modules/import.d.ts.map +0 -1
  520. package/dist/resolve-modules/import.js +0 -102
  521. package/dist/resolve-modules/import.test.d.ts +0 -2
  522. package/dist/resolve-modules/import.test.d.ts.map +0 -1
  523. package/dist/resolve-modules/import.test.js +0 -47
  524. package/dist/resolve-modules/index.d.ts +0 -3
  525. package/dist/resolve-modules/index.d.ts.map +0 -1
  526. package/dist/resolve-modules/index.js +0 -2
  527. package/dist/resolve-modules/message-lint-rules/errors.d.ts +0 -9
  528. package/dist/resolve-modules/message-lint-rules/errors.d.ts.map +0 -1
  529. package/dist/resolve-modules/message-lint-rules/errors.js +0 -6
  530. package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.d.ts +0 -9
  531. package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.d.ts.map +0 -1
  532. package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.js +0 -24
  533. package/dist/resolve-modules/plugins/errors.d.ts +0 -33
  534. package/dist/resolve-modules/plugins/errors.d.ts.map +0 -1
  535. package/dist/resolve-modules/plugins/errors.js +0 -38
  536. package/dist/resolve-modules/plugins/resolvePlugins.d.ts +0 -3
  537. package/dist/resolve-modules/plugins/resolvePlugins.d.ts.map +0 -1
  538. package/dist/resolve-modules/plugins/resolvePlugins.js +0 -92
  539. package/dist/resolve-modules/plugins/resolvePlugins.test.d.ts +0 -2
  540. package/dist/resolve-modules/plugins/resolvePlugins.test.d.ts.map +0 -1
  541. package/dist/resolve-modules/plugins/resolvePlugins.test.js +0 -252
  542. package/dist/resolve-modules/plugins/types.d.ts +0 -57
  543. package/dist/resolve-modules/plugins/types.d.ts.map +0 -1
  544. package/dist/resolve-modules/plugins/types.js +0 -1
  545. package/dist/resolve-modules/plugins/types.test.d.ts +0 -2
  546. package/dist/resolve-modules/plugins/types.test.d.ts.map +0 -1
  547. package/dist/resolve-modules/plugins/types.test.js +0 -45
  548. package/dist/resolve-modules/resolveModules.d.ts +0 -3
  549. package/dist/resolve-modules/resolveModules.d.ts.map +0 -1
  550. package/dist/resolve-modules/resolveModules.js +0 -80
  551. package/dist/resolve-modules/resolveModules.test.d.ts +0 -2
  552. package/dist/resolve-modules/resolveModules.test.d.ts.map +0 -1
  553. package/dist/resolve-modules/resolveModules.test.js +0 -185
  554. package/dist/resolve-modules/types.d.ts +0 -63
  555. package/dist/resolve-modules/types.d.ts.map +0 -1
  556. package/dist/resolve-modules/types.js +0 -1
  557. package/dist/resolve-modules/validateModuleSettings.test.d.ts +0 -2
  558. package/dist/resolve-modules/validateModuleSettings.test.d.ts.map +0 -1
  559. package/dist/resolve-modules/validateModuleSettings.test.js +0 -71
  560. package/dist/resolve-modules/validatedModuleSettings.d.ts +0 -7
  561. package/dist/resolve-modules/validatedModuleSettings.d.ts.map +0 -1
  562. package/dist/resolve-modules/validatedModuleSettings.js +0 -11
  563. package/dist/storage/helper.d.ts +0 -11
  564. package/dist/storage/helper.d.ts.map +0 -1
  565. package/dist/storage/helper.js +0 -63
  566. package/dist/storage/helpers.test.d.ts +0 -2
  567. package/dist/storage/helpers.test.d.ts.map +0 -1
  568. package/dist/storage/helpers.test.js +0 -84
  569. package/dist/storage/human-id/human-readable-id.d.ts +0 -3
  570. package/dist/storage/human-id/human-readable-id.d.ts.map +0 -1
  571. package/dist/storage/human-id/human-readable-id.js +0 -20
  572. package/dist/storage/human-id/words.d.ts.map +0 -1
  573. package/dist/storage/human-id/words.test.d.ts.map +0 -1
  574. package/dist/telemetry/capture.d.ts.map +0 -1
  575. package/dist/telemetry/capture.js +0 -39
  576. package/dist/telemetry/groupIdentify.d.ts +0 -13
  577. package/dist/telemetry/groupIdentify.d.ts.map +0 -1
  578. package/dist/telemetry/groupIdentify.js +0 -35
  579. package/dist/test-utilities/createMessage.d.ts +0 -18
  580. package/dist/test-utilities/createMessage.d.ts.map +0 -1
  581. package/dist/test-utilities/createMessage.js +0 -17
  582. package/dist/test-utilities/createMessage.test.d.ts +0 -2
  583. package/dist/test-utilities/createMessage.test.d.ts.map +0 -1
  584. package/dist/test-utilities/createMessage.test.js +0 -106
  585. package/dist/test-utilities/index.d.ts +0 -3
  586. package/dist/test-utilities/index.d.ts.map +0 -1
  587. package/dist/test-utilities/index.js +0 -2
  588. package/dist/test-utilities/sleep.d.ts +0 -4
  589. package/dist/test-utilities/sleep.d.ts.map +0 -1
  590. package/dist/test-utilities/sleep.js +0 -9
  591. package/dist/v2/helper.d.ts +0 -43
  592. package/dist/v2/helper.d.ts.map +0 -1
  593. package/dist/v2/helper.js +0 -75
  594. package/dist/v2/helper.test.d.ts +0 -2
  595. package/dist/v2/helper.test.d.ts.map +0 -1
  596. package/dist/v2/helper.test.js +0 -92
  597. package/dist/v2/index.d.ts +0 -4
  598. package/dist/v2/index.d.ts.map +0 -1
  599. package/dist/v2/index.js +0 -2
  600. package/dist/v2/mocks/index.d.ts +0 -3
  601. package/dist/v2/mocks/index.d.ts.map +0 -1
  602. package/dist/v2/mocks/index.js +0 -2
  603. package/dist/v2/mocks/multipleMatcher/bundle.d.ts +0 -3
  604. package/dist/v2/mocks/multipleMatcher/bundle.d.ts.map +0 -1
  605. package/dist/v2/mocks/multipleMatcher/bundle.js +0 -194
  606. package/dist/v2/mocks/multipleMatcher/bundle.test.d.ts +0 -2
  607. package/dist/v2/mocks/multipleMatcher/bundle.test.d.ts.map +0 -1
  608. package/dist/v2/mocks/multipleMatcher/bundle.test.js +0 -10
  609. package/dist/v2/mocks/plural/bundle.d.ts +0 -3
  610. package/dist/v2/mocks/plural/bundle.d.ts.map +0 -1
  611. package/dist/v2/mocks/plural/bundle.js +0 -162
  612. package/dist/v2/mocks/plural/bundle.test.d.ts +0 -2
  613. package/dist/v2/mocks/plural/bundle.test.d.ts.map +0 -1
  614. package/dist/v2/mocks/plural/bundle.test.js +0 -15
  615. package/dist/v2/shim.d.ts +0 -12
  616. package/dist/v2/shim.d.ts.map +0 -1
  617. package/dist/v2/shim.js +0 -151
  618. package/dist/v2/shim.test.d.ts +0 -2
  619. package/dist/v2/shim.test.d.ts.map +0 -1
  620. package/dist/v2/shim.test.js +0 -49
  621. package/dist/v2/stubQueryApi.d.ts +0 -9
  622. package/dist/v2/stubQueryApi.d.ts.map +0 -1
  623. package/dist/v2/stubQueryApi.js +0 -38
  624. package/dist/v2/types.d.ts +0 -521
  625. package/dist/v2/types.d.ts.map +0 -1
  626. package/dist/v2/types.js +0 -78
  627. package/dist/validateProjectPath.d.ts +0 -17
  628. package/dist/validateProjectPath.d.ts.map +0 -1
  629. package/dist/validateProjectPath.js +0 -31
  630. package/dist/validateProjectPath.test.d.ts +0 -2
  631. package/dist/validateProjectPath.test.d.ts.map +0 -1
  632. package/dist/validateProjectPath.test.js +0 -40
  633. package/dist/versionedInterfaces.d.ts +0 -8
  634. package/dist/versionedInterfaces.d.ts.map +0 -1
  635. package/dist/versionedInterfaces.js +0 -8
  636. package/src/adapter/solidAdapter.test.ts +0 -472
  637. package/src/adapter/solidAdapter.ts +0 -79
  638. package/src/api.test-d.ts +0 -8
  639. package/src/api.ts +0 -116
  640. package/src/createMessageLintReportsQuery.ts +0 -225
  641. package/src/createMessagesQuery.test.ts +0 -538
  642. package/src/createMessagesQuery.ts +0 -635
  643. package/src/createNewProject.test.ts +0 -105
  644. package/src/createNewProject.ts +0 -46
  645. package/src/createNodeishFsWithAbsolutePaths.test.ts +0 -55
  646. package/src/createNodeishFsWithAbsolutePaths.ts +0 -52
  647. package/src/createNodeishFsWithWatcher.test.ts +0 -50
  648. package/src/createNodeishFsWithWatcher.ts +0 -85
  649. package/src/defaultProjectSettings.ts +0 -26
  650. package/src/env-variables/.prettierignore +0 -1
  651. package/src/env-variables/createIndexFile.js +0 -28
  652. package/src/errors.ts +0 -84
  653. package/src/lint/index.ts +0 -2
  654. package/src/lint/message/errors.ts +0 -9
  655. package/src/lint/message/lintMessages.test.ts +0 -126
  656. package/src/lint/message/lintMessages.ts +0 -25
  657. package/src/lint/message/lintSingleMessage.test.ts +0 -191
  658. package/src/lint/message/lintSingleMessage.ts +0 -57
  659. package/src/listProjects.test.ts +0 -91
  660. package/src/listProjects.ts +0 -48
  661. package/src/loadProject.test.ts +0 -1173
  662. package/src/loadProject.ts +0 -460
  663. package/src/messages/errors.ts +0 -25
  664. package/src/messages/index.ts +0 -2
  665. package/src/messages/variant.test.ts +0 -511
  666. package/src/messages/variant.ts +0 -247
  667. package/src/migrations/maybeAddModuleCache.ts +0 -68
  668. package/src/migrations/maybeCreateFirstProjectId.test.ts +0 -31
  669. package/src/migrations/maybeCreateFirstProjectId.ts +0 -51
  670. package/src/migrations/migrateToDirectory.test.ts +0 -54
  671. package/src/migrations/migrateToDirectory.ts +0 -62
  672. package/src/parseConfig.ts +0 -35
  673. package/src/persistence/batchedIO.test.ts +0 -63
  674. package/src/persistence/batchedIO.ts +0 -64
  675. package/src/persistence/filelock/acquireFileLock.ts +0 -129
  676. package/src/persistence/filelock/releaseLock.ts +0 -29
  677. package/src/persistence/store.test.ts +0 -102
  678. package/src/persistence/store.ts +0 -119
  679. package/src/persistence/storeApi.ts +0 -19
  680. package/src/reactivity/map.ts +0 -135
  681. package/src/reactivity/solid.test.ts +0 -222
  682. package/src/reactivity/solid.ts +0 -42
  683. package/src/reactivity/trigger.ts +0 -46
  684. package/src/resolve-modules/cache.ts +0 -89
  685. package/src/resolve-modules/errors.ts +0 -69
  686. package/src/resolve-modules/import.test.ts +0 -62
  687. package/src/resolve-modules/import.ts +0 -133
  688. package/src/resolve-modules/index.ts +0 -2
  689. package/src/resolve-modules/message-lint-rules/errors.ts +0 -9
  690. package/src/resolve-modules/message-lint-rules/resolveMessageLintRules.ts +0 -27
  691. package/src/resolve-modules/plugins/errors.ts +0 -56
  692. package/src/resolve-modules/plugins/resolvePlugins.test.ts +0 -301
  693. package/src/resolve-modules/plugins/resolvePlugins.ts +0 -129
  694. package/src/resolve-modules/plugins/types.test.ts +0 -53
  695. package/src/resolve-modules/plugins/types.ts +0 -76
  696. package/src/resolve-modules/resolveModules.test.ts +0 -224
  697. package/src/resolve-modules/resolveModules.ts +0 -113
  698. package/src/resolve-modules/types.ts +0 -72
  699. package/src/resolve-modules/validateModuleSettings.test.ts +0 -85
  700. package/src/resolve-modules/validatedModuleSettings.ts +0 -19
  701. package/src/storage/helper.ts +0 -74
  702. package/src/storage/helpers.test.ts +0 -95
  703. package/src/storage/human-id/human-readable-id.ts +0 -27
  704. package/src/telemetry/capture.ts +0 -49
  705. package/src/telemetry/groupIdentify.ts +0 -41
  706. package/src/test-utilities/createMessage.test.ts +0 -118
  707. package/src/test-utilities/createMessage.ts +0 -21
  708. package/src/test-utilities/index.ts +0 -2
  709. package/src/test-utilities/sleep.ts +0 -11
  710. package/src/v2/helper.test.ts +0 -95
  711. package/src/v2/helper.ts +0 -98
  712. package/src/v2/index.ts +0 -3
  713. package/src/v2/mocks/index.ts +0 -2
  714. package/src/v2/mocks/multipleMatcher/bundle.test.ts +0 -11
  715. package/src/v2/mocks/multipleMatcher/bundle.ts +0 -196
  716. package/src/v2/mocks/plural/bundle.test.ts +0 -18
  717. package/src/v2/mocks/plural/bundle.ts +0 -164
  718. package/src/v2/shim.test.ts +0 -56
  719. package/src/v2/shim.ts +0 -173
  720. package/src/v2/stubQueryApi.ts +0 -43
  721. package/src/v2/types.ts +0 -159
  722. package/src/validateProjectPath.test.ts +0 -50
  723. package/src/validateProjectPath.ts +0 -38
  724. package/src/versionedInterfaces.ts +0 -9
  725. /package/dist/{storage/human-id → human-id}/words.d.ts +0 -0
  726. /package/dist/{storage/human-id → human-id}/words.test.d.ts +0 -0
  727. /package/dist/{loadProject.test.d.ts → project/loadProject.test.d.ts} +0 -0
@@ -0,0 +1,61 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2528caec-29b9-569d-a353-9888c7c50eac")}catch(e){}}();
3
+ import { test, expect, vi } from "vitest";
4
+ import { withCache } from "./cache.js";
5
+ import { newLixFile, openLixInMemory } from "@lix-js/sdk";
6
+ import { sql } from "kysely";
7
+ test("it should be network-first", async () => {
8
+ const mockLoader = vi
9
+ .fn()
10
+ .mockResolvedValueOnce("module content 1")
11
+ .mockResolvedValueOnce("module content 2");
12
+ const mockModulePath = "https://mock.com/module.js";
13
+ const lix = await openLixInMemory({ blob: await newLixFile() });
14
+ const result1 = await withCache(mockLoader, lix)(mockModulePath);
15
+ expect(mockLoader).toHaveBeenCalledTimes(1);
16
+ expect(result1).toBe("module content 1");
17
+ const cachedPlugins = await lix.db
18
+ .selectFrom("file")
19
+ .selectAll()
20
+ // @ts-expect-error - kysely doesn't know about GLOB
21
+ .where(sql `path GLOB '/cache/plugins/*'`)
22
+ .execute();
23
+ expect(cachedPlugins.length).toBe(1);
24
+ const parsed = new TextDecoder().decode(cachedPlugins[0].data);
25
+ expect(parsed).toBe("module content 1");
26
+ const result2 = await withCache(mockLoader, lix)(mockModulePath);
27
+ expect(mockLoader).toHaveBeenCalledTimes(2);
28
+ expect(result2).toBe("module content 2");
29
+ const cachedPlugins2 = await lix.db
30
+ .selectFrom("file")
31
+ .selectAll()
32
+ // @ts-expect-error - kysely doesn't know about GLOB
33
+ .where(sql `path GLOB '/cache/plugins/*'`)
34
+ .execute();
35
+ expect(cachedPlugins2.length).toBe(1);
36
+ const parsed2 = new TextDecoder().decode(cachedPlugins2[0].data);
37
+ expect(parsed2).toBe("module content 2");
38
+ });
39
+ test("it should throw the error from the loader if the cache does not exist", async () => {
40
+ const mockLoader = vi.fn().mockRejectedValueOnce(new Error("Network error"));
41
+ const mockModulePath = "https://mock.com/module.js";
42
+ const lix = await openLixInMemory({ blob: await newLixFile() });
43
+ expect(async () => await withCache(mockLoader, lix)(mockModulePath)).rejects.toThrowError("Network error");
44
+ });
45
+ test("it should fallback to the cache if the loader fails", async () => {
46
+ const mockLoader = vi.fn().mockRejectedValueOnce(new Error("Network error"));
47
+ const mockModulePath = "https://mock.com/module.js";
48
+ const mockModuleCachePath = "/cache/plugins/31i1etp0l413h";
49
+ const lix = await openLixInMemory({ blob: await newLixFile() });
50
+ await lix.db
51
+ .insertInto("file")
52
+ .values({
53
+ path: mockModuleCachePath,
54
+ data: new TextEncoder().encode("cached module content"),
55
+ })
56
+ .execute();
57
+ const result = await withCache(mockLoader, lix)(mockModulePath);
58
+ expect(result).toBe("cached module content");
59
+ });
60
+ //# sourceMappingURL=cache.test.js.map
61
+ //# debugId=2528caec-29b9-569d-a353-9888c7c50eac
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.test.js","sources":["plugin/cache.test.ts"],"sourceRoot":"/","sourcesContent":["import { test, expect, vi } from \"vitest\";\nimport { withCache } from \"./cache.js\";\nimport { newLixFile, openLixInMemory } from \"@lix-js/sdk\";\nimport { sql } from \"kysely\";\n\ntest(\"it should be network-first\", async () => {\n\tconst mockLoader = vi\n\t\t.fn()\n\t\t.mockResolvedValueOnce(\"module content 1\")\n\t\t.mockResolvedValueOnce(\"module content 2\");\n\n\tconst mockModulePath = \"https://mock.com/module.js\";\n\n\tconst lix = await openLixInMemory({ blob: await newLixFile() });\n\n\tconst result1 = await withCache(mockLoader, lix)(mockModulePath);\n\n\texpect(mockLoader).toHaveBeenCalledTimes(1);\n\texpect(result1).toBe(\"module content 1\");\n\n\tconst cachedPlugins = await lix.db\n\t\t.selectFrom(\"file\")\n\t\t.selectAll()\n\t\t// @ts-expect-error - kysely doesn't know about GLOB\n\t\t.where(sql`path GLOB '/cache/plugins/*'`)\n\t\t.execute();\n\n\texpect(cachedPlugins.length).toBe(1);\n\n\tconst parsed = new TextDecoder().decode(cachedPlugins[0]!.data);\n\n\texpect(parsed).toBe(\"module content 1\");\n\n\tconst result2 = await withCache(mockLoader, lix)(mockModulePath);\n\n\texpect(mockLoader).toHaveBeenCalledTimes(2);\n\texpect(result2).toBe(\"module content 2\");\n\n\tconst cachedPlugins2 = await lix.db\n\t\t.selectFrom(\"file\")\n\t\t.selectAll()\n\t\t// @ts-expect-error - kysely doesn't know about GLOB\n\t\t.where(sql`path GLOB '/cache/plugins/*'`)\n\t\t.execute();\n\n\texpect(cachedPlugins2.length).toBe(1);\n\n\tconst parsed2 = new TextDecoder().decode(cachedPlugins2[0]!.data);\n\n\texpect(parsed2).toBe(\"module content 2\");\n});\n\ntest(\"it should throw the error from the loader if the cache does not exist\", async () => {\n\tconst mockLoader = vi.fn().mockRejectedValueOnce(new Error(\"Network error\"));\n\n\tconst mockModulePath = \"https://mock.com/module.js\";\n\n\tconst lix = await openLixInMemory({ blob: await newLixFile() });\n\n\texpect(\n\t\tasync () => await withCache(mockLoader, lix)(mockModulePath)\n\t).rejects.toThrowError(\"Network error\");\n});\n\ntest(\"it should fallback to the cache if the loader fails\", async () => {\n\tconst mockLoader = vi.fn().mockRejectedValueOnce(new Error(\"Network error\"));\n\n\tconst mockModulePath = \"https://mock.com/module.js\";\n\tconst mockModuleCachePath = \"/cache/plugins/31i1etp0l413h\";\n\n\tconst lix = await openLixInMemory({ blob: await newLixFile() });\n\n\tawait lix.db\n\t\t.insertInto(\"file\")\n\t\t.values({\n\t\t\tpath: mockModuleCachePath,\n\t\t\tdata: new TextEncoder().encode(\"cached module content\"),\n\t\t})\n\t\t.execute();\n\n\tconst result = await withCache(mockLoader, lix)(mockModulePath);\n\texpect(result).toBe(\"cached module content\");\n});\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,IAAI,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;IAC7C,MAAM,UAAU,GAAG,EAAE;SACnB,EAAE,EAAE;SACJ,qBAAqB,CAAC,kBAAkB,CAAC;SACzC,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;IAE5C,MAAM,cAAc,GAAG,4BAA4B,CAAC;IAEpD,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,UAAU,EAAE,EAAE,CAAC,CAAC;IAEhE,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC;IAEjE,MAAM,CAAC,UAAU,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,CAAC,IAA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
+ export declare class PluginError extends Error {
3
+ readonly plugin: string;
4
+ constructor(message: string, options: {
5
+ plugin: string;
6
+ cause?: Error;
7
+ });
8
+ }
9
+ /**
10
+ * Error when a plugin cannot be imported.
11
+ */
12
+ export declare class PluginImportError extends PluginError {
13
+ constructor(options: {
14
+ plugin: string;
15
+ cause: Error;
16
+ });
17
+ }
18
+ export declare class PluginSettingsAreInvalidError extends PluginError {
19
+ constructor(options: {
20
+ plugin: string;
21
+ errors: ValueError[];
22
+ });
23
+ }
24
+ /**
25
+ * Error when a plugin does not implement a required function
26
+ */
27
+ export declare class PluginDoesNotImplementFunctionError extends PluginError {
28
+ constructor(options: {
29
+ plugin: string;
30
+ function: string;
31
+ });
32
+ }
33
+ /**
34
+ * Error when a plugin was expected to exist, but doesn't
35
+ */
36
+ export declare class PluginMissingError extends PluginError {
37
+ constructor(options: {
38
+ plugin: string;
39
+ });
40
+ }
41
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"/","sources":["plugin/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,qBAAa,WAAY,SAAQ,KAAK;IACrC,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE;CAMvE;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;gBACrC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE;CAOrD;AAED,qBAAa,6BAA8B,SAAQ,WAAW;gBACjD,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,UAAU,EAAE,CAAA;KAAE;CAgB7D;AAED;;GAEG;AACH,qBAAa,mCAAoC,SAAQ,WAAW;gBACvD,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;CAOzD;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;gBACtC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;CAIvC"}
@@ -0,0 +1,48 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="80038c16-cc9c-5214-8c46-54bb2f3bc458")}catch(e){}}();
3
+ export class PluginError extends Error {
4
+ plugin;
5
+ constructor(message, options) {
6
+ super(message);
7
+ this.name = "PluginError";
8
+ this.plugin = options.plugin;
9
+ this.cause = options.cause;
10
+ }
11
+ }
12
+ /**
13
+ * Error when a plugin cannot be imported.
14
+ */
15
+ export class PluginImportError extends PluginError {
16
+ constructor(options) {
17
+ super(`Couldn't import the plugin "${options.plugin}":\n\n${options.cause}`, options);
18
+ this.name = "PluginImportError";
19
+ }
20
+ }
21
+ export class PluginSettingsAreInvalidError extends PluginError {
22
+ constructor(options) {
23
+ super(`The settings of "${options.plugin}" are invalid:\n\n${options.errors
24
+ .map((error) => `Path "${error.path}" with value "${JSON.stringify(error.value, undefined, 2)}": "${error.message}"`)
25
+ .join("\n")}`, options);
26
+ this.name = "PluginSettingsAreInvalidError";
27
+ }
28
+ }
29
+ /**
30
+ * Error when a plugin does not implement a required function
31
+ */
32
+ export class PluginDoesNotImplementFunctionError extends PluginError {
33
+ constructor(options) {
34
+ super(`The plugin "${options.plugin}" does not implement the "${options.function}" function.`, options);
35
+ this.name = "PluginDoesNotImplementFunction";
36
+ }
37
+ }
38
+ /**
39
+ * Error when a plugin was expected to exist, but doesn't
40
+ */
41
+ export class PluginMissingError extends PluginError {
42
+ constructor(options) {
43
+ super(`The plugin "${options.plugin}" does not exist`, options);
44
+ this.name = "PluginMissingError";
45
+ }
46
+ }
47
+ //# sourceMappingURL=errors.js.map
48
+ //# debugId=80038c16-cc9c-5214-8c46-54bb2f3bc458
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sources":["plugin/errors.ts"],"sourceRoot":"/","sourcesContent":["import type { ValueError } from \"@sinclair/typebox/errors\";\n\nexport class PluginError extends Error {\n\tpublic readonly plugin: string;\n\n\tconstructor(message: string, options: { plugin: string; cause?: Error }) {\n\t\tsuper(message);\n\t\tthis.name = \"PluginError\";\n\t\tthis.plugin = options.plugin;\n\t\tthis.cause = options.cause;\n\t}\n}\n\n/**\n * Error when a plugin cannot be imported.\n */\nexport class PluginImportError extends PluginError {\n\tconstructor(options: { plugin: string; cause: Error }) {\n\t\tsuper(\n\t\t\t`Couldn't import the plugin \"${options.plugin}\":\\n\\n${options.cause}`,\n\t\t\toptions\n\t\t);\n\t\tthis.name = \"PluginImportError\";\n\t}\n}\n\nexport class PluginSettingsAreInvalidError extends PluginError {\n\tconstructor(options: { plugin: string; errors: ValueError[] }) {\n\t\tsuper(\n\t\t\t`The settings of \"${options.plugin}\" are invalid:\\n\\n${options.errors\n\t\t\t\t.map(\n\t\t\t\t\t(error) =>\n\t\t\t\t\t\t`Path \"${error.path}\" with value \"${JSON.stringify(\n\t\t\t\t\t\t\terror.value,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t2\n\t\t\t\t\t\t)}\": \"${error.message}\"`\n\t\t\t\t)\n\t\t\t\t.join(\"\\n\")}`,\n\t\t\toptions\n\t\t);\n\t\tthis.name = \"PluginSettingsAreInvalidError\";\n\t}\n}\n\n/**\n * Error when a plugin does not implement a required function\n */\nexport class PluginDoesNotImplementFunctionError extends PluginError {\n\tconstructor(options: { plugin: string; function: string }) {\n\t\tsuper(\n\t\t\t`The plugin \"${options.plugin}\" does not implement the \"${options.function}\" function.`,\n\t\t\toptions\n\t\t);\n\t\tthis.name = \"PluginDoesNotImplementFunction\";\n\t}\n}\n\n/**\n * Error when a plugin was expected to exist, but doesn't\n */\nexport class PluginMissingError extends PluginError {\n\tconstructor(options: { plugin: string }) {\n\t\tsuper(`The plugin \"${options.plugin}\" does not exist`, options);\n\t\tthis.name = \"PluginMissingError\";\n\t}\n}\n"],"names":[],"mappings":";;AAEA,MAAM,OAAO,WAAY,SAAQ,KAAK;IACrB,MAAM,CAAS;IAE/B,YAAY,OAAe,EAAE,OAA0C;QACtE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IACjD,YAAY,OAAyC;QACpD,KAAK,CACJ,+BAA+B,OAAO,CAAC,MAAM,SAAS,OAAO,CAAC,KAAK,EAAE,EACrE,OAAO,CACP,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IACjC,CAAC;CACD;AAED,MAAM,OAAO,6BAA8B,SAAQ,WAAW;IAC7D,YAAY,OAAiD;QAC5D,KAAK,CACJ,oBAAoB,OAAO,CAAC,MAAM,qBAAqB,OAAO,CAAC,MAAM;aACnE,GAAG,CACH,CAAC,KAAK,EAAE,EAAE,CACT,SAAS,KAAK,CAAC,IAAI,iBAAiB,IAAI,CAAC,SAAS,CACjD,KAAK,CAAC,KAAK,EACX,SAAS,EACT,CAAC,CACD,OAAO,KAAK,CAAC,OAAO,GAAG,CACzB;aACA,IAAI,CAAC,IAAI,CAAC,EAAE,EACd,OAAO,CACP,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC7C,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,WAAW;IACnE,YAAY,OAA6C;QACxD,KAAK,CACJ,eAAe,OAAO,CAAC,MAAM,6BAA6B,OAAO,CAAC,QAAQ,aAAa,EACvF,OAAO,CACP,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;IAC9C,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IAClD,YAAY,OAA2B;QACtC,KAAK,CAAC,eAAe,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IAClC,CAAC;CACD","debug_id":"80038c16-cc9c-5214-8c46-54bb2f3bc458"}
@@ -0,0 +1,19 @@
1
+ import type { Lix } from "@lix-js/sdk";
2
+ import type { ProjectSettings } from "../json-schema/settings.js";
3
+ import { PluginError } from "./errors.js";
4
+ import type { InlangPlugin } from "./schema.js";
5
+ /**
6
+ * Function that preprocesses the plugin before importing it.
7
+ *
8
+ * - used by sherlock to convert ESM to CJS
9
+ */
10
+ export type PreprocessPluginBeforeImportFunction = (moduleText: string) => Promise<string> | string;
11
+ export declare function importPlugins(args: {
12
+ lix: Lix;
13
+ settings: ProjectSettings;
14
+ preprocessPluginBeforeImport?: PreprocessPluginBeforeImportFunction;
15
+ }): Promise<{
16
+ plugins: InlangPlugin[];
17
+ errors: PluginError[];
18
+ }>;
19
+ //# sourceMappingURL=importPlugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importPlugins.d.ts","sourceRoot":"/","sources":["plugin/importPlugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD;;;;GAIG;AACH,MAAM,MAAM,oCAAoC,GAAG,CAClD,UAAU,EAAE,MAAM,KACd,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAE9B,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACzC,GAAG,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,eAAe,CAAC;IAC1B,4BAA4B,CAAC,EAAE,oCAAoC,CAAC;CACpE,GAAG,OAAO,CAAC;IACX,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,MAAM,EAAE,WAAW,EAAE,CAAC;CACtB,CAAC,CAyBD"}
@@ -0,0 +1,43 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="922b0ccf-6503-5077-b1ae-ef03acdecbf1")}catch(e){}}();
3
+ import { PluginError, PluginImportError } from "./errors.js";
4
+ import { withCache } from "./cache.js";
5
+ export async function importPlugins(args) {
6
+ const plugins = [];
7
+ const errors = [];
8
+ for (const uri of args.settings.modules ?? []) {
9
+ try {
10
+ let moduleAsText = await withCache(fetchPlugin, args.lix)(uri);
11
+ if (args.preprocessPluginBeforeImport) {
12
+ moduleAsText = await args.preprocessPluginBeforeImport(moduleAsText);
13
+ }
14
+ const moduleWithMimeType = "data:application/javascript," + encodeURIComponent(moduleAsText);
15
+ const { default: module } = await import(
16
+ /* @vite-ignore */ moduleWithMimeType);
17
+ // old legacy message lint rules are not supported
18
+ // and ingored for backwards compatibility
19
+ if (module.id?.includes("messageLintRule")) {
20
+ continue;
21
+ }
22
+ plugins.push(module);
23
+ }
24
+ catch (e) {
25
+ errors.push(new PluginImportError({ plugin: uri, cause: e }));
26
+ }
27
+ }
28
+ return { plugins, errors };
29
+ }
30
+ async function fetchPlugin(uri) {
31
+ try {
32
+ const response = await fetch(uri);
33
+ return await response.text();
34
+ }
35
+ catch (error) {
36
+ throw new PluginImportError({
37
+ plugin: uri,
38
+ cause: error,
39
+ });
40
+ }
41
+ }
42
+ //# sourceMappingURL=importPlugins.js.map
43
+ //# debugId=922b0ccf-6503-5077-b1ae-ef03acdecbf1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importPlugins.js","sources":["plugin/importPlugins.ts"],"sourceRoot":"/","sourcesContent":["import type { Lix } from \"@lix-js/sdk\";\nimport type { ProjectSettings } from \"../json-schema/settings.js\";\nimport { PluginError, PluginImportError } from \"./errors.js\";\nimport type { InlangPlugin } from \"./schema.js\";\nimport { withCache } from \"./cache.js\";\n\n/**\n * Function that preprocesses the plugin before importing it.\n *\n * - used by sherlock to convert ESM to CJS\n */\nexport type PreprocessPluginBeforeImportFunction = (\n\tmoduleText: string\n) => Promise<string> | string;\n\nexport async function importPlugins(args: {\n\tlix: Lix;\n\tsettings: ProjectSettings;\n\tpreprocessPluginBeforeImport?: PreprocessPluginBeforeImportFunction;\n}): Promise<{\n\tplugins: InlangPlugin[];\n\terrors: PluginError[];\n}> {\n\tconst plugins: InlangPlugin[] = [];\n\tconst errors: PluginError[] = [];\n\tfor (const uri of args.settings.modules ?? []) {\n\t\ttry {\n\t\t\tlet moduleAsText = await withCache(fetchPlugin, args.lix)(uri);\n\t\t\tif (args.preprocessPluginBeforeImport) {\n\t\t\t\tmoduleAsText = await args.preprocessPluginBeforeImport(moduleAsText);\n\t\t\t}\n\t\t\tconst moduleWithMimeType =\n\t\t\t\t\"data:application/javascript,\" + encodeURIComponent(moduleAsText);\n\t\t\tconst { default: module } = await import(\n\t\t\t\t/* @vite-ignore */ moduleWithMimeType\n\t\t\t);\n\t\t\t// old legacy message lint rules are not supported\n\t\t\t// and ingored for backwards compatibility\n\t\t\tif (module.id?.includes(\"messageLintRule\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tplugins.push(module);\n\t\t} catch (e) {\n\t\t\terrors.push(new PluginImportError({ plugin: uri, cause: e as Error }));\n\t\t}\n\t}\n\treturn { plugins, errors };\n}\n\nasync function fetchPlugin(uri: string): Promise<string> {\n\ttry {\n\t\tconst response = await fetch(uri);\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ACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,GAAW;IACrC,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,iBAAiB,CAAC;YAC3B,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,KAAc;SACrB,CAAC,CAAC;IACJ,CAAC;AACF,CAAC","debug_id":"922b0ccf-6503-5077-b1ae-ef03acdecbf1"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=importPlugins.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importPlugins.test.d.ts","sourceRoot":"/","sources":["plugin/importPlugins.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,95 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="df00fa76-3eb4-5842-9f9d-4f593257ee7e")}catch(e){}}();
3
+ import { test, expect, vi } from "vitest";
4
+ import { importPlugins } from "./importPlugins.js";
5
+ import { PluginImportError } from "./errors.js";
6
+ import { newLixFile, openLixInMemory } from "@lix-js/sdk";
7
+ test("it should preprocess a plugin", async () => {
8
+ global.fetch = vi.fn().mockResolvedValue({
9
+ ok: true,
10
+ text: vi.fn().mockResolvedValue("export default { key: 'mock' }"),
11
+ });
12
+ const lix = await openLixInMemory({ blob: await newLixFile() });
13
+ const result = await importPlugins({
14
+ lix,
15
+ settings: {
16
+ baseLocale: "en",
17
+ locales: ["en"],
18
+ modules: ["https://mock.com/module.js"],
19
+ },
20
+ preprocessPluginBeforeImport: async (moduleText) => {
21
+ return moduleText.replace("mock", "preprocessed");
22
+ },
23
+ });
24
+ expect(global.fetch).toHaveBeenCalledTimes(1);
25
+ expect(result.plugins.length).toBe(1);
26
+ expect(result.errors.length).toBe(0);
27
+ expect(result.plugins[0]?.key).toBe("preprocessed");
28
+ });
29
+ test("if a fetch fails, a plugin import error is expected", async () => {
30
+ global.fetch = vi.fn().mockResolvedValue({
31
+ ok: false,
32
+ statusText: "HTTP 404",
33
+ });
34
+ const lix = await openLixInMemory({ blob: await newLixFile() });
35
+ const result = await importPlugins({
36
+ lix,
37
+ settings: {
38
+ baseLocale: "en",
39
+ locales: ["en"],
40
+ modules: ["https://mock.com/module.js"],
41
+ },
42
+ });
43
+ expect(global.fetch).toHaveBeenCalledTimes(1);
44
+ expect(result.plugins.length).toBe(0);
45
+ expect(result.errors.length).toBe(1);
46
+ expect(result.errors[0]).toBeInstanceOf(PluginImportError);
47
+ });
48
+ test("it should filter message lint rules for legacy reasons", async () => {
49
+ global.fetch = vi.fn().mockResolvedValue({
50
+ ok: true,
51
+ text: vi
52
+ .fn()
53
+ .mockResolvedValue("export default { id: 'messageLintRule.something' }"),
54
+ });
55
+ const lix = await openLixInMemory({ blob: await newLixFile() });
56
+ const result = await importPlugins({
57
+ lix,
58
+ settings: {
59
+ baseLocale: "en",
60
+ locales: ["en"],
61
+ modules: ["https://mock.com/module.js"],
62
+ },
63
+ });
64
+ expect(result.plugins.length).toBe(0);
65
+ expect(result.errors.length).toBe(0);
66
+ });
67
+ // more tests are found in cache.test.ts
68
+ test("cache should work", async () => {
69
+ global.fetch = vi.fn().mockResolvedValue({
70
+ ok: false,
71
+ });
72
+ const mockModulePath = "https://mock.com/module.js";
73
+ const mockModuleCachePath = "/cache/plugins/31i1etp0l413h";
74
+ const lix = await openLixInMemory({ blob: await newLixFile() });
75
+ await lix.db
76
+ .insertInto("file")
77
+ .values({
78
+ path: mockModuleCachePath,
79
+ data: new TextEncoder().encode("export default { key: 'mock' }"),
80
+ })
81
+ .execute();
82
+ const result = await importPlugins({
83
+ lix,
84
+ settings: {
85
+ baseLocale: "en",
86
+ locales: ["en"],
87
+ modules: [mockModulePath],
88
+ },
89
+ });
90
+ expect(result.errors).lengthOf(0);
91
+ expect(result.plugins).lengthOf(1);
92
+ expect(result.plugins[0]?.key).toBe("mock");
93
+ });
94
+ //# sourceMappingURL=importPlugins.test.js.map
95
+ //# debugId=df00fa76-3eb4-5842-9f9d-4f593257ee7e
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importPlugins.test.js","sources":["plugin/importPlugins.test.ts"],"sourceRoot":"/","sourcesContent":["import { test, expect, vi } from \"vitest\";\nimport { importPlugins } from \"./importPlugins.js\";\nimport { PluginImportError } from \"./errors.js\";\nimport { newLixFile, openLixInMemory } from \"@lix-js/sdk\";\n\ntest(\"it should preprocess a plugin\", async () => {\n\tglobal.fetch = vi.fn().mockResolvedValue({\n\t\tok: true,\n\t\ttext: vi.fn().mockResolvedValue(\"export default { key: 'mock' }\"),\n\t});\n\n\tconst lix = await openLixInMemory({ blob: await newLixFile() });\n\tconst result = await importPlugins({\n\t\tlix,\n\t\tsettings: {\n\t\t\tbaseLocale: \"en\",\n\t\t\tlocales: [\"en\"],\n\t\t\tmodules: [\"https://mock.com/module.js\"],\n\t\t},\n\t\tpreprocessPluginBeforeImport: async (moduleText) => {\n\t\t\treturn moduleText.replace(\"mock\", \"preprocessed\");\n\t\t},\n\t});\n\n\texpect(global.fetch).toHaveBeenCalledTimes(1);\n\texpect(result.plugins.length).toBe(1);\n\texpect(result.errors.length).toBe(0);\n\texpect(result.plugins[0]?.key).toBe(\"preprocessed\");\n});\n\ntest(\"if a fetch fails, a plugin import error is expected\", async () => {\n\tglobal.fetch = vi.fn().mockResolvedValue({\n\t\tok: false,\n\t\tstatusText: \"HTTP 404\",\n\t});\n\tconst lix = await openLixInMemory({ blob: await newLixFile() });\n\n\tconst result = await importPlugins({\n\t\tlix,\n\t\tsettings: {\n\t\t\tbaseLocale: \"en\",\n\t\t\tlocales: [\"en\"],\n\t\t\tmodules: [\"https://mock.com/module.js\"],\n\t\t},\n\t});\n\n\texpect(global.fetch).toHaveBeenCalledTimes(1);\n\texpect(result.plugins.length).toBe(0);\n\texpect(result.errors.length).toBe(1);\n\texpect(result.errors[0]).toBeInstanceOf(PluginImportError);\n});\n\ntest(\"it should filter message lint rules for legacy reasons\", async () => {\n\tglobal.fetch = vi.fn().mockResolvedValue({\n\t\tok: true,\n\t\ttext: vi\n\t\t\t.fn()\n\t\t\t.mockResolvedValue(\"export default { id: 'messageLintRule.something' }\"),\n\t});\n\n\tconst lix = await openLixInMemory({ blob: await newLixFile() });\n\n\tconst result = await importPlugins({\n\t\tlix,\n\t\tsettings: {\n\t\t\tbaseLocale: \"en\",\n\t\t\tlocales: [\"en\"],\n\t\t\tmodules: [\"https://mock.com/module.js\"],\n\t\t},\n\t});\n\n\texpect(result.plugins.length).toBe(0);\n\texpect(result.errors.length).toBe(0);\n});\n\n// more tests are found in cache.test.ts\ntest(\"cache should work\", async () => {\n\tglobal.fetch = vi.fn().mockResolvedValue({\n\t\tok: false,\n\t});\n\n\tconst mockModulePath = \"https://mock.com/module.js\";\n\tconst mockModuleCachePath = \"/cache/plugins/31i1etp0l413h\";\n\n\tconst lix = await openLixInMemory({ blob: await newLixFile() });\n\n\tawait lix.db\n\t\t.insertInto(\"file\")\n\t\t.values({\n\t\t\tpath: mockModuleCachePath,\n\t\t\tdata: new TextEncoder().encode(\"export default { key: 'mock' }\"),\n\t\t})\n\t\t.execute();\n\n\tconst result = await importPlugins({\n\t\tlix,\n\t\tsettings: {\n\t\t\tbaseLocale: \"en\",\n\t\t\tlocales: [\"en\"],\n\t\t\tmodules: [mockModulePath],\n\t\t},\n\t});\n\n\texpect(result.errors).lengthOf(0);\n\texpect(result.plugins).lengthOf(1);\n\texpect(result.plugins[0]?.key).toBe(\"mock\");\n});\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC1C,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,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC","debug_id":"df00fa76-3eb4-5842-9f9d-4f593257ee7e"}
@@ -0,0 +1,54 @@
1
+ interface Position {
2
+ line: number;
3
+ character: number;
4
+ }
5
+ interface MessageReferenceMatch {
6
+ bundleId: string;
7
+ position: {
8
+ start: Position;
9
+ end: Position;
10
+ };
11
+ }
12
+ interface IdeExtensionConfigSchema {
13
+ /**
14
+ * Defines matchers for message references inside the code.
15
+ *
16
+ * @param args - Represents the data to conduct the search on.
17
+ * @returns A promise with matched message references.
18
+ */
19
+ messageReferenceMatchers: Array<(args: {
20
+ documentText: string;
21
+ }) => Promise<MessageReferenceMatch[]>>;
22
+ /**
23
+ * Defines options to extract messages.
24
+ */
25
+ extractMessageOptions: Array<{
26
+ /**
27
+ * Function which is called when the user finishes the message extraction command.
28
+ *
29
+ * @param args - Contains messageId and selection.
30
+ * @returns The code which is inserted into the document.
31
+ */
32
+ callback: (args: {
33
+ bundleId: string;
34
+ selection: string;
35
+ }) => {
36
+ bundleId: string;
37
+ messageReplacement: string;
38
+ };
39
+ }>;
40
+ /**
41
+ * An array of Visual Studio Code DocumentSelectors.
42
+ *
43
+ * The document selectors specify for which files/programming languages
44
+ * (typescript, svelte, etc.) the extension should be activated.
45
+ *
46
+ * See https://code.visualstudio.com/api/references/document-selector
47
+ */
48
+ documentSelectors?: Array<{
49
+ language?: string;
50
+ }>;
51
+ }
52
+ export type IdeExtensionConfig = IdeExtensionConfigSchema;
53
+ export {};
54
+ //# sourceMappingURL=ideExtension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ideExtension.d.ts","sourceRoot":"/","sources":["plugin/meta/ideExtension.ts"],"names":[],"mappings":"AACA,UAAU,QAAQ;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CAClB;AAGD,UAAU,qBAAqB;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE;QACT,KAAK,EAAE,QAAQ,CAAC;QAChB,GAAG,EAAE,QAAQ,CAAC;KACd,CAAC;CACF;AAGD,UAAU,wBAAwB;IACjC;;;;;OAKG;IACH,wBAAwB,EAAE,KAAK,CAC9B,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,qBAAqB,EAAE,CAAC,CACpE,CAAC;IAEF;;OAEG;IACH,qBAAqB,EAAE,KAAK,CAAC;QAC5B;;;;;WAKG;QACH,QAAQ,EAAE,CAAC,IAAI,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,KAAK;YAC5D,QAAQ,EAAE,MAAM,CAAC;YACjB,kBAAkB,EAAE,MAAM,CAAC;SAC3B,CAAC;KACF,CAAC,CAAC;IAEH;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjD;AAGD,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,CAAC"}
@@ -0,0 +1,5 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6b094482-1e1c-5a82-b9ff-edb0247348e7")}catch(e){}}();
3
+ export {};
4
+ //# sourceMappingURL=ideExtension.js.map
5
+ //# debugId=6b094482-1e1c-5a82-b9ff-edb0247348e7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ideExtension.js","sources":["plugin/meta/ideExtension.ts"],"sourceRoot":"/","sourcesContent":["// Basic structure for a position in the document\ninterface Position {\n\tline: number;\n\tcharacter: number;\n}\n\n// Basic structure for a message reference match\ninterface MessageReferenceMatch {\n\tbundleId: string;\n\tposition: {\n\t\tstart: Position;\n\t\tend: Position;\n\t};\n}\n\n// Main IDE extension configuration schema\ninterface IdeExtensionConfigSchema {\n\t/**\n\t * Defines matchers for message references inside the code.\n\t *\n\t * @param args - Represents the data to conduct the search on.\n\t * @returns A promise with matched message references.\n\t */\n\tmessageReferenceMatchers: Array<\n\t\t(args: { documentText: string }) => Promise<MessageReferenceMatch[]>\n\t>;\n\n\t/**\n\t * Defines options to extract messages.\n\t */\n\textractMessageOptions: Array<{\n\t\t/**\n\t\t * Function which is called when the user finishes the message extraction command.\n\t\t *\n\t\t * @param args - Contains messageId and selection.\n\t\t * @returns The code which is inserted into the document.\n\t\t */\n\t\tcallback: (args: { bundleId: string; selection: string }) => {\n\t\t\tbundleId: string;\n\t\t\tmessageReplacement: string;\n\t\t};\n\t}>;\n\n\t/**\n\t * An array of Visual Studio Code DocumentSelectors.\n\t *\n\t * The document selectors specify for which files/programming languages\n\t * (typescript, svelte, etc.) the extension should be activated.\n\t *\n\t * See https://code.visualstudio.com/api/references/document-selector\n\t */\n\tdocumentSelectors?: Array<{ language?: string }>;\n}\n\n// Export the type for external use\nexport type IdeExtensionConfig = IdeExtensionConfigSchema;\n"],"names":[],"mappings":"","debug_id":"6b094482-1e1c-5a82-b9ff-edb0247348e7"}
@@ -0,0 +1,152 @@
1
+ import type { TObject } from "@sinclair/typebox";
2
+ import type { MessageV1 } from "../json-schema/old-v1-message/schemaV1.js";
3
+ import type { ProjectSettings } from "../json-schema/settings.js";
4
+ import type { Bundle, Message, NewBundle, NewMessage, NewVariant, Variant } from "../database/schema.js";
5
+ import type { ExportFile, ImportFile } from "../project/api.js";
6
+ export type InlangPlugin<ExternalSettings extends Record<string, any> | unknown = unknown> = {
7
+ /**
8
+ * @deprecated Use `key` instead.
9
+ */
10
+ id?: string;
11
+ /**
12
+ * The key of the plugin.
13
+ */
14
+ key: string;
15
+ settingsSchema?: TObject;
16
+ /**
17
+ * @deprecated Use `importFiles` instead.
18
+ */
19
+ loadMessages?: (args: {
20
+ settings: ProjectSettings;
21
+ nodeishFs: NodeFsPromisesSubsetLegacy;
22
+ }) => Promise<MessageV1[]> | MessageV1[];
23
+ /**
24
+ * @deprecated Use `exportFiles` instead.
25
+ */
26
+ saveMessages?: (args: {
27
+ messages: MessageV1[];
28
+ settings: ProjectSettings;
29
+ nodeishFs: NodeFsPromisesSubsetLegacy;
30
+ }) => Promise<void> | void;
31
+ /**
32
+ * Files that should be imported by the inlang SDK.
33
+ *
34
+ * - `metadata` is optional and can be used to store additional information
35
+ * that is accessible in `importFiles` via `toBeImportedMetadata`. See
36
+ * https://github.com/opral/inlang-sdk/issues/218 for more info.
37
+ *
38
+ */
39
+ toBeImportedFiles?: (args: {
40
+ settings: ProjectSettings & ExternalSettings;
41
+ }) => MaybePromise<Array<{
42
+ path: string;
43
+ locale: string;
44
+ metadata?: Record<string, any>;
45
+ }>>;
46
+ importFiles?: (args: {
47
+ files: ImportFile[];
48
+ settings: ProjectSettings & ExternalSettings;
49
+ }) => MaybePromise<{
50
+ bundles: BundleImport[];
51
+ messages: MessageImport[];
52
+ variants: VariantImport[];
53
+ }>;
54
+ exportFiles?: (args: {
55
+ bundles: Bundle[];
56
+ messages: Message[];
57
+ variants: Variant[];
58
+ settings: ProjectSettings & ExternalSettings;
59
+ }) => MaybePromise<Array<ExportFile>>;
60
+ /**
61
+ * @deprecated Use the `meta` field instead.
62
+ */
63
+ addCustomApi?: (args: {
64
+ settings: ProjectSettings & ExternalSettings;
65
+ }) => Record<string, unknown>;
66
+ /**
67
+ * Define app-specific APIs under a `meta` field.
68
+ *
69
+ * @example
70
+ * meta: {
71
+ * "app.inlang.ide-extension": {
72
+ * documentPaths: ["*.json"]
73
+ * }
74
+ * }
75
+ */
76
+ meta?: Record<string, Record<string, unknown>>;
77
+ };
78
+ /**
79
+ * Exposing only a subset to ease mapping of fs functions.
80
+ *
81
+ * https://github.com/opral/inlang-sdk/issues/136
82
+ */
83
+ export type NodeFsPromisesSubsetLegacy = {
84
+ readFile: ((path: string) => Promise<ArrayBuffer>) | ((path: string, options?: {
85
+ encoding: "utf-8";
86
+ }) => Promise<string>);
87
+ readdir: (path: string) => Promise<string[]>;
88
+ writeFile: (path: string, data: ArrayBuffer | string) => Promise<void>;
89
+ mkdir: (path: string) => Promise<void>;
90
+ };
91
+ /**
92
+ * A to be imported bundle.
93
+ */
94
+ export type BundleImport = NewBundle;
95
+ /**
96
+ * A to be imported message.
97
+ *
98
+ * The `id` property is omitted because it is generated by the SDK.
99
+ */
100
+ export type MessageImport = Omit<NewMessage, "id"> & {
101
+ /**
102
+ * If the id is not provided, the SDK will generate one.
103
+ */
104
+ id?: string;
105
+ };
106
+ /**
107
+ * A to be imported variant.
108
+ *
109
+ * - The `id` and `messageId` properties are omitted because they are generated by the SDK.
110
+ * - The `bundleId` and `locale` properties are added to the import variant to match the variant
111
+ * with a message.
112
+ */
113
+ export type VariantImport = (NewVariant & {
114
+ /**
115
+ * If the id is not provided, the SDK will generate one.
116
+ */
117
+ id: string;
118
+ /**
119
+ * If the messageId is not provided, the SDK will match the variant
120
+ * with a message based on the `messageBundleId` and `messageLocale` properties.
121
+ */
122
+ messageId: string;
123
+ /**
124
+ * Required to match the variant with a message in case the `id` and `messageId` are undefined.
125
+ */
126
+ messageBundleId?: undefined;
127
+ /**
128
+ * Required to match the variant with a message in case the `id` and `messageId` are undefined.
129
+ */
130
+ messageLocale?: undefined;
131
+ }) | (Omit<NewVariant, "id" | "messageId"> & {
132
+ /**
133
+ * If the id is not provided, the SDK will generate one.
134
+ */
135
+ id?: undefined;
136
+ /**
137
+ * If the messageId is not provided, the SDK will match the variant
138
+ * with a message based on the `messageBundleId` and `messageLocale` properties.
139
+ */
140
+ messageId?: undefined;
141
+ /**
142
+ * Required to match the variant with a message in case the `id` and `messageId` are undefined.
143
+ */
144
+ messageBundleId: string;
145
+ /**
146
+ * Required to match the variant with a message in case the `id` and `messageId` are undefined.
147
+ */
148
+ messageLocale: string;
149
+ });
150
+ type MaybePromise<T> = T | Promise<T>;
151
+ export {};
152
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"/","sources":["plugin/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EACX,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,OAAO,EACP,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,MAAM,YAAY,CACvB,gBAAgB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,IAC7D;IACH;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QACrB,QAAQ,EAAE,eAAe,CAAC;QAC1B,SAAS,EAAE,0BAA0B,CAAC;KACtC,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QACrB,QAAQ,EAAE,SAAS,EAAE,CAAC;QACtB,QAAQ,EAAE,eAAe,CAAC;QAC1B,SAAS,EAAE,0BAA0B,CAAC;KACtC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3B;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE;QAC1B,QA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?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4dbbc1bc-ac41-5301-b32c-65db7bd6cf85")}catch(e){}}();
3
+ export {};
4
+ //# sourceMappingURL=schema.js.map
5
+ //# debugId=4dbbc1bc-ac41-5301-b32c-65db7bd6cf85
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sources":["plugin/schema.ts"],"sourceRoot":"/","sourcesContent":["import type { TObject } from \"@sinclair/typebox\";\nimport type { MessageV1 } from \"../json-schema/old-v1-message/schemaV1.js\";\nimport type { ProjectSettings } from \"../json-schema/settings.js\";\nimport type {\n\tBundle,\n\tMessage,\n\tNewBundle,\n\tNewMessage,\n\tNewVariant,\n\tVariant,\n} from \"../database/schema.js\";\nimport type { ExportFile, ImportFile } from \"../project/api.js\";\n\nexport type InlangPlugin<\n\tExternalSettings extends Record<string, any> | unknown = unknown,\n> = {\n\t/**\n\t * @deprecated Use `key` instead.\n\t */\n\tid?: string;\n\t/**\n\t * The key of the plugin.\n\t */\n\tkey: string;\n\tsettingsSchema?: TObject;\n\t/**\n\t * @deprecated Use `importFiles` instead.\n\t */\n\tloadMessages?: (args: {\n\t\tsettings: ProjectSettings;\n\t\tnodeishFs: NodeFsPromisesSubsetLegacy;\n\t}) => Promise<MessageV1[]> | MessageV1[];\n\t/**\n\t * @deprecated Use `exportFiles` instead.\n\t */\n\tsaveMessages?: (args: {\n\t\tmessages: MessageV1[];\n\t\tsettings: ProjectSettings;\n\t\tnodeishFs: NodeFsPromisesSubsetLegacy;\n\t}) => Promise<void> | void;\n\t/**\n\t * Files that should be imported by the inlang SDK.\n\t *\n\t * - `metadata` is optional and can be used to store additional information\n\t * that is accessible in `importFiles` via `toBeImportedMetadata`. See\n\t * https://github.com/opral/inlang-sdk/issues/218 for more info.\n\t *\n\t */\n\ttoBeImportedFiles?: (args: {\n\t\tsettings: ProjectSettings & ExternalSettings;\n\t}) => MaybePromise<\n\t\tArray<{ path: string; locale: string; metadata?: Record<string, any> }>\n\t>;\n\timportFiles?: (args: {\n\t\tfiles: ImportFile[];\n\t\tsettings: ProjectSettings & ExternalSettings; // we expose the settings in case the importFunction needs to access the plugin config\n\t}) => MaybePromise<{\n\t\tbundles: BundleImport[];\n\t\tmessages: MessageImport[];\n\t\tvariants: VariantImport[];\n\t}>;\n\texportFiles?: (args: {\n\t\tbundles: Bundle[];\n\t\tmessages: Message[];\n\t\tvariants: Variant[];\n\t\tsettings: ProjectSettings & ExternalSettings;\n\t}) => MaybePromise<Array<ExportFile>>;\n\t/**\n\t * @deprecated Use the `meta` field instead.\n\t */\n\taddCustomApi?: (args: {\n\t\tsettings: ProjectSettings & ExternalSettings;\n\t}) => Record<string, unknown>;\n\t/**\n\t * Define app-specific APIs under a `meta` field.\n\t *\n\t * @example\n\t * meta: {\n\t * \"app.inlang.ide-extension\": {\n\t * documentPaths: [\"*.json\"]\n\t * }\n\t * }\n\t */\n\tmeta?: Record<string, Record<string, unknown>>;\n};\n\n/**\n * Exposing only a subset to ease mapping of fs functions.\n *\n * https://github.com/opral/inlang-sdk/issues/136\n */\nexport type NodeFsPromisesSubsetLegacy = {\n\treadFile:\n\t\t| ((path: string) => Promise<ArrayBuffer>)\n\t\t| ((path: string, options?: { encoding: \"utf-8\" }) => Promise<string>);\n\treaddir: (path: string) => Promise<string[]>;\n\twriteFile: (path: string, data: ArrayBuffer | string) => Promise<void>;\n\tmkdir: (path: string) => Promise<void>;\n};\n\n/**\n * A to be imported bundle.\n */\nexport type BundleImport = NewBundle;\n\n/**\n * A to be imported message.\n *\n * The `id` property is omitted because it is generated by the SDK.\n */\nexport type MessageImport = Omit<NewMessage, \"id\"> & {\n\t/**\n\t * If the id is not provided, the SDK will generate one.\n\t */\n\tid?: string;\n};\n\n/**\n * A to be imported variant.\n *\n * - The `id` and `messageId` properties are omitted because they are generated by the SDK.\n * - The `bundleId` and `locale` properties are added to the import variant to match the variant\n * with a message.\n */\nexport type VariantImport =\n\t| (NewVariant & {\n\t\t\t/**\n\t\t\t * If the id is not provided, the SDK will generate one.\n\t\t\t */\n\t\t\tid: string;\n\t\t\t/**\n\t\t\t * If the messageId is not provided, the SDK will match the variant\n\t\t\t * with a message based on the `messageBundleId` and `messageLocale` properties.\n\t\t\t */\n\t\t\tmessageId: string;\n\t\t\t/**\n\t\t\t * Required to match the variant with a message in case the `id` and `messageId` are undefined.\n\t\t\t */\n\t\t\tmessageBundleId?: undefined;\n\t\t\t/**\n\t\t\t * Required to match the variant with a message in case the `id` and `messageId` are undefined.\n\t\t\t */\n\t\t\tmessageLocale?: undefined;\n\t })\n\t| (Omit<NewVariant, \"id\" | \"messageId\"> & {\n\t\t\t/**\n\t\t\t * If the id is not provided, the SDK will generate one.\n\t\t\t */\n\t\t\tid?: undefined;\n\t\t\t/**\n\t\t\t * If the messageId is not provided, the SDK will match the variant\n\t\t\t * with a message based on the `messageBundleId` and `messageLocale` properties.\n\t\t\t */\n\t\t\tmessageId?: undefined;\n\t\t\t/**\n\t\t\t * Required to match the variant with a message in case the `id` and `messageId` are undefined.\n\t\t\t */\n\t\t\tmessageBundleId: string;\n\t\t\t/**\n\t\t\t * Required to match the variant with a message in case the `id` and `messageId` are undefined.\n\t\t\t */\n\t\t\tmessageLocale: string;\n\t });\n\ntype MaybePromise<T> = T | Promise<T>;\n"],"names":[],"mappings":"","debug_id":"4dbbc1bc-ac41-5301-b32c-65db7bd6cf85"}