@featurevisor/core 2.26.1 → 3.0.1

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 (390) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/coverage/clover.xml +4991 -3130
  3. package/coverage/coverage-final.json +63 -39
  4. package/coverage/lcov-report/block-navigation.js +1 -1
  5. package/coverage/lcov-report/index.html +248 -98
  6. package/coverage/lcov-report/sorter.js +21 -7
  7. package/coverage/lcov-report/src/assess-distribution/index.html +116 -0
  8. package/coverage/lcov-report/src/assess-distribution/index.ts.html +754 -0
  9. package/coverage/lcov-report/{list → src/benchmark}/index.html +30 -30
  10. package/coverage/lcov-report/src/benchmark/index.ts.html +793 -0
  11. package/coverage/lcov-report/{builder → src/builder}/allocator.ts.html +38 -38
  12. package/coverage/lcov-report/{builder/buildScopedConditions.ts.html → src/builder/applyContextToConditions.ts.html} +80 -65
  13. package/coverage/lcov-report/{builder/buildScopedDatafile.ts.html → src/builder/applyContextToDatafile.ts.html} +92 -92
  14. package/coverage/lcov-report/{builder/buildScopedSegments.ts.html → src/builder/applyContextToSegments.ts.html} +103 -67
  15. package/coverage/lcov-report/{builder → src/builder}/buildDatafile.ts.html +336 -306
  16. package/coverage/lcov-report/src/builder/buildProject.ts.html +1117 -0
  17. package/coverage/lcov-report/src/builder/buildRuntimeDatafiles.ts.html +256 -0
  18. package/coverage/lcov-report/{builder → src/builder}/getFeatureRanges.ts.html +22 -22
  19. package/coverage/lcov-report/{builder → src/builder}/hashes.ts.html +50 -50
  20. package/coverage/lcov-report/{builder → src/builder}/index.html +114 -84
  21. package/coverage/lcov-report/{tester/cliFormat.ts.html → src/builder/index.ts.html} +17 -29
  22. package/coverage/lcov-report/{builder → src/builder}/mutateVariables.ts.html +55 -55
  23. package/coverage/lcov-report/{builder → src/builder}/mutator.ts.html +118 -118
  24. package/coverage/lcov-report/{builder → src/builder}/revision.ts.html +15 -15
  25. package/coverage/lcov-report/{builder → src/builder}/traffic.ts.html +86 -86
  26. package/coverage/lcov-report/src/cli/cli.ts.html +400 -0
  27. package/coverage/lcov-report/{tester → src/cli}/index.html +41 -41
  28. package/coverage/lcov-report/src/cli/plugins.ts.html +214 -0
  29. package/coverage/lcov-report/{config → src/config}/index.html +31 -31
  30. package/coverage/lcov-report/{config → src/config}/index.ts.html +12 -12
  31. package/coverage/lcov-report/{config → src/config}/projectConfig.ts.html +312 -96
  32. package/coverage/lcov-report/{datasource → src/datasource}/adapter.ts.html +28 -73
  33. package/coverage/lcov-report/{datasource → src/datasource}/datasource.ts.html +191 -104
  34. package/coverage/lcov-report/{datasource → src/datasource}/filesystemAdapter.ts.html +233 -635
  35. package/coverage/lcov-report/{datasource → src/datasource}/index.html +48 -48
  36. package/coverage/lcov-report/{datasource → src/datasource}/index.ts.html +14 -14
  37. package/coverage/lcov-report/src/evaluate/index.html +116 -0
  38. package/coverage/lcov-report/src/evaluate/index.ts.html +814 -0
  39. package/coverage/lcov-report/src/find-duplicate-segments/findDuplicateSegments.ts.html +313 -0
  40. package/coverage/lcov-report/src/find-duplicate-segments/index.html +131 -0
  41. package/coverage/lcov-report/src/find-duplicate-segments/index.ts.html +307 -0
  42. package/coverage/lcov-report/src/find-usage/index.html +116 -0
  43. package/coverage/lcov-report/src/find-usage/index.ts.html +1780 -0
  44. package/coverage/lcov-report/src/generate-code/index.html +131 -0
  45. package/coverage/lcov-report/src/generate-code/index.ts.html +403 -0
  46. package/coverage/lcov-report/{generate-code → src/generate-code}/typescript.ts.html +266 -1361
  47. package/coverage/lcov-report/{generate-code → src}/index.html +38 -23
  48. package/coverage/lcov-report/src/info/index.html +116 -0
  49. package/coverage/lcov-report/src/info/index.ts.html +472 -0
  50. package/coverage/lcov-report/src/init/index.html +116 -0
  51. package/coverage/lcov-report/src/init/index.ts.html +280 -0
  52. package/coverage/lcov-report/{linter → src/linter}/attributeSchema.ts.html +160 -157
  53. package/coverage/lcov-report/{linter → src/linter}/checkCircularDependency.ts.html +25 -25
  54. package/coverage/lcov-report/{linter → src/linter}/checkPercentageExceedingSlot.ts.html +42 -42
  55. package/coverage/lcov-report/{linter → src/linter}/conditionSchema.ts.html +207 -207
  56. package/coverage/lcov-report/{linter → src/linter}/featureSchema.ts.html +462 -471
  57. package/coverage/lcov-report/{linter → src/linter}/groupSchema.ts.html +25 -22
  58. package/coverage/lcov-report/{linter → src/linter}/index.html +129 -99
  59. package/coverage/lcov-report/src/linter/index.ts.html +88 -0
  60. package/coverage/lcov-report/{linter → src/linter}/lintProject.ts.html +740 -332
  61. package/coverage/lcov-report/{linter → src/linter}/mutationNotation.ts.html +130 -130
  62. package/coverage/lcov-report/{linter → src/linter}/printError.ts.html +27 -27
  63. package/coverage/lcov-report/{linter → src/linter}/schema.ts.html +153 -150
  64. package/coverage/lcov-report/{linter → src/linter}/segmentSchema.ts.html +18 -15
  65. package/coverage/lcov-report/src/linter/targetSchema.ts.html +223 -0
  66. package/coverage/lcov-report/{linter → src/linter}/testSchema.ts.html +54 -48
  67. package/coverage/lcov-report/{linter → src/linter}/zodHelpers.ts.html +17 -17
  68. package/coverage/lcov-report/src/list/index.html +131 -0
  69. package/coverage/lcov-report/src/list/index.ts.html +2065 -0
  70. package/coverage/lcov-report/{list → src/list}/matrix.ts.html +43 -58
  71. package/coverage/lcov-report/src/promoter/index.html +116 -0
  72. package/coverage/lcov-report/src/promoter/index.ts.html +3883 -0
  73. package/coverage/lcov-report/src/sets.ts.html +313 -0
  74. package/coverage/lcov-report/src/targeting.ts.html +403 -0
  75. package/coverage/lcov-report/src/tester/cliFormat.ts.html +133 -0
  76. package/coverage/lcov-report/{tester → src/tester}/helpers.ts.html +15 -15
  77. package/coverage/lcov-report/src/tester/index.html +206 -0
  78. package/coverage/lcov-report/src/tester/prettyDuration.ts.html +187 -0
  79. package/coverage/lcov-report/src/tester/printTestResult.ts.html +337 -0
  80. package/coverage/lcov-report/src/tester/testFeature.ts.html +1186 -0
  81. package/coverage/lcov-report/src/tester/testProject.ts.html +1018 -0
  82. package/coverage/lcov-report/src/tester/testSegment.ts.html +316 -0
  83. package/coverage/lcov-report/{utils → src/utils}/extractKeys.ts.html +68 -68
  84. package/coverage/lcov-report/{utils → src/utils}/git.ts.html +44 -68
  85. package/coverage/lcov-report/{utils → src/utils}/index.html +44 -44
  86. package/coverage/lcov-report/{utils → src/utils}/index.ts.html +14 -14
  87. package/coverage/lcov-report/{utils → src/utils}/pretty.ts.html +20 -20
  88. package/coverage/lcov.info +10121 -5723
  89. package/jest.config.js +13 -4
  90. package/lib/assess-distribution/index.d.ts +1 -1
  91. package/lib/assess-distribution/index.js +59 -40
  92. package/lib/assess-distribution/index.js.map +1 -1
  93. package/lib/benchmark/index.d.ts +8 -5
  94. package/lib/benchmark/index.js +82 -65
  95. package/lib/benchmark/index.js.map +1 -1
  96. package/lib/builder/applyContextToConditions.d.ts +5 -0
  97. package/lib/builder/{buildScopedConditions.js → applyContextToConditions.js} +19 -14
  98. package/lib/builder/applyContextToConditions.js.map +1 -0
  99. package/lib/builder/applyContextToDatafile.d.ts +2 -0
  100. package/lib/builder/{buildScopedDatafile.js → applyContextToDatafile.js} +26 -26
  101. package/lib/builder/applyContextToDatafile.js.map +1 -0
  102. package/lib/builder/applyContextToSegments.d.ts +5 -0
  103. package/lib/builder/{buildScopedSegments.js → applyContextToSegments.js} +19 -14
  104. package/lib/builder/applyContextToSegments.js.map +1 -0
  105. package/lib/builder/buildDatafile.d.ts +9 -6
  106. package/lib/builder/buildDatafile.js +86 -51
  107. package/lib/builder/buildDatafile.js.map +1 -1
  108. package/lib/builder/buildProject.d.ts +17 -3
  109. package/lib/builder/buildProject.js +151 -59
  110. package/lib/builder/buildProject.js.map +1 -1
  111. package/lib/builder/buildRuntimeDatafiles.d.ts +12 -0
  112. package/lib/builder/buildRuntimeDatafiles.js +35 -0
  113. package/lib/builder/buildRuntimeDatafiles.js.map +1 -0
  114. package/lib/builder/getFeatureRanges.js +34 -1
  115. package/lib/builder/getFeatureRanges.js.map +1 -1
  116. package/lib/builder/hashes.js +34 -1
  117. package/lib/builder/hashes.js.map +1 -1
  118. package/lib/builder/index.d.ts +0 -1
  119. package/lib/builder/index.js +0 -1
  120. package/lib/builder/index.js.map +1 -1
  121. package/lib/cli/cli.js +0 -4
  122. package/lib/cli/cli.js.map +1 -1
  123. package/lib/cli/plugins.js +7 -2
  124. package/lib/cli/plugins.js.map +1 -1
  125. package/lib/config/projectConfig.d.ts +17 -17
  126. package/lib/config/projectConfig.js +101 -15
  127. package/lib/config/projectConfig.js.map +1 -1
  128. package/lib/datasource/adapter.d.ts +7 -9
  129. package/lib/datasource/adapter.js +0 -7
  130. package/lib/datasource/adapter.js.map +1 -1
  131. package/lib/datasource/datasource.d.ts +15 -5
  132. package/lib/datasource/datasource.js +37 -9
  133. package/lib/datasource/datasource.js.map +1 -1
  134. package/lib/datasource/filesystemAdapter.d.ts +4 -10
  135. package/lib/datasource/filesystemAdapter.js +111 -149
  136. package/lib/datasource/filesystemAdapter.js.map +1 -1
  137. package/lib/evaluate/index.d.ts +1 -7
  138. package/lib/evaluate/index.js +81 -67
  139. package/lib/evaluate/index.js.map +1 -1
  140. package/lib/find-duplicate-segments/findDuplicateSegments.js +34 -1
  141. package/lib/find-duplicate-segments/findDuplicateSegments.js.map +1 -1
  142. package/lib/find-duplicate-segments/index.js +21 -13
  143. package/lib/find-duplicate-segments/index.js.map +1 -1
  144. package/lib/find-usage/index.js +57 -41
  145. package/lib/find-usage/index.js.map +1 -1
  146. package/lib/generate-code/index.d.ts +1 -1
  147. package/lib/generate-code/index.js +64 -21
  148. package/lib/generate-code/index.js.map +1 -1
  149. package/lib/generate-code/typescript.d.ts +1 -1
  150. package/lib/generate-code/typescript.js +59 -333
  151. package/lib/generate-code/typescript.js.map +1 -1
  152. package/lib/index.d.ts +2 -1
  153. package/lib/index.js +2 -1
  154. package/lib/index.js.map +1 -1
  155. package/lib/info/index.js +57 -16
  156. package/lib/info/index.js.map +1 -1
  157. package/lib/init/index.d.ts +2 -2
  158. package/lib/init/index.js +39 -3
  159. package/lib/init/index.js.map +1 -1
  160. package/lib/linter/attributeSchema.d.ts +1 -0
  161. package/lib/linter/attributeSchema.js +1 -0
  162. package/lib/linter/attributeSchema.js.map +1 -1
  163. package/lib/linter/conditionSchema.js +5 -5
  164. package/lib/linter/conditionSchema.js.map +1 -1
  165. package/lib/linter/featureSchema.d.ts +4 -1
  166. package/lib/linter/featureSchema.js +15 -13
  167. package/lib/linter/featureSchema.js.map +1 -1
  168. package/lib/linter/groupSchema.d.ts +1 -0
  169. package/lib/linter/groupSchema.js +1 -0
  170. package/lib/linter/groupSchema.js.map +1 -1
  171. package/lib/linter/lintProject.d.ts +1 -3
  172. package/lib/linter/lintProject.js +198 -68
  173. package/lib/linter/lintProject.js.map +1 -1
  174. package/lib/linter/schema.js +1 -0
  175. package/lib/linter/schema.js.map +1 -1
  176. package/lib/linter/segmentSchema.d.ts +1 -0
  177. package/lib/linter/segmentSchema.js +1 -0
  178. package/lib/linter/segmentSchema.js.map +1 -1
  179. package/lib/linter/targetSchema.d.ts +16 -0
  180. package/lib/linter/targetSchema.js +40 -0
  181. package/lib/linter/targetSchema.js.map +1 -0
  182. package/lib/linter/testSchema.d.ts +4 -3
  183. package/lib/linter/testSchema.js +9 -4
  184. package/lib/linter/testSchema.js.map +1 -1
  185. package/lib/list/index.d.ts +1 -0
  186. package/lib/list/index.js +131 -12
  187. package/lib/list/index.js.map +1 -1
  188. package/lib/list/matrix.js +3 -7
  189. package/lib/list/matrix.js.map +1 -1
  190. package/lib/promoter/index.d.ts +50 -0
  191. package/lib/promoter/index.js +880 -0
  192. package/lib/promoter/index.js.map +1 -0
  193. package/lib/sets.d.ts +11 -0
  194. package/lib/sets.js +81 -0
  195. package/lib/sets.js.map +1 -0
  196. package/lib/targeting.d.ts +14 -0
  197. package/lib/targeting.js +82 -0
  198. package/lib/targeting.js.map +1 -0
  199. package/lib/tester/cliFormat.d.ts +7 -1
  200. package/lib/tester/cliFormat.js +11 -2
  201. package/lib/tester/cliFormat.js.map +1 -1
  202. package/lib/tester/printTestResult.js +2 -2
  203. package/lib/tester/printTestResult.js.map +1 -1
  204. package/lib/tester/testFeature.d.ts +0 -1
  205. package/lib/tester/testFeature.js +8 -25
  206. package/lib/tester/testFeature.js.map +1 -1
  207. package/lib/tester/testProject.d.ts +2 -3
  208. package/lib/tester/testProject.js +93 -86
  209. package/lib/tester/testProject.js.map +1 -1
  210. package/lib/tester/testSegment.d.ts +1 -1
  211. package/lib/tester/testSegment.js +3 -21
  212. package/lib/tester/testSegment.js.map +1 -1
  213. package/lib/utils/git.js +45 -19
  214. package/lib/utils/git.js.map +1 -1
  215. package/package.json +12 -12
  216. package/src/assess-distribution/index.ts +72 -52
  217. package/src/benchmark/index.ts +124 -91
  218. package/src/builder/{buildScopedConditions.spec.ts → applyContextToConditions.spec.ts} +160 -142
  219. package/src/builder/{buildScopedConditions.ts → applyContextToConditions.ts} +19 -14
  220. package/src/builder/{buildScopedDatafile.spec.ts → applyContextToDatafile.spec.ts} +141 -81
  221. package/src/builder/{buildScopedDatafile.ts → applyContextToDatafile.ts} +33 -33
  222. package/src/builder/{buildScopedSegments.spec.ts → applyContextToSegments.spec.ts} +171 -151
  223. package/src/builder/{buildScopedSegments.ts → applyContextToSegments.ts} +26 -14
  224. package/src/builder/buildDatafile.spec.ts +192 -14
  225. package/src/builder/buildDatafile.ts +74 -64
  226. package/src/builder/buildProject.ts +171 -86
  227. package/src/builder/buildRuntimeDatafiles.ts +57 -0
  228. package/src/builder/index.ts +0 -1
  229. package/src/cli/cli.ts +0 -5
  230. package/src/cli/plugins.ts +7 -2
  231. package/src/config/projectConfig.spec.ts +171 -8
  232. package/src/config/projectConfig.ts +100 -28
  233. package/src/datasource/adapter.ts +8 -23
  234. package/src/datasource/datasource.ts +50 -21
  235. package/src/datasource/filesystemAdapter.spec.ts +133 -74
  236. package/src/datasource/filesystemAdapter.ts +93 -227
  237. package/src/evaluate/index.ts +109 -97
  238. package/src/find-duplicate-segments/index.ts +34 -16
  239. package/src/find-usage/index.ts +89 -44
  240. package/src/generate-code/index.ts +36 -24
  241. package/src/generate-code/typescript.spec.ts +106 -0
  242. package/src/generate-code/typescript.ts +33 -398
  243. package/src/index.ts +2 -1
  244. package/src/info/index.ts +72 -16
  245. package/src/init/index.ts +1 -1
  246. package/src/linter/attributeSchema.ts +1 -0
  247. package/src/linter/conditionSchema.spec.ts +23 -3
  248. package/src/linter/conditionSchema.ts +5 -5
  249. package/src/linter/featureSchema.spec.ts +107 -18
  250. package/src/linter/featureSchema.ts +25 -28
  251. package/src/linter/groupSchema.ts +1 -0
  252. package/src/linter/lintProject.spec.ts +131 -92
  253. package/src/linter/lintProject.ts +233 -97
  254. package/src/linter/schema.ts +1 -0
  255. package/src/linter/segmentSchema.spec.ts +5 -3
  256. package/src/linter/segmentSchema.ts +1 -0
  257. package/src/linter/targetSchema.spec.ts +159 -0
  258. package/src/linter/targetSchema.ts +46 -0
  259. package/src/linter/testSchema.spec.ts +70 -5
  260. package/src/linter/testSchema.ts +12 -10
  261. package/src/list/index.spec.ts +135 -0
  262. package/src/list/index.ts +188 -12
  263. package/src/list/matrix.ts +3 -8
  264. package/src/promoter/index.spec.ts +617 -0
  265. package/src/promoter/index.ts +1266 -0
  266. package/src/sets.ts +76 -0
  267. package/src/targeting.spec.ts +74 -0
  268. package/src/targeting.ts +106 -0
  269. package/src/tester/cliFormat.ts +11 -1
  270. package/src/tester/printTestResult.ts +12 -3
  271. package/src/tester/testFeature.ts +10 -36
  272. package/src/tester/testProject.spec.ts +50 -0
  273. package/src/tester/testProject.ts +89 -140
  274. package/src/tester/testSegment.ts +5 -22
  275. package/src/utils/git.ts +13 -21
  276. package/tsconfig.cjs.json +5 -1
  277. package/tsconfig.typecheck.json +9 -0
  278. package/coverage/lcov-report/builder/convertToV1.ts.html +0 -583
  279. package/lib/builder/allocator.spec.d.ts +0 -1
  280. package/lib/builder/allocator.spec.js +0 -85
  281. package/lib/builder/allocator.spec.js.map +0 -1
  282. package/lib/builder/buildDatafile.spec.d.ts +0 -1
  283. package/lib/builder/buildDatafile.spec.js +0 -233
  284. package/lib/builder/buildDatafile.spec.js.map +0 -1
  285. package/lib/builder/buildScopedConditions.d.ts +0 -5
  286. package/lib/builder/buildScopedConditions.js.map +0 -1
  287. package/lib/builder/buildScopedConditions.spec.d.ts +0 -1
  288. package/lib/builder/buildScopedConditions.spec.js +0 -2167
  289. package/lib/builder/buildScopedConditions.spec.js.map +0 -1
  290. package/lib/builder/buildScopedDatafile.d.ts +0 -2
  291. package/lib/builder/buildScopedDatafile.js.map +0 -1
  292. package/lib/builder/buildScopedDatafile.spec.d.ts +0 -1
  293. package/lib/builder/buildScopedDatafile.spec.js +0 -2277
  294. package/lib/builder/buildScopedDatafile.spec.js.map +0 -1
  295. package/lib/builder/buildScopedSegments.d.ts +0 -5
  296. package/lib/builder/buildScopedSegments.js.map +0 -1
  297. package/lib/builder/buildScopedSegments.spec.d.ts +0 -1
  298. package/lib/builder/buildScopedSegments.spec.js +0 -1062
  299. package/lib/builder/buildScopedSegments.spec.js.map +0 -1
  300. package/lib/builder/convertToV1.d.ts +0 -10
  301. package/lib/builder/convertToV1.js +0 -119
  302. package/lib/builder/convertToV1.js.map +0 -1
  303. package/lib/builder/mutateVariables.spec.d.ts +0 -1
  304. package/lib/builder/mutateVariables.spec.js +0 -1074
  305. package/lib/builder/mutateVariables.spec.js.map +0 -1
  306. package/lib/builder/mutator.spec.d.ts +0 -1
  307. package/lib/builder/mutator.spec.js +0 -368
  308. package/lib/builder/mutator.spec.js.map +0 -1
  309. package/lib/builder/revision.spec.d.ts +0 -1
  310. package/lib/builder/revision.spec.js +0 -21
  311. package/lib/builder/revision.spec.js.map +0 -1
  312. package/lib/builder/traffic.spec.d.ts +0 -1
  313. package/lib/builder/traffic.spec.js +0 -872
  314. package/lib/builder/traffic.spec.js.map +0 -1
  315. package/lib/config/projectConfig.spec.d.ts +0 -1
  316. package/lib/config/projectConfig.spec.js +0 -24
  317. package/lib/config/projectConfig.spec.js.map +0 -1
  318. package/lib/datasource/filesystemAdapter.spec.d.ts +0 -1
  319. package/lib/datasource/filesystemAdapter.spec.js +0 -88
  320. package/lib/datasource/filesystemAdapter.spec.js.map +0 -1
  321. package/lib/generate-code/typescript.spec.d.ts +0 -1
  322. package/lib/generate-code/typescript.spec.js +0 -78
  323. package/lib/generate-code/typescript.spec.js.map +0 -1
  324. package/lib/linter/attributeSchema.spec.d.ts +0 -1
  325. package/lib/linter/attributeSchema.spec.js +0 -266
  326. package/lib/linter/attributeSchema.spec.js.map +0 -1
  327. package/lib/linter/conditionSchema.spec.d.ts +0 -1
  328. package/lib/linter/conditionSchema.spec.js +0 -380
  329. package/lib/linter/conditionSchema.spec.js.map +0 -1
  330. package/lib/linter/featureSchema.spec.d.ts +0 -1
  331. package/lib/linter/featureSchema.spec.js +0 -1552
  332. package/lib/linter/featureSchema.spec.js.map +0 -1
  333. package/lib/linter/lintProject.spec.d.ts +0 -1
  334. package/lib/linter/lintProject.spec.js +0 -211
  335. package/lib/linter/lintProject.spec.js.map +0 -1
  336. package/lib/linter/mutationNotation.spec.d.ts +0 -1
  337. package/lib/linter/mutationNotation.spec.js +0 -598
  338. package/lib/linter/mutationNotation.spec.js.map +0 -1
  339. package/lib/linter/schema.spec.d.ts +0 -1
  340. package/lib/linter/schema.spec.js +0 -535
  341. package/lib/linter/schema.spec.js.map +0 -1
  342. package/lib/linter/segmentSchema.spec.d.ts +0 -1
  343. package/lib/linter/segmentSchema.spec.js +0 -303
  344. package/lib/linter/segmentSchema.spec.js.map +0 -1
  345. package/lib/linter/testSchema.spec.d.ts +0 -1
  346. package/lib/linter/testSchema.spec.js +0 -162
  347. package/lib/linter/testSchema.spec.js.map +0 -1
  348. package/lib/list/matrix.spec.d.ts +0 -1
  349. package/lib/list/matrix.spec.js +0 -42
  350. package/lib/list/matrix.spec.js.map +0 -1
  351. package/lib/site/exportSite.d.ts +0 -2
  352. package/lib/site/exportSite.js +0 -30
  353. package/lib/site/exportSite.js.map +0 -1
  354. package/lib/site/generateHistory.d.ts +0 -3
  355. package/lib/site/generateHistory.js +0 -31
  356. package/lib/site/generateHistory.js.map +0 -1
  357. package/lib/site/generateSiteSearchIndex.d.ts +0 -4
  358. package/lib/site/generateSiteSearchIndex.js +0 -195
  359. package/lib/site/generateSiteSearchIndex.js.map +0 -1
  360. package/lib/site/getLastModifiedFromHistory.d.ts +0 -2
  361. package/lib/site/getLastModifiedFromHistory.js +0 -18
  362. package/lib/site/getLastModifiedFromHistory.js.map +0 -1
  363. package/lib/site/getOwnerAndRepoFromUrl.d.ts +0 -4
  364. package/lib/site/getOwnerAndRepoFromUrl.js +0 -20
  365. package/lib/site/getOwnerAndRepoFromUrl.js.map +0 -1
  366. package/lib/site/getRelativePaths.d.ts +0 -6
  367. package/lib/site/getRelativePaths.js +0 -15
  368. package/lib/site/getRelativePaths.js.map +0 -1
  369. package/lib/site/getRepoDetails.d.ts +0 -8
  370. package/lib/site/getRepoDetails.js +0 -48
  371. package/lib/site/getRepoDetails.js.map +0 -1
  372. package/lib/site/index.d.ts +0 -2
  373. package/lib/site/index.js +0 -43
  374. package/lib/site/index.js.map +0 -1
  375. package/lib/site/serveSite.d.ts +0 -2
  376. package/lib/site/serveSite.js +0 -54
  377. package/lib/site/serveSite.js.map +0 -1
  378. package/lib/tester/helpers.spec.d.ts +0 -1
  379. package/lib/tester/helpers.spec.js +0 -115
  380. package/lib/tester/helpers.spec.js.map +0 -1
  381. package/src/builder/convertToV1.ts +0 -166
  382. package/src/site/exportSite.ts +0 -42
  383. package/src/site/generateHistory.ts +0 -40
  384. package/src/site/generateSiteSearchIndex.ts +0 -258
  385. package/src/site/getLastModifiedFromHistory.ts +0 -21
  386. package/src/site/getOwnerAndRepoFromUrl.ts +0 -17
  387. package/src/site/getRelativePaths.ts +0 -24
  388. package/src/site/getRepoDetails.ts +0 -62
  389. package/src/site/index.ts +0 -46
  390. package/src/site/serveSite.ts +0 -58
@@ -1,13 +1,14 @@
1
1
  import { randomBytes } from "crypto";
2
2
 
3
3
  import type { FeatureKey, AttributeKey, Context, DatafileContent } from "@featurevisor/types";
4
- import { createInstance } from "@featurevisor/sdk";
4
+ import { createFeaturevisor } from "@featurevisor/sdk";
5
5
 
6
6
  import { Dependencies } from "../dependencies";
7
- import { buildDatafile } from "../builder";
8
- import { SCHEMA_VERSION } from "../config";
7
+ import { buildRuntimeDatafiles } from "../builder/buildRuntimeDatafiles";
9
8
  import { prettyPercentage, prettyNumber } from "../utils";
10
9
  import { Plugin } from "../cli";
10
+ import { getProjectSetExecutions, printSetHeader } from "../sets";
11
+ import { CLI_COLOR_CYAN, CLI_FORMAT_BOLD, CLI_FORMAT_GREEN, colorize } from "../tester/cliFormat";
11
12
 
12
13
  const UUID_LENGTHS = [4, 2, 2, 2, 6];
13
14
 
@@ -47,7 +48,7 @@ function printCounts(evaluations: EvaluationsCount, n: number, sort = true) {
47
48
 
48
49
  for (const [value, count] of entries) {
49
50
  console.log(
50
- ` - ${value}:`.padEnd(longestValueLength + 5, " "),
51
+ ` ${colorize("•", CLI_COLOR_CYAN)} ${value}:`.padEnd(longestValueLength + 14, " "),
51
52
  `\t${prettyNumber(count).padStart(prettyHighestCountLength, " ")}`,
52
53
  `\t${prettyPercentage(count, n).padStart(7, " ")}`,
53
54
  );
@@ -71,46 +72,34 @@ export interface AssessDistributionOptions {
71
72
  feature: FeatureKey;
72
73
  context: Context;
73
74
  n: number;
74
- schemaVersion?: string;
75
75
  inflate?: number;
76
76
 
77
77
  populateUuid?: AttributeKey[];
78
78
  verbose?: boolean;
79
+ target?: string | string[];
79
80
  }
80
81
 
81
- export async function assessDistribution(deps: Dependencies, options: AssessDistributionOptions) {
82
- const { projectConfig, datasource } = deps;
83
-
84
- console.log(`\nAssessing distribution for feature: "${options.feature}"...`);
85
-
86
- /**
87
- * Prepare datafile
88
- */
89
- const datafileBuildStart = Date.now();
90
- console.log(`\n\nBuilding datafile containing all features for "${options.environment}"...`);
91
- const existingState = await datasource.readState(options.environment || false);
92
- const datafileContent = await buildDatafile(
93
- projectConfig,
94
- datasource,
95
- {
96
- schemaVersion: options.schemaVersion || SCHEMA_VERSION,
97
- revision: "include-all-features",
98
- environment: options.environment || false,
99
- inflate: options.inflate,
100
- },
101
- existingState,
102
- );
103
- const datafileBuildDuration = Date.now() - datafileBuildStart;
104
- console.log(`Datafile build duration: ${datafileBuildDuration}ms`);
82
+ async function assessDistributionWithDatafile(
83
+ datafileContent: DatafileContent,
84
+ options: AssessDistributionOptions,
85
+ target?: string,
86
+ ) {
87
+ console.log("");
88
+ console.log(CLI_FORMAT_BOLD, "Assess Featurevisor distribution");
89
+ console.log(` ${colorize("Feature", CLI_COLOR_CYAN)}: ${options.feature}`);
90
+ console.log(` ${colorize("Environment", CLI_COLOR_CYAN)}: ${options.environment || false}`);
91
+ if (target) console.log(` ${colorize("Target", CLI_COLOR_CYAN)}: ${target}`);
92
+ console.log(` ${colorize("Iterations", CLI_COLOR_CYAN)}: ${prettyNumber(options.n)}`);
105
93
 
106
94
  /**
107
95
  * Initialize SDK
108
96
  */
109
- const f = createInstance({
97
+ const f = createFeaturevisor({
110
98
  datafile: datafileContent as DatafileContent,
111
99
  logLevel: "warn",
112
100
  });
113
- console.log("\n\n...SDK initialized\n");
101
+ console.log("");
102
+ console.log(CLI_FORMAT_GREEN, "SDK initialized");
114
103
 
115
104
  /**
116
105
  * Evaluations
@@ -129,7 +118,8 @@ export async function assessDistribution(deps: Dependencies, options: AssessDist
129
118
 
130
119
  const variationEvaluations: EvaluationsCount = {};
131
120
 
132
- console.log(`\nEvaluating ${prettyNumber(options.n)} times...`);
121
+ console.log("");
122
+ console.log(`Evaluating ${prettyNumber(options.n)} times...`);
133
123
 
134
124
  for (let i = 0; i < options.n; i++) {
135
125
  const context = createContext(options.context, options.populateUuid);
@@ -162,36 +152,66 @@ export async function assessDistribution(deps: Dependencies, options: AssessDist
162
152
  * Print results
163
153
  */
164
154
 
165
- console.log("\n\nFlag evaluations:\n");
155
+ console.log("");
156
+ console.log(CLI_FORMAT_BOLD, "Flag evaluations");
157
+ console.log("");
166
158
  printCounts(flagEvaluations, options.n);
167
159
 
168
160
  if (hasVariations) {
169
- console.log("\n\nVariation evaluations:\n");
161
+ console.log("");
162
+ console.log(CLI_FORMAT_BOLD, "Variation evaluations");
163
+ console.log("");
170
164
  printCounts(variationEvaluations, options.n);
171
165
  }
172
166
  }
173
167
 
168
+ export async function assessDistribution(deps: Dependencies, options: AssessDistributionOptions) {
169
+ const datafileBuildStart = Date.now();
170
+ const datafiles = await buildRuntimeDatafiles(deps, {
171
+ environment: options.environment || false,
172
+ target: options.target,
173
+ revision: "include-all-features",
174
+ inflate: options.inflate,
175
+ });
176
+ const datafileBuildDuration = Date.now() - datafileBuildStart;
177
+
178
+ console.log("");
179
+ console.log(`Building ${datafiles.length} datafile${datafiles.length === 1 ? "" : "s"}...`);
180
+ console.log(` ${colorize("Build duration", CLI_COLOR_CYAN)}: ${datafileBuildDuration}ms`);
181
+
182
+ for (const entry of datafiles) {
183
+ await assessDistributionWithDatafile(entry.datafile, options, entry.target);
184
+ }
185
+ }
186
+
174
187
  export const assessDistributionPlugin: Plugin = {
175
188
  command: "assess-distribution",
176
189
  handler: async ({ rootDirectoryPath, projectConfig, datasource, parsed }) => {
177
- await assessDistribution(
178
- {
179
- rootDirectoryPath,
180
- projectConfig,
181
- datasource,
182
- options: parsed,
183
- },
184
- {
185
- environment: parsed.environment,
186
- feature: parsed.feature,
187
- n: parseInt(parsed.n, 10) || 1,
188
- context: parsed.context ? JSON.parse(parsed.context) : {},
189
- populateUuid: Array.isArray(parsed.populateUuid)
190
- ? parsed.populateUuid
191
- : [parsed.populateUuid as string].filter(Boolean),
192
- verbose: parsed.verbose,
193
- },
194
- );
190
+ const executions = await getProjectSetExecutions(projectConfig, datasource, parsed.set);
191
+
192
+ for (const execution of executions) {
193
+ printSetHeader(projectConfig, execution.set);
194
+
195
+ await assessDistribution(
196
+ {
197
+ rootDirectoryPath,
198
+ projectConfig: execution.projectConfig,
199
+ datasource: execution.datasource,
200
+ options: parsed,
201
+ },
202
+ {
203
+ environment: parsed.environment,
204
+ feature: parsed.feature,
205
+ n: parseInt(parsed.n, 10) || 1,
206
+ context: parsed.context ? JSON.parse(parsed.context) : {},
207
+ populateUuid: Array.isArray(parsed.populateUuid)
208
+ ? parsed.populateUuid
209
+ : [parsed.populateUuid as string].filter(Boolean),
210
+ verbose: parsed.verbose,
211
+ target: parsed.target,
212
+ },
213
+ );
214
+ }
195
215
  },
196
216
  examples: [
197
217
  {
@@ -1,79 +1,83 @@
1
1
  import type { Context, DatafileContent } from "@featurevisor/types";
2
- import { FeaturevisorInstance, createInstance } from "@featurevisor/sdk";
2
+ import { createFeaturevisor } from "@featurevisor/sdk";
3
+ import type { Featurevisor } from "@featurevisor/sdk";
3
4
 
4
- import { SCHEMA_VERSION } from "../config";
5
- import { buildDatafile } from "../builder";
5
+ import { buildRuntimeDatafiles } from "../builder/buildRuntimeDatafiles";
6
6
  import { Dependencies } from "../dependencies";
7
7
  import { prettyDuration } from "../tester/prettyDuration";
8
8
  import { Plugin } from "../cli";
9
+ import { getProjectSetExecutions, printSetHeader } from "../sets";
10
+ import { CLI_COLOR_CYAN, CLI_FORMAT_BOLD, CLI_FORMAT_GREEN, colorize } from "../tester/cliFormat";
9
11
 
10
12
  export interface BenchmarkOutput {
11
13
  value: any;
12
14
  duration: number; // ms
15
+ minDuration: number; // ms
16
+ averageDuration: number; // ms
17
+ maxDuration: number; // ms
13
18
  }
14
19
 
15
- export function benchmarkFeatureFlag(
16
- f: FeaturevisorInstance,
17
- featureKey: string,
18
- context: Record<string, unknown>,
19
- n: number,
20
- ): BenchmarkOutput {
21
- const start = Date.now();
20
+ function benchmarkEvaluation(n: number, evaluate: () => any): BenchmarkOutput {
22
21
  let value: any;
22
+ let totalDurationNs = 0n;
23
+ let minDurationNs: bigint | undefined;
24
+ let maxDurationNs = 0n;
23
25
 
24
26
  for (let i = 0; i < n; i++) {
25
- value = f.isEnabled(featureKey, context as Context);
27
+ const start = process.hrtime.bigint();
28
+ value = evaluate();
29
+ const durationNs = process.hrtime.bigint() - start;
30
+
31
+ totalDurationNs += durationNs;
32
+ if (typeof minDurationNs === "undefined" || durationNs < minDurationNs) {
33
+ minDurationNs = durationNs;
34
+ }
35
+ if (durationNs > maxDurationNs) {
36
+ maxDurationNs = durationNs;
37
+ }
26
38
  }
27
39
 
28
- const duration = Date.now() - start;
40
+ const duration = Number(totalDurationNs) / 1_000_000;
29
41
 
30
42
  return {
31
43
  value,
32
44
  duration,
45
+ minDuration: Number(minDurationNs || 0n) / 1_000_000,
46
+ averageDuration: duration / n,
47
+ maxDuration: Number(maxDurationNs) / 1_000_000,
33
48
  };
34
49
  }
35
50
 
36
- export function benchmarkFeatureVariation(
37
- f: FeaturevisorInstance,
51
+ function formatDurationMs(duration: number): string {
52
+ return `${duration.toFixed(6)}ms`;
53
+ }
54
+
55
+ export function benchmarkFeatureFlag(
56
+ f: Featurevisor,
38
57
  featureKey: string,
39
58
  context: Record<string, unknown>,
40
59
  n: number,
41
60
  ): BenchmarkOutput {
42
- const start = Date.now();
43
- let value: any;
44
-
45
- for (let i = 0; i < n; i++) {
46
- value = f.getVariation(featureKey, context as Context);
47
- }
48
-
49
- const duration = Date.now() - start;
61
+ return benchmarkEvaluation(n, () => f.isEnabled(featureKey, context as Context));
62
+ }
50
63
 
51
- return {
52
- value,
53
- duration,
54
- };
64
+ export function benchmarkFeatureVariation(
65
+ f: Featurevisor,
66
+ featureKey: string,
67
+ context: Record<string, unknown>,
68
+ n: number,
69
+ ): BenchmarkOutput {
70
+ return benchmarkEvaluation(n, () => f.getVariation(featureKey, context as Context));
55
71
  }
56
72
 
57
73
  export function benchmarkFeatureVariable(
58
- f: FeaturevisorInstance,
74
+ f: Featurevisor,
59
75
  featureKey: string,
60
76
  variableKey: string,
61
77
  context: Record<string, unknown>,
62
78
  n: number,
63
79
  ): BenchmarkOutput {
64
- const start = Date.now();
65
- let value: any;
66
-
67
- for (let i = 0; i < n; i++) {
68
- value = f.getVariable(featureKey, variableKey, context as Context);
69
- }
70
-
71
- const duration = Date.now() - start;
72
-
73
- return {
74
- value,
75
- duration,
76
- };
80
+ return benchmarkEvaluation(n, () => f.getVariable(featureKey, variableKey, context as Context));
77
81
  }
78
82
 
79
83
  export interface BenchmarkOptions {
@@ -83,55 +87,46 @@ export interface BenchmarkOptions {
83
87
  context: Record<string, unknown>;
84
88
  variation?: boolean;
85
89
  variable?: string;
86
- schemaVersion?: string;
87
90
  inflate?: number;
91
+ target?: string | string[];
88
92
  }
89
93
 
90
- export async function benchmarkFeature(
91
- deps: Dependencies,
94
+ async function benchmarkFeatureWithDatafile(
95
+ datafileContent: DatafileContent,
92
96
  options: BenchmarkOptions,
97
+ target?: string,
93
98
  ): Promise<void> {
94
- const { datasource, projectConfig } = deps;
95
-
96
- console.log("");
97
- console.log(`Running benchmark for feature "${options.feature}"...`);
98
-
99
99
  console.log("");
100
-
101
- console.log(`Building datafile containing all features for "${options.environment}"...`);
102
- const datafileBuildStart = Date.now();
103
- const existingState = await datasource.readState(options.environment || false);
104
- const datafileContent = await buildDatafile(
105
- projectConfig,
106
- datasource,
107
- {
108
- schemaVersion: options.schemaVersion || SCHEMA_VERSION,
109
- revision: "include-all-features",
110
- environment: options.environment || false,
111
- inflate: options.inflate,
112
- },
113
- existingState,
100
+ console.log(CLI_FORMAT_BOLD, "Benchmark Featurevisor feature");
101
+ console.log(` ${colorize("Feature", CLI_COLOR_CYAN)}: ${options.feature}`);
102
+ console.log(` ${colorize("Environment", CLI_COLOR_CYAN)}: ${options.environment || false}`);
103
+ if (target) console.log(` ${colorize("Target", CLI_COLOR_CYAN)}: ${target}`);
104
+ console.log(` ${colorize("Iterations", CLI_COLOR_CYAN)}: ${options.n}`);
105
+
106
+ console.log(
107
+ ` ${colorize("Datafile size", CLI_COLOR_CYAN)}: ${(JSON.stringify(datafileContent).length / 1024).toFixed(2)} kB`,
114
108
  );
115
- const datafileBuildDuration = Date.now() - datafileBuildStart;
116
- console.log(`Datafile build duration: ${datafileBuildDuration}ms`);
117
- console.log(`Datafile size: ${(JSON.stringify(datafileContent).length / 1024).toFixed(2)} kB`);
118
109
 
119
110
  if (options.inflate) {
120
111
  console.log("");
121
- console.log("Features count:", Object.keys(datafileContent.features).length);
122
- console.log("Segments count:", Object.keys(datafileContent.segments).length);
112
+ console.log(
113
+ ` ${colorize("Features count", CLI_COLOR_CYAN)}: ${Object.keys(datafileContent.features).length}`,
114
+ );
115
+ console.log(
116
+ ` ${colorize("Segments count", CLI_COLOR_CYAN)}: ${Object.keys(datafileContent.segments).length}`,
117
+ );
123
118
  }
124
119
 
125
120
  console.log("");
126
121
 
127
- const f = createInstance({
122
+ const f = createFeaturevisor({
128
123
  datafile: datafileContent as DatafileContent,
129
124
  logLevel: "warn",
130
125
  });
131
- console.log("...SDK initialized");
126
+ console.log(CLI_FORMAT_GREEN, "SDK initialized");
132
127
 
133
128
  console.log("");
134
- console.log(`Against context: ${JSON.stringify(options.context)}`);
129
+ console.log(` ${colorize("Context", CLI_COLOR_CYAN)}: ${JSON.stringify(options.context)}`);
135
130
 
136
131
  let output: BenchmarkOutput;
137
132
  if (options.variable) {
@@ -156,32 +151,70 @@ export async function benchmarkFeature(
156
151
 
157
152
  console.log("");
158
153
 
159
- console.log(`Evaluated value : ${JSON.stringify(output.value)}`);
160
- console.log(`Total duration : ${prettyDuration(output.duration)}`);
161
- console.log(`Average duration: ${prettyDuration(output.duration / options.n)}`);
154
+ console.log(` ${colorize("Evaluated value", CLI_COLOR_CYAN)}: ${JSON.stringify(output.value)}`);
155
+ console.log(
156
+ ` ${colorize("Total duration", CLI_COLOR_CYAN)}: ${prettyDuration(output.duration)}`,
157
+ );
158
+ console.log(
159
+ ` ${colorize("Minimum duration", CLI_COLOR_CYAN)}: ${formatDurationMs(output.minDuration)}`,
160
+ );
161
+ console.log(
162
+ ` ${colorize("Average duration", CLI_COLOR_CYAN)}: ${formatDurationMs(output.averageDuration)}`,
163
+ );
164
+ console.log(
165
+ ` ${colorize("Maximum duration", CLI_COLOR_CYAN)}: ${formatDurationMs(output.maxDuration)}`,
166
+ );
167
+ }
168
+
169
+ export async function benchmarkFeature(
170
+ deps: Dependencies,
171
+ options: BenchmarkOptions,
172
+ ): Promise<void> {
173
+ const datafileBuildStart = Date.now();
174
+ const datafiles = await buildRuntimeDatafiles(deps, {
175
+ environment: options.environment || false,
176
+ target: options.target,
177
+ revision: "include-all-features",
178
+ inflate: options.inflate,
179
+ });
180
+ const datafileBuildDuration = Date.now() - datafileBuildStart;
181
+
182
+ console.log("");
183
+ console.log(`Building ${datafiles.length} datafile${datafiles.length === 1 ? "" : "s"}...`);
184
+ console.log(` ${colorize("Build duration", CLI_COLOR_CYAN)}: ${datafileBuildDuration}ms`);
185
+
186
+ for (const entry of datafiles) {
187
+ await benchmarkFeatureWithDatafile(entry.datafile, options, entry.target);
188
+ }
162
189
  }
163
190
 
164
191
  export const benchmarkPlugin: Plugin = {
165
192
  command: "benchmark",
166
193
  handler: async ({ rootDirectoryPath, projectConfig, datasource, parsed }) => {
167
- await benchmarkFeature(
168
- {
169
- rootDirectoryPath,
170
- projectConfig,
171
- datasource,
172
- options: parsed,
173
- },
174
- {
175
- environment: parsed.environment,
176
- feature: parsed.feature,
177
- n: parseInt(parsed.n, 10) || 1,
178
- context: parsed.context ? JSON.parse(parsed.context) : {},
179
- variation: parsed.variation || undefined,
180
- variable: parsed.variable || undefined,
181
- schemaVersion: parsed.schemaVersion || undefined,
182
- inflate: parseInt(parsed.inflate, 10) || undefined,
183
- },
184
- );
194
+ const executions = await getProjectSetExecutions(projectConfig, datasource, parsed.set);
195
+
196
+ for (const execution of executions) {
197
+ printSetHeader(projectConfig, execution.set);
198
+
199
+ await benchmarkFeature(
200
+ {
201
+ rootDirectoryPath,
202
+ projectConfig: execution.projectConfig,
203
+ datasource: execution.datasource,
204
+ options: parsed,
205
+ },
206
+ {
207
+ environment: parsed.environment,
208
+ feature: parsed.feature,
209
+ n: parseInt(parsed.n, 10) || 1,
210
+ context: parsed.context ? JSON.parse(parsed.context) : {},
211
+ variation: parsed.variation || undefined,
212
+ variable: parsed.variable || undefined,
213
+ inflate: parseInt(parsed.inflate, 10) || undefined,
214
+ target: parsed.target,
215
+ },
216
+ );
217
+ }
185
218
  },
186
219
  examples: [
187
220
  {